tests: Avoid using "SV_Position" as a name for the vertex shader input.

We use vkd3d_shader_find_signature_element() in the Vulkan runner, and
vkd3d-shader translates SM1 position to "POSITION".
This commit is contained in:
Zebediah Figura 2022-08-15 19:53:55 -05:00 committed by Alexandre Julliard
parent aa44f9b390
commit 6a514ebe8e
Notes: Alexandre Julliard 2023-12-14 23:31:52 +01:00
Approved-by: Giovanni Mascellani (@giomasce)
Approved-by: Henri Verbeet (@hverbeet)
Approved-by: Alexandre Julliard (@julliard)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/518
6 changed files with 37 additions and 15 deletions

View File

@ -2,9 +2,10 @@
% definition and its declarations.
[vertex shader]
void main(out float tex : texcoord, inout float4 pos : sv_position)
void main(float4 pos : position, out float tex : texcoord, out float4 out_pos : sv_position)
{
tex = 0.2;
out_pos = pos;
}
[pixel shader fail]
@ -53,12 +54,13 @@ probe (0, 0) rgba (0.2, 0.2, 0.2, 0.2)
[vertex shader]
void main(out float4 tex[4] : texcoord, inout float4 pos : sv_position)
void main(float4 pos : position, out float4 tex[4] : texcoord, out float4 out_pos : sv_position)
{
tex[0] = float4(10.0, 11.0, 12.0, 13.0);
tex[1] = float4(20.0, 21.0, 22.0, 23.0);
tex[2] = float4(30.0, 31.0, 32.0, 33.0);
tex[3] = float4(40.0, 41.0, 42.0, 43.0);
out_pos = pos;
}
@ -196,10 +198,11 @@ struct apple
float4 tex[2] : TEXCOORD0;
};
void main(out apple apl, inout float4 pos : sv_position)
void main(float4 pos : position, out apple apl, out float4 out_pos : sv_position)
{
apl.tex[0] = float4(1, 2, 3, 4);
apl.tex[1] = float4(10, 20, 30, 40);
out_pos = pos;
}
[pixel shader]
@ -220,10 +223,11 @@ struct apple
float2 tex : TEXCOORD0;
};
void main(out apple apls[2], inout float4 pos : sv_position)
void main(float4 pos : position, out apple apls[2], out float4 out_pos : sv_position)
{
apls[0].tex = float2(1, 2);
apls[1].tex = float2(3, 4);
out_pos = pos;
}
@ -233,29 +237,32 @@ struct apple
float2 f : SEMANTIC;
};
void main(out apple a, out apple b, inout float4 pos : sv_position)
void main(float4 pos : position, out apple a, out apple b, out float4 out_pos : sv_position)
{
a.f = float2(1, 2);
b.f = float2(3, 4);
out_pos = pos;
}
% Semantic names are case-insensitive.
[vertex shader fail]
void main(out float2 a : sem0, out float2 b : SEM, inout float4 pos : sv_position)
void main(float4 pos : position, out float2 a : sem0, out float2 b : SEM, out float4 out_pos : sv_position)
{
a = float2(1, 2);
b = float2(3, 4);
out_pos = pos;
}
[vertex shader]
void main(out float4 tex[4] : texcoord, inout float4 pos : sv_position)
void main(float4 pos : position, out float4 tex[4] : texcoord, out float4 out_pos : sv_position)
{
tex[0] = float4(10.0, 11.0, 12.0, 13.0);
tex[1] = float4(20.0, 21.0, 22.0, 23.0);
tex[2] = float4(30.0, 31.0, 32.0, 33.0);
tex[3] = float4(40.0, 41.0, 42.0, 43.0);
out_pos = pos;
}

View File

@ -1,7 +1,8 @@
[vertex shader]
void main(out float tex : texcoord, inout float4 pos : sv_position)
void main(float4 pos : position, out float tex : texcoord, out float4 out_pos : sv_position)
{
tex = pos.x;
out_pos = pos;
}
[pixel shader]

View File

@ -12,9 +12,10 @@ levels 2
0.0 0.0 1.0 0.0
[vertex shader]
void main(out float2 tex : texcoord, inout float4 pos : sv_position)
void main(float4 pos : position, out float2 tex : texcoord, out float4 out_pos : sv_position)
{
tex = pos.xy;
out_pos = pos;
}
[pixel shader]

View File

@ -1,6 +1,6 @@
[input layout]
0 r32g32b32a32 float texcoord
0 r32g32 float sv_position
0 r32g32 float position
[vertex buffer 0]
0.0 1.0 0.0 1.0 -2.0 -2.0
@ -10,7 +10,16 @@
[vertex shader]
struct vertex
struct in_vertex
{
struct
{
float4 texcoord : texcoord;
float4 pos : position;
} m;
};
struct out_vertex
{
struct
{
@ -19,8 +28,10 @@ struct vertex
} m;
};
void main(inout struct vertex v)
void main(struct in_vertex i, out struct out_vertex o)
{
o.m.pos = i.m.pos;
o.m.texcoord = i.m.texcoord;
}
[pixel shader]

View File

@ -1,7 +1,8 @@
[vertex shader]
void main(out float tex : texcoord, inout float4 pos : sv_position)
void main(float4 pos : position, out float tex : texcoord, out float4 out_pos : sv_position)
{
tex = (pos.x + 1) * 320;
out_pos = pos;
}
[pixel shader]

View File

@ -579,8 +579,9 @@ static void parse_test_directive(struct shader_runner *runner, const char *line)
};
static const char vs_source[] =
"void main(inout float4 position : sv_position)\n"
"float4 main(float4 pos : position) : sv_position\n"
"{\n"
" return pos;\n"
"}";
if (!shader_runner_get_resource(runner, RESOURCE_TYPE_RENDER_TARGET, 0))
@ -601,7 +602,7 @@ static void parse_test_directive(struct shader_runner *runner, const char *line)
vkd3d_array_reserve((void **)&runner->input_elements, &runner->input_element_capacity,
1, sizeof(*runner->input_elements));
element = &runner->input_elements[0];
element->name = strdup("sv_position");
element->name = strdup("position");
element->slot = 0;
element->format = DXGI_FORMAT_R32G32_FLOAT;
element->texel_size = sizeof(*quad);