diff --git a/src/opengl/context.c b/src/opengl/context.c index 7e975ba8..dac6d26f 100644 --- a/src/opengl/context.c +++ b/src/opengl/context.c @@ -300,6 +300,12 @@ pl_opengl pl_opengl_create(pl_log log, const struct pl_opengl_params *params) params->max_glsl_version, glsl->version); } + // The layout of variables inside an SSBO is implementation-defined, + // disable SSBO if layout qualifier is not supported. + struct pl_gpu_t *gpu = (struct pl_gpu_t *) pl_gl->gpu; + if (gpu->glsl.version < 140) + gpu->limits.max_ssbo_size = 0; + gl_release_current(pl_gl); return pl_gl; diff --git a/src/tests/gpu_tests.h b/src/tests/gpu_tests.h index f34979b8..67c36b2e 100644 --- a/src/tests/gpu_tests.h +++ b/src/tests/gpu_tests.h @@ -76,9 +76,7 @@ static void pl_buffer_tests(pl_gpu gpu) } // `compute_queues` check is to exclude dummy GPUs here - if (buf_size <= gpu->limits.max_ssbo_size && - gpu->limits.compute_queues && - gpu->glsl.version >= 130) + if (buf_size <= gpu->limits.max_ssbo_size && gpu->limits.compute_queues) { printf("test endian swapping\n"); buf = pl_buf_create(gpu, pl_buf_params( @@ -1158,7 +1156,7 @@ static void pl_render_tests(pl_gpu gpu) hook = pl_mpv_user_shader_parse(gpu, user_shader_tests[i], strlen(user_shader_tests[i])); - if (gpu->glsl.compute) { + if (gpu->glsl.compute && gpu->limits.max_ssbo_size) { REQUIRE(hook); } else { // Not all shaders compile without compute shader support