Commit 666818ea by Jamie Madill Committed by Commit Bot

Use angle::Result in front-end (Part 8)

Refactors the gl::Texture class and a few related methods. Also reduces binary size by up to 4k. Bug: angleproject:2491 Change-Id: Ib9a69d7f507b0dce35abb17b90532f812bf43214 Reviewed-on: https://chromium-review.googlesource.com/c/1291845 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarYuly Novikov <ynovikov@chromium.org>
parent f3acb8c1
......@@ -108,10 +108,10 @@ std::vector<gl::Path *> GatherPaths(gl::PathManager &resourceManager,
}
template <typename T>
gl::Error GetQueryObjectParameter(const gl::Context *context,
gl::Query *query,
GLenum pname,
T *params)
angle::Result GetQueryObjectParameter(const gl::Context *context,
gl::Query *query,
GLenum pname,
T *params)
{
ASSERT(query != nullptr);
......@@ -122,16 +122,13 @@ gl::Error GetQueryObjectParameter(const gl::Context *context,
case GL_QUERY_RESULT_AVAILABLE_EXT:
{
bool available;
gl::Error error = query->isResultAvailable(context, &available);
if (!error.isError())
{
*params = gl::CastFromStateValue<T>(pname, static_cast<GLuint>(available));
}
return error;
ANGLE_TRY(query->isResultAvailable(context, &available));
*params = gl::CastFromStateValue<T>(pname, static_cast<GLuint>(available));
return angle::Result::Continue();
}
default:
UNREACHABLE();
return gl::InternalError() << "Unreachable Error";
return angle::Result::Stop();
}
}
......
......@@ -62,7 +62,6 @@ class ANGLE_NO_DISCARD Error final
inline ~Error() = default;
// automatic error type conversion
inline Error(egl::Error &&eglErr);
inline Error(egl::Error eglErr);
inline Error &operator=(const Error &other);
......
......@@ -38,13 +38,6 @@ Error::Error(Error &&other)
}
// automatic error type conversion
Error::Error(egl::Error &&eglErr)
: mCode(GL_INVALID_OPERATION),
mID(0),
mMessage(std::move(eglErr.mMessage))
{
}
Error::Error(egl::Error eglErr)
: mCode(GL_INVALID_OPERATION),
mID(0),
......
......@@ -72,7 +72,7 @@ void ImageSibling::setTargetImage(const gl::Context *context, egl::Image *imageT
imageTarget->addTargetSibling(this);
}
gl::Error ImageSibling::orphanImages(const gl::Context *context)
angle::Result ImageSibling::orphanImages(const gl::Context *context)
{
if (mTargetOf.get() != nullptr)
{
......@@ -91,7 +91,7 @@ gl::Error ImageSibling::orphanImages(const gl::Context *context)
mSourcesOf.clear();
}
return gl::NoError();
return angle::Result::Continue();
}
void ImageSibling::addImageSource(egl::Image *imageSource)
......@@ -273,7 +273,7 @@ void Image::addTargetSibling(ImageSibling *sibling)
mState.targets.insert(sibling);
}
gl::Error Image::orphanSibling(const gl::Context *context, ImageSibling *sibling)
angle::Result Image::orphanSibling(const gl::Context *context, ImageSibling *sibling)
{
ASSERT(sibling != nullptr);
......@@ -296,7 +296,7 @@ gl::Error Image::orphanSibling(const gl::Context *context, ImageSibling *sibling
mState.targets.erase(sibling);
}
return gl::NoError();
return angle::Result::Continue();
}
const gl::Format &Image::getFormat() const
......
......@@ -53,7 +53,7 @@ class ImageSibling : public gl::FramebufferAttachmentObject
void setTargetImage(const gl::Context *context, egl::Image *imageTarget);
// Orphan all EGL image sources and targets
gl::Error orphanImages(const gl::Context *context);
angle::Result orphanImages(const gl::Context *context);
private:
friend class Image;
......@@ -158,7 +158,7 @@ class Image final : public RefCountObject, public LabeledObject
// Called from ImageSibling only to notify the image that a sibling (source or target) has
// been respecified and state tracking should be updated.
gl::Error orphanSibling(const gl::Context *context, ImageSibling *sibling);
angle::Result orphanSibling(const gl::Context *context, ImageSibling *sibling);
ImageState mState;
rx::ImageImpl *mImplementation;
......
......@@ -76,7 +76,7 @@ Renderbuffer::Renderbuffer(rx::GLImplFactory *implFactory, GLuint id)
void Renderbuffer::onDestroy(const Context *context)
{
ANGLE_SWALLOW_ERR(orphanImages(context));
(void)(orphanImages(context));
if (mImplementation)
{
......@@ -103,7 +103,7 @@ angle::Result Renderbuffer::setStorage(const Context *context,
size_t width,
size_t height)
{
ANGLE_TRY_HANDLE(context, orphanImages(context));
ANGLE_TRY(orphanImages(context));
ANGLE_TRY(mImplementation->setStorage(context, internalformat, width, height));
mState.update(static_cast<GLsizei>(width), static_cast<GLsizei>(height), Format(internalformat),
......@@ -119,7 +119,7 @@ angle::Result Renderbuffer::setStorageMultisample(const Context *context,
size_t width,
size_t height)
{
ANGLE_TRY_HANDLE(context, orphanImages(context));
ANGLE_TRY(orphanImages(context));
ANGLE_TRY(
mImplementation->setStorageMultisample(context, samples, internalformat, width, height));
......@@ -132,7 +132,7 @@ angle::Result Renderbuffer::setStorageMultisample(const Context *context,
angle::Result Renderbuffer::setStorageEGLImageTarget(const Context *context, egl::Image *image)
{
ANGLE_TRY_HANDLE(context, orphanImages(context));
ANGLE_TRY(orphanImages(context));
ANGLE_TRY(mImplementation->setStorageEGLImageTarget(context, image));
setTargetImage(context, image);
......
......@@ -203,8 +203,8 @@ Error Stream::consumerAcquire(const gl::Context *context)
{
if (mPlanes[i].texture != nullptr)
{
ANGLE_TRY(mPlanes[i].texture->acquireImageFromStream(
context, mProducerImplementation->getGLFrameDescription(i)));
ANGLE_TRY(gl::Error(mPlanes[i].texture->acquireImageFromStream(
context, mProducerImplementation->getGLFrameDescription(i))));
}
}
......@@ -224,7 +224,7 @@ Error Stream::consumerRelease(const gl::Context *context)
{
if (mPlanes[i].texture != nullptr)
{
ANGLE_TRY(mPlanes[i].texture->releaseImageFromStream(context));
ANGLE_TRY(gl::Error(mPlanes[i].texture->releaseImageFromStream(context)));
}
}
......
......@@ -47,7 +47,7 @@ class ImageImpl : angle::NonCopyable
virtual ~ImageImpl() {}
virtual egl::Error initialize(const egl::Display *display) = 0;
virtual gl::Error orphan(const gl::Context *context, egl::ImageSibling *sibling) = 0;
virtual angle::Result orphan(const gl::Context *context, egl::ImageSibling *sibling) = 0;
protected:
const egl::ImageState &mState;
......
......@@ -21,7 +21,7 @@ class MockImageImpl : public ImageImpl
MockImageImpl(const egl::ImageState &state) : ImageImpl(state) {}
virtual ~MockImageImpl() { destructor(); }
MOCK_METHOD1(initialize, egl::Error(const egl::Display *));
MOCK_METHOD2(orphan, gl::Error(const gl::Context *, egl::ImageSibling *));
MOCK_METHOD2(orphan, angle::Result(const gl::Context *, egl::ImageSibling *));
MOCK_METHOD0(destructor, void());
};
} // namespace rx
......
......@@ -22,11 +22,11 @@ class PathImpl : angle::NonCopyable
public:
virtual ~PathImpl() {}
virtual gl::Error setCommands(GLsizei numCommands,
const GLubyte *commands,
GLsizei numCoords,
GLenum coordType,
const void *coords) = 0;
virtual angle::Result setCommands(GLsizei numCommands,
const GLubyte *commands,
GLsizei numCoords,
GLenum coordType,
const void *coords) = 0;
virtual void setPathParameter(GLenum pname, GLfloat value) = 0;
};
......
......@@ -10,7 +10,6 @@
namespace rx
{
TextureImpl::TextureImpl(const gl::TextureState &state) : mState(state)
{
}
......@@ -19,73 +18,72 @@ TextureImpl::~TextureImpl()
{
}
gl::Error TextureImpl::onDestroy(const gl::Context *context)
void TextureImpl::onDestroy(const gl::Context *context)
{
return gl::NoError();
}
gl::Error TextureImpl::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)
angle::Result TextureImpl::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)
{
UNREACHABLE();
return gl::InternalError() << "CHROMIUM_copy_texture exposed but not implemented.";
return angle::Result::Stop();
}
gl::Error TextureImpl::copySubTexture(const gl::Context *context,
const gl::ImageIndex &index,
const gl::Offset &destOffset,
size_t sourceLevel,
const gl::Box &sourceBox,
bool unpackFlipY,
bool unpackPremultiplyAlpha,
bool unpackUnmultiplyAlpha,
const gl::Texture *source)
angle::Result TextureImpl::copySubTexture(const gl::Context *context,
const gl::ImageIndex &index,
const gl::Offset &destOffset,
size_t sourceLevel,
const gl::Box &sourceBox,
bool unpackFlipY,
bool unpackPremultiplyAlpha,
bool unpackUnmultiplyAlpha,
const gl::Texture *source)
{
UNREACHABLE();
return gl::InternalError() << "CHROMIUM_copy_texture exposed but not implemented.";
return angle::Result::Stop();
}
gl::Error TextureImpl::copyCompressedTexture(const gl::Context *context, const gl::Texture *source)
angle::Result TextureImpl::copyCompressedTexture(const gl::Context *context,
const gl::Texture *source)
{
UNREACHABLE();
return gl::InternalError() << "CHROMIUM_copy_compressed_texture exposed but not implemented.";
return angle::Result::Stop();
}
gl::Error TextureImpl::copy3DTexture(const gl::Context *context,
gl::TextureTarget target,
GLenum internalFormat,
GLenum type,
size_t sourceLevel,
size_t destLevel,
bool unpackFlipY,
bool unpackPremultiplyAlpha,
bool unpackUnmultiplyAlpha,
const gl::Texture *source)
angle::Result TextureImpl::copy3DTexture(const gl::Context *context,
gl::TextureTarget target,
GLenum internalFormat,
GLenum type,
size_t sourceLevel,
size_t destLevel,
bool unpackFlipY,
bool unpackPremultiplyAlpha,
bool unpackUnmultiplyAlpha,
const gl::Texture *source)
{
UNREACHABLE();
return gl::InternalError() << "ANGLE_copy_texture_3d exposed but not implemented.";
return angle::Result::Stop();
}
gl::Error TextureImpl::copy3DSubTexture(const gl::Context *context,
const gl::TextureTarget target,
const gl::Offset &destOffset,
size_t sourceLevel,
size_t destLevel,
const gl::Box &srcBox,
bool unpackFlipY,
bool unpackPremultiplyAlpha,
bool unpackUnmultiplyAlpha,
const gl::Texture *source)
angle::Result TextureImpl::copy3DSubTexture(const gl::Context *context,
const gl::TextureTarget target,
const gl::Offset &destOffset,
size_t sourceLevel,
size_t destLevel,
const gl::Box &srcBox,
bool unpackFlipY,
bool unpackPremultiplyAlpha,
bool unpackUnmultiplyAlpha,
const gl::Texture *source)
{
UNREACHABLE();
return gl::InternalError() << "ANGLE_copy_texture_3d exposed but not implemented.";
return angle::Result::Stop();
}
} // namespace rx
......@@ -22,84 +22,86 @@ class MockTextureImpl : public TextureImpl
MockTextureImpl() : TextureImpl(mMockState), mMockState(gl::TextureType::_2D) {}
virtual ~MockTextureImpl() { destructor(); }
MOCK_METHOD8(setImage,
gl::Error(const gl::Context *,
const gl::ImageIndex &,
GLenum,
const gl::Extents &,
GLenum,
GLenum,
const gl::PixelUnpackState &,
const uint8_t *));
angle::Result(const gl::Context *,
const gl::ImageIndex &,
GLenum,
const gl::Extents &,
GLenum,
GLenum,
const gl::PixelUnpackState &,
const uint8_t *));
MOCK_METHOD8(setSubImage,
gl::Error(const gl::Context *,
const gl::ImageIndex &,
const gl::Box &,
GLenum,
GLenum,
const gl::PixelUnpackState &,
gl::Buffer *,
const uint8_t *));
angle::Result(const gl::Context *,
const gl::ImageIndex &,
const gl::Box &,
GLenum,
GLenum,
const gl::PixelUnpackState &,
gl::Buffer *,
const uint8_t *));
MOCK_METHOD7(setCompressedImage,
gl::Error(const gl::Context *,
const gl::ImageIndex &,
GLenum,
const gl::Extents &,
const gl::PixelUnpackState &,
size_t,
const uint8_t *));
angle::Result(const gl::Context *,
const gl::ImageIndex &,
GLenum,
const gl::Extents &,
const gl::PixelUnpackState &,
size_t,
const uint8_t *));
MOCK_METHOD7(setCompressedSubImage,
gl::Error(const gl::Context *,
const gl::ImageIndex &,
const gl::Box &,
GLenum,
const gl::PixelUnpackState &,
size_t,
const uint8_t *));
angle::Result(const gl::Context *,
const gl::ImageIndex &,
const gl::Box &,
GLenum,
const gl::PixelUnpackState &,
size_t,
const uint8_t *));
MOCK_METHOD5(copyImage,
gl::Error(const gl::Context *,
const gl::ImageIndex &,
const gl::Rectangle &,
GLenum,
gl::Framebuffer *));
angle::Result(const gl::Context *,
const gl::ImageIndex &,
const gl::Rectangle &,
GLenum,
gl::Framebuffer *));
MOCK_METHOD5(copySubImage,
gl::Error(const gl::Context *,
const gl::ImageIndex &,
const gl::Offset &,
const gl::Rectangle &,
gl::Framebuffer *));
angle::Result(const gl::Context *,
const gl::ImageIndex &,
const gl::Offset &,
const gl::Rectangle &,
gl::Framebuffer *));
MOCK_METHOD9(copyTexture,
gl::Error(const gl::Context *,
const gl::ImageIndex &,
GLenum,
GLenum,
size_t,
bool,
bool,
bool,
const gl::Texture *));
angle::Result(const gl::Context *,
const gl::ImageIndex &,
GLenum,
GLenum,
size_t,
bool,
bool,
bool,
const gl::Texture *));
MOCK_METHOD9(copySubTexture,
gl::Error(const gl::Context *,
const gl::ImageIndex &,
const gl::Offset &,
size_t,
const gl::Box &,
bool,
bool,
bool,
const gl::Texture *));
MOCK_METHOD2(copyCompressedTexture, gl::Error(const gl::Context *, const gl::Texture *source));
angle::Result(const gl::Context *,
const gl::ImageIndex &,
const gl::Offset &,
size_t,
const gl::Box &,
bool,
bool,
bool,
const gl::Texture *));
MOCK_METHOD2(copyCompressedTexture,
angle::Result(const gl::Context *, const gl::Texture *source));
MOCK_METHOD5(
setStorage,
gl::Error(const gl::Context *, gl::TextureType, size_t, GLenum, const gl::Extents &));
angle::Result(const gl::Context *, gl::TextureType, size_t, GLenum, const gl::Extents &));
MOCK_METHOD4(setImageExternal,
gl::Error(const gl::Context *,
gl::TextureType,
egl::Stream *,
const egl::Stream::GLTextureDescription &));
MOCK_METHOD3(setEGLImageTarget, gl::Error(const gl::Context *, gl::TextureType, egl::Image *));
MOCK_METHOD1(generateMipmap, gl::Error(const gl::Context *));
MOCK_METHOD2(bindTexImage, gl::Error(const gl::Context *, egl::Surface *));
MOCK_METHOD1(releaseTexImage, gl::Error(const gl::Context *));
angle::Result(const gl::Context *,
gl::TextureType,
egl::Stream *,
const egl::Stream::GLTextureDescription &));
MOCK_METHOD3(setEGLImageTarget,
angle::Result(const gl::Context *, gl::TextureType, egl::Image *));
MOCK_METHOD1(generateMipmap, angle::Result(const gl::Context *));
MOCK_METHOD2(bindTexImage, angle::Result(const gl::Context *, egl::Surface *));
MOCK_METHOD1(releaseTexImage, angle::Result(const gl::Context *));
MOCK_METHOD4(getAttachmentRenderTarget,
angle::Result(const gl::Context *,
......@@ -107,11 +109,15 @@ class MockTextureImpl : public TextureImpl
const gl::ImageIndex &,
FramebufferAttachmentRenderTarget **));
MOCK_METHOD6(
setStorageMultisample,
gl::Error(const gl::Context *, gl::TextureType, GLsizei, GLint, const gl::Extents &, bool));
MOCK_METHOD6(setStorageMultisample,
angle::Result(const gl::Context *,
gl::TextureType,
GLsizei,
GLint,
const gl::Extents &,
bool));
MOCK_METHOD2(setBaseLevel, gl::Error(const gl::Context *, GLuint));
MOCK_METHOD2(setBaseLevel, angle::Result(const gl::Context *, GLuint));
MOCK_METHOD2(syncState, angle::Result(const gl::Context *, const gl::Texture::DirtyBits &));
......
......@@ -43,14 +43,14 @@ egl::Error EGLImageD3D::initialize(const egl::Display *display)
return egl::NoError();
}
gl::Error EGLImageD3D::orphan(const gl::Context *context, egl::ImageSibling *sibling)
angle::Result EGLImageD3D::orphan(const gl::Context *context, egl::ImageSibling *sibling)
{
if (sibling == mState.source)
{
ANGLE_TRY(copyToLocalRendertarget(context));
}
return gl::NoError();
return angle::Result::Continue();
}
angle::Result EGLImageD3D::getRenderTarget(const gl::Context *context,
......@@ -71,7 +71,7 @@ angle::Result EGLImageD3D::getRenderTarget(const gl::Context *context,
return angle::Result::Continue();
}
gl::Error EGLImageD3D::copyToLocalRendertarget(const gl::Context *context)
angle::Result EGLImageD3D::copyToLocalRendertarget(const gl::Context *context)
{
ASSERT(mState.source != nullptr);
ASSERT(mRenderTarget == nullptr);
......
......@@ -40,12 +40,12 @@ class EGLImageD3D final : public ImageImpl
egl::Error initialize(const egl::Display *display) override;
gl::Error orphan(const gl::Context *context, egl::ImageSibling *sibling) override;
angle::Result orphan(const gl::Context *context, egl::ImageSibling *sibling) override;
angle::Result getRenderTarget(const gl::Context *context, RenderTargetD3D **outRT) const;
private:
gl::Error copyToLocalRendertarget(const gl::Context *context);
angle::Result copyToLocalRendertarget(const gl::Context *context);
RendererD3D *mRenderer;
RenderTargetD3D *mRenderTarget;
......
......@@ -204,8 +204,8 @@ GLenum FramebufferD3D::getImplementationColorReadFormat(const gl::Context *conte
}
RenderTargetD3D *attachmentRenderTarget = nullptr;
gl::Error error = readAttachment->getRenderTarget(context, &attachmentRenderTarget);
if (error.isError())
angle::Result error = readAttachment->getRenderTarget(context, &attachmentRenderTarget);
if (error != angle::Result::Continue())
{
return GL_NONE;
}
......@@ -227,8 +227,8 @@ GLenum FramebufferD3D::getImplementationColorReadType(const gl::Context *context
}
RenderTargetD3D *attachmentRenderTarget = nullptr;
gl::Error error = readAttachment->getRenderTarget(context, &attachmentRenderTarget);
if (error.isError())
angle::Result error = readAttachment->getRenderTarget(context, &attachmentRenderTarget);
if (error != angle::Result::Continue())
{
return GL_NONE;
}
......
......@@ -603,8 +603,8 @@ angle::Result Context11::getIncompleteTexture(const gl::Context *context,
return angle::Result::Continue();
}
gl::Error Context11::initializeMultisampleTextureToBlack(const gl::Context *context,
gl::Texture *glTexture)
angle::Result Context11::initializeMultisampleTextureToBlack(const gl::Context *context,
gl::Texture *glTexture)
{
ASSERT(glTexture->getType() == gl::TextureType::_2DMultisample);
TextureD3D *textureD3D = GetImplAs<TextureD3D>(glTexture);
......
......@@ -158,8 +158,8 @@ class Context11 : public ContextD3D, public MultisampleTextureInitializer
gl::TextureType type,
gl::Texture **textureOut);
gl::Error initializeMultisampleTextureToBlack(const gl::Context *context,
gl::Texture *glTexture) override;
angle::Result initializeMultisampleTextureToBlack(const gl::Context *context,
gl::Texture *glTexture) override;
void handleResult(HRESULT hr,
const char *message,
......
......@@ -26,13 +26,13 @@ class ImageGL : public ImageImpl
// TextureGL does not have access to all the parameters needed to implement
// glEGLImageTargetTexture2DOES or glEGLImageTargetRenderbufferStorageOES. This allows the Image
// to implement these functions because it holds the native EGLimage or emulated object.
virtual gl::Error setTexture2D(const gl::Context *context,
gl::TextureType type,
TextureGL *texture,
GLenum *outInternalFormat) = 0;
virtual gl::Error setRenderbufferStorage(const gl::Context *context,
RenderbufferGL *renderbuffer,
GLenum *outInternalFormat) = 0;
virtual angle::Result setTexture2D(const gl::Context *context,
gl::TextureType type,
TextureGL *texture,
GLenum *outInternalFormat) = 0;
virtual angle::Result setRenderbufferStorage(const gl::Context *context,
RenderbufferGL *renderbuffer,
GLenum *outInternalFormat) = 0;
};
} // namespace rx
......
......@@ -11,7 +11,6 @@
namespace rx
{
PathGL::PathGL(const FunctionsGL *functions, GLuint path) : mFunctions(functions), mPathID(path)
{
}
......@@ -20,19 +19,18 @@ PathGL::~PathGL()
{
}
gl::Error PathGL::setCommands(GLsizei numCommands,
const GLubyte *commands,
GLsizei numCoords,
GLenum coordType,
const void *coords)
angle::Result PathGL::setCommands(GLsizei numCommands,
const GLubyte *commands,
GLsizei numCoords,
GLenum coordType,
const void *coords)
{
mFunctions->pathCommandsNV(mPathID, numCommands, commands, numCoords, coordType, coords);
return gl::NoError();
return angle::Result::Continue();
}
void PathGL::setPathParameter(GLenum pname, GLfloat value)
{
mFunctions->pathParameterfNV(mPathID, pname, value);
}
} // rx
} // namespace rx
......@@ -23,11 +23,11 @@ class PathGL : public PathImpl
PathGL(const FunctionsGL *functions, GLuint path);
~PathGL() override;
gl::Error setCommands(GLsizei numCommands,
const GLubyte *commands,
GLsizei numCoords,
GLenum coordType,
const void *coords) override;
angle::Result setCommands(GLsizei numCommands,
const GLubyte *commands,
GLsizei numCoords,
GLenum coordType,
const void *coords) override;
void setPathParameter(GLenum pname, GLfloat value) override;
......
......@@ -98,16 +98,16 @@ egl::Error ImageEGL::initialize(const egl::Display *display)
return egl::NoError();
}
gl::Error ImageEGL::orphan(const gl::Context *context, egl::ImageSibling *sibling)
angle::Result ImageEGL::orphan(const gl::Context *context, egl::ImageSibling *sibling)
{
// Nothing to do, the native EGLImage will orphan automatically.
return gl::NoError();
return angle::Result::Continue();
}
gl::Error ImageEGL::setTexture2D(const gl::Context *context,
gl::TextureType type,
TextureGL *texture,
GLenum *outInternalFormat)
angle::Result ImageEGL::setTexture2D(const gl::Context *context,
gl::TextureType type,
TextureGL *texture,
GLenum *outInternalFormat)
{
const FunctionsGL *functionsGL = GetFunctionsGL(context);
StateManagerGL *stateManager = GetStateManagerGL(context);
......@@ -119,12 +119,12 @@ gl::Error ImageEGL::setTexture2D(const gl::Context *context,
functionsGL->eGLImageTargetTexture2DOES(ToGLenum(type), mImage);
*outInternalFormat = mNativeInternalFormat;
return gl::NoError();
return angle::Result::Continue();
}
gl::Error ImageEGL::setRenderbufferStorage(const gl::Context *context,
RenderbufferGL *renderbuffer,
GLenum *outInternalFormat)
angle::Result ImageEGL::setRenderbufferStorage(const gl::Context *context,
RenderbufferGL *renderbuffer,
GLenum *outInternalFormat)
{
const FunctionsGL *functionsGL = GetFunctionsGL(context);
StateManagerGL *stateManager = GetStateManagerGL(context);
......@@ -136,7 +136,7 @@ gl::Error ImageEGL::setRenderbufferStorage(const gl::Context *context,
functionsGL->eGLImageTargetRenderbufferStorageOES(GL_RENDERBUFFER, mImage);
*outInternalFormat = mNativeInternalFormat;
return gl::NoError();
return angle::Result::Continue();
}
} // namespace rx
......@@ -33,15 +33,15 @@ class ImageEGL final : public ImageGL
egl::Error initialize(const egl::Display *display) override;
gl::Error orphan(const gl::Context *context, egl::ImageSibling *sibling) override;
gl::Error setTexture2D(const gl::Context *context,
gl::TextureType type,
TextureGL *texture,
GLenum *outInternalFormat) override;
gl::Error setRenderbufferStorage(const gl::Context *context,
RenderbufferGL *renderbuffer,
GLenum *outInternalFormat) override;
angle::Result orphan(const gl::Context *context, egl::ImageSibling *sibling) override;
angle::Result setTexture2D(const gl::Context *context,
gl::TextureType type,
TextureGL *texture,
GLenum *outInternalFormat) override;
angle::Result setRenderbufferStorage(const gl::Context *context,
RenderbufferGL *renderbuffer,
GLenum *outInternalFormat) override;
private:
const FunctionsEGL *mEGL;
......
......@@ -27,9 +27,9 @@ egl::Error ImageNULL::initialize(const egl::Display *display)
return egl::NoError();
}
gl::Error ImageNULL::orphan(const gl::Context *context, egl::ImageSibling *sibling)
angle::Result ImageNULL::orphan(const gl::Context *context, egl::ImageSibling *sibling)
{
return gl::NoError();
return angle::Result::Continue();
}
} // namespace rx
......@@ -22,7 +22,7 @@ class ImageNULL : public ImageImpl
~ImageNULL() override;
egl::Error initialize(const egl::Display *display) override;
gl::Error orphan(const gl::Context *context, egl::ImageSibling *sibling) override;
angle::Result orphan(const gl::Context *context, egl::ImageSibling *sibling) override;
};
} // namespace rx
......
......@@ -13,7 +13,6 @@
namespace rx
{
PathNULL::PathNULL() : PathImpl()
{
}
......@@ -22,19 +21,16 @@ PathNULL::~PathNULL()
{
}
gl::Error PathNULL::setCommands(GLsizei numCommands,
const GLubyte *commands,
GLsizei numCoords,
GLenum coordType,
const void *coords)
angle::Result PathNULL::setCommands(GLsizei numCommands,
const GLubyte *commands,
GLsizei numCoords,
GLenum coordType,
const void *coords)
{
UNIMPLEMENTED();
return gl::InternalError();
return angle::Result::Continue();
}
void PathNULL::setPathParameter(GLenum pname, GLfloat value)
{
UNIMPLEMENTED();
}
} // namespace rx
......@@ -21,11 +21,11 @@ class PathNULL : public PathImpl
PathNULL();
~PathNULL() override;
gl::Error setCommands(GLsizei numCommands,
const GLubyte *commands,
GLsizei numCoords,
GLenum coordType,
const void *coords) override;
angle::Result setCommands(GLsizei numCommands,
const GLubyte *commands,
GLsizei numCoords,
GLenum coordType,
const void *coords) override;
void setPathParameter(GLenum pname, GLfloat value) override;
};
......
......@@ -22,114 +22,114 @@ TextureNULL::~TextureNULL()
{
}
gl::Error TextureNULL::setImage(const gl::Context *context,
const gl::ImageIndex &index,
GLenum internalFormat,
const gl::Extents &size,
GLenum format,
GLenum type,
const gl::PixelUnpackState &unpack,
const uint8_t *pixels)
angle::Result TextureNULL::setImage(const gl::Context *context,
const gl::ImageIndex &index,
GLenum internalFormat,
const gl::Extents &size,
GLenum format,
GLenum type,
const gl::PixelUnpackState &unpack,
const uint8_t *pixels)
{
// TODO(geofflang): Read all incoming pixel data (maybe hash it?) to make sure we don't read out
// of bounds due to validation bugs.
return gl::NoError();
return angle::Result::Continue();
}
gl::Error TextureNULL::setSubImage(const gl::Context *context,
const gl::ImageIndex &index,
const gl::Box &area,
GLenum format,
GLenum type,
const gl::PixelUnpackState &unpack,
gl::Buffer *unpackBuffer,
const uint8_t *pixels)
angle::Result TextureNULL::setSubImage(const gl::Context *context,
const gl::ImageIndex &index,
const gl::Box &area,
GLenum format,
GLenum type,
const gl::PixelUnpackState &unpack,
gl::Buffer *unpackBuffer,
const uint8_t *pixels)
{
return gl::NoError();
return angle::Result::Continue();
}
gl::Error TextureNULL::setCompressedImage(const gl::Context *context,
const gl::ImageIndex &index,
GLenum internalFormat,
const gl::Extents &size,
const gl::PixelUnpackState &unpack,
size_t imageSize,
const uint8_t *pixels)
angle::Result TextureNULL::setCompressedImage(const gl::Context *context,
const gl::ImageIndex &index,
GLenum internalFormat,
const gl::Extents &size,
const gl::PixelUnpackState &unpack,
size_t imageSize,
const uint8_t *pixels)
{
return gl::NoError();
return angle::Result::Continue();
}
gl::Error TextureNULL::setCompressedSubImage(const gl::Context *context,
const gl::ImageIndex &index,
const gl::Box &area,
GLenum format,
const gl::PixelUnpackState &unpack,
size_t imageSize,
const uint8_t *pixels)
angle::Result TextureNULL::setCompressedSubImage(const gl::Context *context,
const gl::ImageIndex &index,
const gl::Box &area,
GLenum format,
const gl::PixelUnpackState &unpack,
size_t imageSize,
const uint8_t *pixels)
{
return gl::NoError();
return angle::Result::Continue();
}
gl::Error TextureNULL::copyImage(const gl::Context *context,
const gl::ImageIndex &index,
const gl::Rectangle &sourceArea,
GLenum internalFormat,
gl::Framebuffer *source)
angle::Result TextureNULL::copyImage(const gl::Context *context,
const gl::ImageIndex &index,
const gl::Rectangle &sourceArea,
GLenum internalFormat,
gl::Framebuffer *source)
{
return gl::NoError();
return angle::Result::Continue();
}
gl::Error TextureNULL::copySubImage(const gl::Context *context,
const gl::ImageIndex &index,
const gl::Offset &destOffset,
const gl::Rectangle &sourceArea,
gl::Framebuffer *source)
angle::Result TextureNULL::copySubImage(const gl::Context *context,
const gl::ImageIndex &index,
const gl::Offset &destOffset,
const gl::Rectangle &sourceArea,
gl::Framebuffer *source)
{
return gl::NoError();
return angle::Result::Continue();
}
gl::Error TextureNULL::setStorage(const gl::Context *context,
gl::TextureType type,
size_t levels,
GLenum internalFormat,
const gl::Extents &size)
angle::Result TextureNULL::setStorage(const gl::Context *context,
gl::TextureType type,
size_t levels,
GLenum internalFormat,
const gl::Extents &size)
{
return gl::NoError();
return angle::Result::Continue();
}
gl::Error TextureNULL::setEGLImageTarget(const gl::Context *context,
gl::TextureType type,
egl::Image *image)
angle::Result TextureNULL::setEGLImageTarget(const gl::Context *context,
gl::TextureType type,
egl::Image *image)
{
return gl::NoError();
return angle::Result::Continue();
}
gl::Error TextureNULL::setImageExternal(const gl::Context *context,
gl::TextureType type,
egl::Stream *stream,
const egl::Stream::GLTextureDescription &desc)
angle::Result TextureNULL::setImageExternal(const gl::Context *context,
gl::TextureType type,
egl::Stream *stream,
const egl::Stream::GLTextureDescription &desc)
{
return gl::NoError();
return angle::Result::Continue();
}
gl::Error TextureNULL::generateMipmap(const gl::Context *context)
angle::Result TextureNULL::generateMipmap(const gl::Context *context)
{
return gl::NoError();
return angle::Result::Continue();
}
gl::Error TextureNULL::setBaseLevel(const gl::Context *context, GLuint baseLevel)
angle::Result TextureNULL::setBaseLevel(const gl::Context *context, GLuint baseLevel)
{
return gl::NoError();
return angle::Result::Continue();
}
gl::Error TextureNULL::bindTexImage(const gl::Context *context, egl::Surface *surface)
angle::Result TextureNULL::bindTexImage(const gl::Context *context, egl::Surface *surface)
{
return gl::NoError();
return angle::Result::Continue();
}
gl::Error TextureNULL::releaseTexImage(const gl::Context *context)
angle::Result TextureNULL::releaseTexImage(const gl::Context *context)
{
return gl::NoError();
return angle::Result::Continue();
}
angle::Result TextureNULL::syncState(const gl::Context *context,
......@@ -138,14 +138,14 @@ angle::Result TextureNULL::syncState(const gl::Context *context,
return angle::Result::Continue();
}
gl::Error TextureNULL::setStorageMultisample(const gl::Context *context,
gl::TextureType type,
GLsizei samples,
GLint internalformat,
const gl::Extents &size,
bool fixedSampleLocations)
angle::Result TextureNULL::setStorageMultisample(const gl::Context *context,
gl::TextureType type,
GLsizei samples,
GLint internalformat,
const gl::Extents &size,
bool fixedSampleLocations)
{
return gl::NoError();
return angle::Result::Continue();
}
angle::Result TextureNULL::initializeContents(const gl::Context *context,
......
......@@ -21,80 +21,80 @@ class TextureNULL : public TextureImpl
TextureNULL(const gl::TextureState &state);
~TextureNULL() override;
gl::Error setImage(const gl::Context *context,
const gl::ImageIndex &index,
GLenum internalFormat,
const gl::Extents &size,
GLenum format,
GLenum type,
const gl::PixelUnpackState &unpack,
const uint8_t *pixels) override;
gl::Error setSubImage(const gl::Context *context,
const gl::ImageIndex &index,
const gl::Box &area,
GLenum format,
GLenum type,
const gl::PixelUnpackState &unpack,
gl::Buffer *unpackBuffer,
const uint8_t *pixels) override;
gl::Error setCompressedImage(const gl::Context *context,
const gl::ImageIndex &index,
GLenum internalFormat,
const gl::Extents &size,
const gl::PixelUnpackState &unpack,
size_t imageSize,
const uint8_t *pixels) override;
gl::Error setCompressedSubImage(const gl::Context *context,
const gl::ImageIndex &index,
const gl::Box &area,
GLenum format,
const gl::PixelUnpackState &unpack,
size_t imageSize,
const uint8_t *pixels) override;
gl::Error copyImage(const gl::Context *context,
const gl::ImageIndex &index,
const gl::Rectangle &sourceArea,
GLenum internalFormat,
gl::Framebuffer *source) override;
gl::Error copySubImage(const gl::Context *context,
angle::Result setImage(const gl::Context *context,
const gl::ImageIndex &index,
const gl::Offset &destOffset,
const gl::Rectangle &sourceArea,
gl::Framebuffer *source) override;
gl::Error setStorage(const gl::Context *context,
gl::TextureType type,
size_t levels,
GLenum internalFormat,
const gl::Extents &size) override;
gl::Error setEGLImageTarget(const gl::Context *context,
gl::TextureType type,
egl::Image *image) override;
GLenum internalFormat,
const gl::Extents &size,
GLenum format,
GLenum type,
const gl::PixelUnpackState &unpack,
const uint8_t *pixels) override;
angle::Result setSubImage(const gl::Context *context,
const gl::ImageIndex &index,
const gl::Box &area,
GLenum format,
GLenum type,
const gl::PixelUnpackState &unpack,
gl::Buffer *unpackBuffer,
const uint8_t *pixels) override;
angle::Result setCompressedImage(const gl::Context *context,
const gl::ImageIndex &index,
GLenum internalFormat,
const gl::Extents &size,
const gl::PixelUnpackState &unpack,
size_t imageSize,
const uint8_t *pixels) override;
angle::Result setCompressedSubImage(const gl::Context *context,
const gl::ImageIndex &index,
const gl::Box &area,
GLenum format,
const gl::PixelUnpackState &unpack,
size_t imageSize,
const uint8_t *pixels) override;
angle::Result copyImage(const gl::Context *context,
const gl::ImageIndex &index,
const gl::Rectangle &sourceArea,
GLenum internalFormat,
gl::Framebuffer *source) override;
angle::Result copySubImage(const gl::Context *context,
const gl::ImageIndex &index,
const gl::Offset &destOffset,
const gl::Rectangle &sourceArea,
gl::Framebuffer *source) override;
angle::Result setStorage(const gl::Context *context,
gl::TextureType type,
size_t levels,
GLenum internalFormat,
const gl::Extents &size) override;
angle::Result setEGLImageTarget(const gl::Context *context,
gl::TextureType type,
egl::Image *image) override;
gl::Error setImageExternal(const gl::Context *context,
gl::TextureType type,
egl::Stream *stream,
const egl::Stream::GLTextureDescription &desc) override;
angle::Result setImageExternal(const gl::Context *context,
gl::TextureType type,
egl::Stream *stream,
const egl::Stream::GLTextureDescription &desc) override;
gl::Error generateMipmap(const gl::Context *context) override;
angle::Result generateMipmap(const gl::Context *context) override;
gl::Error setBaseLevel(const gl::Context *context, GLuint baseLevel) override;
angle::Result setBaseLevel(const gl::Context *context, GLuint baseLevel) override;
gl::Error bindTexImage(const gl::Context *context, egl::Surface *surface) override;
gl::Error releaseTexImage(const gl::Context *context) override;
angle::Result bindTexImage(const gl::Context *context, egl::Surface *surface) override;
angle::Result releaseTexImage(const gl::Context *context) override;
angle::Result syncState(const gl::Context *context,
const gl::Texture::DirtyBits &dirtyBits) override;
gl::Error setStorageMultisample(const gl::Context *context,
gl::TextureType type,
GLsizei samples,
GLint internalformat,
const gl::Extents &size,
bool fixedSampleLocations) override;
angle::Result setStorageMultisample(const gl::Context *context,
gl::TextureType type,
GLsizei samples,
GLint internalformat,
const gl::Extents &size,
bool fixedSampleLocations) override;
angle::Result initializeContents(const gl::Context *context,
const gl::ImageIndex &imageIndex) override;
......
......@@ -413,7 +413,7 @@ void IncompleteTextureSet::onDestroy(const gl::Context *context)
}
}
gl::Error IncompleteTextureSet::getIncompleteTexture(
angle::Result IncompleteTextureSet::getIncompleteTexture(
const gl::Context *context,
gl::TextureType type,
MultisampleTextureInitializer *multisampleInitializer,
......@@ -422,7 +422,7 @@ gl::Error IncompleteTextureSet::getIncompleteTexture(
*textureOut = mIncompleteTextures[type].get();
if (*textureOut != nullptr)
{
return gl::NoError();
return angle::Result::Continue();
}
ContextImpl *implFactory = context->getImplementation();
......@@ -472,7 +472,7 @@ gl::Error IncompleteTextureSet::getIncompleteTexture(
mIncompleteTextures[type].set(context, t.release());
*textureOut = mIncompleteTextures[type].get();
return gl::NoError();
return angle::Result::Continue();
}
#define ANGLE_INSTANTIATE_SET_UNIFORM_MATRIX_FUNC(cols, rows) \
......
......@@ -236,8 +236,8 @@ class MultisampleTextureInitializer
{
public:
virtual ~MultisampleTextureInitializer() {}
virtual gl::Error initializeMultisampleTextureToBlack(const gl::Context *context,
gl::Texture *glTexture) = 0;
virtual angle::Result initializeMultisampleTextureToBlack(const gl::Context *context,
gl::Texture *glTexture) = 0;
};
class IncompleteTextureSet final : angle::NonCopyable
......@@ -248,10 +248,10 @@ class IncompleteTextureSet final : angle::NonCopyable
void onDestroy(const gl::Context *context);
gl::Error getIncompleteTexture(const gl::Context *context,
gl::TextureType type,
MultisampleTextureInitializer *multisampleInitializer,
gl::Texture **textureOut);
angle::Result getIncompleteTexture(const gl::Context *context,
gl::TextureType type,
MultisampleTextureInitializer *multisampleInitializer,
gl::Texture **textureOut);
private:
gl::TextureMap mIncompleteTextures;
......
......@@ -178,9 +178,9 @@ void ContextVk::onDestroy(const gl::Context *context)
}
}
gl::Error ContextVk::getIncompleteTexture(const gl::Context *context,
gl::TextureType type,
gl::Texture **textureOut)
angle::Result ContextVk::getIncompleteTexture(const gl::Context *context,
gl::TextureType type,
gl::Texture **textureOut)
{
// At some point, we'll need to support multisample and we'll pass "this" instead of nullptr
// and implement the necessary interface.
......@@ -1259,7 +1259,7 @@ angle::Result ContextVk::updateActiveTextures(const gl::Context *context)
// Null textures represent incomplete textures.
if (texture == nullptr)
{
ANGLE_TRY_HANDLE(context, getIncompleteTexture(context, textureType, &texture));
ANGLE_TRY(getIncompleteTexture(context, textureType, &texture));
}
mActiveTextures[textureUnit] = vk::GetImpl(texture);
......
......@@ -174,9 +174,9 @@ class ContextVk : public ContextImpl, public vk::Context
const VkClearValue &getClearDepthStencilValue() const;
VkColorComponentFlags getClearColorMask() const;
const VkRect2D &getScissor() const { return mScissor; }
gl::Error getIncompleteTexture(const gl::Context *context,
gl::TextureType type,
gl::Texture **textureOut);
angle::Result getIncompleteTexture(const gl::Context *context,
gl::TextureType type,
gl::Texture **textureOut);
void updateColorMask(const gl::BlendState &blendState);
void handleError(VkResult errorCode, const char *file, unsigned int line) override;
......
......@@ -10,6 +10,9 @@
#include "libANGLE/renderer/vulkan/ImageVk.h"
#include "common/debug.h"
#include "libANGLE/Context.h"
#include "libANGLE/renderer/vulkan/ContextVk.h"
#include "libANGLE/renderer/vulkan/vk_utils.h"
namespace rx
{
......@@ -28,10 +31,9 @@ egl::Error ImageVk::initialize(const egl::Display *display)
return egl::EglBadAccess();
}
gl::Error ImageVk::orphan(const gl::Context *context, egl::ImageSibling *sibling)
angle::Result ImageVk::orphan(const gl::Context *context, egl::ImageSibling *sibling)
{
UNIMPLEMENTED();
return gl::InternalError();
ANGLE_VK_UNREACHABLE(vk::GetImpl(context));
return angle::Result::Stop();
}
} // namespace rx
......@@ -22,7 +22,7 @@ class ImageVk : public ImageImpl
~ImageVk() override;
egl::Error initialize(const egl::Display *display) override;
gl::Error orphan(const gl::Context *context, egl::ImageSibling *sibling) override;
angle::Result orphan(const gl::Context *context, egl::ImageSibling *sibling) override;
};
} // namespace rx
......
......@@ -37,9 +37,9 @@ class D3D11EmulatedIndexedBufferTest : public ANGLETest
mSourceBuffer = new rx::Buffer11(mBufferState, mRenderer);
GLfloat testData[] = { 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f };
gl::Error error = mSourceBuffer->setData(nullptr, gl::BufferBinding::Array, testData,
sizeof(testData), gl::BufferUsage::StaticDraw);
ASSERT_FALSE(error.isError());
angle::Result error = mSourceBuffer->setData(nullptr, gl::BufferBinding::Array, testData,
sizeof(testData), gl::BufferUsage::StaticDraw);
ASSERT_EQ(angle::Result::Continue(), error);
mTranslatedAttribute.baseOffset = 0;
mTranslatedAttribute.usesFirstVertexOffset = false;
......@@ -112,9 +112,9 @@ class D3D11EmulatedIndexedBufferTest : public ANGLETest
void emulateAndCompare(rx::SourceIndexData *srcData)
{
ID3D11Buffer *emulatedBuffer = nullptr;
gl::Error error = mSourceBuffer->getEmulatedIndexedBuffer(
angle::Result error = mSourceBuffer->getEmulatedIndexedBuffer(
mContext, srcData, mTranslatedAttribute, 0, &emulatedBuffer);
ASSERT_FALSE(error.isError());
ASSERT_EQ(angle::Result::Continue(), error);
ASSERT_TRUE(emulatedBuffer != nullptr);
compareContents(emulatedBuffer);
}
......@@ -180,8 +180,8 @@ TEST_P(D3D11EmulatedIndexedBufferTest, TestSourceBufferRemainsUntouchedAfterExpa
const uint8_t *sourceBufferMem = nullptr;
const uint8_t *cleanBufferMem = nullptr;
gl::Error error = mSourceBuffer->getData(mContext, &sourceBufferMem);
ASSERT_FALSE(error.isError());
angle::Result error = mSourceBuffer->getData(mContext, &sourceBufferMem);
ASSERT_EQ(angle::Result::Continue(), error);
error = cleanSourceBuffer->getData(mContext, &cleanBufferMem);
ASSERT_FALSE(error.isError());
......
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