Compare commits

...

73 Commits

Author SHA1 Message Date
Keith Whitwell
020225496e Bump driver date. 2005-05-26 11:42:19 +00:00
Dave Airlie
69509641a8 make egl build first so we don't get wierd drivers linking to libs not available
yet
2005-05-26 04:24:09 +00:00
Dave Airlie
978d2fda3c make linux-solo and linux-solo-x86 config files hierarchical 2005-05-26 03:47:34 +00:00
Ben Skeggs
ae516306b4 constant tracking 2005-05-26 02:33:57 +00:00
Dave Airlie
e45b5a4fa8 use shared-core rather than shared 2005-05-26 01:40:34 +00:00
Dave Airlie
8e5099d6a0 use shared-core instead of shared 2005-05-26 01:40:00 +00:00
Ian Romanick
d2ee346a93 Fix a couple typeos in enum names. 2005-05-25 21:00:16 +00:00
Michal Krol
170999a103 change local var names from "asm" to "assem" - I guess it caused
gcc 3.3.5 to break, but not tested it
2005-05-25 15:09:32 +00:00
Michal Krol
d1834e8c10 a small utility to convert .syn files to its binary forms;
does not require any command line params;
2005-05-25 14:58:22 +00:00
Michal Krol
0432411837 silencium gcc warnings 2005-05-25 14:27:59 +00:00
Michal Krol
0f71c6691e add shader/slang/slang_assemble_assignment.c 2005-05-25 14:24:34 +00:00
Michal Krol
fc534034cc more slang code 2005-05-25 14:23:00 +00:00
Michal Krol
1de60fe47f ncrease stack size 2005-05-25 14:19:24 +00:00
Michal Krol
c16264b138 update grammar_mesa.c path 2005-05-25 14:00:22 +00:00
Michal Krol
1aadf1c039 moved from mesa/shader to mesa/shader/grammar 2005-05-25 13:58:36 +00:00
Michal Krol
1008f57f6f remove the GLSL spec wording;
reorder some elementary operators;
disable assignment "=" and equality "==" "!=" operators - they are
handled internally by the assembly generator;
fix minor typos
2005-05-25 13:43:32 +00:00
Michal Krol
2b73e5aaaf add mesa/shader/grammar to include list 2005-05-25 13:37:56 +00:00
Michal Krol
863eca9973 stand-alone vertsions of grammar_mesa - used by utilities;
DO NOT BUILD UNDER MESA
2005-05-25 13:35:39 +00:00
Keith Whitwell
39e14d2cff Provide initial values for some variables. 2005-05-25 13:35:21 +00:00
Keith Whitwell
741b980433 add special case for flat shaded + separate specular triangles 2005-05-25 13:34:52 +00:00
Michal Krol
3f6d985753 change the behaviour of enter and local_addr instructions 2005-05-25 13:20:59 +00:00
Keith Whitwell
49109d01c0 Disable polygon stipple - it seems to break if certain specific stipple
patterns are used, including the one generated by conform.
2005-05-25 10:17:19 +00:00
Keith Whitwell
8286abd798 Fix various issues with cliprects and MakeCurrent 2005-05-25 10:14:39 +00:00
Ben Skeggs
53d13e014f - Remove one of the loops in emit_arith
- Handle REPL_ALPHA in emit_arith (possibly incorrect for some things)
- Start on getting demos/arbfplight.c to look right.  Won't be animated yet,
  need to re-work const emit so we can update consts without re-translating
  the entire program.

Assertion in r300_state.c::setup_rs_unit needs to be disabled for it to
work.
2005-05-25 06:46:10 +00:00
Ian Romanick
f387c83ec1 Commit the changes propagated from Jeremy Kolb's changes to the Python
scripts in src/mesa/glapi.
2005-05-25 03:30:06 +00:00
Ian Romanick
e87ab8c05f Only use x86 / SSE assembly when USE_X86_ASM / USE_SSE_ASM are defined.
This makes the driver build on x86-64 again.
2005-05-24 23:03:15 +00:00
Karl Schultz
6b5afb0036 Cleanup some Windows junk. 2005-05-24 22:16:27 +00:00
Karl Schultz
89bf62cd49 project file for glut library 2005-05-24 22:06:59 +00:00
Karl Schultz
5dc31379c4 fix location of gears project 2005-05-24 22:04:03 +00:00
Karl Schultz
c97a3a3038 project file to build gears 2005-05-24 21:57:45 +00:00
Karl Schultz
7df5eddf6a Visual Studio 6 project file to build GLUT and some demos. 2005-05-24 21:51:58 +00:00
Karl Schultz
f7c0c4f485 moved to windows build dir 2005-05-24 21:17:42 +00:00
Karl Schultz
b4c8b34534 moved to windows build dir 2005-05-24 21:15:52 +00:00
Karl Schultz
45ab8cb08a Major code cleanup and begin using new render buffer interface. 2005-05-24 21:12:43 +00:00
Karl Schultz
b31b1f44f1 Change prototype for TextureMemCpy to return void* (was void). 2005-05-24 21:06:41 +00:00
Karl Schultz
7708b75d72 Visual Studio 6 project file for OSmesa library. 2005-05-24 21:02:51 +00:00
Karl Schultz
c73968af95 Visual Studio 6 project file for core Mesa. 2005-05-24 21:01:55 +00:00
Karl Schultz
9a726cdf8f Needed to build .cc files in Visual Studio 6. 2005-05-24 21:01:05 +00:00
Karl Schultz
7179810375 Visual Studio 6 project file for GLU library. 2005-05-24 21:00:03 +00:00
Karl Schultz
a1b07e187e Visual Studio 6 project file for Windows GDI driver. 2005-05-24 20:59:07 +00:00
Karl Schultz
39c0e51329 Visual Studio 6 workspace for Mesa libraries. 2005-05-24 20:57:15 +00:00
Karl Schultz
2f9722863d Removing in favor of new Windows build directory. 2005-05-24 20:50:56 +00:00
Daniel Borca
731f1b12a0 remove stupid flags 2005-05-23 22:02:53 +00:00
Keith Whitwell
2d5f12ae6b Initialize hw stencil renderbuffer. 2005-05-23 21:10:01 +00:00
Keith Whitwell
afa7f6a0f5 Disable recent sse change pending more testing. 2005-05-23 14:31:44 +00:00
Ben Skeggs
eeada48497 Implement enough of ARB_fragment_program for Keith's texenv program
generation in Mesa.  Requires most recent Mesa cvs to work correctly.

Swizzle code is possibly slow/buggy and will probably be replaced.

Old behaviour can be controlled by a #define in r300_context.h, if
no-one minds I'll remove the old code later on.

Also, disabled cube map extension.  AFAIK We don't support it yet,
and it causes issues with UT2004.
2005-05-23 14:14:19 +00:00
Keith Whitwell
0c4731b27c Use SSE for vertex emit -- another good speedup. 2005-05-23 12:25:43 +00:00
Keith Whitwell
17bcf9f816 Import Thomas Helstrom's SSE memcpy code from the via X.org driver.
Add a TextureMemCpy callback, called from texstore.c when copying
texture data via the memcpy_texture() path.
Enable this code in the via driver - 100% speedup in texdown.c results.
2005-05-23 12:17:27 +00:00
Keith Whitwell
eb9d6f44a9 silence gcc warnings 2005-05-23 12:15:19 +00:00
Keith Whitwell
241b6b7ab1 Detect use of disabled textures as tex_env_crossbar sources. 2005-05-23 09:50:34 +00:00
Keith Whitwell
2dea6df80b Support ARB_texture_env_crossbar. Changes the way programs are
generated somewhat, with all TEX instructions now emitted at the head
of the program.
2005-05-23 09:37:32 +00:00
Keith Whitwell
6fe176a648 Restore the negate() function.
Add Ben Skegg's ATI_texture_env_combine3 support.
2005-05-23 08:08:43 +00:00
Jerome Glisse
eb8be5d923 Small change to handle native case (7 natives case) 2005-05-22 12:24:52 +00:00
Jerome Glisse
446980473d Adding r300 fragment program swizzle tab. Please some
one reread macro at begining see if i made any error.
A full reread would also be usefull there may be some
errors for some swizzle despite the great care i took
to done them :)
2005-05-22 12:06:50 +00:00
Ian Romanick
b70a47736a Add support for modes with a depth-buffer but no stencil-buffer. This
eliminates various "3D driver claims to not support visual" messages in
16-bit color mode.
2005-05-20 18:40:11 +00:00
Keith Whitwell
3cc2f82bb5 Remove debug printfs 2005-05-20 15:12:12 +00:00
Keith Whitwell
923515b3f8 Re-enable X11 optimized triangle funcs. 2005-05-20 15:06:41 +00:00
Brian Paul
e3e8067db7 use MAX_SCREENS instead of hard-coded number 2005-05-20 14:11:11 +00:00
Brian Paul
8f384f0b67 fix reversed strstr() args, print mode string 2005-05-20 14:03:35 +00:00
Brian Paul
e58d32947e replace // with /* */ 2005-05-20 14:02:02 +00:00
Jouk Jansen
063efce6ee Committing in .
Update openVMS compile support

 Modified Files:
 	Mesa/progs/demos/descrip.mms
 	Mesa/src/mesa/shader/slang/descrip.mms
 	Mesa/src/mesa/tnl/descrip.mms
 ----------------------------------------------------------------------
2005-05-20 11:43:54 +00:00
Jon Smirl
bab559b1fa Remove some debug output
Add #if DEBUG_FRAG in s_nvfragprog.c
2005-05-20 01:17:38 +00:00
Adam Jackson
8f8e0f0b01 Use the 1.3 names for FogCoord* 2005-05-20 00:44:37 +00:00
Keith Whitwell
18a74321aa Invalidate current fastpath on changes to attribute size or offset within
the vertex.

Use existing facilities to check for sse2 and enable when available.

Turn on SSE/SSE2 codegen for t_vertex.c by default when USE_SSE_ASM is
defined.  Disable with "MESA_NO_CODEGEN=t".
2005-05-19 20:25:32 +00:00
Keith Whitwell
c2745ffa49 Cope with the common 3ub and 1ub cases.
Fix a few typos.
Note that sse_movss sets high dwords to zero when reading from memory.
Fix a few related bugs.
2005-05-19 19:02:46 +00:00
Keith Whitwell
9557401a98 Re-initialize viewport shadows each time. 2005-05-19 19:01:47 +00:00
Keith Whitwell
67cc1f6ba6 move osmesa demos to their own directory 2005-05-19 15:39:37 +00:00
Jon Smirl
c70dace694 Fix EGL fbdev palette problem. demo3 can save ppm of screen 2005-05-19 15:03:31 +00:00
Keith Whitwell
6040d34109 Rename emit functions to reflect instruction set in use (ie
x86,sse,sse2,mmx).  Add paths for sse+mmx vs. the initial version
which assumed sse2 was available everywhere.
2005-05-19 14:42:09 +00:00
Brian Paul
8608978aba remove the XFree86 ID line 2005-05-19 13:32:41 +00:00
Michal Krol
02168254a8 intermediate code generator (not finished);
generic back-end interpreter (interprets directly intermediate code)
2005-05-19 11:50:53 +00:00
Michal Krol
e5ff2b94ff add static_assert macro 2005-05-19 10:22:28 +00:00
Michal Krol
216f89318e fix info log grabbing 2005-05-19 09:28:01 +00:00
115 changed files with 15452 additions and 11501 deletions

View File

@@ -31,8 +31,6 @@
# Available options:
#
# Environment variables:
# CPU optimize for the given processor.
# default = pentium
# GLU=[mesa|sgi] specify GLU directory; can be `sgi' (requires GNU/C++)
# or `mesa'.
# default = mesa
@@ -59,12 +57,10 @@
.PHONY : all libgl libglu libglut clean realclean
CPU ?= pentium
GLU ?= mesa
CFLAGS = -Wall -W -pedantic
CFLAGS += -O2 -ffast-math -mtune=$(CPU)
CFLAGS += -O2 -ffast-math
export CFLAGS

View File

@@ -31,8 +31,6 @@
# Available options:
#
# Environment variables:
# CPU optimize for the given processor.
# default = pentium
# GLIDE path to Glide3 SDK; used with FX.
# default = $(TOP)/glide3
# FX=1 build for 3dfx Glide3. Note that this disables
@@ -57,8 +55,6 @@
.PHONY : all libgl clean realclean
CPU ?= pentium
ifeq ($(ICD),1)
# when -std=c99 mingw will not define WIN32
CFLAGS = -Wall -W -Werror
@@ -66,7 +62,7 @@ else
# I love c89
CFLAGS = -Wall -W -pedantic
endif
CFLAGS += -O2 -ffast-math -mtune=$(CPU)
CFLAGS += -O2 -ffast-math
export CFLAGS

179
Mesa.dsw
View File

@@ -1,179 +0,0 @@
Microsoft Developer Studio Workspace File, Format Version 6.00
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
###############################################################################
Project: "array_cache"=".\SRC\MESA\array_cache\array_cache.dsp" - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "gdi"=".\src\mesa\drivers\windows\gdi\gdi.dsp" - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name array_cache
End Project Dependency
Begin Project Dependency
Project_Dep_Name main
End Project Dependency
Begin Project Dependency
Project_Dep_Name math
End Project Dependency
Begin Project Dependency
Project_Dep_Name swrast_setup
End Project Dependency
Begin Project Dependency
Project_Dep_Name swrast
End Project Dependency
Begin Project Dependency
Project_Dep_Name tnl
End Project Dependency
Begin Project Dependency
Project_Dep_Name glapi
End Project Dependency
Begin Project Dependency
Project_Dep_Name shader
End Project Dependency
}}}
###############################################################################
Project: "glapi"=".\SRC\MESA\glapi\glapi.dsp" - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "glu"=".\src\glu\sgi\glu.dsp" - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name gdi
End Project Dependency
}}}
###############################################################################
Project: "main"=".\SRC\MESA\main\main.dsp" - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "math"=".\SRC\MESA\math\math.dsp" - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "osmesa"=".\SRC\MESA\DRIVERS\osmesa\osmesa.dsp" - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name gdi
End Project Dependency
}}}
###############################################################################
Project: "shader"=".\SRC\MESA\shader\shader.dsp" - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "swrast"=".\SRC\MESA\swrast\swrast.dsp" - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "swrast_setup"=".\SRC\MESA\swrast_setup\swrast_setup.dsp" - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "tnl"=".\SRC\MESA\tnl\tnl.dsp" - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Global:
Package=<5>
{{{
}}}
Package=<3>
{{{
}}}
###############################################################################

View File

@@ -8,11 +8,23 @@ CONFIG_NAME = linux-solo
CC = gcc
CXX = g++
DEFINES = -DDRI_NEW_INTERFACE_ONLY -D_POSIX_SOURCE -D_SVID_SOURCE -D_BSD_SOURCE -D_POSIX_C_SOURCE=199309L -D_GNU_SOURCE -DUSE_EXTERNAL_DXTN_LIB=1 -DDRM_USE_MALLOC
WARN_FLAGS = -Wall -Wundef
OPT_FLAGS = -O3 -g
PIC_FLAGS = -fPIC
# Add '-DGLX_USE_TLS' to ARCH_FLAGS to enable TLS support.
ARCH_FLAGS ?=
CFLAGS = $(DEFINES) -Wmissing-prototypes -g -std=c99 -Wundef -fPIC -ffast-math
DEFINES = -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE \
-D_BSD_SOURCE -D_GNU_SOURCE \
-DDRI_NEW_INTERFACE_ONLY -DPTHREADS -DUSE_EXTERNAL_DXTN_LIB=1 -DDRM_USE_MALLOC
CXXFLAGS = $(DEFINES) -Wall -O3 -ansi -pedantic -fPIC
CFLAGS = $(WARN_FLAGS) $(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) $(DEFINES) \
$(ASM_FLAGS) -std=c99 -ffast-math
CXXFLAGS = $(WARN_FLAGS) $(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) $(DEFINES)
ASM_SOURCES =
# Library/program dependencies
DRI_LIB_DEPS = -lm -lpthread -lexpat -ldl -L$(LIB_DIR) -lEGL -l$(GL_LIB)
@@ -22,7 +34,7 @@ GLUT_LIB_DEPS = -L$(LIB_DIR) -l$(GLU_LIB) -l$(GL_LIB) -lm
APP_LIB_DEPS = -L$(LIB_DIR) -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) -lm -lpthread
# Directories
SRC_DIRS = mesa egl glx/mini glu glut/mini
SRC_DIRS = egl mesa glx/mini glu glut/mini
DRIVER_DIRS = dri
PROGRAM_DIRS = miniglx egl

View File

@@ -1,32 +1,12 @@
# Configuration for linux-solo: Linux DRI hardware drivers for fbdev
# -*-makefile-*-
# Configuration for linux-solo-x86: Linux hardware drivers for fbdev for x86
include $(TOP)/configs/default
include $(TOP)/configs/linux-solo
CONFIG_NAME = linux-solo-x86
# Compiler and flags
CC = gcc
CXX = g++
DEFINES = -DDRI_NEW_INTERFACE_ONLY -D_POSIX_SOURCE -D_SVID_SOURCE -D_BSD_SOURCE -D_POSIX_C_SOURCE=199309L -D_GNU_SOURCE -DUSE_X86_ASM -DUSE_MMX_ASM -DUSE_3DNOW_ASM -DUSE_SSE_ASM -DPTHREADS -DUSE_EXTERNAL_DXTN_LIB=1 -DDRM_USE_MALLOC
CFLAGS = $(DEFINES) -Wmissing-prototypes -O3 -g -std=c99 -Wundef -fPIC -ffast-math
CXXFLAGS = $(DEFINES) -Wall -O3 -ansi -pedantic -fPIC
# Unnecessary on x86, generally.
PIC_FLAGS =
ASM_FLAGS = -DUSE_X86_ASM -DUSE_MMX_ASM -DUSE_3DNOW_ASM -DUSE_SSE_ASM
ASM_SOURCES = $(X86_SOURCES)
# Library/program dependencies
DRI_LIB_DEPS = -lm -lpthread -lexpat -ldl
GL_LIB_DEPS = -lm -lpthread -ldl
GLUT_LIB_DEPS = -L$(LIB_DIR) -l$(GLU_LIB) -l$(GL_LIB) -lm
APP_LIB_DEPS = -L$(LIB_DIR) -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) -lm -lpthread
# Directories
SRC_DIRS = mesa glx/mini glu glut/mini
DRIVER_DIRS = dri
PROGRAM_DIRS = miniglx
#DRI_DIRS = fb ffb gamma sis savage
DRI_DIRS = i810 i830 i915 mach64 mga r128 r200 radeon tdfx unichrome

View File

@@ -36,7 +36,6 @@ PROGS = \
morph3d \
multiarb \
occlude \
osdemo \
paltex \
pixeltex \
pointblast \
@@ -110,20 +109,6 @@ shadowtex: shadowtex.o showbuffer.o
shadowtex.o: shadowtex.c showbuffer.h
$(CC) -c -I$(INCDIR) $(CFLAGS) shadowtex.c
# special case: need the -lOSMesa library:
osdemo: osdemo.c
$(CC) -I$(INCDIR) $(CFLAGS) osdemo.c $(OSMESA_LIBS) -o $@
# another special case: need the -lOSMesa16 library:
osdemo16: osdemo16.c
$(CC) -I$(INCDIR) $(CFLAGS) osdemo16.c $(OSMESA16_LIBS) -o $@
# another special case: need the -lOSMesa32 library:
osdemo32: osdemo32.c
$(CC) -I$(INCDIR) $(CFLAGS) osdemo32.c $(OSMESA32_LIBS) -o $@
clean:
-rm -f $(PROGS)
-rm -f *.o *~

View File

@@ -1,6 +1,6 @@
# Makefile for GLUT-based demo programs for VMS
# contributed by Jouk Jansen joukj@crys.chem.uva.nl
# contributed by Jouk Jansen joukj@hrem.stm.tudelft.nl
# Last update : 20 May 2005
.first
define gl [--.include.gl]
@@ -22,7 +22,7 @@ LIB_DEP = [--.lib]$(GL_LIB) [--.lib]$(GLU_LIB) [--.lib]$(GLUT_LIB)
PROGS = bounce.exe;,clearspd.exe;,drawpix.exe;,gamma.exe;,gears.exe;,\
glinfo.exe;,glutfx.exe;,isosurf.exe;,morph3d.exe;,osdemo.exe;,\
glinfo.exe;,glutfx.exe;,isosurf.exe;,morph3d.exe;,\
paltex.exe;,pointblast.exe;,reflect.exe;,spectex.exe;,stex3d.exe;,\
tessdemo.exe;,texcyl.exe;,texobj.exe;,trispd.exe;,winpos.exe;
@@ -53,7 +53,6 @@ glutfx.exe; : glutfx.obj $(LIB_DEP)
isosurf.exe; : isosurf.obj $(LIB_DEP) [-.util]readtex.obj
cxxlink $(MMS$TARGET_NAME),[-.util]readtex.obj,$(GL_LIBS)
morph3d.exe; : morph3d.obj $(LIB_DEP)
osdemo.exe; : osdemo.obj $(LIB_DEP)
paltex.exe; : paltex.obj $(LIB_DEP)
pointblast.exe; : pointblast.obj $(LIB_DEP)
reflect.exe; : reflect.obj [-.util]readtex.obj [-.util]showbuffer.obj\
@@ -79,7 +78,6 @@ glinfo.obj : glinfo.c
glutfx.obj : glutfx.c
isosurf.obj : isosurf.c
morph3d.obj : morph3d.c
osdemo.obj : osdemo.c
paltex.obj : paltex.c
pointblast.obj : pointblast.c
reflect.obj : reflect.c

View File

@@ -9,7 +9,7 @@
#include <GLES/egl.h>
//#define FRONTBUFFER
/*#define FRONTBUFFER*/
static void _subset_Rectf(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2)
{

View File

@@ -500,6 +500,58 @@ static void Draw(EGLDisplay dpy, EGLSurface surf)
}
}
static void
write_ppm(const char *filename, const GLubyte *buffer, int width, int height)
{
const int binary = 0;
FILE *f = fopen( filename, "w" );
if (f) {
int i, x, y;
const GLubyte *ptr = buffer;
if (binary) {
fprintf(f,"P6\n");
fprintf(f,"# ppm-file created by osdemo.c\n");
fprintf(f,"%i %i\n", width,height);
fprintf(f,"255\n");
fclose(f);
f = fopen( filename, "ab" ); /* reopen in binary append mode */
for (y=height-1; y>=0; y--) {
for (x=0; x<width; x++) {
i = (y*width + x) * 4;
fputc(ptr[i], f); /* write red */
fputc(ptr[i+1], f); /* write green */
fputc(ptr[i+2], f); /* write blue */
}
}
}
else {
/*ASCII*/
int counter = 0;
fprintf(f,"P3\n");
fprintf(f,"# ascii ppm file created by osdemo.c\n");
fprintf(f,"%i %i\n", width, height);
fprintf(f,"255\n");
for (y=height-1; y>=0; y--) {
for (x=0; x<width; x++) {
i = (y*width + x) * 4;
fprintf(f, " %3d %3d %3d", ptr[i], ptr[i+1], ptr[i+2]);
counter++;
if (counter % 5 == 0)
fprintf(f, "\n");
}
}
}
fclose(f);
}
}
#include "../src/egl/main/egldisplay.h"
typedef struct fb_display
{
_EGLDisplay Base; /* base class/object */
void *pFB;
} fbDisplay;
int
@@ -561,9 +613,20 @@ main(int argc, char *argv[])
Reshape(1024, 768);
glDrawBuffer( GL_FRONT );
glClearColor( 0,
1.0,
0,
1);
glClear( GL_COLOR_BUFFER_BIT );
doubleBuffer = 1;
glDrawBuffer( GL_BACK );
Draw(d, screen_surf);
write_ppm("dump.ppm", ((struct fb_display *)_eglLookupDisplay(d))->pFB, 1024, 768);
eglDestroySurface(d, screen_surf);
eglDestroyContext(d, ctx);
eglTerminate(d);

View File

