Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Graphics/GraphicsEngine/interface/APIInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
/// \file
/// Diligent API information

#define DILIGENT_API_VERSION 256017
#define DILIGENT_API_VERSION 256018

#include "../../../Primitives/interface/BasicTypes.h"

Expand Down
13 changes: 11 additions & 2 deletions Graphics/GraphicsEngine/interface/GraphicsTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -1867,6 +1867,13 @@ struct DeviceFeatures
/// Not supported by D3D11, D3D12, OpenGL, or Metal backends.
DEVICE_FEATURE_STATE SpecializationConstants DEFAULT_INITIALIZER(DEVICE_FEATURE_STATE_DISABLED);

/// Indicates if device supports native 64-bit float operations.
DEVICE_FEATURE_STATE ShaderFloat64 DEFAULT_INITIALIZER(DEVICE_FEATURE_STATE_DISABLED);

/// Indicates if device supports access to barycentric coordinates in the shaders
/// during the rasterization phase.
DEVICE_FEATURE_STATE ShaderBarycentrics DEFAULT_INITIALIZER(DEVICE_FEATURE_STATE_DISABLED);

#if DILIGENT_CPP_INTERFACE
constexpr DeviceFeatures() noexcept {}

Expand Down Expand Up @@ -1918,11 +1925,13 @@ struct DeviceFeatures
Handler(NativeMultiDraw) \
Handler(AsyncShaderCompilation) \
Handler(FormattedBuffers) \
Handler(SpecializationConstants)
Handler(SpecializationConstants) \
Handler(ShaderFloat64) \
Handler(ShaderBarycentrics)

