[Mesa-dev] [PATCH 3/4] mesa: Allow relax various desktop-only checks for cube arrays

Ian Romanick idr at freedesktop.org
Wed Jun 1 17:44:24 UTC 2016


On 05/31/2016 07:39 AM, Ilia Mirkin wrote:
> This has the unfortunate side-effect of opening up cube map arrays to
> ES 3.0 implementations where the backend driver also supports texture
> cubemaps for desktop GL (I'm thinking the DX10.1 GT21x's for example).
> Perhaps we don't care? Otherwise it may be nice to use the new
> _mesa_has_OES_bla_ext() helpers.

I was also going to make some comments that this extension requires
GL_OES_geometry_shader.  I went digging through the extension spec to
understand the rationale for the requirements.  It basically comes down
to OpenGL ES's strong desire to put suffixes on everything to the
detriment of every application developer:

    (3) What should the rules on GLSL suffixing be?

    RESOLVED: The new sampler and image types are not reserved keywords in
    ESSL 3.00, but they are keywords in GLSL 4.40. ESSL 3.10 updates the
    reserved keyword list to include all keywords used or reserved in GLSL
    4.40 (but not otherwise used in ES), and thus we can use the image
    and sampler keywords directly by moving them from the reserved keywords
    section. See bug 11179.

It requires GLES 3.1 because samplerCubeArray and friends weren't
reserved words in GLES 3.0.  I'll try to stifle my rage and simply say
that we should expose this extension in GLES 3.0.