@@ -33,6 +33,7 @@
#define MAX_CONFIGS 1000
#define MAX_MODES 1000
#define MAX_SCREENS 10
/**
@@ -97,12 +98,12 @@ PrintModes(EGLDisplay d)
{
#ifdef EGL_MESA_screen_surface
const char *extensions = eglQueryString(d, EGL_EXTENSIONS);
if (strstr("EGL_MESA_screen_surface", extensions)) {
EGLScreenMESA screens[20];
if (strstr(extensions, "EGL_MESA_screen_surface")) {
EGLScreenMESA screens[MAX_SCREENS];
EGLint numScreens = 1, scrn;
EGLModeMESA modes[MAX_MODES];
eglGetScreensMESA(d, screens, 20, &numScreens);
eglGetScreensMESA(d, screens, MAX_SCREENS, &numScreens);
printf("Number of Screens: %d\n\n", numScreens);
for (scrn = 0; scrn < numScreens; scrn++) {
@@ -111,15 +112,17 @@ PrintModes(EGLDisplay d)
eglGetModesMESA(d, screens[scrn], modes, MAX_MODES, &numModes);
printf("Screen %d Modes:\n", scrn);
printf(" id width height refresh\n");
printf("-------------------------\n");
printf(" id width height refresh name\n");
printf("-----------------------------------------\n");
for (i = 0; i < numModes; i++) {
EGLint id, w, h, r;
const char *str;
eglGetModeAttribMESA(d, modes[i], EGL_MODE_ID_MESA, &id);
eglGetModeAttribMESA(d, modes[i], EGL_WIDTH, &w);
eglGetModeAttribMESA(d, modes[i], EGL_HEIGHT, &h);
eglGetModeAttribMESA(d, modes[i], EGL_REFRESH_RATE_MESA, &r);
printf("0x%02x %5d %5d %.3f\n", id, w, h, r / 1000.0);
str = eglQueryModeStringMESA(d, modes[i]);
printf("0x%02x %5d %5d %.3f %s\n", id, w, h, r / 1000.0, str);
}
}
}
@@ -132,7 +135,7 @@ int
main(int argc, char *argv[])
{
int maj, min;
// EGLDisplay d = eglGetDisplay(EGL_DEFAULT_DISPLAY);
/*EGLDisplay d = eglGetDisplay(EGL_DEFAULT_DISPLAY);*/
EGLDisplay d = eglGetDisplay("!fb_dri");
if (!eglInitialize(d, &maj, &min)) {

73
progs/osdemos/Makefile Normal file
View File

@@ -0,0 +1,73 @@
# progs/demos/Makefile
TOP = ../..
include $(TOP)/configs/current
INCDIR = $(TOP)/include
OSMESA_LIBS = -L$(LIB_DIR) -lglut -lOSMesa -lGLU -lGL $(APP_LIB_DEPS)
OSMESA16_LIBS = -L$(LIB_DIR) -lglut -lOSMesa16 -lGLU -lGL $(APP_LIB_DEPS)
OSMESA32_LIBS = -L$(LIB_DIR) -lglut -lOSMesa32 -lGLU -lGL $(APP_LIB_DEPS)
LIB_DEP = $(LIB_DIR)/$(GL_LIB_NAME) $(LIB_DIR)/$(GLU_LIB_NAME) $(LIB_DIR)/$(GLUT_LIB_NAME)
PROGS = \
osdemo
##### RULES #####
.SUFFIXES:
.SUFFIXES: .c
# make executable from .c file:
.c: $(LIB_DEP) readtex.o
$(CC) -I$(INCDIR) $(CFLAGS) $< readtex.o $(APP_LIB_DEPS) -o $@
##### TARGETS #####
default: readtex.o $(PROGS)
readtex.c: $(TOP)/progs/util/readtex.c
cp $< .
readtex.h: $(TOP)/progs/util/readtex.h
cp $< .
readtex.o: readtex.c readtex.h
$(CC) -c -I$(INCDIR) $(CFLAGS) readtex.c
showbuffer.c: $(TOP)/progs/util/showbuffer.c
cp $< .
showbuffer.h: $(TOP)/progs/util/showbuffer.h
cp $< .
showbuffer.o: showbuffer.c showbuffer.h
$(CC) -c -I$(INCDIR) $(CFLAGS) showbuffer.c
# special case: need the -lOSMesa library:
osdemo: osdemo.c
$(CC) -I$(INCDIR) $(CFLAGS) osdemo.c $(OSMESA_LIBS) -o $@
# another special case: need the -lOSMesa16 library:
osdemo16: osdemo16.c
$(CC) -I$(INCDIR) $(CFLAGS) osdemo16.c $(OSMESA16_LIBS) -o $@
# another special case: need the -lOSMesa32 library:
osdemo32: osdemo32.c
$(CC) -I$(INCDIR) $(CFLAGS) osdemo32.c $(OSMESA32_LIBS) -o $@
clean:
-rm -f $(PROGS)
-rm -f *.o *~
-rm -f readtex.[ch] showbuffer.[ch]

View File

@@ -31,8 +31,6 @@
# Available options:
#
# Environment variables:
# CPU optimize for the given processor.
# default = pentium
# GLIDE path to Glide3 SDK; used with FX.
# default = $(TOP)/glide3
# FX=1 build for 3dfx Glide3. Note that this disables
@@ -54,12 +52,11 @@
.SECONDARY: ../util/readtex.o ../util/showbuffer.o
TOP = ../..
CPU ?= pentium
GLIDE ?= $(TOP)/glide3
CC = gcc
CFLAGS = -Wall -W -pedantic
CFLAGS += -O2 -ffast-math -mtune=$(CPU)
CFLAGS += -O2 -ffast-math
CFLAGS += -I$(TOP)/include -I../util
CFLAGS += -DGLUT_IMPORT_LIB
ifeq ($(FX),1)

View File

@@ -31,8 +31,6 @@
# Available options:
#
# Environment variables:
# CPU optimize for the given processor.
# default = pentium
#
# Targets:
# <file.exe> build a specific file
@@ -45,11 +43,10 @@
.SECONDARY: ../util/readtex.o ../util/showbuffer.o
TOP = ../..
CPU ?= pentium
CC = mingw32-gcc
CFLAGS = -Wall -W -pedantic
CFLAGS += -O2 -ffast-math -mtune=$(CPU)
CFLAGS += -O2 -ffast-math
CFLAGS += -I$(TOP)/include -I../util
ifeq ($(FX),1)
CFLAGS += -DFX

View File

@@ -83,8 +83,8 @@ static void Display( void )
DO_FUNC( glTexCoord3fv, (v) );
DO_FUNC( glMultiTexCoord2fv, (GL_TEXTURE0, v) );
DO_FUNC( glMultiTexCoord2f, (GL_TEXTURE0, 0.0, 0.0) );
DO_FUNC( glFogCoordfv, (v) );
DO_FUNC( glFogCoordf, (0.5) );
DO_FUNC( glFogCoordfvEXT, (v) );
DO_FUNC( glFogCoordfEXT, (0.5) );
glEnd();

View File

@@ -1,82 +0,0 @@
/nologo /W2 /GX- /ZI /Od /c /TP
/I "../../../include"
/I "./include"
/I "./libnurbs/interface"
/I "./libnurbs/internals"
/I "./libnurbs/nurbtess"
/D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS"
/D "_USRDLL" /D "GLU_EXPORTS" /D "BUILD_GL32" /D "LIBRARYBUILD"
/Fo"Debug/" /Fd"Debug/" /GZ
libnurbs/interface/bezierEval.cc
libnurbs/interface/bezierPatch.cc
libnurbs/interface/bezierPatchMesh.cc
libnurbs/interface/glcurveval.cc
libnurbs/interface/glinterface.cc
libnurbs/interface/glrenderer.cc
libnurbs/interface/glsurfeval.cc
libnurbs/interface/incurveeval.cc
libnurbs/interface/insurfeval.cc
libnurbs/internals/arc.cc
libnurbs/internals/arcsorter.cc
libnurbs/internals/arctess.cc
libnurbs/internals/backend.cc
libnurbs/internals/basiccrveval.cc
libnurbs/internals/basicsurfeval.cc
libnurbs/internals/bin.cc
libnurbs/internals/bufpool.cc
libnurbs/internals/cachingeval.cc
libnurbs/internals/ccw.cc
libnurbs/internals/coveandtiler.cc
libnurbs/internals/curve.cc
libnurbs/internals/curvelist.cc
libnurbs/internals/curvesub.cc
libnurbs/internals/dataTransform.cc
libnurbs/internals/displaylist.cc
libnurbs/internals/flist.cc
libnurbs/internals/flistsorter.cc
libnurbs/internals/hull.cc
libnurbs/internals/intersect.cc
libnurbs/internals/knotvector.cc
libnurbs/internals/mapdesc.cc
libnurbs/internals/mapdescv.cc
libnurbs/internals/maplist.cc
libnurbs/internals/mesher.cc
libnurbs/internals/monoTriangulationBackend.cc
libnurbs/internals/monotonizer.cc
libnurbs/internals/mycode.cc
libnurbs/internals/nurbsinterfac.cc
libnurbs/internals/nurbstess.cc
libnurbs/internals/patch.cc
libnurbs/internals/patchlist.cc
libnurbs/internals/quilt.cc
libnurbs/internals/reader.cc
libnurbs/internals/renderhints.cc
libnurbs/internals/slicer.cc
libnurbs/internals/sorter.cc
libnurbs/internals/splitarcs.cc
libnurbs/internals/subdivider.cc
libnurbs/internals/tobezier.cc
libnurbs/internals/trimline.cc
libnurbs/internals/trimregion.cc
libnurbs/internals/trimvertpool.cc
libnurbs/internals/uarray.cc
libnurbs/internals/varray.cc
libnurbs/nurbtess/directedLine.cc
libnurbs/nurbtess/gridWrap.cc
libnurbs/nurbtess/monoChain.cc
libnurbs/nurbtess/monoPolyPart.cc
libnurbs/nurbtess/monoTriangulation.cc
libnurbs/nurbtess/partitionX.cc
libnurbs/nurbtess/partitionY.cc
libnurbs/nurbtess/polyDBG.cc
libnurbs/nurbtess/polyUtil.cc
libnurbs/nurbtess/primitiveStream.cc
libnurbs/nurbtess/quicksort.cc
libnurbs/nurbtess/rectBlock.cc
libnurbs/nurbtess/sampleComp.cc
libnurbs/nurbtess/sampleCompBot.cc
libnurbs/nurbtess/sampleCompRight.cc
libnurbs/nurbtess/sampleCompTop.cc
libnurbs/nurbtess/sampleMonoPoly.cc
libnurbs/nurbtess/sampledLine.cc
libnurbs/nurbtess/searchTree.cc

View File

@@ -1,82 +0,0 @@
/nologo /W2 /GX- /O2 /c /TP
/I "../../../include"
/I "./include"
/I "./libnurbs/interface"
/I "./libnurbs/internals"
/I "./libnurbs/nurbtess"
/D "WIN32" /D "_WINDOWS" /D "_MBCS"
/D "_USRDLL" /D "GLU_EXPORTS" /D "BUILD_GL32" /D "LIBRARYBUILD"
/Fo"Release/"
libnurbs/interface/bezierEval.cc
libnurbs/interface/bezierPatch.cc
libnurbs/interface/bezierPatchMesh.cc
libnurbs/interface/glcurveval.cc
libnurbs/interface/glinterface.cc
libnurbs/interface/glrenderer.cc
libnurbs/interface/glsurfeval.cc
libnurbs/interface/incurveeval.cc
libnurbs/interface/insurfeval.cc
libnurbs/internals/arc.cc
libnurbs/internals/arcsorter.cc
libnurbs/internals/arctess.cc
libnurbs/internals/backend.cc
libnurbs/internals/basiccrveval.cc
libnurbs/internals/basicsurfeval.cc
libnurbs/internals/bin.cc
libnurbs/internals/bufpool.cc
libnurbs/internals/cachingeval.cc
libnurbs/internals/ccw.cc
libnurbs/internals/coveandtiler.cc
libnurbs/internals/curve.cc
libnurbs/internals/curvelist.cc
libnurbs/internals/curvesub.cc
libnurbs/internals/dataTransform.cc
libnurbs/internals/displaylist.cc
libnurbs/internals/flist.cc
libnurbs/internals/flistsorter.cc
libnurbs/internals/hull.cc
libnurbs/internals/intersect.cc
libnurbs/internals/knotvector.cc
libnurbs/internals/mapdesc.cc
libnurbs/internals/mapdescv.cc
libnurbs/internals/maplist.cc
libnurbs/internals/mesher.cc
libnurbs/internals/monoTriangulationBackend.cc
libnurbs/internals/monotonizer.cc
libnurbs/internals/mycode.cc
libnurbs/internals/nurbsinterfac.cc
libnurbs/internals/nurbstess.cc
libnurbs/internals/patch.cc
libnurbs/internals/patchlist.cc
libnurbs/internals/quilt.cc
libnurbs/internals/reader.cc
libnurbs/internals/renderhints.cc
libnurbs/internals/slicer.cc
libnurbs/internals/sorter.cc
libnurbs/internals/splitarcs.cc
libnurbs/internals/subdivider.cc
libnurbs/internals/tobezier.cc
libnurbs/internals/trimline.cc
libnurbs/internals/trimregion.cc
libnurbs/internals/trimvertpool.cc
libnurbs/internals/uarray.cc
libnurbs/internals/varray.cc
libnurbs/nurbtess/directedLine.cc
libnurbs/nurbtess/gridWrap.cc
libnurbs/nurbtess/monoChain.cc
libnurbs/nurbtess/monoPolyPart.cc
libnurbs/nurbtess/monoTriangulation.cc
libnurbs/nurbtess/partitionX.cc
libnurbs/nurbtess/partitionY.cc
libnurbs/nurbtess/polyDBG.cc
libnurbs/nurbtess/polyUtil.cc
libnurbs/nurbtess/primitiveStream.cc
libnurbs/nurbtess/quicksort.cc
libnurbs/nurbtess/rectBlock.cc
libnurbs/nurbtess/sampleComp.cc
libnurbs/nurbtess/sampleCompBot.cc
libnurbs/nurbtess/sampleCompRight.cc
libnurbs/nurbtess/sampleCompTop.cc
libnurbs/nurbtess/sampleMonoPoly.cc
libnurbs/nurbtess/sampledLine.cc
libnurbs/nurbtess/searchTree.cc

View File

@@ -1,888 +0,0 @@
# Microsoft Developer Studio Project File - Name="glu" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
CFG=glu - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "glu.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "glu.mak" CFG="glu - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "glu - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE "glu - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
MTL=midl.exe
RSC=rc.exe
!IF "$(CFG)" == "glu - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "GLU_EXPORTS" /YX /FD /c
# ADD CPP /nologo /MT /W3 /GX /O2 /I "../../../include" /I "./include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "GLU_EXPORTS" /D "BUILD_GL32" /YX /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
# ADD LINK32 msvcrt.lib winmm.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/OPENGL32.LIB Release/GLUCC.LIB /nologo /dll /machine:I386 /nodefaultlib /out:"Release/GLU32.DLL"
# Begin Special Build Tool
SOURCE="$(InputPath)"
PreLink_Cmds=cl @ccRelease.txt LIB /OUT:Release/GLUCC.LIB @ccReleaseObj.txt
PostBuild_Desc=Copy import lib and dll
PostBuild_Cmds=if not exist ..\..\..\lib md ..\..\..\lib copy Release\GLU32.LIB ..\..\..\lib copy Release\GLU32.DLL ..\..\..\lib
# End Special Build Tool
!ELSEIF "$(CFG)" == "glu - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "GLU_EXPORTS" /YX /FD /GZ /c
# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "../../../include" /I "./include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "GLU_EXPORTS" /D "BUILD_GL32" /FR /YX /FD /GZ /c
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
# ADD LINK32 msvcrtd.lib winmm.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/OPENGL32.LIB Debug/GLUCC.LIB /nologo /dll /debug /machine:I386 /nodefaultlib /out:"Debug/GLU32.DLL" /pdbtype:sept
# Begin Special Build Tool
SOURCE="$(InputPath)"
PreLink_Desc=C++ compilations
PreLink_Cmds=cl @ccDebug.txt LIB /OUT:Debug/GLUCC.LIB @ccDebugObj.txt
PostBuild_Desc=Copy import lib and dll
PostBuild_Cmds=if not exist ..\..\..\lib md ..\..\..\lib copy Debug\GLU32.LIB ..\..\..\lib copy Debug\GLU32.DLL ..\..\..\lib
# End Special Build Tool
!ENDIF
# Begin Target
# Name "glu - Win32 Release"
# Name "glu - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=.\libnurbs\internals\arc.cc
# End Source File
# Begin Source File
SOURCE=.\libnurbs\internals\arcsorter.cc
# End Source File
# Begin Source File
SOURCE=.\libnurbs\internals\arctess.cc
# End Source File
# Begin Source File
SOURCE=.\libnurbs\internals\backend.cc
# End Source File
# Begin Source File
SOURCE=.\libnurbs\internals\basiccrveval.cc
# End Source File
# Begin Source File
SOURCE=.\libnurbs\internals\basicsurfeval.cc
# End Source File
# Begin Source File
SOURCE=.\libnurbs\interface\bezierEval.cc
# End Source File
# Begin Source File
SOURCE=.\libnurbs\interface\bezierPatch.cc
# End Source File
# Begin Source File
SOURCE=.\libnurbs\interface\bezierPatchMesh.cc
# End Source File
# Begin Source File
SOURCE=.\libnurbs\internals\bin.cc
# End Source File
# Begin Source File
SOURCE=.\libnurbs\internals\bufpool.cc
# End Source File
# Begin Source File
SOURCE=.\libnurbs\internals\cachingeval.cc
# End Source File
# Begin Source File
SOURCE=.\libnurbs\internals\ccw.cc
# End Source File
# Begin Source File
SOURCE=.\libnurbs\internals\coveandtiler.cc
# End Source File
# Begin Source File
SOURCE=.\libnurbs\internals\curve.cc
# End Source File
# Begin Source File
SOURCE=.\libnurbs\internals\curvelist.cc
# End Source File
# Begin Source File
SOURCE=.\libnurbs\internals\curvesub.cc
# End Source File
# Begin Source File
SOURCE=.\libnurbs\internals\dataTransform.cc
# End Source File
# Begin Source File
SOURCE=.\libtess\dict.c
# End Source File
# Begin Source File
SOURCE=.\libnurbs\nurbtess\directedLine.cc
# End Source File
# Begin Source File
SOURCE=.\libnurbs\internals\displaylist.cc
# End Source File
# Begin Source File
SOURCE=.\libutil\error.c
# End Source File
# Begin Source File
SOURCE=.\libnurbs\internals\flist.cc
# End Source File
# Begin Source File
SOURCE=.\libnurbs\internals\flistsorter.cc
# End Source File
# Begin Source File
SOURCE=.\libtess\geom.c
# End Source File
# Begin Source File
SOURCE=.\libnurbs\interface\glcurveval.cc
# End Source File
# Begin Source File
SOURCE=.\libnurbs\interface\glinterface.cc
# End Source File
# Begin Source File
SOURCE=.\libnurbs\interface\glrenderer.cc
# End Source File
# Begin Source File
SOURCE=.\libnurbs\interface\glsurfeval.cc
# End Source File
# Begin Source File
SOURCE=.\glu.def
# End Source File
# Begin Source File
SOURCE=.\libutil\glue.c
# End Source File
# Begin Source File
SOURCE=.\libnurbs\nurbtess\gridWrap.cc
# End Source File
# Begin Source File
SOURCE=.\libnurbs\internals\hull.cc
# End Source File
# Begin Source File
SOURCE=.\libnurbs\interface\incurveeval.cc
# End Source File
# Begin Source File
SOURCE=.\libnurbs\interface\insurfeval.cc
# End Source File
# Begin Source File
SOURCE=.\libnurbs\internals\intersect.cc
# End Source File
# Begin Source File
SOURCE=.\libnurbs\internals\knotvector.cc
# End Source File
# Begin Source File
SOURCE=.\libnurbs\internals\mapdesc.cc
# End Source File
# Begin Source File
SOURCE=.\libnurbs\internals\mapdescv.cc
# End Source File
# Begin Source File
SOURCE=.\libnurbs\internals\maplist.cc
# End Source File
# Begin Source File
SOURCE=.\libtess\memalloc.c
# End Source File
# Begin Source File
SOURCE=.\libtess\mesh.c
# End Source File
# Begin Source File
SOURCE=.\libnurbs\internals\mesher.cc
# End Source File
# Begin Source File
SOURCE=.\libutil\mipmap.c
# End Source File
# Begin Source File
SOURCE=.\libnurbs\nurbtess\monoChain.cc
# End Source File
# Begin Source File
SOURCE=.\libnurbs\nurbtess\monoPolyPart.cc
# End Source File
# Begin Source File
SOURCE=.\libnurbs\internals\monotonizer.cc
# End Source File
# Begin Source File
SOURCE=.\libnurbs\nurbtess\monoTriangulation.cc
# End Source File
# Begin Source File
SOURCE=.\libnurbs\internals\monoTriangulationBackend.cc
# End Source File
# Begin Source File
SOURCE=.\libnurbs\internals\mycode.cc
# End Source File
# Begin Source File
SOURCE=.\libtess\normal.c
# End Source File
# Begin Source File
SOURCE=.\libnurbs\internals\nurbsinterfac.cc
# End Source File
# Begin Source File
SOURCE=.\libnurbs\internals\nurbstess.cc
# End Source File
# Begin Source File
SOURCE=.\libnurbs\nurbtess\partitionX.cc
# End Source File
# Begin Source File
SOURCE=.\libnurbs\nurbtess\partitionY.cc
# End Source File
# Begin Source File
SOURCE=.\libnurbs\internals\patch.cc
# End Source File
# Begin Source File
SOURCE=.\libnurbs\internals\patchlist.cc
# End Source File
# Begin Source File
SOURCE=.\libnurbs\nurbtess\polyDBG.cc
# End Source File
# Begin Source File
SOURCE=.\libnurbs\nurbtess\polyUtil.cc
# End Source File
# Begin Source File
SOURCE=.\libnurbs\nurbtess\primitiveStream.cc
# End Source File
# Begin Source File
SOURCE=.\libtess\priorityq.c
# End Source File
# Begin Source File
SOURCE=.\libutil\project.c
# End Source File
# Begin Source File
SOURCE=.\libutil\quad.c
# End Source File
# Begin Source File
SOURCE=.\libnurbs\nurbtess\quicksort.cc
# End Source File
# Begin Source File
SOURCE=.\libnurbs\internals\quilt.cc
# End Source File
# Begin Source File
SOURCE=.\libnurbs\internals\reader.cc
# End Source File
# Begin Source File
SOURCE=.\libnurbs\nurbtess\rectBlock.cc
# End Source File
# Begin Source File
SOURCE=.\libutil\registry.c
# End Source File
# Begin Source File
SOURCE=.\libtess\render.c
# End Source File
# Begin Source File
SOURCE=.\libnurbs\internals\renderhints.cc
# End Source File
# Begin Source File
SOURCE=.\libnurbs\nurbtess\sampleComp.cc
# End Source File
# Begin Source File
SOURCE=.\libnurbs\nurbtess\sampleCompBot.cc
# End Source File
# Begin Source File
SOURCE=.\libnurbs\nurbtess\sampleCompRight.cc
# End Source File
# Begin Source File
SOURCE=.\libnurbs\nurbtess\sampleCompTop.cc
# End Source File
# Begin Source File
SOURCE=.\libnurbs\nurbtess\sampledLine.cc
# End Source File
# Begin Source File
SOURCE=.\libnurbs\nurbtess\sampleMonoPoly.cc
# End Source File
# Begin Source File
SOURCE=.\libnurbs\nurbtess\searchTree.cc
# End Source File
# Begin Source File
SOURCE=.\libnurbs\internals\slicer.cc
# End Source File
# Begin Source File
SOURCE=.\libnurbs\internals\sorter.cc
# End Source File
# Begin Source File
SOURCE=.\libnurbs\internals\splitarcs.cc
# End Source File
# Begin Source File
SOURCE=.\libnurbs\internals\subdivider.cc
# End Source File
# Begin Source File
SOURCE=.\libtess\sweep.c
# End Source File
# Begin Source File
SOURCE=.\libtess\tess.c
# End Source File
# Begin Source File
SOURCE=.\libtess\tessmono.c
# End Source File
# Begin Source File
SOURCE=.\libnurbs\internals\tobezier.cc
# End Source File
# Begin Source File
SOURCE=.\libnurbs\internals\trimline.cc
# End Source File
# Begin Source File
SOURCE=.\libnurbs\internals\trimregion.cc
# End Source File
# Begin Source File
SOURCE=.\libnurbs\internals\trimvertpool.cc
# End Source File
# Begin Source File
SOURCE=.\libnurbs\internals\uarray.cc
# End Source File
# Begin Source File
SOURCE=.\libnurbs\internals\varray.cc
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# Begin Source File
SOURCE=.\libnurbs\internals\arc.h
# End Source File
# Begin Source File
SOURCE=.\libnurbs\internals\arcsorter.h
# End Source File
# Begin Source File
SOURCE=.\libnurbs\internals\arctess.h
# End Source File
# Begin Source File
SOURCE=.\libnurbs\internals\backend.h
# End Source File
# Begin Source File
SOURCE=.\libnurbs\internals\basiccrveval.h
# End Source File
# Begin Source File
SOURCE=.\libnurbs\internals\basicsurfeval.h
# End Source File
# Begin Source File
SOURCE=.\libnurbs\internals\bezierarc.h
# End Source File
# Begin Source File
SOURCE=.\libnurbs\interface\bezierEval.h
# End Source File
# Begin Source File
SOURCE=.\libnurbs\interface\bezierPatch.h
# End Source File
# Begin Source File
SOURCE=.\libnurbs\interface\bezierPatchMesh.h
# End Source File
# Begin Source File
SOURCE=.\libnurbs\internals\bin.h
# End Source File
# Begin Source File
SOURCE=.\libnurbs\internals\bufpool.h
# End Source File
# Begin Source File
SOURCE=.\libnurbs\internals\cachingeval.h
# End Source File
# Begin Source File
SOURCE=.\libnurbs\internals\coveandtiler.h
# End Source File
# Begin Source File
SOURCE=.\libnurbs\internals\curve.h
# End Source File
# Begin Source File
SOURCE=.\libnurbs\internals\curvelist.h
# End Source File
# Begin Source File
SOURCE=.\libnurbs\internals\dataTransform.h
# End Source File
# Begin Source File
SOURCE=.\libnurbs\internals\defines.h
# End Source File
# Begin Source File
SOURCE=.\libnurbs\nurbtess\definitions.h
# End Source File
# Begin Source File
SOURCE=".\libtess\dict-list.h"
# End Source File
# Begin Source File
SOURCE=.\libtess\dict.h
# End Source File
# Begin Source File
SOURCE=.\libnurbs\nurbtess\directedLine.h
# End Source File
# Begin Source File
SOURCE=.\libnurbs\internals\displaylist.h
# End Source File
# Begin Source File
SOURCE=.\libnurbs\internals\displaymode.h
# End Source File
# Begin Source File
SOURCE=.\libnurbs\internals\flist.h
# End Source File
# Begin Source File
SOURCE=.\libnurbs\internals\flistsorter.h
# End Source File
# Begin Source File
SOURCE=.\libtess\geom.h
# End Source File
# Begin Source File
SOURCE=.\libnurbs\interface\glcurveval.h
# End Source File
# Begin Source File
SOURCE=.\libnurbs\interface\glimports.h
# End Source File
# Begin Source File
SOURCE=.\libnurbs\nurbtess\glimports.h
# End Source File
# Begin Source File
SOURCE=.\libnurbs\interface\glrenderer.h
# End Source File
# Begin Source File
SOURCE=.\libnurbs\interface\glsurfeval.h
# End Source File
# Begin Source File
SOURCE=.\libutil\gluint.h
# End Source File
# Begin Source File
SOURCE=.\include\gluos.h
# End Source File
# Begin Source File
SOURCE=.\libnurbs\internals\gridline.h
# End Source File
# Begin Source File
SOURCE=.\libnurbs\internals\gridtrimvertex.h
# End Source File
# Begin Source File
SOURCE=.\libnurbs\internals\gridvertex.h
# End Source File
# Begin Source File
SOURCE=.\libnurbs\nurbtess\gridWrap.h
# End Source File
# Begin Source File
SOURCE=.\libnurbs\internals\hull.h
# End Source File
# Begin Source File
SOURCE=.\libnurbs\internals\jarcloc.h
# End Source File
# Begin Source File
SOURCE=.\libnurbs\internals\knotvector.h
# End Source File
# Begin Source File
SOURCE=.\libnurbs\internals\mapdesc.h
# End Source File
# Begin Source File
SOURCE=.\libnurbs\internals\maplist.h
# End Source File
# Begin Source File
SOURCE=.\libtess\memalloc.h
# End Source File
# Begin Source File
SOURCE=.\libtess\mesh.h
# End Source File
# Begin Source File
SOURCE=.\libnurbs\internals\mesher.h
# End Source File
# Begin Source File
SOURCE=.\libnurbs\nurbtess\monoChain.h
# End Source File
# Begin Source File
SOURCE=.\libnurbs\nurbtess\monoPolyPart.h
# End Source File
# Begin Source File
SOURCE=.\libnurbs\internals\monotonizer.h
# End Source File
# Begin Source File
SOURCE=.\libnurbs\nurbtess\monoTriangulation.h
# End Source File
# Begin Source File
SOURCE=.\libnurbs\internals\myassert.h
# End Source File
# Begin Source File
SOURCE=.\libnurbs\internals\mymath.h
# End Source File
# Begin Source File
SOURCE=.\libnurbs\internals\mysetjmp.h
# End Source File
# Begin Source File
SOURCE=.\libnurbs\interface\mystdio.h
# End Source File
# Begin Source File
SOURCE=.\libnurbs\nurbtess\mystdio.h
# End Source File
# Begin Source File
SOURCE=.\libnurbs\interface\mystdlib.h
# End Source File
# Begin Source File
SOURCE=.\libnurbs\nurbtess\mystdlib.h
# End Source File
# Begin Source File
SOURCE=.\libnurbs\internals\mystring.h
# End Source File
# Begin Source File
SOURCE=.\libtess\normal.h
# End Source File
# Begin Source File
SOURCE=.\libnurbs\internals\nurbsconsts.h
# End Source File
# Begin Source File
SOURCE=.\libnurbs\internals\nurbstess.h
# End Source File
# Begin Source File
SOURCE=.\libnurbs\nurbtess\partitionX.h
# End Source File
# Begin Source File
SOURCE=.\libnurbs\nurbtess\partitionY.h
# End Source File
# Begin Source File
SOURCE=.\libnurbs\internals\patch.h
# End Source File
# Begin Source File
SOURCE=.\libnurbs\internals\patchlist.h
# End Source File
# Begin Source File
SOURCE=.\libnurbs\nurbtess\polyDBG.h
# End Source File
# Begin Source File
SOURCE=.\libnurbs\nurbtess\polyUtil.h
# End Source File
# Begin Source File
SOURCE=.\libnurbs\nurbtess\primitiveStream.h
# End Source File
# Begin Source File
SOURCE=".\libtess\priorityq-sort.h"
# End Source File
# Begin Source File
SOURCE=.\libtess\priorityq.h
# End Source File
# Begin Source File
SOURCE=.\libnurbs\internals\pwlarc.h
# End Source File
# Begin Source File
SOURCE=.\libnurbs\nurbtess\quicksort.h
# End Source File
# Begin Source File
SOURCE=.\libnurbs\internals\quilt.h
# End Source File
# Begin Source File
SOURCE=.\libnurbs\internals\reader.h
# End Source File
# Begin Source File
SOURCE=.\libnurbs\nurbtess\rectBlock.h
# End Source File
# Begin Source File
SOURCE=.\libtess\render.h
# End Source File
# Begin Source File
SOURCE=.\libnurbs\internals\renderhints.h
# End Source File
# Begin Source File
SOURCE=.\libnurbs\nurbtess\sampleComp.h
# End Source File
# Begin Source File
SOURCE=.\libnurbs\nurbtess\sampleCompBot.h
# End Source File
# Begin Source File
SOURCE=.\libnurbs\nurbtess\sampleCompRight.h
# End Source File
# Begin Source File
SOURCE=.\libnurbs\nurbtess\sampleCompTop.h
# End Source File
# Begin Source File
SOURCE=.\libnurbs\nurbtess\sampledLine.h
# End Source File
# Begin Source File
SOURCE=.\libnurbs\nurbtess\sampleMonoPoly.h
# End Source File
# Begin Source File
SOURCE=.\libnurbs\nurbtess\searchTree.h
# End Source File
# Begin Source File
SOURCE=.\libnurbs\internals\simplemath.h
# End Source File
# Begin Source File
SOURCE=.\libnurbs\internals\slicer.h
# End Source File
# Begin Source File
SOURCE=.\libnurbs\internals\sorter.h
# End Source File
# Begin Source File
SOURCE=.\libnurbs\internals\subdivider.h
# End Source File
# Begin Source File
SOURCE=.\libtess\sweep.h
# End Source File
# Begin Source File
SOURCE=.\libtess\tess.h
# End Source File
# Begin Source File
SOURCE=.\libtess\tessmono.h
# End Source File
# Begin Source File
SOURCE=.\libnurbs\internals\trimline.h
# End Source File
# Begin Source File
SOURCE=.\libnurbs\internals\trimregion.h
# End Source File
# Begin Source File
SOURCE=.\libnurbs\internals\trimvertex.h
# End Source File
# Begin Source File
SOURCE=.\libnurbs\internals\trimvertpool.h
# End Source File
# Begin Source File
SOURCE=.\libnurbs\internals\types.h
# End Source File
# Begin Source File
SOURCE=.\libnurbs\internals\uarray.h
# End Source File
# Begin Source File
SOURCE=.\libnurbs\internals\varray.h
# End Source File
# Begin Source File
SOURCE=.\libnurbs\nurbtess\zlassert.h
# End Source File
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
# End Group
# Begin Source File
SOURCE=.\ccDebug.txt
# End Source File
# Begin Source File
SOURCE=.\ccDebugObj.txt
# End Source File
# Begin Source File
SOURCE=.\ccRelease.txt
# End Source File
# Begin Source File
SOURCE=.\ccReleaseObj.txt
# End Source File
# End Target
# End Project

File diff suppressed because it is too large Load Diff

View File

@@ -1,108 +0,0 @@
# Microsoft Developer Studio Project File - Name="array_cache" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Static Library" 0x0104
CFG=array_cache - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "array_cache.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "array_cache.mak" CFG="array_cache - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "array_cache - Win32 Release" (based on "Win32 (x86) Static Library")
!MESSAGE "array_cache - Win32 Debug" (based on "Win32 (x86) Static Library")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "array_cache - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
# ADD CPP /nologo /W3 /GX /O2 /I "../../../include" /I "../" /I "../main" /I "../glapi" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo
!ELSEIF "$(CFG)" == "array_cache - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../../../include" /I "../" /I "../main" /I "../glapi" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /FR /YX /FD /GZ /c
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo
!ENDIF
# Begin Target
# Name "array_cache - Win32 Release"
# Name "array_cache - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=.\ac_context.c
# End Source File
# Begin Source File
SOURCE=.\ac_import.c
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# Begin Source File
SOURCE=.\ac_context.h
# End Source File
# Begin Source File
SOURCE=.\acache.h
# End Source File
# End Group
# End Target
# End Project

View File

@@ -107,6 +107,7 @@ _mesa_init_driver_functions(struct dd_function_table *driver)
driver->DeleteTexture = _mesa_delete_texture_object;
driver->NewTextureImage = _mesa_new_texture_image;
driver->FreeTexImageData = _mesa_free_texture_image_data;
driver->TextureMemCpy = _mesa_memcpy;
driver->IsTextureResident = NULL;
driver->PrioritizeTexture = NULL;
driver->ActiveTexture = NULL;

View File

@@ -1,4 +1,3 @@
/* $XFree86: xc/lib/GL/mesa/src/drv/common/depthtmp.h,v 1.5 2001/03/21 16:14:20 dawes Exp $ */
/*
* Notes:

View File

@@ -19,7 +19,7 @@ OBJECTS = $(C_SOURCES:.c=.o)
INCLUDES = \
-I$(TOP)/include \
-I$(DRM_SOURCE_PATH)/shared \
-I$(DRM_SOURCE_PATH)/shared-core \
-I$(TOP)/include/GL/internal \
-I$(TOP)/src/mesa \
-I$(TOP)/src/mesa/main \

View File

@@ -202,9 +202,40 @@ fbSetupFramebuffer(fbDisplay *disp, char *fbdev)
strerror(errno));
return EGL_FALSE;
}
if (fixedInfo.visual == FB_VISUAL_DIRECTCOLOR) {
struct fb_cmap cmap;
unsigned short red[256], green[256], blue[256];
int rcols = 1 << varInfo.red.length;
int gcols = 1 << varInfo.green.length;
int bcols = 1 << varInfo.blue.length;
int i;
cmap.start = 0;
cmap.len = gcols;
cmap.red = red;
cmap.green = green;
cmap.blue = blue;
cmap.transp = NULL;
for (i = 0; i < rcols ; i++)
red[i] = (65536/(rcols-1)) * i;
for (i = 0; i < gcols ; i++)
green[i] = (65536/(gcols-1)) * i;
for (i = 0; i < bcols ; i++)
blue[i] = (65536/(bcols-1)) * i;
if (ioctl(fd, FBIOPUTCMAP, (void *) &cmap) < 0) {
fprintf(stderr, "ioctl(FBIOPUTCMAP) failed [%d]\n", i);
exit(1);
}
}
/* mmap the framebuffer into our address space */
disp->pFB = (caddr_t)mmap(0, /* start */
if (!disp->pFB)
disp->pFB = (caddr_t)mmap(0, /* start */
fixedInfo.smem_len, /* bytes */
PROT_READ | PROT_WRITE, /* prot */
MAP_SHARED, /* flags */
@@ -422,7 +453,6 @@ fbCreateContext(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config, EGLContext sh
c->Base.Config = conf;
c->Base.DrawSurface = EGL_NO_SURFACE;
c->Base.ReadSurface = EGL_NO_SURFACE;
printf("fbCreateContext\n");
/* generate handle and insert into hash table */
_eglSaveContext(&c->Base);
@@ -609,7 +639,6 @@ fbMakeCurrent(_EGLDriver *drv, EGLDisplay dpy, EGLSurface draw, EGLSurface read,
} else
_mesa_make_current( NULL, NULL, NULL );
printf("eglMakeCurrent()\n");
return EGL_TRUE;
}
@@ -702,10 +731,11 @@ static EGLBoolean
fbShowSurfaceMESA(_EGLDriver *drv, EGLDisplay dpy, EGLScreenMESA screen,
EGLSurface surface, EGLModeMESA m)
{
FILE *file;
char buffer[NAME_MAX];
fbDisplay *display = Lookup_fbDisplay(dpy);
fbScreen *scrn = Lookup_fbScreen(dpy, screen);
fbSurface *surf = Lookup_fbSurface(surface);
FILE *file;
char buffer[NAME_MAX];
_EGLMode *mode = _eglLookupMode(dpy, m);
int bits;
@@ -745,6 +775,8 @@ err:
fputs(buffer, file);
fclose(file);
fbSetupFramebuffer(display, scrn->fb);
snprintf(buffer, sizeof(buffer), "%s/%s/blank", sysfs, scrn->fb);
file = fopen(buffer, "r+");

View File

@@ -405,28 +405,30 @@ intelFillInModes( unsigned pixel_bits, unsigned depth_bits,
GLenum fb_format;
GLenum fb_type;
/* GLX_SWAP_COPY_OML is only supported because the MGA driver doesn't
/* GLX_SWAP_COPY_OML is only supported because the Intel driver doesn't
* support pageflipping at all.
*/
static const GLenum back_buffer_modes[] = {
GLX_NONE, GLX_SWAP_UNDEFINED_OML, GLX_SWAP_COPY_OML
};
u_int8_t depth_bits_array[2];
u_int8_t stencil_bits_array[2];
u_int8_t depth_bits_array[3];
u_int8_t stencil_bits_array[3];
depth_bits_array[0] = 0;
depth_bits_array[1] = depth_bits;
depth_bits_array[2] = depth_bits;
/* Just like with the accumulation buffer, always provide some modes
* with a stencil buffer. It will be a sw fallback, but some apps won't
* care about that.
*/
stencil_bits_array[0] = 0;
stencil_bits_array[1] = (stencil_bits == 0) ? 8 : stencil_bits;
stencil_bits_array[1] = 0;
stencil_bits_array[2] = (stencil_bits == 0) ? 8 : stencil_bits;
depth_buffer_factor = ((depth_bits != 0) || (stencil_bits != 0)) ? 2 : 1;
depth_buffer_factor = ((depth_bits != 0) || (stencil_bits != 0)) ? 3 : 1;
back_buffer_factor = (have_back_buffer) ? 3 : 1;
num_modes = depth_buffer_factor * back_buffer_factor * 4;

View File

@@ -37,6 +37,7 @@ DRIVER_SOURCES = \
r300_texstate.c \
r300_texprog.c \
r300_vertexprog.c \
r300_fragprog.c \
r300_shader.c \
r300_maos.c
# \

View File

@@ -73,14 +73,17 @@ static const char *const card_extensions[] = {
"GL_ARB_multitexture",
"GL_ARB_texture_border_clamp",
"GL_ARB_texture_compression",
"GL_ARB_texture_cube_map",
/* disable until we support it, fixes a few things in ut2004 */
// "GL_ARB_texture_cube_map",
"GL_ARB_texture_env_add",
"GL_ARB_texture_env_combine",
"GL_ARB_texture_env_dot3",
"GL_ARB_texture_mirrored_repeat",
"GL_ARB_vertex_buffer_object",
"GL_ARB_vertex_program",
//"GL_ARB_fragment_program",
#if USE_ARB_F_P == 1
"GL_ARB_fragment_program",
#endif
"GL_EXT_blend_equation_separate",
"GL_EXT_blend_func_separate",
"GL_EXT_blend_minmax",
@@ -101,6 +104,7 @@ static const char *const card_extensions[] = {
"GL_NV_blend_square",
"GL_NV_vertex_program",
"GL_SGIS_generate_mipmap",
"GL_ARB_texture_env_crossbar",
NULL
};
@@ -325,7 +329,20 @@ GLboolean r300CreateContext(const __GLcontextModes * glVisual,
ctx->Const.MaxVertexProgramLocalParams=256; // r420
ctx->Const.MaxVertexProgramEnvParams=256; // r420
ctx->Const.MaxVertexProgramAddressRegs=1;
#if USE_ARB_F_P
ctx->Const.MaxFragmentProgramTemps = PFS_NUM_TEMP_REGS;
ctx->Const.MaxFragmentProgramAttribs = 11; /* copy i915... */
ctx->Const.MaxFragmentProgramLocalParams = PFS_NUM_CONST_REGS;
ctx->Const.MaxFragmentProgramEnvParams = PFS_NUM_CONST_REGS;
ctx->Const.MaxFragmentProgramAluInstructions = PFS_MAX_ALU_INST;
ctx->Const.MaxFragmentProgramTexInstructions = PFS_MAX_TEX_INST;
ctx->Const.MaxFragmentProgramInstructions = PFS_MAX_ALU_INST+PFS_MAX_TEX_INST;
ctx->Const.MaxFragmentProgramTexIndirections = PFS_MAX_TEX_INDIRECT;
ctx->Const.MaxFragmentProgramAddressRegs = 0; /* and these are?? */
ctx->_MaintainTexEnvProgram = GL_TRUE;
#endif
driInitExtensions(ctx, card_extensions, GL_TRUE);
radeonInitSpanFuncs(ctx);

View File

@@ -47,6 +47,8 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "colormac.h"
#include "radeon_context.h"
#define USE_ARB_F_P 1
struct r300_context;
typedef struct r300_context r300ContextRec;
typedef struct r300_context *r300ContextPtr;
@@ -83,7 +85,11 @@ typedef GLubyte uint8_t;
and pixel_shader structure later on */
#define CARD32 GLuint
#include "vertex_shader.h"
#if USE_ARB_F_P == 1
#include "r300_fragprog.h"
#else
#include "pixel_shader.h"
#endif
#undef CARD32
static __inline__ uint32_t r300PackFloat32(float fl)
@@ -588,6 +594,72 @@ struct r300_vertex_program {
int tex_regs[8];
};
#if USE_ARB_F_P == 1
#define PFS_MAX_ALU_INST 64
#define PFS_MAX_TEX_INST 64
#define PFS_MAX_TEX_INDIRECT 4
#define PFS_NUM_TEMP_REGS 32
#define PFS_NUM_CONST_REGS 32
struct r300_fragment_program {
struct fragment_program mesa_program;
GLcontext *ctx;
GLboolean translated;
GLboolean error;
struct {
int length;
GLuint inst[PFS_MAX_TEX_INST];
} tex;
struct {
struct {
GLuint inst0;
GLuint inst1;
GLuint inst2;
GLuint inst3;
} inst[PFS_MAX_ALU_INST];
} alu;
int v_pos;
int s_pos;
struct {
int tex_offset;
int tex_end;
int alu_offset;
int alu_end;
} node[4];
int cur_node;
int first_node_has_tex;
int alu_offset;
int alu_end;
int tex_offset;
int tex_end;
/* Hardware constants */
GLfloat constant[PFS_NUM_CONST_REGS][4];
int const_nr;
/* Tracked parameters */
struct {
int idx; /* hardware index */
GLfloat *values; /* pointer to values */
} param[PFS_NUM_CONST_REGS];
int param_nr;
GLboolean params_uptodate;
GLuint temps[PFS_NUM_TEMP_REGS];
int temp_in_use;
GLuint used_in_node;
GLuint dest_in_node;
GLuint inputs[32]; /* don't actually need 32... */
int hwreg_in_use;
int max_temp_idx;
};
#else
/* 64 appears to be the maximum */
#define PSF_MAX_PROGRAM_LENGTH 64
@@ -652,6 +724,7 @@ struct r300_pixel_shader_state {
float w;
} param[MAX_PIXEL_SHADER_PARAMS];
};
#endif // USE_ARB_F_P
/* 8 is somewhat bogus... it is probably something like 24 */
#define R300_MAX_AOS_ARRAYS 8
@@ -682,8 +755,9 @@ struct r300_state {
struct r300_texture_state texture;
struct r300_vap_reg_state vap_reg;
struct r300_vertex_shader_state vertex_shader;
#if USE_ARB_F_P == 0
struct r300_pixel_shader_state pixel_shader;
#endif
struct r300_dma_region aos[R300_MAX_AOS_ARRAYS];
int aos_count;

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,50 @@
#ifndef __R300_FRAGPROG_H_
#define __R300_FRAGPROG_H_
#include "glheader.h"
#include "macros.h"
#include "enums.h"
#include "program.h"
#include "r300_context.h"
#include "nvfragprog.h"
/* representation of a register for emit_arith/swizzle */
typedef struct _pfs_reg_t {
enum {
REG_TYPE_INPUT,
REG_TYPE_OUTPUT,
REG_TYPE_TEMP,
REG_TYPE_CONST
} type:2;
GLuint index:6;
GLuint v_swz:5;
GLuint s_swz:5;
GLboolean vcross:1;
GLboolean scross:1;
GLuint negate:1; //XXX: we need to handle negate individually
GLboolean has_w:1;
GLboolean valid:1;
} pfs_reg_t;
/* supported hw opcodes */
#define PFS_OP_MAD 0
#define PFS_OP_DP3 1
#define PFS_OP_DP4 2
#define PFS_OP_MIN 3
#define PFS_OP_MAX 4
#define PFS_OP_CMP 5
#define PFS_OP_FRC 6
#define PFS_OP_EX2 7
#define PFS_OP_LG2 8
#define PFS_OP_RCP 9
#define PFS_OP_RSQ 10
#define PFS_OP_REPL_ALPHA 11
#define MAX_PFS_OP 11
#define OP(n) PFS_OP_##n
#define PFS_FLAG_SAT (1 << 0)
#define PFS_FLAG_ABS (1 << 1)
#endif

File diff suppressed because it is too large Load Diff

View File

@@ -823,6 +823,13 @@ I am fairly certain that they are correct unless stated otherwise in comments.
# define R300_FPITX_DST_MASK (31 << 6)
# define R300_FPITX_IMAGE_SHIFT 11
# define R300_FPITX_IMAGE_MASK (15 << 11) /* GUESS based on layout and native limits */
/* Unsure if these are opcodes, or some kind of bitfield, but this is how
* they were set when I checked
*/
# define R300_FPITX_OPCODE_SHIFT 15
# define R300_FPITX_OP_TEX 1
# define R300_FPITX_OP_TXP 3
# define R300_FPITX_OP_TXB 4
/* ALU
// The ALU instructions register blocks are enumerated according to the order
@@ -993,17 +1000,20 @@ I am fairly certain that they are correct unless stated otherwise in comments.
# define R300_FPI2_ARG0A_SHIFT 0
# define R300_FPI2_ARG0A_MASK (31 << 0)
# define R300_FPI2_ARG0A_NEG (1 << 5)
# define R300_FPI2_ARG0A_ABS (1 << 6) /* GUESS */
# define R300_FPI2_ARG1A_SHIFT 7
# define R300_FPI2_ARG1A_MASK (31 << 7)
# define R300_FPI2_ARG1A_NEG (1 << 12)
# define R300_FPI2_ARG1A_ABS (1 << 13) /* GUESS */
# define R300_FPI2_ARG2A_SHIFT 14
# define R300_FPI2_AEG2A_MASK (31 << 14)
# define R300_FPI2_ARG2A_MASK (31 << 14)
# define R300_FPI2_ARG2A_NEG (1 << 19)
# define R300_FPI2_ARG2A_ABS (1 << 20) /* GUESS */
# define R300_FPI2_SPECIAL_LRP (1 << 21)
# define R300_FPI2_OUTA_MAD (0 << 23)
# define R300_FPI2_OUTA_DP4 (1 << 23)
# define R300_RPI2_OUTA_MIN (2 << 23)
# define R300_RPI2_OUTA_MAX (3 << 23)
# define R300_FPI2_OUTA_MIN (2 << 23)
# define R300_FPI2_OUTA_MAX (3 << 23)
# define R300_FPI2_OUTA_CMP (6 << 23)
# define R300_FPI2_OUTA_FRC (7 << 23)
# define R300_FPI2_OUTA_EX2 (8 << 23)

View File

@@ -5,6 +5,9 @@
#include "program.h"
#include "r300_context.h"
#include "nvvertprog.h"
#if USE_ARB_F_P == 1
#include "r300_fragprog.h"
#endif
static void r300BindProgram(GLcontext *ctx, GLenum target, struct program *prog)
{
@@ -13,6 +16,9 @@ static void r300BindProgram(GLcontext *ctx, GLenum target, struct program *prog)
switch(target){
case GL_VERTEX_PROGRAM_ARB:
#if USE_ARB_F_P == 1
case GL_FRAGMENT_PROGRAM_ARB:
#endif
//rmesa->current_vp = vp;
break;
default:
@@ -24,7 +30,11 @@ static void r300BindProgram(GLcontext *ctx, GLenum target, struct program *prog)
static struct program *r300NewProgram(GLcontext *ctx, GLenum target, GLuint id)
{
struct r300_vertex_program *vp;
#if USE_ARB_F_P == 1
struct r300_fragment_program *fp;
#else
struct fragment_program *fp;
#endif
struct ati_fragment_shader *afs;
switch(target){
@@ -33,9 +43,14 @@ static struct program *r300NewProgram(GLcontext *ctx, GLenum target, GLuint id)
return _mesa_init_vertex_program(ctx, &vp->mesa_program, target, id);
case GL_FRAGMENT_PROGRAM_ARB:
#if USE_ARB_F_P == 1
fp=CALLOC_STRUCT(r300_fragment_program);
fp->ctx = ctx;
return _mesa_init_fragment_program(ctx, &fp->mesa_program, target, id);
#else
fp=CALLOC_STRUCT(fragment_program);
return _mesa_init_fragment_program(ctx, fp, target, id);
#endif
case GL_FRAGMENT_PROGRAM_NV:
fp=CALLOC_STRUCT(fragment_program);
return _mesa_init_fragment_program(ctx, fp, target, id);
@@ -64,15 +79,20 @@ void r300ProgramStringNotify(GLcontext *ctx, GLenum target,
struct program *prog)
{
struct r300_vertex_program *vp=(void *)prog;
#if USE_ARB_F_P == 1
struct r300_fragment_program *fp=(void *)prog;
#endif
switch(target) {
case GL_VERTEX_PROGRAM_ARB:
/*vp->translated=GL_FALSE;
translate_vertex_shader(vp);*/
//debug_vp(ctx, vp);
break;
case GL_FRAGMENT_PROGRAM_ARB:
#if USE_ARB_F_P == 1
fp->translated = GL_FALSE;
#endif
break;
}
}

View File

@@ -58,10 +58,14 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "r300_reg.h"
#include "r300_program.h"
#include "r300_emit.h"
#if USE_ARB_F_P == 1
#include "r300_fragprog.h"
#else
#include "r300_fixed_pipelines.h"
#include "r300_texprog.h"
#endif
#include "r300_tex.h"
#include "r300_maos.h"
#include "r300_texprog.h"
static void r300AlphaFunc(GLcontext * ctx, GLenum func, GLfloat ref)
{
@@ -1094,6 +1098,99 @@ void r300_setup_textures(GLcontext *ctx)
fprintf(stderr, "TX_ENABLE: %08x max_texture_unit=%d\n", r300->hw.txe.cmd[R300_TXE_ENABLE], max_texture_unit);
}
#if USE_ARB_F_P == 1
void r300_setup_rs_unit(GLcontext *ctx)
{
r300ContextPtr r300 = R300_CONTEXT(ctx);
int i, vp_reg, fp_reg, in_texcoords;
/* I'm still unsure if these are needed */
GLuint interp_magic[8] = {
0x00,
0x40,
0x80,
0xC0,
0x00,
0x00,
0x00,
0x00
};
GLuint OutputsWritten;
GLuint InputsRead;
if(hw_tcl_on)
OutputsWritten = CURRENT_VERTEX_SHADER(ctx)->OutputsWritten;
else
OutputsWritten = r300->state.render_inputs;
if (ctx->FragmentProgram._Current)
InputsRead = ctx->FragmentProgram._Current->InputsRead;
else {
fprintf(stderr, "No ctx->FragmentProgram._Current!!\n");
return; /* This should only ever happen once.. */
}
/* This needs to be rewritten - it is a hack at best */
R300_STATECHANGE(r300, ri);
R300_STATECHANGE(r300, rc);
R300_STATECHANGE(r300, rr);
vp_reg = fp_reg = in_texcoords = 0;
r300->hw.rr.cmd[R300_RR_ROUTE_0] = 0;
for (i=0;i<ctx->Const.MaxTextureUnits;i++) {
if (OutputsWritten & (hw_tcl_on ? (1 << (VERT_RESULT_TEX0+i)) : (_TNL_BIT_TEX0<<i)))
in_texcoords++;
r300->hw.ri.cmd[R300_RI_INTERP_0+i] = 0
| R300_RS_INTERP_USED
| (vp_reg << R300_RS_INTERP_SRC_SHIFT)
| interp_magic[i];
if (InputsRead & (FRAG_BIT_TEX0<<i)) {
assert(r300->state.texture.tc_count != 0);
r300->hw.rr.cmd[R300_RR_ROUTE_0 + fp_reg] = 0
| R300_RS_ROUTE_ENABLE
| i /* source INTERP */
| (fp_reg << R300_RS_ROUTE_DEST_SHIFT);
if (OutputsWritten & (hw_tcl_on ? (1 << (VERT_RESULT_TEX0+i)) : (_TNL_BIT_TEX0<<i))) {
vp_reg++;
} else {
/* Unsure of how to handle this situation, for now print errors and
* the program will just recieve bogus data
*/
fprintf(stderr, "fragprog wants coords for tex%d, vp doesn't provide them!\n", i);
}
InputsRead &= ~(FRAG_BIT_TEX0<<i);
fp_reg++;
}
}
if (InputsRead & FRAG_BIT_COL0) {
if (!(OutputsWritten & (hw_tcl_on ? (1<<VERT_RESULT_COL0) : _TNL_BIT_COLOR0)))
fprintf(stderr, "fragprog wants col0, vp doesn't provide it\n");
r300->hw.rr.cmd[R300_RR_ROUTE_0] |= 0
| R300_RS_ROUTE_0_COLOR
| (fp_reg << R300_RS_ROUTE_0_COLOR_DEST_SHIFT);
InputsRead &= ~FRAG_BIT_COL0;
}
r300->hw.rc.cmd[1] = 0
| (in_texcoords << R300_RS_CNTL_TC_CNT_SHIFT)
| R300_RS_CNTL_0_UNKNOWN_7
| R300_RS_CNTL_0_UNKNOWN_18;
if (r300->state.texture.tc_count > 0) {
r300->hw.rr.cmd[R300_RR_CMD_0] = cmducs(R300_RS_ROUTE_0, fp_reg);
r300->hw.rc.cmd[2] = 0xC0 | (fp_reg-1); /* index of highest RS_ROUTE used*/
} else {
r300->hw.rr.cmd[R300_RR_CMD_0] = cmducs(R300_RS_ROUTE_0, 1);
r300->hw.rc.cmd[2] = 0x0;
}
if (InputsRead)
WARN_ONCE("Don't know how to satisfy InputsRead=0x%08x\n", InputsRead);
}
#else
void r300_setup_rs_unit(GLcontext *ctx)
{
r300ContextPtr r300 = R300_CONTEXT(ctx);
@@ -1120,7 +1217,6 @@ void r300_setup_rs_unit(GLcontext *ctx)
R300_STATECHANGE(r300, rc);
R300_STATECHANGE(r300, rr);
#if 1
cur_reg = 0;
r300->hw.rr.cmd[R300_RR_ROUTE_0] = 0;
@@ -1163,48 +1259,8 @@ void r300_setup_rs_unit(GLcontext *ctx)
// fprintf(stderr, "rendering with %d texture co-ordinate sets\n", cur_reg);
#else
for(i = 1; i <= 8; ++i)
r300->hw.ri.cmd[i] = 0x00d10000;
r300->hw.ri.cmd[R300_RI_INTERP_1] |= R300_RS_INTERP_1_UNKNOWN;
r300->hw.ri.cmd[R300_RI_INTERP_2] |= R300_RS_INTERP_2_UNKNOWN;
r300->hw.ri.cmd[R300_RI_INTERP_3] |= R300_RS_INTERP_3_UNKNOWN;
#if 1
for(i = 2; i <= 8; ++i)
r300->hw.ri.cmd[i] |= 4;
#endif
for(i = 1; i <= 8; ++i)
r300->hw.rr.cmd[i] = 0;
/* textures enabled ? */
if(r300->state.texture.tc_count>0){
/* This code only really works with one set of texture coordinates */
/* The second constant is needed to get glxgears display anything .. */
r300->hw.rc.cmd[1] = R300_RS_CNTL_0_UNKNOWN_7
| R300_RS_CNTL_0_UNKNOWN_18
| (r300->state.texture.tc_count<<R300_RS_CNTL_TC_CNT_SHIFT);
r300->hw.rc.cmd[2] = 0xc0;
((drm_r300_cmd_header_t*)r300->hw.rr.cmd)->unchecked_state.count = 1;
r300->hw.rr.cmd[R300_RR_ROUTE_0] = 0x24008;
} else {
/* The second constant is needed to get glxgears display anything .. */
r300->hw.rc.cmd[1] = R300_RS_CNTL_0_UNKNOWN_7 | R300_RS_CNTL_0_UNKNOWN_18;
r300->hw.rc.cmd[2] = 0;
((drm_r300_cmd_header_t*)r300->hw.rr.cmd)->unchecked_state.count = 1;
r300->hw.rr.cmd[R300_RR_ROUTE_0] = 0x4000;
}
#endif
}
#endif // USE_ARB_F_P
#define vpucount(ptr) (((drm_r300_cmd_header_t*)(ptr))->vpu.count)
@@ -1477,7 +1533,107 @@ void r300SetupVertexProgram(r300ContextPtr rmesa)
#endif
}
/* This is probably wrong for some values, I need to test this
* some more. Range checking would be a good idea also..
*
* But it works for most things. I'll fix it later if someone
* else with a better clue doesn't
*/
unsigned int r300PackFloat24(float f)
{
float mantissa;
int exponent;
unsigned int float24 = 0;
if (f == 0.0) return 0;
mantissa = frexpf(f, &exponent);
/* Handle -ve */
if (mantissa < 0) {
float24 |= (1<<23);
mantissa = mantissa * -1.0;
}
/* Handle exponent, bias of 63 */
exponent += 62;
float24 |= (exponent << 16);
/* Kill 7 LSB of mantissa */
float24 |= (r300PackFloat32(mantissa) & 0x7FFFFF) >> 7;
return float24;
}
#if USE_ARB_F_P == 1
void r300SetupPixelShader(r300ContextPtr rmesa)
{
GLcontext *ctx = rmesa->radeon.glCtx;
struct r300_fragment_program *rp = ctx->FragmentProgram._Current;
int i,k;
if (!rp) /* should only happenen once, just after context is created */
return;
translate_fragment_shader(ctx->FragmentProgram._Current);
if (!rp->translated) {
fprintf(stderr, "%s: No valid fragment shader, exiting\n", __func__);
exit(-1);
}
R300_STATECHANGE(rmesa, fpt);
for(i=0;i<rp->tex.length;i++)
rmesa->hw.fpt.cmd[R300_FPT_INSTR_0+i]=rp->tex.inst[i];
rmesa->hw.fpt.cmd[R300_FPT_CMD_0]=cmducs(R300_PFS_TEXI_0, rp->tex.length);
#define OUTPUT_FIELD(st, reg, field) \
R300_STATECHANGE(rmesa, st); \
for(i=0;i<=rp->alu_end;i++) \
rmesa->hw.st.cmd[R300_FPI_INSTR_0+i]=rp->alu.inst[i].field;\
rmesa->hw.st.cmd[R300_FPI_CMD_0]=cmducs(reg, rp->alu_end+1);
OUTPUT_FIELD(fpi[0], R300_PFS_INSTR0_0, inst0);
OUTPUT_FIELD(fpi[1], R300_PFS_INSTR1_0, inst1);
OUTPUT_FIELD(fpi[2], R300_PFS_INSTR2_0, inst2);
OUTPUT_FIELD(fpi[3], R300_PFS_INSTR3_0, inst3);
#undef OUTPUT_FIELD
R300_STATECHANGE(rmesa, fp);
/* I just want to say, the way these nodes are stored.. weird.. */
for (i=0,k=(4-(rp->cur_node+1));i<4;i++,k++) {
if (i<(rp->cur_node+1)) {
rmesa->hw.fp.cmd[R300_FP_NODE0+k]=
(rp->node[i].alu_offset << R300_PFS_NODE_ALU_OFFSET_SHIFT)
| (rp->node[i].alu_end << R300_PFS_NODE_ALU_END_SHIFT)
| (rp->node[i].tex_offset << R300_PFS_NODE_TEX_OFFSET_SHIFT)
| (rp->node[i].tex_end << R300_PFS_NODE_TEX_END_SHIFT)
| ( (k==3) ? R300_PFS_NODE_LAST_NODE : 0);
} else {
rmesa->hw.fp.cmd[R300_FP_NODE0+(3-i)] = 0;
}
}
/* PFS_CNTL_0 */
rmesa->hw.fp.cmd[R300_FP_CNTL0]=
rp->cur_node
| (rp->first_node_has_tex<<3);
/* PFS_CNTL_1 */
rmesa->hw.fp.cmd[R300_FP_CNTL1]=rp->max_temp_idx;
/* PFS_CNTL_2 */
rmesa->hw.fp.cmd[R300_FP_CNTL2]=
(rp->alu_offset << R300_PFS_CNTL_ALU_OFFSET_SHIFT)
| (rp->alu_end << R300_PFS_CNTL_ALU_END_SHIFT)
| (rp->tex_offset << R300_PFS_CNTL_TEX_OFFSET_SHIFT)
| (rp->tex_end << R300_PFS_CNTL_TEX_END_SHIFT);
R300_STATECHANGE(rmesa, fpp);
for(i=0;i<rp->const_nr;i++){
rmesa->hw.fpp.cmd[R300_FPP_PARAM_0+4*i+0]=r300PackFloat24(rp->constant[i][0]);
rmesa->hw.fpp.cmd[R300_FPP_PARAM_0+4*i+1]=r300PackFloat24(rp->constant[i][1]);
rmesa->hw.fpp.cmd[R300_FPP_PARAM_0+4*i+2]=r300PackFloat24(rp->constant[i][2]);
rmesa->hw.fpp.cmd[R300_FPP_PARAM_0+4*i+3]=r300PackFloat24(rp->constant[i][3]);
}
rmesa->hw.fpp.cmd[R300_FPP_CMD_0]=cmducs(R300_PFS_PARAM_0_X, rp->const_nr*4);
}
#else
/* just a skeleton for now.. */
void r300GenerateTexturePixelShader(r300ContextPtr r300)
{
@@ -1652,6 +1808,7 @@ int i,k;
rmesa->hw.fpp.cmd[R300_FPP_CMD_0]=cmducs(R300_PFS_PARAM_0_X, rmesa->state.pixel_shader.param_length);
}
#endif
/**
* Called by Mesa after an internal state update.
@@ -1659,7 +1816,7 @@ int i,k;
static void r300InvalidateState(GLcontext * ctx, GLuint new_state)
{
r300ContextPtr r300 = R300_CONTEXT(ctx);
_swrast_InvalidateState(ctx, new_state);
_swsetup_InvalidateState(ctx, new_state);
_ac_InvalidateState(ctx, new_state);
@@ -2118,3 +2275,4 @@ void r300InitStateFuncs(struct dd_function_table* functions)
functions->PolygonOffset = r300PolygonOffset;
functions->PolygonMode = r300PolygonMode;
}

View File

@@ -17,6 +17,7 @@
#include "radeon_ioctl.h"
#include "radeon_state.h"
#include "r300_context.h"
#if USE_ARB_F_P == 0
#include "r300_ioctl.h"
#include "r300_state.h"
#include "r300_reg.h"
@@ -265,4 +266,5 @@ void r300GenerateTextureFragmentShader(r300ContextPtr r300)
p->alu_end = ps->program.alu.length - 1;
p->alu_offset = 0;
}
#endif // USE_ARB_F_P == 0

View File

@@ -12,6 +12,7 @@ DRIVER_SOURCES = \
via_fb.c \
via_tex.c \
via_ioctl.c \
via_memcpy.c \
via_render.c \
via_screen.c \
via_span.c \

View File

@@ -60,7 +60,7 @@
#include <stdio.h>
#include "macros.h"
#define DRIVER_DATE "20041215"
#define DRIVER_DATE "20050526"
#include "vblank.h"
#include "utils.h"
@@ -627,9 +627,9 @@ void viaXMesaWindowMoved(struct via_context *vmesa)
if (!dPriv)
return;
switch (vmesa->glCtx->DrawBuffer->_ColorDrawBufferMask[0]) {
case BUFFER_BIT_FRONT_LEFT:
case BUFFER_BIT_BACK_LEFT:
if (dPriv->numBackClipRects == 0) {
vmesa->numClipRects = dPriv->numClipRects;
vmesa->pClipRects = dPriv->pClipRects;
@@ -639,7 +639,7 @@ void viaXMesaWindowMoved(struct via_context *vmesa)
vmesa->pClipRects = dPriv->pBackClipRects;
}
break;
case BUFFER_BIT_BACK_LEFT:
case BUFFER_BIT_FRONT_LEFT:
vmesa->numClipRects = dPriv->numClipRects;
vmesa->pClipRects = dPriv->pClipRects;
break;
@@ -703,13 +703,15 @@ viaMakeCurrent(__DRIcontextPrivate *driContextPriv,
if ( ! calculate_buffer_parameters( vmesa ) ) {
return GL_FALSE;
}
ctx->Driver.DrawBuffer( ctx, ctx->Color.DrawBuffer[0] );
}
_mesa_make_current(vmesa->glCtx,
(GLframebuffer *)driDrawPriv->driverPrivate,
(GLframebuffer *)driReadPriv->driverPrivate);
ctx->Driver.DrawBuffer( ctx, ctx->Color.DrawBuffer[0] );
viaXMesaWindowMoved(vmesa);
ctx->Driver.Scissor(vmesa->glCtx,
vmesa->glCtx->Scissor.X,
@@ -740,6 +742,7 @@ void viaGetLock(struct via_context *vmesa, GLuint flags)
if (vmesa->lastStamp != dPriv->lastStamp) {
viaXMesaWindowMoved(vmesa);
vmesa->newEmitState = ~0;
vmesa->lastStamp = dPriv->lastStamp;
}
@@ -763,8 +766,9 @@ viaSwapBuffers(__DRIdrawablePrivate *drawablePrivate)
(struct via_context *)dPriv->driContextPriv->driverPrivate;
GLcontext *ctx = vmesa->glCtx;
_mesa_notifySwapBuffers(ctx);
if (ctx->Visual.doubleBufferMode) {
_mesa_notifySwapBuffers(ctx);
if (vmesa->doPageFlip) {
viaPageFlip(dPriv);
}

View File

@@ -63,7 +63,7 @@ enum VIACHIPTAGS {
#define VIA_FALLBACK_BLEND_FUNC 0x400
#define VIA_FALLBACK_USER_DISABLE 0x800
#define VIA_FALLBACK_PROJ_TEXTURE 0x1000
#define VIA_FALLBACK_STIPPLE 0x2000
#define VIA_FALLBACK_POLY_STIPPLE 0x2000
#define VIA_DMA_BUFSIZ 4096
#define VIA_DMA_HIGHWATER (VIA_DMA_BUFSIZ - 128)
@@ -184,6 +184,7 @@ struct via_context {
GLmatrix ViewportMatrix;
GLenum renderPrimitive;
GLenum hwPrimitive;
GLenum hwShadeModel;
unsigned char *verts;
/* drmBufPtr dma_buffer;

View File

@@ -0,0 +1,138 @@
/*
* Copyright (C) 2004 Thomas Hellstrom, 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, sub license,
* 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 (including the
* next paragraph) 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 NON-INFRINGEMENT. IN NO EVENT SHALL
* THE CODE SUPPLIER(S) 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.
*/
/* Thomas' orginal gutted for mesa by Keith Whitwell
*/
#include "via_tex.h"
#if defined( USE_SSE_ASM )
#define SSE_PREFETCH " prefetchnta "
#define FENCE __asm__ __volatile__ ("sfence":::"memory");
#define PREFETCH1(arch_prefetch,from) \
__asm__ __volatile__ ( \
"1: " arch_prefetch "(%0)\n" \
arch_prefetch "32(%0)\n" \
arch_prefetch "64(%0)\n" \
arch_prefetch "96(%0)\n" \
arch_prefetch "128(%0)\n" \
arch_prefetch "160(%0)\n" \
arch_prefetch "192(%0)\n" \
arch_prefetch "256(%0)\n" \
arch_prefetch "288(%0)\n" \
"2:\n" \
: : "r" (from) );
#define small_memcpy(to,from,n) \
{ \
__asm__ __volatile__( \
"movl %2,%%ecx\n\t" \
"sarl $2,%%ecx\n\t" \
"rep ; movsl\n\t" \
"testb $2,%b2\n\t" \
"je 1f\n\t" \
"movsw\n" \
"1:\ttestb $1,%b2\n\t" \
"je 2f\n\t" \
"movsb\n" \
"2:" \
:"=&D" (to), "=&S" (from) \
:"q" (n),"0" ((long) to),"1" ((long) from) \
: "%ecx","memory"); \
}
#define SSE_CPY(prefetch,from,to,dummy,lcnt) \
if ((unsigned long) from & 15) { \
__asm__ __volatile__ ( \
"1:\n" \
prefetch "320(%1)\n" \
" movups (%1), %%xmm0\n" \
" movups 16(%1), %%xmm1\n" \
" movntps %%xmm0, (%0)\n" \
" movntps %%xmm1, 16(%0)\n" \
prefetch "352(%1)\n" \
" movups 32(%1), %%xmm2\n" \
" movups 48(%1), %%xmm3\n" \
" movntps %%xmm2, 32(%0)\n" \
" movntps %%xmm3, 48(%0)\n" \
" addl $64,%0\n" \
" addl $64,%1\n" \
" decl %2\n" \
" jne 1b\n" \
:"=&D"(to), "=&S"(from), "=&r"(dummy) \
:"0" (to), "1" (from), "2" (lcnt): "memory"); \
} else { \
__asm__ __volatile__ ( \
"2:\n" \
prefetch "320(%1)\n" \
" movaps (%1), %%xmm0\n" \
" movaps 16(%1), %%xmm1\n" \
" movntps %%xmm0, (%0)\n" \
" movntps %%xmm1, 16(%0)\n" \
prefetch "352(%1)\n" \
" movaps 32(%1), %%xmm2\n" \
" movaps 48(%1), %%xmm3\n" \
" movntps %%xmm2, 32(%0)\n" \
" movntps %%xmm3, 48(%0)\n" \
" addl $64,%0\n" \
" addl $64,%1\n" \
" decl %2\n" \
" jne 2b\n" \
:"=&D"(to), "=&S"(from), "=&r"(dummy) \
:"0" (to), "1" (from), "2" (lcnt): "memory"); \
}
/*
*/
void via_sse_memcpy(void *to,
const void *from,
size_t sz)
{
int dummy;
int lcnt = sz >> 6;
int rest = sz & 63;
PREFETCH1(SSE_PREFETCH,from);
if (lcnt > 5) {
lcnt -= 5;
SSE_CPY(SSE_PREFETCH,from,to,dummy,lcnt);
lcnt = 5;
}
if (lcnt) {
SSE_CPY("#",from,to,dummy,lcnt);
}
if (rest) small_memcpy(to, from, rest);
FENCE;
}
#endif /* defined( USE_SSE_ASM ) */

View File

@@ -292,15 +292,13 @@ viaCreateBuffer(__DRIscreenPrivate *driScrnPriv,
_mesa_add_renderbuffer(fb, BUFFER_DEPTH, &depthRb->Base);
}
/* no h/w stencil?
if (mesaVis->stencilBits > 0 && !swStencil) {
driRenderbuffer *stencilRb
= driNewRenderbuffer(GL_STENCIL_INDEX8_EXT, screen->cpp,
screen->depthOffset, screen->depthPitch);
= driNewRenderbuffer(GL_STENCIL_INDEX8_EXT, screen->bytesPerPixel,
0, screen->width);
viaSetSpanFunctions(stencilRb, mesaVis);
_mesa_add_renderbuffer(fb, BUFFER_STENCIL, &stencilRb->Base);
}
*/
_mesa_add_soft_renderbuffers(fb,
GL_FALSE, /* color */

View File

@@ -470,52 +470,42 @@ void viaEmitState(struct via_context *vmesa)
}
}
#if 0
/* Polygon stipple is broken - for certain stipple values,
* eg. 0xf0f0f0f0, the hardware will refuse to accept the stipple.
* Coincidentally, conform generates just such a stipple.
*/
if (ctx->Polygon.StippleFlag) {
GLuint *stipple = &ctx->PolygonStipple[0];
GLint i;
BEGIN_RING(38);
OUT_RING( HC_HEADER2 );
OUT_RING( ((HC_ParaType_Palette << 16) | (HC_SubType_Stipple << 24)) );
OUT_RING( stipple[31] );
OUT_RING( stipple[30] );
OUT_RING( stipple[29] );
OUT_RING( stipple[28] );
OUT_RING( stipple[27] );
OUT_RING( stipple[26] );
OUT_RING( stipple[25] );
OUT_RING( stipple[24] );
OUT_RING( stipple[23] );
OUT_RING( stipple[22] );
OUT_RING( stipple[21] );
OUT_RING( stipple[20] );
OUT_RING( stipple[19] );
OUT_RING( stipple[18] );
OUT_RING( stipple[17] );
OUT_RING( stipple[16] );
OUT_RING( stipple[15] );
OUT_RING( stipple[14] );
OUT_RING( stipple[13] );
OUT_RING( stipple[12] );
OUT_RING( stipple[11] );
OUT_RING( stipple[10] );
OUT_RING( stipple[9] );
OUT_RING( stipple[8] );
OUT_RING( stipple[7] );
OUT_RING( stipple[6] );
OUT_RING( stipple[5] );
OUT_RING( stipple[4] );
OUT_RING( stipple[3] );
OUT_RING( stipple[2] );
OUT_RING( stipple[1] );
OUT_RING( stipple[0] );
for (i = 31; i >= 0; i--) {
GLint j;
GLuint k = 0;
/* Need to flip bits left to right:
*/
for (j = 0 ; j < 32; j++)
if (stipple[i] & (1<<j))
k |= 1 << (31-j);
OUT_RING( k );
}
OUT_RING( HC_HEADER2 );
OUT_RING( (HC_ParaType_NotTex << 16) );
OUT_RING( (HC_SubA_HSPXYOS << 24) |
(((31 - vmesa->drawX) & 0x1f) << HC_HSPXOS_SHIFT));
(((32- vmesa->drawXoff) & 0x1f) << HC_HSPXOS_SHIFT));
OUT_RING( (HC_SubA_HSPXYOS << 24) |
(((31 - vmesa->drawX) & 0x1f) << HC_HSPXOS_SHIFT));
(((32 - vmesa->drawXoff) & 0x1f) << HC_HSPXOS_SHIFT));
ADVANCE_RING();
}
#endif
vmesa->newEmitState = 0;
}
@@ -658,29 +648,32 @@ static void viaRenderMode(GLcontext *ctx, GLenum mode)
static void viaDrawBuffer(GLcontext *ctx, GLenum mode)
{
struct via_context *vmesa = VIA_CONTEXT(ctx);
struct via_context *vmesa = VIA_CONTEXT(ctx);
if (VIA_DEBUG & (DEBUG_DRI|DEBUG_STATE))
fprintf(stderr, "%s in\n", __FUNCTION__);
if (VIA_DEBUG & (DEBUG_DRI|DEBUG_STATE))
fprintf(stderr, "%s in\n", __FUNCTION__);
if (mode == GL_FRONT) {
VIA_FLUSH_DMA(vmesa);
vmesa->drawBuffer = vmesa->readBuffer = &vmesa->front;
FALLBACK(vmesa, VIA_FALLBACK_DRAW_BUFFER, GL_FALSE);
return;
}
else if (mode == GL_BACK) {
VIA_FLUSH_DMA(vmesa);
vmesa->drawBuffer = vmesa->readBuffer = &vmesa->back;
FALLBACK(vmesa, VIA_FALLBACK_DRAW_BUFFER, GL_FALSE);
return;
}
else {
FALLBACK(vmesa, VIA_FALLBACK_DRAW_BUFFER, GL_TRUE);
return;
}
if (!ctx->DrawBuffer)
return;
viaXMesaWindowMoved(vmesa);
switch ( ctx->DrawBuffer->_ColorDrawBufferMask[0] ) {
case BUFFER_BIT_FRONT_LEFT:
VIA_FLUSH_DMA(vmesa);
vmesa->drawBuffer = vmesa->readBuffer = &vmesa->front;
FALLBACK(vmesa, VIA_FALLBACK_DRAW_BUFFER, GL_FALSE);
break;
case BUFFER_BIT_BACK_LEFT:
VIA_FLUSH_DMA(vmesa);
vmesa->drawBuffer = vmesa->readBuffer = &vmesa->back;
FALLBACK(vmesa, VIA_FALLBACK_DRAW_BUFFER, GL_FALSE);
break;
default:
FALLBACK(vmesa, VIA_FALLBACK_DRAW_BUFFER, GL_TRUE);
return;
}
viaXMesaWindowMoved(vmesa);
/* We want to update the s/w rast state too so that viaSetBuffer()
* gets called.
@@ -1328,12 +1321,19 @@ static void viaChoosePolygonState(GLcontext *ctx)
{
struct via_context *vmesa = VIA_CONTEXT(ctx);
#if 0
/* Polygon stipple is broken - see via_state.c
*/
if (ctx->Polygon.StippleFlag) {
vmesa->regEnable |= HC_HenSP_MASK;
}
else {
vmesa->regEnable &= ~HC_HenSP_MASK;
}
#else
FALLBACK(vmesa, VIA_FALLBACK_POLY_STIPPLE,
ctx->Polygon.StippleFlag);
#endif
if (ctx->Polygon.CullFlag) {
vmesa->regEnable |= HC_HenFBCull_MASK;

View File

@@ -947,7 +947,16 @@ void viaInitTextureFuncs(struct dd_function_table * functions)
functions->NewTextureImage = viaNewTextureImage;
functions->DeleteTexture = _mesa_delete_texture_object;
functions->FreeTexImageData = viaFreeTextureImageData;
#if defined( USE_SSE_ASM )
if (getenv("VIA_NO_SSE"))
functions->TextureMemCpy = _mesa_memcpy;
else
functions->TextureMemCpy = via_sse_memcpy;
#else
functions->TextureMemCpy = _mesa_memcpy;
#endif
functions->UpdateTexturePalette = 0;
functions->IsTextureResident = viaIsTextureResident;
}

View File

@@ -34,4 +34,8 @@ GLboolean viaUpdateTextureState(GLcontext *ctx);
void viaInitTextureFuncs(struct dd_function_table * functions);
GLboolean viaSwapOutWork( struct via_context *vmesa );
#if defined( USE_SSE_ASM )
void via_sse_memcpy( void *to, const void *from, size_t sz );
#endif /* defined( USE_SSE_ASM ) */
#endif

View File

@@ -43,12 +43,26 @@
#include "via_span.h"
#include "via_ioctl.h"
#include "via_3d_reg.h"
#include "via_tex.h"
/***********************************************************************
* Emit primitives as inline vertices *
***********************************************************************/
#define LINE_FALLBACK (0)
#define POINT_FALLBACK (0)
#define TRI_FALLBACK (0)
#define ANY_FALLBACK_FLAGS (POINT_FALLBACK|LINE_FALLBACK|TRI_FALLBACK)
#define ANY_RASTER_FLAGS (DD_TRI_LIGHT_TWOSIDE|DD_TRI_OFFSET|DD_TRI_UNFILLED)
#if 1
#if 0
#define COPY_DWORDS(vb, vertsize, v) \
do { \
via_sse_memcpy(vb, v, vertsize * 4); \
vb += vertsize; \
} while (0)
#else
#if defined( USE_X86_ASM )
#define COPY_DWORDS(vb, vertsize, v) \
do { \
int j; \
@@ -68,6 +82,7 @@
vb += vertsize; \
} while (0)
#endif
#endif
static void via_draw_triangle(struct via_context *vmesa,
viaVertexPtr v0,
@@ -228,7 +243,7 @@ static struct {
tnl_line_func line;
tnl_triangle_func triangle;
tnl_quad_func quad;
} rast_tab[VIA_MAX_TRIFUNC];
} rast_tab[VIA_MAX_TRIFUNC + 1];
#define DO_FALLBACK (IND & VIA_FALLBACK_BIT)
@@ -288,20 +303,21 @@ do { \
#define VERT_COPY_RGBA( v0, v1 ) v0->ui[coloroffset] = v1->ui[coloroffset]
#define VERT_SET_SPEC( v0, c ) \
#define VERT_SET_SPEC( v, c ) \
do { \
if (specoffset) { \
UNCLAMPED_FLOAT_TO_UBYTE(v0->v.specular.red, (c)[0]); \
UNCLAMPED_FLOAT_TO_UBYTE(v0->v.specular.green, (c)[1]); \
UNCLAMPED_FLOAT_TO_UBYTE(v0->v.specular.blue, (c)[2]); \
via_color_t *color = (via_color_t *)&((v)->ui[specoffset]); \
UNCLAMPED_FLOAT_TO_UBYTE(color->red, (c)[0]); \
UNCLAMPED_FLOAT_TO_UBYTE(color->green, (c)[1]); \
UNCLAMPED_FLOAT_TO_UBYTE(color->blue, (c)[2]); \
} \
} while (0)
#define VERT_COPY_SPEC( v0, v1 ) \
do { \
if (specoffset) { \
v0->v.specular.red = v1->v.specular.red; \
v0->v.specular.green = v1->v.specular.green; \
v0->v.specular.blue = v1->v.specular.blue; \
v0->ub4[specoffset][0] = v1->ub4[specoffset][0]; \
v0->ub4[specoffset][1] = v1->ub4[specoffset][1]; \
v0->ub4[specoffset][2] = v1->ub4[specoffset][2]; \
} \
} while (0)
@@ -418,6 +434,24 @@ static const GLenum hwPrim[GL_POLYGON + 2] = {
#include "tnl_dd/t_dd_tritmp.h"
/* Catchall case for flat, separate specular triangles (via has flat
* diffuse shading, but always does specular color with gouraud).
*/
#undef DO_FALLBACK
#undef DO_OFFSET
#undef DO_UNFILLED
#undef DO_TWOSIDE
#undef DO_FLAT
#define DO_FALLBACK (0)
#define DO_OFFSET (ctx->_TriangleCaps & DD_TRI_OFFSET)
#define DO_UNFILLED (ctx->_TriangleCaps & DD_TRI_UNFILLED)
#define DO_TWOSIDE (ctx->_TriangleCaps & DD_TRI_LIGHT_TWOSIDE)
#define DO_FLAT 1
#define TAG(x) x##_flat_specular
#define IND VIA_MAX_TRIFUNC
#include "tnl_dd/t_dd_tritmp.h"
static void init_rast_tab(void)
{
init();
@@ -436,6 +470,8 @@ static void init_rast_tab(void)
init_offset_unfilled_fallback();
init_twoside_unfilled_fallback();
init_twoside_offset_unfilled_fallback();
init_flat_specular(); /* special! */
}
@@ -609,11 +645,6 @@ static void viaFastRenderClippedPoly(GLcontext *ctx, const GLuint *elts,
_DD_NEW_TRI_STIPPLE | \
_NEW_POLYGONSTIPPLE)
#define LINE_FALLBACK (0)
#define POINT_FALLBACK (0)
#define TRI_FALLBACK (0)
#define ANY_FALLBACK_FLAGS (POINT_FALLBACK|LINE_FALLBACK|TRI_FALLBACK)
#define ANY_RASTER_FLAGS (DD_TRI_LIGHT_TWOSIDE|DD_TRI_OFFSET|DD_TRI_UNFILLED)
static void viaChooseRenderState(GLcontext *ctx)
{
@@ -652,6 +683,12 @@ static void viaChooseRenderState(GLcontext *ctx)
vmesa->drawTri = via_fallback_tri;
}
if ((flags & DD_SEPARATE_SPECULAR) &&
ctx->Light.ShadeModel == GL_FLAT) {
index = VIA_MAX_TRIFUNC; /* flat specular */
}
if (vmesa->renderIndex != index) {
vmesa->renderIndex = index;
@@ -865,13 +902,18 @@ void viaRasterPrimitive(GLcontext *ctx,
RING_VARS;
if (VIA_DEBUG & DEBUG_PRIMS)
fprintf(stderr, "%s: %s/%s\n",
fprintf(stderr, "%s: %s/%s/%s\n",
__FUNCTION__, _mesa_lookup_enum_by_nr(glprim),
_mesa_lookup_enum_by_nr(hwprim));
_mesa_lookup_enum_by_nr(hwprim),
_mesa_lookup_enum_by_nr(ctx->Light.ShadeModel));
assert (!vmesa->newState);
vmesa->renderPrimitive = glprim;
if (hwprim != vmesa->hwPrimitive) {
if (hwprim != vmesa->hwPrimitive ||
ctx->Light.ShadeModel != vmesa->hwShadeModel) {
VIA_FINISH_PRIM(vmesa);
/* Ensure no wrapping inside this function */
@@ -886,7 +928,8 @@ void viaRasterPrimitive(GLcontext *ctx,
if (ctx->Light.ShadeModel == GL_SMOOTH) {
vmesa->regCmdA_End |= HC_HShading_Gouraud;
}
vmesa->hwShadeModel = ctx->Light.ShadeModel;
regCmdB = vmesa->regCmdB;
switch (hwprim) {

View File

@@ -28,7 +28,7 @@ INCLUDE_DIRS = \
-I../dri_client/imports \
-Iserver \
-I$(TOP)/include \
-I$(DRM_SOURCE_PATH)/shared \
-I$(DRM_SOURCE_PATH)/shared-core \
-I$(TOP)/src/mesa \
-I$(TOP)/src/mesa/main \
-I$(TOP)/src/mesa/glapi \

View File

@@ -1,110 +1,3 @@
/* File name : colors.h
* Version : 2.3
*
* Header file for display driver for Mesa 2.3 under
* Windows95 and WindowsNT
* This file defines macros and global variables needed
* for converting color format
*
* Copyright (C) 1996- Li Wei
* Address : Institute of Artificial Intelligence
* : & Robotics
* : Xi'an Jiaotong University
* Email : liwei@aiar.xjtu.edu.cn
* Web page : http://sun.aiar.xjtu.edu.cn
*
* This file and its associations are partially based on the
* Windows NT driver for Mesa, written by Mark Leaming
* (mark@rsinc.com).
*/
/* $Log: ddcolors.h 1997/6/14 by Li Wei(liwei@aiar.xjtu.edu.cn)
* Macros for pixel format defined
*/
/*
* $Log: colors.h,v $
* Revision 1.2 2004/08/25 15:59:48 brianp
* Silence gcc 3.4 warnings on ReactOS. Mostly unused var warnings. (patch 1015696)
*
* Revision 1.1 2003/07/24 03:47:46 kschultz
* Source code for GDI driver.
*
* Revision 1.3 2002/01/15 18:14:34 kschultz
* Fixed pixel color component problem and clear code for 24-bit Windows
* devices. (Jeff Lewis)
*
* Revision 1.2 2002/01/15 18:11:36 kschultz
* Remove trailing CR's. No logical changes.
*
* Revision 1.1.1.1 1999/08/19 00:55:42 jtg
* Imported sources
*
* Revision 1.2 1999/01/03 03:08:57 brianp
* Ted Jump's changes
*
* Revision 1.1 1999/01/03 03:08:12 brianp
* Initial revision
*
* Revision 2.0.2 1997/4/30 15:58:00 CST by Li Wei(liwei@aiar.xjtu.edu.cn)
* Add LUTs need for dithering
*/
/*
* $Log: colors.h,v $
* Revision 1.2 2004/08/25 15:59:48 brianp
* Silence gcc 3.4 warnings on ReactOS. Mostly unused var warnings. (patch 1015696)
*
* Revision 1.1 2003/07/24 03:47:46 kschultz
* Source code for GDI driver.
*
* Revision 1.3 2002/01/15 18:14:34 kschultz
* Fixed pixel color component problem and clear code for 24-bit Windows
* devices. (Jeff Lewis)
*
* Revision 1.2 2002/01/15 18:11:36 kschultz
* Remove trailing CR's. No logical changes.
*
* Revision 1.1.1.1 1999/08/19 00:55:42 jtg
* Imported sources
*
* Revision 1.2 1999/01/03 03:08:57 brianp
* Ted Jump's changes
*
* Revision 1.1 1999/01/03 03:08:12 brianp
* Initial revision
*
* Revision 2.0.1 1997/4/29 15:52:00 CST by Li Wei(liwei@aiar.xjtu.edu.cn)
* Add BGR8 Macro
*/
/*
* $Log: colors.h,v $
* Revision 1.2 2004/08/25 15:59:48 brianp
* Silence gcc 3.4 warnings on ReactOS. Mostly unused var warnings. (patch 1015696)
*
* Revision 1.1 2003/07/24 03:47:46 kschultz
* Source code for GDI driver.
*
* Revision 1.3 2002/01/15 18:14:34 kschultz
* Fixed pixel color component problem and clear code for 24-bit Windows
* devices. (Jeff Lewis)
*
* Revision 1.2 2002/01/15 18:11:36 kschultz
* Remove trailing CR's. No logical changes.
*
* Revision 1.1.1.1 1999/08/19 00:55:42 jtg
* Imported sources
*
* Revision 1.2 1999/01/03 03:08:57 brianp
* Ted Jump's changes
*
* Revision 1.1 1999/01/03 03:08:12 brianp
* Initial revision
*
* Revision 2.0 1996/11/15 10:55:00 CST by Li Wei(liwei@aiar.xjtu.edu.cn)
* Initial revision
*/
/* Values for wmesa->pixelformat: */
#define PF_8A8B8G8R 3 /* 32-bit TrueColor: 8-A, 8-B, 8-G, 8-R */
@@ -114,426 +7,23 @@
#define PF_LOOKUP 7 /* Undithered RGB using a lookup table */
#define PF_GRAYSCALE 10 /* Grayscale or StaticGray */
#define PF_BADFORMAT 11
#define PF_INDEX8 12
char ColorMap16[] = {
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,
0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,
0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,
0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,
0x05,0x05,0x05,0x05,0x05,0x05,0x05,0x05,
0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,
0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,
0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,
0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09,
0x0A,0x0A,0x0A,0x0A,0x0A,0x0A,0x0A,0x0A,
0x0B,0x0B,0x0B,0x0B,0x0B,0x0B,0x0B,0x0B,
0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,
0x0D,0x0D,0x0D,0x0D,0x0D,0x0D,0x0D,0x0D,
0x0E,0x0E,0x0E,0x0E,0x0E,0x0E,0x0E,0x0E,
0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,
0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,
0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,
0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,
0x13,0x13,0x13,0x13,0x13,0x13,0x13,0x13,
0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,
0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,
0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,
0x17,0x17,0x17,0x17,0x17,0x17,0x17,0x17,
0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,
0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x19,
0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,0x1A,
0x1B,0x1B,0x1B,0x1B,0x1B,0x1B,0x1B,0x1B,
0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,
0x1D,0x1D,0x1D,0x1D,0x1D,0x1D,0x1D,0x1D,
0x1E,0x1E,0x1E,0x1E,0x1E,0x1E,0x1E,0x1E,
0x1F,0x1F,0x1F,0x1F,0x1F,0x1F,0x1F,0x1F};
#define BGR8(r,g,b) (unsigned)(((BYTE)((b & 0xc0) | ((g & 0xe0)>>2) | ((r & 0xe0)>>5))))
#ifdef DDRAW
#define BGR16(r,g,b) ((WORD)(((BYTE)(ColorMap16[b]) | ((BYTE)(g&0xfc) << 3)) | (((WORD)(BYTE)(ColorMap16[r])) << 11)))
#else
#define BGR16(r,g,b) ((WORD)(((BYTE)(ColorMap16[b]) | ((BYTE)(ColorMap16[g]) << 5)) | (((WORD)(BYTE)(ColorMap16[r])) << 10)))
#endif
#define BGR24(r,g,b) (unsigned long)((DWORD)(((BYTE)(b)|((WORD)((BYTE)(g))<<8))|(((DWORD)(BYTE)(r))<<16)))
#define BGR32(r,g,b) (unsigned long)((DWORD)(((BYTE)(b)|((WORD)((BYTE)(g))<<8))|(((DWORD)(BYTE)(r))<<16)))
#define PF_INDEX8 12
#define BGR8(r,g,b) (unsigned)(((BYTE)((b & 0xc0) | ((g & 0xe0)>>2) | \
((r & 0xe0)>>5))))
/*
* If pixelformat==PF_8A8B8G8R:
*/
#define PACK_8A8B8G8R( R, G, B, A ) \
( ((A) << 24) | ((B) << 16) | ((G) << 8) | (R) )
/* Windows uses 5,5,5 for 16-bit */
#define BGR16(r,g,b) ( (((unsigned short)b ) >> 3) | \
(((unsigned short)g & 0xf8) << 2) | \
(((unsigned short)r & 0xf8) << 7) )
#define BGR24(r,g,b) (unsigned long)((DWORD)(((BYTE)(b)| \
((WORD)((BYTE)(g))<<8))| \
(((DWORD)(BYTE)(r))<<16)))
#define BGR32(r,g,b) (unsigned long)((DWORD)(((BYTE)(b)| \
((WORD)((BYTE)(g))<<8))| \
(((DWORD)(BYTE)(r))<<16)))
/*
* If pixelformat==PF_8R8G8B:
*/
#define PACK_8R8G8B( R, G, B) ( ((R) << 16) | ((G) << 8) | (B) )
/*
* If pixelformat==PF_5R6G5B:
*/
#ifdef DDRAW
#define PACK_5R6G5B( R, G, B) ((WORD)(((BYTE)(ColorMap16[B]) | ((BYTE)(G&0xfc) << 3)) | (((WORD)(BYTE)(ColorMap16[R])) << 11)))
#else
#define PACK_5R6G5B( R, G, B) ((WORD)(((BYTE)(ColorMap16[B]) | ((BYTE)(ColorMap16[G]) << 5)) | (((WORD)(BYTE)(ColorMap16[R])) << 10)))
#endif
/*----------------------------------------------------------------------------
Division lookup tables. These tables compute 0-255 divided by 51 and
modulo 51. These tables could approximate gamma correction.
*/
char unsigned const aDividedBy51Rounded[256] =
{
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
};
char unsigned const aDividedBy51[256] =
{
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5,
};
char unsigned const aModulo51[256] =
{
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37,
38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 0, 1, 2, 3, 4, 5, 6,
7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25,
26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43,
44, 45, 46, 47, 48, 49, 50, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48,
49, 50, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 0, 1, 2, 3,
4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 0,
};
/*----------------------------------------------------------------------------
Multiplication LUTs. These compute 0-5 times 6 and 36.
*/
char unsigned const aTimes6[6] =
{
0, 6, 12, 18, 24, 30
};
char unsigned const aTimes36[6] =
{
0, 36, 72, 108, 144, 180
};
/*----------------------------------------------------------------------------
Dither matrices for 8 bit to 2.6 bit halftones.
*/
char unsigned const aHalftone16x16[256] =
{
0, 44, 9, 41, 3, 46, 12, 43, 1, 44, 10, 41, 3, 46, 12, 43,
34, 16, 25, 19, 37, 18, 28, 21, 35, 16, 26, 19, 37, 18, 28, 21,
38, 6, 47, 3, 40, 9, 50, 6, 38, 7, 47, 4, 40, 9, 49, 6,
22, 28, 13, 31, 25, 31, 15, 34, 22, 29, 13, 32, 24, 31, 15, 34,
2, 46, 12, 43, 1, 45, 10, 42, 2, 45, 11, 42, 1, 45, 11, 42,
37, 18, 27, 21, 35, 17, 26, 20, 36, 17, 27, 20, 36, 17, 26, 20,
40, 8, 49, 5, 38, 7, 48, 4, 39, 8, 48, 5, 39, 7, 48, 4,
24, 30, 15, 33, 23, 29, 13, 32, 23, 30, 14, 33, 23, 29, 14, 32,
2, 46, 12, 43, 0, 44, 10, 41, 3, 47, 12, 44, 0, 44, 10, 41,
37, 18, 27, 21, 35, 16, 25, 19, 37, 19, 28, 22, 35, 16, 25, 19,
40, 9, 49, 5, 38, 7, 47, 4, 40, 9, 50, 6, 38, 6, 47, 3,
24, 30, 15, 34, 22, 29, 13, 32, 25, 31, 15, 34, 22, 28, 13, 31,
1, 45, 11, 42, 2, 46, 11, 42, 1, 45, 10, 41, 2, 46, 11, 43,
36, 17, 26, 20, 36, 17, 27, 21, 35, 16, 26, 20, 36, 18, 27, 21,
39, 8, 48, 4, 39, 8, 49, 5, 38, 7, 48, 4, 39, 8, 49, 5,
23, 29, 14, 33, 24, 30, 14, 33, 23, 29, 13, 32, 24, 30, 14, 33,
};
char unsigned const aHalftone8x8[64] =
{
0, 38, 9, 47, 2, 40, 11, 50,
25, 12, 35, 22, 27, 15, 37, 24,
6, 44, 3, 41, 8, 47, 5, 43,
31, 19, 28, 15, 34, 21, 31, 18,
1, 39, 11, 49, 0, 39, 10, 48,
27, 14, 36, 23, 26, 13, 35, 23,
7, 46, 4, 43, 7, 45, 3, 42,
33, 20, 30, 17, 32, 19, 29, 16,
};
char unsigned const aHalftone4x4_1[16] =
{
0, 25, 6, 31,
38, 12, 44, 19,
9, 35, 3, 28,
47, 22, 41, 15
};
char unsigned const aHalftone4x4_2[16] =
{
41, 3, 9, 28,
35, 15, 22, 47,
6, 25, 38, 0,
19, 44, 31, 12
};
/***************************************************************************
aWinGHalftoneTranslation
Translates a 2.6 bit-per-pixel halftoned representation into the
slightly rearranged WinG Halftone Palette.
*/
char unsigned const aWinGHalftoneTranslation[216] =
{
0,
29,
30,
31,
32,
249,
33,
34,
35,
36,
37,
38,
39,
40,
41,
42,
43,
44,
45,
46,
47,
48,
49,
50,
51,
52,
53,
54,
55,
56,
250,
250,
57,
58,
59,
251,
60,
61,
62,
63,
64,
65,
66,
67,
68,
69,
70,
71,
72,
73,
74,
75,
76,
77,
78,
79,
80,
81,
82,
83,
84,
85,
86,
87,
88,
89,
250,
90,
91,
92,
93,
94,
95,
96,
97,
98,
99,
100,
101,
102,
103,
104,
105,
106,
107,
108,
109,
110,
111,
227,
112,
113,
114,
115,
116,
117,
118,
119,
151,
120,
121,
122,
123,
124,
228,
125,
126,
229,
133,
162,
135,
131,
132,
137,
166,
134,
140,
130,
136,
143,
138,
139,
174,
141,
142,
177,
129,
144,
145,
146,
147,
148,
149,
150,
157,
152,
153,
154,
155,
156,
192,
158,
159,
160,
161,
196,
163,
164,
165,
127,
199,
167,
168,
169,
170,
171,
172,
173,
207,
175,
176,
210,
178,
179,
180,
181,
182,
183,
184,
185,
186,
187,
188,
189,
190,
191,
224,
193,
194,
195,
252,
252,
197,
198,
128,
253,
252,
200,
201,
202,
203,
204,
205,
206,
230,
208,
209,
231,
211,
212,
213,
214,
215,
216,
217,
218,
219,
220,
221,
222,
254,
223,
232,
225,
226,
255,
};

View File

@@ -976,9 +976,13 @@ EXPORTS
_ac_InvalidateState
_glapi_get_context
_glapi_get_proc_address
_mesa_add_soft_renderbuffers
_mesa_add_renderbuffer
_mesa_buffer_data
_mesa_buffer_get_subdata
_mesa_buffer_map
_mesa_buffer_subdata
_mesa_buffer_unmap
_mesa_bzero
_mesa_calloc
_mesa_choose_tex_format
@@ -986,6 +990,7 @@ EXPORTS
_mesa_create_framebuffer
_mesa_create_visual
_mesa_delete_buffer_object
_mesa_delete_program
_mesa_delete_texture_object
_mesa_destroy_framebuffer
_mesa_destroy_visual
@@ -994,19 +999,31 @@ EXPORTS
_mesa_enable_1_5_extensions
_mesa_enable_sw_extensions
_mesa_error
_mesa_framebuffer_renderbuffer
_mesa_free
_mesa_free_context_data
_mesa_free_texture_image_data
_mesa_get_compressed_teximage
_mesa_get_current_context
_mesa_get_teximage
_mesa_init_default_imports
_mesa_init_driver_functions
_mesa_init_renderbuffer
_mesa_initialize_context
_mesa_make_current
_mesa_memcpy
_mesa_memset
_mesa_new_buffer_object
_mesa_new_framebuffer
_mesa_new_program
_mesa_new_soft_renderbuffer
_mesa_new_texture_image
_mesa_new_texture_object
_mesa_problem
_mesa_renderbuffer_texture
_mesa_ResizeBuffersMESA
_mesa_resize_framebuffer
; _mesa_resize_renderbuffer
_mesa_store_compressed_teximage1d
_mesa_store_compressed_teximage2d
_mesa_store_compressed_teximage3d
@@ -1023,7 +1040,7 @@ EXPORTS
_mesa_test_proxy_teximage
_mesa_Viewport
_swrast_Accum
_swrast_alloc_buffers
; _swrast_alloc_buffers
_swrast_Bitmap
_swrast_CopyPixels
_swrast_DrawBuffer
@@ -1045,7 +1062,7 @@ EXPORTS
_swrast_DestroyContext
_swrast_InvalidateState
_swrast_ReadPixels
_swrast_zbuffer_address
; _swrast_zbuffer_address
_swsetup_Wakeup
_swsetup_CreateContext
_swsetup_DestroyContext

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,175 +1,34 @@
/* File name : wmesadef.h
* Version : 2.3
*
* Header file for display driver for Mesa 2.3 under
* Windows95, WindowsNT and Win32
*
* Copyright (C) 1996- Li Wei
* Address : Institute of Artificial Intelligence
* : & Robotics
* : Xi'an Jiaotong University
* Email : liwei@aiar.xjtu.edu.cn
* Web page : http://sun.aiar.xjtu.edu.cn
*
* This file and its associations are partially based on the
* Windows NT driver for Mesa, written by Mark Leaming
* (mark@rsinc.com).
*/
/*
* $Log: wmesadef.h,v
* Revision 1.1.1.1 1999/08/19 00:55:42 jt
* Imported source
* Revision 1.3 1999/01/03 03:08:57 brian
* Ted Jump's change
*
* Initial version 1997/6/14 CST by Li Wei(liwei@aiar.xjtu.edu.cn)
*/
/*
* $Log: wmesadef.h,v
* Revision 1.1.1.1 1999/08/19 00:55:42 jt
* Imported source
* Revision 1.3 1999/01/03 03:08:57 brian
* Ted Jump's change
*
* Revision 2.1 1996/11/15 10:54:00 CST by Li Wei(liwei@aiar.xjtu.edu.cn)
* a new element added to wmesa_context :
* dither_flag
*/
/*
* $Log: wmesadef.h,v
* Revision 1.1.1.1 1999/08/19 00:55:42 jt
* Imported source
* Revision 1.3 1999/01/03 03:08:57 brian
* Ted Jump's change
*
* Revision 2.0 1996/11/15 10:54:00 CST by Li Wei(liwei@aiar.xjtu.edu.cn)
* Initial revision
*/
#ifndef DDMESADEF_H
#define DDMESADEF_H
// uncomment this to use DirectDraw driver
//#define DDRAW 1
// uncomment this to use a pointer to a function for setting the pixels
// in the buffer
#define COMPILE_SETPIXEL 1
// uncomment this to enable the fast win32 rasterizers ( commented out for MesaGL 4.0 )
// #define FAST_RASTERIZERS 1
// uncomment this to enable setting function pointers once inside of
// WMesaCreateContext instead of on every call to wmesa_update_state()
#define SET_FPOINTERS_ONCE 1
#include <windows.h>
#include <GL/gl.h>
#include "context.h"
#ifdef DDRAW
#define DIRECTDRAW_VERSION 0x0100
#include <ddraw.h>
#endif
//#include "profile.h"
#define REDBITS 0x03
#define REDSHIFT 0x00
#define GREENBITS 0x03
#define GREENSHIFT 0x03
#define BLUEBITS 0x02
#define BLUESHIFT 0x06
typedef struct _dibSection{
HDC hDC;
HANDLE hFileMap;
BOOL fFlushed;
LPVOID base;
HDC hDC;
HANDLE hFileMap;
BOOL fFlushed;
LPVOID base;
}WMDIBSECTION, *PWMDIBSECTION;
#ifdef COMPILE_SETPIXEL
struct wmesa_context;
typedef void (*SETPIXELTYPE)(struct wmesa_context *pwc, int iScanLine, int iPixel, BYTE r, BYTE g, BYTE b);
#endif
typedef struct wmesa_context{
GLcontext *gl_ctx; /* The core GL/Mesa context */
GLvisual *gl_visual; /* Describes the buffers */
GLframebuffer *gl_buffer; /* Depth, stencil, accum, etc buffers */
HWND Window;
GLcontext *gl_ctx; /* The core GL/Mesa context */
GLvisual *gl_visual; /* Describes the buffers */
GLframebuffer *gl_buffer; /* Depth, stencil, accum, etc buffers*/
HWND Window;
HDC hDC;
HPALETTE hPalette;
HPALETTE hOldPalette;
HPEN hPen;
HPEN hOldPen;
HCURSOR hOldCursor;
COLORREF crColor;
// 3D projection stuff
RECT drawRect;
UINT uiDIBoffset;
// OpenGL stuff
HPALETTE hGLPalette;
GLuint width;
GLuint height;
GLuint ScanWidth;
GLboolean db_flag; //* double buffered?
GLboolean rgb_flag; //* RGB mode?
GLboolean dither_flag; //* use dither when 256 color mode for RGB?
GLuint depth; //* bits per pixel (1, 8, 24, etc)
ULONG pixel; // current color index or RGBA pixel value
ULONG clearpixel; //* pixel for clearing the color buffers
PBYTE ScreenMem; // WinG memory
BITMAPINFO *IndexFormat;
HPALETTE hPal; // Current Palette
HPALETTE hPalHalfTone;
WMDIBSECTION dib;
COLORREF clearColorRef;
HPEN clearPen;
HBRUSH clearBrush;
GLuint width;
GLuint height;
GLuint ScanWidth;
GLboolean db_flag;
WMDIBSECTION dib;
BITMAPINFO bmi;
HBITMAP hbmDIB;
HBITMAP hOldBitmap;
HBITMAP Old_Compat_BM;
HBITMAP Compat_BM; // Bitmap for double buffering
PBYTE pbPixels;
int nColors;
BYTE cColorBits;
int pixelformat;
#ifdef DDRAW
LPDIRECTDRAW lpDD; // DirectDraw object
// LPDIRECTDRAW2 lpDD2; // DirectDraw object
LPDIRECTDRAWSURFACE lpDDSPrimary; // DirectDraw primary surface
LPDIRECTDRAWSURFACE lpDDSOffScreen; // DirectDraw off screen surface
LPDIRECTDRAWPALETTE lpDDPal; // DirectDraw palette
BOOL bActive; // is application active?
DDSURFACEDESC ddsd; // surface description
int fullScreen; // fullscreen ?
int gMode ; // fullscreen mode
LONG oldWndProc; // old Window proc. we need to hook WM_MOVE message to update the drawing rectangle
#endif
RECT rectOffScreen;
RECT rectSurface;
HWND hwnd;
DWORD pitch;
PBYTE addrOffScreen;
#ifdef COMPILE_SETPIXEL
SETPIXELTYPE wmSetPixel;
#endif // COMPILE_SETPIXEL
//#ifdef PROFILE
// MESAPROF profile;
//#endif
BYTE cColorBits;
int pixelformat;
} *PWMC;
#define PAGE_FILE 0xffffffff
#endif

View File

@@ -531,9 +531,7 @@
if (z < zRow[i]) { \
pRow[i] = (PIXEL_TYPE) p; \
zRow[i] = z; \
if (span.y == 100) printf("pass\n");\
} \
else if (span.y == 100) printf("fail\n");\
span.z += span.zStep; \
}
@@ -1435,7 +1433,6 @@ static swrast_tri_func get_triangle_func( GLcontext *ctx )
struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *)
ctx->DrawBuffer->_ColorDrawBuffers[0][0];
return NULL;
#ifdef DEBUG
triFuncName = NULL;
#endif

View File

@@ -29,7 +29,7 @@
<enum name="COLOR_ATTACHMENT6_EXT" value="0x8CE6"/>
<enum name="COLOR_ATTACHMENT7_EXT" value="0x8CE7"/>
<enum name="COLOR_ATTACHMENT8_EXT" value="0x8CE8"/>
<enum name="COLOR_ATTACHMENT8_EXT" value="0x8CE9"/>
<enum name="COLOR_ATTACHMENT9_EXT" value="0x8CE9"/>
<enum name="COLOR_ATTACHMENT10_EXT" value="0x8CEA"/>
<enum name="COLOR_ATTACHMENT11_EXT" value="0x8CEB"/>
<enum name="COLOR_ATTACHMENT12_EXT" value="0x8CEC"/>
@@ -52,7 +52,7 @@
<enum name="FRAMEBUFFER_BINDING_EXT" value="0x8CA6"/>
<enum name="RENDERBUFFER_BINDING_EXT" value="0x8CA7"/>
<enum name="MAX_COLOR_ATTACHMENT_EXT" value="0x8CDF"/>
<enum name="MAX_COLOR_ATTACHMENTS_EXT" value="0x8CDF"/>
<enum name="MAX_RENDERBUFFER_SIZE_EXT" value="0x84E8"/>
<enum name="INVALID_FRAMEBUFFER_OPERATION_EXT" value="0x0506"/>

View File

@@ -1,124 +0,0 @@
# Microsoft Developer Studio Project File - Name="glapi" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Static Library" 0x0104
CFG=glapi - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "glapi.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "glapi.mak" CFG="glapi - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "glapi - Win32 Release" (based on "Win32 (x86) Static Library")
!MESSAGE "glapi - Win32 Debug" (based on "Win32 (x86) Static Library")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "glapi - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
# ADD CPP /nologo /W3 /GX /O2 /I "../../../include" /I "../" /I "../main" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo
!ELSEIF "$(CFG)" == "glapi - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../../../include" /I "../" /I "../main" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /FR /YX /FD /GZ /c
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo
!ENDIF
# Begin Target
# Name "glapi - Win32 Release"
# Name "glapi - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=.\glapi.c
# End Source File
# Begin Source File
SOURCE=.\glthread.c
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# Begin Source File
SOURCE=.\glapi.h
# End Source File
# Begin Source File
SOURCE=.\glapioffsets.h
# End Source File
# Begin Source File
SOURCE=.\glapitable.h
# End Source File
# Begin Source File
SOURCE=.\glapitemp.h
# End Source File
# Begin Source File
SOURCE=.\glprocs.h
# End Source File
# Begin Source File
SOURCE=.\glthread.h
# End Source File
# End Group
# End Target
# End Project

View File

@@ -514,6 +514,19 @@ struct dd_function_table {
*/
void (*FreeTexImageData)( GLcontext *ctx, struct gl_texture_image *tImage );
/**
* Note: no context argument. This function doesn't initially look
* like it belongs here, except that the driver is the only entity
* that knows for sure how the texture memory is allocated - via
* the above callbacks. There is then an argument that the driver
* knows what memcpy paths might be fast. Typically this is invoked with
*
* to -- a pointer into texture memory allocated by NewTextureImage() above.
* from -- a pointer into client memory or a mesa temporary.
* sz -- nr bytes to copy.
*/
void* (*TextureMemCpy)( void *to, const void *from, size_t sz );
/**
* Called by glAreTextureResident().
*/

View File

@@ -75,10 +75,12 @@
#include "conf.h"
#endif
/* Get typedefs for uintptr_t and friends */
#if defined(_WIN32) && !defined(__WIN32__) && !defined(__CYGWIN__) && !defined(BUILD_FOR_SNAP)
#if defined(_WIN32)
#include <BaseTsd.h>
#if _MSC_VER == 1200
typedef UINT_PTR uintptr_t;
#endif
#else
#include <inttypes.h>
#endif
@@ -119,16 +121,6 @@
#ifndef __MINGW32__
/* XXX why is this here?
* It should probaby be somewhere in src/mesa/drivers/windows/
*/
/* compatibility guard so we don't need to change client code */
#if defined(_WIN32) && !defined(_WINDEF_) && !defined(_WINDEF_H) && !defined(_GNU_H_WINDOWS32_BASE) && !defined(OPENSTEP) && !defined(__CYGWIN__) && !defined(BUILD_FOR_SNAP)
typedef INT_PTR (GLAPIENTRY *PROC)();
typedef unsigned long COLORREF;
#endif
/* XXX why is this here?
* It should probaby be somewhere in src/mesa/drivers/windows/
*/
@@ -277,6 +269,18 @@ typedef struct tagPIXELFORMATDESCRIPTOR PIXELFORMATDESCRIPTOR, *PPIXELFORMATDESC
# define __builtin_expect(x, y) x
#endif
/* Windows does not have the ffs() function */
#if defined(_WIN32) && !defined(__MINGW32__)
int INLINE ffs(int value)
{
int bit;
if (value == 0)
return 0;
for (bit=1; !(value & 1); bit++)
value >>= 1;
return bit;
}
#endif
#include "config.h"

View File

@@ -1,540 +0,0 @@
# Microsoft Developer Studio Project File - Name="main" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Static Library" 0x0104
CFG=main - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "main.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "main.mak" CFG="main - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "main - Win32 Release" (based on "Win32 (x86) Static Library")
!MESSAGE "main - Win32 Debug" (based on "Win32 (x86) Static Library")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "main - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
# ADD CPP /nologo /W3 /GX /O2 /I "../../../include" /I "../" /I "../glapi" /I "../shader" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /Zm1000 /c
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo
!ELSEIF "$(CFG)" == "main - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../../../include" /I "../" /I "../glapi" /I "../shader" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /FR /YX /FD /GZ /Zm1000 /c
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo
!ENDIF
# Begin Target
# Name "main - Win32 Release"
# Name "main - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=.\accum.c
# End Source File
# Begin Source File
SOURCE=.\api_arrayelt.c
# End Source File
# Begin Source File
SOURCE=.\api_loopback.c
# End Source File
# Begin Source File
SOURCE=.\api_noop.c
# End Source File
# Begin Source File
SOURCE=.\api_validate.c
# End Source File
# Begin Source File
SOURCE=.\attrib.c
# End Source File
# Begin Source File
SOURCE=.\blend.c
# End Source File
# Begin Source File
SOURCE=.\bufferobj.c
# End Source File
# Begin Source File
SOURCE=.\buffers.c
# End Source File
# Begin Source File
SOURCE=.\clip.c
# End Source File
# Begin Source File
SOURCE=.\colortab.c
# End Source File
# Begin Source File
SOURCE=.\context.c
# End Source File
# Begin Source File
SOURCE=.\convolve.c
# End Source File
# Begin Source File
SOURCE=.\debug.c
# End Source File
# Begin Source File
SOURCE=.\depth.c
# End Source File
# Begin Source File
SOURCE=.\dispatch.c
# End Source File
# Begin Source File
SOURCE=.\dlist.c
# End Source File
# Begin Source File
SOURCE=.\drawpix.c
# End Source File
# Begin Source File
SOURCE=.\enable.c
# End Source File
# Begin Source File
SOURCE=.\enums.c
# End Source File
# Begin Source File
SOURCE=.\eval.c
# End Source File
# Begin Source File
SOURCE=.\extensions.c
# End Source File
# Begin Source File
SOURCE=.\feedback.c
# End Source File
# Begin Source File
SOURCE=.\fog.c
# End Source File
# Begin Source File
SOURCE=.\get.c
# End Source File
# Begin Source File
SOURCE=.\getstring.c
# End Source File
# Begin Source File
SOURCE=.\hash.c
# End Source File
# Begin Source File
SOURCE=.\hint.c
# End Source File
# Begin Source File
SOURCE=.\histogram.c
# End Source File
# Begin Source File
SOURCE=.\image.c
# End Source File
# Begin Source File
SOURCE=.\imports.c
# End Source File
# Begin Source File
SOURCE=.\light.c
# End Source File
# Begin Source File
SOURCE=.\lines.c
# End Source File
# Begin Source File
SOURCE=.\matrix.c
# End Source File
# Begin Source File
SOURCE=.\occlude.c
# End Source File
# Begin Source File
SOURCE=.\pixel.c
# End Source File
# Begin Source File
SOURCE=.\points.c
# End Source File
# Begin Source File
SOURCE=.\polygon.c
# End Source File
# Begin Source File
SOURCE=.\rastpos.c
# End Source File
# Begin Source File
SOURCE=.\state.c
# End Source File
# Begin Source File
SOURCE=.\stencil.c
# End Source File
# Begin Source File
SOURCE=.\texcompress.c
# End Source File
# Begin Source File
SOURCE=.\texcompress_fxt1.c
# End Source File
# Begin Source File
SOURCE=.\texcompress_s3tc.c
# End Source File
# Begin Source File
SOURCE=.\texformat.c
# End Source File
# Begin Source File
SOURCE=.\teximage.c
# End Source File
# Begin Source File
SOURCE=.\texobj.c
# End Source File
# Begin Source File
SOURCE=.\texstate.c
# End Source File
# Begin Source File
SOURCE=.\texstore.c
# End Source File
# Begin Source File
SOURCE=.\varray.c
# End Source File
# Begin Source File
SOURCE=.\vtxfmt.c
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# Begin Source File
SOURCE=.\accum.h
# End Source File
# Begin Source File
SOURCE=.\api_arrayelt.h
# End Source File
# Begin Source File
SOURCE=.\api_eval.h
# End Source File
# Begin Source File
SOURCE=.\api_loopback.h
# End Source File
# Begin Source File
SOURCE=.\api_noop.h
# End Source File
# Begin Source File
SOURCE=.\api_validate.h
# End Source File
# Begin Source File
SOURCE=.\attrib.h
# End Source File
# Begin Source File
SOURCE=.\blend.h
# End Source File
# Begin Source File
SOURCE=.\bufferobj.h
# End Source File
# Begin Source File
SOURCE=.\buffers.h
# End Source File
# Begin Source File
SOURCE=.\clip.h
# End Source File
# Begin Source File
SOURCE=.\colormac.h
# End Source File
# Begin Source File
SOURCE=.\colortab.h
# End Source File
# Begin Source File
SOURCE=.\config.h
# End Source File
# Begin Source File
SOURCE=.\context.h
# End Source File
# Begin Source File
SOURCE=.\convolve.h
# End Source File
# Begin Source File
SOURCE=.\dd.h
# End Source File
# Begin Source File
SOURCE=.\debug.h
# End Source File
# Begin Source File
SOURCE=.\depth.h
# End Source File
# Begin Source File
SOURCE=.\dlist.h
# End Source File
# Begin Source File
SOURCE=.\drawpix.h
# End Source File
# Begin Source File
SOURCE=.\enable.h
# End Source File
# Begin Source File
SOURCE=.\enums.h
# End Source File
# Begin Source File
SOURCE=.\eval.h
# End Source File
# Begin Source File
SOURCE=.\extensions.h
# End Source File
# Begin Source File
SOURCE=.\feedback.h
# End Source File
# Begin Source File
SOURCE=.\fog.h
# End Source File
# Begin Source File
SOURCE=.\get.h
# End Source File
# Begin Source File
SOURCE=.\glheader.h
# End Source File
# Begin Source File
SOURCE=.\hash.h
# End Source File
# Begin Source File
SOURCE=.\hint.h
# End Source File
# Begin Source File
SOURCE=.\histogram.h
# End Source File
# Begin Source File
SOURCE=.\image.h
# End Source File
# Begin Source File
SOURCE=.\imports.h
# End Source File
# Begin Source File
SOURCE=.\light.h
# End Source File
# Begin Source File
SOURCE=.\lines.h
# End Source File
# Begin Source File
SOURCE=.\macros.h
# End Source File
# Begin Source File
SOURCE=.\matrix.h
# End Source File
# Begin Source File
SOURCE=.\mtypes.h
# End Source File
# Begin Source File
SOURCE=.\occlude.h
# End Source File
# Begin Source File
SOURCE=.\pixel.h
# End Source File
# Begin Source File
SOURCE=.\points.h
# End Source File
# Begin Source File
SOURCE=.\polygon.h
# End Source File
# Begin Source File
SOURCE=.\program.h
# End Source File
# Begin Source File
SOURCE=.\rastpos.h
# End Source File
# Begin Source File
SOURCE=.\simple_list.h
# End Source File
# Begin Source File
SOURCE=.\state.h
# End Source File
# Begin Source File
SOURCE=.\stencil.h
# End Source File
# Begin Source File
SOURCE=.\texcompress.h
# End Source File
# Begin Source File
SOURCE=.\texformat.h
# End Source File
# Begin Source File
SOURCE=.\texformat_tmp.h
# End Source File
# Begin Source File
SOURCE=.\teximage.h
# End Source File
# Begin Source File
SOURCE=.\texobj.h
# End Source File
# Begin Source File
SOURCE=.\texstate.h
# End Source File
# Begin Source File
SOURCE=.\texstore.h
# End Source File
# Begin Source File
SOURCE=.\texutil.h
# End Source File
# Begin Source File
SOURCE=.\texutil_tmp.h
# End Source File
# Begin Source File
SOURCE=.\varray.h
# End Source File
# Begin Source File
SOURCE=.\version.h
# End Source File
# Begin Source File
SOURCE=.\vtxfmt.h
# End Source File
# Begin Source File
SOURCE=.\vtxfmt_tmp.h
# End Source File
# End Group
# End Target
# End Project

View File

@@ -90,15 +90,20 @@ struct texenv_fragment_program {
GLboolean error;
struct ureg src_texture; /* Reg containing sampled texture color,
* else undef.
*/
struct ureg src_texture[MAX_TEXTURE_UNITS];
/* Reg containing each texture unit's sampled texture color,
* else undef.
*/
struct ureg src_previous; /* Reg containing color from previous
* stage. May need to be decl'd.
*/
GLuint last_tex_stage; /* Number of last enabled texture unit */
struct ureg half;
struct ureg one;
struct ureg zero;
};
@@ -131,6 +136,12 @@ static struct ureg swizzle1( struct ureg reg, int x )
return swizzle(reg, x, x, x, x);
}
static struct ureg negate( struct ureg reg )
{
reg.negatebase ^= 1;
return reg;
}
static GLboolean is_undef( struct ureg reg )
{
return reg.file == 0xf;
@@ -189,10 +200,13 @@ static void release_temps( struct texenv_fragment_program *p )
{
GLuint max_temp = p->ctx->Const.MaxFragmentProgramTemps;
/* KW: To support tex_env_crossbar, don't release the registers in
* temps_output.
*/
if (max_temp >= sizeof(int) * 8)
p->temp_in_use = 0;
p->temp_in_use = p->temps_output;
else
p->temp_in_use = ~((1<<max_temp)-1);
p->temp_in_use = ~((1<<max_temp)-1) | p->temps_output;
}
@@ -340,8 +354,9 @@ static struct ureg emit_texld( struct texenv_fragment_program *p,
(dest.file == PROGRAM_TEMPORARY &&
(p->alu_temps & (1<<dest.idx)))) {
p->program->NumTexIndirections++;
p->temps_output = 0;
p->temps_output = 1<<coord.idx;
p->alu_temps = 0;
assert(0); /* KW: texture env crossbar */
}
return dest;
@@ -372,6 +387,27 @@ static struct ureg register_const4f( struct texenv_fragment_program *p,
static struct ureg get_one( struct texenv_fragment_program *p )
{
if (is_undef(p->one))
p->one = register_scalar_const(p, 1.0);
return p->one;
}
static struct ureg get_half( struct texenv_fragment_program *p )
{
if (is_undef(p->half))
p->one = register_scalar_const(p, 0.5);
return p->half;
}
static struct ureg get_zero( struct texenv_fragment_program *p )
{
if (is_undef(p->zero))
p->one = register_scalar_const(p, 0.0);
return p->zero;
}
@@ -402,22 +438,9 @@ static struct ureg get_source( struct texenv_fragment_program *p,
{
switch (src) {
case GL_TEXTURE:
if (is_undef(p->src_texture)) {
assert(!is_undef(p->src_texture[unit]));
return p->src_texture[unit];
GLuint dim = translate_tex_src_bit( p, p->ctx->Texture.Unit[unit]._ReallyEnabled);
struct ureg texcoord = register_input(p, FRAG_ATTRIB_TEX0+unit);
struct ureg tmp = get_tex_temp( p );
/* TODO: Use D0_MASK_XY where possible.
*/
p->src_texture = emit_texld( p, FP_OPCODE_TXP,
tmp, WRITEMASK_XYZW,
unit, dim, texcoord );
}
return p->src_texture;
/* Crossbar: */
case GL_TEXTURE0:
case GL_TEXTURE1:
case GL_TEXTURE2:
@@ -425,14 +448,16 @@ static struct ureg get_source( struct texenv_fragment_program *p,
case GL_TEXTURE4:
case GL_TEXTURE5:
case GL_TEXTURE6:
case GL_TEXTURE7: {
return undef;
}
case GL_TEXTURE7:
assert(!is_undef(p->src_texture[src - GL_TEXTURE0]));
return p->src_texture[src - GL_TEXTURE0];
case GL_CONSTANT:
return register_param2(p, STATE_TEXENV_COLOR, unit);
case GL_PRIMARY_COLOR:
return register_input(p, FRAG_ATTRIB_COL0);
case GL_PREVIOUS:
default:
if (is_undef(p->src_previous))
@@ -441,7 +466,7 @@ static struct ureg get_source( struct texenv_fragment_program *p,
return p->src_previous;
}
}
static struct ureg emit_combine_source( struct texenv_fragment_program *p,
GLuint mask,
@@ -459,7 +484,7 @@ static struct ureg emit_combine_source( struct texenv_fragment_program *p,
* Emit tmp = 1.0 - arg.xyzw
*/
arg = get_temp( p );
one = register_scalar_const(p, 1.0);
one = get_one( p );
return emit_arith( p, FP_OPCODE_SUB, arg, mask, 0, one, src, undef);
case GL_SRC_ALPHA:
@@ -471,10 +496,14 @@ static struct ureg emit_combine_source( struct texenv_fragment_program *p,
/* Get unused tmp,
* Emit tmp = 1.0 - arg.wwww
*/
arg = get_temp( p );
one = register_scalar_const(p, 1.0);
return emit_arith( p, FP_OPCODE_SUB, arg, mask, 0,
one, swizzle1(src, W), undef);
arg = get_temp(p);
one = get_one(p);
return emit_arith(p, FP_OPCODE_SUB, arg, mask, 0,
one, swizzle1(src, W), undef);
case GL_ZERO:
return get_zero(p);
case GL_ONE:
return get_one(p);
case GL_SRC_COLOR:
default:
return src;
@@ -496,6 +525,9 @@ static int nr_args( GLenum mode )
case GL_DOT3_RGBA_EXT: return 2;
case GL_DOT3_RGB: return 2;
case GL_DOT3_RGBA: return 2;
case GL_MODULATE_ADD_ATI: return 3;
case GL_MODULATE_SUBTRACT_ATI: return 3;
case GL_MODULATE_SIGNED_ADD_ATI: return 3;
default: return 0;
}
}
@@ -562,15 +594,15 @@ static struct ureg emit_combine( struct texenv_fragment_program *p,
return emit_arith( p, FP_OPCODE_MOV, dest, mask, saturate, src[0], undef, undef );
case GL_MODULATE:
return emit_arith( p, FP_OPCODE_MUL, dest, mask, saturate,
src[0], src[1], undef );
src[0], src[1], undef );
case GL_ADD:
return emit_arith( p, FP_OPCODE_ADD, dest, mask, saturate,
src[0], src[1], undef );
src[0], src[1], undef );
case GL_ADD_SIGNED:
/* tmp = arg0 + arg1
* result = tmp - .5
*/
half = register_scalar_const(p, .5);
half = get_half(p);
emit_arith( p, FP_OPCODE_ADD, tmp, mask, 0, src[0], src[1], undef );
emit_arith( p, FP_OPCODE_SUB, dest, mask, saturate, tmp, half, undef );
return dest;
@@ -597,24 +629,38 @@ static struct ureg emit_combine( struct texenv_fragment_program *p,
* dst = tmp0 dot3 tmp1
*/
emit_arith( p, FP_OPCODE_MAD, tmp0, WRITEMASK_XYZW, 0,
two, src[0], neg1);
two, src[0], neg1);
if (memcmp(&src[0], &src[1], sizeof(struct ureg)) == 0)
tmp1 = tmp0;
else
emit_arith( p, FP_OPCODE_MAD, tmp1, WRITEMASK_XYZW, 0,
two, src[1], neg1);
two, src[1], neg1);
emit_arith( p, FP_OPCODE_DP3, dest, mask, saturate, tmp0, tmp1, undef);
return dest;
}
case GL_MODULATE_ADD_ATI:
/* Arg0 * Arg2 + Arg1 */
return emit_arith( p, FP_OPCODE_MAD, dest, mask, saturate,
src[0], src[2], src[1] );
case GL_MODULATE_SIGNED_ADD_ATI: {
/* Arg0 * Arg2 + Arg1 - 0.5 */
struct ureg tmp0 = get_temp(p);
half = get_half(p);
emit_arith( p, FP_OPCODE_MAD, tmp0, mask, 0, src[0], src[2], src[1] );
emit_arith( p, FP_OPCODE_SUB, dest, mask, saturate, tmp0, half, undef );
return dest;
}
case GL_MODULATE_SUBTRACT_ATI:
/* Arg0 * Arg2 - Arg1 */
emit_arith( p, FP_OPCODE_MAD, dest, mask, 0, src[0], src[2], negate(src[1]) );
return dest;
default:
return src[0];
}
}
static struct ureg emit_texenv( struct texenv_fragment_program *p, int unit )
{
struct gl_texture_unit *texUnit = &p->ctx->Texture.Unit[unit];
@@ -696,8 +742,11 @@ static struct ureg emit_texenv( struct texenv_fragment_program *p, int unit )
shift = register_scalar_const(p, 1<<rgb_shift);
}
else {
shift = register_const2f(p, 1<<rgb_shift, 1<<alpha_shift);
shift = swizzle(shift,X,X,X,Y);
shift = register_const4f(p,
1<<rgb_shift,
1<<rgb_shift,
1<<rgb_shift,
1<<alpha_shift);
}
return emit_arith( p, FP_OPCODE_MUL, dest, WRITEMASK_XYZW,
saturate, out, shift, undef );
@@ -706,6 +755,63 @@ static struct ureg emit_texenv( struct texenv_fragment_program *p, int unit )
return out;
}
static void load_texture( struct texenv_fragment_program *p, GLuint unit )
{
if (is_undef(p->src_texture[unit])) {
GLuint dim = translate_tex_src_bit( p, p->ctx->Texture.Unit[unit]._ReallyEnabled);
struct ureg texcoord = register_input(p, FRAG_ATTRIB_TEX0+unit);
struct ureg tmp = get_tex_temp( p );
/* TODO: Use D0_MASK_XY where possible.
*/
p->src_texture[unit] = emit_texld( p, FP_OPCODE_TXP,
tmp, WRITEMASK_XYZW,
unit, dim, texcoord );
}
}
static GLboolean load_texenv_source( struct texenv_fragment_program *p,
GLenum src, GLuint unit )
{
switch (src) {
case GL_TEXTURE:
load_texture(p, unit);
break;
case GL_TEXTURE0:
case GL_TEXTURE1:
case GL_TEXTURE2:
case GL_TEXTURE3:
case GL_TEXTURE4:
case GL_TEXTURE5:
case GL_TEXTURE6:
case GL_TEXTURE7:
if (!p->ctx->Texture.Unit[src - GL_TEXTURE0]._ReallyEnabled)
return GL_FALSE;
load_texture(p, src - GL_TEXTURE0);
break;
default:
break;
}
return GL_TRUE;
}
static GLboolean load_texunit_sources( struct texenv_fragment_program *p, int unit )
{
struct gl_texture_unit *texUnit = &p->ctx->Texture.Unit[unit];
int i, nr = nr_args(texUnit->_CurrentCombine->ModeRGB);
for (i = 0; i < nr; i++) {
if (!load_texenv_source( p, texUnit->_CurrentCombine->SourceRGB[i], unit) ||
!load_texenv_source( p, texUnit->_CurrentCombine->SourceA[i], unit ))
return GL_FALSE;
}
return GL_TRUE;
}
void _mesa_UpdateTexEnvProgram( GLcontext *ctx )
{
struct texenv_fragment_program p;
@@ -754,24 +860,34 @@ void _mesa_UpdateTexEnvProgram( GLcontext *ctx )
p.program->InputsRead = 0;
p.program->OutputsWritten = 1 << FRAG_OUTPUT_COLR;
p.src_texture = undef;
for (unit = 0; unit < MAX_TEXTURE_UNITS; unit++)
p.src_texture[unit] = undef;
p.src_previous = undef;
p.last_tex_stage = 0;
release_temps(&p);
if (ctx->Texture._EnabledUnits) {
GLuint tex_env_enabled = 0;
/* First pass - to support texture_env_crossbar, first identify
* all referenced texture sources and emit texld instructions
* for each:
*/
for (unit = 0 ; unit < ctx->Const.MaxTextureUnits ; unit++)
if (ctx->Texture.Unit[unit]._ReallyEnabled) {
p.last_tex_stage = unit;
if (load_texunit_sources( &p, unit )) {
tex_env_enabled |= 1<<unit;
p.last_tex_stage = unit;
}
}
/* Second pass - emit combine instructions to build final color:
*/
for (unit = 0 ; unit < ctx->Const.MaxTextureUnits; unit++)
if (ctx->Texture.Unit[unit]._ReallyEnabled) {
if (tex_env_enabled & (1<<unit)) {
p.src_previous = emit_texenv( &p, unit );
p.src_texture = undef;
release_temps(&p); /* release all temps */
if (p.src_previous.file == PROGRAM_TEMPORARY)
p.temp_in_use |= 1 << p.src_previous.idx; /* except for this one */
}
}

View File

@@ -671,7 +671,8 @@ _mesa_swizzle_ubyte_image(GLcontext *ctx,
* 1D, 2D and 3D images supported.
*/
static void
memcpy_texture(GLuint dimensions,
memcpy_texture(GLcontext *ctx,
GLuint dimensions,
const struct gl_texture_format *dstFormat,
GLvoid *dstAddr,
GLint dstXoffset, GLint dstYoffset, GLint dstZoffset,
@@ -701,7 +702,7 @@ memcpy_texture(GLuint dimensions,
dstImageStride == bytesPerImage) ||
(srcDepth == 1))) {
/* one big memcpy */
_mesa_memcpy(dstImage, srcImage, bytesPerTexture);
ctx->Driver.TextureMemCpy(dstImage, srcImage, bytesPerTexture);
}
else {
GLint img, row;
@@ -709,7 +710,7 @@ memcpy_texture(GLuint dimensions,
const GLubyte *srcRow = srcImage;
GLubyte *dstRow = dstImage;
for (row = 0; row < srcHeight; row++) {
_mesa_memcpy(dstRow, srcRow, bytesPerRow);
ctx->Driver.TextureMemCpy(dstRow, srcRow, bytesPerRow);
dstRow += dstRowStride;
srcRow += srcRowStride;
}
@@ -776,7 +777,7 @@ _mesa_texstore_rgba(GLcontext *ctx, GLuint dims,
baseInternalFormat == srcFormat &&
srcType == CHAN_TYPE) {
/* simple memcpy path */
memcpy_texture(dims,
memcpy_texture(ctx, dims,
dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset,
dstRowStride, dstImageStride,
srcWidth, srcHeight, srcDepth, srcFormat, srcType,
@@ -862,7 +863,7 @@ _mesa_texstore_depth_component_float32(STORE_PARAMS)
srcFormat == GL_DEPTH_COMPONENT &&
srcType == GL_FLOAT) {
/* simple memcpy path */
memcpy_texture(dims,
memcpy_texture(ctx, dims,
dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset,
dstRowStride, dstImageStride,
srcWidth, srcHeight, srcDepth, srcFormat, srcType,
@@ -907,7 +908,7 @@ _mesa_texstore_depth_component16(STORE_PARAMS)
srcFormat == GL_DEPTH_COMPONENT &&
srcType == GL_UNSIGNED_SHORT) {
/* simple memcpy path */
memcpy_texture(dims,
memcpy_texture(ctx, dims,
dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset,
dstRowStride, dstImageStride,
srcWidth, srcHeight, srcDepth, srcFormat, srcType,
@@ -958,7 +959,7 @@ _mesa_texstore_rgb565(STORE_PARAMS)
srcFormat == GL_RGB &&
srcType == GL_UNSIGNED_SHORT_5_6_5) {
/* simple memcpy path */
memcpy_texture(dims,
memcpy_texture(ctx, dims,
dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset,
dstRowStride, dstImageStride,
srcWidth, srcHeight, srcDepth, srcFormat, srcType,
@@ -1067,7 +1068,7 @@ _mesa_texstore_rgba8888(STORE_PARAMS)
((srcFormat == GL_RGBA && srcType == GL_UNSIGNED_INT_8_8_8_8) ||
(srcFormat == GL_ABGR_EXT && srcType == GL_UNSIGNED_INT_8_8_8_8_REV))) {
/* simple memcpy path */
memcpy_texture(dims,
memcpy_texture(ctx, dims,
dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset,
dstRowStride, dstImageStride,
srcWidth, srcHeight, srcDepth, srcFormat, srcType,
@@ -1173,7 +1174,7 @@ _mesa_texstore_argb8888(STORE_PARAMS)
((srcType == GL_UNSIGNED_BYTE && littleEndian) ||
srcType == GL_UNSIGNED_INT_8_8_8_8_REV)) {
/* simple memcpy path (little endian) */
memcpy_texture(dims,
memcpy_texture(ctx, dims,
dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset,
dstRowStride, dstImageStride,
srcWidth, srcHeight, srcDepth, srcFormat, srcType,
@@ -1187,7 +1188,7 @@ _mesa_texstore_argb8888(STORE_PARAMS)
((srcType == GL_UNSIGNED_BYTE && !littleEndian) ||
srcType == GL_UNSIGNED_INT_8_8_8_8)) {
/* simple memcpy path (big endian) */
memcpy_texture(dims,
memcpy_texture(ctx, dims,
dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset,
dstRowStride, dstImageStride,
srcWidth, srcHeight, srcDepth, srcFormat, srcType,
@@ -1348,7 +1349,7 @@ _mesa_texstore_rgb888(STORE_PARAMS)
srcType == GL_UNSIGNED_BYTE &&
littleEndian) {
/* simple memcpy path */
memcpy_texture(dims,
memcpy_texture(ctx, dims,
dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset,
dstRowStride, dstImageStride,
srcWidth, srcHeight, srcDepth, srcFormat, srcType,
@@ -1453,7 +1454,7 @@ _mesa_texstore_bgr888(STORE_PARAMS)
srcType == GL_UNSIGNED_BYTE &&
littleEndian) {
/* simple memcpy path */
memcpy_texture(dims,
memcpy_texture(ctx, dims,
dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset,
dstRowStride, dstImageStride,
srcWidth, srcHeight, srcDepth, srcFormat, srcType,
@@ -1537,7 +1538,7 @@ _mesa_texstore_argb4444(STORE_PARAMS)
srcFormat == GL_BGRA &&
srcType == GL_UNSIGNED_SHORT_4_4_4_4_REV) {
/* simple memcpy path */
memcpy_texture(dims,
memcpy_texture(ctx, dims,
dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset,
dstRowStride, dstImageStride,
srcWidth, srcHeight, srcDepth, srcFormat, srcType,
@@ -1607,7 +1608,7 @@ _mesa_texstore_argb1555(STORE_PARAMS)
srcFormat == GL_BGRA &&
srcType == GL_UNSIGNED_SHORT_1_5_5_5_REV) {
/* simple memcpy path */
memcpy_texture(dims,
memcpy_texture(ctx, dims,
dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset,
dstRowStride, dstImageStride,
srcWidth, srcHeight, srcDepth, srcFormat, srcType,
@@ -1680,7 +1681,7 @@ _mesa_texstore_al88(STORE_PARAMS)
srcType == GL_UNSIGNED_BYTE &&
littleEndian) {
/* simple memcpy path */
memcpy_texture(dims,
memcpy_texture(ctx, dims,
dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset,
dstRowStride, dstImageStride,
srcWidth, srcHeight, srcDepth, srcFormat, srcType,
@@ -1744,7 +1745,7 @@ _mesa_texstore_rgb332(STORE_PARAMS)
baseInternalFormat == GL_RGB &&
srcFormat == GL_RGB && srcType == GL_UNSIGNED_BYTE_3_3_2) {
/* simple memcpy path */
memcpy_texture(dims,
memcpy_texture(ctx, dims,
dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset,
dstRowStride, dstImageStride,
srcWidth, srcHeight, srcDepth, srcFormat, srcType,
@@ -1802,7 +1803,7 @@ _mesa_texstore_a8(STORE_PARAMS)
baseInternalFormat == srcFormat &&
srcType == GL_UNSIGNED_BYTE) {
/* simple memcpy path */
memcpy_texture(dims,
memcpy_texture(ctx, dims,
dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset,
dstRowStride, dstImageStride,
srcWidth, srcHeight, srcDepth, srcFormat, srcType,
@@ -1856,7 +1857,7 @@ _mesa_texstore_ci8(STORE_PARAMS)
srcFormat == GL_COLOR_INDEX &&
srcType == GL_UNSIGNED_BYTE) {
/* simple memcpy path */
memcpy_texture(dims,
memcpy_texture(ctx, dims,
dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset,
dstRowStride, dstImageStride,
srcWidth, srcHeight, srcDepth, srcFormat, srcType,
@@ -1906,7 +1907,7 @@ _mesa_texstore_ycbcr(STORE_PARAMS)
ASSERT(baseInternalFormat == GL_YCBCR_MESA);
/* always just memcpy since no pixel transfer ops apply */
memcpy_texture(dims,
memcpy_texture(ctx, dims,
dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset,
dstRowStride, dstImageStride,
srcWidth, srcHeight, srcDepth, srcFormat, srcType,
@@ -1971,7 +1972,7 @@ _mesa_texstore_rgba_float32(STORE_PARAMS)
baseInternalFormat == srcFormat &&
srcType == GL_FLOAT) {
/* simple memcpy path */
memcpy_texture(dims,
memcpy_texture(ctx, dims,
dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset,
dstRowStride, dstImageStride,
srcWidth, srcHeight, srcDepth, srcFormat, srcType,
@@ -2039,7 +2040,7 @@ _mesa_texstore_rgba_float16(STORE_PARAMS)
baseInternalFormat == srcFormat &&
srcType == GL_HALF_FLOAT_ARB) {
/* simple memcpy path */
memcpy_texture(dims,
memcpy_texture(ctx, dims,
dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset,
dstRowStride, dstImageStride,
srcWidth, srcHeight, srcDepth, srcFormat, srcType,

View File

@@ -1,180 +0,0 @@
# Microsoft Developer Studio Project File - Name="math" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Static Library" 0x0104
CFG=math - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "math.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "math.mak" CFG="math - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "math - Win32 Release" (based on "Win32 (x86) Static Library")
!MESSAGE "math - Win32 Debug" (based on "Win32 (x86) Static Library")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "math - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
# ADD CPP /nologo /W3 /GX /O2 /I "../../../include" /I "../" /I "../main" /I "../glapi" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo
!ELSEIF "$(CFG)" == "math - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../../../include" /I "../" /I "../main" /I "../glapi" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /FR /YX /FD /GZ /c
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo
!ENDIF
# Begin Target
# Name "math - Win32 Release"
# Name "math - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=.\m_debug_clip.c
# End Source File
# Begin Source File
SOURCE=.\m_debug_norm.c
# End Source File
# Begin Source File
SOURCE=.\m_debug_xform.c
# End Source File
# Begin Source File
SOURCE=.\m_eval.c
# End Source File
# Begin Source File
SOURCE=.\m_matrix.c
# End Source File
# Begin Source File
SOURCE=.\m_translate.c
# End Source File
# Begin Source File
SOURCE=.\m_vector.c
# End Source File
# Begin Source File
SOURCE=.\m_xform.c
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# Begin Source File
SOURCE=.\m_clip_tmp.h
# End Source File
# Begin Source File
SOURCE=.\m_copy_tmp.h
# End Source File
# Begin Source File
SOURCE=.\m_debug.h
# End Source File
# Begin Source File
SOURCE=.\m_debug_util.h
# End Source File
# Begin Source File
SOURCE=.\m_dotprod_tmp.h
# End Source File
# Begin Source File
SOURCE=.\m_eval.h
# End Source File
# Begin Source File
SOURCE=.\m_matrix.h
# End Source File
# Begin Source File
SOURCE=.\m_norm_tmp.h
# End Source File
# Begin Source File
SOURCE=.\m_trans_tmp.h
# End Source File
# Begin Source File
SOURCE=.\m_translate.h
# End Source File
# Begin Source File
SOURCE=.\m_vector.h
# End Source File
# Begin Source File
SOURCE=.\m_xform.h
# End Source File
# Begin Source File
SOURCE=.\m_xform_tmp.h
# End Source File
# Begin Source File
SOURCE=.\mathmod.h
# End Source File
# End Group
# End Target
# End Project

View File

@@ -0,0 +1,64 @@
#include "grammar_crt.h"
#define GRAMMAR_PORT_BUILD 1
#include "grammar.c"
#undef GRAMMAR_PORT_BUILD
void grammar_alloc_free (void *ptr)
{
free (ptr);
}
void *grammar_alloc_malloc (unsigned int size)
{
return malloc (size);
}
void *grammar_alloc_realloc (void *ptr, unsigned int old_size, unsigned int size)
{
return realloc (ptr, size);
}
void *grammar_memory_copy (void *dst, const void * src, unsigned int size)
{
return memcpy (dst, src, size);
}
int grammar_string_compare (const byte *str1, const byte *str2)
{
return strcmp ((const char *) str1, (const char *) str2);
}
int grammar_string_compare_n (const byte *str1, const byte *str2, unsigned int n)
{
return strncmp ((const char *) str1, (const char *) str2, n);
}
byte *grammar_string_copy (byte *dst, const byte *src)
{
return (byte *) strcpy ((char *) dst, (const char *) src);
}
byte *grammar_string_copy_n (byte *dst, const byte *src, unsigned int n)
{
return (byte *) strncpy ((char *) dst, (const char *) src, n);
}
unsigned int grammar_string_length (const byte *str)
{
return strlen ((const char *) str);
}
byte *grammar_string_duplicate (const byte *src)
{
const unsigned int size = grammar_string_length (src);
byte *str = grammar_alloc_malloc (size + 1);
if (str != NULL)
{
grammar_memory_copy (str, src, size);
str[size] = '\0';
}
return str;
}

View File

@@ -0,0 +1,20 @@
#ifndef GRAMMAR_CRT_H
#define GRAMMAR_CRT_H
#include <stdlib.h>
#include <malloc.h>
#include <string.h>
typedef unsigned long grammar;
typedef unsigned char byte;
#define GRAMMAR_PORT_INCLUDE 1
#include "grammar.h"
#undef GRAMMAR_PORT_INCLUDE
#endif

View File

@@ -1,493 +0,0 @@
# Microsoft Developer Studio Project File - Name="shader" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Static Library" 0x0104
CFG=shader - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "shader.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "shader.mak" CFG="shader - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "shader - Win32 Release" (based on "Win32 (x86) Static Library")
!MESSAGE "shader - Win32 Debug" (based on "Win32 (x86) Static Library")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "shader - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
# ADD CPP /nologo /W3 /GX /O2 /I "../../../include" /I "../" /I "../main" /I "../glapi" /I "slang" /I "slang/OSDependent/Windows" /I "slang/OGLCompilersDLL" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /Zm500 /c
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo
!ELSEIF "$(CFG)" == "shader - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../../../include" /I "../" /I "../main" /I "../glapi" /I "slang" /I "slang/OSDependent/Windows" /I "slang/OGLCompilersDLL" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /Zm500 /GZ /c
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo
!ENDIF
# Begin Target
# Name "shader - Win32 Release"
# Name "shader - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=.\arbfragparse.c
# End Source File
# Begin Source File
SOURCE=.\arbprogparse.c
# End Source File
# Begin Source File
SOURCE=.\arbprogram.c
# End Source File
# Begin Source File
SOURCE=.\arbvertparse.c
# End Source File
# Begin Source File
SOURCE=.\atifragshader.c
# End Source File
# Begin Source File
SOURCE=.\grammar.c
# PROP Exclude_From_Build 1
# End Source File
# Begin Source File
SOURCE=.\grammar_mesa.c
# End Source File
# Begin Source File
SOURCE=.\nvfragparse.c
# End Source File
# Begin Source File
SOURCE=.\nvprogram.c
# End Source File
# Begin Source File
SOURCE=.\nvvertexec.c
# End Source File
# Begin Source File
SOURCE=.\nvvertparse.c
# End Source File
# Begin Source File
SOURCE=.\program.c
# End Source File
# Begin Source File
SOURCE=.\shaderobjects.c
# End Source File
# Begin Source File
SOURCE=.\shaderobjects_3dlabs.c
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# Begin Source File
SOURCE=.\arbfragparse.h
# End Source File
# Begin Source File
SOURCE=.\arbprogparse.h
# End Source File
# Begin Source File
SOURCE=.\arbprogram.h
# End Source File
# Begin Source File
SOURCE=.\arbprogram_syn.h
# End Source File
# Begin Source File
SOURCE=.\arbvertparse.h
# End Source File
# Begin Source File
SOURCE=.\atifragshader.h
# End Source File
# Begin Source File
SOURCE=.\grammar.h
# End Source File
# Begin Source File
SOURCE=.\grammar_mesa.h
# End Source File
# Begin Source File
SOURCE=.\grammar_syn.h
# End Source File
# Begin Source File
SOURCE=.\nvfragparse.h
# End Source File
# Begin Source File
SOURCE=.\nvfragprog.h
# End Source File
# Begin Source File
SOURCE=.\nvprogram.h
# End Source File
# Begin Source File
SOURCE=.\nvvertexec.h
# End Source File
# Begin Source File
SOURCE=.\nvvertparse.h
# End Source File
# Begin Source File
SOURCE=.\nvvertprog.h
# End Source File
# Begin Source File
SOURCE=.\program.h
# End Source File
# Begin Source File
SOURCE=.\shaderobjects.h
# End Source File
# Begin Source File
SOURCE=.\shaderobjects_3dlabs.h
# End Source File
# End Group
# Begin Group "slang"
# PROP Default_Filter ""
# Begin Group "Include"
# PROP Default_Filter ""
# Begin Source File
SOURCE=.\slang\Include\BaseTypes.h
# End Source File
# Begin Source File
SOURCE=.\slang\Include\Common.h
# End Source File
# Begin Source File
SOURCE=.\slang\Include\ConstantUnion.h
# End Source File
# Begin Source File
SOURCE=.\slang\Include\InfoSink.h
# End Source File
# Begin Source File
SOURCE=.\slang\Include\InitializeGlobals.h
# End Source File
# Begin Source File
SOURCE=.\slang\Include\InitializeParseContext.h
# End Source File
# Begin Source File
SOURCE=.\slang\Include\intermediate.h
# End Source File
# Begin Source File
SOURCE=.\slang\Include\PoolAlloc.h
# End Source File
# Begin Source File
SOURCE=.\slang\Include\ResourceLimits.h
# End Source File
# Begin Source File
SOURCE=.\slang\Include\ShHandle.h
# End Source File
# Begin Source File
SOURCE=.\slang\Include\Types.h
# End Source File
# End Group
# Begin Group "MachineIndependent"
# PROP Default_Filter ""
# Begin Group "preprocessor"
# PROP Default_Filter ""
# Begin Source File
SOURCE=.\slang\MachineIndependent\preprocessor\atom.c
# End Source File
# Begin Source File
SOURCE=.\slang\MachineIndependent\preprocessor\atom.h
# End Source File
# Begin Source File
SOURCE=.\slang\MachineIndependent\preprocessor\compile.h
# End Source File
# Begin Source File
SOURCE=.\slang\MachineIndependent\preprocessor\cpp.c
# End Source File
# Begin Source File
SOURCE=.\slang\MachineIndependent\preprocessor\cpp.h
# End Source File
# Begin Source File
SOURCE=.\slang\MachineIndependent\preprocessor\cppstruct.c
# End Source File
# Begin Source File
SOURCE=.\slang\MachineIndependent\preprocessor\memory.c
# End Source File
# Begin Source File
SOURCE=.\slang\MachineIndependent\preprocessor\memory.h
# End Source File
# Begin Source File
SOURCE=.\slang\MachineIndependent\preprocessor\parser.h
# End Source File
# Begin Source File
SOURCE=.\slang\MachineIndependent\preprocessor\preprocess.h
# End Source File
# Begin Source File
SOURCE=.\slang\MachineIndependent\preprocessor\scanner.c
# End Source File
# Begin Source File
SOURCE=.\slang\MachineIndependent\preprocessor\scanner.h
# End Source File
# Begin Source File
SOURCE=.\slang\MachineIndependent\preprocessor\slglobals.h
# End Source File
# Begin Source File
SOURCE=.\slang\MachineIndependent\preprocessor\symbols.c
# End Source File
# Begin Source File
SOURCE=.\slang\MachineIndependent\preprocessor\symbols.h
# End Source File
# Begin Source File
SOURCE=.\slang\MachineIndependent\preprocessor\tokens.c
# End Source File
# Begin Source File
SOURCE=.\slang\MachineIndependent\preprocessor\tokens.h
# End Source File
# End Group
# Begin Source File
SOURCE=.\slang\MachineIndependent\Gen_glslang.cpp
# End Source File
# Begin Source File
SOURCE=.\slang\MachineIndependent\Gen_glslang_tab.cpp
# End Source File
# Begin Source File
SOURCE=.\slang\MachineIndependent\glslang_tab.h
# End Source File
# Begin Source File
SOURCE=.\slang\MachineIndependent\InfoSink.cpp
# End Source File
# Begin Source File
SOURCE=.\slang\MachineIndependent\Initialize.cpp
# End Source File
# Begin Source File
SOURCE=.\slang\MachineIndependent\Initialize.h
# End Source File
# Begin Source File
SOURCE=.\slang\MachineIndependent\Intermediate.cpp
# End Source File
# Begin Source File
SOURCE=.\slang\MachineIndependent\intermOut.cpp
# End Source File
# Begin Source File
SOURCE=.\slang\MachineIndependent\IntermTraverse.cpp
# End Source File
# Begin Source File
SOURCE=.\slang\MachineIndependent\localintermediate.h
# End Source File
# Begin Source File
SOURCE=.\slang\MachineIndependent\MMap.h
# End Source File
# Begin Source File
SOURCE=.\slang\MachineIndependent\parseConst.cpp
# End Source File
# Begin Source File
SOURCE=.\slang\MachineIndependent\ParseHelper.cpp
# End Source File
# Begin Source File
SOURCE=.\slang\MachineIndependent\ParseHelper.h
# End Source File
# Begin Source File
SOURCE=.\slang\MachineIndependent\PoolAlloc.cpp
# End Source File
# Begin Source File
SOURCE=.\slang\MachineIndependent\QualifierAlive.cpp
# End Source File
# Begin Source File
SOURCE=.\slang\MachineIndependent\QualifierAlive.h
# End Source File
# Begin Source File
SOURCE=.\slang\MachineIndependent\RemoveTree.cpp
# End Source File
# Begin Source File
SOURCE=.\slang\MachineIndependent\RemoveTree.h
# End Source File
# Begin Source File
SOURCE=.\slang\MachineIndependent\ShaderLang.cpp
# End Source File
# Begin Source File
SOURCE=.\slang\MachineIndependent\SymbolTable.cpp
# End Source File
# Begin Source File
SOURCE=.\slang\MachineIndependent\SymbolTable.h
# End Source File
# Begin Source File
SOURCE=.\slang\MachineIndependent\unistd.h
# End Source File
# End Group
# Begin Group "OGLCompilersDLL"
# PROP Default_Filter ""
# Begin Source File
SOURCE=.\slang\OGLCompilersDLL\Initialisation.cpp
# End Source File
# Begin Source File
SOURCE=.\slang\OGLCompilersDLL\Initialisation.h
# End Source File
# End Group
# Begin Group "OSDependent"
# PROP Default_Filter ""
# Begin Group "Windows"
# PROP Default_Filter ""
# Begin Source File
SOURCE=.\slang\OSDependent\Windows\osinclude.h
# End Source File
# Begin Source File
SOURCE=.\slang\OSDependent\Windows\ossource.cpp
# End Source File
# End Group
# End Group
# Begin Group "Public"
# PROP Default_Filter ""
# Begin Source File
SOURCE=.\slang\Public\ShaderLang.h
# End Source File
# Begin Source File
SOURCE=.\slang\Public\ShaderLangExt.h
# End Source File
# End Group
# Begin Source File
SOURCE=.\slang\slang_mesa.cpp
# End Source File
# Begin Source File
SOURCE=.\slang\slang_mesa.h
# End Source File
# Begin Source File
SOURCE=.\slang\traverse_wrap.h
# End Source File
# End Group
# End Target
# End Project

View File

@@ -631,10 +631,10 @@ _shader_Compile (struct gl2_shader_intf **intf)
{
impl->_obj.compile_status = GL_TRUE;
}
else
{
if (info_log.text != NULL)
impl->_obj._generic.info_log = _mesa_strdup (info_log.text);
}
else
impl->_obj._generic.info_log = _mesa_strdup ("");
slang_info_log_destruct (&info_log);
#endif
}

View File

@@ -1,6 +1,6 @@
# Makefile for core library for VMS
# contributed by Jouk Jansen joukj@hrem.stm.tudelft.nl
# Last revision : 3 May 2005
# Last revision : 20 May 2005
.first
define gl [----.include.gl]
@@ -22,7 +22,10 @@ SOURCES = \
slang_compile.c,slang_preprocess.c
OBJECTS = \
slang_compile.obj,slang_preprocess.obj,slang_utility.obj
slang_compile.obj,slang_preprocess.obj,slang_utility.obj,\
slang_execute.obj,slang_assemble.obj,slang_assemble_conditional.obj,\
slang_assemble_constructor.obj,slang_assemble_typeinfo.obj,\
slang_storage.obj
##### RULES #####
@@ -40,3 +43,9 @@ clean :
slang_compile.obj : slang_compile.c
slang_preprocess.obj : slang_preprocess.c
slang_utility.obj : slang_utility.c
slang_execute.obj : slang_execute.c
slang_assemble.obj : slang_assemble.c
slang_assemble_conditional.obj : slang_assemble_conditional.c
slang_assemble_constructor.obj : slang_assemble_constructor.c
slang_assemble_typeinfo.obj : slang_assemble_typeinfo.c
slang_storage.obj : slang_storage.c

View File

@@ -0,0 +1,79 @@
#include "../../grammar/grammar_crt.h"
#include "../../grammar/grammar_crt.c"
#include <stdio.h>
static const char *slang_shader_syn =
#include "slang_shader_syn.h"
;
static void gc_to_bin (grammar id, const char *in, const char *out)
{
FILE *f;
byte *source, *prod;
unsigned int size, i, line = 0;
f = fopen (in, "r");
if (f == NULL)
return;
fseek (f, 0, SEEK_END);
size = ftell (f);
fseek (f, 0, SEEK_SET);
source = (byte *) grammar_alloc_malloc (size + 1);
source[fread (source, 1, size, f)] = '\0';
fclose (f);
if (!grammar_fast_check (id, source, &prod, &size, 65536))
{
grammar_alloc_free (source);
return;
}
f = fopen (out, "w");
for (i = 0; i < size; i++)
{
unsigned int a;
if (prod[i] < 10)
a = 1;
else if (prod[i] < 100)
a = 2;
else
a = 3;
if (i < size - 1)
a++;
if (line + a > 100)
{
fprintf (f, "\n");
line = 0;
}
line += a;
fprintf (f, "%d", prod[i]);
if (i < size - 1)
fprintf (f, ",");
}
fclose (f);
grammar_alloc_free (prod);
}
int main ()
{
grammar id;
id = grammar_load_from_text ((const byte *) slang_shader_syn);
if (id == 0)
return 1;
grammar_set_reg8 (id, (const byte *) "parsing_builtin", 1);
grammar_set_reg8 (id, (const byte *) "shader_type", 1);
gc_to_bin (id, "slang_core.gc", "slang_core_gc_bin.h");
gc_to_bin (id, "slang_common_builtin.gc", "slang_common_builtin_gc_bin.h");
gc_to_bin (id, "slang_fragment_builtin.gc", "slang_fragment_builtin_gc_bin.h");
grammar_set_reg8 (id, (const byte *) "shader_type", 2);
gc_to_bin (id, "slang_vertex_builtin.gc", "slang_vertex_builtin_gc_bin.h");
grammar_destroy (id);
return 0;
}

File diff suppressed because it is too large Load Diff

View File

@@ -63,30 +63,12 @@
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"int __constructor (const float _f) {\n"
" int _i;\n"
" __asm float_to_int _i, _f;\n"
" return _i;\n"
"}\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"bool __constructor (const int _i) {\n"
" return _i != 0;\n"
"}\n"
@@ -95,11 +77,6 @@
" return _f != 0.0;\n"
"}\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"int __constructor (const bool _b) {\n"
" return _b ? 1 : 0;\n"
"}\n"
@@ -108,20 +85,12 @@
" return _b ? 1.0 : 0.0;\n"
"}\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"float __constructor (const int _i) {\n"
" float _f;\n"
" __asm int_to_float _f, _i;\n"
" return _f;\n"
"}\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"bool __constructor (const bool _b) {\n"
" return _b;\n"
"}\n"
@@ -134,30 +103,6 @@
" return _f;\n"
"}\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"vec2 __constructor (const float _f) {\n"
" return vec2 (_f, _f);\n"
"}\n"
@@ -266,17 +211,6 @@
" return bvec4 (_i, _i, _i, _i);\n"
"}\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"mat2 __constructor (const float _f) {\n"
" return mat2 (\n"
" _f, .0,\n"
@@ -369,65 +303,40 @@
"\n"
"\n"
"\n"
"void __operator = (out float a, const float b) {\n"
" __asm float_copy a, b;\n"
"}\n"
"\n"
"void __operator = (out int a, const int b) {\n"
" __asm int_copy a, b;\n"
"}\n"
"\n"
"void __operator = (out bool a, const bool b) {\n"
" __asm bool_copy a, b;\n"
"}\n"
"\n"
"void __operator = (out vec2 v, const vec2 u) {\n"
" v.x = u.x, v.y = u.y;\n"
"}\n"
"\n"
"void __operator = (out vec3 v, const vec3 u) {\n"
" v.x = u.x, v.y = u.y, v.z = u.z;\n"
"}\n"
"\n"
"void __operator = (out vec4 v, const vec4 u) {\n"
" v.x = u.x, v.y = u.y, v.z = u.z, v.w = u.w;\n"
"}\n"
"\n"
"void __operator = (out ivec2 v, const ivec2 u) {\n"
" v.x = u.x, v.y = u.y;\n"
"}\n"
"\n"
"void __operator = (out ivec3 v, const ivec3 u) {\n"
" v.x = u.x, v.y = u.y, v.z = u.z;\n"
"}\n"
"\n"
"void __operator = (out ivec4 v, const ivec4 u) {\n"
" v.x = u.x, v.y = u.y, v.z = u.z, v.w = u.w;\n"
"}\n"
"\n"
"void __operator = (out bvec2 v, const bvec2 u) {\n"
" v.x = u.x, v.y = u.y;\n"
"}\n"
"\n"
"void __operator = (out bvec3 v, const bvec3 u) {\n"
" v.x = u.x, v.y = u.y, v.z = u.z;\n"
"}\n"
"\n"
"void __operator = (out bvec4 v, const bvec4 u) {\n"
" v.x = u.x, v.y = u.y, v.z = u.z, v.w = u.w;\n"
"}\n"
"\n"
"void __operator = (out mat2 m, const mat2 n) {\n"
" m[0] = n[0], m[1] = n[1];\n"
"}\n"
"\n"
"void __operator = (out mat3 m, const mat3 n) {\n"
" m[0] = n[0], m[1] = n[1], m[2] = n[2];\n"
"}\n"
"\n"
"void __operator = (out mat4 m, const mat4 n) {\n"
" m[0] = n[0], m[1] = n[1], m[2] = n[2], m[3] = n[3];\n"
"}\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
@@ -438,6 +347,12 @@
" __asm float_add a, a, b;\n"
"}\n"
"\n"
"float __operator - (const float a) {\n"
" float c;\n"
" __asm float_negate c, a;\n"
" return c;\n"
"}\n"
"\n"
"void __operator -= (inout float a, const float b) {\n"
" a += -b;\n"
"}\n"
@@ -450,20 +365,42 @@
" __asm float_divide a, a, b;\n"
"}\n"
"\n"
"void __operator += (inout int x, const int y) {\n"
" x = int (float (x) + float (y));\n"
"float __operator + (const float a, const float b) {\n"
" float c;\n"
" c = a;\n"
" return c += b;\n"
"}\n"
"\n"
"void __operator -= (inout int x, const int y) {\n"
" x += -y;\n"
"void __operator += (inout int a, const int b) {\n"
" a = int (float (a) + float (b));\n"
"}\n"
"\n"
"void __operator *= (inout int x, const int y) {\n"
" x = int (float (x) * float (y));\n"
"int __operator - (const int a) {\n"
" return int (-float (a));\n"
"}\n"
"\n"
"void __operator /= (inout int x, const int y) {\n"
" x = int (float (x) / float (y));\n"
"void __operator -= (inout int a, const int b) {\n"
" a += -b;\n"
"}\n"
"\n"
"float __operator * (const float a, const float b) {\n"
" float c;\n"
" c = a;\n"
" return c *= b;\n"
"}\n"
"\n"
"void __operator *= (inout int a, const int b) {\n"
" a = int (float (a) * float (b));\n"
"}\n"
"\n"
"float __operator / (const float a, const float b) {\n"
" float c;\n"
" c = a;\n"
" return c /= b;\n"
"}\n"
"\n"
"void __operator /= (inout int a, const int b) {\n"
" a = int (float (a) / float (b));\n"
"}\n"
"\n"
"void __operator += (inout vec2 v, const vec2 u) {\n"
@@ -566,10 +503,21 @@
" m[0] += n[0], m[1] += n[1];\n"
"}\n"
"\n"
"void __operator -= (inout mat2 v, const mat2 n) {\n"
"void __operator -= (inout mat2 m, const mat2 n) {\n"
" m[0] -= n[0], m[1] -= n[1];\n"
"}\n"
"\n"
"vec2 __operator * (const mat2 m, const vec2 v) {\n"
" return vec2 (\n"
" v.x * m[0].x + v.y * m[1].x,\n"
" v.x * m[0].y + v.y * m[1].y\n"
" );\n"
"}\n"
"\n"
"mat2 __operator * (const mat2 m, const mat2 n) {\n"
" return mat2 (m * n[0], m * n[1]);\n"
"}\n"
"\n"
"void __operator *= (inout mat2 m, const mat2 n) {\n"
" m = m * n;\n"
"}\n"
@@ -586,6 +534,18 @@
" m[0] -= n[0], m[1] -= n[1], m[2] -= n[2];\n"
"}\n"
"\n"
"vec3 __operator * (const mat3 m, const vec3 v) {\n"
" return vec3 (\n"
" v.x * m[0].x + v.y * m[1].x + v.z * m[2].x,\n"
" v.x * m[0].y + v.y * m[1].y + v.z * m[2].y,\n"
" v.x * m[0].z + v.y * m[1].z + v.z * m[2].z\n"
" );\n"
"}\n"
"\n"
"mat3 __operator * (const mat3 m, const mat3 n) {\n"
" return mat3 (m * n[0], m * n[1], m * n[2]);\n"
"}\n"
"\n"
"void __operator *= (inout mat3 m, const mat3 n) {\n"
" m = m * n;\n"
"}\n"
@@ -602,6 +562,19 @@
" m[0] -= n[0], m[1] -= n[1], m[2] -= n[2], m[3] -= n[3];\n"
"}\n"
"\n"
"vec4 __operator * (const mat4 m, const vec4 v) {\n"
" return vec4 (\n"
" v.x * m[0].x + v.y * m[1].x + v.z * m[2].x + v.w * m[3].x,\n"
" v.x * m[0].y + v.y * m[1].y + v.z * m[2].y + v.w * m[3].y,\n"
" v.x * m[0].z + v.y * m[1].z + v.z * m[2].z + v.w * m[3].z,\n"
" v.x * m[0].w + v.y * m[1].w + v.z * m[2].w + v.w * m[3].w\n"
" );\n"
"}\n"
"\n"
"mat4 __operator * (const mat4 m, const mat4 n) {\n"
" return mat4 (m * n[0], m * n[1], m * n[2], m * n[3]);\n"
"}\n"
"\n"
"void __operator *= (inout mat4 m, const mat4 n) {\n"
" m = m * n;\n"
"}\n"
@@ -610,11 +583,6 @@
" m[0] /= n[0], m[1] /= n[1], m[2] /= n[2], m[3] /= n[3];\n"
"}\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"void __operator += (inout vec2 v, const float a) {\n"
" v.x += a, v.y += a;\n"
"}\n"
@@ -711,73 +679,64 @@
" m[0] /= a, m[1] /= a, m[2] /= a, m[3] /= a;\n"
"}\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"vec2 __operator * (const vec2 v, const mat2 m) {\n"
" return vec2 (\n"
" v.x * m[0].x + v.y * m[0].y,\n"
" v.x * m[1].x + v.y * m[1].y\n"
" );\n"
"}\n"
"\n"
"void __operator *= (inout vec2 v, const mat2 m) {\n"
" v = v * m;\n"
"}\n"
"\n"
"vec3 __operator * (const vec3 v, const mat3 m) {\n"
" return vec3 (\n"
" v.x * m[0].x + v.y * m[0].y + v.z * m[0].z,\n"
" v.x * m[1].x + v.y * m[1].y + v.z * m[1].z,\n"
" v.x * m[2].x + v.y * m[2].y + v.z * m[2].z\n"
" );\n"
"}\n"
"\n"
"void __operator *= (inout vec3 v, const mat3 m) {\n"
" v = v * m;\n"
"}\n"
"\n"
"void __operator *= (inout vec4 v, const mat4 m) {\n"
" v = v * m;\n"
"vec4 __operator * (const vec4 v, const mat4 m) {\n"
" return vec4 (\n"
" v.x * m[0].x + v.y * m[0].y + v.z * m[0].z + v.w * m[0].w,\n"
" v.x * m[1].x + v.y * m[1].y + v.z * m[1].z + v.w * m[1].w,\n"
" v.x * m[2].x + v.y * m[2].y + v.z * m[2].z + v.w * m[2].w,\n"
" v.x * m[3].x + v.y * m[3].y + v.z * m[3].z + v.w * m[3].w\n"
" );\n"
"}\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"float __operator + (const float a, const float b) {\n"
" float c = a;\n"
" return c += b;\n"
"void __operator *= (inout vec4 v, const mat4 m) {\n"
" v = v * m;\n"
"}\n"
"\n"
"float __operator - (const float a, const float b) {\n"
" return a + -b;\n"
"}\n"
"\n"
"float __operator * (const float a, const float b) {\n"
" float c = a;\n"
" return c *= b;\n"
"}\n"
"\n"
"float __operator / (const float a, const float b) {\n"
" float c = a;\n"
" return c /= b;\n"
"}\n"
"\n"
"int __operator + (const int a, const int b) {\n"
" int c = a;\n"
" int c;\n"
" c = a;\n"
" return c += b;\n"
"}\n"
"\n"
"int __operator - (const int x, const int y) {\n"
" return x + -y;\n"
"int __operator - (const int a, const int b) {\n"
" return a + -b;\n"
"}\n"
"\n"
"int __operator * (const int x, const int y) {\n"
" int z = x;\n"
" return z *= y;\n"
"int __operator * (const int a, const int b) {\n"
" int c;\n"
" return (c = a) *= b;\n"
"}\n"
"\n"
"int __operator / (const int x, const int y) {\n"
" int z = x;\n"
" return z /= y;\n"
"int __operator / (const int a, const int b) {\n"
" int c;\n"
" return (c = a) /= b;\n"
"}\n"
"\n"
"vec2 __operator + (const vec2 v, const vec2 u) {\n"
@@ -852,10 +811,6 @@
" return mat4 (m[0] - n[0], m[1] - n[1], m[2] - n[2], m[3] - n[3]);\n"
"}\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"vec2 __operator + (const float a, const vec2 u) {\n"
" return vec2 (a + u.x, a + u.y);\n"
"}\n"
@@ -1048,10 +1003,6 @@
" return mat4 (m[0] / b, m[1] / b, m[2] / b, m[3] / b);\n"
"}\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"ivec2 __operator + (const int a, const ivec2 u) {\n"
" return ivec2 (a + u.x, a + u.y);\n"
"}\n"
@@ -1148,70 +1099,6 @@
" return ivec4 (v.x / b, v.y / b, v.z / b, v.w / b);\n"
"}\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"vec2 __operator * (const mat2 m, const vec2 v) {\n"
" return vec2 (\n"
" v.x * m[0].x + v.y * m[1].x,\n"
" v.x * m[0].y + v.y * m[1].y\n"
" );\n"
"}\n"
"\n"
"vec2 __operator * (const vec2 v, const mat2 m) {\n"
" return vec2 (\n"
" v.x * m[0].x + v.y * m[0].y,\n"
" v.x * m[1].x + v.y * m[1].y\n"
" );\n"
"}\n"
"\n"
"vec3 __operator * (const mat3 m, const vec3 v) {\n"
" return vec3 (\n"
" v.x * m[0].x + v.y * m[1].x + v.z * m[2].x,\n"
" v.x * m[0].y + v.y * m[1].y + v.z * m[2].y,\n"
" v.x * m[0].z + v.y * m[1].z + v.z * m[2].z\n"
" );\n"
"}\n"
"\n"
"vec3 __operator * (const vec3 v, const mat3 m) {\n"
" return vec3 (\n"
" v.x * m[0].x + v.y * m[0].y + v.z * m[0].z,\n"
" v.x * m[1].x + v.y * m[1].y + v.z * m[1].z,\n"
" v.x * m[2].x + v.y * m[2].y + v.z * m[2].z\n"
" );\n"
"}\n"
"\n"
"vec4 __operator * (const mat4 m, const vec4 v) {\n"
" return vec4 (\n"
" v.x * m[0].x + v.y * m[1].x + v.z * m[2].x + v.w * m[3].x,\n"
" v.x * m[0].y + v.y * m[1].y + v.z * m[2].y + v.w * m[3].y,\n"
" v.x * m[0].z + v.y * m[1].z + v.z * m[2].z + v.w * m[3].z,\n"
" v.x * m[0].w + v.y * m[1].w + v.z * m[2].w + v.w * m[3].w\n"
" );\n"
"}\n"
"\n"
"vec4 __operator * (const vec4 v, const mat4 m) {\n"
" return vec4 (\n"
" v.x * m[0].x + v.y * m[0].y + v.z * m[0].z + v.w * m[0].w,\n"
" v.x * m[1].x + v.y * m[1].y + v.z * m[1].z + v.w * m[1].w,\n"
" v.x * m[2].x + v.y * m[2].y + v.z * m[2].z + v.w * m[2].w,\n"
" v.x * m[3].x + v.y * m[3].y + v.z * m[3].z + v.w * m[3].w\n"
" );\n"
"}\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"vec2 __operator * (const vec2 v, const vec2 u) {\n"
" return vec2 (v.x * u.x, v.y * u.y);\n"
"}\n"
@@ -1236,10 +1123,6 @@
" return ivec4 (v.x * u.x, v.y * u.y, v.z * u.z, v.w * u.w);\n"
"}\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"vec2 __operator / (const vec2 v, const vec2 u) {\n"
" return vec2 (v.x / u.x, v.y / u.y);\n"
"}\n"
@@ -1276,48 +1159,6 @@
" return mat4 (m[0] / n[0], m[1] / n[1], m[2] / n[2], m[3] / n[3]);\n"
"}\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"mat2 __operator * (const mat2 m, const mat2 n) {\n"
" return mat2 (m * n[0], m * n[1]);\n"
"}\n"
"\n"
"mat3 __operator * (const mat3 m, const mat3 n) {\n"
" return mat3 (m * n[0], m * n[1], m * n[2]);\n"
"}\n"
"\n"
"mat4 __operator * (const mat4 m, const mat4 n) {\n"
" return mat4 (m * n[0], m * n[1], m * n[2], m * n[3]);\n"
"}\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"float __operator - (const float a) {\n"
" float c;\n"
" __asm float_negate c, a;\n"
" return c;\n"
"}\n"
"\n"
"int __operator - (const int a) {\n"
" return int (-float (a));\n"
"}\n"
"\n"
"vec2 __operator - (const vec2 v) {\n"
" return vec2 (-v.x, -v.y);\n"
"}\n"
@@ -1354,6 +1195,11 @@
" return mat4 (-m[0], -m[1], -m[2], -m[3]);\n"
"}\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"void __operator -- (inout float a) {\n"
" a -= 1.0;\n"
"}\n"
@@ -1443,13 +1289,15 @@
"}\n"
"\n"
"float __operator -- (inout float a, const int) {\n"
" const float c = a;\n"
" float c;\n"
" c = a;\n"
" --a;\n"
" return c;\n"
"}\n"
"\n"
"int __operator -- (inout int a, const int) {\n"
" const int c = a;\n"
" int c;\n"
" c = a;\n"
" --a;\n"
" return c;\n"
"}\n"
@@ -1491,13 +1339,15 @@
"}\n"
"\n"
"float __operator ++ (inout float a, const int) {\n"
" const float c = a;\n"
" float c;\n"
" c = a;\n"
" ++a;\n"
" return c;\n"
"}\n"
"\n"
"int __operator ++ (inout int a, const int) {\n"
" const int c = a;\n"
" int c;\n"
" c = a;\n"
" ++a;\n"
" return c;\n"
"}\n"
@@ -1538,14 +1388,6 @@
" return mat4 (m[0]++, m[1]++, m[2]++, m[3]++);\n"
"}\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"bool __operator < (const float a, const float b) {\n"
" bool c;\n"
" __asm float_less c, a, b;\n"
@@ -1587,127 +1429,112 @@
"\n"
"\n"
"\n"
"bool __operator == (const float a, const float b) {\n"
" bool c;\n"
" __asm float_equal c, a, b;\n"
" return c;\n"
"}\n"
"\n"
"bool __operator == (const int a, const int b) {\n"
" return float (a) == float (b);\n"
"}\n"
"\n"
"bool __operator == (const bool a, const bool b) {\n"
" return float (a) == float (b);\n"
"}\n"
"\n"
"bool __operator == (const vec2 v, const vec2 u) {\n"
" return v.x == u.x && v.y == u.y;\n"
"}\n"
"\n"
"bool __operator == (const vec3 v, const vec3 u) {\n"
" return v.x == u.x && v.y == u.y && v.z == u.z;\n"
"}\n"
"\n"
"bool __operator == (const vec4 v, const vec4 u) {\n"
" return v.x == u.x && v.y == u.y && v.z == u.z && v.w == u.w;\n"
"}\n"
"\n"
"bool __operator == (const ivec2 v, const ivec2 u) {\n"
" return v.x == u.x && v.y == u.y;\n"
"}\n"
"\n"
"bool __operator == (const ivec3 v, const ivec3 u) {\n"
" return v.x == u.x && v.y == u.y && v.z == u.z;\n"
"}\n"
"\n"
"bool __operator == (const ivec4 v, const ivec4 u) {\n"
" return v.x == u.x && v.y == u.y && v.z == u.z && v.w == u.w;\n"
"}\n"
"\n"
"bool __operator == (const bvec2 v, const bvec2 u) {\n"
" return v.x == u.x && v.y == u.y;\n"
"}\n"
"\n"
"bool __operator == (const bvec3 v, const bvec3 u) {\n"
" return v.x == u.x && v.y == u.y && v.z == u.z;\n"
"}\n"
"\n"
"bool __operator == (const bvec4 v, const bvec4 u) {\n"
" return v.x == u.x && v.y == u.y && v.z == u.z && v.w == u.w;\n"
"}\n"
"\n"
"bool __operator == (const mat2 m, const mat2 n) {\n"
" return m[0] == n[0] && m[1] == n[1];\n"
"}\n"
"\n"
"bool __operator == (const mat3 m, const mat3 n) {\n"
" return m[0] == n[0] && m[1] == n[1] && m[2] == n[2];\n"
"}\n"
"\n"
"bool __operator == (const mat4 m, const mat4 n) {\n"
" return m[0] == n[0] && m[1] == n[1] && m[2] == n[2] && m[3] == n[3];\n"
"}\n"
"\n"
"bool __operator != (const float a, const float b) {\n"
" return !(a == b);\n"
"}\n"
"\n"
"bool __operator != (const int a, const int b) {\n"
" return !(a == b);\n"
"}\n"
"\n"
"bool __operator != (const bool a, const bool b) {\n"
" return !(a == b);\n"
"}\n"
"\n"
"bool __operator != (const vec2 v, const vec2 u) {\n"
" return v.x != u.x || v.y != u.y;\n"
"}\n"
"\n"
"bool __operator != (const vec3 v, const vec3 u) {\n"
" return v.x != u.x || v.y != u.y || v.z != u.z;\n"
"}\n"
"\n"
"bool __operator != (const vec4 v, const vec4 u) {\n"
" return v.x != u.x || v.y != u.y || v.z != u.z || v.w != u.w;\n"
"}\n"
"\n"
"bool __operator != (const ivec2 v, const ivec2 u) {\n"
" return v.x != u.x || v.y != u.y;\n"
"}\n"
"\n"
"bool __operator != (const ivec3 v, const ivec3 u) {\n"
" return v.x != u.x || v.y != u.y || v.z != u.z;\n"
"}\n"
"\n"
"bool __operator != (const ivec4 v, const ivec4 u) {\n"
" return v.x != u.x || v.y != u.y || v.z != u.z || v.w != u.w;\n"
"}\n"
"\n"
"bool __operator != (const bvec2 v, const bvec2 u) {\n"
" return v.x != u.x || v.y != u.y;\n"
"}\n"
"\n"
"bool __operator != (const bvec3 v, const bvec3 u) {\n"
" return v.x != u.x || v.y != u.y || v.z != u.z;\n"
"}\n"
"\n"
"bool __operator != (const bvec4 v, const bvec4 u) {\n"
" return v.x != u.x || v.y != u.y || v.z != u.z || v.w != u.w;\n"
"}\n"
"\n"
"bool __operator != (const mat2 m, const mat2 n) {\n"
" return m[0] != n[0] || m[1] != n[1];\n"
"}\n"
"\n"
"bool __operator != (const mat3 m, const mat3 n) {\n"
" return m[0] != n[0] || m[1] != n[1] || m[2] != n[2];\n"
"}\n"
"\n"
"bool __operator != (const mat4 m, const mat4 n) {\n"
" return m[0] != n[0] || m[1] != n[1] || m[2] != n[2] || m[3] != n[3];\n"
"}\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
@@ -1732,11 +1559,6 @@
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"bool __operator ! (const bool a) {\n"
" return a == false;\n"
"}\n"

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,145 @@
/*
* Mesa 3-D graphics library
* Version: 6.3
*
* Copyright (C) 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.
*/
#if !defined SLANG_ASSEMBLE_H
#define SLANG_ASSEMBLE_H
#include "slang_compile.h"
#if defined __cplusplus
extern "C" {
#endif
typedef enum slang_assembly_type_
{
/* core */
slang_asm_none,
slang_asm_float_copy,
slang_asm_float_move,
slang_asm_float_push,
slang_asm_float_deref,
slang_asm_float_add,
slang_asm_float_multiply,
slang_asm_float_divide,
slang_asm_float_negate,
slang_asm_float_less,
slang_asm_float_equal,
slang_asm_float_to_int,
slang_asm_int_copy,
slang_asm_int_move,
slang_asm_int_push,
slang_asm_int_deref,
slang_asm_int_to_float,
slang_asm_int_to_addr,
slang_asm_bool_copy,
slang_asm_bool_move,
slang_asm_bool_push,
slang_asm_bool_deref,
slang_asm_addr_copy,
slang_asm_addr_push,
slang_asm_addr_deref,
slang_asm_addr_add,
slang_asm_addr_multiply,
slang_asm_jump,
slang_asm_jump_if_zero,
slang_asm_enter,
slang_asm_leave,
slang_asm_local_alloc,
slang_asm_local_free,
slang_asm_local_addr,
slang_asm_call,
slang_asm_return,
slang_asm_discard,
slang_asm_exit,
slang_asm__last
} slang_assembly_type;
typedef struct slang_assembly_
{
slang_assembly_type type;
GLfloat literal;
GLuint param[2];
} slang_assembly;
typedef struct slang_assembly_file_
{
slang_assembly *code;
unsigned int count;
} slang_assembly_file;
void slang_assembly_file_construct (slang_assembly_file *);
void slang_assembly_file_destruct (slang_assembly_file *);
int slang_assembly_file_push (slang_assembly_file *, slang_assembly_type);
int slang_assembly_file_push_label (slang_assembly_file *, slang_assembly_type, GLuint);
int slang_assembly_file_push_label2 (slang_assembly_file *, slang_assembly_type, GLuint, GLuint);
int slang_assembly_file_push_literal (slang_assembly_file *, slang_assembly_type, GLfloat);
typedef struct slang_assembly_flow_control_
{
unsigned int loop_start; /* for "continue" statement */
unsigned int loop_end; /* for "break" statement */
unsigned int function_end; /* for "return" statement */
} slang_assembly_flow_control;
typedef struct slang_assembly_name_space_
{
struct slang_function_scope_ *funcs;
struct slang_struct_scope_ *structs;
struct slang_variable_scope_ *vars;
} slang_assembly_name_space;
slang_function *_slang_locate_function (const char *name, slang_operation *params,
unsigned int num_params, slang_assembly_name_space *space);
int _slang_assemble_function (slang_assembly_file *, struct slang_function_ *,
slang_assembly_name_space *);
typedef struct slang_assembly_stack_info_
{
unsigned int swizzle_mask;
} slang_assembly_stack_info;
int _slang_cleanup_stack (slang_assembly_file *, slang_operation *, int ref,
slang_assembly_name_space *);
typedef struct slang_assembly_local_info_
{
unsigned int ret_size;
unsigned int addr_tmp;
unsigned int swizzle_tmp;
} slang_assembly_local_info;
int _slang_assemble_operation (slang_assembly_file *, struct slang_operation_ *, int reference,
slang_assembly_flow_control *, slang_assembly_name_space *, slang_assembly_local_info *,
slang_assembly_stack_info *);
void xxx_first (slang_assembly_file *);
void xxx_prolog (slang_assembly_file *, unsigned int);
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -0,0 +1,187 @@
/*
* Mesa 3-D graphics library
* Version: 6.3
*
* Copyright (C) 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.
*/
/**
* \file slang_assemble_assignment.c
* slang assignment expressions assembler
* \author Michal Krol
*/
#include "imports.h"
#include "slang_assemble_assignment.h"
#include "slang_assemble_typeinfo.h"
#include "slang_storage.h"
#include "slang_utility.h"
/*
_slang_assemble_assignment()
copies values on the stack (<component 0> to <component N-1>) to a memory
location pointed by <addr of variable>;
in:
+------------------+
| addr of variable |
+------------------+
| component N-1 |
| ... |
| component 0 |
+------------------+
out:
+------------------+
| addr of variable |
+------------------+
*/
/* TODO: add support for swizzle mask */
static int assign_aggregate (slang_assembly_file *file, const slang_storage_aggregate *agg,
unsigned int *index, unsigned int size, slang_assembly_local_info *info)
{
unsigned int i;
for (i = 0; i < agg->count; i++)
{
const slang_storage_array *arr = agg->arrays + i;
unsigned int j;
for (j = 0; j < arr->length; j++)
{
if (arr->type == slang_stor_aggregate)
{
if (!assign_aggregate (file, arr->aggregate, index, size, info))
return 0;
}
else
{
slang_assembly_type ty;
switch (arr->type)
{
case slang_stor_bool:
ty = slang_asm_bool_copy;
break;
case slang_stor_int:
ty = slang_asm_int_copy;
break;
case slang_stor_float:
ty = slang_asm_float_copy;
break;
default:
break;
}
if (!slang_assembly_file_push_label2 (file, ty, size - *index, *index))
return 0;
*index += 4;
}
}
}
return 1;
}
int _slang_assemble_assignment (slang_assembly_file *file, slang_operation *op,
slang_assembly_name_space *space, slang_assembly_local_info *info)
{
slang_assembly_typeinfo ti;
int result;
slang_storage_aggregate agg;
unsigned int index, size;
slang_assembly_typeinfo_construct (&ti);
if (!_slang_typeof_operation (op, space, &ti))
{
slang_assembly_typeinfo_destruct (&ti);
return 0;
}
slang_storage_aggregate_construct (&agg);
if (!_slang_aggregate_variable (&agg, &ti.spec, NULL, space->funcs, space->structs))
{
slang_storage_aggregate_destruct (&agg);
slang_assembly_typeinfo_destruct (&ti);
return 0;
}
index = 0;
size = _slang_sizeof_aggregate (&agg);
result = assign_aggregate (file, &agg, &index, size, info);
slang_storage_aggregate_destruct (&agg);
slang_assembly_typeinfo_destruct (&ti);
return result;
}
/*
_slang_assemble_assign()
performs unary (pre ++ and --) or binary (=, +=, -=, *=, /=) assignment on the operation's
children
*/
int dereference (slang_assembly_file *file, slang_operation *op,
slang_assembly_name_space *space, slang_assembly_local_info *info);
int call_function_name (slang_assembly_file *file, const char *name, slang_operation *params,
unsigned int param_count, int assignment, slang_assembly_name_space *space,
slang_assembly_local_info *info);
int _slang_assemble_assign (slang_assembly_file *file, slang_operation *op, const char *oper,
int ref, slang_assembly_name_space *space, slang_assembly_local_info *info)
{
slang_assembly_stack_info stk;
slang_assembly_flow_control flow;
if (!ref)
{
if (!slang_assembly_file_push_label2 (file, slang_asm_local_addr, info->addr_tmp, 4))
return 0;
}
if (slang_string_compare ("=", oper) == 0)
{
if (!_slang_assemble_operation (file, op->children, 1, &flow, space, info, &stk))
return 0;
if (!_slang_assemble_operation (file, op->children + 1, 0, &flow, space, info, &stk))
return 0;
if (!_slang_assemble_assignment (file, op->children, space, info))
return 0;
}
else
{
if (!call_function_name (file, oper, op->children, op->num_children, 1, space, info))
return 0;
}
if (!ref)
{
if (!slang_assembly_file_push (file, slang_asm_addr_copy))
return 0;
if (!slang_assembly_file_push_label (file, slang_asm_local_free, 4))
return 0;
if (!dereference (file, op->children, space, info))
return 0;
}
return 1;
}

View File

@@ -0,0 +1,45 @@
/*
* Mesa 3-D graphics library
* Version: 6.3
*
* Copyright (C) 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.
*/
#if !defined SLANG_ASSEMBLE_ASSIGNMENT_H
#define SLANG_ASSEMBLE_ASSIGNMENT_H
#include "slang_assemble.h"
#if defined __cplusplus
extern "C" {
#endif
int _slang_assemble_assignment (slang_assembly_file *, slang_operation *,
slang_assembly_name_space *, slang_assembly_local_info *);
int _slang_assemble_assign (slang_assembly_file *, slang_operation *, const char *, int ref,
slang_assembly_name_space *, slang_assembly_local_info *);
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -0,0 +1,485 @@
/*
* Mesa 3-D graphics library
* Version: 6.3
*
* Copyright (C) 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.
*/
/**
* \file slang_assemble_conditional.c
* slang condtional expressions assembler
* \author Michal Krol
*/
#include "imports.h"
#include "slang_utility.h"
#include "slang_assemble_conditional.h"
#include "slang_assemble.h"
/* _slang_assemble_logicaland() */
int _slang_assemble_logicaland (slang_assembly_file *file, slang_operation *op,
slang_assembly_flow_control *flow, slang_assembly_name_space *space,
slang_assembly_local_info *info)
{
/*
and:
<left-expression>
jumpz zero
<right-expression>
jump end
zero:
push 0
end:
*/
unsigned int zero_jump, end_jump;
slang_assembly_stack_info stk;
/* evaluate left expression */
if (!_slang_assemble_operation (file, op->children, 0, flow, space, info, &stk))
return 0;
/* TODO: inspect stk */
/* jump to pushing 0 if not true */
zero_jump = file->count;
if (!slang_assembly_file_push (file, slang_asm_jump_if_zero))
return 0;
/* evaluate right expression */
if (!_slang_assemble_operation (file, op->children + 1, 0, flow, space, info, &stk))
return 0;
/* TODO: inspect stk */
/* jump to the end of the expression */
end_jump = file->count;
if (!slang_assembly_file_push (file, slang_asm_jump))
return 0;
/* push 0 on stack */
file->code[zero_jump].param[0] = file->count;
if (!slang_assembly_file_push (file, slang_asm_bool_push))
return 0;
/* the end of the expression */
file->code[end_jump].param[0] = file->count;
return 1;
}
/* _slang_assemble_logicalor() */
int _slang_assemble_logicalor (slang_assembly_file *file, slang_operation *op,
slang_assembly_flow_control *flow, slang_assembly_name_space *space,
slang_assembly_local_info *info)
{
/*
or:
<left-expression>
jumpz right
push 1
jump end
right:
<right-expression>
end:
*/
unsigned int right_jump, end_jump;
slang_assembly_stack_info stk;
/* evaluate left expression */
if (!_slang_assemble_operation (file, op->children, 0, flow, space, info, &stk))
return 0;
/* TODO: inspect stk */
/* jump to evaluation of right expression if not true */
right_jump = file->count;
if (!slang_assembly_file_push (file, slang_asm_jump_if_zero))
return 0;
/* push 1 on stack */
if (!slang_assembly_file_push_literal (file, slang_asm_bool_push, 1.0f))
return 0;
/* jump to the end of the expression */
end_jump = file->count;
if (!slang_assembly_file_push (file, slang_asm_jump))
return 0;
/* evaluate right expression */
file->code[right_jump].param[0] = file->count;
if (!_slang_assemble_operation (file, op->children + 1, 0, flow, space, info, &stk))
return 0;
/* TODO: inspect stk */
/* the end of the expression */
file->code[end_jump].param[0] = file->count;
return 1;
}
/* _slang_assemble_select() */
int _slang_assemble_select (slang_assembly_file *file, slang_operation *op,
slang_assembly_flow_control *flow, slang_assembly_name_space *space,
slang_assembly_local_info *info)
{
/*
select:
<condition-expression>
jumpz false
<true-expression>
jump end
false:
<false-expression>
end:
*/
unsigned int cond_jump, end_jump;
slang_assembly_stack_info stk;
/* execute condition expression */
if (!_slang_assemble_operation (file, op->children, 0, flow, space, info, &stk))
return 0;
/* TODO: inspect stk */
/* jump to false expression if not true */
cond_jump = file->count;
if (!slang_assembly_file_push (file, slang_asm_jump_if_zero))
return 0;
/* execute true expression */
if (!_slang_assemble_operation (file, op->children + 1, 0, flow, space, info, &stk))
return 0;
/* TODO: inspect stk */
/* jump to the end of the expression */
end_jump = file->count;
if (!slang_assembly_file_push (file, slang_asm_jump))
return 0;
/* resolve false point */
file->code[cond_jump].param[0] = file->count;
/* execute false expression */
if (!_slang_assemble_operation (file, op->children + 2, 0, flow, space, info, &stk))
return 0;
/* TODO: inspect stk */
/* resolve the end of the expression */
file->code[end_jump].param[0] = file->count;
return 1;
}
/* _slang_assemble_for() */
int _slang_assemble_for (slang_assembly_file *file, slang_operation *op,
slang_assembly_flow_control *flow, slang_assembly_name_space *space,
slang_assembly_local_info *info)
{
/*
for:
<init-statement>
jump start
break:
jump end
continue:
<loop-increment>
start:
<condition-statement>
jumpz end
<loop-body>
jump continue
end:
*/
unsigned int start_jump, end_jump, cond_jump;
unsigned int break_label, cont_label;
slang_assembly_flow_control loop_flow = *flow;
slang_assembly_stack_info stk;
/* execute initialization statement */
if (!_slang_assemble_operation (file, op->children, 0, flow, space, info, &stk))
return 0;
/* TODO: pass-in stk to cleanup */
if (!_slang_cleanup_stack (file, op->children, 0, space))
return 0;
/* skip the "go to the end of the loop" and loop-increment statements */
start_jump = file->count;
if (!slang_assembly_file_push (file, slang_asm_jump))
return 0;
/* go to the end of the loop - break statements are directed here */
break_label = file->count;
end_jump = file->count;
if (!slang_assembly_file_push (file, slang_asm_jump))
return 0;
/* resolve the beginning of the loop - continue statements are directed here */
cont_label = file->count;
/* execute loop-increment statement */
if (!_slang_assemble_operation (file, op->children + 2, 0, flow, space, info, &stk))
return 0;
/* TODO: pass-in stk to cleanup */
if (!_slang_cleanup_stack (file, op->children + 2, 0, space))
return 0;
/* resolve the condition point */
file->code[start_jump].param[0] = file->count;
/* execute condition statement */
if (!_slang_assemble_operation (file, op->children + 1, 0, flow, space, info, &stk))
return 0;
/* TODO: inspect stk */
/* jump to the end of the loop if not true */
cond_jump = file->count;
if (!slang_assembly_file_push (file, slang_asm_jump_if_zero))
return 0;
/* execute loop body */
loop_flow.loop_start = cont_label;
loop_flow.loop_end = break_label;
if (!_slang_assemble_operation (file, op->children + 3, 0, &loop_flow, space, info, &stk))
return 0;
/* TODO: pass-in stk to cleanup */
if (!_slang_cleanup_stack (file, op->children + 3, 0, space))
return 0;
/* go to the beginning of the loop */
if (!slang_assembly_file_push_label (file, slang_asm_jump, cont_label))
return 0;
/* resolve the end of the loop */
file->code[end_jump].param[0] = file->count;
file->code[cond_jump].param[0] = file->count;
return 1;
}
/* _slang_assemble_do() */
int _slang_assemble_do (slang_assembly_file *file, slang_operation *op,
slang_assembly_flow_control *flow, slang_assembly_name_space *space,
slang_assembly_local_info *info)
{
/*
do:
jump start
break:
jump end
continue:
jump condition
start:
<loop-body>
condition:
<condition-statement>
jumpz end
jump start
end:
*/
unsigned int skip_jump, end_jump, cont_jump, cond_jump;
unsigned int break_label, cont_label;
slang_assembly_flow_control loop_flow = *flow;
slang_assembly_stack_info stk;
/* skip the "go to the end of the loop" and "go to condition" statements */
skip_jump = file->count;
if (!slang_assembly_file_push (file, slang_asm_jump))
return 0;
/* go to the end of the loop - break statements are directed here */
break_label = file->count;
end_jump = file->count;
if (!slang_assembly_file_push (file, slang_asm_jump))
return 0;
/* go to condition - continue statements are directed here */
cont_label = file->count;
cont_jump = file->count;
if (!slang_assembly_file_push (file, slang_asm_jump))
return 0;
/* resolve the beginning of the loop */
file->code[skip_jump].param[0] = file->count;
/* execute loop body */
loop_flow.loop_start = cont_label;
loop_flow.loop_end = break_label;
if (!_slang_assemble_operation (file, op->children, 0, &loop_flow, space, info, &stk))
return 0;
/* TODO: pass-in stk to cleanup */
if (!_slang_cleanup_stack (file, op->children, 0, space))
return 0;
/* resolve condition point */
file->code[cont_jump].param[0] = file->count;
/* execute condition statement */
if (!_slang_assemble_operation (file, op->children + 1, 0, flow, space, info, &stk))
return 0;
/* TODO: pass-in stk to cleanup */
/* jump to the end of the loop if not true */
cond_jump = file->count;
if (!slang_assembly_file_push (file, slang_asm_jump_if_zero))
return 0;
/* jump to the beginning of the loop */
if (!slang_assembly_file_push_label (file, slang_asm_jump, file->code[skip_jump].param[0]))
return 0;
/* resolve the end of the loop */
file->code[end_jump].param[0] = file->count;
file->code[cond_jump].param[0] = file->count;
return 1;
}
/* _slang_assemble_while() */
int _slang_assemble_while (slang_assembly_file *file, slang_operation *op,
slang_assembly_flow_control *flow, slang_assembly_name_space *space,
slang_assembly_local_info *info)
{
/*
while:
jump continue
break:
jump end
continue:
<condition-statement>
jumpz end
<loop-body>
jump continue
end:
*/
unsigned int skip_jump, end_jump, cond_jump;
unsigned int break_label;
slang_assembly_flow_control loop_flow = *flow;
slang_assembly_stack_info stk;
/* skip the "go to the end of the loop" statement */
skip_jump = file->count;
if (!slang_assembly_file_push (file, slang_asm_jump))
return 0;
/* go to the end of the loop - break statements are directed here */
break_label = file->count;
end_jump = file->count;
if (!slang_assembly_file_push (file, slang_asm_jump))
return 0;
/* resolve the beginning of the loop - continue statements are directed here */
file->code[skip_jump].param[0] = file->count;
/* execute condition statement */
if (!_slang_assemble_operation (file, op->children, 0, flow, space, info, &stk))
return 0;
/* TODO: pass-in stk to cleanup */
/* jump to the end of the loop if not true */
cond_jump = file->count;
if (!slang_assembly_file_push (file, slang_asm_jump_if_zero))
return 0;
/* execute loop body */
loop_flow.loop_start = file->code[skip_jump].param[0];
loop_flow.loop_end = break_label;
if (!_slang_assemble_operation (file, op->children + 1, 0, &loop_flow, space, info, &stk))
return 0;
/* TODO: pass-in stk to cleanup */
if (!_slang_cleanup_stack (file, op->children + 1, 0, space))
return 0;
/* jump to the beginning of the loop */
if (!slang_assembly_file_push_label (file, slang_asm_jump, file->code[skip_jump].param[0]))
return 0;
/* resolve the end of the loop */
file->code[end_jump].param[0] = file->count;
file->code[cond_jump].param[0] = file->count;
return 1;
}
/* _slang_assemble_if() */
int _slang_assemble_if (slang_assembly_file *file, slang_operation *op,
slang_assembly_flow_control *flow, slang_assembly_name_space *space,
slang_assembly_local_info *info)
{
/*
if:
<condition-statement>
jumpz else
<true-statement>
jump end
else:
<false-statement>
end:
*/
unsigned int cond_jump, else_jump;
slang_assembly_stack_info stk;
/* execute condition statement */
if (!_slang_assemble_operation (file, op->children, 0, flow, space, info, &stk))
return 0;
/* TODO: pass-in stk to cleanup */
/* jump to false-statement if not true */
cond_jump = file->count;
if (!slang_assembly_file_push (file, slang_asm_jump_if_zero))
return 0;
/* execute true-statement */
if (!_slang_assemble_operation (file, op->children + 1, 0, flow, space, info, &stk))
return 0;
/* TODO: pass-in stk to cleanup */
if (!_slang_cleanup_stack (file, op->children + 1, 0, space))
return 0;
/* skip if-false statement */
else_jump = file->count;
if (!slang_assembly_file_push (file, slang_asm_jump))
return 0;
/* resolve start of false-statement */
file->code[cond_jump].param[0] = file->count;
/* execute false-statement */
if (!_slang_assemble_operation (file, op->children + 2, 0, flow, space, info, &stk))
return 0;
/* TODO: pass-in stk to cleanup */
if (!_slang_cleanup_stack (file, op->children + 2, 0, space))
return 0;
/* resolve end of if-false statement */
file->code[else_jump].param[0] = file->count;
return 1;
}

View File

@@ -0,0 +1,67 @@
/*
* Mesa 3-D graphics library
* Version: 6.3
*
* Copyright (C) 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.
*/
#if !defined SLANG_ASSEMBLE_CONDITIONAL_H
#define SLANG_ASSEMBLE_CONDITIONAL_H
#include "slang_assemble.h"
#if defined __cplusplus
extern "C" {
#endif
int _slang_assemble_logicaland (slang_assembly_file *file, slang_operation *op,
slang_assembly_flow_control *flow, slang_assembly_name_space *space,
slang_assembly_local_info *info);
int _slang_assemble_logicalor (slang_assembly_file *file, slang_operation *op,
slang_assembly_flow_control *flow, slang_assembly_name_space *space,
slang_assembly_local_info *info);
int _slang_assemble_select (slang_assembly_file *file, slang_operation *op,
slang_assembly_flow_control *flow, slang_assembly_name_space *space,
slang_assembly_local_info *info);
int _slang_assemble_for (slang_assembly_file *file, slang_operation *op,
slang_assembly_flow_control *flow, slang_assembly_name_space *space,
slang_assembly_local_info *info);
int _slang_assemble_do (slang_assembly_file *file, slang_operation *op,
slang_assembly_flow_control *flow, slang_assembly_name_space *space,
slang_assembly_local_info *info);
int _slang_assemble_while (slang_assembly_file *file, slang_operation *op,
slang_assembly_flow_control *flow, slang_assembly_name_space *space,
slang_assembly_local_info *info);
int _slang_assemble_if (slang_assembly_file *file, slang_operation *op,
slang_assembly_flow_control *flow, slang_assembly_name_space *space,
slang_assembly_local_info *info);
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -0,0 +1,339 @@
/*
* Mesa 3-D graphics library
* Version: 6.3
*
* Copyright (C) 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.
*/
/**
* \file slang_assemble_constructor.c
* slang constructor and vector swizzle assembler
* \author Michal Krol
*/
#include "imports.h"
#include "slang_utility.h"
#include "slang_assemble_constructor.h"
#include "slang_assemble_typeinfo.h"
#include "slang_storage.h"
/* _slang_is_swizzle() */
int _slang_is_swizzle (const char *field, unsigned int rows, slang_swizzle *swz)
{
unsigned int i;
int xyzw = 0, rgba = 0, stpq = 0;
/* the swizzle can be at most 4-component long */
swz->num_components = slang_string_length (field);
if (swz->num_components > 4)
return 0;
for (i = 0; i < swz->num_components; i++)
{
/* mark which swizzle group is used */
switch (field[i])
{
case 'x':
case 'y':
case 'z':
case 'w':
xyzw = 1;
break;
case 'r':
case 'g':
case 'b':
case 'a':
rgba = 1;
break;
case 's':
case 't':
case 'p':
case 'q':
stpq = 1;
break;
default:
return 0;
}
/* collect swizzle component */
switch (field[i])
{
case 'x':
case 'r':
case 's':
swz->swizzle[i] = 0;
break;
case 'y':
case 'g':
case 't':
if (rows < 2)
return 0;
swz->swizzle[i] = 1;
break;
case 'z':
case 'b':
case 'p':
if (rows < 3)
return 0;
swz->swizzle[i] = 2;
break;
case 'w':
case 'a':
case 'q':
if (rows < 4)
return 0;
swz->swizzle[i] = 3;
break;
}
}
/* only one swizzle group can be used */
if ((xyzw && rgba) || (xyzw && stpq) || (rgba && stpq))
return 0;
return 1;
}
/* _slang_is_swizzle_mask() */
int _slang_is_swizzle_mask (const slang_swizzle *swz, unsigned int rows)
{
unsigned int c, i;
if (swz->num_components > rows)
return 0;
c = swz->swizzle[0];
for (i = 1; i < swz->num_components; i++)
{
if (swz->swizzle[i] <= c)
return 0;
c = swz->swizzle[i];
}
return 1;
}
/* _slang_multiply_swizzles() */
void _slang_multiply_swizzles (slang_swizzle *dst, const slang_swizzle *left,
const slang_swizzle *right)
{
unsigned int i;
dst->num_components = right->num_components;
for (i = 0; i < right->num_components; i++)
dst->swizzle[i] = left->swizzle[right->swizzle[i]];
}
/* _slang_assemble_constructor() */
static int constructor_aggregate (slang_assembly_file *file, const slang_storage_aggregate *flat,
unsigned int *index, slang_operation *op, unsigned int size, slang_assembly_flow_control *flow,
slang_assembly_name_space *space, slang_assembly_local_info *info)
{
slang_assembly_typeinfo ti;
int result;
slang_storage_aggregate agg, flat_agg;
slang_assembly_stack_info stk;
unsigned int i;
slang_assembly_typeinfo_construct (&ti);
if (!(result = _slang_typeof_operation (op, space, &ti)))
goto end1;
slang_storage_aggregate_construct (&agg);
if (!(result = _slang_aggregate_variable (&agg, &ti.spec, NULL, space->funcs, space->structs)))
goto end2;
slang_storage_aggregate_construct (&flat_agg);
if (!(result = _slang_flatten_aggregate (&flat_agg, &agg)))
goto end;
if (!(result = _slang_assemble_operation (file, op, 0, flow, space, info, &stk)))
goto end;
for (i = 0; i < flat_agg.count; i++)
{
const slang_storage_array *arr1 = flat_agg.arrays + i;
const slang_storage_array *arr2 = flat->arrays + *index;
if (arr1->type != arr2->type)
{
/* TODO: convert (generic) from arr1 to arr2 */
}
(*index)++;
/* TODO: watch the index, if it reaches the size, pop off the stack subsequent values */
}
result = 1;
end:
slang_storage_aggregate_destruct (&flat_agg);
end2:
slang_storage_aggregate_destruct (&agg);
end1:
slang_assembly_typeinfo_destruct (&ti);
return result;
}
/* XXX: general swizzle! */
int _slang_assemble_constructor (slang_assembly_file *file, slang_operation *op,
slang_assembly_flow_control *flow, slang_assembly_name_space *space,
slang_assembly_local_info *info)
{
slang_assembly_typeinfo ti;
int result;
slang_storage_aggregate agg, flat;
unsigned int size, index, i;
slang_assembly_typeinfo_construct (&ti);
if (!(result = _slang_typeof_operation (op, space, &ti)))
goto end1;
slang_storage_aggregate_construct (&agg);
if (!(result = _slang_aggregate_variable (&agg, &ti.spec, NULL, space->funcs, space->structs)))
goto end2;
size = _slang_sizeof_aggregate (&agg);
slang_storage_aggregate_construct (&flat);
if (!(result = _slang_flatten_aggregate (&flat, &agg)))
goto end;
index = 0;
for (i = 0; i < op->num_children; i++)
{
if (!(result = constructor_aggregate (file, &flat, &index, op->children + i, size, flow,
space, info)))
goto end;
/* TODO: watch the index, if it reaches the size, raise an error */
}
result = 1;
end:
slang_storage_aggregate_destruct (&flat);
end2:
slang_storage_aggregate_destruct (&agg);
end1:
slang_assembly_typeinfo_destruct (&ti);
return result;
}
/* _slang_assemble_constructor_from_swizzle() */
/* XXX: wrong */
int _slang_assemble_constructor_from_swizzle (slang_assembly_file *file, const slang_swizzle *swz,
slang_type_specifier *spec, slang_type_specifier *master_spec, slang_assembly_local_info *info)
{
unsigned int master_rows, i;
switch (master_spec->type)
{
case slang_spec_bool:
case slang_spec_int:
case slang_spec_float:
master_rows = 1;
break;
case slang_spec_bvec2:
case slang_spec_ivec2:
case slang_spec_vec2:
master_rows = 2;
break;
case slang_spec_bvec3:
case slang_spec_ivec3:
case slang_spec_vec3:
master_rows = 3;
break;
case slang_spec_bvec4:
case slang_spec_ivec4:
case slang_spec_vec4:
master_rows = 4;
break;
default:
break;
}
for (i = 0; i < master_rows; i++)
{
switch (master_spec->type)
{
case slang_spec_bool:
case slang_spec_bvec2:
case slang_spec_bvec3:
case slang_spec_bvec4:
if (!slang_assembly_file_push_label2 (file, slang_asm_bool_copy, (master_rows - i) * 4,
i * 4))
return 0;
break;
case slang_spec_int:
case slang_spec_ivec2:
case slang_spec_ivec3:
case slang_spec_ivec4:
if (!slang_assembly_file_push_label2 (file, slang_asm_int_copy, (master_rows - i) * 4,
i * 4))
return 0;
break;
case slang_spec_float:
case slang_spec_vec2:
case slang_spec_vec3:
case slang_spec_vec4:
if (!slang_assembly_file_push_label2 (file, slang_asm_float_copy,
(master_rows - i) * 4, i * 4))
return 0;
break;
default:
break;
}
}
if (!slang_assembly_file_push_label (file, slang_asm_local_free, 4))
return 0;
for (i = swz->num_components; i > 0; i--)
{
unsigned int n = i - 1;
if (!slang_assembly_file_push_label2 (file, slang_asm_local_addr, info->swizzle_tmp, 16))
return 0;
if (!slang_assembly_file_push_label (file, slang_asm_addr_push, swz->swizzle[n] * 4))
return 0;
if (!slang_assembly_file_push (file, slang_asm_addr_add))
return 0;
switch (master_spec->type)
{
case slang_spec_bool:
case slang_spec_bvec2:
case slang_spec_bvec3:
case slang_spec_bvec4:
if (!slang_assembly_file_push (file, slang_asm_bool_deref))
return 0;
break;
case slang_spec_int:
case slang_spec_ivec2:
case slang_spec_ivec3:
case slang_spec_ivec4:
if (!slang_assembly_file_push (file, slang_asm_int_deref))
return 0;
break;
case slang_spec_float:
case slang_spec_vec2:
case slang_spec_vec3:
case slang_spec_vec4:
if (!slang_assembly_file_push (file, slang_asm_float_deref))
return 0;
break;
default:
break;
}
}
return 1;
}

View File

@@ -0,0 +1,80 @@
/*
* Mesa 3-D graphics library
* Version: 6.3
*
* Copyright (C) 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.
*/
#if !defined SLANG_ASSEMBLE_CONSTRUCTOR_H
#define SLANG_ASSEMBLE_CONSTRUCTOR_H
#include "slang_assemble.h"
#include "slang_compile.h"
#if defined __cplusplus
extern "C" {
#endif
/*
holds a complete information about vector swizzle - the <swizzle> array contains
vector component sources indices, where 0 is "x", 1 is "y", ...
example: "xwz" --> { 3, { 0, 3, 2, n/u } }
*/
typedef struct slang_swizzle_
{
unsigned int num_components;
unsigned int swizzle[4];
} slang_swizzle;
/*
checks if a field selector is a general swizzle (an r-value swizzle with replicated
components or an l-value swizzle mask) for a vector
returns 1 if this is the case, <swz> is filled with swizzle information
returns 0 otherwise
*/
int _slang_is_swizzle (const char *field, unsigned int rows, slang_swizzle *swz);
/*
checks if a general swizzle is an l-value swizzle - these swizzles do not have
duplicated fields and they are specified in order
returns 1 if this is a swizzle mask
returns 0 otherwise
*/
int _slang_is_swizzle_mask (const slang_swizzle *swz, unsigned int rows);
/*
combines two swizzles to form single swizzle
example: "wzyx.yx" --> "zw"
*/
void _slang_multiply_swizzles (slang_swizzle *, const slang_swizzle *, const slang_swizzle *);
int _slang_assemble_constructor (slang_assembly_file *file, slang_operation *op,
slang_assembly_flow_control *flow, slang_assembly_name_space *space,
slang_assembly_local_info *info);
int _slang_assemble_constructor_from_swizzle (slang_assembly_file *file, const slang_swizzle *swz,
slang_type_specifier *spec, slang_type_specifier *master_spec, slang_assembly_local_info *info);
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -0,0 +1,430 @@
/*
* Mesa 3-D graphics library
* Version: 6.3
*
* Copyright (C) 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.
*/
/**
* \file slang_assemble_typeinfo.c
* slang type info
* \author Michal Krol
*/
#include "imports.h"
#include "slang_utility.h"
#include "slang_assemble_typeinfo.h"
/* slang_assembly_typeinfo */
void slang_assembly_typeinfo_construct (slang_assembly_typeinfo *ti)
{
slang_type_specifier_construct (&ti->spec);
}
void slang_assembly_typeinfo_destruct (slang_assembly_typeinfo *ti)
{
slang_type_specifier_destruct (&ti->spec);
}
/* _slang_typeof_operation() */
int _slang_typeof_operation (slang_operation *op, slang_assembly_name_space *space,
slang_assembly_typeinfo *ti)
{
ti->can_be_referenced = 0;
ti->is_swizzled = 0;
switch (op->type)
{
case slang_oper_block_no_new_scope:
case slang_oper_block_new_scope:
case slang_oper_variable_decl:
case slang_oper_asm:
case slang_oper_break:
case slang_oper_continue:
case slang_oper_discard:
case slang_oper_return:
case slang_oper_if:
case slang_oper_while:
case slang_oper_do:
case slang_oper_for:
case slang_oper_void:
ti->spec.type = slang_spec_void;
break;
case slang_oper_expression:
case slang_oper_assign:
case slang_oper_addassign:
case slang_oper_subassign:
case slang_oper_mulassign:
case slang_oper_divassign:
case slang_oper_preincrement:
case slang_oper_predecrement:
if (!_slang_typeof_operation (op->children, space, ti))
return 0;
break;
case slang_oper_literal_bool:
case slang_oper_logicalor:
case slang_oper_logicalxor:
case slang_oper_logicaland:
case slang_oper_equal:
case slang_oper_notequal:
case slang_oper_less:
case slang_oper_greater:
case slang_oper_lessequal:
case slang_oper_greaterequal:
case slang_oper_not:
ti->spec.type = slang_spec_bool;
break;
case slang_oper_literal_int:
ti->spec.type = slang_spec_int;
break;
case slang_oper_literal_float:
ti->spec.type = slang_spec_float;
break;
case slang_oper_identifier:
{
slang_variable *var;
var = _slang_locate_variable (op->locals, op->identifier, 1);
if (var == NULL)
return 0;
if (!slang_type_specifier_copy (&ti->spec, &var->type.specifier))
return 0;
ti->can_be_referenced = 1;
}
break;
case slang_oper_sequence:
/* TODO: check [0] and [1] if they match */
if (!_slang_typeof_operation (op->children + 1, space, ti))
return 0;
ti->can_be_referenced = 0;
ti->is_swizzled = 0;
break;
/*case slang_oper_modassign:*/
/*case slang_oper_lshassign:*/
/*case slang_oper_rshassign:*/
/*case slang_oper_orassign:*/
/*case slang_oper_xorassign:*/
/*case slang_oper_andassign:*/
case slang_oper_select:
/* TODO: check [1] and [2] if they match */
if (!_slang_typeof_operation (op->children + 1, space, ti))
return 0;
ti->can_be_referenced = 0;
ti->is_swizzled = 0;
break;
/*case slang_oper_bitor:*/
/*case slang_oper_bitxor:*/
/*case slang_oper_bitand:*/
/*case slang_oper_lshift:*/
/*case slang_oper_rshift:*/
case slang_oper_add:
{
int exists;
if (!_slang_typeof_function ("+", op->children, 2, space, &ti->spec, &exists))
return 0;
if (!exists)
return 0;
}
break;
case slang_oper_subtract:
{
int exists;
if (!_slang_typeof_function ("-", op->children, 2, space, &ti->spec, &exists))
return 0;
if (!exists)
return 0;
}
break;
case slang_oper_multiply:
{
int exists;
if (!_slang_typeof_function ("*", op->children, 2, space, &ti->spec, &exists))
return 0;
if (!exists)
return 0;
}
break;
case slang_oper_divide:
{
int exists;
if (!_slang_typeof_function ("/", op->children, 2, space, &ti->spec, &exists))
return 0;
if (!exists)
return 0;
}
break;
/*case slang_oper_modulus:*/
case slang_oper_plus:
{
int exists;
if (!_slang_typeof_function ("+", op->children, 1, space, &ti->spec, &exists))
return 0;
if (!exists)
return 0;
}
break;
case slang_oper_minus:
{
int exists;
if (!_slang_typeof_function ("-", op->children, 1, space, &ti->spec, &exists))
return 0;
if (!exists)
return 0;
}
break;
/*case slang_oper_complement:*/
case slang_oper_subscript:
{
slang_assembly_typeinfo _ti;
slang_assembly_typeinfo_construct (&_ti);
if (!_slang_typeof_operation (op->children, space, &_ti))
{
slang_assembly_typeinfo_destruct (&_ti);
return 0;
}
ti->can_be_referenced = _ti.can_be_referenced;
switch (_ti.spec.type)
{
case slang_spec_bvec2:
case slang_spec_bvec3:
case slang_spec_bvec4:
ti->spec.type = slang_spec_bool;
break;
case slang_spec_ivec2:
case slang_spec_ivec3:
case slang_spec_ivec4:
ti->spec.type = slang_spec_int;
break;
case slang_spec_vec2:
case slang_spec_vec3:
case slang_spec_vec4:
ti->spec.type = slang_spec_float;
break;
case slang_spec_mat2:
ti->spec.type = slang_spec_vec2;
break;
case slang_spec_mat3:
ti->spec.type = slang_spec_vec3;
break;
case slang_spec_mat4:
ti->spec.type = slang_spec_vec4;
break;
case slang_spec_array:
if (!slang_type_specifier_copy (&ti->spec, _ti.spec._array))
{
slang_assembly_typeinfo_destruct (&_ti);
return 0;
}
break;
default:
slang_assembly_typeinfo_destruct (&_ti);
return 0;
}
slang_assembly_typeinfo_destruct (&_ti);
}
break;
case slang_oper_call:
{
int exists;
if (!_slang_typeof_function (op->identifier, op->children, op->num_children, space,
&ti->spec, &exists))
return 0;
if (!exists)
{
slang_struct *s = slang_struct_scope_find (space->structs, op->identifier, 1);
if (s != NULL)
{
ti->spec.type = slang_spec_struct;
ti->spec._struct = (slang_struct *) slang_alloc_malloc (sizeof (slang_struct));
if (ti->spec._struct == NULL)
return 0;
if (!slang_struct_construct_a (ti->spec._struct))
{
slang_alloc_free (ti->spec._struct);
ti->spec._struct = NULL;
return 0;
}
if (!slang_struct_copy (ti->spec._struct, s))
return 0;
}
else
{
slang_type_specifier_type type = slang_type_specifier_type_from_string (
op->identifier);
if (type == slang_spec_void)
return 0;
ti->spec.type = type;
}
}
}
break;
case slang_oper_field:
{
slang_assembly_typeinfo _ti;
slang_assembly_typeinfo_construct (&_ti);
if (!_slang_typeof_operation (op->children, space, &_ti))
{
slang_assembly_typeinfo_destruct (&_ti);
return 0;
}
if (_ti.spec.type == slang_spec_struct)
{
slang_variable *field = _slang_locate_variable (_ti.spec._struct->fields,
op->identifier, 0);
if (field == NULL)
{
slang_assembly_typeinfo_destruct (&_ti);
return 0;
}
if (!slang_type_specifier_copy (&ti->spec, &field->type.specifier))
{
slang_assembly_typeinfo_destruct (&_ti);
return 0;
}
}
else
{
unsigned int rows;
switch (_ti.spec.type)
{
case slang_spec_vec2:
case slang_spec_ivec2:
case slang_spec_bvec2:
rows = 2;
break;
case slang_spec_vec3:
case slang_spec_ivec3:
case slang_spec_bvec3:
rows = 3;
break;
case slang_spec_vec4:
case slang_spec_ivec4:
case slang_spec_bvec4:
rows = 4;
break;
default:
slang_assembly_typeinfo_destruct (&_ti);
return 0;
}
if (!_slang_is_swizzle (op->identifier, rows, &ti->swz))
return 0;
ti->is_swizzled = 1;
ti->can_be_referenced = _ti.can_be_referenced && _slang_is_swizzle_mask (&ti->swz,
rows);
if (_ti.is_swizzled)
{
slang_swizzle swz;
_slang_multiply_swizzles (&swz, &_ti.swz, &ti->swz);
ti->swz = swz;
}
switch (_ti.spec.type)
{
case slang_spec_vec2:
case slang_spec_vec3:
case slang_spec_vec4:
switch (ti->swz.num_components)
{
case 1:
ti->spec.type = slang_spec_float;
break;
case 2:
ti->spec.type = slang_spec_vec2;
break;
case 3:
ti->spec.type = slang_spec_vec3;
break;
case 4:
ti->spec.type = slang_spec_vec4;
break;
}
break;
case slang_spec_ivec2:
case slang_spec_ivec3:
case slang_spec_ivec4:
switch (ti->swz.num_components)
{
case 1:
ti->spec.type = slang_spec_int;
break;
case 2:
ti->spec.type = slang_spec_ivec2;
break;
case 3:
ti->spec.type = slang_spec_ivec3;
break;
case 4:
ti->spec.type = slang_spec_ivec4;
break;
}
break;
case slang_spec_bvec2:
case slang_spec_bvec3:
case slang_spec_bvec4:
switch (ti->swz.num_components)
{
case 1:
ti->spec.type = slang_spec_bool;
break;
case 2:
ti->spec.type = slang_spec_bvec2;
break;
case 3:
ti->spec.type = slang_spec_bvec3;
break;
case 4:
ti->spec.type = slang_spec_bvec4;
break;
}
break;
default:
break;
}
}
slang_assembly_typeinfo_destruct (&_ti);
return 1;
}
break;
case slang_oper_postincrement:
case slang_oper_postdecrement:
if (!_slang_typeof_operation (op->children, space, ti))
return 0;
ti->can_be_referenced = 0;
ti->is_swizzled = 0;
break;
default:
return 0;
}
return 1;
}
/* _slang_typeof_function() */
int _slang_typeof_function (const char *name, slang_operation *params, unsigned int num_params,
slang_assembly_name_space *space, slang_type_specifier *spec, int *exists)
{
slang_function *fun = _slang_locate_function (name, params, num_params, space);
*exists = fun != NULL;
if (fun == NULL)
return 1;
return slang_type_specifier_copy (spec, &fun->header.type.specifier);
}

View File

@@ -0,0 +1,67 @@
/*
* Mesa 3-D graphics library
* Version: 6.3
*
* Copyright (C) 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.
*/
#if !defined SLANG_ASSEMBLE_TYPEINFO_H
#define SLANG_ASSEMBLE_TYPEINFO_H
#include "slang_assemble_constructor.h"
#include "slang_compile.h"
#if defined __cplusplus
extern "C" {
#endif
typedef struct slang_assembly_typeinfo_
{
int can_be_referenced;
int is_swizzled;
slang_swizzle swz;
slang_type_specifier spec;
} slang_assembly_typeinfo;
void slang_assembly_typeinfo_construct (slang_assembly_typeinfo *);
void slang_assembly_typeinfo_destruct (slang_assembly_typeinfo *);
/*
retrieves type information about an operation
returns 1 on success
returns 0 otherwise
*/
int _slang_typeof_operation (slang_operation *, slang_assembly_name_space *,
slang_assembly_typeinfo *);
/*
retrieves type of a function prototype, if one exists
returns 1 on success, even if the function was not found
returns 0 otherwise
*/
int _slang_typeof_function (const char *name, slang_operation *params, unsigned int num_params,
slang_assembly_name_space *space, slang_type_specifier *spec, int *exists);
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -33,6 +33,9 @@
#include "slang_utility.h"
#include "slang_compile.h"
#include "slang_preprocess.h"
#include "slang_storage.h"
#include "slang_assemble.h"
#include "slang_execute.h"
/*
This is a straightforward implementation of the slang front-end compiler.
@@ -43,22 +46,61 @@
static void slang_variable_construct (slang_variable *);
static int slang_variable_copy (slang_variable *, const slang_variable *);
static void slang_struct_construct (slang_struct *);
static void slang_struct_destruct (slang_struct *);
static int slang_struct_copy (slang_struct *, const slang_struct *);
static int slang_struct_equal (const slang_struct *, const slang_struct *);
static void slang_variable_destruct (slang_variable *);
/* slang_type_specifier_type */
/* these must match with slang_type_specifier_type enum */
static const char *type_specifier_type_names[] = {
"void",
"bool",
"bvec2",
"bvec3",
"bvec4",
"int",
"ivec2",
"ivec3",
"ivec4",
"float",
"vec2",
"vec3",
"vec4",
"mat2",
"mat3",
"mat4",
"sampler1D",
"sampler2D",
"sampler3D",
"samplerCube",
"sampler1DShadow",
"sampler2DShadow",
NULL
};
slang_type_specifier_type slang_type_specifier_type_from_string (const char *name)
{
const char **p = type_specifier_type_names;
while (*p != NULL)
{
if (slang_string_compare (*p, name) == 0)
return (slang_type_specifier_type) (p - type_specifier_type_names);
p++;
}
return slang_spec_void;
}
/* slang_type_specifier */
static void slang_type_specifier_construct (slang_type_specifier *spec)
void slang_type_specifier_construct (slang_type_specifier *spec)
{
spec->type = slang_spec_void;
spec->_struct = NULL;
spec->_array = NULL;
}
static void slang_type_specifier_destruct (slang_type_specifier *spec)
void slang_type_specifier_destruct (slang_type_specifier *spec)
{
if (spec->_struct != NULL)
{
@@ -72,7 +114,7 @@ static void slang_type_specifier_destruct (slang_type_specifier *spec)
}
}
static int slang_type_specifier_copy (slang_type_specifier *x, const slang_type_specifier *y)
int slang_type_specifier_copy (slang_type_specifier *x, const slang_type_specifier *y)
{
slang_type_specifier_destruct (x);
slang_type_specifier_construct (x);
@@ -80,19 +122,28 @@ static int slang_type_specifier_copy (slang_type_specifier *x, const slang_type_
if (x->type == slang_spec_struct)
{
x->_struct = (slang_struct *) slang_alloc_malloc (sizeof (slang_struct));
slang_struct_construct (x->_struct);
if (x->_struct == NULL)
return 0;
if (!slang_struct_construct_a (x->_struct))
{
slang_alloc_free (x->_struct);
x->_struct = NULL;
return 0;
}
return slang_struct_copy (x->_struct, y->_struct);
}
if (x->type == slang_spec_array)
{
x->_array = (slang_type_specifier *) slang_alloc_malloc (sizeof (slang_type_specifier));
if (x->_array == NULL)
return 0;
slang_type_specifier_construct (x->_array);
return slang_type_specifier_copy (x->_array, y->_array);
}
return 1;
}
static int slang_type_specifier_equal (const slang_type_specifier *x, const slang_type_specifier *y)
int slang_type_specifier_equal (const slang_type_specifier *x, const slang_type_specifier *y)
{
if (x->type != y->type)
return 0;
@@ -162,8 +213,8 @@ static int slang_variable_scope_copy (slang_variable_scope *x, const slang_varia
}
/* slang_operation */
/* XXX mem! */
static void slang_operation_construct (slang_operation *oper)
int slang_operation_construct_a (slang_operation *oper)
{
oper->type = slang_oper_none;
oper->children = NULL;
@@ -171,10 +222,13 @@ static void slang_operation_construct (slang_operation *oper)
oper->literal = (float) 0;
oper->identifier = NULL;
oper->locals = (slang_variable_scope *) slang_alloc_malloc (sizeof (slang_variable_scope));
if (oper->locals == NULL)
return 0;
slang_variable_scope_construct (oper->locals);
return 1;
}
static void slang_operation_destruct (slang_operation *oper)
void slang_operation_destruct (slang_operation *oper)
{
unsigned int i;
for (i = 0; i < oper->num_children; i++)
@@ -188,16 +242,31 @@ static void slang_operation_destruct (slang_operation *oper)
static int slang_operation_copy (slang_operation *x, const slang_operation *y)
{
unsigned int i;
slang_operation_destruct (x);
slang_operation_construct (x);
for (i = 0; i < x->num_children; i++)
slang_operation_destruct (x->children + i);
slang_alloc_free (x->children);
x->num_children = 0;
slang_alloc_free (x->identifier);
x->identifier = NULL;
slang_variable_scope_destruct (x->locals);
slang_variable_scope_construct (x->locals);
x->type = y->type;
x->children = (slang_operation *) slang_alloc_malloc (y->num_children * sizeof (
slang_operation));
if (x->children == NULL)
return 0;
for (i = 0; i < y->num_children; i++)
if (!slang_operation_construct_a (x->children + i))
{
unsigned int j;
for (j = 0; j < i; j++)
slang_operation_destruct (x->children + j);
slang_alloc_free (x->children);
x->children = NULL;
return 0;
}
x->num_children = y->num_children;
for (i = 0; i < x->num_children; i++)
slang_operation_construct (x->children + i);
for (i = 0; i < x->num_children; i++)
if (!slang_operation_copy (x->children + i, y->children + i))
return 0;
@@ -221,6 +290,7 @@ static void slang_variable_construct (slang_variable *var)
var->name = NULL;
var->array_size = NULL;
var->initializer = NULL;
var->address = ~0;
}
static void slang_variable_destruct (slang_variable *var)
@@ -256,7 +326,12 @@ static int slang_variable_copy (slang_variable *x, const slang_variable *y)
x->array_size = (slang_operation *) slang_alloc_malloc (sizeof (slang_operation));
if (x->array_size == NULL)
return 0;
slang_operation_construct (x->array_size);
if (!slang_operation_construct_a (x->array_size))
{
slang_alloc_free (x->array_size);
x->array_size = NULL;
return 0;
}
if (!slang_operation_copy (x->array_size, y->array_size))
return 0;
}
@@ -265,13 +340,29 @@ static int slang_variable_copy (slang_variable *x, const slang_variable *y)
x->initializer = (slang_operation *) slang_alloc_malloc (sizeof (slang_operation));
if (x->initializer == NULL)
return 0;
slang_operation_construct (x->initializer);
if (!slang_operation_construct_a (x->initializer))
{
slang_alloc_free (x->initializer);
x->initializer = NULL;
return 0;
}
if (!slang_operation_copy (x->initializer, y->initializer))
return 0;
}
return 1;
}
slang_variable *_slang_locate_variable (slang_variable_scope *scope, const char *name, int all)
{
unsigned int i;
for (i = 0; i < scope->num_variables; i++)
if (slang_string_compare (name, scope->variables[i].name) == 0)
return scope->variables + i;
if (all && scope->outer_scope != NULL)
return _slang_locate_variable (scope->outer_scope, name, 1);
return NULL;
}
/* slang_struct_scope */
static void slang_struct_scope_construct (slang_struct_scope *scope)
@@ -299,7 +390,17 @@ static int slang_struct_scope_copy (slang_struct_scope *x, const slang_struct_sc
return 0;
x->num_structs = y->num_structs;
for (i = 0; i < x->num_structs; i++)
slang_struct_construct (x->structs + i);
{
unsigned int j;
if (!slang_struct_construct_a (x->structs + i))
{
for (j = 0; j < i; j++)
slang_struct_destruct (x->structs + j);
slang_alloc_free (x->structs);
x->structs = NULL;
return 0;
}
}
for (i = 0; i < x->num_structs; i++)
if (!slang_struct_copy (x->structs + i, y->structs + i))
return 0;
@@ -307,8 +408,7 @@ static int slang_struct_scope_copy (slang_struct_scope *x, const slang_struct_sc
return 1;
}
static slang_struct *slang_struct_scope_find (slang_struct_scope *stru, const char *name,
int all_scopes)
slang_struct *slang_struct_scope_find (slang_struct_scope *stru, const char *name, int all_scopes)
{
unsigned int i;
for (i = 0; i < stru->num_structs; i++)
@@ -320,14 +420,23 @@ static slang_struct *slang_struct_scope_find (slang_struct_scope *stru, const ch
}
/* slang_struct */
/* XXX mem! */
static void slang_struct_construct (slang_struct *stru)
int slang_struct_construct_a (slang_struct *stru)
{
stru->name = NULL;
stru->fields = (slang_variable_scope *) slang_alloc_malloc (sizeof (slang_variable_scope));
if (stru->fields == NULL)
return 0;
slang_variable_scope_construct (stru->fields);
stru->structs = (slang_struct_scope *) slang_alloc_malloc (sizeof (slang_struct_scope));
if (stru->structs == NULL)
{
slang_variable_scope_destruct (stru->fields);
slang_alloc_free (stru->fields);
return 0;
}
slang_struct_scope_construct (stru->structs);
return 1;
}
static void slang_struct_destruct (slang_struct *stru)
@@ -339,10 +448,14 @@ static void slang_struct_destruct (slang_struct *stru)
slang_alloc_free (stru->structs);
}
static int slang_struct_copy (slang_struct *x, const slang_struct *y)
int slang_struct_copy (slang_struct *x, const slang_struct *y)
{
slang_struct_destruct (x);
slang_struct_construct (x);
slang_alloc_free (x->name);
x->name = NULL;
slang_variable_scope_destruct (x->fields);
slang_variable_scope_construct (x->fields);
slang_struct_scope_destruct (x->structs);
slang_struct_scope_construct (x->structs);
if (y->name != NULL)
{
x->name = slang_string_duplicate (y->name);
@@ -386,6 +499,7 @@ static void slang_function_construct (slang_function *func)
func->parameters = (slang_variable_scope *) slang_alloc_malloc (sizeof (slang_variable_scope));
slang_variable_scope_construct (func->parameters);
func->body = NULL;
func->address = ~0;
}
static void slang_function_destruct (slang_function *func)
@@ -561,7 +675,7 @@ typedef struct slang_parse_ctx_
int parsing_builtin;
} slang_parse_ctx;
/* --- */
/* _slang_compile() */
static int parse_identifier (slang_parse_ctx *C, char **id)
{
@@ -826,7 +940,14 @@ static int parse_type_specifier (slang_parse_ctx *C, slang_type_specifier *spec,
slang_info_log_memory (C->L);
return 0;
}
slang_struct_construct (spec->_struct);
if (!slang_struct_construct_a (spec->_struct))
{
slang_alloc_free (spec->_struct);
spec->_struct = NULL;
slang_alloc_free (name);
slang_info_log_memory (C->L);
return 0;
}
spec->_struct->name = name;
spec->_struct->structs->outer_scope = structs;
}
@@ -878,7 +999,14 @@ static int parse_type_specifier (slang_parse_ctx *C, slang_type_specifier *spec,
slang_info_log_memory (C->L);
return 0;
}
slang_operation_construct (var->array_size);
if (!slang_operation_construct_a (var->array_size))
{
slang_alloc_free (var->array_size);
var->array_size = NULL;
slang_type_specifier_destruct (&sp);
slang_info_log_memory (C->L);
return 0;
}
if (!parse_expression (C, var->array_size, scope, structs, funcs))
{
slang_type_specifier_destruct (&sp);
@@ -904,8 +1032,9 @@ static int parse_type_specifier (slang_parse_ctx *C, slang_type_specifier *spec,
return 0;
}
s = structs->structs + structs->num_structs;
if (!slang_struct_construct_a (s))
return 0;
structs->num_structs++;
slang_struct_construct (s);
if (!slang_struct_copy (s, spec->_struct))
return 0;
}
@@ -931,7 +1060,12 @@ static int parse_type_specifier (slang_parse_ctx *C, slang_type_specifier *spec,
slang_info_log_memory (C->L);
return 0;
}
slang_struct_construct (spec->_struct);
if (!slang_struct_construct_a (spec->_struct))
{
slang_alloc_free (spec->_struct);
spec->_struct = NULL;
return 0;
}
if (!slang_struct_copy (spec->_struct, stru))
return 0;
}
@@ -1025,7 +1159,11 @@ static int parse_child_operation (slang_parse_ctx *C, slang_operation *oper, int
slang_info_log_memory (C->L);
return 0;
}
slang_operation_construct (oper->children + oper->num_children);
if (!slang_operation_construct_a (oper->children + oper->num_children))
{
slang_info_log_memory (C->L);
return 0;
}
oper->num_children++;
if (statement)
return parse_statement (C, oper->children + oper->num_children - 1, scope, structs, funcs);
@@ -1073,7 +1211,16 @@ static int parse_statement (slang_parse_ctx *C, slang_operation *oper, slang_var
return 0;
}
for (i = 0; i < num_vars; i++)
slang_operation_construct (oper->children + i);
if (!slang_operation_construct_a (oper->children + i))
{
unsigned int j;
for (j = 0; j < i; j++)
slang_operation_destruct (oper->children + j);
slang_alloc_free (oper->children);
oper->children = NULL;
slang_info_log_memory (C->L);
return 0;
}
oper->num_children = num_vars;
for (i = first_var; i < scope->num_variables; i++)
{
@@ -1230,39 +1377,10 @@ static int handle_unary_expression (slang_parse_ctx *C, slang_operation *op,
return 1;
}
/* these must match with slang_type_specifier_type enum */
static const char *builtin_constructor_names[] = {
"void",
"bool",
"bvec2",
"bvec3",
"bvec4",
"int",
"ivec2",
"ivec3",
"ivec4",
"float",
"vec2",
"vec3",
"vec4",
"mat2",
"mat3",
"mat4",
"sampler1D",
"sampler2D",
"sampler3D",
"samplerCube",
"sampler1DShadow",
"sampler2DShadow",
NULL
};
static int is_constructor_name (const char *name, slang_struct_scope *structs)
{
const char **p = &builtin_constructor_names[1];
while (*p != NULL)
if (slang_string_compare (*p++, name) == 0)
return 1;
if (slang_type_specifier_type_from_string (name) != slang_spec_void)
return 1;
return slang_struct_scope_find (structs, name, 1) != NULL;
}
@@ -1285,8 +1403,12 @@ static int parse_expression (slang_parse_ctx *C, slang_operation *oper, slang_va
return 0;
}
op = ops + num_ops;
if (!slang_operation_construct_a (op))
{
slang_info_log_memory (C->L);
return 0;
}
num_ops++;
slang_operation_construct (op);
op->locals->outer_scope = scope;
switch (op_code)
{
@@ -1513,6 +1635,7 @@ static int parse_expression (slang_parse_ctx *C, slang_operation *oper, slang_va
static int parse_parameter_declaration (slang_parse_ctx *C, slang_variable *param,
slang_struct_scope *structs, slang_variable_scope *scope, slang_function_scope *funcs)
{
slang_storage_aggregate agg;
if (!parse_type_qualifier (C, &param->type.qualifier))
return 0;
switch (*C->I++)
@@ -1557,10 +1680,24 @@ static int parse_parameter_declaration (slang_parse_ctx *C, slang_variable *para
slang_info_log_memory (C->L);
return 0;
}
slang_operation_construct (param->array_size);
if (!slang_operation_construct_a (param->array_size))
{
slang_alloc_free (param->array_size);
param->array_size = NULL;
slang_info_log_memory (C->L);
return 0;
}
if (!parse_expression (C, param->array_size, scope, structs, funcs))
return 0;
}
slang_storage_aggregate_construct (&agg);
if (!_slang_aggregate_variable (&agg, &param->type.specifier, param->array_size, funcs,
structs))
{
slang_storage_aggregate_destruct (&agg);
return 0;
}
slang_storage_aggregate_destruct (&agg);
return 1;
}
@@ -1680,7 +1817,7 @@ static int parse_function_prototype (slang_parse_ctx *C, slang_function *func,
if (func->header.type.specifier.type == slang_spec_struct)
return 0;
func->header.name = slang_string_duplicate (
builtin_constructor_names[func->header.type.specifier.type]);
type_specifier_type_names[func->header.type.specifier.type]);
if (func->header.name == NULL)
{
slang_info_log_memory (C->L);
@@ -1728,7 +1865,13 @@ static int parse_function_definition (slang_parse_ctx *C, slang_function *func,
slang_info_log_memory (C->L);
return 0;
}
slang_operation_construct (func->body);
if (!slang_operation_construct_a (func->body))
{
slang_alloc_free (func->body);
func->body = NULL;
slang_info_log_memory (C->L);
return 0;
}
if (!parse_statement (C, func->body, func->parameters, structs, funcs))
return 0;
return 1;
@@ -1781,7 +1924,13 @@ static int parse_init_declarator (slang_parse_ctx *C, const slang_fully_specifie
slang_info_log_memory (C->L);
return 0;
}
slang_operation_construct (var->initializer);
if (!slang_operation_construct_a (var->initializer))
{
slang_alloc_free (var->initializer);
var->initializer = NULL;
slang_info_log_memory (C->L);
return 0;
}
if (!parse_expression (C, var->initializer, vars, structs, funcs))
return 0;
break;
@@ -1816,13 +1965,32 @@ static int parse_init_declarator (slang_parse_ctx *C, const slang_fully_specifie
slang_info_log_memory (C->L);
return 0;
}
slang_operation_construct (var->array_size);
if (!slang_operation_construct_a (var->array_size))
{
slang_alloc_free (var->array_size);
var->array_size = NULL;
slang_info_log_memory (C->L);
return 0;
}
if (!parse_expression (C, var->array_size, vars, structs, funcs))
return 0;
break;
default:
return 0;
}
if (!(var->type.specifier.type == slang_spec_array && var->array_size == NULL))
{
slang_storage_aggregate agg;
slang_storage_aggregate_construct (&agg);
if (!_slang_aggregate_variable (&agg, &var->type.specifier, var->array_size, funcs,
structs))
{
slang_storage_aggregate_destruct (&agg);
return 0;
}
slang_storage_aggregate_destruct (&agg);
}
return 1;
}
@@ -1874,7 +2042,8 @@ static int parse_function (slang_parse_ctx *C, int definition, slang_struct_scop
}
}
/* find a function with a prototype matching the parsed one */
/* find a function with a prototype matching the parsed one - only the current scope
is being searched to allow built-in function overriding */
found_func = slang_function_scope_find (funcs, &parsed_func, 0);
if (found_func == NULL)
{
@@ -1919,6 +2088,36 @@ static int parse_function (slang_parse_ctx *C, int definition, slang_struct_scop
/* return the found function */
*parsed_func_ret = found_func;
}
/* assemble the parsed function */
if (definition)
{
static int x = 0;
static
slang_assembly_file file;
slang_assembly_name_space space;
x++;
if (x == 1)
slang_assembly_file_construct (&file);
space.funcs = funcs;
space.structs = structs;
space.vars = scope;
if (x == 1)
xxx_first (&file);
(**parsed_func_ret).address = file.count;
if (!_slang_assemble_function (&file, *parsed_func_ret, &space))
{
slang_assembly_file_destruct (&file);
return 0;
}
if (slang_string_compare ("main", (**parsed_func_ret).header.name) == 0)
{
xxx_prolog (&file, (**parsed_func_ret).address);
_slang_execute (&file);
slang_assembly_file_destruct (&file);
exit (0);
}
}
return 1;
}
@@ -2051,10 +2250,13 @@ static int compile_with_grammar (grammar id, const char *source, slang_translati
static const char *slang_shader_syn =
#include "library/slang_shader_syn.h"
;
/*
static const byte slang_core_gc_bin[] = {
#include "library/slang_core_gc_bin.h"
};
};*/
static const byte slang_core_gc[] = {
#include "library/slang_core_gc.h"
};
static const byte slang_common_builtin_gc_bin[] = {
#include "library/slang_common_builtin_gc_bin.h"
@@ -2067,7 +2269,7 @@ static const byte slang_fragment_builtin_gc_bin[] = {
static const byte slang_vertex_builtin_gc_bin[] = {
#include "library/slang_vertex_builtin_gc_bin.h"
};
int _slang_compile (const char *source, slang_translation_unit *unit, slang_unit_type type,
slang_info_log *log)
{
@@ -2098,8 +2300,10 @@ int _slang_compile (const char *source, slang_translation_unit *unit, slang_unit
/* if parsing user-specified shader, load built-in library */
if (type == slang_unit_fragment_shader || type == slang_unit_vertex_shader)
{
if (!compile_binary (slang_core_gc_bin, builtin_units,
slang_unit_fragment_builtin, log, NULL))
/*if (!compile_binary (slang_core_gc_bin, builtin_units,
slang_unit_fragment_builtin, log, NULL))*/
if (!compile_with_grammar (id, slang_core_gc, builtin_units, slang_unit_fragment_builtin,
log, NULL))
{
grammar_destroy (id);
return 0;
@@ -2114,7 +2318,7 @@ int _slang_compile (const char *source, slang_translation_unit *unit, slang_unit
if (type == slang_unit_fragment_shader)
{
if (!compile_binary (slang_fragment_builtin_gc_bin, builtin_units + 2,
slang_unit_fragment_builtin, log, NULL))
slang_unit_fragment_builtin, log, NULL))
{
slang_translation_unit_destruct (builtin_units);
slang_translation_unit_destruct (builtin_units + 1);
@@ -2125,7 +2329,7 @@ int _slang_compile (const char *source, slang_translation_unit *unit, slang_unit
else if (type == slang_unit_vertex_shader)
{
if (!compile_binary (slang_vertex_builtin_gc_bin, builtin_units + 2,
slang_unit_vertex_builtin, log, NULL))
slang_unit_vertex_builtin, log, NULL))
{
slang_translation_unit_destruct (builtin_units);
slang_translation_unit_destruct (builtin_units + 1);

View File

@@ -68,14 +68,21 @@ typedef enum slang_type_specifier_type_
slang_spec_sampler2DShadow,
slang_spec_struct,
slang_spec_array
} slang_type_specifier_type;
} slang_type_specifier_type;
slang_type_specifier_type slang_type_specifier_type_from_string (const char *);
typedef struct slang_type_specifier_
{
slang_type_specifier_type type;
struct slang_struct_ *_struct; /* spec_struct */
struct slang_type_specifier_ *_array; /* spec_array */
} slang_type_specifier;
} slang_type_specifier;
void slang_type_specifier_construct (slang_type_specifier *);
void slang_type_specifier_destruct (slang_type_specifier *);
int slang_type_specifier_copy (slang_type_specifier *, const slang_type_specifier *);
int slang_type_specifier_equal (const slang_type_specifier *, const slang_type_specifier *);
typedef struct slang_fully_specified_type_
{
@@ -164,29 +171,40 @@ typedef struct slang_operation_
float literal; /* bool, literal_int, literal_float */
char *identifier; /* asm, identifier, call, field */
slang_variable_scope *locals;
} slang_operation;
} slang_operation;
int slang_operation_construct_a (slang_operation *);
void slang_operation_destruct (slang_operation *);
typedef struct slang_variable_
{
slang_fully_specified_type type;
char *name;
slang_operation *array_size; /* spec_array */
slang_operation *initializer;
} slang_variable;
slang_operation *initializer;
unsigned int address;
} slang_variable;
slang_variable *_slang_locate_variable (slang_variable_scope *scope, const char *name, int all);
typedef struct slang_struct_scope_
{
struct slang_struct_ *structs;
unsigned int num_structs;
struct slang_struct_scope_ *outer_scope;
} slang_struct_scope;
} slang_struct_scope;
struct slang_struct_ *slang_struct_scope_find (slang_struct_scope *, const char *, int);
typedef struct slang_struct_
{
char *name;
slang_variable_scope *fields;
slang_struct_scope *structs;
} slang_struct;
} slang_struct;
int slang_struct_construct_a (slang_struct *);
int slang_struct_copy (slang_struct *, const slang_struct *);
typedef enum slang_function_kind_
{
@@ -201,7 +219,8 @@ typedef struct slang_function_
slang_variable header;
slang_variable_scope *parameters;
unsigned int param_count;
slang_operation *body;
slang_operation *body;
unsigned int address;
} slang_function;
typedef struct slang_function_scope_

View File

@@ -0,0 +1,349 @@
/*
* Mesa 3-D graphics library
* Version: 6.3
*
* Copyright (C) 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.
*/
/**
* \file slang_execute.c
* intermediate code interpreter
* \author Michal Krol
*/
#include "imports.h"
#include "slang_utility.h"
#include "slang_assemble.h"
#include "slang_storage.h"
#include "slang_execute.h"
static void dump_instruction (FILE *f, slang_assembly *a, unsigned int i)
{
fprintf (f, "%.5u:\t", i);
switch (a->type)
{
case slang_asm_none:
fprintf (f, "none");
break;
case slang_asm_float_copy:
fprintf (f, "float_copy\t%d, %d", a->param[0], a->param[1]);
break;
case slang_asm_float_move:
fprintf (f, "float_move\t%d, %d", a->param[0], a->param[1]);
break;
case slang_asm_float_push:
fprintf (f, "float_push\t%f", a->literal);
break;
case slang_asm_float_deref:
fprintf (f, "float_deref");
break;
case slang_asm_float_add:
fprintf (f, "float_add");
break;
case slang_asm_float_multiply:
fprintf (f, "float_multiply");
break;
case slang_asm_float_divide:
fprintf (f, "float_divide");
break;
case slang_asm_float_negate:
fprintf (f, "float_negate");
break;
case slang_asm_float_less:
fprintf (f, "float_less");
break;
case slang_asm_float_equal:
fprintf (f, "float_equal\t%d, %d", a->param[0], a->param[1]);
break;
case slang_asm_float_to_int:
fprintf (f, "float_to_int");
break;
case slang_asm_int_copy:
fprintf (f, "int_copy\t%d, %d", a->param[0], a->param[1]);
break;
case slang_asm_int_move:
fprintf (f, "int_move\t%d, %d", a->param[0], a->param[1]);
break;
case slang_asm_int_push:
fprintf (f, "int_push\t%d", (GLint) a->literal);
break;
case slang_asm_int_deref:
fprintf (f, "int_deref");
break;
case slang_asm_int_to_float:
fprintf (f, "int_to_float");
break;
case slang_asm_int_to_addr:
fprintf (f, "int_to_addr");
break;
case slang_asm_bool_copy:
fprintf (f, "bool_copy\t%d, %d", a->param[0], a->param[1]);
break;
case slang_asm_bool_move:
fprintf (f, "bool_move\t%d, %d", a->param[0], a->param[1]);
break;
case slang_asm_bool_push:
fprintf (f, "bool_push\t%d", a->literal != 0.0f);
break;
case slang_asm_bool_deref:
fprintf (f, "bool_deref");
break;
case slang_asm_addr_copy:
fprintf (f, "addr_copy");
break;
case slang_asm_addr_push:
fprintf (f, "addr_push\t%u", a->param[0]);
break;
case slang_asm_addr_deref:
fprintf (f, "addr_deref");
break;
case slang_asm_addr_add:
fprintf (f, "addr_add");
break;
case slang_asm_addr_multiply:
fprintf (f, "addr_multiply");
break;
case slang_asm_jump:
fprintf (f, "jump\t%u", a->param[0]);
break;
case slang_asm_jump_if_zero:
fprintf (f, "jump_if_zero\t%u", a->param[0]);
break;
case slang_asm_enter:
fprintf (f, "enter\t%u", a->param[0]);
break;
case slang_asm_leave:
fprintf (f, "leave");
break;
case slang_asm_local_alloc:
fprintf (f, "local_alloc\t%u", a->param[0]);
break;
case slang_asm_local_free:
fprintf (f, "local_free\t%u", a->param[0]);
break;
case slang_asm_local_addr:
fprintf (f, "local_addr\t%u, %u", a->param[0], a->param[1]);
break;
case slang_asm_call:
fprintf (f, "call\t%u", a->param[0]);
break;
case slang_asm_return:
fprintf (f, "return");
break;
case slang_asm_discard:
fprintf (f, "discard");
break;
case slang_asm_exit:
fprintf (f, "exit");
break;
default:
break;
}
fprintf (f, "\n");
}
static void dump (const slang_assembly_file *file)
{
unsigned int i;
static unsigned int counter = 0;
FILE *f;
char filename[256];
counter++;
sprintf (filename, "~mesa-slang-assembly-dump-(%u).txt", counter);
f = fopen (filename, "w");
if (f == NULL)
return;
for (i = 0; i < file->count; i++)
dump_instruction (f, file->code + i, i);
fclose (f);
}
int _slang_execute (const slang_assembly_file *file)
{
slang_machine mach;
FILE *f;
mach.ip = 0;
mach.sp = SLANG_MACHINE_STACK_SIZE;
mach.bp = 0;
mach.kill = 0;
mach.exit = 0;
/* assume 32-bit machine */
static_assert(sizeof (GLfloat) == 4);
static_assert(sizeof (GLfloat *) == 4);
static_assert(sizeof (GLuint) == 4);
static_assert(sizeof (GLuint *) == 4);
dump (file);
f = fopen ("~mesa-slang-assembly-execution.txt", "w");
while (!mach.exit)
{
slang_assembly *a = file->code + mach.ip;
if (f != NULL)
{
unsigned int i;
dump_instruction (f, a, mach.ip);
fprintf (f, "\t\tsp=%u bp=%u\n", mach.sp, mach.bp);
for (i = mach.sp; i < SLANG_MACHINE_STACK_SIZE; i++)
fprintf (f, "\t%.5u\t%6f\t%u\n", i, mach.stack._float[i], mach.stack._addr[i]);
fflush (f);
}
mach.ip++;
switch (a->type)
{
case slang_asm_none:
break;
case slang_asm_float_copy:
case slang_asm_int_copy:
case slang_asm_bool_copy:
*(mach.stack._floatp[mach.sp + a->param[0] / 4] + a->param[1] / 4) =
mach.stack._float[mach.sp];
mach.sp++;
break;
case slang_asm_float_move:
case slang_asm_int_move:
case slang_asm_bool_move:
mach.stack._float[mach.sp + a->param[0] / 4] =
mach.stack._float[mach.sp + (mach.stack._addr[mach.sp] + a->param[1]) / 4];
break;
case slang_asm_float_push:
case slang_asm_int_push:
case slang_asm_bool_push:
mach.sp--;
mach.stack._float[mach.sp] = a->literal;
break;
case slang_asm_float_deref:
case slang_asm_int_deref:
case slang_asm_bool_deref:
mach.stack._float[mach.sp] = *mach.stack._floatp[mach.sp];
break;
case slang_asm_float_add:
mach.stack._float[mach.sp + 1] += mach.stack._float[mach.sp];
mach.sp++;
break;
case slang_asm_float_multiply:
mach.stack._float[mach.sp + 1] *= mach.stack._float[mach.sp];
mach.sp++;
break;
case slang_asm_float_divide:
mach.stack._float[mach.sp + 1] /= mach.stack._float[mach.sp];
mach.sp++;
break;
case slang_asm_float_negate:
mach.stack._float[mach.sp] = -mach.stack._float[mach.sp];
break;
case slang_asm_float_less:
mach.stack._float[mach.sp + 1] =
mach.stack._float[mach.sp + 1] < mach.stack._float[mach.sp] ? 1.0f : 0.0f;
mach.sp++;
break;
case slang_asm_float_equal:
mach.sp--;
mach.stack._float[mach.sp] = mach.stack._float[mach.sp + 1 + a->param[0] / 4] ==
mach.stack._float[mach.sp + 1 + a->param[1] / 4] ? 1.0f : 0.0f;
break;
case slang_asm_float_to_int:
mach.stack._float[mach.sp] = (GLfloat) (GLint) mach.stack._float[mach.sp];
break;
case slang_asm_int_to_float:
break;
case slang_asm_int_to_addr:
mach.stack._addr[mach.sp] = (GLuint) (GLint) mach.stack._float[mach.sp];
break;
case slang_asm_addr_copy:
*mach.stack._addrp[mach.sp + 1] = mach.stack._addr[mach.sp];
mach.sp++;
break;
case slang_asm_addr_push:
mach.sp--;
mach.stack._addr[mach.sp] = a->param[0];
break;
case slang_asm_addr_deref:
mach.stack._addr[mach.sp] = *mach.stack._addrp[mach.sp];
break;
case slang_asm_addr_add:
mach.stack._addr[mach.sp + 1] += mach.stack._addr[mach.sp];
mach.sp++;
break;
case slang_asm_addr_multiply:
mach.stack._addr[mach.sp + 1] *= mach.stack._addr[mach.sp];
mach.sp++;
break;
case slang_asm_jump:
mach.ip = a->param[0];
break;
case slang_asm_jump_if_zero:
if (mach.stack._float[mach.sp] == 0.0f)
mach.ip = a->param[0];
mach.sp++;
break;
case slang_asm_enter:
mach.sp--;
mach.stack._addr[mach.sp] = mach.bp;
mach.bp = mach.sp + a->param[0] / 4;
break;
case slang_asm_leave:
mach.bp = mach.stack._addr[mach.sp];
mach.sp++;
break;
case slang_asm_local_alloc:
mach.sp -= a->param[0] / 4;
break;
case slang_asm_local_free:
mach.sp += a->param[0] / 4;
break;
case slang_asm_local_addr:
mach.sp--;
mach.stack._addr[mach.sp] = (GLuint) mach.stack._addr + mach.bp * 4 -
(a->param[0] + a->param[1]) + 4;
break;
case slang_asm_call:
mach.sp--;
mach.stack._addr[mach.sp] = mach.ip;
mach.ip = a->param[0];
break;
case slang_asm_return:
mach.ip = mach.stack._addr[mach.sp];
mach.sp++;
break;
case slang_asm_discard:
mach.kill = 1;
break;
case slang_asm_exit:
mach.exit = 1;
break;
}
}
if (f != NULL)
fclose (f);
return 0;
}

View File

@@ -0,0 +1,57 @@
/*
* Mesa 3-D graphics library
* Version: 6.3
*
* Copyright (C) 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.
*/
#if !defined SLANG_EXECUTE_H
#define SLANG_EXECUTE_H
#if defined __cplusplus
extern "C" {
#endif
#define SLANG_MACHINE_STACK_SIZE 1024
typedef struct slang_machine_
{
GLuint ip; /* instruction pointer, for flow control */
GLuint sp; /* stack pointer, for stack access */
GLuint bp; /* base pointer, for local variable access */
GLuint kill; /* discard the fragment */
GLuint exit; /* terminate the shader */
union stack_
{
GLfloat _float[SLANG_MACHINE_STACK_SIZE];
GLfloat *_floatp[SLANG_MACHINE_STACK_SIZE];
GLuint _addr[SLANG_MACHINE_STACK_SIZE];
GLuint *_addrp[SLANG_MACHINE_STACK_SIZE];
} stack;
} slang_machine;
int _slang_execute (const slang_assembly_file *);
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -0,0 +1,255 @@
/*
* Mesa 3-D graphics library
* Version: 6.3
*
* Copyright (C) 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.
*/
/**
* \file slang_storage.c
* slang variable storage
* \author Michal Krol
*/
#include "imports.h"
#include "slang_utility.h"
#include "slang_storage.h"
#include "slang_assemble.h"
/* slang_storage_array */
void slang_storage_array_construct (slang_storage_array *arr)
{
arr->type = slang_stor_aggregate;
arr->aggregate = NULL;
arr->length = 0;
}
void slang_storage_array_destruct (slang_storage_array *arr)
{
if (arr->aggregate != NULL)
{
slang_storage_aggregate_destruct (arr->aggregate);
slang_alloc_free (arr->aggregate);
}
}
/* slang_storage_aggregate */
void slang_storage_aggregate_construct (slang_storage_aggregate *agg)
{
agg->arrays = NULL;
agg->count = 0;
}
void slang_storage_aggregate_destruct (slang_storage_aggregate *agg)
{
unsigned int i;
for (i = 0; i < agg->count; i++)
slang_storage_array_destruct (agg->arrays + i);
slang_alloc_free (agg->arrays);
}
static slang_storage_array *slang_storage_aggregate_push_new (slang_storage_aggregate *agg)
{
slang_storage_array *arr = NULL;
agg->arrays = (slang_storage_array *) slang_alloc_realloc (agg->arrays, agg->count * sizeof (
slang_storage_array), (agg->count + 1) * sizeof (slang_storage_array));
if (agg->arrays != NULL)
{
arr = agg->arrays + agg->count;
slang_storage_array_construct (arr);
agg->count++;
}
return arr;
}
/* _slang_aggregate_variable() */
static int aggregate_vector (slang_storage_aggregate *agg, slang_storage_type basic_type,
unsigned int row_count)
{
slang_storage_array *arr = slang_storage_aggregate_push_new (agg);
if (arr == NULL)
return 0;
arr->type = basic_type;
arr->length = row_count;
return 1;
}
static int aggregate_matrix (slang_storage_aggregate *agg, slang_storage_type basic_type,
unsigned int dimension)
{
slang_storage_array *arr = slang_storage_aggregate_push_new (agg);
if (arr == NULL)
return 0;
arr->type = slang_stor_aggregate;
arr->length = dimension;
arr->aggregate = (slang_storage_aggregate *) slang_alloc_malloc (sizeof (
slang_storage_aggregate));
if (arr->aggregate == NULL)
return 0;
slang_storage_aggregate_construct (arr->aggregate);
if (!aggregate_vector (arr->aggregate, basic_type, dimension))
return 0;
return 1;
}
static int aggregate_variables (slang_storage_aggregate *agg, const slang_variable_scope *vars,
slang_function_scope *funcs, slang_struct_scope *structs)
{
unsigned int i;
for (i = 0; i < vars->num_variables; i++)
if (!_slang_aggregate_variable (agg, &vars->variables[i].type.specifier,
vars->variables[i].array_size, funcs, structs))
return 0;
return 1;
}
int _slang_aggregate_variable (slang_storage_aggregate *agg, slang_type_specifier *spec,
slang_operation *array_size, slang_function_scope *funcs, slang_struct_scope *structs)
{
switch (spec->type)
{
case slang_spec_bool:
return aggregate_vector (agg, slang_stor_bool, 1);
case slang_spec_bvec2:
return aggregate_vector (agg, slang_stor_bool, 2);
case slang_spec_bvec3:
return aggregate_vector (agg, slang_stor_bool, 3);
case slang_spec_bvec4:
return aggregate_vector (agg, slang_stor_bool, 4);
case slang_spec_int:
return aggregate_vector (agg, slang_stor_int, 1);
case slang_spec_ivec2:
return aggregate_vector (agg, slang_stor_int, 2);
case slang_spec_ivec3:
return aggregate_vector (agg, slang_stor_int, 3);
case slang_spec_ivec4:
return aggregate_vector (agg, slang_stor_int, 4);
case slang_spec_float:
return aggregate_vector (agg, slang_stor_float, 1);
case slang_spec_vec2:
return aggregate_vector (agg, slang_stor_float, 2);
case slang_spec_vec3:
return aggregate_vector (agg, slang_stor_float, 3);
case slang_spec_vec4:
return aggregate_vector (agg, slang_stor_float, 4);
case slang_spec_mat2:
return aggregate_matrix (agg, slang_stor_float, 2);
case slang_spec_mat3:
return aggregate_matrix (agg, slang_stor_float, 3);
case slang_spec_mat4:
return aggregate_matrix (agg, slang_stor_float, 4);
case slang_spec_sampler1D:
case slang_spec_sampler2D:
case slang_spec_sampler3D:
case slang_spec_samplerCube:
case slang_spec_sampler1DShadow:
case slang_spec_sampler2DShadow:
return aggregate_vector (agg, slang_stor_int, 1);
case slang_spec_struct:
return aggregate_variables (agg, spec->_struct->fields, funcs, structs);
case slang_spec_array:
{
slang_storage_array *arr;
slang_assembly_file file;
slang_assembly_flow_control flow;
slang_assembly_name_space space;
slang_assembly_local_info info;
slang_assembly_stack_info stk;
arr = slang_storage_aggregate_push_new (agg);
if (arr == NULL)
return 0;
arr->type = slang_stor_aggregate;
arr->aggregate = (slang_storage_aggregate *) slang_alloc_malloc (sizeof (
slang_storage_aggregate));
if (arr->aggregate == NULL)
return 0;
slang_storage_aggregate_construct (arr->aggregate);
if (!_slang_aggregate_variable (arr->aggregate, spec->_array, NULL, funcs, structs))
return 0;
slang_assembly_file_construct (&file);
space.funcs = funcs;
space.structs = structs;
/* XXX: vars! */
space.vars = NULL;
if (!_slang_assemble_operation (&file, array_size, 0, &flow, &space, &info, &stk))
{
slang_assembly_file_destruct (&file);
return 0;
}
/* TODO: evaluate array size */
slang_assembly_file_destruct (&file);
arr->length = 256;
}
return 1;
default:
return 0;
}
}
/* _slang_sizeof_aggregate() */
unsigned int _slang_sizeof_aggregate (const slang_storage_aggregate *agg)
{
unsigned int i, size = 0;
for (i = 0; i < agg->count; i++)
{
unsigned int element_size;
if (agg->arrays[i].type == slang_stor_aggregate)
element_size = _slang_sizeof_aggregate (agg->arrays[i].aggregate);
else
element_size = sizeof (GLfloat);
size += element_size * agg->arrays[i].length;
}
return size;
}
/* _slang_flatten_aggregate () */
int _slang_flatten_aggregate (slang_storage_aggregate *flat, const slang_storage_aggregate *agg)
{
unsigned int i;
for (i = 0; i < agg->count; i++)
{
unsigned int j;
for (j = 0; j < agg->arrays[i].length; j++)
{
if (agg->arrays[i].type == slang_stor_aggregate)
{
if (!_slang_flatten_aggregate (flat, agg->arrays[i].aggregate))
return 0;
}
else
{
slang_storage_array *arr;
arr = slang_storage_aggregate_push_new (flat);
if (arr == NULL)
return 0;
arr->type = agg->arrays[i].type;
arr->length = 1;
}
}
}
return 1;
}

View File

@@ -0,0 +1,109 @@
/*
* Mesa 3-D graphics library
* Version: 6.3
*
* Copyright (C) 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.
*/
#if !defined SLANG_STORAGE_H
#define SLANG_STORAGE_H
#include "slang_compile.h"
#if defined __cplusplus
extern "C" {
#endif
/*
Program variable data storage is kept completely transparent to the front-end compiler. It is
up to the back-end how the data is actually allocated. The slang_storage_type enum
provides the basic information about how the memory is interpreted. This abstract piece
of memory is called a data slot. A data slot of a particular type has a fixed size.
For now, only the three basic types are supported, that is bool, int and float. Other built-in
types like vector or matrix can easily be decomposed into a series of basic types.
*/
typedef enum slang_storage_type_
{
slang_stor_aggregate,
slang_stor_bool,
slang_stor_int,
slang_stor_float
} slang_storage_type;
/*
The slang_storage_array structure groups data slots of the same type into an array. This
array has a fixed length. Arrays are required to have a size equal to the sum of sizes of its
elements. They are also required to support indirect addressing. That is, if B references
first data slot in the array, S is the size of the data slot and I is the integral index that
is not known at compile time, B+I*S references I-th data slot.
This structure is also used to break down built-in data types that are not supported directly.
Vectors, like vec3, are constructed from arrays of their basic types. Matrices are formed of
an array of column vectors, which are in turn processed as other vectors.
*/
typedef struct slang_storage_array_
{
slang_storage_type type;
struct slang_storage_aggregate_ *aggregate; /* slang_stor_aggregate */
unsigned int length;
} slang_storage_array;
void slang_storage_array_construct (slang_storage_array *);
void slang_storage_array_destruct (slang_storage_array *);
/*
The slang_storage_aggregate structure relaxes the indirect addressing requirement for
slang_storage_array structure. Aggregates are always accessed statically - its member
addresses are well-known at compile time. For example, user-defined types are implemented as
aggregates. Aggregates can collect data of a different type.
*/
typedef struct slang_storage_aggregate_
{
slang_storage_array *arrays;
unsigned int count;
} slang_storage_aggregate;
void slang_storage_aggregate_construct (slang_storage_aggregate *);
void slang_storage_aggregate_destruct (slang_storage_aggregate *);
int _slang_aggregate_variable (slang_storage_aggregate *, struct slang_type_specifier_ *,
struct slang_operation_ *, struct slang_function_scope_ *, slang_struct_scope *);
/*
returns total size (in machine units) of the given aggregate
returns 0 on error
*/
unsigned int _slang_sizeof_aggregate (const slang_storage_aggregate *);
/*
converts structured aggregate to a flat one, with arrays of generic type being
one-element long
returns 1 on success
returns 0 otherwise
*/
int _slang_flatten_aggregate (slang_storage_aggregate *, const slang_storage_aggregate *);
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -29,6 +29,8 @@
extern "C" {
#endif
#define static_assert(expr) do { int _array[(expr) ? 1 : 0]; _array[0]; } while (0)
void slang_alloc_free (void *);
void *slang_alloc_malloc (unsigned int);
void *slang_alloc_realloc (void *, unsigned int, unsigned int);

View File

@@ -149,7 +149,7 @@ SHADER_SOURCES = \
shader/arbprogram.c \
shader/arbvertparse.c \
shader/atifragshader.c \
shader/grammar_mesa.c \
shader/grammar/grammar_mesa.c \
shader/nvfragparse.c \
shader/nvprogram.c \
shader/nvvertexec.c \
@@ -187,8 +187,15 @@ SLANG_CPP_SOURCES = \
shader/slang/OSDependent/Linux/ossource.cpp
SLANG_SOURCES = \
shader/slang/slang_assemble.c \
shader/slang/slang_assemble_assignment.c \
shader/slang/slang_assemble_conditional.c \
shader/slang/slang_assemble_constructor.c \
shader/slang/slang_assemble_typeinfo.c \
shader/slang/slang_compile.c \
shader/slang/slang_execute.c \
shader/slang/slang_preprocess.c \
shader/slang/slang_storage.c \
shader/slang/slang_utility.c
ASM_C_SOURCES = \
@@ -313,6 +320,7 @@ INCLUDE_DIRS = \
-I$(TOP)/src/mesa/math \
-I$(TOP)/src/mesa/tnl \
-I$(TOP)/src/mesa/shader \
-I$(TOP)/src/mesa/shader/grammar \
-I$(TOP)/src/mesa/shader/slang \
-I$(TOP)/src/mesa/shader/slang/OSDependent/Linux \
-I$(TOP)/src/mesa/shader/slang/OGLCompilersDLL \

View File

@@ -1192,8 +1192,10 @@ execute_program( GLcontext *ctx,
fetch_texel( ctx, texcoord,
span->array->lambda[inst->TexSrcUnit][column],
inst->TexSrcUnit, color );
#if DEBUG_FRAG
if (color[3])
printf("color[3] = %f\n", color[3]);
#endif
store_vector4( inst, machine, color );
}
break;

View File

@@ -1,336 +0,0 @@
# Microsoft Developer Studio Project File - Name="swrast" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Static Library" 0x0104
CFG=swrast - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "swrast.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "swrast.mak" CFG="swrast - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "swrast - Win32 Release" (based on "Win32 (x86) Static Library")
!MESSAGE "swrast - Win32 Debug" (based on "Win32 (x86) Static Library")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "swrast - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
# ADD CPP /nologo /W3 /GX /O2 /I "../../../include" /I "../" /I "../main" /I "../glapi" /I "../shader" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo
!ELSEIF "$(CFG)" == "swrast - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../../../include" /I "../" /I "../main" /I "../glapi" /I "../shader" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /FR /YX /FD /GZ /c
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo
!ENDIF
# Begin Target
# Name "swrast - Win32 Release"
# Name "swrast - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=.\s_aaline.c
# End Source File
# Begin Source File
SOURCE=.\s_aatriangle.c
# End Source File
# Begin Source File
SOURCE=.\s_accum.c
# End Source File
# Begin Source File
SOURCE=.\s_alpha.c
# End Source File
# Begin Source File
SOURCE=.\s_alphabuf.c
# End Source File
# Begin Source File
SOURCE=.\s_atifragshader.c
# End Source File
# Begin Source File
SOURCE=.\s_auxbuffer.c
# End Source File
# Begin Source File
SOURCE=.\s_bitmap.c
# End Source File
# Begin Source File
SOURCE=.\s_blend.c
# End Source File
# Begin Source File
SOURCE=.\s_buffers.c
# End Source File
# Begin Source File
SOURCE=.\s_context.c
# End Source File
# Begin Source File
SOURCE=.\s_copypix.c
# End Source File
# Begin Source File
SOURCE=.\s_depth.c
# End Source File
# Begin Source File
SOURCE=.\s_drawpix.c
# End Source File
# Begin Source File
SOURCE=.\s_feedback.c
# End Source File
# Begin Source File
SOURCE=.\s_fog.c
# End Source File
# Begin Source File
SOURCE=.\s_imaging.c
# End Source File
# Begin Source File
SOURCE=.\s_lines.c
# End Source File
# Begin Source File
SOURCE=.\s_logic.c
# End Source File
# Begin Source File
SOURCE=.\s_masking.c
# End Source File
# Begin Source File
SOURCE=.\s_nvfragprog.c
# End Source File
# Begin Source File
SOURCE=.\s_pixeltex.c
# End Source File
# Begin Source File
SOURCE=.\s_points.c
# End Source File
# Begin Source File
SOURCE=.\s_readpix.c
# End Source File
# Begin Source File
SOURCE=.\s_span.c
# End Source File
# Begin Source File
SOURCE=.\s_stencil.c
# End Source File
# Begin Source File
SOURCE=.\s_texstore.c
# End Source File
# Begin Source File
SOURCE=.\s_texture.c
# End Source File
# Begin Source File
SOURCE=.\s_triangle.c
# End Source File
# Begin Source File
SOURCE=.\s_zoom.c
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# Begin Source File
SOURCE=.\s_aaline.h
# End Source File
# Begin Source File
SOURCE=.\s_aalinetemp.h
# End Source File
# Begin Source File
SOURCE=.\s_aatriangle.h
# End Source File
# Begin Source File
SOURCE=.\s_aatritemp.h
# End Source File
# Begin Source File
SOURCE=.\s_accum.h
# End Source File
# Begin Source File
SOURCE=.\s_alpha.h
# End Source File
# Begin Source File
SOURCE=.\s_alphabuf.h
# End Source File
# Begin Source File
SOURCE=.\s_atifragshader.h
# End Source File
# Begin Source File
SOURCE=.\s_blend.h
# End Source File
# Begin Source File
SOURCE=.\s_context.h
# End Source File
# Begin Source File
SOURCE=.\s_depth.h
# End Source File
# Begin Source File
SOURCE=.\s_drawpix.h
# End Source File
# Begin Source File
SOURCE=.\s_feedback.h
# End Source File
# Begin Source File
SOURCE=.\s_fog.h
# End Source File
# Begin Source File
SOURCE=.\s_lines.h
# End Source File
# Begin Source File
SOURCE=.\s_linetemp.h
# End Source File
# Begin Source File
SOURCE=.\s_logic.h
# End Source File
# Begin Source File
SOURCE=.\s_masking.h
# End Source File
# Begin Source File
SOURCE=.\s_nvfragprog.h
# End Source File
# Begin Source File
SOURCE=.\s_pixeltex.h
# End Source File
# Begin Source File
SOURCE=.\s_points.h
# End Source File
# Begin Source File
SOURCE=.\s_pointtemp.h
# End Source File
# Begin Source File
SOURCE=.\s_span.h
# End Source File
# Begin Source File
SOURCE=.\s_spantemp.h
# End Source File
# Begin Source File
SOURCE=.\s_stencil.h
# End Source File
# Begin Source File
SOURCE=.\s_texture.h
# End Source File
# Begin Source File
SOURCE=.\s_triangle.h
# End Source File
# Begin Source File
SOURCE=.\s_trispan.h
# End Source File
# Begin Source File
SOURCE=.\s_tritemp.h
# End Source File
# Begin Source File
SOURCE=.\s_zoom.h
# End Source File
# Begin Source File
SOURCE=.\swrast.h
# End Source File
# End Group
# End Target
# End Project

View File

@@ -1,124 +0,0 @@
# Microsoft Developer Studio Project File - Name="swrast_setup" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Static Library" 0x0104
CFG=swrast_setup - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "swrast_setup.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "swrast_setup.mak" CFG="swrast_setup - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "swrast_setup - Win32 Release" (based on "Win32 (x86) Static Library")
!MESSAGE "swrast_setup - Win32 Debug" (based on "Win32 (x86) Static Library")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "swrast_setup - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
# ADD CPP /nologo /W3 /GX /O2 /I "../../../include" /I "../" /I "../main" /I "../glapi" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo
!ELSEIF "$(CFG)" == "swrast_setup - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../../../include" /I "../" /I "../main" /I "../glapi" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /FR /YX /FD /GZ /c
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo
!ENDIF
# Begin Target
# Name "swrast_setup - Win32 Release"
# Name "swrast_setup - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=.\ss_context.c
# End Source File
# Begin Source File
SOURCE=.\ss_triangle.c
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# Begin Source File
SOURCE=.\ss_context.h
# End Source File
# Begin Source File
SOURCE=.\ss_triangle.h
# End Source File
# Begin Source File
SOURCE=.\ss_tritmp.h
# End Source File
# Begin Source File
SOURCE=.\ss_vb.h
# End Source File
# Begin Source File
SOURCE=.\ss_vbtmp.h
# End Source File
# Begin Source File
SOURCE=.\swrast_setup.h
# End Source File
# End Group
# End Target
# End Project

View File

@@ -1,6 +1,6 @@
# Makefile for core library for VMS
# contributed by Jouk Jansen joukj@hrem.stm.tudelft.nl
# Last revision : 18 August 2004
# Last revision : 20 May 2005
.first
define gl [---.include.gl]
@@ -22,14 +22,14 @@ SOURCES = t_array_api.c t_array_import.c t_context.c \
t_vb_light.c t_vb_normals.c t_vb_points.c t_vb_program.c \
t_vb_render.c t_vb_texgen.c t_vb_texmat.c t_vb_vertex.c \
t_vtx_eval.c t_vtx_exec.c t_save_playback.c t_save_loopback.c \
t_vertex.c t_vtx_generic.c t_vtx_x86.c t_vertex_c.c;
t_vertex.c t_vtx_generic.c t_vtx_x86.c t_vertex_generic.c
OBJECTS = t_array_api.obj,t_array_import.obj,t_context.obj,\
t_pipeline.obj,t_vb_fog.obj,t_vb_light.obj,t_vb_normals.obj,\
t_vb_points.obj,t_vb_program.obj,t_vb_render.obj,t_vb_texgen.obj,\
t_vb_texmat.obj,t_vb_vertex.obj,t_save_api.obj,t_vtx_api.obj,\
t_vtx_eval.obj,t_vtx_exec.obj,t_save_playback.obj,t_save_loopback.obj,\
t_vertex.obj,t_vtx_generic.obj,t_vtx_x86.obj,t_vertex_c.obj
t_vertex.obj,t_vtx_generic.obj,t_vtx_x86.obj,t_vertex_generic.obj
##### RULES #####
@@ -66,4 +66,4 @@ t_save_loopback.obj : t_save_loopback.c
t_vertex.obj : t_vertex.c
t_vtx_x86.obj : t_vtx_x86.c
t_vtx_generic.obj : t_vtx_generic.c
t_vertex_c.obj : t_vertex_c.c
t_vertex_generic.obj : t_vertex_generic.c

View File

@@ -570,7 +570,9 @@ struct tnl_clipspace_fastpath {
struct {
GLuint format;
GLuint size;
GLuint stride;
GLuint offset;
} *attr;
tnl_emit_func func;

View File

@@ -46,7 +46,9 @@ static GLboolean match_fastpath( struct tnl_clipspace *vtx,
return GL_FALSE;
for (j = 0; j < vtx->attr_count; j++)
if (vtx->attr[j].format != fp->attr[j].format)
if (vtx->attr[j].format != fp->attr[j].format ||
vtx->attr[j].inputsize != fp->attr[j].size ||
vtx->attr[j].vertoffset != fp->attr[j].offset)
return GL_FALSE;
if (fp->match_strides) {
@@ -90,6 +92,8 @@ void _tnl_register_fastpath( struct tnl_clipspace *vtx,
for (i = 0; i < vtx->attr_count; i++) {
fastpath->attr[i].format = vtx->attr[i].format;
fastpath->attr[i].stride = vtx->attr[i].inputstride;
fastpath->attr[i].size = vtx->attr[i].inputsize;
fastpath->attr[i].offset = vtx->attr[i].vertoffset;
}
fastpath->next = vtx->fastpath;
@@ -288,14 +292,6 @@ GLuint _tnl_install_attrs( GLcontext *ctx, const struct tnl_attr_map *map,
if (vp) {
vtx->need_viewport = GL_TRUE;
vtx->vp_scale[0] = vp[MAT_SX];
vtx->vp_scale[1] = vp[MAT_SY];
vtx->vp_scale[2] = vp[MAT_SZ];
vtx->vp_scale[3] = 1.0;
vtx->vp_xlate[0] = vp[MAT_TX];
vtx->vp_xlate[1] = vp[MAT_TY];
vtx->vp_xlate[2] = vp[MAT_TZ];
vtx->vp_xlate[3] = 0.0;
}
for (j = 0, i = 0; i < nr; i++) {
@@ -389,6 +385,17 @@ static void update_input_ptrs( GLcontext *ctx, GLuint start )
a[j].inputptr = ((GLubyte *)vptr->data) + start * vptr->stride;
}
if (a->vp) {
vtx->vp_scale[0] = a->vp[MAT_SX];
vtx->vp_scale[1] = a->vp[MAT_SY];
vtx->vp_scale[2] = a->vp[MAT_SZ];
vtx->vp_scale[3] = 1.0;
vtx->vp_xlate[0] = a->vp[MAT_TX];
vtx->vp_xlate[1] = a->vp[MAT_TY];
vtx->vp_xlate[2] = a->vp[MAT_TZ];
vtx->vp_xlate[3] = 0.0;
}
}
@@ -467,8 +474,8 @@ void _tnl_init_vertices( GLcontext *ctx,
vtx->codegen_emit = NULL;
#ifdef __i386__
if (getenv("MESA_EXPERIMENTAL"))
#ifdef USE_SSE_ASM
if (!_mesa_getenv("MESA_NO_CODEGEN"))
vtx->codegen_emit = _tnl_generate_sse_emit;
#endif
}

Some files were not shown because too many files have changed in this diff Show More