diff --git a/internal/graphicsdriver/directx/graphics_windows.go b/internal/graphicsdriver/directx/graphics_windows.go index b9e269772..7cab25e42 100644 --- a/internal/graphicsdriver/directx/graphics_windows.go +++ b/internal/graphicsdriver/directx/graphics_windows.go @@ -1644,7 +1644,9 @@ func (i *Image) WritePixels(args []*graphicsdriver.WritePixelsArgs) error { for j := 0; j < a.Height; j++ { copy(srcBytes[(a.Y+j)*alignedWidth+a.X*4:], a.Pixels[j*a.Width*4:(j+1)*a.Width*4]) } + } + for _, a := range args { dst := _D3D12_TEXTURE_COPY_LOCATION_SubresourceIndex{ pResource: i.texture, Type: _D3D12_TEXTURE_COPY_TYPE_SUBRESOURCE_INDEX, @@ -2043,8 +2045,5 @@ func (s *Shader) uniformsToFloat32s(uniforms [][]float32) []float32 { } func align(x int) int { - if x%_D3D12_TEXTURE_DATA_PITCH_ALIGNMENT == 0 { - return x - } return (((x - 1) / _D3D12_TEXTURE_DATA_PITCH_ALIGNMENT) + 1) * _D3D12_TEXTURE_DATA_PITCH_ALIGNMENT }