Shaun Ren
73ee5a135a
vkd3d-shader/hlsl: Check for duplicate attributes in function declaration.
2024-09-04 18:18:23 +02:00
Petrichor Park
855b9713b8
vkd3d-shader/hlsl: Implement the sincos() intrinsic.
2024-09-04 18:16:37 +02:00
Petrichor Park
384810b4ba
vkd3d-shader/hlsl: Implement the dst() intrinsic.
2024-09-04 18:08:24 +02:00
Francisco Casas
7ec44bd70b
vkd3d-shader/hlsl: Parse the CompileShader() syntax.
2024-09-04 17:59:34 +02:00
Francisco Casas
45f18a7838
vkd3d-shader/hlsl: Parse the shader 'compile' syntax.
...
The hlsl_ir_compile node is introduced to represent the "compile"
syntax, and later the CompileShader() and ConstructGSWithSO()
constructs.
It basically represents a function call that remembers its arguments
using hlsl_srcs and keeps its own instruction block, which is discarded
when working on non-effect shaders.
For shader compilations it can be asserted that args_count is 1, and
that this argument (and the last node in hlsl_ir_effect_call.instrs)
is a regular hlsl_ir_call pointing to the declaration of the function
to be compiled.
2024-09-04 17:58:56 +02:00
Francisco Casas
7abf3c3a37
vkd3d-shader/hlsl: Introduce hlsl_ir_vsir_instruction_ref.
...
This node type will be deleted once the hlsl->vsir->d3dbc translation is
complete. For now it serves the purpose of allowing to keep both real
hlsl_ir_nodes and vsir_instructions in the hlsl_block, until all the
former can be translated into the latter.
2024-09-04 16:49:00 +02:00
Petrichor Park
4467c655f0
vkd3d-shader/hlsl: Factor out add_binary_expr() and use it for assignment operators.
...
This fixes a lot of internal compiler errors with assignment operators,
especially bitwise ones. The bitwise-assignment test has the motivating
examples.
2024-08-19 14:15:43 +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
d945d5e78c
vkd3d-shader/hlsl: Check MS texture declaration without sample count only for used variables.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-08-13 21:10:29 +02:00
Nikolay Sivov
91e88fac2e
vkd3d-shader/hlsl: Add parser support for BlendState type.
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
Victor Chiletto
8c3a5e5458
vkd3d-shader/hlsl: Implement f16tof32 intrinsic.
2024-08-08 23:35:02 +02:00
Francisco Casas
e8354ac499
vkd3d-shader/hlsl: Parse string type.
2024-08-07 15:53:07 +02:00
Francisco Casas
090df488ba
vkd3d-shader/hlsl: Parse string constants.
2024-08-07 15:48:59 +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
Giovanni Mascellani
5e1ae5aaa3
vkd3d-shader: Replace assert() with VKD3D_ASSERT() in hlsl.y.
2024-08-05 15:57:56 +02:00
Victor Chiletto
a0de05f0b4
vkd3d-shader/hlsl: Implement the asint() intrinsic.
2024-07-24 16:06:03 +02:00
Shaun Ren
49caeee1fd
vkd3d-shader/hlsl: Support default values for function parameters.
2024-07-23 15:36:32 +02:00
Nikolay Sivov
958117df2f
vkd3d-shader/hlsl: Allow annotations on global variables.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-07-23 15:23:54 +02:00
Petrichor Park
b3f0cd5788
vkd3d-shader/hlsl: Implement the rcp() intrinisic.
...
SM1 already has the RCP opcode implemented; SM4 implementation is in the
next commit.
2024-07-11 16:44:02 +02:00
Elizabeth Figura
71a3d55e8c
vkd3d-shader/hlsl: Implement the GetRenderTargetSampleCount() intrinsic.
2024-07-11 00:33:57 +02:00
Victor Chiletto
5bc56d43bb
vkd3d-shader/hlsl: Parse loop and unroll loop attributes.
...
Based on a patch by Nikolay Sivov.
Co-authored-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-07-11 00:32:53 +02:00
Victor Chiletto
323f53bd7d
vkd3d-shader/hlsl: Pull evaluate_static_expression_as_uint() upwards.
2024-07-11 00:32:53 +02:00
Petrichor Park
746222b349
vkd3d-shader/hlsl: Implement the faceforward() intrinsic.
2024-07-09 20:43:41 +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
Francisco Casas
7bd53cf6d9
vkd3d-shader/hlsl: Free array sizes on function parameters (Valgrind).
2024-07-09 20:32:25 +02:00
Nikolay Sivov
3dc43e8945
vkd3d-shader: Disallow object structure fields for fx profiles.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-07-08 18:49:28 +02:00
Nikolay Sivov
0f7ac0a054
vkd3d-shader/hlsl: Set default values for annotations variables.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-07-08 18:49:06 +02:00
Nikolay Sivov
4d2ce385a7
vkd3d-shader/hlsl: Do not crash on initialization of a redefined variable.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-07-08 18:24:46 +02:00
Nikolay Sivov
8738e4662e
vkd3d-shader/fx: Preserve parsing order of initializer components.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-07-08 18:24:46 +02:00
Nikolay Sivov
2176294df8
vkd3d-shader/hlsl: Implement tex*grad() functions.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-07-08 18:23:38 +02:00
Nikolay Sivov
4ff288bd32
vkd3d-shader: Implement tex*() functions variants with gradient arguments.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-07-08 18:23:38 +02:00
Elizabeth Figura
4cd2dd50f9
vkd3d-shader/hlsl: Separate an "array" rule.
2024-07-08 18:22:39 +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
48ff7de8ef
vkd3d-shader/hlsl: Add support for ConstantBuffer<> type.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-07-08 18:12:03 +02:00
Victor Chiletto
27414ef928
vkd3d-shader/hlsl: Do not immediately fail parsing for malformed 'b' register reservations.
...
This is a fxc quirk. In most cases, this throws an error, but for global
variables it's completely ignored.
2024-07-03 17:09:16 -03:00
Victor Chiletto
b5b3c8b9ff
vkd3d-shader/hlsl: Ignore bracket offsets for 'b' register types prior to SM 5.1.
...
This is a fxc quirk that was fixed for SM >= 5.1 only.
2024-07-03 14:34:45 -03:00
Victor Chiletto
8fb3b604bf
vkd3d-shader/hlsl: Pass a pointer to struct hlsl_reg_reservation in parse_reservation_index.
...
Instead of passing the struct components individually.
2024-07-03 14:05:58 -03:00
Victor Chiletto
e13eb64d4c
vkd3d-shader/hlsl: Support expressions as register offsets.
2024-07-03 14:05:58 -03:00
Yuxuan Shui
ccb6150aab
vkd3d-shader/hlsl: Implement storing to a swizzled matrix.
2024-06-20 12:39:46 +02:00
Elizabeth Figura
2f88442d7d
vkd3d-shader/hlsl: Always initialize $$ when parsing modifiers from an arbitrary string.
...
This avoids spurious errors like "row_major and column_major are mutually
exclusive" when an invalid modifier is used.
Fixes: cf7c05f431
2024-06-11 15:54:10 +02:00
Nikolay Sivov
1124ea46ee
vkd3d-shader/hlsl: Store original semantic name.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-06-11 15:53:19 +02:00
Nikolay Sivov
ccbe36fb8d
vkd3d-shader/hlsl: Implement tex2Dbias().
...
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=56701
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-06-11 15:50:34 +02:00
Elizabeth Figura
558320b52f
vkd3d-shader/hlsl: Add a hlsl_fixme() for 5.1 resource arrays.
...
These are a bit trickier to handle, and need more tests.
2024-06-11 15:49:30 +02:00
Francisco Casas
f5bfa728eb
vkd3d-shader/hlsl: Reorder default values for matrices for SM4.
...
Default value initializers behave differently than regular initializers
for matrices on SM4 profiles.
While regular initializers assign the rhs elements in reading-order
(completing one row at the time), default initializers assing the rhs
elements in Chinese reading-order (completing one column at the time).
So after lowering a default value to a constant, the index of the
component to which this default value is stored is computed to meet
this expectation. This can be done because the default values.
For reference, compiling this shader:
row_major int2x3 m = {1, 2, 3, 4, 5, 6};
float4 main() : sv_target
{
return float4(m[0][0], 99, 99, 99);
}
gives the following buffer definition:
// cbuffer $Globals
// {
//
// row_major int2x3 m; // Offset: 0 Size: 28
// = 0x00000001 0x00000003 0x00000005 0x00000000
// 0x00000002 0x00000004 0x00000006
//
// }
Given that the matrix is column-major, m's default value is actually
{{1, 3, 5}, {2, 4, 6}}, unlike the {{1, 2, 3}, {4, 5, 6}} one would
expect in a regular initializer.
SM1 profiles assign the elements in regular reading order.
2024-06-11 15:46:40 +02:00
Francisco Casas
099a64aeb2
vkd3d-shader/hlsl: Initialize default values with braceless initializers.
...
It is hard to initialize default values on add_assignment() and calling
add_assignment() for initializers is not really necessary: the only
thing we need from it the implicit cast.
2024-06-11 15:46:40 +02:00
Francisco Casas
e8dbc36bd2
vkd3d-shader/hlsl: Record default values for uniforms and constant buffers.
2024-06-11 15:46:40 +02:00