OpenGL: Use the correct size to lazy-clear mips

We would incorrectly use the size of the first mip level to clear
non-zero mip levels. This was found while enabling debug output in
the OpenGL backend.

BUG=dawn:190

Change-Id: I29a87b87057d425d1c131d11afdc7ca4716607c8
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/9202
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
This commit is contained in:
Corentin Wallez
2019-07-22 09:50:21 +00:00
committed by Commit Bot service account
parent 9dffe11696
commit fefb3ab120
3 changed files with 8 additions and 7 deletions

View File

@@ -245,9 +245,10 @@ namespace dawn_native { namespace opengl {
} else {
auto formatInfo = GetGLFormatInfo(GetFormat().format);
for (GLint level = baseMipLevel; level < baseMipLevel + levelCount; ++level) {
gl.ClearTexSubImage(mHandle, level, 0, 0, baseArrayLayer, GetSize().width,
GetSize().height, layerCount, formatInfo.format,
formatInfo.type, nullptr);
Extent3D mipSize = GetMipLevelPhysicalSize(level);
gl.ClearTexSubImage(mHandle, level, 0, 0, baseArrayLayer, mipSize.width,
mipSize.height, layerCount, formatInfo.format, formatInfo.type,
nullptr);
}
}
SetIsSubresourceContentInitialized(baseMipLevel, levelCount, baseArrayLayer, layerCount);