tests: Test FFP point size clamping.

This commit is contained in:
Elizabeth Figura 2024-10-03 17:55:33 -05:00 committed by Henri Verbeet
parent 1e3c1392bd
commit cd249a47b8
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
6 changed files with 72 additions and 3 deletions

View File

@ -21,7 +21,36 @@ float4 main() : sv_target
} }
[test] [test]
point-size 40.0 clear rtv 0 0 0 0 0
point-size 40.0 1.0 64.0
draw point list 2
probe (139, 240) rgba (0, 0, 0, 0)
probe (141, 240) rgba (0, 1, 0, 1)
probe (179, 240) rgba (0, 1, 0, 1)
probe (181, 240) rgba (0, 0, 0, 0)
probe (459, 240) rgba (0, 0, 0, 0)
probe (461, 240) rgba (0, 1, 0, 1)
probe (499, 240) rgba (0, 1, 0, 1)
probe (501, 240) rgba (0, 0, 0, 0)
clear rtv 0 0 0 0 0
point-size 40.0 1.0 20.0
draw point list 2
probe (149, 240) rgba (0, 0, 0, 0)
probe (151, 240) rgba (0, 1, 0, 1)
probe (169, 240) rgba (0, 1, 0, 1)
probe (171, 240) rgba (0, 0, 0, 0)
probe (469, 240) rgba (0, 0, 0, 0)
probe (471, 240) rgba (0, 1, 0, 1)
probe (489, 240) rgba (0, 1, 0, 1)
probe (491, 240) rgba (0, 0, 0, 0)
clear rtv 0 0 0 0 0
point-size 20.0 40.0 64.0
draw point list 2 draw point list 2
probe (139, 240) rgba (0, 0, 0, 0) probe (139, 240) rgba (0, 0, 0, 0)

View File

@ -21,6 +21,7 @@ float4 main() : color
} }
[test] [test]
clear rtv 0 0 0 0 0
draw point list 2 draw point list 2
probe (149, 240) rgba (0, 0, 0, 0) probe (149, 240) rgba (0, 0, 0, 0)
@ -32,3 +33,22 @@ probe (459, 240) rgba (0, 0, 0, 0)
probe (461, 240) rgba (0, 1, 0, 1) probe (461, 240) rgba (0, 1, 0, 1)
probe (499, 240) rgba (0, 1, 0, 1) probe (499, 240) rgba (0, 1, 0, 1)
probe (501, 240) rgba (0, 0, 0, 0) probe (501, 240) rgba (0, 0, 0, 0)
[require]
shader model < 4.0
point-size
[test]
clear rtv 0 0 0 0 0
point-size 1.0 24.0 36.0
draw point list 2
probe (147, 240) rgba (0, 0, 0, 0)
probe (149, 240) rgba (0, 1, 0, 1)
probe (171, 240) rgba (0, 1, 0, 1)
probe (173, 240) rgba (0, 0, 0, 0)
probe (461, 240) rgba (0, 0, 0, 0)
probe (463, 240) rgba (0, 1, 0, 1)
probe (497, 240) rgba (0, 1, 0, 1)
probe (499, 240) rgba (0, 0, 0, 0)

View File

