本文整理汇总了C++中VkLayerDispatchTable类的典型用法代码示例。如果您正苦于以下问题:C++ VkLayerDispatchTable类的具体用法?C++ VkLayerDispatchTable怎么用?C++ VkLayerDispatchTable使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了VkLayerDispatchTable类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: vkAllocateCommandBuffers
VkResult VKAPI_CALL vkAllocateCommandBuffers(
VkDevice device,
const VkCommandBufferAllocateInfo* pAllocateInfo,
VkCommandBuffer* pCommandBuffers)
{
dispatch_key key = get_dispatch_key(device);
layer_data *my_data = get_my_data_ptr(key, layer_data_map);
VkLayerDispatchTable *pTable = my_data->device_dispatch_table;
VkResult result;
startReadObject(my_data, device);
startWriteObject(my_data, pAllocateInfo->commandPool);
result = pTable->AllocateCommandBuffers(device, pAllocateInfo, pCommandBuffers);
finishReadObject(my_data, device);
finishWriteObject(my_data, pAllocateInfo->commandPool);
// Record mapping from command buffer to command pool
if (VK_SUCCESS == result) {
for (int index=0;index<pAllocateInfo->commandBufferCount;index++) {
loader_platform_thread_lock_mutex(&threadingLock);
command_pool_map[pCommandBuffers[index]] = pAllocateInfo->commandPool;
loader_platform_thread_unlock_mutex(&threadingLock);
}
}
return result;
}
示例2: assert
/* 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 -> CommandBuffer 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 */
VkLayerDebugMarkerDispatchTable *initDebugMarkerTable(VkDevice device) {
VkLayerDebugMarkerDispatchTable *pDebugMarkerTable;
assert(device);
VkLayerDispatchTable *pDisp = *(VkLayerDispatchTable **)device;
std::unordered_map<void *,
VkLayerDebugMarkerDispatchTable *>::const_iterator it =
tableDebugMarkerMap.find((void *)pDisp);
if (it == tableDebugMarkerMap.end()) {
pDebugMarkerTable = new VkLayerDebugMarkerDispatchTable;
tableDebugMarkerMap[(void *)pDisp] = pDebugMarkerTable;
} else {
return it->second;
}
pDebugMarkerTable->CmdDbgMarkerBegin =
(PFN_vkCmdDbgMarkerBegin)pDisp->GetDeviceProcAddr(
device, "vkCmdDbgMarkerBegin");
pDebugMarkerTable->CmdDbgMarkerEnd =
(PFN_vkCmdDbgMarkerEnd)pDisp->GetDeviceProcAddr(device,
"vkCmdDbgMarkerEnd");
pDebugMarkerTable->DbgSetObjectTag =
(PFN_vkDbgSetObjectTag)pDisp->GetDeviceProcAddr(device,
"vkDbgSetObjectTag");
pDebugMarkerTable->DbgSetObjectName =
(PFN_vkDbgSetObjectName)pDisp->GetDeviceProcAddr(device,
"vkDbgSetObjectName");
return pDebugMarkerTable;
}
示例3: vkGetDeviceProcAddr
VK_LAYER_EXPORT VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL
vkGetDeviceProcAddr(VkDevice dev, const char *funcName) {
#define ADD_HOOK(fn) \
if (!strncmp(#fn, funcName, sizeof(#fn))) \
return (PFN_vkVoidFunction)fn
ADD_HOOK(vkGetDeviceProcAddr);
ADD_HOOK(vkDestroyDevice);
ADD_HOOK(vkCreateSwapchainKHR);
ADD_HOOK(vkGetSwapchainImagesKHR);
ADD_HOOK(vkQueuePresentKHR);
ADD_HOOK(vkDestroySwapchainKHR);
ADD_HOOK(vkQueueSubmit);
#undef ADD_HOOK
if (dev == NULL)
return NULL;
layer_data *dev_data;
dev_data = get_my_data_ptr(get_dispatch_key(dev), layer_data_map);
VkLayerDispatchTable *pTable = dev_data->device_dispatch_table;
if (pTable->GetDeviceProcAddr == NULL)
return NULL;
return pTable->GetDeviceProcAddr(dev, funcName);
}
示例4: vkFreeCommandBuffers
void VKAPI_CALL vkFreeCommandBuffers(
VkDevice device,
VkCommandPool commandPool,
uint32_t commandBufferCount,
const VkCommandBuffer* pCommandBuffers)
{
dispatch_key key = get_dispatch_key(device);
layer_data *my_data = get_my_data_ptr(key, layer_data_map);
VkLayerDispatchTable *pTable = my_data->device_dispatch_table;
const bool lockCommandPool = false; // pool is already directly locked
startReadObject(my_data, device);
startWriteObject(my_data, commandPool);
for (int index=0;index<commandBufferCount;index++) {
startWriteObject(my_data, pCommandBuffers[index], lockCommandPool);
}
pTable->FreeCommandBuffers(device,commandPool,commandBufferCount,pCommandBuffers);
finishReadObject(my_data, device);
finishWriteObject(my_data, commandPool);
for (int index=0;index<commandBufferCount;index++) {
finishWriteObject(my_data, pCommandBuffers[index], lockCommandPool);
loader_platform_thread_lock_mutex(&threadingLock);
command_pool_map.erase(pCommandBuffers[index]);
loader_platform_thread_unlock_mutex(&threadingLock);
}
}
示例5: vkQueueSubmit
VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkQueueSubmit(VkQueue queue, uint32_t submitCount, const VkSubmitInfo *pSubmits,
VkFence fence) {
layer_data *my_data = GetLayerDataPtr(get_dispatch_key(queue), layer_data_map);
VkLayerDispatchTable *pTable = my_data->device_dispatch_table;
my_data->cmdBuffersThisFrame += submitCount; // XXX WRONG
return pTable->QueueSubmit(queue, submitCount, pSubmits, fence);
}
示例6: vkDestroyDevice
VK_LAYER_EXPORT VKAPI_ATTR void VKAPI_CALL vkDestroyDevice(VkDevice device, const VkAllocationCallbacks *pAllocator) {
dispatch_key key = get_dispatch_key(device);
layer_data *my_data = GetLayerDataPtr(key, layer_data_map);
my_data->Cleanup();
VkLayerDispatchTable *pTable = my_data->device_dispatch_table;
pTable->DeviceWaitIdle(device);
pTable->DestroyDevice(device, pAllocator);
delete pTable;
layer_data_map.erase(key);
}
示例7: get_my_data_ptr
void WsiImageData::Cleanup(VkDevice dev) {
layer_data *my_data =
get_my_data_ptr(get_dispatch_key(dev), layer_data_map);
VkLayerDispatchTable *pTable = my_data->device_dispatch_table;
// XXX: needs device data
// pTable->FreeCommandBuffers(dev, cmd, nullptr);
pTable->DestroyFramebuffer(dev, framebuffer, nullptr);
pTable->DestroyImageView(dev, view, nullptr);
pTable->DestroyBuffer(dev, vertexBuffer, nullptr);
pTable->FreeMemory(dev, vertexBufferMemory, nullptr);
}
示例8: GetLayerDataPtr
void SwapChainData::Cleanup(VkDevice dev) {
layer_data *my_data = GetLayerDataPtr(get_dispatch_key(dev), layer_data_map);
VkLayerDispatchTable *pTable = my_data->device_dispatch_table;
for (uint32_t i = 0; i < presentableImages.size(); i++) {
presentableImages[i]->Cleanup(dev);
delete presentableImages[i];
}
presentableImages.clear();
pTable->DestroyPipeline(dev, pipeline, nullptr);
pTable->DestroyRenderPass(dev, render_pass, nullptr);
}
示例9: DestroyDevice
VKAPI_ATTR void VKAPI_CALL
DestroyDevice(VkDevice device, const VkAllocationCallbacks *pAllocator) {
DeviceMapStruct *devMap = get_dev_info(device);
assert(devMap);
VkLayerDispatchTable *pDisp = devMap->device_dispatch_table;
pDisp->DestroyDevice(device, pAllocator);
loader_platform_thread_lock_mutex(&globalLock);
delete pDisp;
delete devMap;
deviceMap.erase(device);
loader_platform_thread_unlock_mutex(&globalLock);
}
示例10: GetSwapchainImagesKHR
VKAPI_ATTR VkResult VKAPI_CALL
GetSwapchainImagesKHR(VkDevice device, VkSwapchainKHR swapchain,
uint32_t *pCount, VkImage *pSwapchainImages) {
DeviceMapStruct *devMap = get_dev_info(device);
assert(devMap);
VkLayerDispatchTable *pDisp = devMap->device_dispatch_table;
VkResult result = pDisp->GetSwapchainImagesKHR(device, swapchain, pCount,
pSwapchainImages);
// Save the swapchain images in a map if we are taking screenshots
loader_platform_thread_lock_mutex(&globalLock);
if (screenshotEnvQueried && screenshotFrames.empty()) {
// No screenshots in the list to take
loader_platform_thread_unlock_mutex(&globalLock);
return result;
}
if (result == VK_SUCCESS && pSwapchainImages && !swapchainMap.empty() &&
swapchainMap.find(swapchain) != swapchainMap.end()) {
unsigned i;
for (i = 0; i < *pCount; i++) {
// Create a mapping for an image to a device, image extent, and
// format
if (imageMap[pSwapchainImages[i]] == NULL) {
ImageMapStruct *imageMapElem = new ImageMapStruct;
imageMap[pSwapchainImages[i]] = imageMapElem;
}
imageMap[pSwapchainImages[i]]->device =
swapchainMap[swapchain]->device;
imageMap[pSwapchainImages[i]]->imageExtent =
swapchainMap[swapchain]->imageExtent;
imageMap[pSwapchainImages[i]]->format =
swapchainMap[swapchain]->format;
}
// Add list of images to swapchain to image map
SwapchainMapStruct *swapchainMapElem = swapchainMap[swapchain];
if (i >= 1 && swapchainMapElem) {
VkImage *imageList = new VkImage[i];
swapchainMapElem->imageList = imageList;
for (unsigned j = 0; j < i; j++) {
swapchainMapElem->imageList[j] = pSwapchainImages[j];
}
}
}
loader_platform_thread_unlock_mutex(&globalLock);
return result;
}
示例11: GetDeviceProcAddr
VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL GetDeviceProcAddr(VkDevice device, const char *funcName) {
PFN_vkVoidFunction addr;
layer_data *dev_data;
assert(device);
addr = layer_intercept_proc(funcName);
if (addr)
return addr;
dev_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map);
VkLayerDispatchTable *pTable = dev_data->device_dispatch_table;
if (pTable->GetDeviceProcAddr == NULL)
return NULL;
return pTable->GetDeviceProcAddr(device, funcName);
}
示例12: vkGetDeviceProcAddr
VK_LAYER_EXPORT PFN_vkVoidFunction VKAPI_CALL vkGetDeviceProcAddr(VkDevice device, const char *funcName) {
PFN_vkVoidFunction addr;
layer_data *dev_data;
if (device == VK_NULL_HANDLE) {
return NULL;
}
addr = layer_intercept_proc(funcName);
if (addr)
return addr;
dev_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map);
VkLayerDispatchTable *pTable = dev_data->device_dispatch_table;
if (pTable->GetDeviceProcAddr == NULL)
return NULL;
return pTable->GetDeviceProcAddr(device, funcName);
}
示例13: CreateSwapchainKHR
VKAPI_ATTR VkResult VKAPI_CALL CreateSwapchainKHR(
VkDevice device, const VkSwapchainCreateInfoKHR *pCreateInfo,
const VkAllocationCallbacks *pAllocator, VkSwapchainKHR *pSwapchain) {
DeviceMapStruct *devMap = get_dev_info(device);
assert(devMap);
VkLayerDispatchTable *pDisp = devMap->device_dispatch_table;
// This layer does an image copy later on, and the copy command expects the
// transfer src bit to be on.
VkSwapchainCreateInfoKHR myCreateInfo = *pCreateInfo;
myCreateInfo.imageUsage |= VK_IMAGE_USAGE_TRANSFER_SRC_BIT;
VkResult result = pDisp->CreateSwapchainKHR(device, &myCreateInfo,
pAllocator, pSwapchain);
// Save the swapchain in a map of we are taking screenshots.
loader_platform_thread_lock_mutex(&globalLock);
if (screenshotEnvQueried && screenshotFrames.empty()) {
// No screenshots in the list to take
loader_platform_thread_unlock_mutex(&globalLock);
return result;
}
if (result == VK_SUCCESS) {
// Create a mapping for a swapchain to a device, image extent, and
// format
SwapchainMapStruct *swapchainMapElem = new SwapchainMapStruct;
swapchainMapElem->device = device;
swapchainMapElem->imageExtent = pCreateInfo->imageExtent;
swapchainMapElem->format = pCreateInfo->imageFormat;
swapchainMap.insert(make_pair(*pSwapchain, swapchainMapElem));
// Create a mapping for the swapchain object into the dispatch table
// TODO is this needed? screenshot_device_table_map.emplace((void
// *)pSwapchain, pTable);
}
loader_platform_thread_unlock_mutex(&globalLock);
return result;
}
示例14: CreateCommandPool
VKAPI_ATTR VkResult VKAPI_CALL CreateCommandPool(
VkDevice device, const VkCommandPoolCreateInfo *pCreateInfo,
const VkAllocationCallbacks *pAllocator, VkCommandPool *pCommandPool) {
DeviceMapStruct *devMap = get_dev_info(device);
assert(devMap);
VkLayerDispatchTable *pDisp = devMap->device_dispatch_table;
VkResult result =
pDisp->CreateCommandPool(device, pCreateInfo, pAllocator, pCommandPool);
// Save the command pool on a map if we are taking screenshots.
loader_platform_thread_lock_mutex(&globalLock);
if (screenshotEnvQueried && screenshotFrames.empty()) {
// No screenshots in the list to take
loader_platform_thread_unlock_mutex(&globalLock);
return result;
}
// Create a mapping from a device to a commandPool
devMap->commandPool = *pCommandPool;
loader_platform_thread_unlock_mutex(&globalLock);
return result;
}
示例15: GetDeviceProcAddr
VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL
GetDeviceProcAddr(VkDevice dev, const char *funcName) {
PFN_vkVoidFunction proc = intercept_core_device_command(funcName);
if (proc)
return proc;
if (dev == NULL) {
return NULL;
}
proc = intercept_khr_swapchain_command(funcName, dev);
if (proc)
return proc;
DeviceMapStruct *devMap = get_dev_info(dev);
assert(devMap);
VkLayerDispatchTable *pDisp = devMap->device_dispatch_table;
if (pDisp->GetDeviceProcAddr == NULL)
return NULL;
return pDisp->GetDeviceProcAddr(dev, funcName);
}