Skip to content

Commit 405a734

Browse files
committed
Fixed a threaded rendering issue and check the GL context when checking for errors.
1 parent e443be6 commit 405a734

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

cocos2d/CCConfiguration.m

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,6 @@ -(id) init
131131
}
132132
}
133133

134-
CC_CHECK_GL_ERROR_DEBUG();
135-
136134
return self;
137135
}
138136

cocos2d/CCRenderDispatch.m

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@
4646
dispatch_once(&once, ^{
4747
CC_RENDER_DISPATCH_CONTEXT = [[EAGLContext alloc] initWithAPI:api sharegroup:sharegroup];
4848

49-
5049
CC_RENDER_DISPATCH_QUEUE = dispatch_queue_create("CCRenderQueue", DISPATCH_QUEUE_SERIAL);
5150
CC_RENDER_DISPATCH_SEMAPHORE = dispatch_semaphore_create(CC_RENDER_DISPATCH_MAX_FRAMES);
5251
});
@@ -72,7 +71,6 @@ static void CCRenderDispatchExecute(BOOL threadsafe, BOOL frame, dispatch_block_
7271
});
7372
#else
7473
block();
75-
CC_CHECK_GL_ERROR_DEBUG();
7674
#endif
7775
}
7876

cocos2d/CCRenderer_private.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
#import <Foundation/Foundation.h>
2727
#import "CCRenderer.h"
2828
#import "CCCache.h"
29+
#import "CCRenderDispatch.h"
2930

3031
// TODO These should be made private to the module.
3132
extern id CCBLENDMODE_CACHE;
@@ -155,7 +156,7 @@ CCGraphicsBufferPushElements(CCGraphicsBuffer *buffer, size_t requestedCount, CC
155156
size_t capacity = buffer->_capacity;
156157
if(required > capacity){
157158
// Why 1.5? https://github.com/facebook/folly/blob/master/folly/docs/FBVector.md
158-
[buffer resize:required*1.5];
159+
CCRenderDispatch(NO, ^{[buffer resize:required*1.5];});
159160
}
160161

161162
void *array = buffer->_ptr + buffer->_count*buffer->_elementSize;

cocos2d/Platforms/CCGL.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,9 @@
5353
#define CC_CHECK_GL_ERROR_DEBUG() __CC_CHECK_GL_ERROR_DEBUG(__FUNCTION__, __LINE__)
5454
static inline void __CC_CHECK_GL_ERROR_DEBUG(const char *function, int line)
5555
{
56+
#warning Should reenable this when the Metal renderer is complete enough.
57+
// NSCAssert([EAGLContext currentContext], @"GL context is not set.");
58+
5659
GLenum error;
5760
while((error = glGetError())){
5861
switch(error){

0 commit comments

Comments
 (0)