From 0a59ca6cae6ef24990f1c41c8c7857214489443c Mon Sep 17 00:00:00 2001 From: Gareth Hughes Date: Wed, 28 Mar 2001 20:44:43 +0000 Subject: [PATCH] New type system for assembly code. Asm files should now include matypes.h, which includes assyntax.h and is generated from the core Mesa header files. --- Make-config | 125 ++++++------- src/mesa/Makefile.X11 | 11 +- src/mesa/main/Makefile.X11 | 11 +- src/mesa/x86/3dnow.c | 101 +++++----- src/mesa/x86/3dnow.h | 4 +- src/mesa/x86/clip_args.h | 20 +- src/mesa/x86/common_x86.c | 5 +- src/mesa/x86/common_x86_asm.S | 9 +- src/mesa/x86/common_x86_asm.h | 4 +- src/mesa/x86/common_x86_features.h | 9 +- src/mesa/x86/gen_matypes.c | 286 +++++++++++++++++++++++++++++ src/mesa/x86/mmx.h | 4 +- src/mesa/x86/mmx_blend.S | 2 +- src/mesa/x86/norm_args.h | 61 ++++++ src/mesa/x86/x86.c | 81 ++++---- src/mesa/x86/x86.h | 4 +- src/mesa/x86/x86_cliptest.S | 33 +--- src/mesa/x86/xform_args.h | 20 +- 18 files changed, 536 insertions(+), 254 deletions(-) create mode 100644 src/mesa/x86/gen_matypes.c create mode 100644 src/mesa/x86/norm_args.h diff --git a/Make-config b/Make-config index 813acb484d2..af45b17d132 100644 --- a/Make-config +++ b/Make-config @@ -1,4 +1,4 @@ -# $Id: Make-config,v 1.37 2001/03/17 00:27:04 brianp Exp $ +# $Id: Make-config,v 1.38 2001/03/28 20:44:43 gareth Exp $ MESA_MAJOR=3 MESA_MINOR=5 @@ -220,9 +220,9 @@ freebsd-386: "MAKELIB = ../bin/mklib.freebsd" \ "APP_LIB_DEPS = -L/usr/X11R6/lib -lXext -lXmu -lXi -lX11 -lm" \ "ASM_SOURCES = X86/common_x86_asm.S X86/glapi_x86.S \ - X86/x86_xform_raw2.S X86/x86_xform_raw3.S \ - X86/x86_xform_raw4.S X86/x86_xform_masked2.S \ - X86/x86_xform_masked3.S X86/x86_xform_masked4.S \ + X86/x86_xform_raw2.S X86/x86_xform_masked2.S \ + X86/x86_xform_raw3.S X86/x86_xform_masked3.S \ + X86/x86_xform_raw4.S X86/x86_xform_masked4.S \ X86/x86_cliptest.S" gcc: @@ -561,18 +561,17 @@ linux-x86: "GLU_LIB_DEPS = -L../lib -lGL -lm" \ "GLUT_LIB_DEPS = -L../lib -lGLU -lGL -L/usr/X11R6/lib -lX11 -lXmu -lXt -lXi -lm" \ "APP_LIB_DEPS = -lm" \ + "GEN_SOURCES = X86/matypes.h" \ "ASM_SOURCES = X86/common_x86_asm.S X86/glapi_x86.S \ - X86/x86_xform_raw2.S X86/x86_xform_raw3.S \ - X86/x86_xform_raw4.S X86/x86_xform_masked2.S \ - X86/x86_xform_masked3.S X86/x86_xform_masked4.S \ + X86/x86_xform_raw2.S X86/x86_xform_masked2.S \ + X86/x86_xform_raw3.S X86/x86_xform_masked3.S \ + X86/x86_xform_raw4.S X86/x86_xform_masked4.S \ X86/x86_cliptest.S X86/x86_vertex.S \ X86/mmx_blend.S \ - X86/3dnow_xform_raw1.S X86/3dnow_xform_raw2.S \ - X86/3dnow_xform_raw3.S X86/3dnow_xform_raw4.S \ - X86/3dnow_xform_masked1.S X86/3dnow_xform_masked2.S \ - X86/3dnow_xform_masked3.S X86/3dnow_xform_masked4.S \ + X86/3dnow_xform_raw2.S X86/3dnow_xform_masked2.S \ + X86/3dnow_xform_raw3.S X86/3dnow_xform_masked3.S \ + X86/3dnow_xform_raw4.S X86/3dnow_xform_masked4.S \ X86/3dnow_norm_raw.S X86/3dnow_vertex.S \ - X86/katmai_xform_raw1.S X86/katmai_xform_masked1.S \ X86/katmai_xform_raw2.S X86/katmai_xform_masked2.S \ X86/katmai_xform_raw3.S X86/katmai_xform_masked3.S \ X86/katmai_xform_raw4.S X86/katmai_xform_masked4.S \ @@ -593,17 +592,15 @@ linux-x86-static: "GLUT_LIB_DEPS = -L../lib -lGLU -lGL -L/usr/X11R6/lib -lX11 -lXmu -lXt -lXi -lm" \ "APP_LIB_DEPS = -lm" \ "ASM_SOURCES = X86/common_x86_asm.S X86/glapi_x86.S \ - X86/x86_xform_raw2.S X86/x86_xform_raw3.S \ - X86/x86_xform_raw4.S X86/x86_xform_masked2.S \ - X86/x86_xform_masked3.S X86/x86_xform_masked4.S \ + X86/x86_xform_raw2.S X86/x86_xform_masked2.S \ + X86/x86_xform_raw3.S X86/x86_xform_masked3.S \ + X86/x86_xform_raw4.S X86/x86_xform_masked4.S \ X86/x86_cliptest.S X86/x86_vertex.S \ X86/mmx_blend.S \ - X86/3dnow_xform_raw1.S X86/3dnow_xform_raw2.S \ - X86/3dnow_xform_raw3.S X86/3dnow_xform_raw4.S \ - X86/3dnow_xform_masked1.S X86/3dnow_xform_masked2.S \ - X86/3dnow_xform_masked3.S X86/3dnow_xform_masked4.S \ + X86/3dnow_xform_raw2.S X86/3dnow_xform_masked2.S \ + X86/3dnow_xform_raw3.S X86/3dnow_xform_masked3.S \ + X86/3dnow_xform_raw4.S X86/3dnow_xform_masked4.S \ X86/3dnow_norm_raw.S X86/3dnow_vertex.S \ - X86/katmai_xform_raw1.S X86/katmai_xform_masked1.S \ X86/katmai_xform_raw2.S X86/katmai_xform_masked2.S \ X86/katmai_xform_raw3.S X86/katmai_xform_masked3.S \ X86/katmai_xform_raw4.S X86/katmai_xform_masked4.S \ @@ -639,9 +636,9 @@ linux-386-ggi: "MAKELIB = ../bin/mklib.ggi" \ "APP_LIB_DEPS = -L/usr/X11R6/lib -lX11 -lXext -lXmu -lXt -lXi -lggi -lm" \ "ASM_SOURCES = X86/common_x86_asm.S X86/glapi_x86.S \ - X86/x86_xform_raw2.S X86/x86_xform_raw3.S \ - X86/x86_xform_raw4.S X86/x86_xform_masked2.S \ - X86/x86_xform_masked3.S X86/x86_xform_masked4.S \ + X86/x86_xform_raw2.S X86/x86_xform_masked3.S \ + X86/x86_xform_raw3.S X86/x86_xform_masked2.S \ + X86/x86_xform_raw4.S X86/x86_xform_masked4.S \ X86/x86_cliptest.S X86/x86_vertex.S" linux-glide: @@ -678,9 +675,9 @@ linux-386-glide: "GLUT_LIB_DEPS = -L../lib -lGLU -lGL -L/usr/X11R6/lib -lX11 -lXmu -lXt -lXi -lm" \ "APP_LIB_DEPS = -lm" \ "ASM_SOURCES = X86/common_x86_asm.S X86/glapi_x86.S \ - X86/x86_xform_raw2.S X86/x86_xform_raw3.S \ - X86/x86_xform_raw4.S X86/x86_xform_masked2.S \ - X86/x86_xform_masked3.S X86/x86_xform_masked4.S \ + X86/x86_xform_raw2.S X86/x86_xform_masked2.S \ + X86/x86_xform_raw3.S X86/x86_xform_masked3.S \ + X86/x86_xform_raw4.S X86/x86_xform_masked4.S \ X86/x86_cliptest.S X86/x86_vertex.S" linux-386-opt-glide: @@ -700,9 +697,9 @@ linux-386-opt-glide: "GLUT_LIB_DEPS = -L../lib -lGLU -lGL -L/usr/X11R6/lib -lX11 -lXmu -lXt -lXi -lm" \ "APP_LIB_DEPS = -lm" \ "ASM_SOURCES = X86/common_x86_asm.S X86/glapi_x86.S \ - X86/x86_xform_raw2.S X86/x86_xform_raw3.S \ - X86/x86_xform_raw4.S X86/x86_xform_masked2.S \ - X86/x86_xform_masked3.S X86/x86_xform_masked4.S \ + X86/x86_xform_raw2.S X86/x86_xform_masked2.S \ + X86/x86_xform_raw3.S X86/x86_xform_masked3.S \ + X86/x86_xform_raw4.S X86/x86_xform_masked4.S \ X86/x86_cliptest.S X86/x86_vertex.S" linux-386-opt-V2-glide: @@ -722,9 +719,9 @@ linux-386-opt-V2-glide: "GLUT_LIB_DEPS = -L../lib -lGLU -lGL -L/usr/X11R6/lib -lX11 -lXmu -lXt -lXi -lm" \ "APP_LIB_DEPS = -lm" \ "ASM_SOURCES = X86/common_x86_asm.S X86/glapi_x86.S \ - X86/x86_xform_raw2.S X86/x86_xform_raw3.S \ - X86/x86_xform_raw4.S X86/x86_xform_masked2.S \ - X86/x86_xform_masked3.S X86/x86_xform_masked4.S \ + X86/x86_xform_raw2.S X86/x86_xform_masked2.S \ + X86/x86_xform_raw3.S X86/x86_xform_masked3.S \ + X86/x86_xform_raw4.S X86/x86_xform_masked4.S \ X86/x86_cliptest.S X86/x86_vertex.S" linux-x86-glide: @@ -742,18 +739,16 @@ linux-x86-glide: "GLUT_LIB_DEPS = -L../lib -lGLU -lGL -L/usr/X11R6/lib -lX11 -lXmu -lXt -lXi -lm" \ "APP_LIB_DEPS = -lm" \ "ASM_SOURCES = X86/common_x86_asm.S X86/glapi_x86.S \ - X86/x86_xform_raw2.S X86/x86_xform_raw3.S \ - X86/x86_xform_raw4.S X86/x86_xform_masked2.S \ - X86/x86_xform_masked3.S X86/x86_xform_masked4.S \ + X86/x86_xform_raw2.S X86/x86_xform_masked2.S \ + X86/x86_xform_raw3.S X86/x86_xform_masked3.S \ + X86/x86_xform_raw4.S X86/x86_xform_masked4.S \ X86/x86_cliptest.S X86/x86_vertex.S \ X86/mmx_blend.S \ - X86/3dnow_xform_raw1.S X86/3dnow_xform_raw2.S \ - X86/3dnow_xform_raw3.S X86/3dnow_xform_raw4.S \ - X86/3dnow_xform_masked1.S X86/3dnow_xform_masked2.S \ - X86/3dnow_xform_masked3.S X86/3dnow_xform_masked4.S \ + X86/3dnow_xform_raw2.S X86/3dnow_xform_raw2.S \ + X86/3dnow_xform_raw3.S X86/3dnow_xform_raw3.S \ + X86/3dnow_xform_raw4.S X86/3dnow_xform_raw4.S \ X86/3dnow_norm_raw.S X86/3dnow_vertex.S \ FX/X86/fx_3dnow_fastpath.S \ - X86/katmai_xform_raw1.S X86/katmai_xform_masked1.S \ X86/katmai_xform_raw2.S X86/katmai_xform_masked2.S \ X86/katmai_xform_raw3.S X86/katmai_xform_masked3.S \ X86/katmai_xform_raw4.S X86/katmai_xform_masked4.S \ @@ -1002,9 +997,9 @@ os2-x11: "MAKELIB = ..\\bin\\mklib-emx.cmd " \ "APP_LIB_DEPS = -Zmt -Zcrtdll -Zexe -L$(X11ROOT)/XFree86/lib -lXt -lX11 -lm" \ "ASM_SOURCES = X86/common_x86_asm.S X86/glapi_x86.S \ - X86/x86_xform_raw2.S X86/x86_xform_raw3.S \ - X86/x86_xform_raw4.S X86/x86_xform_masked2.S \ - X86/x86_xform_masked3.S X86/x86_xform_masked4.S \ + X86/x86_xform_raw2.S X86/x86_xform_masked2.S \ + X86/x86_xform_raw3.S X86/x86_xform_masked3.S \ + X86/x86_xform_raw4.S X86/x86_xform_masked4.S \ X86/x86_cliptest.S X86/x86_vertex.S" osf1: @@ -1478,7 +1473,7 @@ linux-debug: "CFLAGS = -g -ansi -pedantic -Wall -Wmissing-prototypes -fPIC -ffast-math -D_SVID_SOURCE -D_BSD_SOURCE -I/usr/X11R6/include -DUSE_XSHM -DPTHREADS -DDEBUG -DMESA_DEBUG -DSVGA -I/usr/include/glide -DFX -DMESA_TRACE" \ "CCFLAGS = $(CFLAGS)" \ "MAKELIB = ../bin/mklib.linux" \ - "GL_LIB_DEPS = -L/usr/X11R6/lib -lX11 -lXext -lm -lpthread -lvga -L/usr/local/glide/lib -lglide2x" \ + "GL_LIB_DEPS = -L/usr/X11R6/lib -lX11 -lXext -lm -lpthread" \ "GLU_LIB_DEPS = -L../lib -lGL -lm" \ "GLUT_LIB_DEPS = -L../lib -lGLU -lGL -L/usr/X11R6/lib -lX11 -lXmu -lXt -lXi -lm" \ "APP_LIB_DEPS = -lglut -lGLU -lGL" @@ -1512,17 +1507,15 @@ linux-x86-debug: "GLUT_LIB_DEPS = -L../lib -lGLU -lGL -L/usr/X11R6/lib -lX11 -lXmu -lXt -lXi -lm" \ "APP_LIB_DEPS = -lm" \ "ASM_SOURCES = X86/common_x86_asm.S X86/glapi_x86.S \ - X86/x86_xform_raw2.S X86/x86_xform_raw3.S \ - X86/x86_xform_raw4.S X86/x86_xform_masked2.S \ - X86/x86_xform_masked3.S X86/x86_xform_masked4.S \ + X86/x86_xform_raw2.S X86/x86_xform_masked2.S \ + X86/x86_xform_raw3.S X86/x86_xform_masked3.S \ + X86/x86_xform_raw4.S X86/x86_xform_masked4.S \ X86/x86_cliptest.S X86/x86_vertex.S \ X86/mmx_blend.S \ - X86/3dnow_xform_raw1.S X86/3dnow_xform_raw2.S \ - X86/3dnow_xform_raw3.S X86/3dnow_xform_raw4.S \ - X86/3dnow_xform_masked1.S X86/3dnow_xform_masked2.S \ - X86/3dnow_xform_masked3.S X86/3dnow_xform_masked4.S \ + X86/3dnow_xform_raw2.S X86/3dnow_xform_masked2.S \ + X86/3dnow_xform_raw3.S X86/3dnow_xform_masked3.S \ + X86/3dnow_xform_raw4.S X86/3dnow_xform_masked4.S \ X86/3dnow_norm_raw.S X86/3dnow_vertex.S \ - X86/katmai_xform_raw1.S X86/katmai_xform_masked1.S \ X86/katmai_xform_raw2.S X86/katmai_xform_masked2.S \ X86/katmai_xform_raw3.S X86/katmai_xform_masked3.S \ X86/katmai_xform_raw4.S X86/katmai_xform_masked4.S \ @@ -1557,18 +1550,16 @@ linux-prof: "MAKELIB = ../bin/mklib.ar-ruv" \ "APP_LIB_DEPS = -L/usr/X11/lib -lX11 -lXext -lXmu -lXt -lXi -lSM -lICE -lm" \ "ASM_SOURCES = X86/common_x86_asm.S X86/glapi_x86.S \ - X86/x86_xform_raw2.S X86/x86_xform_raw3.S \ - X86/x86_xform_raw4.S X86/x86_xform_masked2.S \ - X86/x86_xform_masked3.S X86/x86_xform_masked4.S \ + X86/x86_xform_raw2.S X86/x86_xform_masked2.S \ + X86/x86_xform_raw2.S X86/x86_xform_masked3.S \ + X86/x86_xform_raw4.S X86/x86_xform_masked4.S \ X86/x86_cliptest.S X86/x86_vertex.S \ X86/mmx_blend.S \ - X86/3dnow_xform_raw1.S X86/3dnow_xform_raw2.S \ - X86/3dnow_xform_raw3.S X86/3dnow_xform_raw4.S \ - X86/3dnow_xform_masked1.S X86/3dnow_xform_masked2.S \ - X86/3dnow_xform_masked3.S X86/3dnow_xform_masked4.S \ + X86/3dnow_xform_raw2.S X86/3dnow_xform_masked2.S \ + X86/3dnow_xform_raw3.S X86/3dnow_xform_masked3.S \ + X86/3dnow_xform_raw4.S X86/3dnow_xform_masked4.S \ X86/3dnow_norm_raw.S X86/3dnow_vertex.S \ FX/X86/fx_3dnow_fastpath.S \ - X86/katmai_xform_raw1.S X86/katmai_xform_masked1.S \ X86/katmai_xform_raw2.S X86/katmai_xform_masked2.S \ X86/katmai_xform_raw3.S X86/katmai_xform_masked3.S \ X86/katmai_xform_raw4.S X86/katmai_xform_masked4.S \ @@ -1588,18 +1579,16 @@ linux-glide-prof: "MAKELIB = ../bin/mklib.ar-ruv" \ "APP_LIB_DEPS = -L/usr/local/glide/lib -lglide2x -L/usr/X11/lib -lX11 -lXext -lXmu -lXt -lXi -lSM -lICE -lm" \ "ASM_SOURCES = X86/common_x86_asm.S X86/glapi_x86.S \ - X86/x86_xform_raw2.S X86/x86_xform_raw3.S \ - X86/x86_xform_raw4.S X86/x86_xform_masked2.S \ - X86/x86_xform_masked3.S X86/x86_xform_masked4.S \ + X86/x86_xform_raw2.S X86/x86_xform_masked2.S \ + X86/x86_xform_raw3.S X86/x86_xform_masked3.S \ + X86/x86_xform_raw4.S X86/x86_xform_masked4.S \ X86/x86_cliptest.S X86/x86_vertex.S \ X86/mmx_blend.S \ - X86/3dnow_xform_raw1.S X86/3dnow_xform_raw2.S \ - X86/3dnow_xform_raw3.S X86/3dnow_xform_raw4.S \ - X86/3dnow_xform_masked1.S X86/3dnow_xform_masked2.S \ - X86/3dnow_xform_masked3.S X86/3dnow_xform_masked4.S \ + X86/3dnow_xform_raw2.S X86/3dnow_xform_masked2.S \ + X86/3dnow_xform_raw3.S X86/3dnow_xform_masked3.S \ + X86/3dnow_xform_raw4.S X86/3dnow_xform_masked4.S \ X86/3dnow_norm_raw.S X86/3dnow_vertex.S \ FX/X86/fx_3dnow_fastpath.S \ - X86/katmai_xform_raw1.S X86/katmai_xform_masked1.S \ X86/katmai_xform_raw2.S X86/katmai_xform_masked2.S \ X86/katmai_xform_raw3.S X86/katmai_xform_masked3.S \ X86/katmai_xform_raw4.S X86/katmai_xform_masked4.S \ diff --git a/src/mesa/Makefile.X11 b/src/mesa/Makefile.X11 index fe2e4cece9a..beee04ae76e 100644 --- a/src/mesa/Makefile.X11 +++ b/src/mesa/Makefile.X11 @@ -1,4 +1,4 @@ -# $Id: Makefile.X11,v 1.48 2001/03/28 17:19:58 brianp Exp $ +# $Id: Makefile.X11,v 1.49 2001/03/28 20:44:43 gareth Exp $ # Mesa 3-D graphics library # Version: 3.5 @@ -76,7 +76,6 @@ CORE_SOURCES = \ glapi.c \ glthread.c \ hash.c \ - highpc.c \ hint.c \ histogram.c \ image.c \ @@ -84,7 +83,6 @@ CORE_SOURCES = \ light.c \ lines.c \ logic.c \ - lowpc.c \ masking.c \ matrix.c \ mem.c \ @@ -190,7 +188,8 @@ ASM_SOURCES = ADDITIONAL_OBJ = -OBJECTS = $(ASM_SOURCES:.S=.o) \ +OBJECTS = $(GEN_SOURCES) \ + $(ASM_SOURCES:.S=.o) \ $(CORE_SOURCES:.c=.o) \ $(DRIVER_SOURCES:.c=.o) \ $(ADDITIONAL_OBJ) @@ -283,6 +282,10 @@ X86/3dnow.o: X86/3dnow.c $(CC) -c -I. -I$(INCDIR) $(CFLAGS) $< -o $@ X86/katmai.o: X86/katmai.c $(CC) -c -I. -I$(INCDIR) $(CFLAGS) $< -o $@ +X86/matypes.h: mtypes.h tnl/t_context.h X86/gen_matypes.c + $(CC) -I. -I$(INCDIR) $(CFLAGS) X86/gen_matypes.c -o X86/gen_matypes + ./X86/gen_matypes > X86/matypes.h + rm -f X86/gen_matypes GGI/ggimesa.o: GGI/ggimesa.c $(CC) -c -I. -I$(INCDIR) $(CFLAGS) $< -o $@ diff --git a/src/mesa/main/Makefile.X11 b/src/mesa/main/Makefile.X11 index fe2e4cece9a..beee04ae76e 100644 --- a/src/mesa/main/Makefile.X11 +++ b/src/mesa/main/Makefile.X11 @@ -1,4 +1,4 @@ -# $Id: Makefile.X11,v 1.48 2001/03/28 17:19:58 brianp Exp $ +# $Id: Makefile.X11,v 1.49 2001/03/28 20:44:43 gareth Exp $ # Mesa 3-D graphics library # Version: 3.5 @@ -76,7 +76,6 @@ CORE_SOURCES = \ glapi.c \ glthread.c \ hash.c \ - highpc.c \ hint.c \ histogram.c \ image.c \ @@ -84,7 +83,6 @@ CORE_SOURCES = \ light.c \ lines.c \ logic.c \ - lowpc.c \ masking.c \ matrix.c \ mem.c \ @@ -190,7 +188,8 @@ ASM_SOURCES = ADDITIONAL_OBJ = -OBJECTS = $(ASM_SOURCES:.S=.o) \ +OBJECTS = $(GEN_SOURCES) \ + $(ASM_SOURCES:.S=.o) \ $(CORE_SOURCES:.c=.o) \ $(DRIVER_SOURCES:.c=.o) \ $(ADDITIONAL_OBJ) @@ -283,6 +282,10 @@ X86/3dnow.o: X86/3dnow.c $(CC) -c -I. -I$(INCDIR) $(CFLAGS) $< -o $@ X86/katmai.o: X86/katmai.c $(CC) -c -I. -I$(INCDIR) $(CFLAGS) $< -o $@ +X86/matypes.h: mtypes.h tnl/t_context.h X86/gen_matypes.c + $(CC) -I. -I$(INCDIR) $(CFLAGS) X86/gen_matypes.c -o X86/gen_matypes + ./X86/gen_matypes > X86/matypes.h + rm -f X86/gen_matypes GGI/ggimesa.o: GGI/ggimesa.c $(CC) -c -I. -I$(INCDIR) $(CFLAGS) $< -o $@ diff --git a/src/mesa/x86/3dnow.c b/src/mesa/x86/3dnow.c index 9c00baaa907..b6ef3739361 100644 --- a/src/mesa/x86/3dnow.c +++ b/src/mesa/x86/3dnow.c @@ -1,10 +1,10 @@ -/* $Id: 3dnow.c,v 1.16 2001/03/03 20:56:59 brianp Exp $ */ +/* $Id: 3dnow.c,v 1.17 2001/03/28 20:44:43 gareth Exp $ */ /* * Mesa 3-D graphics library * Version: 3.5 * - * Copyright (C) 1999-2000 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2001 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"), @@ -52,24 +52,24 @@ #define DECLARE_XFORM_GROUP( pfx, sz, masked ) \ - extern void _ASMAPI _mesa_##pfx##_transform_points##sz##_general_##masked( XFORM_ARGS ); \ - extern void _ASMAPI _mesa_##pfx##_transform_points##sz##_identity_##masked( XFORM_ARGS ); \ - extern void _ASMAPI _mesa_##pfx##_transform_points##sz##_3d_no_rot_##masked( XFORM_ARGS ); \ - extern void _ASMAPI _mesa_##pfx##_transform_points##sz##_perspective_##masked( XFORM_ARGS ); \ - extern void _ASMAPI _mesa_##pfx##_transform_points##sz##_2d_##masked( XFORM_ARGS ); \ - extern void _ASMAPI _mesa_##pfx##_transform_points##sz##_2d_no_rot_##masked( XFORM_ARGS ); \ - extern void _ASMAPI _mesa_##pfx##_transform_points##sz##_3d_##masked( XFORM_ARGS ); +extern void _ASMAPI _mesa_##pfx##_transform_points##sz##_general_##masked( XFORM_ARGS ); \ +extern void _ASMAPI _mesa_##pfx##_transform_points##sz##_identity_##masked( XFORM_ARGS ); \ +extern void _ASMAPI _mesa_##pfx##_transform_points##sz##_3d_no_rot_##masked( XFORM_ARGS ); \ +extern void _ASMAPI _mesa_##pfx##_transform_points##sz##_perspective_##masked( XFORM_ARGS ); \ +extern void _ASMAPI _mesa_##pfx##_transform_points##sz##_2d_##masked( XFORM_ARGS ); \ +extern void _ASMAPI _mesa_##pfx##_transform_points##sz##_2d_no_rot_##masked( XFORM_ARGS ); \ +extern void _ASMAPI _mesa_##pfx##_transform_points##sz##_3d_##masked( XFORM_ARGS ); #define ASSIGN_XFORM_GROUP( pfx, cma, sz, masked ) \ - _mesa_transform_tab[cma][sz][MATRIX_GENERAL] = \ + _mesa_transform_tab[cma][sz][MATRIX_GENERAL] = \ _mesa_##pfx##_transform_points##sz##_general_##masked; \ - _mesa_transform_tab[cma][sz][MATRIX_IDENTITY] = \ + _mesa_transform_tab[cma][sz][MATRIX_IDENTITY] = \ _mesa_##pfx##_transform_points##sz##_identity_##masked; \ _mesa_transform_tab[cma][sz][MATRIX_3D_NO_ROT] = \ _mesa_##pfx##_transform_points##sz##_3d_no_rot_##masked; \ _mesa_transform_tab[cma][sz][MATRIX_PERSPECTIVE] = \ - _mesa_##pfx##_transform_points##sz##_perspective_##masked; \ + _mesa_##pfx##_transform_points##sz##_perspective_##masked; \ _mesa_transform_tab[cma][sz][MATRIX_2D] = \ _mesa_##pfx##_transform_points##sz##_2d_##masked; \ _mesa_transform_tab[cma][sz][MATRIX_2D_NO_ROT] = \ @@ -88,42 +88,40 @@ #define DECLARE_NORM_GROUP( pfx, masked ) \ - extern void _ASMAPI _mesa_##pfx##_rescale_normals_##masked( NORM_ARGS ); \ - extern void _ASMAPI _mesa_##pfx##_normalize_normals_##masked( NORM_ARGS ); \ - extern void _ASMAPI _mesa_##pfx##_transform_normals_##masked( NORM_ARGS ); \ - extern void _ASMAPI _mesa_##pfx##_transform_normals_no_rot_##masked( NORM_ARGS ); \ - extern void _ASMAPI _mesa_##pfx##_transform_rescale_normals_##masked( NORM_ARGS ); \ - extern void _ASMAPI _mesa_##pfx##_transform_rescale_normals_no_rot_##masked( NORM_ARGS ); \ - extern void _ASMAPI _mesa_##pfx##_transform_normalize_normals_##masked( NORM_ARGS ); \ - extern void _ASMAPI _mesa_##pfx##_transform_normalize_normals_no_rot_##masked( NORM_ARGS ); +extern void _ASMAPI _mesa_##pfx##_rescale_normals_##masked( NORM_ARGS ); \ +extern void _ASMAPI _mesa_##pfx##_normalize_normals_##masked( NORM_ARGS ); \ +extern void _ASMAPI _mesa_##pfx##_transform_normals_##masked( NORM_ARGS ); \ +extern void _ASMAPI _mesa_##pfx##_transform_normals_no_rot_##masked( NORM_ARGS ); \ +extern void _ASMAPI _mesa_##pfx##_transform_rescale_normals_##masked( NORM_ARGS ); \ +extern void _ASMAPI _mesa_##pfx##_transform_rescale_normals_no_rot_##masked( NORM_ARGS ); \ +extern void _ASMAPI _mesa_##pfx##_transform_normalize_normals_##masked( NORM_ARGS ); \ +extern void _ASMAPI _mesa_##pfx##_transform_normalize_normals_no_rot_##masked( NORM_ARGS ); #define ASSIGN_NORM_GROUP( pfx, cma, masked ) \ - _mesa_normal_tab[NORM_RESCALE][cma] = \ + _mesa_normal_tab[NORM_RESCALE][cma] = \ _mesa_##pfx##_rescale_normals_##masked; \ - _mesa_normal_tab[NORM_NORMALIZE][cma] = \ + _mesa_normal_tab[NORM_NORMALIZE][cma] = \ _mesa_##pfx##_normalize_normals_##masked; \ - _mesa_normal_tab[NORM_TRANSFORM][cma] = \ + _mesa_normal_tab[NORM_TRANSFORM][cma] = \ _mesa_##pfx##_transform_normals_##masked; \ - _mesa_normal_tab[NORM_TRANSFORM_NO_ROT][cma] = \ + _mesa_normal_tab[NORM_TRANSFORM_NO_ROT][cma] = \ _mesa_##pfx##_transform_normals_no_rot_##masked; \ - _mesa_normal_tab[NORM_TRANSFORM | NORM_RESCALE][cma] = \ + _mesa_normal_tab[NORM_TRANSFORM | NORM_RESCALE][cma] = \ _mesa_##pfx##_transform_rescale_normals_##masked; \ - _mesa_normal_tab[NORM_TRANSFORM_NO_ROT | NORM_RESCALE][cma] = \ + _mesa_normal_tab[NORM_TRANSFORM_NO_ROT | NORM_RESCALE][cma] = \ _mesa_##pfx##_transform_rescale_normals_no_rot_##masked; \ _mesa_normal_tab[NORM_TRANSFORM | NORM_NORMALIZE][cma] = \ - _mesa_##pfx##_transform_normalize_normals_##masked; \ - _mesa_normal_tab[NORM_TRANSFORM_NO_ROT | NORM_NORMALIZE][cma] = \ + _mesa_##pfx##_transform_normalize_normals_##masked; \ + _mesa_normal_tab[NORM_TRANSFORM_NO_ROT | NORM_NORMALIZE][cma] = \ _mesa_##pfx##_transform_normalize_normals_no_rot_##masked; #ifdef USE_3DNOW_ASM -DECLARE_XFORM_GROUP( 3dnow, 1, raw ) DECLARE_XFORM_GROUP( 3dnow, 2, raw ) DECLARE_XFORM_GROUP( 3dnow, 3, raw ) DECLARE_XFORM_GROUP( 3dnow, 4, raw ) -DECLARE_XFORM_GROUP( 3dnow, 1, masked ) DECLARE_XFORM_GROUP( 3dnow, 2, masked ) DECLARE_XFORM_GROUP( 3dnow, 3, masked ) DECLARE_XFORM_GROUP( 3dnow, 4, masked ) @@ -132,34 +130,35 @@ DECLARE_NORM_GROUP( 3dnow, raw ) /*DECLARE_NORM_GROUP( 3dnow, masked )*/ -extern void _ASMAPI _mesa_v16_3dnow_general_xform( GLfloat *first_vert, - const GLfloat *m, - const GLfloat *src, - GLuint src_stride, - GLuint count ); - -extern void _ASMAPI _mesa_3dnow_project_vertices( GLfloat *first, - GLfloat *last, - const GLfloat *m, - GLuint stride ); - -extern void _ASMAPI _mesa_3dnow_project_clipped_vertices( GLfloat *first, - GLfloat *last, - const GLfloat *m, - GLuint stride, - const GLubyte *clipmask ); +extern void _ASMAPI +_mesa_v16_3dnow_general_xform( GLfloat *first_vert, + const GLfloat *m, + const GLfloat *src, + GLuint src_stride, + GLuint count ); + +extern void _ASMAPI +_mesa_3dnow_project_vertices( GLfloat *first, + GLfloat *last, + const GLfloat *m, + GLuint stride ); + +extern void _ASMAPI +_mesa_3dnow_project_clipped_vertices( GLfloat *first, + GLfloat *last, + const GLfloat *m, + GLuint stride, + const GLubyte *clipmask ); #endif void _mesa_init_3dnow_transform_asm( void ) { #ifdef USE_3DNOW_ASM - ASSIGN_XFORM_GROUP( 3dnow, 0, 1, raw ); ASSIGN_XFORM_GROUP( 3dnow, 0, 2, raw ); ASSIGN_XFORM_GROUP( 3dnow, 0, 3, raw ); ASSIGN_XFORM_GROUP( 3dnow, 0, 4, raw ); -/* ASSIGN_XFORM_GROUP( 3dnow, CULL_MASK_ACTIVE, 1, masked ); */ /* ASSIGN_XFORM_GROUP( 3dnow, CULL_MASK_ACTIVE, 2, masked ); */ /* ASSIGN_XFORM_GROUP( 3dnow, CULL_MASK_ACTIVE, 3, masked ); */ /* ASSIGN_XFORM_GROUP( 3dnow, CULL_MASK_ACTIVE, 4, masked ); */ @@ -177,9 +176,9 @@ void _mesa_init_3dnow_transform_asm( void ) void _mesa_init_3dnow_vertex_asm( void ) { #ifdef USE_3DNOW_ASM - _mesa_xform_points3_v16_general = _mesa_v16_3dnow_general_xform; - _mesa_project_v16 = _mesa_3dnow_project_vertices; - _mesa_project_clipped_v16 = _mesa_3dnow_project_clipped_vertices; + _mesa_xform_points3_v16_general = _mesa_v16_3dnow_general_xform; + _mesa_project_v16 = _mesa_3dnow_project_vertices; + _mesa_project_clipped_v16 = _mesa_3dnow_project_clipped_vertices; #ifdef DEBUG_NOT _math_test_all_vertex_functions( "3DNow!" ); diff --git a/src/mesa/x86/3dnow.h b/src/mesa/x86/3dnow.h index c26005d2241..de7c6d8f6b9 100644 --- a/src/mesa/x86/3dnow.h +++ b/src/mesa/x86/3dnow.h @@ -1,10 +1,10 @@ -/* $Id: 3dnow.h,v 1.4 2001/03/03 20:33:30 brianp Exp $ */ +/* $Id: 3dnow.h,v 1.5 2001/03/28 20:44:43 gareth Exp $ */ /* * Mesa 3-D graphics library * Version: 3.5 * - * Copyright (C) 1999 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2001 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"), diff --git a/src/mesa/x86/clip_args.h b/src/mesa/x86/clip_args.h index 0829ec7fdca..eeb10236b3b 100644 --- a/src/mesa/x86/clip_args.h +++ b/src/mesa/x86/clip_args.h @@ -1,10 +1,10 @@ -/* $Id: clip_args.h,v 1.2 2000/10/23 00:16:28 gareth Exp $ */ +/* $Id: clip_args.h,v 1.3 2001/03/28 20:44:43 gareth Exp $ */ /* * Mesa 3-D graphics library * Version: 3.5 * - * Copyright (C) 1999-2000 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2001 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"), @@ -35,22 +35,6 @@ #ifndef __CLIP_ARGS_H__ #define __CLIP_ARGS_H__ -/* Offsets into GLvector4f - */ -#define V4F_DATA 0 -#define V4F_START 4 -#define V4F_COUNT 8 -#define V4F_STRIDE 12 -#define V4F_SIZE 16 -#define V4F_FLAGS 20 - -/* GLvector4f flags - */ -#define VEC_SIZE_1 1 -#define VEC_SIZE_2 3 -#define VEC_SIZE_3 7 -#define VEC_SIZE_4 15 - /* * Offsets for clip_func arguments * diff --git a/src/mesa/x86/common_x86.c b/src/mesa/x86/common_x86.c index 58710f1fcd5..7d893917185 100644 --- a/src/mesa/x86/common_x86.c +++ b/src/mesa/x86/common_x86.c @@ -1,10 +1,10 @@ -/* $Id: common_x86.c,v 1.13 2001/03/12 02:13:40 gareth Exp $ */ +/* $Id: common_x86.c,v 1.14 2001/03/28 20:44:43 gareth Exp $ */ /* * Mesa 3-D graphics library * Version: 3.5 * - * Copyright (C) 1999-2000 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2001 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"), @@ -24,7 +24,6 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - /* * Check CPU capabilities & initialize optimized funtions for this particular * processor. diff --git a/src/mesa/x86/common_x86_asm.S b/src/mesa/x86/common_x86_asm.S index 15698cf0628..69cc83f6cd2 100644 --- a/src/mesa/x86/common_x86_asm.S +++ b/src/mesa/x86/common_x86_asm.S @@ -1,10 +1,10 @@ -/* $Id: common_x86_asm.S,v 1.5 2001/03/03 21:11:32 brianp Exp $ */ +/* $Id: common_x86_asm.S,v 1.6 2001/03/28 20:44:43 gareth Exp $ */ /* * Mesa 3-D graphics library - * Version: 3.4 + * Version: 3.5 * - * Copyright (C) 1999-2000 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2001 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"), @@ -33,9 +33,8 @@ * * Cleaned up and simplified by Gareth Hughes */ -/* $XFree86: xc/extras/Mesa/src/X86/common_x86_asm.S,v 1.5 2000/12/12 23:52:37 dawes Exp $ */ -#include "assyntax.h" +#include "matypes.h" #include "common_x86_features.h" diff --git a/src/mesa/x86/common_x86_asm.h b/src/mesa/x86/common_x86_asm.h index a0f972bb179..312855dc652 100644 --- a/src/mesa/x86/common_x86_asm.h +++ b/src/mesa/x86/common_x86_asm.h @@ -1,10 +1,10 @@ -/* $Id: common_x86_asm.h,v 1.6 2001/03/03 21:11:32 brianp Exp $ */ +/* $Id: common_x86_asm.h,v 1.7 2001/03/28 20:44:44 gareth Exp $ */ /* * Mesa 3-D graphics library * Version: 3.5 * - * Copyright (C) 1999 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2001 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"), diff --git a/src/mesa/x86/common_x86_features.h b/src/mesa/x86/common_x86_features.h index f8c7b2ab7bd..c70e6e8803b 100644 --- a/src/mesa/x86/common_x86_features.h +++ b/src/mesa/x86/common_x86_features.h @@ -1,10 +1,10 @@ -/* $Id: common_x86_features.h,v 1.3 2001/03/03 21:11:32 brianp Exp $ */ +/* $Id: common_x86_features.h,v 1.4 2001/03/28 20:44:44 gareth Exp $ */ /* * Mesa 3-D graphics library * Version: 3.5 * - * Copyright (C) 1999 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2001 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"), @@ -63,7 +63,7 @@ #define X86_FEATURE_MMX 0x00800000 #define X86_FEATURE_FXSR 0x01000000 #define X86_FEATURE_XMM 0x02000000 -#define X86_FEATURE_26 0x04000000 +#define X86_FEATURE_XMM2 0x04000000 #define X86_FEATURE_27 0x08000000 #define X86_FEATURE_28 0x10000000 #define X86_FEATURE_29 0x20000000 @@ -71,7 +71,10 @@ #define X86_FEATURE_3DNOW 0x80000000 #define cpu_has_mmx (_mesa_x86_cpu_features & X86_FEATURE_MMX) +#define cpu_has_mmxext (_mesa_x86_cpu_features & X86_FEATURE_MMXEXT) #define cpu_has_xmm (_mesa_x86_cpu_features & X86_FEATURE_XMM) +#define cpu_has_xmm2 (_mesa_x86_cpu_features & X86_FEATURE_XMM2) #define cpu_has_3dnow (_mesa_x86_cpu_features & X86_FEATURE_3DNOW) +#define cpu_has_3dnowext (_mesa_x86_cpu_features & X86_FEATURE_3DNOWEXT) #endif diff --git a/src/mesa/x86/gen_matypes.c b/src/mesa/x86/gen_matypes.c new file mode 100644 index 00000000000..990034fdf61 --- /dev/null +++ b/src/mesa/x86/gen_matypes.c @@ -0,0 +1,286 @@ +/* $Id: gen_matypes.c,v 1.1 2001/03/28 20:44:44 gareth Exp $ */ + +/* + * Mesa 3-D graphics library + * Version: 3.5 + * + * Copyright (C) 1999-2001 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. + * + * Authors: + * Gareth Hughes + */ + +/* + * This generates an asm version of mtypes.h (called matypes.h), so that + * Mesa's x86 assembly code can access the internal structures easily. + * This will be particularly useful when developing new x86 asm code for + * Mesa, including lighting, clipping, texture image conversion etc. + */ + +#ifdef PC_HEADER +#include "all.h" +#else +#include "glheader.h" +#include "context.h" +#include "mtypes.h" +#include "tnl/t_context.h" +#endif + +#undef offsetof +#define offsetof( type, member ) ((size_t) &((type *)0)->member) + + +#define OFFSET_HEADER( x ) \ +do { \ + printf( "\n" ); \ + printf( "\n" ); \ + printf( "/* =====================================================" \ + "========\n" ); \ + printf( " * Offsets for %s\n", x ); \ + printf( " */\n" ); \ + printf( "\n" ); \ +} while (0) + +#define DEFINE_HEADER( x ) \ +do { \ + printf( "\n" ); \ + printf( "/*\n" ); \ + printf( " * Flags for %s\n", x ); \ + printf( " */\n" ); \ + printf( "\n" ); \ +} while (0) + +#define OFFSET( s, t, m ) \ + printf( "#define %s\t%d\n", s, offsetof( t, m ) ); + +#define SIZEOF( s, t ) \ + printf( "#define %s\t%d\n", s, sizeof(t) ); + +#define DEFINE( s, d ) \ + printf( "#define %s\t0x%x\n", s, d ); + + + +int main( int argc, char **argv ) +{ + printf( "/*\n" ); + printf( " * This file is automatically generated from the Mesa internal type\n" ); + printf( " * definitions. Do not edit directly.\n" ); + printf( " */\n" ); + printf( "\n" ); + printf( "#ifndef __ASM_TYPES_H__\n" ); + printf( "#define __ASM_TYPES_H__\n" ); + printf( "\n" ); + printf( "#include \"assyntax.h\"\n" ); + + + /* GLcontext offsets: + */ + OFFSET_HEADER( "GLcontext" ); + + OFFSET( "CTX_DRIVER_CTX ", GLcontext, DriverCtx ); + printf( "\n" ); + OFFSET( "CTX_LIGHT_ENABLED ", GLcontext, Light.Enabled ); + OFFSET( "CTX_LIGHT_SHADE_MODEL ", GLcontext, Light.ShadeModel ); + OFFSET( "CTX_LIGHT_COLOR_MAT_FACE ", GLcontext, Light.ColorMaterialFace ); + OFFSET( "CTX_LIGHT_COLOR_MAT_MODE ", GLcontext, Light.ColorMaterialMode ); + OFFSET( "CTX_LIGHT_COLOR_MAT_MASK ", GLcontext, Light.ColorMaterialBitmask ); + OFFSET( "CTX_LIGHT_COLOR_MAT_ENABLED ", GLcontext, Light.ColorMaterialEnabled ); + OFFSET( "CTX_LIGHT_ENABLED_LIST ", GLcontext, Light.EnabledList ); + OFFSET( "CTX_LIGHT_NEED_VERTS ", GLcontext, Light._NeedVertices ); + OFFSET( "CTX_LIGHT_FLAGS ", GLcontext, Light._Flags ); + OFFSET( "CTX_LIGHT_BASE_COLOR ", GLcontext, Light._BaseColor ); + OFFSET( "CTX_LIGHT_BASE_ALPHA ", GLcontext, Light._BaseAlpha ); + + + /* struct vertex_buffer offsets: + */ + OFFSET_HEADER( "struct vertex_buffer" ); + + OFFSET( "VB_SIZE ", struct vertex_buffer, Size ); + OFFSET( "VB_COUNT ", struct vertex_buffer, Count ); + printf( "\n" ); + OFFSET( "VB_FIRST_CLIPPED ", struct vertex_buffer, FirstClipped ); + OFFSET( "VB_FIRST_PRIMITIVE ", struct vertex_buffer, FirstPrimitive ); + printf( "\n" ); + OFFSET( "VB_ELTS ", struct vertex_buffer, Elts ); + OFFSET( "VB_OBJ_PTR ", struct vertex_buffer, ObjPtr ); + OFFSET( "VB_EYE_PTR ", struct vertex_buffer, EyePtr ); + OFFSET( "VB_CLIP_PTR ", struct vertex_buffer, ClipPtr ); + OFFSET( "VB_PROJ_CLIP_PTR ", struct vertex_buffer, ProjectedClipPtr ); + OFFSET( "VB_CLIP_OR_MASK ", struct vertex_buffer, ClipOrMask ); + OFFSET( "VB_CLIP_MASK ", struct vertex_buffer, ClipMask ); + OFFSET( "VB_NORMAL_PTR ", struct vertex_buffer, NormalPtr ); + OFFSET( "VB_EDGE_FLAG ", struct vertex_buffer, EdgeFlag ); + OFFSET( "VB_TEX0_COORD_PTR ", struct vertex_buffer, TexCoordPtr[0] ); + OFFSET( "VB_TEX1_COORD_PTR ", struct vertex_buffer, TexCoordPtr[1] ); + OFFSET( "VB_TEX2_COORD_PTR ", struct vertex_buffer, TexCoordPtr[2] ); + OFFSET( "VB_TEX3_COORD_PTR ", struct vertex_buffer, TexCoordPtr[3] ); + OFFSET( "VB_INDEX_PTR ", struct vertex_buffer, IndexPtr ); + OFFSET( "VB_COLOR_PTR ", struct vertex_buffer, ColorPtr ); + OFFSET( "VB_SECONDARY_COLOR_PTR ", struct vertex_buffer, SecondaryColorPtr ); + OFFSET( "VB_FOG_COORD_PTR ", struct vertex_buffer, FogCoordPtr ); + OFFSET( "VB_POINT_SIZE_PTR ", struct vertex_buffer, PointSizePtr ); + OFFSET( "VB_MATERIAL ", struct vertex_buffer, Material ); + OFFSET( "VB_MATERIAL_MASK ", struct vertex_buffer, MaterialMask ); + OFFSET( "VB_FLAG ", struct vertex_buffer, Flag ); + OFFSET( "VB_PRIMITIVE ", struct vertex_buffer, Primitive ); + OFFSET( "VB_PRIMITIVE_LENGTH ", struct vertex_buffer, PrimitiveLength ); + printf( "\n" ); + OFFSET( "VB_IMPORTABLE_DATA ", struct vertex_buffer, importable_data ); + printf( "\n" ); + OFFSET( "VB_LAST_CLIPPED ", struct vertex_buffer, LastClipped ); + + DEFINE_HEADER( "struct vertex_buffer" ); + + DEFINE( "VERT_OBJ ", VERT_OBJ ); + DEFINE( "VERT_RGBA ", VERT_RGBA ); + DEFINE( "VERT_NORM ", VERT_NORM ); + DEFINE( "VERT_INDEX ", VERT_INDEX ); + DEFINE( "VERT_EDGE ", VERT_EDGE ); + DEFINE( "VERT_SPEC_RGB ", VERT_SPEC_RGB ); + DEFINE( "VERT_FOG_COORD ", VERT_FOG_COORD ); + DEFINE( "VERT_TEX0 ", VERT_TEX0 ); + DEFINE( "VERT_TEX1 ", VERT_TEX1 ); + DEFINE( "VERT_TEX2 ", VERT_TEX2 ); + DEFINE( "VERT_TEX3 ", VERT_TEX3 ); + DEFINE( "VERT_EVAL_C1 ", VERT_EVAL_C1 ); + DEFINE( "VERT_EVAL_C2 ", VERT_EVAL_C2 ); + DEFINE( "VERT_EVAL_P1 ", VERT_EVAL_P1 ); + DEFINE( "VERT_EVAL_P2 ", VERT_EVAL_P2 ); + DEFINE( "VERT_OBJ_3 ", VERT_OBJ_3 ); + DEFINE( "VERT_OBJ_4 ", VERT_OBJ_4 ); + DEFINE( "VERT_MATERIAL ", VERT_MATERIAL ); + DEFINE( "VERT_ELT ", VERT_ELT ); + DEFINE( "VERT_BEGIN ", VERT_BEGIN ); + DEFINE( "VERT_END ", VERT_END ); + DEFINE( "VERT_END_VB ", VERT_END_VB ); + DEFINE( "VERT_POINT_SIZE ", VERT_POINT_SIZE ); + DEFINE( "VERT_EYE ", VERT_EYE ); + DEFINE( "VERT_CLIP ", VERT_CLIP ); + printf( "\n" ); + DEFINE( "VERT_OBJ_23 ", VERT_OBJ_3 ); + DEFINE( "VERT_OBJ_234 ", VERT_OBJ_4 ); + + + /* GLvector3f offsets: + */ + OFFSET_HEADER( "GLvector3f" ); + + OFFSET( "V3F_DATA ", GLvector3f, data ); + OFFSET( "V3F_START ", GLvector3f, start ); + OFFSET( "V3F_COUNT ", GLvector3f, count ); + OFFSET( "V3F_STRIDE ", GLvector3f, stride ); + OFFSET( "V3F_FLAGS ", GLvector3f, flags ); + + + /* GLvector4f offsets: + */ + OFFSET_HEADER( "GLvector4f" ); + + OFFSET( "V4F_DATA ", GLvector4f, data ); + OFFSET( "V4F_START ", GLvector4f, start ); + OFFSET( "V4F_COUNT ", GLvector4f, count ); + OFFSET( "V4F_STRIDE ", GLvector4f, stride ); + OFFSET( "V4F_SIZE ", GLvector4f, size ); + OFFSET( "V4F_FLAGS ", GLvector4f, flags ); + + DEFINE_HEADER( "GLvector4f" ); + + DEFINE( "VEC_MALLOC ", VEC_MALLOC ); + DEFINE( "VEC_NOT_WRITEABLE ", VEC_NOT_WRITEABLE ); + DEFINE( "VEC_BAD_STRIDE ", VEC_BAD_STRIDE ); + printf( "\n" ); + DEFINE( "VEC_SIZE_1 ", VEC_SIZE_1 ); + DEFINE( "VEC_SIZE_2 ", VEC_SIZE_2 ); + DEFINE( "VEC_SIZE_3 ", VEC_SIZE_3 ); + DEFINE( "VEC_SIZE_4 ", VEC_SIZE_4 ); + + + /* GLmatrix offsets: + */ + OFFSET_HEADER( "GLmatrix" ); + + OFFSET( "MATRIX_DATA ", GLmatrix, m ); + OFFSET( "MATRIX_INV ", GLmatrix, inv ); + OFFSET( "MATRIX_FLAGS ", GLmatrix, flags ); + OFFSET( "MATRIX_TYPE ", GLmatrix, type ); + + + /* struct gl_light offsets: + */ + OFFSET_HEADER( "struct gl_light" ); + + OFFSET( "LIGHT_NEXT ", struct gl_light, next ); + OFFSET( "LIGHT_PREV ", struct gl_light, prev ); + printf( "\n" ); + OFFSET( "LIGHT_AMBIENT ", struct gl_light, Ambient ); + OFFSET( "LIGHT_DIFFUSE ", struct gl_light, Diffuse ); + OFFSET( "LIGHT_SPECULAR ", struct gl_light, Specular ); + OFFSET( "LIGHT_EYE_POSITION ", struct gl_light, EyePosition ); + OFFSET( "LIGHT_EYE_DIRECTION ", struct gl_light, EyeDirection ); + OFFSET( "LIGHT_SPOT_EXPONENT ", struct gl_light, SpotExponent ); + OFFSET( "LIGHT_SPOT_CUTOFF ", struct gl_light, SpotCutoff ); + OFFSET( "LIGHT_COS_CUTOFF ", struct gl_light, _CosCutoff ); + OFFSET( "LIGHT_CONST_ATTEN ", struct gl_light, ConstantAttenuation ); + OFFSET( "LIGHT_LINEAR_ATTEN ", struct gl_light, LinearAttenuation ); + OFFSET( "LIGHT_QUADRATIC_ATTEN ", struct gl_light, QuadraticAttenuation ); + OFFSET( "LIGHT_ENABLED ", struct gl_light, Enabled ); + printf( "\n" ); + OFFSET( "LIGHT_FLAGS ", struct gl_light, _Flags ); + printf( "\n" ); + OFFSET( "LIGHT_POSITION ", struct gl_light, _Position ); + OFFSET( "LIGHT_VP_INF_NORM ", struct gl_light, _VP_inf_norm ); + OFFSET( "LIGHT_H_INF_NORM ", struct gl_light, _h_inf_norm ); + OFFSET( "LIGHT_NORM_DIRECTION ", struct gl_light, _NormDirection ); + OFFSET( "LIGHT_VP_INF_SPOT_ATTEN ", struct gl_light, _VP_inf_spot_attenuation ); + printf( "\n" ); + OFFSET( "LIGHT_SPOT_EXP_TABLE ", struct gl_light, _SpotExpTable ); + OFFSET( "LIGHT_MAT_AMBIENT ", struct gl_light, _MatAmbient ); + OFFSET( "LIGHT_MAT_DIFFUSE ", struct gl_light, _MatDiffuse ); + OFFSET( "LIGHT_MAT_SPECULAR ", struct gl_light, _MatSpecular ); + printf( "\n" ); + SIZEOF( "SIZEOF_GL_LIGHT ", struct gl_light ); + + DEFINE_HEADER( "struct gl_light" ); + + DEFINE( "LIGHT_SPOT ", LIGHT_SPOT ); + DEFINE( "LIGHT_LOCAL_VIEWER ", LIGHT_LOCAL_VIEWER ); + DEFINE( "LIGHT_POSITIONAL ", LIGHT_POSITIONAL ); + printf( "\n" ); + DEFINE( "LIGHT_NEED_VERTICES ", LIGHT_NEED_VERTICES ); + + + /* struct gl_lightmodel offsets: + */ + OFFSET_HEADER( "struct gl_lightmodel" ); + + OFFSET( "LIGHT_MODEL_AMBIENT ", struct gl_lightmodel, Ambient ); + OFFSET( "LIGHT_MODEL_LOCAL_VIEWER ", struct gl_lightmodel, LocalViewer ); + OFFSET( "LIGHT_MODEL_TWO_SIDE ", struct gl_lightmodel, TwoSide ); + OFFSET( "LIGHT_MODEL_COLOR_CONTROL ", struct gl_lightmodel, ColorControl ); + + + printf( "\n" ); + printf( "\n" ); + printf( "#endif /* __ASM_TYPES_H__ */\n" ); + + return 0; +} diff --git a/src/mesa/x86/mmx.h b/src/mesa/x86/mmx.h index 4cac6b8d4e5..4e35bf415c1 100644 --- a/src/mesa/x86/mmx.h +++ b/src/mesa/x86/mmx.h @@ -1,4 +1,4 @@ -/* $Id: mmx.h,v 1.5 2001/03/03 21:11:32 brianp Exp $ */ +/* $Id: mmx.h,v 1.6 2001/03/28 20:44:44 gareth Exp $ */ /* * Mesa 3-D graphics library @@ -28,10 +28,8 @@ #ifndef ASM_MMX_H #define ASM_MMX_H - extern void _ASMAPI _mesa_mmx_blend_transparency( GLcontext *ctx, GLuint n, const GLubyte mask[], GLubyte rgba[][4], const GLubyte dest[][4] ); - #endif diff --git a/src/mesa/x86/mmx_blend.S b/src/mesa/x86/mmx_blend.S index 2c8e6e08aff..154b8ef2ce0 100644 --- a/src/mesa/x86/mmx_blend.S +++ b/src/mesa/x86/mmx_blend.S @@ -1,4 +1,4 @@ -#include "assyntax.h" +#include "matypes.h" SEG_TEXT diff --git a/src/mesa/x86/norm_args.h b/src/mesa/x86/norm_args.h new file mode 100644 index 00000000000..b3d592221f6 --- /dev/null +++ b/src/mesa/x86/norm_args.h @@ -0,0 +1,61 @@ +/* $Id: norm_args.h,v 1.1 2001/03/28 20:44:44 gareth Exp $ */ + +/* + * Mesa 3-D graphics library + * Version: 3.5 + * + * Copyright (C) 1999-2001 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. + */ + +/* + * Normal transform function interface for assembly code. Simply define + * FRAME_OFFSET to the number of bytes pushed onto the stack before + * using the ARG_* argument macros. + * + * Gareth Hughes + */ + +#ifndef __NORM_ARGS_H__ +#define __NORM_ARGS_H__ + +/* Offsets for normal_func arguments + * + * typedef void (*normal_func)( CONST GLmatrix *mat, + * GLfloat scale, + * CONST GLvector3f *in, + * CONST GLfloat lengths[], + * CONST GLubyte mask[], + * GLvector3f *dest ); + */ +#define OFFSET_MAT 4 +#define OFFSET_SCALE 8 +#define OFFSET_IN 12 +#define OFFSET_LENGTHS 16 +#define OFFSET_MASK 20 +#define OFFSET_DEST 24 + +#define ARG_MAT REGOFF(FRAME_OFFSET+OFFSET_MAT, ESP) +#define ARG_SCALE REGOFF(FRAME_OFFSET+OFFSET_SCALE, ESP) +#define ARG_IN REGOFF(FRAME_OFFSET+OFFSET_IN, ESP) +#define ARG_LENGTHS REGOFF(FRAME_OFFSET+OFFSET_LENGTHS, ESP) +#define ARG_MASK REGOFF(FRAME_OFFSET+OFFSET_MASK, ESP) +#define ARG_DEST REGOFF(FRAME_OFFSET+OFFSET_DEST, ESP) + +#endif diff --git a/src/mesa/x86/x86.c b/src/mesa/x86/x86.c index 80d58946ccc..4f35a2ffc50 100644 --- a/src/mesa/x86/x86.c +++ b/src/mesa/x86/x86.c @@ -1,10 +1,10 @@ -/* $Id: x86.c,v 1.18 2001/03/03 20:56:59 brianp Exp $ */ +/* $Id: x86.c,v 1.19 2001/03/28 20:44:44 gareth Exp $ */ /* * Mesa 3-D graphics library * Version: 3.5 * - * Copyright (C) 1999 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2001 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"), @@ -51,24 +51,24 @@ #define DECLARE_XFORM_GROUP( pfx, sz, masked ) \ - extern void _ASMAPI _mesa_##pfx##_transform_points##sz##_general_##masked( XFORM_ARGS ); \ - extern void _ASMAPI _mesa_##pfx##_transform_points##sz##_identity_##masked( XFORM_ARGS ); \ - extern void _ASMAPI _mesa_##pfx##_transform_points##sz##_3d_no_rot_##masked( XFORM_ARGS ); \ - extern void _ASMAPI _mesa_##pfx##_transform_points##sz##_perspective_##masked( XFORM_ARGS ); \ - extern void _ASMAPI _mesa_##pfx##_transform_points##sz##_2d_##masked( XFORM_ARGS ); \ - extern void _ASMAPI _mesa_##pfx##_transform_points##sz##_2d_no_rot_##masked( XFORM_ARGS ); \ - extern void _ASMAPI _mesa_##pfx##_transform_points##sz##_3d_##masked( XFORM_ARGS ); +extern void _ASMAPI _mesa_##pfx##_transform_points##sz##_general_##masked( XFORM_ARGS ); \ +extern void _ASMAPI _mesa_##pfx##_transform_points##sz##_identity_##masked( XFORM_ARGS ); \ +extern void _ASMAPI _mesa_##pfx##_transform_points##sz##_3d_no_rot_##masked( XFORM_ARGS ); \ +extern void _ASMAPI _mesa_##pfx##_transform_points##sz##_perspective_##masked( XFORM_ARGS ); \ +extern void _ASMAPI _mesa_##pfx##_transform_points##sz##_2d_##masked( XFORM_ARGS ); \ +extern void _ASMAPI _mesa_##pfx##_transform_points##sz##_2d_no_rot_##masked( XFORM_ARGS ); \ +extern void _ASMAPI _mesa_##pfx##_transform_points##sz##_3d_##masked( XFORM_ARGS ); #define ASSIGN_XFORM_GROUP( pfx, cma, sz, masked ) \ - _mesa_transform_tab[cma][sz][MATRIX_GENERAL] = \ + _mesa_transform_tab[cma][sz][MATRIX_GENERAL] = \ _mesa_##pfx##_transform_points##sz##_general_##masked; \ - _mesa_transform_tab[cma][sz][MATRIX_IDENTITY] = \ + _mesa_transform_tab[cma][sz][MATRIX_IDENTITY] = \ _mesa_##pfx##_transform_points##sz##_identity_##masked; \ _mesa_transform_tab[cma][sz][MATRIX_3D_NO_ROT] = \ _mesa_##pfx##_transform_points##sz##_3d_no_rot_##masked; \ _mesa_transform_tab[cma][sz][MATRIX_PERSPECTIVE] = \ - _mesa_##pfx##_transform_points##sz##_perspective_##masked; \ + _mesa_##pfx##_transform_points##sz##_perspective_##masked; \ _mesa_transform_tab[cma][sz][MATRIX_2D] = \ _mesa_##pfx##_transform_points##sz##_2d_##masked; \ _mesa_transform_tab[cma][sz][MATRIX_2D_NO_ROT] = \ @@ -86,32 +86,33 @@ DECLARE_XFORM_GROUP( x86, 3, masked ) DECLARE_XFORM_GROUP( x86, 4, masked ) -extern GLvector4f * _ASMAPI _mesa_x86_cliptest_points4( GLvector4f *clip_vec, - GLvector4f *proj_vec, - GLubyte clipMask[], - GLubyte *orMask, - GLubyte *andMask ); - - -extern GLvector4f * _ASMAPI _mesa_x86_cliptest_points4_np( GLvector4f *clip_vec, - GLvector4f *proj_vec, - GLubyte clipMask[], - GLubyte *orMask, - GLubyte *andMask ); - - -extern void _ASMAPI _mesa_v16_x86_cliptest_points4( GLfloat *first_vert, - GLfloat *last_vert, - GLubyte *or_mask, - GLubyte *and_mask, - GLubyte *clip_mask ); - - -extern void _ASMAPI _mesa_v16_x86_general_xform( GLfloat *dest, - const GLfloat *m, - const GLfloat *src, - GLuint src_stride, - GLuint count ); +extern GLvector4f * _ASMAPI +_mesa_x86_cliptest_points4( GLvector4f *clip_vec, + GLvector4f *proj_vec, + GLubyte clipMask[], + GLubyte *orMask, + GLubyte *andMask ); + +extern GLvector4f * _ASMAPI +_mesa_x86_cliptest_points4_np( GLvector4f *clip_vec, + GLvector4f *proj_vec, + GLubyte clipMask[], + GLubyte *orMask, + GLubyte *andMask ); + +extern void _ASMAPI +_mesa_v16_x86_cliptest_points4( GLfloat *first_vert, + GLfloat *last_vert, + GLubyte *or_mask, + GLubyte *and_mask, + GLubyte *clip_mask ); + +extern void _ASMAPI +_mesa_v16_x86_general_xform( GLfloat *dest, + const GLfloat *m, + const GLfloat *src, + GLuint src_stride, + GLuint count ); #endif @@ -139,8 +140,8 @@ void _mesa_init_x86_transform_asm( void ) void _mesa_init_x86_vertex_asm( void ) { #ifdef USE_X86_ASM - _mesa_xform_points3_v16_general = _mesa_v16_x86_general_xform; - _mesa_cliptest_points4_v16 = _mesa_v16_x86_cliptest_points4; + _mesa_xform_points3_v16_general = _mesa_v16_x86_general_xform; + _mesa_cliptest_points4_v16 = _mesa_v16_x86_cliptest_points4; #ifdef DEBUG _math_test_all_vertex_functions( "x86" ); diff --git a/src/mesa/x86/x86.h b/src/mesa/x86/x86.h index 44908a851ad..b614780bfc1 100644 --- a/src/mesa/x86/x86.h +++ b/src/mesa/x86/x86.h @@ -1,10 +1,10 @@ -/* $Id: x86.h,v 1.3 2001/03/03 20:33:30 brianp Exp $ */ +/* $Id: x86.h,v 1.4 2001/03/28 20:44:44 gareth Exp $ */ /* * Mesa 3-D graphics library * Version: 3.5 * - * Copyright (C) 1999 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2001 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"), diff --git a/src/mesa/x86/x86_cliptest.S b/src/mesa/x86/x86_cliptest.S index f406f9d3ca1..f228274dedf 100644 --- a/src/mesa/x86/x86_cliptest.S +++ b/src/mesa/x86/x86_cliptest.S @@ -1,10 +1,10 @@ -/* $Id: x86_cliptest.S,v 1.5 2001/03/03 21:11:32 brianp Exp $ */ +/* $Id: x86_cliptest.S,v 1.6 2001/03/28 20:44:44 gareth Exp $ */ /* * Mesa 3-D graphics library * Version: 3.5 * - * Copyright (C) 1999-2000 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2001 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"), @@ -24,7 +24,7 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#include "assyntax.h" +#include "matypes.h" #include "clip_args.h" #define FP_ONE 1065353216 @@ -379,30 +379,3 @@ LLBL( ctp4_np_finish ): POP_L( ESI ) RET - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/mesa/x86/xform_args.h b/src/mesa/x86/xform_args.h index b69f0b1b9c6..de3ce6855f7 100644 --- a/src/mesa/x86/xform_args.h +++ b/src/mesa/x86/xform_args.h @@ -1,10 +1,10 @@ -/* $Id: xform_args.h,v 1.2 2000/10/23 00:16:29 gareth Exp $ */ +/* $Id: xform_args.h,v 1.3 2001/03/28 20:44:44 gareth Exp $ */ /* * Mesa 3-D graphics library * Version: 3.5 * - * Copyright (C) 1999-2000 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2001 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"), @@ -35,22 +35,6 @@ #ifndef __XFORM_ARGS_H__ #define __XFORM_ARGS_H__ -/* Offsets into GLvector4f - */ -#define V4F_DATA 0 -#define V4F_START 4 -#define V4F_COUNT 8 -#define V4F_STRIDE 12 -#define V4F_SIZE 16 -#define V4F_FLAGS 20 - -/* GLvector4f flags - */ -#define VEC_SIZE_1 1 -#define VEC_SIZE_2 3 -#define VEC_SIZE_3 7 -#define VEC_SIZE_4 15 - /* Offsets for transform_func arguments * * typedef void (*transform_func)( GLvector4f *to_vec, -- 2.30.2