From 6e5be00eb6db740e5db88a49f5a158f74fd7eb47 Mon Sep 17 00:00:00 2001 From: Egor Yusov Date: Thu, 26 Apr 2018 09:05:36 -0700 Subject: Working on SPIRV resource loading --- Graphics/GraphicsEngineVulkan/include/ShaderVkImpl.h | 18 +++++++++--------- Graphics/GraphicsEngineVulkan/src/ShaderVkImpl.cpp | 8 ++++---- 2 files changed, 13 insertions(+), 13 deletions(-) (limited to 'Graphics/GraphicsEngineVulkan') diff --git a/Graphics/GraphicsEngineVulkan/include/ShaderVkImpl.h b/Graphics/GraphicsEngineVulkan/include/ShaderVkImpl.h index a861700f..d2541077 100644 --- a/Graphics/GraphicsEngineVulkan/include/ShaderVkImpl.h +++ b/Graphics/GraphicsEngineVulkan/include/ShaderVkImpl.h @@ -31,6 +31,7 @@ #include "ShaderBase.h" #include "ShaderResourceLayoutVk.h" #include "VulkanUtilities/VulkanObjectWrappers.h" +#include "SPIRVShaderResources.h" #ifdef _DEBUG # define VERIFY_SHADER_BINDINGS @@ -62,10 +63,9 @@ public: return m_VkShaderModule; } -/* - const std::shared_ptr& GetShaderResources()const{return m_pShaderResources;} - const ShaderResourceLayoutVk& GetConstResLayout()const{return m_StaticResLayout;} - + const std::shared_ptr& GetShaderResources()const{return m_pShaderResources;} + //const ShaderResourceLayoutVk& GetConstResLayout()const{return m_StaticResLayout;} + /* #ifdef VERIFY_SHADER_BINDINGS void DbgVerifyStaticResourceBindings(); #endif @@ -73,13 +73,13 @@ public: private: DummyShaderVariable m_DummyShaderVar; ///< Dummy shader variable - + */ // ShaderResources class instance must be referenced through the shared pointer, because // it is referenced by ShaderResourceLayoutVk class instances - std::shared_ptr m_pShaderResources; - ShaderResourceLayoutVk m_StaticResLayout; - ShaderResourceCacheVk m_ConstResCache; -*/ + std::shared_ptr m_pShaderResources; + //ShaderResourceLayoutVk m_StaticResLayout; + //ShaderResourceCacheVk m_ConstResCache; + VulkanUtilities::ShaderModuleWrapper m_VkShaderModule; }; diff --git a/Graphics/GraphicsEngineVulkan/src/ShaderVkImpl.cpp b/Graphics/GraphicsEngineVulkan/src/ShaderVkImpl.cpp index 507d3aea..73c97870 100644 --- a/Graphics/GraphicsEngineVulkan/src/ShaderVkImpl.cpp +++ b/Graphics/GraphicsEngineVulkan/src/ShaderVkImpl.cpp @@ -59,13 +59,13 @@ ShaderVkImpl::ShaderVkImpl(IReferenceCounters *pRefCounters, RenderDeviceVkImpl ShaderModuleCI.pCode = SPIRV.data(); m_VkShaderModule = LogicalDevice.CreateShaderModule(ShaderModuleCI, m_Desc.Name); -/* // Load shader resources auto &Allocator = GetRawAllocator(); - auto *pRawMem = ALLOCATE(Allocator, "Allocator for ShaderResources", sizeof(ShaderResourcesVk)); - auto *pResources = new (pRawMem) ShaderResourcesVk(m_pShaderByteCode, m_Desc); - m_pShaderResources.reset(pResources, STDDeleterRawMem(Allocator)); + auto *pRawMem = ALLOCATE(Allocator, "Allocator for ShaderResources", sizeof(SPIRVShaderResources)); + auto *pResources = new (pRawMem) SPIRVShaderResources(Allocator, m_Desc.ShaderType, std::move(SPIRV)); + m_pShaderResources.reset(pResources, STDDeleterRawMem(Allocator)); + /* // Clone only static resources that will be set directly in the shader // http://diligentgraphics.com/diligent-engine/architecture/Vk/shader-resource-layout#Initializing-Special-Resource-Layout-for-Managing-Static-Shader-Resources SHADER_VARIABLE_TYPE VarTypes[] = {SHADER_VARIABLE_TYPE_STATIC}; -- cgit v1.2.3