File tree Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Original file line number Diff line number Diff line change 27
27
#if __CC_METAL_SUPPORTED_AND_ENABLED
28
28
29
29
#import " CCTexture_Private.h"
30
+ #import " CCShader_Private.h"
30
31
31
32
@implementation CCMetalContext
32
33
@@ -215,7 +216,15 @@ -(void)prepare
215
216
id <MTLLibrary > library = context.library ;
216
217
#warning TEMP Hard coded shaders.
217
218
pipelineStateDescriptor.vertexFunction = [library newFunctionWithName: @" CCVertexFunctionDefault" ];
218
- pipelineStateDescriptor.fragmentFunction = [library newFunctionWithName: @" CCFragmentFunctionDefaultTextureColor" ];
219
+ if (_shader == [CCShader positionColorShader ]){
220
+ pipelineStateDescriptor.fragmentFunction = [library newFunctionWithName: @" CCFragmentFunctionDefaultColor" ];
221
+ } else if (_shader == [CCShader positionTextureColorShader ]){
222
+ pipelineStateDescriptor.fragmentFunction = [library newFunctionWithName: @" CCFragmentFunctionDefaultTextureColor" ];
223
+ } else if (_shader == [CCShader positionTextureA8ColorShader ]){
224
+ pipelineStateDescriptor.fragmentFunction = [library newFunctionWithName: @" CCFragmentFunctionDefaultTextureA8Color" ];
225
+ } else {
226
+ pipelineStateDescriptor.fragmentFunction = [library newFunctionWithName: @" TempUnsupported" ];
227
+ }
219
228
220
229
NSDictionary *blendOptions = _blendMode.options ;
221
230
MTLRenderPipelineColorAttachmentDescriptor *colorDescriptor = [MTLRenderPipelineColorAttachmentDescriptor new ];
Original file line number Diff line number Diff line change @@ -56,4 +56,13 @@ CCFragmentFunctionDefaultTextureA8Color(
56
56
return in.color *mainTexture.sample (mainTextureSampler, in.texCoord1 ).a ;
57
57
}
58
58
59
+ fragment half4
60
+ TempUnsupported (
61
+ CCFragData in [[stage_in]],
62
+ texture2d<half> mainTexture [[texture(0 )]],
63
+ sampler mainTextureSampler [[sampler(0 )]]
64
+ ){
65
+ return half4 (1 , 0 , 1 , 1 );
66
+ }
67
+
59
68
// TODO "alpha test" shader
You can’t perform that action at this time.
0 commit comments