Skip to content

Commit

Permalink
Remove block_index from thread data
Browse files Browse the repository at this point in the history
  • Loading branch information
panos-lunarg committed Sep 18, 2024
1 parent 630d3d5 commit a6e5a0c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 17 deletions.
7 changes: 1 addition & 6 deletions framework/encode/capture_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,7 @@ CommonCaptureManager::ApiCallMutexT CommonCaptureMana
std::atomic<format::HandleId> CommonCaptureManager::unique_id_counter_{ format::kNullHandleId };

CommonCaptureManager::ThreadData::ThreadData() :
thread_id_(GetThreadId()), object_id_(format::kNullHandleId), call_id_(format::ApiCallId::ApiCall_Unknown),
block_index_(0)
thread_id_(GetThreadId()), object_id_(format::kNullHandleId), call_id_(format::ApiCallId::ApiCall_Unknown)
{
parameter_buffer_ = std::make_unique<encode::ParameterBuffer>();
parameter_encoder_ = std::make_unique<ParameterEncoder>(parameter_buffer_.get());
Expand Down Expand Up @@ -1089,9 +1088,6 @@ void CommonCaptureManager::WriteFileHeader()
// File header does not count as a block
assert(block_index_ > 0);
--block_index_;

auto thread_data = GetThreadData();
thread_data->block_index_ = block_index_.load();
}

void CommonCaptureManager::BuildOptionList(const format::EnabledOptions& enabled_options,
Expand Down Expand Up @@ -1306,7 +1302,6 @@ void CommonCaptureManager::WriteToFile(const void* data, size_t size)
assert(thread_data != nullptr);

++block_index_;
thread_data->block_index_ = block_index_.load();
}

void CommonCaptureManager::AtExit()
Expand Down
13 changes: 2 additions & 11 deletions framework/encode/capture_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -162,11 +162,7 @@ class CommonCaptureManager
uint16_t GetDescriptorMask() const { return rv_annotation_info_.descriptor_mask; }
uint64_t GetShaderIDMask() const { return rv_annotation_info_.shaderid_mask; }

uint64_t GetBlockIndex()
{
auto thread_data = GetThreadData();
return thread_data->block_index_ == 0 ? 0 : thread_data->block_index_ - 1;
}
uint64_t GetBlockIndex() { return block_index_ == 0 ? 0 : block_index_ - 1; }

static bool CreateInstance(ApiCaptureManager* api_instance_, const std::function<void()>& destroyer);
template <typename Derived>
Expand Down Expand Up @@ -212,7 +208,6 @@ class CommonCaptureManager
std::unique_ptr<ParameterEncoder> parameter_encoder_;
std::vector<uint8_t> compressed_buffer_;
HandleUnwrapMemory handle_unwrap_memory_;
uint64_t block_index_;

private:
static format::ThreadId GetThreadId();
Expand Down Expand Up @@ -306,11 +301,7 @@ class CommonCaptureManager
WriteToFile(scratch_buffer.data(), scratch_buffer.size());
}

void IncrementBlockIndex(uint64_t blocks)
{
block_index_ += blocks;
GetThreadData()->block_index_ = block_index_;
}
void IncrementBlockIndex(uint64_t blocks) { block_index_ += blocks; }

protected:
std::unique_ptr<util::Compressor> compressor_;
Expand Down

0 comments on commit a6e5a0c

Please sign in to comment.