Skip to content

Commit

Permalink
Disable Metal until a cocoapod .metal files fix is found.
Browse files Browse the repository at this point in the history
  • Loading branch information
Tawa committed Jul 3, 2017
1 parent 93c3aea commit 778285a
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
Binary file not shown.
12 changes: 7 additions & 5 deletions TNTutorialManager/TNTutorialManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
#import "TNTutorialView.h"
#import "UIView+TNScreenshotView.h"

#define TN_DISABLE_METAL 1

@implementation TNTutorialEdgeInsets
{
UIEdgeInsets insets;
Expand All @@ -35,7 +37,7 @@ -(UIEdgeInsets)insets

@interface TNTutorialManager ()
{
#if !(TARGET_IPHONE_SIMULATOR)
#if !(TN_DISABLE_METAL)
TNTutorialView *tutorialView;
#else
UIImageView *tutorialView;
Expand All @@ -59,7 +61,7 @@ -(instancetype)initWithDelegate:(id<TNTutorialManagerDelegate>)delegate
self.delegate = delegate;

tutorialSkipButton = nil;
#if !(TARGET_IPHONE_SIMULATOR)
#if !(TN_DISABLE_METAL)
tutorialView = [TNTutorialView instance];
#else
tutorialView = [[UIImageView alloc] initWithFrame:[UIScreen mainScreen].bounds];
Expand All @@ -74,7 +76,7 @@ -(instancetype)initWithDelegate:(id<TNTutorialManagerDelegate>)delegate

-(void)highlightViews:(NSArray <UIView *> *)views
{
#if !(TARGET_IPHONE_SIMULATOR)
#if !(TN_DISABLE_METAL)
tutorialView.image = [[self.delegate tutorialMasterView] toImage];
#endif

Expand Down Expand Up @@ -273,7 +275,7 @@ -(void)setupLayout
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();

#if (TARGET_IPHONE_SIMULATOR)
#if (TN_DISABLE_METAL)
{
CGSize size = image.size;
int width = size.width;
Expand Down Expand Up @@ -312,7 +314,7 @@ -(void)setupLayout
}
#endif

#if !(TARGET_IPHONE_SIMULATOR)
#if !(TN_DISABLE_METAL)
tutorialView.overlay = image;
#else
tutorialView.image = image;
Expand Down
7 changes: 5 additions & 2 deletions TNTutorialManager/TNTutorialView.m
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

#import "TNTutorialView.h"

#if !(TARGET_IPHONE_SIMULATOR)
#if !(TN_DISABLE_METAL)

@import MetalKit;

Expand Down Expand Up @@ -73,6 +73,10 @@ -(instancetype)initWithFrame:(CGRect)frame
vertexBuffer = [device newBufferWithBytes:vertexData length:dataSize options:0];

id<MTLLibrary> defaultLibrary = [device newDefaultLibrary];
NSError *error = nil;
if (error) {
NSLog(@"Error: %@", [error localizedDescription]);
}
id<MTLFunction> fragmentProgram = [defaultLibrary newFunctionWithName:@"tntutorial_fragment"];
id<MTLFunction> vertexProgram = [defaultLibrary newFunctionWithName:@"tntutorial_vertex"];

Expand All @@ -81,7 +85,6 @@ -(instancetype)initWithFrame:(CGRect)frame
pipelineStateDescriptor.vertexFunction = vertexProgram;
pipelineStateDescriptor.colorAttachments[0].pixelFormat = MTLPixelFormatBGRA8Unorm;

NSError *error = nil;
pipelineState = [device newRenderPipelineStateWithDescriptor:pipelineStateDescriptor error:&error];
if (error) {
NSLog(@"Error making render pipeline state: %@", [error localizedDescription]);
Expand Down

0 comments on commit 778285a

Please sign in to comment.