mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2024-11-21 16:46:41 -08:00
tests: Test point sprite.
This commit is contained in:
parent
a492d64fef
commit
6fd1a1ce7e
Notes:
Henri Verbeet
2024-10-22 20:53:34 +02:00
Approved-by: Henri Verbeet (@hverbeet) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1188
@ -190,6 +190,7 @@ vkd3d_shader_tests = \
|
|||||||
tests/hlsl/object-field-offsets.shader_test \
|
tests/hlsl/object-field-offsets.shader_test \
|
||||||
tests/hlsl/object-parameters.shader_test \
|
tests/hlsl/object-parameters.shader_test \
|
||||||
tests/hlsl/object-references.shader_test \
|
tests/hlsl/object-references.shader_test \
|
||||||
|
tests/hlsl/point-sprite.shader_test \
|
||||||
tests/hlsl/pointer-cast.shader_test \
|
tests/hlsl/pointer-cast.shader_test \
|
||||||
tests/hlsl/pow.shader_test \
|
tests/hlsl/pow.shader_test \
|
||||||
tests/hlsl/precise-modifier.shader_test \
|
tests/hlsl/precise-modifier.shader_test \
|
||||||
|
48
tests/hlsl/point-sprite.shader_test
Normal file
48
tests/hlsl/point-sprite.shader_test
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
[require]
|
||||||
|
point-size
|
||||||
|
% For tex2D() with newer shader models.
|
||||||
|
options: backcompat
|
||||||
|
shader model < 6.0
|
||||||
|
|
||||||
|
[sampler 0]
|
||||||
|
filter linear linear linear
|
||||||
|
address clamp clamp clamp
|
||||||
|
|
||||||
|
[srv 0]
|
||||||
|
size (2d, 2, 2)
|
||||||
|
1 1 0 1 0 1 1 1
|
||||||
|
1 0 0 1 1 0 1 1
|
||||||
|
|
||||||
|
[vertex shader]
|
||||||
|
float4 main(out float2 t : texcoord) : sv_position
|
||||||
|
{
|
||||||
|
t = float2(1, 1);
|
||||||
|
return float4(0, 0, 0, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
[pixel shader]
|
||||||
|
sampler2D s;
|
||||||
|
|
||||||
|
float4 main(float2 t : texcoord) : sv_target
|
||||||
|
{
|
||||||
|
return tex2D(s, t);
|
||||||
|
}
|
||||||
|
|
||||||
|
[test]
|
||||||
|
clear rtv 0 0 0 0 0
|
||||||
|
point-size 30.0 1.0 64.0
|
||||||
|
point-sprite off
|
||||||
|
draw point list 1
|
||||||
|
probe (310, 230) rgba (1, 0, 1, 1)
|
||||||
|
probe (330, 230) rgba (1, 0, 1, 1)
|
||||||
|
probe (310, 250) rgba (1, 0, 1, 1)
|
||||||
|
probe (330, 250) rgba (1, 0, 1, 1)
|
||||||
|
|
||||||
|
clear rtv 0 0 0 0 0
|
||||||
|
point-size 30.0 1.0 64.0
|
||||||
|
point-sprite on
|
||||||
|
draw point list 1
|
||||||
|
probe (310, 230) rgba (1, 1, 0, 1)
|
||||||
|
probe (330, 230) rgba (0, 1, 1, 1)
|
||||||
|
probe (310, 250) rgba (1, 0, 0, 1)
|
||||||
|
probe (330, 250) rgba (1, 0, 1, 1)
|
@ -1335,6 +1335,13 @@ static void parse_test_directive(struct shader_runner *runner, const char *line)
|
|||||||
line = rest;
|
line = rest;
|
||||||
runner->point_size_max = strtof(line, &rest);
|
runner->point_size_max = strtof(line, &rest);
|
||||||
}
|
}
|
||||||
|
else if (match_string(line, "point-sprite", &line))
|
||||||
|
{
|
||||||
|
if (match_string(line, "on", &line))
|
||||||
|
runner->point_sprite = true;
|
||||||
|
else
|
||||||
|
runner->point_sprite = false;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
fatal_error("Unknown test directive '%s'.\n", line);
|
fatal_error("Unknown test directive '%s'.\n", line);
|
||||||
|
@ -224,6 +224,7 @@ struct shader_runner
|
|||||||
uint8_t clip_plane_mask;
|
uint8_t clip_plane_mask;
|
||||||
struct vec4 clip_planes[8];
|
struct vec4 clip_planes[8];
|
||||||
float point_size, point_size_min, point_size_max;
|
float point_size, point_size_min, point_size_max;
|
||||||
|
bool point_sprite;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct shader_runner_ops
|
struct shader_runner_ops
|
||||||
|
@ -492,6 +492,8 @@ static bool d3d9_runner_draw(struct shader_runner *r,
|
|||||||
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_MAX, float_to_int(runner->r.point_size_max));
|
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);
|
ok(hr == D3D_OK, "Failed to set render state, hr %#lx.\n", hr);
|
||||||
|
hr = IDirect3DDevice9_SetRenderState(device, D3DRS_POINTSPRITEENABLE, runner->r.point_sprite);
|
||||||
|
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);
|
||||||
|
@ -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[16];
|
struct vkd3d_shader_parameter1 parameters[17];
|
||||||
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];
|
||||||
@ -472,6 +472,11 @@ static bool compile_shader(struct vulkan_shader_runner *runner, const char *sour
|
|||||||
parameters[15].data_type = VKD3D_SHADER_PARAMETER_DATA_TYPE_FLOAT32;
|
parameters[15].data_type = VKD3D_SHADER_PARAMETER_DATA_TYPE_FLOAT32;
|
||||||
parameters[15].u.immediate_constant.u.f32 = runner->r.point_size_max;
|
parameters[15].u.immediate_constant.u.f32 = runner->r.point_size_max;
|
||||||
|
|
||||||
|
parameters[16].name = VKD3D_SHADER_PARAMETER_NAME_POINT_SPRITE;
|
||||||
|
parameters[16].type = VKD3D_SHADER_PARAMETER_TYPE_IMMEDIATE_CONSTANT;
|
||||||
|
parameters[16].data_type = VKD3D_SHADER_PARAMETER_DATA_TYPE_UINT32;
|
||||||
|
parameters[16].u.immediate_constant.u.u32 = runner->r.point_sprite;
|
||||||
|
|
||||||
parameter_info.parameter_count = ARRAY_SIZE(parameters);
|
parameter_info.parameter_count = ARRAY_SIZE(parameters);
|
||||||
parameter_info.parameters = parameters;
|
parameter_info.parameters = parameters;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user