tests: Add a test for shader point size output.

This commit is contained in:
Elizabeth Figura 2024-10-03 12:35:11 -05:00 committed by Henri Verbeet
parent 56e5fca501
commit a29a4288d2
Notes: Henri Verbeet 2024-10-10 23:00:15 +02:00
Approved-by: Henri Verbeet (@hverbeet)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1146
4 changed files with 46 additions and 0 deletions

View File

@ -212,6 +212,7 @@ vkd3d_shader_tests = \
tests/hlsl/saturate.shader_test \ tests/hlsl/saturate.shader_test \
tests/hlsl/shade-mode.shader_test \ tests/hlsl/shade-mode.shader_test \
tests/hlsl/shader-interstage-interface.shader_test \ tests/hlsl/shader-interstage-interface.shader_test \
tests/hlsl/shader-point-size.shader_test \
tests/hlsl/shape.shader_test \ tests/hlsl/shape.shader_test \
tests/hlsl/side-effects.shader_test \ tests/hlsl/side-effects.shader_test \
tests/hlsl/sign.shader_test \ tests/hlsl/sign.shader_test \

View File

@ -0,0 +1,34 @@
[require]
shader model < 4.0
[input layout]
0 r32g32-float position
0 r32-float psize
[vb 0]
-0.5 0 20
0.5 0 40
[vertex shader]
void main(inout float4 pos : position, inout float size : psize)
{
}
[pixel shader]
float4 main() : color
{
return float4(0, 1, 0, 1);
}
[test]
draw point list 2
probe (149, 240) rgba (0, 0, 0, 0)
todo probe (151, 240) rgba (0, 1, 0, 1)
todo probe (169, 240) rgba (0, 1, 0, 1)
probe (171, 240) rgba (0, 0, 0, 0)
probe (459, 240) rgba (0, 0, 0, 0)
todo probe (461, 240) rgba (0, 1, 0, 1)
todo probe (499, 240) rgba (0, 1, 0, 1)
probe (501, 240) rgba (0, 0, 0, 0)

View File

@ -300,6 +300,9 @@ static D3DDECLTYPE vertex_decl_type_from_format(DXGI_FORMAT format)
{ {
switch (format) switch (format)
{ {
case DXGI_FORMAT_R32_FLOAT:
return D3DDECLTYPE_FLOAT1;
case DXGI_FORMAT_R32G32_FLOAT: case DXGI_FORMAT_R32G32_FLOAT:
return D3DDECLTYPE_FLOAT2; return D3DDECLTYPE_FLOAT2;
@ -315,6 +318,8 @@ static D3DDECLUSAGE vertex_decl_usage_from_name(const char *name)
{ {
if (!strcasecmp(name, "position") || !strcasecmp(name, "sv_position")) if (!strcasecmp(name, "position") || !strcasecmp(name, "sv_position"))
return D3DDECLUSAGE_POSITION; return D3DDECLUSAGE_POSITION;
if (!strcasecmp(name, "psize"))
return D3DDECLUSAGE_PSIZE;
if (!strcasecmp(name, "texcoord")) if (!strcasecmp(name, "texcoord"))
return D3DDECLUSAGE_TEXCOORD; return D3DDECLUSAGE_TEXCOORD;
fatal_error("Cannot translate usage \"%s\" to a d3d9 usage.\n", name); fatal_error("Cannot translate usage \"%s\" to a d3d9 usage.\n", name);
@ -501,6 +506,10 @@ static bool d3d9_runner_draw(struct shader_runner *r,
switch (primitive_topology) switch (primitive_topology)
{ {
case D3D_PRIMITIVE_TOPOLOGY_POINTLIST:
hr = IDirect3DDevice9_DrawPrimitive(device, D3DPT_POINTLIST, 0, vertex_count);
break;
case D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST: case D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST:
hr = IDirect3DDevice9_DrawPrimitive(device, D3DPT_TRIANGLELIST, 0, vertex_count / 3); hr = IDirect3DDevice9_DrawPrimitive(device, D3DPT_TRIANGLELIST, 0, vertex_count / 3);
break; break;

View File

@ -515,6 +515,8 @@ static VkPrimitiveTopology vulkan_primitive_topology_from_d3d(D3D_PRIMITIVE_TOPO
default: default:
fatal_error("Unhandled primitive topology %#x.\n", topology); fatal_error("Unhandled primitive topology %#x.\n", topology);
/* fall through */ /* fall through */
case D3D_PRIMITIVE_TOPOLOGY_POINTLIST:
return VK_PRIMITIVE_TOPOLOGY_POINT_LIST;
case D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST: case D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST:
return VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST; return VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST;
case D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP: case D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP: