Preventing (one of likely many) race condition with ringbuffer.
This was causing acks for commands not executed if the CPU ran faster than the GPU.
This commit is contained in:
parent
41a652dd03
commit
e0af361d74
|
@ -75,7 +75,11 @@ void RingBufferWorker::Pump() {
|
|||
return;
|
||||
}
|
||||
}
|
||||
if (read_ptr_index_ == write_ptr_index_) {
|
||||
|
||||
// Bring local so we don't have to worry about them changing out from under
|
||||
// us.
|
||||
uint32_t write_ptr_index = write_ptr_index_;
|
||||
if (read_ptr_index_ == write_ptr_index) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -84,11 +88,11 @@ void RingBufferWorker::Pump() {
|
|||
|
||||
// TODO(benvanik): handle wrapping around
|
||||
// read_ptr_index_ = (read_ptr_index_ + 1) % (primary_buffer_size_ / 4);
|
||||
XEASSERT(write_ptr_index_ > read_ptr_index_);
|
||||
uint32_t length = write_ptr_index_ - read_ptr_index_;
|
||||
XEASSERT(write_ptr_index > read_ptr_index_);
|
||||
uint32_t length = write_ptr_index - read_ptr_index_;
|
||||
if (length) {
|
||||
ExecuteSegment(primary_buffer_ptr_ + read_ptr_index_ * 4, length);
|
||||
read_ptr_index_ = write_ptr_index_;
|
||||
read_ptr_index_ = write_ptr_index;
|
||||
}
|
||||
|
||||
// TODO(benvanik): use read_ptr_update_freq_ and only issue after moving
|
||||
|
|
|
@ -51,7 +51,7 @@ protected:
|
|||
uint32_t read_ptr_writeback_ptr_;
|
||||
|
||||
HANDLE write_ptr_index_event_;
|
||||
uint32_t write_ptr_index_;
|
||||
volatile uint32_t write_ptr_index_;
|
||||
};
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue