diff options
| author | Egor Yusov <egor.yusov@gmail.com> | 2018-10-19 03:28:09 +0000 |
|---|---|---|
| committer | Egor Yusov <egor.yusov@gmail.com> | 2018-10-19 03:28:09 +0000 |
| commit | f93288162c398987d238e4ead5186d8b2000fc5a (patch) | |
| tree | 4905a6ae3e1780f4562fa7531b2b1f86efdda592 /Graphics/GraphicsEngineD3D11 | |
| parent | Implemented separate samplers in D3D12 (diff) | |
| download | DiligentCore-f93288162c398987d238e4ead5186d8b2000fc5a.tar.gz DiligentCore-f93288162c398987d238e4ead5186d8b2000fc5a.zip | |
Updated BIND_SHADER_RESOURCES_* flags
Diffstat (limited to 'Graphics/GraphicsEngineD3D11')
| -rwxr-xr-x | Graphics/GraphicsEngineD3D11/src/ShaderResourceLayoutD3D11.cpp | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/Graphics/GraphicsEngineD3D11/src/ShaderResourceLayoutD3D11.cpp b/Graphics/GraphicsEngineD3D11/src/ShaderResourceLayoutD3D11.cpp index 00efe57d..22580688 100755 --- a/Graphics/GraphicsEngineD3D11/src/ShaderResourceLayoutD3D11.cpp +++ b/Graphics/GraphicsEngineD3D11/src/ShaderResourceLayoutD3D11.cpp @@ -692,25 +692,25 @@ public: template<typename ResourceType>
void Bind( ResourceType &Res)
{
- for(Uint16 elem=0; elem < Res.Attribs.BindCount; ++elem)
- {
- if( Flags & BIND_SHADER_RESOURCES_RESET_BINDINGS )
- Res.BindResource(nullptr, elem);
+ if ( (Flags & (1 << Res.Attribs.GetVariableType())) == 0 )
+ return;
- if( (Flags & BIND_SHADER_RESOURCES_UPDATE_UNRESOLVED) && Res.IsBound(elem) )
- return;
+ for (Uint16 elem=0; elem < Res.Attribs.BindCount; ++elem)
+ {
+ if ( (Flags & BIND_SHADER_RESOURCES_KEEP_EXISTING) && Res.IsBound(elem) )
+ continue;
const auto* VarName = Res.Attribs.Name;
RefCntAutoPtr<IDeviceObject> pRes;
ResourceMapping.GetResource( VarName, &pRes, elem );
- if( pRes )
+ if (pRes)
{
// Call non-virtual function
Res.BindResource(pRes, elem);
}
else
{
- if( (Flags & BIND_SHADER_RESOURCES_ALL_RESOLVED) && !Res.IsBound(elem) )
+ if ( (Flags & BIND_SHADER_RESOURCES_VERIFY_ALL_RESOLVED) && !Res.IsBound(elem) )
LOG_ERROR_MESSAGE( "Cannot bind resource to shader variable \"", VarName, "\": resource view not found in the resource mapping" );
}
}
@@ -730,6 +730,9 @@ void ShaderResourceLayoutD3D11::BindResources( IResourceMapping* pResourceMappin LOG_ERROR_MESSAGE( "Failed to bind resources in shader \"", GetShaderName(), "\": resource mapping is null" );
return;
}
+
+ if ( (Flags & BIND_SHADER_RESOURCES_UPDATE_ALL) == 0 )
+ Flags |= BIND_SHADER_RESOURCES_UPDATE_ALL;
BindResourceHelper BindResHelper(*pResourceMapping, Flags);
|
