diff options
Diffstat (limited to 'src/shader_recompiler')
| -rw-r--r-- | src/shader_recompiler/backend/glsl/emit_context.cpp | 3 | ||||
| -rw-r--r-- | src/shader_recompiler/backend/glsl/emit_glsl_warp.cpp | 28 | ||||
| -rw-r--r-- | src/shader_recompiler/profile.h | 1 |
3 files changed, 28 insertions, 4 deletions
diff --git a/src/shader_recompiler/backend/glsl/emit_context.cpp b/src/shader_recompiler/backend/glsl/emit_context.cpp index e18f8257e..0e8fe017d 100644 --- a/src/shader_recompiler/backend/glsl/emit_context.cpp +++ b/src/shader_recompiler/backend/glsl/emit_context.cpp | |||
| @@ -395,6 +395,9 @@ void EmitContext::SetupExtensions() { | |||
| 395 | if (info.uses_typeless_image_reads || info.uses_typeless_image_writes) { | 395 | if (info.uses_typeless_image_reads || info.uses_typeless_image_writes) { |
| 396 | header += "#extension GL_EXT_shader_image_load_formatted : enable\n"; | 396 | header += "#extension GL_EXT_shader_image_load_formatted : enable\n"; |
| 397 | } | 397 | } |
| 398 | if (info.uses_derivatives && profile.support_gl_derivative_control) { | ||
| 399 | header += "#extension GL_ARB_derivative_control : enable\n"; | ||
| 400 | } | ||
| 398 | } | 401 | } |
| 399 | 402 | ||
| 400 | void EmitContext::DefineConstantBuffers(Bindings& bindings) { | 403 | void EmitContext::DefineConstantBuffers(Bindings& bindings) { |
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 | ||
| 182 | void EmitDPdxFine(EmitContext& ctx, IR::Inst& inst, std::string_view op_a) { | 182 | void 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 | ||
| 186 | void EmitDPdyFine(EmitContext& ctx, IR::Inst& inst, std::string_view op_a) { | 191 | void 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 | ||
| 190 | void EmitDPdxCoarse(EmitContext& ctx, IR::Inst& inst, std::string_view op_a) { | 200 | void 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 | ||
| 194 | void EmitDPdyCoarse(EmitContext& ctx, IR::Inst& inst, std::string_view op_a) { | 209 | void 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 |
diff --git a/src/shader_recompiler/profile.h b/src/shader_recompiler/profile.h index 6db794e91..e8cfc03af 100644 --- a/src/shader_recompiler/profile.h +++ b/src/shader_recompiler/profile.h | |||
| @@ -89,6 +89,7 @@ struct Profile { | |||
| 89 | bool support_gl_warp_intrinsics{}; | 89 | bool support_gl_warp_intrinsics{}; |
| 90 | bool support_gl_variable_aoffi{}; | 90 | bool support_gl_variable_aoffi{}; |
| 91 | bool support_gl_sparse_textures{}; | 91 | bool support_gl_sparse_textures{}; |
| 92 | bool support_gl_derivative_control{}; | ||
| 92 | 93 | ||
| 93 | bool warp_size_potentially_larger_than_guest{}; | 94 | bool warp_size_potentially_larger_than_guest{}; |
| 94 | 95 | ||