Commit Graph

203 Commits

Author SHA1 Message Date
Nikolay Sivov
a0207436f2 vkd3d-shader/tpf: Add initial support for writing fx_4_0/fx_4_1 binaries.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-01-11 23:04:48 +01:00
Nikolay Sivov
9494b72224 vkd3d-shader: Add separate binary target type for effects.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-01-11 23:04:48 +01:00
Giovanni Mascellani
a02cd1cf64 vkd3d-shader/dxil: Do not use the parser before it is initialized. 2024-01-03 22:38:24 +01:00
Zebediah Figura
4ff389854c vkd3d-shader: Allow compiling d3d bytecode to SPIR-V. 2023-12-14 23:19:31 +01:00
Zebediah Figura
2bc40385d9 vkd3d-shader: Do not scan DCL instructions which do not declare resources. 2023-12-14 23:19:28 +01:00
Zebediah Figura
8af47a96ea vkd3d-shader: Do not scan the shader in vkd3d_shader_parser_compile() for assembly targets. 2023-12-14 23:19:28 +01:00
Giovanni Mascellani
1015cc952e vkd3d-shader/d3d-asm: Add an "internal" mode for the ASM dumper.
The new mode exposes more details about what's going on inside the VSIR
code and it's meant to ease development and debugging.
2023-12-12 23:16:26 +01:00
Zebediah Figura
28f32349f4 vkd3d-shader: Add a helper to search the scan descriptor info.
Avoid shadowing "info" in vkd3d_shader_scan_combined_sampler_declaration().
2023-12-07 21:57:34 +01:00
Conor McCarthy
f2a656b876 vkd3d-shader/dxil: Introduce a value type for immediate constant buffers. 2023-11-22 22:07:56 +01:00
Henri Verbeet
ae4341b565 vkd3d-shader/ir: Use location information from the instruction in vkd3d_shader_scan_instruction(). 2023-11-21 22:41:58 +01:00
Henri Verbeet
01dad41862 vkd3d-shader/ir: Skip recording combined resource/sampler information for dynamically indexed descriptor arrays.
And output a warning instead.
2023-11-21 22:41:57 +01:00
Henri Verbeet
5b82afb83f vkd3d-shader/ir: Decorate vkd3d_shader_scan_error() with VKD3D_PRINTF_FUNC. 2023-11-21 22:41:55 +01:00
Henri Verbeet
9de793f180 vkd3d-shader: Implement scanning combined resource/sampler information. 2023-11-13 23:19:23 +01:00
Giovanni Mascellani
dd96fe50e2 vkd3d-shader: Dump shaders as soon as possible.
So that they are dumped even if parsing fails, which is a circumstance
in which one likely wants to see the problematic shader.

The downside of that is that for shader types other than HLSL
the profile is not written any more in the filename. This should
not be a big problem, because in those cases the shader describes
its own type.

