mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-25 03:08:54 +01:00
internal/graphicsdriver/directx: refactoring
This commit is contained in:
parent
e796646abd
commit
35e9f26681
@ -179,7 +179,6 @@ func (q *commandQueue) flush(graphicsDriver graphicsdriver.Graphics, endFrame bo
|
|||||||
if err := graphicsDriver.Begin(); err != nil {
|
if err := graphicsDriver.Begin(); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
var screenRendered bool
|
|
||||||
cs := q.commands
|
cs := q.commands
|
||||||
for len(cs) > 0 {
|
for len(cs) > 0 {
|
||||||
nv := 0
|
nv := 0
|
||||||
@ -195,9 +194,6 @@ func (q *commandQueue) flush(graphicsDriver graphicsdriver.Graphics, endFrame bo
|
|||||||
}
|
}
|
||||||
nv += dtc.numVertices()
|
nv += dtc.numVertices()
|
||||||
ne += dtc.numIndices()
|
ne += dtc.numIndices()
|
||||||
if dtc.dst.screen {
|
|
||||||
screenRendered = true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
nc++
|
nc++
|
||||||
}
|
}
|
||||||
@ -223,8 +219,7 @@ func (q *commandQueue) flush(graphicsDriver graphicsdriver.Graphics, endFrame bo
|
|||||||
}
|
}
|
||||||
cs = cs[nc:]
|
cs = cs[nc:]
|
||||||
}
|
}
|
||||||
// TODO: Without checking screenRendered, the tests fail on Windows. Investigate this issue.
|
if err := graphicsDriver.End(endFrame); err != nil {
|
||||||
if err := graphicsDriver.End(endFrame && screenRendered); err != nil {
|
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -774,7 +774,8 @@ func (g *Graphics) End(present bool) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if present {
|
// screenImage can be nil in tests.
|
||||||
|
if present && g.screenImage != nil {
|
||||||
if rb, ok := g.screenImage.transiteState(_D3D12_RESOURCE_STATE_PRESENT); ok {
|
if rb, ok := g.screenImage.transiteState(_D3D12_RESOURCE_STATE_PRESENT); ok {
|
||||||
g.drawCommandList.ResourceBarrier([]_D3D12_RESOURCE_BARRIER_Transition{rb})
|
g.drawCommandList.ResourceBarrier([]_D3D12_RESOURCE_BARRIER_Transition{rb})
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user