@ -1326,6 +1326,10 @@ static void parse_test_directive(struct shader_runner *runner, const char *line)
else if (match_string(line, "point-size", &line)) else if (match_string(line, "point-size", &line))
{ {
runner->point_size = strtof(line, &rest); runner->point_size = strtof(line, &rest);
line = rest;
runner->point_size_min = strtof(line, &rest);
line = rest;
runner->point_size_max = strtof(line, &rest);
} }
else else
{ {
@ -1706,6 +1710,8 @@ void run_shader_tests(struct shader_runner *runner, const struct shader_runner_c
runner->maximum_shader_model = caps->maximum_shader_model; runner->maximum_shader_model = caps->maximum_shader_model;
runner->alpha_test_func = VKD3D_SHADER_COMPARISON_FUNC_ALWAYS; runner->alpha_test_func = VKD3D_SHADER_COMPARISON_FUNC_ALWAYS;
runner->point_size = 1.0f; runner->point_size = 1.0f;
runner->point_size_min = 1.0f;
runner->point_size_max = FLT_MAX;
runner->sample_mask = ~0u; runner->sample_mask = ~0u;
runner->depth_bounds = false; runner->depth_bounds = false;

View File

@ -221,7 +221,7 @@ struct shader_runner
bool flat_shading; bool flat_shading;
uint8_t clip_plane_mask; uint8_t clip_plane_mask;
struct vec4 clip_planes[8]; struct vec4 clip_planes[8];
float point_size; float point_size, point_size_min, point_size_max;
}; };
struct shader_runner_ops struct shader_runner_ops

View File

@ -488,6 +488,10 @@ static bool d3d9_runner_draw(struct shader_runner *r,
hr = IDirect3DDevice9_SetRenderState(device, D3DRS_POINTSIZE, float_to_int(runner->r.point_size)); hr = IDirect3DDevice9_SetRenderState(device, D3DRS_POINTSIZE, float_to_int(runner->r.point_size));
ok(hr == D3D_OK, "Failed to set render state, hr %#lx.\n", hr); ok(hr == D3D_OK, "Failed to set render state, hr %#lx.\n", hr);
hr = IDirect3DDevice9_SetRenderState(device, D3DRS_POINTSIZE_MIN, float_to_int(runner->r.point_size_min));
ok(hr == D3D_OK, "Failed to set render state, hr %#lx.\n", hr);
hr = IDirect3DDevice9_SetRenderState(device, D3DRS_POINTSIZE_MAX, float_to_int(runner->r.point_size_max));
ok(hr == D3D_OK, "Failed to set render state, hr %#lx.\n", hr);
hr = IDirect3DDevice9_CreateVertexDeclaration(device, decl_elements, &vertex_declaration); hr = IDirect3DDevice9_CreateVertexDeclaration(device, decl_elements, &vertex_declaration);
ok(hr == D3D_OK, "Failed to create vertex declaration, hr %#lx.\n", hr); ok(hr == D3D_OK, "Failed to create vertex declaration, hr %#lx.\n", hr);

View File

@ -274,7 +274,7 @@ static bool compile_shader(struct vulkan_shader_runner *runner, const char *sour
enum vkd3d_shader_spirv_extension spirv_extensions[2]; enum vkd3d_shader_spirv_extension spirv_extensions[2];
struct vkd3d_shader_resource_binding *binding; struct vkd3d_shader_resource_binding *binding;
struct vkd3d_shader_compile_option options[3]; struct vkd3d_shader_compile_option options[3];
struct vkd3d_shader_parameter1 parameters[14]; struct vkd3d_shader_parameter1 parameters[16];
struct vkd3d_shader_compile_option *option; struct vkd3d_shader_compile_option *option;
unsigned int i, compile_options; unsigned int i, compile_options;
char profile[7]; char profile[7];
@ -462,6 +462,16 @@ static bool compile_shader(struct vulkan_shader_runner *runner, const char *sour
parameters[13].data_type = VKD3D_SHADER_PARAMETER_DATA_TYPE_FLOAT32; parameters[13].data_type = VKD3D_SHADER_PARAMETER_DATA_TYPE_FLOAT32;
parameters[13].u.immediate_constant.u.f32 = runner->r.point_size; parameters[13].u.immediate_constant.u.f32 = runner->r.point_size;
parameters[14].name = VKD3D_SHADER_PARAMETER_NAME_POINT_SIZE_MIN;
parameters[14].type = VKD3D_SHADER_PARAMETER_TYPE_IMMEDIATE_CONSTANT;
parameters[14].data_type = VKD3D_SHADER_PARAMETER_DATA_TYPE_FLOAT32;
parameters[14].u.immediate_constant.u.f32 = runner->r.point_size_min;
parameters[15].name = VKD3D_SHADER_PARAMETER_NAME_POINT_SIZE_MAX;
parameters[15].type = VKD3D_SHADER_PARAMETER_TYPE_IMMEDIATE_CONSTANT;
parameters[15].data_type = VKD3D_SHADER_PARAMETER_DATA_TYPE_FLOAT32;
parameters[15].u.immediate_constant.u.f32 = runner->r.point_size_max;
parameter_info.parameter_count = ARRAY_SIZE(parameters); parameter_info.parameter_count = ARRAY_SIZE(parameters);
parameter_info.parameters = parameters; parameter_info.parameters = parameters;