> On Tue, May 31, 2016 at 1:28 AM, Chris Forbes <chrisf at ijw.co.nz> wrote:
>> Signed-off-by: Chris Forbes <chrisforbes at google.com>
>> ---
>>  src/mesa/main/get.c              | 2 +-
>>  src/mesa/main/get_hash_params.py | 6 +++---
>>  src/mesa/main/teximage.c         | 3 ++-
>>  src/mesa/main/texobj.c           | 2 +-
>>  src/mesa/main/texparam.c         | 3 ++-
>>  src/mesa/main/texstorage.c       | 3 ++-
>>  6 files changed, 11 insertions(+), 8 deletions(-)
>>
>> diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c
>> index 9f70749..4f46572 100644
>> --- a/src/mesa/main/get.c
>> +++ b/src/mesa/main/get.c
>> @@ -1914,7 +1914,7 @@ tex_binding_to_index(const struct gl_context *ctx, GLenum binding)
>>                _mesa_has_OES_texture_buffer(ctx)) ?
>>               TEXTURE_BUFFER_INDEX : -1;
>>     case GL_TEXTURE_BINDING_CUBE_MAP_ARRAY:
>> -      return _mesa_is_desktop_gl(ctx) && ctx->Extensions.ARB_texture_cube_map_array
>> +      return ctx->Extensions.ARB_texture_cube_map_array
>>           ? TEXTURE_CUBE_ARRAY_INDEX : -1;
>>     case GL_TEXTURE_BINDING_2D_MULTISAMPLE:
>>        return _mesa_is_desktop_gl(ctx) && ctx->Extensions.ARB_texture_multisample
>> diff --git a/src/mesa/main/get_hash_params.py b/src/mesa/main/get_hash_params.py
>> index 2124072..7193296 100644
>> --- a/src/mesa/main/get_hash_params.py
>> +++ b/src/mesa/main/get_hash_params.py
>> @@ -458,6 +458,9 @@ descriptor=[
>>    [ "MIN_PROGRAM_TEXTURE_GATHER_OFFSET", "CONTEXT_INT(Const.MinProgramTextureGatherOffset), extra_ARB_texture_gather"],
>>    [ "MAX_PROGRAM_TEXTURE_GATHER_OFFSET", "CONTEXT_INT(Const.MaxProgramTextureGatherOffset), extra_ARB_texture_gather"],
>>
>> +# GL_ARB_texture_cube_map_array / ES3.1 with GL_OES_texture_cube_map_array
>> +  [ "TEXTURE_BINDING_CUBE_MAP_ARRAY_ARB", "LOC_CUSTOM, TYPE_INT, TEXTURE_CUBE_ARRAY_INDEX, extra_ARB_texture_cube_map_array" ],
>> +
>>  # GL_ARB_compute_shader / GLES 3.1
>>    [ "MAX_COMPUTE_WORK_GROUP_INVOCATIONS", "CONTEXT_INT(Const.MaxComputeWorkGroupInvocations), extra_ARB_compute_shader_es31" ],
>>    [ "MAX_COMPUTE_UNIFORM_BLOCKS", "CONTEXT_INT(Const.Program[MESA_SHADER_COMPUTE].MaxUniformBlocks), extra_ARB_compute_shader_es31" ],
>> @@ -851,9 +854,6 @@ descriptor=[
>>  # GL_ARB_map_buffer_alignment
>>    [ "MIN_MAP_BUFFER_ALIGNMENT", "CONTEXT_INT(Const.MinMapBufferAlignment), NO_EXTRA" ],
>>
>> -# GL_ARB_texture_cube_map_array
>> -  [ "TEXTURE_BINDING_CUBE_MAP_ARRAY_ARB", "LOC_CUSTOM, TYPE_INT, TEXTURE_CUBE_ARRAY_INDEX, extra_ARB_texture_cube_map_array" ],
>> -
>>  # GL_ARB_texture_gather
>>    [ "MAX_PROGRAM_TEXTURE_GATHER_COMPONENTS_ARB", "CONTEXT_INT(Const.MaxProgramTextureGatherComponents), extra_ARB_texture_gather"],
>>
>> diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
>> index 58b7f27..bfe0b18 100644
>> --- a/src/mesa/main/teximage.c
>> +++ b/src/mesa/main/teximage.c
>> @@ -1474,8 +1474,9 @@ legal_teximage_target(struct gl_context *ctx, GLuint dims, GLenum target)
>>        case GL_PROXY_TEXTURE_2D_ARRAY_EXT:
>>           return _mesa_is_desktop_gl(ctx) && ctx->Extensions.EXT_texture_array;
>>        case GL_TEXTURE_CUBE_MAP_ARRAY:
>> -      case GL_PROXY_TEXTURE_CUBE_MAP_ARRAY:
>>           return ctx->Extensions.ARB_texture_cube_map_array;
>> +      case GL_PROXY_TEXTURE_CUBE_MAP_ARRAY:
>> +         return _mesa_is_desktop_gl(ctx) && ctx->Extensions.ARB_texture_cube_map_array;
>>        default:
>>           return GL_FALSE;
>>        }
>> diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c
>> index ed630bd..2e9d9e3 100644
>> --- a/src/mesa/main/texobj.c
>> +++ b/src/mesa/main/texobj.c
>> @@ -1579,7 +1579,7 @@ _mesa_tex_target_to_index(const struct gl_context *ctx, GLenum target)
>>        return _mesa_is_gles(ctx) && ctx->Extensions.OES_EGL_image_external
>>           ? TEXTURE_EXTERNAL_INDEX : -1;
>>     case GL_TEXTURE_CUBE_MAP_ARRAY:
>> -      return _mesa_is_desktop_gl(ctx) && ctx->Extensions.ARB_texture_cube_map_array
>> +      return ctx->Extensions.ARB_texture_cube_map_array
>>           ? TEXTURE_CUBE_ARRAY_INDEX : -1;
>>     case GL_TEXTURE_2D_MULTISAMPLE:
>>        return ((_mesa_is_desktop_gl(ctx) && ctx->Extensions.ARB_texture_multisample) ||
>> diff --git a/src/mesa/main/texparam.c b/src/mesa/main/texparam.c
>> index ba83f8f..d701b87 100644
>> --- a/src/mesa/main/texparam.c
>> +++ b/src/mesa/main/texparam.c
>> @@ -1243,6 +1243,8 @@ _mesa_legal_get_tex_level_parameter_target(struct gl_context *ctx, GLenum target
>>         */
>>        return (ctx->API == API_OPENGL_CORE && ctx->Version >= 31) ||
>>           _mesa_has_OES_texture_buffer(ctx);
>> +   case GL_TEXTURE_CUBE_MAP_ARRAY_ARB:
>> +      return ctx->Extensions.ARB_texture_cube_map_array;
>>     }
>>
>>     if (!_mesa_is_desktop_gl(ctx))
>> @@ -1257,7 +1259,6 @@ _mesa_legal_get_tex_level_parameter_target(struct gl_context *ctx, GLenum target
>>        return GL_TRUE;
>>     case GL_PROXY_TEXTURE_CUBE_MAP:
>>        return ctx->Extensions.ARB_texture_cube_map;
>> -   case GL_TEXTURE_CUBE_MAP_ARRAY_ARB:
>>     case GL_PROXY_TEXTURE_CUBE_MAP_ARRAY_ARB:
>>        return ctx->Extensions.ARB_texture_cube_map_array;
>>     case GL_TEXTURE_RECTANGLE_NV:
>> diff --git a/src/mesa/main/texstorage.c b/src/mesa/main/texstorage.c
>> index f4a0760..46869bb 100644
>> --- a/src/mesa/main/texstorage.c
>> +++ b/src/mesa/main/texstorage.c
>> @@ -55,7 +55,8 @@ legal_texobj_target(struct gl_context *ctx, GLuint dims, GLenum target)
>>         && target != GL_TEXTURE_2D
>>         && target != GL_TEXTURE_CUBE_MAP
>>         && target != GL_TEXTURE_3D
>> -       && target != GL_TEXTURE_2D_ARRAY)
>> +       && target != GL_TEXTURE_2D_ARRAY
>> +       && (target != GL_TEXTURE_CUBE_MAP_ARRAY || !ctx->Extensions.ARB_texture_cube_map_array))
>>        return GL_FALSE;
>>
>>     switch (dims) {
>> --
>> 2.8.3
>>
>> _______________________________________________
>> mesa-dev mailing list
>> mesa-dev at lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
> 



More information about the mesa-dev mailing list