Support the VK_EXT_host_query_reset extension.
This allows clients to reset query pools on the host, instead of with a GPU command. This updates Vulkan headers to 1.1.104... but, there's a problem. This change has not been merged to `master` in the `Vulkan-Headers` repo yet, because of an issue building the C++ binding headers. Luckily, we only need the core C header.
This commit is contained in:
parent
d42d7aac79
commit
4468f36bc6
@ -247,6 +247,7 @@ In addition to the core *Vulkan* API, **MoltenVK** also supports the following
|
||||
- `VK_KHR_swapchain`
|
||||
- `VK_KHR_swapchain_mutable_format`
|
||||
- `VK_KHR_variable_pointers`
|
||||
- `VK_EXT_host_query_reset`
|
||||
- `VK_EXT_memory_budget`
|
||||
- `VK_EXT_shader_viewport_index_layer`
|
||||
- `VK_EXT_vertex_attribute_divisor`
|
||||
|
@ -1 +1 @@
|
||||
8e2c4cd554b644592a6d904f2c8000ebbd4aa77f
|
||||
ebcf66aa429eceb3360008878fe2881c7f5b2b20
|
||||
|
@ -63,61 +63,60 @@ void MVKPhysicalDevice::getFeatures(VkPhysicalDeviceFeatures2* features) {
|
||||
if (features) {
|
||||
features->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2;
|
||||
features->features = _features;
|
||||
auto* next = (MVKVkAPIStructHeader*)features->pNext;
|
||||
auto* next = (VkBaseOutStructure*)features->pNext;
|
||||
while (next) {
|
||||
switch ((uint32_t)next->sType) {
|
||||
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_16BIT_STORAGE_FEATURES: {
|
||||
auto* storageFeatures = (VkPhysicalDevice16BitStorageFeatures*)next;
|
||||
storageFeatures->storageBuffer16BitAccess = true;
|
||||
storageFeatures->uniformAndStorageBuffer16BitAccess = true;
|
||||
storageFeatures->storagePushConstant16 = true;
|
||||
storageFeatures->storageInputOutput16 = true;
|
||||
next = (MVKVkAPIStructHeader*)storageFeatures->pNext;
|
||||
break;
|
||||
}
|
||||
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_8BIT_STORAGE_FEATURES_KHR: {
|
||||
auto* storageFeatures = (VkPhysicalDevice8BitStorageFeaturesKHR*)next;
|
||||
storageFeatures->storageBuffer8BitAccess = true;
|
||||
storageFeatures->uniformAndStorageBuffer8BitAccess = true;
|
||||
storageFeatures->storagePushConstant8 = true;
|
||||
next = (MVKVkAPIStructHeader*)storageFeatures->pNext;
|
||||
break;
|
||||
}
|
||||
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FLOAT16_INT8_FEATURES_KHR: {
|
||||
auto* f16Features = (VkPhysicalDeviceFloat16Int8FeaturesKHR*)next;
|
||||
f16Features->shaderFloat16 = true;
|
||||
f16Features->shaderInt8 = true;
|
||||
next = (MVKVkAPIStructHeader*)f16Features->pNext;
|
||||
break;
|
||||
}
|
||||
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VARIABLE_POINTER_FEATURES: {
|
||||
auto* varPtrFeatures = (VkPhysicalDeviceVariablePointerFeatures*)next;
|
||||
varPtrFeatures->variablePointersStorageBuffer = true;
|
||||
varPtrFeatures->variablePointers = true;
|
||||
next = (MVKVkAPIStructHeader*)varPtrFeatures->pNext;
|
||||
break;
|
||||
}
|
||||
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VERTEX_ATTRIBUTE_DIVISOR_FEATURES_EXT: {
|
||||
auto* divisorFeatures = (VkPhysicalDeviceVertexAttributeDivisorFeaturesEXT*)next;
|
||||
divisorFeatures->vertexAttributeInstanceRateDivisor = true;
|
||||
divisorFeatures->vertexAttributeInstanceRateZeroDivisor = true;
|
||||
next = (MVKVkAPIStructHeader*)divisorFeatures->pNext;
|
||||
break;
|
||||
}
|
||||
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PORTABILITY_SUBSET_FEATURES_EXTX: {
|
||||
auto* portabilityFeatures = (VkPhysicalDevicePortabilitySubsetFeaturesEXTX*)next;
|
||||
portabilityFeatures->triangleFans = false;
|
||||
portabilityFeatures->separateStencilMaskRef = true;
|
||||
portabilityFeatures->events = false;
|
||||
portabilityFeatures->standardImageViews = _mvkInstance->getMoltenVKConfiguration()->fullImageViewSwizzle;
|
||||
portabilityFeatures->samplerMipLodBias = false;
|
||||
next = (MVKVkAPIStructHeader*)portabilityFeatures->pNext;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
next = (MVKVkAPIStructHeader*)next->pNext;
|
||||
break;
|
||||
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_16BIT_STORAGE_FEATURES: {
|
||||
auto* storageFeatures = (VkPhysicalDevice16BitStorageFeatures*)next;
|
||||
storageFeatures->storageBuffer16BitAccess = true;
|
||||
storageFeatures->uniformAndStorageBuffer16BitAccess = true;
|
||||
storageFeatures->storagePushConstant16 = true;
|
||||
storageFeatures->storageInputOutput16 = true;
|
||||
break;
|
||||
}
|
||||
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_8BIT_STORAGE_FEATURES_KHR: {
|
||||
auto* storageFeatures = (VkPhysicalDevice8BitStorageFeaturesKHR*)next;
|
||||
storageFeatures->storageBuffer8BitAccess = true;
|
||||
storageFeatures->uniformAndStorageBuffer8BitAccess = true;
|
||||
storageFeatures->storagePushConstant8 = true;
|
||||
break;
|
||||
}
|
||||
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FLOAT16_INT8_FEATURES_KHR: {
|
||||
auto* f16Features = (VkPhysicalDeviceFloat16Int8FeaturesKHR*)next;
|
||||
f16Features->shaderFloat16 = true;
|
||||
f16Features->shaderInt8 = true;
|
||||
break;
|
||||
}
|
||||
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VARIABLE_POINTER_FEATURES: {
|
||||
auto* varPtrFeatures = (VkPhysicalDeviceVariablePointerFeatures*)next;
|
||||
varPtrFeatures->variablePointersStorageBuffer = true;
|
||||
varPtrFeatures->variablePointers = true;
|
||||
break;
|
||||
}
|
||||
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_HOST_QUERY_RESET_FEATURES_EXT: {
|
||||
auto* hostQueryResetFeatures = (VkPhysicalDeviceHostQueryResetFeaturesEXT*)next;
|
||||
hostQueryResetFeatures->hostQueryReset = true;
|
||||
break;
|
||||
}
|
||||
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VERTEX_ATTRIBUTE_DIVISOR_FEATURES_EXT: {
|
||||
auto* divisorFeatures = (VkPhysicalDeviceVertexAttributeDivisorFeaturesEXT*)next;
|
||||
divisorFeatures->vertexAttributeInstanceRateDivisor = true;
|
||||
divisorFeatures->vertexAttributeInstanceRateZeroDivisor = true;
|
||||
break;
|
||||
}
|
||||
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PORTABILITY_SUBSET_FEATURES_EXTX: {
|
||||
auto* portabilityFeatures = (VkPhysicalDevicePortabilitySubsetFeaturesEXTX*)next;
|
||||
portabilityFeatures->triangleFans = false;
|
||||
portabilityFeatures->separateStencilMaskRef = true;
|
||||
portabilityFeatures->events = false;
|
||||
portabilityFeatures->standardImageViews = _mvkInstance->getMoltenVKConfiguration()->fullImageViewSwizzle;
|
||||
portabilityFeatures->samplerMipLodBias = false;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
next = next->pNext;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -325,6 +325,7 @@ void MVKInstance::initProcAddrs() {
|
||||
ADD_PROC_ADDR(vkGetSwapchainImagesKHR);
|
||||
ADD_PROC_ADDR(vkAcquireNextImageKHR);
|
||||
ADD_PROC_ADDR(vkQueuePresentKHR);
|
||||
ADD_PROC_ADDR(vkResetQueryPoolEXT);
|
||||
ADD_PROC_ADDR(vkGetMoltenVKConfigurationMVK);
|
||||
ADD_PROC_ADDR(vkSetMoltenVKConfigurationMVK);
|
||||
ADD_PROC_ADDR(vkGetPhysicalDeviceMetalFeaturesMVK);
|
||||
|
@ -166,13 +166,19 @@ void MVKOcclusionQueryPool::endQuery(uint32_t query, MVKCommandEncoder* cmdEncod
|
||||
void MVKOcclusionQueryPool::resetResults(uint32_t firstQuery, uint32_t queryCount, MVKCommandEncoder* cmdEncoder) {
|
||||
MVKQueryPool::resetResults(firstQuery, queryCount, cmdEncoder);
|
||||
|
||||
id<MTLBlitCommandEncoder> blitEncoder = cmdEncoder->getMTLBlitEncoder(kMVKCommandUseResetQueryPool);
|
||||
NSUInteger firstOffset = getVisibilityResultOffset(firstQuery);
|
||||
NSUInteger lastOffset = getVisibilityResultOffset(firstQuery + queryCount);
|
||||
if (cmdEncoder) {
|
||||
id<MTLBlitCommandEncoder> blitEncoder = cmdEncoder->getMTLBlitEncoder(kMVKCommandUseResetQueryPool);
|
||||
|
||||
[blitEncoder fillBuffer: getVisibilityResultMTLBuffer()
|
||||
range: NSMakeRange(firstOffset, lastOffset - firstOffset)
|
||||
value: 0];
|
||||
[blitEncoder fillBuffer: getVisibilityResultMTLBuffer()
|
||||
range: NSMakeRange(firstOffset, lastOffset - firstOffset)
|
||||
value: 0];
|
||||
} else { // Host-side reset
|
||||
id<MTLBuffer> vizBuff = getVisibilityResultMTLBuffer();
|
||||
size_t size = std::min(lastOffset, vizBuff.length) - firstOffset;
|
||||
memset((char *)[vizBuff contents] + firstOffset, 0, size);
|
||||
}
|
||||
}
|
||||
|
||||
void MVKOcclusionQueryPool::getResult(uint32_t query, void* pQryData, bool shouldOutput64Bit) {
|
||||
|
@ -51,6 +51,7 @@ MVK_EXTENSION(KHR_surface, KHR_SURFACE)
|
||||
MVK_EXTENSION(KHR_swapchain, KHR_SWAPCHAIN)
|
||||
MVK_EXTENSION(KHR_swapchain_mutable_format, KHR_SWAPCHAIN_MUTABLE_FORMAT)
|
||||
MVK_EXTENSION(KHR_variable_pointers, KHR_VARIABLE_POINTERS)
|
||||
MVK_EXTENSION(EXT_host_query_reset, EXT_HOST_QUERY_RESET)
|
||||
MVK_EXTENSION(EXT_memory_budget, EXT_MEMORY_BUDGET)
|
||||
MVK_EXTENSION(EXT_shader_viewport_index_layer, EXT_SHADER_VIEWPORT_INDEX_LAYER)
|
||||
MVK_EXTENSION(EXT_vertex_attribute_divisor, EXT_VERTEX_ATTRIBUTE_DIVISOR)
|
||||
|
@ -1805,6 +1805,20 @@ MVK_PUBLIC_SYMBOL VkResult vkGetPhysicalDeviceSurfacePresentModesKHR(
|
||||
}
|
||||
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark VK_EXT_host_query_reset extension
|
||||
|
||||
MVK_PUBLIC_SYMBOL void vkResetQueryPoolEXT(
|
||||
VkDevice device,
|
||||
VkQueryPool queryPool,
|
||||
uint32_t firstQuery,
|
||||
uint32_t queryCount) {
|
||||
|
||||
auto* mvkQueryPool = (MVKQueryPool*)queryPool;
|
||||
mvkQueryPool->resetResults(firstQuery, queryCount, nullptr);
|
||||
}
|
||||
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark iOS & macOS surface extensions
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user