explicit constexpr DeviceFeatures(DEVICE_FEATURE_STATE State) noexcept
{
static_assert(sizeof(*this) == 48, "Did you add a new feature to DeviceFeatures? Please add it to ENUMERATE_DEVICE_FEATURES.");
static_assert(sizeof(*this) == 50, "Did you add a new feature to DeviceFeatures? Please add it to ENUMERATE_DEVICE_FEATURES.");
#define INIT_FEATURE(Feature) Feature = State;
ENUMERATE_DEVICE_FEATURES(INIT_FEATURE)
#undef INIT_FEATURE
Expand Down
4 changes: 3 additions & 1 deletion Graphics/GraphicsEngine/src/RenderDeviceBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,11 @@ DeviceFeatures EnableDeviceFeatures(const DeviceFeatures& SupportedFeatures,
ENABLE_FEATURE(AsyncShaderCompilation, "Async shader compilation is");
ENABLE_FEATURE(FormattedBuffers, "Formatted buffers are");
ENABLE_FEATURE(SpecializationConstants, "Specialization constants are");
ENABLE_FEATURE(ShaderFloat64, "64-bit float shader operations are");
ENABLE_FEATURE(ShaderBarycentrics, "Shader barycentrics are");
// clang-format on

ASSERT_SIZEOF(DeviceFeatures, 48, "Did you add a new feature to DeviceFeatures? Please handle its status here (if necessary).");
ASSERT_SIZEOF(DeviceFeatures, 50, "Did you add a new feature to DeviceFeatures? Please handle its status here (if necessary).");

return EnabledFeatures;
}
Expand Down
10 changes: 9 additions & 1 deletion Graphics/GraphicsEngineD3D11/src/EngineFactoryD3D11.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,15 @@ GraphicsAdapterInfo EngineFactoryD3D11Impl::GetGraphicsAdapterInfo(void*
Features.ShaderFloat16 = ShaderFloat16Supported ? DEVICE_FEATURE_STATE_ENABLED : DEVICE_FEATURE_STATE_DISABLED;
}

ASSERT_SIZEOF(Features, 48, "Did you add a new feature to DeviceFeatures? Please handle its status here.");
{
D3D11_FEATURE_DATA_DOUBLES d3d11Doubles{};
if (SUCCEEDED(pd3d11Device->CheckFeatureSupport(D3D11_FEATURE_DOUBLES, &d3d11Doubles, sizeof(d3d11Doubles))))
{
Features.ShaderFloat64 = (d3d11Doubles.DoublePrecisionFloatShaderOps != FALSE) ? DEVICE_FEATURE_STATE_ENABLED : DEVICE_FEATURE_STATE_DISABLED;
}
}

ASSERT_SIZEOF(Features, 50, "Did you add a new feature to DeviceFeatures? Please handle its status here.");

// Texture properties
{
Expand Down
10 changes: 9 additions & 1 deletion Graphics/GraphicsEngineD3D12/src/EngineFactoryD3D12.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -905,6 +905,11 @@ GraphicsAdapterInfo EngineFactoryD3D12Impl::GetGraphicsAdapterInfo(void*

ASSERT_SIZEOF(SparseRes, 32, "Did you add a new member to SparseResourceProperties? Please initialize it here.");
}

if (d3d12Features.DoublePrecisionFloatShaderOps != FALSE)
{
Features.ShaderFloat64 = DEVICE_FEATURE_STATE_ENABLED;
}
}

D3D12_FEATURE_DATA_D3D12_OPTIONS1 d3d12Features1 = {};
Expand All @@ -931,6 +936,9 @@ GraphicsAdapterInfo EngineFactoryD3D12Impl::GetGraphicsAdapterInfo(void*
{
if (d3d12Features3.CopyQueueTimestampQueriesSupported)
Features.TransferQueueTimestampQueries = DEVICE_FEATURE_STATE_ENABLED;

if (d3d12Features3.BarycentricsSupported)
Features.ShaderBarycentrics = DEVICE_FEATURE_STATE_ENABLED;
}

D3D12_FEATURE_DATA_D3D12_OPTIONS4 d3d12Features4{};
Expand Down Expand Up @@ -1108,7 +1116,7 @@ GraphicsAdapterInfo EngineFactoryD3D12Impl::GetGraphicsAdapterInfo(void*
ASSERT_SIZEOF(DrawCommandProps, 12, "Did you add a new member to DrawCommandProperties? Please initialize it here.");
}

ASSERT_SIZEOF(DeviceFeatures, 48, "Did you add a new feature to DeviceFeatures? Please handle its status here.");
ASSERT_SIZEOF(DeviceFeatures, 50, "Did you add a new feature to DeviceFeatures? Please handle its status here.");

return AdapterInfo;
}
Expand Down
6 changes: 5 additions & 1 deletion Graphics/GraphicsEngineOpenGL/src/RenderDeviceGLImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -903,6 +903,8 @@ void RenderDeviceGLImpl::InitAdapterInfo()
ENABLE_FEATURE(NativeMultiDraw, IsGL46OrAbove || CheckExtension("GL_ARB_shader_draw_parameters")); // Requirements for gl_DrawID
ENABLE_FEATURE(AsyncShaderCompilation, CheckExtension("GL_KHR_parallel_shader_compile"));
ENABLE_FEATURE(FormattedBuffers, IsGL40OrAbove);
ENABLE_FEATURE(ShaderFloat64, CheckExtension("GL_EXT_shader_explicit_arithmetic_types_float64"));
ENABLE_FEATURE(ShaderBarycentrics, CheckExtension("GL_EXT_fragment_shader_barycentric") || CheckExtension("GL_NV_fragment_shader_barycentric"));
// clang-format on

TexProps.MaxTexture1DDimension = MaxTextureSize;
Expand Down Expand Up @@ -984,6 +986,8 @@ void RenderDeviceGLImpl::InitAdapterInfo()
ENABLE_FEATURE(NativeMultiDraw, strstr(Extensions, "multi_draw"));
ENABLE_FEATURE(AsyncShaderCompilation, strstr(Extensions, "parallel_shader_compile"));
ENABLE_FEATURE(FormattedBuffers, IsGLES32OrAbove);
ENABLE_FEATURE(ShaderFloat64, strstr(Extensions, "shader_explicit_arithmetic_types_float64"));
ENABLE_FEATURE(ShaderBarycentrics, strstr(Extensions, "fragment_shader_barycentric"));
// clang-format on

TexProps.MaxTexture1DDimension = 0; // Not supported in GLES 3.2
Expand Down Expand Up @@ -1161,7 +1165,7 @@ void RenderDeviceGLImpl::InitAdapterInfo()
m_AdapterInfo.Queues[0].TextureCopyGranularity[2] = 1;
}

ASSERT_SIZEOF(DeviceFeatures, 48, "Did you add a new feature to DeviceFeatures? Please handle its status here.");
ASSERT_SIZEOF(DeviceFeatures, 50, "Did you add a new feature to DeviceFeatures? Please handle its status here.");
}

