1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2025-01-29 17:52:18 +01:00

[d3d11] Fixed initialization of compressed images

This commit is contained in:
Philip Rebohle 2018-01-19 18:11:20 +01:00
parent 2a364c557b
commit a644eebfd7
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99
2 changed files with 23 additions and 22 deletions

View File

@ -1486,9 +1486,10 @@ namespace dxvk {
} else {
LockResourceInitContext();
// 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.
// 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.
VkImageSubresourceRange subresources;
subresources.aspectMask = formatInfo->aspectMask;
subresources.baseMipLevel = 0;
@ -1496,19 +1497,26 @@ namespace dxvk {
subresources.baseArrayLayer = 0;
subresources.layerCount = image->info().numLayers;
if (subresources.aspectMask == VK_IMAGE_ASPECT_COLOR_BIT) {
VkClearColorValue value;
std::memset(&value, 0, sizeof(value));
m_resourceInitContext->clearColorImage(
image, value, subresources);
const DxvkFormatInfo* formatInfo = imageFormatInfo(image->info().format);
if (formatInfo->flags.test(DxvkFormatFlag::BlockCompressed)) {
m_resourceInitContext->initImage(
image, subresources);
} else {
VkClearDepthStencilValue value;
value.depth = 1.0f;
value.stencil = 0;
m_resourceInitContext->clearDepthStencilImage(
image, value, subresources);
if (subresources.aspectMask == VK_IMAGE_ASPECT_COLOR_BIT) {
VkClearColorValue value;
std::memset(&value, 0, sizeof(value));
m_resourceInitContext->clearColorImage(
image, value, subresources);
} else {
VkClearDepthStencilValue value;
value.depth = 1.0f;
value.stencil = 0;
m_resourceInitContext->clearDepthStencilImage(
image, value, subresources);
}
}
UnlockResourceInitContext(1);

View File

@ -182,13 +182,6 @@ namespace dxvk {
const VkImageSubresourceRange& subresources) {
this->renderPassEnd();
const DxvkFormatInfo* formatInfo = imageFormatInfo(image->info().format);
if (formatInfo->flags.test(DxvkFormatFlag::BlockCompressed)) {
Logger::err("DxvkContext: Compressed clears not supported");
return;
}
if (image->info().layout != VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL) {
m_barriers.accessImage(image, subresources,
VK_IMAGE_LAYOUT_UNDEFINED, 0, 0,