graphicsdriver/metal/mtl: Refactoring: Specify struct member names explicitly

This commit is contained in:
Hajime Hoshi 2020-11-07 23:46:07 +09:00
parent a8f96ee9af
commit e4e8e7254e

View File

@ -200,12 +200,12 @@ void RenderCommandEncoder_SetViewport(void *renderCommandEncoder,
struct Viewport viewport) { struct Viewport viewport) {
[(id<MTLRenderCommandEncoder>)renderCommandEncoder [(id<MTLRenderCommandEncoder>)renderCommandEncoder
setViewport:(MTLViewport){ setViewport:(MTLViewport){
viewport.OriginX, .originX = viewport.OriginX,
viewport.OriginY, .originY = viewport.OriginY,
viewport.Width, .width = viewport.Width,
viewport.Height, .height = viewport.Height,
viewport.ZNear, .znear = viewport.ZNear,
viewport.ZFar, .zfar = viewport.ZFar,
}]; }];
} }
@ -299,15 +299,18 @@ void BlitCommandEncoder_CopyFromTexture(
copyFromTexture:(id<MTLTexture>)sourceTexture copyFromTexture:(id<MTLTexture>)sourceTexture
sourceSlice:(NSUInteger)sourceSlice sourceSlice:(NSUInteger)sourceSlice
sourceLevel:(NSUInteger)sourceLevel sourceLevel:(NSUInteger)sourceLevel
sourceOrigin:(MTLOrigin){sourceOrigin.X, sourceOrigin.Y, sourceOrigin:(MTLOrigin){.x = sourceOrigin.X,
sourceOrigin.Z} .y = sourceOrigin.Y,
sourceSize:(MTLSize){sourceSize.Width, sourceSize.Height, .z = sourceOrigin.Z}
sourceSize.Depth} sourceSize:(MTLSize){.width = sourceSize.Width,
.height = sourceSize.Height,
.depth = sourceSize.Depth}
toTexture:(id<MTLTexture>)destinationTexture toTexture:(id<MTLTexture>)destinationTexture
destinationSlice:(NSUInteger)destinationSlice destinationSlice:(NSUInteger)destinationSlice
destinationLevel:(NSUInteger)destinationLevel destinationLevel:(NSUInteger)destinationLevel
destinationOrigin:(MTLOrigin){destinationOrigin.X, destinationOrigin.Y, destinationOrigin:(MTLOrigin){.x = destinationOrigin.X,
destinationOrigin.Z}]; .y = destinationOrigin.Y,
.z = destinationOrigin.Z}];
} }
void *Library_MakeFunction(void *library, const char *name) { void *Library_MakeFunction(void *library, const char *name) {
@ -319,22 +322,31 @@ void Texture_Release(void *texture) { [(id<MTLTexture>)texture release]; }
void Texture_GetBytes(void *texture, void *pixelBytes, size_t bytesPerRow, void Texture_GetBytes(void *texture, void *pixelBytes, size_t bytesPerRow,
struct Region region, uint_t level) { struct Region region, uint_t level) {
[(id<MTLTexture>)texture [(id<MTLTexture>)texture getBytes:(void *)pixelBytes
getBytes:(void *)pixelBytes bytesPerRow:(NSUInteger)bytesPerRow
bytesPerRow:(NSUInteger)bytesPerRow fromRegion:(MTLRegion) {
fromRegion:(MTLRegion) { .origin = {.x = region.Origin.X,
{region.Origin.X, region.Origin.Y, region.Origin.Z}, { .y = region.Origin.Y,
region.Size.Width, region.Size.Height, region.Size.Depth .z = region.Origin.Z},
} .size = {
} .width = region.Size.Width,
mipmapLevel:(NSUInteger)level]; .height = region.Size.Height,
.depth = region.Size.Depth
}
}
mipmapLevel:(NSUInteger)level];
} }
void Texture_ReplaceRegion(void *texture, struct Region region, uint_t level, void Texture_ReplaceRegion(void *texture, struct Region region, uint_t level,
void *bytes, uint_t bytesPerRow) { void *bytes, uint_t bytesPerRow) {
[(id<MTLTexture>)texture replaceRegion:(MTLRegion) { [(id<MTLTexture>)texture replaceRegion:(MTLRegion) {
{region.Origin.X, region.Origin.Y, region.Origin.Z}, { .origin = {.x = region.Origin.X,
region.Size.Width, region.Size.Height, region.Size.Depth .y = region.Origin.Y,
.z = region.Origin.Z},
.size = {
.width = region.Size.Width,
.height = region.Size.Height,
.depth = region.Size.Depth
} }
} }
mipmapLevel:(NSUInteger)level mipmapLevel:(NSUInteger)level