diff options
author | liamwhite <liamwhite@users.noreply.github.com> | 2023-08-22 11:30:08 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-22 11:30:08 -0400 |
commit | b8bab551a4852395de473412bfc9d3f02f4cc01c (patch) | |
tree | 139b2b722b7e7f28aadf994f4f4bf87c2ccd9219 /src/shader_recompiler/backend/glsl | |
parent | a9f223cd9f2733e208938187fdab6e4e655e3b80 (diff) | |
parent | c03f0b3c893f2bc2ae4f1e1825c5ac1453c36710 (diff) |
Merge pull request #11316 from FernandoS27/stop-premature-christmas-decorating
Shader Recompiler: implement textureGrad 3D
Diffstat (limited to 'src/shader_recompiler/backend/glsl')
-rw-r--r-- | src/shader_recompiler/backend/glsl/emit_glsl_image.cpp | 8 |
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 { |