summaryrefslogtreecommitdiff
path: root/tools/gfx/d3d11/render-d3d11.cpp
diff options
context:
space:
mode:
authorTim Foley <tfoleyNV@users.noreply.github.com>2021-01-26 13:32:03 -0800
committerGitHub <noreply@github.com>2021-01-26 13:32:03 -0800
commita90c850735664e2928e4cc961442a126c6859b97 (patch)
tree8b5e12113319ae87c57f5e616408eb955fe85a2c /tools/gfx/d3d11/render-d3d11.cpp
parent50676c741e10ffe6f710c5de86387eaacd274a9a (diff)
Integrate reflection more deeply into gfx layer (#1677)
Diffstat (limited to 'tools/gfx/d3d11/render-d3d11.cpp')
-rw-r--r--tools/gfx/d3d11/render-d3d11.cpp17
1 files changed, 8 insertions, 9 deletions
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,17 +331,9 @@ public:
List<ComPtr<ID3D11SamplerState>> 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<IShaderProgram*>(this);
- return nullptr;
- }
- public:
ComPtr<ID3D11VertexShader> m_vertexShader;
ComPtr<ID3D11PixelShader> m_pixelShader;
ComPtr<ID3D11ComputeShader> m_computeShader;
@@ -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<ShaderProgramImpl> 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<ShaderProgramImpl> shaderProgram = new ShaderProgramImpl();
shaderProgram->m_vertexShader.swap(vertexShader);
shaderProgram->m_pixelShader.swap(pixelShader);
+ initProgramCommon(shaderProgram, desc);
*outProgram = shaderProgram.detach();
return SLANG_OK;