diff options
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 7726bc9c6..d60ad139d 100644 --- a/src/shader_recompiler/backend/spirv/emit_context.cpp +++ b/src/shader_recompiler/backend/spirv/emit_context.cpp | |||
| @@ -1302,6 +1302,14 @@ void EmitContext::DefineInputs(const IR::Program& program) { | |||
| 1302 | Decorate(id, spv::Decoration::Location, location); | 1302 | Decorate(id, spv::Decoration::Location, location); |
| 1303 | input_back_color = id; | 1303 | input_back_color = id; |
| 1304 | } | 1304 | } |
| 1305 | if (loads.AnyComponent(IR::Attribute::ColorBackSpecularR)) { | ||
| 1306 | const size_t location = FindNextUnusedLocation(used_locations, previous_unused_location); | ||
| 1307 | previous_unused_location = location; | ||
| 1308 | used_locations.set(location); | ||
| 1309 | const Id id{DefineInput(*this, F32[4], true)}; | ||
| 1310 | Decorate(id, spv::Decoration::Location, location); | ||
| 1311 | input_back_secondary_color = id; | ||
| 1312 | } | ||
| 1305 | for (size_t index = 0; index < NUM_FIXEDFNCTEXTURE; ++index) { | 1313 | for (size_t index = 0; index < NUM_FIXEDFNCTEXTURE; ++index) { |
| 1306 | if (loads.AnyComponent(IR::Attribute::FixedFncTexture0S + index * 4)) { | 1314 | if (loads.AnyComponent(IR::Attribute::FixedFncTexture0S + index * 4)) { |
| 1307 | const size_t location = | 1315 | const size_t location = |
| @@ -1395,6 +1403,14 @@ void EmitContext::DefineOutputs(const IR::Program& program) { | |||
| 1395 | Decorate(id, spv::Decoration::Location, static_cast<u32>(location)); | 1403 | Decorate(id, spv::Decoration::Location, static_cast<u32>(location)); |
| 1396 | output_back_color = id; | 1404 | output_back_color = id; |
| 1397 | } | 1405 | } |
| 1406 | if (info.stores.AnyComponent(IR::Attribute::ColorBackSpecularR)) { | ||
| 1407 | const size_t location = FindNextUnusedLocation(used_locations, previous_unused_location); | ||
| 1408 | previous_unused_location = location; | ||
| 1409 | used_locations.set(location); | ||
| 1410 | const Id id{DefineOutput(*this, F32[4], invocations)}; | ||
| 1411 | Decorate(id, spv::Decoration::Location, static_cast<u32>(location)); | ||
| 1412 | output_back_secondary_color = id; | ||
| 1413 | } | ||
| 1398 | for (size_t index = 0; index < NUM_FIXEDFNCTEXTURE; ++index) { | 1414 | for (size_t index = 0; index < NUM_FIXEDFNCTEXTURE; ++index) { |
| 1399 | if (info.stores.AnyComponent(IR::Attribute::FixedFncTexture0S + index * 4)) { | 1415 | if (info.stores.AnyComponent(IR::Attribute::FixedFncTexture0S + index * 4)) { |
| 1400 | const size_t location = | 1416 | const size_t location = |
diff --git a/src/shader_recompiler/backend/spirv/emit_context.h b/src/shader_recompiler/backend/spirv/emit_context.h index 8818269a5..a08622099 100644 --- a/src/shader_recompiler/backend/spirv/emit_context.h +++ b/src/shader_recompiler/backend/spirv/emit_context.h | |||
| @@ -271,6 +271,7 @@ public: | |||
| 271 | Id input_front_color{}; | 271 | Id input_front_color{}; |
| 272 | Id input_front_secondary_color{}; | 272 | Id input_front_secondary_color{}; |
| 273 | Id input_back_color{}; | 273 | Id input_back_color{}; |
| 274 | Id input_back_secondary_color{}; | ||
| 274 | std::array<Id, 10> input_fixed_fnc_textures{}; | 275 | std::array<Id, 10> input_fixed_fnc_textures{}; |
| 275 | std::array<Id, 32> input_generics{}; | 276 | std::array<Id, 32> input_generics{}; |
| 276 | 277 | ||
| @@ -279,6 +280,7 @@ public: | |||
| 279 | Id output_front_color{}; | 280 | Id output_front_color{}; |
| 280 | Id output_front_secondary_color{}; | 281 | Id output_front_secondary_color{}; |
| 281 | Id output_back_color{}; | 282 | Id output_back_color{}; |
| 283 | Id output_back_secondary_color{}; | ||
| 282 | std::array<Id, 10> output_fixed_fnc_textures{}; | 284 | std::array<Id, 10> output_fixed_fnc_textures{}; |
| 283 | std::array<std::array<GenericElementInfo, 4>, 32> output_generics{}; | 285 | std::array<std::array<GenericElementInfo, 4>, 32> output_generics{}; |
| 284 | 286 | ||
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 2da76493a..2d1545851 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 | |||
| @@ -135,6 +135,14 @@ std::optional<OutAttr> OutputAttrPointer(EmitContext& ctx, IR::Attribute attr) { | |||
| 135 | const Id element_id{ctx.Const(element)}; | 135 | const Id element_id{ctx.Const(element)}; |
| 136 | return OutputAccessChain(ctx, ctx.output_f32, ctx.output_back_color, element_id); | 136 | return OutputAccessChain(ctx, ctx.output_f32, ctx.output_back_color, element_id); |
| 137 | } | 137 | } |
| 138 | case IR::Attribute::ColorBackSpecularR: | ||
| 139 | case IR::Attribute::ColorBackSpecularG: | ||
| 140 | case IR::Attribute::ColorBackSpecularB: | ||
| 141 | case IR::Attribute::ColorBackSpecularA: { | ||
| 142 | const u32 element{static_cast<u32>(attr) % 4}; | ||
| 143 | const Id element_id{ctx.Const(element)}; | ||
| 144 | return OutputAccessChain(ctx, ctx.output_f32, ctx.output_back_secondary_color, element_id); | ||
| 145 | } | ||
| 138 | case IR::Attribute::ClipDistance0: | 146 | case IR::Attribute::ClipDistance0: |
| 139 | case IR::Attribute::ClipDistance1: | 147 | case IR::Attribute::ClipDistance1: |
| 140 | case IR::Attribute::ClipDistance2: | 148 | case IR::Attribute::ClipDistance2: |
| @@ -393,6 +401,13 @@ Id EmitGetAttribute(EmitContext& ctx, IR::Attribute attr, Id vertex) { | |||
| 393 | return ctx.OpLoad(ctx.F32[1], AttrPointer(ctx, ctx.input_f32, vertex, ctx.input_back_color, | 401 | return ctx.OpLoad(ctx.F32[1], AttrPointer(ctx, ctx.input_f32, vertex, ctx.input_back_color, |
| 394 | ctx.Const(element))); | 402 | ctx.Const(element))); |
| 395 | } | 403 | } |
| 404 | case IR::Attribute::ColorBackSpecularR: | ||
| 405 | case IR::Attribute::ColorBackSpecularG: | ||
| 406 | case IR::Attribute::ColorBackSpecularB: | ||
| 407 | case IR::Attribute::ColorBackSpecularA: { | ||
| 408 | return ctx.OpLoad(ctx.F32[1], AttrPointer(ctx, ctx.input_f32, vertex, ctx.input_back_secondary_color, | ||
| 409 | ctx.Const(element))); | ||
| 410 | } | ||
| 396 | case IR::Attribute::InstanceId: | 411 | case IR::Attribute::InstanceId: |
| 397 | if (ctx.profile.support_vertex_instance_id) { | 412 | if (ctx.profile.support_vertex_instance_id) { |
| 398 | return ctx.OpBitcast(ctx.F32[1], ctx.OpLoad(ctx.U32[1], ctx.instance_id)); | 413 | return ctx.OpBitcast(ctx.F32[1], ctx.OpLoad(ctx.U32[1], ctx.instance_id)); |