Commit 507e8d30 by Shahbaz Youssefi Committed by Commit Bot

Add missing entries in texture load functions map

GetLoadFunctionsMap() is expected to cover all possible combinations of texture internalformat and upload data format. Several of these combinations were missing, especially w.r.t to compressed types. This change adds the missing combinations that are hit on any of the configurations being tested. An assert is added to catch missing conversion functions in the future. Bug: angleproject:2670 Change-Id: I793ac2c57f65eeb1cc8da8f1b223f6a9a44c7708 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1524462Reviewed-by: 's avatarYuly Novikov <ynovikov@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
parent eaf56133
...@@ -12,11 +12,11 @@ ...@@ -12,11 +12,11 @@
"ANGLE format:src/libANGLE/renderer/gen_angle_format_table.py": "ANGLE format:src/libANGLE/renderer/gen_angle_format_table.py":
"3d9f679b65f39ccf19bd7bdf5498f837", "3d9f679b65f39ccf19bd7bdf5498f837",
"ANGLE load functions table:src/libANGLE/renderer/gen_load_functions_table.py": "ANGLE load functions table:src/libANGLE/renderer/gen_load_functions_table.py":
"475de30b8552795ca928096543cec7f2", "2dcc3aa0cd700165b588cf53441e243b",
"ANGLE load functions table:src/libANGLE/renderer/load_functions_data.json": "ANGLE load functions table:src/libANGLE/renderer/load_functions_data.json":
"4253e14cd3217f42b6fec75ee400655a", "eaca9d5068380214c416bb8e23ca2f99",
"ANGLE load functions table:src/libANGLE/renderer/load_functions_table_autogen.cpp": "ANGLE load functions table:src/libANGLE/renderer/load_functions_table_autogen.cpp":
"557e3a1de1f2373d6a7520a5b21d52ee", "da4924c3be631b8c2abed3023860299b",
"D3D11 blit shader selection:src/libANGLE/renderer/d3d/d3d11/Blit11Helper_autogen.inc": "D3D11 blit shader selection:src/libANGLE/renderer/d3d/d3d11/Blit11Helper_autogen.inc":
"f69cf03a3d868a977fad9e9c0eb0652a", "f69cf03a3d868a977fad9e9c0eb0652a",
"D3D11 blit shader selection:src/libANGLE/renderer/d3d/d3d11/d3d11_blit_shaders_autogen.gni": "D3D11 blit shader selection:src/libANGLE/renderer/d3d/d3d11/d3d11_blit_shaders_autogen.gni":
......
...@@ -1180,6 +1180,36 @@ void LoadG8R24ToR24G8(size_t width, ...@@ -1180,6 +1180,36 @@ void LoadG8R24ToR24G8(size_t width,
} }
} }
void LoadD24S8ToD32FS8X24(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);
uint32_t *destStencil =
priv::OffsetDataPointer<uint32_t>(output, y, z, outputRowPitch, outputDepthPitch) +
1;
for (size_t x = 0; x < width; x++)
{
destDepth[x * 2] = (source[x] & 0xFFFFFF) / static_cast<float>(0xFFFFFF);
destStencil[x * 2] = source[x] & 0xFF000000;
}
}
}
}
void LoadD32FToD32F(size_t width, void LoadD32FToD32F(size_t width,
size_t height, size_t height,
size_t depth, size_t depth,
...@@ -1206,6 +1236,36 @@ void LoadD32FToD32F(size_t width, ...@@ -1206,6 +1236,36 @@ void LoadD32FToD32F(size_t width,
} }
} }
void LoadD32FS8X24ToD24S8(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);
const uint32_t *sourceStencil =
priv::OffsetDataPointer<uint32_t>(input, y, z, inputRowPitch, inputDepthPitch) + 1;
uint32_t *dest =
priv::OffsetDataPointer<uint32_t>(output, y, z, outputRowPitch, outputDepthPitch);
for (size_t x = 0; x < width; x++)
{
uint32_t d = static_cast<uint32_t>(gl::clamp01(sourceDepth[x * 2]) * 0xFFFFFF);
uint32_t s = sourceStencil[x * 2] & 0xFF000000;
dest[x] = d | s;
}
}
}
}
void LoadD32FS8X24ToD32FS8X24(size_t width, void LoadD32FS8X24ToD32FS8X24(size_t width,
size_t height, size_t height,
size_t depth, size_t depth,
...@@ -1267,6 +1327,34 @@ void LoadRGB32FToRGBA16F(size_t width, ...@@ -1267,6 +1327,34 @@ void LoadRGB32FToRGBA16F(size_t width,
} }
} }
void LoadRGB32FToRGB16F(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 *source =
priv::OffsetDataPointer<float>(input, y, z, inputRowPitch, inputDepthPitch);
uint16_t *dest =
priv::OffsetDataPointer<uint16_t>(output, y, z, outputRowPitch, outputDepthPitch);
for (size_t x = 0; x < width; x++)
{
dest[x * 3 + 0] = gl::float32ToFloat16(source[x * 3 + 0]);
dest[x * 3 + 1] = gl::float32ToFloat16(source[x * 3 + 1]);
dest[x * 3 + 2] = gl::float32ToFloat16(source[x * 3 + 2]);
}
}
}
}
void LoadR32ToR16(size_t width, void LoadR32ToR16(size_t width,
size_t height, size_t height,
size_t depth, size_t depth,
......
...@@ -385,6 +385,16 @@ void LoadG8R24ToR24G8(size_t width, ...@@ -385,6 +385,16 @@ void LoadG8R24ToR24G8(size_t width,
size_t outputRowPitch, size_t outputRowPitch,
size_t outputDepthPitch); size_t outputDepthPitch);
void LoadD24S8ToD32FS8X24(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, void LoadD32FToD32F(size_t width,
size_t height, size_t height,
size_t depth, size_t depth,
...@@ -395,6 +405,16 @@ void LoadD32FToD32F(size_t width, ...@@ -395,6 +405,16 @@ void LoadD32FToD32F(size_t width,
size_t outputRowPitch, size_t outputRowPitch,
size_t outputDepthPitch); size_t outputDepthPitch);
void LoadD32FS8X24ToD24S8(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, void LoadD32FS8X24ToD32FS8X24(size_t width,
size_t height, size_t height,
size_t depth, size_t depth,
...@@ -448,6 +468,16 @@ void LoadRGB32FToRGBA16F(size_t width, ...@@ -448,6 +468,16 @@ void LoadRGB32FToRGBA16F(size_t width,
size_t outputRowPitch, size_t outputRowPitch,
size_t outputDepthPitch); size_t outputDepthPitch);
void LoadRGB32FToRGB16F(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);
template <size_t blockWidth, size_t blockHeight, size_t blockSize> template <size_t blockWidth, size_t blockHeight, size_t blockSize>
inline void LoadCompressedToNative(size_t width, inline void LoadCompressedToNative(size_t width,
size_t height, size_t height,
......
...@@ -86,6 +86,7 @@ LoadFunctionMap GetLoadFunctionsMap(GLenum {internal_format}, FormatID {angle_fo ...@@ -86,6 +86,7 @@ LoadFunctionMap GetLoadFunctionsMap(GLenum {internal_format}, FormatID {angle_fo
break; break;
}} }}
// clang-format on // clang-format on
ASSERT(internalFormat == GL_NONE || angleFormat == angle::FormatID::NONE);
static LoadFunctionMap emptyLoadFunctionsMap; static LoadFunctionMap emptyLoadFunctionsMap;
return emptyLoadFunctionsMap; return emptyLoadFunctionsMap;
......
...@@ -205,7 +205,6 @@ void FormatTable::initialize(RendererVk *renderer, ...@@ -205,7 +205,6 @@ void FormatTable::initialize(RendererVk *renderer,
format.initialize(renderer, angleFormat); format.initialize(renderer, angleFormat);
const GLenum internalFormat = format.internalFormat; const GLenum internalFormat = format.internalFormat;
format.textureLoadFunctions = GetLoadFunctionsMap(internalFormat, format.textureFormatID);
format.angleFormatID = formatID; format.angleFormatID = formatID;
if (!format.valid()) if (!format.valid())
...@@ -220,6 +219,12 @@ void FormatTable::initialize(RendererVk *renderer, ...@@ -220,6 +219,12 @@ void FormatTable::initialize(RendererVk *renderer,
FillTextureFormatCaps(renderer, format.vkTextureFormat, &textureCaps); FillTextureFormatCaps(renderer, format.vkTextureFormat, &textureCaps);
outTextureCapsMap->set(formatID, textureCaps); outTextureCapsMap->set(formatID, textureCaps);
if (textureCaps.texturable)
{
format.textureLoadFunctions =
GetLoadFunctionsMap(internalFormat, format.textureFormatID);
}
if (angleFormat.isBlock) if (angleFormat.isBlock)
{ {
outCompressedTextureFormats->push_back(internalFormat); outCompressedTextureFormats->push_back(internalFormat);
......
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