Add support for display control extensions

* VK_EXT_display_surface_counter and VK_EXT_display_control
This commit is contained in:
baldurk
2017-02-13 19:20:18 +00:00
parent 3d23dbe82c
commit 4cb9fb4fe3
5 changed files with 167 additions and 11 deletions
+5
View File
@@ -2840,6 +2840,11 @@ static void SerialiseNext(Serialiser *ser, VkStructureType &sType, const void *&
{
// do nothing
}
// likewise we don't create real swapchains, so we can ignore surface counters
else if(next->sType == VK_STRUCTURE_TYPE_SWAPCHAIN_COUNTER_CREATE_INFO_EXT)
{
// do nothing
}
else
{
RDCERR("Unrecognised extension structure type %d", next->sType);
+6
View File
@@ -713,6 +713,12 @@ static const VkExtensionProperties supportedExtensions[] = {
{
VK_EXT_DEBUG_REPORT_EXTENSION_NAME, VK_EXT_DEBUG_REPORT_SPEC_VERSION,
},
{
VK_EXT_DISPLAY_CONTROL_EXTENSION_NAME, VK_EXT_DISPLAY_CONTROL_SPEC_VERSION,
},
{
VK_EXT_DISPLAY_SURFACE_COUNTER_EXTENSION_NAME, VK_EXT_DISPLAY_SURFACE_COUNTER_SPEC_VERSION,
},
// this extension is 'free' - it just marks SPIR-V extension availability
{
VK_EXT_SHADER_SUBGROUP_BALLOT_EXTENSION_NAME, VK_EXT_SHADER_SUBGROUP_BALLOT_SPEC_VERSION,
+16
View File
@@ -1425,4 +1425,20 @@ public:
void vkGetPhysicalDeviceSparseImageFormatProperties2KHR(
VkPhysicalDevice physicalDevice, const VkPhysicalDeviceSparseImageFormatInfo2KHR *pFormatInfo,
uint32_t *pPropertyCount, VkSparseImageFormatProperties2KHR *pProperties);
// VK_EXT_display_surface_counter
VkResult vkGetPhysicalDeviceSurfaceCapabilities2EXT(VkPhysicalDevice physicalDevice,
VkSurfaceKHR surface,
VkSurfaceCapabilities2EXT *pSurfaceCapabilities);
// VK_EXT_display_control
VkResult vkDisplayPowerControlEXT(VkDevice device, VkDisplayKHR display,
const VkDisplayPowerInfoEXT *pDisplayPowerInfo);
VkResult vkRegisterDeviceEventEXT(VkDevice device, const VkDeviceEventInfoEXT *pDeviceEventInfo,
const VkAllocationCallbacks *pAllocator, VkFence *pFence);
VkResult vkRegisterDisplayEventEXT(VkDevice device, VkDisplayKHR display,
const VkDisplayEventInfoEXT *pDisplayEventInfo,
const VkAllocationCallbacks *pAllocator, VkFence *pFence);
VkResult vkGetSwapchainCounterEXT(VkDevice device, VkSwapchainKHR swapchain,
VkSurfaceCounterFlagBitsEXT counter, uint64_t *pCounterValue);
};
+30 -11
View File
@@ -249,16 +249,17 @@
// for simplicity and since the check itself is platform agnostic,
// these aren't protected in platform defines
#define CheckInstanceExts() \
CheckExt(VK_KHR_xlib_surface); \
CheckExt(VK_KHR_xcb_surface); \
CheckExt(VK_KHR_win32_surface); \
CheckExt(VK_KHR_android_surface); \
CheckExt(VK_KHR_surface); \
CheckExt(VK_EXT_debug_report); \
CheckExt(VK_KHR_display); \
CheckExt(VK_NV_external_memory_capabilities); \
CheckExt(VK_KHR_get_physical_device_properties2);
#define CheckInstanceExts() \
CheckExt(VK_KHR_xlib_surface); \
CheckExt(VK_KHR_xcb_surface); \
CheckExt(VK_KHR_win32_surface); \
CheckExt(VK_KHR_android_surface); \
CheckExt(VK_KHR_surface); \
CheckExt(VK_EXT_debug_report); \
CheckExt(VK_KHR_display); \
CheckExt(VK_NV_external_memory_capabilities); \
CheckExt(VK_KHR_get_physical_device_properties2); \
CheckExt(VK_EXT_display_surface_counter);
#define CheckDeviceExts() \
CheckExt(VK_EXT_debug_marker); \
@@ -267,7 +268,8 @@
CheckExt(VK_NV_external_memory); \
CheckExt(VK_NV_external_memory_win32); \
CheckExt(VK_NV_win32_keyed_mutex); \
CheckExt(VK_KHR_maintenance1);
CheckExt(VK_KHR_maintenance1); \
CheckExt(VK_EXT_display_control);
#define HookInitVulkanInstanceExts() \
HookInitExtension(VK_KHR_surface, DestroySurfaceKHR); \
@@ -296,6 +298,7 @@
GetPhysicalDeviceQueueFamilyProperties2KHR); \
HookInitExtension(VK_KHR_get_physical_device_properties2, \
GetPhysicalDeviceSparseImageFormatProperties2KHR); \
HookInitExtension(VK_EXT_display_surface_counter, GetPhysicalDeviceSurfaceCapabilities2EXT); \
HookInitInstance_PlatformSpecific()
#define HookInitVulkanDeviceExts() \
@@ -311,6 +314,10 @@
HookInitExtension(VK_KHR_swapchain, QueuePresentKHR); \
HookInitExtension(VK_KHR_display_swapchain, CreateSharedSwapchainsKHR); \
HookInitExtension(VK_KHR_maintenance1, TrimCommandPoolKHR); \
HookInitExtension(VK_EXT_display_control, DisplayPowerControlEXT); \
HookInitExtension(VK_EXT_display_control, RegisterDeviceEventEXT); \
HookInitExtension(VK_EXT_display_control, RegisterDisplayEventEXT); \
HookInitExtension(VK_EXT_display_control, GetSwapchainCounterEXT); \
HookInitDevice_PlatformSpecific()
#define DefineHooks() \
@@ -681,6 +688,18 @@
HookDefine4(void, vkGetPhysicalDeviceSparseImageFormatProperties2KHR, VkPhysicalDevice, \
physicalDevice, const VkPhysicalDeviceSparseImageFormatInfo2KHR *, pFormatInfo, \
uint32_t *, pPropertyCount, VkSparseImageFormatProperties2KHR *, pProperties); \
HookDefine3(VkResult, vkGetPhysicalDeviceSurfaceCapabilities2EXT, VkPhysicalDevice, \
physicalDevice, VkSurfaceKHR, surface, VkSurfaceCapabilities2EXT *, \
pSurfaceCapabilities); \
HookDefine3(VkResult, vkDisplayPowerControlEXT, VkDevice, device, VkDisplayKHR, display, \
const VkDisplayPowerInfoEXT *, pDisplayPowerInfo); \
HookDefine4(VkResult, vkRegisterDeviceEventEXT, VkDevice, device, const VkDeviceEventInfoEXT *, \
pDeviceEventInfo, const VkAllocationCallbacks *, pAllocator, VkFence *, pFence); \
HookDefine5(VkResult, vkRegisterDisplayEventEXT, VkDevice, device, VkDisplayKHR, display, \
const VkDisplayEventInfoEXT *, pDisplayEventInfo, const VkAllocationCallbacks *, \
pAllocator, VkFence *, pFence); \
HookDefine4(VkResult, vkGetSwapchainCounterEXT, VkDevice, device, VkSwapchainKHR, swapchain, \
VkSurfaceCounterFlagBitsEXT, counter, uint64_t *, pCounterValue); \
HookDefine_PlatformSpecific()
struct VkLayerInstanceDispatchTableExtended : VkLayerInstanceDispatchTable
@@ -67,6 +67,116 @@ VkResult WrappedVulkan::vkGetPhysicalDeviceSurfacePresentModesKHR(VkPhysicalDevi
pPresentModeCount, pPresentModes);
}
VkResult WrappedVulkan::vkGetPhysicalDeviceSurfaceCapabilities2EXT(
VkPhysicalDevice physicalDevice, VkSurfaceKHR surface,
VkSurfaceCapabilities2EXT *pSurfaceCapabilities)
{
return ObjDisp(physicalDevice)
->GetPhysicalDeviceSurfaceCapabilities2EXT(Unwrap(physicalDevice), Unwrap(surface),
pSurfaceCapabilities);
}
VkResult WrappedVulkan::vkDisplayPowerControlEXT(VkDevice device, VkDisplayKHR display,
const VkDisplayPowerInfoEXT *pDisplayPowerInfo)
{
// displays are not wrapped
return ObjDisp(device)->DisplayPowerControlEXT(Unwrap(device), display, pDisplayPowerInfo);
}
VkResult WrappedVulkan::vkGetSwapchainCounterEXT(VkDevice device, VkSwapchainKHR swapchain,
VkSurfaceCounterFlagBitsEXT counter,
uint64_t *pCounterValue)
{
return ObjDisp(device)->GetSwapchainCounterEXT(Unwrap(device), Unwrap(swapchain), counter,
pCounterValue);
}
VkResult WrappedVulkan::vkRegisterDeviceEventEXT(VkDevice device,
const VkDeviceEventInfoEXT *pDeviceEventInfo,
const VkAllocationCallbacks *pAllocator,
VkFence *pFence)
{
// for now we emulate this on replay as just a regular fence create, since we don't faithfully
// replay sync events anyway.
VkResult ret =
ObjDisp(device)->RegisterDeviceEventEXT(Unwrap(device), pDeviceEventInfo, pAllocator, pFence);
if(ret == VK_SUCCESS)
{
ResourceId id = GetResourceManager()->WrapResource(Unwrap(device), *pFence);
if(m_State >= WRITING)
{
Chunk *chunk = NULL;
{
CACHE_THREAD_SERIALISER();
VkFenceCreateInfo createInfo = {
VK_STRUCTURE_TYPE_FENCE_CREATE_INFO, NULL, VK_FENCE_CREATE_SIGNALED_BIT,
};
SCOPED_SERIALISE_CONTEXT(CREATE_FENCE);
Serialise_vkCreateFence(localSerialiser, device, &createInfo, NULL, pFence);
chunk = scope.Get();
}
VkResourceRecord *record = GetResourceManager()->AddResourceRecord(*pFence);
record->AddChunk(chunk);
}
else
{
GetResourceManager()->AddLiveResource(id, *pFence);
}
}
return ret;
}
VkResult WrappedVulkan::vkRegisterDisplayEventEXT(VkDevice device, VkDisplayKHR display,
const VkDisplayEventInfoEXT *pDisplayEventInfo,
const VkAllocationCallbacks *pAllocator,
VkFence *pFence)
{
// for now we emulate this on replay as just a regular fence create, since we don't faithfully
// replay sync events anyway.
VkResult ret = ObjDisp(device)->RegisterDisplayEventEXT(Unwrap(device), display,
pDisplayEventInfo, pAllocator, pFence);
if(ret == VK_SUCCESS)
{
ResourceId id = GetResourceManager()->WrapResource(Unwrap(device), *pFence);
if(m_State >= WRITING)
{
Chunk *chunk = NULL;
{
CACHE_THREAD_SERIALISER();
VkFenceCreateInfo createInfo = {
VK_STRUCTURE_TYPE_FENCE_CREATE_INFO, NULL, VK_FENCE_CREATE_SIGNALED_BIT,
};
SCOPED_SERIALISE_CONTEXT(CREATE_FENCE);
Serialise_vkCreateFence(localSerialiser, device, &createInfo, NULL, pFence);
chunk = scope.Get();
}
VkResourceRecord *record = GetResourceManager()->AddResourceRecord(*pFence);
record->AddChunk(chunk);
}
else
{
GetResourceManager()->AddLiveResource(id, *pFence);
}
}
return ret;
}
bool WrappedVulkan::Serialise_vkGetSwapchainImagesKHR(Serialiser *localSerialiser, VkDevice device,
VkSwapchainKHR swapchain, uint32_t *pCount,
VkImage *pSwapchainImages)