summaryrefslogtreecommitdiffstats
path: root/src/mesa/program/ir_to_mesa.cpp
diff options
context:
space:
mode:
authorTimothy Arceri <[email protected]>2017-08-15 20:42:29 +1000
committerTimothy Arceri <[email protected]>2017-08-15 23:51:35 +1000
commitfe74c8ffbf0658f2b5a9be65192ae1bf72eebe95 (patch)
tree956e385cf353e1462d2e0cd29492b0e4d4c73250 /src/mesa/program/ir_to_mesa.cpp
parent1ab7fed7079a8b0f670d6a51ddc98691ace29508 (diff)
mesa: count uniform against storage when its bindless
Gallium drivers use this code path so we need to account for bindless after all. Fixes: 365d34540f33 ("mesa: correctly calculate the storage offset for i915") Reviewed-by: Marek Olšák <[email protected]>
Diffstat (limited to 'src/mesa/program/ir_to_mesa.cpp')
-rw-r--r--src/mesa/program/ir_to_mesa.cpp18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp
index 87999ea3178..0e6a95ce990 100644
--- a/src/mesa/program/ir_to_mesa.cpp
+++ b/src/mesa/program/ir_to_mesa.cpp
@@ -499,7 +499,7 @@ ir_to_mesa_visitor::src_reg_for_float(float val)
}
static int
-type_size(const struct glsl_type *type)
+storage_type_size(const struct glsl_type *type, bool bindless)
{
unsigned int i;
int size;
@@ -541,16 +541,18 @@ type_size(const struct glsl_type *type)
return 1;
case GLSL_TYPE_ARRAY:
assert(type->length > 0);
- return type_size(type->fields.array) * type->length;
+ return storage_type_size(type->fields.array, bindless) * type->length;
case GLSL_TYPE_STRUCT:
size = 0;
for (i = 0; i < type->length; i++) {
- size += type_size(type->fields.structure[i].type);
+ size += storage_type_size(type->fields.structure[i].type, bindless);
}
return size;
case GLSL_TYPE_SAMPLER:
case GLSL_TYPE_IMAGE:
- return 0;
+ if (!bindless)
+ return 0;
+ /* fall through */
case GLSL_TYPE_SUBROUTINE:
return 1;
case GLSL_TYPE_ATOMIC_UINT:
@@ -565,6 +567,12 @@ type_size(const struct glsl_type *type)
return 0;
}
+static int
+type_size(const struct glsl_type *type)
+{
+ return storage_type_size(type, false);
+}
+
/**
* In the initial pass of codegen, we assign temporary numbers to
* intermediate results. (not SSA -- variable assignments will reuse
@@ -2452,7 +2460,7 @@ add_uniform_to_shader::visit_field(const glsl_type *type, const char *name,
assert(_mesa_lookup_parameter_index(params, name) < 0);
- unsigned size = type_size(type) * 4;
+ unsigned size = storage_type_size(type, var->data.bindless) * 4;
int index = _mesa_add_parameter(params, PROGRAM_UNIFORM, name, size,
type->gl_type, NULL, NULL);