Home | History | Annotate | Download | only in EGL
      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 #include "MacPixelFormatsAttribs.h"
     18 
     19 static NSOpenGLPixelFormatAttribute attrs32_1[] =
     20 {
     21     NSOpenGLPFADoubleBuffer,
     22     NSOpenGLPFAWindow,
     23     NSOpenGLPFAPixelBuffer,
     24     NSOpenGLPFAColorSize   ,32,
     25     NSOpenGLPFADepthSize   ,24,
     26     NSOpenGLPFAStencilSize ,8,
     27     0
     28 };
     29 
     30 static NSOpenGLPixelFormatAttribute attrs32_2[] =
     31 {
     32     NSOpenGLPFADoubleBuffer,
     33     NSOpenGLPFAWindow,
     34     NSOpenGLPFAPixelBuffer,
     35     NSOpenGLPFAColorSize   ,32,
     36     NSOpenGLPFAAlphaSize   ,8,
     37     NSOpenGLPFADepthSize   ,24,
     38     NSOpenGLPFAStencilSize ,8,
     39     0
     40 };
     41 
     42 static NSOpenGLPixelFormatAttribute attrs32_3[] =
     43 {
     44     NSOpenGLPFADoubleBuffer,
     45     NSOpenGLPFAWindow,
     46     NSOpenGLPFAPixelBuffer,
     47     NSOpenGLPFAColorSize   ,32,
     48     NSOpenGLPFAAlphaSize   ,8,
     49     0
     50 };
     51 
     52 static NSOpenGLPixelFormatAttribute attrs32_4[] =
     53 {
     54     NSOpenGLPFADoubleBuffer,
     55     NSOpenGLPFAWindow,
     56     NSOpenGLPFAPixelBuffer,
     57     NSOpenGLPFAColorSize   ,32,
     58     0
     59 };
     60 
     61 static NSOpenGLPixelFormatAttribute attrs32_5[] =
     62 {
     63     NSOpenGLPFADoubleBuffer,
     64     NSOpenGLPFAWindow,
     65     NSOpenGLPFAPixelBuffer,
     66     NSOpenGLPFAColorSize   ,32,
     67     NSOpenGLPFADepthSize   ,24,
     68     NSOpenGLPFASamples     ,2,
     69     0
     70 };
     71 
     72 static NSOpenGLPixelFormatAttribute attrs32_6[] =
     73 {
     74     NSOpenGLPFADoubleBuffer,
     75     NSOpenGLPFAWindow,
     76     NSOpenGLPFAPixelBuffer,
     77     NSOpenGLPFAColorSize   ,32,
     78     NSOpenGLPFADepthSize   ,24,
     79     NSOpenGLPFASamples     ,4,
     80     0
     81 };
     82 
     83 static NSOpenGLPixelFormatAttribute attrs32_7[] =
     84 {
     85     NSOpenGLPFADoubleBuffer,
     86     NSOpenGLPFAWindow,
     87     NSOpenGLPFAPixelBuffer,
     88     NSOpenGLPFAColorSize   ,32,
     89     NSOpenGLPFAAlphaSize   ,8,
     90     NSOpenGLPFADepthSize   ,24,
     91     NSOpenGLPFAStencilSize ,8,
     92     NSOpenGLPFASamples     ,4,
     93     0
     94 };
     95 
     96 static NSOpenGLPixelFormatAttribute attrs16_1[] =
     97 {
     98     NSOpenGLPFADoubleBuffer,
     99     NSOpenGLPFAWindow,
    100     NSOpenGLPFAPixelBuffer,
    101     NSOpenGLPFAColorSize   ,16,
    102     NSOpenGLPFADepthSize   ,24,
    103     0
    104 };
    105 
    106 static NSOpenGLPixelFormatAttribute attrs16_2[] =
    107 {
    108     NSOpenGLPFADoubleBuffer,
    109     NSOpenGLPFAWindow,
    110     NSOpenGLPFAPixelBuffer,
    111     NSOpenGLPFAColorSize   ,16,
    112     NSOpenGLPFADepthSize   ,24,
    113     NSOpenGLPFAStencilSize ,8,
    114     0
    115 };
    116 
    117 static NSOpenGLPixelFormatAttribute attrs64_1[] =
    118 {
    119     NSOpenGLPFADoubleBuffer,
    120     NSOpenGLPFAWindow,
    121     NSOpenGLPFAPixelBuffer,
    122     NSOpenGLPFAColorSize   ,64,
    123     NSOpenGLPFAAlphaSize   ,16,
    124     0
    125 };
    126 
    127 static NSOpenGLPixelFormatAttribute attrs64_2[] =
    128 {
    129     NSOpenGLPFADoubleBuffer,
    130     NSOpenGLPFAWindow,
    131     NSOpenGLPFAPixelBuffer,
    132     NSOpenGLPFAColorSize   ,64,
    133     NSOpenGLPFAAlphaSize   ,16,
    134     NSOpenGLPFADepthSize   ,24,
    135     NSOpenGLPFAStencilSize ,8,
    136     0
    137 };
    138 
    139 static NSOpenGLPixelFormatAttribute attrs64_3[] =
    140 {
    141     NSOpenGLPFADoubleBuffer,
    142     NSOpenGLPFAWindow,
    143     NSOpenGLPFAPixelBuffer,
    144     NSOpenGLPFAColorSize   ,64,
    145     NSOpenGLPFAAlphaSize   ,16,
    146     NSOpenGLPFADepthSize   ,24,
    147     0
    148 };
    149 
    150 static NSOpenGLPixelFormatAttribute attrs64_4[] =
    151 {
    152     NSOpenGLPFADoubleBuffer,
    153     NSOpenGLPFAWindow,
    154     NSOpenGLPFAPixelBuffer,
    155     NSOpenGLPFAColorSize   ,64,
    156     NSOpenGLPFADepthSize   ,24,
    157     0
    158 };
    159 
    160 static NSOpenGLPixelFormatAttribute attrs64_5[] =
    161 {
    162     NSOpenGLPFADoubleBuffer,
    163     NSOpenGLPFAWindow,
    164     NSOpenGLPFAPixelBuffer,
    165     NSOpenGLPFAColorSize   ,64,
    166     NSOpenGLPFADepthSize   ,24,
    167     NSOpenGLPFAStencilSize ,8,
    168     0
    169 };
    170 
    171 static NSOpenGLPixelFormatAttribute attrs128_1[] =
    172 {
    173     NSOpenGLPFADoubleBuffer,
    174     NSOpenGLPFAWindow,
    175     NSOpenGLPFAPixelBuffer,
    176     NSOpenGLPFAColorSize   ,128,
    177     NSOpenGLPFAAlphaSize   ,32,
    178     0
    179 };
    180 
    181 static NSOpenGLPixelFormatAttribute attrs128_2[] =
    182 {
    183     NSOpenGLPFADoubleBuffer,
    184     NSOpenGLPFAWindow,
    185     NSOpenGLPFAPixelBuffer,
    186     NSOpenGLPFAColorSize   ,128,
    187     NSOpenGLPFAAlphaSize   ,32,
    188     NSOpenGLPFADepthSize   ,24,
    189     0
    190 };
    191 
    192 NSOpenGLPixelFormatAttribute** getPixelFormatsAttributes(int* size){
    193 static NSOpenGLPixelFormatAttribute* arr[] =
    194 {
    195     attrs16_1,
    196     attrs16_2,
    197     attrs32_1,
    198     attrs32_2,
    199     attrs32_3,
    200     attrs32_4,
    201     attrs32_5,
    202     attrs32_6,
    203     attrs32_7,
    204     attrs64_1,
    205     attrs64_2,
    206     attrs64_3,
    207     attrs64_4,
    208     attrs64_5,
    209     attrs128_1,
    210     attrs128_2
    211 };
    212     *size = sizeof(arr)/sizeof(arr[0]);
    213     return arr;
    214 }
    215