File tree Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -186,6 +186,18 @@ +(void)initialize
186
186
CCTextureNone->_name = 0 ;
187
187
CCTextureNone->_format = CCTexturePixelFormat_RGBA8888;
188
188
CCTextureNone->_contentScale = 1.0 ;
189
+
190
+ #if __CC_METAL_SUPPORTED_AND_ENABLED
191
+ if ([CCConfiguration sharedConfiguration ].graphicsAPI == CCGraphicsAPIMetal){
192
+ CCMetalContext *context = [CCMetalContext currentContext ];
193
+ NSAssert (context, @" Metal context is nil." );
194
+
195
+ CCTextureNone->_metalSampler = [context.device newSamplerStateWithDescriptor: [MTLSamplerDescriptor new ]];
196
+
197
+ MTLTextureDescriptor *textureDesc = [MTLTextureDescriptor texture2DDescriptorWithPixelFormat: MTLPixelFormatRGBA8Unorm width: 1 height: 1 mipmapped: NO ];
198
+ CCTextureNone->_metalTexture = [context.device newTextureWithDescriptor: textureDesc];
199
+ }
200
+ #endif
189
201
}
190
202
191
203
+(instancetype )none
Original file line number Diff line number Diff line change @@ -238,7 +238,7 @@ -(void)prepare
238
238
239
239
CCTexture *texture = _shaderUniforms[CCShaderUniformMainTexture] ?: [CCTexture none ];
240
240
_textureRange = NSMakeRange (0 , 1 );
241
- _samplers[0 ] = texture.metalSampler ?: [context.device newSamplerStateWithDescriptor: [ MTLSamplerDescriptor new ]] ;
241
+ _samplers[0 ] = texture.metalSampler ;
242
242
_textures[0 ] = texture.metalTexture ;
243
243
}
244
244
}
You can’t perform that action at this time.
0 commit comments