зеркало из https://github.com/AvaloniaUI/angle.git
Vulkan: Query aspect flag from the image
When transferring images across queues we need to query the aspect of the image instead of hardcoding it to VK_IMAGE_ASPECT_COLOR_BIT Bug: angleproject:4791 Bug: angleproject:4818 Tests: angle_end2end_tests --gtest_filter=ImageTest.SourceAHBTarget2DDepth* Change-Id: Ia43a00262085dab492935c0c299635f3af468b50 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2274868 Commit-Queue: Mohan Maiya <m.maiya@samsung.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
This commit is contained in:
Родитель
3c8f6094dd
Коммит
69fa4d237a
|
@ -1087,7 +1087,7 @@ angle::Result TextureVk::setEGLImageTarget(const gl::Context *context,
|
|||
}
|
||||
|
||||
ANGLE_TRY(contextVk->endRenderPassAndGetCommandBuffer(&commandBuffer));
|
||||
mImage->changeLayoutAndQueue(VK_IMAGE_ASPECT_COLOR_BIT, newLayout, rendererQueueFamilyIndex,
|
||||
mImage->changeLayoutAndQueue(mImage->getAspectFlags(), newLayout, rendererQueueFamilyIndex,
|
||||
commandBuffer);
|
||||
}
|
||||
|
||||
|
|
|
@ -434,7 +434,6 @@ class ImageTest : public ANGLETest
|
|||
}
|
||||
|
||||
EXPECT_EQ(0, AHardwareBuffer_unlock(aHardwareBuffer, nullptr));
|
||||
AHardwareBuffer_acquire(aHardwareBuffer);
|
||||
return aHardwareBuffer;
|
||||
#else
|
||||
return nullptr;
|
||||
|
@ -1562,6 +1561,81 @@ void ImageTest::SourceAHBTargetExternalESSL3_helper(const EGLint *attribs)
|
|||
glDeleteTextures(1, &target);
|
||||
}
|
||||
|
||||
// Create a depth format AHB backed EGL image and verify that the image's aspect is honored
|
||||
TEST_P(ImageTest, SourceAHBTarget2DDepth)
|
||||
{
|
||||
// TODO - Support for depth formats in AHB is missing (http://anglebug.com/4818)
|
||||
ANGLE_SKIP_TEST_IF(true);
|
||||
|
||||
EGLWindow *window = getEGLWindow();
|
||||
|
||||
ANGLE_SKIP_TEST_IF(getClientMajorVersion() < 3);
|
||||
ANGLE_SKIP_TEST_IF(!hasOESExt() || !hasBaseExt() || !has2DTextureExt());
|
||||
ANGLE_SKIP_TEST_IF(!hasAndroidImageNativeBufferExt() || !hasAndroidHardwareBufferSupport());
|
||||
|
||||
GLint level = 0;
|
||||
GLsizei width = 1;
|
||||
GLsizei height = 1;
|
||||
GLsizei depth = 1;
|
||||
GLint depthStencilValue = 0;
|
||||
|
||||
// Create the Image
|
||||
AHardwareBuffer *source;
|
||||
EGLImageKHR image;
|
||||
createEGLImageAndroidHardwareBufferSource(
|
||||
width, height, depth, GL_DEPTH_COMPONENT24, kDefaultAttribs,
|
||||
reinterpret_cast<GLubyte *>(&depthStencilValue), 3, &source, &image);
|
||||
|
||||
// Create a texture target to bind the egl image
|
||||
GLuint depthTextureTarget;
|
||||
createEGLImageTargetTexture2D(image, &depthTextureTarget);
|
||||
|
||||
// Create a color texture and fill it with red
|
||||
GLTexture colorTexture;
|
||||
glBindTexture(GL_TEXTURE_2D, colorTexture);
|
||||
glTexImage2D(GL_TEXTURE_2D, level, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE,
|
||||
GLColor::red.data());
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
glBindTexture(GL_TEXTURE_2D, 0);
|
||||
EXPECT_GL_NO_ERROR();
|
||||
|
||||
GLFramebuffer fbo;
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, fbo);
|
||||
EXPECT_GL_NO_ERROR();
|
||||
|
||||
// Attach the color and depth texture to the FBO
|
||||
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, colorTexture, 0);
|
||||
EXPECT_GL_NO_ERROR();
|
||||
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, depthTextureTarget,
|
||||
0);
|
||||
EXPECT_GL_NO_ERROR();
|
||||
|
||||
ASSERT_GLENUM_EQ(GL_FRAMEBUFFER_COMPLETE, glCheckFramebufferStatus(GL_FRAMEBUFFER));
|
||||
|
||||
// Clear the color texture to red
|
||||
glClearColor(1.0f, 0.0f, 0.0f, 1.0f);
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
EXPECT_PIXEL_EQ(0, 0, 255, 0, 0, 255);
|
||||
|
||||
// Enable Depth test but disable depth writes. The depth function is set to ">".
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
glDepthMask(GL_FALSE);
|
||||
glDepthFunc(GL_GREATER);
|
||||
|
||||
// Fill any fragment of the color attachment with blue if it passes the depth test.
|
||||
ANGLE_GL_PROGRAM(colorFillProgram, essl1_shaders::vs::Simple(), essl1_shaders::fs::Blue());
|
||||
drawQuad(colorFillProgram, essl1_shaders::PositionAttrib(), 1.0f, 1.0f);
|
||||
|
||||
// Since 1.0f > 0.0f, all fragments of the color attachment should be blue.
|
||||
EXPECT_PIXEL_EQ(0, 0, 0, 0, 255, 255);
|
||||
|
||||
// Clean up
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, 0);
|
||||
eglDestroyImageKHR(window->getDisplay(), image);
|
||||
destroyAndroidHardwareBuffer(source);
|
||||
}
|
||||
|
||||
TEST_P(ImageTest, Source2DTargetRenderbuffer)
|
||||
{
|
||||
Source2DTargetRenderbuffer_helper(kDefaultAttribs);
|
||||
|
|
Загрузка…
Ссылка в новой задаче