Commit a8d19187 by Nicolas Capens Committed by Nicolas Capens

Support loading of multiple compressed texture slices.

Change-Id: I53def31f6e63a9cf0884715078bbf236f00f3c51 Reviewed-on: https://swiftshader-review.googlesource.com/17090Tested-by: 's avatarNicolas Capens <nicolascapens@google.com> Reviewed-by: 's avatarAlexis Hétu <sugoi@google.com> Reviewed-by: 's avatarNicolas Capens <nicolascapens@google.com>
parent 027714e7
......@@ -1461,20 +1461,22 @@ namespace egl
void Image::loadCompressedData(GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLsizei imageSize, const void *pixels)
{
if(depth != 1)
{
UNIMPLEMENTED(); // FIXME
}
int inputPitch = ComputeCompressedPitch(width, format);
int rows = imageSize / inputPitch;
int inputSlice = imageSize / depth;
int rows = inputSlice / inputPitch;
void *buffer = lock(xoffset, yoffset, zoffset, sw::LOCK_WRITEONLY);
if(buffer)
{
for(int i = 0; i < rows; i++)
for(int z = 0; z < depth; z++)
{
memcpy((void*)((GLbyte*)buffer + i * getPitch()), (void*)((GLbyte*)pixels + i * inputPitch), inputPitch);
for(int y = 0; y < rows; y++)
{
GLbyte *dest = (GLbyte*)buffer + y * getPitch() + z * getSlice();
GLbyte *source = (GLbyte*)pixels + y * inputPitch + z * inputSlice;
memcpy(dest, source, inputPitch);
}
}
}
......
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