[Mesa-dev] [PATCH] glsl: introduce data section to gl_uniform_storage
Tapani Pälli
tapani.palli at intel.com
Thu Jan 2 23:33:24 PST 2014
Data section helps serialization of gl_uniform_storage which is required
for binary shader cache implementation, no functional changes.
Signed-off-by: Tapani Pälli <tapani.palli at intel.com>
---
src/glsl/ir_uniform.h | 132 +++++++++++++------------
src/glsl/link_atomics.cpp | 6 +-
src/glsl/link_uniform_initializers.cpp | 23 ++---
src/glsl/link_uniforms.cpp | 50 +++++-----
src/mesa/drivers/dri/i965/brw_fs.cpp | 4 +-
src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp | 2 +-
src/mesa/main/shaderapi.c | 2 +-
src/mesa/main/uniform_query.cpp | 42 ++++----
src/mesa/main/uniforms.c | 6 +-
src/mesa/program/ir_to_mesa.cpp | 6 +-
src/mesa/program/sampler.cpp | 4 +-
src/mesa/state_tracker/st_draw.c | 2 +-
12 files changed, 142 insertions(+), 137 deletions(-)
diff --git a/src/glsl/ir_uniform.h b/src/glsl/ir_uniform.h
index 13faab7..fda7552 100644
--- a/src/glsl/ir_uniform.h
+++ b/src/glsl/ir_uniform.h
@@ -86,37 +86,81 @@ struct gl_uniform_storage {
*/
const struct glsl_type *type;
- /**
- * The number of elements in this uniform.
- *
- * For non-arrays, this is always 0. For arrays, the value is the size of
- * the array.
- */
- unsigned array_elements;
+ struct uniform_storage_data {
+ /**
+ * The number of elements in this uniform.
+ *
+ * For non-arrays, this is always 0. For arrays, the value is the size of
+ * the array.
+ */
+ unsigned array_elements;
- /**
- * Has this uniform ever been set?
- */
- bool initialized;
+ /**
+ * Has this uniform ever been set?
+ */
+ bool initialized;
+
+ struct {
+ /**
+ * Base sampler index
+ *
+ * If \c ::base_type is \c GLSL_TYPE_SAMPLER, this represents the index
+ * of this sampler. If \c ::array_elements is not zero, the array will
+ * use sampler indices \c ::sampler through \c ::sampler +
+ * \c ::array_elements - 1, inclusive.
+ *
+ * Note that the index may be different in each shader stage.
+ */
+ uint8_t index;
+
+ /**
+ * Whether this sampler is used in this shader stage.
+ */
+ bool active;
+ } sampler[MESA_SHADER_TYPES];
+
+ /** Fields for GL_ARB_uniform_buffer_object
+ * @{
+ */
- struct {
/**
- * Base sampler index
- *
- * If \c ::base_type is \c GLSL_TYPE_SAMPLER, this represents the index
- * of this sampler. If \c ::array_elements is not zero, the array will
- * use sampler indices \c ::sampler through \c ::sampler +
- * \c ::array_elements - 1, inclusive.
- *
- * Note that the index may be different in each shader stage.
+ * GL_UNIFORM_BLOCK_INDEX: index of the uniform block containing
+ * the uniform, or -1 for the default uniform block. Note that the
+ * index is into the linked program's UniformBlocks[] array, not
+ * the linked shader's.
+ */
+ int block_index;
+
+ /** GL_UNIFORM_OFFSET: byte offset within the uniform block, or -1. */
+ int offset;
+
+ /**
+ * GL_UNIFORM_MATRIX_STRIDE: byte stride between columns or rows of
+ * a matrix. Set to 0 for non-matrices in UBOs, or -1 for uniforms
+ * in the default uniform block.
*/
- uint8_t index;
+ int matrix_stride;
/**
- * Whether this sampler is used in this shader stage.
+ * GL_UNIFORM_ARRAY_STRIDE: byte stride between elements of the
+ * array. Set to zero for non-arrays in UBOs, or -1 for uniforms
+ * in the default uniform block.
*/
- bool active;
- } sampler[MESA_SHADER_TYPES];
+ int array_stride;
+
+ /** GL_UNIFORM_ROW_MAJOR: true iff it's a row-major matrix in a UBO */
+ bool row_major;
+
+ /** @} */
+
+ /**
+ * Index within gl_shader_program::AtomicBuffers[] of the atomic
+ * counter buffer this uniform is stored in, or -1 if this is not
+ * an atomic counter.
+ */
+ int atomic_buffer_index;
+
+ } data;
/**
* Storage used by the driver for the uniform
@@ -133,46 +177,6 @@ struct gl_uniform_storage {
*/
union gl_constant_value *storage;
- /** Fields for GL_ARB_uniform_buffer_object
- * @{
- */
-
- /**
- * GL_UNIFORM_BLOCK_INDEX: index of the uniform block containing
- * the uniform, or -1 for the default uniform block. Note that the
- * index is into the linked program's UniformBlocks[] array, not
- * the linked shader's.
- */
- int block_index;
-
- /** GL_UNIFORM_OFFSET: byte offset within the uniform block, or -1. */
- int offset;
-
- /**
- * GL_UNIFORM_MATRIX_STRIDE: byte stride between columns or rows of
- * a matrix. Set to 0 for non-matrices in UBOs, or -1 for uniforms
- * in the default uniform block.
- */
- int matrix_stride;
-
- /**
- * GL_UNIFORM_ARRAY_STRIDE: byte stride between elements of the
- * array. Set to zero for non-arrays in UBOs, or -1 for uniforms
- * in the default uniform block.
- */
- int array_stride;
-
- /** GL_UNIFORM_ROW_MAJOR: true iff it's a row-major matrix in a UBO */
- bool row_major;
-
- /** @} */
-
- /**
- * Index within gl_shader_program::AtomicBuffers[] of the atomic
- * counter buffer this uniform is stored in, or -1 if this is not
- * an atomic counter.
- */
- int atomic_buffer_index;
};
#ifdef __cplusplus
diff --git a/src/glsl/link_atomics.cpp b/src/glsl/link_atomics.cpp
index 603329c..b5453be 100644
--- a/src/glsl/link_atomics.cpp
+++ b/src/glsl/link_atomics.cpp
@@ -192,9 +192,9 @@ link_assign_atomic_counter_resources(struct gl_context *ctx,
mab.Uniforms[j] = id;
var->data.atomic.buffer_index = i;
- storage->atomic_buffer_index = i;
- storage->offset = var->data.atomic.offset;
- storage->array_stride = (var->type->is_array() ?
+ storage->data.atomic_buffer_index = i;
+ storage->data.offset = var->data.atomic.offset;
+ storage->data.array_stride = (var->type->is_array() ?
var->type->element_type()->atomic_size() : 0);
}
diff --git a/src/glsl/link_uniform_initializers.cpp b/src/glsl/link_uniform_initializers.cpp
index 04daa17..726c3bf 100644
--- a/src/glsl/link_uniform_initializers.cpp
+++ b/src/glsl/link_uniform_initializers.cpp
@@ -95,7 +95,7 @@ set_uniform_binding(void *mem_ctx, gl_shader_program *prog,
}
if (storage->type->is_sampler()) {
- unsigned elements = MAX2(storage->array_elements, 1);
+ unsigned elements = MAX2(storage->data.array_elements, 1);
/* From section 4.4.4 of the GLSL 4.20 specification:
* "If the binding identifier is used with an array, the first element
@@ -109,18 +109,19 @@ set_uniform_binding(void *mem_ctx, gl_shader_program *prog,
for (int sh = 0; sh < MESA_SHADER_TYPES; sh++) {
gl_shader *shader = prog->_LinkedShaders[sh];
- if (shader && storage->sampler[sh].active) {
+ if (shader && storage->data.sampler[sh].active) {
for (unsigned i = 0; i < elements; i++) {
- unsigned index = storage->sampler[sh].index + i;
+ unsigned index = storage->data.sampler[sh].index + i;
shader->SamplerUnits[index] = storage->storage[i].i;
}
}
}
- } else if (storage->block_index != -1) {
+ } else if (storage->data.block_index != -1) {
/* This is a field of a UBO. val is the binding index. */
for (int i = 0; i < MESA_SHADER_TYPES; i++) {
- int stage_index = prog->UniformBlockStageIndex[i][storage->block_index];
+ int stage_index =
+ prog->UniformBlockStageIndex[i][storage->data.block_index];
if (stage_index != -1) {
struct gl_shader *sh = prog->_LinkedShaders[i];
@@ -129,7 +130,7 @@ set_uniform_binding(void *mem_ctx, gl_shader_program *prog,
}
}
- storage->initialized = true;
+ storage->data.initialized = true;
}
void
@@ -178,8 +179,8 @@ set_uniform_initializer(void *mem_ctx, gl_shader_program *prog,
const unsigned int elements = val->array_elements[0]->type->components();
unsigned int idx = 0;
- assert(val->type->length >= storage->array_elements);
- for (unsigned int i = 0; i < storage->array_elements; i++) {
+ assert(val->type->length >= storage->data.array_elements);
+ for (unsigned int i = 0; i < storage->data.array_elements; i++) {
copy_constant_to_storage(& storage->storage[idx],
val->array_elements[i],
base_type,
@@ -197,8 +198,8 @@ set_uniform_initializer(void *mem_ctx, gl_shader_program *prog,
for (int sh = 0; sh < MESA_SHADER_TYPES; sh++) {
gl_shader *shader = prog->_LinkedShaders[sh];
- if (shader && storage->sampler[sh].active) {
- unsigned index = storage->sampler[sh].index;
+ if (shader && storage->data.sampler[sh].active) {
+ unsigned index = storage->data.sampler[sh].index;
shader->SamplerUnits[index] = storage->storage[0].i;
}
@@ -206,7 +207,7 @@ set_uniform_initializer(void *mem_ctx, gl_shader_program *prog,
}
}
- storage->initialized = true;
+ storage->data.initialized = true;
}
}
diff --git a/src/glsl/link_uniforms.cpp b/src/glsl/link_uniforms.cpp
index bda6e4f..bf6743f 100644
--- a/src/glsl/link_uniforms.cpp
+++ b/src/glsl/link_uniforms.cpp
@@ -436,18 +436,18 @@ private:
struct gl_uniform_storage *uniform)
{
if (base_type->is_sampler()) {
- uniform->sampler[shader_type].index = this->next_sampler;
- uniform->sampler[shader_type].active = true;
+ uniform->data.sampler[shader_type].index = this->next_sampler;
+ uniform->data.sampler[shader_type].active = true;
/* Increment the sampler by 1 for non-arrays and by the number of
* array elements for arrays.
*/
this->next_sampler +=
- MAX2(1, uniform->array_elements);
+ MAX2(1, uniform->data.array_elements);
const gl_texture_index target = base_type->sampler_index();
const unsigned shadow = base_type->sampler_shadow;
- for (unsigned i = uniform->sampler[shader_type].index;
+ for (unsigned i = uniform->data.sampler[shader_type].index;
i < MIN2(this->next_sampler, MAX_SAMPLERS);
i++) {
this->targets[i] = target;
@@ -455,8 +455,8 @@ private:
this->shader_shadow_samplers |= shadow << i;
}
} else {
- uniform->sampler[shader_type].index = ~0;
- uniform->sampler[shader_type].active = false;
+ uniform->data.sampler[shader_type].index = ~0;
+ uniform->data.sampler[shader_type].active = false;
}
}
@@ -488,10 +488,10 @@ private:
const glsl_type *base_type;
if (type->is_array()) {
- this->uniforms[id].array_elements = type->length;
+ this->uniforms[id].data.array_elements = type->length;
base_type = type->fields.array;
} else {
- this->uniforms[id].array_elements = 0;
+ this->uniforms[id].data.array_elements = 0;
base_type = type;
}
@@ -509,42 +509,42 @@ private:
this->uniforms[id].name = ralloc_strdup(this->uniforms, name);
this->uniforms[id].type = base_type;
- this->uniforms[id].initialized = 0;
+ this->uniforms[id].data.initialized = 0;
this->uniforms[id].num_driver_storage = 0;
this->uniforms[id].driver_storage = NULL;
this->uniforms[id].storage = this->values;
- this->uniforms[id].atomic_buffer_index = -1;
+ this->uniforms[id].data.atomic_buffer_index = -1;
if (this->ubo_block_index != -1) {
- this->uniforms[id].block_index = this->ubo_block_index;
+ this->uniforms[id].data.block_index = this->ubo_block_index;
const unsigned alignment = record_type
? record_type->std140_base_alignment(ubo_row_major)
: type->std140_base_alignment(ubo_row_major);
this->ubo_byte_offset = glsl_align(this->ubo_byte_offset, alignment);
- this->uniforms[id].offset = this->ubo_byte_offset;
+ this->uniforms[id].data.offset = this->ubo_byte_offset;
this->ubo_byte_offset += type->std140_size(ubo_row_major);
if (type->is_array()) {
- this->uniforms[id].array_stride =
+ this->uniforms[id].data.array_stride =
glsl_align(type->fields.array->std140_size(ubo_row_major), 16);
} else {
- this->uniforms[id].array_stride = 0;
+ this->uniforms[id].data.array_stride = 0;
}
if (type->is_matrix() ||
(type->is_array() && type->fields.array->is_matrix())) {
- this->uniforms[id].matrix_stride = 16;
- this->uniforms[id].row_major = ubo_row_major;
+ this->uniforms[id].data.matrix_stride = 16;
+ this->uniforms[id].data.row_major = ubo_row_major;
} else {
- this->uniforms[id].matrix_stride = 0;
- this->uniforms[id].row_major = false;
+ this->uniforms[id].data.matrix_stride = 0;
+ this->uniforms[id].data.row_major = false;
}
} else {
- this->uniforms[id].block_index = -1;
- this->uniforms[id].offset = -1;
- this->uniforms[id].array_stride = -1;
- this->uniforms[id].matrix_stride = -1;
- this->uniforms[id].row_major = false;
+ this->uniforms[id].data.block_index = -1;
+ this->uniforms[id].data.offset = -1;
+ this->uniforms[id].data.array_stride = -1;
+ this->uniforms[id].data.matrix_stride = -1;
+ this->uniforms[id].data.row_major = false;
}
this->values += values_for_type(type);
@@ -845,8 +845,8 @@ link_assign_uniform_locations(struct gl_shader_program *prog)
*/
unsigned max_array_size = 1;
for (unsigned i = 0; i < num_user_uniforms; i++) {
- if (uniforms[i].array_elements > max_array_size)
- max_array_size = uniforms[i].array_elements;
+ if (uniforms[i].data.array_elements > max_array_size)
+ max_array_size = uniforms[i].data.array_elements;
}
prog->UniformLocationBaseScale = max_array_size;
diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp
index baf9220..3382cf0 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
@@ -897,8 +897,8 @@ fs_visitor::setup_uniform_values(ir_variable *ir)
}
unsigned slots = storage->type->component_slots();
- if (storage->array_elements)
- slots *= storage->array_elements;
+ if (storage->data.array_elements)
+ slots *= storage->data.array_elements;
for (unsigned i = 0; i < slots; i++) {
c->prog_data.param[c->prog_data.nr_params++] =
diff --git a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
index 3b8cef6..866e9c6 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
@@ -658,7 +658,7 @@ vec4_visitor::setup_uniform_values(ir_variable *ir)
}
gl_constant_value *components = storage->storage;
- unsigned vector_count = (MAX2(storage->array_elements, 1) *
+ unsigned vector_count = (MAX2(storage->data.array_elements, 1) *
storage->type->matrix_columns);
for (unsigned s = 0; s < vector_count; s++) {
diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c
index 57511e8..b779a80 100644
--- a/src/mesa/main/shaderapi.c
+++ b/src/mesa/main/shaderapi.c
@@ -553,7 +553,7 @@ get_programiv(struct gl_context *ctx, GLuint program, GLenum pname, GLint *param
* 4 for the "[0]" and the NUL for an array.
*/
const GLint len = strlen(shProg->UniformStorage[i].name) + 1 +
- ((shProg->UniformStorage[i].array_elements != 0) ? 3 : 0);
+ ((shProg->UniformStorage[i].data.array_elements != 0) ? 3 : 0);
if (len > max_len)
max_len = len;
diff --git a/src/mesa/main/uniform_query.cpp b/src/mesa/main/uniform_query.cpp
index 61bcbcb..4d7c165 100644
--- a/src/mesa/main/uniform_query.cpp
+++ b/src/mesa/main/uniform_query.cpp
@@ -66,7 +66,7 @@ _mesa_GetActiveUniform(GLhandleARB program, GLuint index,
/* array_elements is zero for non-arrays, but the API requires that 1 be
* returned.
*/
- *size = MAX2(1, uni->array_elements);
+ *size = MAX2(1, uni->data.array_elements);
}
if (type) {
@@ -117,7 +117,7 @@ _mesa_GetActiveUniformsiv(GLuint program,
/* array_elements is zero for non-arrays, but the API requires that 1 be
* returned.
*/
- params[i] = MAX2(1, uni->array_elements);
+ params[i] = MAX2(1, uni->data.array_elements);
break;
case GL_UNIFORM_NAME_LENGTH:
@@ -130,34 +130,34 @@ _mesa_GetActiveUniformsiv(GLuint program,
* in name will always be the name of the uniform array appended
* with "[0]"."
*/
- if (uni->array_elements != 0)
+ if (uni->data.array_elements != 0)
params[i] += 3;
break;
case GL_UNIFORM_BLOCK_INDEX:
- params[i] = uni->block_index;
+ params[i] = uni->data.block_index;
break;
case GL_UNIFORM_OFFSET:
- params[i] = uni->offset;
+ params[i] = uni->data.offset;
break;
case GL_UNIFORM_ARRAY_STRIDE:
- params[i] = uni->array_stride;
+ params[i] = uni->data.array_stride;
break;
case GL_UNIFORM_MATRIX_STRIDE:
- params[i] = uni->matrix_stride;
+ params[i] = uni->data.matrix_stride;
break;
case GL_UNIFORM_IS_ROW_MAJOR:
- params[i] = uni->row_major;
+ params[i] = uni->data.row_major;
break;
case GL_UNIFORM_ATOMIC_COUNTER_BUFFER_INDEX:
if (!ctx->Extensions.ARB_shader_atomic_counters)
goto invalid_enum;
- params[i] = uni->atomic_buffer_index;
+ params[i] = uni->data.atomic_buffer_index;
break;
default:
@@ -254,7 +254,7 @@ validate_uniform_parameters(struct gl_context *ctx,
return false;
}
- if (shProg->UniformStorage[*loc].array_elements == 0 && count > 1) {
+ if (shProg->UniformStorage[*loc].data.array_elements == 0 && count > 1) {
_mesa_error(ctx, GL_INVALID_OPERATION,
"%s(count > 1 for non-array, location=%d)",
caller, location);
@@ -265,7 +265,7 @@ validate_uniform_parameters(struct gl_context *ctx,
* If not an array, check that array_index is zero.
* array_index is unsigned so no need to check for less than zero.
*/
- unsigned limit = shProg->UniformStorage[*loc].array_elements;
+ unsigned limit = shProg->UniformStorage[*loc].data.array_elements;
if (limit == 0)
limit = 1;
if (*array_index >= limit) {
@@ -746,8 +746,8 @@ _mesa_uniform(struct gl_context *ctx, struct gl_shader_program *shProg,
* Clamp 'count' to a valid value. Note that for non-arrays a count > 1
* will have already generated an error.
*/
- if (uni->array_elements != 0) {
- count = MIN2(count, (int) (uni->array_elements - offset));
+ if (uni->data.array_elements != 0) {
+ count = MIN2(count, (int) (uni->data.array_elements - offset));
}
FLUSH_VERTICES(ctx, _NEW_PROGRAM_CONSTANTS);
@@ -773,7 +773,7 @@ _mesa_uniform(struct gl_context *ctx, struct gl_shader_program *shProg,
}
}
- uni->initialized = true;
+ uni->data.initialized = true;
_mesa_propagate_uniforms_to_driver_storage(uni, offset, count);
@@ -790,11 +790,11 @@ _mesa_uniform(struct gl_context *ctx, struct gl_shader_program *shProg,
/* If the shader stage doesn't use the sampler uniform, skip this.
*/
- if (sh == NULL || !uni->sampler[i].active)
+ if (sh == NULL || !uni->data.sampler[i].active)
continue;
for (j = 0; j < count; j++) {
- sh->SamplerUnits[uni->sampler[i].index + offset + j] =
+ sh->SamplerUnits[uni->data.sampler[i].index + offset + j] =
((unsigned *) values)[j];
}
@@ -899,8 +899,8 @@ _mesa_uniform_matrix(struct gl_context *ctx, struct gl_shader_program *shProg,
* Clamp 'count' to a valid value. Note that for non-arrays a count > 1
* will have already generated an error.
*/
- if (uni->array_elements != 0) {
- count = MIN2(count, (int) (uni->array_elements - offset));
+ if (uni->data.array_elements != 0) {
+ count = MIN2(count, (int) (uni->data.array_elements - offset));
}
FLUSH_VERTICES(ctx, _NEW_PROGRAM_CONSTANTS);
@@ -930,7 +930,7 @@ _mesa_uniform_matrix(struct gl_context *ctx, struct gl_shader_program *shProg,
}
}
- uni->initialized = true;
+ uni->data.initialized = true;
_mesa_propagate_uniforms_to_driver_storage(uni, offset, count);
}
@@ -1001,8 +1001,8 @@ _mesa_get_uniform_location(struct gl_context *ctx,
* is not an array, but the user is trying to index it, because
* array_elements is zero and offset >= 0.
*/
- if (array_lookup
- && offset >= (long) shProg->UniformStorage[location].array_elements) {
+ if (array_lookup && offset >=
+ (long) shProg->UniformStorage[location].data.array_elements) {
return GL_INVALID_INDEX;
}
diff --git a/src/mesa/main/uniforms.c b/src/mesa/main/uniforms.c
index 17e24f6..1c5667c 100644
--- a/src/mesa/main/uniforms.c
+++ b/src/mesa/main/uniforms.c
@@ -535,8 +535,8 @@ _mesa_GetUniformLocation(GLhandleARB programObj, const GLcharARB *name)
* with a named uniform block, or if <name> starts with the reserved
* prefix "gl_"."
*/
- if (shProg->UniformStorage[index].block_index != -1 ||
- shProg->UniformStorage[index].atomic_buffer_index != -1)
+ if (shProg->UniformStorage[index].data.block_index != -1 ||
+ shProg->UniformStorage[index].data.atomic_buffer_index != -1)
return -1;
return _mesa_uniform_merge_location_offset(shProg, index, offset);
@@ -832,7 +832,7 @@ _mesa_get_uniform_name(const struct gl_uniform_storage *uni,
* to glGetUniformLocation (and related APIs), so there shouldn't be any
* harm in always appending "[0]" to uniform array names.
*/
- if (uni->array_elements != 0) {
+ if (uni->data.array_elements != 0) {
int i;
/* The comparison is strange because *length does *NOT* include the
diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp
index beb0c09..8072f55 100644
--- a/src/mesa/program/ir_to_mesa.cpp
+++ b/src/mesa/program/ir_to_mesa.cpp
@@ -2463,11 +2463,11 @@ add_uniform_to_shader::visit_field(const glsl_type *type, const char *name,
struct gl_uniform_storage *storage =
&this->shader_program->UniformStorage[location];
- assert(storage->sampler[shader_type].active);
+ assert(storage->data.sampler[shader_type].active);
for (unsigned int j = 0; j < size / 4; j++)
params->ParameterValues[index + j][0].f =
- storage->sampler[shader_type].index + j;
+ storage->data.sampler[shader_type].index + j;
}
}
@@ -2585,7 +2585,7 @@ _mesa_associate_uniform_storage(struct gl_context *ctx,
*/
_mesa_propagate_uniforms_to_driver_storage(storage,
0,
- MAX2(1, storage->array_elements));
+ MAX2(1, storage->data.array_elements));
last_location = location;
}
diff --git a/src/mesa/program/sampler.cpp b/src/mesa/program/sampler.cpp
index 9b94127..5976b3a 100644
--- a/src/mesa/program/sampler.cpp
+++ b/src/mesa/program/sampler.cpp
@@ -122,7 +122,7 @@ _mesa_get_sampler_uniform_value(class ir_dereference *sampler,
return 0;
}
- if (!shader_program->UniformStorage[location].sampler[shader].active) {
+ if (!shader_program->UniformStorage[location].data.sampler[shader].active) {
assert(0 && "cannot return a sampler");
linker_error(shader_program,
"cannot return a sampler named %s, because it is not "
@@ -131,6 +131,6 @@ _mesa_get_sampler_uniform_value(class ir_dereference *sampler,
return 0;
}
- return shader_program->UniformStorage[location].sampler[shader].index +
+ return shader_program->UniformStorage[location].data.sampler[shader].index +
getname.offset;
}
diff --git a/src/mesa/state_tracker/st_draw.c b/src/mesa/state_tracker/st_draw.c
index ef0a607..34f1bf5 100644
--- a/src/mesa/state_tracker/st_draw.c
+++ b/src/mesa/state_tracker/st_draw.c
@@ -146,7 +146,7 @@ check_uniforms(struct gl_context *ctx)
for (i = 0; i < shProg[j]->NumUserUniformStorage; i++) {
const struct gl_uniform_storage *u = &shProg[j]->UniformStorage[i];
- if (!u->initialized) {
+ if (!u->data.initialized) {
_mesa_warning(ctx,
"Using shader with uninitialized uniform: %s",
u->name);
--
1.8.3.1
More information about the mesa-dev
mailing list