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
diff --git a/src/libGLESv2/renderer/RenderStateCache.cpp b/src/libGLESv2/renderer/RenderStateCache.cpp
index 027b219..92596b6 100644
--- a/src/libGLESv2/renderer/RenderStateCache.cpp
+++ b/src/libGLESv2/renderer/RenderStateCache.cpp
@@ -96,7 +96,6 @@
if (i != mBlendStateCache.end())
{
BlendStateCounterPair &state = i->second;
- state.first->AddRef();
state.second = mCounter++;
return state.first;
}
@@ -156,7 +155,6 @@
mBlendStateCache.insert(std::make_pair(blendState, std::make_pair(dx11BlendState, mCounter++)));
- dx11BlendState->AddRef();
return dx11BlendState;
}
}
@@ -193,7 +191,6 @@
if (i != mRasterizerStateCache.end())
{
RasterizerStateCounterPair &state = i->second;
- state.first->AddRef();
state.second = mCounter++;
return state.first;
}
@@ -238,7 +235,6 @@
mRasterizerStateCache.insert(std::make_pair(key, std::make_pair(dx11RasterizerState, mCounter++)));
- dx11RasterizerState->AddRef();
return dx11RasterizerState;
}
}
@@ -269,7 +265,6 @@
if (i != mDepthStencilStateCache.end())
{
DepthStencilStateCounterPair &state = i->second;
- state.first->AddRef();
state.second = mCounter++;
return state.first;
}
@@ -318,7 +313,6 @@
mDepthStencilStateCache.insert(std::make_pair(dsState, std::make_pair(dx11DepthStencilState, mCounter++)));
- dx11DepthStencilState->AddRef();
return dx11DepthStencilState;
}
}
@@ -349,7 +343,6 @@
if (i != mSamplerStateCache.end())
{
SamplerStateCounterPair &state = i->second;
- state.first->AddRef();
state.second = mCounter++;
return state.first;
}
@@ -397,7 +390,6 @@
mSamplerStateCache.insert(std::make_pair(samplerState, std::make_pair(dx11SamplerState, mCounter++)));
- dx11SamplerState->AddRef();
return dx11SamplerState;
}
}
diff --git a/src/libGLESv2/renderer/Renderer11.cpp b/src/libGLESv2/renderer/Renderer11.cpp
index 52e6cce..302e000 100644
--- a/src/libGLESv2/renderer/Renderer11.cpp
+++ b/src/libGLESv2/renderer/Renderer11.cpp
@@ -287,10 +287,6 @@
mDeviceContext->PSSetSamplers(index, 1, &dxSamplerState);
- if (dxSamplerState)
- {
- dxSamplerState->Release();
- }
mCurPixelSamplerStates[index] = samplerState;
}
@@ -316,10 +312,6 @@
mDeviceContext->VSSetSamplers(index, 1, &dxSamplerState);
- if (dxSamplerState)
- {
- dxSamplerState->Release();
- }
mCurVertexSamplerStates[index] = samplerState;
}
@@ -383,10 +375,6 @@
mDeviceContext->RSSetState(dxRasterState);
- if (dxRasterState)
- {
- dxRasterState->Release();
- }
mCurRasterState = rasterState;
}
@@ -411,10 +399,6 @@
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 @@
mDeviceContext->OMSetDepthStencilState(dxDepthStencilState, static_cast<UINT>(stencilRef));
- if (dxDepthStencilState)
- {
- dxDepthStencilState->Release();
- }
mCurDepthStencilState = depthStencilState;
mCurStencilRef = stencilRef;
mCurStencilBackRef = stencilBackRef;