Commit Graph

4026 Commits

Author SHA1 Message Date
Giovanni Mascellani
7fb288819a vkd3d-shader/msl: Set the prefix to "unknown" for unhandled shader types in msl_generator_init().
Like we do for GLSL; there's no reason to abort compilation here. Note
that this also avoids leaking "gen->buffer" and "gen->string_buffers" on
the error path.
2025-04-09 16:08:15 +02:00
Shaun Ren
0c139ef7a0 vkd3d-shader/hlsl: Add special allocation rules for patch constant data. 2025-04-09 16:02:12 +02:00
Shaun Ren
d3b32fefa3 vkd3d-shader/tpf: Support SV_RenderTargetArrayIndex/SV_ViewportArrayIndex sysvals in tessellation shaders. 2025-04-09 16:02:12 +02:00
Shaun Ren
05f8dd8273 vkd3d-shader/hlsl: Prioritize smaller writemasks for all allocators in allocate_semantic_registers(). 2025-04-09 16:02:12 +02:00
Shaun Ren
ec2f18ab17 vkd3d-shader/hlsl: Free all allocators in allocate_semantic_registers(). 2025-04-09 16:02:12 +02:00
Shaun Ren
d1df10ac86 vkd3d-shader/hlsl: Use dcl_output_siv for patch constant function sysval outputs. 2025-04-09 16:02:12 +02:00
Anna (navi) Figueiredo Gomes
3e8b56c509 vkd3d-shader/fx: Don't cast between int and uint in state blocks. 2025-04-08 19:14:15 +02:00
Elizabeth Figura
f576ecc992 vkd3d-shader/hlsl: Introduce a compiler pass to vectorize stores. 2025-04-03 20:29:20 +02:00
Elizabeth Figura
1a999f74fc vkd3d-shader/hlsl: Introduce a compiler pass to vectorize expressions. 2025-04-03 20:29:20 +02:00
Nikolay Sivov
2540081988 vkd3d-shader/fx: Accept int(0) as well as uint(0) constant value for object-type states.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2025-04-02 19:34:25 +02:00
Nikolay Sivov
4ff14104b0 vkd3d-shader/fx: Set GeometryShader state type as an object type.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2025-04-02 19:34:25 +02:00
Elizabeth Figura
ea21dddec9 vkd3d-shader/hlsl: Allow compiling directly to GLSL. 2025-04-02 19:33:41 +02:00
Elizabeth Figura
33cd10581e vkd3d-shader/glsl: Invert gl_FragCoord w. 2025-04-02 19:32:39 +02:00
Francisco Casas
4b9c23272a vkd3d-shader/ir: Reset instruction pointers after shader_instruction_array_insert_at().
Every call to shader_instruction_array_insert_at() means a possible
reallocation of all vsir instructions in the program. This means that all
previous pointers are potentially no longer valid.

We are currently using these potentially invalid pointers in some cases,
usually in the form of "ins->location". This commit fixes these.

I moved all pointer changes to right after the call to
shader_instruction_array_insert_at() to make this more evident.
2025-04-02 19:25:12 +02:00
Giovanni Mascellani
875c5df519 vkd3d-shader/ir: Validate register id and index for CONSTBUFFER registers. 2025-04-02 19:24:10 +02:00
Giovanni Mascellani
c181f147ce vkd3d-shader/ir: Validate register id and index for SAMPLER registers. 2025-04-02 19:08:50 +02:00
Giovanni Mascellani
9b7256c0c8 vkd3d-shader/ir: Validate register id and index for UAV registers. 2025-04-02 19:08:00 +02:00
Giovanni Mascellani
10d8760134 vkd3d-shader/ir: Validate register id and index for RESOURCE registers. 2025-04-02 19:06:43 +02:00
Shaun Ren
7aebed0eea vkd3d-shader/hlsl: Ensure that uniform objects are never written to in copy_propagation_transform_object_load(). 2025-04-02 18:49:52 +02:00
Shaun Ren
b1d8915440 vkd3d-shader/hlsl: Divert written uniform derefs to temps before copy-propagation passes.
The following pixel shader currently triggers an infinite loop during
copy propagation, which is fixed by this commit:

    sampler s;
    Texture2D t1, t2;

    float4 main() : sv_target
    {
        Texture2D t = t1;
        t1 = t2;
        t2 = t;
        return t1.Sample(s, float2(0, 0)) + t2.Sample(s, float2(0, 0));
    }

The infinite loop occurs because copy_propagation_transform_object_load()
replaces t1 in the resource_load(t1, ...) instruction
with t2, t1, t2, ... repeatedly.
2025-04-02 18:49:52 +02:00
Francisco Casas
3ead8d532b vkd3d-shader/hlsl: Allow non-constant deref propagation on SM1.
Note that we still have to preempt the propagation to SM1 pixel shader
uniforms. Otherwise this will turn the many constant derefs that appear
from the <index-val> copy generated in lower_index_loads() into a single
non-constant deref, causing it to allocate all the registers instead of
up until the last one used.
2025-04-02 18:27:16 +02:00
Francisco Casas
f65e6265e0 vkd3d-shader/ir: Normalise MOVA and d3dbc indirect addressing. 2025-04-02 18:27:16 +02:00
Francisco Casas
fd02d69dda vkd3d-shader/hlsl: Implement indirect addressing for d3dbc target profiles. 2025-04-02 18:26:03 +02:00
Francisco Casas
0e0ed72652 vkd3d-shader/d3dbc: Respect "idx_count" when writing registers.
Some SM1 src registers have idx_count = 0, in which case we have to
respect that instead of always reading reg->reg.idx[0].offset even when
it is invalid.
2025-04-02 18:06:48 +02:00
Elizabeth Figura
20b76f87bf vkd3d-shader/hlsl: Initialize the temp count for sm1. 2025-04-02 17:58:26 +02:00