aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/glsl/ir_reader.cpp
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2011-02-01 10:46:14 +0000
committermarha <marha@users.sourceforge.net>2011-02-01 10:46:14 +0000
commitd4a8565009962e162d86a9c4ae24062a3fa12025 (patch)
treebcd249c3c523b23a6350b1d6b5a2cff7518cdb0e /mesalib/src/glsl/ir_reader.cpp
parent6751d9898be671d253d6f7b0806cd4b10daaaf85 (diff)
parent0bf07d32cbd460220c67d726900772cf3692746d (diff)
downloadvcxsrv-d4a8565009962e162d86a9c4ae24062a3fa12025.tar.gz
vcxsrv-d4a8565009962e162d86a9c4ae24062a3fa12025.tar.bz2
vcxsrv-d4a8565009962e162d86a9c4ae24062a3fa12025.zip
svn merge ^/branches/released .
Diffstat (limited to 'mesalib/src/glsl/ir_reader.cpp')
-rw-r--r--mesalib/src/glsl/ir_reader.cpp41
1 files changed, 19 insertions, 22 deletions
diff --git a/mesalib/src/glsl/ir_reader.cpp b/mesalib/src/glsl/ir_reader.cpp
index b78aa051b..af85e06ae 100644
--- a/mesalib/src/glsl/ir_reader.cpp
+++ b/mesalib/src/glsl/ir_reader.cpp
@@ -92,7 +92,7 @@ ir_reader::read(exec_list *instructions, const char *src, bool scan_for_protos)
}
read_instructions(instructions, expr, NULL);
- talloc_free(expr);
+ ralloc_free(expr);
if (debug)
validate_ir_tree(instructions);
@@ -106,21 +106,19 @@ ir_reader::ir_read_error(s_expression *expr, const char *fmt, ...)
state->error = true;
if (state->current_function != NULL)
- state->info_log = talloc_asprintf_append(state->info_log,
- "In function %s:\n",
- state->current_function->function_name());
- state->info_log = talloc_strdup_append(state->info_log, "error: ");
+ ralloc_asprintf_append(&state->info_log, "In function %s:\n",
+ state->current_function->function_name());
+ ralloc_strcat(&state->info_log, "error: ");
va_start(ap, fmt);
- state->info_log = talloc_vasprintf_append(state->info_log, fmt, ap);
+ ralloc_vasprintf_append(&state->info_log, fmt, ap);
va_end(ap);
- state->info_log = talloc_strdup_append(state->info_log, "\n");
+ ralloc_strcat(&state->info_log, "\n");
if (expr != NULL) {
- state->info_log = talloc_strdup_append(state->info_log,
- "...in this context:\n ");
+ ralloc_strcat(&state->info_log, "...in this context:\n ");
expr->print();
- state->info_log = talloc_strdup_append(state->info_log, "\n\n");
+ ralloc_strcat(&state->info_log, "\n\n");
}
}
@@ -399,6 +397,8 @@ ir_reader::read_declaration(s_expression *expr)
var->mode = ir_var_auto;
} else if (strcmp(qualifier->value(), "in") == 0) {
var->mode = ir_var_in;
+ } else if (strcmp(qualifier->value(), "const_in") == 0) {
+ var->mode = ir_var_const_in;
} else if (strcmp(qualifier->value(), "out") == 0) {
var->mode = ir_var_out;
} else if (strcmp(qualifier->value(), "inout") == 0) {
@@ -871,7 +871,7 @@ ir_reader::read_texture(s_expression *expr)
s_symbol *tag = NULL;
s_expression *s_sampler = NULL;
s_expression *s_coord = NULL;
- s_list *s_offset = NULL;
+ s_expression *s_offset = NULL;
s_expression *s_proj = NULL;
s_list *s_shadow = NULL;
s_expression *s_lod = NULL;
@@ -917,18 +917,15 @@ ir_reader::read_texture(s_expression *expr)
return NULL;
}
- // Read texel offset, i.e. (0 0 0)
- s_int *offset_x;
- s_int *offset_y;
- s_int *offset_z;
- s_pattern offset_pat[] = { offset_x, offset_y, offset_z };
- if (!MATCH(s_offset, offset_pat)) {
- ir_read_error(s_offset, "expected (<int> <int> <int>)");
- return NULL;
+ // Read texel offset - either 0 or an rvalue.
+ s_int *si_offset = SX_AS_INT(s_offset);
+ if (si_offset == NULL || si_offset->value() != 0) {
+ tex->offset = read_rvalue(s_offset);
+ if (tex->offset == NULL) {
+ ir_read_error(s_offset, "expected 0 or an expression");
+ return NULL;
+ }
}
- tex->offsets[0] = offset_x->value();
- tex->offsets[1] = offset_y->value();
- tex->offsets[2] = offset_z->value();
if (op != ir_txf) {
s_int *proj_as_int = SX_AS_INT(s_proj);