Blender  V2.93
GHOST_ContextCGL.h
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  *
16  * The Original Code is Copyright (C) 2014 Blender Foundation.
17  * All rights reserved.
18  */
19 
24 #pragma once
25 
26 #include "GHOST_Context.h"
27 
28 @class CAMetalLayer;
29 @class MTLCommandQueue;
30 @class MTLRenderPipelineState;
31 @class MTLTexture;
32 @class NSOpenGLContext;
33 @class NSOpenGLView;
34 @class NSView;
35 
37  public:
41  GHOST_ContextCGL(bool stereoVisual,
42  NSView *metalView,
43  CAMetalLayer *metalLayer,
44  NSOpenGLView *openglView);
45 
50 
56 
62 
68 
69  unsigned int getDefaultFramebuffer();
70 
76 
83 
89  GHOST_TSuccess setSwapInterval(int interval);
90 
97 
104 
105  private:
107  NSView *m_metalView;
108  CAMetalLayer *m_metalLayer;
109  MTLCommandQueue *m_metalCmdQueue;
110  MTLRenderPipelineState *m_metalRenderPipeline;
111 
113  NSOpenGLView *m_openGLView;
114 
116  NSOpenGLContext *m_openGLContext;
117 
119  unsigned int m_defaultFramebuffer;
120 
122  MTLTexture *m_defaultFramebufferMetalTexture;
123 
124  bool m_coreProfile;
125 
126  const bool m_debug;
127 
129  static NSOpenGLContext *s_sharedOpenGLContext;
130  static int s_sharedCount;
131 
132  /* Metal functions */
133  void metalInit();
134  void metalFree();
135  void metalInitFramebuffer();
136  void metalUpdateFramebuffer();
137  void metalSwapBuffers();
138 };
GHOST_TSuccess
Definition: GHOST_Types.h:91
GHOST_TSuccess setSwapInterval(int interval)
unsigned int getDefaultFramebuffer()
GHOST_TSuccess swapBuffers()
GHOST_TSuccess initializeDrawingContext()
GHOST_ContextCGL(bool stereoVisual, NSView *metalView, CAMetalLayer *metalLayer, NSOpenGLView *openglView)
GHOST_TSuccess releaseDrawingContext()
GHOST_TSuccess activateDrawingContext()
GHOST_TSuccess releaseNativeHandles()
GHOST_TSuccess getSwapInterval(int &)
GHOST_TSuccess updateDrawingContext()