void RenderDeviceGLImpl::FlagSupportedTexFormats()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,27 +48,28 @@ class PhysicalDevice

struct ExtensionFeatures
{
VkPhysicalDeviceMeshShaderFeaturesEXT MeshShader = {};
VkPhysicalDevice16BitStorageFeaturesKHR Storage16Bit = {};
VkPhysicalDevice8BitStorageFeaturesKHR Storage8Bit = {};
VkPhysicalDeviceShaderFloat16Int8FeaturesKHR ShaderFloat16Int8 = {};
VkPhysicalDeviceAccelerationStructureFeaturesKHR AccelStruct = {};
VkPhysicalDeviceRayTracingPipelineFeaturesKHR RayTracingPipeline = {};
VkPhysicalDeviceRayQueryFeaturesKHR RayQuery = {};
VkPhysicalDeviceBufferDeviceAddressFeaturesKHR BufferDeviceAddress = {};
VkPhysicalDeviceDescriptorIndexingFeaturesEXT DescriptorIndexing = {};
VkPhysicalDevicePortabilitySubsetFeaturesKHR PortabilitySubset = {};
VkPhysicalDeviceVertexAttributeDivisorFeaturesEXT VertexAttributeDivisor = {};
VkPhysicalDeviceTimelineSemaphoreFeaturesKHR TimelineSemaphore = {};
VkPhysicalDeviceHostQueryResetFeatures HostQueryReset = {};
VkPhysicalDeviceFragmentShadingRateFeaturesKHR ShadingRate = {};
VkPhysicalDeviceFragmentDensityMapFeaturesEXT FragmentDensityMap = {}; // Only for desktop devices
VkPhysicalDeviceFragmentDensityMap2FeaturesEXT FragmentDensityMap2 = {}; // Only for mobile devices
VkPhysicalDeviceMultiviewFeaturesKHR Multiview = {}; // Required for RenderPass2
VkPhysicalDeviceMultiDrawFeaturesEXT MultiDraw = {};
VkPhysicalDeviceShaderDrawParametersFeatures ShaderDrawParameters = {};
VkPhysicalDeviceDynamicRenderingFeaturesKHR DynamicRendering = {};
VkPhysicalDeviceHostImageCopyFeaturesEXT HostImageCopy = {};
VkPhysicalDeviceMeshShaderFeaturesEXT MeshShader = {};
VkPhysicalDevice16BitStorageFeaturesKHR Storage16Bit = {};
VkPhysicalDevice8BitStorageFeaturesKHR Storage8Bit = {};
VkPhysicalDeviceShaderFloat16Int8FeaturesKHR ShaderFloat16Int8 = {};
VkPhysicalDeviceAccelerationStructureFeaturesKHR AccelStruct = {};
VkPhysicalDeviceRayTracingPipelineFeaturesKHR RayTracingPipeline = {};
VkPhysicalDeviceRayQueryFeaturesKHR RayQuery = {};
VkPhysicalDeviceBufferDeviceAddressFeaturesKHR BufferDeviceAddress = {};
VkPhysicalDeviceDescriptorIndexingFeaturesEXT DescriptorIndexing = {};
VkPhysicalDevicePortabilitySubsetFeaturesKHR PortabilitySubset = {};
VkPhysicalDeviceVertexAttributeDivisorFeaturesEXT VertexAttributeDivisor = {};
VkPhysicalDeviceTimelineSemaphoreFeaturesKHR TimelineSemaphore = {};
VkPhysicalDeviceHostQueryResetFeatures HostQueryReset = {};
VkPhysicalDeviceFragmentShadingRateFeaturesKHR ShadingRate = {};
VkPhysicalDeviceFragmentDensityMapFeaturesEXT FragmentDensityMap = {}; // Only for desktop devices
VkPhysicalDeviceFragmentDensityMap2FeaturesEXT FragmentDensityMap2 = {}; // Only for mobile devices
VkPhysicalDeviceMultiviewFeaturesKHR Multiview = {}; // Required for RenderPass2
VkPhysicalDeviceMultiDrawFeaturesEXT MultiDraw = {};
VkPhysicalDeviceShaderDrawParametersFeatures ShaderDrawParameters = {};
VkPhysicalDeviceDynamicRenderingFeaturesKHR DynamicRendering = {};
VkPhysicalDeviceHostImageCopyFeaturesEXT HostImageCopy = {};
VkPhysicalDeviceFragmentShaderBarycentricFeaturesKHR FragmentShaderBarycentric = {};


bool Spirv14 = false; // Ray tracing requires Vulkan 1.2 or SPIRV 1.4 extension
Expand All @@ -81,21 +82,22 @@ class PhysicalDevice

struct ExtensionProperties
{
VkPhysicalDeviceMeshShaderPropertiesEXT MeshShader = {};
VkPhysicalDeviceAccelerationStructurePropertiesKHR AccelStruct = {};
VkPhysicalDeviceRayTracingPipelinePropertiesKHR RayTracingPipeline = {};
VkPhysicalDeviceDescriptorIndexingPropertiesEXT DescriptorIndexing = {};
VkPhysicalDevicePortabilitySubsetPropertiesKHR PortabilitySubset = {};
VkPhysicalDeviceSubgroupProperties Subgroup = {};
VkPhysicalDeviceVertexAttributeDivisorPropertiesEXT VertexAttributeDivisor = {};
VkPhysicalDeviceTimelineSemaphorePropertiesKHR TimelineSemaphore = {};
VkPhysicalDeviceFragmentShadingRatePropertiesKHR ShadingRate = {};
VkPhysicalDeviceFragmentDensityMapPropertiesEXT FragmentDensityMap = {};
VkPhysicalDeviceMultiviewPropertiesKHR Multiview = {};
VkPhysicalDeviceMaintenance3Properties Maintenance3 = {};
VkPhysicalDeviceFragmentDensityMap2PropertiesEXT FragmentDensityMap2 = {};
VkPhysicalDeviceMultiDrawPropertiesEXT MultiDraw = {};
VkPhysicalDeviceHostImageCopyPropertiesEXT HostImageCopy = {};
VkPhysicalDeviceMeshShaderPropertiesEXT MeshShader = {};
VkPhysicalDeviceAccelerationStructurePropertiesKHR AccelStruct = {};
VkPhysicalDeviceRayTracingPipelinePropertiesKHR RayTracingPipeline = {};
VkPhysicalDeviceDescriptorIndexingPropertiesEXT DescriptorIndexing = {};
VkPhysicalDevicePortabilitySubsetPropertiesKHR PortabilitySubset = {};
VkPhysicalDeviceSubgroupProperties Subgroup = {};
VkPhysicalDeviceVertexAttributeDivisorPropertiesEXT VertexAttributeDivisor = {};
VkPhysicalDeviceTimelineSemaphorePropertiesKHR TimelineSemaphore = {};
VkPhysicalDeviceFragmentShadingRatePropertiesKHR ShadingRate = {};
VkPhysicalDeviceFragmentDensityMapPropertiesEXT FragmentDensityMap = {};
VkPhysicalDeviceMultiviewPropertiesKHR Multiview = {};
VkPhysicalDeviceMaintenance3Properties Maintenance3 = {};
VkPhysicalDeviceFragmentDensityMap2PropertiesEXT FragmentDensityMap2 = {};
VkPhysicalDeviceMultiDrawPropertiesEXT MultiDraw = {};
VkPhysicalDeviceHostImageCopyPropertiesEXT HostImageCopy = {};
VkPhysicalDeviceFragmentShaderBarycentricPropertiesKHR FragmentShaderBarycentric = {};

std::unique_ptr<VkImageLayout[]> HostImageCopyLayouts;
};
Expand Down
14 changes: 13 additions & 1 deletion Graphics/GraphicsEngineVulkan/src/EngineFactoryVk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -881,6 +881,7 @@ void EngineFactoryVkImpl::CreateDeviceAndContextsVk(const EngineVkCreateInfo& En
ENABLE_VKFEATURE(vertexPipelineStoresAndAtomics, EnabledFeatures.VertexPipelineUAVWritesAndAtomics);
ENABLE_VKFEATURE(fragmentStoresAndAtomics, EnabledFeatures.PixelUAVWritesAndAtomics);
ENABLE_VKFEATURE(shaderStorageImageExtendedFormats, EnabledFeatures.TextureUAVExtendedFormats);
ENABLE_VKFEATURE(shaderFloat64, EnabledFeatures.ShaderFloat64);
// clang-format on
#undef ENABLE_VKFEATURE

Expand Down Expand Up @@ -1248,6 +1249,17 @@ void EngineFactoryVkImpl::CreateDeviceAndContextsVk(const EngineVkCreateInfo& En
NextExt = &EnabledExtFeats.ShaderDrawParameters.pNext;
}

if (EnabledFeatures.ShaderBarycentrics != DEVICE_FEATURE_STATE_DISABLED)
{
VERIFY_EXPR(PhysicalDevice->IsExtensionSupported(VK_KHR_FRAGMENT_SHADER_BARYCENTRIC_EXTENSION_NAME));
DeviceExtensions.push_back(VK_KHR_FRAGMENT_SHADER_BARYCENTRIC_EXTENSION_NAME);

EnabledExtFeats.FragmentShaderBarycentric = DeviceExtFeatures.FragmentShaderBarycentric;

*NextExt = &EnabledExtFeats.FragmentShaderBarycentric;
NextExt = &EnabledExtFeats.FragmentShaderBarycentric.pNext;
}

if (EnabledFeaturesVk.DynamicRendering)
{
VERIFY_EXPR(PhysicalDevice->IsExtensionSupported(VK_KHR_DYNAMIC_RENDERING_EXTENSION_NAME));
Expand Down Expand Up @@ -1308,7 +1320,7 @@ void EngineFactoryVkImpl::CreateDeviceAndContextsVk(const EngineVkCreateInfo& En
}
}

ASSERT_SIZEOF(DeviceFeatures, 48, "Did you add a new feature to DeviceFeatures? Please handle its status here.");
ASSERT_SIZEOF(DeviceFeatures, 50, "Did you add a new feature to DeviceFeatures? Please handle its status here.");

for (Uint32 i = 0; i < EngineCI.DeviceExtensionCount; ++i)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1991,6 +1991,7 @@ DeviceFeatures VkFeaturesToDeviceFeatures(uint32_t
INIT_FEATURE(PixelUAVWritesAndAtomics, vkFeatures.fragmentStoresAndAtomics);
INIT_FEATURE(TextureUAVExtendedFormats, vkFeatures.shaderStorageImageExtendedFormats);
INIT_FEATURE(SparseResources, vkFeatures.sparseBinding && (vkFeatures.sparseResidencyBuffer || vkFeatures.sparseResidencyImage2D)); // requires support for resident resources
INIT_FEATURE(ShaderFloat64, vkFeatures.shaderFloat64);
// clang-format on

const VkPhysicalDeviceMeshShaderFeaturesEXT& MeshShaderFeats = ExtFeatures.MeshShader;
Expand Down Expand Up @@ -2060,9 +2061,12 @@ DeviceFeatures VkFeaturesToDeviceFeatures(uint32_t
INIT_FEATURE(NativeMultiDraw,
ExtFeatures.MultiDraw.multiDraw != VK_FALSE && ExtFeatures.ShaderDrawParameters.shaderDrawParameters != VK_FALSE);

INIT_FEATURE(ShaderBarycentrics, ExtFeatures.FragmentShaderBarycentric.fragmentShaderBarycentric != VK_FALSE);
// clang-format on

#undef INIT_FEATURE

ASSERT_SIZEOF(DeviceFeatures, 48, "Did you add a new feature to DeviceFeatures? Please handle its status here (if necessary).");
ASSERT_SIZEOF(DeviceFeatures, 50, "Did you add a new feature to DeviceFeatures? Please handle its status here (if necessary).");

return Features;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,14 @@ PhysicalDevice::PhysicalDevice(const CreateInfo& CI) :
m_ExtFeatures.DynamicRendering.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DYNAMIC_RENDERING_FEATURES_KHR;
}

if (IsExtensionSupported(VK_KHR_FRAGMENT_SHADER_BARYCENTRIC_EXTENSION_NAME))
{
*NextFeat = &m_ExtFeatures.FragmentShaderBarycentric;
NextFeat = &m_ExtFeatures.FragmentShaderBarycentric.pNext;

m_ExtFeatures.FragmentShaderBarycentric.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_SHADER_BARYCENTRIC_FEATURES_KHR;
}

const bool HostImageCopySupported = IsExtensionSupported(VK_EXT_HOST_IMAGE_COPY_EXTENSION_NAME);
if (HostImageCopySupported)
{
Expand Down