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) override; 44 getCachedColorRenderTargets()45 const gl::AttachmentArray<RenderTarget11 *> &getCachedColorRenderTargets() const 46 { 47 return mRenderTargetCache.getColors(); 48 } getCachedDepthStencilRenderTarget()49 const RenderTarget11 *getCachedDepthStencilRenderTarget() const 50 { 51 return mRenderTargetCache.getDepthStencil(true); 52 } 53 54 RenderTarget11 *getFirstRenderTarget() const; 55 56 angle::Result getSamplePosition(const gl::Context *context, 57 size_t index, 58 GLfloat *xy) const override; 59 60 const gl::InternalFormat &getImplementationColorReadFormat( 61 const gl::Context *context) const override; 62 63 private: 64 angle::Result clearImpl(const gl::Context *context, 65 const ClearParameters &clearParams) override; 66 67 angle::Result readPixelsImpl(const gl::Context *context, 68 const gl::Rectangle &area, 69 GLenum format, 70 GLenum type, 71 size_t outputPitch, 72 const gl::PixelPackState &pack, 73 uint8_t *pixels) override; 74 75 angle::Result blitImpl(const gl::Context *context, 76 const gl::Rectangle &sourceArea, 77 const gl::Rectangle &destArea, 78 const gl::Rectangle *scissor, 79 bool blitRenderTarget, 80 bool blitDepth, 81 bool blitStencil, 82 GLenum filter, 83 const gl::Framebuffer *sourceFramebuffer) override; 84 85 angle::Result invalidateBase(const gl::Context *context, 86 size_t count, 87 const GLenum *attachments, 88 bool useEXTBehavior) const; 89 angle::Result invalidateAttachment(const gl::Context *context, 90 const gl::FramebufferAttachment *attachment) const; 91 92 Renderer11 *const mRenderer; 93 RenderTargetCache<RenderTarget11> mRenderTargetCache; 94 }; 95 96 } // namespace rx 97 98 #endif // LIBANGLE_RENDERER_D3D_D3D11_FRAMBUFFER11_H_ 99