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 ID3D11BlendState *getBlendState(const gl::ClearParameters &clearParams, const std::vector<RenderTarget11*>& rts);
48 ID3D11InputLayout *inputLayout;
49 ID3D11VertexShader *vertexShader;
50 ID3D11PixelShader *pixelShader;
52 ClearShader mFloatClearShader;
53 ClearShader mUintClearShader;
54 ClearShader mIntClearShader;
56 template <unsigned int vsSize, unsigned int psSize>
57 static ClearShader CreateClearShader(ID3D11Device *device, DXGI_FORMAT colorType, const BYTE (&vsByteCode)[vsSize], const BYTE (&psByteCode)[psSize]);
59 struct ClearDepthStencilInfo
63 UINT8 stencilWriteMask;
65 typedef bool (*ClearDepthStencilInfoComparisonFunction)(const ClearDepthStencilInfo&, const ClearDepthStencilInfo &);
66 typedef std::map<ClearDepthStencilInfo, ID3D11DepthStencilState*, ClearDepthStencilInfoComparisonFunction> ClearDepthStencilStateMap;
67 ClearDepthStencilStateMap mClearDepthStencilStates;
69 ID3D11DepthStencilState *getDepthStencilState(const gl::ClearParameters &clearParams);
71 ID3D11Buffer *mVertexBuffer;
72 ID3D11RasterizerState *mRasterizerState;
77 #endif // LIBGLESV2_RENDERER_CLEAR11_H_