From a90c850735664e2928e4cc961442a126c6859b97 Mon Sep 17 00:00:00 2001 From: Tim Foley Date: Tue, 26 Jan 2021 13:32:03 -0800 Subject: Integrate reflection more deeply into gfx layer (#1677) --- tools/gfx/vulkan/render-vk.cpp | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'tools/gfx/vulkan/render-vk.cpp') diff --git a/tools/gfx/vulkan/render-vk.cpp b/tools/gfx/vulkan/render-vk.cpp index 88cd52ad7..5afe3e3b4 100644 --- a/tools/gfx/vulkan/render-vk.cpp +++ b/tools/gfx/vulkan/render-vk.cpp @@ -307,16 +307,8 @@ public: VkDeviceSize size; }; - class ShaderProgramImpl: public IShaderProgram, public RefObject + class ShaderProgramImpl: public GraphicsCommonShaderProgram { - public: - SLANG_REF_OBJECT_IUNKNOWN_ALL - IShaderProgram* getInterface(const Guid& guid) - { - if (guid == GfxGUID::IID_ISlangUnknown || guid == GfxGUID::IID_IShaderProgram) - return static_cast(this); - return nullptr; - } public: ShaderProgramImpl(const VulkanApi& api, PipelineType pipelineType): @@ -2835,6 +2827,11 @@ void VKRenderer::setDescriptorSet(PipelineType pipelineType, IPipelineLayout* la Result VKRenderer::createProgram(const IShaderProgram::Desc& desc, IShaderProgram** outProgram) { + if( desc.kernelCount == 0 ) + { + return createProgramFromSlang(this, desc, outProgram); + } + RefPtr impl = new ShaderProgramImpl(m_api, desc.pipelineType); if( desc.pipelineType == PipelineType::Compute) { @@ -2849,6 +2846,7 @@ Result VKRenderer::createProgram(const IShaderProgram::Desc& desc, IShaderProgra impl->m_vertex = compileEntryPoint(*vertexKernel, VK_SHADER_STAGE_VERTEX_BIT, impl->m_buffers[0], impl->m_modules[0]); impl->m_fragment = compileEntryPoint(*fragmentKernel, VK_SHADER_STAGE_FRAGMENT_BIT, impl->m_buffers[1], impl->m_modules[1]); } + initProgramCommon(impl, desc); *outProgram = impl.detach(); return SLANG_OK; } -- cgit v1.2.3