diff options
Diffstat (limited to 'nx-X11/extras/Mesa/src/mesa/main')
-rw-r--r-- | nx-X11/extras/Mesa/src/mesa/main/Imakefile | 129 | ||||
-rw-r--r-- | nx-X11/extras/Mesa/src/mesa/main/KNOWN_BUGS | 21 | ||||
-rw-r--r-- | nx-X11/extras/Mesa/src/mesa/main/Makefile.ugl | 364 | ||||
-rw-r--r-- | nx-X11/extras/Mesa/src/mesa/main/Makefile.win | 208 | ||||
-rw-r--r-- | nx-X11/extras/Mesa/src/mesa/main/WSDrawBuffer.h.NX.original | 24 | ||||
-rw-r--r-- | nx-X11/extras/Mesa/src/mesa/main/context.c.NX.original | 1818 | ||||
-rw-r--r-- | nx-X11/extras/Mesa/src/mesa/main/context.c.X.original | 1750 | ||||
-rw-r--r-- | nx-X11/extras/Mesa/src/mesa/main/descrip.mms | 210 | ||||
-rw-r--r-- | nx-X11/extras/Mesa/src/mesa/main/get_gen.py | 1200 | ||||
-rw-r--r-- | nx-X11/extras/Mesa/src/mesa/main/mesa.def | 491 | ||||
-rw-r--r-- | nx-X11/extras/Mesa/src/mesa/main/vsnprintf.c | 165 |
11 files changed, 0 insertions, 6380 deletions
diff --git a/nx-X11/extras/Mesa/src/mesa/main/Imakefile b/nx-X11/extras/Mesa/src/mesa/main/Imakefile deleted file mode 100644 index fe0658c6c..000000000 --- a/nx-X11/extras/Mesa/src/mesa/main/Imakefile +++ /dev/null @@ -1,129 +0,0 @@ -#define DoNormalLib NO
-#define DoSharedLib YES
-#define DoDebugLib NO
-#define DoProfileLib NO
-#define LibName MESAGL
-#define SoRev SOX11REV
-#define LibHeaders NO
-
-#include <Threads.tmpl>
-
-REQUIREDLIBS = $(X11ROOT)\\XFree86\\lib\\ Xext X11
-BUILDLIBDIR = $(TOP)\\lib
-
-INCLUDES = -I$(TOP)\\include
-
-SRCS = \
-accum.c \
-alpha.c \
-alphabuf.c \
-api1.c \
-api2.c \
-attrib.c \
-bitmap.c \
-blend.c \
-bresenhm.c \
-clip.c \
-context.c \
-copypix.c \
-dd.c \
-depth.c \
-draw.c \
-drawpix.c \
-enable.c \
-eval2.c \
-feedback.c \
-fog.c \
-fortran.c \
-get.c \
-hash.c \
-glx.c \
-interp.c \
-light.c \
-lines.c \
-list.c \
-logic.c \
-masking.c \
-misc.c \
-osmesa.c \
-pb.c \
-pixel.c \
-points.c \
-polygons.c \
-readpix.c \
-scissor.c \
-span.c \
-stencil.c \
-svgamesa.c \
-texture.c \
-varray.c \
-vb.c \
-vertex.c \
-xfonts.c \
-xform.c \
-xm_api.c \
-xm_dd.c \
-xm_line.c \
-xm_span.c \
-xm_tri.c
-
-OBJS = \
-accum.o \
-alpha.o \
-alphabuf.o \
-api1.o \
-api2.o \
-attrib.o \
-bitmap.o \
-blend.o \
-bresenhm.o \
-clip.o \
-context.o \
-copypix.o \
-dd.o \
-depth.o \
-draw.o \
-drawpix.o \
-enable.o \
-eval2.o \
-feedback.o \
-fog.o \
-fortran.o \
-get.o \
-hash.o \
-glx.o \
-interp.o \
-light.o \
-lines.o \
-list.o \
-logic.o \
-masking.o \
-misc.o \
-osmesa.o \
-pb.o \
-pixel.o \
-points.o \
-polygons.o \
-readpix.o \
-scissor.o \
-span.o \
-stencil.o \
-svgamesa.o \
-texture.o \
-varray.o \
-vb.o \
-vertex.o \
-xfonts.o \
-xform.o \
-xm_api.o \
-xm_dd.o \
-xm_line.o \
-xm_span.o \
-xm_tri.o
-
-LINTLIBS =
-
-#include <Library.tmpl>
-
-DependTarget()
-
diff --git a/nx-X11/extras/Mesa/src/mesa/main/KNOWN_BUGS b/nx-X11/extras/Mesa/src/mesa/main/KNOWN_BUGS deleted file mode 100644 index efbb0ca40..000000000 --- a/nx-X11/extras/Mesa/src/mesa/main/KNOWN_BUGS +++ /dev/null @@ -1,21 +0,0 @@ - - -Performance issues with EXT_point_parameters & quake2 - - - -Using glPolygonMode() where the front and back modes aren't the -same causes poor performance on 3Dfx. - - - -Broken drivers: some of the Mesa device drivers (such as BeOS, D3D, -etc) haven't been updated for Mesa 3.3's device driver changes. - - - -glDrawRangeElements() should use vertex array locking to improve performance -but trying to do so causes a rendering error. Reported by Scott McMillan. -Fixed by disabling locking in glDrawRangeElements (varray.c) but that's -really just hiding a bug in array locking. - diff --git a/nx-X11/extras/Mesa/src/mesa/main/Makefile.ugl b/nx-X11/extras/Mesa/src/mesa/main/Makefile.ugl deleted file mode 100644 index b440e1364..000000000 --- a/nx-X11/extras/Mesa/src/mesa/main/Makefile.ugl +++ /dev/null @@ -1,364 +0,0 @@ -# Mesa 3-D graphics library -# Version: 4.1 -# -# Copyright (C) 2001 Wind River Systems, Inc - -# The MIT License -# Permission is hereby granted, free of charge, to any person obtaining a -# copy of this software and associated documentation files (the "Software"), -# to deal in the Software without restriction, including without limitation -# the rights to use, copy, modify, merge, publish, distribute, sublicense, -# and/or sell copies of the Software, and to permit persons to whom the -# Software is furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included -# in all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -# DEALINGS IN THE SOFTWARE. - -# Makefile for core library - -# This makefile can moved all objects files in MESA_OBJ for use with -# ld in windShell or create a library from objects files in their -# associated .c folder. -# -# For an easy inclusion of lib$(CPU)$(TOOL)GL.a in vxworks image, this -# makefile collects together all .o in an only file -# (obj$(CPU)$(TOOL)GL.o). This operation is unnecessary for -# lib$(CPU)$(TOOL)OSMesa.a and lib$(CPU)$(TOOL)UglMesa.a because they -# already contain only one file. -# -##### MACROS ##### -MESA_MAJOR=4 -MESA_MINOR=1 -MESA_TINY=0 -VERSION=$(MESA_MAJOR).$(MESA_MINOR) - -GL_MAJOR = 1 -GL_MINOR = 2 -GL_TINY = 0$(MESA_MAJOR)0$(MESA_MINOR)0$(MESA_TINY) - -##### RULES ##### - -include ..\rules.windml - -#### GL ##### - -GL_SOURCES = \ - api_arrayelt.c \ - api_loopback.c \ - api_noop.c \ - api_validate.c \ - accum.c \ - arbprogram.c \ - attrib.c \ - blend.c \ - bufferobj.c \ - buffers.c \ - clip.c \ - colortab.c \ - context.c \ - convolve.c \ - debug.c \ - depth.c \ - dispatch.c \ - dlist.c \ - drawpix.c \ - enable.c \ - enums.c \ - eval.c \ - extensions.c \ - feedback.c \ - fog.c \ - get.c \ - glapi.c \ - glthread.c \ - hash.c \ - hint.c \ - histogram.c \ - image.c \ - imports.c \ - light.c \ - lines.c \ - matrix.c \ - pixel.c \ - points.c \ - polygon.c \ - rastpos.c \ - state.c \ - stencil.c \ - texcompress.c \ - texformat.c \ - teximage.c \ - texobj.c \ - texstate.c \ - texstore.c \ - texutil.c \ - varray.c \ - vtxfmt.c \ - X86/x86.c \ - X86/common_x86.c \ - X86/3dnow.c \ - X86/sse.c \ - math/m_debug_clip.c \ - math/m_debug_norm.c \ - math/m_debug_vertex.c \ - math/m_debug_xform.c \ - math/m_eval.c \ - math/m_matrix.c \ - math/m_translate.c \ - math/m_vector.c \ - math/m_vertices.c \ - math/m_xform.c \ - array_cache/ac_context.c \ - array_cache/ac_import.c \ - swrast/s_aaline.c \ - swrast/s_aatriangle.c \ - swrast/s_accum.c \ - swrast/s_alpha.c \ - swrast/s_alphabuf.c \ - swrast/s_bitmap.c \ - swrast/s_blend.c \ - swrast/s_buffers.c \ - swrast/s_copypix.c \ - swrast/s_context.c \ - swrast/s_depth.c \ - swrast/s_drawpix.c \ - swrast/s_feedback.c \ - swrast/s_fog.c \ - swrast/s_imaging.c \ - swrast/s_lines.c \ - swrast/s_logic.c \ - swrast/s_masking.c \ - swrast/s_pixeltex.c \ - swrast/s_points.c \ - swrast/s_readpix.c \ - swrast/s_span.c \ - swrast/s_stencil.c \ - swrast/s_texture.c \ - swrast/s_texstore.c \ - swrast/s_triangle.c \ - swrast/s_zoom.c \ - swrast_setup/ss_context.c \ - swrast_setup/ss_triangle.c \ - swrast_setup/ss_vb.c \ - tnl/t_array_api.c \ - tnl/t_array_import.c \ - tnl/t_context.c \ - tnl/t_eval_api.c \ - tnl/t_imm_alloc.c \ - tnl/t_imm_api.c \ - tnl/t_imm_debug.c \ - tnl/t_imm_dlist.c \ - tnl/t_imm_elt.c \ - tnl/t_imm_eval.c \ - tnl/t_imm_exec.c \ - tnl/t_imm_fixup.c \ - tnl/t_pipeline.c \ - tnl/t_vb_fog.c \ - tnl/t_vb_light.c \ - tnl/t_vb_normals.c \ - tnl/t_vb_points.c \ - tnl/t_vb_render.c \ - tnl/t_vb_texgen.c \ - tnl/t_vb_texmat.c \ - tnl/t_vb_vertex.c - -GL_OBJECTS = $(GL_SOURCES:.c=.o) -GL_OBJNAME = $(MESA_LIBDIR)/objMesaGL.o - -#### X86 ##### - -x86_files = \ - X86/common_x86_asm.S \ - X86/glapi_x86.S \ - X86/x86_cliptest.S \ - X86/x86_vertex.S \ - X86/x86_xform2.S \ - X86/x86_xform3.S \ - X86/x86_xform4.S \ - -x3dnow_files = \ - X86/3dnow_normal.S \ - X86/3dnow_vertex.S \ - X86/3dnow_xform1.S \ - X86/3dnow_xform2.S \ - X86/3dnow_xform3.S \ - X86/3dnow_xform4.S - -sse_files = \ - X86/sse_normal.S \ - X86/sse_vertex.S \ - X86/sse_xform1.S \ - X86/sse_xform2.S \ - X86/sse_xform3.S \ - X86/sse_xform4.S - -mmx_files = X86/mmx_blend.S - -X86_OBJNAME = $(MESA_LIBDIR)/objMesaX86.o - -##### UGL ##### - -UGL_SOURCES = \ - windml/ugl_api.c \ - windml/ugl_dd.c \ - windml/ugl_span.c \ - windml/ugl_line.c \ - windml/ugl_tri.c \ - windml/tornado/torMesaUGLInit.c - -UGL_OBJECTS = $(UGL_SOURCES:.c=.o) -UGL_OBJNAME = $(MESA_LIBDIR)/objMesaUGL.o - -##### OS ##### - -OS_SOURCES = OSmesa/osmesa.c windml/tornado/torMesaOSInit.c -OS_OBJECTS = $(OS_SOURCES:.c=.o) -OS_OBJNAME = $(MESA_LIBDIR)/objMesaOS.o - -##### GLUTSHAPES ##### - -GLUTSHAPES_SOURCES = \ - windml/ugl_glutshapes.c \ - windml/tornado/torGLUTShapesInit.c - -GLUTSHAPES_OBJECTS = $(GLUTSHAPES_SOURCES:.c=.o) -GLUTSHAPES_OBJNAME = $(MESA_LIBDIR)/objGLUTShapes.o - -SOURCES = $(GL_SOURCES) $(UGL_SOURCES) $(OS_SOURCES) \ - $(GLUTSHAPES_SOURCES) - -##### TARGETS ##### - -all: depend.$(CPU)$(TOOL) cfgX86 $(X86_OBJNAME) $(GL_OBJNAME)\ -$(UGL_OBJNAME) $(OS_OBJNAME) $(GLUTSHAPES_OBJNAME) - -#histogram.o: -# $(CC) $(CFLAGS) -O1 $(OPTION_OBJECT_ONLY) $(OPTION_OBJECT_NAME)$@ $< - -#image.o: -# $(CC) $(CFLAGS) -O1 $(OPTION_OBJECT_ONLY) $(OPTION_OBJECT_NAME)$@ $< - -cfgX86: -ifdef HAVE_3DNOW -x3dnow_sources = $(x3dnow_files) -CFLAGS_3DNOW = -DUSE_3DNOW_ASM -HAVE_X86 = 1 -endif -ifdef HAVE_SSE -sse_sources = $(sse_files) -CFLAGS_SSE = -DUSE_SSE_ASM -HAVE_X86 = 1 -endif -ifdef HAVE_MMX -mmx_sources = $(mmx_files) -CFLAGS_MMX = -DUSE_MMX_ASM -HAVE_X86 = 1 -endif -ifdef HAVE_X86 -x86_sources = $(x86_files) -CFLAGS_X86 = -DUSE_X86_ASM -endif -X86_SOURCES = $(x86_sources) $(mmx_sources) \ - $(x3dnow_sources) $(sse_sources) -X86_OBJECTS = $(X86_SOURCES:.S=.o) -CFLAGS_USE_X86 = $(CFLAGS_3DNOW) $(CFLAGS_SSE) $(CFLAGS_MMX) $(CFLAGS_X86) - -#X86/matypes.h: mtypes.h tnl/t_context.h X86/gen_matypes.c -# $(CC) -I ./ X86/gen_matypes.c -o X86/gen_matypes -# ./X86/gen_matypes > X86/matypes.h -# $(RM) X86/gen_matypes -# $(RM) X86/gen_matypes.o - -# Make the Mesax86 library -$(X86_OBJNAME): $(X86_OBJECTS) -ifdef HAVE_X86 -# $(LD) -r $(X86_OBJECTS) -o $(MESA_OBJNAME) - $(LD) -r $(X86_OBJECTS) -o $(X86_OBJNAME) -# $(AR) rus $(MESA_LIBNAME) $(X86_OBJNAME) -# $(RM) $(X86_OBJNAME) -endif - -# Make the GL library -$(GL_OBJNAME): $(GL_OBJECTS) -# $(LD) -r $(GL_OBJECTS) -o $(MESA_OBJNAME) - $(LD) -r $(GL_OBJECTS) -o $(GL_OBJNAME) -# $(AR) rus $(MESA_LIBNAME) $(GL_OBJNAME) -# $(AR) rus $(VX_LIBNAME) $(GL_OBJNAME) -# $(RM) $(GL_OBJNAME) - -# Make the UGLMesa library -$(UGL_OBJNAME): $(UGL_OBJECTS) -# $(LD) -r $(UGL_OBJECTS) -o $(MESA_OBJNAME) - $(LD) -r $(UGL_OBJECTS) -o $(UGL_OBJNAME) -# $(AR) rus $(MESA_LIBNAME) $(UGL_OBJNAME) -# $(AR) rus $(VX_LIBNAME) $(UGL_OBJNAME) -# $(RM) $(UGL_OBJNAME) - -# Make the OSMesa library -$(OS_OBJNAME): $(OS_OBJECTS) -# $(LD) -r $(OS_OBJECTS) -o $(MESA_OBJNAME) - $(LD) -r $(OS_OBJECTS) -o $(OS_OBJNAME) -# $(AR) rus $(MESA_LIBNAME) $(OS_OBJNAME) -# $(AR) rus $(VX_LIBNAME) $(OS_OBJNAME) -# $(RM) $(OS_OBJNAME) - -# Make the GLUT Shapes library -$(GLUTSHAPES_OBJNAME): $(GLUTSHAPES_OBJECTS) -# $(LD) -r $(GLUTSHAPES_OBJECTS) -o $(MESA_OBJNAME) - $(LD) -r $(GLUTSHAPES_OBJECTS) -o $(GLUTSHAPES_OBJNAME) -# $(AR) rus $(MESA_LIBNAME) $(GLUTSHAPES_OBJNAME) -# $(AR) rus $(VX_LIBNAME) $(GLUTSHAPES_OBJNAME) -# $(RM) $(GLUTSHAPES_OBJNAME) - -depend.$(CPU)$(TOOL): -ifeq ($(WIND_HOST_TYPE),x86-win32) - @ $(RM) $@ - @ $(ECHO) Creating depend.$(CPU)$(TOOL) -ifneq ($(SOURCES),) - @ for %f in ($(SOURCES)) do \ - $(CC) -MM $(CFLAGS) %f >>$@ -endif -else -Makefile - @ $(RM) $@ - @ $(ECHO) "Creating depend.$(CPU)$(TOOL)" -ifneq ($(SOURCES),) - @ for FILE in $(filter-out $(NODEPENDOBJS), $(SOURCES)); \ - do \ - $(CC) -MM $(CFLAGS) $$FILE \ - | $(TCL) $(BIN_DIR)/depend.tcl $(TGT_DIR) >>$@; \ - done -endif -endif - -.PHONY = clean - -clean: -# $(AR) d $(MESA_LIBNAME) $(GL_OBJNAME) -# $(AR) d $(MESA_LIBNAME) $(UGL_OBJNAME) -# $(AR) d $(MESA_LIBNAME) $(OS_OBJNAME) -# $(AR) d $(MESA_LIBNAME) $(GLUTSHAPES_OBJNAME) -# $(AR) d $(VX_LIBNAME) $(GL_OBJNAME) -# $(AR) d $(VX_LIBNAME) $(UGL_OBJNAME) -# $(AR) d $(VX_LIBNAME) $(OS_OBJNAME) -# $(AR) d $(VX_LIBNAME) $(GLUTSHAPES_OBJNAME) - $(RM) $(GL_OBJECTS) - $(RM) $(UGL_OBJECTS) - $(RM) $(OS_OBJECTS) - $(RM) $(GLUTSHAPES_OBJECTS) - $(RM) $(GL_OBJNAME) - $(RM) $(UGL_OBJNAME) - $(RM) $(OS_OBJNAME) - $(RM) $(GLUTSHAPES_OBJNAME) - $(RM) depend.$(CPU)$(TOOL) - -include depend.$(CPU)$(TOOL) - diff --git a/nx-X11/extras/Mesa/src/mesa/main/Makefile.win b/nx-X11/extras/Mesa/src/mesa/main/Makefile.win deleted file mode 100644 index a27f44c11..000000000 --- a/nx-X11/extras/Mesa/src/mesa/main/Makefile.win +++ /dev/null @@ -1,208 +0,0 @@ -# Makefile for Win32 -# -# NOTE: the install target may overwrite important files in the system dirs -# Check first, before making the install target. -# -# This builds both the osmesa and Windows drivers. -# - -!include <win32.mak> - -TOP = .. -SUBDIRS = osmesa.dir - -CORE_SRCS = \ - api_loopback.c \ - api_noop.c \ - api_validate.c \ - accum.c \ - arbprogram.c \ - attrib.c \ - blend.c \ - bufferobj.c \ - buffers.c \ - clip.c \ - colortab.c \ - context.c \ - convolve.c \ - debug.c \ - depth.c \ - dispatch.c \ - dlist.c \ - drawpix.c \ - enable.c \ - enums.c \ - eval.c \ - extensions.c \ - feedback.c \ - fog.c \ - get.c \ - glapi.c \ - glthread.c \ - hash.c \ - hint.c \ - histogram.c \ - image.c \ - imports.c \ - light.c \ - lines.c \ - matrix.c \ - nvprogram.c \ - nvfragparse.c \ - nvvertexec.c \ - nvvertparse.c \ - pixel.c \ - points.c \ - polygon.c \ - rastpos.c \ - state.c \ - stencil.c \ - texcompress.c \ - texcompress_fxt1.c \ - texcompress_s3tc.c \ - teximage.c \ - texformat.c \ - texobj.c \ - texstate.c \ - texstore.c \ - varray.c \ - vtxfmt.c \ -# X86\x86.c \ -# X86\common_x86.c \ -# X86\3dnow.c \ -# X86\sse.c \ - math\m_debug_norm.c \ - math\m_debug_xform.c \ - math\m_eval.c \ - math\m_matrix.c \ - math\m_translate.c \ - math\m_vector.c \ - math\m_xform.c \ - array_cache\ac_context.c \ - array_cache\ac_import.c \ - swrast\s_aaline.c \ - swrast\s_aatriangle.c \ - swrast\s_accum.c \ - swrast\s_alpha.c \ - swrast\s_alphabuf.c \ - swrast\s_bitmap.c \ - swrast\s_blend.c \ - swrast\s_buffers.c \ - swrast\s_copypix.c \ - swrast\s_context.c \ - swrast\s_depth.c \ - swrast\s_drawpix.c \ - swrast\s_feedback.c \ - swrast\s_fog.c \ - swrast\s_imaging.c \ - swrast\s_lines.c \ - swrast\s_logic.c \ - swrast\s_masking.c \ - swrast\s_nvfragprog.c \ - swrast\s_pixeltex.c \ - swrast\s_points.c \ - swrast\s_readpix.c \ - swrast\s_span.c \ - swrast\s_stencil.c \ - swrast\s_texstore.c \ - swrast\s_texture.c \ - swrast\s_triangle.c \ - swrast\s_zoom.c \ - swrast_setup\ss_context.c \ - swrast_setup\ss_triangle.c \ - swrast_setup\ss_vb.c \ - tnl\t_array_api.c \ - tnl\t_array_import.c \ - tnl\t_context.c \ - tnl\t_eval_api.c \ - tnl\t_imm_alloc.c \ - tnl\t_imm_api.c \ - tnl\t_imm_debug.c \ - tnl\t_imm_dlist.c \ - tnl\t_imm_elt.c \ - tnl\t_imm_eval.c \ - tnl\t_imm_exec.c \ - tnl\t_imm_fixup.c \ - tnl\t_pipeline.c \ - tnl\t_vb_fog.c \ - tnl\t_vb_light.c \ - tnl\t_vb_normals.c \ - tnl\t_vb_points.c \ - tnl\t_vb_program.c \ - tnl\t_vb_render.c \ - tnl\t_vb_texgen.c \ - tnl\t_vb_texmat.c \ - tnl\t_vb_vertex.c - -DRIVER_SRCS = \ - Trace\tr_context.c \ - Trace\tr_control.c \ - Trace\tr_error.c \ - Trace\tr_support.c \ - Trace\tr_wrapper.c \ - Trace\tr_write.c \ - Windows\wgl.c \ - Windows\wmesa.c - -ASM_SRCS = - -SRCS = $(CORE_SRCS) $(DRIVER_SRCS) - -all : mesadll $(SUBDIRS) - -!include "$(TOP)/mesawin32.mak" - -mesadll : $(MESADLL) - -CFLAGS = $(cvarsdll) $(CFLAGS) -D_OPENGL32_ -DBUILD_GL32 -DNO_PARALLEL -DNO_STEREO -!IFNDEF NODEBUG -CFLAGS = $(CFLAGS) -DMESA_DEBUG -!ENDIF -LFLAGS = $(dlllflags) $(lcommon) $(LFLAGS) - -OBJS = $(ASM_SRCS:.S=.obj) $(CORE_SRCS:.c=.obj) $(DRIVER_SRCS:.c=.obj) -LIBS = winmm.lib $(guilibsdll) - -$(MESADLL) : $(OBJS) mesa.def - $(link) $(LFLAGS) -out:$(MESADLL) -def:mesa.def $(OBJS) $(LIBS) - @echo "copying Mesa dynamic link library to lib directory..." - -copy $(MESADLL) ..\lib - @echo "copying Mesa import library to lib directory..." - -copy $(MESALIB) ..\lib - -$(SUBDIRS) : - @echo. - @echo Making in $* directory - @cd $* - @nmake -f Makefile.win -nologo - @cd .. - -install : $(MESADLL) - @echo. - @echo "copying Mesa dynamic link library to system directory..." - -copy $(MESADLL) $(DLLINSTALL) - @echo "copying Mesa header files to include directory..." - -copy ..\..\include\GL\gl.h $(INCLUDEINSTALL) - -copy ..\..\include\GL\glext.h $(INCLUDEINSTALL) - @echo "copying Mesa import library to library directory..." - -copy $(MESALIB) $(LIBINSTALL) - -clean :: - @del /f tnl\*.obj - @del /f swrast_setup\*.obj - @del /f math\*.obj - @del /f array_cache\*.obj - @del /f swrast\*.obj - @del /f Trace\*.obj - @del /f osmesa\*.obj - @del /f Windows\*.obj - -clobber :: - @del /f OSmesa\*.lib - @del /f OSmesa\*.exp - @del /f OSmesa\*.dll - -# override default inference rule with one that writes the object to -# the same subdir that the c file is in. -.c.obj : - $(cc) $(CFLAGS) -I. $< /Fo$*.obj diff --git a/nx-X11/extras/Mesa/src/mesa/main/WSDrawBuffer.h.NX.original b/nx-X11/extras/Mesa/src/mesa/main/WSDrawBuffer.h.NX.original deleted file mode 100644 index b4d805d6d..000000000 --- a/nx-X11/extras/Mesa/src/mesa/main/WSDrawBuffer.h.NX.original +++ /dev/null @@ -1,24 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine, http://www.nomachine.com/. */ -/* */ -/* NXAGENT, NX protocol compression and NX extensions to this software */ -/* are copyright of NoMachine. Redistribution and use of the present */ -/* software is allowed according to terms specified in the file LICENSE */ -/* which comes in the source distribution. */ -/* */ -/* Check http://www.nomachine.com/licensing.html for applicability. */ -/* */ -/* NX and NoMachine are trademarks of Medialogic S.p.A. */ -/* */ -/* All rights reserved. */ -/* */ -/**************************************************************************/ - -typedef struct _WSDrawBufferRec { - GLframebuffer *DrawBuffer; - struct _WSDrawBufferRec *next; -} WSDrawBufferRec, *WSDrawBufferPtr; - -WSDrawBufferPtr pWSDrawBuffer; - diff --git a/nx-X11/extras/Mesa/src/mesa/main/context.c.NX.original b/nx-X11/extras/Mesa/src/mesa/main/context.c.NX.original deleted file mode 100644 index eb4b4ce4e..000000000 --- a/nx-X11/extras/Mesa/src/mesa/main/context.c.NX.original +++ /dev/null @@ -1,1818 +0,0 @@ -/** - * \file context.c - * Mesa context/visual/framebuffer management functions. - * \author Brian Paul - */ - -/* - * Mesa 3-D graphics library - * Version: 6.4 - * - * Copyright (C) 1999-2005 Brian Paul All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - - -/** - * \mainpage Mesa Main Module - * - * \section MainIntroduction Introduction - * - * The Mesa Main module consists of all the files in the main/ directory. - * Among the features of this module are: - * <UL> - * <LI> Structures to represent most GL state </LI> - * <LI> State set/get functions </LI> - * <LI> Display lists </LI> - * <LI> Texture unit, object and image handling </LI> - * <LI> Matrix and attribute stacks </LI> - * </UL> - * - * Other modules are responsible for API dispatch, vertex transformation, - * point/line/triangle setup, rasterization, vertex array caching, - * vertex/fragment programs/shaders, etc. - * - * - * \section AboutDoxygen About Doxygen - * - * If you're viewing this information as Doxygen-generated HTML you'll - * see the documentation index at the top of this page. - * - * The first line lists the Mesa source code modules. - * The second line lists the indexes available for viewing the documentation - * for each module. - * - * Selecting the <b>Main page</b> link will display a summary of the module - * (this page). - * - * Selecting <b>Data Structures</b> will list all C structures. - * - * Selecting the <b>File List</b> link will list all the source files in - * the module. - * Selecting a filename will show a list of all functions defined in that file. - * - * Selecting the <b>Data Fields</b> link will display a list of all - * documented structure members. - * - * Selecting the <b>Globals</b> link will display a list - * of all functions, structures, global variables and macros in the module. - * - */ - - -#include "glheader.h" -#include "imports.h" -#include "accum.h" -#include "attrib.h" -#include "blend.h" -#include "buffers.h" -#include "bufferobj.h" -#include "colortab.h" -#include "context.h" -#include "debug.h" -#include "depth.h" -#include "dlist.h" -#include "eval.h" -#include "enums.h" -#include "extensions.h" -#include "fbobject.h" -#include "feedback.h" -#include "fog.h" -#include "get.h" -#include "glthread.h" -#include "glapioffsets.h" -#include "histogram.h" -#include "hint.h" -#include "hash.h" -#include "light.h" -#include "lines.h" -#include "macros.h" -#include "matrix.h" -#include "occlude.h" -#include "pixel.h" -#include "points.h" -#include "polygon.h" -#if FEATURE_NV_vertex_program || FEATURE_NV_fragment_program -#include "program.h" -#endif -#include "rastpos.h" -#include "simple_list.h" -#include "state.h" -#include "stencil.h" -#include "texcompress.h" -#include "teximage.h" -#include "texobj.h" -#include "texstate.h" -#include "mtypes.h" -#include "varray.h" -#include "version.h" -#include "vtxfmt.h" -#if _HAVE_FULL_GL -#include "math/m_translate.h" -#include "math/m_matrix.h" -#include "math/m_xform.h" -#include "math/mathmod.h" -#endif -#include "shaderobjects.h" - -#ifdef NXAGENT_SERVER -#include "WSDrawBuffer.h" -#endif - -#ifdef USE_SPARC_ASM -#include "sparc/sparc.h" -#endif - -#ifndef MESA_VERBOSE -int MESA_VERBOSE = 0; -#endif - -#ifndef MESA_DEBUG_FLAGS -int MESA_DEBUG_FLAGS = 0; -#endif - -#ifdef NXAGENT_SERVER -extern WSDrawBufferPtr pWSDrawBuffer; - -int IsWSDrawBuffer(GLframebuffer *mesa_buffer) -{ - WSDrawBufferPtr p = pWSDrawBuffer; - - while (p != NULL) { - if (p -> DrawBuffer == mesa_buffer) { - return 1; - } - p = p -> next; - } - return 0; -} - -void FreeWSDrawBuffer(GLframebuffer *mesa_buffer) -{ - WSDrawBufferPtr p = pWSDrawBuffer; - WSDrawBufferPtr pOld = NULL; - - if (p == NULL) - return; - - if (p -> DrawBuffer == mesa_buffer) { - pWSDrawBuffer = p -> next; - free(p); - return; - } - - while (p -> next != NULL) { - if (p -> next -> DrawBuffer == mesa_buffer) { - pOld = p -> next; - p -> next = p -> next -> next; - free(pOld); - return; - } - p = p -> next; - } -} -#endif - -/* ubyte -> float conversion */ -GLfloat _mesa_ubyte_to_float_color_tab[256]; - -static void -free_shared_state( GLcontext *ctx, struct gl_shared_state *ss ); - - -/**********************************************************************/ -/** \name OpenGL SI-style interface (new in Mesa 3.5) - * - * \if subset - * \note Most of these functions are never called in the Mesa subset. - * \endif - */ -/*@{*/ - -/** - * Destroy context callback. - * - * \param gc context. - * \return GL_TRUE on success, or GL_FALSE on failure. - * - * \ifnot subset - * Called by window system/device driver (via __GLexports::destroyCurrent) when - * the rendering context is to be destroyed. - * \endif - * - * Frees the context data and the context structure. - */ -GLboolean -_mesa_destroyContext(__GLcontext *gc) -{ - if (gc) { - _mesa_free_context_data(gc); - _mesa_free(gc); - } - return GL_TRUE; -} - -/** - * Unbind context callback. - * - * \param gc context. - * \return GL_TRUE on success, or GL_FALSE on failure. - * - * \ifnot subset - * Called by window system/device driver (via __GLexports::loseCurrent) - * when the rendering context is made non-current. - * \endif - * - * No-op - */ -GLboolean -_mesa_loseCurrent(__GLcontext *gc) -{ - /* XXX unbind context from thread */ - (void) gc; - return GL_TRUE; -} - -/** - * Bind context callback. - * - * \param gc context. - * \return GL_TRUE on success, or GL_FALSE on failure. - * - * \ifnot subset - * Called by window system/device driver (via __GLexports::makeCurrent) - * when the rendering context is made current. - * \endif - * - * No-op - */ -GLboolean -_mesa_makeCurrent(__GLcontext *gc) -{ - /* XXX bind context to thread */ - (void) gc; - return GL_TRUE; -} - -/** - * Share context callback. - * - * \param gc context. - * \param gcShare shared context. - * \return GL_TRUE on success, or GL_FALSE on failure. - * - * \ifnot subset - * Called by window system/device driver (via __GLexports::shareContext) - * \endif - * - * Update the shared context reference count, gl_shared_state::RefCount. - */ -GLboolean -_mesa_shareContext(__GLcontext *gc, __GLcontext *gcShare) -{ - if (gc && gcShare && gc->Shared && gcShare->Shared) { - gc->Shared->RefCount--; - if (gc->Shared->RefCount == 0) { - free_shared_state(gc, gc->Shared); - } - gc->Shared = gcShare->Shared; - gc->Shared->RefCount++; - return GL_TRUE; - } - else { - return GL_FALSE; - } -} - - -#if _HAVE_FULL_GL -/** - * Copy context callback. - */ -GLboolean -_mesa_copyContext(__GLcontext *dst, const __GLcontext *src, GLuint mask) -{ - if (dst && src) { - _mesa_copy_context( src, dst, mask ); - return GL_TRUE; - } - else { - return GL_FALSE; - } -} -#endif - -/** No-op */ -GLboolean -_mesa_forceCurrent(__GLcontext *gc) -{ - (void) gc; - return GL_TRUE; -} - -/** - * Windows/buffer resizing notification callback. - * - * \param gc GL context. - * \return GL_TRUE on success, or GL_FALSE on failure. - */ -GLboolean -_mesa_notifyResize(__GLcontext *gc) -{ - GLint x, y; - GLuint width, height; - __GLdrawablePrivate *d = gc->imports.getDrawablePrivate(gc); - if (!d || !d->getDrawableSize) - return GL_FALSE; - d->getDrawableSize( d, &x, &y, &width, &height ); - /* update viewport, resize software buffers, etc. */ - return GL_TRUE; -} - -/** - * Window/buffer destruction notification callback. - * - * \param gc GL context. - * - * Called when the context's window/buffer is going to be destroyed. - * - * No-op - */ -void -_mesa_notifyDestroy(__GLcontext *gc) -{ - /* Unbind from it. */ - (void) gc; -} - -/** - * Swap buffers notification callback. - * - * \param gc GL context. - * - * Called by window system just before swapping buffers. - * We have to finish any pending rendering. - */ -void -_mesa_notifySwapBuffers(__GLcontext *gc) -{ - FLUSH_VERTICES( gc, 0 ); -} - -/** No-op */ -struct __GLdispatchStateRec * -_mesa_dispatchExec(__GLcontext *gc) -{ - (void) gc; - return NULL; -} - -/** No-op */ -void -_mesa_beginDispatchOverride(__GLcontext *gc) -{ - (void) gc; -} - -/** No-op */ -void -_mesa_endDispatchOverride(__GLcontext *gc) -{ - (void) gc; -} - -/** - * \ifnot subset - * Setup the exports. - * - * The window system will call these functions when it needs Mesa to do - * something. - * - * \note Device drivers should override these functions! For example, - * the Xlib driver should plug in the XMesa*-style functions into this - * structure. The XMesa-style functions should then call the _mesa_* - * version of these functions. This is an approximation to OO design - * (inheritance and virtual functions). - * \endif - * - * \if subset - * No-op. - * - * \endif - */ -static void -_mesa_init_default_exports(__GLexports *exports) -{ -#if _HAVE_FULL_GL - exports->destroyContext = _mesa_destroyContext; - exports->loseCurrent = _mesa_loseCurrent; - exports->makeCurrent = _mesa_makeCurrent; - exports->shareContext = _mesa_shareContext; - exports->copyContext = _mesa_copyContext; - exports->forceCurrent = _mesa_forceCurrent; - exports->notifyResize = _mesa_notifyResize; - exports->notifyDestroy = _mesa_notifyDestroy; - exports->notifySwapBuffers = _mesa_notifySwapBuffers; - exports->dispatchExec = _mesa_dispatchExec; - exports->beginDispatchOverride = _mesa_beginDispatchOverride; - exports->endDispatchOverride = _mesa_endDispatchOverride; -#else - (void) exports; -#endif -} - -/** - * Exported OpenGL SI interface. - */ -__GLcontext * -__glCoreCreateContext(__GLimports *imports, __GLcontextModes *modes) -{ - GLcontext *ctx; - - ctx = (GLcontext *) (*imports->calloc)(NULL, 1, sizeof(GLcontext)); - if (ctx == NULL) { - return NULL; - } - - /* XXX doesn't work at this time */ - _mesa_initialize_context(ctx, modes, NULL, NULL, NULL); - ctx->imports = *imports; - - return ctx; -} - -/** - * Exported OpenGL SI interface. - */ -void -__glCoreNopDispatch(void) -{ -#if 0 - /* SI */ - __gl_dispatch = __glNopDispatchState; -#else - /* Mesa */ - _glapi_set_dispatch(NULL); -#endif -} - -/*@}*/ - - -/**********************************************************************/ -/** \name GL Visual allocation/destruction */ -/**********************************************************************/ -/*@{*/ - -/** - * Allocates a GLvisual structure and initializes it via - * _mesa_initialize_visual(). - * - * \param rgbFlag GL_TRUE for RGB(A) mode, GL_FALSE for Color Index mode. - * \param dbFlag double buffering - * \param stereoFlag stereo buffer - * \param depthBits requested bits per depth buffer value. Any value in [0, 32] - * is acceptable but the actual depth type will be GLushort or GLuint as - * needed. - * \param stencilBits requested minimum bits per stencil buffer value - * \param accumRedBits, accumGreenBits, accumBlueBits, accumAlphaBits number of bits per color component in accum buffer. - * \param indexBits number of bits per pixel if \p rgbFlag is GL_FALSE - * \param redBits number of bits per color component in frame buffer for RGB(A) - * mode. We always use 8 in core Mesa though. - * \param greenBits same as above. - * \param blueBits same as above. - * \param alphaBits same as above. - * \param numSamples not really used. - * - * \return pointer to new GLvisual or NULL if requested parameters can't be - * met. - * - * \note Need to add params for level and numAuxBuffers (at least) - */ -GLvisual * -_mesa_create_visual( GLboolean rgbFlag, - GLboolean dbFlag, - GLboolean stereoFlag, - GLint redBits, - GLint greenBits, - GLint blueBits, - GLint alphaBits, - GLint indexBits, - GLint depthBits, - GLint stencilBits, - GLint accumRedBits, - GLint accumGreenBits, - GLint accumBlueBits, - GLint accumAlphaBits, - GLint numSamples ) -{ - GLvisual *vis = (GLvisual *) CALLOC( sizeof(GLvisual) ); - if (vis) { - if (!_mesa_initialize_visual(vis, rgbFlag, dbFlag, stereoFlag, - redBits, greenBits, blueBits, alphaBits, - indexBits, depthBits, stencilBits, - accumRedBits, accumGreenBits, - accumBlueBits, accumAlphaBits, - numSamples)) { - FREE(vis); - return NULL; - } - } - return vis; -} - -/** - * Makes some sanity checks and fills in the fields of the - * GLvisual object with the given parameters. If the caller needs - * to set additional fields, he should just probably init the whole GLvisual - * object himself. - * \return GL_TRUE on success, or GL_FALSE on failure. - * - * \sa _mesa_create_visual() above for the parameter description. - */ -GLboolean -_mesa_initialize_visual( GLvisual *vis, - GLboolean rgbFlag, - GLboolean dbFlag, - GLboolean stereoFlag, - GLint redBits, - GLint greenBits, - GLint blueBits, - GLint alphaBits, - GLint indexBits, - GLint depthBits, - GLint stencilBits, - GLint accumRedBits, - GLint accumGreenBits, - GLint accumBlueBits, - GLint accumAlphaBits, - GLint numSamples ) -{ - assert(vis); - - if (depthBits < 0 || depthBits > 32) { - return GL_FALSE; - } - if (stencilBits < 0 || stencilBits > STENCIL_BITS) { - return GL_FALSE; - } - if (accumRedBits < 0 || accumRedBits > ACCUM_BITS) { - return GL_FALSE; - } - if (accumGreenBits < 0 || accumGreenBits > ACCUM_BITS) { - return GL_FALSE; - } - if (accumBlueBits < 0 || accumBlueBits > ACCUM_BITS) { - return GL_FALSE; - } - if (accumAlphaBits < 0 || accumAlphaBits > ACCUM_BITS) { - return GL_FALSE; - } - - vis->rgbMode = rgbFlag; - vis->doubleBufferMode = dbFlag; - vis->stereoMode = stereoFlag; - - vis->redBits = redBits; - vis->greenBits = greenBits; - vis->blueBits = blueBits; - vis->alphaBits = alphaBits; - vis->rgbBits = redBits + greenBits + blueBits; - - vis->indexBits = indexBits; - vis->depthBits = depthBits; - vis->stencilBits = stencilBits; - - vis->accumRedBits = accumRedBits; - vis->accumGreenBits = accumGreenBits; - vis->accumBlueBits = accumBlueBits; - vis->accumAlphaBits = accumAlphaBits; - - vis->haveAccumBuffer = accumRedBits > 0; - vis->haveDepthBuffer = depthBits > 0; - vis->haveStencilBuffer = stencilBits > 0; - - vis->numAuxBuffers = 0; - vis->level = 0; - vis->pixmapMode = 0; - vis->sampleBuffers = numSamples > 0 ? 1 : 0; - vis->samples = numSamples; - - return GL_TRUE; -} - - -/** - * Destroy a visual and free its memory. - * - * \param vis visual. - * - * Frees the visual structure. - */ -void -_mesa_destroy_visual( GLvisual *vis ) -{ - FREE(vis); -} - -/*@}*/ - - -/**********************************************************************/ -/** \name Context allocation, initialization, destroying - * - * The purpose of the most initialization functions here is to provide the - * default state values according to the OpenGL specification. - */ -/**********************************************************************/ -/*@{*/ - -/** - * One-time initialization mutex lock. - * - * \sa Used by one_time_init(). - */ -_glthread_DECLARE_STATIC_MUTEX(OneTimeLock); - -/** - * Calls all the various one-time-init functions in Mesa. - * - * While holding a global mutex lock, calls several initialization functions, - * and sets the glapi callbacks if the \c MESA_DEBUG environment variable is - * defined. - * - * \sa _mesa_init_lists(), _math_init(). - */ -static void -one_time_init( GLcontext *ctx ) -{ - static GLboolean alreadyCalled = GL_FALSE; - (void) ctx; - _glthread_LOCK_MUTEX(OneTimeLock); - if (!alreadyCalled) { - GLuint i; - - /* do some implementation tests */ - assert( sizeof(GLbyte) == 1 ); - assert( sizeof(GLubyte) == 1 ); - assert( sizeof(GLshort) == 2 ); - assert( sizeof(GLushort) == 2 ); - assert( sizeof(GLint) == 4 ); - assert( sizeof(GLuint) == 4 ); - - _mesa_init_lists(); - -#if _HAVE_FULL_GL - _math_init(); - - for (i = 0; i < 256; i++) { - _mesa_ubyte_to_float_color_tab[i] = (float) i / 255.0F; - } -#endif - -#ifdef USE_SPARC_ASM - _mesa_init_sparc_glapi_relocs(); -#endif - if (_mesa_getenv("MESA_DEBUG")) { - _glapi_noop_enable_warnings(GL_TRUE); - _glapi_set_warning_func( (_glapi_warning_func) _mesa_warning ); - } - else { - _glapi_noop_enable_warnings(GL_FALSE); - } - -#if defined(DEBUG) && defined(__DATE__) && defined(__TIME__) - _mesa_debug(ctx, "Mesa %s DEBUG build %s %s\n", - MESA_VERSION_STRING, __DATE__, __TIME__); -#endif - - alreadyCalled = GL_TRUE; - } - _glthread_UNLOCK_MUTEX(OneTimeLock); -} - - -/** - * Allocate and initialize a shared context state structure. - * Initializes the display list, texture objects and vertex programs hash - * tables, allocates the texture objects. If it runs out of memory, frees - * everything already allocated before returning NULL. - * - * \return pointer to a gl_shared_state structure on success, or NULL on - * failure. - */ -static GLboolean -alloc_shared_state( GLcontext *ctx ) -{ - struct gl_shared_state *ss = CALLOC_STRUCT(gl_shared_state); - if (!ss) - return GL_FALSE; - - ctx->Shared = ss; - - _glthread_INIT_MUTEX(ss->Mutex); - - ss->DisplayList = _mesa_NewHashTable(); - ss->TexObjects = _mesa_NewHashTable(); -#if FEATURE_NV_vertex_program || FEATURE_NV_fragment_program - ss->Programs = _mesa_NewHashTable(); -#endif - -#if FEATURE_ARB_vertex_program - ss->DefaultVertexProgram = ctx->Driver.NewProgram(ctx, GL_VERTEX_PROGRAM_ARB, 0); - if (!ss->DefaultVertexProgram) - goto cleanup; -#endif -#if FEATURE_ARB_fragment_program - ss->DefaultFragmentProgram = ctx->Driver.NewProgram(ctx, GL_FRAGMENT_PROGRAM_ARB, 0); - if (!ss->DefaultFragmentProgram) - goto cleanup; -#endif -#if FEATURE_ATI_fragment_shader - ss->DefaultFragmentShader = ctx->Driver.NewProgram(ctx, GL_FRAGMENT_SHADER_ATI, 0); - if (!ss->DefaultFragmentShader) - goto cleanup; -#endif - - ss->BufferObjects = _mesa_NewHashTable(); - - ss->GL2Objects = _mesa_NewHashTable (); - - ss->Default1D = (*ctx->Driver.NewTextureObject)(ctx, 0, GL_TEXTURE_1D); - if (!ss->Default1D) - goto cleanup; - - ss->Default2D = (*ctx->Driver.NewTextureObject)(ctx, 0, GL_TEXTURE_2D); - if (!ss->Default2D) - goto cleanup; - - ss->Default3D = (*ctx->Driver.NewTextureObject)(ctx, 0, GL_TEXTURE_3D); - if (!ss->Default3D) - goto cleanup; - - ss->DefaultCubeMap = (*ctx->Driver.NewTextureObject)(ctx, 0, GL_TEXTURE_CUBE_MAP_ARB); - if (!ss->DefaultCubeMap) - goto cleanup; - - ss->DefaultRect = (*ctx->Driver.NewTextureObject)(ctx, 0, GL_TEXTURE_RECTANGLE_NV); - if (!ss->DefaultRect) - goto cleanup; - - /* Effectively bind the default textures to all texture units */ - ss->Default1D->RefCount += MAX_TEXTURE_IMAGE_UNITS; - ss->Default2D->RefCount += MAX_TEXTURE_IMAGE_UNITS; - ss->Default3D->RefCount += MAX_TEXTURE_IMAGE_UNITS; - ss->DefaultCubeMap->RefCount += MAX_TEXTURE_IMAGE_UNITS; - ss->DefaultRect->RefCount += MAX_TEXTURE_IMAGE_UNITS; - -#if FEATURE_EXT_framebuffer_object - ss->FrameBuffers = _mesa_NewHashTable(); - if (!ss->FrameBuffers) - goto cleanup; - ss->RenderBuffers = _mesa_NewHashTable(); - if (!ss->RenderBuffers) - goto cleanup; -#endif - - - return GL_TRUE; - - cleanup: - /* Ran out of memory at some point. Free everything and return NULL */ - if (ss->DisplayList) - _mesa_DeleteHashTable(ss->DisplayList); - if (ss->TexObjects) - _mesa_DeleteHashTable(ss->TexObjects); -#if FEATURE_NV_vertex_program - if (ss->Programs) - _mesa_DeleteHashTable(ss->Programs); -#endif -#if FEATURE_ARB_vertex_program - if (ss->DefaultVertexProgram) - ctx->Driver.DeleteProgram(ctx, ss->DefaultVertexProgram); -#endif -#if FEATURE_ARB_fragment_program - if (ss->DefaultFragmentProgram) - ctx->Driver.DeleteProgram(ctx, ss->DefaultFragmentProgram); -#endif -#if FEATURE_ATI_fragment_shader - if (ss->DefaultFragmentShader) - ctx->Driver.DeleteProgram(ctx, ss->DefaultFragmentShader); -#endif -#if FEATURE_ARB_vertex_buffer_object - if (ss->BufferObjects) - _mesa_DeleteHashTable(ss->BufferObjects); -#endif - - if (ss->GL2Objects) - _mesa_DeleteHashTable (ss->GL2Objects); - -#if FEATURE_EXT_framebuffer_object - if (ss->FrameBuffers) - _mesa_DeleteHashTable(ss->FrameBuffers); - if (ss->RenderBuffers) - _mesa_DeleteHashTable(ss->RenderBuffers); -#endif - - if (ss->Default1D) - (*ctx->Driver.DeleteTexture)(ctx, ss->Default1D); - if (ss->Default2D) - (*ctx->Driver.DeleteTexture)(ctx, ss->Default2D); - if (ss->Default3D) - (*ctx->Driver.DeleteTexture)(ctx, ss->Default3D); - if (ss->DefaultCubeMap) - (*ctx->Driver.DeleteTexture)(ctx, ss->DefaultCubeMap); - if (ss->DefaultRect) - (*ctx->Driver.DeleteTexture)(ctx, ss->DefaultRect); - if (ss) - _mesa_free(ss); - return GL_FALSE; -} - -/** - * Deallocate a shared state context and all children structures. - * - * \param ctx GL context. - * \param ss shared state pointer. - * - * Frees the display lists, the texture objects (calling the driver texture - * deletion callback to free its private data) and the vertex programs, as well - * as their hash tables. - * - * \sa alloc_shared_state(). - */ -static void -free_shared_state( GLcontext *ctx, struct gl_shared_state *ss ) -{ - /* Free display lists */ - while (1) { - GLuint list = _mesa_HashFirstEntry(ss->DisplayList); - if (list) { - _mesa_destroy_list(ctx, list); - } - else { - break; - } - } - _mesa_DeleteHashTable(ss->DisplayList); - - /* Free texture objects */ - ASSERT(ctx->Driver.DeleteTexture); - /* the default textures */ - (*ctx->Driver.DeleteTexture)(ctx, ss->Default1D); - (*ctx->Driver.DeleteTexture)(ctx, ss->Default2D); - (*ctx->Driver.DeleteTexture)(ctx, ss->Default3D); - (*ctx->Driver.DeleteTexture)(ctx, ss->DefaultCubeMap); - (*ctx->Driver.DeleteTexture)(ctx, ss->DefaultRect); - /* all other textures */ - while (1) { - GLuint texName = _mesa_HashFirstEntry(ss->TexObjects); - if (texName) { - struct gl_texture_object *texObj = (struct gl_texture_object *) - _mesa_HashLookup(ss->TexObjects, texName); - ASSERT(texObj); - (*ctx->Driver.DeleteTexture)(ctx, texObj); - _mesa_HashRemove(ss->TexObjects, texName); - } - else { - break; - } - } - _mesa_DeleteHashTable(ss->TexObjects); - -#if FEATURE_NV_vertex_program - /* Free vertex programs */ - while (1) { - GLuint prog = _mesa_HashFirstEntry(ss->Programs); - if (prog) { - struct program *p = (struct program *) _mesa_HashLookup(ss->Programs, - prog); - ASSERT(p); - ctx->Driver.DeleteProgram(ctx, p); - _mesa_HashRemove(ss->Programs, prog); - } - else { - break; - } - } - _mesa_DeleteHashTable(ss->Programs); -#endif -#if FEATURE_ARB_vertex_program - _mesa_delete_program(ctx, ss->DefaultVertexProgram); -#endif -#if FEATURE_ARB_fragment_program - _mesa_delete_program(ctx, ss->DefaultFragmentProgram); -#endif -#if FEATURE_ATI_fragment_shader - _mesa_delete_program(ctx, ss->DefaultFragmentShader); -#endif - -#if FEATURE_ARB_vertex_buffer_object - _mesa_DeleteHashTable(ss->BufferObjects); -#endif - - _mesa_DeleteHashTable (ss->GL2Objects); - -#if FEATURE_EXT_framebuffer_object - _mesa_DeleteHashTable(ss->FrameBuffers); - _mesa_DeleteHashTable(ss->RenderBuffers); -#endif - - _glthread_DESTROY_MUTEX(ss->Mutex); - - FREE(ss); -} - - -/** - * Initialize fields of gl_current_attrib (aka ctx->Current.*) - */ -static void -_mesa_init_current( GLcontext *ctx ) -{ - GLuint i; - - /* Current group */ - for (i = 0; i < VERT_ATTRIB_MAX; i++) { - ASSIGN_4V( ctx->Current.Attrib[i], 0.0, 0.0, 0.0, 1.0 ); - } - /* special cases: */ - ASSIGN_4V( ctx->Current.Attrib[VERT_ATTRIB_WEIGHT], 1.0, 0.0, 0.0, 1.0 ); - ASSIGN_4V( ctx->Current.Attrib[VERT_ATTRIB_NORMAL], 0.0, 0.0, 1.0, 1.0 ); - ASSIGN_4V( ctx->Current.Attrib[VERT_ATTRIB_COLOR0], 1.0, 1.0, 1.0, 1.0 ); - ASSIGN_4V( ctx->Current.Attrib[VERT_ATTRIB_COLOR1], 0.0, 0.0, 0.0, 1.0 ); - ASSIGN_4V( ctx->Current.Attrib[VERT_ATTRIB_FOG], 0.0, 0.0, 0.0, 0.0 ); - - ctx->Current.Index = 1; - ctx->Current.EdgeFlag = GL_TRUE; -} - - -/** - * Initialize fields of gl_constants (aka ctx->Const.*). - * Use defaults from config.h. The device drivers will often override - * some of these values (such as number of texture units). - */ -static void -_mesa_init_constants( GLcontext *ctx ) -{ - assert(ctx); - - assert(MAX_TEXTURE_LEVELS >= MAX_3D_TEXTURE_LEVELS); - assert(MAX_TEXTURE_LEVELS >= MAX_CUBE_TEXTURE_LEVELS); - - /* Constants, may be overriden (usually only reduced) by device drivers */ - ctx->Const.MaxTextureLevels = MAX_TEXTURE_LEVELS; - ctx->Const.Max3DTextureLevels = MAX_3D_TEXTURE_LEVELS; - ctx->Const.MaxCubeTextureLevels = MAX_CUBE_TEXTURE_LEVELS; - ctx->Const.MaxTextureRectSize = MAX_TEXTURE_RECT_SIZE; - ctx->Const.MaxTextureUnits = MAX_TEXTURE_UNITS; - ctx->Const.MaxTextureCoordUnits = MAX_TEXTURE_COORD_UNITS; - ctx->Const.MaxTextureImageUnits = MAX_TEXTURE_IMAGE_UNITS; - ctx->Const.MaxTextureMaxAnisotropy = MAX_TEXTURE_MAX_ANISOTROPY; - ctx->Const.MaxTextureLodBias = MAX_TEXTURE_LOD_BIAS; - ctx->Const.MaxArrayLockSize = MAX_ARRAY_LOCK_SIZE; - ctx->Const.SubPixelBits = SUB_PIXEL_BITS; - ctx->Const.MinPointSize = MIN_POINT_SIZE; - ctx->Const.MaxPointSize = MAX_POINT_SIZE; - ctx->Const.MinPointSizeAA = MIN_POINT_SIZE; - ctx->Const.MaxPointSizeAA = MAX_POINT_SIZE; - ctx->Const.PointSizeGranularity = (GLfloat) POINT_SIZE_GRANULARITY; - ctx->Const.MinLineWidth = MIN_LINE_WIDTH; - ctx->Const.MaxLineWidth = MAX_LINE_WIDTH; - ctx->Const.MinLineWidthAA = MIN_LINE_WIDTH; - ctx->Const.MaxLineWidthAA = MAX_LINE_WIDTH; - ctx->Const.LineWidthGranularity = (GLfloat) LINE_WIDTH_GRANULARITY; - ctx->Const.MaxColorTableSize = MAX_COLOR_TABLE_SIZE; - ctx->Const.MaxConvolutionWidth = MAX_CONVOLUTION_WIDTH; - ctx->Const.MaxConvolutionHeight = MAX_CONVOLUTION_HEIGHT; - ctx->Const.MaxClipPlanes = MAX_CLIP_PLANES; - ctx->Const.MaxLights = MAX_LIGHTS; - ctx->Const.MaxShininess = 128.0; - ctx->Const.MaxSpotExponent = 128.0; - ctx->Const.MaxViewportWidth = MAX_WIDTH; - ctx->Const.MaxViewportHeight = MAX_HEIGHT; -#if FEATURE_ARB_vertex_program - ctx->Const.MaxVertexProgramInstructions = MAX_NV_VERTEX_PROGRAM_INSTRUCTIONS; - ctx->Const.MaxVertexProgramAttribs = MAX_NV_VERTEX_PROGRAM_INPUTS; - ctx->Const.MaxVertexProgramTemps = MAX_NV_VERTEX_PROGRAM_TEMPS; - ctx->Const.MaxVertexProgramLocalParams = MAX_NV_VERTEX_PROGRAM_PARAMS; - ctx->Const.MaxVertexProgramEnvParams = MAX_NV_VERTEX_PROGRAM_PARAMS;/*XXX*/ - ctx->Const.MaxVertexProgramAddressRegs = MAX_VERTEX_PROGRAM_ADDRESS_REGS; -#endif -#if FEATURE_ARB_fragment_program - ctx->Const.MaxFragmentProgramInstructions = MAX_NV_FRAGMENT_PROGRAM_INSTRUCTIONS; - ctx->Const.MaxFragmentProgramAttribs = MAX_NV_FRAGMENT_PROGRAM_INPUTS; - ctx->Const.MaxFragmentProgramTemps = MAX_NV_FRAGMENT_PROGRAM_TEMPS; - ctx->Const.MaxFragmentProgramLocalParams = MAX_NV_FRAGMENT_PROGRAM_PARAMS; - ctx->Const.MaxFragmentProgramEnvParams = MAX_NV_FRAGMENT_PROGRAM_PARAMS;/*XXX*/ - ctx->Const.MaxFragmentProgramAddressRegs = MAX_FRAGMENT_PROGRAM_ADDRESS_REGS; - ctx->Const.MaxFragmentProgramAluInstructions = MAX_FRAGMENT_PROGRAM_ALU_INSTRUCTIONS; - ctx->Const.MaxFragmentProgramTexInstructions = MAX_FRAGMENT_PROGRAM_TEX_INSTRUCTIONS; - ctx->Const.MaxFragmentProgramTexIndirections = MAX_FRAGMENT_PROGRAM_TEX_INDIRECTIONS; -#endif - - ctx->Const.MaxProgramMatrices = MAX_PROGRAM_MATRICES; - ctx->Const.MaxProgramMatrixStackDepth = MAX_PROGRAM_MATRIX_STACK_DEPTH; - - /* If we're running in the X server, do bounds checking to prevent - * segfaults and server crashes! - */ -#if defined(XFree86LOADER) && defined(IN_MODULE) - ctx->Const.CheckArrayBounds = GL_TRUE; -#else - ctx->Const.CheckArrayBounds = GL_FALSE; -#endif - - ctx->Const.MaxDrawBuffers = MAX_DRAW_BUFFERS; - - /* GL_OES_read_format */ - ctx->Const.ColorReadFormat = GL_RGBA; - ctx->Const.ColorReadType = GL_UNSIGNED_BYTE; - -#if FEATURE_EXT_framebuffer_object - ctx->Const.MaxColorAttachments = MAX_COLOR_ATTACHMENTS; - ctx->Const.MaxRenderbufferSize = MAX_WIDTH; -#endif - - /* sanity checks */ - ASSERT(ctx->Const.MaxTextureUnits == MAX2(ctx->Const.MaxTextureImageUnits, ctx->Const.MaxTextureCoordUnits)); -} - - -/** - * Initialize the attribute groups in a GL context. - * - * \param ctx GL context. - * - * Initializes all the attributes, calling the respective <tt>init*</tt> - * functions for the more complex data structures. - */ -static GLboolean -init_attrib_groups( GLcontext *ctx ) -{ - assert(ctx); - - /* Constants */ - _mesa_init_constants( ctx ); - - /* Extensions */ - _mesa_init_extensions( ctx ); - - /* Attribute Groups */ - _mesa_init_accum( ctx ); - _mesa_init_attrib( ctx ); - _mesa_init_buffer_objects( ctx ); - _mesa_init_color( ctx ); - _mesa_init_colortables( ctx ); - _mesa_init_current( ctx ); - _mesa_init_depth( ctx ); - _mesa_init_debug( ctx ); - _mesa_init_display_list( ctx ); - _mesa_init_eval( ctx ); - _mesa_init_feedback( ctx ); - _mesa_init_fog( ctx ); - _mesa_init_histogram( ctx ); - _mesa_init_hint( ctx ); - _mesa_init_line( ctx ); - _mesa_init_lighting( ctx ); - _mesa_init_matrix( ctx ); - _mesa_init_multisample( ctx ); - _mesa_init_occlude( ctx ); - _mesa_init_pixel( ctx ); - _mesa_init_point( ctx ); - _mesa_init_polygon( ctx ); - _mesa_init_program( ctx ); - _mesa_init_rastpos( ctx ); - _mesa_init_scissor( ctx ); - _mesa_init_shaderobjects (ctx); - _mesa_init_stencil( ctx ); - _mesa_init_transform( ctx ); - _mesa_init_varray( ctx ); - _mesa_init_viewport( ctx ); - - if (!_mesa_init_texture( ctx )) - return GL_FALSE; - - _mesa_init_texture_s3tc( ctx ); - _mesa_init_texture_fxt1( ctx ); - - /* Miscellaneous */ - ctx->NewState = _NEW_ALL; - ctx->ErrorValue = (GLenum) GL_NO_ERROR; - ctx->_Facing = 0; -#if CHAN_TYPE == GL_FLOAT - ctx->ClampFragmentColors = GL_FALSE; /* XXX temporary */ -#else - ctx->ClampFragmentColors = GL_TRUE; -#endif - ctx->ClampVertexColors = GL_TRUE; - - return GL_TRUE; -} - - -/** - * This is the default function we plug into all dispatch table slots - * This helps prevents a segfault when someone calls a GL function without - * first checking if the extension's supported. - */ -static int -generic_nop(void) -{ - _mesa_problem(NULL, "User called no-op dispatch function (an unsupported extension function?)"); - return 0; -} - - -/** - * Allocate and initialize a new dispatch table. - */ -static struct _glapi_table * -alloc_dispatch_table(void) -{ - /* Find the larger of Mesa's dispatch table and libGL's dispatch table. - * In practice, this'll be the same for stand-alone Mesa. But for DRI - * Mesa we do this to accomodate different versions of libGL and various - * DRI drivers. - */ - GLint numEntries = MAX2(_glapi_get_dispatch_table_size(), - sizeof(struct _glapi_table) / sizeof(_glapi_proc)); - struct _glapi_table *table = - (struct _glapi_table *) _mesa_malloc(numEntries * sizeof(_glapi_proc)); - if (table) { - _glapi_proc *entry = (_glapi_proc *) table; - GLint i; - for (i = 0; i < numEntries; i++) { - entry[i] = (_glapi_proc) generic_nop; - } - } - return table; -} - - -/** - * Initialize a GLcontext struct (rendering context). - * - * This includes allocating all the other structs and arrays which hang off of - * the context by pointers. - * Note that the driver needs to pass in its dd_function_table here since - * we need to at least call driverFunctions->NewTextureObject to create the - * default texture objects. - * - * Called by _mesa_create_context(). - * - * Performs the imports and exports callback tables initialization, and - * miscellaneous one-time initializations. If no shared context is supplied one - * is allocated, and increase its reference count. Setups the GL API dispatch - * tables. Initialize the TNL module. Sets the maximum Z buffer depth. - * Finally queries the \c MESA_DEBUG and \c MESA_VERBOSE environment variables - * for debug flags. - * - * \param ctx the context to initialize - * \param visual describes the visual attributes for this context - * \param share_list points to context to share textures, display lists, - * etc with, or NULL - * \param driverFunctions table of device driver functions for this context - * to use - * \param driverContext pointer to driver-specific context data - */ -GLboolean -_mesa_initialize_context( GLcontext *ctx, - const GLvisual *visual, - GLcontext *share_list, - const struct dd_function_table *driverFunctions, - void *driverContext ) -{ - ASSERT(driverContext); - assert(driverFunctions->NewTextureObject); - assert(driverFunctions->FreeTexImageData); - - /* If the driver wants core Mesa to use special imports, it'll have to - * override these defaults. - */ - _mesa_init_default_imports( &(ctx->imports), driverContext ); - - /* initialize the exports (Mesa functions called by the window system) */ - _mesa_init_default_exports( &(ctx->exports) ); - - /* misc one-time initializations */ - one_time_init(ctx); - - ctx->Visual = *visual; - ctx->DrawBuffer = NULL; - ctx->ReadBuffer = NULL; - ctx->WinSysDrawBuffer = NULL; - ctx->WinSysReadBuffer = NULL; - - /* Plug in driver functions and context pointer here. - * This is important because when we call alloc_shared_state() below - * we'll call ctx->Driver.NewTextureObject() to create the default - * textures. - */ - ctx->Driver = *driverFunctions; - ctx->DriverCtx = driverContext; - - if (share_list) { - /* share state with another context */ - ctx->Shared = share_list->Shared; - } - else { - /* allocate new, unshared state */ - if (!alloc_shared_state( ctx )) { - return GL_FALSE; - } - } - _glthread_LOCK_MUTEX(ctx->Shared->Mutex); - ctx->Shared->RefCount++; - _glthread_UNLOCK_MUTEX(ctx->Shared->Mutex); - - if (!init_attrib_groups( ctx )) { - free_shared_state(ctx, ctx->Shared); - return GL_FALSE; - } - - /* setup the API dispatch tables */ - ctx->Exec = alloc_dispatch_table(); - ctx->Save = alloc_dispatch_table(); - if (!ctx->Exec || !ctx->Save) { - free_shared_state(ctx, ctx->Shared); - if (ctx->Exec) - _mesa_free(ctx->Exec); - } - _mesa_init_exec_table(ctx->Exec); - ctx->CurrentDispatch = ctx->Exec; -#if _HAVE_FULL_GL - _mesa_init_dlist_table(ctx->Save); - _mesa_install_save_vtxfmt( ctx, &ctx->ListState.ListVtxfmt ); - /* Neutral tnl module stuff */ - _mesa_init_exec_vtxfmt( ctx ); - ctx->TnlModule.Current = NULL; - ctx->TnlModule.SwapCount = 0; -#endif - - ctx->_MaintainTexEnvProgram = (_mesa_getenv("MESA_TEX_PROG") != NULL); - ctx->_MaintainTnlProgram = (_mesa_getenv("MESA_TNL_PROG") != NULL); - - return GL_TRUE; -} - - -/** - * Allocate and initialize a GLcontext structure. - * Note that the driver needs to pass in its dd_function_table here since - * we need to at least call driverFunctions->NewTextureObject to initialize - * the rendering context. - * - * \param visual a GLvisual pointer (we copy the struct contents) - * \param share_list another context to share display lists with or NULL - * \param driverFunctions points to the dd_function_table into which the - * driver has plugged in all its special functions. - * \param driverCtx points to the device driver's private context state - * - * \return pointer to a new __GLcontextRec or NULL if error. - */ -GLcontext * -_mesa_create_context( const GLvisual *visual, - GLcontext *share_list, - const struct dd_function_table *driverFunctions, - void *driverContext ) - -{ - GLcontext *ctx; - - ASSERT(visual); - ASSERT(driverContext); - - ctx = (GLcontext *) _mesa_calloc(sizeof(GLcontext)); - if (!ctx) - return NULL; - - if (_mesa_initialize_context(ctx, visual, share_list, - driverFunctions, driverContext)) { - return ctx; - } - else { - _mesa_free(ctx); - return NULL; - } -} - - -/** - * Free the data associated with the given context. - * - * But doesn't free the GLcontext struct itself. - * - * \sa _mesa_initialize_context() and init_attrib_groups(). - */ -void -_mesa_free_context_data( GLcontext *ctx ) -{ - /* if we're destroying the current context, unbind it first */ - if (ctx == _mesa_get_current_context()) { - _mesa_make_current(NULL, NULL, NULL); - } - - _mesa_free_lighting_data( ctx ); - _mesa_free_eval_data( ctx ); - _mesa_free_texture_data( ctx ); - _mesa_free_matrix_data( ctx ); - _mesa_free_viewport_data( ctx ); - _mesa_free_colortables_data( ctx ); - _mesa_free_program_data(ctx); - _mesa_free_occlude_data(ctx); - -#if FEATURE_ARB_vertex_buffer_object - _mesa_delete_buffer_object(ctx, ctx->Array.NullBufferObj); -#endif - - /* free dispatch tables */ - _mesa_free(ctx->Exec); - _mesa_free(ctx->Save); - - /* Shared context state (display lists, textures, etc) */ - _glthread_LOCK_MUTEX(ctx->Shared->Mutex); - ctx->Shared->RefCount--; - assert(ctx->Shared->RefCount >= 0); - _glthread_UNLOCK_MUTEX(ctx->Shared->Mutex); - if (ctx->Shared->RefCount == 0) { - /* free shared state */ - free_shared_state( ctx, ctx->Shared ); - } - - if (ctx->Extensions.String) - FREE((void *) ctx->Extensions.String); -} - - -/** - * Destroy a GLcontext structure. - * - * \param ctx GL context. - * - * Calls _mesa_free_context_data() and frees the GLcontext structure itself. - */ -void -_mesa_destroy_context( GLcontext *ctx ) -{ - if (ctx) { - _mesa_free_context_data(ctx); - FREE( (void *) ctx ); - } -} - - -#if _HAVE_FULL_GL -/** - * Copy attribute groups from one context to another. - * - * \param src source context - * \param dst destination context - * \param mask bitwise OR of GL_*_BIT flags - * - * According to the bits specified in \p mask, copies the corresponding - * attributes from \p src into \p dst. For many of the attributes a simple \c - * memcpy is not enough due to the existence of internal pointers in their data - * structures. - */ -void -_mesa_copy_context( const GLcontext *src, GLcontext *dst, GLuint mask ) -{ - if (mask & GL_ACCUM_BUFFER_BIT) { - /* OK to memcpy */ - dst->Accum = src->Accum; - } - if (mask & GL_COLOR_BUFFER_BIT) { - /* OK to memcpy */ - dst->Color = src->Color; - } - if (mask & GL_CURRENT_BIT) { - /* OK to memcpy */ - dst->Current = src->Current; - } - if (mask & GL_DEPTH_BUFFER_BIT) { - /* OK to memcpy */ - dst->Depth = src->Depth; - } - if (mask & GL_ENABLE_BIT) { - /* no op */ - } - if (mask & GL_EVAL_BIT) { - /* OK to memcpy */ - dst->Eval = src->Eval; - } - if (mask & GL_FOG_BIT) { - /* OK to memcpy */ - dst->Fog = src->Fog; - } - if (mask & GL_HINT_BIT) { - /* OK to memcpy */ - dst->Hint = src->Hint; - } - if (mask & GL_LIGHTING_BIT) { - GLuint i; - /* begin with memcpy */ - MEMCPY( &dst->Light, &src->Light, sizeof(struct gl_light) ); - /* fixup linked lists to prevent pointer insanity */ - make_empty_list( &(dst->Light.EnabledList) ); - for (i = 0; i < MAX_LIGHTS; i++) { - if (dst->Light.Light[i].Enabled) { - insert_at_tail(&(dst->Light.EnabledList), &(dst->Light.Light[i])); - } - } - } - if (mask & GL_LINE_BIT) { - /* OK to memcpy */ - dst->Line = src->Line; - } - if (mask & GL_LIST_BIT) { - /* OK to memcpy */ - dst->List = src->List; - } - if (mask & GL_PIXEL_MODE_BIT) { - /* OK to memcpy */ - dst->Pixel = src->Pixel; - } - if (mask & GL_POINT_BIT) { - /* OK to memcpy */ - dst->Point = src->Point; - } - if (mask & GL_POLYGON_BIT) { - /* OK to memcpy */ - dst->Polygon = src->Polygon; - } - if (mask & GL_POLYGON_STIPPLE_BIT) { - /* Use loop instead of MEMCPY due to problem with Portland Group's - * C compiler. Reported by John Stone. - */ - GLuint i; - for (i = 0; i < 32; i++) { - dst->PolygonStipple[i] = src->PolygonStipple[i]; - } - } - if (mask & GL_SCISSOR_BIT) { - /* OK to memcpy */ - dst->Scissor = src->Scissor; - } - if (mask & GL_STENCIL_BUFFER_BIT) { - /* OK to memcpy */ - dst->Stencil = src->Stencil; - } - if (mask & GL_TEXTURE_BIT) { - /* Cannot memcpy because of pointers */ - _mesa_copy_texture_state(src, dst); - } - if (mask & GL_TRANSFORM_BIT) { - /* OK to memcpy */ - dst->Transform = src->Transform; - } - if (mask & GL_VIEWPORT_BIT) { - /* Cannot use memcpy, because of pointers in GLmatrix _WindowMap */ - dst->Viewport.X = src->Viewport.X; - dst->Viewport.Y = src->Viewport.Y; - dst->Viewport.Width = src->Viewport.Width; - dst->Viewport.Height = src->Viewport.Height; - dst->Viewport.Near = src->Viewport.Near; - dst->Viewport.Far = src->Viewport.Far; - _math_matrix_copy(&dst->Viewport._WindowMap, &src->Viewport._WindowMap); - } - - /* XXX FIXME: Call callbacks? - */ - dst->NewState = _NEW_ALL; -} -#endif - - -/** - * Check if the given context can render into the given framebuffer - * by checking visual attributes. - * \return GL_TRUE if compatible, GL_FALSE otherwise. - */ -static GLboolean -check_compatible(const GLcontext *ctx, const GLframebuffer *buffer) -{ - const GLvisual *ctxvis = &ctx->Visual; - const GLvisual *bufvis = &buffer->Visual; - - if (ctxvis == bufvis) - return GL_TRUE; - - if (ctxvis->rgbMode != bufvis->rgbMode) - return GL_FALSE; - if (ctxvis->doubleBufferMode && !bufvis->doubleBufferMode) - return GL_FALSE; - if (ctxvis->stereoMode && !bufvis->stereoMode) - return GL_FALSE; - if (ctxvis->haveAccumBuffer && !bufvis->haveAccumBuffer) - return GL_FALSE; - if (ctxvis->haveDepthBuffer && !bufvis->haveDepthBuffer) - return GL_FALSE; - if (ctxvis->haveStencilBuffer && !bufvis->haveStencilBuffer) - return GL_FALSE; - if (ctxvis->redMask && ctxvis->redMask != bufvis->redMask) - return GL_FALSE; - if (ctxvis->greenMask && ctxvis->greenMask != bufvis->greenMask) - return GL_FALSE; - if (ctxvis->blueMask && ctxvis->blueMask != bufvis->blueMask) - return GL_FALSE; - if (ctxvis->depthBits && ctxvis->depthBits != bufvis->depthBits) - return GL_FALSE; - if (ctxvis->stencilBits && ctxvis->stencilBits != bufvis->stencilBits) - return GL_FALSE; - - return GL_TRUE; -} - - -/** - * Bind the given context to the given draw-buffer and read-buffer and - * make it the current context for this thread. - * - * \param newCtx new GL context. If NULL then there will be no current GL - * context. - * \param drawBuffer draw framebuffer. - * \param readBuffer read framebuffer. - * - * Check that the context's and framebuffer's visuals are compatible, returning - * immediately otherwise. Sets the glapi current context via - * _glapi_set_context(). If \p newCtx is not NULL, associates \p drawBuffer and - * \p readBuffer with it and calls dd_function_table::ResizeBuffers if the buffers size has changed. - * Calls dd_function_table::MakeCurrent callback if defined. - * - * When a context is bound by the first time and the \c MESA_INFO environment - * variable is set it calls print_info() as an aid for remote user - * troubleshooting. - */ -void -_mesa_make_current( GLcontext *newCtx, GLframebuffer *drawBuffer, - GLframebuffer *readBuffer ) -{ - #ifdef NXAGENT_SERVER - int flag; - #endif - - if (MESA_VERBOSE & VERBOSE_API) - _mesa_debug(newCtx, "_mesa_make_current()\n"); - - /* Check that the context's and framebuffer's visuals are compatible. - */ - if (newCtx && drawBuffer && newCtx->DrawBuffer != drawBuffer) { - if (!check_compatible(newCtx, drawBuffer)) - return; - } - if (newCtx && readBuffer && newCtx->ReadBuffer != readBuffer) { - if (!check_compatible(newCtx, readBuffer)) - return; - } - -#if !defined(IN_DRI_DRIVER) - /* We call this function periodically (just here for now) in - * order to detect when multithreading has begun. In a DRI driver, this - * step is done by the driver loader (e.g., libGL). - */ - _glapi_check_multithread(); -#endif /* !defined(IN_DRI_DRIVER) */ - - _glapi_set_context((void *) newCtx); - ASSERT(_mesa_get_current_context() == newCtx); - - if (!newCtx) { - _glapi_set_dispatch(NULL); /* none current */ - } - else { - _glapi_set_dispatch(newCtx->CurrentDispatch); - - if (drawBuffer && readBuffer) { - /* TODO: check if newCtx and buffer's visual match??? */ - - ASSERT(drawBuffer->Name == 0); - ASSERT(readBuffer->Name == 0); - newCtx->WinSysDrawBuffer = drawBuffer; - newCtx->WinSysReadBuffer = readBuffer; - -#ifdef NXAGENT_SERVER - flag = 0; - if (newCtx->DrawBuffer) { - if (!IsWSDrawBuffer(newCtx->DrawBuffer)) { - if (newCtx->DrawBuffer->Name == 0) { - flag = 1; - } - FreeWSDrawBuffer(newCtx->DrawBuffer); - } - else flag = 1; - } - - if (!newCtx->DrawBuffer || flag) { - newCtx->DrawBuffer = drawBuffer; - newCtx->ReadBuffer = readBuffer; - } -#else - /* don't replace user-buffer bindings with window system buffer */ - if (!newCtx->DrawBuffer || newCtx->DrawBuffer->Name == 0) { - newCtx->DrawBuffer = drawBuffer; - newCtx->ReadBuffer = readBuffer; - } -#endif - - newCtx->NewState |= _NEW_BUFFERS; - -#if _HAVE_FULL_GL - if (!drawBuffer->Initialized) { - /* get initial window size */ - GLuint bufWidth, bufHeight; - /* ask device driver for size of the buffer */ - (*newCtx->Driver.GetBufferSize)(drawBuffer, &bufWidth, &bufHeight); - /* set initial buffer size */ - if (newCtx->Driver.ResizeBuffers) - newCtx->Driver.ResizeBuffers(newCtx, drawBuffer, - bufWidth, bufHeight); - drawBuffer->Initialized = GL_TRUE; - } - - if (readBuffer != drawBuffer && !readBuffer->Initialized) { - /* get initial window size */ - GLuint bufWidth, bufHeight; - /* ask device driver for size of the buffer */ - (*newCtx->Driver.GetBufferSize)(readBuffer, &bufWidth, &bufHeight); - /* set initial buffer size */ - if (newCtx->Driver.ResizeBuffers) - newCtx->Driver.ResizeBuffers(newCtx, readBuffer, - bufWidth, bufHeight); - readBuffer->Initialized = GL_TRUE; - } -#endif - if (newCtx->FirstTimeCurrent) { - /* set initial viewport and scissor size now */ - _mesa_set_viewport(newCtx, 0, 0, drawBuffer->Width, drawBuffer->Height); - newCtx->Scissor.Width = drawBuffer->Width; - newCtx->Scissor.Height = drawBuffer->Height; - } - } - - /* Alert the driver - usually passed on to the sw t&l module, - * but also used to detect threaded cases in the radeon codegen - * hw t&l module. - */ - if (newCtx->Driver.MakeCurrent) - newCtx->Driver.MakeCurrent( newCtx, drawBuffer, readBuffer ); - - /* We can use this to help debug user's problems. Tell them to set - * the MESA_INFO env variable before running their app. Then the - * first time each context is made current we'll print some useful - * information. - */ - if (newCtx->FirstTimeCurrent) { - if (_mesa_getenv("MESA_INFO")) { - _mesa_print_info(); - } - newCtx->FirstTimeCurrent = GL_FALSE; - } - } -} - - -/** - * Make context 'ctx' share the display lists, textures and programs - * that are associated with 'ctxToShare'. - * Any display lists, textures or programs associated with 'ctx' will - * be deleted if nobody else is sharing them. - */ -GLboolean -_mesa_share_state(GLcontext *ctx, GLcontext *ctxToShare) -{ - if (ctx && ctxToShare && ctx->Shared && ctxToShare->Shared) { - ctx->Shared->RefCount--; - if (ctx->Shared->RefCount == 0) { - free_shared_state(ctx, ctx->Shared); - } - ctx->Shared = ctxToShare->Shared; - ctx->Shared->RefCount++; - return GL_TRUE; - } - else { - return GL_FALSE; - } -} - - - -/** - * Get current context for the calling thread. - * - * \return pointer to the current GL context. - * - * Calls _glapi_get_context(). This isn't the fastest way to get the current - * context. If you need speed, see the #GET_CURRENT_CONTEXT macro in context.h. - */ -GLcontext * -_mesa_get_current_context( void ) -{ - return (GLcontext *) _glapi_get_context(); -} - -/** - * Get context's current API dispatch table. - * - * It'll either be the immediate-mode execute dispatcher or the display list - * compile dispatcher. - * - * \param ctx GL context. - * - * \return pointer to dispatch_table. - * - * Simply returns __GLcontextRec::CurrentDispatch. - */ -struct _glapi_table * -_mesa_get_dispatch(GLcontext *ctx) -{ - return ctx->CurrentDispatch; -} - -/*@}*/ - - -/**********************************************************************/ -/** \name Miscellaneous functions */ -/**********************************************************************/ -/*@{*/ - -/** - * Record an error. - * - * \param ctx GL context. - * \param error error code. - * - * Records the given error code and call the driver's dd_function_table::Error - * function if defined. - * - * \sa - * This is called via _mesa_error(). - */ -void -_mesa_record_error( GLcontext *ctx, GLenum error ) -{ - if (!ctx) - return; - - if (ctx->ErrorValue == GL_NO_ERROR) { - ctx->ErrorValue = error; - } - - /* Call device driver's error handler, if any. This is used on the Mac. */ - if (ctx->Driver.Error) { - (*ctx->Driver.Error)( ctx ); - } -} - -/** - * Execute glFinish(). - * - * Calls the #ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH macro and the - * dd_function_table::Finish driver callback, if not NULL. - */ -void GLAPIENTRY -_mesa_Finish( void ) -{ - GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); - if (ctx->Driver.Finish) { - (*ctx->Driver.Finish)( ctx ); - } -} - -/** - * Execute glFlush(). - * - * Calls the #ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH macro and the - * dd_function_table::Flush driver callback, if not NULL. - */ -void GLAPIENTRY -_mesa_Flush( void ) -{ - GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); - if (ctx->Driver.Flush) { - (*ctx->Driver.Flush)( ctx ); - } -} - - -/*@}*/ diff --git a/nx-X11/extras/Mesa/src/mesa/main/context.c.X.original b/nx-X11/extras/Mesa/src/mesa/main/context.c.X.original deleted file mode 100644 index 25a3f6a37..000000000 --- a/nx-X11/extras/Mesa/src/mesa/main/context.c.X.original +++ /dev/null @@ -1,1750 +0,0 @@ -/** - * \file context.c - * Mesa context/visual/framebuffer management functions. - * \author Brian Paul - */ - -/* - * Mesa 3-D graphics library - * Version: 6.4 - * - * Copyright (C) 1999-2005 Brian Paul All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - - -/** - * \mainpage Mesa Main Module - * - * \section MainIntroduction Introduction - * - * The Mesa Main module consists of all the files in the main/ directory. - * Among the features of this module are: - * <UL> - * <LI> Structures to represent most GL state </LI> - * <LI> State set/get functions </LI> - * <LI> Display lists </LI> - * <LI> Texture unit, object and image handling </LI> - * <LI> Matrix and attribute stacks </LI> - * </UL> - * - * Other modules are responsible for API dispatch, vertex transformation, - * point/line/triangle setup, rasterization, vertex array caching, - * vertex/fragment programs/shaders, etc. - * - * - * \section AboutDoxygen About Doxygen - * - * If you're viewing this information as Doxygen-generated HTML you'll - * see the documentation index at the top of this page. - * - * The first line lists the Mesa source code modules. - * The second line lists the indexes available for viewing the documentation - * for each module. - * - * Selecting the <b>Main page</b> link will display a summary of the module - * (this page). - * - * Selecting <b>Data Structures</b> will list all C structures. - * - * Selecting the <b>File List</b> link will list all the source files in - * the module. - * Selecting a filename will show a list of all functions defined in that file. - * - * Selecting the <b>Data Fields</b> link will display a list of all - * documented structure members. - * - * Selecting the <b>Globals</b> link will display a list - * of all functions, structures, global variables and macros in the module. - * - */ - - -#include "glheader.h" -#include "imports.h" -#include "accum.h" -#include "attrib.h" -#include "blend.h" -#include "buffers.h" -#include "bufferobj.h" -#include "colortab.h" -#include "context.h" -#include "debug.h" -#include "depth.h" -#include "dlist.h" -#include "eval.h" -#include "enums.h" -#include "extensions.h" -#include "fbobject.h" -#include "feedback.h" -#include "fog.h" -#include "get.h" -#include "glthread.h" -#include "glapioffsets.h" -#include "histogram.h" -#include "hint.h" -#include "hash.h" -#include "light.h" -#include "lines.h" -#include "macros.h" -#include "matrix.h" -#include "occlude.h" -#include "pixel.h" -#include "points.h" -#include "polygon.h" -#if FEATURE_NV_vertex_program || FEATURE_NV_fragment_program -#include "program.h" -#endif -#include "rastpos.h" -#include "simple_list.h" -#include "state.h" -#include "stencil.h" -#include "texcompress.h" -#include "teximage.h" -#include "texobj.h" -#include "texstate.h" -#include "mtypes.h" -#include "varray.h" -#include "version.h" -#include "vtxfmt.h" -#if _HAVE_FULL_GL -#include "math/m_translate.h" -#include "math/m_matrix.h" -#include "math/m_xform.h" -#include "math/mathmod.h" -#endif -#include "shaderobjects.h" - -#ifdef USE_SPARC_ASM -#include "sparc/sparc.h" -#endif - -#ifndef MESA_VERBOSE -int MESA_VERBOSE = 0; -#endif - -#ifndef MESA_DEBUG_FLAGS -int MESA_DEBUG_FLAGS = 0; -#endif - - -/* ubyte -> float conversion */ -GLfloat _mesa_ubyte_to_float_color_tab[256]; - -static void -free_shared_state( GLcontext *ctx, struct gl_shared_state *ss ); - - -/**********************************************************************/ -/** \name OpenGL SI-style interface (new in Mesa 3.5) - * - * \if subset - * \note Most of these functions are never called in the Mesa subset. - * \endif - */ -/*@{*/ - -/** - * Destroy context callback. - * - * \param gc context. - * \return GL_TRUE on success, or GL_FALSE on failure. - * - * \ifnot subset - * Called by window system/device driver (via __GLexports::destroyCurrent) when - * the rendering context is to be destroyed. - * \endif - * - * Frees the context data and the context structure. - */ -GLboolean -_mesa_destroyContext(__GLcontext *gc) -{ - if (gc) { - _mesa_free_context_data(gc); - _mesa_free(gc); - } - return GL_TRUE; -} - -/** - * Unbind context callback. - * - * \param gc context. - * \return GL_TRUE on success, or GL_FALSE on failure. - * - * \ifnot subset - * Called by window system/device driver (via __GLexports::loseCurrent) - * when the rendering context is made non-current. - * \endif - * - * No-op - */ -GLboolean -_mesa_loseCurrent(__GLcontext *gc) -{ - /* XXX unbind context from thread */ - (void) gc; - return GL_TRUE; -} - -/** - * Bind context callback. - * - * \param gc context. - * \return GL_TRUE on success, or GL_FALSE on failure. - * - * \ifnot subset - * Called by window system/device driver (via __GLexports::makeCurrent) - * when the rendering context is made current. - * \endif - * - * No-op - */ -GLboolean -_mesa_makeCurrent(__GLcontext *gc) -{ - /* XXX bind context to thread */ - (void) gc; - return GL_TRUE; -} - -/** - * Share context callback. - * - * \param gc context. - * \param gcShare shared context. - * \return GL_TRUE on success, or GL_FALSE on failure. - * - * \ifnot subset - * Called by window system/device driver (via __GLexports::shareContext) - * \endif - * - * Update the shared context reference count, gl_shared_state::RefCount. - */ -GLboolean -_mesa_shareContext(__GLcontext *gc, __GLcontext *gcShare) -{ - if (gc && gcShare && gc->Shared && gcShare->Shared) { - gc->Shared->RefCount--; - if (gc->Shared->RefCount == 0) { - free_shared_state(gc, gc->Shared); - } - gc->Shared = gcShare->Shared; - gc->Shared->RefCount++; - return GL_TRUE; - } - else { - return GL_FALSE; - } -} - - -#if _HAVE_FULL_GL -/** - * Copy context callback. - */ -GLboolean -_mesa_copyContext(__GLcontext *dst, const __GLcontext *src, GLuint mask) -{ - if (dst && src) { - _mesa_copy_context( src, dst, mask ); - return GL_TRUE; - } - else { - return GL_FALSE; - } -} -#endif - -/** No-op */ -GLboolean -_mesa_forceCurrent(__GLcontext *gc) -{ - (void) gc; - return GL_TRUE; -} - -/** - * Windows/buffer resizing notification callback. - * - * \param gc GL context. - * \return GL_TRUE on success, or GL_FALSE on failure. - */ -GLboolean -_mesa_notifyResize(__GLcontext *gc) -{ - GLint x, y; - GLuint width, height; - __GLdrawablePrivate *d = gc->imports.getDrawablePrivate(gc); - if (!d || !d->getDrawableSize) - return GL_FALSE; - d->getDrawableSize( d, &x, &y, &width, &height ); - /* update viewport, resize software buffers, etc. */ - return GL_TRUE; -} - -/** - * Window/buffer destruction notification callback. - * - * \param gc GL context. - * - * Called when the context's window/buffer is going to be destroyed. - * - * No-op - */ -void -_mesa_notifyDestroy(__GLcontext *gc) -{ - /* Unbind from it. */ - (void) gc; -} - -/** - * Swap buffers notification callback. - * - * \param gc GL context. - * - * Called by window system just before swapping buffers. - * We have to finish any pending rendering. - */ -void -_mesa_notifySwapBuffers(__GLcontext *gc) -{ - FLUSH_VERTICES( gc, 0 ); -} - -/** No-op */ -struct __GLdispatchStateRec * -_mesa_dispatchExec(__GLcontext *gc) -{ - (void) gc; - return NULL; -} - -/** No-op */ -void -_mesa_beginDispatchOverride(__GLcontext *gc) -{ - (void) gc; -} - -/** No-op */ -void -_mesa_endDispatchOverride(__GLcontext *gc) -{ - (void) gc; -} - -/** - * \ifnot subset - * Setup the exports. - * - * The window system will call these functions when it needs Mesa to do - * something. - * - * \note Device drivers should override these functions! For example, - * the Xlib driver should plug in the XMesa*-style functions into this - * structure. The XMesa-style functions should then call the _mesa_* - * version of these functions. This is an approximation to OO design - * (inheritance and virtual functions). - * \endif - * - * \if subset - * No-op. - * - * \endif - */ -static void -_mesa_init_default_exports(__GLexports *exports) -{ -#if _HAVE_FULL_GL - exports->destroyContext = _mesa_destroyContext; - exports->loseCurrent = _mesa_loseCurrent; - exports->makeCurrent = _mesa_makeCurrent; - exports->shareContext = _mesa_shareContext; - exports->copyContext = _mesa_copyContext; - exports->forceCurrent = _mesa_forceCurrent; - exports->notifyResize = _mesa_notifyResize; - exports->notifyDestroy = _mesa_notifyDestroy; - exports->notifySwapBuffers = _mesa_notifySwapBuffers; - exports->dispatchExec = _mesa_dispatchExec; - exports->beginDispatchOverride = _mesa_beginDispatchOverride; - exports->endDispatchOverride = _mesa_endDispatchOverride; -#else - (void) exports; -#endif -} - -/** - * Exported OpenGL SI interface. - */ -__GLcontext * -__glCoreCreateContext(__GLimports *imports, __GLcontextModes *modes) -{ - GLcontext *ctx; - - ctx = (GLcontext *) (*imports->calloc)(NULL, 1, sizeof(GLcontext)); - if (ctx == NULL) { - return NULL; - } - - /* XXX doesn't work at this time */ - _mesa_initialize_context(ctx, modes, NULL, NULL, NULL); - ctx->imports = *imports; - - return ctx; -} - -/** - * Exported OpenGL SI interface. - */ -void -__glCoreNopDispatch(void) -{ -#if 0 - /* SI */ - __gl_dispatch = __glNopDispatchState; -#else - /* Mesa */ - _glapi_set_dispatch(NULL); -#endif -} - -/*@}*/ - - -/**********************************************************************/ -/** \name GL Visual allocation/destruction */ -/**********************************************************************/ -/*@{*/ - -/** - * Allocates a GLvisual structure and initializes it via - * _mesa_initialize_visual(). - * - * \param rgbFlag GL_TRUE for RGB(A) mode, GL_FALSE for Color Index mode. - * \param dbFlag double buffering - * \param stereoFlag stereo buffer - * \param depthBits requested bits per depth buffer value. Any value in [0, 32] - * is acceptable but the actual depth type will be GLushort or GLuint as - * needed. - * \param stencilBits requested minimum bits per stencil buffer value - * \param accumRedBits, accumGreenBits, accumBlueBits, accumAlphaBits number of bits per color component in accum buffer. - * \param indexBits number of bits per pixel if \p rgbFlag is GL_FALSE - * \param redBits number of bits per color component in frame buffer for RGB(A) - * mode. We always use 8 in core Mesa though. - * \param greenBits same as above. - * \param blueBits same as above. - * \param alphaBits same as above. - * \param numSamples not really used. - * - * \return pointer to new GLvisual or NULL if requested parameters can't be - * met. - * - * \note Need to add params for level and numAuxBuffers (at least) - */ -GLvisual * -_mesa_create_visual( GLboolean rgbFlag, - GLboolean dbFlag, - GLboolean stereoFlag, - GLint redBits, - GLint greenBits, - GLint blueBits, - GLint alphaBits, - GLint indexBits, - GLint depthBits, - GLint stencilBits, - GLint accumRedBits, - GLint accumGreenBits, - GLint accumBlueBits, - GLint accumAlphaBits, - GLint numSamples ) -{ - GLvisual *vis = (GLvisual *) CALLOC( sizeof(GLvisual) ); - if (vis) { - if (!_mesa_initialize_visual(vis, rgbFlag, dbFlag, stereoFlag, - redBits, greenBits, blueBits, alphaBits, - indexBits, depthBits, stencilBits, - accumRedBits, accumGreenBits, - accumBlueBits, accumAlphaBits, - numSamples)) { - FREE(vis); - return NULL; - } - } - return vis; -} - -/** - * Makes some sanity checks and fills in the fields of the - * GLvisual object with the given parameters. If the caller needs - * to set additional fields, he should just probably init the whole GLvisual - * object himself. - * \return GL_TRUE on success, or GL_FALSE on failure. - * - * \sa _mesa_create_visual() above for the parameter description. - */ -GLboolean -_mesa_initialize_visual( GLvisual *vis, - GLboolean rgbFlag, - GLboolean dbFlag, - GLboolean stereoFlag, - GLint redBits, - GLint greenBits, - GLint blueBits, - GLint alphaBits, - GLint indexBits, - GLint depthBits, - GLint stencilBits, - GLint accumRedBits, - GLint accumGreenBits, - GLint accumBlueBits, - GLint accumAlphaBits, - GLint numSamples ) -{ - assert(vis); - - if (depthBits < 0 || depthBits > 32) { - return GL_FALSE; - } - if (stencilBits < 0 || stencilBits > STENCIL_BITS) { - return GL_FALSE; - } - if (accumRedBits < 0 || accumRedBits > ACCUM_BITS) { - return GL_FALSE; - } - if (accumGreenBits < 0 || accumGreenBits > ACCUM_BITS) { - return GL_FALSE; - } - if (accumBlueBits < 0 || accumBlueBits > ACCUM_BITS) { - return GL_FALSE; - } - if (accumAlphaBits < 0 || accumAlphaBits > ACCUM_BITS) { - return GL_FALSE; - } - - vis->rgbMode = rgbFlag; - vis->doubleBufferMode = dbFlag; - vis->stereoMode = stereoFlag; - - vis->redBits = redBits; - vis->greenBits = greenBits; - vis->blueBits = blueBits; - vis->alphaBits = alphaBits; - vis->rgbBits = redBits + greenBits + blueBits; - - vis->indexBits = indexBits; - vis->depthBits = depthBits; - vis->stencilBits = stencilBits; - - vis->accumRedBits = accumRedBits; - vis->accumGreenBits = accumGreenBits; - vis->accumBlueBits = accumBlueBits; - vis->accumAlphaBits = accumAlphaBits; - - vis->haveAccumBuffer = accumRedBits > 0; - vis->haveDepthBuffer = depthBits > 0; - vis->haveStencilBuffer = stencilBits > 0; - - vis->numAuxBuffers = 0; - vis->level = 0; - vis->pixmapMode = 0; - vis->sampleBuffers = numSamples > 0 ? 1 : 0; - vis->samples = numSamples; - - return GL_TRUE; -} - - -/** - * Destroy a visual and free its memory. - * - * \param vis visual. - * - * Frees the visual structure. - */ -void -_mesa_destroy_visual( GLvisual *vis ) -{ - FREE(vis); -} - -/*@}*/ - - -/**********************************************************************/ -/** \name Context allocation, initialization, destroying - * - * The purpose of the most initialization functions here is to provide the - * default state values according to the OpenGL specification. - */ -/**********************************************************************/ -/*@{*/ - -/** - * One-time initialization mutex lock. - * - * \sa Used by one_time_init(). - */ -_glthread_DECLARE_STATIC_MUTEX(OneTimeLock); - -/** - * Calls all the various one-time-init functions in Mesa. - * - * While holding a global mutex lock, calls several initialization functions, - * and sets the glapi callbacks if the \c MESA_DEBUG environment variable is - * defined. - * - * \sa _mesa_init_lists(), _math_init(). - */ -static void -one_time_init( GLcontext *ctx ) -{ - static GLboolean alreadyCalled = GL_FALSE; - (void) ctx; - _glthread_LOCK_MUTEX(OneTimeLock); - if (!alreadyCalled) { - GLuint i; - - /* do some implementation tests */ - assert( sizeof(GLbyte) == 1 ); - assert( sizeof(GLubyte) == 1 ); - assert( sizeof(GLshort) == 2 ); - assert( sizeof(GLushort) == 2 ); - assert( sizeof(GLint) == 4 ); - assert( sizeof(GLuint) == 4 ); - - _mesa_init_lists(); - -#if _HAVE_FULL_GL - _math_init(); - - for (i = 0; i < 256; i++) { - _mesa_ubyte_to_float_color_tab[i] = (float) i / 255.0F; - } -#endif - -#ifdef USE_SPARC_ASM - _mesa_init_sparc_glapi_relocs(); -#endif - if (_mesa_getenv("MESA_DEBUG")) { - _glapi_noop_enable_warnings(GL_TRUE); - _glapi_set_warning_func( (_glapi_warning_func) _mesa_warning ); - } - else { - _glapi_noop_enable_warnings(GL_FALSE); - } - -#if defined(DEBUG) && defined(__DATE__) && defined(__TIME__) - _mesa_debug(ctx, "Mesa %s DEBUG build %s %s\n", - MESA_VERSION_STRING, __DATE__, __TIME__); -#endif - - alreadyCalled = GL_TRUE; - } - _glthread_UNLOCK_MUTEX(OneTimeLock); -} - - -/** - * Allocate and initialize a shared context state structure. - * Initializes the display list, texture objects and vertex programs hash - * tables, allocates the texture objects. If it runs out of memory, frees - * everything already allocated before returning NULL. - * - * \return pointer to a gl_shared_state structure on success, or NULL on - * failure. - */ -static GLboolean -alloc_shared_state( GLcontext *ctx ) -{ - struct gl_shared_state *ss = CALLOC_STRUCT(gl_shared_state); - if (!ss) - return GL_FALSE; - - ctx->Shared = ss; - - _glthread_INIT_MUTEX(ss->Mutex); - - ss->DisplayList = _mesa_NewHashTable(); - ss->TexObjects = _mesa_NewHashTable(); -#if FEATURE_NV_vertex_program || FEATURE_NV_fragment_program - ss->Programs = _mesa_NewHashTable(); -#endif - -#if FEATURE_ARB_vertex_program - ss->DefaultVertexProgram = ctx->Driver.NewProgram(ctx, GL_VERTEX_PROGRAM_ARB, 0); - if (!ss->DefaultVertexProgram) - goto cleanup; -#endif -#if FEATURE_ARB_fragment_program - ss->DefaultFragmentProgram = ctx->Driver.NewProgram(ctx, GL_FRAGMENT_PROGRAM_ARB, 0); - if (!ss->DefaultFragmentProgram) - goto cleanup; -#endif -#if FEATURE_ATI_fragment_shader - ss->DefaultFragmentShader = ctx->Driver.NewProgram(ctx, GL_FRAGMENT_SHADER_ATI, 0); - if (!ss->DefaultFragmentShader) - goto cleanup; -#endif - - ss->BufferObjects = _mesa_NewHashTable(); - - ss->GL2Objects = _mesa_NewHashTable (); - - ss->Default1D = (*ctx->Driver.NewTextureObject)(ctx, 0, GL_TEXTURE_1D); - if (!ss->Default1D) - goto cleanup; - - ss->Default2D = (*ctx->Driver.NewTextureObject)(ctx, 0, GL_TEXTURE_2D); - if (!ss->Default2D) - goto cleanup; - - ss->Default3D = (*ctx->Driver.NewTextureObject)(ctx, 0, GL_TEXTURE_3D); - if (!ss->Default3D) - goto cleanup; - - ss->DefaultCubeMap = (*ctx->Driver.NewTextureObject)(ctx, 0, GL_TEXTURE_CUBE_MAP_ARB); - if (!ss->DefaultCubeMap) - goto cleanup; - - ss->DefaultRect = (*ctx->Driver.NewTextureObject)(ctx, 0, GL_TEXTURE_RECTANGLE_NV); - if (!ss->DefaultRect) - goto cleanup; - - /* Effectively bind the default textures to all texture units */ - ss->Default1D->RefCount += MAX_TEXTURE_IMAGE_UNITS; - ss->Default2D->RefCount += MAX_TEXTURE_IMAGE_UNITS; - ss->Default3D->RefCount += MAX_TEXTURE_IMAGE_UNITS; - ss->DefaultCubeMap->RefCount += MAX_TEXTURE_IMAGE_UNITS; - ss->DefaultRect->RefCount += MAX_TEXTURE_IMAGE_UNITS; - -#if FEATURE_EXT_framebuffer_object - ss->FrameBuffers = _mesa_NewHashTable(); - if (!ss->FrameBuffers) - goto cleanup; - ss->RenderBuffers = _mesa_NewHashTable(); - if (!ss->RenderBuffers) - goto cleanup; -#endif - - - return GL_TRUE; - - cleanup: - /* Ran out of memory at some point. Free everything and return NULL */ - if (ss->DisplayList) - _mesa_DeleteHashTable(ss->DisplayList); - if (ss->TexObjects) - _mesa_DeleteHashTable(ss->TexObjects); -#if FEATURE_NV_vertex_program - if (ss->Programs) - _mesa_DeleteHashTable(ss->Programs); -#endif -#if FEATURE_ARB_vertex_program - if (ss->DefaultVertexProgram) - ctx->Driver.DeleteProgram(ctx, ss->DefaultVertexProgram); -#endif -#if FEATURE_ARB_fragment_program - if (ss->DefaultFragmentProgram) - ctx->Driver.DeleteProgram(ctx, ss->DefaultFragmentProgram); -#endif -#if FEATURE_ATI_fragment_shader - if (ss->DefaultFragmentShader) - ctx->Driver.DeleteProgram(ctx, ss->DefaultFragmentShader); -#endif -#if FEATURE_ARB_vertex_buffer_object - if (ss->BufferObjects) - _mesa_DeleteHashTable(ss->BufferObjects); -#endif - - if (ss->GL2Objects) - _mesa_DeleteHashTable (ss->GL2Objects); - -#if FEATURE_EXT_framebuffer_object - if (ss->FrameBuffers) - _mesa_DeleteHashTable(ss->FrameBuffers); - if (ss->RenderBuffers) - _mesa_DeleteHashTable(ss->RenderBuffers); -#endif - - if (ss->Default1D) - (*ctx->Driver.DeleteTexture)(ctx, ss->Default1D); - if (ss->Default2D) - (*ctx->Driver.DeleteTexture)(ctx, ss->Default2D); - if (ss->Default3D) - (*ctx->Driver.DeleteTexture)(ctx, ss->Default3D); - if (ss->DefaultCubeMap) - (*ctx->Driver.DeleteTexture)(ctx, ss->DefaultCubeMap); - if (ss->DefaultRect) - (*ctx->Driver.DeleteTexture)(ctx, ss->DefaultRect); - if (ss) - _mesa_free(ss); - return GL_FALSE; -} - -/** - * Deallocate a shared state context and all children structures. - * - * \param ctx GL context. - * \param ss shared state pointer. - * - * Frees the display lists, the texture objects (calling the driver texture - * deletion callback to free its private data) and the vertex programs, as well - * as their hash tables. - * - * \sa alloc_shared_state(). - */ -static void -free_shared_state( GLcontext *ctx, struct gl_shared_state *ss ) -{ - /* Free display lists */ - while (1) { - GLuint list = _mesa_HashFirstEntry(ss->DisplayList); - if (list) { - _mesa_destroy_list(ctx, list); - } - else { - break; - } - } - _mesa_DeleteHashTable(ss->DisplayList); - - /* Free texture objects */ - ASSERT(ctx->Driver.DeleteTexture); - /* the default textures */ - (*ctx->Driver.DeleteTexture)(ctx, ss->Default1D); - (*ctx->Driver.DeleteTexture)(ctx, ss->Default2D); - (*ctx->Driver.DeleteTexture)(ctx, ss->Default3D); - (*ctx->Driver.DeleteTexture)(ctx, ss->DefaultCubeMap); - (*ctx->Driver.DeleteTexture)(ctx, ss->DefaultRect); - /* all other textures */ - while (1) { - GLuint texName = _mesa_HashFirstEntry(ss->TexObjects); - if (texName) { - struct gl_texture_object *texObj = (struct gl_texture_object *) - _mesa_HashLookup(ss->TexObjects, texName); - ASSERT(texObj); - (*ctx->Driver.DeleteTexture)(ctx, texObj); - _mesa_HashRemove(ss->TexObjects, texName); - } - else { - break; - } - } - _mesa_DeleteHashTable(ss->TexObjects); - -#if FEATURE_NV_vertex_program - /* Free vertex programs */ - while (1) { - GLuint prog = _mesa_HashFirstEntry(ss->Programs); - if (prog) { - struct program *p = (struct program *) _mesa_HashLookup(ss->Programs, - prog); - ASSERT(p); - ctx->Driver.DeleteProgram(ctx, p); - _mesa_HashRemove(ss->Programs, prog); - } - else { - break; - } - } - _mesa_DeleteHashTable(ss->Programs); -#endif -#if FEATURE_ARB_vertex_program - _mesa_delete_program(ctx, ss->DefaultVertexProgram); -#endif -#if FEATURE_ARB_fragment_program - _mesa_delete_program(ctx, ss->DefaultFragmentProgram); -#endif -#if FEATURE_ATI_fragment_shader - _mesa_delete_program(ctx, ss->DefaultFragmentShader); -#endif - -#if FEATURE_ARB_vertex_buffer_object - _mesa_DeleteHashTable(ss->BufferObjects); -#endif - - _mesa_DeleteHashTable (ss->GL2Objects); - -#if FEATURE_EXT_framebuffer_object - _mesa_DeleteHashTable(ss->FrameBuffers); - _mesa_DeleteHashTable(ss->RenderBuffers); -#endif - - _glthread_DESTROY_MUTEX(ss->Mutex); - - FREE(ss); -} - - -/** - * Initialize fields of gl_current_attrib (aka ctx->Current.*) - */ -static void -_mesa_init_current( GLcontext *ctx ) -{ - GLuint i; - - /* Current group */ - for (i = 0; i < VERT_ATTRIB_MAX; i++) { - ASSIGN_4V( ctx->Current.Attrib[i], 0.0, 0.0, 0.0, 1.0 ); - } - /* special cases: */ - ASSIGN_4V( ctx->Current.Attrib[VERT_ATTRIB_WEIGHT], 1.0, 0.0, 0.0, 1.0 ); - ASSIGN_4V( ctx->Current.Attrib[VERT_ATTRIB_NORMAL], 0.0, 0.0, 1.0, 1.0 ); - ASSIGN_4V( ctx->Current.Attrib[VERT_ATTRIB_COLOR0], 1.0, 1.0, 1.0, 1.0 ); - ASSIGN_4V( ctx->Current.Attrib[VERT_ATTRIB_COLOR1], 0.0, 0.0, 0.0, 1.0 ); - ASSIGN_4V( ctx->Current.Attrib[VERT_ATTRIB_FOG], 0.0, 0.0, 0.0, 0.0 ); - - ctx->Current.Index = 1; - ctx->Current.EdgeFlag = GL_TRUE; -} - - -/** - * Initialize fields of gl_constants (aka ctx->Const.*). - * Use defaults from config.h. The device drivers will often override - * some of these values (such as number of texture units). - */ -static void -_mesa_init_constants( GLcontext *ctx ) -{ - assert(ctx); - - assert(MAX_TEXTURE_LEVELS >= MAX_3D_TEXTURE_LEVELS); - assert(MAX_TEXTURE_LEVELS >= MAX_CUBE_TEXTURE_LEVELS); - - /* Constants, may be overriden (usually only reduced) by device drivers */ - ctx->Const.MaxTextureLevels = MAX_TEXTURE_LEVELS; - ctx->Const.Max3DTextureLevels = MAX_3D_TEXTURE_LEVELS; - ctx->Const.MaxCubeTextureLevels = MAX_CUBE_TEXTURE_LEVELS; - ctx->Const.MaxTextureRectSize = MAX_TEXTURE_RECT_SIZE; - ctx->Const.MaxTextureUnits = MAX_TEXTURE_UNITS; - ctx->Const.MaxTextureCoordUnits = MAX_TEXTURE_COORD_UNITS; - ctx->Const.MaxTextureImageUnits = MAX_TEXTURE_IMAGE_UNITS; - ctx->Const.MaxTextureMaxAnisotropy = MAX_TEXTURE_MAX_ANISOTROPY; - ctx->Const.MaxTextureLodBias = MAX_TEXTURE_LOD_BIAS; - ctx->Const.MaxArrayLockSize = MAX_ARRAY_LOCK_SIZE; - ctx->Const.SubPixelBits = SUB_PIXEL_BITS; - ctx->Const.MinPointSize = MIN_POINT_SIZE; - ctx->Const.MaxPointSize = MAX_POINT_SIZE; - ctx->Const.MinPointSizeAA = MIN_POINT_SIZE; - ctx->Const.MaxPointSizeAA = MAX_POINT_SIZE; - ctx->Const.PointSizeGranularity = (GLfloat) POINT_SIZE_GRANULARITY; - ctx->Const.MinLineWidth = MIN_LINE_WIDTH; - ctx->Const.MaxLineWidth = MAX_LINE_WIDTH; - ctx->Const.MinLineWidthAA = MIN_LINE_WIDTH; - ctx->Const.MaxLineWidthAA = MAX_LINE_WIDTH; - ctx->Const.LineWidthGranularity = (GLfloat) LINE_WIDTH_GRANULARITY; - ctx->Const.MaxColorTableSize = MAX_COLOR_TABLE_SIZE; - ctx->Const.MaxConvolutionWidth = MAX_CONVOLUTION_WIDTH; - ctx->Const.MaxConvolutionHeight = MAX_CONVOLUTION_HEIGHT; - ctx->Const.MaxClipPlanes = MAX_CLIP_PLANES; - ctx->Const.MaxLights = MAX_LIGHTS; - ctx->Const.MaxShininess = 128.0; - ctx->Const.MaxSpotExponent = 128.0; - ctx->Const.MaxViewportWidth = MAX_WIDTH; - ctx->Const.MaxViewportHeight = MAX_HEIGHT; -#if FEATURE_ARB_vertex_program - ctx->Const.MaxVertexProgramInstructions = MAX_NV_VERTEX_PROGRAM_INSTRUCTIONS; - ctx->Const.MaxVertexProgramAttribs = MAX_NV_VERTEX_PROGRAM_INPUTS; - ctx->Const.MaxVertexProgramTemps = MAX_NV_VERTEX_PROGRAM_TEMPS; - ctx->Const.MaxVertexProgramLocalParams = MAX_NV_VERTEX_PROGRAM_PARAMS; - ctx->Const.MaxVertexProgramEnvParams = MAX_NV_VERTEX_PROGRAM_PARAMS;/*XXX*/ - ctx->Const.MaxVertexProgramAddressRegs = MAX_VERTEX_PROGRAM_ADDRESS_REGS; -#endif -#if FEATURE_ARB_fragment_program - ctx->Const.MaxFragmentProgramInstructions = MAX_NV_FRAGMENT_PROGRAM_INSTRUCTIONS; - ctx->Const.MaxFragmentProgramAttribs = MAX_NV_FRAGMENT_PROGRAM_INPUTS; - ctx->Const.MaxFragmentProgramTemps = MAX_NV_FRAGMENT_PROGRAM_TEMPS; - ctx->Const.MaxFragmentProgramLocalParams = MAX_NV_FRAGMENT_PROGRAM_PARAMS; - ctx->Const.MaxFragmentProgramEnvParams = MAX_NV_FRAGMENT_PROGRAM_PARAMS;/*XXX*/ - ctx->Const.MaxFragmentProgramAddressRegs = MAX_FRAGMENT_PROGRAM_ADDRESS_REGS; - ctx->Const.MaxFragmentProgramAluInstructions = MAX_FRAGMENT_PROGRAM_ALU_INSTRUCTIONS; - ctx->Const.MaxFragmentProgramTexInstructions = MAX_FRAGMENT_PROGRAM_TEX_INSTRUCTIONS; - ctx->Const.MaxFragmentProgramTexIndirections = MAX_FRAGMENT_PROGRAM_TEX_INDIRECTIONS; -#endif - - ctx->Const.MaxProgramMatrices = MAX_PROGRAM_MATRICES; - ctx->Const.MaxProgramMatrixStackDepth = MAX_PROGRAM_MATRIX_STACK_DEPTH; - - /* If we're running in the X server, do bounds checking to prevent - * segfaults and server crashes! - */ -#if defined(XFree86LOADER) && defined(IN_MODULE) - ctx->Const.CheckArrayBounds = GL_TRUE; -#else - ctx->Const.CheckArrayBounds = GL_FALSE; -#endif - - ctx->Const.MaxDrawBuffers = MAX_DRAW_BUFFERS; - - /* GL_OES_read_format */ - ctx->Const.ColorReadFormat = GL_RGBA; - ctx->Const.ColorReadType = GL_UNSIGNED_BYTE; - -#if FEATURE_EXT_framebuffer_object - ctx->Const.MaxColorAttachments = MAX_COLOR_ATTACHMENTS; - ctx->Const.MaxRenderbufferSize = MAX_WIDTH; -#endif - - /* sanity checks */ - ASSERT(ctx->Const.MaxTextureUnits == MAX2(ctx->Const.MaxTextureImageUnits, ctx->Const.MaxTextureCoordUnits)); -} - - -/** - * Initialize the attribute groups in a GL context. - * - * \param ctx GL context. - * - * Initializes all the attributes, calling the respective <tt>init*</tt> - * functions for the more complex data structures. - */ -static GLboolean -init_attrib_groups( GLcontext *ctx ) -{ - assert(ctx); - - /* Constants */ - _mesa_init_constants( ctx ); - - /* Extensions */ - _mesa_init_extensions( ctx ); - - /* Attribute Groups */ - _mesa_init_accum( ctx ); - _mesa_init_attrib( ctx ); - _mesa_init_buffer_objects( ctx ); - _mesa_init_color( ctx ); - _mesa_init_colortables( ctx ); - _mesa_init_current( ctx ); - _mesa_init_depth( ctx ); - _mesa_init_debug( ctx ); - _mesa_init_display_list( ctx ); - _mesa_init_eval( ctx ); - _mesa_init_feedback( ctx ); - _mesa_init_fog( ctx ); - _mesa_init_histogram( ctx ); - _mesa_init_hint( ctx ); - _mesa_init_line( ctx ); - _mesa_init_lighting( ctx ); - _mesa_init_matrix( ctx ); - _mesa_init_multisample( ctx ); - _mesa_init_occlude( ctx ); - _mesa_init_pixel( ctx ); - _mesa_init_point( ctx ); - _mesa_init_polygon( ctx ); - _mesa_init_program( ctx ); - _mesa_init_rastpos( ctx ); - _mesa_init_scissor( ctx ); - _mesa_init_shaderobjects (ctx); - _mesa_init_stencil( ctx ); - _mesa_init_transform( ctx ); - _mesa_init_varray( ctx ); - _mesa_init_viewport( ctx ); - - if (!_mesa_init_texture( ctx )) - return GL_FALSE; - - _mesa_init_texture_s3tc( ctx ); - _mesa_init_texture_fxt1( ctx ); - - /* Miscellaneous */ - ctx->NewState = _NEW_ALL; - ctx->ErrorValue = (GLenum) GL_NO_ERROR; - ctx->_Facing = 0; -#if CHAN_TYPE == GL_FLOAT - ctx->ClampFragmentColors = GL_FALSE; /* XXX temporary */ -#else - ctx->ClampFragmentColors = GL_TRUE; -#endif - ctx->ClampVertexColors = GL_TRUE; - - return GL_TRUE; -} - - -/** - * This is the default function we plug into all dispatch table slots - * This helps prevents a segfault when someone calls a GL function without - * first checking if the extension's supported. - */ -static int -generic_nop(void) -{ - _mesa_problem(NULL, "User called no-op dispatch function (an unsupported extension function?)"); - return 0; -} - - -/** - * Allocate and initialize a new dispatch table. - */ -static struct _glapi_table * -alloc_dispatch_table(void) -{ - /* Find the larger of Mesa's dispatch table and libGL's dispatch table. - * In practice, this'll be the same for stand-alone Mesa. But for DRI - * Mesa we do this to accomodate different versions of libGL and various - * DRI drivers. - */ - GLint numEntries = MAX2(_glapi_get_dispatch_table_size(), - sizeof(struct _glapi_table) / sizeof(_glapi_proc)); - struct _glapi_table *table = - (struct _glapi_table *) _mesa_malloc(numEntries * sizeof(_glapi_proc)); - if (table) { - _glapi_proc *entry = (_glapi_proc *) table; - GLint i; - for (i = 0; i < numEntries; i++) { - entry[i] = (_glapi_proc) generic_nop; - } - } - return table; -} - - -/** - * Initialize a GLcontext struct (rendering context). - * - * This includes allocating all the other structs and arrays which hang off of - * the context by pointers. - * Note that the driver needs to pass in its dd_function_table here since - * we need to at least call driverFunctions->NewTextureObject to create the - * default texture objects. - * - * Called by _mesa_create_context(). - * - * Performs the imports and exports callback tables initialization, and - * miscellaneous one-time initializations. If no shared context is supplied one - * is allocated, and increase its reference count. Setups the GL API dispatch - * tables. Initialize the TNL module. Sets the maximum Z buffer depth. - * Finally queries the \c MESA_DEBUG and \c MESA_VERBOSE environment variables - * for debug flags. - * - * \param ctx the context to initialize - * \param visual describes the visual attributes for this context - * \param share_list points to context to share textures, display lists, - * etc with, or NULL - * \param driverFunctions table of device driver functions for this context - * to use - * \param driverContext pointer to driver-specific context data - */ -GLboolean -_mesa_initialize_context( GLcontext *ctx, - const GLvisual *visual, - GLcontext *share_list, - const struct dd_function_table *driverFunctions, - void *driverContext ) -{ - ASSERT(driverContext); - assert(driverFunctions->NewTextureObject); - assert(driverFunctions->FreeTexImageData); - - /* If the driver wants core Mesa to use special imports, it'll have to - * override these defaults. - */ - _mesa_init_default_imports( &(ctx->imports), driverContext ); - - /* initialize the exports (Mesa functions called by the window system) */ - _mesa_init_default_exports( &(ctx->exports) ); - - /* misc one-time initializations */ - one_time_init(ctx); - - ctx->Visual = *visual; - ctx->DrawBuffer = NULL; - ctx->ReadBuffer = NULL; - ctx->WinSysDrawBuffer = NULL; - ctx->WinSysReadBuffer = NULL; - - /* Plug in driver functions and context pointer here. - * This is important because when we call alloc_shared_state() below - * we'll call ctx->Driver.NewTextureObject() to create the default - * textures. - */ - ctx->Driver = *driverFunctions; - ctx->DriverCtx = driverContext; - - if (share_list) { - /* share state with another context */ - ctx->Shared = share_list->Shared; - } - else { - /* allocate new, unshared state */ - if (!alloc_shared_state( ctx )) { - return GL_FALSE; - } - } - _glthread_LOCK_MUTEX(ctx->Shared->Mutex); - ctx->Shared->RefCount++; - _glthread_UNLOCK_MUTEX(ctx->Shared->Mutex); - - if (!init_attrib_groups( ctx )) { - free_shared_state(ctx, ctx->Shared); - return GL_FALSE; - } - - /* setup the API dispatch tables */ - ctx->Exec = alloc_dispatch_table(); - ctx->Save = alloc_dispatch_table(); - if (!ctx->Exec || !ctx->Save) { - free_shared_state(ctx, ctx->Shared); - if (ctx->Exec) - _mesa_free(ctx->Exec); - } - _mesa_init_exec_table(ctx->Exec); - ctx->CurrentDispatch = ctx->Exec; -#if _HAVE_FULL_GL - _mesa_init_dlist_table(ctx->Save); - _mesa_install_save_vtxfmt( ctx, &ctx->ListState.ListVtxfmt ); - /* Neutral tnl module stuff */ - _mesa_init_exec_vtxfmt( ctx ); - ctx->TnlModule.Current = NULL; - ctx->TnlModule.SwapCount = 0; -#endif - - ctx->_MaintainTexEnvProgram = (_mesa_getenv("MESA_TEX_PROG") != NULL); - ctx->_MaintainTnlProgram = (_mesa_getenv("MESA_TNL_PROG") != NULL); - - return GL_TRUE; -} - - -/** - * Allocate and initialize a GLcontext structure. - * Note that the driver needs to pass in its dd_function_table here since - * we need to at least call driverFunctions->NewTextureObject to initialize - * the rendering context. - * - * \param visual a GLvisual pointer (we copy the struct contents) - * \param share_list another context to share display lists with or NULL - * \param driverFunctions points to the dd_function_table into which the - * driver has plugged in all its special functions. - * \param driverCtx points to the device driver's private context state - * - * \return pointer to a new __GLcontextRec or NULL if error. - */ -GLcontext * -_mesa_create_context( const GLvisual *visual, - GLcontext *share_list, - const struct dd_function_table *driverFunctions, - void *driverContext ) - -{ - GLcontext *ctx; - - ASSERT(visual); - ASSERT(driverContext); - - ctx = (GLcontext *) _mesa_calloc(sizeof(GLcontext)); - if (!ctx) - return NULL; - - if (_mesa_initialize_context(ctx, visual, share_list, - driverFunctions, driverContext)) { - return ctx; - } - else { - _mesa_free(ctx); - return NULL; - } -} - - -/** - * Free the data associated with the given context. - * - * But doesn't free the GLcontext struct itself. - * - * \sa _mesa_initialize_context() and init_attrib_groups(). - */ -void -_mesa_free_context_data( GLcontext *ctx ) -{ - /* if we're destroying the current context, unbind it first */ - if (ctx == _mesa_get_current_context()) { - _mesa_make_current(NULL, NULL, NULL); - } - - _mesa_free_lighting_data( ctx ); - _mesa_free_eval_data( ctx ); - _mesa_free_texture_data( ctx ); - _mesa_free_matrix_data( ctx ); - _mesa_free_viewport_data( ctx ); - _mesa_free_colortables_data( ctx ); - _mesa_free_program_data(ctx); - _mesa_free_occlude_data(ctx); - -#if FEATURE_ARB_vertex_buffer_object - _mesa_delete_buffer_object(ctx, ctx->Array.NullBufferObj); -#endif - - /* free dispatch tables */ - _mesa_free(ctx->Exec); - _mesa_free(ctx->Save); - - /* Shared context state (display lists, textures, etc) */ - _glthread_LOCK_MUTEX(ctx->Shared->Mutex); - ctx->Shared->RefCount--; - assert(ctx->Shared->RefCount >= 0); - _glthread_UNLOCK_MUTEX(ctx->Shared->Mutex); - if (ctx->Shared->RefCount == 0) { - /* free shared state */ - free_shared_state( ctx, ctx->Shared ); - } - - if (ctx->Extensions.String) - FREE((void *) ctx->Extensions.String); -} - - -/** - * Destroy a GLcontext structure. - * - * \param ctx GL context. - * - * Calls _mesa_free_context_data() and frees the GLcontext structure itself. - */ -void -_mesa_destroy_context( GLcontext *ctx ) -{ - if (ctx) { - _mesa_free_context_data(ctx); - FREE( (void *) ctx ); - } -} - - -#if _HAVE_FULL_GL -/** - * Copy attribute groups from one context to another. - * - * \param src source context - * \param dst destination context - * \param mask bitwise OR of GL_*_BIT flags - * - * According to the bits specified in \p mask, copies the corresponding - * attributes from \p src into \p dst. For many of the attributes a simple \c - * memcpy is not enough due to the existence of internal pointers in their data - * structures. - */ -void -_mesa_copy_context( const GLcontext *src, GLcontext *dst, GLuint mask ) -{ - if (mask & GL_ACCUM_BUFFER_BIT) { - /* OK to memcpy */ - dst->Accum = src->Accum; - } - if (mask & GL_COLOR_BUFFER_BIT) { - /* OK to memcpy */ - dst->Color = src->Color; - } - if (mask & GL_CURRENT_BIT) { - /* OK to memcpy */ - dst->Current = src->Current; - } - if (mask & GL_DEPTH_BUFFER_BIT) { - /* OK to memcpy */ - dst->Depth = src->Depth; - } - if (mask & GL_ENABLE_BIT) { - /* no op */ - } - if (mask & GL_EVAL_BIT) { - /* OK to memcpy */ - dst->Eval = src->Eval; - } - if (mask & GL_FOG_BIT) { - /* OK to memcpy */ - dst->Fog = src->Fog; - } - if (mask & GL_HINT_BIT) { - /* OK to memcpy */ - dst->Hint = src->Hint; - } - if (mask & GL_LIGHTING_BIT) { - GLuint i; - /* begin with memcpy */ - MEMCPY( &dst->Light, &src->Light, sizeof(struct gl_light) ); - /* fixup linked lists to prevent pointer insanity */ - make_empty_list( &(dst->Light.EnabledList) ); - for (i = 0; i < MAX_LIGHTS; i++) { - if (dst->Light.Light[i].Enabled) { - insert_at_tail(&(dst->Light.EnabledList), &(dst->Light.Light[i])); - } - } - } - if (mask & GL_LINE_BIT) { - /* OK to memcpy */ - dst->Line = src->Line; - } - if (mask & GL_LIST_BIT) { - /* OK to memcpy */ - dst->List = src->List; - } - if (mask & GL_PIXEL_MODE_BIT) { - /* OK to memcpy */ - dst->Pixel = src->Pixel; - } - if (mask & GL_POINT_BIT) { - /* OK to memcpy */ - dst->Point = src->Point; - } - if (mask & GL_POLYGON_BIT) { - /* OK to memcpy */ - dst->Polygon = src->Polygon; - } - if (mask & GL_POLYGON_STIPPLE_BIT) { - /* Use loop instead of MEMCPY due to problem with Portland Group's - * C compiler. Reported by John Stone. - */ - GLuint i; - for (i = 0; i < 32; i++) { - dst->PolygonStipple[i] = src->PolygonStipple[i]; - } - } - if (mask & GL_SCISSOR_BIT) { - /* OK to memcpy */ - dst->Scissor = src->Scissor; - } - if (mask & GL_STENCIL_BUFFER_BIT) { - /* OK to memcpy */ - dst->Stencil = src->Stencil; - } - if (mask & GL_TEXTURE_BIT) { - /* Cannot memcpy because of pointers */ - _mesa_copy_texture_state(src, dst); - } - if (mask & GL_TRANSFORM_BIT) { - /* OK to memcpy */ - dst->Transform = src->Transform; - } - if (mask & GL_VIEWPORT_BIT) { - /* Cannot use memcpy, because of pointers in GLmatrix _WindowMap */ - dst->Viewport.X = src->Viewport.X; - dst->Viewport.Y = src->Viewport.Y; - dst->Viewport.Width = src->Viewport.Width; - dst->Viewport.Height = src->Viewport.Height; - dst->Viewport.Near = src->Viewport.Near; - dst->Viewport.Far = src->Viewport.Far; - _math_matrix_copy(&dst->Viewport._WindowMap, &src->Viewport._WindowMap); - } - - /* XXX FIXME: Call callbacks? - */ - dst->NewState = _NEW_ALL; -} -#endif - - -/** - * Check if the given context can render into the given framebuffer - * by checking visual attributes. - * \return GL_TRUE if compatible, GL_FALSE otherwise. - */ -static GLboolean -check_compatible(const GLcontext *ctx, const GLframebuffer *buffer) -{ - const GLvisual *ctxvis = &ctx->Visual; - const GLvisual *bufvis = &buffer->Visual; - - if (ctxvis == bufvis) - return GL_TRUE; - - if (ctxvis->rgbMode != bufvis->rgbMode) - return GL_FALSE; - if (ctxvis->doubleBufferMode && !bufvis->doubleBufferMode) - return GL_FALSE; - if (ctxvis->stereoMode && !bufvis->stereoMode) - return GL_FALSE; - if (ctxvis->haveAccumBuffer && !bufvis->haveAccumBuffer) - return GL_FALSE; - if (ctxvis->haveDepthBuffer && !bufvis->haveDepthBuffer) - return GL_FALSE; - if (ctxvis->haveStencilBuffer && !bufvis->haveStencilBuffer) - return GL_FALSE; - if (ctxvis->redMask && ctxvis->redMask != bufvis->redMask) - return GL_FALSE; - if (ctxvis->greenMask && ctxvis->greenMask != bufvis->greenMask) - return GL_FALSE; - if (ctxvis->blueMask && ctxvis->blueMask != bufvis->blueMask) - return GL_FALSE; - if (ctxvis->depthBits && ctxvis->depthBits != bufvis->depthBits) - return GL_FALSE; - if (ctxvis->stencilBits && ctxvis->stencilBits != bufvis->stencilBits) - return GL_FALSE; - - return GL_TRUE; -} - - -/** - * Bind the given context to the given draw-buffer and read-buffer and - * make it the current context for this thread. - * - * \param newCtx new GL context. If NULL then there will be no current GL - * context. - * \param drawBuffer draw framebuffer. - * \param readBuffer read framebuffer. - * - * Check that the context's and framebuffer's visuals are compatible, returning - * immediately otherwise. Sets the glapi current context via - * _glapi_set_context(). If \p newCtx is not NULL, associates \p drawBuffer and - * \p readBuffer with it and calls dd_function_table::ResizeBuffers if the buffers size has changed. - * Calls dd_function_table::MakeCurrent callback if defined. - * - * When a context is bound by the first time and the \c MESA_INFO environment - * variable is set it calls print_info() as an aid for remote user - * troubleshooting. - */ -void -_mesa_make_current( GLcontext *newCtx, GLframebuffer *drawBuffer, - GLframebuffer *readBuffer ) -{ - if (MESA_VERBOSE & VERBOSE_API) - _mesa_debug(newCtx, "_mesa_make_current()\n"); - - /* Check that the context's and framebuffer's visuals are compatible. - */ - if (newCtx && drawBuffer && newCtx->DrawBuffer != drawBuffer) { - if (!check_compatible(newCtx, drawBuffer)) - return; - } - if (newCtx && readBuffer && newCtx->ReadBuffer != readBuffer) { - if (!check_compatible(newCtx, readBuffer)) - return; - } - -#if !defined(IN_DRI_DRIVER) - /* We call this function periodically (just here for now) in - * order to detect when multithreading has begun. In a DRI driver, this - * step is done by the driver loader (e.g., libGL). - */ - _glapi_check_multithread(); -#endif /* !defined(IN_DRI_DRIVER) */ - - _glapi_set_context((void *) newCtx); - ASSERT(_mesa_get_current_context() == newCtx); - - if (!newCtx) { - _glapi_set_dispatch(NULL); /* none current */ - } - else { - _glapi_set_dispatch(newCtx->CurrentDispatch); - - if (drawBuffer && readBuffer) { - /* TODO: check if newCtx and buffer's visual match??? */ - - ASSERT(drawBuffer->Name == 0); - ASSERT(readBuffer->Name == 0); - newCtx->WinSysDrawBuffer = drawBuffer; - newCtx->WinSysReadBuffer = readBuffer; - /* don't replace user-buffer bindings with window system buffer */ - if (!newCtx->DrawBuffer || newCtx->DrawBuffer->Name == 0) { - newCtx->DrawBuffer = drawBuffer; - newCtx->ReadBuffer = readBuffer; - } - - newCtx->NewState |= _NEW_BUFFERS; - -#if _HAVE_FULL_GL - if (!drawBuffer->Initialized) { - /* get initial window size */ - GLuint bufWidth, bufHeight; - /* ask device driver for size of the buffer */ - (*newCtx->Driver.GetBufferSize)(drawBuffer, &bufWidth, &bufHeight); - /* set initial buffer size */ - if (newCtx->Driver.ResizeBuffers) - newCtx->Driver.ResizeBuffers(newCtx, drawBuffer, - bufWidth, bufHeight); - drawBuffer->Initialized = GL_TRUE; - } - - if (readBuffer != drawBuffer && !readBuffer->Initialized) { - /* get initial window size */ - GLuint bufWidth, bufHeight; - /* ask device driver for size of the buffer */ - (*newCtx->Driver.GetBufferSize)(readBuffer, &bufWidth, &bufHeight); - /* set initial buffer size */ - if (newCtx->Driver.ResizeBuffers) - newCtx->Driver.ResizeBuffers(newCtx, readBuffer, - bufWidth, bufHeight); - readBuffer->Initialized = GL_TRUE; - } -#endif - if (newCtx->FirstTimeCurrent) { - /* set initial viewport and scissor size now */ - _mesa_set_viewport(newCtx, 0, 0, drawBuffer->Width, drawBuffer->Height); - newCtx->Scissor.Width = drawBuffer->Width; - newCtx->Scissor.Height = drawBuffer->Height; - } - } - - /* Alert the driver - usually passed on to the sw t&l module, - * but also used to detect threaded cases in the radeon codegen - * hw t&l module. - */ - if (newCtx->Driver.MakeCurrent) - newCtx->Driver.MakeCurrent( newCtx, drawBuffer, readBuffer ); - - /* We can use this to help debug user's problems. Tell them to set - * the MESA_INFO env variable before running their app. Then the - * first time each context is made current we'll print some useful - * information. - */ - if (newCtx->FirstTimeCurrent) { - if (_mesa_getenv("MESA_INFO")) { - _mesa_print_info(); - } - newCtx->FirstTimeCurrent = GL_FALSE; - } - } -} - - -/** - * Make context 'ctx' share the display lists, textures and programs - * that are associated with 'ctxToShare'. - * Any display lists, textures or programs associated with 'ctx' will - * be deleted if nobody else is sharing them. - */ -GLboolean -_mesa_share_state(GLcontext *ctx, GLcontext *ctxToShare) -{ - if (ctx && ctxToShare && ctx->Shared && ctxToShare->Shared) { - ctx->Shared->RefCount--; - if (ctx->Shared->RefCount == 0) { - free_shared_state(ctx, ctx->Shared); - } - ctx->Shared = ctxToShare->Shared; - ctx->Shared->RefCount++; - return GL_TRUE; - } - else { - return GL_FALSE; - } -} - - - -/** - * Get current context for the calling thread. - * - * \return pointer to the current GL context. - * - * Calls _glapi_get_context(). This isn't the fastest way to get the current - * context. If you need speed, see the #GET_CURRENT_CONTEXT macro in context.h. - */ -GLcontext * -_mesa_get_current_context( void ) -{ - return (GLcontext *) _glapi_get_context(); -} - -/** - * Get context's current API dispatch table. - * - * It'll either be the immediate-mode execute dispatcher or the display list - * compile dispatcher. - * - * \param ctx GL context. - * - * \return pointer to dispatch_table. - * - * Simply returns __GLcontextRec::CurrentDispatch. - */ -struct _glapi_table * -_mesa_get_dispatch(GLcontext *ctx) -{ - return ctx->CurrentDispatch; -} - -/*@}*/ - - -/**********************************************************************/ -/** \name Miscellaneous functions */ -/**********************************************************************/ -/*@{*/ - -/** - * Record an error. - * - * \param ctx GL context. - * \param error error code. - * - * Records the given error code and call the driver's dd_function_table::Error - * function if defined. - * - * \sa - * This is called via _mesa_error(). - */ -void -_mesa_record_error( GLcontext *ctx, GLenum error ) -{ - if (!ctx) - return; - - if (ctx->ErrorValue == GL_NO_ERROR) { - ctx->ErrorValue = error; - } - - /* Call device driver's error handler, if any. This is used on the Mac. */ - if (ctx->Driver.Error) { - (*ctx->Driver.Error)( ctx ); - } -} - -/** - * Execute glFinish(). - * - * Calls the #ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH macro and the - * dd_function_table::Finish driver callback, if not NULL. - */ -void GLAPIENTRY -_mesa_Finish( void ) -{ - GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); - if (ctx->Driver.Finish) { - (*ctx->Driver.Finish)( ctx ); - } -} - -/** - * Execute glFlush(). - * - * Calls the #ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH macro and the - * dd_function_table::Flush driver callback, if not NULL. - */ -void GLAPIENTRY -_mesa_Flush( void ) -{ - GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); - if (ctx->Driver.Flush) { - (*ctx->Driver.Flush)( ctx ); - } -} - - -/*@}*/ diff --git a/nx-X11/extras/Mesa/src/mesa/main/descrip.mms b/nx-X11/extras/Mesa/src/mesa/main/descrip.mms deleted file mode 100644 index ce298229c..000000000 --- a/nx-X11/extras/Mesa/src/mesa/main/descrip.mms +++ /dev/null @@ -1,210 +0,0 @@ -# Makefile for core library for VMS -# contributed by Jouk Jansen joukj@hrem.stm.tudelft.nl -# Last revision : 10 May 2005 - -.first - define gl [---.include.gl] - define math [-.math] - define shader [-.shader] - -.include [---]mms-config. - -##### MACROS ##### - -VPATH = RCS - -INCDIR = [---.include],[-.glapi],[-.shader] -LIBDIR = [---.lib] -CFLAGS = /include=($(INCDIR),[])/define=(PTHREADS=1)/name=(as_is,short) - -SOURCES =accum.c \ - api_arrayelt.c \ - api_loopback.c \ - api_noop.c \ - api_validate.c \ - attrib.c \ - blend.c \ - bufferobj.c \ - buffers.c \ - clip.c \ - colortab.c \ - context.c \ - convolve.c \ - debug.c \ - depth.c \ - dispatch.c \ - dlist.c \ - drawpix.c \ - enable.c \ - enums.c \ - eval.c \ - execmem.c \ - extensions.c \ - fbobject.c \ - feedback.c \ - fog.c \ - framebuffer.c \ - get.c \ - getstring.c \ - hash.c \ - hint.c \ - histogram.c \ - image.c \ - imports.c \ - light.c \ - lines.c \ - matrix.c \ - mm.c \ - occlude.c \ - pixel.c \ - points.c \ - polygon.c \ - rastpos.c \ - renderbuffer.c \ - state.c \ - stencil.c \ - texcompress.c \ - texcompress_fxt1.c \ - texcompress_s3tc.c \ - texenvprogram.c \ - texformat.c \ - teximage.c \ - texobj.c \ - texrender.c \ - texstate.c \ - texstore.c \ - varray.c \ - vtxfmt.c - -OBJECTS=accum.obj,\ -api_arrayelt.obj,\ -api_loopback.obj,\ -api_noop.obj,\ -api_validate.obj,\ -attrib.obj,\ -blend.obj,\ -bufferobj.obj,\ -buffers.obj,\ -clip.obj,\ -colortab.obj,\ -context.obj,\ -convolve.obj,\ -debug.obj,\ -depth.obj,\ -dispatch.obj,\ -dlist.obj,\ -drawpix.obj,\ -enable.obj,\ -enums.obj,\ -eval.obj,\ -execmem.obj,\ -extensions.obj,\ -fbobject.obj,\ -feedback.obj,\ -fog.obj,\ -framebuffer.obj,\ -get.obj,\ -getstring.obj,\ -hash.obj,\ -hint.obj,\ -histogram.obj,\ -image.obj,\ -imports.obj,\ -light.obj,\ -lines.obj,\ -matrix.obj,\ -mm.obj,\ -occlude.obj,\ -pixel.obj,\ -points.obj,\ -polygon.obj,\ -rastpos.obj,\ -renderbuffer.obj,\ -state.obj,\ -stencil.obj,\ -texcompress.obj,\ -texcompress_fxt1.obj,\ -texcompress_s3tc.obj,\ -texenvprogram.obj,\ -texformat.obj,\ -teximage.obj,\ -texobj.obj,\ -texrender.obj,\ -texstate.obj,\ -texstore.obj,\ -varray.obj,\ -vtxfmt.obj - -##### RULES ##### - -VERSION=Mesa V3.4 - -##### TARGETS ##### -# Make the library -$(LIBDIR)$(GL_LIB) : $(OBJECTS) - @ $(MAKELIB) $(GL_LIB) $(OBJECTS) - @ rename $(GL_LIB)* $(LIBDIR) - -clean : - purge - delete *.obj;* - -accum.obj : accum.c -api_arrayelt.obj : api_arrayelt.c -api_loopback.obj : api_loopback.c -api_noop.obj : api_noop.c -api_validate.obj : api_validate.c -attrib.obj : attrib.c -blend.obj : blend.c -bufferobj.obj : bufferobj.c -buffers.obj : buffers.c -clip.obj : clip.c -colortab.obj : colortab.c -context.obj : context.c -convolve.obj : convolve.c -debug.obj : debug.c -depth.obj : depth.c -dispatch.obj : dispatch.c -dlist.obj : dlist.c -drawpix.obj : drawpix.c -enable.obj : enable.c -enums.obj : enums.c -eval.obj : eval.c -execmem.obj : execmem.c -extensions.obj : extensions.c -fbobject.obj : fbobject.c -feedback.obj : feedback.c -fog.obj : fog.c -framebuffer.obj : framebuffer.c -get.obj : get.c -getstring.obj : getstring.c -hash.obj : hash.c -hint.obj : hint.c -histogram.obj : histogram.c -image.obj : image.c -imports.obj : imports.c vsnprintf.c -light.obj : light.c -lines.obj : lines.c -matrix.obj : matrix.c -mm.obj: mm.c -occlude.obj : occlude.c -pixel.obj : pixel.c -points.obj : points.c -polygon.obj : polygon.c -rastpos.obj : rastpos.c -renderbuffer.obj : renderbuffer.c -state.obj : state.c -stencil.obj : stencil.c -texcompress.obj : texcompress.c -texcompress_fxt1.obj : texcompress_fxt1.c - cc$(CFLAGS)/warn=(disable=SHIFTCOUNT) texcompress_fxt1.c -texcompress_s3tc.obj : texcompress_s3tc.c -texenvprogram.obj : texenvprogram.c -texformat.obj : texformat.c -teximage.obj : teximage.c -texobj.obj : texobj.c -texrender.obj : texrender.c -texstate.obj : texstate.c -texstore.obj : texstore.c -varray.obj : varray.c -vtxfmt.obj : vtxfmt.c diff --git a/nx-X11/extras/Mesa/src/mesa/main/get_gen.py b/nx-X11/extras/Mesa/src/mesa/main/get_gen.py deleted file mode 100644 index 32a5a3d77..000000000 --- a/nx-X11/extras/Mesa/src/mesa/main/get_gen.py +++ /dev/null @@ -1,1200 +0,0 @@ -#!/usr/bin/env python - -# Mesa 3-D graphics library -# -# Copyright (C) 1999-2005 Brian Paul All Rights Reserved. -# -# Permission is hereby granted, free of charge, to any person obtaining a -# copy of this software and associated documentation files (the "Software"), -# to deal in the Software without restriction, including without limitation -# the rights to use, copy, modify, merge, publish, distribute, sublicense, -# and/or sell copies of the Software, and to permit persons to whom the -# Software is furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included -# in all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -# BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - - -# This script is used to generate the get.c file: -# python get_gen.py > get.c - - -import string - - -GLint = 1 -GLenum = 2 -GLfloat = 3 -GLdouble = 4 -GLboolean = 5 -GLfloatN = 6 # A normalized value, such as a color or depth range - - -TypeStrings = { - GLint : "GLint", - GLenum : "GLenum", - GLfloat : "GLfloat", - GLdouble : "GLdouble", - GLboolean : "GLboolean" -} - - -# Each entry is a tuple of: -# - the GL state name, such as GL_CURRENT_COLOR -# - the state datatype, one of GLint, GLfloat, GLboolean or GLenum -# - list of code fragments to get the state, such as ["ctx->Foo.Bar"] -# - optional extra code or empty string -# - optional extension to check, or None (XXX this should be a list!) -# -StateVars = [ - ( "GL_ACCUM_RED_BITS", GLint, ["ctx->DrawBuffer->Visual.accumRedBits"], - "", None ), - ( "GL_ACCUM_GREEN_BITS", GLint, ["ctx->DrawBuffer->Visual.accumGreenBits"], - "", None ), - ( "GL_ACCUM_BLUE_BITS", GLint, ["ctx->DrawBuffer->Visual.accumBlueBits"], - "", None ), - ( "GL_ACCUM_ALPHA_BITS", GLint, ["ctx->DrawBuffer->Visual.accumAlphaBits"], - "", None ), - ( "GL_ACCUM_CLEAR_VALUE", GLfloatN, - [ "ctx->Accum.ClearColor[0]", - "ctx->Accum.ClearColor[1]", - "ctx->Accum.ClearColor[2]", - "ctx->Accum.ClearColor[3]" ], - "", None ), - ( "GL_ALPHA_BIAS", GLfloat, ["ctx->Pixel.AlphaBias"], "", None ), - ( "GL_ALPHA_BITS", GLint, ["ctx->DrawBuffer->Visual.alphaBits"], - "", None ), - ( "GL_ALPHA_SCALE", GLfloat, ["ctx->Pixel.AlphaScale"], "", None ), - ( "GL_ALPHA_TEST", GLboolean, ["ctx->Color.AlphaEnabled"], "", None ), - ( "GL_ALPHA_TEST_FUNC", GLenum, ["ctx->Color.AlphaFunc"], "", None ), - ( "GL_ALPHA_TEST_REF", GLfloatN, ["ctx->Color.AlphaRef"], "", None ), - ( "GL_ATTRIB_STACK_DEPTH", GLint, ["ctx->AttribStackDepth"], "", None ), - ( "GL_AUTO_NORMAL", GLboolean, ["ctx->Eval.AutoNormal"], "", None ), - ( "GL_AUX_BUFFERS", GLint, ["ctx->DrawBuffer->Visual.numAuxBuffers"], - "", None ), - ( "GL_BLEND", GLboolean, ["ctx->Color.BlendEnabled"], "", None ), - ( "GL_BLEND_DST", GLenum, ["ctx->Color.BlendDstRGB"], "", None ), - ( "GL_BLEND_SRC", GLenum, ["ctx->Color.BlendSrcRGB"], "", None ), - ( "GL_BLEND_SRC_RGB_EXT", GLenum, ["ctx->Color.BlendSrcRGB"], "", None ), - ( "GL_BLEND_DST_RGB_EXT", GLenum, ["ctx->Color.BlendDstRGB"], "", None ), - ( "GL_BLEND_SRC_ALPHA_EXT", GLenum, ["ctx->Color.BlendSrcA"], "", None ), - ( "GL_BLEND_DST_ALPHA_EXT", GLenum, ["ctx->Color.BlendDstA"], "", None ), - ( "GL_BLEND_EQUATION", GLenum, ["ctx->Color.BlendEquationRGB "], "", None), - ( "GL_BLEND_EQUATION_ALPHA_EXT", GLenum, ["ctx->Color.BlendEquationA "], - "", None ), - ( "GL_BLEND_COLOR_EXT", GLfloatN, - [ "ctx->Color.BlendColor[0]", - "ctx->Color.BlendColor[1]", - "ctx->Color.BlendColor[2]", - "ctx->Color.BlendColor[3]"], "", None ), - ( "GL_BLUE_BIAS", GLfloat, ["ctx->Pixel.BlueBias"], "", None ), - ( "GL_BLUE_BITS", GLint, ["ctx->DrawBuffer->Visual.blueBits"], "", None ), - ( "GL_BLUE_SCALE", GLfloat, ["ctx->Pixel.BlueScale"], "", None ), - ( "GL_CLIENT_ATTRIB_STACK_DEPTH", GLint, - ["ctx->ClientAttribStackDepth"], "", None ), - ( "GL_CLIP_PLANE0", GLboolean, - [ "(ctx->Transform.ClipPlanesEnabled >> 0) & 1" ], "", None ), - ( "GL_CLIP_PLANE1", GLboolean, - [ "(ctx->Transform.ClipPlanesEnabled >> 1) & 1" ], "", None ), - ( "GL_CLIP_PLANE2", GLboolean, - [ "(ctx->Transform.ClipPlanesEnabled >> 2) & 1" ], "", None ), - ( "GL_CLIP_PLANE3", GLboolean, - [ "(ctx->Transform.ClipPlanesEnabled >> 3) & 1" ], "", None ), - ( "GL_CLIP_PLANE4", GLboolean, - [ "(ctx->Transform.ClipPlanesEnabled >> 4) & 1" ], "", None ), - ( "GL_CLIP_PLANE5", GLboolean, - [ "(ctx->Transform.ClipPlanesEnabled >> 5) & 1" ], "", None ), - ( "GL_COLOR_CLEAR_VALUE", GLfloatN, - [ "ctx->Color.ClearColor[0]", - "ctx->Color.ClearColor[1]", - "ctx->Color.ClearColor[2]", - "ctx->Color.ClearColor[3]" ], "", None ), - ( "GL_COLOR_MATERIAL", GLboolean, - ["ctx->Light.ColorMaterialEnabled"], "", None ), - ( "GL_COLOR_MATERIAL_FACE", GLenum, - ["ctx->Light.ColorMaterialFace"], "", None ), - ( "GL_COLOR_MATERIAL_PARAMETER", GLenum, - ["ctx->Light.ColorMaterialMode"], "", None ), - ( "GL_COLOR_WRITEMASK", GLint, - [ "ctx->Color.ColorMask[RCOMP] ? 1 : 0", - "ctx->Color.ColorMask[GCOMP] ? 1 : 0", - "ctx->Color.ColorMask[BCOMP] ? 1 : 0", - "ctx->Color.ColorMask[ACOMP] ? 1 : 0" ], "", None ), - ( "GL_CULL_FACE", GLboolean, ["ctx->Polygon.CullFlag"], "", None ), - ( "GL_CULL_FACE_MODE", GLenum, ["ctx->Polygon.CullFaceMode"], "", None ), - ( "GL_CURRENT_COLOR", GLfloatN, - [ "ctx->Current.Attrib[VERT_ATTRIB_COLOR0][0]", - "ctx->Current.Attrib[VERT_ATTRIB_COLOR0][1]", - "ctx->Current.Attrib[VERT_ATTRIB_COLOR0][2]", - "ctx->Current.Attrib[VERT_ATTRIB_COLOR0][3]" ], - "FLUSH_CURRENT(ctx, 0);", None ), - ( "GL_CURRENT_INDEX", GLfloat, ["ctx->Current.Index"], - "FLUSH_CURRENT(ctx, 0);", None ), - ( "GL_CURRENT_NORMAL", GLfloatN, - [ "ctx->Current.Attrib[VERT_ATTRIB_NORMAL][0]", - "ctx->Current.Attrib[VERT_ATTRIB_NORMAL][1]", - "ctx->Current.Attrib[VERT_ATTRIB_NORMAL][2]"], - "FLUSH_CURRENT(ctx, 0);", None ), - ( "GL_CURRENT_RASTER_COLOR", GLfloatN, - ["ctx->Current.RasterColor[0]", - "ctx->Current.RasterColor[1]", - "ctx->Current.RasterColor[2]", - "ctx->Current.RasterColor[3]"], "", None ), - ( "GL_CURRENT_RASTER_DISTANCE", GLfloat, - ["ctx->Current.RasterDistance"], "", None ), - ( "GL_CURRENT_RASTER_INDEX", GLfloat, - ["ctx->Current.RasterIndex"], "", None ), - ( "GL_CURRENT_RASTER_POSITION", GLfloat, - ["ctx->Current.RasterPos[0]", - "ctx->Current.RasterPos[1]", - "ctx->Current.RasterPos[2]", - "ctx->Current.RasterPos[3]"], "", None ), - ( "GL_CURRENT_RASTER_TEXTURE_COORDS", GLfloat, - ["ctx->Current.RasterTexCoords[texUnit][0]", - "ctx->Current.RasterTexCoords[texUnit][1]", - "ctx->Current.RasterTexCoords[texUnit][2]", - "ctx->Current.RasterTexCoords[texUnit][3]"], - "const GLuint texUnit = ctx->Texture.CurrentUnit;", None ), - ( "GL_CURRENT_RASTER_POSITION_VALID", GLboolean, - ["ctx->Current.RasterPosValid"], "", None ), - ( "GL_CURRENT_TEXTURE_COORDS", GLfloat, - ["ctx->Current.Attrib[VERT_ATTRIB_TEX0 + texUnit][0]", - "ctx->Current.Attrib[VERT_ATTRIB_TEX0 + texUnit][1]", - "ctx->Current.Attrib[VERT_ATTRIB_TEX0 + texUnit][2]", - "ctx->Current.Attrib[VERT_ATTRIB_TEX0 + texUnit][3]"], - "const GLuint texUnit = ctx->Texture.CurrentUnit;", None ), - ( "GL_DEPTH_BIAS", GLfloat, ["ctx->Pixel.DepthBias"], "", None ), - ( "GL_DEPTH_BITS", GLint, ["ctx->DrawBuffer->Visual.depthBits"], - "", None ), - ( "GL_DEPTH_CLEAR_VALUE", GLfloat, ["ctx->Depth.Clear"], "", None ), - ( "GL_DEPTH_FUNC", GLenum, ["ctx->Depth.Func"], "", None ), - ( "GL_DEPTH_RANGE", GLfloatN, - [ "ctx->Viewport.Near", "ctx->Viewport.Far" ], "", None ), - ( "GL_DEPTH_SCALE", GLfloat, ["ctx->Pixel.DepthScale"], "", None ), - ( "GL_DEPTH_TEST", GLboolean, ["ctx->Depth.Test"], "", None ), - ( "GL_DEPTH_WRITEMASK", GLboolean, ["ctx->Depth.Mask"], "", None ), - ( "GL_DITHER", GLboolean, ["ctx->Color.DitherFlag"], "", None ), - ( "GL_DOUBLEBUFFER", GLboolean, - ["ctx->DrawBuffer->Visual.doubleBufferMode"], "", None ), - ( "GL_DRAW_BUFFER", GLenum, ["ctx->Color.DrawBuffer[0]"], "", None ), - ( "GL_EDGE_FLAG", GLboolean, ["ctx->Current.EdgeFlag"], - "FLUSH_CURRENT(ctx, 0);", None ), - ( "GL_FEEDBACK_BUFFER_SIZE", GLint, ["ctx->Feedback.BufferSize"], "", None ), - ( "GL_FEEDBACK_BUFFER_TYPE", GLenum, ["ctx->Feedback.Type"], "", None ), - ( "GL_FOG", GLboolean, ["ctx->Fog.Enabled"], "", None ), - ( "GL_FOG_COLOR", GLfloatN, - [ "ctx->Fog.Color[0]", - "ctx->Fog.Color[1]", - "ctx->Fog.Color[2]", - "ctx->Fog.Color[3]" ], "", None ), - ( "GL_FOG_DENSITY", GLfloat, ["ctx->Fog.Density"], "", None ), - ( "GL_FOG_END", GLfloat, ["ctx->Fog.End"], "", None ), - ( "GL_FOG_HINT", GLenum, ["ctx->Hint.Fog"], "", None ), - ( "GL_FOG_INDEX", GLfloat, ["ctx->Fog.Index"], "", None ), - ( "GL_FOG_MODE", GLenum, ["ctx->Fog.Mode"], "", None ), - ( "GL_FOG_START", GLfloat, ["ctx->Fog.Start"], "", None ), - ( "GL_FRONT_FACE", GLenum, ["ctx->Polygon.FrontFace"], "", None ), - ( "GL_GREEN_BIAS", GLfloat, ["ctx->Pixel.GreenBias"], "", None ), - ( "GL_GREEN_BITS", GLint, ["ctx->DrawBuffer->Visual.greenBits"], - "", None ), - ( "GL_GREEN_SCALE", GLfloat, ["ctx->Pixel.GreenScale"], "", None ), - ( "GL_INDEX_BITS", GLint, ["ctx->DrawBuffer->Visual.indexBits"], - "", None ), - ( "GL_INDEX_CLEAR_VALUE", GLint, ["ctx->Color.ClearIndex"], "", None ), - ( "GL_INDEX_MODE", GLboolean, ["!ctx->DrawBuffer->Visual.rgbMode"], - "", None ), - ( "GL_INDEX_OFFSET", GLint, ["ctx->Pixel.IndexOffset"], "", None ), - ( "GL_INDEX_SHIFT", GLint, ["ctx->Pixel.IndexShift"], "", None ), - ( "GL_INDEX_WRITEMASK", GLint, ["ctx->Color.IndexMask"], "", None ), - ( "GL_LIGHT0", GLboolean, ["ctx->Light.Light[0].Enabled"], "", None ), - ( "GL_LIGHT1", GLboolean, ["ctx->Light.Light[1].Enabled"], "", None ), - ( "GL_LIGHT2", GLboolean, ["ctx->Light.Light[2].Enabled"], "", None ), - ( "GL_LIGHT3", GLboolean, ["ctx->Light.Light[3].Enabled"], "", None ), - ( "GL_LIGHT4", GLboolean, ["ctx->Light.Light[4].Enabled"], "", None ), - ( "GL_LIGHT5", GLboolean, ["ctx->Light.Light[5].Enabled"], "", None ), - ( "GL_LIGHT6", GLboolean, ["ctx->Light.Light[6].Enabled"], "", None ), - ( "GL_LIGHT7", GLboolean, ["ctx->Light.Light[7].Enabled"], "", None ), - ( "GL_LIGHTING", GLboolean, ["ctx->Light.Enabled"], "", None ), - ( "GL_LIGHT_MODEL_AMBIENT", GLfloatN, - ["ctx->Light.Model.Ambient[0]", - "ctx->Light.Model.Ambient[1]", - "ctx->Light.Model.Ambient[2]", - "ctx->Light.Model.Ambient[3]"], "", None ), - ( "GL_LIGHT_MODEL_COLOR_CONTROL", GLenum, - ["ctx->Light.Model.ColorControl"], "", None ), - ( "GL_LIGHT_MODEL_LOCAL_VIEWER", GLboolean, - ["ctx->Light.Model.LocalViewer"], "", None ), - ( "GL_LIGHT_MODEL_TWO_SIDE", GLboolean, ["ctx->Light.Model.TwoSide"], "", None ), - ( "GL_LINE_SMOOTH", GLboolean, ["ctx->Line.SmoothFlag"], "", None ), - ( "GL_LINE_SMOOTH_HINT", GLenum, ["ctx->Hint.LineSmooth"], "", None ), - ( "GL_LINE_STIPPLE", GLboolean, ["ctx->Line.StippleFlag"], "", None ), - ( "GL_LINE_STIPPLE_PATTERN", GLint, ["ctx->Line.StipplePattern"], "", None ), - ( "GL_LINE_STIPPLE_REPEAT", GLint, ["ctx->Line.StippleFactor"], "", None ), - ( "GL_LINE_WIDTH", GLfloat, ["ctx->Line.Width"], "", None ), - ( "GL_LINE_WIDTH_GRANULARITY", GLfloat, - ["ctx->Const.LineWidthGranularity"], "", None ), - ( "GL_LINE_WIDTH_RANGE", GLfloat, - ["ctx->Const.MinLineWidthAA", - "ctx->Const.MaxLineWidthAA"], "", None ), - ( "GL_ALIASED_LINE_WIDTH_RANGE", GLfloat, - ["ctx->Const.MinLineWidth", - "ctx->Const.MaxLineWidth"], "", None ), - ( "GL_LIST_BASE", GLint, ["ctx->List.ListBase"], "", None ), - ( "GL_LIST_INDEX", GLint, ["ctx->ListState.CurrentListNum"], "", None ), - ( "GL_LIST_MODE", GLenum, ["mode"], - """GLenum mode; - if (!ctx->CompileFlag) - mode = 0; - else if (ctx->ExecuteFlag) - mode = GL_COMPILE_AND_EXECUTE; - else - mode = GL_COMPILE;""", None ), - ( "GL_INDEX_LOGIC_OP", GLboolean, ["ctx->Color.IndexLogicOpEnabled"], "", None ), - ( "GL_COLOR_LOGIC_OP", GLboolean, ["ctx->Color.ColorLogicOpEnabled"], "", None ), - ( "GL_LOGIC_OP_MODE", GLenum, ["ctx->Color.LogicOp"], "", None ), - ( "GL_MAP1_COLOR_4", GLboolean, ["ctx->Eval.Map1Color4"], "", None ), - ( "GL_MAP1_GRID_DOMAIN", GLfloat, - ["ctx->Eval.MapGrid1u1", - "ctx->Eval.MapGrid1u2"], "", None ), - ( "GL_MAP1_GRID_SEGMENTS", GLint, ["ctx->Eval.MapGrid1un"], "", None ), - ( "GL_MAP1_INDEX", GLboolean, ["ctx->Eval.Map1Index"], "", None ), - ( "GL_MAP1_NORMAL", GLboolean, ["ctx->Eval.Map1Normal"], "", None ), - ( "GL_MAP1_TEXTURE_COORD_1", GLboolean, ["ctx->Eval.Map1TextureCoord1"], "", None ), - ( "GL_MAP1_TEXTURE_COORD_2", GLboolean, ["ctx->Eval.Map1TextureCoord2"], "", None ), - ( "GL_MAP1_TEXTURE_COORD_3", GLboolean, ["ctx->Eval.Map1TextureCoord3"], "", None ), - ( "GL_MAP1_TEXTURE_COORD_4", GLboolean, ["ctx->Eval.Map1TextureCoord4"], "", None ), - ( "GL_MAP1_VERTEX_3", GLboolean, ["ctx->Eval.Map1Vertex3"], "", None ), - ( "GL_MAP1_VERTEX_4", GLboolean, ["ctx->Eval.Map1Vertex4"], "", None ), - ( "GL_MAP2_COLOR_4", GLboolean, ["ctx->Eval.Map2Color4"], "", None ), - ( "GL_MAP2_GRID_DOMAIN", GLfloat, - ["ctx->Eval.MapGrid2u1", - "ctx->Eval.MapGrid2u2", - "ctx->Eval.MapGrid2v1", - "ctx->Eval.MapGrid2v2"], "", None ), - ( "GL_MAP2_GRID_SEGMENTS", GLint, - ["ctx->Eval.MapGrid2un", - "ctx->Eval.MapGrid2vn"], "", None ), - ( "GL_MAP2_INDEX", GLboolean, ["ctx->Eval.Map2Index"], "", None ), - ( "GL_MAP2_NORMAL", GLboolean, ["ctx->Eval.Map2Normal"], "", None ), - ( "GL_MAP2_TEXTURE_COORD_1", GLboolean, ["ctx->Eval.Map2TextureCoord1"], "", None ), - ( "GL_MAP2_TEXTURE_COORD_2", GLboolean, ["ctx->Eval.Map2TextureCoord2"], "", None ), - ( "GL_MAP2_TEXTURE_COORD_3", GLboolean, ["ctx->Eval.Map2TextureCoord3"], "", None ), - ( "GL_MAP2_TEXTURE_COORD_4", GLboolean, ["ctx->Eval.Map2TextureCoord4"], "", None ), - ( "GL_MAP2_VERTEX_3", GLboolean, ["ctx->Eval.Map2Vertex3"], "", None ), - ( "GL_MAP2_VERTEX_4", GLboolean, ["ctx->Eval.Map2Vertex4"], "", None ), - ( "GL_MAP_COLOR", GLboolean, ["ctx->Pixel.MapColorFlag"], "", None ), - ( "GL_MAP_STENCIL", GLboolean, ["ctx->Pixel.MapStencilFlag"], "", None ), - ( "GL_MATRIX_MODE", GLenum, ["ctx->Transform.MatrixMode"], "", None ), - - ( "GL_MAX_ATTRIB_STACK_DEPTH", GLint, ["MAX_ATTRIB_STACK_DEPTH"], "", None ), - ( "GL_MAX_CLIENT_ATTRIB_STACK_DEPTH", GLint, ["MAX_CLIENT_ATTRIB_STACK_DEPTH"], "", None ), - ( "GL_MAX_CLIP_PLANES", GLint, ["ctx->Const.MaxClipPlanes"], "", None ), - ( "GL_MAX_ELEMENTS_VERTICES", GLint, ["ctx->Const.MaxArrayLockSize"], "", None ), - ( "GL_MAX_ELEMENTS_INDICES", GLint, ["ctx->Const.MaxArrayLockSize"], "", None ), - ( "GL_MAX_EVAL_ORDER", GLint, ["MAX_EVAL_ORDER"], "", None ), - ( "GL_MAX_LIGHTS", GLint, ["ctx->Const.MaxLights"], "", None ), - ( "GL_MAX_LIST_NESTING", GLint, ["MAX_LIST_NESTING"], "", None ), - ( "GL_MAX_MODELVIEW_STACK_DEPTH", GLint, ["MAX_MODELVIEW_STACK_DEPTH"], "", None ), - ( "GL_MAX_NAME_STACK_DEPTH", GLint, ["MAX_NAME_STACK_DEPTH"], "", None ), - ( "GL_MAX_PIXEL_MAP_TABLE", GLint, ["MAX_PIXEL_MAP_TABLE"], "", None ), - ( "GL_MAX_PROJECTION_STACK_DEPTH", GLint, ["MAX_PROJECTION_STACK_DEPTH"], "", None ), - ( "GL_MAX_TEXTURE_SIZE", GLint, ["1 << (ctx->Const.MaxTextureLevels - 1)"], "", None ), - ( "GL_MAX_3D_TEXTURE_SIZE", GLint, ["1 << (ctx->Const.Max3DTextureLevels - 1)"], "", None ), - ( "GL_MAX_TEXTURE_STACK_DEPTH", GLint, ["MAX_TEXTURE_STACK_DEPTH"], "", None ), - ( "GL_MAX_VIEWPORT_DIMS", GLint, - ["ctx->Const.MaxViewportWidth", "ctx->Const.MaxViewportHeight"], - "", None ), - ( "GL_MODELVIEW_MATRIX", GLfloat, - [ "matrix[0]", "matrix[1]", "matrix[2]", "matrix[3]", - "matrix[4]", "matrix[5]", "matrix[6]", "matrix[7]", - "matrix[8]", "matrix[9]", "matrix[10]", "matrix[11]", - "matrix[12]", "matrix[13]", "matrix[14]", "matrix[15]" ], - "const GLfloat *matrix = ctx->ModelviewMatrixStack.Top->m;", None ), - ( "GL_MODELVIEW_STACK_DEPTH", GLint, ["ctx->ModelviewMatrixStack.Depth + 1"], "", None ), - ( "GL_NAME_STACK_DEPTH", GLint, ["ctx->Select.NameStackDepth"], "", None ), - ( "GL_NORMALIZE", GLboolean, ["ctx->Transform.Normalize"], "", None ), - ( "GL_PACK_ALIGNMENT", GLint, ["ctx->Pack.Alignment"], "", None ), - ( "GL_PACK_LSB_FIRST", GLboolean, ["ctx->Pack.LsbFirst"], "", None ), - ( "GL_PACK_ROW_LENGTH", GLint, ["ctx->Pack.RowLength"], "", None ), - ( "GL_PACK_SKIP_PIXELS", GLint, ["ctx->Pack.SkipPixels"], "", None ), - ( "GL_PACK_SKIP_ROWS", GLint, ["ctx->Pack.SkipRows"], "", None ), - ( "GL_PACK_SWAP_BYTES", GLboolean, ["ctx->Pack.SwapBytes"], "", None ), - ( "GL_PACK_SKIP_IMAGES_EXT", GLint, ["ctx->Pack.SkipImages"], "", None ), - ( "GL_PACK_IMAGE_HEIGHT_EXT", GLint, ["ctx->Pack.ImageHeight"], "", None ), - ( "GL_PACK_INVERT_MESA", GLboolean, ["ctx->Pack.Invert"], "", None ), - ( "GL_PERSPECTIVE_CORRECTION_HINT", GLenum, - ["ctx->Hint.PerspectiveCorrection"], "", None ), - ( "GL_PIXEL_MAP_A_TO_A_SIZE", GLint, ["ctx->Pixel.MapAtoAsize"], "", None ), - ( "GL_PIXEL_MAP_B_TO_B_SIZE", GLint, ["ctx->Pixel.MapBtoBsize"], "", None ), - ( "GL_PIXEL_MAP_G_TO_G_SIZE", GLint, ["ctx->Pixel.MapGtoGsize"], "", None ), - ( "GL_PIXEL_MAP_I_TO_A_SIZE", GLint, ["ctx->Pixel.MapItoAsize"], "", None ), - ( "GL_PIXEL_MAP_I_TO_B_SIZE", GLint, ["ctx->Pixel.MapItoBsize"], "", None ), - ( "GL_PIXEL_MAP_I_TO_G_SIZE", GLint, ["ctx->Pixel.MapItoGsize"], "", None ), - ( "GL_PIXEL_MAP_I_TO_I_SIZE", GLint, ["ctx->Pixel.MapItoIsize"], "", None ), - ( "GL_PIXEL_MAP_I_TO_R_SIZE", GLint, ["ctx->Pixel.MapItoRsize"], "", None ), - ( "GL_PIXEL_MAP_R_TO_R_SIZE", GLint, ["ctx->Pixel.MapRtoRsize"], "", None ), - ( "GL_PIXEL_MAP_S_TO_S_SIZE", GLint, ["ctx->Pixel.MapStoSsize"], "", None ), - ( "GL_POINT_SIZE", GLfloat, ["ctx->Point.Size"], "", None ), - ( "GL_POINT_SIZE_GRANULARITY", GLfloat, - ["ctx->Const.PointSizeGranularity"], "", None ), - ( "GL_POINT_SIZE_RANGE", GLfloat, - ["ctx->Const.MinPointSizeAA", - "ctx->Const.MaxPointSizeAA"], "", None ), - ( "GL_ALIASED_POINT_SIZE_RANGE", GLfloat, - ["ctx->Const.MinPointSize", - "ctx->Const.MaxPointSize"], "", None ), - ( "GL_POINT_SMOOTH", GLboolean, ["ctx->Point.SmoothFlag"], "", None ), - ( "GL_POINT_SMOOTH_HINT", GLenum, ["ctx->Hint.PointSmooth"], "", None ), - ( "GL_POINT_SIZE_MIN_EXT", GLfloat, ["ctx->Point.MinSize"], "", None ), - ( "GL_POINT_SIZE_MAX_EXT", GLfloat, ["ctx->Point.MaxSize"], "", None ), - ( "GL_POINT_FADE_THRESHOLD_SIZE_EXT", GLfloat, - ["ctx->Point.Threshold"], "", None ), - ( "GL_DISTANCE_ATTENUATION_EXT", GLfloat, - ["ctx->Point.Params[0]", - "ctx->Point.Params[1]", - "ctx->Point.Params[2]"], "", None ), - ( "GL_POLYGON_MODE", GLenum, - ["ctx->Polygon.FrontMode", - "ctx->Polygon.BackMode"], "", None ), - ( "GL_POLYGON_OFFSET_BIAS_EXT", GLfloat, ["ctx->Polygon.OffsetUnits"], "", None ), - ( "GL_POLYGON_OFFSET_FACTOR", GLfloat, ["ctx->Polygon.OffsetFactor "], "", None ), - ( "GL_POLYGON_OFFSET_UNITS", GLfloat, ["ctx->Polygon.OffsetUnits "], "", None ), - ( "GL_POLYGON_SMOOTH", GLboolean, ["ctx->Polygon.SmoothFlag"], "", None ), - ( "GL_POLYGON_SMOOTH_HINT", GLenum, ["ctx->Hint.PolygonSmooth"], "", None ), - ( "GL_POLYGON_STIPPLE", GLboolean, ["ctx->Polygon.StippleFlag"], "", None ), - ( "GL_PROJECTION_MATRIX", GLfloat, - [ "matrix[0]", "matrix[1]", "matrix[2]", "matrix[3]", - "matrix[4]", "matrix[5]", "matrix[6]", "matrix[7]", - "matrix[8]", "matrix[9]", "matrix[10]", "matrix[11]", - "matrix[12]", "matrix[13]", "matrix[14]", "matrix[15]" ], - "const GLfloat *matrix = ctx->ProjectionMatrixStack.Top->m;", None ), - ( "GL_PROJECTION_STACK_DEPTH", GLint, - ["ctx->ProjectionMatrixStack.Depth + 1"], "", None ), - ( "GL_READ_BUFFER", GLenum, ["ctx->Pixel.ReadBuffer"], "", None ), - ( "GL_RED_BIAS", GLfloat, ["ctx->Pixel.RedBias"], "", None ), - ( "GL_RED_BITS", GLint, [" ctx->DrawBuffer->Visual.redBits "], "", None ), - ( "GL_RED_SCALE", GLfloat, ["ctx->Pixel.RedScale"], "", None ), - ( "GL_RENDER_MODE", GLenum, ["ctx->RenderMode"], "", None ), - ( "GL_RESCALE_NORMAL", GLboolean, - ["ctx->Transform.RescaleNormals"], "", None ), - ( "GL_RGBA_MODE", GLboolean, ["ctx->DrawBuffer->Visual.rgbMode"], - "", None ), - ( "GL_SCISSOR_BOX", GLint, - ["ctx->Scissor.X", - "ctx->Scissor.Y", - "ctx->Scissor.Width", - "ctx->Scissor.Height"], "", None ), - ( "GL_SCISSOR_TEST", GLboolean, ["ctx->Scissor.Enabled"], "", None ), - ( "GL_SELECTION_BUFFER_SIZE", GLint, ["ctx->Select.BufferSize"], "", None ), - ( "GL_SHADE_MODEL", GLenum, ["ctx->Light.ShadeModel"], "", None ), - ( "GL_SHARED_TEXTURE_PALETTE_EXT", GLboolean, - ["ctx->Texture.SharedPalette"], "", None ), - ( "GL_STENCIL_BITS", GLint, ["ctx->DrawBuffer->Visual.stencilBits"], "", None ), - ( "GL_STENCIL_CLEAR_VALUE", GLint, ["ctx->Stencil.Clear"], "", None ), - ( "GL_STENCIL_FAIL", GLenum, - ["ctx->Stencil.FailFunc[ctx->Stencil.ActiveFace]"], "", None ), - ( "GL_STENCIL_FUNC", GLenum, - ["ctx->Stencil.Function[ctx->Stencil.ActiveFace]"], "", None ), - ( "GL_STENCIL_PASS_DEPTH_FAIL", GLenum, - ["ctx->Stencil.ZFailFunc[ctx->Stencil.ActiveFace]"], "", None ), - ( "GL_STENCIL_PASS_DEPTH_PASS", GLenum, - ["ctx->Stencil.ZPassFunc[ctx->Stencil.ActiveFace]"], "", None ), - ( "GL_STENCIL_REF", GLint, - ["ctx->Stencil.Ref[ctx->Stencil.ActiveFace]"], "", None ), - ( "GL_STENCIL_TEST", GLboolean, ["ctx->Stencil.Enabled"], "", None ), - ( "GL_STENCIL_VALUE_MASK", GLint, - ["ctx->Stencil.ValueMask[ctx->Stencil.ActiveFace]"], "", None ), - ( "GL_STENCIL_WRITEMASK", GLint, - ["ctx->Stencil.WriteMask[ctx->Stencil.ActiveFace]"], "", None ), - ( "GL_STEREO", GLboolean, ["ctx->DrawBuffer->Visual.stereoMode"], - "", None ), - ( "GL_SUBPIXEL_BITS", GLint, ["ctx->Const.SubPixelBits"], "", None ), - ( "GL_TEXTURE_1D", GLboolean, ["_mesa_IsEnabled(GL_TEXTURE_1D)"], "", None ), - ( "GL_TEXTURE_2D", GLboolean, ["_mesa_IsEnabled(GL_TEXTURE_2D)"], "", None ), - ( "GL_TEXTURE_3D", GLboolean, ["_mesa_IsEnabled(GL_TEXTURE_3D)"], "", None ), - ( "GL_TEXTURE_BINDING_1D", GLint, - ["ctx->Texture.Unit[ctx->Texture.CurrentUnit].Current1D->Name"], "", None ), - ( "GL_TEXTURE_BINDING_2D", GLint, - ["ctx->Texture.Unit[ctx->Texture.CurrentUnit].Current2D->Name"], "", None ), - ( "GL_TEXTURE_BINDING_3D", GLint, - ["ctx->Texture.Unit[ctx->Texture.CurrentUnit].Current3D->Name"], "", None ), - ( "GL_TEXTURE_ENV_COLOR", GLfloatN, - ["color[0]", "color[1]", "color[2]", "color[3]"], - "const GLfloat *color = ctx->Texture.Unit[ctx->Texture.CurrentUnit].EnvColor;", - None ), - ( "GL_TEXTURE_ENV_MODE", GLenum, - ["ctx->Texture.Unit[ctx->Texture.CurrentUnit].EnvMode"], "", None ), - ( "GL_TEXTURE_GEN_S", GLboolean, - ["((ctx->Texture.Unit[ctx->Texture.CurrentUnit].TexGenEnabled & S_BIT) ? 1 : 0)"], "", None ), - ( "GL_TEXTURE_GEN_T", GLboolean, - ["((ctx->Texture.Unit[ctx->Texture.CurrentUnit].TexGenEnabled & T_BIT) ? 1 : 0)"], "", None ), - ( "GL_TEXTURE_GEN_R", GLboolean, - ["((ctx->Texture.Unit[ctx->Texture.CurrentUnit].TexGenEnabled & R_BIT) ? 1 : 0)"], "", None ), - ( "GL_TEXTURE_GEN_Q", GLboolean, - ["((ctx->Texture.Unit[ctx->Texture.CurrentUnit].TexGenEnabled & Q_BIT) ? 1 : 0)"], "", None ), - ( "GL_TEXTURE_MATRIX", GLfloat, - ["matrix[0]", "matrix[1]", "matrix[2]", "matrix[3]", - "matrix[4]", "matrix[5]", "matrix[6]", "matrix[7]", - "matrix[8]", "matrix[9]", "matrix[10]", "matrix[11]", - "matrix[12]", "matrix[13]", "matrix[14]", "matrix[15]" ], - "const GLfloat *matrix = ctx->TextureMatrixStack[ctx->Texture.CurrentUnit].Top->m;", None ), - ( "GL_TEXTURE_STACK_DEPTH", GLint, - ["ctx->TextureMatrixStack[ctx->Texture.CurrentUnit].Depth + 1"], "", None ), - ( "GL_UNPACK_ALIGNMENT", GLint, ["ctx->Unpack.Alignment"], "", None ), - ( "GL_UNPACK_LSB_FIRST", GLboolean, ["ctx->Unpack.LsbFirst"], "", None ), - ( "GL_UNPACK_ROW_LENGTH", GLint, ["ctx->Unpack.RowLength"], "", None ), - ( "GL_UNPACK_SKIP_PIXELS", GLint, ["ctx->Unpack.SkipPixels"], "", None ), - ( "GL_UNPACK_SKIP_ROWS", GLint, ["ctx->Unpack.SkipRows"], "", None ), - ( "GL_UNPACK_SWAP_BYTES", GLboolean, ["ctx->Unpack.SwapBytes"], "", None ), - ( "GL_UNPACK_SKIP_IMAGES_EXT", GLint, ["ctx->Unpack.SkipImages"], "", None ), - ( "GL_UNPACK_IMAGE_HEIGHT_EXT", GLint, ["ctx->Unpack.ImageHeight"], "", None ), - ( "GL_UNPACK_CLIENT_STORAGE_APPLE", GLboolean, ["ctx->Unpack.ClientStorage"], "", None ), - ( "GL_VIEWPORT", GLint, [ "ctx->Viewport.X", "ctx->Viewport.Y", - "ctx->Viewport.Width", "ctx->Viewport.Height" ], "", None ), - ( "GL_ZOOM_X", GLfloat, ["ctx->Pixel.ZoomX"], "", None ), - ( "GL_ZOOM_Y", GLfloat, ["ctx->Pixel.ZoomY"], "", None ), - - # Vertex arrays - ( "GL_VERTEX_ARRAY", GLboolean, ["ctx->Array.Vertex.Enabled"], "", None ), - ( "GL_VERTEX_ARRAY_SIZE", GLint, ["ctx->Array.Vertex.Size"], "", None ), - ( "GL_VERTEX_ARRAY_TYPE", GLenum, ["ctx->Array.Vertex.Type"], "", None ), - ( "GL_VERTEX_ARRAY_STRIDE", GLint, ["ctx->Array.Vertex.Stride"], "", None ), - ( "GL_VERTEX_ARRAY_COUNT_EXT", GLint, ["0"], "", None ), - ( "GL_NORMAL_ARRAY", GLenum, ["ctx->Array.Normal.Enabled"], "", None ), - ( "GL_NORMAL_ARRAY_TYPE", GLenum, ["ctx->Array.Normal.Type"], "", None ), - ( "GL_NORMAL_ARRAY_STRIDE", GLint, ["ctx->Array.Normal.Stride"], "", None ), - ( "GL_NORMAL_ARRAY_COUNT_EXT", GLint, ["0"], "", None ), - ( "GL_COLOR_ARRAY", GLboolean, ["ctx->Array.Color.Enabled"], "", None ), - ( "GL_COLOR_ARRAY_SIZE", GLint, ["ctx->Array.Color.Size"], "", None ), - ( "GL_COLOR_ARRAY_TYPE", GLenum, ["ctx->Array.Color.Type"], "", None ), - ( "GL_COLOR_ARRAY_STRIDE", GLint, ["ctx->Array.Color.Stride"], "", None ), - ( "GL_COLOR_ARRAY_COUNT_EXT", GLint, ["0"], "", None ), - ( "GL_INDEX_ARRAY", GLboolean, ["ctx->Array.Index.Enabled"], "", None ), - ( "GL_INDEX_ARRAY_TYPE", GLenum, ["ctx->Array.Index.Type"], "", None ), - ( "GL_INDEX_ARRAY_STRIDE", GLint, ["ctx->Array.Index.Stride"], "", None ), - ( "GL_INDEX_ARRAY_COUNT_EXT", GLint, ["0"], "", None ), - ( "GL_TEXTURE_COORD_ARRAY", GLboolean, - ["ctx->Array.TexCoord[ctx->Array.ActiveTexture].Enabled"], "", None ), - ( "GL_TEXTURE_COORD_ARRAY_SIZE", GLint, - ["ctx->Array.TexCoord[ctx->Array.ActiveTexture].Size"], "", None ), - ( "GL_TEXTURE_COORD_ARRAY_TYPE", GLenum, - ["ctx->Array.TexCoord[ctx->Array.ActiveTexture].Type"], "", None ), - ( "GL_TEXTURE_COORD_ARRAY_STRIDE", GLint, - ["ctx->Array.TexCoord[ctx->Array.ActiveTexture].Stride"], "", None ), - ( "GL_TEXTURE_COORD_ARRAY_COUNT_EXT", GLint, ["0"], "", None ), - ( "GL_EDGE_FLAG_ARRAY", GLboolean, ["ctx->Array.EdgeFlag.Enabled"], "", None ), - ( "GL_EDGE_FLAG_ARRAY_STRIDE", GLint, ["ctx->Array.EdgeFlag.Stride"], "", None ), - ( "GL_EDGE_FLAG_ARRAY_COUNT_EXT", GLint, ["0"], "", None ), - - # GL_ARB_multitexture - ( "GL_MAX_TEXTURE_UNITS_ARB", GLint, - ["MIN2(ctx->Const.MaxTextureImageUnits, ctx->Const.MaxTextureCoordUnits)"], - "", "ARB_multitexture" ), - ( "GL_ACTIVE_TEXTURE_ARB", GLint, - [ "GL_TEXTURE0_ARB + ctx->Texture.CurrentUnit"], "", "ARB_multitexture" ), - ( "GL_CLIENT_ACTIVE_TEXTURE_ARB", GLint, - ["GL_TEXTURE0_ARB + ctx->Array.ActiveTexture"], "", "ARB_multitexture" ), - - # GL_ARB_texture_cube_map - ( "GL_TEXTURE_CUBE_MAP_ARB", GLboolean, - ["_mesa_IsEnabled(GL_TEXTURE_CUBE_MAP_ARB)"], "", "ARB_texture_cube_map" ), - ( "GL_TEXTURE_BINDING_CUBE_MAP_ARB", GLint, - ["ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentCubeMap->Name"], - "", "ARB_texture_cube_map" ), - ( "GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB", GLint, - ["(1 << (ctx->Const.MaxCubeTextureLevels - 1))"], - "", "ARB_texture_cube_map"), - - # GL_ARB_texture_compression */ - ( "GL_TEXTURE_COMPRESSION_HINT_ARB", GLint, - ["ctx->Hint.TextureCompression"], "", "ARB_texture_compression" ), - ( "GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB", GLint, - ["_mesa_get_compressed_formats(ctx, NULL)"], "", "ARB_texture_compression" ), - ( "GL_COMPRESSED_TEXTURE_FORMATS_ARB", GLenum, - [], - """GLint formats[100]; - GLuint i, n = _mesa_get_compressed_formats(ctx, formats); - ASSERT(n <= 100); - for (i = 0; i < n; i++) - params[i] = ENUM_TO_INT(formats[i]);""", - "ARB_texture_compression" ), - - # GL_EXT_compiled_vertex_array - ( "GL_ARRAY_ELEMENT_LOCK_FIRST_EXT", GLint, ["ctx->Array.LockFirst"], - "", "EXT_compiled_vertex_array" ), - ( "GL_ARRAY_ELEMENT_LOCK_COUNT_EXT", GLint, ["ctx->Array.LockCount"], - "", "EXT_compiled_vertex_array" ), - - # GL_ARB_transpose_matrix - ( "GL_TRANSPOSE_COLOR_MATRIX_ARB", GLfloat, - ["matrix[0]", "matrix[4]", "matrix[8]", "matrix[12]", - "matrix[1]", "matrix[5]", "matrix[9]", "matrix[13]", - "matrix[2]", "matrix[6]", "matrix[10]", "matrix[14]", - "matrix[3]", "matrix[7]", "matrix[11]", "matrix[15]"], - "const GLfloat *matrix = ctx->ColorMatrixStack.Top->m;", None ), - ( "GL_TRANSPOSE_MODELVIEW_MATRIX_ARB", GLfloat, - ["matrix[0]", "matrix[4]", "matrix[8]", "matrix[12]", - "matrix[1]", "matrix[5]", "matrix[9]", "matrix[13]", - "matrix[2]", "matrix[6]", "matrix[10]", "matrix[14]", - "matrix[3]", "matrix[7]", "matrix[11]", "matrix[15]"], - "const GLfloat *matrix = ctx->ModelviewMatrixStack.Top->m;", None ), - ( "GL_TRANSPOSE_PROJECTION_MATRIX_ARB", GLfloat, - ["matrix[0]", "matrix[4]", "matrix[8]", "matrix[12]", - "matrix[1]", "matrix[5]", "matrix[9]", "matrix[13]", - "matrix[2]", "matrix[6]", "matrix[10]", "matrix[14]", - "matrix[3]", "matrix[7]", "matrix[11]", "matrix[15]"], - "const GLfloat *matrix = ctx->ProjectionMatrixStack.Top->m;", None ), - ( "GL_TRANSPOSE_TEXTURE_MATRIX_ARB", GLfloat, - ["matrix[0]", "matrix[4]", "matrix[8]", "matrix[12]", - "matrix[1]", "matrix[5]", "matrix[9]", "matrix[13]", - "matrix[2]", "matrix[6]", "matrix[10]", "matrix[14]", - "matrix[3]", "matrix[7]", "matrix[11]", "matrix[15]"], - "const GLfloat *matrix = ctx->TextureMatrixStack[ctx->Texture.CurrentUnit].Top->m;", None ), - - # GL_HP_occlusion_test - ( "GL_OCCLUSION_TEST_HP", GLboolean, ["ctx->Depth.OcclusionTest"], "", - "HP_occlusion_test" ), - ( "GL_OCCLUSION_TEST_RESULT_HP", GLboolean, [], - """FLUSH_VERTICES(ctx, _NEW_DEPTH); - if (ctx->Depth.OcclusionTest) - params[0] = ctx->OcclusionResult; - else - params[0] = ctx->OcclusionResultSaved; - /* reset flag now */ - ctx->OcclusionResult = GL_FALSE; - ctx->OcclusionResultSaved = GL_FALSE; - return;""", - "HP_occlusion_test" ), - - # GL_SGIS_pixel_texture - ( "GL_PIXEL_TEXTURE_SGIS", GLboolean, ["ctx->Pixel.PixelTextureEnabled"], - "", "SGIS_pixel_texture" ), - - # GL_SGIX_pixel_texture - ( "GL_PIXEL_TEX_GEN_SGIX", GLboolean, ["ctx->Pixel.PixelTextureEnabled"], - "", "SGIX_pixel_texture" ), - ( "GL_PIXEL_TEX_GEN_MODE_SGIX", GLenum, ["pixel_texgen_mode(ctx)"], - "", "SGIX_pixel_texture" ), - - # GL_SGI_color_matrix (also in 1.2 imaging) - ( "GL_COLOR_MATRIX_SGI", GLfloat, - ["matrix[0]", "matrix[1]", "matrix[2]", "matrix[3]", - "matrix[4]", "matrix[5]", "matrix[6]", "matrix[7]", - "matrix[8]", "matrix[9]", "matrix[10]", "matrix[11]", - "matrix[12]", "matrix[13]", "matrix[14]", "matrix[15]" ], - "const GLfloat *matrix = ctx->ColorMatrixStack.Top->m;", None ), - ( "GL_COLOR_MATRIX_STACK_DEPTH_SGI", GLint, - ["ctx->ColorMatrixStack.Depth + 1"], "", None ), - ( "GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI", GLint, - ["MAX_COLOR_STACK_DEPTH"], "", None ), - ( "GL_POST_COLOR_MATRIX_RED_SCALE_SGI", GLfloat, - ["ctx->Pixel.PostColorMatrixScale[0]"], "", None ), - ( "GL_POST_COLOR_MATRIX_GREEN_SCALE_SGI", GLfloat, - ["ctx->Pixel.PostColorMatrixScale[1]"], "", None ), - ( "GL_POST_COLOR_MATRIX_BLUE_SCALE_SGI", GLfloat, - ["ctx->Pixel.PostColorMatrixScale[2]"], "", None ), - ( "GL_POST_COLOR_MATRIX_ALPHA_SCALE_SGI", GLfloat, - ["ctx->Pixel.PostColorMatrixScale[3]"], "", None ), - ( "GL_POST_COLOR_MATRIX_RED_BIAS_SGI", GLfloat, - ["ctx->Pixel.PostColorMatrixBias[0]"], "", None ), - ( "GL_POST_COLOR_MATRIX_GREEN_BIAS_SGI", GLfloat, - ["ctx->Pixel.PostColorMatrixBias[1]"], "", None ), - ( "GL_POST_COLOR_MATRIX_BLUE_BIAS_SGI", GLfloat, - ["ctx->Pixel.PostColorMatrixBias[2]"], "", None ), - ( "GL_POST_COLOR_MATRIX_ALPHA_BIAS_SGI", GLfloat, - ["ctx->Pixel.PostColorMatrixBias[3]"], "", None ), - - # GL_EXT_convolution (also in 1.2 imaging) - ( "GL_CONVOLUTION_1D_EXT", GLboolean, - ["ctx->Pixel.Convolution1DEnabled"], "", "EXT_convolution" ), - ( "GL_CONVOLUTION_2D_EXT", GLboolean, - ["ctx->Pixel.Convolution2DEnabled"], "", "EXT_convolution" ), - ( "GL_SEPARABLE_2D_EXT", GLboolean, - ["ctx->Pixel.Separable2DEnabled"], "", "EXT_convolution" ), - ( "GL_POST_CONVOLUTION_RED_SCALE_EXT", GLfloat, - ["ctx->Pixel.PostConvolutionScale[0]"], "", "EXT_convolution" ), - ( "GL_POST_CONVOLUTION_GREEN_SCALE_EXT", GLfloat, - ["ctx->Pixel.PostConvolutionScale[1]"], "", "EXT_convolution" ), - ( "GL_POST_CONVOLUTION_BLUE_SCALE_EXT", GLfloat, - ["ctx->Pixel.PostConvolutionScale[2]"], "", "EXT_convolution" ), - ( "GL_POST_CONVOLUTION_ALPHA_SCALE_EXT", GLfloat, - ["ctx->Pixel.PostConvolutionScale[3]"], "", "EXT_convolution" ), - ( "GL_POST_CONVOLUTION_RED_BIAS_EXT", GLfloat, - ["ctx->Pixel.PostConvolutionBias[0]"], "", "EXT_convolution" ), - ( "GL_POST_CONVOLUTION_GREEN_BIAS_EXT", GLfloat, - ["ctx->Pixel.PostConvolutionBias[1]"], "", "EXT_convolution" ), - ( "GL_POST_CONVOLUTION_BLUE_BIAS_EXT", GLfloat, - ["ctx->Pixel.PostConvolutionBias[2]"], "", "EXT_convolution" ), - ( "GL_POST_CONVOLUTION_ALPHA_BIAS_EXT", GLfloat, - ["ctx->Pixel.PostConvolutionBias[3]"], "", "EXT_convolution" ), - - # GL_EXT_histogram / GL_ARB_imaging - ( "GL_HISTOGRAM", GLboolean, - [ "ctx->Pixel.HistogramEnabled" ], "", "EXT_histogram" ), - ( "GL_MINMAX", GLboolean, - [ "ctx->Pixel.MinMaxEnabled" ], "", "EXT_histogram" ), - - # GL_SGI_color_table / GL_ARB_imaging - ( "GL_COLOR_TABLE_SGI", GLboolean, - ["ctx->Pixel.ColorTableEnabled"], "", "SGI_color_table" ), - ( "GL_POST_CONVOLUTION_COLOR_TABLE_SGI", GLboolean, - ["ctx->Pixel.PostConvolutionColorTableEnabled"], "", "SGI_color_table" ), - ( "GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI", GLboolean, - ["ctx->Pixel.PostColorMatrixColorTableEnabled"], "", "SGI_color_table" ), - - # GL_SGI_texture_color_table - ( "GL_TEXTURE_COLOR_TABLE_SGI", GLboolean, - ["ctx->Texture.Unit[ctx->Texture.CurrentUnit].ColorTableEnabled"], - "", "SGI_texture_color_table" ), - - # GL_EXT_secondary_color - ( "GL_COLOR_SUM_EXT", GLboolean, - ["ctx->Fog.ColorSumEnabled"], "", "EXT_secondary_color" ), - ( "GL_CURRENT_SECONDARY_COLOR_EXT", GLfloatN, - ["ctx->Current.Attrib[VERT_ATTRIB_COLOR1][0]", - "ctx->Current.Attrib[VERT_ATTRIB_COLOR1][1]", - "ctx->Current.Attrib[VERT_ATTRIB_COLOR1][2]", - "ctx->Current.Attrib[VERT_ATTRIB_COLOR1][3]"], - "FLUSH_CURRENT(ctx, 0);", "EXT_secondary_color" ), - ( "GL_SECONDARY_COLOR_ARRAY_EXT", GLboolean, - ["ctx->Array.SecondaryColor.Enabled"], "", "EXT_secondary_color" ), - ( "GL_SECONDARY_COLOR_ARRAY_TYPE_EXT", GLenum, - ["ctx->Array.SecondaryColor.Type"], "", "EXT_secondary_color" ), - ( "GL_SECONDARY_COLOR_ARRAY_STRIDE_EXT", GLint, - ["ctx->Array.SecondaryColor.Stride"], "", "EXT_secondary_color" ), - ( "GL_SECONDARY_COLOR_ARRAY_SIZE_EXT", GLint, - ["ctx->Array.SecondaryColor.Size"], "", "EXT_secondary_color" ), - - # GL_EXT_fog_coord - ( "GL_CURRENT_FOG_COORDINATE_EXT", GLfloat, - ["ctx->Current.Attrib[VERT_ATTRIB_FOG][0]"], - "FLUSH_CURRENT(ctx, 0);", "EXT_fog_coord" ), - ( "GL_FOG_COORDINATE_ARRAY_EXT", GLboolean, ["ctx->Array.FogCoord.Enabled"], - "", "EXT_fog_coord" ), - ( "GL_FOG_COORDINATE_ARRAY_TYPE_EXT", GLenum, ["ctx->Array.FogCoord.Type"], - "", "EXT_fog_coord" ), - ( "GL_FOG_COORDINATE_ARRAY_STRIDE_EXT", GLint, ["ctx->Array.FogCoord.Stride"], - "", "EXT_fog_coord" ), - ( "GL_FOG_COORDINATE_SOURCE_EXT", GLenum, ["ctx->Fog.FogCoordinateSource"], - "", "EXT_fog_coord" ), - - # GL_EXT_texture_lod_bias - ( "GL_MAX_TEXTURE_LOD_BIAS_EXT", GLfloat, - ["ctx->Const.MaxTextureLodBias"], "", "EXT_texture_lod_bias"), - - # GL_EXT_texture_filter_anisotropic - ( "GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT", GLfloat, - ["ctx->Const.MaxTextureMaxAnisotropy"], "", "EXT_texture_filter_anisotropic"), - - # GL_ARB_multisample - ( "GL_MULTISAMPLE_ARB", GLboolean, - ["ctx->Multisample.Enabled"], "", "ARB_multisample" ), - ( "GL_SAMPLE_ALPHA_TO_COVERAGE_ARB", GLboolean, - ["ctx->Multisample.SampleAlphaToCoverage"], "", "ARB_multisample" ), - ( "GL_SAMPLE_ALPHA_TO_ONE_ARB", GLboolean, - ["ctx->Multisample.SampleAlphaToOne"], "", "ARB_multisample" ), - ( "GL_SAMPLE_COVERAGE_ARB", GLboolean, - ["ctx->Multisample.SampleCoverage"], "", "ARB_multisample" ), - ( "GL_SAMPLE_COVERAGE_VALUE_ARB", GLfloat, - ["ctx->Multisample.SampleCoverageValue"], "", "ARB_multisample" ), - ( "GL_SAMPLE_COVERAGE_INVERT_ARB", GLboolean, - ["ctx->Multisample.SampleCoverageInvert"], "", "ARB_multisample" ), - ( "GL_SAMPLE_BUFFERS_ARB", GLint, - ["ctx->DrawBuffer->Visual.sampleBuffers"], "", "ARB_multisample" ), - ( "GL_SAMPLES_ARB", GLint, - ["ctx->DrawBuffer->Visual.samples"], "", "ARB_multisample" ), - - # GL_IBM_rasterpos_clip - ( "GL_RASTER_POSITION_UNCLIPPED_IBM", GLboolean, - ["ctx->Transform.RasterPositionUnclipped"], "", "IBM_rasterpos_clip" ), - - # GL_NV_point_sprite - ( "GL_POINT_SPRITE_NV", GLboolean, ["ctx->Point.PointSprite"], - "", "NV_point_sprite" ), # OR ARB_point_sprite - ( "GL_POINT_SPRITE_R_MODE_NV", GLenum, ["ctx->Point.SpriteRMode"], - "", "NV_point_sprite" ), # OR ARB_point_sprite - ( "GL_POINT_SPRITE_COORD_ORIGIN", GLenum, ["ctx->Point.SpriteOrigin"], - "", "NV_point_sprite" ), # OR ARB_point_sprite - - # GL_SGIS_generate_mipmap - ( "GL_GENERATE_MIPMAP_HINT_SGIS", GLenum, ["ctx->Hint.GenerateMipmap"], - "", "SGIS_generate_mipmap" ), - - # GL_NV_vertex_program - ( "GL_VERTEX_PROGRAM_NV", GLboolean, - ["ctx->VertexProgram.Enabled"], "", "NV_vertex_program" ), - ( "GL_VERTEX_PROGRAM_POINT_SIZE_NV", GLboolean, - ["ctx->VertexProgram.PointSizeEnabled"], "", "NV_vertex_program" ), - ( "GL_VERTEX_PROGRAM_TWO_SIDE_NV", GLboolean, - ["ctx->VertexProgram.TwoSideEnabled"], "", "NV_vertex_program" ), - ( "GL_MAX_TRACK_MATRIX_STACK_DEPTH_NV", GLint, - ["ctx->Const.MaxProgramMatrixStackDepth"], "", "NV_vertex_program" ), - ( "GL_MAX_TRACK_MATRICES_NV", GLint, - ["ctx->Const.MaxProgramMatrices"], "", "NV_vertex_program" ), - ( "GL_CURRENT_MATRIX_STACK_DEPTH_NV", GLboolean, - ["ctx->CurrentStack->Depth + 1"], "", "NV_vertex_program" ), - ( "GL_CURRENT_MATRIX_NV", GLfloat, - ["matrix[0]", "matrix[1]", "matrix[2]", "matrix[3]", - "matrix[4]", "matrix[5]", "matrix[6]", "matrix[7]", - "matrix[8]", "matrix[9]", "matrix[10]", "matrix[11]", - "matrix[12]", "matrix[13]", "matrix[14]", "matrix[15]" ], - "const GLfloat *matrix = ctx->CurrentStack->Top->m;", "NV_vertex_program" ), - ( "GL_VERTEX_PROGRAM_BINDING_NV", GLint, - ["(ctx->VertexProgram.Current ? ctx->VertexProgram.Current->Base.Id : 0)"], - "", "NV_vertex_program" ), - ( "GL_PROGRAM_ERROR_POSITION_NV", GLint, - ["ctx->Program.ErrorPos"], "", "NV_vertex_program" ), - ( "GL_VERTEX_ATTRIB_ARRAY0_NV", GLboolean, - ["ctx->Array.VertexAttrib[0].Enabled"], "", "NV_vertex_program" ), - ( "GL_VERTEX_ATTRIB_ARRAY1_NV", GLboolean, - ["ctx->Array.VertexAttrib[1].Enabled"], "", "NV_vertex_program" ), - ( "GL_VERTEX_ATTRIB_ARRAY2_NV", GLboolean, - ["ctx->Array.VertexAttrib[2].Enabled"], "", "NV_vertex_program" ), - ( "GL_VERTEX_ATTRIB_ARRAY3_NV", GLboolean, - ["ctx->Array.VertexAttrib[3].Enabled"], "", "NV_vertex_program" ), - ( "GL_VERTEX_ATTRIB_ARRAY4_NV", GLboolean, - ["ctx->Array.VertexAttrib[4].Enabled"], "", "NV_vertex_program" ), - ( "GL_VERTEX_ATTRIB_ARRAY5_NV", GLboolean, - ["ctx->Array.VertexAttrib[5].Enabled"], "", "NV_vertex_program" ), - ( "GL_VERTEX_ATTRIB_ARRAY6_NV", GLboolean, - ["ctx->Array.VertexAttrib[6].Enabled"], "", "NV_vertex_program" ), - ( "GL_VERTEX_ATTRIB_ARRAY7_NV", GLboolean, - ["ctx->Array.VertexAttrib[7].Enabled"], "", "NV_vertex_program" ), - ( "GL_VERTEX_ATTRIB_ARRAY8_NV", GLboolean, - ["ctx->Array.VertexAttrib[8].Enabled"], "", "NV_vertex_program" ), - ( "GL_VERTEX_ATTRIB_ARRAY9_NV", GLboolean, - ["ctx->Array.VertexAttrib[9].Enabled"], "", "NV_vertex_program" ), - ( "GL_VERTEX_ATTRIB_ARRAY10_NV", GLboolean, - ["ctx->Array.VertexAttrib[10].Enabled"], "", "NV_vertex_program" ), - ( "GL_VERTEX_ATTRIB_ARRAY11_NV", GLboolean, - ["ctx->Array.VertexAttrib[11].Enabled"], "", "NV_vertex_program" ), - ( "GL_VERTEX_ATTRIB_ARRAY12_NV", GLboolean, - ["ctx->Array.VertexAttrib[12].Enabled"], "", "NV_vertex_program" ), - ( "GL_VERTEX_ATTRIB_ARRAY13_NV", GLboolean, - ["ctx->Array.VertexAttrib[13].Enabled"], "", "NV_vertex_program" ), - ( "GL_VERTEX_ATTRIB_ARRAY14_NV", GLboolean, - ["ctx->Array.VertexAttrib[14].Enabled"], "", "NV_vertex_program" ), - ( "GL_VERTEX_ATTRIB_ARRAY15_NV", GLboolean, - ["ctx->Array.VertexAttrib[15].Enabled"], "", "NV_vertex_program" ), - ( "GL_MAP1_VERTEX_ATTRIB0_4_NV", GLboolean, - ["ctx->Eval.Map1Attrib[0]"], "", "NV_vertex_program" ), - ( "GL_MAP1_VERTEX_ATTRIB1_4_NV", GLboolean, - ["ctx->Eval.Map1Attrib[1]"], "", "NV_vertex_program" ), - ( "GL_MAP1_VERTEX_ATTRIB2_4_NV", GLboolean, - ["ctx->Eval.Map1Attrib[2]"], "", "NV_vertex_program" ), - ( "GL_MAP1_VERTEX_ATTRIB3_4_NV", GLboolean, - ["ctx->Eval.Map1Attrib[3]"], "", "NV_vertex_program" ), - ( "GL_MAP1_VERTEX_ATTRIB4_4_NV", GLboolean, - ["ctx->Eval.Map1Attrib[4]"], "", "NV_vertex_program" ), - ( "GL_MAP1_VERTEX_ATTRIB5_4_NV", GLboolean, - ["ctx->Eval.Map1Attrib[5]"], "", "NV_vertex_program" ), - ( "GL_MAP1_VERTEX_ATTRIB6_4_NV", GLboolean, - ["ctx->Eval.Map1Attrib[6]"], "", "NV_vertex_program" ), - ( "GL_MAP1_VERTEX_ATTRIB7_4_NV", GLboolean, - ["ctx->Eval.Map1Attrib[7]"], "", "NV_vertex_program" ), - ( "GL_MAP1_VERTEX_ATTRIB8_4_NV", GLboolean, - ["ctx->Eval.Map1Attrib[8]"], "", "NV_vertex_program" ), - ( "GL_MAP1_VERTEX_ATTRIB9_4_NV", GLboolean, - ["ctx->Eval.Map1Attrib[9]"], "", "NV_vertex_program" ), - ( "GL_MAP1_VERTEX_ATTRIB10_4_NV", GLboolean, - ["ctx->Eval.Map1Attrib[10]"], "", "NV_vertex_program" ), - ( "GL_MAP1_VERTEX_ATTRIB11_4_NV", GLboolean, - ["ctx->Eval.Map1Attrib[11]"], "", "NV_vertex_program" ), - ( "GL_MAP1_VERTEX_ATTRIB12_4_NV", GLboolean, - ["ctx->Eval.Map1Attrib[12]"], "", "NV_vertex_program" ), - ( "GL_MAP1_VERTEX_ATTRIB13_4_NV", GLboolean, - ["ctx->Eval.Map1Attrib[13]"], "", "NV_vertex_program" ), - ( "GL_MAP1_VERTEX_ATTRIB14_4_NV", GLboolean, - ["ctx->Eval.Map1Attrib[14]"], "", "NV_vertex_program" ), - ( "GL_MAP1_VERTEX_ATTRIB15_4_NV", GLboolean, - ["ctx->Eval.Map1Attrib[15]"], "", "NV_vertex_program" ), - - # GL_NV_fragment_program - ( "GL_FRAGMENT_PROGRAM_NV", GLboolean, - ["ctx->FragmentProgram.Enabled"], "", "NV_fragment_program" ), - ( "GL_MAX_TEXTURE_COORDS_NV", GLint, - ["ctx->Const.MaxTextureCoordUnits"], "", "NV_fragment_program" ), - ( "GL_MAX_TEXTURE_IMAGE_UNITS_NV", GLint, - ["ctx->Const.MaxTextureImageUnits"], "", "NV_fragment_program" ), - ( "GL_FRAGMENT_PROGRAM_BINDING_NV", GLint, - ["ctx->FragmentProgram.Current ? ctx->FragmentProgram.Current->Base.Id : 0"], - "", "NV_fragment_program" ), - ( "GL_MAX_FRAGMENT_PROGRAM_LOCAL_PARAMETERS_NV", GLint, - ["MAX_NV_FRAGMENT_PROGRAM_PARAMS"], "", "NV_fragment_program" ), - - # GL_NV_texture_rectangle - ( "GL_TEXTURE_RECTANGLE_NV", GLboolean, - ["_mesa_IsEnabled(GL_TEXTURE_RECTANGLE_NV)"], "", "NV_texture_rectangle" ), - ( "GL_TEXTURE_BINDING_RECTANGLE_NV", GLint, - ["ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentRect->Name"], - "", "NV_texture_rectangle" ), - ( "GL_MAX_RECTANGLE_TEXTURE_SIZE_NV", GLint, - ["ctx->Const.MaxTextureRectSize"], "", "NV_texture_rectangle" ), - - # GL_EXT_stencil_two_side - ( "GL_STENCIL_TEST_TWO_SIDE_EXT", GLboolean, - ["ctx->Stencil.TestTwoSide"], "", "EXT_stencil_two_side" ), - ( "GL_ACTIVE_STENCIL_FACE_EXT", GLenum, - ["ctx->Stencil.ActiveFace ? GL_BACK : GL_FRONT"], - "", "EXT_stencil_two_side" ), - - # GL_NV_light_max_exponent - ( "GL_MAX_SHININESS_NV", GLfloat, - ["ctx->Const.MaxShininess"], "", "NV_light_max_exponent" ), - ( "GL_MAX_SPOT_EXPONENT_NV", GLfloat, - ["ctx->Const.MaxSpotExponent"], "", "NV_light_max_exponent" ), - - # GL_ARB_vertex_buffer_object - ( "GL_ARRAY_BUFFER_BINDING_ARB", GLint, - ["ctx->Array.ArrayBufferObj->Name"], "", "ARB_vertex_buffer_object" ), - ( "GL_VERTEX_ARRAY_BUFFER_BINDING_ARB", GLint, - ["ctx->Array.Vertex.BufferObj->Name"], "", "ARB_vertex_buffer_object" ), - ( "GL_NORMAL_ARRAY_BUFFER_BINDING_ARB", GLint, - ["ctx->Array.Normal.BufferObj->Name"], "", "ARB_vertex_buffer_object" ), - ( "GL_COLOR_ARRAY_BUFFER_BINDING_ARB", GLint, - ["ctx->Array.Color.BufferObj->Name"], "", "ARB_vertex_buffer_object" ), - ( "GL_INDEX_ARRAY_BUFFER_BINDING_ARB", GLint, - ["ctx->Array.Index.BufferObj->Name"], "", "ARB_vertex_buffer_object" ), - ( "GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB", GLint, - ["ctx->Array.TexCoord[ctx->Array.ActiveTexture].BufferObj->Name"], - "", "ARB_vertex_buffer_object" ), - ( "GL_EDGE_FLAG_ARRAY_BUFFER_BINDING_ARB", GLint, - ["ctx->Array.EdgeFlag.BufferObj->Name"], "", "ARB_vertex_buffer_object" ), - ( "GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB", GLint, - ["ctx->Array.SecondaryColor.BufferObj->Name"], - "", "ARB_vertex_buffer_object" ), - ( "GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB", GLint, - ["ctx->Array.FogCoord.BufferObj->Name"], "", "ARB_vertex_buffer_object" ), - # GL_WEIGHT_ARRAY_BUFFER_BINDING_ARB - not supported - ( "GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB", GLint, - ["ctx->Array.ElementArrayBufferObj->Name"], "", "ARB_vertex_buffer_object" ), - - # GL_EXT_pixel_buffer_object - ( "GL_PIXEL_PACK_BUFFER_BINDING_EXT", GLint, - ["ctx->Pack.BufferObj->Name"], "", "EXT_pixel_buffer_object" ), - ( "GL_PIXEL_UNPACK_BUFFER_BINDING_EXT", GLint, - ["ctx->Unpack.BufferObj->Name"], "", "EXT_pixel_buffer_object" ), - - # GL_ARB_vertex_program - ( "GL_MAX_VERTEX_ATTRIBS_ARB", GLint, - ["ctx->Const.MaxVertexProgramAttribs"], "", "ARB_vertex_program" ), - - # GL_ARB_fragment_program - ( "GL_FRAGMENT_PROGRAM_ARB", GLboolean, - ["ctx->FragmentProgram.Enabled"], "", "ARB_fragment_program" ), - ( "GL_TRANSPOSE_CURRENT_MATRIX_ARB", GLfloat, - ["matrix[0]", "matrix[4]", "matrix[8]", "matrix[12]", - "matrix[1]", "matrix[5]", "matrix[9]", "matrix[13]", - "matrix[2]", "matrix[6]", "matrix[10]", "matrix[14]", - "matrix[3]", "matrix[7]", "matrix[11]", "matrix[15]"], - "const GLfloat *matrix = ctx->CurrentStack->Top->m;", "ARB_fragment_program" ), - - # GL_EXT_depth_bounds_test - ( "GL_DEPTH_BOUNDS_TEST_EXT", GLboolean, - ["ctx->Depth.BoundsTest"], "", "EXT_depth_bounds_test" ), - ( "GL_DEPTH_BOUNDS_EXT", GLfloat, - ["ctx->Depth.BoundsMin", "ctx->Depth.BoundsMax"], - "", "EXT_depth_bounds_test" ), - - # GL_MESA_program_debug - ( "GL_FRAGMENT_PROGRAM_CALLBACK_MESA", GLboolean, - ["ctx->FragmentProgram.CallbackEnabled"], "", "MESA_program_debug" ), - ( "GL_VERTEX_PROGRAM_CALLBACK_MESA", GLboolean, - ["ctx->VertexProgram.CallbackEnabled"], "", "MESA_program_debug" ), - ( "GL_FRAGMENT_PROGRAM_POSITION_MESA", GLint, - ["ctx->FragmentProgram.CurrentPosition"], "", "MESA_program_debug" ), - ( "GL_VERTEX_PROGRAM_POSITION_MESA", GLint, - ["ctx->VertexProgram.CurrentPosition"], "", "MESA_program_debug" ), - - # GL_ARB_draw_buffers - ( "GL_MAX_DRAW_BUFFERS_ARB", GLint, - ["ctx->Const.MaxDrawBuffers"], "", "ARB_draw_buffers" ), - ( "GL_DRAW_BUFFER0_ARB", GLenum, - ["ctx->Color.DrawBuffer[0]"], "", "ARB_draw_buffers" ), - ( "GL_DRAW_BUFFER1_ARB", GLenum, - ["buffer"], - """GLenum buffer; - if (pname - GL_DRAW_BUFFER0_ARB >= ctx->Const.MaxDrawBuffers) { - _mesa_error(ctx, GL_INVALID_ENUM, "glGet(GL_DRAW_BUFFERx_ARB)"); - return; - } - buffer = ctx->Color.DrawBuffer[1];""", "ARB_draw_buffers" ), - ( "GL_DRAW_BUFFER2_ARB", GLenum, - ["buffer"], - """GLenum buffer; - if (pname - GL_DRAW_BUFFER0_ARB >= ctx->Const.MaxDrawBuffers) { - _mesa_error(ctx, GL_INVALID_ENUM, "glGet(GL_DRAW_BUFFERx_ARB)"); - return; - } - buffer = ctx->Color.DrawBuffer[2];""", "ARB_draw_buffers" ), - ( "GL_DRAW_BUFFER3_ARB", GLenum, - ["buffer"], - """GLenum buffer; - if (pname - GL_DRAW_BUFFER0_ARB >= ctx->Const.MaxDrawBuffers) { - _mesa_error(ctx, GL_INVALID_ENUM, "glGet(GL_DRAW_BUFFERx_ARB)"); - return; - } - buffer = ctx->Color.DrawBuffer[3];""", "ARB_draw_buffers" ), - # XXX Add more GL_DRAW_BUFFERn_ARB entries as needed in the future - - # GL_OES_read_format - ( "GL_IMPLEMENTATION_COLOR_READ_TYPE_OES", GLint, - ["ctx->Const.ColorReadType"], "", "OES_read_format" ), - ( "GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES", GLint, - ["ctx->Const.ColorReadFormat"], "", "OES_read_format" ), - - # GL_ATI_fragment_shader - ( "GL_NUM_FRAGMENT_REGISTERS_ATI", GLint, ["6"], "", "ATI_fragment_shader" ), - ( "GL_NUM_FRAGMENT_CONSTANTS_ATI", GLint, ["8"], "", "ATI_fragment_shader" ), - ( "GL_NUM_PASSES_ATI", GLint, ["2"], "", "ATI_fragment_shader" ), - ( "GL_NUM_INSTRUCTIONS_PER_PASS_ATI", GLint, ["8"], "", "ATI_fragment_shader" ), - ( "GL_NUM_INSTRUCTIONS_TOTAL_ATI", GLint, ["16"], "", "ATI_fragment_shader" ), - ( "GL_COLOR_ALPHA_PAIRING_ATI", GLboolean, ["GL_TRUE"], "", "ATI_fragment_shader" ), - ( "GL_NUM_LOOPBACK_COMPONENTS_ATI", GLint, ["3"], "", "ATI_fragment_shader" ), - ( "GL_NUM_INPUT_INTERPOLATOR_COMPONENTS_ATI", GLint, ["3"], "", "ATI_fragment_shader" ), - - # OpenGL 2.0 - ( "GL_STENCIL_BACK_FUNC", GLenum, ["ctx->Stencil.Function[1]"], "", None ), - ( "GL_STENCIL_BACK_VALUE_MASK", GLint, ["ctx->Stencil.ValueMask[1]"], "", None ), - ( "GL_STENCIL_BACK_REF", GLint, ["ctx->Stencil.Ref[1]"], "", None ), - ( "GL_STENCIL_BACK_FAIL", GLenum, ["ctx->Stencil.FailFunc[1]"], "", None ), - ( "GL_STENCIL_BACK_PASS_DEPTH_FAIL", GLenum, ["ctx->Stencil.ZFailFunc[1]"], "", None ), - ( "GL_STENCIL_BACK_PASS_DEPTH_PASS", GLenum, ["ctx->Stencil.ZPassFunc[1]"], "", None ), - - # GL_EXT_framebuffer_object - ( "GL_FRAMEBUFFER_BINDING_EXT", GLint, ["ctx->DrawBuffer->Name"], "", - "EXT_framebuffer_object" ), - ( "GL_RENDERBUFFER_BINDING_EXT", GLint, - ["ctx->CurrentRenderbuffer ? ctx->CurrentRenderbuffer->Name : 0"], "", - "EXT_framebuffer_object" ), - ( "GL_MAX_COLOR_ATTACHMENTS_EXT", GLint, - ["ctx->Const.MaxColorAttachments"], "", - "EXT_framebuffer_object" ), - ( "GL_MAX_RENDERBUFFER_SIZE_EXT", GLint, - ["ctx->Const.MaxRenderbufferSize"], "", - "EXT_framebuffer_object" ), - - # GL_ARB_fragment_shader - ( "GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB", GLint, ["MAX_FRAGMENT_UNIFORM_COMPONENTS"], "",
- "ARB_fragment_shader" ),
- ( "GL_FRAGMENT_SHADER_DERIVATIVE_HINT_ARB", GLenum, ["ctx->Hint.FragmentShaderDerivative"], "",
- "ARB_fragment_shader" ),
-
- # GL_ARB_vertex_shader
- ( "GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB", GLint, ["MAX_VERTEX_UNIFORM_COMPONENTS"], "",
- "ARB_vertex_shader" ),
- ( "GL_MAX_VARYING_FLOATS_ARB", GLint, ["MAX_VARYING_FLOATS"], "", "ARB_vertex_shader" ),
- ( "GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB", GLint, ["MAX_VERTEX_TEXTURE_IMAGE_UNITS"], "",
- "ARB_vertex_shader" ),
- ( "GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB", GLint, ["MAX_COMBINED_TEXTURE_IMAGE_UNITS"], "",
- "ARB_vertex_shader" ) -] - - -def ConversionFunc(fromType, toType): - """Return the name of the macro to convert between two data types.""" - if fromType == toType: - return "" - elif fromType == GLfloat and toType == GLint: - return "IROUND" - elif fromType == GLfloatN and toType == GLfloat: - return "" - elif fromType == GLint and toType == GLfloat: # but not GLfloatN! - return "(GLfloat)" - else: - if fromType == GLfloatN: - fromType = GLfloat - fromStr = TypeStrings[fromType] - fromStr = string.upper(fromStr[2:]) - toStr = TypeStrings[toType] - toStr = string.upper(toStr[2:]) - return fromStr + "_TO_" + toStr - - -def EmitGetFunction(stateVars, returnType): - """Emit the code to implement glGetBooleanv, glGetIntegerv or glGetFloatv.""" - assert (returnType == GLboolean or - returnType == GLint or - returnType == GLfloat) - - strType = TypeStrings[returnType] - # Capitalize first letter of return type - if returnType == GLint: - function = "GetIntegerv" - else: - function = "Get" + string.upper(strType[2]) + strType[3:] + "v" - - print "void GLAPIENTRY" - print "_mesa_%s( GLenum pname, %s *params )" % (function, TypeStrings[returnType]) - print "{" - print " GET_CURRENT_CONTEXT(ctx);" - print " ASSERT_OUTSIDE_BEGIN_END(ctx);" - print "" - print " if (!params)" - print " return;" - print "" - print " if (ctx->NewState)" - print " _mesa_update_state(ctx);" - print "" - print " if (ctx->Driver.%s &&" % function - print " ctx->Driver.%s(ctx, pname, params))" % function - print " return;" - print "" - print " switch (pname) {" - - extCheck = "CHECK_EXTENSION_%s" % string.upper(TypeStrings[returnType][2]) - - for (name, varType, state, optionalCode, extension) in stateVars: - print " case " + name + ":" - if extension: - print " %s(%s, pname);" % (extCheck, extension) - if optionalCode: - print " {" - print " " + optionalCode - conversion = ConversionFunc(varType, returnType) - n = len(state) - for i in range(n): - if conversion: - print " params[%d] = %s(%s);" % (i, conversion, state[i]) - else: - print " params[%d] = %s;" % (i, state[i]) - if optionalCode: - print " }" - print " break;" - - print " default:" - print ' _mesa_error(ctx, GL_INVALID_ENUM, "gl%s(pname=0x%%x)", pname);' % function - print " }" - print "}" - print "" - return - - - -def EmitHeader(): - """Print the get.c file header.""" - print """ -/*** - *** NOTE!!! DO NOT EDIT THIS FILE!!! IT IS GENERATED BY get_gen.py - ***/ - -#include "glheader.h" -#include "context.h" -#include "enable.h" -#include "extensions.h" -#include "fbobject.h" -#include "get.h" -#include "macros.h" -#include "mtypes.h" -#include "state.h" -#include "texcompress.h" - - -#define FLOAT_TO_BOOLEAN(X) ( (X) ? GL_TRUE : GL_FALSE ) - -#define INT_TO_BOOLEAN(I) ( (I) ? GL_TRUE : GL_FALSE ) - -#define ENUM_TO_BOOLEAN(E) ( (E) ? GL_TRUE : GL_FALSE ) -#define ENUM_TO_INT(E) ( (GLint) (E) ) -#define ENUM_TO_FLOAT(E) ( (GLfloat) (E) ) - -#define BOOLEAN_TO_INT(B) ( (GLint) (B) ) -#define BOOLEAN_TO_FLOAT(B) ( (B) ? 1.0F : 0.0F ) - - -/* Check if named extension is enabled, if not generate error and return */ - -#define CHECK1(E1, str, PNAME) \\ - if (!ctx->Extensions.E1) { \\ - _mesa_error(ctx, GL_INVALID_VALUE, \\ - "glGet" str "v(0x%x)", (int) PNAME); \\ - return; \\ - } - -#define CHECK2(E1, E2, str, PNAME) \\ - if (!ctx->Extensions.E1 && !ctx->Extensions.E2) { \\ - _mesa_error(ctx, GL_INVALID_VALUE, \\ - "glGet" str "v(0x%x)", (int) PNAME); \\ - return; \\ - } - -#define CHECK_EXTENSION_B(EXTNAME, PNAME) \\ - CHECK1(EXTNAME, "Boolean", PNAME ) - -#define CHECK_EXTENSION_I(EXTNAME, PNAME) \\ - CHECK1(EXTNAME, "Integer", PNAME ) - -#define CHECK_EXTENSION_F(EXTNAME, PNAME) \\ - CHECK1(EXTNAME, "Float", PNAME ) - - -/** - * Helper routine. - */ -static GLenum -pixel_texgen_mode(const GLcontext *ctx) -{ - if (ctx->Pixel.FragmentRgbSource == GL_CURRENT_RASTER_POSITION) { - if (ctx->Pixel.FragmentAlphaSource == GL_CURRENT_RASTER_POSITION) { - return GL_RGBA; - } - else { - return GL_RGB; - } - } - else { - if (ctx->Pixel.FragmentAlphaSource == GL_CURRENT_RASTER_POSITION) { - return GL_ALPHA; - } - else { - return GL_NONE; - } - } -} -""" - return - - - -def EmitGetDoublev(): - print """ -void GLAPIENTRY -_mesa_GetDoublev( GLenum pname, GLdouble *params ) -{ - const GLfloat magic = -1234.5F; - GLfloat values[16]; - GLuint i; - - if (!params) - return; - - /* Init temp array to magic numbers so we can figure out how many values - * are returned by the GetFloatv() call. - */ - for (i = 0; i < 16; i++) - values[i] = magic; - - _mesa_GetFloatv(pname, values); - - for (i = 0; i < 16 && values[i] != magic; i++) - params[i] = (GLdouble) values[i]; -} -""" - - - - -EmitHeader() -# XXX Maybe sort the StateVars list -EmitGetFunction(StateVars, GLboolean) -EmitGetFunction(StateVars, GLfloat) -EmitGetFunction(StateVars, GLint) -EmitGetDoublev() - diff --git a/nx-X11/extras/Mesa/src/mesa/main/mesa.def b/nx-X11/extras/Mesa/src/mesa/main/mesa.def deleted file mode 100644 index b0c9ab3ca..000000000 --- a/nx-X11/extras/Mesa/src/mesa/main/mesa.def +++ /dev/null @@ -1,491 +0,0 @@ -DESCRIPTION 'Mesa (OpenGL work-alike) for Win32' -VERSION 4.1 - -EXPORTS - glAccum - glAlphaFunc - glAreTexturesResident - glAreTexturesResidentEXT - glArrayElement - glArrayElementEXT - glBegin - glBindTexture - glBindTextureEXT - glBitmap - glBlendColorEXT - glBlendEquationEXT - glBlendFunc - glCallList - glCallLists - glClear - glClearAccum - glClearColor - glClearDepth - glClearIndex - glClearStencil - glClipPlane - glColor3b - glColor3bv - glColor3d - glColor3dv - glColor3f - glColor3fv - glColor3i - glColor3iv - glColor3s - glColor3sv - glColor3ub - glColor3ubv - glColor3ui - glColor3uiv - glColor3us - glColor3usv - glColor4b - glColor4bv - glColor4d - glColor4dv - glColor4f - glColor4fv - glColor4i - glColor4iv - glColor4s - glColor4sv - glColor4ub - glColor4ubv - glColor4ui - glColor4uiv - glColor4us - glColor4usv - glColorMask - glColorMaterial - glColorPointer - glColorPointerEXT - glColorSubTableEXT - glColorTableEXT - glCopyPixels - glCopyTexImage1D - glCopyTexImage2D - glCopyTexSubImage1D - glCopyTexSubImage2D - glCopyTexSubImage3DEXT - glCullFace - glDeleteLists - glDeleteTextures - glDeleteTexturesEXT - glDepthFunc - glDepthMask - glDepthRange - glDisable - glDisableClientState - glDrawArrays - glDrawArraysEXT - glDrawBuffer - glDrawElements - glDrawPixels - glEdgeFlag - glEdgeFlagPointer - glEdgeFlagPointerEXT - glEdgeFlagv - glEnable - glEnableClientState - glEnd - glEndList - glEvalCoord1d - glEvalCoord1dv - glEvalCoord1f - glEvalCoord1fv - glEvalCoord2d - glEvalCoord2dv - glEvalCoord2f - glEvalCoord2fv - glEvalMesh1 - glEvalMesh2 - glEvalPoint1 - glEvalPoint2 - glFeedbackBuffer - glFinish - glFlush - glFogf - glFogfv - glFogi - glFogiv - glFrontFace - glFrustum - glGenLists - glGenTextures - glGenTexturesEXT - glGetBooleanv - glGetClipPlane - glGetColorTableEXT - glGetColorTableParameterfvEXT - glGetColorTableParameterivEXT - glGetDoublev - glGetError - glGetFloatv - glGetIntegerv - glGetLightfv - glGetLightiv - glGetMapdv - glGetMapfv - glGetMapiv - glGetMaterialfv - glGetMaterialiv - glGetPixelMapfv - glGetPixelMapuiv - glGetPixelMapusv - glGetPointerv - glGetPointervEXT - glGetPolygonStipple - glGetString - glGetTexEnvfv - glGetTexEnviv - glGetTexGendv - glGetTexGenfv - glGetTexGeniv - glGetTexImage - glGetTexLevelParameterfv - glGetTexLevelParameteriv - glGetTexParameterfv - glGetTexParameteriv - glHint - glIndexd - glIndexdv - glIndexf - glIndexfv - glIndexi - glIndexiv - glIndexMask - glIndexPointer - glIndexPointerEXT - glIndexs - glIndexsv - glIndexub - glIndexubv - glInitNames - glInterleavedArrays - glIsEnabled - glIsList - glIsTexture - glIsTextureEXT - glLightf - glLightfv - glLighti - glLightiv - glLightModelf - glLightModelfv - glLightModeli - glLightModeliv - glLineStipple - glLineWidth - glListBase - glLoadIdentity - glLoadMatrixd - glLoadMatrixf - glLoadName - glLogicOp - glMap1d - glMap1f - glMap2d - glMap2f - glMapGrid1d - glMapGrid1f - glMapGrid2d - glMapGrid2f - glMaterialf - glMaterialfv - glMateriali - glMaterialiv - glMatrixMode - glMultMatrixd - glMultMatrixf - glNewList - glNormal3b - glNormal3bv - glNormal3d - glNormal3dv - glNormal3f - glNormal3fv - glNormal3i - glNormal3iv - glNormal3s - glNormal3sv - glNormalPointer - glNormalPointerEXT - glOrtho - glPassThrough - glPixelMapfv - glPixelMapuiv - glPixelMapusv - glPixelStoref - glPixelStorei - glPixelTransferf - glPixelTransferi - glPixelZoom - glPointParameterfEXT - glPointParameterfvEXT - glPointSize - glPolygonMode - glPolygonOffset - glPolygonOffsetEXT - glPolygonStipple - glPopAttrib - glPopClientAttrib - glPopMatrix - glPopName - glPrioritizeTextures - glPrioritizeTexturesEXT - glPushAttrib - glPushClientAttrib - glPushMatrix - glPushName - glRasterPos2d - glRasterPos2dv - glRasterPos2f - glRasterPos2fv - glRasterPos2i - glRasterPos2iv - glRasterPos2s - glRasterPos2sv - glRasterPos3d - glRasterPos3dv - glRasterPos3f - glRasterPos3fv - glRasterPos3i - glRasterPos3iv - glRasterPos3s - glRasterPos3sv - glRasterPos4d - glRasterPos4dv - glRasterPos4f - glRasterPos4fv - glRasterPos4i - glRasterPos4iv - glRasterPos4s - glRasterPos4sv - glReadBuffer - glReadPixels - glRectd - glRectdv - glRectf - glRectfv - glRecti - glRectiv - glRects - glRectsv - glRenderMode - glResizeBuffersMESA - glRotated - glRotatef - glScaled - glScalef - glScissor - glSelectBuffer - glShadeModel - glStencilFunc - glStencilMask - glStencilOp - glTexCoord1d - glTexCoord1dv - glTexCoord1f - glTexCoord1fv - glTexCoord1i - glTexCoord1iv - glTexCoord1s - glTexCoord1sv - glTexCoord2d - glTexCoord2dv - glTexCoord2f - glTexCoord2fv - glTexCoord2i - glTexCoord2iv - glTexCoord2s - glTexCoord2sv - glTexCoord3d - glTexCoord3dv - glTexCoord3f - glTexCoord3fv - glTexCoord3i - glTexCoord3iv - glTexCoord3s - glTexCoord3sv - glTexCoord4d - glTexCoord4dv - glTexCoord4f - glTexCoord4fv - glTexCoord4i - glTexCoord4iv - glTexCoord4s - glTexCoord4sv - glTexCoordPointer - glTexCoordPointerEXT - glTexEnvf - glTexEnvfv - glTexEnvi - glTexEnviv - glTexGend - glTexGendv - glTexGenf - glTexGenfv - glTexGeni - glTexGeniv - glTexImage1D - glTexImage2D - glTexImage3DEXT - glTexParameterf - glTexParameterfv - glTexParameteri - glTexParameteriv - glTexSubImage1D - glTexSubImage2D - glTexSubImage3DEXT - glTranslated - glTranslatef - glVertex2d - glVertex2dv - glVertex2f - glVertex2fv - glVertex2i - glVertex2iv - glVertex2s - glVertex2sv - glVertex3d - glVertex3dv - glVertex3f - glVertex3fv - glVertex3i - glVertex3iv - glVertex3s - glVertex3sv - glVertex4d - glVertex4dv - glVertex4f - glVertex4fv - glVertex4i - glVertex4iv - glVertex4s - glVertex4sv - glVertexPointer - glVertexPointerEXT - glViewport - glWindowPos2dMESA - glWindowPos2dvMESA - glWindowPos2fMESA - glWindowPos2fvMESA - glWindowPos2iMESA - glWindowPos2ivMESA - glWindowPos2sMESA - glWindowPos2svMESA - glWindowPos3dMESA - glWindowPos3dvMESA - glWindowPos3fMESA - glWindowPos3fvMESA - glWindowPos3iMESA - glWindowPos3ivMESA - glWindowPos3sMESA - glWindowPos3svMESA - glWindowPos4dMESA - glWindowPos4dvMESA - glWindowPos4fMESA - glWindowPos4fvMESA - glWindowPos4iMESA - glWindowPos4ivMESA - glWindowPos4sMESA - glWindowPos4svMESA - _swsetup_Wakeup - _swsetup_CreateContext - _tnl_CreateContext - _ac_CreateContext - _swrast_CreateContext - _mesa_free_context_data - _mesa_create_framebuffer - _mesa_enable_1_3_extensions - _mesa_enable_1_4_extensions - _mesa_enable_sw_extensions - _mesa_destroy_visual - _mesa_initialize_context - _mesa_create_visual - _mesa_destroy_framebuffer - _swrast_DestroyContext - _ac_DestroyContext - _tnl_DestroyContext - _swsetup_DestroyContext - _mesa_Viewport - _mesa_make_current - _mesa_get_current_context - _mesa_error - _swrast_choose_triangle - _mesa_zbuffer_address - _swrast_choose_line - _tnl_InvalidateState - _ac_InvalidateState - _swsetup_InvalidateState - _swrast_InvalidateState - _tnl_run_pipeline - _swrast_CopyConvolutionFilter2D - _swrast_CopyConvolutionFilter1D - _swrast_CopyColorSubTable - _swrast_CopyColorTable - _swrast_copy_texsubimage3d - _swrast_copy_texsubimage2d - _swrast_copy_texsubimage1d - _swrast_copy_teximage2d - _swrast_copy_teximage1d - _mesa_test_proxy_teximage - _mesa_store_texsubimage3d - _mesa_store_texsubimage2d - _mesa_store_texsubimage1d - _mesa_store_teximage3d - _mesa_store_teximage2d - _mesa_store_teximage1d - _mesa_store_compressed_texsubimage3d - _mesa_store_compressed_texsubimage2d - _mesa_store_compressed_texsubimage1d - _mesa_store_compressed_teximage3d - _mesa_store_compressed_teximage2d - _mesa_store_compressed_teximage1d - _mesa_choose_tex_format - _mesa_compressed_texture_size - _swrast_ReadPixels - _swrast_DrawPixels - _swrast_CopyPixels - _swrast_Bitmap - _swrast_Accum - _swrast_alloc_buffers - _swrast_GetDeviceDriverReference - _swrast_Clear - _glapi_get_context - _mesa_ResizeBuffersMESA - _glapi_get_proc_address - _mesa_init_default_imports - _tnl_MakeCurrent - _swrast_DrawBuffer - _mesa_free - _mesa_calloc - _mesa_strcmp - _mesa_bzero - _mesa_memset - _mesa_memcpy - _mesa_problem - wglCopyContext - wglCreateContext - wglDeleteContext - wglCreateLayerContext - wglGetCurrentContext - wglGetCurrentDC - wglMakeCurrent - wglShareLists - wglUseFontBitmapsA - wglUseFontBitmapsW - wglUseFontOutlinesA - wglUseFontOutlinesW - wglDescribeLayerPlane - wglSetLayerPaletteEntries - wglGetLayerPaletteEntries - wglRealizeLayerPalette - wglSwapLayerBuffers - wglChoosePixelFormat - wglDescribePixelFormat - wglGetProcAddress - wglGetPixelFormat - wglSetPixelFormat - wglSwapBuffers diff --git a/nx-X11/extras/Mesa/src/mesa/main/vsnprintf.c b/nx-X11/extras/Mesa/src/mesa/main/vsnprintf.c deleted file mode 100644 index ab6c740d7..000000000 --- a/nx-X11/extras/Mesa/src/mesa/main/vsnprintf.c +++ /dev/null @@ -1,165 +0,0 @@ -/* - * Revision 12: http://theos.com/~deraadt/snprintf.c - * - * Copyright (c) 1997 Theo de Raadt - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef __VMS -# include <sys/param.h> -#endif -#include <sys/types.h> -#include <sys/mman.h> -#include <signal.h> -#include <stdio.h> -#if __STDC__ -#include <stdarg.h> -#include <stdlib.h> -#else -#include <varargs.h> -#endif -#include <setjmp.h> -#include <unistd.h> -#include <string.h> - -#ifndef roundup -#define roundup(x, y) ((((x)+((y)-1))/(y))*(y)) -#endif - -#ifdef __sgi -#define size_t ssize_t -#endif - -static int pgsize; -static char *curobj; -static int caught; -static sigjmp_buf bail; - -#define EXTRABYTES 2 /* XXX: why 2? you don't want to know */ - -static char * -msetup(str, n) - char *str; - size_t n; -{ - char *e; - - if (n == 0) - return NULL; - if (pgsize == 0) - pgsize = getpagesize(); - curobj = (char *)malloc(n + EXTRABYTES + pgsize * 2); - if (curobj == NULL) - return NULL; - e = curobj + n + EXTRABYTES; - e = (char *)roundup((unsigned long)e, pgsize); - if (mprotect(e, pgsize, PROT_NONE) == -1) { - free(curobj); - curobj = NULL; - return NULL; - } - e = e - n - EXTRABYTES; - *e = '\0'; - return (e); -} - -static void - mcatch( int a ) -{ - siglongjmp(bail, 1); -} - -static void -mcleanup(str, n, p) - char *str; - size_t n; - char *p; -{ - strncpy(str, p, n-1); - str[n-1] = '\0'; - if (mprotect((caddr_t)(p + n + EXTRABYTES), pgsize, - PROT_READ|PROT_WRITE|PROT_EXEC) == -1) - mprotect((caddr_t)(p + n + EXTRABYTES), pgsize, - PROT_READ|PROT_WRITE); - free(curobj); -} - -int -#if __STDC__ -vsnprintf(char *str, size_t n, char const *fmt, va_list ap) -#else -vsnprintf(str, n, fmt, ap) - char *str; - size_t n; - char *fmt; - char *ap; -#endif -{ - struct sigaction osa, nsa; - char *p; - int ret = n + 1; /* if we bail, indicated we overflowed */ - - memset(&nsa, 0, sizeof nsa); - nsa.sa_handler = mcatch; - sigemptyset(&nsa.sa_mask); - - p = msetup(str, n); - if (p == NULL) { - *str = '\0'; - return 0; - } - if (sigsetjmp(bail, 1) == 0) { - if (sigaction(SIGSEGV, &nsa, &osa) == -1) { - mcleanup(str, n, p); - return (0); - } - ret = vsprintf(p, fmt, ap); - } - mcleanup(str, n, p); - (void) sigaction(SIGSEGV, &osa, NULL); - return (ret); -} - -int -#if __STDC__ -snprintf(char *str, size_t n, char const *fmt, ...) -#else -snprintf(str, n, fmt, va_alist) - char *str; - size_t n; - char *fmt; - va_dcl -#endif -{ - va_list ap; -#if __STDC__ - va_start(ap, fmt); -#else - va_start(ap); -#endif - - return (vsnprintf(str, n, fmt, ap)); - va_end(ap); -} - - - |