[XMA] Fix consume-only path write offset and drain check
This commit is contained in:
@@ -130,9 +130,19 @@ bool XmaContextNew::Work() {
|
|||||||
RingBuffer output_rb = PrepareOutputRingBuffer(&data);
|
RingBuffer output_rb = PrepareOutputRingBuffer(&data);
|
||||||
|
|
||||||
if (data.IsConsumeOnlyContext()) {
|
if (data.IsConsumeOnlyContext()) {
|
||||||
|
XELOGAPU("XmaContext {}: Consume-only context, draining subframes", id());
|
||||||
Consume(&output_rb, &data);
|
Consume(&output_rb, &data);
|
||||||
|
data.output_buffer_write_offset =
|
||||||
|
output_rb.write_offset() / kOutputBytesPerBlock;
|
||||||
|
// Clearing contexts that match TightBufferOutput heuristic can disrupt
|
||||||
|
// playback (e.g. audio noise during races in PGR4), so we only clear
|
||||||
|
// contexts with enough output buffer headroom where empty input reliably
|
||||||
|
// indicates the stream is finished (e.g. needed for dialog completion in
|
||||||
|
// Borderlands 2 startup).
|
||||||
if (!data.HasTightOutputBuffer() &&
|
if (!data.HasTightOutputBuffer() &&
|
||||||
data.output_buffer_read_offset == data.output_buffer_write_offset) {
|
current_frame_remaining_subframes_ == 0 && output_rb.empty()) {
|
||||||
|
XELOGAPU("XmaContext {}: Consume-only context fully drained, clearing",
|
||||||
|
id());
|
||||||
ClearLocked(&data);
|
ClearLocked(&data);
|
||||||
}
|
}
|
||||||
StoreContextMerged(data, initial_data, context_ptr);
|
StoreContextMerged(data, initial_data, context_ptr);
|
||||||
|
|||||||
Reference in New Issue
Block a user