Moved the static initializers of RenderStateCache's constants to the top of the cpp file.

TRAC #22129 Signed-off-by: Daniel Koch git-svn-id: https://angleproject.googlecode.com/svn/branches/dx11proto@1441 736b8ea6-26fd-11df-bfd4-992fa37f6226
parent 5503fd03
...@@ -16,6 +16,13 @@ ...@@ -16,6 +16,13 @@
namespace rx namespace rx
{ {
// MSDN's documentation of ID3D11Device::CreateBlendState, ID3D11Device::CreateRasterizerState
// and ID3D11Device::CreateDepthStencilState claims the maximum number of unique states of each
// type an application can create is 4096
const unsigned int RenderStateCache::kMaxBlendStates = 4096;
const unsigned int RenderStateCache::kMaxRasterizerStates = 4096;
const unsigned int RenderStateCache::kMaxDepthStencilStates = 4096;
RenderStateCache::RenderStateCache() : mDevice(NULL), mCounter(0), RenderStateCache::RenderStateCache() : mDevice(NULL), mCounter(0),
mBlendStateCache(kMaxBlendStates, hashBlendState, compareBlendStates), mBlendStateCache(kMaxBlendStates, hashBlendState, compareBlendStates),
mRasterizerStateCache(kMaxRasterizerStates, hashRasterizerState, compareRasterizerStates), mRasterizerStateCache(kMaxRasterizerStates, hashRasterizerState, compareRasterizerStates),
...@@ -69,10 +76,6 @@ bool RenderStateCache::compareBlendStates(const gl::BlendState &a, const gl::Ble ...@@ -69,10 +76,6 @@ bool RenderStateCache::compareBlendStates(const gl::BlendState &a, const gl::Ble
return memcmp(&a, &b, sizeof(gl::BlendState)) == 0; return memcmp(&a, &b, sizeof(gl::BlendState)) == 0;
} }
// MSDN's documentation of ID3D11Device::CreateBlendState claims the maximum number of
// unique blend states an application can create is 4096
const unsigned int RenderStateCache::kMaxBlendStates = 4096;
ID3D11BlendState *RenderStateCache::getBlendState(const gl::BlendState &blendState) ID3D11BlendState *RenderStateCache::getBlendState(const gl::BlendState &blendState)
{ {
if (!mDevice) if (!mDevice)
...@@ -164,10 +167,6 @@ bool RenderStateCache::compareRasterizerStates(const RasterizerStateKey &a, cons ...@@ -164,10 +167,6 @@ bool RenderStateCache::compareRasterizerStates(const RasterizerStateKey &a, cons
return memcmp(&a, &b, sizeof(RasterizerStateKey)) == 0; return memcmp(&a, &b, sizeof(RasterizerStateKey)) == 0;
} }
// MSDN's documentation of ID3D11Device::CreateRasterizerState claims the maximum number of
// unique rasterizer states an application can create is 4096
const unsigned int RenderStateCache::kMaxRasterizerStates = 4096;
ID3D11RasterizerState *RenderStateCache::getRasterizerState(const gl::RasterizerState &rasterState, ID3D11RasterizerState *RenderStateCache::getRasterizerState(const gl::RasterizerState &rasterState,
unsigned int depthSize) unsigned int depthSize)
{ {
...@@ -249,10 +248,6 @@ bool RenderStateCache::compareDepthStencilStates(const gl::DepthStencilState &a, ...@@ -249,10 +248,6 @@ bool RenderStateCache::compareDepthStencilStates(const gl::DepthStencilState &a,
return memcmp(&a, &b, sizeof(gl::DepthStencilState)) == 0; return memcmp(&a, &b, sizeof(gl::DepthStencilState)) == 0;
} }
// MSDN's documentation of ID3D11Device::CreateDepthStencilState claims the maximum number of
// unique depth stencil states an application can create is 4096
const unsigned int RenderStateCache::kMaxDepthStencilStates = 4096;
ID3D11DepthStencilState* RenderStateCache::getDepthStencilState(const gl::DepthStencilState &dsState) ID3D11DepthStencilState* RenderStateCache::getDepthStencilState(const gl::DepthStencilState &dsState)
{ {
if (!mDevice) if (!mDevice)
......
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