aboutsummaryrefslogtreecommitdiff
path: root/layers/core_validation.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'layers/core_validation.cpp')
-rw-r--r--layers/core_validation.cpp956
1 files changed, 465 insertions, 491 deletions
diff --git a/layers/core_validation.cpp b/layers/core_validation.cpp
index 5256cb95..16f7172d 100644
--- a/layers/core_validation.cpp
+++ b/layers/core_validation.cpp
@@ -445,10 +445,10 @@ static bool ValidateMemoryIsValid(layer_data *dev_data, VkDeviceMemory mem, uint
if (mem_info) {
if (!mem_info->bound_ranges[bound_object_handle].valid) {
return log_msg(dev_data->report_data, VK_DEBUG_REPORT_WARNING_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_MEMORY_EXT,
- reinterpret_cast<uint64_t &>(mem), __LINE__, MEMTRACK_INVALID_MEM_REGION, "MEM",
+ HandleToUint64(mem), __LINE__, MEMTRACK_INVALID_MEM_REGION, "MEM",
"%s: Cannot read invalid region of memory allocation 0x%" PRIx64 " for bound %s object 0x%" PRIx64
", please fill the memory before using.",
- functionName, reinterpret_cast<uint64_t &>(mem), object_string[type], bound_object_handle);
+ functionName, HandleToUint64(mem), object_string[type], bound_object_handle);
}
}
return false;
@@ -460,20 +460,20 @@ bool ValidateImageMemoryIsValid(layer_data *dev_data, IMAGE_STATE *image_state,
if (image_state->binding.mem == MEMTRACKER_SWAP_CHAIN_IMAGE_KEY) {
if (!image_state->valid) {
return log_msg(dev_data->report_data, VK_DEBUG_REPORT_WARNING_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_MEMORY_EXT,
- reinterpret_cast<uint64_t &>(image_state->binding.mem), __LINE__, MEMTRACK_INVALID_MEM_REGION, "MEM",
+ HandleToUint64(image_state->binding.mem), __LINE__, MEMTRACK_INVALID_MEM_REGION, "MEM",
"%s: Cannot read invalid swapchain image 0x%" PRIx64 ", please fill the memory before using.",
- functionName, reinterpret_cast<uint64_t &>(image_state->image));
+ functionName, HandleToUint64(image_state->image));
}
} else {
- return ValidateMemoryIsValid(dev_data, image_state->binding.mem, reinterpret_cast<uint64_t &>(image_state->image),
- kVulkanObjectTypeImage, functionName);
+ return ValidateMemoryIsValid(dev_data, image_state->binding.mem, HandleToUint64(image_state->image), kVulkanObjectTypeImage,
+ functionName);
}
return false;
}
// For given buffer_state, verify that the range it's bound to is valid
bool ValidateBufferMemoryIsValid(layer_data *dev_data, BUFFER_STATE *buffer_state, const char *functionName) {
- return ValidateMemoryIsValid(dev_data, buffer_state->binding.mem, reinterpret_cast<uint64_t &>(buffer_state->buffer),
- kVulkanObjectTypeBuffer, functionName);
+ return ValidateMemoryIsValid(dev_data, buffer_state->binding.mem, HandleToUint64(buffer_state->buffer), kVulkanObjectTypeBuffer,
+ functionName);
}
// For the given memory allocation, set the range bound by the given handle object to the valid param value
static void SetMemoryValid(layer_data *dev_data, VkDeviceMemory mem, uint64_t handle, bool valid) {
@@ -489,19 +489,18 @@ void SetImageMemoryValid(layer_data *dev_data, IMAGE_STATE *image_state, bool va
if (image_state->binding.mem == MEMTRACKER_SWAP_CHAIN_IMAGE_KEY) {
image_state->valid = valid;
} else {
- SetMemoryValid(dev_data, image_state->binding.mem, reinterpret_cast<uint64_t &>(image_state->image), valid);
+ SetMemoryValid(dev_data, image_state->binding.mem, HandleToUint64(image_state->image), valid);
}
}
// For given buffer node set the buffer's bound memory range to valid param value
void SetBufferMemoryValid(layer_data *dev_data, BUFFER_STATE *buffer_state, bool valid) {
- SetMemoryValid(dev_data, buffer_state->binding.mem, reinterpret_cast<uint64_t &>(buffer_state->buffer), valid);
+ SetMemoryValid(dev_data, buffer_state->binding.mem, HandleToUint64(buffer_state->buffer), valid);
}
// Create binding link between given sampler and command buffer node
void AddCommandBufferBindingSampler(GLOBAL_CB_NODE *cb_node, SAMPLER_STATE *sampler_state) {
sampler_state->cb_bindings.insert(cb_node);
- cb_node->object_bindings.insert(
- {reinterpret_cast<uint64_t &>(sampler_state->sampler), kVulkanObjectTypeSampler });
+ cb_node->object_bindings.insert({HandleToUint64(sampler_state->sampler), kVulkanObjectTypeSampler});
}
// Create binding link between given image node and command buffer node
@@ -518,7 +517,7 @@ void AddCommandBufferBindingImage(const layer_data *dev_data, GLOBAL_CB_NODE *cb
}
}
// Now update cb binding for image
- cb_node->object_bindings.insert({reinterpret_cast<uint64_t &>(image_state->image), kVulkanObjectTypeImage });
+ cb_node->object_bindings.insert({HandleToUint64(image_state->image), kVulkanObjectTypeImage});
image_state->cb_bindings.insert(cb_node);
}
}
@@ -527,8 +526,7 @@ void AddCommandBufferBindingImage(const layer_data *dev_data, GLOBAL_CB_NODE *cb
void AddCommandBufferBindingImageView(const layer_data *dev_data, GLOBAL_CB_NODE *cb_node, IMAGE_VIEW_STATE *view_state) {
// First add bindings for imageView
view_state->cb_bindings.insert(cb_node);
- cb_node->object_bindings.insert(
- {reinterpret_cast<uint64_t &>(view_state->image_view), kVulkanObjectTypeImageView });
+ cb_node->object_bindings.insert({HandleToUint64(view_state->image_view), kVulkanObjectTypeImageView});
auto image_state = GetImageState(dev_data, view_state->create_info.image);
// Add bindings for image within imageView
if (image_state) {
@@ -548,7 +546,7 @@ void AddCommandBufferBindingBuffer(const layer_data *dev_data, GLOBAL_CB_NODE *c
}
}
// Now update cb binding for buffer
- cb_node->object_bindings.insert({reinterpret_cast<uint64_t &>(buffer_state->buffer), kVulkanObjectTypeBuffer });
+ cb_node->object_bindings.insert({HandleToUint64(buffer_state->buffer), kVulkanObjectTypeBuffer});
buffer_state->cb_bindings.insert(cb_node);
}
@@ -556,8 +554,7 @@ void AddCommandBufferBindingBuffer(const layer_data *dev_data, GLOBAL_CB_NODE *c
void AddCommandBufferBindingBufferView(const layer_data *dev_data, GLOBAL_CB_NODE *cb_node, BUFFER_VIEW_STATE *view_state) {
// First add bindings for bufferView
view_state->cb_bindings.insert(cb_node);
- cb_node->object_bindings.insert(
- {reinterpret_cast<uint64_t &>(view_state->buffer_view), kVulkanObjectTypeBufferView });
+ cb_node->object_bindings.insert({HandleToUint64(view_state->buffer_view), kVulkanObjectTypeBufferView});
auto buffer_state = GetBufferState(dev_data, view_state->create_info.buffer);
// Add bindings for buffer within bufferView
if (buffer_state) {
@@ -634,8 +631,8 @@ bool ValidateMemoryIsBoundToImage(const layer_data *dev_data, const IMAGE_STATE
UNIQUE_VALIDATION_ERROR_CODE error_code) {
bool result = false;
if (0 == (static_cast<uint32_t>(image_state->createInfo.flags) & VK_IMAGE_CREATE_SPARSE_BINDING_BIT)) {
- result = VerifyBoundMemoryIsValid(dev_data, image_state->binding.mem,
- reinterpret_cast<const uint64_t &>(image_state->image), api_name, "Image", error_code);
+ result = VerifyBoundMemoryIsValid(dev_data, image_state->binding.mem, HandleToUint64(image_state->image), api_name, "Image",
+ error_code);
}
return result;
}
@@ -645,8 +642,8 @@ bool ValidateMemoryIsBoundToBuffer(const layer_data *dev_data, const BUFFER_STAT
UNIQUE_VALIDATION_ERROR_CODE error_code) {
bool result = false;
if (0 == (static_cast<uint32_t>(buffer_state->createInfo.flags) & VK_BUFFER_CREATE_SPARSE_BINDING_BIT)) {
- result = VerifyBoundMemoryIsValid(dev_data, buffer_state->binding.mem,
- reinterpret_cast<const uint64_t &>(buffer_state->buffer), api_name, "Buffer", error_code);
+ result = VerifyBoundMemoryIsValid(dev_data, buffer_state->binding.mem, HandleToUint64(buffer_state->buffer), api_name,
+ "Buffer", error_code);
}
return result;
}
@@ -700,10 +697,10 @@ static bool ValidateSetMemBinding(layer_data *dev_data, VkDeviceMemory mem, uint
assert(strcmp(apiName, "vkBindImageMemory()") == 0);
}
skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_MEMORY_EXT,
- reinterpret_cast<uint64_t &>(mem), __LINE__, error_code, "MEM",
+ HandleToUint64(mem), __LINE__, error_code, "MEM",
"In %s, attempting to bind memory (0x%" PRIxLEAST64 ") to object (0x%" PRIxLEAST64
") which was created with sparse memory flags (VK_%s_CREATE_SPARSE_*_BIT). %s",
- apiName, reinterpret_cast<uint64_t &>(mem), handle, handle_type, validation_error_map[error_code]);
+ apiName, HandleToUint64(mem), handle, handle_type, validation_error_map[error_code]);
}
DEVICE_MEM_INFO *mem_info = GetMemObjInfo(dev_data, mem);
if (mem_info) {
@@ -716,18 +713,18 @@ static bool ValidateSetMemBinding(layer_data *dev_data, VkDeviceMemory mem, uint
assert(strcmp(apiName, "vkBindImageMemory()") == 0);
}
skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_MEMORY_EXT,
- reinterpret_cast<uint64_t &>(mem), __LINE__, error_code, "MEM",
+ HandleToUint64(mem), __LINE__, error_code, "MEM",
"In %s, attempting to bind memory (0x%" PRIxLEAST64 ") to object (0x%" PRIxLEAST64
") which has already been bound to mem object 0x%" PRIxLEAST64 ". %s",
- apiName, reinterpret_cast<uint64_t &>(mem), handle, reinterpret_cast<uint64_t &>(prev_binding->mem),
+ apiName, HandleToUint64(mem), handle, HandleToUint64(prev_binding->mem),
validation_error_map[error_code]);
} else if (mem_binding->binding.mem == MEMORY_UNBOUND) {
skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_MEMORY_EXT,
- reinterpret_cast<uint64_t &>(mem), __LINE__, MEMTRACK_REBIND_OBJECT, "MEM",
+ HandleToUint64(mem), __LINE__, MEMTRACK_REBIND_OBJECT, "MEM",
"In %s, attempting to bind memory (0x%" PRIxLEAST64 ") to object (0x%" PRIxLEAST64
") which was previous bound to memory that has since been freed. Memory bindings are immutable in "
"Vulkan so this attempt to bind to new memory is not allowed.",
- apiName, reinterpret_cast<uint64_t &>(mem), handle);
+ apiName, HandleToUint64(mem), handle);
}
}
}
@@ -1813,8 +1810,8 @@ static bool validate_status(layer_data *dev_data, GLOBAL_CB_NODE *pNode, CBStatu
if (!(pNode->status & status_mask)) {
char const *const message = validation_error_map[msg_code];
return log_msg(dev_data->report_data, msg_flags, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT,
- reinterpret_cast<const uint64_t &>(pNode->commandBuffer), __LINE__, msg_code, "DS",
- "command buffer object 0x%p: %s. %s.", pNode->commandBuffer, fail_msg, message);
+ HandleToUint64(pNode->commandBuffer), __LINE__, msg_code, "DS", "command buffer object 0x%p: %s. %s.",
+ pNode->commandBuffer, fail_msg, message);
}
return false;
}
@@ -2494,22 +2491,22 @@ static bool ValidatePipelineDrawtimeState(layer_data const *dev_data, LAST_BOUND
(pCB->currentDrawData.buffers[vertex_binding] == VK_NULL_HANDLE)) {
skip |=
log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT,
- reinterpret_cast<uint64_t>(pCB->commandBuffer), __LINE__, DRAWSTATE_VTX_INDEX_OUT_OF_BOUNDS, "DS",
+ HandleToUint64(pCB->commandBuffer), __LINE__, DRAWSTATE_VTX_INDEX_OUT_OF_BOUNDS, "DS",
"The Pipeline State Object (0x%" PRIxLEAST64
") expects that this Command Buffer's vertex binding Index %u "
"should be set via vkCmdBindVertexBuffers. This is because VkVertexInputBindingDescription struct "
"at index " PRINTF_SIZE_T_SPECIFIER " of pVertexBindingDescriptions has a binding value of %u.",
- (uint64_t)state.pipeline_state->pipeline, vertex_binding, i, vertex_binding);
+ HandleToUint64(state.pipeline_state->pipeline), vertex_binding, i, vertex_binding);
}
}
} else {
if (!pCB->currentDrawData.buffers.empty() && !pCB->vertex_buffer_used) {
skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_PERFORMANCE_WARNING_BIT_EXT,
- VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, reinterpret_cast<uint64_t>(pCB->commandBuffer),
- __LINE__, DRAWSTATE_VTX_INDEX_OUT_OF_BOUNDS, "DS",
+ VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, HandleToUint64(pCB->commandBuffer), __LINE__,
+ DRAWSTATE_VTX_INDEX_OUT_OF_BOUNDS, "DS",
"Vertex buffers are bound to command buffer (0x%p"
") but no vertex buffers are attached to this Pipeline State Object (0x%" PRIxLEAST64 ").",
- pCB->commandBuffer, (uint64_t)state.pipeline_state->pipeline);
+ pCB->commandBuffer, HandleToUint64(state.pipeline_state->pipeline));
}
}
// If Viewport or scissors are dynamic, verify that dynamic count matches PSO count.
@@ -2572,17 +2569,17 @@ static bool ValidatePipelineDrawtimeState(layer_data const *dev_data, LAST_BOUND
if (subpass_num_samples && static_cast<unsigned>(pso_num_samples) != subpass_num_samples) {
skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_EXT,
- reinterpret_cast<const uint64_t &>(pPipeline->pipeline), __LINE__, DRAWSTATE_NUM_SAMPLES_MISMATCH,
- "DS", "Num samples mismatch! At draw-time in Pipeline (0x%" PRIxLEAST64
- ") with %u samples while current RenderPass (0x%" PRIxLEAST64 ") w/ %u samples!",
- reinterpret_cast<const uint64_t &>(pPipeline->pipeline), pso_num_samples,
- reinterpret_cast<const uint64_t &>(pCB->activeRenderPass->renderPass), subpass_num_samples);
+ HandleToUint64(pPipeline->pipeline), __LINE__, DRAWSTATE_NUM_SAMPLES_MISMATCH, "DS",
+ "Num samples mismatch! At draw-time in Pipeline (0x%" PRIxLEAST64
+ ") with %u samples while current RenderPass (0x%" PRIxLEAST64 ") w/ %u samples!",
+ HandleToUint64(pPipeline->pipeline), pso_num_samples,
+ HandleToUint64(pCB->activeRenderPass->renderPass), subpass_num_samples);
}
} else {
skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_EXT,
- reinterpret_cast<const uint64_t &>(pPipeline->pipeline), __LINE__, DRAWSTATE_NUM_SAMPLES_MISMATCH, "DS",
+ HandleToUint64(pPipeline->pipeline), __LINE__, DRAWSTATE_NUM_SAMPLES_MISMATCH, "DS",
"No active render pass found at draw-time in Pipeline (0x%" PRIxLEAST64 ")!",
- reinterpret_cast<const uint64_t &>(pPipeline->pipeline));
+ HandleToUint64(pPipeline->pipeline));
}
}
// Verify that PSO creation renderPass is compatible with active renderPass
@@ -2593,19 +2590,18 @@ static bool ValidatePipelineDrawtimeState(layer_data const *dev_data, LAST_BOUND
err_string)) {
// renderPass that PSO was created with must be compatible with active renderPass that PSO is being used with
skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_EXT,
- reinterpret_cast<const uint64_t &>(pPipeline->pipeline), __LINE__, DRAWSTATE_RENDERPASS_INCOMPATIBLE,
- "DS", "At Draw time the active render pass (0x%" PRIxLEAST64
- ") is incompatible w/ gfx pipeline "
- "(0x%" PRIxLEAST64 ") that was created w/ render pass (0x%" PRIxLEAST64 ") due to: %s",
- reinterpret_cast<uint64_t &>(pCB->activeRenderPass->renderPass),
- reinterpret_cast<uint64_t const &>(pPipeline->pipeline),
- reinterpret_cast<const uint64_t &>(pPipeline->graphicsPipelineCI.renderPass), err_string.c_str());
+ HandleToUint64(pPipeline->pipeline), __LINE__, DRAWSTATE_RENDERPASS_INCOMPATIBLE, "DS",
+ "At Draw time the active render pass (0x%" PRIxLEAST64
+ ") is incompatible w/ gfx pipeline "
+ "(0x%" PRIxLEAST64 ") that was created w/ render pass (0x%" PRIxLEAST64 ") due to: %s",
+ HandleToUint64(pCB->activeRenderPass->renderPass), HandleToUint64(pPipeline->pipeline),
+ HandleToUint64(pPipeline->graphicsPipelineCI.renderPass), err_string.c_str());
}
if (pPipeline->graphicsPipelineCI.subpass != pCB->activeSubpass) {
skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_EXT,
- reinterpret_cast<uint64_t const &>(pPipeline->pipeline), __LINE__, DRAWSTATE_RENDERPASS_INCOMPATIBLE,
- "DS", "Pipeline was built for subpass %u but used in subpass %u", pPipeline->graphicsPipelineCI.subpass,
+ HandleToUint64(pPipeline->pipeline), __LINE__, DRAWSTATE_RENDERPASS_INCOMPATIBLE, "DS",
+ "Pipeline was built for subpass %u but used in subpass %u", pPipeline->graphicsPipelineCI.subpass,
pCB->activeSubpass);
}
}
@@ -2624,7 +2620,7 @@ static bool ValidateDrawState(layer_data *dev_data, GLOBAL_CB_NODE *cb_node, con
if (nullptr == pPipe) {
result |= log_msg(
dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT,
- reinterpret_cast<uint64_t>(cb_node->commandBuffer), __LINE__, DRAWSTATE_INVALID_PIPELINE, "DS",
+ HandleToUint64(cb_node->commandBuffer), __LINE__, DRAWSTATE_INVALID_PIPELINE, "DS",
"At Draw/Dispatch time no valid VkPipeline is bound! This is illegal. Please bind one with vkCmdBindPipeline().");
// Early return as any further checks below will be busted w/o a pipeline
if (result) return true;
@@ -2642,21 +2638,21 @@ static bool ValidateDrawState(layer_data *dev_data, GLOBAL_CB_NODE *cb_node, con
uint32_t setIndex = set_binding_pair.first;
// If valid set is not bound throw an error
if ((state.boundDescriptorSets.size() <= setIndex) || (!state.boundDescriptorSets[setIndex])) {
- result |= log_msg(
- dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT,
- reinterpret_cast<uint64_t>(cb_node->commandBuffer), __LINE__, DRAWSTATE_DESCRIPTOR_SET_NOT_BOUND, "DS",
- "VkPipeline 0x%" PRIxLEAST64 " uses set #%u but that set is not bound.", (uint64_t)pPipe->pipeline, setIndex);
+ result |=
+ log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT,
+ HandleToUint64(cb_node->commandBuffer), __LINE__, DRAWSTATE_DESCRIPTOR_SET_NOT_BOUND, "DS",
+ "VkPipeline 0x%" PRIxLEAST64 " uses set #%u but that set is not bound.",
+ HandleToUint64(pPipe->pipeline), setIndex);
} else if (!verify_set_layout_compatibility(state.boundDescriptorSets[setIndex], &pipeline_layout, setIndex,
errorString)) {
// Set is bound but not compatible w/ overlapping pipeline_layout from PSO
VkDescriptorSet setHandle = state.boundDescriptorSets[setIndex]->GetSet();
result |=
log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_SET_EXT,
- (uint64_t)setHandle, __LINE__, DRAWSTATE_PIPELINE_LAYOUTS_INCOMPATIBLE, "DS",
+ HandleToUint64(setHandle), __LINE__, DRAWSTATE_PIPELINE_LAYOUTS_INCOMPATIBLE, "DS",
"VkDescriptorSet (0x%" PRIxLEAST64
") bound as set #%u is not compatible with overlapping VkPipelineLayout 0x%" PRIxLEAST64 " due to: %s",
- reinterpret_cast<uint64_t &>(setHandle), setIndex, reinterpret_cast<uint64_t &>(pipeline_layout.layout),
- errorString.c_str());
+ HandleToUint64(setHandle), setIndex, HandleToUint64(pipeline_layout.layout), errorString.c_str());
} else { // Valid set is bound and layout compatible, validate that it's updated
// Pull the set node
cvdescriptorset::DescriptorSet *descriptor_set = state.boundDescriptorSets[setIndex];
@@ -2666,10 +2662,10 @@ static bool ValidateDrawState(layer_data *dev_data, GLOBAL_CB_NODE *cb_node, con
&err_str)) {
auto set = descriptor_set->GetSet();
result |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT,
- VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_SET_EXT, reinterpret_cast<const uint64_t &>(set),
- __LINE__, DRAWSTATE_DESCRIPTOR_SET_NOT_UPDATED, "DS",
+ VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_SET_EXT, HandleToUint64(set), __LINE__,
+ DRAWSTATE_DESCRIPTOR_SET_NOT_UPDATED, "DS",
"Descriptor set 0x%" PRIxLEAST64 " encountered the following validation error at %s time: %s",
- reinterpret_cast<const uint64_t &>(set), function, err_str.c_str());
+ HandleToUint64(set), function, err_str.c_str());
}
}
}
@@ -2743,13 +2739,13 @@ static bool verifyPipelineCreateState(layer_data *dev_data, std::vector<PIPELINE
(pPipeline->graphicsPipelineCI.basePipelineIndex != -1))) {
// This check is a superset of VALIDATION_ERROR_00526 and VALIDATION_ERROR_00528
skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_EXT,
- reinterpret_cast<uint64_t &>(pPipeline->pipeline), __LINE__, DRAWSTATE_INVALID_PIPELINE_CREATE_STATE,
- "DS", "Invalid Pipeline CreateInfo: exactly one of base pipeline index and handle must be specified");
+ HandleToUint64(pPipeline->pipeline), __LINE__, DRAWSTATE_INVALID_PIPELINE_CREATE_STATE, "DS",
+ "Invalid Pipeline CreateInfo: exactly one of base pipeline index and handle must be specified");
} else if (pPipeline->graphicsPipelineCI.basePipelineIndex != -1) {
if (pPipeline->graphicsPipelineCI.basePipelineIndex >= pipelineIndex) {
skip |=
log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_EXT,
- reinterpret_cast<uint64_t &>(pPipeline->pipeline), __LINE__, VALIDATION_ERROR_00518, "DS",
+ HandleToUint64(pPipeline->pipeline), __LINE__, VALIDATION_ERROR_00518, "DS",
"Invalid Pipeline CreateInfo: base pipeline must occur earlier in array than derivative pipeline. %s",
validation_error_map[VALIDATION_ERROR_00518]);
} else {
@@ -2761,8 +2757,8 @@ static bool verifyPipelineCreateState(layer_data *dev_data, std::vector<PIPELINE
if (pBasePipeline && !(pBasePipeline->graphicsPipelineCI.flags & VK_PIPELINE_CREATE_ALLOW_DERIVATIVES_BIT)) {
skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_EXT,
- reinterpret_cast<uint64_t &>(pPipeline->pipeline), __LINE__, DRAWSTATE_INVALID_PIPELINE_CREATE_STATE,
- "DS", "Invalid Pipeline CreateInfo: base pipeline does not allow derivatives.");
+ HandleToUint64(pPipeline->pipeline), __LINE__, DRAWSTATE_INVALID_PIPELINE_CREATE_STATE, "DS",
+ "Invalid Pipeline CreateInfo: base pipeline does not allow derivatives.");
}
}
@@ -2773,10 +2769,10 @@ static bool verifyPipelineCreateState(layer_data *dev_data, std::vector<PIPELINE
if (color_blend_state->attachmentCount != subpass_desc->colorAttachmentCount) {
skip |= log_msg(
dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_EXT,
- reinterpret_cast<const uint64_t &>(pPipeline->pipeline), __LINE__, VALIDATION_ERROR_02109, "DS",
+ HandleToUint64(pPipeline->pipeline), __LINE__, VALIDATION_ERROR_02109, "DS",
"vkCreateGraphicsPipelines(): Render pass (0x%" PRIxLEAST64
") subpass %u has colorAttachmentCount of %u which doesn't match the pColorBlendState->attachmentCount of %u. %s",
- reinterpret_cast<const uint64_t &>(pPipeline->graphicsPipelineCI.renderPass), pPipeline->graphicsPipelineCI.subpass,
+ HandleToUint64(pPipeline->graphicsPipelineCI.renderPass), pPipeline->graphicsPipelineCI.subpass,
subpass_desc->colorAttachmentCount, color_blend_state->attachmentCount,
validation_error_map[VALIDATION_ERROR_02109]);
}
@@ -2791,7 +2787,7 @@ static bool verifyPipelineCreateState(layer_data *dev_data, std::vector<PIPELINE
sizeof(pAttachments[0]))) {
skip |=
log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_EXT,
- reinterpret_cast<uint64_t &>(pPipeline->pipeline), __LINE__, VALIDATION_ERROR_01532, "DS",
+ HandleToUint64(pPipeline->pipeline), __LINE__, VALIDATION_ERROR_01532, "DS",
"Invalid Pipeline CreateInfo: If independent blend feature not "
"enabled, all elements of pAttachments must be identical. %s",
validation_error_map[VALIDATION_ERROR_01532]);
@@ -2803,7 +2799,7 @@ static bool verifyPipelineCreateState(layer_data *dev_data, std::vector<PIPELINE
if (!dev_data->enabled_features.logicOp && (pPipeline->graphicsPipelineCI.pColorBlendState->logicOpEnable != VK_FALSE)) {
skip |=
log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_EXT,
- reinterpret_cast<uint64_t &>(pPipeline->pipeline), __LINE__, VALIDATION_ERROR_01533, "DS",
+ HandleToUint64(pPipeline->pipeline), __LINE__, VALIDATION_ERROR_01533, "DS",
"Invalid Pipeline CreateInfo: If logic operations feature not enabled, logicOpEnable must be VK_FALSE. %s",
validation_error_map[VALIDATION_ERROR_01533]);
}
@@ -2815,7 +2811,7 @@ static bool verifyPipelineCreateState(layer_data *dev_data, std::vector<PIPELINE
auto renderPass = GetRenderPassState(dev_data, pPipeline->graphicsPipelineCI.renderPass);
if (renderPass && pPipeline->graphicsPipelineCI.subpass >= renderPass->createInfo.subpassCount) {
skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_EXT,
- reinterpret_cast<uint64_t &>(pPipeline->pipeline), __LINE__, VALIDATION_ERROR_02122, "DS",
+ HandleToUint64(pPipeline->pipeline), __LINE__, VALIDATION_ERROR_02122, "DS",
"Invalid Pipeline CreateInfo State: Subpass index %u "
"is out of range for this renderpass (0..%u). %s",
pPipeline->graphicsPipelineCI.subpass, renderPass->createInfo.subpassCount - 1,
@@ -2829,11 +2825,10 @@ static bool verifyPipelineCreateState(layer_data *dev_data, std::vector<PIPELINE
if (pPipeline->duplicate_shaders) {
for (uint32_t stage = VK_SHADER_STAGE_VERTEX_BIT; stage & VK_SHADER_STAGE_ALL_GRAPHICS; stage <<= 1) {
if (pPipeline->duplicate_shaders & stage) {
- skip |=
- log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_EXT,
- reinterpret_cast<uint64_t &>(pPipeline->pipeline), __LINE__, DRAWSTATE_INVALID_PIPELINE_CREATE_STATE,
- "DS", "Invalid Pipeline CreateInfo State: Multiple shaders provided for stage %s",
- string_VkShaderStageFlagBits(VkShaderStageFlagBits(stage)));
+ skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_EXT,
+ HandleToUint64(pPipeline->pipeline), __LINE__, DRAWSTATE_INVALID_PIPELINE_CREATE_STATE, "DS",
+ "Invalid Pipeline CreateInfo State: Multiple shaders provided for stage %s",
+ string_VkShaderStageFlagBits(VkShaderStageFlagBits(stage)));
}
}
}
@@ -2841,7 +2836,7 @@ static bool verifyPipelineCreateState(layer_data *dev_data, std::vector<PIPELINE
if (!(pPipeline->active_shaders & VK_SHADER_STAGE_VERTEX_BIT)) {
skip |=
log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_EXT,
- reinterpret_cast<uint64_t &>(pPipeline->pipeline), __LINE__, VALIDATION_ERROR_00532, "DS",
+ HandleToUint64(pPipeline->pipeline), __LINE__, VALIDATION_ERROR_00532, "DS",
"Invalid Pipeline CreateInfo State: Vertex Shader required. %s", validation_error_map[VALIDATION_ERROR_00532]);
}
// Either both or neither TC/TE shaders should be defined
@@ -2849,20 +2844,20 @@ static bool verifyPipelineCreateState(layer_data *dev_data, std::vector<PIPELINE
bool has_eval = (pPipeline->active_shaders & VK_SHADER_STAGE_TESSELLATION_EVALUATION_BIT) != 0;
if (has_control && !has_eval) {
skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_EXT,
- reinterpret_cast<uint64_t &>(pPipeline->pipeline), __LINE__, VALIDATION_ERROR_00534, "DS",
+ HandleToUint64(pPipeline->pipeline), __LINE__, VALIDATION_ERROR_00534, "DS",
"Invalid Pipeline CreateInfo State: TE and TC shaders must be included or excluded as a pair. %s",
validation_error_map[VALIDATION_ERROR_00534]);
}
if (!has_control && has_eval) {
skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_EXT,
- reinterpret_cast<uint64_t &>(pPipeline->pipeline), __LINE__, VALIDATION_ERROR_00535, "DS",
+ HandleToUint64(pPipeline->pipeline), __LINE__, VALIDATION_ERROR_00535, "DS",
"Invalid Pipeline CreateInfo State: TE and TC shaders must be included or excluded as a pair. %s",
validation_error_map[VALIDATION_ERROR_00535]);
}
// Compute shaders should be specified independent of Gfx shaders
if (pPipeline->active_shaders & VK_SHADER_STAGE_COMPUTE_BIT) {
skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_EXT,
- reinterpret_cast<uint64_t &>(pPipeline->pipeline), __LINE__, VALIDATION_ERROR_00533, "DS",
+ HandleToUint64(pPipeline->pipeline), __LINE__, VALIDATION_ERROR_00533, "DS",
"Invalid Pipeline CreateInfo State: Do not specify Compute Shader for Gfx Pipeline. %s",
validation_error_map[VALIDATION_ERROR_00533]);
}
@@ -2872,7 +2867,7 @@ static bool verifyPipelineCreateState(layer_data *dev_data, std::vector<PIPELINE
(!pPipeline->graphicsPipelineCI.pInputAssemblyState ||
pPipeline->graphicsPipelineCI.pInputAssemblyState->topology != VK_PRIMITIVE_TOPOLOGY_PATCH_LIST)) {
skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_EXT,
- reinterpret_cast<uint64_t &>(pPipeline->pipeline), __LINE__, VALIDATION_ERROR_02099, "DS",
+ HandleToUint64(pPipeline->pipeline), __LINE__, VALIDATION_ERROR_02099, "DS",
"Invalid Pipeline CreateInfo State: "
"VK_PRIMITIVE_TOPOLOGY_PATCH_LIST must be set as IA "
"topology for tessellation pipelines. %s",
@@ -2882,7 +2877,7 @@ static bool verifyPipelineCreateState(layer_data *dev_data, std::vector<PIPELINE
pPipeline->graphicsPipelineCI.pInputAssemblyState->topology == VK_PRIMITIVE_TOPOLOGY_PATCH_LIST) {
if (!has_control || !has_eval) {
skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_EXT,
- reinterpret_cast<uint64_t &>(pPipeline->pipeline), __LINE__, VALIDATION_ERROR_02100, "DS",
+ HandleToUint64(pPipeline->pipeline), __LINE__, VALIDATION_ERROR_02100, "DS",
"Invalid Pipeline CreateInfo State: "
"VK_PRIMITIVE_TOPOLOGY_PATCH_LIST primitive "
"topology is only valid for tessellation pipelines. %s",
@@ -2894,15 +2889,15 @@ static bool verifyPipelineCreateState(layer_data *dev_data, std::vector<PIPELINE
if (pPipeline->graphicsPipelineCI.pRasterizationState) {
// Make sure that the line width conforms to the HW.
if (!isDynamic(pPipeline, VK_DYNAMIC_STATE_LINE_WIDTH)) {
- skip |= verifyLineWidth(dev_data, DRAWSTATE_INVALID_PIPELINE_CREATE_STATE, kVulkanObjectTypePipeline,
- reinterpret_cast<uint64_t const &>(pPipeline->pipeline),
- pPipeline->graphicsPipelineCI.pRasterizationState->lineWidth);
+ skip |=
+ verifyLineWidth(dev_data, DRAWSTATE_INVALID_PIPELINE_CREATE_STATE, kVulkanObjectTypePipeline,
+ HandleToUint64(pPipeline->pipeline), pPipeline->graphicsPipelineCI.pRasterizationState->lineWidth);
}
if ((pPipeline->graphicsPipelineCI.pRasterizationState->depthClampEnable == VK_TRUE) &&
(!dev_data->enabled_features.depthClamp)) {
skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_EXT,
- reinterpret_cast<uint64_t &>(pPipeline->pipeline), __LINE__, VALIDATION_ERROR_01455, "DS",
+ HandleToUint64(pPipeline->pipeline), __LINE__, VALIDATION_ERROR_01455, "DS",
"vkCreateGraphicsPipelines(): the depthClamp device feature is disabled: the depthClampEnable "
"member of the VkPipelineRasterizationStateCreateInfo structure must be set to VK_FALSE. %s",
validation_error_map[VALIDATION_ERROR_01455]);
@@ -2912,7 +2907,7 @@ static bool verifyPipelineCreateState(layer_data *dev_data, std::vector<PIPELINE
(pPipeline->graphicsPipelineCI.pRasterizationState->depthBiasClamp != 0.0) &&
(!dev_data->enabled_features.depthBiasClamp)) {
skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_EXT,
- reinterpret_cast<uint64_t &>(pPipeline->pipeline), __LINE__, DRAWSTATE_INVALID_FEATURE, "DS",
+ HandleToUint64(pPipeline->pipeline), __LINE__, DRAWSTATE_INVALID_FEATURE, "DS",
"vkCreateGraphicsPipelines(): the depthBiasClamp device feature is disabled: the depthBiasClamp "
"member of the VkPipelineRasterizationStateCreateInfo structure must be set to 0.0 unless the "
"VK_DYNAMIC_STATE_DEPTH_BIAS dynamic state is enabled");
@@ -2925,7 +2920,7 @@ static bool verifyPipelineCreateState(layer_data *dev_data, std::vector<PIPELINE
if ((pPipeline->graphicsPipelineCI.pMultisampleState->alphaToOneEnable == VK_TRUE) &&
(!dev_data->enabled_features.alphaToOne)) {
skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_EXT,
- reinterpret_cast<uint64_t &>(pPipeline->pipeline), __LINE__, VALIDATION_ERROR_01464, "DS",
+ HandleToUint64(pPipeline->pipeline), __LINE__, VALIDATION_ERROR_01464, "DS",
"vkCreateGraphicsPipelines(): the alphaToOne device feature is disabled: the alphaToOneEnable "
"member of the VkPipelineMultisampleStateCreateInfo structure must be set to VK_FALSE. %s",
validation_error_map[VALIDATION_ERROR_01464]);
@@ -2936,7 +2931,7 @@ static bool verifyPipelineCreateState(layer_data *dev_data, std::vector<PIPELINE
subpass_desc->pDepthStencilAttachment->attachment != VK_ATTACHMENT_UNUSED) {
if (!pPipeline->graphicsPipelineCI.pDepthStencilState) {
skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_EXT,
- reinterpret_cast<uint64_t &>(pPipeline->pipeline), __LINE__, VALIDATION_ERROR_02115, "DS",
+ HandleToUint64(pPipeline->pipeline), __LINE__, VALIDATION_ERROR_02115, "DS",
"Invalid Pipeline CreateInfo State: pDepthStencilState is NULL when rasterization is "
"enabled and subpass uses a depth/stencil attachment. %s",
validation_error_map[VALIDATION_ERROR_02115]);
@@ -2945,7 +2940,7 @@ static bool verifyPipelineCreateState(layer_data *dev_data, std::vector<PIPELINE
(!dev_data->enabled_features.depthBounds)) {
skip |= log_msg(
dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_EXT,
- reinterpret_cast<uint64_t &>(pPipeline->pipeline), __LINE__, DRAWSTATE_INVALID_FEATURE, "DS",
+ HandleToUint64(pPipeline->pipeline), __LINE__, DRAWSTATE_INVALID_FEATURE, "DS",
"vkCreateGraphicsPipelines(): the depthBounds device feature is disabled: the depthBoundsTestEnable "
"member of the VkPipelineDepthStencilStateCreateInfo structure must be set to VK_FALSE.");
}
@@ -2961,7 +2956,7 @@ static bool verifyPipelineCreateState(layer_data *dev_data, std::vector<PIPELINE
}
if (color_attachment_count > 0 && pPipeline->graphicsPipelineCI.pColorBlendState == nullptr) {
skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_EXT,
- reinterpret_cast<uint64_t &>(pPipeline->pipeline), __LINE__, VALIDATION_ERROR_02116, "DS",
+ HandleToUint64(pPipeline->pipeline), __LINE__, VALIDATION_ERROR_02116, "DS",
"Invalid Pipeline CreateInfo State: pColorBlendState is NULL when rasterization is "
"enabled and subpass uses color attachments. %s",
validation_error_map[VALIDATION_ERROR_02116]);
@@ -3003,16 +2998,16 @@ static bool validateIdleDescriptorSet(const layer_data *dev_data, VkDescriptorSe
auto set_node = dev_data->setMap.find(set);
if (set_node == dev_data->setMap.end()) {
skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_SET_EXT,
- (uint64_t)(set), __LINE__, DRAWSTATE_DOUBLE_DESTROY, "DS",
+ HandleToUint64(set), __LINE__, DRAWSTATE_DOUBLE_DESTROY, "DS",
"Cannot call %s() on descriptor set 0x%" PRIxLEAST64 " that has not been allocated.", func_str.c_str(),
- (uint64_t)(set));
+ HandleToUint64(set));
} else {
// TODO : This covers various error cases so should pass error enum into this function and use passed in enum here
if (set_node->second->in_use.load()) {
skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_SET_EXT,
- (uint64_t)(set), __LINE__, VALIDATION_ERROR_00919, "DS",
+ HandleToUint64(set), __LINE__, VALIDATION_ERROR_00919, "DS",
"Cannot call %s() on descriptor set 0x%" PRIxLEAST64 " that is in use by a command buffer. %s",
- func_str.c_str(), (uint64_t)(set), validation_error_map[VALIDATION_ERROR_00919]);
+ func_str.c_str(), HandleToUint64(set), validation_error_map[VALIDATION_ERROR_00919]);
}
}
return skip;
@@ -3069,11 +3064,11 @@ bool ValidateCmdSubpassState(const layer_data *dev_data, const GLOBAL_CB_NODE *p
if (pCB->activeSubpassContents == VK_SUBPASS_CONTENTS_SECONDARY_COMMAND_BUFFERS &&
(cmd_type != CMD_EXECUTECOMMANDS && cmd_type != CMD_NEXTSUBPASS && cmd_type != CMD_ENDRENDERPASS)) {
skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT,
- reinterpret_cast<uint64_t>(pCB->commandBuffer), __LINE__, DRAWSTATE_INVALID_COMMAND_BUFFER, "DS",
+ HandleToUint64(pCB->commandBuffer), __LINE__, DRAWSTATE_INVALID_COMMAND_BUFFER, "DS",
"Commands cannot be called in a subpass using secondary command buffers.");
} else if (pCB->activeSubpassContents == VK_SUBPASS_CONTENTS_INLINE && cmd_type == CMD_EXECUTECOMMANDS) {
skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT,
- reinterpret_cast<uint64_t>(pCB->commandBuffer), __LINE__, DRAWSTATE_INVALID_COMMAND_BUFFER, "DS",
+ HandleToUint64(pCB->commandBuffer), __LINE__, DRAWSTATE_INVALID_COMMAND_BUFFER, "DS",
"vkCmdExecuteCommands() cannot be called in a subpass using inline commands.");
}
return skip;
@@ -3095,7 +3090,7 @@ bool ValidateCmdQueueFlags(layer_data *dev_data, GLOBAL_CB_NODE *cb_node, const
}
}
return log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT,
- reinterpret_cast<uint64_t>(cb_node->commandBuffer), __LINE__, error_code, "DS",
+ HandleToUint64(cb_node->commandBuffer), __LINE__, error_code, "DS",
"Cannot call %s on a command buffer allocated from a pool without %s capabilities. %s.", caller_name,
required_flags_string.c_str(), validation_error_map[error_code]);
}
@@ -3110,7 +3105,7 @@ static bool ReportInvalidCommandBuffer(layer_data *dev_data, GLOBAL_CB_NODE *cb_
// Descriptor sets are a special case that can be either destroyed or updated to invalidate a CB
const char *cause_str = (obj.type == kVulkanObjectTypeDescriptorSet) ? "destroyed or updated" : "destroyed";
skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT,
- reinterpret_cast<uint64_t &>(cb_state->commandBuffer), __LINE__, DRAWSTATE_INVALID_COMMAND_BUFFER, "DS",
+ HandleToUint64(cb_state->commandBuffer), __LINE__, DRAWSTATE_INVALID_COMMAND_BUFFER, "DS",
"You are adding %s to command buffer 0x%p that is invalid because bound %s 0x%" PRIxLEAST64 " was %s.",
call_source, cb_state->commandBuffer, type_str, obj.handle, cause_str);
}
@@ -3129,7 +3124,7 @@ bool ValidateCmd(layer_data *dev_data, GLOBAL_CB_NODE *cb_state, const CMD_TYPE
default:
return log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT,
- reinterpret_cast<uint64_t &>(cb_state->commandBuffer), __LINE__, DRAWSTATE_NO_BEGIN_COMMAND_BUFFER, "DS",
+ HandleToUint64(cb_state->commandBuffer), __LINE__, DRAWSTATE_NO_BEGIN_COMMAND_BUFFER, "DS",
"You must call vkBeginCommandBuffer() before this call to %s", caller_name);
}
}
@@ -3334,9 +3329,9 @@ bool insideRenderPass(const layer_data *dev_data, GLOBAL_CB_NODE *pCB, const cha
bool inside = false;
if (pCB->activeRenderPass) {
inside = log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT,
- (uint64_t)pCB->commandBuffer, __LINE__, msgCode, "DS",
+ HandleToUint64(pCB->commandBuffer), __LINE__, msgCode, "DS",
"%s: It is invalid to issue this call inside an active render pass (0x%" PRIxLEAST64 "). %s", apiName,
- (uint64_t)pCB->activeRenderPass->renderPass, validation_error_map[msgCode]);
+ HandleToUint64(pCB->activeRenderPass->renderPass), validation_error_map[msgCode]);
}
return inside;
}
@@ -3349,7 +3344,7 @@ bool outsideRenderPass(const layer_data *dev_data, GLOBAL_CB_NODE *pCB, const ch
((pCB->createInfo.level == VK_COMMAND_BUFFER_LEVEL_SECONDARY) && (!pCB->activeRenderPass) &&
!(pCB->beginInfo.flags & VK_COMMAND_BUFFER_USAGE_RENDER_PASS_CONTINUE_BIT))) {
outside = log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT,
- (uint64_t)pCB->commandBuffer, __LINE__, msgCode, "DS",
+ HandleToUint64(pCB->commandBuffer), __LINE__, msgCode, "DS",
"%s: This call must be issued inside an active render pass. %s", apiName, validation_error_map[msgCode]);
}
return outside;
@@ -3449,8 +3444,9 @@ static bool ValidatePhysicalDeviceQueueFamily(instance_layer_data *instance_data
if (requested_queue_family >= pd_state->queue_family_count) {
skip |= log_msg(instance_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_PHYSICAL_DEVICE_EXT,
- reinterpret_cast<uint64_t>(pd_state->phys_device), __LINE__, err_code, "DL",
- "%s: %s (= %" PRIu32 ") is not less than any previously obtained pQueueFamilyPropertyCount from "
+ HandleToUint64(pd_state->phys_device), __LINE__, err_code, "DL",
+ "%s: %s (= %" PRIu32
+ ") is not less than any previously obtained pQueueFamilyPropertyCount from "
"vkGetPhysicalDeviceQueueFamilyProperties%s (%s). %s",
cmd_name, queue_family_var_name, requested_queue_family, conditional_ext_cmd, count_note.c_str(), vu_note);
}
@@ -3487,11 +3483,13 @@ static bool ValidateDeviceQueueCreateInfos(instance_layer_data *instance_data, c
if (!queue_family_has_props ||
requested_queue_count > pd_state->queue_family_properties[requested_queue_family].queueCount) {
skip |= log_msg(instance_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT,
- VK_DEBUG_REPORT_OBJECT_TYPE_PHYSICAL_DEVICE_EXT, reinterpret_cast<uint64_t>(pd_state->phys_device),
- __LINE__, VALIDATION_ERROR_02055, "DL",
- "vkCreateDevice: pCreateInfo->pQueueCreateInfos[%" PRIu32 "].queueCount (=%" PRIu32 ") is not "
+ VK_DEBUG_REPORT_OBJECT_TYPE_PHYSICAL_DEVICE_EXT, HandleToUint64(pd_state->phys_device), __LINE__,
+ VALIDATION_ERROR_02055, "DL",
+ "vkCreateDevice: pCreateInfo->pQueueCreateInfos[%" PRIu32 "].queueCount (=%" PRIu32
+ ") is not "
"less than or equal to available queue count for this "
- "pCreateInfo->pQueueCreateInfos[%" PRIu32 "].queueFamilyIndex} (=%" PRIu32 ") obtained previously "
+ "pCreateInfo->pQueueCreateInfos[%" PRIu32 "].queueFamilyIndex} (=%" PRIu32
+ ") obtained previously "
"from vkGetPhysicalDeviceQueueFamilyProperties%s (%s). %s",
i, requested_queue_count, i, requested_queue_family, conditional_ext_cmd, count_note.c_str(),
validation_error_map[VALIDATION_ERROR_02055]);
@@ -3769,7 +3767,8 @@ static bool VerifyQueueStateToSeq(layer_data *dev_data, QUEUE_STATE *initial_que
VK_DEBUG_REPORT_OBJECT_TYPE_QUERY_POOL_EXT, 0, 0, DRAWSTATE_INVALID_QUERY, "DS",
"Cannot get query results on queryPool 0x%" PRIx64
" with index %d which was guarded by unsignaled event 0x%" PRIx64 ".",
- (uint64_t)(queryEventsPair.first.pool), queryEventsPair.first.index, (uint64_t)(event));
+ HandleToUint64(queryEventsPair.first.pool), queryEventsPair.first.index,
+ HandleToUint64(event));
}
}
}
@@ -3923,7 +3922,7 @@ static bool validateCommandBufferState(layer_data *dev_data, GLOBAL_CB_NODE *cb_
skip |= ReportInvalidCommandBuffer(dev_data, cb_state, call_source);
} else { // Flag error for using CB w/o vkEndCommandBuffer() called
skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT,
- (uint64_t)(cb_state->commandBuffer), __LINE__, DRAWSTATE_NO_END_COMMAND_BUFFER, "DS",
+ HandleToUint64(cb_state->commandBuffer), __LINE__, DRAWSTATE_NO_END_COMMAND_BUFFER, "DS",
"You must call vkEndCommandBuffer() on command buffer 0x%p before this call to %s!",
cb_state->commandBuffer, call_source);
}
@@ -3942,8 +3941,8 @@ static bool validateResources(layer_data *dev_data, GLOBAL_CB_NODE *cb_node) {
auto buffer_state = GetBufferState(dev_data, buffer);
if (!buffer_state) {
skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_BUFFER_EXT,
- (uint64_t)(buffer), __LINE__, DRAWSTATE_INVALID_BUFFER, "DS",
- "Cannot submit cmd buffer using deleted buffer 0x%" PRIx64 ".", (uint64_t)(buffer));
+ HandleToUint64(buffer), __LINE__, DRAWSTATE_INVALID_BUFFER, "DS",
+ "Cannot submit cmd buffer using deleted buffer 0x%" PRIx64 ".", HandleToUint64(buffer));
}
}
}
@@ -3965,12 +3964,11 @@ bool ValidImageBufferQueue(layer_data *dev_data, GLOBAL_CB_NODE *cb_node, const
}
if (!found) {
- skip = log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, get_debug_report_enum[object->type],
- object->handle, __LINE__, DRAWSTATE_INVALID_QUEUE_FAMILY, "DS",
- "vkQueueSubmit: Command buffer 0x%" PRIxLEAST64 " contains %s 0x%" PRIxLEAST64
- " which was not created allowing concurrent access to this queue family %d.",
- reinterpret_cast<uint64_t>(cb_node->commandBuffer), object_string[object->type], object->handle,
- queue_state->queueFamilyIndex);
+ skip = log_msg(
+ dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, get_debug_report_enum[object->type], object->handle, __LINE__,
+ DRAWSTATE_INVALID_QUEUE_FAMILY, "DS", "vkQueueSubmit: Command buffer 0x%" PRIxLEAST64 " contains %s 0x%" PRIxLEAST64
+ " which was not created allowing concurrent access to this queue family %d.",
+ HandleToUint64(cb_node->commandBuffer), object_string[object->type], object->handle, queue_state->queueFamilyIndex);
}
}
return skip;
@@ -3986,7 +3984,7 @@ static bool validateQueueFamilyIndices(layer_data *dev_data, GLOBAL_CB_NODE *pCB
if (pPool && queue_state) {
if (pPool->queueFamilyIndex != queue_state->queueFamilyIndex) {
skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT,
- reinterpret_cast<uint64_t>(pCB->commandBuffer), __LINE__, VALIDATION_ERROR_00139, "DS",
+ HandleToUint64(pCB->commandBuffer), __LINE__, VALIDATION_ERROR_00139, "DS",
"vkQueueSubmit: Primary command buffer 0x%p created in queue family %d is being submitted on queue "
"0x%p from queue family %d. %s",
pCB->commandBuffer, pPool->queueFamilyIndex, queue, queue_state->queueFamilyIndex,
@@ -4053,16 +4051,16 @@ static bool ValidateFenceForSubmit(layer_data *dev_data, FENCE_NODE *pFence) {
if (pFence->state == FENCE_INFLIGHT) {
// TODO: opportunities for VALIDATION_ERROR_00127, VALIDATION_ERROR_01647, VALIDATION_ERROR_01953
skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_FENCE_EXT,
- (uint64_t)(pFence->fence), __LINE__, DRAWSTATE_INVALID_FENCE, "DS",
- "Fence 0x%" PRIx64 " is already in use by another submission.", (uint64_t)(pFence->fence));
+ HandleToUint64(pFence->fence), __LINE__, DRAWSTATE_INVALID_FENCE, "DS",
+ "Fence 0x%" PRIx64 " is already in use by another submission.", HandleToUint64(pFence->fence));
}
else if (pFence->state == FENCE_RETIRED) {
// TODO: opportunities for VALIDATION_ERROR_00126, VALIDATION_ERROR_01646, VALIDATION_ERROR_01953
skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_FENCE_EXT,
- reinterpret_cast<uint64_t &>(pFence->fence), __LINE__, MEMTRACK_INVALID_FENCE_STATE, "MEM",
+ HandleToUint64(pFence->fence), __LINE__, MEMTRACK_INVALID_FENCE_STATE, "MEM",
"Fence 0x%" PRIxLEAST64 " submitted in SIGNALED state. Fences must be reset before being submitted",
- reinterpret_cast<uint64_t &>(pFence->fence));
+ HandleToUint64(pFence->fence));
}
}
@@ -4162,9 +4160,9 @@ static bool PreCallValidateQueueSubmit(layer_data *dev_data, VkQueue queue, uint
if (unsignaled_semaphores.count(semaphore) ||
(!(signaled_semaphores.count(semaphore)) && !(pSemaphore->signaled))) {
skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_SEMAPHORE_EXT,
- reinterpret_cast<const uint64_t &>(semaphore), __LINE__, DRAWSTATE_QUEUE_FORWARD_PROGRESS, "DS",
+ HandleToUint64(semaphore), __LINE__, DRAWSTATE_QUEUE_FORWARD_PROGRESS, "DS",
"Queue 0x%p is waiting on semaphore 0x%" PRIx64 " that has no way to be signaled.", queue,
- reinterpret_cast<const uint64_t &>(semaphore));
+ HandleToUint64(semaphore));
} else {
signaled_semaphores.erase(semaphore);
unsignaled_semaphores.insert(semaphore);
@@ -4177,11 +4175,10 @@ static bool PreCallValidateQueueSubmit(layer_data *dev_data, VkQueue queue, uint
if (pSemaphore) {
if (signaled_semaphores.count(semaphore) || (!(unsignaled_semaphores.count(semaphore)) && pSemaphore->signaled)) {
skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_SEMAPHORE_EXT,
- reinterpret_cast<const uint64_t &>(semaphore), __LINE__, DRAWSTATE_QUEUE_FORWARD_PROGRESS, "DS",
+ HandleToUint64(semaphore), __LINE__, DRAWSTATE_QUEUE_FORWARD_PROGRESS, "DS",
"Queue 0x%p is signaling semaphore 0x%" PRIx64
" that has already been signaled but not waited on by queue 0x%" PRIx64 ".",
- queue, reinterpret_cast<const uint64_t &>(semaphore),
- reinterpret_cast<uint64_t &>(pSemaphore->signaler.first));
+ queue, HandleToUint64(semaphore), HandleToUint64(pSemaphore->signaler.first));
} else {
unsignaled_semaphores.erase(semaphore);
signaled_semaphores.insert(semaphore);
@@ -4239,7 +4236,7 @@ static bool PreCallValidateAllocateMemory(layer_data *dev_data) {
bool skip = false;
if (dev_data->memObjMap.size() >= dev_data->phys_dev_properties.properties.limits.maxMemoryAllocationCount) {
skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT,
- reinterpret_cast<const uint64_t &>(dev_data->device), __LINE__, VALIDATION_ERROR_00611, "MEM",
+ HandleToUint64(dev_data->device), __LINE__, VALIDATION_ERROR_00611, "MEM",
"Number of currently valid memory objects is not less than the maximum allowed (%u). %s",
dev_data->phys_dev_properties.properties.limits.maxMemoryAllocationCount,
validation_error_map[VALIDATION_ERROR_00611]);
@@ -4285,7 +4282,7 @@ bool ValidateObjectNotInUse(const layer_data *dev_data, BASE_NODE *obj_node, VK_
static bool PreCallValidateFreeMemory(layer_data *dev_data, VkDeviceMemory mem, DEVICE_MEM_INFO **mem_info, VK_OBJECT *obj_struct) {
*mem_info = GetMemObjInfo(dev_data, mem);
- *obj_struct = {reinterpret_cast<uint64_t &>(mem), kVulkanObjectTypeDeviceMemory};
+ *obj_struct = {HandleToUint64(mem), kVulkanObjectTypeDeviceMemory};
if (dev_data->instance_data->disabled.free_memory) return false;
bool skip = false;
if (*mem_info) {
@@ -4299,7 +4296,7 @@ static void PostCallRecordFreeMemory(layer_data *dev_data, VkDeviceMemory mem, D
for (auto obj : mem_info->obj_bindings) {
log_msg(dev_data->report_data, VK_DEBUG_REPORT_INFORMATION_BIT_EXT, get_debug_report_enum[obj.type], obj.handle, __LINE__,
MEMTRACK_FREED_MEM_REF, "MEM", "VK Object 0x%" PRIxLEAST64 " still has a reference to mem obj 0x%" PRIxLEAST64,
- obj.handle, (uint64_t)mem_info->mem);
+ obj.handle, HandleToUint64(mem_info->mem));
switch (obj.type) {
case kVulkanObjectTypeImage: {
auto image_state = GetImageState(dev_data, reinterpret_cast<VkImage &>(obj.handle));
@@ -4348,7 +4345,7 @@ static bool ValidateMapMemRange(layer_data *dev_data, VkDeviceMemory mem, VkDevi
if (size == 0) {
skip = log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_MEMORY_EXT,
- (uint64_t)mem, __LINE__, MEMTRACK_INVALID_MAP, "MEM",
+ HandleToUint64(mem), __LINE__, MEMTRACK_INVALID_MAP, "MEM",
"VkMapMemory: Attempting to map memory range of size zero");
}
@@ -4357,16 +4354,17 @@ static bool ValidateMapMemRange(layer_data *dev_data, VkDeviceMemory mem, VkDevi
auto mem_info = mem_element->second.get();
// It is an application error to call VkMapMemory on an object that is already mapped
if (mem_info->mem_range.size != 0) {
- skip = log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_MEMORY_EXT,
- (uint64_t)mem, __LINE__, MEMTRACK_INVALID_MAP, "MEM",
- "VkMapMemory: Attempting to map memory on an already-mapped object 0x%" PRIxLEAST64, (uint64_t)mem);
+ skip =
+ log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_MEMORY_EXT,
+ HandleToUint64(mem), __LINE__, MEMTRACK_INVALID_MAP, "MEM",
+ "VkMapMemory: Attempting to map memory on an already-mapped object 0x%" PRIxLEAST64, HandleToUint64(mem));
}
// Validate that offset + size is within object's allocationSize
if (size == VK_WHOLE_SIZE) {
if (offset >= mem_info->alloc_info.allocationSize) {
skip = log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_MEMORY_EXT,
- (uint64_t)mem, __LINE__, MEMTRACK_INVALID_MAP, "MEM",
+ HandleToUint64(mem), __LINE__, MEMTRACK_INVALID_MAP, "MEM",
"Mapping Memory from 0x%" PRIx64 " to 0x%" PRIx64
" with size of VK_WHOLE_SIZE oversteps total array size 0x%" PRIx64,
offset, mem_info->alloc_info.allocationSize, mem_info->alloc_info.allocationSize);
@@ -4374,7 +4372,7 @@ static bool ValidateMapMemRange(layer_data *dev_data, VkDeviceMemory mem, VkDevi
} else {
if ((offset + size) > mem_info->alloc_info.allocationSize) {
skip = log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_MEMORY_EXT,
- (uint64_t)mem, __LINE__, VALIDATION_ERROR_00628, "MEM",
+ HandleToUint64(mem), __LINE__, VALIDATION_ERROR_00628, "MEM",
"Mapping Memory from 0x%" PRIx64 " to 0x%" PRIx64 " oversteps total array size 0x%" PRIx64 ". %s",
offset, size + offset, mem_info->alloc_info.allocationSize,
validation_error_map[VALIDATION_ERROR_00628]);
@@ -4399,8 +4397,8 @@ static bool deleteMemRanges(layer_data *dev_data, VkDeviceMemory mem) {
if (!mem_info->mem_range.size) {
// Valid Usage: memory must currently be mapped
skip = log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_MEMORY_EXT,
- (uint64_t)mem, __LINE__, VALIDATION_ERROR_00649, "MEM",
- "Unmapping Memory without memory being mapped: mem obj 0x%" PRIxLEAST64 ". %s", (uint64_t)mem,
+ HandleToUint64(mem), __LINE__, VALIDATION_ERROR_00649, "MEM",
+ "Unmapping Memory without memory being mapped: mem obj 0x%" PRIxLEAST64 ". %s", HandleToUint64(mem),
validation_error_map[VALIDATION_ERROR_00649]);
}
mem_info->mem_range.size = 0;
@@ -4463,11 +4461,11 @@ static inline bool verifyWaitFenceState(layer_data *dev_data, VkFence fence, con
if (pFence) {
if (pFence->state == FENCE_UNSIGNALED) {
skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_WARNING_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_FENCE_EXT,
- reinterpret_cast<uint64_t &>(fence), __LINE__, MEMTRACK_INVALID_FENCE_STATE, "MEM",
+ HandleToUint64(fence), __LINE__, MEMTRACK_INVALID_FENCE_STATE, "MEM",
"%s called for fence 0x%" PRIxLEAST64
" which has not been submitted on a Queue or during "
"acquire next image.",
- apiCall, reinterpret_cast<uint64_t &>(fence));
+ apiCall, HandleToUint64(fence));
}
}
return skip;
@@ -4626,14 +4624,14 @@ VKAPI_ATTR VkResult VKAPI_CALL DeviceWaitIdle(VkDevice device) {
static bool PreCallValidateDestroyFence(layer_data *dev_data, VkFence fence, FENCE_NODE **fence_node, VK_OBJECT *obj_struct) {
*fence_node = GetFenceNode(dev_data, fence);
- *obj_struct = {reinterpret_cast<uint64_t &>(fence), kVulkanObjectTypeFence};
+ *obj_struct = {HandleToUint64(fence), kVulkanObjectTypeFence};
if (dev_data->instance_data->disabled.destroy_fence) return false;
bool skip = false;
if (*fence_node) {
if ((*fence_node)->state == FENCE_INFLIGHT) {
skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_FENCE_EXT,
- (uint64_t)(fence), __LINE__, VALIDATION_ERROR_00173, "DS", "Fence 0x%" PRIx64 " is in use. %s",
- (uint64_t)(fence), validation_error_map[VALIDATION_ERROR_00173]);
+ HandleToUint64(fence), __LINE__, VALIDATION_ERROR_00173, "DS", "Fence 0x%" PRIx64 " is in use. %s",
+ HandleToUint64(fence), validation_error_map[VALIDATION_ERROR_00173]);
}
}
return skip;
@@ -4660,7 +4658,7 @@ VKAPI_ATTR void VKAPI_CALL DestroyFence(VkDevice device, VkFence fence, const Vk
static bool PreCallValidateDestroySemaphore(layer_data *dev_data, VkSemaphore semaphore, SEMAPHORE_NODE **sema_node,
VK_OBJECT *obj_struct) {
*sema_node = GetSemaphoreNode(dev_data, semaphore);
- *obj_struct = {reinterpret_cast<uint64_t &>(semaphore), kVulkanObjectTypeSemaphore};
+ *obj_struct = {HandleToUint64(semaphore), kVulkanObjectTypeSemaphore};
if (dev_data->instance_data->disabled.destroy_semaphore) return false;
bool skip = false;
if (*sema_node) {
@@ -4687,7 +4685,7 @@ VKAPI_ATTR void VKAPI_CALL DestroySemaphore(VkDevice device, VkSemaphore semapho
static bool PreCallValidateDestroyEvent(layer_data *dev_data, VkEvent event, EVENT_STATE **event_state, VK_OBJECT *obj_struct) {
*event_state = GetEventNode(dev_data, event);
- *obj_struct = {reinterpret_cast<uint64_t &>(event), kVulkanObjectTypeEvent};
+ *obj_struct = {HandleToUint64(event), kVulkanObjectTypeEvent};
if (dev_data->instance_data->disabled.destroy_event) return false;
bool skip = false;
if (*event_state) {
@@ -4720,7 +4718,7 @@ VKAPI_ATTR void VKAPI_CALL DestroyEvent(VkDevice device, VkEvent event, const Vk
static bool PreCallValidateDestroyQueryPool(layer_data *dev_data, VkQueryPool query_pool, QUERY_POOL_NODE **qp_state,
VK_OBJECT *obj_struct) {
*qp_state = GetQueryPoolNode(dev_data, query_pool);
- *obj_struct = {reinterpret_cast<uint64_t &>(query_pool), kVulkanObjectTypeQueryPool};
+ *obj_struct = {HandleToUint64(query_pool), kVulkanObjectTypeQueryPool};
if (dev_data->instance_data->disabled.destroy_query_pool) return false;
bool skip = false;
if (*qp_state) {
@@ -4776,7 +4774,7 @@ static bool PreCallValidateGetQueryPoolResults(layer_data *dev_data, VkQueryPool
skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT,
VK_DEBUG_REPORT_OBJECT_TYPE_QUERY_POOL_EXT, 0, __LINE__, DRAWSTATE_INVALID_QUERY, "DS",
"Cannot get query results on queryPool 0x%" PRIx64 " with index %d which is in flight.",
- (uint64_t)(query_pool), first_query + i);
+ HandleToUint64(query_pool), first_query + i);
}
}
// Unavailable and in flight
@@ -4792,21 +4790,21 @@ static bool PreCallValidateGetQueryPoolResults(layer_data *dev_data, VkQueryPool
skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT,
VK_DEBUG_REPORT_OBJECT_TYPE_QUERY_POOL_EXT, 0, __LINE__, DRAWSTATE_INVALID_QUERY, "DS",
"Cannot get query results on queryPool 0x%" PRIx64 " with index %d which is unavailable.",
- (uint64_t)(query_pool), first_query + i);
+ HandleToUint64(query_pool), first_query + i);
}
// Unavailable
} else if (query_state_pair != dev_data->queryToStateMap.end() && !query_state_pair->second) {
skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_QUERY_POOL_EXT, 0,
__LINE__, DRAWSTATE_INVALID_QUERY, "DS",
"Cannot get query results on queryPool 0x%" PRIx64 " with index %d which is unavailable.",
- (uint64_t)(query_pool), first_query + i);
+ HandleToUint64(query_pool), first_query + i);
// Uninitialized
} else if (query_state_pair == dev_data->queryToStateMap.end()) {
skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_QUERY_POOL_EXT, 0,
__LINE__, DRAWSTATE_INVALID_QUERY, "DS",
"Cannot get query results on queryPool 0x%" PRIx64
" with index %d as data has not been collected for this index.",
- (uint64_t)(query_pool), first_query + i);
+ HandleToUint64(query_pool), first_query + i);
}
}
}
@@ -4949,11 +4947,11 @@ static bool ValidateInsertMemoryRange(layer_data const *dev_data, uint64_t handl
if (memoryOffset >= mem_info->alloc_info.allocationSize) {
UNIQUE_VALIDATION_ERROR_CODE error_code = is_image ? VALIDATION_ERROR_00805 : VALIDATION_ERROR_00793;
skip = log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_MEMORY_EXT,
- reinterpret_cast<uint64_t &>(mem_info->mem), __LINE__, error_code, "MEM",
+ HandleToUint64(mem_info->mem), __LINE__, error_code, "MEM",
"In %s, attempting to bind memory (0x%" PRIxLEAST64 ") to object (0x%" PRIxLEAST64
"), memoryOffset=0x%" PRIxLEAST64 " must be less than the memory allocation size 0x%" PRIxLEAST64 ". %s",
- api_name, reinterpret_cast<uint64_t &>(mem_info->mem), handle, memoryOffset,
- mem_info->alloc_info.allocationSize, validation_error_map[error_code]);
+ api_name, HandleToUint64(mem_info->mem), handle, memoryOffset, mem_info->alloc_info.allocationSize,
+ validation_error_map[error_code]);
}
return skip;
@@ -5004,22 +5002,20 @@ static void InsertMemoryRange(layer_data const *dev_data, uint64_t handle, DEVIC
static bool ValidateInsertImageMemoryRange(layer_data const *dev_data, VkImage image, DEVICE_MEM_INFO *mem_info,
VkDeviceSize mem_offset, VkMemoryRequirements mem_reqs, bool is_linear,
const char *api_name) {
- return ValidateInsertMemoryRange(dev_data, reinterpret_cast<uint64_t &>(image), mem_info, mem_offset, mem_reqs, true, is_linear,
- api_name);
+ return ValidateInsertMemoryRange(dev_data, HandleToUint64(image), mem_info, mem_offset, mem_reqs, true, is_linear, api_name);
}
static void InsertImageMemoryRange(layer_data const *dev_data, VkImage image, DEVICE_MEM_INFO *mem_info, VkDeviceSize mem_offset,
VkMemoryRequirements mem_reqs, bool is_linear) {
- InsertMemoryRange(dev_data, reinterpret_cast<uint64_t &>(image), mem_info, mem_offset, mem_reqs, true, is_linear);
+ InsertMemoryRange(dev_data, HandleToUint64(image), mem_info, mem_offset, mem_reqs, true, is_linear);
}
static bool ValidateInsertBufferMemoryRange(layer_data const *dev_data, VkBuffer buffer, DEVICE_MEM_INFO *mem_info,
VkDeviceSize mem_offset, VkMemoryRequirements mem_reqs, const char *api_name) {
- return ValidateInsertMemoryRange(dev_data, reinterpret_cast<uint64_t &>(buffer), mem_info, mem_offset, mem_reqs, false, true,
- api_name);
+ return ValidateInsertMemoryRange(dev_data, HandleToUint64(buffer), mem_info, mem_offset, mem_reqs, false, true, api_name);
}
static void InsertBufferMemoryRange(layer_data const *dev_data, VkBuffer buffer, DEVICE_MEM_INFO *mem_info, VkDeviceSize mem_offset,
VkMemoryRequirements mem_reqs) {
- InsertMemoryRange(dev_data, reinterpret_cast<uint64_t &>(buffer), mem_info, mem_offset, mem_reqs, false, true);
+ InsertMemoryRange(dev_data, HandleToUint64(buffer), mem_info, mem_offset, mem_reqs, false, true);
}
// Remove MEMORY_RANGE struct for give handle from bound_ranges of mem_info
@@ -5099,11 +5095,11 @@ static bool ValidateMemoryTypes(const layer_data *dev_data, const DEVICE_MEM_INF
bool skip = false;
if (((1 << mem_info->alloc_info.memoryTypeIndex) & memory_type_bits) == 0) {
skip = log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_MEMORY_EXT,
- reinterpret_cast<const uint64_t &>(mem_info->mem), __LINE__, msgCode, "MT",
+ HandleToUint64(mem_info->mem), __LINE__, msgCode, "MT",
"%s(): MemoryRequirements->memoryTypeBits (0x%X) for this object type are not compatible with the memory "
"type (0x%X) of this memory object 0x%" PRIx64 ". %s",
- funcName, memory_type_bits, mem_info->alloc_info.memoryTypeIndex,
- reinterpret_cast<const uint64_t &>(mem_info->mem), validation_error_map[msgCode]);
+ funcName, memory_type_bits, mem_info->alloc_info.memoryTypeIndex, HandleToUint64(mem_info->mem),
+ validation_error_map[msgCode]);
}
return skip;
}
@@ -5114,7 +5110,7 @@ static bool PreCallValidateBindBufferMemory(layer_data *dev_data, VkBuffer buffe
if (buffer_state) {
std::unique_lock<std::mutex> lock(global_lock);
// Track objects tied to memory
- uint64_t buffer_handle = reinterpret_cast<uint64_t &>(buffer);
+ uint64_t buffer_handle = HandleToUint64(buffer);
skip = ValidateSetMemBinding(dev_data, mem, buffer_handle, kVulkanObjectTypeBuffer, "vkBindBufferMemory()");
if (!buffer_state->memory_requirements_checked) {
// There's not an explicit requirement in the spec to call vkGetBufferMemoryRequirements() prior to calling
@@ -5211,7 +5207,7 @@ static void PostCallRecordBindBufferMemory(layer_data *dev_data, VkBuffer buffer
}
// Track objects tied to memory
- uint64_t buffer_handle = reinterpret_cast<uint64_t &>(buffer);
+ uint64_t buffer_handle = HandleToUint64(buffer);
SetMemBinding(dev_data, mem, buffer_handle, kVulkanObjectTypeBuffer, "vkBindBufferMemory()");
buffer_state->binding.mem = mem;
@@ -5286,7 +5282,7 @@ VKAPI_ATTR void VKAPI_CALL DestroyShaderModule(VkDevice device, VkShaderModule s
static bool PreCallValidateDestroyPipeline(layer_data *dev_data, VkPipeline pipeline, PIPELINE_STATE **pipeline_state,
VK_OBJECT *obj_struct) {
*pipeline_state = getPipelineState(dev_data, pipeline);
- *obj_struct = {reinterpret_cast<uint64_t &>(pipeline), kVulkanObjectTypePipeline};
+ *obj_struct = {HandleToUint64(pipeline), kVulkanObjectTypePipeline};
if (dev_data->instance_data->disabled.destroy_pipeline) return false;
bool skip = false;
if (*pipeline_state) {
@@ -5331,7 +5327,7 @@ VKAPI_ATTR void VKAPI_CALL DestroyPipelineLayout(VkDevice device, VkPipelineLayo
static bool PreCallValidateDestroySampler(layer_data *dev_data, VkSampler sampler, SAMPLER_STATE **sampler_state,
VK_OBJECT *obj_struct) {
*sampler_state = GetSamplerState(dev_data, sampler);
- *obj_struct = {reinterpret_cast<uint64_t &>(sampler), kVulkanObjectTypeSampler};
+ *obj_struct = {HandleToUint64(sampler), kVulkanObjectTypeSampler};
if (dev_data->instance_data->disabled.destroy_sampler) return false;
bool skip = false;
if (*sampler_state) {
@@ -5378,7 +5374,7 @@ VKAPI_ATTR void VKAPI_CALL DestroyDescriptorSetLayout(VkDevice device, VkDescrip
static bool PreCallValidateDestroyDescriptorPool(layer_data *dev_data, VkDescriptorPool pool,
DESCRIPTOR_POOL_STATE **desc_pool_state, VK_OBJECT *obj_struct) {
*desc_pool_state = GetDescriptorPoolState(dev_data, pool);
- *obj_struct = {reinterpret_cast<uint64_t &>(pool), kVulkanObjectTypeDescriptorPool};
+ *obj_struct = {HandleToUint64(pool), kVulkanObjectTypeDescriptorPool};
if (dev_data->instance_data->disabled.destroy_descriptor_pool) return false;
bool skip = false;
if (*desc_pool_state) {
@@ -5426,7 +5422,7 @@ static bool checkCommandBufferInFlight(layer_data *dev_data, const GLOBAL_CB_NOD
if ((cb_node->createInfo.level != VK_COMMAND_BUFFER_LEVEL_SECONDARY) ||
(dev_data->globalInFlightCmdBuffers.count(cb_node->primaryCommandBuffer))) {
skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT,
- reinterpret_cast<const uint64_t &>(cb_node->commandBuffer), __LINE__, error_code, "DS",
+ HandleToUint64(cb_node->commandBuffer), __LINE__, error_code, "DS",
"Attempt to %s command buffer (0x%p) which is in use. %s", action, cb_node->commandBuffer,
validation_error_map[error_code]);
}
@@ -5609,9 +5605,8 @@ VKAPI_ATTR VkResult VKAPI_CALL ResetFences(VkDevice device, uint32_t fenceCount,
auto pFence = GetFenceNode(dev_data, pFences[i]);
if (pFence && pFence->state == FENCE_INFLIGHT) {
skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_FENCE_EXT,
- reinterpret_cast<const uint64_t &>(pFences[i]), __LINE__, VALIDATION_ERROR_00183, "DS",
- "Fence 0x%" PRIx64 " is in use. %s", reinterpret_cast<const uint64_t &>(pFences[i]),
- validation_error_map[VALIDATION_ERROR_00183]);
+ HandleToUint64(pFences[i]), __LINE__, VALIDATION_ERROR_00183, "DS", "Fence 0x%" PRIx64 " is in use. %s",
+ HandleToUint64(pFences[i]), validation_error_map[VALIDATION_ERROR_00183]);
}
}
lock.unlock();
@@ -5639,7 +5634,7 @@ void invalidateCommandBuffers(const layer_data *dev_data, std::unordered_set<GLO
for (auto cb_node : cb_nodes) {
if (cb_node->state == CB_RECORDING) {
log_msg(dev_data->report_data, VK_DEBUG_REPORT_WARNING_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT,
- (uint64_t)(cb_node->commandBuffer), __LINE__, DRAWSTATE_INVALID_COMMAND_BUFFER, "DS",
+ HandleToUint64(cb_node->commandBuffer), __LINE__, DRAWSTATE_INVALID_COMMAND_BUFFER, "DS",
"Invalidating a command buffer that's currently being recorded: 0x%p.", cb_node->commandBuffer);
}
cb_node->state = CB_INVALID;
@@ -5650,7 +5645,7 @@ void invalidateCommandBuffers(const layer_data *dev_data, std::unordered_set<GLO
static bool PreCallValidateDestroyFramebuffer(layer_data *dev_data, VkFramebuffer framebuffer,
FRAMEBUFFER_STATE **framebuffer_state, VK_OBJECT *obj_struct) {
*framebuffer_state = GetFramebufferState(dev_data, framebuffer);
- *obj_struct = {reinterpret_cast<uint64_t &>(framebuffer), kVulkanObjectTypeFramebuffer};
+ *obj_struct = {HandleToUint64(framebuffer), kVulkanObjectTypeFramebuffer};
if (dev_data->instance_data->disabled.destroy_framebuffer) return false;
bool skip = false;
if (*framebuffer_state) {
@@ -5684,7 +5679,7 @@ VKAPI_ATTR void VKAPI_CALL DestroyFramebuffer(VkDevice device, VkFramebuffer fra
static bool PreCallValidateDestroyRenderPass(layer_data *dev_data, VkRenderPass render_pass, RENDER_PASS_STATE **rp_state,
VK_OBJECT *obj_struct) {
*rp_state = GetRenderPassState(dev_data, render_pass);
- *obj_struct = {reinterpret_cast<uint64_t &>(render_pass), kVulkanObjectTypeRenderPass};
+ *obj_struct = {HandleToUint64(render_pass), kVulkanObjectTypeRenderPass};
if (dev_data->instance_data->disabled.destroy_renderpass) return false;
bool skip = false;
if (*rp_state) {
@@ -5925,10 +5920,10 @@ bool validate_dual_src_blend_feature(layer_data *device_data, PIPELINE_STATE *pi
(pipe_state->attachments[i].srcAlphaBlendFactor == VK_BLEND_FACTOR_ONE_MINUS_SRC1_ALPHA)) {
skip |=
log_msg(device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_EXT,
- reinterpret_cast<uint64_t &>(pipe_state->pipeline), __LINE__, DRAWSTATE_INVALID_FEATURE, "DS",
+ HandleToUint64(pipe_state->pipeline), __LINE__, DRAWSTATE_INVALID_FEATURE, "DS",
"CmdBindPipeline: vkPipeline (0x%" PRIxLEAST64 ") attachment[" PRINTF_SIZE_T_SPECIFIER
"] has a dual-source blend factor but this device feature is not enabled.",
- reinterpret_cast<uint64_t &>(pipe_state->pipeline), i);
+ HandleToUint64(pipe_state->pipeline), i);
}
}
}
@@ -6263,7 +6258,7 @@ VKAPI_ATTR VkResult VKAPI_CALL CreateDescriptorPool(VkDevice device, const VkDes
DESCRIPTOR_POOL_STATE *pNewNode = new DESCRIPTOR_POOL_STATE(*pDescriptorPool, pCreateInfo);
if (NULL == pNewNode) {
if (log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_POOL_EXT,
- (uint64_t)*pDescriptorPool, __LINE__, DRAWSTATE_OUT_OF_MEMORY, "DS",
+ HandleToUint64(*pDescriptorPool), __LINE__, DRAWSTATE_OUT_OF_MEMORY, "DS",
"Out of memory while attempting to allocate DESCRIPTOR_POOL_STATE in vkCreateDescriptorPool()"))
return VK_ERROR_VALIDATION_FAILED_EXT;
} else {
@@ -6342,7 +6337,7 @@ static bool PreCallValidateFreeDescriptorSets(const layer_data *dev_data, VkDesc
if (pool_state && !(VK_DESCRIPTOR_POOL_CREATE_FREE_DESCRIPTOR_SET_BIT & pool_state->createInfo.flags)) {
// Can't Free from a NON_FREE pool
skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_POOL_EXT,
- reinterpret_cast<uint64_t &>(pool), __LINE__, VALIDATION_ERROR_00922, "DS",
+ HandleToUint64(pool), __LINE__, VALIDATION_ERROR_00922, "DS",
"It is invalid to call vkFreeDescriptorSets() with a pool created without setting "
"VK_DESCRIPTOR_POOL_CREATE_FREE_DESCRIPTOR_SET_BIT. %s",
validation_error_map[VALIDATION_ERROR_00922]);
@@ -6461,8 +6456,7 @@ VKAPI_ATTR VkResult VKAPI_CALL AllocateCommandBuffers(VkDevice device, const VkC
// Add bindings between the given cmd buffer & framebuffer and the framebuffer's children
static void AddFramebufferBinding(layer_data *dev_data, GLOBAL_CB_NODE *cb_state, FRAMEBUFFER_STATE *fb_state) {
- addCommandBufferBinding(&fb_state->cb_bindings,
- {reinterpret_cast<uint64_t &>(fb_state->framebuffer), kVulkanObjectTypeFramebuffer},
+ addCommandBufferBinding(&fb_state->cb_bindings, {HandleToUint64(fb_state->framebuffer), kVulkanObjectTypeFramebuffer},
cb_state);
for (auto attachment : fb_state->attachments) {
auto view_state = attachment.view_state;
@@ -6471,9 +6465,8 @@ static void AddFramebufferBinding(layer_data *dev_data, GLOBAL_CB_NODE *cb_state
}
auto rp_state = GetRenderPassState(dev_data, fb_state->createInfo.renderPass);
if (rp_state) {
- addCommandBufferBinding(
- &rp_state->cb_bindings,
- {reinterpret_cast<uint64_t &>(rp_state->renderPass), kVulkanObjectTypeRenderPass}, cb_state);
+ addCommandBufferBinding(&rp_state->cb_bindings, {HandleToUint64(rp_state->renderPass), kVulkanObjectTypeRenderPass},
+ cb_state);
}
}
}
@@ -6488,7 +6481,7 @@ VKAPI_ATTR VkResult VKAPI_CALL BeginCommandBuffer(VkCommandBuffer commandBuffer,
// This implicitly resets the Cmd Buffer so make sure any fence is done and then clear memory references
if (dev_data->globalInFlightCmdBuffers.count(commandBuffer)) {
skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT,
- (uint64_t)commandBuffer, __LINE__, VALIDATION_ERROR_00103, "MEM",
+ HandleToUint64(commandBuffer), __LINE__, VALIDATION_ERROR_00103, "MEM",
"Calling vkBeginCommandBuffer() on active command buffer 0x%p before it has completed. "
"You must check command buffer fence before this call. %s",
commandBuffer, validation_error_map[VALIDATION_ERROR_00103]);
@@ -6500,7 +6493,7 @@ VKAPI_ATTR VkResult VKAPI_CALL BeginCommandBuffer(VkCommandBuffer commandBuffer,
if (!pInfo) {
skip |=
log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT,
- reinterpret_cast<uint64_t>(commandBuffer), __LINE__, VALIDATION_ERROR_00106, "DS",
+ HandleToUint64(commandBuffer), __LINE__, VALIDATION_ERROR_00106, "DS",
"vkBeginCommandBuffer(): Secondary Command Buffer (0x%p) must have inheritance info. %s", commandBuffer,
validation_error_map[VALIDATION_ERROR_00106]);
} else {
@@ -6517,15 +6510,14 @@ VKAPI_ATTR VkResult VKAPI_CALL BeginCommandBuffer(VkCommandBuffer commandBuffer,
errorString)) {
// renderPass that framebuffer was created with must be compatible with local renderPass
skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT,
- VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT,
- reinterpret_cast<uint64_t>(commandBuffer), __LINE__, VALIDATION_ERROR_00112, "DS",
+ VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, HandleToUint64(commandBuffer), __LINE__,
+ VALIDATION_ERROR_00112, "DS",
"vkBeginCommandBuffer(): Secondary Command "
"Buffer (0x%p) renderPass (0x%" PRIxLEAST64
") is incompatible w/ framebuffer "
"(0x%" PRIxLEAST64 ") w/ render pass (0x%" PRIxLEAST64 ") due to: %s. %s",
- commandBuffer, reinterpret_cast<const uint64_t &>(pInfo->renderPass),
- reinterpret_cast<const uint64_t &>(pInfo->framebuffer),
- reinterpret_cast<uint64_t &>(framebuffer->createInfo.renderPass), errorString.c_str(),
+ commandBuffer, HandleToUint64(pInfo->renderPass), HandleToUint64(pInfo->framebuffer),
+ HandleToUint64(framebuffer->createInfo.renderPass), errorString.c_str(),
validation_error_map[VALIDATION_ERROR_00112]);
}
// Connect this framebuffer and its children to this cmdBuffer
@@ -6535,8 +6527,8 @@ VKAPI_ATTR VkResult VKAPI_CALL BeginCommandBuffer(VkCommandBuffer commandBuffer,
if ((pInfo->occlusionQueryEnable == VK_FALSE || dev_data->enabled_features.occlusionQueryPrecise == VK_FALSE) &&
(pInfo->queryFlags & VK_QUERY_CONTROL_PRECISE_BIT)) {
skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT,
- VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, reinterpret_cast<uint64_t>(commandBuffer),
- __LINE__, VALIDATION_ERROR_00107, "DS",
+ VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, HandleToUint64(commandBuffer), __LINE__,
+ VALIDATION_ERROR_00107, "DS",
"vkBeginCommandBuffer(): Secondary Command Buffer (0x%p) must not have "
"VK_QUERY_CONTROL_PRECISE_BIT if occulusionQuery is disabled or the device does not "
"support precise occlusion queries. %s",
@@ -6548,7 +6540,7 @@ VKAPI_ATTR VkResult VKAPI_CALL BeginCommandBuffer(VkCommandBuffer commandBuffer,
if (renderPass) {
if (pInfo->subpass >= renderPass->createInfo.subpassCount) {
skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT,
- VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, (uint64_t)commandBuffer, __LINE__,
+ VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, HandleToUint64(commandBuffer), __LINE__,
VALIDATION_ERROR_00111, "DS",
"vkBeginCommandBuffer(): Secondary Command Buffers (0x%p) must have a subpass index (%d) "
"that is less than the number of subpasses (%d). %s",
@@ -6560,7 +6552,7 @@ VKAPI_ATTR VkResult VKAPI_CALL BeginCommandBuffer(VkCommandBuffer commandBuffer,
}
if (CB_RECORDING == cb_node->state) {
skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT,
- (uint64_t)commandBuffer, __LINE__, VALIDATION_ERROR_00103, "DS",
+ HandleToUint64(commandBuffer), __LINE__, VALIDATION_ERROR_00103, "DS",
"vkBeginCommandBuffer(): Cannot call Begin on command buffer (0x%p"
") in the RECORDING state. Must first call vkEndCommandBuffer(). %s",
commandBuffer, validation_error_map[VALIDATION_ERROR_00103]);
@@ -6570,11 +6562,11 @@ VKAPI_ATTR VkResult VKAPI_CALL BeginCommandBuffer(VkCommandBuffer commandBuffer,
if (!(VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT & pPool->createFlags)) {
skip |=
log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT,
- (uint64_t)commandBuffer, __LINE__, VALIDATION_ERROR_00105, "DS",
+ HandleToUint64(commandBuffer), __LINE__, VALIDATION_ERROR_00105, "DS",
"Call to vkBeginCommandBuffer() on command buffer (0x%p"
") attempts to implicitly reset cmdBuffer created from command pool (0x%" PRIxLEAST64
") that does NOT have the VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT bit set. %s",
- commandBuffer, (uint64_t)cmdPool, validation_error_map[VALIDATION_ERROR_00105]);
+ commandBuffer, HandleToUint64(cmdPool), validation_error_map[VALIDATION_ERROR_00105]);
}
resetCB(dev_data, commandBuffer);
}
@@ -6619,9 +6611,9 @@ VKAPI_ATTR VkResult VKAPI_CALL EndCommandBuffer(VkCommandBuffer commandBuffer) {
UpdateCmdBufferLastCmd(pCB, CMD_END);
for (auto query : pCB->activeQueries) {
skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT,
- reinterpret_cast<uint64_t>(commandBuffer), __LINE__, VALIDATION_ERROR_00124, "DS",
+ HandleToUint64(commandBuffer), __LINE__, VALIDATION_ERROR_00124, "DS",
"Ending command buffer with in progress query: queryPool 0x%" PRIx64 ", index %d. %s",
- (uint64_t)(query.pool), query.index, validation_error_map[VALIDATION_ERROR_00124]);
+ HandleToUint64(query.pool), query.index, validation_error_map[VALIDATION_ERROR_00124]);
}
}
if (!skip) {
@@ -6646,10 +6638,10 @@ VKAPI_ATTR VkResult VKAPI_CALL ResetCommandBuffer(VkCommandBuffer commandBuffer,
auto pPool = GetCommandPoolNode(dev_data, cmdPool);
if (!(VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT & pPool->createFlags)) {
skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT,
- (uint64_t)commandBuffer, __LINE__, VALIDATION_ERROR_00093, "DS",
+ HandleToUint64(commandBuffer), __LINE__, VALIDATION_ERROR_00093, "DS",
"Attempt to reset command buffer (0x%p) created from command pool (0x%" PRIxLEAST64
") that does NOT have the VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT bit set. %s",
- commandBuffer, (uint64_t)cmdPool, validation_error_map[VALIDATION_ERROR_00093]);
+ commandBuffer, HandleToUint64(cmdPool), validation_error_map[VALIDATION_ERROR_00093]);
}
skip |= checkCommandBufferInFlight(dev_data, pCB, "reset", VALIDATION_ERROR_00092);
lock.unlock();
@@ -6678,9 +6670,9 @@ VKAPI_ATTR void VKAPI_CALL CmdBindPipeline(VkCommandBuffer commandBuffer, VkPipe
if ((VK_PIPELINE_BIND_POINT_COMPUTE == pipelineBindPoint) && (cb_state->activeRenderPass)) {
skip |=
log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_EXT,
- (uint64_t)pipeline, __LINE__, DRAWSTATE_INVALID_RENDERPASS_CMD, "DS",
+ HandleToUint64(pipeline), __LINE__, DRAWSTATE_INVALID_RENDERPASS_CMD, "DS",
"Incorrectly binding compute pipeline (0x%" PRIxLEAST64 ") during active RenderPass (0x%" PRIxLEAST64 ")",
- (uint64_t)pipeline, (uint64_t)cb_state->activeRenderPass->renderPass);
+ HandleToUint64(pipeline), HandleToUint64(cb_state->activeRenderPass->renderPass));
}
// TODO: VALIDATION_ERROR_00594 VALIDATION_ERROR_00596
@@ -6692,19 +6684,17 @@ VKAPI_ATTR void VKAPI_CALL CmdBindPipeline(VkCommandBuffer commandBuffer, VkPipe
skip |= validate_dual_src_blend_feature(dev_data, pipe_state);
} else {
skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_EXT,
- (uint64_t)pipeline, __LINE__, VALIDATION_ERROR_00600, "DS",
- "Attempt to bind Pipeline 0x%" PRIxLEAST64 " that doesn't exist! %s", (uint64_t)(pipeline),
+ HandleToUint64(pipeline), __LINE__, VALIDATION_ERROR_00600, "DS",
+ "Attempt to bind Pipeline 0x%" PRIxLEAST64 " that doesn't exist! %s", HandleToUint64(pipeline),
validation_error_map[VALIDATION_ERROR_00600]);
}
- addCommandBufferBinding(&pipe_state->cb_bindings,
- {reinterpret_cast<uint64_t &>(pipeline), kVulkanObjectTypePipeline}, cb_state);
+ addCommandBufferBinding(&pipe_state->cb_bindings, {HandleToUint64(pipeline), kVulkanObjectTypePipeline}, cb_state);
if (VK_PIPELINE_BIND_POINT_GRAPHICS == pipelineBindPoint) {
// Add binding for child renderpass
auto rp_state = GetRenderPassState(dev_data, pipe_state->graphicsPipelineCI.renderPass);
if (rp_state) {
- addCommandBufferBinding(
- &rp_state->cb_bindings,
- {reinterpret_cast<uint64_t &>(rp_state->renderPass), kVulkanObjectTypeRenderPass}, cb_state);
+ addCommandBufferBinding(&rp_state->cb_bindings, {HandleToUint64(rp_state->renderPass), kVulkanObjectTypeRenderPass},
+ cb_state);
}
}
}
@@ -6758,13 +6748,13 @@ VKAPI_ATTR void VKAPI_CALL CmdSetLineWidth(VkCommandBuffer commandBuffer, float
PIPELINE_STATE *pPipeTrav = pCB->lastBound[VK_PIPELINE_BIND_POINT_GRAPHICS].pipeline_state;
if (pPipeTrav != NULL && !isDynamic(pPipeTrav, VK_DYNAMIC_STATE_LINE_WIDTH)) {
skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_WARNING_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT,
- reinterpret_cast<uint64_t>(commandBuffer), __LINE__, VALIDATION_ERROR_01476, "DS",
+ HandleToUint64(commandBuffer), __LINE__, VALIDATION_ERROR_01476, "DS",
"vkCmdSetLineWidth called but pipeline was created without VK_DYNAMIC_STATE_LINE_WIDTH "
"flag. This is undefined behavior and could be ignored. %s",
validation_error_map[VALIDATION_ERROR_01476]);
} else {
- skip |= verifyLineWidth(dev_data, DRAWSTATE_INVALID_SET, kVulkanObjectTypeCommandBuffer,
- reinterpret_cast<uint64_t &>(commandBuffer), lineWidth);
+ skip |= verifyLineWidth(dev_data, DRAWSTATE_INVALID_SET, kVulkanObjectTypeCommandBuffer, HandleToUint64(commandBuffer),
+ lineWidth);
}
}
lock.unlock();
@@ -6782,7 +6772,7 @@ VKAPI_ATTR void VKAPI_CALL CmdSetDepthBias(VkCommandBuffer commandBuffer, float
skip |= ValidateCmd(dev_data, pCB, CMD_SETDEPTHBIASSTATE, "vkCmdSetDepthBias()");
if ((depthBiasClamp != 0.0) && (!dev_data->enabled_features.depthBiasClamp)) {
skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT,
- reinterpret_cast<uint64_t>(commandBuffer), __LINE__, VALIDATION_ERROR_01482, "DS",
+ HandleToUint64(commandBuffer), __LINE__, VALIDATION_ERROR_01482, "DS",
"vkCmdSetDepthBias(): the depthBiasClamp device feature is disabled: the depthBiasClamp "
"parameter must be set to 0.0. %s",
validation_error_map[VALIDATION_ERROR_01482]);
@@ -6901,25 +6891,25 @@ VKAPI_ATTR void VKAPI_CALL CmdBindDescriptorSets(VkCommandBuffer commandBuffer,
cb_state->lastBound[pipelineBindPoint].pipeline_layout = *pipeline_layout;
cb_state->lastBound[pipelineBindPoint].boundDescriptorSets[set_idx + firstSet] = descriptor_set;
skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_INFORMATION_BIT_EXT,
- VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_SET_EXT, (uint64_t)pDescriptorSets[set_idx], __LINE__,
+ VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_SET_EXT, HandleToUint64(pDescriptorSets[set_idx]), __LINE__,
DRAWSTATE_NONE, "DS", "Descriptor Set 0x%" PRIxLEAST64 " bound on pipeline %s",
- (uint64_t)pDescriptorSets[set_idx], string_VkPipelineBindPoint(pipelineBindPoint));
+ HandleToUint64(pDescriptorSets[set_idx]), string_VkPipelineBindPoint(pipelineBindPoint));
if (!descriptor_set->IsUpdated() && (descriptor_set->GetTotalDescriptorCount() != 0)) {
skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_WARNING_BIT_EXT,
- VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_SET_EXT, (uint64_t)pDescriptorSets[set_idx], __LINE__,
- DRAWSTATE_DESCRIPTOR_SET_NOT_UPDATED, "DS",
+ VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_SET_EXT, HandleToUint64(pDescriptorSets[set_idx]),
+ __LINE__, DRAWSTATE_DESCRIPTOR_SET_NOT_UPDATED, "DS",
"Descriptor Set 0x%" PRIxLEAST64
" bound but it was never updated. You may want to either update it or not bind it.",
- (uint64_t)pDescriptorSets[set_idx]);
+ HandleToUint64(pDescriptorSets[set_idx]));
}
// Verify that set being bound is compatible with overlapping setLayout of pipelineLayout
if (!verify_set_layout_compatibility(descriptor_set, pipeline_layout, set_idx + firstSet, error_string)) {
skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT,
- VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_SET_EXT, (uint64_t)pDescriptorSets[set_idx], __LINE__,
- VALIDATION_ERROR_00974, "DS",
+ VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_SET_EXT, HandleToUint64(pDescriptorSets[set_idx]),
+ __LINE__, VALIDATION_ERROR_00974, "DS",
"descriptorSet #%u being bound is not compatible with overlapping descriptorSetLayout "
"at index %u of pipelineLayout 0x%" PRIxLEAST64 " due to: %s. %s",
- set_idx, set_idx + firstSet, reinterpret_cast<uint64_t &>(layout), error_string.c_str(),
+ set_idx, set_idx + firstSet, HandleToUint64(layout), error_string.c_str(),
validation_error_map[VALIDATION_ERROR_00974]);
}
@@ -6930,14 +6920,14 @@ VKAPI_ATTR void VKAPI_CALL CmdBindDescriptorSets(VkCommandBuffer commandBuffer,
if (set_dynamic_descriptor_count) {
// First make sure we won't overstep bounds of pDynamicOffsets array
if ((total_dynamic_descriptors + set_dynamic_descriptor_count) > dynamicOffsetCount) {
- skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT,
- VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_SET_EXT, (uint64_t)pDescriptorSets[set_idx],
- __LINE__, DRAWSTATE_INVALID_DYNAMIC_OFFSET_COUNT, "DS",
- "descriptorSet #%u (0x%" PRIxLEAST64
- ") requires %u dynamicOffsets, but only %u dynamicOffsets are left in pDynamicOffsets "
- "array. There must be one dynamic offset for each dynamic descriptor being bound.",
- set_idx, (uint64_t)pDescriptorSets[set_idx], descriptor_set->GetDynamicDescriptorCount(),
- (dynamicOffsetCount - total_dynamic_descriptors));
+ skip |= log_msg(
+ dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_SET_EXT,
+ HandleToUint64(pDescriptorSets[set_idx]), __LINE__, DRAWSTATE_INVALID_DYNAMIC_OFFSET_COUNT, "DS",
+ "descriptorSet #%u (0x%" PRIxLEAST64
+ ") requires %u dynamicOffsets, but only %u dynamicOffsets are left in pDynamicOffsets "
+ "array. There must be one dynamic offset for each dynamic descriptor being bound.",
+ set_idx, HandleToUint64(pDescriptorSets[set_idx]), descriptor_set->GetDynamicDescriptorCount(),
+ (dynamicOffsetCount - total_dynamic_descriptors));
} else { // Validate and store dynamic offsets with the set
// Validate Dynamic Offset Minimums
uint32_t cur_dyn_offset = total_dynamic_descriptors;
@@ -6981,10 +6971,11 @@ VKAPI_ATTR void VKAPI_CALL CmdBindDescriptorSets(VkCommandBuffer commandBuffer,
}
}
} else {
- skip |= log_msg(
- dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_SET_EXT,
- (uint64_t)pDescriptorSets[set_idx], __LINE__, DRAWSTATE_INVALID_SET, "DS",
- "Attempt to bind descriptor set 0x%" PRIxLEAST64 " that doesn't exist!", (uint64_t)pDescriptorSets[set_idx]);
+ skip |=
+ log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_SET_EXT,
+ HandleToUint64(pDescriptorSets[set_idx]), __LINE__, DRAWSTATE_INVALID_SET, "DS",
+ "Attempt to bind descriptor set 0x%" PRIxLEAST64 " that doesn't exist!",
+ HandleToUint64(pDescriptorSets[set_idx]));
}
UpdateCmdBufferLastCmd(cb_state, CMD_BINDDESCRIPTORSETS);
// For any previously bound sets, need to set them to "invalid" if they were disturbed by this update
@@ -6996,10 +6987,11 @@ VKAPI_ATTR void VKAPI_CALL CmdBindDescriptorSets(VkCommandBuffer commandBuffer,
skip |= log_msg(
dev_data->report_data, VK_DEBUG_REPORT_PERFORMANCE_WARNING_BIT_EXT,
VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_SET_EXT,
- (uint64_t)cb_state->lastBound[pipelineBindPoint].boundDescriptorSets[i], __LINE__, DRAWSTATE_NONE, "DS",
- "DescriptorSet 0x%" PRIxLEAST64
- " previously bound as set #%u was disturbed by newly bound pipelineLayout (0x%" PRIxLEAST64 ")",
- (uint64_t)cb_state->lastBound[pipelineBindPoint].boundDescriptorSets[i], i, (uint64_t)layout);
+ HandleToUint64(cb_state->lastBound[pipelineBindPoint].boundDescriptorSets[i]), __LINE__, DRAWSTATE_NONE,
+ "DS", "DescriptorSet 0x%" PRIxLEAST64
+ " previously bound as set #%u was disturbed by newly bound pipelineLayout (0x%" PRIxLEAST64 ")",
+ HandleToUint64(cb_state->lastBound[pipelineBindPoint].boundDescriptorSets[i]), i,
+ HandleToUint64(layout));
cb_state->lastBound[pipelineBindPoint].boundDescriptorSets[i] = VK_NULL_HANDLE;
}
}
@@ -7010,14 +7002,14 @@ VKAPI_ATTR void VKAPI_CALL CmdBindDescriptorSets(VkCommandBuffer commandBuffer,
!verify_set_layout_compatibility(old_final_bound_set, pipeline_layout, last_set_index, error_string)) {
auto old_set = old_final_bound_set->GetSet();
skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_PERFORMANCE_WARNING_BIT_EXT,
- VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_SET_EXT, reinterpret_cast<uint64_t &>(old_set), __LINE__,
+ VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_SET_EXT, HandleToUint64(old_set), __LINE__,
DRAWSTATE_NONE, "DS", "DescriptorSet 0x%" PRIxLEAST64
" previously bound as set #%u is incompatible with set 0x%" PRIxLEAST64
" newly bound as set #%u so set #%u and any subsequent sets were "
"disturbed by newly bound pipelineLayout (0x%" PRIxLEAST64 ")",
- reinterpret_cast<uint64_t &>(old_set), last_set_index,
- (uint64_t)cb_state->lastBound[pipelineBindPoint].boundDescriptorSets[last_set_index],
- last_set_index, last_set_index + 1, (uint64_t)layout);
+ HandleToUint64(old_set), last_set_index,
+ HandleToUint64(cb_state->lastBound[pipelineBindPoint].boundDescriptorSets[last_set_index]),
+ last_set_index, last_set_index + 1, HandleToUint64(layout));
cb_state->lastBound[pipelineBindPoint].boundDescriptorSets.resize(last_set_index + 1);
}
}
@@ -7025,7 +7017,7 @@ VKAPI_ATTR void VKAPI_CALL CmdBindDescriptorSets(VkCommandBuffer commandBuffer,
// dynamicOffsetCount must equal the total number of dynamic descriptors in the sets being bound
if (total_dynamic_descriptors != dynamicOffsetCount) {
skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT,
- (uint64_t)commandBuffer, __LINE__, VALIDATION_ERROR_00975, "DS",
+ HandleToUint64(commandBuffer), __LINE__, VALIDATION_ERROR_00975, "DS",
"Attempting to bind %u descriptorSets with %u dynamic descriptors, but dynamicOffsetCount "
"is %u. It should exactly match the number of dynamic descriptors. %s",
setCount, total_dynamic_descriptors, dynamicOffsetCount, validation_error_map[VALIDATION_ERROR_00975]);
@@ -7069,7 +7061,7 @@ VKAPI_ATTR void VKAPI_CALL CmdBindIndexBuffer(VkCommandBuffer commandBuffer, VkB
}
if (!offset_align || (offset % offset_align)) {
skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT,
- reinterpret_cast<uint64_t>(commandBuffer), __LINE__, DRAWSTATE_VTX_INDEX_ALIGNMENT_ERROR, "DS",
+ HandleToUint64(commandBuffer), __LINE__, DRAWSTATE_VTX_INDEX_ALIGNMENT_ERROR, "DS",
"vkCmdBindIndexBuffer() offset (0x%" PRIxLEAST64 ") does not fall on alignment (%s) boundary.", offset,
string_VkIndexType(indexType));
}
@@ -7114,7 +7106,7 @@ VKAPI_ATTR void VKAPI_CALL CmdBindVertexBuffers(VkCommandBuffer commandBuffer, u
cb_node->validate_functions.push_back(function);
if (pOffsets[i] >= buffer_state->createInfo.size) {
skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_BUFFER_EXT,
- reinterpret_cast<uint64_t &>(buffer_state->buffer), __LINE__, VALIDATION_ERROR_01417, "DS",
+ HandleToUint64(buffer_state->buffer), __LINE__, VALIDATION_ERROR_01417, "DS",
"vkCmdBindVertexBuffers() offset (0x%" PRIxLEAST64 ") is beyond the end of the buffer. %s",
pOffsets[i], validation_error_map[VALIDATION_ERROR_01417]);
}
@@ -7419,12 +7411,11 @@ bool ValidateImageSampleCount(layer_data *dev_data, IMAGE_STATE *image_state, Vk
const char *location, UNIQUE_VALIDATION_ERROR_CODE msgCode) {
bool skip = false;
if (image_state->createInfo.samples != sample_count) {
- skip =
- log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT,
- reinterpret_cast<uint64_t &>(image_state->image), 0, msgCode, "DS",
- "%s for image 0x%" PRIxLEAST64 " was created with a sample count of %s but must be %s. %s", location,
- reinterpret_cast<uint64_t &>(image_state->image), string_VkSampleCountFlagBits(image_state->createInfo.samples),
- string_VkSampleCountFlagBits(sample_count), validation_error_map[msgCode]);
+ skip = log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT,
+ HandleToUint64(image_state->image), 0, msgCode, "DS",
+ "%s for image 0x%" PRIxLEAST64 " was created with a sample count of %s but must be %s. %s", location,
+ HandleToUint64(image_state->image), string_VkSampleCountFlagBits(image_state->createInfo.samples),
+ string_VkSampleCountFlagBits(sample_count), validation_error_map[msgCode]);
}
return skip;
}
@@ -7650,8 +7641,7 @@ VKAPI_ATTR void VKAPI_CALL CmdSetEvent(VkCommandBuffer commandBuffer, VkEvent ev
ValidateStageMaskGsTsEnables(dev_data, stageMask, "vkCmdSetEvent()", VALIDATION_ERROR_00230, VALIDATION_ERROR_00231);
auto event_state = GetEventNode(dev_data, event);
if (event_state) {
- addCommandBufferBinding(&event_state->cb_bindings,
- {reinterpret_cast<uint64_t &>(event), kVulkanObjectTypeEvent}, pCB);
+ addCommandBufferBinding(&event_state->cb_bindings, {HandleToUint64(event), kVulkanObjectTypeEvent}, pCB);
event_state->cb_bindings.insert(pCB);
}
pCB->events.push_back(event);
@@ -7681,8 +7671,7 @@ VKAPI_ATTR void VKAPI_CALL CmdResetEvent(VkCommandBuffer commandBuffer, VkEvent
ValidateStageMaskGsTsEnables(dev_data, stageMask, "vkCmdResetEvent()", VALIDATION_ERROR_00240, VALIDATION_ERROR_00241);
auto event_state = GetEventNode(dev_data, event);
if (event_state) {
- addCommandBufferBinding(&event_state->cb_bindings,
- {reinterpret_cast<uint64_t &>(event), kVulkanObjectTypeEvent}, pCB);
+ addCommandBufferBinding(&event_state->cb_bindings, {HandleToUint64(event), kVulkanObjectTypeEvent}, pCB);
event_state->cb_bindings.insert(pCB);
}
pCB->events.push_back(event);
@@ -7708,7 +7697,7 @@ static bool ValidateBarriers(const char *funcName, VkCommandBuffer cmdBuffer, ui
if (pCB->activeRenderPass && memBarrierCount) {
if (!pCB->activeRenderPass->hasSelfDependency[pCB->activeSubpass]) {
skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT,
- reinterpret_cast<uint64_t>(cmdBuffer), __LINE__, DRAWSTATE_INVALID_BARRIER, "DS",
+ HandleToUint64(cmdBuffer), __LINE__, DRAWSTATE_INVALID_BARRIER, "DS",
"%s: Barriers cannot be set during subpass %d "
"with no self dependency specified.",
funcName, pCB->activeSubpass);
@@ -7725,13 +7714,12 @@ static bool ValidateBarriers(const char *funcName, VkCommandBuffer cmdBuffer, ui
// be VK_QUEUE_FAMILY_IGNORED
if ((src_q_f_index != VK_QUEUE_FAMILY_IGNORED) || (dst_q_f_index != VK_QUEUE_FAMILY_IGNORED)) {
skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT,
- VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, reinterpret_cast<uint64_t>(cmdBuffer), __LINE__,
- DRAWSTATE_INVALID_QUEUE_INDEX, "DS",
- "%s: Image Barrier for image 0x%" PRIx64
- " was created with sharingMode of "
- "VK_SHARING_MODE_CONCURRENT. Src and dst "
- "queueFamilyIndices must be VK_QUEUE_FAMILY_IGNORED.",
- funcName, reinterpret_cast<const uint64_t &>(mem_barrier->image));
+ VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, HandleToUint64(cmdBuffer), __LINE__,
+ DRAWSTATE_INVALID_QUEUE_INDEX, "DS", "%s: Image Barrier for image 0x%" PRIx64
+ " was created with sharingMode of "
+ "VK_SHARING_MODE_CONCURRENT. Src and dst "
+ "queueFamilyIndices must be VK_QUEUE_FAMILY_IGNORED.",
+ funcName, HandleToUint64(mem_barrier->image));
}
} else {
// Sharing mode is VK_SHARING_MODE_EXCLUSIVE. srcQueueFamilyIndex and
@@ -7740,26 +7728,25 @@ static bool ValidateBarriers(const char *funcName, VkCommandBuffer cmdBuffer, ui
if (((src_q_f_index == VK_QUEUE_FAMILY_IGNORED) || (dst_q_f_index == VK_QUEUE_FAMILY_IGNORED)) &&
(src_q_f_index != dst_q_f_index)) {
skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT,
- VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, reinterpret_cast<uint64_t>(cmdBuffer), __LINE__,
- DRAWSTATE_INVALID_QUEUE_INDEX, "DS",
- "%s: Image 0x%" PRIx64
- " was created with sharingMode "
- "of VK_SHARING_MODE_EXCLUSIVE. If one of src- or "
- "dstQueueFamilyIndex is VK_QUEUE_FAMILY_IGNORED, both "
- "must be.",
- funcName, reinterpret_cast<const uint64_t &>(mem_barrier->image));
+ VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, HandleToUint64(cmdBuffer), __LINE__,
+ DRAWSTATE_INVALID_QUEUE_INDEX, "DS", "%s: Image 0x%" PRIx64
+ " was created with sharingMode "
+ "of VK_SHARING_MODE_EXCLUSIVE. If one of src- or "
+ "dstQueueFamilyIndex is VK_QUEUE_FAMILY_IGNORED, both "
+ "must be.",
+ funcName, HandleToUint64(mem_barrier->image));
} else if (((src_q_f_index != VK_QUEUE_FAMILY_IGNORED) && (dst_q_f_index != VK_QUEUE_FAMILY_IGNORED)) &&
((src_q_f_index >= dev_data->phys_dev_properties.queue_family_properties.size()) ||
(dst_q_f_index >= dev_data->phys_dev_properties.queue_family_properties.size()))) {
skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT,
- VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, reinterpret_cast<uint64_t>(cmdBuffer), __LINE__,
+ VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, HandleToUint64(cmdBuffer), __LINE__,
DRAWSTATE_INVALID_QUEUE_INDEX, "DS",
"%s: Image 0x%" PRIx64
" was created with sharingMode "
"of VK_SHARING_MODE_EXCLUSIVE, but srcQueueFamilyIndex %d"
" or dstQueueFamilyIndex %d is greater than " PRINTF_SIZE_T_SPECIFIER
"queueFamilies crated for this device.",
- funcName, reinterpret_cast<const uint64_t &>(mem_barrier->image), src_q_f_index, dst_q_f_index,
+ funcName, HandleToUint64(mem_barrier->image), src_q_f_index, dst_q_f_index,
dev_data->phys_dev_properties.queue_family_properties.size());
}
}
@@ -7767,21 +7754,21 @@ static bool ValidateBarriers(const char *funcName, VkCommandBuffer cmdBuffer, ui
if (mem_barrier->oldLayout != mem_barrier->newLayout) {
if (pCB->activeRenderPass) {
- skip |= log_msg(
- dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT,
- reinterpret_cast<uint64_t>(cmdBuffer), __LINE__, VALIDATION_ERROR_02080, "DS",
- "%s: As the Image Barrier for image 0x%" PRIx64
- " is being executed within a render pass instance, oldLayout must equal newLayout yet they are "
- "%s and %s. %s",
- funcName, reinterpret_cast<const uint64_t &>(mem_barrier->image), string_VkImageLayout(mem_barrier->oldLayout),
- string_VkImageLayout(mem_barrier->newLayout), validation_error_map[VALIDATION_ERROR_02080]);
+ skip |=
+ log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT,
+ HandleToUint64(cmdBuffer), __LINE__, VALIDATION_ERROR_02080, "DS",
+ "%s: As the Image Barrier for image 0x%" PRIx64
+ " is being executed within a render pass instance, oldLayout must equal newLayout yet they are "
+ "%s and %s. %s",
+ funcName, HandleToUint64(mem_barrier->image), string_VkImageLayout(mem_barrier->oldLayout),
+ string_VkImageLayout(mem_barrier->newLayout), validation_error_map[VALIDATION_ERROR_02080]);
}
skip |= ValidateMaskBitsFromLayouts(dev_data, cmdBuffer, mem_barrier->srcAccessMask, mem_barrier->oldLayout, "Source");
skip |= ValidateMaskBitsFromLayouts(dev_data, cmdBuffer, mem_barrier->dstAccessMask, mem_barrier->newLayout, "Dest");
}
if (mem_barrier->newLayout == VK_IMAGE_LAYOUT_UNDEFINED || mem_barrier->newLayout == VK_IMAGE_LAYOUT_PREINITIALIZED) {
skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT,
- reinterpret_cast<uint64_t>(cmdBuffer), __LINE__, DRAWSTATE_INVALID_BARRIER, "DS",
+ HandleToUint64(cmdBuffer), __LINE__, DRAWSTATE_INVALID_BARRIER, "DS",
"%s: Image Layout cannot be transitioned to UNDEFINED or "
"PREINITIALIZED.",
funcName);
@@ -7795,7 +7782,7 @@ static bool ValidateBarriers(const char *funcName, VkCommandBuffer cmdBuffer, ui
if ((mem_barrier->subresourceRange.baseArrayLayer + layer_count) > image_data->createInfo.arrayLayers) {
skip |= log_msg(
dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT,
- reinterpret_cast<uint64_t>(cmdBuffer), __LINE__, DRAWSTATE_INVALID_BARRIER, "DS",
+ HandleToUint64(cmdBuffer), __LINE__, DRAWSTATE_INVALID_BARRIER, "DS",
"%s: Subresource must have the sum of the baseArrayLayer (%d) and layerCount (%d) be less "
"than or equal to the total number of layers (%d).",
funcName, mem_barrier->subresourceRange.baseArrayLayer, layer_count, image_data->createInfo.arrayLayers);
@@ -7805,7 +7792,7 @@ static bool ValidateBarriers(const char *funcName, VkCommandBuffer cmdBuffer, ui
if ((mem_barrier->subresourceRange.baseMipLevel + level_count) > image_data->createInfo.mipLevels) {
skip |= log_msg(
dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT,
- reinterpret_cast<uint64_t>(cmdBuffer), __LINE__, DRAWSTATE_INVALID_BARRIER, "DS",
+ HandleToUint64(cmdBuffer), __LINE__, DRAWSTATE_INVALID_BARRIER, "DS",
"%s: Subresource must have the sum of the baseMipLevel (%d) and levelCount (%d) be less than or equal to "
"the total number of levels (%d).",
funcName, mem_barrier->subresourceRange.baseMipLevel, level_count, image_data->createInfo.mipLevels);
@@ -7817,7 +7804,7 @@ static bool ValidateBarriers(const char *funcName, VkCommandBuffer cmdBuffer, ui
auto mem_barrier = &pBufferMemBarriers[i];
if (pCB->activeRenderPass) {
skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT,
- reinterpret_cast<uint64_t>(cmdBuffer), __LINE__, DRAWSTATE_INVALID_BARRIER, "DS",
+ HandleToUint64(cmdBuffer), __LINE__, DRAWSTATE_INVALID_BARRIER, "DS",
"%s: Buffer Barriers cannot be used during a render pass.", funcName);
}
if (!mem_barrier) continue;
@@ -7828,11 +7815,11 @@ static bool ValidateBarriers(const char *funcName, VkCommandBuffer cmdBuffer, ui
(mem_barrier->dstQueueFamilyIndex != VK_QUEUE_FAMILY_IGNORED &&
mem_barrier->dstQueueFamilyIndex >= dev_data->phys_dev_properties.queue_family_properties.size())) {
skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT,
- reinterpret_cast<uint64_t>(cmdBuffer), __LINE__, DRAWSTATE_INVALID_QUEUE_INDEX, "DS",
+ HandleToUint64(cmdBuffer), __LINE__, DRAWSTATE_INVALID_QUEUE_INDEX, "DS",
"%s: Buffer Barrier 0x%" PRIx64
" has QueueFamilyIndex greater "
"than the number of QueueFamilies (" PRINTF_SIZE_T_SPECIFIER ") for this device.",
- funcName, reinterpret_cast<const uint64_t &>(mem_barrier->buffer),
+ funcName, HandleToUint64(mem_barrier->buffer),
dev_data->phys_dev_properties.queue_family_properties.size());
}
@@ -7840,21 +7827,20 @@ static bool ValidateBarriers(const char *funcName, VkCommandBuffer cmdBuffer, ui
if (buffer_state) {
auto buffer_size = buffer_state->requirements.size;
if (mem_barrier->offset >= buffer_size) {
- skip |= log_msg(
- dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT,
- reinterpret_cast<uint64_t>(cmdBuffer), __LINE__, DRAWSTATE_INVALID_BARRIER, "DS",
- "%s: Buffer Barrier 0x%" PRIx64 " has offset 0x%" PRIx64 " which is not less than total size 0x%" PRIx64 ".",
- funcName, reinterpret_cast<const uint64_t &>(mem_barrier->buffer),
- reinterpret_cast<const uint64_t &>(mem_barrier->offset), reinterpret_cast<const uint64_t &>(buffer_size));
+ skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT,
+ VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, HandleToUint64(cmdBuffer), __LINE__,
+ DRAWSTATE_INVALID_BARRIER, "DS", "%s: Buffer Barrier 0x%" PRIx64 " has offset 0x%" PRIx64
+ " which is not less than total size 0x%" PRIx64 ".",
+ funcName, HandleToUint64(mem_barrier->buffer), HandleToUint64(mem_barrier->offset),
+ HandleToUint64(buffer_size));
} else if (mem_barrier->size != VK_WHOLE_SIZE && (mem_barrier->offset + mem_barrier->size > buffer_size)) {
skip |=
log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT,
- reinterpret_cast<uint64_t>(cmdBuffer), __LINE__, DRAWSTATE_INVALID_BARRIER, "DS",
+ HandleToUint64(cmdBuffer), __LINE__, DRAWSTATE_INVALID_BARRIER, "DS",
"%s: Buffer Barrier 0x%" PRIx64 " has offset 0x%" PRIx64 " and size 0x%" PRIx64
" whose sum is greater than total size 0x%" PRIx64 ".",
- funcName, reinterpret_cast<const uint64_t &>(mem_barrier->buffer),
- reinterpret_cast<const uint64_t &>(mem_barrier->offset),
- reinterpret_cast<const uint64_t &>(mem_barrier->size), reinterpret_cast<const uint64_t &>(buffer_size));
+ funcName, HandleToUint64(mem_barrier->buffer), HandleToUint64(mem_barrier->offset),
+ HandleToUint64(mem_barrier->size), HandleToUint64(buffer_size));
}
}
}
@@ -7877,9 +7863,8 @@ bool validateEventStageMask(VkQueue queue, GLOBAL_CB_NODE *pCB, uint32_t eventCo
auto global_event_data = GetEventNode(dev_data, event);
if (!global_event_data) {
skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_EVENT_EXT,
- reinterpret_cast<const uint64_t &>(event), __LINE__, DRAWSTATE_INVALID_EVENT, "DS",
- "Event 0x%" PRIx64 " cannot be waited on if it has never been set.",
- reinterpret_cast<const uint64_t &>(event));
+ HandleToUint64(event), __LINE__, DRAWSTATE_INVALID_EVENT, "DS",
+ "Event 0x%" PRIx64 " cannot be waited on if it has never been set.", HandleToUint64(event));
} else {
stageMask |= global_event_data->stageMask;
}
@@ -7889,7 +7874,7 @@ bool validateEventStageMask(VkQueue queue, GLOBAL_CB_NODE *pCB, uint32_t eventCo
// but set event can be called at any time.
if (sourceStageMask != stageMask && sourceStageMask != (stageMask | VK_PIPELINE_STAGE_HOST_BIT)) {
skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT,
- reinterpret_cast<uint64_t>(pCB->commandBuffer), __LINE__, VALIDATION_ERROR_00254, "DS",
+ HandleToUint64(pCB->commandBuffer), __LINE__, VALIDATION_ERROR_00254, "DS",
"Submitting cmdbuffer with call to VkCmdWaitEvents "
"using srcStageMask 0x%X which must be the bitwise "
"OR of the stageMask parameters used in calls to "
@@ -7942,7 +7927,7 @@ bool CheckStageMaskQueueCompatibility(layer_data *dev_data, VkCommandBuffer comm
if ((supported_pipeline_stages_table[item] & queue_flags) == 0) {
skip |=
log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT,
- reinterpret_cast<uint64_t &>(command_buffer), __LINE__, error_code, "DL",
+ HandleToUint64(command_buffer), __LINE__, error_code, "DL",
"%s(): %s flag %s is not compatible with the queue family properties of this "
"command buffer. %s",
function, src_or_dest, string_VkPipelineStageFlagBits(static_cast<VkPipelineStageFlagBits>(item)),
@@ -8000,9 +7985,7 @@ VKAPI_ATTR void VKAPI_CALL CmdWaitEvents(VkCommandBuffer commandBuffer, uint32_t
for (uint32_t i = 0; i < eventCount; ++i) {
auto event_state = GetEventNode(dev_data, pEvents[i]);
if (event_state) {
- addCommandBufferBinding(&event_state->cb_bindings,
- {reinterpret_cast<const uint64_t &>(pEvents[i]), kVulkanObjectTypeEvent},
- cb_state);
+ addCommandBufferBinding(&event_state->cb_bindings, {HandleToUint64(pEvents[i]), kVulkanObjectTypeEvent}, cb_state);
event_state->cb_bindings.insert(cb_state);
}
cb_state->waitedEvents.insert(pEvents[i]);
@@ -8115,7 +8098,7 @@ VKAPI_ATTR void VKAPI_CALL CmdBeginQuery(VkCommandBuffer commandBuffer, VkQueryP
skip |= ValidateCmd(dev_data, pCB, CMD_BEGINQUERY, "vkCmdBeginQuery()");
UpdateCmdBufferLastCmd(pCB, CMD_BEGINQUERY);
addCommandBufferBinding(&GetQueryPoolNode(dev_data, queryPool)->cb_bindings,
- {reinterpret_cast<uint64_t &>(queryPool), kVulkanObjectTypeQueryPool}, pCB);
+ {HandleToUint64(queryPool), kVulkanObjectTypeQueryPool}, pCB);
}
lock.unlock();
if (!skip) dev_data->dispatch_table.CmdBeginQuery(commandBuffer, queryPool, slot, flags);
@@ -8130,9 +8113,9 @@ VKAPI_ATTR void VKAPI_CALL CmdEndQuery(VkCommandBuffer commandBuffer, VkQueryPoo
QueryObject query = {queryPool, slot};
if (!cb_state->activeQueries.count(query)) {
skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT,
- reinterpret_cast<uint64_t>(commandBuffer), __LINE__, VALIDATION_ERROR_01041, "DS",
- "Ending a query before it was started: queryPool 0x%" PRIx64 ", index %d. %s", (uint64_t)(queryPool),
- slot, validation_error_map[VALIDATION_ERROR_01041]);
+ HandleToUint64(commandBuffer), __LINE__, VALIDATION_ERROR_01041, "DS",
+ "Ending a query before it was started: queryPool 0x%" PRIx64 ", index %d. %s",
+ HandleToUint64(queryPool), slot, validation_error_map[VALIDATION_ERROR_01041]);
} else {
cb_state->activeQueries.erase(query);
}
@@ -8143,7 +8126,7 @@ VKAPI_ATTR void VKAPI_CALL CmdEndQuery(VkCommandBuffer commandBuffer, VkQueryPoo
skip |= ValidateCmd(dev_data, cb_state, CMD_ENDQUERY, "VkCmdEndQuery()");
UpdateCmdBufferLastCmd(cb_state, CMD_ENDQUERY);
addCommandBufferBinding(&GetQueryPoolNode(dev_data, queryPool)->cb_bindings,
- {reinterpret_cast<uint64_t &>(queryPool), kVulkanObjectTypeQueryPool}, cb_state);
+ {HandleToUint64(queryPool), kVulkanObjectTypeQueryPool}, cb_state);
}
lock.unlock();
if (!skip) dev_data->dispatch_table.CmdEndQuery(commandBuffer, queryPool, slot);
@@ -8169,7 +8152,7 @@ VKAPI_ATTR void VKAPI_CALL CmdResetQueryPool(VkCommandBuffer commandBuffer, VkQu
UpdateCmdBufferLastCmd(cb_state, CMD_RESETQUERYPOOL);
skip |= insideRenderPass(dev_data, cb_state, "vkCmdResetQueryPool()", VALIDATION_ERROR_01025);
addCommandBufferBinding(&GetQueryPoolNode(dev_data, queryPool)->cb_bindings,
- {reinterpret_cast<uint64_t &>(queryPool), kVulkanObjectTypeQueryPool}, cb_state);
+ {HandleToUint64(queryPool), kVulkanObjectTypeQueryPool}, cb_state);
}
lock.unlock();
if (!skip) dev_data->dispatch_table.CmdResetQueryPool(commandBuffer, queryPool, firstQuery, queryCount);
@@ -8200,9 +8183,9 @@ bool validateQuery(VkQueue queue, GLOBAL_CB_NODE *pCB, VkQueryPool queryPool, ui
}
if (fail) {
skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT,
- reinterpret_cast<uint64_t>(pCB->commandBuffer), __LINE__, DRAWSTATE_INVALID_QUERY, "DS",
+ HandleToUint64(pCB->commandBuffer), __LINE__, DRAWSTATE_INVALID_QUERY, "DS",
"Requesting a copy from query to buffer with invalid query: queryPool 0x%" PRIx64 ", index %d",
- reinterpret_cast<uint64_t &>(queryPool), firstQuery + i);
+ HandleToUint64(queryPool), firstQuery + i);
}
}
return skip;
@@ -8238,7 +8221,7 @@ VKAPI_ATTR void VKAPI_CALL CmdCopyQueryPoolResults(VkCommandBuffer commandBuffer
UpdateCmdBufferLastCmd(cb_node, CMD_COPYQUERYPOOLRESULTS);
skip |= insideRenderPass(dev_data, cb_node, "vkCmdCopyQueryPoolResults()", VALIDATION_ERROR_01074);
addCommandBufferBinding(&GetQueryPoolNode(dev_data, queryPool)->cb_bindings,
- {reinterpret_cast<uint64_t &>(queryPool), kVulkanObjectTypeQueryPool}, cb_node);
+ {HandleToUint64(queryPool), kVulkanObjectTypeQueryPool}, cb_node);
} else {
assert(0);
}
@@ -8263,7 +8246,7 @@ VKAPI_ATTR void VKAPI_CALL CmdPushConstants(VkCommandBuffer commandBuffer, VkPip
skip |= validatePushConstantRange(dev_data, offset, size, "vkCmdPushConstants()");
if (0 == stageFlags) {
skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT,
- reinterpret_cast<uint64_t>(commandBuffer), __LINE__, VALIDATION_ERROR_00996, "DS",
+ HandleToUint64(commandBuffer), __LINE__, VALIDATION_ERROR_00996, "DS",
"vkCmdPushConstants() call has no stageFlags set. %s", validation_error_map[VALIDATION_ERROR_00996]);
}
@@ -8281,12 +8264,13 @@ VKAPI_ATTR void VKAPI_CALL CmdPushConstants(VkCommandBuffer commandBuffer, VkPip
}
}
if (!found_matching_range) {
- skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT,
- reinterpret_cast<uint64_t>(commandBuffer), __LINE__, VALIDATION_ERROR_00988, "DS",
- "vkCmdPushConstants() stageFlags = 0x%" PRIx32
- " do not match the stageFlags in any of the ranges with"
- " offset = %d and size = %d in pipeline layout 0x%" PRIx64 ". %s",
- (uint32_t)stageFlags, offset, size, (uint64_t)layout, validation_error_map[VALIDATION_ERROR_00988]);
+ skip |=
+ log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT,
+ HandleToUint64(commandBuffer), __LINE__, VALIDATION_ERROR_00988, "DS",
+ "vkCmdPushConstants() stageFlags = 0x%" PRIx32
+ " do not match the stageFlags in any of the ranges with"
+ " offset = %d and size = %d in pipeline layout 0x%" PRIx64 ". %s",
+ (uint32_t)stageFlags, offset, size, HandleToUint64(layout), validation_error_map[VALIDATION_ERROR_00988]);
}
}
lock.unlock();
@@ -8360,10 +8344,10 @@ static bool ValidateFramebufferCreateInfo(layer_data *dev_data, const VkFramebuf
if (rpci->attachmentCount != pCreateInfo->attachmentCount) {
skip |= log_msg(
dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_RENDER_PASS_EXT,
- reinterpret_cast<const uint64_t &>(pCreateInfo->renderPass), __LINE__, VALIDATION_ERROR_00404, "DS",
+ HandleToUint64(pCreateInfo->renderPass), __LINE__, VALIDATION_ERROR_00404, "DS",
"vkCreateFramebuffer(): VkFramebufferCreateInfo attachmentCount of %u does not match attachmentCount of %u of "
"renderPass (0x%" PRIxLEAST64 ") being used to create Framebuffer. %s",
- pCreateInfo->attachmentCount, rpci->attachmentCount, reinterpret_cast<const uint64_t &>(pCreateInfo->renderPass),
+ pCreateInfo->attachmentCount, rpci->attachmentCount, HandleToUint64(pCreateInfo->renderPass),
validation_error_map[VALIDATION_ERROR_00404]);
} else {
// attachmentCounts match, so make sure corresponding attachment details line up
@@ -8374,22 +8358,22 @@ static bool ValidateFramebufferCreateInfo(layer_data *dev_data, const VkFramebuf
if (ivci.format != rpci->pAttachments[i].format) {
skip |= log_msg(
dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_RENDER_PASS_EXT,
- reinterpret_cast<const uint64_t &>(pCreateInfo->renderPass), __LINE__, VALIDATION_ERROR_00408, "DS",
+ HandleToUint64(pCreateInfo->renderPass), __LINE__, VALIDATION_ERROR_00408, "DS",
"vkCreateFramebuffer(): VkFramebufferCreateInfo attachment #%u has format of %s that does not match "
"the format of "
"%s used by the corresponding attachment for renderPass (0x%" PRIxLEAST64 "). %s",
i, string_VkFormat(ivci.format), string_VkFormat(rpci->pAttachments[i].format),
- reinterpret_cast<const uint64_t &>(pCreateInfo->renderPass), validation_error_map[VALIDATION_ERROR_00408]);
+ HandleToUint64(pCreateInfo->renderPass), validation_error_map[VALIDATION_ERROR_00408]);
}
const VkImageCreateInfo *ici = &GetImageState(dev_data, ivci.image)->createInfo;
if (ici->samples != rpci->pAttachments[i].samples) {
skip |= log_msg(
dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_RENDER_PASS_EXT,
- reinterpret_cast<const uint64_t &>(pCreateInfo->renderPass), __LINE__, VALIDATION_ERROR_00409, "DS",
+ HandleToUint64(pCreateInfo->renderPass), __LINE__, VALIDATION_ERROR_00409, "DS",
"vkCreateFramebuffer(): VkFramebufferCreateInfo attachment #%u has %s samples that do not match "
"the %s samples used by the corresponding attachment for renderPass (0x%" PRIxLEAST64 "). %s",
i, string_VkSampleCountFlagBits(ici->samples), string_VkSampleCountFlagBits(rpci->pAttachments[i].samples),
- reinterpret_cast<const uint64_t &>(pCreateInfo->renderPass), validation_error_map[VALIDATION_ERROR_00409]);
+ HandleToUint64(pCreateInfo->renderPass), validation_error_map[VALIDATION_ERROR_00409]);
}
// Verify that view only has a single mip level
if (ivci.subresourceRange.levelCount != 1) {
@@ -8693,20 +8677,18 @@ static bool ValidateDependencies(const layer_data *dev_data, FRAMEBUFFER_STATE c
uint32_t attachment = i;
for (auto other_attachment : overlapping_attachments[i]) {
if (!(pCreateInfo->pAttachments[attachment].flags & VK_ATTACHMENT_DESCRIPTION_MAY_ALIAS_BIT)) {
- skip |=
- log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_FRAMEBUFFER_EXT,
- reinterpret_cast<const uint64_t &>(framebuffer->framebuffer), __LINE__, VALIDATION_ERROR_00324, "DS",
- "Attachment %d aliases attachment %d but doesn't "
- "set VK_ATTACHMENT_DESCRIPTION_MAY_ALIAS_BIT. %s",
- attachment, other_attachment, validation_error_map[VALIDATION_ERROR_00324]);
+ skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_FRAMEBUFFER_EXT,
+ HandleToUint64(framebuffer->framebuffer), __LINE__, VALIDATION_ERROR_00324, "DS",
+ "Attachment %d aliases attachment %d but doesn't "
+ "set VK_ATTACHMENT_DESCRIPTION_MAY_ALIAS_BIT. %s",
+ attachment, other_attachment, validation_error_map[VALIDATION_ERROR_00324]);
}
if (!(pCreateInfo->pAttachments[other_attachment].flags & VK_ATTACHMENT_DESCRIPTION_MAY_ALIAS_BIT)) {
- skip |=
- log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_FRAMEBUFFER_EXT,
- reinterpret_cast<const uint64_t &>(framebuffer->framebuffer), __LINE__, VALIDATION_ERROR_00324, "DS",
- "Attachment %d aliases attachment %d but doesn't "
- "set VK_ATTACHMENT_DESCRIPTION_MAY_ALIAS_BIT. %s",
- other_attachment, attachment, validation_error_map[VALIDATION_ERROR_00324]);
+ skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_FRAMEBUFFER_EXT,
+ HandleToUint64(framebuffer->framebuffer), __LINE__, VALIDATION_ERROR_00324, "DS",
+ "Attachment %d aliases attachment %d but doesn't "
+ "set VK_ATTACHMENT_DESCRIPTION_MAY_ALIAS_BIT. %s",
+ other_attachment, attachment, validation_error_map[VALIDATION_ERROR_00324]);
}
}
}
@@ -9069,9 +9051,8 @@ static bool validatePrimaryCommandBuffer(const layer_data *dev_data, const GLOBA
bool skip = false;
if (pCB->createInfo.level != VK_COMMAND_BUFFER_LEVEL_PRIMARY) {
skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT,
- reinterpret_cast<uint64_t>(pCB->commandBuffer), __LINE__, error_code, "DS",
- "Cannot execute command %s on a secondary command buffer. %s", cmd_name,
- validation_error_map[error_code]);
+ HandleToUint64(pCB->commandBuffer), __LINE__, error_code, "DS",
+ "Cannot execute command %s on a secondary command buffer. %s", cmd_name, validation_error_map[error_code]);
}
return skip;
}
@@ -9160,25 +9141,24 @@ VKAPI_ATTR void VKAPI_CALL CmdBeginRenderPass(VkCommandBuffer commandBuffer, con
if (clear_op_size > pRenderPassBegin->clearValueCount) {
skip |= log_msg(
dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_RENDER_PASS_EXT,
- reinterpret_cast<uint64_t &>(render_pass_state->renderPass), __LINE__, VALIDATION_ERROR_00442, "DS",
+ HandleToUint64(render_pass_state->renderPass), __LINE__, VALIDATION_ERROR_00442, "DS",
"In vkCmdBeginRenderPass() the VkRenderPassBeginInfo struct has a clearValueCount of %u but there must "
"be at least %u entries in pClearValues array to account for the highest index attachment in renderPass "
"0x%" PRIx64
" that uses VK_ATTACHMENT_LOAD_OP_CLEAR is %u. Note that the pClearValues array "
"is indexed by attachment number so even if some pClearValues entries between 0 and %u correspond to "
"attachments that aren't cleared they will be ignored. %s",
- pRenderPassBegin->clearValueCount, clear_op_size, reinterpret_cast<uint64_t &>(render_pass_state->renderPass),
- clear_op_size, clear_op_size - 1, validation_error_map[VALIDATION_ERROR_00442]);
+ pRenderPassBegin->clearValueCount, clear_op_size, HandleToUint64(render_pass_state->renderPass), clear_op_size,
+ clear_op_size - 1, validation_error_map[VALIDATION_ERROR_00442]);
}
if (clear_op_size < pRenderPassBegin->clearValueCount) {
skip |= log_msg(
dev_data->report_data, VK_DEBUG_REPORT_WARNING_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_RENDER_PASS_EXT,
- reinterpret_cast<uint64_t &>(render_pass_state->renderPass), __LINE__,
- DRAWSTATE_RENDERPASS_TOO_MANY_CLEAR_VALUES, "DS",
+ HandleToUint64(render_pass_state->renderPass), __LINE__, DRAWSTATE_RENDERPASS_TOO_MANY_CLEAR_VALUES, "DS",
"In vkCmdBeginRenderPass() the VkRenderPassBeginInfo struct has a clearValueCount of %u but only first %u "
"entries in pClearValues array are used. The highest index of any attachment in renderPass 0x%" PRIx64
" that uses VK_ATTACHMENT_LOAD_OP_CLEAR is %u - other pClearValues are ignored.",
- pRenderPassBegin->clearValueCount, clear_op_size, reinterpret_cast<uint64_t &>(render_pass_state->renderPass),
+ pRenderPassBegin->clearValueCount, clear_op_size, HandleToUint64(render_pass_state->renderPass),
clear_op_size - 1);
}
skip |= VerifyRenderAreaBounds(dev_data, pRenderPassBegin);
@@ -9224,7 +9204,7 @@ VKAPI_ATTR void VKAPI_CALL CmdNextSubpass(VkCommandBuffer commandBuffer, VkSubpa
auto subpassCount = pCB->activeRenderPass->createInfo.subpassCount;
if (pCB->activeSubpass == subpassCount - 1) {
skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT,
- reinterpret_cast<uint64_t>(commandBuffer), __LINE__, VALIDATION_ERROR_00453, "DS",
+ HandleToUint64(commandBuffer), __LINE__, VALIDATION_ERROR_00453, "DS",
"vkCmdNextSubpass(): Attempted to advance beyond final subpass. %s",
validation_error_map[VALIDATION_ERROR_00453]);
}
@@ -9256,7 +9236,7 @@ VKAPI_ATTR void VKAPI_CALL CmdEndRenderPass(VkCommandBuffer commandBuffer) {
if (rp_state) {
if (pCB->activeSubpass != rp_state->createInfo.subpassCount - 1) {
skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT,
- VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, reinterpret_cast<uint64_t>(commandBuffer), __LINE__,
+ VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, HandleToUint64(commandBuffer), __LINE__,
VALIDATION_ERROR_00460, "DS", "vkCmdEndRenderPass(): Called before reaching final subpass. %s",
validation_error_map[VALIDATION_ERROR_00460]);
}
@@ -9305,12 +9285,12 @@ VKAPI_ATTR void VKAPI_CALL CmdEndRenderPass(VkCommandBuffer commandBuffer) {
static bool logInvalidAttachmentMessage(layer_data *dev_data, VkCommandBuffer secondaryBuffer, uint32_t primaryAttach,
uint32_t secondaryAttach, const char *msg) {
return log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT,
- reinterpret_cast<uint64_t>(secondaryBuffer), __LINE__, VALIDATION_ERROR_02059, "DS",
+ HandleToUint64(secondaryBuffer), __LINE__, VALIDATION_ERROR_02059, "DS",
"vkCmdExecuteCommands() called w/ invalid Secondary Cmd Buffer 0x%" PRIx64
" which has a render pass "
"that is not compatible with the Primary Cmd Buffer current render pass. "
"Attachment %u is not compatible with %u: %s. %s",
- reinterpret_cast<uint64_t &>(secondaryBuffer), primaryAttach, secondaryAttach, msg,
+ HandleToUint64(secondaryBuffer), primaryAttach, secondaryAttach, msg,
validation_error_map[VALIDATION_ERROR_02059]);
}
@@ -9414,12 +9394,12 @@ static bool validateRenderPassCompatibility(layer_data *dev_data, VkCommandBuffe
if (primaryPassCI->subpassCount != secondaryPassCI->subpassCount) {
skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT,
- reinterpret_cast<uint64_t>(primaryBuffer), __LINE__, DRAWSTATE_INVALID_SECONDARY_COMMAND_BUFFER, "DS",
+ HandleToUint64(primaryBuffer), __LINE__, DRAWSTATE_INVALID_SECONDARY_COMMAND_BUFFER, "DS",
"vkCmdExecuteCommands() called w/ invalid secondary Cmd Buffer 0x%" PRIx64
" that has a subpassCount of %u that is incompatible with the primary Cmd Buffer 0x%" PRIx64
" that has a subpassCount of %u.",
- reinterpret_cast<uint64_t &>(secondaryBuffer), secondaryPassCI->subpassCount,
- reinterpret_cast<uint64_t &>(primaryBuffer), primaryPassCI->subpassCount);
+ HandleToUint64(secondaryBuffer), secondaryPassCI->subpassCount, HandleToUint64(primaryBuffer),
+ primaryPassCI->subpassCount);
} else {
for (uint32_t i = 0; i < primaryPassCI->subpassCount; ++i) {
skip |= validateSubpassCompatibility(dev_data, primaryBuffer, primaryPassCI, secondaryBuffer, secondaryPassCI, i,
@@ -9440,20 +9420,20 @@ static bool validateFramebuffer(layer_data *dev_data, VkCommandBuffer primaryBuf
if (secondary_fb != VK_NULL_HANDLE) {
if (primary_fb != secondary_fb) {
skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT,
- reinterpret_cast<uint64_t>(primaryBuffer), __LINE__, VALIDATION_ERROR_02060, "DS",
+ HandleToUint64(primaryBuffer), __LINE__, VALIDATION_ERROR_02060, "DS",
"vkCmdExecuteCommands() called w/ invalid secondary command buffer 0x%" PRIx64
" which has a framebuffer 0x%" PRIx64
" that is not the same as the primary command buffer's current active framebuffer 0x%" PRIx64 ". %s",
- reinterpret_cast<uint64_t &>(secondaryBuffer), reinterpret_cast<uint64_t &>(secondary_fb),
- reinterpret_cast<uint64_t &>(primary_fb), validation_error_map[VALIDATION_ERROR_02060]);
+ HandleToUint64(secondaryBuffer), HandleToUint64(secondary_fb), HandleToUint64(primary_fb),
+ validation_error_map[VALIDATION_ERROR_02060]);
}
auto fb = GetFramebufferState(dev_data, secondary_fb);
if (!fb) {
skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT,
- reinterpret_cast<uint64_t>(primaryBuffer), __LINE__, DRAWSTATE_INVALID_SECONDARY_COMMAND_BUFFER, "DS",
+ HandleToUint64(primaryBuffer), __LINE__, DRAWSTATE_INVALID_SECONDARY_COMMAND_BUFFER, "DS",
"vkCmdExecuteCommands() called w/ invalid Cmd Buffer 0x%p "
"which has invalid framebuffer 0x%" PRIx64 ".",
- (void *)secondaryBuffer, (uint64_t)(secondary_fb));
+ (void *)secondaryBuffer, HandleToUint64(secondary_fb));
return skip;
}
auto cb_renderpass = GetRenderPassState(dev_data, pSubCB->beginInfo.pInheritanceInfo->renderPass);
@@ -9475,15 +9455,14 @@ static bool validateSecondaryCommandBufferState(layer_data *dev_data, GLOBAL_CB_
pSubCB->beginInfo.pInheritanceInfo) {
VkQueryPipelineStatisticFlags cmdBufStatistics = pSubCB->beginInfo.pInheritanceInfo->pipelineStatistics;
if ((cmdBufStatistics & queryPoolData->second.createInfo.pipelineStatistics) != cmdBufStatistics) {
- skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT,
- VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, reinterpret_cast<uint64_t>(pCB->commandBuffer),
- __LINE__, VALIDATION_ERROR_02065, "DS",
- "vkCmdExecuteCommands() called w/ invalid Cmd Buffer 0x%p "
- "which has invalid active query pool 0x%" PRIx64
- ". Pipeline statistics is being queried so the command "
- "buffer must have all bits set on the queryPool. %s",
- pCB->commandBuffer, reinterpret_cast<const uint64_t &>(queryPoolData->first),
- validation_error_map[VALIDATION_ERROR_02065]);
+ skip |= log_msg(
+ dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT,
+ HandleToUint64(pCB->commandBuffer), __LINE__, VALIDATION_ERROR_02065, "DS",
+ "vkCmdExecuteCommands() called w/ invalid Cmd Buffer 0x%p "
+ "which has invalid active query pool 0x%" PRIx64
+ ". Pipeline statistics is being queried so the command "
+ "buffer must have all bits set on the queryPool. %s",
+ pCB->commandBuffer, HandleToUint64(queryPoolData->first), validation_error_map[VALIDATION_ERROR_02065]);
}
}
activeTypes.insert(queryPoolData->second.createInfo.queryType);
@@ -9492,15 +9471,14 @@ static bool validateSecondaryCommandBufferState(layer_data *dev_data, GLOBAL_CB_
for (auto queryObject : pSubCB->startedQueries) {
auto queryPoolData = dev_data->queryPoolMap.find(queryObject.pool);
if (queryPoolData != dev_data->queryPoolMap.end() && activeTypes.count(queryPoolData->second.createInfo.queryType)) {
- skip |=
- log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT,
- reinterpret_cast<uint64_t>(pCB->commandBuffer), __LINE__, DRAWSTATE_INVALID_SECONDARY_COMMAND_BUFFER, "DS",
- "vkCmdExecuteCommands() called w/ invalid Cmd Buffer 0x%p "
- "which has invalid active query pool 0x%" PRIx64
- "of type %d but a query of that type has been started on "
- "secondary Cmd Buffer 0x%p.",
- pCB->commandBuffer, reinterpret_cast<const uint64_t &>(queryPoolData->first),
- queryPoolData->second.createInfo.queryType, pSubCB->commandBuffer);
+ skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT,
+ HandleToUint64(pCB->commandBuffer), __LINE__, DRAWSTATE_INVALID_SECONDARY_COMMAND_BUFFER, "DS",
+ "vkCmdExecuteCommands() called w/ invalid Cmd Buffer 0x%p "
+ "which has invalid active query pool 0x%" PRIx64
+ "of type %d but a query of that type has been started on "
+ "secondary Cmd Buffer 0x%p.",
+ pCB->commandBuffer, HandleToUint64(queryPoolData->first), queryPoolData->second.createInfo.queryType,
+ pSubCB->commandBuffer);
}
}
@@ -9509,7 +9487,7 @@ static bool validateSecondaryCommandBufferState(layer_data *dev_data, GLOBAL_CB_
if (primary_pool && secondary_pool && (primary_pool->queueFamilyIndex != secondary_pool->queueFamilyIndex)) {
skip |=
log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT,
- reinterpret_cast<uint64_t>(pSubCB->commandBuffer), __LINE__, DRAWSTATE_INVALID_QUEUE_FAMILY, "DS",
+ HandleToUint64(pSubCB->commandBuffer), __LINE__, DRAWSTATE_INVALID_QUEUE_FAMILY, "DS",
"vkCmdExecuteCommands(): Primary command buffer 0x%p"
" created in queue family %d has secondary command buffer 0x%p created in queue family %d.",
pCB->commandBuffer, primary_pool->queueFamilyIndex, pSubCB->commandBuffer, secondary_pool->queueFamilyIndex);
@@ -9532,7 +9510,7 @@ VKAPI_ATTR void VKAPI_CALL CmdExecuteCommands(VkCommandBuffer commandBuffer, uin
if (VK_COMMAND_BUFFER_LEVEL_PRIMARY == pSubCB->createInfo.level) {
skip |=
log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT,
- reinterpret_cast<uint64_t>(pCommandBuffers[i]), __LINE__, VALIDATION_ERROR_00156, "DS",
+ HandleToUint64(pCommandBuffers[i]), __LINE__, VALIDATION_ERROR_00156, "DS",
"vkCmdExecuteCommands() called w/ Primary Cmd Buffer 0x%p in element %u of pCommandBuffers "
"array. All cmd buffers in pCommandBuffers array must be secondary. %s",
pCommandBuffers[i], i, validation_error_map[VALIDATION_ERROR_00156]);
@@ -9541,10 +9519,10 @@ VKAPI_ATTR void VKAPI_CALL CmdExecuteCommands(VkCommandBuffer commandBuffer, uin
if (!(pSubCB->beginInfo.flags & VK_COMMAND_BUFFER_USAGE_RENDER_PASS_CONTINUE_BIT)) {
skip |= log_msg(
dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT,
- reinterpret_cast<uint64_t>(pCommandBuffers[i]), __LINE__, VALIDATION_ERROR_02057, "DS",
+ HandleToUint64(pCommandBuffers[i]), __LINE__, VALIDATION_ERROR_02057, "DS",
"vkCmdExecuteCommands(): Secondary Command Buffer (0x%p) executed within render pass (0x%" PRIxLEAST64
") must have had vkBeginCommandBuffer() called w/ VK_COMMAND_BUFFER_USAGE_RENDER_PASS_CONTINUE_BIT set. %s",
- pCommandBuffers[i], (uint64_t)pCB->activeRenderPass->renderPass,
+ pCommandBuffers[i], HandleToUint64(pCB->activeRenderPass->renderPass),
validation_error_map[VALIDATION_ERROR_02057]);
} else {
// Make sure render pass is compatible with parent command buffer pass if has continue
@@ -9562,11 +9540,11 @@ VKAPI_ATTR void VKAPI_CALL CmdExecuteCommands(VkCommandBuffer commandBuffer, uin
secondary_rp_state->createInfo.ptr(), errorString)) {
skip |= log_msg(
dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT,
- reinterpret_cast<uint64_t>(pCommandBuffers[i]), __LINE__, DRAWSTATE_RENDERPASS_INCOMPATIBLE, "DS",
+ HandleToUint64(pCommandBuffers[i]), __LINE__, DRAWSTATE_RENDERPASS_INCOMPATIBLE, "DS",
"vkCmdExecuteCommands(): Secondary Command Buffer (0x%p) w/ render pass (0x%" PRIxLEAST64
") is incompatible w/ primary command buffer (0x%p) w/ render pass (0x%" PRIxLEAST64 ") due to: %s",
- pCommandBuffers[i], (uint64_t)pSubCB->beginInfo.pInheritanceInfo->renderPass, commandBuffer,
- (uint64_t)pCB->activeRenderPass->renderPass, errorString.c_str());
+ pCommandBuffers[i], HandleToUint64(pSubCB->beginInfo.pInheritanceInfo->renderPass), commandBuffer,
+ HandleToUint64(pCB->activeRenderPass->renderPass), errorString.c_str());
}
}
// TODO(mlentine): Move more logic into this method
@@ -9577,8 +9555,8 @@ VKAPI_ATTR void VKAPI_CALL CmdExecuteCommands(VkCommandBuffer commandBuffer, uin
if (!(pSubCB->beginInfo.flags & VK_COMMAND_BUFFER_USAGE_SIMULTANEOUS_USE_BIT)) {
if (dev_data->globalInFlightCmdBuffers.find(pSubCB->commandBuffer) != dev_data->globalInFlightCmdBuffers.end()) {
skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT,
- VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, reinterpret_cast<uint64_t>(pCB->commandBuffer),
- __LINE__, VALIDATION_ERROR_00154, "DS",
+ VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, HandleToUint64(pCB->commandBuffer), __LINE__,
+ VALIDATION_ERROR_00154, "DS",
"Attempt to simultaneously execute command buffer 0x%p"
" without VK_COMMAND_BUFFER_USAGE_SIMULTANEOUS_USE_BIT set! %s",
pCB->commandBuffer, validation_error_map[VALIDATION_ERROR_00154]);
@@ -9587,7 +9565,7 @@ VKAPI_ATTR void VKAPI_CALL CmdExecuteCommands(VkCommandBuffer commandBuffer, uin
// Warn that non-simultaneous secondary cmd buffer renders primary non-simultaneous
skip |= log_msg(
dev_data->report_data, VK_DEBUG_REPORT_WARNING_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT,
- reinterpret_cast<uint64_t>(pCommandBuffers[i]), __LINE__, DRAWSTATE_INVALID_CB_SIMULTANEOUS_USE, "DS",
+ HandleToUint64(pCommandBuffers[i]), __LINE__, DRAWSTATE_INVALID_CB_SIMULTANEOUS_USE, "DS",
"vkCmdExecuteCommands(): Secondary Command Buffer (0x%p) "
"does not have VK_COMMAND_BUFFER_USAGE_SIMULTANEOUS_USE_BIT set and will cause primary command buffer "
"(0x%p) to be treated as if it does not have VK_COMMAND_BUFFER_USAGE_SIMULTANEOUS_USE_BIT "
@@ -9599,7 +9577,7 @@ VKAPI_ATTR void VKAPI_CALL CmdExecuteCommands(VkCommandBuffer commandBuffer, uin
if (!pCB->activeQueries.empty() && !dev_data->enabled_features.inheritedQueries) {
skip |=
log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT,
- reinterpret_cast<uint64_t>(pCommandBuffers[i]), __LINE__, VALIDATION_ERROR_02062, "DS",
+ HandleToUint64(pCommandBuffers[i]), __LINE__, VALIDATION_ERROR_02062, "DS",
"vkCmdExecuteCommands(): Secondary Command Buffer "
"(0x%p) cannot be submitted with a query in "
"flight and inherited queries not "
@@ -9645,9 +9623,9 @@ VKAPI_ATTR VkResult VKAPI_CALL MapMemory(VkDevice device, VkDeviceMemory mem, Vk
if ((dev_data->phys_dev_mem_props.memoryTypes[mem_info->alloc_info.memoryTypeIndex].propertyFlags &
VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT) == 0) {
skip = log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_MEMORY_EXT,
- (uint64_t)mem, __LINE__, VALIDATION_ERROR_00629, "MEM",
+ HandleToUint64(mem), __LINE__, VALIDATION_ERROR_00629, "MEM",
"Mapping Memory without VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT set: mem obj 0x%" PRIxLEAST64 ". %s",
- (uint64_t)mem, validation_error_map[VALIDATION_ERROR_00629]);
+ HandleToUint64(mem), validation_error_map[VALIDATION_ERROR_00629]);
}
}
skip |= ValidateMapMemRange(dev_data, mem, offset, size);
@@ -9687,7 +9665,7 @@ static bool validateMemoryIsMapped(layer_data *dev_data, const char *funcName, u
if (pMemRanges[i].size == VK_WHOLE_SIZE) {
if (mem_info->mem_range.offset > pMemRanges[i].offset) {
skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT,
- VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_MEMORY_EXT, (uint64_t)pMemRanges[i].memory, __LINE__,
+ VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_MEMORY_EXT, HandleToUint64(pMemRanges[i].memory), __LINE__,
VALIDATION_ERROR_00643, "MEM", "%s: Flush/Invalidate offset (" PRINTF_SIZE_T_SPECIFIER
") is less than Memory Object's offset "
"(" PRINTF_SIZE_T_SPECIFIER "). %s",
@@ -9702,7 +9680,7 @@ static bool validateMemoryIsMapped(layer_data *dev_data, const char *funcName, u
(data_end < (pMemRanges[i].offset + pMemRanges[i].size))) {
skip |=
log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_MEMORY_EXT,
- (uint64_t)pMemRanges[i].memory, __LINE__, VALIDATION_ERROR_00642, "MEM",
+ HandleToUint64(pMemRanges[i].memory), __LINE__, VALIDATION_ERROR_00642, "MEM",
"%s: Flush/Invalidate size or offset (" PRINTF_SIZE_T_SPECIFIER ", " PRINTF_SIZE_T_SPECIFIER
") exceed the Memory Object's upper-bound "
"(" PRINTF_SIZE_T_SPECIFIER "). %s",
@@ -9729,18 +9707,18 @@ static bool ValidateAndCopyNoncoherentMemoryToDriver(layer_data *dev_data, uint3
char *data = static_cast<char *>(mem_info->shadow_copy);
for (uint64_t j = 0; j < mem_info->shadow_pad_size; ++j) {
if (data[j] != NoncoherentMemoryFillValue) {
- skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT,
- VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_MEMORY_EXT, (uint64_t)mem_ranges[i].memory, __LINE__,
- MEMTRACK_INVALID_MAP, "MEM", "Memory underflow was detected on mem obj 0x%" PRIxLEAST64,
- (uint64_t)mem_ranges[i].memory);
+ skip |= log_msg(
+ dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_MEMORY_EXT,
+ HandleToUint64(mem_ranges[i].memory), __LINE__, MEMTRACK_INVALID_MAP, "MEM",
+ "Memory underflow was detected on mem obj 0x%" PRIxLEAST64, HandleToUint64(mem_ranges[i].memory));
}
}
for (uint64_t j = (size + mem_info->shadow_pad_size); j < (2 * mem_info->shadow_pad_size + size); ++j) {
if (data[j] != NoncoherentMemoryFillValue) {
- skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT,
- VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_MEMORY_EXT, (uint64_t)mem_ranges[i].memory, __LINE__,
- MEMTRACK_INVALID_MAP, "MEM", "Memory overflow was detected on mem obj 0x%" PRIxLEAST64,
- (uint64_t)mem_ranges[i].memory);
+ skip |= log_msg(
+ dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_MEMORY_EXT,
+ HandleToUint64(mem_ranges[i].memory), __LINE__, MEMTRACK_INVALID_MAP, "MEM",
+ "Memory overflow was detected on mem obj 0x%" PRIxLEAST64, HandleToUint64(mem_ranges[i].memory));
}
}
memcpy(mem_info->p_driver_data, static_cast<void *>(data + mem_info->shadow_pad_size), (size_t)(size));
@@ -9770,14 +9748,14 @@ static bool ValidateMappedMemoryRangeDeviceLimits(layer_data *dev_data, const ch
uint64_t atom_size = dev_data->phys_dev_properties.properties.limits.nonCoherentAtomSize;
if (SafeModulo(mem_ranges[i].offset, atom_size) != 0) {
skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_MEMORY_EXT,
- reinterpret_cast<const uint64_t &>(mem_ranges->memory), __LINE__, VALIDATION_ERROR_00644, "MEM",
+ HandleToUint64(mem_ranges->memory), __LINE__, VALIDATION_ERROR_00644, "MEM",
"%s: Offset in pMemRanges[%d] is 0x%" PRIxLEAST64
", which is not a multiple of VkPhysicalDeviceLimits::nonCoherentAtomSize (0x%" PRIxLEAST64 "). %s",
func_name, i, mem_ranges[i].offset, atom_size, validation_error_map[VALIDATION_ERROR_00644]);
}
if ((mem_ranges[i].size != VK_WHOLE_SIZE) && (SafeModulo(mem_ranges[i].size, atom_size) != 0)) {
skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_MEMORY_EXT,
- reinterpret_cast<const uint64_t &>(mem_ranges->memory), __LINE__, VALIDATION_ERROR_00645, "MEM",
+ HandleToUint64(mem_ranges->memory), __LINE__, VALIDATION_ERROR_00645, "MEM",
"%s: Size in pMemRanges[%d] is 0x%" PRIxLEAST64
", which is not a multiple of VkPhysicalDeviceLimits::nonCoherentAtomSize (0x%" PRIxLEAST64 "). %s",
func_name, i, mem_ranges[i].size, atom_size, validation_error_map[VALIDATION_ERROR_00645]);
@@ -9841,7 +9819,7 @@ static bool PreCallValidateBindImageMemory(layer_data *dev_data, VkImage image,
if (image_state) {
std::unique_lock<std::mutex> lock(global_lock);
// Track objects tied to memory
- uint64_t image_handle = reinterpret_cast<uint64_t &>(image);
+ uint64_t image_handle = HandleToUint64(image);
skip = ValidateSetMemBinding(dev_data, mem, image_handle, kVulkanObjectTypeImage, "vkBindImageMemory()");
if (!image_state->memory_requirements_checked) {
// There's not an explicit requirement in the spec to call vkGetImageMemoryRequirements() prior to calling
@@ -9905,7 +9883,7 @@ static void PostCallRecordBindImageMemory(layer_data *dev_data, VkImage image, I
}
// Track objects tied to memory
- uint64_t image_handle = reinterpret_cast<uint64_t &>(image);
+ uint64_t image_handle = HandleToUint64(image);
SetMemBinding(dev_data, mem, image_handle, kVulkanObjectTypeImage, "vkBindImageMemory()");
image_state->binding.mem = mem;
@@ -9939,9 +9917,9 @@ VKAPI_ATTR VkResult VKAPI_CALL SetEvent(VkDevice device, VkEvent event) {
event_state->stageMask = VK_PIPELINE_STAGE_HOST_BIT;
if (event_state->write_in_use) {
skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_EVENT_EXT,
- reinterpret_cast<const uint64_t &>(event), __LINE__, DRAWSTATE_QUEUE_FORWARD_PROGRESS, "DS",
+ HandleToUint64(event), __LINE__, DRAWSTATE_QUEUE_FORWARD_PROGRESS, "DS",
"Cannot call vkSetEvent() on event 0x%" PRIxLEAST64 " that is already in use by a command buffer.",
- reinterpret_cast<const uint64_t &>(event));
+ HandleToUint64(event));
}
}
lock.unlock();
@@ -9981,7 +9959,7 @@ VKAPI_ATTR VkResult VKAPI_CALL QueueBindSparse(VkQueue queue, uint32_t bindInfoC
for (uint32_t k = 0; k < bindInfo.pBufferBinds[j].bindCount; k++) {
auto sparse_binding = bindInfo.pBufferBinds[j].pBinds[k];
if (SetSparseMemBinding(dev_data, {sparse_binding.memory, sparse_binding.memoryOffset, sparse_binding.size},
- (uint64_t)bindInfo.pBufferBinds[j].buffer, kVulkanObjectTypeBuffer))
+ HandleToUint64(bindInfo.pBufferBinds[j].buffer), kVulkanObjectTypeBuffer))
skip = true;
}
}
@@ -9989,7 +9967,7 @@ VKAPI_ATTR VkResult VKAPI_CALL QueueBindSparse(VkQueue queue, uint32_t bindInfoC
for (uint32_t k = 0; k < bindInfo.pImageOpaqueBinds[j].bindCount; k++) {
auto sparse_binding = bindInfo.pImageOpaqueBinds[j].pBinds[k];
if (SetSparseMemBinding(dev_data, {sparse_binding.memory, sparse_binding.memoryOffset, sparse_binding.size},
- (uint64_t)bindInfo.pImageOpaqueBinds[j].image, kVulkanObjectTypeImage))
+ HandleToUint64(bindInfo.pImageOpaqueBinds[j].image), kVulkanObjectTypeImage))
skip = true;
}
}
@@ -9999,7 +9977,7 @@ VKAPI_ATTR VkResult VKAPI_CALL QueueBindSparse(VkQueue queue, uint32_t bindInfoC
// TODO: This size is broken for non-opaque bindings, need to update to comprehend full sparse binding data
VkDeviceSize size = sparse_binding.extent.depth * sparse_binding.extent.height * sparse_binding.extent.width * 4;
if (SetSparseMemBinding(dev_data, {sparse_binding.memory, sparse_binding.memoryOffset, size},
- (uint64_t)bindInfo.pImageBinds[j].image, kVulkanObjectTypeImage))
+ HandleToUint64(bindInfo.pImageBinds[j].image), kVulkanObjectTypeImage))
skip = true;
}
}
@@ -10019,10 +9997,10 @@ VKAPI_ATTR VkResult VKAPI_CALL QueueBindSparse(VkQueue queue, uint32_t bindInfoC
pSemaphore->signaled = false;
} else {
skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_SEMAPHORE_EXT,
- reinterpret_cast<const uint64_t &>(semaphore), __LINE__, DRAWSTATE_QUEUE_FORWARD_PROGRESS, "DS",
+ HandleToUint64(semaphore), __LINE__, DRAWSTATE_QUEUE_FORWARD_PROGRESS, "DS",
"vkQueueBindSparse: Queue 0x%p is waiting on semaphore 0x%" PRIx64
" that has no way to be signaled.",
- queue, reinterpret_cast<const uint64_t &>(semaphore));
+ queue, HandleToUint64(semaphore));
}
}
}
@@ -10032,10 +10010,10 @@ VKAPI_ATTR VkResult VKAPI_CALL QueueBindSparse(VkQueue queue, uint32_t bindInfoC
if (pSemaphore) {
if (pSemaphore->signaled) {
skip = log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_SEMAPHORE_EXT,
- reinterpret_cast<const uint64_t &>(semaphore), __LINE__, DRAWSTATE_QUEUE_FORWARD_PROGRESS, "DS",
+ HandleToUint64(semaphore), __LINE__, DRAWSTATE_QUEUE_FORWARD_PROGRESS, "DS",
"vkQueueBindSparse: Queue 0x%p is signaling semaphore 0x%" PRIx64
", but that semaphore is already signaled.",
- queue, reinterpret_cast<const uint64_t &>(semaphore));
+ queue, HandleToUint64(semaphore));
} else {
pSemaphore->signaler.first = queue;
pSemaphore->signaler.second = pQueue->seq + pQueue->submissions.size() + 1;
@@ -10110,31 +10088,31 @@ static bool PreCallValidateCreateSwapchainKHR(layer_data *dev_data, const char *
if (!is_supported) {
if (log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT,
- reinterpret_cast<uint64_t>(dev_data->device), __LINE__, VALIDATION_ERROR_01922, "DS",
+ HandleToUint64(dev_data->device), __LINE__, VALIDATION_ERROR_01922, "DS",
"%s: pCreateInfo->surface is not known at this time to be supported for presentation by this device. "
"The vkGetPhysicalDeviceSurfaceSupportKHR() must be called beforehand, and it must return VK_TRUE support "
"with this surface for at least one queue family of this device. %s",
- func_name, validation_error_map[VALIDATION_ERROR_01922]))
+ func_name, validation_error_map[VALIDATION_ERROR_01922]))
return true;
}
}
if (most_recent_swapchain != old_swapchain_state || (surface_state->old_swapchain && surface_state->swapchain)) {
if (log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT,
- reinterpret_cast<uint64_t>(dev_data->device), __LINE__, DRAWSTATE_SWAPCHAIN_ALREADY_EXISTS, "DS",
+ HandleToUint64(dev_data->device), __LINE__, DRAWSTATE_SWAPCHAIN_ALREADY_EXISTS, "DS",
"%s: surface has an existing swapchain other than oldSwapchain", func_name))
return true;
}
if (old_swapchain_state && old_swapchain_state->createInfo.surface != pCreateInfo->surface) {
if (log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_SWAPCHAIN_KHR_EXT,
- reinterpret_cast<uint64_t const &>(pCreateInfo->oldSwapchain), __LINE__, DRAWSTATE_SWAPCHAIN_WRONG_SURFACE,
- "DS", "%s: pCreateInfo->oldSwapchain's surface is not pCreateInfo->surface", func_name))
+ HandleToUint64(pCreateInfo->oldSwapchain), __LINE__, DRAWSTATE_SWAPCHAIN_WRONG_SURFACE, "DS",
+ "%s: pCreateInfo->oldSwapchain's surface is not pCreateInfo->surface", func_name))
return true;
}
auto physical_device_state = GetPhysicalDeviceState(dev_data->instance_data, dev_data->physical_device);
if (physical_device_state->vkGetPhysicalDeviceSurfaceCapabilitiesKHRState == UNCALLED) {
if (log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_PHYSICAL_DEVICE_EXT,
- reinterpret_cast<uint64_t>(dev_data->physical_device), __LINE__, DRAWSTATE_SWAPCHAIN_CREATE_BEFORE_QUERY, "DS",
+ HandleToUint64(dev_data->physical_device), __LINE__, DRAWSTATE_SWAPCHAIN_CREATE_BEFORE_QUERY, "DS",
"%s: surface capabilities not retrieved for this physical device", func_name))
return true;
} else { // have valid capabilities
@@ -10142,7 +10120,7 @@ static bool PreCallValidateCreateSwapchainKHR(layer_data *dev_data, const char *
// Validate pCreateInfo->minImageCount against VkSurfaceCapabilitiesKHR::{min|max}ImageCount:
if (pCreateInfo->minImageCount < capabilities.minImageCount) {
if (log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT,
- reinterpret_cast<uint64_t>(dev_data->device), __LINE__, VALIDATION_ERROR_02331, "DS",
+ HandleToUint64(dev_data->device), __LINE__, VALIDATION_ERROR_02331, "DS",
"%s called with minImageCount = %d, which is outside the bounds returned "
"by vkGetPhysicalDeviceSurfaceCapabilitiesKHR() (i.e. minImageCount = %d, maxImageCount = %d). %s",
func_name, pCreateInfo->minImageCount, capabilities.minImageCount, capabilities.maxImageCount,
@@ -10152,7 +10130,7 @@ static bool PreCallValidateCreateSwapchainKHR(layer_data *dev_data, const char *
if ((capabilities.maxImageCount > 0) && (pCreateInfo->minImageCount > capabilities.maxImageCount)) {
if (log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT,
- reinterpret_cast<uint64_t>(dev_data->device), __LINE__, VALIDATION_ERROR_02332, "DS",
+ HandleToUint64(dev_data->device), __LINE__, VALIDATION_ERROR_02332, "DS",
"%s called with minImageCount = %d, which is outside the bounds returned "
"by vkGetPhysicalDeviceSurfaceCapabilitiesKHR() (i.e. minImageCount = %d, maxImageCount = %d). %s",
func_name, pCreateInfo->minImageCount, capabilities.minImageCount, capabilities.maxImageCount,
@@ -10167,7 +10145,7 @@ static bool PreCallValidateCreateSwapchainKHR(layer_data *dev_data, const char *
(pCreateInfo->imageExtent.height < capabilities.minImageExtent.height) ||
(pCreateInfo->imageExtent.height > capabilities.maxImageExtent.height))) {
if (log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT,
- reinterpret_cast<uint64_t>(dev_data->device), __LINE__, VALIDATION_ERROR_02334, "DS",
+ HandleToUint64(dev_data->device), __LINE__, VALIDATION_ERROR_02334, "DS",
"%s called with imageExtent = (%d,%d), which is outside the bounds returned by "
"vkGetPhysicalDeviceSurfaceCapabilitiesKHR(): currentExtent = (%d,%d), minImageExtent = (%d,%d), "
"maxImageExtent = (%d,%d). %s",
@@ -10199,8 +10177,8 @@ static bool PreCallValidateCreateSwapchainKHR(layer_data *dev_data, const char *
}
// Log the message that we've built up:
if (log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT,
- reinterpret_cast<uint64_t &>(dev_data->device), __LINE__, VALIDATION_ERROR_02339, "DS", "%s. %s",
- errorString.c_str(), validation_error_map[VALIDATION_ERROR_02339]))
+ HandleToUint64(dev_data->device), __LINE__, VALIDATION_ERROR_02339, "DS", "%s. %s", errorString.c_str(),
+ validation_error_map[VALIDATION_ERROR_02339]))
return true;
}
@@ -10226,14 +10204,14 @@ static bool PreCallValidateCreateSwapchainKHR(layer_data *dev_data, const char *
}
// Log the message that we've built up:
if (log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT,
- reinterpret_cast<uint64_t &>(dev_data->device), __LINE__, VALIDATION_ERROR_02340, "DS", "%s. %s",
- errorString.c_str(), validation_error_map[VALIDATION_ERROR_02340]))
+ HandleToUint64(dev_data->device), __LINE__, VALIDATION_ERROR_02340, "DS", "%s. %s", errorString.c_str(),
+ validation_error_map[VALIDATION_ERROR_02340]))
return true;
}
// Validate pCreateInfo->imageArrayLayers against VkSurfaceCapabilitiesKHR::maxImageArrayLayers:
if ((pCreateInfo->imageArrayLayers < 1) || (pCreateInfo->imageArrayLayers > capabilities.maxImageArrayLayers)) {
if (log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT,
- reinterpret_cast<uint64_t>(dev_data->device), __LINE__, VALIDATION_ERROR_02335, "DS",
+ HandleToUint64(dev_data->device), __LINE__, VALIDATION_ERROR_02335, "DS",
"%s called with a non-supported imageArrayLayers (i.e. %d). Minimum value is 1, maximum value is %d. %s",
func_name, pCreateInfo->imageArrayLayers, capabilities.maxImageArrayLayers,
validation_error_map[VALIDATION_ERROR_02335]))
@@ -10242,7 +10220,7 @@ static bool PreCallValidateCreateSwapchainKHR(layer_data *dev_data, const char *
// Validate pCreateInfo->imageUsage against VkSurfaceCapabilitiesKHR::supportedUsageFlags:
if (pCreateInfo->imageUsage != (pCreateInfo->imageUsage & capabilities.supportedUsageFlags)) {
if (log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT,
- reinterpret_cast<uint64_t>(dev_data->device), __LINE__, VALIDATION_ERROR_02336, "DS",
+ HandleToUint64(dev_data->device), __LINE__, VALIDATION_ERROR_02336, "DS",
"%s called with a non-supported pCreateInfo->imageUsage (i.e. 0x%08x). Supported flag bits are 0x%08x. %s",
func_name, pCreateInfo->imageUsage, capabilities.supportedUsageFlags,
validation_error_map[VALIDATION_ERROR_02336]))
@@ -10253,7 +10231,7 @@ static bool PreCallValidateCreateSwapchainKHR(layer_data *dev_data, const char *
// Validate pCreateInfo values with the results of vkGetPhysicalDeviceSurfaceFormatsKHR():
if (physical_device_state->vkGetPhysicalDeviceSurfaceFormatsKHRState != QUERY_DETAILS) {
if (log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT,
- reinterpret_cast<uint64_t>(dev_data->device), __LINE__, DRAWSTATE_SWAPCHAIN_CREATE_BEFORE_QUERY, "DS",
+ HandleToUint64(dev_data->device), __LINE__, DRAWSTATE_SWAPCHAIN_CREATE_BEFORE_QUERY, "DS",
"%s called before calling vkGetPhysicalDeviceSurfaceFormatsKHR().", func_name))
return true;
} else {
@@ -10278,14 +10256,14 @@ static bool PreCallValidateCreateSwapchainKHR(layer_data *dev_data, const char *
if (!foundMatch) {
if (!foundFormat) {
if (log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT,
- reinterpret_cast<uint64_t>(dev_data->device), __LINE__, VALIDATION_ERROR_02333, "DS",
+ HandleToUint64(dev_data->device), __LINE__, VALIDATION_ERROR_02333, "DS",
"%s called with a non-supported pCreateInfo->imageFormat (i.e. %d). %s", func_name,
pCreateInfo->imageFormat, validation_error_map[VALIDATION_ERROR_02333]))
return true;
}
if (!foundColorSpace) {
if (log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT,
- reinterpret_cast<uint64_t>(dev_data->device), __LINE__, VALIDATION_ERROR_02333, "DS",
+ HandleToUint64(dev_data->device), __LINE__, VALIDATION_ERROR_02333, "DS",
"%s called with a non-supported pCreateInfo->imageColorSpace (i.e. %d). %s", func_name,
pCreateInfo->imageColorSpace, validation_error_map[VALIDATION_ERROR_02333]))
return true;
@@ -10298,7 +10276,7 @@ static bool PreCallValidateCreateSwapchainKHR(layer_data *dev_data, const char *
// FIFO is required to always be supported
if (pCreateInfo->presentMode != VK_PRESENT_MODE_FIFO_KHR) {
if (log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT,
- reinterpret_cast<uint64_t>(dev_data->device), __LINE__, DRAWSTATE_SWAPCHAIN_CREATE_BEFORE_QUERY, "DS",
+ HandleToUint64(dev_data->device), __LINE__, DRAWSTATE_SWAPCHAIN_CREATE_BEFORE_QUERY, "DS",
"%s called before calling vkGetPhysicalDeviceSurfacePresentModesKHR().", func_name))
return true;
}
@@ -10308,7 +10286,7 @@ static bool PreCallValidateCreateSwapchainKHR(layer_data *dev_data, const char *
pCreateInfo->presentMode) != physical_device_state->present_modes.end();
if (!foundMatch) {
if (log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT,
- reinterpret_cast<uint64_t>(dev_data->device), __LINE__, VALIDATION_ERROR_02341, "DS",
+ HandleToUint64(dev_data->device), __LINE__, VALIDATION_ERROR_02341, "DS",
"%s called with a non-supported presentMode (i.e. %s). %s", func_name,
string_VkPresentModeKHR(pCreateInfo->presentMode), validation_error_map[VALIDATION_ERROR_02341]))
return true;
@@ -10397,7 +10375,7 @@ VKAPI_ATTR void VKAPI_CALL DestroySwapchainKHR(VkDevice device, VkSwapchainKHR s
}
dev_data->imageSubresourceMap.erase(image_sub);
}
- skip = ClearMemoryObjectBindings(dev_data, (uint64_t)swapchain_image, kVulkanObjectTypeSwapchainKHR);
+ skip = ClearMemoryObjectBindings(dev_data, HandleToUint64(swapchain_image), kVulkanObjectTypeSwapchainKHR);
dev_data->imageMap.erase(swapchain_image);
}
}
@@ -10432,10 +10410,10 @@ VKAPI_ATTR VkResult VKAPI_CALL GetSwapchainImagesKHR(VkDevice device, VkSwapchai
if (mismatch) {
// TODO: Verify against Valid Usage section of extension
log_msg(dev_data->report_data, VK_DEBUG_REPORT_WARNING_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_SWAPCHAIN_KHR_EXT,
- (uint64_t)swapchain, __LINE__, MEMTRACK_NONE, "SWAP_CHAIN",
+ HandleToUint64(swapchain), __LINE__, MEMTRACK_NONE, "SWAP_CHAIN",
"vkGetSwapchainInfoKHR(0x%" PRIx64
", VK_SWAP_CHAIN_INFO_TYPE_PERSISTENT_IMAGES_KHR) returned mismatching data",
- (uint64_t)(swapchain));
+ HandleToUint64(swapchain));
}
}
for (uint32_t i = 0; i < *pCount; ++i) {
@@ -10482,7 +10460,7 @@ VKAPI_ATTR VkResult VKAPI_CALL QueuePresentKHR(VkQueue queue, const VkPresentInf
skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, 0,
__LINE__, DRAWSTATE_QUEUE_FORWARD_PROGRESS, "DS",
"Queue 0x%p is waiting on semaphore 0x%" PRIx64 " that has no way to be signaled.", queue,
- reinterpret_cast<const uint64_t &>(pPresentInfo->pWaitSemaphores[i]));
+ HandleToUint64(pPresentInfo->pWaitSemaphores[i]));
}
}
@@ -10490,11 +10468,11 @@ VKAPI_ATTR VkResult VKAPI_CALL QueuePresentKHR(VkQueue queue, const VkPresentInf
auto swapchain_data = GetSwapchainNode(dev_data, pPresentInfo->pSwapchains[i]);
if (swapchain_data) {
if (pPresentInfo->pImageIndices[i] >= swapchain_data->images.size()) {
- skip |= log_msg(
- dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_SWAPCHAIN_KHR_EXT,
- reinterpret_cast<uint64_t const &>(pPresentInfo->pSwapchains[i]), __LINE__, DRAWSTATE_SWAPCHAIN_INVALID_IMAGE,
- "DS", "vkQueuePresentKHR: Swapchain image index too large (%u). There are only %u images in this swapchain.",
- pPresentInfo->pImageIndices[i], (uint32_t)swapchain_data->images.size());
+ skip |=
+ log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_SWAPCHAIN_KHR_EXT,
+ HandleToUint64(pPresentInfo->pSwapchains[i]), __LINE__, DRAWSTATE_SWAPCHAIN_INVALID_IMAGE, "DS",
+ "vkQueuePresentKHR: Swapchain image index too large (%u). There are only %u images in this swapchain.",
+ pPresentInfo->pImageIndices[i], (uint32_t)swapchain_data->images.size());
} else {
auto image = swapchain_data->images[pPresentInfo->pImageIndices[i]];
auto image_state = GetImageState(dev_data, image);
@@ -10508,8 +10486,7 @@ VKAPI_ATTR VkResult VKAPI_CALL QueuePresentKHR(VkQueue queue, const VkPresentInf
if (!image_state->acquired) {
skip |= log_msg(
dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_SWAPCHAIN_KHR_EXT,
- reinterpret_cast<uint64_t const &>(pPresentInfo->pSwapchains[i]), __LINE__,
- DRAWSTATE_SWAPCHAIN_IMAGE_NOT_ACQUIRED, "DS",
+ HandleToUint64(pPresentInfo->pSwapchains[i]), __LINE__, DRAWSTATE_SWAPCHAIN_IMAGE_NOT_ACQUIRED, "DS",
"vkQueuePresentKHR: Swapchain image index %u has not been acquired.", pPresentInfo->pImageIndices[i]);
}
@@ -10521,7 +10498,7 @@ VKAPI_ATTR VkResult VKAPI_CALL QueuePresentKHR(VkQueue queue, const VkPresentInf
(layout != VK_IMAGE_LAYOUT_SHARED_PRESENT_KHR))) {
skip |=
log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_QUEUE_EXT,
- reinterpret_cast<uint64_t &>(queue), __LINE__, VALIDATION_ERROR_01964, "DS",
+ HandleToUint64(queue), __LINE__, VALIDATION_ERROR_01964, "DS",
"Images passed to present must be in layout "
"VK_IMAGE_LAYOUT_PRESENT_SRC_KHR or VK_IMAGE_LAYOUT_SHARED_PRESENT_KHR but is in %s. %s",
string_VkImageLayout(layout), validation_error_map[VALIDATION_ERROR_01964]);
@@ -10540,17 +10517,16 @@ VKAPI_ATTR VkResult VKAPI_CALL QueuePresentKHR(VkQueue queue, const VkPresentInf
if (support_it == surface_state->gpu_queue_support.end()) {
skip |=
log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_SWAPCHAIN_KHR_EXT,
- reinterpret_cast<uint64_t const &>(pPresentInfo->pSwapchains[i]), __LINE__,
- DRAWSTATE_SWAPCHAIN_UNSUPPORTED_QUEUE, "DS",
+ HandleToUint64(pPresentInfo->pSwapchains[i]), __LINE__, DRAWSTATE_SWAPCHAIN_UNSUPPORTED_QUEUE, "DS",
"vkQueuePresentKHR: Presenting image without calling "
"vkGetPhysicalDeviceSurfaceSupportKHR");
} else if (!support_it->second) {
- skip |= log_msg(
- dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_SWAPCHAIN_KHR_EXT,
- reinterpret_cast<uint64_t const &>(pPresentInfo->pSwapchains[i]), __LINE__, VALIDATION_ERROR_01961, "DS",
- "vkQueuePresentKHR: Presenting image on queue that cannot "
- "present to this surface. %s",
- validation_error_map[VALIDATION_ERROR_01961]);
+ skip |=
+ log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_SWAPCHAIN_KHR_EXT,
+ HandleToUint64(pPresentInfo->pSwapchains[i]), __LINE__, VALIDATION_ERROR_01961, "DS",
+ "vkQueuePresentKHR: Presenting image on queue that cannot "
+ "present to this surface. %s",
+ validation_error_map[VALIDATION_ERROR_01961]);
}
}
}
@@ -10573,32 +10549,29 @@ VKAPI_ATTR VkResult VKAPI_CALL QueuePresentKHR(VkQueue queue, const VkPresentInf
VkRectLayerKHR rect = region.pRectangles[j];
// TODO: Need to update these errors to their unique error ids when available
if ((rect.offset.x + rect.extent.width) > swapchain_data->createInfo.imageExtent.width) {
- skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT,
- VK_DEBUG_REPORT_OBJECT_TYPE_SWAPCHAIN_KHR_EXT,
- reinterpret_cast<uint64_t const &>(pPresentInfo->pSwapchains[i]), __LINE__,
- DRAWSTATE_SWAPCHAIN_INVALID_IMAGE, "DS",
- "vkQueuePresentKHR(): For VkPresentRegionKHR down pNext "
- "chain, pRegion[%i].pRectangles[%i], the sum of offset.x "
- "(%i) and extent.width (%i) is greater than the "
- "corresponding swapchain's imageExtent.width (%i).",
- i, j, rect.offset.x, rect.extent.width, swapchain_data->createInfo.imageExtent.width);
+ skip |= log_msg(
+ dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_SWAPCHAIN_KHR_EXT,
+ HandleToUint64(pPresentInfo->pSwapchains[i]), __LINE__, DRAWSTATE_SWAPCHAIN_INVALID_IMAGE, "DS",
+ "vkQueuePresentKHR(): For VkPresentRegionKHR down pNext "
+ "chain, pRegion[%i].pRectangles[%i], the sum of offset.x "
+ "(%i) and extent.width (%i) is greater than the "
+ "corresponding swapchain's imageExtent.width (%i).",
+ i, j, rect.offset.x, rect.extent.width, swapchain_data->createInfo.imageExtent.width);
}
if ((rect.offset.y + rect.extent.height) > swapchain_data->createInfo.imageExtent.height) {
- skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT,
- VK_DEBUG_REPORT_OBJECT_TYPE_SWAPCHAIN_KHR_EXT,
- reinterpret_cast<uint64_t const &>(pPresentInfo->pSwapchains[i]), __LINE__,
- DRAWSTATE_SWAPCHAIN_INVALID_IMAGE, "DS",
- "vkQueuePresentKHR(): For VkPresentRegionKHR down pNext "
- "chain, pRegion[%i].pRectangles[%i], the sum of offset.y "
- "(%i) and extent.height (%i) is greater than the "
- "corresponding swapchain's imageExtent.height (%i).",
- i, j, rect.offset.y, rect.extent.height, swapchain_data->createInfo.imageExtent.height);
+ skip |= log_msg(
+ dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_SWAPCHAIN_KHR_EXT,
+ HandleToUint64(pPresentInfo->pSwapchains[i]), __LINE__, DRAWSTATE_SWAPCHAIN_INVALID_IMAGE, "DS",
+ "vkQueuePresentKHR(): For VkPresentRegionKHR down pNext "
+ "chain, pRegion[%i].pRectangles[%i], the sum of offset.y "
+ "(%i) and extent.height (%i) is greater than the "
+ "corresponding swapchain's imageExtent.height (%i).",
+ i, j, rect.offset.y, rect.extent.height, swapchain_data->createInfo.imageExtent.height);
}
if (rect.layer > swapchain_data->createInfo.imageArrayLayers) {
skip |= log_msg(
dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_SWAPCHAIN_KHR_EXT,
- reinterpret_cast<uint64_t const &>(pPresentInfo->pSwapchains[i]), __LINE__,
- DRAWSTATE_SWAPCHAIN_INVALID_IMAGE, "DS",
+ HandleToUint64(pPresentInfo->pSwapchains[i]), __LINE__, DRAWSTATE_SWAPCHAIN_INVALID_IMAGE, "DS",
"vkQueuePresentKHR(): For VkPresentRegionKHR down pNext chain, pRegion[%i].pRectangles[%i], the "
"layer (%i) is greater than the corresponding swapchain's imageArrayLayers (%i).",
i, j, rect.layer, swapchain_data->createInfo.imageArrayLayers);
@@ -10610,7 +10583,7 @@ VKAPI_ATTR VkResult VKAPI_CALL QueuePresentKHR(VkQueue queue, const VkPresentInf
if (pPresentInfo->swapchainCount != present_times_info->swapchainCount) {
skip |=
log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_SWAPCHAIN_KHR_EXT,
- reinterpret_cast<uint64_t const &>(pPresentInfo->pSwapchains[0]), __LINE__,
+ HandleToUint64(pPresentInfo->pSwapchains[0]), __LINE__,
VALIDATION_ERROR_03214, "DS",
"vkQueuePresentKHR(): VkPresentTimesInfoGOOGLE.swapchainCount is %i but "
@@ -10743,7 +10716,7 @@ VKAPI_ATTR VkResult VKAPI_CALL AcquireNextImageKHR(VkDevice device, VkSwapchainK
if (fence == VK_NULL_HANDLE && semaphore == VK_NULL_HANDLE) {
skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT,
- reinterpret_cast<uint64_t &>(device), __LINE__, DRAWSTATE_SWAPCHAIN_NO_SYNC_FOR_ACQUIRE, "DS",
+ HandleToUint64(device), __LINE__, DRAWSTATE_SWAPCHAIN_NO_SYNC_FOR_ACQUIRE, "DS",
"vkAcquireNextImageKHR: Semaphore and fence cannot both be VK_NULL_HANDLE. There would be no way "
"to determine the completion of this operation.");
}
@@ -10751,7 +10724,7 @@ VKAPI_ATTR VkResult VKAPI_CALL AcquireNextImageKHR(VkDevice device, VkSwapchainK
auto pSemaphore = GetSemaphoreNode(dev_data, semaphore);
if (pSemaphore && pSemaphore->signaled) {
skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_SEMAPHORE_EXT,
- reinterpret_cast<const uint64_t &>(semaphore), __LINE__, VALIDATION_ERROR_01952, "DS",
+ HandleToUint64(semaphore), __LINE__, VALIDATION_ERROR_01952, "DS",
"vkAcquireNextImageKHR: Semaphore must not be currently signaled or in a wait state. %s",
validation_error_map[VALIDATION_ERROR_01952]);
}
@@ -10765,7 +10738,7 @@ VKAPI_ATTR VkResult VKAPI_CALL AcquireNextImageKHR(VkDevice device, VkSwapchainK
if (swapchain_data->replaced) {
skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_SWAPCHAIN_KHR_EXT,
- reinterpret_cast<uint64_t &>(swapchain), __LINE__, DRAWSTATE_SWAPCHAIN_REPLACED, "DS",
+ HandleToUint64(swapchain), __LINE__, DRAWSTATE_SWAPCHAIN_REPLACED, "DS",
"vkAcquireNextImageKHR: This swapchain has been replaced. The application can still "
"present any images it has acquired, but cannot acquire any more.");
}
@@ -10777,7 +10750,7 @@ VKAPI_ATTR VkResult VKAPI_CALL AcquireNextImageKHR(VkDevice device, VkSwapchainK
if (acquired_images > swapchain_data->images.size() - physical_device_state->surfaceCapabilities.minImageCount) {
skip |=
log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_SWAPCHAIN_KHR_EXT,
- reinterpret_cast<uint64_t const &>(swapchain), __LINE__, DRAWSTATE_SWAPCHAIN_TOO_MANY_IMAGES, "DS",
+ HandleToUint64(swapchain), __LINE__, DRAWSTATE_SWAPCHAIN_TOO_MANY_IMAGES, "DS",
"vkAcquireNextImageKHR: Application has already acquired the maximum number of images (0x%" PRIxLEAST64 ")",
acquired_images);
}
@@ -10785,7 +10758,7 @@ VKAPI_ATTR VkResult VKAPI_CALL AcquireNextImageKHR(VkDevice device, VkSwapchainK
if (swapchain_data->images.size() == 0) {
skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_WARNING_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_SWAPCHAIN_KHR_EXT,
- reinterpret_cast<uint64_t const &>(swapchain), __LINE__, DRAWSTATE_SWAPCHAIN_IMAGES_NOT_FOUND, "DS",
+ HandleToUint64(swapchain), __LINE__, DRAWSTATE_SWAPCHAIN_IMAGES_NOT_FOUND, "DS",
"vkAcquireNextImageKHR: No images found to acquire from. Application probably did not call "
"vkGetSwapchainImagesKHR after swapchain creation.");
}
@@ -10876,7 +10849,7 @@ static bool ValidateCommonGetPhysicalDeviceQueueFamilyProperties(instance_layer_
if (UNCALLED == pd_state->vkGetPhysicalDeviceQueueFamilyPropertiesState) {
skip |= log_msg(
instance_data->report_data, VK_DEBUG_REPORT_WARNING_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_PHYSICAL_DEVICE_EXT,
- reinterpret_cast<uint64_t>(pd_state->phys_device), __LINE__, DEVLIMITS_MISSING_QUERY_COUNT, "DL",
+ HandleToUint64(pd_state->phys_device), __LINE__, DEVLIMITS_MISSING_QUERY_COUNT, "DL",
"%s is called with non-NULL pQueueFamilyProperties before obtaining pQueueFamilyPropertyCount. It is recommended "
"to first call %s with NULL pQueueFamilyProperties in order to obtain the maximal pQueueFamilyPropertyCount.",
caller_name, caller_name);
@@ -10884,7 +10857,7 @@ static bool ValidateCommonGetPhysicalDeviceQueueFamilyProperties(instance_layer_
} else if (pd_state->queue_family_count != requested_queue_family_property_count) {
skip |= log_msg(
instance_data->report_data, VK_DEBUG_REPORT_WARNING_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_PHYSICAL_DEVICE_EXT,
- reinterpret_cast<uint64_t>(pd_state->phys_device), __LINE__, DEVLIMITS_COUNT_MISMATCH, "DL",
+ HandleToUint64(pd_state->phys_device), __LINE__, DEVLIMITS_COUNT_MISMATCH, "DL",
"%s is called with non-NULL pQueueFamilyProperties and pQueueFamilyPropertyCount value %" PRIu32
", but the largest previously returned pQueueFamilyPropertyCount for this physicalDevice is %" PRIu32
". It is recommended to instead receive all the properties by calling %s with pQueueFamilyPropertyCount that was "
@@ -11255,7 +11228,7 @@ VKAPI_ATTR VkResult VKAPI_CALL GetPhysicalDeviceSurfacePresentModesKHR(VkPhysica
case UNCALLED:
skip |= log_msg(
instance_data->report_data, VK_DEBUG_REPORT_WARNING_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_PHYSICAL_DEVICE_EXT,
- reinterpret_cast<uint64_t>(physicalDevice), __LINE__, DEVLIMITS_MUST_QUERY_COUNT, "DL",
+ HandleToUint64(physicalDevice), __LINE__, DEVLIMITS_MUST_QUERY_COUNT, "DL",
"vkGetPhysicalDeviceSurfacePresentModesKHR() called with non-NULL pPresentModeCount; but no prior positive "
"value has been seen for pPresentModeCount.");
break;
@@ -11263,8 +11236,8 @@ VKAPI_ATTR VkResult VKAPI_CALL GetPhysicalDeviceSurfacePresentModesKHR(VkPhysica
// both query count and query details
if (*pPresentModeCount != prev_mode_count) {
skip |= log_msg(instance_data->report_data, VK_DEBUG_REPORT_WARNING_BIT_EXT,
- VK_DEBUG_REPORT_OBJECT_TYPE_PHYSICAL_DEVICE_EXT, reinterpret_cast<uint64_t>(physicalDevice),
- __LINE__, DEVLIMITS_COUNT_MISMATCH, "DL",
+ VK_DEBUG_REPORT_OBJECT_TYPE_PHYSICAL_DEVICE_EXT, HandleToUint64(physicalDevice), __LINE__,
+ DEVLIMITS_COUNT_MISMATCH, "DL",
"vkGetPhysicalDeviceSurfacePresentModesKHR() called with *pPresentModeCount (%u) that "
"differs from the value "
"(%u) that was returned when pPresentModes was NULL.",
@@ -11318,7 +11291,7 @@ VKAPI_ATTR VkResult VKAPI_CALL GetPhysicalDeviceSurfaceFormatsKHR(VkPhysicalDevi
// previously call this function with a NULL value of pSurfaceFormats:
skip |= log_msg(
instance_data->report_data, VK_DEBUG_REPORT_WARNING_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_PHYSICAL_DEVICE_EXT,
- reinterpret_cast<uint64_t>(physicalDevice), __LINE__, DEVLIMITS_MUST_QUERY_COUNT, "DL",
+ HandleToUint64(physicalDevice), __LINE__, DEVLIMITS_MUST_QUERY_COUNT, "DL",
"vkGetPhysicalDeviceSurfaceFormatsKHR() called with non-NULL pSurfaceFormatCount; but no prior positive "
"value has been seen for pSurfaceFormats.");
break;
@@ -11326,7 +11299,7 @@ VKAPI_ATTR VkResult VKAPI_CALL GetPhysicalDeviceSurfaceFormatsKHR(VkPhysicalDevi
if (prev_format_count != *pSurfaceFormatCount) {
skip |= log_msg(
instance_data->report_data, VK_DEBUG_REPORT_WARNING_BIT_EXT,
- VK_DEBUG_REPORT_OBJECT_TYPE_PHYSICAL_DEVICE_EXT, reinterpret_cast<uint64_t>(physicalDevice), __LINE__,
+ VK_DEBUG_REPORT_OBJECT_TYPE_PHYSICAL_DEVICE_EXT, HandleToUint64(physicalDevice), __LINE__,
DEVLIMITS_COUNT_MISMATCH, "DL",
"vkGetPhysicalDeviceSurfaceFormatsKHR() called with non-NULL pSurfaceFormatCount, and with pSurfaceFormats "
"set "
@@ -11470,8 +11443,9 @@ VKAPI_ATTR VkResult VKAPI_CALL EnumeratePhysicalDeviceGroupsKHX(
return result;
} else {
log_msg(instance_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_INSTANCE_EXT, 0, __LINE__,
- DEVLIMITS_INVALID_INSTANCE, "DL",
- "Invalid instance (0x%" PRIxLEAST64 ") passed into vkEnumeratePhysicalDeviceGroupsKHX().", (uint64_t)instance);
+ DEVLIMITS_INVALID_INSTANCE, "DL",
+ "Invalid instance (0x%" PRIxLEAST64 ") passed into vkEnumeratePhysicalDeviceGroupsKHX().",
+ HandleToUint64(instance));
}
return VK_ERROR_VALIDATION_FAILED_EXT;
}