mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-10 04:57:26 +01:00
directx: Better logic to assume MRT
This commit is contained in:
parent
65646df8ed
commit
92a257a557
@ -587,11 +587,15 @@ func (g *graphics11) DrawTriangles(dstIDs [graphics.ShaderDstImageCount]graphics
|
||||
var dsts [graphics.ShaderDstImageCount]*image11
|
||||
var viewports [graphics.ShaderDstImageCount]_D3D11_VIEWPORT
|
||||
var targetCount int
|
||||
firstTarget := -1
|
||||
for i, id := range dstIDs {
|
||||
img := g.images[id]
|
||||
if img == nil {
|
||||
continue
|
||||
}
|
||||
if firstTarget == -1 {
|
||||
firstTarget = i
|
||||
}
|
||||
dsts[i] = img
|
||||
w, h := img.internalSize()
|
||||
viewports[i] = _D3D11_VIEWPORT{
|
||||
@ -614,8 +618,12 @@ func (g *graphics11) DrawTriangles(dstIDs [graphics.ShaderDstImageCount]graphics
|
||||
srcs[i] = img
|
||||
}
|
||||
|
||||
// TODO: this is not correct, we can't assume that a single image means no MRT!
|
||||
if targetCount > 1 {
|
||||
// If the number of targets is more than one, or if the only target is the first one, then
|
||||
// it is safe to assume that MRT is used.
|
||||
// Also, it only matters in order to specify empty targets/viewports when not all slots are
|
||||
// being filled.
|
||||
usesMRT := targetCount > 1 || firstTarget > 0
|
||||
if usesMRT {
|
||||
targetCount = graphics.ShaderDstImageCount
|
||||
}
|
||||
g.deviceContext.RSSetViewports(viewports[:targetCount])
|
||||
|
Loading…
Reference in New Issue
Block a user