Commit a333b87c by Courtney Goeltzenleuchter Committed by Commit Bot

Vulkan: Handle D24 -> D32FS8X24 depth fallback

Swiftshader's depth support requires that ANGLE fall back to using the D32FS8X24 depth format. Some conversion routines needed to be added to support that use. Test: dEQP.GLES3/functional_texture_format_sized_* Bug: angleproject/3937 Change-Id: I979dc5e9b01dac40f564daad4f4817b61bd056ac Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1829170 Commit-Queue: Courtney Goeltzenleuchter <courtneygo@google.com> Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org>
parent a787b618
......@@ -2,7 +2,7 @@
"src/libANGLE/renderer/gen_load_functions_table.py":
"e65c50e84fc38ad34d0eb0bebb84aab6",
"src/libANGLE/renderer/load_functions_data.json":
"9d7a6eae5190f725e4dc410537bfa660",
"15adad07ae96288c2060016efbd6e97a",
"src/libANGLE/renderer/load_functions_table_autogen.cpp":
"a0b59e47d968007d1344c84a7e61f9fc"
"66ebc5b10e1c6c2554030fbcf894d0c7"
}
\ No newline at end of file
......@@ -1236,6 +1236,86 @@ void LoadD24S8ToD32FS8X24(size_t width,
}
}
void LoadD24S8ToD32F(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 =
priv::OffsetDataPointer<uint32_t>(input, y, z, inputRowPitch, inputDepthPitch);
float *destDepth =
priv::OffsetDataPointer<float>(output, y, z, outputRowPitch, outputDepthPitch);
for (size_t x = 0; x < width; x++)
{
uint32_t sourcePixel = (source[x] >> 8) & 0xFFFFFF;
destDepth[x] = sourcePixel / static_cast<float>(0xFFFFFF);
}
}
}
}
void LoadD32ToD32FX32(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 =
priv::OffsetDataPointer<uint32_t>(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 * 2] = source[x] / static_cast<float>(0xFFFFFFFF);
}
}
}
}
void LoadD32ToD32F(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 =
priv::OffsetDataPointer<uint32_t>(input, y, z, inputRowPitch, inputDepthPitch);
float *destDepth =
priv::OffsetDataPointer<float>(output, y, z, outputRowPitch, outputDepthPitch);
for (size_t x = 0; x < width; x++)
{
uint32_t sourcePixel = source[x];
destDepth[x] = sourcePixel / static_cast<float>(0xFFFFFFFF);
}
}
}
}
void LoadD32FToD32F(size_t width,
size_t height,
size_t depth,
......
......@@ -405,6 +405,36 @@ void LoadD24S8ToD32FS8X24(size_t width,
size_t outputRowPitch,
size_t outputDepthPitch);
void LoadD24S8ToD32F(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 LoadD32ToD32FX32(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 LoadD32ToD32F(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 LoadD32FToD32F(size_t width,
size_t height,
size_t depth,
......
......@@ -646,7 +646,8 @@
"GL_UNSIGNED_INT": "LoadR32ToR24G8"
},
"D32_FLOAT_S8X24_UINT": {
"GL_UNSIGNED_INT_24_8": "LoadD24S8ToD32FS8X24"
"GL_UNSIGNED_INT_24_8": "LoadD24S8ToD32FS8X24",
"GL_UNSIGNED_INT": "LoadD32ToD32FX32"
}
},
"GL_R32I": {
......
......@@ -1466,6 +1466,8 @@ LoadImageFunctionInfo DEPTH_COMPONENT24_to_D32_FLOAT_S8X24_UINT(GLenum type)
{
switch (type)
{
case GL_UNSIGNED_INT:
return LoadImageFunctionInfo(LoadD32ToD32FX32, true);
case GL_UNSIGNED_INT_24_8:
return LoadImageFunctionInfo(LoadD24S8ToD32FS8X24, true);
default:
......
......@@ -2184,8 +2184,24 @@ angle::Result ImageHelper::stageSubresourceUpdate(ContextVk *contextVk,
// 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;
switch (type)
{
case GL_UNSIGNED_INT:
loadFunctionInfo.loadFunction = angle::LoadD32ToD32F;
stencilLoadFunction = nullptr;
break;
case GL_DEPTH32F_STENCIL8:
case GL_FLOAT_32_UNSIGNED_INT_24_8_REV:
loadFunctionInfo.loadFunction = angle::LoadD32FS8X24ToD32F;
stencilLoadFunction = angle::LoadX32S8ToS8;
break;
case GL_UNSIGNED_INT_24_8_OES:
loadFunctionInfo.loadFunction = angle::LoadD24S8ToD32F;
stencilLoadFunction = angle::LoadX24S8ToS8;
break;
default:
UNREACHABLE();
}
}
else
{
......
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