internal/graphicsdriver/directx: unmap constant buffers appropriately

Updates #2198
Updates #2202
This commit is contained in:
Hajime Hoshi 2022-07-14 01:54:31 +09:00
parent 742503ae68
commit 085e6fe994

View File

@ -674,12 +674,16 @@ func (p *pipelineStates) newPipelineState(device *iD3D12Device, vsh, psh *iD3DBl
func (p *pipelineStates) releaseConstantBuffers(frameIndex int) {
for i := range p.constantBuffers[frameIndex] {
p.constantBuffers[frameIndex][i].Unmap(0, nil)
p.constantBuffers[frameIndex][i].Release()
p.constantBuffers[frameIndex][i] = nil
p.constantBufferMaps[frameIndex][i] = 0
}
p.constantBuffers[frameIndex] = p.constantBuffers[frameIndex][:0]
p.constantBufferMaps[frameIndex] = p.constantBufferMaps[frameIndex][:0]
}
func (p *pipelineStates) resetConstantBuffers(frameIndex int) {
p.constantBuffers[frameIndex] = p.constantBuffers[frameIndex][:0]
p.constantBufferMaps[frameIndex] = p.constantBufferMaps[frameIndex][:0]
}