mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2024-11-21 16:46:41 -08:00
tests/hlsl: Add tests for SV_DepthLessEqual and SV_DepthGreaterEqual.
This commit is contained in:
parent
b68a9ae3ec
commit
7eeca3fa39
Notes:
Alexandre Julliard
2024-04-19 22:27:07 +02: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/777
@ -33,3 +33,78 @@ depth less
|
|||||||
clear dsv 0.5
|
clear dsv 0.5
|
||||||
todo(sm>=6 | glsl) draw quad
|
todo(sm>=6 | glsl) draw quad
|
||||||
probe dsv all r (0.5)
|
probe dsv all r (0.5)
|
||||||
|
|
||||||
|
|
||||||
|
[require]
|
||||||
|
shader model >= 5.0
|
||||||
|
|
||||||
|
[rtv 0]
|
||||||
|
format r32g32b32a32 float
|
||||||
|
size (2d, 640, 480)
|
||||||
|
|
||||||
|
[vertex shader]
|
||||||
|
float2 depth;
|
||||||
|
|
||||||
|
void main(float4 in_position : POSITION, out float4 out_position : SV_Position)
|
||||||
|
{
|
||||||
|
out_position = in_position;
|
||||||
|
out_position.z = depth.x;
|
||||||
|
}
|
||||||
|
|
||||||
|
[pixel shader todo]
|
||||||
|
float2 depth;
|
||||||
|
|
||||||
|
float4 main(out float out_depth : SV_DepthLessEqual) : SV_Target
|
||||||
|
{
|
||||||
|
out_depth = depth.y;
|
||||||
|
return float4(0.0f, 1.0f, 0.0f, 1.0f);
|
||||||
|
}
|
||||||
|
|
||||||
|
[test]
|
||||||
|
uniform 0 float4 0.75 0.75 0.0 0.0
|
||||||
|
clear rtv 0 1.0 1.0 1.0 1.0
|
||||||
|
clear dsv 0.5
|
||||||
|
depth greater equal
|
||||||
|
todo draw quad
|
||||||
|
probe all rgba (0.0, 1.0, 0.0, 1.0)
|
||||||
|
probe dsv all r (0.75)
|
||||||
|
|
||||||
|
uniform 0 float4 0.75 0.375 0.0 0.0
|
||||||
|
clear rtv 0 1.0 1.0 1.0 1.0
|
||||||
|
clear dsv 0.5
|
||||||
|
todo draw quad
|
||||||
|
probe all rgba (1.0, 1.0, 1.0, 1.0)
|
||||||
|
probe dsv all r (0.5)
|
||||||
|
|
||||||
|
|
||||||
|
[pixel shader todo]
|
||||||
|
float2 depth;
|
||||||
|
|
||||||
|
float4 main(out float out_depth : SV_DepthGreaterEqual) : SV_Target
|
||||||
|
{
|
||||||
|
out_depth = depth.y;
|
||||||
|
return float4(0.0f, 1.0f, 0.0f, 1.0f);
|
||||||
|
}
|
||||||
|
|
||||||
|
[test]
|
||||||
|
uniform 0 float4 0.75 0.75 0.0 0.0
|
||||||
|
clear rtv 0 1.0 1.0 1.0 1.0
|
||||||
|
clear dsv 0.5
|
||||||
|
depth greater equal
|
||||||
|
todo draw quad
|
||||||
|
probe all rgba (0.0, 1.0, 0.0, 1.0)
|
||||||
|
probe dsv all r (0.75)
|
||||||
|
|
||||||
|
uniform 0 float4 0.375 0.625 0.0 0.0
|
||||||
|
clear rtv 0 1.0 1.0 1.0 1.0
|
||||||
|
clear dsv 0.5
|
||||||
|
todo draw quad
|
||||||
|
probe all rgba (0.0, 1.0, 0.0, 1.0)
|
||||||
|
probe dsv all r (0.625)
|
||||||
|
|
||||||
|
uniform 0 float4 0.375 0.375 0.0 0.0
|
||||||
|
clear rtv 0 1.0 1.0 1.0 1.0
|
||||||
|
clear dsv 0.5
|
||||||
|
todo draw quad
|
||||||
|
probe all rgba (1.0, 1.0, 1.0, 1.0)
|
||||||
|
probe dsv all r (0.5)
|
||||||
|
@ -834,6 +834,19 @@ static void parse_test_directive(struct shader_runner *runner, const char *line)
|
|||||||
|
|
||||||
runner->last_render_failed = !runner->ops->dispatch(runner, x, y, z);
|
runner->last_render_failed = !runner->ops->dispatch(runner, x, y, z);
|
||||||
}
|
}
|
||||||
|
else if (match_string(line, "clear rtv", &line))
|
||||||
|
{
|
||||||
|
struct resource *resource;
|
||||||
|
unsigned int slot;
|
||||||
|
struct vec4 v;
|
||||||
|
|
||||||
|
if (sscanf(line, "%u %f %f %f %f", &slot, &v.x, &v.y, &v.z, &v.w) < 5)
|
||||||
|
fatal_error("Malformed rtv clear arguments '%s'.\n", line);
|
||||||
|
|
||||||
|
if (!(resource = shader_runner_get_resource(runner, RESOURCE_TYPE_RENDER_TARGET, slot)))
|
||||||
|
fatal_error("Resource not found.\n");
|
||||||
|
runner->ops->clear(runner, resource, &v);
|
||||||
|
}
|
||||||
else if (match_string(line, "clear dsv", &line))
|
else if (match_string(line, "clear dsv", &line))
|
||||||
{
|
{
|
||||||
struct resource *resource;
|
struct resource *resource;
|
||||||
|
@ -620,6 +620,10 @@ static void d3d11_runner_clear(struct shader_runner *r, struct resource *res, co
|
|||||||
|
|
||||||
switch (resource->r.type)
|
switch (resource->r.type)
|
||||||
{
|
{
|
||||||
|
case RESOURCE_TYPE_RENDER_TARGET:
|
||||||
|
ID3D11DeviceContext_ClearRenderTargetView(context, resource->rtv, (const float *)clear_value);
|
||||||
|
break;
|
||||||
|
|
||||||
case RESOURCE_TYPE_DEPTH_STENCIL:
|
case RESOURCE_TYPE_DEPTH_STENCIL:
|
||||||
ID3D11DeviceContext_ClearDepthStencilView(context, resource->dsv, D3D11_CLEAR_DEPTH, clear_value->x, 0);
|
ID3D11DeviceContext_ClearDepthStencilView(context, resource->dsv, D3D11_CLEAR_DEPTH, clear_value->x, 0);
|
||||||
break;
|
break;
|
||||||
|
@ -468,6 +468,11 @@ static void d3d12_runner_clear(struct shader_runner *r, struct resource *resourc
|
|||||||
|
|
||||||
switch (resource->type)
|
switch (resource->type)
|
||||||
{
|
{
|
||||||
|
case RESOURCE_TYPE_RENDER_TARGET:
|
||||||
|
view = get_cpu_rtv_handle(test_context, runner->rtv_heap, resource->slot);
|
||||||
|
ID3D12GraphicsCommandList_ClearRenderTargetView(command_list, view, (const float *)clear_value, 0, NULL);
|
||||||
|
break;
|
||||||
|
|
||||||
case RESOURCE_TYPE_DEPTH_STENCIL:
|
case RESOURCE_TYPE_DEPTH_STENCIL:
|
||||||
view = get_cpu_dsv_handle(test_context, runner->dsv_heap, 0);
|
view = get_cpu_dsv_handle(test_context, runner->dsv_heap, 0);
|
||||||
ID3D12GraphicsCommandList_ClearDepthStencilView(command_list, view,
|
ID3D12GraphicsCommandList_ClearDepthStencilView(command_list, view,
|
||||||
|
@ -940,6 +940,7 @@ static void gl_runner_clear(struct shader_runner *r, struct resource *res, const
|
|||||||
{
|
{
|
||||||
struct gl_resource *resource = gl_resource(res);
|
struct gl_resource *resource = gl_resource(res);
|
||||||
struct gl_runner *runner = gl_runner(r);
|
struct gl_runner *runner = gl_runner(r);
|
||||||
|
GLbitfield clear_mask;
|
||||||
|
|
||||||
if (!runner->fbo_id)
|
if (!runner->fbo_id)
|
||||||
glGenFramebuffers(1, &runner->fbo_id);
|
glGenFramebuffers(1, &runner->fbo_id);
|
||||||
@ -947,10 +948,18 @@ static void gl_runner_clear(struct shader_runner *r, struct resource *res, const
|
|||||||
|
|
||||||
switch (resource->r.type)
|
switch (resource->r.type)
|
||||||
{
|
{
|
||||||
|
case RESOURCE_TYPE_RENDER_TARGET:
|
||||||
|
glFramebufferTexture(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, resource->id, 0);
|
||||||
|
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
|
||||||
|
glClearColor(clear_value->x, clear_value->y, clear_value->z, clear_value->w);
|
||||||
|
clear_mask = GL_COLOR_BUFFER_BIT;
|
||||||
|
break;
|
||||||
|
|
||||||
case RESOURCE_TYPE_DEPTH_STENCIL:
|
case RESOURCE_TYPE_DEPTH_STENCIL:
|
||||||
glFramebufferTexture(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, resource->id, 0);
|
glFramebufferTexture(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, resource->id, 0);
|
||||||
glDepthMask(GL_TRUE);
|
glDepthMask(GL_TRUE);
|
||||||
glClearDepthf(clear_value->x);
|
glClearDepthf(clear_value->x);
|
||||||
|
clear_mask = GL_DEPTH_BUFFER_BIT;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -958,7 +967,7 @@ static void gl_runner_clear(struct shader_runner *r, struct resource *res, const
|
|||||||
}
|
}
|
||||||
|
|
||||||
glScissor(0, 0, res->width, res->height);
|
glScissor(0, 0, res->width, res->height);
|
||||||
glClear(GL_DEPTH_BUFFER_BIT);
|
glClear(clear_mask);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool gl_runner_draw(struct shader_runner *r,
|
static bool gl_runner_draw(struct shader_runner *r,
|
||||||
|
@ -1225,6 +1225,13 @@ static void vulkan_runner_clear(struct shader_runner *r, struct resource *res, c
|
|||||||
|
|
||||||
switch (resource->r.type)
|
switch (resource->r.type)
|
||||||
{
|
{
|
||||||
|
case RESOURCE_TYPE_RENDER_TARGET:
|
||||||
|
attachment_desc.initialLayout = VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL;
|
||||||
|
sub_pass_desc.colorAttachmentCount = 1;
|
||||||
|
sub_pass_desc.pColorAttachments = &attachment_ref;
|
||||||
|
memcpy(vk_clear_value.color.float32, clear_value, sizeof(vk_clear_value.color.float32));
|
||||||
|
break;
|
||||||
|
|
||||||
case RESOURCE_TYPE_DEPTH_STENCIL:
|
case RESOURCE_TYPE_DEPTH_STENCIL:
|
||||||
attachment_desc.initialLayout = VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL;
|
attachment_desc.initialLayout = VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL;
|
||||||
sub_pass_desc.pDepthStencilAttachment = &attachment_ref;
|
sub_pass_desc.pDepthStencilAttachment = &attachment_ref;
|
||||||
|
Loading…
Reference in New Issue
Block a user