⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 r300_context.c

📁 Mesa is an open-source implementation of the OpenGL specification - a system for rendering interacti
💻 C
📖 第 1 页 / 共 2 页
字号:
/*Copyright (C) The Weather Channel, Inc.  2002.  All Rights Reserved.The Weather Channel (TM) funded Tungsten Graphics to develop theinitial release of the Radeon 8500 driver under the XFree86 license.This notice must be preserved.Permission is hereby granted, free of charge, to any person obtaininga copy of this software and associated documentation files (the"Software"), to deal in the Software without restriction, includingwithout limitation the rights to use, copy, modify, merge, publish,distribute, sublicense, and/or sell copies of the Software, and topermit persons to whom the Software is furnished to do so, subject tothe following conditions:The above copyright notice and this permission notice (including thenext paragraph) shall be included in all copies or substantialportions of the Software.THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OFMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BELIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTIONOF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTIONWITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.**************************************************************************//** * \file * * \author Keith Whitwell <keith@tungstengraphics.com> * * \author Nicolai Haehnle <prefect_@gmx.net> */#include "glheader.h"#include "api_arrayelt.h"#include "context.h"#include "simple_list.h"#include "imports.h"#include "matrix.h"#include "extensions.h"#include "state.h"#include "bufferobj.h"#include "swrast/swrast.h"#include "swrast_setup/swrast_setup.h"#include "vbo/vbo.h"#include "tnl/tnl.h"#include "tnl/t_pipeline.h"#include "tnl/t_vp_build.h"#include "drivers/common/driverfuncs.h"#include "radeon_ioctl.h"#include "radeon_span.h"#include "r300_context.h"#include "r300_cmdbuf.h"#include "r300_state.h"#include "r300_ioctl.h"#include "r300_tex.h"#include "r300_emit.h"#include "r300_swtcl.h"#ifdef USER_BUFFERS#include "r300_mem.h"#endif#include "vblank.h"#include "utils.h"#include "xmlpool.h"		/* for symbolic values of enum-type options *//* hw_tcl_on derives from future_hw_tcl_on when its safe to change it. */int future_hw_tcl_on = 1;int hw_tcl_on = 1;#define need_GL_EXT_stencil_two_side#define need_GL_ARB_multisample#define need_GL_ARB_point_parameters#define need_GL_ARB_texture_compression#define need_GL_ARB_vertex_buffer_object#define need_GL_ARB_vertex_program#define need_GL_EXT_blend_minmax//#define need_GL_EXT_fog_coord#define need_GL_EXT_multi_draw_arrays#define need_GL_EXT_secondary_color#define need_GL_EXT_blend_equation_separate#define need_GL_EXT_blend_func_separate#define need_GL_EXT_gpu_program_parameters#define need_GL_NV_vertex_program#include "extension_helper.h"const struct dri_extension card_extensions[] = {  /* *INDENT-OFF* */  {"GL_ARB_depth_texture",		NULL},  {"GL_ARB_fragment_program",		NULL},  {"GL_ARB_multisample",		GL_ARB_multisample_functions},  {"GL_ARB_multitexture",		NULL},  {"GL_ARB_point_parameters",		GL_ARB_point_parameters_functions},  {"GL_ARB_shadow",			NULL},  {"GL_ARB_shadow_ambient",		NULL},  {"GL_ARB_texture_border_clamp",	NULL},  {"GL_ARB_texture_compression",	GL_ARB_texture_compression_functions},  {"GL_ARB_texture_cube_map",		NULL},  {"GL_ARB_texture_env_add",		NULL},  {"GL_ARB_texture_env_combine",	NULL},  {"GL_ARB_texture_env_crossbar",	NULL},  {"GL_ARB_texture_env_dot3",		NULL},  {"GL_ARB_texture_mirrored_repeat",	NULL},  {"GL_ARB_vertex_buffer_object",	GL_ARB_vertex_buffer_object_functions},  {"GL_ARB_vertex_program",		GL_ARB_vertex_program_functions},  {"GL_EXT_blend_equation_separate",	GL_EXT_blend_equation_separate_functions},  {"GL_EXT_blend_func_separate",	GL_EXT_blend_func_separate_functions},  {"GL_EXT_blend_minmax",		GL_EXT_blend_minmax_functions},  {"GL_EXT_blend_subtract",		NULL},//  {"GL_EXT_fog_coord",			GL_EXT_fog_coord_functions },  {"GL_EXT_multi_draw_arrays",		GL_EXT_multi_draw_arrays_functions},  {"GL_EXT_gpu_program_parameters",     GL_EXT_gpu_program_parameters_functions},  {"GL_EXT_secondary_color", 		GL_EXT_secondary_color_functions},  {"GL_EXT_shadow_funcs",		NULL},  {"GL_EXT_stencil_two_side",		GL_EXT_stencil_two_side_functions},  {"GL_EXT_stencil_wrap",		NULL},  {"GL_EXT_texture_edge_clamp",		NULL},  {"GL_EXT_texture_env_combine", 	NULL},  {"GL_EXT_texture_env_dot3", 		NULL},  {"GL_EXT_texture_filter_anisotropic",	NULL},  {"GL_EXT_texture_lod_bias",		NULL},  {"GL_EXT_texture_mirror_clamp",	NULL},  {"GL_EXT_texture_rectangle",		NULL},  {"GL_ATI_texture_env_combine3",	NULL},  {"GL_ATI_texture_mirror_once",	NULL},  {"GL_MESA_pack_invert",		NULL},  {"GL_MESA_ycbcr_texture",		NULL},  {"GL_MESAX_texture_float",		NULL},  {"GL_NV_blend_square",		NULL},  {"GL_NV_vertex_program",		GL_NV_vertex_program_functions},  {"GL_SGIS_generate_mipmap",		NULL},  {"GL_SGIX_depth_texture",		NULL},  {NULL,				NULL}  /* *INDENT-ON* */};extern struct tnl_pipeline_stage _r300_render_stage;extern const struct tnl_pipeline_stage _r300_tcl_stage;static const struct tnl_pipeline_stage *r300_pipeline[] = {	/* Try and go straight to t&l	 */	&_r300_tcl_stage,	/* Catch any t&l fallbacks	 */	&_tnl_vertex_transform_stage,	&_tnl_normal_transform_stage,	&_tnl_lighting_stage,	&_tnl_fog_coordinate_stage,	&_tnl_texgen_stage,	&_tnl_texture_transform_stage,	&_tnl_vertex_program_stage,	/* Try again to go to tcl?	 *     - no good for asymmetric-twoside (do with multipass)	 *     - no good for asymmetric-unfilled (do with multipass)	 *     - good for material	 *     - good for texgen	 *     - need to manipulate a bit of state	 *	 * - worth it/not worth it?	 */	/* Else do them here.	 */	&_r300_render_stage,	&_tnl_render_stage,	/* FALLBACK  */	0,};/* Create the device specific rendering context. */GLboolean r300CreateContext(const __GLcontextModes * glVisual,			    __DRIcontextPrivate * driContextPriv,			    void *sharedContextPrivate){	__DRIscreenPrivate *sPriv = driContextPriv->driScreenPriv;	radeonScreenPtr screen = (radeonScreenPtr) (sPriv->private);	struct dd_function_table functions;	r300ContextPtr r300;	GLcontext *ctx;	int tcl_mode, i;	assert(glVisual);	assert(driContextPriv);	assert(screen);	/* Allocate the R300 context */	r300 = (r300ContextPtr) CALLOC(sizeof(*r300));	if (!r300)		return GL_FALSE;	if (!(screen->chip_flags & RADEON_CHIPSET_TCL))		hw_tcl_on = future_hw_tcl_on = 0;	/* Parse configuration files.	 * Do this here so that initialMaxAnisotropy is set before we create	 * the default textures.	 */	driParseConfigFiles(&r300->radeon.optionCache, &screen->optionCache,			    screen->driScreen->myNum, "r300");	r300->initialMaxAnisotropy = driQueryOptionf(&r300->radeon.optionCache,						     "def_max_anisotropy");	/* Init default driver functions then plug in our R300-specific functions	 * (the texture functions are especially important)	 */	_mesa_init_driver_functions(&functions);	r300InitIoctlFuncs(&functions);	r300InitStateFuncs(&functions);	r300InitTextureFuncs(&functions);	r300InitShaderFuncs(&functions);#ifdef USER_BUFFERS	r300_mem_init(r300);#endif	if (!radeonInitContext(&r300->radeon, &functions,			       glVisual, driContextPriv,			       sharedContextPrivate)) {		FREE(r300);		return GL_FALSE;	}	/* Init r300 context data */	r300->dma.buf0_address =	    r300->radeon.radeonScreen->buffers->list[0].address;	(void)memset(r300->texture_heaps, 0, sizeof(r300->texture_heaps));	make_empty_list(&r300->swapped);	r300->nr_heaps = 1 /* screen->numTexHeaps */ ;	assert(r300->nr_heaps < RADEON_NR_TEX_HEAPS);	for (i = 0; i < r300->nr_heaps; i++) {		/* *INDENT-OFF* */		r300->texture_heaps[i] = driCreateTextureHeap(i, r300,							       screen->							       texSize[i], 12,							       RADEON_NR_TEX_REGIONS,							       (drmTextureRegionPtr)							       r300->radeon.sarea->							       tex_list[i],							       &r300->radeon.sarea->							       tex_age[i],							       &r300->swapped,							       sizeof							       (r300TexObj),							       (destroy_texture_object_t								*)							       r300DestroyTexObj);		/* *INDENT-ON* */	}	r300->texture_depth = driQueryOptioni(&r300->radeon.optionCache,					      "texture_depth");	if (r300->texture_depth == DRI_CONF_TEXTURE_DEPTH_FB)		r300->texture_depth = (screen->cpp == 4) ?		    DRI_CONF_TEXTURE_DEPTH_32 : DRI_CONF_TEXTURE_DEPTH_16;	/* Set the maximum texture size small enough that we can guarentee that	 * all texture units can bind a maximal texture and have them both in	 * texturable memory at once.	 */	ctx = r300->radeon.glCtx;	ctx->Const.MaxTextureImageUnits =

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -