diff options
Diffstat (limited to 'src/shader_recompiler')
17 files changed, 65 insertions, 79 deletions
diff --git a/src/shader_recompiler/backend/glasm/emit_glasm.cpp b/src/shader_recompiler/backend/glasm/emit_glasm.cpp index 0cb1e193e..fd4a61a4d 100644 --- a/src/shader_recompiler/backend/glasm/emit_glasm.cpp +++ b/src/shader_recompiler/backend/glasm/emit_glasm.cpp | |||
| @@ -279,6 +279,8 @@ void SetupOptions(const IR::Program& program, const Profile& profile, | |||
| 279 | header += "OPTION NV_internal;" | 279 | header += "OPTION NV_internal;" |
| 280 | "OPTION NV_shader_storage_buffer;" | 280 | "OPTION NV_shader_storage_buffer;" |
| 281 | "OPTION NV_gpu_program_fp64;"; | 281 | "OPTION NV_gpu_program_fp64;"; |
| 282 | // TODO: Enable only when MS is used | ||
| 283 | header += "OPTION NV_texture_multisample;"; | ||
| 282 | if (info.uses_int64_bit_atomics) { | 284 | if (info.uses_int64_bit_atomics) { |
| 283 | header += "OPTION NV_shader_atomic_int64;"; | 285 | header += "OPTION NV_shader_atomic_int64;"; |
| 284 | } | 286 | } |
diff --git a/src/shader_recompiler/backend/glasm/emit_glasm_bitwise_conversion.cpp b/src/shader_recompiler/backend/glasm/emit_glasm_bitwise_conversion.cpp index 5bfdecc09..2fc2a0ac6 100644 --- a/src/shader_recompiler/backend/glasm/emit_glasm_bitwise_conversion.cpp +++ b/src/shader_recompiler/backend/glasm/emit_glasm_bitwise_conversion.cpp | |||
| @@ -43,10 +43,6 @@ void EmitBitCastU64F64(EmitContext&, IR::Inst& inst, const IR::Value& value) { | |||
| 43 | Alias(inst, value); | 43 | Alias(inst, value); |
| 44 | } | 44 | } |
| 45 | 45 | ||
| 46 | void EmitBitCastS32F32(EmitContext&, IR::Inst& inst, const IR::Value& value) { | ||
| 47 | Alias(inst, value); | ||
| 48 | } | ||
| 49 | |||
| 50 | void EmitBitCastF16U16(EmitContext&, IR::Inst& inst, const IR::Value& value) { | 46 | void EmitBitCastF16U16(EmitContext&, IR::Inst& inst, const IR::Value& value) { |
| 51 | Alias(inst, value); | 47 | Alias(inst, value); |
| 52 | } | 48 | } |
diff --git a/src/shader_recompiler/backend/glasm/emit_glasm_image.cpp b/src/shader_recompiler/backend/glasm/emit_glasm_image.cpp index e67e80fac..cf6065208 100644 --- a/src/shader_recompiler/backend/glasm/emit_glasm_image.cpp +++ b/src/shader_recompiler/backend/glasm/emit_glasm_image.cpp | |||
| @@ -59,7 +59,7 @@ std::string Image(EmitContext& ctx, IR::TextureInstInfo info, | |||
| 59 | } | 59 | } |
| 60 | } | 60 | } |
| 61 | 61 | ||
| 62 | std::string_view TextureType(IR::TextureInstInfo info) { | 62 | std::string_view TextureType(IR::TextureInstInfo info, bool is_ms = false) { |
| 63 | if (info.is_depth) { | 63 | if (info.is_depth) { |
| 64 | switch (info.type) { | 64 | switch (info.type) { |
| 65 | case TextureType::Color1D: | 65 | case TextureType::Color1D: |
| @@ -88,9 +88,9 @@ std::string_view TextureType(IR::TextureInstInfo info) { | |||
| 88 | return "ARRAY1D"; | 88 | return "ARRAY1D"; |
| 89 | case TextureType::Color2D: | 89 | case TextureType::Color2D: |
| 90 | case TextureType::Color2DRect: | 90 | case TextureType::Color2DRect: |
| 91 | return "2D"; | 91 | return is_ms ? "2DMS" : "2D"; |
| 92 | case TextureType::ColorArray2D: | 92 | case TextureType::ColorArray2D: |
| 93 | return "ARRAY2D"; | 93 | return is_ms ? "ARRAY2DMS" : "ARRAY2D"; |
| 94 | case TextureType::Color3D: | 94 | case TextureType::Color3D: |
| 95 | return "3D"; | 95 | return "3D"; |
| 96 | case TextureType::ColorCube: | 96 | case TextureType::ColorCube: |
| @@ -510,15 +510,16 @@ void EmitImageFetch(EmitContext& ctx, IR::Inst& inst, const IR::Value& index, | |||
| 510 | const IR::Value& coord, const IR::Value& offset, ScalarS32 lod, ScalarS32 ms) { | 510 | const IR::Value& coord, const IR::Value& offset, ScalarS32 lod, ScalarS32 ms) { |
| 511 | const auto info{inst.Flags<IR::TextureInstInfo>()}; | 511 | const auto info{inst.Flags<IR::TextureInstInfo>()}; |
| 512 | const auto sparse_inst{PrepareSparse(inst)}; | 512 | const auto sparse_inst{PrepareSparse(inst)}; |
| 513 | const bool is_multisample{ms.type != Type::Void}; | ||
| 513 | const std::string_view sparse_mod{sparse_inst ? ".SPARSE" : ""}; | 514 | const std::string_view sparse_mod{sparse_inst ? ".SPARSE" : ""}; |
| 514 | const std::string_view type{TextureType(info)}; | 515 | const std::string_view type{TextureType(info, is_multisample)}; |
| 515 | const std::string texture{Texture(ctx, info, index)}; | 516 | const std::string texture{Texture(ctx, info, index)}; |
| 516 | const std::string offset_vec{Offset(ctx, offset)}; | 517 | const std::string offset_vec{Offset(ctx, offset)}; |
| 517 | const auto [coord_vec, coord_alloc]{Coord(ctx, coord)}; | 518 | const auto [coord_vec, coord_alloc]{Coord(ctx, coord)}; |
| 518 | const Register ret{ctx.reg_alloc.Define(inst)}; | 519 | const Register ret{ctx.reg_alloc.Define(inst)}; |
| 519 | if (info.type == TextureType::Buffer) { | 520 | if (info.type == TextureType::Buffer) { |
| 520 | ctx.Add("TXF.F{} {},{},{},{}{};", sparse_mod, ret, coord_vec, texture, type, offset_vec); | 521 | ctx.Add("TXF.F{} {},{},{},{}{};", sparse_mod, ret, coord_vec, texture, type, offset_vec); |
| 521 | } else if (ms.type != Type::Void) { | 522 | } else if (is_multisample) { |
| 522 | ctx.Add("MOV.S {}.w,{};" | 523 | ctx.Add("MOV.S {}.w,{};" |
| 523 | "TXFMS.F{} {},{},{},{}{};", | 524 | "TXFMS.F{} {},{},{},{}{};", |
| 524 | coord_vec, ms, sparse_mod, ret, coord_vec, texture, type, offset_vec); | 525 | coord_vec, ms, sparse_mod, ret, coord_vec, texture, type, offset_vec); |
diff --git a/src/shader_recompiler/backend/glasm/emit_glasm_instructions.h b/src/shader_recompiler/backend/glasm/emit_glasm_instructions.h index eaaf9ba39..415a249e4 100644 --- a/src/shader_recompiler/backend/glasm/emit_glasm_instructions.h +++ b/src/shader_recompiler/backend/glasm/emit_glasm_instructions.h | |||
| @@ -197,7 +197,6 @@ void EmitSelectF64(EmitContext& ctx, ScalarS32 cond, Register true_value, Regist | |||
| 197 | void EmitBitCastU16F16(EmitContext& ctx, IR::Inst& inst, const IR::Value& value); | 197 | void EmitBitCastU16F16(EmitContext& ctx, IR::Inst& inst, const IR::Value& value); |
| 198 | void EmitBitCastU32F32(EmitContext& ctx, IR::Inst& inst, const IR::Value& value); | 198 | void EmitBitCastU32F32(EmitContext& ctx, IR::Inst& inst, const IR::Value& value); |
| 199 | void EmitBitCastU64F64(EmitContext& ctx, IR::Inst& inst, const IR::Value& value); | 199 | void EmitBitCastU64F64(EmitContext& ctx, IR::Inst& inst, const IR::Value& value); |
| 200 | void EmitBitCastS32F32(EmitContext& ctx, IR::Inst& inst, const IR::Value& value); | ||
| 201 | void EmitBitCastF16U16(EmitContext& ctx, IR::Inst& inst, const IR::Value& value); | 200 | void EmitBitCastF16U16(EmitContext& ctx, IR::Inst& inst, const IR::Value& value); |
| 202 | void EmitBitCastF32U32(EmitContext& ctx, IR::Inst& inst, const IR::Value& value); | 201 | void EmitBitCastF32U32(EmitContext& ctx, IR::Inst& inst, const IR::Value& value); |
| 203 | void EmitBitCastF64U64(EmitContext& ctx, IR::Inst& inst, const IR::Value& value); | 202 | void EmitBitCastF64U64(EmitContext& ctx, IR::Inst& inst, const IR::Value& value); |
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 8e5e6cf1f..1be4a0f59 100644 --- a/src/shader_recompiler/backend/glsl/emit_glsl_bitwise_conversion.cpp +++ b/src/shader_recompiler/backend/glsl/emit_glsl_bitwise_conversion.cpp | |||
| @@ -48,10 +48,6 @@ void EmitBitCastU64F64(EmitContext& ctx, IR::Inst& inst, std::string_view value) | |||
| 48 | ctx.AddU64("{}=doubleBitsToUint64({});", inst, value); | 48 | ctx.AddU64("{}=doubleBitsToUint64({});", inst, value); |
| 49 | } | 49 | } |
| 50 | 50 | ||
| 51 | void EmitBitCastS32F32(EmitContext& ctx, IR::Inst& inst, std::string_view value) { | ||
| 52 | ctx.AddF32("{}=ftoi({});", inst, value); | ||
| 53 | } | ||
| 54 | |||
| 55 | void EmitBitCastF16U16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst) { | 51 | void EmitBitCastF16U16([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst) { |
| 56 | NotImplemented(); | 52 | NotImplemented(); |
| 57 | } | 53 | } |
diff --git a/src/shader_recompiler/backend/glsl/emit_glsl_image.cpp b/src/shader_recompiler/backend/glsl/emit_glsl_image.cpp index cecdbb9d6..d8874b0cc 100644 --- a/src/shader_recompiler/backend/glsl/emit_glsl_image.cpp +++ b/src/shader_recompiler/backend/glsl/emit_glsl_image.cpp | |||
| @@ -414,7 +414,7 @@ void EmitImageGatherDref(EmitContext& ctx, IR::Inst& inst, const IR::Value& inde | |||
| 414 | 414 | ||
| 415 | void EmitImageFetch(EmitContext& ctx, IR::Inst& inst, const IR::Value& index, | 415 | void EmitImageFetch(EmitContext& ctx, IR::Inst& inst, const IR::Value& index, |
| 416 | std::string_view coords, std::string_view offset, std::string_view lod, | 416 | std::string_view coords, std::string_view offset, std::string_view lod, |
| 417 | [[maybe_unused]] std::string_view ms) { | 417 | std::string_view ms) { |
| 418 | const auto info{inst.Flags<IR::TextureInstInfo>()}; | 418 | const auto info{inst.Flags<IR::TextureInstInfo>()}; |
| 419 | if (info.has_bias) { | 419 | if (info.has_bias) { |
| 420 | throw NotImplementedException("EmitImageFetch Bias texture samples"); | 420 | throw NotImplementedException("EmitImageFetch Bias texture samples"); |
| @@ -431,19 +431,24 @@ void EmitImageFetch(EmitContext& ctx, IR::Inst& inst, const IR::Value& index, | |||
| 431 | ctx.AddU1("{}=true;", *sparse_inst); | 431 | ctx.AddU1("{}=true;", *sparse_inst); |
| 432 | } | 432 | } |
| 433 | if (!sparse_inst || !supports_sparse) { | 433 | if (!sparse_inst || !supports_sparse) { |
| 434 | if (!offset.empty()) { | 434 | const auto int_coords{CoordsCastToInt(coords, info)}; |
| 435 | ctx.Add("{}=texelFetchOffset({},{},int({}),{});", texel, texture, | 435 | if (!ms.empty()) { |
| 436 | CoordsCastToInt(coords, info), lod, CoordsCastToInt(offset, info)); | 436 | ctx.Add("{}=texelFetch({},{},int({}));", texel, texture, int_coords, ms); |
| 437 | } else if (!offset.empty()) { | ||
| 438 | ctx.Add("{}=texelFetchOffset({},{},int({}),{});", texel, texture, int_coords, lod, | ||
| 439 | CoordsCastToInt(offset, info)); | ||
| 437 | } else { | 440 | } else { |
| 438 | if (info.type == TextureType::Buffer) { | 441 | if (info.type == TextureType::Buffer) { |
| 439 | ctx.Add("{}=texelFetch({},int({}));", texel, texture, coords); | 442 | ctx.Add("{}=texelFetch({},int({}));", texel, texture, coords); |
| 440 | } else { | 443 | } else { |
| 441 | ctx.Add("{}=texelFetch({},{},int({}));", texel, texture, | 444 | ctx.Add("{}=texelFetch({},{},int({}));", texel, texture, int_coords, lod); |
| 442 | CoordsCastToInt(coords, info), lod); | ||
| 443 | } | 445 | } |
| 444 | } | 446 | } |
| 445 | return; | 447 | return; |
| 446 | } | 448 | } |
| 449 | if (!ms.empty()) { | ||
| 450 | throw NotImplementedException("EmitImageFetch Sparse MSAA samples"); | ||
| 451 | } | ||
| 447 | if (!offset.empty()) { | 452 | if (!offset.empty()) { |
| 448 | ctx.AddU1("{}=sparseTexelsResidentARB(sparseTexelFetchOffsetARB({},{},int({}),{},{}));", | 453 | ctx.AddU1("{}=sparseTexelsResidentARB(sparseTexelFetchOffsetARB({},{},int({}),{},{}));", |
| 449 | *sparse_inst, texture, CastToIntVec(coords, info), lod, | 454 | *sparse_inst, texture, CastToIntVec(coords, info), lod, |
diff --git a/src/shader_recompiler/backend/glsl/emit_glsl_instructions.h b/src/shader_recompiler/backend/glsl/emit_glsl_instructions.h index 4151c89de..c6df1dba7 100644 --- a/src/shader_recompiler/backend/glsl/emit_glsl_instructions.h +++ b/src/shader_recompiler/backend/glsl/emit_glsl_instructions.h | |||
| @@ -231,7 +231,6 @@ void EmitSelectF64(EmitContext& ctx, IR::Inst& inst, std::string_view cond, | |||
| 231 | void EmitBitCastU16F16(EmitContext& ctx, IR::Inst& inst); | 231 | void EmitBitCastU16F16(EmitContext& ctx, IR::Inst& inst); |
| 232 | void EmitBitCastU32F32(EmitContext& ctx, IR::Inst& inst, std::string_view value); | 232 | void EmitBitCastU32F32(EmitContext& ctx, IR::Inst& inst, std::string_view value); |
| 233 | void EmitBitCastU64F64(EmitContext& ctx, IR::Inst& inst, std::string_view value); | 233 | void EmitBitCastU64F64(EmitContext& ctx, IR::Inst& inst, std::string_view value); |
| 234 | void EmitBitCastS32F32(EmitContext& ctx, IR::Inst& inst, std::string_view value); | ||
| 235 | void EmitBitCastF16U16(EmitContext& ctx, IR::Inst& inst); | 234 | void EmitBitCastF16U16(EmitContext& ctx, IR::Inst& inst); |
| 236 | void EmitBitCastF32U32(EmitContext& ctx, IR::Inst& inst, std::string_view value); | 235 | void EmitBitCastF32U32(EmitContext& ctx, IR::Inst& inst, std::string_view value); |
| 237 | void EmitBitCastF64U64(EmitContext& ctx, IR::Inst& inst, std::string_view value); | 236 | void EmitBitCastF64U64(EmitContext& ctx, IR::Inst& inst, std::string_view value); |
diff --git a/src/shader_recompiler/backend/glsl/glsl_emit_context.cpp b/src/shader_recompiler/backend/glsl/glsl_emit_context.cpp index 5d01ec0cd..1b006e811 100644 --- a/src/shader_recompiler/backend/glsl/glsl_emit_context.cpp +++ b/src/shader_recompiler/backend/glsl/glsl_emit_context.cpp | |||
| @@ -61,24 +61,28 @@ std::string OutputDecorator(Stage stage, u32 size) { | |||
| 61 | } | 61 | } |
| 62 | } | 62 | } |
| 63 | 63 | ||
| 64 | std::string_view SamplerType(TextureType type, bool is_depth) { | 64 | std::string_view DepthSamplerType(TextureType type) { |
| 65 | if (is_depth) { | 65 | switch (type) { |
| 66 | switch (type) { | 66 | case TextureType::Color1D: |
| 67 | case TextureType::Color1D: | 67 | return "sampler1DShadow"; |
| 68 | return "sampler1DShadow"; | 68 | case TextureType::ColorArray1D: |
| 69 | case TextureType::ColorArray1D: | 69 | return "sampler1DArrayShadow"; |
| 70 | return "sampler1DArrayShadow"; | 70 | case TextureType::Color2D: |
| 71 | case TextureType::Color2D: | 71 | return "sampler2DShadow"; |
| 72 | return "sampler2DShadow"; | 72 | case TextureType::ColorArray2D: |
| 73 | case TextureType::ColorArray2D: | 73 | return "sampler2DArrayShadow"; |
| 74 | return "sampler2DArrayShadow"; | 74 | case TextureType::ColorCube: |
| 75 | case TextureType::ColorCube: | 75 | return "samplerCubeShadow"; |
| 76 | return "samplerCubeShadow"; | 76 | case TextureType::ColorArrayCube: |
| 77 | case TextureType::ColorArrayCube: | 77 | return "samplerCubeArrayShadow"; |
| 78 | return "samplerCubeArrayShadow"; | 78 | default: |
| 79 | default: | 79 | throw NotImplementedException("Texture type: {}", type); |
| 80 | throw NotImplementedException("Texture type: {}", type); | 80 | } |
| 81 | } | 81 | } |
| 82 | |||
| 83 | std::string_view ColorSamplerType(TextureType type, bool is_multisample = false) { | ||
| 84 | if (is_multisample) { | ||
| 85 | ASSERT(type == TextureType::Color2D || type == TextureType::ColorArray2D); | ||
| 82 | } | 86 | } |
| 83 | switch (type) { | 87 | switch (type) { |
| 84 | case TextureType::Color1D: | 88 | case TextureType::Color1D: |
| @@ -87,9 +91,9 @@ std::string_view SamplerType(TextureType type, bool is_depth) { | |||
| 87 | return "sampler1DArray"; | 91 | return "sampler1DArray"; |
| 88 | case TextureType::Color2D: | 92 | case TextureType::Color2D: |
| 89 | case TextureType::Color2DRect: | 93 | case TextureType::Color2DRect: |
| 90 | return "sampler2D"; | 94 | return is_multisample ? "sampler2DMS" : "sampler2D"; |
| 91 | case TextureType::ColorArray2D: | 95 | case TextureType::ColorArray2D: |
| 92 | return "sampler2DArray"; | 96 | return is_multisample ? "sampler2DMSArray" : "sampler2DArray"; |
| 93 | case TextureType::Color3D: | 97 | case TextureType::Color3D: |
| 94 | return "sampler3D"; | 98 | return "sampler3D"; |
| 95 | case TextureType::ColorCube: | 99 | case TextureType::ColorCube: |
| @@ -677,7 +681,7 @@ void EmitContext::SetupTextures(Bindings& bindings) { | |||
| 677 | texture_buffers.reserve(info.texture_buffer_descriptors.size()); | 681 | texture_buffers.reserve(info.texture_buffer_descriptors.size()); |
| 678 | for (const auto& desc : info.texture_buffer_descriptors) { | 682 | for (const auto& desc : info.texture_buffer_descriptors) { |
| 679 | texture_buffers.push_back({bindings.texture, desc.count}); | 683 | texture_buffers.push_back({bindings.texture, desc.count}); |
| 680 | const auto sampler_type{SamplerType(TextureType::Buffer, false)}; | 684 | const auto sampler_type{ColorSamplerType(TextureType::Buffer)}; |
| 681 | const auto array_decorator{desc.count > 1 ? fmt::format("[{}]", desc.count) : ""}; | 685 | const auto array_decorator{desc.count > 1 ? fmt::format("[{}]", desc.count) : ""}; |
| 682 | header += fmt::format("layout(binding={}) uniform {} tex{}{};", bindings.texture, | 686 | header += fmt::format("layout(binding={}) uniform {} tex{}{};", bindings.texture, |
| 683 | sampler_type, bindings.texture, array_decorator); | 687 | sampler_type, bindings.texture, array_decorator); |
| @@ -686,7 +690,8 @@ void EmitContext::SetupTextures(Bindings& bindings) { | |||
| 686 | textures.reserve(info.texture_descriptors.size()); | 690 | textures.reserve(info.texture_descriptors.size()); |
| 687 | for (const auto& desc : info.texture_descriptors) { | 691 | for (const auto& desc : info.texture_descriptors) { |
| 688 | textures.push_back({bindings.texture, desc.count}); | 692 | textures.push_back({bindings.texture, desc.count}); |
| 689 | const auto sampler_type{SamplerType(desc.type, desc.is_depth)}; | 693 | const auto sampler_type{desc.is_depth ? DepthSamplerType(desc.type) |
| 694 | : ColorSamplerType(desc.type, desc.is_multisample)}; | ||
| 690 | const auto array_decorator{desc.count > 1 ? fmt::format("[{}]", desc.count) : ""}; | 695 | const auto array_decorator{desc.count > 1 ? fmt::format("[{}]", desc.count) : ""}; |
| 691 | header += fmt::format("layout(binding={}) uniform {} tex{}{};", bindings.texture, | 696 | header += fmt::format("layout(binding={}) uniform {} tex{}{};", bindings.texture, |
| 692 | sampler_type, bindings.texture, array_decorator); | 697 | sampler_type, bindings.texture, array_decorator); |
diff --git a/src/shader_recompiler/backend/spirv/emit_spirv_bitwise_conversion.cpp b/src/shader_recompiler/backend/spirv/emit_spirv_bitwise_conversion.cpp index 50daacd95..c4ca28d11 100644 --- a/src/shader_recompiler/backend/spirv/emit_spirv_bitwise_conversion.cpp +++ b/src/shader_recompiler/backend/spirv/emit_spirv_bitwise_conversion.cpp | |||
| @@ -18,10 +18,6 @@ void EmitBitCastU64F64(EmitContext&) { | |||
| 18 | throw NotImplementedException("SPIR-V Instruction"); | 18 | throw NotImplementedException("SPIR-V Instruction"); |
| 19 | } | 19 | } |
| 20 | 20 | ||
| 21 | void EmitBitCastS32F32(EmitContext&) { | ||
| 22 | throw NotImplementedException("SPIR-V Instruction"); | ||
| 23 | } | ||
| 24 | |||
| 25 | void EmitBitCastF16U16(EmitContext&) { | 21 | void EmitBitCastF16U16(EmitContext&) { |
| 26 | throw NotImplementedException("SPIR-V Instruction"); | 22 | throw NotImplementedException("SPIR-V Instruction"); |
| 27 | } | 23 | } |
diff --git a/src/shader_recompiler/backend/spirv/emit_spirv_instructions.h b/src/shader_recompiler/backend/spirv/emit_spirv_instructions.h index e31cdc5e8..db12e8176 100644 --- a/src/shader_recompiler/backend/spirv/emit_spirv_instructions.h +++ b/src/shader_recompiler/backend/spirv/emit_spirv_instructions.h | |||
| @@ -179,7 +179,6 @@ Id EmitSelectF64(EmitContext& ctx, Id cond, Id true_value, Id false_value); | |||
| 179 | void EmitBitCastU16F16(EmitContext& ctx); | 179 | void EmitBitCastU16F16(EmitContext& ctx); |
| 180 | Id EmitBitCastU32F32(EmitContext& ctx, Id value); | 180 | Id EmitBitCastU32F32(EmitContext& ctx, Id value); |
| 181 | void EmitBitCastU64F64(EmitContext& ctx); | 181 | void EmitBitCastU64F64(EmitContext& ctx); |
| 182 | void EmitBitCastS32F32(EmitContext& ctx); | ||
| 183 | void EmitBitCastF16U16(EmitContext&); | 182 | void EmitBitCastF16U16(EmitContext&); |
| 184 | Id EmitBitCastF32U32(EmitContext& ctx, Id value); | 183 | Id EmitBitCastF32U32(EmitContext& ctx, Id value); |
| 185 | void EmitBitCastF64U64(EmitContext& ctx); | 184 | void EmitBitCastF64U64(EmitContext& ctx); |
diff --git a/src/shader_recompiler/frontend/ir/ir_emitter.cpp b/src/shader_recompiler/frontend/ir/ir_emitter.cpp index eb2e49a68..430797d23 100644 --- a/src/shader_recompiler/frontend/ir/ir_emitter.cpp +++ b/src/shader_recompiler/frontend/ir/ir_emitter.cpp | |||
| @@ -704,11 +704,6 @@ IR::U32 IREmitter::BitCast<IR::U32, IR::F32>(const IR::F32& value) { | |||
| 704 | } | 704 | } |
| 705 | 705 | ||
| 706 | template <> | 706 | template <> |
| 707 | IR::S32 IREmitter::BitCast<IR::S32, IR::F32>(const IR::F32& value) { | ||
| 708 | return Inst<IR::S32>(Opcode::BitCastS32F32, value); | ||
| 709 | } | ||
| 710 | |||
| 711 | template <> | ||
| 712 | IR::F32 IREmitter::BitCast<IR::F32, IR::U32>(const IR::U32& value) { | 707 | IR::F32 IREmitter::BitCast<IR::F32, IR::U32>(const IR::U32& value) { |
| 713 | return Inst<IR::F32>(Opcode::BitCastF32U32, value); | 708 | return Inst<IR::F32>(Opcode::BitCastF32U32, value); |
| 714 | } | 709 | } |
diff --git a/src/shader_recompiler/frontend/ir/opcodes.h b/src/shader_recompiler/frontend/ir/opcodes.h index d155afd0f..e300714f3 100644 --- a/src/shader_recompiler/frontend/ir/opcodes.h +++ b/src/shader_recompiler/frontend/ir/opcodes.h | |||
| @@ -38,7 +38,6 @@ constexpr Type U8{Type::U8}; | |||
| 38 | constexpr Type U16{Type::U16}; | 38 | constexpr Type U16{Type::U16}; |
| 39 | constexpr Type U32{Type::U32}; | 39 | constexpr Type U32{Type::U32}; |
| 40 | constexpr Type U64{Type::U64}; | 40 | constexpr Type U64{Type::U64}; |
| 41 | constexpr Type S32{Type::S32}; | ||
| 42 | constexpr Type F16{Type::F16}; | 41 | constexpr Type F16{Type::F16}; |
| 43 | constexpr Type F32{Type::F32}; | 42 | constexpr Type F32{Type::F32}; |
| 44 | constexpr Type F64{Type::F64}; | 43 | constexpr Type F64{Type::F64}; |
diff --git a/src/shader_recompiler/frontend/ir/opcodes.inc b/src/shader_recompiler/frontend/ir/opcodes.inc index 1fe3749cc..24e82f802 100644 --- a/src/shader_recompiler/frontend/ir/opcodes.inc +++ b/src/shader_recompiler/frontend/ir/opcodes.inc | |||
| @@ -175,7 +175,6 @@ OPCODE(SelectF64, F64, U1, | |||
| 175 | OPCODE(BitCastU16F16, U16, F16, ) | 175 | OPCODE(BitCastU16F16, U16, F16, ) |
| 176 | OPCODE(BitCastU32F32, U32, F32, ) | 176 | OPCODE(BitCastU32F32, U32, F32, ) |
| 177 | OPCODE(BitCastU64F64, U64, F64, ) | 177 | OPCODE(BitCastU64F64, U64, F64, ) |
| 178 | OPCODE(BitCastS32F32, S32, F32, ) | ||
| 179 | OPCODE(BitCastF16U16, F16, U16, ) | 178 | OPCODE(BitCastF16U16, F16, U16, ) |
| 180 | OPCODE(BitCastF32U32, F32, U32, ) | 179 | OPCODE(BitCastF32U32, F32, U32, ) |
| 181 | OPCODE(BitCastF64U64, F64, U64, ) | 180 | OPCODE(BitCastF64U64, F64, U64, ) |
diff --git a/src/shader_recompiler/frontend/ir/type.h b/src/shader_recompiler/frontend/ir/type.h index 5a7c706ad..04c8c4ddb 100644 --- a/src/shader_recompiler/frontend/ir/type.h +++ b/src/shader_recompiler/frontend/ir/type.h | |||
| @@ -24,22 +24,21 @@ enum class Type { | |||
| 24 | U16 = 1 << 7, | 24 | U16 = 1 << 7, |
| 25 | U32 = 1 << 8, | 25 | U32 = 1 << 8, |
| 26 | U64 = 1 << 9, | 26 | U64 = 1 << 9, |
| 27 | S32 = 1 << 10, | 27 | F16 = 1 << 10, |
| 28 | F16 = 1 << 11, | 28 | F32 = 1 << 11, |
| 29 | F32 = 1 << 12, | 29 | F64 = 1 << 12, |
| 30 | F64 = 1 << 13, | 30 | U32x2 = 1 << 13, |
| 31 | U32x2 = 1 << 14, | 31 | U32x3 = 1 << 14, |
| 32 | U32x3 = 1 << 15, | 32 | U32x4 = 1 << 15, |
| 33 | U32x4 = 1 << 16, | 33 | F16x2 = 1 << 16, |
| 34 | F16x2 = 1 << 17, | 34 | F16x3 = 1 << 17, |
| 35 | F16x3 = 1 << 18, | 35 | F16x4 = 1 << 18, |
| 36 | F16x4 = 1 << 19, | 36 | F32x2 = 1 << 19, |
| 37 | F32x2 = 1 << 20, | 37 | F32x3 = 1 << 20, |
| 38 | F32x3 = 1 << 21, | 38 | F32x4 = 1 << 21, |
| 39 | F32x4 = 1 << 22, | 39 | F64x2 = 1 << 22, |
| 40 | F64x2 = 1 << 23, | 40 | F64x3 = 1 << 23, |
| 41 | F64x3 = 1 << 24, | 41 | F64x4 = 1 << 24, |
| 42 | F64x4 = 1 << 25, | ||
| 43 | }; | 42 | }; |
| 44 | DECLARE_ENUM_FLAG_OPERATORS(Type) | 43 | DECLARE_ENUM_FLAG_OPERATORS(Type) |
| 45 | 44 | ||
diff --git a/src/shader_recompiler/frontend/ir/value.cpp b/src/shader_recompiler/frontend/ir/value.cpp index 30ba12316..346169328 100644 --- a/src/shader_recompiler/frontend/ir/value.cpp +++ b/src/shader_recompiler/frontend/ir/value.cpp | |||
| @@ -23,8 +23,6 @@ Value::Value(u16 value) noexcept : type{Type::U16}, imm_u16{value} {} | |||
| 23 | 23 | ||
| 24 | Value::Value(u32 value) noexcept : type{Type::U32}, imm_u32{value} {} | 24 | Value::Value(u32 value) noexcept : type{Type::U32}, imm_u32{value} {} |
| 25 | 25 | ||
| 26 | Value::Value(s32 value) noexcept : type{Type::S32}, imm_s32{value} {} | ||
| 27 | |||
| 28 | Value::Value(f32 value) noexcept : type{Type::F32}, imm_f32{value} {} | 26 | Value::Value(f32 value) noexcept : type{Type::F32}, imm_f32{value} {} |
| 29 | 27 | ||
| 30 | Value::Value(u64 value) noexcept : type{Type::U64}, imm_u64{value} {} | 28 | Value::Value(u64 value) noexcept : type{Type::U64}, imm_u64{value} {} |
| @@ -71,7 +69,6 @@ bool Value::operator==(const Value& other) const { | |||
| 71 | return imm_u16 == other.imm_u16; | 69 | return imm_u16 == other.imm_u16; |
| 72 | case Type::U32: | 70 | case Type::U32: |
| 73 | case Type::F32: | 71 | case Type::F32: |
| 74 | case Type::S32: | ||
| 75 | return imm_u32 == other.imm_u32; | 72 | return imm_u32 == other.imm_u32; |
| 76 | case Type::U64: | 73 | case Type::U64: |
| 77 | case Type::F64: | 74 | case Type::F64: |
diff --git a/src/shader_recompiler/frontend/ir/value.h b/src/shader_recompiler/frontend/ir/value.h index 8b34356fd..883dfa24e 100644 --- a/src/shader_recompiler/frontend/ir/value.h +++ b/src/shader_recompiler/frontend/ir/value.h | |||
| @@ -268,7 +268,6 @@ using U8 = TypedValue<Type::U8>; | |||
| 268 | using U16 = TypedValue<Type::U16>; | 268 | using U16 = TypedValue<Type::U16>; |
| 269 | using U32 = TypedValue<Type::U32>; | 269 | using U32 = TypedValue<Type::U32>; |
| 270 | using U64 = TypedValue<Type::U64>; | 270 | using U64 = TypedValue<Type::U64>; |
| 271 | using S32 = TypedValue<Type::S32>; | ||
| 272 | using F16 = TypedValue<Type::F16>; | 271 | using F16 = TypedValue<Type::F16>; |
| 273 | using F32 = TypedValue<Type::F32>; | 272 | using F32 = TypedValue<Type::F32>; |
| 274 | using F64 = TypedValue<Type::F64>; | 273 | using F64 = TypedValue<Type::F64>; |
diff --git a/src/shader_recompiler/ir_opt/texture_pass.cpp b/src/shader_recompiler/ir_opt/texture_pass.cpp index 9718c6921..70b620dcb 100644 --- a/src/shader_recompiler/ir_opt/texture_pass.cpp +++ b/src/shader_recompiler/ir_opt/texture_pass.cpp | |||
| @@ -486,10 +486,10 @@ void PatchTexelFetch(IR::Block& block, IR::Inst& inst, TexturePixelFormat pixel_ | |||
| 486 | const IR::F32 w(ir.CompositeExtract(new_inst, 3)); | 486 | const IR::F32 w(ir.CompositeExtract(new_inst, 3)); |
| 487 | const IR::F16F32F64 max_value(ir.Imm32(get_max_value())); | 487 | const IR::F16F32F64 max_value(ir.Imm32(get_max_value())); |
| 488 | const IR::Value converted = | 488 | const IR::Value converted = |
| 489 | ir.CompositeConstruct(ir.FPMul(ir.ConvertSToF(32, 32, ir.BitCast<IR::S32>(x)), max_value), | 489 | ir.CompositeConstruct(ir.FPMul(ir.ConvertSToF(32, 32, ir.BitCast<IR::U32>(x)), max_value), |
| 490 | ir.FPMul(ir.ConvertSToF(32, 32, ir.BitCast<IR::S32>(y)), max_value), | 490 | ir.FPMul(ir.ConvertSToF(32, 32, ir.BitCast<IR::U32>(y)), max_value), |
| 491 | ir.FPMul(ir.ConvertSToF(32, 32, ir.BitCast<IR::S32>(z)), max_value), | 491 | ir.FPMul(ir.ConvertSToF(32, 32, ir.BitCast<IR::U32>(z)), max_value), |
| 492 | ir.FPMul(ir.ConvertSToF(32, 32, ir.BitCast<IR::S32>(w)), max_value)); | 492 | ir.FPMul(ir.ConvertSToF(32, 32, ir.BitCast<IR::U32>(w)), max_value)); |
| 493 | inst.ReplaceUsesWith(converted); | 493 | inst.ReplaceUsesWith(converted); |
| 494 | } | 494 | } |
| 495 | } // Anonymous namespace | 495 | } // Anonymous namespace |