diff options
Diffstat (limited to 'mesalib/src/glsl/glsl_types.cpp')
-rw-r--r-- | mesalib/src/glsl/glsl_types.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/mesalib/src/glsl/glsl_types.cpp b/mesalib/src/glsl/glsl_types.cpp index 978e9a398..758fcf756 100644 --- a/mesalib/src/glsl/glsl_types.cpp +++ b/mesalib/src/glsl/glsl_types.cpp @@ -523,3 +523,19 @@ glsl_type::component_slots() const return 0;
}
}
+
+bool
+glsl_type::can_implicitly_convert_to(const glsl_type *desired) const
+{
+ if (this == desired)
+ return true;
+
+ /* There is no conversion among matrix types. */
+ if (this->matrix_columns > 1 || desired->matrix_columns > 1)
+ return false;
+
+ /* int and uint can be converted to float. */
+ return desired->is_float()
+ && this->is_integer()
+ && this->vector_elements == desired->vector_elements;
+}
|