Commit 4133f5c2 by Geoff Lang

24bit depth formats need to flip the depth and stencil bits when loading.

TRAC #23540 Signed-off-by: Jamie Madill Signed-off-by: Shannon Woods
parent 85ea9abb
...@@ -268,10 +268,10 @@ D3D11LoadFunctionMap buildD3D11LoadFunctionMap() ...@@ -268,10 +268,10 @@ D3D11LoadFunctionMap buildD3D11LoadFunctionMap()
insertLoadFunction(&map, GL_R32UI, GL_UNSIGNED_INT, loadToNative<GLuint, 1> ); insertLoadFunction(&map, GL_R32UI, GL_UNSIGNED_INT, loadToNative<GLuint, 1> );
insertLoadFunction(&map, GL_R32I, GL_INT, loadToNative<GLint, 1> ); insertLoadFunction(&map, GL_R32I, GL_INT, loadToNative<GLint, 1> );
insertLoadFunction(&map, GL_DEPTH_COMPONENT16, GL_UNSIGNED_SHORT, loadToNative<GLushort, 1> ); insertLoadFunction(&map, GL_DEPTH_COMPONENT16, GL_UNSIGNED_SHORT, loadToNative<GLushort, 1> );
insertLoadFunction(&map, GL_DEPTH_COMPONENT24, GL_UNSIGNED_INT, loadToNative<GLuint, 1> ); insertLoadFunction(&map, GL_DEPTH_COMPONENT24, GL_UNSIGNED_INT, loadG8R24DataToR24G8 );
insertLoadFunction(&map, GL_DEPTH_COMPONENT16, GL_UNSIGNED_INT, loadUintDataToUshort ); insertLoadFunction(&map, GL_DEPTH_COMPONENT16, GL_UNSIGNED_INT, loadUintDataToUshort );
insertLoadFunction(&map, GL_DEPTH_COMPONENT32F, GL_FLOAT, loadToNative<GLfloat, 1> ); insertLoadFunction(&map, GL_DEPTH_COMPONENT32F, GL_FLOAT, loadToNative<GLfloat, 1> );
insertLoadFunction(&map, GL_DEPTH24_STENCIL8, GL_UNSIGNED_INT_24_8, loadToNative<GLuint, 1> ); insertLoadFunction(&map, GL_DEPTH24_STENCIL8, GL_UNSIGNED_INT_24_8, loadG8R24DataToR24G8 );
insertLoadFunction(&map, GL_DEPTH32F_STENCIL8, GL_FLOAT_32_UNSIGNED_INT_24_8_REV, loadToNative<GLuint, 2> ); insertLoadFunction(&map, GL_DEPTH32F_STENCIL8, GL_FLOAT_32_UNSIGNED_INT_24_8_REV, loadToNative<GLuint, 2> );
// Unsized formats // Unsized formats
......
...@@ -828,6 +828,31 @@ void loadRGBFloatDataTo111110Float(int width, int height, int depth, ...@@ -828,6 +828,31 @@ void loadRGBFloatDataTo111110Float(int width, int height, int depth,
} }
} }
void loadG8R24DataToR24G8(int width, int height, int depth,
const void *input, unsigned int inputRowPitch, unsigned int inputDepthPitch,
void *output, unsigned int outputRowPitch, unsigned int outputDepthPitch)
{
const unsigned int *source = NULL;
unsigned int *dest = NULL;
for (int z = 0; z < depth; z++)
{
for (int y = 0; y < height; y++)
{
source = offsetDataPointer<const unsigned int>(input, y, z, inputRowPitch, inputDepthPitch);
dest = offsetDataPointer<unsigned int>(output, y, z, outputRowPitch, outputDepthPitch);
for (int x = 0; x < width; x++)
{
unsigned int depth = source[x] >> 8;
unsigned int stencil = source[x] & 0xFF;
dest[x] = depth | (stencil << 24);
}
}
}
}
void loadFloatRGBDataToHalfFloatRGBA(int width, int height, int depth, void loadFloatRGBDataToHalfFloatRGBA(int width, int height, int depth,
const void *input, unsigned int inputRowPitch, unsigned int inputDepthPitch, const void *input, unsigned int inputRowPitch, unsigned int inputDepthPitch,
void *output, unsigned int outputRowPitch, unsigned int outputDepthPitch) void *output, unsigned int outputRowPitch, unsigned int outputDepthPitch)
......
...@@ -178,6 +178,10 @@ void loadRGBFloatDataTo111110Float(int width, int height, int depth, ...@@ -178,6 +178,10 @@ void loadRGBFloatDataTo111110Float(int width, int height, int depth,
const void *input, unsigned int inputRowPitch, unsigned int inputDepthPitch, const void *input, unsigned int inputRowPitch, unsigned int inputDepthPitch,
void *output, unsigned int outputRowPitch, unsigned int outputDepthPitch); void *output, unsigned int outputRowPitch, unsigned int outputDepthPitch);
void loadG8R24DataToR24G8(int width, int height, int depth,
const void *input, unsigned int inputRowPitch, unsigned int inputDepthPitch,
void *output, unsigned int outputRowPitch, unsigned int outputDepthPitch);
template <typename type, unsigned int componentCount> template <typename type, unsigned int componentCount>
void loadToNative(int width, int height, int depth, void loadToNative(int width, int height, int depth,
const void *input, unsigned int inputRowPitch, unsigned int inputDepthPitch, const void *input, unsigned int inputRowPitch, unsigned int inputDepthPitch,
......
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