summaryrefslogtreecommitdiff
path: root/tools/gfx/render-graphics-common.h
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2021-03-24 13:57:55 -0700
committerGitHub <noreply@github.com>2021-03-24 13:57:55 -0700
commit98afb421f408aa8651afff3dba1b21fad71131fe (patch)
treea8610d12ac7d74a8772cb6ecdd810da8216baa67 /tools/gfx/render-graphics-common.h
parentd0f7b7f0ed1d0d1388ce944cd1ad906bbd9afb35 (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/render-graphics-common.h')
-rw-r--r--tools/gfx/render-graphics-common.h56
1 files changed, 0 insertions, 56 deletions
diff --git a/tools/gfx/render-graphics-common.h b/tools/gfx/render-graphics-common.h
deleted file mode 100644
index 96ab8e831..000000000
--- a/tools/gfx/render-graphics-common.h
+++ /dev/null
@@ -1,56 +0,0 @@
-#pragma once
-
-#include "tools/gfx/renderer-shared.h"
-#include "core/slang-basic.h"
-#include "tools/gfx/slang-context.h"
-
-namespace gfx
-{
-class GraphicsCommonProgramLayout;
-
-class GraphicsCommonShaderProgram : public ShaderProgramBase
-{
-public:
- GraphicsCommonProgramLayout* getLayout() const;
-private:
- friend class GraphicsAPIRenderer;
- Slang::RefPtr<ShaderObjectLayoutBase> m_layout;
-};
-
-class GraphicsComputeCommandEncoderBase
-{
-public:
- RendererBase* m_rendererBase;
- Slang::RefPtr<PipelineStateBase> m_currentPipeline;
-
- virtual SLANG_NO_THROW void SLANG_MCALL setDescriptorSetImpl(
- PipelineType pipelineType,
- IPipelineLayout* layout,
- UInt index,
- IDescriptorSet* descriptorSet) = 0;
- virtual SLANG_NO_THROW void SLANG_MCALL uploadBufferDataImpl(
- IBufferResource* buffer, size_t offset, size_t size, void* data) = 0;
-
- Result bindRootShaderObjectImpl(PipelineType pipelineType, IShaderObject* object);
-};
-
-class GraphicsAPIRenderer : public RendererBase
-{
-public:
- virtual Result createShaderObjectLayout(
- slang::TypeLayoutReflection* typeLayout,
- ShaderObjectLayoutBase** outLayout) SLANG_OVERRIDE;
- virtual Result createShaderObject(
- ShaderObjectLayoutBase* layout,
- IShaderObject** outObject) SLANG_OVERRIDE;
- virtual SLANG_NO_THROW Result SLANG_MCALL createRootShaderObject(
- IShaderProgram* program,
- IShaderObject** outObject) SLANG_OVERRIDE;
- void preparePipelineDesc(GraphicsPipelineStateDesc& desc);
- void preparePipelineDesc(ComputePipelineStateDesc& desc);
-
- Result initProgramCommon(
- GraphicsCommonShaderProgram* program,
- IShaderProgram::Desc const& desc);
-};
-}