101e04c3fSmrg 201e04c3fSmrg/* 301e04c3fSmrg * Mesa 3-D graphics library 401e04c3fSmrg * 501e04c3fSmrg * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. 601e04c3fSmrg * 701e04c3fSmrg * Permission is hereby granted, free of charge, to any person obtaining a 801e04c3fSmrg * copy of this software and associated documentation files (the "Software"), 901e04c3fSmrg * to deal in the Software without restriction, including without limitation 1001e04c3fSmrg * the rights to use, copy, modify, merge, publish, distribute, sublicense, 1101e04c3fSmrg * and/or sell copies of the Software, and to permit persons to whom the 1201e04c3fSmrg * Software is furnished to do so, subject to the following conditions: 1301e04c3fSmrg * 1401e04c3fSmrg * The above copyright notice and this permission notice shall be included 1501e04c3fSmrg * in all copies or substantial portions of the Software. 1601e04c3fSmrg * 1701e04c3fSmrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 1801e04c3fSmrg * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 1901e04c3fSmrg * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 2001e04c3fSmrg * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR 2101e04c3fSmrg * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 2201e04c3fSmrg * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 2301e04c3fSmrg * OTHER DEALINGS IN THE SOFTWARE. 2401e04c3fSmrg */ 2501e04c3fSmrg 2601e04c3fSmrg 2701e04c3fSmrg#ifndef API_VALIDATE_H 2801e04c3fSmrg#define API_VALIDATE_H 2901e04c3fSmrg 307ec681f3Smrg#include "mtypes.h" 317ec681f3Smrg 327ec681f3Smrg#ifdef __cplusplus 337ec681f3Smrgextern "C" { 347ec681f3Smrg#endif 3501e04c3fSmrg 3601e04c3fSmrgstruct gl_buffer_object; 3701e04c3fSmrgstruct gl_context; 3801e04c3fSmrgstruct gl_transform_feedback_object; 3901e04c3fSmrg 4001e04c3fSmrg 417ec681f3Smrgextern GLenum 427ec681f3Smrg_mesa_valid_prim_mode(struct gl_context *ctx, GLenum mode); 4301e04c3fSmrg 447ec681f3Smrgextern void 457ec681f3Smrg_mesa_update_valid_to_render_state(struct gl_context *ctx); 4601e04c3fSmrg 477ec681f3Smrg/** 487ec681f3Smrg * Is 'mode' a valid value for glBegin(), glDrawArrays(), glDrawElements(), 497ec681f3Smrg * etc? The set of legal values depends on whether geometry shaders/programs 507ec681f3Smrg * are supported. 517ec681f3Smrg * Note: This may be called during display list compilation. 527ec681f3Smrg */ 537ec681f3Smrgstatic inline bool 547ec681f3Smrg_mesa_is_valid_prim_mode(const struct gl_context *ctx, GLenum mode) 557ec681f3Smrg{ 567ec681f3Smrg /* All primitive types are less than 32, which allows us to use a mask. */ 577ec681f3Smrg return mode < 32 && (1u << mode) & ctx->SupportedPrimMask; 587ec681f3Smrg} 597ec681f3Smrg 607ec681f3Smrg#ifdef __cplusplus 617ec681f3Smrg} 627ec681f3Smrg#endif 6301e04c3fSmrg 6401e04c3fSmrg#endif 65