summaryrefslogtreecommitdiffstats
path: root/tools/gfx/d3d12/render-d3d12.cpp
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2021-12-06 09:06:16 -0800
committerGitHub <noreply@github.com>2021-12-06 09:06:16 -0800
commit5cbd61774c6ef2209fa0afc79b1dbbb68514346b (patch)
tree5d1eaaa4f8ed16b5b3fe005b3dfd2488ad462b87 /tools/gfx/d3d12/render-d3d12.cpp
parentda6be80f18014a3972eedf05099cd0066e9eae04 (diff)
gfx Mutable Root shader object implementation. (#2042)
* gfx Mutable Root shader object implementation. * Fix x86 build. Co-authored-by: Yong He <yhe@nvidia.com>
Diffstat (limited to 'tools/gfx/d3d12/render-d3d12.cpp')
-rw-r--r--tools/gfx/d3d12/render-d3d12.cpp29
1 files changed, 27 insertions, 2 deletions
diff --git a/tools/gfx/d3d12/render-d3d12.cpp b/tools/gfx/d3d12/render-d3d12.cpp
index 4d5845b85..5a0478f68 100644
--- a/tools/gfx/d3d12/render-d3d12.cpp
+++ b/tools/gfx/d3d12/render-d3d12.cpp
@@ -131,6 +131,8 @@ public:
override;
virtual Result createMutableShaderObject(
ShaderObjectLayoutBase* layout, IShaderObject** outObject) override;
+ virtual SLANG_NO_THROW Result SLANG_MCALL
+ createMutableRootShaderObject(IShaderProgram* program, IShaderObject** outObject) override;
virtual SLANG_NO_THROW Result SLANG_MCALL
createProgram(const IShaderProgram::Desc& desc, IShaderProgram** outProgram) override;
@@ -2819,6 +2821,21 @@ public:
return SLANG_OK;
}
+ virtual SLANG_NO_THROW Result SLANG_MCALL
+ copyFrom(IShaderObject* object, ITransientResourceHeap* transientHeap) override
+ {
+ SLANG_RETURN_ON_FAIL(Super::copyFrom(object, transientHeap));
+ if (auto srcObj = dynamic_cast<MutableRootShaderObject*>(object))
+ {
+ for (Index i = 0; i < srcObj->m_entryPoints.getCount(); i++)
+ {
+ m_entryPoints[i]->copyFrom(srcObj->m_entryPoints[i], transientHeap);
+ }
+ return SLANG_OK;
+ }
+ return SLANG_FAIL;
+ }
+
public:
Result bindAsRoot(
BindingContext* context,
@@ -4935,8 +4952,8 @@ Result D3D12Device::getTextureAllocationInfo(
D3D12_RESOURCE_DESC resourceDesc = {};
setupResourceDesc(resourceDesc, srcDesc);
auto allocInfo = m_device->GetResourceAllocationInfo(0xFF, 1, &resourceDesc);
- *outSize = allocInfo.SizeInBytes;
- *outAlignment = allocInfo.Alignment;
+ *outSize = (size_t)allocInfo.SizeInBytes;
+ *outAlignment = (size_t)allocInfo.Alignment;
return SLANG_OK;
}
@@ -5843,6 +5860,14 @@ Result D3D12Device::createMutableShaderObject(
return SLANG_OK;
}
+Result D3D12Device::createMutableRootShaderObject(IShaderProgram* program, IShaderObject** outObject)
+{
+ RefPtr<MutableRootShaderObject> result =
+ new MutableRootShaderObject(this, static_cast<ShaderProgramBase*>(program));
+ returnComPtr(outObject, result);
+ return SLANG_OK;
+}
+
Result D3D12Device::createGraphicsPipelineState(const GraphicsPipelineStateDesc& inDesc, IPipelineState** outState)
{
GraphicsPipelineStateDesc desc = inDesc;