Compare commits

...

95 Commits

Author SHA1 Message Date
Keith Whitwell
b4979ec178 Allow the print opcode to compile 2005-06-10 13:59:49 +00:00
Keith Whitwell
6c1948d593 Fix typo in spot attenuation 2005-06-10 13:35:31 +00:00
Keith Whitwell
729cccba5d Correct test for attenuation.
DISSASEM changes.
2005-06-10 12:04:47 +00:00
Keith Whitwell
7e8e4c500e remove depend files on clean 2005-06-10 10:43:02 +00:00
Keith Whitwell
f6e7cfb60d Fix colormaterial flag calculations.
Fix lighting alpha result.
2005-06-10 08:33:37 +00:00
Keith Whitwell
52608d2d21 Add notes about intended precision of opcodes.
Remove dead floating point twiddles.
Fix bug translating MAD->MUL,ADD.
2005-06-10 08:32:27 +00:00
Keith Whitwell
1c48986e54 Fix a couple of buglets 2005-06-09 22:10:23 +00:00
Keith Whitwell
1fc4bcbb17 Another typo 2005-06-09 19:03:18 +00:00
Keith Whitwell
44367aab2a Further clean up RoughApproxPow2 and disable the optimized version --
it's a very poor approximation.
2005-06-09 18:59:41 +00:00
Keith Whitwell
2c6e8e90ec Fix typo in RoughApproxPow2 2005-06-09 18:52:42 +00:00
Keith Whitwell
81032030ff Store compiled vertex program representations in a pointer in the
vertex_program struct.

Allow switching between regular and vertex_program implementations
of fixed function TNL with the MESA_TNL_PROG environment var
(previously this required recompilation).

Ensure program compilation only references program data, not the
wider context.  This means that compiled programs only need to be
invalidated when the program string changes, not on other state
changes.
2005-06-09 14:55:34 +00:00
Keith Whitwell
a8534885ef Build vertex programs using state from a 'state key' struct which is
distilled from the current state.

Maintain a list of vertex programs for various different tnl states
indexed by these state keys.

This cuts down the number of vertex programs generated and means that
time spent optimizing vertex programs for execution isn't wasted each
time the state changes.
2005-06-09 14:52:08 +00:00
Keith Whitwell
79b7bd18bb Turn off debug 2005-06-08 22:14:29 +00:00
Keith Whitwell
8e56122782 Add t_vb_arbprogram_sse.c 2005-06-08 22:10:34 +00:00
Keith Whitwell
ea93b2986b Runtime generate sse/sse2 code for some vertex programs. Experimental
and only active when _TNL_FIXED_FUNCTION_PROGRAM is defined *and*
the MESA_EXPERIMENTAL environment variable is set...
Works for the arbfplight demo at least.
2005-06-08 22:10:16 +00:00
Keith Whitwell
002d0ad3e9 Turn off DISASSEM 2005-06-08 22:06:29 +00:00
Keith Whitwell
562bdaf70e New arguments for sse_shufps() 2005-06-08 21:58:30 +00:00
Keith Whitwell
9899f58c76 Use ALIGN_MALLOC for parameter lists. 2005-06-08 21:57:45 +00:00
Keith Whitwell
dce3a91a8d Add some more opcodes 2005-06-08 21:56:21 +00:00
Ben Skeggs
2d2f5a4b19 - Secondary colour
- Calculate tc_count in EmitArrays (enabled units != nr texcoords).
2005-06-08 15:05:19 +00:00
Brian Paul
ee7ad16f3f regenerated 2005-06-08 13:35:28 +00:00
Brian Paul
2c7336af4e put full prototype on one line to fix gl_mangle.h generation (Dave Reveman) 2005-06-08 13:35:07 +00:00
Brian Paul
012de39c23 remove stray line 2005-06-08 13:07:33 +00:00
Keith Whitwell
60339c7062 Remove ARL opcode from interpreter.
Revert SEL opcode to MSK.
Split out t_vb_arbprogram.h header file.
2005-06-08 10:03:29 +00:00
Keith Whitwell
7fb16836e7 new file 2005-06-08 10:02:28 +00:00
Brian Paul
d45cb9a836 regenerate for latest glext.h 2005-06-08 02:18:22 +00:00
Brian Paul
681b758f11 fix some renderbuffer problems for Xserver build (Dave Reveman) 2005-06-08 02:17:10 +00:00
Brian Paul
a0b5c98364 check for double-buffered buffer in XMesaDestroyBuffer() (Dave Reveman) 2005-06-08 02:14:55 +00:00
Daniel Borca
31d0cedd78 updates from Paul Garceau 2005-06-07 19:01:33 +00:00
Brian Paul
7477a7d366 added GL libs to APP_LIB_DEPS (bug 3485) 2005-06-07 15:30:12 +00:00
Brian Paul
4417d4cb61 fix error in OSMESA_LIB_NAME line 2005-06-07 15:25:08 +00:00
Brian Paul
ed7f3aead8 fix GL_ALPHA render-to-texture problem (Jon Smirl) 2005-06-07 15:03:40 +00:00
Keith Whitwell
395280bf88 Initialize some variables. 2005-06-07 12:46:30 +00:00
Keith Whitwell
a4691981d9 Add new runtime assembly files. 2005-06-07 12:45:29 +00:00
Keith Whitwell
1d60469c4c Split out runtime assembly functions. 2005-06-07 12:45:04 +00:00
Keith Whitwell
461a2a799a New files - split off runtime assembly functions from
t_vertex_sse.c.
2005-06-07 12:44:26 +00:00
Keith Whitwell
757e0855ad Simplify interpreted language:
- Expand operand argument specifiers so that all registers and
  parameters can be referenced directly.  Remove old PAR/PRL
  instructions.

- No 3 operand instructions, translate MAD -> MUL, ADD.  (No room for
  3 full operands in instruction struct).

- Translate SWZ instructions into 1 or 2 reduced swizzles at compile
  time.

- Add hardwired code for moving input and output values to/from the
  register file.  Drop old INx, OUT instructions.
2005-06-07 10:59:37 +00:00
Keith Whitwell
17d249d31b Add a VP_MAX_OPCODE entry to allow engines with internal opcodes to
place them sensibly.
2005-06-07 10:56:17 +00:00
Daniel Borca
4f923fb0bc updates from Paul Garceau 2005-06-07 05:29:38 +00:00
Jon Smirl
c20a2b0b72 Add SetBuffer to egl driver too 2005-06-07 02:10:14 +00:00
Jon Smirl
ef9e0be0cb Add a NULL SetBuffer function to the fbdev driver 2005-06-06 21:40:55 +00:00
Brian Paul
2e7dcdd38b this is auto-generated 2005-06-06 14:40:56 +00:00
Ben Skeggs
d59fbcdee5 TEX to output 2005-06-06 07:38:29 +00:00
Ben Skeggs
3c4c6d1f80 Fix xyz/w interaction (needs a cleanup still..)
Use SRC0A instead of WZY/XXX combination for W in XYZ positions.
Remove dodgy hack from POW opcode, now works correctly without it
2005-06-05 08:25:54 +00:00
Jon Smirl
40b8b57ed4 Make install install GLES too 2005-06-05 02:10:58 +00:00
Brian Paul
df5e2b934b set OLD_RENDERBUFFER=0, need to clean up a few more things before totally removing that 2005-06-04 22:09:27 +00:00
Brian Paul
d96dd3cd49 remove old span functions from swrast_device_driver struct 2005-06-04 18:25:39 +00:00
Brian Paul
bb8b302dbc remove old span code 2005-06-04 18:12:28 +00:00
Brian Paul
5ec5c6b222 fix an assertion 2005-06-04 17:53:30 +00:00
Brian Paul
863bd56520 remove old span code 2005-06-04 17:45:50 +00:00
Brian Paul
5821f3d70c added comment 2005-06-04 17:44:42 +00:00
Karl Schultz
5b10d71559 Fixup file lists for tarball/zip file creation.
- Adjust for recent changes to Windows build files.
- Add in at least some of the new slang files - enough to build on
Windows, but some of the other slang-related files may still need to be
added.  (Will probably get corrected just prior to next release, if needed)
2005-06-03 15:24:55 +00:00
Karl Schultz
516546ad5b Updates for new Windows build system. 2005-06-02 23:17:02 +00:00
Brian Paul
3fe9c40cb2 Remove last of the old span code. 2005-06-02 04:09:05 +00:00
Brian Paul
13c8f985d9 oops, undo previous change 2005-06-02 04:07:08 +00:00
Brian Paul
1516f559bc start removing old (pre-renderbuffer) span code 2005-06-02 04:05:45 +00:00
Jouk Jansen
c4fbdb090c Committing in .
OpenVMS makefile added

 Added Files:
 	Mesa/src/mesa/shader/grammar/descrip.mms
 ----------------------------------------------------------------------
2005-06-01 12:07:15 +00:00
Jouk Jansen
589a3a3f6e Committing in .
Update OpneVMS compilesupport

 Modified Files:
 	Mesa/src/mesa/shader/descrip.mms
 	Mesa/src/mesa/shader/slang/descrip.mms
 	Mesa/src/mesa/shader/slang/slang_compile.c
 	Mesa/src/mesa/shader/slang/slang_storage.c
 	Mesa/src/mesa/shader/slang/slang_storage.h
 ----------------------------------------------------------------------
2005-06-01 12:05:34 +00:00
Eric Anholt
f090fdc50b Move fallback and other debugging under TDFX_DEBUG using the same mechanism
as other drivers.
2005-06-01 08:22:57 +00:00
Eric Anholt
d638f6a0bb Add no_rast option. 2005-06-01 07:44:52 +00:00
Keith Whitwell
502504de23 Add a mode to test flat shading + separate specular. 2005-06-01 07:02:23 +00:00
Eric Anholt
f772e3dd15 Fix the 3dfx driver by correcting what appears to be a typo GL_RGBA8 instead
of GL_RGBA in driNewRenderbuffer of the backbuffer.
2005-06-01 02:59:12 +00:00
Brian Paul
c7264415b6 added code to detect GL_FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT_EXT error 2005-06-01 00:50:23 +00:00
Brian Paul
1b93953fbc add support for GL_RENDERBUFFER_RED/GREEN/BLUE/etc_SIZE_EXT querie 2005-05-31 23:55:21 +00:00
Brian Paul
5d5100aabc remove temporary GL_EXT_framebuffer_object info 2005-05-31 23:54:44 +00:00
Brian Paul
2e081cd90e updated to version 28 2005-05-31 23:54:24 +00:00
Eric Anholt
0009e3d97d Bugzilla #2708: Disable the fallback on GL_SPHERE_MAP. It appears to hurt more
than it helps, and we seem to have a handle on how to fix it.
2005-05-31 23:32:47 +00:00
Alan Hourihane
628b18b8ca Add Intel(R) 945G support (Keith Whitwell, Tungsten Graphics) 2005-05-31 18:10:03 +00:00
Aapo Tahkola
4ec6eceea9 Causes lockups on some rare cases. 2005-05-31 05:53:38 +00:00
Eric Anholt
8c2a9a9166 Pull locking out of HW_LOCK/UNLOCK and into SpanRenderStart/Finish. Also do
some cleanups on the span macros.  This does not deal with the brokenness of
depth spans, but makes the code more readable.
2005-05-31 05:31:43 +00:00
Eric Anholt
ef377c3c00 Correct the descriptions of the glBlend{Equation,Func} fallbacks in r128, and
remove those descriptions and the corresponding bits on r200, where they're no
longer used.
2005-05-31 04:26:13 +00:00
Eric Anholt
b79c47e90c Remove unused CTX_ARG2 define. 2005-05-31 04:13:45 +00:00
Eric Anholt
8a1df96862 Bugzilla #2195: Convert the radeon driver to the t_vertex interface. This cuts
about 200 lines from the code and 25k from the binary, while matching other
drivers more closely.  In the worst case (tcl_mode=0) it appears to have
a performance cost of 4.4% +/- 0.3% on quake3 (800x600 demofours, 1ghz p3,
rv200).  Tested on ut2004, ut, q3, projtex.

Submitted by:	Andreas Stenglein <a.stenglein@gmx.net>
2005-05-31 04:04:24 +00:00
Eric Anholt
9dff2ca07a Move fallback debugging under MACH64_DEBUG=fall (matching other drivers) and
add pretty descriptions of the bits.  GC one of the bits that was unused.
Also, now only the first thing triggering a fallback and the last thing
requiring one do the debug output.  This also matches other drivers.
2005-05-31 03:47:39 +00:00
Eric Anholt
12eabeb3b9 Pull locking out from HW_LOCK/UNLOCK into SpanRenderStart/Finish. Provides a
factor of 5+ improvement in no_rast glxgears and 2.3 in no_rast quake3 (n=1,
320x240, 16bpp, low qualities, 1ghz p3)
2005-05-30 08:07:03 +00:00
Eric Anholt
c7f8d36451 Fix software fallbacks by being safe with macro arguments in READ/WRITE_DEPTH.
Convert to spantmp2.h while I'm here.  Tested with 16 and 32bpp no_rast
glxgears.
2005-05-30 06:50:17 +00:00
Eric Anholt
993d8ad5ef Add the no_rast debug option to mach64. It shows that software fallbacks are
pretty broken.
2005-05-30 06:41:19 +00:00
Eric Anholt
b328dded75 Pull hardware locking out into SpanRenderStart/Finish rather than
HW_LOCK/UNLOCK. Provides a 61% performance improvement in no_rast=true quake3
(n=2, 320x240, 16bpp, p4 1ghz), and a factor of 3 improvement in no_rast
glxgears.
2005-05-30 06:15:29 +00:00
Eric Anholt
c1b87b2a06 Add the description of the no_rast option fallback so that MGA_DEBUG=fall
doesn't segfault with no_rast.
2005-05-30 06:11:22 +00:00
Eric Anholt
0936eeb456 Add the no_rast debug option, which I used in some testing. 2005-05-30 03:32:52 +00:00
Eric Anholt
f2149a7a66 Remove unused CTX_ARG2. 2005-05-30 01:59:39 +00:00
Eric Anholt
0b73889d54 Put some fallback debugging output under DEBUG_FALLBACKS. 2005-05-28 23:45:39 +00:00
Eric Anholt
2962f88189 Add a missing EnsureCmdBufSpace, matching r200. 2005-05-28 22:56:16 +00:00
Eric Anholt
f054fa85d8 Add a freebsd-dri-amd64 config, and quiet makedepend slightly by making an
EXPAT_INCLUDES config variable (set on FreeBSD) which is then used in
Makefile.template's INCLUDES.
2005-05-28 20:17:06 +00:00
Jerome Glisse
2ed4c296d9 Some fixes 2005-05-28 12:18:32 +00:00
Dave Airlie
22b0a42465 use shared-core 2005-05-28 10:55:23 +00:00
Ben Skeggs
0bae91562e Up MAX_AOS_ARRAYS to 16. Do we need more? 2005-05-28 05:20:05 +00:00
Ben Skeggs
908dbc44c2 Play with swizzling a bit. 2005-05-28 03:19:56 +00:00
Aapo Tahkola
74e412c695 Programmable per-vertex point sizes and proper result reg assigns. 2005-05-28 01:02:00 +00:00
Aapo Tahkola
0080faf83e More optimal r300Clear. 2005-05-27 20:10:05 +00:00
Brian Paul
d322810e13 properly pop the GL_TEXTURE_GEN_ enable state 2005-05-27 14:44:14 +00:00
Karl Schultz
6580a6d561 Account for moved/new/removed files. 2005-05-26 18:22:13 +00:00
Ian Romanick
70dbbbf89a Fix gl_enums.py so that enums that are listed with the same name in
multiple places don't get generated multiple times.
2005-05-26 16:59:47 +00:00
Ian Romanick
497dd3e920 Minor correction to EXT_framebuffer_object XML. Fix gl_table.py so that it
generates the correct script name in the generated output.
2005-05-26 16:34:58 +00:00
Ian Romanick
249db89b00 Make a couple minor corrections to gl_API.xml. Fixes the name of an
extension that was missing the GL_ part and uses the core GL type names for
vertex buffer object functions instead of the ARB names.

Also commits the resulting changes to the generated code.  Some how, the
#if sequence disappeared in the 1.52 version of glapi_x86.S.
2005-05-26 16:24:35 +00:00
111 changed files with 7782 additions and 6509 deletions

View File

@@ -28,6 +28,7 @@ realclean:
-rm -f `find . -name \*.o`
-rm -f `find . -name \*.a`
-rm -f `find . -name \*.so`
-rm -f `find . -name depend`
@@ -61,6 +62,7 @@ darwin \
darwin-static \
freebsd \
freebsd-dri \
freebsd-dri-amd64 \
freebsd-dri-x86 \
hpux10 \
hpux10-gcc \
@@ -139,7 +141,6 @@ LIB_FILES = \
$(DIRECTORY)/Makefile* \
$(DIRECTORY)/descrip.mms \
$(DIRECTORY)/mms-config. \
$(DIRECTORY)/Mesa.dsw \
$(DIRECTORY)/bin/mklib \
$(DIRECTORY)/bin/installmesa \
$(DIRECTORY)/configs/[a-z]* \
@@ -179,28 +180,25 @@ LIB_FILES = \
$(DIRECTORY)/src/mesa/descrip.mms \
$(DIRECTORY)/src/mesa/depend \
$(DIRECTORY)/src/mesa/main/*.[chS] \
$(DIRECTORY)/src/mesa/main/main.dsp \
$(DIRECTORY)/src/mesa/main/descrip.mms \
$(DIRECTORY)/src/mesa/glapi/*.[chS] \
$(DIRECTORY)/src/mesa/glapi/glapi.dsp \
$(DIRECTORY)/src/mesa/glapi/descrip.mms \
$(DIRECTORY)/src/mesa/array_cache/*.[ch] \
$(DIRECTORY)/src/mesa/array_cache/array_cache.dsp \
$(DIRECTORY)/src/mesa/array_cache/descrip.mms \
$(DIRECTORY)/src/mesa/math/*.[ch] \
$(DIRECTORY)/src/mesa/math/math.dsp \
$(DIRECTORY)/src/mesa/math/descrip.mms \
$(DIRECTORY)/src/mesa/shader/*.[ch] \
$(DIRECTORY)/src/mesa/shader/shader.dsp \
$(DIRECTORY)/src/mesa/shader/descrip.mms \
$(DIRECTORY)/src/mesa/shader/grammar/*.[ch] \
$(DIRECTORY)/src/mesa/shader/grammar/descrip.mms \
$(DIRECTORY)/src/mesa/shader/slang/*.[ch] \
$(DIRECTORY)/src/mesa/shader/slang/descrip.mms \
$(DIRECTORY)/src/mesa/shader/slang/library/*.[ch] \
$(DIRECTORY)/src/mesa/swrast/*.[ch] \
$(DIRECTORY)/src/mesa/swrast/swrast.dsp \
$(DIRECTORY)/src/mesa/swrast/descrip.mms \
$(DIRECTORY)/src/mesa/swrast_setup/*.[ch] \
$(DIRECTORY)/src/mesa/swrast_setup/swrast_setup.dsp \
$(DIRECTORY)/src/mesa/swrast_setup/descrip.mms \
$(DIRECTORY)/src/mesa/tnl/*.[chS] \
$(DIRECTORY)/src/mesa/tnl/tnl.dsp \
$(DIRECTORY)/src/mesa/tnl/descrip.mms \
$(DIRECTORY)/src/mesa/tnl_dd/*.[ch] \
$(DIRECTORY)/src/mesa/tnl_dd/imm/*.[ch] \
@@ -209,8 +207,8 @@ LIB_FILES = \
$(DIRECTORY)/src/mesa/drivers/beos/Makefile \
$(DIRECTORY)/src/mesa/drivers/common/*.[ch] \
$(DIRECTORY)/src/mesa/drivers/common/descrip.mms \
$(DIRECTORY)/src/mesa/drivers/directfb/*.[ch] \
$(DIRECTORY)/src/mesa/drivers/directfb/Makefile \
$(DIRECTORY)/src/mesa/drivers/directfb/*.[ch] \
$(DIRECTORY)/src/mesa/drivers/directfb/Makefile \
$(DIRECTORY)/src/mesa/drivers/dos/*.[chS] \
$(DIRECTORY)/src/mesa/drivers/dri/common/*.[ch] \
$(DIRECTORY)/src/mesa/drivers/fbdev/glfbdev.c \
@@ -226,12 +224,10 @@ LIB_FILES = \
$(DIRECTORY)/src/mesa/drivers/osmesa/Makefile.win \
$(DIRECTORY)/src/mesa/drivers/osmesa/descrip.mms \
$(DIRECTORY)/src/mesa/drivers/osmesa/osmesa.def \
$(DIRECTORY)/src/mesa/drivers/osmesa/osmesa.dsp \
$(DIRECTORY)/src/mesa/drivers/osmesa/*.[ch] \
$(DIRECTORY)/src/mesa/drivers/svga/*.[ch] \
$(DIRECTORY)/src/mesa/drivers/windows/*/*.[ch] \
$(DIRECTORY)/src/mesa/drivers/windows/*/*.def \
$(DIRECTORY)/src/mesa/drivers/windows/*/*.dsp \
$(DIRECTORY)/src/mesa/drivers/x11/descrip.mms \
$(DIRECTORY)/src/mesa/drivers/x11/*.[ch] \
$(DIRECTORY)/src/mesa/sparc/*.[chS] \
@@ -243,9 +239,7 @@ LIB_FILES = \
$(DIRECTORY)/src/glu/sgi/Makefile \
$(DIRECTORY)/src/glu/sgi/Makefile.win \
$(DIRECTORY)/src/glu/sgi/Makefile.DJ \
$(DIRECTORY)/src/glu/sgi/cc*.txt \
$(DIRECTORY)/src/glu/sgi/glu.def \
$(DIRECTORY)/src/glu/sgi/glu.dsp \
$(DIRECTORY)/src/glu/sgi/dummy.cc \
$(DIRECTORY)/src/glu/sgi/descrip.mms \
$(DIRECTORY)/src/glu/sgi/mesaglu.opt \
@@ -277,7 +271,13 @@ LIB_FILES = \
$(DIRECTORY)/progs/util/sampleMakefile \
$(DIRECTORY)/vms/analyze_map.com \
$(DIRECTORY)/vms/xlib.opt \
$(DIRECTORY)/vms/xlib_share.opt
$(DIRECTORY)/vms/xlib_share.opt \
$(DIRECTORY)/windows/VC?/mesa/gdi/gdi.dsp \
$(DIRECTORY)/windows/VC?/mesa/glu/*.txt \
$(DIRECTORY)/windows/VC?/mesa/glu/glu.dsp \
$(DIRECTORY)/windows/VC?/mesa/mesa.dsw \
$(DIRECTORY)/windows/VC?/mesa/mesa/mesa.dsp \
$(DIRECTORY)/windows/VC?/mesa/osmesa/osmesa.dsp
GLUT_FILES = \
@@ -288,7 +288,6 @@ GLUT_FILES = \
$(DIRECTORY)/src/glut/glx/*def \
$(DIRECTORY)/src/glut/glx/descrip.mms \
$(DIRECTORY)/src/glut/glx/mms_depend \
$(DIRECTORY)/src/glut/glx/glut.dsp \
$(DIRECTORY)/src/glut/glx/*.[ch] \
$(DIRECTORY)/src/glut/beos/*.[ch] \
$(DIRECTORY)/src/glut/beos/*.cpp \
@@ -311,8 +310,6 @@ DEMO_FILES = \
$(DIRECTORY)/progs/demos/*.cxx \
$(DIRECTORY)/progs/demos/*.dat \
$(DIRECTORY)/progs/demos/README \
$(DIRECTORY)/progs/demos/Windows/*.dsp \
$(DIRECTORY)/progs/demos/Windows/*.dsw \
$(DIRECTORY)/progs/xdemos/Makefile* \
$(DIRECTORY)/progs/xdemos/descrip.mms \
$(DIRECTORY)/progs/xdemos/*.[chf] \
@@ -325,7 +322,10 @@ DEMO_FILES = \
$(DIRECTORY)/progs/windml/Makefile.ugl \
$(DIRECTORY)/progs/windml/*.c \
$(DIRECTORY)/progs/windml/*.bmp \
$(DIRECTORY)/progs/ggi/*.c
$(DIRECTORY)/progs/ggi/*.c \
$(DIRECTORY)/windows/VC?/progs/demos/*.dsp \
$(DIRECTORY)/windows/VC?/progs/glut/glut.dsp \
$(DIRECTORY)/windows/VC?/progs/progs.dsw
DRI_FILES = \

View File

@@ -53,8 +53,10 @@ set -v
mkdir ${INCLUDE_DIR}
mkdir ${INCLUDE_DIR}/GL
mkdir ${INCLUDE_DIR}/GLES
mkdir ${LIB_DIR}
cp -f ${TOP}/include/GL/*.h ${INCLUDE_DIR}/GL
cp -f ${TOP}/include/GLES/*.h ${INCLUDE_DIR}/GLES
cp -fd ${TOP}/lib*/lib* ${LIB_DIR}
echo "Done."

View File

@@ -39,7 +39,7 @@ GL_LIB_NAME = lib$(GL_LIB).so
GLU_LIB_NAME = lib$(GLU_LIB).so
GLUT_LIB_NAME = lib$(GLUT_LIB).so
GLW_LIB_NAME = lib$(GLW_LIB).so
OSMESA_LIB_NAME = lib$(OSMesa).so
OSMESA_LIB_NAME = lib$(OSMESA_LIB).so
# Optional assembly language optimization files for libGL

View File

@@ -11,16 +11,18 @@ CXX = g++
WARN_FLAGS = -Wall
OPT_FLAGS = -O
EXPAT_INCLUDES = -I/usr/local/include
X11_INCLUDES = -I/usr/X11R6/include -I/usr/X11R6/include/X11/extensions
DEFINES = -DDRI_NEW_INTERFACE_ONLY
CFLAGS = $(DEFINES) -Wmissing-prototypes -g -std=c99 -Wundef -fPIC -ffast-math -I/usr/local/include $(X11_INCLUDES)
CFLAGS = $(DEFINES) -Wmissing-prototypes -g -std=c99 -Wundef -fPIC \
-ffast-math $(X11_INCLUDES)
CXXFLAGS = $(DEFINES) -Wall -g -ansi -pedantic -fPIC
ASM_SOURCES =
# Library/program dependencies
DRI_LIB_DEPS = -L/usr/local/lib -lm -lpthread -lexpat
GL_LIB_DEPS = -L/usr/X11R6/lib -lX11 -lXext -lm -pthread
GL_LIB_DEPS = -L/usr/X11R6/lib -lX11 -lXext -lm -lpthread
GLUT_LIB_DEPS = -L$(LIB_DIR) -L/usr/X11R6/lib -lGLU -lGL -lX11 -lXmu -lXt -lXi -lm
GLW_LIB_DEPS = -L$(LIB_DIR) -L/usr/X11R6/lib -lGL -lXt -lXm -lX11

View File

@@ -0,0 +1,8 @@
# -*-makefile-*-
# Configuration for freebsd-dri-amd64: FreeBSD DRI hardware drivers
include $(TOP)/configs/freebsd-dri
CONFIG_NAME = freebsd-dri-x86-64
ASM_FLAGS = -DUSE_X86_64_ASM

View File

@@ -9,7 +9,7 @@ CC = cc
CFLAGS = -Xa -xO3 -xpentium -KPIC -I/usr/openwin/include -DUSE_XSHM
MKLIB_OPTIONS = -static
APP_LIB_DEPS = -L$(LIB_DIR) -L/usr/openwin/lib -R/usr/openwin/lib -lX11 -lXext -lXmu -lXi -lm
APP_LIB_DEPS = -L$(LIB_DIR) -L/usr/openwin/lib -R/usr/openwin/lib -lX11 -lXext -lXmu -lXi -lm -lglut -lGLU -lGL
GL_LIB_NAME = libGL.a
GLU_LIB_NAME = libGLU.a

View File

@@ -14,68 +14,77 @@ Quick & dirty start:
Contact:
--------
Daniel Borca <dborca@users.sourceforge.net>
WARNING! The info below this line is outdated (yet some of it useful). WARNING!
*******************************************************************************
The Mingw port for Mesa 3-D Graphics Library was created August 30, 1998 by Paul Garceau.
August 30, 1998 -- Paul Garceau
Updated January 13, 2000 -- Paul Garceau (pgarceau@teleport.com)
Updated January 13, 2000; June 3, 2005 -- Paul Garceau <pgarceau@users.sourceforge.net>
DISCLAIMER: I make this port of the Mesa 3-D Graphics Library as a service
to the general public. I can, in no way support or make any guarantee that the
build will work for your system.
The associated packages and batch files I have included as part of the GCC-2.95.2/Mingw32 extension are provided "As-is" with out any guarantee of support or functionality from this author.
Acknowledgements:
Feel free to modify or change things as you see fit, just remember that
I can't support any modifications you might want to make to the files which I
have included OR the lgpl protected Mesa 3-D Graphics Library.
Daniel Borca, whose work and commitment to maintaining the Mingw port of the Mesa 3-D Graphics Library has been, and will continue to be greatly appreciated by an overworked and underpaid developer such as myself.
Without the creative inspiration and personal commitment provided by Mumit Khan, Jan-Jaap Vanderhagen and Colin Peters, Mingw would never have existed. Acknowledgements also need to be given to all of the developers who have worked on Mingw, Mesa and Msys over the years.
Last, but certainly far from the least, Brian Paul, who has dedicated at least the last seven or eight years of his life to making Mesa 3-D Graphics Library what it is today and managing the development for all of those years.
*********************************************************************************
I recommend using GCC-2.95.2/Mingw32 which is available at Mumit Khans' ftp site:
Greetings,
(ftp://ftp.xraylith.wisc.edu/pub/khan/gnu-win32/mingw32/)
Feel free to modify or change things related to the Mingw build as you see fit, just remember that, the author of the current build may not be able to support any modifications you might want to make to the files which have been included for the build.
Mesa core components are licensed under XFree-86 (for more on licensing of Mesa 3-D Graphics Library, check out the Mesa homepage (http://www.mesa3d.org).
The Mingw generated libraries themselves are licensed under the GNU-LGPL license. Source code for Mingw can be found at http://www.mingw.org. For licensing terms on Mingw, please visit http://www.mingw.org.
It is recommended that you use the latest "stable" release of Mingw. "Candidates" are beta testing distributions for Mingw. Mingw is available at http://www.mingw.org.
This build has been tested under WinNT4/SP6. Win9x and WinNT5 remain untested by me. I have not tested any of the demos included with Mesa3d.
I recommend using the GCC-2.95.2/Mingw32.
Installation:
ftp://ftp.xraylith.wisc.edu/pub/khan/gnu-win32/mingw32/gcc-2.95.2
This readme assumes that you already have extracted the necessary files to a working directory/folder that Mingw can use to build the Mesa3D libraries and that you know where that directory/folder is located on your Windows system. If you have any questions about how to set things up properly which is specific to Mesa3D, the folks on the Mesa3D mailing lists (http://www.mesa3d.org) would probably be happy to assist you. Also you can probably ask anyone on the Mingw mailing lists for any questions specific to Mingw (http://www.mingw.org)
Much thanks to the combined efforts of Mumit Khan, Jan-Jaap Vanderhagen
and Colin Peters for making it possible for the Mingw32 toolchain to exist. Also, thanks go out to Stephane Rehel for the work that was completed on the Cygwin build.
Targets and Environment variables used for Mingw build:
Installing GCC-2.95.2/Mingw32 Build:
Before going into the actual build of the libraries, here is a list of available targets for the make process:
a) Open the file archive (either tar.gz or .zip extensions)
"all" or "libgl" -- this target will build libopengl.a, a static library. It will not build the demos, etc.
b) Decide the directory you want to move the archived files to.
clean -- this target will clean up most of the Mesa 3-D Graphics Library/object code from your hard drive.
realclean -- this target will clean up all of the Mesa 3D Graphics Library and the Mesa object code that it can find.
Environment Variables:
The environment variables are used to determine what sort of graphics driver support needs to be included in the finished Mesa 3-D Graphics Library.
GLIDE path to Glide3 SDK; used with FX.
default = $(TOP)/glide3
FX=1 build for 3dfx Glide3. Note that this disables
compilation of most WMesa code and requires fxMesa.
As a consequence, you'll need the Win32 Glide3
library to build any application.
default = no
ICD=1 build the installable client driver interface
(windows opengl driver interface)
default = no
X86=1 optimize for x86 (if possible, use MMX, SSE, 3DNow).
default = no
d) Extract the files from the archive.
e) Edit the mingw32.bat file to accomodate your choice of directory structure.
%mesaroot%: This is your root directory (Mesa-3.3)
%mesasrc%: This is the Mesa-3.3 src directory (Mesa-3.3\src)
%mesalib%: This is where the build will put libGL.a and libGLU.a
Running the Build:
Open your Command Prompt or MS-DOS prompt.
Go to your Mesa-3.3 'root' directory
At the command line type: mingw32
Launch Mingw.
From the Windows Command Prompt:
Set Environment Variables (as needed).
"cd" to your Mesa3D 'root' directory.
Enter "mingw32-make -f makefile.mgw <target>
That's all there is to it.
Enjoy!
Peace,
Paul G. (pgarceau@teleport.com)
Paul G. <pgarceau@users.sourceforge.net>
Daniel Borca <dborca@users.sourceforge.net>

View File

