summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Gebben <jeremyg@lunarg.com>2022-02-22 10:55:48 -0700
committerjeremyg-lunarg <jeremyg@lunarg.com>2022-02-28 10:52:31 -0700
commitf57d844b59db441c40d4c2214e4c8bcf0cf7b7f6 (patch)
treedee8bb3b6b38b5922c4db7f0c0d5d621acfec06a
parentfca381ce15a847fc2bfd4eb1a72f4119e9b43d32 (diff)
downloadVulkan-ValidationLayers-f57d844b59db441c40d4c2214e4c8bcf0cf7b7f6.tar.gz
Vulkan-ValidationLayers-f57d844b59db441c40d4c2214e4c8bcf0cf7b7f6.tar.bz2
Vulkan-ValidationLayers-f57d844b59db441c40d4c2214e4c8bcf0cf7b7f6.zip
layers: Track objects in the accel struct <-> memory copies
Add tracking for vkCmdCopyMemoryToAccelerationStructureKHR() and vkCmdCopyMemoryToAccelerationStructureKHR().
-rw-r--r--layers/state_tracker.cpp32
-rw-r--r--layers/state_tracker.h4
2 files changed, 36 insertions, 0 deletions
diff --git a/layers/state_tracker.cpp b/layers/state_tracker.cpp
index dabe1209c..f9b02c497 100644
--- a/layers/state_tracker.cpp
+++ b/layers/state_tracker.cpp
@@ -4178,6 +4178,38 @@ void ValidationStateTracker::PostCallRecordCmdCopyAccelerationStructureKHR(VkCom
}
}
+void ValidationStateTracker::PostCallRecordCmdCopyAccelerationStructureToMemoryKHR(
+ VkCommandBuffer commandBuffer, const VkCopyAccelerationStructureToMemoryInfoKHR *pInfo) {
+ auto cb_state = GetWrite<CMD_BUFFER_STATE>(commandBuffer);
+ if (cb_state) {
+ cb_state->RecordCmd(CMD_COPYACCELERATIONSTRUCTURETOMEMORYKHR);
+ auto src_as_state = Get<ACCELERATION_STRUCTURE_STATE_KHR>(pInfo->src);
+ if (!disabled[command_buffer_state]) {
+ cb_state->AddChild(src_as_state);
+ }
+ auto iter = buffer_address_map_.find(pInfo->dst.deviceAddress);
+ if (iter != buffer_address_map_.end()) {
+ cb_state->AddChild(iter->second);
+ }
+ }
+}
+
+void ValidationStateTracker::PostCallRecordCmdCopyMemoryToAccelerationStructureKHR(
+ VkCommandBuffer commandBuffer, const VkCopyMemoryToAccelerationStructureInfoKHR *pInfo) {
+ auto cb_state = GetWrite<CMD_BUFFER_STATE>(commandBuffer);
+ if (cb_state) {
+ cb_state->RecordCmd(CMD_COPYMEMORYTOACCELERATIONSTRUCTUREKHR);
+ if (!disabled[command_buffer_state]) {
+ auto iter = buffer_address_map_.find(pInfo->src.deviceAddress);
+ if (iter != buffer_address_map_.end()) {
+ cb_state->AddChild(iter->second);
+ }
+ auto dst_as_state = Get<ACCELERATION_STRUCTURE_STATE_KHR>(pInfo->dst);
+ cb_state->AddChild(dst_as_state);
+ }
+ }
+}
+
void ValidationStateTracker::PreCallRecordCmdSetCullModeEXT(VkCommandBuffer commandBuffer, VkCullModeFlags cullMode) {
auto cb_state = GetWrite<CMD_BUFFER_STATE>(commandBuffer);
cb_state->RecordStateCmd(CMD_SETCULLMODEEXT, CBSTATUS_CULL_MODE_SET);
diff --git a/layers/state_tracker.h b/layers/state_tracker.h
index 6f5465369..f939d4353 100644
--- a/layers/state_tracker.h
+++ b/layers/state_tracker.h
@@ -1078,6 +1078,10 @@ class ValidationStateTracker : public ValidationObject {
const VkCopyAccelerationStructureInfoKHR* pInfo, VkResult result) override;
void PostCallRecordCmdCopyAccelerationStructureKHR(VkCommandBuffer commandBuffer,
const VkCopyAccelerationStructureInfoKHR* pInfo) override;
+ void PostCallRecordCmdCopyAccelerationStructureToMemoryKHR(VkCommandBuffer commandBuffer,
+ const VkCopyAccelerationStructureToMemoryInfoKHR* pInfo) override;
+ void PostCallRecordCmdCopyMemoryToAccelerationStructureKHR(VkCommandBuffer commandBuffer,
+ const VkCopyMemoryToAccelerationStructureInfoKHR* pInfo) override;
void PreCallRecordCmdSetCullMode(VkCommandBuffer commandBuffer, VkCullModeFlags cullMode) override;
void PreCallRecordCmdSetCullModeEXT(VkCommandBuffer commandBuffer, VkCullModeFlags cullMode) override;
void PreCallRecordCmdSetFrontFace(VkCommandBuffer commandBuffer, VkFrontFace frontFace) override;