Francisco Casas
90a07ada8e
vkd3d-shader/tpf: Use SCALAR swizzle dimension for RASTERIZER registers.
...
While we currently output instructions like this:
sampleinfo_uint r0.x, rasterizer.xxxx
> SAMPLE_INFO (111)
0 0000100[len:4] 0000000000001[1] 00001101111[opcode:111]
└─ 0 000[d3i:0] 000[d2i:0] 000[d1i:0] 01[idxs:1] 00000000[type:0] 0000[0] 0001[wmask:1] 00[swtype:0] 10[dim:2]
└─ 00000000000000000000000000000000[0|0.0]
└─ 0 000[d3i:0] 000[d2i:0] 000[d1i:0] 00[idxs:0] 00001110[type:14] 00000000[sw:0] 01[swtype:1] 10[dim:2]
FXC/d3dcompiler outputs instructions like this:
sampleinfo o0.x, rasterizer.x
> SAMPLE_INFO (111)
0 0000100[len:4] 0000000000000[0] 00001101111[opcode:111]
└─ 0 000[d3i:0] 000[d2i:0] 000[d1i:0] 01[idxs:1] 00000010[type:2] 0000[0] 0001[wmask:1] 00[swtype:0] 10[dim:2]
└─ 00000000000000000000000000000000[0|0.0]
└─ 0 000[d3i:0] 000[d2i:0] 000[d1i:0] 00[idxs:0] 00001110[type:14] 000000[0] 00[swcomp:0] 10[swtype:2] 10[dim:2]
Note the difference in swtype of the rasterizer src register.
2024-11-05 19:50:55 +01:00
Francisco Casas
950c381728
vkd3d-shader/hlsl: Store RASTERIZER_SAMPLE_COUNT in the vsir program.
...
Also, the profile check for GetRenderTargetSampleCount() is moved to
parse time.
2024-11-05 19:48:31 +01:00
Francisco Casas
ab60f4e082
vkd3d-shader/hlsl: Store simple SM4 expressions in the vsir program.
2024-11-05 19:35:52 +01:00
Francisco Casas
b4608e99e3
vkd3d-shader/tpf: Remove HLSL IR ABS handling.
2024-11-05 19:20:21 +01:00
Francisco Casas
6eda775047
vkd3d-shader/hlsl: Run sm4_generate_vsir_block() recursively.
...
This allows us to remove the HLSL IR version of an instruction when
the vsir version is properly implemented.
2024-11-05 19:20:21 +01:00
Shaun Ren
64c4a3a442
vkd3d-shader/hlsl: Store SM4 semantic declarations in the vsir program.
2024-11-05 19:19:22 +01:00
Nikolay Sivov
5ea946aa90
vkd3d-shader/hlsl: Accept multiple colon-separated attributes.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-11-05 18:23:31 +01:00
Francisco Casas
68311ef010
vkd3d-shader/hlsl: Store SM4 ABS instructions in the vsir program.
2024-11-04 17:00:54 +01:00
Francisco Casas
404644bad3
vkd3d-shader/hlsl: Introduce vsir_src_from_hlsl_node().
...
This allows constants to be inlined for sm4.
2024-11-04 16:36:28 +01:00
Francisco Casas
6f52bb6b1a
vkd3d-shader/hlsl: Store SM4 swizzles in the vsir program.
2024-11-04 16:08:38 +01:00
Francisco Casas
2083d505c7
vkd3d-shader/tpf: Use instr.extra_bits for IF.
2024-11-04 15:37:46 +01:00
Henri Verbeet
e6c84862a8
vkd3d-shader/ir: Search for SV_TARGET0 vsir_program_insert_alpha_test().
...
As opposed to any SV_TARGET with register index 0. We care about the
semantic index here, not the register index.
2024-11-04 15:32:05 +01:00
Henri Verbeet
1b0248f31b
vkd3d-shader/ir: Specifically search for SV_POSITION0 in vsir_program_insert_clip_planes().
2024-11-04 15:30:44 +01:00
Elizabeth Figura
3681b83fb4
vkd3d-shader/fx: Fix checking for a GS with stream output.
2024-11-04 15:29:39 +01:00
Elizabeth Figura
7e4ab9c7c0
vkd3d-shader: Write zeroes for uninitialized outputs in vsir_program_remap_output_signature().
2024-11-04 15:26:55 +01:00
Elizabeth Figura
e781abc3fb
vkd3d-shader: Write uninitialized components of COLOR0 as 1.
2024-11-04 15:21:09 +01:00
Elizabeth Figura
cc9fcee676
vkd3d-shader: Reduce masks to only read components in vsir_program_remap_output_signature().
2024-11-04 15:11:54 +01:00
Elizabeth Figura
61bda1c054
vkd3d-shader: Always ensure a RET at the end of a program.
2024-11-04 15:06:02 +01:00
Nikolay Sivov
ad2208b726
vkd3d-shader/fx: Implement parsing shader resources types.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-10-29 14:52:39 +01:00
Nikolay Sivov
1a8e9ff94e
vkd3d-shader/fx: Implement parsing shader objects.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-10-29 14:41:55 +01:00
Elizabeth Figura
3511b54040
vkd3d-shader/hlsl: Use early return in allocate_register().
...
Partly to avoid a spurious maybe-uninitialized warning, and partly because it's a more idiomatic structure.
2024-10-28 18:01:06 +01:00
Elizabeth Figura
08253504dc
vkd3d-shader: Make an assert into an explicit check.
...
For some reason gcc without LTO thinks that component_count can overflow the
array here.
2024-10-28 18:01:06 +01:00
Elizabeth Figura
5883e01032
vkd3d-shader/fx: Remove an unnecessary hlsl_is_numeric_type().
...
Constants can only be numeric.
2024-10-28 18:01:06 +01:00
Henri Verbeet
9690ffff61
vkd3d-shader/spirv: Handle oPts in spirv_compiler_get_register_name().
2024-10-28 17:54:43 +01:00
Henri Verbeet
fa6d03a4cb
vkd3d-shader/d3d-asm: Implement support for VKD3DSPR_PARAMETER registers.
2024-10-28 17:54:20 +01:00
Nikolay Sivov
89e5912fd2
vkd3d-shader/hlsl: Implement RWByteAddressBuffer.Store*() methods.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-10-28 17:51:04 +01:00
Nikolay Sivov
cf27065b7d
vkd3d-shader/hlsl: Add parser support for the RWByteAddressBuffer type.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-10-28 17:44:28 +01:00
Nikolay Sivov
4195a2f18a
vkd3d-shader/hlsl: Use a more compact way to store object method configurations.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-10-28 17:41:46 +01:00
Elizabeth Figura
390a330b8e
vkd3d-shader/hlsl: Avoid leaking the block in the subscript rule.
2024-10-28 15:40:41 +01:00
Elizabeth Figura
bb74180659
vkd3d-shader/hlsl: Return an error expression when an invalid subscript is used.
2024-10-28 15:40:41 +01:00
Elizabeth Figura
7905c47765
vkd3d-shader/hlsl: Handle error expressions in array sizes.
2024-10-28 15:40:41 +01:00
Elizabeth Figura
8b98e483ac
vkd3d-shader/hlsl: Handle error expressions in return statements.
2024-10-28 15:40:41 +01:00
Elizabeth Figura
94cf432035
vkd3d-shader/hlsl: Handle error expressions in conditions.
2024-10-28 15:40:41 +01:00
Nikolay Sivov
5eff8bf918
vkd3d-shader/hlsl: Handle SV_GroupIndex.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-10-24 20:54:04 +02:00
Henri Verbeet
5e9edf25d0
vkd3d-shader/glsl: Implement VKD3DSIH_GATHER4.
2024-10-24 20:52:37 +02:00
Henri Verbeet
d477a00734
vkd3d-shader/glsl: Implement VKD3DSIH_SAMPLE_GRAD.
2024-10-24 20:52:37 +02:00
Henri Verbeet
d58282c6d1
vkd3d-shader/glsl: Implement VKD3DSIH_SAMPLE_LOD.
2024-10-24 20:52:37 +02:00
Henri Verbeet
85697d76be
vkd3d-shader/glsl: Implement VKD3DSIH_UMAX and VKD3DSIH_UMIN.
2024-10-24 20:52:37 +02:00
Henri Verbeet
6a119b6946
vkd3d-shader/glsl: Implement VKD3DSGF_FORCE_EARLY_DEPTH_STENCIL.
2024-10-24 20:52:37 +02:00
Francisco Casas
9d82915629
vkd3d-shader/hlsl: Make allocation functions static again.
2024-10-24 20:50:59 +02:00
Francisco Casas
23be6ed0dd
vkd3d-shader/hlsl: Store temp declarations in the vsir program.
...
Move the temp allocation back to hlsl_codegen.c.
Note that the DCL_TEMPS instructions wouldn't be necessary if we had the
capacity to store the temp_count for both the main program and the patch
constant program (or more generally speaking, a temp_count for all
phases).
The plan is to eventually also move the HS_CONTROL_POINT and
HS_FORK_PHASE markers to the vsir_program, making it able to contain
both functions.
2024-10-24 20:50:59 +02:00
Francisco Casas
158bf794e6
vkd3d-shader/hlsl: Introduce hlsl_ir_vsir_instruction_ref, again.
...
This node type will be deleted (again) once the hlsl->vsir->tpf
translation is complete. 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-10-24 20:50:59 +02:00
Francisco Casas
cf7fade580
vkd3d-shader/hlsl: Store the thread group size in the vsir program.
2024-10-24 20:48:20 +02:00
Giovanni Mascellani
91701f8303
vkd3d-shader: Warn instead of erroring out when failing to dump a shader.
...
It's a debug operation and shouldn't be considered fatal, even
for development workflows.
2024-10-23 16:14:33 +02:00
Giovanni Mascellani
6a03369f84
vkd3d-shader: Do not dump the target shader if compilation failed.
...
Otherwise we'd use unitialized data.
2024-10-23 16:14:33 +02:00
Elizabeth Figura
32e6a1bb4d
vkd3d-shader: Validate the parsed shader in vsir_parse().
2024-10-23 16:02:09 +02:00
Elizabeth Figura
3a3f95e1e7
vkd3d-shader: Factor out a vsir_parse() helper.
2024-10-23 16:02:09 +02:00
Henri Verbeet
1113d24a70
vkd3d-shader/ir: Store the global flags in struct vsir_program.
2024-10-22 20:40:31 +02:00
Henri Verbeet
21e9029177
vkd3d-shader/glsl: Implement VKD3DSIH_SAMPLE_C_LZ.
2024-10-22 20:39:31 +02:00
Henri Verbeet
5958e527e5
vkd3d-shader/glsl: Implement VKD3DSIH_SAMPLE_C.
2024-10-22 20:39:31 +02:00
Henri Verbeet
19c493722e
vkd3d-shader/glsl: Implement VKD3DSIH_SAMPLE_B.
2024-10-22 20:39:31 +02:00
Henri Verbeet
e408f1d984
vkd3d-shader/glsl: Implement support for the VKD3DSPR_THREADID register.
2024-10-22 20:39:31 +02:00
Henri Verbeet
f76dd80cba
vkd3d-shader/glsl: Implement VKD3DSIH_LD_UAV_TYPED.
2024-10-22 20:39:31 +02:00
Nikolay Sivov
cf3e251a9f
vkd3d-shader/hlsl: Implement the f32tof16() intrinsic.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-10-22 20:28:33 +02:00
Shaun Ren
f54797bae5
vkd3d-shader/hlsl: Support discard for SM1.
2024-10-22 20:27:34 +02:00
Francisco Casas
2a8c1b2823
vkd3d-shader/hlsl: Sort signature elements by register id.
2024-10-22 20:25:40 +02:00
Francisco Casas
51d05c1844
vkd3d-shader/hlsl: Optimize interstage signatures.
2024-10-22 20:15:15 +02:00
Francisco Casas
88dd082160
vkd3d-shader/hlsl: Allow prioritizing smaller writemasks when allocating signature elements.
...
For now this doesn't have effect yet, until semantic allocation is
optimized.
2024-10-22 20:06:15 +02:00
Francisco Casas
d562b03c43
vkd3d-shader/hlsl: Allow to force alignment on some semantic vars.
...
This is required to properly optimize signatures, because these
semantics must be alligned while being packed:
- Array elements.
- The first fields of structs.
- Major vectors of a matrix.
For now this has no effect since semantics are allocated with reg_size
4, but will have effect when optimizing interstage signatures.
2024-10-22 20:04:41 +02:00
Francisco Casas
7fd6c29ee8
vkd3d-shader/hlsl: Allow accounting for interpolation mode when allocating semantics.
...
For now this has no effect since semantics are allocated with reg_size
4, but will have effect when optimizing interstage signatures.
2024-10-22 20:03:39 +02:00
Francisco Casas
b65f5fb069
vkd3d-shader/hlsl: Also pass field storage modifiers to output signature elements.
...
The generated pixel shader input signature must be consistent with the
generated vertex shader output signature for the same data type.
Since the interpolation mode affects allocation order, the allocator
needs to know the modifiers for both input and output signature elements.
2024-10-22 19:29:11 +02:00
Francisco Casas
7180a96741
vkd3d-shader/hlsl: Use a register_allocator to allocate semantic registers.
2024-10-22 19:23:33 +02:00
Francisco Casas
9ce7b7806f
vkd3d-shader/hlsl: Add mode field to register_allocator allocations.
2024-10-22 19:23:22 +02:00
Nikolay Sivov
fb2b974466
vkd3d-shader/hlsl: Handle snorm/unorm types as resource formats.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-10-22 19:14:51 +02:00
Elizabeth Figura
a492d64fef
vkd3d-shader/ir: Allow controlling point sprite through a parameter.
2024-10-22 19:14:02 +02:00
Nikolay Sivov
8a3fe9cd1e
vkd3d-shader/fx: Implement parsing groups and techniques.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-10-21 18:23:33 +02:00
Giovanni Mascellani
ed4d45355a
vkd3d-shader/ir: Represent the normalisation level with an enumeration.
2024-10-21 18:21:39 +02:00
Shaun Ren
abed6d9cb7
vkd3d-shader/tpf: Implement semantics for domain shaders.
2024-10-21 18:18:25 +02:00
Shaun Ren
0273ff007b
vkd3d-shader/tpf: Write domain shader declarations.
2024-10-21 18:18:00 +02:00
Shaun Ren
26efba30b4
vkd3d-shader/tpf: Use vpc input registers for domain shaders.
2024-10-21 18:17:06 +02:00
Shaun Ren
2b897296a1
vkd3d-shader/tpf: Write the input signature of domain shaders as PCSG.
2024-10-21 18:16:50 +02:00
Shaun Ren
768b19d410
vkd3d-shader/ir: Validate control point counts correctly.
...
Allow zero input control points for domain shaders, and zero output
control points for hull shaders.
2024-10-21 18:10:13 +02:00
Giovanni Mascellani
03ad04c890
vkd3d-shader/ir: Validate OUTCONTROLPOINT registers.
2024-10-17 17:34:55 +02:00
Giovanni Mascellani
1e86f00247
vkd3d-shader/ir: Validate INCONTROLPOINT registers.
2024-10-17 17:34:55 +02:00
Giovanni Mascellani
a4ab53ab7b
vkd3d-shader/ir: Validate PATCHCONST registers.
2024-10-17 17:34:55 +02:00
Giovanni Mascellani
62d5bc91f5
vkd3d-shader/ir: Validate OUTPUT registers.
2024-10-17 17:34:55 +02:00
Giovanni Mascellani
349fdd0843
vkd3d-shader/ir: Validate INPUT registers.
2024-10-17 17:34:55 +02:00
Giovanni Mascellani
d9508558a9
vkd3d-shader: Keep track of whether programs have normalised hull shader control point I/O.
2024-10-17 17:34:55 +02:00
Giovanni Mascellani
eba8fd4720
vkd3d-shader: Keep track of whether programs have normalised I/O.
2024-10-17 17:34:55 +02:00
Nikolay Sivov
071130b944
vkd3d-shader/fx: Add support for tracing annotations.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-10-17 17:32:54 +02:00
Elizabeth Figura
eeb7bbe3c5
vkd3d-shader/hlsl: Handle error expressions in ternary expressions.
2024-10-17 17:28:52 +02:00
Elizabeth Figura
d95962068a
vkd3d-shader/hlsl: Handle error expressions in initializers.
2024-10-17 17:28:52 +02:00
Elizabeth Figura
dfe79cb6a9
vkd3d-shader/hlsl: Factor the component count check into initialize_var().
2024-10-17 17:28:52 +02:00
Elizabeth Figura
d8892a4ca2
vkd3d-shader/hlsl: Store the initializer location in struct parse_initializer.
2024-10-17 17:28:52 +02:00
Elizabeth Figura
44ea7b5e12
vkd3d-shader/hlsl: Factor out an initialize_var() helper.
2024-10-17 17:28:52 +02:00
Giovanni Mascellani
0e43dea42d
vkd3d-shader/ir: Check that signature masks are contiguous.
2024-10-17 17:28:52 +02:00
Giovanni Mascellani
083b87c712
vkd3d-shader/d3dbc: Make signature masks contiguous.
...
The goal is to make a requirement for VSIR that signature element
masks are always contiguous. The SPIR-V backend already implicitly
makes that assumption, since it just consider the LSB and popcount
of the mask.
For example, consider this HLSL pixel shader:
float4 main(float4 color : COLOR) : SV_Target
{
return float4(color.x, 10.0f, 11.0f, color.w);
}
Currently the parser describes the input signature element
corresponding to semantic COLOR as having mask .xw, which is
sensible. However, the SPIR-V parser will interpret that as
a mask starting at x and with popcount 2, and assuming it is
contiguous it will implicitly act as if it were .xy. This is
not correct, because the wrong component will be loaded from
the vertex stage.
2024-10-17 17:28:52 +02:00
Giovanni Mascellani
2b45878ff8
vkd3d-shader/ir: Validate the line density SV_TessFactor signature element for isolines domains.
2024-10-16 21:40:58 +02:00
Giovanni Mascellani
f470eb2a1a
vkd3d-shader/ir: Validate the line detail SV_TessFactor signature element for isolines domains.
2024-10-16 21:40:58 +02:00
Giovanni Mascellani
c5c3151414
vkd3d-shader/ir: Validate SV_InsideTessFactor signature elements for tri domains.
2024-10-16 21:40:58 +02:00
Giovanni Mascellani
4e8b34c075
vkd3d-shader/ir: Validate SV_TessFactor signature elements for tri domains.
2024-10-16 21:40:58 +02:00
Giovanni Mascellani
b2460a6794
vkd3d-shader/ir: Validate SV_InsideTessFactor signature elements for quad domains.
2024-10-16 21:40:58 +02:00
Giovanni Mascellani
a8b9a92c10
vkd3d-shader/ir: Validate SV_TessFactor signature elements for quad domains.
2024-10-16 21:40:58 +02:00
Shaun Ren
1ed5f1a4d0
vkd3d-shader/tpf: Write the patch constant function in hull shaders.
...
We use a single hs_fork_phase here for the patch constant function.
2024-10-16 21:40:40 +02:00
Shaun Ren
ae2d86b99c
vkd3d-shader/tpf: Determine SIV from SV and index in write_sm4_dcl_semantic().
2024-10-16 21:12:29 +02:00
Shaun Ren
df3aaac7cf
vkd3d-shader/tpf: Introduce tpf_write_shader_function().
2024-10-16 21:12:13 +02:00
Shaun Ren
147f8898ca
vkd3d-shader/hlsl: Process the patch constant function in hlsl_emit_bytecode().
...
Also, support patch constant function semantics in sm4_sysval_semantic_from_semantic_name().
2024-10-16 21:10:24 +02:00
Shaun Ren
cbed70c60f
vkd3d-shader/tpf: Implement semantics for hull shaders.
2024-10-16 21:07:53 +02:00
Shaun Ren
beb342ed5f
vkd3d-shader/tpf: Write hull shader declarations.
2024-10-16 21:07:53 +02:00
Henri Verbeet
47fcbc335b
vkd3d-shader/d3dbc: Avoid D3DXSHADER_CONSTANTTABLE.
2024-10-16 21:07:53 +02:00