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

Do second round API detect for optimizer if needed #1557

Merged
merged 3 commits into from
May 21, 2024
Merged
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
10 changes: 7 additions & 3 deletions framework/decode/decode_api_detection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,20 +29,24 @@
GFXRECON_BEGIN_NAMESPACE(gfxrecon)
GFXRECON_BEGIN_NAMESPACE(decode)

bool DetectAPIs(const std::string& input_filename, bool& dx12_detected, bool& vulkan_detected)
bool DetectAPIs(const std::string& input_filename, bool& dx12_detected, bool& vulkan_detected, bool no_block_limit)
{
dx12_detected = false;
vulkan_detected = false;

gfxrecon::decode::FileProcessor file_processor;
if (file_processor.Initialize(input_filename))
{
gfxrecon::decode::VulkanDetectionConsumer vulkan_detection_consumer;
uint64_t vulkan_block_limit = no_block_limit ? gfxrecon::decode::VulkanDetectionConsumer::kNoBlockLimit
: gfxrecon::decode::VulkanDetectionConsumer::kDefaultBlockLimit;
gfxrecon::decode::VulkanDetectionConsumer vulkan_detection_consumer(vulkan_block_limit);
gfxrecon::decode::VulkanDecoder vulkan_decoder;
vulkan_decoder.AddConsumer(&vulkan_detection_consumer);
file_processor.AddDecoder(&vulkan_decoder);
#if defined(D3D12_SUPPORT)
gfxrecon::decode::Dx12DetectionConsumer dx12_detection_consumer;
uint64_t dx12_block_limit = no_block_limit ? gfxrecon::decode::Dx12DetectionConsumer::kNoBlockLimit
: gfxrecon::decode::Dx12DetectionConsumer::kDefaultBlockLimit;
gfxrecon::decode::Dx12DetectionConsumer dx12_detection_consumer(dx12_block_limit);
gfxrecon::decode::Dx12Decoder dx12_decoder;
dx12_decoder.AddConsumer(&dx12_detection_consumer);
file_processor.AddDecoder(&dx12_decoder);
Expand Down
5 changes: 4 additions & 1 deletion framework/decode/decode_api_detection.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,10 @@
GFXRECON_BEGIN_NAMESPACE(gfxrecon)
GFXRECON_BEGIN_NAMESPACE(decode)

bool DetectAPIs(const std::string& input_filename, bool& dx12_detected, bool& vulkan_detected);
bool DetectAPIs(const std::string& input_filename,
bool& dx12_detected,
bool& vulkan_detected,
bool no_block_limit = false);

GFXRECON_END_NAMESPACE(decode)
GFXRECON_END_NAMESPACE(gfxrecon)
Expand Down
6 changes: 6 additions & 0 deletions tools/optimize/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,12 @@ int main(int argc, const char** argv)
bool detected_vulkan = false;
gfxrecon::decode::DetectAPIs(input_filename, detected_d3d12, detected_vulkan);

if ((!detected_d3d12) && (!detected_vulkan))
{
// Detect with no block limit
gfxrecon::decode::DetectAPIs(input_filename, detected_d3d12, detected_vulkan, true);
}

if (detected_d3d12)
{
dx12_options.optimize_resource_values = true;
Expand Down
Loading