• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2 * Copyright 2011 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16 
17 #ifndef  MAC_NATIVE_H
18 #define  MAC_NATIVE_H
19 
20 #include <OpenGL/gl.h>
21 
22 typedef enum {                               // Mac equivalence
23                  MAC_HAS_DOUBLE_BUFFER = 5,  // NSOpenGLPFADoubleBuffer
24                  MAC_DRAW_TO_WINDOW    = 80, // NSOpenGLPFAWindow
25                  MAC_DRAW_TO_PBUFFER   = 90, // NSOpenGLPFAPixelBuffer
26                  MAC_SAMPLES_PER_PIXEL = 56, // NSOpenGLPFASamples
27                  MAC_OPENGL_PROFILE    = 99, // NSOpenGLPFAOpenGLProfile
28                  MAC_COLOR_SIZE        = 8,  // NSOpenGLPFAColorSize
29                  MAC_ALPHA_SIZE        = 11, // NSOpenGLPFAAlphaSize
30                  MAC_DEPTH_SIZE        = 12, // NSOpenGLPFADepthSize
31                  MAC_STENCIL_SIZE      = 13  // NSOpenGLPFAStencilSize
32              } MacPixelFormatAttribs;
33 
34 typedef enum {
35                  MAC_OPENGL_PROFILE_LEGACY = 0x1000, // NSOpenGLProfileVersionLegacy
36                  MAC_OPENGL_PROFILE_3_2    = 0x3200, // NSOpenGLProfileVersion3_2Core
37                  MAC_OPENGL_PROFILE_4_1    = 0x4100, // NSOpenGLProfileVersion4_1Core
38              } MacOpenGLProfileVersions;
39 
40 
41 extern "C"{
42 
43 int setupCoreProfileNativeFormats();
44 
45 int getNumPixelFormats();
46 
47 void* finalizePixelFormat(
48     bool coreProfile, int pixelFormatIndex);
49 
50 int getPixelFormatAttrib(int i, int attrib);
51 
52 void* nsCreateContext(void* finalizedPixelFormat,void* share);
53 void* nsGetLowLevelContext(void* context);
54 // convert to NV12 textures from decoded output iosurface
55 void nsConvertVideoFrameToNV12Textures(void* context,
56                                        void* iosurface,
57                                        int Ytex,
58                                        int UVtex);
59 
60 // copy texture "from" to "to"
61 // from: GL_TEXTURE_RECTANGLE
62 // to:   GL_TEXTURE_2D
63 
64 void nsCopyTexture(void* context, int from, int to, int w, int h);
65 
66 void nsWindowMakeCurrent(void* context,void* nativeWin);
67 void nsPBufferMakeCurrent(void* context,void* nativePBuffer,int level);
68 void nsSwapBuffers();
69 void nsSwapInterval(int *interval);
70 void nsDestroyContext(void* context);
71 void* nsCreatePBuffer(GLenum target,GLenum format,int maxMip,int width,int height);
72 void nsDestroyPBuffer(void* pbuffer);
73 bool nsGetWinDims(void* win,unsigned int* width,unsigned int* height);
74 bool nsCheckColor(void* win,int colorSize);
75 void* nsGetLayer(void* nativeWin);
76 
77 }
78 
79 #endif
80