Henri Verbeet pushed to branch master at wine / vkd3d
Commits: 8975933a by Elizabeth Figura at 2024-09-23T15:28:47+02:00 vkd3d-shader/hlsl: Store a pointer to the block's "value" instruction in the block.
- - - - - eb7f5f7f by Elizabeth Figura at 2024-09-23T15:28:47+02:00 vkd3d-shader/hlsl: Return bool from add_assignment().
- - - - - f73a23f7 by Elizabeth Figura at 2024-09-23T15:28:47+02:00 vkd3d-shader/hlsl: Do not create a copy in add_assignment().
- - - - - 010aa53b by Elizabeth Figura at 2024-09-23T15:28:47+02:00 vkd3d-shader/hlsl: Do not handle HLSL_CLASS_CONSTANT_BUFFER in copy_propagation_transform_load().
- - - - - 7daaaf63 by Elizabeth Figura at 2024-09-23T15:28:47+02:00 vkd3d-shader/hlsl: Clarify a comment.
- - - - - c43e5c8e by Elizabeth Figura at 2024-09-23T15:28:47+02:00 vkd3d-shader/hlsl: Introduce the "error" type.
Currently, if an expression successfully parses according to the bison grammar, but for one reason or another cannot generate a meaningful IR instruction, we abort parsing with YYABORT. This includes, for example, an undefined variable or function, invalid swizzle or field reference, or a constructor with a complex or non-numeric data type.
Aborting parsing is unfortunate, however, because it means that any further errors in the program cannot be caught by the programmer, increasing the number of times they will need to fix errors and recompile.
The idea of this patch is that any such expression will instead generate an IR node whose data type is of HLSL_CLASS_ERROR. Any further expression which would consume an "error" typed instruction will instead immediately return an expression of type "error" (probably the same one) instead of aborting or doing any other type-checking.
Currently these "error" instructions should not pass the parsing stage, since hlsl_compile_shader() will immediately notice that compilation has failed and skip any optimization, lowering, or bytecode-writing.
A further direction to take this is to pre-allocate one "error" expression immediately when creating the HLSL parser, and return that expression when we fail to allocate an hlsl_ir_node of any type. This means we do not need to handle allocation errors when constructing nodes, saving us quite a lot of error handling (which is not only tedious but currently often broken, if nothing else by virtue of neglecting cleanup of local variables).
- - - - - 7e3231c7 by Elizabeth Figura at 2024-09-23T15:28:47+02:00 vkd3d-shader/hlsl: Return an "error" expression when constructing an arithmetic expression from incompatible types.
- - - - - 43b714d8 by Elizabeth Figura at 2024-09-23T15:28:47+02:00 vkd3d-shader/hlsl: Handle error expressions in unary expressions.
- - - - -
7 changed files:
- libs/vkd3d-shader/d3dbc.c - libs/vkd3d-shader/fx.c - libs/vkd3d-shader/hlsl.c - libs/vkd3d-shader/hlsl.h - libs/vkd3d-shader/hlsl.y - libs/vkd3d-shader/hlsl_codegen.c - libs/vkd3d-shader/tpf.c
View it on GitLab: https://gitlab.winehq.org/wine/vkd3d/-/compare/799e6105a4edfd9291ea16d8ecfc5...