vkd3d/libs/vkd3d-shader
Elizabeth Figura c43e5c8eb5 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).
2024-09-23 15:28:47 +02:00
..
checksum.c vkd3d-shader: Use a hash to build the filename when dumping shaders. 2024-08-29 19:14:27 +02:00
d3d_asm.c vkd3d-shader/d3d-asm: Tweak some GS declaration names. 2024-09-16 13:58:57 +02:00
d3dbc.c vkd3d-shader/hlsl: Introduce the "error" type. 2024-09-23 15:28:47 +02:00
dxbc.c vkd3d-shader: Use a hash to build the filename when dumping shaders. 2024-08-29 19:14:27 +02:00
dxil.c vkd3d-shader/ir: Record the control flow type in the program. 2024-09-12 18:31:32 +02:00
fx.c vkd3d-shader/hlsl: Introduce the "error" type. 2024-09-23 15:28:47 +02:00
glsl.c vkd3d-shader/glsl: Implement VKD3DSIH_OR. 2024-09-20 17:16:33 +02:00
hlsl_codegen.c vkd3d-shader/hlsl: Introduce the "error" type. 2024-09-23 15:28:47 +02:00
hlsl_constant_ops.c vkd3d-shader/hlsl: Fold logic AND and logic OR identities. 2024-09-03 15:11:16 +02:00
hlsl.c vkd3d-shader/hlsl: Introduce the "error" type. 2024-09-23 15:28:47 +02:00
hlsl.h vkd3d-shader/hlsl: Introduce the "error" type. 2024-09-23 15:28:47 +02:00
hlsl.l vkd3d-shader/hlsl: Remove the 'double' keyword. 2024-09-23 15:26:35 +02:00
hlsl.y vkd3d-shader/hlsl: Do not create a copy in add_assignment(). 2024-09-23 15:28:47 +02:00
ir.c vkd3d-shader/ir: Allow failure in shader_signature_find_element_for_reg(). 2024-09-20 17:01:29 +02:00
libvkd3d-shader.pc.in build: Build libvkd3d-shader as public library. 2018-11-02 11:19:00 +01:00
msl.c vkd3d-shader/msl: Implement VKD3DSIH_RET. 2024-09-18 15:02:57 +02:00
preproc.h vkd3d-shader: Replace assert() with VKD3D_ASSERT() in preproc.h. 2024-08-05 15:57:56 +02:00
preproc.l vkd3d-shader: Replace assert() with VKD3D_ASSERT() in preproc.l. 2024-08-05 15:57:56 +02:00
preproc.y vkd3d-shader: Replace assert() with VKD3D_ASSERT() in preproc.y. 2024-08-05 15:57:56 +02:00
spirv.c vkd3d-shader/spirv: Do not reallocate the SPIR-V program. 2024-09-20 17:14:49 +02:00
tpf.c vkd3d-shader/hlsl: Introduce the "error" type. 2024-09-23 15:28:47 +02:00
vkd3d_shader_main.c vkd3d-shader/glsl: Implement support for VKD3DSPR_CONSTBUFFER registers. 2024-09-19 14:29:46 +02:00
vkd3d_shader_private.h vkd3d-shader/ir: Allow failure in shader_signature_find_element_for_reg(). 2024-09-20 17:01:29 +02:00
vkd3d_shader.map vkd3d-shader: Implement scanning combined resource/sampler information. 2023-11-13 23:19:23 +01:00