Merge "opengl translator: Mac fixes for unbind context"
This commit is contained in:
@@ -117,7 +117,7 @@ bool validNativePixmap(EGLNativeDisplayType dpy, EGLNativePixmapType pix) {
|
|||||||
bool checkWindowPixelFormatMatch(EGLNativeDisplayType dpy,EGLNativeWindowType win,EglConfig* cfg,unsigned int* width,unsigned int* height) {
|
bool checkWindowPixelFormatMatch(EGLNativeDisplayType dpy,EGLNativeWindowType win,EglConfig* cfg,unsigned int* width,unsigned int* height) {
|
||||||
int r,g,b;
|
int r,g,b;
|
||||||
bool ret = nsGetWinDims(win,width,height);
|
bool ret = nsGetWinDims(win,width,height);
|
||||||
|
|
||||||
cfg->getConfAttrib(EGL_RED_SIZE,&r);
|
cfg->getConfAttrib(EGL_RED_SIZE,&r);
|
||||||
cfg->getConfAttrib(EGL_GREEN_SIZE,&g);
|
cfg->getConfAttrib(EGL_GREEN_SIZE,&g);
|
||||||
cfg->getConfAttrib(EGL_BLUE_SIZE,&b);
|
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){
|
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
|
//dont supporting diffrent read & draw surfaces on Mac
|
||||||
if(read->native() != draw->native()) return false;
|
if(read->native() != draw->native()) return false;
|
||||||
switch(draw->type()){
|
switch(draw->type()){
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ void* getPixelFormat(int i){
|
|||||||
|
|
||||||
void getPixelFormatAttrib(void* pixelFormat,int attrib,int* val){
|
void getPixelFormatAttrib(void* pixelFormat,int attrib,int* val){
|
||||||
NSOpenGLPixelFormat *frmt = (NSOpenGLPixelFormat *)pixelFormat;
|
NSOpenGLPixelFormat *frmt = (NSOpenGLPixelFormat *)pixelFormat;
|
||||||
[frmt getValues:val forAttribute:attrib forVirtualScreen:0];
|
[frmt getValues:val forAttribute:attrib forVirtualScreen:0];
|
||||||
}
|
}
|
||||||
|
|
||||||
void* nsCreateContext(void* format,void* share){
|
void* nsCreateContext(void* format,void* share){
|
||||||
@@ -60,12 +60,9 @@ void nsWindowMakeCurrent(void* context,void* nativeWin){
|
|||||||
NSView* win = (NSView *)nativeWin;
|
NSView* win = (NSView *)nativeWin;
|
||||||
if(ctx == nil){
|
if(ctx == nil){
|
||||||
[NSOpenGLContext clearCurrentContext];
|
[NSOpenGLContext clearCurrentContext];
|
||||||
} else {
|
} else if (win != nil) {
|
||||||
if(win != nil){
|
[ctx setView: win];
|
||||||
[ctx clearDrawable];
|
[ctx makeCurrentContext];
|
||||||
[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){
|
void* nsCreatePBuffer(GLenum target,GLenum format,int maxMip,int width,int height){
|
||||||
return [[NSOpenGLPixelBuffer alloc] initWithTextureTarget:target
|
return [[NSOpenGLPixelBuffer alloc] initWithTextureTarget:target
|
||||||
textureInternalFormat:format
|
textureInternalFormat:format
|
||||||
textureMaxMipMapLevel:maxMip
|
textureMaxMipMapLevel:maxMip
|
||||||
pixelsWide:width pixelsHigh:height];
|
pixelsWide:width pixelsHigh:height];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void nsDestroyPBuffer(void* pbuffer){
|
void nsDestroyPBuffer(void* pbuffer){
|
||||||
@@ -129,7 +126,7 @@ bool nsCheckColor(void* win,int colorSize){
|
|||||||
int depth = (limit != 0) ? NSBitsPerPixelFromDepth(limit):
|
int depth = (limit != 0) ? NSBitsPerPixelFromDepth(limit):
|
||||||
NSBitsPerPixelFromDepth(defaultLimit);
|
NSBitsPerPixelFromDepth(defaultLimit);
|
||||||
return depth >= colorSize;
|
return depth >= colorSize;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
Reference in New Issue
Block a user