internal/graphicsdriver/directx: reduce unnecessary settings of pipelines

This commit is contained in:
Hajime Hoshi 2023-03-29 14:15:22 +09:00
parent c22957f678
commit f23dd72fb4

View File

@ -285,6 +285,14 @@ func (p *pipelineStates) drawTriangles(device *_ID3D12Device, commandList *_ID3D
} }
commandList.SetGraphicsRootDescriptorTable(2, sh) commandList.SetGraphicsRootDescriptorTable(2, sh)
if !evenOdd {
s, err := shader.pipelineState(blend, noStencil, screen)
if err != nil {
return err
}
commandList.SetPipelineState(s)
}
for _, dstRegion := range dstRegions { for _, dstRegion := range dstRegions {
commandList.RSSetScissorRects([]_D3D12_RECT{ commandList.RSSetScissorRects([]_D3D12_RECT{
{ {
@ -309,11 +317,6 @@ func (p *pipelineStates) drawTriangles(device *_ID3D12Device, commandList *_ID3D
commandList.SetPipelineState(s) commandList.SetPipelineState(s)
commandList.DrawIndexedInstanced(uint32(dstRegion.IndexCount), 1, uint32(indexOffset), 0, 0) commandList.DrawIndexedInstanced(uint32(dstRegion.IndexCount), 1, uint32(indexOffset), 0, 0)
} else { } else {
s, err := shader.pipelineState(blend, noStencil, screen)
if err != nil {
return err
}
commandList.SetPipelineState(s)
commandList.DrawIndexedInstanced(uint32(dstRegion.IndexCount), 1, uint32(indexOffset), 0, 0) commandList.DrawIndexedInstanced(uint32(dstRegion.IndexCount), 1, uint32(indexOffset), 0, 0)
} }
indexOffset += dstRegion.IndexCount indexOffset += dstRegion.IndexCount