vkd3d-shader/hlsl: Error out when an output semantic is used more than once.

The use of the hlsl_semantic.reported_duplicated_output_next_index field
allows reporting multiple overlapping indexes, such as in the following
vertex shader:

    void main(out float1x3 x : OVERLAP0, out float1x3 y : OVERLAP1)
    {
        x = float3(1.0, 2.0, 3.2);
        y = float3(5.0, 6.0, 5.0);
    }

    apple.hlsl:1:41: E5013: Output semantic "OVERLAP1" is used multiple times.
    apple.hlsl:1:13: First use of "OVERLAP1" is here.
    apple.hlsl:1:41: E5013: Output semantic "OVERLAP2" is used multiple times.
    apple.hlsl:1:13: First use of "OVERLAP2" is here.

While at the same time avoiding reporting overlaps more than once for
large arrays:

    struct apple
    {
        float2 p : sv_position;
    };

    void main(out apple aps[4])
    {
    }

    apple.hlsl:3:8: E5013: Output semantic "sv_position0" is used multiple times.
    apple.hlsl:3:8: First use of "sv_position0" is here.
This commit is contained in:
Francisco Casas
2023-04-12 15:59:06 -04:00
committed by Alexandre Julliard
parent edc72fdefc
commit d96e9665b1
Notes: Alexandre Julliard 2023-05-01 22:24:44 +02:00
Approved-by: Giovanni Mascellani (@giomasce)
Approved-by: Zebediah Figura (@zfigura)
Approved-by: Henri Verbeet (@hverbeet)
Approved-by: Alexandre Julliard (@julliard)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/148
5 changed files with 38 additions and 16 deletions

View File

@@ -205,7 +205,7 @@ probe (0, 0) rgba (1.0, 2.0, 10.0, 20.0)
% Output semantics cannot be mapped to more than one value.
[vertex shader fail todo]
[vertex shader fail]
struct apple
{
float2 tex : TEXCOORD0;
@@ -218,7 +218,7 @@ void main(out apple apls[2], inout float4 pos : sv_position)
}
[vertex shader fail todo]
[vertex shader fail]
struct apple
{
float2 f : SEMANTIC;
@@ -232,7 +232,7 @@ void main(out apple a, out apple b, inout float4 pos : sv_position)
% Semantic names are case-insensitive.
[vertex shader fail todo]
[vertex shader fail]
void main(out float2 a : sem0, out float2 b : SEM, inout float4 pos : sv_position)
{
a = float2(1, 2);

View File

@@ -63,7 +63,7 @@ probe render target 1 all r (2.0)
probe render target 2 all r (3.0)
probe render target 3 all r (4.0)
[pixel shader fail todo]
[pixel shader fail]
void main(out float1x2 x : sv_target0, out float1x2 y : sv_target1)
{
x = float2(1.0, 2.0);