xref: /third_party/mesa3d/src/mesa/main/menums.h (revision bf215546)
1/*
2 * Mesa 3-D graphics library
3 *
4 * Copyright (C) 1999-2008  Brian Paul   All Rights Reserved.
5 * Copyright (C) 2009  VMware, Inc.  All Rights Reserved.
6 * Copyright (C) 2018 Advanced Micro Devices, Inc.  All Rights Reserved.
7 *
8 * Permission is hereby granted, free of charge, to any person obtaining a
9 * copy of this software and associated documentation files (the "Software"),
10 * to deal in the Software without restriction, including without limitation
11 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
12 * and/or sell copies of the Software, and to permit persons to whom the
13 * Software is furnished to do so, subject to the following conditions:
14 *
15 * The above copyright notice and this permission notice shall be included
16 * in all copies or substantial portions of the Software.
17 *
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
21 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
22 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
23 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
24 * OTHER DEALINGS IN THE SOFTWARE.
25 */
26
27/**
28 * \file menums.h
29 * Often used definitions and enums.
30 */
31
32#ifndef MENUMS_H
33#define MENUMS_H
34
35#include "util/macros.h"
36
37/**
38 * Enum for the OpenGL APIs we know about and may support.
39 *
40 * NOTE: This must match the api_enum table in
41 * src/mesa/main/get_hash_generator.py
42 */
43typedef enum
44{
45   API_OPENGL_COMPAT,      /* legacy / compatibility contexts */
46   API_OPENGLES,
47   API_OPENGLES2,
48   API_OPENGL_CORE,
49   API_OPENGL_LAST = API_OPENGL_CORE
50} gl_api;
51
52/**
53 * An index for each type of texture object.  These correspond to the GL
54 * texture target enums, such as GL_TEXTURE_2D, GL_TEXTURE_CUBE_MAP, etc.
55 * Note: the order is from highest priority to lowest priority.
56 */
57typedef enum
58{
59   TEXTURE_2D_MULTISAMPLE_INDEX,
60   TEXTURE_2D_MULTISAMPLE_ARRAY_INDEX,
61   TEXTURE_CUBE_ARRAY_INDEX,
62   TEXTURE_BUFFER_INDEX,
63   TEXTURE_2D_ARRAY_INDEX,
64   TEXTURE_1D_ARRAY_INDEX,
65   TEXTURE_EXTERNAL_INDEX,
66   TEXTURE_CUBE_INDEX,
67   TEXTURE_3D_INDEX,
68   TEXTURE_RECT_INDEX,
69   TEXTURE_2D_INDEX,
70   TEXTURE_1D_INDEX,
71   NUM_TEXTURE_TARGETS
72} gl_texture_index;
73
74/**
75 * Remapped color logical operations
76 *
77 * With the exception of NVIDIA hardware, which consumes the OpenGL enumerants
78 * directly, everything wants this mapping of color logical operations.
79 *
80 * Fun fact: These values are just the bit-reverse of the low-nibble of the GL
81 * enumerant values (i.e., `GL_NOOP & 0x0f` is `b0101' while
82 * \c COLOR_LOGICOP_NOOP is `b1010`).
83 *
84 * Fun fact #2: These values are just an encoding of the operation as a table
85 * of bit values. The result of the logic op is:
86 *
87 *    result_bit = (logic_op >> (2 * src_bit + dst_bit)) & 1
88 *
89 * For the GL enums, the result is:
90 *
91 *    result_bit = logic_op & (1 << (2 * src_bit + dst_bit))
92 */
93enum PACKED gl_logicop_mode {
94   COLOR_LOGICOP_CLEAR = 0,
95   COLOR_LOGICOP_NOR = 1,
96   COLOR_LOGICOP_AND_INVERTED = 2,
97   COLOR_LOGICOP_COPY_INVERTED = 3,
98   COLOR_LOGICOP_AND_REVERSE = 4,
99   COLOR_LOGICOP_INVERT = 5,
100   COLOR_LOGICOP_XOR = 6,
101   COLOR_LOGICOP_NAND = 7,
102   COLOR_LOGICOP_AND = 8,
103   COLOR_LOGICOP_EQUIV = 9,
104   COLOR_LOGICOP_NOOP = 10,
105   COLOR_LOGICOP_OR_INVERTED = 11,
106   COLOR_LOGICOP_COPY = 12,
107   COLOR_LOGICOP_OR_REVERSE = 13,
108   COLOR_LOGICOP_OR = 14,
109   COLOR_LOGICOP_SET = 15
110};
111
112/**
113 * Indexes for all renderbuffers
114 */
115typedef enum
116{
117   /* the four standard color buffers */
118   BUFFER_FRONT_LEFT,
119   BUFFER_BACK_LEFT,
120   BUFFER_FRONT_RIGHT,
121   BUFFER_BACK_RIGHT,
122   BUFFER_DEPTH,
123   BUFFER_STENCIL,
124   BUFFER_ACCUM,
125   /* generic renderbuffers */
126   BUFFER_COLOR0,
127   BUFFER_COLOR1,
128   BUFFER_COLOR2,
129   BUFFER_COLOR3,
130   BUFFER_COLOR4,
131   BUFFER_COLOR5,
132   BUFFER_COLOR6,
133   BUFFER_COLOR7,
134   BUFFER_COUNT,
135   BUFFER_NONE = -1,
136} gl_buffer_index;
137
138typedef enum
139{
140   MAP_USER,
141   MAP_INTERNAL,
142   MAP_GLTHREAD,
143   MAP_COUNT
144} gl_map_buffer_index;
145
146/** @{
147 *
148 * These are a mapping of the GL_ARB_debug_output/GL_KHR_debug enums
149 * to small enums suitable for use as an array index.
150 */
151
152enum mesa_debug_source
153{
154   MESA_DEBUG_SOURCE_API,
155   MESA_DEBUG_SOURCE_WINDOW_SYSTEM,
156   MESA_DEBUG_SOURCE_SHADER_COMPILER,
157   MESA_DEBUG_SOURCE_THIRD_PARTY,
158   MESA_DEBUG_SOURCE_APPLICATION,
159   MESA_DEBUG_SOURCE_OTHER,
160   MESA_DEBUG_SOURCE_COUNT
161};
162
163enum mesa_debug_type
164{
165   MESA_DEBUG_TYPE_ERROR,
166   MESA_DEBUG_TYPE_DEPRECATED,
167   MESA_DEBUG_TYPE_UNDEFINED,
168   MESA_DEBUG_TYPE_PORTABILITY,
169   MESA_DEBUG_TYPE_PERFORMANCE,
170   MESA_DEBUG_TYPE_OTHER,
171   MESA_DEBUG_TYPE_MARKER,
172   MESA_DEBUG_TYPE_PUSH_GROUP,
173   MESA_DEBUG_TYPE_POP_GROUP,
174   MESA_DEBUG_TYPE_COUNT
175};
176
177enum mesa_debug_severity
178{
179   MESA_DEBUG_SEVERITY_LOW,
180   MESA_DEBUG_SEVERITY_MEDIUM,
181   MESA_DEBUG_SEVERITY_HIGH,
182   MESA_DEBUG_SEVERITY_NOTIFICATION,
183   MESA_DEBUG_SEVERITY_COUNT
184};
185
186/** @} */
187
188#endif
189