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/renderer/d3d/FramebufferD3D.h" 13 #include "libANGLE/renderer/d3d/d3d11/renderer11_utils.h" 14 #include "libANGLE/signal_utils.h" 15 16 namespace rx 17 { 18 class Renderer11; 19 20 class Framebuffer11 : public FramebufferD3D, public OnRenderTargetDirtyReceiver 21 { 22 public: 23 Framebuffer11(const gl::FramebufferState &data, Renderer11 *renderer); 24 ~Framebuffer11() override; 25 26 gl::Error discard(const gl::Context *context, size_t count, const GLenum *attachments) override; 27 gl::Error invalidate(const gl::Context *context, 28 size_t count, 29 const GLenum *attachments) override; 30 gl::Error invalidateSub(const gl::Context *context, 31 size_t count, 32 const GLenum *attachments, 33 const gl::Rectangle &area) override; 34 35 // Invalidate the cached swizzles of all bound texture attachments. 36 gl::Error markAttachmentsDirty(const gl::Context *context) const; 37 38 void syncState(const gl::Context *context, 39 const gl::Framebuffer::DirtyBits &dirtyBits) override; 40 getCachedColorRenderTargets()41 const RenderTargetArray &getCachedColorRenderTargets() const 42 { 43 return mCachedColorRenderTargets; 44 } getCachedDepthStencilRenderTarget()45 const RenderTarget11 *getCachedDepthStencilRenderTarget() const 46 { 47 return mCachedDepthStencilRenderTarget; 48 } 49 50 RenderTarget11 *getFirstRenderTarget() const; 51 52 bool hasAnyInternalDirtyBit() const; 53 void syncInternalState(const gl::Context *context); 54 55 void signal(size_t channelID, const gl::Context *context) override; 56 57 gl::Error getSamplePosition(size_t index, GLfloat *xy) const override; 58 59 private: 60 gl::Error clearImpl(const gl::Context *context, const ClearParameters &clearParams) override; 61 62 gl::Error readPixelsImpl(const gl::Context *context, 63 const gl::Rectangle &area, 64 GLenum format, 65 GLenum type, 66 size_t outputPitch, 67 const gl::PixelPackState &pack, 68 uint8_t *pixels) override; 69 70 gl::Error blitImpl(const gl::Context *context, 71 const gl::Rectangle &sourceArea, 72 const gl::Rectangle &destArea, 73 const gl::Rectangle *scissor, 74 bool blitRenderTarget, 75 bool blitDepth, 76 bool blitStencil, 77 GLenum filter, 78 const gl::Framebuffer *sourceFramebuffer) override; 79 80 gl::Error invalidateBase(const gl::Context *context, 81 size_t count, 82 const GLenum *attachments, 83 bool useEXTBehavior) const; 84 gl::Error invalidateAttachment(const gl::Context *context, 85 const gl::FramebufferAttachment *attachment) const; 86 87 GLenum getRenderTargetImplementationFormat(RenderTargetD3D *renderTarget) const override; 88 89 void updateColorRenderTarget(const gl::Context *context, size_t colorIndex); 90 void updateDepthStencilRenderTarget(const gl::Context *context); 91 92 Renderer11 *const mRenderer; 93 RenderTargetArray mCachedColorRenderTargets; 94 RenderTarget11 *mCachedDepthStencilRenderTarget; 95 96 std::vector<OnRenderTargetDirtyBinding> mColorRenderTargetsDirty; 97 OnRenderTargetDirtyBinding mDepthStencilRenderTargetDirty; 98 99 gl::Framebuffer::DirtyBits mInternalDirtyBits; 100 }; 101 102 } 103 104 #endif // LIBANGLE_RENDERER_D3D_D3D11_FRAMBUFFER11_H_ 105