mirror of
https://github.com/doitsujin/dxvk.git
synced 2024-12-05 01:24:14 +01:00
[d3d11] Use initImage to clear uninitialized image resources
This commit is contained in:
parent
464c6810b3
commit
6d0e5dfd21
@ -181,8 +181,7 @@ namespace dxvk {
|
||||
|
||||
// While the Microsoft docs state that resource contents are
|
||||
// undefined if no initial data is provided, some applications
|
||||
// expect a resource to be pre-cleared. We can only do that
|
||||
// for non-compressed images, but that should be fine.
|
||||
// expect a resource to be pre-cleared.
|
||||
VkImageSubresourceRange subresources;
|
||||
subresources.aspectMask = formatInfo->aspectMask;
|
||||
subresources.baseMipLevel = 0;
|
||||
@ -190,23 +189,7 @@ namespace dxvk {
|
||||
subresources.baseArrayLayer = 0;
|
||||
subresources.layerCount = desc->ArraySize;
|
||||
|
||||
if (formatInfo->flags.any(DxvkFormatFlag::BlockCompressed, DxvkFormatFlag::MultiPlane)) {
|
||||
m_context->clearCompressedColorImage(image, subresources);
|
||||
} else {
|
||||
if (subresources.aspectMask == VK_IMAGE_ASPECT_COLOR_BIT) {
|
||||
VkClearColorValue value = { };
|
||||
|
||||
m_context->clearColorImage(
|
||||
image, value, subresources);
|
||||
} else {
|
||||
VkClearDepthStencilValue value;
|
||||
value.depth = 0.0f;
|
||||
value.stencil = 0;
|
||||
|
||||
m_context->clearDepthStencilImage(
|
||||
image, value, subresources);
|
||||
}
|
||||
}
|
||||
m_context->initImage(image, subresources, VK_IMAGE_LAYOUT_UNDEFINED);
|
||||
}
|
||||
|
||||
if (mapMode != D3D11_COMMON_TEXTURE_MAP_MODE_NONE) {
|
||||
|
@ -523,17 +523,11 @@ namespace dxvk {
|
||||
subresources.baseArrayLayer = 0;
|
||||
subresources.layerCount = 1;
|
||||
|
||||
VkClearColorValue clearColor;
|
||||
clearColor.float32[0] = 0.0f;
|
||||
clearColor.float32[1] = 0.0f;
|
||||
clearColor.float32[2] = 0.0f;
|
||||
clearColor.float32[3] = 0.0f;
|
||||
|
||||
m_context->beginRecording(
|
||||
m_device->createCommandList());
|
||||
|
||||
m_context->clearColorImage(
|
||||
m_swapImage, clearColor, subresources);
|
||||
m_context->initImage(m_swapImage,
|
||||
subresources, VK_IMAGE_LAYOUT_UNDEFINED);
|
||||
|
||||
m_device->submitCommandList(
|
||||
m_context->endRecording(),
|
||||
|
Loading…
Reference in New Issue
Block a user