[Mesa-dev] [PATCH 1/2] glsl: Expose pack/unpack built-ins for ARB_gpu_shader5.

Kenneth Graunke kenneth at whitecape.org
Tue Mar 18 17:47:14 PDT 2014


On 03/18/2014 04:00 PM, Matt Turner wrote:
> ARB_gpu_shader5 and ES 3.0 expose different subsets of
> ARB_shading_language_packing.
> ---
>  src/glsl/builtin_functions.cpp | 26 +++++++++++++++++---------
>  1 file changed, 17 insertions(+), 9 deletions(-)
> 
> diff --git a/src/glsl/builtin_functions.cpp b/src/glsl/builtin_functions.cpp
> index a52077d..3df2e3a 100644
> --- a/src/glsl/builtin_functions.cpp
> +++ b/src/glsl/builtin_functions.cpp
> @@ -194,16 +194,17 @@ shader_integer_mix(const _mesa_glsl_parse_state *state)
>  }
>  
>  static bool
> -shader_packing(const _mesa_glsl_parse_state *state)
> +shader_packing_or_es3(const _mesa_glsl_parse_state *state)
>  {
>     return state->ARB_shading_language_packing_enable ||
> -          state->is_version(400, 0);
> +          state->is_version(400, 300);
>  }
>  
>  static bool
> -shader_packing_or_es3(const _mesa_glsl_parse_state *state)
> +shader_packing_or_es3_or_gpu_shader5(const _mesa_glsl_parse_state *state)
>  {
>     return state->ARB_shading_language_packing_enable ||
> +          state->ARB_gpu_shader5_enable ||
>            state->is_version(400, 300);

This is definitely going in the "...strong work, diff!" file.  The
change looks good...once I read it correctly. :)

Both are
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>

>  }
>  
> @@ -214,6 +215,13 @@ gpu_shader5(const _mesa_glsl_parse_state *state)
>  }
>  
>  static bool
> +shader_packing_or_gpu_shader5(const _mesa_glsl_parse_state *state)
> +{
> +   return state->ARB_shading_language_packing_enable ||
> +          gpu_shader5(state);
> +}
> +
> +static bool
>  texture_array_lod(const _mesa_glsl_parse_state *state)
>  {
>     return lod_exists_in_stage(state) &&
> @@ -991,14 +999,14 @@ builtin_builder::create_builtins()
>                  _uintBitsToFloat(glsl_type::uvec4_type),
>                  NULL);
>  
> -   add_function("packUnorm2x16",   _packUnorm2x16(shader_packing_or_es3),   NULL);
> +   add_function("packUnorm2x16",   _packUnorm2x16(shader_packing_or_es3_or_gpu_shader5),   NULL);
>     add_function("packSnorm2x16",   _packSnorm2x16(shader_packing_or_es3),   NULL);
> -   add_function("packUnorm4x8",    _packUnorm4x8(shader_packing),           NULL);
> -   add_function("packSnorm4x8",    _packSnorm4x8(shader_packing),           NULL);
> -   add_function("unpackUnorm2x16", _unpackUnorm2x16(shader_packing_or_es3), NULL);
> +   add_function("packUnorm4x8",    _packUnorm4x8(shader_packing_or_gpu_shader5),           NULL);
> +   add_function("packSnorm4x8",    _packSnorm4x8(shader_packing_or_gpu_shader5),           NULL);
> +   add_function("unpackUnorm2x16", _unpackUnorm2x16(shader_packing_or_es3_or_gpu_shader5), NULL);
>     add_function("unpackSnorm2x16", _unpackSnorm2x16(shader_packing_or_es3), NULL);
> -   add_function("unpackUnorm4x8",  _unpackUnorm4x8(shader_packing),         NULL);
> -   add_function("unpackSnorm4x8",  _unpackSnorm4x8(shader_packing),         NULL);
> +   add_function("unpackUnorm4x8",  _unpackUnorm4x8(shader_packing_or_gpu_shader5),         NULL);
> +   add_function("unpackSnorm4x8",  _unpackSnorm4x8(shader_packing_or_gpu_shader5),         NULL);
>     add_function("packHalf2x16",    _packHalf2x16(shader_packing_or_es3),    NULL);
>     add_function("unpackHalf2x16",  _unpackHalf2x16(shader_packing_or_es3),  NULL);

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20140318/6e1bf2c0/attachment.sig>


More information about the mesa-dev mailing list