[Mesa-dev] [PATCH] glsl: Delete unused gl_uniform_driver_format enum values.

Ian Romanick idr at freedesktop.org
Tue Oct 21 08:05:43 PDT 2014


I have this exact patch setting in me queue to send out.

Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>

I had initially thought about going the other way, and using the enums
instead of UniformBooleanTrue.  I think the UniformBooleanTrue method is
slightly more efficient since there is only one place where value
conversions occur.

On 10/16/2014 09:28 AM, Kenneth Graunke wrote:
> A while back, Matt made the uniform upload functions simply upload
> ctx->Const.UniformBooleanTrue for boolean values instead of 0/1, which
> removed the need to convert it later.  We also set UniformBooleanTrue to
> 1.0f for drivers which want to treat booleans as 0.0/1.0f.
> 
> Nothing ever sets these, so they are dead.
> 
> Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
> ---
>  src/glsl/ir_uniform.h           | 11 -----------
>  src/mesa/main/uniform_query.cpp | 27 ++-------------------------
>  2 files changed, 2 insertions(+), 36 deletions(-)
> 
> diff --git a/src/glsl/ir_uniform.h b/src/glsl/ir_uniform.h
> index 2f73528..b9ecf7c 100644
> --- a/src/glsl/ir_uniform.h
> +++ b/src/glsl/ir_uniform.h
> @@ -45,17 +45,6 @@ extern "C" {
>  enum PACKED gl_uniform_driver_format {
>     uniform_native = 0,          /**< Store data in the native format. */
>     uniform_int_float,           /**< Store integer data as floats. */
> -   uniform_bool_float,          /**< Store boolean data as floats. */
> -
> -   /**
> -    * Store boolean data as integer using 1 for \c true.
> -    */
> -   uniform_bool_int_0_1,
> -
> -   /**
> -    * Store boolean data as integer using ~0 for \c true.
> -    */
> -   uniform_bool_int_0_not0
>  };
>  
>  struct gl_uniform_driver_storage {
> diff --git a/src/mesa/main/uniform_query.cpp b/src/mesa/main/uniform_query.cpp
> index 1592c9b..f747cd5 100644
> --- a/src/mesa/main/uniform_query.cpp
> +++ b/src/mesa/main/uniform_query.cpp
> @@ -533,8 +533,7 @@ _mesa_propagate_uniforms_to_driver_storage(struct gl_uniform_storage *uni,
>        dst += array_index * store->element_stride;
>  
>        switch (store->format) {
> -      case uniform_native:
> -      case uniform_bool_int_0_1: {
> +      case uniform_native: {
>  	 unsigned j;
>  	 unsigned v;
>  
> @@ -550,8 +549,7 @@ _mesa_propagate_uniforms_to_driver_storage(struct gl_uniform_storage *uni,
>  	 break;
>        }
>  
> -      case uniform_int_float:
> -      case uniform_bool_float: {
> +      case uniform_int_float: {
>  	 const int *isrc = (const int *) src;
>  	 unsigned j;
>  	 unsigned v;
> @@ -572,27 +570,6 @@ _mesa_propagate_uniforms_to_driver_storage(struct gl_uniform_storage *uni,
>  	 break;
>        }
>  
> -      case uniform_bool_int_0_not0: {
> -	 const int *isrc = (const int *) src;
> -	 unsigned j;
> -	 unsigned v;
> -	 unsigned c;
> -
> -	 for (j = 0; j < count; j++) {
> -	    for (v = 0; v < vectors; v++) {
> -	       for (c = 0; c < components; c++) {
> -		  ((int *) dst)[c] = *isrc == 0 ? 0 : ~0;
> -		  isrc++;
> -	       }
> -
> -	       dst += store->vector_stride;
> -	    }
> -
> -	    dst += extra_stride;
> -	 }
> -	 break;
> -      }
> -
>        default:
>  	 assert(!"Should not get here.");
>  	 break;
> 



More information about the mesa-dev mailing list