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
Francisco Casas
1f9fc2a422
vkd3d-shader/hlsl: Process GeometryShader as a valid stateblock lhs.
2024-09-14 16:02:43 +02:00
Nikolay Sivov
3b4e0ce8e9
vkd3d-shader/fx: Check modifiers when reusing types.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-09-10 21:48:03 +02:00
Nikolay Sivov
6d28cc131b
vkd3d-shader/fx: Fix the unpacked size and stride fields of the fx_4_0 types.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-09-02 19:14:59 +02:00
Nikolay Sivov
9673b660d4
vkd3d-shader/fx: Expand BlendState array fields for fx_4_1 as well.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-09-02 19:14:59 +02:00
Nikolay Sivov
1ed4543007
vkd3d-shader/fx: Only add numeric variables when writing buffers.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-09-02 19:14:59 +02:00
Nikolay Sivov
ee2da76e6d
vkd3d-shader/fx: Set structure field offsets in bytes.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-09-02 19:14:59 +02:00
Nikolay Sivov
c8cc1b1a24
vkd3d-shader/fx: Fix the matrix type class for fx_2_0.
...
CTAB type correctly reflects matrix majority, unlike effects
type data that does not respond to majority modifiers at all.
It doesn't transpose default values either.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-08-19 14:21:59 +02:00
Nikolay Sivov
ebc039d128
vkd3d-shader/fx: Resolve NULL values for SamplerState.Texture field.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-08-15 17:53:46 +02:00
Nikolay Sivov
873b182021
vkd3d-shader/fx: Support NULL constants for object fields.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-08-15 17:53:46 +02:00
Nikolay Sivov
aa0ea548e4
vkd3d-shader/fx: Handle SetPixelShader() and SetVertexShader().
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-08-15 17:53:46 +02:00
Nikolay Sivov
2c533e494a
vkd3d-shader/fx: Handle SetBlendState().
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-08-15 17:53:46 +02:00
Nikolay Sivov
60ce81112b
vkd3d-shader/fx: Support string annotations for fx_4+.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-08-14 22:00:35 +02:00
Nikolay Sivov
d4ae844bb6
vkd3d-shader/fx: Enable writing string objects for fx_4+.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-08-14 22:00:35 +02:00
Henri Verbeet
114578fc8a
vkd3d-shader/fx: Replace assert() with VKD3D_ASSERT().
2024-08-13 21:20:28 +02:00
Francisco Casas
094e298c1c
vkd3d-shader/hlsl: Parse string default values.
2024-08-13 21:19:01 +02:00
Nikolay Sivov
b4d957f848
vkd3d-shader/hlsl: Handle NULL constants.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-08-13 21:10:45 +02:00
Nikolay Sivov
b0ca3627bf
vkd3d-shader/fx: Turn assignments to arrays to element assignments for certain states.
2024-08-12 14:15:14 +02:00
Nikolay Sivov
25e1c3e374
vkd3d-shader/fx: Explicitly handle bool values in state entries.
2024-08-12 14:15:14 +02:00
Nikolay Sivov
c81223d086
vkd3d-shader/fx: Handle states of a BlendState object.
2024-08-12 14:15:14 +02:00
Nikolay Sivov
2affc8f5c5
vkd3d-shader/fx: Run full set of constants passes on state block entries values.
2024-08-12 14:15:14 +02:00
Nikolay Sivov
f1e65ecc83
vkd3d-shader/fx: Enable writing BlendState variables.
2024-08-12 14:15:14 +02:00
Nikolay Sivov
91e88fac2e
vkd3d-shader/hlsl: Add parser support for BlendState type.
2024-08-12 14:15:14 +02:00
Nikolay Sivov
1be0d99b76
vkd3d-shader/fx: Check destination array index when checking for duplicate state entries.
2024-08-12 14:15:14 +02:00
Nikolay Sivov
b23874dad6
vkd3d-shader/hlsl: Add parser support for GeometryShader type.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-08-08 23:42:37 +02:00
Nikolay Sivov
de48960b33
vkd3d-shader/fx: Add support for the OMSetRenderTargets() state.
2024-08-08 23:42:37 +02:00
Nikolay Sivov
c565a60b9e
vkd3d-shader/fx: Add an array size field to the states description table.
2024-08-08 23:42:37 +02:00
Nikolay Sivov
d55a709992
vkd3d-shader/fx: Use more descriptive names for FX-specific types.
2024-08-08 23:42:37 +02:00
Nikolay Sivov
9fb23b9090
vkd3d-shader/fx: Handle "Texture" field of the sampler state objects.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-08-08 23:42:37 +02:00
Nikolay Sivov
c44a18b3d1
vkd3d-shader/fx: Add support for SetDomainShader(), SetComputeShader(), and SetHullShader() states.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-08-06 16:54:19 +02:00
Nikolay Sivov
1559237780
vkd3d-shader/fx: Fix state block entry array shifting when decomposing.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-08-06 16:54:19 +02:00
Nikolay Sivov
7c3677b114
vkd3d-shader/hlsl: Add parser support for ComputeShader, DomainShader, and HullShader types.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-08-06 16:54:19 +02:00
Nikolay Sivov
2cbad81b55
vkd3d-shader/fx: Handle SetRasterizerState().
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-08-06 16:54:19 +02:00
Nikolay Sivov
a3f4785720
vkd3d-shader/fx: Decompose function-style state assignments to individual states.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-08-05 16:01:33 +02:00
Giovanni Mascellani
02ef731b9a
vkd3d-shader: Replace assert() with VKD3D_ASSERT() in fx.c.
2024-08-01 15:18:15 +02:00
Nikolay Sivov
91dce79227
vkd3d-shader/fx: Correct one of the object counters in the fx_2_0 header.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-07-24 16:04:21 +02:00
Nikolay Sivov
29699d3d22
vkd3d-shader/fx: Set total pass count for fx_2_0.
...
Binaries with that field set incorrectly fail to load on Windows.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-07-23 15:23:54 +02:00
Nikolay Sivov
dcf4ce753b
vkd3d-shader/fx: Correct empty pass check.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-07-23 15:23:54 +02:00
Nikolay Sivov
c792114a6a
vkd3d-shader/fx: Do not output empty strings for missing semantics for fx_2_0.
...
This is directly visible in parameter description. For a parameter without semantic
it should return null, instead of a pointer to an empty string.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-07-11 00:36:05 +02:00
Francisco Casas
60c8a813a3
vkd3d-shader/hlsl: Validate state block function calls.
2024-07-09 20:38:08 +02:00
Francisco Casas
b5f2e7daeb
vkd3d-shader/hlsl: Parse function call syntax on state blocks.
2024-07-09 20:36:28 +02:00
Nikolay Sivov
937a80ead6
vkd3d-shader/fx: Write annotations for fx_4+ profiles.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-07-08 18:49:28 +02:00
Nikolay Sivov
0a344bd3c9
vkd3d-shader/fx: Add missing fields for structure types on fx_5_0.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-07-08 18:24:46 +02:00
Nikolay Sivov
c97c652ff0
vkd3d-shader/fx: Fix packed size for fx_4+ types.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-07-08 18:24:46 +02:00
Nikolay Sivov
856686b2a2
vkd3d-shader/fx: Write default numeric values.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-07-08 18:24:46 +02:00
Nikolay Sivov
aea36be94c
vkd3d-shader/fx: Fix structure type data written for fx_4.
...
Strings and field types are written to the same unstructured area
as structure type itself, so it has to be done in two passes.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-07-08 18:24:46 +02:00
Nikolay Sivov
94130c2394
vkd3d-shader/fx: Add support for writing RasterizerState objects.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-07-08 18:12:03 +02:00
Nikolay Sivov
f03cb7e911
vkd3d-shader/hlsl: Add RasterizerState type.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-07-08 18:12:03 +02:00
Nikolay Sivov
12947aa50d
vkd3d-shader/fx: Add support for writing DepthStencilState objects.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-07-08 18:12:03 +02:00
Nikolay Sivov
1008c49ce6
vkd3d-shader/fx: Cast state block field values to target type.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-07-08 18:12:03 +02:00