Commit 1d4f5775 by Nicolas Capens Committed by Nicolas Capens

Clamp GLSL textureSize() lod to mipmap range

Bug chromium:980816 Change-Id: Ic4393668f82316e475baa5e753d891dfb1e30572 Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/33728 Presubmit-Ready: Nicolas Capens <nicolascapens@google.com> Kokoro-Presubmit: kokoro <noreply+kokoro@google.com> Tested-by: 's avatarNicolas Capens <nicolascapens@google.com> Reviewed-by: 's avatarAlexis Hétu <sugoi@google.com>
parent 49f8051e
......@@ -506,7 +506,8 @@ namespace sw
for(int i = 0; i < 4; ++i)
{
Int baseLevel = *Pointer<Int>(texture + OFFSET(Texture, baseLevel));
Pointer<Byte> mipmap = texture + OFFSET(Texture, mipmap) + (As<Int>(Extract(lod, i)) + baseLevel) * sizeof(Mipmap);
Int index = Min(As<UInt>(As<Int>(Extract(lod, i)) + baseLevel), MIPMAP_LEVELS - 1);
Pointer<Byte> mipmap = texture + OFFSET(Texture, mipmap) + index * sizeof(Mipmap);
size.x = Insert(size.x, As<Float>(Int(*Pointer<Short>(mipmap + OFFSET(Mipmap, width)))), i);
size.y = Insert(size.y, As<Float>(Int(*Pointer<Short>(mipmap + OFFSET(Mipmap, height)))), i);
size.z = Insert(size.z, As<Float>(Int(*Pointer<Short>(mipmap + OFFSET(Mipmap, depth)))), i);
......
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