glsl: rename is_record() -> is_struct()
Replace was done using: find ./src -type f -exec sed -i -- \ 's/is_record(/is_struct(/g' {} \; Acked-by: Karol Herbst <kherbst@redhat.com> Acked-by: Jason Ekstrand <jason@jlekstrand.net> Acked-by: Kenneth Graunke <kenneth@whitecape.org>
This commit is contained in:
@@ -2118,7 +2118,7 @@ ast_function_expression::hir(exec_list *instructions,
|
|||||||
* must have the exact number of arguments with matching types in the
|
* must have the exact number of arguments with matching types in the
|
||||||
* correct order.
|
* correct order.
|
||||||
*/
|
*/
|
||||||
if (constructor_type->is_record()) {
|
if (constructor_type->is_struct()) {
|
||||||
return process_record_constructor(instructions, constructor_type,
|
return process_record_constructor(instructions, constructor_type,
|
||||||
&loc, &this->expressions,
|
&loc, &this->expressions,
|
||||||
state);
|
state);
|
||||||
@@ -2458,7 +2458,7 @@ ast_aggregate_initializer::hir(exec_list *instructions,
|
|||||||
&this->expressions, state);
|
&this->expressions, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (constructor_type->is_record()) {
|
if (constructor_type->is_struct()) {
|
||||||
return process_record_constructor(instructions, constructor_type, &loc,
|
return process_record_constructor(instructions, constructor_type, &loc,
|
||||||
&this->expressions, state);
|
&this->expressions, state);
|
||||||
}
|
}
|
||||||
|
@@ -2389,7 +2389,7 @@ precision_qualifier_allowed(const glsl_type *type)
|
|||||||
const glsl_type *const t = type->without_array();
|
const glsl_type *const t = type->without_array();
|
||||||
|
|
||||||
return (t->is_float() || t->is_integer() || t->contains_opaque()) &&
|
return (t->is_float() || t->is_integer() || t->contains_opaque()) &&
|
||||||
!t->is_record();
|
!t->is_struct();
|
||||||
}
|
}
|
||||||
|
|
||||||
const glsl_type *
|
const glsl_type *
|
||||||
@@ -2807,7 +2807,7 @@ validate_xfb_offset_qualifier(YYLTYPE *loc,
|
|||||||
/* Make sure nested structs don't contain unsized arrays, and validate
|
/* Make sure nested structs don't contain unsized arrays, and validate
|
||||||
* any xfb_offsets on interface members.
|
* any xfb_offsets on interface members.
|
||||||
*/
|
*/
|
||||||
if (t_without_array->is_record() || t_without_array->is_interface())
|
if (t_without_array->is_struct() || t_without_array->is_interface())
|
||||||
for (unsigned int i = 0; i < t_without_array->length; i++) {
|
for (unsigned int i = 0; i < t_without_array->length; i++) {
|
||||||
const glsl_type *member_t = t_without_array->fields.structure[i].type;
|
const glsl_type *member_t = t_without_array->fields.structure[i].type;
|
||||||
|
|
||||||
@@ -3691,7 +3691,7 @@ apply_layout_qualifier_to_variable(const struct ast_type_qualifier *qual,
|
|||||||
const glsl_type *type = var->type->without_array();
|
const glsl_type *type = var->type->without_array();
|
||||||
unsigned components = type->component_slots();
|
unsigned components = type->component_slots();
|
||||||
|
|
||||||
if (type->is_matrix() || type->is_record()) {
|
if (type->is_matrix() || type->is_struct()) {
|
||||||
_mesa_glsl_error(loc, state, "component layout qualifier "
|
_mesa_glsl_error(loc, state, "component layout qualifier "
|
||||||
"cannot be applied to a matrix, a structure, "
|
"cannot be applied to a matrix, a structure, "
|
||||||
"a block, or an array containing any of "
|
"a block, or an array containing any of "
|
||||||
@@ -5302,15 +5302,15 @@ ast_declarator_list::hir(exec_list *instructions,
|
|||||||
_mesa_shader_stage_to_string(state->stage));
|
_mesa_shader_stage_to_string(state->stage));
|
||||||
}
|
}
|
||||||
if (var->type->is_array() &&
|
if (var->type->is_array() &&
|
||||||
var->type->fields.array->is_record()) {
|
var->type->fields.array->is_struct()) {
|
||||||
_mesa_glsl_error(&loc, state,
|
_mesa_glsl_error(&loc, state,
|
||||||
"fragment shader input "
|
"fragment shader input "
|
||||||
"cannot have an array of structs");
|
"cannot have an array of structs");
|
||||||
}
|
}
|
||||||
if (var->type->is_record()) {
|
if (var->type->is_struct()) {
|
||||||
for (unsigned i = 0; i < var->type->length; i++) {
|
for (unsigned i = 0; i < var->type->length; i++) {
|
||||||
if (var->type->fields.structure[i].type->is_array() ||
|
if (var->type->fields.structure[i].type->is_array() ||
|
||||||
var->type->fields.structure[i].type->is_record())
|
var->type->fields.structure[i].type->is_struct())
|
||||||
_mesa_glsl_error(&loc, state,
|
_mesa_glsl_error(&loc, state,
|
||||||
"fragment shader input cannot have "
|
"fragment shader input cannot have "
|
||||||
"a struct that contains an "
|
"a struct that contains an "
|
||||||
@@ -5337,7 +5337,7 @@ ast_declarator_list::hir(exec_list *instructions,
|
|||||||
* * A structure
|
* * A structure
|
||||||
*/
|
*/
|
||||||
if (state->stage == MESA_SHADER_FRAGMENT) {
|
if (state->stage == MESA_SHADER_FRAGMENT) {
|
||||||
if (check_type->is_record() || check_type->is_matrix())
|
if (check_type->is_struct() || check_type->is_matrix())
|
||||||
_mesa_glsl_error(&loc, state,
|
_mesa_glsl_error(&loc, state,
|
||||||
"fragment shader output "
|
"fragment shader output "
|
||||||
"cannot have struct or matrix type");
|
"cannot have struct or matrix type");
|
||||||
@@ -5408,16 +5408,16 @@ ast_declarator_list::hir(exec_list *instructions,
|
|||||||
type = var->type->fields.array;
|
type = var->type->fields.array;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type->is_array() && type->fields.array->is_record()) {
|
if (type->is_array() && type->fields.array->is_struct()) {
|
||||||
_mesa_glsl_error(&loc, state,
|
_mesa_glsl_error(&loc, state,
|
||||||
"%s shader output cannot have "
|
"%s shader output cannot have "
|
||||||
"an array of structs",
|
"an array of structs",
|
||||||
_mesa_shader_stage_to_string(state->stage));
|
_mesa_shader_stage_to_string(state->stage));
|
||||||
}
|
}
|
||||||
if (type->is_record()) {
|
if (type->is_struct()) {
|
||||||
for (unsigned i = 0; i < type->length; i++) {
|
for (unsigned i = 0; i < type->length; i++) {
|
||||||
if (type->fields.structure[i].type->is_array() ||
|
if (type->fields.structure[i].type->is_array() ||
|
||||||
type->fields.structure[i].type->is_record())
|
type->fields.structure[i].type->is_struct())
|
||||||
_mesa_glsl_error(&loc, state,
|
_mesa_glsl_error(&loc, state,
|
||||||
"%s shader output cannot have a "
|
"%s shader output cannot have a "
|
||||||
"struct that contains an "
|
"struct that contains an "
|
||||||
@@ -7468,7 +7468,7 @@ ast_process_struct_or_iface_block_members(exec_list *instructions,
|
|||||||
if (is_interface && layout &&
|
if (is_interface && layout &&
|
||||||
(layout->flags.q.uniform || layout->flags.q.buffer) &&
|
(layout->flags.q.uniform || layout->flags.q.buffer) &&
|
||||||
(field_type->without_array()->is_matrix()
|
(field_type->without_array()->is_matrix()
|
||||||
|| field_type->without_array()->is_record())) {
|
|| field_type->without_array()->is_struct())) {
|
||||||
/* If no layout is specified for the field, inherit the layout
|
/* If no layout is specified for the field, inherit the layout
|
||||||
* from the block.
|
* from the block.
|
||||||
*/
|
*/
|
||||||
|
@@ -940,7 +940,7 @@ _mesa_ast_set_aggregate_type(const glsl_type *type,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* If the aggregate is a struct, recursively set its fields' types. */
|
/* If the aggregate is a struct, recursively set its fields' types. */
|
||||||
} else if (type->is_record()) {
|
} else if (type->is_struct()) {
|
||||||
exec_node *expr_node = ai->expressions.get_head_raw();
|
exec_node *expr_node = ai->expressions.get_head_raw();
|
||||||
|
|
||||||
/* Iterate through the struct's fields. */
|
/* Iterate through the struct's fields. */
|
||||||
|
@@ -46,7 +46,7 @@ _mesa_ast_field_selection_to_hir(const ast_expression *expr,
|
|||||||
YYLTYPE loc = expr->get_location();
|
YYLTYPE loc = expr->get_location();
|
||||||
if (op->type->is_error()) {
|
if (op->type->is_error()) {
|
||||||
/* silently propagate the error */
|
/* silently propagate the error */
|
||||||
} else if (op->type->is_record() || op->type->is_interface()) {
|
} else if (op->type->is_struct() || op->type->is_interface()) {
|
||||||
result = new(ctx) ir_dereference_record(op,
|
result = new(ctx) ir_dereference_record(op,
|
||||||
expr->primary_expression.identifier);
|
expr->primary_expression.identifier);
|
||||||
|
|
||||||
|
@@ -754,14 +754,14 @@ ir_constant::ir_constant(const struct glsl_type *type, exec_list *value_list)
|
|||||||
this->type = type;
|
this->type = type;
|
||||||
|
|
||||||
assert(type->is_scalar() || type->is_vector() || type->is_matrix()
|
assert(type->is_scalar() || type->is_vector() || type->is_matrix()
|
||||||
|| type->is_record() || type->is_array());
|
|| type->is_struct() || type->is_array());
|
||||||
|
|
||||||
/* If the constant is a record, the types of each of the entries in
|
/* If the constant is a record, the types of each of the entries in
|
||||||
* value_list must be a 1-for-1 match with the structure components. Each
|
* value_list must be a 1-for-1 match with the structure components. Each
|
||||||
* entry must also be a constant. Just move the nodes from the value_list
|
* entry must also be a constant. Just move the nodes from the value_list
|
||||||
* to the list in the ir_constant.
|
* to the list in the ir_constant.
|
||||||
*/
|
*/
|
||||||
if (type->is_array() || type->is_record()) {
|
if (type->is_array() || type->is_struct()) {
|
||||||
this->const_elements = ralloc_array(this, ir_constant *, type->length);
|
this->const_elements = ralloc_array(this, ir_constant *, type->length);
|
||||||
unsigned i = 0;
|
unsigned i = 0;
|
||||||
foreach_in_list(ir_constant, value, value_list) {
|
foreach_in_list(ir_constant, value, value_list) {
|
||||||
@@ -909,7 +909,7 @@ ir_constant *
|
|||||||
ir_constant::zero(void *mem_ctx, const glsl_type *type)
|
ir_constant::zero(void *mem_ctx, const glsl_type *type)
|
||||||
{
|
{
|
||||||
assert(type->is_scalar() || type->is_vector() || type->is_matrix()
|
assert(type->is_scalar() || type->is_vector() || type->is_matrix()
|
||||||
|| type->is_record() || type->is_array());
|
|| type->is_struct() || type->is_array());
|
||||||
|
|
||||||
ir_constant *c = new(mem_ctx) ir_constant;
|
ir_constant *c = new(mem_ctx) ir_constant;
|
||||||
c->type = type;
|
c->type = type;
|
||||||
@@ -922,7 +922,7 @@ ir_constant::zero(void *mem_ctx, const glsl_type *type)
|
|||||||
c->const_elements[i] = ir_constant::zero(c, type->fields.array);
|
c->const_elements[i] = ir_constant::zero(c, type->fields.array);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type->is_record()) {
|
if (type->is_struct()) {
|
||||||
c->const_elements = ralloc_array(c, ir_constant *, type->length);
|
c->const_elements = ralloc_array(c, ir_constant *, type->length);
|
||||||
|
|
||||||
for (unsigned i = 0; i < type->length; i++) {
|
for (unsigned i = 0; i < type->length; i++) {
|
||||||
@@ -1114,7 +1114,7 @@ ir_constant::get_array_element(unsigned i) const
|
|||||||
ir_constant *
|
ir_constant *
|
||||||
ir_constant::get_record_field(int idx)
|
ir_constant::get_record_field(int idx)
|
||||||
{
|
{
|
||||||
assert(this->type->is_record());
|
assert(this->type->is_struct());
|
||||||
assert(idx >= 0 && (unsigned) idx < this->type->length);
|
assert(idx >= 0 && (unsigned) idx < this->type->length);
|
||||||
|
|
||||||
return const_elements[idx];
|
return const_elements[idx];
|
||||||
@@ -1185,7 +1185,7 @@ ir_constant::copy_offset(ir_constant *src, int offset)
|
|||||||
void
|
void
|
||||||
ir_constant::copy_masked_offset(ir_constant *src, int offset, unsigned int mask)
|
ir_constant::copy_masked_offset(ir_constant *src, int offset, unsigned int mask)
|
||||||
{
|
{
|
||||||
assert (!type->is_array() && !type->is_record());
|
assert (!type->is_array() && !type->is_struct());
|
||||||
|
|
||||||
if (!type->is_vector() && !type->is_matrix()) {
|
if (!type->is_vector() && !type->is_matrix()) {
|
||||||
offset = 0;
|
offset = 0;
|
||||||
@@ -1233,7 +1233,7 @@ ir_constant::has_value(const ir_constant *c) const
|
|||||||
if (this->type != c->type)
|
if (this->type != c->type)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (this->type->is_array() || this->type->is_record()) {
|
if (this->type->is_array() || this->type->is_struct()) {
|
||||||
for (unsigned i = 0; i < this->type->length; i++) {
|
for (unsigned i = 0; i < this->type->length; i++) {
|
||||||
if (!this->const_elements[i]->has_value(c->const_elements[i]))
|
if (!this->const_elements[i]->has_value(c->const_elements[i]))
|
||||||
return false;
|
return false;
|
||||||
@@ -1944,7 +1944,7 @@ steal_memory(ir_instruction *ir, void *new_ctx)
|
|||||||
* visitor, so steal their values by hand.
|
* visitor, so steal their values by hand.
|
||||||
*/
|
*/
|
||||||
if (constant != NULL &&
|
if (constant != NULL &&
|
||||||
(constant->type->is_array() || constant->type->is_record())) {
|
(constant->type->is_array() || constant->type->is_struct())) {
|
||||||
for (unsigned int i = 0; i < constant->type->length; i++) {
|
for (unsigned int i = 0; i < constant->type->length; i++) {
|
||||||
steal_memory(constant->const_elements[i], ir);
|
steal_memory(constant->const_elements[i], ir);
|
||||||
}
|
}
|
||||||
|
@@ -149,7 +149,7 @@ print_type(FILE *f, const glsl_type *t)
|
|||||||
fprintf(f, "(array ");
|
fprintf(f, "(array ");
|
||||||
print_type(f, t->fields.array);
|
print_type(f, t->fields.array);
|
||||||
fprintf(f, " %u)", t->length);
|
fprintf(f, " %u)", t->length);
|
||||||
} else if (t->is_record() && !is_gl_identifier(t->name)) {
|
} else if (t->is_struct() && !is_gl_identifier(t->name)) {
|
||||||
fprintf(f, "%s@%p", t->name, (void *) t);
|
fprintf(f, "%s@%p", t->name, (void *) t);
|
||||||
} else {
|
} else {
|
||||||
fprintf(f, "%s", t->name);
|
fprintf(f, "%s", t->name);
|
||||||
@@ -469,7 +469,7 @@ void ir_print_visitor::visit(ir_constant *ir)
|
|||||||
if (ir->type->is_array()) {
|
if (ir->type->is_array()) {
|
||||||
for (unsigned i = 0; i < ir->type->length; i++)
|
for (unsigned i = 0; i < ir->type->length; i++)
|
||||||
ir->get_array_element(i)->accept(this);
|
ir->get_array_element(i)->accept(this);
|
||||||
} else if (ir->type->is_record()) {
|
} else if (ir->type->is_struct()) {
|
||||||
for (unsigned i = 0; i < ir->type->length; i++) {
|
for (unsigned i = 0; i < ir->type->length; i++) {
|
||||||
fprintf(f, "(%s ", ir->type->fields.structure[i].name);
|
fprintf(f, "(%s ", ir->type->fields.structure[i].name);
|
||||||
ir->get_record_field(i)->accept(this);
|
ir->get_record_field(i)->accept(this);
|
||||||
|
@@ -68,7 +68,7 @@ private:
|
|||||||
bool row_major,
|
bool row_major,
|
||||||
const enum glsl_interface_packing packing)
|
const enum glsl_interface_packing packing)
|
||||||
{
|
{
|
||||||
assert(type->is_record());
|
assert(type->is_struct());
|
||||||
if (packing == GLSL_INTERFACE_PACKING_STD430)
|
if (packing == GLSL_INTERFACE_PACKING_STD430)
|
||||||
this->offset = glsl_align(
|
this->offset = glsl_align(
|
||||||
this->offset, type->std430_base_alignment(row_major));
|
this->offset, type->std430_base_alignment(row_major));
|
||||||
@@ -81,7 +81,7 @@ private:
|
|||||||
bool row_major,
|
bool row_major,
|
||||||
const enum glsl_interface_packing packing)
|
const enum glsl_interface_packing packing)
|
||||||
{
|
{
|
||||||
assert(type->is_record());
|
assert(type->is_struct());
|
||||||
|
|
||||||
/* If this is the last field of a structure, apply rule #9. The
|
/* If this is the last field of a structure, apply rule #9. The
|
||||||
* ARB_uniform_buffer_object spec says:
|
* ARB_uniform_buffer_object spec says:
|
||||||
|
@@ -190,7 +190,7 @@ set_uniform_initializer(void *mem_ctx, gl_shader_program *prog,
|
|||||||
ir_constant *val, unsigned int boolean_true)
|
ir_constant *val, unsigned int boolean_true)
|
||||||
{
|
{
|
||||||
const glsl_type *t_without_array = type->without_array();
|
const glsl_type *t_without_array = type->without_array();
|
||||||
if (type->is_record()) {
|
if (type->is_struct()) {
|
||||||
for (unsigned int i = 0; i < type->length; i++) {
|
for (unsigned int i = 0; i < type->length; i++) {
|
||||||
const glsl_type *field_type = type->fields.structure[i].type;
|
const glsl_type *field_type = type->fields.structure[i].type;
|
||||||
const char *field_name = ralloc_asprintf(mem_ctx, "%s.%s", name,
|
const char *field_name = ralloc_asprintf(mem_ctx, "%s.%s", name,
|
||||||
@@ -200,7 +200,7 @@ set_uniform_initializer(void *mem_ctx, gl_shader_program *prog,
|
|||||||
boolean_true);
|
boolean_true);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
} else if (t_without_array->is_record() ||
|
} else if (t_without_array->is_struct() ||
|
||||||
(type->is_array() && type->fields.array->is_array())) {
|
(type->is_array() && type->fields.array->is_array())) {
|
||||||
const glsl_type *const element_type = type->fields.array;
|
const glsl_type *const element_type = type->fields.array;
|
||||||
|
|
||||||
|
@@ -46,7 +46,7 @@ void
|
|||||||
program_resource_visitor::process(const glsl_type *type, const char *name,
|
program_resource_visitor::process(const glsl_type *type, const char *name,
|
||||||
bool use_std430_as_default)
|
bool use_std430_as_default)
|
||||||
{
|
{
|
||||||
assert(type->without_array()->is_record()
|
assert(type->without_array()->is_struct()
|
||||||
|| type->without_array()->is_interface());
|
|| type->without_array()->is_interface());
|
||||||
|
|
||||||
unsigned record_array_count = 1;
|
unsigned record_array_count = 1;
|
||||||
@@ -88,7 +88,7 @@ program_resource_visitor::process(ir_variable *var, const glsl_type *var_type,
|
|||||||
* processing functions because no information is available to do
|
* processing functions because no information is available to do
|
||||||
* otherwise. See the warning in linker.h.
|
* otherwise. See the warning in linker.h.
|
||||||
*/
|
*/
|
||||||
if (t_without_array->is_record() ||
|
if (t_without_array->is_struct() ||
|
||||||
(t->is_array() && t->fields.array->is_array())) {
|
(t->is_array() && t->fields.array->is_array())) {
|
||||||
char *name = ralloc_strdup(NULL, var->name);
|
char *name = ralloc_strdup(NULL, var->name);
|
||||||
recursion(var->type, &name, strlen(name), row_major, NULL, packing,
|
recursion(var->type, &name, strlen(name), row_major, NULL, packing,
|
||||||
@@ -129,11 +129,11 @@ program_resource_visitor::recursion(const glsl_type *t, char **name,
|
|||||||
named_ifc_member->name);
|
named_ifc_member->name);
|
||||||
recursion(named_ifc_member->type, name, name_length, row_major, NULL,
|
recursion(named_ifc_member->type, name, name_length, row_major, NULL,
|
||||||
packing, false, record_array_count, NULL);
|
packing, false, record_array_count, NULL);
|
||||||
} else if (t->is_record() || t->is_interface()) {
|
} else if (t->is_struct() || t->is_interface()) {
|
||||||
if (record_type == NULL && t->is_record())
|
if (record_type == NULL && t->is_struct())
|
||||||
record_type = t;
|
record_type = t;
|
||||||
|
|
||||||
if (t->is_record())
|
if (t->is_struct())
|
||||||
this->enter_record(t, *name, row_major, packing);
|
this->enter_record(t, *name, row_major, packing);
|
||||||
|
|
||||||
for (unsigned i = 0; i < t->length; i++) {
|
for (unsigned i = 0; i < t->length; i++) {
|
||||||
@@ -177,14 +177,14 @@ program_resource_visitor::recursion(const glsl_type *t, char **name,
|
|||||||
record_type = NULL;
|
record_type = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (t->is_record()) {
|
if (t->is_struct()) {
|
||||||
(*name)[name_length] = '\0';
|
(*name)[name_length] = '\0';
|
||||||
this->leave_record(t, *name, row_major, packing);
|
this->leave_record(t, *name, row_major, packing);
|
||||||
}
|
}
|
||||||
} else if (t->without_array()->is_record() ||
|
} else if (t->without_array()->is_struct() ||
|
||||||
t->without_array()->is_interface() ||
|
t->without_array()->is_interface() ||
|
||||||
(t->is_array() && t->fields.array->is_array())) {
|
(t->is_array() && t->fields.array->is_array())) {
|
||||||
if (record_type == NULL && t->fields.array->is_record())
|
if (record_type == NULL && t->fields.array->is_struct())
|
||||||
record_type = t->fields.array;
|
record_type = t->fields.array;
|
||||||
|
|
||||||
unsigned length = t->length;
|
unsigned length = t->length;
|
||||||
@@ -334,7 +334,7 @@ private:
|
|||||||
const enum glsl_interface_packing,
|
const enum glsl_interface_packing,
|
||||||
bool /* last_field */)
|
bool /* last_field */)
|
||||||
{
|
{
|
||||||
assert(!type->without_array()->is_record());
|
assert(!type->without_array()->is_struct());
|
||||||
assert(!type->without_array()->is_interface());
|
assert(!type->without_array()->is_interface());
|
||||||
assert(!(type->is_array() && type->fields.array->is_array()));
|
assert(!(type->is_array() && type->fields.array->is_array()));
|
||||||
|
|
||||||
@@ -767,7 +767,7 @@ private:
|
|||||||
bool row_major,
|
bool row_major,
|
||||||
const enum glsl_interface_packing packing)
|
const enum glsl_interface_packing packing)
|
||||||
{
|
{
|
||||||
assert(type->is_record());
|
assert(type->is_struct());
|
||||||
if (this->buffer_block_index == -1)
|
if (this->buffer_block_index == -1)
|
||||||
return;
|
return;
|
||||||
if (packing == GLSL_INTERFACE_PACKING_STD430)
|
if (packing == GLSL_INTERFACE_PACKING_STD430)
|
||||||
@@ -782,7 +782,7 @@ private:
|
|||||||
bool row_major,
|
bool row_major,
|
||||||
const enum glsl_interface_packing packing)
|
const enum glsl_interface_packing packing)
|
||||||
{
|
{
|
||||||
assert(type->is_record());
|
assert(type->is_struct());
|
||||||
if (this->buffer_block_index == -1)
|
if (this->buffer_block_index == -1)
|
||||||
return;
|
return;
|
||||||
if (packing == GLSL_INTERFACE_PACKING_STD430)
|
if (packing == GLSL_INTERFACE_PACKING_STD430)
|
||||||
@@ -798,7 +798,7 @@ private:
|
|||||||
const enum glsl_interface_packing packing,
|
const enum glsl_interface_packing packing,
|
||||||
bool /* last_field */)
|
bool /* last_field */)
|
||||||
{
|
{
|
||||||
assert(!type->without_array()->is_record());
|
assert(!type->without_array()->is_struct());
|
||||||
assert(!type->without_array()->is_interface());
|
assert(!type->without_array()->is_interface());
|
||||||
assert(!(type->is_array() && type->fields.array->is_array()));
|
assert(!(type->is_array() && type->fields.array->is_array()));
|
||||||
|
|
||||||
@@ -849,7 +849,7 @@ private:
|
|||||||
/* Assign explicit locations. */
|
/* Assign explicit locations. */
|
||||||
if (current_var->data.explicit_location) {
|
if (current_var->data.explicit_location) {
|
||||||
/* Set sequential locations for struct fields. */
|
/* Set sequential locations for struct fields. */
|
||||||
if (current_var->type->without_array()->is_record() ||
|
if (current_var->type->without_array()->is_struct() ||
|
||||||
current_var->type->is_array_of_arrays()) {
|
current_var->type->is_array_of_arrays()) {
|
||||||
const unsigned entries = MAX2(1, this->uniforms[id].array_elements);
|
const unsigned entries = MAX2(1, this->uniforms[id].array_elements);
|
||||||
this->uniforms[id].remap_location =
|
this->uniforms[id].remap_location =
|
||||||
@@ -1105,10 +1105,10 @@ link_update_uniform_buffer_variables(struct gl_linked_shader *shader,
|
|||||||
bool found = false;
|
bool found = false;
|
||||||
char sentinel = '\0';
|
char sentinel = '\0';
|
||||||
|
|
||||||
if (var->type->is_record()) {
|
if (var->type->is_struct()) {
|
||||||
sentinel = '.';
|
sentinel = '.';
|
||||||
} else if (var->type->is_array() && (var->type->fields.array->is_array()
|
} else if (var->type->is_array() && (var->type->fields.array->is_array()
|
||||||
|| var->type->without_array()->is_record())) {
|
|| var->type->without_array()->is_struct())) {
|
||||||
sentinel = '[';
|
sentinel = '[';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -79,7 +79,7 @@ create_xfb_varying_names(void *mem_ctx, const glsl_type *t, char **name,
|
|||||||
|
|
||||||
create_xfb_varying_names(mem_ctx, ifc_member_t, name, new_length, count,
|
create_xfb_varying_names(mem_ctx, ifc_member_t, name, new_length, count,
|
||||||
NULL, NULL, varying_names);
|
NULL, NULL, varying_names);
|
||||||
} else if (t->is_record()) {
|
} else if (t->is_struct()) {
|
||||||
for (unsigned i = 0; i < t->length; i++) {
|
for (unsigned i = 0; i < t->length; i++) {
|
||||||
const char *field = t->fields.structure[i].name;
|
const char *field = t->fields.structure[i].name;
|
||||||
size_t new_length = name_length;
|
size_t new_length = name_length;
|
||||||
@@ -90,7 +90,7 @@ create_xfb_varying_names(void *mem_ctx, const glsl_type *t, char **name,
|
|||||||
new_length, count, NULL, NULL,
|
new_length, count, NULL, NULL,
|
||||||
varying_names);
|
varying_names);
|
||||||
}
|
}
|
||||||
} else if (t->without_array()->is_record() ||
|
} else if (t->without_array()->is_struct() ||
|
||||||
t->without_array()->is_interface() ||
|
t->without_array()->is_interface() ||
|
||||||
(t->is_array() && t->fields.array->is_array())) {
|
(t->is_array() && t->fields.array->is_array())) {
|
||||||
for (unsigned i = 0; i < t->length; i++) {
|
for (unsigned i = 0; i < t->length; i++) {
|
||||||
@@ -461,7 +461,7 @@ check_location_aliasing(struct explicit_location_info explicit_locations[][4],
|
|||||||
gl_shader_stage stage)
|
gl_shader_stage stage)
|
||||||
{
|
{
|
||||||
unsigned last_comp;
|
unsigned last_comp;
|
||||||
if (type->without_array()->is_record()) {
|
if (type->without_array()->is_struct()) {
|
||||||
/* The component qualifier can't be used on structs so just treat
|
/* The component qualifier can't be used on structs so just treat
|
||||||
* all component slots as used.
|
* all component slots as used.
|
||||||
*/
|
*/
|
||||||
@@ -1619,7 +1619,7 @@ varying_matches::is_varying_packing_safe(const glsl_type *type,
|
|||||||
producer_stage == MESA_SHADER_TESS_CTRL)
|
producer_stage == MESA_SHADER_TESS_CTRL)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return xfb_enabled && (type->is_array() || type->is_record() ||
|
return xfb_enabled && (type->is_array() || type->is_struct() ||
|
||||||
type->is_matrix() || var->data.is_xfb_only);
|
type->is_matrix() || var->data.is_xfb_only);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1926,7 +1926,7 @@ varying_matches::store_locations() const
|
|||||||
if (enhanced_layouts_enabled) {
|
if (enhanced_layouts_enabled) {
|
||||||
const glsl_type *type =
|
const glsl_type *type =
|
||||||
get_varying_type(producer_var, producer_stage);
|
get_varying_type(producer_var, producer_stage);
|
||||||
if (type->is_array() || type->is_matrix() || type->is_record() ||
|
if (type->is_array() || type->is_matrix() || type->is_struct() ||
|
||||||
type->is_double()) {
|
type->is_double()) {
|
||||||
unsigned comp_slots = type->component_slots() + offset;
|
unsigned comp_slots = type->component_slots() + offset;
|
||||||
unsigned slots = comp_slots / 4;
|
unsigned slots = comp_slots / 4;
|
||||||
@@ -2158,7 +2158,7 @@ private:
|
|||||||
const enum glsl_interface_packing,
|
const enum glsl_interface_packing,
|
||||||
bool /* last_field */)
|
bool /* last_field */)
|
||||||
{
|
{
|
||||||
assert(!type->without_array()->is_record());
|
assert(!type->without_array()->is_struct());
|
||||||
assert(!type->without_array()->is_interface());
|
assert(!type->without_array()->is_interface());
|
||||||
|
|
||||||
tfeedback_candidate *candidate
|
tfeedback_candidate *candidate
|
||||||
|
@@ -4303,7 +4303,7 @@ get_array_stride(struct gl_context *ctx, struct gl_uniform_storage *uni,
|
|||||||
if (GLSL_INTERFACE_PACKING_STD140 ==
|
if (GLSL_INTERFACE_PACKING_STD140 ==
|
||||||
iface->
|
iface->
|
||||||
get_internal_ifc_packing(ctx->Const.UseSTD430AsDefaultPacking)) {
|
get_internal_ifc_packing(ctx->Const.UseSTD430AsDefaultPacking)) {
|
||||||
if (array_type->is_record() || array_type->is_array())
|
if (array_type->is_struct() || array_type->is_array())
|
||||||
return glsl_align(array_type->std140_size(row_major), 16);
|
return glsl_align(array_type->std140_size(row_major), 16);
|
||||||
else
|
else
|
||||||
return MAX2(array_type->std140_base_alignment(row_major), 16);
|
return MAX2(array_type->std140_base_alignment(row_major), 16);
|
||||||
|
@@ -63,7 +63,7 @@ lower_buffer_access::emit_access(void *mem_ctx,
|
|||||||
enum glsl_interface_packing packing,
|
enum glsl_interface_packing packing,
|
||||||
unsigned int write_mask)
|
unsigned int write_mask)
|
||||||
{
|
{
|
||||||
if (deref->type->is_record()) {
|
if (deref->type->is_struct()) {
|
||||||
unsigned int field_offset = 0;
|
unsigned int field_offset = 0;
|
||||||
|
|
||||||
for (unsigned i = 0; i < deref->type->length; i++) {
|
for (unsigned i = 0; i < deref->type->length; i++) {
|
||||||
@@ -214,7 +214,7 @@ lower_buffer_access::is_dereferenced_thing_row_major(const ir_rvalue *deref)
|
|||||||
case GLSL_MATRIX_LAYOUT_COLUMN_MAJOR:
|
case GLSL_MATRIX_LAYOUT_COLUMN_MAJOR:
|
||||||
return false;
|
return false;
|
||||||
case GLSL_MATRIX_LAYOUT_ROW_MAJOR:
|
case GLSL_MATRIX_LAYOUT_ROW_MAJOR:
|
||||||
return matrix || deref->type->without_array()->is_record();
|
return matrix || deref->type->without_array()->is_struct();
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
@@ -241,7 +241,7 @@ lower_buffer_access::is_dereferenced_thing_row_major(const ir_rvalue *deref)
|
|||||||
case GLSL_MATRIX_LAYOUT_COLUMN_MAJOR:
|
case GLSL_MATRIX_LAYOUT_COLUMN_MAJOR:
|
||||||
return false;
|
return false;
|
||||||
case GLSL_MATRIX_LAYOUT_ROW_MAJOR:
|
case GLSL_MATRIX_LAYOUT_ROW_MAJOR:
|
||||||
return matrix || deref->type->without_array()->is_record();
|
return matrix || deref->type->without_array()->is_struct();
|
||||||
}
|
}
|
||||||
|
|
||||||
unreachable("invalid matrix layout");
|
unreachable("invalid matrix layout");
|
||||||
@@ -414,7 +414,7 @@ lower_buffer_access::setup_buffer_access(void *mem_ctx,
|
|||||||
* of the member following the sub-structure is rounded up to
|
* of the member following the sub-structure is rounded up to
|
||||||
* the next multiple of the base alignment of the structure."
|
* the next multiple of the base alignment of the structure."
|
||||||
*/
|
*/
|
||||||
if (type->without_array()->is_record()) {
|
if (type->without_array()->is_struct()) {
|
||||||
intra_struct_offset = glsl_align(intra_struct_offset,
|
intra_struct_offset = glsl_align(intra_struct_offset,
|
||||||
field_align);
|
field_align);
|
||||||
|
|
||||||
|
@@ -521,7 +521,7 @@ lower_packed_varyings_visitor::lower_rvalue(ir_rvalue *rvalue,
|
|||||||
*/
|
*/
|
||||||
assert(!gs_input_toplevel || rvalue->type->is_array());
|
assert(!gs_input_toplevel || rvalue->type->is_array());
|
||||||
|
|
||||||
if (rvalue->type->is_record()) {
|
if (rvalue->type->is_struct()) {
|
||||||
for (unsigned i = 0; i < rvalue->type->length; i++) {
|
for (unsigned i = 0; i < rvalue->type->length; i++) {
|
||||||
if (i != 0)
|
if (i != 0)
|
||||||
rvalue = rvalue->clone(this->mem_ctx, NULL);
|
rvalue = rvalue->clone(this->mem_ctx, NULL);
|
||||||
@@ -776,7 +776,7 @@ lower_packed_varyings_visitor::needs_lowering(ir_variable *var)
|
|||||||
*/
|
*/
|
||||||
const glsl_type *type = var->type;
|
const glsl_type *type = var->type;
|
||||||
if (disable_varying_packing && !var->data.is_xfb_only &&
|
if (disable_varying_packing && !var->data.is_xfb_only &&
|
||||||
!((type->is_array() || type->is_record() || type->is_matrix()) &&
|
!((type->is_array() || type->is_struct() || type->is_matrix()) &&
|
||||||
xfb_enabled))
|
xfb_enabled))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@@ -884,7 +884,7 @@ lower_ubo_reference_visitor::check_for_buffer_struct_copy(ir_assignment *ir)
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
/* LHS and RHS must be records */
|
/* LHS and RHS must be records */
|
||||||
if (!ir->lhs->type->is_record() || !ir->rhs->type->is_record())
|
if (!ir->lhs->type->is_struct() || !ir->rhs->type->is_struct())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
/* RHS must be a buffer-backed variable. This is what can cause the problem
|
/* RHS must be a buffer-backed variable. This is what can cause the problem
|
||||||
|
@@ -103,7 +103,7 @@ ir_structure_reference_visitor::get_variable_entry(ir_variable *var)
|
|||||||
{
|
{
|
||||||
assert(var);
|
assert(var);
|
||||||
|
|
||||||
if (!var->type->is_record() ||
|
if (!var->type->is_struct() ||
|
||||||
var->data.mode == ir_var_uniform || var->data.mode == ir_var_shader_storage ||
|
var->data.mode == ir_var_uniform || var->data.mode == ir_var_shader_storage ||
|
||||||
var->data.mode == ir_var_shader_in || var->data.mode == ir_var_shader_out)
|
var->data.mode == ir_var_shader_in || var->data.mode == ir_var_shader_out)
|
||||||
return NULL;
|
return NULL;
|
||||||
@@ -206,7 +206,7 @@ ir_structure_splitting_visitor::get_splitting_entry(ir_variable *var)
|
|||||||
{
|
{
|
||||||
assert(var);
|
assert(var);
|
||||||
|
|
||||||
if (!var->type->is_record())
|
if (!var->type->is_struct())
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
foreach_in_list(variable_entry, entry, this->variable_list) {
|
foreach_in_list(variable_entry, entry, this->variable_list) {
|
||||||
|
@@ -203,7 +203,7 @@ glsl_type::contains_sampler() const
|
|||||||
{
|
{
|
||||||
if (this->is_array()) {
|
if (this->is_array()) {
|
||||||
return this->fields.array->contains_sampler();
|
return this->fields.array->contains_sampler();
|
||||||
} else if (this->is_record() || this->is_interface()) {
|
} else if (this->is_struct() || this->is_interface()) {
|
||||||
for (unsigned int i = 0; i < this->length; i++) {
|
for (unsigned int i = 0; i < this->length; i++) {
|
||||||
if (this->fields.structure[i].type->contains_sampler())
|
if (this->fields.structure[i].type->contains_sampler())
|
||||||
return true;
|
return true;
|
||||||
@@ -217,7 +217,7 @@ glsl_type::contains_sampler() const
|
|||||||
bool
|
bool
|
||||||
glsl_type::contains_array() const
|
glsl_type::contains_array() const
|
||||||
{
|
{
|
||||||
if (this->is_record() || this->is_interface()) {
|
if (this->is_struct() || this->is_interface()) {
|
||||||
for (unsigned int i = 0; i < this->length; i++) {
|
for (unsigned int i = 0; i < this->length; i++) {
|
||||||
if (this->fields.structure[i].type->contains_array())
|
if (this->fields.structure[i].type->contains_array())
|
||||||
return true;
|
return true;
|
||||||
@@ -233,7 +233,7 @@ glsl_type::contains_integer() const
|
|||||||
{
|
{
|
||||||
if (this->is_array()) {
|
if (this->is_array()) {
|
||||||
return this->fields.array->contains_integer();
|
return this->fields.array->contains_integer();
|
||||||
} else if (this->is_record() || this->is_interface()) {
|
} else if (this->is_struct() || this->is_interface()) {
|
||||||
for (unsigned int i = 0; i < this->length; i++) {
|
for (unsigned int i = 0; i < this->length; i++) {
|
||||||
if (this->fields.structure[i].type->contains_integer())
|
if (this->fields.structure[i].type->contains_integer())
|
||||||
return true;
|
return true;
|
||||||
@@ -249,7 +249,7 @@ glsl_type::contains_double() const
|
|||||||
{
|
{
|
||||||
if (this->is_array()) {
|
if (this->is_array()) {
|
||||||
return this->fields.array->contains_double();
|
return this->fields.array->contains_double();
|
||||||
} else if (this->is_record() || this->is_interface()) {
|
} else if (this->is_struct() || this->is_interface()) {
|
||||||
for (unsigned int i = 0; i < this->length; i++) {
|
for (unsigned int i = 0; i < this->length; i++) {
|
||||||
if (this->fields.structure[i].type->contains_double())
|
if (this->fields.structure[i].type->contains_double())
|
||||||
return true;
|
return true;
|
||||||
@@ -265,7 +265,7 @@ glsl_type::contains_64bit() const
|
|||||||
{
|
{
|
||||||
if (this->is_array()) {
|
if (this->is_array()) {
|
||||||
return this->fields.array->contains_64bit();
|
return this->fields.array->contains_64bit();
|
||||||
} else if (this->is_record() || this->is_interface()) {
|
} else if (this->is_struct() || this->is_interface()) {
|
||||||
for (unsigned int i = 0; i < this->length; i++) {
|
for (unsigned int i = 0; i < this->length; i++) {
|
||||||
if (this->fields.structure[i].type->contains_64bit())
|
if (this->fields.structure[i].type->contains_64bit())
|
||||||
return true;
|
return true;
|
||||||
@@ -302,7 +302,7 @@ glsl_type::contains_subroutine() const
|
|||||||
{
|
{
|
||||||
if (this->is_array()) {
|
if (this->is_array()) {
|
||||||
return this->fields.array->contains_subroutine();
|
return this->fields.array->contains_subroutine();
|
||||||
} else if (this->is_record() || this->is_interface()) {
|
} else if (this->is_struct() || this->is_interface()) {
|
||||||
for (unsigned int i = 0; i < this->length; i++) {
|
for (unsigned int i = 0; i < this->length; i++) {
|
||||||
if (this->fields.structure[i].type->contains_subroutine())
|
if (this->fields.structure[i].type->contains_subroutine())
|
||||||
return true;
|
return true;
|
||||||
@@ -348,7 +348,7 @@ glsl_type::contains_image() const
|
|||||||
{
|
{
|
||||||
if (this->is_array()) {
|
if (this->is_array()) {
|
||||||
return this->fields.array->contains_image();
|
return this->fields.array->contains_image();
|
||||||
} else if (this->is_record() || this->is_interface()) {
|
} else if (this->is_struct() || this->is_interface()) {
|
||||||
for (unsigned int i = 0; i < this->length; i++) {
|
for (unsigned int i = 0; i < this->length; i++) {
|
||||||
if (this->fields.structure[i].type->contains_image())
|
if (this->fields.structure[i].type->contains_image())
|
||||||
return true;
|
return true;
|
||||||
@@ -1429,13 +1429,13 @@ glsl_type::record_location_offset(unsigned length) const
|
|||||||
{
|
{
|
||||||
unsigned offset = 0;
|
unsigned offset = 0;
|
||||||
const glsl_type *t = this->without_array();
|
const glsl_type *t = this->without_array();
|
||||||
if (t->is_record()) {
|
if (t->is_struct()) {
|
||||||
assert(length <= t->length);
|
assert(length <= t->length);
|
||||||
|
|
||||||
for (unsigned i = 0; i < length; i++) {
|
for (unsigned i = 0; i < length; i++) {
|
||||||
const glsl_type *st = t->fields.structure[i].type;
|
const glsl_type *st = t->fields.structure[i].type;
|
||||||
const glsl_type *wa = st->without_array();
|
const glsl_type *wa = st->without_array();
|
||||||
if (wa->is_record()) {
|
if (wa->is_struct()) {
|
||||||
unsigned r_offset = wa->record_location_offset(wa->length);
|
unsigned r_offset = wa->record_location_offset(wa->length);
|
||||||
offset += st->is_array() ?
|
offset += st->is_array() ?
|
||||||
st->arrays_of_arrays_size() * r_offset : r_offset;
|
st->arrays_of_arrays_size() * r_offset : r_offset;
|
||||||
@@ -1527,7 +1527,7 @@ glsl_type::varying_count() const
|
|||||||
return size;
|
return size;
|
||||||
case GLSL_TYPE_ARRAY:
|
case GLSL_TYPE_ARRAY:
|
||||||
/* Don't count innermost array elements */
|
/* Don't count innermost array elements */
|
||||||
if (this->without_array()->is_record() ||
|
if (this->without_array()->is_struct() ||
|
||||||
this->without_array()->is_interface() ||
|
this->without_array()->is_interface() ||
|
||||||
this->fields.array->is_array())
|
this->fields.array->is_array())
|
||||||
return this->length * this->fields.array->varying_count();
|
return this->length * this->fields.array->varying_count();
|
||||||
@@ -1642,7 +1642,7 @@ glsl_type::std140_base_alignment(bool row_major) const
|
|||||||
this->fields.array->is_matrix()) {
|
this->fields.array->is_matrix()) {
|
||||||
return MAX2(this->fields.array->std140_base_alignment(row_major), 16);
|
return MAX2(this->fields.array->std140_base_alignment(row_major), 16);
|
||||||
} else {
|
} else {
|
||||||
assert(this->fields.array->is_record() ||
|
assert(this->fields.array->is_struct() ||
|
||||||
this->fields.array->is_array());
|
this->fields.array->is_array());
|
||||||
return this->fields.array->std140_base_alignment(row_major);
|
return this->fields.array->std140_base_alignment(row_major);
|
||||||
}
|
}
|
||||||
@@ -1685,7 +1685,7 @@ glsl_type::std140_base_alignment(bool row_major) const
|
|||||||
* rounded up to the next multiple of the base alignment of the
|
* rounded up to the next multiple of the base alignment of the
|
||||||
* structure.
|
* structure.
|
||||||
*/
|
*/
|
||||||
if (this->is_record()) {
|
if (this->is_struct()) {
|
||||||
unsigned base_alignment = 16;
|
unsigned base_alignment = 16;
|
||||||
for (unsigned i = 0; i < this->length; i++) {
|
for (unsigned i = 0; i < this->length; i++) {
|
||||||
bool field_row_major = row_major;
|
bool field_row_major = row_major;
|
||||||
@@ -1789,7 +1789,7 @@ glsl_type::std140_size(bool row_major) const
|
|||||||
*/
|
*/
|
||||||
if (this->is_array()) {
|
if (this->is_array()) {
|
||||||
assert(this->explicit_stride == 0);
|
assert(this->explicit_stride == 0);
|
||||||
if (this->without_array()->is_record()) {
|
if (this->without_array()->is_struct()) {
|
||||||
return this->arrays_of_arrays_size() *
|
return this->arrays_of_arrays_size() *
|
||||||
this->without_array()->std140_size(row_major);
|
this->without_array()->std140_size(row_major);
|
||||||
} else {
|
} else {
|
||||||
@@ -1811,7 +1811,7 @@ glsl_type::std140_size(bool row_major) const
|
|||||||
* rounded up to the next multiple of the base alignment of the
|
* rounded up to the next multiple of the base alignment of the
|
||||||
* structure.
|
* structure.
|
||||||
*/
|
*/
|
||||||
if (this->is_record() || this->is_interface()) {
|
if (this->is_struct() || this->is_interface()) {
|
||||||
unsigned size = 0;
|
unsigned size = 0;
|
||||||
unsigned max_align = 0;
|
unsigned max_align = 0;
|
||||||
|
|
||||||
@@ -1837,7 +1837,7 @@ glsl_type::std140_size(bool row_major) const
|
|||||||
|
|
||||||
max_align = MAX2(align, max_align);
|
max_align = MAX2(align, max_align);
|
||||||
|
|
||||||
if (field_type->is_record() && (i + 1 < this->length))
|
if (field_type->is_struct() && (i + 1 < this->length))
|
||||||
size = glsl_align(size, 16);
|
size = glsl_align(size, 16);
|
||||||
}
|
}
|
||||||
size = glsl_align(size, MAX2(max_align, 16));
|
size = glsl_align(size, MAX2(max_align, 16));
|
||||||
@@ -1935,7 +1935,7 @@ glsl_type::std430_base_alignment(bool row_major) const
|
|||||||
* rounded up to the next multiple of the base alignment of the
|
* rounded up to the next multiple of the base alignment of the
|
||||||
* structure.
|
* structure.
|
||||||
*/
|
*/
|
||||||
if (this->is_record()) {
|
if (this->is_struct()) {
|
||||||
unsigned base_alignment = 0;
|
unsigned base_alignment = 0;
|
||||||
for (unsigned i = 0; i < this->length; i++) {
|
for (unsigned i = 0; i < this->length; i++) {
|
||||||
bool field_row_major = row_major;
|
bool field_row_major = row_major;
|
||||||
@@ -2029,7 +2029,7 @@ glsl_type::std430_size(bool row_major) const
|
|||||||
|
|
||||||
if (this->is_array()) {
|
if (this->is_array()) {
|
||||||
assert(this->explicit_stride == 0);
|
assert(this->explicit_stride == 0);
|
||||||
if (this->without_array()->is_record())
|
if (this->without_array()->is_struct())
|
||||||
return this->arrays_of_arrays_size() *
|
return this->arrays_of_arrays_size() *
|
||||||
this->without_array()->std430_size(row_major);
|
this->without_array()->std430_size(row_major);
|
||||||
else
|
else
|
||||||
@@ -2037,7 +2037,7 @@ glsl_type::std430_size(bool row_major) const
|
|||||||
this->without_array()->std430_base_alignment(row_major);
|
this->without_array()->std430_base_alignment(row_major);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this->is_record() || this->is_interface()) {
|
if (this->is_struct() || this->is_interface()) {
|
||||||
unsigned size = 0;
|
unsigned size = 0;
|
||||||
unsigned max_align = 0;
|
unsigned max_align = 0;
|
||||||
|
|
||||||
|
@@ -663,7 +663,7 @@ public:
|
|||||||
/**
|
/**
|
||||||
* Query whether or not a type is a record
|
* Query whether or not a type is a record
|
||||||
*/
|
*/
|
||||||
bool is_record() const
|
bool is_struct() const
|
||||||
{
|
{
|
||||||
return base_type == GLSL_TYPE_STRUCT;
|
return base_type == GLSL_TYPE_STRUCT;
|
||||||
}
|
}
|
||||||
|
@@ -280,7 +280,7 @@ glsl_type_is_array_or_matrix(const struct glsl_type *type)
|
|||||||
bool
|
bool
|
||||||
glsl_type_is_struct(const struct glsl_type *type)
|
glsl_type_is_struct(const struct glsl_type *type)
|
||||||
{
|
{
|
||||||
return type->is_record() || type->is_interface();
|
return type->is_struct() || type->is_interface();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
|
@@ -686,7 +686,7 @@ src_reg::src_reg(class vec4_visitor *v, const struct glsl_type *type)
|
|||||||
this->file = VGRF;
|
this->file = VGRF;
|
||||||
this->nr = v->alloc.allocate(type_size_vec4(type));
|
this->nr = v->alloc.allocate(type_size_vec4(type));
|
||||||
|
|
||||||
if (type->is_array() || type->is_record()) {
|
if (type->is_array() || type->is_struct()) {
|
||||||
this->swizzle = BRW_SWIZZLE_NOOP;
|
this->swizzle = BRW_SWIZZLE_NOOP;
|
||||||
} else {
|
} else {
|
||||||
this->swizzle = brw_swizzle_for_size(type->vector_elements);
|
this->swizzle = brw_swizzle_for_size(type->vector_elements);
|
||||||
@@ -716,7 +716,7 @@ dst_reg::dst_reg(class vec4_visitor *v, const struct glsl_type *type)
|
|||||||
this->file = VGRF;
|
this->file = VGRF;
|
||||||
this->nr = v->alloc.allocate(type_size_vec4(type));
|
this->nr = v->alloc.allocate(type_size_vec4(type));
|
||||||
|
|
||||||
if (type->is_array() || type->is_record()) {
|
if (type->is_array() || type->is_struct()) {
|
||||||
this->writemask = WRITEMASK_XYZW;
|
this->writemask = WRITEMASK_XYZW;
|
||||||
} else {
|
} else {
|
||||||
this->writemask = (1 << type->vector_elements) - 1;
|
this->writemask = (1 << type->vector_elements) - 1;
|
||||||
|
@@ -863,7 +863,7 @@ program_resource_location(struct gl_program_resource *res, unsigned array_index)
|
|||||||
* "A valid name cannot be a structure, an array of structures, or any
|
* "A valid name cannot be a structure, an array of structures, or any
|
||||||
* portion of a single vector or a matrix."
|
* portion of a single vector or a matrix."
|
||||||
*/
|
*/
|
||||||
if (RESOURCE_UNI(res)->type->without_array()->is_record())
|
if (RESOURCE_UNI(res)->type->without_array()->is_struct())
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
/* From the GL_ARB_uniform_buffer_object spec:
|
/* From the GL_ARB_uniform_buffer_object spec:
|
||||||
|
@@ -594,7 +594,7 @@ ir_to_mesa_visitor::get_temp(const glsl_type *type)
|
|||||||
src.reladdr = NULL;
|
src.reladdr = NULL;
|
||||||
next_temp += type_size(type);
|
next_temp += type_size(type);
|
||||||
|
|
||||||
if (type->is_array() || type->is_record()) {
|
if (type->is_array() || type->is_struct()) {
|
||||||
src.swizzle = SWIZZLE_NOOP;
|
src.swizzle = SWIZZLE_NOOP;
|
||||||
} else {
|
} else {
|
||||||
src.swizzle = swizzle_for_size(type->vector_elements);
|
src.swizzle = swizzle_for_size(type->vector_elements);
|
||||||
@@ -1879,7 +1879,7 @@ ir_to_mesa_visitor::visit(ir_constant *ir)
|
|||||||
* get lucky, copy propagation will eliminate the extra moves.
|
* get lucky, copy propagation will eliminate the extra moves.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (ir->type->is_record()) {
|
if (ir->type->is_struct()) {
|
||||||
src_reg temp_base = get_temp(ir->type);
|
src_reg temp_base = get_temp(ir->type);
|
||||||
dst_reg temp = dst_reg(temp_base);
|
dst_reg temp = dst_reg(temp_base);
|
||||||
|
|
||||||
|
@@ -1066,7 +1066,7 @@ type_has_array_or_matrix(const glsl_type *type)
|
|||||||
if (type->is_array() || type->is_matrix())
|
if (type->is_array() || type->is_matrix())
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (type->is_record()) {
|
if (type->is_struct()) {
|
||||||
for (unsigned i = 0; i < type->length; i++) {
|
for (unsigned i = 0; i < type->length; i++) {
|
||||||
if (type_has_array_or_matrix(type->fields.structure[i].type)) {
|
if (type_has_array_or_matrix(type->fields.structure[i].type)) {
|
||||||
return true;
|
return true;
|
||||||
@@ -1112,7 +1112,7 @@ glsl_to_tgsi_visitor::get_temp(const glsl_type *type)
|
|||||||
next_temp += type_size(type);
|
next_temp += type_size(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type->is_array() || type->is_record()) {
|
if (type->is_array() || type->is_struct()) {
|
||||||
src.swizzle = SWIZZLE_NOOP;
|
src.swizzle = SWIZZLE_NOOP;
|
||||||
} else {
|
} else {
|
||||||
src.swizzle = swizzle_for_size(type->vector_elements);
|
src.swizzle = swizzle_for_size(type->vector_elements);
|
||||||
@@ -2732,7 +2732,7 @@ glsl_to_tgsi_visitor::visit(ir_dereference_array *ir)
|
|||||||
* for arrays of structs. Indirect sampler and image indexing is handled
|
* for arrays of structs. Indirect sampler and image indexing is handled
|
||||||
* elsewhere.
|
* elsewhere.
|
||||||
*/
|
*/
|
||||||
int element_size = ir->type->without_array()->is_record() ?
|
int element_size = ir->type->without_array()->is_struct() ?
|
||||||
st_glsl_storage_type_size(ir->type, var->data.bindless) :
|
st_glsl_storage_type_size(ir->type, var->data.bindless) :
|
||||||
type_size(ir->type);
|
type_size(ir->type);
|
||||||
|
|
||||||
@@ -2987,7 +2987,7 @@ glsl_to_tgsi_visitor::emit_block_mov(ir_assignment *ir, const struct glsl_type *
|
|||||||
st_dst_reg *l, st_src_reg *r,
|
st_dst_reg *l, st_src_reg *r,
|
||||||
st_src_reg *cond, bool cond_swap)
|
st_src_reg *cond, bool cond_swap)
|
||||||
{
|
{
|
||||||
if (type->is_record()) {
|
if (type->is_struct()) {
|
||||||
for (unsigned int i = 0; i < type->length; i++) {
|
for (unsigned int i = 0; i < type->length; i++) {
|
||||||
emit_block_mov(ir, type->fields.structure[i].type, l, r,
|
emit_block_mov(ir, type->fields.structure[i].type, l, r,
|
||||||
cond, cond_swap);
|
cond, cond_swap);
|
||||||
@@ -3175,7 +3175,7 @@ glsl_to_tgsi_visitor::visit(ir_constant *ir)
|
|||||||
* aggregate constant and move each constant value into it. If we
|
* aggregate constant and move each constant value into it. If we
|
||||||
* get lucky, copy propagation will eliminate the extra moves.
|
* get lucky, copy propagation will eliminate the extra moves.
|
||||||
*/
|
*/
|
||||||
if (ir->type->is_record()) {
|
if (ir->type->is_struct()) {
|
||||||
st_src_reg temp_base = get_temp(ir->type);
|
st_src_reg temp_base = get_temp(ir->type);
|
||||||
st_dst_reg temp = st_dst_reg(temp_base);
|
st_dst_reg temp = st_dst_reg(temp_base);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user