diff options
| author | Yong He <yonghe@outlook.com> | 2021-11-15 13:52:37 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-11-15 13:52:37 -0800 |
| commit | ae9df74fce7e3583effc822b3003542cf753823d (patch) | |
| tree | 3bfff7def0c448a868876e0656babd2c84472fca /tools/gfx | |
| parent | 7a4f08ee0411220c728bf42832d98e72d72167e2 (diff) | |
Update gfx interface. (#2015)
Diffstat (limited to 'tools/gfx')
| -rw-r--r-- | tools/gfx/cuda/render-cuda.cpp | 10 | ||||
| -rw-r--r-- | tools/gfx/d3d12/render-d3d12.cpp | 24 | ||||
| -rw-r--r-- | tools/gfx/debug-layer.cpp | 53 | ||||
| -rw-r--r-- | tools/gfx/debug-layer.h | 25 | ||||
| -rw-r--r-- | tools/gfx/immediate-renderer-base.cpp | 16 | ||||
| -rw-r--r-- | tools/gfx/renderer-shared.cpp | 5 | ||||
| -rw-r--r-- | tools/gfx/renderer-shared.h | 8 | ||||
| -rw-r--r-- | tools/gfx/vulkan/render-vk.cpp | 24 |
8 files changed, 47 insertions, 118 deletions
diff --git a/tools/gfx/cuda/render-cuda.cpp b/tools/gfx/cuda/render-cuda.cpp index 9f52c4c62..e9a9960ad 100644 --- a/tools/gfx/cuda/render-cuda.cpp +++ b/tools/gfx/cuda/render-cuda.cpp @@ -956,13 +956,6 @@ public: return SLANG_OK; } - 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 { m_writer->bindRootShaderObject(m_rootObject); @@ -1141,8 +1134,9 @@ public: } virtual SLANG_NO_THROW void SLANG_MCALL executeCommandBuffers( - uint32_t count, ICommandBuffer* const* commandBuffers, IFence* fence) override + uint32_t count, ICommandBuffer* const* commandBuffers, IFence* fence, uint64_t valueToSignal) override { + SLANG_UNUSED(valueToSignal); // TODO: implement fence. assert(fence == nullptr); for (uint32_t i = 0; i < count; i++) diff --git a/tools/gfx/d3d12/render-d3d12.cpp b/tools/gfx/d3d12/render-d3d12.cpp index accd9297c..bbe7e4bdc 100644 --- a/tools/gfx/d3d12/render-d3d12.cpp +++ b/tools/gfx/d3d12/render-d3d12.cpp @@ -3157,13 +3157,6 @@ public: { return bindPipelineImpl(state, 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 @@ -3454,13 +3447,6 @@ public: return bindPipelineImpl(state, 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 { // Submit binding for compute @@ -3632,8 +3618,6 @@ public: AccessFlag::Enum destAccess) override; virtual SLANG_NO_THROW void SLANG_MCALL bindPipeline(IPipelineState* state, IShaderObject** outRootObject) override; - virtual SLANG_NO_THROW void SLANG_MCALL bindPipelineAndRootObject( - IPipelineState* state, IShaderObject* rootObject) override; virtual SLANG_NO_THROW void SLANG_MCALL dispatchRays( const char* rayGenShaderName, int32_t width, @@ -3725,7 +3709,7 @@ public: } virtual SLANG_NO_THROW void SLANG_MCALL - executeCommandBuffers(uint32_t count, ICommandBuffer* const* commandBuffers, IFence* fence) override + executeCommandBuffers(uint32_t count, ICommandBuffer* const* commandBuffers, IFence* fence, uint64_t valueToSignal) override { // TODO: implement fence signal. assert(fence == nullptr); @@ -6162,12 +6146,6 @@ void D3D12Device::CommandBufferImpl::RayTracingCommandEncoderImpl::bindPipeline( bindPipelineImpl(state, outRootObject); } -void D3D12Device::CommandBufferImpl::RayTracingCommandEncoderImpl::bindPipelineAndRootObject( - IPipelineState* state, IShaderObject* rootObject) -{ - SLANG_UNIMPLEMENTED_X("bindPipelineAndRootObject"); -} - void D3D12Device::CommandBufferImpl::RayTracingCommandEncoderImpl::dispatchRays( const char* rayGenShaderName, int32_t width, diff --git a/tools/gfx/debug-layer.cpp b/tools/gfx/debug-layer.cpp index e01773c30..90997edda 100644 --- a/tools/gfx/debug-layer.cpp +++ b/tools/gfx/debug-layer.cpp @@ -764,10 +764,10 @@ Result DebugDevice::createFence(const IFence::Desc& desc, IFence** outFence) } Result DebugDevice::waitForFences( - IFence** fences, uint32_t fenceCount, bool waitForAll, uint64_t timeout) + uint32_t fenceCount, IFence** fences, uint64_t* values , bool waitForAll, uint64_t timeout) { SLANG_GFX_API_FUNC; - return baseObject->waitForFences(fences, fenceCount, waitForAll, timeout); + return baseObject->waitForFences(fenceCount, fences, values, waitForAll, timeout); } IResource::Type DebugBufferResource::getType() @@ -1001,13 +1001,6 @@ Result DebugComputeCommandEncoder::bindPipeline( return result; } -Result DebugComputeCommandEncoder::bindPipelineAndRootObject( - IPipelineState* state, IShaderObject* rootObject) -{ - SLANG_GFX_API_FUNC; - return baseObject->bindPipelineAndRootObject(getInnerObj(state), getInnerObj(rootObject)); -} - void DebugComputeCommandEncoder::dispatchCompute(int x, int y, int z) { SLANG_GFX_API_FUNC; @@ -1049,13 +1042,6 @@ Result DebugRenderCommandEncoder::bindPipeline( return result; } -Result DebugRenderCommandEncoder::bindPipelineAndRootObject( - IPipelineState* state, IShaderObject* rootObject) -{ - SLANG_GFX_API_FUNC; - return baseObject->bindPipelineAndRootObject(getInnerObj(state), getInnerObj(rootObject)); -} - void DebugRenderCommandEncoder::setViewports(uint32_t count, const Viewport* viewports) { SLANG_GFX_API_FUNC; @@ -1361,13 +1347,6 @@ void DebugRayTracingCommandEncoder::bindPipeline( *outRootObject = &commandBuffer->rootObject; } -void DebugRayTracingCommandEncoder::bindPipelineAndRootObject( - IPipelineState* state, IShaderObject* rootObject) -{ - SLANG_GFX_API_FUNC; - baseObject->bindPipelineAndRootObject(getInnerObj(state), getInnerObj(rootObject)); -} - void DebugRayTracingCommandEncoder::dispatchRays( const char* rayGenShaderName, int32_t width, @@ -1384,7 +1363,7 @@ const ICommandQueue::Desc& DebugCommandQueue::getDesc() return baseObject->getDesc(); } -void DebugCommandQueue::executeCommandBuffers(uint32_t count, ICommandBuffer* const* commandBuffers, IFence* fence) +void DebugCommandQueue::executeCommandBuffers(uint32_t count, ICommandBuffer* const* commandBuffers, IFence* fence, uint64_t valueToSignal) { SLANG_GFX_API_FUNC; List<ICommandBuffer*> innerCommandBuffers; @@ -1410,7 +1389,7 @@ void DebugCommandQueue::executeCommandBuffers(uint32_t count, ICommandBuffer* co } } } - baseObject->executeCommandBuffers(count, innerCommandBuffers.getBuffer(), getInnerObj(fence)); + baseObject->executeCommandBuffers(count, innerCommandBuffers.getBuffer(), getInnerObj(fence), valueToSignal); } void DebugCommandQueue::wait() { baseObject->wait(); } @@ -1615,12 +1594,14 @@ Result DebugShaderObject::setSpecializationArgs( const slang::SpecializationArg* args, uint32_t count) { + SLANG_GFX_API_FUNC; return baseObject->setSpecializationArgs(offset, args, count); } Result DebugShaderObject::getCurrentVersion( ITransientResourceHeap* transientHeap, IShaderObject** outObject) { + SLANG_GFX_API_FUNC; ComPtr<IShaderObject> innerObject; SLANG_RETURN_ON_FAIL(baseObject->getCurrentVersion(getInnerObj(transientHeap), innerObject.writeRef())); RefPtr<DebugShaderObject> debugShaderObject = new DebugShaderObject(); @@ -1630,6 +1611,12 @@ Result DebugShaderObject::getCurrentVersion( return SLANG_OK; } +Result DebugShaderObject::copyFrom(IShaderObject* other) +{ + SLANG_GFX_API_FUNC; + return baseObject->copyFrom(getInnerObj(other)); +} + DebugObjectBase::DebugObjectBase() { static uint64_t uidCounter = 0; @@ -1685,28 +1672,28 @@ IResourceView::Desc* DebugAccelerationStructure::getViewDesc() return baseObject->getViewDesc(); } -IFence::FenceStatus DebugFence::getStatus() +Result DebugFence::getSharedHandle(InteropHandle* outHandle) { SLANG_GFX_API_FUNC; - return baseObject->getStatus(); + return baseObject->getSharedHandle(outHandle); } -Result DebugFence::reset() +Result DebugFence::getNativeHandle(InteropHandle* outNativeHandle) { SLANG_GFX_API_FUNC; - return baseObject->reset(); + return baseObject->getNativeHandle(outNativeHandle); } -Result DebugFence::getSharedHandle(uint64_t* outHandle) +Result DebugFence::getCurrentValue(uint64_t* outValue) { SLANG_GFX_API_FUNC; - return baseObject->getSharedHandle(outHandle); + return baseObject->getCurrentValue(outValue); } -Result DebugFence::getNativeHandle(void** outNativeHandle) +Result DebugFence::setCurrentValue(uint64_t value) { SLANG_GFX_API_FUNC; - return baseObject->getNativeHandle(outNativeHandle); + return baseObject->setCurrentValue(value); } } // namespace gfx diff --git a/tools/gfx/debug-layer.h b/tools/gfx/debug-layer.h index f1167fe63..b7cb9e353 100644 --- a/tools/gfx/debug-layer.h +++ b/tools/gfx/debug-layer.h @@ -144,8 +144,12 @@ public: IQueryPool** outPool) override; virtual SLANG_NO_THROW Result SLANG_MCALL createFence(const IFence::Desc& desc, IFence** outFence) override; - virtual SLANG_NO_THROW Result SLANG_MCALL - waitForFences(IFence** fences, uint32_t fenceCount, bool waitForAll, uint64_t timeout) override; + virtual SLANG_NO_THROW Result SLANG_MCALL waitForFences( + uint32_t fenceCount, + IFence** fences, + uint64_t* values, + bool waitForAll, + uint64_t timeout) override; }; class DebugQueryPool : public DebugObject<IQueryPool> @@ -274,6 +278,7 @@ public: virtual SLANG_NO_THROW Result SLANG_MCALL getCurrentVersion( ITransientResourceHeap* transientHeap, IShaderObject** outObject) override; + virtual SLANG_NO_THROW Result SLANG_MCALL copyFrom(IShaderObject* other) override; public: Slang::String m_typeName; @@ -305,8 +310,6 @@ public: virtual SLANG_NO_THROW void SLANG_MCALL endEncoding() override; virtual SLANG_NO_THROW Result SLANG_MCALL bindPipeline(IPipelineState* state, IShaderObject** outRootShaderObject) override; - virtual SLANG_NO_THROW Result SLANG_MCALL - bindPipelineAndRootObject(IPipelineState* state, IShaderObject* rootObject) override; virtual SLANG_NO_THROW void SLANG_MCALL dispatchCompute(int x, int y, int z) override; virtual SLANG_NO_THROW void SLANG_MCALL dispatchComputeIndirect(IBufferResource* cmdBuffer, uint64_t offset) override; @@ -323,8 +326,6 @@ public: virtual SLANG_NO_THROW void SLANG_MCALL endEncoding() override; virtual SLANG_NO_THROW Result SLANG_MCALL bindPipeline(IPipelineState* state, IShaderObject** outRootShaderObject) override; - virtual SLANG_NO_THROW Result SLANG_MCALL - bindPipelineAndRootObject(IPipelineState* state, IShaderObject* rootObject) override; virtual SLANG_NO_THROW void SLANG_MCALL setViewports(uint32_t count, const Viewport* viewports) override; virtual SLANG_NO_THROW void SLANG_MCALL @@ -438,8 +439,6 @@ public: AccessFlag::Enum destAccess) override; virtual SLANG_NO_THROW void SLANG_MCALL bindPipeline(IPipelineState* state, IShaderObject** outRootObject) override; - virtual SLANG_NO_THROW void SLANG_MCALL - bindPipelineAndRootObject(IPipelineState* state, IShaderObject* rootObject) override; virtual SLANG_NO_THROW void SLANG_MCALL dispatchRays( const char* rayGenShaderName, int32_t width, @@ -456,10 +455,10 @@ class DebugFence : public DebugObject<IFence> public: SLANG_COM_OBJECT_IUNKNOWN_ALL; IFence* getInterface(const Slang::Guid& guid); - virtual SLANG_NO_THROW FenceStatus SLANG_MCALL getStatus() override; - virtual SLANG_NO_THROW Result SLANG_MCALL reset() override; - virtual SLANG_NO_THROW Result SLANG_MCALL getSharedHandle(uint64_t* outHandle) override; - virtual SLANG_NO_THROW Result SLANG_MCALL getNativeHandle(void** outNativeHandle) override; + virtual SLANG_NO_THROW Result SLANG_MCALL getCurrentValue(uint64_t* outValue) override; + virtual SLANG_NO_THROW Result SLANG_MCALL setCurrentValue(uint64_t value) override; + virtual SLANG_NO_THROW Result SLANG_MCALL getSharedHandle(InteropHandle* outHandle) override; + virtual SLANG_NO_THROW Result SLANG_MCALL getNativeHandle(InteropHandle* outNativeHandle) override; }; class DebugTransientResourceHeap; @@ -511,7 +510,7 @@ public: ICommandQueue* getInterface(const Slang::Guid& guid); virtual SLANG_NO_THROW const Desc& SLANG_MCALL getDesc() override; virtual SLANG_NO_THROW void SLANG_MCALL - executeCommandBuffers(uint32_t count, ICommandBuffer* const* commandBuffers, IFence* fence) override; + executeCommandBuffers(uint32_t count, ICommandBuffer* const* commandBuffers, IFence* fence, uint64_t valueToSignal) override; virtual SLANG_NO_THROW void SLANG_MCALL wait() override; virtual SLANG_NO_THROW Result SLANG_MCALL getNativeHandle(NativeHandle* outHandle) override; }; diff --git a/tools/gfx/immediate-renderer-base.cpp b/tools/gfx/immediate-renderer-base.cpp index 774162eb3..33a578a4f 100644 --- a/tools/gfx/immediate-renderer-base.cpp +++ b/tools/gfx/immediate-renderer-base.cpp @@ -154,13 +154,6 @@ public: m_writer->writeTimestamp(pool, index); } - virtual SLANG_NO_THROW Result SLANG_MCALL - bindPipelineAndRootObject(IPipelineState* state, IShaderObject* rootObject) override - { - SLANG_UNIMPLEMENTED_X("ImmediateRenderBase::bindPipelineAndRootObject"); - return SLANG_E_NOT_AVAILABLE; - } - virtual SLANG_NO_THROW void SLANG_MCALL drawIndirect( uint32_t maxDrawCount, IBufferResource* argBuffer, @@ -233,13 +226,6 @@ public: return SLANG_OK; } - virtual SLANG_NO_THROW Result SLANG_MCALL - bindPipelineAndRootObject(IPipelineState* state, IShaderObject* rootObject) override - { - SLANG_UNIMPLEMENTED_X("ImmediateRenderBase::bindPipelineAndRootObject"); - return SLANG_E_NOT_AVAILABLE; - } - virtual SLANG_NO_THROW void SLANG_MCALL dispatchCompute(int x, int y, int z) override { m_writer->bindRootShaderObject(m_commandBuffer->m_rootShaderObject); @@ -494,7 +480,7 @@ public: virtual SLANG_NO_THROW const Desc& SLANG_MCALL getDesc() override { return m_desc; } virtual SLANG_NO_THROW void SLANG_MCALL executeCommandBuffers( - uint32_t count, ICommandBuffer* const* commandBuffers, IFence* fence) override + uint32_t count, ICommandBuffer* const* commandBuffers, IFence* fence, uint64_t valueToSignal) override { // TODO: implement fence signal. assert(fence == nullptr); diff --git a/tools/gfx/renderer-shared.cpp b/tools/gfx/renderer-shared.cpp index 7dbee8ed5..705f1f95d 100644 --- a/tools/gfx/renderer-shared.cpp +++ b/tools/gfx/renderer-shared.cpp @@ -440,10 +440,11 @@ Result RendererBase::createFence(const IFence::Desc& desc, IFence** outFence) } Result RendererBase::waitForFences( - IFence** fences, uint32_t fenceCount, bool waitForAll, uint64_t timeout) + uint32_t fenceCount, IFence** fences, uint64_t* fenceValues, bool waitForAll, uint64_t timeout) { - SLANG_UNUSED(fences); SLANG_UNUSED(fenceCount); + SLANG_UNUSED(fences); + SLANG_UNUSED(fenceValues); SLANG_UNUSED(waitForAll); SLANG_UNUSED(timeout); return SLANG_E_NOT_AVAILABLE; diff --git a/tools/gfx/renderer-shared.h b/tools/gfx/renderer-shared.h index 504f49bd7..eeb10b527 100644 --- a/tools/gfx/renderer-shared.h +++ b/tools/gfx/renderer-shared.h @@ -536,6 +536,12 @@ public: SLANG_UNUSED(outObject); return SLANG_E_NOT_AVAILABLE; } + + virtual SLANG_NO_THROW Result SLANG_MCALL copyFrom(IShaderObject* other) override + { + SLANG_UNUSED(other); + return SLANG_E_NOT_AVAILABLE; + } }; template<typename TShaderObjectImpl, typename TShaderObjectLayoutImpl, typename TShaderObjectData> @@ -1233,7 +1239,7 @@ public: // Provides a default implementation that returns SLANG_E_NOT_AVAILABLE. virtual SLANG_NO_THROW Result SLANG_MCALL - waitForFences(IFence** fences, uint32_t fenceCount, bool waitForAll, uint64_t timeout) override; + waitForFences(uint32_t fenceCount, IFence** fences, uint64_t* fenceValues, bool waitForAll, uint64_t timeout) override; Result getShaderObjectLayout( slang::TypeReflection* type, diff --git a/tools/gfx/vulkan/render-vk.cpp b/tools/gfx/vulkan/render-vk.cpp index a3f5e078b..2a48e60d8 100644 --- a/tools/gfx/vulkan/render-vk.cpp +++ b/tools/gfx/vulkan/render-vk.cpp @@ -3756,13 +3756,6 @@ 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 { @@ -4007,13 +4000,6 @@ 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()); @@ -4598,14 +4584,6 @@ public: 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, @@ -4754,7 +4732,7 @@ public: } virtual SLANG_NO_THROW void SLANG_MCALL executeCommandBuffers( - uint32_t count, ICommandBuffer* const* commandBuffers, IFence* fence) override + uint32_t count, ICommandBuffer* const* commandBuffers, IFence* fence, uint64_t valueToSignal) override { // TODO: implement fence signaling. assert(fence == nullptr); |
