Commit adb305a2 by Nicolas Capens

Fix checking all mipmap levels for padding.

When textures have padding after a row of pixels, we can't use the sampler's fast path which uses shift operations. We have to treat it as an NPOT texture. Previously only mipmap level 0 was checked for padding, but when a texture is also a render target we allocate 2x2 pixel blocks so a 1x1 mipmap has stride 2. Change-Id: I7421fddbe5ed0d330d881f09c2161d9c42348600 Reviewed-on: https://swiftshader-review.googlesource.com/5175Tested-by: 's avatarNicolas Capens <capn@google.com> Reviewed-by: 's avatarAlexis Hétu <sugoi@google.com> Reviewed-by: 's avatarNicolas Capens <capn@google.com>
parent 31b65a76
......@@ -178,9 +178,9 @@ namespace sw
mipmap.fDepth[3] = (float)depth / 65536.0f;
}
short halfTexelU = isPow2(width) ? 0x8000 >> logWidth : 0x8000 / width;
short halfTexelV = isPow2(height) ? 0x8000 >> logHeight : 0x8000 / height;
short halfTexelW = isPow2(depth) ? 0x8000 >> logDepth : 0x8000 / depth;
short halfTexelU = 0x8000 / width;
short halfTexelV = 0x8000 / height;
short halfTexelW = 0x8000 / depth;
mipmap.uHalf[0] = halfTexelU;
mipmap.uHalf[1] = halfTexelU;
......@@ -400,9 +400,12 @@ namespace sw
return false;
}
if(texture.mipmap[0].width[0] != texture.mipmap[0].onePitchP[1])
for(int i = 0; i < MIPMAP_LEVELS; i++)
{
return true; // Shifting of the texture coordinates doesn't yield the correct address, so using multiply by pitch
if(texture.mipmap[i].width[0] != texture.mipmap[i].onePitchP[1])
{
return true; // Shifting of the texture coordinates doesn't yield the correct address, so using multiply by pitch
}
}
return !isPow2(texture.mipmap[0].width[0]) || !isPow2(texture.mipmap[0].height[0]) || !isPow2(texture.mipmap[0].depth[0]);
......
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