Commit 4107dda9 by Geoff Lang Committed by Commit Bot

Clamp float32 depth data when uploading.

BUG=angleproject:1095 Change-Id: I4c272aef0f94733fc7b5297ddaa1fa2bc765fe62 Reviewed-on: https://chromium-review.googlesource.com/360029Reviewed-by: 's avatarCorentin Wallez <cwallez@chromium.org> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org> Commit-Queue: Geoff Lang <geofflang@chromium.org>
parent 84954988
......@@ -1180,6 +1180,64 @@ void LoadG8R24ToR24G8(size_t width,
}
}
void LoadD32FToD32F(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);
float *dest =
priv::OffsetDataPointer<float>(output, y, z, outputRowPitch, outputDepthPitch);
for (size_t x = 0; x < width; x++)
{
dest[x] = gl::clamp01(source[x]);
}
}
}
}
void LoadD32FS8X24ToD32FS8X24(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;
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] = gl::clamp01(sourceDepth[x * 2]);
destStencil[x * 2] = sourceStencil[x * 2] & 0xFF000000;
}
}
}
}
void LoadRGB32FToRGBA16F(size_t width,
size_t height,
size_t depth,
......
......@@ -385,6 +385,26 @@ void LoadG8R24ToR24G8(size_t width,
size_t outputRowPitch,
size_t outputDepthPitch);
void LoadD32FToD32F(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,
const uint8_t *input,
size_t inputRowPitch,
size_t inputDepthPitch,
uint8_t *output,
size_t outputRowPitch,
size_t outputDepthPitch);
template <typename type, size_t componentCount>
inline void LoadToNative(size_t width,
size_t height,
......
......@@ -553,7 +553,7 @@
"GL_DEPTH_COMPONENT32F": {
"GL_FLOAT": [
{
"loadFunction": "LoadToNative<GLfloat,1>",
"loadFunction": "LoadD32FToD32F",
"dxgiFormat": "DXGI_FORMAT_R32_TYPELESS",
"requiresConversion": "false"
},
......@@ -635,7 +635,7 @@
"GL_DEPTH32F_STENCIL8": {
"GL_FLOAT_32_UNSIGNED_INT_24_8_REV": [
{
"loadFunction": "LoadToNative<GLuint,2>",
"loadFunction": "LoadD32FS8X24ToD32FS8X24",
"dxgiFormat": "DXGI_FORMAT_R32G8X24_TYPELESS",
"requiresConversion": "false"
},
......
......@@ -570,7 +570,7 @@ const std::map<GLenum, LoadImageFunctionInfo> &GetLoadFunctionsMap(GLenum intern
case DXGI_FORMAT_R32G8X24_TYPELESS:
{
static const std::map<GLenum, LoadImageFunctionInfo> loadFunctionsMap = {
{ GL_FLOAT_32_UNSIGNED_INT_24_8_REV, LoadImageFunctionInfo(LoadToNative<GLuint,2>, false) },
{ GL_FLOAT_32_UNSIGNED_INT_24_8_REV, LoadImageFunctionInfo(LoadD32FS8X24ToD32FS8X24, false) },
};
return loadFunctionsMap;
......@@ -649,7 +649,7 @@ const std::map<GLenum, LoadImageFunctionInfo> &GetLoadFunctionsMap(GLenum intern
case DXGI_FORMAT_R32_TYPELESS:
{
static const std::map<GLenum, LoadImageFunctionInfo> loadFunctionsMap = {
{ GL_FLOAT, LoadImageFunctionInfo(LoadToNative<GLfloat,1>, false) },
{ GL_FLOAT, LoadImageFunctionInfo(LoadD32FToD32F, false) },
};
return loadFunctionsMap;
......
......@@ -109,13 +109,7 @@
1436 WIN : dEQP-GLES3.functional.shaders.texture_functions.textureprojgrad.sampler2dshadow_fragment = FAIL
1436 WIN : dEQP-GLES3.functional.shaders.texture_functions.textureprojgradoffset.sampler2dshadow_vertex = FAIL
1436 WIN : dEQP-GLES3.functional.shaders.texture_functions.textureprojgradoffset.sampler2dshadow_fragment = FAIL
1095 WIN : dEQP-GLES3.functional.texture.specification.teximage2d_depth.depth_component32f = FAIL
1095 WIN : dEQP-GLES3.functional.texture.specification.teximage2d_depth.depth32f_stencil8 = FAIL
1095 WIN : dEQP-GLES3.functional.texture.specification.teximage2d_depth_pbo.depth_component32f = FAIL
1095 WIN : dEQP-GLES3.functional.texture.specification.teximage2d_depth_pbo.depth_component24 = FAIL
1095 WIN : dEQP-GLES3.functional.texture.specification.teximage2d_depth_pbo.depth32f_stencil8 = FAIL
1095 WIN : dEQP-GLES3.functional.texture.specification.texsubimage2d_depth.depth_component32f = FAIL
1095 WIN : dEQP-GLES3.functional.texture.specification.texsubimage2d_depth.depth32f_stencil8 = FAIL
1095 WIN : dEQP-GLES3.functional.texture.specification.basic_copytexsubimage2d.2d_rgba = FAIL
1095 WIN : dEQP-GLES3.functional.texture.specification.basic_copytexsubimage2d.2d_alpha = FAIL
1095 WIN : dEQP-GLES3.functional.texture.specification.basic_copytexsubimage2d.2d_luminance_alpha = FAIL
......@@ -124,13 +118,7 @@
1095 WIN : dEQP-GLES3.functional.texture.specification.basic_copytexsubimage2d.cube_alpha = FAIL
1095 WIN : dEQP-GLES3.functional.texture.specification.basic_copytexsubimage2d.cube_luminance_alpha = FAIL
1095 WIN : dEQP-GLES3.functional.texture.specification.basic_copytexsubimage2d.cube_rgb = FAIL
1095 WIN : dEQP-GLES3.functional.texture.specification.teximage3d_depth.depth_component32f_2d_array = FAIL
1095 WIN : dEQP-GLES3.functional.texture.specification.teximage3d_depth.depth32f_stencil8_2d_array = FAIL
1095 WIN : dEQP-GLES3.functional.texture.specification.teximage3d_depth_pbo.depth_component32f_2d_array = FAIL
1095 WIN : dEQP-GLES3.functional.texture.specification.teximage3d_depth_pbo.depth32f_stencil8_2d_array = FAIL
1095 WIN : dEQP-GLES3.functional.texture.specification.teximage3d_depth_pbo.depth_component24_2d_array = FAIL
1095 WIN : dEQP-GLES3.functional.texture.specification.texsubimage3d_depth.depth_component32f_2d_array = FAIL
1095 WIN : dEQP-GLES3.functional.texture.specification.texsubimage3d_depth.depth32f_stencil8_2d_array = FAIL
1096 WIN : dEQP-GLES3.functional.fragment_ops.depth_stencil.stencil_depth_funcs.stencil_* = FAIL
1096 WIN : dEQP-GLES3.functional.fragment_ops.depth_stencil.stencil_ops.* = FAIL
1096 WIN : dEQP-GLES3.functional.fragment_ops.depth_stencil.write_mask.* = FAIL
......
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