Commit 369f9e5d by Geoff Lang

GL: Support Rectangle textures as sources for glCopyTextureCHROMIUM.

Chrome uses rectangle textures on mac to copy data. ANGLE's frontend allowed them as CopyTexture sources but did not implement them in the backend. TEST=Any WebGL test on Mac BUG=982294 Change-Id: If2e40292b22c4f49676e3ece8cc6fa126c5b7b94 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1726849Reviewed-by: 's avatarShahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Geoff Lang <geofflang@chromium.org>
parent 301f77e7
......@@ -517,7 +517,8 @@ angle::Result BlitGL::copySubTexture(const gl::Context *context,
bool *copySucceededOut)
{
ASSERT(source->getType() == gl::TextureType::_2D ||
source->getType() == gl::TextureType::External);
source->getType() == gl::TextureType::External ||
source->getType() == gl::TextureType::Rectangle);
ANGLE_TRY(initializeResources());
// Make sure the destination texture can be rendered to before setting anything else up. Some
......@@ -572,10 +573,15 @@ angle::Result BlitGL::copySubTexture(const gl::Context *context,
mStateManager->activeTexture(0);
mStateManager->bindTexture(source->getType(), source->getTextureID());
Vector2 scale(sourceArea.width / static_cast<float>(sourceSize.width),
sourceArea.height / static_cast<float>(sourceSize.height));
Vector2 offset(sourceArea.x / static_cast<float>(sourceSize.width),
sourceArea.y / static_cast<float>(sourceSize.height));
Vector2 scale(sourceArea.width, sourceArea.height);
Vector2 offset(sourceArea.x, sourceArea.y);
if (source->getType() != gl::TextureType::Rectangle)
{
scale.x() /= static_cast<float>(sourceSize.width);
scale.y() /= static_cast<float>(sourceSize.height);
offset.x() /= static_cast<float>(sourceSize.width);
offset.y() /= static_cast<float>(sourceSize.height);
}
if (unpackFlipY)
{
offset.y() += scale.y();
......@@ -628,7 +634,8 @@ angle::Result BlitGL::copySubTextureCPUReadback(const gl::Context *context,
ContextGL *contextGL = GetImplAs<ContextGL>(context);
ASSERT(source->getType() == gl::TextureType::_2D ||
source->getType() == gl::TextureType::External);
source->getType() == gl::TextureType::External ||
source->getType() == gl::TextureType::Rectangle);
const auto &destInternalFormatInfo = gl::GetInternalFormatInfo(destFormat, destType);
const gl::InternalFormat &sourceInternalFormatInfo =
gl::GetSizedInternalFormatInfo(sourceSizedInternalFormat);
......
......@@ -814,7 +814,8 @@ angle::Result TextureGL::copySubTextureHelper(const gl::Context *context,
// Check is this is a simple copySubTexture that can be done with a copyTexSubImage
ASSERT(sourceGL->getType() == gl::TextureType::_2D ||
source->getType() == gl::TextureType::External);
source->getType() == gl::TextureType::External ||
source->getType() == gl::TextureType::Rectangle);
const LevelInfoGL &sourceLevelInfo =
sourceGL->getLevelInfo(NonCubeTextureTypeToTarget(source->getType()), sourceLevel);
bool needsLumaWorkaround = sourceLevelInfo.lumaWorkaround.enabled;
......
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