summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Turner <mattst88@gmail.com>2015-12-07 14:11:01 -0800
committerEmil Velikov <emil.l.velikov@gmail.com>2015-12-12 19:39:02 +0000
commit0586c5844fb01d8b8df99a7f189e7ad55490659a (patch)
tree30fb3b7bd944ad13fbb5838dec459a36c37d2665
parent7d226ee279b956d762e9a865c1cc5e08f94169a7 (diff)
glsl: Use has_420pack().
These features would not have been enabled with #version 420 otherwise. Cc: "11.1" <mesa-stable@lists.freedesktop.org> Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu> (cherry picked from commit 79da7220db645ade2903af238603c32d551ed5c4)
-rw-r--r--src/glsl/ast_function.cpp6
-rw-r--r--src/glsl/ast_to_hir.cpp4
-rw-r--r--src/glsl/hir_field_selection.cpp3
3 files changed, 6 insertions, 7 deletions
diff --git a/src/glsl/ast_function.cpp b/src/glsl/ast_function.cpp
index 466ece67424..18e05197743 100644
--- a/src/glsl/ast_function.cpp
+++ b/src/glsl/ast_function.cpp
@@ -1737,7 +1737,7 @@ ast_function_expression::handle_method(exec_list *instructions,
result = new(ctx) ir_constant(op->type->array_size());
}
} else if (op->type->is_vector()) {
- if (state->ARB_shading_language_420pack_enable) {
+ if (state->has_420pack()) {
/* .length() returns int. */
result = new(ctx) ir_constant((int) op->type->vector_elements);
} else {
@@ -1746,7 +1746,7 @@ ast_function_expression::handle_method(exec_list *instructions,
goto fail;
}
} else if (op->type->is_matrix()) {
- if (state->ARB_shading_language_420pack_enable) {
+ if (state->has_420pack()) {
/* .length() returns int. */
result = new(ctx) ir_constant((int) op->type->matrix_columns);
} else {
@@ -2075,7 +2075,7 @@ ast_aggregate_initializer::hir(exec_list *instructions,
}
const glsl_type *const constructor_type = this->constructor_type;
- if (!state->ARB_shading_language_420pack_enable) {
+ if (!state->has_420pack()) {
_mesa_glsl_error(&loc, state, "C-style initialization requires the "
"GL_ARB_shading_language_420pack extension");
return ir_rvalue::error_value(ctx);
diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
index 51f7f868aa0..4666b490f02 100644
--- a/src/glsl/ast_to_hir.cpp
+++ b/src/glsl/ast_to_hir.cpp
@@ -3738,7 +3738,7 @@ process_initializer(ir_variable *var, ast_declaration *decl,
* expressions. Const-qualified global variables must still be
* initialized with constant expressions.
*/
- if (!state->ARB_shading_language_420pack_enable
+ if (!state->has_420pack()
|| state->current_function == NULL) {
_mesa_glsl_error(& initializer_loc, state,
"initializer of %s variable `%s' must be a "
@@ -5367,7 +5367,7 @@ ast_jump_statement::hir(exec_list *instructions,
if (state->current_function->return_type != ret_type) {
YYLTYPE loc = this->get_location();
- if (state->ARB_shading_language_420pack_enable) {
+ if (state->has_420pack()) {
if (!apply_implicit_conversion(state->current_function->return_type,
ret, state)) {
_mesa_glsl_error(& loc, state,
diff --git a/src/glsl/hir_field_selection.cpp b/src/glsl/hir_field_selection.cpp
index 337095b95b8..92bb4139194 100644
--- a/src/glsl/hir_field_selection.cpp
+++ b/src/glsl/hir_field_selection.cpp
@@ -57,8 +57,7 @@ _mesa_ast_field_selection_to_hir(const ast_expression *expr,
expr->primary_expression.identifier);
}
} else if (op->type->is_vector() ||
- (state->ARB_shading_language_420pack_enable &&
- op->type->is_scalar())) {
+ (state->has_420pack() && op->type->is_scalar())) {
ir_swizzle *swiz = ir_swizzle::create(op,
expr->primary_expression.identifier,
op->type->vector_elements);