Apple renamed nsctx -> nsgl_ctx

Changed some naming of parameters in the NSGL Objective-C functions
This commit is contained in:
Jake Turner
2021-03-26 05:42:33 +00:00
committed by Baldur Karlsson
parent 2545dfc853
commit e074c3aba0
3 changed files with 49 additions and 49 deletions
+16 -16
View File
@@ -32,11 +32,11 @@
// helpers defined in cgl_platform.mm
extern "C" int NSGL_getLayerWidth(void *layer);
extern "C" int NSGL_getLayerHeight(void *layer);
extern "C" void *NSGL_createContext(void *view, void *shareNSCtx);
extern "C" void NSGL_makeCurrentContext(void *nsctx);
extern "C" void NSGL_update(void *nsctx);
extern "C" void NSGL_flushBuffer(void *nsctx);
extern "C" void NSGL_destroyContext(void *nsctx);
extern "C" void *NSGL_createContext(void *view, void *shareContext);
extern "C" void NSGL_makeCurrentContext(void *context);
extern "C" void NSGL_update(void *context);
extern "C" void NSGL_flushBuffer(void *context);
extern "C" void NSGL_destroyContext(void *context);
// helper for cgl_platform.mm
extern "C" void NSGL_LogText(const char *text)
@@ -107,7 +107,7 @@ class CGLPlatform : public GLPlatform
{
if(RenderDoc::Inst().IsReplayApp())
{
NSGL_makeCurrentContext(data.nsctx);
NSGL_makeCurrentContext(data.nsgl_ctx);
return true;
}
else
@@ -130,8 +130,8 @@ class CGLPlatform : public GLPlatform
if(RenderDoc::Inst().IsReplayApp())
{
RDCASSERT(share.nsctx);
ret.nsctx = NSGL_createContext(NULL, share.nsctx);
RDCASSERT(share.nsgl_ctx);
ret.nsgl_ctx = NSGL_createContext(NULL, share.nsgl_ctx);
}
else
{
@@ -149,7 +149,7 @@ class CGLPlatform : public GLPlatform
{
if(RenderDoc::Inst().IsReplayApp())
{
NSGL_destroyContext(context.nsctx);
NSGL_destroyContext(context.nsgl_ctx);
}
else
{
@@ -159,11 +159,11 @@ class CGLPlatform : public GLPlatform
}
void DeleteReplayContext(GLWindowingData context)
{
RDCASSERT(context.nsctx);
NSGL_destroyContext(context.nsctx);
RDCASSERT(context.nsgl_ctx);
NSGL_destroyContext(context.nsgl_ctx);
}
void SwapBuffers(GLWindowingData context) { NSGL_flushBuffer(context.nsctx); }
void WindowResized(GLWindowingData context) { NSGL_update(context.nsctx); }
void SwapBuffers(GLWindowingData context) { NSGL_flushBuffer(context.nsgl_ctx); }
void WindowResized(GLWindowingData context) { NSGL_update(context.nsgl_ctx); }
void GetOutputWindowDimensions(GLWindowingData context, int32_t &w, int32_t &h)
{
if(context.layer)
@@ -199,7 +199,7 @@ class CGLPlatform : public GLPlatform
{
RDCASSERT(window.macOS.layer && window.macOS.view);
ret.nsctx = NSGL_createContext(window.macOS.view, share_context.nsctx);
ret.nsgl_ctx = NSGL_createContext(window.macOS.view, share_context.nsgl_ctx);
ret.wnd = window.macOS.view;
ret.layer = window.macOS.layer;
@@ -207,7 +207,7 @@ class CGLPlatform : public GLPlatform
}
else if(window.system == WindowingSystem::Unknown || window.system == WindowingSystem::Headless)
{
ret.nsctx = NSGL_createContext(NULL, share_context.nsctx);
ret.nsgl_ctx = NSGL_createContext(NULL, share_context.nsgl_ctx);
return ret;
}
@@ -223,7 +223,7 @@ class CGLPlatform : public GLPlatform
{
RDCASSERT(api == RDCDriver::OpenGL);
replayContext.nsctx = NSGL_createContext(NULL, NULL);
replayContext.nsgl_ctx = NSGL_createContext(NULL, NULL);
return ReplayStatus::Succeeded;
}
+32 -32
View File
@@ -4,28 +4,28 @@ extern "C" void NSGL_LogText(const char *text);
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
extern "C" int NSGL_getLayerWidth(void *handle)
extern "C" int NSGL_getLayerWidth(void *layer)
{
CALayer *layer = (CALayer *)handle;
assert([layer isKindOfClass:[CALayer class]]);
CALayer *caLayer = (CALayer *)layer;
assert([caLayer isKindOfClass:[CALayer class]]);
return layer.bounds.size.width;
return caLayer.bounds.size.width;
}
extern "C" int NSGL_getLayerHeight(void *handle)
extern "C" int NSGL_getLayerHeight(void *layer)
{
CALayer *layer = (CALayer *)handle;
assert([layer isKindOfClass:[CALayer class]]);
CALayer *caLayer = (CALayer *)layer;
assert([caLayer isKindOfClass:[CALayer class]]);
return layer.bounds.size.height;
return caLayer.bounds.size.height;
}
extern "C" void *NSGL_createContext(void *handle, void *sharehandle)
extern "C" void *NSGL_createContext(void *view, void *shareContext)
{
NSView *view = (NSView *)handle;
assert(view == nil || [view isKindOfClass:[NSView class]]);
NSView *nsView = (NSView *)view;
assert(nsView == nil || [nsView isKindOfClass:[NSView class]]);
NSOpenGLContext *share = (NSOpenGLContext *)sharehandle;
NSOpenGLContext *share = (NSOpenGLContext *)shareContext;
assert(share == nil || [share isKindOfClass:[NSOpenGLContext class]]);
NSOpenGLPixelFormatAttribute attr[] = {
@@ -63,46 +63,46 @@ extern "C" void *NSGL_createContext(void *handle, void *sharehandle)
GLint aboveWindow = 1;
[context setValues:&aboveWindow forParameter:NSOpenGLCPSurfaceOrder];
[context setView:view];
[context setView:nsView];
[context update];
return context;
}
extern "C" void NSGL_makeCurrentContext(void *handle)
extern "C" void NSGL_makeCurrentContext(void *context)
{
NSOpenGLContext *context = (NSOpenGLContext *)handle;
assert([context isKindOfClass:[NSOpenGLContext class]]);
NSOpenGLContext *nsglContext = (NSOpenGLContext *)context;
assert([nsglContext isKindOfClass:[NSOpenGLContext class]]);
[context makeCurrentContext];
[nsglContext makeCurrentContext];
}
extern "C" void NSGL_update(void *handle)
extern "C" void NSGL_update(void *context)
{
NSOpenGLContext *context = (NSOpenGLContext *)handle;
assert([context isKindOfClass:[NSOpenGLContext class]]);
NSOpenGLContext *nsglContext = (NSOpenGLContext *)context;
assert([nsglContext isKindOfClass:[NSOpenGLContext class]]);
[context update];
[nsglContext update];
}
extern "C" void NSGL_flushBuffer(void *handle)
extern "C" void NSGL_flushBuffer(void *context)
{
NSOpenGLContext *context = (NSOpenGLContext *)handle;
assert([context isKindOfClass:[NSOpenGLContext class]]);
NSOpenGLContext *nsglContext = (NSOpenGLContext *)context;
assert([nsglContext isKindOfClass:[NSOpenGLContext class]]);
[context flushBuffer];
[nsglContext flushBuffer];
}
extern "C" void NSGL_destroyContext(void *handle)
extern "C" void NSGL_destroyContext(void *context)
{
@autoreleasepool
{
NSOpenGLContext *context = (NSOpenGLContext *)handle;
assert([context isKindOfClass:[NSOpenGLContext class]]);
NSOpenGLContext *nsglContext = (NSOpenGLContext *)context;
assert([nsglContext isKindOfClass:[NSOpenGLContext class]]);
[context makeCurrentContext];
[context clearDrawable];
[context update];
[context release];
[nsglContext makeCurrentContext];
[nsglContext clearDrawable];
[nsglContext update];
[nsglContext release];
}
}
+1 -1
View File
@@ -205,7 +205,7 @@ struct GLWindowingData
union
{
CGLContextObj ctx;
void *nsctx; // during replay only, this is the NSOpenGLContext
void *nsgl_ctx; // during replay only, this is the NSOpenGLContext
};
void *wnd; // during capture, this is the CGL window ID. During replay, it's the NSView