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

New preload #1895

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
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
16 changes: 16 additions & 0 deletions android/framework/decode/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,16 @@ target_sources(gfxrecon_decode
${GFXRECON_SOURCE_DIR}/framework/decode/file_processor.cpp
${GFXRECON_SOURCE_DIR}/framework/decode/preload_file_processor.h
${GFXRECON_SOURCE_DIR}/framework/decode/preload_file_processor.cpp
${GFXRECON_SOURCE_DIR}/framework/decode/preload_decode_allocator.h
${GFXRECON_SOURCE_DIR}/framework/decode/preload_decode_allocator.cpp
${GFXRECON_SOURCE_DIR}/framework/decode/preload_allocator.h
${GFXRECON_SOURCE_DIR}/framework/decode/preload_allocator.cpp
${GFXRECON_SOURCE_DIR}/framework/decode/vulkan_preload_replayer_base.h
${GFXRECON_SOURCE_DIR}/framework/decode/vulkan_preload_replayer_base.cpp
${GFXRECON_SOURCE_DIR}/framework/decode/vulkan_preload_decoder_base.h
${GFXRECON_SOURCE_DIR}/framework/decode/vulkan_preload_decoder_base.cpp
${GFXRECON_SOURCE_DIR}/framework/decode/vulkan_preload_file_processor.h
${GFXRECON_SOURCE_DIR}/framework/decode/vulkan_preload_file_processor.cpp
${GFXRECON_SOURCE_DIR}/framework/decode/file_transformer.h
${GFXRECON_SOURCE_DIR}/framework/decode/file_transformer.cpp
${GFXRECON_SOURCE_DIR}/framework/decode/handle_pointer_decoder.h
Expand Down Expand Up @@ -115,6 +125,12 @@ target_sources(gfxrecon_decode
${GFXRECON_SOURCE_DIR}/framework/generated/generated_vulkan_struct_handle_mappers.cpp
${GFXRECON_SOURCE_DIR}/framework/generated/generated_decode_pnext_struct.cpp
${GFXRECON_SOURCE_DIR}/framework/generated/generated_vulkan_object_info_table_base2.h
${GFXRECON_SOURCE_DIR}/framework/generated/generated_vulkan_struct_packet.h
${GFXRECON_SOURCE_DIR}/framework/generated/generated_vulkan_preload_decoder.h
${GFXRECON_SOURCE_DIR}/framework/generated/generated_vulkan_preload_decoder.cpp
${GFXRECON_SOURCE_DIR}/framework/generated/generated_vulkan_preload_replayer.h
${GFXRECON_SOURCE_DIR}/framework/generated/generated_vulkan_preload_replayer.cpp
${GFXRECON_SOURCE_DIR}/framework/generated/generated_vulkan_preload_decode_pnext_struct.cpp
)

target_include_directories(gfxrecon_decode
Expand Down
1 change: 1 addition & 0 deletions android/framework/format/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ target_sources(gfxrecon_format
${GFXRECON_SOURCE_DIR}/framework/format/format_util.h
${GFXRECON_SOURCE_DIR}/framework/format/format_util.cpp
${GFXRECON_SOURCE_DIR}/framework/format/platform_types.h
${GFXRECON_SOURCE_DIR}/framework/format/packet_call_id.h
)

target_include_directories(gfxrecon_format
Expand Down
25 changes: 22 additions & 3 deletions framework/application/application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@
#include "util/logging.h"
#include "util/platform.h"
#include "decode/preload_file_processor.h"
#include "decode/vulkan_preload_file_processor.h"

#include "decode/preload_decode_allocator.h"

#if defined(VK_USE_PLATFORM_WIN32_KHR)
#include "application/win32_context.h"
Expand Down Expand Up @@ -155,9 +158,25 @@ void Application::Run()
auto preload_frames_count = fps_info_->ShouldPreloadFrames(frame_number);
if (preload_frames_count > 0U)
{
auto* preload_processor = dynamic_cast<decode::PreloadFileProcessor*>(file_processor_);
GFXRECON_ASSERT(preload_processor)
preload_processor->PreloadNextFrames(preload_frames_count);
if (detected_vulkan_)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Detection and processing of API is handled in other parts of the system by having vectors of classes that may or may not take responsibility of blocks. E.g. there are different Decoder and the FileProcessor walks a list of Decoders to decode and then consume blocks. This hardcoding is counter to that design. PreloadAllocator should fit into that design in some way that does not detect or hardcode API types in Application class.

{
auto* preload_processor = dynamic_cast<decode::VulkanPreloadFileProcessor*>(file_processor_);
GFXRECON_ASSERT(preload_processor)
decode::PreloadDecodeAllocator::Begin();
preload_processor->PreloadNextFrames(preload_frames_count);

fps_info_->BeginFrame(frame_number);
preload_processor->ReplayPreloadedPackets();
fps_info_->EndFrame(frame_number);

decode::PreloadDecodeAllocator::End();
}
else
{
auto* preload_processor = dynamic_cast<decode::PreloadFileProcessor*>(file_processor_);
GFXRECON_ASSERT(preload_processor)
preload_processor->PreloadNextFrames(preload_frames_count);
}
}

fps_info_->BeginFrame(frame_number);
Expand Down
8 changes: 8 additions & 0 deletions framework/application/application.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,12 @@ class Application final
return file_processor_->GetCurrentFrameNumber();
}

void SetAPIDetected(bool detected_d3d12, bool detected_vulkan)
{
detected_d3d12_ = detected_d3d12;
detected_vulkan_ = detected_vulkan;
}

private:
// clang-format off
std::string name_; ///< Application name to display in window title bar.
Expand All @@ -99,6 +105,8 @@ class Application final
std::unordered_map<std::string, std::unique_ptr<WsiContext>> wsi_contexts_; ///< Loaded WSI contexts from CLI and VkInstanceCreateInfo
std::string cli_wsi_extension_; ///< WSI extension selected on CLI, empty string if no CLI selection
graphics::FpsInfo* fps_info_; ///< A optional FPS info object that logs the FPS across a configured framerange.
bool detected_d3d12_; ///<Indicates that the trace uses D3D12
bool detected_vulkan_; ///<Indicates that the trace uses Vulkan
///< capture file data.
// clang-format on
};
Expand Down
16 changes: 16 additions & 0 deletions framework/decode/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ target_sources(gfxrecon_decode
${CMAKE_CURRENT_LIST_DIR}/custom_vulkan_struct_to_json.cpp
${CMAKE_CURRENT_LIST_DIR}/descriptor_update_template_decoder.h
${CMAKE_CURRENT_LIST_DIR}/descriptor_update_template_decoder.cpp
${CMAKE_CURRENT_LIST_DIR}/preload_decode_allocator.h
${CMAKE_CURRENT_LIST_DIR}/preload_decode_allocator.cpp
${CMAKE_CURRENT_LIST_DIR}/preload_allocator.h
${CMAKE_CURRENT_LIST_DIR}/preload_allocator.cpp
${CMAKE_CURRENT_LIST_DIR}/decode_allocator.h
${CMAKE_CURRENT_LIST_DIR}/decode_allocator.cpp
${CMAKE_CURRENT_LIST_DIR}/decode_api_detection.h
Expand Down Expand Up @@ -198,6 +202,12 @@ target_sources(gfxrecon_decode
${CMAKE_CURRENT_LIST_DIR}/vulkan_offscreen_swapchain.h
${CMAKE_CURRENT_LIST_DIR}/vulkan_offscreen_swapchain.cpp
${CMAKE_CURRENT_LIST_DIR}/window.h
${CMAKE_CURRENT_LIST_DIR}/vulkan_preload_replayer_base.h
${CMAKE_CURRENT_LIST_DIR}/vulkan_preload_replayer_base.cpp
${CMAKE_CURRENT_LIST_DIR}/vulkan_preload_decoder_base.h
${CMAKE_CURRENT_LIST_DIR}/vulkan_preload_decoder_base.cpp
${CMAKE_CURRENT_LIST_DIR}/vulkan_preload_file_processor.h
${CMAKE_CURRENT_LIST_DIR}/vulkan_preload_file_processor.cpp
$<$<BOOL:${GFXRECON_TOCPP_SUPPORT}>:${CMAKE_SOURCE_DIR}/framework/generated/generated_vulkan_cpp_consumer.h>
$<$<BOOL:${GFXRECON_TOCPP_SUPPORT}>:${CMAKE_SOURCE_DIR}/framework/generated/generated_vulkan_cpp_consumer.cpp>
$<$<BOOL:${GFXRECON_TOCPP_SUPPORT}>:${CMAKE_SOURCE_DIR}/framework/generated/generated_vulkan_cpp_structs.h>
Expand Down Expand Up @@ -227,6 +237,12 @@ target_sources(gfxrecon_decode
${CMAKE_SOURCE_DIR}/framework/generated/generated_vulkan_struct_to_json.h
${CMAKE_SOURCE_DIR}/framework/generated/generated_vulkan_struct_to_json.cpp
${CMAKE_SOURCE_DIR}/framework/generated/generated_vulkan_object_info_table_base2.h
${CMAKE_SOURCE_DIR}/framework/generated/generated_vulkan_struct_packet.h
${CMAKE_SOURCE_DIR}/framework/generated/generated_vulkan_preload_decoder.h
${CMAKE_SOURCE_DIR}/framework/generated/generated_vulkan_preload_decoder.cpp
${CMAKE_SOURCE_DIR}/framework/generated/generated_vulkan_preload_replayer.h
${CMAKE_SOURCE_DIR}/framework/generated/generated_vulkan_preload_replayer.cpp
${CMAKE_SOURCE_DIR}/framework/generated/generated_vulkan_preload_decode_pnext_struct.cpp
$<$<BOOL:${D3D12_SUPPORT}>:${CMAKE_SOURCE_DIR}/framework/generated/generated_dx12_decoder.h>
$<$<BOOL:${D3D12_SUPPORT}>:${CMAKE_SOURCE_DIR}/framework/generated/generated_dx12_decoder.cpp>
$<$<BOOL:${D3D12_SUPPORT}>:${CMAKE_SOURCE_DIR}/framework/generated/generated_dx12_struct_decoders_forward.h>
Expand Down
Loading