Commit c4f3b713 by Alexis Hetu Committed by Alexis Hétu

Fix copying cubemap textures out of bounds

Cubemap textures are created with a border, which means that their size is larger. Their range is also different. Instead of [0, dim-1], they have a [-1, dim] range. This means that if we copy them starting at [0, 0] for their full size, we'll overflow at the end, since the buffer starts at [-1, -1]. This cl prevents going through the fast copy path when we have a border. Bug: chromium:1115345 Change-Id: I333acfd6094645231eb111634359d82ed3d5c787 Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/47668 Presubmit-Ready: Alexis Hétu <sugoi@google.com> Reviewed-by: 's avatarCorentin Wallez <cwallez@google.com> Reviewed-by: 's avatarChris Forbes <chrisforbes@google.com> Tested-by: 's avatarAlexis Hétu <sugoi@google.com>
parent ee70c3aa
...@@ -575,7 +575,7 @@ namespace es2 ...@@ -575,7 +575,7 @@ namespace es2
bool fullCopy = (sRect.x0 == 0.0f) && (sRect.y0 == 0.0f) && (dRect.x0 == 0) && (dRect.y0 == 0) && bool fullCopy = (sRect.x0 == 0.0f) && (sRect.y0 == 0.0f) && (dRect.x0 == 0) && (dRect.y0 == 0) &&
(sRect.x1 == (float)sWidth) && (sRect.y1 == (float)sHeight) && (dRect.x1 == dWidth) && (dRect.y1 == dHeight); (sRect.x1 == (float)sWidth) && (sRect.y1 == (float)sHeight) && (dRect.x1 == dWidth) && (dRect.y1 == dHeight);
bool alpha0xFF = false; bool alpha0xFF = false;
bool equalSlice = sourceSliceB == destSliceB; bool equalSlice = (sourceSliceB == destSliceB) && (source->getBorder() == 0) && (dest->getBorder() == 0);
bool smallMargin = sourcePitchB <= source->getWidth() * Surface::bytes(source->getInternalFormat()) + 16; bool smallMargin = sourcePitchB <= source->getWidth() * Surface::bytes(source->getInternalFormat()) + 16;
if((source->getInternalFormat() == FORMAT_A8R8G8B8 && dest->getInternalFormat() == FORMAT_X8R8G8B8) || if((source->getInternalFormat() == FORMAT_A8R8G8B8 && dest->getInternalFormat() == FORMAT_X8R8G8B8) ||
......
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