summaryrefslogtreecommitdiffstats
path: root/src/shader_recompiler/backend/spirv/emit_context.cpp
diff options
context:
space:
mode:
authorReinUsesLisp <reinuseslisp@airmail.cc>2021-03-27 08:59:58 +0100
committerameerj <52414509+ameerj@users.noreply.github.com>2021-07-23 03:51:24 +0200
commitdbd882ddeb1a1a9233c0085d0b8ccb022db385b2 (patch)
tree5a8456364cc41a0a53acf93e22e3f9ce855bd413 /src/shader_recompiler/backend/spirv/emit_context.cpp
parentspirv: Remove dependencies on Environment when generating SPIR-V (diff)
downloadyuzu-dbd882ddeb1a1a9233c0085d0b8ccb022db385b2.tar
yuzu-dbd882ddeb1a1a9233c0085d0b8ccb022db385b2.tar.gz
yuzu-dbd882ddeb1a1a9233c0085d0b8ccb022db385b2.tar.bz2
yuzu-dbd882ddeb1a1a9233c0085d0b8ccb022db385b2.tar.lz
yuzu-dbd882ddeb1a1a9233c0085d0b8ccb022db385b2.tar.xz
yuzu-dbd882ddeb1a1a9233c0085d0b8ccb022db385b2.tar.zst
yuzu-dbd882ddeb1a1a9233c0085d0b8ccb022db385b2.zip
Diffstat (limited to '')
-rw-r--r--src/shader_recompiler/backend/spirv/emit_context.cpp29
1 files changed, 26 insertions, 3 deletions
diff --git a/src/shader_recompiler/backend/spirv/emit_context.cpp b/src/shader_recompiler/backend/spirv/emit_context.cpp
index 4d5dabcbf..a8ca33c1d 100644
--- a/src/shader_recompiler/backend/spirv/emit_context.cpp
+++ b/src/shader_recompiler/backend/spirv/emit_context.cpp
@@ -76,6 +76,8 @@ Id GetAttributeType(EmitContext& ctx, AttributeType type) {
return ctx.TypeVector(ctx.TypeInt(32, true), 4);
case AttributeType::UnsignedInt:
return ctx.U32[4];
+ case AttributeType::Disabled:
+ break;
}
throw InvalidArgument("Invalid attribute type {}", type);
}
@@ -305,15 +307,36 @@ void EmitContext::DefineInputs(const Info& info) {
if (info.loads_front_face) {
front_face = DefineInput(*this, U1, spv::BuiltIn::FrontFacing);
}
- for (size_t index = 0; index < info.loads_generics.size(); ++index) {
- if (!info.loads_generics[index]) {
+ for (size_t index = 0; index < info.input_generics.size(); ++index) {
+ const InputVarying generic{info.input_generics[index]};
+ if (!generic.used) {
continue;
}
- const Id type{GetAttributeType(*this, profile.generic_input_types[index])};
+ const AttributeType input_type{profile.generic_input_types[index]};
+ if (input_type == AttributeType::Disabled) {
+ continue;
+ }
+ const Id type{GetAttributeType(*this, input_type)};
const Id id{DefineInput(*this, type)};
Decorate(id, spv::Decoration::Location, static_cast<u32>(index));
Name(id, fmt::format("in_attr{}", index));
input_generics[index] = id;
+
+ if (stage != Stage::Fragment) {
+ continue;
+ }
+ switch (generic.interpolation) {
+ case Interpolation::Smooth:
+ // Default
+ // Decorate(id, spv::Decoration::Smooth);
+ break;
+ case Interpolation::NoPerspective:
+ Decorate(id, spv::Decoration::NoPerspective);
+ break;
+ case Interpolation::Flat:
+ Decorate(id, spv::Decoration::Flat);
+ break;
+ }
}
}