Commit 8897afa1 by Jamie Madill Committed by Commit Bot

Pass Context around to Texture::copyImage.

Passing this through the chain will allow us to have access to the platform methods, as well as be useful in the future for Vulkan. BUG=angleproject:1660 Change-Id: I819984fceeb5a2a299aa54e59ef3b428f5f9c91f Reviewed-on: https://chromium-review.googlesource.com/438684Reviewed-by: 's avatarCorentin Wallez <cwallez@chromium.org> Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
parent a631e93b
...@@ -2629,7 +2629,7 @@ void Context::copyTexImage2D(GLenum target, ...@@ -2629,7 +2629,7 @@ void Context::copyTexImage2D(GLenum target,
const Framebuffer *framebuffer = mGLState.getReadFramebuffer(); const Framebuffer *framebuffer = mGLState.getReadFramebuffer();
Texture *texture = Texture *texture =
getTargetTexture(IsCubeMapTextureTarget(target) ? GL_TEXTURE_CUBE_MAP : target); getTargetTexture(IsCubeMapTextureTarget(target) ? GL_TEXTURE_CUBE_MAP : target);
handleError(texture->copyImage(target, level, sourceArea, internalformat, framebuffer)); handleError(texture->copyImage(this, target, level, sourceArea, internalformat, framebuffer));
} }
void Context::copyTexSubImage2D(GLenum target, void Context::copyTexSubImage2D(GLenum target,
...@@ -2655,7 +2655,7 @@ void Context::copyTexSubImage2D(GLenum target, ...@@ -2655,7 +2655,7 @@ void Context::copyTexSubImage2D(GLenum target,
const Framebuffer *framebuffer = mGLState.getReadFramebuffer(); const Framebuffer *framebuffer = mGLState.getReadFramebuffer();
Texture *texture = Texture *texture =
getTargetTexture(IsCubeMapTextureTarget(target) ? GL_TEXTURE_CUBE_MAP : target); getTargetTexture(IsCubeMapTextureTarget(target) ? GL_TEXTURE_CUBE_MAP : target);
handleError(texture->copySubImage(target, level, destOffset, sourceArea, framebuffer)); handleError(texture->copySubImage(this, target, level, destOffset, sourceArea, framebuffer));
} }
void Context::copyTexSubImage3D(GLenum target, void Context::copyTexSubImage3D(GLenum target,
...@@ -2681,7 +2681,7 @@ void Context::copyTexSubImage3D(GLenum target, ...@@ -2681,7 +2681,7 @@ void Context::copyTexSubImage3D(GLenum target,
const Framebuffer *framebuffer = mGLState.getReadFramebuffer(); const Framebuffer *framebuffer = mGLState.getReadFramebuffer();
Texture *texture = getTargetTexture(target); Texture *texture = getTargetTexture(target);
handleError(texture->copySubImage(target, level, destOffset, sourceArea, framebuffer)); handleError(texture->copySubImage(this, target, level, destOffset, sourceArea, framebuffer));
} }
void Context::framebufferTexture2D(GLenum target, void Context::framebufferTexture2D(GLenum target,
...@@ -2865,8 +2865,8 @@ void Context::texImage2D(GLenum target, ...@@ -2865,8 +2865,8 @@ void Context::texImage2D(GLenum target,
Extents size(width, height, 1); Extents size(width, height, 1);
Texture *texture = Texture *texture =
getTargetTexture(IsCubeMapTextureTarget(target) ? GL_TEXTURE_CUBE_MAP : target); getTargetTexture(IsCubeMapTextureTarget(target) ? GL_TEXTURE_CUBE_MAP : target);
handleError(texture->setImage(mGLState.getUnpackState(), target, level, internalformat, size, handleError(texture->setImage(this, mGLState.getUnpackState(), target, level, internalformat,
format, type, reinterpret_cast<const uint8_t *>(pixels))); size, format, type, reinterpret_cast<const uint8_t *>(pixels)));
} }
void Context::texImage3D(GLenum target, void Context::texImage3D(GLenum target,
...@@ -2884,8 +2884,8 @@ void Context::texImage3D(GLenum target, ...@@ -2884,8 +2884,8 @@ void Context::texImage3D(GLenum target,
Extents size(width, height, depth); Extents size(width, height, depth);
Texture *texture = getTargetTexture(target); Texture *texture = getTargetTexture(target);
handleError(texture->setImage(mGLState.getUnpackState(), target, level, internalformat, size, handleError(texture->setImage(this, mGLState.getUnpackState(), target, level, internalformat,
format, type, reinterpret_cast<const uint8_t *>(pixels))); size, format, type, reinterpret_cast<const uint8_t *>(pixels)));
} }
void Context::texSubImage2D(GLenum target, void Context::texSubImage2D(GLenum target,
...@@ -2909,8 +2909,8 @@ void Context::texSubImage2D(GLenum target, ...@@ -2909,8 +2909,8 @@ void Context::texSubImage2D(GLenum target,
Box area(xoffset, yoffset, 0, width, height, 1); Box area(xoffset, yoffset, 0, width, height, 1);
Texture *texture = Texture *texture =
getTargetTexture(IsCubeMapTextureTarget(target) ? GL_TEXTURE_CUBE_MAP : target); getTargetTexture(IsCubeMapTextureTarget(target) ? GL_TEXTURE_CUBE_MAP : target);
handleError(texture->setSubImage(mGLState.getUnpackState(), target, level, area, format, type, handleError(texture->setSubImage(this, mGLState.getUnpackState(), target, level, area, format,
reinterpret_cast<const uint8_t *>(pixels))); type, reinterpret_cast<const uint8_t *>(pixels)));
} }
void Context::texSubImage3D(GLenum target, void Context::texSubImage3D(GLenum target,
...@@ -2935,8 +2935,8 @@ void Context::texSubImage3D(GLenum target, ...@@ -2935,8 +2935,8 @@ void Context::texSubImage3D(GLenum target,
Box area(xoffset, yoffset, zoffset, width, height, depth); Box area(xoffset, yoffset, zoffset, width, height, depth);
Texture *texture = getTargetTexture(target); Texture *texture = getTargetTexture(target);
handleError(texture->setSubImage(mGLState.getUnpackState(), target, level, area, format, type, handleError(texture->setSubImage(this, mGLState.getUnpackState(), target, level, area, format,
reinterpret_cast<const uint8_t *>(pixels))); type, reinterpret_cast<const uint8_t *>(pixels)));
} }
void Context::compressedTexImage2D(GLenum target, void Context::compressedTexImage2D(GLenum target,
...@@ -2953,7 +2953,7 @@ void Context::compressedTexImage2D(GLenum target, ...@@ -2953,7 +2953,7 @@ void Context::compressedTexImage2D(GLenum target,
Extents size(width, height, 1); Extents size(width, height, 1);
Texture *texture = Texture *texture =
getTargetTexture(IsCubeMapTextureTarget(target) ? GL_TEXTURE_CUBE_MAP : target); getTargetTexture(IsCubeMapTextureTarget(target) ? GL_TEXTURE_CUBE_MAP : target);
handleError(texture->setCompressedImage(mGLState.getUnpackState(), target, level, handleError(texture->setCompressedImage(this, mGLState.getUnpackState(), target, level,
internalformat, size, imageSize, internalformat, size, imageSize,
reinterpret_cast<const uint8_t *>(data))); reinterpret_cast<const uint8_t *>(data)));
} }
...@@ -2972,7 +2972,7 @@ void Context::compressedTexImage3D(GLenum target, ...@@ -2972,7 +2972,7 @@ void Context::compressedTexImage3D(GLenum target,
Extents size(width, height, depth); Extents size(width, height, depth);
Texture *texture = getTargetTexture(target); Texture *texture = getTargetTexture(target);
handleError(texture->setCompressedImage(mGLState.getUnpackState(), target, level, handleError(texture->setCompressedImage(this, mGLState.getUnpackState(), target, level,
internalformat, size, imageSize, internalformat, size, imageSize,
reinterpret_cast<const uint8_t *>(data))); reinterpret_cast<const uint8_t *>(data)));
} }
...@@ -2992,7 +2992,7 @@ void Context::compressedTexSubImage2D(GLenum target, ...@@ -2992,7 +2992,7 @@ void Context::compressedTexSubImage2D(GLenum target,
Box area(xoffset, yoffset, 0, width, height, 1); Box area(xoffset, yoffset, 0, width, height, 1);
Texture *texture = Texture *texture =
getTargetTexture(IsCubeMapTextureTarget(target) ? GL_TEXTURE_CUBE_MAP : target); getTargetTexture(IsCubeMapTextureTarget(target) ? GL_TEXTURE_CUBE_MAP : target);
handleError(texture->setCompressedSubImage(mGLState.getUnpackState(), target, level, area, handleError(texture->setCompressedSubImage(this, mGLState.getUnpackState(), target, level, area,
format, imageSize, format, imageSize,
reinterpret_cast<const uint8_t *>(data))); reinterpret_cast<const uint8_t *>(data)));
} }
...@@ -3019,7 +3019,7 @@ void Context::compressedTexSubImage3D(GLenum target, ...@@ -3019,7 +3019,7 @@ void Context::compressedTexSubImage3D(GLenum target,
Box area(xoffset, yoffset, zoffset, width, height, depth); Box area(xoffset, yoffset, zoffset, width, height, depth);
Texture *texture = getTargetTexture(target); Texture *texture = getTargetTexture(target);
handleError(texture->setCompressedSubImage(mGLState.getUnpackState(), target, level, area, handleError(texture->setCompressedSubImage(this, mGLState.getUnpackState(), target, level, area,
format, imageSize, format, imageSize,
reinterpret_cast<const uint8_t *>(data))); reinterpret_cast<const uint8_t *>(data)));
} }
...@@ -3027,7 +3027,7 @@ void Context::compressedTexSubImage3D(GLenum target, ...@@ -3027,7 +3027,7 @@ void Context::compressedTexSubImage3D(GLenum target,
void Context::generateMipmap(GLenum target) void Context::generateMipmap(GLenum target)
{ {
Texture *texture = getTargetTexture(target); Texture *texture = getTargetTexture(target);
handleError(texture->generateMipmap()); handleError(texture->generateMipmap(this));
} }
void Context::copyTextureCHROMIUM(GLuint sourceId, void Context::copyTextureCHROMIUM(GLuint sourceId,
...@@ -3042,7 +3042,7 @@ void Context::copyTextureCHROMIUM(GLuint sourceId, ...@@ -3042,7 +3042,7 @@ void Context::copyTextureCHROMIUM(GLuint sourceId,
gl::Texture *sourceTexture = getTexture(sourceId); gl::Texture *sourceTexture = getTexture(sourceId);
gl::Texture *destTexture = getTexture(destId); gl::Texture *destTexture = getTexture(destId);
handleError(destTexture->copyTexture(internalFormat, destType, unpackFlipY == GL_TRUE, handleError(destTexture->copyTexture(this, internalFormat, destType, unpackFlipY == GL_TRUE,
unpackPremultiplyAlpha == GL_TRUE, unpackPremultiplyAlpha == GL_TRUE,
unpackUnmultiplyAlpha == GL_TRUE, sourceTexture)); unpackUnmultiplyAlpha == GL_TRUE, sourceTexture));
} }
...@@ -3071,7 +3071,7 @@ void Context::copySubTextureCHROMIUM(GLuint sourceId, ...@@ -3071,7 +3071,7 @@ void Context::copySubTextureCHROMIUM(GLuint sourceId,
gl::Texture *destTexture = getTexture(destId); gl::Texture *destTexture = getTexture(destId);
Offset offset(xoffset, yoffset, 0); Offset offset(xoffset, yoffset, 0);
Rectangle area(x, y, width, height); Rectangle area(x, y, width, height);
handleError(destTexture->copySubTexture(offset, area, unpackFlipY == GL_TRUE, handleError(destTexture->copySubTexture(this, offset, area, unpackFlipY == GL_TRUE,
unpackPremultiplyAlpha == GL_TRUE, unpackPremultiplyAlpha == GL_TRUE,
unpackUnmultiplyAlpha == GL_TRUE, sourceTexture)); unpackUnmultiplyAlpha == GL_TRUE, sourceTexture));
} }
...@@ -3082,7 +3082,7 @@ void Context::compressedCopyTextureCHROMIUM(GLuint sourceId, GLuint destId) ...@@ -3082,7 +3082,7 @@ void Context::compressedCopyTextureCHROMIUM(GLuint sourceId, GLuint destId)
gl::Texture *sourceTexture = getTexture(sourceId); gl::Texture *sourceTexture = getTexture(sourceId);
gl::Texture *destTexture = getTexture(destId); gl::Texture *destTexture = getTexture(destId);
handleError(destTexture->copyCompressedTexture(sourceTexture)); handleError(destTexture->copyCompressedTexture(this, sourceTexture));
} }
void Context::getBufferPointerv(GLenum target, GLenum pname, void **params) void Context::getBufferPointerv(GLenum target, GLenum pname, void **params)
...@@ -3696,7 +3696,7 @@ void Context::texStorage2DMultisample(GLenum target, ...@@ -3696,7 +3696,7 @@ void Context::texStorage2DMultisample(GLenum target,
{ {
Extents size(width, height, 1); Extents size(width, height, 1);
Texture *texture = getTargetTexture(target); Texture *texture = getTargetTexture(target);
handleError(texture->setStorageMultisample(target, samples, internalformat, size, handleError(texture->setStorageMultisample(this, target, samples, internalformat, size,
fixedsamplelocations)); fixedsamplelocations));
} }
......
...@@ -93,11 +93,11 @@ TEST(ImageTest, RespecificationReleasesReferences) ...@@ -93,11 +93,11 @@ TEST(ImageTest, RespecificationReleasesReferences)
gl::PixelUnpackState defaultUnpackState; gl::PixelUnpackState defaultUnpackState;
EXPECT_CALL(*textureImpl, setImage(_, _, _, _, _, _, _, _)) EXPECT_CALL(*textureImpl, setImage(_, _, _, _, _, _, _, _, _))
.WillOnce(Return(gl::NoError())) .WillOnce(Return(gl::NoError()))
.RetiresOnSaturation(); .RetiresOnSaturation();
texture->setImage(defaultUnpackState, GL_TEXTURE_2D, 0, GL_RGBA8, gl::Extents(1, 1, 1), GL_RGBA, texture->setImage(nullptr, defaultUnpackState, GL_TEXTURE_2D, 0, GL_RGBA8, gl::Extents(1, 1, 1),
GL_UNSIGNED_BYTE, nullptr); GL_RGBA, GL_UNSIGNED_BYTE, nullptr);
rx::MockImageImpl *imageImpl = new rx::MockImageImpl(); rx::MockImageImpl *imageImpl = new rx::MockImageImpl();
egl::Image *image = new egl::Image(imageImpl, EGL_GL_TEXTURE_2D, texture, egl::AttributeMap()); egl::Image *image = new egl::Image(imageImpl, EGL_GL_TEXTURE_2D, texture, egl::AttributeMap());
...@@ -110,12 +110,12 @@ TEST(ImageTest, RespecificationReleasesReferences) ...@@ -110,12 +110,12 @@ TEST(ImageTest, RespecificationReleasesReferences)
// Respecify the texture and verify that the image releases its reference // Respecify the texture and verify that the image releases its reference
EXPECT_CALL(*imageImpl, orphan(_)).WillOnce(Return(gl::NoError())).RetiresOnSaturation(); EXPECT_CALL(*imageImpl, orphan(_)).WillOnce(Return(gl::NoError())).RetiresOnSaturation();
EXPECT_CALL(*textureImpl, setImage(_, _, _, _, _, _, _, _)) EXPECT_CALL(*textureImpl, setImage(_, _, _, _, _, _, _, _, _))
.WillOnce(Return(gl::NoError())) .WillOnce(Return(gl::NoError()))
.RetiresOnSaturation(); .RetiresOnSaturation();
texture->setImage(defaultUnpackState, GL_TEXTURE_2D, 0, GL_RGBA8, gl::Extents(1, 1, 1), GL_RGBA, texture->setImage(nullptr, defaultUnpackState, GL_TEXTURE_2D, 0, GL_RGBA8, gl::Extents(1, 1, 1),
GL_UNSIGNED_BYTE, nullptr); GL_RGBA, GL_UNSIGNED_BYTE, nullptr);
EXPECT_EQ(texture->getRefCount(), 1u); EXPECT_EQ(texture->getRefCount(), 1u);
EXPECT_EQ(image->getRefCount(), 1u); EXPECT_EQ(image->getRefCount(), 1u);
......
...@@ -263,7 +263,8 @@ class Texture final : public egl::ImageSibling, ...@@ -263,7 +263,8 @@ class Texture final : public egl::ImageSibling,
bool isMipmapComplete() const; bool isMipmapComplete() const;
Error setImage(const PixelUnpackState &unpackState, Error setImage(const Context *context,
const PixelUnpackState &unpackState,
GLenum target, GLenum target,
size_t level, size_t level,
GLenum internalFormat, GLenum internalFormat,
...@@ -271,7 +272,8 @@ class Texture final : public egl::ImageSibling, ...@@ -271,7 +272,8 @@ class Texture final : public egl::ImageSibling,
GLenum format, GLenum format,
GLenum type, GLenum type,
const uint8_t *pixels); const uint8_t *pixels);
Error setSubImage(const PixelUnpackState &unpackState, Error setSubImage(const Context *context,
const PixelUnpackState &unpackState,
GLenum target, GLenum target,
size_t level, size_t level,
const Box &area, const Box &area,
...@@ -279,14 +281,16 @@ class Texture final : public egl::ImageSibling, ...@@ -279,14 +281,16 @@ class Texture final : public egl::ImageSibling,
GLenum type, GLenum type,
const uint8_t *pixels); const uint8_t *pixels);
Error setCompressedImage(const PixelUnpackState &unpackState, Error setCompressedImage(const Context *context,
const PixelUnpackState &unpackState,
GLenum target, GLenum target,
size_t level, size_t level,
GLenum internalFormat, GLenum internalFormat,
const Extents &size, const Extents &size,
size_t imageSize, size_t imageSize,
const uint8_t *pixels); const uint8_t *pixels);
Error setCompressedSubImage(const PixelUnpackState &unpackState, Error setCompressedSubImage(const Context *context,
const PixelUnpackState &unpackState,
GLenum target, GLenum target,
size_t level, size_t level,
const Box &area, const Box &area,
...@@ -294,34 +298,43 @@ class Texture final : public egl::ImageSibling, ...@@ -294,34 +298,43 @@ class Texture final : public egl::ImageSibling,
size_t imageSize, size_t imageSize,
const uint8_t *pixels); const uint8_t *pixels);
Error copyImage(GLenum target, Error copyImage(const Context *context,
GLenum target,
size_t level, size_t level,
const Rectangle &sourceArea, const Rectangle &sourceArea,
GLenum internalFormat, GLenum internalFormat,
const Framebuffer *source); const Framebuffer *source);
Error copySubImage(GLenum target, Error copySubImage(const Context *context,
GLenum target,
size_t level, size_t level,
const Offset &destOffset, const Offset &destOffset,
const Rectangle &sourceArea, const Rectangle &sourceArea,
const Framebuffer *source); const Framebuffer *source);
Error copyTexture(GLenum internalFormat, Error copyTexture(const Context *context,
GLenum internalFormat,
GLenum type, GLenum type,
bool unpackFlipY, bool unpackFlipY,
bool unpackPremultiplyAlpha, bool unpackPremultiplyAlpha,
bool unpackUnmultiplyAlpha, bool unpackUnmultiplyAlpha,
const Texture *source); const Texture *source);
Error copySubTexture(const Offset &destOffset, Error copySubTexture(const Context *context,
const Offset &destOffset,
const Rectangle &sourceArea, const Rectangle &sourceArea,
bool unpackFlipY, bool unpackFlipY,
bool unpackPremultiplyAlpha, bool unpackPremultiplyAlpha,
bool unpackUnmultiplyAlpha, bool unpackUnmultiplyAlpha,
const Texture *source); const Texture *source);
Error copyCompressedTexture(const Texture *source); Error copyCompressedTexture(const Context *context, const Texture *source);
Error setStorage(GLenum target, GLsizei levels, GLenum internalFormat, const Extents &size); Error setStorage(const Context *context,
GLenum target,
GLsizei levels,
GLenum internalFormat,
const Extents &size);
Error setStorageMultisample(GLenum target, Error setStorageMultisample(const Context *context,
GLenum target,
GLsizei samples, GLsizei samples,
GLint internalformat, GLint internalformat,
const Extents &size, const Extents &size,
...@@ -329,7 +342,7 @@ class Texture final : public egl::ImageSibling, ...@@ -329,7 +342,7 @@ class Texture final : public egl::ImageSibling,
Error setEGLImageTarget(GLenum target, egl::Image *imageTarget); Error setEGLImageTarget(GLenum target, egl::Image *imageTarget);
Error generateMipmap(); Error generateMipmap(const Context *context);
egl::Surface *getBoundSurface() const; egl::Surface *getBoundSurface() const;
egl::Stream *getBoundStream() const; egl::Stream *getBoundStream() const;
......
...@@ -19,7 +19,8 @@ TextureImpl::~TextureImpl() ...@@ -19,7 +19,8 @@ TextureImpl::~TextureImpl()
{ {
} }
gl::Error TextureImpl::copyTexture(GLenum internalFormat, gl::Error TextureImpl::copyTexture(ContextImpl *contextImpl,
GLenum internalFormat,
GLenum type, GLenum type,
bool unpackFlipY, bool unpackFlipY,
bool unpackPremultiplyAlpha, bool unpackPremultiplyAlpha,
...@@ -30,7 +31,8 @@ gl::Error TextureImpl::copyTexture(GLenum internalFormat, ...@@ -30,7 +31,8 @@ gl::Error TextureImpl::copyTexture(GLenum internalFormat,
return gl::Error(GL_INVALID_OPERATION, "CHROMIUM_copy_texture exposed but not implemented."); return gl::Error(GL_INVALID_OPERATION, "CHROMIUM_copy_texture exposed but not implemented.");
} }
gl::Error TextureImpl::copySubTexture(const gl::Offset &destOffset, gl::Error TextureImpl::copySubTexture(ContextImpl *contextImpl,
const gl::Offset &destOffset,
const gl::Rectangle &sourceArea, const gl::Rectangle &sourceArea,
bool unpackFlipY, bool unpackFlipY,
bool unpackPremultiplyAlpha, bool unpackPremultiplyAlpha,
...@@ -41,10 +43,10 @@ gl::Error TextureImpl::copySubTexture(const gl::Offset &destOffset, ...@@ -41,10 +43,10 @@ gl::Error TextureImpl::copySubTexture(const gl::Offset &destOffset,
return gl::Error(GL_INVALID_OPERATION, "CHROMIUM_copy_texture exposed but not implemented."); return gl::Error(GL_INVALID_OPERATION, "CHROMIUM_copy_texture exposed but not implemented.");
} }
gl::Error TextureImpl::copyCompressedTexture(const gl::Texture *source) gl::Error TextureImpl::copyCompressedTexture(ContextImpl *contextImpl, const gl::Texture *source)
{ {
UNREACHABLE(); UNREACHABLE();
return gl::Error(GL_INVALID_OPERATION, return gl::Error(GL_INVALID_OPERATION,
"CHROMIUM_copy_compressed_texture exposed but not implemented."); "CHROMIUM_copy_compressed_texture exposed but not implemented.");
} }
} } // namespace rx
...@@ -38,6 +38,7 @@ struct TextureState; ...@@ -38,6 +38,7 @@ struct TextureState;
namespace rx namespace rx
{ {
class ContextImpl;
class TextureImpl : public FramebufferAttachmentObjectImpl class TextureImpl : public FramebufferAttachmentObjectImpl
{ {
...@@ -45,39 +46,79 @@ class TextureImpl : public FramebufferAttachmentObjectImpl ...@@ -45,39 +46,79 @@ class TextureImpl : public FramebufferAttachmentObjectImpl
TextureImpl(const gl::TextureState &state); TextureImpl(const gl::TextureState &state);
virtual ~TextureImpl(); virtual ~TextureImpl();
virtual gl::Error setImage(GLenum target, size_t level, GLenum internalFormat, const gl::Extents &size, GLenum format, GLenum type, virtual gl::Error setImage(ContextImpl *contextImpl,
const gl::PixelUnpackState &unpack, const uint8_t *pixels) = 0; GLenum target,
virtual gl::Error setSubImage(GLenum target, size_t level, const gl::Box &area, GLenum format, GLenum type, size_t level,
const gl::PixelUnpackState &unpack, const uint8_t *pixels) = 0; GLenum internalFormat,
const gl::Extents &size,
virtual gl::Error setCompressedImage(GLenum target, size_t level, GLenum internalFormat, const gl::Extents &size, GLenum format,
const gl::PixelUnpackState &unpack, size_t imageSize, const uint8_t *pixels) = 0; GLenum type,
virtual gl::Error setCompressedSubImage(GLenum target, size_t level, const gl::Box &area, GLenum format, const gl::PixelUnpackState &unpack,
const gl::PixelUnpackState &unpack, size_t imageSize, const uint8_t *pixels) = 0; const uint8_t *pixels) = 0;
virtual gl::Error setSubImage(ContextImpl *contextImpl,
virtual gl::Error copyImage(GLenum target, size_t level, const gl::Rectangle &sourceArea, GLenum internalFormat, GLenum target,
size_t level,
const gl::Box &area,
GLenum format,
GLenum type,
const gl::PixelUnpackState &unpack,
const uint8_t *pixels) = 0;
virtual gl::Error setCompressedImage(ContextImpl *contextImpl,
GLenum target,
size_t level,
GLenum internalFormat,
const gl::Extents &size,
const gl::PixelUnpackState &unpack,
size_t imageSize,
const uint8_t *pixels) = 0;
virtual gl::Error setCompressedSubImage(ContextImpl *contextImpl,
GLenum target,
size_t level,
const gl::Box &area,
GLenum format,
const gl::PixelUnpackState &unpack,
size_t imageSize,
const uint8_t *pixels) = 0;
virtual gl::Error copyImage(ContextImpl *contextImpl,
GLenum target,
size_t level,
const gl::Rectangle &sourceArea,
GLenum internalFormat,
const gl::Framebuffer *source) = 0; const gl::Framebuffer *source) = 0;
virtual gl::Error copySubImage(GLenum target, size_t level, const gl::Offset &destOffset, const gl::Rectangle &sourceArea, virtual gl::Error copySubImage(ContextImpl *contextImpl,
GLenum target,
size_t level,
const gl::Offset &destOffset,
const gl::Rectangle &sourceArea,
const gl::Framebuffer *source) = 0; const gl::Framebuffer *source) = 0;
virtual gl::Error copyTexture(GLenum internalFormat, virtual gl::Error copyTexture(ContextImpl *contextImpl,
GLenum internalFormat,
GLenum type, GLenum type,
bool unpackFlipY, bool unpackFlipY,
bool unpackPremultiplyAlpha, bool unpackPremultiplyAlpha,
bool unpackUnmultiplyAlpha, bool unpackUnmultiplyAlpha,
const gl::Texture *source); const gl::Texture *source);
virtual gl::Error copySubTexture(const gl::Offset &destOffset, virtual gl::Error copySubTexture(ContextImpl *contextImpl,
const gl::Offset &destOffset,
const gl::Rectangle &sourceArea, const gl::Rectangle &sourceArea,
bool unpackFlipY, bool unpackFlipY,
bool unpackPremultiplyAlpha, bool unpackPremultiplyAlpha,
bool unpackUnmultiplyAlpha, bool unpackUnmultiplyAlpha,
const gl::Texture *source); const gl::Texture *source);
virtual gl::Error copyCompressedTexture(const gl::Texture *source); virtual gl::Error copyCompressedTexture(ContextImpl *contextImpl, const gl::Texture *source);
virtual gl::Error setStorage(GLenum target, size_t levels, GLenum internalFormat, const gl::Extents &size) = 0; virtual gl::Error setStorage(ContextImpl *contextImpl,
GLenum target,
size_t levels,
GLenum internalFormat,
const gl::Extents &size) = 0;
virtual gl::Error setStorageMultisample(GLenum target, virtual gl::Error setStorageMultisample(ContextImpl *contextImpl,
GLenum target,
GLsizei samples, GLsizei samples,
GLint internalformat, GLint internalformat,
const gl::Extents &size, const gl::Extents &size,
...@@ -89,7 +130,7 @@ class TextureImpl : public FramebufferAttachmentObjectImpl ...@@ -89,7 +130,7 @@ class TextureImpl : public FramebufferAttachmentObjectImpl
egl::Stream *stream, egl::Stream *stream,
const egl::Stream::GLTextureDescription &desc) = 0; const egl::Stream::GLTextureDescription &desc) = 0;
virtual gl::Error generateMipmap() = 0; virtual gl::Error generateMipmap(ContextImpl *contextImpl) = 0;
virtual void setBaseLevel(GLuint baseLevel) = 0; virtual void setBaseLevel(GLuint baseLevel) = 0;
......
...@@ -21,33 +21,80 @@ class MockTextureImpl : public TextureImpl ...@@ -21,33 +21,80 @@ class MockTextureImpl : public TextureImpl
public: public:
MockTextureImpl() : TextureImpl(mMockState), mMockState(GL_TEXTURE_2D) {} MockTextureImpl() : TextureImpl(mMockState), mMockState(GL_TEXTURE_2D) {}
virtual ~MockTextureImpl() { destructor(); } virtual ~MockTextureImpl() { destructor(); }
MOCK_METHOD8(setImage, gl::Error(GLenum, size_t, GLenum, const gl::Extents &, GLenum, GLenum, const gl::PixelUnpackState &, const uint8_t *)); MOCK_METHOD9(setImage,
MOCK_METHOD7(setSubImage, gl::Error(GLenum, size_t, const gl::Box &, GLenum, GLenum, const gl::PixelUnpackState &, const uint8_t *)); gl::Error(ContextImpl *,
MOCK_METHOD7(setCompressedImage, gl::Error(GLenum, size_t, GLenum, const gl::Extents &, const gl::PixelUnpackState &, size_t, const uint8_t *)); GLenum,
MOCK_METHOD7(setCompressedSubImage, gl::Error(GLenum, size_t, const gl::Box &, GLenum, const gl::PixelUnpackState &, size_t, const uint8_t *)); size_t,
MOCK_METHOD5(copyImage, gl::Error(GLenum, size_t, const gl::Rectangle &, GLenum, const gl::Framebuffer *)); GLenum,
MOCK_METHOD5(copySubImage, gl::Error(GLenum, size_t, const gl::Offset &, const gl::Rectangle &, const gl::Framebuffer *)); const gl::Extents &,
MOCK_METHOD6(copyTexture, gl::Error(GLenum, GLenum, bool, bool, bool, const gl::Texture *)); GLenum,
MOCK_METHOD6(copySubTexture, GLenum,
gl::Error(const gl::Offset &, const gl::PixelUnpackState &,
const uint8_t *));
MOCK_METHOD8(setSubImage,
gl::Error(ContextImpl *,
GLenum,
size_t,
const gl::Box &,
GLenum,
GLenum,
const gl::PixelUnpackState &,
const uint8_t *));
MOCK_METHOD8(setCompressedImage,
gl::Error(ContextImpl *,
GLenum,
size_t,
GLenum,
const gl::Extents &,
const gl::PixelUnpackState &,
size_t,
const uint8_t *));
MOCK_METHOD8(setCompressedSubImage,
gl::Error(ContextImpl *,
GLenum,
size_t,
const gl::Box &,
GLenum,
const gl::PixelUnpackState &,
size_t,
const uint8_t *));
MOCK_METHOD6(copyImage,
gl::Error(ContextImpl *,
GLenum,
size_t,
const gl::Rectangle &,
GLenum,
const gl::Framebuffer *));
MOCK_METHOD6(copySubImage,
gl::Error(ContextImpl *,
GLenum,
size_t,
const gl::Offset &,
const gl::Rectangle &,
const gl::Framebuffer *));
MOCK_METHOD7(copyTexture,
gl::Error(ContextImpl *, GLenum, GLenum, bool, bool, bool, const gl::Texture *));
MOCK_METHOD7(copySubTexture,
gl::Error(ContextImpl *,
const gl::Offset &,
const gl::Rectangle &, const gl::Rectangle &,
bool, bool,
bool, bool,
bool, bool,
const gl::Texture *)); const gl::Texture *));
MOCK_METHOD1(copyCompressedTexture, gl::Error(const gl::Texture *source)); MOCK_METHOD2(copyCompressedTexture, gl::Error(ContextImpl *, const gl::Texture *source));
MOCK_METHOD4(setStorage, gl::Error(GLenum, size_t, GLenum, const gl::Extents &)); MOCK_METHOD5(setStorage, gl::Error(ContextImpl *, GLenum, size_t, GLenum, const gl::Extents &));
MOCK_METHOD3(setImageExternal, MOCK_METHOD3(setImageExternal,
gl::Error(GLenum, egl::Stream *, const egl::Stream::GLTextureDescription &)); gl::Error(GLenum, egl::Stream *, const egl::Stream::GLTextureDescription &));
MOCK_METHOD2(setEGLImageTarget, gl::Error(GLenum, egl::Image *)); MOCK_METHOD2(setEGLImageTarget, gl::Error(GLenum, egl::Image *));
MOCK_METHOD0(generateMipmap, gl::Error()); MOCK_METHOD1(generateMipmap, gl::Error(ContextImpl *));
MOCK_METHOD1(bindTexImage, void(egl::Surface *)); MOCK_METHOD1(bindTexImage, void(egl::Surface *));
MOCK_METHOD0(releaseTexImage, void(void)); MOCK_METHOD0(releaseTexImage, void(void));
MOCK_METHOD2(getAttachmentRenderTarget, gl::Error(const gl::FramebufferAttachment::Target &, FramebufferAttachmentRenderTarget **)); MOCK_METHOD2(getAttachmentRenderTarget, gl::Error(const gl::FramebufferAttachment::Target &, FramebufferAttachmentRenderTarget **));
MOCK_METHOD5(setStorageMultisample, MOCK_METHOD6(setStorageMultisample,
gl::Error(GLenum, GLsizei, GLint, const gl::Extents &, GLboolean)); gl::Error(ContextImpl *, GLenum, GLsizei, GLint, const gl::Extents &, GLboolean));
MOCK_METHOD1(setBaseLevel, void(GLuint)); MOCK_METHOD1(setBaseLevel, void(GLuint));
......
...@@ -256,19 +256,19 @@ gl::Texture *RendererD3D::getIncompleteTexture(GLImplFactory *implFactory, GLenu ...@@ -256,19 +256,19 @@ gl::Texture *RendererD3D::getIncompleteTexture(GLImplFactory *implFactory, GLenu
// Skip the API layer to avoid needing to pass the Context and mess with dirty bits. // Skip the API layer to avoid needing to pass the Context and mess with dirty bits.
gl::Texture *t = gl::Texture *t =
new gl::Texture(implFactory, std::numeric_limits<GLuint>::max(), createType); new gl::Texture(implFactory, std::numeric_limits<GLuint>::max(), createType);
t->setStorage(createType, 1, GL_RGBA8, colorSize); t->setStorage(nullptr, createType, 1, GL_RGBA8, colorSize);
if (type == GL_TEXTURE_CUBE_MAP) if (type == GL_TEXTURE_CUBE_MAP)
{ {
for (GLenum face = GL_TEXTURE_CUBE_MAP_POSITIVE_X; face <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z; face++) for (GLenum face = GL_TEXTURE_CUBE_MAP_POSITIVE_X; face <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z; face++)
{ {
t->getImplementation()->setSubImage(face, 0, area, GL_RGBA8, GL_UNSIGNED_BYTE, t->getImplementation()->setSubImage(nullptr, face, 0, area, GL_RGBA8,
unpack, color); GL_UNSIGNED_BYTE, unpack, color);
} }
} }
else else
{ {
t->getImplementation()->setSubImage(createType, 0, area, GL_RGBA8, GL_UNSIGNED_BYTE, unpack, t->getImplementation()->setSubImage(nullptr, createType, 0, area, GL_RGBA8,
color); GL_UNSIGNED_BYTE, unpack, color);
} }
mIncompleteTextures[type].set(t); mIncompleteTextures[type].set(t);
} }
......
...@@ -156,7 +156,8 @@ TextureGL::~TextureGL() ...@@ -156,7 +156,8 @@ TextureGL::~TextureGL()
mTextureID = 0; mTextureID = 0;
} }
gl::Error TextureGL::setImage(GLenum target, gl::Error TextureGL::setImage(ContextImpl *contextImpl,
GLenum target,
size_t level, size_t level,
GLenum internalFormat, GLenum internalFormat,
const gl::Extents &size, const gl::Extents &size,
...@@ -257,8 +258,14 @@ void TextureGL::reserveTexImageToBeFilled(GLenum target, ...@@ -257,8 +258,14 @@ void TextureGL::reserveTexImageToBeFilled(GLenum target,
setImageHelper(target, level, internalFormat, size, format, type, nullptr); setImageHelper(target, level, internalFormat, size, format, type, nullptr);
} }
gl::Error TextureGL::setSubImage(GLenum target, size_t level, const gl::Box &area, GLenum format, GLenum type, gl::Error TextureGL::setSubImage(ContextImpl *contextImpl,
const gl::PixelUnpackState &unpack, const uint8_t *pixels) GLenum target,
size_t level,
const gl::Box &area,
GLenum format,
GLenum type,
const gl::PixelUnpackState &unpack,
const uint8_t *pixels)
{ {
ASSERT(CompatibleTextureTarget(getTarget(), target)); ASSERT(CompatibleTextureTarget(getTarget(), target));
...@@ -452,8 +459,14 @@ gl::Error TextureGL::setSubImagePaddingWorkaround(GLenum target, ...@@ -452,8 +459,14 @@ gl::Error TextureGL::setSubImagePaddingWorkaround(GLenum target,
return gl::NoError(); return gl::NoError();
} }
gl::Error TextureGL::setCompressedImage(GLenum target, size_t level, GLenum internalFormat, const gl::Extents &size, gl::Error TextureGL::setCompressedImage(ContextImpl *contextImpl,
const gl::PixelUnpackState &unpack, size_t imageSize, const uint8_t *pixels) GLenum target,
size_t level,
GLenum internalFormat,
const gl::Extents &size,
const gl::PixelUnpackState &unpack,
size_t imageSize,
const uint8_t *pixels)
{ {
ASSERT(CompatibleTextureTarget(getTarget(), target)); ASSERT(CompatibleTextureTarget(getTarget(), target));
...@@ -485,8 +498,14 @@ gl::Error TextureGL::setCompressedImage(GLenum target, size_t level, GLenum inte ...@@ -485,8 +498,14 @@ gl::Error TextureGL::setCompressedImage(GLenum target, size_t level, GLenum inte
return gl::NoError(); return gl::NoError();
} }
gl::Error TextureGL::setCompressedSubImage(GLenum target, size_t level, const gl::Box &area, GLenum format, gl::Error TextureGL::setCompressedSubImage(ContextImpl *contextImpl,
const gl::PixelUnpackState &unpack, size_t imageSize, const uint8_t *pixels) GLenum target,
size_t level,
const gl::Box &area,
GLenum format,
const gl::PixelUnpackState &unpack,
size_t imageSize,
const uint8_t *pixels)
{ {
ASSERT(CompatibleTextureTarget(getTarget(), target)); ASSERT(CompatibleTextureTarget(getTarget(), target));
...@@ -519,7 +538,11 @@ gl::Error TextureGL::setCompressedSubImage(GLenum target, size_t level, const gl ...@@ -519,7 +538,11 @@ gl::Error TextureGL::setCompressedSubImage(GLenum target, size_t level, const gl
return gl::NoError(); return gl::NoError();
} }
gl::Error TextureGL::copyImage(GLenum target, size_t level, const gl::Rectangle &sourceArea, GLenum internalFormat, gl::Error TextureGL::copyImage(ContextImpl *contextImpl,
GLenum target,
size_t level,
const gl::Rectangle &sourceArea,
GLenum internalFormat,
const gl::Framebuffer *source) const gl::Framebuffer *source)
{ {
nativegl::CopyTexImageImageFormat copyTexImageFormat = nativegl::GetCopyTexImageImageFormat( nativegl::CopyTexImageImageFormat copyTexImageFormat = nativegl::GetCopyTexImageImageFormat(
...@@ -561,7 +584,11 @@ gl::Error TextureGL::copyImage(GLenum target, size_t level, const gl::Rectangle ...@@ -561,7 +584,11 @@ gl::Error TextureGL::copyImage(GLenum target, size_t level, const gl::Rectangle
return gl::NoError(); return gl::NoError();
} }
gl::Error TextureGL::copySubImage(GLenum target, size_t level, const gl::Offset &destOffset, const gl::Rectangle &sourceArea, gl::Error TextureGL::copySubImage(ContextImpl *contextImpl,
GLenum target,
size_t level,
const gl::Offset &destOffset,
const gl::Rectangle &sourceArea,
const gl::Framebuffer *source) const gl::Framebuffer *source)
{ {
const FramebufferGL *sourceFramebufferGL = GetImplAs<FramebufferGL>(source); const FramebufferGL *sourceFramebufferGL = GetImplAs<FramebufferGL>(source);
...@@ -604,7 +631,8 @@ gl::Error TextureGL::copySubImage(GLenum target, size_t level, const gl::Offset ...@@ -604,7 +631,8 @@ gl::Error TextureGL::copySubImage(GLenum target, size_t level, const gl::Offset
return gl::NoError(); return gl::NoError();
} }
gl::Error TextureGL::copyTexture(GLenum internalFormat, gl::Error TextureGL::copyTexture(ContextImpl *contextImpl,
GLenum internalFormat,
GLenum type, GLenum type,
bool unpackFlipY, bool unpackFlipY,
bool unpackPremultiplyAlpha, bool unpackPremultiplyAlpha,
...@@ -623,7 +651,8 @@ gl::Error TextureGL::copyTexture(GLenum internalFormat, ...@@ -623,7 +651,8 @@ gl::Error TextureGL::copyTexture(GLenum internalFormat,
unpackPremultiplyAlpha, unpackUnmultiplyAlpha, source); unpackPremultiplyAlpha, unpackUnmultiplyAlpha, source);
} }
gl::Error TextureGL::copySubTexture(const gl::Offset &destOffset, gl::Error TextureGL::copySubTexture(ContextImpl *contextImpl,
const gl::Offset &destOffset,
const gl::Rectangle &sourceArea, const gl::Rectangle &sourceArea,
bool unpackFlipY, bool unpackFlipY,
bool unpackPremultiplyAlpha, bool unpackPremultiplyAlpha,
...@@ -667,7 +696,8 @@ gl::Error TextureGL::copySubTextureHelper(const gl::Offset &destOffset, ...@@ -667,7 +696,8 @@ gl::Error TextureGL::copySubTextureHelper(const gl::Offset &destOffset,
unpackFlipY, unpackPremultiplyAlpha, unpackUnmultiplyAlpha); unpackFlipY, unpackPremultiplyAlpha, unpackUnmultiplyAlpha);
} }
gl::Error TextureGL::setStorage(GLenum target, gl::Error TextureGL::setStorage(ContextImpl *contextImpl,
GLenum target,
size_t levels, size_t levels,
GLenum internalFormat, GLenum internalFormat,
const gl::Extents &size) const gl::Extents &size)
...@@ -807,7 +837,8 @@ gl::Error TextureGL::setStorage(GLenum target, ...@@ -807,7 +837,8 @@ gl::Error TextureGL::setStorage(GLenum target,
return gl::NoError(); return gl::NoError();
} }
gl::Error TextureGL::setStorageMultisample(GLenum target, gl::Error TextureGL::setStorageMultisample(ContextImpl *contextImpl,
GLenum target,
GLsizei samples, GLsizei samples,
GLint internalFormat, GLint internalFormat,
const gl::Extents &size, const gl::Extents &size,
...@@ -836,7 +867,7 @@ gl::Error TextureGL::setImageExternal(GLenum target, ...@@ -836,7 +867,7 @@ gl::Error TextureGL::setImageExternal(GLenum target,
return gl::Error(GL_INVALID_OPERATION); return gl::Error(GL_INVALID_OPERATION);
} }
gl::Error TextureGL::generateMipmap() gl::Error TextureGL::generateMipmap(ContextImpl *contextImpl)
{ {
mStateManager->bindTexture(getTarget(), mTextureID); mStateManager->bindTexture(getTarget(), mTextureID);
mFunctions->generateMipmap(getTarget()); mFunctions->generateMipmap(getTarget());
......
...@@ -59,28 +59,63 @@ class TextureGL : public TextureImpl ...@@ -59,28 +59,63 @@ class TextureGL : public TextureImpl
BlitGL *blitter); BlitGL *blitter);
~TextureGL() override; ~TextureGL() override;
gl::Error setImage(GLenum target, size_t level, GLenum internalFormat, const gl::Extents &size, GLenum format, GLenum type, gl::Error setImage(ContextImpl *contextImpl,
const gl::PixelUnpackState &unpack, const uint8_t *pixels) override; GLenum target,
gl::Error setSubImage(GLenum target, size_t level, const gl::Box &area, GLenum format, GLenum type, size_t level,
const gl::PixelUnpackState &unpack, const uint8_t *pixels) override; GLenum internalFormat,
const gl::Extents &size,
gl::Error setCompressedImage(GLenum target, size_t level, GLenum internalFormat, const gl::Extents &size, GLenum format,
const gl::PixelUnpackState &unpack, size_t imageSize, const uint8_t *pixels) override; GLenum type,
gl::Error setCompressedSubImage(GLenum target, size_t level, const gl::Box &area, GLenum format, const gl::PixelUnpackState &unpack,
const gl::PixelUnpackState &unpack, size_t imageSize, const uint8_t *pixels) override; const uint8_t *pixels) override;
gl::Error setSubImage(ContextImpl *contextImpl,
gl::Error copyImage(GLenum target, size_t level, const gl::Rectangle &sourceArea, GLenum internalFormat, GLenum target,
size_t level,
const gl::Box &area,
GLenum format,
GLenum type,
const gl::PixelUnpackState &unpack,
const uint8_t *pixels) override;
gl::Error setCompressedImage(ContextImpl *contextImpl,
GLenum target,
size_t level,
GLenum internalFormat,
const gl::Extents &size,
const gl::PixelUnpackState &unpack,
size_t imageSize,
const uint8_t *pixels) override;
gl::Error setCompressedSubImage(ContextImpl *contextImpl,
GLenum target,
size_t level,
const gl::Box &area,
GLenum format,
const gl::PixelUnpackState &unpack,
size_t imageSize,
const uint8_t *pixels) override;
gl::Error copyImage(ContextImpl *contextImpl,
GLenum target,
size_t level,
const gl::Rectangle &sourceArea,
GLenum internalFormat,
const gl::Framebuffer *source) override; const gl::Framebuffer *source) override;
gl::Error copySubImage(GLenum target, size_t level, const gl::Offset &destOffset, const gl::Rectangle &sourceArea, gl::Error copySubImage(ContextImpl *contextImpl,
GLenum target,
size_t level,
const gl::Offset &destOffset,
const gl::Rectangle &sourceArea,
const gl::Framebuffer *source) override; const gl::Framebuffer *source) override;
gl::Error copyTexture(GLenum internalFormat, gl::Error copyTexture(ContextImpl *contextImpl,
GLenum internalFormat,
GLenum type, GLenum type,
bool unpackFlipY, bool unpackFlipY,
bool unpackPremultiplyAlpha, bool unpackPremultiplyAlpha,
bool unpackUnmultiplyAlpha, bool unpackUnmultiplyAlpha,
const gl::Texture *source) override; const gl::Texture *source) override;
gl::Error copySubTexture(const gl::Offset &destOffset, gl::Error copySubTexture(ContextImpl *contextImpl,
const gl::Offset &destOffset,
const gl::Rectangle &sourceArea, const gl::Rectangle &sourceArea,
bool unpackFlipY, bool unpackFlipY,
bool unpackPremultiplyAlpha, bool unpackPremultiplyAlpha,
...@@ -94,9 +129,14 @@ class TextureGL : public TextureImpl ...@@ -94,9 +129,14 @@ class TextureGL : public TextureImpl
bool unpackUnmultiplyAlpha, bool unpackUnmultiplyAlpha,
const gl::Texture *source); const gl::Texture *source);
gl::Error setStorage(GLenum target, size_t levels, GLenum internalFormat, const gl::Extents &size) override; gl::Error setStorage(ContextImpl *contextImpl,
GLenum target,
size_t levels,
GLenum internalFormat,
const gl::Extents &size) override;
gl::Error setStorageMultisample(GLenum target, gl::Error setStorageMultisample(ContextImpl *contextImpl,
GLenum target,
GLsizei samples, GLsizei samples,
GLint internalFormat, GLint internalFormat,
const gl::Extents &size, const gl::Extents &size,
...@@ -106,7 +146,7 @@ class TextureGL : public TextureImpl ...@@ -106,7 +146,7 @@ class TextureGL : public TextureImpl
egl::Stream *stream, egl::Stream *stream,
const egl::Stream::GLTextureDescription &desc) override; const egl::Stream::GLTextureDescription &desc) override;
gl::Error generateMipmap() override; gl::Error generateMipmap(ContextImpl *contextImpl) override;
void bindTexImage(egl::Surface *surface) override; void bindTexImage(egl::Surface *surface) override;
void releaseTexImage() override; void releaseTexImage() override;
......
...@@ -22,7 +22,8 @@ TextureNULL::~TextureNULL() ...@@ -22,7 +22,8 @@ TextureNULL::~TextureNULL()
{ {
} }
gl::Error TextureNULL::setImage(GLenum target, gl::Error TextureNULL::setImage(ContextImpl *contextImpl,
GLenum target,
size_t level, size_t level,
GLenum internalFormat, GLenum internalFormat,
const gl::Extents &size, const gl::Extents &size,
...@@ -36,7 +37,8 @@ gl::Error TextureNULL::setImage(GLenum target, ...@@ -36,7 +37,8 @@ gl::Error TextureNULL::setImage(GLenum target,
return gl::NoError(); return gl::NoError();
} }
gl::Error TextureNULL::setSubImage(GLenum target, gl::Error TextureNULL::setSubImage(ContextImpl *contextImpl,
GLenum target,
size_t level, size_t level,
const gl::Box &area, const gl::Box &area,
GLenum format, GLenum format,
...@@ -47,7 +49,8 @@ gl::Error TextureNULL::setSubImage(GLenum target, ...@@ -47,7 +49,8 @@ gl::Error TextureNULL::setSubImage(GLenum target,
return gl::NoError(); return gl::NoError();
} }
gl::Error TextureNULL::setCompressedImage(GLenum target, gl::Error TextureNULL::setCompressedImage(ContextImpl *contextImpl,
GLenum target,
size_t level, size_t level,
GLenum internalFormat, GLenum internalFormat,
const gl::Extents &size, const gl::Extents &size,
...@@ -58,7 +61,8 @@ gl::Error TextureNULL::setCompressedImage(GLenum target, ...@@ -58,7 +61,8 @@ gl::Error TextureNULL::setCompressedImage(GLenum target,
return gl::NoError(); return gl::NoError();
} }
gl::Error TextureNULL::setCompressedSubImage(GLenum target, gl::Error TextureNULL::setCompressedSubImage(ContextImpl *contextImpl,
GLenum target,
size_t level, size_t level,
const gl::Box &area, const gl::Box &area,
GLenum format, GLenum format,
...@@ -69,7 +73,8 @@ gl::Error TextureNULL::setCompressedSubImage(GLenum target, ...@@ -69,7 +73,8 @@ gl::Error TextureNULL::setCompressedSubImage(GLenum target,
return gl::NoError(); return gl::NoError();
} }
gl::Error TextureNULL::copyImage(GLenum target, gl::Error TextureNULL::copyImage(ContextImpl *contextImpl,
GLenum target,
size_t level, size_t level,
const gl::Rectangle &sourceArea, const gl::Rectangle &sourceArea,
GLenum internalFormat, GLenum internalFormat,
...@@ -78,7 +83,8 @@ gl::Error TextureNULL::copyImage(GLenum target, ...@@ -78,7 +83,8 @@ gl::Error TextureNULL::copyImage(GLenum target,
return gl::NoError(); return gl::NoError();
} }
gl::Error TextureNULL::copySubImage(GLenum target, gl::Error TextureNULL::copySubImage(ContextImpl *contextImpl,
GLenum target,
size_t level, size_t level,
const gl::Offset &destOffset, const gl::Offset &destOffset,
const gl::Rectangle &sourceArea, const gl::Rectangle &sourceArea,
...@@ -87,7 +93,8 @@ gl::Error TextureNULL::copySubImage(GLenum target, ...@@ -87,7 +93,8 @@ gl::Error TextureNULL::copySubImage(GLenum target,
return gl::NoError(); return gl::NoError();
} }
gl::Error TextureNULL::setStorage(GLenum target, gl::Error TextureNULL::setStorage(ContextImpl *contextImpl,
GLenum target,
size_t levels, size_t levels,
GLenum internalFormat, GLenum internalFormat,
const gl::Extents &size) const gl::Extents &size)
...@@ -107,7 +114,7 @@ gl::Error TextureNULL::setImageExternal(GLenum target, ...@@ -107,7 +114,7 @@ gl::Error TextureNULL::setImageExternal(GLenum target,
return gl::NoError(); return gl::NoError();
} }
gl::Error TextureNULL::generateMipmap() gl::Error TextureNULL::generateMipmap(ContextImpl *contextImpl)
{ {
return gl::NoError(); return gl::NoError();
} }
...@@ -128,7 +135,8 @@ void TextureNULL::syncState(const gl::Texture::DirtyBits &dirtyBits) ...@@ -128,7 +135,8 @@ void TextureNULL::syncState(const gl::Texture::DirtyBits &dirtyBits)
{ {
} }
gl::Error TextureNULL::setStorageMultisample(GLenum target, gl::Error TextureNULL::setStorageMultisample(ContextImpl *contextImpl,
GLenum target,
GLsizei samples, GLsizei samples,
GLint internalformat, GLint internalformat,
const gl::Extents &size, const gl::Extents &size,
......
...@@ -21,7 +21,8 @@ class TextureNULL : public TextureImpl ...@@ -21,7 +21,8 @@ class TextureNULL : public TextureImpl
TextureNULL(const gl::TextureState &state); TextureNULL(const gl::TextureState &state);
~TextureNULL() override; ~TextureNULL() override;
gl::Error setImage(GLenum target, gl::Error setImage(ContextImpl *contextImpl,
GLenum target,
size_t level, size_t level,
GLenum internalFormat, GLenum internalFormat,
const gl::Extents &size, const gl::Extents &size,
...@@ -29,7 +30,8 @@ class TextureNULL : public TextureImpl ...@@ -29,7 +30,8 @@ class TextureNULL : public TextureImpl
GLenum type, GLenum type,
const gl::PixelUnpackState &unpack, const gl::PixelUnpackState &unpack,
const uint8_t *pixels) override; const uint8_t *pixels) override;
gl::Error setSubImage(GLenum target, gl::Error setSubImage(ContextImpl *contextImpl,
GLenum target,
size_t level, size_t level,
const gl::Box &area, const gl::Box &area,
GLenum format, GLenum format,
...@@ -37,14 +39,16 @@ class TextureNULL : public TextureImpl ...@@ -37,14 +39,16 @@ class TextureNULL : public TextureImpl
const gl::PixelUnpackState &unpack, const gl::PixelUnpackState &unpack,
const uint8_t *pixels) override; const uint8_t *pixels) override;
gl::Error setCompressedImage(GLenum target, gl::Error setCompressedImage(ContextImpl *contextImpl,
GLenum target,
size_t level, size_t level,
GLenum internalFormat, GLenum internalFormat,
const gl::Extents &size, const gl::Extents &size,
const gl::PixelUnpackState &unpack, const gl::PixelUnpackState &unpack,
size_t imageSize, size_t imageSize,
const uint8_t *pixels) override; const uint8_t *pixels) override;
gl::Error setCompressedSubImage(GLenum target, gl::Error setCompressedSubImage(ContextImpl *contextImpl,
GLenum target,
size_t level, size_t level,
const gl::Box &area, const gl::Box &area,
GLenum format, GLenum format,
...@@ -52,18 +56,21 @@ class TextureNULL : public TextureImpl ...@@ -52,18 +56,21 @@ class TextureNULL : public TextureImpl
size_t imageSize, size_t imageSize,
const uint8_t *pixels) override; const uint8_t *pixels) override;
gl::Error copyImage(GLenum target, gl::Error copyImage(ContextImpl *contextImpl,
GLenum target,
size_t level, size_t level,
const gl::Rectangle &sourceArea, const gl::Rectangle &sourceArea,
GLenum internalFormat, GLenum internalFormat,
const gl::Framebuffer *source) override; const gl::Framebuffer *source) override;
gl::Error copySubImage(GLenum target, gl::Error copySubImage(ContextImpl *contextImpl,
GLenum target,
size_t level, size_t level,
const gl::Offset &destOffset, const gl::Offset &destOffset,
const gl::Rectangle &sourceArea, const gl::Rectangle &sourceArea,
const gl::Framebuffer *source) override; const gl::Framebuffer *source) override;
gl::Error setStorage(GLenum target, gl::Error setStorage(ContextImpl *contextImpl,
GLenum target,
size_t levels, size_t levels,
GLenum internalFormat, GLenum internalFormat,
const gl::Extents &size) override; const gl::Extents &size) override;
...@@ -74,7 +81,7 @@ class TextureNULL : public TextureImpl ...@@ -74,7 +81,7 @@ class TextureNULL : public TextureImpl
egl::Stream *stream, egl::Stream *stream,
const egl::Stream::GLTextureDescription &desc) override; const egl::Stream::GLTextureDescription &desc) override;
gl::Error generateMipmap() override; gl::Error generateMipmap(ContextImpl *contextImpl) override;
void setBaseLevel(GLuint baseLevel) override; void setBaseLevel(GLuint baseLevel) override;
...@@ -83,7 +90,8 @@ class TextureNULL : public TextureImpl ...@@ -83,7 +90,8 @@ class TextureNULL : public TextureImpl
void syncState(const gl::Texture::DirtyBits &dirtyBits) override; void syncState(const gl::Texture::DirtyBits &dirtyBits) override;
gl::Error setStorageMultisample(GLenum target, gl::Error setStorageMultisample(ContextImpl *contextImpl,
GLenum target,
GLsizei samples, GLsizei samples,
GLint internalformat, GLint internalformat,
const gl::Extents &size, const gl::Extents &size,
......
...@@ -22,7 +22,8 @@ TextureVk::~TextureVk() ...@@ -22,7 +22,8 @@ TextureVk::~TextureVk()
{ {
} }
gl::Error TextureVk::setImage(GLenum target, gl::Error TextureVk::setImage(ContextImpl *contextImpl,
GLenum target,
size_t level, size_t level,
GLenum internalFormat, GLenum internalFormat,
const gl::Extents &size, const gl::Extents &size,
...@@ -35,7 +36,8 @@ gl::Error TextureVk::setImage(GLenum target, ...@@ -35,7 +36,8 @@ gl::Error TextureVk::setImage(GLenum target,
return gl::Error(GL_INVALID_OPERATION); return gl::Error(GL_INVALID_OPERATION);
} }
gl::Error TextureVk::setSubImage(GLenum target, gl::Error TextureVk::setSubImage(ContextImpl *contextImpl,
GLenum target,
size_t level, size_t level,
const gl::Box &area, const gl::Box &area,
GLenum format, GLenum format,
...@@ -47,7 +49,8 @@ gl::Error TextureVk::setSubImage(GLenum target, ...@@ -47,7 +49,8 @@ gl::Error TextureVk::setSubImage(GLenum target,
return gl::Error(GL_INVALID_OPERATION); return gl::Error(GL_INVALID_OPERATION);
} }
gl::Error TextureVk::setCompressedImage(GLenum target, gl::Error TextureVk::setCompressedImage(ContextImpl *contextImpl,
GLenum target,
size_t level, size_t level,
GLenum internalFormat, GLenum internalFormat,
const gl::Extents &size, const gl::Extents &size,
...@@ -59,7 +62,8 @@ gl::Error TextureVk::setCompressedImage(GLenum target, ...@@ -59,7 +62,8 @@ gl::Error TextureVk::setCompressedImage(GLenum target,
return gl::Error(GL_INVALID_OPERATION); return gl::Error(GL_INVALID_OPERATION);
} }
gl::Error TextureVk::setCompressedSubImage(GLenum target, gl::Error TextureVk::setCompressedSubImage(ContextImpl *contextImpl,
GLenum target,
size_t level, size_t level,
const gl::Box &area, const gl::Box &area,
GLenum format, GLenum format,
...@@ -71,7 +75,8 @@ gl::Error TextureVk::setCompressedSubImage(GLenum target, ...@@ -71,7 +75,8 @@ gl::Error TextureVk::setCompressedSubImage(GLenum target,
return gl::Error(GL_INVALID_OPERATION); return gl::Error(GL_INVALID_OPERATION);
} }
gl::Error TextureVk::copyImage(GLenum target, gl::Error TextureVk::copyImage(ContextImpl *contextImpl,
GLenum target,
size_t level, size_t level,
const gl::Rectangle &sourceArea, const gl::Rectangle &sourceArea,
GLenum internalFormat, GLenum internalFormat,
...@@ -81,7 +86,8 @@ gl::Error TextureVk::copyImage(GLenum target, ...@@ -81,7 +86,8 @@ gl::Error TextureVk::copyImage(GLenum target,
return gl::Error(GL_INVALID_OPERATION); return gl::Error(GL_INVALID_OPERATION);
} }
gl::Error TextureVk::copySubImage(GLenum target, gl::Error TextureVk::copySubImage(ContextImpl *contextImpl,
GLenum target,
size_t level, size_t level,
const gl::Offset &destOffset, const gl::Offset &destOffset,
const gl::Rectangle &sourceArea, const gl::Rectangle &sourceArea,
...@@ -91,7 +97,8 @@ gl::Error TextureVk::copySubImage(GLenum target, ...@@ -91,7 +97,8 @@ gl::Error TextureVk::copySubImage(GLenum target,
return gl::Error(GL_INVALID_OPERATION); return gl::Error(GL_INVALID_OPERATION);
} }
gl::Error TextureVk::setStorage(GLenum target, gl::Error TextureVk::setStorage(ContextImpl *contextImpl,
GLenum target,
size_t levels, size_t levels,
GLenum internalFormat, GLenum internalFormat,
const gl::Extents &size) const gl::Extents &size)
...@@ -114,7 +121,7 @@ gl::Error TextureVk::setImageExternal(GLenum target, ...@@ -114,7 +121,7 @@ gl::Error TextureVk::setImageExternal(GLenum target,
return gl::Error(GL_INVALID_OPERATION); return gl::Error(GL_INVALID_OPERATION);
} }
gl::Error TextureVk::generateMipmap() gl::Error TextureVk::generateMipmap(ContextImpl *contextImpl)
{ {
UNIMPLEMENTED(); UNIMPLEMENTED();
return gl::Error(GL_INVALID_OPERATION); return gl::Error(GL_INVALID_OPERATION);
...@@ -147,7 +154,8 @@ void TextureVk::syncState(const gl::Texture::DirtyBits &dirtyBits) ...@@ -147,7 +154,8 @@ void TextureVk::syncState(const gl::Texture::DirtyBits &dirtyBits)
UNIMPLEMENTED(); UNIMPLEMENTED();
} }
gl::Error TextureVk::setStorageMultisample(GLenum target, gl::Error TextureVk::setStorageMultisample(ContextImpl *contextImpl,
GLenum target,
GLsizei samples, GLsizei samples,
GLint internalformat, GLint internalformat,
const gl::Extents &size, const gl::Extents &size,
......
...@@ -21,7 +21,8 @@ class TextureVk : public TextureImpl ...@@ -21,7 +21,8 @@ class TextureVk : public TextureImpl
TextureVk(const gl::TextureState &state); TextureVk(const gl::TextureState &state);
~TextureVk() override; ~TextureVk() override;
gl::Error setImage(GLenum target, gl::Error setImage(ContextImpl *contextImpl,
GLenum target,
size_t level, size_t level,
GLenum internalFormat, GLenum internalFormat,
const gl::Extents &size, const gl::Extents &size,
...@@ -29,7 +30,8 @@ class TextureVk : public TextureImpl ...@@ -29,7 +30,8 @@ class TextureVk : public TextureImpl
GLenum type, GLenum type,
const gl::PixelUnpackState &unpack, const gl::PixelUnpackState &unpack,
const uint8_t *pixels) override; const uint8_t *pixels) override;
gl::Error setSubImage(GLenum target, gl::Error setSubImage(ContextImpl *contextImpl,
GLenum target,
size_t level, size_t level,
const gl::Box &area, const gl::Box &area,
GLenum format, GLenum format,
...@@ -37,14 +39,16 @@ class TextureVk : public TextureImpl ...@@ -37,14 +39,16 @@ class TextureVk : public TextureImpl
const gl::PixelUnpackState &unpack, const gl::PixelUnpackState &unpack,
const uint8_t *pixels) override; const uint8_t *pixels) override;
gl::Error setCompressedImage(GLenum target, gl::Error setCompressedImage(ContextImpl *contextImpl,
GLenum target,
size_t level, size_t level,
GLenum internalFormat, GLenum internalFormat,
const gl::Extents &size, const gl::Extents &size,
const gl::PixelUnpackState &unpack, const gl::PixelUnpackState &unpack,
size_t imageSize, size_t imageSize,
const uint8_t *pixels) override; const uint8_t *pixels) override;
gl::Error setCompressedSubImage(GLenum target, gl::Error setCompressedSubImage(ContextImpl *contextImpl,
GLenum target,
size_t level, size_t level,
const gl::Box &area, const gl::Box &area,
GLenum format, GLenum format,
...@@ -52,18 +56,21 @@ class TextureVk : public TextureImpl ...@@ -52,18 +56,21 @@ class TextureVk : public TextureImpl
size_t imageSize, size_t imageSize,
const uint8_t *pixels) override; const uint8_t *pixels) override;
gl::Error copyImage(GLenum target, gl::Error copyImage(ContextImpl *contextImpl,
GLenum target,
size_t level, size_t level,
const gl::Rectangle &sourceArea, const gl::Rectangle &sourceArea,
GLenum internalFormat, GLenum internalFormat,
const gl::Framebuffer *source) override; const gl::Framebuffer *source) override;
gl::Error copySubImage(GLenum target, gl::Error copySubImage(ContextImpl *contextImpl,
GLenum target,
size_t level, size_t level,
const gl::Offset &destOffset, const gl::Offset &destOffset,
const gl::Rectangle &sourceArea, const gl::Rectangle &sourceArea,
const gl::Framebuffer *source) override; const gl::Framebuffer *source) override;
gl::Error setStorage(GLenum target, gl::Error setStorage(ContextImpl *contextImpl,
GLenum target,
size_t levels, size_t levels,
GLenum internalFormat, GLenum internalFormat,
const gl::Extents &size) override; const gl::Extents &size) override;
...@@ -74,7 +81,7 @@ class TextureVk : public TextureImpl ...@@ -74,7 +81,7 @@ class TextureVk : public TextureImpl
egl::Stream *stream, egl::Stream *stream,
const egl::Stream::GLTextureDescription &desc) override; const egl::Stream::GLTextureDescription &desc) override;
gl::Error generateMipmap() override; gl::Error generateMipmap(ContextImpl *contextImpl) override;
void setBaseLevel(GLuint baseLevel) override; void setBaseLevel(GLuint baseLevel) override;
...@@ -86,7 +93,8 @@ class TextureVk : public TextureImpl ...@@ -86,7 +93,8 @@ class TextureVk : public TextureImpl
void syncState(const gl::Texture::DirtyBits &dirtyBits) override; void syncState(const gl::Texture::DirtyBits &dirtyBits) override;
gl::Error setStorageMultisample(GLenum target, gl::Error setStorageMultisample(ContextImpl *contextImpl,
GLenum target,
GLsizei samples, GLsizei samples,
GLint internalformat, GLint internalformat,
const gl::Extents &size, const gl::Extents &size,
......
...@@ -80,12 +80,12 @@ TEST(ValidationESTest, DrawElementsWithMaxIndexGivesError) ...@@ -80,12 +80,12 @@ TEST(ValidationESTest, DrawElementsWithMaxIndexGivesError)
NiceMock<MockTextureImpl> *textureImpl = new NiceMock<MockTextureImpl>(); NiceMock<MockTextureImpl> *textureImpl = new NiceMock<MockTextureImpl>();
EXPECT_CALL(mockFactory, createTexture(_)).WillOnce(Return(textureImpl)); EXPECT_CALL(mockFactory, createTexture(_)).WillOnce(Return(textureImpl));
EXPECT_CALL(*textureImpl, setStorage(_, _, _, _)).WillOnce(Return(NoError())); EXPECT_CALL(*textureImpl, setStorage(_, _, _, _, _)).WillOnce(Return(NoError()));
EXPECT_CALL(*textureImpl, destructor()).Times(1).RetiresOnSaturation(); EXPECT_CALL(*textureImpl, destructor()).Times(1).RetiresOnSaturation();
Texture *texture = new Texture(&mockFactory, 0, GL_TEXTURE_2D); Texture *texture = new Texture(&mockFactory, 0, GL_TEXTURE_2D);
texture->addRef(); texture->addRef();
texture->setStorage(GL_TEXTURE_2D, 1, GL_RGBA8, Extents(1, 1, 0)); texture->setStorage(nullptr, GL_TEXTURE_2D, 1, GL_RGBA8, Extents(1, 1, 0));
VertexArray *vertexArray = new VertexArray(&mockFactory, 0, 1); VertexArray *vertexArray = new VertexArray(&mockFactory, 0, 1);
Framebuffer *framebuffer = new Framebuffer(caps, &mockFactory, 1); Framebuffer *framebuffer = new Framebuffer(caps, &mockFactory, 1);
......
...@@ -649,7 +649,7 @@ void GL_APIENTRY TexStorage2DEXT(GLenum target, GLsizei levels, GLenum internalf ...@@ -649,7 +649,7 @@ void GL_APIENTRY TexStorage2DEXT(GLenum target, GLsizei levels, GLenum internalf
Extents size(width, height, 1); Extents size(width, height, 1);
Texture *texture = context->getTargetTexture(target); Texture *texture = context->getTargetTexture(target);
Error error = texture->setStorage(target, levels, internalformat, size); Error error = texture->setStorage(context, target, levels, internalformat, size);
if (error.isError()) if (error.isError())
{ {
context->handleError(error); context->handleError(error);
......
...@@ -2513,7 +2513,7 @@ void GL_APIENTRY TexStorage2D(GLenum target, GLsizei levels, GLenum internalform ...@@ -2513,7 +2513,7 @@ void GL_APIENTRY TexStorage2D(GLenum target, GLsizei levels, GLenum internalform
Extents size(width, height, 1); Extents size(width, height, 1);
Texture *texture = context->getTargetTexture(target); Texture *texture = context->getTargetTexture(target);
Error error = texture->setStorage(target, levels, internalformat, size); Error error = texture->setStorage(context, target, levels, internalformat, size);
if (error.isError()) if (error.isError())
{ {
context->handleError(error); context->handleError(error);
...@@ -2545,7 +2545,7 @@ void GL_APIENTRY TexStorage3D(GLenum target, GLsizei levels, GLenum internalform ...@@ -2545,7 +2545,7 @@ void GL_APIENTRY TexStorage3D(GLenum target, GLsizei levels, GLenum internalform
Extents size(width, height, depth); Extents size(width, height, depth);
Texture *texture = context->getTargetTexture(target); Texture *texture = context->getTargetTexture(target);
Error error = texture->setStorage(target, levels, internalformat, size); Error error = texture->setStorage(context, target, levels, internalformat, size);
if (error.isError()) if (error.isError())
{ {
context->handleError(error); context->handleError(error);
......
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