summaryrefslogtreecommitdiff
path: root/src/shader_recompiler/backend/glsl/emit_glsl_warp.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/shader_recompiler/backend/glsl/emit_glsl_warp.cpp')
-rw-r--r--src/shader_recompiler/backend/glsl/emit_glsl_warp.cpp28
1 files changed, 24 insertions, 4 deletions
diff --git a/src/shader_recompiler/backend/glsl/emit_glsl_warp.cpp b/src/shader_recompiler/backend/glsl/emit_glsl_warp.cpp
index 4d418cbbc..a982dd8a2 100644
--- a/src/shader_recompiler/backend/glsl/emit_glsl_warp.cpp
+++ b/src/shader_recompiler/backend/glsl/emit_glsl_warp.cpp
@@ -180,18 +180,38 @@ void EmitFSwizzleAdd(EmitContext& ctx, IR::Inst& inst, std::string_view op_a, st
180} 180}
181 181
182void EmitDPdxFine(EmitContext& ctx, IR::Inst& inst, std::string_view op_a) { 182void EmitDPdxFine(EmitContext& ctx, IR::Inst& inst, std::string_view op_a) {
183 ctx.AddF32("{}=dFdxFine({});", inst, op_a); 183 if (ctx.profile.support_gl_derivative_control) {
184 ctx.AddF32("{}=dFdxFine({});", inst, op_a);
185 } else {
186 LOG_WARNING(Shader_GLSL, "Device does not support dFdxFine, fallback to dFdx");
187 ctx.AddF32("{}=dFdx({});", inst, op_a);
188 }
184} 189}
185 190
186void EmitDPdyFine(EmitContext& ctx, IR::Inst& inst, std::string_view op_a) { 191void EmitDPdyFine(EmitContext& ctx, IR::Inst& inst, std::string_view op_a) {
187 ctx.AddF32("{}=dFdyFine({});", inst, op_a); 192 if (ctx.profile.support_gl_derivative_control) {
193 ctx.AddF32("{}=dFdyFine({});", inst, op_a);
194 } else {
195 LOG_WARNING(Shader_GLSL, "Device does not support dFdyFine, fallback to dFdy");
196 ctx.AddF32("{}=dFdy({});", inst, op_a);
197 }
188} 198}
189 199
190void EmitDPdxCoarse(EmitContext& ctx, IR::Inst& inst, std::string_view op_a) { 200void EmitDPdxCoarse(EmitContext& ctx, IR::Inst& inst, std::string_view op_a) {
191 ctx.AddF32("{}=dFdxCoarse({});", inst, op_a); 201 if (ctx.profile.support_gl_derivative_control) {
202 ctx.AddF32("{}=dFdxCoarse({});", inst, op_a);
203 } else {
204 LOG_WARNING(Shader_GLSL, "Device does not support dFdxCoarse, fallback to dFdx");
205 ctx.AddF32("{}=dFdx({});", inst, op_a);
206 }
192} 207}
193 208
194void EmitDPdyCoarse(EmitContext& ctx, IR::Inst& inst, std::string_view op_a) { 209void EmitDPdyCoarse(EmitContext& ctx, IR::Inst& inst, std::string_view op_a) {
195 ctx.AddF32("{}=dFdyCoarse({});", inst, op_a); 210 if (ctx.profile.support_gl_derivative_control) {
211 ctx.AddF32("{}=dFdyCoarse({});", inst, op_a);
212 } else {
213 LOG_WARNING(Shader_GLSL, "Device does not support dFdyCoarse, fallback to dFdy");
214 ctx.AddF32("{}=dFdy({});", inst, op_a);
215 }
196} 216}
197} // namespace Shader::Backend::GLSL 217} // namespace Shader::Backend::GLSL