diff options
| author | 2021-09-04 00:12:06 +0800 | |
|---|---|---|
| committer | 2021-09-06 10:36:45 +0800 | |
| commit | d994466a08efaa2c06237e6ac840bc0e9000d433 (patch) | |
| tree | 384c1f3e32a34ff8680ee86c083bde8e9acfb788 /src/shader_recompiler/backend/spirv/emit_context.cpp | |
| parent | Rename parameters (diff) | |
| download | yuzu-d994466a08efaa2c06237e6ac840bc0e9000d433.tar.gz yuzu-d994466a08efaa2c06237e6ac840bc0e9000d433.tar.xz yuzu-d994466a08efaa2c06237e6ac840bc0e9000d433.zip | |
Implement intput and output fixed fnc textures
Diffstat (limited to 'src/shader_recompiler/backend/spirv/emit_context.cpp')
| -rw-r--r-- | src/shader_recompiler/backend/spirv/emit_context.cpp | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/src/shader_recompiler/backend/spirv/emit_context.cpp b/src/shader_recompiler/backend/spirv/emit_context.cpp index 3ec5a4570..81c79e1ed 100644 --- a/src/shader_recompiler/backend/spirv/emit_context.cpp +++ b/src/shader_recompiler/backend/spirv/emit_context.cpp | |||
| @@ -1206,10 +1206,12 @@ void EmitContext::DefineInputs(const IR::Program& program) { | |||
| 1206 | Decorate(id, spv::Decoration::Location, static_cast<u32>(11)); | 1206 | Decorate(id, spv::Decoration::Location, static_cast<u32>(11)); |
| 1207 | input_front_color = id; | 1207 | input_front_color = id; |
| 1208 | } | 1208 | } |
| 1209 | if (loads.AnyComponent(IR::Attribute::FixedFncTexture0S)) { | 1209 | for (size_t index = 0; index < IR::NUM_FIXEDFNCTEXTURE; ++index) { |
| 1210 | const Id id{DefineInput(*this, F32[4], true)}; | 1210 | if (loads.AnyComponent(IR::Attribute::FixedFncTexture0S + index * 4)) { |
| 1211 | Decorate(id, spv::Decoration::Location, static_cast<u32>(12)); | 1211 | const Id id{DefineInput(*this, F32[4], true)}; |
| 1212 | input_fixed_fnc_texture = id; | 1212 | Decorate(id, spv::Decoration::Location, static_cast<u32>(12)); |
| 1213 | input_fixed_fnc_textures[index] = id; | ||
| 1214 | } | ||
| 1213 | } | 1215 | } |
| 1214 | if (loads[IR::Attribute::InstanceId]) { | 1216 | if (loads[IR::Attribute::InstanceId]) { |
| 1215 | if (profile.support_vertex_instance_id) { | 1217 | if (profile.support_vertex_instance_id) { |
| @@ -1292,11 +1294,6 @@ void EmitContext::DefineOutputs(const IR::Program& program) { | |||
| 1292 | if (info.stores.AnyComponent(IR::Attribute::PositionX) || stage == Stage::VertexB) { | 1294 | if (info.stores.AnyComponent(IR::Attribute::PositionX) || stage == Stage::VertexB) { |
| 1293 | output_position = DefineOutput(*this, F32[4], invocations, spv::BuiltIn::Position); | 1295 | output_position = DefineOutput(*this, F32[4], invocations, spv::BuiltIn::Position); |
| 1294 | } | 1296 | } |
| 1295 | if (info.stores.AnyComponent(IR::Attribute::ColorFrontDiffuseR) || stage == Stage::VertexB) { | ||
| 1296 | const Id id{DefineOutput(*this, F32[4], invocations)}; | ||
| 1297 | Decorate(id, spv::Decoration::Location, static_cast<u32>(11)); | ||
| 1298 | output_front_color = id; | ||
| 1299 | } | ||
| 1300 | if (info.stores[IR::Attribute::PointSize] || runtime_info.fixed_state_point_size) { | 1297 | if (info.stores[IR::Attribute::PointSize] || runtime_info.fixed_state_point_size) { |
| 1301 | if (stage == Stage::Fragment) { | 1298 | if (stage == Stage::Fragment) { |
| 1302 | throw NotImplementedException("Storing PointSize in fragment stage"); | 1299 | throw NotImplementedException("Storing PointSize in fragment stage"); |
| @@ -1328,13 +1325,18 @@ void EmitContext::DefineOutputs(const IR::Program& program) { | |||
| 1328 | viewport_mask = DefineOutput(*this, TypeArray(U32[1], Const(1u)), std::nullopt, | 1325 | viewport_mask = DefineOutput(*this, TypeArray(U32[1], Const(1u)), std::nullopt, |
| 1329 | spv::BuiltIn::ViewportMaskNV); | 1326 | spv::BuiltIn::ViewportMaskNV); |
| 1330 | } | 1327 | } |
| 1331 | 1328 | if (info.stores.AnyComponent(IR::Attribute::ColorFrontDiffuseR) || stage == Stage::VertexB) { | |
| 1332 | if (info.stores.AnyComponent(IR::Attribute::FixedFncTexture0S)) { | ||
| 1333 | const Id id{DefineOutput(*this, F32[4], invocations)}; | 1329 | const Id id{DefineOutput(*this, F32[4], invocations)}; |
| 1334 | Decorate(id, spv::Decoration::Location, static_cast<u32>(12)); | 1330 | Decorate(id, spv::Decoration::Location, static_cast<u32>(11)); |
| 1335 | output_fixed_fnc_texture = id; | 1331 | output_front_color = id; |
| 1332 | } | ||
| 1333 | for (size_t index = 0; index < IR::NUM_FIXEDFNCTEXTURE; ++index) { | ||
| 1334 | if (info.stores.AnyComponent(IR::Attribute::FixedFncTexture0S + index * 4)) { | ||
| 1335 | const Id id{DefineOutput(*this, F32[4], invocations)}; | ||
| 1336 | Decorate(id, spv::Decoration::Location, static_cast<u32>(12)); | ||
| 1337 | output_fixed_fnc_textures[index] = id; | ||
| 1338 | } | ||
| 1336 | } | 1339 | } |
| 1337 | |||
| 1338 | for (size_t index = 0; index < IR::NUM_GENERICS; ++index) { | 1340 | for (size_t index = 0; index < IR::NUM_GENERICS; ++index) { |
| 1339 | if (info.stores.Generic(index)) { | 1341 | if (info.stores.Generic(index)) { |
| 1340 | DefineGenericOutput(*this, index, invocations); | 1342 | DefineGenericOutput(*this, index, invocations); |