diff options
| author | assiduous <assiduous@diligentgraphics.com> | 2020-09-08 05:00:23 +0000 |
|---|---|---|
| committer | assiduous <assiduous@diligentgraphics.com> | 2020-09-09 16:18:08 +0000 |
| commit | 90a707ecb5d7985c261faf1903e849548c046b02 (patch) | |
| tree | 0d853d782deae54ce7a41924c50b432ac7aa464a /Graphics/GraphicsEngine | |
| parent | Added DILIGENT_NO_FORMAT_VALIDATION cmake option (diff) | |
| download | DiligentCore-90a707ecb5d7985c261faf1903e849548c046b02.tar.gz DiligentCore-90a707ecb5d7985c261faf1903e849548c046b02.zip | |
A bunch of random updates
Diffstat (limited to 'Graphics/GraphicsEngine')
| -rw-r--r-- | Graphics/GraphicsEngine/include/PipelineStateBase.hpp | 17 | ||||
| -rw-r--r-- | Graphics/GraphicsEngine/include/ShaderBase.hpp | 1 | ||||
| -rw-r--r-- | Graphics/GraphicsEngine/interface/DeviceCaps.h | 6 | ||||
| -rw-r--r-- | Graphics/GraphicsEngine/interface/DeviceContext.h | 19 | ||||
| -rw-r--r-- | Graphics/GraphicsEngine/interface/GraphicsTypes.h | 7 | ||||
| -rw-r--r-- | Graphics/GraphicsEngine/interface/PipelineState.h | 16 | ||||
| -rw-r--r-- | Graphics/GraphicsEngine/interface/Shader.h | 29 |
7 files changed, 48 insertions, 47 deletions
diff --git a/Graphics/GraphicsEngine/include/PipelineStateBase.hpp b/Graphics/GraphicsEngine/include/PipelineStateBase.hpp index 48aab98b..02a74f85 100644 --- a/Graphics/GraphicsEngine/include/PipelineStateBase.hpp +++ b/Graphics/GraphicsEngine/include/PipelineStateBase.hpp @@ -191,11 +191,11 @@ public: { DEV_CHECK_ERR(GraphicsPipeline.pMS, "Mesh shader must be defined"); DEV_CHECK_ERR(!GraphicsPipeline.pVS && !GraphicsPipeline.pGS && !GraphicsPipeline.pDS && !GraphicsPipeline.pHS, - "Vertex, geometry and tessellation shaders are not supported in mesh pipeline"); + "Vertex, geometry and tessellation shaders are not supported in a mesh pipeline"); DEV_CHECK_ERR(GraphicsPipeline.InputLayout.NumElements == 0, "Input layout ignored in mesh shader"); DEV_CHECK_ERR(GraphicsPipeline.PrimitiveTopology == PRIMITIVE_TOPOLOGY_TRIANGLE_LIST || GraphicsPipeline.PrimitiveTopology == PRIMITIVE_TOPOLOGY_UNDEFINED, - "Primitive topology ignored in mesh pipeline, set it to undefined or keep default value (triangle list)"); + "Primitive topology is ignored in a mesh pipeline, set it to undefined or keep default value (triangle list)"); m_pAS = GraphicsPipeline.pAS; m_pMS = GraphicsPipeline.pMS; m_pPS = GraphicsPipeline.pPS; @@ -451,18 +451,7 @@ 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 ", 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"; - } +#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__) void ValidateDesc() const { diff --git a/Graphics/GraphicsEngine/include/ShaderBase.hpp b/Graphics/GraphicsEngine/include/ShaderBase.hpp index f3d3f6cc..17dec618 100644 --- a/Graphics/GraphicsEngine/include/ShaderBase.hpp +++ b/Graphics/GraphicsEngine/include/ShaderBase.hpp @@ -54,6 +54,7 @@ inline Int32 GetShaderTypeIndex(SHADER_TYPE Type) Int32 ShaderIndex = PlatformMisc::GetLSB(Type); #ifdef DILIGENT_DEBUG + static_assert(SHADER_TYPE_LAST == SHADER_TYPE_MESH, "Please update the switch below to handle the new shader type"); switch (Type) { // clang-format off diff --git a/Graphics/GraphicsEngine/interface/DeviceCaps.h b/Graphics/GraphicsEngine/interface/DeviceCaps.h index 104481d3..b5bb866a 100644 --- a/Graphics/GraphicsEngine/interface/DeviceCaps.h +++ b/Graphics/GraphicsEngine/interface/DeviceCaps.h @@ -121,6 +121,9 @@ struct DeviceFeatures /// Indicates if device supports tessellation Bool Tessellation DEFAULT_INITIALIZER(False); + /// Indicates if device supports mesh and amplification shaders + Bool MeshShaders DEFAULT_INITIALIZER(False); + /// Indicates if device supports bindless resources Bool BindlessResources DEFAULT_INITIALIZER(False); @@ -167,9 +170,6 @@ struct DeviceFeatures /// Specifies whether all the extended UAV texture formats are available in shader code. Bool TextureUAVExtendedFormats DEFAULT_INITIALIZER(False); - - /// Indicates if device supports mesh and amplification shaders - Bool MeshShaders DEFAULT_INITIALIZER(False); }; typedef struct DeviceFeatures DeviceFeatures; diff --git a/Graphics/GraphicsEngine/interface/DeviceContext.h b/Graphics/GraphicsEngine/interface/DeviceContext.h index ae237638..18e53478 100644 --- a/Graphics/GraphicsEngine/interface/DeviceContext.h +++ b/Graphics/GraphicsEngine/interface/DeviceContext.h @@ -281,6 +281,7 @@ struct DrawIndexedAttribs }; typedef struct DrawIndexedAttribs DrawIndexedAttribs; + /// Defines the indirect draw command attributes. /// This structure is used by IDeviceContext::DrawIndirect(). @@ -319,6 +320,7 @@ struct DrawIndirectAttribs }; typedef struct DrawIndirectAttribs DrawIndirectAttribs; + /// Defines the indexed indirect draw command attributes. /// This structure is used by IDeviceContext::DrawIndexedIndirect(). @@ -364,12 +366,13 @@ struct DrawIndexedIndirectAttribs }; typedef struct DrawIndexedIndirectAttribs DrawIndexedIndirectAttribs; + /// Defines the mesh draw command attributes. /// This structure is used by IDeviceContext::DrawMesh(). struct DrawMeshAttribs { - ///< Number of dispatched groups + /// The number of dispatched groups Uint32 ThreadGroupCount DEFAULT_INITIALIZER(1); /// Additional flags, see Diligent::DRAW_FLAGS. @@ -389,6 +392,7 @@ struct DrawMeshAttribs }; typedef struct DrawMeshAttribs DrawMeshAttribs; + /// Defines the mesh indirect draw command attributes. /// This structure is used by IDeviceContext::DrawMeshIndirect(). @@ -426,6 +430,7 @@ struct DrawMeshIndirectAttribs }; typedef struct DrawMeshIndirectAttribs DrawMeshIndirectAttribs; + /// Defines which parts of the depth-stencil buffer to clear. /// These flags are used by IDeviceContext::ClearDepthStencil(). @@ -1060,13 +1065,13 @@ DILIGENT_BEGIN_INTERFACE(IDeviceContext, IObject) IBuffer* pAttribsBuffer) PURE; - /// Executes an mesh draw command. + /// Executes a mesh draw command. /// \param [in] Attribs - Draw command attributes, see Diligent::DrawMeshAttribs for details. /// - /// \remarks For compatibility between Direct3D12 and Vulkan used only single work group dimension. - /// Also in shader numthreads and local_size attributes must use only single dimension, - /// example: '[numthreads(ThreadCount, 1, 1)]' or 'layout(local_size_x = ThreadCount) in'. + /// \remarks For compatibility between Direct3D12 and Vulkan, only a single work group dimension is used. + /// Also in the shader, 'numthreads' and 'local_size' attributes must define only the first dimension, + /// for example: '[numthreads(ThreadCount, 1, 1)]' or 'layout(local_size_x = ThreadCount) in'. VIRTUAL void METHOD(DrawMesh)(THIS_ const DrawMeshAttribs REF Attribs) PURE; @@ -1084,8 +1089,8 @@ DILIGENT_BEGIN_INTERFACE(IDeviceContext, IObject) /// Uint32 TaskCount; /// Uint32 FirstTask; /// - /// \remarks For compatibility between Direct3D12 and Vulkan and with direct call (DrawMesh) use only first element in structure, - /// example: Direct3D12 {TaskCount, 1, 1}, Vulkan {TaskCount, 0}. + /// \remarks For compatibility between Direct3D12 and Vulkan and with direct call (DrawMesh) use define the first element in the structure, + /// for example: Direct3D12 {TaskCount, 1, 1}, Vulkan {TaskCount, 0}. /// /// \remarks If IndirectAttribsBufferStateTransitionMode member is Diligent::RESOURCE_STATE_TRANSITION_MODE_TRANSITION, /// the method may transition the state of the indirect draw arguments buffer. This is not a thread safe operation, diff --git a/Graphics/GraphicsEngine/interface/GraphicsTypes.h b/Graphics/GraphicsEngine/interface/GraphicsTypes.h index c6a9eb5c..40ac9671 100644 --- a/Graphics/GraphicsEngine/interface/GraphicsTypes.h +++ b/Graphics/GraphicsEngine/interface/GraphicsTypes.h @@ -1686,8 +1686,8 @@ struct EngineD3D12CreateInfo DILIGENT_DERIVE(EngineCreateInfo) #endif ; - /// Path to DirectX Shader Compiler, which required to use Shader Module 6 features. - /// By default engine will search for "dxcompiler.dll". + /// Path to DirectX Shader Compiler, which is required to use Shader Model 6.0+ features. + /// By default, the engine will search for "dxcompiler.dll". const char* pDxCompilerPath DEFAULT_INITIALIZER(nullptr); }; typedef struct EngineD3D12CreateInfo EngineD3D12CreateInfo; @@ -1828,7 +1828,8 @@ struct EngineVkCreateInfo DILIGENT_DERIVE(EngineCreateInfo) #endif ; - /// Path to DirectX Shader Compiler, which required to use Shader Module 6 features for HLSL. + /// Path to DirectX Shader Compiler, which is required to use Shader Model 6.0+ + /// features when compiling shaders from HLSL. const char* pDxCompilerPath DEFAULT_INITIALIZER(nullptr); }; typedef struct EngineVkCreateInfo EngineVkCreateInfo; diff --git a/Graphics/GraphicsEngine/interface/PipelineState.h b/Graphics/GraphicsEngine/interface/PipelineState.h index d4361fde..7fe2fbb6 100644 --- a/Graphics/GraphicsEngine/interface/PipelineState.h +++ b/Graphics/GraphicsEngine/interface/PipelineState.h @@ -189,11 +189,11 @@ struct GraphicsPipelineDesc /// Depth-stencil state description. DepthStencilStateDesc DepthStencilDesc; - /// Input layout, ignored in mesh pipeline. + /// Input layout, ignored in a mesh pipeline. InputLayoutDesc InputLayout; //D3D12_INDEX_BUFFER_STRIP_CUT_VALUE IBStripCutValue; - /// Primitive topology type, ignored in mesh pipeline. + /// Primitive topology type, ignored in a mesh pipeline. PRIMITIVE_TOPOLOGY PrimitiveTopology DEFAULT_INITIALIZER(PRIMITIVE_TOPOLOGY_TRIANGLE_LIST); /// The number of viewports used by this pipeline @@ -244,20 +244,22 @@ struct ComputePipelineDesc }; typedef struct ComputePipelineDesc ComputePipelineDesc; + /// Pipeline type DILIGENT_TYPED_ENUM(PIPELINE_TYPE, Uint8) { - /// Graphics pipeline used in IDeviceContext::Draw(), IDeviceContext::DrawIndexed(), + /// Graphics pipeline, which is used by IDeviceContext::Draw(), IDeviceContext::DrawIndexed(), /// IDeviceContext::DrawIndirect(), IDeviceContext::DrawIndexedIndirect(). PIPELINE_TYPE_GRAPHICS, - /// Compute pipeline used in IDeviceContext::DispatchCompute(), IDeviceContext::DispatchComputeIndirect(). + /// Compute pipeline, which is used by IDeviceContext::DispatchCompute(), IDeviceContext::DispatchComputeIndirect(). PIPELINE_TYPE_COMPUTE, - // Mesh pipeline used in IDeviceContext::DrawMesh(), IDeviceContext::DrawMeshIndirect(). + /// Mesh pipeline, which is used by IDeviceContext::DrawMesh(), IDeviceContext::DrawMeshIndirect(). PIPELINE_TYPE_MESH, }; + /// Pipeline state description struct PipelineStateDesc DILIGENT_DERIVE(DeviceObjectAttribs) @@ -276,10 +278,10 @@ struct PipelineStateDesc DILIGENT_DERIVE(DeviceObjectAttribs) /// Pipeline layout description PipelineResourceLayoutDesc ResourceLayout; - /// Graphics pipeline state description. This memeber is ignored if PipelineType != PIPELINE_TYPE_GRAPHICS or PIPELINE_TYPE_MESH + /// Graphics pipeline state description. This memeber is ignored if PipelineType is not PIPELINE_TYPE_GRAPHICS or PIPELINE_TYPE_MESH GraphicsPipelineDesc GraphicsPipeline; - /// Compute pipeline state description. This memeber is ignored if PipelineType != PIPELINE_TYPE_COMPUTE + /// Compute pipeline state description. This memeber is ignored if PipelineType is not PIPELINE_TYPE_COMPUTE ComputePipelineDesc ComputePipeline; #if DILIGENT_CPP_INTERFACE diff --git a/Graphics/GraphicsEngine/interface/Shader.h b/Graphics/GraphicsEngine/interface/Shader.h index a85ab726..7cffb0f1 100644 --- a/Graphics/GraphicsEngine/interface/Shader.h +++ b/Graphics/GraphicsEngine/interface/Shader.h @@ -58,7 +58,8 @@ DILIGENT_TYPED_ENUM(SHADER_TYPE, Uint32) }; DEFINE_FLAG_ENUM_OPERATORS(SHADER_TYPE); -/// Describes shader source code language + +/// Describes the shader source code language DILIGENT_TYPED_ENUM(SHADER_SOURCE_LANGUAGE, Uint32) { /// Default language (GLSL for OpenGL/OpenGLES/Vulkan devices, HLSL for Direct3D11/Direct3D12 devices) @@ -70,7 +71,7 @@ DILIGENT_TYPED_ENUM(SHADER_SOURCE_LANGUAGE, Uint32) /// The source language is GLSL SHADER_SOURCE_LANGUAGE_GLSL, - /// The source language is GLSL which should be compiled verbatim + /// The source language is GLSL that should be compiled verbatim /// By default the engine prepends GLSL shader source code with platform-specific /// definitions. For instance it adds appropriate #version directive (e.g. '#version 430 core' or @@ -80,28 +81,30 @@ DILIGENT_TYPED_ENUM(SHADER_SOURCE_LANGUAGE, Uint32) SHADER_SOURCE_LANGUAGE_GLSL_VERBATIM }; -/// Describes shader compiler + +/// Describes the shader compiler that will be used to compile the shader source code DILIGENT_TYPED_ENUM(SHADER_COMPILER, Uint32) { - /// Default compiler for specific language and API: - /// for Direct3D11 - external FXC - /// for Direct3D12 - external FXC - /// for OpenGL(ES) GLSL - native compiler - /// for OpenGL(ES) HLSL - HLSL2GLSL and native compiler - /// for Vulkan GLSL - builtin glslang - /// for Vulkan HLSL - builtin glslang (with limitted support for Shader Model 6.x) + /// Default compiler for specific language and API that is chosen as follows: + /// - Direct3D11: legacy HLSL compiler (FXC) + /// - Direct3D12: legacy HLSL compiler (FXC) + /// - OpenGL(ES) GLSL: native compiler + /// - OpenGL(ES) HLSL: HLSL2GLSL converter and native compiler + /// - Vulkan GLSL: built-in glslang + /// - Vulkan HLSL: built-in glslang (with limitted support for Shader Model 6.x) SHADER_COMPILER_DEFAULT = 0, - /// Builtin glslang compiler for GLSL and HLSL. + /// Built-in glslang compiler for GLSL and HLSL. SHADER_COMPILER_GLSLANG, - /// External HLSL compiler for Direct3D12 and Vulkan with Shader Model 6.x support. + /// Modern HLSL compiler (DXC) for Direct3D12 and Vulkan with Shader Model 6.x support. SHADER_COMPILER_DXC, - /// External HLSL compiler for Direct3D11 and Direct3D12 before Shader Model 6. + /// Legacy HLSL compiler (FXC) for Direct3D11 and Direct3D12 supporting shader models up to 5.1. SHADER_COMPILER_FXC, }; + /// Describes the flags that can be passed over to IShaderSourceInputStreamFactory::CreateInputStream2() function. DILIGENT_TYPED_ENUM(CREATE_SHADER_SOURCE_INPUT_STREAM_FLAGS, Uint32) { |
