From 470ca17fb5109cf366f4366e142395df5235c5e3 Mon Sep 17 00:00:00 2001 From: Simon Kallweit Date: Sat, 31 Aug 2024 02:42:57 +0200 Subject: [PATCH] rename pipeline state -> pipeline --- CHANGELOG | 7 +++ include/slang-rhi.h | 50 ++++++++-------- src/command-writer.h | 8 +-- src/cpu/cpu-base.h | 2 +- src/cpu/cpu-device.cpp | 14 ++--- src/cpu/cpu-device.h | 6 +- src/cpu/cpu-pipeline-state.cpp | 4 +- src/cpu/cpu-pipeline-state.h | 4 +- src/cuda/cuda-base.h | 2 +- src/cuda/cuda-command-encoder.cpp | 12 ++-- src/cuda/cuda-command-encoder.h | 5 +- src/cuda/cuda-command-queue.cpp | 12 ++-- src/cuda/cuda-command-queue.h | 4 +- src/cuda/cuda-device.cpp | 10 ++-- src/cuda/cuda-device.h | 4 +- src/cuda/cuda-pipeline-state.cpp | 2 +- src/cuda/cuda-pipeline-state.h | 6 +- src/d3d11/d3d11-base.h | 6 +- src/d3d11/d3d11-device.cpp | 68 +++++++++++----------- src/d3d11/d3d11-device.h | 8 +-- src/d3d11/d3d11-pipeline-state.cpp | 8 +-- src/d3d11/d3d11-pipeline-state.h | 10 ++-- src/d3d12/d3d12-base.h | 4 +- src/d3d12/d3d12-command-encoder.cpp | 48 +++++++-------- src/d3d12/d3d12-command-encoder.h | 23 ++++---- src/d3d12/d3d12-device.cpp | 24 ++++---- src/d3d12/d3d12-device.h | 6 +- src/d3d12/d3d12-pipeline-state.cpp | 26 ++++----- src/d3d12/d3d12-pipeline-state.h | 18 +++--- src/d3d12/d3d12-shader-table.cpp | 4 +- src/d3d12/d3d12-shader-table.h | 2 +- src/d3d12/d3d12-submitter.cpp | 8 +-- src/d3d12/d3d12-submitter.h | 6 +- src/debug-layer/debug-base.h | 2 +- src/debug-layer/debug-command-encoder.cpp | 12 ++-- src/debug-layer/debug-command-encoder.h | 13 ++--- src/debug-layer/debug-device.cpp | 30 +++++----- src/debug-layer/debug-device.h | 6 +- src/debug-layer/debug-helper-functions.cpp | 2 +- src/debug-layer/debug-helper-functions.h | 2 +- src/debug-layer/debug-pipeline-state.cpp | 2 +- src/debug-layer/debug-pipeline-state.h | 4 +- src/immediate-renderer-base.cpp | 30 +++++----- src/immediate-renderer-base.h | 6 +- src/metal/metal-base.h | 4 +- src/metal/metal-command-encoder.cpp | 34 +++++------ src/metal/metal-command-encoder.h | 19 +++--- src/metal/metal-device.cpp | 20 +++---- src/metal/metal-device.h | 8 +-- src/metal/metal-pipeline-state.cpp | 26 ++++----- src/metal/metal-pipeline-state.h | 20 +++---- src/metal/metal-shader-table.cpp | 2 +- src/metal/metal-shader-table.h | 2 +- src/renderer-shared.cpp | 51 ++++++++-------- src/renderer-shared.h | 44 +++++++------- src/vulkan/vk-base.h | 4 +- src/vulkan/vk-command-encoder.cpp | 42 ++++++------- src/vulkan/vk-command-encoder.h | 21 +++---- src/vulkan/vk-device.cpp | 40 ++++++------- src/vulkan/vk-device.h | 10 ++-- src/vulkan/vk-pipeline-state.cpp | 58 +++++++++--------- src/vulkan/vk-pipeline-state.h | 28 ++++----- src/vulkan/vk-shader-table.cpp | 4 +- src/vulkan/vk-shader-table.h | 2 +- tests/test-buffer-barrier.cpp | 12 ++-- tests/test-compute-smoke.cpp | 8 +-- tests/test-compute-trivial.cpp | 8 +-- tests/test-create-buffer-from-handle.cpp | 8 +-- tests/test-existing-device-handle.cpp | 8 +-- tests/test-formats.cpp | 8 +-- tests/test-instanced-draw.cpp | 14 ++--- tests/test-link-time-constant.cpp | 8 +-- tests/test-link-time-default.cpp | 16 ++--- tests/test-link-time-options.cpp | 8 +-- tests/test-link-time-type.cpp | 8 +-- tests/test-mutable-shader-object.cpp | 10 ++-- tests/test-nested-parameter-block.cpp | 8 +-- tests/test-precompiled-module-2.cpp | 8 +-- tests/test-precompiled-module-cache.cpp | 8 +-- tests/test-precompiled-module.cpp | 8 +-- tests/test-ray-tracing.cpp | 12 ++-- tests/test-resolve-resource-tests.cpp | 8 +-- tests/test-root-mutable-shader-object.cpp | 10 ++-- tests/test-root-shader-parameter.cpp | 8 +-- tests/test-sampler-array.cpp | 8 +-- tests/test-shader-cache.cpp | 32 +++++----- tests/test-shared-buffer.cpp | 8 +-- tests/test-shared-texture.cpp | 8 +-- tests/test-swapchain.cpp | 8 +-- tests/test-texture-types.cpp | 16 ++--- tests/test-uint16-structured-buffer.cpp | 8 +-- 91 files changed, 616 insertions(+), 627 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 89fb47a8..a05f3010 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,10 @@ +- rename IPipelineState -> IPipeline +- rename IDevice::createRayTracingPipelineState -> IDevice::createRayTracingPipeline +- rename IDevice::createComputePipelineState -> IDevice::createComputePipeline +- rename IDevice::createGraphicsPipelineState -> IDevice::createRenderPipeline +- rename RayTracingPipelineStateDesc -> RayTracingPipelineDesc +- rename ComputePipelineStateDesc -> ComputePipelineDesc +- rename GraphicsPipelineStateDesc -> RenderPipelineDesc - remove SampleDesc and instead add sampleCount and sampleQuality to TextureDesc - rename ISamplerState -> ISampler - rename ISamplerState::Desc -> SamlerDesc diff --git a/include/slang-rhi.h b/include/slang-rhi.h index 7625b7ce..d94d6f2c 100644 --- a/include/slang-rhi.h +++ b/include/slang-rhi.h @@ -1289,7 +1289,7 @@ class IFramebufferLayout : public ISlangUnknown }; }; -struct GraphicsPipelineStateDesc +struct RenderPipelineDesc { IShaderProgram* program = nullptr; @@ -1301,7 +1301,7 @@ struct GraphicsPipelineStateDesc BlendDesc blend; }; -struct ComputePipelineStateDesc +struct ComputePipelineDesc { IShaderProgram* program = nullptr; void* d3d12RootSignatureOverride = nullptr; @@ -1325,7 +1325,7 @@ struct HitGroupDesc const char* intersectionEntryPoint = nullptr; }; -struct RayTracingPipelineStateDesc +struct RayTracingPipelineDesc { IShaderProgram* program = nullptr; GfxCount hitGroupCount = 0; @@ -1371,7 +1371,7 @@ class IShaderTable : public ISlangUnknown }; }; -class IPipelineState : public ISlangUnknown +class IPipeline : public ISlangUnknown { SLANG_COM_INTERFACE(0x2ad83bfc, 0x581d, 0x4b88, {0x81, 0x3c, 0x0c, 0x0e, 0xaf, 0x04, 0x0a, 0x00}); @@ -1651,9 +1651,8 @@ class IRenderCommandEncoder : public IResourceCommandEncoder // sub-shader-objects bound to it. The user must be responsible for ensuring that any // resources or shader objects that is set into `outRootShaderObject` stays alive during // the execution of the command buffer. - virtual SLANG_NO_THROW Result SLANG_MCALL - bindPipeline(IPipelineState* state, IShaderObject** outRootShaderObject) = 0; - inline IShaderObject* bindPipeline(IPipelineState* state) + virtual SLANG_NO_THROW Result SLANG_MCALL bindPipeline(IPipeline* state, IShaderObject** outRootShaderObject) = 0; + inline IShaderObject* bindPipeline(IPipeline* state) { IShaderObject* rootObject = nullptr; SLANG_RETURN_NULL_ON_FAIL(bindPipeline(state, &rootObject)); @@ -1662,7 +1661,7 @@ class IRenderCommandEncoder : public IResourceCommandEncoder // Sets the current pipeline state along with a pre-created mutable root shader object. virtual SLANG_NO_THROW Result SLANG_MCALL - bindPipelineWithRootObject(IPipelineState* state, IShaderObject* rootObject) = 0; + bindPipelineWithRootObject(IPipeline* state, IShaderObject* rootObject) = 0; virtual SLANG_NO_THROW void SLANG_MCALL setViewports(GfxCount count, const Viewport* viewports) = 0; virtual SLANG_NO_THROW void SLANG_MCALL setScissorRects(GfxCount count, const ScissorRect* scissors) = 0; @@ -1732,9 +1731,8 @@ class IComputeCommandEncoder : public IResourceCommandEncoder // sub-shader-objects bound to it. The user must be responsible for ensuring that any // resources or shader objects that is set into `outRooShaderObject` stays alive during // the execution of the command buffer. - virtual SLANG_NO_THROW Result SLANG_MCALL - bindPipeline(IPipelineState* state, IShaderObject** outRootShaderObject) = 0; - inline IShaderObject* bindPipeline(IPipelineState* state) + virtual SLANG_NO_THROW Result SLANG_MCALL bindPipeline(IPipeline* state, IShaderObject** outRootShaderObject) = 0; + inline IShaderObject* bindPipeline(IPipeline* state) { IShaderObject* rootObject = nullptr; SLANG_RETURN_NULL_ON_FAIL(bindPipeline(state, &rootObject)); @@ -1742,7 +1740,7 @@ class IComputeCommandEncoder : public IResourceCommandEncoder } // Sets the current pipeline state along with a pre-created mutable root shader object. virtual SLANG_NO_THROW Result SLANG_MCALL - bindPipelineWithRootObject(IPipelineState* state, IShaderObject* rootObject) = 0; + bindPipelineWithRootObject(IPipeline* state, IShaderObject* rootObject) = 0; virtual SLANG_NO_THROW Result SLANG_MCALL dispatchCompute(int x, int y, int z) = 0; virtual SLANG_NO_THROW Result SLANG_MCALL dispatchComputeIndirect(IBuffer* cmdBuffer, Offset offset) = 0; }; @@ -1788,10 +1786,10 @@ class IRayTracingCommandEncoder : public IResourceCommandEncoder virtual SLANG_NO_THROW void SLANG_MCALL deserializeAccelerationStructure(IAccelerationStructure* dest, DeviceAddress source) = 0; - virtual SLANG_NO_THROW Result SLANG_MCALL bindPipeline(IPipelineState* state, IShaderObject** outRootObject) = 0; + virtual SLANG_NO_THROW Result SLANG_MCALL bindPipeline(IPipeline* state, IShaderObject** outRootObject) = 0; // Sets the current pipeline state along with a pre-created mutable root shader object. virtual SLANG_NO_THROW Result SLANG_MCALL - bindPipelineWithRootObject(IPipelineState* state, IShaderObject* rootObject) = 0; + bindPipelineWithRootObject(IPipeline* state, IShaderObject* rootObject) = 0; /// Issues a dispatch command to start ray tracing workload with a ray tracing pipeline. /// `rayGenShaderIndex` specifies the index into the shader table that identifies the ray generation shader. @@ -2449,27 +2447,27 @@ class IDevice : public ISlangUnknown ) = 0; virtual SLANG_NO_THROW Result SLANG_MCALL - createGraphicsPipelineState(const GraphicsPipelineStateDesc& desc, IPipelineState** outState) = 0; + createRenderPipeline(const RenderPipelineDesc& desc, IPipeline** outPipeline) = 0; - inline ComPtr createGraphicsPipelineState(const GraphicsPipelineStateDesc& desc) + inline ComPtr createRenderPipeline(const RenderPipelineDesc& desc) { - ComPtr state; - SLANG_RETURN_NULL_ON_FAIL(createGraphicsPipelineState(desc, state.writeRef())); + ComPtr state; + SLANG_RETURN_NULL_ON_FAIL(createRenderPipeline(desc, state.writeRef())); return state; } virtual SLANG_NO_THROW Result SLANG_MCALL - createComputePipelineState(const ComputePipelineStateDesc& desc, IPipelineState** outState) = 0; + createComputePipeline(const ComputePipelineDesc& desc, IPipeline** outPipeline) = 0; - inline ComPtr createComputePipelineState(const ComputePipelineStateDesc& desc) + inline ComPtr createComputePipeline(const ComputePipelineDesc& desc) { - ComPtr state; - SLANG_RETURN_NULL_ON_FAIL(createComputePipelineState(desc, state.writeRef())); + ComPtr state; + SLANG_RETURN_NULL_ON_FAIL(createComputePipeline(desc, state.writeRef())); return state; } virtual SLANG_NO_THROW Result SLANG_MCALL - createRayTracingPipelineState(const RayTracingPipelineStateDesc& desc, IPipelineState** outState) = 0; + createRayTracingPipeline(const RayTracingPipelineDesc& desc, IPipeline** outPipeline) = 0; /// Read back texture resource and stores the result in `outBlob`. virtual SLANG_NO_THROW SlangResult SLANG_MCALL readTexture( @@ -2537,19 +2535,19 @@ class IPipelineCreationAPIDispatcher : public ISlangUnknown SLANG_COM_INTERFACE(0x8d7aa89d, 0x07f1, 0x4e21, {0xbc, 0xd2, 0x9a, 0x71, 0xc7, 0x95, 0xba, 0x91}); public: - virtual SLANG_NO_THROW Result SLANG_MCALL createComputePipelineState( + virtual SLANG_NO_THROW Result SLANG_MCALL createComputePipeline( IDevice* device, slang::IComponentType* program, void* pipelineDesc, void** outPipelineState ) = 0; - virtual SLANG_NO_THROW Result SLANG_MCALL createGraphicsPipelineState( + virtual SLANG_NO_THROW Result SLANG_MCALL createRenderPipeline( IDevice* device, slang::IComponentType* program, void* pipelineDesc, void** outPipelineState ) = 0; - virtual SLANG_NO_THROW Result SLANG_MCALL createMeshPipelineState( + virtual SLANG_NO_THROW Result SLANG_MCALL createMeshPipeline( IDevice* device, slang::IComponentType* program, void* pipelineDesc, diff --git a/src/command-writer.h b/src/command-writer.h index 92e20c79..f4e3d8b1 100644 --- a/src/command-writer.h +++ b/src/command-writer.h @@ -12,7 +12,7 @@ namespace rhi { enum class CommandName { - SetPipelineState, + SetPipeline, BindRootShaderObject, SetFramebuffer, ClearFrame, @@ -123,10 +123,10 @@ class CommandWriter return reinterpret_cast(m_data.data() + offset); } - void setPipelineState(IPipelineState* state) + void setPipeline(IPipeline* state) { - auto offset = encodeObject(static_cast(state)); - m_commands.push_back(Command(CommandName::SetPipelineState, (uint32_t)offset)); + auto offset = encodeObject(static_cast(state)); + m_commands.push_back(Command(CommandName::SetPipeline, (uint32_t)offset)); } void bindRootShaderObject(IShaderObject* object) diff --git a/src/cpu/cpu-base.h b/src/cpu/cpu-base.h index b3e0f0b8..7af2e67a 100644 --- a/src/cpu/cpu-base.h +++ b/src/cpu/cpu-base.h @@ -27,7 +27,7 @@ class MutableShaderObjectImpl; class EntryPointShaderObjectImpl; class RootShaderObjectImpl; class ShaderProgramImpl; -class PipelineStateImpl; +class PipelineImpl; class QueryPoolImpl; class DeviceImpl; diff --git a/src/cpu/cpu-device.cpp b/src/cpu/cpu-device.cpp index 7164a776..dca40851 100644 --- a/src/cpu/cpu-device.cpp +++ b/src/cpu/cpu-device.cpp @@ -167,11 +167,11 @@ DeviceImpl::createProgram(const IShaderProgram::Desc& desc, IShaderProgram** out } SLANG_NO_THROW Result SLANG_MCALL -DeviceImpl::createComputePipelineState(const ComputePipelineStateDesc& desc, IPipelineState** outState) +DeviceImpl::createComputePipeline(const ComputePipelineDesc& desc, IPipeline** outPipeline) { - RefPtr state = new PipelineStateImpl(); + RefPtr state = new PipelineImpl(); state->init(desc); - returnComPtr(outState, state); + returnComPtr(outPipeline, state); return Result(); } @@ -215,9 +215,9 @@ void DeviceImpl::unmap(IBuffer* buffer, size_t offsetWritten, size_t sizeWritten SLANG_UNUSED(sizeWritten); } -void DeviceImpl::setPipelineState(IPipelineState* state) +void DeviceImpl::setPipeline(IPipeline* state) { - m_currentPipeline = static_cast(state); + m_currentPipeline = static_cast(state); } void DeviceImpl::bindRootShaderObject(IShaderObject* object) @@ -231,9 +231,9 @@ void DeviceImpl::dispatchCompute(int x, int y, int z) int targetIndex = 0; // Specialize the compute kernel based on the shader object bindings. - RefPtr newPipeline; + RefPtr newPipeline; maybeSpecializePipeline(m_currentPipeline, m_currentRootObject, newPipeline); - m_currentPipeline = static_cast(newPipeline.Ptr()); + m_currentPipeline = static_cast(newPipeline.Ptr()); auto program = m_currentPipeline->getProgram(); auto entryPointLayout = m_currentRootObject->getLayout()->getEntryPoint(entryPointIndex); diff --git a/src/cpu/cpu-device.h b/src/cpu/cpu-device.h index 78a78de5..11da8da3 100644 --- a/src/cpu/cpu-device.h +++ b/src/cpu/cpu-device.h @@ -48,7 +48,7 @@ class DeviceImpl : public ImmediateComputeDeviceBase ) override; virtual SLANG_NO_THROW Result SLANG_MCALL - createComputePipelineState(const ComputePipelineStateDesc& desc, IPipelineState** outState) override; + createComputePipeline(const ComputePipelineDesc& desc, IPipeline** outPipeline) override; virtual SLANG_NO_THROW Result SLANG_MCALL createQueryPool(const IQueryPool::Desc& desc, IQueryPool** outPool) override; @@ -65,11 +65,11 @@ class DeviceImpl : public ImmediateComputeDeviceBase virtual void unmap(IBuffer* buffer, size_t offsetWritten, size_t sizeWritten) override; private: - RefPtr m_currentPipeline = nullptr; + RefPtr m_currentPipeline = nullptr; RefPtr m_currentRootObject = nullptr; DeviceInfo m_info; - virtual void setPipelineState(IPipelineState* state) override; + virtual void setPipeline(IPipeline* state) override; virtual void bindRootShaderObject(IShaderObject* object) override; diff --git a/src/cpu/cpu-pipeline-state.cpp b/src/cpu/cpu-pipeline-state.cpp index c867bd16..c45eec79 100644 --- a/src/cpu/cpu-pipeline-state.cpp +++ b/src/cpu/cpu-pipeline-state.cpp @@ -4,12 +4,12 @@ namespace rhi::cpu { -ShaderProgramImpl* PipelineStateImpl::getProgram() +ShaderProgramImpl* PipelineImpl::getProgram() { return static_cast(m_program.Ptr()); } -void PipelineStateImpl::init(const ComputePipelineStateDesc& inDesc) +void PipelineImpl::init(const ComputePipelineDesc& inDesc) { PipelineStateDesc pipelineDesc; pipelineDesc.type = PipelineType::Compute; diff --git a/src/cpu/cpu-pipeline-state.h b/src/cpu/cpu-pipeline-state.h index 3c9fedcf..60cad4e2 100644 --- a/src/cpu/cpu-pipeline-state.h +++ b/src/cpu/cpu-pipeline-state.h @@ -4,12 +4,12 @@ namespace rhi::cpu { -class PipelineStateImpl : public PipelineStateBase +class PipelineImpl : public PipelineBase { public: ShaderProgramImpl* getProgram(); - void init(const ComputePipelineStateDesc& inDesc); + void init(const ComputePipelineDesc& inDesc); }; } // namespace rhi::cpu diff --git a/src/cuda/cuda-base.h b/src/cuda/cuda-base.h index ee327de7..ff8e6bf4 100644 --- a/src/cuda/cuda-base.h +++ b/src/cuda/cuda-base.h @@ -40,7 +40,7 @@ class MutableShaderObjectImpl; class EntryPointShaderObjectImpl; class RootShaderObjectImpl; class ShaderProgramImpl; -class PipelineStateImpl; +class PipelineImpl; class QueryPoolImpl; class DeviceImpl; class CommandBufferImpl; diff --git a/src/cuda/cuda-command-encoder.cpp b/src/cuda/cuda-command-encoder.cpp index 5fd2c08e..4820cf26 100644 --- a/src/cuda/cuda-command-encoder.cpp +++ b/src/cuda/cuda-command-encoder.cpp @@ -165,10 +165,10 @@ void ComputeCommandEncoderImpl::init(CommandBufferImpl* cmdBuffer) } SLANG_NO_THROW Result SLANG_MCALL -ComputeCommandEncoderImpl::bindPipeline(IPipelineState* state, IShaderObject** outRootObject) +ComputeCommandEncoderImpl::bindPipeline(IPipeline* state, IShaderObject** outRootObject) { - m_writer->setPipelineState(state); - PipelineStateBase* pipelineImpl = static_cast(state); + m_writer->setPipeline(state); + PipelineBase* pipelineImpl = static_cast(state); SLANG_RETURN_ON_FAIL( m_commandBuffer->m_device->createRootShaderObject(pipelineImpl->m_program, m_rootObject.writeRef()) ); @@ -177,10 +177,10 @@ ComputeCommandEncoderImpl::bindPipeline(IPipelineState* state, IShaderObject** o } SLANG_NO_THROW Result SLANG_MCALL -ComputeCommandEncoderImpl::bindPipelineWithRootObject(IPipelineState* state, IShaderObject* rootObject) +ComputeCommandEncoderImpl::bindPipelineWithRootObject(IPipeline* state, IShaderObject* rootObject) { - m_writer->setPipelineState(state); - PipelineStateBase* pipelineImpl = static_cast(state); + m_writer->setPipeline(state); + PipelineBase* pipelineImpl = static_cast(state); SLANG_RETURN_ON_FAIL( m_commandBuffer->m_device->createRootShaderObject(pipelineImpl->m_program, m_rootObject.writeRef()) ); diff --git a/src/cuda/cuda-command-encoder.h b/src/cuda/cuda-command-encoder.h index 5f911202..81a45564 100644 --- a/src/cuda/cuda-command-encoder.h +++ b/src/cuda/cuda-command-encoder.h @@ -131,11 +131,10 @@ class ComputeCommandEncoderImpl : public IComputeCommandEncoder, public Resource void init(CommandBufferImpl* cmdBuffer); - virtual SLANG_NO_THROW Result SLANG_MCALL - bindPipeline(IPipelineState* state, IShaderObject** outRootObject) override; + virtual SLANG_NO_THROW Result SLANG_MCALL bindPipeline(IPipeline* state, IShaderObject** outRootObject) override; virtual SLANG_NO_THROW Result SLANG_MCALL - bindPipelineWithRootObject(IPipelineState* state, IShaderObject* rootObject) override; + bindPipelineWithRootObject(IPipeline* state, IShaderObject* rootObject) override; virtual SLANG_NO_THROW Result SLANG_MCALL dispatchCompute(int x, int y, int z) override; diff --git a/src/cuda/cuda-command-queue.cpp b/src/cuda/cuda-command-queue.cpp index 3df84ad5..b57b85bf 100644 --- a/src/cuda/cuda-command-queue.cpp +++ b/src/cuda/cuda-command-queue.cpp @@ -62,9 +62,9 @@ SLANG_NO_THROW Result SLANG_MCALL CommandQueueImpl::getNativeHandle(InteropHandl return SLANG_FAIL; } -void CommandQueueImpl::setPipelineState(IPipelineState* state) +void CommandQueueImpl::setPipeline(IPipeline* state) { - currentPipeline = dynamic_cast(state); + currentPipeline = dynamic_cast(state); } Result CommandQueueImpl::bindRootShaderObject(IShaderObject* object) @@ -78,9 +78,9 @@ Result CommandQueueImpl::bindRootShaderObject(IShaderObject* object) void CommandQueueImpl::dispatchCompute(int x, int y, int z) { // Specialize the compute kernel based on the shader object bindings. - RefPtr newPipeline; + RefPtr newPipeline; renderer->maybeSpecializePipeline(currentPipeline, currentRootObject, newPipeline); - currentPipeline = static_cast(newPipeline.Ptr()); + currentPipeline = static_cast(newPipeline.Ptr()); // Find out thread group size from program reflection. auto& kernelName = currentPipeline->shaderProgram->kernelName; @@ -168,8 +168,8 @@ void CommandQueueImpl::execute(CommandBufferImpl* commandBuffer) { switch (cmd.name) { - case CommandName::SetPipelineState: - setPipelineState(commandBuffer->getObject(cmd.operands[0])); + case CommandName::SetPipeline: + setPipeline(commandBuffer->getObject(cmd.operands[0])); break; case CommandName::BindRootShaderObject: bindRootShaderObject(commandBuffer->getObject(cmd.operands[0])); diff --git a/src/cuda/cuda-command-queue.h b/src/cuda/cuda-command-queue.h index c1412b04..d15b6ae4 100644 --- a/src/cuda/cuda-command-queue.h +++ b/src/cuda/cuda-command-queue.h @@ -15,7 +15,7 @@ class CommandQueueImpl : public ICommandQueue, public ComObject ICommandQueue* getInterface(const Guid& guid); - RefPtr currentPipeline; + RefPtr currentPipeline; RefPtr currentRootObject; RefPtr renderer; CUstream stream; @@ -37,7 +37,7 @@ class CommandQueueImpl : public ICommandQueue, public ComObject virtual SLANG_NO_THROW Result SLANG_MCALL getNativeHandle(InteropHandle* outHandle) override; - void setPipelineState(IPipelineState* state); + void setPipeline(IPipeline* state); Result bindRootShaderObject(IShaderObject* object); diff --git a/src/cuda/cuda-device.cpp b/src/cuda/cuda-device.cpp index 5809979f..8ba29790 100644 --- a/src/cuda/cuda-device.cpp +++ b/src/cuda/cuda-device.cpp @@ -1012,12 +1012,12 @@ DeviceImpl::createProgram(const IShaderProgram::Desc& desc, IShaderProgram** out } SLANG_NO_THROW Result SLANG_MCALL -DeviceImpl::createComputePipelineState(const ComputePipelineStateDesc& desc, IPipelineState** outState) +DeviceImpl::createComputePipeline(const ComputePipelineDesc& desc, IPipeline** outPipeline) { - RefPtr state = new ComputePipelineStateImpl(); + RefPtr state = new ComputePipelineImpl(); state->shaderProgram = static_cast(desc.program); state->init(desc); - returnComPtr(outState, state); + returnComPtr(outPipeline, state); return Result(); } @@ -1103,10 +1103,10 @@ DeviceImpl::createInputLayout(IInputLayout::Desc const& desc, IInputLayout** out } SLANG_NO_THROW Result SLANG_MCALL -DeviceImpl::createGraphicsPipelineState(const GraphicsPipelineStateDesc& desc, IPipelineState** outState) +DeviceImpl::createRenderPipeline(const RenderPipelineDesc& desc, IPipeline** outPipeline) { SLANG_UNUSED(desc); - SLANG_UNUSED(outState); + SLANG_UNUSED(outPipeline); return SLANG_E_NOT_AVAILABLE; } diff --git a/src/cuda/cuda-device.h b/src/cuda/cuda-device.h index a76d27ac..f276b529 100644 --- a/src/cuda/cuda-device.h +++ b/src/cuda/cuda-device.h @@ -76,7 +76,7 @@ class DeviceImpl : public RendererBase ) override; virtual SLANG_NO_THROW Result SLANG_MCALL - createComputePipelineState(const ComputePipelineStateDesc& desc, IPipelineState** outState) override; + createComputePipeline(const ComputePipelineDesc& desc, IPipeline** outPipeline) override; void* map(IBuffer* buffer); @@ -111,7 +111,7 @@ class DeviceImpl : public RendererBase createInputLayout(IInputLayout::Desc const& desc, IInputLayout** outLayout) override; virtual SLANG_NO_THROW Result SLANG_MCALL - createGraphicsPipelineState(const GraphicsPipelineStateDesc& desc, IPipelineState** outState) override; + createRenderPipeline(const RenderPipelineDesc& desc, IPipeline** outPipeline) override; virtual SLANG_NO_THROW Result SLANG_MCALL readTexture(ITexture* texture, ResourceState state, ISlangBlob** outBlob, size_t* outRowPitch, size_t* outPixelSize) diff --git a/src/cuda/cuda-pipeline-state.cpp b/src/cuda/cuda-pipeline-state.cpp index cf0aee58..2a58ad0d 100644 --- a/src/cuda/cuda-pipeline-state.cpp +++ b/src/cuda/cuda-pipeline-state.cpp @@ -2,7 +2,7 @@ namespace rhi::cuda { -void ComputePipelineStateImpl::init(const ComputePipelineStateDesc& inDesc) +void ComputePipelineImpl::init(const ComputePipelineDesc& inDesc) { PipelineStateDesc pipelineDesc; pipelineDesc.type = PipelineType::Compute; diff --git a/src/cuda/cuda-pipeline-state.h b/src/cuda/cuda-pipeline-state.h index 50a65754..7341d370 100644 --- a/src/cuda/cuda-pipeline-state.h +++ b/src/cuda/cuda-pipeline-state.h @@ -5,16 +5,16 @@ namespace rhi::cuda { -class PipelineStateImpl : public PipelineStateBase +class PipelineImpl : public PipelineBase { public: }; -class ComputePipelineStateImpl : public PipelineStateImpl +class ComputePipelineImpl : public PipelineImpl { public: RefPtr shaderProgram; - void init(const ComputePipelineStateDesc& inDesc); + void init(const ComputePipelineDesc& inDesc); }; } // namespace rhi::cuda diff --git a/src/d3d11/d3d11-base.h b/src/d3d11/d3d11-base.h index 54dae5c3..129ec26b 100644 --- a/src/d3d11/d3d11-base.h +++ b/src/d3d11/d3d11-base.h @@ -58,9 +58,9 @@ class FramebufferImpl; class SwapchainImpl; class InputLayoutImpl; class QueryPoolImpl; -class PipelineStateImpl; -class GraphicsPipelineStateImpl; -class ComputePipelineStateImpl; +class PipelineImpl; +class GraphicsPipelineImpl; +class ComputePipelineImpl; class ShaderObjectLayoutImpl; class RootShaderObjectLayoutImpl; class ShaderObjectImpl; diff --git a/src/d3d11/d3d11-device.cpp b/src/d3d11/d3d11-device.cpp index 6f854502..70523c2a 100644 --- a/src/d3d11/d3d11-device.cpp +++ b/src/d3d11/d3d11-device.cpp @@ -1149,7 +1149,7 @@ void DeviceImpl::setVertexBuffers( { static const int kMaxVertexBuffers = 16; SLANG_RHI_ASSERT(slotCount <= kMaxVertexBuffers); - SLANG_RHI_ASSERT(m_currentPipelineState); // The pipeline state should be created before setting vertex buffers. + SLANG_RHI_ASSERT(m_currentPipeline); // The pipeline state should be created before setting vertex buffers. UINT vertexStrides[kMaxVertexBuffers]; UINT vertexOffsets[kMaxVertexBuffers]; @@ -1159,7 +1159,7 @@ void DeviceImpl::setVertexBuffers( for (GfxIndex ii = 0; ii < slotCount; ++ii) { - auto inputLayout = (InputLayoutImpl*)m_currentPipelineState->inputLayout.Ptr(); + auto inputLayout = (InputLayoutImpl*)m_currentPipeline->inputLayout.Ptr(); vertexStrides[ii] = inputLayout->m_vertexStreamStrides[startSlot + ii]; vertexOffsets[ii] = (UINT)offsetsIn[ii]; dxBuffers[ii] = buffers[ii]->m_buffer; @@ -1217,9 +1217,9 @@ void DeviceImpl::setScissorRects(GfxCount count, ScissorRect const* rects) m_immediateContext->RSSetScissorRects(UINT(count), dxRects); } -void DeviceImpl::setPipelineState(IPipelineState* state) +void DeviceImpl::setPipeline(IPipeline* state) { - auto pipelineType = static_cast(state)->desc.type; + auto pipelineType = static_cast(state)->desc.type; switch (pipelineType) { @@ -1228,7 +1228,7 @@ void DeviceImpl::setPipelineState(IPipelineState* state) case PipelineType::Graphics: { - auto stateImpl = (GraphicsPipelineStateImpl*)state; + auto stateImpl = (GraphicsPipelineImpl*)state; auto programImpl = static_cast(stateImpl->m_program.Ptr()); // TODO: We could conceivably do some lightweight state @@ -1267,7 +1267,7 @@ void DeviceImpl::setPipelineState(IPipelineState* state) m_immediateContext->OMSetBlendState(stateImpl->m_blendState, stateImpl->m_blendColor, stateImpl->m_sampleMask); - m_currentPipelineState = stateImpl; + m_currentPipeline = stateImpl; m_depthStencilStateDirty = true; } @@ -1275,13 +1275,13 @@ void DeviceImpl::setPipelineState(IPipelineState* state) case PipelineType::Compute: { - auto stateImpl = (ComputePipelineStateImpl*)state; + auto stateImpl = (ComputePipelineImpl*)state; auto programImpl = static_cast(stateImpl->m_program.Ptr()); // CS m_immediateContext->CSSetShader(programImpl->m_computeShader, nullptr, 0); - m_currentPipelineState = stateImpl; + m_currentPipeline = stateImpl; } break; } @@ -1476,10 +1476,10 @@ Result DeviceImpl::createRootShaderObject(IShaderProgram* program, ShaderObjectB void DeviceImpl::bindRootShaderObject(IShaderObject* shaderObject) { RootShaderObjectImpl* rootShaderObjectImpl = static_cast(shaderObject); - RefPtr specializedPipeline; - maybeSpecializePipeline(m_currentPipelineState, rootShaderObjectImpl, specializedPipeline); - PipelineStateImpl* specializedPipelineImpl = static_cast(specializedPipeline.Ptr()); - setPipelineState(specializedPipelineImpl); + RefPtr specializedPipeline; + maybeSpecializePipeline(m_currentPipeline, rootShaderObjectImpl, specializedPipeline); + PipelineImpl* specializedPipelineImpl = static_cast(specializedPipeline.Ptr()); + setPipeline(specializedPipelineImpl); // In order to bind the root object we must compute its specialized layout. // @@ -1496,7 +1496,7 @@ void DeviceImpl::bindRootShaderObject(IShaderObject* shaderObject) // D3D11 calls. We deal with that distinction here by instantiating an // appropriate subtype of `BindingContext` based on the pipeline type. // - switch (m_currentPipelineState->desc.type) + switch (m_currentPipeline->desc.type) { case PipelineType::Compute: { @@ -1569,9 +1569,9 @@ void DeviceImpl::bindRootShaderObject(IShaderObject* shaderObject) } } -Result DeviceImpl::createGraphicsPipelineState(const GraphicsPipelineStateDesc& inDesc, IPipelineState** outState) +Result DeviceImpl::createRenderPipeline(const RenderPipelineDesc& inDesc, IPipeline** outPipeline) { - GraphicsPipelineStateDesc desc = inDesc; + RenderPipelineDesc desc = inDesc; auto programImpl = (ShaderProgramImpl*)desc.program; @@ -1676,29 +1676,29 @@ Result DeviceImpl::createGraphicsPipelineState(const GraphicsPipelineStateDesc& SLANG_RETURN_ON_FAIL(m_device->CreateBlendState(&dstDesc, blendState.writeRef())); } - RefPtr state = new GraphicsPipelineStateImpl(); - state->m_depthStencilState = depthStencilState; - state->m_rasterizerState = rasterizerState; - state->m_blendState = blendState; - state->m_inputLayout = static_cast(desc.inputLayout); - state->m_rtvCount = (UINT) static_cast(desc.framebufferLayout)->m_renderTargets.size(); - state->m_blendColor[0] = 0; - state->m_blendColor[1] = 0; - state->m_blendColor[2] = 0; - state->m_blendColor[3] = 0; - state->m_sampleMask = 0xFFFFFFFF; - state->init(desc); - returnComPtr(outState, state); + RefPtr pipeline = new GraphicsPipelineImpl(); + pipeline->m_depthStencilState = depthStencilState; + pipeline->m_rasterizerState = rasterizerState; + pipeline->m_blendState = blendState; + pipeline->m_inputLayout = static_cast(desc.inputLayout); + pipeline->m_rtvCount = (UINT) static_cast(desc.framebufferLayout)->m_renderTargets.size(); + pipeline->m_blendColor[0] = 0; + pipeline->m_blendColor[1] = 0; + pipeline->m_blendColor[2] = 0; + pipeline->m_blendColor[3] = 0; + pipeline->m_sampleMask = 0xFFFFFFFF; + pipeline->init(desc); + returnComPtr(outPipeline, pipeline); return SLANG_OK; } -Result DeviceImpl::createComputePipelineState(const ComputePipelineStateDesc& inDesc, IPipelineState** outState) +Result DeviceImpl::createComputePipeline(const ComputePipelineDesc& inDesc, IPipeline** outPipeline) { - ComputePipelineStateDesc desc = inDesc; + ComputePipelineDesc desc = inDesc; - RefPtr state = new ComputePipelineStateImpl(); + RefPtr state = new ComputePipelineImpl(); state->init(desc); - returnComPtr(outState, state); + returnComPtr(outPipeline, state); return SLANG_OK; } @@ -1724,8 +1724,8 @@ void DeviceImpl::_flushGraphicsState() if (m_depthStencilStateDirty) { m_depthStencilStateDirty = false; - auto pipelineState = static_cast(m_currentPipelineState.Ptr()); - m_immediateContext->OMSetDepthStencilState(pipelineState->m_depthStencilState, m_stencilRef); + auto pipeline = static_cast(m_currentPipeline.Ptr()); + m_immediateContext->OMSetDepthStencilState(pipeline->m_depthStencilState, m_stencilRef); } } diff --git a/src/d3d11/d3d11-device.h b/src/d3d11/d3d11-device.h index afe54f6f..eb780dd6 100644 --- a/src/d3d11/d3d11-device.h +++ b/src/d3d11/d3d11-device.h @@ -57,9 +57,9 @@ class DeviceImpl : public ImmediateRendererBase ISlangBlob** outDiagnosticBlob ) override; virtual SLANG_NO_THROW Result SLANG_MCALL - createGraphicsPipelineState(const GraphicsPipelineStateDesc& desc, IPipelineState** outState) override; + createRenderPipeline(const RenderPipelineDesc& desc, IPipeline** outPipeline) override; virtual SLANG_NO_THROW Result SLANG_MCALL - createComputePipelineState(const ComputePipelineStateDesc& desc, IPipelineState** outState) override; + createComputePipeline(const ComputePipelineDesc& desc, IPipeline** outPipeline) override; virtual void* map(IBuffer* buffer, MapFlavor flavor) override; virtual void unmap(IBuffer* buffer, size_t offsetWritten, size_t sizeWritten) override; @@ -79,7 +79,7 @@ class DeviceImpl : public ImmediateRendererBase virtual void setIndexBuffer(IBuffer* buffer, Format indexFormat, Offset offset) override; virtual void setViewports(GfxCount count, Viewport const* viewports) override; virtual void setScissorRects(GfxCount count, ScissorRect const* rects) override; - virtual void setPipelineState(IPipelineState* state) override; + virtual void setPipeline(IPipeline* state) override; virtual void draw(GfxCount vertexCount, GfxIndex startVertex) override; virtual void drawIndexed(GfxCount indexCount, GfxIndex startIndex, GfxIndex baseVertex) override; virtual void drawInstanced( @@ -118,7 +118,7 @@ class DeviceImpl : public ImmediateRendererBase ComPtr m_dxgiFactory; RefPtr m_currentFramebuffer; - RefPtr m_currentPipelineState; + RefPtr m_currentPipeline; ComPtr m_disjointQuery; diff --git a/src/d3d11/d3d11-pipeline-state.cpp b/src/d3d11/d3d11-pipeline-state.cpp index 1fd46c5d..581f0d7f 100644 --- a/src/d3d11/d3d11-pipeline-state.cpp +++ b/src/d3d11/d3d11-pipeline-state.cpp @@ -2,17 +2,17 @@ namespace rhi::d3d11 { -void GraphicsPipelineStateImpl::init(const GraphicsPipelineStateDesc& inDesc) +void GraphicsPipelineImpl::init(const RenderPipelineDesc& inDesc) { - PipelineStateBase::PipelineStateDesc pipelineDesc; + PipelineBase::PipelineStateDesc pipelineDesc; pipelineDesc.graphics = inDesc; pipelineDesc.type = PipelineType::Graphics; initializeBase(pipelineDesc); } -void ComputePipelineStateImpl::init(const ComputePipelineStateDesc& inDesc) +void ComputePipelineImpl::init(const ComputePipelineDesc& inDesc) { - PipelineStateBase::PipelineStateDesc pipelineDesc; + PipelineBase::PipelineStateDesc pipelineDesc; pipelineDesc.compute = inDesc; pipelineDesc.type = PipelineType::Compute; initializeBase(pipelineDesc); diff --git a/src/d3d11/d3d11-pipeline-state.h b/src/d3d11/d3d11-pipeline-state.h index e194e745..28366c6f 100644 --- a/src/d3d11/d3d11-pipeline-state.h +++ b/src/d3d11/d3d11-pipeline-state.h @@ -4,12 +4,12 @@ namespace rhi::d3d11 { -class PipelineStateImpl : public PipelineStateBase +class PipelineImpl : public PipelineBase { public: }; -class GraphicsPipelineStateImpl : public PipelineStateImpl +class GraphicsPipelineImpl : public PipelineImpl { public: UINT m_rtvCount; @@ -22,13 +22,13 @@ class GraphicsPipelineStateImpl : public PipelineStateImpl float m_blendColor[4]; UINT m_sampleMask; - void init(const GraphicsPipelineStateDesc& inDesc); + void init(const RenderPipelineDesc& inDesc); }; -class ComputePipelineStateImpl : public PipelineStateImpl +class ComputePipelineImpl : public PipelineImpl { public: - void init(const ComputePipelineStateDesc& inDesc); + void init(const ComputePipelineDesc& inDesc); }; } // namespace rhi::d3d11 diff --git a/src/d3d12/d3d12-base.h b/src/d3d12/d3d12-base.h index 35218aee..11656547 100644 --- a/src/d3d12/d3d12-base.h +++ b/src/d3d12/d3d12-base.h @@ -51,7 +51,7 @@ class FramebufferLayoutImpl; class FramebufferImpl; class QueryPoolImpl; class PlainBufferProxyQueryPoolImpl; -class PipelineStateImpl; +class PipelineImpl; class RenderPassLayoutImpl; class ResourceViewInternalImpl; class ResourceViewImpl; @@ -70,7 +70,7 @@ class InputLayoutImpl; #if SLANG_RHI_DXR class RayTracingCommandEncoderImpl; -class RayTracingPipelineStateImpl; +class RayTracingPipelineImpl; #endif } // namespace rhi::d3d12 diff --git a/src/d3d12/d3d12-command-encoder.cpp b/src/d3d12/d3d12-command-encoder.cpp index f5b0b673..dc27de18 100644 --- a/src/d3d12/d3d12-command-encoder.cpp +++ b/src/d3d12/d3d12-command-encoder.cpp @@ -41,9 +41,9 @@ void PipelineCommandEncoder::init(CommandBufferImpl* commandBuffer) m_device = commandBuffer->m_renderer->m_device; } -Result PipelineCommandEncoder::bindPipelineImpl(IPipelineState* pipelineState, IShaderObject** outRootObject) +Result PipelineCommandEncoder::bindPipelineImpl(IPipeline* pipeline, IShaderObject** outRootObject) { - m_currentPipeline = static_cast(pipelineState); + m_currentPipeline = static_cast(pipeline); auto rootObject = &m_commandBuffer->m_rootShaderObject; m_commandBuffer->m_mutableRootShaderObject = nullptr; SLANG_RETURN_ON_FAIL(rootObject->reset( @@ -56,27 +56,27 @@ Result PipelineCommandEncoder::bindPipelineImpl(IPipelineState* pipelineState, I return SLANG_OK; } -Result PipelineCommandEncoder::bindPipelineWithRootObjectImpl(IPipelineState* pipelineState, IShaderObject* rootObject) +Result PipelineCommandEncoder::bindPipelineWithRootObjectImpl(IPipeline* pipeline, IShaderObject* rootObject) { - m_currentPipeline = static_cast(pipelineState); + m_currentPipeline = static_cast(pipeline); m_commandBuffer->m_mutableRootShaderObject = static_cast(rootObject); m_bindingDirty = true; return SLANG_OK; } -Result PipelineCommandEncoder::_bindRenderState(Submitter* submitter, RefPtr& newPipeline) +Result PipelineCommandEncoder::_bindRenderState(Submitter* submitter, RefPtr& newPipeline) { RootShaderObjectImpl* rootObjectImpl = m_commandBuffer->m_mutableRootShaderObject ? m_commandBuffer->m_mutableRootShaderObject.Ptr() : &m_commandBuffer->m_rootShaderObject; SLANG_RETURN_ON_FAIL(m_renderer->maybeSpecializePipeline(m_currentPipeline, rootObjectImpl, newPipeline)); - PipelineStateBase* newPipelineImpl = static_cast(newPipeline.Ptr()); + PipelineBase* newPipelineImpl = static_cast(newPipeline.Ptr()); auto commandList = m_d3dCmdList; auto pipelineTypeIndex = (int)newPipelineImpl->desc.type; auto programImpl = static_cast(newPipelineImpl->m_program.Ptr()); - SLANG_RETURN_ON_FAIL(newPipelineImpl->ensureAPIPipelineStateCreated()); + SLANG_RETURN_ON_FAIL(newPipelineImpl->ensureAPIPipelineCreated()); submitter->setRootSignature(programImpl->m_rootObjectLayout->m_rootSignature); - submitter->setPipelineState(newPipelineImpl); + submitter->setPipeline(newPipelineImpl); RootShaderObjectLayoutImpl* rootLayoutImpl = programImpl->m_rootObjectLayout; // We need to set up a context for binding shader objects to the pipeline state. @@ -903,12 +903,12 @@ void RenderCommandEncoderImpl::init( } } -Result RenderCommandEncoderImpl::bindPipeline(IPipelineState* state, IShaderObject** outRootObject) +Result RenderCommandEncoderImpl::bindPipeline(IPipeline* state, IShaderObject** outRootObject) { return bindPipelineImpl(state, outRootObject); } -Result RenderCommandEncoderImpl::bindPipelineWithRootObject(IPipelineState* state, IShaderObject* rootObject) +Result RenderCommandEncoderImpl::bindPipelineWithRootObject(IPipeline* state, IShaderObject* rootObject) { return bindPipelineWithRootObjectImpl(state, rootObject); } @@ -991,8 +991,8 @@ void RenderCommandEncoderImpl::setIndexBuffer(IBuffer* buffer, Format indexForma Result RenderCommandEncoderImpl::prepareDraw() { - auto pipelineState = m_currentPipeline.Ptr(); - if (!pipelineState || (pipelineState->desc.type != PipelineType::Graphics)) + auto pipeline = m_currentPipeline.Ptr(); + if (!pipeline || (pipeline->desc.type != PipelineType::Graphics)) { return SLANG_FAIL; } @@ -1000,7 +1000,7 @@ Result RenderCommandEncoderImpl::prepareDraw() // Submit - setting for graphics { GraphicsSubmitter submitter(m_d3dCmdList); - RefPtr newPipeline; + RefPtr newPipeline; SLANG_RETURN_ON_FAIL(_bindRenderState(&submitter, newPipeline)); } @@ -1008,7 +1008,7 @@ Result RenderCommandEncoderImpl::prepareDraw() // Set up vertex buffer views { - auto inputLayout = (InputLayoutImpl*)pipelineState->inputLayout.Ptr(); + auto inputLayout = (InputLayoutImpl*)pipeline->inputLayout.Ptr(); if (inputLayout) { int numVertexViews = 0; @@ -1232,12 +1232,12 @@ void ComputeCommandEncoderImpl::init( m_currentPipeline = nullptr; } -Result ComputeCommandEncoderImpl::bindPipeline(IPipelineState* state, IShaderObject** outRootObject) +Result ComputeCommandEncoderImpl::bindPipeline(IPipeline* state, IShaderObject** outRootObject) { return bindPipelineImpl(state, outRootObject); } -Result ComputeCommandEncoderImpl::bindPipelineWithRootObject(IPipelineState* state, IShaderObject* rootObject) +Result ComputeCommandEncoderImpl::bindPipelineWithRootObject(IPipeline* state, IShaderObject* rootObject) { return bindPipelineWithRootObjectImpl(state, rootObject); } @@ -1247,7 +1247,7 @@ Result ComputeCommandEncoderImpl::dispatchCompute(int x, int y, int z) // Submit binding for compute { ComputeSubmitter submitter(m_d3dCmdList); - RefPtr newPipeline; + RefPtr newPipeline; SLANG_RETURN_ON_FAIL(_bindRenderState(&submitter, newPipeline)); } m_d3dCmdList->Dispatch(x, y, z); @@ -1259,7 +1259,7 @@ Result ComputeCommandEncoderImpl::dispatchComputeIndirect(IBuffer* argBuffer, Of // Submit binding for compute { ComputeSubmitter submitter(m_d3dCmdList); - RefPtr newPipeline; + RefPtr newPipeline; SLANG_RETURN_ON_FAIL(_bindRenderState(&submitter, newPipeline)); } auto argBufferImpl = static_cast(argBuffer); @@ -1382,7 +1382,7 @@ void RayTracingCommandEncoderImpl::deserializeAccelerationStructure(IAcceleratio ); } -Result RayTracingCommandEncoderImpl::bindPipeline(IPipelineState* state, IShaderObject** outRootObject) +Result RayTracingCommandEncoderImpl::bindPipeline(IPipeline* state, IShaderObject** outRootObject) { return bindPipelineImpl(state, outRootObject); } @@ -1395,8 +1395,8 @@ Result RayTracingCommandEncoderImpl::dispatchRays( GfxCount depth ) { - RefPtr newPipeline; - PipelineStateBase* pipeline = m_currentPipeline.Ptr(); + RefPtr newPipeline; + PipelineBase* pipeline = m_currentPipeline.Ptr(); { struct RayTracingSubmitter : public ComputeSubmitter { @@ -1406,9 +1406,9 @@ Result RayTracingCommandEncoderImpl::dispatchRays( , m_cmdList4(cmdList4) { } - virtual void setPipelineState(PipelineStateBase* pipeline) override + virtual void setPipeline(PipelineBase* pipeline) override { - auto pipelineImpl = static_cast(pipeline); + auto pipelineImpl = static_cast(pipeline); m_cmdList4->SetPipelineState1(pipelineImpl->m_stateObject.get()); } }; @@ -1417,7 +1417,7 @@ Result RayTracingCommandEncoderImpl::dispatchRays( if (newPipeline) pipeline = newPipeline.Ptr(); } - auto pipelineImpl = static_cast(pipeline); + auto pipelineImpl = static_cast(pipeline); auto shaderTableImpl = static_cast(shaderTable); diff --git a/src/d3d12/d3d12-command-encoder.h b/src/d3d12/d3d12-command-encoder.h index c747de5a..2c18a295 100644 --- a/src/d3d12/d3d12-command-encoder.h +++ b/src/d3d12/d3d12-command-encoder.h @@ -23,7 +23,7 @@ class PipelineCommandEncoder ID3D12GraphicsCommandList6* m_d3dCmdList6; ID3D12GraphicsCommandList* m_preCmdList = nullptr; - RefPtr m_currentPipeline; + RefPtr m_currentPipeline; static int getBindPointIndex(PipelineType type); @@ -31,15 +31,15 @@ class PipelineCommandEncoder void endEncodingImpl() { m_isOpen = false; } - Result bindPipelineImpl(IPipelineState* pipelineState, IShaderObject** outRootObject); + Result bindPipelineImpl(IPipeline* pipeline, IShaderObject** outRootObject); - Result bindPipelineWithRootObjectImpl(IPipelineState* pipelineState, IShaderObject* rootObject); + Result bindPipelineWithRootObjectImpl(IPipeline* pipeline, IShaderObject* rootObject); /// Specializes the pipeline according to current root-object argument values, /// applys the root object bindings and binds the pipeline state. /// The newly specialized pipeline is held alive by the pipeline cache so users of /// `newPipeline` do not need to maintain its lifespan. - Result _bindRenderState(Submitter* submitter, RefPtr& newPipeline); + Result _bindRenderState(Submitter* submitter, RefPtr& newPipeline); }; class ResourceCommandEncoderImpl : public IResourceCommandEncoder, public PipelineCommandEncoder @@ -148,11 +148,10 @@ class ComputeCommandEncoderImpl : public IComputeCommandEncoder, public Resource virtual SLANG_NO_THROW void SLANG_MCALL endEncoding() override; void init(DeviceImpl* renderer, TransientResourceHeapImpl* transientHeap, CommandBufferImpl* cmdBuffer); - virtual SLANG_NO_THROW Result SLANG_MCALL - bindPipeline(IPipelineState* state, IShaderObject** outRootObject) override; + virtual SLANG_NO_THROW Result SLANG_MCALL bindPipeline(IPipeline* state, IShaderObject** outRootObject) override; virtual SLANG_NO_THROW Result SLANG_MCALL - bindPipelineWithRootObject(IPipelineState* state, IShaderObject* rootObject) override; + bindPipelineWithRootObject(IPipeline* state, IShaderObject* rootObject) override; virtual SLANG_NO_THROW Result SLANG_MCALL dispatchCompute(int x, int y, int z) override; @@ -202,11 +201,10 @@ class RenderCommandEncoderImpl : public IRenderCommandEncoder, public ResourceCo FramebufferImpl* framebuffer ); - virtual SLANG_NO_THROW Result SLANG_MCALL - bindPipeline(IPipelineState* state, IShaderObject** outRootObject) override; + virtual SLANG_NO_THROW Result SLANG_MCALL bindPipeline(IPipeline* state, IShaderObject** outRootObject) override; virtual SLANG_NO_THROW Result SLANG_MCALL - bindPipelineWithRootObject(IPipelineState* state, IShaderObject* rootObject) override; + bindPipelineWithRootObject(IPipeline* state, IShaderObject* rootObject) override; virtual SLANG_NO_THROW void SLANG_MCALL setViewports(GfxCount count, const Viewport* viewports) override; @@ -291,10 +289,9 @@ class RayTracingCommandEncoderImpl : public IRayTracingCommandEncoder, public Re serializeAccelerationStructure(DeviceAddress dest, IAccelerationStructure* source) override; virtual SLANG_NO_THROW void SLANG_MCALL deserializeAccelerationStructure(IAccelerationStructure* dest, DeviceAddress source) override; + virtual SLANG_NO_THROW Result SLANG_MCALL bindPipeline(IPipeline* state, IShaderObject** outRootObject) override; virtual SLANG_NO_THROW Result SLANG_MCALL - bindPipeline(IPipelineState* state, IShaderObject** outRootObject) override; - virtual SLANG_NO_THROW Result SLANG_MCALL - bindPipelineWithRootObject(IPipelineState* state, IShaderObject* rootObject) override + bindPipelineWithRootObject(IPipeline* state, IShaderObject* rootObject) override { return bindPipelineWithRootObjectImpl(state, rootObject); } diff --git a/src/d3d12/d3d12-device.cpp b/src/d3d12/d3d12-device.cpp index ef765823..67947b7e 100644 --- a/src/d3d12/d3d12-device.cpp +++ b/src/d3d12/d3d12-device.cpp @@ -1936,19 +1936,19 @@ Result DeviceImpl::createShaderTable(const IShaderTable::Desc& desc, IShaderTabl return SLANG_OK; } -Result DeviceImpl::createGraphicsPipelineState(const GraphicsPipelineStateDesc& desc, IPipelineState** outState) +Result DeviceImpl::createRenderPipeline(const RenderPipelineDesc& desc, IPipeline** outPipeline) { - RefPtr pipelineStateImpl = new PipelineStateImpl(this); - pipelineStateImpl->init(desc); - returnComPtr(outState, pipelineStateImpl); + RefPtr pipelineImpl = new PipelineImpl(this); + pipelineImpl->init(desc); + returnComPtr(outPipeline, pipelineImpl); return SLANG_OK; } -Result DeviceImpl::createComputePipelineState(const ComputePipelineStateDesc& desc, IPipelineState** outState) +Result DeviceImpl::createComputePipeline(const ComputePipelineDesc& desc, IPipeline** outPipeline) { - RefPtr pipelineStateImpl = new PipelineStateImpl(this); - pipelineStateImpl->init(desc); - returnComPtr(outState, pipelineStateImpl); + RefPtr pipelineImpl = new PipelineImpl(this); + pipelineImpl->init(desc); + returnComPtr(outPipeline, pipelineImpl); return SLANG_OK; } @@ -2116,16 +2116,16 @@ Result DeviceImpl::createAccelerationStructure( #endif } -Result DeviceImpl::createRayTracingPipelineState(const RayTracingPipelineStateDesc& inDesc, IPipelineState** outState) +Result DeviceImpl::createRayTracingPipeline(const RayTracingPipelineDesc& inDesc, IPipeline** outPipeline) { if (!m_device5) { return SLANG_E_NOT_AVAILABLE; } - RefPtr pipelineStateImpl = new RayTracingPipelineStateImpl(this); - pipelineStateImpl->init(inDesc); - returnComPtr(outState, pipelineStateImpl); + RefPtr pipelineImpl = new RayTracingPipelineImpl(this); + pipelineImpl->init(inDesc); + returnComPtr(outPipeline, pipelineImpl); return SLANG_OK; } diff --git a/src/d3d12/d3d12-device.h b/src/d3d12/d3d12-device.h index 08b69eb1..86262d6b 100644 --- a/src/d3d12/d3d12-device.h +++ b/src/d3d12/d3d12-device.h @@ -156,9 +156,9 @@ class DeviceImpl : public RendererBase virtual SLANG_NO_THROW Result SLANG_MCALL createProgram(const IShaderProgram::Desc& desc, IShaderProgram** outProgram, ISlangBlob** outDiagnostics) override; virtual SLANG_NO_THROW Result SLANG_MCALL - createGraphicsPipelineState(const GraphicsPipelineStateDesc& desc, IPipelineState** outState) override; + createRenderPipeline(const RenderPipelineDesc& desc, IPipeline** outPipeline) override; virtual SLANG_NO_THROW Result SLANG_MCALL - createComputePipelineState(const ComputePipelineStateDesc& desc, IPipelineState** outState) override; + createComputePipeline(const ComputePipelineDesc& desc, IPipeline** outPipeline) override; virtual SLANG_NO_THROW Result SLANG_MCALL createQueryPool(const IQueryPool::Desc& desc, IQueryPool** outState) override; @@ -191,7 +191,7 @@ class DeviceImpl : public RendererBase IAccelerationStructure** outView ) override; virtual SLANG_NO_THROW Result SLANG_MCALL - createRayTracingPipelineState(const RayTracingPipelineStateDesc& desc, IPipelineState** outState) override; + createRayTracingPipeline(const RayTracingPipelineDesc& desc, IPipeline** outPipeline) override; public: static void* loadProc(SharedLibraryHandle module, char const* name); diff --git a/src/d3d12/d3d12-pipeline-state.cpp b/src/d3d12/d3d12-pipeline-state.cpp index 21792f7e..f2d11063 100644 --- a/src/d3d12/d3d12-pipeline-state.cpp +++ b/src/d3d12/d3d12-pipeline-state.cpp @@ -20,7 +20,7 @@ namespace rhi::d3d12 { -void PipelineStateImpl::init(const GraphicsPipelineStateDesc& inDesc) +void PipelineImpl::init(const RenderPipelineDesc& inDesc) { PipelineStateDesc pipelineDesc; pipelineDesc.type = PipelineType::Graphics; @@ -28,7 +28,7 @@ void PipelineStateImpl::init(const GraphicsPipelineStateDesc& inDesc) initializeBase(pipelineDesc); } -void PipelineStateImpl::init(const ComputePipelineStateDesc& inDesc) +void PipelineImpl::init(const ComputePipelineDesc& inDesc) { PipelineStateDesc pipelineDesc; pipelineDesc.type = PipelineType::Compute; @@ -36,15 +36,15 @@ void PipelineStateImpl::init(const ComputePipelineStateDesc& inDesc) initializeBase(pipelineDesc); } -Result PipelineStateImpl::getNativeHandle(InteropHandle* outHandle) +Result PipelineImpl::getNativeHandle(InteropHandle* outHandle) { - SLANG_RETURN_ON_FAIL(ensureAPIPipelineStateCreated()); + SLANG_RETURN_ON_FAIL(ensureAPIPipelineCreated()); outHandle->api = InteropHandleAPI::D3D12; outHandle->handleValue = reinterpret_cast(m_pipelineState.get()); return SLANG_OK; } -Result PipelineStateImpl::ensureAPIPipelineStateCreated() +Result PipelineImpl::ensureAPIPipelineCreated() { if (m_pipelineState) return SLANG_OK; @@ -194,7 +194,7 @@ Result PipelineStateImpl::ensureAPIPipelineStateCreated() fillCommonGraphicsState(meshDesc); if (m_device->m_pipelineCreationAPIDispatcher) { - SLANG_RETURN_ON_FAIL(m_device->m_pipelineCreationAPIDispatcher->createMeshPipelineState( + SLANG_RETURN_ON_FAIL(m_device->m_pipelineCreationAPIDispatcher->createMeshPipeline( m_device, programImpl->linkedProgram.get(), &meshDesc, @@ -255,7 +255,7 @@ Result PipelineStateImpl::ensureAPIPipelineStateCreated() if (m_device->m_pipelineCreationAPIDispatcher) { - SLANG_RETURN_ON_FAIL(m_device->m_pipelineCreationAPIDispatcher->createGraphicsPipelineState( + SLANG_RETURN_ON_FAIL(m_device->m_pipelineCreationAPIDispatcher->createRenderPipeline( m_device, programImpl->linkedProgram.get(), &graphicsDesc, @@ -322,7 +322,7 @@ Result PipelineStateImpl::ensureAPIPipelineStateCreated() { if (m_device->m_pipelineCreationAPIDispatcher) { - SLANG_RETURN_ON_FAIL(m_device->m_pipelineCreationAPIDispatcher->createComputePipelineState( + SLANG_RETURN_ON_FAIL(m_device->m_pipelineCreationAPIDispatcher->createComputePipeline( m_device, programImpl->linkedProgram.get(), &computeDesc, @@ -345,12 +345,12 @@ Result PipelineStateImpl::ensureAPIPipelineStateCreated() #if SLANG_RHI_DXR -RayTracingPipelineStateImpl::RayTracingPipelineStateImpl(DeviceImpl* device) +RayTracingPipelineImpl::RayTracingPipelineImpl(DeviceImpl* device) : m_device(device) { } -void RayTracingPipelineStateImpl::init(const RayTracingPipelineStateDesc& inDesc) +void RayTracingPipelineImpl::init(const RayTracingPipelineDesc& inDesc) { PipelineStateDesc pipelineDesc; pipelineDesc.type = PipelineType::RayTracing; @@ -358,15 +358,15 @@ void RayTracingPipelineStateImpl::init(const RayTracingPipelineStateDesc& inDesc initializeBase(pipelineDesc); } -Result RayTracingPipelineStateImpl::getNativeHandle(InteropHandle* outHandle) +Result RayTracingPipelineImpl::getNativeHandle(InteropHandle* outHandle) { - SLANG_RETURN_ON_FAIL(ensureAPIPipelineStateCreated()); + SLANG_RETURN_ON_FAIL(ensureAPIPipelineCreated()); outHandle->api = InteropHandleAPI::D3D12; outHandle->handleValue = reinterpret_cast(m_stateObject.get()); return SLANG_OK; } -Result RayTracingPipelineStateImpl::ensureAPIPipelineStateCreated() +Result RayTracingPipelineImpl::ensureAPIPipelineCreated() { if (m_stateObject) return SLANG_OK; diff --git a/src/d3d12/d3d12-pipeline-state.h b/src/d3d12/d3d12-pipeline-state.h index 31f9c4c2..90d1586c 100644 --- a/src/d3d12/d3d12-pipeline-state.h +++ b/src/d3d12/d3d12-pipeline-state.h @@ -4,31 +4,31 @@ namespace rhi::d3d12 { -class PipelineStateImpl : public PipelineStateBase +class PipelineImpl : public PipelineBase { public: - PipelineStateImpl(DeviceImpl* device) + PipelineImpl(DeviceImpl* device) : m_device(device) { } DeviceImpl* m_device; ComPtr m_pipelineState; - void init(const GraphicsPipelineStateDesc& inDesc); - void init(const ComputePipelineStateDesc& inDesc); + void init(const RenderPipelineDesc& inDesc); + void init(const ComputePipelineDesc& inDesc); virtual SLANG_NO_THROW Result SLANG_MCALL getNativeHandle(InteropHandle* outHandle) override; - virtual Result ensureAPIPipelineStateCreated() override; + virtual Result ensureAPIPipelineCreated() override; }; #if SLANG_RHI_DXR -class RayTracingPipelineStateImpl : public PipelineStateBase +class RayTracingPipelineImpl : public PipelineBase { public: ComPtr m_stateObject; DeviceImpl* m_device; - RayTracingPipelineStateImpl(DeviceImpl* device); - void init(const RayTracingPipelineStateDesc& inDesc); + RayTracingPipelineImpl(DeviceImpl* device); + void init(const RayTracingPipelineDesc& inDesc); virtual SLANG_NO_THROW Result SLANG_MCALL getNativeHandle(InteropHandle* outHandle) override; - virtual Result ensureAPIPipelineStateCreated() override; + virtual Result ensureAPIPipelineCreated() override; }; #endif diff --git a/src/d3d12/d3d12-shader-table.cpp b/src/d3d12/d3d12-shader-table.cpp index afa4897a..9c8ea874 100644 --- a/src/d3d12/d3d12-shader-table.cpp +++ b/src/d3d12/d3d12-shader-table.cpp @@ -8,7 +8,7 @@ namespace rhi::d3d12 { RefPtr ShaderTableImpl::createDeviceBuffer( - PipelineStateBase* pipeline, + PipelineBase* pipeline, TransientResourceHeapBase* transientHeap, IResourceCommandEncoder* encoder ) @@ -25,7 +25,7 @@ RefPtr ShaderTableImpl::createDeviceBuffer( )D3DUtil::calcAligned(m_hitGroupTableOffset + hitgroupTableSize, D3D12_RAYTRACING_SHADER_TABLE_BYTE_ALIGNMENT); uint32_t tableSize = m_callableTableOffset + callableTableSize; - auto pipelineImpl = static_cast(pipeline); + auto pipelineImpl = static_cast(pipeline); ComPtr buffer; BufferDesc bufferDesc = {}; bufferDesc.memoryType = MemoryType::DeviceLocal; diff --git a/src/d3d12/d3d12-shader-table.h b/src/d3d12/d3d12-shader-table.h index fb1077fb..0afc7d05 100644 --- a/src/d3d12/d3d12-shader-table.h +++ b/src/d3d12/d3d12-shader-table.h @@ -15,7 +15,7 @@ class ShaderTableImpl : public ShaderTableBase DeviceImpl* m_device; virtual RefPtr createDeviceBuffer( - PipelineStateBase* pipeline, + PipelineBase* pipeline, TransientResourceHeapBase* transientHeap, IResourceCommandEncoder* encoder ) override; diff --git a/src/d3d12/d3d12-submitter.cpp b/src/d3d12/d3d12-submitter.cpp index fbd2e442..c83a07e3 100644 --- a/src/d3d12/d3d12-submitter.cpp +++ b/src/d3d12/d3d12-submitter.cpp @@ -43,9 +43,9 @@ void GraphicsSubmitter::setRootConstants( ); } -void GraphicsSubmitter::setPipelineState(PipelineStateBase* pipeline) +void GraphicsSubmitter::setPipeline(PipelineBase* pipeline) { - auto pipelineImpl = static_cast(pipeline); + auto pipelineImpl = static_cast(pipeline); m_commandList->SetPipelineState(pipelineImpl->m_pipelineState.get()); } @@ -89,9 +89,9 @@ void ComputeSubmitter::setRootConstants( ); } -void ComputeSubmitter::setPipelineState(PipelineStateBase* pipeline) +void ComputeSubmitter::setPipeline(PipelineBase* pipeline) { - auto pipelineImpl = static_cast(pipeline); + auto pipelineImpl = static_cast(pipeline); m_commandList->SetPipelineState(pipelineImpl->m_pipelineState.get()); } diff --git a/src/d3d12/d3d12-submitter.h b/src/d3d12/d3d12-submitter.h index ace9bf6b..bbe93431 100644 --- a/src/d3d12/d3d12-submitter.h +++ b/src/d3d12/d3d12-submitter.h @@ -17,7 +17,7 @@ struct Submitter Index countOf32BitValues, void const* srcData ) = 0; - virtual void setPipelineState(PipelineStateBase* pipelineState) = 0; + virtual void setPipeline(PipelineBase* pipeline) = 0; }; struct GraphicsSubmitter : public Submitter @@ -33,7 +33,7 @@ struct GraphicsSubmitter : public Submitter Index countOf32BitValues, void const* srcData ) override; - virtual void setPipelineState(PipelineStateBase* pipeline) override; + virtual void setPipeline(PipelineBase* pipeline) override; GraphicsSubmitter(ID3D12GraphicsCommandList* commandList) : m_commandList(commandList) @@ -56,7 +56,7 @@ struct ComputeSubmitter : public Submitter Index countOf32BitValues, void const* srcData ) override; - virtual void setPipelineState(PipelineStateBase* pipeline) override; + virtual void setPipeline(PipelineBase* pipeline) override; ComputeSubmitter(ID3D12GraphicsCommandList* commandList) : m_commandList(commandList) { diff --git a/src/debug-layer/debug-base.h b/src/debug-layer/debug-base.h index 92c81cfc..5a6b2181 100644 --- a/src/debug-layer/debug-base.h +++ b/src/debug-layer/debug-base.h @@ -56,7 +56,7 @@ class DebugCommandQueue; class DebugFramebuffer; class DebugFramebufferLayout; class DebugInputLayout; -class DebugPipelineState; +class DebugPipeline; class DebugRenderPassLayout; class DebugShaderProgram; class DebugTransientResourceHeap; diff --git a/src/debug-layer/debug-command-encoder.cpp b/src/debug-layer/debug-command-encoder.cpp index 5ab3271f..05b4bc84 100644 --- a/src/debug-layer/debug-command-encoder.cpp +++ b/src/debug-layer/debug-command-encoder.cpp @@ -18,7 +18,7 @@ void DebugComputeCommandEncoder::endEncoding() baseObject->endEncoding(); } -Result DebugComputeCommandEncoder::bindPipeline(IPipelineState* state, IShaderObject** outRootShaderObject) +Result DebugComputeCommandEncoder::bindPipeline(IPipeline* state, IShaderObject** outRootShaderObject) { SLANG_RHI_API_FUNC; @@ -31,7 +31,7 @@ Result DebugComputeCommandEncoder::bindPipeline(IPipelineState* state, IShaderOb return result; } -Result DebugComputeCommandEncoder::bindPipelineWithRootObject(IPipelineState* state, IShaderObject* rootObject) +Result DebugComputeCommandEncoder::bindPipelineWithRootObject(IPipeline* state, IShaderObject* rootObject) { SLANG_RHI_API_FUNC; return baseObject->bindPipelineWithRootObject(getInnerObj(state), getInnerObj(rootObject)); @@ -56,7 +56,7 @@ void DebugRenderCommandEncoder::endEncoding() baseObject->endEncoding(); } -Result DebugRenderCommandEncoder::bindPipeline(IPipelineState* state, IShaderObject** outRootShaderObject) +Result DebugRenderCommandEncoder::bindPipeline(IPipeline* state, IShaderObject** outRootShaderObject) { SLANG_RHI_API_FUNC; @@ -69,7 +69,7 @@ Result DebugRenderCommandEncoder::bindPipeline(IPipelineState* state, IShaderObj return result; } -Result DebugRenderCommandEncoder::bindPipelineWithRootObject(IPipelineState* state, IShaderObject* rootObject) +Result DebugRenderCommandEncoder::bindPipelineWithRootObject(IPipeline* state, IShaderObject* rootObject) { SLANG_RHI_API_FUNC; return baseObject->bindPipelineWithRootObject(getInnerObj(state), getInnerObj(rootObject)); @@ -496,7 +496,7 @@ void DebugRayTracingCommandEncoder::deserializeAccelerationStructure(IAccelerati baseObject->deserializeAccelerationStructure(getInnerObj(dest), source); } -Result DebugRayTracingCommandEncoder::bindPipeline(IPipelineState* state, IShaderObject** outRootObject) +Result DebugRayTracingCommandEncoder::bindPipeline(IPipeline* state, IShaderObject** outRootObject) { SLANG_RHI_API_FUNC; auto innerPipeline = getInnerObj(state); @@ -508,7 +508,7 @@ Result DebugRayTracingCommandEncoder::bindPipeline(IPipelineState* state, IShade return result; } -Result DebugRayTracingCommandEncoder::bindPipelineWithRootObject(IPipelineState* state, IShaderObject* rootObject) +Result DebugRayTracingCommandEncoder::bindPipelineWithRootObject(IPipeline* state, IShaderObject* rootObject) { SLANG_RHI_API_FUNC; return baseObject->bindPipelineWithRootObject(getInnerObj(state), getInnerObj(rootObject)); diff --git a/src/debug-layer/debug-command-encoder.h b/src/debug-layer/debug-command-encoder.h index 99e5498e..a209f914 100644 --- a/src/debug-layer/debug-command-encoder.h +++ b/src/debug-layer/debug-command-encoder.h @@ -105,9 +105,9 @@ class DebugComputeCommandEncoder : public UnownedDebugObject outObject = new DebugPipelineState(); - auto result = baseObject->createGraphicsPipelineState(innerDesc, outObject->baseObject.writeRef()); + RefPtr outObject = new DebugPipeline(); + auto result = baseObject->createRenderPipeline(innerDesc, outObject->baseObject.writeRef()); if (SLANG_FAILED(result)) return result; - returnComPtr(outState, outObject); + returnComPtr(outPipeline, outObject); return result; } -Result DebugDevice::createComputePipelineState(const ComputePipelineStateDesc& desc, IPipelineState** outState) +Result DebugDevice::createComputePipeline(const ComputePipelineDesc& desc, IPipeline** outPipeline) { SLANG_RHI_API_FUNC; - ComputePipelineStateDesc innerDesc = desc; + ComputePipelineDesc innerDesc = desc; innerDesc.program = getInnerObj(desc.program); - RefPtr outObject = new DebugPipelineState(); - auto result = baseObject->createComputePipelineState(innerDesc, outObject->baseObject.writeRef()); + RefPtr outObject = new DebugPipeline(); + auto result = baseObject->createComputePipeline(innerDesc, outObject->baseObject.writeRef()); if (SLANG_FAILED(result)) return result; - returnComPtr(outState, outObject); + returnComPtr(outPipeline, outObject); return result; } -Result DebugDevice::createRayTracingPipelineState(const RayTracingPipelineStateDesc& desc, IPipelineState** outState) +Result DebugDevice::createRayTracingPipeline(const RayTracingPipelineDesc& desc, IPipeline** outPipeline) { SLANG_RHI_API_FUNC; - RayTracingPipelineStateDesc innerDesc = desc; + RayTracingPipelineDesc innerDesc = desc; innerDesc.program = getInnerObj(desc.program); - RefPtr outObject = new DebugPipelineState(); - auto result = baseObject->createRayTracingPipelineState(innerDesc, outObject->baseObject.writeRef()); + RefPtr outObject = new DebugPipeline(); + auto result = baseObject->createRayTracingPipeline(innerDesc, outObject->baseObject.writeRef()); if (SLANG_FAILED(result)) return result; - returnComPtr(outState, outObject); + returnComPtr(outPipeline, outObject); return result; } diff --git a/src/debug-layer/debug-device.h b/src/debug-layer/debug-device.h index a8a6be28..f8800944 100644 --- a/src/debug-layer/debug-device.h +++ b/src/debug-layer/debug-device.h @@ -104,11 +104,11 @@ class DebugDevice : public DebugObject ISlangBlob** outDiagnostics ) override; virtual SLANG_NO_THROW Result SLANG_MCALL - createGraphicsPipelineState(const GraphicsPipelineStateDesc& desc, IPipelineState** outState) override; + createRenderPipeline(const RenderPipelineDesc& desc, IPipeline** outPipeline) override; virtual SLANG_NO_THROW Result SLANG_MCALL - createComputePipelineState(const ComputePipelineStateDesc& desc, IPipelineState** outState) override; + createComputePipeline(const ComputePipelineDesc& desc, IPipeline** outPipeline) override; virtual SLANG_NO_THROW Result SLANG_MCALL - createRayTracingPipelineState(const RayTracingPipelineStateDesc& desc, IPipelineState** outState) override; + createRayTracingPipeline(const RayTracingPipelineDesc& desc, IPipeline** outPipeline) override; virtual SLANG_NO_THROW Result SLANG_MCALL readTexture(ITexture* resource, ResourceState state, ISlangBlob** outBlob, Size* outRowPitch, Size* outPixelSize) override; diff --git a/src/debug-layer/debug-helper-functions.cpp b/src/debug-layer/debug-helper-functions.cpp index d2204538..dd581e15 100644 --- a/src/debug-layer/debug-helper-functions.cpp +++ b/src/debug-layer/debug-helper-functions.cpp @@ -14,7 +14,7 @@ SLANG_RHI_DEBUG_GET_INTERFACE_IMPL(Framebuffer) SLANG_RHI_DEBUG_GET_INTERFACE_IMPL(FramebufferLayout) SLANG_RHI_DEBUG_GET_INTERFACE_IMPL(InputLayout) SLANG_RHI_DEBUG_GET_INTERFACE_IMPL(RenderPassLayout) -SLANG_RHI_DEBUG_GET_INTERFACE_IMPL(PipelineState) +SLANG_RHI_DEBUG_GET_INTERFACE_IMPL(Pipeline) SLANG_RHI_DEBUG_GET_INTERFACE_IMPL(ResourceView) SLANG_RHI_DEBUG_GET_INTERFACE_IMPL(Sampler) SLANG_RHI_DEBUG_GET_INTERFACE_IMPL(ShaderObject) diff --git a/src/debug-layer/debug-helper-functions.h b/src/debug-layer/debug-helper-functions.h index c5302e56..58a4cdac 100644 --- a/src/debug-layer/debug-helper-functions.h +++ b/src/debug-layer/debug-helper-functions.h @@ -165,7 +165,7 @@ SLANG_RHI_DEBUG_GET_OBJ_IMPL(Framebuffer) SLANG_RHI_DEBUG_GET_OBJ_IMPL(FramebufferLayout) SLANG_RHI_DEBUG_GET_OBJ_IMPL(InputLayout) SLANG_RHI_DEBUG_GET_OBJ_IMPL(RenderPassLayout) -SLANG_RHI_DEBUG_GET_OBJ_IMPL(PipelineState) +SLANG_RHI_DEBUG_GET_OBJ_IMPL(Pipeline) SLANG_RHI_DEBUG_GET_OBJ_IMPL(ResourceView) SLANG_RHI_DEBUG_GET_OBJ_IMPL(Sampler) SLANG_RHI_DEBUG_GET_OBJ_IMPL(ShaderObject) diff --git a/src/debug-layer/debug-pipeline-state.cpp b/src/debug-layer/debug-pipeline-state.cpp index 25048e13..14989f1d 100644 --- a/src/debug-layer/debug-pipeline-state.cpp +++ b/src/debug-layer/debug-pipeline-state.cpp @@ -3,7 +3,7 @@ namespace rhi::debug { -Result DebugPipelineState::getNativeHandle(InteropHandle* outHandle) +Result DebugPipeline::getNativeHandle(InteropHandle* outHandle) { SLANG_RHI_API_FUNC; return baseObject->getNativeHandle(outHandle); diff --git a/src/debug-layer/debug-pipeline-state.h b/src/debug-layer/debug-pipeline-state.h index 8620ec21..e689ecb5 100644 --- a/src/debug-layer/debug-pipeline-state.h +++ b/src/debug-layer/debug-pipeline-state.h @@ -4,13 +4,13 @@ namespace rhi::debug { -class DebugPipelineState : public DebugObject +class DebugPipeline : public DebugObject { public: SLANG_COM_OBJECT_IUNKNOWN_ALL; public: - IPipelineState* getInterface(const Guid& guid); + IPipeline* getInterface(const Guid& guid); virtual SLANG_NO_THROW Result SLANG_MCALL getNativeHandle(InteropHandle* outHandle) override; }; diff --git a/src/immediate-renderer-base.cpp b/src/immediate-renderer-base.cpp index 0b8db0f3..e8df4571 100644 --- a/src/immediate-renderer-base.cpp +++ b/src/immediate-renderer-base.cpp @@ -280,11 +280,10 @@ class CommandBufferImpl : public ICommandBuffer, public ComObject m_writer->clearFrame(clearMask, clearDepth, clearStencil); } - virtual SLANG_NO_THROW Result SLANG_MCALL - bindPipeline(IPipelineState* state, IShaderObject** outRootObject) override + virtual SLANG_NO_THROW Result SLANG_MCALL bindPipeline(IPipeline* state, IShaderObject** outRootObject) override { - m_writer->setPipelineState(state); - auto stateImpl = static_cast(state); + m_writer->setPipeline(state); + auto stateImpl = static_cast(state); SLANG_RETURN_ON_FAIL(m_commandBuffer->m_renderer->createRootShaderObject( stateImpl->m_program, m_commandBuffer->m_rootShaderObject.writeRef() @@ -294,10 +293,10 @@ class CommandBufferImpl : public ICommandBuffer, public ComObject } virtual SLANG_NO_THROW Result SLANG_MCALL - bindPipelineWithRootObject(IPipelineState* state, IShaderObject* rootObject) override + bindPipelineWithRootObject(IPipeline* state, IShaderObject* rootObject) override { - m_writer->setPipelineState(state); - auto stateImpl = static_cast(state); + m_writer->setPipeline(state); + auto stateImpl = static_cast(state); SLANG_RETURN_ON_FAIL(m_commandBuffer->m_renderer->createRootShaderObject( stateImpl->m_program, m_commandBuffer->m_rootShaderObject.writeRef() @@ -462,11 +461,10 @@ class CommandBufferImpl : public ICommandBuffer, public ComObject public: virtual SLANG_NO_THROW void SLANG_MCALL endEncoding() override {} - virtual SLANG_NO_THROW Result SLANG_MCALL - bindPipeline(IPipelineState* state, IShaderObject** outRootObject) override + virtual SLANG_NO_THROW Result SLANG_MCALL bindPipeline(IPipeline* state, IShaderObject** outRootObject) override { - m_writer->setPipelineState(state); - auto stateImpl = static_cast(state); + m_writer->setPipeline(state); + auto stateImpl = static_cast(state); SLANG_RETURN_ON_FAIL(m_commandBuffer->m_renderer->createRootShaderObject( stateImpl->m_program, m_commandBuffer->m_rootShaderObject.writeRef() @@ -476,10 +474,10 @@ class CommandBufferImpl : public ICommandBuffer, public ComObject } virtual SLANG_NO_THROW Result SLANG_MCALL - bindPipelineWithRootObject(IPipelineState* state, IShaderObject* rootObject) override + bindPipelineWithRootObject(IPipeline* state, IShaderObject* rootObject) override { - m_writer->setPipelineState(state); - auto stateImpl = static_cast(state); + m_writer->setPipeline(state); + auto stateImpl = static_cast(state); SLANG_RETURN_ON_FAIL(m_commandBuffer->m_renderer->createRootShaderObject( stateImpl->m_program, m_commandBuffer->m_rootShaderObject.writeRef() @@ -524,8 +522,8 @@ class CommandBufferImpl : public ICommandBuffer, public ComObject auto name = cmd.name; switch (name) { - case CommandName::SetPipelineState: - m_renderer->setPipelineState(m_writer.getObject(cmd.operands[0])); + case CommandName::SetPipeline: + m_renderer->setPipeline(m_writer.getObject(cmd.operands[0])); break; case CommandName::BindRootShaderObject: m_renderer->bindRootShaderObject(m_writer.getObject(cmd.operands[0])); diff --git a/src/immediate-renderer-base.h b/src/immediate-renderer-base.h index 9be6d64b..671ea8bc 100644 --- a/src/immediate-renderer-base.h +++ b/src/immediate-renderer-base.h @@ -48,7 +48,7 @@ class ImmediateRendererBase : public RendererBase // Immediate commands to be implemented by each target. virtual Result createRootShaderObject(IShaderProgram* program, ShaderObjectBase** outObject) = 0; virtual void bindRootShaderObject(IShaderObject* rootObject) = 0; - virtual void setPipelineState(IPipelineState* state) = 0; + virtual void setPipeline(IPipeline* state) = 0; virtual void setFramebuffer(IFramebuffer* frameBuffer) = 0; virtual void clearFrame(uint32_t colorBufferMask, bool clearDepth, bool clearStencil) = 0; virtual void setViewports(GfxCount count, const Viewport* viewports) = 0; @@ -224,10 +224,10 @@ class ImmediateComputeDeviceBase : public ImmediateRendererBase return SLANG_E_NOT_AVAILABLE; } virtual SLANG_NO_THROW Result SLANG_MCALL - createGraphicsPipelineState(const GraphicsPipelineStateDesc& desc, IPipelineState** outState) override + createRenderPipeline(const RenderPipelineDesc& desc, IPipeline** outPipeline) override { SLANG_UNUSED(desc); - SLANG_UNUSED(outState); + SLANG_UNUSED(outPipeline); return SLANG_E_NOT_AVAILABLE; } virtual SLANG_NO_THROW Result SLANG_MCALL diff --git a/src/metal/metal-base.h b/src/metal/metal-base.h index e000305a..69b05cc4 100644 --- a/src/metal/metal-base.h +++ b/src/metal/metal-base.h @@ -25,8 +25,8 @@ class AccelerationStructureImpl; class FramebufferLayoutImpl; class RenderPassLayoutImpl; class FramebufferImpl; -class PipelineStateImpl; -class RayTracingPipelineStateImpl; +class PipelineImpl; +class RayTracingPipelineImpl; class ShaderObjectLayoutImpl; class EntryPointLayout; class RootShaderObjectLayoutImpl; diff --git a/src/metal/metal-command-encoder.cpp b/src/metal/metal-command-encoder.cpp index 41233bd5..8754b6e6 100644 --- a/src/metal/metal-command-encoder.cpp +++ b/src/metal/metal-command-encoder.cpp @@ -24,9 +24,9 @@ void PipelineCommandEncoder::endEncodingImpl() m_commandBuffer->endMetalCommandEncoder(); } -Result PipelineCommandEncoder::setPipelineStateImpl(IPipelineState* state, IShaderObject** outRootObject) +Result PipelineCommandEncoder::setPipelineImpl(IPipeline* state, IShaderObject** outRootObject) { - m_currentPipeline = static_cast(state); + m_currentPipeline = static_cast(state); // m_commandBuffer->m_mutableRootShaderObject = nullptr; SLANG_RETURN_ON_FAIL(m_commandBuffer->m_rootObject.init( m_commandBuffer->m_device, @@ -275,12 +275,12 @@ void RenderCommandEncoder::endEncoding() PipelineCommandEncoder::endEncodingImpl(); } -Result RenderCommandEncoder::bindPipeline(IPipelineState* pipelineState, IShaderObject** outRootObject) +Result RenderCommandEncoder::bindPipeline(IPipeline* pipeline, IShaderObject** outRootObject) { - return setPipelineStateImpl(pipelineState, outRootObject); + return setPipelineImpl(pipeline, outRootObject); } -Result RenderCommandEncoder::bindPipelineWithRootObject(IPipelineState* pipelineState, IShaderObject* rootObject) +Result RenderCommandEncoder::bindPipelineWithRootObject(IPipeline* pipeline, IShaderObject* rootObject) { return SLANG_E_NOT_IMPLEMENTED; } @@ -373,8 +373,8 @@ Result RenderCommandEncoder::setSamplePositions( Result RenderCommandEncoder::prepareDraw(MTL::RenderCommandEncoder*& encoder) { - auto pipeline = static_cast(m_currentPipeline.Ptr()); - pipeline->ensureAPIPipelineStateCreated(); + auto pipeline = static_cast(m_currentPipeline.Ptr()); + pipeline->ensureAPIPipelineCreated(); encoder = m_commandBuffer->getMetalRenderCommandEncoder(m_renderPassDesc.get()); encoder->setRenderPipelineState(pipeline->m_renderPipelineState.get()); @@ -500,12 +500,12 @@ void ComputeCommandEncoder::endEncoding() ResourceCommandEncoder::endEncoding(); } -Result ComputeCommandEncoder::bindPipeline(IPipelineState* pipelineState, IShaderObject** outRootObject) +Result ComputeCommandEncoder::bindPipeline(IPipeline* pipeline, IShaderObject** outRootObject) { - return setPipelineStateImpl(pipelineState, outRootObject); + return setPipelineImpl(pipeline, outRootObject); } -Result ComputeCommandEncoder::bindPipelineWithRootObject(IPipelineState* pipelineState, IShaderObject* rootObject) +Result ComputeCommandEncoder::bindPipelineWithRootObject(IPipeline* pipeline, IShaderObject* rootObject) { return SLANG_E_NOT_IMPLEMENTED; } @@ -519,18 +519,18 @@ Result ComputeCommandEncoder::dispatchCompute(int x, int y, int z) auto program = static_cast(m_currentPipeline->m_program.get()); m_commandBuffer->m_rootObject.bindAsRoot(&bindingContext, program->m_rootObjectLayout); - auto pipeline = static_cast(m_currentPipeline.Ptr()); + auto pipeline = static_cast(m_currentPipeline.Ptr()); RootShaderObjectImpl* rootObjectImpl = &m_commandBuffer->m_rootObject; - RefPtr newPipeline; + RefPtr newPipeline; SLANG_RETURN_ON_FAIL( m_commandBuffer->m_device->maybeSpecializePipeline(m_currentPipeline, rootObjectImpl, newPipeline) ); - PipelineStateImpl* newPipelineImpl = static_cast(newPipeline.Ptr()); + PipelineImpl* newPipelineImpl = static_cast(newPipeline.Ptr()); - SLANG_RETURN_ON_FAIL(newPipelineImpl->ensureAPIPipelineStateCreated()); + SLANG_RETURN_ON_FAIL(newPipelineImpl->ensureAPIPipelineCreated()); m_currentPipeline = newPipelineImpl; - m_currentPipeline->ensureAPIPipelineStateCreated(); + m_currentPipeline->ensureAPIPipelineCreated(); encoder->setComputePipelineState(m_currentPipeline->m_computePipelineState.get()); encoder->dispatchThreadgroups(MTL::Size(x, y, z), m_currentPipeline->m_threadGroupSize); @@ -591,12 +591,12 @@ void RayTracingCommandEncoder::serializeAccelerationStructure(DeviceAddress dest void RayTracingCommandEncoder::deserializeAccelerationStructure(IAccelerationStructure* dest, DeviceAddress source) {} -Result RayTracingCommandEncoder::bindPipeline(IPipelineState* pipeline, IShaderObject** outRootObject) +Result RayTracingCommandEncoder::bindPipeline(IPipeline* pipeline, IShaderObject** outRootObject) { return SLANG_E_NOT_IMPLEMENTED; } -Result RayTracingCommandEncoder::bindPipelineWithRootObject(IPipelineState* pipelineState, IShaderObject* rootObject) +Result RayTracingCommandEncoder::bindPipelineWithRootObject(IPipeline* pipeline, IShaderObject* rootObject) { return SLANG_E_NOT_IMPLEMENTED; } diff --git a/src/metal/metal-command-encoder.h b/src/metal/metal-command-encoder.h index 28ef4377..cf323f64 100644 --- a/src/metal/metal-command-encoder.h +++ b/src/metal/metal-command-encoder.h @@ -13,12 +13,12 @@ class PipelineCommandEncoder : public ComObject public: CommandBufferImpl* m_commandBuffer; MTL::CommandBuffer* m_metalCommandBuffer; - RefPtr m_currentPipeline; + RefPtr m_currentPipeline; void init(CommandBufferImpl* commandBuffer); void endEncodingImpl(); - Result setPipelineStateImpl(IPipelineState* state, IShaderObject** outRootObject); + Result setPipelineImpl(IPipeline* state, IShaderObject** outRootObject); }; class ResourceCommandEncoder : public IResourceCommandEncoder, public PipelineCommandEncoder @@ -157,11 +157,10 @@ class RenderCommandEncoder : public IRenderCommandEncoder, public ResourceComman virtual SLANG_NO_THROW void SLANG_MCALL endEncoding() override; - virtual SLANG_NO_THROW Result SLANG_MCALL - bindPipeline(IPipelineState* pipelineState, IShaderObject** outRootObject) override; + virtual SLANG_NO_THROW Result SLANG_MCALL bindPipeline(IPipeline* pipeline, IShaderObject** outRootObject) override; virtual SLANG_NO_THROW Result SLANG_MCALL - bindPipelineWithRootObject(IPipelineState* pipelineState, IShaderObject* rootObject) override; + bindPipelineWithRootObject(IPipeline* pipeline, IShaderObject* rootObject) override; virtual SLANG_NO_THROW void SLANG_MCALL setViewports(GfxCount count, const Viewport* viewports) override; @@ -229,11 +228,10 @@ class ComputeCommandEncoder : public IComputeCommandEncoder, public ResourceComm virtual SLANG_NO_THROW void SLANG_MCALL endEncoding() override; - virtual SLANG_NO_THROW Result SLANG_MCALL - bindPipeline(IPipelineState* pipelineState, IShaderObject** outRootObject) override; + virtual SLANG_NO_THROW Result SLANG_MCALL bindPipeline(IPipeline* pipeline, IShaderObject** outRootObject) override; virtual SLANG_NO_THROW Result SLANG_MCALL - bindPipelineWithRootObject(IPipelineState* pipelineState, IShaderObject* rootObject) override; + bindPipelineWithRootObject(IPipeline* pipeline, IShaderObject* rootObject) override; virtual SLANG_NO_THROW Result SLANG_MCALL dispatchCompute(int x, int y, int z) override; @@ -294,11 +292,10 @@ class RayTracingCommandEncoder : public IRayTracingCommandEncoder, public Resour virtual SLANG_NO_THROW void SLANG_MCALL deserializeAccelerationStructure(IAccelerationStructure* dest, DeviceAddress source) override; - virtual SLANG_NO_THROW Result SLANG_MCALL - bindPipeline(IPipelineState* pipeline, IShaderObject** outRootObject) override; + virtual SLANG_NO_THROW Result SLANG_MCALL bindPipeline(IPipeline* pipeline, IShaderObject** outRootObject) override; virtual SLANG_NO_THROW Result SLANG_MCALL - bindPipelineWithRootObject(IPipelineState* pipelineState, IShaderObject* rootObject) override; + bindPipelineWithRootObject(IPipeline* pipeline, IShaderObject* rootObject) override; virtual SLANG_NO_THROW Result SLANG_MCALL dispatchRays(GfxIndex raygenShaderIndex, IShaderTable* shaderTable, GfxCount width, GfxCount height, GfxCount depth) diff --git a/src/metal/metal-device.cpp b/src/metal/metal-device.cpp index 5030d1e9..397425f8 100644 --- a/src/metal/metal-device.cpp +++ b/src/metal/metal-device.cpp @@ -753,28 +753,28 @@ Result DeviceImpl::createShaderTable(const IShaderTable::Desc& desc, IShaderTabl return SLANG_E_NOT_IMPLEMENTED; } -Result DeviceImpl::createGraphicsPipelineState(const GraphicsPipelineStateDesc& desc, IPipelineState** outState) +Result DeviceImpl::createRenderPipeline(const RenderPipelineDesc& desc, IPipeline** outPipeline) { AUTORELEASEPOOL - RefPtr pipelineStateImpl = new PipelineStateImpl(this); - pipelineStateImpl->init(desc); - returnComPtr(outState, pipelineStateImpl); + RefPtr pipelineImpl = new PipelineImpl(this); + pipelineImpl->init(desc); + returnComPtr(outPipeline, pipelineImpl); return SLANG_OK; } -Result DeviceImpl::createComputePipelineState(const ComputePipelineStateDesc& desc, IPipelineState** outState) +Result DeviceImpl::createComputePipeline(const ComputePipelineDesc& desc, IPipeline** outPipeline) { AUTORELEASEPOOL - RefPtr pipelineStateImpl = new PipelineStateImpl(this); - pipelineStateImpl->init(desc); - m_deviceObjectsWithPotentialBackReferences.push_back(pipelineStateImpl); - returnComPtr(outState, pipelineStateImpl); + RefPtr pipelineImpl = new PipelineImpl(this); + pipelineImpl->init(desc); + m_deviceObjectsWithPotentialBackReferences.push_back(pipelineImpl); + returnComPtr(outPipeline, pipelineImpl); return SLANG_OK; } -Result DeviceImpl::createRayTracingPipelineState(const RayTracingPipelineStateDesc& desc, IPipelineState** outState) +Result DeviceImpl::createRayTracingPipeline(const RayTracingPipelineDesc& desc, IPipeline** outPipeline) { AUTORELEASEPOOL diff --git a/src/metal/metal-device.h b/src/metal/metal-device.h index 9096dbdb..4ef6fdd9 100644 --- a/src/metal/metal-device.h +++ b/src/metal/metal-device.h @@ -65,11 +65,11 @@ class DeviceImpl : public RendererBase ISlangBlob** outDiagnosticBlob ) override; virtual SLANG_NO_THROW Result SLANG_MCALL - createGraphicsPipelineState(const GraphicsPipelineStateDesc& desc, IPipelineState** outState) override; + createRenderPipeline(const RenderPipelineDesc& desc, IPipeline** outPipeline) override; virtual SLANG_NO_THROW Result SLANG_MCALL - createComputePipelineState(const ComputePipelineStateDesc& desc, IPipelineState** outState) override; + createComputePipeline(const ComputePipelineDesc& desc, IPipeline** outPipeline) override; virtual SLANG_NO_THROW Result SLANG_MCALL - createRayTracingPipelineState(const RayTracingPipelineStateDesc& desc, IPipelineState** outState) override; + createRayTracingPipeline(const RayTracingPipelineDesc& desc, IPipeline** outPipeline) override; virtual SLANG_NO_THROW Result SLANG_MCALL createQueryPool(const IQueryPool::Desc& desc, IQueryPool** outPool) override; @@ -122,7 +122,7 @@ class DeviceImpl : public RendererBase // A list to hold objects that may have a strong back reference to the device // instance. Because of the pipeline cache in `RendererBase`, there could be a reference - // cycle among `DeviceImpl`->`PipelineStateImpl`->`ShaderProgramImpl`->`DeviceImpl`. + // cycle among `DeviceImpl`->`PipelineImpl`->`ShaderProgramImpl`->`DeviceImpl`. // Depending on whether a `PipelineState` objects gets stored in pipeline cache, there // may or may not be such a reference cycle. // We need to hold strong references to any objects that may become part of the reference diff --git a/src/metal/metal-pipeline-state.cpp b/src/metal/metal-pipeline-state.cpp index c69f58aa..09cb177f 100644 --- a/src/metal/metal-pipeline-state.cpp +++ b/src/metal/metal-pipeline-state.cpp @@ -7,14 +7,14 @@ namespace rhi::metal { -PipelineStateImpl::PipelineStateImpl(DeviceImpl* device) +PipelineImpl::PipelineImpl(DeviceImpl* device) : m_device(device) { } -PipelineStateImpl::~PipelineStateImpl() {} +PipelineImpl::~PipelineImpl() {} -void PipelineStateImpl::init(const GraphicsPipelineStateDesc& desc) +void PipelineImpl::init(const RenderPipelineDesc& desc) { PipelineStateDesc pipelineDesc; pipelineDesc.type = PipelineType::Graphics; @@ -22,7 +22,7 @@ void PipelineStateImpl::init(const GraphicsPipelineStateDesc& desc) initializeBase(pipelineDesc); } -void PipelineStateImpl::init(const ComputePipelineStateDesc& desc) +void PipelineImpl::init(const ComputePipelineDesc& desc) { PipelineStateDesc pipelineDesc; pipelineDesc.type = PipelineType::Compute; @@ -30,7 +30,7 @@ void PipelineStateImpl::init(const ComputePipelineStateDesc& desc) initializeBase(pipelineDesc); } -void PipelineStateImpl::init(const RayTracingPipelineStateDesc& desc) +void PipelineImpl::init(const RayTracingPipelineDesc& desc) { PipelineStateDesc pipelineDesc; pipelineDesc.type = PipelineType::RayTracing; @@ -38,7 +38,7 @@ void PipelineStateImpl::init(const RayTracingPipelineStateDesc& desc) initializeBase(pipelineDesc); } -Result PipelineStateImpl::createMetalRenderPipelineState() +Result PipelineImpl::createMetalRenderPipelineState() { auto programImpl = static_cast(m_program.Ptr()); if (!programImpl) @@ -173,7 +173,7 @@ Result PipelineStateImpl::createMetalRenderPipelineState() return SLANG_OK; } -Result PipelineStateImpl::createMetalComputePipelineState() +Result PipelineImpl::createMetalComputePipelineState() { auto programImpl = static_cast(m_program.Ptr()); if (!programImpl) @@ -196,7 +196,7 @@ Result PipelineStateImpl::createMetalComputePipelineState() return m_computePipelineState ? SLANG_OK : SLANG_FAIL; } -Result PipelineStateImpl::ensureAPIPipelineStateCreated() +Result PipelineImpl::ensureAPIPipelineCreated() { AUTORELEASEPOOL @@ -213,7 +213,7 @@ Result PipelineStateImpl::ensureAPIPipelineStateCreated() return SLANG_OK; } -SLANG_NO_THROW Result SLANG_MCALL PipelineStateImpl::getNativeHandle(InteropHandle* outHandle) +SLANG_NO_THROW Result SLANG_MCALL PipelineImpl::getNativeHandle(InteropHandle* outHandle) { switch (desc.type) { @@ -229,17 +229,17 @@ SLANG_NO_THROW Result SLANG_MCALL PipelineStateImpl::getNativeHandle(InteropHand return SLANG_FAIL; } -RayTracingPipelineStateImpl::RayTracingPipelineStateImpl(DeviceImpl* device) - : PipelineStateImpl(device) +RayTracingPipelineImpl::RayTracingPipelineImpl(DeviceImpl* device) + : PipelineImpl(device) { } -Result RayTracingPipelineStateImpl::ensureAPIPipelineStateCreated() +Result RayTracingPipelineImpl::ensureAPIPipelineCreated() { return SLANG_E_NOT_IMPLEMENTED; } -Result RayTracingPipelineStateImpl::getNativeHandle(InteropHandle* outHandle) +Result RayTracingPipelineImpl::getNativeHandle(InteropHandle* outHandle) { return SLANG_E_NOT_IMPLEMENTED; } diff --git a/src/metal/metal-pipeline-state.h b/src/metal/metal-pipeline-state.h index 119f3845..385dfb59 100644 --- a/src/metal/metal-pipeline-state.h +++ b/src/metal/metal-pipeline-state.h @@ -7,7 +7,7 @@ namespace rhi::metal { -class PipelineStateImpl : public PipelineStateBase +class PipelineImpl : public PipelineBase { public: DeviceImpl* m_device; @@ -17,30 +17,30 @@ class PipelineStateImpl : public PipelineStateBase MTL::Size m_threadGroupSize; NS::UInteger m_vertexBufferOffset; - PipelineStateImpl(DeviceImpl* device); - ~PipelineStateImpl(); + PipelineImpl(DeviceImpl* device); + ~PipelineImpl(); - void init(const GraphicsPipelineStateDesc& desc); - void init(const ComputePipelineStateDesc& desc); - void init(const RayTracingPipelineStateDesc& desc); + void init(const RenderPipelineDesc& desc); + void init(const ComputePipelineDesc& desc); + void init(const RayTracingPipelineDesc& desc); Result createMetalComputePipelineState(); Result createMetalRenderPipelineState(); - virtual Result ensureAPIPipelineStateCreated() override; + virtual Result ensureAPIPipelineCreated() override; virtual SLANG_NO_THROW Result SLANG_MCALL getNativeHandle(InteropHandle* outHandle) override; }; -class RayTracingPipelineStateImpl : public PipelineStateImpl +class RayTracingPipelineImpl : public PipelineImpl { public: std::map shaderGroupNameToIndex; Int shaderGroupCount; - RayTracingPipelineStateImpl(DeviceImpl* device); + RayTracingPipelineImpl(DeviceImpl* device); - virtual Result ensureAPIPipelineStateCreated() override; + virtual Result ensureAPIPipelineCreated() override; virtual SLANG_NO_THROW Result SLANG_MCALL getNativeHandle(InteropHandle* outHandle) override; }; diff --git a/src/metal/metal-shader-table.cpp b/src/metal/metal-shader-table.cpp index 0fd043c9..337dd0d3 100644 --- a/src/metal/metal-shader-table.cpp +++ b/src/metal/metal-shader-table.cpp @@ -4,7 +4,7 @@ namespace rhi::metal { RefPtr ShaderTableImpl::createDeviceBuffer( - PipelineStateBase* pipeline, + PipelineBase* pipeline, TransientResourceHeapBase* transientHeap, IResourceCommandEncoder* encoder ) diff --git a/src/metal/metal-shader-table.h b/src/metal/metal-shader-table.h index f03fc190..4c88be1f 100644 --- a/src/metal/metal-shader-table.h +++ b/src/metal/metal-shader-table.h @@ -15,7 +15,7 @@ class ShaderTableImpl : public ShaderTableBase DeviceImpl* m_device; virtual RefPtr createDeviceBuffer( - PipelineStateBase* pipeline, + PipelineBase* pipeline, TransientResourceHeapBase* transientHeap, IResourceCommandEncoder* encoder ) override; diff --git a/src/renderer-shared.cpp b/src/renderer-shared.cpp index b08cfd5c..43375546 100644 --- a/src/renderer-shared.cpp +++ b/src/renderer-shared.cpp @@ -15,7 +15,7 @@ namespace rhi { const Guid GUID::IID_ISlangUnknown = SLANG_UUID_ISlangUnknown; const Guid GUID::IID_IShaderProgram = IShaderProgram::getTypeGuid(); const Guid GUID::IID_IInputLayout = IInputLayout::getTypeGuid(); -const Guid GUID::IID_IPipelineState = IPipelineState::getTypeGuid(); +const Guid GUID::IID_IPipeline = IPipeline::getTypeGuid(); const Guid GUID::IID_ITransientResourceHeap = ITransientResourceHeap::getTypeGuid(); const Guid GUID::IID_IResourceView = IResourceView::getTypeGuid(); const Guid GUID::IID_IFramebuffer = IFramebuffer::getTypeGuid(); @@ -236,21 +236,21 @@ IQueryPool* QueryPoolBase::getInterface(const Guid& guid) return nullptr; } -IPipelineState* PipelineStateBase::getInterface(const Guid& guid) +IPipeline* PipelineBase::getInterface(const Guid& guid) { - if (guid == GUID::IID_ISlangUnknown || guid == GUID::IID_IPipelineState) - return static_cast(this); + if (guid == GUID::IID_ISlangUnknown || guid == GUID::IID_IPipeline) + return static_cast(this); return nullptr; } -Result PipelineStateBase::getNativeHandle(InteropHandle* outHandle) +Result PipelineBase::getNativeHandle(InteropHandle* outHandle) { outHandle->api = InteropHandleAPI::Unknown; outHandle->handleValue = 0; return SLANG_E_NOT_IMPLEMENTED; } -void PipelineStateBase::initializeBase(const PipelineStateDesc& inDesc) +void PipelineBase::initializeBase(const PipelineStateDesc& inDesc) { desc = inDesc; @@ -602,10 +602,10 @@ Result RendererBase::createShaderTable(const IShaderTable::Desc& desc, IShaderTa return SLANG_E_NOT_AVAILABLE; } -Result RendererBase::createRayTracingPipelineState(const RayTracingPipelineStateDesc& desc, IPipelineState** outState) +Result RendererBase::createRayTracingPipeline(const RayTracingPipelineDesc& desc, IPipeline** outPipeline) { SLANG_UNUSED(desc); - SLANG_UNUSED(outState); + SLANG_UNUSED(outPipeline); return SLANG_E_NOT_AVAILABLE; } @@ -758,7 +758,7 @@ ShaderComponentID ShaderCache::getComponentId(ComponentKey key) return resultId; } -void ShaderCache::addSpecializedPipeline(PipelineKey key, RefPtr specializedPipeline) +void ShaderCache::addSpecializedPipeline(PipelineKey key, RefPtr specializedPipeline) { specializedPipelines[key] = specializedPipeline; } @@ -1018,16 +1018,16 @@ bool ShaderProgramBase::isMeshShaderProgram() const } Result RendererBase::maybeSpecializePipeline( - PipelineStateBase* currentPipeline, + PipelineBase* currentPipeline, ShaderObjectBase* rootObject, - RefPtr& outNewPipeline + RefPtr& outNewPipeline ) { - outNewPipeline = static_cast(currentPipeline); + outNewPipeline = static_cast(currentPipeline); auto pipelineType = currentPipeline->desc.type; - if (currentPipeline->unspecializedPipelineState) - currentPipeline = currentPipeline->unspecializedPipelineState; + if (currentPipeline->unspecializedPipeline) + currentPipeline = currentPipeline->unspecializedPipeline; // If the currently bound pipeline is specializable, we need to specialize it based on bound shader objects. if (currentPipeline->isSpecializable) { @@ -1043,9 +1043,9 @@ Result RendererBase::maybeSpecializePipeline( } pipelineKey.updateHash(); - RefPtr specializedPipelineState = shaderCache.getSpecializedPipelineState(pipelineKey); + RefPtr specializedPipeline = shaderCache.getSpecializedPipeline(pipelineKey); // Try to find specialized pipeline from shader cache. - if (!specializedPipelineState) + if (!specializedPipeline) { auto unspecializedProgram = static_cast( pipelineType == PipelineType::Compute ? currentPipeline->desc.compute.program @@ -1086,41 +1086,40 @@ Result RendererBase::maybeSpecializePipeline( SLANG_RETURN_ON_FAIL(createProgram(specializedProgramDesc, specializedProgram.writeRef())); // Create specialized pipeline state. - ComPtr specializedPipelineComPtr; + ComPtr specializedPipelineComPtr; switch (pipelineType) { case PipelineType::Compute: { auto pipelineDesc = currentPipeline->desc.compute; pipelineDesc.program = specializedProgram; - SLANG_RETURN_ON_FAIL(createComputePipelineState(pipelineDesc, specializedPipelineComPtr.writeRef())); + SLANG_RETURN_ON_FAIL(createComputePipeline(pipelineDesc, specializedPipelineComPtr.writeRef())); break; } case PipelineType::Graphics: { auto pipelineDesc = currentPipeline->desc.graphics; pipelineDesc.program = static_cast(specializedProgram.get()); - SLANG_RETURN_ON_FAIL(createGraphicsPipelineState(pipelineDesc, specializedPipelineComPtr.writeRef())); + SLANG_RETURN_ON_FAIL(createRenderPipeline(pipelineDesc, specializedPipelineComPtr.writeRef())); break; } case PipelineType::RayTracing: { auto pipelineDesc = currentPipeline->desc.rayTracing; pipelineDesc.program = static_cast(specializedProgram.get()); - SLANG_RETURN_ON_FAIL( - createRayTracingPipelineState(pipelineDesc.get(), specializedPipelineComPtr.writeRef()) + SLANG_RETURN_ON_FAIL(createRayTracingPipeline(pipelineDesc.get(), specializedPipelineComPtr.writeRef()) ); break; } default: break; } - specializedPipelineState = static_cast(specializedPipelineComPtr.get()); - specializedPipelineState->unspecializedPipelineState = currentPipeline; - shaderCache.addSpecializedPipeline(pipelineKey, specializedPipelineState); + specializedPipeline = static_cast(specializedPipelineComPtr.get()); + specializedPipeline->unspecializedPipeline = currentPipeline; + shaderCache.addSpecializedPipeline(pipelineKey, specializedPipeline); } - auto specializedPipelineStateBase = static_cast(specializedPipelineState.Ptr()); - outNewPipeline = specializedPipelineStateBase; + auto specializedPipelineBase = static_cast(specializedPipeline.Ptr()); + outNewPipeline = specializedPipelineBase; } return SLANG_OK; } diff --git a/src/renderer-shared.h b/src/renderer-shared.h index 52760b76..440e2eee 100644 --- a/src/renderer-shared.h +++ b/src/renderer-shared.h @@ -22,7 +22,7 @@ struct GUID static const Guid IID_ISlangUnknown; static const Guid IID_IShaderProgram; static const Guid IID_ITransientResourceHeap; - static const Guid IID_IPipelineState; + static const Guid IID_IPipeline; static const Guid IID_IResourceView; static const Guid IID_IFramebuffer; static const Guid IID_IFramebufferLayout; @@ -889,7 +889,7 @@ struct OwnedHitGroupDesc } }; -struct OwnedRayTracingPipelineStateDesc +struct OwnedRayTracingPipelineDesc { RefPtr program; std::vector hitGroups; @@ -899,14 +899,14 @@ struct OwnedRayTracingPipelineStateDesc Size maxAttributeSizeInBytes = 8; RayTracingPipelineFlags::Enum flags = RayTracingPipelineFlags::None; - RayTracingPipelineStateDesc get() + RayTracingPipelineDesc get() { // TODO horrible hack to update the c-strings after this struct is copied. for (int32_t i = 0; i < hitGroupDescs.size(); i++) { hitGroupDescs[i] = hitGroups[i].get(); } - RayTracingPipelineStateDesc desc; + RayTracingPipelineDesc desc; desc.program = program.Ptr(); desc.hitGroupCount = (int32_t)hitGroupDescs.size(); desc.hitGroups = hitGroupDescs.data(); @@ -917,7 +917,7 @@ struct OwnedRayTracingPipelineStateDesc return desc; } - void set(const RayTracingPipelineStateDesc& inDesc) + void set(const RayTracingPipelineDesc& inDesc) { program = static_cast(inDesc.program); hitGroups.resize(inDesc.hitGroupCount); @@ -936,18 +936,18 @@ struct OwnedRayTracingPipelineStateDesc } }; -class PipelineStateBase : public IPipelineState, public ComObject +class PipelineBase : public IPipeline, public ComObject { public: SLANG_COM_OBJECT_IUNKNOWN_ALL - IPipelineState* getInterface(const Guid& guid); + IPipeline* getInterface(const Guid& guid); struct PipelineStateDesc { PipelineType type; - GraphicsPipelineStateDesc graphics; - ComputePipelineStateDesc compute; - OwnedRayTracingPipelineStateDesc rayTracing; + RenderPipelineDesc graphics; + ComputePipelineDesc compute; + OwnedRayTracingPipelineDesc rayTracing; ShaderProgramBase* getProgram() { switch (type) @@ -970,7 +970,7 @@ class PipelineStateBase : public IPipelineState, public ComObject // The pipeline state from which this pipeline state is specialized. // If null, this pipeline is either an unspecialized pipeline. - RefPtr unspecializedPipelineState = nullptr; + RefPtr unspecializedPipeline = nullptr; // Indicates whether this is a specializable pipeline. A specializable // pipeline cannot be used directly and must be specialized first. @@ -983,7 +983,7 @@ class PipelineStateBase : public IPipelineState, public ComObject } virtual SLANG_NO_THROW Result SLANG_MCALL getNativeHandle(InteropHandle* outHandle) override; - virtual Result ensureAPIPipelineStateCreated() { return SLANG_OK; }; + virtual Result ensureAPIPipelineCreated() { return SLANG_OK; }; protected: void initializeBase(const PipelineStateDesc& inDesc); @@ -1018,7 +1018,7 @@ struct ComponentKey struct PipelineKey { - PipelineStateBase* pipeline; + PipelineBase* pipeline; short_vector specializationArgs; size_t hash; void updateHash() @@ -1050,14 +1050,14 @@ class ShaderCache : public RefObject ShaderComponentID getComponentId(std::string_view name); ShaderComponentID getComponentId(ComponentKey key); - RefPtr getSpecializedPipelineState(PipelineKey programKey) + RefPtr getSpecializedPipeline(PipelineKey programKey) { auto it = specializedPipelines.find(programKey); if (it != specializedPipelines.end()) return it->second; return nullptr; } - void addSpecializedPipeline(PipelineKey key, RefPtr specializedPipeline); + void addSpecializedPipeline(PipelineKey key, RefPtr specializedPipeline); void free() { specializedPipelines = decltype(specializedPipelines)(); @@ -1075,7 +1075,7 @@ class ShaderCache : public RefObject }; std::unordered_map componentIds; - std::unordered_map, PipelineKeyHasher> specializedPipelines; + std::unordered_map, PipelineKeyHasher> specializedPipelines; }; class TransientResourceHeapBase : public ITransientResourceHeap, public ComObject @@ -1116,7 +1116,7 @@ class ShaderTableBase : public IShaderTable, public ComObject uint32_t m_hitGroupCount; uint32_t m_callableShaderCount; - std::map> m_deviceBuffers; + std::map> m_deviceBuffers; SLANG_COM_OBJECT_IUNKNOWN_ALL IShaderTable* getInterface(const Guid& guid) @@ -1127,13 +1127,13 @@ class ShaderTableBase : public IShaderTable, public ComObject } virtual RefPtr createDeviceBuffer( - PipelineStateBase* pipeline, + PipelineBase* pipeline, TransientResourceHeapBase* transientHeap, IResourceCommandEncoder* encoder ) = 0; Buffer* getOrCreateBuffer( - PipelineStateBase* pipeline, + PipelineBase* pipeline, TransientResourceHeapBase* transientHeap, IResourceCommandEncoder* encoder ) @@ -1246,7 +1246,7 @@ class RendererBase : public IDevice, public ComObject // Provides a default implementation that returns SLANG_E_NOT_AVAILABLE for platforms // without ray tracing support. virtual SLANG_NO_THROW Result SLANG_MCALL - createRayTracingPipelineState(const RayTracingPipelineStateDesc& desc, IPipelineState** outState) override; + createRayTracingPipeline(const RayTracingPipelineDesc& desc, IPipeline** outPipeline) override; // Provides a default implementation that returns SLANG_E_NOT_AVAILABLE. virtual SLANG_NO_THROW Result SLANG_MCALL @@ -1294,9 +1294,9 @@ class RendererBase : public IDevice, public ComObject // The newly specialized pipeline is held alive by the pipeline cache so users of `outNewPipeline` do not // need to maintain its lifespan. Result maybeSpecializePipeline( - PipelineStateBase* currentPipeline, + PipelineBase* currentPipeline, ShaderObjectBase* rootObject, - RefPtr& outNewPipeline + RefPtr& outNewPipeline ); virtual Result createShaderObjectLayout( diff --git a/src/vulkan/vk-base.h b/src/vulkan/vk-base.h index 5f22fa96..817bed1b 100644 --- a/src/vulkan/vk-base.h +++ b/src/vulkan/vk-base.h @@ -26,8 +26,8 @@ class AccelerationStructureImpl; class FramebufferLayoutImpl; class RenderPassLayoutImpl; class FramebufferImpl; -class PipelineStateImpl; -class RayTracingPipelineStateImpl; +class PipelineImpl; +class RayTracingPipelineImpl; class ShaderObjectLayoutImpl; class EntryPointLayout; class RootShaderObjectLayout; diff --git a/src/vulkan/vk-command-encoder.cpp b/src/vulkan/vk-command-encoder.cpp index c620e30e..e6b78cca 100644 --- a/src/vulkan/vk-command-encoder.cpp +++ b/src/vulkan/vk-command-encoder.cpp @@ -156,9 +156,9 @@ Result PipelineCommandEncoder::bindRootShaderObjectImpl( return SLANG_OK; } -Result PipelineCommandEncoder::setPipelineStateImpl(IPipelineState* state, IShaderObject** outRootObject) +Result PipelineCommandEncoder::setPipelineImpl(IPipeline* state, IShaderObject** outRootObject) { - m_currentPipeline = static_cast(state); + m_currentPipeline = static_cast(state); m_commandBuffer->m_mutableRootShaderObject = nullptr; SLANG_RETURN_ON_FAIL(m_commandBuffer->m_rootObject.init( m_commandBuffer->m_renderer, @@ -168,9 +168,9 @@ Result PipelineCommandEncoder::setPipelineStateImpl(IPipelineState* state, IShad return SLANG_OK; } -Result PipelineCommandEncoder::setPipelineStateWithRootObjectImpl(IPipelineState* state, IShaderObject* rootObject) +Result PipelineCommandEncoder::setPipelineWithRootObjectImpl(IPipeline* state, IShaderObject* rootObject) { - m_currentPipeline = static_cast(state); + m_currentPipeline = static_cast(state); m_commandBuffer->m_mutableRootShaderObject = static_cast(rootObject); return SLANG_OK; } @@ -184,11 +184,11 @@ Result PipelineCommandEncoder::bindRenderState(VkPipelineBindPoint pipelineBindP RootShaderObjectImpl* rootObjectImpl = m_commandBuffer->m_mutableRootShaderObject ? m_commandBuffer->m_mutableRootShaderObject.Ptr() : &m_commandBuffer->m_rootObject; - RefPtr newPipeline; + RefPtr newPipeline; SLANG_RETURN_ON_FAIL(m_device->maybeSpecializePipeline(m_currentPipeline, rootObjectImpl, newPipeline)); - PipelineStateImpl* newPipelineImpl = static_cast(newPipeline.Ptr()); + PipelineImpl* newPipelineImpl = static_cast(newPipeline.Ptr()); - SLANG_RETURN_ON_FAIL(newPipelineImpl->ensureAPIPipelineStateCreated()); + SLANG_RETURN_ON_FAIL(newPipelineImpl->ensureAPIPipelineCreated()); m_currentPipeline = newPipelineImpl; bindRootShaderObjectImpl(rootObjectImpl, pipelineBindPoint); @@ -980,14 +980,14 @@ void RenderCommandEncoder::endEncoding() endEncodingImpl(); } -Result RenderCommandEncoder::bindPipeline(IPipelineState* pipelineState, IShaderObject** outRootObject) +Result RenderCommandEncoder::bindPipeline(IPipeline* pipeline, IShaderObject** outRootObject) { - return setPipelineStateImpl(pipelineState, outRootObject); + return setPipelineImpl(pipeline, outRootObject); } -Result RenderCommandEncoder::bindPipelineWithRootObject(IPipelineState* pipelineState, IShaderObject* rootObject) +Result RenderCommandEncoder::bindPipelineWithRootObject(IPipeline* pipeline, IShaderObject* rootObject) { - return setPipelineStateWithRootObjectImpl(pipelineState, rootObject); + return setPipelineWithRootObjectImpl(pipeline, rootObject); } void RenderCommandEncoder::setViewports(GfxCount count, const Viewport* viewports) @@ -1100,7 +1100,7 @@ void RenderCommandEncoder::setIndexBuffer(IBuffer* buffer, Format indexFormat, O Result RenderCommandEncoder::prepareDraw() { - auto pipeline = static_cast(m_currentPipeline.Ptr()); + auto pipeline = static_cast(m_currentPipeline.Ptr()); if (!pipeline) { return SLANG_FAIL; @@ -1247,19 +1247,19 @@ void ComputeCommandEncoder::endEncoding() endEncodingImpl(); } -Result ComputeCommandEncoder::bindPipeline(IPipelineState* pipelineState, IShaderObject** outRootObject) +Result ComputeCommandEncoder::bindPipeline(IPipeline* pipeline, IShaderObject** outRootObject) { - return setPipelineStateImpl(pipelineState, outRootObject); + return setPipelineImpl(pipeline, outRootObject); } -Result ComputeCommandEncoder::bindPipelineWithRootObject(IPipelineState* pipelineState, IShaderObject* rootObject) +Result ComputeCommandEncoder::bindPipelineWithRootObject(IPipeline* pipeline, IShaderObject* rootObject) { - return setPipelineStateWithRootObjectImpl(pipelineState, rootObject); + return setPipelineWithRootObjectImpl(pipeline, rootObject); } Result ComputeCommandEncoder::dispatchCompute(int x, int y, int z) { - auto pipeline = static_cast(m_currentPipeline.Ptr()); + auto pipeline = static_cast(m_currentPipeline.Ptr()); if (!pipeline) { return SLANG_FAIL; @@ -1482,14 +1482,14 @@ void RayTracingCommandEncoder::deserializeAccelerationStructure(IAccelerationStr ); } -Result RayTracingCommandEncoder::bindPipeline(IPipelineState* pipeline, IShaderObject** outRootObject) +Result RayTracingCommandEncoder::bindPipeline(IPipeline* pipeline, IShaderObject** outRootObject) { - return setPipelineStateImpl(pipeline, outRootObject); + return setPipelineImpl(pipeline, outRootObject); } -Result RayTracingCommandEncoder::bindPipelineWithRootObject(IPipelineState* pipelineState, IShaderObject* rootObject) +Result RayTracingCommandEncoder::bindPipelineWithRootObject(IPipeline* pipeline, IShaderObject* rootObject) { - return setPipelineStateWithRootObjectImpl(pipelineState, rootObject); + return setPipelineWithRootObjectImpl(pipeline, rootObject); } Result RayTracingCommandEncoder::dispatchRays( diff --git a/src/vulkan/vk-command-encoder.h b/src/vulkan/vk-command-encoder.h index 3be4b28b..8f729681 100644 --- a/src/vulkan/vk-command-encoder.h +++ b/src/vulkan/vk-command-encoder.h @@ -15,7 +15,7 @@ class PipelineCommandEncoder : public ComObject VkCommandBuffer m_vkPreCommandBuffer = VK_NULL_HANDLE; VkPipeline m_boundPipelines[3] = {}; DeviceImpl* m_device = nullptr; - RefPtr m_currentPipeline; + RefPtr m_currentPipeline; VulkanApi* m_api; @@ -38,9 +38,9 @@ class PipelineCommandEncoder : public ComObject Result bindRootShaderObjectImpl(RootShaderObjectImpl* rootShaderObject, VkPipelineBindPoint bindPoint); - Result setPipelineStateImpl(IPipelineState* state, IShaderObject** outRootObject); + Result setPipelineImpl(IPipeline* state, IShaderObject** outRootObject); - Result setPipelineStateWithRootObjectImpl(IPipelineState* state, IShaderObject* rootObject); + Result setPipelineWithRootObjectImpl(IPipeline* state, IShaderObject* rootObject); Result bindRenderState(VkPipelineBindPoint pipelineBindPoint); }; @@ -165,11 +165,10 @@ class RenderCommandEncoder : public IRenderCommandEncoder, public ResourceComman virtual SLANG_NO_THROW void SLANG_MCALL endEncoding() override; - virtual SLANG_NO_THROW Result SLANG_MCALL - bindPipeline(IPipelineState* pipelineState, IShaderObject** outRootObject) override; + virtual SLANG_NO_THROW Result SLANG_MCALL bindPipeline(IPipeline* pipeline, IShaderObject** outRootObject) override; virtual SLANG_NO_THROW Result SLANG_MCALL - bindPipelineWithRootObject(IPipelineState* pipelineState, IShaderObject* rootObject) override; + bindPipelineWithRootObject(IPipeline* pipeline, IShaderObject* rootObject) override; virtual SLANG_NO_THROW void SLANG_MCALL setViewports(GfxCount count, const Viewport* viewports) override; @@ -237,11 +236,10 @@ class ComputeCommandEncoder : public IComputeCommandEncoder, public ResourceComm virtual SLANG_NO_THROW void SLANG_MCALL endEncoding() override; - virtual SLANG_NO_THROW Result SLANG_MCALL - bindPipeline(IPipelineState* pipelineState, IShaderObject** outRootObject) override; + virtual SLANG_NO_THROW Result SLANG_MCALL bindPipeline(IPipeline* pipeline, IShaderObject** outRootObject) override; virtual SLANG_NO_THROW Result SLANG_MCALL - bindPipelineWithRootObject(IPipelineState* pipelineState, IShaderObject* rootObject) override; + bindPipelineWithRootObject(IPipeline* pipeline, IShaderObject* rootObject) override; virtual SLANG_NO_THROW Result SLANG_MCALL dispatchCompute(int x, int y, int z) override; @@ -302,11 +300,10 @@ class RayTracingCommandEncoder : public IRayTracingCommandEncoder, public Resour virtual SLANG_NO_THROW void SLANG_MCALL deserializeAccelerationStructure(IAccelerationStructure* dest, DeviceAddress source) override; - virtual SLANG_NO_THROW Result SLANG_MCALL - bindPipeline(IPipelineState* pipeline, IShaderObject** outRootObject) override; + virtual SLANG_NO_THROW Result SLANG_MCALL bindPipeline(IPipeline* pipeline, IShaderObject** outRootObject) override; virtual SLANG_NO_THROW Result SLANG_MCALL - bindPipelineWithRootObject(IPipelineState* pipelineState, IShaderObject* rootObject) override; + bindPipelineWithRootObject(IPipeline* pipeline, IShaderObject* rootObject) override; virtual SLANG_NO_THROW Result SLANG_MCALL dispatchRays(GfxIndex raygenShaderIndex, IShaderTable* shaderTable, GfxCount width, GfxCount height, GfxCount depth) diff --git a/src/vulkan/vk-device.cpp b/src/vulkan/vk-device.cpp index 3d392305..b677c0f8 100644 --- a/src/vulkan/vk-device.cpp +++ b/src/vulkan/vk-device.cpp @@ -2433,36 +2433,36 @@ Result DeviceImpl::createShaderTable(const IShaderTable::Desc& desc, IShaderTabl return SLANG_OK; } -Result DeviceImpl::createGraphicsPipelineState(const GraphicsPipelineStateDesc& inDesc, IPipelineState** outState) +Result DeviceImpl::createRenderPipeline(const RenderPipelineDesc& inDesc, IPipeline** outPipeline) { - GraphicsPipelineStateDesc desc = inDesc; - RefPtr pipelineStateImpl = new PipelineStateImpl(this); - pipelineStateImpl->init(desc); - pipelineStateImpl->establishStrongDeviceReference(); - m_deviceObjectsWithPotentialBackReferences.push_back(pipelineStateImpl); - returnComPtr(outState, pipelineStateImpl); + RenderPipelineDesc desc = inDesc; + RefPtr pipelineImpl = new PipelineImpl(this); + pipelineImpl->init(desc); + pipelineImpl->establishStrongDeviceReference(); + m_deviceObjectsWithPotentialBackReferences.push_back(pipelineImpl); + returnComPtr(outPipeline, pipelineImpl); return SLANG_OK; } -Result DeviceImpl::createComputePipelineState(const ComputePipelineStateDesc& inDesc, IPipelineState** outState) +Result DeviceImpl::createComputePipeline(const ComputePipelineDesc& inDesc, IPipeline** outPipeline) { - ComputePipelineStateDesc desc = inDesc; - RefPtr pipelineStateImpl = new PipelineStateImpl(this); - pipelineStateImpl->init(desc); - m_deviceObjectsWithPotentialBackReferences.push_back(pipelineStateImpl); - pipelineStateImpl->establishStrongDeviceReference(); - returnComPtr(outState, pipelineStateImpl); + ComputePipelineDesc desc = inDesc; + RefPtr pipelineImpl = new PipelineImpl(this); + pipelineImpl->init(desc); + m_deviceObjectsWithPotentialBackReferences.push_back(pipelineImpl); + pipelineImpl->establishStrongDeviceReference(); + returnComPtr(outPipeline, pipelineImpl); return SLANG_OK; } -Result DeviceImpl::createRayTracingPipelineState(const RayTracingPipelineStateDesc& desc, IPipelineState** outState) +Result DeviceImpl::createRayTracingPipeline(const RayTracingPipelineDesc& desc, IPipeline** outPipeline) { - RefPtr pipelineStateImpl = new RayTracingPipelineStateImpl(this); - pipelineStateImpl->init(desc); - m_deviceObjectsWithPotentialBackReferences.push_back(pipelineStateImpl); - pipelineStateImpl->establishStrongDeviceReference(); - returnComPtr(outState, pipelineStateImpl); + RefPtr pipelineImpl = new RayTracingPipelineImpl(this); + pipelineImpl->init(desc); + m_deviceObjectsWithPotentialBackReferences.push_back(pipelineImpl); + pipelineImpl->establishStrongDeviceReference(); + returnComPtr(outPipeline, pipelineImpl); return SLANG_OK; } diff --git a/src/vulkan/vk-device.h b/src/vulkan/vk-device.h index 81f9c4ae..34f709e8 100644 --- a/src/vulkan/vk-device.h +++ b/src/vulkan/vk-device.h @@ -70,11 +70,11 @@ class DeviceImpl : public RendererBase ISlangBlob** outDiagnosticBlob ) override; virtual SLANG_NO_THROW Result SLANG_MCALL - createGraphicsPipelineState(const GraphicsPipelineStateDesc& desc, IPipelineState** outState) override; + createRenderPipeline(const RenderPipelineDesc& desc, IPipeline** outPipeline) override; virtual SLANG_NO_THROW Result SLANG_MCALL - createComputePipelineState(const ComputePipelineStateDesc& desc, IPipelineState** outState) override; + createComputePipeline(const ComputePipelineDesc& desc, IPipeline** outPipeline) override; virtual SLANG_NO_THROW Result SLANG_MCALL - createRayTracingPipelineState(const RayTracingPipelineStateDesc& desc, IPipelineState** outState) override; + createRayTracingPipeline(const RayTracingPipelineDesc& desc, IPipeline** outPipeline) override; virtual SLANG_NO_THROW Result SLANG_MCALL createQueryPool(const IQueryPool::Desc& desc, IQueryPool** outPool) override; @@ -178,8 +178,8 @@ class DeviceImpl : public RendererBase // A list to hold objects that may have a strong back reference to the device // instance. Because of the pipeline cache in `RendererBase`, there could be a reference - // cycle among `DeviceImpl`->`PipelineStateImpl`->`ShaderProgramImpl`->`DeviceImpl`. - // Depending on whether a `PipelineState` objects gets stored in pipeline cache, there + // cycle among `DeviceImpl`->`PipelineImpl`->`ShaderProgramImpl`->`DeviceImpl`. + // Depending on whether a `Pipeline` objects gets stored in pipeline cache, there // may or may not be such a reference cycle. // We need to hold strong references to any objects that may become part of the reference // cycle here, so that when objects like `ShaderProgramImpl` lost all public refernces, we diff --git a/src/vulkan/vk-pipeline-state.cpp b/src/vulkan/vk-pipeline-state.cpp index c4921a54..6423d0bb 100644 --- a/src/vulkan/vk-pipeline-state.cpp +++ b/src/vulkan/vk-pipeline-state.cpp @@ -13,18 +13,18 @@ namespace rhi::vk { -PipelineStateImpl::PipelineStateImpl(DeviceImpl* device) +PipelineImpl::PipelineImpl(DeviceImpl* device) { // Only weakly reference `device` at start. // We make it a strong reference only when the pipeline state is exposed to the user. - // Note that `PipelineState`s may also be created via implicit specialization that + // Note that `Pipeline`s may also be created via implicit specialization that // happens behind the scenes, and the user will not have access to those specialized // pipeline states. Only those pipeline states that are returned to the user needs to // hold a strong reference to `device`. m_device.setWeakReference(device); } -PipelineStateImpl::~PipelineStateImpl() +PipelineImpl::~PipelineImpl() { if (m_pipeline != VK_NULL_HANDLE) { @@ -32,17 +32,17 @@ PipelineStateImpl::~PipelineStateImpl() } } -void PipelineStateImpl::establishStrongDeviceReference() +void PipelineImpl::establishStrongDeviceReference() { m_device.establishStrongReference(); } -void PipelineStateImpl::comFree() +void PipelineImpl::comFree() { m_device.breakStrongReference(); } -void PipelineStateImpl::init(const GraphicsPipelineStateDesc& inDesc) +void PipelineImpl::init(const RenderPipelineDesc& inDesc) { PipelineStateDesc pipelineDesc; pipelineDesc.type = PipelineType::Graphics; @@ -50,7 +50,7 @@ void PipelineStateImpl::init(const GraphicsPipelineStateDesc& inDesc) initializeBase(pipelineDesc); } -void PipelineStateImpl::init(const ComputePipelineStateDesc& inDesc) +void PipelineImpl::init(const ComputePipelineDesc& inDesc) { PipelineStateDesc pipelineDesc; pipelineDesc.type = PipelineType::Compute; @@ -58,7 +58,7 @@ void PipelineStateImpl::init(const ComputePipelineStateDesc& inDesc) initializeBase(pipelineDesc); } -void PipelineStateImpl::init(const RayTracingPipelineStateDesc& inDesc) +void PipelineImpl::init(const RayTracingPipelineDesc& inDesc) { PipelineStateDesc pipelineDesc; pipelineDesc.type = PipelineType::RayTracing; @@ -66,7 +66,7 @@ void PipelineStateImpl::init(const RayTracingPipelineStateDesc& inDesc) initializeBase(pipelineDesc); } -Result PipelineStateImpl::createVKGraphicsPipelineState() +Result PipelineImpl::createVKGraphicsPipeline() { VkPipelineCache pipelineCache = VK_NULL_HANDLE; @@ -263,12 +263,10 @@ Result PipelineStateImpl::createVKGraphicsPipelineState() if (m_device->m_pipelineCreationAPIDispatcher) { - SLANG_RETURN_ON_FAIL(m_device->m_pipelineCreationAPIDispatcher->createGraphicsPipelineState( - m_device, - programImpl->linkedProgram.get(), - &pipelineInfo, - (void**)&m_pipeline - )); + SLANG_RETURN_ON_FAIL( + m_device->m_pipelineCreationAPIDispatcher + ->createRenderPipeline(m_device, programImpl->linkedProgram.get(), &pipelineInfo, (void**)&m_pipeline) + ); } else { @@ -281,7 +279,7 @@ Result PipelineStateImpl::createVKGraphicsPipelineState() return SLANG_OK; } -Result PipelineStateImpl::createVKComputePipelineState() +Result PipelineImpl::createVKComputePipeline() { auto programImpl = static_cast(m_program.Ptr()); if (programImpl->m_stageCreateInfos.empty()) @@ -295,7 +293,7 @@ Result PipelineStateImpl::createVKComputePipelineState() if (m_device->m_pipelineCreationAPIDispatcher) { - SLANG_RETURN_ON_FAIL(m_device->m_pipelineCreationAPIDispatcher->createComputePipelineState( + SLANG_RETURN_ON_FAIL(m_device->m_pipelineCreationAPIDispatcher->createComputePipeline( m_device, programImpl->linkedProgram.get(), &computePipelineInfo, @@ -317,7 +315,7 @@ Result PipelineStateImpl::createVKComputePipelineState() return SLANG_OK; } -Result PipelineStateImpl::ensureAPIPipelineStateCreated() +Result PipelineImpl::ensureAPIPipelineCreated() { if (m_pipeline) return SLANG_OK; @@ -325,28 +323,28 @@ Result PipelineStateImpl::ensureAPIPipelineStateCreated() switch (desc.type) { case PipelineType::Compute: - return createVKComputePipelineState(); + return createVKComputePipeline(); case PipelineType::Graphics: - return createVKGraphicsPipelineState(); + return createVKGraphicsPipeline(); default: SLANG_RHI_UNREACHABLE("Unknown pipeline type."); return SLANG_FAIL; } } -SLANG_NO_THROW Result SLANG_MCALL PipelineStateImpl::getNativeHandle(InteropHandle* outHandle) +SLANG_NO_THROW Result SLANG_MCALL PipelineImpl::getNativeHandle(InteropHandle* outHandle) { - SLANG_RETURN_ON_FAIL(ensureAPIPipelineStateCreated()); + SLANG_RETURN_ON_FAIL(ensureAPIPipelineCreated()); outHandle->api = InteropHandleAPI::Vulkan; outHandle->handleValue = 0; memcpy(&outHandle->handleValue, &m_pipeline, sizeof(m_pipeline)); return SLANG_OK; } -RayTracingPipelineStateImpl::RayTracingPipelineStateImpl(DeviceImpl* device) - : PipelineStateImpl(device) +RayTracingPipelineImpl::RayTracingPipelineImpl(DeviceImpl* device) + : PipelineImpl(device) { } -uint32_t RayTracingPipelineStateImpl::findEntryPointIndexByName( +uint32_t RayTracingPipelineImpl::findEntryPointIndexByName( const std::map& entryPointNameToIndex, const char* name ) @@ -360,7 +358,7 @@ uint32_t RayTracingPipelineStateImpl::findEntryPointIndexByName( // TODO: Error reporting? return VK_SHADER_UNUSED_KHR; } -Result RayTracingPipelineStateImpl::createVKRayTracingPipelineState() +Result RayTracingPipelineImpl::createVKRayTracingPipeline() { auto programImpl = static_cast(m_program.Ptr()); if (programImpl->m_stageCreateInfos.empty()) @@ -475,7 +473,7 @@ Result RayTracingPipelineStateImpl::createVKRayTracingPipelineState() } return SLANG_OK; } -Result RayTracingPipelineStateImpl::ensureAPIPipelineStateCreated() +Result RayTracingPipelineImpl::ensureAPIPipelineCreated() { if (m_pipeline) return SLANG_OK; @@ -483,15 +481,15 @@ Result RayTracingPipelineStateImpl::ensureAPIPipelineStateCreated() switch (desc.type) { case PipelineType::RayTracing: - return createVKRayTracingPipelineState(); + return createVKRayTracingPipeline(); default: SLANG_RHI_UNREACHABLE("Unknown pipeline type."); return SLANG_FAIL; } } -Result RayTracingPipelineStateImpl::getNativeHandle(InteropHandle* outHandle) +Result RayTracingPipelineImpl::getNativeHandle(InteropHandle* outHandle) { - SLANG_RETURN_ON_FAIL(ensureAPIPipelineStateCreated()); + SLANG_RETURN_ON_FAIL(ensureAPIPipelineCreated()); outHandle->api = InteropHandleAPI::Vulkan; outHandle->handleValue = 0; memcpy(&outHandle->handleValue, &m_pipeline, sizeof(m_pipeline)); diff --git a/src/vulkan/vk-pipeline-state.h b/src/vulkan/vk-pipeline-state.h index 78aa0d0c..1bf5d35e 100644 --- a/src/vulkan/vk-pipeline-state.h +++ b/src/vulkan/vk-pipeline-state.h @@ -7,28 +7,28 @@ namespace rhi::vk { -class PipelineStateImpl : public PipelineStateBase +class PipelineImpl : public PipelineBase { public: - PipelineStateImpl(DeviceImpl* device); - ~PipelineStateImpl(); + PipelineImpl(DeviceImpl* device); + ~PipelineImpl(); // Turns `m_device` into a strong reference. // This method should be called before returning the pipeline state object to - // external users (i.e. via an `IPipelineState` pointer). + // external users (i.e. via an `IPipeline` pointer). void establishStrongDeviceReference(); virtual void comFree() override; - void init(const GraphicsPipelineStateDesc& inDesc); - void init(const ComputePipelineStateDesc& inDesc); - void init(const RayTracingPipelineStateDesc& inDesc); + void init(const RenderPipelineDesc& inDesc); + void init(const ComputePipelineDesc& inDesc); + void init(const RayTracingPipelineDesc& inDesc); - Result createVKGraphicsPipelineState(); + Result createVKGraphicsPipeline(); - Result createVKComputePipelineState(); + Result createVKComputePipeline(); - virtual Result ensureAPIPipelineStateCreated() override; + virtual Result ensureAPIPipelineCreated() override; virtual SLANG_NO_THROW Result SLANG_MCALL getNativeHandle(InteropHandle* outHandle) override; @@ -37,19 +37,19 @@ class PipelineStateImpl : public PipelineStateBase VkPipeline m_pipeline = VK_NULL_HANDLE; }; -class RayTracingPipelineStateImpl : public PipelineStateImpl +class RayTracingPipelineImpl : public PipelineImpl { public: std::map shaderGroupNameToIndex; Int shaderGroupCount; - RayTracingPipelineStateImpl(DeviceImpl* device); + RayTracingPipelineImpl(DeviceImpl* device); uint32_t findEntryPointIndexByName(const std::map& entryPointNameToIndex, const char* name); - Result createVKRayTracingPipelineState(); + Result createVKRayTracingPipeline(); - virtual Result ensureAPIPipelineStateCreated() override; + virtual Result ensureAPIPipelineCreated() override; virtual SLANG_NO_THROW Result SLANG_MCALL getNativeHandle(InteropHandle* outHandle) override; }; diff --git a/src/vulkan/vk-shader-table.cpp b/src/vulkan/vk-shader-table.cpp index fd393522..df91be3b 100644 --- a/src/vulkan/vk-shader-table.cpp +++ b/src/vulkan/vk-shader-table.cpp @@ -8,7 +8,7 @@ namespace rhi::vk { RefPtr ShaderTableImpl::createDeviceBuffer( - PipelineStateBase* pipeline, + PipelineBase* pipeline, TransientResourceHeapBase* transientHeap, IResourceCommandEncoder* encoder ) @@ -24,7 +24,7 @@ RefPtr ShaderTableImpl::createDeviceBuffer( (uint32_t)VulkanUtil::calcAligned(m_callableShaderCount * handleSize, rtProps.shaderGroupBaseAlignment); uint32_t tableSize = m_raygenTableSize + m_missTableSize + m_hitTableSize + m_callableTableSize; - auto pipelineImpl = static_cast(pipeline); + auto pipelineImpl = static_cast(pipeline); ComPtr buffer; BufferDesc bufferDesc = {}; bufferDesc.memoryType = MemoryType::DeviceLocal; diff --git a/src/vulkan/vk-shader-table.h b/src/vulkan/vk-shader-table.h index 99a85ae3..4267d390 100644 --- a/src/vulkan/vk-shader-table.h +++ b/src/vulkan/vk-shader-table.h @@ -15,7 +15,7 @@ class ShaderTableImpl : public ShaderTableBase DeviceImpl* m_device; virtual RefPtr createDeviceBuffer( - PipelineStateBase* pipeline, + PipelineBase* pipeline, TransientResourceHeapBase* transientHeap, IResourceCommandEncoder* encoder ) override; diff --git a/tests/test-buffer-barrier.cpp b/tests/test-buffer-barrier.cpp index f14e57ef..f2607ba9 100644 --- a/tests/test-buffer-barrier.cpp +++ b/tests/test-buffer-barrier.cpp @@ -7,8 +7,8 @@ struct Shader { ComPtr program; slang::ProgramLayout* reflection = nullptr; - ComputePipelineStateDesc pipelineDesc = {}; - ComPtr pipelineState; + ComputePipelineDesc pipelineDesc = {}; + ComPtr pipeline; }; struct Buffer @@ -61,8 +61,8 @@ void testBufferBarrier(GpuTestContext* ctx, DeviceType deviceType) REQUIRE_CALL(loadComputeProgram(device, programB.program, "test-buffer-barrier", "computeB", programB.reflection)); programA.pipelineDesc.program = programA.program.get(); programB.pipelineDesc.program = programB.program.get(); - REQUIRE_CALL(device->createComputePipelineState(programA.pipelineDesc, programA.pipelineState.writeRef())); - REQUIRE_CALL(device->createComputePipelineState(programB.pipelineDesc, programB.pipelineState.writeRef())); + REQUIRE_CALL(device->createComputePipeline(programA.pipelineDesc, programA.pipeline.writeRef())); + REQUIRE_CALL(device->createComputePipeline(programB.pipelineDesc, programB.pipeline.writeRef())); float initialData[] = {1.0f, 2.0f, 3.0f, 4.0f}; Buffer inputBuffer; @@ -85,7 +85,7 @@ void testBufferBarrier(GpuTestContext* ctx, DeviceType deviceType) auto resourceEncoder = commandBuffer->encodeResourceCommands(); // Write inputBuffer data to intermediateBuffer - auto rootObjectA = encoder->bindPipeline(programA.pipelineState); + auto rootObjectA = encoder->bindPipeline(programA.pipeline); ShaderCursor entryPointCursorA(rootObjectA->getEntryPoint(0)); entryPointCursorA.getPath("inBuffer").setResource(inputBuffer.view); entryPointCursorA.getPath("outBuffer").setResource(intermediateBuffer.view); @@ -98,7 +98,7 @@ void testBufferBarrier(GpuTestContext* ctx, DeviceType deviceType) resourceEncoder->endEncoding(); // Write intermediateBuffer to outputBuffer - auto rootObjectB = encoder->bindPipeline(programB.pipelineState); + auto rootObjectB = encoder->bindPipeline(programB.pipeline); ShaderCursor entryPointCursorB(rootObjectB->getEntryPoint(0)); entryPointCursorB.getPath("inBuffer").setResource(intermediateBuffer.view); entryPointCursorB.getPath("outBuffer").setResource(outputBuffer.view); diff --git a/tests/test-compute-smoke.cpp b/tests/test-compute-smoke.cpp index 6d9d14c2..4b01a2c8 100644 --- a/tests/test-compute-smoke.cpp +++ b/tests/test-compute-smoke.cpp @@ -16,10 +16,10 @@ void testComputeSmoke(GpuTestContext* ctx, DeviceType deviceType) slang::ProgramLayout* slangReflection; REQUIRE_CALL(loadComputeProgram(device, shaderProgram, "test-compute-smoke", "computeMain", slangReflection)); - ComputePipelineStateDesc pipelineDesc = {}; + ComputePipelineDesc pipelineDesc = {}; pipelineDesc.program = shaderProgram.get(); - ComPtr pipelineState; - REQUIRE_CALL(device->createComputePipelineState(pipelineDesc, pipelineState.writeRef())); + ComPtr pipeline; + REQUIRE_CALL(device->createComputePipeline(pipelineDesc, pipeline.writeRef())); const int numberCount = 4; float initialData[] = {0.0f, 1.0f, 2.0f, 3.0f}; @@ -54,7 +54,7 @@ void testComputeSmoke(GpuTestContext* ctx, DeviceType deviceType) auto commandBuffer = transientHeap->createCommandBuffer(); auto encoder = commandBuffer->encodeComputeCommands(); - auto rootObject = encoder->bindPipeline(pipelineState); + auto rootObject = encoder->bindPipeline(pipeline); slang::TypeReflection* addTransformerType = slangReflection->findTypeByName("AddTransformer"); diff --git a/tests/test-compute-trivial.cpp b/tests/test-compute-trivial.cpp index c8e092ea..dec8b3b3 100644 --- a/tests/test-compute-trivial.cpp +++ b/tests/test-compute-trivial.cpp @@ -16,10 +16,10 @@ void testComputeTrivial(GpuTestContext* ctx, DeviceType deviceType) slang::ProgramLayout* slangReflection; REQUIRE_CALL(loadComputeProgram(device, shaderProgram, "test-compute-trivial", "computeMain", slangReflection)); - ComputePipelineStateDesc pipelineDesc = {}; + ComputePipelineDesc pipelineDesc = {}; pipelineDesc.program = shaderProgram.get(); - ComPtr pipelineState; - REQUIRE_CALL(device->createComputePipelineState(pipelineDesc, pipelineState.writeRef())); + ComPtr pipeline; + REQUIRE_CALL(device->createComputePipeline(pipelineDesc, pipeline.writeRef())); const int numberCount = 4; float initialData[] = {0.0f, 1.0f, 2.0f, 3.0f}; @@ -54,7 +54,7 @@ void testComputeTrivial(GpuTestContext* ctx, DeviceType deviceType) auto commandBuffer = transientHeap->createCommandBuffer(); auto encoder = commandBuffer->encodeComputeCommands(); - auto rootObject = encoder->bindPipeline(pipelineState); + auto rootObject = encoder->bindPipeline(pipeline); // Bind buffer view to the entry point. ShaderCursor(rootObject).getPath("buffer").setResource(bufferView); diff --git a/tests/test-create-buffer-from-handle.cpp b/tests/test-create-buffer-from-handle.cpp index f23afd4c..4291cae9 100644 --- a/tests/test-create-buffer-from-handle.cpp +++ b/tests/test-create-buffer-from-handle.cpp @@ -16,10 +16,10 @@ void testCreateBufferFromHandle(GpuTestContext* ctx, DeviceType deviceType) slang::ProgramLayout* slangReflection; REQUIRE_CALL(loadComputeProgram(device, shaderProgram, "test-compute-trivial", "computeMain", slangReflection)); - ComputePipelineStateDesc pipelineDesc = {}; + ComputePipelineDesc pipelineDesc = {}; pipelineDesc.program = shaderProgram.get(); - ComPtr pipelineState; - REQUIRE_CALL(device->createComputePipelineState(pipelineDesc, pipelineState.writeRef())); + ComPtr pipeline; + REQUIRE_CALL(device->createComputePipeline(pipelineDesc, pipeline.writeRef())); const int numberCount = 4; float initialData[] = {0.0f, 1.0f, 2.0f, 3.0f}; @@ -60,7 +60,7 @@ void testCreateBufferFromHandle(GpuTestContext* ctx, DeviceType deviceType) auto commandBuffer = transientHeap->createCommandBuffer(); auto encoder = commandBuffer->encodeComputeCommands(); - auto rootObject = encoder->bindPipeline(pipelineState); + auto rootObject = encoder->bindPipeline(pipeline); ShaderCursor rootCursor(rootObject); // Bind buffer view to the entry point. diff --git a/tests/test-existing-device-handle.cpp b/tests/test-existing-device-handle.cpp index 00a00f71..e439dd76 100644 --- a/tests/test-existing-device-handle.cpp +++ b/tests/test-existing-device-handle.cpp @@ -33,10 +33,10 @@ void testExistingDeviceHandle(GpuTestContext* ctx, DeviceType deviceType) slang::ProgramLayout* slangReflection; REQUIRE_CALL(loadComputeProgram(device, shaderProgram, "test-compute-trivial", "computeMain", slangReflection)); - ComputePipelineStateDesc pipelineDesc = {}; + ComputePipelineDesc pipelineDesc = {}; pipelineDesc.program = shaderProgram.get(); - ComPtr pipelineState; - REQUIRE_CALL(device->createComputePipelineState(pipelineDesc, pipelineState.writeRef())); + ComPtr pipeline; + REQUIRE_CALL(device->createComputePipeline(pipelineDesc, pipeline.writeRef())); const int numberCount = 4; float initialData[] = {0.0f, 1.0f, 2.0f, 3.0f}; @@ -71,7 +71,7 @@ void testExistingDeviceHandle(GpuTestContext* ctx, DeviceType deviceType) auto commandBuffer = transientHeap->createCommandBuffer(); auto encoder = commandBuffer->encodeComputeCommands(); - auto rootObject = encoder->bindPipeline(pipelineState); + auto rootObject = encoder->bindPipeline(pipeline); ShaderCursor rootCursor(rootObject); // Bind buffer view to the root. diff --git a/tests/test-formats.cpp b/tests/test-formats.cpp index 4210f749..757e1bb1 100644 --- a/tests/test-formats.cpp +++ b/tests/test-formats.cpp @@ -53,10 +53,10 @@ void setUpAndRunTest( slang::ProgramLayout* slangReflection; REQUIRE_CALL(loadComputeProgram(device, shaderProgram, "test-formats", entryPoint, slangReflection)); - ComputePipelineStateDesc pipelineDesc = {}; + ComputePipelineDesc pipelineDesc = {}; pipelineDesc.program = shaderProgram.get(); - ComPtr pipelineState; - REQUIRE_CALL(device->createComputePipelineState(pipelineDesc, pipelineState.writeRef())); + ComPtr pipeline; + REQUIRE_CALL(device->createComputePipeline(pipelineDesc, pipeline.writeRef())); // We have done all the set up work, now it is time to start recording a command buffer for // GPU execution. @@ -67,7 +67,7 @@ void setUpAndRunTest( auto commandBuffer = transientHeap->createCommandBuffer(); auto encoder = commandBuffer->encodeComputeCommands(); - auto rootObject = encoder->bindPipeline(pipelineState); + auto rootObject = encoder->bindPipeline(pipeline); ShaderCursor entryPointCursor(rootObject->getEntryPoint(0)); // get a cursor the the first entry-point. diff --git a/tests/test-instanced-draw.cpp b/tests/test-instanced-draw.cpp index e5b54d28..167e318c 100644 --- a/tests/test-instanced-draw.cpp +++ b/tests/test-instanced-draw.cpp @@ -102,7 +102,7 @@ class BaseDrawTest ComPtr device; ComPtr transientHeap; - ComPtr pipelineState; + ComPtr pipeline; ComPtr renderPass; ComPtr framebuffer; @@ -164,13 +164,13 @@ class BaseDrawTest ComPtr framebufferLayout = device->createFramebufferLayout(framebufferLayoutDesc); REQUIRE(framebufferLayout != nullptr); - GraphicsPipelineStateDesc pipelineDesc = {}; + RenderPipelineDesc pipelineDesc = {}; pipelineDesc.program = shaderProgram.get(); pipelineDesc.inputLayout = inputLayout; pipelineDesc.framebufferLayout = framebufferLayout; pipelineDesc.depthStencil.depthTestEnable = false; pipelineDesc.depthStencil.depthWriteEnable = false; - REQUIRE_CALL(device->createGraphicsPipelineState(pipelineDesc, pipelineState.writeRef())); + REQUIRE_CALL(device->createRenderPipeline(pipelineDesc, pipeline.writeRef())); IRenderPassLayout::Desc renderPassDesc = {}; renderPassDesc.framebufferLayout = framebufferLayout; @@ -247,7 +247,7 @@ struct DrawInstancedTest : BaseDrawTest auto commandBuffer = transientHeap->createCommandBuffer(); auto encoder = commandBuffer->encodeRenderCommands(renderPass, framebuffer); - auto rootObject = encoder->bindPipeline(pipelineState); + auto rootObject = encoder->bindPipeline(pipeline); Viewport viewport = {}; viewport.maxZ = 1.0f; @@ -296,7 +296,7 @@ struct DrawIndexedInstancedTest : BaseDrawTest auto commandBuffer = transientHeap->createCommandBuffer(); auto encoder = commandBuffer->encodeRenderCommands(renderPass, framebuffer); - auto rootObject = encoder->bindPipeline(pipelineState); + auto rootObject = encoder->bindPipeline(pipeline); Viewport viewport = {}; viewport.maxZ = 1.0f; @@ -371,7 +371,7 @@ struct DrawIndirectTest : BaseDrawTest auto commandBuffer = transientHeap->createCommandBuffer(); auto encoder = commandBuffer->encodeRenderCommands(renderPass, framebuffer); - auto rootObject = encoder->bindPipeline(pipelineState); + auto rootObject = encoder->bindPipeline(pipeline); Viewport viewport = {}; viewport.maxZ = 1.0f; @@ -445,7 +445,7 @@ struct DrawIndexedIndirectTest : BaseDrawTest auto commandBuffer = transientHeap->createCommandBuffer(); auto encoder = commandBuffer->encodeRenderCommands(renderPass, framebuffer); - auto rootObject = encoder->bindPipeline(pipelineState); + auto rootObject = encoder->bindPipeline(pipeline); Viewport viewport = {}; viewport.maxZ = 1.0f; diff --git a/tests/test-link-time-constant.cpp b/tests/test-link-time-constant.cpp index 42cd20f7..083e0f5b 100644 --- a/tests/test-link-time-constant.cpp +++ b/tests/test-link-time-constant.cpp @@ -90,10 +90,10 @@ void testLinkTimeConstant(GpuTestContext* ctx, DeviceType deviceType) CHECK_EQ(threadGroupSizes[1], 1); CHECK_EQ(threadGroupSizes[2], 1); - ComputePipelineStateDesc pipelineDesc = {}; + ComputePipelineDesc pipelineDesc = {}; pipelineDesc.program = shaderProgram.get(); - ComPtr pipelineState; - REQUIRE_CALL(device->createComputePipelineState(pipelineDesc, pipelineState.writeRef())); + ComPtr pipeline; + REQUIRE_CALL(device->createComputePipeline(pipelineDesc, pipeline.writeRef())); const int numberCount = 4; float initialData[] = {0.0f, 0.0f, 0.0f, 0.0f}; @@ -128,7 +128,7 @@ void testLinkTimeConstant(GpuTestContext* ctx, DeviceType deviceType) auto commandBuffer = transientHeap->createCommandBuffer(); auto encoder = commandBuffer->encodeComputeCommands(); - auto rootObject = encoder->bindPipeline(pipelineState); + auto rootObject = encoder->bindPipeline(pipeline); ShaderCursor entryPointCursor(rootObject->getEntryPoint(0)); // get a cursor the the first entry-point. // Bind buffer view to the entry point. diff --git a/tests/test-link-time-default.cpp b/tests/test-link-time-default.cpp index df1551ed..82ab7c9a 100644 --- a/tests/test-link-time-default.cpp +++ b/tests/test-link-time-default.cpp @@ -119,20 +119,20 @@ void testLinkTimeDefault(GpuTestContext* ctx, DeviceType deviceType) slang::ProgramLayout* slangReflection; REQUIRE_CALL(loadProgram(device, shaderProgram, slangReflection, false)); - ComputePipelineStateDesc pipelineDesc = {}; + ComputePipelineDesc pipelineDesc = {}; pipelineDesc.program = shaderProgram.get(); - ComPtr pipelineState; - REQUIRE_CALL(device->createComputePipelineState(pipelineDesc, pipelineState.writeRef())); + ComPtr pipeline; + REQUIRE_CALL(device->createComputePipeline(pipelineDesc, pipeline.writeRef())); // Create pipeline with a specialization override module linked in, so we should // see the result of using `Bar` for `extern Foo`. ComPtr shaderProgram1; REQUIRE_CALL(loadProgram(device, shaderProgram1, slangReflection, true)); - ComputePipelineStateDesc pipelineDesc1 = {}; + ComputePipelineDesc pipelineDesc1 = {}; pipelineDesc1.program = shaderProgram1.get(); - ComPtr pipelineState1; - REQUIRE_CALL(device->createComputePipelineState(pipelineDesc1, pipelineState1.writeRef())); + ComPtr pipeline1; + REQUIRE_CALL(device->createComputePipeline(pipelineDesc1, pipeline1.writeRef())); const int numberCount = 4; float initialData[] = {0.0f, 0.0f, 0.0f, 0.0f}; @@ -167,7 +167,7 @@ void testLinkTimeDefault(GpuTestContext* ctx, DeviceType deviceType) auto commandBuffer = transientHeap->createCommandBuffer(); auto encoder = commandBuffer->encodeComputeCommands(); - auto rootObject = encoder->bindPipeline(pipelineState); + auto rootObject = encoder->bindPipeline(pipeline); ShaderCursor entryPointCursor(rootObject->getEntryPoint(0)); // get a cursor the the first entry-point. // Bind buffer view to the entry point. @@ -187,7 +187,7 @@ void testLinkTimeDefault(GpuTestContext* ctx, DeviceType deviceType) auto commandBuffer = transientHeap->createCommandBuffer(); auto encoder = commandBuffer->encodeComputeCommands(); - auto rootObject = encoder->bindPipeline(pipelineState1); + auto rootObject = encoder->bindPipeline(pipeline1); ShaderCursor entryPointCursor(rootObject->getEntryPoint(0)); // get a cursor the the first entry-point. // Bind buffer view to the entry point. diff --git a/tests/test-link-time-options.cpp b/tests/test-link-time-options.cpp index d8872823..3c2dc7d7 100644 --- a/tests/test-link-time-options.cpp +++ b/tests/test-link-time-options.cpp @@ -78,10 +78,10 @@ void testLinkTimeOptions(GpuTestContext* ctx, DeviceType deviceType) slang::ProgramLayout* slangReflection; REQUIRE_CALL(loadProgram(device, shaderProgram, "test-link-time-options", "computeMain", slangReflection)); - ComputePipelineStateDesc pipelineDesc = {}; + ComputePipelineDesc pipelineDesc = {}; pipelineDesc.program = shaderProgram.get(); - ComPtr pipelineState; - REQUIRE_CALL(device->createComputePipelineState(pipelineDesc, pipelineState.writeRef())); + ComPtr pipeline; + REQUIRE_CALL(device->createComputePipeline(pipelineDesc, pipeline.writeRef())); const int numberCount = 4; float initialData[] = {0.0f, 0.0f, 0.0f, 0.0f}; @@ -116,7 +116,7 @@ void testLinkTimeOptions(GpuTestContext* ctx, DeviceType deviceType) auto commandBuffer = transientHeap->createCommandBuffer(); auto encoder = commandBuffer->encodeComputeCommands(); - auto rootObject = encoder->bindPipeline(pipelineState); + auto rootObject = encoder->bindPipeline(pipeline); ShaderCursor entryPointCursor(rootObject->getEntryPoint(0)); // get a cursor the the first entry-point. // Bind buffer view to the entry point. diff --git a/tests/test-link-time-type.cpp b/tests/test-link-time-type.cpp index 0af6f365..1a024146 100644 --- a/tests/test-link-time-type.cpp +++ b/tests/test-link-time-type.cpp @@ -117,10 +117,10 @@ void testLinkTimeType(GpuTestContext* ctx, DeviceType deviceType) slang::ProgramLayout* slangReflection; REQUIRE_CALL(loadProgram(device, shaderProgram, slangReflection)); - ComputePipelineStateDesc pipelineDesc = {}; + ComputePipelineDesc pipelineDesc = {}; pipelineDesc.program = shaderProgram.get(); - ComPtr pipelineState; - REQUIRE_CALL(device->createComputePipelineState(pipelineDesc, pipelineState.writeRef())); + ComPtr pipeline; + REQUIRE_CALL(device->createComputePipeline(pipelineDesc, pipeline.writeRef())); const int numberCount = 4; float initialData[] = {0.0f, 0.0f, 0.0f, 0.0f}; @@ -155,7 +155,7 @@ void testLinkTimeType(GpuTestContext* ctx, DeviceType deviceType) auto commandBuffer = transientHeap->createCommandBuffer(); auto encoder = commandBuffer->encodeComputeCommands(); - auto rootObject = encoder->bindPipeline(pipelineState); + auto rootObject = encoder->bindPipeline(pipeline); ShaderCursor entryPointCursor(rootObject->getEntryPoint(0)); // get a cursor the the first entry-point. // Bind buffer view to the entry point. diff --git a/tests/test-mutable-shader-object.cpp b/tests/test-mutable-shader-object.cpp index 961ca474..3fa3ac1a 100644 --- a/tests/test-mutable-shader-object.cpp +++ b/tests/test-mutable-shader-object.cpp @@ -17,10 +17,10 @@ void testMutableShaderObject(GpuTestContext* ctx, DeviceType deviceType) REQUIRE_CALL(loadComputeProgram(device, shaderProgram, "test-mutable-shader-object", "computeMain", slangReflection) ); - ComputePipelineStateDesc pipelineDesc = {}; + ComputePipelineDesc pipelineDesc = {}; pipelineDesc.program = shaderProgram.get(); - ComPtr pipelineState; - REQUIRE_CALL(device->createComputePipelineState(pipelineDesc, pipelineState.writeRef())); + ComPtr pipeline; + REQUIRE_CALL(device->createComputePipeline(pipelineDesc, pipeline.writeRef())); float initialData[] = {0.0f, 1.0f, 2.0f, 3.0f}; const int numberCount = SLANG_COUNT_OF(initialData); @@ -65,7 +65,7 @@ void testMutableShaderObject(GpuTestContext* ctx, DeviceType deviceType) auto commandBuffer = transientHeap->createCommandBuffer(); auto encoder = commandBuffer->encodeComputeCommands(); - auto rootObject = encoder->bindPipeline(pipelineState); + auto rootObject = encoder->bindPipeline(pipeline); auto entryPointCursor = ShaderCursor(rootObject->getEntryPoint(0)); @@ -86,7 +86,7 @@ void testMutableShaderObject(GpuTestContext* ctx, DeviceType deviceType) encoder = commandBuffer->encodeComputeCommands(); - rootObject = encoder->bindPipeline(pipelineState); + rootObject = encoder->bindPipeline(pipeline); entryPointCursor = ShaderCursor(rootObject->getEntryPoint(0)); // Mutate `transformer` object and run again. diff --git a/tests/test-nested-parameter-block.cpp b/tests/test-nested-parameter-block.cpp index 86f00301..e4ecd540 100644 --- a/tests/test-nested-parameter-block.cpp +++ b/tests/test-nested-parameter-block.cpp @@ -45,10 +45,10 @@ void testNestedParameterBlock(GpuTestContext* ctx, DeviceType deviceType) loadComputeProgram(device, shaderProgram, "test-nested-parameter-block", "computeMain", slangReflection) ); - ComputePipelineStateDesc pipelineDesc = {}; + ComputePipelineDesc pipelineDesc = {}; pipelineDesc.program = shaderProgram.get(); - ComPtr pipelineState; - REQUIRE_CALL(device->createComputePipelineState(pipelineDesc, pipelineState.writeRef())); + ComPtr pipeline; + REQUIRE_CALL(device->createComputePipeline(pipelineDesc, pipeline.writeRef())); ComPtr shaderObject; REQUIRE_CALL(device->createMutableRootShaderObject(shaderProgram, shaderObject.writeRef())); @@ -122,7 +122,7 @@ void testNestedParameterBlock(GpuTestContext* ctx, DeviceType deviceType) auto commandBuffer = transientHeap->createCommandBuffer(); auto encoder = commandBuffer->encodeComputeCommands(); - encoder->bindPipelineWithRootObject(pipelineState, shaderObject); + encoder->bindPipelineWithRootObject(pipeline, shaderObject); encoder->dispatchCompute(1, 1, 1); encoder->endEncoding(); diff --git a/tests/test-precompiled-module-2.cpp b/tests/test-precompiled-module-2.cpp index 8e64a365..d0bcfc93 100644 --- a/tests/test-precompiled-module-2.cpp +++ b/tests/test-precompiled-module-2.cpp @@ -116,10 +116,10 @@ void precompiledModule2TestImplCommon(IDevice* device, UnitTestContext* context, loadComputeProgram(device, slangSession, shaderProgram, "precompiled-module", "computeMain", slangReflection) ); - ComputePipelineStateDesc pipelineDesc = {}; + ComputePipelineDesc pipelineDesc = {}; pipelineDesc.program = shaderProgram.get(); - ComPtr pipelineState; - REQUIRE_CALL(device->createComputePipelineState(pipelineDesc, pipelineState.writeRef())); + ComPtr pipeline; + REQUIRE_CALL(device->createComputePipeline(pipelineDesc, pipeline.writeRef())); const int numberCount = 4; float initialData[] = {0.0f, 0.0f, 0.0f, 0.0f}; @@ -154,7 +154,7 @@ void precompiledModule2TestImplCommon(IDevice* device, UnitTestContext* context, auto commandBuffer = transientHeap->createCommandBuffer(); auto encoder = commandBuffer->encodeComputeCommands(); - auto rootObject = encoder->bindPipeline(pipelineState); + auto rootObject = encoder->bindPipeline(pipeline); ShaderCursor entryPointCursor(rootObject->getEntryPoint(0)); // get a cursor the the first entry-point. // Bind buffer view to the entry point. diff --git a/tests/test-precompiled-module-cache.cpp b/tests/test-precompiled-module-cache.cpp index d650e87e..5ee649d4 100644 --- a/tests/test-precompiled-module-cache.cpp +++ b/tests/test-precompiled-module-cache.cpp @@ -144,10 +144,10 @@ void precompiledModuleCacheTestImpl(IDevice* device, UnitTestContext* context) loadComputeProgram(device, slangSession, shaderProgram, "precompiled-module", "computeMain", slangReflection) ); - ComputePipelineStateDesc pipelineDesc = {}; + ComputePipelineDesc pipelineDesc = {}; pipelineDesc.program = shaderProgram.get(); - ComPtr pipelineState; - REQUIRE_CALL(device->createComputePipelineState(pipelineDesc, pipelineState.writeRef())); + ComPtr pipeline; + REQUIRE_CALL(device->createComputePipeline(pipelineDesc, pipeline.writeRef())); const int numberCount = 4; float initialData[] = {0.0f, 0.0f, 0.0f, 0.0f}; @@ -182,7 +182,7 @@ void precompiledModuleCacheTestImpl(IDevice* device, UnitTestContext* context) auto commandBuffer = transientHeap->createCommandBuffer(); auto encoder = commandBuffer->encodeComputeCommands(); - auto rootObject = encoder->bindPipeline(pipelineState); + auto rootObject = encoder->bindPipeline(pipeline); ShaderCursor entryPointCursor(rootObject->getEntryPoint(0)); // get a cursor the the first entry-point. // Bind buffer view to the entry point. diff --git a/tests/test-precompiled-module.cpp b/tests/test-precompiled-module.cpp index 0c739083..e1d1d5c6 100644 --- a/tests/test-precompiled-module.cpp +++ b/tests/test-precompiled-module.cpp @@ -78,10 +78,10 @@ void testPrecompiledModule(GpuTestContext* ctx, DeviceType deviceType) loadComputeProgram(device, slangSession, shaderProgram, "precompiled-module", "computeMain", slangReflection) ); - ComputePipelineStateDesc pipelineDesc = {}; + ComputePipelineDesc pipelineDesc = {}; pipelineDesc.program = shaderProgram.get(); - ComPtr pipelineState; - REQUIRE_CALL(device->createComputePipelineState(pipelineDesc, pipelineState.writeRef())); + ComPtr pipeline; + REQUIRE_CALL(device->createComputePipeline(pipelineDesc, pipeline.writeRef())); const int numberCount = 4; float initialData[] = {0.0f, 0.0f, 0.0f, 0.0f}; @@ -116,7 +116,7 @@ void testPrecompiledModule(GpuTestContext* ctx, DeviceType deviceType) auto commandBuffer = transientHeap->createCommandBuffer(); auto encoder = commandBuffer->encodeComputeCommands(); - auto rootObject = encoder->bindPipeline(pipelineState); + auto rootObject = encoder->bindPipeline(pipeline); ShaderCursor entryPointCursor(rootObject->getEntryPoint(0)); // get a cursor the the first entry-point. // Bind buffer view to the entry point. diff --git a/tests/test-ray-tracing.cpp b/tests/test-ray-tracing.cpp index 3f5e6f16..6f1b2795 100644 --- a/tests/test-ray-tracing.cpp +++ b/tests/test-ray-tracing.cpp @@ -47,7 +47,7 @@ struct BaseRayTracingTest ComPtr transientHeap; ComPtr queue; - ComPtr renderPipelineState; + ComPtr raytracingPipeline; ComPtr vertexBuffer; ComPtr indexBuffer; ComPtr transformBuffer; @@ -317,7 +317,7 @@ struct BaseRayTracingTest ComPtr rayTracingProgram; REQUIRE_CALL(loadShaderProgram(device, rayTracingProgram.writeRef())); - RayTracingPipelineStateDesc rtpDesc = {}; + RayTracingPipelineDesc rtpDesc = {}; rtpDesc.program = rayTracingProgram; rtpDesc.hitGroupCount = 2; HitGroupDesc hitGroups[2]; @@ -328,8 +328,8 @@ struct BaseRayTracingTest rtpDesc.hitGroups = hitGroups; rtpDesc.maxRayPayloadSize = 64; rtpDesc.maxRecursion = 2; - REQUIRE_CALL(device->createRayTracingPipelineState(rtpDesc, renderPipelineState.writeRef())); - REQUIRE(renderPipelineState != nullptr); + REQUIRE_CALL(device->createRayTracingPipeline(rtpDesc, raytracingPipeline.writeRef())); + REQUIRE(raytracingPipeline != nullptr); const char* raygenNames[] = {"rayGenShaderA", "rayGenShaderB"}; const char* missNames[] = {"missShaderA", "missShaderB"}; @@ -377,7 +377,7 @@ struct RayTracingTestA : BaseRayTracingTest ComPtr renderCommandBuffer = transientHeap->createCommandBuffer(); auto renderEncoder = renderCommandBuffer->encodeRayTracingCommands(); IShaderObject* rootObject = nullptr; - renderEncoder->bindPipeline(renderPipelineState, &rootObject); + renderEncoder->bindPipeline(raytracingPipeline, &rootObject); auto cursor = ShaderCursor(rootObject); cursor["resultTexture"].setResource(resultTextureUAV); cursor["sceneBVH"].setResource(TLAS); @@ -405,7 +405,7 @@ struct RayTracingTestB : BaseRayTracingTest ComPtr renderCommandBuffer = transientHeap->createCommandBuffer(); auto renderEncoder = renderCommandBuffer->encodeRayTracingCommands(); IShaderObject* rootObject = nullptr; - renderEncoder->bindPipeline(renderPipelineState, &rootObject); + renderEncoder->bindPipeline(raytracingPipeline, &rootObject); auto cursor = ShaderCursor(rootObject); cursor["resultTexture"].setResource(resultTextureUAV); cursor["sceneBVH"].setResource(TLAS); diff --git a/tests/test-resolve-resource-tests.cpp b/tests/test-resolve-resource-tests.cpp index fd37c7cb..03c33852 100644 --- a/tests/test-resolve-resource-tests.cpp +++ b/tests/test-resolve-resource-tests.cpp @@ -59,7 +59,7 @@ struct BaseResolveResourceTest ComPtr dstTexture; ComPtr transientHeap; - ComPtr pipelineState; + ComPtr pipeline; ComPtr renderPass; ComPtr framebuffer; @@ -145,13 +145,13 @@ struct BaseResolveResourceTest ComPtr framebufferLayout = device->createFramebufferLayout(framebufferLayoutDesc); REQUIRE(framebufferLayout != nullptr); - GraphicsPipelineStateDesc pipelineDesc = {}; + RenderPipelineDesc pipelineDesc = {}; pipelineDesc.program = shaderProgram.get(); pipelineDesc.inputLayout = inputLayout; pipelineDesc.framebufferLayout = framebufferLayout; pipelineDesc.depthStencil.depthTestEnable = false; pipelineDesc.depthStencil.depthWriteEnable = false; - REQUIRE_CALL(device->createGraphicsPipelineState(pipelineDesc, pipelineState.writeRef())); + REQUIRE_CALL(device->createRenderPipeline(pipelineDesc, pipeline.writeRef())); IRenderPassLayout::Desc renderPassDesc = {}; renderPassDesc.framebufferLayout = framebufferLayout; @@ -191,7 +191,7 @@ struct BaseResolveResourceTest auto commandBuffer = transientHeap->createCommandBuffer(); auto renderEncoder = commandBuffer->encodeRenderCommands(renderPass, framebuffer); - auto rootObject = renderEncoder->bindPipeline(pipelineState); + auto rootObject = renderEncoder->bindPipeline(pipeline); Viewport viewport = {}; viewport.maxZ = 1.0f; diff --git a/tests/test-root-mutable-shader-object.cpp b/tests/test-root-mutable-shader-object.cpp index 02fdad2c..757e35e2 100644 --- a/tests/test-root-mutable-shader-object.cpp +++ b/tests/test-root-mutable-shader-object.cpp @@ -17,10 +17,10 @@ void testRootMutableShaderObject(GpuTestContext* ctx, DeviceType deviceType) REQUIRE_CALL(loadComputeProgram(device, shaderProgram, "test-mutable-shader-object", "computeMain", slangReflection) ); - ComputePipelineStateDesc pipelineDesc = {}; + ComputePipelineDesc pipelineDesc = {}; pipelineDesc.program = shaderProgram.get(); - ComPtr pipelineState; - REQUIRE_CALL(device->createComputePipelineState(pipelineDesc, pipelineState.writeRef())); + ComPtr pipeline; + REQUIRE_CALL(device->createComputePipeline(pipelineDesc, pipeline.writeRef())); float initialData[] = {0.0f, 1.0f, 2.0f, 3.0f}; const int numberCount = SLANG_COUNT_OF(initialData); @@ -69,7 +69,7 @@ void testRootMutableShaderObject(GpuTestContext* ctx, DeviceType deviceType) auto commandBuffer = transientHeap->createCommandBuffer(); { auto encoder = commandBuffer->encodeComputeCommands(); - encoder->bindPipelineWithRootObject(pipelineState, rootObject); + encoder->bindPipelineWithRootObject(pipeline, rootObject); encoder->dispatchCompute(1, 1, 1); encoder->endEncoding(); } @@ -84,7 +84,7 @@ void testRootMutableShaderObject(GpuTestContext* ctx, DeviceType deviceType) ShaderCursor(transformer).getPath("c").setData(&c, sizeof(float)); { auto encoder = commandBuffer->encodeComputeCommands(); - encoder->bindPipelineWithRootObject(pipelineState, rootObject); + encoder->bindPipelineWithRootObject(pipeline, rootObject); encoder->dispatchCompute(1, 1, 1); encoder->endEncoding(); } diff --git a/tests/test-root-shader-parameter.cpp b/tests/test-root-shader-parameter.cpp index bd584524..5d99f314 100644 --- a/tests/test-root-shader-parameter.cpp +++ b/tests/test-root-shader-parameter.cpp @@ -38,10 +38,10 @@ void testRootShaderParameter(GpuTestContext* ctx, DeviceType deviceType) REQUIRE_CALL(loadComputeProgram(device, shaderProgram, "test-root-shader-parameter", "computeMain", slangReflection) ); - ComputePipelineStateDesc pipelineDesc = {}; + ComputePipelineDesc pipelineDesc = {}; pipelineDesc.program = shaderProgram.get(); - ComPtr pipelineState; - REQUIRE_CALL(device->createComputePipelineState(pipelineDesc, pipelineState.writeRef())); + ComPtr pipeline; + REQUIRE_CALL(device->createComputePipeline(pipelineDesc, pipeline.writeRef())); std::vector> buffers; std::vector> srvs, uavs; @@ -115,7 +115,7 @@ void testRootShaderParameter(GpuTestContext* ctx, DeviceType deviceType) auto commandBuffer = transientHeap->createCommandBuffer(); { auto encoder = commandBuffer->encodeComputeCommands(); - encoder->bindPipelineWithRootObject(pipelineState, rootObject); + encoder->bindPipelineWithRootObject(pipeline, rootObject); encoder->dispatchCompute(1, 1, 1); encoder->endEncoding(); } diff --git a/tests/test-sampler-array.cpp b/tests/test-sampler-array.cpp index c9ad9ce9..d3a07085 100644 --- a/tests/test-sampler-array.cpp +++ b/tests/test-sampler-array.cpp @@ -37,10 +37,10 @@ void testSamplerArray(GpuTestContext* ctx, DeviceType deviceType) slang::ProgramLayout* slangReflection; REQUIRE_CALL(loadComputeProgram(device, shaderProgram, "test-sampler-array", "computeMain", slangReflection)); - ComputePipelineStateDesc pipelineDesc = {}; + ComputePipelineDesc pipelineDesc = {}; pipelineDesc.program = shaderProgram.get(); - ComPtr pipelineState; - REQUIRE_CALL(device->createComputePipelineState(pipelineDesc, pipelineState.writeRef())); + ComPtr pipeline; + REQUIRE_CALL(device->createComputePipeline(pipelineDesc, pipeline.writeRef())); std::vector> samplers; std::vector> srvs; @@ -135,7 +135,7 @@ void testSamplerArray(GpuTestContext* ctx, DeviceType deviceType) auto commandBuffer = transientHeap->createCommandBuffer(); { auto encoder = commandBuffer->encodeComputeCommands(); - encoder->bindPipelineWithRootObject(pipelineState, rootObject); + encoder->bindPipelineWithRootObject(pipeline, rootObject); encoder->dispatchCompute(1, 1, 1); encoder->endEncoding(); } diff --git a/tests/test-shader-cache.cpp b/tests/test-shader-cache.cpp index 4c8c0e78..2e1b785b 100644 --- a/tests/test-shader-cache.cpp +++ b/tests/test-shader-cache.cpp @@ -121,7 +121,7 @@ struct ShaderCacheTest std::filesystem::path tempDirectory; ComPtr device; - ComPtr pipelineState; + ComPtr pipeline; ComPtr buffer; ComPtr bufferView; @@ -243,7 +243,7 @@ struct ShaderCacheTest { buffer = nullptr; bufferView = nullptr; - pipelineState = nullptr; + pipeline = nullptr; } void createComputePipeline(const char* moduleName, const char* entryPointName) @@ -252,9 +252,9 @@ struct ShaderCacheTest slang::ProgramLayout* slangReflection; REQUIRE_CALL(loadComputeProgram(device, shaderProgram, moduleName, entryPointName, slangReflection)); - ComputePipelineStateDesc pipelineDesc = {}; + ComputePipelineDesc pipelineDesc = {}; pipelineDesc.program = shaderProgram.get(); - REQUIRE_CALL(device->createComputePipelineState(pipelineDesc, pipelineState.writeRef())); + REQUIRE_CALL(device->createComputePipeline(pipelineDesc, pipeline.writeRef())); } void createComputePipeline(std::string shaderSource) @@ -262,9 +262,9 @@ struct ShaderCacheTest ComPtr shaderProgram; REQUIRE_CALL(loadComputeProgramFromSource(device, shaderProgram, shaderSource)); - ComputePipelineStateDesc pipelineDesc = {}; + ComputePipelineDesc pipelineDesc = {}; pipelineDesc.program = shaderProgram.get(); - REQUIRE_CALL(device->createComputePipelineState(pipelineDesc, pipelineState.writeRef())); + REQUIRE_CALL(device->createComputePipeline(pipelineDesc, pipeline.writeRef())); } void dispatchComputePipeline() @@ -280,7 +280,7 @@ struct ShaderCacheTest auto commandBuffer = transientHeap->createCommandBuffer(); auto encoder = commandBuffer->encodeComputeCommands(); - auto rootObject = encoder->bindPipeline(pipelineState); + auto rootObject = encoder->bindPipeline(pipeline); // Bind buffer view to the entry point. ShaderCursor entryPointCursor(rootObject->getEntryPoint(0)); @@ -560,9 +560,9 @@ struct ShaderCacheTestSpecialization : ShaderCacheTest slangReflection )); - ComputePipelineStateDesc pipelineDesc = {}; + ComputePipelineDesc pipelineDesc = {}; pipelineDesc.program = shaderProgram.get(); - REQUIRE_CALL(device->createComputePipelineState(pipelineDesc, pipelineState.writeRef())); + REQUIRE_CALL(device->createComputePipeline(pipelineDesc, pipeline.writeRef())); } void dispatchComputePipeline(const char* transformerTypeName) @@ -578,7 +578,7 @@ struct ShaderCacheTestSpecialization : ShaderCacheTest auto commandBuffer = transientHeap->createCommandBuffer(); auto encoder = commandBuffer->encodeComputeCommands(); - auto rootObject = encoder->bindPipeline(pipelineState); + auto rootObject = encoder->bindPipeline(pipeline); ComPtr transformer; slang::TypeReflection* transformerType = slangReflection->findTypeByName(transformerTypeName); @@ -800,7 +800,7 @@ struct ShaderCacheTestGraphics : ShaderCacheTest framebuffer = nullptr; vertexBuffer = nullptr; colorBuffer = nullptr; - pipelineState = nullptr; + pipeline = nullptr; } void createGraphicsPipeline() @@ -816,13 +816,13 @@ struct ShaderCacheTestGraphics : ShaderCacheTest slangReflection )); - GraphicsPipelineStateDesc pipelineDesc = {}; + RenderPipelineDesc pipelineDesc = {}; pipelineDesc.program = shaderProgram.get(); pipelineDesc.inputLayout = inputLayout; pipelineDesc.framebufferLayout = framebufferLayout; pipelineDesc.depthStencil.depthTestEnable = false; pipelineDesc.depthStencil.depthWriteEnable = false; - REQUIRE_CALL(device->createGraphicsPipelineState(pipelineDesc, pipelineState.writeRef())); + REQUIRE_CALL(device->createRenderPipeline(pipelineDesc, pipeline.writeRef())); } void dispatchGraphicsPipeline() @@ -837,7 +837,7 @@ struct ShaderCacheTestGraphics : ShaderCacheTest auto commandBuffer = transientHeap->createCommandBuffer(); auto encoder = commandBuffer->encodeRenderCommands(renderPass, framebuffer); - auto rootObject = encoder->bindPipeline(pipelineState); + auto rootObject = encoder->bindPipeline(pipeline); Viewport viewport = {}; viewport.maxZ = 1.0f; @@ -924,13 +924,13 @@ struct ShaderCacheTestGraphicsSplit : ShaderCacheTestGraphics ComPtr shaderProgram = device->createProgram(programDesc); - GraphicsPipelineStateDesc pipelineDesc = {}; + RenderPipelineDesc pipelineDesc = {}; pipelineDesc.program = shaderProgram.get(); pipelineDesc.inputLayout = inputLayout; pipelineDesc.framebufferLayout = framebufferLayout; pipelineDesc.depthStencil.depthTestEnable = false; pipelineDesc.depthStencil.depthWriteEnable = false; - REQUIRE_CALL(device->createGraphicsPipelineState(pipelineDesc, pipelineState.writeRef())); + REQUIRE_CALL(device->createRenderPipeline(pipelineDesc, pipeline.writeRef())); } void runGraphicsPipeline() diff --git a/tests/test-shared-buffer.cpp b/tests/test-shared-buffer.cpp index a123c2b6..cfe00e3d 100644 --- a/tests/test-shared-buffer.cpp +++ b/tests/test-shared-buffer.cpp @@ -56,10 +56,10 @@ void testSharedBuffer(GpuTestContext* ctx, DeviceType deviceType) slang::ProgramLayout* slangReflection; REQUIRE_CALL(loadComputeProgram(dstDevice, shaderProgram, "test-compute-trivial", "computeMain", slangReflection)); - ComputePipelineStateDesc pipelineDesc = {}; + ComputePipelineDesc pipelineDesc = {}; pipelineDesc.program = shaderProgram.get(); - ComPtr pipelineState; - REQUIRE_CALL(dstDevice->createComputePipelineState(pipelineDesc, pipelineState.writeRef())); + ComPtr pipeline; + REQUIRE_CALL(dstDevice->createComputePipeline(pipelineDesc, pipeline.writeRef())); ComPtr bufferView; IResourceView::Desc viewDesc = {}; @@ -74,7 +74,7 @@ void testSharedBuffer(GpuTestContext* ctx, DeviceType deviceType) auto commandBuffer = transientHeap->createCommandBuffer(); auto encoder = commandBuffer->encodeComputeCommands(); - auto rootObject = encoder->bindPipeline(pipelineState); + auto rootObject = encoder->bindPipeline(pipeline); ShaderCursor rootCursor(rootObject); // Bind buffer view to the entry point. diff --git a/tests/test-shared-texture.cpp b/tests/test-shared-texture.cpp index aa6a302c..86ba2873 100644 --- a/tests/test-shared-texture.cpp +++ b/tests/test-shared-texture.cpp @@ -21,10 +21,10 @@ static void setUpAndRunShader( slang::ProgramLayout* slangReflection; REQUIRE_CALL(loadComputeProgram(device, shaderProgram, "trivial-copy", entryPoint, slangReflection)); - ComputePipelineStateDesc pipelineDesc = {}; + ComputePipelineDesc pipelineDesc = {}; pipelineDesc.program = shaderProgram.get(); - ComPtr pipelineState; - REQUIRE_CALL(device->createComputePipelineState(pipelineDesc, pipelineState.writeRef())); + ComPtr pipeline; + REQUIRE_CALL(device->createComputePipeline(pipelineDesc, pipeline.writeRef())); // We have done all the set up work, now it is time to start recording a command buffer for // GPU execution. @@ -35,7 +35,7 @@ static void setUpAndRunShader( auto commandBuffer = transientHeap->createCommandBuffer(); auto encoder = commandBuffer->encodeComputeCommands(); - auto rootObject = encoder->bindPipeline(pipelineState); + auto rootObject = encoder->bindPipeline(pipeline); ShaderCursor entryPointCursor(rootObject->getEntryPoint(0)); // get a cursor the the first entry-point. diff --git a/tests/test-swapchain.cpp b/tests/test-swapchain.cpp index 397aec91..bcf2b197 100644 --- a/tests/test-swapchain.cpp +++ b/tests/test-swapchain.cpp @@ -29,7 +29,7 @@ struct SwapchainResizeTest ComPtr transientHeap; ComPtr framebufferLayout; - ComPtr pipelineState; + ComPtr pipeline; ComPtr renderPass; List> framebuffers; @@ -148,13 +148,13 @@ struct SwapchainResizeTest framebufferLayout = device->createFramebufferLayout(framebufferLayoutDesc); SLANG_CHECK_ABORT(framebufferLayout != nullptr); - GraphicsPipelineStateDesc pipelineDesc = {}; + RenderPipelineDesc pipelineDesc = {}; pipelineDesc.program = shaderProgram.get(); pipelineDesc.inputLayout = inputLayout; pipelineDesc.framebufferLayout = framebufferLayout; pipelineDesc.depthStencil.depthTestEnable = false; pipelineDesc.depthStencil.depthWriteEnable = false; - REQUIRE_CALL(device->createGraphicsPipelineState(pipelineDesc, pipelineState.writeRef())); + REQUIRE_CALL(device->createRenderPipeline(pipelineDesc, pipeline.writeRef())); IRenderPassLayout::Desc renderPassDesc = {}; renderPassDesc.framebufferLayout = framebufferLayout; @@ -175,7 +175,7 @@ struct SwapchainResizeTest auto commandBuffer = transientHeap->createCommandBuffer(); auto encoder = commandBuffer->encodeRenderCommands(renderPass, framebuffers[framebufferIndex]); - auto rootObject = encoder->bindPipeline(pipelineState); + auto rootObject = encoder->bindPipeline(pipeline); gfx::Viewport viewport = {}; viewport.maxZ = 1.0f; diff --git a/tests/test-texture-types.cpp b/tests/test-texture-types.cpp index d1eae4b8..e60391f5 100644 --- a/tests/test-texture-types.cpp +++ b/tests/test-texture-types.cpp @@ -174,10 +174,10 @@ struct ShaderAndUnorderedTests : BaseTextureViewTest slang::ProgramLayout* slangReflection; REQUIRE_CALL(loadComputeProgram(device, shaderProgram, "test-texture-types", entryPoint, slangReflection)); - ComputePipelineStateDesc pipelineDesc = {}; + ComputePipelineDesc pipelineDesc = {}; pipelineDesc.program = shaderProgram.get(); - ComPtr pipelineState; - REQUIRE_CALL(device->createComputePipelineState(pipelineDesc, pipelineState.writeRef())); + ComPtr pipeline; + REQUIRE_CALL(device->createComputePipeline(pipelineDesc, pipeline.writeRef())); // We have done all the set up work, now it is time to start recording a command buffer for // GPU execution. @@ -188,7 +188,7 @@ struct ShaderAndUnorderedTests : BaseTextureViewTest auto commandBuffer = transientHeap->createCommandBuffer(); auto encoder = commandBuffer->encodeComputeCommands(); - auto rootObject = encoder->bindPipeline(pipelineState); + auto rootObject = encoder->bindPipeline(pipeline); ShaderCursor entryPointCursor(rootObject->getEntryPoint(0)); // get a cursor the the first entry-point. @@ -340,7 +340,7 @@ struct RenderTargetTests : BaseTextureViewTest int sampleCount = 1; ComPtr transientHeap; - ComPtr pipelineState; + ComPtr pipeline; ComPtr renderPass; ComPtr framebuffer; @@ -425,13 +425,13 @@ struct RenderTargetTests : BaseTextureViewTest ComPtr framebufferLayout = device->createFramebufferLayout(framebufferLayoutDesc); REQUIRE(framebufferLayout != nullptr); - GraphicsPipelineStateDesc pipelineDesc = {}; + RenderPipelineDesc pipelineDesc = {}; pipelineDesc.program = shaderProgram.get(); pipelineDesc.inputLayout = inputLayout; pipelineDesc.framebufferLayout = framebufferLayout; pipelineDesc.depthStencil.depthTestEnable = false; pipelineDesc.depthStencil.depthWriteEnable = false; - REQUIRE_CALL(device->createGraphicsPipelineState(pipelineDesc, pipelineState.writeRef())); + REQUIRE_CALL(device->createRenderPipeline(pipelineDesc, pipeline.writeRef())); IRenderPassLayout::Desc renderPassDesc = {}; renderPassDesc.framebufferLayout = framebufferLayout; @@ -471,7 +471,7 @@ struct RenderTargetTests : BaseTextureViewTest auto commandBuffer = transientHeap->createCommandBuffer(); auto renderEncoder = commandBuffer->encodeRenderCommands(renderPass, framebuffer); - auto rootObject = renderEncoder->bindPipeline(pipelineState); + auto rootObject = renderEncoder->bindPipeline(pipeline); Viewport viewport = {}; viewport.maxZ = (float)textureInfo->extents.depth; diff --git a/tests/test-uint16-structured-buffer.cpp b/tests/test-uint16-structured-buffer.cpp index c3d8d3e3..161bdf97 100644 --- a/tests/test-uint16-structured-buffer.cpp +++ b/tests/test-uint16-structured-buffer.cpp @@ -16,10 +16,10 @@ void testUint16StructuredBuffer(GpuTestContext* ctx, DeviceType deviceType) slang::ProgramLayout* slangReflection; REQUIRE_CALL(loadComputeProgram(device, shaderProgram, "test-uint16-buffer", "computeMain", slangReflection)); - ComputePipelineStateDesc pipelineDesc = {}; + ComputePipelineDesc pipelineDesc = {}; pipelineDesc.program = shaderProgram.get(); - ComPtr pipelineState; - REQUIRE_CALL(device->createComputePipelineState(pipelineDesc, pipelineState.writeRef())); + ComPtr pipeline; + REQUIRE_CALL(device->createComputePipeline(pipelineDesc, pipeline.writeRef())); const int numberCount = 4; uint16_t initialData[] = {0, 1, 2, 3}; @@ -56,7 +56,7 @@ void testUint16StructuredBuffer(GpuTestContext* ctx, DeviceType deviceType) auto commandBuffer = transientHeap->createCommandBuffer(); auto encoder = commandBuffer->encodeComputeCommands(); - auto rootObject = encoder->bindPipeline(pipelineState); + auto rootObject = encoder->bindPipeline(pipeline); // Bind buffer view to the entry point. ShaderCursor(rootObject).getPath("buffer").setResource(bufferView);