From c6f6ce12ec522b193b42bcd12d3a2540c7a6ff92 Mon Sep 17 00:00:00 2001 From: Yong He Date: Wed, 28 Jul 2021 12:24:12 -0700 Subject: Experimental DXR1.0 support in gfx. (#1915) * Experimental DXR1.0 support in gfx. - Add `dispatchRays` command. - Add `createRayTracingPipelineState` method to construct a D3D ray tracing state object from a linked slang program and user specified shader table. Limitations/simplifications: no local root signature support, shader table entries contains only shader identifiers and is specified at pipeline creation time, owned by the pipeline state object. * Root object binding for raytracing pipelines. * `maybeSpecializePipeline` implementation for raytracing pipelines. * Add ray-tracing-pipeline example. * Fixes. * Update README.md * Update comments on the lifespan of specialized pipelines Co-authored-by: Yong He Co-authored-by: jsmall-nvidia --- tools/gfx/vulkan/render-vk.cpp | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 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 bc0271aa6..592cbaac1 100644 --- a/tools/gfx/vulkan/render-vk.cpp +++ b/tools/gfx/vulkan/render-vk.cpp @@ -1266,7 +1266,7 @@ public: vkPushConstantRange.size = ordinaryDataSize; vkPushConstantRange.stageFlags = VK_SHADER_STAGE_ALL; // TODO: be more clever - while(m_ownPushConstantRanges.getCount() <= pushConstantRangeIndex) + while((uint32_t)m_ownPushConstantRanges.getCount() <= pushConstantRangeIndex) { VkPushConstantRange emptyRange = { 0 }; m_ownPushConstantRanges.add(emptyRange); @@ -2995,7 +2995,7 @@ public: case slang::BindingType::ConstantBuffer: { BindingOffset objOffset = rangeOffset; - for (uint32_t i = 0; i < count; ++i) + for (Index i = 0; i < count; ++i) { // Binding a constant buffer sub-object is simple enough: // we just call `bindAsConstantBuffer` on it to bind @@ -3016,7 +3016,7 @@ public: case slang::BindingType::ParameterBlock: { BindingOffset objOffset = rangeOffset; - for (uint32_t i = 0; i < count; ++i) + for (Index i = 0; i < count; ++i) { // The case for `ParameterBlock` is not that different // from `ConstantBuffer`, except that we call `bindAsParameterBlock` @@ -3047,7 +3047,7 @@ public: // SimpleBindingOffset objOffset = rangeOffset.pending; SimpleBindingOffset objStride = rangeStride.pending; - for (uint32_t i = 0; i < count; ++i) + for (Index i = 0; i < count; ++i) { // An existential-type sub-object is always bound just as a value, // which handles its nested bindings and descriptor sets, but @@ -4258,6 +4258,25 @@ public: _memoryBarrier(count, structures, srcAccess, destAccess); } + virtual SLANG_NO_THROW void SLANG_MCALL + bindPipeline(IPipelineState* pipeline, IShaderObject** outRootObject) override + { + SLANG_UNUSED(pipeline); + SLANG_UNUSED(outRootObject); + } + + virtual SLANG_NO_THROW void SLANG_MCALL dispatchRays( + const char* rayGenShaderName, + int32_t width, + int32_t height, + int32_t depth) override + { + SLANG_UNUSED(rayGenShaderName); + SLANG_UNUSED(width); + SLANG_UNUSED(height); + SLANG_UNUSED(depth); + } + virtual SLANG_NO_THROW void SLANG_MCALL endEncoding() override { } -- cgit v1.2.3