summaryrefslogtreecommitdiff
path: root/tools/gfx
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2021-12-09 10:46:41 -0800
committerGitHub <noreply@github.com>2021-12-09 10:46:41 -0800
commit1c99a986ae12a3f1ce4cee86191052183d37208a (patch)
treee9903d1e569badef813e3f5f33696683bd34f3b0 /tools/gfx
parent4ca37fea2829ad9c623b94d77bb0311f76ad0971 (diff)
Remove `PipelineType` from gfx header. (#2051)
Co-authored-by: Yong He <yhe@nvidia.com>
Diffstat (limited to 'tools/gfx')
-rw-r--r--tools/gfx/d3d12/render-d3d12.cpp2
-rw-r--r--tools/gfx/renderer-shared.cpp1
-rw-r--r--tools/gfx/renderer-shared.h9
-rw-r--r--tools/gfx/vulkan/render-vk.cpp15
-rw-r--r--tools/gfx/vulkan/vk-util.cpp15
-rw-r--r--tools/gfx/vulkan/vk-util.h2
6 files changed, 13 insertions, 31 deletions
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)