internal/graphicsdriver/directx: fix moveToNextFrame for Xbox

Updates #2084
This commit is contained in:
Hajime Hoshi 2022-06-20 00:41:22 +09:00
parent f8e9dcf035
commit 969e87fb89

View File

@ -685,8 +685,11 @@ func (g *Graphics) moveToNextFrame() error {
} }
// Update the frame index. // Update the frame index.
// TODO: The calculation might be different in Xbox. if microsoftgdk.IsXbox() {
g.frameIndex = int(g.swapChain.GetCurrentBackBufferIndex()) g.frameIndex = (g.frameIndex + 1) % frameCount
} else {
g.frameIndex = int(g.swapChain.GetCurrentBackBufferIndex())
}
if g.fence.GetCompletedValue() < g.fenceValues[g.frameIndex] { if g.fence.GetCompletedValue() < g.fenceValues[g.frameIndex] {
if err := g.fence.SetEventOnCompletion(fv, g.fenceWaitEvent); err != nil { if err := g.fence.SetEventOnCompletion(fv, g.fenceWaitEvent); err != nil {