Add support for Vulkan12Properties

VkPhysicalDeviceVulkan12Properties was added to the core spec by Vulkan 1.2. It allows users to query the following properties simultaneously: * VkPhysicalDeviceDriverProperties * VkPhysicalDeviceFloatControlsProperties * VkPhysicalDeviceDescriptorIndexingProperties * VkPhysicalDeviceDepthStencilResolveProperties * VkPhysicalDeviceSamplerFilterMinmaxProperties * VkPhysicalDeviceTimelineSemaphoreProperties * and framebufferIntegerColorSampleCounts All these structs are a part of the core spec and must be supported. Bug: b/176498010 Change-Id: I82b06f219d2ee091139964ee8b19f05e1c64e3a8 Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/51408 Kokoro-Result: kokoro <noreply+kokoro@google.com> Reviewed-by: 's avatarNicolas Capens <nicolascapens@google.com> Tested-by: 's avatarSean Risser <srisser@google.com> Commit-Queue: Sean Risser <srisser@google.com>
parent 1cc5b335
...@@ -238,16 +238,8 @@ static void getPhysicalDeviceUniformBufferStandardLayoutFeatures(T *features) ...@@ -238,16 +238,8 @@ static void getPhysicalDeviceUniformBufferStandardLayoutFeatures(T *features)
} }
template<typename T> template<typename T>
static void getPhysicalDeviceVulkan12Features(T *features) static void getPhysicalDeviceDescriptorIndexingFeatures(T *features)
{ {
features->samplerMirrorClampToEdge = VK_FALSE;
features->drawIndirectCount = VK_FALSE;
getPhysicalDevice8BitStorageFeaturesKHR(features);
features->shaderBufferInt64Atomics = VK_FALSE;
features->shaderSharedInt64Atomics = VK_FALSE;
features->shaderFloat16 = VK_FALSE;
features->shaderInt8 = VK_FALSE;
features->descriptorIndexing = VK_FALSE;
features->shaderInputAttachmentArrayDynamicIndexing = VK_FALSE; features->shaderInputAttachmentArrayDynamicIndexing = VK_FALSE;
features->shaderUniformTexelBufferArrayDynamicIndexing = VK_FALSE; features->shaderUniformTexelBufferArrayDynamicIndexing = VK_FALSE;
features->shaderStorageTexelBufferArrayDynamicIndexing = VK_FALSE; features->shaderStorageTexelBufferArrayDynamicIndexing = VK_FALSE;
...@@ -267,6 +259,20 @@ static void getPhysicalDeviceVulkan12Features(T *features) ...@@ -267,6 +259,20 @@ static void getPhysicalDeviceVulkan12Features(T *features)
features->descriptorBindingPartiallyBound = VK_FALSE; features->descriptorBindingPartiallyBound = VK_FALSE;
features->descriptorBindingVariableDescriptorCount = VK_FALSE; features->descriptorBindingVariableDescriptorCount = VK_FALSE;
features->runtimeDescriptorArray = VK_FALSE; features->runtimeDescriptorArray = VK_FALSE;
}
template<typename T>
static void getPhysicalDeviceVulkan12Features(T *features)
{
features->samplerMirrorClampToEdge = VK_FALSE;
features->drawIndirectCount = VK_FALSE;
getPhysicalDevice8BitStorageFeaturesKHR(features);
features->shaderBufferInt64Atomics = VK_FALSE;
features->shaderSharedInt64Atomics = VK_FALSE;
features->shaderFloat16 = VK_FALSE;
features->shaderInt8 = VK_FALSE;
features->descriptorIndexing = VK_FALSE;
getPhysicalDeviceDescriptorIndexingFeatures(features);
features->samplerFilterMinmax = VK_FALSE; features->samplerFilterMinmax = VK_FALSE;
getPhysicalDeviceScalarBlockLayoutFeatures(features); getPhysicalDeviceScalarBlockLayoutFeatures(features);
getPhysicalDeviceImagelessFramebufferFeatures(features); getPhysicalDeviceImagelessFramebufferFeatures(features);
...@@ -714,7 +720,8 @@ void PhysicalDevice::getProperties(VkPhysicalDeviceExternalMemoryHostPropertiesE ...@@ -714,7 +720,8 @@ void PhysicalDevice::getProperties(VkPhysicalDeviceExternalMemoryHostPropertiesE
properties->minImportedHostPointerAlignment = REQUIRED_MEMORY_ALIGNMENT; properties->minImportedHostPointerAlignment = REQUIRED_MEMORY_ALIGNMENT;
} }
void PhysicalDevice::getProperties(VkPhysicalDeviceDriverPropertiesKHR *properties) const template<typename T>
static void getDriverProperties(T *properties)
{ {
properties->driverID = VK_DRIVER_ID_GOOGLE_SWIFTSHADER_KHR; properties->driverID = VK_DRIVER_ID_GOOGLE_SWIFTSHADER_KHR;
strcpy(properties->driverName, "SwiftShader driver"); strcpy(properties->driverName, "SwiftShader driver");
...@@ -722,6 +729,11 @@ void PhysicalDevice::getProperties(VkPhysicalDeviceDriverPropertiesKHR *properti ...@@ -722,6 +729,11 @@ void PhysicalDevice::getProperties(VkPhysicalDeviceDriverPropertiesKHR *properti
properties->conformanceVersion = { 1, 1, 3, 3 }; properties->conformanceVersion = { 1, 1, 3, 3 };
} }
void PhysicalDevice::getProperties(VkPhysicalDeviceDriverPropertiesKHR *properties) const
{
getDriverProperties(properties);
}
void PhysicalDevice::getProperties(VkPhysicalDeviceLineRasterizationPropertiesEXT *properties) const void PhysicalDevice::getProperties(VkPhysicalDeviceLineRasterizationPropertiesEXT *properties) const
{ {
properties->lineSubPixelPrecisionBits = vk::SUBPIXEL_PRECISION_BITS; properties->lineSubPixelPrecisionBits = vk::SUBPIXEL_PRECISION_BITS;
...@@ -732,7 +744,8 @@ void PhysicalDevice::getProperties(VkPhysicalDeviceProvokingVertexPropertiesEXT ...@@ -732,7 +744,8 @@ void PhysicalDevice::getProperties(VkPhysicalDeviceProvokingVertexPropertiesEXT
properties->provokingVertexModePerPipeline = VK_TRUE; properties->provokingVertexModePerPipeline = VK_TRUE;
} }
void PhysicalDevice::getProperties(VkPhysicalDeviceFloatControlsProperties *properties) const template<typename T>
static void getFloatControlsProperties(T *properties)
{ {
// The spec states: // The spec states:
// shaderSignedZeroInfNanPreserveFloat32 is a boolean value indicating whether // shaderSignedZeroInfNanPreserveFloat32 is a boolean value indicating whether
...@@ -764,6 +777,92 @@ void PhysicalDevice::getProperties(VkPhysicalDeviceFloatControlsProperties *prop ...@@ -764,6 +777,92 @@ void PhysicalDevice::getProperties(VkPhysicalDeviceFloatControlsProperties *prop
properties->shaderRoundingModeRTEFloat64 = VK_FALSE; properties->shaderRoundingModeRTEFloat64 = VK_FALSE;
} }
void PhysicalDevice::getProperties(VkPhysicalDeviceFloatControlsProperties *properties) const
{
getFloatControlsProperties(properties);
}
template<typename T>
static void getDescriptorIndexingProperties(T *properties)
{
properties->maxUpdateAfterBindDescriptorsInAllPools = 0;
properties->shaderUniformBufferArrayNonUniformIndexingNative = VK_FALSE;
properties->shaderSampledImageArrayNonUniformIndexingNative = VK_FALSE;
properties->shaderStorageBufferArrayNonUniformIndexingNative = VK_FALSE;
properties->shaderStorageImageArrayNonUniformIndexingNative = VK_FALSE;
properties->shaderInputAttachmentArrayNonUniformIndexingNative = VK_FALSE;
properties->robustBufferAccessUpdateAfterBind = VK_FALSE;
properties->quadDivergentImplicitLod = VK_FALSE;
properties->maxPerStageDescriptorUpdateAfterBindSamplers = 0;
properties->maxPerStageDescriptorUpdateAfterBindUniformBuffers = 0;
properties->maxPerStageDescriptorUpdateAfterBindStorageBuffers = 0;
properties->maxPerStageDescriptorUpdateAfterBindSampledImages = 0;
properties->maxPerStageDescriptorUpdateAfterBindStorageImages = 0;
properties->maxPerStageDescriptorUpdateAfterBindInputAttachments = 0;
properties->maxPerStageUpdateAfterBindResources = 0;
properties->maxDescriptorSetUpdateAfterBindSamplers = 0;
properties->maxDescriptorSetUpdateAfterBindUniformBuffers = 0;
properties->maxDescriptorSetUpdateAfterBindUniformBuffersDynamic = 0;
properties->maxDescriptorSetUpdateAfterBindStorageBuffers = 0;
properties->maxDescriptorSetUpdateAfterBindStorageBuffersDynamic = 0;
properties->maxDescriptorSetUpdateAfterBindSampledImages = 0;
properties->maxDescriptorSetUpdateAfterBindStorageImages = 0;
properties->maxDescriptorSetUpdateAfterBindInputAttachments = 0;
}
void PhysicalDevice::getProperties(VkPhysicalDeviceDescriptorIndexingProperties *properties) const
{
getDescriptorIndexingProperties(properties);
}
template<typename T>
static void getDepthStencilResolveProperties(T *properties)
{
properties->supportedDepthResolveModes = VK_RESOLVE_MODE_SAMPLE_ZERO_BIT | VK_RESOLVE_MODE_NONE;
properties->supportedStencilResolveModes = VK_RESOLVE_MODE_SAMPLE_ZERO_BIT | VK_RESOLVE_MODE_NONE;
properties->independentResolveNone = VK_FALSE;
properties->independentResolve = VK_FALSE;
}
void PhysicalDevice::getProperties(VkPhysicalDeviceDepthStencilResolveProperties *properties) const
{
getDepthStencilResolveProperties(properties);
}
template<typename T>
static void getSamplerFilterMinmaxProperties(T *properties)
{
properties->filterMinmaxSingleComponentFormats = VK_FALSE;
properties->filterMinmaxImageComponentMapping = VK_FALSE;
}
void PhysicalDevice::getProperties(VkPhysicalDeviceSamplerFilterMinmaxProperties *properties) const
{
getSamplerFilterMinmaxProperties(properties);
}
template<typename T>
static void getTimelineSemaphoreProperties(T *properties)
{
properties->maxTimelineSemaphoreValueDifference = 0x7FFFFFFFull;
}
void PhysicalDevice::getProperties(VkPhysicalDeviceTimelineSemaphoreProperties *properties) const
{
getTimelineSemaphoreProperties(properties);
}
void PhysicalDevice::getProperties(VkPhysicalDeviceVulkan12Properties *properties) const
{
getDriverProperties(properties);
getFloatControlsProperties(properties);
getDescriptorIndexingProperties(properties);
getDepthStencilResolveProperties(properties);
getSamplerFilterMinmaxProperties(properties);
getTimelineSemaphoreProperties(properties);
properties->framebufferIntegerColorSampleCounts = VK_SAMPLE_COUNT_1_BIT;
}
bool PhysicalDevice::hasFeatures(const VkPhysicalDeviceFeatures &requestedFeatures) const bool PhysicalDevice::hasFeatures(const VkPhysicalDeviceFeatures &requestedFeatures) const
{ {
const VkPhysicalDeviceFeatures &supportedFeatures = getFeatures(); const VkPhysicalDeviceFeatures &supportedFeatures = getFeatures();
......
...@@ -60,6 +60,11 @@ public: ...@@ -60,6 +60,11 @@ public:
void getProperties(VkPhysicalDeviceLineRasterizationPropertiesEXT *properties) const; void getProperties(VkPhysicalDeviceLineRasterizationPropertiesEXT *properties) const;
void getProperties(VkPhysicalDeviceProvokingVertexPropertiesEXT *properties) const; void getProperties(VkPhysicalDeviceProvokingVertexPropertiesEXT *properties) const;
void getProperties(VkPhysicalDeviceFloatControlsProperties *) const; void getProperties(VkPhysicalDeviceFloatControlsProperties *) const;
void getProperties(VkPhysicalDeviceSamplerFilterMinmaxProperties *properties) const;
void getProperties(VkPhysicalDeviceTimelineSemaphoreProperties *properties) const;
void getProperties(VkPhysicalDeviceVulkan12Properties *properties) const;
void getProperties(VkPhysicalDeviceDescriptorIndexingProperties *properties) const;
void getProperties(VkPhysicalDeviceDepthStencilResolveProperties *properties) const;
static void GetFormatProperties(Format format, VkFormatProperties *pFormatProperties); static void GetFormatProperties(Format format, VkFormatProperties *pFormatProperties);
void getImageFormatProperties(Format format, VkImageType type, VkImageTiling tiling, void getImageFormatProperties(Format format, VkImageType type, VkImageTiling tiling,
......
...@@ -2964,6 +2964,36 @@ VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceProperties2(VkPhysicalDevice physi ...@@ -2964,6 +2964,36 @@ VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceProperties2(VkPhysicalDevice physi
vk::Cast(physicalDevice)->getProperties(properties); vk::Cast(physicalDevice)->getProperties(properties);
} }
break; break;
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SAMPLER_FILTER_MINMAX_PROPERTIES:
{
auto properties = reinterpret_cast<VkPhysicalDeviceSamplerFilterMinmaxProperties *>(extensionProperties);
vk::Cast(physicalDevice)->getProperties(properties);
}
break;
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TIMELINE_SEMAPHORE_PROPERTIES:
{
auto properties = reinterpret_cast<VkPhysicalDeviceTimelineSemaphoreProperties *>(extensionProperties);
vk::Cast(physicalDevice)->getProperties(properties);
}
break;
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_2_PROPERTIES:
{
auto properties = reinterpret_cast<VkPhysicalDeviceVulkan12Properties *>(extensionProperties);
vk::Cast(physicalDevice)->getProperties(properties);
}
break;
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_INDEXING_PROPERTIES:
{
auto properties = reinterpret_cast<VkPhysicalDeviceDescriptorIndexingProperties *>(extensionProperties);
vk::Cast(physicalDevice)->getProperties(properties);
}
break;
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEPTH_STENCIL_RESOLVE_PROPERTIES:
{
auto properties = reinterpret_cast<VkPhysicalDeviceDepthStencilResolveProperties *>(extensionProperties);
vk::Cast(physicalDevice)->getProperties(properties);
}
break;
default: default:
// "the [driver] must skip over, without processing (other than reading the sType and pNext members) any structures in the chain with sType values not defined by [supported extenions]" // "the [driver] must skip over, without processing (other than reading the sType and pNext members) any structures in the chain with sType values not defined by [supported extenions]"
LOG_TRAP("pProperties->pNext sType = %s", vk::Stringify(extensionProperties->sType).c_str()); LOG_TRAP("pProperties->pNext sType = %s", vk::Stringify(extensionProperties->sType).c_str());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment