Commit eb026f1c by Nicolas Capens Committed by Nicolas Capens

Fix support for NPOT 3D and 2D array textures.

The slices of 3D and 2D array textures are not at pitch * height offset apart when the height is odd, due to allocating 2x2 quads for render targets. Explicitly use the slice size instead. Change-Id: Id35f35f21a5b2b199215e2526239bcd459141e2c Reviewed-on: https://swiftshader-review.googlesource.com/14348Reviewed-by: 's avatarAlexis Hétu <sugoi@google.com> Tested-by: 's avatarNicolas Capens <nicolascapens@google.com>
parent d19db3dc
...@@ -414,12 +414,12 @@ namespace ...@@ -414,12 +414,12 @@ namespace
} }
template<DataType dataType> template<DataType dataType>
void LoadImageData(GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, int inputPitch, int inputHeight, int destPitch, GLsizei destHeight, const void *input, void *buffer) void LoadImageData(GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, int inputPitch, int inputHeight, int destPitch, GLsizei destSlice, const void *input, void *buffer)
{ {
for(int z = 0; z < depth; ++z) for(int z = 0; z < depth; ++z)
{ {
const unsigned char *inputStart = static_cast<const unsigned char*>(input) + (z * inputPitch * inputHeight); const unsigned char *inputStart = static_cast<const unsigned char*>(input) + (z * inputPitch * inputHeight);
unsigned char *destStart = static_cast<unsigned char*>(buffer) + ((zoffset + z) * destPitch * destHeight); unsigned char *destStart = static_cast<unsigned char*>(buffer) + ((zoffset + z) * destSlice);
for(int y = 0; y < height; ++y) for(int y = 0; y < height; ++y)
{ {
const unsigned char *source = inputStart + y * inputPitch; const unsigned char *source = inputStart + y * inputPitch;
...@@ -1369,7 +1369,7 @@ namespace egl ...@@ -1369,7 +1369,7 @@ namespace egl
case GL_ALPHA8_EXT: case GL_ALPHA8_EXT:
case GL_LUMINANCE: case GL_LUMINANCE:
case GL_LUMINANCE8_EXT: case GL_LUMINANCE8_EXT:
LoadImageData<Bytes_1>(xoffset, yoffset, zoffset, width, height, depth, inputPitch, inputHeight, getPitch(), getHeight(), input, buffer); LoadImageData<Bytes_1>(xoffset, yoffset, zoffset, width, height, depth, inputPitch, inputHeight, getPitch(), getSlice(), input, buffer);
break; break;
case GL_RG8: case GL_RG8:
case GL_RG8I: case GL_RG8I:
...@@ -1378,14 +1378,14 @@ namespace egl ...@@ -1378,14 +1378,14 @@ namespace egl
case GL_RG_INTEGER: case GL_RG_INTEGER:
case GL_LUMINANCE_ALPHA: case GL_LUMINANCE_ALPHA:
case GL_LUMINANCE8_ALPHA8_EXT: case GL_LUMINANCE8_ALPHA8_EXT:
LoadImageData<Bytes_2>(xoffset, yoffset, zoffset, width, height, depth, inputPitch, inputHeight, getPitch(), getHeight(), input, buffer); LoadImageData<Bytes_2>(xoffset, yoffset, zoffset, width, height, depth, inputPitch, inputHeight, getPitch(), getSlice(), input, buffer);
break; break;
case GL_RGB8: case GL_RGB8:
case GL_RGB8I: case GL_RGB8I:
case GL_RGB8_SNORM: case GL_RGB8_SNORM:
case GL_RGB: case GL_RGB:
case GL_RGB_INTEGER: case GL_RGB_INTEGER:
LoadImageData<ByteRGB>(xoffset, yoffset, zoffset, width, height, depth, inputPitch, inputHeight, getPitch(), getHeight(), input, buffer); LoadImageData<ByteRGB>(xoffset, yoffset, zoffset, width, height, depth, inputPitch, inputHeight, getPitch(), getSlice(), input, buffer);
break; break;
case GL_RGBA8: case GL_RGBA8:
case GL_RGBA8I: case GL_RGBA8I:
...@@ -1394,7 +1394,7 @@ namespace egl ...@@ -1394,7 +1394,7 @@ namespace egl
case GL_RGBA_INTEGER: case GL_RGBA_INTEGER:
case GL_BGRA_EXT: case GL_BGRA_EXT:
case GL_BGRA8_EXT: case GL_BGRA8_EXT:
LoadImageData<Bytes_4>(xoffset, yoffset, zoffset, width, height, depth, inputPitch, inputHeight, getPitch(), getHeight(), input, buffer); LoadImageData<Bytes_4>(xoffset, yoffset, zoffset, width, height, depth, inputPitch, inputHeight, getPitch(), getSlice(), input, buffer);
break; break;
default: UNREACHABLE(format); default: UNREACHABLE(format);
} }
...@@ -1411,7 +1411,7 @@ namespace egl ...@@ -1411,7 +1411,7 @@ namespace egl
case GL_ALPHA8_EXT: case GL_ALPHA8_EXT:
case GL_LUMINANCE: case GL_LUMINANCE:
case GL_LUMINANCE8_EXT: case GL_LUMINANCE8_EXT:
LoadImageData<Bytes_1>(xoffset, yoffset, zoffset, width, height, depth, inputPitch, inputHeight, getPitch(), getHeight(), input, buffer); LoadImageData<Bytes_1>(xoffset, yoffset, zoffset, width, height, depth, inputPitch, inputHeight, getPitch(), getSlice(), input, buffer);
break; break;
case GL_RG8: case GL_RG8:
case GL_RG8UI: case GL_RG8UI:
...@@ -1420,14 +1420,14 @@ namespace egl ...@@ -1420,14 +1420,14 @@ namespace egl
case GL_RG_INTEGER: case GL_RG_INTEGER:
case GL_LUMINANCE_ALPHA: case GL_LUMINANCE_ALPHA:
case GL_LUMINANCE8_ALPHA8_EXT: case GL_LUMINANCE8_ALPHA8_EXT:
LoadImageData<Bytes_2>(xoffset, yoffset, zoffset, width, height, depth, inputPitch, inputHeight, getPitch(), getHeight(), input, buffer); LoadImageData<Bytes_2>(xoffset, yoffset, zoffset, width, height, depth, inputPitch, inputHeight, getPitch(), getSlice(), input, buffer);
break; break;
case GL_RGB8: case GL_RGB8:
case GL_RGB8UI: case GL_RGB8UI:
case GL_RGB8_SNORM: case GL_RGB8_SNORM:
case GL_RGB: case GL_RGB:
case GL_RGB_INTEGER: case GL_RGB_INTEGER:
LoadImageData<UByteRGB>(xoffset, yoffset, zoffset, width, height, depth, inputPitch, inputHeight, getPitch(), getHeight(), input, buffer); LoadImageData<UByteRGB>(xoffset, yoffset, zoffset, width, height, depth, inputPitch, inputHeight, getPitch(), getSlice(), input, buffer);
break; break;
case GL_RGBA8: case GL_RGBA8:
case GL_RGBA8UI: case GL_RGBA8UI:
...@@ -1436,13 +1436,13 @@ namespace egl ...@@ -1436,13 +1436,13 @@ namespace egl
case GL_RGBA_INTEGER: case GL_RGBA_INTEGER:
case GL_BGRA_EXT: case GL_BGRA_EXT:
case GL_BGRA8_EXT: case GL_BGRA8_EXT:
LoadImageData<Bytes_4>(xoffset, yoffset, zoffset, width, height, depth, inputPitch, inputHeight, getPitch(), getHeight(), input, buffer); LoadImageData<Bytes_4>(xoffset, yoffset, zoffset, width, height, depth, inputPitch, inputHeight, getPitch(), getSlice(), input, buffer);
break; break;
case GL_SRGB8: case GL_SRGB8:
LoadImageData<SRGB>(xoffset, yoffset, zoffset, width, height, depth, inputPitch, inputHeight, getPitch(), getHeight(), input, buffer); LoadImageData<SRGB>(xoffset, yoffset, zoffset, width, height, depth, inputPitch, inputHeight, getPitch(), getSlice(), input, buffer);
break; break;
case GL_SRGB8_ALPHA8: case GL_SRGB8_ALPHA8:
LoadImageData<SRGBA>(xoffset, yoffset, zoffset, width, height, depth, inputPitch, inputHeight, getPitch(), getHeight(), input, buffer); LoadImageData<SRGBA>(xoffset, yoffset, zoffset, width, height, depth, inputPitch, inputHeight, getPitch(), getSlice(), input, buffer);
break; break;
default: UNREACHABLE(format); default: UNREACHABLE(format);
} }
...@@ -1452,7 +1452,7 @@ namespace egl ...@@ -1452,7 +1452,7 @@ namespace egl
{ {
case GL_RGB565: case GL_RGB565:
case GL_RGB: case GL_RGB:
LoadImageData<RGB565>(xoffset, yoffset, zoffset, width, height, depth, inputPitch, inputHeight, getPitch(), getHeight(), input, buffer); LoadImageData<RGB565>(xoffset, yoffset, zoffset, width, height, depth, inputPitch, inputHeight, getPitch(), getSlice(), input, buffer);
break; break;
default: UNREACHABLE(format); default: UNREACHABLE(format);
} }
...@@ -1462,7 +1462,7 @@ namespace egl ...@@ -1462,7 +1462,7 @@ namespace egl
{ {
case GL_RGBA4: case GL_RGBA4:
case GL_RGBA: case GL_RGBA:
LoadImageData<RGBA4444>(xoffset, yoffset, zoffset, width, height, depth, inputPitch, inputHeight, getPitch(), getHeight(), input, buffer); LoadImageData<RGBA4444>(xoffset, yoffset, zoffset, width, height, depth, inputPitch, inputHeight, getPitch(), getSlice(), input, buffer);
break; break;
default: UNREACHABLE(format); default: UNREACHABLE(format);
} }
...@@ -1472,7 +1472,7 @@ namespace egl ...@@ -1472,7 +1472,7 @@ namespace egl
{ {
case GL_RGB5_A1: case GL_RGB5_A1:
case GL_RGBA: case GL_RGBA:
LoadImageData<RGBA5551>(xoffset, yoffset, zoffset, width, height, depth, inputPitch, inputHeight, getPitch(), getHeight(), input, buffer); LoadImageData<RGBA5551>(xoffset, yoffset, zoffset, width, height, depth, inputPitch, inputHeight, getPitch(), getSlice(), input, buffer);
break; break;
default: UNREACHABLE(format); default: UNREACHABLE(format);
} }
...@@ -1482,7 +1482,7 @@ namespace egl ...@@ -1482,7 +1482,7 @@ namespace egl
{ {
case GL_R11F_G11F_B10F: case GL_R11F_G11F_B10F:
case GL_RGB: case GL_RGB:
LoadImageData<R11G11B10F>(xoffset, yoffset, zoffset, width, height, depth, inputPitch, inputHeight, getPitch(), getHeight(), input, buffer); LoadImageData<R11G11B10F>(xoffset, yoffset, zoffset, width, height, depth, inputPitch, inputHeight, getPitch(), getSlice(), input, buffer);
break; break;
default: UNREACHABLE(format); default: UNREACHABLE(format);
} }
...@@ -1492,7 +1492,7 @@ namespace egl ...@@ -1492,7 +1492,7 @@ namespace egl
{ {
case GL_RGB9_E5: case GL_RGB9_E5:
case GL_RGB: case GL_RGB:
LoadImageData<RGB9E5>(xoffset, yoffset, zoffset, width, height, depth, inputPitch, inputHeight, getPitch(), getHeight(), input, buffer); LoadImageData<RGB9E5>(xoffset, yoffset, zoffset, width, height, depth, inputPitch, inputHeight, getPitch(), getSlice(), input, buffer);
break; break;
default: UNREACHABLE(format); default: UNREACHABLE(format);
} }
...@@ -1501,12 +1501,12 @@ namespace egl ...@@ -1501,12 +1501,12 @@ namespace egl
switch(format) switch(format)
{ {
case GL_RGB10_A2UI: case GL_RGB10_A2UI:
LoadImageData<RGB10A2UI>(xoffset, yoffset, zoffset, width, height, depth, inputPitch, inputHeight, getPitch(), getHeight(), input, buffer); LoadImageData<RGB10A2UI>(xoffset, yoffset, zoffset, width, height, depth, inputPitch, inputHeight, getPitch(), getSlice(), input, buffer);
break; break;
case GL_RGB10_A2: case GL_RGB10_A2:
case GL_RGBA: case GL_RGBA:
case GL_RGBA_INTEGER: case GL_RGBA_INTEGER:
LoadImageData<Bytes_4>(xoffset, yoffset, zoffset, width, height, depth, inputPitch, inputHeight, getPitch(), getHeight(), input, buffer); LoadImageData<Bytes_4>(xoffset, yoffset, zoffset, width, height, depth, inputPitch, inputHeight, getPitch(), getSlice(), input, buffer);
break; break;
default: UNREACHABLE(format); default: UNREACHABLE(format);
} }
...@@ -1517,41 +1517,41 @@ namespace egl ...@@ -1517,41 +1517,41 @@ namespace egl
// float textures are converted to RGBA, not BGRA // float textures are converted to RGBA, not BGRA
case GL_ALPHA: case GL_ALPHA:
case GL_ALPHA32F_EXT: case GL_ALPHA32F_EXT:
LoadImageData<Bytes_4>(xoffset, yoffset, zoffset, width, height, depth, inputPitch, inputHeight, getPitch(), getHeight(), input, buffer); LoadImageData<Bytes_4>(xoffset, yoffset, zoffset, width, height, depth, inputPitch, inputHeight, getPitch(), getSlice(), input, buffer);
break; break;
case GL_LUMINANCE: case GL_LUMINANCE:
case GL_LUMINANCE32F_EXT: case GL_LUMINANCE32F_EXT:
LoadImageData<Bytes_4>(xoffset, yoffset, zoffset, width, height, depth, inputPitch, inputHeight, getPitch(), getHeight(), input, buffer); LoadImageData<Bytes_4>(xoffset, yoffset, zoffset, width, height, depth, inputPitch, inputHeight, getPitch(), getSlice(), input, buffer);
break; break;
case GL_LUMINANCE_ALPHA: case GL_LUMINANCE_ALPHA:
case GL_LUMINANCE_ALPHA32F_EXT: case GL_LUMINANCE_ALPHA32F_EXT:
LoadImageData<Bytes_8>(xoffset, yoffset, zoffset, width, height, depth, inputPitch, inputHeight, getPitch(), getHeight(), input, buffer); LoadImageData<Bytes_8>(xoffset, yoffset, zoffset, width, height, depth, inputPitch, inputHeight, getPitch(), getSlice(), input, buffer);
break; break;
case GL_RED: case GL_RED:
case GL_R32F: case GL_R32F:
LoadImageData<Bytes_4>(xoffset, yoffset, zoffset, width, height, depth, inputPitch, inputHeight, getPitch(), getHeight(), input, buffer); LoadImageData<Bytes_4>(xoffset, yoffset, zoffset, width, height, depth, inputPitch, inputHeight, getPitch(), getSlice(), input, buffer);
break; break;
case GL_RG: case GL_RG:
case GL_RG32F: case GL_RG32F:
LoadImageData<Bytes_8>(xoffset, yoffset, zoffset, width, height, depth, inputPitch, inputHeight, getPitch(), getHeight(), input, buffer); LoadImageData<Bytes_8>(xoffset, yoffset, zoffset, width, height, depth, inputPitch, inputHeight, getPitch(), getSlice(), input, buffer);
break; break;
case GL_RGB: case GL_RGB:
case GL_RGB32F: case GL_RGB32F:
LoadImageData<FloatRGB>(xoffset, yoffset, zoffset, width, height, depth, inputPitch, inputHeight, getPitch(), getHeight(), input, buffer); LoadImageData<FloatRGB>(xoffset, yoffset, zoffset, width, height, depth, inputPitch, inputHeight, getPitch(), getSlice(), input, buffer);
break; break;
case GL_RGBA: case GL_RGBA:
case GL_RGBA32F: case GL_RGBA32F:
LoadImageData<Bytes_16>(xoffset, yoffset, zoffset, width, height, depth, inputPitch, inputHeight, getPitch(), getHeight(), input, buffer); LoadImageData<Bytes_16>(xoffset, yoffset, zoffset, width, height, depth, inputPitch, inputHeight, getPitch(), getSlice(), input, buffer);
break; break;
case GL_R11F_G11F_B10F: case GL_R11F_G11F_B10F:
LoadImageData<R11G11B10F>(xoffset, yoffset, zoffset, width, height, depth, inputPitch, inputHeight, getPitch(), getHeight(), input, buffer); LoadImageData<R11G11B10F>(xoffset, yoffset, zoffset, width, height, depth, inputPitch, inputHeight, getPitch(), getSlice(), input, buffer);
break; break;
case GL_RGB9_E5: case GL_RGB9_E5:
LoadImageData<RGB9E5>(xoffset, yoffset, zoffset, width, height, depth, inputPitch, inputHeight, getPitch(), getHeight(), input, buffer); LoadImageData<RGB9E5>(xoffset, yoffset, zoffset, width, height, depth, inputPitch, inputHeight, getPitch(), getSlice(), input, buffer);
break; break;
case GL_DEPTH_COMPONENT: case GL_DEPTH_COMPONENT:
case GL_DEPTH_COMPONENT32F: case GL_DEPTH_COMPONENT32F:
LoadImageData<D32F>(xoffset, yoffset, zoffset, width, height, depth, inputPitch, inputHeight, getPitch(), getHeight(), input, buffer); LoadImageData<D32F>(xoffset, yoffset, zoffset, width, height, depth, inputPitch, inputHeight, getPitch(), getSlice(), input, buffer);
break; break;
default: UNREACHABLE(format); default: UNREACHABLE(format);
} }
...@@ -1562,37 +1562,37 @@ namespace egl ...@@ -1562,37 +1562,37 @@ namespace egl
{ {
case GL_ALPHA: case GL_ALPHA:
case GL_ALPHA16F_EXT: case GL_ALPHA16F_EXT:
LoadImageData<Bytes_2>(xoffset, yoffset, zoffset, width, height, depth, inputPitch, inputHeight, getPitch(), getHeight(), input, buffer); LoadImageData<Bytes_2>(xoffset, yoffset, zoffset, width, height, depth, inputPitch, inputHeight, getPitch(), getSlice(), input, buffer);
break; break;
case GL_LUMINANCE: case GL_LUMINANCE:
case GL_LUMINANCE16F_EXT: case GL_LUMINANCE16F_EXT:
LoadImageData<Bytes_2>(xoffset, yoffset, zoffset, width, height, depth, inputPitch, inputHeight, getPitch(), getHeight(), input, buffer); LoadImageData<Bytes_2>(xoffset, yoffset, zoffset, width, height, depth, inputPitch, inputHeight, getPitch(), getSlice(), input, buffer);
break; break;
case GL_LUMINANCE_ALPHA: case GL_LUMINANCE_ALPHA:
case GL_LUMINANCE_ALPHA16F_EXT: case GL_LUMINANCE_ALPHA16F_EXT:
LoadImageData<Bytes_4>(xoffset, yoffset, zoffset, width, height, depth, inputPitch, inputHeight, getPitch(), getHeight(), input, buffer); LoadImageData<Bytes_4>(xoffset, yoffset, zoffset, width, height, depth, inputPitch, inputHeight, getPitch(), getSlice(), input, buffer);
break; break;
case GL_RED: case GL_RED:
case GL_R16F: case GL_R16F:
LoadImageData<Bytes_2>(xoffset, yoffset, zoffset, width, height, depth, inputPitch, inputHeight, getPitch(), getHeight(), input, buffer); LoadImageData<Bytes_2>(xoffset, yoffset, zoffset, width, height, depth, inputPitch, inputHeight, getPitch(), getSlice(), input, buffer);
break; break;
case GL_RG: case GL_RG:
case GL_RG16F: case GL_RG16F:
LoadImageData<Bytes_4>(xoffset, yoffset, zoffset, width, height, depth, inputPitch, inputHeight, getPitch(), getHeight(), input, buffer); LoadImageData<Bytes_4>(xoffset, yoffset, zoffset, width, height, depth, inputPitch, inputHeight, getPitch(), getSlice(), input, buffer);
break; break;
case GL_RGB: case GL_RGB:
case GL_RGB16F: case GL_RGB16F:
LoadImageData<HalfFloatRGB>(xoffset, yoffset, zoffset, width, height, depth, inputPitch, inputHeight, getPitch(), getHeight(), input, buffer); LoadImageData<HalfFloatRGB>(xoffset, yoffset, zoffset, width, height, depth, inputPitch, inputHeight, getPitch(), getSlice(), input, buffer);
break; break;
case GL_RGBA: case GL_RGBA:
case GL_RGBA16F: case GL_RGBA16F:
LoadImageData<Bytes_8>(xoffset, yoffset, zoffset, width, height, depth, inputPitch, inputHeight, getPitch(), getHeight(), input, buffer); LoadImageData<Bytes_8>(xoffset, yoffset, zoffset, width, height, depth, inputPitch, inputHeight, getPitch(), getSlice(), input, buffer);
break; break;
case GL_R11F_G11F_B10F: case GL_R11F_G11F_B10F:
LoadImageData<R11G11B10F>(xoffset, yoffset, zoffset, width, height, depth, inputPitch, inputHeight, getPitch(), getHeight(), input, buffer); LoadImageData<R11G11B10F>(xoffset, yoffset, zoffset, width, height, depth, inputPitch, inputHeight, getPitch(), getSlice(), input, buffer);
break; break;
case GL_RGB9_E5: case GL_RGB9_E5:
LoadImageData<RGB9E5>(xoffset, yoffset, zoffset, width, height, depth, inputPitch, inputHeight, getPitch(), getHeight(), input, buffer); LoadImageData<RGB9E5>(xoffset, yoffset, zoffset, width, height, depth, inputPitch, inputHeight, getPitch(), getSlice(), input, buffer);
break; break;
default: UNREACHABLE(format); default: UNREACHABLE(format);
} }
...@@ -1605,25 +1605,25 @@ namespace egl ...@@ -1605,25 +1605,25 @@ namespace egl
case GL_RED_INTEGER: case GL_RED_INTEGER:
case GL_ALPHA: case GL_ALPHA:
case GL_LUMINANCE: case GL_LUMINANCE:
LoadImageData<Bytes_2>(xoffset, yoffset, zoffset, width, height, depth, inputPitch, inputHeight, getPitch(), getHeight(), input, buffer); LoadImageData<Bytes_2>(xoffset, yoffset, zoffset, width, height, depth, inputPitch, inputHeight, getPitch(), getSlice(), input, buffer);
break; break;
case GL_RG16I: case GL_RG16I:
case GL_RG: case GL_RG:
case GL_RG_INTEGER: case GL_RG_INTEGER:
case GL_LUMINANCE_ALPHA: case GL_LUMINANCE_ALPHA:
LoadImageData<Bytes_4>(xoffset, yoffset, zoffset, width, height, depth, inputPitch, inputHeight, getPitch(), getHeight(), input, buffer); LoadImageData<Bytes_4>(xoffset, yoffset, zoffset, width, height, depth, inputPitch, inputHeight, getPitch(), getSlice(), input, buffer);
break; break;
case GL_RGB16I: case GL_RGB16I:
case GL_RGB: case GL_RGB:
case GL_RGB_INTEGER: case GL_RGB_INTEGER:
LoadImageData<ShortRGB>(xoffset, yoffset, zoffset, width, height, depth, inputPitch, inputHeight, getPitch(), getHeight(), input, buffer); LoadImageData<ShortRGB>(xoffset, yoffset, zoffset, width, height, depth, inputPitch, inputHeight, getPitch(), getSlice(), input, buffer);
break; break;
case GL_RGBA16I: case GL_RGBA16I:
case GL_RGBA: case GL_RGBA:
case GL_RGBA_INTEGER: case GL_RGBA_INTEGER:
case GL_BGRA_EXT: case GL_BGRA_EXT:
case GL_BGRA8_EXT: case GL_BGRA8_EXT:
LoadImageData<Bytes_8>(xoffset, yoffset, zoffset, width, height, depth, inputPitch, inputHeight, getPitch(), getHeight(), input, buffer); LoadImageData<Bytes_8>(xoffset, yoffset, zoffset, width, height, depth, inputPitch, inputHeight, getPitch(), getSlice(), input, buffer);
break; break;
default: UNREACHABLE(format); default: UNREACHABLE(format);
} }
...@@ -1636,29 +1636,29 @@ namespace egl ...@@ -1636,29 +1636,29 @@ namespace egl
case GL_RED_INTEGER: case GL_RED_INTEGER:
case GL_ALPHA: case GL_ALPHA:
case GL_LUMINANCE: case GL_LUMINANCE:
LoadImageData<Bytes_2>(xoffset, yoffset, zoffset, width, height, depth, inputPitch, inputHeight, getPitch(), getHeight(), input, buffer); LoadImageData<Bytes_2>(xoffset, yoffset, zoffset, width, height, depth, inputPitch, inputHeight, getPitch(), getSlice(), input, buffer);
break; break;
case GL_RG16UI: case GL_RG16UI:
case GL_RG: case GL_RG:
case GL_RG_INTEGER: case GL_RG_INTEGER:
case GL_LUMINANCE_ALPHA: case GL_LUMINANCE_ALPHA:
LoadImageData<Bytes_4>(xoffset, yoffset, zoffset, width, height, depth, inputPitch, inputHeight, getPitch(), getHeight(), input, buffer); LoadImageData<Bytes_4>(xoffset, yoffset, zoffset, width, height, depth, inputPitch, inputHeight, getPitch(), getSlice(), input, buffer);
break; break;
case GL_RGB16UI: case GL_RGB16UI:
case GL_RGB: case GL_RGB:
case GL_RGB_INTEGER: case GL_RGB_INTEGER:
LoadImageData<UShortRGB>(xoffset, yoffset, zoffset, width, height, depth, inputPitch, inputHeight, getPitch(), getHeight(), input, buffer); LoadImageData<UShortRGB>(xoffset, yoffset, zoffset, width, height, depth, inputPitch, inputHeight, getPitch(), getSlice(), input, buffer);
break; break;
case GL_RGBA16UI: case GL_RGBA16UI:
case GL_RGBA: case GL_RGBA:
case GL_RGBA_INTEGER: case GL_RGBA_INTEGER:
case GL_BGRA_EXT: case GL_BGRA_EXT:
case GL_BGRA8_EXT: case GL_BGRA8_EXT:
LoadImageData<Bytes_8>(xoffset, yoffset, zoffset, width, height, depth, inputPitch, inputHeight, getPitch(), getHeight(), input, buffer); LoadImageData<Bytes_8>(xoffset, yoffset, zoffset, width, height, depth, inputPitch, inputHeight, getPitch(), getSlice(), input, buffer);
break; break;
case GL_DEPTH_COMPONENT: case GL_DEPTH_COMPONENT:
case GL_DEPTH_COMPONENT16: case GL_DEPTH_COMPONENT16:
LoadImageData<D16>(xoffset, yoffset, zoffset, width, height, depth, inputPitch, inputHeight, getPitch(), getHeight(), input, buffer); LoadImageData<D16>(xoffset, yoffset, zoffset, width, height, depth, inputPitch, inputHeight, getPitch(), getSlice(), input, buffer);
break; break;
default: UNREACHABLE(format); default: UNREACHABLE(format);
} }
...@@ -1671,25 +1671,25 @@ namespace egl ...@@ -1671,25 +1671,25 @@ namespace egl
case GL_RED_INTEGER: case GL_RED_INTEGER:
case GL_ALPHA: case GL_ALPHA:
case GL_LUMINANCE: case GL_LUMINANCE:
LoadImageData<Bytes_4>(xoffset, yoffset, zoffset, width, height, depth, inputPitch, inputHeight, getPitch(), getHeight(), input, buffer); LoadImageData<Bytes_4>(xoffset, yoffset, zoffset, width, height, depth, inputPitch, inputHeight, getPitch(), getSlice(), input, buffer);
break; break;
case GL_RG32I: case GL_RG32I:
case GL_RG: case GL_RG:
case GL_RG_INTEGER: case GL_RG_INTEGER:
case GL_LUMINANCE_ALPHA: case GL_LUMINANCE_ALPHA:
LoadImageData<Bytes_8>(xoffset, yoffset, zoffset, width, height, depth, inputPitch, inputHeight, getPitch(), getHeight(), input, buffer); LoadImageData<Bytes_8>(xoffset, yoffset, zoffset, width, height, depth, inputPitch, inputHeight, getPitch(), getSlice(), input, buffer);
break; break;
case GL_RGB32I: case GL_RGB32I:
case GL_RGB: case GL_RGB:
case GL_RGB_INTEGER: case GL_RGB_INTEGER:
LoadImageData<IntRGB>(xoffset, yoffset, zoffset, width, height, depth, inputPitch, inputHeight, getPitch(), getHeight(), input, buffer); LoadImageData<IntRGB>(xoffset, yoffset, zoffset, width, height, depth, inputPitch, inputHeight, getPitch(), getSlice(), input, buffer);
break; break;
case GL_RGBA32I: case GL_RGBA32I:
case GL_RGBA: case GL_RGBA:
case GL_RGBA_INTEGER: case GL_RGBA_INTEGER:
case GL_BGRA_EXT: case GL_BGRA_EXT:
case GL_BGRA8_EXT: case GL_BGRA8_EXT:
LoadImageData<Bytes_16>(xoffset, yoffset, zoffset, width, height, depth, inputPitch, inputHeight, getPitch(), getHeight(), input, buffer); LoadImageData<Bytes_16>(xoffset, yoffset, zoffset, width, height, depth, inputPitch, inputHeight, getPitch(), getSlice(), input, buffer);
break; break;
default: UNREACHABLE(format); default: UNREACHABLE(format);
} }
...@@ -1702,31 +1702,31 @@ namespace egl ...@@ -1702,31 +1702,31 @@ namespace egl
case GL_RED_INTEGER: case GL_RED_INTEGER:
case GL_ALPHA: case GL_ALPHA:
case GL_LUMINANCE: case GL_LUMINANCE:
LoadImageData<Bytes_4>(xoffset, yoffset, zoffset, width, height, depth, inputPitch, inputHeight, getPitch(), getHeight(), input, buffer); LoadImageData<Bytes_4>(xoffset, yoffset, zoffset, width, height, depth, inputPitch, inputHeight, getPitch(), getSlice(), input, buffer);
break; break;
case GL_RG32UI: case GL_RG32UI:
case GL_RG: case GL_RG:
case GL_RG_INTEGER: case GL_RG_INTEGER:
case GL_LUMINANCE_ALPHA: case GL_LUMINANCE_ALPHA:
LoadImageData<Bytes_8>(xoffset, yoffset, zoffset, width, height, depth, inputPitch, inputHeight, getPitch(), getHeight(), input, buffer); LoadImageData<Bytes_8>(xoffset, yoffset, zoffset, width, height, depth, inputPitch, inputHeight, getPitch(), getSlice(), input, buffer);
break; break;
case GL_RGB32UI: case GL_RGB32UI:
case GL_RGB: case GL_RGB:
case GL_RGB_INTEGER: case GL_RGB_INTEGER:
LoadImageData<UIntRGB>(xoffset, yoffset, zoffset, width, height, depth, inputPitch, inputHeight, getPitch(), getHeight(), input, buffer); LoadImageData<UIntRGB>(xoffset, yoffset, zoffset, width, height, depth, inputPitch, inputHeight, getPitch(), getSlice(), input, buffer);
break; break;
case GL_RGBA32UI: case GL_RGBA32UI:
case GL_RGBA: case GL_RGBA:
case GL_RGBA_INTEGER: case GL_RGBA_INTEGER:
case GL_BGRA_EXT: case GL_BGRA_EXT:
case GL_BGRA8_EXT: case GL_BGRA8_EXT:
LoadImageData<Bytes_16>(xoffset, yoffset, zoffset, width, height, depth, inputPitch, inputHeight, getPitch(), getHeight(), input, buffer); LoadImageData<Bytes_16>(xoffset, yoffset, zoffset, width, height, depth, inputPitch, inputHeight, getPitch(), getSlice(), input, buffer);
break; break;
case GL_DEPTH_COMPONENT16: case GL_DEPTH_COMPONENT16:
case GL_DEPTH_COMPONENT24: case GL_DEPTH_COMPONENT24:
case GL_DEPTH_COMPONENT32_OES: case GL_DEPTH_COMPONENT32_OES:
case GL_DEPTH_COMPONENT: case GL_DEPTH_COMPONENT:
LoadImageData<D32>(xoffset, yoffset, zoffset, width, height, depth, inputPitch, inputHeight, getPitch(), getHeight(), input, buffer); LoadImageData<D32>(xoffset, yoffset, zoffset, width, height, depth, inputPitch, inputHeight, getPitch(), getSlice(), input, buffer);
break; break;
default: UNREACHABLE(format); default: UNREACHABLE(format);
} }
...@@ -1755,7 +1755,7 @@ namespace egl ...@@ -1755,7 +1755,7 @@ namespace egl
void Image::loadD24S8ImageData(GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, int inputPitch, int inputHeight, const void *input, void *buffer) void Image::loadD24S8ImageData(GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, int inputPitch, int inputHeight, const void *input, void *buffer)
{ {
LoadImageData<D24>(xoffset, yoffset, zoffset, width, height, depth, inputPitch, inputHeight, getPitch(), getHeight(), input, buffer); LoadImageData<D24>(xoffset, yoffset, zoffset, width, height, depth, inputPitch, inputHeight, getPitch(), getSlice(), input, buffer);
unsigned char *stencil = reinterpret_cast<unsigned char*>(lockStencil(0, 0, 0, sw::PUBLIC)); unsigned char *stencil = reinterpret_cast<unsigned char*>(lockStencil(0, 0, 0, sw::PUBLIC));
...@@ -1769,7 +1769,7 @@ namespace egl ...@@ -1769,7 +1769,7 @@ namespace egl
void Image::loadD32FS8ImageData(GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, int inputPitch, int inputHeight, const void *input, void *buffer) void Image::loadD32FS8ImageData(GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, int inputPitch, int inputHeight, const void *input, void *buffer)
{ {
LoadImageData<D32FS8>(xoffset, yoffset, zoffset, width, height, depth, inputPitch, inputHeight, getPitch(), getHeight(), input, buffer); LoadImageData<D32FS8>(xoffset, yoffset, zoffset, width, height, depth, inputPitch, inputHeight, getPitch(), getSlice(), input, buffer);
unsigned char *stencil = reinterpret_cast<unsigned char*>(lockStencil(0, 0, 0, sw::PUBLIC)); unsigned char *stencil = reinterpret_cast<unsigned char*>(lockStencil(0, 0, 0, sw::PUBLIC));
......
...@@ -157,6 +157,11 @@ public: ...@@ -157,6 +157,11 @@ public:
return getExternalPitchB(); return getExternalPitchB();
} }
unsigned int getSlice() const
{
return getExternalSliceB();
}
virtual void unlock() virtual void unlock()
{ {
unlockExternal(); unlockExternal();
......
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