Refactor texture pixel upload offsets.
Apply xoffset, yoffset, and zoffset at image buffer lock so we don't
have to pass them down to the row loading functions as parameters.
Change-Id: I055549c80b1b207df4c49f6f59ecfb8286736040
Reviewed-on: https://swiftshader-review.googlesource.com/17068
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
diff --git a/src/OpenGL/common/Image.cpp b/src/OpenGL/common/Image.cpp
index 577f9b4..9506898 100644
--- a/src/OpenGL/common/Image.cpp
+++ b/src/OpenGL/common/Image.cpp
@@ -60,45 +60,45 @@
};
template<DataType dataType>
- void LoadImageRow(const unsigned char *source, unsigned char *dest, GLint xoffset, GLsizei width)
+ void LoadImageRow(const unsigned char *source, unsigned char *dest, GLsizei width)
{
UNIMPLEMENTED();
}
template<>
- void LoadImageRow<Bytes_1>(const unsigned char *source, unsigned char *dest, GLint xoffset, GLsizei width)
+ void LoadImageRow<Bytes_1>(const unsigned char *source, unsigned char *dest, GLsizei width)
{
- memcpy(dest + xoffset, source, width);
+ memcpy(dest, source, width);
}
template<>
- void LoadImageRow<Bytes_2>(const unsigned char *source, unsigned char *dest, GLint xoffset, GLsizei width)
+ void LoadImageRow<Bytes_2>(const unsigned char *source, unsigned char *dest, GLsizei width)
{
- memcpy(dest + xoffset * 2, source, width * 2);
+ memcpy(dest, source, width * 2);
}
template<>
- void LoadImageRow<Bytes_4>(const unsigned char *source, unsigned char *dest, GLint xoffset, GLsizei width)
+ void LoadImageRow<Bytes_4>(const unsigned char *source, unsigned char *dest, GLsizei width)
{
- memcpy(dest + xoffset * 4, source, width * 4);
+ memcpy(dest, source, width * 4);
}
template<>
- void LoadImageRow<Bytes_8>(const unsigned char *source, unsigned char *dest, GLint xoffset, GLsizei width)
+ void LoadImageRow<Bytes_8>(const unsigned char *source, unsigned char *dest, GLsizei width)
{
- memcpy(dest + xoffset * 8, source, width * 8);
+ memcpy(dest, source, width * 8);
}
template<>
- void LoadImageRow<Bytes_16>(const unsigned char *source, unsigned char *dest, GLint xoffset, GLsizei width)
+ void LoadImageRow<Bytes_16>(const unsigned char *source, unsigned char *dest, GLsizei width)
{
- memcpy(dest + xoffset * 16, source, width * 16);
+ memcpy(dest, source, width * 16);
}
template<>
- void LoadImageRow<ByteRGB>(const unsigned char *source, unsigned char *dest, GLint xoffset, GLsizei width)
+ void LoadImageRow<ByteRGB>(const unsigned char *source, unsigned char *dest, GLsizei width)
{
- unsigned char *destB = dest + xoffset * 4;
+ unsigned char *destB = dest;
for(int x = 0; x < width; x++)
{
@@ -110,9 +110,9 @@
}
template<>
- void LoadImageRow<UByteRGB>(const unsigned char *source, unsigned char *dest, GLint xoffset, GLsizei width)
+ void LoadImageRow<UByteRGB>(const unsigned char *source, unsigned char *dest, GLsizei width)
{
- unsigned char *destB = dest + xoffset * 4;
+ unsigned char *destB = dest;
for(int x = 0; x < width; x++)
{
@@ -124,10 +124,10 @@
}
template<>
- void LoadImageRow<ShortRGB>(const unsigned char *source, unsigned char *dest, GLint xoffset, GLsizei width)
+ void LoadImageRow<ShortRGB>(const unsigned char *source, unsigned char *dest, GLsizei width)
{
const unsigned short *sourceS = reinterpret_cast<const unsigned short*>(source);
- unsigned short *destS = reinterpret_cast<unsigned short*>(dest + xoffset * 8);
+ unsigned short *destS = reinterpret_cast<unsigned short*>(dest);
for(int x = 0; x < width; x++)
{
@@ -139,10 +139,10 @@
}
template<>
- void LoadImageRow<UShortRGB>(const unsigned char *source, unsigned char *dest, GLint xoffset, GLsizei width)
+ void LoadImageRow<UShortRGB>(const unsigned char *source, unsigned char *dest, GLsizei width)
{
const unsigned short *sourceS = reinterpret_cast<const unsigned short*>(source);
- unsigned short *destS = reinterpret_cast<unsigned short*>(dest + xoffset * 8);
+ unsigned short *destS = reinterpret_cast<unsigned short*>(dest);
for(int x = 0; x < width; x++)
{
@@ -154,10 +154,10 @@
}
template<>
- void LoadImageRow<IntRGB>(const unsigned char *source, unsigned char *dest, GLint xoffset, GLsizei width)
+ void LoadImageRow<IntRGB>(const unsigned char *source, unsigned char *dest, GLsizei width)
{
const unsigned int *sourceI = reinterpret_cast<const unsigned int*>(source);
- unsigned int *destI = reinterpret_cast<unsigned int*>(dest + xoffset * 16);
+ unsigned int *destI = reinterpret_cast<unsigned int*>(dest);
for(int x = 0; x < width; x++)
{
@@ -169,10 +169,10 @@
}
template<>
- void LoadImageRow<UIntRGB>(const unsigned char *source, unsigned char *dest, GLint xoffset, GLsizei width)
+ void LoadImageRow<UIntRGB>(const unsigned char *source, unsigned char *dest, GLsizei width)
{
const unsigned int *sourceI = reinterpret_cast<const unsigned int*>(source);
- unsigned int *destI = reinterpret_cast<unsigned int*>(dest + xoffset * 16);
+ unsigned int *destI = reinterpret_cast<unsigned int*>(dest);
for(int x = 0; x < width; x++)
{
@@ -184,10 +184,10 @@
}
template<>
- void LoadImageRow<FloatRGB>(const unsigned char *source, unsigned char *dest, GLint xoffset, GLsizei width)
+ void LoadImageRow<FloatRGB>(const unsigned char *source, unsigned char *dest, GLsizei width)
{
const float *sourceF = reinterpret_cast<const float*>(source);
- float *destF = reinterpret_cast<float*>(dest + xoffset * 16);
+ float *destF = reinterpret_cast<float*>(dest);
for(int x = 0; x < width; x++)
{
@@ -199,10 +199,10 @@
}
template<>
- void LoadImageRow<HalfFloatRGB>(const unsigned char *source, unsigned char *dest, GLint xoffset, GLsizei width)
+ void LoadImageRow<HalfFloatRGB>(const unsigned char *source, unsigned char *dest, GLsizei width)
{
const unsigned short *sourceH = reinterpret_cast<const unsigned short*>(source);
- unsigned short *destH = reinterpret_cast<unsigned short*>(dest + xoffset * 8);
+ unsigned short *destH = reinterpret_cast<unsigned short*>(dest);
for(int x = 0; x < width; x++)
{
@@ -214,10 +214,10 @@
}
template<>
- void LoadImageRow<RGBA4444>(const unsigned char *source, unsigned char *dest, GLint xoffset, GLsizei width)
+ void LoadImageRow<RGBA4444>(const unsigned char *source, unsigned char *dest, GLsizei width)
{
const unsigned short *source4444 = reinterpret_cast<const unsigned short*>(source);
- unsigned char *dest4444 = dest + xoffset * 4;
+ unsigned char *dest4444 = dest;
for(int x = 0; x < width; x++)
{
@@ -230,10 +230,10 @@
}
template<>
- void LoadImageRow<RGBA5551>(const unsigned char *source, unsigned char *dest, GLint xoffset, GLsizei width)
+ void LoadImageRow<RGBA5551>(const unsigned char *source, unsigned char *dest, GLsizei width)
{
const unsigned short *source5551 = reinterpret_cast<const unsigned short*>(source);
- unsigned char *dest5551 = dest + xoffset * 4;
+ unsigned char *dest5551 = dest;
for(int x = 0; x < width; x++)
{
@@ -246,10 +246,10 @@
}
template<>
- void LoadImageRow<R11G11B10F>(const unsigned char *source, unsigned char *dest, GLint xoffset, GLsizei width)
+ void LoadImageRow<R11G11B10F>(const unsigned char *source, unsigned char *dest, GLsizei width)
{
const sw::R11G11B10F *sourceRGB = reinterpret_cast<const sw::R11G11B10F*>(source);
- sw::half *destF = reinterpret_cast<sw::half*>(dest + xoffset * 8);
+ sw::half *destF = reinterpret_cast<sw::half*>(dest);
for(int x = 0; x < width; x++, sourceRGB++, destF+=4)
{
@@ -259,10 +259,10 @@
}
template<>
- void LoadImageRow<RGB9E5>(const unsigned char *source, unsigned char *dest, GLint xoffset, GLsizei width)
+ void LoadImageRow<RGB9E5>(const unsigned char *source, unsigned char *dest, GLsizei width)
{
const sw::RGB9E5 *sourceRGB = reinterpret_cast<const sw::RGB9E5*>(source);
- sw::half *destF = reinterpret_cast<sw::half*>(dest + xoffset * 8);
+ sw::half *destF = reinterpret_cast<sw::half*>(dest);
for(int x = 0; x < width; x++, sourceRGB++, destF += 4)
{
@@ -272,10 +272,10 @@
}
template<>
- void LoadImageRow<D16>(const unsigned char *source, unsigned char *dest, GLint xoffset, GLsizei width)
+ void LoadImageRow<D16>(const unsigned char *source, unsigned char *dest, GLsizei width)
{
const unsigned short *sourceD16 = reinterpret_cast<const unsigned short*>(source);
- float *destF = reinterpret_cast<float*>(dest + xoffset * 4);
+ float *destF = reinterpret_cast<float*>(dest);
for(int x = 0; x < width; x++)
{
@@ -284,10 +284,10 @@
}
template<>
- void LoadImageRow<D24>(const unsigned char *source, unsigned char *dest, GLint xoffset, GLsizei width)
+ void LoadImageRow<D24>(const unsigned char *source, unsigned char *dest, GLsizei width)
{
const unsigned int *sourceD24 = reinterpret_cast<const unsigned int*>(source);
- float *destF = reinterpret_cast<float*>(dest + xoffset * 4);
+ float *destF = reinterpret_cast<float*>(dest);
for(int x = 0; x < width; x++)
{
@@ -296,10 +296,10 @@
}
template<>
- void LoadImageRow<D32>(const unsigned char *source, unsigned char *dest, GLint xoffset, GLsizei width)
+ void LoadImageRow<D32>(const unsigned char *source, unsigned char *dest, GLsizei width)
{
const unsigned int *sourceD32 = reinterpret_cast<const unsigned int*>(source);
- float *destF = reinterpret_cast<float*>(dest + xoffset * 4);
+ float *destF = reinterpret_cast<float*>(dest);
for(int x = 0; x < width; x++)
{
@@ -308,10 +308,10 @@
}
template<>
- void LoadImageRow<S8>(const unsigned char *source, unsigned char *dest, GLint xoffset, GLsizei width)
+ void LoadImageRow<S8>(const unsigned char *source, unsigned char *dest, GLsizei width)
{
const unsigned int *sourceI = reinterpret_cast<const unsigned int*>(source);
- unsigned char *destI = dest + xoffset;
+ unsigned char *destI = dest;
for(int x = 0; x < width; x++)
{
@@ -320,10 +320,10 @@
}
template<>
- void LoadImageRow<D32F>(const unsigned char *source, unsigned char *dest, GLint xoffset, GLsizei width)
+ void LoadImageRow<D32F>(const unsigned char *source, unsigned char *dest, GLsizei width)
{
const float *sourceF = reinterpret_cast<const float*>(source);
- float *destF = reinterpret_cast<float*>(dest + xoffset * 4);
+ float *destF = reinterpret_cast<float*>(dest);
for(int x = 0; x < width; x++)
{
@@ -332,11 +332,11 @@
}
template<>
- void LoadImageRow<D32FS8>(const unsigned char *source, unsigned char *dest, GLint xoffset, GLsizei width)
+ void LoadImageRow<D32FS8>(const unsigned char *source, unsigned char *dest, GLsizei width)
{
struct D32FS8 { float depth32f; unsigned int stencil24_8; };
const D32FS8 *sourceD32FS8 = reinterpret_cast<const D32FS8*>(source);
- float *destF = reinterpret_cast<float*>(dest + xoffset * 4);
+ float *destF = reinterpret_cast<float*>(dest);
for(int x = 0; x < width; x++)
{
@@ -345,11 +345,11 @@
}
template<>
- void LoadImageRow<S24_8>(const unsigned char *source, unsigned char *dest, GLint xoffset, GLsizei width)
+ void LoadImageRow<S24_8>(const unsigned char *source, unsigned char *dest, GLsizei width)
{
struct D32FS8 { float depth32f; unsigned int stencil24_8; };
const D32FS8 *sourceD32FS8 = reinterpret_cast<const D32FS8*>(source);
- unsigned char *destI = dest + xoffset;
+ unsigned char *destI = dest;
for(int x = 0; x < width; x++)
{
@@ -358,18 +358,18 @@
}
template<DataType dataType>
- 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)
+ void LoadImageData(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);
- unsigned char *destStart = static_cast<unsigned char*>(buffer) + ((zoffset + z) * destSlice);
- for(int y = 0; y < height; ++y)
+ unsigned char *destStart = static_cast<unsigned char*>(buffer) + (z * destSlice);
+ for(int y = 0; y < height; y++)
{
const unsigned char *source = inputStart + y * inputPitch;
- unsigned char *dest = destStart + (y + yoffset) * destPitch;
+ unsigned char *dest = destStart + y * destPitch;
- LoadImageRow<dataType>(source, dest, xoffset, width);
+ LoadImageRow<dataType>(source, dest, width);
}
}
}
@@ -1218,7 +1218,7 @@
(uploadFormat == sw::FORMAT_X8B8G8R8 && internalFormat == sw::FORMAT_SRGB8_X8) ||
(uploadFormat == sw::FORMAT_A2B10G10R10 && internalFormat == sw::FORMAT_A2B10G10R10UI))
{
- void *buffer = lock(0, 0, sw::LOCK_WRITEONLY);
+ void *buffer = lock(xoffset, yoffset, zoffset, sw::LOCK_WRITEONLY);
if(buffer)
{
@@ -1233,24 +1233,24 @@
{
case GL_BYTE:
case GL_UNSIGNED_BYTE:
- LoadImageData<Bytes_1>(xoffset, yoffset, zoffset, width, height, depth, inputPitch, inputHeight, getPitch(), getSlice(), input, buffer);
+ LoadImageData<Bytes_1>(width, height, depth, inputPitch, inputHeight, getPitch(), getSlice(), input, buffer);
break;
case GL_FLOAT:
ASSERT(format != GL_RED_INTEGER);
- LoadImageData<Bytes_4>(xoffset, yoffset, zoffset, width, height, depth, inputPitch, inputHeight, getPitch(), getSlice(), input, buffer);
+ LoadImageData<Bytes_4>(width, height, depth, inputPitch, inputHeight, getPitch(), getSlice(), input, buffer);
break;
case GL_HALF_FLOAT:
case GL_HALF_FLOAT_OES:
ASSERT(format != GL_RED_INTEGER);
- LoadImageData<Bytes_2>(xoffset, yoffset, zoffset, width, height, depth, inputPitch, inputHeight, getPitch(), getSlice(), input, buffer);
+ LoadImageData<Bytes_2>(width, height, depth, inputPitch, inputHeight, getPitch(), getSlice(), input, buffer);
break;
case GL_SHORT:
case GL_UNSIGNED_SHORT:
- LoadImageData<Bytes_2>(xoffset, yoffset, zoffset, width, height, depth, inputPitch, inputHeight, getPitch(), getSlice(), input, buffer);
+ LoadImageData<Bytes_2>(width, height, depth, inputPitch, inputHeight, getPitch(), getSlice(), input, buffer);
break;
case GL_INT:
case GL_UNSIGNED_INT:
- LoadImageData<Bytes_4>(xoffset, yoffset, zoffset, width, height, depth, inputPitch, inputHeight, getPitch(), getSlice(), input, buffer);
+ LoadImageData<Bytes_4>(width, height, depth, inputPitch, inputHeight, getPitch(), getSlice(), input, buffer);
break;
default:
UNREACHABLE(type);
@@ -1263,24 +1263,24 @@
{
case GL_BYTE:
case GL_UNSIGNED_BYTE:
- LoadImageData<Bytes_2>(xoffset, yoffset, zoffset, width, height, depth, inputPitch, inputHeight, getPitch(), getSlice(), input, buffer);
+ LoadImageData<Bytes_2>(width, height, depth, inputPitch, inputHeight, getPitch(), getSlice(), input, buffer);
break;
case GL_FLOAT:
ASSERT(format != GL_RG_INTEGER);
- LoadImageData<Bytes_8>(xoffset, yoffset, zoffset, width, height, depth, inputPitch, inputHeight, getPitch(), getSlice(), input, buffer);
+ LoadImageData<Bytes_8>(width, height, depth, inputPitch, inputHeight, getPitch(), getSlice(), input, buffer);
break;
case GL_HALF_FLOAT:
case GL_HALF_FLOAT_OES:
ASSERT(format != GL_RG_INTEGER);
- LoadImageData<Bytes_4>(xoffset, yoffset, zoffset, width, height, depth, inputPitch, inputHeight, getPitch(), getSlice(), input, buffer);
+ LoadImageData<Bytes_4>(width, height, depth, inputPitch, inputHeight, getPitch(), getSlice(), input, buffer);
break;
case GL_SHORT:
case GL_UNSIGNED_SHORT:
- LoadImageData<Bytes_4>(xoffset, yoffset, zoffset, width, height, depth, inputPitch, inputHeight, getPitch(), getSlice(), input, buffer);
+ LoadImageData<Bytes_4>(width, height, depth, inputPitch, inputHeight, getPitch(), getSlice(), input, buffer);
break;
case GL_INT:
case GL_UNSIGNED_INT:
- LoadImageData<Bytes_8>(xoffset, yoffset, zoffset, width, height, depth, inputPitch, inputHeight, getPitch(), getSlice(), input, buffer);
+ LoadImageData<Bytes_8>(width, height, depth, inputPitch, inputHeight, getPitch(), getSlice(), input, buffer);
break;
default:
UNREACHABLE(type);
@@ -1291,43 +1291,43 @@
switch(type)
{
case GL_BYTE:
- LoadImageData<ByteRGB>(xoffset, yoffset, zoffset, width, height, depth, inputPitch, inputHeight, getPitch(), getSlice(), input, buffer);
+ LoadImageData<ByteRGB>(width, height, depth, inputPitch, inputHeight, getPitch(), getSlice(), input, buffer);
break;
case GL_UNSIGNED_BYTE:
- LoadImageData<UByteRGB>(xoffset, yoffset, zoffset, width, height, depth, inputPitch, inputHeight, getPitch(), getSlice(), input, buffer);
+ LoadImageData<UByteRGB>(width, height, depth, inputPitch, inputHeight, getPitch(), getSlice(), input, buffer);
break;
case GL_UNSIGNED_SHORT_5_6_5:
ASSERT(format == GL_RGB);
- LoadImageData<Bytes_2>(xoffset, yoffset, zoffset, width, height, depth, inputPitch, inputHeight, getPitch(), getSlice(), input, buffer);
+ LoadImageData<Bytes_2>(width, height, depth, inputPitch, inputHeight, getPitch(), getSlice(), input, buffer);
break;
case GL_UNSIGNED_INT_10F_11F_11F_REV:
ASSERT(format == GL_RGB);
- LoadImageData<R11G11B10F>(xoffset, yoffset, zoffset, width, height, depth, inputPitch, inputHeight, getPitch(), getSlice(), input, buffer);
+ LoadImageData<R11G11B10F>(width, height, depth, inputPitch, inputHeight, getPitch(), getSlice(), input, buffer);
break;
case GL_UNSIGNED_INT_5_9_9_9_REV:
ASSERT(format == GL_RGB);
- LoadImageData<RGB9E5>(xoffset, yoffset, zoffset, width, height, depth, inputPitch, inputHeight, getPitch(), getSlice(), input, buffer);
+ LoadImageData<RGB9E5>(width, height, depth, inputPitch, inputHeight, getPitch(), getSlice(), input, buffer);
break;
case GL_FLOAT:
ASSERT(format == GL_RGB);
- LoadImageData<FloatRGB>(xoffset, yoffset, zoffset, width, height, depth, inputPitch, inputHeight, getPitch(), getSlice(), input, buffer);
+ LoadImageData<FloatRGB>(width, height, depth, inputPitch, inputHeight, getPitch(), getSlice(), input, buffer);
break;
case GL_HALF_FLOAT:
case GL_HALF_FLOAT_OES:
ASSERT(format == GL_RGB);
- LoadImageData<HalfFloatRGB>(xoffset, yoffset, zoffset, width, height, depth, inputPitch, inputHeight, getPitch(), getSlice(), input, buffer);
+ LoadImageData<HalfFloatRGB>(width, height, depth, inputPitch, inputHeight, getPitch(), getSlice(), input, buffer);
break;
case GL_SHORT:
- LoadImageData<ShortRGB>(xoffset, yoffset, zoffset, width, height, depth, inputPitch, inputHeight, getPitch(), getSlice(), input, buffer);
+ LoadImageData<ShortRGB>(width, height, depth, inputPitch, inputHeight, getPitch(), getSlice(), input, buffer);
break;
case GL_UNSIGNED_SHORT:
- LoadImageData<UShortRGB>(xoffset, yoffset, zoffset, width, height, depth, inputPitch, inputHeight, getPitch(), getSlice(), input, buffer);
+ LoadImageData<UShortRGB>(width, height, depth, inputPitch, inputHeight, getPitch(), getSlice(), input, buffer);
break;
case GL_INT:
- LoadImageData<IntRGB>(xoffset, yoffset, zoffset, width, height, depth, inputPitch, inputHeight, getPitch(), getSlice(), input, buffer);
+ LoadImageData<IntRGB>(width, height, depth, inputPitch, inputHeight, getPitch(), getSlice(), input, buffer);
break;
case GL_UNSIGNED_INT:
- LoadImageData<UIntRGB>(xoffset, yoffset, zoffset, width, height, depth, inputPitch, inputHeight, getPitch(), getSlice(), input, buffer);
+ LoadImageData<UIntRGB>(width, height, depth, inputPitch, inputHeight, getPitch(), getSlice(), input, buffer);
break;
default:
UNREACHABLE(type);
@@ -1340,46 +1340,46 @@
{
case GL_BYTE:
case GL_UNSIGNED_BYTE:
- LoadImageData<Bytes_4>(xoffset, yoffset, zoffset, width, height, depth, inputPitch, inputHeight, getPitch(), getSlice(), input, buffer);
+ LoadImageData<Bytes_4>(width, height, depth, inputPitch, inputHeight, getPitch(), getSlice(), input, buffer);
break;
case GL_UNSIGNED_SHORT_4_4_4_4:
ASSERT(format == GL_RGBA);
- LoadImageData<RGBA4444>(xoffset, yoffset, zoffset, width, height, depth, inputPitch, inputHeight, getPitch(), getSlice(), input, buffer);
+ LoadImageData<RGBA4444>(width, height, depth, inputPitch, inputHeight, getPitch(), getSlice(), input, buffer);
break;
// case GL_UNSIGNED_SHORT_4_4_4_4_REV_EXT:
// ASSERT(format == GL_BGRA_EXT);
- // LoadImageData<ABGR4444>(xoffset, yoffset, zoffset, width, height, depth, inputPitch, inputHeight, getPitch(), getSlice(), input, buffer);
+ // LoadImageData<ABGR4444>(width, height, depth, inputPitch, inputHeight, getPitch(), getSlice(), input, buffer);
// break;
case GL_UNSIGNED_SHORT_5_5_5_1:
ASSERT(format == GL_RGBA);
- LoadImageData<RGBA5551>(xoffset, yoffset, zoffset, width, height, depth, inputPitch, inputHeight, getPitch(), getSlice(), input, buffer);
+ LoadImageData<RGBA5551>(width, height, depth, inputPitch, inputHeight, getPitch(), getSlice(), input, buffer);
break;
// case GL_UNSIGNED_SHORT_1_5_5_5_REV_EXT:
// ASSERT(format == GL_BGRA_EXT);
- // LoadImageData<ABGR5551>(xoffset, yoffset, zoffset, width, height, depth, inputPitch, inputHeight, getPitch(), getSlice(), input, buffer);
+ // LoadImageData<ABGR5551>(width, height, depth, inputPitch, inputHeight, getPitch(), getSlice(), input, buffer);
// break;
case GL_UNSIGNED_INT_2_10_10_10_REV:
ASSERT(format != GL_BGRA_EXT);
- LoadImageData<Bytes_4>(xoffset, yoffset, zoffset, width, height, depth, inputPitch, inputHeight, getPitch(), getSlice(), input, buffer);
+ LoadImageData<Bytes_4>(width, height, depth, inputPitch, inputHeight, getPitch(), getSlice(), input, buffer);
break;
case GL_FLOAT:
ASSERT(format == GL_RGBA);
- LoadImageData<Bytes_16>(xoffset, yoffset, zoffset, width, height, depth, inputPitch, inputHeight, getPitch(), getSlice(), input, buffer);
+ LoadImageData<Bytes_16>(width, height, depth, inputPitch, inputHeight, getPitch(), getSlice(), input, buffer);
break;
case GL_HALF_FLOAT:
case GL_HALF_FLOAT_OES:
ASSERT(format == GL_RGBA);
- LoadImageData<Bytes_8>(xoffset, yoffset, zoffset, width, height, depth, inputPitch, inputHeight, getPitch(), getSlice(), input, buffer);
+ LoadImageData<Bytes_8>(width, height, depth, inputPitch, inputHeight, getPitch(), getSlice(), input, buffer);
break;
case GL_SHORT:
case GL_UNSIGNED_SHORT:
ASSERT(format != GL_BGRA_EXT);
- LoadImageData<Bytes_8>(xoffset, yoffset, zoffset, width, height, depth, inputPitch, inputHeight, getPitch(), getSlice(), input, buffer);
+ LoadImageData<Bytes_8>(width, height, depth, inputPitch, inputHeight, getPitch(), getSlice(), input, buffer);
break;
case GL_INT:
case GL_UNSIGNED_INT:
ASSERT(format != GL_BGRA_EXT);
- LoadImageData<Bytes_16>(xoffset, yoffset, zoffset, width, height, depth, inputPitch, inputHeight, getPitch(), getSlice(), input, buffer);
+ LoadImageData<Bytes_16>(width, height, depth, inputPitch, inputHeight, getPitch(), getSlice(), input, buffer);
break;
default:
UNREACHABLE(type);
@@ -1389,13 +1389,13 @@
switch(type)
{
case GL_FLOAT:
- LoadImageData<D32F>(xoffset, yoffset, zoffset, width, height, depth, inputPitch, inputHeight, getPitch(), getSlice(), input, buffer);
+ LoadImageData<D32F>(width, height, depth, inputPitch, inputHeight, getPitch(), getSlice(), input, buffer);
break;
case GL_UNSIGNED_SHORT:
- LoadImageData<D16>(xoffset, yoffset, zoffset, width, height, depth, inputPitch, inputHeight, getPitch(), getSlice(), input, buffer);
+ LoadImageData<D16>(width, height, depth, inputPitch, inputHeight, getPitch(), getSlice(), input, buffer);
break;
case GL_UNSIGNED_INT:
- LoadImageData<D32>(xoffset, yoffset, zoffset, width, height, depth, inputPitch, inputHeight, getPitch(), getSlice(), input, buffer);
+ LoadImageData<D32>(width, height, depth, inputPitch, inputHeight, getPitch(), getSlice(), input, buffer);
break;
default:
UNREACHABLE(type);
@@ -1433,13 +1433,13 @@
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(), getSlice(), input, buffer);
+ LoadImageData<D24>(width, height, depth, inputPitch, inputHeight, getPitch(), getSlice(), input, buffer);
unsigned char *stencil = reinterpret_cast<unsigned char*>(lockStencil(0, 0, 0, sw::PUBLIC));
if(stencil)
{
- LoadImageData<S8>(xoffset, yoffset, zoffset, width, height, depth, inputPitch, inputHeight, getStencilPitchB(), getHeight(), input, stencil);
+ LoadImageData<S8>(width, height, depth, inputPitch, inputHeight, getStencilPitchB(), getHeight(), input, stencil);
unlockStencil();
}
@@ -1447,13 +1447,13 @@
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(), getSlice(), input, buffer);
+ LoadImageData<D32FS8>(width, height, depth, inputPitch, inputHeight, getPitch(), getSlice(), input, buffer);
unsigned char *stencil = reinterpret_cast<unsigned char*>(lockStencil(0, 0, 0, sw::PUBLIC));
if(stencil)
{
- LoadImageData<S24_8>(xoffset, yoffset, zoffset, width, height, depth, inputPitch, inputHeight, getStencilPitchB(), getHeight(), input, stencil);
+ LoadImageData<S24_8>(width, height, depth, inputPitch, inputHeight, getStencilPitchB(), getHeight(), input, stencil);
unlockStencil();
}
@@ -1461,14 +1461,14 @@
void Image::loadCompressedData(GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLsizei imageSize, const void *pixels)
{
- if(zoffset != 0 || depth != 1)
+ if(depth != 1)
{
UNIMPLEMENTED(); // FIXME
}
int inputPitch = ComputeCompressedPitch(width, format);
int rows = imageSize / inputPitch;
- void *buffer = lock(xoffset, yoffset, sw::LOCK_WRITEONLY);
+ void *buffer = lock(xoffset, yoffset, zoffset, sw::LOCK_WRITEONLY);
if(buffer)
{
diff --git a/src/OpenGL/common/Image.hpp b/src/OpenGL/common/Image.hpp
index 052121c..88b2d89 100644
--- a/src/OpenGL/common/Image.hpp
+++ b/src/OpenGL/common/Image.hpp
@@ -147,9 +147,9 @@
shared = true;
}
- virtual void *lock(unsigned int left, unsigned int top, sw::Lock lock)
+ virtual void *lock(int x, int y, int z, sw::Lock lock)
{
- return lockExternal(left, top, 0, lock, sw::PUBLIC);
+ return lockExternal(x, y, z, lock, sw::PUBLIC);
}
unsigned int getPitch() const
@@ -325,10 +325,10 @@
sw::Surface::unlockInternal();
}
- void *lock(unsigned int left, unsigned int top, sw::Lock lock) override
+ void *lock(int x, int y, int z, sw::Lock lock) override
{
LOGLOCK("image=%p op=%s lock=%d", this, __FUNCTION__, lock);
- (void)sw::Surface::lockExternal(left, top, 0, lock, sw::PUBLIC);
+ (void)sw::Surface::lockExternal(x, y, z, lock, sw::PUBLIC);
return lockNativeBuffer(GRALLOC_USAGE_SW_READ_OFTEN | GRALLOC_USAGE_SW_WRITE_OFTEN);
}