@@ -1,108 +1,136 @@
File: docs/README.WIN32
Last updated: Oct 01, 2004 - Karl Schultz - kschultz@users.sourceforge.net
Last updated: Jun 02, 2005 - Karl Schultz - kschultz@users.sourceforge.net
Quick Start
----- -----
Unzip both ZIP files (MesaLib and MesaDemos) into the same directory.
The libs and demos build separately, so if you do not care about the
demos, you do not have to unzip that zip file. But if you do, it does
need to be unzipped into the same directory as the lib zip file because
the demos depend on the libs.
need to be unzipped into the same directory as the lib zip file
because the demos depend on the libs.
The build system has been changed to use Microsoft Visual Studio project
workspaces and projects. Makefiles are no longer shipped or supported, but
can be generated from the projects using Visual Studio.
The Windows build system uses Microsoft Visual Studio. Project files
for a specific version of Visual Studio are in their own directory in
the top-level "windows" directory. For example, Visual Studio 6 files
are in windows/VC6. If a directory does not exist for your version of
Visual Studio, you can try importing the project files from an earlier
version of Visual Studio. At this time, project files exist for
Version 6.
The workspace and project files were created with Visual Studio 6, so that
they can be used with VS6 and so that they can also be imported into VS 7.
The project files to build the core Mesa library, Windows Mesa
drivers, OSMesa, and GLU are in the mesa directory. The project files
to build GLUT and some demo programs are in the progs directory.
Details and Notes
Makefiles are no longer shipped or supported, but can be generated
from the projects using Visual Studio.
- To build the Mesa libraries, open the Mesa.dsw workspace file
in the top directory. You will need to build at least one
driver. Currently, only the gdi and osmesa drivers are available.
Select one or the other as the active project and build it.
If you want glu, select the glu project as active and build that as well.
- Glut is no longer in the Mesa.dsw workspace. It is now built in
the demo workspace (see below).
- The build process will create a lib directory in the top directory
and will put the following files there as you build them:
Windows Drivers
------- -------
At this time, only the GDI driver is known to work, as it has been
ported and rewritten to the latest Mesa DD interfaces. Source code
also exists in the tree for other drivers in src/mesa/drivers/windows,
but the status of this code is unknown.
The GDI driver operates basically by writing pixel spans into a DIB
section and then blitting the DIB to the window. The driver was
recently cleaned up and rewitten and so may have bugs or may be
missing some functionality. The older versions of the CVS source may
be useful in figuring out any problems, or report them to me.
To build Mesa with the GDI driver, build the mesa, gdi, and glu
projects in the Visual Studio workspace found at
windows/VC?/mesa/mesa.dsw. The osmesa DLL can also be built with the
osmesa project.
The build system creates a lib top-level directory and copies
resulting LIB and DLL files to this lib directory. The files are:
OPENGL32.LIB, GLU32.LIB, OSMESA32.LIB
OPENGL32.DLL, GLU32.DLL, OSMESA32.DLL
- Some users have reported problems building glu with VS7 after importing
and converting the VS6 project files. The problem is caused by a custom
build step that was put in place to work around a problem with VS6 not
recognizing .cc files as C++ source files. It appears that VS7 can be
configured to recognize .cc files as C++ files and so it compiles these
glu files with the default settings, and does not use settings that are
required to compile the files correctly. The easiest way to solve the
problem is to remove the .cc files from the glu project. This does not
delete the files, but removes them from the project so that VS does not
try to compile them at all. This allows the custom build step to compile
the files with the proper settings.
If the MesaDemos ZIP file was extracted, the DLL files are also copied
to the demos directory.
- After building, you can copy the above DLL files to a place in your PATH
such as $SystemRoot/SYSTEM32. If you don't like putting things in a
system directory, place them in the same directory as the executable(s).
Be careful about accidentially overwriting files of the same name in
the SYSTEM32 directory.
- Build the demos by opening the appropriate *.dsw file in the
progs directory tree. For example, to build the demos, use
progs/demos/Windows/demos.dsw. The Windows directory contains
the workspace and all the projects for each demo program. Each
project places the executable in the same directory as its source
code, which is required for some demos.
GLUT and Demos
---- --- -----
- The demo projects also copy the Mesa library DLL files from the lib
directory into the same directory as the demo executables, so that
the demos use the Mesa libs you just built.
A Visual Studio workspace can be found at windows/VC?/progs/progs.dsw.
It can be used to build GLUT and a few demos. The GLUT lib and DLL
are copied to the top-level lib directory, along with the Mesa libs.
- The DLL files are built so that the external entry points use the
stdcall calling convention.
The demo build system expects to find the LIB files in the top level
lib directory, so you must build the Mesa libs first. The demo
executables are placed in the demos directory, because some of them
rely on data files found there. Also, the Mesa lib DLL's were copied
there by the Mesa lib build process. Therefore, you should be able to
simply run the demo executables from the demo directory.
- Static LIB files are not built. The LIB files that are built with
are the linker import files associated with the DLL files.
- The si-glu sources are used to build the GLU libs. This was done
mainly to get the better tessellator code.
- The Windows driver (in src/Windows) builds and runs at least at
a minimal level. I modified this driver to work with the new
Mesa 4.0 code and driver architecture, but I did not do a great
deal of optimization and testing. There are many opportunities
for optimization, many of which can be done by coding more specific
paths for the rasterizers. See src/osmesa/osmesa.c for some good
examples.
Build System Notes
----- ------ -----
- There is DirectDraw support in the Windows driver, updated by
Daniel Slater. You'll need to uncomment the #define DDRAW line
in src/Windows/wmesadef.h and add ddraw.lib to the list of libraries.
On some systems, you will acheive significantly higher framerates
with DirectDraw.
VC6
---
- Some of the more specialized code like FX drivers, stereo, and
parallel support isn't compiled or tested. I left much of this
code alone, but it may need some work to get it 'turned on' again.
Visual Studio 6 does not recognize files with the .cc extension as C++
language files, without a lot of unnatural tweaking. So, the VC6
build process uses custom build steps to compile these files in the
GLU library.
- No assembly code is compiled or assembled. Again, this may need
some work to turn it back on or use it again.
- To build "mangled" Mesa, add the preprocessor define USE_MGL_NAMESPACE
to the project settings. You will also need to edit src/mesa.def to change
all the gl* symbols to mgl*. Because this is easy to do with a global
replace operation in a text editor, no additional mangled version of mesa.def
is maintained or shipped.
VC7
---
Some users have reported problems building glu with VC7 after
importing and converting the VC6 project files. The problem is caused
by a custom build step that was put in place to work around a problem
with VC6 not recognizing .cc files as C++ source files. It appears
that VC7 can be configured to recognize .cc files as C++ files and so
it compiles these glu files with the default settings, and does not
use settings that are required to compile the files correctly. The
easiest way to solve the problem is to remove the .cc files from the
glu project. This does not delete the files, but removes them from
the project so that VS does not try to compile them at all. This
allows the custom build step to compile the files with the proper
settings. Another approach is to remove the custom build step and fix
the project up to compile the files normally.
General
-------
After building, you can copy the above DLL files to a place in your
PATH such as $SystemRoot/SYSTEM32. If you don't like putting things
in a system directory, place them in the same directory as the
executable(s). Be careful about accidentially overwriting files of
the same name in the SYSTEM32 directory.
The DLL files are built so that the external entry points use the
stdcall calling convention.
Static LIB files are not built. The LIB files that are built with are
the linker import files associated with the DLL files.
The si-glu sources are used to build the GLU libs. This was done
mainly to get the better tessellator code.
To build "mangled" Mesa, add the preprocessor define USE_MGL_NAMESPACE
to the project settings. You will also need to edit src/mesa.def to
change all the gl* symbols to mgl*. Because this is easy to do with a
global replace operation in a text editor, no additional mangled
version of mesa.def is maintained or shipped.
If you have a Windows-related build problem or question, it is
probably better to direct it to me (kschultz@users.sourceforge.net),
rather than directly to the other Mesa developers. I will help you
as much as I can. I also monitor the Mesa mailing lists and will
answer questions in this area there as well.
rather than directly to the other Mesa developers. I will help you as
much as I can. I also monitor the Mesa mailing lists and will answer
questions in this area there as well.
Karl Schultz

View File

