From 78fa6c94992a6d1a140da1354448a004e62c9683 Mon Sep 17 00:00:00 2001 From: azhirnov Date: Sat, 6 Feb 2021 00:35:37 +0300 Subject: merged with resource_signature --- .../GraphicsEngine/include/PipelineResourceSignatureBase.hpp | 2 -- Graphics/GraphicsEngine/interface/GraphicsTypes.h | 11 +++++++++-- Graphics/GraphicsEngine/interface/PipelineResourceSignature.h | 5 ++++- Graphics/GraphicsEngine/interface/PipelineState.h | 7 +++++-- 4 files changed, 18 insertions(+), 7 deletions(-) (limited to 'Graphics/GraphicsEngine') diff --git a/Graphics/GraphicsEngine/include/PipelineResourceSignatureBase.hpp b/Graphics/GraphicsEngine/include/PipelineResourceSignatureBase.hpp index c0cd6b94..913418fa 100644 --- a/Graphics/GraphicsEngine/include/PipelineResourceSignatureBase.hpp +++ b/Graphics/GraphicsEngine/include/PipelineResourceSignatureBase.hpp @@ -101,8 +101,6 @@ public: return std::pair{m_ResourceOffsets[VarType], m_ResourceOffsets[VarType + 1]}; } - SHADER_TYPE GetActiveShaderStages() const { return m_ShaderStages; } - // Returns the number of shader stages that have resources. Uint32 GetNumActiveShaderStages() const { return m_NumShaderStages; } diff --git a/Graphics/GraphicsEngine/interface/GraphicsTypes.h b/Graphics/GraphicsEngine/interface/GraphicsTypes.h index 57c484db..fff9ca2a 100644 --- a/Graphics/GraphicsEngine/interface/GraphicsTypes.h +++ b/Graphics/GraphicsEngine/interface/GraphicsTypes.h @@ -1644,6 +1644,12 @@ struct DeviceFeatures /// Indicates if device supports reading 8-bit types from uniform buffers. DEVICE_FEATURE_STATE UniformBuffer8BitAccess DEFAULT_INITIALIZER(DEVICE_FEATURE_STATE_DISABLED); + /// Indicates if device supports runtime-sized arrays in shader. + /// DirectX 12 backend already supports this feature, + /// Vulkan backend has optional support, + /// other backends are does not support this feature. + DEVICE_FEATURE_STATE ShaderResourceRuntimeArray DEFAULT_INITIALIZER(DEVICE_FEATURE_STATE_DISABLED); + #if DILIGENT_CPP_INTERFACE DeviceFeatures() noexcept {} @@ -1680,10 +1686,11 @@ struct DeviceFeatures ShaderInputOutput16 {State}, ShaderInt8 {State}, ResourceBuffer8BitAccess {State}, - UniformBuffer8BitAccess {State} + UniformBuffer8BitAccess {State}, + ShaderResourceRuntimeArray {State} { # if defined(_MSC_VER) && defined(_WIN64) - static_assert(sizeof(*this) == 32, "Did you add a new feature to DeviceFeatures? Please handle its status above."); + static_assert(sizeof(*this) == 33, "Did you add a new feature to DeviceFeatures? Please handle its status above."); # endif } #endif diff --git a/Graphics/GraphicsEngine/interface/PipelineResourceSignature.h b/Graphics/GraphicsEngine/interface/PipelineResourceSignature.h index 3b6e66c9..a501a27c 100644 --- a/Graphics/GraphicsEngine/interface/PipelineResourceSignature.h +++ b/Graphics/GraphicsEngine/interface/PipelineResourceSignature.h @@ -108,7 +108,10 @@ DILIGENT_TYPED_ENUM(PIPELINE_RESOURCE_FLAGS, Uint8) /// PIPELINE_RESOURCE_FLAG_FORMATTED_BUFFER flag. PIPELINE_RESOURCE_FLAG_FORMATTED_BUFFER = 0x04, - PIPELINE_RESOURCE_FLAG_LAST = PIPELINE_RESOURCE_FLAG_FORMATTED_BUFFER + /// DirectX 12 only - runtime sized array must be in separate space. + PIPELINE_RESOURCE_FLAG_RUNTIME_ARRAY = 0x08, + + PIPELINE_RESOURCE_FLAG_LAST = PIPELINE_RESOURCE_FLAG_RUNTIME_ARRAY }; DEFINE_FLAG_ENUM_OPERATORS(PIPELINE_RESOURCE_FLAGS); diff --git a/Graphics/GraphicsEngine/interface/PipelineState.h b/Graphics/GraphicsEngine/interface/PipelineState.h index 90f54ebc..dedeee9a 100644 --- a/Graphics/GraphicsEngine/interface/PipelineState.h +++ b/Graphics/GraphicsEngine/interface/PipelineState.h @@ -462,7 +462,7 @@ struct RayTracingPipelineStateCreateInfo DILIGENT_DERIVE(PipelineStateCreateInfo /// Direct3D12 only: the name of the constant buffer that will be used by the local root signature. /// Ignored if RayTracingPipelineDesc::ShaderRecordSize is zero. - /// In Vulkan backend in HLSL add [[vk::shader_record_nv]] attribute to the constant buffer, in GLSL add shaderRecord layout to buffer. + /// In Vulkan backend in HLSL add [[vk::shader_record_ext]] attribute to the constant buffer, in GLSL add shaderRecord layout to buffer. const char* pShaderRecordName DEFAULT_INITIALIZER(nullptr); /// Direct3D12 only: the maximum hit shader attribute size in bytes. @@ -579,7 +579,6 @@ DILIGENT_BEGIN_INTERFACE(IPipelineState, IDeviceObject) /// Checks if this pipeline state object is compatible with another PSO - // Deprecated: use IsCompatibleWith() for pipeline resource signature. /// If two pipeline state objects are compatible, they can use shader resource binding /// objects interchangebly, i.e. SRBs created by one PSO can be committed @@ -593,6 +592,10 @@ DILIGENT_BEGIN_INTERFACE(IPipelineState, IDeviceObject) /// to commit resources for the second pipeline, a runtime error will occur.\n /// The function only checks compatibility of shader resource layouts. It does not take /// into account vertex shader input layout, number of outputs, etc. + /// + /// \remarks On Vulkan backend PSO may be partially compatible, on other backends this behavior is emulated. + /// For Vulkan changing PSO between totally or partially compatible may increase performance, + /// for DirectX 12 only changing PSO between compatible may increase performance. VIRTUAL bool METHOD(IsCompatibleWith)(THIS_ const struct IPipelineState* pPSO) CONST PURE; -- cgit v1.2.3