From e02f4117714a4674306ff12c82f0ad9f1953d95f Mon Sep 17 00:00:00 2001 From: Egor Yusov Date: Sun, 28 Oct 2018 21:32:18 -0700 Subject: Allowed arbitrary entry point name in compiled SPIRV bytecode --- Graphics/GraphicsEngineVulkan/include/ShaderVkImpl.h | 3 +++ Graphics/GraphicsEngineVulkan/src/PipelineStateVkImpl.cpp | 6 +++--- Graphics/GraphicsEngineVulkan/src/ShaderVkImpl.cpp | 3 ++- 3 files changed, 8 insertions(+), 4 deletions(-) (limited to 'Graphics/GraphicsEngineVulkan') diff --git a/Graphics/GraphicsEngineVulkan/include/ShaderVkImpl.h b/Graphics/GraphicsEngineVulkan/include/ShaderVkImpl.h index f2febb53..144581bf 100644 --- a/Graphics/GraphicsEngineVulkan/include/ShaderVkImpl.h +++ b/Graphics/GraphicsEngineVulkan/include/ShaderVkImpl.h @@ -80,6 +80,8 @@ public: const ShaderResourceLayoutVk& GetStaticResLayout()const{return m_StaticResLayout;} ShaderResourceCacheVk& GetStaticResCache(){return m_StaticResCache;} + const char* GetEntryPoint() const { return m_EntryPoint.c_str(); } + #ifdef DEVELOPMENT void DvpVerifyStaticResourceBindings(); #endif @@ -92,6 +94,7 @@ private: ShaderResourceCacheVk m_StaticResCache; ShaderVariableManagerVk m_StaticVarsMgr; + const std::string m_EntryPoint; std::vector m_SPIRV; }; diff --git a/Graphics/GraphicsEngineVulkan/src/PipelineStateVkImpl.cpp b/Graphics/GraphicsEngineVulkan/src/PipelineStateVkImpl.cpp index f74f4afb..a5cd7342 100644 --- a/Graphics/GraphicsEngineVulkan/src/PipelineStateVkImpl.cpp +++ b/Graphics/GraphicsEngineVulkan/src/PipelineStateVkImpl.cpp @@ -172,8 +172,8 @@ PipelineStateVkImpl :: PipelineStateVkImpl(IReferenceCounters* pRefCounters std::array ShaderStages = {}; for (Uint32 s = 0; s < m_NumShaders; ++s) { - auto* pShader = m_ppShaders[s]; - auto ShaderType = pShader->GetDesc().ShaderType; + auto* pShaderVk = GetShader(s); + auto ShaderType = pShaderVk->GetDesc().ShaderType; auto& StageCI = ShaderStages[s]; StageCI.sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO; @@ -200,7 +200,7 @@ PipelineStateVkImpl :: PipelineStateVkImpl(IReferenceCounters* pRefCounters m_ShaderModules[s] = LogicalDevice.CreateShaderModule(ShaderModuleCI, m_Desc.Name); StageCI.module = m_ShaderModules[s]; - StageCI.pName = "main"; // entry point + StageCI.pName = pShaderVk->GetEntryPoint(); StageCI.pSpecializationInfo = nullptr; } diff --git a/Graphics/GraphicsEngineVulkan/src/ShaderVkImpl.cpp b/Graphics/GraphicsEngineVulkan/src/ShaderVkImpl.cpp index 137727ff..23d2123d 100644 --- a/Graphics/GraphicsEngineVulkan/src/ShaderVkImpl.cpp +++ b/Graphics/GraphicsEngineVulkan/src/ShaderVkImpl.cpp @@ -37,7 +37,8 @@ ShaderVkImpl::ShaderVkImpl(IReferenceCounters* pRefCounters, RenderDeviceVkImpl* TShaderBase (pRefCounters, pRenderDeviceVk, CreationAttribs.Desc), m_StaticResLayout (*this, pRenderDeviceVk->GetLogicalDevice()), m_StaticResCache (ShaderResourceCacheVk::DbgCacheContentType::StaticShaderResources), - m_StaticVarsMgr (*this) + m_StaticVarsMgr (*this), + m_EntryPoint (CreationAttribs.EntryPoint) { if (CreationAttribs.Source != nullptr || CreationAttribs.FilePath != nullptr) { -- cgit v1.2.3