@@ -231,18 +231,6 @@ +(CCBlendMode *)multiplyMode
231
231
232
232
233
233
// MARK: Render States.
234
- @interface CCRenderState () {
235
- @public
236
- CCBlendMode *_blendMode;
237
- CCShader *_shader;
238
- NSDictionary *_shaderUniforms;
239
- }
240
-
241
- -(instancetype )initWithBlendMode : (CCBlendMode *)blendMode shader : (CCShader *)shader shaderUniforms : (NSDictionary *)shaderUniforms ;
242
-
243
- @end
244
-
245
-
246
234
@interface CCRenderStateCache : CCCache
247
235
@end
248
236
@@ -256,7 +244,7 @@ -(id)createSharedDataForKey:(CCRenderState *)renderState
256
244
257
245
-(id )createPublicObjectForSharedData : (CCRenderState *)renderState
258
246
{
259
- return [[CCRenderState alloc ] initWithBlendMode: renderState->_blendMode shader: renderState->_shader shaderUniforms: renderState->_shaderUniforms ];
247
+ return [renderState copy ];
260
248
}
261
249
262
250
// Nothing special
@@ -275,6 +263,11 @@ -(void)flush
275
263
276
264
@implementation CCRenderState {
277
265
CCTexture *_mainTexture;
266
+
267
+ @public
268
+ CCBlendMode *_blendMode;
269
+ CCShader *_shader;
270
+ NSDictionary *_shaderUniforms;
278
271
}
279
272
280
273
CCRenderStateCache *CCRENDERSTATE_CACHE = nil ;
@@ -312,10 +305,11 @@ +(instancetype)renderStateWithBlendMode:(CCBlendMode *)blendMode shader:(CCShade
312
305
313
306
-(id )copyWithZone : (NSZone *)zone
314
307
{
315
- if ([_shaderUniforms isKindOfClass: [NSMutableDictionary class ]]){
316
- return [[CCRenderState allocWithZone: zone] initWithBlendMode: _blendMode shader: _shader shaderUniforms: [_shaderUniforms copy ]];
317
- } else {
308
+ NSDictionary *shaderUniforms = [_shaderUniforms copy ];
309
+ if (shaderUniforms == _shaderUniforms){
318
310
return self;
311
+ } else {
312
+ return [[CCRenderState allocWithZone: zone] initWithBlendMode: _blendMode shader: _shader shaderUniforms: shaderUniforms];
319
313
}
320
314
}
321
315
0 commit comments