diff options
Diffstat (limited to 'src')
3 files changed, 33 insertions, 0 deletions
diff --git a/src/shader_recompiler/backend/spirv/emit_context.cpp b/src/shader_recompiler/backend/spirv/emit_context.cpp index 9d84c4fc6..7726bc9c6 100644 --- a/src/shader_recompiler/backend/spirv/emit_context.cpp +++ b/src/shader_recompiler/backend/spirv/emit_context.cpp | |||
| @@ -1286,6 +1286,14 @@ void EmitContext::DefineInputs(const IR::Program& program) { | |||
| 1286 | Decorate(id, spv::Decoration::Location, location); | 1286 | Decorate(id, spv::Decoration::Location, location); |
| 1287 | input_front_color = id; | 1287 | input_front_color = id; |
| 1288 | } | 1288 | } |
| 1289 | if (loads.AnyComponent(IR::Attribute::ColorFrontSpecularR)) { | ||
| 1290 | const size_t location = FindNextUnusedLocation(used_locations, previous_unused_location); | ||
| 1291 | previous_unused_location = location; | ||
| 1292 | used_locations.set(location); | ||
| 1293 | const Id id{DefineInput(*this, F32[4], true)}; | ||
| 1294 | Decorate(id, spv::Decoration::Location, location); | ||
| 1295 | input_front_secondary_color = id; | ||
| 1296 | } | ||
| 1289 | if (loads.AnyComponent(IR::Attribute::ColorBackDiffuseR)) { | 1297 | if (loads.AnyComponent(IR::Attribute::ColorBackDiffuseR)) { |
| 1290 | const size_t location = FindNextUnusedLocation(used_locations, previous_unused_location); | 1298 | const size_t location = FindNextUnusedLocation(used_locations, previous_unused_location); |
| 1291 | previous_unused_location = location; | 1299 | previous_unused_location = location; |
| @@ -1371,6 +1379,14 @@ void EmitContext::DefineOutputs(const IR::Program& program) { | |||
| 1371 | Decorate(id, spv::Decoration::Location, static_cast<u32>(location)); | 1379 | Decorate(id, spv::Decoration::Location, static_cast<u32>(location)); |
| 1372 | output_front_color = id; | 1380 | output_front_color = id; |
| 1373 | } | 1381 | } |
| 1382 | if (info.stores.AnyComponent(IR::Attribute::ColorFrontSpecularR)) { | ||
| 1383 | const size_t location = FindNextUnusedLocation(used_locations, previous_unused_location); | ||
| 1384 | previous_unused_location = location; | ||
| 1385 | used_locations.set(location); | ||
| 1386 | const Id id{DefineOutput(*this, F32[4], invocations)}; | ||
| 1387 | Decorate(id, spv::Decoration::Location, static_cast<u32>(location)); | ||
| 1388 | output_front_secondary_color = id; | ||
| 1389 | } | ||
| 1374 | if (info.stores.AnyComponent(IR::Attribute::ColorBackDiffuseR)) { | 1390 | if (info.stores.AnyComponent(IR::Attribute::ColorBackDiffuseR)) { |
| 1375 | const size_t location = FindNextUnusedLocation(used_locations, previous_unused_location); | 1391 | const size_t location = FindNextUnusedLocation(used_locations, previous_unused_location); |
| 1376 | previous_unused_location = location; | 1392 | previous_unused_location = location; |
diff --git a/src/shader_recompiler/backend/spirv/emit_context.h b/src/shader_recompiler/backend/spirv/emit_context.h index d2bc0a952..8818269a5 100644 --- a/src/shader_recompiler/backend/spirv/emit_context.h +++ b/src/shader_recompiler/backend/spirv/emit_context.h | |||
| @@ -269,6 +269,7 @@ public: | |||
| 269 | 269 | ||
| 270 | Id input_position{}; | 270 | Id input_position{}; |
| 271 | Id input_front_color{}; | 271 | Id input_front_color{}; |
| 272 | Id input_front_secondary_color{}; | ||
| 272 | Id input_back_color{}; | 273 | Id input_back_color{}; |
| 273 | std::array<Id, 10> input_fixed_fnc_textures{}; | 274 | std::array<Id, 10> input_fixed_fnc_textures{}; |
| 274 | std::array<Id, 32> input_generics{}; | 275 | std::array<Id, 32> input_generics{}; |
| @@ -276,6 +277,7 @@ public: | |||
| 276 | Id output_point_size{}; | 277 | Id output_point_size{}; |
| 277 | Id output_position{}; | 278 | Id output_position{}; |
| 278 | Id output_front_color{}; | 279 | Id output_front_color{}; |
| 280 | Id output_front_secondary_color{}; | ||
| 279 | Id output_back_color{}; | 281 | Id output_back_color{}; |
| 280 | std::array<Id, 10> output_fixed_fnc_textures{}; | 282 | std::array<Id, 10> output_fixed_fnc_textures{}; |
| 281 | std::array<std::array<GenericElementInfo, 4>, 32> output_generics{}; | 283 | std::array<std::array<GenericElementInfo, 4>, 32> output_generics{}; |
diff --git a/src/shader_recompiler/backend/spirv/emit_spirv_context_get_set.cpp b/src/shader_recompiler/backend/spirv/emit_spirv_context_get_set.cpp index 899df6294..2da76493a 100644 --- a/src/shader_recompiler/backend/spirv/emit_spirv_context_get_set.cpp +++ b/src/shader_recompiler/backend/spirv/emit_spirv_context_get_set.cpp | |||
| @@ -119,6 +119,14 @@ std::optional<OutAttr> OutputAttrPointer(EmitContext& ctx, IR::Attribute attr) { | |||
| 119 | const Id element_id{ctx.Const(element)}; | 119 | const Id element_id{ctx.Const(element)}; |
| 120 | return OutputAccessChain(ctx, ctx.output_f32, ctx.output_front_color, element_id); | 120 | return OutputAccessChain(ctx, ctx.output_f32, ctx.output_front_color, element_id); |
| 121 | } | 121 | } |
| 122 | case IR::Attribute::ColorFrontSpecularR: | ||
| 123 | case IR::Attribute::ColorFrontSpecularG: | ||
| 124 | case IR::Attribute::ColorFrontSpecularB: | ||
| 125 | case IR::Attribute::ColorFrontSpecularA: { | ||
| 126 | const u32 element{static_cast<u32>(attr) % 4}; | ||
| 127 | const Id element_id{ctx.Const(element)}; | ||
| 128 | return OutputAccessChain(ctx, ctx.output_f32, ctx.output_front_secondary_color, element_id); | ||
| 129 | } | ||
| 122 | case IR::Attribute::ColorBackDiffuseR: | 130 | case IR::Attribute::ColorBackDiffuseR: |
| 123 | case IR::Attribute::ColorBackDiffuseG: | 131 | case IR::Attribute::ColorBackDiffuseG: |
| 124 | case IR::Attribute::ColorBackDiffuseB: | 132 | case IR::Attribute::ColorBackDiffuseB: |
| @@ -371,6 +379,13 @@ Id EmitGetAttribute(EmitContext& ctx, IR::Attribute attr, Id vertex) { | |||
| 371 | return ctx.OpLoad(ctx.F32[1], AttrPointer(ctx, ctx.input_f32, vertex, ctx.input_front_color, | 379 | return ctx.OpLoad(ctx.F32[1], AttrPointer(ctx, ctx.input_f32, vertex, ctx.input_front_color, |
| 372 | ctx.Const(element))); | 380 | ctx.Const(element))); |
| 373 | } | 381 | } |
| 382 | case IR::Attribute::ColorFrontSpecularR: | ||
| 383 | case IR::Attribute::ColorFrontSpecularG: | ||
| 384 | case IR::Attribute::ColorFrontSpecularB: | ||
| 385 | case IR::Attribute::ColorFrontSpecularA: { | ||
| 386 | return ctx.OpLoad(ctx.F32[1], AttrPointer(ctx, ctx.input_f32, vertex, ctx.input_front_secondary_color, | ||
| 387 | ctx.Const(element))); | ||
| 388 | } | ||
| 374 | case IR::Attribute::ColorBackDiffuseR: | 389 | case IR::Attribute::ColorBackDiffuseR: |
| 375 | case IR::Attribute::ColorBackDiffuseG: | 390 | case IR::Attribute::ColorBackDiffuseG: |
| 376 | case IR::Attribute::ColorBackDiffuseB: | 391 | case IR::Attribute::ColorBackDiffuseB: |