mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-01-18 20:52:10 +01:00
[d3d9] Use initImage to clear uninitialized image resources
This commit is contained in:
parent
6d0e5dfd21
commit
752f98cf00
@ -91,8 +91,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;
|
||||
@ -100,23 +99,7 @@ namespace dxvk {
|
||||
subresources.baseArrayLayer = 0;
|
||||
subresources.layerCount = image->info().numLayers;
|
||||
|
||||
if (formatInfo->flags.test(DxvkFormatFlag::BlockCompressed)) {
|
||||
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);
|
||||
};
|
||||
|
||||
InitImage(pTexture->GetImage());
|
||||
|
@ -1050,19 +1050,13 @@ 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());
|
||||
|
||||
for (uint32_t i = 0; i < m_backBuffers.size(); i++) {
|
||||
m_context->clearColorImage(
|
||||
m_context->initImage(
|
||||
m_backBuffers[i]->GetCommonTexture()->GetImage(),
|
||||
clearColor, subresources);
|
||||
subresources, VK_IMAGE_LAYOUT_UNDEFINED);
|
||||
}
|
||||
|
||||
m_device->submitCommandList(
|
||||
|
Loading…
x
Reference in New Issue
Block a user