diff options
| author | Egor Yusov <egor.yusov@gmail.com> | 2018-05-27 16:44:09 +0000 |
|---|---|---|
| committer | Egor Yusov <egor.yusov@gmail.com> | 2018-05-27 16:44:09 +0000 |
| commit | a2ea66b86d58cacc573cad86e6d707e461579e9f (patch) | |
| tree | 684aed6c66fb9dab7391a74e96d90875c7f1534d /Graphics/GraphicsEngineVulkan | |
| parent | Code cleaning + number of minor updates (diff) | |
| download | DiligentCore-a2ea66b86d58cacc573cad86e6d707e461579e9f.tar.gz DiligentCore-a2ea66b86d58cacc573cad86e6d707e461579e9f.zip | |
Removed unused vkDescriptor field from ShaderResourceCacheVk::Resource pluse few minor updates
Diffstat (limited to 'Graphics/GraphicsEngineVulkan')
4 files changed, 16 insertions, 12 deletions
diff --git a/Graphics/GraphicsEngineVulkan/include/ShaderResourceCacheVk.h b/Graphics/GraphicsEngineVulkan/include/ShaderResourceCacheVk.h index b2afd1c2..d1dda4de 100644 --- a/Graphics/GraphicsEngineVulkan/include/ShaderResourceCacheVk.h +++ b/Graphics/GraphicsEngineVulkan/include/ShaderResourceCacheVk.h @@ -85,7 +85,7 @@ public: void InitializeSets(IMemoryAllocator &MemAllocator, Uint32 NumSets, Uint32 SetSizes[]); void InitializeResources(Uint32 Set, Uint32 Offset, Uint32 ArraySize, SPIRVShaderResourceAttribs::ResourceType Type); - // sizeof(Resource) == 24 (x64, msvc, Release) + // sizeof(Resource) == 16 (x64, msvc, Release) struct Resource { Resource(const Resource&) = delete; @@ -95,7 +95,6 @@ public: const SPIRVShaderResourceAttribs::ResourceType Type; RefCntAutoPtr<IDeviceObject> pObject; - void* vkDescriptor = nullptr; VkDescriptorBufferInfo GetBufferDescriptorWriteInfo () const; VkDescriptorImageInfo GetImageDescriptorWriteInfo (bool IsImmutableSampler)const; diff --git a/Graphics/GraphicsEngineVulkan/src/ShaderResourceBindingVkImpl.cpp b/Graphics/GraphicsEngineVulkan/src/ShaderResourceBindingVkImpl.cpp index 879ba581..499b4997 100644 --- a/Graphics/GraphicsEngineVulkan/src/ShaderResourceBindingVkImpl.cpp +++ b/Graphics/GraphicsEngineVulkan/src/ShaderResourceBindingVkImpl.cpp @@ -39,7 +39,7 @@ ShaderResourceBindingVkImpl::ShaderResourceBindingVkImpl( IReferenceCounters *pR m_NumShaders = pPSO->GetNumShaders(); auto *pRenderDeviceVkImpl = ValidatedCast<RenderDeviceVkImpl>(pPSO->GetDevice()); - // This only allocate memory and initialize descriptor sets in the resource cache + // This will only allocate memory and initialize descriptor sets in the resource cache // Resources will be initialized by InitializeResourceMemoryInCache() pPSO->GetPipelineLayout().InitResourceCache(pRenderDeviceVkImpl, m_ShaderResourceCache, pPSO->GetResourceCacheDataAllocator()); @@ -106,16 +106,20 @@ IShaderVariable *ShaderResourceBindingVkImpl::GetVariable(SHADER_TYPE ShaderType auto ResLayoutInd = m_ResourceLayoutIndex[ShaderInd]; if (ResLayoutInd < 0) { - LOG_ERROR_MESSAGE("Failed to find shader variable \"", Name,"\" in shader resource binding: shader type ", GetShaderTypeLiteralName(ShaderType), " is not initialized"); + LOG_ERROR_MESSAGE("Failed to find variable \"", Name,"\" in shader resource binding: shader type ", GetShaderTypeLiteralName(ShaderType), " is not initialized"); return ValidatedCast<PipelineStateVkImpl>(GetPipelineState())->GetDummyShaderVar(); } auto *pVar = m_pShaderVarMgrs[ResLayoutInd].GetVariable(Name); - VERIFY(pVar->GetResource().SpirvAttribs.VarType != SHADER_VARIABLE_TYPE_STATIC, "Static variables cannot be accessed through shader resource binding"); - if(pVar == nullptr) + { + LOG_ERROR_MESSAGE("Failed to find variable \"", Name,"\" in shader resource binding. Note that only dynamic and mutable variables can be accessed through SRB object."); return ValidatedCast<PipelineStateVkImpl>(GetPipelineState())->GetDummyShaderVar(); + } else + { + VERIFY(pVar->GetResource().SpirvAttribs.VarType != SHADER_VARIABLE_TYPE_STATIC, "Static variables cannot be accessed through shader resource binding"); return pVar; + } } } diff --git a/Graphics/GraphicsEngineVulkan/src/ShaderVariableVk.cpp b/Graphics/GraphicsEngineVulkan/src/ShaderVariableVk.cpp index d4418d6a..461566b9 100644 --- a/Graphics/GraphicsEngineVulkan/src/ShaderVariableVk.cpp +++ b/Graphics/GraphicsEngineVulkan/src/ShaderVariableVk.cpp @@ -97,11 +97,6 @@ ShaderVariableVkImpl* ShaderVariableManagerVk::GetVariable(const Char* Name) break; } } - - if (pVar == nullptr) - { - LOG_ERROR_MESSAGE("Shader variable \"", Name, "\" is not found in shader \"", m_pResourceLayout->GetShaderName(), "\". Attempts to set the variable will be silently ignored."); - } return pVar; } diff --git a/Graphics/GraphicsEngineVulkan/src/ShaderVkImpl.cpp b/Graphics/GraphicsEngineVulkan/src/ShaderVkImpl.cpp index fb9213c2..69bc2dfc 100644 --- a/Graphics/GraphicsEngineVulkan/src/ShaderVkImpl.cpp +++ b/Graphics/GraphicsEngineVulkan/src/ShaderVkImpl.cpp @@ -79,7 +79,13 @@ void ShaderVkImpl::BindResources(IResourceMapping* pResourceMapping, Uint32 Flag IShaderVariable* ShaderVkImpl::GetShaderVariable(const Char* Name) { IShaderVariable *pVar = m_StaticVarsMgr.GetVariable(Name); - return (pVar != nullptr) ? pVar : &m_DummyShaderVar; + if(pVar == nullptr) + { + LOG_ERROR_MESSAGE("Shader variable \"", Name, "\" is not found in shader \"", m_Desc.Name, "\". Note that only static variables can be accessed through shader object."); + return &m_DummyShaderVar; + } + else + return pVar; } #ifdef VERIFY_SHADER_BINDINGS |
