Commit Graph

3494 Commits

Author SHA1 Message Date
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
Shaun Ren
069b8aac64 vkd3d-shader/hlsl: Implement struct single inheritance.
Here, we implement single inheritance by inserting a field at the
beginning of the derived struct with name "$super".

For the following struct declarations

  struct a
  {
      float4 aa;
      float4 bb;
  };

  struct b : a
  {
      float4 cc;
  };

  struct c : b
  {
      float4 bb;
  };

this commit generates the following:

  struct a
  {
      float4 aa;
      float4 bb;
  };

  struct b
  {
      struct a $super;
      float4 cc;
  };

  struct c
  {
      struct b $super;
      float4 bb;
  };
2024-10-16 21:07:53 +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
10442369d8 vkd3d-shader/tpf: Pass a tpf_compiler structure to tpf_compile() callees. 2024-10-16 17:26:47 +02:00
Francisco Casas
16d9a10dd5 vkd3d-shader/tpf: Rename "tpf_writer" to "tpf_compiler".
Analog to d3dbc_compiler.
2024-10-16 17:09:15 +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
Giovanni Mascellani
7f834f57e5 vkd3d-shader/ir: Validate that signatures are sensible for shader type. 2024-10-15 16:47:04 +02:00
Giovanni Mascellani
859b911b3a vkd3d-shader/ir: Validate the output control point count. 2024-10-15 16:47:04 +02:00
Giovanni Mascellani
bd3ba87747 vkd3d-shader/ir: Validate the input control point count. 2024-10-15 16:47:04 +02:00
Henri Verbeet
90616be301 vkd3d-shader/dxil: Shift register write masks by the component index in sm6_parser_emit_dx_store_output().
To account for the change we made in commit
c571a45e65 on the SPIR-V side.
2024-10-15 16:45:28 +02:00
Francisco Casas
104435df5f vkd3d-shader/tpf: Use dcl_input_ps_sgv for sv_isfrontface.
As the native compiler does.
2024-10-15 16:44:38 +02:00