Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Relax command buffe validity check in vulkan state writer #1854

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 63 additions & 0 deletions framework/encode/vulkan_state_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,69 @@ enum CommandHandleType : uint32_t
NumHandleTypes // THIS MUST BE THE LAST ENUM VALUE !
};

static const char* CommandHandleTypeToStr(CommandHandleType type)
{
switch (type)
{
case BufferHandle:
return GFXRECON_STR(BufferHandle);
case BufferViewHandle:
return GFXRECON_STR(BufferViewHandle);
case CommandBufferHandle:
return GFXRECON_STR(CommandBufferHandle);
case DescriptorSetHandle:
return GFXRECON_STR(DescriptorSetHandle);
case EventHandle:
return GFXRECON_STR(EventHandle);
case FramebufferHandle:
return GFXRECON_STR(FramebufferHandle);
case ImageHandle:
return GFXRECON_STR(ImageHandle);
case ImageViewHandle:
return GFXRECON_STR(ImageViewHandle);
case PipelineHandle:
return GFXRECON_STR(PipelineHandle);
case PipelineLayoutHandle:
return GFXRECON_STR(PipelineLayoutHandle);
case QueryPoolHandle:
return GFXRECON_STR(QueryPoolHandle);
case RenderPassHandle:
return GFXRECON_STR(RenderPassHandle);
case SamplerHandle:
return GFXRECON_STR(SamplerHandle);
case AccelerationStructureKHRHandle:
return GFXRECON_STR(AccelerationStructureKHRHandle);
case AccelerationStructureNVHandle:
return GFXRECON_STR(AccelerationStructureNVHandle);
case IndirectCommandsLayoutNVHandle:
return GFXRECON_STR(IndirectCommandsLayoutNVHandle);
case DeferredOperationKHRHandle:
return GFXRECON_STR(DeferredOperationKHRHandle);
case MicromapEXTHandle:
return GFXRECON_STR(MicromapEXTHandle);
case OpticalFlowSessionNVHandle:
return GFXRECON_STR(OpticalFlowSessionNVHandle);
case VideoSessionKHRHandle:
return GFXRECON_STR(VideoSessionKHRHandle);
case VideoSessionParametersKHRHandle:
return GFXRECON_STR(VideoSessionParametersKHRHandle);
case ShaderEXTHandle:
return GFXRECON_STR(ShaderEXTHandle);
case DescriptorSetLayoutHandle:
return GFXRECON_STR(DescriptorSetLayoutHandle);
case DescriptorUpdateTemplateHandle:
return GFXRECON_STR(DescriptorUpdateTemplateHandle);
case IndirectCommandsLayoutEXTHandle:
return GFXRECON_STR(IndirectCommandsLayoutEXTHandle);
case IndirectExecutionSetEXTHandle:
return GFXRECON_STR(IndirectExecutionSetEXTHandle);
default:
return "XXXX";
}

return "XXXX";
}

struct ShaderReflectionDescriptorInfo
{
ShaderReflectionDescriptorInfo(
Expand Down
20 changes: 15 additions & 5 deletions framework/encode/vulkan_state_writer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#include "format/format_util.h"
#include "util/logging.h"
#include "custom_vulkan_array_size_2d.h"
#include "vulkan/vulkan_core.h"

#include <algorithm>
#include <array>
Expand Down Expand Up @@ -3452,6 +3453,11 @@ void VulkanStateWriter::WriteCommandBufferCommands(const vulkan_wrappers::Comman

assert(offset == data_size);
}
else
{
const char* level_str = wrapper->level == VK_COMMAND_BUFFER_LEVEL_PRIMARY ? "Primary" : "Secondary";
GFXRECON_LOG_ERROR("%s command buffer % " PRIu64 " will not be dumped", level_str, wrapper->handle_id);
}
}

void VulkanStateWriter::WriteDescriptorUpdateCommand(format::HandleId device_id,
Expand Down Expand Up @@ -4174,6 +4180,10 @@ bool VulkanStateWriter::CheckCommandHandles(const vulkan_wrappers::CommandBuffer
{
if (!CheckCommandHandle(static_cast<vulkan_state_info::CommandHandleType>(i), id, state_table))
{
GFXRECON_LOG_ERROR("%s(): Object %" PRIu64 " of type %s is invalid",
__func__,
id,
CommandHandleTypeToStr(static_cast<vulkan_state_info::CommandHandleType>(i)));
return false;
}
}
Expand All @@ -4189,21 +4199,21 @@ bool VulkanStateWriter::CheckCommandHandle(vulkan_state_info::CommandHandleType
switch (handle_type)
{
case vulkan_state_info::CommandHandleType::BufferHandle:
return IsBufferValid(handle_id, state_table);
return (state_table.GetBufferWrapper(handle_id) != nullptr);
case vulkan_state_info::CommandHandleType::BufferViewHandle:
return IsBufferViewValid(handle_id, state_table);
return (state_table.GetBufferViewWrapper(handle_id) != nullptr);
case vulkan_state_info::CommandHandleType::CommandBufferHandle:
return (state_table.GetCommandBufferWrapper(handle_id) != nullptr);
case vulkan_state_info::CommandHandleType::DescriptorSetHandle:
return (state_table.GetDescriptorSetWrapper(handle_id) != nullptr);
case vulkan_state_info::CommandHandleType::EventHandle:
return (state_table.GetEventWrapper(handle_id) != nullptr);
case vulkan_state_info::CommandHandleType::FramebufferHandle:
return IsFramebufferValid(handle_id, state_table);
return (state_table.GetFramebufferWrapper(handle_id) != nullptr);
case vulkan_state_info::CommandHandleType::ImageHandle:
return IsImageValid(handle_id, state_table);
return (state_table.GetImageWrapper(handle_id) != nullptr);
case vulkan_state_info::CommandHandleType::ImageViewHandle:
return IsImageViewValid(handle_id, state_table);
return (state_table.GetImageViewWrapper(handle_id) != nullptr);
case vulkan_state_info::CommandHandleType::PipelineHandle:
return (state_table.GetPipelineWrapper(handle_id) != nullptr);
case vulkan_state_info::CommandHandleType::PipelineLayoutHandle:
Expand Down
Loading