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
2eb1efe3cc
commit
8e40c2ce7e
@ -1644,7 +1644,9 @@ func (i *Image) WritePixels(args []*graphicsdriver.WritePixelsArgs) error {
|
|||||||
for j := 0; j < a.Height; j++ {
|
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])
|
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{
|
dst := _D3D12_TEXTURE_COPY_LOCATION_SubresourceIndex{
|
||||||
pResource: i.texture,
|
pResource: i.texture,
|
||||||
Type: _D3D12_TEXTURE_COPY_TYPE_SUBRESOURCE_INDEX,
|
Type: _D3D12_TEXTURE_COPY_TYPE_SUBRESOURCE_INDEX,
|
||||||
@ -2043,8 +2045,5 @@ func (s *Shader) uniformsToFloat32s(uniforms [][]float32) []float32 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func align(x int) int {
|
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
|
return (((x - 1) / _D3D12_TEXTURE_DATA_PITCH_ALIGNMENT) + 1) * _D3D12_TEXTURE_DATA_PITCH_ALIGNMENT
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user