Skip to content

Commit c081f1b

Browse files
committed
Remove block index from thread data
1 parent 10f3ad7 commit c081f1b

File tree

4 files changed

+5
-26
lines changed

4 files changed

+5
-26
lines changed

framework/encode/capture_manager.cpp

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1269,12 +1269,9 @@ void CommonCaptureManager::WriteFileHeader(util::FileOutputStream* file_stream)
12691269
{ option_list.data(), option_list.size() * sizeof(format::FileOptionPair) } },
12701270
file_stream);
12711271

1272-
// File header does not count as a block
1273-
assert(block_index_ > 0);
1272+
// File header does not count as a block when replaying
1273+
GFXRECON_ASSERT(block_index_ > 0);
12741274
--block_index_;
1275-
1276-
auto thread_data = GetThreadData();
1277-
thread_data->block_index_ = block_index_.load();
12781275
}
12791276

12801277
void CommonCaptureManager::BuildOptionList(const format::EnabledOptions& enabled_options,
@@ -1507,11 +1504,7 @@ void CommonCaptureManager::WriteToFile(const void* data, size_t size, util::File
15071504
file_stream ? file_stream->Write(data, size) : file_stream_->Write(data, size);
15081505

15091506
// Increment block index
1510-
auto thread_data = GetThreadData();
1511-
assert(thread_data != nullptr);
1512-
15131507
++block_index_;
1514-
thread_data->block_index_ = block_index_.load();
15151508
}
15161509

15171510
void CommonCaptureManager::AtExit()

framework/encode/capture_manager.h

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -172,11 +172,7 @@ class CommonCaptureManager
172172
uint16_t GetDescriptorMask() const { return rv_annotation_info_.descriptor_mask; }
173173
uint64_t GetShaderIDMask() const { return rv_annotation_info_.shaderid_mask; }
174174

175-
uint64_t GetBlockIndex()
176-
{
177-
auto thread_data = GetThreadData();
178-
return thread_data->block_index_ == 0 ? 0 : thread_data->block_index_ - 1;
179-
}
175+
uint64_t GetBlockIndex() { return block_index_ == 0 ? 0 : block_index_ - 1; }
180176

181177
static bool CreateInstance(ApiCaptureManager* api_instance_, const std::function<void()>& destroyer);
182178
template <typename Derived>
@@ -296,18 +292,10 @@ class CommonCaptureManager
296292
: file_stream_->CombineAndWrite<N>(buffers, GetThreadData()->GetScratchBuffer());
297293

298294
// Increment block index
299-
auto thread_data = GetThreadData();
300-
assert(thread_data != nullptr);
301-
302295
++block_index_;
303-
thread_data->block_index_ = block_index_.load();
304296
}
305297

306-
void IncrementBlockIndex(uint64_t blocks)
307-
{
308-
block_index_ += blocks;
309-
GetThreadData()->block_index_ = block_index_;
310-
}
298+
void IncrementBlockIndex(uint64_t blocks) { block_index_ += blocks; }
311299

312300
void SetWriteAssets() { write_assets_ = true; }
313301

framework/util/thread_data.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,7 @@ format::ThreadId ThreadData::thread_count_ = 0;
3030
std::unordered_map<uint64_t, format::ThreadId> ThreadData::id_map_;
3131

3232
ThreadData::ThreadData() :
33-
thread_id_(GetThreadId()), object_id_(format::kNullHandleId), call_id_(format::ApiCallId::ApiCall_Unknown),
34-
block_index_(0)
33+
thread_id_(GetThreadId()), object_id_(format::kNullHandleId), call_id_(format::ApiCallId::ApiCall_Unknown)
3534
{
3635
parameter_buffer_ = std::make_unique<encode::ParameterBuffer>();
3736
parameter_encoder_ = std::make_unique<encode::ParameterEncoder>(parameter_buffer_.get());

framework/util/thread_data.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ class ThreadData
4646
std::unique_ptr<encode::ParameterEncoder> parameter_encoder_;
4747
std::vector<uint8_t> compressed_buffer_;
4848
encode::HandleUnwrapMemory handle_unwrap_memory_;
49-
uint64_t block_index_;
5049

5150
private:
5251
static format::ThreadId GetThreadId();

0 commit comments

Comments
 (0)