17117f1b4Smrg/** 27117f1b4Smrg * \file extensions.h 37117f1b4Smrg * Extension handling. 47117f1b4Smrg * 57117f1b4Smrg * \if subset 67117f1b4Smrg * (No-op) 77117f1b4Smrg * 87117f1b4Smrg * \endif 97117f1b4Smrg */ 107117f1b4Smrg 117117f1b4Smrg/* 127117f1b4Smrg * Mesa 3-D graphics library 137117f1b4Smrg * 147117f1b4Smrg * Copyright (C) 1999-2006 Brian Paul All Rights Reserved. 157117f1b4Smrg * 167117f1b4Smrg * Permission is hereby granted, free of charge, to any person obtaining a 177117f1b4Smrg * copy of this software and associated documentation files (the "Software"), 187117f1b4Smrg * to deal in the Software without restriction, including without limitation 197117f1b4Smrg * the rights to use, copy, modify, merge, publish, distribute, sublicense, 207117f1b4Smrg * and/or sell copies of the Software, and to permit persons to whom the 217117f1b4Smrg * Software is furnished to do so, subject to the following conditions: 227117f1b4Smrg * 237117f1b4Smrg * The above copyright notice and this permission notice shall be included 247117f1b4Smrg * in all copies or substantial portions of the Software. 257117f1b4Smrg * 267117f1b4Smrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 277117f1b4Smrg * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 287117f1b4Smrg * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 29af69d88dSmrg * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR 30af69d88dSmrg * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 31af69d88dSmrg * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 32af69d88dSmrg * OTHER DEALINGS IN THE SOFTWARE. 337117f1b4Smrg */ 347117f1b4Smrg 357117f1b4Smrg 367117f1b4Smrg#ifndef _EXTENSIONS_H_ 377117f1b4Smrg#define _EXTENSIONS_H_ 387117f1b4Smrg 3901e04c3fSmrg#include "mtypes.h" 4001e04c3fSmrg 4101e04c3fSmrg#ifdef __cplusplus 4201e04c3fSmrgextern "C" { 4301e04c3fSmrg#endif 443464ebd5Sriastradh 453464ebd5Sriastradhstruct gl_context; 46af69d88dSmrgstruct gl_extensions; 477117f1b4Smrg 483464ebd5Sriastradhextern void _mesa_enable_sw_extensions(struct gl_context *ctx); 497117f1b4Smrg 507ec681f3Smrgextern void _mesa_one_time_init_extension_overrides(void); 517117f1b4Smrg 52af69d88dSmrgextern void _mesa_init_extensions(struct gl_extensions *extentions); 537117f1b4Smrg 543464ebd5Sriastradhextern GLubyte *_mesa_make_extension_string(struct gl_context *ctx); 557117f1b4Smrg 5601e04c3fSmrgextern void _mesa_override_extensions(struct gl_context *ctx); 5701e04c3fSmrg 58cdc920a0Smrgextern GLuint 593464ebd5Sriastradh_mesa_get_extension_count(struct gl_context *ctx); 60cdc920a0Smrg 61cdc920a0Smrgextern const GLubyte * 623464ebd5Sriastradh_mesa_get_enabled_extension(struct gl_context *ctx, GLuint index); 63cdc920a0Smrg 6401e04c3fSmrg 6501e04c3fSmrg/** 6601e04c3fSmrg * \brief An element of the \c extension_table. 6701e04c3fSmrg */ 6801e04c3fSmrgstruct mesa_extension { 6901e04c3fSmrg /** Name of extension, such as "GL_ARB_depth_clamp". */ 7001e04c3fSmrg const char *name; 7101e04c3fSmrg 7201e04c3fSmrg /** Offset (in bytes) of the corresponding member in struct gl_extensions. */ 7301e04c3fSmrg size_t offset; 7401e04c3fSmrg 7501e04c3fSmrg /** Minimum version the extension requires for the given API 7601e04c3fSmrg * (see gl_api defined in mtypes.h). The value is equal to: 7701e04c3fSmrg * 10 * major_version + minor_version 7801e04c3fSmrg */ 7901e04c3fSmrg uint8_t version[API_OPENGL_LAST + 1]; 8001e04c3fSmrg 8101e04c3fSmrg /** Year the extension was proposed or approved. Used to sort the 8201e04c3fSmrg * extension string chronologically. */ 8301e04c3fSmrg uint16_t year; 8401e04c3fSmrg}; 8501e04c3fSmrg 8601e04c3fSmrgextern const struct mesa_extension _mesa_extension_table[]; 8701e04c3fSmrg 8801e04c3fSmrg 8901e04c3fSmrg/* Generate enums for the functions below */ 9001e04c3fSmrgenum { 9101e04c3fSmrg#define EXT(name_str, ...) MESA_EXTENSION_##name_str, 9201e04c3fSmrg#include "extensions_table.h" 9301e04c3fSmrg#undef EXT 9401e04c3fSmrgMESA_EXTENSION_COUNT 9501e04c3fSmrg}; 9601e04c3fSmrg 9701e04c3fSmrg 9801e04c3fSmrg/** Checks if the context supports a user-facing extension */ 9901e04c3fSmrg#define EXT(name_str, driver_cap, ...) \ 10001e04c3fSmrgstatic inline bool \ 10101e04c3fSmrg_mesa_has_##name_str(const struct gl_context *ctx) \ 10201e04c3fSmrg{ \ 10301e04c3fSmrg return ctx->Extensions.driver_cap && (ctx->Extensions.Version >= \ 10401e04c3fSmrg _mesa_extension_table[MESA_EXTENSION_##name_str].version[ctx->API]); \ 10501e04c3fSmrg} 10601e04c3fSmrg#include "extensions_table.h" 10701e04c3fSmrg#undef EXT 10801e04c3fSmrg 10901e04c3fSmrg/* Sometimes the driver wants to query the extension override status before 11001e04c3fSmrg * a context is created. These variables are filled with extension override 11101e04c3fSmrg * information before context creation. 11201e04c3fSmrg * 11301e04c3fSmrg * This can be useful during extension bring-up when an extension is 11401e04c3fSmrg * partially implemented, but cannot yet be advertised as supported. 11501e04c3fSmrg * 11601e04c3fSmrg * Use it with care and keep access read-only. 11701e04c3fSmrg */ 118af69d88dSmrgextern struct gl_extensions _mesa_extension_override_enables; 119af69d88dSmrgextern struct gl_extensions _mesa_extension_override_disables; 1207117f1b4Smrg 12101e04c3fSmrg#ifdef __cplusplus 12201e04c3fSmrg} 12301e04c3fSmrg#endif 12401e04c3fSmrg 1257117f1b4Smrg#endif 126