Skip to content

Commit

Permalink
Don't initialize dump resources indices from global variables.
Browse files Browse the repository at this point in the history
...and a few other minor tweaks
  • Loading branch information
davidlunarg authored and panos-lunarg committed Jan 26, 2024
1 parent 633d61e commit 7be88a1
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 23 deletions.
17 changes: 6 additions & 11 deletions framework/decode/vulkan_replay_options.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,6 @@ typedef std::function<VulkanResourceAllocator*()> CreateResourceAllocator;
// Default log level to use prior to loading settings.
const util::Log::Severity kDefaultLogLevel = util::Log::Severity::kInfoSeverity;

// Indices to --dump-resources args stored in dump_resources_params array below -- NEEDED??
const uint32_t kdr_BeginCommandBufferIndex = 0;
const uint32_t kdr_DrawIndex = 1;
const uint32_t kdr_QueueSubmintIndex = 2;

// Sascha's Compute ray tracing
// static constexpr uint64_t g_BeginCommandBuffer_indices = 185;
// static constexpr uint64_t g_CmdDraw_indices = 0;
Expand Down Expand Up @@ -604,12 +599,12 @@ struct VulkanReplayOptions : public ReplayOptions
std::string replace_dir;

// Dumping resources related configurable replay options
std::vector<uint64_t> BeginCommandBuffer_Indices{ g_BeginCommandBuffer_indices };
std::vector<std::vector<uint64_t>> Draw_Indices{ g_CmdDraw_indices };
std::vector<std::vector<std::vector<uint64_t>>> RenderPass_Indices{ g_RenderPass_indices };
std::vector<std::vector<uint64_t>> Dispatch_Indices{ g_CmdDispatch_indices };
std::vector<std::vector<uint64_t>> TraceRays_Indices{ g_CmdTraceRaysKHR_indices };
std::vector<uint64_t> QueueSubmit_Indices{ g_QueueSubmit_indices };
std::vector<uint64_t> BeginCommandBuffer_Indices;
std::vector<std::vector<uint64_t>> Draw_Indices;
std::vector<std::vector<std::vector<uint64_t>>> RenderPass_Indices;
std::vector<std::vector<uint64_t>> Dispatch_Indices;
std::vector<std::vector<uint64_t>> TraceRays_Indices;
std::vector<uint64_t> QueueSubmit_Indices;
std::string dump_resources;

bool dumping_resource{ true };
Expand Down
25 changes: 15 additions & 10 deletions tools/replay/desktop_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,19 +108,23 @@ static bool ends_with(std::string const &fullString, std::string const &ending)

const char kLayerEnvVar[] = "VK_INSTANCE_LAYERS";

void parse_dump_resources_arg(gfxrecon::decode::VulkanReplayOptions &vulkan_replay_options)
static void parse_dump_resources_arg(gfxrecon::decode::VulkanReplayOptions &vulkan_replay_options)
{
bool parse_error=false;

// Take out this section once I make sure that we we don't stuff args event when null.
#if 0
if (vulkan_replay_options.dump_resources.length() == 0)
{
// arg is null string. Error.
parse_error = true;
// Arg is null string.
// Clear dump resources indices and return.
vulkan_replay_options.BeginCommandBuffer_Indices.clear();
vulkan_replay_options.Draw_Indices.clear();
vulkan_replay_options.RenderPass_Indices.clear();
vulkan_replay_options.Dispatch_Indices.clear();
vulkan_replay_options.TraceRays_Indices.clear();
vulkan_replay_options.QueueSubmit_Indices.clear();
return;
}
else
#endif

if (ends_with(to_lower(vulkan_replay_options.dump_resources), ".json"))
{
// dump-resource arg value is a json file. Read and parse the json file.
Expand Down Expand Up @@ -335,11 +339,12 @@ void parse_dump_resources_arg(gfxrecon::decode::VulkanReplayOptions &vulkan_repl
parse_error |= (vulkan_replay_options.Draw_Indices.size() == 0 &&
vulkan_replay_options.Dispatch_Indices.size() == 0 &&
vulkan_replay_options.TraceRays_Indices.size() == 0);
if (vulkan_replay_options.Draw_Indices.size() > 0)
if (vulkan_replay_options.Draw_Indices.size() != 0)
parse_error |= (vulkan_replay_options.RenderPass_Indices.size() == 0);
else
if (vulkan_replay_options.Dispatch_Indices.size() == 0)
parse_error |= (vulkan_replay_options.TraceRays_Indices.size() == 0);
parse_error |= (vulkan_replay_options.Dispatch_Indices.size() == 0 &&
+vulkan_replay_options.TraceRays_Indices.size() == 0);


if (parse_error)
{
Expand Down
4 changes: 2 additions & 2 deletions tools/replay/replay_settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -229,8 +229,8 @@ static void PrintUsage(const char* exe_name)
GFXRECON_WRITE_CONSOLE(" \t\treturned by vkEnumeratePhysicalDeviceGroups. Replay may fail");
GFXRECON_WRITE_CONSOLE(" \t\tif the specified device group is not compatible with the");
GFXRECON_WRITE_CONSOLE(" \t\toriginal capture device group.");
GFXRECON_WRITE_CONSOLE(" --dump-resources BeginCommandBuffer=<n>,CmdDraw=<m>,RenderPass=<n>,NextSubpass=<o>,CmdDispatch=<p>,CmdTraceRays=<q>,QueueSubmit=<r>");
GFXRECON_WRITE_CONSOLE(" \t\tDump gpu resources after the given vmCmdDraw*, vkCmdDispatch, or vkCmdTraceRaysKHR is replayed.");
GFXRECON_WRITE_CONSOLE(" --dump-resources BeginCommandBuffer=<n>,Draw=<m>,RenderPass=<n>,NextSubpass=<o>,Dispatch=<p>,CmdTraceRays=<q>,QueueSubmit=<r>");
GFXRECON_WRITE_CONSOLE(" \t\tDump gpu resources after the given vkCmdDraw*, vkCmdDispatch, or vkCmdTraceRaysKHR is replayed.");
GFXRECON_WRITE_CONSOLE(" --dump-resources <filename>");
GFXRECON_WRITE_CONSOLE(" \t\tExtract --dump-resources args from the specified file.");
GFXRECON_WRITE_CONSOLE(" --dump-resources-before-draw");
Expand Down

0 comments on commit 7be88a1

Please sign in to comment.