aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSamuel Pitoiset <[email protected]>2017-04-21 16:31:52 +0200
committerSamuel Pitoiset <[email protected]>2017-05-06 16:40:19 +0200
commitb98542588cd27ebcd403ea8130ef04b440661cb0 (patch)
tree907e2d8dee5e02872c2e9af4a6a27dd894f00f1c /src
parent1eff26f02d8579bd45d97ec0c4f4ac1db79fd051 (diff)
glsl: add is_valid_constructor() helper function
This will help for the explicit conversions for sampler and image types as specified by ARB_bindless_texture. Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Timothy Arceri <[email protected]> Reviewed-by: Nicolai Hähnle <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/compiler/glsl/ast_function.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/compiler/glsl/ast_function.cpp b/src/compiler/glsl/ast_function.cpp
index 91c39265443..d493d1bd01a 100644
--- a/src/compiler/glsl/ast_function.cpp
+++ b/src/compiler/glsl/ast_function.cpp
@@ -1930,6 +1930,12 @@ ast_function_expression::handle_method(exec_list *instructions,
return ir_rvalue::error_value(ctx);
}
+static inline bool is_valid_constructor(const glsl_type *type,
+ struct _mesa_glsl_parse_state *state)
+{
+ return type->is_numeric() || type->is_boolean();
+}
+
ir_rvalue *
ast_function_expression::hir(exec_list *instructions,
struct _mesa_glsl_parse_state *state)
@@ -2007,7 +2013,7 @@ ast_function_expression::hir(exec_list *instructions,
state);
}
- if (!constructor_type->is_numeric() && !constructor_type->is_boolean())
+ if (!is_valid_constructor(constructor_type, state))
return ir_rvalue::error_value(ctx);
/* Total number of components of the type being constructed. */
@@ -2037,7 +2043,7 @@ ast_function_expression::hir(exec_list *instructions,
return ir_rvalue::error_value(ctx);
}
- if (!result->type->is_numeric() && !result->type->is_boolean()) {
+ if (!is_valid_constructor(result->type, state)) {
_mesa_glsl_error(& loc, state, "cannot construct `%s' from a "
"non-numeric data type",
constructor_type->name);