diff options
Diffstat (limited to 'src/shader_recompiler')
| -rw-r--r-- | src/shader_recompiler/backend/glasm/emit_glasm_image.cpp | 30 |
1 files changed, 26 insertions, 4 deletions
diff --git a/src/shader_recompiler/backend/glasm/emit_glasm_image.cpp b/src/shader_recompiler/backend/glasm/emit_glasm_image.cpp index 247118dff..2af5483d9 100644 --- a/src/shader_recompiler/backend/glasm/emit_glasm_image.cpp +++ b/src/shader_recompiler/backend/glasm/emit_glasm_image.cpp | |||
| @@ -8,21 +8,43 @@ | |||
| 8 | #include "shader_recompiler/frontend/ir/value.h" | 8 | #include "shader_recompiler/frontend/ir/value.h" |
| 9 | 9 | ||
| 10 | namespace Shader::Backend::GLASM { | 10 | namespace Shader::Backend::GLASM { |
| 11 | 11 | namespace { | |
| 12 | std::string Texture([[maybe_unused]] EmitContext& ctx, IR::TextureInstInfo info, | 12 | std::string Texture([[maybe_unused]] EmitContext& ctx, IR::TextureInstInfo info, |
| 13 | [[maybe_unused]] const IR::Value& index) { | 13 | [[maybe_unused]] const IR::Value& index) { |
| 14 | // FIXME | 14 | // FIXME |
| 15 | return fmt::format("texture[{}]", info.descriptor_index); | 15 | return fmt::format("texture[{}]", info.descriptor_index); |
| 16 | } | 16 | } |
| 17 | 17 | ||
| 18 | std::string_view TextureType(IR::TextureInstInfo info) { | ||
| 19 | switch (info.type) { | ||
| 20 | case TextureType::Color1D: | ||
| 21 | return "1D"; | ||
| 22 | case TextureType::ColorArray1D: | ||
| 23 | return "ARRAY1D"; | ||
| 24 | case TextureType::Color2D: | ||
| 25 | return "2D"; | ||
| 26 | case TextureType::ColorArray2D: | ||
| 27 | return "ARRAY2D"; | ||
| 28 | case TextureType::Color3D: | ||
| 29 | return "3D"; | ||
| 30 | case TextureType::ColorCube: | ||
| 31 | return "CUBE"; | ||
| 32 | case TextureType::ColorArrayCube: | ||
| 33 | return "ARRAYCUBE"; | ||
| 34 | case TextureType::Buffer: | ||
| 35 | return "BUFFER"; | ||
| 36 | } | ||
| 37 | throw InvalidArgument("Invalid texture type {}", info.type.Value()); | ||
| 38 | } | ||
| 39 | } // Anonymous namespace | ||
| 40 | |||
| 18 | void EmitImageSampleImplicitLod(EmitContext& ctx, IR::Inst& inst, const IR::Value& index, | 41 | void EmitImageSampleImplicitLod(EmitContext& ctx, IR::Inst& inst, const IR::Value& index, |
| 19 | const IR::Value& coord, Register bias_lc, | 42 | const IR::Value& coord, Register bias_lc, const IR::Value& offset) { |
| 20 | [[maybe_unused]] const IR::Value& offset) { | ||
| 21 | const auto info{inst.Flags<IR::TextureInstInfo>()}; | 43 | const auto info{inst.Flags<IR::TextureInstInfo>()}; |
| 22 | const auto sparse_inst{inst.GetAssociatedPseudoOperation(IR::Opcode::GetSparseFromOp)}; | 44 | const auto sparse_inst{inst.GetAssociatedPseudoOperation(IR::Opcode::GetSparseFromOp)}; |
| 23 | const std::string_view sparse_mod{sparse_inst ? ".SPARSE" : ""}; | 45 | const std::string_view sparse_mod{sparse_inst ? ".SPARSE" : ""}; |
| 24 | const std::string_view lod_clamp_mod{info.has_lod_clamp ? ".LODCLAMP" : ""}; | 46 | const std::string_view lod_clamp_mod{info.has_lod_clamp ? ".LODCLAMP" : ""}; |
| 25 | const std::string_view type{"2D"}; // FIXME | 47 | const std::string_view type{TextureType(info)}; |
| 26 | const std::string texture{Texture(ctx, info, index)}; | 48 | const std::string texture{Texture(ctx, info, index)}; |
| 27 | std::string offset_vec; | 49 | std::string offset_vec; |
| 28 | if (!offset.IsEmpty()) { | 50 | if (!offset.IsEmpty()) { |