Commit Graph

499 Commits

Author SHA1 Message Date
Francisco Casas
5b4af411f5 vkd3d-shader/hlsl: Store SM4 loads in the vsir program. 2024-11-21 19:28:46 +01:00
Francisco Casas
874ca85a95 vkd3d-shader/hlsl: Store SM4 stores in the vsir program. 2024-11-21 19:28:46 +01:00
Elizabeth Figura
683e11aece vkd3d-shader/hlsl: Silence a spurious -Wmaybe-uninitialized in sm4_generate_vsir_instr_dcl_semantic(). 2024-11-14 14:12:13 +01:00
Francisco Casas
5df836c513 vkd3d-shader/hlsl: Store SM4 MOD in the vsir program. 2024-11-06 22:49:12 +01:00
Francisco Casas
30bc6965a2 vkd3d-shader/hlsl: Store SM4 DOT in the vsir program. 2024-11-06 22:48:13 +01:00
Francisco Casas
e8b373e3ff vkd3d-shader/hlsl: Store SM4 DIV in the vsir program. 2024-11-06 22:47:42 +01:00
Francisco Casas
24f4308982 vkd3d-shader/hlsl: Store SM4 MUL in the vsir program. 2024-11-06 22:45:46 +01:00
Francisco Casas
e4d36bd855 vkd3d-shader/hlsl: Store SM4 SAT in the vsir program. 2024-11-06 22:45:23 +01:00
Francisco Casas
2e3f4a01bf vkd3d-shader/hlsl: Store SM4 RCP in the vsir program. 2024-11-06 22:40:50 +01:00
Francisco Casas
3c4889add3 vkd3d-shader/hlsl: Store SM4 SIN and COS in the vsir program. 2024-11-06 22:38:04 +01:00
Francisco Casas
befba8e813 vkd3d-shader/hlsl: Store SM4 casts in the vsir program. 2024-11-06 22:27:49 +01:00
Elizabeth Figura
4290d85397 vkd3d-shader/hlsl: Write all writemask components for PSIZE and FOG outputs.
Matching fxc/d3dcompiler.
2024-11-05 19:58:49 +01:00
Elizabeth Figura
5a513ffcec vkd3d-shader/hlsl: Enforce FOG component count for sm1 VS output. 2024-11-05 19:53:24 +01:00
Elizabeth Figura
f50b20ddd6 vkd3d-shader/hlsl: Enforce PSIZE component count for sm1 VS output. 2024-11-05 19:53:24 +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
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
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
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
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
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
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
Giovanni Mascellani
ed4d45355a vkd3d-shader/ir: Represent the normalisation level with an enumeration. 2024-10-21 18:21:39 +02:00
Shaun Ren
0273ff007b vkd3d-shader/tpf: Write domain shader declarations. 2024-10-21 18:18:00 +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
Giovanni Mascellani
eba8fd4720 vkd3d-shader: Keep track of whether programs have normalised I/O. 2024-10-17 17:34:55 +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
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
Francisco Casas
7eee877dd4 vkd3d-shader/tpf: Make hlsl_sm4_register_from_semantic() independent of HLSL IR. 2024-10-16 21:07:51 +02:00
Francisco Casas
a243862b8c vkd3d-shader/tpf: Make sysval_semantic_from_hlsl() independent of HLSL IR. 2024-10-16 21:05:10 +02:00
Francisco Casas
7cc8151b81 vkd3d-shader/tpf: Replace uses of ctx->profile with tpf->program->shader_version. 2024-10-16 18:50:15 +02:00
Francisco Casas
c75fbaf94e vkd3d-shader/tpf: Use the I/O signatures from the vsir program in tpf_write_signature(). 2024-10-16 17:40:26 +02:00
Francisco Casas
5b21cc67f1 vkd3d-shader/hlsl: Split hlsl_sm4_write().
Similarly to the already done split from

    HLSL IR -> d3dbc

to

    HLSL IR -> vsir -> d3bc

we now start splitting the

    HLSL IR -> tpf

translation into

    HLSL IR -> vsir -> tpf

So hlsl_sm4_write is split into two functions, sm4_generate_vsir() and
tpf_compile().

This translation should be completed once tpf_compile() no longer needs
the hlsl_ctx and entry_func parameters.
2024-10-16 17:08:50 +02:00
Francisco Casas
3601397703 vkd3d-shader/d3dbc: Remove the "hlsl_" prefix from external functions.
They no longer rely on HLSL IR.

Also, rename them from "_from_semantic" to "from_semantic_name".
2024-10-16 16:52:45 +02:00
Shaun Ren
cb55ba5b9b vkd3d-shader/hlsl: Invoke prepend_uniform_copy() only once for global uniforms.
We store the copy instructions in a separate block that is cloned for
each function processed.
2024-10-15 16:42:47 +02:00
Shaun Ren
0c5dc53fd2 vkd3d-shader/hlsl: Allocate temporary registers separately for each entry function. 2024-10-15 16:39:50 +02:00