summaryrefslogtreecommitdiff
path: root/tools/gfx/vulkan/render-vk.cpp
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2021-11-04 09:40:56 -0700
committerGitHub <noreply@github.com>2021-11-04 09:40:56 -0700
commit8fe3f9cd7d664fc98e33cf276427390b42b9b468 (patch)
tree2e920085fc82f45befef0c438357596e3d159e82 /tools/gfx/vulkan/render-vk.cpp
parentaf0f26d54ce39b6d7203646abd6e970b8113584c (diff)
Add interface for new gfx features. (#2003)
* Add interface for new gfx features. * Add cuda implementation. * Code review fixes. * Fix. 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.cpp111
1 files changed, 103 insertions, 8 deletions
diff --git a/tools/gfx/vulkan/render-vk.cpp b/tools/gfx/vulkan/render-vk.cpp
index 3a1557a3c..1b538f992 100644
--- a/tools/gfx/vulkan/render-vk.cpp
+++ b/tools/gfx/vulkan/render-vk.cpp
@@ -3693,6 +3693,13 @@ public:
return setPipelineStateImpl(pipelineState, outRootObject);
}
+ virtual SLANG_NO_THROW Result SLANG_MCALL
+ bindPipelineAndRootObject(IPipelineState* state, IShaderObject* rootObject) override
+ {
+ SLANG_UNIMPLEMENTED_X("bindPipelineAndRootObject");
+ return SLANG_E_NOT_AVAILABLE;
+ }
+
virtual SLANG_NO_THROW void SLANG_MCALL
setViewports(uint32_t count, const Viewport* viewports) override
{
@@ -3873,6 +3880,36 @@ public:
api.vkCmdSetStencilReference(
m_vkCommandBuffer, VK_STENCIL_FRONT_AND_BACK, referenceValue);
}
+
+ virtual SLANG_NO_THROW void SLANG_MCALL drawIndirect(
+ uint32_t maxDrawCount,
+ IBufferResource* argBuffer,
+ uint64_t argOffset,
+ IBufferResource* countBuffer,
+ uint64_t countOffset) override
+ {
+ SLANG_UNUSED(maxDrawCount);
+ SLANG_UNUSED(argBuffer);
+ SLANG_UNUSED(argOffset);
+ SLANG_UNUSED(countBuffer);
+ SLANG_UNUSED(countOffset);
+ SLANG_UNIMPLEMENTED_X("drawIndirect");
+ }
+
+ virtual SLANG_NO_THROW void SLANG_MCALL drawIndexedIndirect(
+ uint32_t maxDrawCount,
+ IBufferResource* argBuffer,
+ uint64_t argOffset,
+ IBufferResource* countBuffer,
+ uint64_t countOffset) override
+ {
+ SLANG_UNUSED(maxDrawCount);
+ SLANG_UNUSED(argBuffer);
+ SLANG_UNUSED(argOffset);
+ SLANG_UNUSED(countBuffer);
+ SLANG_UNUSED(countOffset);
+ SLANG_UNIMPLEMENTED_X("drawIndirect");
+ }
};
RefPtr<RenderCommandEncoder> m_renderCommandEncoder;
@@ -3907,6 +3944,13 @@ public:
return setPipelineStateImpl(pipelineState, outRootObject);
}
+ virtual SLANG_NO_THROW Result SLANG_MCALL
+ bindPipelineAndRootObject(IPipelineState* state, IShaderObject* rootObject) override
+ {
+ SLANG_UNIMPLEMENTED_X("bindPipelineAndRootObject");
+ return SLANG_E_NOT_AVAILABLE;
+ }
+
virtual SLANG_NO_THROW void SLANG_MCALL dispatchCompute(int x, int y, int z) override
{
auto pipeline = static_cast<PipelineStateImpl*>(m_currentPipeline.Ptr());
@@ -3927,6 +3971,12 @@ public:
{
_writeTimestamp(m_api, m_vkCommandBuffer, queryPool, index);
}
+
+ virtual SLANG_NO_THROW void SLANG_MCALL
+ dispatchComputeIndirect(IBufferResource* argBuffer, uint64_t offset) override
+ {
+ SLANG_UNIMPLEMENTED_X("dispatchComputeIndirect");
+ }
};
RefPtr<ComputeCommandEncoder> m_computeCommandEncoder;
@@ -4198,6 +4248,42 @@ public:
{
m_commandBuffer = commandBuffer;
}
+
+ virtual SLANG_NO_THROW void SLANG_MCALL copyTexture(
+ ITextureResource* dst,
+ ITextureResource::SubresourceRange dstSubresource,
+ ITextureResource::Offset3D dstOffset,
+ ITextureResource* src,
+ ITextureResource::SubresourceRange srcSubresource,
+ ITextureResource::Offset3D srcOffset,
+ ITextureResource::Size extent) override
+ {
+ SLANG_UNUSED(dst);
+ SLANG_UNUSED(dstSubresource);
+ SLANG_UNUSED(dstOffset);
+ SLANG_UNUSED(src);
+ SLANG_UNUSED(srcSubresource);
+ SLANG_UNUSED(srcOffset);
+ SLANG_UNUSED(extent);
+ SLANG_UNIMPLEMENTED_X("copyTexture");
+ }
+
+ virtual SLANG_NO_THROW void SLANG_MCALL uploadTextureData(
+ ITextureResource* dst,
+ ITextureResource::SubresourceRange subResourceRange,
+ ITextureResource::Offset3D offset,
+ ITextureResource::Offset3D extend,
+ ITextureResource::SubresourceData* subResourceData,
+ size_t subResourceDataCount) override
+ {
+ SLANG_UNUSED(dst);
+ SLANG_UNUSED(subResourceRange);
+ SLANG_UNUSED(offset);
+ SLANG_UNUSED(extend);
+ SLANG_UNUSED(subResourceData);
+ SLANG_UNUSED(subResourceDataCount);
+ SLANG_UNIMPLEMENTED_X("uploadTextureData");
+ }
};
RefPtr<ResourceCommandEncoder> m_resourceCommandEncoder;
@@ -4443,12 +4529,20 @@ public:
}
virtual SLANG_NO_THROW void SLANG_MCALL
- bindPipeline(IPipelineState* pipeline, IShaderObject** outRootObject) override
+ bindPipeline(IPipelineState* pipeline, IShaderObject** outRootObject) override
{
SLANG_UNUSED(pipeline);
SLANG_UNUSED(outRootObject);
}
+ virtual SLANG_NO_THROW void SLANG_MCALL
+ bindPipelineAndRootObject(IPipelineState* state, IShaderObject* rootObject) override
+ {
+ SLANG_UNUSED(state);
+ SLANG_UNUSED(rootObject);
+ SLANG_UNIMPLEMENTED_X("bindPipelineAndRootObject");
+ }
+
virtual SLANG_NO_THROW void SLANG_MCALL dispatchRays(
const char* rayGenShaderName,
int32_t width,
@@ -4596,11 +4690,12 @@ public:
return m_desc;
}
- virtual SLANG_NO_THROW void SLANG_MCALL
- executeCommandBuffers(
- uint32_t count,
- ICommandBuffer* const* commandBuffers) override
+ virtual SLANG_NO_THROW void SLANG_MCALL executeCommandBuffers(
+ uint32_t count, ICommandBuffer* const* commandBuffers, IFence* fence) override
{
+ // TODO: implement fence signaling.
+ assert(fence == nullptr);
+
if (count == 0)
return;
@@ -4639,9 +4734,9 @@ public:
submitInfo.pSignalSemaphores = &signalSemaphore;
auto commandBufferImpl = static_cast<CommandBufferImpl*>(commandBuffers[0]);
- auto fence = commandBufferImpl->m_transientHeap->getCurrentFence();
- vkAPI.vkResetFences(vkAPI.m_device, 1, &fence);
- vkAPI.vkQueueSubmit(m_queue, 1, &submitInfo, fence);
+ auto vkFence = commandBufferImpl->m_transientHeap->getCurrentFence();
+ vkAPI.vkResetFences(vkAPI.m_device, 1, &vkFence);
+ vkAPI.vkQueueSubmit(m_queue, 1, &submitInfo, vkFence);
m_pendingWaitSemaphores[0] = signalSemaphore;
m_pendingWaitSemaphores[1] = VK_NULL_HANDLE;
commandBufferImpl->m_transientHeap->advanceFence();