From 7f96a8471e8ddf2b49a644780f35ee493157782a Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Tue, 11 Dec 2012 12:09:32 -0800 Subject: [PATCH] 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 Reviewed-by: Carl Worth Reviewed-by: Paul Berry Reviewed-by: Kenneth Graunke --- src/glsl/builtin_types.h | 74 ++++++++++++++++++++-------------------- src/glsl/glsl_types.cpp | 4 +++ src/glsl/glsl_types.h | 1 + 3 files changed, 42 insertions(+), 37 deletions(-) diff --git a/src/glsl/builtin_types.h b/src/glsl/builtin_types.h index a4c995fd15a..c78c2d27080 100644 --- a/src/glsl/builtin_types.h +++ b/src/glsl/builtin_types.h @@ -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[] = { diff --git a/src/glsl/glsl_types.cpp b/src/glsl/glsl_types.cpp index 7386760a1a2..f2dd44acb62 100644 --- a/src/glsl/glsl_types.cpp +++ b/src/glsl/glsl_types.cpp @@ -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; diff --git a/src/glsl/glsl_types.h b/src/glsl/glsl_types.h index d6f5c105eb5..24ad844cc54 100644 --- a/src/glsl/glsl_types.h +++ b/src/glsl/glsl_types.h @@ -566,6 +566,7 @@ private: struct glsl_struct_field { const struct glsl_type *type; const char *name; + bool row_major; }; #endif /* __cplusplus */ -- 2.30.2