storage->storage[i].i;
}
}
- } else if (glsl_type_is_image(type)) {
+ } else if (glsl_type_is_image(storage->type)) {
for (unsigned i = 0; i < elements; i++) {
const unsigned index = storage->opaque[sh].index + i;
const enum glsl_base_type base_type = glsl_get_base_type(type);
const unsigned n_columns = glsl_get_matrix_columns(type);
const unsigned n_rows = glsl_get_vector_elements(type);
+ unsigned dmul = glsl_base_type_is_64bit(base_type) ? 2 : 1;
int i = 0;
- for (unsigned int column = 0; column < n_columns; column++) {
+ if (n_columns > 1) {
+ const struct glsl_type *column_type = glsl_get_column_type(type);
+ for (unsigned int column = 0; column < n_columns; column++) {
+ copy_constant_to_storage(&storage[i], val->elements[column],
+ column_type, boolean_true);
+ i += n_rows * dmul;
+ }
+ } else {
for (unsigned int row = 0; row < n_rows; row++) {
switch (base_type) {
case GLSL_TYPE_UINT:
- storage[i].u = val->values[column].u32[row];
+ storage[i].u = val->values[row].u32;
break;
case GLSL_TYPE_INT:
case GLSL_TYPE_SAMPLER:
- storage[i].i = val->values[column].i32[row];
+ storage[i].i = val->values[row].i32;
break;
case GLSL_TYPE_FLOAT:
- storage[i].f = val->values[column].f32[row];
+ storage[i].f = val->values[row].f32;
break;
case GLSL_TYPE_DOUBLE:
case GLSL_TYPE_UINT64:
case GLSL_TYPE_INT64:
/* XXX need to check on big-endian */
- memcpy(&storage[i * 2].u,
- &val->values[column].f64[row],
- sizeof(double));
+ memcpy(&storage[i].u, &val->values[row].f64, sizeof(double));
break;
case GLSL_TYPE_BOOL:
- storage[i].b = val->values[column].u32[row] ? boolean_true : 0;
+ storage[i].b = val->values[row].u32 ? boolean_true : 0;
break;
case GLSL_TYPE_ARRAY:
case GLSL_TYPE_STRUCT:
assert(!"Should not get here.");
break;
}
- i++;
+ i += dmul;
}
}
}
nir_shader *nir = sh->Program->nir;
assert(nir);
- nir_foreach_variable(var, &nir->uniforms) {
+ nir_foreach_gl_uniform_variable(var, nir) {
if (var->constant_initializer) {
struct set_uniform_initializer_closure data = {
.shader_prog = prog,
var->type,
var->constant_initializer);
} else if (var->data.explicit_binding) {
+
+ if (nir_variable_is_in_block(var)) {
+ /* This case is handled by link_uniform_blocks */
+ continue;
+ }
+
const struct glsl_type *without_array =
glsl_without_array(var->type);
}
}
}
+ memcpy(prog->data->UniformDataDefaults, prog->data->UniformDataSlots,
+ sizeof(union gl_constant_value) * prog->data->NumUniformDataSlots);
+
}