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 GLsizei width, 31 GLsizei height) override; 32 angle::Result setStorageMultisample(const gl::Context *context, 33 GLsizei samples, 34 GLenum internalformat, 35 GLsizei width, 36 GLsizei height, 37 gl::MultisamplingMode mode) override; 38 angle::Result setStorageEGLImageTarget(const gl::Context *context, egl::Image *image) override; 39 40 angle::Result getAttachmentRenderTarget(const gl::Context *context, 41 GLenum binding, 42 const gl::ImageIndex &imageIndex, 43 GLsizei samples, 44 FramebufferAttachmentRenderTarget **rtOut) override; 45 46 angle::Result initializeContents(const gl::Context *context, 47 const gl::ImageIndex &imageIndex) override; 48 49 private: 50 angle::Result setStorageImpl(const gl::Context *context, 51 GLsizei samples, 52 GLenum internalformat, 53 GLsizei width, 54 GLsizei height); 55 56 void releaseTexture(); 57 58 mtl::Format mFormat; 59 mtl::TextureRef mTexture; 60 mtl::TextureRef mImplicitMSTexture; 61 RenderTargetMtl mRenderTarget; 62 }; 63 64 } // namespace rx 65 66 #endif /* LIBANGLE_RENDERER_METAL_RENDERBUFFERMTL_H_ */ 67