diff options
| author | Yong He <yonghe@outlook.com> | 2021-12-09 10:46:41 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-12-09 10:46:41 -0800 |
| commit | 1c99a986ae12a3f1ce4cee86191052183d37208a (patch) | |
| tree | e9903d1e569badef813e3f5f33696683bd34f3b0 /tools | |
| parent | 4ca37fea2829ad9c623b94d77bb0311f76ad0971 (diff) | |
Remove `PipelineType` from gfx header. (#2051)
Co-authored-by: Yong He <yhe@nvidia.com>
Diffstat (limited to 'tools')
| -rw-r--r-- | tools/gfx-unit-test/gfx-test-util.cpp | 1 | ||||
| -rw-r--r-- | tools/gfx/d3d12/render-d3d12.cpp | 2 | ||||
| -rw-r--r-- | tools/gfx/renderer-shared.cpp | 1 | ||||
| -rw-r--r-- | tools/gfx/renderer-shared.h | 9 | ||||
| -rw-r--r-- | tools/gfx/vulkan/render-vk.cpp | 15 | ||||
| -rw-r--r-- | tools/gfx/vulkan/vk-util.cpp | 15 | ||||
| -rw-r--r-- | tools/gfx/vulkan/vk-util.h | 2 | ||||
| -rw-r--r-- | tools/render-test/render-test-main.cpp | 26 | ||||
| -rw-r--r-- | tools/render-test/slang-support.cpp | 5 | ||||
| -rw-r--r-- | tools/render-test/slang-support.h | 2 |
10 files changed, 21 insertions, 57 deletions
diff --git a/tools/gfx-unit-test/gfx-test-util.cpp b/tools/gfx-unit-test/gfx-test-util.cpp index 952638fd8..e1da919d8 100644 --- a/tools/gfx-unit-test/gfx-test-util.cpp +++ b/tools/gfx-unit-test/gfx-test-util.cpp @@ -57,7 +57,6 @@ namespace gfx_test slangReflection = composedProgram->getLayout(); gfx::IShaderProgram::Desc programDesc = {}; - programDesc.pipelineType = gfx::PipelineType::Compute; programDesc.slangProgram = composedProgram.get(); auto shaderProgram = device->createProgram(programDesc); diff --git a/tools/gfx/d3d12/render-d3d12.cpp b/tools/gfx/d3d12/render-d3d12.cpp index a9cab870b..28128a04d 100644 --- a/tools/gfx/d3d12/render-d3d12.cpp +++ b/tools/gfx/d3d12/render-d3d12.cpp @@ -2061,7 +2061,6 @@ public: class ShaderProgramImpl : public ShaderProgramBase { public: - PipelineType m_pipelineType; List<ShaderBinary> m_shaders; RefPtr<RootShaderObjectLayoutImpl> m_rootObjectLayout; }; @@ -5952,7 +5951,6 @@ Result D3D12Device::readBufferResource( Result D3D12Device::createProgram(const IShaderProgram::Desc& desc, IShaderProgram** outProgram) { RefPtr<ShaderProgramImpl> shaderProgram = new ShaderProgramImpl(); - shaderProgram->m_pipelineType = desc.pipelineType; shaderProgram->slangProgram = desc.slangProgram; RootShaderObjectLayoutImpl::create( this, diff --git a/tools/gfx/renderer-shared.cpp b/tools/gfx/renderer-shared.cpp index df6ebd37e..fb7baf85d 100644 --- a/tools/gfx/renderer-shared.cpp +++ b/tools/gfx/renderer-shared.cpp @@ -752,7 +752,6 @@ Result RendererBase::maybeSpecializePipeline( ComPtr<IShaderProgram> specializedProgram; IShaderProgram::Desc specializedProgramDesc = {}; specializedProgramDesc.slangProgram = specializedComponentType; - specializedProgramDesc.pipelineType = pipelineType; SLANG_RETURN_ON_FAIL(createProgram(specializedProgramDesc, specializedProgram.writeRef())); // Create specialized pipeline state. diff --git a/tools/gfx/renderer-shared.h b/tools/gfx/renderer-shared.h index 7859f1ad9..9383f2c4e 100644 --- a/tools/gfx/renderer-shared.h +++ b/tools/gfx/renderer-shared.h @@ -1008,6 +1008,15 @@ public: IQueryPool* getInterface(const Slang::Guid& guid); }; +enum class PipelineType +{ + Unknown, + Graphics, + Compute, + RayTracing, + CountOf, +}; + class PipelineStateBase : public IPipelineState , public Slang::ComObject diff --git a/tools/gfx/vulkan/render-vk.cpp b/tools/gfx/vulkan/render-vk.cpp index f949742ea..c48faeb7b 100644 --- a/tools/gfx/vulkan/render-vk.cpp +++ b/tools/gfx/vulkan/render-vk.cpp @@ -2279,9 +2279,8 @@ public: class ShaderProgramImpl : public ShaderProgramBase { public: - ShaderProgramImpl(VKDevice* device, PipelineType pipelineType) + ShaderProgramImpl(VKDevice* device) : m_device(device) - , m_pipelineType(pipelineType) { for (auto& shaderModule : m_modules) shaderModule = VK_NULL_HANDLE; @@ -2306,8 +2305,6 @@ public: BreakableReference<VKDevice> m_device; - PipelineType m_pipelineType; - Array<VkPipelineShaderStageCreateInfo, 8> m_stageCreateInfos; Array<ComPtr<ISlangBlob>, 8> m_codeBlobs; //< To keep storage of code in scope Array<VkShaderModule, 8> m_modules; @@ -4033,8 +4030,7 @@ public: void prepareDraw() { auto pipeline = static_cast<PipelineStateImpl*>(m_currentPipeline.Ptr()); - if (!pipeline || static_cast<ShaderProgramImpl*>(pipeline->m_program.Ptr()) - ->m_pipelineType != PipelineType::Graphics) + if (!pipeline) { assert(!"Invalid render pipeline"); return; @@ -4195,9 +4191,7 @@ public: virtual SLANG_NO_THROW void SLANG_MCALL dispatchCompute(int x, int y, int z) override { auto pipeline = static_cast<PipelineStateImpl*>(m_currentPipeline.Ptr()); - if (!pipeline || - static_cast<ShaderProgramImpl*>(pipeline->m_program.Ptr())->m_pipelineType != - PipelineType::Compute) + if (!pipeline) { assert(!"Invalid compute pipeline"); return; @@ -7893,8 +7887,7 @@ static VkImageViewType _calcImageViewType(ITextureResource::Type type, const ITe Result VKDevice::createProgram(const IShaderProgram::Desc& desc, IShaderProgram** outProgram) { - RefPtr<ShaderProgramImpl> shaderProgram = new ShaderProgramImpl(this, desc.pipelineType); - shaderProgram->m_pipelineType = desc.pipelineType; + RefPtr<ShaderProgramImpl> shaderProgram = new ShaderProgramImpl(this); shaderProgram->slangProgram = desc.slangProgram; m_deviceObjectsWithPotentialBackReferences.add(shaderProgram); diff --git a/tools/gfx/vulkan/vk-util.cpp b/tools/gfx/vulkan/vk-util.cpp index 574e1b9c4..0f6dfaf32 100644 --- a/tools/gfx/vulkan/vk-util.cpp +++ b/tools/gfx/vulkan/vk-util.cpp @@ -148,21 +148,6 @@ VkShaderStageFlags VulkanUtil::getShaderStage(SlangStage stage) } } -VkPipelineBindPoint VulkanUtil::getPipelineBindPoint(PipelineType pipelineType) -{ - switch (pipelineType) - { - case gfx::PipelineType::Graphics: - return VK_PIPELINE_BIND_POINT_GRAPHICS; - case gfx::PipelineType::Compute: - return VK_PIPELINE_BIND_POINT_COMPUTE; - case gfx::PipelineType::RayTracing: - return VK_PIPELINE_BIND_POINT_RAY_TRACING_KHR; - default: - return VkPipelineBindPoint(-1); - } -} - VkImageLayout VulkanUtil::getImageLayoutFromState(ResourceState state) { switch (state) diff --git a/tools/gfx/vulkan/vk-util.h b/tools/gfx/vulkan/vk-util.h index 95f463a7a..cdf7bcc79 100644 --- a/tools/gfx/vulkan/vk-util.h +++ b/tools/gfx/vulkan/vk-util.h @@ -42,8 +42,6 @@ struct VulkanUtil static VkShaderStageFlags getShaderStage(SlangStage stage); - static VkPipelineBindPoint getPipelineBindPoint(PipelineType pipelineType); - static VkImageLayout getImageLayoutFromState(ResourceState state); static inline bool isDepthFormat(VkFormat format) diff --git a/tools/render-test/render-test-main.cpp b/tools/render-test/render-test-main.cpp index 78fa149e8..16a725f2b 100644 --- a/tools/render-test/render-test-main.cpp +++ b/tools/render-test/render-test-main.cpp @@ -80,6 +80,13 @@ struct ShaderOutputPlan List<Item> items; }; +enum class PipelineType +{ + Graphics, + Compute, + RayTracing, +}; + class RenderTestApp { public: @@ -1229,25 +1236,6 @@ static SlangResult _innerMain(Slang::StdWriters* stdWriters, SlangSession* sessi break; } - switch( options.shaderType ) - { - case Options::ShaderProgramType::Graphics: - case Options::ShaderProgramType::GraphicsCompute: - input.pipelineType = PipelineType::Graphics; - break; - - case Options::ShaderProgramType::Compute: - input.pipelineType = PipelineType::Compute; - break; - - case Options::ShaderProgramType::RayTracing: - input.pipelineType = PipelineType::RayTracing; - break; - - default: - break; - } - if (options.sourceLanguage != SLANG_SOURCE_LANGUAGE_UNKNOWN) { input.sourceLanguage = options.sourceLanguage; diff --git a/tools/render-test/slang-support.cpp b/tools/render-test/slang-support.cpp index f479218f7..8240212ec 100644 --- a/tools/render-test/slang-support.cpp +++ b/tools/render-test/slang-support.cpp @@ -51,18 +51,15 @@ gfx::StageType translateStage(SlangStage slangStage) } void ShaderCompilerUtil::Output::set( - PipelineType pipelineType, slang::IComponentType* inSlangProgram) { slangProgram = inSlangProgram; - desc.pipelineType = pipelineType; desc.slangProgram = inSlangProgram; } void ShaderCompilerUtil::Output::reset() { { - desc.pipelineType = PipelineType::Unknown; desc.slangProgram = nullptr; } @@ -266,7 +263,7 @@ void ShaderCompilerUtil::Output::reset() outDiagnostic.writeRef()); linkedSlangProgram = newProgram; } - out.set(input.pipelineType, linkedSlangProgram); + out.set(linkedSlangProgram); return SLANG_OK; } diff --git a/tools/render-test/slang-support.h b/tools/render-test/slang-support.h index 7770bada4..9e06ef77c 100644 --- a/tools/render-test/slang-support.h +++ b/tools/render-test/slang-support.h @@ -57,14 +57,12 @@ struct ShaderCompilerUtil SlangCompileTarget target; SlangSourceLanguage sourceLanguage; SlangPassThrough passThrough; - PipelineType pipelineType = PipelineType::Unknown; Slang::String profile; }; struct Output { void set( - PipelineType pipelineType, slang::IComponentType* slangProgram); void reset(); ~Output() |
