* Author: Chia-I Wu <olv@google.com>
* Author: Chris Forbes <chrisf@ijw.co.nz>
* Author: Mark Lobodzinski <mark@lunarg.com>
+ * Author: Ian Elliott <ianelliott@google.com>
*/
// Allow use of STL min and max functions in Windows
// Track the last cmd buffer touched by this thread
// prototype
-static GLOBAL_CB_NODE* getCBNode(layer_data*, const VkCommandBuffer);
+static GLOBAL_CB_NODE* getCBNode(layer_data*, const VkCommandBuffer, bool doLock = true);
static VkBool32 hasDrawCmd(GLOBAL_CB_NODE* pCB)
{
static bool verify_renderpass_compatibility(layer_data* my_data, const VkRenderPass primaryRP, const VkRenderPass secondaryRP, string& errorMsg)
{
stringstream errorStr;
+ loader_platform_thread_lock_mutex(&globalLock);
if (my_data->renderPassMap.find(primaryRP) == my_data->renderPassMap.end()) {
errorStr << "invalid VkRenderPass (" << primaryRP << ")";
errorMsg = errorStr.str();
+ loader_platform_thread_unlock_mutex(&globalLock);
return false;
} else if (my_data->renderPassMap.find(secondaryRP) == my_data->renderPassMap.end()) {
errorStr << "invalid VkRenderPass (" << secondaryRP << ")";
errorMsg = errorStr.str();
+ loader_platform_thread_unlock_mutex(&globalLock);
return false;
}
// Trivial pass case is exact same RP
- if (primaryRP == secondaryRP)
+ if (primaryRP == secondaryRP) {
+ loader_platform_thread_unlock_mutex(&globalLock);
return true;
+ }
const VkRenderPassCreateInfo* primaryRPCI = my_data->renderPassMap[primaryRP]->pCreateInfo;
const VkRenderPassCreateInfo* secondaryRPCI = my_data->renderPassMap[secondaryRP]->pCreateInfo;
if (primaryRPCI->subpassCount != secondaryRPCI->subpassCount) {
errorStr << "RenderPass for primary cmdBuffer has " << primaryRPCI->subpassCount << " subpasses but renderPass for secondary cmdBuffer has " << secondaryRPCI->subpassCount << " subpasses.";
errorMsg = errorStr.str();
+ loader_platform_thread_unlock_mutex(&globalLock);
return false;
}
uint32_t spIndex = 0;
secondaryRPCI->pSubpasses[spIndex].pColorAttachments, secondaryColorCount, secondaryRPCI->pAttachments)) {
errorStr << "color attachments at index " << cIdx << " of subpass index " << spIndex << " are not compatible.";
errorMsg = errorStr.str();
+ loader_platform_thread_unlock_mutex(&globalLock);
return false;
} else if (!attachment_references_compatible(cIdx, primaryRPCI->pSubpasses[spIndex].pResolveAttachments, primaryColorCount, primaryRPCI->pAttachments,
secondaryRPCI->pSubpasses[spIndex].pResolveAttachments, secondaryColorCount, secondaryRPCI->pAttachments)) {
errorStr << "resolve attachments at index " << cIdx << " of subpass index " << spIndex << " are not compatible.";
errorMsg = errorStr.str();
+ loader_platform_thread_unlock_mutex(&globalLock);
return false;
} else if (!attachment_references_compatible(cIdx, primaryRPCI->pSubpasses[spIndex].pDepthStencilAttachment, primaryColorCount, primaryRPCI->pAttachments,
secondaryRPCI->pSubpasses[spIndex].pDepthStencilAttachment, secondaryColorCount, secondaryRPCI->pAttachments)) {
errorStr << "depth/stencil attachments at index " << cIdx << " of subpass index " << spIndex << " are not compatible.";
errorMsg = errorStr.str();
+ loader_platform_thread_unlock_mutex(&globalLock);
return false;
}
}
secondaryRPCI->pSubpasses[spIndex].pInputAttachments, secondaryColorCount, secondaryRPCI->pAttachments)) {
errorStr << "input attachments at index " << i << " of subpass index " << spIndex << " are not compatible.";
errorMsg = errorStr.str();
+ loader_platform_thread_unlock_mutex(&globalLock);
return false;
}
}
}
+ loader_platform_thread_unlock_mutex(&globalLock);
return true;
}
}
// Return Set node ptr for specified set or else NULL
-static SET_NODE* getSetNode(layer_data* my_data, const VkDescriptorSet set)
+static SET_NODE* getSetNode(layer_data* my_data, const VkDescriptorSet set, bool doLock = true)
{
- loader_platform_thread_lock_mutex(&globalLock);
+ if (doLock) {
+ loader_platform_thread_lock_mutex(&globalLock);
+ }
if (my_data->setMap.find(set) == my_data->setMap.end()) {
- loader_platform_thread_unlock_mutex(&globalLock);
+ if (doLock) {
+ loader_platform_thread_unlock_mutex(&globalLock);
+ }
return NULL;
}
- loader_platform_thread_unlock_mutex(&globalLock);
- return my_data->setMap[set];
+ SET_NODE *rtn = my_data->setMap[set];
+ if (doLock) {
+ loader_platform_thread_unlock_mutex(&globalLock);
+ }
+ return rtn;
}
// For the given command buffer, verify that for each set set in activeSetNodes
// that any dynamic descriptor in that set has a valid dynamic offset bound.
// For given pipeline, return number of MSAA samples, or one if MSAA disabled
static VkSampleCountFlagBits getNumSamples(layer_data* my_data, const VkPipeline pipeline)
{
+ loader_platform_thread_lock_mutex(&globalLock);
PIPELINE_NODE* pPipe = my_data->pipelineMap[pipeline];
+ loader_platform_thread_unlock_mutex(&globalLock);
if (VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO == pPipe->msStateCI.sType) {
return pPipe->msStateCI.rasterizationSamples;
}
// Verify that any MSAA request in PSO matches sample# in bound FB
VkSampleCountFlagBits psoNumSamples = getNumSamples(my_data, pipeline);
if (pCB->activeRenderPass) {
+ loader_platform_thread_lock_mutex(&globalLock);
const VkRenderPassCreateInfo* pRPCI = my_data->renderPassMap[pCB->activeRenderPass]->pCreateInfo;
const VkSubpassDescription* pSD = &pRPCI->pSubpasses[pCB->activeSubpass];
+ loader_platform_thread_unlock_mutex(&globalLock);
VkSampleCountFlagBits subpassNumSamples = (VkSampleCountFlagBits) 0;
uint32_t i;
loader_platform_thread_unlock_mutex(&globalLock);
return NULL;
}
+ DESCRIPTOR_POOL_NODE *rtn = my_data->descriptorPoolMap[pool];
loader_platform_thread_unlock_mutex(&globalLock);
- return my_data->descriptorPoolMap[pool];
+ return rtn;
}
static LAYOUT_NODE* getLayoutNode(layer_data* my_data, const VkDescriptorSetLayout layout) {
loader_platform_thread_unlock_mutex(&globalLock);
return NULL;
}
+ LAYOUT_NODE *rtn = my_data->descriptorSetLayoutMap[layout];
loader_platform_thread_unlock_mutex(&globalLock);
- return my_data->descriptorSetLayoutMap[layout];
+ return rtn;
}
// Return VK_FALSE if update struct is of valid type, otherwise flag error and return code from callback
pSet = pSet->pNext;
}
// Reset available count to max count for this pool
+ loader_platform_thread_lock_mutex(&globalLock);
for (uint32_t i=0; i<pPool->availableDescriptorTypeCount.size(); ++i) {
pPool->availableDescriptorTypeCount[i] = pPool->maxDescriptorTypeCount[i];
}
+ loader_platform_thread_unlock_mutex(&globalLock);
}
}
// For given CB object, fetch associated CB Node from map
-static GLOBAL_CB_NODE* getCBNode(layer_data* my_data, const VkCommandBuffer cb)
+static GLOBAL_CB_NODE* getCBNode(layer_data* my_data, const VkCommandBuffer cb, bool doLock)
{
- loader_platform_thread_lock_mutex(&globalLock);
+ if (doLock) {
+ loader_platform_thread_lock_mutex(&globalLock);
+ }
if (my_data->commandBufferMap.count(cb) == 0) {
- loader_platform_thread_unlock_mutex(&globalLock);
+ if (doLock) {
+ loader_platform_thread_unlock_mutex(&globalLock);
+ }
// TODO : How to pass cb as srcObj here?
log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, 0, __LINE__, DRAWSTATE_INVALID_COMMAND_BUFFER, "DS",
"Attempt to use CommandBuffer %#" PRIxLEAST64 " that doesn't exist!", (uint64_t)(cb));
return NULL;
}
- loader_platform_thread_unlock_mutex(&globalLock);
- return my_data->commandBufferMap[cb];
+ GLOBAL_CB_NODE *rtn = my_data->commandBufferMap[cb];
+ if (doLock) {
+ loader_platform_thread_unlock_mutex(&globalLock);
+ }
+ return rtn;
}
// Free all CB Nodes
if (result != VK_SUCCESS)
return result;
+ // TBD: Need any locking this early, in case this function is called at the
+ // same time by more than one thread?
layer_data *my_data = get_my_data_ptr(get_dispatch_key(*pInstance), layer_data_map);
my_data->instance_dispatch_table = new VkLayerInstanceDispatchTable;
layer_init_instance_dispatch_table(*pInstance, my_data->instance_dispatch_table, fpGetInstanceProcAddr);
{
// TODOSC : Shouldn't need any customization here
dispatch_key key = get_dispatch_key(instance);
+ // TBD: Need any locking this early, in case this function is called at the
+ // same time by more than one thread?
layer_data *my_data = get_my_data_ptr(key, layer_data_map);
VkLayerInstanceDispatchTable *pTable = my_data->instance_dispatch_table;
pTable->DestroyInstance(instance, pAllocator);
static void createDeviceRegisterExtensions(const VkDeviceCreateInfo* pCreateInfo, VkDevice device)
{
uint32_t i;
+ // TBD: Need any locking, in case this function is called at the same time
+ // by more than one thread?
layer_data* dev_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map);
dev_data->device_extensions.debug_marker_enabled = false;
dev_data->device_extensions.wsi_enabled = false;
return result;
}
+ // TBD: Need any locking, in case this function is called at the same time
+ // by more than one thread?
layer_data *my_instance_data = get_my_data_ptr(get_dispatch_key(gpu), layer_data_map);
layer_data *my_device_data = get_my_data_ptr(get_dispatch_key(*pDevice), layer_data_map);
VkBool32 skipCall = VK_FALSE;
GLOBAL_CB_NODE* pCB = NULL;
layer_data* dev_data = get_my_data_ptr(get_dispatch_key(queue), layer_data_map);
+ loader_platform_thread_lock_mutex(&globalLock);
for (uint32_t submit_idx = 0; submit_idx < submitCount; submit_idx++) {
const VkSubmitInfo *submit = &pSubmits[submit_idx];
for (uint32_t i=0; i < submit->waitSemaphoreCount; ++i) {
dev_data->semaphoreSignaledMap[submit->pSignalSemaphores[i]] = 1;
}
for (uint32_t i=0; i < submit->commandBufferCount; i++) {
-
#ifndef DISABLE_IMAGE_LAYOUT_VALIDATION
- skipCall |= ValidateCmdBufImageLayouts(submit->pCommandBuffers[i]);
+ skipCall |= ValidateCmdBufImageLayouts(submit->pCommandBuffers[i]);
#endif // DISABLE_IMAGE_LAYOUT_VALIDATION
- pCB = getCBNode(dev_data, submit->pCommandBuffers[i]);
- loader_platform_thread_lock_mutex(&globalLock);
+ pCB = getCBNode(dev_data, submit->pCommandBuffers[i], false);
pCB->submitCount++; // increment submit count
skipCall |= validateCommandBufferState(dev_data, pCB);
- loader_platform_thread_unlock_mutex(&globalLock);
}
if (dev_data->fenceMap[fence].in_use.load()) {
skipCall |= log_msg(
trackCommandBuffers(dev_data, queue, submit->commandBufferCount,
submit->pCommandBuffers, fence);
}
+ loader_platform_thread_unlock_mutex(&globalLock);
if (VK_FALSE == skipCall)
return dev_data->device_dispatch_table->QueueSubmit(queue, submitCount, pSubmits, fence);
return VK_ERROR_VALIDATION_FAILED_EXT;
}
+// Note: This function assumes that the global lock is held by the calling
+// thread.
VkBool32 cleanInFlightCmdBuffer(layer_data* my_data, VkCommandBuffer cmdBuffer) {
VkBool32 skip_call = VK_FALSE;
- GLOBAL_CB_NODE* pCB = getCBNode(my_data, cmdBuffer);
+ GLOBAL_CB_NODE* pCB = getCBNode(my_data, cmdBuffer, false);
if (pCB) {
for (auto queryEventsPair : pCB->waitedEventsBeforeQueryReset) {
for (auto event : queryEventsPair.second) {
// Also, if given queue is valid, then remove the cmd_buffer from that queues
// inFlightCmdBuffer set. Finally, check all other queues and if given cmd_buffer
// is still in flight on another queue, add it back into the global set.
+// Note: This function assumes that the global lock is held by the calling
+// thread.
static inline void removeInFlightCmdBuffer(layer_data* dev_data, VkCommandBuffer cmd_buffer, VkQueue queue)
{
// Pull it off of global list initially, but if we find it in any other queue list, add it back in
layer_data* dev_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map);
VkResult result = dev_data->device_dispatch_table->WaitForFences(device, fenceCount, pFences, waitAll, timeout);
VkBool32 skip_call = VK_FALSE;
+ loader_platform_thread_lock_mutex(&globalLock);
if (result == VK_SUCCESS) {
// When we know that all fences are complete we can clean/remove their CBs
if (waitAll || fenceCount == 1) {
// this case for app to guarantee which fences completed it will have to call
// vkGetFenceStatus() at which point we'll clean/remove their CBs if complete.
}
+ loader_platform_thread_unlock_mutex(&globalLock);
if (VK_FALSE != skip_call)
return VK_ERROR_VALIDATION_FAILED_EXT;
return result;
layer_data* dev_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map);
VkResult result = dev_data->device_dispatch_table->GetFenceStatus(device, fence);
VkBool32 skip_call = VK_FALSE;
+ loader_platform_thread_lock_mutex(&globalLock);
if (result == VK_SUCCESS) {
auto fence_queue = dev_data->fenceMap[fence].queue;
for (auto cmdBuffer : dev_data->fenceMap[fence].cmdBuffers) {
}
decrementResources(dev_data, 1, &fence);
}
+ loader_platform_thread_unlock_mutex(&globalLock);
if (VK_FALSE != skip_call)
return VK_ERROR_VALIDATION_FAILED_EXT;
return result;
VK_LAYER_EXPORT VKAPI_ATTR void VKAPI_CALL vkGetDeviceQueue(VkDevice device, uint32_t queueFamilyIndex, uint32_t queueIndex, VkQueue* pQueue)
{
layer_data* dev_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map);
+ loader_platform_thread_lock_mutex(&globalLock);
dev_data->device_dispatch_table->GetDeviceQueue(device, queueFamilyIndex, queueIndex, pQueue);
dev_data->queues.push_back(*pQueue);
dev_data->queueMap[*pQueue].device = device;
+ loader_platform_thread_unlock_mutex(&globalLock);
}
VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkQueueWaitIdle(VkQueue queue)
layer_data* dev_data = get_my_data_ptr(get_dispatch_key(queue), layer_data_map);
decrementResources(dev_data, queue);
VkBool32 skip_call = VK_FALSE;
+ loader_platform_thread_lock_mutex(&globalLock);
// Iterate over local set since we erase set members as we go in for loop
auto local_cb_set = dev_data->queueMap[queue].inFlightCmdBuffers;
for (auto cmdBuffer : local_cb_set) {
removeInFlightCmdBuffer(dev_data, cmdBuffer, queue);
}
dev_data->queueMap[queue].inFlightCmdBuffers.clear();
+ loader_platform_thread_unlock_mutex(&globalLock);
if (VK_FALSE != skip_call)
return VK_ERROR_VALIDATION_FAILED_EXT;
return dev_data->device_dispatch_table->QueueWaitIdle(queue);
{
VkBool32 skip_call = VK_FALSE;
layer_data* dev_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map);
+ loader_platform_thread_lock_mutex(&globalLock);
for (auto queue : dev_data->queues) {
decrementResources(dev_data, queue);
if (dev_data->queueMap.find(queue) != dev_data->queueMap.end()) {
skip_call |= cleanInFlightCmdBuffer(dev_data, cmdBuffer);
}
dev_data->globalInFlightCmdBuffers.clear();
+ loader_platform_thread_unlock_mutex(&globalLock);
if (VK_FALSE != skip_call)
return VK_ERROR_VALIDATION_FAILED_EXT;
return dev_data->device_dispatch_table->DeviceWaitIdle(device);
{
layer_data* dev_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map);
dev_data->device_dispatch_table->DestroySemaphore(device, semaphore, pAllocator);
+ loader_platform_thread_lock_mutex(&globalLock);
dev_data->semaphoreSignaledMap.erase(semaphore);
+ loader_platform_thread_unlock_mutex(&globalLock);
// TODO : Clean up any internal data structures using this obj.
}
layer_data* dev_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map);
unordered_map<QueryObject, vector<VkCommandBuffer>> queriesInFlight;
GLOBAL_CB_NODE* pCB = nullptr;
+ loader_platform_thread_lock_mutex(&globalLock);
for (auto cmdBuffer : dev_data->globalInFlightCmdBuffers) {
- pCB = getCBNode(dev_data, cmdBuffer);
+ pCB = getCBNode(dev_data, cmdBuffer, false);
for (auto queryStatePair : pCB->queryToStateMap) {
queriesInFlight[queryStatePair.first].push_back(cmdBuffer);
}
// Available and in flight
if(queryElement != queriesInFlight.end() && queryToStateElement != dev_data->queryToStateMap.end() && queryToStateElement->second) {
for (auto cmdBuffer : queryElement->second) {
- pCB = getCBNode(dev_data, cmdBuffer);
+ pCB = getCBNode(dev_data, cmdBuffer, false);
auto queryEventElement = pCB->waitedEventsBeforeQueryReset.find(query);
if (queryEventElement == pCB->waitedEventsBeforeQueryReset.end()) {
skip_call |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_QUERY_POOL_EXT, 0, __LINE__,
// TODO : Can there be the same query in use by multiple command buffers in flight?
bool make_available = false;
for (auto cmdBuffer : queryElement->second) {
- pCB = getCBNode(dev_data, cmdBuffer);
+ pCB = getCBNode(dev_data, cmdBuffer, false);
make_available |= pCB->queryToStateMap[query];
}
if (!(((flags & VK_QUERY_RESULT_PARTIAL_BIT) || (flags & VK_QUERY_RESULT_WAIT_BIT)) && make_available)) {
(uint64_t)(queryPool), firstQuery + i);
}
}
+ loader_platform_thread_unlock_mutex(&globalLock);
if (skip_call)
return VK_ERROR_VALIDATION_FAILED_EXT;
return dev_data->device_dispatch_table->GetQueryPoolResults(device, queryPool, firstQuery, queryCount, dataSize, pData, stride, flags);
VkBool32 validateIdleBuffer(const layer_data* my_data, VkBuffer buffer) {
VkBool32 skip_call = VK_FALSE;
+ loader_platform_thread_lock_mutex(&globalLock);
auto buffer_data = my_data->bufferMap.find(buffer);
if (buffer_data == my_data->bufferMap.end()) {
skip_call |= log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_BUFFER_EXT, (uint64_t)(buffer), __LINE__, DRAWSTATE_DOUBLE_DESTROY, "DS",
"Cannot free buffer %" PRIxLEAST64 " that is in use by a command buffer.", (uint64_t)(buffer));
}
}
+ loader_platform_thread_unlock_mutex(&globalLock);
return skip_call;
}
if (!validateIdleBuffer(dev_data, buffer)) {
dev_data->device_dispatch_table->DestroyBuffer(device, buffer, pAllocator);
}
+ loader_platform_thread_lock_mutex(&globalLock);
dev_data->bufferMap.erase(buffer);
+ loader_platform_thread_unlock_mutex(&globalLock);
}
VK_LAYER_EXPORT VKAPI_ATTR void VKAPI_CALL vkDestroyBufferView(VkDevice device, VkBufferView bufferView, const VkAllocationCallbacks* pAllocator)
{
layer_data* dev_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map);
dev_data->device_dispatch_table->DestroyBufferView(device, bufferView, pAllocator);
+ loader_platform_thread_lock_mutex(&globalLock);
dev_data->bufferViewMap.erase(bufferView);
+ loader_platform_thread_unlock_mutex(&globalLock);
}
VK_LAYER_EXPORT VKAPI_ATTR void VKAPI_CALL vkDestroyImage(VkDevice device, VkImage image, const VkAllocationCallbacks* pAllocator)
{
layer_data* dev_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map);
dev_data->device_dispatch_table->DestroyImage(device, image, pAllocator);
+ loader_platform_thread_lock_mutex(&globalLock);
dev_data->imageMap.erase(image);
+ loader_platform_thread_unlock_mutex(&globalLock);
}
VK_LAYER_EXPORT VKAPI_ATTR void VKAPI_CALL vkDestroyImageView(VkDevice device, VkImageView imageView, const VkAllocationCallbacks* pAllocator)
layer_data* dev_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map);
VkResult result = dev_data->device_dispatch_table->CreatePipelineLayout(device, pCreateInfo, pAllocator, pPipelineLayout);
if (VK_SUCCESS == result) {
+ loader_platform_thread_lock_mutex(&globalLock);
// TODOSC : Merge capture of the setLayouts per pipeline
PIPELINE_LAYOUT_NODE& plNode = dev_data->pipelineLayoutMap[*pPipelineLayout];
plNode.descriptorSetLayouts.resize(pCreateInfo->setLayoutCount);
for (i=0; i<pCreateInfo->pushConstantRangeCount; ++i) {
plNode.pushConstantRanges[i] = pCreateInfo->pPushConstantRanges[i];
}
+ loader_platform_thread_unlock_mutex(&globalLock);
}
return result;
}
"Unable to find set layout node for layout %#" PRIxLEAST64 " specified in vkAllocateDescriptorSets() call", (uint64_t) pAllocateInfo->pSetLayouts[i]))
return VK_ERROR_VALIDATION_FAILED_EXT;
}
+ loader_platform_thread_lock_mutex(&globalLock);
pNewNode->pLayout = pLayout;
pNewNode->pool = pAllocateInfo->descriptorPool;
pNewNode->set = pDescriptorSets[i];
memset(pNewNode->ppDescriptors, 0, descriptorArraySize);
}
dev_data->setMap[pDescriptorSets[i]] = pNewNode;
+ loader_platform_thread_unlock_mutex(&globalLock);
}
}
}
VkResult result = dev_data->device_dispatch_table->FreeDescriptorSets(device, descriptorPool, count, pDescriptorSets);
if (VK_SUCCESS == result) {
// For each freed descriptor add it back into the pool as available
+ loader_platform_thread_lock_mutex(&globalLock);
for (uint32_t i=0; i<count; ++i) {
SET_NODE* pSet = dev_data->setMap[pDescriptorSets[i]]; // getSetNode() without locking
invalidateBoundCmdBuffers(dev_data, pSet);
pPoolNode->availableDescriptorTypeCount[typeIndex] += poolSizeCount;
}
}
+ loader_platform_thread_unlock_mutex(&globalLock);
}
// TODO : Any other clean-up or book-keeping to do here?
return result;
layer_data* dev_data = get_my_data_ptr(get_dispatch_key(commandBuffer), layer_data_map);
GLOBAL_CB_NODE* pCB = getCBNode(dev_data, commandBuffer);
if (pCB) {
- skipCall |= addCmd(dev_data, pCB, CMD_SETVIEWPORTSTATE, "vkCmdSetViewport()");
loader_platform_thread_lock_mutex(&globalLock);
+ skipCall |= addCmd(dev_data, pCB, CMD_SETVIEWPORTSTATE, "vkCmdSetViewport()");
pCB->status |= CBSTATUS_VIEWPORT_SET;
pCB->viewports.resize(viewportCount);
memcpy(pCB->viewports.data(), pViewports, viewportCount * sizeof(VkViewport));
layer_data* dev_data = get_my_data_ptr(get_dispatch_key(commandBuffer), layer_data_map);
GLOBAL_CB_NODE* pCB = getCBNode(dev_data, commandBuffer);
if (pCB) {
- skipCall |= addCmd(dev_data, pCB, CMD_SETSCISSORSTATE, "vkCmdSetScissor()");
loader_platform_thread_lock_mutex(&globalLock);
+ skipCall |= addCmd(dev_data, pCB, CMD_SETSCISSORSTATE, "vkCmdSetScissor()");
pCB->status |= CBSTATUS_SCISSOR_SET;
pCB->scissors.resize(scissorCount);
memcpy(pCB->scissors.data(), pScissors, scissorCount * sizeof(VkRect2D));
layer_data* dev_data = get_my_data_ptr(get_dispatch_key(commandBuffer), layer_data_map);
GLOBAL_CB_NODE* pCB = getCBNode(dev_data, commandBuffer);
if (pCB) {
- skipCall |= addCmd(dev_data, pCB, CMD_SETLINEWIDTHSTATE, "vkCmdSetLineWidth()");
- /* TODO: Do we still need this lock? */
loader_platform_thread_lock_mutex(&globalLock);
+ skipCall |= addCmd(dev_data, pCB, CMD_SETLINEWIDTHSTATE, "vkCmdSetLineWidth()");
pCB->status |= CBSTATUS_LINE_WIDTH_SET;
pCB->lineWidth = lineWidth;
loader_platform_thread_unlock_mutex(&globalLock);
layer_data* dev_data = get_my_data_ptr(get_dispatch_key(commandBuffer), layer_data_map);
GLOBAL_CB_NODE* pCB = getCBNode(dev_data, commandBuffer);
if (pCB) {
+ loader_platform_thread_lock_mutex(&globalLock);
skipCall |= addCmd(dev_data, pCB, CMD_SETDEPTHBIASSTATE, "vkCmdSetDepthBias()");
pCB->status |= CBSTATUS_DEPTH_BIAS_SET;
pCB->depthBiasConstantFactor = depthBiasConstantFactor;
pCB->depthBiasClamp = depthBiasClamp;
pCB->depthBiasSlopeFactor = depthBiasSlopeFactor;
+ loader_platform_thread_unlock_mutex(&globalLock);
}
if (VK_FALSE == skipCall)
dev_data->device_dispatch_table->CmdSetDepthBias(commandBuffer, depthBiasConstantFactor, depthBiasClamp, depthBiasSlopeFactor);
layer_data* dev_data = get_my_data_ptr(get_dispatch_key(commandBuffer), layer_data_map);
GLOBAL_CB_NODE* pCB = getCBNode(dev_data, commandBuffer);
if (pCB) {
+ loader_platform_thread_lock_mutex(&globalLock);
skipCall |= addCmd(dev_data, pCB, CMD_SETBLENDSTATE, "vkCmdSetBlendConstants()");
pCB->status |= CBSTATUS_BLEND_SET;
memcpy(pCB->blendConstants, blendConstants, 4 * sizeof(float));
+ loader_platform_thread_unlock_mutex(&globalLock);
}
if (VK_FALSE == skipCall)
dev_data->device_dispatch_table->CmdSetBlendConstants(commandBuffer, blendConstants);
layer_data* dev_data = get_my_data_ptr(get_dispatch_key(commandBuffer), layer_data_map);
GLOBAL_CB_NODE* pCB = getCBNode(dev_data, commandBuffer);
if (pCB) {
+ loader_platform_thread_lock_mutex(&globalLock);
skipCall |= addCmd(dev_data, pCB, CMD_SETDEPTHBOUNDSSTATE, "vkCmdSetDepthBounds()");
pCB->status |= CBSTATUS_DEPTH_BOUNDS_SET;
pCB->minDepthBounds = minDepthBounds;
pCB->maxDepthBounds = maxDepthBounds;
+ loader_platform_thread_unlock_mutex(&globalLock);
}
if (VK_FALSE == skipCall)
dev_data->device_dispatch_table->CmdSetDepthBounds(commandBuffer, minDepthBounds, maxDepthBounds);
layer_data* dev_data = get_my_data_ptr(get_dispatch_key(commandBuffer), layer_data_map);
GLOBAL_CB_NODE* pCB = getCBNode(dev_data, commandBuffer);
if (pCB) {
+ loader_platform_thread_lock_mutex(&globalLock);
skipCall |= addCmd(dev_data, pCB, CMD_SETSTENCILREADMASKSTATE, "vkCmdSetStencilCompareMask()");
if (faceMask & VK_STENCIL_FACE_FRONT_BIT) {
pCB->front.compareMask = compareMask;
/* TODO: Do we need to track front and back separately? */
/* TODO: We aren't capturing the faceMask, do we need to? */
pCB->status |= CBSTATUS_STENCIL_READ_MASK_SET;
+ loader_platform_thread_unlock_mutex(&globalLock);
}
if (VK_FALSE == skipCall)
dev_data->device_dispatch_table->CmdSetStencilCompareMask(commandBuffer, faceMask, compareMask);
layer_data* dev_data = get_my_data_ptr(get_dispatch_key(commandBuffer), layer_data_map);
GLOBAL_CB_NODE* pCB = getCBNode(dev_data, commandBuffer);
if (pCB) {
+ loader_platform_thread_lock_mutex(&globalLock);
skipCall |= addCmd(dev_data, pCB, CMD_SETSTENCILWRITEMASKSTATE, "vkCmdSetStencilWriteMask()");
if (faceMask & VK_STENCIL_FACE_FRONT_BIT) {
pCB->front.writeMask = writeMask;
pCB->back.writeMask = writeMask;
}
pCB->status |= CBSTATUS_STENCIL_WRITE_MASK_SET;
+ loader_platform_thread_unlock_mutex(&globalLock);
}
if (VK_FALSE == skipCall)
dev_data->device_dispatch_table->CmdSetStencilWriteMask(commandBuffer, faceMask, writeMask);
layer_data* dev_data = get_my_data_ptr(get_dispatch_key(commandBuffer), layer_data_map);
GLOBAL_CB_NODE* pCB = getCBNode(dev_data, commandBuffer);
if (pCB) {
+ loader_platform_thread_lock_mutex(&globalLock);
skipCall |= addCmd(dev_data, pCB, CMD_SETSTENCILREFERENCESTATE, "vkCmdSetStencilReference()");
if (faceMask & VK_STENCIL_FACE_FRONT_BIT) {
pCB->front.reference = reference;
pCB->back.reference = reference;
}
pCB->status |= CBSTATUS_STENCIL_REFERENCE_SET;
+ loader_platform_thread_unlock_mutex(&globalLock);
}
if (VK_FALSE == skipCall)
dev_data->device_dispatch_table->CmdSetStencilReference(commandBuffer, faceMask, reference);
{
VkBool32 skipCall = VK_FALSE;
layer_data* dev_data = get_my_data_ptr(get_dispatch_key(commandBuffer), layer_data_map);
- GLOBAL_CB_NODE* pCB = getCBNode(dev_data, commandBuffer);
+ loader_platform_thread_lock_mutex(&globalLock);
+ GLOBAL_CB_NODE* pCB = getCBNode(dev_data, commandBuffer, false);
if (pCB) {
if (pCB->state == CB_RECORDING) {
if ((VK_PIPELINE_BIND_POINT_COMPUTE == pipelineBindPoint) && (pCB->activeRenderPass)) {
pCB->boundDescriptorSets.resize(lastSetIndex+1);
VkDescriptorSet oldFinalBoundSet = pCB->boundDescriptorSets[lastSetIndex];
for (uint32_t i=0; i<setCount; i++) {
- SET_NODE* pSet = getSetNode(dev_data, pDescriptorSets[i]);
+ SET_NODE* pSet = getSetNode(dev_data, pDescriptorSets[i], false);
if (pSet) {
- loader_platform_thread_lock_mutex(&globalLock);
pCB->uniqueBoundSets.insert(pDescriptorSets[i]);
pSet->boundCmdBuffers.insert(commandBuffer);
pCB->lastBoundDescriptorSet = pDescriptorSets[i];
pCB->lastBoundPipelineLayout = layout;
pCB->boundDescriptorSets[i+firstSet] = pDescriptorSets[i];
- loader_platform_thread_unlock_mutex(&globalLock);
skipCall |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_INFO_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_SET_EXT, (uint64_t) pDescriptorSets[i], __LINE__, DRAWSTATE_NONE, "DS",
"DS %#" PRIxLEAST64 " bound on pipeline %s", (uint64_t) pDescriptorSets[i], string_VkPipelineBindPoint(pipelineBindPoint));
if (!pSet->pUpdateStructs && (pSet->descriptorCount != 0)) {
skipCall |= report_error_no_cb_begin(dev_data, commandBuffer, "vkCmdBindDescriptorSets()");
}
}
+ loader_platform_thread_unlock_mutex(&globalLock);
if (VK_FALSE == skipCall)
dev_data->device_dispatch_table->CmdBindDescriptorSets(commandBuffer, pipelineBindPoint, layout, firstSet, setCount, pDescriptorSets, dynamicOffsetCount, pDynamicOffsets);
}
{
VkBool32 skipCall = VK_FALSE;
layer_data* dev_data = get_my_data_ptr(get_dispatch_key(commandBuffer), layer_data_map);
- GLOBAL_CB_NODE* pCB = getCBNode(dev_data, commandBuffer);
+ loader_platform_thread_lock_mutex(&globalLock);
+ GLOBAL_CB_NODE* pCB = getCBNode(dev_data, commandBuffer, false);
if (pCB) {
skipCall |= addCmd(dev_data, pCB, CMD_BINDINDEXBUFFER, "vkCmdBindIndexBuffer()");
VkDeviceSize offset_align = 0;
}
pCB->status |= CBSTATUS_INDEX_BUFFER_BOUND;
}
+ loader_platform_thread_unlock_mutex(&globalLock);
if (VK_FALSE == skipCall)
dev_data->device_dispatch_table->CmdBindIndexBuffer(commandBuffer, buffer, offset, indexType);
}
{
VkBool32 skipCall = VK_FALSE;
layer_data* dev_data = get_my_data_ptr(get_dispatch_key(commandBuffer), layer_data_map);
- GLOBAL_CB_NODE* pCB = getCBNode(dev_data, commandBuffer);
+ loader_platform_thread_lock_mutex(&globalLock);
+ GLOBAL_CB_NODE* pCB = getCBNode(dev_data, commandBuffer, false);
if (pCB) {
addCmd(dev_data, pCB, CMD_BINDVERTEXBUFFER, "vkCmdBindVertexBuffer()");
updateResourceTracking(pCB, firstBinding, bindingCount, pBuffers);
} else {
skipCall |= report_error_no_cb_begin(dev_data, commandBuffer, "vkCmdBindVertexBuffer()");
}
+ loader_platform_thread_unlock_mutex(&globalLock);
if (VK_FALSE == skipCall)
dev_data->device_dispatch_table->CmdBindVertexBuffers(commandBuffer, firstBinding, bindingCount, pBuffers, pOffsets);
}
{
VkBool32 skipCall = VK_FALSE;
layer_data* dev_data = get_my_data_ptr(get_dispatch_key(commandBuffer), layer_data_map);
- GLOBAL_CB_NODE* pCB = getCBNode(dev_data, commandBuffer);
+ loader_platform_thread_lock_mutex(&globalLock);
+ GLOBAL_CB_NODE* pCB = getCBNode(dev_data, commandBuffer, false);
if (pCB) {
skipCall |= addCmd(dev_data, pCB, CMD_DRAW, "vkCmdDraw()");
pCB->drawCount[DRAW]++;
+ loader_platform_thread_unlock_mutex(&globalLock);
skipCall |= validate_draw_state(dev_data, pCB, VK_FALSE);
+ loader_platform_thread_lock_mutex(&globalLock);
// TODO : Need to pass commandBuffer as srcObj here
skipCall |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_INFO_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, 0, __LINE__, DRAWSTATE_NONE, "DS",
"vkCmdDraw() call #%" PRIu64 ", reporting DS state:", g_drawCount[DRAW]++);
}
skipCall |= outsideRenderPass(dev_data, pCB, "vkCmdDraw");
}
+ loader_platform_thread_unlock_mutex(&globalLock);
if (VK_FALSE == skipCall)
dev_data->device_dispatch_table->CmdDraw(commandBuffer, vertexCount, instanceCount, firstVertex, firstInstance);
}
VK_LAYER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdDrawIndexed(VkCommandBuffer commandBuffer, uint32_t indexCount, uint32_t instanceCount, uint32_t firstIndex, int32_t vertexOffset, uint32_t firstInstance)
{
layer_data* dev_data = get_my_data_ptr(get_dispatch_key(commandBuffer), layer_data_map);
- GLOBAL_CB_NODE* pCB = getCBNode(dev_data, commandBuffer);
+ loader_platform_thread_lock_mutex(&globalLock);
+ GLOBAL_CB_NODE* pCB = getCBNode(dev_data, commandBuffer, false);
VkBool32 skipCall = VK_FALSE;
if (pCB) {
skipCall |= addCmd(dev_data, pCB, CMD_DRAWINDEXED, "vkCmdDrawIndexed()");
pCB->drawCount[DRAW_INDEXED]++;
+ loader_platform_thread_unlock_mutex(&globalLock);
skipCall |= validate_draw_state(dev_data, pCB, VK_TRUE);
+ loader_platform_thread_lock_mutex(&globalLock);
// TODO : Need to pass commandBuffer as srcObj here
skipCall |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_INFO_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, 0, __LINE__, DRAWSTATE_NONE, "DS",
"vkCmdDrawIndexed() call #%" PRIu64 ", reporting DS state:", g_drawCount[DRAW_INDEXED]++);
}
skipCall |= outsideRenderPass(dev_data, pCB, "vkCmdDrawIndexed");
}
+ loader_platform_thread_unlock_mutex(&globalLock);
if (VK_FALSE == skipCall)
dev_data->device_dispatch_table->CmdDrawIndexed(commandBuffer, indexCount, instanceCount, firstIndex, vertexOffset, firstInstance);
}
VK_LAYER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdDrawIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, uint32_t count, uint32_t stride)
{
layer_data* dev_data = get_my_data_ptr(get_dispatch_key(commandBuffer), layer_data_map);
- GLOBAL_CB_NODE* pCB = getCBNode(dev_data, commandBuffer);
+ loader_platform_thread_lock_mutex(&globalLock);
+ GLOBAL_CB_NODE* pCB = getCBNode(dev_data, commandBuffer, false);
VkBool32 skipCall = VK_FALSE;
if (pCB) {
skipCall |= addCmd(dev_data, pCB, CMD_DRAWINDIRECT, "vkCmdDrawIndirect()");
pCB->drawCount[DRAW_INDIRECT]++;
+ loader_platform_thread_unlock_mutex(&globalLock);
skipCall |= validate_draw_state(dev_data, pCB, VK_FALSE);
+ loader_platform_thread_lock_mutex(&globalLock);
// TODO : Need to pass commandBuffer as srcObj here
skipCall |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_INFO_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, 0, __LINE__, DRAWSTATE_NONE, "DS",
"vkCmdDrawIndirect() call #%" PRIu64 ", reporting DS state:", g_drawCount[DRAW_INDIRECT]++);
}
skipCall |= outsideRenderPass(dev_data, pCB, "vkCmdDrawIndirect");
}
+ loader_platform_thread_unlock_mutex(&globalLock);
if (VK_FALSE == skipCall)
dev_data->device_dispatch_table->CmdDrawIndirect(commandBuffer, buffer, offset, count, stride);
}
{
VkBool32 skipCall = VK_FALSE;
layer_data* dev_data = get_my_data_ptr(get_dispatch_key(commandBuffer), layer_data_map);
- GLOBAL_CB_NODE* pCB = getCBNode(dev_data, commandBuffer);
+ loader_platform_thread_lock_mutex(&globalLock);
+ GLOBAL_CB_NODE* pCB = getCBNode(dev_data, commandBuffer, false);
if (pCB) {
skipCall |= addCmd(dev_data, pCB, CMD_DRAWINDEXEDINDIRECT, "vkCmdDrawIndexedIndirect()");
pCB->drawCount[DRAW_INDEXED_INDIRECT]++;
+ loader_platform_thread_unlock_mutex(&globalLock);
skipCall |= validate_draw_state(dev_data, pCB, VK_TRUE);
+ loader_platform_thread_lock_mutex(&globalLock);
// TODO : Need to pass commandBuffer as srcObj here
skipCall |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_INFO_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, 0, __LINE__, DRAWSTATE_NONE, "DS",
"vkCmdDrawIndexedIndirect() call #%" PRIu64 ", reporting DS state:", g_drawCount[DRAW_INDEXED_INDIRECT]++);
}
skipCall |= outsideRenderPass(dev_data, pCB, "vkCmdDrawIndexedIndirect");
}
+ loader_platform_thread_unlock_mutex(&globalLock);
if (VK_FALSE == skipCall)
dev_data->device_dispatch_table->CmdDrawIndexedIndirect(commandBuffer, buffer, offset, count, stride);
}
{
VkBool32 skipCall = VK_FALSE;
layer_data* dev_data = get_my_data_ptr(get_dispatch_key(commandBuffer), layer_data_map);
- GLOBAL_CB_NODE* pCB = getCBNode(dev_data, commandBuffer);
+ loader_platform_thread_lock_mutex(&globalLock);
+ GLOBAL_CB_NODE* pCB = getCBNode(dev_data, commandBuffer, false);
if (pCB) {
skipCall |= addCmd(dev_data, pCB, CMD_DISPATCH, "vkCmdDispatch()");
skipCall |= insideRenderPass(dev_data, pCB, "vkCmdDispatch");
}
+ loader_platform_thread_unlock_mutex(&globalLock);
if (VK_FALSE == skipCall)
dev_data->device_dispatch_table->CmdDispatch(commandBuffer, x, y, z);
}
{
VkBool32 skipCall = VK_FALSE;
layer_data* dev_data = get_my_data_ptr(get_dispatch_key(commandBuffer), layer_data_map);
- GLOBAL_CB_NODE* pCB = getCBNode(dev_data, commandBuffer);
+ loader_platform_thread_lock_mutex(&globalLock);
+ GLOBAL_CB_NODE* pCB = getCBNode(dev_data, commandBuffer, false);
if (pCB) {
skipCall |= addCmd(dev_data, pCB, CMD_DISPATCHINDIRECT, "vkCmdDispatchIndirect()");
skipCall |= insideRenderPass(dev_data, pCB, "vkCmdDispatchIndirect");
}
+ loader_platform_thread_unlock_mutex(&globalLock);
if (VK_FALSE == skipCall)
dev_data->device_dispatch_table->CmdDispatchIndirect(commandBuffer, buffer, offset);
}
{
VkBool32 skipCall = VK_FALSE;
layer_data* dev_data = get_my_data_ptr(get_dispatch_key(commandBuffer), layer_data_map);
- GLOBAL_CB_NODE* pCB = getCBNode(dev_data, commandBuffer);
+ loader_platform_thread_lock_mutex(&globalLock);
+ GLOBAL_CB_NODE* pCB = getCBNode(dev_data, commandBuffer, false);
if (pCB) {
skipCall |= addCmd(dev_data, pCB, CMD_COPYBUFFER, "vkCmdCopyBuffer()");
skipCall |= insideRenderPass(dev_data, pCB, "vkCmdCopyBuffer");
}
+ loader_platform_thread_unlock_mutex(&globalLock);
if (VK_FALSE == skipCall)
dev_data->device_dispatch_table->CmdCopyBuffer(commandBuffer, srcBuffer, dstBuffer, regionCount, pRegions);
}
{
VkBool32 skipCall = VK_FALSE;
layer_data* dev_data = get_my_data_ptr(get_dispatch_key(commandBuffer), layer_data_map);
- GLOBAL_CB_NODE* pCB = getCBNode(dev_data, commandBuffer);
+ loader_platform_thread_lock_mutex(&globalLock);
+ GLOBAL_CB_NODE* pCB = getCBNode(dev_data, commandBuffer, false);
if (pCB) {
skipCall |= addCmd(dev_data, pCB, CMD_COPYIMAGE, "vkCmdCopyImage()");
skipCall |= insideRenderPass(dev_data, pCB, "vkCmdCopyImage");
skipCall |= VerifySourceImageLayout(commandBuffer, srcImage, srcImageLayout);
skipCall |= VerifyDestImageLayout(commandBuffer, dstImage, dstImageLayout);
}
+ loader_platform_thread_unlock_mutex(&globalLock);
if (VK_FALSE == skipCall)
dev_data->device_dispatch_table->CmdCopyImage(commandBuffer, srcImage, srcImageLayout, dstImage, dstImageLayout, regionCount, pRegions);
}
{
VkBool32 skipCall = VK_FALSE;
layer_data* dev_data = get_my_data_ptr(get_dispatch_key(commandBuffer), layer_data_map);
- GLOBAL_CB_NODE* pCB = getCBNode(dev_data, commandBuffer);
+ loader_platform_thread_lock_mutex(&globalLock);
+ GLOBAL_CB_NODE* pCB = getCBNode(dev_data, commandBuffer, false);
if (pCB) {
skipCall |= addCmd(dev_data, pCB, CMD_BLITIMAGE, "vkCmdBlitImage()");
skipCall |= insideRenderPass(dev_data, pCB, "vkCmdBlitImage");
}
+ loader_platform_thread_unlock_mutex(&globalLock);
if (VK_FALSE == skipCall)
dev_data->device_dispatch_table->CmdBlitImage(commandBuffer, srcImage, srcImageLayout, dstImage, dstImageLayout, regionCount, pRegions, filter);
}
{
VkBool32 skipCall = VK_FALSE;
layer_data* dev_data = get_my_data_ptr(get_dispatch_key(commandBuffer), layer_data_map);
- GLOBAL_CB_NODE* pCB = getCBNode(dev_data, commandBuffer);
+ loader_platform_thread_lock_mutex(&globalLock);
+ GLOBAL_CB_NODE* pCB = getCBNode(dev_data, commandBuffer, false);
if (pCB) {
skipCall |= addCmd(dev_data, pCB, CMD_COPYBUFFERTOIMAGE, "vkCmdCopyBufferToImage()");
skipCall |= insideRenderPass(dev_data, pCB, "vkCmdCopyBufferToImage");
skipCall |= VerifyDestImageLayout(commandBuffer, dstImage, dstImageLayout);
}
+ loader_platform_thread_unlock_mutex(&globalLock);
if (VK_FALSE == skipCall)
dev_data->device_dispatch_table->CmdCopyBufferToImage(commandBuffer, srcBuffer, dstImage, dstImageLayout, regionCount, pRegions);
}
{
VkBool32 skipCall = VK_FALSE;
layer_data* dev_data = get_my_data_ptr(get_dispatch_key(commandBuffer), layer_data_map);
- GLOBAL_CB_NODE* pCB = getCBNode(dev_data, commandBuffer);
+ loader_platform_thread_lock_mutex(&globalLock);
+ GLOBAL_CB_NODE* pCB = getCBNode(dev_data, commandBuffer, false);
if (pCB) {
skipCall |= addCmd(dev_data, pCB, CMD_COPYIMAGETOBUFFER, "vkCmdCopyImageToBuffer()");
skipCall |= insideRenderPass(dev_data, pCB, "vkCmdCopyImageToBuffer");
skipCall |= VerifySourceImageLayout(commandBuffer, srcImage, srcImageLayout);
}
+ loader_platform_thread_unlock_mutex(&globalLock);
if (VK_FALSE == skipCall)
dev_data->device_dispatch_table->CmdCopyImageToBuffer(commandBuffer, srcImage, srcImageLayout, dstBuffer, regionCount, pRegions);
}
{
VkBool32 skipCall = VK_FALSE;
layer_data* dev_data = get_my_data_ptr(get_dispatch_key(commandBuffer), layer_data_map);
- GLOBAL_CB_NODE* pCB = getCBNode(dev_data, commandBuffer);
+ loader_platform_thread_lock_mutex(&globalLock);
+ GLOBAL_CB_NODE* pCB = getCBNode(dev_data, commandBuffer, false);
if (pCB) {
skipCall |= addCmd(dev_data, pCB, CMD_UPDATEBUFFER, "vkCmdUpdateBuffer()");
skipCall |= insideRenderPass(dev_data, pCB, "vkCmdCopyUpdateBuffer");
}
+ loader_platform_thread_unlock_mutex(&globalLock);
if (VK_FALSE == skipCall)
dev_data->device_dispatch_table->CmdUpdateBuffer(commandBuffer, dstBuffer, dstOffset, dataSize, pData);
}
{
VkBool32 skipCall = VK_FALSE;
layer_data* dev_data = get_my_data_ptr(get_dispatch_key(commandBuffer), layer_data_map);
- GLOBAL_CB_NODE* pCB = getCBNode(dev_data, commandBuffer);
+ loader_platform_thread_lock_mutex(&globalLock);
+ GLOBAL_CB_NODE* pCB = getCBNode(dev_data, commandBuffer, false);
if (pCB) {
skipCall |= addCmd(dev_data, pCB, CMD_FILLBUFFER, "vkCmdFillBuffer()");
skipCall |= insideRenderPass(dev_data, pCB, "vkCmdCopyFillBuffer");
}
+ loader_platform_thread_unlock_mutex(&globalLock);
if (VK_FALSE == skipCall)
dev_data->device_dispatch_table->CmdFillBuffer(commandBuffer, dstBuffer, dstOffset, size, data);
}
{
VkBool32 skipCall = VK_FALSE;
layer_data* dev_data = get_my_data_ptr(get_dispatch_key(commandBuffer), layer_data_map);
- GLOBAL_CB_NODE* pCB = getCBNode(dev_data, commandBuffer);
+ loader_platform_thread_lock_mutex(&globalLock);
+ GLOBAL_CB_NODE* pCB = getCBNode(dev_data, commandBuffer, false);
if (pCB) {
skipCall |= addCmd(dev_data, pCB, CMD_CLEARATTACHMENTS, "vkCmdClearAttachments()");
// Warn if this is issued prior to Draw Cmd and clearing the entire attachment
}
}
}
+ loader_platform_thread_unlock_mutex(&globalLock);
if (VK_FALSE == skipCall)
dev_data->device_dispatch_table->CmdClearAttachments(commandBuffer, attachmentCount, pAttachments, rectCount, pRects);
}
{
VkBool32 skipCall = VK_FALSE;
layer_data* dev_data = get_my_data_ptr(get_dispatch_key(commandBuffer), layer_data_map);
- GLOBAL_CB_NODE* pCB = getCBNode(dev_data, commandBuffer);
+ loader_platform_thread_lock_mutex(&globalLock);
+ GLOBAL_CB_NODE* pCB = getCBNode(dev_data, commandBuffer, false);
if (pCB) {
skipCall |= addCmd(dev_data, pCB, CMD_CLEARCOLORIMAGE, "vkCmdClearColorImage()");
skipCall |= insideRenderPass(dev_data, pCB, "vkCmdClearColorImage");
}
+ loader_platform_thread_unlock_mutex(&globalLock);
if (VK_FALSE == skipCall)
dev_data->device_dispatch_table->CmdClearColorImage(commandBuffer, image, imageLayout, pColor, rangeCount, pRanges);
}
{
VkBool32 skipCall = VK_FALSE;
layer_data* dev_data = get_my_data_ptr(get_dispatch_key(commandBuffer), layer_data_map);
- GLOBAL_CB_NODE* pCB = getCBNode(dev_data, commandBuffer);
+ loader_platform_thread_lock_mutex(&globalLock);
+ GLOBAL_CB_NODE* pCB = getCBNode(dev_data, commandBuffer, false);
if (pCB) {
skipCall |= addCmd(dev_data, pCB, CMD_CLEARDEPTHSTENCILIMAGE, "vkCmdClearDepthStencilImage()");
skipCall |= insideRenderPass(dev_data, pCB, "vkCmdClearDepthStencilImage");
}
+ loader_platform_thread_unlock_mutex(&globalLock);
if (VK_FALSE == skipCall)
dev_data->device_dispatch_table->CmdClearDepthStencilImage(commandBuffer, image, imageLayout, pDepthStencil, rangeCount, pRanges);
}
{
VkBool32 skipCall = VK_FALSE;
layer_data* dev_data = get_my_data_ptr(get_dispatch_key(commandBuffer), layer_data_map);
- GLOBAL_CB_NODE* pCB = getCBNode(dev_data, commandBuffer);
+ loader_platform_thread_lock_mutex(&globalLock);
+ GLOBAL_CB_NODE* pCB = getCBNode(dev_data, commandBuffer, false);
if (pCB) {
skipCall |= addCmd(dev_data, pCB, CMD_RESOLVEIMAGE, "vkCmdResolveImage()");
skipCall |= insideRenderPass(dev_data, pCB, "vkCmdResolveImage");
}
+ loader_platform_thread_unlock_mutex(&globalLock);
if (VK_FALSE == skipCall)
dev_data->device_dispatch_table->CmdResolveImage(commandBuffer, srcImage, srcImageLayout, dstImage, dstImageLayout, regionCount, pRegions);
}
{
VkBool32 skipCall = VK_FALSE;
layer_data* dev_data = get_my_data_ptr(get_dispatch_key(commandBuffer), layer_data_map);
- GLOBAL_CB_NODE* pCB = getCBNode(dev_data, commandBuffer);
+ loader_platform_thread_lock_mutex(&globalLock);
+ GLOBAL_CB_NODE* pCB = getCBNode(dev_data, commandBuffer, false);
if (pCB) {
skipCall |= addCmd(dev_data, pCB, CMD_SETEVENT, "vkCmdSetEvent()");
skipCall |= insideRenderPass(dev_data, pCB, "vkCmdSetEvent");
}
+ loader_platform_thread_unlock_mutex(&globalLock);
if (VK_FALSE == skipCall)
dev_data->device_dispatch_table->CmdSetEvent(commandBuffer, event, stageMask);
}
{
VkBool32 skipCall = VK_FALSE;
layer_data* dev_data = get_my_data_ptr(get_dispatch_key(commandBuffer), layer_data_map);
- GLOBAL_CB_NODE* pCB = getCBNode(dev_data, commandBuffer);
+ loader_platform_thread_lock_mutex(&globalLock);
+ GLOBAL_CB_NODE* pCB = getCBNode(dev_data, commandBuffer, false);
if (pCB) {
skipCall |= addCmd(dev_data, pCB, CMD_RESETEVENT, "vkCmdResetEvent()");
skipCall |= insideRenderPass(dev_data, pCB, "vkCmdResetEvent");
}
+ loader_platform_thread_unlock_mutex(&globalLock);
if (VK_FALSE == skipCall)
dev_data->device_dispatch_table->CmdResetEvent(commandBuffer, event, stageMask);
}
VkBool32 TransitionImageLayouts(VkCommandBuffer cmdBuffer, uint32_t memBarrierCount, const VkImageMemoryBarrier* pImgMemBarriers) {
layer_data* dev_data = get_my_data_ptr(get_dispatch_key(cmdBuffer), layer_data_map);
- GLOBAL_CB_NODE* pCB = getCBNode(dev_data, cmdBuffer);
+ GLOBAL_CB_NODE* pCB = getCBNode(dev_data, cmdBuffer, false);
VkBool32 skip = VK_FALSE;
#ifdef DISABLE_IMAGE_LAYOUT_VALIDATION
{
VkBool32 skip_call = VK_FALSE;
layer_data* dev_data = get_my_data_ptr(get_dispatch_key(cmdBuffer), layer_data_map);
- GLOBAL_CB_NODE* pCB = getCBNode(dev_data, cmdBuffer);
+ GLOBAL_CB_NODE* pCB = getCBNode(dev_data, cmdBuffer, false);
if (pCB->activeRenderPass && memBarrierCount) {
for (uint32_t i = 0; i < memBarrierCount; ++i) {
auto mem_barrier = &pMemBarriers[i];
{
VkBool32 skipCall = VK_FALSE;
layer_data* dev_data = get_my_data_ptr(get_dispatch_key(commandBuffer), layer_data_map);
- GLOBAL_CB_NODE* pCB = getCBNode(dev_data, commandBuffer);
+ loader_platform_thread_lock_mutex(&globalLock);
+ GLOBAL_CB_NODE* pCB = getCBNode(dev_data, commandBuffer, false);
if (pCB) {
for (uint32_t i = 0; i < eventCount; ++i) {
pCB->waitedEvents.push_back(pEvents[i]);
skipCall |= TransitionImageLayouts(commandBuffer, imageMemoryBarrierCount, pImageMemoryBarriers);
skipCall |= ValidateBarriers(commandBuffer, memoryBarrierCount, pMemoryBarriers, imageMemoryBarrierCount, pImageMemoryBarriers);
}
+ loader_platform_thread_unlock_mutex(&globalLock);
if (VK_FALSE == skipCall)
dev_data->device_dispatch_table->CmdWaitEvents(commandBuffer, eventCount, pEvents, sourceStageMask, dstStageMask,
memoryBarrierCount, pMemoryBarriers,
{
VkBool32 skipCall = VK_FALSE;
layer_data* dev_data = get_my_data_ptr(get_dispatch_key(commandBuffer), layer_data_map);
- GLOBAL_CB_NODE* pCB = getCBNode(dev_data, commandBuffer);
+ loader_platform_thread_lock_mutex(&globalLock);
+ GLOBAL_CB_NODE* pCB = getCBNode(dev_data, commandBuffer, false);
if (pCB) {
skipCall |= addCmd(dev_data, pCB, CMD_PIPELINEBARRIER, "vkCmdPipelineBarrier()");
skipCall |= TransitionImageLayouts(commandBuffer, imageMemoryBarrierCount, pImageMemoryBarriers);
skipCall |= ValidateBarriers(commandBuffer, memoryBarrierCount, pMemoryBarriers, imageMemoryBarrierCount, pImageMemoryBarriers);
}
+ loader_platform_thread_unlock_mutex(&globalLock);
if (VK_FALSE == skipCall)
dev_data->device_dispatch_table->CmdPipelineBarrier(commandBuffer, srcStageMask, dstStageMask, dependencyFlags,
memoryBarrierCount, pMemoryBarriers,
{
VkBool32 skipCall = VK_FALSE;
layer_data* dev_data = get_my_data_ptr(get_dispatch_key(commandBuffer), layer_data_map);
- GLOBAL_CB_NODE* pCB = getCBNode(dev_data, commandBuffer);
+ loader_platform_thread_lock_mutex(&globalLock);
+ GLOBAL_CB_NODE* pCB = getCBNode(dev_data, commandBuffer, false);
if (pCB) {
QueryObject query = {queryPool, slot};
pCB->activeQueries.insert(query);
skipCall |= addCmd(dev_data, pCB, CMD_BEGINQUERY, "vkCmdBeginQuery()");
}
+ loader_platform_thread_unlock_mutex(&globalLock);
if (VK_FALSE == skipCall)
dev_data->device_dispatch_table->CmdBeginQuery(commandBuffer, queryPool, slot, flags);
}
{
VkBool32 skipCall = VK_FALSE;
layer_data* dev_data = get_my_data_ptr(get_dispatch_key(commandBuffer), layer_data_map);
- GLOBAL_CB_NODE* pCB = getCBNode(dev_data, commandBuffer);
+ loader_platform_thread_lock_mutex(&globalLock);
+ GLOBAL_CB_NODE* pCB = getCBNode(dev_data, commandBuffer, false);
if (pCB) {
QueryObject query = {queryPool, slot};
if (!pCB->activeQueries.count(query)) {
skipCall |= report_error_no_cb_begin(dev_data, commandBuffer, "vkCmdEndQuery()");
}
}
+ loader_platform_thread_unlock_mutex(&globalLock);
if (VK_FALSE == skipCall)
dev_data->device_dispatch_table->CmdEndQuery(commandBuffer, queryPool, slot);
}
{
VkBool32 skipCall = VK_FALSE;
layer_data* dev_data = get_my_data_ptr(get_dispatch_key(commandBuffer), layer_data_map);
- GLOBAL_CB_NODE* pCB = getCBNode(dev_data, commandBuffer);
+ loader_platform_thread_lock_mutex(&globalLock);
+ GLOBAL_CB_NODE* pCB = getCBNode(dev_data, commandBuffer, false);
if (pCB) {
for (uint32_t i = 0; i < queryCount; i++) {
QueryObject query = {queryPool, firstQuery + i};
}
skipCall |= insideRenderPass(dev_data, pCB, "vkCmdQueryPool");
}
+ loader_platform_thread_unlock_mutex(&globalLock);
if (VK_FALSE == skipCall)
dev_data->device_dispatch_table->CmdResetQueryPool(commandBuffer, queryPool, firstQuery, queryCount);
}
{
VkBool32 skipCall = VK_FALSE;
layer_data* dev_data = get_my_data_ptr(get_dispatch_key(commandBuffer), layer_data_map);
- GLOBAL_CB_NODE* pCB = getCBNode(dev_data, commandBuffer);
+ loader_platform_thread_lock_mutex(&globalLock);
+ GLOBAL_CB_NODE* pCB = getCBNode(dev_data, commandBuffer, false);
if (pCB) {
for (uint32_t i = 0; i < queryCount; i++) {
QueryObject query = {queryPool, firstQuery + i};
}
skipCall |= insideRenderPass(dev_data, pCB, "vkCmdCopyQueryPoolResults");
}
+ loader_platform_thread_unlock_mutex(&globalLock);
if (VK_FALSE == skipCall)
dev_data->device_dispatch_table->CmdCopyQueryPoolResults(commandBuffer, queryPool,
firstQuery, queryCount, dstBuffer, dstOffset, stride, flags);
{
VkBool32 skipCall = VK_FALSE;
layer_data* dev_data = get_my_data_ptr(get_dispatch_key(commandBuffer), layer_data_map);
- GLOBAL_CB_NODE* pCB = getCBNode(dev_data, commandBuffer);
+ loader_platform_thread_lock_mutex(&globalLock);
+ GLOBAL_CB_NODE* pCB = getCBNode(dev_data, commandBuffer, false);
if (pCB) {
QueryObject query = {queryPool, slot};
pCB->queryToStateMap[query] = 1;
skipCall |= report_error_no_cb_begin(dev_data, commandBuffer, "vkCmdWriteTimestamp()");
}
}
+ loader_platform_thread_unlock_mutex(&globalLock);
if (VK_FALSE == skipCall)
dev_data->device_dispatch_table->CmdWriteTimestamp(commandBuffer, pipelineStage, queryPool, slot);
}
localFBCI->pAttachments = new VkImageView[localFBCI->attachmentCount];
memcpy((void*)localFBCI->pAttachments, pCreateInfo->pAttachments, localFBCI->attachmentCount*sizeof(VkImageView));
}
+ loader_platform_thread_lock_mutex(&globalLock);
dev_data->frameBufferMap[*pFramebuffer] = localFBCI;
+ loader_platform_thread_unlock_mutex(&globalLock);
}
return result;
}
{
VkBool32 skip_call = VK_FALSE;
layer_data* dev_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map);
+ loader_platform_thread_lock_mutex(&globalLock);
// Create DAG
std::vector<bool> has_self_dependency(pCreateInfo->subpassCount);
std::vector<DAGNode> subpass_to_node(pCreateInfo->subpassCount);
if (VK_FALSE != skip_call) {
return VK_ERROR_VALIDATION_FAILED_EXT;
}
+ loader_platform_thread_unlock_mutex(&globalLock);
VkResult result = dev_data->device_dispatch_table->CreateRenderPass(device, pCreateInfo, pAllocator, pRenderPass);
if (VK_SUCCESS == result) {
// TODOSC : Merge in tracking of renderpass from ShaderChecker
VkBool32 VerifyFramebufferAndRenderPassLayouts(VkCommandBuffer cmdBuffer, const VkRenderPassBeginInfo* pRenderPassBegin) {
VkBool32 skip_call = VK_FALSE;
layer_data* dev_data = get_my_data_ptr(get_dispatch_key(cmdBuffer), layer_data_map);
- GLOBAL_CB_NODE* pCB = getCBNode(dev_data, cmdBuffer);
+ GLOBAL_CB_NODE* pCB = getCBNode(dev_data, cmdBuffer, false);
const VkRenderPassCreateInfo* pRenderPassInfo = dev_data->renderPassMap[pRenderPassBegin->renderPass]->pCreateInfo;
const VkFramebufferCreateInfo* pFramebufferInfo = dev_data->frameBufferMap[pRenderPassBegin->framebuffer];
if (pRenderPassInfo->attachmentCount != pFramebufferInfo->attachmentCount) {
void TransitionSubpassLayouts(VkCommandBuffer cmdBuffer, const VkRenderPassBeginInfo* pRenderPassBegin, const int subpass_index) {
layer_data* dev_data = get_my_data_ptr(get_dispatch_key(cmdBuffer), layer_data_map);
- GLOBAL_CB_NODE* pCB = getCBNode(dev_data, cmdBuffer);
+ GLOBAL_CB_NODE* pCB = getCBNode(dev_data, cmdBuffer, false);
auto render_pass_data = dev_data->renderPassMap.find(pRenderPassBegin->renderPass);
if (render_pass_data == dev_data->renderPassMap.end()) {
return;
void TransitionFinalSubpassLayouts(VkCommandBuffer cmdBuffer, const VkRenderPassBeginInfo* pRenderPassBegin) {
layer_data* dev_data = get_my_data_ptr(get_dispatch_key(cmdBuffer), layer_data_map);
- GLOBAL_CB_NODE* pCB = getCBNode(dev_data, cmdBuffer);
+ GLOBAL_CB_NODE* pCB = getCBNode(dev_data, cmdBuffer, false);
auto render_pass_data = dev_data->renderPassMap.find(pRenderPassBegin->renderPass);
if (render_pass_data == dev_data->renderPassMap.end()) {
return;
{
VkBool32 skipCall = VK_FALSE;
layer_data* dev_data = get_my_data_ptr(get_dispatch_key(commandBuffer), layer_data_map);
- GLOBAL_CB_NODE* pCB = getCBNode(dev_data, commandBuffer);
+ loader_platform_thread_lock_mutex(&globalLock);
+ GLOBAL_CB_NODE* pCB = getCBNode(dev_data, commandBuffer, false);
if (pCB) {
if (pRenderPassBegin && pRenderPassBegin->renderPass) {
skipCall |= VerifyFramebufferAndRenderPassLayouts(commandBuffer, pRenderPassBegin);
"You cannot use a NULL RenderPass object in vkCmdBeginRenderPass()");
}
}
+ loader_platform_thread_unlock_mutex(&globalLock);
if (VK_FALSE == skipCall) {
dev_data->device_dispatch_table->CmdBeginRenderPass(commandBuffer, pRenderPassBegin, contents);
+ loader_platform_thread_lock_mutex(&globalLock);
// This is a shallow copy as that is all that is needed for now
dev_data->renderPassBeginInfo = *pRenderPassBegin;
dev_data->currentSubpass = 0;
+ loader_platform_thread_unlock_mutex(&globalLock);
}
}
{
VkBool32 skipCall = VK_FALSE;
layer_data* dev_data = get_my_data_ptr(get_dispatch_key(commandBuffer), layer_data_map);
- GLOBAL_CB_NODE* pCB = getCBNode(dev_data, commandBuffer);
+ loader_platform_thread_lock_mutex(&globalLock);
+ GLOBAL_CB_NODE* pCB = getCBNode(dev_data, commandBuffer, false);
TransitionSubpassLayouts(commandBuffer, &dev_data->renderPassBeginInfo, ++dev_data->currentSubpass);
if (pCB) {
skipCall |= validatePrimaryCommandBuffer(dev_data, pCB, "vkCmdNextSubpass");
}
skipCall |= outsideRenderPass(dev_data, pCB, "vkCmdNextSubpass");
}
+ loader_platform_thread_unlock_mutex(&globalLock);
if (VK_FALSE == skipCall)
dev_data->device_dispatch_table->CmdNextSubpass(commandBuffer, contents);
}
{
VkBool32 skipCall = VK_FALSE;
layer_data* dev_data = get_my_data_ptr(get_dispatch_key(commandBuffer), layer_data_map);
- GLOBAL_CB_NODE* pCB = getCBNode(dev_data, commandBuffer);
+ loader_platform_thread_lock_mutex(&globalLock);
+ GLOBAL_CB_NODE* pCB = getCBNode(dev_data, commandBuffer, false);
TransitionFinalSubpassLayouts(commandBuffer, &dev_data->renderPassBeginInfo);
if (pCB) {
skipCall |= outsideRenderPass(dev_data, pCB, "vkCmdEndRenderpass");
pCB->activeRenderPass = 0;
pCB->activeSubpass = 0;
}
+ loader_platform_thread_unlock_mutex(&globalLock);
if (VK_FALSE == skipCall)
dev_data->device_dispatch_table->CmdEndRenderPass(commandBuffer);
}
{
VkBool32 skipCall = VK_FALSE;
layer_data* dev_data = get_my_data_ptr(get_dispatch_key(commandBuffer), layer_data_map);
- GLOBAL_CB_NODE* pCB = getCBNode(dev_data, commandBuffer);
+ loader_platform_thread_lock_mutex(&globalLock);
+ GLOBAL_CB_NODE* pCB = getCBNode(dev_data, commandBuffer, false);
if (pCB) {
GLOBAL_CB_NODE* pSubCB = NULL;
for (uint32_t i=0; i<commandBuffersCount; i++) {
- pSubCB = getCBNode(dev_data, pCommandBuffers[i]);
+ pSubCB = getCBNode(dev_data, pCommandBuffers[i], false);
if (!pSubCB) {
skipCall |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT) 0, 0, __LINE__, DRAWSTATE_INVALID_SECONDARY_COMMAND_BUFFER, "DS",
"vkCmdExecuteCommands() called w/ invalid Cmd Buffer %p in element %u of pCommandBuffers array.", (void*)pCommandBuffers[i], i);
skipCall |= validatePrimaryCommandBuffer(dev_data, pCB, "vkCmdExecuteComands");
skipCall |= addCmd(dev_data, pCB, CMD_EXECUTECOMMANDS, "vkCmdExecuteComands()");
}
+ loader_platform_thread_unlock_mutex(&globalLock);
if (VK_FALSE == skipCall)
dev_data->device_dispatch_table->CmdExecuteCommands(commandBuffer, commandBuffersCount, pCommandBuffers);
}
VkBool32 skip_call = VK_FALSE;
#ifndef DISABLE_IMAGE_LAYOUT_VALIDATION
+ loader_platform_thread_lock_mutex(&globalLock);
skip_call = ValidateMapImageLayouts(device, mem);
+ loader_platform_thread_unlock_mutex(&globalLock);
#endif // DISABLE_IMAGE_LAYOUT_VALIDATION
if (VK_FALSE == skip_call) {
VKAPI_ATTR VkResult VKAPI_CALL vkSetEvent(VkDevice device, VkEvent event) {
layer_data* dev_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map);
+ loader_platform_thread_lock_mutex(&globalLock);
dev_data->eventMap[event].needsSignaled = false;
+ loader_platform_thread_unlock_mutex(&globalLock);
VkResult result = dev_data->device_dispatch_table->SetEvent(device, event);
return result;
}
layer_data* dev_data = get_my_data_ptr(get_dispatch_key(queue), layer_data_map);
VkBool32 skip_call = VK_FALSE;
+ loader_platform_thread_lock_mutex(&globalLock);
for (uint32_t bindIdx=0; bindIdx < bindInfoCount; ++bindIdx) {
const VkBindSparseInfo& bindInfo = pBindInfo[bindIdx];
for (uint32_t i=0; i < bindInfo.waitSemaphoreCount; ++i) {
dev_data->semaphoreSignaledMap[bindInfo.pSignalSemaphores[i]] = 1;
}
}
+ loader_platform_thread_unlock_mutex(&globalLock);
if (VK_FALSE == skip_call)
return dev_data->device_dispatch_table->QueueBindSparse(queue, bindInfoCount, pBindInfo, fence);
layer_data* dev_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map);
VkResult result = dev_data->device_dispatch_table->CreateSemaphore(device, pCreateInfo, pAllocator, pSemaphore);
if (result == VK_SUCCESS) {
+ loader_platform_thread_lock_mutex(&globalLock);
dev_data->semaphoreSignaledMap[*pSemaphore] = 0;
+ loader_platform_thread_unlock_mutex(&globalLock);
}
return result;
}
dev_data->device_extensions.swapchainMap.erase(swapchain);
}
loader_platform_thread_unlock_mutex(&globalLock);
- return dev_data->device_dispatch_table->DestroySwapchainKHR(device, swapchain, pAllocator);
+ dev_data->device_dispatch_table->DestroySwapchainKHR(device, swapchain, pAllocator);
}
VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkGetSwapchainImagesKHR(
if (result == VK_SUCCESS && pSwapchainImages != NULL) {
// This should never happen and is checked by param checker.
if (!pCount) return result;
+ loader_platform_thread_lock_mutex(&globalLock);
for (uint32_t i = 0; i < *pCount; ++i) {
IMAGE_NODE* image_node = new IMAGE_NODE;
image_node->layout = VK_IMAGE_LAYOUT_UNDEFINED;
- loader_platform_thread_lock_mutex(&globalLock);
auto swapchain_node = dev_data->device_extensions.swapchainMap[swapchain];
image_node->format = swapchain_node->createInfo.imageFormat;
swapchain_node->images.push_back(pSwapchainImages[i]);
dev_data->imageLayoutMap[pSwapchainImages[i]] = image_node;
- loader_platform_thread_unlock_mutex(&globalLock);
}
+ loader_platform_thread_unlock_mutex(&globalLock);
}
return result;
}
#ifndef DISABLE_IMAGE_LAYOUT_VALIDATION
if (pPresentInfo) {
+ loader_platform_thread_lock_mutex(&globalLock);
for (uint32_t i=0; i < pPresentInfo->waitSemaphoreCount; ++i) {
if (dev_data->semaphoreSignaledMap[pPresentInfo->pWaitSemaphores[i]]) {
dev_data->semaphoreSignaledMap[pPresentInfo->pWaitSemaphores[i]] = 0;
}
}
}
+ loader_platform_thread_unlock_mutex(&globalLock);
}
#endif // DISABLE_IMAGE_LAYOUT_VALIDATION
uint32_t* pImageIndex)
{
layer_data* dev_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map);
+ loader_platform_thread_lock_mutex(&globalLock);
VkResult result = dev_data->device_dispatch_table->AcquireNextImageKHR(device, swapchain, timeout, semaphore, fence, pImageIndex);
dev_data->semaphoreSignaledMap[semaphore] = 1;
+ loader_platform_thread_unlock_mutex(&globalLock);
return result;
}
VkLayerInstanceDispatchTable *pTable = my_data->instance_dispatch_table;
VkResult res = pTable->CreateDebugReportCallbackEXT(instance, pCreateInfo, pAllocator, pMsgCallback);
if (VK_SUCCESS == res) {
+ loader_platform_thread_lock_mutex(&globalLock);
res = layer_create_msg_callback(my_data->report_data, pCreateInfo, pAllocator, pMsgCallback);
+ loader_platform_thread_unlock_mutex(&globalLock);
}
return res;
}
layer_data* my_data = get_my_data_ptr(get_dispatch_key(instance), layer_data_map);
VkLayerInstanceDispatchTable *pTable = my_data->instance_dispatch_table;
pTable->DestroyDebugReportCallbackEXT(instance, msgCallback, pAllocator);
+ loader_platform_thread_lock_mutex(&globalLock);
layer_destroy_msg_callback(my_data->report_data, msgCallback, pAllocator);
+ loader_platform_thread_unlock_mutex(&globalLock);
}
VK_LAYER_EXPORT VKAPI_ATTR void VKAPI_CALL vkDebugReportMessageEXT(
{
VkBool32 skipCall = VK_FALSE;
layer_data* dev_data = get_my_data_ptr(get_dispatch_key(commandBuffer), layer_data_map);
- GLOBAL_CB_NODE* pCB = getCBNode(dev_data, commandBuffer);
+ loader_platform_thread_lock_mutex(&globalLock);
+ GLOBAL_CB_NODE* pCB = getCBNode(dev_data, commandBuffer, false);
if (!dev_data->device_extensions.debug_marker_enabled) {
skipCall |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, (uint64_t)commandBuffer, __LINE__, DRAWSTATE_INVALID_EXTENSION, "DS",
"Attempt to use CmdDbgMarkerBegin but extension disabled!");
} else if (pCB) {
skipCall |= addCmd(dev_data, pCB, CMD_DBGMARKERBEGIN, "vkCmdDbgMarkerBegin()");
}
+ loader_platform_thread_unlock_mutex(&globalLock);
if (VK_FALSE == skipCall)
debug_marker_dispatch_table(commandBuffer)->CmdDbgMarkerBegin(commandBuffer, pMarker);
}
{
VkBool32 skipCall = VK_FALSE;
layer_data* dev_data = get_my_data_ptr(get_dispatch_key(commandBuffer), layer_data_map);
- GLOBAL_CB_NODE* pCB = getCBNode(dev_data, commandBuffer);
+ loader_platform_thread_lock_mutex(&globalLock);
+ GLOBAL_CB_NODE* pCB = getCBNode(dev_data, commandBuffer, false);
if (!dev_data->device_extensions.debug_marker_enabled) {
skipCall |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, (uint64_t)commandBuffer, __LINE__, DRAWSTATE_INVALID_EXTENSION, "DS",
"Attempt to use CmdDbgMarkerEnd but extension disabled!");
} else if (pCB) {
skipCall |= addCmd(dev_data, pCB, CMD_DBGMARKEREND, "vkCmdDbgMarkerEnd()");
}
+ loader_platform_thread_unlock_mutex(&globalLock);
if (VK_FALSE == skipCall)
debug_marker_dispatch_table(commandBuffer)->CmdDbgMarkerEnd(commandBuffer);
}