Commit 01867144 by Courtney Goeltzenleuchter Committed by Commit Bot

Vulkan: Add support for D32F_S8 depth_texture

Test: angle_deqp_khr_gles3_tests --deqp-egl-display-type=angle-vulkan --gtest_filter=dEQP.KHR_GLES3/packed_depth_stencil_verify_read_pixels_depth24_stencil8 angle_deqp_khr_gles3_tests --deqp-egl-display-type=angle-vulkan --gtest_filter=dEQP.KHR_GLES3/packed_depth_stencil_clear_buffer_depth32f_stencil8 Full passing results are blocked by suspected driver issues: Bug: angleproject:3683 Bug: angleproject:3689 Bug: angleproject:3457 Change-Id: I7ce1a7824802ebca2c0479a3467fac26013829eb Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1704791 Commit-Queue: Courtney Goeltzenleuchter <courtneygo@google.com> Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org>
parent 4346c8b1
......@@ -1292,6 +1292,58 @@ void LoadX24S8ToS8(size_t width,
}
}
void LoadX32S8ToS8(size_t width,
size_t height,
size_t depth,
const uint8_t *input,
size_t inputRowPitch,
size_t inputDepthPitch,
uint8_t *output,
size_t outputRowPitch,
size_t outputDepthPitch)
{
for (size_t z = 0; z < depth; z++)
{
for (size_t y = 0; y < height; y++)
{
const uint32_t *source = reinterpret_cast<const uint32_t *>(
input + (y * inputRowPitch) + (z * inputDepthPitch));
uint8_t *destStencil =
reinterpret_cast<uint8_t *>(output + (y * outputRowPitch) + (z * outputDepthPitch));
for (size_t x = 0; x < width; x++)
{
destStencil[x] = (source[(x * 2) + 1] & 0xFF);
}
}
}
}
void LoadD32FS8X24ToD32F(size_t width,
size_t height,
size_t depth,
const uint8_t *input,
size_t inputRowPitch,
size_t inputDepthPitch,
uint8_t *output,
size_t outputRowPitch,
size_t outputDepthPitch)
{
for (size_t z = 0; z < depth; z++)
{
for (size_t y = 0; y < height; y++)
{
const float *sourceDepth =
priv::OffsetDataPointer<float>(input, y, z, inputRowPitch, inputDepthPitch);
float *destDepth =
priv::OffsetDataPointer<float>(output, y, z, outputRowPitch, outputDepthPitch);
for (size_t x = 0; x < width; x++)
{
destDepth[x] = gl::clamp01(sourceDepth[x * 2]);
}
}
}
}
void LoadD32FS8X24ToD32FS8X24(size_t width,
size_t height,
size_t depth,
......
......@@ -425,6 +425,26 @@ void LoadX24S8ToS8(size_t width,
size_t outputRowPitch,
size_t outputDepthPitch);
void LoadX32S8ToS8(size_t width,
size_t height,
size_t depth,
const uint8_t *input,
size_t inputRowPitch,
size_t inputDepthPitch,
uint8_t *output,
size_t outputRowPitch,
size_t outputDepthPitch);
void LoadD32FS8X24ToD32F(size_t width,
size_t height,
size_t depth,
const uint8_t *input,
size_t inputRowPitch,
size_t inputDepthPitch,
uint8_t *output,
size_t outputRowPitch,
size_t outputDepthPitch);
void LoadD32FS8X24ToD32FS8X24(size_t width,
size_t height,
size_t depth,
......
......@@ -2082,6 +2082,9 @@ angle::Result ImageHelper::stageSubresourceUpdate(ContextVk *contextVk,
uint32_t bufferImageHeight;
size_t allocationSize;
LoadImageFunctionInfo loadFunctionInfo = vkFormat.textureLoadFunctions(type);
LoadImageFunction stencilLoadFunction = nullptr;
if (storageFormat.isBlock)
{
const gl::InternalFormat &storageFormatInfo = vkFormat.getInternalFormatInfo(type);
......@@ -2117,7 +2120,24 @@ angle::Result ImageHelper::stageSubresourceUpdate(ContextVk *contextVk,
{
ASSERT(storageFormat.pixelBytes != 0);
outputRowPitch = storageFormat.pixelBytes * glExtents.width;
if (storageFormat.id == angle::FormatID::D24_UNORM_S8_UINT)
{
stencilLoadFunction = angle::LoadX24S8ToS8;
}
if (storageFormat.id == angle::FormatID::D32_FLOAT_S8X24_UINT)
{
// If depth is D32FLOAT_S8, we must pack D32F tightly (no stencil) for CopyBufferToImage
outputRowPitch = sizeof(float) * glExtents.width;
// The generic load functions don't handle tightly packing D32FS8 to D32F & S8 so call
// special case load functions.
loadFunctionInfo.loadFunction = angle::LoadD32FS8X24ToD32F;
stencilLoadFunction = angle::LoadX32S8ToS8;
}
else
{
outputRowPitch = storageFormat.pixelBytes * glExtents.width;
}
outputDepthPitch = outputRowPitch * glExtents.height;
bufferRowLength = glExtents.width;
......@@ -2146,11 +2166,9 @@ angle::Result ImageHelper::stageSubresourceUpdate(ContextVk *contextVk,
const uint8_t *source = pixels + static_cast<ptrdiff_t>(inputSkipBytes);
LoadImageFunctionInfo loadFunction = vkFormat.textureLoadFunctions(type);
loadFunction.loadFunction(glExtents.width, glExtents.height, glExtents.depth, source,
inputRowPitch, inputDepthPitch, stagingPointer, outputRowPitch,
outputDepthPitch);
loadFunctionInfo.loadFunction(glExtents.width, glExtents.height, glExtents.depth, source,
inputRowPitch, inputDepthPitch, stagingPointer, outputRowPitch,
outputDepthPitch);
VkBufferImageCopy copy = {};
VkImageAspectFlags aspectFlags = GetFormatAspectFlags(vkFormat.imageFormat());
......@@ -2189,9 +2207,10 @@ angle::Result ImageHelper::stageSubresourceUpdate(ContextVk *contextVk,
outputRowPitch = glExtents.width;
outputDepthPitch = outputRowPitch * glExtents.height;
angle::LoadX24S8ToS8(glExtents.width, glExtents.height, glExtents.depth, source,
inputRowPitch, inputDepthPitch, stagingPointer, outputRowPitch,
outputDepthPitch);
ASSERT(stencilLoadFunction != nullptr);
stencilLoadFunction(glExtents.width, glExtents.height, glExtents.depth, source,
inputRowPitch, inputDepthPitch, stagingPointer, outputRowPitch,
outputDepthPitch);
VkBufferImageCopy stencilCopy = {};
......
......@@ -37,8 +37,7 @@
// Depth/stencil related failures.
3457 VULKAN ANDROID : KHR-GLES3.packed_depth_stencil.*.depth24_stencil8 = FAIL
3457 VULKAN : KHR-GLES3.packed_depth_stencil.verify_read_pixels.depth32f_stencil8 = FAIL
3457 VULKAN : KHR-GLES3.packed_depth_stencil.clear_buffer.depth32f_stencil8 = FAIL
3457 VULKAN ANDROID : KHR-GLES3.packed_depth_stencil.*.depth32f_stencil8 = FAIL
// CopyTexImage conversion missing 2D Array and 3D texture support.
3458 VULKAN : KHR-GLES3.copy_tex_image_conversions.required.texture_array_texture2d = SKIP
......
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