Commit 9167e1e2 by Corentin Wallez

Revert "Optimize clearing of depth and stencil images"

This reverts commit af1f2159. Reason for revert: Fails tests with ASAN crbug.com/1097740 Bug: chromium:1097740 Change-Id: I48d3d1129ad3ea314df29d1f40b595ad6fa169ce Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/45928Reviewed-by: 's avatarCorentin Wallez <cwallez@google.com> Tested-by: 's avatarCorentin Wallez <cwallez@google.com>
parent ae100795
......@@ -154,22 +154,20 @@ void Blitter::clear(void *pixel, vk::Format format, vk::Image *dest, const vk::F
}
}
bool Blitter::fastClear(void *clearValue, vk::Format clearFormat, vk::Image *dest, const vk::Format &viewFormat, const VkImageSubresourceRange &subresourceRange, const VkRect2D *renderArea)
bool Blitter::fastClear(void *pixel, vk::Format format, vk::Image *dest, const vk::Format &viewFormat, const VkImageSubresourceRange &subresourceRange, const VkRect2D *renderArea)
{
if(clearFormat != VK_FORMAT_R32G32B32A32_SFLOAT &&
clearFormat != VK_FORMAT_D32_SFLOAT &&
clearFormat != VK_FORMAT_S8_UINT)
if(format != VK_FORMAT_R32G32B32A32_SFLOAT)
{
return false;
}
float *color = reinterpret_cast<float *>(clearValue);
float *color = (float *)pixel;
float r = color[0];
float g = color[1];
float b = color[2];
float a = color[3];
uint32_t packed = 0;
uint32_t packed;
VkImageAspectFlagBits aspect = static_cast<VkImageAspectFlagBits>(subresourceRange.aspectMask);
switch(viewFormat)
......@@ -204,14 +202,6 @@ bool Blitter::fastClear(void *clearValue, vk::Format clearFormat, vk::Image *des
case VK_FORMAT_E5B9G9R9_UFLOAT_PACK32:
packed = RGB9E5(color);
break;
case VK_FORMAT_D32_SFLOAT:
ASSERT(clearFormat == VK_FORMAT_D32_SFLOAT);
packed = *reinterpret_cast<uint32_t *>(clearValue); // float reinterpreted as uint32
break;
case VK_FORMAT_S8_UINT:
ASSERT(clearFormat == VK_FORMAT_S8_UINT);
packed = *reinterpret_cast<uint8_t *>(clearValue);
break;
default:
return false;
}
......@@ -259,14 +249,6 @@ bool Blitter::fastClear(void *clearValue, vk::Format clearFormat, vk::Image *des
switch(viewFormat.bytes())
{
case 4:
for(uint32_t i = 0; i < area.extent.height; i++)
{
ASSERT(d < dest->end());
sw::clear((uint32_t *)d, packed, area.extent.width);
d += rowPitchBytes;
}
break;
case 2:
for(uint32_t i = 0; i < area.extent.height; i++)
{
......@@ -275,11 +257,11 @@ bool Blitter::fastClear(void *clearValue, vk::Format clearFormat, vk::Image *des
d += rowPitchBytes;
}
break;
case 1:
case 4:
for(uint32_t i = 0; i < area.extent.height; i++)
{
ASSERT(d < dest->end());
memset(d, packed, area.extent.width);
sw::clear((uint32_t *)d, packed, area.extent.width);
d += rowPitchBytes;
}
break;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment