summaryrefslogtreecommitdiffstats
path: root/Graphics
diff options
context:
space:
mode:
authorassiduous <assiduous@diligentgraphics.com>2020-10-21 01:05:02 +0000
committerassiduous <assiduous@diligentgraphics.com>2020-10-21 01:05:02 +0000
commitb9d1a84943f61d1b48ffb1847cd0b3f7b8c60fb2 (patch)
tree41fbdec950b17f7d8f833b0fa0c5be0a4a005344 /Graphics
parentImproved exception safety of SRB object creation (diff)
downloadDiligentCore-b9d1a84943f61d1b48ffb1847cd0b3f7b8c60fb2.tar.gz
DiligentCore-b9d1a84943f61d1b48ffb1847cd0b3f7b8c60fb2.zip
Added ShaderResourceQueries device feature and EngineGLCreateInfo::ForceNonSeparablePrograms parameter (API 240078)
Diffstat (limited to 'Graphics')
-rw-r--r--Graphics/GraphicsEngine/interface/APIInfo.h2
-rw-r--r--Graphics/GraphicsEngine/interface/GraphicsTypes.h19
-rw-r--r--Graphics/GraphicsEngineD3D11/src/RenderDeviceD3D11Impl.cpp2
-rw-r--r--Graphics/GraphicsEngineD3D12/src/RenderDeviceD3D12Impl.cpp2
-rw-r--r--Graphics/GraphicsEngineD3DBase/include/RenderDeviceD3DBase.hpp1
-rw-r--r--Graphics/GraphicsEngineOpenGL/src/RenderDeviceGLImpl.cpp8
-rw-r--r--Graphics/GraphicsEngineVulkan/src/EngineFactoryVk.cpp2
-rw-r--r--Graphics/GraphicsEngineVulkan/src/RenderDeviceVkImpl.cpp3
8 files changed, 30 insertions, 9 deletions
diff --git a/Graphics/GraphicsEngine/interface/APIInfo.h b/Graphics/GraphicsEngine/interface/APIInfo.h
index 327f54c7..0ecbd92b 100644
--- a/Graphics/GraphicsEngine/interface/APIInfo.h
+++ b/Graphics/GraphicsEngine/interface/APIInfo.h
@@ -30,7 +30,7 @@
/// \file
/// Diligent API information
-#define DILIGENT_API_VERSION 240077
+#define DILIGENT_API_VERSION 240078
#include "../../../Primitives/interface/BasicTypes.h"
diff --git a/Graphics/GraphicsEngine/interface/GraphicsTypes.h b/Graphics/GraphicsEngine/interface/GraphicsTypes.h
index 0f6b4b82..b05519c5 100644
--- a/Graphics/GraphicsEngine/interface/GraphicsTypes.h
+++ b/Graphics/GraphicsEngine/interface/GraphicsTypes.h
@@ -1515,6 +1515,17 @@ struct DeviceFeatures
/// Indicates if device supports separable programs
DEVICE_FEATURE_STATE SeparablePrograms DEFAULT_INITIALIZER(DEVICE_FEATURE_STATE_DISABLED);
+ /// Indicates if device supports resource queries from shader objects.
+
+ /// \ note This feature indicates if IShader::GetResourceCount() and IShader::GetResourceDesc() methods
+ /// can be used to query the list of resources of individual shader objects.
+ /// Shader variable queries from pipeline state and shader resource binding objects are always
+ /// available.
+ ///
+ /// The feature is always enabled in Direct3D11, Direct3D12 and Vulkan. It is enabled in
+ /// OpenGL when separable programs are available, and it is always disabled in Metal.
+ DEVICE_FEATURE_STATE ShaderResourceQueries DEFAULT_INITIALIZER(DEVICE_FEATURE_STATE_DISABLED);
+
/// Indicates if device supports indirect draw commands
DEVICE_FEATURE_STATE IndirectRendering DEFAULT_INITIALIZER(DEVICE_FEATURE_STATE_DISABLED);
@@ -1616,6 +1627,7 @@ struct DeviceFeatures
explicit DeviceFeatures(DEVICE_FEATURE_STATE State) noexcept :
SeparablePrograms {State},
+ ShaderResourceQueries {State},
IndirectRendering {State},
WireframeFill {State},
MultithreadedResourceCreation {State},
@@ -1647,7 +1659,7 @@ struct DeviceFeatures
UniformBuffer8BitAccess {State}
{
# if defined(_MSC_VER) && defined(_WIN64)
- static_assert(sizeof(*this) == 30, "Did you add a new feature to DeviceFeatures? Please handle its status above.");
+ static_assert(sizeof(*this) == 31, "Did you add a new feature to DeviceFeatures? Please handle its status above.");
# endif
}
#endif
@@ -1875,6 +1887,11 @@ struct EngineGLCreateInfo DILIGENT_DERIVE(EngineCreateInfo)
/// provide additional runtime checking, validation, and logging
/// functionality while possibly incurring performance penalties
bool CreateDebugContext DEFAULT_INITIALIZER(false);
+
+ /// Force using non-separable programs.
+
+ /// Setting this to true is typically needed for testing purposes only.
+ bool ForceNonSeparablePrograms DEFAULT_INITIALIZER(false);
};
typedef struct EngineGLCreateInfo EngineGLCreateInfo;
diff --git a/Graphics/GraphicsEngineD3D11/src/RenderDeviceD3D11Impl.cpp b/Graphics/GraphicsEngineD3D11/src/RenderDeviceD3D11Impl.cpp
index 94847a51..8d45e547 100644
--- a/Graphics/GraphicsEngineD3D11/src/RenderDeviceD3D11Impl.cpp
+++ b/Graphics/GraphicsEngineD3D11/src/RenderDeviceD3D11Impl.cpp
@@ -176,7 +176,7 @@ RenderDeviceD3D11Impl::RenderDeviceD3D11Impl(IReferenceCounters* pRefCo
#undef UNSUPPORTED_FEATURE
#if defined(_MSC_VER) && defined(_WIN64)
- static_assert(sizeof(DeviceFeatures) == 30, "Did you add a new feature to DeviceFeatures? Please handle its satus here.");
+ static_assert(sizeof(DeviceFeatures) == 31, "Did you add a new feature to DeviceFeatures? Please handle its satus here.");
#endif
auto& TexCaps = m_DeviceCaps.TexCaps;
diff --git a/Graphics/GraphicsEngineD3D12/src/RenderDeviceD3D12Impl.cpp b/Graphics/GraphicsEngineD3D12/src/RenderDeviceD3D12Impl.cpp
index ba91f7bc..377eb5a7 100644
--- a/Graphics/GraphicsEngineD3D12/src/RenderDeviceD3D12Impl.cpp
+++ b/Graphics/GraphicsEngineD3D12/src/RenderDeviceD3D12Impl.cpp
@@ -297,7 +297,7 @@ RenderDeviceD3D12Impl::RenderDeviceD3D12Impl(IReferenceCounters* pRefCo
#undef CHECK_REQUIRED_FEATURE
#if defined(_MSC_VER) && defined(_WIN64)
- static_assert(sizeof(DeviceFeatures) == 30, "Did you add a new feature to DeviceFeatures? Please handle its satus here.");
+ static_assert(sizeof(DeviceFeatures) == 31, "Did you add a new feature to DeviceFeatures? Please handle its satus here.");
#endif
auto& TexCaps = m_DeviceCaps.TexCaps;
diff --git a/Graphics/GraphicsEngineD3DBase/include/RenderDeviceD3DBase.hpp b/Graphics/GraphicsEngineD3DBase/include/RenderDeviceD3DBase.hpp
index 104533c9..ea4a43bb 100644
--- a/Graphics/GraphicsEngineD3DBase/include/RenderDeviceD3DBase.hpp
+++ b/Graphics/GraphicsEngineD3DBase/include/RenderDeviceD3DBase.hpp
@@ -160,6 +160,7 @@ public:
auto& Features = this->m_DeviceCaps.Features;
Features.SeparablePrograms = DEVICE_FEATURE_STATE_ENABLED;
+ Features.ShaderResourceQueries = DEVICE_FEATURE_STATE_ENABLED;
Features.IndirectRendering = DEVICE_FEATURE_STATE_ENABLED;
Features.WireframeFill = DEVICE_FEATURE_STATE_ENABLED;
Features.MultithreadedResourceCreation = DEVICE_FEATURE_STATE_ENABLED;
diff --git a/Graphics/GraphicsEngineOpenGL/src/RenderDeviceGLImpl.cpp b/Graphics/GraphicsEngineOpenGL/src/RenderDeviceGLImpl.cpp
index 7911fa47..919d5aef 100644
--- a/Graphics/GraphicsEngineOpenGL/src/RenderDeviceGLImpl.cpp
+++ b/Graphics/GraphicsEngineOpenGL/src/RenderDeviceGLImpl.cpp
@@ -336,7 +336,8 @@ RenderDeviceGLImpl::RenderDeviceGLImpl(IReferenceCounters* pRefCounters,
const bool IsGL42OrAbove = (MajorVersion >= 5) || (MajorVersion == 4 && MinorVersion >= 2);
const bool IsGL41OrAbove = (MajorVersion >= 5) || (MajorVersion == 4 && MinorVersion >= 1);
- Features.SeparablePrograms = DEVICE_FEATURE_STATE_ENABLED;
+ SET_FEATURE_STATE(SeparablePrograms, !InitAttribs.ForceNonSeparablePrograms, "Separable programs are");
+ SET_FEATURE_STATE(ShaderResourceQueries, Features.SeparablePrograms != DEVICE_FEATURE_STATE_DISABLED, "Shader resource queries are");
Features.IndirectRendering = DEVICE_FEATURE_STATE_ENABLED;
Features.WireframeFill = DEVICE_FEATURE_STATE_ENABLED;
// clang-format off
@@ -395,7 +396,8 @@ RenderDeviceGLImpl::RenderDeviceGLImpl(IReferenceCounters* pRefCounters,
bool IsGLES32OrAbove = (MajorVersion >= 4) || (MajorVersion == 3 && MinorVersion >= 2);
// clang-format off
- SET_FEATURE_STATE(SeparablePrograms, IsGLES31OrAbove || strstr(Extensions, "separate_shader_objects"), "Separable programs are");
+ SET_FEATURE_STATE(SeparablePrograms, (IsGLES31OrAbove || strstr(Extensions, "separate_shader_objects")) && !InitAttribs.ForceNonSeparablePrograms, "Separable programs are");
+ SET_FEATURE_STATE(ShaderResourceQueries, Features.SeparablePrograms != DEVICE_FEATURE_STATE_DISABLED, "Shader resource queries are");
SET_FEATURE_STATE(IndirectRendering, IsGLES31OrAbove || strstr(Extensions, "draw_indirect"), "Indirect rendering is");
SET_FEATURE_STATE(WireframeFill, false, "Wireframe fill is");
SET_FEATURE_STATE(MultithreadedResourceCreation, false, "Multithreaded resource creation is");
@@ -456,7 +458,7 @@ RenderDeviceGLImpl::RenderDeviceGLImpl(IReferenceCounters* pRefCounters,
#undef SET_FEATURE_STATE
#if defined(_MSC_VER) && defined(_WIN64)
- static_assert(sizeof(DeviceFeatures) == 30, "Did you add a new feature to DeviceFeatures? Please handle its satus here.");
+ static_assert(sizeof(DeviceFeatures) == 31, "Did you add a new feature to DeviceFeatures? Please handle its satus here.");
#endif
}
diff --git a/Graphics/GraphicsEngineVulkan/src/EngineFactoryVk.cpp b/Graphics/GraphicsEngineVulkan/src/EngineFactoryVk.cpp
index 81d6753c..cbe1779f 100644
--- a/Graphics/GraphicsEngineVulkan/src/EngineFactoryVk.cpp
+++ b/Graphics/GraphicsEngineVulkan/src/EngineFactoryVk.cpp
@@ -389,7 +389,7 @@ void EngineFactoryVkImpl::CreateDeviceAndContextsVk(const EngineVkCreateInfo& _E
#if defined(_MSC_VER) && defined(_WIN64)
- static_assert(sizeof(DeviceFeatures) == 30, "Did you add a new feature to DeviceFeatures? Please handle its satus here.");
+ static_assert(sizeof(DeviceFeatures) == 31, "Did you add a new feature to DeviceFeatures? Please handle its satus here.");
#endif
DeviceCreateInfo.ppEnabledExtensionNames = DeviceExtensions.empty() ? nullptr : DeviceExtensions.data();
diff --git a/Graphics/GraphicsEngineVulkan/src/RenderDeviceVkImpl.cpp b/Graphics/GraphicsEngineVulkan/src/RenderDeviceVkImpl.cpp
index 1441569e..ccfb74ac 100644
--- a/Graphics/GraphicsEngineVulkan/src/RenderDeviceVkImpl.cpp
+++ b/Graphics/GraphicsEngineVulkan/src/RenderDeviceVkImpl.cpp
@@ -213,6 +213,7 @@ RenderDeviceVkImpl::RenderDeviceVkImpl(IReferenceCounters*
// The following features are always enabled
Features.SeparablePrograms = DEVICE_FEATURE_STATE_ENABLED;
+ Features.ShaderResourceQueries = DEVICE_FEATURE_STATE_ENABLED;
Features.IndirectRendering = DEVICE_FEATURE_STATE_ENABLED;
Features.MultithreadedResourceCreation = DEVICE_FEATURE_STATE_ENABLED;
Features.ComputeShaders = DEVICE_FEATURE_STATE_ENABLED;
@@ -222,7 +223,7 @@ RenderDeviceVkImpl::RenderDeviceVkImpl(IReferenceCounters*
Features.DurationQueries = DEVICE_FEATURE_STATE_ENABLED;
#if defined(_MSC_VER) && defined(_WIN64)
- static_assert(sizeof(DeviceFeatures) == 30, "Did you add a new feature to DeviceFeatures? Please handle its satus here (if necessary).");
+ static_assert(sizeof(DeviceFeatures) == 31, "Did you add a new feature to DeviceFeatures? Please handle its satus here (if necessary).");
#endif
const auto& vkDeviceLimits = m_PhysicalDevice->GetProperties().limits;