diff options
Diffstat (limited to 'src/shader_recompiler/backend/glsl')
13 files changed, 87 insertions, 75 deletions
diff --git a/src/shader_recompiler/backend/glsl/emit_context.cpp b/src/shader_recompiler/backend/glsl/emit_context.cpp index 484548467..cbcf0a1eb 100644 --- a/src/shader_recompiler/backend/glsl/emit_context.cpp +++ b/src/shader_recompiler/backend/glsl/emit_context.cpp | |||
| @@ -13,7 +13,7 @@ u32 CbufIndex(size_t offset) { | |||
| 13 | return (offset / 4) % 4; | 13 | return (offset / 4) % 4; |
| 14 | } | 14 | } |
| 15 | 15 | ||
| 16 | char CbufSwizzle(size_t offset) { | 16 | char Swizzle(size_t offset) { |
| 17 | return "xyzw"[CbufIndex(offset)]; | 17 | return "xyzw"[CbufIndex(offset)]; |
| 18 | } | 18 | } |
| 19 | 19 | ||
| @@ -341,8 +341,8 @@ void EmitContext::SetupExtensions(std::string&) { | |||
| 341 | header += "#extension GL_NV_shader_thread_shuffle : enable\n"; | 341 | header += "#extension GL_NV_shader_thread_shuffle : enable\n"; |
| 342 | } | 342 | } |
| 343 | } | 343 | } |
| 344 | if (info.stores_viewport_index && profile.support_viewport_index_layer_non_geometry && | 344 | if ((info.stores_viewport_index || info.stores_layer) && |
| 345 | stage != Stage::Geometry) { | 345 | profile.support_viewport_index_layer_non_geometry && stage != Stage::Geometry) { |
| 346 | header += "#extension GL_ARB_shader_viewport_layer_array : enable\n"; | 346 | header += "#extension GL_ARB_shader_viewport_layer_array : enable\n"; |
| 347 | } | 347 | } |
| 348 | if (info.uses_sparse_residency) { | 348 | if (info.uses_sparse_residency) { |
| @@ -428,16 +428,16 @@ void EmitContext::DefineHelperFunctions() { | |||
| 428 | header += "uint CasIncrement(uint op_a,uint op_b){return op_a>=op_b?0u:(op_a+1u);}"; | 428 | header += "uint CasIncrement(uint op_a,uint op_b){return op_a>=op_b?0u:(op_a+1u);}"; |
| 429 | } | 429 | } |
| 430 | if (info.uses_global_decrement || info.uses_shared_decrement) { | 430 | if (info.uses_global_decrement || info.uses_shared_decrement) { |
| 431 | header += "uint CasDecrement(uint op_a,uint " | 431 | header += "uint CasDecrement(uint op_a,uint op_b){" |
| 432 | "op_b){return op_a==0||op_a>op_b?op_b:(op_a-1u);}"; | 432 | "return op_a==0||op_a>op_b?op_b:(op_a-1u);}"; |
| 433 | } | 433 | } |
| 434 | if (info.uses_atomic_f32_add) { | 434 | if (info.uses_atomic_f32_add) { |
| 435 | header += "uint CasFloatAdd(uint op_a,float op_b){return " | 435 | header += "uint CasFloatAdd(uint op_a,float op_b){" |
| 436 | "ftou(utof(op_a)+op_b);}"; | 436 | "return ftou(utof(op_a)+op_b);}"; |
| 437 | } | 437 | } |
| 438 | if (info.uses_atomic_f32x2_add) { | 438 | if (info.uses_atomic_f32x2_add) { |
| 439 | header += "uint CasFloatAdd32x2(uint op_a,vec2 op_b){return " | 439 | header += "uint CasFloatAdd32x2(uint op_a,vec2 op_b){" |
| 440 | "packHalf2x16(unpackHalf2x16(op_a)+op_b);}"; | 440 | "return packHalf2x16(unpackHalf2x16(op_a)+op_b);}"; |
| 441 | } | 441 | } |
| 442 | if (info.uses_atomic_f32x2_min) { | 442 | if (info.uses_atomic_f32x2_min) { |
| 443 | header += "uint CasFloatMin32x2(uint op_a,vec2 op_b){return " | 443 | header += "uint CasFloatMin32x2(uint op_a,vec2 op_b){return " |
| @@ -476,9 +476,10 @@ void EmitContext::DefineHelperFunctions() { | |||
| 476 | "masked_index=uint(base_index)&3u;switch(base_index>>2){{", | 476 | "masked_index=uint(base_index)&3u;switch(base_index>>2){{", |
| 477 | vertex_arg)}; | 477 | vertex_arg)}; |
| 478 | if (info.loads_position) { | 478 | if (info.loads_position) { |
| 479 | func += fmt::format("case {}:", static_cast<u32>(IR::Attribute::PositionX) >> 2); | ||
| 480 | const auto position_idx{is_array ? "gl_in[vertex]." : ""}; | 479 | const auto position_idx{is_array ? "gl_in[vertex]." : ""}; |
| 481 | func += fmt::format("return {}{}[masked_index];", position_idx, position_name); | 480 | func += fmt::format("case {}:return {}{}[masked_index];", |
| 481 | static_cast<u32>(IR::Attribute::PositionX) >> 2, position_idx, | ||
| 482 | position_name); | ||
| 482 | } | 483 | } |
| 483 | const u32 base_attribute_value = static_cast<u32>(IR::Attribute::Generic0X) >> 2; | 484 | const u32 base_attribute_value = static_cast<u32>(IR::Attribute::Generic0X) >> 2; |
| 484 | for (u32 i = 0; i < info.input_generics.size(); ++i) { | 485 | for (u32 i = 0; i < info.input_generics.size(); ++i) { |
| @@ -486,8 +487,8 @@ void EmitContext::DefineHelperFunctions() { | |||
| 486 | continue; | 487 | continue; |
| 487 | } | 488 | } |
| 488 | const auto vertex_idx{is_array ? "[vertex]" : ""}; | 489 | const auto vertex_idx{is_array ? "[vertex]" : ""}; |
| 489 | func += fmt::format("case {}:", base_attribute_value + i); | 490 | func += fmt::format("case {}:return in_attr{}{}[masked_index];", |
| 490 | func += fmt::format("return in_attr{}{}[masked_index];", i, vertex_idx); | 491 | base_attribute_value + i, i, vertex_idx); |
| 491 | } | 492 | } |
| 492 | func += "default: return 0.0;}}"; | 493 | func += "default: return 0.0;}}"; |
| 493 | header += func; | 494 | header += func; |
| @@ -508,8 +509,8 @@ std::string EmitContext::DefineGlobalMemoryFunctions() { | |||
| 508 | for (size_t i = 0; i < addr_xy.size(); ++i) { | 509 | for (size_t i = 0; i < addr_xy.size(); ++i) { |
| 509 | const auto addr_loc{ssbo.cbuf_offset + 4 * i}; | 510 | const auto addr_loc{ssbo.cbuf_offset + 4 * i}; |
| 510 | const auto size_loc{size_cbuf_offset + 4 * i}; | 511 | const auto size_loc{size_cbuf_offset + 4 * i}; |
| 511 | addr_xy[i] = fmt::format("ftou({}[{}].{})", cbuf, addr_loc / 16, CbufSwizzle(addr_loc)); | 512 | addr_xy[i] = fmt::format("ftou({}[{}].{})", cbuf, addr_loc / 16, Swizzle(addr_loc)); |
| 512 | size_xy[i] = fmt::format("ftou({}[{}].{})", cbuf, size_loc / 16, CbufSwizzle(size_loc)); | 513 | size_xy[i] = fmt::format("ftou({}[{}].{})", cbuf, size_loc / 16, Swizzle(size_loc)); |
| 513 | } | 514 | } |
| 514 | const auto addr_pack{fmt::format("packUint2x32(uvec2({},{}))", addr_xy[0], addr_xy[1])}; | 515 | const auto addr_pack{fmt::format("packUint2x32(uvec2({},{}))", addr_xy[0], addr_xy[1])}; |
| 515 | const auto addr_statment{fmt::format("uint64_t {}={};", ssbo_addr, addr_pack)}; | 516 | const auto addr_statment{fmt::format("uint64_t {}={};", ssbo_addr, addr_pack)}; |
diff --git a/src/shader_recompiler/backend/glsl/emit_context.h b/src/shader_recompiler/backend/glsl/emit_context.h index 2b0d22ce5..0d18abe90 100644 --- a/src/shader_recompiler/backend/glsl/emit_context.h +++ b/src/shader_recompiler/backend/glsl/emit_context.h | |||
| @@ -46,7 +46,7 @@ public: | |||
| 46 | const auto var_def{var_alloc.AddDefine(inst, type)}; | 46 | const auto var_def{var_alloc.AddDefine(inst, type)}; |
| 47 | if (var_def.empty()) { | 47 | if (var_def.empty()) { |
| 48 | // skip assigment. | 48 | // skip assigment. |
| 49 | code += fmt::format(&format_str[3], std::forward<Args>(args)...); | 49 | code += fmt::format(format_str + 3, std::forward<Args>(args)...); |
| 50 | } else { | 50 | } else { |
| 51 | code += fmt::format(format_str, var_def, std::forward<Args>(args)...); | 51 | code += fmt::format(format_str, var_def, std::forward<Args>(args)...); |
| 52 | } | 52 | } |
diff --git a/src/shader_recompiler/backend/glsl/emit_glsl.cpp b/src/shader_recompiler/backend/glsl/emit_glsl.cpp index b189f6c11..3e6add7cd 100644 --- a/src/shader_recompiler/backend/glsl/emit_glsl.cpp +++ b/src/shader_recompiler/backend/glsl/emit_glsl.cpp | |||
| @@ -5,6 +5,7 @@ | |||
| 5 | #include <ranges> | 5 | #include <ranges> |
| 6 | #include <string> | 6 | #include <string> |
| 7 | 7 | ||
| 8 | #include "common/alignment.h" | ||
| 8 | #include "shader_recompiler/backend/glsl/emit_context.h" | 9 | #include "shader_recompiler/backend/glsl/emit_context.h" |
| 9 | #include "shader_recompiler/backend/glsl/emit_glsl.h" | 10 | #include "shader_recompiler/backend/glsl/emit_glsl.h" |
| 10 | #include "shader_recompiler/backend/glsl/emit_glsl_instructions.h" | 11 | #include "shader_recompiler/backend/glsl/emit_glsl_instructions.h" |
| @@ -159,8 +160,7 @@ void EmitCode(EmitContext& ctx, const IR::Program& program) { | |||
| 159 | ctx.var_alloc.Consume(node.data.repeat.cond)); | 160 | ctx.var_alloc.Consume(node.data.repeat.cond)); |
| 160 | break; | 161 | break; |
| 161 | default: | 162 | default: |
| 162 | throw NotImplementedException("AbstractSyntaxNode::Type {}", node.type); | 163 | throw NotImplementedException("AbstractSyntaxNode Type {}", node.type); |
| 163 | break; | ||
| 164 | } | 164 | } |
| 165 | } | 165 | } |
| 166 | } | 166 | } |
| @@ -209,10 +209,11 @@ std::string EmitGLSL(const Profile& profile, const RuntimeInfo& runtime_info, IR | |||
| 209 | const std::string version{fmt::format("#version 450{}\n", GlslVersionSpecifier(ctx))}; | 209 | const std::string version{fmt::format("#version 450{}\n", GlslVersionSpecifier(ctx))}; |
| 210 | ctx.header.insert(0, version); | 210 | ctx.header.insert(0, version); |
| 211 | if (program.local_memory_size > 0) { | 211 | if (program.local_memory_size > 0) { |
| 212 | ctx.header += fmt::format("uint lmem[{}];", program.local_memory_size / 4); | 212 | ctx.header += fmt::format("uint lmem[{}];", Common::AlignUp(program.local_memory_size, 4)); |
| 213 | } | 213 | } |
| 214 | if (program.shared_memory_size > 0) { | 214 | if (program.shared_memory_size > 0) { |
| 215 | ctx.header += fmt::format("shared uint smem[{}];", program.shared_memory_size / 4); | 215 | ctx.header += |
| 216 | fmt::format("shared uint smem[{}];", Common::AlignUp(program.shared_memory_size, 4)); | ||
| 216 | } | 217 | } |
| 217 | ctx.header += "\nvoid main(){\n"; | 218 | ctx.header += "\nvoid main(){\n"; |
| 218 | if (program.stage == Stage::VertexA || program.stage == Stage::VertexB) { | 219 | if (program.stage == Stage::VertexA || program.stage == Stage::VertexB) { |
diff --git a/src/shader_recompiler/backend/glsl/emit_glsl_bitwise_conversion.cpp b/src/shader_recompiler/backend/glsl/emit_glsl_bitwise_conversion.cpp index eff672cc4..3c1714e89 100644 --- a/src/shader_recompiler/backend/glsl/emit_glsl_bitwise_conversion.cpp +++ b/src/shader_recompiler/backend/glsl/emit_glsl_bitwise_conversion.cpp | |||
| @@ -19,7 +19,7 @@ void Alias(IR::Inst& inst, const IR::Value& value) { | |||
| 19 | value_inst.DestructiveRemoveUsage(); | 19 | value_inst.DestructiveRemoveUsage(); |
| 20 | inst.SetDefinition(value_inst.Definition<Id>()); | 20 | inst.SetDefinition(value_inst.Definition<Id>()); |
| 21 | } | 21 | } |
| 22 | } // namespace | 22 | } // Anonymous namespace |
| 23 | 23 | ||
| 24 | void EmitIdentity(EmitContext&, IR::Inst& inst, const IR::Value& value) { | 24 | void EmitIdentity(EmitContext&, IR::Inst& inst, const IR::Value& value) { |
| 25 | Alias(inst, value); | 25 | Alias(inst, value); |
diff --git a/src/shader_recompiler/backend/glsl/emit_glsl_composite.cpp b/src/shader_recompiler/backend/glsl/emit_glsl_composite.cpp index 954fc67b1..7421ce97d 100644 --- a/src/shader_recompiler/backend/glsl/emit_glsl_composite.cpp +++ b/src/shader_recompiler/backend/glsl/emit_glsl_composite.cpp | |||
| @@ -13,8 +13,13 @@ namespace { | |||
| 13 | constexpr std::string_view SWIZZLE{"xyzw"}; | 13 | constexpr std::string_view SWIZZLE{"xyzw"}; |
| 14 | void CompositeInsert(EmitContext& ctx, std::string_view result, std::string_view composite, | 14 | void CompositeInsert(EmitContext& ctx, std::string_view result, std::string_view composite, |
| 15 | std::string_view object, u32 index) { | 15 | std::string_view object, u32 index) { |
| 16 | ctx.Add("{}={};", result, composite); | 16 | if (result == composite) { |
| 17 | ctx.Add("{}.{}={};", result, SWIZZLE[index], object); | 17 | // The result is aliased with the composite |
| 18 | ctx.Add("{}.{}={};", composite, SWIZZLE[index], object); | ||
| 19 | } else { | ||
| 20 | ctx.Add("{}={};", result, composite); | ||
| 21 | ctx.Add("{}.{}={};", result, SWIZZLE[index], object); | ||
| 22 | } | ||
| 18 | } | 23 | } |
| 19 | } // Anonymous namespace | 24 | } // Anonymous namespace |
| 20 | 25 | ||
diff --git a/src/shader_recompiler/backend/glsl/emit_glsl_context_get_set.cpp b/src/shader_recompiler/backend/glsl/emit_glsl_context_get_set.cpp index 0546c1c81..711b568b1 100644 --- a/src/shader_recompiler/backend/glsl/emit_glsl_context_get_set.cpp +++ b/src/shader_recompiler/backend/glsl/emit_glsl_context_get_set.cpp | |||
| @@ -31,12 +31,7 @@ std::string InputVertexIndex(EmitContext& ctx, std::string_view vertex) { | |||
| 31 | } | 31 | } |
| 32 | 32 | ||
| 33 | std::string OutputVertexIndex(EmitContext& ctx) { | 33 | std::string OutputVertexIndex(EmitContext& ctx) { |
| 34 | switch (ctx.stage) { | 34 | return ctx.stage == Stage::TessellationControl ? "[gl_InvocationID]" : ""; |
| 35 | case Stage::TessellationControl: | ||
| 36 | return "[gl_InvocationID]"; | ||
| 37 | default: | ||
| 38 | return ""; | ||
| 39 | } | ||
| 40 | } | 35 | } |
| 41 | } // Anonymous namespace | 36 | } // Anonymous namespace |
| 42 | 37 | ||
| @@ -219,7 +214,11 @@ void EmitGetAttribute(EmitContext& ctx, IR::Inst& inst, IR::Attribute attr, | |||
| 219 | case IR::Attribute::ColorFrontDiffuseG: | 214 | case IR::Attribute::ColorFrontDiffuseG: |
| 220 | case IR::Attribute::ColorFrontDiffuseB: | 215 | case IR::Attribute::ColorFrontDiffuseB: |
| 221 | case IR::Attribute::ColorFrontDiffuseA: | 216 | case IR::Attribute::ColorFrontDiffuseA: |
| 222 | ctx.AddF32("{}=gl_FrontMaterial.diffuse.{};", inst, swizzle); | 217 | if (ctx.stage == Stage::Fragment) { |
| 218 | ctx.AddF32("{}=gl_Color.{};", inst, swizzle); | ||
| 219 | } else { | ||
| 220 | ctx.AddF32("{}=gl_FrontColor.{};", inst, swizzle); | ||
| 221 | } | ||
| 223 | break; | 222 | break; |
| 224 | case IR::Attribute::PointSpriteS: | 223 | case IR::Attribute::PointSpriteS: |
| 225 | case IR::Attribute::PointSpriteT: | 224 | case IR::Attribute::PointSpriteT: |
| @@ -300,28 +299,36 @@ void EmitSetAttribute(EmitContext& ctx, IR::Attribute attr, std::string_view val | |||
| 300 | case IR::Attribute::ColorFrontDiffuseG: | 299 | case IR::Attribute::ColorFrontDiffuseG: |
| 301 | case IR::Attribute::ColorFrontDiffuseB: | 300 | case IR::Attribute::ColorFrontDiffuseB: |
| 302 | case IR::Attribute::ColorFrontDiffuseA: | 301 | case IR::Attribute::ColorFrontDiffuseA: |
| 303 | ctx.Add("gl_FrontMaterial.diffuse.{}={};", swizzle, value); | 302 | if (ctx.stage == Stage::Fragment) { |
| 303 | ctx.Add("gl_Color.{}={};", swizzle, value); | ||
| 304 | } else { | ||
| 305 | ctx.Add("gl_FrontColor.{}={};", swizzle, value); | ||
| 306 | } | ||
| 304 | break; | 307 | break; |
| 305 | case IR::Attribute::ColorFrontSpecularR: | 308 | case IR::Attribute::ColorFrontSpecularR: |
| 306 | case IR::Attribute::ColorFrontSpecularG: | 309 | case IR::Attribute::ColorFrontSpecularG: |
| 307 | case IR::Attribute::ColorFrontSpecularB: | 310 | case IR::Attribute::ColorFrontSpecularB: |
| 308 | case IR::Attribute::ColorFrontSpecularA: | 311 | case IR::Attribute::ColorFrontSpecularA: |
| 309 | ctx.Add("gl_FrontMaterial.specular.{}={};", swizzle, value); | 312 | if (ctx.stage == Stage::Fragment) { |
| 313 | ctx.Add("gl_SecondaryColor.{}={};", swizzle, value); | ||
| 314 | } else { | ||
| 315 | ctx.Add("gl_FrontSecondaryColor.{}={};", swizzle, value); | ||
| 316 | } | ||
| 310 | break; | 317 | break; |
| 311 | case IR::Attribute::ColorBackDiffuseR: | 318 | case IR::Attribute::ColorBackDiffuseR: |
| 312 | case IR::Attribute::ColorBackDiffuseG: | 319 | case IR::Attribute::ColorBackDiffuseG: |
| 313 | case IR::Attribute::ColorBackDiffuseB: | 320 | case IR::Attribute::ColorBackDiffuseB: |
| 314 | case IR::Attribute::ColorBackDiffuseA: | 321 | case IR::Attribute::ColorBackDiffuseA: |
| 315 | ctx.Add("gl_BackMaterial.diffuse.{}={};", swizzle, value); | 322 | ctx.Add("gl_BackColor.{}={};", swizzle, value); |
| 316 | break; | 323 | break; |
| 317 | case IR::Attribute::ColorBackSpecularR: | 324 | case IR::Attribute::ColorBackSpecularR: |
| 318 | case IR::Attribute::ColorBackSpecularG: | 325 | case IR::Attribute::ColorBackSpecularG: |
| 319 | case IR::Attribute::ColorBackSpecularB: | 326 | case IR::Attribute::ColorBackSpecularB: |
| 320 | case IR::Attribute::ColorBackSpecularA: | 327 | case IR::Attribute::ColorBackSpecularA: |
| 321 | ctx.Add("gl_BackMaterial.specular.{}={};", swizzle, value); | 328 | ctx.Add("gl_BackSecondaryColor.{}={};", swizzle, value); |
| 322 | break; | 329 | break; |
| 323 | case IR::Attribute::FogCoordinate: | 330 | case IR::Attribute::FogCoordinate: |
| 324 | ctx.Add("gl_FragCoord.x={};", value); | 331 | ctx.Add("gl_FogFragCoord.x={};", value); |
| 325 | break; | 332 | break; |
| 326 | case IR::Attribute::ClipDistance0: | 333 | case IR::Attribute::ClipDistance0: |
| 327 | case IR::Attribute::ClipDistance1: | 334 | case IR::Attribute::ClipDistance1: |
diff --git a/src/shader_recompiler/backend/glsl/emit_glsl_control_flow.cpp b/src/shader_recompiler/backend/glsl/emit_glsl_control_flow.cpp index 59522fdbd..53f8896be 100644 --- a/src/shader_recompiler/backend/glsl/emit_glsl_control_flow.cpp +++ b/src/shader_recompiler/backend/glsl/emit_glsl_control_flow.cpp | |||
| @@ -14,8 +14,7 @@ void EmitJoin(EmitContext&) { | |||
| 14 | throw NotImplementedException("Join shouldn't be emitted"); | 14 | throw NotImplementedException("Join shouldn't be emitted"); |
| 15 | } | 15 | } |
| 16 | 16 | ||
| 17 | void EmitDemoteToHelperInvocation(EmitContext& ctx, | 17 | void EmitDemoteToHelperInvocation(EmitContext& ctx) { |
| 18 | [[maybe_unused]] std::string_view continue_label) { | ||
| 19 | ctx.Add("discard;"); | 18 | ctx.Add("discard;"); |
| 20 | } | 19 | } |
| 21 | 20 | ||
diff --git a/src/shader_recompiler/backend/glsl/emit_glsl_convert.cpp b/src/shader_recompiler/backend/glsl/emit_glsl_convert.cpp index 8d823e466..777e290b4 100644 --- a/src/shader_recompiler/backend/glsl/emit_glsl_convert.cpp +++ b/src/shader_recompiler/backend/glsl/emit_glsl_convert.cpp | |||
| @@ -15,7 +15,7 @@ void EmitConvertS16F16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::I | |||
| 15 | } | 15 | } |
| 16 | 16 | ||
| 17 | void EmitConvertS16F32(EmitContext& ctx, IR::Inst& inst, std::string_view value) { | 17 | void EmitConvertS16F32(EmitContext& ctx, IR::Inst& inst, std::string_view value) { |
| 18 | ctx.AddS32("{}=int(float({}))&0xffff;", inst, value); | 18 | ctx.AddS32("{}=(int({})&0xffff)|(bitfieldExtract(int({}),31,1)<<15);", inst, value, value); |
| 19 | } | 19 | } |
| 20 | 20 | ||
| 21 | void EmitConvertS16F64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 21 | void EmitConvertS16F64([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, |
| @@ -29,11 +29,11 @@ void EmitConvertS32F16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::I | |||
| 29 | } | 29 | } |
| 30 | 30 | ||
| 31 | void EmitConvertS32F32(EmitContext& ctx, IR::Inst& inst, std::string_view value) { | 31 | void EmitConvertS32F32(EmitContext& ctx, IR::Inst& inst, std::string_view value) { |
| 32 | ctx.AddS32("{}=int(float({}));", inst, value); | 32 | ctx.AddS32("{}=int({});", inst, value); |
| 33 | } | 33 | } |
| 34 | 34 | ||
| 35 | void EmitConvertS32F64(EmitContext& ctx, IR::Inst& inst, std::string_view value) { | 35 | void EmitConvertS32F64(EmitContext& ctx, IR::Inst& inst, std::string_view value) { |
| 36 | ctx.AddS32("{}=int(double({}));", inst, value); | 36 | ctx.AddS32("{}=int({});", inst, value); |
| 37 | } | 37 | } |
| 38 | 38 | ||
| 39 | void EmitConvertS64F16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 39 | void EmitConvertS64F16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, |
| @@ -42,11 +42,11 @@ void EmitConvertS64F16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::I | |||
| 42 | } | 42 | } |
| 43 | 43 | ||
| 44 | void EmitConvertS64F32(EmitContext& ctx, IR::Inst& inst, std::string_view value) { | 44 | void EmitConvertS64F32(EmitContext& ctx, IR::Inst& inst, std::string_view value) { |
| 45 | ctx.AddS64("{}=int64_t(double(float({})));", inst, value); | 45 | ctx.AddS64("{}=int64_t(double({}));", inst, value); |
| 46 | } | 46 | } |
| 47 | 47 | ||
| 48 | void EmitConvertS64F64(EmitContext& ctx, IR::Inst& inst, std::string_view value) { | 48 | void EmitConvertS64F64(EmitContext& ctx, IR::Inst& inst, std::string_view value) { |
| 49 | ctx.AddS64("{}=int64_t(double({}));", inst, value); | 49 | ctx.AddS64("{}=int64_t({});", inst, value); |
| 50 | } | 50 | } |
| 51 | 51 | ||
| 52 | void EmitConvertU16F16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 52 | void EmitConvertU16F16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, |
| @@ -70,11 +70,11 @@ void EmitConvertU32F16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::I | |||
| 70 | } | 70 | } |
| 71 | 71 | ||
| 72 | void EmitConvertU32F32(EmitContext& ctx, IR::Inst& inst, std::string_view value) { | 72 | void EmitConvertU32F32(EmitContext& ctx, IR::Inst& inst, std::string_view value) { |
| 73 | ctx.AddU32("{}=uint(float({}));", inst, value); | 73 | ctx.AddU32("{}=uint({});", inst, value); |
| 74 | } | 74 | } |
| 75 | 75 | ||
| 76 | void EmitConvertU32F64(EmitContext& ctx, IR::Inst& inst, std::string_view value) { | 76 | void EmitConvertU32F64(EmitContext& ctx, IR::Inst& inst, std::string_view value) { |
| 77 | ctx.AddU32("{}=uint(double({}));", inst, value); | 77 | ctx.AddU32("{}=uint({});", inst, value); |
| 78 | } | 78 | } |
| 79 | 79 | ||
| 80 | void EmitConvertU64F16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 80 | void EmitConvertU64F16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, |
| @@ -83,19 +83,19 @@ void EmitConvertU64F16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::I | |||
| 83 | } | 83 | } |
| 84 | 84 | ||
| 85 | void EmitConvertU64F32(EmitContext& ctx, IR::Inst& inst, std::string_view value) { | 85 | void EmitConvertU64F32(EmitContext& ctx, IR::Inst& inst, std::string_view value) { |
| 86 | ctx.AddU64("{}=uint64_t(float({}));", inst, value); | 86 | ctx.AddU64("{}=uint64_t({});", inst, value); |
| 87 | } | 87 | } |
| 88 | 88 | ||
| 89 | void EmitConvertU64F64(EmitContext& ctx, IR::Inst& inst, std::string_view value) { | 89 | void EmitConvertU64F64(EmitContext& ctx, IR::Inst& inst, std::string_view value) { |
| 90 | ctx.AddU64("{}=uint64_t(double({}));", inst, value); | 90 | ctx.AddU64("{}=uint64_t({});", inst, value); |
| 91 | } | 91 | } |
| 92 | 92 | ||
| 93 | void EmitConvertU64U32(EmitContext& ctx, IR::Inst& inst, std::string_view value) { | 93 | void EmitConvertU64U32(EmitContext& ctx, IR::Inst& inst, std::string_view value) { |
| 94 | ctx.AddU64("{}=uint64_t(uint({}));", inst, value); | 94 | ctx.AddU64("{}=uint64_t({});", inst, value); |
| 95 | } | 95 | } |
| 96 | 96 | ||
| 97 | void EmitConvertU32U64(EmitContext& ctx, IR::Inst& inst, std::string_view value) { | 97 | void EmitConvertU32U64(EmitContext& ctx, IR::Inst& inst, std::string_view value) { |
| 98 | ctx.AddU32("{}=uint(uint64_t({}));", inst, value); | 98 | ctx.AddU32("{}=uint({});", inst, value); |
| 99 | } | 99 | } |
| 100 | 100 | ||
| 101 | void EmitConvertF16F32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 101 | void EmitConvertF16F32([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, |
| @@ -109,11 +109,11 @@ void EmitConvertF32F16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::I | |||
| 109 | } | 109 | } |
| 110 | 110 | ||
| 111 | void EmitConvertF32F64(EmitContext& ctx, IR::Inst& inst, std::string_view value) { | 111 | void EmitConvertF32F64(EmitContext& ctx, IR::Inst& inst, std::string_view value) { |
| 112 | ctx.AddF32("{}=float(double({}));", inst, value); | 112 | ctx.AddF32("{}=float({});", inst, value); |
| 113 | } | 113 | } |
| 114 | 114 | ||
| 115 | void EmitConvertF64F32(EmitContext& ctx, IR::Inst& inst, std::string_view value) { | 115 | void EmitConvertF64F32(EmitContext& ctx, IR::Inst& inst, std::string_view value) { |
| 116 | ctx.AddF64("{}=double(float({}));", inst, value); | 116 | ctx.AddF64("{}=double({});", inst, value); |
| 117 | } | 117 | } |
| 118 | 118 | ||
| 119 | void EmitConvertF16S8([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 119 | void EmitConvertF16S8([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, |
| @@ -171,7 +171,7 @@ void EmitConvertF32S32(EmitContext& ctx, IR::Inst& inst, std::string_view value) | |||
| 171 | } | 171 | } |
| 172 | 172 | ||
| 173 | void EmitConvertF32S64(EmitContext& ctx, IR::Inst& inst, std::string_view value) { | 173 | void EmitConvertF32S64(EmitContext& ctx, IR::Inst& inst, std::string_view value) { |
| 174 | ctx.AddF32("{}=float(double(int64_t({})));", inst, value); | 174 | ctx.AddF32("{}=float(int64_t({}));", inst, value); |
| 175 | } | 175 | } |
| 176 | 176 | ||
| 177 | void EmitConvertF32U8([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 177 | void EmitConvertF32U8([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, |
| @@ -180,15 +180,15 @@ void EmitConvertF32U8([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::In | |||
| 180 | } | 180 | } |
| 181 | 181 | ||
| 182 | void EmitConvertF32U16(EmitContext& ctx, IR::Inst& inst, std::string_view value) { | 182 | void EmitConvertF32U16(EmitContext& ctx, IR::Inst& inst, std::string_view value) { |
| 183 | ctx.AddF32("{}=float(uint({}&0xffff));", inst, value); | 183 | ctx.AddF32("{}=float({}&0xffff);", inst, value); |
| 184 | } | 184 | } |
| 185 | 185 | ||
| 186 | void EmitConvertF32U32(EmitContext& ctx, IR::Inst& inst, std::string_view value) { | 186 | void EmitConvertF32U32(EmitContext& ctx, IR::Inst& inst, std::string_view value) { |
| 187 | ctx.AddF32("{}=float(uint({}));", inst, value); | 187 | ctx.AddF32("{}=float({});", inst, value); |
| 188 | } | 188 | } |
| 189 | 189 | ||
| 190 | void EmitConvertF32U64(EmitContext& ctx, IR::Inst& inst, std::string_view value) { | 190 | void EmitConvertF32U64(EmitContext& ctx, IR::Inst& inst, std::string_view value) { |
| 191 | ctx.AddF32("{}=float(double(uint64_t({})));", inst, value); | 191 | ctx.AddF32("{}=float({});", inst, value); |
| 192 | } | 192 | } |
| 193 | 193 | ||
| 194 | void EmitConvertF64S8([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 194 | void EmitConvertF64S8([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, |
| @@ -220,11 +220,11 @@ void EmitConvertF64U16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::I | |||
| 220 | } | 220 | } |
| 221 | 221 | ||
| 222 | void EmitConvertF64U32(EmitContext& ctx, IR::Inst& inst, std::string_view value) { | 222 | void EmitConvertF64U32(EmitContext& ctx, IR::Inst& inst, std::string_view value) { |
| 223 | ctx.AddF64("{}=double(uint({}));", inst, value); | 223 | ctx.AddF64("{}=double({});", inst, value); |
| 224 | } | 224 | } |
| 225 | 225 | ||
| 226 | void EmitConvertF64U64(EmitContext& ctx, IR::Inst& inst, std::string_view value) { | 226 | void EmitConvertF64U64(EmitContext& ctx, IR::Inst& inst, std::string_view value) { |
| 227 | ctx.AddF64("{}=double(uint64_t({}));", inst, value); | 227 | ctx.AddF64("{}=double({});", inst, value); |
| 228 | } | 228 | } |
| 229 | 229 | ||
| 230 | } // namespace Shader::Backend::GLSL | 230 | } // namespace Shader::Backend::GLSL |
diff --git a/src/shader_recompiler/backend/glsl/emit_glsl_floating_point.cpp b/src/shader_recompiler/backend/glsl/emit_glsl_floating_point.cpp index fbf66015f..b11be5bd7 100644 --- a/src/shader_recompiler/backend/glsl/emit_glsl_floating_point.cpp +++ b/src/shader_recompiler/backend/glsl/emit_glsl_floating_point.cpp | |||
| @@ -15,14 +15,13 @@ void Compare(EmitContext& ctx, IR::Inst& inst, std::string_view lhs, std::string | |||
| 15 | std::string_view op, bool ordered) { | 15 | std::string_view op, bool ordered) { |
| 16 | ctx.AddU1("{}={}{}{}", inst, lhs, op, rhs, lhs, rhs); | 16 | ctx.AddU1("{}={}{}{}", inst, lhs, op, rhs, lhs, rhs); |
| 17 | if (ordered) { | 17 | if (ordered) { |
| 18 | ctx.code += fmt::format("&&!isnan({})&&!isnan({})", lhs, rhs); | 18 | ctx.Add("&&!isnan({})&&!isnan({});", lhs, rhs); |
| 19 | } else { | 19 | } else { |
| 20 | ctx.code += fmt::format("||isnan({})||isnan({})", lhs, rhs); | 20 | ctx.Add("||isnan({})||isnan({});", lhs, rhs); |
| 21 | } | 21 | } |
| 22 | ctx.code += ";"; | ||
| 23 | } | 22 | } |
| 24 | 23 | ||
| 25 | bool Precise(IR::Inst& inst) { | 24 | bool IsPrecise(const IR::Inst& inst) { |
| 26 | return {inst.Flags<IR::FpControl>().no_contraction}; | 25 | return {inst.Flags<IR::FpControl>().no_contraction}; |
| 27 | } | 26 | } |
| 28 | } // Anonymous namespace | 27 | } // Anonymous namespace |
| @@ -46,7 +45,7 @@ void EmitFPAdd16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& i | |||
| 46 | } | 45 | } |
| 47 | 46 | ||
| 48 | void EmitFPAdd32(EmitContext& ctx, IR::Inst& inst, std::string_view a, std::string_view b) { | 47 | void EmitFPAdd32(EmitContext& ctx, IR::Inst& inst, std::string_view a, std::string_view b) { |
| 49 | if (Precise(inst)) { | 48 | if (IsPrecise(inst)) { |
| 50 | ctx.AddPrecF32("{}={}+{};", inst, a, b); | 49 | ctx.AddPrecF32("{}={}+{};", inst, a, b); |
| 51 | } else { | 50 | } else { |
| 52 | ctx.AddF32("{}={}+{};", inst, a, b); | 51 | ctx.AddF32("{}={}+{};", inst, a, b); |
| @@ -54,7 +53,7 @@ void EmitFPAdd32(EmitContext& ctx, IR::Inst& inst, std::string_view a, std::stri | |||
| 54 | } | 53 | } |
| 55 | 54 | ||
| 56 | void EmitFPAdd64(EmitContext& ctx, IR::Inst& inst, std::string_view a, std::string_view b) { | 55 | void EmitFPAdd64(EmitContext& ctx, IR::Inst& inst, std::string_view a, std::string_view b) { |
| 57 | if (Precise(inst)) { | 56 | if (IsPrecise(inst)) { |
| 58 | ctx.AddPrecF64("{}={}+{};", inst, a, b); | 57 | ctx.AddPrecF64("{}={}+{};", inst, a, b); |
| 59 | } else { | 58 | } else { |
| 60 | ctx.AddF64("{}={}+{};", inst, a, b); | 59 | ctx.AddF64("{}={}+{};", inst, a, b); |
| @@ -69,7 +68,7 @@ void EmitFPFma16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& i | |||
| 69 | 68 | ||
| 70 | void EmitFPFma32(EmitContext& ctx, IR::Inst& inst, std::string_view a, std::string_view b, | 69 | void EmitFPFma32(EmitContext& ctx, IR::Inst& inst, std::string_view a, std::string_view b, |
| 71 | std::string_view c) { | 70 | std::string_view c) { |
| 72 | if (Precise(inst)) { | 71 | if (IsPrecise(inst)) { |
| 73 | ctx.AddPrecF32("{}=fma({},{},{});", inst, a, b, c); | 72 | ctx.AddPrecF32("{}=fma({},{},{});", inst, a, b, c); |
| 74 | } else { | 73 | } else { |
| 75 | ctx.AddF32("{}=fma({},{},{});", inst, a, b, c); | 74 | ctx.AddF32("{}=fma({},{},{});", inst, a, b, c); |
| @@ -78,7 +77,7 @@ void EmitFPFma32(EmitContext& ctx, IR::Inst& inst, std::string_view a, std::stri | |||
| 78 | 77 | ||
| 79 | void EmitFPFma64(EmitContext& ctx, IR::Inst& inst, std::string_view a, std::string_view b, | 78 | void EmitFPFma64(EmitContext& ctx, IR::Inst& inst, std::string_view a, std::string_view b, |
| 80 | std::string_view c) { | 79 | std::string_view c) { |
| 81 | if (Precise(inst)) { | 80 | if (IsPrecise(inst)) { |
| 82 | ctx.AddPrecF64("{}=fma({},{},{});", inst, a, b, c); | 81 | ctx.AddPrecF64("{}=fma({},{},{});", inst, a, b, c); |
| 83 | } else { | 82 | } else { |
| 84 | ctx.AddF64("{}=fma({},{},{});", inst, a, b, c); | 83 | ctx.AddF64("{}=fma({},{},{});", inst, a, b, c); |
| @@ -107,7 +106,7 @@ void EmitFPMul16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& i | |||
| 107 | } | 106 | } |
| 108 | 107 | ||
| 109 | void EmitFPMul32(EmitContext& ctx, IR::Inst& inst, std::string_view a, std::string_view b) { | 108 | void EmitFPMul32(EmitContext& ctx, IR::Inst& inst, std::string_view a, std::string_view b) { |
| 110 | if (Precise(inst)) { | 109 | if (IsPrecise(inst)) { |
| 111 | ctx.AddPrecF32("{}={}*{};", inst, a, b); | 110 | ctx.AddPrecF32("{}={}*{};", inst, a, b); |
| 112 | } else { | 111 | } else { |
| 113 | ctx.AddF32("{}={}*{};", inst, a, b); | 112 | ctx.AddF32("{}={}*{};", inst, a, b); |
| @@ -115,7 +114,7 @@ void EmitFPMul32(EmitContext& ctx, IR::Inst& inst, std::string_view a, std::stri | |||
| 115 | } | 114 | } |
| 116 | 115 | ||
| 117 | void EmitFPMul64(EmitContext& ctx, IR::Inst& inst, std::string_view a, std::string_view b) { | 116 | void EmitFPMul64(EmitContext& ctx, IR::Inst& inst, std::string_view a, std::string_view b) { |
| 118 | if (Precise(inst)) { | 117 | if (IsPrecise(inst)) { |
| 119 | ctx.AddPrecF64("{}={}*{};", inst, a, b); | 118 | ctx.AddPrecF64("{}={}*{};", inst, a, b); |
| 120 | } else { | 119 | } else { |
| 121 | ctx.AddF64("{}={}*{};", inst, a, b); | 120 | ctx.AddF64("{}={}*{};", inst, a, b); |
diff --git a/src/shader_recompiler/backend/glsl/emit_glsl_instructions.h b/src/shader_recompiler/backend/glsl/emit_glsl_instructions.h index 1257575c0..0c717664f 100644 --- a/src/shader_recompiler/backend/glsl/emit_glsl_instructions.h +++ b/src/shader_recompiler/backend/glsl/emit_glsl_instructions.h | |||
| @@ -31,7 +31,7 @@ void EmitConditionRef(EmitContext& ctx, IR::Inst& inst, const IR::Value& value); | |||
| 31 | void EmitReference(EmitContext& ctx, const IR::Value& value); | 31 | void EmitReference(EmitContext& ctx, const IR::Value& value); |
| 32 | void EmitPhiMove(EmitContext& ctx, const IR::Value& phi, const IR::Value& value); | 32 | void EmitPhiMove(EmitContext& ctx, const IR::Value& phi, const IR::Value& value); |
| 33 | void EmitJoin(EmitContext& ctx); | 33 | void EmitJoin(EmitContext& ctx); |
| 34 | void EmitDemoteToHelperInvocation(EmitContext& ctx, std::string_view continue_label); | 34 | void EmitDemoteToHelperInvocation(EmitContext& ctx); |
| 35 | void EmitBarrier(EmitContext& ctx); | 35 | void EmitBarrier(EmitContext& ctx); |
| 36 | void EmitWorkgroupMemoryBarrier(EmitContext& ctx); | 36 | void EmitWorkgroupMemoryBarrier(EmitContext& ctx); |
| 37 | void EmitDeviceMemoryBarrier(EmitContext& ctx); | 37 | void EmitDeviceMemoryBarrier(EmitContext& ctx); |
diff --git a/src/shader_recompiler/backend/glsl/emit_glsl_select.cpp b/src/shader_recompiler/backend/glsl/emit_glsl_select.cpp index 49fba9073..7aa6096e6 100644 --- a/src/shader_recompiler/backend/glsl/emit_glsl_select.cpp +++ b/src/shader_recompiler/backend/glsl/emit_glsl_select.cpp | |||
| @@ -28,12 +28,12 @@ void EmitSelectU16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::stri | |||
| 28 | 28 | ||
| 29 | void EmitSelectU32(EmitContext& ctx, IR::Inst& inst, std::string_view cond, | 29 | void EmitSelectU32(EmitContext& ctx, IR::Inst& inst, std::string_view cond, |
| 30 | std::string_view true_value, std::string_view false_value) { | 30 | std::string_view true_value, std::string_view false_value) { |
| 31 | ctx.AddU32("{}={}?{}:{};", inst, cond, true_value, false_value); | 31 | ctx.AddU32("{}={}?uint({}):uint({});", inst, cond, true_value, false_value); |
| 32 | } | 32 | } |
| 33 | 33 | ||
| 34 | void EmitSelectU64(EmitContext& ctx, IR::Inst& inst, std::string_view cond, | 34 | void EmitSelectU64(EmitContext& ctx, IR::Inst& inst, std::string_view cond, |
| 35 | std::string_view true_value, std::string_view false_value) { | 35 | std::string_view true_value, std::string_view false_value) { |
| 36 | ctx.AddU64("{}={}?{}:{};", inst, cond, true_value, false_value); | 36 | ctx.AddU64("{}={}?uint64_t({}):uint64_t({});", inst, cond, true_value, false_value); |
| 37 | } | 37 | } |
| 38 | 38 | ||
| 39 | void EmitSelectF16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view cond, | 39 | void EmitSelectF16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] std::string_view cond, |
diff --git a/src/shader_recompiler/backend/glsl/emit_glsl_warp.cpp b/src/shader_recompiler/backend/glsl/emit_glsl_warp.cpp index 6ced0776c..7047928fd 100644 --- a/src/shader_recompiler/backend/glsl/emit_glsl_warp.cpp +++ b/src/shader_recompiler/backend/glsl/emit_glsl_warp.cpp | |||
| @@ -89,23 +89,23 @@ void EmitSubgroupBallot(EmitContext& ctx, IR::Inst& inst, std::string_view pred) | |||
| 89 | } | 89 | } |
| 90 | 90 | ||
| 91 | void EmitSubgroupEqMask(EmitContext& ctx, IR::Inst& inst) { | 91 | void EmitSubgroupEqMask(EmitContext& ctx, IR::Inst& inst) { |
| 92 | ctx.AddU32("{}=uvec2(gl_SubGroupEqMaskARB).x;", inst); | 92 | ctx.AddU32("{}=uint(gl_SubGroupEqMaskARB.x);", inst); |
| 93 | } | 93 | } |
| 94 | 94 | ||
| 95 | void EmitSubgroupLtMask(EmitContext& ctx, IR::Inst& inst) { | 95 | void EmitSubgroupLtMask(EmitContext& ctx, IR::Inst& inst) { |
| 96 | ctx.AddU32("{}=uvec2(gl_SubGroupLtMaskARB).x;", inst); | 96 | ctx.AddU32("{}=uint(gl_SubGroupLtMaskARB.x);", inst); |
| 97 | } | 97 | } |
| 98 | 98 | ||
| 99 | void EmitSubgroupLeMask(EmitContext& ctx, IR::Inst& inst) { | 99 | void EmitSubgroupLeMask(EmitContext& ctx, IR::Inst& inst) { |
| 100 | ctx.AddU32("{}=uvec2(gl_SubGroupLeMaskARB).x;", inst); | 100 | ctx.AddU32("{}=uint(gl_SubGroupLeMaskARB.x);", inst); |
| 101 | } | 101 | } |
| 102 | 102 | ||
| 103 | void EmitSubgroupGtMask(EmitContext& ctx, IR::Inst& inst) { | 103 | void EmitSubgroupGtMask(EmitContext& ctx, IR::Inst& inst) { |
| 104 | ctx.AddU32("{}=uvec2(gl_SubGroupGtMaskARB).x;", inst); | 104 | ctx.AddU32("{}=uint(gl_SubGroupGtMaskARB.x);", inst); |
| 105 | } | 105 | } |
| 106 | 106 | ||
| 107 | void EmitSubgroupGeMask(EmitContext& ctx, IR::Inst& inst) { | 107 | void EmitSubgroupGeMask(EmitContext& ctx, IR::Inst& inst) { |
| 108 | ctx.AddU32("{}=uvec2(gl_SubGroupGeMaskARB).x;", inst); | 108 | ctx.AddU32("{}=uint(gl_SubGroupGeMaskARB.x);", inst); |
| 109 | } | 109 | } |
| 110 | 110 | ||
| 111 | void EmitShuffleIndex(EmitContext& ctx, IR::Inst& inst, std::string_view value, | 111 | void EmitShuffleIndex(EmitContext& ctx, IR::Inst& inst, std::string_view value, |
diff --git a/src/shader_recompiler/backend/glsl/var_alloc.cpp b/src/shader_recompiler/backend/glsl/var_alloc.cpp index 95e8233e2..6a19aa549 100644 --- a/src/shader_recompiler/backend/glsl/var_alloc.cpp +++ b/src/shader_recompiler/backend/glsl/var_alloc.cpp | |||
| @@ -116,7 +116,7 @@ std::string VarAlloc::Define(IR::Inst& inst, GlslVarType type) { | |||
| 116 | id.type.Assign(type); | 116 | id.type.Assign(type); |
| 117 | GetUseTracker(type).uses_temp = true; | 117 | GetUseTracker(type).uses_temp = true; |
| 118 | inst.SetDefinition<Id>(id); | 118 | inst.SetDefinition<Id>(id); |
| 119 | return "t" + Representation(inst.Definition<Id>()); | 119 | return 't' + Representation(inst.Definition<Id>()); |
| 120 | } | 120 | } |
| 121 | } | 121 | } |
| 122 | 122 | ||