From the ARB_enhanced_layouts spec:
"As with input layout qualifiers, all shaders except compute shaders
allow *location* layout qualifiers on output variable declarations,
output block declarations, and output block member declarations. Of
these, variables and block members (but not blocks) additionally
allow the *component* layout qualifier."
We previously had compile tests in piglit to make sure this was not a
compile error but no execution tests.
Fixes:
d99a040bbf2c ("i965: enable ARB_enhanced_layouts for gen8+")
Reviewed-by: Alejandro PiƱeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10763>
}
}
+ if (qual->flags.q.explicit_component) {
+ unsigned qual_component;
+ if (process_qualifier_constant(state, &loc, "component",
+ qual->component, &qual_component)) {
+ validate_component_layout_for_type(state, &loc, fields[i].type,
+ qual_component);
+ fields[i].component = qual_component;
+ }
+ } else {
+ fields[i].component = -1;
+ }
+
/* Offset can only be used with std430 and std140 layouts an initial
* value of 0 is used for error detection.
*/
if (c->fields.structure[i].location !=
p->fields.structure[i].location)
return true;
+ if (c->fields.structure[i].component !=
+ p->fields.structure[i].component)
+ return true;
if (c->fields.structure[i].patch !=
p->fields.structure[i].patch)
return true;
(ir_variable_mode) var->data.mode);
}
new_var->data.location = iface_t->fields.structure[i].location;
+ new_var->data.location_frac =
+ iface_t->fields.structure[i].component >= 0 ?
+ iface_t->fields.structure[i].component : 0;
new_var->data.explicit_location = (new_var->data.location >= 0);
+ new_var->data.explicit_component =
+ (iface_t->fields.structure[i].component >= 0);
new_var->data.offset = iface_t->fields.structure[i].offset;
new_var->data.explicit_xfb_offset =
(iface_t->fields.structure[i].offset >= 0);
if (match_locations && this->fields.structure[i].location
!= b->fields.structure[i].location)
return false;
+ if (this->fields.structure[i].component
+ != b->fields.structure[i].component)
+ return false;
if (this->fields.structure[i].offset
!= b->fields.structure[i].offset)
return false;
encode_type_to_blob(blob, struct_field->type);
blob_write_string(blob, struct_field->name);
blob_write_uint32(blob, struct_field->location);
+ blob_write_uint32(blob, struct_field->component);
blob_write_uint32(blob, struct_field->offset);
blob_write_uint32(blob, struct_field->xfb_buffer);
blob_write_uint32(blob, struct_field->xfb_stride);
struct_field->type = decode_type_from_blob(blob);
struct_field->name = blob_read_string(blob);
struct_field->location = blob_read_uint32(blob);
+ struct_field->component = blob_read_uint32(blob);
struct_field->offset = blob_read_uint32(blob);
struct_field->xfb_buffer = blob_read_uint32(blob);
struct_field->xfb_stride = blob_read_uint32(blob);
int location;
/**
+ * For interface blocks, members may explicitly assign the component used
+ * by a varying. Ignored for structs.
+ */
+ int component;
+
+ /**
* For interface blocks, members may have an explicit byte offset
* specified; -1 otherwise. Also used for xfb_offset layout qualifier.
*
* -1 otherwise.
*/
int xfb_stride;
+
/**
* Layout format, applicable to image variables only.
*/
};
#ifdef __cplusplus
#define DEFAULT_CONSTRUCTORS(_type, _name) \
- type(_type), name(_name), location(-1), offset(-1), xfb_buffer(0), \
- xfb_stride(0), image_format(PIPE_FORMAT_NONE), flags(0) \
+ type(_type), name(_name), location(-1), component(-1), offset(-1), \
+ xfb_buffer(0), xfb_stride(0), image_format(PIPE_FORMAT_NONE), flags(0) \
glsl_struct_field(const struct glsl_type *_type,
int _precision,