From e4e8e7254ea4345c6a2b177a3d220e01e7b7a408 Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Sat, 7 Nov 2020 23:46:07 +0900 Subject: [PATCH] graphicsdriver/metal/mtl: Refactoring: Specify struct member names explicitly --- internal/graphicsdriver/metal/mtl/mtl.m | 58 +++++++++++++++---------- 1 file changed, 35 insertions(+), 23 deletions(-) diff --git a/internal/graphicsdriver/metal/mtl/mtl.m b/internal/graphicsdriver/metal/mtl/mtl.m index 15f6b6037..3d8694b8e 100644 --- a/internal/graphicsdriver/metal/mtl/mtl.m +++ b/internal/graphicsdriver/metal/mtl/mtl.m @@ -200,12 +200,12 @@ void RenderCommandEncoder_SetViewport(void *renderCommandEncoder, struct Viewport viewport) { [(id)renderCommandEncoder setViewport:(MTLViewport){ - viewport.OriginX, - viewport.OriginY, - viewport.Width, - viewport.Height, - viewport.ZNear, - viewport.ZFar, + .originX = viewport.OriginX, + .originY = viewport.OriginY, + .width = viewport.Width, + .height = viewport.Height, + .znear = viewport.ZNear, + .zfar = viewport.ZFar, }]; } @@ -299,15 +299,18 @@ void BlitCommandEncoder_CopyFromTexture( copyFromTexture:(id)sourceTexture sourceSlice:(NSUInteger)sourceSlice sourceLevel:(NSUInteger)sourceLevel - sourceOrigin:(MTLOrigin){sourceOrigin.X, sourceOrigin.Y, - sourceOrigin.Z} - sourceSize:(MTLSize){sourceSize.Width, sourceSize.Height, - sourceSize.Depth} + sourceOrigin:(MTLOrigin){.x = sourceOrigin.X, + .y = sourceOrigin.Y, + .z = sourceOrigin.Z} + sourceSize:(MTLSize){.width = sourceSize.Width, + .height = sourceSize.Height, + .depth = sourceSize.Depth} toTexture:(id)destinationTexture destinationSlice:(NSUInteger)destinationSlice destinationLevel:(NSUInteger)destinationLevel - destinationOrigin:(MTLOrigin){destinationOrigin.X, destinationOrigin.Y, - destinationOrigin.Z}]; + destinationOrigin:(MTLOrigin){.x = destinationOrigin.X, + .y = destinationOrigin.Y, + .z = destinationOrigin.Z}]; } void *Library_MakeFunction(void *library, const char *name) { @@ -319,22 +322,31 @@ void Texture_Release(void *texture) { [(id)texture release]; } void Texture_GetBytes(void *texture, void *pixelBytes, size_t bytesPerRow, struct Region region, uint_t level) { - [(id)texture - getBytes:(void *)pixelBytes - bytesPerRow:(NSUInteger)bytesPerRow - fromRegion:(MTLRegion) { - {region.Origin.X, region.Origin.Y, region.Origin.Z}, { - region.Size.Width, region.Size.Height, region.Size.Depth - } - } - mipmapLevel:(NSUInteger)level]; + [(id)texture getBytes:(void *)pixelBytes + bytesPerRow:(NSUInteger)bytesPerRow + fromRegion:(MTLRegion) { + .origin = {.x = region.Origin.X, + .y = region.Origin.Y, + .z = region.Origin.Z}, + .size = { + .width = region.Size.Width, + .height = region.Size.Height, + .depth = region.Size.Depth + } + } + mipmapLevel:(NSUInteger)level]; } void Texture_ReplaceRegion(void *texture, struct Region region, uint_t level, void *bytes, uint_t bytesPerRow) { [(id)texture replaceRegion:(MTLRegion) { - {region.Origin.X, region.Origin.Y, region.Origin.Z}, { - region.Size.Width, region.Size.Height, region.Size.Depth + .origin = {.x = region.Origin.X, + .y = region.Origin.Y, + .z = region.Origin.Z}, + .size = { + .width = region.Size.Width, + .height = region.Size.Height, + .depth = region.Size.Depth } } mipmapLevel:(NSUInteger)level