diff options
| author | Yong He <yonghe@outlook.com> | 2021-03-24 13:57:55 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-03-24 13:57:55 -0700 |
| commit | 98afb421f408aa8651afff3dba1b21fad71131fe (patch) | |
| tree | a8610d12ac7d74a8772cb6ecdd810da8216baa67 /tools/gfx/cpu/render-cpu.cpp | |
| parent | d0f7b7f0ed1d0d1388ce944cd1ad906bbd9afb35 (diff) | |
Reimplement Vulkan shader objects. (#1764)
* Reimplement Vulkan shader objects.
This change reimplements Vulkan shader objects in the `gfx` layer so that it is no longer layered on top of the `DescriptorSet` abstraction. Since this is the last implementation that uses `DescriptorSet`, the change also removes all `DescriptorSet` related API from public `gfx` interface.
The Vulkan implementation now passes all test cases, but it still have two issues:
1. The PushConstant setting is not correct, this is because we don't seem to be able to get correct reflection data about the size of push constants for an entry-point.
2. The `shader-toy` example can't run on Vulkan, because it currently sets nullptr to `Texture` bindings, and this change doesn't properly handle setting resource to null in `ShaderObject`s yet. If we can use the `nullDescriptor` feature on vulkan, this implementation will be simple. However we still want to decide whether we want to use a Vulkan 1.2 feature for this.
* Fix up
Diffstat (limited to 'tools/gfx/cpu/render-cpu.cpp')
| -rw-r--r-- | tools/gfx/cpu/render-cpu.cpp | 38 |
1 files changed, 0 insertions, 38 deletions
diff --git a/tools/gfx/cpu/render-cpu.cpp b/tools/gfx/cpu/render-cpu.cpp index ab9224657..fa31f7ee1 100644 --- a/tools/gfx/cpu/render-cpu.cpp +++ b/tools/gfx/cpu/render-cpu.cpp @@ -1167,14 +1167,6 @@ private: m_writer->bindRootShaderObject(PipelineType::Compute, object); } - virtual SLANG_NO_THROW void SLANG_MCALL setDescriptorSet( - IPipelineLayout* layout, - UInt index, - IDescriptorSet* descriptorSet) override - { - m_writer->setDescriptorSet(PipelineType::Compute, layout, index, descriptorSet); - } - virtual SLANG_NO_THROW void SLANG_MCALL dispatchCompute(int x, int y, int z) override { m_writer->dispatchCompute(x, y, z); @@ -1521,14 +1513,6 @@ public: virtual SLANG_NO_THROW Result SLANG_MCALL createProgram(const IShaderProgram::Desc& desc, IShaderProgram** outProgram) override { - if( desc.kernelCount == 0 ) - { - return createProgramFromSlang(this, desc, outProgram); - } - - if (desc.kernelCount != 1) - return SLANG_E_INVALID_ARG; - RefPtr<CPUShaderProgram> cpuProgram = new CPUShaderProgram(); // TODO: stuff? @@ -1623,28 +1607,6 @@ public: SLANG_UNUSED(outLayout); return SLANG_E_NOT_AVAILABLE; } - virtual SLANG_NO_THROW Result SLANG_MCALL createDescriptorSetLayout( - const IDescriptorSetLayout::Desc& desc, IDescriptorSetLayout** outLayout) override - { - SLANG_UNUSED(desc); - SLANG_UNUSED(outLayout); - return SLANG_E_NOT_AVAILABLE; - } - virtual SLANG_NO_THROW Result SLANG_MCALL - createPipelineLayout(const IPipelineLayout::Desc& desc, IPipelineLayout** outLayout) override - { - SLANG_UNUSED(desc); - SLANG_UNUSED(outLayout); - return SLANG_E_NOT_AVAILABLE; - } - virtual SLANG_NO_THROW Result SLANG_MCALL - createDescriptorSet(IDescriptorSetLayout* layout, IDescriptorSet::Flag::Enum flags, IDescriptorSet** outDescriptorSet) override - { - SLANG_UNUSED(layout); - SLANG_UNUSED(flags); - SLANG_UNUSED(outDescriptorSet); - return SLANG_E_NOT_AVAILABLE; - } virtual SLANG_NO_THROW Result SLANG_MCALL createGraphicsPipelineState( const GraphicsPipelineStateDesc& desc, IPipelineState** outState) override { |
