hlsl: Fixes for function definition vs declaration.
2 unresolved threads
2 unresolved threads
Merge request reports
Activity
2224 2229 { 2225 2230 struct hlsl_ir_function_decl *decl = RB_ENTRY_VALUE(entry, struct hlsl_ir_function_decl, entry); 2226 2231 struct find_function_call_args *args = context; 2227 const struct hlsl_ir_var *param; 2228 unsigned int i = 0; 2232 unsigned int i; 2229 2233 2230 LIST_FOR_EACH_ENTRY(param, decl->parameters, struct hlsl_ir_var, param_entry) 2234 if (decl->parameters.count > args->params->args_count) 2235 return; added 5 commits
- 4df98c22 - vkd3d-shader/hlsl: Store function parameters in an array.
- e7a29e80 - vkd3d-shader/hlsl: Add a hlsl_cleanup_semantic() helper.
- 6ae9dbc5 - vkd3d-shader/hlsl: Put synthetic variables into a dummy scope.
- fd19b5d0 - vkd3d-shader/hlsl: Use the original hlsl_ir_function_decl struct rather than...
- 927e5211 - vkd3d-shader/hlsl: Add functions to the global list inside the func_prototype rule.
Toggle commit listUnless I am mistaken, if there is a declaration after a definition, the parameter variables will end up with the name in the last definition, e.g. in:
float foo(float aa); float foo(float bb) { return bb + 1; } float foo(float cc); float4 main() : sv_target { return foo(5); }
the parameter will end up with
"cc"
as its name. I think this could be a problem for error logging.I haven't tested, but I think it may actually be fine, or even preferred? Because the vast majority of errors are done while parsing, references to the parameters from inside the function should print "bb" here, and references to parameters from outside the function (like, say, for a type mismatch) would use the last definition or declaration (so in this case "cc"), which seems like a reasonable or even desirable behaviour.
- Resolved by Giovanni Mascellani
added 12 commits
-
9046a03d...898fc9e1 - 6 commits from branch
wine:master
- 721c7aa2 - tests: Add more tests for function definitions.
- cb2c89a5 - vkd3d-shader/hlsl: Store function parameters in an array.
- 8755a921 - vkd3d-shader/hlsl: Add a hlsl_cleanup_semantic() helper.
- 25d49b51 - vkd3d-shader/hlsl: Put synthetic variables into a dummy scope.
- 4c46075d - vkd3d-shader/hlsl: Use the original hlsl_ir_function_decl struct rather than...
- 77d716c8 - vkd3d-shader/hlsl: Add functions to the global list inside the func_prototype rule.
Toggle commit list-
9046a03d...898fc9e1 - 6 commits from branch
Please register or sign in to reply