[Mesa-dev] [PATCH 5/8] mesa: expose AMD_texture_texture4

Ian Romanick idr at freedesktop.org
Wed Aug 15 19:10:16 UTC 2018


On 08/08/2018 07:12 PM, Marek Olšák wrote:
> From: Marek Olšák <marek.olsak at amd.com>
> 
> because the closed driver exposes it.

Aside from AMD_texture_texture4 being really, really under-specified,
there is one big difference between the two extensions.

    7)  Can both texture *AND* texture4 built-in functions
    sample from the same sampler in a shader?

    No.

vs.

    (5) Can both texture *AND* textureGather built-in functions
        sample from the same sampler in a shader?

       RESOLVED: Yes.

Of course, the AMD_texture_texture4 spec doesn't say what "no" means.
Compile error?  Garbage results?  A kitten dies?  Zero guidance from the
spec.  We should imitate whatever the closed driver does... unless a
kitten dies.  Don't do that.

> ---
>  docs/relnotes/18.3.0.html                |  1 +
>  src/compiler/glsl/builtin_functions.cpp  | 10 ++++++++++
>  src/compiler/glsl/glsl_parser_extras.cpp |  1 +
>  src/compiler/glsl/glsl_parser_extras.h   |  2 ++
>  src/mesa/main/extensions_table.h         |  1 +
>  5 files changed, 15 insertions(+)
> 
> diff --git a/docs/relnotes/18.3.0.html b/docs/relnotes/18.3.0.html
> index c0132311a25..8b067b55d3c 100644
> --- a/docs/relnotes/18.3.0.html
> +++ b/docs/relnotes/18.3.0.html
> @@ -48,20 +48,21 @@ TBD.
>  
>  <p>
>  Note: some of the new features are only available with certain drivers.
>  </p>
>  
>  <ul>
>  <li>GL_AMD_framebuffer_multisample_advanced on radeonsi.</li>
>  <li>GL_AMD_gpu_shader_int64 on i965, nvc0, radeonsi.</li>
>  <li>GL_AMD_multi_draw_indirect on all GL 4.x drivers.</li>
>  <li>GL_AMD_query_buffer_object on i965, nvc0, r600, radeonsi.</li>
> +<li>GL_AMD_texture_texture4 on i965, nvc0, r600, radeonsi.</li>
>  <li>GL_EXT_window_rectangles on radeonsi.</li>
>  </ul>
>  
>  <h2>Bug fixes</h2>
>  
>  <ul>
>  <li>TBD</li>
>  </ul>
>  
>  <h2>Changes</h2>
> diff --git a/src/compiler/glsl/builtin_functions.cpp b/src/compiler/glsl/builtin_functions.cpp
> index e37d96c4636..c778b65c6cd 100644
> --- a/src/compiler/glsl/builtin_functions.cpp
> +++ b/src/compiler/glsl/builtin_functions.cpp
> @@ -411,20 +411,26 @@ texture_query_lod(const _mesa_glsl_parse_state *state)
>  static bool
>  texture_gather_cube_map_array(const _mesa_glsl_parse_state *state)
>  {
>     return state->is_version(400, 320) ||
>            state->ARB_texture_gather_enable ||
>            state->ARB_gpu_shader5_enable ||
>            state->EXT_texture_cube_map_array_enable ||
>            state->OES_texture_cube_map_array_enable;
>  }
>  
> +static bool
> +texture_texture4(const _mesa_glsl_parse_state *state)
> +{
> +   return state->AMD_texture_texture4_enable;
> +}
> +
>  static bool
>  texture_gather_or_es31(const _mesa_glsl_parse_state *state)
>  {
>     return state->is_version(400, 310) ||
>            state->ARB_texture_gather_enable ||
>            state->ARB_gpu_shader5_enable;
>  }
>  
>  /* Only ARB_texture_gather but not GLSL 4.0 or ARB_gpu_shader5.
>   * used for relaxation of const offset requirements.
> @@ -2824,20 +2830,24 @@ builtin_builder::create_builtins()
>                  NULL);
>  
>     add_function("shadow2DRectGradARB",
>                  _texture(ir_txd, shader_texture_lod_and_rect, glsl_type::vec4_type,  glsl_type::sampler2DRectShadow_type, glsl_type::vec3_type),
>                  NULL);
>  
>     add_function("shadow2DRectProjGradARB",
>                  _texture(ir_txd, shader_texture_lod_and_rect, glsl_type::vec4_type,  glsl_type::sampler2DRectShadow_type, glsl_type::vec4_type, TEX_PROJECT),
>                  NULL);
>  
> +   add_function("texture4",
> +                _texture(ir_tg4, texture_texture4, glsl_type::vec4_type, glsl_type::sampler2D_type, glsl_type::vec2_type),
> +                NULL);
> +
>     add_function("textureGather",
>                  _texture(ir_tg4, texture_gather_or_es31, glsl_type::vec4_type, glsl_type::sampler2D_type, glsl_type::vec2_type),
>                  _texture(ir_tg4, texture_gather_or_es31, glsl_type::ivec4_type, glsl_type::isampler2D_type, glsl_type::vec2_type),
>                  _texture(ir_tg4, texture_gather_or_es31, glsl_type::uvec4_type, glsl_type::usampler2D_type, glsl_type::vec2_type),
>  
>                  _texture(ir_tg4, gpu_shader5, glsl_type::vec4_type, glsl_type::sampler2DRect_type, glsl_type::vec2_type),
>                  _texture(ir_tg4, gpu_shader5, glsl_type::ivec4_type, glsl_type::isampler2DRect_type, glsl_type::vec2_type),
>                  _texture(ir_tg4, gpu_shader5, glsl_type::uvec4_type, glsl_type::usampler2DRect_type, glsl_type::vec2_type),
>  
>                  _texture(ir_tg4, texture_gather_or_es31, glsl_type::vec4_type, glsl_type::sampler2DArray_type, glsl_type::vec3_type),
> diff --git a/src/compiler/glsl/glsl_parser_extras.cpp b/src/compiler/glsl/glsl_parser_extras.cpp
> index a455dde122a..9dbaef8f729 100644
> --- a/src/compiler/glsl/glsl_parser_extras.cpp
> +++ b/src/compiler/glsl/glsl_parser_extras.cpp
> @@ -694,20 +694,21 @@ static const _mesa_glsl_extension _mesa_glsl_supported_extensions[] = {
>     EXT(OES_texture_cube_map_array),
>     EXT_AEP(OES_texture_storage_multisample_2d_array),
>     EXT(OES_viewport_array),
>  
>     /* All other extensions go here, sorted alphabetically.
>      */
>     EXT(AMD_conservative_depth),
>     EXT(AMD_gpu_shader_int64),
>     EXT(AMD_shader_stencil_export),
>     EXT(AMD_shader_trinary_minmax),
> +   EXT(AMD_texture_texture4),
>     EXT(AMD_vertex_shader_layer),
>     EXT(AMD_vertex_shader_viewport_index),
>     EXT(ANDROID_extension_pack_es31a),
>     EXT(EXT_blend_func_extended),
>     EXT(EXT_frag_depth),
>     EXT(EXT_draw_buffers),
>     EXT(EXT_clip_cull_distance),
>     EXT(EXT_geometry_point_size),
>     EXT_AEP(EXT_geometry_shader),
>     EXT_AEP(EXT_gpu_shader5),
> diff --git a/src/compiler/glsl/glsl_parser_extras.h b/src/compiler/glsl/glsl_parser_extras.h
> index 81792de5704..71c21ced2bd 100644
> --- a/src/compiler/glsl/glsl_parser_extras.h
> +++ b/src/compiler/glsl/glsl_parser_extras.h
> @@ -758,20 +758,22 @@ struct _mesa_glsl_parse_state {
>     /* All other extensions go here, sorted alphabetically.
>      */
>     bool AMD_conservative_depth_enable;
>     bool AMD_conservative_depth_warn;
>     bool AMD_gpu_shader_int64_enable;
>     bool AMD_gpu_shader_int64_warn;
>     bool AMD_shader_stencil_export_enable;
>     bool AMD_shader_stencil_export_warn;
>     bool AMD_shader_trinary_minmax_enable;
>     bool AMD_shader_trinary_minmax_warn;
> +   bool AMD_texture_texture4_enable;
> +   bool AMD_texture_texture4_warn;
>     bool AMD_vertex_shader_layer_enable;
>     bool AMD_vertex_shader_layer_warn;
>     bool AMD_vertex_shader_viewport_index_enable;
>     bool AMD_vertex_shader_viewport_index_warn;
>     bool ANDROID_extension_pack_es31a_enable;
>     bool ANDROID_extension_pack_es31a_warn;
>     bool EXT_blend_func_extended_enable;
>     bool EXT_blend_func_extended_warn;
>     bool EXT_clip_cull_distance_enable;
>     bool EXT_clip_cull_distance_warn;
> diff --git a/src/mesa/main/extensions_table.h b/src/mesa/main/extensions_table.h
> index 34d7fa96bae..629a42f64e0 100644
> --- a/src/mesa/main/extensions_table.h
> +++ b/src/mesa/main/extensions_table.h
> @@ -12,20 +12,21 @@ EXT(AMD_conservative_depth                  , ARB_conservative_depth
>  EXT(AMD_draw_buffers_blend                  , ARB_draw_buffers_blend                 , GLL, GLC,  x ,  x , 2009)
>  EXT(AMD_framebuffer_multisample_advanced    , AMD_framebuffer_multisample_advanced   , GLL, GLC,  x , ES2, 2018)
>  EXT(AMD_gpu_shader_int64                    , ARB_gpu_shader_int64                   ,  x , GLC,  x ,  x , 2015)
>  EXT(AMD_multi_draw_indirect                 , ARB_draw_indirect                      , GLL, GLC,  x ,  x , 2011)
>  EXT(AMD_performance_monitor                 , AMD_performance_monitor                , GLL, GLC,  x , ES2, 2007)
>  EXT(AMD_pinned_memory                       , AMD_pinned_memory                      , GLL, GLC,  x ,  x , 2013)
>  EXT(AMD_query_buffer_object                 , ARB_query_buffer_object                , GLL, GLC,  x ,  x , 2012)
>  EXT(AMD_seamless_cubemap_per_texture        , AMD_seamless_cubemap_per_texture       , GLL, GLC,  x ,  x , 2009)
>  EXT(AMD_shader_stencil_export               , ARB_shader_stencil_export              , GLL, GLC,  x ,  x , 2009)
>  EXT(AMD_shader_trinary_minmax               , dummy_true                             , GLL, GLC,  x ,  x , 2012)
> +EXT(AMD_texture_texture4                    , ARB_texture_gather                     , GLL, GLC,  x ,  x , 2008)
>  EXT(AMD_vertex_shader_layer                 , AMD_vertex_shader_layer                , GLL, GLC,  x ,  x , 2012)
>  EXT(AMD_vertex_shader_viewport_index        , AMD_vertex_shader_viewport_index       , GLL, GLC,  x ,  x , 2012)
>  
>  EXT(ANDROID_extension_pack_es31a            , ANDROID_extension_pack_es31a           ,  x ,  x ,  x ,  31, 2014)
>  
>  EXT(ANGLE_texture_compression_dxt3          , ANGLE_texture_compression_dxt          , GLL, GLC, ES1, ES2, 2011)
>  EXT(ANGLE_texture_compression_dxt5          , ANGLE_texture_compression_dxt          , GLL, GLC, ES1, ES2, 2011)
>  
>  EXT(APPLE_object_purgeable                  , APPLE_object_purgeable                 , GLL, GLC,  x ,  x , 2006)
>  EXT(APPLE_packed_pixels                     , dummy_true                             , GLL,  x ,  x ,  x , 2002)
> 



More information about the mesa-dev mailing list