glsl: Add row_major field to glsl_struct_field

For now, this will always be false.  In the near future, an "interface"
type will be added that shares a lot of infrastructure with structures.

v2: Move row_major checking in glsl_type::record_key_compare from the
next patch to this patch.  Suggested by Paul Berry.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Carl Worth <cworth@cworth.org>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
This commit is contained in:
Ian Romanick
2012-12-11 12:09:32 -08:00
parent 51f740cd5a
commit 7f96a8471e
3 changed files with 42 additions and 37 deletions
+37 -37
View File
@@ -89,9 +89,9 @@ const glsl_type *const glsl_type::mat4_type = & builtin_core_types[14];
/*@{*/
static const struct glsl_struct_field gl_DepthRangeParameters_fields[] = {
{ glsl_type::float_type, "near" },
{ glsl_type::float_type, "far" },
{ glsl_type::float_type, "diff" },
{ glsl_type::float_type, "near", false },
{ glsl_type::float_type, "far", false },
{ glsl_type::float_type, "diff", false },
};
const glsl_type glsl_type::builtin_structure_types[] = {
@@ -106,58 +106,58 @@ const glsl_type glsl_type::builtin_structure_types[] = {
/*@{*/
static const struct glsl_struct_field gl_PointParameters_fields[] = {
{ glsl_type::float_type, "size" },
{ glsl_type::float_type, "sizeMin" },
{ glsl_type::float_type, "sizeMax" },
{ glsl_type::float_type, "fadeThresholdSize" },
{ glsl_type::float_type, "distanceConstantAttenuation" },
{ glsl_type::float_type, "distanceLinearAttenuation" },
{ glsl_type::float_type, "distanceQuadraticAttenuation" },
{ glsl_type::float_type, "size", false },
{ glsl_type::float_type, "sizeMin", false },
{ glsl_type::float_type, "sizeMax", false },
{ glsl_type::float_type, "fadeThresholdSize", false },
{ glsl_type::float_type, "distanceConstantAttenuation", false },
{ glsl_type::float_type, "distanceLinearAttenuation", false },
{ glsl_type::float_type, "distanceQuadraticAttenuation", false },
};
static const struct glsl_struct_field gl_MaterialParameters_fields[] = {
{ glsl_type::vec4_type, "emission" },
{ glsl_type::vec4_type, "ambient" },
{ glsl_type::vec4_type, "diffuse" },
{ glsl_type::vec4_type, "specular" },
{ glsl_type::float_type, "shininess" },
{ glsl_type::vec4_type, "emission", false },
{ glsl_type::vec4_type, "ambient", false },
{ glsl_type::vec4_type, "diffuse", false },
{ glsl_type::vec4_type, "specular", false },
{ glsl_type::float_type, "shininess", false },
};
static const struct glsl_struct_field gl_LightSourceParameters_fields[] = {
{ glsl_type::vec4_type, "ambient" },
{ glsl_type::vec4_type, "diffuse" },
{ glsl_type::vec4_type, "specular" },
{ glsl_type::vec4_type, "position" },
{ glsl_type::vec4_type, "halfVector" },
{ glsl_type::vec3_type, "spotDirection" },
{ glsl_type::float_type, "spotExponent" },
{ glsl_type::float_type, "spotCutoff" },
{ glsl_type::float_type, "spotCosCutoff" },
{ glsl_type::float_type, "constantAttenuation" },
{ glsl_type::float_type, "linearAttenuation" },
{ glsl_type::float_type, "quadraticAttenuation" },
{ glsl_type::vec4_type, "ambient", false },
{ glsl_type::vec4_type, "diffuse", false },
{ glsl_type::vec4_type, "specular", false },
{ glsl_type::vec4_type, "position", false },
{ glsl_type::vec4_type, "halfVector", false },
{ glsl_type::vec3_type, "spotDirection", false },
{ glsl_type::float_type, "spotExponent", false },
{ glsl_type::float_type, "spotCutoff", false },
{ glsl_type::float_type, "spotCosCutoff", false },
{ glsl_type::float_type, "constantAttenuation", false },
{ glsl_type::float_type, "linearAttenuation", false },
{ glsl_type::float_type, "quadraticAttenuation", false },
};
static const struct glsl_struct_field gl_LightModelParameters_fields[] = {
{ glsl_type::vec4_type, "ambient" },
{ glsl_type::vec4_type, "ambient", false },
};
static const struct glsl_struct_field gl_LightModelProducts_fields[] = {
{ glsl_type::vec4_type, "sceneColor" },
{ glsl_type::vec4_type, "sceneColor", false },
};
static const struct glsl_struct_field gl_LightProducts_fields[] = {
{ glsl_type::vec4_type, "ambient" },
{ glsl_type::vec4_type, "diffuse" },
{ glsl_type::vec4_type, "specular" },
{ glsl_type::vec4_type, "ambient", false },
{ glsl_type::vec4_type, "diffuse", false },
{ glsl_type::vec4_type, "specular", false },
};
static const struct glsl_struct_field gl_FogParameters_fields[] = {
{ glsl_type::vec4_type, "color" },
{ glsl_type::float_type, "density" },
{ glsl_type::float_type, "start" },
{ glsl_type::float_type, "end" },
{ glsl_type::float_type, "scale" },
{ glsl_type::vec4_type, "color", false },
{ glsl_type::float_type, "density", false },
{ glsl_type::float_type, "start", false },
{ glsl_type::float_type, "end", false },
{ glsl_type::float_type, "scale", false },
};
const glsl_type glsl_type::builtin_110_deprecated_structure_types[] = {
+4
View File
@@ -96,6 +96,7 @@ glsl_type::glsl_type(const glsl_struct_field *fields, unsigned num_fields,
this->fields.structure[i].type = fields[i].type;
this->fields.structure[i].name = ralloc_strdup(this->fields.structure,
fields[i].name);
this->fields.structure[i].row_major = fields[i].row_major;
}
}
@@ -567,6 +568,9 @@ glsl_type::record_key_compare(const void *a, const void *b)
if (strcmp(key1->fields.structure[i].name,
key2->fields.structure[i].name) != 0)
return 1;
if (key1->fields.structure[i].row_major
!= key2->fields.structure[i].row_major)
return 1;
}
return 0;
+1
View File
@@ -566,6 +566,7 @@ private:
struct glsl_struct_field {
const struct glsl_type *type;
const char *name;
bool row_major;
};
#endif /* __cplusplus */