improved readability for references to the platform specific metal storage mode option; removed support for btstack since its not compiling and is less relevant for the iOS platform; removed commented out code
This commit is contained in:
parent
fd9ac64d55
commit
a2327be378
|
@ -9,6 +9,7 @@
|
||||||
#import "Context.h"
|
#import "Context.h"
|
||||||
#import "Filter.h"
|
#import "Filter.h"
|
||||||
#import <QuartzCore/QuartzCore.h>
|
#import <QuartzCore/QuartzCore.h>
|
||||||
|
#import "metal_common.h"
|
||||||
|
|
||||||
@interface BufferNode : NSObject
|
@interface BufferNode : NSObject
|
||||||
@property (nonatomic, readonly) id<MTLBuffer> src;
|
@property (nonatomic, readonly) id<MTLBuffer> src;
|
||||||
|
@ -759,15 +760,9 @@ static const NSUInteger kConstantAlignment = 4;
|
||||||
- (bool)allocRange:(BufferRange *)range length:(NSUInteger)length
|
- (bool)allocRange:(BufferRange *)range length:(NSUInteger)length
|
||||||
{
|
{
|
||||||
MTLResourceOptions opts;
|
MTLResourceOptions opts;
|
||||||
|
opts = PLATFORM_METAL_RESOURCE_STORAGE_MODE;
|
||||||
memset(range, 0, sizeof(*range));
|
memset(range, 0, sizeof(*range));
|
||||||
|
|
||||||
#if TARGET_OS_OSX
|
|
||||||
opts = MTLResourceStorageModeManaged;
|
|
||||||
#else
|
|
||||||
opts = MTLResourceStorageModeShared;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (!_head)
|
if (!_head)
|
||||||
{
|
{
|
||||||
_head = [[BufferNode alloc] initWithBuffer:[_device newBufferWithLength:_blockLen options:opts]];
|
_head = [[BufferNode alloc] initWithBuffer:[_device newBufferWithLength:_blockLen options:opts]];
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
#import "Context.h"
|
#import "Context.h"
|
||||||
#import "MenuDisplay.h"
|
#import "MenuDisplay.h"
|
||||||
#import "ShaderTypes.h"
|
#import "ShaderTypes.h"
|
||||||
//#import "menu_driver.h"
|
#include "../../../menu/menu_driver.h"
|
||||||
#import <Metal/Metal.h>
|
#import <Metal/Metal.h>
|
||||||
/* TODO(sgc): this dependency is incorrect */
|
/* TODO(sgc): this dependency is incorrect */
|
||||||
#import "../metal_common.h"
|
#import "../metal_common.h"
|
||||||
|
|
|
@ -28,6 +28,12 @@
|
||||||
#include "../../config.h"
|
#include "../../config.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_COCOATOUCH
|
||||||
|
#define PLATFORM_METAL_RESOURCE_STORAGE_MODE MTLResourceStorageModeShared
|
||||||
|
#else
|
||||||
|
#define PLATFORM_METAL_RESOURCE_STORAGE_MODE MTLResourceStorageModeManaged
|
||||||
|
#endif
|
||||||
|
|
||||||
RETRO_BEGIN_DECLS
|
RETRO_BEGIN_DECLS
|
||||||
|
|
||||||
extern MTLPixelFormat glslang_format_to_metal(glslang_format fmt);
|
extern MTLPixelFormat glslang_format_to_metal(glslang_format fmt);
|
||||||
|
|
|
@ -505,9 +505,6 @@
|
||||||
NSLog(@"mtkView drawableSizeWillChange to: %f x %f",size.width,size.height);
|
NSLog(@"mtkView drawableSizeWillChange to: %f x %f",size.width,size.height);
|
||||||
#ifdef HAVE_COCOATOUCH
|
#ifdef HAVE_COCOATOUCH
|
||||||
CGFloat scale = [[UIScreen mainScreen] scale];
|
CGFloat scale = [[UIScreen mainScreen] scale];
|
||||||
// // due to autolayout constraints?
|
|
||||||
//// if (size.width == INFINITY || size.height == INFINITY) {
|
|
||||||
// NSLog(@"mtkView drawableSizeWillChange width or height is infinity, flipping...");
|
|
||||||
[self setViewportWidth:(unsigned int)view.bounds.size.width*scale height:(unsigned int)view.bounds.size.height*scale forceFull:NO allowRotate:YES];
|
[self setViewportWidth:(unsigned int)view.bounds.size.width*scale height:(unsigned int)view.bounds.size.height*scale forceFull:NO allowRotate:YES];
|
||||||
#else
|
#else
|
||||||
[self setViewportWidth:(unsigned int)size.width height:(unsigned int)size.height forceFull:NO allowRotate:YES];
|
[self setViewportWidth:(unsigned int)size.width height:(unsigned int)size.height forceFull:NO allowRotate:YES];
|
||||||
|
@ -1373,11 +1370,7 @@ typedef struct MTLALIGN(16)
|
||||||
if (size == 0)
|
if (size == 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
#if defined(HAVE_COCOATOUCH)
|
id<MTLBuffer> buf = [_context.device newBufferWithLength:size options:PLATFORM_METAL_RESOURCE_STORAGE_MODE];
|
||||||
id<MTLBuffer> buf = [_context.device newBufferWithLength:size options:MTLResourceStorageModeShared];
|
|
||||||
#else
|
|
||||||
id<MTLBuffer> buf = [_context.device newBufferWithLength:size options:MTLResourceStorageModeManaged];
|
|
||||||
#endif
|
|
||||||
STRUCT_ASSIGN(_engine.pass[i].buffers[j], buf);
|
STRUCT_ASSIGN(_engine.pass[i].buffers[j], buf);
|
||||||
}
|
}
|
||||||
} @finally
|
} @finally
|
||||||
|
@ -1493,11 +1486,7 @@ typedef struct MTLALIGN(16)
|
||||||
NSUInteger needed = sizeof(SpriteVertex) * count * 4;
|
NSUInteger needed = sizeof(SpriteVertex) * count * 4;
|
||||||
if (!_vert || _vert.length < needed)
|
if (!_vert || _vert.length < needed)
|
||||||
{
|
{
|
||||||
#if defined(HAVE_COCOATOUCH)
|
_vert = [_context.device newBufferWithLength:needed options:PLATFORM_METAL_RESOURCE_STORAGE_MODE];
|
||||||
_vert = [_context.device newBufferWithLength:needed options:MTLResourceStorageModeShared];
|
|
||||||
#else
|
|
||||||
_vert = [_context.device newBufferWithLength:needed options:MTLResourceStorageModeManaged];
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (NSUInteger i = 0; i < count; i++)
|
for (NSUInteger i = 0; i < count; i++)
|
||||||
|
|
|
@ -79,13 +79,7 @@
|
||||||
{
|
{
|
||||||
_buffer = [_context.device newBufferWithBytes:_atlas->buffer
|
_buffer = [_context.device newBufferWithBytes:_atlas->buffer
|
||||||
length:(NSUInteger)(_stride * _atlas->height)
|
length:(NSUInteger)(_stride * _atlas->height)
|
||||||
options:
|
options:PLATFORM_METAL_RESOURCE_STORAGE_MODE];
|
||||||
#if defined(HAVE_COCOATOUCH)
|
|
||||||
MTLResourceStorageModeShared
|
|
||||||
#else
|
|
||||||
MTLResourceStorageModeManaged
|
|
||||||
#endif
|
|
||||||
];
|
|
||||||
|
|
||||||
// Even though newBufferWithBytes will copy the initial contents
|
// Even though newBufferWithBytes will copy the initial contents
|
||||||
// from our atlas, it doesn't seem to invalidate the buffer when
|
// from our atlas, it doesn't seem to invalidate the buffer when
|
||||||
|
@ -98,13 +92,7 @@
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_buffer = [_context.device newBufferWithLength:(NSUInteger)(_stride * _atlas->height)
|
_buffer = [_context.device newBufferWithLength:(NSUInteger)(_stride * _atlas->height)
|
||||||
options:
|
options:PLATFORM_METAL_RESOURCE_STORAGE_MODE];
|
||||||
#if defined(HAVE_COCOATOUCH)
|
|
||||||
MTLResourceStorageModeShared
|
|
||||||
#else
|
|
||||||
MTLResourceStorageModeManaged
|
|
||||||
#endif
|
|
||||||
];
|
|
||||||
void *dst = _buffer.contents;
|
void *dst = _buffer.contents;
|
||||||
void *src = _atlas->buffer;
|
void *src = _atlas->buffer;
|
||||||
for (unsigned i = 0; i < _atlas->height; i++)
|
for (unsigned i = 0; i < _atlas->height; i++)
|
||||||
|
@ -127,13 +115,7 @@
|
||||||
|
|
||||||
_capacity = 12000;
|
_capacity = 12000;
|
||||||
_vert = [_context.device newBufferWithLength:sizeof(SpriteVertex) *
|
_vert = [_context.device newBufferWithLength:sizeof(SpriteVertex) *
|
||||||
_capacity options:
|
_capacity options:PLATFORM_METAL_RESOURCE_STORAGE_MODE];
|
||||||
#if defined(HAVE_COCOATOUCH)
|
|
||||||
MTLResourceStorageModeShared
|
|
||||||
#else
|
|
||||||
MTLResourceStorageModeManaged
|
|
||||||
#endif
|
|
||||||
];
|
|
||||||
if (![self _initializeState])
|
if (![self _initializeState])
|
||||||
{
|
{
|
||||||
return nil;
|
return nil;
|
||||||
|
|
|
@ -842,8 +842,16 @@
|
||||||
"-DHAVE_SHADERPIPELINE",
|
"-DHAVE_SHADERPIPELINE",
|
||||||
"-D_LZMA_UINT32_IS_ULONG",
|
"-D_LZMA_UINT32_IS_ULONG",
|
||||||
"-DHAVE_MFI",
|
"-DHAVE_MFI",
|
||||||
"-DHAVE_BTSTACK",
|
|
||||||
"-DHAVE_KEYMAPPER",
|
"-DHAVE_KEYMAPPER",
|
||||||
|
"-DHAVE_COCOA_METAL",
|
||||||
|
"-DHAVE_METAL",
|
||||||
|
"-DHAVE_SLANG",
|
||||||
|
"-DHAVE_SPIRV_CROSS",
|
||||||
|
"-DHAVE_GLSLANG",
|
||||||
|
"-DWANT_GLSLANG",
|
||||||
|
"-DGLSLANG_OSINCLUDE_UNIX",
|
||||||
|
"-DENABLE_HLSL",
|
||||||
|
"-DHAVE_BUILTINGLSLANG",
|
||||||
);
|
);
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = com.libretro.RetroArchDBUG;
|
PRODUCT_BUNDLE_IDENTIFIER = com.libretro.RetroArchDBUG;
|
||||||
PRODUCT_NAME = RADEBUG;
|
PRODUCT_NAME = RADEBUG;
|
||||||
|
@ -965,8 +973,16 @@
|
||||||
"-DHAVE_SHADERPIPELINE",
|
"-DHAVE_SHADERPIPELINE",
|
||||||
"-D_LZMA_UINT32_IS_ULONG",
|
"-D_LZMA_UINT32_IS_ULONG",
|
||||||
"-DHAVE_MFI",
|
"-DHAVE_MFI",
|
||||||
"-DHAVE_BTSTACK",
|
|
||||||
"-DHAVE_KEYMAPPER",
|
"-DHAVE_KEYMAPPER",
|
||||||
|
"-DHAVE_COCOA_METAL",
|
||||||
|
"-DHAVE_METAL",
|
||||||
|
"-DHAVE_SLANG",
|
||||||
|
"-DHAVE_SPIRV_CROSS",
|
||||||
|
"-DHAVE_GLSLANG",
|
||||||
|
"-DWANT_GLSLANG",
|
||||||
|
"-DGLSLANG_OSINCLUDE_UNIX",
|
||||||
|
"-DENABLE_HLSL",
|
||||||
|
"-DHAVE_BUILTINGLSLANG",
|
||||||
);
|
);
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = com.libretro.dist.tvos.RetroArch;
|
PRODUCT_BUNDLE_IDENTIFIER = com.libretro.dist.tvos.RetroArch;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
|
@ -1089,8 +1105,16 @@
|
||||||
"-DHAVE_SHADERPIPELINE",
|
"-DHAVE_SHADERPIPELINE",
|
||||||
"-D_LZMA_UINT32_IS_ULONG",
|
"-D_LZMA_UINT32_IS_ULONG",
|
||||||
"-DHAVE_MFI",
|
"-DHAVE_MFI",
|
||||||
"-DHAVE_BTSTACK",
|
|
||||||
"-DHAVE_KEYMAPPER",
|
"-DHAVE_KEYMAPPER",
|
||||||
|
"-DHAVE_COCOA_METAL",
|
||||||
|
"-DHAVE_METAL",
|
||||||
|
"-DHAVE_SLANG",
|
||||||
|
"-DHAVE_SPIRV_CROSS",
|
||||||
|
"-DHAVE_GLSLANG",
|
||||||
|
"-DWANT_GLSLANG",
|
||||||
|
"-DGLSLANG_OSINCLUDE_UNIX",
|
||||||
|
"-DENABLE_HLSL",
|
||||||
|
"-DHAVE_BUILTINGLSLANG",
|
||||||
);
|
);
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = com.libretro.dist.tvos.RetroArch;
|
PRODUCT_BUNDLE_IDENTIFIER = com.libretro.dist.tvos.RetroArch;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
|
|
Loading…
Reference in New Issue