@@ -2,7 +2,7 @@
* Mesa 3-D graphics library
* Version: 6.3
*
* Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
* Copyright (C) 1999-2005 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -2213,13 +2213,9 @@ GLAPI void GLAPIENTRY glTracePointerRangeMESA( const GLvoid* first, const GLvoid
typedef void (*GLprogramcallbackMESA)(GLenum target, GLvoid *data);
GLAPI void GLAPIENTRY
glProgramCallbackMESA(GLenum target, GLprogramcallbackMESA callback,
GLvoid *data);
GLAPI void GLAPIENTRY glProgramCallbackMESA(GLenum target, GLprogramcallbackMESA callback, GLvoid *data);
GLAPI void GLAPIENTRY
glGetProgramRegisterfvMESA(GLenum target, GLsizei len, const GLubyte *name,
GLfloat *v);
GLAPI void GLAPIENTRY glGetProgramRegisterfvMESA(GLenum target, GLsizei len, const GLubyte *name, GLfloat *v);
#endif /* GL_MESA_program_debug */
@@ -2235,123 +2231,6 @@ typedef void (APIENTRYP PFNGLBLENDEQUATIONSEPARATEATIPROC) (GLenum modeRGB, GLen
#endif /* GL_ATI_blend_equation_separate */
/* XXX this is temporary here! */
#ifndef GL_EXT_framebuffer_object
#define GL_EXT_framebuffer_object
GLAPI GLboolean GLAPIENTRY
glIsRenderbufferEXT(GLuint renderbuffer);
GLAPI void GLAPIENTRY
glBindRenderbufferEXT(GLenum target, GLuint renderbuffer);
GLAPI void GLAPIENTRY
glDeleteRenderbuffersEXT(GLsizei n, const GLuint *renderbuffers);
GLAPI void GLAPIENTRY
glGenRenderbuffersEXT(GLsizei n, GLuint *renderbuffers);
GLAPI void GLAPIENTRY
glRenderbufferStorageEXT(GLenum target, GLenum internalformat,
GLsizei width, GLsizei height);
GLAPI void GLAPIENTRY
glGetRenderbufferParameterivEXT(GLenum target, GLenum pname, GLint *params);
GLAPI GLboolean GLAPIENTRY
glIsFramebufferEXT(GLuint framebuffer);
GLAPI void GLAPIENTRY
glBindFramebufferEXT(GLenum target, GLuint framebuffer);
GLAPI void GLAPIENTRY
glDeleteFramebuffersEXT(GLsizei n, const GLuint *framebuffers);
GLAPI void GLAPIENTRY
glGenFramebuffersEXT(GLsizei n, GLuint *framebuffers);
GLAPI GLenum GLAPIENTRY
glCheckFramebufferStatusEXT(GLenum target);
GLAPI void GLAPIENTRY
glFramebufferTexture1DEXT(GLenum target, GLenum attachment,
GLenum textarget, GLuint texture, GLint level);
GLAPI void GLAPIENTRY
glFramebufferTexture2DEXT(GLenum target, GLenum attachment,
GLenum textarget, GLuint texture, GLint level);
GLAPI void GLAPIENTRY
glFramebufferTexture3DEXT(GLenum target, GLenum attachment,
GLenum textarget, GLuint texture,
GLint level, GLint zoffset);
GLAPI void GLAPIENTRY
glFramebufferRenderbufferEXT(GLenum target, GLenum attachment,
GLenum renderbuffertarget,
GLuint renderbuffer);
GLAPI void GLAPIENTRY
glGetFramebufferAttachmentParameterivEXT(GLenum target, GLenum attachment,
GLenum pname, GLint *params);
GLAPI void GLAPIENTRY
glGenerateMipmapEXT(GLenum target);
#define GL_FRAMEBUFFER_EXT 0x8D40
#define GL_RENDERBUFFER_EXT 0x8D41
#define GL_STENCIL_INDEX_EXT 0x8D45
#define GL_STENCIL_INDEX1_EXT 0x8D46
#define GL_STENCIL_INDEX4_EXT 0x8D47
#define GL_STENCIL_INDEX8_EXT 0x8D48
#define GL_STENCIL_INDEX16_EXT 0x8D49
#define GL_RENDERBUFFER_WIDTH_EXT 0x8D42
#define GL_RENDERBUFFER_HEIGHT_EXT 0x8D43
#define GL_RENDERBUFFER_INTERNAL_FORMAT_EXT 0x8D44
#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT 0x8CD0
#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT 0x8CD1
#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_EXT 0x8CD2
#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_EXT 0x8CD3
#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_EXT 0x8CD4
#define GL_COLOR_ATTACHMENT0_EXT 0x8CE0
#define GL_COLOR_ATTACHMENT1_EXT 0x8CE1
#define GL_COLOR_ATTACHMENT2_EXT 0x8CE2
#define GL_COLOR_ATTACHMENT3_EXT 0x8CE3
#define GL_COLOR_ATTACHMENT4_EXT 0x8CE4
#define GL_COLOR_ATTACHMENT5_EXT 0x8CE5
#define GL_COLOR_ATTACHMENT6_EXT 0x8CE6
#define GL_COLOR_ATTACHMENT7_EXT 0x8CE7
#define GL_COLOR_ATTACHMENT8_EXT 0x8CE8
#define GL_COLOR_ATTACHMENT9_EXT 0x8CE9
#define GL_COLOR_ATTACHMENT10_EXT 0x8CEA
#define GL_COLOR_ATTACHMENT11_EXT 0x8CEB
#define GL_COLOR_ATTACHMENT12_EXT 0x8CEC
#define GL_COLOR_ATTACHMENT13_EXT 0x8CED
#define GL_COLOR_ATTACHMENT14_EXT 0x8CEE
#define GL_COLOR_ATTACHMENT15_EXT 0x8CEF
#define GL_DEPTH_ATTACHMENT_EXT 0x8D00
#define GL_STENCIL_ATTACHMENT_EXT 0x8D20
#define GL_FRAMEBUFFER_COMPLETE_EXT 0x8CD5
#define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT 0x8CD6
#define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT 0x8CD7
#define GL_FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT_EXT 0x8CD8
#define GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT 0x8CD9
#define GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT 0x8CDA
#define GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT 0x8CDB
#define GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT 0x8CDC
#define GL_FRAMEBUFFER_UNSUPPORTED_EXT 0x8CDD
#define GL_FRAMEBUFFER_STATUS_ERROR_EXT 0x8CDE
#define GL_FRAMEBUFFER_BINDING_EXT 0x8CA6
#define GL_RENDERBUFFER_BINDING_EXT 0x8CA7
#define GL_MAX_COLOR_ATTACHMENTS_EXT 0x8CDF
#define GL_MAX_RENDERBUFFER_SIZE_EXT 0x84E8
#define GL_INVALID_FRAMEBUFFER_OPERATION_EXT 0x0506
#endif /* GL_EXT_framebuffer_object */
/**
** NOTE!!!!! If you add new functions to this file, or update
** glext.h be sure to regenerate the gl_mangle.h file. See comments

View File

@@ -62,11 +62,13 @@
#define glBindBufferARB MANGLE(BindBufferARB)
#define glBindBuffer MANGLE(BindBuffer)
#define glBindFragmentShaderATI MANGLE(BindFragmentShaderATI)
#define glBindFramebufferEXT MANGLE(BindFramebufferEXT)
#define glBindLightParameterEXT MANGLE(BindLightParameterEXT)
#define glBindMaterialParameterEXT MANGLE(BindMaterialParameterEXT)
#define glBindParameterEXT MANGLE(BindParameterEXT)
#define glBindProgramARB MANGLE(BindProgramARB)
#define glBindProgramNV MANGLE(BindProgramNV)
#define glBindRenderbufferEXT MANGLE(BindRenderbufferEXT)
#define glBindTexGenParameterEXT MANGLE(BindTexGenParameterEXT)
#define glBindTextureEXT MANGLE(BindTextureEXT)
#define glBindTexture MANGLE(BindTexture)
@@ -102,6 +104,7 @@
#define glBufferSubData MANGLE(BufferSubData)
#define glCallList MANGLE(CallList)
#define glCallLists MANGLE(CallLists)
#define glCheckFramebufferStatusEXT MANGLE(CheckFramebufferStatusEXT)
#define glClampColorARB MANGLE(ClampColorARB)
#define glClearAccum MANGLE(ClearAccum)
#define glClearColor MANGLE(ClearColor)
@@ -244,6 +247,7 @@
#define glDeleteFencesAPPLE MANGLE(DeleteFencesAPPLE)
#define glDeleteFencesNV MANGLE(DeleteFencesNV)
#define glDeleteFragmentShaderATI MANGLE(DeleteFragmentShaderATI)
#define glDeleteFramebuffersEXT MANGLE(DeleteFramebuffersEXT)
#define glDeleteLists MANGLE(DeleteLists)
#define glDeleteObjectARB MANGLE(DeleteObjectARB)
#define glDeleteOcclusionQueriesNV MANGLE(DeleteOcclusionQueriesNV)
@@ -252,6 +256,7 @@
#define glDeleteProgramsNV MANGLE(DeleteProgramsNV)
#define glDeleteQueriesARB MANGLE(DeleteQueriesARB)
#define glDeleteQueries MANGLE(DeleteQueries)
#define glDeleteRenderbuffersEXT MANGLE(DeleteRenderbuffersEXT)
#define glDeleteShader MANGLE(DeleteShader)
#define glDeleteTexturesEXT MANGLE(DeleteTexturesEXT)
#define glDeleteTextures MANGLE(DeleteTextures)
@@ -365,6 +370,10 @@
#define glFragmentMaterialfvSGIX MANGLE(FragmentMaterialfvSGIX)
#define glFragmentMaterialiSGIX MANGLE(FragmentMaterialiSGIX)
#define glFragmentMaterialivSGIX MANGLE(FragmentMaterialivSGIX)
#define glFramebufferRenderbufferEXT MANGLE(FramebufferRenderbufferEXT)
#define glFramebufferTexture1DEXT MANGLE(FramebufferTexture1DEXT)
#define glFramebufferTexture2DEXT MANGLE(FramebufferTexture2DEXT)
#define glFramebufferTexture3DEXT MANGLE(FramebufferTexture3DEXT)
#define glFrameZoomSGIX MANGLE(FrameZoomSGIX)
#define glFreeObjectBufferATI MANGLE(FreeObjectBufferATI)
#define glFrontFace MANGLE(FrontFace)
@@ -372,15 +381,18 @@
#define glGenAsyncMarkersSGIX MANGLE(GenAsyncMarkersSGIX)
#define glGenBuffersARB MANGLE(GenBuffersARB)
#define glGenBuffers MANGLE(GenBuffers)
#define glGenerateMipmapEXT MANGLE(GenerateMipmapEXT)
#define glGenFencesAPPLE MANGLE(GenFencesAPPLE)
#define glGenFencesNV MANGLE(GenFencesNV)
#define glGenFragmentShadersATI MANGLE(GenFragmentShadersATI)
#define glGenFramebuffersEXT MANGLE(GenFramebuffersEXT)
#define glGenLists MANGLE(GenLists)
#define glGenOcclusionQueriesNV MANGLE(GenOcclusionQueriesNV)
#define glGenProgramsARB MANGLE(GenProgramsARB)
#define glGenProgramsNV MANGLE(GenProgramsNV)
#define glGenQueriesARB MANGLE(GenQueriesARB)
#define glGenQueries MANGLE(GenQueries)
#define glGenRenderbuffersEXT MANGLE(GenRenderbuffersEXT)
#define glGenSymbolsEXT MANGLE(GenSymbolsEXT)
#define glGenTexturesEXT MANGLE(GenTexturesEXT)
#define glGenTextures MANGLE(GenTextures)
@@ -438,6 +450,7 @@
#define glGetFragmentLightivSGIX MANGLE(GetFragmentLightivSGIX)
#define glGetFragmentMaterialfvSGIX MANGLE(GetFragmentMaterialfvSGIX)
#define glGetFragmentMaterialivSGIX MANGLE(GetFragmentMaterialivSGIX)
#define glGetFramebufferAttachmentParameterivEXT MANGLE(GetFramebufferAttachmentParameterivEXT)
#define glGetHandleARB MANGLE(GetHandleARB)
#define glGetHistogramEXT MANGLE(GetHistogramEXT)
#define glGetHistogram MANGLE(GetHistogram)
@@ -502,6 +515,7 @@
#define glGetProgramNamedParameterfvNV MANGLE(GetProgramNamedParameterfvNV)
#define glGetProgramParameterdvNV MANGLE(GetProgramParameterdvNV)
#define glGetProgramParameterfvNV MANGLE(GetProgramParameterfvNV)
#define glGetProgramRegisterfvMESA MANGLE(GetProgramRegisterfvMESA)
#define glGetProgramStringARB MANGLE(GetProgramStringARB)
#define glGetProgramStringNV MANGLE(GetProgramStringNV)
#define glGetQueryivARB MANGLE(GetQueryivARB)
@@ -510,6 +524,7 @@
#define glGetQueryObjectiv MANGLE(GetQueryObjectiv)
#define glGetQueryObjectuivARB MANGLE(GetQueryObjectuivARB)
#define glGetQueryObjectuiv MANGLE(GetQueryObjectuiv)
#define glGetRenderbufferParameterivEXT MANGLE(GetRenderbufferParameterivEXT)
#define glGetSeparableFilterEXT MANGLE(GetSeparableFilterEXT)
#define glGetSeparableFilter MANGLE(GetSeparableFilter)
#define glGetShaderInfoLog MANGLE(GetShaderInfoLog)
@@ -601,6 +616,7 @@
#define glIsEnabled MANGLE(IsEnabled)
#define glIsFenceAPPLE MANGLE(IsFenceAPPLE)
#define glIsFenceNV MANGLE(IsFenceNV)
#define glIsFramebufferEXT MANGLE(IsFramebufferEXT)
#define glIsList MANGLE(IsList)
#define glIsObjectBufferATI MANGLE(IsObjectBufferATI)
#define glIsOcclusionQueryNV MANGLE(IsOcclusionQueryNV)
@@ -609,6 +625,7 @@
#define glIsProgramNV MANGLE(IsProgramNV)
#define glIsQueryARB MANGLE(IsQueryARB)
#define glIsQuery MANGLE(IsQuery)
#define glIsRenderbufferEXT MANGLE(IsRenderbufferEXT)
#define glIsShader MANGLE(IsShader)
#define glIsTextureEXT MANGLE(IsTextureEXT)
#define glIsTexture MANGLE(IsTexture)
@@ -836,6 +853,7 @@
#define glPrimitiveRestartNV MANGLE(PrimitiveRestartNV)
#define glPrioritizeTexturesEXT MANGLE(PrioritizeTexturesEXT)
#define glPrioritizeTextures MANGLE(PrioritizeTextures)
#define glProgramCallbackMESA MANGLE(ProgramCallbackMESA)
#define glProgramEnvParameter4dARB MANGLE(ProgramEnvParameter4dARB)
#define glProgramEnvParameter4dvARB MANGLE(ProgramEnvParameter4dvARB)
#define glProgramEnvParameter4fARB MANGLE(ProgramEnvParameter4fARB)
@@ -895,6 +913,7 @@
#define glRects MANGLE(Rects)
#define glRectsv MANGLE(Rectsv)
#define glReferencePlaneSGIX MANGLE(ReferencePlaneSGIX)
#define glRenderbufferStorageEXT MANGLE(RenderbufferStorageEXT)
#define glRenderMode MANGLE(RenderMode)
#define glReplacementCodePointerSUN MANGLE(ReplacementCodePointerSUN)
#define glReplacementCodeubSUN MANGLE(ReplacementCodeubSUN)
@@ -1003,6 +1022,7 @@
#define glStencilOpSeparateATI MANGLE(StencilOpSeparateATI)
#define glStencilOpSeparate MANGLE(StencilOpSeparate)
#define glStopInstrumentsSGIX MANGLE(StopInstrumentsSGIX)
#define glStringMarkerGREMEDY MANGLE(StringMarkerGREMEDY)
#define glSwizzleEXT MANGLE(SwizzleEXT)
#define glTagSampleBufferSGIX MANGLE(TagSampleBufferSGIX)
#define glTangent3bEXT MANGLE(Tangent3bEXT)

View File

@@ -52,9 +52,9 @@ extern "C" {
/*************************************************************/
/* Header file version number, required by OpenGL ABI for Linux */
/* glext.h last updated 2005/01/20 */
/* glext.h last updated 2005/05/31 */
/* Current version at http://oss.sgi.com/projects/ogl-sample/registry/ */
#define GL_GLEXT_VERSION 26
#define GL_GLEXT_VERSION 28
#ifndef GL_VERSION_1_2
#define GL_UNSIGNED_BYTE_3_3_2 0x8032
@@ -2980,6 +2980,65 @@ extern "C" {
/* reuse GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB */
#endif
#ifndef GL_EXT_framebuffer_object
#define GL_INVALID_FRAMEBUFFER_OPERATION_EXT 0x0506
#define GL_MAX_RENDERBUFFER_SIZE_EXT 0x84E8
#define GL_FRAMEBUFFER_BINDING_EXT 0x8CA6
#define GL_RENDERBUFFER_BINDING_EXT 0x8CA7
#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT 0x8CD0
#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT 0x8CD1
#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_EXT 0x8CD2
#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_EXT 0x8CD3
#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_EXT 0x8CD4
#define GL_FRAMEBUFFER_COMPLETE_EXT 0x8CD5
#define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT 0x8CD6
#define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT 0x8CD7
#define GL_FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT_EXT 0x8CD8
#define GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT 0x8CD9
#define GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT 0x8CDA
#define GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT 0x8CDB
#define GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT 0x8CDC
#define GL_FRAMEBUFFER_UNSUPPORTED_EXT 0x8CDD
#define GL_MAX_COLOR_ATTACHMENTS_EXT 0x8CDF
#define GL_COLOR_ATTACHMENT0_EXT 0x8CE0
#define GL_COLOR_ATTACHMENT1_EXT 0x8CE1
#define GL_COLOR_ATTACHMENT2_EXT 0x8CE2
#define GL_COLOR_ATTACHMENT3_EXT 0x8CE3
#define GL_COLOR_ATTACHMENT4_EXT 0x8CE4
#define GL_COLOR_ATTACHMENT5_EXT 0x8CE5
#define GL_COLOR_ATTACHMENT6_EXT 0x8CE6
#define GL_COLOR_ATTACHMENT7_EXT 0x8CE7
#define GL_COLOR_ATTACHMENT8_EXT 0x8CE8
#define GL_COLOR_ATTACHMENT9_EXT 0x8CE9
#define GL_COLOR_ATTACHMENT10_EXT 0x8CEA
#define GL_COLOR_ATTACHMENT11_EXT 0x8CEB
#define GL_COLOR_ATTACHMENT12_EXT 0x8CEC
#define GL_COLOR_ATTACHMENT13_EXT 0x8CED
#define GL_COLOR_ATTACHMENT14_EXT 0x8CEE
#define GL_COLOR_ATTACHMENT15_EXT 0x8CEF
#define GL_DEPTH_ATTACHMENT_EXT 0x8D00
#define GL_STENCIL_ATTACHMENT_EXT 0x8D20
#define GL_FRAMEBUFFER_EXT 0x8D40
#define GL_RENDERBUFFER_EXT 0x8D41
#define GL_RENDERBUFFER_WIDTH_EXT 0x8D42
#define GL_RENDERBUFFER_HEIGHT_EXT 0x8D43
#define GL_RENDERBUFFER_INTERNAL_FORMAT_EXT 0x8D44
#define GL_STENCIL_INDEX_EXT 0x8D45
#define GL_STENCIL_INDEX1_EXT 0x8D46
#define GL_STENCIL_INDEX4_EXT 0x8D47
#define GL_STENCIL_INDEX8_EXT 0x8D48
#define GL_STENCIL_INDEX16_EXT 0x8D49
#define GL_RENDERBUFFER_RED_SIZE_EXT 0x8D50
#define GL_RENDERBUFFER_GREEN_SIZE_EXT 0x8D51
#define GL_RENDERBUFFER_BLUE_SIZE_EXT 0x8D52
#define GL_RENDERBUFFER_ALPHA_SIZE_EXT 0x8D53
#define GL_RENDERBUFFER_DEPTH_SIZE_EXT 0x8D54
#define GL_RENDERBUFFER_STENCIL_SIZE_EXT 0x8D55
#endif
#ifndef GL_GREMEDY_string_marker
#endif
/*************************************************************/
@@ -6381,6 +6440,54 @@ typedef void (APIENTRYP PFNGLBLENDEQUATIONSEPARATEEXTPROC) (GLenum modeRGB, GLen
#define GL_NV_vertex_program3 1
#endif
#ifndef GL_EXT_framebuffer_object
#define GL_EXT_framebuffer_object 1
#ifdef GL_GLEXT_PROTOTYPES
GLAPI GLboolean APIENTRY glIsRenderbufferEXT (GLuint);
GLAPI void APIENTRY glBindRenderbufferEXT (GLenum, GLuint);
GLAPI void APIENTRY glDeleteRenderbuffersEXT (GLsizei, const GLuint *);
GLAPI void APIENTRY glGenRenderbuffersEXT (GLsizei, GLuint *);
GLAPI void APIENTRY glRenderbufferStorageEXT (GLenum, GLenum, GLsizei, GLsizei);
GLAPI void APIENTRY glGetRenderbufferParameterivEXT (GLenum, GLenum, GLint *);
GLAPI GLboolean APIENTRY glIsFramebufferEXT (GLuint);
GLAPI void APIENTRY glBindFramebufferEXT (GLenum, GLuint);
GLAPI void APIENTRY glDeleteFramebuffersEXT (GLsizei, const GLuint *);
GLAPI void APIENTRY glGenFramebuffersEXT (GLsizei, GLuint *);
GLAPI GLenum APIENTRY glCheckFramebufferStatusEXT (GLenum);
GLAPI void APIENTRY glFramebufferTexture1DEXT (GLenum, GLenum, GLenum, GLuint, GLint);
GLAPI void APIENTRY glFramebufferTexture2DEXT (GLenum, GLenum, GLenum, GLuint, GLint);
GLAPI void APIENTRY glFramebufferTexture3DEXT (GLenum, GLenum, GLenum, GLuint, GLint, GLint);
GLAPI void APIENTRY glFramebufferRenderbufferEXT (GLenum, GLenum, GLenum, GLuint);
GLAPI void APIENTRY glGetFramebufferAttachmentParameterivEXT (GLenum, GLenum, GLenum, GLint *);
GLAPI void APIENTRY glGenerateMipmapEXT (GLenum);
#endif /* GL_GLEXT_PROTOTYPES */
typedef GLboolean (APIENTRYP PFNGLISRENDERBUFFEREXTPROC) (GLuint renderbuffer);
typedef void (APIENTRYP PFNGLBINDRENDERBUFFEREXTPROC) (GLenum target, GLuint renderbuffer);
typedef void (APIENTRYP PFNGLDELETERENDERBUFFERSEXTPROC) (GLsizei n, const GLuint *renderbuffers);
typedef void (APIENTRYP PFNGLGENRENDERBUFFERSEXTPROC) (GLsizei n, GLuint *renderbuffers);
typedef void (APIENTRYP PFNGLRENDERBUFFERSTORAGEEXTPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
typedef void (APIENTRYP PFNGLGETRENDERBUFFERPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint *params);
typedef GLboolean (APIENTRYP PFNGLISFRAMEBUFFEREXTPROC) (GLuint framebuffer);
typedef void (APIENTRYP PFNGLBINDFRAMEBUFFEREXTPROC) (GLenum target, GLuint framebuffer);
typedef void (APIENTRYP PFNGLDELETEFRAMEBUFFERSEXTPROC) (GLsizei n, const GLuint *framebuffers);
typedef void (APIENTRYP PFNGLGENFRAMEBUFFERSEXTPROC) (GLsizei n, GLuint *framebuffers);
typedef GLenum (APIENTRYP PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC) (GLenum target);
typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURE1DEXTPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DEXTPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURE3DEXTPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset);
typedef void (APIENTRYP PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC) (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
typedef void (APIENTRYP PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC) (GLenum target, GLenum attachment, GLenum pname, GLint *params);
typedef void (APIENTRYP PFNGLGENERATEMIPMAPEXTPROC) (GLenum target);
#endif
#ifndef GL_GREMEDY_string_marker
#define GL_GREMEDY_string_marker 1
#ifdef GL_GLEXT_PROTOTYPES
GLAPI void APIENTRY glStringMarkerGREMEDY (GLsizei, const GLvoid *);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLSTRINGMARKERGREMEDYPROC) (GLsizei len, const GLvoid *string);
#endif
#ifdef __cplusplus
}

View File

@@ -33,6 +33,7 @@ static GLint Mode = 4;
static GLfloat Black[4] = {0.0, 0.0, 0.0, 1.0};
static GLfloat White[4] = {1.0, 1.0, 1.0, 1.0};
static GLboolean smooth = 1;
static void
Idle(void)
@@ -143,9 +144,16 @@ static void Key( unsigned char key, int x, int y )
(void) x;
(void) y;
switch (key) {
case 27:
exit(0);
break;
case 27:
exit(0);
break;
case 's':
smooth = !smooth;
if (smooth)
glShadeModel(GL_SMOOTH);
else
glShadeModel(GL_FLAT);
break;
}
glutPostRedisplay();
}
@@ -175,6 +183,8 @@ static void Init( void )
glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, 0);
glLightModelfv(GL_LIGHT_MODEL_AMBIENT, Black);
glShadeModel(GL_SMOOTH);
glMaterialfv(GL_FRONT, GL_DIFFUSE, White);
glMaterialfv(GL_FRONT, GL_SPECULAR, White);
glMaterialf(GL_FRONT, GL_SHININESS, 20.0);

View File

@@ -67,7 +67,7 @@ INCLUDES = -I. \
-I$(TOP)/src/mesa/swrast_setup \
-I$(TOP)/src/mesa/drivers/dri/common \
-I$(DRM_SOURCE_PATH)/libdrm \
-I$(DRM_SOURCE_PATH)/shared \
-I$(DRM_SOURCE_PATH)/shared-core \
$(X11_INCLUDES)

View File

@@ -682,7 +682,7 @@ __GLapi * __glXNewIndirectAPI( void )
glAPI->MultiDrawArraysEXT = __indirect_glMultiDrawArraysEXT;
glAPI->MultiDrawElementsEXT = __indirect_glMultiDrawElementsEXT;
/* EXT_stencil_two_side */
/* GL_EXT_stencil_two_side */
glAPI->ActiveStencilFaceEXT = __indirect_glActiveStencilFaceEXT;

View File

@@ -220,6 +220,7 @@ tags:
clean:
-rm -f */*.o
-rm -f */*/*.o
-rm -f depend depend.bak mesa.a
-rm -f drivers/*/*.o
(cd drivers/dri ; $(MAKE) clean)

View File

@@ -16,7 +16,7 @@ COMMON_SOURCES = \
ifeq ($(WINDOW_SYSTEM),dri)
WINOBJ=../dri_client/dri.a
WINLIB=
INCLUDES = $(SHARED_INCLUDES) \
INCLUDES = $(SHARED_INCLUDES) $(EXPAT_INCLUDES) \
-I../dri_client \
-I../dri_client/imports

View File

@@ -8,6 +8,8 @@
/**
* This will get called when a window is resized.
* Just update width, height and internal format fields for now.
* There's usually no memory allocation above because the present
* DRI drivers use statically-allocated full-screen buffers.
*/
static GLboolean
driRenderbufferStorage(GLcontext *ctx, struct gl_renderbuffer *rb,

View File

@@ -316,6 +316,13 @@ fbDestroyScreen( __DRIscreenPrivate *sPriv )
{
}
void fbSetBuffer( GLcontext *ctx,
GLframebuffer *colorBuffer,
GLuint bufferBit )
{
/* NOP until SetBuffer is fully removed */
}
/* Create the device specific context.
*/
static GLboolean
@@ -368,6 +375,7 @@ fbCreateContext( const __GLcontextModes *glVisual,
{
struct swrast_device_driver *swdd;
swdd = _swrast_GetDeviceDriverReference( ctx );
swdd->SetBuffer = fbSetBuffer;
}
/* use default TCL pipeline */

View File

@@ -37,6 +37,8 @@
extern void
fbSetSpanFunctions(driRenderbuffer *drb, const GLvisual *vis);
extern void
fbSetBuffer( GLcontext *ctx, GLframebuffer *colorBuffer, GLuint bufferBit);
/**
* fb driver-specific driver class derived from _EGLDriver
@@ -485,6 +487,7 @@ fbCreateContext(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config, EGLContext sh
{
struct swrast_device_driver *swdd;
swdd = _swrast_GetDeviceDriverReference( ctx );
swdd->SetBuffer = fbSetBuffer;
}
/* use default TCL pipeline */

View File

@@ -191,6 +191,203 @@ static void i915LayoutTextureImages( i915ContextPtr i915,
}
static void i945LayoutTextureImages( i915ContextPtr i915,
struct gl_texture_object *tObj )
{
const struct gl_texture_image *baseImage = tObj->Image[0][tObj->BaseLevel];
i915TextureObjectPtr t = (i915TextureObjectPtr) tObj->DriverData;
GLint firstLevel, lastLevel, numLevels;
GLint i, total_height, pitch, sz, max_offset = 0, offset;
/* Compute which mipmap levels we really want to send to the hardware.
*/
driCalculateTextureFirstLastLevel( (driTextureObject *) t );
/* Figure out the amount of memory required to hold all the mipmap
* levels. Choose the smallest pitch to accomodate the largest
* mipmap:
*/
firstLevel = t->intel.base.firstLevel;
lastLevel = t->intel.base.lastLevel;
numLevels = lastLevel - firstLevel + 1;
/* All images must be loaded at this pitch. Count the number of
* lines required:
*/
switch (tObj->Target) {
case GL_TEXTURE_CUBE_MAP: {
const GLuint dim = tObj->Image[0][firstLevel]->Width;
GLuint face;
/* Depending on the size of the largest images, pitch can be
* determined either by the old-style packing of cubemap faces,
* or the final row of 4x4, 2x2 and 1x1 faces below this.
*/
if (dim > 32) {
pitch = dim * t->intel.texelBytes;
pitch *= 2; /* double pitch for cube layouts */
pitch = (pitch + 3) & ~3;
}
else {
pitch = 14 * 8 * t->intel.texelBytes; /* determined by row of
* little maps at
* bottom */
}
total_height = dim * 4 + 4;
for ( face = 0 ; face < 6 ; face++) {
GLuint x = initial_offsets[face][0] * dim;
GLuint y = initial_offsets[face][1] * dim;
GLuint d = dim;
if (dim == 4 && face >= 4) {
y = total_height - 4;
x = (face - 4) * 8;
}
else if (dim < 4) {
y = total_height - 4;
x = face * 8;
}
t->intel.base.dirty_images[face] = ~0;
assert(tObj->Image[face][firstLevel]->Width == dim);
assert(tObj->Image[face][firstLevel]->Height == dim);
for (i = 0; i < numLevels; i++) {
t->intel.image[face][i].image = tObj->Image[face][firstLevel + i];
assert(t->intel.image[face][i].image);
t->intel.image[face][i].offset =
y * pitch + x * t->intel.texelBytes;
t->intel.image[face][i].internalFormat = baseImage->Format;
d >>= 1;
switch (d) {
case 4:
switch (face) {
case FACE_POS_X:
case FACE_NEG_X:
x += step_offsets[face][0] * d;
y += step_offsets[face][1] * d;
break;
case FACE_POS_Y:
case FACE_NEG_Y:
y += 12;
x -= 8;
break;
case FACE_POS_Z:
case FACE_NEG_Z:
y = total_height - 4;
x = (face - 4) * 8;
break;
}
case 2:
y = total_height - 4;
x = 16 + face * 8;
break;
case 1:
x += 48;
break;
default:
x += step_offsets[face][0] * d;
y += step_offsets[face][1] * d;
break;
}
}
}
max_offset = total_height * pitch;
break;
}
case GL_TEXTURE_3D: {
GLuint depth_packing = 0, depth_pack_pitch;
GLuint tmp_numLevels = numLevels;
pitch = tObj->Image[0][firstLevel]->Width * t->intel.texelBytes;
pitch = (pitch + 3) & ~3;
depth_pack_pitch = pitch;
t->intel.base.dirty_images[0] = ~0;
for ( total_height = i = 0 ; i < tmp_numLevels ; i++ ) {
t->intel.image[0][i].image = tObj->Image[0][firstLevel + i];
if (!t->intel.image[0][i].image)
break;
t->intel.image[0][i].offset = total_height * pitch;
t->intel.image[0][i].internalFormat = baseImage->Format;
total_height += MAX2(2, t->intel.image[0][i].image->Height) *
MAX2((t->intel.image[0][i].image->Depth >> depth_packing), 1);
/* When alignment dominates, can't increase depth packing?
* Or does pitch grow??? What are the alignment constraints,
* anyway?
*/
if (depth_pack_pitch > 4) {
depth_packing++;
depth_pack_pitch <<= 2;
}
}
max_offset = total_height * pitch;
break;
}
default:
pitch = tObj->Image[0][firstLevel]->Width * t->intel.texelBytes;
pitch = (pitch + 3) & ~3;
t->intel.base.dirty_images[0] = ~0;
max_offset = 0;
for ( offset = i = 0 ; i < numLevels ; i++ ) {
t->intel.image[0][i].image = tObj->Image[0][firstLevel + i];
if (!t->intel.image[0][i].image)
break;
t->intel.image[0][i].offset = offset;
t->intel.image[0][i].internalFormat = baseImage->Format;
if (t->intel.image[0][i].image->IsCompressed)
sz = MAX2(1, t->intel.image[0][i].image->Height/4) * pitch;
else
sz = MAX2(2, t->intel.image[0][i].image->Height) * pitch;
/* Because the images are packed better, the final offset
* might not be the maximal one:
*/
max_offset = MAX2(max_offset, offset + sz);
/* LPT change: step right after second mipmap.
*/
if (i == 1)
offset += pitch / 2;
else
offset += sz;
}
break;
}
t->intel.Pitch = pitch;
t->intel.base.totalSize = max_offset;
t->intel.max_level = numLevels-1;
}
static void i915SetTexImages( i915ContextPtr i915,
struct gl_texture_object *tObj )
@@ -298,7 +495,11 @@ static void i915SetTexImages( i915ContextPtr i915,
abort();
}
i915LayoutTextureImages( i915, tObj );
if (i915->intel.intelScreen->deviceID == PCI_CHIP_I945_G)
i945LayoutTextureImages( i915, tObj );
else
i915LayoutTextureImages( i915, tObj );
t->Setup[I915_TEXREG_MS3] =
(((tObj->Image[0][t->intel.base.firstLevel]->Height - 1) << MS3_HEIGHT_SHIFT) |

View File

@@ -73,7 +73,7 @@ int prevLockLine;
* Mesa's Driver Functions
***************************************/
#define DRIVER_DATE "20041217"
#define DRIVER_DATE "20050225"
const GLubyte *intelGetString( GLcontext *ctx, GLenum name )
{
@@ -99,6 +99,8 @@ const GLubyte *intelGetString( GLcontext *ctx, GLenum name )
chipset = "Intel(R) 915G"; break;
case PCI_CHIP_I915_GM:
chipset = "Intel(R) 915GM"; break;
case PCI_CHIP_I945_G:
chipset = "Intel(R) 945G"; break;
default:
chipset = "Unknown Intel Chipset"; break;
}

View File

@@ -412,6 +412,7 @@ extern int INTEL_DEBUG;
#define PCI_CHIP_I865_G 0x2572
#define PCI_CHIP_I915_G 0x2582
#define PCI_CHIP_I915_GM 0x2592
#define PCI_CHIP_I945_G 0x2772
/* ================================================================

View File

@@ -349,6 +349,7 @@ static GLboolean intelCreateContext( const __GLcontextModes *mesaVis,
case PCI_CHIP_I915_G:
case PCI_CHIP_I915_GM:
case PCI_CHIP_I945_G:
return i915CreateContext( mesaVis, driContextPriv,
sharedContextPrivate );

View File

@@ -72,6 +72,7 @@ static const struct dri_debug_control debug_control[] =
{ "prims", DEBUG_VERBOSE_PRIMS },
{ "count", DEBUG_VERBOSE_COUNT },
{ "nowait", DEBUG_NOWAIT },
{ "fall", DEBUG_VERBOSE_FALLBACK },
{ NULL, 0 }
};
@@ -230,6 +231,11 @@ GLboolean mach64CreateContext( const __GLcontextModes *glVisual,
driContextPriv->driverPrivate = (void *)mmesa;
if (driQueryOptionb(&mmesa->optionCache, "no_rast")) {
fprintf(stderr, "disabling 3D acceleration\n");
FALLBACK(mmesa, MACH64_FALLBACK_DISABLE, 1);
}
return GL_TRUE;
}

View File

@@ -79,11 +79,11 @@ typedef struct mach64_context *mach64ContextPtr;
#define MACH64_FALLBACK_READ_BUFFER 0x0004
#define MACH64_FALLBACK_STENCIL 0x0008
#define MACH64_FALLBACK_RENDER_MODE 0x0010
#define MACH64_FALLBACK_MULTIDRAW 0x0020
#define MACH64_FALLBACK_LOGICOP 0x0040
#define MACH64_FALLBACK_SEP_SPECULAR 0x0080
#define MACH64_FALLBACK_BLEND_EQ 0x0100
#define MACH64_FALLBACK_BLEND_FUNC 0x0200
#define MACH64_FALLBACK_LOGICOP 0x0020
#define MACH64_FALLBACK_SEP_SPECULAR 0x0040
#define MACH64_FALLBACK_BLEND_EQ 0x0080
#define MACH64_FALLBACK_BLEND_FUNC 0x0100
#define MACH64_FALLBACK_DISABLE 0x0200
#define CARD32 GLuint /* KW: For building in mesa tree */
@@ -401,4 +401,5 @@ extern int MACH64_DEBUG;
#define DEBUG_VERBOSE_PRIMS 0x040
#define DEBUG_VERBOSE_COUNT 0x080
#define DEBUG_NOWAIT 0x100
#define DEBUG_VERBOSE_FALLBACK 0x200
#endif /* __MACH64_CONTEXT_H__ */

View File

@@ -54,16 +54,17 @@ DRI_CONF_BEGIN
DRI_CONF_SECTION_PERFORMANCE
DRI_CONF_VBLANK_MODE(DRI_CONF_VBLANK_DEF_INTERVAL_0)
DRI_CONF_SECTION_END
#if ENABLE_PERF_BOXES
DRI_CONF_SECTION_DEBUG
DRI_CONF_NO_RAST(false)
#if ENABLE_PERF_BOXES
DRI_CONF_PERFORMANCE_BOXES(false)
DRI_CONF_SECTION_END
#endif
DRI_CONF_SECTION_END
DRI_CONF_END;
#if ENABLE_PERF_BOXES
static const GLuint __driNConfigOptions = 2;
static const GLuint __driNConfigOptions = 3;
#else
static const GLuint __driNConfigOptions = 1;
static const GLuint __driNConfigOptions = 2;
#endif
#ifdef USE_NEW_INTERFACE

View File

@@ -58,6 +58,7 @@
(void) read_buf; (void) buf; (void) p
#define LOCAL_DEPTH_VARS \
mach64ContextPtr mmesa = MACH64_CONTEXT(ctx); \
mach64ScreenRec *mach64Screen = mmesa->mach64Screen; \
__DRIdrawablePrivate *dPriv = mmesa->driDrawable; \
__DRIscreenPrivate *driScreen = mmesa->driScreen; \
@@ -87,10 +88,7 @@
#define Y_FLIP( _y ) (height - _y - 1)
#define HW_LOCK() \
mach64ContextPtr mmesa = MACH64_CONTEXT(ctx); \
LOCK_HARDWARE( mmesa ); \
FINISH_DMA_LOCKED( mmesa ); \
#define HW_LOCK()
#define HW_CLIPLOOP() \
do { \
@@ -106,8 +104,7 @@
} \
} while (0)
#define HW_UNLOCK() \
UNLOCK_HARDWARE( mmesa ) \
#define HW_UNLOCK()
@@ -117,59 +114,26 @@
/* 16 bit, RGB565 color spanline and pixel functions
*/
#undef INIT_MONO_PIXEL
#define INIT_MONO_PIXEL(p, color) \
p = MACH64PACKCOLOR565( color[0], color[1], color[2] )
#define WRITE_RGBA( _x, _y, r, g, b, a ) \
*(GLushort *)(buf + _x*2 + _y*pitch) = ((((int)r & 0xf8) << 8) | \
(((int)g & 0xfc) << 3) | \
(((int)b & 0xf8) >> 3))
#define WRITE_PIXEL( _x, _y, p ) \
*(GLushort *)(buf + _x*2 + _y*pitch) = p
#define READ_RGBA( rgba, _x, _y ) \
do { \
GLushort p = *(GLushort *)(read_buf + _x*2 + _y*pitch); \
rgba[0] = ((p >> 8) & 0xf8) * 255 / 0xf8; \
rgba[1] = ((p >> 3) & 0xfc) * 255 / 0xfc; \
rgba[2] = ((p << 3) & 0xf8) * 255 / 0xf8; \
rgba[3] = 0xff; \
} while (0)
#define TAG(x) mach64##x##_RGB565
#include "spantmp.h"
#define GET_SRC_PTR(_x, _y) (read_buf + _x * 2 + _y * pitch)
#define GET_DST_PTR(_x, _y) ( buf + _x * 2 + _y * pitch)
#define SPANTMP_PIXEL_FMT GL_RGB
#define SPANTMP_PIXEL_TYPE GL_UNSIGNED_SHORT_5_6_5
#define TAG(x) mach64##x##_RGB565
#define TAG2(x,y) mach64##x##_RGB565##y
#include "spantmp2.h"
/* 32 bit, ARGB8888 color spanline and pixel functions
*/
#undef INIT_MONO_PIXEL
#define INIT_MONO_PIXEL(p, color) \
p = MACH64PACKCOLOR8888( color[0], color[1], color[2], color[3] )
#define WRITE_RGBA( _x, _y, r, g, b, a ) \
*(GLuint *)(buf + _x*4 + _y*pitch) = ((b << 0) | \
(g << 8) | \
(r << 16) | \
(a << 24) )
#define WRITE_PIXEL( _x, _y, p ) \
*(GLuint *)(buf + _x*4 + _y*pitch) = p
#define READ_RGBA( rgba, _x, _y ) \
do { \
GLuint p = *(GLuint *)(read_buf + _x*4 + _y*pitch); \
rgba[0] = (p >> 16) & 0xff; \
rgba[1] = (p >> 8) & 0xff; \
rgba[2] = (p >> 0) & 0xff; \
rgba[3] = 0xff; /*(p >> 24) & 0xff;*/ \
} while (0)
#define TAG(x) mach64##x##_ARGB8888
#include "spantmp.h"
#define GET_SRC_PTR(_x, _y) (read_buf + _x * 4 + _y * pitch)
#define GET_DST_PTR(_x, _y) ( buf + _x * 4 + _y * pitch)
#define SPANTMP_PIXEL_FMT GL_BGRA
#define SPANTMP_PIXEL_TYPE GL_UNSIGNED_INT_8_8_8_8_REV
#define TAG(x) mach64##x##_ARGB8888
#define TAG2(x,y) mach64##x##_ARGB8888##y
#include "spantmp2.h"
/* ================================================================
@@ -179,10 +143,10 @@ do { \
/* 16 bit depthbuffer functions.
*/
#define WRITE_DEPTH( _x, _y, d ) \
*(GLushort *)(buf + _x*2 + _y*pitch) = d;
*(GLushort *)(buf + (_x)*2 + (_y)*pitch) = d;
#define READ_DEPTH( d, _x, _y ) \
d = *(GLushort *)(buf + _x*2 + _y*pitch);
d = *(GLushort *)(buf + (_x)*2 + (_y)*pitch);
#define TAG(x) mach64##x##_16
#include "depthtmp.h"
@@ -217,6 +181,19 @@ static void mach64DDSetBuffer( GLcontext *ctx,
}
}
static void mach64SpanRenderStart( GLcontext *ctx )
{
mach64ContextPtr mmesa = MACH64_CONTEXT(ctx);
LOCK_HARDWARE( mmesa );
FINISH_DMA_LOCKED( mmesa );
}
static void mach64SpanRenderFinish( GLcontext *ctx )
{
mach64ContextPtr mmesa = MACH64_CONTEXT(ctx);
_swrast_flush( ctx );
UNLOCK_HARDWARE( mmesa );
}
void mach64DDInitSpanFuncs( GLcontext *ctx )
{
@@ -262,6 +239,7 @@ void mach64DDInitSpanFuncs( GLcontext *ctx )
swdd->ReadDepthPixels = mach64ReadDepthPixels_16;
swdd->WriteDepthPixels = mach64WriteDepthPixels_16;
#endif
#if 0
/* No hardware stencil buffer */
swdd->ReadStencilSpan = NULL;
swdd->WriteStencilSpan = NULL;
@@ -275,6 +253,9 @@ void mach64DDInitSpanFuncs( GLcontext *ctx )
swdd->WriteMonoCIPixels = NULL;
swdd->ReadCI32Span = NULL;
swdd->ReadCI32Pixels = NULL;
#endif
swdd->SpanRenderStart = mach64SpanRenderStart;
swdd->SpanRenderFinish = mach64SpanRenderFinish;
}
@@ -286,22 +267,10 @@ mach64SetSpanFunctions(driRenderbuffer *drb, const GLvisual *vis)
{
if (drb->Base.InternalFormat == GL_RGBA) {
if (vis->redBits == 5 && vis->greenBits == 6 && vis->blueBits == 5) {
drb->Base.GetRow = mach64ReadRGBASpan_RGB565;
drb->Base.GetValues = mach64ReadRGBAPixels_RGB565;
drb->Base.PutRow = mach64WriteRGBASpan_RGB565;
drb->Base.PutRowRGB = mach64WriteRGBSpan_RGB565;
drb->Base.PutMonoRow = mach64WriteMonoRGBASpan_RGB565;
drb->Base.PutValues = mach64WriteRGBAPixels_RGB565;
drb->Base.PutMonoValues = mach64WriteMonoRGBAPixels_RGB565;
mach64InitPointers_RGB565(&drb->Base);
}
else {
drb->Base.GetRow = mach64ReadRGBASpan_ARGB8888;
drb->Base.GetValues = mach64ReadRGBAPixels_ARGB8888;
drb->Base.PutRow = mach64WriteRGBASpan_ARGB8888;
drb->Base.PutRowRGB = mach64WriteRGBSpan_ARGB8888;
drb->Base.PutMonoRow = mach64WriteMonoRGBASpan_ARGB8888;
drb->Base.PutValues = mach64WriteRGBAPixels_ARGB8888;
drb->Base.PutMonoValues = mach64WriteMonoRGBAPixels_ARGB8888;
mach64InitPointers_ARGB8888(&drb->Base);
}
}
else if (drb->Base.InternalFormat == GL_DEPTH_COMPONENT16) {

View File

@@ -1838,6 +1838,30 @@ static void mach64RenderFinish( GLcontext *ctx )
/* Transition to/from hardware rasterization. */
/**********************************************************************/
static const char * const fallbackStrings[] = {
"Texture mode",
"glDrawBuffer(GL_FRONT_AND_BACK)",
"glReadBuffer",
"glEnable(GL_STENCIL) without hw stencil buffer",
"glRenderMode(selection or feedback)",
"glLogicOp (mode != GL_COPY)",
"GL_SEPARATE_SPECULAR_COLOR",
"glBlendEquation (mode != ADD)",
"glBlendFunc",
"Rasterization disable",
};
static const char *getFallbackString(GLuint bit)
{
int i = 0;
while (bit > 1) {
i++;
bit >>= 1;
}
return fallbackStrings[i];
}
void mach64Fallback( GLcontext *ctx, GLuint bit, GLboolean mode )
{
TNLcontext *tnl = TNL_CONTEXT(ctx);
@@ -1845,18 +1869,18 @@ void mach64Fallback( GLcontext *ctx, GLuint bit, GLboolean mode )
GLuint oldfallback = mmesa->Fallback;
if (mode) {
if (MACH64_DEBUG & DEBUG_VERBOSE_MSG)
fprintf(stderr,"Set Fallback: %d\n", bit);
mmesa->Fallback |= bit;
if (oldfallback == 0) {
FLUSH_BATCH( mmesa );
_swsetup_Wakeup( ctx );
mmesa->RenderIndex = ~0;
if (MACH64_DEBUG & DEBUG_VERBOSE_FALLBACK) {
fprintf(stderr, "Mach64 begin rasterization fallback: 0x%x %s\n",
bit, getFallbackString(bit));
}
}
}
else {
if (MACH64_DEBUG & DEBUG_VERBOSE_MSG)
fprintf(stderr,"Clear Fallback: %d\n", bit);
mmesa->Fallback &= ~bit;
if (oldfallback == bit) {
_swrast_flush( ctx );
@@ -1866,6 +1890,10 @@ void mach64Fallback( GLcontext *ctx, GLuint bit, GLboolean mode )
tnl->Driver.Render.BuildVertices = mach64BuildVertices;
mmesa->NewGLState |= (_MACH64_NEW_RENDER_STATE|
_MACH64_NEW_VERTEX_STATE);
if (MACH64_DEBUG & DEBUG_VERBOSE_FALLBACK) {
fprintf(stderr, "Mach64 end rasterization fallback: 0x%x %s\n",
bit, getFallbackString(bit));
}
}
}
}
@@ -1890,6 +1918,4 @@ void mach64InitTriFuncs( GLcontext *ctx )
tnl->Driver.Render.PrimitiveNotify = mach64RenderPrimitive;
tnl->Driver.Render.ResetLineStipple = _swrast_ResetLineStipple;
tnl->Driver.Render.BuildVertices = mach64BuildVertices;
/* mach64Fallback( ctx, 0x100000, 1 ); */
}

View File

@@ -85,8 +85,11 @@ DRI_CONF_BEGIN
DRI_CONF_ARB_VERTEX_PROGRAM(true)
DRI_CONF_NV_VERTEX_PROGRAM(true)
DRI_CONF_SECTION_END
DRI_CONF_SECTION_DEBUG
DRI_CONF_NO_RAST(false)
DRI_CONF_SECTION_END
DRI_CONF_END;
static const GLuint __driNConfigOptions = 5;
static const GLuint __driNConfigOptions = 6;
#ifdef USE_NEW_INTERFACE
static PFNGLXCREATECONTEXTMODES create_context_modes = NULL;
@@ -640,6 +643,11 @@ mgaCreateContext( const __GLcontextModes *mesaVis,
(*mmesa->get_ust)( & mmesa->swap_ust );
if (driQueryOptionb(&mmesa->optionCache, "no_rast")) {
fprintf(stderr, "disabling 3D acceleration\n");
FALLBACK(mmesa->glCtx, MGA_FALLBACK_DISABLE, 1);
}
return GL_TRUE;
}

View File

@@ -62,6 +62,7 @@
#define MGA_FALLBACK_STENCIL 0x20
#define MGA_FALLBACK_DEPTH 0x40
#define MGA_FALLBACK_BORDER_MODE 0x80
#define MGA_FALLBACK_DISABLE 0x100
/* Use the templated vertex formats:

View File

@@ -36,6 +36,7 @@
#define DBG 0
#define LOCAL_VARS \
mgaContextPtr mmesa = MGA_CONTEXT(ctx); \
__DRIdrawablePrivate *dPriv = mmesa->mesa_drawable; \
mgaScreenPrivate *mgaScreen = mmesa->mgaScreen; \
__DRIscreenPrivate *sPriv = mmesa->driScreen; \
@@ -55,6 +56,7 @@
#define LOCAL_DEPTH_VARS \
mgaContextPtr mmesa = MGA_CONTEXT(ctx); \
__DRIdrawablePrivate *dPriv = mmesa->mesa_drawable; \
mgaScreenPrivate *mgaScreen = mmesa->mgaScreen; \
__DRIscreenPrivate *sPriv = mmesa->driScreen; \
@@ -81,11 +83,7 @@
}
#define HW_LOCK() \
mgaContextPtr mmesa = MGA_CONTEXT(ctx); \
FLUSH_BATCH(mmesa); \
LOCK_HARDWARE_QUIESCENT(mmesa);
#define HW_LOCK()
#define HW_CLIPLOOP() \
do { \
@@ -100,10 +98,7 @@
} \
} while (0)
#define HW_UNLOCK() \
UNLOCK_HARDWARE(mmesa);
#define HW_UNLOCK()
@@ -220,6 +215,20 @@ static void mgaDDSetBuffer(GLcontext *ctx, GLframebuffer *buffer,
? mmesa->driDrawable : mmesa->driReadable;
}
void mgaSpanRenderStart( GLcontext *ctx )
{
mgaContextPtr mmesa = MGA_CONTEXT(ctx);
FLUSH_BATCH( mmesa );
LOCK_HARDWARE_QUIESCENT( mmesa );
}
void mgaSpanRenderFinish( GLcontext *ctx )
{
mgaContextPtr mmesa = MGA_CONTEXT(ctx);
_swrast_flush( ctx );
UNLOCK_HARDWARE( mmesa );
}
/**
* Initialize the driver callbacks for the read / write span functions.
*
@@ -269,10 +278,11 @@ void mgaDDInitSpanFuncs( GLcontext *ctx )
#endif
break;
}
swdd->SpanRenderStart = mgaSpanRenderStart;
swdd->SpanRenderFinish = mgaSpanRenderFinish;
}
/**
* Plug in the Get/Put routines for the given driRenderbuffer.
*/

View File

@@ -839,7 +839,8 @@ static const char * const fallbackStrings[] = {
"glRenderMode(selection or feedback)",
"No hardware stencil",
"glDepthFunc( GL_NEVER )",
"Mixing GL_CLAMP_TO_EDGE and GL_CLAMP"
"Mixing GL_CLAMP_TO_EDGE and GL_CLAMP",
"rasterization fallback option"
};
static const char *getFallbackString(GLuint bit)

View File

@@ -93,11 +93,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
#define Y_FLIP( _y ) (height - _y - 1)
#define HW_LOCK() \
r128ContextPtr rmesa = R128_CONTEXT(ctx); \
FLUSH_BATCH( rmesa ); \
LOCK_HARDWARE( rmesa ); \
r128WaitForIdleLocked( rmesa );
#define HW_LOCK()
#define HW_CLIPLOOP() \
do { \
@@ -114,8 +110,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
} \
} while (0)
#define HW_UNLOCK() \
UNLOCK_HARDWARE( rmesa )
#define HW_UNLOCK()
@@ -153,8 +148,6 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
/* 16-bit depth buffer functions
*/
#define READ_DEPTH(d, _x, _y) \
d = *(GLushort *)(buf + (_x)*2 + (_y)*pitch)
#define WRITE_DEPTH_SPAN() \
r128WriteDepthSpanLocked( rmesa, n, \
@@ -168,8 +161,6 @@ do { \
GLint oy[MAX_WIDTH]; \
for ( i = 0 ; i < n ; i++ ) { \
ox[i] = x[i] + dPriv->x; \
} \
for ( i = 0 ; i < n ; i++ ) { \
oy[i] = Y_FLIP( y[i] ) + dPriv->y; \
} \
r128WriteDepthPixelsLocked( rmesa, n, ox, oy, depth, mask ); \
@@ -198,8 +189,8 @@ do { \
GLint i, remaining = n; \
\
while ( remaining > 0 ) { \
GLint ox[MAX_WIDTH]; \
GLint oy[MAX_WIDTH]; \
GLint ox[128]; \
GLint oy[128]; \
GLint count; \
\
if ( remaining <= 128 ) { \
@@ -209,8 +200,6 @@ do { \
} \
for ( i = 0 ; i < count ; i++ ) { \
ox[i] = x[i] + dPriv->x; \
} \
for ( i = 0 ; i < count ; i++ ) { \
oy[i] = Y_FLIP( y[i] ) + dPriv->y; \
} \
\
@@ -245,8 +234,6 @@ do { \
GLint oy[MAX_WIDTH]; \
for ( i = 0 ; i < n ; i++ ) { \
ox[i] = x[i] + dPriv->x; \
} \
for ( i = 0 ; i < n ; i++ ) { \
oy[i] = Y_FLIP( y[i] ) + dPriv->y; \
} \
r128WriteDepthPixelsLocked( rmesa, n, ox, oy, depth, mask ); \
@@ -275,8 +262,8 @@ do { \
GLint i, remaining = n; \
\
while ( remaining > 0 ) { \
GLint ox[MAX_WIDTH]; \
GLint oy[MAX_WIDTH]; \
GLint ox[128]; \
GLint oy[128]; \
GLint count; \
\
if ( remaining <= 128 ) { \
@@ -286,8 +273,6 @@ do { \
} \
for ( i = 0 ; i < count ; i++ ) { \
ox[i] = x[i] + dPriv->x; \
} \
for ( i = 0 ; i < count ; i++ ) { \
oy[i] = Y_FLIP( y[i] ) + dPriv->y; \
} \
\
@@ -316,13 +301,6 @@ do { \
/* FIXME: Add support for hardware stencil buffers.
*/
/* 32 bit depthbuffer functions */
#define WRITE_DEPTH(_x, _y, d) \
*(GLuint *)(buf + _x*4 + _y*pitch) = d
/*
* This function is called to specify which buffer to read and write
* for software rasterization (swrast) fallbacks. This doesn't necessarily
@@ -358,6 +336,20 @@ static void r128DDSetBuffer( GLcontext *ctx,
}
}
void r128SpanRenderStart( GLcontext *ctx )
{
r128ContextPtr rmesa = R128_CONTEXT(ctx);
FLUSH_BATCH(rmesa);
LOCK_HARDWARE(rmesa);
r128WaitForIdleLocked( rmesa );
}
void r128SpanRenderFinish( GLcontext *ctx )
{
r128ContextPtr rmesa = R128_CONTEXT(ctx);
_swrast_flush( ctx );
UNLOCK_HARDWARE( rmesa );
}
void r128DDInitSpanFuncs( GLcontext *ctx )
{
@@ -365,54 +357,8 @@ void r128DDInitSpanFuncs( GLcontext *ctx )
struct swrast_device_driver *swdd = _swrast_GetDeviceDriverReference(ctx);
swdd->SetBuffer = r128DDSetBuffer;
switch ( rmesa->r128Screen->cpp ) {
case 2:
#if 0
r128InitPointers_RGB565( swdd );
#endif
break;
case 4:
#if 0
r128InitPointers_ARGB8888( swdd );
#endif
break;
default:
break;
}
switch ( rmesa->glCtx->Visual.depthBits ) {
case 16:
#if 0
swdd->ReadDepthSpan = r128ReadDepthSpan_16;
swdd->WriteDepthSpan = r128WriteDepthSpan_16;
swdd->ReadDepthPixels = r128ReadDepthPixels_16;
swdd->WriteDepthPixels = r128WriteDepthPixels_16;
#endif
break;
case 24:
#if 0
swdd->ReadDepthSpan = r128ReadDepthSpan_24_8;
swdd->WriteDepthSpan = r128WriteDepthSpan_24_8;
swdd->ReadDepthPixels = r128ReadDepthPixels_24_8;
swdd->WriteDepthPixels = r128WriteDepthPixels_24_8;
#endif
break;
default:
break;
}
swdd->WriteCI8Span = NULL;
swdd->WriteCI32Span = NULL;
swdd->WriteMonoCISpan = NULL;
swdd->WriteCI32Pixels = NULL;
swdd->WriteMonoCIPixels = NULL;
swdd->ReadCI32Span = NULL;
swdd->ReadCI32Pixels = NULL;
swdd->SpanRenderStart = r128SpanRenderStart;
swdd->SpanRenderFinish = r128SpanRenderFinish;
}

View File

@@ -75,7 +75,6 @@ static void r128RenderPrimitive( GLcontext *ctx, GLenum prim );
#define HAVE_POINTS 1
#define HAVE_LE32_VERTS 1
#define CTX_ARG r128ContextPtr rmesa
#define CTX_ARG2 rmesa
#define GET_VERTEX_DWORDS() rmesa->vertex_size
#define ALLOC_VERTS( n, size ) r128AllocDmaLow( rmesa, (n), (size) * 4 )
#undef LOCAL_VARS
@@ -350,7 +349,6 @@ r128_fallback_tri( r128ContextPtr rmesa,
_swsetup_Translate( ctx, v0, &v[0] );
_swsetup_Translate( ctx, v1, &v[1] );
_swsetup_Translate( ctx, v2, &v[2] );
/* XXX: SpanRenderStart */
_swrast_Triangle( ctx, &v[0], &v[1], &v[2] );
}
@@ -674,8 +672,8 @@ static const char * const fallbackStrings[] = {
"glRenderMode(selection or feedback)",
"glLogicOp (mode != GL_COPY)",
"GL_SEPARATE_SPECULAR_COLOR",
"glBlendEquation",
"glBlendFunc(mode != ADD)",
"glBlendEquation(mode != ADD)",
"glBlendFunc",
"Projective texture",
"Rasterization disable",
};

View File

@@ -59,14 +59,12 @@ typedef struct r200_context *r200ContextPtr;
/* Flags for software fallback cases */
/* See correponding strings in r200_swtcl.c */
#define R200_FALLBACK_TEXTURE 0x1
#define R200_FALLBACK_DRAW_BUFFER 0x2
#define R200_FALLBACK_STENCIL 0x4
#define R200_FALLBACK_RENDER_MODE 0x8
#define R200_FALLBACK_BLEND_EQ 0x10
#define R200_FALLBACK_BLEND_FUNC 0x20
#define R200_FALLBACK_DISABLE 0x40
#define R200_FALLBACK_BORDER_MODE 0x80
#define R200_FALLBACK_TEXTURE 0x01
#define R200_FALLBACK_DRAW_BUFFER 0x02
#define R200_FALLBACK_STENCIL 0x04
#define R200_FALLBACK_RENDER_MODE 0x08
#define R200_FALLBACK_DISABLE 0x10
#define R200_FALLBACK_BORDER_MODE 0x20
/* The blit width for texture uploads
*/

View File

@@ -369,7 +369,6 @@ static void r200ResetLineStipple( GLcontext *ctx );
#undef LOCAL_VARS
#undef ALLOC_VERTS
#define CTX_ARG r200ContextPtr rmesa
#define CTX_ARG2 rmesa
#define GET_VERTEX_DWORDS() rmesa->swtcl.vertex_size
#define ALLOC_VERTS( n, size ) r200AllocDmaLowVerts( rmesa, n, size * 4 )
#define LOCAL_VARS \
@@ -648,8 +647,6 @@ static const char * const fallbackStrings[] = {
"glDrawBuffer(GL_FRONT_AND_BACK)",
"glEnable(GL_STENCIL) without hw stencil buffer",
"glRenderMode(selection or feedback)",
"glBlendEquation",
"glBlendFunc(mode != ADD)",
"R200_NO_RAST",
"Mixing GL_CLAMP_TO_BORDER and GL_CLAMP (or GL_MIRROR_CLAMP_ATI)"
};

View File

@@ -1016,8 +1016,7 @@ static GLboolean r200_validate_texgen( GLcontext *ctx, GLuint unit )
case GL_SPHERE_MAP:
rmesa->TexGenNeedNormals[unit] = GL_TRUE;
tgi |= R200_TEXGEN_INPUT_SPHERE<<inputshift;
/* GL_SPHERE_MAP doesn't appear to work. */
return GL_FALSE;
break;
case 0:
/* All texgen units were disabled, so just pass coords through. */

View File

@@ -74,9 +74,10 @@ static const char *const card_extensions[] = {
"GL_ARB_texture_border_clamp",
"GL_ARB_texture_compression",
/* disable until we support it, fixes a few things in ut2004 */
// "GL_ARB_texture_cube_map",
/* "GL_ARB_texture_cube_map", */
"GL_ARB_texture_env_add",
"GL_ARB_texture_env_combine",
"GL_ARB_texture_env_crossbar",
"GL_ARB_texture_env_dot3",
"GL_ARB_texture_mirrored_repeat",
"GL_ARB_vertex_buffer_object",
@@ -104,7 +105,6 @@ static const char *const card_extensions[] = {
"GL_NV_blend_square",
"GL_NV_vertex_program",
"GL_SGIS_generate_mipmap",
"GL_ARB_texture_env_crossbar",
NULL
};

View File

@@ -573,7 +573,7 @@ extern int hw_tcl_on;
#define CURRENT_VERTEX_SHADER(ctx) (ctx->VertexProgram._Enabled ? ctx->VertexProgram.Current : ctx->_TnlProgram)
//#define TMU_ENABLED(ctx, unit) (hw_tcl_on ? ctx->Texture.Unit[unit]._ReallyEnabled && (OutputsWritten & (1<<(VERT_RESULT_TEX0+(unit)))) : \
//#define TMU_ENABLED(ctx, unit) (hw_tcl_on ? ctx->Texture.Unit[unit]._ReallyEnabled && (OutputsWritten & (1<<(VERT_RESULT_TEX0+(unit)))) :
// (r300->state.render_inputs & (_TNL_BIT_TEX0<<(unit))))
#define TMU_ENABLED(ctx, unit) (hw_tcl_on ? ctx->Texture.Unit[unit]._ReallyEnabled && OutputsWritten & (1<<(VERT_RESULT_TEX0+(unit))) : \
ctx->Texture.Unit[unit]._ReallyEnabled && r300->state.render_inputs & (_TNL_BIT_TEX0<<(unit)))
@@ -591,7 +591,7 @@ struct r300_vertex_program {
int pos_end;
unsigned long num_temporaries; /* Number of temp vars used by program */
int inputs[VERT_ATTRIB_MAX];
int tex_regs[8];
int outputs[VERT_RESULT_MAX];
};
#if USE_ARB_F_P == 1
@@ -727,7 +727,7 @@ struct r300_pixel_shader_state {
#endif // USE_ARB_F_P
/* 8 is somewhat bogus... it is probably something like 24 */
#define R300_MAX_AOS_ARRAYS 8
#define R300_MAX_AOS_ARRAYS 16
#define AOS_FORMAT_FLOAT 1
#define AOS_FORMAT_UBYTE 2

View File

@@ -110,11 +110,13 @@ static const struct r300_pfv_swizzle {
{ "xxx", MAKE_SWZ3(X, X, X), GL_TRUE, R300_FPI0_ARGC_SRC0C_XXX, 4, GL_FALSE },
{ "yyy", MAKE_SWZ3(Y, Y, Y), GL_TRUE, R300_FPI0_ARGC_SRC0C_YYY, 4, GL_FALSE },
{ "zzz", MAKE_SWZ3(Z, Z, Z), GL_TRUE, R300_FPI0_ARGC_SRC0C_ZZZ, 4, GL_FALSE },
{ "www", MAKE_SWZ3(W, W, W), GL_TRUE, R300_FPI0_ARGC_SRC0A, 1, GL_TRUE },
{ "yzx", MAKE_SWZ3(Y, Z, X), GL_TRUE, R300_FPI0_ARGC_SRC0C_YZX, 1, GL_FALSE },
{ "zxy", MAKE_SWZ3(Z, X, Y), GL_TRUE, R300_FPI0_ARGC_SRC0C_ZXY, 1, GL_FALSE },
{ "wzy", MAKE_SWZ3(W, Z, Y), GL_TRUE, R300_FPI0_ARGC_SRC0CA_WZY, 1, GL_TRUE },
/* disable this for now, until I find a clean way of making sure xyz/w streams
* have a source in the same register slot.. */
// { "wzy", MAKE_SWZ3(W, Z, Y), GL_TRUE, R300_FPI0_ARGC_SRC0CA_WZY, 1, GL_TRUE },
/* special cases */
{ NULL, MAKE_SWZ3(W, W, W), GL_FALSE, 0, 0, GL_FALSE},
{ NULL, MAKE_SWZ3(ONE, ONE, ONE), GL_FALSE, R300_FPI0_ARGC_ONE, 0, GL_FALSE},
{ NULL, MAKE_SWZ3(ZERO, ZERO, ZERO), GL_FALSE, R300_FPI0_ARGC_ZERO, 0, GL_FALSE},
{ NULL, PFS_INVAL, GL_FALSE, R300_FPI0_ARGC_HALF, 0, GL_FALSE},
@@ -122,10 +124,10 @@ static const struct r300_pfv_swizzle {
};
#define SWIZZLE_XYZ 0
#define SWIZZLE_XXX 1
#define SWIZZLE_WZY 6
#define SWIZZLE_111 8
#define SWIZZLE_000 9
#define SWIZZLE_HHH 10
#define SWIZZLE_WWW 4
#define SWIZZLE_111 7
#define SWIZZLE_000 8
#define SWIZZLE_HHH 9
#define SWZ_X_MASK (7 << 0)
#define SWZ_Y_MASK (7 << 3)
@@ -170,10 +172,7 @@ const pfs_reg_t pfs_default_reg = {
index: 0,
v_swz: 0 /* matches XYZ in table */,
s_swz: SWIZZLE_W,
vcross: 0,
scross: 0,
negate: 0,
has_w: GL_FALSE,
valid: GL_FALSE
};
@@ -240,6 +239,32 @@ static pfs_reg_t get_temp_reg(struct r300_fragment_program *rp)
return r;
}
static pfs_reg_t get_temp_reg_tex(struct r300_fragment_program *rp)
{
pfs_reg_t r = pfs_default_reg;
int hwreg;
hwreg = ffs(~(rp->hwreg_in_use | rp->used_in_node));
if (!hwreg) {
/* Try and grab an already used temp, will
* cause an indirection, but better than failing */
return get_temp_reg(rp);
}
if (hwreg > rp->max_temp_idx)
rp->max_temp_idx = hwreg;
r.index = ffs(~rp->temp_in_use);
if (!r.index) {
ERROR("Out of program temps\n");
return r;
}
rp->temp_in_use |= (1 << --r.index);
rp->temps[r.index] = --hwreg;
r.valid = GL_TRUE;
return r;
}
static void free_temp(struct r300_fragment_program *rp, pfs_reg_t r)
{
if (!rp || !(rp->temp_in_use & (1<<r.index))) return;
@@ -297,50 +322,37 @@ static int swz_native(struct r300_fragment_program *rp,
{
/* Native swizzle, nothing to see here */
*r = src;
r->has_w = GL_TRUE;
return 3;
}
static int swz_emit_partial(struct r300_fragment_program *rp,
pfs_reg_t src, pfs_reg_t *r, int mask)
pfs_reg_t src, pfs_reg_t *r, int mask, int mc)
{
if (!r->valid)
*r = get_temp_reg(rp);
/* A partial match, src.v_swz/mask define what parts of the
* desired swizzle we match */
emit_arith(rp, PFS_OP_MAD, *r, s_mask[mask].mask, src, pfs_one, pfs_zero, 0);
if (mc + s_mask[mask].count == 3)
emit_arith(rp, PFS_OP_MAD, *r, s_mask[mask].mask|WRITEMASK_W, src, pfs_one, pfs_zero, 0);
else
emit_arith(rp, PFS_OP_MAD, *r, s_mask[mask].mask, src, pfs_one, pfs_zero, 0);
return s_mask[mask].count;
}
static int swz_special_case(struct r300_fragment_program *rp,
pfs_reg_t src, pfs_reg_t *r, int mask)
pfs_reg_t src, pfs_reg_t *r, int mask, int mc)
{
pfs_reg_t ssrc = pfs_default_reg;
switch(GET_SWZ(v_swiz[src.v_swz].hash, 0)) {
case SWIZZLE_W:
ssrc = get_temp_reg(rp);
src.v_swz = SWIZZLE_WZY;
src.vcross = GL_TRUE;
if (s_mask[mask].count == 3) {
emit_arith(rp, PFS_OP_MAD, ssrc, WRITEMASK_XW, src, pfs_one, pfs_zero, 0);
*r = ssrc;
r->v_swz = SWIZZLE_XXX;
r->s_swz = SWIZZLE_W;
r->has_w = GL_TRUE;
} else {
if (!r->valid)
*r = get_temp_reg(rp);
emit_arith(rp, PFS_OP_MAD, ssrc, WRITEMASK_X, src, pfs_one, pfs_zero, 0);
ssrc.v_swz = SWIZZLE_XXX;
emit_arith(rp, PFS_OP_MAD, *r, s_mask[mask].mask, ssrc, pfs_one, pfs_zero, 0);
free_temp(rp, ssrc);
}
break;
case SWIZZLE_ONE:
case SWIZZLE_ZERO:
if (!r->valid)
*r = get_temp_reg(rp);
if (mc + s_mask[mask].count == 3)
emit_arith(rp, PFS_OP_MAD, *r, s_mask[mask].mask|WRITEMASK_W, src, pfs_one, pfs_zero, 0);
else
emit_arith(rp, PFS_OP_MAD, *r, s_mask[mask].mask, src, pfs_one, pfs_zero, 0);
break;
default:
ERROR("Unknown special-case swizzle! %d\n", src.v_swz);
return 0;
@@ -359,38 +371,27 @@ static pfs_reg_t swizzle(struct r300_fragment_program *rp,
int v_matched = 0;
src.v_swz = SWIZZLE_XYZ;
src.s_swz = GET_SWZ(arbswz, 3);
if (src.s_swz >= SWIZZLE_X && src.s_swz <= SWIZZLE_Z)
src.scross = GL_TRUE;
do {
do {
#define CUR_HASH (v_swiz[src.v_swz].hash & s_mask[c_mask].hash)
if (CUR_HASH == (arbswz & s_mask[c_mask].hash)) {
if (v_swiz[src.v_swz].native == GL_FALSE)
v_matched += swz_special_case(rp, src, &r, c_mask);
v_matched += swz_special_case(rp, src, &r, c_mask, v_matched);
else if (s_mask[c_mask].count == 3)
v_matched += swz_native(rp, src, &r);
else
v_matched += swz_emit_partial(rp, src, &r, c_mask);
v_matched += swz_emit_partial(rp, src, &r, c_mask, v_matched);
if (v_matched == 3) {
if (!r.has_w) {
emit_arith(rp, PFS_OP_MAD, r, WRITEMASK_W, src, pfs_one, pfs_zero, 0);
r.s_swz = SWIZZLE_W;
}
if (r.type != REG_TYPE_CONST) {
if (r.v_swz == SWIZZLE_WZY)
r.vcross = GL_TRUE;
if (r.s_swz >= SWIZZLE_X && r.s_swz <= SWIZZLE_Z)
r.scross = GL_TRUE;
}
if (v_matched == 3)
return r;
}
arbswz &= ~s_mask[c_mask].hash;
/* Fill with something invalid.. all 0's was wrong before, matched
* SWIZZLE_X. So all 1's will be okay for now */
arbswz |= (PFS_INVAL & s_mask[c_mask].hash);
}
} while(v_swiz[++src.v_swz].hash != PFS_INVAL);
src.v_swz = SWIZZLE_XYZ;
} while (s_mask[++c_mask].hash != PFS_INVAL);
ERROR("should NEVER get here\n");
@@ -471,16 +472,16 @@ static void sync_streams(struct r300_fragment_program *rp) {
/* Bring vector/scalar streams into sync, inserting nops into
* whatever stream is lagging behind
*
* I'm using "MAD t0, t0, 1.0, 0.0" as a NOP
* Using NOP == MAD out.none, 0, 0, 0
*/
while (rp->v_pos != rp->s_pos) {
if (rp->s_pos > rp->v_pos) {
rp->alu.inst[rp->v_pos].inst0 = 0x00050A80;
rp->alu.inst[rp->v_pos].inst1 = 0x03820800;
rp->alu.inst[rp->v_pos].inst0 = 0x00050A14;
rp->alu.inst[rp->v_pos].inst1 = 0x00020820;
rp->v_pos++;
} else {
rp->alu.inst[rp->s_pos].inst2 = 0x00040889;
rp->alu.inst[rp->s_pos].inst3 = 0x00820800;
rp->alu.inst[rp->s_pos].inst2 = 0x00040810;
rp->alu.inst[rp->s_pos].inst3 = 0x00020820;
rp->s_pos++;
}
}
@@ -491,10 +492,15 @@ static void emit_tex(struct r300_fragment_program *rp,
int opcode)
{
pfs_reg_t coord = t_src(rp, fpi->SrcReg[0]);
pfs_reg_t dest = t_dst(rp, fpi->DstReg);
pfs_reg_t dest = t_dst(rp, fpi->DstReg), rdest = pfs_default_reg;
int unit = fpi->TexSrcUnit;
int hwsrc, hwdest, flags = 0;
if (dest.type == REG_TYPE_OUTPUT) {
rdest = dest;
dest = get_temp_reg_tex(rp);
}
switch (coord.type) {
case REG_TYPE_TEMP:
hwsrc = rp->temps[coord.index];
@@ -522,6 +528,7 @@ static void emit_tex(struct r300_fragment_program *rp,
ERROR("too many levels of texture indirection\n");
return;
}
/* Finish off current node */
sync_streams(rp);
rp->node[rp->cur_node].alu_end = rp->v_pos - 1;
@@ -544,9 +551,59 @@ static void emit_tex(struct r300_fragment_program *rp,
| (unit << R300_FPITX_IMAGE_SHIFT)
| (opcode << R300_FPITX_OPCODE_SHIFT) /* not entirely sure about this */
| flags;
rp->dest_in_node |= (1 << hwdest);
rp->dest_in_node |= (1 << hwdest);
if (coord.type != REG_TYPE_CONST)
rp->used_in_node |= (1 << hwsrc);
rp->node[rp->cur_node].tex_end++;
/* Copy from temp to output if needed */
if (rdest.valid) {
emit_arith(rp, PFS_OP_MAD, rdest, WRITEMASK_XYZW, dest, pfs_one, pfs_zero, 0);
free_temp(rp, dest);
}
}
#define ARG_NEG (1<<5)
#define ARG_ABS (1<<6)
#define SRC_CONST (1<<5)
#define SRC_STRIDE 6
static int t_hw_src(struct r300_fragment_program *rp, pfs_reg_t src)
{
int idx;
switch (src.type) {
case REG_TYPE_TEMP:
idx = rp->temps[src.index];
break;
case REG_TYPE_INPUT:
idx = rp->inputs[src.index];
break;
case REG_TYPE_CONST:
return (src.index | SRC_CONST);
default:
ERROR("Invalid type for source reg\n");
return (0 | SRC_CONST);
}
rp->used_in_node |= (1 << idx);
return idx;
}
/* Add sources to FPI1/FPI3 lists. If source is already on list,
* reuse the index instead of wasting a source.
*/
static inline int add_src(int src[3], int *cnt, int reg) {
int i;
for (i=0;i<*cnt;i++)
if (src[i] == reg) return i;
if (*cnt == 3) assert(0); /* I don't *think* this can happen */
src[*cnt] = reg;
return (*cnt)++;
}
static void emit_arith(struct r300_fragment_program *rp, int op,
@@ -555,19 +612,20 @@ static void emit_arith(struct r300_fragment_program *rp, int op,
int flags)
{
pfs_reg_t src[3] = { src0, src1, src2 };
/* XYZ/W emit control */
int v_idx = rp->v_pos, s_idx = rp->s_pos;
GLboolean emit_v = GL_FALSE, emit_s = GL_FALSE;
/* INST1/INST3 sources */
int vsrc[3], ssrc[3];
int nvs = 0, nss = 0;
/* INST0/INST2 sources */
int vswz[3], sswz[3];
/* temp stuff */
int hwdest, hwsrc;
int argc;
int v_idx = rp->v_pos, s_idx = rp->s_pos;
GLuint inst[4] = { 0, 0, 0, 0 };
int vop, sop;
int i;
#define ARG_NEG (1<<5)
#define ARG_ABS (1<<6)
#define ARG_STRIDE 7
#define SRC_CONST (1<<5)
#define SRC_STRIDE 6
if (!dest.valid || !src0.valid || !src1.valid || !src2.valid) {
ERROR("invalid register. dest/src0/src1/src2 valid = %d/%d/%d/%d\n",
dest.valid, src0.valid, src1.valid, src2.valid);
@@ -597,95 +655,91 @@ static void emit_arith(struct r300_fragment_program *rp, int op,
ERROR("invalid dest reg type %d\n", dest.type);
return;
}
/* grab hwregs of sources */
int str;
for (i=0;i<3;i++) {
if (i<argc) {
/* Decide on hardware source index */
switch (src[i].type) {
case REG_TYPE_INPUT:
hwsrc = rp->inputs[src[i].index];
rp->used_in_node |= (1 << hwsrc);
inst[1] |= hwsrc << (i * SRC_STRIDE);
inst[3] |= hwsrc << (i * SRC_STRIDE);
break;
case REG_TYPE_TEMP:
/* make sure insn ordering is right... */
if ((src[i].vcross && v_idx < s_idx) ||
(src[i].scross && s_idx < v_idx)) {
hwsrc = t_hw_src(rp, src[i]);
if (mask & WRITEMASK_XYZ && vop != R300_FPI0_OUTC_REPL_ALPHA) {
if (v_swiz[src[i].v_swz].dep_sca) {
sync_streams(rp);
v_idx = s_idx = rp->v_pos;
}
emit_s = GL_TRUE;
str = add_src(ssrc, &nss, hwsrc);
} else
str = add_src(vsrc, &nvs, hwsrc);
vswz[i] = v_swiz[src[i].v_swz].base + (str * v_swiz[src[i].v_swz].stride);
} else
vswz[i] = R300_FPI0_ARGC_ZERO;
if (mask & WRITEMASK_W || vop == R300_FPI0_OUTC_REPL_ALPHA) {
if (s_swiz[src[i].s_swz].dep_vec) {
sync_streams(rp);
v_idx = s_idx = rp->v_pos;
emit_v = GL_TRUE;
str = add_src(vsrc, &nvs, hwsrc);
} else
str = add_src(ssrc, &nss, hwsrc);
sswz[i] = s_swiz[src[i].s_swz].base + (str * s_swiz[src[i].s_swz].stride);
} else
sswz[i] = R300_FPI2_ARGA_ZERO;
hwsrc = rp->temps[src[i].index];
rp->used_in_node |= (1 << hwsrc);
inst[1] |= hwsrc << (i * SRC_STRIDE);
inst[3] |= hwsrc << (i * SRC_STRIDE);
break;
case REG_TYPE_CONST:
hwsrc = src[i].index;
inst[1] |= ((hwsrc | SRC_CONST) << (i * SRC_STRIDE));
inst[3] |= ((hwsrc | SRC_CONST) << (i * SRC_STRIDE));
break;
default:
ERROR("invalid source reg\n");
return;
}
/* Swizzling/Negation */
if (vop == R300_FPI0_OUTC_REPL_ALPHA)
inst[0] |= R300_FPI0_ARGC_ZERO << (i * ARG_STRIDE);
else
inst[0] |= (v_swiz[src[i].v_swz].base + (i * v_swiz[src[i].v_swz].stride)) << (i*ARG_STRIDE);
inst[2] |= (s_swiz[src[i].s_swz].base + (i * s_swiz[src[i].s_swz].stride)) << (i*ARG_STRIDE);
if (src[i].negate) {
inst[0] |= ARG_NEG << (i * ARG_STRIDE);
inst[2] |= ARG_NEG << (i * ARG_STRIDE);
vswz[i] |= ARG_NEG;
sswz[i] |= ARG_NEG;
}
if (flags & PFS_FLAG_ABS) {
inst[0] |= ARG_ABS << (i * ARG_STRIDE);
inst[2] |= ARG_ABS << (i * ARG_STRIDE);
vswz[i] |= ARG_ABS;
sswz[i] |= ARG_ABS;
}
} else {
/* read constant 0, use zero swizzle aswell */
inst[0] |= R300_FPI0_ARGC_ZERO << (i*ARG_STRIDE);
inst[1] |= SRC_CONST << (i*SRC_STRIDE);
inst[2] |= R300_FPI2_ARGA_ZERO << (i*ARG_STRIDE);
inst[3] |= SRC_CONST << (i*SRC_STRIDE);
vswz[i] = R300_FPI0_ARGC_ZERO;
sswz[i] = R300_FPI2_ARGA_ZERO;
}
}
/* Unused sources, read constant reg 0 */
for (i=nvs;i<3;i++)
vsrc[i] = 0 | SRC_CONST;
for (i=nss;i<3;i++)
ssrc[i] = 0 | SRC_CONST;
if (flags & PFS_FLAG_SAT) {
vop |= R300_FPI0_OUTC_SAT;
sop |= R300_FPI2_OUTA_SAT;
}
if (mask & WRITEMASK_XYZ) {
if (mask & WRITEMASK_XYZ || emit_v) {
if (r300_fpop[op].v_op == R300_FPI0_OUTC_REPL_ALPHA) {
sync_streams(rp);
s_idx = v_idx = rp->v_pos;
}
rp->alu.inst[v_idx].inst0 = inst[0] | vop;
rp->alu.inst[v_idx].inst1 = inst[1] |
(hwdest << R300_FPI1_DSTC_SHIFT) |
rp->alu.inst[v_idx].inst0 = vop |
vswz[0] << R300_FPI0_ARG0C_SHIFT |
vswz[1] << R300_FPI0_ARG1C_SHIFT |
vswz[2] << R300_FPI0_ARG2C_SHIFT;
rp->alu.inst[v_idx].inst1 = hwdest << R300_FPI1_DSTC_SHIFT |
vsrc[0] << R300_FPI1_SRC0C_SHIFT |
vsrc[1] << R300_FPI1_SRC1C_SHIFT |
vsrc[2] << R300_FPI1_SRC2C_SHIFT |
((mask & WRITEMASK_XYZ) << (dest.type == REG_TYPE_OUTPUT ? 26 : 23));
rp->v_pos = v_idx + 1;
}
if ((mask & WRITEMASK_W) || r300_fpop[op].v_op == R300_FPI0_OUTC_REPL_ALPHA) {
rp->alu.inst[s_idx].inst2 = inst[2] | sop;
rp->alu.inst[s_idx].inst3 = inst[3] |
(hwdest << R300_FPI3_DSTA_SHIFT) |
if (mask & WRITEMASK_W || emit_s || vop == R300_FPI0_OUTC_REPL_ALPHA) {
rp->alu.inst[s_idx].inst2 = sop |
sswz[0] << R300_FPI2_ARG0A_SHIFT |
sswz[1] << R300_FPI2_ARG1A_SHIFT |
sswz[2] << R300_FPI2_ARG2A_SHIFT;
rp->alu.inst[s_idx].inst3 = hwdest << R300_FPI3_DSTA_SHIFT |
ssrc[0] << R300_FPI3_SRC0A_SHIFT |
ssrc[1] << R300_FPI3_SRC1A_SHIFT |
ssrc[2] << R300_FPI3_SRC2A_SHIFT |
(((mask & WRITEMASK_W)?1:0) << (dest.type == REG_TYPE_OUTPUT ? 24 : 23));
rp->s_pos = s_idx + 1;
}
// sync_streams(rp);
/* sync_streams(rp); */
return;
};
@@ -776,6 +830,7 @@ static GLboolean parse_program(struct r300_fragment_program *rp)
ERROR("unknown fpi->Opcode %d\n", fpi->Opcode);
break;
case FP_OPCODE_MOV:
case FP_OPCODE_SWZ:
emit_arith(rp, PFS_OP_MAD, t_dst(rp, fpi->DstReg), fpi->DstReg.WriteMask,
t_src(rp, fpi->SrcReg[0]), pfs_one, pfs_zero,
flags);
@@ -788,17 +843,14 @@ static GLboolean parse_program(struct r300_fragment_program *rp)
flags);
break;
case FP_OPCODE_POW:
/* I don't like this, and it's probably wrong in some
* circumstances... Needs checking */
src0 = t_src(rp, fpi->SrcReg[0]);
src1 = t_src(rp, fpi->SrcReg[1]);
dest = t_dst(rp, fpi->DstReg);
temp = get_temp_reg(rp);
temp.s_swz = SWIZZLE_X; /* cheat, bypass swizzle code */
emit_arith(rp, PFS_OP_LG2, temp, WRITEMASK_X,
emit_arith(rp, PFS_OP_LG2, temp, WRITEMASK_W,
src0, pfs_zero, pfs_zero, 0);
emit_arith(rp, PFS_OP_MAD, temp, WRITEMASK_X,
emit_arith(rp, PFS_OP_MAD, temp, WRITEMASK_W,
temp, src1, pfs_zero, 0);
emit_arith(rp, PFS_OP_EX2, dest, fpi->DstReg.WriteMask,
temp, pfs_zero, pfs_zero, 0);
@@ -826,9 +878,6 @@ static GLboolean parse_program(struct r300_fragment_program *rp)
negate(t_src(rp, fpi->SrcReg[1])),
flags);
break;
case FP_OPCODE_SWZ:
ERROR("unknown fpi->Opcode %d\n", fpi->Opcode);
break;
case FP_OPCODE_TEX:
emit_tex(rp, fpi, R300_FPITX_OP_TEX);
break;
@@ -892,24 +941,29 @@ void init_program(struct r300_fragment_program *rp)
/* Work out what temps the Mesa inputs correspond to, this must match
* what setup_rs_unit does, which shouldn't be a problem as rs_unit
* configures itself based on the fragprog's InputsRead
*
* I'm using get_hw_temp() here now rather than doing this manually.
* This depends on get_hw_temp() allocating registers in order, starting
* at 0 (which it currently does).
*/
/* Texcoords come first */
for (i=0;i<rp->ctx->Const.MaxTextureUnits;i++) {
if (InputsRead & (FRAG_BIT_TEX0 << i)) {
rp->hwreg_in_use |= (1<<fp_reg);
rp->inputs[FRAG_ATTRIB_TEX0+i] = fp_reg++;
}
if (InputsRead & (FRAG_BIT_TEX0 << i))
rp->inputs[FRAG_ATTRIB_TEX0+i] = get_hw_temp(rp);
}
InputsRead &= ~FRAG_BITS_TEX_ANY;
/* Then primary colour */
if (InputsRead & FRAG_BIT_COL0) {
rp->hwreg_in_use |= (1<<fp_reg);
rp->inputs[FRAG_ATTRIB_COL0] = fp_reg++;
}
if (InputsRead & FRAG_BIT_COL0)
rp->inputs[FRAG_ATTRIB_COL0] = get_hw_temp(rp);
InputsRead &= ~FRAG_BIT_COL0;
/* Secondary color */
if (InputsRead & FRAG_BIT_COL1)
rp->inputs[FRAG_ATTRIB_COL1] = get_hw_temp(rp);
InputsRead &= ~FRAG_BIT_COL1;
/* Anything else */
if (InputsRead) {
WARN_ONCE("Don't know how to handle inputs 0x%x\n", InputsRead);
@@ -966,15 +1020,15 @@ void update_params(struct r300_fragment_program *rp) {
void translate_fragment_shader(struct r300_fragment_program *rp)
{
int i;
if (!rp->translated) {
init_program(rp);
if (parse_program(rp) == GL_FALSE) {
dump_program(rp);
return;
}
/* Finish off */
sync_streams(rp);
rp->node[rp->cur_node].alu_end = rp->v_pos - 1;
@@ -987,6 +1041,7 @@ void translate_fragment_shader(struct r300_fragment_program *rp)
if (0) dump_program(rp);
}
update_params(rp);
}

View File

@@ -20,10 +20,7 @@ typedef struct _pfs_reg_t {
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;

View File

@@ -437,7 +437,7 @@ struct r300_fragment_program_swizzle r300_swizzle [512] = {
/* WXZ */
{3,{0,0,0,0},{ I0_XXX, I1__Y_,
I0_ZZZ, I1___Z,
I0_WZY, I1___Z,
I0_WZY, I1_X__,
0,0}},
/* 0XZ */
{3,{0,0,2,0},{ I0_XXX, I1__Y_,

View File

@@ -55,21 +55,24 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "vblank.h"
//#define CB_DPATH
#define CLEARBUFFER_COLOR 0x1
#define CLEARBUFFER_DEPTH 0x2
#define CLEARBUFFER_STENCIL 0x4
/* TODO: Fix this so that white vertical lines no longer appear. */
static void r300ClearBuffer(r300ContextPtr r300, int flags, int buffer)
{
GLcontext* ctx = r300->radeon.glCtx;
r300ContextPtr rmesa=r300;
__DRIdrawablePrivate *dPriv = r300->radeon.dri.drawable;
int i;
GLuint cboffset, cbpitch;
drm_r300_cmd_header_t* cmd2;
#ifdef CB_DPATH
r300ContextPtr rmesa=r300;
LOCAL_VARS;
#else
int i;
#endif
if (RADEON_DEBUG & DEBUG_IOCTL)
fprintf(stderr, "%s: %s buffer (%i,%i %ix%i)\n",
@@ -86,6 +89,7 @@ static void r300ClearBuffer(r300ContextPtr r300, int flags, int buffer)
cboffset += r300->radeon.radeonScreen->fbLocation;
#ifndef CB_DPATH
R300_STATECHANGE(r300, vir[0]);
((drm_r300_cmd_header_t*)r300->hw.vir[0].cmd)->unchecked_state.count = 1;
r300->hw.vir[0].cmd[1] = 0x21030003;
@@ -139,7 +143,7 @@ static void r300ClearBuffer(r300ContextPtr r300, int flags, int buffer)
R300_STATECHANGE(r300, rc);
/* 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[1] = (1 << R300_RS_CNTL_CI_CNT_SHIFT) | R300_RS_CNTL_0_UNKNOWN_18;
r300->hw.rc.cmd[2] = 0;
R300_STATECHANGE(r300, rr);
@@ -248,6 +252,80 @@ static void r300ClearBuffer(r300ContextPtr r300, int flags, int buffer)
r300EnsureCmdBufSpace(r300, r300->hw.max_state_size + 9+8, __FUNCTION__);
r300EmitState(r300);
#else
R300_STATECHANGE(r300, cb);
reg_start(R300_RB3D_COLOROFFSET0, 0);
e32(cboffset);
reg_start(R300_RB3D_COLORPITCH0, 0);
e32(cbpitch | R300_COLOR_UNKNOWN_22_23);
R300_STATECHANGE(r300, cmk);
reg_start(R300_RB3D_COLORMASK, 0);
if (flags & CLEARBUFFER_COLOR) {
e32((ctx->Color.ColorMask[BCOMP] ? R300_COLORMASK0_B : 0) |
(ctx->Color.ColorMask[GCOMP] ? R300_COLORMASK0_G : 0) |
(ctx->Color.ColorMask[RCOMP] ? R300_COLORMASK0_R : 0) |
(ctx->Color.ColorMask[ACOMP] ? R300_COLORMASK0_A : 0));
} else {
e32(0);
}
R300_STATECHANGE(r300, zs);
reg_start(R300_RB3D_ZSTENCIL_CNTL_0, 2);
{
uint32_t t1, t2;
t1 = r300->hw.zs.cmd[R300_ZS_CNTL_0];
t2 = r300->hw.zs.cmd[R300_ZS_CNTL_1];
if (flags & CLEARBUFFER_DEPTH) {
t1 &= R300_RB3D_STENCIL_ENABLE;
t1 |= 0x6; // test and write
t2 &= ~(R300_ZS_MASK << R300_RB3D_ZS1_DEPTH_FUNC_SHIFT);
t2 |= (R300_ZS_ALWAYS<<R300_RB3D_ZS1_DEPTH_FUNC_SHIFT);
/*
R300_STATECHANGE(r300, zb);
r300->hw.zb.cmd[R300_ZB_OFFSET] =
1024*4*300 +
r300->radeon.radeonScreen->frontOffset +
r300->radeon.radeonScreen->fbLocation;
r300->hw.zb.cmd[R300_ZB_PITCH] =
r300->radeon.radeonScreen->depthPitch;
*/
} else {
t1 &= R300_RB3D_STENCIL_ENABLE;
t1 |= R300_RB3D_Z_DISABLED_1; // disable
t2 &= ~(R300_ZS_MASK << R300_RB3D_ZS1_DEPTH_FUNC_SHIFT);
}
if (flags & CLEARBUFFER_STENCIL) {
t1 &= ~R300_RB3D_STENCIL_ENABLE;
t1 |= R300_RB3D_STENCIL_ENABLE;
t2 &=
~((R300_ZS_MASK << R300_RB3D_ZS1_FRONT_FUNC_SHIFT) | (R300_ZS_MASK << R300_RB3D_ZS1_BACK_FUNC_SHIFT));
t2 |=
(R300_ZS_ALWAYS<<R300_RB3D_ZS1_FRONT_FUNC_SHIFT) |
(R300_ZS_REPLACE<<R300_RB3D_ZS1_FRONT_FAIL_OP_SHIFT) |
(R300_ZS_REPLACE<<R300_RB3D_ZS1_FRONT_ZPASS_OP_SHIFT) |
(R300_ZS_REPLACE<<R300_RB3D_ZS1_FRONT_ZFAIL_OP_SHIFT) |
(R300_ZS_ALWAYS<<R300_RB3D_ZS1_BACK_FUNC_SHIFT) |
(R300_ZS_REPLACE<<R300_RB3D_ZS1_BACK_FAIL_OP_SHIFT) |
(R300_ZS_REPLACE<<R300_RB3D_ZS1_BACK_ZPASS_OP_SHIFT) |
(R300_ZS_REPLACE<<R300_RB3D_ZS1_BACK_ZFAIL_OP_SHIFT) ;
}
e32(t1);
e32(t2);
e32(r300->state.stencil.clear);
}
#endif
cmd2 = (drm_r300_cmd_header_t*)r300AllocCmdBuf(r300, 9, __FUNCTION__);
cmd2[0].packet3.cmd_type = R300_CMD_PACKET3;
@@ -262,6 +340,131 @@ static void r300ClearBuffer(r300ContextPtr r300, int flags, int buffer)
cmd2[8].u = r300PackFloat32(ctx->Color.ClearColor[3]);
}
#ifdef CB_DPATH
static void r300EmitClearState(GLcontext * ctx)
{
r300ContextPtr r300 = R300_CONTEXT(ctx);
r300ContextPtr rmesa=r300;
__DRIdrawablePrivate *dPriv = r300->radeon.dri.drawable;
int i;
LOCAL_VARS;
R300_STATECHANGE(r300, vir[0]);
reg_start(R300_VAP_INPUT_ROUTE_0_0, 0);
e32(0x21030003);
R300_STATECHANGE(r300, vir[1]);
reg_start(R300_VAP_INPUT_ROUTE_1_0, 0);
e32(0xF688F688);
R300_STATECHANGE(r300, vic);
reg_start(R300_VAP_INPUT_CNTL_0, 1);
e32(0x00000001);
e32(0x00000405);
R300_STATECHANGE(r300, vof);
reg_start(R300_VAP_OUTPUT_VTX_FMT_0, 1);
e32(R300_VAP_OUTPUT_VTX_FMT_0__POS_PRESENT | R300_VAP_OUTPUT_VTX_FMT_0__COLOR_PRESENT);
e32(0); /* no textures */
R300_STATECHANGE(r300, txe);
reg_start(R300_TX_ENABLE, 0);
e32(0);
R300_STATECHANGE(r300, vpt);
reg_start(R300_SE_VPORT_XSCALE, 5);
efloat(1.0);
efloat(dPriv->x);
efloat(1.0);
efloat(dPriv->y);
efloat(1.0);
efloat(0.0);
R300_STATECHANGE(r300, at);
reg_start(R300_PP_ALPHA_TEST, 0);
e32(0);
R300_STATECHANGE(r300, bld);
reg_start(R300_RB3D_CBLEND, 1);
e32(0);
e32(0);
R300_STATECHANGE(r300, unk221C);
reg_start(0x221C, 0);
e32(R300_221C_CLEAR);
R300_STATECHANGE(r300, ps);
reg_start(R300_RE_POINTSIZE, 0);
e32(((dPriv->w * 6) << R300_POINTSIZE_X_SHIFT) |
((dPriv->h * 6) << R300_POINTSIZE_Y_SHIFT));
R300_STATECHANGE(r300, ri);
reg_start(R300_RS_INTERP_0, 8);
for(i = 0; i < 8; ++i){
e32(R300_RS_INTERP_USED);
}
R300_STATECHANGE(r300, rc);
/* The second constant is needed to get glxgears display anything .. */
reg_start(R300_RS_CNTL_0, 1);
e32(R300_RS_CNTL_0_UNKNOWN_7 | R300_RS_CNTL_0_UNKNOWN_18);
e32(0);
R300_STATECHANGE(r300, rr);
reg_start(R300_RS_ROUTE_0, 0);
e32(0x00004000);
R300_STATECHANGE(r300, fp);
reg_start(R300_PFS_CNTL_0, 2);
e32(0);
e32(0);
e32(0);
reg_start(R300_PFS_NODE_0, 3);
e32(0);
e32(0);
e32(0);
e32(R300_PFS_NODE_LAST_NODE);
R300_STATECHANGE(r300, fpi[0]);
R300_STATECHANGE(r300, fpi[1]);
R300_STATECHANGE(r300, fpi[2]);
R300_STATECHANGE(r300, fpi[3]);
reg_start(R300_PFS_INSTR0_0, 0);
e32(FP_INSTRC(MAD, FP_ARGC(SRC0C_XYZ), FP_ARGC(ONE), FP_ARGC(ZERO)));
reg_start(R300_PFS_INSTR1_0, 0);
e32(FP_SELC(0,NO,XYZ,FP_TMP(0),0,0));
reg_start(R300_PFS_INSTR2_0, 0);
e32(FP_INSTRA(MAD, FP_ARGA(SRC0A), FP_ARGA(ONE), FP_ARGA(ZERO)));
reg_start(R300_PFS_INSTR3_0, 0);
e32(FP_SELA(0,NO,W,FP_TMP(0),0,0));
R300_STATECHANGE(r300, pvs);
reg_start(R300_VAP_PVS_CNTL_1, 2);
e32((0 << R300_PVS_CNTL_1_PROGRAM_START_SHIFT) |
(0 << R300_PVS_CNTL_1_POS_END_SHIFT) |
(1 << R300_PVS_CNTL_1_PROGRAM_END_SHIFT));
e32(0);
e32(1 << R300_PVS_CNTL_3_PROGRAM_UNKNOWN_SHIFT);
R300_STATECHANGE(r300, vpi);
vsf_start_fragment(0x0, 8);
e32(VP_OUT(ADD,OUT,0,XYZW));
e32(VP_IN(IN,0));
e32(VP_ZERO());
e32(0);
e32(VP_OUT(ADD,OUT,1,XYZW));
e32(VP_IN(IN,1));
e32(VP_ZERO());
e32(0);
}
#endif
/**
* Buffer clear
@@ -274,8 +477,6 @@ static void r300Clear(GLcontext * ctx, GLbitfield mask, GLboolean all,
int flags = 0;
int bits = 0;
int swapped;
uint32_t unk42B4;
uint32_t zbs[4];
if (RADEON_DEBUG & DEBUG_IOCTL)
fprintf(stderr, "%s: all=%d cx=%d cy=%d cw=%d ch=%d\n",
@@ -317,6 +518,11 @@ static void r300Clear(GLcontext * ctx, GLbitfield mask, GLboolean all,
swapped = r300->radeon.doPageFlip && (r300->radeon.sarea->pfCurrentPage == 1);
#ifdef CB_DPATH
if(flags || bits)
r300EmitClearState(ctx);
#endif
if (flags & BUFFER_BIT_FRONT_LEFT) {
r300ClearBuffer(r300, bits | CLEARBUFFER_COLOR, swapped);
bits = 0;
@@ -330,6 +536,7 @@ static void r300Clear(GLcontext * ctx, GLbitfield mask, GLboolean all,
if (bits)
r300ClearBuffer(r300, bits, 0);
#ifndef CB_DPATH
/* Recalculate the hardware state. This could be done more efficiently,
* but do keep it like this for now.
*/
@@ -337,6 +544,7 @@ static void r300Clear(GLcontext * ctx, GLbitfield mask, GLboolean all,
/* r300ClearBuffer has trampled all over the hardware state.. */
r300->hw.all_dirty=GL_TRUE;
#endif
}
void r300Flush(GLcontext * ctx)

View File

@@ -385,6 +385,7 @@ void r300EmitArrays(GLcontext * ctx, GLboolean immd)
}
#endif
r300->state.texture.tc_count = 0;
for (i = 0; i < ctx->Const.MaxTextureUnits; i++) {
if (inputs & (_TNL_BIT_TEX0 << i)) {
CONFIGURE_AOS(i_tex[i], AOS_FORMAT_FLOAT,
@@ -393,14 +394,10 @@ void r300EmitArrays(GLcontext * ctx, GLboolean immd)
count);
vic_1 |= R300_INPUT_CNTL_TC0 << i;
r300->state.texture.tc_count++;
}
}
int cmd_reserved=0;
int cmd_written=0;
drm_radeon_cmd_header_t *cmd = NULL;
#define SHOW_INFO(n) do { \
if (RADEON_DEBUG & DEBUG_ALL) { \
fprintf(stderr, "RR[%d] - sz=%d, reg=%d, fmt=%d -- st=%d, of=0x%08x\n", \
@@ -529,7 +526,9 @@ drm_radeon_cmd_header_t *cmd = NULL;
if(OutputsWritten & (1<<VERT_RESULT_BFC1))
r300->hw.vof.cmd[R300_VOF_CNTL_0] |= R300_VAP_OUTPUT_VTX_FMT_0__COLOR_3_PRESENT;*/
//if(OutputsWritten & (1<<VERT_RESULT_FOGC))
//if(OutputsWritten & (1<<VERT_RESULT_PSIZ))
if(OutputsWritten & (1<<VERT_RESULT_PSIZ))
r300->hw.vof.cmd[R300_VOF_CNTL_0] |= R300_VAP_OUTPUT_VTX_FMT_0__PT_SIZE_PRESENT;
for(i=0;i < ctx->Const.MaxTextureUnits;i++)
if(OutputsWritten & (1<<(VERT_RESULT_TEX0+i)))
@@ -539,6 +538,8 @@ drm_radeon_cmd_header_t *cmd = NULL;
r300->hw.vof.cmd[R300_VOF_CNTL_0] |= R300_VAP_OUTPUT_VTX_FMT_0__POS_PRESENT;
if(inputs & _TNL_BIT_COLOR0)
r300->hw.vof.cmd[R300_VOF_CNTL_0] |= R300_VAP_OUTPUT_VTX_FMT_0__COLOR_PRESENT;
if(inputs & _TNL_BIT_COLOR1)
r300->hw.vof.cmd[R300_VOF_CNTL_0] |= R300_VAP_OUTPUT_VTX_FMT_0__COLOR_1_PRESENT;
for(i=0;i < ctx->Const.MaxTextureUnits;i++)
if(inputs & (_TNL_BIT_TEX0<<i))

View File

@@ -124,6 +124,10 @@ I am fairly certain that they are correct unless stated otherwise in comments.
#define R300_VAP_INPUT_ROUTE_0_1 0x2154
#define R300_VAP_INPUT_ROUTE_0_2 0x2158
#define R300_VAP_INPUT_ROUTE_0_3 0x215C
#define R300_VAP_INPUT_ROUTE_0_4 0x2160
#define R300_VAP_INPUT_ROUTE_0_5 0x2164
#define R300_VAP_INPUT_ROUTE_0_6 0x2168
#define R300_VAP_INPUT_ROUTE_0_7 0x216C
/* gap */
/* Notes:
@@ -168,6 +172,10 @@ I am fairly certain that they are correct unless stated otherwise in comments.
#define R300_VAP_INPUT_ROUTE_1_1 0x21E4
#define R300_VAP_INPUT_ROUTE_1_2 0x21E8
#define R300_VAP_INPUT_ROUTE_1_3 0x21EC
#define R300_VAP_INPUT_ROUTE_1_4 0x21F0
#define R300_VAP_INPUT_ROUTE_1_5 0x21F4
#define R300_VAP_INPUT_ROUTE_1_6 0x21F8
#define R300_VAP_INPUT_ROUTE_1_7 0x21FC
/* END */
@@ -494,7 +502,7 @@ I am fairly certain that they are correct unless stated otherwise in comments.
#define R300_RS_CNTL_0 0x4300
# define R300_RS_CNTL_TC_CNT_SHIFT 2
# define R300_RS_CNTL_TC_CNT_MASK (7 << 2)
# define R300_RS_CNTL_0_UNKNOWN_7 (1 << 7) /* Number of color interpolators used (shifted by 7) */
# define R300_RS_CNTL_CI_CNT_SHIFT 7 /* number of color interpolators used */
# define R300_RS_CNTL_0_UNKNOWN_18 (1 << 18)
/* Guess: RS_CNTL_1 holds the index of the highest used RS_ROUTE_n register. */
#define R300_RS_CNTL_1 0x4304
@@ -554,6 +562,11 @@ I am fairly certain that they are correct unless stated otherwise in comments.
# define R300_RS_ROUTE_0_COLOR (1 << 14)
# define R300_RS_ROUTE_0_COLOR_DEST_SHIFT 17
# define R300_RS_ROUTE_0_COLOR_DEST_MASK (31 << 17) /* GUESS */
/* As above, but for secondary color */
# define R300_RS_ROUTE_1_COLOR1 (1 << 14)
# define R300_RS_ROUTE_1_COLOR1_DEST_SHIFT 17
# define R300_RS_ROUTE_1_COLOR1_DEST_MASK (31 << 17)
# define R300_RS_ROUTE_1_UNKNOWN11 (1 << 11)
/* END */
/* BEGIN: Scissors and cliprects

View File

@@ -66,11 +66,8 @@ static struct program *r300NewProgram(GLcontext *ctx, GLenum target, GLuint id)
static void r300DeleteProgram(GLcontext *ctx, struct program *prog)
{
r300ContextPtr rmesa = R300_CONTEXT(ctx);
struct r300_vertex_program *vp=(void *)prog;
/*if(rmesa->current_vp == vp)
rmesa->current_vp = NULL;*/
//r300ContextPtr rmesa = R300_CONTEXT(ctx);
//struct r300_vertex_program *vp=(void *)prog;
_mesa_delete_program(ctx, prog);
}
@@ -99,8 +96,8 @@ void r300ProgramStringNotify(GLcontext *ctx, GLenum target,
static GLboolean r300IsProgramNative(GLcontext *ctx, GLenum target, struct program *prog)
{
struct r300_vertex_program *vp=(void *)prog;
r300ContextPtr rmesa = R300_CONTEXT(ctx);
//struct r300_vertex_program *vp=(void *)prog;
//r300ContextPtr rmesa = R300_CONTEXT(ctx);
return 1;
}

View File

@@ -1030,8 +1030,6 @@ void r300_setup_textures(GLcontext *ctx)
R300_STATECHANGE(r300, tex.unknown4);
R300_STATECHANGE(r300, tex.border_color);
r300->state.texture.tc_count=0;
r300->hw.txe.cmd[R300_TXE_ENABLE]=0x0;
mtu = r300->radeon.glCtx->Const.MaxTextureUnits;
@@ -1053,7 +1051,6 @@ void r300_setup_textures(GLcontext *ctx)
if(TMU_ENABLED(ctx, i)) {
t=r300->state.texture.unit[i].texobj;
//fprintf(stderr, "format=%08x\n", r300->state.texture.unit[i].format);
r300->state.texture.tc_count++;
if(t == NULL){
fprintf(stderr, "Texture unit %d enabled, but corresponding texobj is NULL, using default object.\n", i);
@@ -1102,7 +1099,6 @@ void r300_setup_textures(GLcontext *ctx)
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,
@@ -1116,7 +1112,10 @@ void r300_setup_rs_unit(GLcontext *ctx)
};
GLuint OutputsWritten;
GLuint InputsRead;
int vp_reg, fp_reg, high_rr;
int in_texcoords, col_interp_nr;
int i;
if(hw_tcl_on)
OutputsWritten = CURRENT_VERTEX_SHADER(ctx)->OutputsWritten;
else
@@ -1128,13 +1127,14 @@ void r300_setup_rs_unit(GLcontext *ctx)
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;
vp_reg = fp_reg = in_texcoords = col_interp_nr = high_rr = 0;
r300->hw.rr.cmd[R300_RR_ROUTE_0] = 0;
r300->hw.rr.cmd[R300_RR_ROUTE_1] = 0;
for (i=0;i<ctx->Const.MaxTextureUnits;i++) {
if (OutputsWritten & (hw_tcl_on ? (1 << (VERT_RESULT_TEX0+i)) : (_TNL_BIT_TEX0<<i)))
@@ -1151,7 +1151,8 @@ void r300_setup_rs_unit(GLcontext *ctx)
| R300_RS_ROUTE_ENABLE
| i /* source INTERP */
| (fp_reg << R300_RS_ROUTE_DEST_SHIFT);
high_rr = fp_reg;
if (OutputsWritten & (hw_tcl_on ? (1 << (VERT_RESULT_TEX0+i)) : (_TNL_BIT_TEX0<<i))) {
vp_reg++;
} else {
@@ -1168,24 +1169,34 @@ void r300_setup_rs_unit(GLcontext *ctx)
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);
| (fp_reg++ << R300_RS_ROUTE_0_COLOR_DEST_SHIFT);
InputsRead &= ~FRAG_BIT_COL0;
col_interp_nr++;
}
if (InputsRead & FRAG_BIT_COL1) {
if (!(OutputsWritten & (hw_tcl_on ? (1<<VERT_RESULT_COL1) : _TNL_BIT_COLOR1)))
fprintf(stderr, "fragprog wants col1, vp doesn't provide it\n");
r300->hw.rr.cmd[R300_RR_ROUTE_1] |= R300_RS_ROUTE_1_UNKNOWN11
| R300_RS_ROUTE_1_COLOR1
| (fp_reg++ << R300_RS_ROUTE_1_COLOR1_DEST_SHIFT);
InputsRead &= ~FRAG_BIT_COL1;
if (high_rr < 1) high_rr = 1;
col_interp_nr++;
}
r300->hw.rc.cmd[1] = 0
| (in_texcoords << R300_RS_CNTL_TC_CNT_SHIFT)
| R300_RS_CNTL_0_UNKNOWN_7
| (col_interp_nr << R300_RS_CNTL_CI_CNT_SHIFT)
| 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;
}
assert(high_rr >= 0);
r300->hw.rr.cmd[R300_RR_CMD_0] = cmducs(R300_RS_ROUTE_0, high_rr+1);
r300->hw.rc.cmd[2] = 0xC0 | high_rr;
if (InputsRead)
WARN_ONCE("Don't know how to satisfy InputsRead=0x%08x\n", InputsRead);
@@ -1387,7 +1398,16 @@ void r300GenerateSimpleVertexShader(r300ContextPtr r300)
VSF_TMP(0)
)
o_reg += 2;
if (r300->state.render_inputs & _TNL_BIT_COLOR1) {
WRITE_OP(
EASY_VSF_OP(MUL, o_reg++, ALL, RESULT),
VSF_REG(r300->state.vap_reg.i_color[1]),
VSF_ATTR_UNITY(r300->state.vap_reg.i_color[1]),
VSF_UNITY(r300->state.vap_reg.i_color[1])
)
}
/* Pass through texture coordinates, if any */
for(i=0;i < r300->radeon.glCtx->Const.MaxTextureUnits;i++)
if(r300->state.render_inputs & (_TNL_BIT_TEX0<<i)){

View File

@@ -313,42 +313,14 @@ static unsigned long t_dst_class(enum register_file file)
static unsigned long t_dst_index(struct r300_vertex_program *vp, struct vp_dst_register *dst)
{
int i, high=0;
if(dst->File == PROGRAM_OUTPUT)
switch(dst->Index){
case VERT_RESULT_HPOS:
return 0;
case VERT_RESULT_COL0:
return 1;
case VERT_RESULT_TEX0:
case VERT_RESULT_TEX1:
case VERT_RESULT_TEX2:
case VERT_RESULT_TEX3:
case VERT_RESULT_TEX4:
case VERT_RESULT_TEX5:
case VERT_RESULT_TEX6:
case VERT_RESULT_TEX7:
/* Awful hack to get tex coord results regs correctly packed.
Wount work if tex coords arent written in logical order! */
if(vp->tex_regs[dst->Index - VERT_RESULT_TEX0] != 1){
return vp->tex_regs[dst->Index - VERT_RESULT_TEX0];
}
for(i=0; i < 8; i++)
if(vp->tex_regs[i] > high)
high = vp->tex_regs[i];
high++;
vp->tex_regs[dst->Index - VERT_RESULT_TEX0] = high;
return high;
case VERT_RESULT_COL1:
case VERT_RESULT_BFC0:
case VERT_RESULT_BFC1:
case VERT_RESULT_FOGC:
case VERT_RESULT_PSIZ:
default: WARN_ONCE("Unknown output\n"); return 10;
if(dst->File == PROGRAM_OUTPUT) {
if (vp->outputs[dst->Index] != -1)
return vp->outputs[dst->Index];
else {
WARN_ONCE("Unknown output %d\n", dst->Index);
return 10;
}
}
return dst->Index;
}
@@ -509,8 +481,7 @@ void translate_vertex_shader(struct r300_vertex_program *vp)
{
struct vertex_program *mesa_vp=(void *)vp;
struct vp_instruction *vpi;
int operand_index, i;
VERTEX_SHADER_INSTRUCTION t2rs[1024];
int i, cur_reg=0;
VERTEX_SHADER_INSTRUCTION *o_inst;
unsigned long operands;
int are_srcs_scalar;
@@ -527,11 +498,43 @@ void translate_vertex_shader(struct r300_vertex_program *vp)
vp->pos_end=0; /* Not supported yet */
vp->program.length=0;
vp->num_temporaries=mesa_vp->Base.NumTemporaries;
for(i=0; i < 8; i++)
vp->tex_regs[i]=1;
for(i=0; i < VERT_ATTRIB_MAX; i++)
vp->inputs[i]=-1;
vp->inputs[i] = -1;
for(i=0; i < VERT_RESULT_MAX; i++)
vp->outputs[i] = -1;
assert(mesa_vp->OutputsWritten & (1 << VERT_RESULT_HPOS));
assert(mesa_vp->OutputsWritten & (1 << VERT_RESULT_COL0));
/* Assign outputs */
if(mesa_vp->OutputsWritten & (1 << VERT_RESULT_HPOS))
vp->outputs[VERT_RESULT_HPOS] = cur_reg++;
if(mesa_vp->OutputsWritten & (1 << VERT_RESULT_PSIZ))
vp->outputs[VERT_RESULT_PSIZ] = cur_reg++;
if(mesa_vp->OutputsWritten & (1 << VERT_RESULT_COL0))
vp->outputs[VERT_RESULT_COL0] = cur_reg++;
#if 0 /* Not supported yet */
if(mesa_vp->OutputsWritten & (1 << VERT_RESULT_BFC0))
vp->outputs[VERT_RESULT_BFC0] = cur_reg++;
if(mesa_vp->OutputsWritten & (1 << VERT_RESULT_COL1))
vp->outputs[VERT_RESULT_COL1] = cur_reg++;
if(mesa_vp->OutputsWritten & (1 << VERT_RESULT_BFC1))
vp->outputs[VERT_RESULT_BFC1] = cur_reg++;
if(mesa_vp->OutputsWritten & (1 << VERT_RESULT_FOGC))
vp->outputs[VERT_RESULT_FOGC] = cur_reg++;
#endif
for(i=VERT_RESULT_TEX0; i <= VERT_RESULT_TEX7; i++)
if(mesa_vp->OutputsWritten & (1 << i))
vp->outputs[i] = cur_reg++;
o_inst=vp->program.body.i;
for(vpi=mesa_vp->Instructions; vpi->Opcode != VP_OPCODE_END; vpi++, o_inst++){

View File

@@ -63,7 +63,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "radeon_vtxfmt.h"
#include "radeon_maos.h"
#define DRIVER_DATE "20041207"
#define DRIVER_DATE "20050528"
#include "vblank.h"
#include "utils.h"

View File

@@ -38,6 +38,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#ifndef __RADEON_CONTEXT_H__
#define __RADEON_CONTEXT_H__
#include "tnl/t_vertex.h"
#include "dri_util.h"
#include "drm.h"
#include "radeon_drm.h"
@@ -530,12 +531,13 @@ struct radeon_tcl_info {
/* radeon_swtcl.c
*/
struct radeon_swtcl_info {
GLuint SetupIndex;
GLuint SetupNewInputs;
GLuint RenderIndex;
GLuint vertex_size;
GLuint vertex_stride_shift;
GLuint vertex_format;
struct tnl_attr_map vertex_attrs[VERT_ATTRIB_MAX];
GLuint vertex_attr_count;
GLubyte *verts;
/* Fallback rasterization functions
@@ -548,6 +550,18 @@ struct radeon_swtcl_info {
GLenum render_primitive;
GLuint numverts;
/**
* Offset of the 4UB color data within a hardware (swtcl) vertex.
*/
GLuint coloroffset;
/**
* Offset of the 3UB specular color data within a hardware (swtcl) vertex.
*/
GLuint specoffset;
GLboolean needproj;
struct radeon_dma_region indexed_verts;
};
@@ -707,6 +721,7 @@ struct radeon_context {
GLuint TclFallback;
GLuint Fallback;
GLuint NewGLState;
GLuint tnl_index; /* index of bits for last tnl_install_attrs */
/* Vertex buffers
*/

View File

@@ -53,224 +53,175 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "radeon_swtcl.h"
#include "radeon_tcl.h"
/***********************************************************************
* Build render functions from dd templates *
***********************************************************************/
#define RADEON_XYZW_BIT 0x01
#define RADEON_RGBA_BIT 0x02
#define RADEON_SPEC_BIT 0x04
#define RADEON_TEX0_BIT 0x08
#define RADEON_TEX1_BIT 0x10
#define RADEON_PTEX_BIT 0x20
#define RADEON_MAX_SETUP 0x40
static void flush_last_swtcl_prim( radeonContextPtr rmesa );
static struct {
void (*emit)( GLcontext *, GLuint, GLuint, void *, GLuint );
tnl_interp_func interp;
tnl_copy_pv_func copy_pv;
GLboolean (*check_tex_sizes)( GLcontext *ctx );
GLuint vertex_size;
GLuint vertex_format;
} setup_tab[RADEON_MAX_SETUP];
#define TINY_VERTEX_FORMAT (RADEON_CP_VC_FRMT_XY | \
RADEON_CP_VC_FRMT_Z | \
RADEON_CP_VC_FRMT_PKCOLOR)
#define NOTEX_VERTEX_FORMAT (RADEON_CP_VC_FRMT_XY | \
RADEON_CP_VC_FRMT_Z | \
RADEON_CP_VC_FRMT_W0 | \
RADEON_CP_VC_FRMT_PKCOLOR | \
RADEON_CP_VC_FRMT_PKSPEC)
#define TEX0_VERTEX_FORMAT (RADEON_CP_VC_FRMT_XY | \
RADEON_CP_VC_FRMT_Z | \
RADEON_CP_VC_FRMT_W0 | \
RADEON_CP_VC_FRMT_PKCOLOR | \
RADEON_CP_VC_FRMT_PKSPEC | \
RADEON_CP_VC_FRMT_ST0)
#define TEX1_VERTEX_FORMAT (RADEON_CP_VC_FRMT_XY | \
RADEON_CP_VC_FRMT_Z | \
RADEON_CP_VC_FRMT_W0 | \
RADEON_CP_VC_FRMT_PKCOLOR | \
RADEON_CP_VC_FRMT_PKSPEC | \
RADEON_CP_VC_FRMT_ST0 | \
RADEON_CP_VC_FRMT_ST1)
#define PROJ_TEX1_VERTEX_FORMAT (RADEON_CP_VC_FRMT_XY | \
RADEON_CP_VC_FRMT_Z | \
RADEON_CP_VC_FRMT_W0 | \
RADEON_CP_VC_FRMT_PKCOLOR | \
RADEON_CP_VC_FRMT_PKSPEC | \
RADEON_CP_VC_FRMT_ST0 | \
RADEON_CP_VC_FRMT_Q0 | \
RADEON_CP_VC_FRMT_ST1 | \
RADEON_CP_VC_FRMT_Q1)
#define TEX2_VERTEX_FORMAT 0
#define TEX3_VERTEX_FORMAT 0
#define PROJ_TEX3_VERTEX_FORMAT 0
#define DO_XYZW (IND & RADEON_XYZW_BIT)
#define DO_RGBA (IND & RADEON_RGBA_BIT)
#define DO_SPEC (IND & RADEON_SPEC_BIT)
#define DO_FOG (IND & RADEON_SPEC_BIT)
#define DO_TEX0 (IND & RADEON_TEX0_BIT)
#define DO_TEX1 (IND & RADEON_TEX1_BIT)
#define DO_TEX2 0
#define DO_TEX3 0
#define DO_PTEX (IND & RADEON_PTEX_BIT)
#define VERTEX radeonVertex
#define VERTEX_COLOR radeon_color_t
#define GET_VIEWPORT_MAT() 0
#define GET_TEXSOURCE(n) n
#define GET_VERTEX_FORMAT() RADEON_CONTEXT(ctx)->swtcl.vertex_format
#define GET_VERTEX_STORE() RADEON_CONTEXT(ctx)->swtcl.verts
#define GET_VERTEX_SIZE() RADEON_CONTEXT(ctx)->swtcl.vertex_size * sizeof(GLuint)
#define HAVE_HW_VIEWPORT 1
/* Tiny vertices don't seem to work atm - haven't looked into why.
*/
#define HAVE_HW_DIVIDE (IND & ~(RADEON_XYZW_BIT|RADEON_RGBA_BIT))
#define HAVE_TINY_VERTICES 1
#define HAVE_RGBA_COLOR 1
#define HAVE_NOTEX_VERTICES 1
#define HAVE_TEX0_VERTICES 1
#define HAVE_TEX1_VERTICES 1
#define HAVE_TEX2_VERTICES 0
#define HAVE_TEX3_VERTICES 0
#define HAVE_PTEX_VERTICES 1
#define CHECK_HW_DIVIDE (!(ctx->_TriangleCaps & (DD_TRI_LIGHT_TWOSIDE| \
DD_TRI_UNFILLED)))
#define INTERP_VERTEX setup_tab[RADEON_CONTEXT(ctx)->swtcl.SetupIndex].interp
#define COPY_PV_VERTEX setup_tab[RADEON_CONTEXT(ctx)->swtcl.SetupIndex].copy_pv
/***********************************************************************
* Generate pv-copying and translation functions *
***********************************************************************/
#define TAG(x) radeon_##x
#define IND ~0
#include "tnl_dd/t_dd_vb.c"
#undef IND
/***********************************************************************
* Generate vertex emit and interp functions *
***********************************************************************/
#define IND (RADEON_XYZW_BIT|RADEON_RGBA_BIT)
#define TAG(x) x##_wg
#include "tnl_dd/t_dd_vbtmp.h"
#define IND (RADEON_XYZW_BIT|RADEON_RGBA_BIT|RADEON_TEX0_BIT)
#define TAG(x) x##_wgt0
#include "tnl_dd/t_dd_vbtmp.h"
#define IND (RADEON_XYZW_BIT|RADEON_RGBA_BIT|RADEON_TEX0_BIT|RADEON_PTEX_BIT)
#define TAG(x) x##_wgpt0
#include "tnl_dd/t_dd_vbtmp.h"
#define IND (RADEON_XYZW_BIT|RADEON_RGBA_BIT|RADEON_TEX0_BIT|RADEON_TEX1_BIT)
#define TAG(x) x##_wgt0t1
#include "tnl_dd/t_dd_vbtmp.h"
#define IND (RADEON_XYZW_BIT|RADEON_RGBA_BIT|RADEON_TEX0_BIT|RADEON_TEX1_BIT|\
RADEON_PTEX_BIT)
#define TAG(x) x##_wgpt0t1
#include "tnl_dd/t_dd_vbtmp.h"
#define IND (RADEON_XYZW_BIT|RADEON_RGBA_BIT|RADEON_SPEC_BIT)
#define TAG(x) x##_wgfs
#include "tnl_dd/t_dd_vbtmp.h"
#define IND (RADEON_XYZW_BIT|RADEON_RGBA_BIT|RADEON_SPEC_BIT|\
RADEON_TEX0_BIT)
#define TAG(x) x##_wgfst0
#include "tnl_dd/t_dd_vbtmp.h"
#define IND (RADEON_XYZW_BIT|RADEON_RGBA_BIT|RADEON_SPEC_BIT|\
RADEON_TEX0_BIT|RADEON_PTEX_BIT)
#define TAG(x) x##_wgfspt0
#include "tnl_dd/t_dd_vbtmp.h"
#define IND (RADEON_XYZW_BIT|RADEON_RGBA_BIT|RADEON_SPEC_BIT|\
RADEON_TEX0_BIT|RADEON_TEX1_BIT)
#define TAG(x) x##_wgfst0t1
#include "tnl_dd/t_dd_vbtmp.h"
#define IND (RADEON_XYZW_BIT|RADEON_RGBA_BIT|RADEON_SPEC_BIT|\
RADEON_TEX0_BIT|RADEON_TEX1_BIT|RADEON_PTEX_BIT)
#define TAG(x) x##_wgfspt0t1
#include "tnl_dd/t_dd_vbtmp.h"
/* R100: xyzw, c0, c1/fog, stq[0..2] = 4+1+1+3*3 = 15 right? */
/* R200: xyzw, c0, c1/fog, strq[0..5] = 4+1+1+4*6 = 30 */
#define RADEON_MAX_TNL_VERTEX_SIZE (15 * sizeof(GLfloat)) /* for mesa _tnl stage */
/***********************************************************************
* Initialization
***********************************************************************/
static void init_setup_tab( void )
#define EMIT_ATTR( ATTR, STYLE, F0 ) \
do { \
rmesa->swtcl.vertex_attrs[rmesa->swtcl.vertex_attr_count].attrib = (ATTR); \
rmesa->swtcl.vertex_attrs[rmesa->swtcl.vertex_attr_count].format = (STYLE); \
rmesa->swtcl.vertex_attr_count++; \
fmt_0 |= F0; \
} while (0)
#define EMIT_PAD( N ) \
do { \
rmesa->swtcl.vertex_attrs[rmesa->swtcl.vertex_attr_count].attrib = 0; \
rmesa->swtcl.vertex_attrs[rmesa->swtcl.vertex_attr_count].format = EMIT_PAD; \
rmesa->swtcl.vertex_attrs[rmesa->swtcl.vertex_attr_count].offset = (N); \
rmesa->swtcl.vertex_attr_count++; \
} while (0)
static GLuint radeon_cp_vc_frmts[3][2] =
{
init_wg();
init_wgt0();
init_wgpt0();
init_wgt0t1();
init_wgpt0t1();
init_wgfs();
init_wgfst0();
init_wgfspt0();
init_wgfst0t1();
init_wgfspt0t1();
}
{ RADEON_CP_VC_FRMT_ST0, RADEON_CP_VC_FRMT_ST0 | RADEON_CP_VC_FRMT_Q0 },
{ RADEON_CP_VC_FRMT_ST1, RADEON_CP_VC_FRMT_ST1 | RADEON_CP_VC_FRMT_Q1 },
{ RADEON_CP_VC_FRMT_ST2, RADEON_CP_VC_FRMT_ST2 | RADEON_CP_VC_FRMT_Q2 },
};
void radeonPrintSetupFlags(char *msg, GLuint flags )
static void radeonSetVertexFormat( GLcontext *ctx )
{
fprintf(stderr, "%s(%x): %s%s%s%s%s%s\n",
msg,
(int)flags,
(flags & RADEON_XYZW_BIT) ? " xyzw," : "",
(flags & RADEON_RGBA_BIT) ? " rgba," : "",
(flags & RADEON_SPEC_BIT) ? " spec/fog," : "",
(flags & RADEON_TEX0_BIT) ? " tex-0," : "",
(flags & RADEON_TEX1_BIT) ? " tex-1," : "",
(flags & RADEON_PTEX_BIT) ? " proj-tex," : "");
radeonContextPtr rmesa = RADEON_CONTEXT( ctx );
TNLcontext *tnl = TNL_CONTEXT(ctx);
struct vertex_buffer *VB = &tnl->vb;
GLuint index = tnl->render_inputs;
int fmt_0 = 0;
int offset = 0;
/* Important:
*/
if ( VB->NdcPtr != NULL ) {
VB->AttribPtr[VERT_ATTRIB_POS] = VB->NdcPtr;
}
else {
VB->AttribPtr[VERT_ATTRIB_POS] = VB->ClipPtr;
}
assert( VB->AttribPtr[VERT_ATTRIB_POS] != NULL );
rmesa->swtcl.vertex_attr_count = 0;
/* EMIT_ATTR's must be in order as they tell t_vertex.c how to
* build up a hardware vertex.
*/
if ( !rmesa->swtcl.needproj ||
(index & _TNL_BITS_TEX_ANY)) { /* for projtex */
EMIT_ATTR( _TNL_ATTRIB_POS, EMIT_4F,
RADEON_CP_VC_FRMT_XY | RADEON_CP_VC_FRMT_Z | RADEON_CP_VC_FRMT_W0 );
offset = 4;
}
else {
EMIT_ATTR( _TNL_ATTRIB_POS, EMIT_3F,
RADEON_CP_VC_FRMT_XY | RADEON_CP_VC_FRMT_Z );
offset = 3;
}
rmesa->swtcl.coloroffset = offset;
#if MESA_LITTLE_ENDIAN
EMIT_ATTR( _TNL_ATTRIB_COLOR0, EMIT_4UB_4F_RGBA,
RADEON_CP_VC_FRMT_PKCOLOR );
#else
EMIT_ATTR( _TNL_ATTRIB_COLOR0, EMIT_4UB_4F_ABGR,
RADEON_CP_VC_FRMT_PKCOLOR );
#endif
offset += 1;
rmesa->swtcl.specoffset = 0;
if (index & (_TNL_BIT_COLOR1|_TNL_BIT_FOG)) {
#if MESA_LITTLE_ENDIAN
if (index & _TNL_BIT_COLOR1) {
rmesa->swtcl.specoffset = offset;
EMIT_ATTR( _TNL_ATTRIB_COLOR1, EMIT_3UB_3F_RGB,
RADEON_CP_VC_FRMT_PKSPEC );
}
else {
EMIT_PAD( 3 );
}
if (index & _TNL_BIT_FOG) {
EMIT_ATTR( _TNL_ATTRIB_FOG, EMIT_1UB_1F,
RADEON_CP_VC_FRMT_PKSPEC );
}
else {
EMIT_PAD( 1 );
}
#else
if (index & _TNL_BIT_FOG) {
EMIT_ATTR( _TNL_ATTRIB_FOG, EMIT_1UB_1F,
RADEON_CP_VC_FRMT_PKSPEC );
}
else {
EMIT_PAD( 1 );
}
if (index & _TNL_BIT_COLOR1) {
rmesa->swtcl.specoffset = offset;
EMIT_ATTR( _TNL_ATTRIB_COLOR1, EMIT_3UB_3F_BGR,
RADEON_CP_VC_FRMT_PKSPEC );
}
else {
EMIT_PAD( 3 );
}
#endif
}
if (index & _TNL_BITS_TEX_ANY) {
int i;
for (i = 0; i < ctx->Const.MaxTextureUnits; i++) {
if (index & _TNL_BIT_TEX(i)) {
GLuint sz = VB->TexCoordPtr[i]->size;
switch (sz) {
case 1:
case 2:
case 3:
EMIT_ATTR( _TNL_ATTRIB_TEX0+i, EMIT_2F,
radeon_cp_vc_frmts[i][0] );
break;
case 4:
EMIT_ATTR( _TNL_ATTRIB_TEX0+i, EMIT_3F_XYW,
radeon_cp_vc_frmts[i][1] );
break;
default:
continue;
};
}
}
}
if ( rmesa->tnl_index != index ||
fmt_0 != rmesa->swtcl.vertex_format) {
RADEON_NEWPRIM(rmesa);
rmesa->swtcl.vertex_format = fmt_0;
rmesa->swtcl.vertex_size =
_tnl_install_attrs( ctx,
rmesa->swtcl.vertex_attrs,
rmesa->swtcl.vertex_attr_count,
NULL, 0 );
rmesa->swtcl.vertex_size /= 4;
rmesa->tnl_index = index;
if (RADEON_DEBUG & DEBUG_VERTS)
fprintf( stderr, "%s: vertex_size= %d floats\n",
__FUNCTION__, rmesa->swtcl.vertex_size);
}
}
static void radeonRenderStart( GLcontext *ctx )
{
TNLcontext *tnl = TNL_CONTEXT(ctx);
radeonContextPtr rmesa = RADEON_CONTEXT( ctx );
if (!setup_tab[rmesa->swtcl.SetupIndex].check_tex_sizes(ctx)) {
GLuint ind = rmesa->swtcl.SetupIndex |= (RADEON_PTEX_BIT|RADEON_RGBA_BIT);
/* Projective textures are handled nicely; just have to change
* up to the new vertex format.
*/
if (setup_tab[ind].vertex_format != rmesa->swtcl.vertex_format) {
RADEON_NEWPRIM(rmesa);
rmesa->swtcl.vertex_format = setup_tab[ind].vertex_format;
rmesa->swtcl.vertex_size = setup_tab[ind].vertex_size;
}
if (!(ctx->_TriangleCaps & (DD_TRI_LIGHT_TWOSIDE|DD_TRI_UNFILLED))) {
tnl->Driver.Render.Interp = setup_tab[rmesa->swtcl.SetupIndex].interp;
tnl->Driver.Render.CopyPV = setup_tab[rmesa->swtcl.SetupIndex].copy_pv;
}
}
radeonSetVertexFormat( ctx );
if (rmesa->dma.flush != 0 &&
rmesa->dma.flush != flush_last_swtcl_prim)
@@ -278,82 +229,40 @@ static void radeonRenderStart( GLcontext *ctx )
}
void radeonBuildVertices( GLcontext *ctx, GLuint start, GLuint count,
GLuint newinputs )
{
radeonContextPtr rmesa = RADEON_CONTEXT( ctx );
GLuint stride = rmesa->swtcl.vertex_size * sizeof(int);
GLubyte *v = ((GLubyte *)rmesa->swtcl.verts + (start * stride));
newinputs |= rmesa->swtcl.SetupNewInputs;
rmesa->swtcl.SetupNewInputs = 0;
if (!newinputs)
return;
setup_tab[rmesa->swtcl.SetupIndex].emit( ctx, start, count, v, stride );
}
/**
* Set vertex state for SW TCL. The primary purpose of this function is to
* determine in advance whether or not the hardware can / should do the
* projection divide or Mesa should do it.
*/
void radeonChooseVertexState( GLcontext *ctx )
{
radeonContextPtr rmesa = RADEON_CONTEXT( ctx );
TNLcontext *tnl = TNL_CONTEXT(ctx);
GLuint ind = (RADEON_XYZW_BIT | RADEON_RGBA_BIT);
if (!rmesa->TclFallback || rmesa->Fallback)
return;
GLuint se_coord_fmt;
if (ctx->Fog.Enabled || (ctx->_TriangleCaps & DD_SEPARATE_SPECULAR))
ind |= RADEON_SPEC_BIT;
/* HW perspective divide is a win, but tiny vertex formats are a
* bigger one.
*/
if (ctx->Texture._EnabledUnits & 0x2)
/* unit 1 enabled */
ind |= RADEON_TEX0_BIT|RADEON_TEX1_BIT;
else if (ctx->Texture._EnabledUnits & 0x1)
/* unit 0 enabled */
ind |= RADEON_TEX0_BIT;
rmesa->swtcl.SetupIndex = ind;
if (ctx->_TriangleCaps & (DD_TRI_LIGHT_TWOSIDE|DD_TRI_UNFILLED)) {
tnl->Driver.Render.Interp = radeon_interp_extras;
tnl->Driver.Render.CopyPV = radeon_copy_pv_extras;
if ( ((tnl->render_inputs & (_TNL_BITS_TEX_ANY|_TNL_BIT_COLOR1) ) == 0)
|| (ctx->_TriangleCaps & (DD_TRI_LIGHT_TWOSIDE|DD_TRI_UNFILLED))) {
rmesa->swtcl.needproj = GL_TRUE;
se_coord_fmt = (RADEON_VTX_XY_PRE_MULT_1_OVER_W0 |
RADEON_VTX_Z_PRE_MULT_1_OVER_W0 |
RADEON_TEX1_W_ROUTING_USE_Q1);
}
else {
tnl->Driver.Render.Interp = setup_tab[ind].interp;
tnl->Driver.Render.CopyPV = setup_tab[ind].copy_pv;
rmesa->swtcl.needproj = GL_FALSE;
se_coord_fmt = (RADEON_VTX_W0_IS_NOT_1_OVER_W0 |
RADEON_TEX1_W_ROUTING_USE_Q1);
}
if (setup_tab[ind].vertex_format != rmesa->swtcl.vertex_format) {
RADEON_NEWPRIM(rmesa);
rmesa->swtcl.vertex_format = setup_tab[ind].vertex_format;
rmesa->swtcl.vertex_size = setup_tab[ind].vertex_size;
}
_tnl_need_projected_coords( ctx, rmesa->swtcl.needproj );
{
GLuint se_coord_fmt, needproj;
/* HW perspective divide is a win, but tiny vertex formats are a
* bigger one.
*/
if (setup_tab[ind].vertex_format == TINY_VERTEX_FORMAT ||
(ctx->_TriangleCaps & (DD_TRI_LIGHT_TWOSIDE|DD_TRI_UNFILLED))) {
needproj = GL_TRUE;
se_coord_fmt = (RADEON_VTX_XY_PRE_MULT_1_OVER_W0 |
RADEON_VTX_Z_PRE_MULT_1_OVER_W0 |
RADEON_TEX1_W_ROUTING_USE_Q1);
}
else {
needproj = GL_FALSE;
se_coord_fmt = (RADEON_VTX_W0_IS_NOT_1_OVER_W0 |
RADEON_TEX1_W_ROUTING_USE_Q1);
}
if ( se_coord_fmt != rmesa->hw.set.cmd[SET_SE_COORDFMT] ) {
RADEON_STATECHANGE( rmesa, set );
rmesa->hw.set.cmd[SET_SE_COORDFMT] = se_coord_fmt;
}
_tnl_need_projected_coords( ctx, needproj );
if ( se_coord_fmt != rmesa->hw.set.cmd[SET_SE_COORDFMT] ) {
RADEON_STATECHANGE( rmesa, set );
rmesa->hw.set.cmd[SET_SE_COORDFMT] = se_coord_fmt;
}
}
@@ -382,6 +291,7 @@ static void flush_last_swtcl_prim( radeonContextPtr rmesa )
if (rmesa->dma.current.start != rmesa->dma.current.ptr) {
radeonEnsureCmdBufSpace( rmesa, VERT_AOS_BUFSZ +
rmesa->hw.max_state_size + VBUF_BUFSZ );
radeonEmitVertexAOS( rmesa,
rmesa->swtcl.vertex_size,
current_offset);
@@ -430,38 +340,6 @@ static __inline void *radeonAllocDmaLowVerts( radeonContextPtr rmesa,
}
static void *radeon_emit_contiguous_verts( GLcontext *ctx,
GLuint start,
GLuint count,
void *dest)
{
radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
GLuint stride = rmesa->swtcl.vertex_size * 4;
setup_tab[rmesa->swtcl.SetupIndex].emit( ctx, start, count, dest, stride );
return (void *)((char *)dest + stride * (count - start));
}
void radeon_emit_indexed_verts( GLcontext *ctx, GLuint start, GLuint count )
{
radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
radeonAllocDmaRegionVerts( rmesa,
&rmesa->swtcl.indexed_verts,
count - start,
rmesa->swtcl.vertex_size * 4,
64);
setup_tab[rmesa->swtcl.SetupIndex].emit(
ctx, start, count,
rmesa->swtcl.indexed_verts.address + rmesa->swtcl.indexed_verts.start,
rmesa->swtcl.vertex_size * 4 );
}
/*
* Render unclipped vertex buffers by emitting vertices directly to
* dma buffers. Use strip/fan hardware primitives where possible.
@@ -477,7 +355,8 @@ void radeon_emit_indexed_verts( GLcontext *ctx, GLuint start, GLuint count )
#define HAVE_QUADS 0
#define HAVE_QUAD_STRIPS 0
#define HAVE_POLYGONS 0
#define HAVE_ELTS 1
/* \todo: is it possible to make "ELTS" work with t_vertex code ? */
#define HAVE_ELTS 0
static const GLuint hw_prim[GL_POLYGON+1] = {
RADEON_CP_VC_CNTL_PRIM_TYPE_POINT,
@@ -499,91 +378,17 @@ static __inline void radeonDmaPrimitive( radeonContextPtr rmesa, GLenum prim )
assert(rmesa->dma.current.ptr == rmesa->dma.current.start);
}
static __inline void radeonEltPrimitive( radeonContextPtr rmesa, GLenum prim )
{
RADEON_NEWPRIM( rmesa );
rmesa->swtcl.hw_primitive = hw_prim[prim] | RADEON_CP_VC_CNTL_PRIM_WALK_IND;
}
#define LOCAL_VARS radeonContextPtr rmesa = RADEON_CONTEXT(ctx)
#define ELTS_VARS( buf ) GLushort *dest = buf; (void)rmesa;
#define LOCAL_VARS radeonContextPtr rmesa = RADEON_CONTEXT(ctx); (void)rmesa
#define INIT( prim ) radeonDmaPrimitive( rmesa, prim )
#define ELT_INIT(prim) radeonEltPrimitive( rmesa, prim )
#define FLUSH() RADEON_NEWPRIM( rmesa )
#define GET_CURRENT_VB_MAX_VERTS() \
(((int)rmesa->dma.current.end - (int)rmesa->dma.current.ptr) / (rmesa->swtcl.vertex_size*4))
#define GET_SUBSEQUENT_VB_MAX_VERTS() \
((RADEON_BUFFER_SIZE) / (rmesa->swtcl.vertex_size*4))
#if RADEON_OLD_PACKETS
# define GET_CURRENT_VB_MAX_ELTS() \
((RADEON_CMD_BUF_SZ - (rmesa->store.cmd_used + 24)) / 2)
#else
# define GET_CURRENT_VB_MAX_ELTS() \
((RADEON_CMD_BUF_SZ - (rmesa->store.cmd_used + 16)) / 2)
#endif
#define GET_SUBSEQUENT_VB_MAX_ELTS() \
((RADEON_CMD_BUF_SZ - 1024) / 2)
static void *radeon_alloc_elts( radeonContextPtr rmesa, int nr )
{
if (rmesa->dma.flush == radeonFlushElts &&
rmesa->store.cmd_used + nr*2 < RADEON_CMD_BUF_SZ) {
rmesa->store.cmd_used += nr*2;
return (void *)(rmesa->store.cmd_buf + rmesa->store.cmd_used);
}
else {
if (rmesa->dma.flush) {
rmesa->dma.flush( rmesa );
}
radeonEmitVertexAOS( rmesa,
rmesa->swtcl.vertex_size,
(rmesa->radeonScreen->gart_buffer_offset +
rmesa->swtcl.indexed_verts.buf->buf->idx *
RADEON_BUFFER_SIZE +
rmesa->swtcl.indexed_verts.start));
return (void *) radeonAllocEltsOpenEnded( rmesa,
rmesa->swtcl.vertex_format,
rmesa->swtcl.hw_primitive,
nr );
}
}
#define ALLOC_ELTS(nr) radeon_alloc_elts(rmesa, nr)
#ifdef MESA_BIG_ENDIAN
/* We could do without (most of) this ugliness if dest was always 32 bit word aligned... */
#define EMIT_ELT(offset, x) do { \
int off = offset + ( ( (GLuint)dest & 0x2 ) >> 1 ); \
GLushort *des = (GLushort *)( (GLuint)dest & ~0x2 ); \
(des)[ off + 1 - 2 * ( off & 1 ) ] = (GLushort)(x); \
(void)rmesa; } while (0)
#else
#define EMIT_ELT(offset, x) do { \
(dest)[offset] = (GLushort) (x); \
(void)rmesa; } while (0)
#endif
#define EMIT_TWO_ELTS(offset, x, y) *(GLuint *)(dest+offset) = ((y)<<16)|(x);
#define INCR_ELTS( nr ) dest += nr
#define ELTPTR dest
#define RELEASE_ELT_VERTS() \
radeonReleaseDmaRegion( rmesa, &rmesa->swtcl.indexed_verts, __FUNCTION__ )
#define EMIT_INDEXED_VERTS( ctx, start, count ) \
radeon_emit_indexed_verts( ctx, start, count )
#define ALLOC_VERTS( nr ) \
radeonAllocDmaLowVerts( rmesa, nr, rmesa->swtcl.vertex_size * 4 )
#define EMIT_VERTS( ctx, j, nr, buf ) \
radeon_emit_contiguous_verts(ctx, j, (j)+(nr), buf)
_tnl_emit_vertices_to_buffer(ctx, j, (j)+(nr), buf)
#define TAG(x) radeon_dma_##x
#include "tnl_dd/t_dd_dmatmp.h"
@@ -612,15 +417,6 @@ static GLboolean radeon_run_render( GLcontext *ctx,
tnl->Driver.Render.Start( ctx );
if (VB->Elts) {
tab = TAG(render_tab_elts);
if (!rmesa->swtcl.indexed_verts.buf) {
if (VB->Count > GET_SUBSEQUENT_VB_MAX_VERTS())
return GL_TRUE;
EMIT_INDEXED_VERTS(ctx, 0, VB->Count);
}
}
for (i = 0 ; i < VB->PrimitiveCount ; i++)
{
GLuint prim = VB->Primitive[i].mode;
@@ -702,7 +498,7 @@ static GLboolean run_texrect_stage( GLcontext *ctx,
in = (GLfloat *)((GLubyte *)in + instride);
}
VB->TexCoordPtr[i] = &store->texcoord[i];
VB->AttribPtr[VERT_ATTRIB_TEX0+i] = VB->TexCoordPtr[i] = &store->texcoord[i];
}
}
@@ -783,14 +579,13 @@ static void radeonResetLineStipple( GLcontext *ctx );
#undef LOCAL_VARS
#undef ALLOC_VERTS
#define CTX_ARG radeonContextPtr rmesa
#define CTX_ARG2 rmesa
#define GET_VERTEX_DWORDS() rmesa->swtcl.vertex_size
#define ALLOC_VERTS( n, size ) radeonAllocDmaLowVerts( rmesa, n, size * 4 )
#define ALLOC_VERTS( n, size ) radeonAllocDmaLowVerts( rmesa, n, (size) * 4 )
#undef LOCAL_VARS
#define LOCAL_VARS \
radeonContextPtr rmesa = RADEON_CONTEXT(ctx); \
const char *radeonverts = (char *)rmesa->swtcl.verts;
#define VERT(x) (radeonVertex *)(radeonverts + (x * vertsize * sizeof(int)))
#define VERT(x) (radeonVertex *)(radeonverts + ((x) * (vertsize) * sizeof(int)))
#define VERTEX radeonVertex
#undef TAG
#define TAG(x) radeon_##x
@@ -847,7 +642,7 @@ static struct {
#define VERT_Y(_v) _v->v.y
#define VERT_Z(_v) _v->v.z
#define AREA_IS_CCW( a ) (a < 0)
#define GET_VERTEX(e) (rmesa->swtcl.verts + (e * rmesa->swtcl.vertex_size * sizeof(int)))
#define GET_VERTEX(e) (rmesa->swtcl.verts + ((e) * rmesa->swtcl.vertex_size * sizeof(int)))
#define VERT_SET_RGBA( v, c ) \
do { \
@@ -860,20 +655,23 @@ 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 (havespec) { \
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]); \
if (specoffset) { \
radeon_color_t *spec = (radeon_color_t *)&((v)->ui[specoffset]); \
UNCLAMPED_FLOAT_TO_UBYTE(spec->red, (c)[0]); \
UNCLAMPED_FLOAT_TO_UBYTE(spec->green, (c)[1]); \
UNCLAMPED_FLOAT_TO_UBYTE(spec->blue, (c)[2]); \
} \
} while (0)
#define VERT_COPY_SPEC( v0, v1 ) \
do { \
if (havespec) { \
v0->v.specular.red = v1->v.specular.red; \
v0->v.specular.green = v1->v.specular.green; \
v0->v.specular.blue = v1->v.specular.blue; \
if (specoffset) { \
radeon_color_t *spec0 = (radeon_color_t *)&((v0)->ui[specoffset]); \
radeon_color_t *spec1 = (radeon_color_t *)&((v1)->ui[specoffset]); \
spec0->red = spec1->red; \
spec0->green = spec1->green; \
spec0->blue = spec1->blue; \
} \
} while (0)
@@ -882,8 +680,8 @@ do { \
*/
#define VERT_SAVE_RGBA( idx ) color[idx] = v[idx]->ui[coloroffset]
#define VERT_RESTORE_RGBA( idx ) v[idx]->ui[coloroffset] = color[idx]
#define VERT_SAVE_SPEC( idx ) if (havespec) spec[idx] = v[idx]->ui[5]
#define VERT_RESTORE_SPEC( idx ) if (havespec) v[idx]->ui[5] = spec[idx]
#define VERT_SAVE_SPEC( idx ) if (specoffset) spec[idx] = v[idx]->ui[specoffset]
#define VERT_RESTORE_SPEC( idx ) if (specoffset) v[idx]->ui[specoffset] = spec[idx]
#undef LOCAL_VARS
#undef TAG
@@ -892,9 +690,9 @@ do { \
#define LOCAL_VARS(n) \
radeonContextPtr rmesa = RADEON_CONTEXT(ctx); \
GLuint color[n], spec[n]; \
GLuint coloroffset = (rmesa->swtcl.vertex_size == 4 ? 3 : 4); \
GLboolean havespec = (rmesa->swtcl.vertex_size > 4); \
(void) color; (void) spec; (void) coloroffset; (void) havespec;
GLuint coloroffset = rmesa->swtcl.coloroffset; \
GLuint specoffset = rmesa->swtcl.specoffset; \
(void) color; (void) spec; (void) coloroffset; (void) specoffset;
/***********************************************************************
* Helpers for rendering unfilled primitives *
@@ -942,7 +740,6 @@ static void init_rast_tab( void )
/* Render unclipped begin/end objects */
/**********************************************************************/
#define VERT(x) (radeonVertex *)(radeonverts + (x * vertsize * sizeof(int)))
#define RENDER_POINTS( start, count ) \
for ( ; start < count ; start++) \
radeon_point( rmesa, VERT(start) )
@@ -1105,7 +902,11 @@ void radeonFallback( GLcontext *ctx, GLuint bit, GLboolean mode )
tnl->Driver.Render.Start = radeonRenderStart;
tnl->Driver.Render.PrimitiveNotify = radeonRenderPrimitive;
tnl->Driver.Render.Finish = radeonRenderFinish;
tnl->Driver.Render.BuildVertices = radeonBuildVertices;
tnl->Driver.Render.BuildVertices = _tnl_build_vertices;
tnl->Driver.Render.CopyPV = _tnl_copy_pv;
tnl->Driver.Render.Interp = _tnl_interp;
tnl->Driver.Render.ResetLineStipple = radeonResetLineStipple;
TCL_FALLBACK( ctx, RADEON_TCL_FALLBACK_RASTER, GL_FALSE );
if (rmesa->TclFallback) {
@@ -1141,12 +942,10 @@ void radeonInitSwtcl( GLcontext *ctx )
{
TNLcontext *tnl = TNL_CONTEXT(ctx);
radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
GLuint size = TNL_CONTEXT(ctx)->vb.Size;
static int firsttime = 1;
if (firsttime) {
init_rast_tab();
init_setup_tab();
firsttime = 0;
}
@@ -1154,9 +953,14 @@ void radeonInitSwtcl( GLcontext *ctx )
tnl->Driver.Render.Finish = radeonRenderFinish;
tnl->Driver.Render.PrimitiveNotify = radeonRenderPrimitive;
tnl->Driver.Render.ResetLineStipple = radeonResetLineStipple;
tnl->Driver.Render.BuildVertices = radeonBuildVertices;
tnl->Driver.Render.BuildVertices = _tnl_build_vertices;
tnl->Driver.Render.CopyPV = _tnl_copy_pv;
tnl->Driver.Render.Interp = _tnl_interp;
rmesa->swtcl.verts = (GLubyte *)ALIGN_MALLOC( size * 16 * 4, 32 );
_tnl_init_vertices( ctx, ctx->Const.MaxArrayLockSize + 12,
RADEON_MAX_TNL_VERTEX_SIZE);
rmesa->swtcl.verts = (GLubyte *)tnl->clipspace.vertex_buf;
rmesa->swtcl.RenderIndex = ~0;
rmesa->swtcl.render_primitive = GL_TRIANGLES;
rmesa->swtcl.hw_primitive = 0;
@@ -1170,10 +974,4 @@ void radeonDestroySwtcl( GLcontext *ctx )
if (rmesa->swtcl.indexed_verts.buf)
radeonReleaseDmaRegion( rmesa, &rmesa->swtcl.indexed_verts,
__FUNCTION__ );
if (rmesa->swtcl.verts) {
ALIGN_FREE(rmesa->swtcl.verts);
rmesa->swtcl.verts = NULL;
}
}

View File

@@ -881,14 +881,16 @@ static GLboolean radeon_validate_texgen( GLcontext *ctx, GLuint unit )
/* Very easy to do this, in fact would remove a fallback case
* elsewhere, but I haven't done it yet... Fallback:
*/
fprintf(stderr, "fallback Q_BIT\n");
if (RADEON_DEBUG & DEBUG_FALLBACKS)
fprintf(stderr, "fallback Q_BIT\n");
return GL_FALSE;
}
else if ((texUnit->TexGenEnabled & (S_BIT|T_BIT)) != (S_BIT|T_BIT) ||
texUnit->GenModeS != texUnit->GenModeT) {
/* Mixed modes, fallback:
*/
/* fprintf(stderr, "fallback mixed texgen\n"); */
if (RADEON_DEBUG & DEBUG_FALLBACKS)
fprintf(stderr, "fallback mixed texgen\n");
return GL_FALSE;
}
else

View File

@@ -305,65 +305,6 @@ void savageDDInitSpanFuncs( GLcontext *ctx )
struct swrast_device_driver *swdd = _swrast_GetDeviceDriverReference(ctx);
swdd->SetBuffer = savageDDSetBuffer;
#if 0
switch (imesa->savageScreen->cpp)
{
case 2: savageInitPointers_565( swdd ); break;
case 4: savageInitPointers_8888( swdd );
}
#endif
switch (imesa->savageScreen->zpp)
{
case 2:
#if 0
if (imesa->float_depth) {
swdd->ReadDepthSpan = savageReadDepthSpan_16f;
swdd->WriteDepthSpan = savageWriteDepthSpan_16f;
swdd->WriteMonoDepthSpan = savageWriteMonoDepthSpan_16f;
swdd->ReadDepthPixels = savageReadDepthPixels_16f;
swdd->WriteDepthPixels = savageWriteDepthPixels_16f;
} else {
swdd->ReadDepthSpan = savageReadDepthSpan_16;
swdd->WriteDepthSpan = savageWriteDepthSpan_16;
swdd->WriteMonoDepthSpan = savageWriteMonoDepthSpan_16;
swdd->ReadDepthPixels = savageReadDepthPixels_16;
swdd->WriteDepthPixels = savageWriteDepthPixels_16;
}
#endif
break;
case 4:
#if 0
if (imesa->float_depth) {
swdd->ReadDepthSpan = savageReadDepthSpan_8_24f;
swdd->WriteDepthSpan = savageWriteDepthSpan_8_24f;
swdd->WriteMonoDepthSpan = savageWriteMonoDepthSpan_8_24f;
swdd->ReadDepthPixels = savageReadDepthPixels_8_24f;
swdd->WriteDepthPixels = savageWriteDepthPixels_8_24f;
} else {
swdd->ReadDepthSpan = savageReadDepthSpan_8_24;
swdd->WriteDepthSpan = savageWriteDepthSpan_8_24;
swdd->WriteMonoDepthSpan = savageWriteMonoDepthSpan_8_24;
swdd->ReadDepthPixels = savageReadDepthPixels_8_24;
swdd->WriteDepthPixels = savageWriteDepthPixels_8_24;
}
swdd->ReadStencilSpan = savageReadStencilSpan_8_24;
swdd->WriteStencilSpan = savageWriteStencilSpan_8_24;
swdd->ReadStencilPixels = savageReadStencilPixels_8_24;
swdd->WriteStencilPixels = savageWriteStencilPixels_8_24;
#endif
break;
}
swdd->WriteCI8Span =NULL;
swdd->WriteCI32Span =NULL;
swdd->WriteMonoCISpan =NULL;
swdd->WriteCI32Pixels =NULL;
swdd->WriteMonoCIPixels =NULL;
swdd->ReadCI32Span =NULL;
swdd->ReadCI32Pixels =NULL;
swdd->SpanRenderStart = savageSpanRenderStart;
/* Pixel path fallbacks.

View File

@@ -98,7 +98,6 @@ static void sisRenderPrimitive( GLcontext *ctx, GLenum prim );
#define HAVE_LINES 1
#define HAVE_POINTS 1
#define CTX_ARG sisContextPtr smesa
#define CTX_ARG2 smesa
#define GET_VERTEX_DWORDS() smesa->vertex_size
#define ALLOC_VERTS( n, size ) sisAllocDmaLow( smesa, n * size * sizeof(int) )
#undef LOCAL_VARS

View File

@@ -62,9 +62,6 @@
#include "utils.h"
PUBLIC const char __driConfigOptions[] = { 0 };
const GLuint __driNConfigOptions = 0;
/**
* Common extension strings exported by all cards
*/
@@ -155,6 +152,14 @@ static const struct tnl_pipeline_stage *tdfx_pipeline[] = {
0,
};
static const struct dri_debug_control debug_control[] =
{
{ "dri", DEBUG_VERBOSE_DRI },
{ "sync", DEBUG_ALWAYS_SYNC },
{ "api", DEBUG_VERBOSE_API },
{ "fall", DEBUG_VERBOSE_FALL },
{ NULL, 0 }
};
GLboolean tdfxCreateContext( const __GLcontextModes *mesaVis,
__DRIcontextPrivate *driContextPriv,
@@ -221,6 +226,10 @@ GLboolean tdfxCreateContext( const __GLcontextModes *mesaVis,
fxMesa->new_state = ~0;
fxMesa->dirty = ~0;
/* Parse configuration files */
driParseConfigFiles (&fxMesa->optionCache, &fxScreen->optionCache,
fxMesa->driScreen->myNum, "tdfx");
/* NOTE: This must be here before any Glide calls! */
if (!tdfxInitGlide( fxMesa )) {
FREE(fxMesa);
@@ -320,6 +329,15 @@ GLboolean tdfxCreateContext( const __GLcontextModes *mesaVis,
tdfxInitVB( ctx );
tdfxInitState( fxMesa );
#if DO_DEBUG
TDFX_DEBUG = driParseDebugString( getenv( "TDFX_DEBUG" ), debug_control );
#endif
if (driQueryOptionb(&fxMesa->optionCache, "no_rast")) {
fprintf(stderr, "disabling 3D acceleration\n");
FALLBACK(fxMesa, TDFX_FALLBACK_DISABLE, 1);
}
return GL_TRUE;
}
@@ -529,14 +547,6 @@ tdfxInitContext( __DRIdrawablePrivate *driDrawPriv, tdfxContextPtr fxMesa )
UNLOCK_HARDWARE( fxMesa );
{
const char *debug = getenv("LIBGL_DEBUG");
if (debug && strstr(debug, "fallbacks")) {
fxMesa->debugFallbacks = GL_TRUE;
}
}
fxMesa->numClipRects = 0;
fxMesa->pClipRects = NULL;
fxMesa->scissoredClipRects = GL_FALSE;

View File

@@ -54,6 +54,7 @@
#include "drm.h"
#include "drm_sarea.h"
#include "tdfx_glide.h"
#include "xmlconfig.h"
#include "clip.h"
#include "context.h"
@@ -141,6 +142,7 @@
#define TDFX_FALLBACK_COLORMASK 0x0100
#define TDFX_FALLBACK_BLEND 0x0200
#define TDFX_FALLBACK_LINE_STIPPLE 0x0400
#define TDFX_FALLBACK_DISABLE 0x0800
/* Different Glide vertex layouts
*/
@@ -917,7 +919,9 @@ struct tdfx_context {
tdfxStats stats;
GLboolean debugFallbacks;
/* Configuration cache
*/
driOptionCache optionCache;
};
#define TDFX_CONTEXT(ctx) ((tdfxContextPtr)((ctx)->DriverCtx))
@@ -984,7 +988,7 @@ static __inline__ GrColor_t tdfxPackColor( GLuint cpp,
}
}
#define DO_DEBUG 0
#define DO_DEBUG 1
#if DO_DEBUG
extern int TDFX_DEBUG;
#else
@@ -993,11 +997,8 @@ extern int TDFX_DEBUG;
#define DEBUG_ALWAYS_SYNC 0x01
#define DEBUG_VERBOSE_API 0x02
#define DEBUG_VERBOSE_MSG 0x04
#define DEBUG_VERBOSE_LRU 0x08
#define DEBUG_VERBOSE_DRI 0x10
#define DEBUG_VERBOSE_IOCTL 0x20
#define DEBUG_VERBOSE_2D 0x40
#define DEBUG_VERBOSE_DRI 0x04
#define DEBUG_VERBOSE_FALL 0x08
/* conf */
#define FX_COMPRESS_S3TC_AS_FXT1_HACK 1

View File

@@ -40,9 +40,12 @@
#include "tdfx_vb.h"
#include "tdfx_span.h"
#include "tdfx_tris.h"
#include "utils.h"
#include "framebuffer.h"
#include "renderbuffer.h"
#include "xmlpool.h"
#include "utils.h"
#ifdef DEBUG_LOCKING
char *prevLockFile = 0;
@@ -50,18 +53,17 @@ int prevLockLine = 0;
#endif
#ifndef TDFX_DEBUG
int TDFX_DEBUG = (0
/* | DEBUG_ALWAYS_SYNC */
/* | DEBUG_VERBOSE_API */
/* | DEBUG_VERBOSE_MSG */
/* | DEBUG_VERBOSE_LRU */
/* | DEBUG_VERBOSE_DRI */
/* | DEBUG_VERBOSE_IOCTL */
/* | DEBUG_VERBOSE_2D */
);
int TDFX_DEBUG = 0;
#endif
PUBLIC const char __driConfigOptions[] =
DRI_CONF_BEGIN
DRI_CONF_SECTION_DEBUG
DRI_CONF_NO_RAST(false)
DRI_CONF_SECTION_END
DRI_CONF_END;
static const GLuint __driNConfigOptions = 1;
static GLboolean
tdfxCreateScreen( __DRIscreenPrivate *sPriv )
@@ -74,6 +76,10 @@ tdfxCreateScreen( __DRIscreenPrivate *sPriv )
if ( !fxScreen )
return GL_FALSE;
/* parse information in __driConfigOptions */
driParseOptionInfo (&fxScreen->optionCache,
__driConfigOptions, __driNConfigOptions);
fxScreen->driScrnPriv = sPriv;
sPriv->private = (void *) fxScreen;
@@ -108,12 +114,16 @@ tdfxDestroyScreen( __DRIscreenPrivate *sPriv )
{
tdfxScreenPrivate *fxScreen = (tdfxScreenPrivate *) sPriv->private;
if ( fxScreen ) {
drmUnmap( fxScreen->regs.map, fxScreen->regs.size );
if (!fxScreen)
return;
FREE( fxScreen );
sPriv->private = NULL;
}
drmUnmap( fxScreen->regs.map, fxScreen->regs.size );
/* free all option information */
driDestroyOptionInfo (&fxScreen->optionCache);
FREE( fxScreen );
sPriv->private = NULL;
}
@@ -165,7 +175,7 @@ tdfxCreateBuffer( __DRIscreenPrivate *driScrnPriv,
if (mesaVis->doubleBufferMode) {
driRenderbuffer *backRb
= driNewRenderbuffer(GL_RGBA8, screen->cpp,
= driNewRenderbuffer(GL_RGBA, screen->cpp,
screen->backOffset, screen->width);
tdfxSetSpanFunctions(backRb, mesaVis);
_mesa_add_renderbuffer(fb, BUFFER_BACK_LEFT, &backRb->Base);

View File

@@ -64,6 +64,9 @@ typedef struct {
__DRIscreenPrivate *driScrnPriv;
unsigned int sarea_priv_offset;
/* Configuration cache with default values for all contexts */
driOptionCache optionCache;
} tdfxScreenPrivate;

View File

@@ -1372,74 +1372,8 @@ static void tdfxDDSetBuffer( GLcontext *ctx,
void tdfxDDInitSpanFuncs( GLcontext *ctx )
{
tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
struct swrast_device_driver *swdd = _swrast_GetDeviceDriverReference( ctx );
swdd->SetBuffer = tdfxDDSetBuffer;
#if 0
if ( VISUAL_EQUALS_RGBA(ctx->Visual, 5, 6, 5, 0) )
{
/* 16bpp mode */
swdd->WriteRGBASpan = tdfxWriteRGBASpan_RGB565;
swdd->WriteRGBSpan = tdfxWriteRGBSpan_RGB565;
swdd->WriteMonoRGBASpan = tdfxWriteMonoRGBASpan_RGB565;
swdd->WriteRGBAPixels = tdfxWriteRGBAPixels_RGB565;
swdd->WriteMonoRGBAPixels = tdfxWriteMonoRGBAPixels_RGB565;
swdd->ReadRGBASpan = tdfxReadRGBASpan_RGB565;
swdd->ReadRGBAPixels = tdfxReadRGBAPixels_RGB565;
}
else if ( VISUAL_EQUALS_RGBA(ctx->Visual, 8, 8, 8, 0) )
{
/* 24bpp mode */
swdd->WriteRGBASpan = tdfxWriteRGBASpan_RGB888;
swdd->WriteRGBSpan = tdfxWriteRGBSpan_RGB888;
swdd->WriteMonoRGBASpan = tdfxWriteMonoRGBASpan_RGB888;
swdd->WriteRGBAPixels = tdfxWriteRGBAPixels_RGB888;
swdd->WriteMonoRGBAPixels = tdfxWriteMonoRGBAPixels_RGB888;
swdd->ReadRGBASpan = tdfxReadRGBASpan_RGB888;
swdd->ReadRGBAPixels = tdfxReadRGBAPixels_RGB888;
}
else if ( VISUAL_EQUALS_RGBA(ctx->Visual, 8, 8, 8, 8) )
{
/* 32bpp mode */
swdd->WriteRGBASpan = tdfxWriteRGBASpan_ARGB8888;
swdd->WriteRGBSpan = tdfxWriteRGBSpan_ARGB8888;
swdd->WriteMonoRGBASpan = tdfxWriteMonoRGBASpan_ARGB8888;
swdd->WriteRGBAPixels = tdfxWriteRGBAPixels_ARGB8888;
swdd->WriteMonoRGBAPixels = tdfxWriteMonoRGBAPixels_ARGB8888;
swdd->ReadRGBAPixels = tdfxReadRGBAPixels_ARGB8888;
swdd->ReadRGBASpan = tdfxReadRGBASpan_ARGB8888;
}
else
{
abort();
}
#endif
if ( fxMesa->haveHwStencil ) {
#if 0
swdd->WriteStencilSpan = write_stencil_span;
swdd->ReadStencilSpan = read_stencil_span;
swdd->WriteStencilPixels = write_stencil_pixels;
swdd->ReadStencilPixels = read_stencil_pixels;
#endif
}
#if 0
swdd->WriteDepthSpan = tdfxDDWriteDepthSpan;
swdd->WriteDepthPixels = tdfxDDWriteDepthPixels;
swdd->ReadDepthSpan = tdfxDDReadDepthSpan;
swdd->ReadDepthPixels = tdfxDDReadDepthPixels;
#endif
swdd->WriteCI8Span = NULL;
swdd->WriteCI32Span = NULL;
swdd->WriteMonoCISpan = NULL;
swdd->WriteCI32Pixels = NULL;
swdd->WriteMonoCIPixels = NULL;
swdd->ReadCI32Span = NULL;
swdd->ReadCI32Pixels = NULL;
swdd->SpanRenderStart = tdfxSpanRenderStart;
swdd->SpanRenderFinish = tdfxSpanRenderFinish;
}

View File

@@ -1213,7 +1213,8 @@ static char *fallbackStrings[] = {
"Texture border",
"glColorMask",
"blend mode",
"line stipple"
"line stipple",
"Rasterization disable"
};
@@ -1241,7 +1242,7 @@ void tdfxFallback( GLcontext *ctx, GLuint bit, GLboolean mode )
FLUSH_BATCH(fxMesa);
_swsetup_Wakeup( ctx );
fxMesa->RenderIndex = ~0;
if (fxMesa->debugFallbacks) {
if (TDFX_DEBUG & DEBUG_VERBOSE_FALL) {
fprintf(stderr, "Tdfx begin software fallback: 0x%x %s\n",
bit, getFallbackString(bit));
}
@@ -1258,7 +1259,7 @@ void tdfxFallback( GLcontext *ctx, GLuint bit, GLboolean mode )
tnl->Driver.Render.BuildVertices = tdfxBuildVertices;
fxMesa->new_gl_state |= (_TDFX_NEW_RENDERSTATE|
_TDFX_NEW_RASTERSETUP);
if (fxMesa->debugFallbacks) {
if (TDFX_DEBUG & DEBUG_VERBOSE_FALL) {
fprintf(stderr, "Tdfx end software fallback: 0x%x %s\n",
bit, getFallbackString(bit));
}

View File

@@ -1999,24 +1999,27 @@ void XMesaDestroyBuffer( XMesaBuffer b )
if (b->cleargc) XMesaFreeGC( b->xm_visual->display, b->cleargc );
if (b->swapgc) XMesaFreeGC( b->xm_visual->display, b->swapgc );
if (b->backxrb->ximage) {
if (b->xm_visual->mesa_visual.doubleBufferMode)
{
if (b->backxrb->ximage) {
#if defined(USE_XSHM) && !defined(XFree86Server)
if (b->shm) {
XShmDetach( b->xm_visual->display, &b->shminfo );
XDestroyImage( b->backxrb->ximage );
shmdt( b->shminfo.shmaddr );
}
else
if (b->shm) {
XShmDetach( b->xm_visual->display, &b->shminfo );
XDestroyImage( b->backxrb->ximage );
shmdt( b->shminfo.shmaddr );
}
else
#endif
XMesaDestroyImage( b->backxrb->ximage );
}
if (b->backxrb->pixmap) {
XMesaFreePixmap( b->xm_visual->display, b->backxrb->pixmap );
if (b->xm_visual->hpcr_clear_flag) {
XMesaFreePixmap( b->xm_visual->display,
b->xm_visual->hpcr_clear_pixmap );
XMesaDestroyImage( b->xm_visual->hpcr_clear_ximage );
}
XMesaDestroyImage( b->backxrb->ximage );
}
if (b->backxrb->pixmap) {
XMesaFreePixmap( b->xm_visual->display, b->backxrb->pixmap );
if (b->xm_visual->hpcr_clear_flag) {
XMesaFreePixmap( b->xm_visual->display,
b->xm_visual->hpcr_clear_pixmap );
XMesaDestroyImage( b->xm_visual->hpcr_clear_ximage );
}
}
}
if (b->rowimage) {
_mesa_free( b->rowimage->data );
@@ -2634,7 +2637,7 @@ unsigned long XMesaDitherColor( XMesaContext xmesa, GLint x, GLint y,
*/
void XMesaResizeBuffers( XMesaBuffer b )
{
#if OLD_RENDERBUFFER && 0
#if OLD_RENDERBUFFER
xmesa_resize_buffers(ctx, &(b->mesa_buffer), 0, 0 );
#endif
}

View File

@@ -3832,7 +3832,7 @@ get_row_ci(GLcontext *ctx, struct gl_renderbuffer *rb,
XMesaDestroyImage( span );
}
#else
(*xmesa->display->GetImage)(source->buffer,
(*xmesa->display->GetImage)(xrb->pixmap,
x, y, n, 1, ZPixmap,
~0L, (pointer)index);
#endif
@@ -3867,7 +3867,7 @@ get_row_rgba(GLcontext *ctx, struct gl_renderbuffer *rb,
span = XMesaCreateImage(xmesa->xm_visual->BitsPerPixel, n, 1, NULL);
span->data = (char *)MALLOC(span->height * span->bytes_per_line);
error = (!span->data);
(*xmesa->display->GetImage)(source->buffer,
(*xmesa->display->GetImage)(xrb->pixmap,
x, YFLIP(xrb, y), n, 1, ZPixmap,
~0L, (pointer)span->data);
#else

View File

@@ -22,12 +22,12 @@
vectorequiv NMTOKEN #IMPLIED>
<!ATTLIST size name NMTOKEN #REQUIRED
count NMTOKEN #IMPLIED
mode NMTOKEN #IMPLIED>
mode (get | set) "set">
<!ATTLIST param name NMTOKEN #REQUIRED
type CDATA #REQUIRED
count NMTOKEN #IMPLIED
counter (true | false) "false"
count_scale NMTOKEN #IMPLIED
count_scale NMTOKEN "1"
output (true | false) "false"
img_width NMTOKEN #IMPLIED
img_height NMTOKEN #IMPLIED

View File

@@ -4919,15 +4919,15 @@
<function name="BufferData" alias="BufferDataARB">
<param name="target" type="GLenum"/>
<param name="size" type="GLsizeiptrARB"/>
<param name="size" type="GLsizeiptr"/>
<param name="data" type="const GLvoid *"/>
<param name="usage" type="GLenum"/>
</function>
<function name="BufferSubData" alias="BufferSubDataARB">
<param name="target" type="GLenum"/>
<param name="offset" type="GLintptrARB"/>
<param name="size" type="GLsizeiptrARB"/>
<param name="offset" type="GLintptr"/>
<param name="size" type="GLsizeiptr"/>
<param name="data" type="const GLvoid *"/>
</function>
@@ -4955,8 +4955,8 @@
<function name="GetBufferSubData" alias="GetBufferSubDataARB">
<param name="target" type="GLenum"/>
<param name="offset" type="GLintptrARB"/>
<param name="size" type="GLsizeiptrARB"/>
<param name="offset" type="GLintptr"/>
<param name="size" type="GLsizeiptr"/>
<param name="data" type="GLvoid *" output="true"/>
</function>
@@ -11110,7 +11110,7 @@
<!-- No new functions, types, enums. -->
</category>
<category name="EXT_stencil_two_side" number="268">
<category name="GL_EXT_stencil_two_side" number="268">
<enum name="STENCIL_TEST_TWO_SIDE_EXT" count="1" value="0x8910">
<size name="Get" mode="get"/>
</enum>
@@ -11508,7 +11508,7 @@
<param name="textarget" type="GLenum"/>
<param name="texture" type="GLuint"/>
<param name="level" type="GLint"/>
<param name="zoffsetl" type="GLint"/>
<param name="zoffset" type="GLint"/>
</function>
<function name="FramebufferRenderbufferEXT" offset="810">

View File

@@ -31,10 +31,11 @@ import gl_XML
import sys, getopt
class PrintGlEnums(gl_XML.FilterGLAPISpecBase):
name = "gl_enums.py (from Mesa)"
def __init__(self):
gl_XML.FilterGLAPISpecBase.__init__(self)
self.name = "gl_enums.py (from Mesa)"
self.license = license.bsd_license_template % ( \
"""Copyright (C) 1999-2005 Brian Paul All Rights Reserved.""", "BRIAN PAUL")
self.enum_table = {}
@@ -186,7 +187,13 @@ int _mesa_lookup_enum_by_name( const char *symbol )
# Prevent duplicate names in the enum table.
if obj.name not in self.enum_table[ obj.value ]:
found_it = 0
for [n, junk] in self.enum_table[ obj.value ]:
if n == obj.name:
found_it = 1
break
if not found_it:
# Calculate a "priority" for this enum name.
# When we lookup an enum by number, there may

View File

@@ -30,11 +30,11 @@ import license
import sys, getopt
class PrintGlTable(gl_XML.FilterGLAPISpecBase):
file_name = "gl_gen_table.xml (from Mesa)"
def __init__(self):
gl_XML.FilterGLAPISpecBase.__init__(self)
self.header_tag = '_GLAPI_TABLE_H_'
self.name = "gl_table.py (from Mesa)"
self.license = license.bsd_license_template % ( \
"""Copyright (C) 1999-2003 Brian Paul All Rights Reserved.
(C) Copyright IBM Corporation 2004""", "BRIAN PAUL, IBM")

View File

@@ -1,4 +1,4 @@
/* DO NOT EDIT - This file generated automatically by a script */
/* DO NOT EDIT - This file generated automatically by gl_table.py (from Mesa) script */
/*
* Copyright (C) 1999-2003 Brian Paul All Rights Reserved.
@@ -844,7 +844,7 @@ struct _glapi_table
GLenum (GLAPIENTRYP CheckFramebufferStatusEXT)(GLenum target); /* 806 */
void (GLAPIENTRYP FramebufferTexture1DEXT)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); /* 807 */
void (GLAPIENTRYP FramebufferTexture2DEXT)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); /* 808 */
void (GLAPIENTRYP FramebufferTexture3DEXT)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffsetl); /* 809 */
void (GLAPIENTRYP FramebufferTexture3DEXT)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset); /* 809 */
void (GLAPIENTRYP FramebufferRenderbufferEXT)(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); /* 810 */
void (GLAPIENTRYP GetFramebufferAttachmentParameterivEXT)(GLenum target, GLenum attachment, GLenum pname, GLint * params); /* 811 */
void (GLAPIENTRYP GenerateMipmapEXT)(GLenum target); /* 812 */

View File

@@ -4115,9 +4115,9 @@ KEYWORD1 void KEYWORD2 NAME(FramebufferTexture2DEXT)(GLenum target, GLenum attac
DISPATCH(FramebufferTexture2DEXT, (target, attachment, textarget, texture, level), (F, "glFramebufferTexture2DEXT(0x%x, 0x%x, 0x%x, %d, %d);\n", target, attachment, textarget, texture, level));
}
KEYWORD1 void KEYWORD2 NAME(FramebufferTexture3DEXT)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffsetl)
KEYWORD1 void KEYWORD2 NAME(FramebufferTexture3DEXT)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset)
{
DISPATCH(FramebufferTexture3DEXT, (target, attachment, textarget, texture, level, zoffsetl), (F, "glFramebufferTexture3DEXT(0x%x, 0x%x, 0x%x, %d, %d, %d);\n", target, attachment, textarget, texture, level, zoffsetl));
DISPATCH(FramebufferTexture3DEXT, (target, attachment, textarget, texture, level, zoffset), (F, "glFramebufferTexture3DEXT(0x%x, 0x%x, 0x%x, %d, %d, %d);\n", target, attachment, textarget, texture, level, zoffset));
}
KEYWORD1 void KEYWORD2 NAME(FramebufferRenderbufferEXT)(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer)
@@ -4610,12 +4610,12 @@ KEYWORD1 void KEYWORD2 NAME(BindBuffer)(GLenum target, GLuint buffer)
DISPATCH(BindBufferARB, (target, buffer), (F, "glBindBuffer(0x%x, %d);\n", target, buffer));
}
KEYWORD1 void KEYWORD2 NAME(BufferData)(GLenum target, GLsizeiptrARB size, const GLvoid * data, GLenum usage)
KEYWORD1 void KEYWORD2 NAME(BufferData)(GLenum target, GLsizeiptr size, const GLvoid * data, GLenum usage)
{
DISPATCH(BufferDataARB, (target, size, data, usage), (F, "glBufferData(0x%x, %d, %p, 0x%x);\n", target, size, (const void *) data, usage));
}
KEYWORD1 void KEYWORD2 NAME(BufferSubData)(GLenum target, GLintptrARB offset, GLsizeiptrARB size, const GLvoid * data)
KEYWORD1 void KEYWORD2 NAME(BufferSubData)(GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid * data)
{
DISPATCH(BufferSubDataARB, (target, offset, size, data), (F, "glBufferSubData(0x%x, %d, %d, %p);\n", target, offset, size, (const void *) data));
}
@@ -4640,7 +4640,7 @@ KEYWORD1 void KEYWORD2 NAME(GetBufferPointerv)(GLenum target, GLenum pname, GLvo
DISPATCH(GetBufferPointervARB, (target, pname, params), (F, "glGetBufferPointerv(0x%x, 0x%x, %p);\n", target, pname, (const void *) params));
}
KEYWORD1 void KEYWORD2 NAME(GetBufferSubData)(GLenum target, GLintptrARB offset, GLsizeiptrARB size, GLvoid * data)
KEYWORD1 void KEYWORD2 NAME(GetBufferSubData)(GLenum target, GLintptr offset, GLsizeiptr size, GLvoid * data)
{
DISPATCH(GetBufferSubDataARB, (target, offset, size, data), (F, "glGetBufferSubData(0x%x, %d, %d, %p);\n", target, offset, size, (const void *) data));
}

View File

@@ -649,6 +649,14 @@ pop_texture_group(GLcontext *ctx, const struct gl_texture_attrib *texAttrib)
_mesa_TexGenfv(GL_T, GL_EYE_PLANE, unit->EyePlaneT);
_mesa_TexGenfv(GL_R, GL_EYE_PLANE, unit->EyePlaneR);
_mesa_TexGenfv(GL_Q, GL_EYE_PLANE, unit->EyePlaneQ);
_mesa_set_enable(ctx, GL_TEXTURE_GEN_S,
((unit->TexGenEnabled & S_BIT) ? GL_TRUE : GL_FALSE));
_mesa_set_enable(ctx, GL_TEXTURE_GEN_T,
((unit->TexGenEnabled & T_BIT) ? GL_TRUE : GL_FALSE));
_mesa_set_enable(ctx, GL_TEXTURE_GEN_R,
((unit->TexGenEnabled & R_BIT) ? GL_TRUE : GL_FALSE));
_mesa_set_enable(ctx, GL_TEXTURE_GEN_Q,
((unit->TexGenEnabled & Q_BIT) ? GL_TRUE : GL_FALSE));
if (ctx->Extensions.EXT_texture_lod_bias) {
_mesa_TexEnvf(GL_TEXTURE_FILTER_CONTROL_EXT,
GL_TEXTURE_LOD_BIAS_EXT, unit->LodBias);

View File

@@ -324,7 +324,7 @@
/* XXX these are temporary */
#define NEW_RENDERBUFFER 1
#define OLD_RENDERBUFFER 1
#define OLD_RENDERBUFFER 0
#endif /* CONFIG_H */

File diff suppressed because it is too large Load Diff

View File

@@ -348,6 +348,8 @@ _mesa_test_framebuffer_completeness(GLcontext *ctx, struct gl_framebuffer *fb)
GLuint w = 0, h = 0;
GLint i;
assert(fb->Name != 0);
numImages = 0;
fb->Width = 0;
fb->Height = 0;
@@ -387,6 +389,10 @@ _mesa_test_framebuffer_completeness(GLcontext *ctx, struct gl_framebuffer *fb)
h = att->Texture->Image[att->CubeMapFace][att->TextureLevel]->Height;
f = att->Texture->Image[att->CubeMapFace][att->TextureLevel]->Format;
numImages++;
if (f != GL_RGB && f != GL_RGBA && f != GL_DEPTH_COMPONENT) {
fb->_Status = GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT;
return;
}
}
else if (att->Type == GL_RENDERBUFFER_EXT) {
w = att->Renderbuffer->Width;
@@ -443,6 +449,22 @@ _mesa_test_framebuffer_completeness(GLcontext *ctx, struct gl_framebuffer *fb)
}
}
/* Check if any renderbuffer is attached more than once */
for (i = 0; i < BUFFER_COUNT - 1; i++) {
struct gl_renderbuffer *rb_i = fb->Attachment[i].Renderbuffer;
if (rb_i) {
GLint j;
for (j = i + 1; j < BUFFER_COUNT; j++) {
struct gl_renderbuffer *rb_j = fb->Attachment[j].Renderbuffer;
if (rb_i == rb_j) {
fb->_Status = GL_FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT_EXT;
return;
}
}
}
}
if (numImages == 0) {
fb->_Status = GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT;
return;
@@ -722,6 +744,59 @@ _mesa_GetRenderbufferParameterivEXT(GLenum target, GLenum pname, GLint *params)
case GL_RENDERBUFFER_INTERNAL_FORMAT_EXT:
*params = ctx->CurrentRenderbuffer->InternalFormat;
return;
case GL_RENDERBUFFER_RED_SIZE_EXT:
if (ctx->CurrentRenderbuffer->_BaseFormat == GL_RGB ||
ctx->CurrentRenderbuffer->_BaseFormat == GL_RGBA) {
*params = ctx->CurrentRenderbuffer->ComponentSizes[0];
}
else {
*params = 0;
}
break;
case GL_RENDERBUFFER_GREEN_SIZE_EXT:
if (ctx->CurrentRenderbuffer->_BaseFormat == GL_RGB ||
ctx->CurrentRenderbuffer->_BaseFormat == GL_RGBA) {
*params = ctx->CurrentRenderbuffer->ComponentSizes[1];
}
else {
*params = 0;
}
break;
case GL_RENDERBUFFER_BLUE_SIZE_EXT:
if (ctx->CurrentRenderbuffer->_BaseFormat == GL_RGB ||
ctx->CurrentRenderbuffer->_BaseFormat == GL_RGBA) {
*params = ctx->CurrentRenderbuffer->ComponentSizes[2];
}
else {
*params = 0;
}
break;
case GL_RENDERBUFFER_ALPHA_SIZE_EXT:
if (ctx->CurrentRenderbuffer->_BaseFormat == GL_RGB ||
ctx->CurrentRenderbuffer->_BaseFormat == GL_RGBA) {
*params = ctx->CurrentRenderbuffer->ComponentSizes[3];
}
else {
*params = 0;
}
break;
case GL_RENDERBUFFER_DEPTH_SIZE_EXT:
if (ctx->CurrentRenderbuffer->_BaseFormat == GL_DEPTH_COMPONENT) {
*params = ctx->CurrentRenderbuffer->ComponentSizes[0];
}
else {
*params = 0;
}
break;
case GL_RENDERBUFFER_STENCIL_SIZE_EXT:
if (ctx->CurrentRenderbuffer->_BaseFormat == GL_STENCIL_INDEX) {
*params = ctx->CurrentRenderbuffer->ComponentSizes[0];
}
else {
*params = 0;
}
break;
default:
_mesa_error(ctx, GL_INVALID_ENUM,
"glGetRenderbufferParameterivEXT(target)");
@@ -1234,6 +1309,7 @@ _mesa_GenerateMipmapEXT(GLenum target)
case GL_TEXTURE_2D:
case GL_TEXTURE_3D:
case GL_TEXTURE_CUBE_MAP:
/* OK, legal value */
break;
default:
_mesa_error(ctx, GL_INVALID_ENUM, "glGenerateMipmapEXT(target)");

View File

@@ -842,7 +842,7 @@ _mesa_printf( const char *fmtString, ... )
#if defined(XFree86LOADER) && defined(IN_MODULE)
xf86printf("%s", s);
#else
printf("%s", s);
fprintf(stderr,"%s", s);
#endif
}

View File

@@ -1770,6 +1770,7 @@ struct vertex_program
GLuint InputsRead; /* Bitmask of which input regs are read */
GLuint OutputsWritten; /* Bitmask of which output regs are written to */
struct program_parameter_list *Parameters; /**< array [NumParameters] */
void *TnlData; /* should probably use Base.DriverData */
};
@@ -2183,7 +2184,7 @@ struct gl_framebuffer
struct gl_renderbuffer *_ColorDrawBuffers[MAX_DRAW_BUFFERS][4];
struct gl_renderbuffer *_ColorReadBuffer;
#if OLD_RENDERBUFFER
#if OLD_RENDERBUFFER || NEW_RENDERBUFFER
/* XXX THIS IS TEMPORARY */
GLuint _ColorDrawBit[MAX_DRAW_BUFFERS][4];
#endif

View File

@@ -151,9 +151,12 @@ wrap_texture(GLcontext *ctx, struct gl_renderbuffer_attachment *att)
trb->Base.Height = trb->TexImage->Height;
trb->Base.InternalFormat = trb->TexImage->IntFormat; /* XXX fix? */
trb->Base._BaseFormat = trb->TexImage->TexFormat->BaseFormat;
#if 0
/* fix/avoid this assertion someday */
assert(trb->Base._BaseFormat == GL_RGB ||
trb->Base._BaseFormat == GL_RGBA ||
trb->Base._BaseFormat == GL_DEPTH_COMPONENT);
#endif
trb->Base.DataType = GL_UNSIGNED_BYTE; /* XXX fix! */
trb->Base.Data = trb->TexImage->Data;

View File

@@ -1,6 +1,6 @@
# Makefile for core library for VMS
# contributed by Jouk Jansen joukj@hrem.stm.tudelft.nl
# Last revision : 15 April 2005
# Last revision : 1 June 2005
.first
define gl [---.include.gl]
@@ -14,7 +14,7 @@
VPATH = RCS
INCDIR = [---.include],[-.main],[-.glapi],[.slang]
INCDIR = [---.include],[.grammar],[-.main],[-.glapi],[.slang]
LIBDIR = [---.lib]
CFLAGS = /include=($(INCDIR),[])/define=(PTHREADS=1)/name=(as_is,short)
@@ -24,7 +24,6 @@ SOURCES = \
arbprogparse.c \
arbprogram.c \
arbvertparse.c \
grammar_mesa.c \
nvfragparse.c \
nvprogram.c \
nvvertexec.c \
@@ -39,7 +38,6 @@ OBJECTS = \
arbprogparse.obj,\
arbprogram.obj,\
arbvertparse.obj,\
grammar_mesa.obj,\
nvfragparse.obj,\
nvprogram.obj,\
nvvertexec.obj,\
@@ -58,6 +56,8 @@ all :
$(MMS)$(MMSQUALIFIERS) $(LIBDIR)$(GL_LIB)
set def [.slang]
$(MMS)$(MMSQUALIFIERS)
set def [-.grammar]
$(MMS)$(MMSQUALIFIERS)
set def [-]
# Make the library
@@ -73,7 +73,6 @@ arbfragparse.obj : arbfragparse.c
arbprogparse.obj : arbprogparse.c
arbprogram.obj : arbprogram.c
arbvertparse.obj : arbvertparse.c
grammar_mesa.obj : grammar_mesa.c
nvfragparse.obj : nvfragparse.c
nvprogram.obj : nvprogram.c
nvvertexec.obj : nvvertexec.c

View File

@@ -0,0 +1,41 @@
# Makefile for core library for VMS
# contributed by Jouk Jansen joukj@hrem.stm.tudelft.nl
# Last revision : 1 June 2005
.first
define gl [----.include.gl]
define math [--.math]
define swrast [--.swrast]
define array_cache [--.array_cache]
.include [----]mms-config.
##### MACROS #####
VPATH = RCS
INCDIR = [----.include],[],[--.main],[--.glapi],[-.slang]
LIBDIR = [----.lib]
CFLAGS = /include=($(INCDIR),[])/define=(PTHREADS=1)/name=(as_is,short)
SOURCES = grammar_mesa.c
OBJECTS = grammar_mesa.obj
##### RULES #####
VERSION=Mesa V3.4
##### TARGETS #####
all :
$(MMS)$(MMSQUALIFIERS) $(LIBDIR)$(GL_LIB)
# Make the library
$(LIBDIR)$(GL_LIB) : $(OBJECTS)
@ library $(LIBDIR)$(GL_LIB) $(OBJECTS)
clean :
purge
delete *.obj;*
grammar_mesa.obj : grammar_mesa.c grammar.c

View File

@@ -66,7 +66,9 @@ enum vp_opcode
VP_OPCODE_SLT,
VP_OPCODE_SUB,
VP_OPCODE_SWZ, /* ARB only */
VP_OPCODE_XPD /* ARB only */
VP_OPCODE_XPD, /* ARB only */
VP_MAX_OPCODE
};

View File

@@ -353,7 +353,8 @@ _mesa_free_parameter_list(struct program_parameter_list *paramList)
{
_mesa_free_parameters(paramList);
_mesa_free(paramList->Parameters);
_mesa_free(paramList->ParameterValues);
if (paramList->ParameterValues)
ALIGN_FREE(paramList->ParameterValues);
_mesa_free(paramList);
}
@@ -385,18 +386,24 @@ add_parameter(struct program_parameter_list *paramList,
const GLuint n = paramList->NumParameters;
if (n == paramList->Size) {
GLfloat (*tmp)[4];
paramList->Size *= 2;
if (!paramList->Size)
paramList->Size = 4;
paramList->Size = 8;
paramList->Parameters = (struct program_parameter *)
_mesa_realloc(paramList->Parameters,
n * sizeof(struct program_parameter),
paramList->Size * sizeof(struct program_parameter));
paramList->ParameterValues = (GLfloat (*)[4])
_mesa_realloc(paramList->ParameterValues,
n * 4 * sizeof(GLfloat),
paramList->Size * 4 * sizeof(GLfloat));
tmp = paramList->ParameterValues;
paramList->ParameterValues = ALIGN_MALLOC(paramList->Size * 4 * sizeof(GLfloat), 16);
if (tmp) {
_mesa_memcpy(paramList->ParameterValues, tmp,
n * 4 * sizeof(GLfloat));
ALIGN_FREE(tmp);
}
}
if (!paramList->Parameters ||

View File

@@ -1,6 +1,6 @@
# Makefile for core library for VMS
# contributed by Jouk Jansen joukj@hrem.stm.tudelft.nl
# Last revision : 20 May 2005
# Last revision : 1 June 2005
.first
define gl [----.include.gl]
@@ -14,7 +14,7 @@
VPATH = RCS
INCDIR = [----.include],[--.main],[--.glapi],[-.slang],[-]
INCDIR = [----.include],[--.main],[--.glapi],[-.slang],[-.grammar],[-]
LIBDIR = [----.lib]
CFLAGS = /include=($(INCDIR),[])/define=(PTHREADS=1)/name=(as_is,short)
@@ -25,7 +25,7 @@ OBJECTS = \
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
slang_storage.obj,slang_assemble_assignment.obj
##### RULES #####
@@ -49,3 +49,4 @@ 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
slang_assemble_assignment.obj : slang_assemble_assignment.c

View File

@@ -2103,7 +2103,7 @@ if (x == 1)
space.structs = structs;
space.vars = scope;
if (x == 1)
xxx_first (&file);
xxx_first (&file);
(**parsed_func_ret).address = file.count;
if (!_slang_assemble_function (&file, *parsed_func_ret, &space))
{
@@ -2111,7 +2111,7 @@ xxx_first (&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);
@@ -2254,9 +2254,9 @@ static const char *slang_shader_syn =
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_core_gc[] = {
#include "library/slang_core_gc.h"
};
static const byte slang_common_builtin_gc_bin[] = {
#include "library/slang_common_builtin_gc_bin.h"
@@ -2269,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)
{
@@ -2301,8 +2301,8 @@ int _slang_compile (const char *source, slang_translation_unit *unit, slang_unit
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_with_grammar (id, slang_core_gc, builtin_units, slang_unit_fragment_builtin,
slang_unit_fragment_builtin, log, NULL))*/
if (!compile_with_grammar (id, (const char*) slang_core_gc, builtin_units, slang_unit_fragment_builtin,
log, NULL))
{
grammar_destroy (id);
@@ -2318,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);
@@ -2329,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

@@ -1,255 +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;
}
/*
* 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

@@ -1,109 +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
/*
* 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

@@ -121,6 +121,7 @@ TNL_SOURCES = \
tnl/t_save_loopback.c \
tnl/t_save_playback.c \
tnl/t_vb_arbprogram.c \
tnl/t_vb_arbprogram_sse.c \
tnl/t_vb_program.c \
tnl/t_vb_render.c \
tnl/t_vb_texgen.c \
@@ -203,6 +204,7 @@ ASM_C_SOURCES = \
x86/x86.c \
x86/3dnow.c \
x86/sse.c \
x86/rtasm/x86sse.c \
sparc/sparc.c \
ppc/common_ppc.c \
x86-64/x86-64.c

View File

@@ -521,13 +521,7 @@ accum_return(GLcontext *ctx, GLfloat value,
if (masking) {
_swrast_mask_rgba_array(ctx, rb, width, xpos, ypos + i, rgba);
}
#if OLD_RENDERBUFFER
if (swrast->Driver.WriteRGBASpan)
swrast->Driver.WriteRGBASpan(ctx, rb, width, xpos, ypos + i,
(const GLchan (*)[4]) rgba, NULL);
else
#endif
rb->PutRow(ctx, rb, width, xpos, ypos + i, rgba, NULL);
rb->PutRow(ctx, rb, width, xpos, ypos + i, rgba, NULL);
}
}
}

View File

@@ -849,7 +849,6 @@ void
_swrast_blend_span(GLcontext *ctx, struct gl_renderbuffer *rb,
const struct sw_span *span, GLchan rgba[][4])
{
SWcontext *swrast = SWRAST_CONTEXT(ctx);
GLchan framebuffer[MAX_WIDTH][4];
ASSERT(span->end <= MAX_WIDTH);
@@ -859,15 +858,8 @@ _swrast_blend_span(GLcontext *ctx, struct gl_renderbuffer *rb,
/* Read span of current frame buffer pixels */
if (span->arrayMask & SPAN_XY) {
/* array of x/y pixel coords */
#if OLD_RENDERBUFFER
if (swrast->Driver.ReadRGBAPixels)
(*swrast->Driver.ReadRGBAPixels)( ctx, rb, span->end,
span->array->x, span->array->y,
framebuffer, span->array->mask );
else
#endif
rb->GetValues(ctx, rb, span->end, span->array->x, span->array->y,
framebuffer);
rb->GetValues(ctx, rb, span->end, span->array->x, span->array->y,
framebuffer);
}
else {
/* horizontal run of pixels */

View File

@@ -43,7 +43,6 @@
static void
clear_rgba_buffer_with_masking(GLcontext *ctx, struct gl_renderbuffer *rb)
{
SWcontext *swrast = SWRAST_CONTEXT(ctx);
const GLint x = ctx->DrawBuffer->_Xmin;
const GLint y = ctx->DrawBuffer->_Ymin;
const GLint height = ctx->DrawBuffer->_Ymax - ctx->DrawBuffer->_Ymin;
@@ -52,6 +51,7 @@ clear_rgba_buffer_with_masking(GLcontext *ctx, struct gl_renderbuffer *rb)
GLint i;
ASSERT(ctx->Visual.rgbMode);
ASSERT(rb->PutRow);
CLAMPED_FLOAT_TO_CHAN(clearColor[RCOMP], ctx->Color.ClearColor[0]);
CLAMPED_FLOAT_TO_CHAN(clearColor[GCOMP], ctx->Color.ClearColor[1]);
@@ -65,17 +65,7 @@ clear_rgba_buffer_with_masking(GLcontext *ctx, struct gl_renderbuffer *rb)
COPY_CHAN4(rgba[j], clearColor);
}
_swrast_mask_rgba_array( ctx, rb, width, x, y + i, rgba );
#if NEW_RENDERBUFFER
if (rb->PutRow) {
rb->PutRow(ctx, rb, width, x, y + i, rgba, NULL);
}
#endif
#if OLD_RENDERBUFFER
else {
swrast->Driver.WriteRGBASpan(ctx, rb, width, x, y + i,
(CONST GLchan (*)[4]) rgba, NULL);
}
#endif
rb->PutRow(ctx, rb, width, x, y + i, rgba, NULL);
}
}
@@ -115,11 +105,13 @@ clear_ci_buffer_with_masking(GLcontext *ctx, struct gl_renderbuffer *rb)
static void
clear_rgba_buffer(GLcontext *ctx, struct gl_renderbuffer *rb)
{
SWcontext *swrast = SWRAST_CONTEXT(ctx);
const GLint x = ctx->DrawBuffer->_Xmin;
const GLint y = ctx->DrawBuffer->_Ymin;
const GLint height = ctx->DrawBuffer->_Ymax - ctx->DrawBuffer->_Ymin;
const GLint width = ctx->DrawBuffer->_Xmax - ctx->DrawBuffer->_Xmin;
GLubyte clear8[4];
GLushort clear16[4];
GLvoid *clearVal;
GLint i;
ASSERT(ctx->Visual.rgbMode);
@@ -129,12 +121,9 @@ clear_rgba_buffer(GLcontext *ctx, struct gl_renderbuffer *rb)
ctx->Color.ColorMask[2] &&
ctx->Color.ColorMask[3]);
#if NEW_RENDERBUFFER
if (rb->PutMonoRow) { /* XXX assert this */
GLubyte clear8[4];
GLushort clear16[4];
GLvoid *clearVal;
switch (rb->DataType) {
ASSERT(rb->PutMonoRow);
switch (rb->DataType) {
case GL_UNSIGNED_BYTE:
clear8[0] = FLOAT_TO_UBYTE(ctx->Color.ClearColor[0]);
clear8[1] = FLOAT_TO_UBYTE(ctx->Color.ClearColor[1]);
@@ -155,26 +144,11 @@ clear_rgba_buffer(GLcontext *ctx, struct gl_renderbuffer *rb)
default:
_mesa_problem(ctx, "Bad rb DataType in clear_color_buffer");
return;
}
for (i = 0; i < height; i++) {
rb->PutMonoRow(ctx, rb, width, x, y + i, clearVal, NULL);
}
}
#endif
#if OLD_RENDERBUFFER
else {
GLchan clearColor[4];
CLAMPED_FLOAT_TO_CHAN(clearColor[RCOMP], ctx->Color.ClearColor[0]);
CLAMPED_FLOAT_TO_CHAN(clearColor[GCOMP], ctx->Color.ClearColor[1]);
CLAMPED_FLOAT_TO_CHAN(clearColor[BCOMP], ctx->Color.ClearColor[2]);
CLAMPED_FLOAT_TO_CHAN(clearColor[ACOMP], ctx->Color.ClearColor[3]);
ASSERT(swrast->Driver.WriteRGBASpan);
for (i = 0; i < height; i++) {
swrast->Driver.WriteMonoRGBASpan(ctx, rb, width, x, y + i,
clearColor, NULL );
}
for (i = 0; i < height; i++) {
rb->PutMonoRow(ctx, rb, width, x, y + i, clearVal, NULL);
}
#endif
}
@@ -188,20 +162,21 @@ clear_ci_buffer(GLcontext *ctx, struct gl_renderbuffer *rb)
const GLint y = ctx->DrawBuffer->_Ymin;
const GLint height = ctx->DrawBuffer->_Ymax - ctx->DrawBuffer->_Ymin;
const GLint width = ctx->DrawBuffer->_Xmax - ctx->DrawBuffer->_Xmin;
GLubyte clear8;
GLushort clear16;
GLuint clear32;
GLvoid *clearVal;
GLint i;
ASSERT(!ctx->Visual.rgbMode);
ASSERT((ctx->Color.IndexMask & ((1 << ctx->Visual.indexBits) - 1))
== (GLuint) ((1 << ctx->Visual.indexBits) - 1));
#if NEW_RENDERBUFFER
if (rb->PutMonoRow) { /* XXX assert this */
GLubyte clear8;
GLushort clear16;
GLuint clear32;
GLvoid *clearVal;
GLint i;
switch (rb->DataType) {
ASSERT(rb->PutMonoRow);
/* setup clear value */
switch (rb->DataType) {
case GL_UNSIGNED_BYTE:
clear8 = (GLubyte) ctx->Color.ClearIndex;
clearVal = &clear8;
@@ -217,11 +192,10 @@ clear_ci_buffer(GLcontext *ctx, struct gl_renderbuffer *rb)
default:
_mesa_problem(ctx, "Bad rb DataType in clear_color_buffer");
return;
}
for (i = 0; i < height; i++)
rb->PutMonoRow(ctx, rb, width, x, y + i, clearVal, NULL);
}
#endif
for (i = 0; i < height; i++)
rb->PutMonoRow(ctx, rb, width, x, y + i, clearVal, NULL);
}
@@ -260,9 +234,9 @@ clear_color_buffers(GLcontext *ctx)
for (i = 0; i < ctx->DrawBuffer->_NumColorDrawBuffers[0]; i++) {
struct gl_renderbuffer *rb = ctx->DrawBuffer->_ColorDrawBuffers[0][i];
#if OLD_RENDERBUFFER /* this is obsolete code */
if (swrast->Driver.SetBuffer)
swrast->Driver.SetBuffer(ctx, ctx->DrawBuffer,
#if OLD_RENDERBUFFER || NEW_RENDERBUFFER
/* SetBuffer will go away */
swrast->Driver.SetBuffer(ctx, ctx->DrawBuffer,
ctx->DrawBuffer->_ColorDrawBit[0][i]);
#endif

View File

@@ -2,7 +2,7 @@
* Mesa 3-D graphics library
* Version: 6.3
*
* Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
* Copyright (C) 1999-2005 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -130,7 +130,6 @@ static void
copy_conv_rgba_pixels(GLcontext *ctx, GLint srcx, GLint srcy,
GLint width, GLint height, GLint destx, GLint desty)
{
SWcontext *swrast = SWRAST_CONTEXT(ctx);
struct gl_renderbuffer *drawRb = NULL;
GLboolean quick_draw;
GLint row;
@@ -242,14 +241,7 @@ copy_conv_rgba_pixels(GLcontext *ctx, GLint srcx, GLint srcy,
dy = desty + row;
if (quick_draw && dy >= 0 && dy < (GLint) ctx->DrawBuffer->Height) {
#if OLD_RENDERBUFFER
if (swrast->Driver.WriteRGBASpan)
swrast->Driver.WriteRGBASpan(ctx, drawRb, width, destx, dy,
(const GLchan (*)[4]) span.array->rgba, NULL);
else
#endif
drawRb->PutRow(ctx, drawRb, width, destx, dy,
span.array->rgba, NULL);
drawRb->PutRow(ctx, drawRb, width, destx, dy, span.array->rgba, NULL);
}
else if (zoom) {
span.x = destx;
@@ -278,7 +270,6 @@ static void
copy_rgba_pixels(GLcontext *ctx, GLint srcx, GLint srcy,
GLint width, GLint height, GLint destx, GLint desty)
{
SWcontext *swrast = SWRAST_CONTEXT(ctx);
struct gl_renderbuffer *drawRb;
GLchan *tmpImage,*p;
GLboolean quick_draw;
@@ -413,14 +404,7 @@ copy_rgba_pixels(GLcontext *ctx, GLint srcx, GLint srcy,
/* Write color span */
if (quick_draw && dy >= 0 && dy < (GLint) ctx->DrawBuffer->Height) {
#if OLD_RENDERBUFFER
if (swrast->Driver.WriteRGBASpan)
swrast->Driver.WriteRGBASpan(ctx, drawRb, width, destx, dy,
(const GLchan (*)[4])span.array->rgba, NULL);
else
#endif
drawRb->PutRow(ctx, drawRb, width, destx, dy, span.array->rgba, NULL);
drawRb->PutRow(ctx, drawRb, width, destx, dy, span.array->rgba, NULL);
}
else if (zoom) {
span.x = destx;

View File

@@ -792,7 +792,6 @@ draw_rgba_pixels( GLcontext *ctx, GLint x, GLint y,
const struct gl_pixelstore_attrib *unpack,
const GLvoid *pixels )
{
SWcontext *swrast = SWRAST_CONTEXT(ctx);
struct gl_renderbuffer *rb = NULL; /* only used for quickDraw path */
const GLboolean zoom = ctx->Pixel.ZoomX!=1.0 || ctx->Pixel.ZoomY!=1.0;
const GLint desty = y;
@@ -926,13 +925,7 @@ draw_rgba_pixels( GLcontext *ctx, GLint x, GLint y,
/* draw the span */
if (quickDraw) {
#if OLD_RENDERBUFFER
if (swrast->Driver.WriteRGBASpan)
swrast->Driver.WriteRGBASpan(ctx, rb, span.end, span.x, span.y,
(CONST GLchan (*)[4]) span.array->rgba, NULL);
else
#endif
rb->PutRow(ctx, rb, span.end, span.x, span.y,
rb->PutRow(ctx, rb, span.end, span.x, span.y,
span.array->rgba, NULL);
}
else if (zoom) {

View File

@@ -188,14 +188,13 @@ _swrast_logicop_ci_span(GLcontext *ctx, struct gl_renderbuffer *rb,
GLuint dest[MAX_WIDTH];
ASSERT(span->end < MAX_WIDTH);
ASSERT(rb->DataType == GL_UNSIGNED_INT);
/* Read dest values from frame buffer */
if (span->arrayMask & SPAN_XY) {
ASSERT(rb->DataType == GL_UNSIGNED_INT);
rb->GetValues(ctx, rb, span->end, span->array->x, span->array->y, dest);
}
else {
ASSERT(rb->DataType == GL_UNSIGNED_INT);
rb->GetRow(ctx, rb, span->end, span->x, span->y, dest);
}
@@ -212,16 +211,14 @@ void
_swrast_logicop_rgba_span(GLcontext *ctx, struct gl_renderbuffer *rb,
const struct sw_span *span, GLchan rgba[][4])
{
SWcontext *swrast = SWRAST_CONTEXT(ctx);
GLchan dest[MAX_WIDTH][4];
ASSERT(span->end < MAX_WIDTH);
ASSERT(span->arrayMask & SPAN_RGBA);
ASSERT(rb->DataType == GL_UNSIGNED_BYTE);
if (span->arrayMask & SPAN_XY) {
swrast->Driver.ReadRGBAPixels(ctx, rb, span->end,
span->array->x, span->array->y,
dest, span->array->mask);
rb->GetValues(ctx, rb, span->end, span->array->x, span->array->y, dest);
}
else {
_swrast_read_rgba_span(ctx, rb, span->end, span->x, span->y, dest);

View File

@@ -42,7 +42,6 @@ void
_swrast_mask_rgba_span(GLcontext *ctx, struct gl_renderbuffer *rb,
const struct sw_span *span, GLchan rgba[][4])
{
SWcontext *swrast = SWRAST_CONTEXT(ctx);
GLchan dest[MAX_WIDTH][4];
#if CHAN_BITS == 8
GLuint srcMask = *((GLuint*)ctx->Color.ColorMask);
@@ -62,13 +61,7 @@ _swrast_mask_rgba_span(GLcontext *ctx, struct gl_renderbuffer *rb,
ASSERT(span->arrayMask & SPAN_RGBA);
if (span->arrayMask & SPAN_XY) {
#if OLD_RENDERBUFFER
if (swrast->Driver.ReadRGBAPixels)
swrast->Driver.ReadRGBAPixels(ctx, rb, n, span->array->x, span->array->y,
dest, span->array->mask);
else
#endif
rb->GetValues(ctx, rb, n, span->array->x, span->array->y, dest);
rb->GetValues(ctx, rb, n, span->array->x, span->array->y, dest);
}
else {
_swrast_read_rgba_span(ctx, rb, n, span->x, span->y, dest);

View File

@@ -300,17 +300,9 @@ read_fast_rgba_pixels( GLcontext *ctx,
rowLength = -rowLength;
}
ASSERT(rb->GetRow);
for (row=0; row<readHeight; row++) {
#if OLD_RENDERBUFFER && 0
(*swrast->Driver.ReadRGBASpan)(ctx, rb, readWidth, srcX, srcY,
(GLchan (*)[4]) dest);
if (ctx->DrawBuffer->UseSoftwareAlphaBuffers) {
_swrast_read_alpha_span(ctx, readWidth, srcX, srcY,
(GLchan (*)[4]) dest);
}
#else
rb->GetRow(ctx, rb, readWidth, srcX, srcY, dest);
#endif
dest += rowLength * 4;
srcY++;
}

View File

@@ -987,7 +987,7 @@ _swrast_write_index_span( GLcontext *ctx, struct sw_span *span)
}
}
#if OLD_RENDERBUFFER
#if OLD_RENDERBUFFER || NEW_RENDERBUFFER
/* restore default dest buffer */
_swrast_use_draw_buffer(ctx);
#endif
@@ -1033,7 +1033,9 @@ add_colors(GLuint n, GLchan rgba[][4], GLchan specular[][4] )
static void
multi_write_rgba_span( GLcontext *ctx, struct sw_span *span )
{
#if OLD_RENDERBUFFER || NEW_RENDERBUFFER
SWcontext *swrast = SWRAST_CONTEXT(ctx);
#endif
const GLuint colorMask = *((GLuint *) ctx->Color.ColorMask);
struct gl_framebuffer *fb = ctx->DrawBuffer;
const GLuint output = 0;
@@ -1046,7 +1048,8 @@ multi_write_rgba_span( GLcontext *ctx, struct sw_span *span )
struct gl_renderbuffer *rb = fb->_ColorDrawBuffers[output][i];
GLchan rgbaTmp[MAX_WIDTH][4];
#if OLD_RENDERBUFFER /* obsolete code */
#if OLD_RENDERBUFFER || NEW_RENDERBUFFER
/* obsolete code */
GLuint bufferBit = fb->_ColorDrawBit[output][i];
/* Set the current read/draw buffer */
swrast->CurrentBufferBit = bufferBit;
@@ -1069,36 +1072,19 @@ multi_write_rgba_span( GLcontext *ctx, struct sw_span *span )
if (span->arrayMask & SPAN_XY) {
/* array of pixel coords */
if (rb->PutValues) {
rb->PutValues(ctx, rb, span->end, span->array->x,
span->array->y, rgbaTmp, span->array->mask);
}
#if OLD_RENDERBUFFER
else {
swrast->Driver.WriteRGBAPixels(ctx, rb, span->end,
span->array->x, span->array->y,
(const GLchan (*)[4]) rgbaTmp,
span->array->mask);
}
#endif
ASSERT(rb->PutValues);
rb->PutValues(ctx, rb, span->end, span->array->x,
span->array->y, rgbaTmp, span->array->mask);
}
else {
/* horizontal run of pixels */
if (rb->PutRow) {
rb->PutRow(ctx, rb, span->end, span->x, span->y, rgbaTmp,
span->array->mask);
}
#if OLD_RENDERBUFFER
else {
swrast->Driver.WriteRGBASpan(ctx, rb, span->end, span->x, span->y,
(const GLchan (*)[4]) rgbaTmp,
span->array->mask);
}
#endif
ASSERT(rb->PutRow);
rb->PutRow(ctx, rb, span->end, span->x, span->y, rgbaTmp,
span->array->mask);
}
}
#if OLD_RENDERBUFFER
#if OLD_RENDERBUFFER || NEW_RENDERBUFFER
/* restore default dest buffer */
_swrast_use_draw_buffer(ctx);
#endif
@@ -1337,37 +1323,19 @@ _swrast_write_rgba_span( GLcontext *ctx, struct sw_span *span)
/* Finally, write the pixels to a color buffer */
if (span->arrayMask & SPAN_XY) {
/* array of pixel coords */
if (rb->PutValues) {
ASSERT(rb->_BaseFormat == GL_RGB || rb->_BaseFormat == GL_RGBA);
/* XXX check datatype */
rb->PutValues(ctx, rb, span->end, span->array->x, span->array->y,
span->array->rgba, span->array->mask);
}
#ifdef OLD_RENDERBUFFER
else
{
swrast->Driver.WriteRGBAPixels(ctx, rb, span->end, span->array->x,
span->array->y, (const GLchan (*)[4]) span->array->rgba,
span->array->mask);
}
#endif
ASSERT(rb->PutValues);
ASSERT(rb->_BaseFormat == GL_RGB || rb->_BaseFormat == GL_RGBA);
/* XXX check datatype */
rb->PutValues(ctx, rb, span->end, span->array->x, span->array->y,
span->array->rgba, span->array->mask);
}
else {
/* horizontal run of pixels */
if (rb->PutRow) {
ASSERT(rb->_BaseFormat == GL_RGB || rb->_BaseFormat == GL_RGBA);
/* XXX check datatype */
rb->PutRow(ctx, rb, span->end, span->x, span->y, span->array->rgba,
span->writeAll ? NULL : span->array->mask);
}
#ifdef OLD_RENDERBUFFER
else
{
swrast->Driver.WriteRGBASpan(ctx, rb, span->end, span->x, span->y,
(const GLchan (*)[4]) span->array->rgba,
span->writeAll ? NULL : span->array->mask);
}
#endif
ASSERT(rb->PutRow);
ASSERT(rb->_BaseFormat == GL_RGB || rb->_BaseFormat == GL_RGBA);
/* XXX check datatype */
rb->PutRow(ctx, rb, span->end, span->x, span->y, span->array->rgba,
span->writeAll ? NULL : span->array->mask);
}
}
@@ -1385,7 +1353,6 @@ void
_swrast_read_rgba_span( GLcontext *ctx, struct gl_renderbuffer *rb,
GLuint n, GLint x, GLint y, GLchan rgba[][4] )
{
SWcontext *swrast = SWRAST_CONTEXT(ctx);
const GLint bufWidth = (GLint) rb->Width;
const GLint bufHeight = (GLint) rb->Height;
@@ -1423,22 +1390,11 @@ _swrast_read_rgba_span( GLcontext *ctx, struct gl_renderbuffer *rb,
length = (GLint) n;
}
if (rb && rb->GetRow) {
assert(rb->_BaseFormat == GL_RGB || rb->_BaseFormat == GL_RGBA);
assert(rb->DataType == GL_UNSIGNED_BYTE);
rb->GetRow(ctx, rb, length, x + skip, y, rgba + skip);
}
#if OLD_RENDERBUFFER
else {
swrast->Driver.ReadRGBASpan(ctx, rb, length, x + skip, y,
rgba + skip);
/*
if (buffer->UseSoftwareAlphaBuffers) {
_swrast_read_alpha_span(ctx, length, x + skip, y, rgba + skip);
}
*/
}
#endif
ASSERT(rb);
ASSERT(rb->GetRow);
ASSERT(rb->_BaseFormat == GL_RGB || rb->_BaseFormat == GL_RGBA);
ASSERT(rb->DataType == GL_UNSIGNED_BYTE);
rb->GetRow(ctx, rb, length, x + skip, y, rgba + skip);
}
}

View File

@@ -148,7 +148,6 @@ _swrast_culltriangle( GLcontext *ctx,
#define T_SCALE theight
#define SETUP_CODE \
SWcontext *swrast = SWRAST_CONTEXT(ctx); \
struct gl_renderbuffer *rb = ctx->DrawBuffer->_ColorDrawBuffers[0][0];\
struct gl_texture_object *obj = ctx->Texture.Unit[0].Current2D; \
const GLint b = obj->BaseLevel; \
@@ -178,12 +177,7 @@ _swrast_culltriangle( GLcontext *ctx,
span.intTex[0] += span.intTexStep[0]; \
span.intTex[1] += span.intTexStep[1]; \
} \
if (swrast->Driver.WriteRGBSpan) \
swrast->Driver.WriteRGBSpan(ctx, rb, span.end, span.x, span.y, \
(CONST GLchan (*)[3]) span.array->rgb,\
NULL ); \
else \
rb->PutRowRGB(ctx, rb, span.end, span.x, span.y, span.array->rgb, NULL);
rb->PutRowRGB(ctx, rb, span.end, span.x, span.y, span.array->rgb, NULL);
#include "s_tritemp.h"
@@ -205,7 +199,6 @@ _swrast_culltriangle( GLcontext *ctx,
#define T_SCALE theight
#define SETUP_CODE \
SWcontext *swrast = SWRAST_CONTEXT(ctx); \
struct gl_renderbuffer *rb = ctx->DrawBuffer->_ColorDrawBuffers[0][0];\
struct gl_texture_object *obj = ctx->Texture.Unit[0].Current2D; \
const GLint b = obj->BaseLevel; \
@@ -244,12 +237,7 @@ _swrast_culltriangle( GLcontext *ctx,
span.intTex[1] += span.intTexStep[1]; \
span.z += span.zStep; \
} \
if (swrast->Driver.WriteRGBSpan) \
swrast->Driver.WriteRGBSpan(ctx, rb, span.end, span.x, span.y, \
(CONST GLchan (*)[3]) span.array->rgb,\
span.array->mask ); \
else \
rb->PutRowRGB(ctx, rb, span.end, span.x, span.y, span.array->rgb, NULL);
rb->PutRowRGB(ctx, rb, span.end, span.x, span.y, span.array->rgb, NULL);
#include "s_tritemp.h"

View File

@@ -257,7 +257,7 @@ _swrast_copy_texsubimage3d(GLcontext *ctx,
* Unless otherwise noted, all functions are mandatory.
*/
struct swrast_device_driver {
#if OLD_RENDERBUFFER
#if OLD_RENDERBUFFER || NEW_RENDERBUFFER
void (*SetBuffer)(GLcontext *ctx, GLframebuffer *buffer, GLuint bufferBit);
/*
* Specifies the current color buffer for span/pixel writing/reading.
@@ -289,181 +289,6 @@ struct swrast_device_driver {
* these functions. Locking in that case must be organized by the
* driver by other mechanisms.
*/
/***
*** Functions for writing pixels to the frame buffer:
***/
void (*WriteRGBASpan)( const GLcontext *ctx, struct gl_renderbuffer *rb,
GLuint n, GLint x, GLint y,
CONST GLchan rgba[][4], const GLubyte mask[] );
void (*WriteRGBSpan)( const GLcontext *ctx, struct gl_renderbuffer *rb,
GLuint n, GLint x, GLint y,
CONST GLchan rgb[][3], const GLubyte mask[] );
/* Write a horizontal run of RGBA or RGB pixels.
* If mask is NULL, draw all pixels.
* If mask is not null, only draw pixel [i] when mask [i] is true.
*/
void (*WriteMonoRGBASpan)( const GLcontext *ctx, struct gl_renderbuffer *rb,
GLuint n, GLint x, GLint y,
const GLchan color[4], const GLubyte mask[] );
/* Write a horizontal run of RGBA pixels all with the same color.
* If mask is NULL, draw all pixels.
* If mask is not null, only draw pixel [i] when mask [i] is true.
*/
void (*WriteRGBAPixels)( const GLcontext *ctx, struct gl_renderbuffer *rb,
GLuint n, const GLint x[], const GLint y[],
CONST GLchan rgba[][4], const GLubyte mask[] );
/* Write array of RGBA pixels at random locations.
*/
void (*WriteMonoRGBAPixels)( const GLcontext *ctx,
struct gl_renderbuffer *rb,
GLuint n, const GLint x[], const GLint y[],
const GLchan color[4], const GLubyte mask[] );
/* Write an array of mono-RGBA pixels at random locations.
*/
#if OLD_RENDERBUFFER /* these are obsolete */
void (*WriteCI32Span)( const GLcontext *ctx, struct gl_renderbuffer *rb,
GLuint n, GLint x, GLint y,
const GLuint index[], const GLubyte mask[] );
void (*WriteCI8Span)( const GLcontext *ctx, struct gl_renderbuffer *rb,
GLuint n, GLint x, GLint y,
const GLubyte index[], const GLubyte mask[] );
/* Write a horizontal run of CI pixels. One function is for 32bpp
* indexes and the other for 8bpp pixels (the common case). You mus
* implement both for color index mode.
* If mask is NULL, draw all pixels.
* If mask is not null, only draw pixel [i] when mask [i] is true.
*/
void (*WriteMonoCISpan)( const GLcontext *ctx, struct gl_renderbuffer *rb,
GLuint n, GLint x, GLint y,
GLuint colorIndex, const GLubyte mask[] );
/* Write a horizontal run of color index pixels using the color index
* last specified by the Index() function.
* If mask is NULL, draw all pixels.
* If mask is not null, only draw pixel [i] when mask [i] is true.
*/
void (*WriteCI32Pixels)( const GLcontext *ctx, struct gl_renderbuffer *rb,
GLuint n, const GLint x[], const GLint y[],
const GLuint index[], const GLubyte mask[] );
/*
* Write a random array of CI pixels.
*/
void (*WriteMonoCIPixels)( const GLcontext *ctx, struct gl_renderbuffer *rb, GLuint n, const GLint x[], const GLint y[],
GLuint colorIndex, const GLubyte mask[] );
/* Write a random array of color index pixels using the color index
* last specified by the Index() function.
*/
/***
*** Functions to read pixels from frame buffer:
***/
void (*ReadCI32Span)( const GLcontext *ctx, struct gl_renderbuffer *rb,
GLuint n, GLint x, GLint y, GLuint index[] );
/* Read a horizontal run of color index pixels.
*/
void (*ReadCI32Pixels)( const GLcontext *ctx, struct gl_renderbuffer *rb,
GLuint n, const GLint x[], const GLint y[],
GLuint indx[], const GLubyte mask[] );
/* Read a random array of CI pixels.
*/
#endif
void (*ReadRGBASpan)( const GLcontext *ctx, struct gl_renderbuffer *rb,
GLuint n, GLint x, GLint y, GLchan rgba[][4] );
/* Read a horizontal run of RGBA pixels.
*/
void (*ReadRGBAPixels)( const GLcontext *ctx, struct gl_renderbuffer *rb,
GLuint n, const GLint x[], const GLint y[],
GLchan rgba[][4], const GLubyte mask[] );
/* Read a random array of RGBA pixels.
*/
/***
*** For supporting hardware Z buffers:
*** Either ALL or NONE of these functions must be implemented!
*** NOTE that Each depth value is a 32-bit GLuint. If the depth
*** buffer is less than 32 bits deep then the extra upperbits are zero.
***/
void (*WriteDepthSpan)( GLcontext *ctx, struct gl_renderbuffer *rb,
GLuint n, GLint x, GLint y,
const GLdepth depth[], const GLubyte mask[] );
/* Write a horizontal span of values into the depth buffer. Only write
* depth[i] value if mask[i] is nonzero.
*/
void (*WriteMonoDepthSpan)( GLcontext *ctx, struct gl_renderbuffer *rb,
GLuint n, GLint x, GLint y,
const GLdepth depth, const GLubyte mask[] );
/* Write a horizontal run of depth values.
* If mask is NULL, draw all pixels.
* If mask is not null, only draw pixel [i] when mask [i] is true.
*/
void (*ReadDepthSpan)( GLcontext *ctx, struct gl_renderbuffer *rb,
GLuint n, GLint x, GLint y, GLdepth depth[] );
/* Read a horizontal span of values from the depth buffer.
*/
void (*WriteDepthPixels)( GLcontext *ctx, struct gl_renderbuffer *rb,
GLuint n, const GLint x[], const GLint y[],
const GLdepth depth[], const GLubyte mask[] );
/* Write an array of randomly positioned depth values into the
* depth buffer. Only write depth[i] value if mask[i] is nonzero.
*/
void (*ReadDepthPixels)( GLcontext *ctx, struct gl_renderbuffer *rb,
GLuint n, const GLint x[], const GLint y[],
GLdepth depth[] );
/* Read an array of randomly positioned depth values from the depth buffer.
*/
/***
*** For supporting hardware stencil buffers:
*** Either ALL or NONE of these functions must be implemented!
***/
void (*WriteStencilSpan)( GLcontext *ctx, struct gl_renderbuffer *rb,
GLuint n, GLint x, GLint y,
const GLstencil stencil[], const GLubyte mask[] );
/* Write a horizontal span of stencil values into the stencil buffer.
* If mask is NULL, write all stencil values.
* Else, only write stencil[i] if mask[i] is non-zero.
*/
void (*ReadStencilSpan)( GLcontext *ctx, struct gl_renderbuffer *rb,
GLuint n, GLint x, GLint y, GLstencil stencil[] );
/* Read a horizontal span of stencil values from the stencil buffer.
*/
void (*WriteStencilPixels)( GLcontext *ctx, struct gl_renderbuffer *rb,
GLuint n, const GLint x[], const GLint y[],
const GLstencil stencil[],
const GLubyte mask[] );
/* Write an array of stencil values into the stencil buffer.
* If mask is NULL, write all stencil values.
* Else, only write stencil[i] if mask[i] is non-zero.
*/
void (*ReadStencilPixels)( GLcontext *ctx, struct gl_renderbuffer *rb,
GLuint n, const GLint x[], const GLint y[],
GLstencil stencil[] );
/* Read an array of stencil values from the stencil buffer.
*/
};

View File

@@ -95,7 +95,11 @@ _tnl_CreateContext( GLcontext *ctx )
_tnl_save_init( ctx );
_tnl_array_init( ctx );
_tnl_vtx_init( ctx );
_tnl_install_pipeline( ctx, _tnl_default_pipeline );
if (ctx->_MaintainTnlProgram)
_tnl_install_pipeline( ctx, _tnl_vp_pipeline );
else
_tnl_install_pipeline( ctx, _tnl_default_pipeline );
/* Initialize the arrayelt helper
*/
@@ -140,6 +144,8 @@ _tnl_DestroyContext( GLcontext *ctx )
_tnl_destroy_pipeline( ctx );
_ae_destroy_context( ctx );
_tnl_ProgramCacheDestroy( ctx );
FREE(tnl);
ctx->swtnl_context = NULL;
}

View File

@@ -614,6 +614,15 @@ struct tnl_clipspace
};
struct tnl_cache {
GLuint hash;
void *key;
void *data;
struct tnl_cache *next;
};
struct tnl_device_driver
{
/***
@@ -769,6 +778,8 @@ typedef struct
GLvertexformat exec_vtxfmt;
GLvertexformat save_vtxfmt;
struct tnl_cache *vp_cache;
} TNLcontext;

View File

@@ -131,9 +131,8 @@ void _tnl_run_pipeline( GLcontext *ctx )
* (ie const or non-const).
*/
if (check_input_changes( ctx ) || tnl->pipeline.new_state) {
#if TNL_FIXED_FUNCTION_PROGRAM
_tnl_UpdateFixedFunctionProgram( ctx );
#endif
if (ctx->_MaintainTnlProgram)
_tnl_UpdateFixedFunctionProgram( ctx );
for (i = 0; i < tnl->pipeline.nr_stages ; i++) {
struct tnl_pipeline_stage *s = &tnl->pipeline.stages[i];
@@ -197,9 +196,6 @@ void _tnl_run_pipeline( GLcontext *ctx )
* case, if it becomes necessary to do so.
*/
const struct tnl_pipeline_stage *_tnl_default_pipeline[] = {
#if TNL_FIXED_FUNCTION_PROGRAM
&_tnl_arb_vertex_program_stage,
#else
&_tnl_vertex_transform_stage,
&_tnl_normal_transform_stage,
&_tnl_lighting_stage,
@@ -208,9 +204,15 @@ const struct tnl_pipeline_stage *_tnl_default_pipeline[] = {
&_tnl_texture_transform_stage,
&_tnl_point_attenuation_stage,
#if defined(FEATURE_NV_vertex_program) || defined(FEATURE_ARB_vertex_program)
&_tnl_vertex_program_stage,
#endif
&_tnl_arb_vertex_program_stage,
&_tnl_vertex_program_stage,
#endif
&_tnl_render_stage,
NULL
};
const struct tnl_pipeline_stage *_tnl_vp_pipeline[] = {
&_tnl_arb_vertex_program_stage,
&_tnl_render_stage,
NULL
};

View File

@@ -59,6 +59,7 @@ extern const struct tnl_pipeline_stage _tnl_render_stage;
/* Shorthand to plug in the default pipeline:
*/
extern const struct tnl_pipeline_stage *_tnl_default_pipeline[];
extern const struct tnl_pipeline_stage *_tnl_vp_pipeline[];
/* Convenience routines provided by t_vb_render.c:

File diff suppressed because it is too large Load Diff

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