diff options
author | Philip Langdale <philipl@overt.org> | 2021-12-11 19:28:46 -0800 |
---|---|---|
committer | Philip Langdale <github.philipl@overt.org> | 2021-12-12 20:23:31 -0800 |
commit | 584ab29c88d6c5ffa03666bffbbc93e4f0740f67 (patch) | |
tree | fd5db4e42bfdd3cb217cdca82494de8b3fff9b6e /video/out/gpu/video_shaders.c | |
parent | 2fc327f2fdd48f0cd58a4d4382a7aa57f3fabd77 (diff) | |
download | mpv-584ab29c88d6c5ffa03666bffbbc93e4f0740f67.tar.bz2 mpv-584ab29c88d6c5ffa03666bffbbc93e4f0740f67.tar.xz |
vo_gpu: opengl: some fixes to make compute shaders work with GLES
It's supposed to work with GLES >= 3.1 but we had all sorts of bad
assumptions in our version handling, and then our compute shaders
turn out not to be GLSL-ES compliant.
This change contains some necessary, but insufficient, tweaks to the
shaders. Perhaps we'll make it actually work some day.
Diffstat (limited to 'video/out/gpu/video_shaders.c')
-rw-r--r-- | video/out/gpu/video_shaders.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/video/out/gpu/video_shaders.c b/video/out/gpu/video_shaders.c index d5bc678145..df379778fc 100644 --- a/video/out/gpu/video_shaders.c +++ b/video/out/gpu/video_shaders.c @@ -609,7 +609,7 @@ static void hdr_update_peak(struct gl_shader_cache *sc, // pixel using shared memory first GLSLH(shared int wg_sum;) GLSLH(shared uint wg_max;) - GLSL(wg_sum = 0; wg_max = 0;) + GLSL(wg_sum = 0; wg_max = 0u;) GLSL(barrier();) GLSLF("float sig_log = log(max(sig_max, %f));\n", log_min); GLSLF("atomicAdd(wg_sum, int(sig_log * %f));\n", log_scale); @@ -618,7 +618,7 @@ static void hdr_update_peak(struct gl_shader_cache *sc, // Have one thread per work group update the global atomics GLSL(memoryBarrierShared();) GLSL(barrier();) - GLSL(if (gl_LocalInvocationIndex == 0) {) + GLSL(if (gl_LocalInvocationIndex == 0u) {) GLSL( int wg_avg = wg_sum / int(gl_WorkGroupSize.x * gl_WorkGroupSize.y);) GLSL( atomicAdd(frame_sum, wg_avg);) GLSL( atomicMax(frame_max, wg_max);) @@ -628,8 +628,8 @@ static void hdr_update_peak(struct gl_shader_cache *sc, // Finally, to update the global state, we increment a counter per dispatch GLSL(uint num_wg = gl_NumWorkGroups.x * gl_NumWorkGroups.y;) - GLSL(if (gl_LocalInvocationIndex == 0 && atomicAdd(counter, 1) == num_wg - 1) {) - GLSL( counter = 0;) + GLSL(if (gl_LocalInvocationIndex == 0u && atomicAdd(counter, 1u) == num_wg - 1u) {) + GLSL( counter = 0u;) GLSL( vec2 cur = vec2(float(frame_sum) / float(num_wg), frame_max);) GLSLF(" cur *= vec2(1.0/%f, 1.0/%f);\n", log_scale, sig_scale); GLSL( cur.x = exp(cur.x);) @@ -650,7 +650,7 @@ static void hdr_update_peak(struct gl_shader_cache *sc, GLSL( average = mix(average, cur, weight);) // Reset SSBO state for the next frame - GLSL( frame_sum = 0; frame_max = 0;) + GLSL( frame_sum = 0; frame_max = 0u;) GLSL( memoryBarrierBuffer();) GLSL(}) } |