Shaun Ren
b3a11a9ec4
vkd3d-shader/ir: Lower SM1 SINCOS to SM4 SINCOS.
2024-07-16 15:24:58 +02:00
Elizabeth Figura
806363b765
vkd3d-shader: Allow controlling alpha test through vkd3d-shader parameters.
2024-07-11 17:02:11 +02:00
Elizabeth Figura
c2ce15b623
vkd3d-shader/spirv: Respect VKD3D_SHADER_CONDITIONAL_OP_Z when discard has a bool argument.
2024-07-11 16:59:06 +02:00
Elizabeth Figura
e8bdac8147
vkd3d-shader/spirv: Support passing shader parameters through uniform buffers.
2024-07-11 16:58:52 +02:00
Elizabeth Figura
98def3214b
vkd3d-shader: Introduce struct vkd3d_shader_parameter_info and struct vkd3d_shader_parameter1.
...
As the newly added documentation describes, this reroll serves two purposes:
* to allow shader parameters to be used for any target type (which allows using
parameters for things like Direct3D 8-9 alpha test),
* to allow the union in struct vkd3d_shader_parameter to contain types larger
than 32 bits (by specifying them indirectly through a pointer).
2024-07-11 16:48:09 +02:00
Petrichor Park
bec4f413dc
vkd3d-shader/tpf: Implmenent HLSL_OP1_RCP.
...
SM5 comes with a RCP opcode; for SM4, implement it as `DIV dst, 1, x`.
2024-07-11 16:44:16 +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
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
Giovanni Mascellani
9ebf779ef0
vkd3d: Propagate a failure in d3d12_descriptor_heap_init().
2024-07-11 00:34:58 +02:00
Elizabeth Figura
59f770214a
vkd3d-shader/hlsl: Implement output SV_Coverage.
2024-07-11 00:33:57 +02:00
Elizabeth Figura
71a3d55e8c
vkd3d-shader/hlsl: Implement the GetRenderTargetSampleCount() intrinsic.
2024-07-11 00:33:57 +02:00
Victor Chiletto
2034a8bab9
vkd3d-shader/hlsl: Implement loop unrolling.
...
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
7edd7dcf79
vkd3d-shader/hlsl: Allow cloned blocks to contain external references.
2024-07-11 00:32:53 +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
Victor Chiletto
50e28f70ed
vkd3d-shader/hlsl: Defer bounds checks to after copy propagation.
...
We potentially generate OOB accesses during loop unrolling that are later deleted.
2024-07-11 00:32:53 +02:00
Victor Chiletto
317bd46efd
vkd3d-shader/hlsl: Use a switch in validate_static_object_references().
2024-07-11 00:32:49 +02:00
Victor Chiletto
67c690aa07
vkd3d-shader/d3dbc: Fix implicit enum conversion warning.
...
This slipped through and broke CI.
2024-07-10 00:06:14 +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
Francisco Casas
b92baa40ec
vkd3d-shader/d3dbc: Don't write inconsequential MOVs.
...
CASTs from floats to integers are implemented as mere MOVs. These often,
but not always, end up moving the value from one register to the same
register.
This patch avoids writing the MOV instructions if they have no effect.
2024-07-09 20:32:25 +02:00
Francisco Casas
daa13934a4
vkd3d-shader/d3dbc: Use vsir_program I/O signatures to write dcls.
...
Instead of relying on ctx->extern vars, semantics are now stored in the
vsir_program signatures, and then read to write the declarations.
2024-07-09 20:31:14 +02:00
Francisco Casas
704ce03561
vkd3d-shader/d3dbc: Don't require a hlsl_semantic to get register and usage.
2024-07-09 20:12:47 +02:00
Francisco Casas
003f4c7600
vkd3d-shader/d3dbc: Use program->shader_version instead of ctx->profile.
2024-07-09 20:06:23 +02:00
Francisco Casas
a333090288
vkd3d-shader/d3dbc: Introduce struct d3dbc_compiler.
2024-07-09 19:44:03 +02:00
Francisco Casas
dd8aa2ec91
vkd3d-shader/hlsl: Generate CTAB outside d3dbc_compile().
...
There is no way to store this information from the vsir_program alone,
so we make d3dbc_compile() expect the CTAB blob.
2024-07-09 18:59:54 +02:00
Francisco Casas
130b3335cb
vkd3d-shader/d3dbc: Split hlsl_sm1_write().
...
The idea is to start splitting the
HLSL IR -> d3dbc
translation into
HLSL IR -> vsir -> d3dbc
So hlsl_sm1_write is split into two functions, sm1_generate_vsir()
which should handle the first part and d3dbc_compile() which should
handle the second part.
This translation should be completed once the hlsl_ctx and entry_func
are no longer used in d3dbc_compile().
2024-07-09 18:38:00 +02:00
Zebediah Figura
6db2bc3eff
vkd3d-shader/d3dbc: Use enum vkd3d_shader_register_type in struct sm1_instruction.
2024-07-09 16:59:02 +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
Giovanni Mascellani
7958babb39
vkd3d: Do not synchronize with the tessellation shader stages if they're not enabled.
...
Similarly to a54187f3c9
, this fixes some validation
errors on devices that do not support tessellation; the Adreno 540 on my OnePlus 5
phone in my specific case.
2024-07-08 18:49: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
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
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
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
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
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
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
Francisco Casas
597e55691a
vkd3d-shader/hlsl: Only error out on bind_count register reservation overlaps for SM1.
...
While on SM1 a register reservation reserves the whole size in
registers of the variable's data type, overlapping conflicts are only
checked up to the bind_count (used size) for each variable.
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
abbcf0461f
vkd3d-shader/hlsl: Reserve register slots for unused buffers.
2024-07-03 17:09:16 -03:00