summaryrefslogtreecommitdiffstats
path: root/tools/gfx/vulkan/render-vk.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/vulkan/render-vk.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/vulkan/render-vk.cpp')
-rw-r--r--tools/gfx/vulkan/render-vk.cpp31
1 files changed, 29 insertions, 2 deletions
diff --git a/tools/gfx/vulkan/render-vk.cpp b/tools/gfx/vulkan/render-vk.cpp
index 5c3e75110..1fb06b8e7 100644
--- a/tools/gfx/vulkan/render-vk.cpp
+++ b/tools/gfx/vulkan/render-vk.cpp
@@ -106,6 +106,9 @@ 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;
@@ -3449,6 +3452,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;
+ }
+
/// Bind this object as a root shader object
Result bindAsRoot(
PipelineCommandEncoder* encoder,
@@ -6744,8 +6762,8 @@ Result VKDevice::getTextureAllocationInfo(
VkMemoryRequirements memRequirements;
m_api.vkGetImageMemoryRequirements(m_device, image, &memRequirements);
- *outSize = memRequirements.size;
- *outAlignment = memRequirements.alignment;
+ *outSize = (size_t)memRequirements.size;
+ *outAlignment = (size_t)memRequirements.alignment;
m_api.vkDestroyImage(m_device, image, nullptr);
return SLANG_OK;
@@ -7555,6 +7573,15 @@ Result VKDevice::createMutableShaderObject(
return SLANG_OK;
}
+Result VKDevice::createMutableRootShaderObject(
+ IShaderProgram* program, IShaderObject** outObject)
+{
+ RefPtr<MutableRootShaderObject> result =
+ new MutableRootShaderObject(this, static_cast<ShaderProgramBase*>(program));
+ returnComPtr(outObject, result);
+ return SLANG_OK;
+}
+
Result VKDevice::createGraphicsPipelineState(const GraphicsPipelineStateDesc& inDesc, IPipelineState** outState)
{
GraphicsPipelineStateDesc desc = inDesc;