Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
b1594dab
Commit
b1594dab
authored
Sep 28, 2012
by
Matteo Bruni
Committed by
Alexandre Julliard
Sep 28, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d3dcompiler: Parse array indexing expressions.
parent
f50007b8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
58 additions
and
0 deletions
+58
-0
hlsl.y
dlls/d3dcompiler_43/hlsl.y
+58
-0
No files found.
dlls/d3dcompiler_43/hlsl.y
View file @
b1594dab
...
...
@@ -1852,6 +1852,64 @@ postfix_expr: primary_expr
return 1;
}
}
| postfix_expr '[' expr ']'
{
/* This may be an array dereference or a vector/matrix
* subcomponent access.
* We store it as an array dereference in any case. */
struct hlsl_ir_deref *deref = d3dcompiler_alloc(sizeof(*deref));
struct hlsl_type *expr_type = $1->data_type;
struct source_location loc;
TRACE("Array dereference from type %s\n", debug_hlsl_type(expr_type));
if (!deref)
{
ERR("Out of memory\n");
return -1;
}
deref->node.type = HLSL_IR_DEREF;
set_location(&loc, &@2);
deref->node.loc = loc;
if (expr_type->type == HLSL_CLASS_ARRAY)
{
deref->node.data_type = expr_type->e.array.type;
}
else if (expr_type->type == HLSL_CLASS_MATRIX)
{
deref->node.data_type = new_hlsl_type(NULL, HLSL_CLASS_VECTOR, expr_type->base_type, expr_type->dimx, 1);
}
else if (expr_type->type == HLSL_CLASS_VECTOR)
{
deref->node.data_type = new_hlsl_type(NULL, HLSL_CLASS_SCALAR, expr_type->base_type, 1, 1);
}
else
{
if (expr_type->type == HLSL_CLASS_SCALAR)
hlsl_report_message(loc.file, loc.line, loc.col, HLSL_LEVEL_ERROR,
"array-indexed expression is scalar");
else
hlsl_report_message(loc.file, loc.line, loc.col, HLSL_LEVEL_ERROR,
"expression is not array-indexable");
d3dcompiler_free(deref);
free_instr($1);
free_instr($3);
return 1;
}
if ($3->data_type->type != HLSL_CLASS_SCALAR)
{
hlsl_report_message(loc.file, loc.line, loc.col, HLSL_LEVEL_ERROR,
"array index is not scalar");
d3dcompiler_free(deref);
free_instr($1);
free_instr($3);
return 1;
}
deref->type = HLSL_IR_DEREF_ARRAY;
deref->v.array.array = $1;
deref->v.array.index = $3;
$$ = &deref->node;
}
/* "var_modifiers" doesn't make sense in this case, but it's needed
in the grammar to avoid shift/reduce conflicts. */
| var_modifiers type '(' initializer_expr_list ')'
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment