mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-28 16:50:10 +01:00
mesa/st: do not expose ARB_shader_image_load_store if not fully implemented
So far we were checking ARB_shader_image_load_store is supported as requirement to expose GLES 3.1. But when this extension functionality was added in GLES 3.1 spec, it was relaxed, and one of its requirements, the support for formatless writing, was not included. So this means that a driver that support all the extension functionality except formatless writing, could expose GLES 3.1, but it couldn't expose the extension itself (nor GL 4.2, which requires fully implementation of the extension). v2: - Add the same exposure treatment to ARB_shader_image_size (Ilia). v3: - Remove dependency for OES_texture_buffer (Ilia). - Check image resources for GLES 3.1 (Ilia). v4: - Check for MaxImageUniforms in compute shader (Ilia). - Check for max combined image uniforms/ssbo (Ilia). v5: - Remove ARB_shader_image_load_store from check (Ilia). - ARB_shader_image_store and ARB_shader_image required for ARB_ES3_1_compatibility (Ilia). Signed-off-by: Juan A. Suarez Romero <jasuarez@igalia.com> Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu> Reviewed-by: Emma Anholt <emma@anholt.net> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14288>
This commit is contained in:
parent
d9bc018854
commit
3b81d2d30d
4 changed files with 14 additions and 8 deletions
|
|
@ -3433,7 +3433,8 @@ check_image_resources(const struct gl_constants *consts,
|
|||
unsigned fragment_outputs = 0;
|
||||
unsigned total_shader_storage_blocks = 0;
|
||||
|
||||
if (!exts->ARB_shader_image_load_store)
|
||||
if (!consts->MaxCombinedImageUniforms &&
|
||||
!consts->MaxCombinedShaderStorageBlocks)
|
||||
return;
|
||||
|
||||
for (unsigned i = 0; i < MESA_SHADER_STAGES; i++) {
|
||||
|
|
|
|||
|
|
@ -805,7 +805,8 @@ _mesa_BindImageTextures(GLuint first, GLsizei count, const GLuint *textures)
|
|||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
|
||||
if (!ctx->Extensions.ARB_shader_image_load_store) {
|
||||
if (!ctx->Extensions.ARB_shader_image_load_store &&
|
||||
!_mesa_is_gles31(ctx)) {
|
||||
_mesa_error(ctx, GL_INVALID_OPERATION, "glBindImageTextures()");
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2451,7 +2451,8 @@ get_tex_parameterfv(struct gl_context *ctx,
|
|||
break;
|
||||
|
||||
case GL_IMAGE_FORMAT_COMPATIBILITY_TYPE:
|
||||
if (!ctx->Extensions.ARB_shader_image_load_store)
|
||||
if (!ctx->Extensions.ARB_shader_image_load_store &&
|
||||
!_mesa_is_gles31(ctx))
|
||||
goto invalid_pname;
|
||||
*params = (GLfloat) obj->Attrib.ImageFormatCompatibilityType;
|
||||
break;
|
||||
|
|
@ -2741,7 +2742,8 @@ get_tex_parameteriv(struct gl_context *ctx,
|
|||
break;
|
||||
|
||||
case GL_IMAGE_FORMAT_COMPATIBILITY_TYPE:
|
||||
if (!ctx->Extensions.ARB_shader_image_load_store)
|
||||
if (!ctx->Extensions.ARB_shader_image_load_store &&
|
||||
!_mesa_is_gles31(ctx))
|
||||
goto invalid_pname;
|
||||
*params = obj->Attrib.ImageFormatCompatibilityType;
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -583,7 +583,8 @@ void st_init_limits(struct pipe_screen *screen,
|
|||
c->Program[MESA_SHADER_COMPUTE].MaxImageUniforms;
|
||||
c->MaxCombinedShaderOutputResources += c->MaxCombinedImageUniforms;
|
||||
c->MaxImageUnits = MAX_IMAGE_UNITS;
|
||||
if (c->Program[MESA_SHADER_FRAGMENT].MaxImageUniforms) {
|
||||
if (c->Program[MESA_SHADER_FRAGMENT].MaxImageUniforms &&
|
||||
screen->get_param(screen, PIPE_CAP_IMAGE_STORE_FORMATTED)) {
|
||||
extensions->ARB_shader_image_load_store = GL_TRUE;
|
||||
extensions->ARB_shader_image_size = GL_TRUE;
|
||||
}
|
||||
|
|
@ -1484,10 +1485,10 @@ void st_init_extensions(struct pipe_screen *screen,
|
|||
}
|
||||
|
||||
extensions->OES_texture_buffer =
|
||||
consts->Program[MESA_SHADER_COMPUTE].MaxImageUniforms &&
|
||||
extensions->ARB_texture_buffer_object &&
|
||||
extensions->ARB_texture_buffer_range &&
|
||||
extensions->ARB_texture_buffer_object_rgb32 &&
|
||||
extensions->ARB_shader_image_load_store;
|
||||
extensions->ARB_texture_buffer_object_rgb32;
|
||||
|
||||
extensions->EXT_framebuffer_sRGB =
|
||||
screen->get_param(screen, PIPE_CAP_DEST_SURFACE_SRGB_CONTROL) &&
|
||||
|
|
@ -1683,6 +1684,7 @@ void st_init_extensions(struct pipe_screen *screen,
|
|||
* these are redunant, but simpler to just have a (near-)exact copy here.
|
||||
*/
|
||||
extensions->ARB_ES3_1_compatibility =
|
||||
consts->Program[MESA_SHADER_FRAGMENT].MaxImageUniforms &&
|
||||
extensions->ARB_ES3_compatibility &&
|
||||
extensions->ARB_arrays_of_arrays &&
|
||||
extensions->ARB_compute_shader &&
|
||||
|
|
@ -1715,10 +1717,10 @@ void st_init_extensions(struct pipe_screen *screen,
|
|||
consts->NoPrimitiveBoundingBoxOutput = true;
|
||||
|
||||
extensions->ANDROID_extension_pack_es31a =
|
||||
consts->Program[MESA_SHADER_FRAGMENT].MaxImageUniforms &&
|
||||
extensions->KHR_texture_compression_astc_ldr &&
|
||||
extensions->KHR_blend_equation_advanced &&
|
||||
extensions->OES_sample_variables &&
|
||||
extensions->ARB_shader_image_load_store &&
|
||||
extensions->ARB_texture_stencil8 &&
|
||||
extensions->ARB_texture_multisample &&
|
||||
extensions->OES_copy_image &&
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue