diff options
Diffstat (limited to 'src/shader_recompiler/backend/spirv/emit_context.cpp')
| -rw-r--r-- | src/shader_recompiler/backend/spirv/emit_context.cpp | 29 |
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) { | |||
| 76 | return ctx.TypeVector(ctx.TypeInt(32, true), 4); | 76 | return ctx.TypeVector(ctx.TypeInt(32, true), 4); |
| 77 | case AttributeType::UnsignedInt: | 77 | case AttributeType::UnsignedInt: |
| 78 | return ctx.U32[4]; | 78 | return ctx.U32[4]; |
| 79 | case AttributeType::Disabled: | ||
| 80 | break; | ||
| 79 | } | 81 | } |
| 80 | throw InvalidArgument("Invalid attribute type {}", type); | 82 | throw InvalidArgument("Invalid attribute type {}", type); |
| 81 | } | 83 | } |
| @@ -305,15 +307,36 @@ void EmitContext::DefineInputs(const Info& info) { | |||
| 305 | if (info.loads_front_face) { | 307 | if (info.loads_front_face) { |
| 306 | front_face = DefineInput(*this, U1, spv::BuiltIn::FrontFacing); | 308 | front_face = DefineInput(*this, U1, spv::BuiltIn::FrontFacing); |
| 307 | } | 309 | } |
| 308 | for (size_t index = 0; index < info.loads_generics.size(); ++index) { | 310 | for (size_t index = 0; index < info.input_generics.size(); ++index) { |
| 309 | if (!info.loads_generics[index]) { | 311 | const InputVarying generic{info.input_generics[index]}; |
| 312 | if (!generic.used) { | ||
| 310 | continue; | 313 | continue; |
| 311 | } | 314 | } |
| 312 | const Id type{GetAttributeType(*this, profile.generic_input_types[index])}; | 315 | const AttributeType input_type{profile.generic_input_types[index]}; |
| 316 | if (input_type == AttributeType::Disabled) { | ||
| 317 | continue; | ||
| 318 | } | ||
| 319 | const Id type{GetAttributeType(*this, input_type)}; | ||
| 313 | const Id id{DefineInput(*this, type)}; | 320 | const Id id{DefineInput(*this, type)}; |
| 314 | Decorate(id, spv::Decoration::Location, static_cast<u32>(index)); | 321 | Decorate(id, spv::Decoration::Location, static_cast<u32>(index)); |
| 315 | Name(id, fmt::format("in_attr{}", index)); | 322 | Name(id, fmt::format("in_attr{}", index)); |
| 316 | input_generics[index] = id; | 323 | input_generics[index] = id; |
| 324 | |||
| 325 | if (stage != Stage::Fragment) { | ||
| 326 | continue; | ||
| 327 | } | ||
| 328 | switch (generic.interpolation) { | ||
| 329 | case Interpolation::Smooth: | ||
| 330 | // Default | ||
| 331 | // Decorate(id, spv::Decoration::Smooth); | ||
| 332 | break; | ||
| 333 | case Interpolation::NoPerspective: | ||
| 334 | Decorate(id, spv::Decoration::NoPerspective); | ||
| 335 | break; | ||
| 336 | case Interpolation::Flat: | ||
| 337 | Decorate(id, spv::Decoration::Flat); | ||
| 338 | break; | ||
| 339 | } | ||
| 317 | } | 340 | } |
| 318 | } | 341 | } |
| 319 | 342 | ||