17117f1b4Smrg/*
27117f1b4Smrg * Mesa 3-D graphics library
37117f1b4Smrg *
47117f1b4Smrg * Copyright (C) 1999-2007  Brian Paul   All Rights Reserved.
5c1f859d4Smrg * Copyright (C) 2008  VMware, Inc.  All Rights Reserved.
67117f1b4Smrg *
77117f1b4Smrg * Permission is hereby granted, free of charge, to any person obtaining a
87117f1b4Smrg * copy of this software and associated documentation files (the "Software"),
97117f1b4Smrg * to deal in the Software without restriction, including without limitation
107117f1b4Smrg * the rights to use, copy, modify, merge, publish, distribute, sublicense,
117117f1b4Smrg * and/or sell copies of the Software, and to permit persons to whom the
127117f1b4Smrg * Software is furnished to do so, subject to the following conditions:
137117f1b4Smrg *
147117f1b4Smrg * The above copyright notice and this permission notice shall be included
157117f1b4Smrg * in all copies or substantial portions of the Software.
167117f1b4Smrg *
177117f1b4Smrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
187117f1b4Smrg * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
197117f1b4Smrg * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
20af69d88dSmrg * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
21af69d88dSmrg * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
22af69d88dSmrg * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
23af69d88dSmrg * OTHER DEALINGS IN THE SOFTWARE.
247117f1b4Smrg */
257117f1b4Smrg
26c1f859d4Smrg/**
27c1f859d4Smrg * \file config.h
28c1f859d4Smrg * Tunable configuration parameters.
29c1f859d4Smrg */
307117f1b4Smrg
317117f1b4Smrg#ifndef MESA_CONFIG_H_INCLUDED
327117f1b4Smrg#define MESA_CONFIG_H_INCLUDED
337117f1b4Smrg
347ec681f3Smrg#include "compiler/shader_enums.h"
35c1f859d4Smrg
367117f1b4Smrg/**
377117f1b4Smrg * \name OpenGL implementation limits
387117f1b4Smrg */
397117f1b4Smrg/*@{*/
407117f1b4Smrg
417117f1b4Smrg/** Maximum modelview matrix stack depth */
427117f1b4Smrg#define MAX_MODELVIEW_STACK_DEPTH 32
437117f1b4Smrg
447117f1b4Smrg/** Maximum projection matrix stack depth */
457117f1b4Smrg#define MAX_PROJECTION_STACK_DEPTH 32
467117f1b4Smrg
477117f1b4Smrg/** Maximum texture matrix stack depth */
487117f1b4Smrg#define MAX_TEXTURE_STACK_DEPTH 10
497117f1b4Smrg
507117f1b4Smrg/** Maximum attribute stack depth */
517117f1b4Smrg#define MAX_ATTRIB_STACK_DEPTH 16
527117f1b4Smrg
537117f1b4Smrg/** Maximum client attribute stack depth */
547117f1b4Smrg#define MAX_CLIENT_ATTRIB_STACK_DEPTH 16
557117f1b4Smrg
567117f1b4Smrg/** Maximum recursion depth of display list calls */
577117f1b4Smrg#define MAX_LIST_NESTING 64
587117f1b4Smrg
597117f1b4Smrg/** Maximum number of lights */
607117f1b4Smrg#define MAX_LIGHTS 8
617117f1b4Smrg
62af69d88dSmrg/**
63af69d88dSmrg * Maximum number of user-defined clipping planes supported by any driver in
64af69d88dSmrg * Mesa.  This is used to size arrays.
65af69d88dSmrg */
66af69d88dSmrg#define MAX_CLIP_PLANES 8
677117f1b4Smrg
687117f1b4Smrg/** Maximum pixel map lookup table size */
697117f1b4Smrg#define MAX_PIXEL_MAP_TABLE 256
707117f1b4Smrg
717117f1b4Smrg/** Maximum number of auxillary color buffers */
724a49301eSmrg#define MAX_AUX_BUFFERS 1
737117f1b4Smrg
747117f1b4Smrg/** Maximum order (degree) of curves */
75af69d88dSmrg#define MAX_EVAL_ORDER 30
767117f1b4Smrg
777117f1b4Smrg/** Maximum Name stack depth */
787117f1b4Smrg#define MAX_NAME_STACK_DEPTH 64
797117f1b4Smrg
807117f1b4Smrg/** Minimum point size */
817117f1b4Smrg#define MIN_POINT_SIZE 1.0
827117f1b4Smrg/** Maximum point size */
83c1f859d4Smrg#define MAX_POINT_SIZE 60.0
847117f1b4Smrg/** Point size granularity */
857117f1b4Smrg#define POINT_SIZE_GRANULARITY 0.1
867117f1b4Smrg
877117f1b4Smrg/** Minimum line width */
887117f1b4Smrg#define MIN_LINE_WIDTH 1.0
897117f1b4Smrg/** Maximum line width */
907117f1b4Smrg#define MAX_LINE_WIDTH 10.0
917117f1b4Smrg/** Line width granularity */
927117f1b4Smrg#define LINE_WIDTH_GRANULARITY 0.1
937117f1b4Smrg
943464ebd5Sriastradh/** Max memory to allow for a single texture image (in megabytes) */
953464ebd5Sriastradh#define MAX_TEXTURE_MBYTES 1024
963464ebd5Sriastradh
977ec681f3Smrg/** Number of texture mipmap levels */
983464ebd5Sriastradh#define MAX_TEXTURE_LEVELS 15
997117f1b4Smrg
1007117f1b4Smrg/** Maximum rectangular texture size - GL_NV_texture_rectangle */
1013464ebd5Sriastradh#define MAX_TEXTURE_RECT_SIZE 16384
1027117f1b4Smrg
103af69d88dSmrg/**
104af69d88dSmrg * Maximum number of layers in a 1D or 2D array texture - GL_MESA_texture_array
105af69d88dSmrg */
106c1f859d4Smrg#define MAX_ARRAY_TEXTURE_LAYERS 64
1077117f1b4Smrg
108c1f859d4Smrg/**
109c1f859d4Smrg * Max number of texture image units.  Also determines number of texture
110c1f859d4Smrg * samplers in shaders.
111c1f859d4Smrg */
112af69d88dSmrg#define MAX_TEXTURE_IMAGE_UNITS 32
1137117f1b4Smrg
1147117f1b4Smrg/**
115c1f859d4Smrg * Larger of MAX_TEXTURE_COORD_UNITS and MAX_TEXTURE_IMAGE_UNITS.
116c1f859d4Smrg * This value is only used for dimensioning arrays.
117c1f859d4Smrg * Either MAX_TEXTURE_COORD_UNITS or MAX_TEXTURE_IMAGE_UNITS (or the
118c1f859d4Smrg * corresponding ctx->Const.MaxTextureCoord/ImageUnits fields) should be
119c1f859d4Smrg * used almost everywhere else.
1207117f1b4Smrg */
121c1f859d4Smrg#define MAX_TEXTURE_UNITS ((MAX_TEXTURE_COORD_UNITS > MAX_TEXTURE_IMAGE_UNITS) ? MAX_TEXTURE_COORD_UNITS : MAX_TEXTURE_IMAGE_UNITS)
122c1f859d4Smrg
12301e04c3fSmrg/** Maximum number of viewports supported with ARB_viewport_array */
124af69d88dSmrg#define MAX_VIEWPORTS 16
1257117f1b4Smrg
12601e04c3fSmrg/** Maximum number of window rectangles supported with EXT_window_rectangles */
12701e04c3fSmrg#define MAX_WINDOW_RECTANGLES 8
12801e04c3fSmrg
12901e04c3fSmrg/** Maximum size for CVA.  May be overridden by the drivers.  */
1307117f1b4Smrg#define MAX_ARRAY_LOCK_SIZE 3000
1317117f1b4Smrg
1327117f1b4Smrg/** Subpixel precision for antialiasing, window coordinate snapping */
1337117f1b4Smrg#define SUB_PIXEL_BITS 4
1347117f1b4Smrg
1357117f1b4Smrg/** For GL_ARB_texture_compression */
1367117f1b4Smrg#define MAX_COMPRESSED_TEXTURE_FORMATS 25
1377117f1b4Smrg
1387117f1b4Smrg/** For GL_EXT_texture_filter_anisotropic */
1397117f1b4Smrg#define MAX_TEXTURE_MAX_ANISOTROPY 16.0
1407117f1b4Smrg
1417117f1b4Smrg/** For GL_EXT_texture_lod_bias (typically MAX_TEXTURE_LEVELS - 1) */
1423464ebd5Sriastradh#define MAX_TEXTURE_LOD_BIAS 14.0
1434a49301eSmrg
1444a49301eSmrg/** For any program target/extension */
1454a49301eSmrg/*@{*/
1464a49301eSmrg#define MAX_PROGRAM_INSTRUCTIONS       (16 * 1024)
1474a49301eSmrg
1484a49301eSmrg/**
1494a49301eSmrg * Per-program constants (power of two)
1504a49301eSmrg *
1513464ebd5Sriastradh * \c MAX_PROGRAM_LOCAL_PARAMS and \c MAX_UNIFORMS are just the assembly shader
1524a49301eSmrg * and GLSL shader names for the same thing.  They should \b always have the
1534a49301eSmrg * same value.  Each refers to the number of vec4 values supplied as
1544a49301eSmrg * per-program parameters.
1554a49301eSmrg */
1564a49301eSmrg/*@{*/
157af69d88dSmrg#define MAX_PROGRAM_LOCAL_PARAMS       4096
158af69d88dSmrg#define MAX_UNIFORMS                   4096
159af69d88dSmrg#define MAX_UNIFORM_BUFFERS            15 /* + 1 default uniform buffer */
16001e04c3fSmrg#define MAX_SHADER_STORAGE_BUFFERS     16
161af69d88dSmrg/* 6 is for vertex, hull, domain, geometry, fragment, and compute shader. */
162af69d88dSmrg#define MAX_COMBINED_UNIFORM_BUFFERS   (MAX_UNIFORM_BUFFERS * 6)
16301e04c3fSmrg#define MAX_COMBINED_SHADER_STORAGE_BUFFERS   (MAX_SHADER_STORAGE_BUFFERS * 6)
164af69d88dSmrg#define MAX_ATOMIC_COUNTERS            4096
165af69d88dSmrg/* 6 is for vertex, hull, domain, geometry, fragment, and compute shader. */
166af69d88dSmrg#define MAX_COMBINED_ATOMIC_BUFFERS    (MAX_UNIFORM_BUFFERS * 6)
167af69d88dSmrg/* Size of an atomic counter in bytes according to ARB_shader_atomic_counters */
168af69d88dSmrg#define ATOMIC_COUNTER_SIZE            4
16901e04c3fSmrg#define MAX_IMAGE_UNIFORMS             32
170af69d88dSmrg/* 6 is for vertex, hull, domain, geometry, fragment, and compute shader. */
171af69d88dSmrg#define MAX_IMAGE_UNITS                (MAX_IMAGE_UNIFORMS * 6)
1724a49301eSmrg/*@}*/
1734a49301eSmrg
1744a49301eSmrg/**
1754a49301eSmrg * Per-context constants (power of two)
1764a49301eSmrg *
1774a49301eSmrg * \note
1784a49301eSmrg * This value should always be less than or equal to \c MAX_PROGRAM_LOCAL_PARAMS
1794a49301eSmrg * and \c MAX_VERTEX_PROGRAM_PARAMS.  Otherwise some applications will make
1804a49301eSmrg * incorrect assumptions.
1814a49301eSmrg */
1824a49301eSmrg#define MAX_PROGRAM_ENV_PARAMS         256
1834a49301eSmrg
1844a49301eSmrg#define MAX_PROGRAM_MATRICES           8
1854a49301eSmrg#define MAX_PROGRAM_MATRIX_STACK_DEPTH 4
1864a49301eSmrg#define MAX_PROGRAM_CALL_DEPTH         8
1874a49301eSmrg#define MAX_PROGRAM_TEMPS              256
188af69d88dSmrg#define MAX_PROGRAM_ADDRESS_REGS       1
1894a49301eSmrg#define MAX_SAMPLERS                   MAX_TEXTURE_IMAGE_UNITS
1904a49301eSmrg#define MAX_PROGRAM_INPUTS             32
1914a49301eSmrg#define MAX_PROGRAM_OUTPUTS            64
1924a49301eSmrg/*@}*/
1937117f1b4Smrg
1947117f1b4Smrg/** For GL_ARB_vertex_program */
1957117f1b4Smrg/*@{*/
1967117f1b4Smrg#define MAX_VERTEX_PROGRAM_ADDRESS_REGS 1
1974a49301eSmrg#define MAX_VERTEX_PROGRAM_PARAMS       MAX_UNIFORMS
1987117f1b4Smrg/*@}*/
1997117f1b4Smrg
2007117f1b4Smrg/** For GL_ARB_fragment_program */
2017117f1b4Smrg/*@{*/
2027117f1b4Smrg#define MAX_FRAGMENT_PROGRAM_ADDRESS_REGS 0
20301e04c3fSmrg#define MAX_FRAGMENT_PROGRAM_PARAMS       64
20401e04c3fSmrg#define MAX_FRAGMENT_PROGRAM_INPUTS       12
2057117f1b4Smrg/*@}*/
2067117f1b4Smrg
2077117f1b4Smrg/** For GL_ARB_vertex_shader */
2087117f1b4Smrg/*@{*/
209af69d88dSmrg/* 6 is for vertex, hull, domain, geometry, fragment, and compute shader. */
210af69d88dSmrg#define MAX_COMBINED_TEXTURE_IMAGE_UNITS (MAX_TEXTURE_IMAGE_UNITS * 6)
2117117f1b4Smrg/*@}*/
2127117f1b4Smrg
2137117f1b4Smrg
2147117f1b4Smrg/** For GL_EXT_framebuffer_object */
2157117f1b4Smrg/*@{*/
2167117f1b4Smrg#define MAX_COLOR_ATTACHMENTS 8
217af69d88dSmrg#define MAX_RENDERBUFFER_SIZE 16384
2187117f1b4Smrg/*@}*/
2197117f1b4Smrg
2204a49301eSmrg/** For GL_ATI_envmap_bump - support bump mapping on first 8 units */
2214a49301eSmrg#define SUPPORTED_ATI_BUMP_UNITS 0xff
2227117f1b4Smrg
2233464ebd5Sriastradh/** For GL_EXT_transform_feedback */
224af69d88dSmrg#define MAX_FEEDBACK_BUFFERS 4
2253464ebd5Sriastradh#define MAX_FEEDBACK_ATTRIBS 32
2263464ebd5Sriastradh
22701e04c3fSmrg/** For geometry shader */
2283464ebd5Sriastradh/*@{*/
2293464ebd5Sriastradh#define MAX_GEOMETRY_UNIFORM_COMPONENTS              512
2303464ebd5Sriastradh#define MAX_GEOMETRY_OUTPUT_VERTICES                 256
2313464ebd5Sriastradh#define MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS         1024
2323464ebd5Sriastradh/*@}*/
2333464ebd5Sriastradh
234af69d88dSmrg/** For GL_ARB_debug_output and GL_KHR_debug */
2357117f1b4Smrg/*@{*/
236af69d88dSmrg#define MAX_DEBUG_LOGGED_MESSAGES   10
237af69d88dSmrg#define MAX_DEBUG_MESSAGE_LENGTH    4096
238af69d88dSmrg/*@}*/
2397117f1b4Smrg
240af69d88dSmrg/** For GL_KHR_debug */
241af69d88dSmrg/*@{*/
242af69d88dSmrg#define MAX_LABEL_LENGTH 256
243af69d88dSmrg#define MAX_DEBUG_GROUP_STACK_DEPTH 64
244af69d88dSmrg/*@}*/
2457117f1b4Smrg
246af69d88dSmrg/** For GL_ARB_gpu_shader5 */
247af69d88dSmrg/*@{*/
248af69d88dSmrg#define MAX_GEOMETRY_SHADER_INVOCATIONS     32
249af69d88dSmrg#define MIN_FRAGMENT_INTERPOLATION_OFFSET   -0.5
250af69d88dSmrg#define MAX_FRAGMENT_INTERPOLATION_OFFSET   0.5
251af69d88dSmrg#define FRAGMENT_INTERPOLATION_OFFSET_BITS  4
252af69d88dSmrg#define MAX_VERTEX_STREAMS                  4
253af69d88dSmrg/*@}*/
2547117f1b4Smrg
25501e04c3fSmrg/** For GL_ARB_shader_subroutine */
25601e04c3fSmrg/*@{*/
25701e04c3fSmrg#define MAX_SUBROUTINES                   256
25801e04c3fSmrg#define MAX_SUBROUTINE_UNIFORM_LOCATIONS  1024
25901e04c3fSmrg/*@}*/
26001e04c3fSmrg
261af69d88dSmrg/** For GL_INTEL_performance_query */
262af69d88dSmrg/*@{*/
263af69d88dSmrg#define MAX_PERFQUERY_QUERY_NAME_LENGTH     256
264af69d88dSmrg#define MAX_PERFQUERY_COUNTER_NAME_LENGTH   256
265af69d88dSmrg#define MAX_PERFQUERY_COUNTER_DESC_LENGTH   1024
266af69d88dSmrg#define PERFQUERY_HAVE_GPA_EXTENDED_COUNTERS 0
267af69d88dSmrg/*@}*/
2687117f1b4Smrg
26901e04c3fSmrg/** For GL_ARB_pipeline_statistics_query */
27001e04c3fSmrg#define MAX_PIPELINE_STATISTICS             11
27101e04c3fSmrg
27201e04c3fSmrg/** For GL_ARB_tessellation_shader */
273af69d88dSmrg/*@{*/
27401e04c3fSmrg#define MAX_TESS_GEN_LEVEL 64
27501e04c3fSmrg#define MAX_PATCH_VERTICES 32
27601e04c3fSmrg#define MAX_TESS_PATCH_COMPONENTS 120
27701e04c3fSmrg#define MAX_TESS_CONTROL_TOTAL_OUTPUT_COMPONENTS 4096
278af69d88dSmrg/*@}*/
2797117f1b4Smrg
2807117f1b4Smrg/*
2817117f1b4Smrg * Color channel component order
2827117f1b4Smrg *
2837117f1b4Smrg * \note Changes will almost certainly cause problems at this time.
2847117f1b4Smrg */
2857117f1b4Smrg#define RCOMP 0
2867117f1b4Smrg#define GCOMP 1
2877117f1b4Smrg#define BCOMP 2
2887117f1b4Smrg#define ACOMP 3
2897117f1b4Smrg
2907117f1b4Smrg
2917117f1b4Smrg/**
2927117f1b4Smrg * Maximum number of temporary vertices required for clipping.
2937117f1b4Smrg *
2947117f1b4Smrg * Used in array_cache and tnl modules.
2957117f1b4Smrg */
2967117f1b4Smrg#define MAX_CLIPPED_VERTICES ((2 * (6 + MAX_CLIP_PLANES))+1)
2977117f1b4Smrg
2987117f1b4Smrg
29901e04c3fSmrg/** For GL_ARB_sample_locations - maximum of SAMPLE_LOCATION_PIXEL_GRID_*_ARB */
30001e04c3fSmrg#define MAX_SAMPLE_LOCATION_GRID_SIZE 4
30101e04c3fSmrg
30201e04c3fSmrg/* It is theoretically possible for Consts.MaxSamples to be >32 but
30301e04c3fSmrg * other code seems to assume that is not the case.
30401e04c3fSmrg */
30501e04c3fSmrg#define MAX_SAMPLE_LOCATION_TABLE_SIZE \
30601e04c3fSmrg   (MAX_SAMPLE_LOCATION_GRID_SIZE * MAX_SAMPLE_LOCATION_GRID_SIZE * 32)
30701e04c3fSmrg
3087117f1b4Smrg#endif /* MESA_CONFIG_H_INCLUDED */
309