summaryrefslogtreecommitdiffstats
path: root/src/shader_recompiler/backend/glasm/emit_glasm_image.cpp
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2021-11-17 03:52:11 +0100
committerGitHub <noreply@github.com>2021-11-17 03:52:11 +0100
commit71313509f75aeafe425e531824d1faa9e7c0a40b (patch)
treecb1df371d288677fcede6a3409eb079e0d278163 /src/shader_recompiler/backend/glasm/emit_glasm_image.cpp
parentMerge pull request #7347 from lioncash/catch (diff)
parentTextureCache: Fix Automatic Anisotropic. (diff)
downloadyuzu-71313509f75aeafe425e531824d1faa9e7c0a40b.tar
yuzu-71313509f75aeafe425e531824d1faa9e7c0a40b.tar.gz
yuzu-71313509f75aeafe425e531824d1faa9e7c0a40b.tar.bz2
yuzu-71313509f75aeafe425e531824d1faa9e7c0a40b.tar.lz
yuzu-71313509f75aeafe425e531824d1faa9e7c0a40b.tar.xz
yuzu-71313509f75aeafe425e531824d1faa9e7c0a40b.tar.zst
yuzu-71313509f75aeafe425e531824d1faa9e7c0a40b.zip
Diffstat (limited to 'src/shader_recompiler/backend/glasm/emit_glasm_image.cpp')
-rw-r--r--src/shader_recompiler/backend/glasm/emit_glasm_image.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/shader_recompiler/backend/glasm/emit_glasm_image.cpp b/src/shader_recompiler/backend/glasm/emit_glasm_image.cpp
index 09e3a9b82..d325d31c7 100644
--- a/src/shader_recompiler/backend/glasm/emit_glasm_image.cpp
+++ b/src/shader_recompiler/backend/glasm/emit_glasm_image.cpp
@@ -608,6 +608,24 @@ void EmitImageWrite(EmitContext& ctx, IR::Inst& inst, const IR::Value& index, Re
ctx.Add("STOREIM.{} {},{},{},{};", format, image, color, coord, type);
}
+void EmitIsTextureScaled(EmitContext& ctx, IR::Inst& inst, const IR::Value& index) {
+ if (!index.IsImmediate()) {
+ throw NotImplementedException("Non-constant texture rescaling");
+ }
+ ctx.Add("AND.U RC.x,scaling[0].x,{};"
+ "SNE.S {},RC.x,0;",
+ 1u << index.U32(), ctx.reg_alloc.Define(inst));
+}
+
+void EmitIsImageScaled(EmitContext& ctx, IR::Inst& inst, const IR::Value& index) {
+ if (!index.IsImmediate()) {
+ throw NotImplementedException("Non-constant texture rescaling");
+ }
+ ctx.Add("AND.U RC.x,scaling[0].y,{};"
+ "SNE.S {},RC.x,0;",
+ 1u << index.U32(), ctx.reg_alloc.Define(inst));
+}
+
void EmitImageAtomicIAdd32(EmitContext& ctx, IR::Inst& inst, const IR::Value& index, Register coord,
ScalarU32 value) {
ImageAtomic(ctx, inst, index, coord, value, "ADD.U32");