Commit d691aeeb by Geoff Lang Committed by Commit Bot

Vulkan: Implement GL_CHROMIUM_copy_texture with CPU copies.

BUG=angleproject:2723 Change-Id: Ic3905531d3e91f94ff0ce10a09ca5dcdf643e21f Reviewed-on: https://chromium-review.googlesource.com/1134084Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Commit-Queue: Geoff Lang <geofflang@chromium.org>
parent 6fb8ba4e
...@@ -60,14 +60,16 @@ bool ClipRectangle(const Rectangle &source, const Rectangle &clip, Rectangle *in ...@@ -60,14 +60,16 @@ bool ClipRectangle(const Rectangle &source, const Rectangle &clip, Rectangle *in
struct Offset struct Offset
{ {
Offset() : x(0), y(0), z(0) {} constexpr Offset() : x(0), y(0), z(0) {}
Offset(int x_in, int y_in, int z_in) : x(x_in), y(y_in), z(z_in) {} constexpr Offset(int x_in, int y_in, int z_in) : x(x_in), y(y_in), z(z_in) {}
int x; int x;
int y; int y;
int z; int z;
}; };
constexpr Offset kOffsetZero(0, 0, 0);
bool operator==(const Offset &a, const Offset &b); bool operator==(const Offset &a, const Offset &b);
bool operator!=(const Offset &a, const Offset &b); bool operator!=(const Offset &a, const Offset &b);
......
...@@ -131,6 +131,26 @@ class TextureVk : public TextureImpl, public vk::CommandGraphResource ...@@ -131,6 +131,26 @@ 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 copyTexture(const gl::Context *context,
const gl::ImageIndex &index,
GLenum internalFormat,
GLenum type,
size_t sourceLevel,
bool unpackFlipY,
bool unpackPremultiplyAlpha,
bool unpackUnmultiplyAlpha,
const gl::Texture *source) override;
gl::Error copySubTexture(const gl::Context *context,
const gl::ImageIndex &index,
const gl::Offset &destOffset,
size_t sourceLevel,
const gl::Rectangle &sourceArea,
bool unpackFlipY,
bool unpackPremultiplyAlpha,
bool unpackUnmultiplyAlpha,
const gl::Texture *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,
...@@ -178,6 +198,16 @@ class TextureVk : public TextureImpl, public vk::CommandGraphResource ...@@ -178,6 +198,16 @@ class TextureVk : public TextureImpl, public vk::CommandGraphResource
angle::Result ensureImageInitialized(ContextVk *contextVk); angle::Result ensureImageInitialized(ContextVk *contextVk);
private: private:
angle::Result redefineImage(const gl::Context *context,
const gl::ImageIndex &index,
const gl::InternalFormat &internalFormat,
const gl::Extents &size);
angle::Result copyImageDataToBuffer(ContextVk *contextVk,
size_t sourceLevel,
const gl::Rectangle &sourceArea,
uint8_t **outDataPtr);
angle::Result generateMipmapWithBlit(ContextVk *contextVk); angle::Result generateMipmapWithBlit(ContextVk *contextVk);
angle::Result generateMipmapWithCPU(const gl::Context *context); angle::Result generateMipmapWithCPU(const gl::Context *context);
...@@ -198,6 +228,18 @@ class TextureVk : public TextureImpl, public vk::CommandGraphResource ...@@ -198,6 +228,18 @@ class TextureVk : public TextureImpl, public vk::CommandGraphResource
const gl::Rectangle &sourceArea, const gl::Rectangle &sourceArea,
const gl::InternalFormat &internalFormat, const gl::InternalFormat &internalFormat,
gl::Framebuffer *source); gl::Framebuffer *source);
gl::Error copySubTextureImpl(ContextVk *contextVk,
const gl::ImageIndex &index,
const gl::Offset &destOffset,
const gl::InternalFormat &destFormat,
size_t sourceLevel,
const gl::Rectangle &sourceArea,
bool unpackFlipY,
bool unpackPremultiplyAlpha,
bool unpackUnmultiplyAlpha,
TextureVk *source);
angle::Result initImage(ContextVk *contextVk, angle::Result initImage(ContextVk *contextVk,
const vk::Format &format, const vk::Format &format,
const gl::Extents &extents, const gl::Extents &extents,
......
...@@ -43,6 +43,7 @@ void GenerateCaps(const VkPhysicalDeviceProperties &physicalDeviceProperties, ...@@ -43,6 +43,7 @@ void GenerateCaps(const VkPhysicalDeviceProperties &physicalDeviceProperties,
outExtensions->mapBufferRange = true; outExtensions->mapBufferRange = true;
outExtensions->textureStorage = true; outExtensions->textureStorage = true;
outExtensions->framebufferBlit = true; outExtensions->framebufferBlit = true;
outExtensions->copyTexture = true;
// TODO(lucferron): Eventually remove everything above this line in this function as the caps // TODO(lucferron): Eventually remove everything above this line in this function as the caps
// get implemented. // get implemented.
......
...@@ -684,6 +684,9 @@ TEST_P(CopyTextureTest, Alpha) ...@@ -684,6 +684,9 @@ TEST_P(CopyTextureTest, Alpha)
// Test that copying to cube maps works // Test that copying to cube maps works
TEST_P(CopyTextureTest, CubeMapTarget) TEST_P(CopyTextureTest, CubeMapTarget)
{ {
// TODO(jmadill): Support cube map framebuffer attachments. http://anglebug.com/2470
ANGLE_SKIP_TEST_IF(IsVulkan());
if (!checkExtensions()) if (!checkExtensions())
{ {
return; return;
......
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