Skip to content

Commit

Permalink
metal fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
thatcosmonaut committed Jun 18, 2024
1 parent a218038 commit fc788b6
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/gpu/metal/SDL_gpu_metal.m
Original file line number Diff line number Diff line change
Expand Up @@ -1374,8 +1374,7 @@ static void METAL_INTERNAL_CycleActiveTexture(

if (isPrivate) {
resourceOptions = MTLResourceStorageModePrivate;
} else
{
} else {
if (isWriteOnly) {
resourceOptions = MTLResourceCPUCacheModeWriteCombined;
} else {
Expand Down Expand Up @@ -1410,7 +1409,6 @@ static void METAL_INTERNAL_CycleActiveTexture(
SDL_bool uploadOnly,
Uint32 sizeInBytes)
{
(void)usage;
return (SDL_GpuTransferBuffer *)METAL_INTERNAL_CreateBufferContainer(
(MetalRenderer *)driverData,
sizeInBytes,
Expand Down Expand Up @@ -1452,12 +1450,14 @@ static void METAL_INTERNAL_CycleActiveBuffer(
container->bufferCapacity,
container->bufferCapacity + 1);

if (container->transferMapFlags == 0) {
if (container->isPrivate) {
resourceOptions = MTLResourceStorageModePrivate;
} else if ((container->transferMapFlags & SDL_GPU_TRANSFER_MAP_WRITE) && !(container->transferMapFlags & SDL_GPU_TRANSFER_MAP_READ)) {
resourceOptions = MTLResourceCPUCacheModeWriteCombined;
} else {
resourceOptions = MTLResourceCPUCacheModeDefaultCache;
if (container->isWriteOnly) {
resourceOptions = MTLResourceCPUCacheModeWriteCombined;
} else {
resourceOptions = MTLResourceCPUCacheModeDefaultCache;
}
}

container->buffers[container->bufferCount] = METAL_INTERNAL_CreateBuffer(
Expand Down

0 comments on commit fc788b6

Please sign in to comment.