summaryrefslogtreecommitdiffstats
path: root/Graphics/GraphicsEngine
diff options
context:
space:
mode:
authorassiduous <assiduous@diligentgraphics.com>2020-09-17 20:28:10 +0000
committerassiduous <assiduous@diligentgraphics.com>2020-09-17 20:28:10 +0000
commit6bccf55c08b641ee2b0ae0df1e5908e28e52e612 (patch)
tree7237eed479980235e6987e6868eacb88f9ae96b8 /Graphics/GraphicsEngine
parentAdded UnifiedMemoryCPUAccess member to GraphicsAdapterInfo struct (API Versio... (diff)
parentdon't link with vulkan if used volk, added shader name to log message (diff)
downloadDiligentCore-6bccf55c08b641ee2b0ae0df1e5908e28e52e612.tar.gz
DiligentCore-6bccf55c08b641ee2b0ae0df1e5908e28e52e612.zip
Merge branch 'mesh_shader_fix' of https://github.com/azhirnov/DiligentCore into azhirnov-mesh_shader_fix
Diffstat (limited to 'Graphics/GraphicsEngine')
-rw-r--r--Graphics/GraphicsEngine/include/PipelineStateBase.hpp6
-rw-r--r--Graphics/GraphicsEngine/include/ShaderBase.hpp3
-rw-r--r--Graphics/GraphicsEngine/interface/Constants.h4
3 files changed, 10 insertions, 3 deletions
diff --git a/Graphics/GraphicsEngine/include/PipelineStateBase.hpp b/Graphics/GraphicsEngine/include/PipelineStateBase.hpp
index 02a74f85..4d2e408f 100644
--- a/Graphics/GraphicsEngine/include/PipelineStateBase.hpp
+++ b/Graphics/GraphicsEngine/include/PipelineStateBase.hpp
@@ -406,7 +406,7 @@ public:
IShader* GetHS() { return m_pHS; }
IShader* GetCS() { return m_pCS; }
- IShader* const* GetShaders() const { return m_ppShaders; }
+ IShader* const* GetShaders() const { return m_ppShaders.data(); }
Uint32 GetNumShaders() const { return m_NumShaders; }
template <typename ShaderType>
@@ -447,8 +447,8 @@ protected:
RefCntAutoPtr<IRenderPass> m_pRenderPass; ///< Strong reference to the render pass object
- IShader* m_ppShaders[MAX_SHADERS_IN_PIPELINE] = {}; ///< Array of pointers to the shaders used by this PSO
- size_t m_ShaderResourceLayoutHash = 0; ///< Hash computed from the shader resource layout
+ std::array<IShader*, MAX_SHADERS_IN_PIPELINE> m_ppShaders = {}; ///< Array of pointers to the shaders used by this PSO
+ 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 ", GetPipelineTypeString(this->m_Desc.PipelineType), " PSO '", this->m_Desc.Name, "' is invalid: ", ##__VA_ARGS__)
diff --git a/Graphics/GraphicsEngine/include/ShaderBase.hpp b/Graphics/GraphicsEngine/include/ShaderBase.hpp
index 5b39da79..3beaa9c8 100644
--- a/Graphics/GraphicsEngine/include/ShaderBase.hpp
+++ b/Graphics/GraphicsEngine/include/ShaderBase.hpp
@@ -38,10 +38,13 @@
#include "PlatformMisc.hpp"
#include "EngineMemory.h"
#include "Align.hpp"
+#include "Constants.h"
namespace Diligent
{
+static_assert((1u << (NUM_SHADER_TYPES - 1)) == SHADER_TYPE_LAST, "check shader type enum or shader count");
+
inline SHADER_TYPE GetShaderTypeFromIndex(Int32 Index)
{
return static_cast<SHADER_TYPE>(1 << Index);
diff --git a/Graphics/GraphicsEngine/interface/Constants.h b/Graphics/GraphicsEngine/interface/Constants.h
index dfd17c45..419d6862 100644
--- a/Graphics/GraphicsEngine/interface/Constants.h
+++ b/Graphics/GraphicsEngine/interface/Constants.h
@@ -51,8 +51,12 @@ static const Uint32 MAX_RENDER_TARGETS = DILIGENT_MAX_RENDER_TARGETS;
static const Uint32 MAX_VIEWPORTS = DILIGENT_MAX_VIEWPORTS;
/// Maximum number of shader stages in a pipeline.
+/// (Vertex, Pixel, Geometry, Domain, Hull) or (Amplification, Mesh, Pixel)
static const Uint32 MAX_SHADERS_IN_PIPELINE = 5;
+///// Number of different shader types (Vertex, Pixel, Geometry, Domain, Hull, Compute, Amplification, Mesh)
+static const Uint32 NUM_SHADER_TYPES = 8;
+
// clang-format on
DILIGENT_END_NAMESPACE // namespace Diligent