blob: feb6ba016168a87753ecb945943bfa393380eda9 [file] [log] [blame]
epoger@google.comec3ed6a2011-07-28 14:26:00 +00001
reed@google.comac10a2d2010-12-22 21:39:39 +00002/*
epoger@google.comec3ed6a2011-07-28 14:26:00 +00003 * Copyright 2011 Google Inc.
4 *
5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file.
reed@google.comac10a2d2010-12-22 21:39:39 +00007 */
8
9
epoger@google.comec3ed6a2011-07-28 14:26:00 +000010
reed@google.comac10a2d2010-12-22 21:39:39 +000011#ifndef GrGLConfig_DEFINED
12#define GrGLConfig_DEFINED
13
14#include "GrTypes.h"
15
bsalomon@google.com42ab7ea2011-01-19 17:19:40 +000016/**
bsalomon@google.comf987d1b2011-04-04 17:13:52 +000017 * Optional GL config file.
twiz@google.comb65e0cb2011-03-18 20:41:44 +000018 */
bsalomon@google.comf987d1b2011-04-04 17:13:52 +000019#ifdef GR_GL_CUSTOM_SETUP_HEADER
20 #include GR_GL_CUSTOM_SETUP_HEADER
21#endif
22
23#if !defined(GR_GL_FUNCTION_TYPE)
Mike Klein8f11d4d2018-01-24 12:42:55 -050024 #if defined(SK_BUILD_FOR_WIN)
mtklein3d96cb82016-08-10 07:30:21 -070025 #define GR_GL_FUNCTION_TYPE __stdcall
26 #else
27 #define GR_GL_FUNCTION_TYPE
28 #endif
bsalomon@google.comf987d1b2011-04-04 17:13:52 +000029#endif
twiz@google.comb65e0cb2011-03-18 20:41:44 +000030
31/**
bsalomon@google.com3723a482011-02-17 21:47:25 +000032 * The following are optional defines that can be enabled at the compiler
33 * command line, in a IDE project, in a GrUserConfig.h file, or in a GL custom
bsalomon@google.comf987d1b2011-04-04 17:13:52 +000034 * file (if one is in use). If a GR_GL_CUSTOM_SETUP_HEADER is used they can
35 * also be placed there.
bsalomon@google.com7acdb8e2011-02-11 14:07:02 +000036 *
tfarina38406c82014-10-31 07:11:12 -070037 * GR_GL_LOG_CALLS: if 1 Gr can print every GL call using SkDebugf. Defaults to
reed@google.com27a1e772011-03-08 15:34:06 +000038 * 0. Logging can be enabled and disabled at runtime using a debugger via to
bsalomon@google.com3723a482011-02-17 21:47:25 +000039 * global gLogCallsGL. The initial value of gLogCallsGL is controlled by
40 * GR_GL_LOG_CALLS_START.
41 *
42 * GR_GL_LOG_CALLS_START: controls the initial value of gLogCallsGL when
43 * GR_GL_LOG_CALLS is 1. Defaults to 0.
44 *
45 * GR_GL_CHECK_ERROR: if enabled Gr can do a glGetError() after every GL call.
commit-bot@chromium.org515dcd32013-08-28 14:17:03 +000046 * Defaults to 1 if SK_DEBUG is set, otherwise 0. When GR_GL_CHECK_ERROR is 1
bsalomon@google.com3723a482011-02-17 21:47:25 +000047 * this can be toggled in a debugger using the gCheckErrorGL global. The initial
48 * value of gCheckErrorGL is controlled by by GR_GL_CHECK_ERROR_START.
49 *
50 * GR_GL_CHECK_ERROR_START: controls the initial value of gCheckErrorGL
51 * when GR_GL_CHECK_ERROR is 1. Defaults to 1.
bsalomon@google.com4be283f2011-04-19 21:15:09 +000052 *
bsalomon@google.com4f3c2532012-01-19 16:16:52 +000053 * GR_GL_CHECK_ALLOC_WITH_GET_ERROR: If set to 1 this will then glTexImage,
54 * glBufferData, glRenderbufferStorage, etc will be checked for errors. This
55 * amounts to ensuring the error is GL_NO_ERROR, calling the allocating
56 * function, and then checking that the error is still GL_NO_ERROR. When the
57 * value is 0 we will assume no error was generated without checking.
bsalomon@google.com4bcb0c62012-02-07 16:06:47 +000058 *
59 * GR_GL_CHECK_FBO_STATUS_ONCE_PER_FORMAT: We will normally check the FBO status
60 * every time we bind a texture or renderbuffer to an FBO. However, in some
61 * environments CheckFrameBufferStatus is very expensive. If this is set we will
62 * check the first time we use a color format or a combination of color /
63 * stencil formats as attachments. If the FBO is complete we will assume
64 * subsequent attachments with the same formats are complete as well.
bsalomon@google.comded4f4b2012-06-28 18:48:06 +000065 *
bsalomon@google.com96966a52013-02-21 16:34:21 +000066 * GR_GL_MUST_USE_VBO: Indicates that all vertices and indices must be rendered
67 * from VBOs. Chromium's command buffer doesn't allow glVertexAttribArray with
68 * ARARY_BUFFER 0 bound or glDrawElements with ELEMENT_ARRAY_BUFFER 0 bound.
bsalomon@google.com42ab7ea2011-01-19 17:19:40 +000069 */
70
bsalomon@google.com7acdb8e2011-02-11 14:07:02 +000071#if !defined(GR_GL_LOG_CALLS)
commit-bot@chromium.org515dcd32013-08-28 14:17:03 +000072 #ifdef SK_DEBUG
73 #define GR_GL_LOG_CALLS 1
74 #else
75 #define GR_GL_LOG_CALLS 0
76 #endif
bsalomon@google.com3723a482011-02-17 21:47:25 +000077#endif
78
79#if !defined(GR_GL_LOG_CALLS_START)
bsalomon@google.com4bcb0c62012-02-07 16:06:47 +000080 #define GR_GL_LOG_CALLS_START 0
bsalomon@google.com3723a482011-02-17 21:47:25 +000081#endif
82
reed@google.com27a1e772011-03-08 15:34:06 +000083#if !defined(GR_GL_CHECK_ERROR)
commit-bot@chromium.org515dcd32013-08-28 14:17:03 +000084 #ifdef SK_DEBUG
85 #define GR_GL_CHECK_ERROR 1
86 #else
87 #define GR_GL_CHECK_ERROR 0
88 #endif
bsalomon@google.com3723a482011-02-17 21:47:25 +000089#endif
90
91#if !defined(GR_GL_CHECK_ERROR_START)
bsalomon@google.com4bcb0c62012-02-07 16:06:47 +000092 #define GR_GL_CHECK_ERROR_START 1
bsalomon@google.com4be283f2011-04-19 21:15:09 +000093#endif
94
bsalomon@google.com4f3c2532012-01-19 16:16:52 +000095#if !defined(GR_GL_CHECK_ALLOC_WITH_GET_ERROR)
bsalomon@google.com4bcb0c62012-02-07 16:06:47 +000096 #define GR_GL_CHECK_ALLOC_WITH_GET_ERROR 1
97#endif
98
reed@google.com27a1e772011-03-08 15:34:06 +000099#endif