summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/shader_recompiler/backend/glasm/emit_glasm.cpp7
-rw-r--r--src/shader_recompiler/backend/glasm/emit_glasm_warp.cpp29
-rw-r--r--src/shader_recompiler/profile.h1
-rw-r--r--src/video_core/renderer_opengl/gl_device.cpp1
-rw-r--r--src/video_core/renderer_opengl/gl_device.h5
-rw-r--r--src/video_core/renderer_opengl/gl_shader_cache.cpp1
6 files changed, 37 insertions, 7 deletions
diff --git a/src/shader_recompiler/backend/glasm/emit_glasm.cpp b/src/shader_recompiler/backend/glasm/emit_glasm.cpp
index 70ca6f621..fc01797b6 100644
--- a/src/shader_recompiler/backend/glasm/emit_glasm.cpp
+++ b/src/shader_recompiler/backend/glasm/emit_glasm.cpp
@@ -265,9 +265,7 @@ void SetupOptions(const IR::Program& program, const Profile& profile,
265 // TODO: Track the shared atomic ops 265 // TODO: Track the shared atomic ops
266 header += "OPTION NV_internal;" 266 header += "OPTION NV_internal;"
267 "OPTION NV_shader_storage_buffer;" 267 "OPTION NV_shader_storage_buffer;"
268 "OPTION NV_gpu_program_fp64;" 268 "OPTION NV_gpu_program_fp64;";
269 "OPTION NV_bindless_texture;"
270 "OPTION ARB_derivative_control;";
271 if (info.uses_int64_bit_atomics) { 269 if (info.uses_int64_bit_atomics) {
272 header += "OPTION NV_shader_atomic_int64;"; 270 header += "OPTION NV_shader_atomic_int64;";
273 } 271 }
@@ -295,6 +293,9 @@ void SetupOptions(const IR::Program& program, const Profile& profile,
295 if (info.uses_typeless_image_reads && profile.support_typeless_image_loads) { 293 if (info.uses_typeless_image_reads && profile.support_typeless_image_loads) {
296 header += "OPTION EXT_shader_image_load_formatted;"; 294 header += "OPTION EXT_shader_image_load_formatted;";
297 } 295 }
296 if (profile.support_derivative_control) {
297 header += "OPTION ARB_derivative_control;";
298 }
298 if (stage == Stage::Fragment && runtime_info.force_early_z != 0) { 299 if (stage == Stage::Fragment && runtime_info.force_early_z != 0) {
299 header += "OPTION NV_early_fragment_tests;"; 300 header += "OPTION NV_early_fragment_tests;";
300 } 301 }
diff --git a/src/shader_recompiler/backend/glasm/emit_glasm_warp.cpp b/src/shader_recompiler/backend/glasm/emit_glasm_warp.cpp
index 6e30790bb..8cec5ee7e 100644
--- a/src/shader_recompiler/backend/glasm/emit_glasm_warp.cpp
+++ b/src/shader_recompiler/backend/glasm/emit_glasm_warp.cpp
@@ -5,6 +5,7 @@
5#include "shader_recompiler/backend/glasm/emit_context.h" 5#include "shader_recompiler/backend/glasm/emit_context.h"
6#include "shader_recompiler/backend/glasm/emit_glasm_instructions.h" 6#include "shader_recompiler/backend/glasm/emit_glasm_instructions.h"
7#include "shader_recompiler/frontend/ir/value.h" 7#include "shader_recompiler/frontend/ir/value.h"
8#include "shader_recompiler/profile.h"
8 9
9namespace Shader::Backend::GLASM { 10namespace Shader::Backend::GLASM {
10 11
@@ -111,19 +112,39 @@ void EmitFSwizzleAdd(EmitContext& ctx, IR::Inst& inst, ScalarF32 op_a, ScalarF32
111} 112}
112 113
113void EmitDPdxFine(EmitContext& ctx, IR::Inst& inst, ScalarF32 p) { 114void EmitDPdxFine(EmitContext& ctx, IR::Inst& inst, ScalarF32 p) {
114 ctx.Add("DDX.FINE {}.x,{};", inst, p); 115 if (ctx.profile.support_derivative_control) {
116 ctx.Add("DDX.FINE {}.x,{};", inst, p);
117 } else {
118 // LOG_WARNING
119 ctx.Add("DDX {}.x,{};", inst, p);
120 }
115} 121}
116 122
117void EmitDPdyFine(EmitContext& ctx, IR::Inst& inst, ScalarF32 p) { 123void EmitDPdyFine(EmitContext& ctx, IR::Inst& inst, ScalarF32 p) {
118 ctx.Add("DDY.FINE {}.x,{};", inst, p); 124 if (ctx.profile.support_derivative_control) {
125 ctx.Add("DDY.FINE {}.x,{};", inst, p);
126 } else {
127 // LOG_WARNING
128 ctx.Add("DDY {}.x,{};", inst, p);
129 }
119} 130}
120 131
121void EmitDPdxCoarse(EmitContext& ctx, IR::Inst& inst, ScalarF32 p) { 132void EmitDPdxCoarse(EmitContext& ctx, IR::Inst& inst, ScalarF32 p) {
122 ctx.Add("DDX.COARSE {}.x,{};", inst, p); 133 if (ctx.profile.support_derivative_control) {
134 ctx.Add("DDX.COARSE {}.x,{};", inst, p);
135 } else {
136 // LOG_WARNING
137 ctx.Add("DDX {}.x,{};", inst, p);
138 }
123} 139}
124 140
125void EmitDPdyCoarse(EmitContext& ctx, IR::Inst& inst, ScalarF32 p) { 141void EmitDPdyCoarse(EmitContext& ctx, IR::Inst& inst, ScalarF32 p) {
126 ctx.Add("DDY.COARSE {}.x,{};", inst, p); 142 if (ctx.profile.support_derivative_control) {
143 ctx.Add("DDY.COARSE {}.x,{};", inst, p);
144 } else {
145 // LOG_WARNING
146 ctx.Add("DDY {}.x,{};", inst, p);
147 }
127} 148}
128 149
129} // namespace Shader::Backend::GLASM 150} // namespace Shader::Backend::GLASM
diff --git a/src/shader_recompiler/profile.h b/src/shader_recompiler/profile.h
index f059e3b26..3109fb69c 100644
--- a/src/shader_recompiler/profile.h
+++ b/src/shader_recompiler/profile.h
@@ -82,6 +82,7 @@ struct Profile {
82 bool support_typeless_image_loads{}; 82 bool support_typeless_image_loads{};
83 bool support_demote_to_helper_invocation{}; 83 bool support_demote_to_helper_invocation{};
84 bool support_int64_atomics{}; 84 bool support_int64_atomics{};
85 bool support_derivative_control{};
85 86
86 bool warp_size_potentially_larger_than_guest{}; 87 bool warp_size_potentially_larger_than_guest{};
87 88
diff --git a/src/video_core/renderer_opengl/gl_device.cpp b/src/video_core/renderer_opengl/gl_device.cpp
index 01da2bb57..3f7929f9e 100644
--- a/src/video_core/renderer_opengl/gl_device.cpp
+++ b/src/video_core/renderer_opengl/gl_device.cpp
@@ -154,6 +154,7 @@ Device::Device() {
154 has_precise_bug = TestPreciseBug(); 154 has_precise_bug = TestPreciseBug();
155 has_broken_texture_view_formats = is_amd || (!is_linux && is_intel); 155 has_broken_texture_view_formats = is_amd || (!is_linux && is_intel);
156 has_nv_viewport_array2 = GLAD_GL_NV_viewport_array2; 156 has_nv_viewport_array2 = GLAD_GL_NV_viewport_array2;
157 has_derivative_control = GLAD_GL_ARB_derivative_control;
157 has_vertex_buffer_unified_memory = GLAD_GL_NV_vertex_buffer_unified_memory; 158 has_vertex_buffer_unified_memory = GLAD_GL_NV_vertex_buffer_unified_memory;
158 has_debugging_tool_attached = IsDebugToolAttached(extensions); 159 has_debugging_tool_attached = IsDebugToolAttached(extensions);
159 has_depth_buffer_float = HasExtension(extensions, "GL_NV_depth_buffer_float"); 160 has_depth_buffer_float = HasExtension(extensions, "GL_NV_depth_buffer_float");
diff --git a/src/video_core/renderer_opengl/gl_device.h b/src/video_core/renderer_opengl/gl_device.h
index d67f5693c..1ffd24883 100644
--- a/src/video_core/renderer_opengl/gl_device.h
+++ b/src/video_core/renderer_opengl/gl_device.h
@@ -96,6 +96,10 @@ public:
96 return has_nv_viewport_array2; 96 return has_nv_viewport_array2;
97 } 97 }
98 98
99 bool HasDerivativeControl() const {
100 return has_derivative_control;
101 }
102
99 bool HasDebuggingToolAttached() const { 103 bool HasDebuggingToolAttached() const {
100 return has_debugging_tool_attached; 104 return has_debugging_tool_attached;
101 } 105 }
@@ -141,6 +145,7 @@ private:
141 bool has_broken_texture_view_formats{}; 145 bool has_broken_texture_view_formats{};
142 bool has_fast_buffer_sub_data{}; 146 bool has_fast_buffer_sub_data{};
143 bool has_nv_viewport_array2{}; 147 bool has_nv_viewport_array2{};
148 bool has_derivative_control{};
144 bool has_debugging_tool_attached{}; 149 bool has_debugging_tool_attached{};
145 bool use_assembly_shaders{}; 150 bool use_assembly_shaders{};
146 bool use_asynchronous_shaders{}; 151 bool use_asynchronous_shaders{};
diff --git a/src/video_core/renderer_opengl/gl_shader_cache.cpp b/src/video_core/renderer_opengl/gl_shader_cache.cpp
index 6ea7c0ee8..bdffac4b2 100644
--- a/src/video_core/renderer_opengl/gl_shader_cache.cpp
+++ b/src/video_core/renderer_opengl/gl_shader_cache.cpp
@@ -274,6 +274,7 @@ ShaderCache::ShaderCache(RasterizerOpenGL& rasterizer_, Core::Frontend::EmuWindo
274 .support_typeless_image_loads = device.HasImageLoadFormatted(), 274 .support_typeless_image_loads = device.HasImageLoadFormatted(),
275 .support_demote_to_helper_invocation = false, 275 .support_demote_to_helper_invocation = false,
276 .support_int64_atomics = false, 276 .support_int64_atomics = false,
277 .support_derivative_control = device.HasDerivativeControl(),
277 278
278 .warp_size_potentially_larger_than_guest = true, 279 .warp_size_potentially_larger_than_guest = true,
279 280