1 // 2 // Copyright 2014 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 // Framebuffer11.h: Defines the Framebuffer11 class. 8 9 #ifndef LIBANGLE_RENDERER_D3D_D3D11_FRAMBUFFER11_H_ 10 #define LIBANGLE_RENDERER_D3D_D3D11_FRAMBUFFER11_H_ 11 12 #include "libANGLE/Observer.h" 13 #include "libANGLE/renderer/RenderTargetCache.h" 14 #include "libANGLE/renderer/d3d/FramebufferD3D.h" 15 #include "libANGLE/renderer/d3d/d3d11/renderer11_utils.h" 16 17 namespace rx 18 { 19 class Renderer11; 20 21 class Framebuffer11 : public FramebufferD3D 22 { 23 public: 24 Framebuffer11(const gl::FramebufferState &data, Renderer11 *renderer); 25 ~Framebuffer11() override; 26 27 angle::Result discard(const gl::Context *context, 28 size_t count, 29 const GLenum *attachments) override; 30 angle::Result invalidate(const gl::Context *context, 31 size_t count, 32 const GLenum *attachments) override; 33 angle::Result invalidateSub(const gl::Context *context, 34 size_t count, 35 const GLenum *attachments, 36 const gl::Rectangle &area) override; 37 38 // Invalidate the cached swizzles of all bound texture attachments. 39 angle::Result markAttachmentsDirty(const gl::Context *context) const; 40 41 angle::Result syncState(const gl::Context *context, 42 GLenum binding, 43 const gl::Framebuffer::DirtyBits &dirtyBits, 44 gl::Command command) override; 45 getCachedColorRenderTargets()46 const gl::AttachmentArray<RenderTarget11 *> &getCachedColorRenderTargets() const 47 { 48 return mRenderTargetCache.getColors(); 49 } getCachedDepthStencilRenderTarget()50 const RenderTarget11 *getCachedDepthStencilRenderTarget() const 51 { 52 return mRenderTargetCache.getDepthStencil(); 53 } 54 55 RenderTarget11 *getFirstRenderTarget() const; 56 57 angle::Result getSamplePosition(const gl::Context *context, 58 size_t index, 59 GLfloat *xy) const override; 60 61 const gl::InternalFormat &getImplementationColorReadFormat( 62 const gl::Context *context) const override; 63 64 private: 65 angle::Result clearImpl(const gl::Context *context, 66 const ClearParameters &clearParams) override; 67 68 angle::Result readPixelsImpl(const gl::Context *context, 69 const gl::Rectangle &area, 70 GLenum format, 71 GLenum type, 72 size_t outputPitch, 73 const gl::PixelPackState &pack, 74 gl::Buffer *packBuffer, 75 uint8_t *pixels) override; 76 77 angle::Result blitImpl(const gl::Context *context, 78 const gl::Rectangle &sourceArea, 79 const gl::Rectangle &destArea, 80 const gl::Rectangle *scissor, 81 bool blitRenderTarget, 82 bool blitDepth, 83 bool blitStencil, 84 GLenum filter, 85 const gl::Framebuffer *sourceFramebuffer) override; 86 87 angle::Result invalidateBase(const gl::Context *context, 88 size_t count, 89 const GLenum *attachments, 90 bool useEXTBehavior) const; 91 angle::Result invalidateAttachment(const gl::Context *context, 92 const gl::FramebufferAttachment *attachment) const; 93 94 Renderer11 *const mRenderer; 95 RenderTargetCache<RenderTarget11> mRenderTargetCache; 96 }; 97 98 } // namespace rx 99 100 #endif // LIBANGLE_RENDERER_D3D_D3D11_FRAMBUFFER11_H_ 101