diff options
author | Timothy Arceri <[email protected]> | 2019-03-29 12:39:48 +1100 |
---|---|---|
committer | Karol Herbst <[email protected]> | 2019-04-12 09:02:59 +0200 |
commit | 035759b61ba1778d5143cdf3a8795a62dd5d8a60 (patch) | |
tree | 18f3e4fb796338f1e72defe381e9bd7e463e7ce3 /src/mesa | |
parent | 3b2a9ffd60eb3612e1034019e499a27a1c2a672b (diff) |
nir/i965/freedreno/vc4: add a bindless bool to type size functions
This required to calculate sizes correctly when we have bindless
samplers/images.
Reviewed-by: Marek Olšák <[email protected]>
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/state_tracker/st_glsl_types.cpp | 18 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_glsl_types.h | 4 |
2 files changed, 13 insertions, 9 deletions
diff --git a/src/mesa/state_tracker/st_glsl_types.cpp b/src/mesa/state_tracker/st_glsl_types.cpp index 277b91c4a5c..b0b422f41fe 100644 --- a/src/mesa/state_tracker/st_glsl_types.cpp +++ b/src/mesa/state_tracker/st_glsl_types.cpp @@ -110,7 +110,7 @@ st_glsl_storage_type_size(const struct glsl_type *type, bool is_bindless) } int -st_glsl_type_dword_size(const struct glsl_type *type) +st_glsl_type_dword_size(const struct glsl_type *type, bool bindless) { unsigned int size, i; @@ -127,20 +127,24 @@ st_glsl_type_dword_size(const struct glsl_type *type) case GLSL_TYPE_UINT8: case GLSL_TYPE_INT8: return DIV_ROUND_UP(type->components(), 4); + case GLSL_TYPE_IMAGE: + case GLSL_TYPE_SAMPLER: + if (!bindless) + return 0; case GLSL_TYPE_DOUBLE: case GLSL_TYPE_UINT64: case GLSL_TYPE_INT64: return type->components() * 2; case GLSL_TYPE_ARRAY: - return st_glsl_type_dword_size(type->fields.array) * type->length; + return st_glsl_type_dword_size(type->fields.array, bindless) * + type->length; case GLSL_TYPE_STRUCT: size = 0; for (i = 0; i < type->length; i++) { - size += st_glsl_type_dword_size(type->fields.structure[i].type); + size += st_glsl_type_dword_size(type->fields.structure[i].type, + bindless); } return size; - case GLSL_TYPE_IMAGE: - case GLSL_TYPE_SAMPLER: case GLSL_TYPE_ATOMIC_UINT: return 0; case GLSL_TYPE_SUBROUTINE: @@ -162,7 +166,7 @@ st_glsl_type_dword_size(const struct glsl_type *type) * vec4. */ int -st_glsl_uniforms_type_size(const struct glsl_type *type) +st_glsl_uniforms_type_size(const struct glsl_type *type, bool bindless) { - return st_glsl_storage_type_size(type, false); + return st_glsl_storage_type_size(type, bindless); } diff --git a/src/mesa/state_tracker/st_glsl_types.h b/src/mesa/state_tracker/st_glsl_types.h index e0aff12366a..1f2e5ab8f29 100644 --- a/src/mesa/state_tracker/st_glsl_types.h +++ b/src/mesa/state_tracker/st_glsl_types.h @@ -36,9 +36,9 @@ extern "C" { int st_glsl_storage_type_size(const struct glsl_type *type, bool is_bindless); -int st_glsl_uniforms_type_size(const struct glsl_type *type); +int st_glsl_uniforms_type_size(const struct glsl_type *type, bool bindless); -int st_glsl_type_dword_size(const struct glsl_type *type); +int st_glsl_type_dword_size(const struct glsl_type *type, bool bindless); #ifdef __cplusplus } |