1 // 2 // Copyright 2016 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 // ImageVk.h: 7 // Defines the class interface for ImageVk, implementing ImageImpl. 8 // 9 10 #ifndef LIBANGLE_RENDERER_VULKAN_IMAGEVK_H_ 11 #define LIBANGLE_RENDERER_VULKAN_IMAGEVK_H_ 12 13 #include "libANGLE/renderer/ImageImpl.h" 14 #include "libANGLE/renderer/vulkan/vk_helpers.h" 15 16 namespace rx 17 { 18 19 class ExternalImageSiblingVk : public ExternalImageSiblingImpl 20 { 21 public: ExternalImageSiblingVk()22 ExternalImageSiblingVk() {} ~ExternalImageSiblingVk()23 ~ExternalImageSiblingVk() override {} 24 25 virtual vk::ImageHelper *getImage() const = 0; 26 27 virtual void release(RendererVk *renderer) = 0; 28 }; 29 30 class ImageVk : public ImageImpl 31 { 32 public: 33 ImageVk(const egl::ImageState &state, const gl::Context *context); 34 ~ImageVk() override; 35 void onDestroy(const egl::Display *display) override; 36 37 egl::Error initialize(const egl::Display *display) override; 38 39 angle::Result orphan(const gl::Context *context, egl::ImageSibling *sibling) override; 40 41 egl::Error exportVkImage(void *vkImage, void *vkImageCreateInfo) override; 42 getImage()43 vk::ImageHelper *getImage() const { return mImage; } 44 gl::TextureType getImageTextureType() const; 45 gl::LevelIndex getImageLevel() const; 46 uint32_t getImageLayer() const; 47 48 private: 49 bool mOwnsImage; 50 vk::ImageHelper *mImage; 51 52 std::vector<vk::Shared<vk::Fence>> mImageLastUseFences; 53 54 const gl::Context *mContext; 55 }; 56 57 } // namespace rx 58 59 #endif // LIBANGLE_RENDERER_VULKAN_IMAGEVK_H_ 60