diff options
Diffstat (limited to 'src/mesa/main')
59 files changed, 309 insertions, 303 deletions
diff --git a/src/mesa/main/api_arrayelt.h b/src/mesa/main/api_arrayelt.h index 965e0ad3aea..6543a58f724 100644 --- a/src/mesa/main/api_arrayelt.h +++ b/src/mesa/main/api_arrayelt.h @@ -27,9 +27,10 @@ #ifndef API_ARRAYELT_H #define API_ARRAYELT_H +#include <stdbool.h> +#include "dd.h" -#include "main/mtypes.h" - +struct _glapi_table; extern GLboolean _ae_create_context( struct gl_context *ctx ); extern void _ae_destroy_context( struct gl_context *ctx ); diff --git a/src/mesa/main/buffers.h b/src/mesa/main/buffers.h index c43810752b0..913af7842fe 100644 --- a/src/mesa/main/buffers.h +++ b/src/mesa/main/buffers.h @@ -34,7 +34,7 @@ #include "glheader.h" -#include "mtypes.h" +#include "menums.h" struct gl_context; struct gl_framebuffer; diff --git a/src/mesa/main/colormac.h b/src/mesa/main/colormac.h index 33ca5af0731..8cd305cb31f 100644 --- a/src/mesa/main/colormac.h +++ b/src/mesa/main/colormac.h @@ -35,7 +35,6 @@ #include "config.h" #include "macros.h" -#include "mtypes.h" /** diff --git a/src/mesa/main/context.h b/src/mesa/main/context.h index 86be66f9e09..ef06540e9ba 100644 --- a/src/mesa/main/context.h +++ b/src/mesa/main/context.h @@ -49,6 +49,7 @@ #define CONTEXT_H +#include "errors.h" #include "imports.h" #include "extensions.h" #include "mtypes.h" diff --git a/src/mesa/main/copyimage.h b/src/mesa/main/copyimage.h index ea2f15b4352..7cebb30d997 100644 --- a/src/mesa/main/copyimage.h +++ b/src/mesa/main/copyimage.h @@ -29,7 +29,7 @@ #ifndef COPYIMAGE_H #define COPYIMAGE_H -#include "mtypes.h" +#include "glheader.h" #ifdef __cplusplus extern "C" { diff --git a/src/mesa/main/core.h b/src/mesa/main/core.h deleted file mode 100644 index 73ed01c259b..00000000000 --- a/src/mesa/main/core.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Mesa 3-D graphics library - * - * Copyright (C) 2010 LunarG Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - * Authors: - * Chia-I Wu <[email protected]> - */ - - -/** - * \file core.h - * The public header of core mesa. - * - * This file is the (only) public header of core mesa. It is supposed to be - * used by GLX, WGL, and GLSL. - */ - - -#ifndef CORE_H -#define CORE_H - - -#include "main/glheader.h" -#include "main/compiler.h" -#include "main/imports.h" -#include "main/macros.h" - -#include "main/mtypes.h" - -/* for GLSL */ -#include "program/prog_parameter.h" - - -#endif /* CORE_H */ diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h index 09e9c41244e..64ddd818835 100644 --- a/src/mesa/main/dd.h +++ b/src/mesa/main/dd.h @@ -31,9 +31,9 @@ #ifndef DD_INCLUDED #define DD_INCLUDED -/* THIS FILE ONLY INCLUDED BY mtypes.h !!!!! */ - #include "glheader.h" +#include "formats.h" +#include "menums.h" struct gl_bitmap_atlas; struct gl_buffer_object; @@ -50,6 +50,8 @@ struct gl_shader_program; struct gl_texture_image; struct gl_texture_object; struct gl_memory_info; +struct gl_transform_feedback_object; +struct ati_fragment_shader; struct util_queue_monitoring; struct _mesa_prim; struct _mesa_index_buffer; diff --git a/src/mesa/main/debug.c b/src/mesa/main/debug.c index d7e0143a8f6..b1fa1f067ff 100644 --- a/src/mesa/main/debug.c +++ b/src/mesa/main/debug.c @@ -24,6 +24,7 @@ */ #include <stdio.h> +#include "errors.h" #include "mtypes.h" #include "attrib.h" #include "enums.h" diff --git a/src/mesa/main/debug_output.h b/src/mesa/main/debug_output.h index 63e3e7b48e4..8a5eedc21f0 100644 --- a/src/mesa/main/debug_output.h +++ b/src/mesa/main/debug_output.h @@ -30,13 +30,14 @@ #include <stdio.h> #include <stdarg.h> #include "glheader.h" -#include "mtypes.h" +#include "menums.h" #ifdef __cplusplus extern "C" { #endif +struct gl_context; void _mesa_init_debug_output(struct gl_context *ctx); diff --git a/src/mesa/main/dlist.h b/src/mesa/main/dlist.h index 22b696f50c1..1ac17d5bb09 100644 --- a/src/mesa/main/dlist.h +++ b/src/mesa/main/dlist.h @@ -33,8 +33,8 @@ #define DLIST_H #include <stdio.h> -#include "main/mtypes.h" +struct gl_context; /** * Describes the location and size of a glBitmap image in a texture atlas. diff --git a/src/mesa/main/drawtex.c b/src/mesa/main/drawtex.c index 9c4fdf90e3b..6114b3277b0 100644 --- a/src/mesa/main/drawtex.c +++ b/src/mesa/main/drawtex.c @@ -21,6 +21,7 @@ * DEALINGS IN THE SOFTWARE. */ +#include "main/errors.h" #include "main/drawtex.h" #include "main/state.h" #include "main/imports.h" diff --git a/src/mesa/main/errors.h b/src/mesa/main/errors.h index b784b117761..5911da2956f 100644 --- a/src/mesa/main/errors.h +++ b/src/mesa/main/errors.h @@ -39,13 +39,15 @@ #include <stdio.h> #include <stdarg.h> #include "glheader.h" -#include "mtypes.h" +#include "menums.h" #ifdef __cplusplus extern "C" { #endif +struct gl_context; + extern void _mesa_warning( struct gl_context *gc, const char *fmtString, ... ) PRINTFLIKE(2, 3); diff --git a/src/mesa/main/eval.h b/src/mesa/main/eval.h index 5b2fce11948..938e3579b0e 100644 --- a/src/mesa/main/eval.h +++ b/src/mesa/main/eval.h @@ -37,7 +37,7 @@ #define EVAL_H -#include "main/mtypes.h" +#include "dd.h" #include <stdbool.h> diff --git a/src/mesa/main/execmem.c b/src/mesa/main/execmem.c index 21c5de7ad9d..2142b50a6e9 100644 --- a/src/mesa/main/execmem.c +++ b/src/mesa/main/execmem.c @@ -34,7 +34,7 @@ #include <stdio.h> #include "imports.h" #include "execmem.h" - +#include "c11/threads.h" #if defined(__linux__) || defined(__OpenBSD__) || defined(_NetBSD__) || defined(__sun) || defined(__HAIKU__) diff --git a/src/mesa/main/extensions.h b/src/mesa/main/extensions.h index 159610b6e12..705d65dcdb5 100644 --- a/src/mesa/main/extensions.h +++ b/src/mesa/main/extensions.h @@ -36,7 +36,7 @@ #ifndef _EXTENSIONS_H_ #define _EXTENSIONS_H_ -#include "glheader.h" +#include "mtypes.h" #ifdef __cplusplus extern "C" { diff --git a/src/mesa/main/extensions_table.c b/src/mesa/main/extensions_table.c index 1e37fbcc462..6241705de13 100644 --- a/src/mesa/main/extensions_table.c +++ b/src/mesa/main/extensions_table.c @@ -23,7 +23,6 @@ * OTHER DEALINGS IN THE SOFTWARE. */ -#include "main/mtypes.h" #include "main/extensions.h" /** diff --git a/src/mesa/main/ffvertex_prog.c b/src/mesa/main/ffvertex_prog.c index c7b639456cd..1c755592bd9 100644 --- a/src/mesa/main/ffvertex_prog.c +++ b/src/mesa/main/ffvertex_prog.c @@ -33,6 +33,7 @@ */ +#include "main/errors.h" #include "main/glheader.h" #include "main/mtypes.h" #include "main/macros.h" diff --git a/src/mesa/main/format_pack.py b/src/mesa/main/format_pack.py index 71c467f7e90..77ab16694ed 100644 --- a/src/mesa/main/format_pack.py +++ b/src/mesa/main/format_pack.py @@ -42,6 +42,8 @@ string = """/* #include <stdint.h> +#include "config.h" +#include "errors.h" #include "format_pack.h" #include "format_utils.h" #include "macros.h" diff --git a/src/mesa/main/format_unpack.py b/src/mesa/main/format_unpack.py index c8b1b24d169..87f64cc151a 100644 --- a/src/mesa/main/format_unpack.py +++ b/src/mesa/main/format_unpack.py @@ -42,6 +42,7 @@ string = """/* #include <stdint.h> +#include "errors.h" #include "format_unpack.h" #include "format_utils.h" #include "macros.h" diff --git a/src/mesa/main/format_utils.c b/src/mesa/main/format_utils.c index 31580750bd4..6959bf062a1 100644 --- a/src/mesa/main/format_utils.c +++ b/src/mesa/main/format_utils.c @@ -22,6 +22,7 @@ * OTHER DEALINGS IN THE SOFTWARE. */ +#include "errors.h" #include "format_utils.h" #include "glformats.h" #include "format_pack.h" diff --git a/src/mesa/main/format_utils.h b/src/mesa/main/format_utils.h index 378997b38b2..78365cab533 100644 --- a/src/mesa/main/format_utils.h +++ b/src/mesa/main/format_utils.h @@ -31,6 +31,7 @@ #ifndef FORMAT_UTILS_H #define FORMAT_UTILS_H +#include "formats.h" #include "imports.h" #include "macros.h" #include "util/rounding.h" diff --git a/src/mesa/main/formats.c b/src/mesa/main/formats.c index 8d32757a879..fdb53afd570 100644 --- a/src/mesa/main/formats.c +++ b/src/mesa/main/formats.c @@ -24,6 +24,7 @@ */ +#include "errors.h" #include "imports.h" #include "formats.h" #include "macros.h" diff --git a/src/mesa/main/glformats.h b/src/mesa/main/glformats.h index 5c9d8263ed1..844f1e270c0 100644 --- a/src/mesa/main/glformats.h +++ b/src/mesa/main/glformats.h @@ -36,6 +36,8 @@ extern "C" { #endif +struct gl_context; + extern void _mesa_compute_component_mapping(GLenum inFormat, GLenum outFormat, GLubyte *map); diff --git a/src/mesa/main/glheader.h b/src/mesa/main/glheader.h index a6e6b6a2e64..16648820b1b 100644 --- a/src/mesa/main/glheader.h +++ b/src/mesa/main/glheader.h @@ -42,10 +42,12 @@ extern "C" { #endif + /* Custom Mesa types to save space. */ typedef unsigned short GLenum16; typedef unsigned char GLbitfield8; typedef unsigned short GLbitfield16; +typedef GLuint64 GLbitfield64; typedef int GLclampx; diff --git a/src/mesa/main/glspirv.c b/src/mesa/main/glspirv.c index 71dc9154ef2..c585bc51bbf 100644 --- a/src/mesa/main/glspirv.c +++ b/src/mesa/main/glspirv.c @@ -24,6 +24,7 @@ #include "glspirv.h" #include "errors.h" #include "shaderobj.h" +#include "mtypes.h" #include "compiler/nir/nir.h" #include "compiler/spirv/nir_spirv.h" diff --git a/src/mesa/main/glspirv.h b/src/mesa/main/glspirv.h index 81626ce75b5..cbcd3c0bcbc 100644 --- a/src/mesa/main/glspirv.h +++ b/src/mesa/main/glspirv.h @@ -25,12 +25,14 @@ #define GLSPIRV_H #include "compiler/nir/nir.h" -#include "mtypes.h" #ifdef __cplusplus extern "C" { #endif +struct gl_context; +struct gl_shader; + /** * A SPIR-V module contains the raw SPIR-V binary as set by ShaderBinary. * diff --git a/src/mesa/main/glthread.h b/src/mesa/main/glthread.h index 306246ca1c5..8cd5d022674 100644 --- a/src/mesa/main/glthread.h +++ b/src/mesa/main/glthread.h @@ -24,8 +24,6 @@ #ifndef _GLTHREAD_H #define _GLTHREAD_H -#include "main/mtypes.h" - /* The size of one batch and the maximum size of one call. * * This should be as low as possible, so that: @@ -50,6 +48,7 @@ #include "util/u_queue.h" enum marshal_dispatch_cmd_id; +struct gl_context; /** A single batch of commands queued up for execution. */ struct glthread_batch diff --git a/src/mesa/main/hash.c b/src/mesa/main/hash.c index d0e575ea6b3..9a6d5ed5edb 100644 --- a/src/mesa/main/hash.c +++ b/src/mesa/main/hash.c @@ -34,6 +34,7 @@ * OTHER DEALINGS IN THE SOFTWARE. */ +#include "errors.h" #include "glheader.h" #include "hash.h" #include "util/hash_table.h" diff --git a/src/mesa/main/hash.h b/src/mesa/main/hash.h index 02960e3b356..64f2962aba6 100644 --- a/src/mesa/main/hash.h +++ b/src/mesa/main/hash.h @@ -34,6 +34,7 @@ #include "glheader.h" #include "imports.h" +#include "c11/threads.h" /** * Magic GLuint object name that gets stored outside of the struct hash_table. diff --git a/src/mesa/main/imports.c b/src/mesa/main/imports.c index de4dd0e33d5..b4685b6dc35 100644 --- a/src/mesa/main/imports.c +++ b/src/mesa/main/imports.c @@ -48,7 +48,6 @@ #include "util/rounding.h" /* for _mesa_roundeven */ #include "imports.h" #include "context.h" -#include "mtypes.h" #include "version.h" #ifdef _GNU_SOURCE diff --git a/src/mesa/main/imports.h b/src/mesa/main/imports.h index 51fa72cbc37..72ce8783ddb 100644 --- a/src/mesa/main/imports.h +++ b/src/mesa/main/imports.h @@ -41,7 +41,6 @@ #include <string.h> #include "compiler.h" #include "glheader.h" -#include "errors.h" #include "util/bitscan.h" #ifdef __cplusplus diff --git a/src/mesa/main/menums.h b/src/mesa/main/menums.h new file mode 100644 index 00000000000..40b16cb9cac --- /dev/null +++ b/src/mesa/main/menums.h @@ -0,0 +1,213 @@ +/* + * Mesa 3-D graphics library + * + * Copyright (C) 1999-2008 Brian Paul All Rights Reserved. + * Copyright (C) 2009 VMware, Inc. All Rights Reserved. + * Copyright (C) 2018 Advanced Micro Devices, Inc. All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +/** + * \file menums.h + * Often used definitions and enums. + */ + +#ifndef MENUMS_H +#define MENUMS_H + +#include "util/macros.h" + +/** + * Enum for the OpenGL APIs we know about and may support. + * + * NOTE: This must match the api_enum table in + * src/mesa/main/get_hash_generator.py + */ +typedef enum +{ + API_OPENGL_COMPAT, /* legacy / compatibility contexts */ + API_OPENGLES, + API_OPENGLES2, + API_OPENGL_CORE, + API_OPENGL_LAST = API_OPENGL_CORE +} gl_api; + +/** + * An index for each type of texture object. These correspond to the GL + * texture target enums, such as GL_TEXTURE_2D, GL_TEXTURE_CUBE_MAP, etc. + * Note: the order is from highest priority to lowest priority. + */ +typedef enum +{ + TEXTURE_2D_MULTISAMPLE_INDEX, + TEXTURE_2D_MULTISAMPLE_ARRAY_INDEX, + TEXTURE_CUBE_ARRAY_INDEX, + TEXTURE_BUFFER_INDEX, + TEXTURE_2D_ARRAY_INDEX, + TEXTURE_1D_ARRAY_INDEX, + TEXTURE_EXTERNAL_INDEX, + TEXTURE_CUBE_INDEX, + TEXTURE_3D_INDEX, + TEXTURE_RECT_INDEX, + TEXTURE_2D_INDEX, + TEXTURE_1D_INDEX, + NUM_TEXTURE_TARGETS +} gl_texture_index; + +/** + * Remapped color logical operations + * + * With the exception of NVIDIA hardware, which consumes the OpenGL enumerants + * directly, everything wants this mapping of color logical operations. + * + * Fun fact: These values are just the bit-reverse of the low-nibble of the GL + * enumerant values (i.e., `GL_NOOP & 0x0f` is `b0101' while + * \c COLOR_LOGICOP_NOOP is `b1010`). + * + * Fun fact #2: These values are just an encoding of the operation as a table + * of bit values. The result of the logic op is: + * + * result_bit = (logic_op >> (2 * src_bit + dst_bit)) & 1 + * + * For the GL enums, the result is: + * + * result_bit = logic_op & (1 << (2 * src_bit + dst_bit)) + */ +enum PACKED gl_logicop_mode { + COLOR_LOGICOP_CLEAR = 0, + COLOR_LOGICOP_NOR = 1, + COLOR_LOGICOP_AND_INVERTED = 2, + COLOR_LOGICOP_COPY_INVERTED = 3, + COLOR_LOGICOP_AND_REVERSE = 4, + COLOR_LOGICOP_INVERT = 5, + COLOR_LOGICOP_XOR = 6, + COLOR_LOGICOP_NAND = 7, + COLOR_LOGICOP_AND = 8, + COLOR_LOGICOP_EQUIV = 9, + COLOR_LOGICOP_NOOP = 10, + COLOR_LOGICOP_OR_INVERTED = 11, + COLOR_LOGICOP_COPY = 12, + COLOR_LOGICOP_OR_REVERSE = 13, + COLOR_LOGICOP_OR = 14, + COLOR_LOGICOP_SET = 15 +}; + +/** + * Indexes for all renderbuffers + */ +typedef enum +{ + /* the four standard color buffers */ + BUFFER_FRONT_LEFT, + BUFFER_BACK_LEFT, + BUFFER_FRONT_RIGHT, + BUFFER_BACK_RIGHT, + BUFFER_DEPTH, + BUFFER_STENCIL, + BUFFER_ACCUM, + /* optional aux buffer */ + BUFFER_AUX0, + /* generic renderbuffers */ + BUFFER_COLOR0, + BUFFER_COLOR1, + BUFFER_COLOR2, + BUFFER_COLOR3, + BUFFER_COLOR4, + BUFFER_COLOR5, + BUFFER_COLOR6, + BUFFER_COLOR7, + BUFFER_COUNT, + BUFFER_NONE = -1, +} gl_buffer_index; + +typedef enum +{ + MAP_USER, + MAP_INTERNAL, + MAP_COUNT +} gl_map_buffer_index; + +/** @{ + * + * These are a mapping of the GL_ARB_debug_output/GL_KHR_debug enums + * to small enums suitable for use as an array index. + */ + +enum mesa_debug_source +{ + MESA_DEBUG_SOURCE_API, + MESA_DEBUG_SOURCE_WINDOW_SYSTEM, + MESA_DEBUG_SOURCE_SHADER_COMPILER, + MESA_DEBUG_SOURCE_THIRD_PARTY, + MESA_DEBUG_SOURCE_APPLICATION, + MESA_DEBUG_SOURCE_OTHER, + MESA_DEBUG_SOURCE_COUNT +}; + +enum mesa_debug_type +{ + MESA_DEBUG_TYPE_ERROR, + MESA_DEBUG_TYPE_DEPRECATED, + MESA_DEBUG_TYPE_UNDEFINED, + MESA_DEBUG_TYPE_PORTABILITY, + MESA_DEBUG_TYPE_PERFORMANCE, + MESA_DEBUG_TYPE_OTHER, + MESA_DEBUG_TYPE_MARKER, + MESA_DEBUG_TYPE_PUSH_GROUP, + MESA_DEBUG_TYPE_POP_GROUP, + MESA_DEBUG_TYPE_COUNT +}; + +enum mesa_debug_severity +{ + MESA_DEBUG_SEVERITY_LOW, + MESA_DEBUG_SEVERITY_MEDIUM, + MESA_DEBUG_SEVERITY_HIGH, + MESA_DEBUG_SEVERITY_NOTIFICATION, + MESA_DEBUG_SEVERITY_COUNT +}; + +/** @} */ + +/** Set a single bit */ +#define BITFIELD_BIT(b) (1u << (b)) +/** Set all bits up to excluding bit b */ +#define BITFIELD_MASK(b) \ + ((b) == 32 ? (~0u) : BITFIELD_BIT((b) % 32) - 1) +/** Set count bits starting from bit b */ +#define BITFIELD_RANGE(b, count) \ + (BITFIELD_MASK((b) + (count)) & ~BITFIELD_MASK(b)) + + +/** + * \name 64-bit extension of GLbitfield. + */ +/*@{*/ + +/** Set a single bit */ +#define BITFIELD64_BIT(b) (1ull << (b)) +/** Set all bits up to excluding bit b */ +#define BITFIELD64_MASK(b) \ + ((b) == 64 ? (~0ull) : BITFIELD64_BIT(b) - 1) +/** Set count bits starting from bit b */ +#define BITFIELD64_RANGE(b, count) \ + (BITFIELD64_MASK((b) + (count)) & ~BITFIELD64_MASK(b)) + +#endif diff --git a/src/mesa/main/mipmap.c b/src/mesa/main/mipmap.c index 1ed82c52ab6..9b6eee41dbd 100644 --- a/src/mesa/main/mipmap.c +++ b/src/mesa/main/mipmap.c @@ -27,6 +27,7 @@ * \file mipmap.c mipmap generation and teximage resizing functions. */ +#include "errors.h" #include "imports.h" #include "formats.h" #include "glformats.h" diff --git a/src/mesa/main/mipmap.h b/src/mesa/main/mipmap.h index 1f108f7e5d8..3ec99721743 100644 --- a/src/mesa/main/mipmap.h +++ b/src/mesa/main/mipmap.h @@ -26,7 +26,10 @@ #ifndef MIPMAP_H #define MIPMAP_H -#include "mtypes.h" +#include "glheader.h" + +struct gl_context; +struct gl_texture_object; unsigned _mesa_compute_num_levels(struct gl_context *ctx, diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index b7a7b34a090..b65e7b2c3c2 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -39,6 +39,7 @@ #include "c11/threads.h" #include "main/glheader.h" +#include "main/menums.h" #include "main/config.h" #include "glapi/glapi.h" #include "math/m_matrix.h" /* GLmatrix */ @@ -54,33 +55,6 @@ extern "C" { #endif - -/** Set a single bit */ -#define BITFIELD_BIT(b) ((GLbitfield)1 << (b)) -/** Set all bits up to excluding bit b */ -#define BITFIELD_MASK(b) \ - ((b) == 32 ? (~(GLbitfield)0) : BITFIELD_BIT((b) % 32) - 1) -/** Set count bits starting from bit b */ -#define BITFIELD_RANGE(b, count) \ - (BITFIELD_MASK((b) + (count)) & ~BITFIELD_MASK(b)) - - -/** - * \name 64-bit extension of GLbitfield. - */ -/*@{*/ -typedef GLuint64 GLbitfield64; - -/** Set a single bit */ -#define BITFIELD64_BIT(b) ((GLbitfield64)1 << (b)) -/** Set all bits up to excluding bit b */ -#define BITFIELD64_MASK(b) \ - ((b) == 64 ? (~(GLbitfield64)0) : BITFIELD64_BIT(b) - 1) -/** Set count bits starting from bit b */ -#define BITFIELD64_RANGE(b, count) \ - (BITFIELD64_MASK((b) + (count)) & ~BITFIELD64_MASK(b)) - - #define GET_COLORMASK_BIT(mask, buf, chan) (((mask) >> (4 * (buf) + (chan))) & 0x1) #define GET_COLORMASK(mask, buf) (((mask) >> (4 * (buf))) & 0xf) @@ -136,34 +110,6 @@ _mesa_varying_slot_in_fs(gl_varying_slot slot) } /** - * Indexes for all renderbuffers - */ -typedef enum -{ - /* the four standard color buffers */ - BUFFER_FRONT_LEFT, - BUFFER_BACK_LEFT, - BUFFER_FRONT_RIGHT, - BUFFER_BACK_RIGHT, - BUFFER_DEPTH, - BUFFER_STENCIL, - BUFFER_ACCUM, - /* optional aux buffer */ - BUFFER_AUX0, - /* generic renderbuffers */ - BUFFER_COLOR0, - BUFFER_COLOR1, - BUFFER_COLOR2, - BUFFER_COLOR3, - BUFFER_COLOR4, - BUFFER_COLOR5, - BUFFER_COLOR6, - BUFFER_COLOR7, - BUFFER_COUNT, - BUFFER_NONE = -1, -} gl_buffer_index; - -/** * Bit flags for all renderbuffers */ #define BUFFER_BIT_FRONT_LEFT (1 << BUFFER_FRONT_LEFT) @@ -417,43 +363,6 @@ union gl_color_union GLuint ui[4]; }; -/** - * Remapped color logical operations - * - * With the exception of NVIDIA hardware, which consumes the OpenGL enumerants - * directly, everything wants this mapping of color logical operations. - * - * Fun fact: These values are just the bit-reverse of the low-nibble of the GL - * enumerant values (i.e., `GL_NOOP & 0x0f` is `b0101' while - * \c COLOR_LOGICOP_NOOP is `b1010`). - * - * Fun fact #2: These values are just an encoding of the operation as a table - * of bit values. The result of the logic op is: - * - * result_bit = (logic_op >> (2 * src_bit + dst_bit)) & 1 - * - * For the GL enums, the result is: - * - * result_bit = logic_op & (1 << (2 * src_bit + dst_bit)) - */ -enum PACKED gl_logicop_mode { - COLOR_LOGICOP_CLEAR = 0, - COLOR_LOGICOP_NOR = 1, - COLOR_LOGICOP_AND_INVERTED = 2, - COLOR_LOGICOP_COPY_INVERTED = 3, - COLOR_LOGICOP_AND_REVERSE = 4, - COLOR_LOGICOP_INVERT = 5, - COLOR_LOGICOP_XOR = 6, - COLOR_LOGICOP_NAND = 7, - COLOR_LOGICOP_AND = 8, - COLOR_LOGICOP_EQUIV = 9, - COLOR_LOGICOP_NOOP = 10, - COLOR_LOGICOP_OR_INVERTED = 11, - COLOR_LOGICOP_COPY = 12, - COLOR_LOGICOP_OR_REVERSE = 13, - COLOR_LOGICOP_OR = 14, - COLOR_LOGICOP_SET = 15 -}; /** * Color buffer attribute group (GL_COLOR_BUFFER_BIT). @@ -918,29 +827,6 @@ struct gl_stencil_attrib /** - * An index for each type of texture object. These correspond to the GL - * texture target enums, such as GL_TEXTURE_2D, GL_TEXTURE_CUBE_MAP, etc. - * Note: the order is from highest priority to lowest priority. - */ -typedef enum -{ - TEXTURE_2D_MULTISAMPLE_INDEX, - TEXTURE_2D_MULTISAMPLE_ARRAY_INDEX, - TEXTURE_CUBE_ARRAY_INDEX, - TEXTURE_BUFFER_INDEX, - TEXTURE_2D_ARRAY_INDEX, - TEXTURE_1D_ARRAY_INDEX, - TEXTURE_EXTERNAL_INDEX, - TEXTURE_CUBE_INDEX, - TEXTURE_3D_INDEX, - TEXTURE_RECT_INDEX, - TEXTURE_2D_INDEX, - TEXTURE_1D_INDEX, - NUM_TEXTURE_TARGETS -} gl_texture_index; - - -/** * Bit flags for each type of texture object */ /*@{*/ @@ -1411,14 +1297,6 @@ struct gl_viewport_attrib }; -typedef enum -{ - MAP_USER, - MAP_INTERNAL, - MAP_COUNT -} gl_map_buffer_index; - - /** * Fields describing a mapped buffer range. */ @@ -1629,22 +1507,6 @@ struct gl_vertex_array_object /** - * Enum for the OpenGL APIs we know about and may support. - * - * NOTE: This must match the api_enum table in - * src/mesa/main/get_hash_generator.py - */ -typedef enum -{ - API_OPENGL_COMPAT, /* legacy / compatibility contexts */ - API_OPENGLES, - API_OPENGLES2, - API_OPENGL_CORE, - API_OPENGL_LAST = API_OPENGL_CORE -} gl_api; - - -/** * Vertex array state */ struct gl_array_attrib @@ -2113,39 +1975,6 @@ struct gl_bindless_image /** - * Names of the various vertex/fragment program register files, etc. - * - * NOTE: first four tokens must fit into 2 bits (see t_vb_arbprogram.c) - * All values should fit in a 4-bit field. - * - * NOTE: PROGRAM_STATE_VAR, PROGRAM_CONSTANT, and PROGRAM_UNIFORM can all be - * considered to be "uniform" variables since they can only be set outside - * glBegin/End. They're also all stored in the same Parameters array. - */ -typedef enum -{ - PROGRAM_TEMPORARY, /**< machine->Temporary[] */ - PROGRAM_ARRAY, /**< Arrays & Matrixes */ - PROGRAM_INPUT, /**< machine->Inputs[] */ - PROGRAM_OUTPUT, /**< machine->Outputs[] */ - PROGRAM_STATE_VAR, /**< gl_program->Parameters[] */ - PROGRAM_CONSTANT, /**< gl_program->Parameters[] */ - PROGRAM_UNIFORM, /**< gl_program->Parameters[] */ - PROGRAM_WRITE_ONLY, /**< A dummy, write-only register */ - PROGRAM_ADDRESS, /**< machine->AddressReg */ - PROGRAM_SAMPLER, /**< for shader samplers, compile-time only */ - PROGRAM_SYSTEM_VALUE,/**< InstanceId, PrimitiveID, etc. */ - PROGRAM_UNDEFINED, /**< Invalid/TBD value */ - PROGRAM_IMMEDIATE, /**< Immediate value, used by TGSI */ - PROGRAM_BUFFER, /**< for shader buffers, compile-time only */ - PROGRAM_MEMORY, /**< for shared, global and local memory */ - PROGRAM_IMAGE, /**< for shader images, compile-time only */ - PROGRAM_HW_ATOMIC, /**< for hw atomic counters, compile-time only */ - PROGRAM_FILE_MAX -} gl_register_file; - - -/** * Current vertex processing mode: fixed function vs. shader. * In reality, fixed function is probably implemented by a shader but that's * not what we care about here. @@ -4531,48 +4360,6 @@ struct gl_dlist_state } Current; }; -/** @{ - * - * These are a mapping of the GL_ARB_debug_output/GL_KHR_debug enums - * to small enums suitable for use as an array index. - */ - -enum mesa_debug_source -{ - MESA_DEBUG_SOURCE_API, - MESA_DEBUG_SOURCE_WINDOW_SYSTEM, - MESA_DEBUG_SOURCE_SHADER_COMPILER, - MESA_DEBUG_SOURCE_THIRD_PARTY, - MESA_DEBUG_SOURCE_APPLICATION, - MESA_DEBUG_SOURCE_OTHER, - MESA_DEBUG_SOURCE_COUNT -}; - -enum mesa_debug_type -{ - MESA_DEBUG_TYPE_ERROR, - MESA_DEBUG_TYPE_DEPRECATED, - MESA_DEBUG_TYPE_UNDEFINED, - MESA_DEBUG_TYPE_PORTABILITY, - MESA_DEBUG_TYPE_PERFORMANCE, - MESA_DEBUG_TYPE_OTHER, - MESA_DEBUG_TYPE_MARKER, - MESA_DEBUG_TYPE_PUSH_GROUP, - MESA_DEBUG_TYPE_POP_GROUP, - MESA_DEBUG_TYPE_COUNT -}; - -enum mesa_debug_severity -{ - MESA_DEBUG_SEVERITY_LOW, - MESA_DEBUG_SEVERITY_MEDIUM, - MESA_DEBUG_SEVERITY_HIGH, - MESA_DEBUG_SEVERITY_NOTIFICATION, - MESA_DEBUG_SEVERITY_COUNT -}; - -/** @} */ - /** * Driver-specific state flags. * diff --git a/src/mesa/main/pack.c b/src/mesa/main/pack.c index 94a6d285d8e..64ad115f8b5 100644 --- a/src/mesa/main/pack.c +++ b/src/mesa/main/pack.c @@ -42,6 +42,7 @@ #endif +#include "errors.h" #include "glheader.h" #include "enums.h" #include "image.h" diff --git a/src/mesa/main/pack.h b/src/mesa/main/pack.h index ac0a099e391..8625a145fca 100644 --- a/src/mesa/main/pack.h +++ b/src/mesa/main/pack.h @@ -28,8 +28,10 @@ #define PACK_H -#include "mtypes.h" +#include "glheader.h" +struct gl_context; +struct gl_pixelstore_attrib; extern void _mesa_unpack_polygon_stipple(const GLubyte *pattern, GLuint dest[32], diff --git a/src/mesa/main/pbo.c b/src/mesa/main/pbo.c index 7762324a4ae..cea55f2a0d2 100644 --- a/src/mesa/main/pbo.c +++ b/src/mesa/main/pbo.c @@ -31,6 +31,7 @@ +#include "errors.h" #include "glheader.h" #include "bufferobj.h" #include "glformats.h" diff --git a/src/mesa/main/pbo.h b/src/mesa/main/pbo.h index b3f24e62bd2..bc764175ff4 100644 --- a/src/mesa/main/pbo.h +++ b/src/mesa/main/pbo.h @@ -28,8 +28,10 @@ #define PBO_H -#include "mtypes.h" +#include "glheader.h" +struct gl_context; +struct gl_pixelstore_attrib; extern GLboolean _mesa_validate_pbo_access(GLuint dimensions, diff --git a/src/mesa/main/pixeltransfer.h b/src/mesa/main/pixeltransfer.h index b0a301f2638..caa2911fcf1 100644 --- a/src/mesa/main/pixeltransfer.h +++ b/src/mesa/main/pixeltransfer.h @@ -28,7 +28,9 @@ #define PIXELTRANSFER_H -#include "mtypes.h" +#include "glheader.h" + +struct gl_context; extern void diff --git a/src/mesa/main/querymatrix.c b/src/mesa/main/querymatrix.c index 18361c929fb..b80bae6a6d2 100644 --- a/src/mesa/main/querymatrix.c +++ b/src/mesa/main/querymatrix.c @@ -17,6 +17,7 @@ #include "glheader.h" #include "querymatrix.h" #include "main/get.h" +#include "util/macros.h" /** diff --git a/src/mesa/main/querymatrix.h b/src/mesa/main/querymatrix.h index e08d843a963..64921891000 100644 --- a/src/mesa/main/querymatrix.h +++ b/src/mesa/main/querymatrix.h @@ -25,7 +25,7 @@ #define QUERYMATRIX_H -#include "mtypes.h" +#include "glheader.h" /* diff --git a/src/mesa/main/remap.c b/src/mesa/main/remap.c index 6dc4235cba0..fa412c0c4f7 100644 --- a/src/mesa/main/remap.c +++ b/src/mesa/main/remap.c @@ -44,6 +44,7 @@ #define need_MESA_remap_table #include "main/remap_helper.h" +#include "errors.h" /* this is global for quick access */ diff --git a/src/mesa/main/renderbuffer.h b/src/mesa/main/renderbuffer.h index f9a6462d536..3f568e1e7f1 100644 --- a/src/mesa/main/renderbuffer.h +++ b/src/mesa/main/renderbuffer.h @@ -27,7 +27,7 @@ #define RENDERBUFFER_H #include "glheader.h" -#include "mtypes.h" +#include "menums.h" #ifdef __cplusplus extern "C" { diff --git a/src/mesa/main/shader_query.cpp b/src/mesa/main/shader_query.cpp index 6712bb45fb2..86064a98b97 100644 --- a/src/mesa/main/shader_query.cpp +++ b/src/mesa/main/shader_query.cpp @@ -29,7 +29,6 @@ */ #include "main/context.h" -#include "main/core.h" #include "main/enums.h" #include "main/shaderapi.h" #include "main/shaderobj.h" diff --git a/src/mesa/main/shaderapi.h b/src/mesa/main/shaderapi.h index 7915248e391..dbfd68fd3a1 100644 --- a/src/mesa/main/shaderapi.h +++ b/src/mesa/main/shaderapi.h @@ -29,7 +29,7 @@ #include "glheader.h" - +#include "compiler/shader_enums.h" #ifdef __cplusplus extern "C" { @@ -38,6 +38,11 @@ extern "C" { struct _glapi_table; struct gl_context; +struct gl_linked_shader; +struct gl_pipeline_object; +struct gl_program; +struct gl_program_resource; +struct gl_shader; struct gl_shader_program; extern GLbitfield diff --git a/src/mesa/main/shaderobj.h b/src/mesa/main/shaderobj.h index fedb4dc3dec..c7ccc54afe4 100644 --- a/src/mesa/main/shaderobj.h +++ b/src/mesa/main/shaderobj.h @@ -28,14 +28,19 @@ #include "main/glheader.h" -#include "main/mtypes.h" +#include "compiler/shader_enums.h" #include "program/ir_to_mesa.h" +#include "util/macros.h" #ifdef __cplusplus extern "C" { #endif +struct gl_shader_program_data; +struct gl_linked_shader; +struct dd_function_table; +struct gl_pipeline_object; /** * Internal functions diff --git a/src/mesa/main/texcompress_bptc.c b/src/mesa/main/texcompress_bptc.c index 26e59158007..fd37be97f36 100644 --- a/src/mesa/main/texcompress_bptc.c +++ b/src/mesa/main/texcompress_bptc.c @@ -34,6 +34,7 @@ #include "texstore.h" #include "macros.h" #include "image.h" +#include "mtypes.h" #define BLOCK_SIZE 4 #define N_PARTITIONS 64 diff --git a/src/mesa/main/texcompress_etc.c b/src/mesa/main/texcompress_etc.c index faeaae90937..099787b7f40 100644 --- a/src/mesa/main/texcompress_etc.c +++ b/src/mesa/main/texcompress_etc.c @@ -41,6 +41,7 @@ #include "texcompress.h" #include "texcompress_etc.h" #include "texstore.h" +#include "config.h" #include "macros.h" #include "format_unpack.h" #include "util/format_srgb.h" diff --git a/src/mesa/main/texcompress_fxt1.c b/src/mesa/main/texcompress_fxt1.c index c5646fbd7a3..19df6baf371 100644 --- a/src/mesa/main/texcompress_fxt1.c +++ b/src/mesa/main/texcompress_fxt1.c @@ -29,6 +29,7 @@ */ +#include "errors.h" #include "glheader.h" #include "imports.h" #include "image.h" @@ -37,6 +38,7 @@ #include "texcompress.h" #include "texcompress_fxt1.h" #include "texstore.h" +#include "mtypes.h" static void diff --git a/src/mesa/main/texcompress_rgtc.c b/src/mesa/main/texcompress_rgtc.c index 8cab7a56b1a..843b42e54e6 100644 --- a/src/mesa/main/texcompress_rgtc.c +++ b/src/mesa/main/texcompress_rgtc.c @@ -33,6 +33,7 @@ */ +#include "config.h" #include "glheader.h" #include "imports.h" #include "image.h" diff --git a/src/mesa/main/texobj.h b/src/mesa/main/texobj.h index dbac1fe8cb8..743e6b73ddf 100644 --- a/src/mesa/main/texobj.h +++ b/src/mesa/main/texobj.h @@ -33,7 +33,6 @@ #include "glheader.h" -#include "mtypes.h" #include "samplerobj.h" diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c index 3314e557c0a..31163f67717 100644 --- a/src/mesa/main/texstore.c +++ b/src/mesa/main/texstore.c @@ -51,6 +51,7 @@ */ +#include "errors.h" #include "glheader.h" #include "bufferobj.h" #include "format_pack.h" diff --git a/src/mesa/main/texstore.h b/src/mesa/main/texstore.h index b8281c51e2a..2fef7ba7d7d 100644 --- a/src/mesa/main/texstore.h +++ b/src/mesa/main/texstore.h @@ -36,9 +36,13 @@ #define TEXSTORE_H -#include "mtypes.h" +#include "glheader.h" #include "formats.h" +#include "util/macros.h" +struct gl_context; +struct gl_pixelstore_attrib; +struct gl_texture_image; /** * This macro defines the (many) parameters to the texstore functions. diff --git a/src/mesa/main/texturebindless.h b/src/mesa/main/texturebindless.h index 8a9fff6d57e..ac97e95e81c 100644 --- a/src/mesa/main/texturebindless.h +++ b/src/mesa/main/texturebindless.h @@ -24,12 +24,14 @@ #ifndef TEXTUREBINDLESS_H #define TEXTUREBINDLESS_H -#include "mtypes.h" +#include "glheader.h" #ifdef __cplusplus extern "C" { #endif +struct gl_context; + /** * \name Internal functions */ diff --git a/src/mesa/main/uniform_query.cpp b/src/mesa/main/uniform_query.cpp index f901fcb3e58..de594fcc3d7 100644 --- a/src/mesa/main/uniform_query.cpp +++ b/src/mesa/main/uniform_query.cpp @@ -26,8 +26,8 @@ #include <stdlib.h> #include <inttypes.h> /* for PRIx64 macro */ +#include <math.h> -#include "main/core.h" #include "main/context.h" #include "main/shaderapi.h" #include "main/shaderobj.h" diff --git a/src/mesa/main/varray.h b/src/mesa/main/varray.h index 77027be8002..25d2a29e731 100644 --- a/src/mesa/main/varray.h +++ b/src/mesa/main/varray.h @@ -27,8 +27,6 @@ #ifndef VARRAY_H #define VARRAY_H - -#include "mtypes.h" #include "bufferobj.h" diff --git a/src/mesa/main/version.h b/src/mesa/main/version.h index adfec6f8282..4469509c08e 100644 --- a/src/mesa/main/version.h +++ b/src/mesa/main/version.h @@ -27,8 +27,13 @@ #ifndef VERSION_H #define VERSION_H -#include "mtypes.h" +#include <stdbool.h> +#include "glheader.h" +#include "menums.h" +struct gl_context; +struct gl_constants; +struct gl_extensions; extern GLuint _mesa_get_version(const struct gl_extensions *extensions, diff --git a/src/mesa/main/vtxfmt.h b/src/mesa/main/vtxfmt.h index 4f8bc9cdf06..20fc4667019 100644 --- a/src/mesa/main/vtxfmt.h +++ b/src/mesa/main/vtxfmt.h @@ -33,12 +33,14 @@ #ifndef _VTXFMT_H_ #define _VTXFMT_H_ -#include "mtypes.h" +#include "dd.h" #ifdef __cplusplus extern "C" { #endif +struct gl_context; + extern void _mesa_install_exec_vtxfmt( struct gl_context *ctx, const GLvertexformat *vfmt ); extern void _mesa_install_save_vtxfmt( struct gl_context *ctx, const GLvertexformat *vfmt ); extern void _mesa_initialize_vbo_vtxfmt(struct gl_context *ctx); |