When dumping an HLSL shader, the id is brought in front of the profile
in the file name, in order to make it more tab-friendly: when dealing
with a directory full of shaders it's likely that the id determines
the profile, but the other way around.
2023-11-02 18:22:26 +01:00
Giovanni Mascellani
ab09c0b45b vkd3d-shader: Expose the whole profile when dumping an HLSL shader.
The profile cannot be reliably devised by analyzing the HLSL code,
so it's useful to have it included in the file name.
2023-11-02 18:22:24 +01:00
Zebediah Figura
a668f1ce1c vkd3d-shader: Handle a NULL descriptor info in vkd3d_shader_scan_add_descriptor(). 2023-10-31 21:59:33 +01:00
Conor McCarthy
1e5f91b371 vkd3d-shader: Emit IR CBV declaration sizes in bytes.
DXIL declares CBV sizes in bytes and they are not aligned to 16 bytes.
2023-10-19 23:07:43 +02:00
Conor McCarthy
df4e1b7393 vkd3d-shader/dxil: Read immediate constant arrays. 2023-10-11 22:21:19 +02:00
Zebediah Figura
bd9eae6c22 vkd3d-shader: Scan combined sampler declarations.
This does not handle 1.x samplers yet.
2023-10-09 21:58:38 +02:00
Conor McCarthy
b765f3c770 vkd3d-shader: Make the paramater allocator slab size at least MAX_REG_OUTPUT.
The allocator is used for DXIL input/output parameter arrays.
2023-09-25 22:07:01 +02:00
Giovanni Mascellani
c052cd8998 vkd3d-shader/ir: Introduce a boilerplate to validate the generated IR.
For the moment the validator is trivial, it never fails. Checks will
be added incrementally.
2023-09-22 11:06:13 +02:00
Henri Verbeet
da89da2bf3 vkd3d-shader: Hide support for DXIL sources.
Unfortunately this is not sufficiently ready to release.
2023-09-18 21:04:19 +02:00
Conor McCarthy
bad4c74002 vkd3d-shader: Match only UAV descriptors in vkd3d_shader_scan_add_uav_flag().
Fixes compilation failures in Cyberpunk 2077 due to missing UAV counter
flag.
2023-09-04 20:25:31 +02:00
Conor McCarthy
bf49a1a95b vkd3d-shader/dxil: Declare shader outputs. 2023-08-30 22:48:50 +02:00
Zebediah Figura
622311da8e vkd3d-shader: Add a flag marking raw buffers to struct vkd3d_shader_descriptor_info. 2023-08-23 22:45:04 +02:00
Zebediah Figura
c1ebba9515 vkd3d-shader: Add structure stride to struct vkd3d_shader_descriptor_info1. 2023-08-23 22:45:04 +02:00
Zebediah Figura
88f85ffb50 vkd3d-shader: Add constant buffer size to struct vkd3d_shader_descriptor_info1. 2023-08-23 22:45:04 +02:00
Zebediah Figura
8c465c81cf vkd3d-shader: Add sample count to struct vkd3d_shader_descriptor_info1. 2023-08-23 22:45:04 +02:00
Zebediah Figura
ccedb7f711 vkd3d-shader: Set descriptor flags in the caller to vkd3d_shader_scan_add_descriptor().
Return the vkd3d_shader_descriptor_info1 from that function.
2023-08-23 22:45:02 +02:00
Zebediah Figura
983d01df8c vkd3d-shader: Get rid of the uav_ranges array.
This is now redundant; the register ID is encoded into the scan descriptors.
2023-08-14 18:38:11 +02:00
Zebediah Figura
7d02922541 vkd3d-shader: Add register ID to struct vkd3d_shader_descriptor_info1. 2023-08-14 18:38:11 +02:00
Zebediah Figura
4e9798f6f7 vkd3d-shader: Introduce struct vkd3d_shader_scan_descriptor_info1. 2023-08-14 18:38:11 +02:00
Zebediah Figura
fd4a820c4b vkd3d-shader: Centralize cleanup on error in scan_with_parser(). 2023-08-14 18:38:11 +02:00
Zebediah Figura
9c5cb2de18 vkd3d-shader: Factor more code into vkd3d_shader_scan_get_uav_descriptor_info(). 2023-08-14 18:38:11 +02:00
Zebediah Figura
f649db23a5 vkd3d-shader: Introduce a function to build a varying map between sm1 stages. 2023-08-03 21:20:44 +09:00
Zebediah Figura
d077562f79 vkd3d-shader/d3dbc: Scan descriptors for constant register sets. 2023-07-17 22:56:39 +02:00
Conor McCarthy
6775f7ba66 vkd3d-shader/dxil: Read and validate DXIL bitcode unabbreviated blocks. 2023-06-28 21:40:34 +02:00
Zebediah Figura
20190a1388 vkd3d-shader: Introduce an API to retrieve all signatures from DXBC shaders. 2023-06-27 22:33:41 +02:00
Conor McCarthy
f4778b727d vkd3d-shader/spirv: Use the register index count in shader_register_clone_relative_addresses(). 2023-05-26 19:11:15 +02:00
Conor McCarthy
a0a18b1620 vkd3d-shader: Introduce an internal shader signature structure.
A register count is required for Shader Model 6 signatures, including
those normalised from earlier models.
2023-05-03 21:12:07 +02:00
Zebediah Figura
a60c47ff39 vkd3d-shader: Explicitly align the size in bytecode_get_next_offset() and rename it accordingly. 2023-04-06 17:52:16 +02:00
Zebediah Figura
09cda98deb vkd3d-shader: Factor out vkd3d_shader_parser_compile(). 2023-04-06 17:52:02 +02:00
Zebediah Figura
507e8644ae vkd3d-shader: Reuse the existing parser for scanning in compile_dxbc_tpf(). 2023-04-06 17:52:02 +02:00
Zebediah Figura
70cfd58be6 vkd3d-shader/spirv: Introduce a spirv_compile() helper. 2023-04-06 17:51:59 +02:00
Henri Verbeet
d6d9aab31c vkd3d-shader: Align the start offset instead of the size in bytecode_put_bytes().
The practical effect this has is that we avoid potential trailing padding at
the end of DXBC blobs. Unfortunately this also means we need to be more
careful about using bytecode_get_size() to find the offset where subsequent
data would get written, although in many cases this follows a put_u32() call.
2023-04-04 22:01:36 +02:00
Conor McCarthy
16a7de4b38 vkd3d-shader/trace: Trace the normalised instruction array after tracing the input. 2023-04-03 17:58:23 +02:00
Conor McCarthy
eabdccb117 vkd3d-shader/ir: Merge all shader IR fork and join phases into a single phase.
Normalise the incoming vkd3d_shader_instruction IR to the shader model 6
pattern. This allows generation of a single patch constant function in
SPIR-V.
2023-04-03 17:58:21 +02:00
Henri Verbeet
3a3acb5b7d vkd3d-shader/dxbc: Pass a vkd3d_shader_code structure to shader_parse_input_signature(). 2023-02-23 21:47:20 +01:00
Zebediah Figura
ab601d65cd vkd3d-shader: Initialize the parameter allocator head.
This fixes a memory leak.

Fixes: 007f894b94
2023-02-07 22:15:08 +01:00
Conor McCarthy
d14f42be9d vkd3d-shader/spirv: Pass a parser pointer to spirv_compiler_generate_spirv(). 2023-01-24 18:11:16 +01:00