1 // 2 // Copyright 2015 The ANGLE Project Authors. All rights reserved. 3 // Use of this source code is governed by a BSD-style license that can be 4 // found in the LICENSE file. 5 // 6 7 // ImageImpl.h: Defines the rx::ImageImpl class representing the EGLimage object. 8 9 #ifndef LIBANGLE_RENDERER_IMAGEIMPL_H_ 10 #define LIBANGLE_RENDERER_IMAGEIMPL_H_ 11 12 #include "common/angleutils.h" 13 #include "libANGLE/Error.h" 14 #include "libANGLE/formatutils.h" 15 #include "libANGLE/renderer/FramebufferAttachmentObjectImpl.h" 16 17 namespace gl 18 { 19 class Context; 20 } // namespace gl 21 22 namespace egl 23 { 24 class Display; 25 class ImageSibling; 26 struct ImageState; 27 } // namespace egl 28 29 namespace rx 30 { 31 class ExternalImageSiblingImpl : public FramebufferAttachmentObjectImpl 32 { 33 public: ~ExternalImageSiblingImpl()34 ~ExternalImageSiblingImpl() override {} 35 36 virtual egl::Error initialize(const egl::Display *display) = 0; onDestroy(const egl::Display * display)37 virtual void onDestroy(const egl::Display *display) {} 38 39 virtual gl::Format getFormat() const = 0; 40 virtual bool isRenderable(const gl::Context *context) const = 0; 41 virtual bool isTexturable(const gl::Context *context) const = 0; 42 virtual bool isYUV() const = 0; 43 virtual bool hasFrontBufferUsage() const; 44 virtual bool isCubeMap() const; 45 virtual bool hasProtectedContent() const = 0; 46 virtual gl::Extents getSize() const = 0; 47 virtual size_t getSamples() const = 0; 48 virtual uint32_t getLevelCount() const; 49 }; 50 51 class ImageImpl : angle::NonCopyable 52 { 53 public: ImageImpl(const egl::ImageState & state)54 ImageImpl(const egl::ImageState &state) : mState(state) {} ~ImageImpl()55 virtual ~ImageImpl() {} onDestroy(const egl::Display * display)56 virtual void onDestroy(const egl::Display *display) {} 57 58 virtual egl::Error initialize(const egl::Display *display) = 0; 59 60 virtual angle::Result orphan(const gl::Context *context, egl::ImageSibling *sibling) = 0; 61 62 virtual egl::Error exportVkImage(void *vkImage, void *vkImageCreateInfo); 63 64 virtual bool isFixedRatedCompression(const gl::Context *context); 65 66 protected: 67 const egl::ImageState &mState; 68 }; 69 } // namespace rx 70 71 #endif // LIBANGLE_RENDERER_IMAGEIMPL_H_ 72