Commit Graph

3875 Commits

Author SHA1 Message Date
Zebediah Figura
24b047f1fe vkd3d-utils: Implement ID3D12ShaderReflectionConstantBuffer::GetVariableByIndex(). 2024-03-27 22:36:33 +01:00
Zebediah Figura
2fceebd050 vkd3d-utils: Parse the RD11 section. 2024-03-27 22:36:33 +01:00
Zebediah Figura
90cd57404b vkd3d-utils: Implement ID3D12ShaderReflection::GetConstantBufferByIndex(). 2024-03-27 22:36:31 +01:00
Henri Verbeet
166dc24b2f vkd3d: Move the vkd3d_mutex implementation to vkd3d-common. 2024-03-19 22:58:53 +01:00
Henri Verbeet
2431357fd6 vkd3d-common: Merge vkd3d_debug.h into vkd3d_common.h.
There doesn't seem much point in separating these. Pretty much all of
vkd3d (eventually) includes vkd3d_debug.h, and vkd3d_debug.h includes
vkd3d_common.h because it uses VKD3D_PRINTF_FUNC. The separation also
makes it inconvenient to use the debug macros in vkd3d_common.h.
2024-03-19 22:58:51 +01:00
Henri Verbeet
5de5f241a6 vkd3d-shader/ir: Pass a struct vsir_program to vkd3d_shader_normalise(). 2024-03-19 22:57:56 +01:00
Henri Verbeet
164608a007 vkd3d-shader/d3d-asm: Pass a prefix and suffix to shader_dump_dst_param(). 2024-03-18 23:08:03 +01:00
Henri Verbeet
e2d1a878a7 vkd3d-shader/d3d-asm: Pass a prefix and suffix to shader_dump_src_param(). 2024-03-18 23:08:02 +01:00
Henri Verbeet
939a7fbe88 vkd3d-shader/d3d-asm: Pass a prefix and suffix to shader_dump_tessellator_partitioning(). 2024-03-18 23:08:01 +01:00
Henri Verbeet
5f5145b8f8 vkd3d-shader/d3d-asm: Pass a prefix and suffix to shader_dump_tessellator_output_primitive(). 2024-03-18 23:08:00 +01:00
Henri Verbeet
f61a92b908 vkd3d-shader/d3d-asm: Pass a prefix and suffix to shader_dump_tessellator_domain(). 2024-03-18 23:07:58 +01:00
Henri Verbeet
b98171878f vkd3d-shader/glsl: Keep track of the current indentation level. 2024-03-18 23:07:52 +01:00
Giovanni Mascellani
e5f486edd3 vkd3d-shader/ir: Use type "unused" for labels.
The label itself is certainly an unsigned integer, but the register
has no meaningful data type. It cannot be evaluated to anything.
The goal of this is to reduce cluttering in the internal ASM dumps.
2024-03-18 23:07:45 +01:00
Giovanni Mascellani
d418f49888 vkd3d-shader/d3d-asm: Do not dump a register's type if it's unused. 2024-03-18 23:07:44 +01:00
Giovanni Mascellani
22d19aed58 vkd3d-shader/d3d-asm: Indent instructions inside a block. 2024-03-18 23:07:43 +01:00
Conor McCarthy
0c01a55c7d vkd3d-shader/dxil: Implement DX intrinsic Saturate. 2024-03-18 23:07:40 +01:00
Conor McCarthy
4599d3c1cf vkd3d-shader/dxil: Implement DX intrinsic FAbs. 2024-03-18 23:07:39 +01:00
Conor McCarthy
33694f08fc vkd3d-shader/dxil: Implement DX intrinsics FMa, FMad, IMad and UMad. 2024-03-18 23:07:38 +01:00
Conor McCarthy
421d311a49 vkd3d-shader/spirv: Use dst register data type in spirv_compiler_emit_imad(). 2024-03-18 23:07:36 +01:00
Nikolay Sivov
f55b152811 vkd3d-shader/fx: Fail effect writing on unsupported annotations.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-03-18 23:07:32 +01:00
Nikolay Sivov
206eeb0752 vkd3d-shader/fx: Remove newlines from fixme messages.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-03-18 23:07:31 +01:00
Nikolay Sivov
4fc15d4b4a vkd3d-shader/fx: Add initial support for writing fx_2_0 parameters.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-03-18 23:07:30 +01:00
Nikolay Sivov
ed06e0bbef vkd3d-shader/fx: Populate global variables list during context initialization.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-03-18 23:07:29 +01:00
Nikolay Sivov
ea686e8f5a vkd3d-shader/fx: Fix an instruction block leak.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-03-18 23:07:28 +01:00
Nikolay Sivov
9c7fe62da6 vkd3d-shader/fx: Use type writing helper only for fx_4+.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-03-18 23:07:27 +01:00
Conor McCarthy
3f99719ff2 vkd3d-shader/dxil: Implement DX intrinsic BufferUpdateCounter. 2024-03-18 23:07:23 +01:00
Giovanni Mascellani
8c15377ffc vkd3d-shader/ir: Emit multilevel jumps in the structured program.
The new structurizer therefore reaches feature parity with the
older simple one, except for a couple of points:

 * the old structurizer accepts any CFG, without requiring reducibility;
   however, the DXIL specification requires the CFG to be reducible
   anyway, so we're not really losing anything;

 * the new structurizer additionally requires that no block has two
   incoming back arrows; AFAIK this is condition that can happen,
   but in practice it seems to be rare; also, it's not hard to add
   support for it, as soon as it is decided it is useful.

