From e074c3aba073a06c8e2c451e7cfa71ebeefb70e8 Mon Sep 17 00:00:00 2001 From: Jake Turner Date: Fri, 26 Mar 2021 05:42:33 +0000 Subject: [PATCH] Apple renamed nsctx -> nsgl_ctx Changed some naming of parameters in the NSGL Objective-C functions --- renderdoc/driver/gl/cgl_platform.cpp | 32 +++++++------- renderdoc/driver/gl/cgl_platform.mm | 64 ++++++++++++++-------------- renderdoc/driver/gl/gl_common.h | 2 +- 3 files changed, 49 insertions(+), 49 deletions(-) diff --git a/renderdoc/driver/gl/cgl_platform.cpp b/renderdoc/driver/gl/cgl_platform.cpp index 6eb4327ed..97d5786e3 100644 --- a/renderdoc/driver/gl/cgl_platform.cpp +++ b/renderdoc/driver/gl/cgl_platform.cpp @@ -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; } diff --git a/renderdoc/driver/gl/cgl_platform.mm b/renderdoc/driver/gl/cgl_platform.mm index 638a7b4b0..3acff0317 100644 --- a/renderdoc/driver/gl/cgl_platform.mm +++ b/renderdoc/driver/gl/cgl_platform.mm @@ -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]; } } diff --git a/renderdoc/driver/gl/gl_common.h b/renderdoc/driver/gl/gl_common.h index 55e88da2a..c122f5e17 100644 --- a/renderdoc/driver/gl/gl_common.h +++ b/renderdoc/driver/gl/gl_common.h @@ -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