summaryrefslogtreecommitdiff
path: root/src/shader_recompiler/backend/glsl
diff options
context:
space:
mode:
authorGravatar Fernando Sahmkow2023-08-18 18:30:31 +0200
committerGravatar Liam2023-08-18 22:17:02 -0400
commitc03f0b3c893f2bc2ae4f1e1825c5ac1453c36710 (patch)
tree3f7f14fad6574878a7c0f94fbe16d574b61cb95a /src/shader_recompiler/backend/glsl
parentMerge pull request #11278 from Kelebek1/dma_sync (diff)
downloadyuzu-c03f0b3c893f2bc2ae4f1e1825c5ac1453c36710.tar.gz
yuzu-c03f0b3c893f2bc2ae4f1e1825c5ac1453c36710.tar.xz
yuzu-c03f0b3c893f2bc2ae4f1e1825c5ac1453c36710.zip
Shader Recomnpiler: implement textuzreGrad 3D emulation constant propagation
Diffstat (limited to 'src/shader_recompiler/backend/glsl')
-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,
548 if (sparse_inst) { 548 if (sparse_inst) {
549 throw NotImplementedException("EmitImageGradient Sparse"); 549 throw NotImplementedException("EmitImageGradient Sparse");
550 } 550 }
551 if (!offset.IsEmpty()) { 551 if (!offset.IsEmpty() && info.num_derivates <= 2) {
552 throw NotImplementedException("EmitImageGradient offset"); 552 throw NotImplementedException("EmitImageGradient offset");
553 } 553 }
554 const auto texture{Texture(ctx, info, index)}; 554 const auto texture{Texture(ctx, info, index)};
@@ -556,6 +556,12 @@ void EmitImageGradient(EmitContext& ctx, IR::Inst& inst, const IR::Value& index,
556 const bool multi_component{info.num_derivates > 1 || info.has_lod_clamp}; 556 const bool multi_component{info.num_derivates > 1 || info.has_lod_clamp};
557 const auto derivatives_vec{ctx.var_alloc.Consume(derivatives)}; 557 const auto derivatives_vec{ctx.var_alloc.Consume(derivatives)};
558 if (multi_component) { 558 if (multi_component) {
559 if (info.num_derivates >= 3) {
560 const auto offset_vec{ctx.var_alloc.Consume(offset)};
561 ctx.Add("{}=textureGrad({},{},vec3({}.xz, {}.x),vec3({}.yz, {}.y));", texel, texture,
562 coords, derivatives_vec, offset_vec, derivatives_vec, offset_vec);
563 return;
564 }
559 ctx.Add("{}=textureGrad({},{},vec2({}.xz),vec2({}.yz));", texel, texture, coords, 565 ctx.Add("{}=textureGrad({},{},vec2({}.xz),vec2({}.yz));", texel, texture, coords,
560 derivatives_vec, derivatives_vec); 566 derivatives_vec, derivatives_vec);
561 } else { 567 } else {