On the other hand, the new structurizer makes use of the merging
information that are reconstructed from the CFG, which is important
for downstream optimization and fundamental for correctly emitting
tangled instructions.

Taking these considerations into account, the old structurizer is
considered superseded and is therefore removed.
2024-03-18 23:07:17 +01:00
Giovanni Mascellani
c2aa01de6e vkd3d-shader/ir: Emit the reconstructed structured program.
Multilevel jumps are not supported yet, and trigger a fallback to the
simple structurizer.
2024-03-18 23:07:15 +01:00
Henri Verbeet
abf76372e0 vkd3d-shader/ir: Pass a struct vsir_program to vsir_validate(). 2024-03-14 23:24:29 +01:00
Henri Verbeet
7af3e9300f vkd3d-shader/ir: Pass a struct vsir_program to flatten_control_flow_constructs(). 2024-03-14 23:24:28 +01:00
Henri Verbeet
268989f5b9 vkd3d-shader/ir: Pass a struct vsir_program to normalise_combined_samplers(). 2024-03-14 23:24:27 +01:00
Henri Verbeet
674bebe9c9 vkd3d-shader/ir: Pass a struct vsir_program to shader_normalise_io_registers(). 2024-03-14 23:24:24 +01:00
Henri Verbeet
8a60814476 vkd3d-shader/glsl: Generate comments for unhandled instructions.
Mostly for debugging purposes; we'll fail compilation, but will still trace
the shader that would have been generated.
2024-03-14 23:24:19 +01:00
Henri Verbeet
9869fbb0ea vkd3d-shader/glsl: Trace the generated shader.
Even if compilation ultimately failed.
2024-03-14 23:24:16 +01:00
Francisco Casas
619edb4c38 vkd3d-shader/hlsl: Lower CMP instructions for vertex shaders. 2024-03-14 22:49:29 +01:00
Francisco Casas
4c40deaac1 vkd3d-shader/hlsl: Use hlsl_fixme() on missing SM1 matrix writemask lowering.
Instead of FIXME(). Otherwise we compile invalid d3dbc.
2024-03-14 22:49:29 +01:00
Francisco Casas
5c986b9cde vkd3d-shader/hlsl: Lower SLT instructions for pixel shaders.
Properly passing the inverse-trig.shader_test tests whose qualifiers
have been removed requires making spirv.c capable of handling ABS.
The same happens for the ps_3_0 equality test in
float-comparison.shader_test.
2024-03-14 22:49:29 +01:00
Francisco Casas
e9a4758648 vkd3d-shader/hlsl: Implement SM1 comparison operators. 2024-03-14 22:49:29 +01:00
Francisco Casas
7b883eef53 vkd3d-shader/d3dbc: Check profiles before writing SLT and CMP. 2024-03-14 22:48:56 +01:00
Giovanni Mascellani
d75dc76011 vkd3d-shader/ir: Dump the reconstructed structured program. 2024-03-14 22:48:53 +01:00
Giovanni Mascellani
2b3e21caeb vkd3d-shader/ir: Add jumps to the structured programs. 2024-03-14 22:48:52 +01:00
Giovanni Mascellani
c25e4c47c3 vkd3d-shader/ir: Reconstruct a structured program.
For simplicity jumps are not currently processed.
2024-03-14 22:48:50 +01:00
Conor McCarthy
f08976be33 vkd3d-shader/dxil: Implement DX instruction Barrier. 2024-03-14 22:48:46 +01:00
Conor McCarthy
b22632ff1a vkd3d-shader/spirv: Emit a trace message if TGSM alignment is ignored.
This would cause a lot of warning spam if it was a warning.
2024-03-14 22:48:45 +01:00
Conor McCarthy
5e63164d01 vkd3d-shader/dxil: Implement structured groupshared address space global variables. 2024-03-14 22:48:44 +01:00
Conor McCarthy
0965a3608a vkd3d-shader/dxil: Implement raw groupshared address space global variables. 2024-03-14 22:48:43 +01:00
Conor McCarthy
6dd54eeb09 vkd3d-shader/spirv: Support zero-initialisation for workgroup memory. 2024-03-14 22:48:41 +01:00
Henri Verbeet
374c5fcbdd vkd3d-shader/glsl: Store a pointer to the vsir program in struct vkd3d_glsl_generator. 2024-03-13 22:00:48 +01:00
Henri Verbeet
5f1f7ababb vkd3d-shader/ir: Pass a struct vsir_program to remap_output_signature(). 2024-03-13 22:00:42 +01:00
Henri Verbeet
0edf6d25f3 vkd3d-shader/ir: Pass a struct vsir_program to simple_structurizer_run(). 2024-03-13 22:00:41 +01:00
Henri Verbeet
c3f3cb5ef9 vkd3d-shader/ir: Pass a struct vsir_program to materialize_ssas_to_temps(). 2024-03-13 22:00:40 +01:00
Henri Verbeet
76791913d0 vkd3d-shader/ir: Pass a struct vsir_program to materialize_ssas_to_temps_process_reg(). 2024-03-13 22:00:39 +01:00
Henri Verbeet
343a365c97 vkd3d-shader/ir: Pass a struct vsir_program to instruction_array_lower_texkills(). 2024-03-13 22:00:37 +01:00
Conor McCarthy
0dc174ebd7 vkd3d-shader/spirv: Emit an error if a FIRSTBIT instruction has a 64-bit source. 2024-03-13 21:50:37 +01:00
Conor McCarthy
a64eb75c1d vkd3d-shader/spirv: Emit an error if COUNTBITS has a 64-bit source. 2024-03-13 21:50:36 +01:00
Henri Verbeet
9b0d304f8f vkd3d-shader/glsl: Introduce glsl_compile(). 2024-03-12 22:15:41 +01:00
Henri Verbeet
bdc096d437 vkd3d-shader/d3d-asm: Get rid of the (now) redundant "shader_desc" parameter to vkd3d_dxbc_binary_to_text().
And rename the function to d3d_asm_compile() while we're touching it.
2024-03-12 22:15:34 +01:00
Nikolay Sivov
948cd2154a vkd3d-shader/fx: Handle 'single' modifier for buffers.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-03-12 22:14:50 +01:00
Nikolay Sivov
e0ef45c0a3 vkd3d-shader: Parse a 'single' modifier.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-03-12 22:14:50 +01:00
Nikolay Sivov
cf7c05f431 vkd3d-shader: Remove a token for 'precise' modifier.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-03-12 22:14:50 +01:00
Giovanni Mascellani
f2b2040ff6 vkd3d-shader/ir: Sort loop intervals. 2024-03-12 22:14:47 +01:00
Giovanni Mascellani
070c4af8b3 vkd3d-shader/ir: Generate synthetic intervals for forward edges. 2024-03-12 22:14:46 +01:00
Giovanni Mascellani
1d60612340 vkd3d-shader/ir: Compute loop as intervals of the block order. 2024-03-12 22:14:45 +01:00
Nikolay Sivov
30cc6ceb44 vkd3d-shader/fx: Add support for writing shared object descriptions for fx_4_x.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-03-12 22:14:41 +01:00
Nikolay Sivov
13227f3852 vkd3d-shader: Add an option to enable child effects compilation.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-03-12 22:14:41 +01:00
Nikolay Sivov
7f1fdd447c vkd3d-shader/fx: Add initial support for writing uninitialized vertex/pixel shader objects.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-03-12 22:14:40 +01:00
Evan Tang
03a80cde2e vkd3d: Enable VK_EXT_fragment_shader_interlock if available. 2024-03-11 22:10:25 +01:00
Henri Verbeet
038764985a vkd3d-shader/glsl: Use location information from the current instruction. 2024-03-11 22:10:21 +01:00
Conor McCarthy
4f0e5b9069 vkd3d-shader/dxil: Support 16-bit types. 2024-03-11 22:10:06 +01:00
Conor McCarthy
066ea75945 vkd3d-shader/spirv: Introduce HALF and UINT16 types for minimum precision.
Minimum precision types must always be implemented as 32-bit to match how
reduced precision works in SPIR-V.
2024-03-11 22:10:05 +01:00
Conor McCarthy
58123c2e10 vkd3d-shader/spirv: Introduce a data_type_is_floating_point() helper function. 2024-03-11 22:10:03 +01:00
Nikolay Sivov
25d353db91 vkd3d-shader/d3dbc: Do not write semantic declarations for unused variables.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=55829
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=56402
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-03-11 22:09:55 +01:00
Zebediah Figura
ad495970e0 vkd3d-shader/spirv: Implement SLT and SGE. 2024-03-11 22:09:48 +01:00
Zebediah Figura
27196d8b0f vkd3d-shader/spirv: Implement CMP. 2024-03-11 22:09:44 +01:00
Francisco Casas
cfac67ccc2 vkd3d-shader/hlsl: Cast slt before multiplying on ternary operator.
Otherwise we may get a failing
    "hlsl_types_are_equal(arg1->data_type, arg2->data_type)"
