Commit e62cedd0 by Jamie Madill

Load Clear11 resources lazily.

Again this saves on startup time and memory use. BUG=angleproject:1014 Change-Id: I3890dc2ea50ff4e4f1ff9d7cb223e1ab57c330ce Reviewed-on: https://chromium-review.googlesource.com/282552Reviewed-by: 's avatarBrandon Jones <bajones@chromium.org> Tested-by: 's avatarJamie Madill <jmadill@chromium.org>
parent 86a07aec
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
#include "libANGLE/angletypes.h" #include "libANGLE/angletypes.h"
#include "libANGLE/Error.h" #include "libANGLE/Error.h"
#include "libANGLE/Framebuffer.h" #include "libANGLE/Framebuffer.h"
#include "libANGLE/renderer/d3d/d3d11/renderer11_utils.h"
namespace rx namespace rx
{ {
...@@ -41,29 +42,32 @@ class Clear11 : angle::NonCopyable ...@@ -41,29 +42,32 @@ class Clear11 : angle::NonCopyable
ID3D11BlendState *getBlendState(const std::vector<MaskedRenderTarget> &rts); ID3D11BlendState *getBlendState(const std::vector<MaskedRenderTarget> &rts);
ID3D11DepthStencilState *getDepthStencilState(const ClearParameters &clearParams); ID3D11DepthStencilState *getDepthStencilState(const ClearParameters &clearParams);
struct ClearShader struct ClearShader final : public angle::NonCopyable
{ {
ID3D11InputLayout *inputLayout; ClearShader(DXGI_FORMAT colorType,
ID3D11VertexShader *vertexShader; const char *inputLayoutName,
ID3D11PixelShader *pixelShader; const BYTE *vsByteCode,
size_t vsSize,
const char *vsDebugName,
const BYTE *psByteCode,
size_t psSize,
const char *psDebugName);
~ClearShader();
d3d11::LazyInputLayout *inputLayout;
d3d11::LazyShader<ID3D11VertexShader> vertexShader;
d3d11::LazyShader<ID3D11PixelShader> pixelShader;
}; };
template <unsigned int vsSize, unsigned int psSize> template <unsigned int vsSize, unsigned int psSize>
static ClearShader CreateClearShader(ID3D11Device *device, DXGI_FORMAT colorType, const BYTE(&vsByteCode)[vsSize], const BYTE(&psByteCode)[psSize]); static ClearShader CreateClearShader(ID3D11Device *device, DXGI_FORMAT colorType, const BYTE(&vsByteCode)[vsSize], const BYTE(&psByteCode)[psSize]);
Renderer11 *mRenderer;
struct ClearBlendInfo struct ClearBlendInfo
{ {
bool maskChannels[D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT][4]; bool maskChannels[D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT][4];
}; };
typedef bool(*ClearBlendInfoComparisonFunction)(const ClearBlendInfo&, const ClearBlendInfo &); typedef bool(*ClearBlendInfoComparisonFunction)(const ClearBlendInfo&, const ClearBlendInfo &);
typedef std::map<ClearBlendInfo, ID3D11BlendState*, ClearBlendInfoComparisonFunction> ClearBlendStateMap; typedef std::map<ClearBlendInfo, ID3D11BlendState*, ClearBlendInfoComparisonFunction> ClearBlendStateMap;
ClearBlendStateMap mClearBlendStates;
ClearShader mFloatClearShader;
ClearShader mUintClearShader;
ClearShader mIntClearShader;
struct ClearDepthStencilInfo struct ClearDepthStencilInfo
{ {
...@@ -71,8 +75,17 @@ class Clear11 : angle::NonCopyable ...@@ -71,8 +75,17 @@ class Clear11 : angle::NonCopyable
bool clearStencil; bool clearStencil;
UINT8 stencilWriteMask; UINT8 stencilWriteMask;
}; };
typedef bool (*ClearDepthStencilInfoComparisonFunction)(const ClearDepthStencilInfo&, const ClearDepthStencilInfo &); typedef bool(*ClearDepthStencilInfoComparisonFunction)(const ClearDepthStencilInfo&, const ClearDepthStencilInfo &);
typedef std::map<ClearDepthStencilInfo, ID3D11DepthStencilState*, ClearDepthStencilInfoComparisonFunction> ClearDepthStencilStateMap; typedef std::map<ClearDepthStencilInfo, ID3D11DepthStencilState*, ClearDepthStencilInfoComparisonFunction> ClearDepthStencilStateMap;
Renderer11 *mRenderer;
ClearBlendStateMap mClearBlendStates;
ClearShader *mFloatClearShader;
ClearShader *mUintClearShader;
ClearShader *mIntClearShader;
ClearDepthStencilStateMap mClearDepthStencilStates; ClearDepthStencilStateMap mClearDepthStencilStates;
ID3D11Buffer *mVertexBuffer; ID3D11Buffer *mVertexBuffer;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment