Skip to content

Commit

Permalink
icd: Fix DEVICE_LOST injection null check
Browse files Browse the repository at this point in the history
  • Loading branch information
spencer-lunarg committed Mar 19, 2024
1 parent e5f1de8 commit 4f22ec3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
8 changes: 5 additions & 3 deletions icd/generated/function_definitions.h
Original file line number Diff line number Diff line change
Expand Up @@ -381,9 +381,11 @@ static VKAPI_ATTR VkResult VKAPI_CALL QueueSubmit(
// Picked VkExportFenceCreateInfo because needed some struct that wouldn't get cleared by validation Safe Struct
// ... TODO - It would be MUCH nicer to have a layer or other setting control when this occured
// For now this is used to allow Validation Layers test reacting to device losts
auto pNext = reinterpret_cast<const VkBaseInStructure *>(pSubmits[0].pNext);
if (pNext && pNext->sType == VK_STRUCTURE_TYPE_EXPORT_FENCE_CREATE_INFO && pNext->pNext == nullptr) {
return VK_ERROR_DEVICE_LOST;
if (submitCount > 0 && pSubmits) {
auto pNext = reinterpret_cast<const VkBaseInStructure *>(pSubmits[0].pNext);
if (pNext && pNext->sType == VK_STRUCTURE_TYPE_EXPORT_FENCE_CREATE_INFO && pNext->pNext == nullptr) {
return VK_ERROR_DEVICE_LOST;
}
}
return VK_SUCCESS;
}
Expand Down
8 changes: 5 additions & 3 deletions scripts/mock_icd_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -1659,9 +1659,11 @@
// Picked VkExportFenceCreateInfo because needed some struct that wouldn't get cleared by validation Safe Struct
// ... TODO - It would be MUCH nicer to have a layer or other setting control when this occured
// For now this is used to allow Validation Layers test reacting to device losts
auto pNext = reinterpret_cast<const VkBaseInStructure *>(pSubmits[0].pNext);
if (pNext && pNext->sType == VK_STRUCTURE_TYPE_EXPORT_FENCE_CREATE_INFO && pNext->pNext == nullptr) {
return VK_ERROR_DEVICE_LOST;
if (submitCount > 0 && pSubmits) {
auto pNext = reinterpret_cast<const VkBaseInStructure *>(pSubmits[0].pNext);
if (pNext && pNext->sType == VK_STRUCTURE_TYPE_EXPORT_FENCE_CREATE_INFO && pNext->pNext == nullptr) {
return VK_ERROR_DEVICE_LOST;
}
}
return VK_SUCCESS;
''',
Expand Down

0 comments on commit 4f22ec3

Please sign in to comment.