tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

Clear11.h (3448B)


      1 //
      2 // Copyright 2013 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 // Clear11.h: Framebuffer clear utility class.
      8 
      9 #ifndef LIBANGLE_RENDERER_D3D_D3D11_CLEAR11_H_
     10 #define LIBANGLE_RENDERER_D3D_D3D11_CLEAR11_H_
     11 
     12 #include <map>
     13 #include <vector>
     14 
     15 #include "libANGLE/Error.h"
     16 #include "libANGLE/Framebuffer.h"
     17 #include "libANGLE/angletypes.h"
     18 #include "libANGLE/renderer/d3d/d3d11/renderer11_utils.h"
     19 
     20 namespace rx
     21 {
     22 class Renderer11;
     23 class RenderTarget11;
     24 struct ClearParameters;
     25 
     26 template <typename T>
     27 struct RtvDsvClearInfo
     28 {
     29    T r, g, b, a;
     30    float z;
     31    float c1padding[3];
     32 };
     33 
     34 class Clear11 : angle::NonCopyable
     35 {
     36  public:
     37    explicit Clear11(Renderer11 *renderer);
     38    ~Clear11();
     39 
     40    // Clears the framebuffer with the supplied clear parameters, assumes that the framebuffer is
     41    // currently applied.
     42    angle::Result clearFramebuffer(const gl::Context *context,
     43                                   const ClearParameters &clearParams,
     44                                   const gl::FramebufferState &fboData);
     45 
     46  private:
     47    class ShaderManager final : angle::NonCopyable
     48    {
     49      public:
     50        ShaderManager();
     51        ~ShaderManager();
     52        angle::Result getShadersAndLayout(const gl::Context *context,
     53                                          Renderer11 *renderer,
     54                                          const INT clearType,
     55                                          const uint32_t numRTs,
     56                                          const bool hasLayeredLayout,
     57                                          const d3d11::InputLayout **il,
     58                                          const d3d11::VertexShader **vs,
     59                                          const d3d11::GeometryShader **gs,
     60                                          const d3d11::PixelShader **ps);
     61 
     62      private:
     63        constexpr static size_t kNumShaders = D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT;
     64 
     65        d3d11::InputLayout mIl9;
     66        d3d11::LazyShader<ID3D11VertexShader> mVs9;
     67        d3d11::LazyShader<ID3D11PixelShader> mPsFloat9;
     68        d3d11::LazyShader<ID3D11VertexShader> mVs;
     69        d3d11::LazyShader<ID3D11VertexShader> mVsMultiview;
     70        d3d11::LazyShader<ID3D11GeometryShader> mGsMultiview;
     71        d3d11::LazyShader<ID3D11PixelShader> mPsDepth;
     72        std::array<d3d11::LazyShader<ID3D11PixelShader>, kNumShaders> mPsFloat;
     73        std::array<d3d11::LazyShader<ID3D11PixelShader>, kNumShaders> mPsUInt;
     74        std::array<d3d11::LazyShader<ID3D11PixelShader>, kNumShaders> mPsSInt;
     75    };
     76 
     77    bool useVertexBuffer() const;
     78    angle::Result ensureConstantBufferCreated(const gl::Context *context);
     79    angle::Result ensureVertexBufferCreated(const gl::Context *context);
     80    angle::Result ensureResourcesInitialized(const gl::Context *context);
     81 
     82    Renderer11 *mRenderer;
     83    bool mResourcesInitialized;
     84 
     85    // States
     86    d3d11::RasterizerState mScissorEnabledRasterizerState;
     87    d3d11::RasterizerState mScissorDisabledRasterizerState;
     88    gl::DepthStencilState mDepthStencilStateKey;
     89    d3d11::BlendStateKey mBlendStateKey;
     90 
     91    // Shaders and shader resources
     92    ShaderManager mShaderManager;
     93    d3d11::Buffer mConstantBuffer;
     94    d3d11::Buffer mVertexBuffer;
     95 
     96    // Buffer data and draw parameters
     97    RtvDsvClearInfo<float> mShaderData;
     98 };
     99 
    100 }  // namespace rx
    101 
    102 #endif  // LIBANGLE_RENDERER_D3D_D3D11_CLEAR11_H_