mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2024-11-21 16:46:41 -08:00
vkd3d: Fix draw calls without depth-stencil view.
Fixes a regression introduced by
9eba55403d
.
Signed-off-by: Józef Kucia <jkucia@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
8782764434
commit
92d88e2903
@ -2340,6 +2340,7 @@ static bool d3d12_command_list_update_current_framebuffer(struct d3d12_command_l
|
|||||||
VkFramebuffer vk_framebuffer;
|
VkFramebuffer vk_framebuffer;
|
||||||
unsigned int view_count;
|
unsigned int view_count;
|
||||||
size_t start_idx = 0;
|
size_t start_idx = 0;
|
||||||
|
bool null_attachment;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
VkResult vr;
|
VkResult vr;
|
||||||
|
|
||||||
@ -2353,7 +2354,11 @@ static bool d3d12_command_list_update_current_framebuffer(struct d3d12_command_l
|
|||||||
|
|
||||||
for (i = 0, view_count = 0; i < graphics->attachment_count; ++i)
|
for (i = 0, view_count = 0; i < graphics->attachment_count; ++i)
|
||||||
{
|
{
|
||||||
if (graphics->null_attachment_mask & (1u << i))
|
null_attachment = graphics->null_attachment_mask & (1u << i);
|
||||||
|
if (graphics->rt_idx && i == 0)
|
||||||
|
null_attachment = list->dsv_format == VK_FORMAT_UNDEFINED;
|
||||||
|
|
||||||
|
if (null_attachment)
|
||||||
{
|
{
|
||||||
if (list->views[start_idx + i])
|
if (list->views[start_idx + i])
|
||||||
WARN("Expected NULL view for attachment %u.\n", i);
|
WARN("Expected NULL view for attachment %u.\n", i);
|
||||||
|
@ -2058,21 +2058,21 @@ static HRESULT d3d12_graphics_pipeline_state_create_render_pass(
|
|||||||
VkFormat dynamic_dsv_format, VkRenderPass *vk_render_pass)
|
VkFormat dynamic_dsv_format, VkRenderPass *vk_render_pass)
|
||||||
{
|
{
|
||||||
struct vkd3d_render_pass_key key;
|
struct vkd3d_render_pass_key key;
|
||||||
unsigned int i;
|
VkFormat dsv_format;
|
||||||
|
unsigned int i = 0;
|
||||||
|
|
||||||
if (graphics->rt_idx)
|
dsv_format = graphics->rt_idx ?
|
||||||
|
graphics->dsv_format ? graphics->dsv_format : dynamic_dsv_format
|
||||||
|
: VK_FORMAT_UNDEFINED;
|
||||||
|
|
||||||
|
if (dsv_format)
|
||||||
{
|
{
|
||||||
assert(graphics->ds_desc.front.writeMask == graphics->ds_desc.back.writeMask);
|
assert(graphics->ds_desc.front.writeMask == graphics->ds_desc.back.writeMask);
|
||||||
key.depth_enable = graphics->ds_desc.depthTestEnable;
|
key.depth_enable = graphics->ds_desc.depthTestEnable;
|
||||||
key.stencil_enable = graphics->ds_desc.stencilTestEnable;
|
key.stencil_enable = graphics->ds_desc.stencilTestEnable;
|
||||||
key.depth_stencil_write = graphics->ds_desc.depthWriteEnable
|
key.depth_stencil_write = graphics->ds_desc.depthWriteEnable
|
||||||
|| graphics->ds_desc.front.writeMask;
|
|| graphics->ds_desc.front.writeMask;
|
||||||
|
key.vk_formats[i++] = dsv_format;
|
||||||
if (!(key.vk_formats[0] = graphics->dsv_format))
|
|
||||||
key.vk_formats[0] = dynamic_dsv_format;
|
|
||||||
|
|
||||||
if (!key.vk_formats[0])
|
|
||||||
FIXME("Compiling with DXGI_FORMAT_UNKNOWN.\n");
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -2082,11 +2082,13 @@ static HRESULT d3d12_graphics_pipeline_state_create_render_pass(
|
|||||||
key.vk_formats[ARRAY_SIZE(key.vk_formats) - 1] = VK_FORMAT_UNDEFINED;
|
key.vk_formats[ARRAY_SIZE(key.vk_formats) - 1] = VK_FORMAT_UNDEFINED;
|
||||||
}
|
}
|
||||||
|
|
||||||
memcpy(&key.vk_formats[graphics->rt_idx], graphics->rtv_formats, sizeof(graphics->rtv_formats));
|
memcpy(&key.vk_formats[i], graphics->rtv_formats, sizeof(graphics->rtv_formats));
|
||||||
for (i = graphics->attachment_count; i < ARRAY_SIZE(key.vk_formats); ++i)
|
for (i = graphics->attachment_count; i < ARRAY_SIZE(key.vk_formats); ++i)
|
||||||
assert(key.vk_formats[i] == VK_FORMAT_UNDEFINED);
|
assert(key.vk_formats[i] == VK_FORMAT_UNDEFINED);
|
||||||
|
|
||||||
key.attachment_count = graphics->attachment_count;
|
key.attachment_count = graphics->attachment_count;
|
||||||
|
if (!dsv_format && graphics->rt_idx)
|
||||||
|
--key.attachment_count;
|
||||||
key.padding = 0;
|
key.padding = 0;
|
||||||
key.sample_count = graphics->ms_desc.rasterizationSamples;
|
key.sample_count = graphics->ms_desc.rasterizationSamples;
|
||||||
|
|
||||||
|
@ -4934,6 +4934,35 @@ static void test_unknown_dsv_format(void)
|
|||||||
D3D12_RESOURCE_STATE_RENDER_TARGET, D3D12_RESOURCE_STATE_COPY_SOURCE);
|
D3D12_RESOURCE_STATE_RENDER_TARGET, D3D12_RESOURCE_STATE_COPY_SOURCE);
|
||||||
check_sub_resource_vec4(context.render_target, 0, queue, command_list, &green, 0);
|
check_sub_resource_vec4(context.render_target, 0, queue, command_list, &green, 0);
|
||||||
|
|
||||||
|
/* DSVFormat = DXGI_FORMAT_UNKNOWN and no DSV */
|
||||||
|
reset_command_list(command_list, context.allocator);
|
||||||
|
transition_resource_state(command_list, ds.texture,
|
||||||
|
D3D12_RESOURCE_STATE_COPY_SOURCE, D3D12_RESOURCE_STATE_DEPTH_WRITE);
|
||||||
|
transition_resource_state(command_list, context.render_target,
|
||||||
|
D3D12_RESOURCE_STATE_COPY_SOURCE, D3D12_RESOURCE_STATE_RENDER_TARGET);
|
||||||
|
|
||||||
|
ID3D12GraphicsCommandList_ClearRenderTargetView(command_list, context.rtv, white, 0, NULL);
|
||||||
|
|
||||||
|
ID3D12GraphicsCommandList_OMSetRenderTargets(command_list, 1, &context.rtv, FALSE, NULL);
|
||||||
|
ID3D12GraphicsCommandList_SetGraphicsRootSignature(command_list, context.root_signature);
|
||||||
|
ID3D12GraphicsCommandList_SetPipelineState(command_list, context.pipeline_state);
|
||||||
|
ID3D12GraphicsCommandList_IASetPrimitiveTopology(command_list, D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
|
||||||
|
ID3D12GraphicsCommandList_RSSetScissorRects(command_list, 1, &context.scissor_rect);
|
||||||
|
|
||||||
|
ID3D12GraphicsCommandList_SetGraphicsRoot32BitConstants(command_list, 0, 4, &red.x, 0);
|
||||||
|
set_viewport(&context.viewport, 0.0f, 0.0f, 32.0f, 32.0f, 0.0f, 0.0f);
|
||||||
|
ID3D12GraphicsCommandList_RSSetViewports(command_list, 1, &context.viewport);
|
||||||
|
ID3D12GraphicsCommandList_DrawInstanced(command_list, 3, 1, 0, 0);
|
||||||
|
|
||||||
|
ID3D12GraphicsCommandList_SetGraphicsRoot32BitConstants(command_list, 0, 4, &green.x, 0);
|
||||||
|
set_viewport(&context.viewport, 0.0f, 0.0f, 32.0f, 32.0f, 1.0f, 0.5f);
|
||||||
|
ID3D12GraphicsCommandList_RSSetViewports(command_list, 1, &context.viewport);
|
||||||
|
ID3D12GraphicsCommandList_DrawInstanced(command_list, 3, 1, 0, 0);
|
||||||
|
|
||||||
|
transition_resource_state(command_list, context.render_target,
|
||||||
|
D3D12_RESOURCE_STATE_RENDER_TARGET, D3D12_RESOURCE_STATE_COPY_SOURCE);
|
||||||
|
check_sub_resource_vec4(context.render_target, 0, queue, command_list, &green, 0);
|
||||||
|
|
||||||
destroy_depth_stencil(&ds);
|
destroy_depth_stencil(&ds);
|
||||||
destroy_test_context(&context);
|
destroy_test_context(&context);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user