assertion on hlsl_new_binary_expr() when creating the MUL.

This happens in the test introducing in the following patch:

    int a, b, c;

    void main(out float4 res : COLOR1, in float4 pos : position, out float4 out_pos : sv_position)
    {
        out_pos = pos;

        res = a ? b/1000.0 : c/1000.0;
    }
2024-03-11 22:09:42 +01:00
Giovanni Mascellani
1690b0b554 vkd3d-shader: Remove the bytecode fields from vkd3d_shader_desc. 2024-03-11 22:09:32 +01:00
Giovanni Mascellani
204c8afb9c vkd3d-shader/dxbc: Remove flag is_dxil.
The full shader profile is already available in vsir_program.
2024-03-11 22:09:31 +01:00
Giovanni Mascellani
470d83a9da vkd3d-shader: Move shader signatures to vsir_program. 2024-03-11 22:09:31 +01:00
Giovanni Mascellani
56dc0c9842 vkd3d-shader/dxbc: Decouple vkd3d_shader_desc from DXBC parsing. 2024-03-11 22:09:30 +01:00
Giovanni Mascellani
5204b92fa0 vkd3d-shader/tpf: Remove a useless parameter to shader_sm4_init(). 2024-03-11 22:09:28 +01:00
Conor McCarthy
7b4b0143bd vkd3d-shader/dxil: Implement DX intrinsic TextureGatherCmp. 2024-03-11 22:09:20 +01:00
Conor McCarthy
5a6fd010ac vkd3d-shader/dxil: Implement DX intrinsic TextureGather. 2024-03-11 22:09:18 +01:00
Giovanni Mascellani
75bc68962d vkd3d-shader/dxbc: Add flag to ignore the DXBC checksum. 2024-03-11 22:08:55 +01:00
Giovanni Mascellani
23259263cf vkd3d-shader/d3d-asm: Only emit signatures for SM4-6. 2024-03-08 23:36:44 +01:00
Henri Verbeet
1fc55d80cd vkd3d-shader: Enable GLSL target support when VKD3D_SHADER_UNSUPPORTED_GLSL is defined. 2024-03-08 23:36:40 +01:00
Evan Tang
4553b2a0dc vkd3d-shader/spirv: Implement support for rasteriser-ordered views.
Using SPV_EXT_fragment_shader_interlock.
2024-03-08 23:36:35 +01:00
Giovanni Mascellani
21f76257b0 vkd3d-shader/d3d-asm: Print labels in red.
They are substantially different from any other register type, so
it makes sense to have them stand out. Also, they help segmenting
visually the code into blocks, because labels are usually found
either at the beginning or at the end of a block.
2024-03-08 23:36:25 +01:00
Conor McCarthy
e65055b435 vkd3d-shader/spirv: Handle the ORD and UNO instructions. 2024-03-08 23:36:14 +01:00
Conor McCarthy
f212aad0ff vkd3d-shader/dxil: Support FCMP_ORD and FCMP_UNO for CMP2. 2024-03-08 23:36:13 +01:00
Conor McCarthy
4dafd6bedf vkd3d: Implement GetCopyableFootprints1(). 2024-03-08 23:36:08 +01:00
Conor McCarthy
197f16efa9 vkd3d: Implement CreatePlacedResource1(). 2024-03-08 23:36:08 +01:00
Conor McCarthy
e5ae6bd3c2 vkd3d: Implement CreateCommittedResource2(). 2024-03-08 23:36:08 +01:00
Conor McCarthy
6edba86a26 vkd3d: Implement GetResourceAllocationInfo2(). 2024-03-08 23:36:08 +01:00
Conor McCarthy
7d2c274b9b vkd3d: Add ID3D12Device8 interface stubs. 2024-03-08 23:36:02 +01:00
Giovanni Mascellani
172e7edf2d vkd3d-shader: Refactor common code for vkd3d_shader_compile(). 2024-03-08 23:35:54 +01:00
Giovanni Mascellani
0e5d6a97cc vkd3d-shader: Refactor common code for vkd3d_shader_scan(). 2024-03-08 23:35:54 +01:00
Giovanni Mascellani
bbd37a76fc vkd3d-shader: Treat the HLSL case specially in vkd3d_shader_compile(). 2024-03-08 23:35:54 +01:00
Giovanni Mascellani
3a1c32acd4 vkd3d-shader: Treat the HLSL case specially in vkd3d_shader_scan().
The other cases are similar and common code can be refactored.
Ideally the HLSL parser will eventually fit the same model, but that
will require more extensive work.
2024-03-08 23:35:53 +01:00
Giovanni Mascellani
b940d79aa8 vkd3d-shader/ir: Keep loops contiguous in the topological sort. 2024-03-08 23:35:48 +01:00
Giovanni Mascellani
cf9a023566 vkd3d-shader/ir: Dump the topological order of the control flow graph. 2024-03-08 23:35:47 +01:00