Skip to content

Commit

Permalink
opengl/gpu: fill in missing GLES versions in feature checks
Browse files Browse the repository at this point in the history
The existing OpenGL code can transparently make use of these features by
just correcting the checks.
  • Loading branch information
sfan5 committed Apr 16, 2024
1 parent e4e096b commit 40163a6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/dispatch.c
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ static void generate_shaders(pl_dispatch dp,
}
}

if (has_img)
if (has_img && !gpu->glsl.gles)
ADD(pre, "#extension GL_ARB_shader_image_load_store : enable\n");
if (has_ubo)
ADD(pre, "#extension GL_ARB_uniform_buffer_object : enable\n");
Expand All @@ -376,7 +376,7 @@ static void generate_shaders(pl_dispatch dp,
}
if (has_nofmt)
ADD(pre, "#extension GL_EXT_shader_image_load_formatted : enable\n");
if (has_gather)
if (has_gather && !gpu->glsl.gles)
ADD(pre, "#extension GL_ARB_texture_gather : enable\n");

if (gpu->glsl.gles) {
Expand Down
12 changes: 8 additions & 4 deletions src/opengl/gpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,12 @@ pl_gpu pl_gpu_create_gl(pl_log log, pl_opengl pl_gl, const struct pl_opengl_para
geti(GL_MAX_COMPUTE_WORK_GROUP_SIZE, i, &glsl->max_group_size[i]);
}

if (gl_test_ext(gpu, "GL_ARB_texture_gather", 40, 0)) {
get(GL_MAX_PROGRAM_TEXTURE_GATHER_COMPONENTS_ARB, &p->gather_comps);
if (gl_test_ext(gpu, "GL_ARB_texture_gather", 40, 31) &&
glsl->version >= (p->gles_ver ? 310 : 400)) {
if (p->gles_ver)
p->gather_comps = 4;
else
get(GL_MAX_PROGRAM_TEXTURE_GATHER_COMPONENTS_ARB, &p->gather_comps);
get(GL_MIN_PROGRAM_TEXTURE_GATHER_OFFSET_ARB, &glsl->min_gather_offset);
get(GL_MAX_PROGRAM_TEXTURE_GATHER_OFFSET_ARB, &glsl->max_gather_offset);
}
Expand Down Expand Up @@ -231,11 +235,11 @@ pl_gpu pl_gpu_create_gl(pl_log log, pl_opengl pl_gl, const struct pl_opengl_para
}

// Cache some internal capability checks
p->has_vao = gl_test_ext(gpu, "GL_ARB_vertex_array_object", 30, 0);
p->has_vao = gl_test_ext(gpu, "GL_ARB_vertex_array_object", 30, 30);
p->has_invalidate_fb = gl_test_ext(gpu, "GL_ARB_invalidate_subdata", 43, 30);
p->has_invalidate_tex = gl_test_ext(gpu, "GL_ARB_invalidate_subdata", 43, 0);
p->has_queries = gl_test_ext(gpu, "GL_ARB_timer_query", 33, 0);
p->has_storage = gl_test_ext(gpu, "GL_ARB_shader_image_load_store", 42, 0);
p->has_storage = gl_test_ext(gpu, "GL_ARB_shader_image_load_store", 42, 31);
p->has_readback = true;

if (p->has_readback && p->gles_ver) {
Expand Down

0 comments on commit 40163a6

Please sign in to comment.