Skip to content

Commit

Permalink
bp: Move PreCallRecord to PostCallRecord
Browse files Browse the repository at this point in the history
  • Loading branch information
spencer-lunarg committed Jul 21, 2024
1 parent 69d78b7 commit 4316d68
Show file tree
Hide file tree
Showing 7 changed files with 269 additions and 325 deletions.
115 changes: 49 additions & 66 deletions layers/best_practices/best_practices_validation.h

Large diffs are not rendered by default.

24 changes: 12 additions & 12 deletions layers/best_practices/bp_cmd_buffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,9 +160,9 @@ bool BestPractices::PreCallValidateGetQueryPoolResults(VkDevice device, VkQueryP
return skip;
}

void BestPractices::PreCallRecordCmdSetDepthCompareOp(VkCommandBuffer commandBuffer, VkCompareOp depthCompareOp,
const RecordObject& record_obj) {
StateTracker::PreCallRecordCmdSetDepthCompareOp(commandBuffer, depthCompareOp, record_obj);
void BestPractices::PostCallRecordCmdSetDepthCompareOp(VkCommandBuffer commandBuffer, VkCompareOp depthCompareOp,
const RecordObject& record_obj) {
StateTracker::PostCallRecordCmdSetDepthCompareOp(commandBuffer, depthCompareOp, record_obj);

auto cb_state = GetWrite<bp_state::CommandBuffer>(commandBuffer);

Expand All @@ -171,14 +171,14 @@ void BestPractices::PreCallRecordCmdSetDepthCompareOp(VkCommandBuffer commandBuf
}
}

void BestPractices::PreCallRecordCmdSetDepthCompareOpEXT(VkCommandBuffer commandBuffer, VkCompareOp depthCompareOp,
const RecordObject& record_obj) {
PreCallRecordCmdSetDepthCompareOp(commandBuffer, depthCompareOp, record_obj);
void BestPractices::PostCallRecordCmdSetDepthCompareOpEXT(VkCommandBuffer commandBuffer, VkCompareOp depthCompareOp,
const RecordObject& record_obj) {
PostCallRecordCmdSetDepthCompareOp(commandBuffer, depthCompareOp, record_obj);
}

void BestPractices::PreCallRecordCmdSetDepthTestEnable(VkCommandBuffer commandBuffer, VkBool32 depthTestEnable,
const RecordObject& record_obj) {
StateTracker::PreCallRecordCmdSetDepthTestEnable(commandBuffer, depthTestEnable, record_obj);
void BestPractices::PostCallRecordCmdSetDepthTestEnable(VkCommandBuffer commandBuffer, VkBool32 depthTestEnable,
const RecordObject& record_obj) {
StateTracker::PostCallRecordCmdSetDepthTestEnable(commandBuffer, depthTestEnable, record_obj);

auto cb_state = GetWrite<bp_state::CommandBuffer>(commandBuffer);

Expand All @@ -187,9 +187,9 @@ void BestPractices::PreCallRecordCmdSetDepthTestEnable(VkCommandBuffer commandBu
}
}

void BestPractices::PreCallRecordCmdSetDepthTestEnableEXT(VkCommandBuffer commandBuffer, VkBool32 depthTestEnable,
const RecordObject& record_obj) {
PreCallRecordCmdSetDepthTestEnable(commandBuffer, depthTestEnable, record_obj);
void BestPractices::PostCallRecordCmdSetDepthTestEnableEXT(VkCommandBuffer commandBuffer, VkBool32 depthTestEnable,
const RecordObject& record_obj) {
PostCallRecordCmdSetDepthTestEnable(commandBuffer, depthTestEnable, record_obj);
}

namespace {
Expand Down
72 changes: 37 additions & 35 deletions layers/best_practices/bp_copy_blit_resolve.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@
#include "best_practices/bp_state.h"
#include "state_tracker/render_pass_state.h"

void BestPractices::PreCallRecordCmdClearAttachments(VkCommandBuffer commandBuffer, uint32_t attachmentCount,
const VkClearAttachment* pClearAttachments, uint32_t rectCount,
const VkClearRect* pRects, const RecordObject& record_obj) {
ValidationStateTracker::PreCallRecordCmdClearAttachments(commandBuffer, attachmentCount, pClearAttachments, rectCount, pRects,
record_obj);
void BestPractices::PostCallRecordCmdClearAttachments(VkCommandBuffer commandBuffer, uint32_t attachmentCount,
const VkClearAttachment* pClearAttachments, uint32_t rectCount,
const VkClearRect* pRects, const RecordObject& record_obj) {
ValidationStateTracker::PostCallRecordCmdClearAttachments(commandBuffer, attachmentCount, pClearAttachments, rectCount, pRects,
record_obj);

auto cb_state = GetWrite<bp_state::CommandBuffer>(commandBuffer);
auto* rp_state = cb_state->activeRenderPass.get();
Expand Down Expand Up @@ -375,9 +375,9 @@ bool BestPractices::PreCallValidateCmdResolveImage2(VkCommandBuffer commandBuffe
return skip;
}

void BestPractices::PreCallRecordCmdResolveImage(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout,
VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount,
const VkImageResolve* pRegions, const RecordObject& record_obj) {
void BestPractices::PostCallRecordCmdResolveImage(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout,
VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount,
const VkImageResolve* pRegions, const RecordObject& record_obj) {
auto cb_state = GetWrite<bp_state::CommandBuffer>(commandBuffer);
auto& funcs = cb_state->queue_submit_functions;
auto src = Get<bp_state::Image>(srcImage);
Expand All @@ -391,13 +391,14 @@ void BestPractices::PreCallRecordCmdResolveImage(VkCommandBuffer commandBuffer,
}
}

void BestPractices::PreCallRecordCmdResolveImage2KHR(VkCommandBuffer commandBuffer, const VkResolveImageInfo2KHR* pResolveImageInfo,
const RecordObject& record_obj) {
PreCallRecordCmdResolveImage2(commandBuffer, pResolveImageInfo, record_obj);
void BestPractices::PostCallRecordCmdResolveImage2KHR(VkCommandBuffer commandBuffer,
const VkResolveImageInfo2KHR* pResolveImageInfo,
const RecordObject& record_obj) {
PostCallRecordCmdResolveImage2(commandBuffer, pResolveImageInfo, record_obj);
}

void BestPractices::PreCallRecordCmdResolveImage2(VkCommandBuffer commandBuffer, const VkResolveImageInfo2* pResolveImageInfo,
const RecordObject& record_obj) {
void BestPractices::PostCallRecordCmdResolveImage2(VkCommandBuffer commandBuffer, const VkResolveImageInfo2* pResolveImageInfo,
const RecordObject& record_obj) {
auto cb_state = GetWrite<bp_state::CommandBuffer>(commandBuffer);
auto& funcs = cb_state->queue_submit_functions;
auto src = Get<bp_state::Image>(pResolveImageInfo->srcImage);
Expand All @@ -412,9 +413,9 @@ void BestPractices::PreCallRecordCmdResolveImage2(VkCommandBuffer commandBuffer,
}
}

void BestPractices::PreCallRecordCmdClearColorImage(VkCommandBuffer commandBuffer, VkImage image, VkImageLayout imageLayout,
const VkClearColorValue* pColor, uint32_t rangeCount,
const VkImageSubresourceRange* pRanges, const RecordObject& record_obj) {
void BestPractices::PostCallRecordCmdClearColorImage(VkCommandBuffer commandBuffer, VkImage image, VkImageLayout imageLayout,
const VkClearColorValue* pColor, uint32_t rangeCount,
const VkImageSubresourceRange* pRanges, const RecordObject& record_obj) {
auto cb_state = GetWrite<bp_state::CommandBuffer>(commandBuffer);
auto& funcs = cb_state->queue_submit_functions;
auto dst = Get<bp_state::Image>(image);
Expand All @@ -428,11 +429,12 @@ void BestPractices::PreCallRecordCmdClearColorImage(VkCommandBuffer commandBuffe
}
}

void BestPractices::PreCallRecordCmdClearDepthStencilImage(VkCommandBuffer commandBuffer, VkImage image, VkImageLayout imageLayout,
const VkClearDepthStencilValue* pDepthStencil, uint32_t rangeCount,
const VkImageSubresourceRange* pRanges, const RecordObject& record_obj) {
ValidationStateTracker::PreCallRecordCmdClearDepthStencilImage(commandBuffer, image, imageLayout, pDepthStencil, rangeCount,
pRanges, record_obj);
void BestPractices::PostCallRecordCmdClearDepthStencilImage(VkCommandBuffer commandBuffer, VkImage image, VkImageLayout imageLayout,
const VkClearDepthStencilValue* pDepthStencil, uint32_t rangeCount,
const VkImageSubresourceRange* pRanges,
const RecordObject& record_obj) {
ValidationStateTracker::PostCallRecordCmdClearDepthStencilImage(commandBuffer, image, imageLayout, pDepthStencil, rangeCount,
pRanges, record_obj);

auto cb_state = GetWrite<bp_state::CommandBuffer>(commandBuffer);
auto& funcs = cb_state->queue_submit_functions;
Expand All @@ -448,11 +450,11 @@ void BestPractices::PreCallRecordCmdClearDepthStencilImage(VkCommandBuffer comma
}
}

void BestPractices::PreCallRecordCmdCopyImage(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout,
VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount,
const VkImageCopy* pRegions, const RecordObject& record_obj) {
ValidationStateTracker::PreCallRecordCmdCopyImage(commandBuffer, srcImage, srcImageLayout, dstImage, dstImageLayout,
regionCount, pRegions, record_obj);
void BestPractices::PostCallRecordCmdCopyImage(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout,
VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount,
const VkImageCopy* pRegions, const RecordObject& record_obj) {
ValidationStateTracker::PostCallRecordCmdCopyImage(commandBuffer, srcImage, srcImageLayout, dstImage, dstImageLayout,
regionCount, pRegions, record_obj);

auto cb_state = GetWrite<bp_state::CommandBuffer>(commandBuffer);
auto& funcs = cb_state->queue_submit_functions;
Expand All @@ -467,9 +469,9 @@ void BestPractices::PreCallRecordCmdCopyImage(VkCommandBuffer commandBuffer, VkI
}
}

void BestPractices::PreCallRecordCmdCopyBufferToImage(VkCommandBuffer commandBuffer, VkBuffer srcBuffer, VkImage dstImage,
VkImageLayout dstImageLayout, uint32_t regionCount,
const VkBufferImageCopy* pRegions, const RecordObject& record_obj) {
void BestPractices::PostCallRecordCmdCopyBufferToImage(VkCommandBuffer commandBuffer, VkBuffer srcBuffer, VkImage dstImage,
VkImageLayout dstImageLayout, uint32_t regionCount,
const VkBufferImageCopy* pRegions, const RecordObject& record_obj) {
auto cb_state = GetWrite<bp_state::CommandBuffer>(commandBuffer);
auto& funcs = cb_state->queue_submit_functions;
auto dst = Get<bp_state::Image>(dstImage);
Expand All @@ -480,9 +482,9 @@ void BestPractices::PreCallRecordCmdCopyBufferToImage(VkCommandBuffer commandBuf
}
}

void BestPractices::PreCallRecordCmdCopyImageToBuffer(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout,
VkBuffer dstBuffer, uint32_t regionCount, const VkBufferImageCopy* pRegions,
const RecordObject& record_obj) {
void BestPractices::PostCallRecordCmdCopyImageToBuffer(VkCommandBuffer commandBuffer, VkImage srcImage,
VkImageLayout srcImageLayout, VkBuffer dstBuffer, uint32_t regionCount,
const VkBufferImageCopy* pRegions, const RecordObject& record_obj) {
auto cb_state = GetWrite<bp_state::CommandBuffer>(commandBuffer);
auto& funcs = cb_state->queue_submit_functions;
auto src = Get<bp_state::Image>(srcImage);
Expand All @@ -493,9 +495,9 @@ void BestPractices::PreCallRecordCmdCopyImageToBuffer(VkCommandBuffer commandBuf
}
}

void BestPractices::PreCallRecordCmdBlitImage(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout,
VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount,
const VkImageBlit* pRegions, VkFilter filter, const RecordObject& record_obj) {
void BestPractices::PostCallRecordCmdBlitImage(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout,
VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount,
const VkImageBlit* pRegions, VkFilter filter, const RecordObject& record_obj) {
auto cb_state = GetWrite<bp_state::CommandBuffer>(commandBuffer);
auto& funcs = cb_state->queue_submit_functions;
auto src = Get<bp_state::Image>(srcImage);
Expand Down
4 changes: 2 additions & 2 deletions layers/best_practices/bp_device_memory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -280,8 +280,8 @@ bool BestPractices::PreCallValidateBindImageMemory2KHR(VkDevice device, uint32_t
return PreCallValidateBindImageMemory2(device, bindInfoCount, pBindInfos, error_obj);
}

void BestPractices::PreCallRecordSetDeviceMemoryPriorityEXT(VkDevice device, VkDeviceMemory memory, float priority,
const RecordObject& record_obj) {
void BestPractices::PostCallRecordSetDeviceMemoryPriorityEXT(VkDevice device, VkDeviceMemory memory, float priority,
const RecordObject& record_obj) {
auto mem_info = std::static_pointer_cast<bp_state::DeviceMemory>(Get<vvl::DeviceMemory>(memory));
mem_info->dynamic_priority.emplace(priority);
}
Expand Down
Loading

0 comments on commit 4316d68

Please sign in to comment.