Made the D3D objects returned by RenderStateCache into weak pointers.

TRAC #22339 Signed-off-by: Nicolas Capens Signed-off-by: Daniel Koch Author: Geoff Lang git-svn-id: https://angleproject.googlecode.com/svn/branches/dx11proto@1671 736b8ea6-26fd-11df-bfd4-992fa37f6226
parent a0b868aa
......@@ -96,7 +96,6 @@ ID3D11BlendState *RenderStateCache::getBlendState(const gl::BlendState &blendSta
if (i != mBlendStateCache.end())
{
BlendStateCounterPair &state = i->second;
state.first->AddRef();
state.second = mCounter++;
return state.first;
}
......@@ -156,7 +155,6 @@ ID3D11BlendState *RenderStateCache::getBlendState(const gl::BlendState &blendSta
mBlendStateCache.insert(std::make_pair(blendState, std::make_pair(dx11BlendState, mCounter++)));
dx11BlendState->AddRef();
return dx11BlendState;
}
}
......@@ -193,7 +191,6 @@ ID3D11RasterizerState *RenderStateCache::getRasterizerState(const gl::Rasterizer
if (i != mRasterizerStateCache.end())
{
RasterizerStateCounterPair &state = i->second;
state.first->AddRef();
state.second = mCounter++;
return state.first;
}
......@@ -238,7 +235,6 @@ ID3D11RasterizerState *RenderStateCache::getRasterizerState(const gl::Rasterizer
mRasterizerStateCache.insert(std::make_pair(key, std::make_pair(dx11RasterizerState, mCounter++)));
dx11RasterizerState->AddRef();
return dx11RasterizerState;
}
}
......@@ -269,7 +265,6 @@ ID3D11DepthStencilState* RenderStateCache::getDepthStencilState(const gl::DepthS
if (i != mDepthStencilStateCache.end())
{
DepthStencilStateCounterPair &state = i->second;
state.first->AddRef();
state.second = mCounter++;
return state.first;
}
......@@ -318,7 +313,6 @@ ID3D11DepthStencilState* RenderStateCache::getDepthStencilState(const gl::DepthS
mDepthStencilStateCache.insert(std::make_pair(dsState, std::make_pair(dx11DepthStencilState, mCounter++)));
dx11DepthStencilState->AddRef();
return dx11DepthStencilState;
}
}
......@@ -349,7 +343,6 @@ ID3D11SamplerState* RenderStateCache::getSamplerState(const gl::SamplerState &sa
if (i != mSamplerStateCache.end())
{
SamplerStateCounterPair &state = i->second;
state.first->AddRef();
state.second = mCounter++;
return state.first;
}
......@@ -397,7 +390,6 @@ ID3D11SamplerState* RenderStateCache::getSamplerState(const gl::SamplerState &sa
mSamplerStateCache.insert(std::make_pair(samplerState, std::make_pair(dx11SamplerState, mCounter++)));
dx11SamplerState->AddRef();
return dx11SamplerState;
}
}
......
......@@ -287,10 +287,6 @@ void Renderer11::setSamplerState(gl::SamplerType type, int index, const gl::Samp
mDeviceContext->PSSetSamplers(index, 1, &dxSamplerState);
if (dxSamplerState)
{
dxSamplerState->Release();
}
mCurPixelSamplerStates[index] = samplerState;
}
......@@ -316,10 +312,6 @@ void Renderer11::setSamplerState(gl::SamplerType type, int index, const gl::Samp
mDeviceContext->VSSetSamplers(index, 1, &dxSamplerState);
if (dxSamplerState)
{
dxSamplerState->Release();
}
mCurVertexSamplerStates[index] = samplerState;
}
......@@ -383,10 +375,6 @@ void Renderer11::setRasterizerState(const gl::RasterizerState &rasterState)
mDeviceContext->RSSetState(dxRasterState);
if (dxRasterState)
{
dxRasterState->Release();
}
mCurRasterState = rasterState;
}
......@@ -411,10 +399,6 @@ void Renderer11::setBlendState(const gl::BlendState &blendState, const gl::Color
const float blendColors[] = { blendColor.red, blendColor.green, blendColor.blue, blendColor.alpha };
mDeviceContext->OMSetBlendState(dxBlendState, blendColors, sampleMask);
if (dxBlendState)
{
dxBlendState->Release();
}
mCurBlendState = blendState;
mCurBlendColor = blendColor;
mCurSampleMask = sampleMask;
......@@ -448,10 +432,6 @@ void Renderer11::setDepthStencilState(const gl::DepthStencilState &depthStencilS
mDeviceContext->OMSetDepthStencilState(dxDepthStencilState, static_cast<UINT>(stencilRef));
if (dxDepthStencilState)
{
dxDepthStencilState->Release();
}
mCurDepthStencilState = depthStencilState;
mCurStencilRef = stencilRef;
mCurStencilBackRef = stencilBackRef;
......
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