mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-04 17:10:47 +00:00
Add support for protected memory, new in Vulkan 1.1
This commit is contained in:
@@ -467,6 +467,7 @@ enum class VulkanChunk : uint32_t
|
||||
vkCreateSamplerYcbcrConversionKHR,
|
||||
vkCmdSetDeviceMaskKHR,
|
||||
vkCmdDispatchBaseKHR,
|
||||
vkGetDeviceQueue2,
|
||||
Max,
|
||||
};
|
||||
|
||||
@@ -624,6 +625,7 @@ DECLARE_REFLECTION_STRUCT(VkSamplerReductionModeCreateInfoEXT);
|
||||
DECLARE_REFLECTION_STRUCT(VkDebugUtilsLabelEXT);
|
||||
DECLARE_REFLECTION_STRUCT(VkSamplerYcbcrConversionCreateInfoKHR);
|
||||
DECLARE_REFLECTION_STRUCT(VkRenderPassMultiviewCreateInfoKHR);
|
||||
DECLARE_REFLECTION_STRUCT(VkDeviceQueueInfo2);
|
||||
|
||||
DECLARE_DESERIALISE_TYPE(VkDeviceCreateInfo);
|
||||
DECLARE_DESERIALISE_TYPE(VkBufferCreateInfo);
|
||||
@@ -672,6 +674,7 @@ DECLARE_DESERIALISE_TYPE(VkSamplerReductionModeCreateInfoEXT);
|
||||
DECLARE_DESERIALISE_TYPE(VkDebugUtilsLabelEXT);
|
||||
DECLARE_DESERIALISE_TYPE(VkSamplerYcbcrConversionCreateInfoKHR);
|
||||
DECLARE_DESERIALISE_TYPE(VkRenderPassMultiviewCreateInfoKHR);
|
||||
DECLARE_DESERIALISE_TYPE(VkDeviceQueueInfo2);
|
||||
|
||||
DECLARE_REFLECTION_ENUM(VkFlagWithNoBits);
|
||||
DECLARE_REFLECTION_ENUM(VkQueueFlagBits);
|
||||
@@ -742,4 +745,5 @@ DECLARE_REFLECTION_ENUM(VkTessellationDomainOriginKHR);
|
||||
DECLARE_REFLECTION_ENUM(VkSamplerReductionModeEXT);
|
||||
DECLARE_REFLECTION_ENUM(VkSamplerYcbcrModelConversionKHR);
|
||||
DECLARE_REFLECTION_ENUM(VkSamplerYcbcrRangeKHR);
|
||||
DECLARE_REFLECTION_ENUM(VkChromaLocation);
|
||||
DECLARE_REFLECTION_ENUM(VkChromaLocation);
|
||||
DECLARE_REFLECTION_ENUM(VkDeviceQueueCreateFlagBits);
|
||||
@@ -2370,6 +2370,10 @@ bool WrappedVulkan::ProcessChunk(ReadSerialiser &ser, VulkanChunk chunk)
|
||||
return Serialise_vkCmdDispatchBaseKHR(ser, VK_NULL_HANDLE, 0, 0, 0, 0, 0, 0);
|
||||
break;
|
||||
|
||||
case VulkanChunk::vkGetDeviceQueue2:
|
||||
return Serialise_vkGetDeviceQueue2(ser, VK_NULL_HANDLE, NULL, NULL);
|
||||
break;
|
||||
|
||||
default:
|
||||
{
|
||||
SystemChunk system = (SystemChunk)chunk;
|
||||
|
||||
@@ -1771,4 +1771,9 @@ public:
|
||||
IMPLEMENT_FUNCTION_SERIALISED(void, vkCmdDispatchBaseKHR, VkCommandBuffer commandBuffer,
|
||||
uint32_t baseGroupX, uint32_t baseGroupY, uint32_t baseGroupZ,
|
||||
uint32_t groupCountX, uint32_t groupCountY, uint32_t groupCountZ);
|
||||
|
||||
// Vulkan 1.1
|
||||
|
||||
IMPLEMENT_FUNCTION_SERIALISED(void, vkGetDeviceQueue2, VkDevice device,
|
||||
const VkDeviceQueueInfo2 *pQueueInfo, VkQueue *pQueue);
|
||||
};
|
||||
|
||||
@@ -297,7 +297,8 @@
|
||||
CheckExt(KHR_external_semaphore_capabilities, VK11); \
|
||||
CheckExt(KHR_external_fence_capabilities, VK11); \
|
||||
CheckExt(EXT_debug_utils, VKXX); \
|
||||
CheckExt(KHR_device_group_creation, VK11);
|
||||
CheckExt(KHR_device_group_creation, VK11); \
|
||||
CheckExt(protected_memory, VK11);
|
||||
|
||||
#define CheckDeviceExts() \
|
||||
CheckExt(EXT_debug_marker, VKXX); \
|
||||
@@ -429,6 +430,7 @@
|
||||
HookInitExtension(KHR_device_group, GetDeviceGroupPresentCapabilitiesKHR); \
|
||||
HookInitExtension(KHR_device_group, GetDeviceGroupSurfacePresentModesKHR); \
|
||||
HookInitExtension(KHR_device_group, AcquireNextImage2KHR); \
|
||||
HookInitExtension(protected_memory, GetDeviceQueue2); \
|
||||
HookInitDevice_PlatformSpecific()
|
||||
|
||||
#define DefineHooks() \
|
||||
@@ -923,6 +925,8 @@
|
||||
VkSurfaceKHR, surface, uint32_t *, pRectCount, VkRect2D *, pRects); \
|
||||
HookDefine3(VkResult, vkAcquireNextImage2KHR, VkDevice, device, \
|
||||
const VkAcquireNextImageInfoKHR *, pAcquireInfo, uint32_t *, pImageIndex); \
|
||||
HookDefine3(void, vkGetDeviceQueue2, VkDevice, device, const VkDeviceQueueInfo2 *, pQueueInfo, \
|
||||
VkQueue *, pQueue); \
|
||||
HookDefine_PlatformSpecific()
|
||||
|
||||
struct VkLayerInstanceDispatchTableExtended : VkLayerInstanceDispatchTable
|
||||
|
||||
@@ -189,6 +189,9 @@ SERIALISE_VK_HANDLES();
|
||||
PNEXT_IGNORE(VK_STRUCTURE_TYPE_DEVICE_GROUP_RENDER_PASS_BEGIN_INFO_KHR) \
|
||||
PNEXT_IGNORE(VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_FLAGS_INFO_KHR) \
|
||||
\
|
||||
/* Vulkan 1.1 - protected memory */ \
|
||||
PNEXT_IGNORE(VK_STRUCTURE_TYPE_PROTECTED_SUBMIT_INFO) \
|
||||
\
|
||||
/* VK_EXT_conservative_rasterization */ \
|
||||
PNEXT_STRUCT(VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_CONSERVATIVE_STATE_CREATE_INFO_EXT, \
|
||||
VkPipelineRasterizationConservativeStateCreateInfoEXT) \
|
||||
@@ -2435,6 +2438,23 @@ void Deserialise(const VkRenderPassMultiviewCreateInfoKHR &el)
|
||||
delete[] el.pCorrelationMasks;
|
||||
}
|
||||
|
||||
template <typename SerialiserType>
|
||||
void DoSerialise(SerialiserType &ser, VkDeviceQueueInfo2 &el)
|
||||
{
|
||||
RDCASSERT(ser.IsReading() || el.sType == VK_STRUCTURE_TYPE_DEVICE_QUEUE_INFO_2);
|
||||
SerialiseNext(ser, el.sType, el.pNext);
|
||||
|
||||
SERIALISE_MEMBER_TYPED(VkDeviceQueueCreateFlagBits, flags);
|
||||
SERIALISE_MEMBER(queueFamilyIndex);
|
||||
SERIALISE_MEMBER(queueIndex);
|
||||
}
|
||||
|
||||
template <>
|
||||
void Deserialise(const VkDeviceQueueInfo2 &el)
|
||||
{
|
||||
DeserialiseNext(el.pNext);
|
||||
}
|
||||
|
||||
INSTANTIATE_SERIALISE_TYPE(VkOffset2D);
|
||||
INSTANTIATE_SERIALISE_TYPE(VkExtent2D);
|
||||
INSTANTIATE_SERIALISE_TYPE(VkMemoryType);
|
||||
@@ -2541,6 +2561,7 @@ INSTANTIATE_SERIALISE_TYPE(VkSamplerReductionModeCreateInfoEXT);
|
||||
INSTANTIATE_SERIALISE_TYPE(VkDebugUtilsLabelEXT);
|
||||
INSTANTIATE_SERIALISE_TYPE(VkSamplerYcbcrConversionCreateInfoKHR);
|
||||
INSTANTIATE_SERIALISE_TYPE(VkRenderPassMultiviewCreateInfoKHR);
|
||||
INSTANTIATE_SERIALISE_TYPE(VkDeviceQueueInfo2);
|
||||
|
||||
INSTANTIATE_SERIALISE_TYPE(DescriptorSetSlot);
|
||||
INSTANTIATE_SERIALISE_TYPE(ImageRegionState);
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
template <>
|
||||
std::string DoStringise(const VulkanChunk &el)
|
||||
{
|
||||
RDCCOMPILE_ASSERT((uint32_t)VulkanChunk::Max == 1115, "Chunks changed without updating names");
|
||||
RDCCOMPILE_ASSERT((uint32_t)VulkanChunk::Max == 1116, "Chunks changed without updating names");
|
||||
|
||||
BEGIN_ENUM_STRINGISE(VulkanChunk)
|
||||
{
|
||||
@@ -147,6 +147,7 @@ std::string DoStringise(const VulkanChunk &el)
|
||||
STRINGISE_ENUM_CLASS(vkCreateSamplerYcbcrConversionKHR);
|
||||
STRINGISE_ENUM_CLASS(vkCmdSetDeviceMaskKHR);
|
||||
STRINGISE_ENUM_CLASS(vkCmdDispatchBaseKHR);
|
||||
STRINGISE_ENUM_CLASS(vkGetDeviceQueue2);
|
||||
STRINGISE_ENUM_CLASS_NAMED(Max, "Max Chunk");
|
||||
}
|
||||
END_ENUM_STRINGISE()
|
||||
@@ -1770,6 +1771,16 @@ std::string DoStringise(const VkChromaLocation &el)
|
||||
END_ENUM_STRINGISE();
|
||||
}
|
||||
|
||||
template <>
|
||||
std::string DoStringise(const VkDeviceQueueCreateFlagBits &el)
|
||||
{
|
||||
BEGIN_ENUM_STRINGISE(VkDeviceQueueCreateFlagBits);
|
||||
{
|
||||
STRINGISE_ENUM(VK_DEVICE_QUEUE_CREATE_PROTECTED_BIT)
|
||||
}
|
||||
END_ENUM_STRINGISE();
|
||||
}
|
||||
|
||||
template <>
|
||||
std::string DoStringise(const VkExtent3D &el)
|
||||
{
|
||||
|
||||
@@ -1260,6 +1260,110 @@ void WrappedVulkan::vkQueueInsertDebugUtilsLabelEXT(VkQueue queue,
|
||||
}
|
||||
}
|
||||
|
||||
template <typename SerialiserType>
|
||||
bool WrappedVulkan::Serialise_vkGetDeviceQueue2(SerialiserType &ser, VkDevice device,
|
||||
const VkDeviceQueueInfo2 *pQueueInfo, VkQueue *pQueue)
|
||||
{
|
||||
SERIALISE_ELEMENT(device);
|
||||
SERIALISE_ELEMENT_LOCAL(QueueInfo, *pQueueInfo);
|
||||
SERIALISE_ELEMENT_LOCAL(Queue, GetResID(*pQueue)).TypedAs("VkQueue");
|
||||
|
||||
SERIALISE_CHECK_READ_ERRORS();
|
||||
|
||||
if(IsReplayingAndReading())
|
||||
{
|
||||
uint32_t queueFamilyIndex = QueueInfo.queueFamilyIndex;
|
||||
|
||||
VkQueue queue;
|
||||
// MULTIQUEUE - re-map the queue family/index instead of using the supported family
|
||||
QueueInfo.queueFamilyIndex = m_SupportedQueueFamily;
|
||||
QueueInfo.queueIndex = 0;
|
||||
ObjDisp(device)->GetDeviceQueue2(Unwrap(device), &QueueInfo, &queue);
|
||||
|
||||
GetResourceManager()->WrapResource(Unwrap(device), queue);
|
||||
GetResourceManager()->AddLiveResource(Queue, queue);
|
||||
|
||||
if(queueFamilyIndex == m_QueueFamilyIdx)
|
||||
{
|
||||
m_Queue = queue;
|
||||
|
||||
// we can now submit any cmds that were queued (e.g. from creating debug
|
||||
// manager on vkCreateDevice)
|
||||
SubmitCmds();
|
||||
}
|
||||
|
||||
AddResource(Queue, ResourceType::Queue, "Queue");
|
||||
DerivedResource(device, Queue);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void WrappedVulkan::vkGetDeviceQueue2(VkDevice device, const VkDeviceQueueInfo2 *pQueueInfo,
|
||||
VkQueue *pQueue)
|
||||
{
|
||||
SERIALISE_TIME_CALL(ObjDisp(device)->GetDeviceQueue2(Unwrap(device), pQueueInfo, pQueue));
|
||||
|
||||
if(m_SetDeviceLoaderData)
|
||||
m_SetDeviceLoaderData(m_Device, *pQueue);
|
||||
else
|
||||
SetDispatchTableOverMagicNumber(device, *pQueue);
|
||||
|
||||
RDCASSERT(IsCaptureMode(m_State));
|
||||
|
||||
{
|
||||
// it's perfectly valid for enumerate type functions to return the same handle
|
||||
// each time. If that happens, we will already have a wrapper created so just
|
||||
// return the wrapped object to the user and do nothing else
|
||||
if(m_QueueFamilies[pQueueInfo->queueFamilyIndex][pQueueInfo->queueIndex] != VK_NULL_HANDLE)
|
||||
{
|
||||
*pQueue = m_QueueFamilies[pQueueInfo->queueFamilyIndex][pQueueInfo->queueIndex];
|
||||
}
|
||||
else
|
||||
{
|
||||
ResourceId id = GetResourceManager()->WrapResource(Unwrap(device), *pQueue);
|
||||
|
||||
{
|
||||
Chunk *chunk = NULL;
|
||||
|
||||
{
|
||||
CACHE_THREAD_SERIALISER();
|
||||
|
||||
SCOPED_SERIALISE_CHUNK(VulkanChunk::vkGetDeviceQueue2);
|
||||
Serialise_vkGetDeviceQueue2(ser, device, pQueueInfo, pQueue);
|
||||
|
||||
chunk = scope.Get();
|
||||
}
|
||||
|
||||
VkResourceRecord *record = GetResourceManager()->AddResourceRecord(*pQueue);
|
||||
RDCASSERT(record);
|
||||
|
||||
VkResourceRecord *instrecord = GetRecord(m_Instance);
|
||||
|
||||
// treat queues as pool members of the instance (ie. freed when the instance dies)
|
||||
{
|
||||
instrecord->LockChunks();
|
||||
instrecord->pooledChildren.push_back(record);
|
||||
instrecord->UnlockChunks();
|
||||
}
|
||||
|
||||
record->AddChunk(chunk);
|
||||
}
|
||||
|
||||
m_QueueFamilies[pQueueInfo->queueFamilyIndex][pQueueInfo->queueIndex] = *pQueue;
|
||||
|
||||
if(pQueueInfo->queueFamilyIndex == m_QueueFamilyIdx)
|
||||
{
|
||||
m_Queue = *pQueue;
|
||||
|
||||
// we can now submit any cmds that were queued (e.g. from creating debug
|
||||
// manager on vkCreateDevice)
|
||||
SubmitCmds();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
INSTANTIATE_FUNCTION_SERIALISED(void, vkGetDeviceQueue, VkDevice device, uint32_t queueFamilyIndex,
|
||||
uint32_t queueIndex, VkQueue *pQueue);
|
||||
|
||||
@@ -1278,3 +1382,6 @@ INSTANTIATE_FUNCTION_SERIALISED(void, vkQueueEndDebugUtilsLabelEXT, VkQueue queu
|
||||
|
||||
INSTANTIATE_FUNCTION_SERIALISED(void, vkQueueInsertDebugUtilsLabelEXT, VkQueue queue,
|
||||
const VkDebugUtilsLabelEXT *pLabelInfo);
|
||||
|
||||
INSTANTIATE_FUNCTION_SERIALISED(void, vkGetDeviceQueue2, VkDevice device,
|
||||
const VkDeviceQueueInfo2 *pQueueInfo, VkQueue *pQueue);
|
||||
|
||||
Reference in New Issue
Block a user