xref: /aosp_15_r20/external/angle/src/libANGLE/renderer/d3d/d3d9/Framebuffer9.h (revision 8975f5c5ed3d1c378011245431ada316dfb6f244)
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 // Framebuffer9.h: Defines the Framebuffer9 class.
8 
9 #ifndef LIBANGLE_RENDERER_D3D_D3D9_FRAMBUFFER9_H_
10 #define LIBANGLE_RENDERER_D3D_D3D9_FRAMBUFFER9_H_
11 
12 #include "libANGLE/renderer/RenderTargetCache.h"
13 #include "libANGLE/renderer/d3d/FramebufferD3D.h"
14 #include "libANGLE/renderer/d3d/d3d9/renderer9_utils.h"
15 
16 namespace rx
17 {
18 class Renderer9;
19 
20 class Framebuffer9 : public FramebufferD3D
21 {
22   public:
23     Framebuffer9(const gl::FramebufferState &data, Renderer9 *renderer);
24     ~Framebuffer9() override;
25 
26     angle::Result discard(const gl::Context *context,
27                           size_t count,
28                           const GLenum *attachments) override;
29     angle::Result invalidate(const gl::Context *context,
30                              size_t count,
31                              const GLenum *attachments) override;
32     angle::Result invalidateSub(const gl::Context *context,
33                                 size_t count,
34                                 const GLenum *attachments,
35                                 const gl::Rectangle &area) override;
36 
37     angle::Result getSamplePosition(const gl::Context *context,
38                                     size_t index,
39                                     GLfloat *xy) const override;
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<RenderTarget9 *> &getCachedColorRenderTargets() const
47     {
48         return mRenderTargetCache.getColors();
49     }
50 
getCachedDepthStencilRenderTarget()51     const RenderTarget9 *getCachedDepthStencilRenderTarget() const
52     {
53         return mRenderTargetCache.getDepthStencil();
54     }
55 
56     const gl::InternalFormat &getImplementationColorReadFormat(
57         const gl::Context *context) const override;
58 
59   private:
60     angle::Result clearImpl(const gl::Context *context,
61                             const ClearParameters &clearParams) override;
62 
63     angle::Result readPixelsImpl(const gl::Context *context,
64                                  const gl::Rectangle &area,
65                                  GLenum format,
66                                  GLenum type,
67                                  size_t outputPitch,
68                                  const gl::PixelPackState &pack,
69                                  gl::Buffer *packPixels,
70                                  uint8_t *pixels) override;
71 
72     angle::Result blitImpl(const gl::Context *context,
73                            const gl::Rectangle &sourceArea,
74                            const gl::Rectangle &destArea,
75                            const gl::Rectangle *scissor,
76                            bool blitRenderTarget,
77                            bool blitDepth,
78                            bool blitStencil,
79                            GLenum filter,
80                            const gl::Framebuffer *sourceFramebuffer) override;
81 
82     Renderer9 *const mRenderer;
83 
84     RenderTargetCache<RenderTarget9> mRenderTargetCache;
85 };
86 
87 }  // namespace rx
88 
89 #endif  // LIBANGLE_RENDERER_D3D_D3D9_FRAMBUFFER9_H_
90