diff options
Diffstat (limited to 'src/shader_recompiler/backend/glasm')
4 files changed, 19 insertions, 13 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..85ee27333 100644 --- a/src/shader_recompiler/backend/glasm/emit_glasm_image.cpp +++ b/src/shader_recompiler/backend/glasm/emit_glasm_image.cpp | |||
| @@ -59,7 +59,14 @@ std::string Image(EmitContext& ctx, IR::TextureInstInfo info, | |||
| 59 | } | 59 | } |
| 60 | } | 60 | } |
| 61 | 61 | ||
| 62 | std::string_view TextureType(IR::TextureInstInfo info) { | 62 | bool IsTextureMsaa(EmitContext& ctx, const IR::TextureInstInfo& info) { |
| 63 | if (info.type == TextureType::Buffer) { | ||
| 64 | return false; | ||
| 65 | } | ||
| 66 | return ctx.info.texture_descriptors.at(info.descriptor_index).is_multisample; | ||
| 67 | } | ||
| 68 | |||
| 69 | std::string_view TextureType(IR::TextureInstInfo info, bool is_ms = false) { | ||
| 63 | if (info.is_depth) { | 70 | if (info.is_depth) { |
| 64 | switch (info.type) { | 71 | switch (info.type) { |
| 65 | case TextureType::Color1D: | 72 | case TextureType::Color1D: |
| @@ -88,9 +95,9 @@ std::string_view TextureType(IR::TextureInstInfo info) { | |||
| 88 | return "ARRAY1D"; | 95 | return "ARRAY1D"; |
| 89 | case TextureType::Color2D: | 96 | case TextureType::Color2D: |
| 90 | case TextureType::Color2DRect: | 97 | case TextureType::Color2DRect: |
| 91 | return "2D"; | 98 | return is_ms ? "2DMS" : "2D"; |
| 92 | case TextureType::ColorArray2D: | 99 | case TextureType::ColorArray2D: |
| 93 | return "ARRAY2D"; | 100 | return is_ms ? "ARRAY2DMS" : "ARRAY2D"; |
| 94 | case TextureType::Color3D: | 101 | case TextureType::Color3D: |
| 95 | return "3D"; | 102 | return "3D"; |
| 96 | case TextureType::ColorCube: | 103 | case TextureType::ColorCube: |
| @@ -510,15 +517,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) { | 517 | const IR::Value& coord, const IR::Value& offset, ScalarS32 lod, ScalarS32 ms) { |
| 511 | const auto info{inst.Flags<IR::TextureInstInfo>()}; | 518 | const auto info{inst.Flags<IR::TextureInstInfo>()}; |
| 512 | const auto sparse_inst{PrepareSparse(inst)}; | 519 | const auto sparse_inst{PrepareSparse(inst)}; |
| 520 | const bool is_multisample{ms.type != Type::Void}; | ||
| 513 | const std::string_view sparse_mod{sparse_inst ? ".SPARSE" : ""}; | 521 | const std::string_view sparse_mod{sparse_inst ? ".SPARSE" : ""}; |
| 514 | const std::string_view type{TextureType(info)}; | 522 | const std::string_view type{TextureType(info, is_multisample)}; |
| 515 | const std::string texture{Texture(ctx, info, index)}; | 523 | const std::string texture{Texture(ctx, info, index)}; |
| 516 | const std::string offset_vec{Offset(ctx, offset)}; | 524 | const std::string offset_vec{Offset(ctx, offset)}; |
| 517 | const auto [coord_vec, coord_alloc]{Coord(ctx, coord)}; | 525 | const auto [coord_vec, coord_alloc]{Coord(ctx, coord)}; |
| 518 | const Register ret{ctx.reg_alloc.Define(inst)}; | 526 | const Register ret{ctx.reg_alloc.Define(inst)}; |
| 519 | if (info.type == TextureType::Buffer) { | 527 | if (info.type == TextureType::Buffer) { |
| 520 | ctx.Add("TXF.F{} {},{},{},{}{};", sparse_mod, ret, coord_vec, texture, type, offset_vec); | 528 | ctx.Add("TXF.F{} {},{},{},{}{};", sparse_mod, ret, coord_vec, texture, type, offset_vec); |
| 521 | } else if (ms.type != Type::Void) { | 529 | } else if (is_multisample) { |
| 522 | ctx.Add("MOV.S {}.w,{};" | 530 | ctx.Add("MOV.S {}.w,{};" |
| 523 | "TXFMS.F{} {},{},{},{}{};", | 531 | "TXFMS.F{} {},{},{},{}{};", |
| 524 | coord_vec, ms, sparse_mod, ret, coord_vec, texture, type, offset_vec); | 532 | coord_vec, ms, sparse_mod, ret, coord_vec, texture, type, offset_vec); |
| @@ -531,10 +539,11 @@ void EmitImageFetch(EmitContext& ctx, IR::Inst& inst, const IR::Value& index, | |||
| 531 | } | 539 | } |
| 532 | 540 | ||
| 533 | void EmitImageQueryDimensions(EmitContext& ctx, IR::Inst& inst, const IR::Value& index, | 541 | void EmitImageQueryDimensions(EmitContext& ctx, IR::Inst& inst, const IR::Value& index, |
| 534 | ScalarS32 lod) { | 542 | ScalarS32 lod, [[maybe_unused]] const IR::Value& skip_mips) { |
| 535 | const auto info{inst.Flags<IR::TextureInstInfo>()}; | 543 | const auto info{inst.Flags<IR::TextureInstInfo>()}; |
| 536 | const std::string texture{Texture(ctx, info, index)}; | 544 | const std::string texture{Texture(ctx, info, index)}; |
| 537 | const std::string_view type{TextureType(info)}; | 545 | const bool is_msaa{IsTextureMsaa(ctx, info)}; |
| 546 | const std::string_view type{TextureType(info, is_msaa)}; | ||
| 538 | ctx.Add("TXQ {},{},{},{};", inst, lod, texture, type); | 547 | ctx.Add("TXQ {},{},{},{};", inst, lod, texture, type); |
| 539 | } | 548 | } |
| 540 | 549 | ||
diff --git a/src/shader_recompiler/backend/glasm/emit_glasm_instructions.h b/src/shader_recompiler/backend/glasm/emit_glasm_instructions.h index eaaf9ba39..1a1ea61d5 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); |
| @@ -582,7 +581,7 @@ void EmitImageGatherDref(EmitContext& ctx, IR::Inst& inst, const IR::Value& inde | |||
| 582 | void EmitImageFetch(EmitContext& ctx, IR::Inst& inst, const IR::Value& index, | 581 | void EmitImageFetch(EmitContext& ctx, IR::Inst& inst, const IR::Value& index, |
| 583 | const IR::Value& coord, const IR::Value& offset, ScalarS32 lod, ScalarS32 ms); | 582 | const IR::Value& coord, const IR::Value& offset, ScalarS32 lod, ScalarS32 ms); |
| 584 | void EmitImageQueryDimensions(EmitContext& ctx, IR::Inst& inst, const IR::Value& index, | 583 | void EmitImageQueryDimensions(EmitContext& ctx, IR::Inst& inst, const IR::Value& index, |
| 585 | ScalarS32 lod); | 584 | ScalarS32 lod, const IR::Value& skip_mips); |
| 586 | void EmitImageQueryLod(EmitContext& ctx, IR::Inst& inst, const IR::Value& index, Register coord); | 585 | void EmitImageQueryLod(EmitContext& ctx, IR::Inst& inst, const IR::Value& index, Register coord); |
| 587 | void EmitImageGradient(EmitContext& ctx, IR::Inst& inst, const IR::Value& index, | 586 | void EmitImageGradient(EmitContext& ctx, IR::Inst& inst, const IR::Value& index, |
| 588 | const IR::Value& coord, const IR::Value& derivatives, | 587 | const IR::Value& coord, const IR::Value& derivatives, |