Periodically fire interrupts.
This commit is contained in:
parent
96a857e892
commit
cc12f0b96a
|
@ -130,6 +130,11 @@ void D3D11GraphicsSystem::Pump() {
|
||||||
|
|
||||||
// Dispatch interrupt callback to let the game know it can keep drawing.
|
// Dispatch interrupt callback to let the game know it can keep drawing.
|
||||||
DispatchInterruptCallback();
|
DispatchInterruptCallback();
|
||||||
|
} else {
|
||||||
|
// If we have gone too long without an interrupt, fire one.
|
||||||
|
if (xe_pal_now() - last_interrupt_time_ > 16 / 1000.0) {
|
||||||
|
DispatchInterruptCallback();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@ using namespace xe::gpu::xenos;
|
||||||
|
|
||||||
GraphicsSystem::GraphicsSystem(const CreationParams* params) :
|
GraphicsSystem::GraphicsSystem(const CreationParams* params) :
|
||||||
interrupt_callback_(0), interrupt_callback_data_(0),
|
interrupt_callback_(0), interrupt_callback_data_(0),
|
||||||
swap_pending_(false) {
|
last_interrupt_time_(0), swap_pending_(false) {
|
||||||
memory_ = xe_memory_retain(params->memory);
|
memory_ = xe_memory_retain(params->memory);
|
||||||
|
|
||||||
worker_ = new RingBufferWorker(memory_);
|
worker_ = new RingBufferWorker(memory_);
|
||||||
|
@ -147,15 +147,18 @@ void GraphicsSystem::WriteRegister(uint32_t r, uint64_t value) {
|
||||||
case 0x0714: // CP_RB_WPTR
|
case 0x0714: // CP_RB_WPTR
|
||||||
worker_->UpdateWritePointer((uint32_t)value);
|
worker_->UpdateWritePointer((uint32_t)value);
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
XELOGW("Unknown GPU register %.4X write: %.8X", r, value);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
XEASSERT(r >= 0 && r < kXEGpuRegisterCount);
|
XEASSERT(r >= 0 && r < kXEGpuRegisterCount);
|
||||||
XELOGW("Unknown GPU register %.4X write: %.8X", r, value);
|
|
||||||
regs->values[r].u32 = (uint32_t)value;
|
regs->values[r].u32 = (uint32_t)value;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GraphicsSystem::DispatchInterruptCallback() {
|
void GraphicsSystem::DispatchInterruptCallback() {
|
||||||
// NOTE: we may be executing in some random thread.
|
// NOTE: we may be executing in some random thread.
|
||||||
|
last_interrupt_time_ = xe_pal_now();
|
||||||
if (!interrupt_callback_) {
|
if (!interrupt_callback_) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -93,6 +93,7 @@ protected:
|
||||||
|
|
||||||
uint32_t interrupt_callback_;
|
uint32_t interrupt_callback_;
|
||||||
uint32_t interrupt_callback_data_;
|
uint32_t interrupt_callback_data_;
|
||||||
|
double last_interrupt_time_;
|
||||||
bool swap_pending_;
|
bool swap_pending_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue