summaryrefslogtreecommitdiffstats
path: root/Graphics/GraphicsEngineOpenGL
diff options
context:
space:
mode:
authorEgor Yusov <egor.yusov@gmail.com>2018-10-19 03:28:09 +0000
committerEgor Yusov <egor.yusov@gmail.com>2018-10-19 03:28:09 +0000
commitf93288162c398987d238e4ead5186d8b2000fc5a (patch)
tree4905a6ae3e1780f4562fa7531b2b1f86efdda592 /Graphics/GraphicsEngineOpenGL
parentImplemented separate samplers in D3D12 (diff)
downloadDiligentCore-f93288162c398987d238e4ead5186d8b2000fc5a.tar.gz
DiligentCore-f93288162c398987d238e4ead5186d8b2000fc5a.zip
Updated BIND_SHADER_RESOURCES_* flags
Diffstat (limited to 'Graphics/GraphicsEngineOpenGL')
-rw-r--r--Graphics/GraphicsEngineOpenGL/src/GLProgramResources.cpp22
1 files changed, 13 insertions, 9 deletions
diff --git a/Graphics/GraphicsEngineOpenGL/src/GLProgramResources.cpp b/Graphics/GraphicsEngineOpenGL/src/GLProgramResources.cpp
index a845c613..cb2cbe36 100644
--- a/Graphics/GraphicsEngineOpenGL/src/GLProgramResources.cpp
+++ b/Graphics/GraphicsEngineOpenGL/src/GLProgramResources.cpp
@@ -428,16 +428,17 @@ namespace Diligent
template<typename TResArrayType>
void BindResourcesHelper(TResArrayType &ResArr, IResourceMapping *pResourceMapping, Uint32 Flags)
{
- for( auto res = ResArr.begin(); res != ResArr.end(); ++res )
+ for (auto& res : ResArr)
{
- auto &Name = res->Name;
- for(Uint32 ArrInd = 0; ArrInd < res->pResources.size(); ++ArrInd)
+ if ( (Flags & (1 << res.VarType)) == 0 )
+ continue;
+
+ auto &Name = res.Name;
+ for(Uint32 ArrInd = 0; ArrInd < res.pResources.size(); ++ArrInd)
{
- auto &CurrResource = res->pResources[ArrInd];
- if( Flags & BIND_SHADER_RESOURCES_RESET_BINDINGS )
- CurrResource.Release();
+ auto &CurrResource = res.pResources[ArrInd];
- if( (Flags & BIND_SHADER_RESOURCES_UPDATE_UNRESOLVED) && CurrResource )
+ if( (Flags & BIND_SHADER_RESOURCES_KEEP_EXISTING) && CurrResource )
continue; // Skip already resolved resources
RefCntAutoPtr<IDeviceObject> pNewRes;
@@ -445,13 +446,13 @@ namespace Diligent
if (pNewRes != nullptr)
{
- if(res->VarType == SHADER_VARIABLE_TYPE_STATIC && CurrResource != nullptr && CurrResource != pNewRes )
+ if(res.VarType == SHADER_VARIABLE_TYPE_STATIC && CurrResource != nullptr && CurrResource != pNewRes )
LOG_ERROR_MESSAGE( "Updating binding for static variable \"", Name, "\" is invalid and may result in an undefined behavior" );
CurrResource = pNewRes;
}
else
{
- if ( CurrResource == nullptr && (Flags & BIND_SHADER_RESOURCES_ALL_RESOLVED) )
+ if ( CurrResource == nullptr && (Flags & BIND_SHADER_RESOURCES_VERIFY_ALL_RESOLVED) )
LOG_ERROR_MESSAGE("Resource \"", Name, "\" is not found in the resource mapping");
}
}
@@ -463,6 +464,9 @@ namespace Diligent
if( !pResourceMapping )
return;
+ if ( (Flags & BIND_SHADER_RESOURCES_UPDATE_ALL) == 0 )
+ Flags |= BIND_SHADER_RESOURCES_UPDATE_ALL;
+
BindResourcesHelper( m_UniformBlocks, pResourceMapping, Flags );
BindResourcesHelper( m_Samplers, pResourceMapping, Flags );
BindResourcesHelper( m_Images, pResourceMapping, Flags );