16dc85575000127630489b407c50a4b3ea87c9acbKeith Whitwell/** 26dc85575000127630489b407c50a4b3ea87c9acbKeith Whitwell * \file texstate.h 36dc85575000127630489b407c50a4b3ea87c9acbKeith Whitwell * Texture state management. 46dc85575000127630489b407c50a4b3ea87c9acbKeith Whitwell */ 5afb833d4e89c312460a4ab9ed6a7a8ca4ebbfe1cJochen Gerlach 6afb833d4e89c312460a4ab9ed6a7a8ca4ebbfe1cJochen Gerlach/* 7afb833d4e89c312460a4ab9ed6a7a8ca4ebbfe1cJochen Gerlach * Mesa 3-D graphics library 85e3bc0c2a2bcdf59949410f94c9b705fc1281ce8Jouk Jansen * 90fbc4c51a07a5980956d62b3f70c46c65f6c7a57Brian Paul * Copyright (C) 1999-2007 Brian Paul All Rights Reserved. 105e3bc0c2a2bcdf59949410f94c9b705fc1281ce8Jouk Jansen * 11afb833d4e89c312460a4ab9ed6a7a8ca4ebbfe1cJochen Gerlach * Permission is hereby granted, free of charge, to any person obtaining a 12afb833d4e89c312460a4ab9ed6a7a8ca4ebbfe1cJochen Gerlach * copy of this software and associated documentation files (the "Software"), 13afb833d4e89c312460a4ab9ed6a7a8ca4ebbfe1cJochen Gerlach * to deal in the Software without restriction, including without limitation 14afb833d4e89c312460a4ab9ed6a7a8ca4ebbfe1cJochen Gerlach * the rights to use, copy, modify, merge, publish, distribute, sublicense, 15afb833d4e89c312460a4ab9ed6a7a8ca4ebbfe1cJochen Gerlach * and/or sell copies of the Software, and to permit persons to whom the 16afb833d4e89c312460a4ab9ed6a7a8ca4ebbfe1cJochen Gerlach * Software is furnished to do so, subject to the following conditions: 175e3bc0c2a2bcdf59949410f94c9b705fc1281ce8Jouk Jansen * 18afb833d4e89c312460a4ab9ed6a7a8ca4ebbfe1cJochen Gerlach * The above copyright notice and this permission notice shall be included 19afb833d4e89c312460a4ab9ed6a7a8ca4ebbfe1cJochen Gerlach * in all copies or substantial portions of the Software. 205e3bc0c2a2bcdf59949410f94c9b705fc1281ce8Jouk Jansen * 21afb833d4e89c312460a4ab9ed6a7a8ca4ebbfe1cJochen Gerlach * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 22afb833d4e89c312460a4ab9ed6a7a8ca4ebbfe1cJochen Gerlach * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 23afb833d4e89c312460a4ab9ed6a7a8ca4ebbfe1cJochen Gerlach * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 243d8d5b298a268b119d840bc9bae0ee9e0c9244a9Kenneth Graunke * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR 253d8d5b298a268b119d840bc9bae0ee9e0c9244a9Kenneth Graunke * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 263d8d5b298a268b119d840bc9bae0ee9e0c9244a9Kenneth Graunke * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 273d8d5b298a268b119d840bc9bae0ee9e0c9244a9Kenneth Graunke * OTHER DEALINGS IN THE SOFTWARE. 28afb833d4e89c312460a4ab9ed6a7a8ca4ebbfe1cJochen Gerlach */ 29afb833d4e89c312460a4ab9ed6a7a8ca4ebbfe1cJochen Gerlach 30afb833d4e89c312460a4ab9ed6a7a8ca4ebbfe1cJochen Gerlach 31afb833d4e89c312460a4ab9ed6a7a8ca4ebbfe1cJochen Gerlach#ifndef TEXSTATE_H 32afb833d4e89c312460a4ab9ed6a7a8ca4ebbfe1cJochen Gerlach#define TEXSTATE_H 33afb833d4e89c312460a4ab9ed6a7a8ca4ebbfe1cJochen Gerlach 34afb833d4e89c312460a4ab9ed6a7a8ca4ebbfe1cJochen Gerlach 359846b0627149e221c9fbd7c3379e33fb68e68511Vinson Lee#include "compiler.h" 3677aabd8be237b68921d2e7c69fd1a0be3d36de01Laura Ekstrand#include "enums.h" 3777aabd8be237b68921d2e7c69fd1a0be3d36de01Laura Ekstrand#include "macros.h" 385e3bc0c2a2bcdf59949410f94c9b705fc1281ce8Jouk Jansen#include "mtypes.h" 39afb833d4e89c312460a4ab9ed6a7a8ca4ebbfe1cJochen Gerlach 40afb833d4e89c312460a4ab9ed6a7a8ca4ebbfe1cJochen Gerlach 4177aabd8be237b68921d2e7c69fd1a0be3d36de01Laura Ekstrandstatic inline struct gl_texture_unit * 4277aabd8be237b68921d2e7c69fd1a0be3d36de01Laura Ekstrand_mesa_get_tex_unit(struct gl_context *ctx, GLuint unit) 4377aabd8be237b68921d2e7c69fd1a0be3d36de01Laura Ekstrand{ 44c2e130f8201239f836f429cab3beddb4d66a3357Brian Paul assert(unit < ARRAY_SIZE(ctx->Texture.Unit)); 4577aabd8be237b68921d2e7c69fd1a0be3d36de01Laura Ekstrand return &(ctx->Texture.Unit[unit]); 4677aabd8be237b68921d2e7c69fd1a0be3d36de01Laura Ekstrand} 4777aabd8be237b68921d2e7c69fd1a0be3d36de01Laura Ekstrand 486aa7a03d856f4cfdbed493c976387b2164a0c922Brian Paul/** 496aa7a03d856f4cfdbed493c976387b2164a0c922Brian Paul * Return pointer to current texture unit. 506aa7a03d856f4cfdbed493c976387b2164a0c922Brian Paul * This the texture unit set by glActiveTexture(), not glClientActiveTexture(). 516aa7a03d856f4cfdbed493c976387b2164a0c922Brian Paul */ 529520f483b8f1e45fa474674b415554988de5d8d3Brian Paulstatic inline struct gl_texture_unit * 53f9995b30756140724f41daf963fa06167912be7fKristian Høgsberg_mesa_get_current_tex_unit(struct gl_context *ctx) 546aa7a03d856f4cfdbed493c976387b2164a0c922Brian Paul{ 5577aabd8be237b68921d2e7c69fd1a0be3d36de01Laura Ekstrand return _mesa_get_tex_unit(ctx, ctx->Texture.CurrentUnit); 5677aabd8be237b68921d2e7c69fd1a0be3d36de01Laura Ekstrand} 5777aabd8be237b68921d2e7c69fd1a0be3d36de01Laura Ekstrand 5877aabd8be237b68921d2e7c69fd1a0be3d36de01Laura Ekstrandstatic inline GLuint 5977aabd8be237b68921d2e7c69fd1a0be3d36de01Laura Ekstrand_mesa_max_tex_unit(struct gl_context *ctx) 6077aabd8be237b68921d2e7c69fd1a0be3d36de01Laura Ekstrand{ 6177aabd8be237b68921d2e7c69fd1a0be3d36de01Laura Ekstrand /* See OpenGL spec for glActiveTexture: */ 6277aabd8be237b68921d2e7c69fd1a0be3d36de01Laura Ekstrand return MAX2(ctx->Const.MaxCombinedTextureImageUnits, 6377aabd8be237b68921d2e7c69fd1a0be3d36de01Laura Ekstrand ctx->Const.MaxTextureCoordUnits); 6477aabd8be237b68921d2e7c69fd1a0be3d36de01Laura Ekstrand} 6577aabd8be237b68921d2e7c69fd1a0be3d36de01Laura Ekstrand 666aa7a03d856f4cfdbed493c976387b2164a0c922Brian Paul 6785d816028a2472e0378afda65e7ab6f7ff4d76b4Brian Paulextern void 68f9995b30756140724f41daf963fa06167912be7fKristian Høgsberg_mesa_copy_texture_state( const struct gl_context *src, struct gl_context *dst ); 6985d816028a2472e0378afda65e7ab6f7ff4d76b4Brian Paul 706cb5b3475d0d4a40479702e93b3c6a7a4129bb41Brian Paulextern void 71f9995b30756140724f41daf963fa06167912be7fKristian Høgsberg_mesa_print_texunit_state( struct gl_context *ctx, GLuint unit ); 726cb5b3475d0d4a40479702e93b3c6a7a4129bb41Brian Paul 7384d1b24647c0719551e8bcd5fa4601fbd3b1d555Ian Romanick 7485d816028a2472e0378afda65e7ab6f7ff4d76b4Brian Paul 756dc85575000127630489b407c50a4b3ea87c9acbKeith Whitwell/** 766dc85575000127630489b407c50a4b3ea87c9acbKeith Whitwell * \name Called from API 776dc85575000127630489b407c50a4b3ea87c9acbKeith Whitwell */ 786dc85575000127630489b407c50a4b3ea87c9acbKeith Whitwell/*@{*/ 79afb833d4e89c312460a4ab9ed6a7a8ca4ebbfe1cJochen Gerlach 80c40d1dd62dd9bcbb97128e37a75d991a8d3b2d8cKendall Bennettextern void GLAPIENTRY 811a1db1746db82efc7f0643508886dfc78a15eb71Paul Berry_mesa_ActiveTexture( GLenum target ); 82afb833d4e89c312460a4ab9ed6a7a8ca4ebbfe1cJochen Gerlach 83c40d1dd62dd9bcbb97128e37a75d991a8d3b2d8cKendall Bennettextern void GLAPIENTRY 841a1db1746db82efc7f0643508886dfc78a15eb71Paul Berry_mesa_ClientActiveTexture( GLenum target ); 85afb833d4e89c312460a4ab9ed6a7a8ca4ebbfe1cJochen Gerlach 866aa7a03d856f4cfdbed493c976387b2164a0c922Brian Paul/*@}*/ 876aa7a03d856f4cfdbed493c976387b2164a0c922Brian Paul 88afb833d4e89c312460a4ab9ed6a7a8ca4ebbfe1cJochen Gerlach 896dc85575000127630489b407c50a4b3ea87c9acbKeith Whitwell/** 906dc85575000127630489b407c50a4b3ea87c9acbKeith Whitwell * \name Initialization, state maintenance 916dc85575000127630489b407c50a4b3ea87c9acbKeith Whitwell */ 926dc85575000127630489b407c50a4b3ea87c9acbKeith Whitwell/*@{*/ 936dc85575000127630489b407c50a4b3ea87c9acbKeith Whitwell 946dc85575000127630489b407c50a4b3ea87c9acbKeith Whitwellextern void 95f9995b30756140724f41daf963fa06167912be7fKristian Høgsberg_mesa_update_texture( struct gl_context *ctx, GLuint new_state ); 966dc85575000127630489b407c50a4b3ea87c9acbKeith Whitwell 976dc85575000127630489b407c50a4b3ea87c9acbKeith Whitwellextern GLboolean 98f9995b30756140724f41daf963fa06167912be7fKristian Høgsberg_mesa_init_texture( struct gl_context *ctx ); 996dc85575000127630489b407c50a4b3ea87c9acbKeith Whitwell 1006dc85575000127630489b407c50a4b3ea87c9acbKeith Whitwellextern void 101f9995b30756140724f41daf963fa06167912be7fKristian Høgsberg_mesa_free_texture_data( struct gl_context *ctx ); 1026dc85575000127630489b407c50a4b3ea87c9acbKeith Whitwell 1034b654d41da08b3b5475144c027e97a3ae7ab5696Brian Paulextern void 104f9995b30756140724f41daf963fa06167912be7fKristian Høgsberg_mesa_update_default_objects_texture(struct gl_context *ctx); 1054b654d41da08b3b5475144c027e97a3ae7ab5696Brian Paul 1066dc85575000127630489b407c50a4b3ea87c9acbKeith Whitwell/*@}*/ 1071b258989462e907e45abbdf8743b0a75f22c02b3Brian Paul 108afb833d4e89c312460a4ab9ed6a7a8ca4ebbfe1cJochen Gerlach#endif 109