Commit f299a378 by Luc Ferron Committed by Commit Bot

Vulkan: Implement copyImage and enable all tests for it

Bug: angleproject:2500 Change-Id: I9066861ed4db0330754b32995ed82c658d66a590 Reviewed-on: https://chromium-review.googlesource.com/1058034 Commit-Queue: Luc Ferron <lucferron@chromium.org> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org>
parent daf7ace5
...@@ -408,8 +408,13 @@ gl::Error TextureVk::copyImage(const gl::Context *context, ...@@ -408,8 +408,13 @@ gl::Error TextureVk::copyImage(const gl::Context *context,
GLenum internalFormat, GLenum internalFormat,
gl::Framebuffer *source) gl::Framebuffer *source)
{ {
UNIMPLEMENTED(); gl::Extents newImageSize(sourceArea.width, sourceArea.height, 1);
return gl::InternalError(); const gl::InternalFormat &internalFormatInfo =
gl::GetInternalFormatInfo(internalFormat, GL_UNSIGNED_BYTE);
ANGLE_TRY(setImage(context, index, internalFormat, newImageSize, internalFormatInfo.format,
internalFormatInfo.type, gl::PixelUnpackState(), nullptr));
return copySubImageImpl(context, index, gl::Offset(0, 0, 0), sourceArea, internalFormatInfo,
source);
} }
gl::Error TextureVk::copySubImage(const gl::Context *context, gl::Error TextureVk::copySubImage(const gl::Context *context,
...@@ -418,6 +423,17 @@ gl::Error TextureVk::copySubImage(const gl::Context *context, ...@@ -418,6 +423,17 @@ gl::Error TextureVk::copySubImage(const gl::Context *context,
const gl::Rectangle &sourceArea, const gl::Rectangle &sourceArea,
gl::Framebuffer *source) gl::Framebuffer *source)
{ {
const gl::InternalFormat &currentFormat = *mState.getBaseLevelDesc().format.info;
return copySubImageImpl(context, index, destOffset, sourceArea, currentFormat, source);
}
gl::Error TextureVk::copySubImageImpl(const gl::Context *context,
const gl::ImageIndex &index,
const gl::Offset &destOffset,
const gl::Rectangle &sourceArea,
const gl::InternalFormat &internalFormat,
gl::Framebuffer *source)
{
gl::Extents fbSize = source->getReadColorbuffer()->getSize(); gl::Extents fbSize = source->getReadColorbuffer()->getSize();
gl::Rectangle clippedSourceArea; gl::Rectangle clippedSourceArea;
if (!ClipRectangle(sourceArea, gl::Rectangle(0, 0, fbSize.width, fbSize.height), if (!ClipRectangle(sourceArea, gl::Rectangle(0, 0, fbSize.width, fbSize.height),
...@@ -431,9 +447,8 @@ gl::Error TextureVk::copySubImage(const gl::Context *context, ...@@ -431,9 +447,8 @@ gl::Error TextureVk::copySubImage(const gl::Context *context,
ContextVk *contextVk = vk::GetImpl(context); ContextVk *contextVk = vk::GetImpl(context);
FramebufferVk *framebufferVk = vk::GetImpl(source); FramebufferVk *framebufferVk = vk::GetImpl(source);
RenderTargetVk *renderTarget = framebufferVk->getColorReadRenderTarget(); RenderTargetVk *renderTarget = framebufferVk->getColorReadRenderTarget();
const gl::InternalFormat &currentFormat = *mState.getBaseLevelDesc().format.info;
vk::CommandBuffer *commandBuffer = nullptr; vk::CommandBuffer *commandBuffer = nullptr;
ANGLE_TRY(framebufferVk->beginWriteResource(contextVk->getRenderer(), &commandBuffer)); ANGLE_TRY(framebufferVk->beginWriteResource(contextVk->getRenderer(), &commandBuffer));
...@@ -444,7 +459,7 @@ gl::Error TextureVk::copySubImage(const gl::Context *context, ...@@ -444,7 +459,7 @@ gl::Error TextureVk::copySubImage(const gl::Context *context,
// when its supported. // when its supported.
ANGLE_TRY(mPixelBuffer.stageSubresourceUpdateFromRenderTarget( ANGLE_TRY(mPixelBuffer.stageSubresourceUpdateFromRenderTarget(
context, index, clippedSourceArea, modifiedDestOffset, context, index, clippedSourceArea, modifiedDestOffset,
gl::Extents(clippedSourceArea.width, clippedSourceArea.height, 1), currentFormat, gl::Extents(clippedSourceArea.width, clippedSourceArea.height, 1), internalFormat,
commandBuffer, renderTarget)); commandBuffer, renderTarget));
vk::CommandGraphNode *writingNode = getNewWritingNode(contextVk->getRenderer()); vk::CommandGraphNode *writingNode = getNewWritingNode(contextVk->getRenderer());
......
...@@ -113,7 +113,6 @@ class TextureVk : public TextureImpl, public vk::CommandGraphResource ...@@ -113,7 +113,6 @@ class TextureVk : public TextureImpl, public vk::CommandGraphResource
const gl::Offset &destOffset, const gl::Offset &destOffset,
const gl::Rectangle &sourceArea, const gl::Rectangle &sourceArea,
gl::Framebuffer *source) override; gl::Framebuffer *source) override;
gl::Error setStorage(const gl::Context *context, gl::Error setStorage(const gl::Context *context,
gl::TextureType type, gl::TextureType type,
size_t levels, size_t levels,
...@@ -161,6 +160,12 @@ class TextureVk : public TextureImpl, public vk::CommandGraphResource ...@@ -161,6 +160,12 @@ class TextureVk : public TextureImpl, public vk::CommandGraphResource
vk::Error ensureImageInitialized(RendererVk *renderer); vk::Error ensureImageInitialized(RendererVk *renderer);
private: private:
gl::Error copySubImageImpl(const gl::Context *context,
const gl::ImageIndex &index,
const gl::Offset &destOffset,
const gl::Rectangle &sourceArea,
const gl::InternalFormat &internalFormat,
gl::Framebuffer *source);
vk::Error initImage(RendererVk *renderer, vk::Error initImage(RendererVk *renderer,
const vk::Format &format, const vk::Format &format,
const gl::Extents &extents, const gl::Extents &extents,
......
...@@ -195,7 +195,6 @@ ...@@ -195,7 +195,6 @@
2161 VULKAN : dEQP-GLES2.functional.shaders.* = SKIP 2161 VULKAN : dEQP-GLES2.functional.shaders.* = SKIP
2161 VULKAN : dEQP-GLES2.functional.texture.mipmap.2d.generate.* = SKIP 2161 VULKAN : dEQP-GLES2.functional.texture.mipmap.2d.generate.* = SKIP
2161 VULKAN : dEQP-GLES2.functional.texture.mipmap.cube.generate.* = SKIP 2161 VULKAN : dEQP-GLES2.functional.texture.mipmap.cube.generate.* = SKIP
2500 VULKAN : dEQP-GLES2.functional.texture.specification.basic_copyteximage2d.* = SKIP
2161 VULKAN : dEQP-GLES2.functional.texture.completeness.* = SKIP 2161 VULKAN : dEQP-GLES2.functional.texture.completeness.* = SKIP
2161 VULKAN : dEQP-GLES2.functional.texture.vertex.* = SKIP 2161 VULKAN : dEQP-GLES2.functional.texture.vertex.* = SKIP
2161 VULKAN : dEQP-GLES2.functional.fragment_ops.random.* = SKIP 2161 VULKAN : dEQP-GLES2.functional.fragment_ops.random.* = SKIP
......
...@@ -352,7 +352,8 @@ ANGLE_INSTANTIATE_TEST(CopyTexImageTest, ...@@ -352,7 +352,8 @@ ANGLE_INSTANTIATE_TEST(CopyTexImageTest,
ES2_D3D11(EGL_EXPERIMENTAL_PRESENT_PATH_FAST_ANGLE), ES2_D3D11(EGL_EXPERIMENTAL_PRESENT_PATH_FAST_ANGLE),
ES2_OPENGL(), ES2_OPENGL(),
ES2_OPENGL(3, 3), ES2_OPENGL(3, 3),
ES2_OPENGLES()); ES2_OPENGLES(),
ES2_VULKAN());
ANGLE_INSTANTIATE_TEST(CopyTexImageTestES3, ES3_D3D11(), ES3_OPENGL(), ES3_OPENGLES()); ANGLE_INSTANTIATE_TEST(CopyTexImageTestES3, ES3_D3D11(), ES3_OPENGL(), ES3_OPENGLES());
} }
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