OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #ifndef GrGLInterface_DEFINED | 8 #ifndef GrGLInterface_DEFINED |
9 #define GrGLInterface_DEFINED | 9 #define GrGLInterface_DEFINED |
10 | 10 |
(...skipping 19 matching lines...) Expand all Loading... |
30 | 30 |
31 // Temporary alias until Chromium can be updated. | 31 // Temporary alias until Chromium can be updated. |
32 static const GrGLBinding kES2_GrGLBinding = kES_GrGLBinding; | 32 static const GrGLBinding kES2_GrGLBinding = kES_GrGLBinding; |
33 | 33 |
34 //////////////////////////////////////////////////////////////////////////////// | 34 //////////////////////////////////////////////////////////////////////////////// |
35 | 35 |
36 /** | 36 /** |
37 * Rather than depend on platform-specific GL headers and libraries, we require | 37 * Rather than depend on platform-specific GL headers and libraries, we require |
38 * the client to provide a struct of GL function pointers. This struct can be | 38 * the client to provide a struct of GL function pointers. This struct can be |
39 * specified per-GrContext as a parameter to GrContext::Create. If NULL is | 39 * specified per-GrContext as a parameter to GrContext::Create. If NULL is |
40 * passed to Create then the "default" GL interface is used. If the default is | 40 * passed to Create then a "default" GL interface is created. If the default is |
41 * also NULL GrContext creation will fail. | 41 * also NULL GrContext creation will fail. |
42 * | 42 * |
43 * The default interface is returned by GrGLDefaultInterface. This function's | 43 * The default interface is returned by GrGLDefaultInterface. This function's |
44 * implementation is platform-specific. Several have been provided, along with | 44 * implementation is platform-specific. Several have been provided, along with |
45 * an implementation that simply returns NULL. It is implementation-specific | 45 * an implementation that simply returns NULL. |
46 * whether the same GrGLInterface is returned or whether a new one is created | |
47 * at each call. Some platforms may not be able to use a single GrGLInterface | |
48 * because extension function ptrs vary across contexts. Note that GrGLInterface | |
49 * is ref-counted. So if the same object is returned by multiple calls to | |
50 * GrGLDefaultInterface, each should bump the ref count. | |
51 * | 46 * |
52 * By defining GR_GL_PER_GL_CALL_IFACE_CALLBACK to 1 the client can specify a | 47 * By defining GR_GL_PER_GL_CALL_IFACE_CALLBACK to 1 the client can specify a |
53 * callback function that will be called prior to each GL function call. See | 48 * callback function that will be called prior to each GL function call. See |
54 * comments in GrGLConfig.h | 49 * comments in GrGLConfig.h |
55 */ | 50 */ |
56 | 51 |
57 struct GrGLInterface; | 52 struct GrGLInterface; |
58 | 53 |
59 const GrGLInterface* GrGLDefaultInterface(); | 54 const GrGLInterface* GrGLDefaultInterface(); |
60 | 55 |
61 /** | 56 /** |
62 * Creates a GrGLInterface for a "native" GL context (e.g. WGL on windows, | 57 * Creates a GrGLInterface for a "native" GL context (e.g. WGL on windows, |
63 * GLX on linux, AGL on Mac). On platforms that have context-specific function | 58 * GLX on linux, AGL on Mac). The interface is only valid for the GL context |
64 * pointers for GL extensions (e.g. windows) the returned interface is only | 59 * that is current when the interface is created. |
65 * valid for the context that was current at creation. | |
66 */ | 60 */ |
67 const GrGLInterface* GrGLCreateNativeInterface(); | 61 const GrGLInterface* GrGLCreateNativeInterface(); |
68 | 62 |
69 #if SK_MESA | 63 #if SK_MESA |
70 /** | 64 /** |
71 * Creates a GrGLInterface for an OSMesa context. | 65 * Creates a GrGLInterface for an OSMesa context. |
72 */ | 66 */ |
73 const GrGLInterface* GrGLCreateMesaInterface(); | 67 const GrGLInterface* GrGLCreateMesaInterface(); |
74 #endif | 68 #endif |
75 | 69 |
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
354 | 348 |
355 // Per-GL func callback | 349 // Per-GL func callback |
356 #if GR_GL_PER_GL_FUNC_CALLBACK | 350 #if GR_GL_PER_GL_FUNC_CALLBACK |
357 GrGLInterfaceCallbackProc fCallback; | 351 GrGLInterfaceCallbackProc fCallback; |
358 GrGLInterfaceCallbackData fCallbackData; | 352 GrGLInterfaceCallbackData fCallbackData; |
359 #endif | 353 #endif |
360 | 354 |
361 }; | 355 }; |
362 | 356 |
363 #endif | 357 #endif |
OLD | NEW |