Commit Graph

4015 Commits

Author SHA1 Message Date
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
Elizabeth Figura
7cb5a7bebc vkd3d-shader/hlsl: Leave the swizzle zero for VSIR_DIMENSION_NONE registers. 2025-04-02 17:58:26 +02:00
Elizabeth Figura
950f78041a vkd3d-shader/hlsl: Initialize the vsir dimension for sm1. 2025-04-02 17:58:26 +02:00
Elizabeth Figura
856f4b55f6 vkd3d-shader/hlsl: Set the correct index count for sm1 DEPTHOUT. 2025-04-02 17:58:26 +02:00
Elizabeth Figura
227e2cc0f5 vkd3d-shader/hlsl: Use vsir_*_from_hlsl_node() helpers in more places. 2025-04-02 17:58:18 +02:00
Nikolay Sivov
21e08955d3 vkd3d-shader/fx: Pad fx_2_0 object data blobs with zeroes.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2025-03-18 15:56:32 +01:00
Shaun Ren
62c00be873 vkd3d-shader/tpf: Emit geometry shader property declarations. 2025-03-18 15:46:07 +01:00
Shaun Ren
bd055fac1c vkd3d-shader/hlsl: Store geometry shader properties in struct vsir_program. 2025-03-18 15:46:02 +01:00
Shaun Ren
b1ace5763a vkd3d-shader/hlsl: Implement input semantics for geometry shaders. 2025-03-18 15:40:11 +01:00
Shaun Ren
8af3173955 vkd3d-shader/hlsl: Support input primitive arrays in geometry shaders. 2025-03-18 15:40:11 +01:00
Giovanni Mascellani
2377db33db vkd3d-shader: Represent descriptor information in the vsir program. 2025-03-18 15:38:01 +01:00
Giovanni Mascellani
4308fa3f68 vkd3d-shader/spirv: Do not steal the instruction array from the vsir program.
There is no need, and it only complicates tracking ownership.
2025-03-18 15:37:57 +01:00