diff options
author | Ian Romanick <ian.d.romanick@intel.com> | 2010-03-25 13:05:43 -0700 |
---|---|---|
committer | Ian Romanick <ian.d.romanick@intel.com> | 2010-03-25 13:05:43 -0700 |
commit | 80b5ed6e63481237f5e0355b6b096d43a9332fb2 (patch) | |
tree | 730c5f2f3610a27c92853655de955acc58d79cd7 /ir_function.cpp | |
parent | 252127c379404f0c0c23a5f0e2e4175816f7e903 (diff) |
Replace several glsl_type field comparisons with a single pointer comparison
This simplifies the process of matching function parameter types.
More simplifications are probably possible here, but arrays and
structures need to be implemented first.
Diffstat (limited to 'ir_function.cpp')
-rw-r--r-- | ir_function.cpp | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/ir_function.cpp b/ir_function.cpp index a14b546bc6..1ff5b203cc 100644 --- a/ir_function.cpp +++ b/ir_function.cpp @@ -27,6 +27,11 @@ int type_compare(const glsl_type *a, const glsl_type *b) { + /* If the types are the same, they trivially match. + */ + if (a == b) + return 0; + switch (a->base_type) { case GLSL_TYPE_UINT: case GLSL_TYPE_INT: @@ -36,9 +41,6 @@ type_compare(const glsl_type *a, const glsl_type *b) || (a->matrix_rows != b->matrix_rows)) return -1; - if (a->base_type == b->base_type) - return 0; - /* There is no implicit conversion to or from bool. */ if ((a->base_type == GLSL_TYPE_BOOL) @@ -48,14 +50,10 @@ type_compare(const glsl_type *a, const glsl_type *b) return 1; case GLSL_TYPE_SAMPLER: - return ((a->sampler_dimensionality == b->sampler_dimensionality) - && (a->sampler_shadow == b->sampler_shadow) - && (a->sampler_array == b->sampler_array) - && (a->sampler_type == b->sampler_type)) - ? 0 : -1; - case GLSL_TYPE_STRUCT: - return (strcmp(a->name, b->name) == 0) ? 0 : -1; + /* Samplers and structures must match exactly. + */ + return -1; case GLSL_TYPE_ARRAY: if ((b->base_type != GLSL_TYPE_ARRAY) |