summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorReinUsesLisp <reinuseslisp@airmail.cc>2021-05-16 23:00:31 +0200
committerameerj <52414509+ameerj@users.noreply.github.com>2021-07-23 03:51:31 +0200
commite6b4d461d2424d4fc46eeb3601a5b25cd850c2af (patch)
tree04413a57ea417a456a8eb0750f82b6ed1df96830 /src
parentglasm: Improve texture sampling instructions (diff)
downloadyuzu-e6b4d461d2424d4fc46eeb3601a5b25cd850c2af.tar
yuzu-e6b4d461d2424d4fc46eeb3601a5b25cd850c2af.tar.gz
yuzu-e6b4d461d2424d4fc46eeb3601a5b25cd850c2af.tar.bz2
yuzu-e6b4d461d2424d4fc46eeb3601a5b25cd850c2af.tar.lz
yuzu-e6b4d461d2424d4fc46eeb3601a5b25cd850c2af.tar.xz
yuzu-e6b4d461d2424d4fc46eeb3601a5b25cd850c2af.tar.zst
yuzu-e6b4d461d2424d4fc46eeb3601a5b25cd850c2af.zip
Diffstat (limited to 'src')
-rw-r--r--src/shader_recompiler/backend/glasm/emit_glasm_image.cpp26
1 files changed, 15 insertions, 11 deletions
diff --git a/src/shader_recompiler/backend/glasm/emit_glasm_image.cpp b/src/shader_recompiler/backend/glasm/emit_glasm_image.cpp
index 7f2cf052a..c395248ed 100644
--- a/src/shader_recompiler/backend/glasm/emit_glasm_image.cpp
+++ b/src/shader_recompiler/backend/glasm/emit_glasm_image.cpp
@@ -120,7 +120,10 @@ void EmitImageSampleImplicitLod(EmitContext& ctx, IR::Inst& inst, const IR::Valu
const std::string_view lod_clamp_mod{info.has_lod_clamp ? ".LODCLAMP" : ""};
const std::string_view type{"2D"}; // FIXME
const std::string texture{Texture(ctx, info, index)};
-
+ std::string offset_vec;
+ if (!offset.IsEmpty()) {
+ offset_vec = fmt::format(",offset({})", Register{ctx.reg_alloc.Consume(offset)});
+ }
std::string coord_vec{fmt::to_string(Register{ctx.reg_alloc.Consume(coord)})};
if (coord.InstRecursive()->HasUses()) {
// Move non-dead coords to a separate register, although this should never happen because
@@ -131,26 +134,27 @@ void EmitImageSampleImplicitLod(EmitContext& ctx, IR::Inst& inst, const IR::Valu
const Register ret{ctx.reg_alloc.Define(inst)};
if (info.has_bias) {
if (info.type == TextureType::ColorArrayCube) {
- ctx.Add("TXB.F{}{} {},{},{},{},ARRAYCUBE;", lod_clamp_mod, sparse_mod, ret, coord_vec,
- bias_lc, texture);
+ ctx.Add("TXB.F{}{} {},{},{},{},ARRAYCUBE{};", lod_clamp_mod, sparse_mod, ret, coord_vec,
+ bias_lc, texture, offset_vec);
} else {
if (info.has_lod_clamp) {
ctx.Add("MOV.F {}.w,{}.x;"
- "TXB.F.LODCLAMP{} {},{},{}.y,{},{};",
- coord_vec, bias_lc, sparse_mod, ret, coord_vec, bias_lc, texture, type);
+ "TXB.F.LODCLAMP{} {},{},{}.y,{},{}{};",
+ coord_vec, bias_lc, sparse_mod, ret, coord_vec, bias_lc, texture, type,
+ offset_vec);
} else {
ctx.Add("MOV.F {}.w,{}.x;"
- "TXB.F{} {},{},{},{};",
- coord_vec, bias_lc, sparse_mod, ret, coord_vec, texture, type);
+ "TXB.F{} {},{},{},{}{};",
+ coord_vec, bias_lc, sparse_mod, ret, coord_vec, texture, type, offset_vec);
}
}
} else {
if (info.has_lod_clamp && info.type == TextureType::ColorArrayCube) {
- ctx.Add("TEX.F.LODCLAMP{} {},{},{},{},ARRAYCUBE;", sparse_mod, ret, coord_vec, bias_lc,
- texture);
+ ctx.Add("TEX.F.LODCLAMP{} {},{},{},{},ARRAYCUBE{};", sparse_mod, ret, coord_vec,
+ bias_lc, texture, offset_vec);
} else {
- ctx.Add("TEX.F{}{} {},{},{},{};", lod_clamp_mod, sparse_mod, ret, coord_vec, texture,
- type);
+ ctx.Add("TEX.F{}{} {},{},{},{}{};", lod_clamp_mod, sparse_mod, ret, coord_vec, texture,
+ type, offset_vec);
}
}
if (sparse_inst) {