mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-08-24 23:46:41 +00:00
Move dispatch table handling internal, remove LoaderAndTools code
This commit is contained in:
@@ -1,206 +0,0 @@
|
||||
/* THIS FILE IS GENERATED. DO NOT EDIT. */
|
||||
|
||||
/*
|
||||
* Vulkan
|
||||
*
|
||||
* Copyright (C) 2014 LunarG, Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <vulkan.h>
|
||||
#include <vk_layer.h>
|
||||
#include <string.h>
|
||||
|
||||
static inline void layer_initialize_dispatch_table(VkLayerDispatchTable *table,
|
||||
const VkBaseLayerObject *devw)
|
||||
{
|
||||
VkDevice device = (VkDevice) devw->nextObject;
|
||||
PFN_vkGetDeviceProcAddr gpa = (PFN_vkGetDeviceProcAddr) devw->pGPA;
|
||||
VkDevice baseDevice = (VkDevice) devw->baseObject;
|
||||
// GPA has to be first entry inited and uses wrapped object since it triggers init
|
||||
memset(table, 0, sizeof(*table));
|
||||
table->GetDeviceProcAddr =(PFN_vkGetDeviceProcAddr) gpa(device,"vkGetDeviceProcAddr");
|
||||
table->CreateDevice = (PFN_vkCreateDevice) gpa(baseDevice, "vkCreateDevice");
|
||||
table->DestroyDevice = (PFN_vkDestroyDevice) gpa(baseDevice, "vkDestroyDevice");
|
||||
table->GetDeviceQueue = (PFN_vkGetDeviceQueue) gpa(baseDevice, "vkGetDeviceQueue");
|
||||
table->QueueSubmit = (PFN_vkQueueSubmit) gpa(baseDevice, "vkQueueSubmit");
|
||||
table->QueueWaitIdle = (PFN_vkQueueWaitIdle) gpa(baseDevice, "vkQueueWaitIdle");
|
||||
table->DeviceWaitIdle = (PFN_vkDeviceWaitIdle) gpa(baseDevice, "vkDeviceWaitIdle");
|
||||
table->AllocMemory = (PFN_vkAllocMemory) gpa(baseDevice, "vkAllocMemory");
|
||||
table->FreeMemory = (PFN_vkFreeMemory) gpa(baseDevice, "vkFreeMemory");
|
||||
table->MapMemory = (PFN_vkMapMemory) gpa(baseDevice, "vkMapMemory");
|
||||
table->UnmapMemory = (PFN_vkUnmapMemory) gpa(baseDevice, "vkUnmapMemory");
|
||||
table->FlushMappedMemoryRanges = (PFN_vkFlushMappedMemoryRanges) gpa(baseDevice, "vkFlushMappedMemoryRanges");
|
||||
table->InvalidateMappedMemoryRanges = (PFN_vkInvalidateMappedMemoryRanges) gpa(baseDevice, "vkInvalidateMappedMemoryRanges");
|
||||
table->GetDeviceMemoryCommitment = (PFN_vkGetDeviceMemoryCommitment) gpa(baseDevice, "vkGetDeviceMemoryCommitment");
|
||||
table->BindBufferMemory = (PFN_vkBindBufferMemory) gpa(baseDevice, "vkBindBufferMemory");
|
||||
table->BindImageMemory = (PFN_vkBindImageMemory) gpa(baseDevice, "vkBindImageMemory");
|
||||
table->GetBufferMemoryRequirements = (PFN_vkGetBufferMemoryRequirements) gpa(baseDevice, "vkGetBufferMemoryRequirements");
|
||||
table->GetImageMemoryRequirements = (PFN_vkGetImageMemoryRequirements) gpa(baseDevice, "vkGetImageMemoryRequirements");
|
||||
table->GetImageSparseMemoryRequirements = (PFN_vkGetImageSparseMemoryRequirements) gpa(baseDevice, "vkGetImageSparseMemoryRequirements");
|
||||
table->QueueBindSparseBufferMemory = (PFN_vkQueueBindSparseBufferMemory) gpa(baseDevice, "vkQueueBindSparseBufferMemory");
|
||||
table->QueueBindSparseImageOpaqueMemory = (PFN_vkQueueBindSparseImageOpaqueMemory) gpa(baseDevice, "vkQueueBindSparseImageOpaqueMemory");
|
||||
table->QueueBindSparseImageMemory = (PFN_vkQueueBindSparseImageMemory) gpa(baseDevice, "vkQueueBindSparseImageMemory");
|
||||
table->CreateFence = (PFN_vkCreateFence) gpa(baseDevice, "vkCreateFence");
|
||||
table->DestroyFence = (PFN_vkDestroyFence) gpa(baseDevice, "vkDestroyFence");
|
||||
table->ResetFences = (PFN_vkResetFences) gpa(baseDevice, "vkResetFences");
|
||||
table->GetFenceStatus = (PFN_vkGetFenceStatus) gpa(baseDevice, "vkGetFenceStatus");
|
||||
table->WaitForFences = (PFN_vkWaitForFences) gpa(baseDevice, "vkWaitForFences");
|
||||
table->CreateSemaphore = (PFN_vkCreateSemaphore) gpa(baseDevice, "vkCreateSemaphore");
|
||||
table->DestroySemaphore = (PFN_vkDestroySemaphore) gpa(baseDevice, "vkDestroySemaphore");
|
||||
table->QueueSignalSemaphore = (PFN_vkQueueSignalSemaphore) gpa(baseDevice, "vkQueueSignalSemaphore");
|
||||
table->QueueWaitSemaphore = (PFN_vkQueueWaitSemaphore) gpa(baseDevice, "vkQueueWaitSemaphore");
|
||||
table->CreateEvent = (PFN_vkCreateEvent) gpa(baseDevice, "vkCreateEvent");
|
||||
table->DestroyEvent = (PFN_vkDestroyEvent) gpa(baseDevice, "vkDestroyEvent");
|
||||
table->GetEventStatus = (PFN_vkGetEventStatus) gpa(baseDevice, "vkGetEventStatus");
|
||||
table->SetEvent = (PFN_vkSetEvent) gpa(baseDevice, "vkSetEvent");
|
||||
table->ResetEvent = (PFN_vkResetEvent) gpa(baseDevice, "vkResetEvent");
|
||||
table->CreateQueryPool = (PFN_vkCreateQueryPool) gpa(baseDevice, "vkCreateQueryPool");
|
||||
table->DestroyQueryPool = (PFN_vkDestroyQueryPool) gpa(baseDevice, "vkDestroyQueryPool");
|
||||
table->GetQueryPoolResults = (PFN_vkGetQueryPoolResults) gpa(baseDevice, "vkGetQueryPoolResults");
|
||||
table->CreateBuffer = (PFN_vkCreateBuffer) gpa(baseDevice, "vkCreateBuffer");
|
||||
table->DestroyBuffer = (PFN_vkDestroyBuffer) gpa(baseDevice, "vkDestroyBuffer");
|
||||
table->CreateBufferView = (PFN_vkCreateBufferView) gpa(baseDevice, "vkCreateBufferView");
|
||||
table->DestroyBufferView = (PFN_vkDestroyBufferView) gpa(baseDevice, "vkDestroyBufferView");
|
||||
table->CreateImage = (PFN_vkCreateImage) gpa(baseDevice, "vkCreateImage");
|
||||
table->DestroyImage = (PFN_vkDestroyImage) gpa(baseDevice, "vkDestroyImage");
|
||||
table->GetImageSubresourceLayout = (PFN_vkGetImageSubresourceLayout) gpa(baseDevice, "vkGetImageSubresourceLayout");
|
||||
table->CreateImageView = (PFN_vkCreateImageView) gpa(baseDevice, "vkCreateImageView");
|
||||
table->DestroyImageView = (PFN_vkDestroyImageView) gpa(baseDevice, "vkDestroyImageView");
|
||||
table->CreateAttachmentView = (PFN_vkCreateAttachmentView) gpa(baseDevice, "vkCreateAttachmentView");
|
||||
table->DestroyAttachmentView = (PFN_vkDestroyAttachmentView) gpa(baseDevice, "vkDestroyAttachmentView");
|
||||
table->CreateShaderModule = (PFN_vkCreateShaderModule) gpa(baseDevice, "vkCreateShaderModule");
|
||||
table->DestroyShaderModule = (PFN_vkDestroyShaderModule) gpa(baseDevice, "vkDestroyShaderModule");
|
||||
table->CreateShader = (PFN_vkCreateShader) gpa(baseDevice, "vkCreateShader");
|
||||
table->DestroyShader = (PFN_vkDestroyShader) gpa(baseDevice, "vkDestroyShader");
|
||||
table->CreatePipelineCache = (PFN_vkCreatePipelineCache) gpa(baseDevice, "vkCreatePipelineCache");
|
||||
table->DestroyPipelineCache = (PFN_vkDestroyPipelineCache) gpa(baseDevice, "vkDestroyPipelineCache");
|
||||
table->GetPipelineCacheSize = (PFN_vkGetPipelineCacheSize) gpa(baseDevice, "vkGetPipelineCacheSize");
|
||||
table->GetPipelineCacheData = (PFN_vkGetPipelineCacheData) gpa(baseDevice, "vkGetPipelineCacheData");
|
||||
table->MergePipelineCaches = (PFN_vkMergePipelineCaches) gpa(baseDevice, "vkMergePipelineCaches");
|
||||
table->CreateGraphicsPipelines = (PFN_vkCreateGraphicsPipelines) gpa(baseDevice, "vkCreateGraphicsPipelines");
|
||||
table->CreateComputePipelines = (PFN_vkCreateComputePipelines) gpa(baseDevice, "vkCreateComputePipelines");
|
||||
table->DestroyPipeline = (PFN_vkDestroyPipeline) gpa(baseDevice, "vkDestroyPipeline");
|
||||
table->CreatePipelineLayout = (PFN_vkCreatePipelineLayout) gpa(baseDevice, "vkCreatePipelineLayout");
|
||||
table->DestroyPipelineLayout = (PFN_vkDestroyPipelineLayout) gpa(baseDevice, "vkDestroyPipelineLayout");
|
||||
table->CreateSampler = (PFN_vkCreateSampler) gpa(baseDevice, "vkCreateSampler");
|
||||
table->DestroySampler = (PFN_vkDestroySampler) gpa(baseDevice, "vkDestroySampler");
|
||||
table->CreateDescriptorSetLayout = (PFN_vkCreateDescriptorSetLayout) gpa(baseDevice, "vkCreateDescriptorSetLayout");
|
||||
table->DestroyDescriptorSetLayout = (PFN_vkDestroyDescriptorSetLayout) gpa(baseDevice, "vkDestroyDescriptorSetLayout");
|
||||
table->CreateDescriptorPool = (PFN_vkCreateDescriptorPool) gpa(baseDevice, "vkCreateDescriptorPool");
|
||||
table->DestroyDescriptorPool = (PFN_vkDestroyDescriptorPool) gpa(baseDevice, "vkDestroyDescriptorPool");
|
||||
table->ResetDescriptorPool = (PFN_vkResetDescriptorPool) gpa(baseDevice, "vkResetDescriptorPool");
|
||||
table->AllocDescriptorSets = (PFN_vkAllocDescriptorSets) gpa(baseDevice, "vkAllocDescriptorSets");
|
||||
table->FreeDescriptorSets = (PFN_vkFreeDescriptorSets) gpa(baseDevice, "vkFreeDescriptorSets");
|
||||
table->UpdateDescriptorSets = (PFN_vkUpdateDescriptorSets) gpa(baseDevice, "vkUpdateDescriptorSets");
|
||||
table->CreateDynamicViewportState = (PFN_vkCreateDynamicViewportState) gpa(baseDevice, "vkCreateDynamicViewportState");
|
||||
table->DestroyDynamicViewportState = (PFN_vkDestroyDynamicViewportState) gpa(baseDevice, "vkDestroyDynamicViewportState");
|
||||
table->CreateDynamicRasterState = (PFN_vkCreateDynamicRasterState) gpa(baseDevice, "vkCreateDynamicRasterState");
|
||||
table->DestroyDynamicRasterState = (PFN_vkDestroyDynamicRasterState) gpa(baseDevice, "vkDestroyDynamicRasterState");
|
||||
table->CreateDynamicColorBlendState = (PFN_vkCreateDynamicColorBlendState) gpa(baseDevice, "vkCreateDynamicColorBlendState");
|
||||
table->DestroyDynamicColorBlendState = (PFN_vkDestroyDynamicColorBlendState) gpa(baseDevice, "vkDestroyDynamicColorBlendState");
|
||||
table->CreateDynamicDepthStencilState = (PFN_vkCreateDynamicDepthStencilState) gpa(baseDevice, "vkCreateDynamicDepthStencilState");
|
||||
table->DestroyDynamicDepthStencilState = (PFN_vkDestroyDynamicDepthStencilState) gpa(baseDevice, "vkDestroyDynamicDepthStencilState");
|
||||
table->CreateCommandPool = (PFN_vkCreateCommandPool) gpa(baseDevice, "vkCreateCommandPool");
|
||||
table->DestroyCommandPool = (PFN_vkDestroyCommandPool) gpa(baseDevice, "vkDestroyCommandPool");
|
||||
table->ResetCommandPool = (PFN_vkResetCommandPool) gpa(baseDevice, "vkResetCommandPool");
|
||||
table->CreateCommandBuffer = (PFN_vkCreateCommandBuffer) gpa(baseDevice, "vkCreateCommandBuffer");
|
||||
table->DestroyCommandBuffer = (PFN_vkDestroyCommandBuffer) gpa(baseDevice, "vkDestroyCommandBuffer");
|
||||
table->BeginCommandBuffer = (PFN_vkBeginCommandBuffer) gpa(baseDevice, "vkBeginCommandBuffer");
|
||||
table->EndCommandBuffer = (PFN_vkEndCommandBuffer) gpa(baseDevice, "vkEndCommandBuffer");
|
||||
table->ResetCommandBuffer = (PFN_vkResetCommandBuffer) gpa(baseDevice, "vkResetCommandBuffer");
|
||||
table->CmdBindPipeline = (PFN_vkCmdBindPipeline) gpa(baseDevice, "vkCmdBindPipeline");
|
||||
table->CmdBindDynamicViewportState = (PFN_vkCmdBindDynamicViewportState) gpa(baseDevice, "vkCmdBindDynamicViewportState");
|
||||
table->CmdBindDynamicRasterState = (PFN_vkCmdBindDynamicRasterState) gpa(baseDevice, "vkCmdBindDynamicRasterState");
|
||||
table->CmdBindDynamicColorBlendState = (PFN_vkCmdBindDynamicColorBlendState) gpa(baseDevice, "vkCmdBindDynamicColorBlendState");
|
||||
table->CmdBindDynamicDepthStencilState = (PFN_vkCmdBindDynamicDepthStencilState) gpa(baseDevice, "vkCmdBindDynamicDepthStencilState");
|
||||
table->CmdBindDescriptorSets = (PFN_vkCmdBindDescriptorSets) gpa(baseDevice, "vkCmdBindDescriptorSets");
|
||||
table->CmdBindIndexBuffer = (PFN_vkCmdBindIndexBuffer) gpa(baseDevice, "vkCmdBindIndexBuffer");
|
||||
table->CmdBindVertexBuffers = (PFN_vkCmdBindVertexBuffers) gpa(baseDevice, "vkCmdBindVertexBuffers");
|
||||
table->CmdDraw = (PFN_vkCmdDraw) gpa(baseDevice, "vkCmdDraw");
|
||||
table->CmdDrawIndexed = (PFN_vkCmdDrawIndexed) gpa(baseDevice, "vkCmdDrawIndexed");
|
||||
table->CmdDrawIndirect = (PFN_vkCmdDrawIndirect) gpa(baseDevice, "vkCmdDrawIndirect");
|
||||
table->CmdDrawIndexedIndirect = (PFN_vkCmdDrawIndexedIndirect) gpa(baseDevice, "vkCmdDrawIndexedIndirect");
|
||||
table->CmdDispatch = (PFN_vkCmdDispatch) gpa(baseDevice, "vkCmdDispatch");
|
||||
table->CmdDispatchIndirect = (PFN_vkCmdDispatchIndirect) gpa(baseDevice, "vkCmdDispatchIndirect");
|
||||
table->CmdCopyBuffer = (PFN_vkCmdCopyBuffer) gpa(baseDevice, "vkCmdCopyBuffer");
|
||||
table->CmdCopyImage = (PFN_vkCmdCopyImage) gpa(baseDevice, "vkCmdCopyImage");
|
||||
table->CmdBlitImage = (PFN_vkCmdBlitImage) gpa(baseDevice, "vkCmdBlitImage");
|
||||
table->CmdCopyBufferToImage = (PFN_vkCmdCopyBufferToImage) gpa(baseDevice, "vkCmdCopyBufferToImage");
|
||||
table->CmdCopyImageToBuffer = (PFN_vkCmdCopyImageToBuffer) gpa(baseDevice, "vkCmdCopyImageToBuffer");
|
||||
table->CmdUpdateBuffer = (PFN_vkCmdUpdateBuffer) gpa(baseDevice, "vkCmdUpdateBuffer");
|
||||
table->CmdFillBuffer = (PFN_vkCmdFillBuffer) gpa(baseDevice, "vkCmdFillBuffer");
|
||||
table->CmdClearColorImage = (PFN_vkCmdClearColorImage) gpa(baseDevice, "vkCmdClearColorImage");
|
||||
table->CmdClearDepthStencilImage = (PFN_vkCmdClearDepthStencilImage) gpa(baseDevice, "vkCmdClearDepthStencilImage");
|
||||
table->CmdClearColorAttachment = (PFN_vkCmdClearColorAttachment) gpa(baseDevice, "vkCmdClearColorAttachment");
|
||||
table->CmdClearDepthStencilAttachment = (PFN_vkCmdClearDepthStencilAttachment) gpa(baseDevice, "vkCmdClearDepthStencilAttachment");
|
||||
table->CmdResolveImage = (PFN_vkCmdResolveImage) gpa(baseDevice, "vkCmdResolveImage");
|
||||
table->CmdSetEvent = (PFN_vkCmdSetEvent) gpa(baseDevice, "vkCmdSetEvent");
|
||||
table->CmdResetEvent = (PFN_vkCmdResetEvent) gpa(baseDevice, "vkCmdResetEvent");
|
||||
table->CmdWaitEvents = (PFN_vkCmdWaitEvents) gpa(baseDevice, "vkCmdWaitEvents");
|
||||
table->CmdPipelineBarrier = (PFN_vkCmdPipelineBarrier) gpa(baseDevice, "vkCmdPipelineBarrier");
|
||||
table->CmdBeginQuery = (PFN_vkCmdBeginQuery) gpa(baseDevice, "vkCmdBeginQuery");
|
||||
table->CmdEndQuery = (PFN_vkCmdEndQuery) gpa(baseDevice, "vkCmdEndQuery");
|
||||
table->CmdResetQueryPool = (PFN_vkCmdResetQueryPool) gpa(baseDevice, "vkCmdResetQueryPool");
|
||||
table->CmdWriteTimestamp = (PFN_vkCmdWriteTimestamp) gpa(baseDevice, "vkCmdWriteTimestamp");
|
||||
table->CmdCopyQueryPoolResults = (PFN_vkCmdCopyQueryPoolResults) gpa(baseDevice, "vkCmdCopyQueryPoolResults");
|
||||
table->CreateFramebuffer = (PFN_vkCreateFramebuffer) gpa(baseDevice, "vkCreateFramebuffer");
|
||||
table->DestroyFramebuffer = (PFN_vkDestroyFramebuffer) gpa(baseDevice, "vkDestroyFramebuffer");
|
||||
table->CreateRenderPass = (PFN_vkCreateRenderPass) gpa(baseDevice, "vkCreateRenderPass");
|
||||
table->DestroyRenderPass = (PFN_vkDestroyRenderPass) gpa(baseDevice, "vkDestroyRenderPass");
|
||||
table->GetRenderAreaGranularity = (PFN_vkGetRenderAreaGranularity) gpa(baseDevice, "vkGetRenderAreaGranularity");
|
||||
table->CmdBeginRenderPass = (PFN_vkCmdBeginRenderPass) gpa(baseDevice, "vkCmdBeginRenderPass");
|
||||
table->CmdNextSubpass = (PFN_vkCmdNextSubpass) gpa(baseDevice, "vkCmdNextSubpass");
|
||||
table->CmdPushConstants = (PFN_vkCmdPushConstants) gpa(baseDevice, "vkCmdPushConstants");
|
||||
table->CmdEndRenderPass = (PFN_vkCmdEndRenderPass) gpa(baseDevice, "vkCmdEndRenderPass");
|
||||
table->CmdExecuteCommands = (PFN_vkCmdExecuteCommands) gpa(baseDevice, "vkCmdExecuteCommands");
|
||||
table->GetSurfaceInfoWSI = (PFN_vkGetSurfaceInfoWSI) gpa(baseDevice, "vkGetSurfaceInfoWSI");
|
||||
table->CreateSwapChainWSI = (PFN_vkCreateSwapChainWSI) gpa(baseDevice, "vkCreateSwapChainWSI");
|
||||
table->DestroySwapChainWSI = (PFN_vkDestroySwapChainWSI) gpa(baseDevice, "vkDestroySwapChainWSI");
|
||||
table->GetSwapChainInfoWSI = (PFN_vkGetSwapChainInfoWSI) gpa(baseDevice, "vkGetSwapChainInfoWSI");
|
||||
table->AcquireNextImageWSI = (PFN_vkAcquireNextImageWSI) gpa(baseDevice, "vkAcquireNextImageWSI");
|
||||
table->QueuePresentWSI = (PFN_vkQueuePresentWSI) gpa(baseDevice, "vkQueuePresentWSI");
|
||||
}
|
||||
|
||||
static inline void layer_init_instance_dispatch_table(VkLayerInstanceDispatchTable *table,
|
||||
const VkBaseLayerObject *instw)
|
||||
{
|
||||
VkInstance instance = (VkInstance) instw->nextObject;
|
||||
PFN_vkGetInstanceProcAddr gpa = (PFN_vkGetInstanceProcAddr) instw->pGPA;
|
||||
VkInstance baseInstance = (VkInstance) instw->baseObject;
|
||||
// GPA has to be first entry inited and uses wrapped object since it triggers init
|
||||
memset(table, 0, sizeof(*table));
|
||||
table->GetInstanceProcAddr =(PFN_vkGetInstanceProcAddr) gpa(instance,"vkGetInstanceProcAddr");
|
||||
table->CreateInstance = (PFN_vkCreateInstance) gpa(baseInstance, "vkCreateInstance");
|
||||
table->DestroyInstance = (PFN_vkDestroyInstance) gpa(baseInstance, "vkDestroyInstance");
|
||||
table->EnumeratePhysicalDevices = (PFN_vkEnumeratePhysicalDevices) gpa(baseInstance, "vkEnumeratePhysicalDevices");
|
||||
table->GetPhysicalDeviceFeatures = (PFN_vkGetPhysicalDeviceFeatures) gpa(baseInstance, "vkGetPhysicalDeviceFeatures");
|
||||
table->GetPhysicalDeviceFormatProperties = (PFN_vkGetPhysicalDeviceFormatProperties) gpa(baseInstance, "vkGetPhysicalDeviceFormatProperties");
|
||||
table->GetPhysicalDeviceImageFormatProperties = (PFN_vkGetPhysicalDeviceImageFormatProperties) gpa(baseInstance, "vkGetPhysicalDeviceImageFormatProperties");
|
||||
table->GetPhysicalDeviceLimits = (PFN_vkGetPhysicalDeviceLimits) gpa(baseInstance, "vkGetPhysicalDeviceLimits");
|
||||
table->GetPhysicalDeviceProperties = (PFN_vkGetPhysicalDeviceProperties) gpa(baseInstance, "vkGetPhysicalDeviceProperties");
|
||||
table->GetPhysicalDeviceQueueCount = (PFN_vkGetPhysicalDeviceQueueCount) gpa(baseInstance, "vkGetPhysicalDeviceQueueCount");
|
||||
table->GetPhysicalDeviceQueueProperties = (PFN_vkGetPhysicalDeviceQueueProperties) gpa(baseInstance, "vkGetPhysicalDeviceQueueProperties");
|
||||
table->GetPhysicalDeviceMemoryProperties = (PFN_vkGetPhysicalDeviceMemoryProperties) gpa(baseInstance, "vkGetPhysicalDeviceMemoryProperties");
|
||||
table->GetPhysicalDeviceExtensionProperties = (PFN_vkGetPhysicalDeviceExtensionProperties) gpa(baseInstance, "vkGetPhysicalDeviceExtensionProperties");
|
||||
table->GetPhysicalDeviceLayerProperties = (PFN_vkGetPhysicalDeviceLayerProperties) gpa(baseInstance, "vkGetPhysicalDeviceLayerProperties");
|
||||
table->GetPhysicalDeviceSparseImageFormatProperties = (PFN_vkGetPhysicalDeviceSparseImageFormatProperties) gpa(baseInstance, "vkGetPhysicalDeviceSparseImageFormatProperties");
|
||||
table->GetPhysicalDeviceSurfaceSupportWSI = (PFN_vkGetPhysicalDeviceSurfaceSupportWSI) gpa(baseInstance, "vkGetPhysicalDeviceSurfaceSupportWSI");
|
||||
}
|
||||
@@ -1,45 +0,0 @@
|
||||
//
|
||||
// File: vk_debug_marker_lunarg.h
|
||||
//
|
||||
/*
|
||||
** Copyright (c) 2015 The Khronos Group Inc.
|
||||
**
|
||||
** Permission is hereby granted, free of charge, to any person obtaining a
|
||||
** copy of this software and/or associated documentation files (the
|
||||
** "Materials"), to deal in the Materials without restriction, including
|
||||
** without limitation the rights to use, copy, modify, merge, publish,
|
||||
** distribute, sublicense, and/or sell copies of the Materials, and to
|
||||
** permit persons to whom the Materials are furnished to do so, subject to
|
||||
** the following conditions:
|
||||
**
|
||||
** The above copyright notice and this permission notice shall be included
|
||||
** in all copies or substantial portions of the Materials.
|
||||
**
|
||||
** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
|
||||
**
|
||||
** Authors:
|
||||
** Jon Ashburn <jon@lunarg.com>
|
||||
** Courtney Goeltzenleuchter <courtney@lunarg.com>
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "vulkan.h"
|
||||
#include "vk_debug_marker_lunarg.h"
|
||||
#include "vk_layer.h"
|
||||
|
||||
|
||||
typedef struct VkLayerDebugMarkerDispatchTable_
|
||||
{
|
||||
|
||||
PFN_vkCmdDbgMarkerBegin CmdDbgMarkerBegin;
|
||||
PFN_vkCmdDbgMarkerEnd CmdDbgMarkerEnd;
|
||||
PFN_vkDbgSetObjectTag DbgSetObjectTag;
|
||||
PFN_vkDbgSetObjectName DbgSetObjectName;
|
||||
} VkLayerDebugMarkerDispatchTable;
|
||||
@@ -1,98 +0,0 @@
|
||||
//
|
||||
// File: vk_debug_marker_lunarg.h
|
||||
//
|
||||
/*
|
||||
** Copyright (c) 2015 The Khronos Group Inc.
|
||||
**
|
||||
** Permission is hereby granted, free of charge, to any person obtaining a
|
||||
** copy of this software and/or associated documentation files (the
|
||||
** "Materials"), to deal in the Materials without restriction, including
|
||||
** without limitation the rights to use, copy, modify, merge, publish,
|
||||
** distribute, sublicense, and/or sell copies of the Materials, and to
|
||||
** permit persons to whom the Materials are furnished to do so, subject to
|
||||
** the following conditions:
|
||||
**
|
||||
** The above copyright notice and this permission notice shall be included
|
||||
** in all copies or substantial portions of the Materials.
|
||||
**
|
||||
** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
|
||||
**
|
||||
** Authors:
|
||||
** Jon Ashburn <jon@lunarg.com>
|
||||
** Courtney Goeltzenleuchter <courtney@lunarg.com>
|
||||
*/
|
||||
|
||||
#ifndef __VK_DEBUG_MARKER_H__
|
||||
#define __VK_DEBUG_MARKER_H__
|
||||
|
||||
#include "vulkan.h"
|
||||
#include "vk_debug_report_lunarg.h"
|
||||
|
||||
#define VK_DEBUG_MARKER_EXTENSION_NUMBER 3
|
||||
#define VK_DEBUG_MARKER_EXTENSION_VERSION VK_MAKE_VERSION(0, 1, 0)
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif // __cplusplus
|
||||
|
||||
/*
|
||||
***************************************************************************************************
|
||||
* DebugMarker Vulkan Extension API
|
||||
***************************************************************************************************
|
||||
*/
|
||||
|
||||
#define DEBUG_MARKER_EXTENSION_NAME "DEBUG_MARKER"
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// Enumerations
|
||||
|
||||
#define VK_DEBUG_MARKER_ENUM_EXTEND(type, id) ((type)(VK_DEBUG_MARKER_EXTENSION_NUMBER * -1000 + (id)))
|
||||
|
||||
#define VK_OBJECT_INFO_TYPE_DBG_OBJECT_TAG VK_DEBUG_MARKER_ENUM_EXTEND(VkDbgObjectInfoType, 0)
|
||||
#define VK_OBJECT_INFO_TYPE_DBG_OBJECT_NAME VK_DEBUG_MARKER_ENUM_EXTEND(VkDbgObjectInfoType, 1)
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// API functions
|
||||
|
||||
typedef void (VKAPI *PFN_vkCmdDbgMarkerBegin)(VkCmdBuffer cmdBuffer, const char* pMarker);
|
||||
typedef void (VKAPI *PFN_vkCmdDbgMarkerEnd)(VkCmdBuffer cmdBuffer);
|
||||
typedef VkResult (VKAPI *PFN_vkDbgSetObjectTag)(VkDevice device, VkDbgObjectType objType, uint64_t object, size_t tagSize, const void* pTag);
|
||||
typedef VkResult (VKAPI *PFN_vkDbgSetObjectName)(VkDevice device, VkDbgObjectType objType, uint64_t object, size_t nameSize, const char* pName);
|
||||
|
||||
#ifdef VK_PROTOTYPES
|
||||
|
||||
// DebugMarker extension entrypoints
|
||||
void VKAPI vkCmdDbgMarkerBegin(
|
||||
VkCmdBuffer cmdBuffer,
|
||||
const char* pMarker);
|
||||
|
||||
void VKAPI vkCmdDbgMarkerEnd(
|
||||
VkCmdBuffer cmdBuffer);
|
||||
|
||||
VkResult VKAPI vkDbgSetObjectTag(
|
||||
VkDevice device,
|
||||
VkDbgObjectType objType,
|
||||
uint64_t object,
|
||||
size_t tagSize,
|
||||
const void* pTag);
|
||||
|
||||
VkResult VKAPI vkDbgSetObjectName(
|
||||
VkDevice device,
|
||||
VkDbgObjectType objType,
|
||||
uint64_t object,
|
||||
size_t nameSize,
|
||||
const char* pName);
|
||||
|
||||
#endif // VK_PROTOTYPES
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif // __cplusplus
|
||||
|
||||
#endif // __VK_DEBUG_MARKER_H__
|
||||
@@ -1,256 +0,0 @@
|
||||
//
|
||||
// File: vk_debug_report_lunarg.h
|
||||
//
|
||||
/*
|
||||
* Vulkan
|
||||
*
|
||||
* Copyright (C) 2015 LunarG, Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* Authors:
|
||||
* Jon Ashburn <jon@lunarg.com>
|
||||
* Courtney Goeltzenleuchter <courtney@lunarg.com>
|
||||
*/
|
||||
|
||||
#ifndef __VK_DEBUG_REPORT_LUNARG_H__
|
||||
#define __VK_DEBUG_REPORT_LUNARG_H__
|
||||
|
||||
#include "vulkan.h"
|
||||
|
||||
#define VK_DEBUG_REPORT_EXTENSION_NUMBER 2
|
||||
#define VK_DEBUG_REPORT_EXTENSION_VERSION VK_MAKE_VERSION(0, 1, 0)
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif // __cplusplus
|
||||
|
||||
/*
|
||||
***************************************************************************************************
|
||||
* DebugReport Vulkan Extension API
|
||||
***************************************************************************************************
|
||||
*/
|
||||
typedef enum {
|
||||
VK_OBJECT_TYPE_INSTANCE = 0,
|
||||
VK_OBJECT_TYPE_PHYSICAL_DEVICE = 1,
|
||||
VK_OBJECT_TYPE_DEVICE = 2,
|
||||
VK_OBJECT_TYPE_QUEUE = 3,
|
||||
VK_OBJECT_TYPE_COMMAND_BUFFER = 4,
|
||||
VK_OBJECT_TYPE_DEVICE_MEMORY = 5,
|
||||
VK_OBJECT_TYPE_BUFFER = 6,
|
||||
VK_OBJECT_TYPE_BUFFER_VIEW = 7,
|
||||
VK_OBJECT_TYPE_IMAGE = 8,
|
||||
VK_OBJECT_TYPE_IMAGE_VIEW = 9,
|
||||
VK_OBJECT_TYPE_ATTACHMENT_VIEW = 10,
|
||||
VK_OBJECT_TYPE_SHADER_MODULE = 12,
|
||||
VK_OBJECT_TYPE_SHADER = 13,
|
||||
VK_OBJECT_TYPE_PIPELINE = 14,
|
||||
VK_OBJECT_TYPE_PIPELINE_LAYOUT = 15,
|
||||
VK_OBJECT_TYPE_SAMPLER = 16,
|
||||
VK_OBJECT_TYPE_DESCRIPTOR_SET = 17,
|
||||
VK_OBJECT_TYPE_DESCRIPTOR_SET_LAYOUT = 18,
|
||||
VK_OBJECT_TYPE_DESCRIPTOR_POOL = 19,
|
||||
VK_OBJECT_TYPE_DYNAMIC_VIEWPORT_STATE = 20,
|
||||
VK_OBJECT_TYPE_DYNAMIC_RASTER_STATE = 21,
|
||||
VK_OBJECT_TYPE_DYNAMIC_COLOR_BLEND_STATE = 22,
|
||||
VK_OBJECT_TYPE_DYNAMIC_DEPTH_STENCIL_STATE = 23,
|
||||
VK_OBJECT_TYPE_FENCE = 24,
|
||||
VK_OBJECT_TYPE_SEMAPHORE = 25,
|
||||
VK_OBJECT_TYPE_EVENT = 26,
|
||||
VK_OBJECT_TYPE_QUERY_POOL = 27,
|
||||
VK_OBJECT_TYPE_FRAMEBUFFER = 28,
|
||||
VK_OBJECT_TYPE_RENDER_PASS = 29,
|
||||
VK_OBJECT_TYPE_PIPELINE_CACHE = 30,
|
||||
VK_OBJECT_TYPE_SWAP_CHAIN_WSI = 31,
|
||||
VK_OBJECT_TYPE_CMD_POOL = 32,
|
||||
VK_OBJECT_TYPE_BEGIN_RANGE = VK_OBJECT_TYPE_INSTANCE,
|
||||
VK_OBJECT_TYPE_END_RANGE = VK_OBJECT_TYPE_CMD_POOL,
|
||||
VK_OBJECT_TYPE_NUM = (VK_OBJECT_TYPE_CMD_POOL - VK_OBJECT_TYPE_INSTANCE + 1),
|
||||
VK_OBJECT_TYPE_MAX_ENUM = 0x7FFFFFFF
|
||||
} VkDbgObjectType;
|
||||
|
||||
static inline const char* string_VkDbgObjectType(VkDbgObjectType input_value)
|
||||
{
|
||||
switch ((VkDbgObjectType)input_value)
|
||||
{
|
||||
case VK_OBJECT_TYPE_CMD_POOL:
|
||||
return "VK_OBJECT_TYPE_CMD_POOL";
|
||||
case VK_OBJECT_TYPE_BUFFER:
|
||||
return "VK_OBJECT_TYPE_BUFFER";
|
||||
case VK_OBJECT_TYPE_BUFFER_VIEW:
|
||||
return "VK_OBJECT_TYPE_BUFFER_VIEW";
|
||||
case VK_OBJECT_TYPE_ATTACHMENT_VIEW:
|
||||
return "VK_OBJECT_TYPE_ATTACHMENT_VIEW";
|
||||
case VK_OBJECT_TYPE_COMMAND_BUFFER:
|
||||
return "VK_OBJECT_TYPE_COMMAND_BUFFER";
|
||||
case VK_OBJECT_TYPE_DESCRIPTOR_POOL:
|
||||
return "VK_OBJECT_TYPE_DESCRIPTOR_POOL";
|
||||
case VK_OBJECT_TYPE_DESCRIPTOR_SET:
|
||||
return "VK_OBJECT_TYPE_DESCRIPTOR_SET";
|
||||
case VK_OBJECT_TYPE_DESCRIPTOR_SET_LAYOUT:
|
||||
return "VK_OBJECT_TYPE_DESCRIPTOR_SET_LAYOUT";
|
||||
case VK_OBJECT_TYPE_DEVICE:
|
||||
return "VK_OBJECT_TYPE_DEVICE";
|
||||
case VK_OBJECT_TYPE_DEVICE_MEMORY:
|
||||
return "VK_OBJECT_TYPE_DEVICE_MEMORY";
|
||||
case VK_OBJECT_TYPE_DYNAMIC_COLOR_BLEND_STATE:
|
||||
return "VK_OBJECT_TYPE_DYNAMIC_COLOR_BLEND_STATE";
|
||||
case VK_OBJECT_TYPE_DYNAMIC_DEPTH_STENCIL_STATE:
|
||||
return "VK_OBJECT_TYPE_DYNAMIC_DEPTH_STENCIL_STATE";
|
||||
case VK_OBJECT_TYPE_DYNAMIC_RASTER_STATE:
|
||||
return "VK_OBJECT_TYPE_DYNAMIC_RASTER_STATE";
|
||||
case VK_OBJECT_TYPE_DYNAMIC_VIEWPORT_STATE:
|
||||
return "VK_OBJECT_TYPE_DYNAMIC_VIEPORT_STATE";
|
||||
case VK_OBJECT_TYPE_EVENT:
|
||||
return "VK_OBJECT_TYPE_EVENT";
|
||||
case VK_OBJECT_TYPE_FENCE:
|
||||
return "VK_OBJECT_TYPE_FENCE";
|
||||
case VK_OBJECT_TYPE_FRAMEBUFFER:
|
||||
return "VK_OBJECT_TYPE_FRAMEBUFFER";
|
||||
case VK_OBJECT_TYPE_IMAGE:
|
||||
return "VK_OBJECT_TYPE_IMAGE";
|
||||
case VK_OBJECT_TYPE_IMAGE_VIEW:
|
||||
return "VK_OBJECT_TYPE_IMAGE_VIEW";
|
||||
case VK_OBJECT_TYPE_INSTANCE:
|
||||
return "VK_OBJECT_TYPE_INSTANCE";
|
||||
case VK_OBJECT_TYPE_PHYSICAL_DEVICE:
|
||||
return "VK_OBJECT_TYPE_PHYSICAL_DEVICE";
|
||||
case VK_OBJECT_TYPE_PIPELINE:
|
||||
return "VK_OBJECT_TYPE_PIPELINE";
|
||||
case VK_OBJECT_TYPE_PIPELINE_LAYOUT:
|
||||
return "VK_OBJECT_TYPE_PIPELINE_LAYOUT";
|
||||
case VK_OBJECT_TYPE_PIPELINE_CACHE:
|
||||
return "VK_OBJECT_TYPE_PIPELINE_CACHE";
|
||||
case VK_OBJECT_TYPE_QUERY_POOL:
|
||||
return "VK_OBJECT_TYPE_QUERY_POOL";
|
||||
case VK_OBJECT_TYPE_QUEUE:
|
||||
return "VK_OBJECT_TYPE_QUEUE";
|
||||
case VK_OBJECT_TYPE_RENDER_PASS:
|
||||
return "VK_OBJECT_TYPE_RENDER_PASS";
|
||||
case VK_OBJECT_TYPE_SAMPLER:
|
||||
return "VK_OBJECT_TYPE_SAMPLER";
|
||||
case VK_OBJECT_TYPE_SEMAPHORE:
|
||||
return "VK_OBJECT_TYPE_SEMAPHORE";
|
||||
case VK_OBJECT_TYPE_SHADER:
|
||||
return "VK_OBJECT_TYPE_SHADER";
|
||||
case VK_OBJECT_TYPE_SHADER_MODULE:
|
||||
return "VK_OBJECT_TYPE_SHADER_MODULE";
|
||||
case VK_OBJECT_TYPE_SWAP_CHAIN_WSI:
|
||||
return "VK_OBJECT_TYPE_SWAP_CHAIN_WSI";
|
||||
default:
|
||||
return "Unhandled VkObjectType";
|
||||
}
|
||||
}
|
||||
#define VK_DEBUG_REPORT_EXTENSION_NAME "DEBUG_REPORT"
|
||||
|
||||
VK_DEFINE_NONDISP_HANDLE(VkDbgMsgCallback)
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// Enumerations
|
||||
|
||||
typedef enum VkDbgReportFlags_
|
||||
{
|
||||
VK_DBG_REPORT_INFO_BIT = 0x0001,
|
||||
VK_DBG_REPORT_WARN_BIT = 0x0002,
|
||||
VK_DBG_REPORT_PERF_WARN_BIT = 0x0004,
|
||||
VK_DBG_REPORT_ERROR_BIT = 0x0008,
|
||||
VK_DBG_REPORT_DEBUG_BIT = 0x0010,
|
||||
} VkDbgReportFlags;
|
||||
|
||||
// Debug Report ERROR codes
|
||||
typedef enum _DEBUG_REPORT_ERROR
|
||||
{
|
||||
DEBUG_REPORT_NONE, // Used for INFO & other non-error messages
|
||||
DEBUG_REPORT_CALLBACK_REF, // Callbacks were not destroyed prior to calling DestroyInstance
|
||||
} DEBUG_REPORT_ERROR;
|
||||
|
||||
#define VK_DEBUG_REPORT_ENUM_EXTEND(type, id) ((type)(VK_DEBUG_REPORT_EXTENSION_NUMBER * -1000 + (id)))
|
||||
|
||||
#define VK_OBJECT_TYPE_MSG_CALLBACK VK_DEBUG_REPORT_ENUM_EXTEND(VkDbgObjectType, 0)
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// Vulkan function pointers
|
||||
|
||||
typedef void (*PFN_vkDbgMsgCallback)(
|
||||
VkFlags msgFlags,
|
||||
VkDbgObjectType objType,
|
||||
uint64_t srcObject,
|
||||
size_t location,
|
||||
int32_t msgCode,
|
||||
const char* pLayerPrefix,
|
||||
const char* pMsg,
|
||||
void* pUserData);
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// API functions
|
||||
|
||||
typedef VkResult (VKAPI *PFN_vkDbgCreateMsgCallback)(VkInstance instance, VkFlags msgFlags, const PFN_vkDbgMsgCallback pfnMsgCallback, const void* pUserData, VkDbgMsgCallback* pMsgCallback);
|
||||
typedef VkResult (VKAPI *PFN_vkDbgDestroyMsgCallback)(VkInstance instance, VkDbgMsgCallback msgCallback);
|
||||
|
||||
#ifdef VK_PROTOTYPES
|
||||
|
||||
// DebugReport extension entrypoints
|
||||
VkResult VKAPI vkDbgCreateMsgCallback(
|
||||
VkInstance instance,
|
||||
VkFlags msgFlags,
|
||||
const PFN_vkDbgMsgCallback pfnMsgCallback,
|
||||
void* pUserData,
|
||||
VkDbgMsgCallback* pMsgCallback);
|
||||
|
||||
VkResult VKAPI vkDbgDestroyMsgCallback(
|
||||
VkInstance instance,
|
||||
VkDbgMsgCallback msgCallback);
|
||||
|
||||
// DebugReport utility callback functions
|
||||
void VKAPI vkDbgStringCallback(
|
||||
VkFlags msgFlags,
|
||||
VkDbgObjectType objType,
|
||||
uint64_t srcObject,
|
||||
size_t location,
|
||||
int32_t msgCode,
|
||||
const char* pLayerPrefix,
|
||||
const char* pMsg,
|
||||
void* pUserData);
|
||||
|
||||
void VKAPI vkDbgStdioCallback(
|
||||
VkFlags msgFlags,
|
||||
VkDbgObjectType objType,
|
||||
uint64_t srcObject,
|
||||
size_t location,
|
||||
int32_t msgCode,
|
||||
const char* pLayerPrefix,
|
||||
const char* pMsg,
|
||||
void* pUserData);
|
||||
|
||||
void VKAPI vkDbgBreakCallback(
|
||||
VkFlags msgFlags,
|
||||
VkDbgObjectType objType,
|
||||
uint64_t srcObject,
|
||||
size_t location,
|
||||
int32_t msgCode,
|
||||
const char* pLayerPrefix,
|
||||
const char* pMsg,
|
||||
void* pUserData);
|
||||
|
||||
#endif // VK_PROTOTYPES
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif // __cplusplus
|
||||
|
||||
#endif // __VK_DEBUG_REPORT_LUNARG_H__
|
||||
@@ -1,32 +0,0 @@
|
||||
#ifndef VKICD_H
|
||||
#define VKICD_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include "vk_platform.h"
|
||||
|
||||
/*
|
||||
* The ICD must reserve space for a pointer for the loader's dispatch
|
||||
* table, at the start of <each object>.
|
||||
* The ICD must initialize this variable using the SET_LOADER_MAGIC_VALUE macro.
|
||||
*/
|
||||
|
||||
#define ICD_LOADER_MAGIC 0x01CDC0DE
|
||||
|
||||
typedef union _VK_LOADER_DATA {
|
||||
uintptr_t loaderMagic;
|
||||
void *loaderData;
|
||||
} VK_LOADER_DATA;
|
||||
|
||||
static inline void set_loader_magic_value(void* pNewObject) {
|
||||
VK_LOADER_DATA *loader_info = (VK_LOADER_DATA *) pNewObject;
|
||||
loader_info->loaderMagic = ICD_LOADER_MAGIC;
|
||||
}
|
||||
|
||||
static inline bool valid_loader_magic_value(void* pNewObject) {
|
||||
const VK_LOADER_DATA *loader_info = (VK_LOADER_DATA *) pNewObject;
|
||||
return (loader_info->loaderMagic & 0xffffffff) == ICD_LOADER_MAGIC;
|
||||
}
|
||||
|
||||
#endif // VKICD_H
|
||||
|
||||
@@ -1,217 +0,0 @@
|
||||
/* Need to define dispatch table
|
||||
* Core struct can then have ptr to dispatch table at the top
|
||||
* Along with object ptrs for current and next OBJ
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "vulkan.h"
|
||||
#include "vk_debug_report_lunarg.h"
|
||||
#include "vk_debug_marker_lunarg.h"
|
||||
#include "vk_wsi_swapchain.h"
|
||||
#include "vk_wsi_device_swapchain.h"
|
||||
#if defined(__GNUC__) && __GNUC__ >= 4
|
||||
# define VK_LAYER_EXPORT __attribute__((visibility("default")))
|
||||
#elif defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590)
|
||||
# define VK_LAYER_EXPORT __attribute__((visibility("default")))
|
||||
#else
|
||||
# define VK_LAYER_EXPORT
|
||||
#endif
|
||||
|
||||
typedef void * (*PFN_vkGPA)(void* obj, const char * pName);
|
||||
|
||||
typedef struct VkBaseLayerObject_
|
||||
{
|
||||
PFN_vkGPA pGPA;
|
||||
void* nextObject;
|
||||
void* baseObject;
|
||||
} VkBaseLayerObject;
|
||||
|
||||
typedef struct VkLayerDispatchTable_
|
||||
{
|
||||
PFN_vkGetDeviceProcAddr GetDeviceProcAddr;
|
||||
PFN_vkCreateDevice CreateDevice;
|
||||
PFN_vkDestroyDevice DestroyDevice;
|
||||
PFN_vkGetDeviceQueue GetDeviceQueue;
|
||||
PFN_vkQueueSubmit QueueSubmit;
|
||||
PFN_vkQueueWaitIdle QueueWaitIdle;
|
||||
PFN_vkDeviceWaitIdle DeviceWaitIdle;
|
||||
PFN_vkAllocMemory AllocMemory;
|
||||
PFN_vkFreeMemory FreeMemory;
|
||||
PFN_vkMapMemory MapMemory;
|
||||
PFN_vkUnmapMemory UnmapMemory;
|
||||
PFN_vkFlushMappedMemoryRanges FlushMappedMemoryRanges;
|
||||
PFN_vkInvalidateMappedMemoryRanges InvalidateMappedMemoryRanges;
|
||||
PFN_vkGetDeviceMemoryCommitment GetDeviceMemoryCommitment;
|
||||
PFN_vkGetImageSparseMemoryRequirements GetImageSparseMemoryRequirements;
|
||||
PFN_vkGetImageMemoryRequirements GetImageMemoryRequirements;
|
||||
PFN_vkGetBufferMemoryRequirements GetBufferMemoryRequirements;
|
||||
PFN_vkBindImageMemory BindImageMemory;
|
||||
PFN_vkBindBufferMemory BindBufferMemory;
|
||||
PFN_vkQueueBindSparseBufferMemory QueueBindSparseBufferMemory;
|
||||
PFN_vkQueueBindSparseImageOpaqueMemory QueueBindSparseImageOpaqueMemory;
|
||||
PFN_vkQueueBindSparseImageMemory QueueBindSparseImageMemory;
|
||||
PFN_vkCreateFence CreateFence;
|
||||
PFN_vkDestroyFence DestroyFence;
|
||||
PFN_vkGetFenceStatus GetFenceStatus;
|
||||
PFN_vkResetFences ResetFences;
|
||||
PFN_vkWaitForFences WaitForFences;
|
||||
PFN_vkCreateSemaphore CreateSemaphore;
|
||||
PFN_vkDestroySemaphore DestroySemaphore;
|
||||
PFN_vkQueueSignalSemaphore QueueSignalSemaphore;
|
||||
PFN_vkQueueWaitSemaphore QueueWaitSemaphore;
|
||||
PFN_vkCreateEvent CreateEvent;
|
||||
PFN_vkDestroyEvent DestroyEvent;
|
||||
PFN_vkGetEventStatus GetEventStatus;
|
||||
PFN_vkSetEvent SetEvent;
|
||||
PFN_vkResetEvent ResetEvent;
|
||||
PFN_vkCreateQueryPool CreateQueryPool;
|
||||
PFN_vkDestroyQueryPool DestroyQueryPool;
|
||||
PFN_vkGetQueryPoolResults GetQueryPoolResults;
|
||||
PFN_vkCreateBuffer CreateBuffer;
|
||||
PFN_vkDestroyBuffer DestroyBuffer;
|
||||
PFN_vkCreateBufferView CreateBufferView;
|
||||
PFN_vkDestroyBufferView DestroyBufferView;
|
||||
PFN_vkCreateImage CreateImage;
|
||||
PFN_vkDestroyImage DestroyImage;
|
||||
PFN_vkGetImageSubresourceLayout GetImageSubresourceLayout;
|
||||
PFN_vkCreateImageView CreateImageView;
|
||||
PFN_vkDestroyImageView DestroyImageView;
|
||||
PFN_vkCreateAttachmentView CreateAttachmentView;
|
||||
PFN_vkDestroyAttachmentView DestroyAttachmentView;
|
||||
PFN_vkCreateShaderModule CreateShaderModule;
|
||||
PFN_vkDestroyShaderModule DestroyShaderModule;
|
||||
PFN_vkCreateShader CreateShader;
|
||||
PFN_vkDestroyShader DestroyShader;
|
||||
PFN_vkCreatePipelineCache CreatePipelineCache;
|
||||
PFN_vkDestroyPipelineCache DestroyPipelineCache;
|
||||
PFN_vkGetPipelineCacheSize GetPipelineCacheSize;
|
||||
PFN_vkGetPipelineCacheData GetPipelineCacheData;
|
||||
PFN_vkMergePipelineCaches MergePipelineCaches;
|
||||
PFN_vkCreateGraphicsPipelines CreateGraphicsPipelines;
|
||||
PFN_vkCreateComputePipelines CreateComputePipelines;
|
||||
PFN_vkDestroyPipeline DestroyPipeline;
|
||||
PFN_vkCreatePipelineLayout CreatePipelineLayout;
|
||||
PFN_vkDestroyPipelineLayout DestroyPipelineLayout;
|
||||
PFN_vkCreateSampler CreateSampler;
|
||||
PFN_vkDestroySampler DestroySampler;
|
||||
PFN_vkCreateDescriptorSetLayout CreateDescriptorSetLayout;
|
||||
PFN_vkDestroyDescriptorSetLayout DestroyDescriptorSetLayout;
|
||||
PFN_vkCreateDescriptorPool CreateDescriptorPool;
|
||||
PFN_vkDestroyDescriptorPool DestroyDescriptorPool;
|
||||
PFN_vkResetDescriptorPool ResetDescriptorPool;
|
||||
PFN_vkAllocDescriptorSets AllocDescriptorSets;
|
||||
PFN_vkFreeDescriptorSets FreeDescriptorSets;
|
||||
PFN_vkUpdateDescriptorSets UpdateDescriptorSets;
|
||||
PFN_vkCreateDynamicViewportState CreateDynamicViewportState;
|
||||
PFN_vkDestroyDynamicViewportState DestroyDynamicViewportState;
|
||||
PFN_vkCreateDynamicRasterState CreateDynamicRasterState;
|
||||
PFN_vkDestroyDynamicRasterState DestroyDynamicRasterState;
|
||||
PFN_vkCreateDynamicColorBlendState CreateDynamicColorBlendState;
|
||||
PFN_vkDestroyDynamicColorBlendState DestroyDynamicColorBlendState;
|
||||
PFN_vkCreateDynamicDepthStencilState CreateDynamicDepthStencilState;
|
||||
PFN_vkDestroyDynamicDepthStencilState DestroyDynamicDepthStencilState;
|
||||
PFN_vkCreateFramebuffer CreateFramebuffer;
|
||||
PFN_vkDestroyFramebuffer DestroyFramebuffer;
|
||||
PFN_vkCreateRenderPass CreateRenderPass;
|
||||
PFN_vkDestroyRenderPass DestroyRenderPass;
|
||||
PFN_vkGetRenderAreaGranularity GetRenderAreaGranularity;
|
||||
PFN_vkCreateCommandPool CreateCommandPool;
|
||||
PFN_vkDestroyCommandPool DestroyCommandPool;
|
||||
PFN_vkResetCommandPool ResetCommandPool;
|
||||
PFN_vkCreateCommandBuffer CreateCommandBuffer;
|
||||
PFN_vkDestroyCommandBuffer DestroyCommandBuffer;
|
||||
PFN_vkBeginCommandBuffer BeginCommandBuffer;
|
||||
PFN_vkEndCommandBuffer EndCommandBuffer;
|
||||
PFN_vkResetCommandBuffer ResetCommandBuffer;
|
||||
PFN_vkCmdBindPipeline CmdBindPipeline;
|
||||
PFN_vkCmdBindDynamicViewportState CmdBindDynamicViewportState;
|
||||
PFN_vkCmdBindDynamicRasterState CmdBindDynamicRasterState;
|
||||
PFN_vkCmdBindDynamicColorBlendState CmdBindDynamicColorBlendState;
|
||||
PFN_vkCmdBindDynamicDepthStencilState CmdBindDynamicDepthStencilState;
|
||||
PFN_vkCmdBindDescriptorSets CmdBindDescriptorSets;
|
||||
PFN_vkCmdBindVertexBuffers CmdBindVertexBuffers;
|
||||
PFN_vkCmdBindIndexBuffer CmdBindIndexBuffer;
|
||||
PFN_vkCmdDraw CmdDraw;
|
||||
PFN_vkCmdDrawIndexed CmdDrawIndexed;
|
||||
PFN_vkCmdDrawIndirect CmdDrawIndirect;
|
||||
PFN_vkCmdDrawIndexedIndirect CmdDrawIndexedIndirect;
|
||||
PFN_vkCmdDispatch CmdDispatch;
|
||||
PFN_vkCmdDispatchIndirect CmdDispatchIndirect;
|
||||
PFN_vkCmdCopyBuffer CmdCopyBuffer;
|
||||
PFN_vkCmdCopyImage CmdCopyImage;
|
||||
PFN_vkCmdBlitImage CmdBlitImage;
|
||||
PFN_vkCmdCopyBufferToImage CmdCopyBufferToImage;
|
||||
PFN_vkCmdCopyImageToBuffer CmdCopyImageToBuffer;
|
||||
PFN_vkCmdUpdateBuffer CmdUpdateBuffer;
|
||||
PFN_vkCmdFillBuffer CmdFillBuffer;
|
||||
PFN_vkCmdClearColorImage CmdClearColorImage;
|
||||
PFN_vkCmdClearDepthStencilImage CmdClearDepthStencilImage;
|
||||
PFN_vkCmdClearColorAttachment CmdClearColorAttachment;
|
||||
PFN_vkCmdClearDepthStencilAttachment CmdClearDepthStencilAttachment;
|
||||
PFN_vkCmdResolveImage CmdResolveImage;
|
||||
PFN_vkCmdSetEvent CmdSetEvent;
|
||||
PFN_vkCmdResetEvent CmdResetEvent;
|
||||
PFN_vkCmdWaitEvents CmdWaitEvents;
|
||||
PFN_vkCmdPipelineBarrier CmdPipelineBarrier;
|
||||
PFN_vkCmdBeginQuery CmdBeginQuery;
|
||||
PFN_vkCmdEndQuery CmdEndQuery;
|
||||
PFN_vkCmdResetQueryPool CmdResetQueryPool;
|
||||
PFN_vkCmdWriteTimestamp CmdWriteTimestamp;
|
||||
PFN_vkCmdCopyQueryPoolResults CmdCopyQueryPoolResults;
|
||||
PFN_vkCmdPushConstants CmdPushConstants;
|
||||
PFN_vkCmdBeginRenderPass CmdBeginRenderPass;
|
||||
PFN_vkCmdNextSubpass CmdNextSubpass;
|
||||
PFN_vkCmdEndRenderPass CmdEndRenderPass;
|
||||
PFN_vkCmdExecuteCommands CmdExecuteCommands;
|
||||
PFN_vkGetSurfaceInfoWSI GetSurfaceInfoWSI;
|
||||
PFN_vkCreateSwapChainWSI CreateSwapChainWSI;
|
||||
PFN_vkDestroySwapChainWSI DestroySwapChainWSI;
|
||||
PFN_vkGetSwapChainInfoWSI GetSwapChainInfoWSI;
|
||||
PFN_vkAcquireNextImageWSI AcquireNextImageWSI;
|
||||
PFN_vkQueuePresentWSI QueuePresentWSI;
|
||||
PFN_vkDbgCreateMsgCallback DbgCreateMsgCallback;
|
||||
PFN_vkDbgDestroyMsgCallback DbgDestroyMsgCallback;
|
||||
} VkLayerDispatchTable;
|
||||
|
||||
typedef struct VkLayerInstanceDispatchTable_
|
||||
{
|
||||
PFN_vkGetInstanceProcAddr GetInstanceProcAddr;
|
||||
PFN_vkCreateInstance CreateInstance;
|
||||
PFN_vkDestroyInstance DestroyInstance;
|
||||
PFN_vkEnumeratePhysicalDevices EnumeratePhysicalDevices;
|
||||
PFN_vkGetPhysicalDeviceFeatures GetPhysicalDeviceFeatures;
|
||||
PFN_vkGetPhysicalDeviceImageFormatProperties GetPhysicalDeviceImageFormatProperties;
|
||||
PFN_vkGetPhysicalDeviceFormatProperties GetPhysicalDeviceFormatProperties;
|
||||
PFN_vkGetPhysicalDeviceLimits GetPhysicalDeviceLimits;
|
||||
PFN_vkGetPhysicalDeviceSparseImageFormatProperties GetPhysicalDeviceSparseImageFormatProperties;
|
||||
PFN_vkGetPhysicalDeviceProperties GetPhysicalDeviceProperties;
|
||||
PFN_vkGetPhysicalDeviceQueueCount GetPhysicalDeviceQueueCount;
|
||||
PFN_vkGetPhysicalDeviceQueueProperties GetPhysicalDeviceQueueProperties;
|
||||
PFN_vkGetPhysicalDeviceMemoryProperties GetPhysicalDeviceMemoryProperties;
|
||||
PFN_vkGetPhysicalDeviceExtensionProperties GetPhysicalDeviceExtensionProperties;
|
||||
PFN_vkGetPhysicalDeviceLayerProperties GetPhysicalDeviceLayerProperties;
|
||||
PFN_vkGetPhysicalDeviceSurfaceSupportWSI GetPhysicalDeviceSurfaceSupportWSI;
|
||||
PFN_vkDbgCreateMsgCallback DbgCreateMsgCallback;
|
||||
PFN_vkDbgDestroyMsgCallback DbgDestroyMsgCallback;
|
||||
} VkLayerInstanceDispatchTable;
|
||||
|
||||
// LL node for tree of dbg callback functions
|
||||
typedef struct VkLayerDbgFunctionNode_
|
||||
{
|
||||
VkDbgMsgCallback msgCallback;
|
||||
PFN_vkDbgMsgCallback pfnMsgCallback;
|
||||
VkFlags msgFlags;
|
||||
const void *pUserData;
|
||||
struct VkLayerDbgFunctionNode_ *pNext;
|
||||
} VkLayerDbgFunctionNode;
|
||||
|
||||
typedef enum VkLayerDbgAction_
|
||||
{
|
||||
VK_DBG_LAYER_ACTION_IGNORE = 0x0,
|
||||
VK_DBG_LAYER_ACTION_CALLBACK = 0x1,
|
||||
VK_DBG_LAYER_ACTION_LOG_MSG = 0x2,
|
||||
VK_DBG_LAYER_ACTION_BREAK = 0x4
|
||||
} VkLayerDbgAction;
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// API functions
|
||||
@@ -1,99 +0,0 @@
|
||||
//
|
||||
// File: vk_platform.h
|
||||
//
|
||||
/*
|
||||
** Copyright (c) 2014-2015 The Khronos Group Inc.
|
||||
**
|
||||
** Permission is hereby granted, free of charge, to any person obtaining a
|
||||
** copy of this software and/or associated documentation files (the
|
||||
** "Materials"), to deal in the Materials without restriction, including
|
||||
** without limitation the rights to use, copy, modify, merge, publish,
|
||||
** distribute, sublicense, and/or sell copies of the Materials, and to
|
||||
** permit persons to whom the Materials are furnished to do so, subject to
|
||||
** the following conditions:
|
||||
**
|
||||
** The above copyright notice and this permission notice shall be included
|
||||
** in all copies or substantial portions of the Materials.
|
||||
**
|
||||
** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __VK_PLATFORM_H__
|
||||
#define __VK_PLATFORM_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif // __cplusplus
|
||||
|
||||
/*
|
||||
***************************************************************************************************
|
||||
* Platform-specific directives and type declarations
|
||||
***************************************************************************************************
|
||||
*/
|
||||
|
||||
#if defined(_WIN32)
|
||||
// Ensure we don't pick up min/max macros from Winddef.h
|
||||
#define NOMINMAX
|
||||
|
||||
// On Windows, VKAPI should equate to the __stdcall convention
|
||||
#define VKAPI __stdcall
|
||||
|
||||
// C99:
|
||||
#ifndef __cplusplus
|
||||
#undef inline
|
||||
#define inline __inline
|
||||
#endif // __cplusplus
|
||||
#elif defined(__GNUC__)
|
||||
// On other platforms using GCC, VKAPI stays undefined
|
||||
#define VKAPI
|
||||
#else
|
||||
// Unsupported Platform!
|
||||
#error "Unsupported OS Platform detected!"
|
||||
#endif
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#if !defined(VK_NO_STDINT_H)
|
||||
#if defined(_MSC_VER) && (_MSC_VER < 1600)
|
||||
typedef signed __int8 int8_t;
|
||||
typedef unsigned __int8 uint8_t;
|
||||
typedef signed __int16 int16_t;
|
||||
typedef unsigned __int16 uint16_t;
|
||||
typedef signed __int32 int32_t;
|
||||
typedef unsigned __int32 uint32_t;
|
||||
typedef signed __int64 int64_t;
|
||||
typedef unsigned __int64 uint64_t;
|
||||
#else
|
||||
#include <stdint.h>
|
||||
#endif
|
||||
#endif // !defined(VK_NO_STDINT_H)
|
||||
|
||||
typedef uint64_t VkDeviceSize;
|
||||
typedef uint32_t VkBool32;
|
||||
|
||||
typedef uint32_t VkSampleMask;
|
||||
typedef uint32_t VkFlags;
|
||||
|
||||
#if (UINTPTR_MAX >= UINT64_MAX)
|
||||
#define VK_UINTPTRLEAST64_MAX UINTPTR_MAX
|
||||
|
||||
typedef uintptr_t VkUintPtrLeast64;
|
||||
#else
|
||||
#define VK_UINTPTRLEAST64_MAX UINT64_MAX
|
||||
|
||||
typedef uint64_t VkUintPtrLeast64;
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif // __cplusplus
|
||||
|
||||
#endif // __VK_PLATFORM_H__
|
||||
@@ -1,249 +0,0 @@
|
||||
//
|
||||
// File: vk_wsi_device_swapchain.h
|
||||
//
|
||||
/*
|
||||
** Copyright (c) 2014 The Khronos Group Inc.
|
||||
**
|
||||
** Permission is hereby granted, free of charge, to any person obtaining a
|
||||
** copy of this software and/or associated documentation files (the
|
||||
** "Materials"), to deal in the Materials without restriction, including
|
||||
** without limitation the rights to use, copy, modify, merge, publish,
|
||||
** distribute, sublicense, and/or sell copies of the Materials, and to
|
||||
** permit persons to whom the Materials are furnished to do so, subject to
|
||||
** the following conditions:
|
||||
**
|
||||
** The above copyright notice and this permission notice shall be included
|
||||
** in all copies or substantial portions of the Materials.
|
||||
**
|
||||
** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
|
||||
*/
|
||||
|
||||
#ifndef __VK_WSI_DEVICE_SWAPCHAIN_H__
|
||||
#define __VK_WSI_DEVICE_SWAPCHAIN_H__
|
||||
|
||||
#include "vulkan.h"
|
||||
|
||||
#define VK_WSI_DEVICE_SWAPCHAIN_REVISION 40
|
||||
#define VK_WSI_DEVICE_SWAPCHAIN_EXTENSION_NUMBER 2
|
||||
#define VK_WSI_DEVICE_SWAPCHAIN_EXTENSION_NAME "VK_WSI_device_swapchain"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif // __cplusplus
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// Objects
|
||||
|
||||
VK_DEFINE_NONDISP_HANDLE(VkSwapChainWSI);
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// Enumeration constants
|
||||
|
||||
#define VK_WSI_DEVICE_SWAPCHAIN_ENUM(type,id) ((type)((int)0xc0000000 - VK_WSI_DEVICE_SWAPCHAIN_EXTENSION_NUMBER * -1024 + (id)))
|
||||
#define VK_WSI_DEVICE_SWAPCHAIN_ENUM_POSITIVE(type,id) ((type)((int)0x40000000 + (VK_WSI_DEVICE_SWAPCHAIN_EXTENSION_NUMBER - 1) * 1024 + (id)))
|
||||
|
||||
// Extend VkStructureType enum with extension specific constants
|
||||
#define VK_STRUCTURE_TYPE_SWAP_CHAIN_CREATE_INFO_WSI VK_WSI_DEVICE_SWAPCHAIN_ENUM(VkStructureType, 0)
|
||||
#define VK_STRUCTURE_TYPE_QUEUE_PRESENT_INFO_WSI VK_WSI_DEVICE_SWAPCHAIN_ENUM(VkStructureType, 1)
|
||||
|
||||
// Extend VkImageLayout enum with extension specific constants
|
||||
#define VK_IMAGE_LAYOUT_PRESENT_SOURCE_WSI VK_WSI_DEVICE_SWAPCHAIN_ENUM(VkImageLayout, 2)
|
||||
|
||||
// Extend VkResult enum with extension specific constants
|
||||
// Return codes for successful operation execution
|
||||
#define VK_SUBOPTIMAL_WSI VK_WSI_DEVICE_SWAPCHAIN_ENUM_POSITIVE(VkResult, 3)
|
||||
// Error codes
|
||||
#define VK_ERROR_OUT_OF_DATE_WSI VK_WSI_DEVICE_SWAPCHAIN_ENUM(VkResult, 4)
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// Enumerations
|
||||
|
||||
typedef enum VkSurfaceTransformWSI_
|
||||
{
|
||||
VK_SURFACE_TRANSFORM_NONE_WSI = 0,
|
||||
VK_SURFACE_TRANSFORM_ROT90_WSI = 1,
|
||||
VK_SURFACE_TRANSFORM_ROT180_WSI = 2,
|
||||
VK_SURFACE_TRANSFORM_ROT270_WSI = 3,
|
||||
VK_SURFACE_TRANSFORM_HMIRROR_WSI = 4,
|
||||
VK_SURFACE_TRANSFORM_HMIRROR_ROT90_WSI = 5,
|
||||
VK_SURFACE_TRANSFORM_HMIRROR_ROT180_WSI = 6,
|
||||
VK_SURFACE_TRANSFORM_HMIRROR_ROT270_WSI = 7,
|
||||
VK_SURFACE_TRANSFORM_INHERIT_WSI = 8,
|
||||
} VkSurfaceTransformWSI;
|
||||
|
||||
typedef enum VkSurfaceTransformFlagBitsWSI_
|
||||
{
|
||||
VK_SURFACE_TRANSFORM_NONE_BIT_WSI = 0x00000001,
|
||||
VK_SURFACE_TRANSFORM_ROT90_BIT_WSI = 0x00000002,
|
||||
VK_SURFACE_TRANSFORM_ROT180_BIT_WSI = 0x00000004,
|
||||
VK_SURFACE_TRANSFORM_ROT270_BIT_WSI = 0x00000008,
|
||||
VK_SURFACE_TRANSFORM_HMIRROR_BIT_WSI = 0x00000010,
|
||||
VK_SURFACE_TRANSFORM_HMIRROR_ROT90_BIT_WSI = 0x00000020,
|
||||
VK_SURFACE_TRANSFORM_HMIRROR_ROT180_BIT_WSI = 0x00000040,
|
||||
VK_SURFACE_TRANSFORM_HMIRROR_ROT270_BIT_WSI = 0x00000080,
|
||||
VK_SURFACE_TRANSFORM_INHERIT_BIT_WSI = 0x00000100,
|
||||
} VkSurfaceTransformFlagBitsWSI;
|
||||
typedef VkFlags VkSurfaceTransformFlagsWSI;
|
||||
|
||||
typedef enum VkSurfaceInfoTypeWSI_
|
||||
{
|
||||
VK_SURFACE_INFO_TYPE_PROPERTIES_WSI = 0,
|
||||
VK_SURFACE_INFO_TYPE_FORMATS_WSI = 1,
|
||||
VK_SURFACE_INFO_TYPE_PRESENT_MODES_WSI = 2,
|
||||
VK_SURFACE_INFO_TYPE_BEGIN_RANGE_WSI = VK_SURFACE_INFO_TYPE_PROPERTIES_WSI,
|
||||
VK_SURFACE_INFO_TYPE_END_RANGE_WSI = VK_SURFACE_INFO_TYPE_PRESENT_MODES_WSI,
|
||||
VK_SURFACE_INFO_TYPE_NUM_WSI = (VK_SURFACE_INFO_TYPE_PRESENT_MODES_WSI - VK_SURFACE_INFO_TYPE_PROPERTIES_WSI + 1),
|
||||
VK_SURFACE_INFO_TYPE_MAX_ENUM_WSI = 0x7FFFFFFF
|
||||
} VkSurfaceInfoTypeWSI;
|
||||
|
||||
typedef enum VkSwapChainInfoTypeWSI_
|
||||
{
|
||||
VK_SWAP_CHAIN_INFO_TYPE_IMAGES_WSI = 0,
|
||||
VK_SWAP_CHAIN_INFO_TYPE_BEGIN_RANGE_WSI = VK_SWAP_CHAIN_INFO_TYPE_IMAGES_WSI,
|
||||
VK_SWAP_CHAIN_INFO_TYPE_END_RANGE_WSI = VK_SWAP_CHAIN_INFO_TYPE_IMAGES_WSI,
|
||||
VK_SWAP_CHAIN_INFO_TYPE_NUM_WSI = (VK_SWAP_CHAIN_INFO_TYPE_IMAGES_WSI - VK_SWAP_CHAIN_INFO_TYPE_IMAGES_WSI + 1),
|
||||
VK_SWAP_CHAIN_INFO_TYPE_MAX_ENUM_WSI = 0x7FFFFFFF
|
||||
} VkSwapChainInfoTypeWSI;
|
||||
|
||||
typedef enum VkPresentModeWSI_
|
||||
{
|
||||
VK_PRESENT_MODE_IMMEDIATE_WSI = 0,
|
||||
VK_PRESENT_MODE_MAILBOX_WSI = 1,
|
||||
VK_PRESENT_MODE_FIFO_WSI = 2,
|
||||
VK_PRESENT_MODE_BEGIN_RANGE_WSI = VK_PRESENT_MODE_IMMEDIATE_WSI,
|
||||
VK_PRESENT_MODE_END_RANGE_WSI = VK_PRESENT_MODE_FIFO_WSI,
|
||||
VK_PRESENT_MODE_NUM = (VK_PRESENT_MODE_FIFO_WSI - VK_PRESENT_MODE_IMMEDIATE_WSI + 1),
|
||||
VK_PRESENT_MODE_MAX_ENUM_WSI = 0x7FFFFFFF
|
||||
} VkPresentModeWSI;
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// Flags
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// Structures
|
||||
|
||||
typedef struct VkSurfacePropertiesWSI_
|
||||
{
|
||||
uint32_t minImageCount; // Supported minimum number of images for the surface
|
||||
uint32_t maxImageCount; // Supported maximum number of images for the surface, 0 for unlimited
|
||||
|
||||
VkExtent2D currentExtent; // Current image width and height for the surface, (-1, -1) if undefined.
|
||||
VkExtent2D minImageExtent; // Supported minimum image width and height for the surface
|
||||
VkExtent2D maxImageExtent; // Supported maximum image width and height for the surface
|
||||
|
||||
VkSurfaceTransformFlagsWSI supportedTransforms;// 1 or more bits representing the transforms supported
|
||||
VkSurfaceTransformWSI currentTransform; // The surface's current transform relative to the device's natural orientation.
|
||||
|
||||
uint32_t maxImageArraySize; // Supported maximum number of image layers for the surface
|
||||
|
||||
VkImageUsageFlags supportedUsageFlags;// Supported image usage flags for the surface
|
||||
} VkSurfacePropertiesWSI;
|
||||
|
||||
typedef struct VkSurfaceFormatPropertiesWSI_
|
||||
{
|
||||
VkFormat format; // Supported rendering format for the surface
|
||||
} VkSurfaceFormatPropertiesWSI;
|
||||
|
||||
typedef struct VkSurfacePresentModePropertiesWSI_
|
||||
{
|
||||
VkPresentModeWSI presentMode; // Supported presention mode for the surface
|
||||
} VkSurfacePresentModePropertiesWSI;
|
||||
|
||||
typedef struct VkSwapChainCreateInfoWSI_
|
||||
{
|
||||
VkStructureType sType; // Must be VK_STRUCTURE_TYPE_SWAP_CHAIN_CREATE_INFO_WSI
|
||||
const void* pNext; // Pointer to next structure
|
||||
|
||||
const VkSurfaceDescriptionWSI* pSurfaceDescription;// describes the swap chain's target surface
|
||||
|
||||
uint32_t minImageCount; // Minimum number of presentation images the application needs
|
||||
VkFormat imageFormat; // Format of the presentation images
|
||||
VkExtent2D imageExtent; // Dimensions of the presentation images
|
||||
VkImageUsageFlags imageUsageFlags; // Bits indicating how the presentation images will be used
|
||||
VkSurfaceTransformWSI preTransform; // The transform, relative to the device's natural orientation, applied to the image content prior to presentation
|
||||
uint32_t imageArraySize; // Determines the number of views for multiview/stereo presentation
|
||||
|
||||
VkPresentModeWSI presentMode; // Which presentation mode to use for presents on this swap chain.
|
||||
|
||||
VkSwapChainWSI oldSwapChain; // Existing swap chain to replace, if any.
|
||||
|
||||
VkBool32 clipped; // Specifies whether presentable images may be affected by window clip regions.
|
||||
} VkSwapChainCreateInfoWSI;
|
||||
|
||||
typedef struct VkSwapChainImagePropertiesWSI_
|
||||
{
|
||||
VkImage image; // Persistent swap chain image handle
|
||||
} VkSwapChainImagePropertiesWSI;
|
||||
|
||||
typedef struct VkPresentInfoWSI_
|
||||
{
|
||||
VkStructureType sType; // Must be VK_STRUCTURE_TYPE_QUEUE_PRESENT_INFO_WSI
|
||||
const void* pNext; // Pointer to next structure
|
||||
uint32_t swapChainCount; // Number of swap chains to present in this call
|
||||
const VkSwapChainWSI* swapChains; // Swap chains to present an image from.
|
||||
const uint32_t* imageIndices; // Indices of which swapChain images to present
|
||||
} VkPresentInfoWSI;
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// Function types
|
||||
|
||||
typedef VkResult (VKAPI *PFN_vkGetSurfaceInfoWSI)(VkDevice device, const VkSurfaceDescriptionWSI* pSurfaceDescription, VkSurfaceInfoTypeWSI infoType, size_t* pDataSize, void* pData);
|
||||
typedef VkResult (VKAPI *PFN_vkCreateSwapChainWSI)(VkDevice device, const VkSwapChainCreateInfoWSI* pCreateInfo, VkSwapChainWSI* pSwapChain);
|
||||
typedef VkResult (VKAPI *PFN_vkDestroySwapChainWSI)(VkDevice device, VkSwapChainWSI swapChain);
|
||||
typedef VkResult (VKAPI *PFN_vkGetSwapChainInfoWSI)(VkDevice device, VkSwapChainWSI swapChain, VkSwapChainInfoTypeWSI infoType, size_t* pDataSize, void* pData);
|
||||
typedef VkResult (VKAPI *PFN_vkAcquireNextImageWSI)(VkDevice device, VkSwapChainWSI swapChain, uint64_t timeout, VkSemaphore semaphore, uint32_t* pImageIndex);
|
||||
typedef VkResult (VKAPI *PFN_vkQueuePresentWSI)(VkQueue queue, VkPresentInfoWSI* pPresentInfo);
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// Function prototypes
|
||||
|
||||
#ifdef VK_PROTOTYPES
|
||||
|
||||
VkResult VKAPI vkGetSurfaceInfoWSI(
|
||||
VkDevice device,
|
||||
const VkSurfaceDescriptionWSI* pSurfaceDescription,
|
||||
VkSurfaceInfoTypeWSI infoType,
|
||||
size_t* pDataSize,
|
||||
void* pData);
|
||||
|
||||
VkResult VKAPI vkCreateSwapChainWSI(
|
||||
VkDevice device,
|
||||
const VkSwapChainCreateInfoWSI* pCreateInfo,
|
||||
VkSwapChainWSI* pSwapChain);
|
||||
|
||||
VkResult VKAPI vkDestroySwapChainWSI(
|
||||
VkDevice device,
|
||||
VkSwapChainWSI swapChain);
|
||||
|
||||
VkResult VKAPI vkGetSwapChainInfoWSI(
|
||||
VkDevice device,
|
||||
VkSwapChainWSI swapChain,
|
||||
VkSwapChainInfoTypeWSI infoType,
|
||||
size_t* pDataSize,
|
||||
void* pData);
|
||||
|
||||
VkResult VKAPI vkAcquireNextImageWSI(
|
||||
VkDevice device,
|
||||
VkSwapChainWSI swapChain,
|
||||
uint64_t timeout,
|
||||
VkSemaphore semaphore,
|
||||
uint32_t* pImageIndex);
|
||||
|
||||
VkResult VKAPI vkQueuePresentWSI(
|
||||
VkQueue queue,
|
||||
VkPresentInfoWSI* pPresentInfo);
|
||||
|
||||
#endif // VK_PROTOTYPES
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif // __cplusplus
|
||||
|
||||
#endif // __VK_WSI_SWAPCHAIN_H__
|
||||
@@ -1,175 +0,0 @@
|
||||
//
|
||||
// File: vk_wsi_display.h
|
||||
//
|
||||
/*
|
||||
** Copyright (c) 2014 The Khronos Group Inc.
|
||||
**
|
||||
** Permission is hereby granted, free of charge, to any person obtaining a
|
||||
** copy of this software and/or associated documentation files (the
|
||||
** "Materials"), to deal in the Materials without restriction, including
|
||||
** without limitation the rights to use, copy, modify, merge, publish,
|
||||
** distribute, sublicense, and/or sell copies of the Materials, and to
|
||||
** permit persons to whom the Materials are furnished to do so, subject to
|
||||
** the following conditions:
|
||||
**
|
||||
** The above copyright notice and this permission notice shall be included
|
||||
** in all copies or substantial portions of the Materials.
|
||||
**
|
||||
** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
|
||||
*/
|
||||
|
||||
#ifndef __VK_WSI_LUNARG_H__
|
||||
#define __VK_WSI_LUNARG_H__
|
||||
|
||||
#include "vulkan.h"
|
||||
|
||||
#define VK_WSI_LUNARG_REVISION VK_MAKE_VERSION(0, 3, 0)
|
||||
#define VK_WSI_LUNARG_EXTENSION_NUMBER 1
|
||||
#define VK_WSI_LUNARG_EXTENSION_NAME "VK_WSI_LunarG"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif // __cplusplus
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// Objects
|
||||
|
||||
VK_DEFINE_HANDLE(VkDisplayWSI)
|
||||
VK_DEFINE_HANDLE(VkSwapChainWSI)
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// Enumeration constants
|
||||
|
||||
#define VK_WSI_LUNARG_ENUM(type,id) ((type)(VK_WSI_LUNARG_EXTENSION_NUMBER * -1000 + (id)))
|
||||
|
||||
// Extend VkPhysicalDeviceInfoType enum with extension specific constants
|
||||
#define VK_PHYSICAL_DEVICE_INFO_TYPE_QUEUE_PRESENT_PROPERTIES_WSI VK_WSI_LUNARG_ENUM(VkPhysicalDeviceInfoType, 1)
|
||||
|
||||
// Extend VkStructureType enum with extension specific constants
|
||||
#define VK_STRUCTURE_TYPE_SWAP_CHAIN_CREATE_INFO_WSI VK_WSI_LUNARG_ENUM(VkStructureType, 0)
|
||||
#define VK_STRUCTURE_TYPE_PRESENT_INFO_WSI VK_WSI_LUNARG_ENUM(VkStructureType, 1)
|
||||
|
||||
// Extend VkImageLayout enum with extension specific constants
|
||||
#define VK_IMAGE_LAYOUT_PRESENT_SOURCE_WSI VK_WSI_LUNARG_ENUM(VkImageLayout, 0)
|
||||
|
||||
typedef enum VkSwapChainInfoTypeWSI_
|
||||
{
|
||||
// Info type for vkGetSwapChainInfo()
|
||||
VK_SWAP_CHAIN_INFO_TYPE_PERSISTENT_IMAGES_WSI = 0x00000000, // Return information about the persistent images of the swapchain
|
||||
|
||||
} VkSwapChainInfoTypeWSI;
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// Flags
|
||||
|
||||
typedef VkFlags VkSwapModeFlagsWSI;
|
||||
typedef enum VkSwapModeFlagBitsWSI_
|
||||
{
|
||||
VK_SWAP_MODE_FLIP_BIT_WSI = 0x1,
|
||||
VK_SWAP_MODE_BLIT_BIT_WSI = 0x2
|
||||
} VkSwapModeFlagBitsWSI;
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// Structures
|
||||
|
||||
typedef struct VkDisplayPropertiesWSI_
|
||||
{
|
||||
VkDisplayWSI display; // Handle of the display object
|
||||
VkExtent2D physicalResolution; // Max resolution for CRT?
|
||||
} VkDisplayPropertiesWSI;
|
||||
|
||||
typedef struct VkDisplayFormatPropertiesWSI_
|
||||
{
|
||||
VkFormat swapChainFormat; // Format of the images of the swap chain
|
||||
} VkDisplayFormatPropertiesWSI;
|
||||
|
||||
typedef struct VkSwapChainCreateInfoWSI_
|
||||
{
|
||||
VkStructureType sType; // Must be VK_STRUCTURE_TYPE_SWAP_CHAIN_CREATE_INFO_WSI
|
||||
const void* pNext; // Pointer to next structure
|
||||
|
||||
// TBD: It is not yet clear what the use will be for the following two
|
||||
// values. It seems to be needed for more-global window-system handles
|
||||
// (e.g. X11 display). If not needed for the SDK, we will drop it from
|
||||
// this extension, and from a future version of this header.
|
||||
const void* pNativeWindowSystemHandle; // Pointer to native window system handle
|
||||
const void* pNativeWindowHandle; // Pointer to native window handle
|
||||
|
||||
uint32_t displayCount; // Number of displays the swap chain is created for
|
||||
const VkDisplayWSI* pDisplays; // displayCount number of display objects the swap chain is created for
|
||||
|
||||
uint32_t imageCount; // Number of images in the swap chain
|
||||
|
||||
VkFormat imageFormat; // Format of the images of the swap chain
|
||||
VkExtent2D imageExtent; // Width and height of the images of the swap chain
|
||||
uint32_t imageArraySize; // Number of layers of the images of the swap chain (needed for multi-view rendering)
|
||||
VkFlags imageUsageFlags; // Usage flags for the images of the swap chain (see VkImageUsageFlags)
|
||||
|
||||
VkFlags swapModeFlags; // Allowed swap modes (see VkSwapModeFlagsWSI)
|
||||
} VkSwapChainCreateInfoWSI;
|
||||
|
||||
typedef struct VkSwapChainImageInfoWSI_
|
||||
{
|
||||
VkImage image; // Persistent swap chain image handle
|
||||
VkDeviceMemory memory; // Persistent swap chain image's memory handle
|
||||
} VkSwapChainImageInfoWSI;
|
||||
|
||||
typedef struct VkPhysicalDeviceQueuePresentPropertiesWSI_
|
||||
{
|
||||
VkBool32 supportsPresent; // Tells whether the queue supports presenting
|
||||
} VkPhysicalDeviceQueuePresentPropertiesWSI;
|
||||
|
||||
typedef struct VkPresentInfoWSI_
|
||||
{
|
||||
VkStructureType sType; // Must be VK_STRUCTURE_TYPE_PRESENT_INFO_WSI
|
||||
const void* pNext; // Pointer to next structure
|
||||
VkImage image; // Image to present
|
||||
uint32_t flipInterval; // Flip interval
|
||||
} VkPresentInfoWSI;
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// Function types
|
||||
|
||||
typedef VkResult (VKAPI *PFN_vkCreateSwapChainWSI)(VkDevice device, const VkSwapChainCreateInfoWSI* pCreateInfo, VkSwapChainWSI* pSwapChain);
|
||||
typedef VkResult (VKAPI *PFN_vkDestroySwapChainWSI)(VkSwapChainWSI swapChain);
|
||||
typedef VkResult (VKAPI *PFN_vkGetSwapChainInfoWSI)(VkSwapChainWSI swapChain, VkSwapChainInfoTypeWSI infoType, size_t* pDataSize, void* pData);
|
||||
typedef VkResult (VKAPI *PFN_vkQueuePresentWSI)(VkQueue queue, const VkPresentInfoWSI* pPresentInfo);
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// Function prototypes
|
||||
|
||||
#ifdef VK_PROTOTYPES
|
||||
|
||||
|
||||
VkResult VKAPI vkCreateSwapChainWSI(
|
||||
VkDevice device,
|
||||
const VkSwapChainCreateInfoWSI* pCreateInfo,
|
||||
VkSwapChainWSI* pSwapChain);
|
||||
|
||||
VkResult VKAPI vkDestroySwapChainWSI(
|
||||
VkSwapChainWSI swapChain);
|
||||
|
||||
VkResult VKAPI vkGetSwapChainInfoWSI(
|
||||
VkSwapChainWSI swapChain,
|
||||
VkSwapChainInfoTypeWSI infoType,
|
||||
size_t* pDataSize,
|
||||
void* pData);
|
||||
|
||||
VkResult VKAPI vkQueuePresentWSI(
|
||||
VkQueue queue,
|
||||
const VkPresentInfoWSI* pPresentInfo);
|
||||
|
||||
#endif // VK_PROTOTYPES
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif // __cplusplus
|
||||
|
||||
#endif // __VK_WSI_LUNARG_H__
|
||||
@@ -1,133 +0,0 @@
|
||||
//
|
||||
// File: vk_wsi_swapchain.h
|
||||
//
|
||||
/*
|
||||
** Copyright (c) 2014 The Khronos Group Inc.
|
||||
**
|
||||
** Permission is hereby granted, free of charge, to any person obtaining a
|
||||
** copy of this software and/or associated documentation files (the
|
||||
** "Materials"), to deal in the Materials without restriction, including
|
||||
** without limitation the rights to use, copy, modify, merge, publish,
|
||||
** distribute, sublicense, and/or sell copies of the Materials, and to
|
||||
** permit persons to whom the Materials are furnished to do so, subject to
|
||||
** the following conditions:
|
||||
**
|
||||
** The above copyright notice and this permission notice shall be included
|
||||
** in all copies or substantial portions of the Materials.
|
||||
**
|
||||
** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
|
||||
*/
|
||||
|
||||
#ifndef __VK_WSI_SWAPCHAIN_H__
|
||||
#define __VK_WSI_SWAPCHAIN_H__
|
||||
|
||||
#include "vulkan.h"
|
||||
|
||||
#define VK_WSI_SWAPCHAIN_REVISION 12
|
||||
#define VK_WSI_SWAPCHAIN_EXTENSION_NUMBER 1
|
||||
#define VK_WSI_SWAPCHAIN_EXTENSION_NAME "VK_WSI_swapchain"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif // __cplusplus
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// Objects
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// Enumeration constants
|
||||
|
||||
#define VK_WSI_SWAPCHAIN_ENUM(type,id) ((type)((int)0xc0000000 - VK_WSI_SWAPCHAIN_EXTENSION_NUMBER * -1024 + (id)))
|
||||
#define VK_WSI_SWAPCHAIN_ENUM_POSITIVE(type,id) ((type)((int)0x40000000 + (VK_WSI_SWAPCHAIN_EXTENSION_NUMBER - 1) * 1024 + (id)))
|
||||
|
||||
// Extend VkStructureType enum with extension specific constants
|
||||
#define VK_STRUCTURE_TYPE_SURFACE_DESCRIPTION_WINDOW_WSI VK_WSI_SWAPCHAIN_ENUM(VkStructureType, 0)
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// Enumerations
|
||||
|
||||
typedef enum VkPlatformWSI_
|
||||
{
|
||||
VK_PLATFORM_WIN32_WSI = 0,
|
||||
VK_PLATFORM_X11_WSI = 1,
|
||||
VK_PLATFORM_XCB_WSI = 2,
|
||||
VK_PLATFORM_ANDROID_WSI = 3,
|
||||
VK_PLATFORM_WAYLAND_WSI = 4,
|
||||
VK_PLATFORM_MIR_WSI = 5,
|
||||
VK_PLATFORM_BEGIN_RANGE_WSI = VK_PLATFORM_WIN32_WSI,
|
||||
VK_PLATFORM_END_RANGE_WSI = VK_PLATFORM_MIR_WSI,
|
||||
VK_PLATFORM_NUM_WSI = (VK_PLATFORM_MIR_WSI - VK_PLATFORM_WIN32_WSI + 1),
|
||||
VK_PLATFORM_MAX_ENUM_WSI = 0x7FFFFFFF
|
||||
} VkPlatformWSI;
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// Flags
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// Structures
|
||||
|
||||
// pPlatformHandle points to this struct when platform is VK_PLATFORM_X11_WSI
|
||||
#ifdef _X11_XLIB_H_
|
||||
typedef struct VkPlatformHandleX11WSI_
|
||||
{
|
||||
Display* dpy; // Display connection to an X server
|
||||
Window root; // To identify the X screen
|
||||
} VkPlatformHandleX11WSI;
|
||||
#endif /* _X11_XLIB_H_ */
|
||||
|
||||
// pPlatformHandle points to this struct when platform is VK_PLATFORM_XCB_WSI
|
||||
#ifdef __XCB_H__
|
||||
typedef struct VkPlatformHandleXcbWSI_
|
||||
{
|
||||
xcb_connection_t* connection; // XCB connection to an X server
|
||||
xcb_window_t root; // To identify the X screen
|
||||
} VkPlatformHandleXcbWSI;
|
||||
#endif /* __XCB_H__ */
|
||||
|
||||
// Placeholder structure header for the different types of surface description structures
|
||||
typedef struct VkSurfaceDescriptionWSI_
|
||||
{
|
||||
VkStructureType sType; // Can be any of the VK_STRUCTURE_TYPE_SURFACE_DESCRIPTION_XXX_WSI constants
|
||||
const void* pNext; // Pointer to next structure
|
||||
} VkSurfaceDescriptionWSI;
|
||||
|
||||
// Surface description structure for a native platform window surface
|
||||
typedef struct VkSurfaceDescriptionWindowWSI_
|
||||
{
|
||||
VkStructureType sType; // Must be VK_STRUCTURE_TYPE_SURFACE_DESCRIPTION_WINDOW_WSI
|
||||
const void* pNext; // Pointer to next structure
|
||||
VkPlatformWSI platform; // e.g. VK_PLATFORM_*_WSI
|
||||
void* pPlatformHandle;
|
||||
void* pPlatformWindow;
|
||||
} VkSurfaceDescriptionWindowWSI;
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// Function types
|
||||
|
||||
typedef VkResult (VKAPI *PFN_vkGetPhysicalDeviceSurfaceSupportWSI)(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, const VkSurfaceDescriptionWSI* pSurfaceDescription, VkBool32* pSupported);
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// Function prototypes
|
||||
|
||||
#ifdef VK_PROTOTYPES
|
||||
|
||||
VkResult VKAPI vkGetPhysicalDeviceSurfaceSupportWSI(
|
||||
VkPhysicalDevice physicalDevice,
|
||||
uint32_t queueFamilyIndex,
|
||||
const VkSurfaceDescriptionWSI* pSurfaceDescription,
|
||||
VkBool32* pSupported);
|
||||
|
||||
#endif // VK_PROTOTYPES
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif // __cplusplus
|
||||
|
||||
#endif // __VK_WSI_SWAPCHAIN_H__
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,89 +0,0 @@
|
||||
/*
|
||||
* Vulkan
|
||||
*
|
||||
* Copyright (C) 2015 LunarG, Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* Authors:
|
||||
* Courtney Goeltzenleuchter <courtney@lunarg.com>
|
||||
*/
|
||||
|
||||
#include "string.h"
|
||||
#include "vk_layer_extension_utils.h"
|
||||
|
||||
#define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0]))
|
||||
|
||||
/*
|
||||
* This file contains utility functions for layers
|
||||
*/
|
||||
|
||||
VkResult util_GetExtensionProperties(
|
||||
const uint32_t count,
|
||||
const VkExtensionProperties *layer_extensions,
|
||||
uint32_t* pCount,
|
||||
VkExtensionProperties* pProperties)
|
||||
{
|
||||
uint32_t copy_size;
|
||||
|
||||
if (pCount == NULL) {
|
||||
return VK_ERROR_INVALID_POINTER;
|
||||
}
|
||||
|
||||
if (pProperties == NULL || layer_extensions == NULL) {
|
||||
*pCount = count;
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
copy_size = *pCount < count ? *pCount : count;
|
||||
memcpy(pProperties, layer_extensions, copy_size * sizeof(VkExtensionProperties));
|
||||
*pCount = copy_size;
|
||||
if (copy_size < count) {
|
||||
return VK_INCOMPLETE;
|
||||
}
|
||||
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
VkResult util_GetLayerProperties(
|
||||
const uint32_t count,
|
||||
const VkLayerProperties *layer_properties,
|
||||
uint32_t* pCount,
|
||||
VkLayerProperties* pProperties)
|
||||
{
|
||||
uint32_t copy_size;
|
||||
|
||||
if (pCount == NULL) {
|
||||
return VK_ERROR_INVALID_POINTER;
|
||||
}
|
||||
|
||||
if (pProperties == NULL || layer_properties == NULL) {
|
||||
*pCount = count;
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
copy_size = *pCount < count ? *pCount : count;
|
||||
memcpy(pProperties, layer_properties, copy_size * sizeof(VkLayerProperties));
|
||||
*pCount = copy_size;
|
||||
if (copy_size < count) {
|
||||
return VK_INCOMPLETE;
|
||||
}
|
||||
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
@@ -1,54 +0,0 @@
|
||||
/*
|
||||
* Vulkan
|
||||
*
|
||||
* Copyright (C) 2014 LunarG, Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* Authors:
|
||||
* Courtney Goeltzenleuchter <courtney@lunarg.com>
|
||||
*/
|
||||
|
||||
#include "vk_layer.h"
|
||||
|
||||
#ifndef LAYER_EXTENSION_UTILS_H
|
||||
#define LAYER_EXTENSION_UTILS_H
|
||||
|
||||
#define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0]))
|
||||
|
||||
/*
|
||||
* This file contains static functions for the generated layers
|
||||
*/
|
||||
extern "C" {
|
||||
|
||||
VkResult util_GetExtensionProperties(
|
||||
const uint32_t count,
|
||||
const VkExtensionProperties *layer_extensions,
|
||||
uint32_t* pCount,
|
||||
VkExtensionProperties* pProperties);
|
||||
|
||||
VkResult util_GetLayerProperties(
|
||||
const uint32_t count,
|
||||
const VkLayerProperties *layer_properties,
|
||||
uint32_t* pCount,
|
||||
VkLayerProperties* pProperties);
|
||||
|
||||
} // extern "C"
|
||||
#endif // LAYER_EXTENSION_UTILS_H
|
||||
|
||||
@@ -1,198 +0,0 @@
|
||||
/*
|
||||
* Vulkan
|
||||
*
|
||||
* Copyright (C) 2014 LunarG, Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
#include <assert.h>
|
||||
#include <unordered_map>
|
||||
#include "../build/layers/vk_dispatch_table_helper.h"
|
||||
#include "vk_layer.h"
|
||||
#include "vk_layer_table.h"
|
||||
static device_table_map tableMap;
|
||||
static instance_table_map tableInstanceMap;
|
||||
|
||||
#define DISPATCH_MAP_DEBUG 0
|
||||
|
||||
// Map lookup must be thread safe
|
||||
VkLayerDispatchTable *device_dispatch_table(void* object)
|
||||
{
|
||||
dispatch_key key = get_dispatch_key(object);
|
||||
device_table_map::const_iterator it = tableMap.find((void *) key);
|
||||
assert(it != tableMap.end() && "Not able to find device dispatch entry");
|
||||
return it->second;
|
||||
}
|
||||
|
||||
VkLayerInstanceDispatchTable *instance_dispatch_table(void* object)
|
||||
{
|
||||
dispatch_key key = get_dispatch_key(object);
|
||||
instance_table_map::const_iterator it = tableInstanceMap.find((void *) key);
|
||||
#if DISPATCH_MAP_DEBUG
|
||||
if (it != tableInstanceMap.end()) {
|
||||
fprintf(stderr, "instance_dispatch_table: map: %p, object: %p, key: %p, table: %p\n", &tableInstanceMap, object, key, it->second);
|
||||
} else {
|
||||
fprintf(stderr, "instance_dispatch_table: map: %p, object: %p, key: %p, table: UNKNOWN\n", &tableInstanceMap, object, key);
|
||||
}
|
||||
#endif
|
||||
assert(it != tableInstanceMap.end() && "Not able to find instance dispatch entry");
|
||||
return it->second;
|
||||
}
|
||||
|
||||
void destroy_dispatch_table(device_table_map &map, dispatch_key key)
|
||||
{
|
||||
device_table_map::const_iterator it = map.find((void *) key);
|
||||
#if DISPATCH_MAP_DEBUG
|
||||
if (it != map.end()) {
|
||||
fprintf(stderr, "destroy device dispatch_table: map: %p, key: %p, table: %p\n", &map, key, it->second);
|
||||
} else {
|
||||
fprintf(stderr, "destroy device dispatch table: map: %p, key: %p, table: UNKNOWN\n", &map, key);
|
||||
assert(it != map.end());
|
||||
}
|
||||
#endif
|
||||
map.erase(key);
|
||||
}
|
||||
|
||||
void destroy_dispatch_table(instance_table_map &map, dispatch_key key)
|
||||
{
|
||||
instance_table_map::const_iterator it = map.find((void *) key);
|
||||
#if DISPATCH_MAP_DEBUG
|
||||
if (it != map.end()) {
|
||||
fprintf(stderr, "destroy instance dispatch_table: map: %p, key: %p, table: %p\n", &map, key, it->second);
|
||||
} else {
|
||||
fprintf(stderr, "destroy instance dispatch table: map: %p, key: %p, table: UNKNOWN\n", &map, key);
|
||||
assert(it != map.end());
|
||||
}
|
||||
#endif
|
||||
map.erase(key);
|
||||
}
|
||||
|
||||
void destroy_device_dispatch_table(dispatch_key key)
|
||||
{
|
||||
destroy_dispatch_table(tableMap, key);
|
||||
}
|
||||
|
||||
void destroy_instance_dispatch_table(dispatch_key key)
|
||||
{
|
||||
destroy_dispatch_table(tableInstanceMap, key);
|
||||
}
|
||||
|
||||
VkLayerDispatchTable *get_dispatch_table(device_table_map &map, void* object)
|
||||
{
|
||||
dispatch_key key = get_dispatch_key(object);
|
||||
device_table_map::const_iterator it = map.find((void *) key);
|
||||
#if DISPATCH_MAP_DEBUG
|
||||
if (it != map.end()) {
|
||||
fprintf(stderr, "instance_dispatch_table: map: %p, object: %p, key: %p, table: %p\n", &tableInstanceMap, object, key, it->second);
|
||||
} else {
|
||||
fprintf(stderr, "instance_dispatch_table: map: %p, object: %p, key: %p, table: UNKNOWN\n", &tableInstanceMap, object, key);
|
||||
}
|
||||
#endif
|
||||
assert(it != map.end() && "Not able to find device dispatch entry");
|
||||
return it->second;
|
||||
}
|
||||
|
||||
VkLayerInstanceDispatchTable *get_dispatch_table(instance_table_map &map, void* object)
|
||||
{
|
||||
// VkLayerInstanceDispatchTable *pDisp = *(VkLayerInstanceDispatchTable **) object;
|
||||
dispatch_key key = get_dispatch_key(object);
|
||||
instance_table_map::const_iterator it = map.find((void *) key);
|
||||
#if DISPATCH_MAP_DEBUG
|
||||
if (it != map.end()) {
|
||||
fprintf(stderr, "instance_dispatch_table: map: %p, object: %p, key: %p, table: %p\n", &tableInstanceMap, object, key, it->second);
|
||||
} else {
|
||||
fprintf(stderr, "instance_dispatch_table: map: %p, object: %p, key: %p, table: UNKNOWN\n", &tableInstanceMap, object, key);
|
||||
}
|
||||
#endif
|
||||
assert(it != map.end() && "Not able to find instance dispatch entry");
|
||||
return it->second;
|
||||
}
|
||||
|
||||
/* Various dispatchable objects will use the same underlying dispatch table if they
|
||||
* are created from that "parent" object. Thus use pointer to dispatch table
|
||||
* as the key to these table maps.
|
||||
* Instance -> PhysicalDevice
|
||||
* Device -> CmdBuffer or Queue
|
||||
* If use the object themselves as key to map then implies Create entrypoints have to be intercepted
|
||||
* and a new key inserted into map */
|
||||
VkLayerInstanceDispatchTable * initInstanceTable(instance_table_map &map, const VkBaseLayerObject *instancew)
|
||||
{
|
||||
VkLayerInstanceDispatchTable *pTable;
|
||||
assert(instancew);
|
||||
VkLayerInstanceDispatchTable **ppDisp = (VkLayerInstanceDispatchTable **) instancew->baseObject;
|
||||
|
||||
std::unordered_map<void *, VkLayerInstanceDispatchTable *>::const_iterator it = map.find((void *) *ppDisp);
|
||||
if (it == map.end())
|
||||
{
|
||||
pTable = new VkLayerInstanceDispatchTable;
|
||||
map[(void *) *ppDisp] = pTable;
|
||||
#if DISPATCH_MAP_DEBUG
|
||||
fprintf(stderr, "New, Instance: map: %p, base object: %p, key: %p, table: %p\n", &map, instancew, *ppDisp, pTable);
|
||||
#endif
|
||||
assert(map.size() <= 1 && "Instance dispatch table map has more than one entry");
|
||||
} else
|
||||
{
|
||||
#if DISPATCH_MAP_DEBUG
|
||||
fprintf(stderr, "Instance: map: %p, base object: %p, key: %p, table: %p\n", &map, instancew, *ppDisp, it->second);
|
||||
#endif
|
||||
return it->second;
|
||||
}
|
||||
|
||||
layer_init_instance_dispatch_table(pTable, instancew);
|
||||
|
||||
return pTable;
|
||||
}
|
||||
|
||||
VkLayerInstanceDispatchTable * initInstanceTable(const VkBaseLayerObject *instancew)
|
||||
{
|
||||
return initInstanceTable(tableInstanceMap, instancew);
|
||||
}
|
||||
|
||||
VkLayerDispatchTable * initDeviceTable(device_table_map &map, const VkBaseLayerObject *devw)
|
||||
{
|
||||
VkLayerDispatchTable *layer_device_table = NULL;
|
||||
assert(devw);
|
||||
VkLayerDispatchTable **ppDisp = (VkLayerDispatchTable **) (devw->baseObject);
|
||||
VkLayerDispatchTable *base_device_table = *ppDisp;
|
||||
|
||||
std::unordered_map<void *, VkLayerDispatchTable *>::const_iterator it = map.find((void *) base_device_table);
|
||||
if (it == map.end())
|
||||
{
|
||||
layer_device_table = new VkLayerDispatchTable;
|
||||
map[(void *) base_device_table] = layer_device_table;
|
||||
#if DISPATCH_MAP_DEBUG
|
||||
fprintf(stderr, "New, Device: map: %p, base object: %p, key: %p, table: %p\n", &map, devw, *ppDisp, layer_device_table);
|
||||
#endif
|
||||
} else
|
||||
{
|
||||
#if DISPATCH_MAP_DEBUG
|
||||
fprintf(stderr, "Device: map: %p, base object: %p, key: %p, table: %p\n", &map, devw, *ppDisp, it->second);
|
||||
#endif
|
||||
return it->second;
|
||||
}
|
||||
|
||||
layer_initialize_dispatch_table(layer_device_table, devw);
|
||||
|
||||
return layer_device_table;
|
||||
}
|
||||
|
||||
VkLayerDispatchTable * initDeviceTable(const VkBaseLayerObject *devw)
|
||||
{
|
||||
return initDeviceTable(tableMap, devw);
|
||||
}
|
||||
@@ -1,55 +0,0 @@
|
||||
/*
|
||||
* Vulkan
|
||||
*
|
||||
* Copyright (C) 2014 LunarG, Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <unordered_map>
|
||||
|
||||
typedef std::unordered_map<void *, VkLayerDispatchTable *> device_table_map;
|
||||
typedef std::unordered_map<void *, VkLayerInstanceDispatchTable *> instance_table_map;
|
||||
VkLayerDispatchTable * initDeviceTable(const VkBaseLayerObject *devw);
|
||||
VkLayerDispatchTable * initDeviceTable(device_table_map &map, const VkBaseLayerObject *devw);
|
||||
VkLayerInstanceDispatchTable * initInstanceTable(const VkBaseLayerObject *instancew);
|
||||
VkLayerInstanceDispatchTable * initInstanceTable(instance_table_map &map, const VkBaseLayerObject *instancew);
|
||||
|
||||
typedef void *dispatch_key;
|
||||
|
||||
static inline dispatch_key get_dispatch_key(const void* object)
|
||||
{
|
||||
return (dispatch_key) *(VkLayerDispatchTable **) object;
|
||||
}
|
||||
|
||||
VkLayerDispatchTable *device_dispatch_table(void* object);
|
||||
|
||||
VkLayerInstanceDispatchTable *instance_dispatch_table(void* object);
|
||||
|
||||
VkLayerDispatchTable *get_dispatch_table(device_table_map &map, void* object);
|
||||
|
||||
VkLayerInstanceDispatchTable *get_dispatch_table(instance_table_map &map, void* object);
|
||||
|
||||
void destroy_device_dispatch_table(dispatch_key key);
|
||||
void destroy_instance_dispatch_table(dispatch_key key);
|
||||
|
||||
void destroy_dispatch_table(device_table_map &map, dispatch_key key);
|
||||
void destroy_dispatch_table(instance_table_map &map, dispatch_key key);
|
||||
|
||||
@@ -1,423 +0,0 @@
|
||||
/*
|
||||
* Vulkan
|
||||
*
|
||||
* Copyright (C) 2015 LunarG, Inc.
|
||||
* Copyright 2014 Valve Software
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* Authors:
|
||||
* Jon Ashburn <jon@luanrg.com>
|
||||
* Ian Elliott <ian@lunarg.com>
|
||||
*/
|
||||
|
||||
#ifndef LOADER_PLATFORM_H
|
||||
#define LOADER_PLATFORM_H
|
||||
|
||||
#include "vk_platform.h"
|
||||
|
||||
#if defined(__linux__)
|
||||
/* Linux-specific common code: */
|
||||
|
||||
// Headers:
|
||||
//#define _GNU_SOURCE 1
|
||||
// TBD: Are the contents of the following file used?
|
||||
#include <unistd.h>
|
||||
// Note: The following file is for dynamic loading:
|
||||
#include <dlfcn.h>
|
||||
#include <pthread.h>
|
||||
#include <assert.h>
|
||||
#include <stdbool.h>
|
||||
#include <libgen.h>
|
||||
|
||||
// VK Library Filenames, Paths, etc.:
|
||||
#define PATH_SEPERATOR ':'
|
||||
#define DIRECTORY_SYMBOL '/'
|
||||
|
||||
// TODO: Need to handle different Linux distros
|
||||
#define DEFAULT_VK_DRIVERS_INFO "/etc/vulkan/icd.d:/usr/share/vulkan/icd.d"
|
||||
#define DEFAULT_VK_DRIVERS_PATH "/usr/lib/i386-linux-gnu/vulkan/icd:/usr/lib/x86_64-linux-gnu/vulkan/icd"
|
||||
#define DEFAULT_VK_LAYERS_INFO "/etc/vulkan/explicit_layer.d:/etc/vulkan/implicit_layer.d:/usr/share/vulkan/explicit_layer.d:/usr/share/vulkan/implicit_layer.d"
|
||||
#define DEFAULT_VK_LAYERS_PATH "/usr/lib/i386-linux-gnu/vulkan/layer:/usr/lib/x86_64-linux-gnu/vulkan/layer"
|
||||
#define LAYERS_PATH_ENV "VK_LAYER_DIRS"
|
||||
|
||||
// C99:
|
||||
#define PRINTF_SIZE_T_SPECIFIER "%zu"
|
||||
|
||||
// File IO
|
||||
static inline bool loader_platform_file_exists(const char *path)
|
||||
{
|
||||
if (access(path, F_OK))
|
||||
return false;
|
||||
else
|
||||
return true;
|
||||
}
|
||||
|
||||
static inline bool loader_platform_is_path_absolute(const char *path)
|
||||
{
|
||||
if (path[0] == '/')
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
static inline char *loader_platform_dirname(char *path)
|
||||
{
|
||||
return dirname(path);
|
||||
}
|
||||
|
||||
// Dynamic Loading of libraries:
|
||||
typedef void * loader_platform_dl_handle;
|
||||
static inline loader_platform_dl_handle loader_platform_open_library(const char* libPath)
|
||||
{
|
||||
return dlopen(libPath, RTLD_LAZY | RTLD_LOCAL);
|
||||
}
|
||||
static inline char * loader_platform_open_library_error(const char* libPath)
|
||||
{
|
||||
return dlerror();
|
||||
}
|
||||
static inline void loader_platform_close_library(loader_platform_dl_handle library)
|
||||
{
|
||||
dlclose(library);
|
||||
}
|
||||
static inline void * loader_platform_get_proc_address(loader_platform_dl_handle library,
|
||||
const char *name)
|
||||
{
|
||||
assert(library);
|
||||
assert(name);
|
||||
return dlsym(library, name);
|
||||
}
|
||||
static inline char * loader_platform_get_proc_address_error(const char *name)
|
||||
{
|
||||
return dlerror();
|
||||
}
|
||||
|
||||
// Threads:
|
||||
typedef pthread_t loader_platform_thread;
|
||||
#define LOADER_PLATFORM_THREAD_ONCE_DECLARATION(var) \
|
||||
pthread_once_t var = PTHREAD_ONCE_INIT;
|
||||
#define LOADER_PLATFORM_THREAD_ONCE_DEFINITION(var) \
|
||||
pthread_once_t var;
|
||||
static inline void loader_platform_thread_once(void *ctl, void (* func) (void))
|
||||
{
|
||||
assert(func != NULL);
|
||||
assert(ctl != NULL);
|
||||
pthread_once((pthread_once_t *) ctl, func);
|
||||
}
|
||||
|
||||
// Thread IDs:
|
||||
typedef pthread_t loader_platform_thread_id;
|
||||
static inline loader_platform_thread_id loader_platform_get_thread_id()
|
||||
{
|
||||
return pthread_self();
|
||||
}
|
||||
|
||||
// Thread mutex:
|
||||
typedef pthread_mutex_t loader_platform_thread_mutex;
|
||||
static inline void loader_platform_thread_create_mutex(loader_platform_thread_mutex* pMutex)
|
||||
{
|
||||
pthread_mutex_init(pMutex, NULL);
|
||||
}
|
||||
static inline void loader_platform_thread_lock_mutex(loader_platform_thread_mutex* pMutex)
|
||||
{
|
||||
pthread_mutex_lock(pMutex);
|
||||
}
|
||||
static inline void loader_platform_thread_unlock_mutex(loader_platform_thread_mutex* pMutex)
|
||||
{
|
||||
pthread_mutex_unlock(pMutex);
|
||||
}
|
||||
static inline void loader_platform_thread_delete_mutex(loader_platform_thread_mutex* pMutex)
|
||||
{
|
||||
pthread_mutex_destroy(pMutex);
|
||||
}
|
||||
typedef pthread_cond_t loader_platform_thread_cond;
|
||||
static inline void loader_platform_thread_init_cond(loader_platform_thread_cond* pCond)
|
||||
{
|
||||
pthread_cond_init(pCond, NULL);
|
||||
}
|
||||
static inline void loader_platform_thread_cond_wait(loader_platform_thread_cond* pCond, loader_platform_thread_mutex* pMutex)
|
||||
{
|
||||
pthread_cond_wait(pCond, pMutex);
|
||||
}
|
||||
static inline void loader_platform_thread_cond_broadcast(loader_platform_thread_cond* pCond)
|
||||
{
|
||||
pthread_cond_broadcast(pCond);
|
||||
}
|
||||
|
||||
#define loader_stack_alloc(size) alloca(size)
|
||||
static inline void *loader_aligned_alloc(size_t alignment, size_t size) { return aligned_alloc(alignment, size); }
|
||||
|
||||
#elif defined(_WIN32) // defined(__linux__)
|
||||
/* Windows-specific common code: */
|
||||
|
||||
// Headers:
|
||||
#include <WinSock2.h>
|
||||
#include <windows.h>
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
#include <io.h>
|
||||
//#include <stdbool.h>
|
||||
#include <shlwapi.h>
|
||||
#ifdef __cplusplus
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
using namespace std;
|
||||
#endif // __cplusplus
|
||||
|
||||
// VK Library Filenames, Paths, etc.:
|
||||
#define PATH_SEPERATOR ';'
|
||||
#define DIRECTORY_SYMBOL '\\'
|
||||
#define DEFAULT_VK_REGISTRY_HIVE HKEY_LOCAL_MACHINE
|
||||
#define DEFAULT_VK_DRIVERS_INFO "SOFTWARE\\Khronos\\Vulkan\\Drivers"
|
||||
// TODO: Are these the correct paths
|
||||
#define DEFAULT_VK_DRIVERS_PATH "C:\\Windows\\System32;C:\\Windows\\SysWow64"
|
||||
#define DEFAULT_VK_LAYERS_INFO "SOFTWARE\\Khronos\\Vulkan\\ExplicitLayers;SOFTWARE\\Khronos\\Vulkan\\ImplicitLayers"
|
||||
#define DEFAULT_VK_LAYERS_PATH "C:\\Windows\\System32;C:\\Windows\\SysWow64"
|
||||
#define LAYERS_PATH_ENV "VK_LAYER_FOLDERS"
|
||||
|
||||
// C99:
|
||||
// Microsoft didn't implement C99 in Visual Studio; but started adding it with
|
||||
// VS2013. However, VS2013 still didn't have snprintf(). The following is a
|
||||
// work-around (Note: The _CRT_SECURE_NO_WARNINGS macro must be set in the
|
||||
// "CMakeLists.txt" file).
|
||||
#define snprintf _snprintf
|
||||
#define strdup _strdup
|
||||
#define PRINTF_SIZE_T_SPECIFIER "%Iu"
|
||||
|
||||
|
||||
// File IO
|
||||
static bool loader_platform_file_exists(const char *path)
|
||||
{
|
||||
if ((_access(path, 0)) == -1)
|
||||
return false;
|
||||
else
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool loader_platform_is_path_absolute(const char *path)
|
||||
{
|
||||
return !PathIsRelativeA(path);
|
||||
}
|
||||
|
||||
// WIN32 runtime doesn't have dirname().
|
||||
static inline char *loader_platform_dirname(char *path)
|
||||
{
|
||||
char *current, *next;
|
||||
|
||||
// TODO/TBD: Do we need to deal with the Windows's ":" character?
|
||||
|
||||
for (current = path; *current != '\0'; current = next) {
|
||||
next = strchr(current, DIRECTORY_SYMBOL);
|
||||
if (next == NULL) {
|
||||
if (current != path)
|
||||
*(current - 1) = '\0';
|
||||
return path;
|
||||
} else {
|
||||
// Point one character past the DIRECTORY_SYMBOL:
|
||||
next++;
|
||||
}
|
||||
}
|
||||
return path;
|
||||
}
|
||||
|
||||
// WIN32 runtime doesn't have basename().
|
||||
// Microsoft also doesn't have basename(). Paths are different on Windows, and
|
||||
// so this is just a temporary solution in order to get us compiling, so that we
|
||||
// can test some scenarios, and develop the correct solution for Windows.
|
||||
// TODO: Develop a better, permanent solution for Windows, to replace this
|
||||
// temporary code:
|
||||
static char *loader_platform_basename(char *pathname)
|
||||
{
|
||||
char *current, *next;
|
||||
|
||||
// TODO/TBD: Do we need to deal with the Windows's ":" character?
|
||||
|
||||
for (current = pathname; *current != '\0'; current = next) {
|
||||
next = strchr(current, DIRECTORY_SYMBOL);
|
||||
if (next == NULL) {
|
||||
// No more DIRECTORY_SYMBOL's so return p:
|
||||
return current;
|
||||
} else {
|
||||
// Point one character past the DIRECTORY_SYMBOL:
|
||||
next++;
|
||||
}
|
||||
}
|
||||
// We shouldn't get to here, but this makes the compiler happy:
|
||||
return current;
|
||||
}
|
||||
|
||||
// Dynamic Loading:
|
||||
typedef HMODULE loader_platform_dl_handle;
|
||||
static loader_platform_dl_handle loader_platform_open_library(const char* libPath)
|
||||
{
|
||||
return LoadLibraryA(libPath);
|
||||
}
|
||||
static char * loader_platform_open_library_error(const char* libPath)
|
||||
{
|
||||
static char errorMsg[120];
|
||||
_snprintf_s(errorMsg, 119, "Failed to open dynamic library \"%s\"", libPath);
|
||||
return errorMsg;
|
||||
}
|
||||
static void loader_platform_close_library(loader_platform_dl_handle library)
|
||||
{
|
||||
FreeLibrary(library);
|
||||
}
|
||||
static void * loader_platform_get_proc_address(loader_platform_dl_handle library,
|
||||
const char *name)
|
||||
{
|
||||
assert(library);
|
||||
assert(name);
|
||||
return GetProcAddress(library, name);
|
||||
}
|
||||
static char * loader_platform_get_proc_address_error(const char *name)
|
||||
{
|
||||
static char errorMsg[120];
|
||||
_snprintf_s(errorMsg, 119, "Failed to find function \"%s\" in dynamic library", name);
|
||||
return errorMsg;
|
||||
}
|
||||
|
||||
// Threads:
|
||||
typedef HANDLE loader_platform_thread;
|
||||
#define LOADER_PLATFORM_THREAD_ONCE_DECLARATION(var) \
|
||||
INIT_ONCE var = INIT_ONCE_STATIC_INIT;
|
||||
#define LOADER_PLATFORM_THREAD_ONCE_DEFINITION(var) \
|
||||
INIT_ONCE var;
|
||||
static BOOL CALLBACK InitFuncWrapper(PINIT_ONCE InitOnce, PVOID Parameter, PVOID *Context)
|
||||
{
|
||||
void (*func)(void) = (void (*)(void))Parameter;
|
||||
func();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void loader_platform_thread_once(void *ctl, void (* func) (void))
|
||||
{
|
||||
assert(func != NULL);
|
||||
assert(ctl != NULL);
|
||||
InitOnceExecuteOnce((PINIT_ONCE) ctl, InitFuncWrapper, func, NULL);
|
||||
}
|
||||
|
||||
// Thread IDs:
|
||||
typedef DWORD loader_platform_thread_id;
|
||||
static loader_platform_thread_id loader_platform_get_thread_id()
|
||||
{
|
||||
return GetCurrentThreadId();
|
||||
}
|
||||
|
||||
// Thread mutex:
|
||||
typedef CRITICAL_SECTION loader_platform_thread_mutex;
|
||||
static void loader_platform_thread_create_mutex(loader_platform_thread_mutex* pMutex)
|
||||
{
|
||||
InitializeCriticalSection(pMutex);
|
||||
}
|
||||
static void loader_platform_thread_lock_mutex(loader_platform_thread_mutex* pMutex)
|
||||
{
|
||||
EnterCriticalSection(pMutex);
|
||||
}
|
||||
static void loader_platform_thread_unlock_mutex(loader_platform_thread_mutex* pMutex)
|
||||
{
|
||||
LeaveCriticalSection(pMutex);
|
||||
}
|
||||
static void loader_platform_thread_delete_mutex(loader_platform_thread_mutex* pMutex)
|
||||
{
|
||||
DeleteCriticalSection(pMutex);
|
||||
}
|
||||
typedef CONDITION_VARIABLE loader_platform_thread_cond;
|
||||
static void loader_platform_thread_init_cond(loader_platform_thread_cond* pCond)
|
||||
{
|
||||
InitializeConditionVariable(pCond);
|
||||
}
|
||||
static void loader_platform_thread_cond_wait(loader_platform_thread_cond* pCond, loader_platform_thread_mutex* pMutex)
|
||||
{
|
||||
SleepConditionVariableCS(pCond, pMutex, INFINITE);
|
||||
}
|
||||
static void loader_platform_thread_cond_broadcast(loader_platform_thread_cond* pCond)
|
||||
{
|
||||
WakeAllConditionVariable(pCond);
|
||||
}
|
||||
|
||||
// Windows Registry:
|
||||
char *loader_get_registry_string(const HKEY hive,
|
||||
const LPCTSTR sub_key,
|
||||
const char *value);
|
||||
|
||||
#else // defined(_WIN32)
|
||||
|
||||
#error The "loader_platform.h" file must be modified for this OS.
|
||||
|
||||
// NOTE: In order to support another OS, an #elif needs to be added (above the
|
||||
// "#else // defined(_WIN32)") for that OS, and OS-specific versions of the
|
||||
// contents of this file must be created.
|
||||
|
||||
// NOTE: Other OS-specific changes are also needed for this OS. Search for
|
||||
// files with "WIN32" in it, as a quick way to find files that must be changed.
|
||||
|
||||
#endif // defined(_WIN32)
|
||||
|
||||
#else /* LOADER_PLATFORM_H */
|
||||
#ifndef LOADER_PLATFORM_H_TEMP
|
||||
#define LOADER_PLATFORM_H_TEMP
|
||||
|
||||
// NOTE: The following are hopefully-temporary macros to ensure that people
|
||||
// don't forget to use the loader_platform_*() functions above:
|
||||
|
||||
#if defined(__linux__)
|
||||
/* Linux-specific common code: */
|
||||
|
||||
// Dynamic Loading:
|
||||
#define dlopen PLEASE USE THE loader_platform_open_library() FUNCTION
|
||||
#define dlerror PLEASE DO NOT USE THE dlerror() FUNCTION DIRECTLY
|
||||
#define dlclose PLEASE USE THE loader_platform_close_library() FUNCTION
|
||||
#define dlsym PLEASE USE THE loader_platform_get_proc_address() FUNCTION
|
||||
|
||||
// Threads:
|
||||
#define pthread_once PLEASE USE THE loader_platform_thread_once() FUNCTION
|
||||
#define pthread_self PLEASE USE THE loader_platform_get_thread_id() FUNCTION
|
||||
|
||||
// Thread mutex:
|
||||
#define pthread_mutex_init PLEASE USE THE loader_platform_thread_create_mutex() FUNCTION
|
||||
#define pthread_mutex_lock PLEASE USE THE loader_platform_thread_lock_mutex() FUNCTION
|
||||
#define pthread_mutex_unlock PLEASE USE THE loader_platform_thread_unlock_mutex() FUNCTION
|
||||
#define pthread_mutex_destroy PLEASE USE THE loader_platform_thread_delete_mutex() FUNCTION
|
||||
|
||||
|
||||
#elif defined(_WIN32) // defined(__linux__)
|
||||
/* Windows-specific common code: */
|
||||
|
||||
// Dynamic Loading:
|
||||
//#define LoadLibrary PLEASE USE THE loader_platform_open_library() FUNCTION
|
||||
#define FreeLibrary PLEASE USE THE loader_platform_close_library() FUNCTION
|
||||
#define GetProcAddress PLEASE USE THE loader_platform_get_proc_address() FUNCTION
|
||||
|
||||
// Threads:
|
||||
#define InitOnceExecuteOnce PLEASE USE THE loader_platform_thread_once() FUNCTION
|
||||
#define GetCurrentThreadId PLEASE USE THE loader_platform_get_thread_id() FUNCTION
|
||||
|
||||
// Thread mutex:
|
||||
#define InitializeCriticalSection PLEASE USE THE loader_platform_thread_create_mutex() FUNCTION
|
||||
#define EnterCriticalSection PLEASE USE THE loader_platform_thread_lock_mutex() FUNCTION
|
||||
#define LeaveCriticalSection PLEASE USE THE loader_platform_thread_unlock_mutex() FUNCTION
|
||||
#define DeleteCriticalSection PLEASE USE THE loader_platform_thread_delete_mutex() FUNCTION
|
||||
|
||||
#define loader_stack_alloc(size) _alloca(size)
|
||||
static inline void *loader_aligned_alloc(size_t alignment, size_t size) { return _aligned_malloc(alignment, size); }
|
||||
|
||||
#endif // defined(_WIN32)
|
||||
#endif /* LOADER_PLATFORM_H_TEMP */
|
||||
#endif /* LOADER_PLATFORM_H */
|
||||
@@ -19,8 +19,7 @@
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="LoaderAndTools\layers\vk_layer_extension_utils.cpp" />
|
||||
<ClCompile Include="LoaderAndTools\layers\vk_layer_table.cpp" />
|
||||
<ClCompile Include="vk_dispatchtables.cpp" />
|
||||
<ClCompile Include="vk_tracelayer.cpp" />
|
||||
<ClCompile Include="vk_common.cpp" />
|
||||
<ClCompile Include="vk_core.cpp" />
|
||||
@@ -48,7 +47,7 @@
|
||||
<ClInclude Include="vk_common.h" />
|
||||
<ClInclude Include="vk_core.h" />
|
||||
<ClInclude Include="vk_debug.h" />
|
||||
<ClInclude Include="vk_hookset.h" />
|
||||
<ClInclude Include="vk_dispatchtables.h" />
|
||||
<ClInclude Include="vk_hookset_defs.h" />
|
||||
<ClInclude Include="vk_info.h" />
|
||||
<ClInclude Include="vk_manager.h" />
|
||||
|
||||
@@ -10,17 +10,11 @@
|
||||
<ClCompile Include="vk_resources.cpp" />
|
||||
<ClCompile Include="vk_info.cpp" />
|
||||
<ClCompile Include="vk_debug.cpp" />
|
||||
<ClCompile Include="LoaderAndTools\layers\vk_layer_table.cpp">
|
||||
<Filter>ext</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="LoaderAndTools\layers\vk_layer_extension_utils.cpp">
|
||||
<Filter>ext</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="vk_tracelayer.cpp" />
|
||||
<ClCompile Include="vk_dispatchtables.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="vk_core.h" />
|
||||
<ClInclude Include="vk_hookset.h" />
|
||||
<ClInclude Include="vk_hookset_defs.h" />
|
||||
<ClInclude Include="vk_manager.h" />
|
||||
<ClInclude Include="vk_replay.h" />
|
||||
@@ -28,10 +22,6 @@
|
||||
<ClInclude Include="vk_common.h" />
|
||||
<ClInclude Include="vk_info.h" />
|
||||
<ClInclude Include="vk_debug.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Filter Include="ext">
|
||||
<UniqueIdentifier>{170618b5-5523-497e-a798-4cad26474162}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<ClInclude Include="vk_dispatchtables.h" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -62,40 +62,7 @@
|
||||
|
||||
#include "api/replay/renderdoc_replay.h"
|
||||
|
||||
// layer includes
|
||||
|
||||
#ifdef WIN32
|
||||
// undefined clashing windows #defines
|
||||
#undef CreateEvent
|
||||
#undef CreateSemaphore
|
||||
#endif
|
||||
|
||||
#include "vk_layer.h"
|
||||
#include "LoaderAndTools/layers/vk_layer_table.h"
|
||||
#include "LoaderAndTools/layers/vk_layer_extension_utils.h"
|
||||
|
||||
extern VkLayerDispatchTable *dummyDeviceTable;
|
||||
extern VkLayerInstanceDispatchTable *dummyInstanceTable;
|
||||
|
||||
extern device_table_map renderdoc_device_table_map;
|
||||
extern instance_table_map renderdoc_instance_table_map;
|
||||
|
||||
template<typename parenttype, typename wrappedtype>
|
||||
void SetDispatchTable(bool writing, parenttype parent, wrappedtype *wrapped)
|
||||
{
|
||||
if(writing)
|
||||
{
|
||||
wrapped->table = wrappedtype::UseInstanceDispatchTable
|
||||
? (uintptr_t)get_dispatch_table(renderdoc_instance_table_map, (void *)parent)
|
||||
: (uintptr_t)get_dispatch_table(renderdoc_device_table_map, (void *)parent);
|
||||
}
|
||||
else
|
||||
{
|
||||
wrapped->table = wrappedtype::UseInstanceDispatchTable
|
||||
? (uintptr_t)dummyInstanceTable
|
||||
: (uintptr_t)dummyDeviceTable;
|
||||
}
|
||||
}
|
||||
#include "vk_dispatchtables.h"
|
||||
|
||||
ResourceFormat MakeResourceFormat(VkFormat fmt);
|
||||
PrimitiveTopology MakePrimitiveTopology(VkPrimitiveTopology Topo, uint32_t patchControlPoints);
|
||||
|
||||
@@ -31,9 +31,6 @@
|
||||
|
||||
#include "jpeg-compressor/jpge.h"
|
||||
|
||||
device_table_map renderdoc_device_table_map;
|
||||
instance_table_map renderdoc_instance_table_map;
|
||||
|
||||
// VKTODOLOW dirty buffers should propagate through to their memory somehow
|
||||
// images can be separately dirty since we can't just copy their memory
|
||||
// (tiling could be different)
|
||||
@@ -256,7 +253,7 @@ void WrappedVulkan::Initialise(VkInitParams ¶ms)
|
||||
|
||||
VkInstance inst = {0};
|
||||
|
||||
VkResult ret = dummyInstanceTable->CreateInstance(&instinfo, &inst);
|
||||
VkResult ret = GetInstanceDispatchTable(NULL)->CreateInstance(&instinfo, &inst);
|
||||
|
||||
GetResourceManager()->WrapResource(inst, inst);
|
||||
GetResourceManager()->AddLiveResource(params.InstanceID, inst);
|
||||
@@ -292,51 +289,8 @@ WrappedVulkan::WrappedVulkan(const char *logFilename)
|
||||
m_pSerialiser = new Serialiser(NULL, Serialiser::WRITING, debugSerialiser);
|
||||
}
|
||||
|
||||
#define AddExtSupport(list, name, version) { VkExtensionProperties props = { name, version }; list.push_back(props); }
|
||||
|
||||
AddExtSupport(globalExts.renderdoc, "VK_Renderdoc", 0);
|
||||
AddExtSupport(globalExts.renderdoc, "VK_WSI_swapchain", 0);
|
||||
|
||||
#undef AddExtSupport
|
||||
|
||||
m_SwapPhysDevice = -1;
|
||||
|
||||
uint32_t extCount = 0;
|
||||
vkGetGlobalExtensionProperties(NULL, &extCount, NULL);
|
||||
|
||||
globalExts.driver.resize(extCount);
|
||||
vkGetGlobalExtensionProperties(NULL, &extCount, &globalExts.driver[0]);
|
||||
|
||||
std::sort(globalExts.driver.begin(), globalExts.driver.end());
|
||||
|
||||
for(size_t i=0; i < globalExts.driver.size(); i++)
|
||||
RDCDEBUG("Driver Ext %d: %s", i, globalExts.driver[i].extName);
|
||||
|
||||
// intersection of extensions
|
||||
{
|
||||
size_t len = RDCMIN(globalExts.renderdoc.size(), globalExts.driver.size());
|
||||
for(size_t i=0, j=0; i < globalExts.renderdoc.size() && j < globalExts.driver.size(); )
|
||||
{
|
||||
string a = globalExts.renderdoc[i].extName;
|
||||
string b = globalExts.driver[j].extName;
|
||||
|
||||
if(a == b)
|
||||
{
|
||||
globalExts.extensions.push_back(globalExts.renderdoc[i]);
|
||||
i++;
|
||||
j++;
|
||||
}
|
||||
else if(a < b)
|
||||
{
|
||||
i++;
|
||||
}
|
||||
else if(b < a)
|
||||
{
|
||||
j++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
m_Replay.SetDriver(this);
|
||||
|
||||
m_FrameCounter = 0;
|
||||
@@ -440,9 +394,8 @@ WrappedVulkan::~WrappedVulkan()
|
||||
if(m_PhysicalReplayData[0].inst != VK_NULL_HANDLE)
|
||||
{
|
||||
VkInstance instance = Unwrap(m_PhysicalReplayData[0].inst);
|
||||
dispatch_key key = get_dispatch_key(instance);
|
||||
|
||||
ObjDisp(m_PhysicalReplayData[0].inst)->DestroyInstance(instance);
|
||||
destroy_dispatch_table(renderdoc_instance_table_map, key);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -465,7 +418,7 @@ VkResult WrappedVulkan::vkCreateInstance(
|
||||
|
||||
VkInstance inst = *pInstance;
|
||||
|
||||
VkResult ret = get_dispatch_table(renderdoc_instance_table_map, *pInstance)->CreateInstance(pCreateInfo, &inst);
|
||||
VkResult ret = GetInstanceDispatchTable(*pInstance)->CreateInstance(pCreateInfo, &inst);
|
||||
|
||||
GetResourceManager()->WrapResource(inst, inst);
|
||||
|
||||
@@ -494,7 +447,6 @@ VkResult WrappedVulkan::vkCreateInstance(
|
||||
VkResult WrappedVulkan::vkDestroyInstance(
|
||||
VkInstance instance)
|
||||
{
|
||||
dispatch_key key = get_dispatch_key(instance);
|
||||
VkResult ret = ObjDisp(instance)->DestroyInstance(Unwrap(instance));
|
||||
|
||||
if(ret != VK_SUCCESS)
|
||||
@@ -514,8 +466,6 @@ VkResult WrappedVulkan::vkDestroyInstance(
|
||||
|
||||
m_ResourceManager->Shutdown();
|
||||
|
||||
destroy_dispatch_table(renderdoc_instance_table_map, key);
|
||||
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -705,7 +655,7 @@ bool WrappedVulkan::Serialise_vkCreateDevice(
|
||||
|
||||
// VKTODOLOW: check that extensions and layers supported in capture (from createInfo) are supported in replay
|
||||
|
||||
VkResult ret = dummyDeviceTable->CreateDevice(Unwrap(physicalDevice), &createInfo, &device);
|
||||
VkResult ret = GetDeviceDispatchTable(NULL)->CreateDevice(Unwrap(physicalDevice), &createInfo, &device);
|
||||
|
||||
GetResourceManager()->WrapResource(device, device);
|
||||
GetResourceManager()->AddLiveResource(devId, device);
|
||||
@@ -716,20 +666,7 @@ bool WrappedVulkan::Serialise_vkCreateDevice(
|
||||
{
|
||||
if(m_PhysicalReplayData[i].phys == physicalDevice)
|
||||
{
|
||||
// fill out replay functions. Maybe this should be somewhere else.
|
||||
// VKTODOLOW this won't work with multiple devices - will need a replay device table for each
|
||||
{
|
||||
RDCASSERT(dummyDeviceTable);
|
||||
|
||||
#define FETCH_DEVICE_FUNCPTR(func) dummyDeviceTable->func = (CONCAT(PFN_vk, func))dummyDeviceTable->GetDeviceProcAddr(Unwrap(device), STRINGIZE(CONCAT(vk, func)));
|
||||
FETCH_DEVICE_FUNCPTR(CreateSwapChainWSI)
|
||||
FETCH_DEVICE_FUNCPTR(DestroySwapChainWSI)
|
||||
FETCH_DEVICE_FUNCPTR(GetSurfaceInfoWSI)
|
||||
FETCH_DEVICE_FUNCPTR(GetSwapChainInfoWSI)
|
||||
FETCH_DEVICE_FUNCPTR(AcquireNextImageWSI)
|
||||
FETCH_DEVICE_FUNCPTR(QueuePresentWSI)
|
||||
#undef FETCH_DEVICE_FUNCPTR
|
||||
}
|
||||
InitDeviceReplayTables(Unwrap(device));
|
||||
|
||||
// VKTODOLOW not handling multiple devices per physical devices
|
||||
RDCASSERT(m_PhysicalReplayData[i].dev == VK_NULL_HANDLE);
|
||||
@@ -843,7 +780,7 @@ VkResult WrappedVulkan::vkCreateDevice(
|
||||
|
||||
RDCDEBUG("Might want to fiddle with createinfo - e.g. to remove VK_RenderDoc from set of extensions or similar");
|
||||
|
||||
VkResult ret = get_dispatch_table(renderdoc_device_table_map, *pDevice)->CreateDevice(Unwrap(physicalDevice), &createInfo, pDevice);
|
||||
VkResult ret = GetDeviceDispatchTable(*pDevice)->CreateDevice(Unwrap(physicalDevice), &createInfo, pDevice);
|
||||
|
||||
if(ret == VK_SUCCESS)
|
||||
{
|
||||
@@ -939,9 +876,7 @@ VkResult WrappedVulkan::vkDestroyDevice(VkDevice device)
|
||||
GetResourceManager()->ReleaseWrappedResource(queues[i]);
|
||||
}
|
||||
|
||||
dispatch_key key = get_dispatch_key(device);
|
||||
VkResult ret = ObjDisp(device)->DestroyDevice(Unwrap(device));
|
||||
destroy_dispatch_table(renderdoc_device_table_map, key);
|
||||
|
||||
// VKTODOLOW on replay we're releasing this after resource manager
|
||||
// shutdown. Yes it's a hack, yes it's ugly.
|
||||
@@ -1038,22 +973,6 @@ VkResult WrappedVulkan::vkGetImageMemoryRequirements(
|
||||
return ObjDisp(device)->GetImageMemoryRequirements(Unwrap(device), Unwrap(image), pMemoryRequirements);
|
||||
}
|
||||
|
||||
VkResult WrappedVulkan::vkGetGlobalExtensionProperties(
|
||||
const char* pLayerName,
|
||||
uint32_t* pCount,
|
||||
VkExtensionProperties* pProperties)
|
||||
{
|
||||
if(pLayerName == NULL)
|
||||
{
|
||||
if(pCount) *pCount = uint32_t(globalExts.extensions.size());
|
||||
if(pProperties)
|
||||
memcpy(pProperties, &globalExts.extensions[0], sizeof(VkExtensionProperties)*globalExts.extensions.size());
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
return util_GetExtensionProperties(0, NULL, pCount, pProperties);
|
||||
}
|
||||
|
||||
#define DESTROY_IMPL(type, func) \
|
||||
VkResult WrappedVulkan::vk ## func(VkDevice device, type obj) \
|
||||
{ \
|
||||
@@ -5868,9 +5787,7 @@ bool WrappedVulkan::ReleaseResource(WrappedVkRes *res)
|
||||
case eResInstance:
|
||||
{
|
||||
VkInstance instance = disp->real.As<VkInstance>();
|
||||
dispatch_key key = get_dispatch_key(instance);
|
||||
((WrappedVkInstance::DispatchTableType *)disp->table)->DestroyInstance(instance);
|
||||
destroy_dispatch_table(renderdoc_instance_table_map, key);
|
||||
break;
|
||||
}
|
||||
case eResDevice:
|
||||
|
||||
@@ -160,15 +160,6 @@ private:
|
||||
};
|
||||
vector<ReplayData> m_PhysicalReplayData;
|
||||
int m_SwapPhysDevice;
|
||||
|
||||
struct ExtensionSupport
|
||||
{
|
||||
vector<VkExtensionProperties> renderdoc;
|
||||
vector<VkExtensionProperties> driver;
|
||||
vector<VkExtensionProperties> extensions;
|
||||
};
|
||||
ExtensionSupport globalExts;
|
||||
map<ResourceId, ExtensionSupport> deviceExts;
|
||||
|
||||
VulkanDebugManager *GetDebugManager()
|
||||
{ RDCASSERT(m_SwapPhysDevice >= 0); return m_PhysicalReplayData[m_SwapPhysDevice].debugMan; }
|
||||
@@ -491,13 +482,6 @@ public:
|
||||
IMPLEMENT_FUNCTION_SERIALISED(VkResult, vkDestroyDevice(
|
||||
VkDevice device));
|
||||
|
||||
// Extension discovery functions
|
||||
|
||||
IMPLEMENT_FUNCTION_SERIALISED(VkResult, vkGetGlobalExtensionProperties(
|
||||
const char* pLayerName,
|
||||
uint32_t* pCount,
|
||||
VkExtensionProperties* pProperties));
|
||||
|
||||
// Queue functions
|
||||
|
||||
IMPLEMENT_FUNCTION_SERIALISED(VkResult, vkGetDeviceQueue(
|
||||
|
||||
@@ -0,0 +1,178 @@
|
||||
/******************************************************************************
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2015 Baldur Karlsson
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
******************************************************************************/
|
||||
|
||||
#include "vk_common.h"
|
||||
#include "vk_hookset_defs.h"
|
||||
|
||||
#include "os/os_specific.h"
|
||||
#include "common/threading.h"
|
||||
|
||||
#include <unordered_map>
|
||||
|
||||
#if !defined(WIN32)
|
||||
#include <dlfcn.h>
|
||||
#endif
|
||||
|
||||
static VkLayerDispatchTable replayDeviceTable = {0};
|
||||
static VkLayerInstanceDispatchTable replayInstanceTable = {0};
|
||||
|
||||
static bool replay = false;
|
||||
|
||||
void InitReplayTables()
|
||||
{
|
||||
replay = true;
|
||||
|
||||
// VKTODOLOW this won't work with multiple devices - will need a replay device table for each
|
||||
|
||||
// not all functions will succeed - some need to be fetched through the below InitDeviceReplayTable()
|
||||
// VKTODOMED need to move this into os_specific
|
||||
|
||||
#undef HookInit
|
||||
|
||||
#ifdef WIN32
|
||||
#define HookInit(name) table.name = (CONCAT(PFN_vk, name))GetProcAddress(LoadLibraryA("vulkan.0.dll"), STRINGIZE(CONCAT(vk, name)))
|
||||
#else
|
||||
void *libhandle = dlopen("libvulkan.so", RTLD_NOW);
|
||||
#define HookInit(name) table.name = (CONCAT(PFN_vk, name))dlsym(libhandle, STRINGIZE(CONCAT(vk, name)))
|
||||
#endif
|
||||
|
||||
{
|
||||
VkLayerDispatchTable &table = replayDeviceTable;
|
||||
HookInitVulkanDevice();
|
||||
}
|
||||
|
||||
{
|
||||
VkLayerInstanceDispatchTable &table = replayInstanceTable;
|
||||
HookInitVulkanInstance();
|
||||
}
|
||||
}
|
||||
|
||||
void InitDeviceReplayTables(VkDevice device)
|
||||
{
|
||||
VkLayerDispatchTable *table = GetDeviceDispatchTable(NULL);
|
||||
RDCASSERT(table);
|
||||
|
||||
#define DeviceGPA(func) table->func = (CONCAT(PFN_vk, func))table->GetDeviceProcAddr(device, STRINGIZE(CONCAT(vk, func)));
|
||||
|
||||
DeviceGPA(CreateSwapChainWSI)
|
||||
DeviceGPA(DestroySwapChainWSI)
|
||||
DeviceGPA(GetSurfaceInfoWSI)
|
||||
DeviceGPA(GetSwapChainInfoWSI)
|
||||
DeviceGPA(AcquireNextImageWSI)
|
||||
DeviceGPA(QueuePresentWSI)
|
||||
|
||||
#undef DeviceGPA
|
||||
}
|
||||
|
||||
static Threading::CriticalSection devlock;
|
||||
std::map<void *, VkLayerDispatchTable> devlookup;
|
||||
|
||||
static Threading::CriticalSection instlock;
|
||||
std::map<void *, VkLayerInstanceDispatchTable> instlookup;
|
||||
|
||||
static void *GetKey(void *obj)
|
||||
{
|
||||
VkLayerDispatchTable **tablePtr = (VkLayerDispatchTable **)obj;
|
||||
return (void *)*tablePtr;
|
||||
}
|
||||
|
||||
void InitDeviceTable(const VkBaseLayerObject *obj)
|
||||
{
|
||||
void *key = GetKey(obj->baseObject);
|
||||
|
||||
VkLayerDispatchTable *table = NULL;
|
||||
|
||||
{
|
||||
SCOPED_LOCK(devlock);
|
||||
RDCEraseEl(devlookup[key]);
|
||||
table = &devlookup[key];
|
||||
}
|
||||
|
||||
// init the GetDeviceProcAddr function first
|
||||
table->GetDeviceProcAddr = (PFN_vkGetDeviceProcAddr)obj->pGPA((VkDevice)obj->nextObject, "vkGetDeviceProcAddr");
|
||||
|
||||
// fetch the rest of the functions
|
||||
#undef HookInit
|
||||
#define HookInit(name) if(table->name == NULL) table->name = (CONCAT(PFN_vk, name))obj->pGPA((VkDevice)obj->baseObject, STRINGIZE(CONCAT(vk, name)))
|
||||
|
||||
HookInitVulkanDevice();
|
||||
}
|
||||
|
||||
void InitInstanceTable(const VkBaseLayerObject *obj)
|
||||
{
|
||||
void *key = GetKey(obj->baseObject);
|
||||
|
||||
VkLayerInstanceDispatchTable *table = NULL;
|
||||
|
||||
{
|
||||
SCOPED_LOCK(instlock);
|
||||
RDCEraseEl(instlookup[key]);
|
||||
table = &instlookup[key];
|
||||
}
|
||||
|
||||
// init the GetInstanceProcAddr function first
|
||||
table->GetInstanceProcAddr = (PFN_vkGetInstanceProcAddr)obj->pGPA((VkInstance)obj->nextObject, "vkGetInstanceProcAddr");
|
||||
|
||||
// fetch the rest of the functions
|
||||
#undef HookInit
|
||||
#define HookInit(name) if(table->name == NULL) table->name = (CONCAT(PFN_vk, name))obj->pGPA((VkInstance)obj->baseObject, STRINGIZE(CONCAT(vk, name)))
|
||||
|
||||
HookInitVulkanInstance();
|
||||
}
|
||||
|
||||
VkLayerDispatchTable *GetDeviceDispatchTable(void *device)
|
||||
{
|
||||
if(replay) return &replayDeviceTable;
|
||||
|
||||
void *key = GetKey(device);
|
||||
|
||||
{
|
||||
SCOPED_LOCK(devlock);
|
||||
|
||||
auto it = devlookup.find(key);
|
||||
|
||||
if(it == devlookup.end())
|
||||
RDCFATAL("Bad device pointer");
|
||||
|
||||
return &it->second;
|
||||
}
|
||||
}
|
||||
|
||||
VkLayerInstanceDispatchTable *GetInstanceDispatchTable(void *instance)
|
||||
{
|
||||
if(replay) return &replayInstanceTable;
|
||||
|
||||
void *key = GetKey(instance);
|
||||
|
||||
{
|
||||
SCOPED_LOCK(instlock);
|
||||
|
||||
auto it = instlookup.find(key);
|
||||
|
||||
if(it == instlookup.end())
|
||||
RDCFATAL("Bad device pointer");
|
||||
|
||||
return &it->second;
|
||||
}
|
||||
}
|
||||
@@ -24,15 +24,35 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "vk_common.h"
|
||||
// layer includes
|
||||
|
||||
#include "vk_hookset_defs.h"
|
||||
#ifdef WIN32
|
||||
// undefined clashing windows #defines
|
||||
#undef CreateEvent
|
||||
#undef CreateSemaphore
|
||||
#endif
|
||||
|
||||
#undef HookInit
|
||||
#define HookInit(funcname) CONCAT(PFN_, funcname) funcname
|
||||
#include "vk_layer.h"
|
||||
|
||||
struct VulkanFunctions
|
||||
void InitReplayTables();
|
||||
void InitDeviceReplayTables(VkDevice device);
|
||||
|
||||
VkLayerDispatchTable *GetDeviceDispatchTable(void *device);
|
||||
VkLayerInstanceDispatchTable *GetInstanceDispatchTable(void *instance);
|
||||
|
||||
template<typename parenttype, typename wrappedtype>
|
||||
void SetDispatchTable(bool writing, parenttype parent, wrappedtype *wrapped)
|
||||
{
|
||||
HookInitVulkanInstance();
|
||||
HookInitVulkanDevice();
|
||||
};
|
||||
if(writing)
|
||||
{
|
||||
wrapped->table = wrappedtype::UseInstanceDispatchTable
|
||||
? (uintptr_t)GetInstanceDispatchTable((void *)parent)
|
||||
: (uintptr_t)GetDeviceDispatchTable((void *)parent);
|
||||
}
|
||||
else
|
||||
{
|
||||
wrapped->table = wrappedtype::UseInstanceDispatchTable
|
||||
? (uintptr_t)GetInstanceDispatchTable(NULL)
|
||||
: (uintptr_t)GetDeviceDispatchTable(NULL);
|
||||
}
|
||||
}
|
||||
@@ -25,127 +25,125 @@
|
||||
#pragma once
|
||||
|
||||
#define HookInitVulkanInstance() \
|
||||
HookInit(vkCreateInstance); \
|
||||
HookInit(vkDestroyInstance); \
|
||||
HookInit(vkEnumeratePhysicalDevices); \
|
||||
HookInit(vkGetPhysicalDeviceFeatures); \
|
||||
HookInit(vkGetPhysicalDeviceFormatProperties); \
|
||||
HookInit(vkGetPhysicalDeviceImageFormatProperties); \
|
||||
HookInit(vkGetPhysicalDeviceLimits); \
|
||||
HookInit(vkGetPhysicalDeviceProperties); \
|
||||
HookInit(vkGetPhysicalDeviceQueueCount); \
|
||||
HookInit(vkGetPhysicalDeviceQueueProperties); \
|
||||
HookInit(vkGetPhysicalDeviceMemoryProperties); \
|
||||
HookInit(vkDbgCreateMsgCallback); \
|
||||
HookInit(vkDbgDestroyMsgCallback); \
|
||||
HookInit(vkGetPhysicalDeviceSurfaceSupportWSI)
|
||||
HookInit(CreateInstance); \
|
||||
HookInit(DestroyInstance); \
|
||||
HookInit(EnumeratePhysicalDevices); \
|
||||
HookInit(GetPhysicalDeviceFeatures); \
|
||||
HookInit(GetPhysicalDeviceFormatProperties); \
|
||||
HookInit(GetPhysicalDeviceImageFormatProperties); \
|
||||
HookInit(GetPhysicalDeviceLimits); \
|
||||
HookInit(GetPhysicalDeviceProperties); \
|
||||
HookInit(GetPhysicalDeviceQueueCount); \
|
||||
HookInit(GetPhysicalDeviceQueueProperties); \
|
||||
HookInit(GetPhysicalDeviceMemoryProperties); \
|
||||
HookInit(DbgCreateMsgCallback); \
|
||||
HookInit(DbgDestroyMsgCallback); \
|
||||
HookInit(GetPhysicalDeviceSurfaceSupportWSI)
|
||||
|
||||
#define HookInitVulkanDevice() \
|
||||
HookInit(vkCreateDevice); \
|
||||
HookInit(vkDestroyDevice); \
|
||||
HookInit(vkGetGlobalExtensionProperties); \
|
||||
HookInit(vkGetDeviceQueue); \
|
||||
HookInit(vkQueueSubmit); \
|
||||
HookInit(vkQueueWaitIdle); \
|
||||
HookInit(vkDeviceWaitIdle); \
|
||||
HookInit(vkAllocMemory); \
|
||||
HookInit(vkFreeMemory); \
|
||||
HookInit(vkMapMemory); \
|
||||
HookInit(vkUnmapMemory); \
|
||||
HookInit(vkBindBufferMemory); \
|
||||
HookInit(vkBindImageMemory); \
|
||||
HookInit(vkCreateBuffer); \
|
||||
HookInit(vkDestroyBuffer); \
|
||||
HookInit(vkCreateBufferView); \
|
||||
HookInit(vkDestroyBufferView); \
|
||||
HookInit(vkCreateImage); \
|
||||
HookInit(vkDestroyImage); \
|
||||
HookInit(vkGetImageSubresourceLayout); \
|
||||
HookInit(vkGetBufferMemoryRequirements); \
|
||||
HookInit(vkGetImageMemoryRequirements); \
|
||||
HookInit(vkCreateImageView); \
|
||||
HookInit(vkDestroyImageView); \
|
||||
HookInit(vkCreateAttachmentView); \
|
||||
HookInit(vkDestroyAttachmentView); \
|
||||
HookInit(vkCreateShader); \
|
||||
HookInit(vkDestroyShader); \
|
||||
HookInit(vkCreateShaderModule); \
|
||||
HookInit(vkDestroyShaderModule); \
|
||||
HookInit(vkCreateGraphicsPipelines); \
|
||||
HookInit(vkDestroyPipeline); \
|
||||
HookInit(vkCreatePipelineCache); \
|
||||
HookInit(vkDestroyPipelineCache); \
|
||||
HookInit(vkCreatePipelineLayout); \
|
||||
HookInit(vkDestroyPipelineLayout); \
|
||||
HookInit(vkCreateSemaphore); \
|
||||
HookInit(vkDestroySemaphore); \
|
||||
HookInit(vkQueueSignalSemaphore); \
|
||||
HookInit(vkQueueWaitSemaphore); \
|
||||
HookInit(vkCreateSampler); \
|
||||
HookInit(vkDestroySampler); \
|
||||
HookInit(vkCreateDescriptorSetLayout); \
|
||||
HookInit(vkDestroyDescriptorSetLayout); \
|
||||
HookInit(vkCreateDescriptorPool); \
|
||||
HookInit(vkDestroyDescriptorPool); \
|
||||
HookInit(vkAllocDescriptorSets); \
|
||||
HookInit(vkUpdateDescriptorSets); \
|
||||
HookInit(vkFreeDescriptorSets); \
|
||||
HookInit(vkCreateDynamicViewportState); \
|
||||
HookInit(vkDestroyDynamicViewportState); \
|
||||
HookInit(vkCreateDynamicRasterState); \
|
||||
HookInit(vkDestroyDynamicRasterState); \
|
||||
HookInit(vkCreateDynamicColorBlendState); \
|
||||
HookInit(vkDestroyDynamicColorBlendState); \
|
||||
HookInit(vkCreateDynamicDepthStencilState); \
|
||||
HookInit(vkDestroyDynamicDepthStencilState); \
|
||||
HookInit(vkCreateCommandPool); \
|
||||
HookInit(vkDestroyCommandPool); \
|
||||
HookInit(vkResetCommandPool); \
|
||||
HookInit(vkCreateCommandBuffer); \
|
||||
HookInit(vkDestroyCommandBuffer); \
|
||||
HookInit(vkBeginCommandBuffer); \
|
||||
HookInit(vkEndCommandBuffer); \
|
||||
HookInit(vkResetCommandBuffer); \
|
||||
HookInit(vkCmdBindPipeline); \
|
||||
HookInit(vkCmdBindDynamicViewportState); \
|
||||
HookInit(vkCmdBindDynamicRasterState); \
|
||||
HookInit(vkCmdBindDynamicColorBlendState); \
|
||||
HookInit(vkCmdBindDynamicDepthStencilState); \
|
||||
HookInit(vkCmdBindDescriptorSets); \
|
||||
HookInit(vkCmdBindVertexBuffers); \
|
||||
HookInit(vkCmdBindIndexBuffer); \
|
||||
HookInit(vkCmdDraw); \
|
||||
HookInit(vkCmdDrawIndirect); \
|
||||
HookInit(vkCmdDrawIndexed); \
|
||||
HookInit(vkCmdDrawIndexedIndirect); \
|
||||
HookInit(vkCmdDispatch); \
|
||||
HookInit(vkCmdDispatchIndirect); \
|
||||
HookInit(vkCmdCopyBufferToImage); \
|
||||
HookInit(vkCmdCopyImageToBuffer); \
|
||||
HookInit(vkCmdCopyBuffer); \
|
||||
HookInit(vkCmdCopyImage); \
|
||||
HookInit(vkCmdBlitImage); \
|
||||
HookInit(vkCmdClearColorImage); \
|
||||
HookInit(vkCmdClearDepthStencilImage); \
|
||||
HookInit(vkCmdClearColorAttachment); \
|
||||
HookInit(vkCmdClearDepthStencilAttachment); \
|
||||
HookInit(vkCmdPipelineBarrier); \
|
||||
HookInit(vkCreateFramebuffer); \
|
||||
HookInit(vkDestroyFramebuffer); \
|
||||
HookInit(vkCreateRenderPass); \
|
||||
HookInit(vkDestroyRenderPass); \
|
||||
HookInit(vkCmdBeginRenderPass); \
|
||||
HookInit(vkCmdEndRenderPass); \
|
||||
HookInit(vkCmdDbgMarkerBegin); \
|
||||
HookInit(vkCmdDbgMarkerEnd); \
|
||||
HookInit(vkDbgCreateMsgCallback); \
|
||||
HookInit(vkDbgDestroyMsgCallback); \
|
||||
HookInit(vkCreateSwapChainWSI); \
|
||||
HookInit(vkDestroySwapChainWSI); \
|
||||
HookInit(vkGetSurfaceInfoWSI); \
|
||||
HookInit(vkGetSwapChainInfoWSI); \
|
||||
HookInit(vkAcquireNextImageWSI); \
|
||||
HookInit(vkQueuePresentWSI)
|
||||
HookInit(GetDeviceProcAddr); \
|
||||
HookInit(CreateDevice); \
|
||||
HookInit(DestroyDevice); \
|
||||
HookInit(GetDeviceQueue); \
|
||||
HookInit(QueueSubmit); \
|
||||
HookInit(QueueWaitIdle); \
|
||||
HookInit(DeviceWaitIdle); \
|
||||
HookInit(AllocMemory); \
|
||||
HookInit(FreeMemory); \
|
||||
HookInit(MapMemory); \
|
||||
HookInit(UnmapMemory); \
|
||||
HookInit(BindBufferMemory); \
|
||||
HookInit(BindImageMemory); \
|
||||
HookInit(CreateBuffer); \
|
||||
HookInit(DestroyBuffer); \
|
||||
HookInit(CreateBufferView); \
|
||||
HookInit(DestroyBufferView); \
|
||||
HookInit(CreateImage); \
|
||||
HookInit(DestroyImage); \
|
||||
HookInit(GetImageSubresourceLayout); \
|
||||
HookInit(GetBufferMemoryRequirements); \
|
||||
HookInit(GetImageMemoryRequirements); \
|
||||
HookInit(CreateImageView); \
|
||||
HookInit(DestroyImageView); \
|
||||
HookInit(CreateAttachmentView); \
|
||||
HookInit(DestroyAttachmentView); \
|
||||
HookInit(CreateShader); \
|
||||
HookInit(DestroyShader); \
|
||||
HookInit(CreateShaderModule); \
|
||||
HookInit(DestroyShaderModule); \
|
||||
HookInit(CreateGraphicsPipelines); \
|
||||
HookInit(DestroyPipeline); \
|
||||
HookInit(CreatePipelineCache); \
|
||||
HookInit(DestroyPipelineCache); \
|
||||
HookInit(CreatePipelineLayout); \
|
||||
HookInit(DestroyPipelineLayout); \
|
||||
HookInit(CreateSemaphore); \
|
||||
HookInit(DestroySemaphore); \
|
||||
HookInit(QueueSignalSemaphore); \
|
||||
HookInit(QueueWaitSemaphore); \
|
||||
HookInit(CreateSampler); \
|
||||
HookInit(DestroySampler); \
|
||||
HookInit(CreateDescriptorSetLayout); \
|
||||
HookInit(DestroyDescriptorSetLayout); \
|
||||
HookInit(CreateDescriptorPool); \
|
||||
HookInit(DestroyDescriptorPool); \
|
||||
HookInit(AllocDescriptorSets); \
|
||||
HookInit(UpdateDescriptorSets); \
|
||||
HookInit(FreeDescriptorSets); \
|
||||
HookInit(CreateDynamicViewportState); \
|
||||
HookInit(DestroyDynamicViewportState); \
|
||||
HookInit(CreateDynamicRasterState); \
|
||||
HookInit(DestroyDynamicRasterState); \
|
||||
HookInit(CreateDynamicColorBlendState); \
|
||||
HookInit(DestroyDynamicColorBlendState); \
|
||||
HookInit(CreateDynamicDepthStencilState); \
|
||||
HookInit(DestroyDynamicDepthStencilState); \
|
||||
HookInit(CreateCommandPool); \
|
||||
HookInit(DestroyCommandPool); \
|
||||
HookInit(ResetCommandPool); \
|
||||
HookInit(CreateCommandBuffer); \
|
||||
HookInit(DestroyCommandBuffer); \
|
||||
HookInit(BeginCommandBuffer); \
|
||||
HookInit(EndCommandBuffer); \
|
||||
HookInit(ResetCommandBuffer); \
|
||||
HookInit(CmdBindPipeline); \
|
||||
HookInit(CmdBindDynamicViewportState); \
|
||||
HookInit(CmdBindDynamicRasterState); \
|
||||
HookInit(CmdBindDynamicColorBlendState); \
|
||||
HookInit(CmdBindDynamicDepthStencilState); \
|
||||
HookInit(CmdBindDescriptorSets); \
|
||||
HookInit(CmdBindVertexBuffers); \
|
||||
HookInit(CmdBindIndexBuffer); \
|
||||
HookInit(CmdDraw); \
|
||||
HookInit(CmdDrawIndirect); \
|
||||
HookInit(CmdDrawIndexed); \
|
||||
HookInit(CmdDrawIndexedIndirect); \
|
||||
HookInit(CmdDispatch); \
|
||||
HookInit(CmdDispatchIndirect); \
|
||||
HookInit(CmdCopyBufferToImage); \
|
||||
HookInit(CmdCopyImageToBuffer); \
|
||||
HookInit(CmdCopyBuffer); \
|
||||
HookInit(CmdCopyImage); \
|
||||
HookInit(CmdBlitImage); \
|
||||
HookInit(CmdClearColorImage); \
|
||||
HookInit(CmdClearDepthStencilImage); \
|
||||
HookInit(CmdClearColorAttachment); \
|
||||
HookInit(CmdClearDepthStencilAttachment); \
|
||||
HookInit(CmdPipelineBarrier); \
|
||||
HookInit(CreateFramebuffer); \
|
||||
HookInit(DestroyFramebuffer); \
|
||||
HookInit(CreateRenderPass); \
|
||||
HookInit(DestroyRenderPass); \
|
||||
HookInit(CmdBeginRenderPass); \
|
||||
HookInit(CmdEndRenderPass); \
|
||||
HookInit(DbgCreateMsgCallback); \
|
||||
HookInit(DbgDestroyMsgCallback); \
|
||||
HookInit(CreateSwapChainWSI); \
|
||||
HookInit(DestroySwapChainWSI); \
|
||||
HookInit(GetSurfaceInfoWSI); \
|
||||
HookInit(GetSwapChainInfoWSI); \
|
||||
HookInit(AcquireNextImageWSI); \
|
||||
HookInit(QueuePresentWSI)
|
||||
|
||||
#define DefineHooks() \
|
||||
HookDefine2(VkResult, vkCreateInstance, const VkInstanceCreateInfo*, pCreateInfo, VkInstance*, pInstance); \
|
||||
@@ -161,7 +159,6 @@
|
||||
HookDefine2(VkResult, vkGetPhysicalDeviceMemoryProperties, VkPhysicalDevice, physicalDevice, VkPhysicalDeviceMemoryProperties*, pMemoryProperties); \
|
||||
HookDefine3(VkResult, vkCreateDevice, VkPhysicalDevice, physicalDevice, const VkDeviceCreateInfo*, pCreateInfo, VkDevice*, pDevice); \
|
||||
HookDefine1(VkResult, vkDestroyDevice, VkDevice, device); \
|
||||
HookDefine3(VkResult, vkGetGlobalExtensionProperties, const char*, pLayerName, uint32_t*, pCount, VkExtensionProperties*, pProperties); \
|
||||
HookDefine4(VkResult, vkGetDeviceQueue, VkDevice, device, uint32_t, queueFamilyIndex, uint32_t, queueIndex, VkQueue*, pQueue); \
|
||||
HookDefine4(VkResult, vkQueueSubmit, VkQueue, queue, uint32_t, cmdBufferCount, const VkCmdBuffer*, pCmdBuffers, VkFence, fence); \
|
||||
HookDefine1(VkResult, vkQueueWaitIdle, VkQueue, queue); \
|
||||
@@ -254,8 +251,6 @@
|
||||
HookDefine2(VkResult, vkDestroyRenderPass, VkDevice, device, VkRenderPass, renderPass); \
|
||||
HookDefine3(void, vkCmdBeginRenderPass, VkCmdBuffer, cmdBuffer, const VkRenderPassBeginInfo*, pRenderPassBegin, VkRenderPassContents, contents); \
|
||||
HookDefine1(void, vkCmdEndRenderPass, VkCmdBuffer, cmdBuffer); \
|
||||
HookDefine2(void, vkCmdDbgMarkerBegin, VkCmdBuffer, cmdBuffer, const char*, pMarker); \
|
||||
HookDefine1(void, vkCmdDbgMarkerEnd, VkCmdBuffer, cmdBuffer); \
|
||||
HookDefine5(VkResult, vkDbgCreateMsgCallback, VkInstance, instance, VkFlags, msgFlags, const PFN_vkDbgMsgCallback, pfnMsgCallback, void*, pUserData, VkDbgMsgCallback*, pMsgCallback); \
|
||||
HookDefine2(VkResult, vkDbgDestroyMsgCallback, VkInstance, instance, VkDbgMsgCallback, msgCallback); \
|
||||
HookDefine4(VkResult, vkGetPhysicalDeviceSurfaceSupportWSI, VkPhysicalDevice, physicalDevice, uint32_t, queueFamilyIndex, const VkSurfaceDescriptionWSI*, pSurfaceDescription, VkBool32*, pSupported); \
|
||||
|
||||
@@ -1608,16 +1608,6 @@ void VulkanReplay::SetProxyBufferData(ResourceId bufid, byte *data, size_t dataS
|
||||
// in vk_replay_platform.cpp
|
||||
bool LoadVulkanLibrary();
|
||||
|
||||
static VkLayerDispatchTable replayDeviceTable = {0};
|
||||
static VkLayerInstanceDispatchTable replayInstanceTable = {0};
|
||||
|
||||
VkLayerDispatchTable *dummyDeviceTable = NULL;
|
||||
VkLayerInstanceDispatchTable *dummyInstanceTable = NULL;
|
||||
|
||||
#if !defined(WIN32)
|
||||
#include <dlfcn.h>
|
||||
#endif
|
||||
|
||||
ReplayCreateStatus Vulkan_CreateReplayDevice(const char *logfile, IReplayDriver **driver)
|
||||
{
|
||||
RDCDEBUG("Creating a VulkanReplay replay device");
|
||||
@@ -1640,192 +1630,8 @@ ReplayCreateStatus Vulkan_CreateReplayDevice(const char *logfile, IReplayDriver
|
||||
return eReplayCreate_APIIncompatibleVersion;
|
||||
}
|
||||
|
||||
dummyDeviceTable = &replayDeviceTable;
|
||||
dummyInstanceTable = &replayInstanceTable;
|
||||
InitReplayTables();
|
||||
|
||||
#ifdef WIN32
|
||||
|
||||
#define GetProcAddr(type, name) (type)GetProcAddress(LoadLibraryA("vulkan.0.dll"), STRINGIZE(CONCAT(vk, name)))
|
||||
|
||||
#else
|
||||
|
||||
void *libhandle = dlopen("libvulkan.so", RTLD_NOW);
|
||||
|
||||
#define GetProcAddr(type, name) (type)dlsym(libhandle, STRINGIZE(CONCAT(vk, name)))
|
||||
|
||||
#endif
|
||||
|
||||
{
|
||||
VkLayerDispatchTable &table = replayDeviceTable;
|
||||
|
||||
table.GetDeviceProcAddr = GetProcAddr(PFN_vkGetDeviceProcAddr, GetDeviceProcAddr);
|
||||
table.CreateDevice = GetProcAddr(PFN_vkCreateDevice, CreateDevice);
|
||||
table.DestroyDevice = GetProcAddr(PFN_vkDestroyDevice, DestroyDevice);
|
||||
table.GetDeviceQueue = GetProcAddr(PFN_vkGetDeviceQueue, GetDeviceQueue);
|
||||
table.QueueSubmit = GetProcAddr(PFN_vkQueueSubmit, QueueSubmit);
|
||||
table.QueueWaitIdle = GetProcAddr(PFN_vkQueueWaitIdle, QueueWaitIdle);
|
||||
table.DeviceWaitIdle = GetProcAddr(PFN_vkDeviceWaitIdle, DeviceWaitIdle);
|
||||
table.AllocMemory = GetProcAddr(PFN_vkAllocMemory, AllocMemory);
|
||||
table.FreeMemory = GetProcAddr(PFN_vkFreeMemory, FreeMemory);
|
||||
table.MapMemory = GetProcAddr(PFN_vkMapMemory, MapMemory);
|
||||
table.UnmapMemory = GetProcAddr(PFN_vkUnmapMemory, UnmapMemory);
|
||||
table.FlushMappedMemoryRanges = GetProcAddr(PFN_vkFlushMappedMemoryRanges, FlushMappedMemoryRanges);
|
||||
table.InvalidateMappedMemoryRanges = GetProcAddr(PFN_vkInvalidateMappedMemoryRanges, InvalidateMappedMemoryRanges);
|
||||
table.GetDeviceMemoryCommitment = GetProcAddr(PFN_vkGetDeviceMemoryCommitment, GetDeviceMemoryCommitment);
|
||||
table.GetImageSparseMemoryRequirements = GetProcAddr(PFN_vkGetImageSparseMemoryRequirements, GetImageSparseMemoryRequirements);
|
||||
table.GetImageMemoryRequirements = GetProcAddr(PFN_vkGetImageMemoryRequirements, GetImageMemoryRequirements);
|
||||
table.GetBufferMemoryRequirements = GetProcAddr(PFN_vkGetBufferMemoryRequirements, GetBufferMemoryRequirements);
|
||||
table.BindImageMemory = GetProcAddr(PFN_vkBindImageMemory, BindImageMemory);
|
||||
table.BindBufferMemory = GetProcAddr(PFN_vkBindBufferMemory, BindBufferMemory);
|
||||
table.QueueBindSparseBufferMemory = GetProcAddr(PFN_vkQueueBindSparseBufferMemory, QueueBindSparseBufferMemory);
|
||||
table.QueueBindSparseImageOpaqueMemory = GetProcAddr(PFN_vkQueueBindSparseImageOpaqueMemory, QueueBindSparseImageOpaqueMemory);
|
||||
table.QueueBindSparseImageMemory = GetProcAddr(PFN_vkQueueBindSparseImageMemory, QueueBindSparseImageMemory);
|
||||
table.CreateFence = GetProcAddr(PFN_vkCreateFence, CreateFence);
|
||||
table.DestroyFence = GetProcAddr(PFN_vkDestroyFence, DestroyFence);
|
||||
table.GetFenceStatus = GetProcAddr(PFN_vkGetFenceStatus, GetFenceStatus);
|
||||
table.ResetFences = GetProcAddr(PFN_vkResetFences, ResetFences);
|
||||
table.WaitForFences = GetProcAddr(PFN_vkWaitForFences, WaitForFences);
|
||||
table.CreateSemaphore = GetProcAddr(PFN_vkCreateSemaphore, CreateSemaphore);
|
||||
table.DestroySemaphore = GetProcAddr(PFN_vkDestroySemaphore, DestroySemaphore);
|
||||
table.QueueSignalSemaphore = GetProcAddr(PFN_vkQueueSignalSemaphore, QueueSignalSemaphore);
|
||||
table.QueueWaitSemaphore = GetProcAddr(PFN_vkQueueWaitSemaphore, QueueWaitSemaphore);
|
||||
table.CreateEvent = GetProcAddr(PFN_vkCreateEvent, CreateEvent);
|
||||
table.DestroyEvent = GetProcAddr(PFN_vkDestroyEvent, DestroyEvent);
|
||||
table.GetEventStatus = GetProcAddr(PFN_vkGetEventStatus, GetEventStatus);
|
||||
table.SetEvent = GetProcAddr(PFN_vkSetEvent, SetEvent);
|
||||
table.ResetEvent = GetProcAddr(PFN_vkResetEvent, ResetEvent);
|
||||
table.CreateQueryPool = GetProcAddr(PFN_vkCreateQueryPool, CreateQueryPool);
|
||||
table.DestroyQueryPool = GetProcAddr(PFN_vkDestroyQueryPool, DestroyQueryPool);
|
||||
table.GetQueryPoolResults = GetProcAddr(PFN_vkGetQueryPoolResults, GetQueryPoolResults);
|
||||
table.CreateBuffer = GetProcAddr(PFN_vkCreateBuffer, CreateBuffer);
|
||||
table.DestroyBuffer = GetProcAddr(PFN_vkDestroyBuffer, DestroyBuffer);
|
||||
table.CreateBufferView = GetProcAddr(PFN_vkCreateBufferView, CreateBufferView);
|
||||
table.DestroyBufferView = GetProcAddr(PFN_vkDestroyBufferView, DestroyBufferView);
|
||||
table.CreateImage = GetProcAddr(PFN_vkCreateImage, CreateImage);
|
||||
table.DestroyImage = GetProcAddr(PFN_vkDestroyImage, DestroyImage);
|
||||
table.GetImageSubresourceLayout = GetProcAddr(PFN_vkGetImageSubresourceLayout, GetImageSubresourceLayout);
|
||||
table.CreateImageView = GetProcAddr(PFN_vkCreateImageView, CreateImageView);
|
||||
table.DestroyImageView = GetProcAddr(PFN_vkDestroyImageView, DestroyImageView);
|
||||
table.CreateAttachmentView = GetProcAddr(PFN_vkCreateAttachmentView, CreateAttachmentView);
|
||||
table.DestroyAttachmentView = GetProcAddr(PFN_vkDestroyAttachmentView, DestroyAttachmentView);
|
||||
table.CreateShaderModule = GetProcAddr(PFN_vkCreateShaderModule, CreateShaderModule);
|
||||
table.DestroyShaderModule = GetProcAddr(PFN_vkDestroyShaderModule, DestroyShaderModule);
|
||||
table.CreateShader = GetProcAddr(PFN_vkCreateShader, CreateShader);
|
||||
table.DestroyShader = GetProcAddr(PFN_vkDestroyShader, DestroyShader);
|
||||
table.CreatePipelineCache = GetProcAddr(PFN_vkCreatePipelineCache, CreatePipelineCache);
|
||||
table.DestroyPipelineCache = GetProcAddr(PFN_vkDestroyPipelineCache, DestroyPipelineCache);
|
||||
table.GetPipelineCacheSize = GetProcAddr(PFN_vkGetPipelineCacheSize, GetPipelineCacheSize);
|
||||
table.GetPipelineCacheData = GetProcAddr(PFN_vkGetPipelineCacheData, GetPipelineCacheData);
|
||||
table.MergePipelineCaches = GetProcAddr(PFN_vkMergePipelineCaches, MergePipelineCaches);
|
||||
table.CreateGraphicsPipelines = GetProcAddr(PFN_vkCreateGraphicsPipelines, CreateGraphicsPipelines);
|
||||
table.CreateComputePipelines = GetProcAddr(PFN_vkCreateComputePipelines, CreateComputePipelines);
|
||||
table.DestroyPipeline = GetProcAddr(PFN_vkDestroyPipeline, DestroyPipeline);
|
||||
table.CreatePipelineLayout = GetProcAddr(PFN_vkCreatePipelineLayout, CreatePipelineLayout);
|
||||
table.DestroyPipelineLayout = GetProcAddr(PFN_vkDestroyPipelineLayout, DestroyPipelineLayout);
|
||||
table.CreateSampler = GetProcAddr(PFN_vkCreateSampler, CreateSampler);
|
||||
table.DestroySampler = GetProcAddr(PFN_vkDestroySampler, DestroySampler);
|
||||
table.CreateDescriptorSetLayout = GetProcAddr(PFN_vkCreateDescriptorSetLayout, CreateDescriptorSetLayout);
|
||||
table.DestroyDescriptorSetLayout = GetProcAddr(PFN_vkDestroyDescriptorSetLayout, DestroyDescriptorSetLayout);
|
||||
table.CreateDescriptorPool = GetProcAddr(PFN_vkCreateDescriptorPool, CreateDescriptorPool);
|
||||
table.DestroyDescriptorPool = GetProcAddr(PFN_vkDestroyDescriptorPool, DestroyDescriptorPool);
|
||||
table.ResetDescriptorPool = GetProcAddr(PFN_vkResetDescriptorPool, ResetDescriptorPool);
|
||||
table.AllocDescriptorSets = GetProcAddr(PFN_vkAllocDescriptorSets, AllocDescriptorSets);
|
||||
table.FreeDescriptorSets = GetProcAddr(PFN_vkFreeDescriptorSets, FreeDescriptorSets);
|
||||
table.UpdateDescriptorSets = GetProcAddr(PFN_vkUpdateDescriptorSets, UpdateDescriptorSets);
|
||||
table.CreateDynamicViewportState = GetProcAddr(PFN_vkCreateDynamicViewportState, CreateDynamicViewportState);
|
||||
table.DestroyDynamicViewportState = GetProcAddr(PFN_vkDestroyDynamicViewportState, DestroyDynamicViewportState);
|
||||
table.CreateDynamicRasterState = GetProcAddr(PFN_vkCreateDynamicRasterState, CreateDynamicRasterState);
|
||||
table.DestroyDynamicRasterState = GetProcAddr(PFN_vkDestroyDynamicRasterState, DestroyDynamicRasterState);
|
||||
table.CreateDynamicColorBlendState = GetProcAddr(PFN_vkCreateDynamicColorBlendState, CreateDynamicColorBlendState);
|
||||
table.DestroyDynamicColorBlendState = GetProcAddr(PFN_vkDestroyDynamicColorBlendState, DestroyDynamicColorBlendState);
|
||||
table.CreateDynamicDepthStencilState = GetProcAddr(PFN_vkCreateDynamicDepthStencilState, CreateDynamicDepthStencilState);
|
||||
table.DestroyDynamicDepthStencilState = GetProcAddr(PFN_vkDestroyDynamicDepthStencilState, DestroyDynamicDepthStencilState);
|
||||
table.CreateFramebuffer = GetProcAddr(PFN_vkCreateFramebuffer, CreateFramebuffer);
|
||||
table.DestroyFramebuffer = GetProcAddr(PFN_vkDestroyFramebuffer, DestroyFramebuffer);
|
||||
table.CreateRenderPass = GetProcAddr(PFN_vkCreateRenderPass, CreateRenderPass);
|
||||
table.DestroyRenderPass = GetProcAddr(PFN_vkDestroyRenderPass, DestroyRenderPass);
|
||||
table.GetRenderAreaGranularity = GetProcAddr(PFN_vkGetRenderAreaGranularity, GetRenderAreaGranularity);
|
||||
table.CreateCommandPool = GetProcAddr(PFN_vkCreateCommandPool, CreateCommandPool);
|
||||
table.DestroyCommandPool = GetProcAddr(PFN_vkDestroyCommandPool, DestroyCommandPool);
|
||||
table.ResetCommandPool = GetProcAddr(PFN_vkResetCommandPool, ResetCommandPool);
|
||||
table.CreateCommandBuffer = GetProcAddr(PFN_vkCreateCommandBuffer, CreateCommandBuffer);
|
||||
table.DestroyCommandBuffer = GetProcAddr(PFN_vkDestroyCommandBuffer, DestroyCommandBuffer);
|
||||
table.BeginCommandBuffer = GetProcAddr(PFN_vkBeginCommandBuffer, BeginCommandBuffer);
|
||||
table.EndCommandBuffer = GetProcAddr(PFN_vkEndCommandBuffer, EndCommandBuffer);
|
||||
table.ResetCommandBuffer = GetProcAddr(PFN_vkResetCommandBuffer, ResetCommandBuffer);
|
||||
table.CmdBindPipeline = GetProcAddr(PFN_vkCmdBindPipeline, CmdBindPipeline);
|
||||
table.CmdBindDynamicViewportState = GetProcAddr(PFN_vkCmdBindDynamicViewportState, CmdBindDynamicViewportState);
|
||||
table.CmdBindDynamicRasterState = GetProcAddr(PFN_vkCmdBindDynamicRasterState, CmdBindDynamicRasterState);
|
||||
table.CmdBindDynamicColorBlendState = GetProcAddr(PFN_vkCmdBindDynamicColorBlendState, CmdBindDynamicColorBlendState);
|
||||
table.CmdBindDynamicDepthStencilState = GetProcAddr(PFN_vkCmdBindDynamicDepthStencilState, CmdBindDynamicDepthStencilState);
|
||||
table.CmdBindDescriptorSets = GetProcAddr(PFN_vkCmdBindDescriptorSets, CmdBindDescriptorSets);
|
||||
table.CmdBindVertexBuffers = GetProcAddr(PFN_vkCmdBindVertexBuffers, CmdBindVertexBuffers);
|
||||
table.CmdBindIndexBuffer = GetProcAddr(PFN_vkCmdBindIndexBuffer, CmdBindIndexBuffer);
|
||||
table.CmdDraw = GetProcAddr(PFN_vkCmdDraw, CmdDraw);
|
||||
table.CmdDrawIndexed = GetProcAddr(PFN_vkCmdDrawIndexed, CmdDrawIndexed);
|
||||
table.CmdDrawIndirect = GetProcAddr(PFN_vkCmdDrawIndirect, CmdDrawIndirect);
|
||||
table.CmdDrawIndexedIndirect = GetProcAddr(PFN_vkCmdDrawIndexedIndirect, CmdDrawIndexedIndirect);
|
||||
table.CmdDispatch = GetProcAddr(PFN_vkCmdDispatch, CmdDispatch);
|
||||
table.CmdDispatchIndirect = GetProcAddr(PFN_vkCmdDispatchIndirect, CmdDispatchIndirect);
|
||||
table.CmdCopyBuffer = GetProcAddr(PFN_vkCmdCopyBuffer, CmdCopyBuffer);
|
||||
table.CmdCopyImage = GetProcAddr(PFN_vkCmdCopyImage, CmdCopyImage);
|
||||
table.CmdBlitImage = GetProcAddr(PFN_vkCmdBlitImage, CmdBlitImage);
|
||||
table.CmdCopyBufferToImage = GetProcAddr(PFN_vkCmdCopyBufferToImage, CmdCopyBufferToImage);
|
||||
table.CmdCopyImageToBuffer = GetProcAddr(PFN_vkCmdCopyImageToBuffer, CmdCopyImageToBuffer);
|
||||
table.CmdUpdateBuffer = GetProcAddr(PFN_vkCmdUpdateBuffer, CmdUpdateBuffer);
|
||||
table.CmdFillBuffer = GetProcAddr(PFN_vkCmdFillBuffer, CmdFillBuffer);
|
||||
table.CmdClearColorImage = GetProcAddr(PFN_vkCmdClearColorImage, CmdClearColorImage);
|
||||
table.CmdClearDepthStencilImage = GetProcAddr(PFN_vkCmdClearDepthStencilImage, CmdClearDepthStencilImage);
|
||||
table.CmdClearColorAttachment = GetProcAddr(PFN_vkCmdClearColorAttachment, CmdClearColorAttachment);
|
||||
table.CmdClearDepthStencilAttachment = GetProcAddr(PFN_vkCmdClearDepthStencilAttachment, CmdClearDepthStencilAttachment);
|
||||
table.CmdResolveImage = GetProcAddr(PFN_vkCmdResolveImage, CmdResolveImage);
|
||||
table.CmdSetEvent = GetProcAddr(PFN_vkCmdSetEvent, CmdSetEvent);
|
||||
table.CmdResetEvent = GetProcAddr(PFN_vkCmdResetEvent, CmdResetEvent);
|
||||
table.CmdWaitEvents = GetProcAddr(PFN_vkCmdWaitEvents, CmdWaitEvents);
|
||||
table.CmdPipelineBarrier = GetProcAddr(PFN_vkCmdPipelineBarrier, CmdPipelineBarrier);
|
||||
table.CmdBeginQuery = GetProcAddr(PFN_vkCmdBeginQuery, CmdBeginQuery);
|
||||
table.CmdEndQuery = GetProcAddr(PFN_vkCmdEndQuery, CmdEndQuery);
|
||||
table.CmdResetQueryPool = GetProcAddr(PFN_vkCmdResetQueryPool, CmdResetQueryPool);
|
||||
table.CmdWriteTimestamp = GetProcAddr(PFN_vkCmdWriteTimestamp, CmdWriteTimestamp);
|
||||
table.CmdCopyQueryPoolResults = GetProcAddr(PFN_vkCmdCopyQueryPoolResults, CmdCopyQueryPoolResults);
|
||||
table.CmdPushConstants = GetProcAddr(PFN_vkCmdPushConstants, CmdPushConstants);
|
||||
table.CmdBeginRenderPass = GetProcAddr(PFN_vkCmdBeginRenderPass, CmdBeginRenderPass);
|
||||
table.CmdNextSubpass = GetProcAddr(PFN_vkCmdNextSubpass, CmdNextSubpass);
|
||||
table.CmdEndRenderPass = GetProcAddr(PFN_vkCmdEndRenderPass, CmdEndRenderPass);
|
||||
table.CmdExecuteCommands = GetProcAddr(PFN_vkCmdExecuteCommands, CmdExecuteCommands);
|
||||
table.GetSurfaceInfoWSI = GetProcAddr(PFN_vkGetSurfaceInfoWSI, GetSurfaceInfoWSI);
|
||||
table.CreateSwapChainWSI = GetProcAddr(PFN_vkCreateSwapChainWSI, CreateSwapChainWSI);
|
||||
table.DestroySwapChainWSI = GetProcAddr(PFN_vkDestroySwapChainWSI, DestroySwapChainWSI);
|
||||
table.GetSwapChainInfoWSI = GetProcAddr(PFN_vkGetSwapChainInfoWSI, GetSwapChainInfoWSI);
|
||||
table.AcquireNextImageWSI = GetProcAddr(PFN_vkAcquireNextImageWSI, AcquireNextImageWSI);
|
||||
table.QueuePresentWSI = GetProcAddr(PFN_vkQueuePresentWSI, QueuePresentWSI);
|
||||
table.DbgCreateMsgCallback = GetProcAddr(PFN_vkDbgCreateMsgCallback, DbgCreateMsgCallback);
|
||||
table.DbgDestroyMsgCallback = GetProcAddr(PFN_vkDbgDestroyMsgCallback, DbgDestroyMsgCallback);
|
||||
}
|
||||
|
||||
{
|
||||
VkLayerInstanceDispatchTable &table = replayInstanceTable;
|
||||
|
||||
table.GetInstanceProcAddr = GetProcAddr(PFN_vkGetInstanceProcAddr, GetInstanceProcAddr);
|
||||
table.CreateInstance = GetProcAddr(PFN_vkCreateInstance, CreateInstance);
|
||||
table.DestroyInstance = GetProcAddr(PFN_vkDestroyInstance, DestroyInstance);
|
||||
table.EnumeratePhysicalDevices = GetProcAddr(PFN_vkEnumeratePhysicalDevices, EnumeratePhysicalDevices);
|
||||
table.GetPhysicalDeviceFeatures = GetProcAddr(PFN_vkGetPhysicalDeviceFeatures, GetPhysicalDeviceFeatures);
|
||||
table.GetPhysicalDeviceImageFormatProperties = GetProcAddr(PFN_vkGetPhysicalDeviceImageFormatProperties, GetPhysicalDeviceImageFormatProperties);
|
||||
table.GetPhysicalDeviceFormatProperties = GetProcAddr(PFN_vkGetPhysicalDeviceFormatProperties, GetPhysicalDeviceFormatProperties);
|
||||
table.GetPhysicalDeviceLimits = GetProcAddr(PFN_vkGetPhysicalDeviceLimits, GetPhysicalDeviceLimits);
|
||||
table.GetPhysicalDeviceSparseImageFormatProperties = GetProcAddr(PFN_vkGetPhysicalDeviceSparseImageFormatProperties, GetPhysicalDeviceSparseImageFormatProperties);
|
||||
table.GetPhysicalDeviceProperties = GetProcAddr(PFN_vkGetPhysicalDeviceProperties, GetPhysicalDeviceProperties);
|
||||
table.GetPhysicalDeviceQueueCount = GetProcAddr(PFN_vkGetPhysicalDeviceQueueCount, GetPhysicalDeviceQueueCount);
|
||||
table.GetPhysicalDeviceQueueProperties = GetProcAddr(PFN_vkGetPhysicalDeviceQueueProperties, GetPhysicalDeviceQueueProperties);
|
||||
table.GetPhysicalDeviceMemoryProperties = GetProcAddr(PFN_vkGetPhysicalDeviceMemoryProperties, GetPhysicalDeviceMemoryProperties);
|
||||
table.GetPhysicalDeviceExtensionProperties = GetProcAddr(PFN_vkGetPhysicalDeviceExtensionProperties, GetPhysicalDeviceExtensionProperties);
|
||||
table.GetPhysicalDeviceLayerProperties = GetProcAddr(PFN_vkGetPhysicalDeviceLayerProperties, GetPhysicalDeviceLayerProperties);
|
||||
table.GetPhysicalDeviceSurfaceSupportWSI = GetProcAddr(PFN_vkGetPhysicalDeviceSurfaceSupportWSI, GetPhysicalDeviceSurfaceSupportWSI);
|
||||
table.DbgCreateMsgCallback = GetProcAddr(PFN_vkDbgCreateMsgCallback, DbgCreateMsgCallback);
|
||||
table.DbgDestroyMsgCallback = GetProcAddr(PFN_vkDbgDestroyMsgCallback, DbgDestroyMsgCallback);
|
||||
}
|
||||
|
||||
if(initParams.APIVersion != VK_API_VERSION)
|
||||
{
|
||||
RDCLOG("Captured API version is not the same as RenderDoc's built version, expected %d got %d", VK_API_VERSION, initParams.APIVersion);
|
||||
|
||||
@@ -25,15 +25,14 @@
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include "vk_layer.h"
|
||||
#include "LoaderAndTools/layers/vk_layer_table.h"
|
||||
#include "LoaderAndTools/layers/vk_layer_extension_utils.h"
|
||||
|
||||
// RenderDoc Includes
|
||||
|
||||
#include "driver/vulkan/vk_common.h"
|
||||
#include "driver/vulkan/vk_core.h"
|
||||
#include "driver/vulkan/vk_hookset_defs.h"
|
||||
#include "vk_common.h"
|
||||
#include "vk_core.h"
|
||||
#include "vk_hookset_defs.h"
|
||||
|
||||
#include "common/common.h"
|
||||
#include "common/threading.h"
|
||||
|
||||
// this should be in the vulkan definition header
|
||||
@@ -42,6 +41,9 @@
|
||||
#define VK_LAYER_EXPORT extern "C" __declspec(dllexport)
|
||||
#endif
|
||||
|
||||
void InitDeviceTable(const VkBaseLayerObject *obj);
|
||||
void InitInstanceTable(const VkBaseLayerObject *obj);
|
||||
|
||||
// RenderDoc State
|
||||
|
||||
WrappedVulkan *shadowVulkan = NULL;
|
||||
@@ -82,7 +84,7 @@ DefineHooks();
|
||||
|
||||
// Layer Intercepts
|
||||
|
||||
static const VkLayerProperties rdt_physicaldevice_layers[] = {
|
||||
static const VkLayerProperties physLayers[] = {
|
||||
{
|
||||
"RenderDoc",
|
||||
VK_API_VERSION,
|
||||
@@ -91,33 +93,14 @@ static const VkLayerProperties rdt_physicaldevice_layers[] = {
|
||||
}
|
||||
};
|
||||
|
||||
VK_LAYER_EXPORT VkResult VKAPI vkGetPhysicalDeviceLayerProperties(
|
||||
VkPhysicalDevice physicalDevice,
|
||||
uint32_t* pCount,
|
||||
VkLayerProperties* pProperties)
|
||||
{
|
||||
return util_GetLayerProperties(ARRAY_SIZE(rdt_physicaldevice_layers), rdt_physicaldevice_layers,
|
||||
pCount, pProperties);
|
||||
}
|
||||
|
||||
static const VkExtensionProperties rdt_physicaldevice_extensions[] = {
|
||||
static const VkExtensionProperties physExts[] = {
|
||||
{
|
||||
DEBUG_MARKER_EXTENSION_NAME,
|
||||
VK_MAKE_VERSION(0, 1, 0),
|
||||
}
|
||||
};
|
||||
|
||||
VK_LAYER_EXPORT VkResult VKAPI vkGetPhysicalDeviceExtensionProperties(
|
||||
VkPhysicalDevice physicalDevice,
|
||||
const char *pLayerName,
|
||||
uint32_t *pCount,
|
||||
VkExtensionProperties *pProperties)
|
||||
{
|
||||
return util_GetExtensionProperties(ARRAY_SIZE(rdt_physicaldevice_extensions), rdt_physicaldevice_extensions,
|
||||
pCount, pProperties);
|
||||
}
|
||||
|
||||
static const VkLayerProperties rdt_GlobalLayers[] = {
|
||||
static const VkLayerProperties globalLayers[] = {
|
||||
{
|
||||
"RenderDoc",
|
||||
VK_API_VERSION,
|
||||
@@ -126,17 +109,52 @@ static const VkLayerProperties rdt_GlobalLayers[] = {
|
||||
}
|
||||
};
|
||||
|
||||
VkResult getProps(uint32_t *dstCount, void *dstProps, uint32_t srcCount, void *srcProps, size_t elemSize)
|
||||
{
|
||||
if(dstCount == NULL)
|
||||
return VK_ERROR_INVALID_POINTER;
|
||||
|
||||
if(dstProps == NULL)
|
||||
{
|
||||
*dstCount = srcCount;
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
memcpy(dstProps, srcProps, elemSize*RDCMIN(srcCount, *dstCount));
|
||||
if(*dstCount < srcCount)
|
||||
return VK_INCOMPLETE;
|
||||
|
||||
*dstCount = srcCount;
|
||||
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
VK_LAYER_EXPORT VkResult VKAPI vkGetPhysicalDeviceLayerProperties(
|
||||
VkPhysicalDevice physicalDevice,
|
||||
uint32_t* pCount,
|
||||
VkLayerProperties* pProperties)
|
||||
{
|
||||
return getProps(pCount, pProperties, ARRAY_COUNT(physLayers), (void *)physLayers, sizeof(VkLayerProperties));
|
||||
}
|
||||
|
||||
VK_LAYER_EXPORT VkResult VKAPI vkGetPhysicalDeviceExtensionProperties(
|
||||
VkPhysicalDevice physicalDevice,
|
||||
const char *pLayerName,
|
||||
uint32_t *pCount,
|
||||
VkExtensionProperties *pProperties)
|
||||
{
|
||||
return getProps(pCount, pProperties, ARRAY_COUNT(physExts), (void *)physExts, sizeof(VkExtensionProperties));
|
||||
}
|
||||
|
||||
VK_LAYER_EXPORT VkResult VKAPI vkGetGlobalLayerProperties(
|
||||
uint32_t *pCount,
|
||||
VkLayerProperties* pProperties)
|
||||
{
|
||||
return util_GetLayerProperties(ARRAY_SIZE(rdt_GlobalLayers),
|
||||
rdt_GlobalLayers,
|
||||
pCount, pProperties);
|
||||
return getProps(pCount, pProperties, ARRAY_COUNT(globalLayers), (void *)globalLayers, sizeof(VkLayerProperties));
|
||||
}
|
||||
|
||||
#undef HookInit
|
||||
#define HookInit(function) if (!strcmp(pName, STRINGIZE(function))) return (PFN_vkVoidFunction) function;
|
||||
#define HookInit(function) if (!strcmp(pName, STRINGIZE(CONCAT(vk, function)))) return (PFN_vkVoidFunction) &CONCAT(vk, function);
|
||||
|
||||
// proc addr routines
|
||||
|
||||
@@ -147,22 +165,20 @@ VK_LAYER_EXPORT PFN_vkVoidFunction VKAPI vkGetDeviceProcAddr(VkDevice device, co
|
||||
|
||||
/* loader uses this to force layer initialization; device object is wrapped */
|
||||
if (!strcmp("vkGetDeviceProcAddr", pName)) {
|
||||
initDeviceTable(renderdoc_device_table_map, (const VkBaseLayerObject *) device);
|
||||
return (PFN_vkVoidFunction) vkGetDeviceProcAddr;
|
||||
InitDeviceTable((const VkBaseLayerObject *) device);
|
||||
return (PFN_vkVoidFunction) &vkGetDeviceProcAddr;
|
||||
}
|
||||
|
||||
if (!strcmp("vkCreateDevice", pName))
|
||||
return (PFN_vkVoidFunction) &vkCreateDevice;
|
||||
if (!strcmp("vkDestroyDevice", pName))
|
||||
return (PFN_vkVoidFunction) &vkDestroyDevice;
|
||||
|
||||
HookInitVulkanDevice();
|
||||
|
||||
if (!strcmp("vkCreateDevice", pName))
|
||||
return (PFN_vkVoidFunction) vkCreateDevice;
|
||||
if (!strcmp("vkDestroyDevice", pName))
|
||||
return (PFN_vkVoidFunction) vkDestroyDevice;
|
||||
else
|
||||
{
|
||||
if (get_dispatch_table(renderdoc_device_table_map, device)->GetDeviceProcAddr == NULL)
|
||||
return NULL;
|
||||
return get_dispatch_table(renderdoc_device_table_map, device)->GetDeviceProcAddr(device, pName);
|
||||
}
|
||||
if (GetDeviceDispatchTable(device)->GetDeviceProcAddr == NULL)
|
||||
return NULL;
|
||||
return GetDeviceDispatchTable(device)->GetDeviceProcAddr(device, pName);
|
||||
}
|
||||
|
||||
VK_LAYER_EXPORT PFN_vkVoidFunction VKAPI vkGetInstanceProcAddr(VkInstance instance, const char* pName)
|
||||
@@ -172,24 +188,26 @@ VK_LAYER_EXPORT PFN_vkVoidFunction VKAPI vkGetInstanceProcAddr(VkInstance instan
|
||||
|
||||
/* loader uses this to force layer initialization; instance object is wrapped */
|
||||
if (!strcmp("vkGetInstanceProcAddr", pName)) {
|
||||
initInstanceTable(renderdoc_instance_table_map, (const VkBaseLayerObject *) instance);
|
||||
InitInstanceTable((const VkBaseLayerObject *) instance);
|
||||
// VKTODOLOW I think this will be created and passed down in wrapped dispatchable
|
||||
// objects
|
||||
if (shadowVulkan == NULL) {
|
||||
shadowVulkan = new WrappedVulkan("");
|
||||
}
|
||||
return (PFN_vkVoidFunction) vkGetInstanceProcAddr;
|
||||
return (PFN_vkVoidFunction) &vkGetInstanceProcAddr;
|
||||
}
|
||||
|
||||
if (!strcmp("vkGetPhysicalDeviceLayerProperties", pName))
|
||||
return (PFN_vkVoidFunction) &vkGetPhysicalDeviceLayerProperties;
|
||||
if (!strcmp("vkGetPhysicalDeviceExtensionProperties", pName))
|
||||
return (PFN_vkVoidFunction) &vkGetPhysicalDeviceExtensionProperties;
|
||||
if (!strcmp("vkGetGlobalLayerProperties", pName))
|
||||
return (PFN_vkVoidFunction) &vkGetGlobalLayerProperties;
|
||||
|
||||
HookInitVulkanInstance();
|
||||
|
||||
if (!strcmp("vkGetPhysicalDeviceLayerProperties", pName))
|
||||
return (PFN_vkVoidFunction) vkGetPhysicalDeviceLayerProperties;
|
||||
if (!strcmp("vkGetPhysicalDeviceExtensionProperties", pName))
|
||||
return (PFN_vkVoidFunction) vkGetPhysicalDeviceExtensionProperties;
|
||||
if (!strcmp("vkGetGlobalLayerProperties", pName))
|
||||
return (PFN_vkVoidFunction) vkGetGlobalLayerProperties;
|
||||
|
||||
if (get_dispatch_table(renderdoc_instance_table_map, instance)->GetInstanceProcAddr == NULL)
|
||||
if (GetInstanceDispatchTable(instance)->GetInstanceProcAddr == NULL)
|
||||
return NULL;
|
||||
return get_dispatch_table(renderdoc_instance_table_map, instance)->GetInstanceProcAddr(instance, pName);
|
||||
return GetInstanceDispatchTable(instance)->GetInstanceProcAddr(instance, pName);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user