summaryrefslogtreecommitdiffstats
path: root/src/shader_recompiler/backend
diff options
context:
space:
mode:
authorReinUsesLisp <reinuseslisp@airmail.cc>2021-05-16 23:06:37 +0200
committerameerj <52414509+ameerj@users.noreply.github.com>2021-07-23 03:51:31 +0200
commitc42a6143a55e202974f6ea03e4eb752151c754c3 (patch)
tree589a121f80e38065c2c7e194095c8e276401290d /src/shader_recompiler/backend
parentglasm: Reorder unreachable image instructions to the bottom (diff)
downloadyuzu-c42a6143a55e202974f6ea03e4eb752151c754c3.tar
yuzu-c42a6143a55e202974f6ea03e4eb752151c754c3.tar.gz
yuzu-c42a6143a55e202974f6ea03e4eb752151c754c3.tar.bz2
yuzu-c42a6143a55e202974f6ea03e4eb752151c754c3.tar.lz
yuzu-c42a6143a55e202974f6ea03e4eb752151c754c3.tar.xz
yuzu-c42a6143a55e202974f6ea03e4eb752151c754c3.tar.zst
yuzu-c42a6143a55e202974f6ea03e4eb752151c754c3.zip
Diffstat (limited to 'src/shader_recompiler/backend')
-rw-r--r--src/shader_recompiler/backend/glasm/emit_glasm_image.cpp30
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 @@
#include "shader_recompiler/frontend/ir/value.h"
namespace Shader::Backend::GLASM {
-
+namespace {
std::string Texture([[maybe_unused]] EmitContext& ctx, IR::TextureInstInfo info,
[[maybe_unused]] const IR::Value& index) {
// FIXME
return fmt::format("texture[{}]", info.descriptor_index);
}
+std::string_view TextureType(IR::TextureInstInfo info) {
+ switch (info.type) {
+ case TextureType::Color1D:
+ return "1D";
+ case TextureType::ColorArray1D:
+ return "ARRAY1D";
+ case TextureType::Color2D:
+ return "2D";
+ case TextureType::ColorArray2D:
+ return "ARRAY2D";
+ case TextureType::Color3D:
+ return "3D";
+ case TextureType::ColorCube:
+ return "CUBE";
+ case TextureType::ColorArrayCube:
+ return "ARRAYCUBE";
+ case TextureType::Buffer:
+ return "BUFFER";
+ }
+ throw InvalidArgument("Invalid texture type {}", info.type.Value());
+}
+} // Anonymous namespace
+
void EmitImageSampleImplicitLod(EmitContext& ctx, IR::Inst& inst, const IR::Value& index,
- const IR::Value& coord, Register bias_lc,
- [[maybe_unused]] const IR::Value& offset) {
+ const IR::Value& coord, Register bias_lc, const IR::Value& offset) {
const auto info{inst.Flags<IR::TextureInstInfo>()};
const auto sparse_inst{inst.GetAssociatedPseudoOperation(IR::Opcode::GetSparseFromOp)};
const std::string_view sparse_mod{sparse_inst ? ".SPARSE" : ""};
const std::string_view lod_clamp_mod{info.has_lod_clamp ? ".LODCLAMP" : ""};
- const std::string_view type{"2D"}; // FIXME
+ const std::string_view type{TextureType(info)};
const std::string texture{Texture(ctx, info, index)};
std::string offset_vec;
if (!offset.IsEmpty()) {