From 30b8276ffe44b5c45fdbf4eb09a3c0d246dbc2f4 Mon Sep 17 00:00:00 2001 From: azhirnov Date: Wed, 19 Aug 2020 18:47:11 +0300 Subject: Rename ***_PIPELINE to PIPELINE_TYPE_*** --- Graphics/GraphicsEngine/include/DeviceContextBase.hpp | 16 ++++++++-------- Graphics/GraphicsEngine/include/PipelineStateBase.hpp | 17 ++++++++++++++--- Graphics/GraphicsEngine/interface/PipelineState.h | 16 ++++++++-------- 3 files changed, 30 insertions(+), 19 deletions(-) (limited to 'Graphics/GraphicsEngine') diff --git a/Graphics/GraphicsEngine/include/DeviceContextBase.hpp b/Graphics/GraphicsEngine/include/DeviceContextBase.hpp index 3d5544a4..c82cb26a 100644 --- a/Graphics/GraphicsEngine/include/DeviceContextBase.hpp +++ b/Graphics/GraphicsEngine/include/DeviceContextBase.hpp @@ -1426,7 +1426,7 @@ inline bool DeviceContextBase:: return false; } - if (m_pPipelineState->GetDesc().PipelineType != GRAPHICS_PIPELINE) + if (m_pPipelineState->GetDesc().PipelineType != PIPELINE_TYPE_GRAPHICS) { LOG_ERROR_MESSAGE("Draw command arguments are invalid: pipeline state '", m_pPipelineState->GetDesc().Name, "' is a compute pipeline."); return false; @@ -1453,7 +1453,7 @@ inline bool DeviceContextBase:: return false; } - if (m_pPipelineState->GetDesc().PipelineType != GRAPHICS_PIPELINE) + if (m_pPipelineState->GetDesc().PipelineType != PIPELINE_TYPE_GRAPHICS) { LOG_ERROR_MESSAGE("DrawIndexed command arguments are invalid: pipeline state '", m_pPipelineState->GetDesc().Name, "' is a compute pipeline."); @@ -1494,7 +1494,7 @@ inline bool DeviceContextBase:: return false; } - if (m_pPipelineState->GetDesc().PipelineType != MESH_PIPELINE) + if (m_pPipelineState->GetDesc().PipelineType != PIPELINE_TYPE_MESH) { LOG_ERROR_MESSAGE("DrawMesh command arguments are invalid: pipeline state '", m_pPipelineState->GetDesc().Name, "' is a compute pipeline."); @@ -1522,7 +1522,7 @@ inline bool DeviceContextBase:: return false; } - if (m_pPipelineState->GetDesc().PipelineType != GRAPHICS_PIPELINE) + if (m_pPipelineState->GetDesc().PipelineType != PIPELINE_TYPE_GRAPHICS) { LOG_ERROR_MESSAGE("DrawIndirect command arguments are invalid: pipeline state '", @@ -1568,7 +1568,7 @@ inline bool DeviceContextBase:: return false; } - if (m_pPipelineState->GetDesc().PipelineType != GRAPHICS_PIPELINE) + if (m_pPipelineState->GetDesc().PipelineType != PIPELINE_TYPE_GRAPHICS) { LOG_ERROR_MESSAGE("DrawIndexedIndirect command arguments are invalid: pipeline state '", m_pPipelineState->GetDesc().Name, "' is a compute pipeline."); @@ -1626,7 +1626,7 @@ inline bool DeviceContextBase:: return false; } - if (m_pPipelineState->GetDesc().PipelineType != MESH_PIPELINE) + if (m_pPipelineState->GetDesc().PipelineType != PIPELINE_TYPE_MESH) { LOG_ERROR_MESSAGE("DrawMeshIndirect command arguments are invalid: pipeline state '", m_pPipelineState->GetDesc().Name, "' is a compute pipeline."); @@ -1715,7 +1715,7 @@ inline bool DeviceContextBase:: return false; } - if (m_pPipelineState->GetDesc().PipelineType != COMPUTE_PIPELINE) + if (m_pPipelineState->GetDesc().PipelineType != PIPELINE_TYPE_COMPUTE) { LOG_ERROR_MESSAGE("DispatchCompute command arguments are invalid: pipeline state '", m_pPipelineState->GetDesc().Name, "' is a graphics pipeline."); @@ -1750,7 +1750,7 @@ inline bool DeviceContextBase:: return false; } - if (m_pPipelineState->GetDesc().PipelineType != COMPUTE_PIPELINE) + if (m_pPipelineState->GetDesc().PipelineType != PIPELINE_TYPE_COMPUTE) { LOG_ERROR_MESSAGE("DispatchComputeIndirect command arguments are invalid: pipeline state '", m_pPipelineState->GetDesc().Name, "' is a graphics pipeline."); diff --git a/Graphics/GraphicsEngine/include/PipelineStateBase.hpp b/Graphics/GraphicsEngine/include/PipelineStateBase.hpp index 17029ced..82d89e0d 100644 --- a/Graphics/GraphicsEngine/include/PipelineStateBase.hpp +++ b/Graphics/GraphicsEngine/include/PipelineStateBase.hpp @@ -177,7 +177,7 @@ public: VALIDATE_SHADER_TYPE(GraphicsPipeline.pMS, SHADER_TYPE_MESH, "mesh") #undef VALIDATE_SHADER_TYPE - if (PSODesc.PipelineType == GRAPHICS_PIPELINE) + if (PSODesc.PipelineType == PIPELINE_TYPE_GRAPHICS) { CHECK_THROW(GraphicsPipeline.pVS, "Vertex shader must be defined"); CHECK_THROW(!GraphicsPipeline.pAS && !GraphicsPipeline.pMS, "Mesh shaders are not supported in graphics pipeline"); @@ -187,7 +187,7 @@ public: m_pDS = GraphicsPipeline.pDS; m_pHS = GraphicsPipeline.pHS; } - else if (PSODesc.PipelineType == MESH_PIPELINE) + else if (PSODesc.PipelineType == PIPELINE_TYPE_MESH) { CHECK_THROW(GraphicsPipeline.pMS, "Mesh shader must be defined"); CHECK_THROW(!GraphicsPipeline.pVS && !GraphicsPipeline.pGS && !GraphicsPipeline.pDS && !GraphicsPipeline.pHS, @@ -448,7 +448,18 @@ protected: size_t m_ShaderResourceLayoutHash = 0; ///< Hash computed from the shader resource layout private: -#define LOG_PSO_ERROR_AND_THROW(...) LOG_ERROR_AND_THROW("Description of ", (this->m_Desc.IsComputePipeline() ? "compute" : "graphics"), " PSO '", this->m_Desc.Name, "' is invalid: ", ##__VA_ARGS__) +#define LOG_PSO_ERROR_AND_THROW(...) LOG_ERROR_AND_THROW("Description of ", PipelineTypeToString(), " PSO '", this->m_Desc.Name, "' is invalid: ", ##__VA_ARGS__) + + const char* PipelineTypeToString() const + { + switch (this->m_Desc.PipelineType) + { + case PIPELINE_TYPE_COMPUTE: return "compute"; + case PIPELINE_TYPE_GRAPHICS: return "graphics"; + case PIPELINE_TYPE_MESH: return "mesh"; + } + return "unknown"; + } void ValidateDesc() const { diff --git a/Graphics/GraphicsEngine/interface/PipelineState.h b/Graphics/GraphicsEngine/interface/PipelineState.h index 007ce319..271ed607 100644 --- a/Graphics/GraphicsEngine/interface/PipelineState.h +++ b/Graphics/GraphicsEngine/interface/PipelineState.h @@ -249,20 +249,20 @@ DILIGENT_TYPED_ENUM(PIPELINE_TYPE, Uint8) { /// Graphics pipeline used in IDeviceContext::Draw(), IDeviceContext::DrawIndexed(), /// IDeviceContext::DrawIndirect(), IDeviceContext::DrawIndexedIndirect(). - GRAPHICS_PIPELINE, + PIPELINE_TYPE_GRAPHICS, /// Compute pipeline used in IDeviceContext::DispatchCompute(), IDeviceContext::DispatchComputeIndirect(). - COMPUTE_PIPELINE, + PIPELINE_TYPE_COMPUTE, // Mesh pipeline used in IDeviceContext::DrawMesh(), IDeviceContext::DrawMeshIndirect(). - MESH_PIPELINE, + PIPELINE_TYPE_MESH, }; /// Pipeline state description struct PipelineStateDesc DILIGENT_DERIVE(DeviceObjectAttribs) /// Pipeline type - PIPELINE_TYPE PipelineType DEFAULT_INITIALIZER(GRAPHICS_PIPELINE); + PIPELINE_TYPE PipelineType DEFAULT_INITIALIZER(PIPELINE_TYPE_GRAPHICS); /// Shader resource binding allocation granularity @@ -276,15 +276,15 @@ struct PipelineStateDesc DILIGENT_DERIVE(DeviceObjectAttribs) /// Pipeline layout description PipelineResourceLayoutDesc ResourceLayout; - /// Graphics pipeline state description. This memeber is ignored if PipelineType == GRAPHICS_PIPELINE or MESH_PIPELINE + /// Graphics pipeline state description. This memeber is ignored if PipelineType == PIPELINE_TYPE_GRAPHICS or PIPELINE_TYPE_MESH GraphicsPipelineDesc GraphicsPipeline; - /// Compute pipeline state description. This memeber is ignored if PipelineType == COMPUTE_PIPELINE + /// Compute pipeline state description. This memeber is ignored if PipelineType == PIPELINE_TYPE_COMPUTE ComputePipelineDesc ComputePipeline; #if DILIGENT_CPP_INTERFACE - bool IsAnyGraphicsPipeline() const { return PipelineType == GRAPHICS_PIPELINE || PipelineType == MESH_PIPELINE; } - bool IsComputePipeline () const { return PipelineType == COMPUTE_PIPELINE; } + bool IsAnyGraphicsPipeline() const { return PipelineType == PIPELINE_TYPE_GRAPHICS || PipelineType == PIPELINE_TYPE_MESH; } + bool IsComputePipeline () const { return PipelineType == PIPELINE_TYPE_COMPUTE; } #endif }; typedef struct PipelineStateDesc PipelineStateDesc; -- cgit v1.2.3