|
|
@@ -140,13 +140,13 @@ namespace bs
|
|
|
|
|
|
namespace ct
|
|
|
{
|
|
|
- RenderStateCoreManager::RenderStateCoreManager()
|
|
|
+ RenderStateManager::RenderStateManager()
|
|
|
:mNextBlendStateId(0), mNextRasterizerStateId(0), mNextDepthStencilStateId(0)
|
|
|
{
|
|
|
|
|
|
}
|
|
|
|
|
|
- SPtr<SamplerStateCore> RenderStateCoreManager::createSamplerState(const SAMPLER_STATE_DESC& desc,
|
|
|
+ SPtr<SamplerStateCore> RenderStateManager::createSamplerState(const SAMPLER_STATE_DESC& desc,
|
|
|
GpuDeviceFlags deviceMask) const
|
|
|
{
|
|
|
SPtr<SamplerStateCore> state = findCachedState(desc);
|
|
|
@@ -161,7 +161,7 @@ namespace bs
|
|
|
return state;
|
|
|
}
|
|
|
|
|
|
- SPtr<DepthStencilStateCore> RenderStateCoreManager::createDepthStencilState(const DEPTH_STENCIL_STATE_DESC& desc) const
|
|
|
+ SPtr<DepthStencilStateCore> RenderStateManager::createDepthStencilState(const DEPTH_STENCIL_STATE_DESC& desc) const
|
|
|
{
|
|
|
UINT32 id = 0;
|
|
|
SPtr<DepthStencilStateCore> state = findCachedState(desc, id);
|
|
|
@@ -179,7 +179,7 @@ namespace bs
|
|
|
return state;
|
|
|
}
|
|
|
|
|
|
- SPtr<RasterizerStateCore> RenderStateCoreManager::createRasterizerState(const RASTERIZER_STATE_DESC& desc) const
|
|
|
+ SPtr<RasterizerStateCore> RenderStateManager::createRasterizerState(const RASTERIZER_STATE_DESC& desc) const
|
|
|
{
|
|
|
UINT32 id = 0;
|
|
|
SPtr<RasterizerStateCore> state = findCachedState(desc, id);
|
|
|
@@ -197,7 +197,7 @@ namespace bs
|
|
|
return state;
|
|
|
}
|
|
|
|
|
|
- SPtr<BlendStateCore> RenderStateCoreManager::createBlendState(const BLEND_STATE_DESC& desc) const
|
|
|
+ SPtr<BlendStateCore> RenderStateManager::createBlendState(const BLEND_STATE_DESC& desc) const
|
|
|
{
|
|
|
UINT32 id = 0;
|
|
|
SPtr<BlendStateCore> state = findCachedState(desc, id);
|
|
|
@@ -215,7 +215,7 @@ namespace bs
|
|
|
return state;
|
|
|
}
|
|
|
|
|
|
- SPtr<GraphicsPipelineStateCore> RenderStateCoreManager::createGraphicsPipelineState(const PIPELINE_STATE_DESC& desc,
|
|
|
+ SPtr<GraphicsPipelineStateCore> RenderStateManager::createGraphicsPipelineState(const PIPELINE_STATE_DESC& desc,
|
|
|
GpuDeviceFlags deviceMask) const
|
|
|
{
|
|
|
SPtr<GraphicsPipelineStateCore> state = _createGraphicsPipelineState(desc, deviceMask);
|
|
|
@@ -224,7 +224,7 @@ namespace bs
|
|
|
return state;
|
|
|
}
|
|
|
|
|
|
- SPtr<ComputePipelineStateCore> RenderStateCoreManager::createComputePipelineState(const SPtr<GpuProgramCore>& program,
|
|
|
+ SPtr<ComputePipelineStateCore> RenderStateManager::createComputePipelineState(const SPtr<GpuProgramCore>& program,
|
|
|
GpuDeviceFlags deviceMask) const
|
|
|
{
|
|
|
SPtr<ComputePipelineStateCore> state = _createComputePipelineState(program, deviceMask);
|
|
|
@@ -233,7 +233,7 @@ namespace bs
|
|
|
return state;
|
|
|
}
|
|
|
|
|
|
- SPtr<GpuPipelineParamInfoCore> RenderStateCoreManager::createPipelineParamInfo(
|
|
|
+ SPtr<GpuPipelineParamInfoCore> RenderStateManager::createPipelineParamInfo(
|
|
|
const GPU_PIPELINE_PARAMS_DESC& desc, GpuDeviceFlags deviceMask) const
|
|
|
{
|
|
|
SPtr<GpuPipelineParamInfoCore> paramInfo = _createPipelineParamInfo(desc, deviceMask);
|
|
|
@@ -242,7 +242,7 @@ namespace bs
|
|
|
return paramInfo;
|
|
|
}
|
|
|
|
|
|
- SPtr<SamplerStateCore> RenderStateCoreManager::_createSamplerState(const SAMPLER_STATE_DESC& desc,
|
|
|
+ SPtr<SamplerStateCore> RenderStateManager::_createSamplerState(const SAMPLER_STATE_DESC& desc,
|
|
|
GpuDeviceFlags deviceMask) const
|
|
|
{
|
|
|
SPtr<SamplerStateCore> state = findCachedState(desc);
|
|
|
@@ -256,7 +256,7 @@ namespace bs
|
|
|
return state;
|
|
|
}
|
|
|
|
|
|
- SPtr<DepthStencilStateCore> RenderStateCoreManager::_createDepthStencilState(const DEPTH_STENCIL_STATE_DESC& desc) const
|
|
|
+ SPtr<DepthStencilStateCore> RenderStateManager::_createDepthStencilState(const DEPTH_STENCIL_STATE_DESC& desc) const
|
|
|
{
|
|
|
UINT32 id = 0;
|
|
|
SPtr<DepthStencilStateCore> state = findCachedState(desc, id);
|
|
|
@@ -273,7 +273,7 @@ namespace bs
|
|
|
return state;
|
|
|
}
|
|
|
|
|
|
- SPtr<RasterizerStateCore> RenderStateCoreManager::_createRasterizerState(const RASTERIZER_STATE_DESC& desc) const
|
|
|
+ SPtr<RasterizerStateCore> RenderStateManager::_createRasterizerState(const RASTERIZER_STATE_DESC& desc) const
|
|
|
{
|
|
|
UINT32 id = 0;
|
|
|
SPtr<RasterizerStateCore> state = findCachedState(desc, id);
|
|
|
@@ -290,7 +290,7 @@ namespace bs
|
|
|
return state;
|
|
|
}
|
|
|
|
|
|
- SPtr<BlendStateCore> RenderStateCoreManager::_createBlendState(const BLEND_STATE_DESC& desc) const
|
|
|
+ SPtr<BlendStateCore> RenderStateManager::_createBlendState(const BLEND_STATE_DESC& desc) const
|
|
|
{
|
|
|
UINT32 id = 0;
|
|
|
SPtr<BlendStateCore> state = findCachedState(desc, id);
|
|
|
@@ -307,7 +307,7 @@ namespace bs
|
|
|
return state;
|
|
|
}
|
|
|
|
|
|
- SPtr<GraphicsPipelineStateCore> RenderStateCoreManager::_createGraphicsPipelineState(const PIPELINE_STATE_DESC& desc,
|
|
|
+ SPtr<GraphicsPipelineStateCore> RenderStateManager::_createGraphicsPipelineState(const PIPELINE_STATE_DESC& desc,
|
|
|
GpuDeviceFlags deviceMask) const
|
|
|
{
|
|
|
SPtr<GraphicsPipelineStateCore> pipelineState =
|
|
|
@@ -319,7 +319,7 @@ namespace bs
|
|
|
return pipelineState;
|
|
|
}
|
|
|
|
|
|
- SPtr<ComputePipelineStateCore> RenderStateCoreManager::_createComputePipelineState(const SPtr<GpuProgramCore>& program,
|
|
|
+ SPtr<ComputePipelineStateCore> RenderStateManager::_createComputePipelineState(const SPtr<GpuProgramCore>& program,
|
|
|
GpuDeviceFlags deviceMask) const
|
|
|
{
|
|
|
SPtr<ComputePipelineStateCore> pipelineState =
|
|
|
@@ -331,7 +331,7 @@ namespace bs
|
|
|
return pipelineState;
|
|
|
}
|
|
|
|
|
|
- SPtr<GpuPipelineParamInfoCore> RenderStateCoreManager::_createPipelineParamInfo(
|
|
|
+ SPtr<GpuPipelineParamInfoCore> RenderStateManager::_createPipelineParamInfo(
|
|
|
const GPU_PIPELINE_PARAMS_DESC& desc, GpuDeviceFlags deviceMask) const
|
|
|
{
|
|
|
SPtr<GpuPipelineParamInfoCore> paramInfo =
|
|
|
@@ -343,7 +343,7 @@ namespace bs
|
|
|
return paramInfo;
|
|
|
}
|
|
|
|
|
|
- void RenderStateCoreManager::onShutDown()
|
|
|
+ void RenderStateManager::onShutDown()
|
|
|
{
|
|
|
mDefaultBlendState = nullptr;
|
|
|
mDefaultDepthStencilState = nullptr;
|
|
|
@@ -351,7 +351,7 @@ namespace bs
|
|
|
mDefaultSamplerState = nullptr;
|
|
|
}
|
|
|
|
|
|
- const SPtr<SamplerStateCore>& RenderStateCoreManager::getDefaultSamplerState() const
|
|
|
+ const SPtr<SamplerStateCore>& RenderStateManager::getDefaultSamplerState() const
|
|
|
{
|
|
|
if (mDefaultSamplerState == nullptr)
|
|
|
mDefaultSamplerState = createSamplerState(SAMPLER_STATE_DESC());
|
|
|
@@ -359,7 +359,7 @@ namespace bs
|
|
|
return mDefaultSamplerState;
|
|
|
}
|
|
|
|
|
|
- const SPtr<BlendStateCore>& RenderStateCoreManager::getDefaultBlendState() const
|
|
|
+ const SPtr<BlendStateCore>& RenderStateManager::getDefaultBlendState() const
|
|
|
{
|
|
|
if (mDefaultBlendState == nullptr)
|
|
|
mDefaultBlendState = createBlendState(BLEND_STATE_DESC());
|
|
|
@@ -367,7 +367,7 @@ namespace bs
|
|
|
return mDefaultBlendState;
|
|
|
}
|
|
|
|
|
|
- const SPtr<RasterizerStateCore>& RenderStateCoreManager::getDefaultRasterizerState() const
|
|
|
+ const SPtr<RasterizerStateCore>& RenderStateManager::getDefaultRasterizerState() const
|
|
|
{
|
|
|
if (mDefaultRasterizerState == nullptr)
|
|
|
mDefaultRasterizerState = createRasterizerState(RASTERIZER_STATE_DESC());
|
|
|
@@ -375,7 +375,7 @@ namespace bs
|
|
|
return mDefaultRasterizerState;
|
|
|
}
|
|
|
|
|
|
- const SPtr<DepthStencilStateCore>& RenderStateCoreManager::getDefaultDepthStencilState() const
|
|
|
+ const SPtr<DepthStencilStateCore>& RenderStateManager::getDefaultDepthStencilState() const
|
|
|
{
|
|
|
if (mDefaultDepthStencilState == nullptr)
|
|
|
mDefaultDepthStencilState = createDepthStencilState(DEPTH_STENCIL_STATE_DESC());
|
|
|
@@ -383,42 +383,42 @@ namespace bs
|
|
|
return mDefaultDepthStencilState;
|
|
|
}
|
|
|
|
|
|
- void RenderStateCoreManager::notifySamplerStateCreated(const SAMPLER_STATE_DESC& desc, const SPtr<SamplerStateCore>& state) const
|
|
|
+ void RenderStateManager::notifySamplerStateCreated(const SAMPLER_STATE_DESC& desc, const SPtr<SamplerStateCore>& state) const
|
|
|
{
|
|
|
Lock lock(mMutex);
|
|
|
|
|
|
mCachedSamplerStates[desc] = state;
|
|
|
}
|
|
|
|
|
|
- void RenderStateCoreManager::notifyBlendStateCreated(const BLEND_STATE_DESC& desc, const CachedBlendState& state) const
|
|
|
+ void RenderStateManager::notifyBlendStateCreated(const BLEND_STATE_DESC& desc, const CachedBlendState& state) const
|
|
|
{
|
|
|
Lock lock(mMutex);
|
|
|
|
|
|
mCachedBlendStates[desc] = state;
|
|
|
}
|
|
|
|
|
|
- void RenderStateCoreManager::notifyRasterizerStateCreated(const RASTERIZER_STATE_DESC& desc, const CachedRasterizerState& state) const
|
|
|
+ void RenderStateManager::notifyRasterizerStateCreated(const RASTERIZER_STATE_DESC& desc, const CachedRasterizerState& state) const
|
|
|
{
|
|
|
Lock lock(mMutex);
|
|
|
|
|
|
mCachedRasterizerStates[desc] = state;
|
|
|
}
|
|
|
|
|
|
- void RenderStateCoreManager::notifyDepthStencilStateCreated(const DEPTH_STENCIL_STATE_DESC& desc, const CachedDepthStencilState& state) const
|
|
|
+ void RenderStateManager::notifyDepthStencilStateCreated(const DEPTH_STENCIL_STATE_DESC& desc, const CachedDepthStencilState& state) const
|
|
|
{
|
|
|
Lock lock(mMutex);
|
|
|
|
|
|
mCachedDepthStencilStates[desc] = state;
|
|
|
}
|
|
|
|
|
|
- void RenderStateCoreManager::notifySamplerStateDestroyed(const SAMPLER_STATE_DESC& desc) const
|
|
|
+ void RenderStateManager::notifySamplerStateDestroyed(const SAMPLER_STATE_DESC& desc) const
|
|
|
{
|
|
|
Lock lock(mMutex);
|
|
|
|
|
|
mCachedSamplerStates.erase(desc);
|
|
|
}
|
|
|
|
|
|
- SPtr<SamplerStateCore> RenderStateCoreManager::findCachedState(const SAMPLER_STATE_DESC& desc) const
|
|
|
+ SPtr<SamplerStateCore> RenderStateManager::findCachedState(const SAMPLER_STATE_DESC& desc) const
|
|
|
{
|
|
|
Lock lock(mMutex);
|
|
|
|
|
|
@@ -429,7 +429,7 @@ namespace bs
|
|
|
return nullptr;
|
|
|
}
|
|
|
|
|
|
- SPtr<BlendStateCore> RenderStateCoreManager::findCachedState(const BLEND_STATE_DESC& desc, UINT32& id) const
|
|
|
+ SPtr<BlendStateCore> RenderStateManager::findCachedState(const BLEND_STATE_DESC& desc, UINT32& id) const
|
|
|
{
|
|
|
Lock lock(mMutex);
|
|
|
|
|
|
@@ -450,7 +450,7 @@ namespace bs
|
|
|
return nullptr;
|
|
|
}
|
|
|
|
|
|
- SPtr<RasterizerStateCore> RenderStateCoreManager::findCachedState(const RASTERIZER_STATE_DESC& desc, UINT32& id) const
|
|
|
+ SPtr<RasterizerStateCore> RenderStateManager::findCachedState(const RASTERIZER_STATE_DESC& desc, UINT32& id) const
|
|
|
{
|
|
|
Lock lock(mMutex);
|
|
|
|
|
|
@@ -471,7 +471,7 @@ namespace bs
|
|
|
return nullptr;
|
|
|
}
|
|
|
|
|
|
- SPtr<DepthStencilStateCore> RenderStateCoreManager::findCachedState(const DEPTH_STENCIL_STATE_DESC& desc, UINT32& id) const
|
|
|
+ SPtr<DepthStencilStateCore> RenderStateManager::findCachedState(const DEPTH_STENCIL_STATE_DESC& desc, UINT32& id) const
|
|
|
{
|
|
|
Lock lock(mMutex);
|
|
|
|
|
|
@@ -492,7 +492,7 @@ namespace bs
|
|
|
return nullptr;
|
|
|
}
|
|
|
|
|
|
- SPtr<SamplerStateCore> RenderStateCoreManager::createSamplerStateInternal(const SAMPLER_STATE_DESC& desc, GpuDeviceFlags deviceMask) const
|
|
|
+ SPtr<SamplerStateCore> RenderStateManager::createSamplerStateInternal(const SAMPLER_STATE_DESC& desc, GpuDeviceFlags deviceMask) const
|
|
|
{
|
|
|
SPtr<SamplerStateCore> state =
|
|
|
bs_shared_ptr<SamplerStateCore>(new (bs_alloc<SamplerStateCore>()) SamplerStateCore(desc, deviceMask));
|
|
|
@@ -501,7 +501,7 @@ namespace bs
|
|
|
return state;
|
|
|
}
|
|
|
|
|
|
- SPtr<DepthStencilStateCore> RenderStateCoreManager::createDepthStencilStateInternal(const DEPTH_STENCIL_STATE_DESC& desc, UINT32 id) const
|
|
|
+ SPtr<DepthStencilStateCore> RenderStateManager::createDepthStencilStateInternal(const DEPTH_STENCIL_STATE_DESC& desc, UINT32 id) const
|
|
|
{
|
|
|
SPtr<DepthStencilStateCore> state = bs_shared_ptr<DepthStencilStateCore>(new (bs_alloc<DepthStencilStateCore>()) DepthStencilStateCore(desc, id));
|
|
|
state->_setThisPtr(state);
|
|
|
@@ -509,7 +509,7 @@ namespace bs
|
|
|
return state;
|
|
|
}
|
|
|
|
|
|
- SPtr<RasterizerStateCore> RenderStateCoreManager::createRasterizerStateInternal(const RASTERIZER_STATE_DESC& desc, UINT32 id) const
|
|
|
+ SPtr<RasterizerStateCore> RenderStateManager::createRasterizerStateInternal(const RASTERIZER_STATE_DESC& desc, UINT32 id) const
|
|
|
{
|
|
|
SPtr<RasterizerStateCore> state = bs_shared_ptr<RasterizerStateCore>(new (bs_alloc<RasterizerStateCore>()) RasterizerStateCore(desc, id));
|
|
|
state->_setThisPtr(state);
|
|
|
@@ -517,7 +517,7 @@ namespace bs
|
|
|
return state;
|
|
|
}
|
|
|
|
|
|
- SPtr<BlendStateCore> RenderStateCoreManager::createBlendStateInternal(const BLEND_STATE_DESC& desc, UINT32 id) const
|
|
|
+ SPtr<BlendStateCore> RenderStateManager::createBlendStateInternal(const BLEND_STATE_DESC& desc, UINT32 id) const
|
|
|
{
|
|
|
SPtr<BlendStateCore> state = bs_shared_ptr<BlendStateCore>(new (bs_alloc<BlendStateCore>()) BlendStateCore(desc, id));
|
|
|
state->_setThisPtr(state);
|