diff --git a/ios/RNGLContext.m b/ios/RNGLContext.m index 909aac30db9295724f8e82436ed9c1e7d483ce7c..75b021b161887e6073cca23d02c8d42e8ffc80d1 100644 --- a/ios/RNGLContext.m +++ b/ios/RNGLContext.m @@ -49,13 +49,17 @@ RCT_EXPORT_MODULE() withConfig:(NSDictionary *)config withOnCompile:(RCTResponseSenderBlock)onCompile { + NSString *vert = [RCTConvert NSString:config[@"vert"]]; NSString *frag = [RCTConvert NSString:config[@"frag"]]; NSString *name = [RCTConvert NSString:config[@"name"]]; + if (!vert) { + vert = fullViewportVert; + } if (!frag) { RCTLogError(@"Shader '%@': missing frag field", name); return; } - GLShader *shader = [[GLShader alloc] initWithContext:_context withName:name withVert:fullViewportVert withFrag:frag]; + GLShader *shader = [[GLShader alloc] initWithContext:_context withName:name withVert:vert withFrag:frag]; NSError *error; bool success = [shader ensureCompiles:&error]; if (onCompile) { @@ -112,13 +116,17 @@ NSDictionary* glTypesString (NSDictionary *types) { RCT_EXPORT_METHOD(addShader:(nonnull NSNumber *)id withConfig:(NSDictionary *)config withOnCompile:(RCTResponseSenderBlock)onCompile) { + NSString *vert = [RCTConvert NSString:config[@"vert"]]; NSString *frag = [RCTConvert NSString:config[@"frag"]]; NSString *name = [RCTConvert NSString:config[@"name"]]; + if (!vert) { + vert = fullViewportVert; + } if (!frag) { RCTLogError(@"Shader '%@': missing frag field", name); return; } - GLShader *shader = [[GLShader alloc] initWithContext:_context withName:name withVert:fullViewportVert withFrag:frag]; + GLShader *shader = [[GLShader alloc] initWithContext:_context withName:name withVert:vert withFrag:frag]; NSError *error; bool success = [shader ensureCompiles:&error]; if (onCompile) { @@ -158,4 +166,4 @@ RCT_EXPORT_METHOD(removeShader:(nonnull NSNumber *)id) { return [self moduleForClass:[RNGLContext class]]; } -@end \ No newline at end of file +@end