mirror of https://github.com/xemu-project/xemu.git
nv2a: Add state flushing to PGRAPH
This commit is contained in:
parent
0673010e54
commit
c9cf9a9972
|
@ -266,7 +266,7 @@ typedef struct PGRAPHState {
|
||||||
bool waiting_for_flip;
|
bool waiting_for_flip;
|
||||||
bool waiting_for_fifo_access;
|
bool waiting_for_fifo_access;
|
||||||
bool waiting_for_context_switch;
|
bool waiting_for_context_switch;
|
||||||
|
bool flush_pending;
|
||||||
} PGRAPHState;
|
} PGRAPHState;
|
||||||
|
|
||||||
typedef struct NV2AState {
|
typedef struct NV2AState {
|
||||||
|
|
|
@ -475,6 +475,22 @@ void pgraph_write(void *opaque, hwaddr addr, uint64_t val, unsigned int size)
|
||||||
qemu_mutex_unlock(&d->pfifo.lock);
|
qemu_mutex_unlock(&d->pfifo.lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void pgraph_flush(NV2AState *d)
|
||||||
|
{
|
||||||
|
PGRAPHState *pg = &d->pgraph;
|
||||||
|
|
||||||
|
// Clear last surface shape to force recreation of buffers at next draw
|
||||||
|
pg->surface_color.draw_dirty = false;
|
||||||
|
pg->surface_zeta.draw_dirty = false;
|
||||||
|
memset(&pg->last_surface_shape, 0, sizeof(pg->last_surface_shape));
|
||||||
|
|
||||||
|
// Sync all RAM
|
||||||
|
glBindBuffer(GL_ARRAY_BUFFER, d->pgraph.gl_memory_buffer);
|
||||||
|
glBufferSubData(GL_ARRAY_BUFFER, 0, memory_region_size(d->vram), d->vram_ptr);
|
||||||
|
|
||||||
|
// FIXME: Flush more?
|
||||||
|
}
|
||||||
|
|
||||||
/* If NV097_FLIP_STALL was executed, check if the flip has completed.
|
/* If NV097_FLIP_STALL was executed, check if the flip has completed.
|
||||||
* This will usually happen in the VSYNC interrupt handler.
|
* This will usually happen in the VSYNC interrupt handler.
|
||||||
*/
|
*/
|
||||||
|
@ -506,6 +522,11 @@ static void pgraph_method(NV2AState *d,
|
||||||
|
|
||||||
PGRAPHState *pg = &d->pgraph;
|
PGRAPHState *pg = &d->pgraph;
|
||||||
|
|
||||||
|
if (pg->flush_pending) {
|
||||||
|
pgraph_flush(d);
|
||||||
|
pg->flush_pending = false;
|
||||||
|
}
|
||||||
|
|
||||||
bool channel_valid =
|
bool channel_valid =
|
||||||
d->pgraph.regs[NV_PGRAPH_CTX_CONTROL] & NV_PGRAPH_CTX_CONTROL_CHID;
|
d->pgraph.regs[NV_PGRAPH_CTX_CONTROL] & NV_PGRAPH_CTX_CONTROL_CHID;
|
||||||
assert(channel_valid);
|
assert(channel_valid);
|
||||||
|
|
Loading…
Reference in New Issue