mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-02-06 13:54:14 +01:00
[d3d11] Fixed initialization of compressed images
This commit is contained in:
parent
2a364c557b
commit
a644eebfd7
@ -1486,9 +1486,10 @@ namespace dxvk {
|
|||||||
} else {
|
} else {
|
||||||
LockResourceInitContext();
|
LockResourceInitContext();
|
||||||
|
|
||||||
// While the Microsoft docs state that resource contents
|
// While the Microsoft docs state that resource contents are
|
||||||
// are undefined if no initial data is provided, some
|
// undefined if no initial data is provided, some applications
|
||||||
// applications expect a resource to be pre-cleared.
|
// expect a resource to be pre-cleared. We can only do that
|
||||||
|
// for non-compressed images, but that should be fine.
|
||||||
VkImageSubresourceRange subresources;
|
VkImageSubresourceRange subresources;
|
||||||
subresources.aspectMask = formatInfo->aspectMask;
|
subresources.aspectMask = formatInfo->aspectMask;
|
||||||
subresources.baseMipLevel = 0;
|
subresources.baseMipLevel = 0;
|
||||||
@ -1496,19 +1497,26 @@ namespace dxvk {
|
|||||||
subresources.baseArrayLayer = 0;
|
subresources.baseArrayLayer = 0;
|
||||||
subresources.layerCount = image->info().numLayers;
|
subresources.layerCount = image->info().numLayers;
|
||||||
|
|
||||||
if (subresources.aspectMask == VK_IMAGE_ASPECT_COLOR_BIT) {
|
const DxvkFormatInfo* formatInfo = imageFormatInfo(image->info().format);
|
||||||
VkClearColorValue value;
|
|
||||||
std::memset(&value, 0, sizeof(value));
|
if (formatInfo->flags.test(DxvkFormatFlag::BlockCompressed)) {
|
||||||
|
m_resourceInitContext->initImage(
|
||||||
m_resourceInitContext->clearColorImage(
|
image, subresources);
|
||||||
image, value, subresources);
|
|
||||||
} else {
|
} else {
|
||||||
VkClearDepthStencilValue value;
|
if (subresources.aspectMask == VK_IMAGE_ASPECT_COLOR_BIT) {
|
||||||
value.depth = 1.0f;
|
VkClearColorValue value;
|
||||||
value.stencil = 0;
|
std::memset(&value, 0, sizeof(value));
|
||||||
|
|
||||||
m_resourceInitContext->clearDepthStencilImage(
|
m_resourceInitContext->clearColorImage(
|
||||||
image, value, subresources);
|
image, value, subresources);
|
||||||
|
} else {
|
||||||
|
VkClearDepthStencilValue value;
|
||||||
|
value.depth = 1.0f;
|
||||||
|
value.stencil = 0;
|
||||||
|
|
||||||
|
m_resourceInitContext->clearDepthStencilImage(
|
||||||
|
image, value, subresources);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
UnlockResourceInitContext(1);
|
UnlockResourceInitContext(1);
|
||||||
|
@ -182,13 +182,6 @@ namespace dxvk {
|
|||||||
const VkImageSubresourceRange& subresources) {
|
const VkImageSubresourceRange& subresources) {
|
||||||
this->renderPassEnd();
|
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) {
|
if (image->info().layout != VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL) {
|
||||||
m_barriers.accessImage(image, subresources,
|
m_barriers.accessImage(image, subresources,
|
||||||
VK_IMAGE_LAYOUT_UNDEFINED, 0, 0,
|
VK_IMAGE_LAYOUT_UNDEFINED, 0, 0,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user