Re: [Mesa-dev] [PATCH] glsl/types: rename is_dual_slot_double to is_dual_slot_64bit.

2016-06-08 Thread Ilia Mirkin
On Wed, Jun 8, 2016 at 5:51 PM, Dave Airlie  wrote:
> From: Dave Airlie 
>
> In the future int64 support will have the same requirements.
>
> Signed-off-by: Dave Airlie 
> ---
>  src/compiler/glsl/ir_set_program_inouts.cpp| 4 ++--
>  src/compiler/glsl/linker.cpp   | 4 ++--
>  src/compiler/glsl_types.h  | 4 ++--
>  src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp | 4 ++--
>  src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 2 +-
>  5 files changed, 9 insertions(+), 9 deletions(-)
>
> diff --git a/src/compiler/glsl/ir_set_program_inouts.cpp 
> b/src/compiler/glsl/ir_set_program_inouts.cpp
> index 183b13b..2300da1 100644
> --- a/src/compiler/glsl/ir_set_program_inouts.cpp
> +++ b/src/compiler/glsl/ir_set_program_inouts.cpp
> @@ -119,7 +119,7 @@ mark(struct gl_program *prog, ir_variable *var, int 
> offset, int len,
>
>   /* double inputs read is only for vertex inputs */
>   if (stage == MESA_SHADER_VERTEX &&
> - var->type->without_array()->is_dual_slot_double())
> + var->type->without_array()->is_dual_slot_64bit())
>  prog->DoubleInputsRead |= bitfield;
>
>   if (stage == MESA_SHADER_FRAGMENT) {
> @@ -306,7 +306,7 @@ 
> ir_set_program_inouts_visitor::try_mark_partial_variable(ir_variable *var,
> /* double element width for double types that takes two slots */
> if (this->shader_stage != MESA_SHADER_VERTEX ||
> var->data.mode != ir_var_shader_in) {
> -  if (type->without_array()->is_dual_slot_double())
> +  if (type->without_array()->is_dual_slot_64bit())
>  elem_width *= 2;
> }
>
> diff --git a/src/compiler/glsl/linker.cpp b/src/compiler/glsl/linker.cpp
> index 9e65590..b82446d 100644
> --- a/src/compiler/glsl/linker.cpp
> +++ b/src/compiler/glsl/linker.cpp
> @@ -2863,7 +2863,7 @@ assign_attribute_or_color_locations(gl_shader_program 
> *prog,
>   * issue (3) of the GL_ARB_vertex_attrib_64bit behavior, this
>   * is optional behavior, but it seems preferable.
>   */
> -if (var->type->without_array()->is_dual_slot_double())
> +if (var->type->without_array()->is_dual_slot_64bit())
> double_storage_locations |= (use_mask << attr);
>  }
>
> @@ -2940,7 +2940,7 @@ assign_attribute_or_color_locations(gl_shader_program 
> *prog,
>to_assign[i].var->data.is_unmatched_generic_inout = 0;
>used_locations |= (use_mask << location);
>
> -  if (to_assign[i].var->type->without_array()->is_dual_slot_double())
> +  if (to_assign[i].var->type->without_array()->is_dual_slot_64bit())
>   double_storage_locations |= (use_mask << location);
> }
>
> diff --git a/src/compiler/glsl_types.h b/src/compiler/glsl_types.h
> index 2102132..b16ae67 100644
> --- a/src/compiler/glsl_types.h
> +++ b/src/compiler/glsl_types.h
> @@ -497,9 +497,9 @@ struct glsl_type {
> /**
>  * Query whether a double takes two slots.
>  */
> -   bool is_dual_slot_double() const
> +   bool is_dual_slot_64bit() const

I might just call this is_dual_slot(). Also adjust the comment above it.

Either way,

Reviewed-by: Ilia Mirkin 


> {
> -  return base_type == GLSL_TYPE_DOUBLE && vector_elements > 2;
> +  return is_64bit() && vector_elements > 2;
> }
>
> /**
> diff --git a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp 
> b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
> index 4b5dfe6..fbaf2ba 100644
> --- a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
> +++ b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
> @@ -585,7 +585,7 @@ type_size_xvec4(const struct glsl_type *type, bool 
> as_vec4)
>if (type->is_matrix()) {
>   const glsl_type *col_type = type->column_type();
>   unsigned col_slots =
> -(as_vec4 && col_type->is_dual_slot_double()) ? 2 : 1;
> +(as_vec4 && col_type->is_dual_slot_64bit()) ? 2 : 1;
>   return type->matrix_columns * col_slots;
>} else {
>   /* Regardless of size of vector, it gets a vec4. This is bad
> @@ -593,7 +593,7 @@ type_size_xvec4(const struct glsl_type *type, bool 
> as_vec4)
>* mess.  Hopefully a later pass over the code can pack scalars
>* down if appropriate.
>*/
> - return (as_vec4 && type->is_dual_slot_double()) ? 2 : 1;
> + return (as_vec4 && type->is_dual_slot_64bit()) ? 2 : 1;
>}
> case GLSL_TYPE_ARRAY:
>assert(type->length > 0);
> diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp 
> b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
> index e559e46..62bc39d 100644
> --- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
> +++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
> @@ -2822,7 +2822,7 @@ glsl_to_tgsi_visitor::emit_block_mov(ir_assignment *ir, 
> const struct glsl_type *
> }
> l->index++;
> r->index++;
> -   if 

[Mesa-dev] [PATCH] glsl/types: rename is_dual_slot_double to is_dual_slot_64bit.

2016-06-08 Thread Dave Airlie
From: Dave Airlie 

In the future int64 support will have the same requirements.

Signed-off-by: Dave Airlie 
---
 src/compiler/glsl/ir_set_program_inouts.cpp| 4 ++--
 src/compiler/glsl/linker.cpp   | 4 ++--
 src/compiler/glsl_types.h  | 4 ++--
 src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp | 4 ++--
 src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 2 +-
 5 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/src/compiler/glsl/ir_set_program_inouts.cpp 
b/src/compiler/glsl/ir_set_program_inouts.cpp
index 183b13b..2300da1 100644
--- a/src/compiler/glsl/ir_set_program_inouts.cpp
+++ b/src/compiler/glsl/ir_set_program_inouts.cpp
@@ -119,7 +119,7 @@ mark(struct gl_program *prog, ir_variable *var, int offset, 
int len,
 
  /* double inputs read is only for vertex inputs */
  if (stage == MESA_SHADER_VERTEX &&
- var->type->without_array()->is_dual_slot_double())
+ var->type->without_array()->is_dual_slot_64bit())
 prog->DoubleInputsRead |= bitfield;
 
  if (stage == MESA_SHADER_FRAGMENT) {
@@ -306,7 +306,7 @@ 
ir_set_program_inouts_visitor::try_mark_partial_variable(ir_variable *var,
/* double element width for double types that takes two slots */
if (this->shader_stage != MESA_SHADER_VERTEX ||
var->data.mode != ir_var_shader_in) {
-  if (type->without_array()->is_dual_slot_double())
+  if (type->without_array()->is_dual_slot_64bit())
 elem_width *= 2;
}
 
diff --git a/src/compiler/glsl/linker.cpp b/src/compiler/glsl/linker.cpp
index 9e65590..b82446d 100644
--- a/src/compiler/glsl/linker.cpp
+++ b/src/compiler/glsl/linker.cpp
@@ -2863,7 +2863,7 @@ assign_attribute_or_color_locations(gl_shader_program 
*prog,
  * issue (3) of the GL_ARB_vertex_attrib_64bit behavior, this
  * is optional behavior, but it seems preferable.
  */
-if (var->type->without_array()->is_dual_slot_double())
+if (var->type->without_array()->is_dual_slot_64bit())
double_storage_locations |= (use_mask << attr);
 }
 
@@ -2940,7 +2940,7 @@ assign_attribute_or_color_locations(gl_shader_program 
*prog,
   to_assign[i].var->data.is_unmatched_generic_inout = 0;
   used_locations |= (use_mask << location);
 
-  if (to_assign[i].var->type->without_array()->is_dual_slot_double())
+  if (to_assign[i].var->type->without_array()->is_dual_slot_64bit())
  double_storage_locations |= (use_mask << location);
}
 
diff --git a/src/compiler/glsl_types.h b/src/compiler/glsl_types.h
index 2102132..b16ae67 100644
--- a/src/compiler/glsl_types.h
+++ b/src/compiler/glsl_types.h
@@ -497,9 +497,9 @@ struct glsl_type {
/**
 * Query whether a double takes two slots.
 */
-   bool is_dual_slot_double() const
+   bool is_dual_slot_64bit() const
{
-  return base_type == GLSL_TYPE_DOUBLE && vector_elements > 2;
+  return is_64bit() && vector_elements > 2;
}
 
/**
diff --git a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp 
b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
index 4b5dfe6..fbaf2ba 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
@@ -585,7 +585,7 @@ type_size_xvec4(const struct glsl_type *type, bool as_vec4)
   if (type->is_matrix()) {
  const glsl_type *col_type = type->column_type();
  unsigned col_slots =
-(as_vec4 && col_type->is_dual_slot_double()) ? 2 : 1;
+(as_vec4 && col_type->is_dual_slot_64bit()) ? 2 : 1;
  return type->matrix_columns * col_slots;
   } else {
  /* Regardless of size of vector, it gets a vec4. This is bad
@@ -593,7 +593,7 @@ type_size_xvec4(const struct glsl_type *type, bool as_vec4)
   * mess.  Hopefully a later pass over the code can pack scalars
   * down if appropriate.
   */
- return (as_vec4 && type->is_dual_slot_double()) ? 2 : 1;
+ return (as_vec4 && type->is_dual_slot_64bit()) ? 2 : 1;
   }
case GLSL_TYPE_ARRAY:
   assert(type->length > 0);
diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp 
b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
index e559e46..62bc39d 100644
--- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
@@ -2822,7 +2822,7 @@ glsl_to_tgsi_visitor::emit_block_mov(ir_assignment *ir, 
const struct glsl_type *
}
l->index++;
r->index++;
-   if (type->is_dual_slot_double()) {
+   if (type->is_dual_slot_64bit()) {
   l->index++;
   if (r->is_double_vertex_input == false)
 r->index++;
-- 
2.5.5

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev