diff options
Diffstat (limited to 'src/3rdparty/angle/src/libANGLE/Image.h')
-rw-r--r-- | src/3rdparty/angle/src/libANGLE/Image.h | 66 |
1 files changed, 45 insertions, 21 deletions
diff --git a/src/3rdparty/angle/src/libANGLE/Image.h b/src/3rdparty/angle/src/libANGLE/Image.h index 26c9df914c..d2f1b875c6 100644 --- a/src/3rdparty/angle/src/libANGLE/Image.h +++ b/src/3rdparty/angle/src/libANGLE/Image.h @@ -12,12 +12,15 @@ #include "common/angleutils.h" #include "libANGLE/AttributeMap.h" #include "libANGLE/Error.h" +#include "libANGLE/FramebufferAttachment.h" #include "libANGLE/RefCountObject.h" +#include "libANGLE/formatutils.h" #include <set> namespace rx { +class EGLImplFactory; class ImageImpl; } @@ -25,18 +28,25 @@ namespace egl { class Image; -class ImageSibling : public RefCountObject +// Only currently Renderbuffers and Textures can be bound with images. This makes the relationship +// explicit, and also ensures that an image sibling can determine if it's been initialized or not, +// which is important for the robust resource init extension with Textures and EGLImages. +class ImageSibling : public gl::RefCountObject, public gl::FramebufferAttachmentObject { public: ImageSibling(GLuint id); - virtual ~ImageSibling(); + ~ImageSibling() override; + + bool isEGLImageTarget() const; + gl::InitState sourceEGLImageInitState() const; + void setSourceEGLImageInitState(gl::InitState initState) const; protected: // Set the image target of this sibling - void setTargetImage(egl::Image *imageTarget); + void setTargetImage(const gl::Context *context, egl::Image *imageTarget); // Orphan all EGL image sources and targets - gl::Error orphanImages(); + gl::Error orphanImages(const gl::Context *context); private: friend class Image; @@ -48,22 +58,42 @@ class ImageSibling : public RefCountObject void removeImageSource(egl::Image *imageSource); std::set<Image *> mSourcesOf; - BindingPointer<Image> mTargetOf; + gl::BindingPointer<Image> mTargetOf; +}; + +struct ImageState : private angle::NonCopyable +{ + ImageState(EGLenum target, ImageSibling *buffer, const AttributeMap &attribs); + ~ImageState(); + + gl::ImageIndex imageIndex; + gl::BindingPointer<ImageSibling> source; + std::set<ImageSibling *> targets; }; -class Image final : public RefCountObject +class Image final : public gl::RefCountObject { public: - Image(rx::ImageImpl *impl, EGLenum target, ImageSibling *buffer, const AttributeMap &attribs); - ~Image(); + Image(rx::EGLImplFactory *factory, + EGLenum target, + ImageSibling *buffer, + const AttributeMap &attribs); + + gl::Error onDestroy(const gl::Context *context) override; + ~Image() override; - GLenum getInternalFormat() const; + const gl::Format &getFormat() const; size_t getWidth() const; size_t getHeight() const; size_t getSamples() const; - rx::ImageImpl *getImplementation(); - const rx::ImageImpl *getImplementation() const; + Error initialize(); + + rx::ImageImpl *getImplementation() const; + + bool orphaned() const; + gl::InitState sourceInitState() const; + void setInitState(gl::InitState initState); private: friend class ImageSibling; @@ -74,18 +104,12 @@ class Image final : public RefCountObject // 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(ImageSibling *sibling); + gl::Error orphanSibling(const gl::Context *context, ImageSibling *sibling); + ImageState mState; rx::ImageImpl *mImplementation; - - GLenum mInternalFormat; - size_t mWidth; - size_t mHeight; - size_t mSamples; - - BindingPointer<ImageSibling> mSource; - std::set<ImageSibling *> mTargets; + bool mOrphanedAndNeedsInit; }; -} +} // namespace egl #endif // LIBANGLE_IMAGE_H_ |