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/d3d11/render-d3d11.cpp | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'tools/gfx/d3d11/render-d3d11.cpp') diff --git a/tools/gfx/d3d11/render-d3d11.cpp b/tools/gfx/d3d11/render-d3d11.cpp index a2cf63a8f..40e617a1f 100644 --- a/tools/gfx/d3d11/render-d3d11.cpp +++ b/tools/gfx/d3d11/render-d3d11.cpp @@ -331,16 +331,8 @@ public: List> m_samplers; }; - 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: ComPtr m_vertexShader; ComPtr m_pixelShader; @@ -1785,6 +1777,11 @@ void D3D11Renderer::drawIndexed(UInt indexCount, UInt startIndex, UInt baseVerte Result D3D11Renderer::createProgram(const IShaderProgram::Desc& desc, IShaderProgram** outProgram) { + if( desc.kernelCount == 0 ) + { + return createProgramFromSlang(this, desc, outProgram); + } + if (desc.pipelineType == PipelineType::Compute) { auto computeKernel = desc.findKernel(StageType::Compute); @@ -1799,6 +1796,7 @@ Result D3D11Renderer::createProgram(const IShaderProgram::Desc& desc, IShaderPro RefPtr shaderProgram = new ShaderProgramImpl(); shaderProgram->m_computeShader.swap(computeShader); + initProgramCommon(shaderProgram, desc); *outProgram = shaderProgram.detach(); return SLANG_OK; @@ -1822,6 +1820,7 @@ Result D3D11Renderer::createProgram(const IShaderProgram::Desc& desc, IShaderPro RefPtr shaderProgram = new ShaderProgramImpl(); shaderProgram->m_vertexShader.swap(vertexShader); shaderProgram->m_pixelShader.swap(pixelShader); + initProgramCommon(shaderProgram, desc); *outProgram = shaderProgram.detach(); return SLANG_OK; -- cgit v1.2.3