From 580fc84cfd48c05fd96233a479e8f8ff8d5617b2 Mon Sep 17 00:00:00 2001 From: Matijn Woudt Date: Sun, 29 Aug 2010 03:14:16 +0200 Subject: [PATCH] Fix struct lookup --- dlls/d3dcompiler_43/hlslparser.y | 2 ++ dlls/d3dcompiler_43/hlslparser_funcs.c | 12 ++++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/dlls/d3dcompiler_43/hlslparser.y b/dlls/d3dcompiler_43/hlslparser.y index 96f55d5f8ba..c6c21cc05b1 100644 --- a/dlls/d3dcompiler_43/hlslparser.y +++ b/dlls/d3dcompiler_43/hlslparser.y @@ -1155,9 +1155,11 @@ char *debugstr_expression(struct hlsl_expression *expr) { } switch(expr->op) { case HLSL_OP_VAR: + /* Fixme: display structs correctly */ sprintf(buffer, "%s", expr->A.var->name); break; case HLSL_OP_ASSIGN: + /* Fixme: display structs correctly */ sprintf(buffer, "%s = %s", expr->A.var->name, debugstr_expression(expr->B.expr)); break; case HLSL_OP_INTRINSIC_FUNC: diff --git a/dlls/d3dcompiler_43/hlslparser_funcs.c b/dlls/d3dcompiler_43/hlslparser_funcs.c index 32b111f86fb..03dd704aace 100644 --- a/dlls/d3dcompiler_43/hlslparser_funcs.c +++ b/dlls/d3dcompiler_43/hlslparser_funcs.c @@ -75,8 +75,16 @@ BOOL hlsl_get_variable(struct hlsl_scope *scope, char *name, struct hlsl_variabl } BOOL hlsl_find_var_in_struct(struct hlsl_scope *scope, const char *name, struct hlsl_variable **value) { - /* FIXME */ - return TRUE; + if((*value)->data_type->type == HLSL_STRUCT) { + int i; + for(i = 0; i < (*value)->data_type->value.structure.count; i++) { + if(!lstrcmpiA(name, (*value)->data_type->value.structure.members[i].name)) { + (*value) = &(*value)->data_type->value.structure.members[i]; + return TRUE; + } + } + } + return FALSE; } void hlsl_push_scope(struct hlsl_scope **old, const char *target) { -- 2.11.4.GIT