1 // 2 // Copyright 2019 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 // RenderBufferMtl.h: 7 // Defines the class interface for RenderBufferMtl, implementing RenderBufferImpl. 8 // 9 10 #ifndef LIBANGLE_RENDERER_METAL_RENDERBUFFERMTL_H_ 11 #define LIBANGLE_RENDERER_METAL_RENDERBUFFERMTL_H_ 12 13 #include "libANGLE/renderer/RenderbufferImpl.h" 14 #include "libANGLE/renderer/metal/RenderTargetMtl.h" 15 #include "libANGLE/renderer/metal/mtl_resources.h" 16 17 namespace rx 18 { 19 20 class RenderbufferMtl : public RenderbufferImpl 21 { 22 public: 23 RenderbufferMtl(const gl::RenderbufferState &state); 24 ~RenderbufferMtl() override; 25 26 void onDestroy(const gl::Context *context) override; 27 28 angle::Result setStorage(const gl::Context *context, 29 GLenum internalformat, 30 size_t width, 31 size_t height) override; 32 angle::Result setStorageMultisample(const gl::Context *context, 33 size_t samples, 34 GLenum internalformat, 35 size_t width, 36 size_t height) override; 37 angle::Result setStorageEGLImageTarget(const gl::Context *context, egl::Image *image) override; 38 39 angle::Result getAttachmentRenderTarget(const gl::Context *context, 40 GLenum binding, 41 const gl::ImageIndex &imageIndex, 42 GLsizei samples, 43 FramebufferAttachmentRenderTarget **rtOut) override; 44 45 angle::Result initializeContents(const gl::Context *context, 46 const gl::ImageIndex &imageIndex) override; 47 48 private: 49 angle::Result setStorageImpl(const gl::Context *context, 50 size_t samples, 51 GLenum internalformat, 52 size_t width, 53 size_t height); 54 55 void releaseTexture(); 56 57 mtl::Format mFormat; 58 mtl::TextureRef mTexture; 59 RenderTargetMtl mRenderTarget; 60 }; 61 62 } // namespace rx 63 64 #endif /* LIBANGLE_RENDERER_METAL_RENDERBUFFERMTL_H_ */ 65