diff options
author | marha <marha@users.sourceforge.net> | 2013-06-18 08:23:14 +0200 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2013-06-18 08:23:14 +0200 |
commit | b071050b9eda9d5e5185e582dbe9f4adba863ccc (patch) | |
tree | 6da290f7da04f9afc96691608b65967f2ee0e0fa /mesalib/src/glsl/hir_field_selection.cpp | |
parent | 150771e7aabf4c864b0b970c5b8d773634793abe (diff) | |
download | vcxsrv-b071050b9eda9d5e5185e582dbe9f4adba863ccc.tar.gz vcxsrv-b071050b9eda9d5e5185e582dbe9f4adba863ccc.tar.bz2 vcxsrv-b071050b9eda9d5e5185e582dbe9f4adba863ccc.zip |
libX11 libXmu libxcb/xcb-proto mesa mkfontscale pixman xkeyboard-config git update 18 June 2013
libxcb/xcb-proto commit e5f7c750815cb5170db363a2e5b09639b7354733
xkeyboard-config commit 30d804538462213ed01e8efc0b44a8e5a0aff990
libX11 commit 9dfb0f3c0a761590bcdc1f3396b1e064da4e18e8
pixman commit 279bdcda7ec3af8ac06312f4514b1b082a279544
mkfontscale commit f731c5c36f28ddd0f25f474d2991c96f9a7a915c
libXmu commit e46ecb4e02b7f919b11efa79448d4db71d1deb69
mesa commit eb2021507556633cd6ba64cda26653e3c43e80df
Diffstat (limited to 'mesalib/src/glsl/hir_field_selection.cpp')
-rw-r--r-- | mesalib/src/glsl/hir_field_selection.cpp | 60 |
1 files changed, 40 insertions, 20 deletions
diff --git a/mesalib/src/glsl/hir_field_selection.cpp b/mesalib/src/glsl/hir_field_selection.cpp index 0035a5f81..ceb0a4cdb 100644 --- a/mesalib/src/glsl/hir_field_selection.cpp +++ b/mesalib/src/glsl/hir_field_selection.cpp @@ -47,20 +47,6 @@ _mesa_ast_field_selection_to_hir(const ast_expression *expr, YYLTYPE loc = expr->get_location(); if (op->type->is_error()) { /* silently propagate the error */ - } else if (op->type->is_vector()) { - ir_swizzle *swiz = ir_swizzle::create(op, - expr->primary_expression.identifier, - op->type->vector_elements); - if (swiz != NULL) { - result = swiz; - } else { - /* FINISHME: Logging of error messages should be moved into - * FINISHME: ir_swizzle::create. This allows the generation of more - * FINISHME: specific error messages. - */ - _mesa_glsl_error(& loc, state, "Invalid swizzle / mask `%s'", - expr->primary_expression.identifier); - } } else if (op->type->base_type == GLSL_TYPE_STRUCT || op->type->base_type == GLSL_TYPE_INTERFACE) { result = new(ctx) ir_dereference_record(op, @@ -81,17 +67,51 @@ _mesa_ast_field_selection_to_hir(const ast_expression *expr, const char *method; method = call->subexpressions[0]->primary_expression.identifier; - if (op->type->is_array() && strcmp(method, "length") == 0) { - if (!call->expressions.is_empty()) - _mesa_glsl_error(&loc, state, "length method takes no arguments."); + if (strcmp(method, "length") == 0) { + if (!call->expressions.is_empty()) + _mesa_glsl_error(&loc, state, "length method takes no arguments."); - if (op->type->array_size() == 0) - _mesa_glsl_error(&loc, state, "length called on unsized array."); + if (op->type->is_array()) { + if (op->type->array_size() == 0) + _mesa_glsl_error(&loc, state, "length called on unsized array."); - result = new(ctx) ir_constant(op->type->array_size()); + result = new(ctx) ir_constant(op->type->array_size()); + } else if (op->type->is_vector()) { + if (state->ARB_shading_language_420pack_enable) { + /* .length() returns int. */ + result = new(ctx) ir_constant((int) op->type->vector_elements); + } else { + _mesa_glsl_error(&loc, state, "length method on matrix only available" + "with ARB_shading_language_420pack."); + } + } else if (op->type->is_matrix()) { + if (state->ARB_shading_language_420pack_enable) { + /* .length() returns int. */ + result = new(ctx) ir_constant((int) op->type->matrix_columns); + } else { + _mesa_glsl_error(&loc, state, "length method on matrix only available" + "with ARB_shading_language_420pack."); + } + } } else { _mesa_glsl_error(&loc, state, "Unknown method: `%s'.", method); } + } else if (op->type->is_vector() || + (state->ARB_shading_language_420pack_enable && + op->type->is_scalar())) { + ir_swizzle *swiz = ir_swizzle::create(op, + expr->primary_expression.identifier, + op->type->vector_elements); + if (swiz != NULL) { + result = swiz; + } else { + /* FINISHME: Logging of error messages should be moved into + * FINISHME: ir_swizzle::create. This allows the generation of more + * FINISHME: specific error messages. + */ + _mesa_glsl_error(& loc, state, "Invalid swizzle / mask `%s'", + expr->primary_expression.identifier); + } } else { _mesa_glsl_error(& loc, state, "Cannot access field `%s' of " "non-structure / non-vector.", |