mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2024-11-21 16:46:41 -08:00
vkd3d: Clarify DSV attachment mask handling.
It isn't immediately obvious what "1u << graphics->rt_count" means. Use dsv_attachment_mask() helper instead. 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
7ecd67aaa0
commit
895aaa461b
@ -2278,17 +2278,6 @@ static HRESULT STDMETHODCALLTYPE d3d12_command_list_ClearState(ID3D12GraphicsCom
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static bool d3d12_command_list_has_unknown_dsv_format(struct d3d12_command_list *list)
|
||||
{
|
||||
struct d3d12_graphics_pipeline_state *graphics;
|
||||
|
||||
if (!d3d12_pipeline_state_is_graphics(list->state))
|
||||
return false;
|
||||
|
||||
graphics = &list->state->u.graphics;
|
||||
return graphics->null_attachment_mask & (1u << graphics->rt_count);
|
||||
}
|
||||
|
||||
static bool d3d12_command_list_has_depth_stencil_view(struct d3d12_command_list *list)
|
||||
{
|
||||
struct d3d12_graphics_pipeline_state *graphics;
|
||||
@ -2296,7 +2285,7 @@ static bool d3d12_command_list_has_depth_stencil_view(struct d3d12_command_list
|
||||
assert(d3d12_pipeline_state_is_graphics(list->state));
|
||||
graphics = &list->state->u.graphics;
|
||||
|
||||
return graphics->dsv_format || (d3d12_command_list_has_unknown_dsv_format(list) && list->dsv_format);
|
||||
return graphics->dsv_format || (d3d12_pipeline_state_has_unknown_dsv_format(list->state) && list->dsv_format);
|
||||
}
|
||||
|
||||
static void d3d12_command_list_get_fb_extent(struct d3d12_command_list *list,
|
||||
@ -4386,7 +4375,7 @@ static void STDMETHODCALLTYPE d3d12_command_list_OMSetRenderTargets(ID3D12Graphi
|
||||
}
|
||||
}
|
||||
|
||||
if (prev_dsv_format != list->dsv_format && d3d12_command_list_has_unknown_dsv_format(list))
|
||||
if (prev_dsv_format != list->dsv_format && d3d12_pipeline_state_has_unknown_dsv_format(list->state))
|
||||
d3d12_command_list_invalidate_current_pipeline(list);
|
||||
|
||||
d3d12_command_list_invalidate_current_framebuffer(list);
|
||||
|
@ -2038,7 +2038,7 @@ static HRESULT d3d12_graphics_pipeline_state_create_render_pass(
|
||||
memcpy(key.vk_formats, graphics->rtv_formats, sizeof(graphics->rtv_formats));
|
||||
key.attachment_count = graphics->rt_count;
|
||||
|
||||
if (!(dsv_format = graphics->dsv_format) && (graphics->null_attachment_mask & (1u << graphics->rt_count)))
|
||||
if (!(dsv_format = graphics->dsv_format) && (graphics->null_attachment_mask & dsv_attachment_mask(graphics)))
|
||||
dsv_format = dynamic_dsv_format;
|
||||
|
||||
if (dsv_format)
|
||||
@ -2220,7 +2220,7 @@ static HRESULT d3d12_pipeline_state_init_graphics(struct d3d12_pipeline_state *s
|
||||
{
|
||||
WARN("DSV format is DXGI_FORMAT_UNKNOWN.\n");
|
||||
graphics->dsv_format = VK_FORMAT_UNDEFINED;
|
||||
graphics->null_attachment_mask |= 1u << graphics->rt_count;
|
||||
graphics->null_attachment_mask |= dsv_attachment_mask(graphics);
|
||||
}
|
||||
else if ((format = vkd3d_get_format(device, desc->DSVFormat, true)))
|
||||
{
|
||||
@ -2503,7 +2503,7 @@ static HRESULT d3d12_pipeline_state_init_graphics(struct d3d12_pipeline_state *s
|
||||
goto fail;
|
||||
}
|
||||
|
||||
is_dsv_format_unknown = graphics->null_attachment_mask & (1u << graphics->rt_count);
|
||||
is_dsv_format_unknown = graphics->null_attachment_mask & dsv_attachment_mask(graphics);
|
||||
|
||||
rs_desc_from_d3d12(&graphics->rs_desc, &desc->RasterizerState);
|
||||
have_attachment = graphics->rt_count || graphics->dsv_format || is_dsv_format_unknown;
|
||||
@ -2855,7 +2855,7 @@ VkPipeline d3d12_pipeline_state_get_or_create_pipeline(struct d3d12_pipeline_sta
|
||||
/* Create a render pass for pipelines with DXGI_FORMAT_UNKNOWN. */
|
||||
if (!(pipeline_desc.renderPass = graphics->render_pass))
|
||||
{
|
||||
if (graphics->null_attachment_mask & (1u << graphics->rt_count))
|
||||
if (graphics->null_attachment_mask & dsv_attachment_mask(graphics))
|
||||
TRACE("Compiling %p with DSV format %#x.\n", state, dsv_format);
|
||||
|
||||
if (FAILED(hr = d3d12_graphics_pipeline_state_create_render_pass(graphics, device, dsv_format,
|
||||
|
@ -706,6 +706,11 @@ struct d3d12_graphics_pipeline_state
|
||||
bool xfb_enabled;
|
||||
};
|
||||
|
||||
static inline unsigned int dsv_attachment_mask(const struct d3d12_graphics_pipeline_state *graphics)
|
||||
{
|
||||
return 1u << graphics->rt_count;
|
||||
}
|
||||
|
||||
struct d3d12_compute_pipeline_state
|
||||
{
|
||||
VkPipeline vk_pipeline;
|
||||
@ -746,6 +751,18 @@ static inline bool d3d12_pipeline_state_is_graphics(const struct d3d12_pipeline_
|
||||
return state && state->vk_bind_point == VK_PIPELINE_BIND_POINT_GRAPHICS;
|
||||
}
|
||||
|
||||
static inline bool d3d12_pipeline_state_has_unknown_dsv_format(struct d3d12_pipeline_state *state)
|
||||
{
|
||||
if (d3d12_pipeline_state_is_graphics(state))
|
||||
{
|
||||
struct d3d12_graphics_pipeline_state *graphics = &state->u.graphics;
|
||||
|
||||
return graphics->null_attachment_mask & dsv_attachment_mask(graphics);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
HRESULT d3d12_pipeline_state_create_compute(struct d3d12_device *device,
|
||||
const D3D12_COMPUTE_PIPELINE_STATE_DESC *desc, struct d3d12_pipeline_state **state) DECLSPEC_HIDDEN;
|
||||
HRESULT d3d12_pipeline_state_create_graphics(struct d3d12_device *device,
|
||||
|
Loading…
Reference in New Issue
Block a user