summaryrefslogtreecommitdiffstats
path: root/src/shader_recompiler/backend/glsl/emit_glsl_image.cpp
diff options
context:
space:
mode:
authorFernando Sahmkow <fsahmkow27@gmail.com>2023-08-18 18:30:31 +0200
committerLiam <byteslice@airmail.cc>2023-08-19 04:17:02 +0200
commitc03f0b3c893f2bc2ae4f1e1825c5ac1453c36710 (patch)
tree3f7f14fad6574878a7c0f94fbe16d574b61cb95a /src/shader_recompiler/backend/glsl/emit_glsl_image.cpp
parentMerge pull request #11278 from Kelebek1/dma_sync (diff)
downloadyuzu-c03f0b3c893f2bc2ae4f1e1825c5ac1453c36710.tar
yuzu-c03f0b3c893f2bc2ae4f1e1825c5ac1453c36710.tar.gz
yuzu-c03f0b3c893f2bc2ae4f1e1825c5ac1453c36710.tar.bz2
yuzu-c03f0b3c893f2bc2ae4f1e1825c5ac1453c36710.tar.lz
yuzu-c03f0b3c893f2bc2ae4f1e1825c5ac1453c36710.tar.xz
yuzu-c03f0b3c893f2bc2ae4f1e1825c5ac1453c36710.tar.zst
yuzu-c03f0b3c893f2bc2ae4f1e1825c5ac1453c36710.zip
Diffstat (limited to 'src/shader_recompiler/backend/glsl/emit_glsl_image.cpp')
-rw-r--r--src/shader_recompiler/backend/glsl/emit_glsl_image.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/shader_recompiler/backend/glsl/emit_glsl_image.cpp b/src/shader_recompiler/backend/glsl/emit_glsl_image.cpp
index 418505475..3ad668a47 100644
--- a/src/shader_recompiler/backend/glsl/emit_glsl_image.cpp
+++ b/src/shader_recompiler/backend/glsl/emit_glsl_image.cpp
@@ -548,7 +548,7 @@ void EmitImageGradient(EmitContext& ctx, IR::Inst& inst, const IR::Value& index,
if (sparse_inst) {
throw NotImplementedException("EmitImageGradient Sparse");
}
- if (!offset.IsEmpty()) {
+ if (!offset.IsEmpty() && info.num_derivates <= 2) {
throw NotImplementedException("EmitImageGradient offset");
}
const auto texture{Texture(ctx, info, index)};
@@ -556,6 +556,12 @@ void EmitImageGradient(EmitContext& ctx, IR::Inst& inst, const IR::Value& index,
const bool multi_component{info.num_derivates > 1 || info.has_lod_clamp};
const auto derivatives_vec{ctx.var_alloc.Consume(derivatives)};
if (multi_component) {
+ if (info.num_derivates >= 3) {
+ const auto offset_vec{ctx.var_alloc.Consume(offset)};
+ ctx.Add("{}=textureGrad({},{},vec3({}.xz, {}.x),vec3({}.yz, {}.y));", texel, texture,
+ coords, derivatives_vec, offset_vec, derivatives_vec, offset_vec);
+ return;
+ }
ctx.Add("{}=textureGrad({},{},vec2({}.xz),vec2({}.yz));", texel, texture, coords,
derivatives_vec, derivatives_vec);
} else {