diff options
| author | assiduous <assiduous@diligentgraphics.com> | 2020-01-07 04:53:34 +0000 |
|---|---|---|
| committer | assiduous <assiduous@diligentgraphics.com> | 2020-01-07 04:53:34 +0000 |
| commit | 0c99ee543ef936ef770f4b11fa77e08c2f736c1b (patch) | |
| tree | 9ca3812fd317e3366f975b74e8c67b8cb928fc89 /Graphics/GraphicsEngine | |
| parent | Added workaround for inteface type mismatch error in GS references VK (diff) | |
| download | DiligentCore-0c99ee543ef936ef770f4b11fa77e08c2f736c1b.tar.gz DiligentCore-0c99ee543ef936ef770f4b11fa77e08c2f736c1b.zip | |
Improved device feature reporting; added flags for query support
Diffstat (limited to 'Graphics/GraphicsEngine')
| -rw-r--r-- | Graphics/GraphicsEngine/include/QueryBase.h | 29 | ||||
| -rw-r--r-- | Graphics/GraphicsEngine/include/ShaderBase.h | 14 | ||||
| -rw-r--r-- | Graphics/GraphicsEngine/interface/APIInfo.h | 2 | ||||
| -rw-r--r-- | Graphics/GraphicsEngine/interface/DeviceCaps.h | 67 |
4 files changed, 85 insertions, 27 deletions
diff --git a/Graphics/GraphicsEngine/include/QueryBase.h b/Graphics/GraphicsEngine/include/QueryBase.h index 2d506ad4..f32c7455 100644 --- a/Graphics/GraphicsEngine/include/QueryBase.h +++ b/Graphics/GraphicsEngine/include/QueryBase.h @@ -67,7 +67,34 @@ public: const QueryDesc& Desc, bool bIsDeviceInternal = false) : TDeviceObjectBase{pRefCounters, pDevice, Desc, bIsDeviceInternal} - {} + { + const auto& deviceFeatures = pDevice->GetDeviceCaps().Features; + switch (Desc.Type) + { + case QUERY_TYPE_OCCLUSION: + if (!deviceFeatures.OcclusionQueries) + LOG_ERROR_AND_THROW("Occlusion queries are not supported by this device"); + break; + + case QUERY_TYPE_BINARY_OCCLUSION: + if (!deviceFeatures.BinaryOcclusionQueries) + LOG_ERROR_AND_THROW("Binary occlusion queries are not supported by this device"); + break; + + case QUERY_TYPE_TIMESTAMP: + if (!deviceFeatures.TimestampQueries) + LOG_ERROR_AND_THROW("Timestamp queries are not supported by this device"); + break; + + case QUERY_TYPE_PIPELINE_STATISTICS: + if (!deviceFeatures.PipelineStatisticsQueries) + LOG_ERROR_AND_THROW("Pipeline statistics queries are not supported by this device"); + break; + + default: + UNEXPECTED("Unexpected device type"); + } + } ~QueryBase() { diff --git a/Graphics/GraphicsEngine/include/ShaderBase.h b/Graphics/GraphicsEngine/include/ShaderBase.h index 01e6ab4f..cf99cdc0 100644 --- a/Graphics/GraphicsEngine/include/ShaderBase.h +++ b/Graphics/GraphicsEngine/include/ShaderBase.h @@ -99,9 +99,21 @@ public: /// \param ShdrDesc - shader description. /// \param bIsDeviceInternal - flag indicating if the shader is an internal device object and /// must not keep a strong reference to the device. - ShaderBase(IReferenceCounters* pRefCounters, RenderDeviceImplType* pDevice, const ShaderDesc& ShdrDesc, bool bIsDeviceInternal = false) : + ShaderBase(IReferenceCounters* pRefCounters, + RenderDeviceImplType* pDevice, + const ShaderDesc& ShdrDesc, + bool bIsDeviceInternal = false) : TDeviceObjectBase{pRefCounters, pDevice, ShdrDesc, bIsDeviceInternal} { + const auto& deviceFeatures = pDevice->GetDeviceCaps().Features; + if (ShdrDesc.ShaderType == SHADER_TYPE_GEOMETRY && !deviceFeatures.GeometryShaders) + LOG_ERROR_AND_THROW("Geometry shaders are not supported by this device"); + + if ((ShdrDesc.ShaderType == SHADER_TYPE_DOMAIN || ShdrDesc.ShaderType == SHADER_TYPE_HULL) && !deviceFeatures.Tessellation) + LOG_ERROR_AND_THROW("Tessellation shaders are not supported by this device"); + + if (ShdrDesc.ShaderType == SHADER_TYPE_COMPUTE && !deviceFeatures.ComputeShaders) + LOG_ERROR_AND_THROW("Compute shaders are not supported by this device"); } IMPLEMENT_QUERY_INTERFACE_IN_PLACE(IID_Shader, TDeviceObjectBase) diff --git a/Graphics/GraphicsEngine/interface/APIInfo.h b/Graphics/GraphicsEngine/interface/APIInfo.h index 1686e3f7..00fb32f7 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 240049 +#define DILIGENT_API_VERSION 240050 #include "../../../Primitives/interface/BasicTypes.h" diff --git a/Graphics/GraphicsEngine/interface/DeviceCaps.h b/Graphics/GraphicsEngine/interface/DeviceCaps.h index 1a433468..ebde692e 100644 --- a/Graphics/GraphicsEngine/interface/DeviceCaps.h +++ b/Graphics/GraphicsEngine/interface/DeviceCaps.h @@ -83,6 +83,46 @@ namespace Diligent Bool bCubemapArraysSupported = True; }; + /// Describes supported device features + struct DeviceFeatures + { + /// Indicates if device supports separable programs + Bool SeparablePrograms = False; + + /// Indicates if device supports indirect draw commands + Bool IndirectRendering = False; + + /// Indicates if device supports wireframe fill mode + Bool WireframeFill = False; + + /// Indicates if device supports multithreaded resource creation + Bool MultithreadedResourceCreation = False; + + /// Indicates if device supports compute shaders + Bool ComputeShaders = False; + + /// Indicates if device supports geometry shaders + Bool GeometryShaders = False; + + /// Indicates if device supports tessellation + Bool Tessellation = False; + + /// Indicates if device supports bindless resources + Bool BindlessResources = False; + + /// Indicates if device supports occlusion queries (see Diligent::QUERY_TYPE_OCCLUSION). + Bool OcclusionQueries = False; + + /// Indicates if device supports binary occlusion queries (see Diligent::QUERY_TYPE_BINARY_OCCLUSION). + Bool BinaryOcclusionQueries = False; + + /// Indicates if device supports timestamp queries (see Diligent::QUERY_TYPE_TIMESTAMP). + Bool TimestampQueries = False; + + /// Indicates if device supports timestamp queries (see Diligent::QUERY_TYPE_PIPELINE_STATISTICS). + Bool PipelineStatisticsQueries = False; + }; + /// Device capabilities struct DeviceCaps { @@ -102,36 +142,15 @@ namespace Diligent /// Adapter type. See Diligent::ADAPTER_TYPE. ADAPTER_TYPE AdaterType = ADAPTER_TYPE_UNKNOWN; - /// Indicates if device supports separable programs - Bool bSeparableProgramSupported = True; - - /// Indicates if device supports indirect draw commands - Bool bIndirectRenderingSupported = True; - - /// Indicates if device supports wireframe fill mode - Bool bWireframeFillSupported = True; - - /// Indicates if device supports multithreaded resource creation - Bool bMultithreadedResourceCreationSupported = False; - - /// Indicates if device supports compute shaders - Bool bComputeShadersSupported = True; - - /// Indicates if device supports geometry shaders - Bool bGeometryShadersSupported = True; - - /// Indicates if device supports tessellation - Bool bTessellationSupported = True; - - /// Indicates if device supports bindless resources - Bool bBindlessSupported = False; - /// Texture sampling capabilities. See Diligent::SamplerCaps. SamplerCaps SamCaps; /// Texture capabilities. See Diligent::TextureCaps. TextureCaps TexCaps; + /// Device features. See Diligent::DeviceFeatures. + DeviceFeatures Features; + bool IsGLDevice()const { return DevType == DeviceType::OpenGL || DevType == DeviceType::OpenGLES; |
