2 // Copyright (c) 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.
7 // Clear11.h: Framebuffer clear utility class.
9 #ifndef LIBGLESV2_RENDERER_CLEAR11_H_
10 #define LIBGLESV2_RENDERER_CLEAR11_H_
12 #include "libGLESv2/angletypes.h"
27 explicit Clear11(Renderer11 *renderer);
30 // Clears the framebuffer with the supplied clear parameters, assumes that the framebuffer is currently applied.
31 void clearFramebuffer(const gl::ClearParameters &clearParams, gl::Framebuffer *frameBuffer);
34 Renderer11 *mRenderer;
38 bool maskChannels[D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT][4];
40 typedef bool (*ClearBlendInfoComparisonFunction)(const ClearBlendInfo&, const ClearBlendInfo &);
41 typedef std::map<ClearBlendInfo, ID3D11BlendState*, ClearBlendInfoComparisonFunction> ClearBlendStateMap;
42 ClearBlendStateMap mClearBlendStates;
44 struct MaskedRenderTarget
47 RenderTarget11 *renderTarget;
50 ID3D11BlendState *getBlendState(const std::vector<MaskedRenderTarget> &rts);
54 ID3D11InputLayout *inputLayout;
55 ID3D11VertexShader *vertexShader;
56 ID3D11PixelShader *pixelShader;
58 ClearShader mFloatClearShader;
59 ClearShader mUintClearShader;
60 ClearShader mIntClearShader;
62 template <unsigned int vsSize, unsigned int psSize>
63 static ClearShader CreateClearShader(ID3D11Device *device, DXGI_FORMAT colorType, const BYTE (&vsByteCode)[vsSize], const BYTE (&psByteCode)[psSize]);
65 struct ClearDepthStencilInfo
69 UINT8 stencilWriteMask;
71 typedef bool (*ClearDepthStencilInfoComparisonFunction)(const ClearDepthStencilInfo&, const ClearDepthStencilInfo &);
72 typedef std::map<ClearDepthStencilInfo, ID3D11DepthStencilState*, ClearDepthStencilInfoComparisonFunction> ClearDepthStencilStateMap;
73 ClearDepthStencilStateMap mClearDepthStencilStates;
75 ID3D11DepthStencilState *getDepthStencilState(const gl::ClearParameters &clearParams);
77 ID3D11Buffer *mVertexBuffer;
78 ID3D11RasterizerState *mRasterizerState;
83 #endif // LIBGLESV2_RENDERER_CLEAR11_H_