Vulkan: Fix bugs in glGenerateMipmaps.

We had two separate minor bugs. 1) missing a flush of the image data
and 2) missing an initial barrier to set the image to TRANSFER_DST.

Bug: angleproject:2652
Bug: angleproject:2653
Change-Id: I485aafc5c9055b5efb101cb2bc3ebab0588d2639
Reviewed-on: https://chromium-review.googlesource.com/1249564
Commit-Queue: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Reviewed-by: Frank Henigman <fjhenigman@chromium.org>
This commit is contained in:
Jamie Madill 2018-10-01 10:15:37 -04:00 коммит произвёл Commit Bot
Родитель a78092cb25
Коммит 5ddbdbf70c
3 изменённых файлов: 6 добавлений и 8 удалений

Просмотреть файл

@ -809,11 +809,17 @@ angle::Result TextureVk::copyImageDataToBuffer(ContextVk *contextVk,
angle::Result TextureVk::generateMipmapWithBlit(ContextVk *contextVk) angle::Result TextureVk::generateMipmapWithBlit(ContextVk *contextVk)
{ {
ANGLE_TRY(ensureImageInitialized(contextVk));
uint32_t imageLayerCount = GetImageLayerCount(mState.getType()); uint32_t imageLayerCount = GetImageLayerCount(mState.getType());
const gl::Extents baseLevelExtents = mImage.getExtents(); const gl::Extents baseLevelExtents = mImage.getExtents();
vk::CommandBuffer *commandBuffer = nullptr; vk::CommandBuffer *commandBuffer = nullptr;
ANGLE_TRY(getCommandBufferForWrite(contextVk, &commandBuffer)); ANGLE_TRY(getCommandBufferForWrite(contextVk, &commandBuffer));
mImage.changeLayoutWithStages(VK_IMAGE_ASPECT_COLOR_BIT, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL,
VK_PIPELINE_STAGE_ALL_COMMANDS_BIT,
VK_PIPELINE_STAGE_ALL_COMMANDS_BIT, commandBuffer);
// We are able to use blitImage since the image format we are using supports it. This // We are able to use blitImage since the image format we are using supports it. This
// is a faster way we can generate the mips. // is a faster way we can generate the mips.
int32_t mipWidth = baseLevelExtents.width; int32_t mipWidth = baseLevelExtents.width;

Просмотреть файл

@ -601,10 +601,6 @@ TEST_P(StateChangeRenderTest, RecreateRenderbuffer)
// Test that recreating a texture with GenerateMipmaps signals the FBO is dirty. // Test that recreating a texture with GenerateMipmaps signals the FBO is dirty.
TEST_P(StateChangeRenderTest, GenerateMipmap) TEST_P(StateChangeRenderTest, GenerateMipmap)
{ {
// TODO(lucferron): Diagnose and fix
// http://anglebug.com/2652
ANGLE_SKIP_TEST_IF(IsVulkan());
glBindFramebuffer(GL_FRAMEBUFFER, mFramebuffer); glBindFramebuffer(GL_FRAMEBUFFER, mFramebuffer);
glBindTexture(GL_TEXTURE_2D, mTextures[0]); glBindTexture(GL_TEXTURE_2D, mTextures[0]);

Просмотреть файл

@ -1328,10 +1328,6 @@ TEST_P(SamplerArrayAsFunctionParameterTest, SamplerArrayAsFunctionParameter)
// Copy of a test in conformance/textures/texture-mips, to test generate mipmaps // Copy of a test in conformance/textures/texture-mips, to test generate mipmaps
TEST_P(Texture2DTestWithDrawScale, MipmapsTwice) TEST_P(Texture2DTestWithDrawScale, MipmapsTwice)
{ {
// TODO(lucferron): Diagnose and fix
// http://anglebug.com/2653
ANGLE_SKIP_TEST_IF(IsVulkan());
int px = getWindowWidth() / 2; int px = getWindowWidth() / 2;
int py = getWindowHeight() / 2; int py = getWindowHeight() / 2;