am 3aca01d3: am 2683b10b: Merge "opengl translator: Mac fixes for unbind context"

* commit '3aca01d3b03bdb2e312ff302d04eb36034f09384':
  opengl translator: Mac fixes for unbind context
This commit is contained in:
David Turner
2011-07-06 07:46:24 -07:00
committed by Android Git Automerger
2 changed files with 21 additions and 13 deletions

View File

@@ -117,7 +117,7 @@ bool validNativePixmap(EGLNativeDisplayType dpy, EGLNativePixmapType pix) {
bool checkWindowPixelFormatMatch(EGLNativeDisplayType dpy,EGLNativeWindowType win,EglConfig* cfg,unsigned int* width,unsigned int* height) {
int r,g,b;
bool ret = nsGetWinDims(win,width,height);
cfg->getConfAttrib(EGL_RED_SIZE,&r);
cfg->getConfAttrib(EGL_GREEN_SIZE,&g);
cfg->getConfAttrib(EGL_BLUE_SIZE,&b);
@@ -156,6 +156,17 @@ bool destroyContext(EGLNativeDisplayType dpy,EGLNativeContextType ctx) {
}
bool makeCurrent(EGLNativeDisplayType dpy,EglSurface* read,EglSurface* draw,EGLNativeContextType ctx){
// check for unbind
if (ctx == NULL && read == NULL && draw == NULL) {
nsWindowMakeCurrent(NULL, NULL);
return true;
}
else if (ctx == NULL || read == NULL || draw == NULL) {
// error !
return false;
}
//dont supporting diffrent read & draw surfaces on Mac
if(read->native() != draw->native()) return false;
switch(draw->type()){

View File

@@ -33,7 +33,7 @@ void* getPixelFormat(int i){
void getPixelFormatAttrib(void* pixelFormat,int attrib,int* val){
NSOpenGLPixelFormat *frmt = (NSOpenGLPixelFormat *)pixelFormat;
[frmt getValues:val forAttribute:attrib forVirtualScreen:0];
[frmt getValues:val forAttribute:attrib forVirtualScreen:0];
}
void* nsCreateContext(void* format,void* share){
@@ -60,12 +60,9 @@ void nsWindowMakeCurrent(void* context,void* nativeWin){
NSView* win = (NSView *)nativeWin;
if(ctx == nil){
[NSOpenGLContext clearCurrentContext];
} else {
if(win != nil){
[ctx clearDrawable];
[ctx setView: win];
[ctx makeCurrentContext];
}
} else if (win != nil) {
[ctx setView: win];
[ctx makeCurrentContext];
}
}
@@ -93,11 +90,11 @@ void nsDestroyContext(void* context){
void* nsCreatePBuffer(GLenum target,GLenum format,int maxMip,int width,int height){
return [[NSOpenGLPixelBuffer alloc] initWithTextureTarget:target
textureInternalFormat:format
textureMaxMipMapLevel:maxMip
return [[NSOpenGLPixelBuffer alloc] initWithTextureTarget:target
textureInternalFormat:format
textureMaxMipMapLevel:maxMip
pixelsWide:width pixelsHigh:height];
}
void nsDestroyPBuffer(void* pbuffer){
@@ -129,7 +126,7 @@ bool nsCheckColor(void* win,int colorSize){
int depth = (limit != 0) ? NSBitsPerPixelFromDepth(limit):
NSBitsPerPixelFromDepth(defaultLimit);
return depth >= colorSize;
}
}
return false;