diff options
author | Eric Anholt <[email protected]> | 2020-01-06 13:19:30 -0800 |
---|---|---|
committer | Marge Bot <[email protected]> | 2020-01-14 23:55:00 +0000 |
commit | 4cabd4812a6b2a15d15cd889778a36956574c9a3 (patch) | |
tree | 806786733d586fd067424a5033aa7b238ea69ca2 | |
parent | 74ee3f76deec064577b2ce33b6a7ec9828868d57 (diff) |
mesa/prog: Reuse count_vec4_slots() from ir_to_mesa.
Reviewed-by: Kristian H. Kristensen <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3297>
-rw-r--r-- | src/mesa/program/ir_to_mesa.cpp | 76 |
1 files changed, 1 insertions, 75 deletions
diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp index bcf50c505e1..dfc52e718d1 100644 --- a/src/mesa/program/ir_to_mesa.cpp +++ b/src/mesa/program/ir_to_mesa.cpp @@ -500,83 +500,9 @@ ir_to_mesa_visitor::src_reg_for_float(float val) } static int -storage_type_size(const struct glsl_type *type, bool bindless) -{ - unsigned int i; - int size; - - switch (type->base_type) { - case GLSL_TYPE_UINT: - case GLSL_TYPE_INT: - case GLSL_TYPE_UINT8: - case GLSL_TYPE_INT8: - case GLSL_TYPE_UINT16: - case GLSL_TYPE_INT16: - case GLSL_TYPE_FLOAT: - case GLSL_TYPE_FLOAT16: - case GLSL_TYPE_BOOL: - if (type->is_matrix()) { - return type->matrix_columns; - } else { - /* Regardless of size of vector, it gets a vec4. This is bad - * packing for things like floats, but otherwise arrays become a - * mess. Hopefully a later pass over the code can pack scalars - * down if appropriate. - */ - return 1; - } - break; - case GLSL_TYPE_DOUBLE: - if (type->is_matrix()) { - if (type->vector_elements > 2) - return type->matrix_columns * 2; - else - return type->matrix_columns; - } else { - if (type->vector_elements > 2) - return 2; - else - return 1; - } - break; - case GLSL_TYPE_UINT64: - case GLSL_TYPE_INT64: - if (type->vector_elements > 2) - return 2; - else - return 1; - case GLSL_TYPE_ARRAY: - assert(type->length > 0); - return storage_type_size(type->fields.array, bindless) * type->length; - case GLSL_TYPE_STRUCT: - size = 0; - for (i = 0; i < type->length; i++) { - size += storage_type_size(type->fields.structure[i].type, bindless); - } - return size; - case GLSL_TYPE_SAMPLER: - case GLSL_TYPE_IMAGE: - if (!bindless) - return 0; - /* fall through */ - case GLSL_TYPE_SUBROUTINE: - return 1; - case GLSL_TYPE_ATOMIC_UINT: - case GLSL_TYPE_VOID: - case GLSL_TYPE_ERROR: - case GLSL_TYPE_INTERFACE: - case GLSL_TYPE_FUNCTION: - assert(!"Invalid type in type_size"); - break; - } - - return 0; -} - -static int type_size(const struct glsl_type *type) { - return storage_type_size(type, false); + return type->count_vec4_slots(false, false); } /** |