Merge commit 'origin/master' into radeon-rewrite
Conflicts: src/mesa/drivers/dri/r200/r200_state.c src/mesa/drivers/dri/r300/r300_context.h src/mesa/drivers/dri/r300/r300_fragprog.c src/mesa/drivers/dri/r300/r300_state.c src/mesa/drivers/dri/r300/r300_texmem.c src/mesa/drivers/dri/r300/r300_texstate.c src/mesa/drivers/dri/r300/r500_fragprog.c src/mesa/drivers/dri/radeon/radeon_screen.c src/mesa/drivers/dri/radeon/radeon_state.c
This commit is contained in:
@@ -181,7 +181,7 @@ ultrix-gcc:
|
||||
|
||||
# Rules for making release tarballs
|
||||
|
||||
VERSION=7.5-devel
|
||||
VERSION=7.6-devel
|
||||
DIRECTORY = Mesa-$(VERSION)
|
||||
LIB_NAME = MesaLib-$(VERSION)
|
||||
DEMO_NAME = MesaDemos-$(VERSION)
|
||||
|
||||
+5
-5
@@ -41,16 +41,16 @@ else:
|
||||
default_drivers = 'all'
|
||||
default_winsys = 'all'
|
||||
|
||||
opts = Options('config.py')
|
||||
opts = Variables('config.py')
|
||||
common.AddOptions(opts)
|
||||
opts.Add(ListOption('statetrackers', 'state trackers to build', default_statetrackers,
|
||||
opts.Add(ListVariable('statetrackers', 'state trackers to build', default_statetrackers,
|
||||
['mesa', 'python']))
|
||||
opts.Add(ListOption('drivers', 'pipe drivers to build', default_drivers,
|
||||
opts.Add(ListVariable('drivers', 'pipe drivers to build', default_drivers,
|
||||
['softpipe', 'failover', 'i915simple', 'i965simple', 'cell', 'trace', 'r300']))
|
||||
opts.Add(ListOption('winsys', 'winsys drivers to build', default_winsys,
|
||||
opts.Add(ListVariable('winsys', 'winsys drivers to build', default_winsys,
|
||||
['xlib', 'intel', 'gdi', 'radeon']))
|
||||
|
||||
opts.Add(EnumOption('MSVS_VERSION', 'MS Visual C++ version', None, allowed_values=('7.1', '8.0', '9.0')))
|
||||
opts.Add(EnumVariable('MSVS_VERSION', 'MS Visual C++ version', None, allowed_values=('7.1', '8.0', '9.0')))
|
||||
|
||||
env = Environment(
|
||||
options = opts,
|
||||
|
||||
@@ -176,6 +176,23 @@ if [ ${ARCH} = "auto" ] ; then
|
||||
fi
|
||||
|
||||
|
||||
if [ $STATIC = 1 ]; then
|
||||
# filter out linker options inside object list
|
||||
NEWOBJECTS=""
|
||||
for OBJ in $OBJECTS ; do
|
||||
case $OBJ in
|
||||
-Wl,*)
|
||||
echo "mklib: warning: ignoring $OBJ for static library"
|
||||
;;
|
||||
*)
|
||||
NEWOBJECTS="$NEWOBJECTS $OBJ"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
OBJECTS=$NEWOBJECTS
|
||||
fi
|
||||
|
||||
|
||||
#
|
||||
# Error checking
|
||||
#
|
||||
@@ -264,18 +281,21 @@ case $ARCH in
|
||||
# expand any .a objects into constituent .o files.
|
||||
NEWOBJECTS=""
|
||||
DELETIA=""
|
||||
for OBJ in ${OBJECTS} ; do
|
||||
if [ `expr match $OBJ '.*\.a'` -gt 0 ] ; then
|
||||
# extract the .o files from this .a archive
|
||||
FILES=`ar t $OBJ`
|
||||
ar x $OBJ
|
||||
NEWOBJECTS="$NEWOBJECTS $FILES"
|
||||
# keep track of temporary .o files and delete them below
|
||||
DELETIA="$DELETIA $FILES"
|
||||
else
|
||||
# ordinary .o file
|
||||
NEWOBJECTS="$NEWOBJECTS $OBJ"
|
||||
fi
|
||||
for OBJ in $OBJECTS ; do
|
||||
case $OBJ in
|
||||
*.a)
|
||||
# extract the .o files from this .a archive
|
||||
FILES=`ar t $OBJ`
|
||||
ar x $OBJ
|
||||
NEWOBJECTS="$NEWOBJECTS $FILES"
|
||||
# keep track of temporary .o files and delete them below
|
||||
DELETIA="$DELETIA $FILES"
|
||||
;;
|
||||
*)
|
||||
# ordinary .o file
|
||||
NEWOBJECTS="$NEWOBJECTS $OBJ"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# make lib
|
||||
|
||||
@@ -46,13 +46,13 @@ else:
|
||||
|
||||
def AddOptions(opts):
|
||||
try:
|
||||
from SCons.Options.BoolOption import BoolOption
|
||||
except ImportError:
|
||||
from SCons.Variables.BoolVariable import BoolVariable as BoolOption
|
||||
try:
|
||||
from SCons.Options.EnumOption import EnumOption
|
||||
except ImportError:
|
||||
from SCons.Options.BoolOption import BoolOption
|
||||
try:
|
||||
from SCons.Variables.EnumVariable import EnumVariable as EnumOption
|
||||
except ImportError:
|
||||
from SCons.Options.EnumOption import EnumOption
|
||||
opts.Add(BoolOption('debug', 'debug build', 'no'))
|
||||
opts.Add(BoolOption('profile', 'profile build', 'no'))
|
||||
#opts.Add(BoolOption('quiet', 'quiet command lines', 'no'))
|
||||
|
||||
+1
-1
@@ -9,7 +9,7 @@ CONFIG_NAME = default
|
||||
|
||||
# Version info
|
||||
MESA_MAJOR=7
|
||||
MESA_MINOR=3
|
||||
MESA_MINOR=6
|
||||
MESA_TINY=0
|
||||
MESA_VERSION = $(MESA_MAJOR).$(MESA_MINOR).$(MESA_TINY)
|
||||
|
||||
|
||||
@@ -22,7 +22,5 @@ GLUT_LIB_DEPS =
|
||||
GLW_LIB_DEPS =
|
||||
|
||||
# Need to specify all libraries we may need
|
||||
APP_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLU_LIB) -Wl,--start-group \
|
||||
-l$(GL_LIB) $(TOP)/src/mesa/pipe/softpipe/libsoftpipe.a -Wl,--end-group -lm \
|
||||
-L/usr/X11R6/lib/ -lX11 -lXext -lXmu -lXi -lpthread
|
||||
|
||||
APP_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLU_LIB) \
|
||||
-l$(GL_LIB) -lm -L/usr/X11R6/lib/ -lX11 -lXext -lXmu -lXi -lpthread
|
||||
|
||||
@@ -4,4 +4,5 @@ include $(TOP)/configs/linux-x86-64
|
||||
|
||||
CONFIG_NAME = linux-x86-64-debug
|
||||
|
||||
OPT_FLAGS = -g
|
||||
DEFINES += -DDEBUG -DDEBUG_MATH
|
||||
|
||||
@@ -22,6 +22,5 @@ GLUT_LIB_DEPS =
|
||||
GLW_LIB_DEPS =
|
||||
|
||||
# Need to specify all libraries we may need
|
||||
APP_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLU_LIB) -Wl,--start-group \
|
||||
-l$(GL_LIB) $(TOP)/src/mesa/pipe/softpipe/libsoftpipe.a -Wl,--end-group \
|
||||
$(EXTRA_LIB_PATH) -lX11 -lXext -lXmu -lXt -lXi -lpthread -lstdc++ -lm
|
||||
APP_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLU_LIB) \
|
||||
-l$(GL_LIB) $(EXTRA_LIB_PATH) -lX11 -lXext -lXmu -lXt -lXi -lpthread -lstdc++ -lm
|
||||
|
||||
+35
-25
@@ -5,12 +5,8 @@ AC_PREREQ([2.59])
|
||||
dnl Versioning - scrape the version from configs/default
|
||||
m4_define([mesa_version],
|
||||
[m4_esyscmd([${MAKE-make} -s -f bin/version.mk version | tr -d '\n'])])
|
||||
m4_ifval(mesa_version,[],[
|
||||
m4_errprint([Error: Failed to get the Mesa version from the output of
|
||||
running `make -f bin/version.mk version'
|
||||
])
|
||||
m4_exit([1])
|
||||
])
|
||||
m4_ifval(mesa_version,,
|
||||
[m4_fatal([Failed to get the Mesa version from `make -f bin/version.mk version`])])
|
||||
|
||||
dnl Tell the user about autoconf.html in the --help output
|
||||
m4_divert_once([HELP_END], [
|
||||
@@ -58,15 +54,11 @@ fi
|
||||
AC_SUBST([MKDEP_OPTIONS])
|
||||
|
||||
dnl Make sure the pkg-config macros are defined
|
||||
m4_ifdef([PKG_PROG_PKG_CONFIG],[],[
|
||||
m4_errprint([Error: Could not locate the pkg-config autoconf macros.
|
||||
These are usually located in /usr/share/aclocal/pkg.m4. If your
|
||||
macros are in a different location, try setting the environment
|
||||
variable ACLOCAL="aclocal -I/other/macro/dir" before running
|
||||
autoreconf.
|
||||
])
|
||||
m4_exit([1])
|
||||
])
|
||||
m4_ifndef([PKG_PROG_PKG_CONFIG],
|
||||
[m4_fatal([Could not locate the pkg-config autoconf macros.
|
||||
These are usually located in /usr/share/aclocal/pkg.m4. If your macros
|
||||
are in a different location, try setting the environment variable
|
||||
ACLOCAL="aclocal -I/other/macro/dir" before running autoreconf.])])
|
||||
PKG_PROG_PKG_CONFIG()
|
||||
|
||||
dnl LIB_DIR - library basename
|
||||
@@ -87,7 +79,7 @@ dnl Compiler macros
|
||||
DEFINES=""
|
||||
AC_SUBST([DEFINES])
|
||||
case "$host_os" in
|
||||
linux*|*-gnu*)
|
||||
linux*|*-gnu*|gnu*)
|
||||
DEFINES="$DEFINES -D_GNU_SOURCE -DPTHREADS"
|
||||
;;
|
||||
solaris*)
|
||||
@@ -411,7 +403,7 @@ esac
|
||||
dnl
|
||||
dnl Driver specific build directories
|
||||
dnl
|
||||
SRC_DIRS="mesa egl glew"
|
||||
SRC_DIRS="mesa glew"
|
||||
GLU_DIRS="sgi"
|
||||
WINDOW_SYSTEM=""
|
||||
GALLIUM_DIRS="auxiliary drivers state_trackers"
|
||||
@@ -751,6 +743,10 @@ if test "$mesa_driver" = dri; then
|
||||
unichrome savage sis swrast"
|
||||
fi
|
||||
;;
|
||||
gnu*)
|
||||
DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER"
|
||||
DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING -DHAVE_ALIAS"
|
||||
;;
|
||||
solaris*)
|
||||
DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER"
|
||||
DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING"
|
||||
@@ -870,14 +866,23 @@ AC_SUBST([OSMESA_PC_LIB_PRIV])
|
||||
dnl
|
||||
dnl EGL configuration
|
||||
dnl
|
||||
if test "$x11_pkgconfig" = yes; then
|
||||
PKG_CHECK_MODULES([EGL],[x11])
|
||||
EGL_LIB_DEPS="$EGL_LIBS"
|
||||
else
|
||||
# should check these...
|
||||
EGL_LIB_DEPS="$X_LIBS -lX11"
|
||||
AC_ARG_ENABLE([egl],
|
||||
[AS_HELP_STRING([--disable-egl],
|
||||
[disable EGL library @<:@default=enabled@:>@])],
|
||||
[enable_egl="$enableval"],
|
||||
[enable_egl=yes])
|
||||
if test "x$enable_egl" = xyes; then
|
||||
SRC_DIRS="$SRC_DIRS egl"
|
||||
|
||||
if test "$x11_pkgconfig" = yes; then
|
||||
PKG_CHECK_MODULES([EGL], [x11])
|
||||
EGL_LIB_DEPS="$EGL_LIBS"
|
||||
else
|
||||
# should check these...
|
||||
EGL_LIB_DEPS="$X_LIBS -lX11"
|
||||
fi
|
||||
EGL_LIB_DEPS="$EGL_LIB_DEPS $DLOPEN_LIBS"
|
||||
fi
|
||||
EGL_LIB_DEPS="$EGL_LIB_DEPS $DLOPEN_LIBS"
|
||||
AC_SUBST([EGL_LIB_DEPS])
|
||||
|
||||
dnl
|
||||
@@ -1121,7 +1126,7 @@ yes)
|
||||
GALLIUM_STATE_TRACKERS_DIRS=glx
|
||||
;;
|
||||
dri)
|
||||
GALLIUM_STATE_TRACKERS_DIRS=egl
|
||||
test "x$enable_egl" = xyes && GALLIUM_STATE_TRACKERS_DIRS=egl
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
@@ -1131,6 +1136,10 @@ yes)
|
||||
for tracker in $state_trackers; do
|
||||
test -d "$srcdir/src/gallium/state_trackers/$tracker" || \
|
||||
AC_MSG_ERROR([state tracker '$tracker' doesn't exist])
|
||||
|
||||
if test "$tracker" = egl && test "x$enable_egl" != xyes; then
|
||||
AC_MSG_ERROR([cannot build egl state tracker without EGL library])
|
||||
fi
|
||||
done
|
||||
GALLIUM_STATE_TRACKERS_DIRS="$state_trackers"
|
||||
;;
|
||||
@@ -1246,6 +1255,7 @@ dnl Libraries
|
||||
echo ""
|
||||
echo " Shared libs: $enable_shared"
|
||||
echo " Static libs: $enable_static"
|
||||
echo " EGL: $enable_egl"
|
||||
echo " GLU: $enable_glu"
|
||||
echo " GLw: $enable_glw (Motif: $enable_motif)"
|
||||
echo " glut: $enable_glut"
|
||||
|
||||
@@ -8,12 +8,6 @@
|
||||
|
||||
<H1>Downloading</H1>
|
||||
|
||||
<p>
|
||||
Current development release: <b>7.3</b>
|
||||
<br>
|
||||
Last stable release: <b>7.2</b>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Primary download site:
|
||||
<a href="http://sourceforge.net/project/showfiles.php?group_id=3"
|
||||
|
||||
@@ -11,6 +11,26 @@
|
||||
<H1>News</H1>
|
||||
|
||||
|
||||
<h2>May tbd, 2009</h2>
|
||||
<p>
|
||||
<a href="relnotes-7.5.html">Mesa 7.5</a> is released.
|
||||
</p>
|
||||
|
||||
|
||||
<h2>April 18, 2009</h2>
|
||||
<p>
|
||||
<a href="relnotes-7.4.1.html">Mesa 7.4.1</a> is released.
|
||||
This is a stable release fixing bugs since the 7.4 release.
|
||||
</p>
|
||||
|
||||
|
||||
<h2>March 27, 2009</h2>
|
||||
<p>
|
||||
<a href="relnotes-7.4.html">Mesa 7.4</a> is released.
|
||||
This is a stable release fixing bugs since the 7.3 release.
|
||||
</p>
|
||||
|
||||
|
||||
<h2>January 22, 2009</h2>
|
||||
<p>
|
||||
<a href="relnotes-7.3.html">Mesa 7.3</a> is released.
|
||||
|
||||
@@ -0,0 +1,79 @@
|
||||
<HTML>
|
||||
|
||||
<TITLE>Mesa Release Notes</TITLE>
|
||||
|
||||
<head><link rel="stylesheet" type="text/css" href="mesa.css"></head>
|
||||
|
||||
<BODY>
|
||||
|
||||
<body bgcolor="#eeeeee">
|
||||
|
||||
<H1>Mesa 7.4.1 Release Notes / 18 April 2009</H1>
|
||||
|
||||
<p>
|
||||
Mesa 7.4.1 is a stable development release fixing bugs since the 7.4 release.
|
||||
</p>
|
||||
<p>
|
||||
Mesa 7.4.1 implements the OpenGL 2.1 API, but the version reported by
|
||||
glGetString(GL_VERSION) depends on the particular driver being used.
|
||||
Some drivers don't support all the features required in OpenGL 2.1.
|
||||
</p>
|
||||
<p>
|
||||
See the <a href="install.html">Compiling/Installing page</a> for prerequisites
|
||||
for DRI hardware acceleration.
|
||||
</p>
|
||||
|
||||
|
||||
<h2>MD5 checksums</h2>
|
||||
<pre>
|
||||
0c3a72f3295a53a134c04bd7d209ea62 MesaLib-7.4.1.tar.gz
|
||||
423260578b653818ba66c2fcbde6d7ad MesaLib-7.4.1.tar.bz2
|
||||
84f78b154d4bd5c3ecc42eeff2e56676 MesaLib-7.4.1.zip
|
||||
aa0ad323e59d6d10ff33ac0dde462a60 MesaDemos-7.4.1.tar.gz
|
||||
1e169fb6abc2b45613f1c98a82dfe690 MesaDemos-7.4.1.tar.bz2
|
||||
294e42be2d74176596c994ec23322fcf MesaDemos-7.4.1.zip
|
||||
92373bfa48e7b68dddf356e86b0e5699 MesaGLUT-7.4.1.tar.gz
|
||||
336f3824b578b072211e0beecf4f04f4 MesaGLUT-7.4.1.tar.bz2
|
||||
20751388d8ef16b42d25d9e3d705d101 MesaGLUT-7.4.1.zip
|
||||
</pre>
|
||||
|
||||
|
||||
<h2>Bug fixes</h2>
|
||||
<ul>
|
||||
<li>Fixed a two-sided lighting bug in fixed-function-to-GPU code generation
|
||||
<li>Fixed some Darwin issues (Jeremy Huddleston)
|
||||
<li>Indexing the GLSL gl_EyePlane[] or gl_ObjectPlane[] arrays with a variable
|
||||
was broken, bug 20986
|
||||
<li>Fixed incorrect texture unit bias in TXB instruction
|
||||
<li>glTexParameter settings weren't always propogated to drivers
|
||||
<li>Assorted vertex/fragment program bug fixes
|
||||
<li>Fixed point rendering in software rasterizer
|
||||
<li>Fixed potential deadlock in object hash functions
|
||||
<li>Fix a couple bugs surrounding front-buffer rendering with DRI2, but this
|
||||
is not quite complete.
|
||||
<li>Fixed glPopAttrib() bug when restoring user clip planes
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
<h2>Driver Status</h2>
|
||||
|
||||
<pre>
|
||||
Driver Status
|
||||
---------------------- ----------------------
|
||||
DRI drivers varies with the driver
|
||||
XMesa/GLX (on Xlib) implements OpenGL 2.1
|
||||
OSMesa (off-screen) implements OpenGL 2.1
|
||||
Windows/Win32 implements OpenGL 2.1
|
||||
Glide (3dfx Voodoo1/2) implements OpenGL 1.3
|
||||
SVGA unsupported
|
||||
Wind River UGL unsupported
|
||||
DJGPP unsupported
|
||||
GGI unsupported
|
||||
BeOS unsupported
|
||||
Allegro unsupported
|
||||
D3D unsupported
|
||||
</pre>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
+23
-3
@@ -8,7 +8,7 @@
|
||||
|
||||
<body bgcolor="#eeeeee">
|
||||
|
||||
<H1>Mesa 7.4 Release Notes / date TBD</H1>
|
||||
<H1>Mesa 7.4 Release Notes / 27 March 2009</H1>
|
||||
|
||||
<p>
|
||||
Mesa 7.4 is a stable development release fixing bugs since the 7.3 release.
|
||||
@@ -20,28 +20,48 @@ Some drivers don't support all the features required in OpenGL 2.1.
|
||||
</p>
|
||||
<p>
|
||||
See the <a href="install.html">Compiling/Installing page</a> for prerequisites
|
||||
for DRI ardware acceleration.
|
||||
for DRI hardware acceleration.
|
||||
</p>
|
||||
|
||||
|
||||
<h2>MD5 checksums</h2>
|
||||
<pre>
|
||||
tbd
|
||||
ed6bd7437177307e51e16d0c7c381dfa MesaLib-7.4.tar.gz
|
||||
7ecddb341a2691e0dfdb02f697109834 MesaLib-7.4.tar.bz2
|
||||
433e823f8245f9fd5f397e7b719a8e47 MesaLib-7.4.zip
|
||||
656eee6128016fb237e01aa8dabbc703 MesaDemos-7.4.tar.gz
|
||||
02816f10f30b1dc5e069e0f68c177c98 MesaDemos-7.4.tar.bz2
|
||||
44a70d6db4aa4c64ecc47871b6aceee8 MesaDemos-7.4.zip
|
||||
25f80db4f8645cd3e58e2c9af53ec341 MesaGLUT-7.4.tar.gz
|
||||
04ec01caebde44f5b0d619f00716b368 MesaGLUT-7.4.tar.bz2
|
||||
019dc213baecaa3cb1278847d41b8591 MesaGLUT-7.4.zip
|
||||
</pre>
|
||||
|
||||
|
||||
<h2>New features</h2>
|
||||
<ul>
|
||||
<li>Added MESA_GLX_FORCE_DIRECT env var for Xlib/software driver
|
||||
<li>GLSL version 1.20 is returnd by the GL_SHADING_LANGUAGE_VERSION query
|
||||
</ul>
|
||||
|
||||
|
||||
<h2>Bug fixes</h2>
|
||||
<ul>
|
||||
<li>glGetActiveUniform() returned wrong size for some array types
|
||||
<li>Fixed some error checking in glUniform()
|
||||
<li>Fixed a potential glTexImage('proxy target') segfault
|
||||
<li>Fixed bad reference counting for 1D/2D texture arrays
|
||||
<li>Fixed VBO + glPush/PopClientAttrib() bug #19835
|
||||
<li>Assorted i965 driver bug fixes
|
||||
<li>Fixed a Windows compilation failure in s_triangle.c
|
||||
<li>Fixed a GLSL array indexing bug
|
||||
<li>Fixes for building on Haiku
|
||||
</ul>
|
||||
|
||||
<h2>Changes</h2>
|
||||
<ul>
|
||||
<li>Updated GL/glxext.h to version 48
|
||||
<li>Assorted updates for building on Solaris
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
+10
-3
@@ -13,7 +13,7 @@
|
||||
<p>
|
||||
Mesa 7.5 is a new development release.
|
||||
People who are concerned with stability and reliability should stick
|
||||
with the 7.4.x branch or wait for Mesa 7.6.
|
||||
with the 7.4.x branch or wait for Mesa 7.5.1.
|
||||
</p>
|
||||
<p>
|
||||
The main new feature of Mesa 7.5 is the
|
||||
@@ -27,7 +27,14 @@ Some drivers don't support all the features required in OpenGL 2.1.
|
||||
</p>
|
||||
<p>
|
||||
See the <a href="install.html">Compiling/Installing page</a> for prerequisites
|
||||
for DRI ardware acceleration.
|
||||
for DRI hardware acceleration.
|
||||
</p>
|
||||
<p>
|
||||
Note that the Mesa project is no longer using odd/even version numbers
|
||||
to indicate development/stable releases.
|
||||
The so-called development releases have been fairly stable.
|
||||
If you're especially concerned with stability you should probably look for
|
||||
"point" releases such as 7.5.1 which will be a bug-fix release.
|
||||
</p>
|
||||
|
||||
|
||||
@@ -72,7 +79,7 @@ including GL_ATI_separate_stencil, GL_EXT_stencil_two_side and OpenGL 2.0
|
||||
<ul>
|
||||
<li>Remove support for GL_SGIX_shadow, GL_SGIX_shadow_ambient and
|
||||
GL_SGIX_depth_texture extensions. Superseded by the ARB versions.
|
||||
<li>Omittd some old Mesa demos from the release tarballs, added some others.
|
||||
<li>Omitted some old Mesa demos from the release tarballs, added some others.
|
||||
</ul>
|
||||
|
||||
</body>
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
<HTML>
|
||||
|
||||
<TITLE>Mesa Release Notes</TITLE>
|
||||
|
||||
<head><link rel="stylesheet" type="text/css" href="mesa.css"></head>
|
||||
|
||||
<BODY>
|
||||
|
||||
<body bgcolor="#eeeeee">
|
||||
|
||||
<H1>Mesa 7.6 Release Notes / date TBD</H1>
|
||||
|
||||
<p>
|
||||
Mesa 7.6 is a new development release.
|
||||
People who are concerned with stability and reliability should stick
|
||||
with a previous release or wait for Mesa 7.6.1.
|
||||
</p>
|
||||
<p>
|
||||
Mesa 7.6 implements the OpenGL 2.1 API, but the version reported by
|
||||
glGetString(GL_VERSION) depends on the particular driver being used.
|
||||
Some drivers don't support all the features required in OpenGL 2.1.
|
||||
</p>
|
||||
<p>
|
||||
See the <a href="install.html">Compiling/Installing page</a> for prerequisites
|
||||
for DRI hardware acceleration.
|
||||
</p>
|
||||
<p>
|
||||
Note that the Mesa project is no longer using odd/even version numbers
|
||||
to indicate development/stable releases.
|
||||
The so-called development releases have been fairly stable.
|
||||
If you're especially concerned with stability you should probably look for
|
||||
"point" releases such as 7.5.1 which will be a bug-fix release.
|
||||
</p>
|
||||
|
||||
|
||||
<h2>MD5 checksums</h2>
|
||||
<pre>
|
||||
tbd
|
||||
</pre>
|
||||
|
||||
|
||||
<h2>New features</h2>
|
||||
<ul>
|
||||
<li><a href="openvg.html">OpenVG</a> front-end (state tracker for Gallium).
|
||||
This was written by Zack Rusin at Tungsten Graphics.
|
||||
</ul>
|
||||
|
||||
|
||||
<h2>Bug fixes</h2>
|
||||
<ul>
|
||||
<li>i965 DRI driver fixes, including support for "unlimited" size constant
|
||||
buffers (GLSL uniforms)
|
||||
</ul>
|
||||
|
||||
|
||||
<h2>Changes</h2>
|
||||
<ul>
|
||||
</ul>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -20,7 +20,9 @@ The release notes summarize what's new or changed in each Mesa release.
|
||||
</p>
|
||||
|
||||
<UL>
|
||||
<LI><A HREF="relnotes-7.6.html">7.6 release notes</A>
|
||||
<LI><A HREF="relnotes-7.5.html">7.5 release notes</A>
|
||||
<LI><A HREF="relnotes-7.4.1.html">7.4.1 release notes</A>
|
||||
<LI><A HREF="relnotes-7.4.html">7.4 release notes</A>
|
||||
<LI><A HREF="relnotes-7.3.html">7.3 release notes</A>
|
||||
<LI><A HREF="relnotes-7.2.html">7.2 release notes</A>
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
#define DRI_INTERFACE_H
|
||||
|
||||
/* For archs with no drm.h */
|
||||
#if !defined(__APPLE__) && !defined(__CYGWIN__)
|
||||
#if !defined(__APPLE__) && !defined(__CYGWIN__) && !defined(__GNU__)
|
||||
#include <drm.h>
|
||||
#else
|
||||
typedef unsigned int drm_context_t;
|
||||
@@ -649,6 +649,7 @@ struct __DRIswrastExtensionRec {
|
||||
#define __DRI_BUFFER_ACCUM 6
|
||||
#define __DRI_BUFFER_FAKE_FRONT_LEFT 7
|
||||
#define __DRI_BUFFER_FAKE_FRONT_RIGHT 8
|
||||
#define __DRI_BUFFER_DEPTH_STENCIL 9 /**< Only available with DRI2 1.1 */
|
||||
|
||||
struct __DRIbufferRec {
|
||||
unsigned int attachment;
|
||||
@@ -659,7 +660,7 @@ struct __DRIbufferRec {
|
||||
};
|
||||
|
||||
#define __DRI_DRI2_LOADER "DRI_DRI2Loader"
|
||||
#define __DRI_DRI2_LOADER_VERSION 2
|
||||
#define __DRI_DRI2_LOADER_VERSION 3
|
||||
struct __DRIdri2LoaderExtensionRec {
|
||||
__DRIextension base;
|
||||
|
||||
@@ -680,6 +681,31 @@ struct __DRIdri2LoaderExtensionRec {
|
||||
* into __DRIdri2ExtensionRec::createNewDrawable
|
||||
*/
|
||||
void (*flushFrontBuffer)(__DRIdrawable *driDrawable, void *loaderPrivate);
|
||||
|
||||
|
||||
/**
|
||||
* Get list of buffers from the server
|
||||
*
|
||||
* Gets a list of buffer for the specified set of attachments. Unlike
|
||||
* \c ::getBuffers, this function takes a list of attachments paired with
|
||||
* opaque \c unsigned \c int value describing the format of the buffer.
|
||||
* It is the responsibility of the caller to know what the service that
|
||||
* allocates the buffers will expect to receive for the format.
|
||||
*
|
||||
* \param driDrawable Drawable whose buffers are being queried.
|
||||
* \param width Output where the width of the buffers is stored.
|
||||
* \param height Output where the height of the buffers is stored.
|
||||
* \param attachments List of pairs of attachment ID and opaque format
|
||||
* requested for the drawable.
|
||||
* \param count Number of attachment / format pairs stored in
|
||||
* \c attachments.
|
||||
* \param loaderPrivate Loader's private data that was previously passed
|
||||
* into __DRIdri2ExtensionRec::createNewDrawable.
|
||||
*/
|
||||
__DRIbuffer *(*getBuffersWithFormat)(__DRIdrawable *driDrawable,
|
||||
int *width, int *height,
|
||||
unsigned int *attachments, int count,
|
||||
int *out_count, void *loaderPrivate);
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -382,7 +382,7 @@ static GLfloat floorShadow[4][4];
|
||||
static void
|
||||
redraw(void)
|
||||
{
|
||||
int start, end;
|
||||
int start = 0, end = 0;
|
||||
|
||||
if (reportSpeed) {
|
||||
start = glutGet(GLUT_ELAPSED_TIME);
|
||||
@@ -624,6 +624,7 @@ redraw(void)
|
||||
glFinish();
|
||||
end = glutGet(GLUT_ELAPSED_TIME);
|
||||
printf("Speed %.3g frames/sec (%d ms)\n", 1000.0/(end-start), end-start);
|
||||
fflush(stdout);
|
||||
}
|
||||
|
||||
glutSwapBuffers();
|
||||
@@ -878,6 +879,7 @@ main(int argc, char **argv)
|
||||
polygonOffsetVersion = MISSING;
|
||||
printf("\ndinoshine: Missing polygon offset.\n");
|
||||
printf(" Expect shadow depth aliasing artifacts.\n\n");
|
||||
fflush(stdout);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -236,11 +236,28 @@ special(int k, int x, int y)
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
cleanup(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
glDeleteTextures(1, &t1id);
|
||||
glDeleteTextures(1, &t2id);
|
||||
|
||||
glDeleteLists(skydlist, 1);
|
||||
for (i = 0; i < MAX_LOD; i++) {
|
||||
glDeleteLists(LODdlist[i], 1);
|
||||
glDeleteLists(LODnumpoly[i], 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
key(unsigned char k, int x, int y)
|
||||
{
|
||||
switch (k) {
|
||||
case 27:
|
||||
cleanup();
|
||||
exit(0);
|
||||
break;
|
||||
|
||||
@@ -707,6 +724,7 @@ main(int ac, char **av)
|
||||
glutIdleFunc(draw);
|
||||
|
||||
glutMainLoop();
|
||||
cleanup();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
+62
-5
@@ -17,6 +17,7 @@
|
||||
#define IMAGE_FILE "../images/girl.rgb"
|
||||
|
||||
static int ImgWidth, ImgHeight;
|
||||
static int WinWidth, WinHeight;
|
||||
static GLenum ImgFormat;
|
||||
static GLubyte *Image = NULL;
|
||||
|
||||
@@ -27,6 +28,7 @@ static int CPosX, CPosY; /* copypixels */
|
||||
static GLboolean DrawFront = GL_FALSE;
|
||||
static GLboolean ScaleAndBias = GL_FALSE;
|
||||
static GLboolean Benchmark = GL_FALSE;
|
||||
static GLboolean Triangle = GL_FALSE;
|
||||
static GLubyte *TempImage = NULL;
|
||||
|
||||
#define COMBO 1
|
||||
@@ -150,11 +152,60 @@ Display( void )
|
||||
/* draw original image */
|
||||
glRasterPos2i(APosX, 5);
|
||||
PrintString("Original");
|
||||
glRasterPos2i(APosX, APosY);
|
||||
glEnable(GL_DITHER);
|
||||
SetupPixelTransfer(GL_FALSE);
|
||||
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
|
||||
glDrawPixels(ImgWidth, ImgHeight, ImgFormat, GL_UNSIGNED_BYTE, Image);
|
||||
if (!Triangle) {
|
||||
glRasterPos2i(APosX, APosY);
|
||||
glEnable(GL_DITHER);
|
||||
SetupPixelTransfer(GL_FALSE);
|
||||
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
|
||||
glDrawPixels(ImgWidth, ImgHeight, ImgFormat, GL_UNSIGNED_BYTE, Image);
|
||||
}
|
||||
else {
|
||||
float z = 0;
|
||||
|
||||
glViewport(APosX, APosY, ImgWidth, ImgHeight);
|
||||
glMatrixMode( GL_PROJECTION );
|
||||
glLoadIdentity();
|
||||
glOrtho(-1.0, 1.0, -1.0, 1.0, -1.0, 1.0);
|
||||
glDisable(GL_CULL_FACE);
|
||||
|
||||
/* Red should never be seen
|
||||
*/
|
||||
glBegin(GL_POLYGON);
|
||||
glColor3f(1,0,0);
|
||||
glVertex3f(-2, -2, z);
|
||||
glVertex3f(-2, 2, z);
|
||||
glVertex3f(2, 2, z);
|
||||
glVertex3f(2, -2, z);
|
||||
glEnd();
|
||||
|
||||
/* Blue background
|
||||
*/
|
||||
glBegin(GL_POLYGON);
|
||||
glColor3f(.5,.5,1);
|
||||
glVertex3f(-1, -1, z);
|
||||
glVertex3f(-1, 1, z);
|
||||
glVertex3f(1, 1, z);
|
||||
glVertex3f(1, -1, z);
|
||||
glEnd();
|
||||
|
||||
/* Triangle
|
||||
*/
|
||||
glBegin(GL_TRIANGLES);
|
||||
glColor3f(.8,0,0);
|
||||
glVertex3f(-0.9, -0.9, z);
|
||||
glColor3f(0,.9,0);
|
||||
glVertex3f( 0.9, -0.9, z);
|
||||
glColor3f(0,0,.7);
|
||||
glVertex3f( 0.0, 0.9, z);
|
||||
glEnd();
|
||||
|
||||
glColor3f(1,1,1);
|
||||
|
||||
glViewport( 0, 0, WinWidth, WinHeight );
|
||||
glMatrixMode( GL_PROJECTION );
|
||||
glLoadIdentity();
|
||||
glOrtho( 0.0, WinWidth, 0.0, WinHeight, -1.0, 1.0 );
|
||||
}
|
||||
|
||||
/* might try alignment=4 here for testing */
|
||||
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
|
||||
@@ -218,6 +269,9 @@ Display( void )
|
||||
static void
|
||||
Reshape( int width, int height )
|
||||
{
|
||||
WinWidth = width;
|
||||
WinHeight = height;
|
||||
|
||||
glViewport( 0, 0, width, height );
|
||||
glMatrixMode( GL_PROJECTION );
|
||||
glLoadIdentity();
|
||||
@@ -236,6 +290,9 @@ Key( unsigned char key, int x, int y )
|
||||
case 'b':
|
||||
Benchmark = GL_TRUE;
|
||||
break;
|
||||
case 't':
|
||||
Triangle = !Triangle;
|
||||
break;
|
||||
case 's':
|
||||
ScaleAndBias = !ScaleAndBias;
|
||||
break;
|
||||
|
||||
@@ -788,6 +788,7 @@ Key(unsigned char key, int x, int y)
|
||||
exit(0);
|
||||
break;
|
||||
}
|
||||
fflush(stdout);
|
||||
glutPostRedisplay();
|
||||
}
|
||||
|
||||
@@ -1014,6 +1015,7 @@ PrintHelp(void)
|
||||
printf(" <shift> + cursor keys = rotate light source\n");
|
||||
if (HaveEXTshadowFuncs)
|
||||
printf(" o = cycle through comparison modes\n");
|
||||
fflush(stdout);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -173,10 +173,20 @@ static void special(int k, int x, int y)
|
||||
}
|
||||
}
|
||||
|
||||
static void cleanup(void)
|
||||
{
|
||||
glDeleteTextures(1, &t1id);
|
||||
glDeleteTextures(1, &t2id);
|
||||
glDeleteLists(teapotdlist, 1);
|
||||
glDeleteLists(basedlist, 1);
|
||||
glDeleteLists(lightdlist, 1);
|
||||
}
|
||||
|
||||
static void key(unsigned char k, int x, int y)
|
||||
{
|
||||
switch(k) {
|
||||
case 27:
|
||||
cleanup();
|
||||
exit(0);
|
||||
break;
|
||||
|
||||
@@ -670,6 +680,7 @@ int main(int ac, char **av)
|
||||
glutIdleFunc(draw);
|
||||
|
||||
glutMainLoop();
|
||||
cleanup();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -202,11 +202,19 @@ special(int k, int x, int y)
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
cleanup(void)
|
||||
{
|
||||
glDeleteTextures(1, &t1id);
|
||||
glDeleteTextures(1, &t2id);
|
||||
}
|
||||
|
||||
static void
|
||||
key(unsigned char k, int x, int y)
|
||||
{
|
||||
switch (k) {
|
||||
case 27:
|
||||
cleanup();
|
||||
exit(0);
|
||||
break;
|
||||
|
||||
@@ -531,5 +539,6 @@ main(int ac, char **av)
|
||||
|
||||
glutMainLoop();
|
||||
|
||||
cleanup();
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -200,6 +200,13 @@ special(int k, int x, int y)
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
cleanup(void)
|
||||
{
|
||||
glDeleteTextures(1, &t1id);
|
||||
glDeleteTextures(1, &t2id);
|
||||
}
|
||||
|
||||
static void
|
||||
key(unsigned char k, int x, int y)
|
||||
{
|
||||
@@ -207,6 +214,7 @@ key(unsigned char k, int x, int y)
|
||||
case 27:
|
||||
glutDestroyWindow(channel[0]);
|
||||
glutDestroyWindow(channel[1]);
|
||||
cleanup();
|
||||
exit(0);
|
||||
break;
|
||||
|
||||
@@ -602,6 +610,7 @@ main(int ac, char **av)
|
||||
calcposobs();
|
||||
|
||||
glutMainLoop();
|
||||
cleanup();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -260,6 +260,8 @@ static void Key( unsigned char key, int x, int y )
|
||||
(void) y;
|
||||
switch (key) {
|
||||
case 27:
|
||||
(*delete_vertex_arrays)( 1, & cube_array_obj );
|
||||
(*delete_vertex_arrays)( 1, & oct_array_obj );
|
||||
glutDestroyWindow(Win);
|
||||
exit(0);
|
||||
break;
|
||||
|
||||
@@ -153,6 +153,7 @@ static void Benchmark( float xdiff, float ydiff )
|
||||
double seconds, fps;
|
||||
|
||||
printf("Benchmarking...\n");
|
||||
fflush(stdout);
|
||||
|
||||
draws = 0;
|
||||
startTime = glutGet(GLUT_ELAPSED_TIME);
|
||||
@@ -169,6 +170,7 @@ static void Benchmark( float xdiff, float ydiff )
|
||||
seconds = (double) (endTime - startTime) / 1000.0;
|
||||
fps = draws / seconds;
|
||||
printf("Result: fps: %g\n", fps);
|
||||
fflush(stdout);
|
||||
}
|
||||
|
||||
|
||||
@@ -263,6 +265,7 @@ void keyboard (unsigned char key, int x, int y)
|
||||
default:
|
||||
break;
|
||||
}
|
||||
fflush(stdout);
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@@ -16,22 +16,20 @@ blendminmax
|
||||
blendsquare
|
||||
blendxor
|
||||
bufferobj
|
||||
bumpmap
|
||||
bug_3050
|
||||
bug_3101
|
||||
bug_3195
|
||||
bug_texstore_i8
|
||||
bumpmap
|
||||
calibrate_rast
|
||||
copypixrate
|
||||
crossbar
|
||||
cva
|
||||
dinoshade
|
||||
drawbuffers
|
||||
extfuncs.h
|
||||
exactrast
|
||||
fbotest1
|
||||
fbotest2
|
||||
fbotexture
|
||||
fillrate
|
||||
floattex
|
||||
fog
|
||||
@@ -40,6 +38,7 @@ fptest1
|
||||
fptexture
|
||||
getprocaddress
|
||||
getproclist.h
|
||||
glutfx
|
||||
interleave
|
||||
invert
|
||||
jkrahntest
|
||||
@@ -49,6 +48,7 @@ mapbufrange
|
||||
mapvbo
|
||||
minmag
|
||||
mipgen
|
||||
mipmap_comp
|
||||
mipmap_limits
|
||||
mipmap_view
|
||||
multipal
|
||||
@@ -56,7 +56,6 @@ no_s3tc
|
||||
packedpixels
|
||||
pbo
|
||||
prog_parameter
|
||||
projtex
|
||||
quads
|
||||
random
|
||||
readrate
|
||||
@@ -64,22 +63,22 @@ readtex.c
|
||||
readtex.h
|
||||
rubberband
|
||||
seccolor
|
||||
sharedtex
|
||||
shader_api
|
||||
shaderutil.c
|
||||
shaderutil.h
|
||||
sharedtex
|
||||
stencil_twoside
|
||||
stencil_wrap
|
||||
stencilwrap
|
||||
stencil_wrap
|
||||
streaming_rect
|
||||
subtex
|
||||
subtexrate
|
||||
tex1d
|
||||
texcmp
|
||||
texcompress2
|
||||
texdown
|
||||
texfilt
|
||||
texgenmix
|
||||
texline
|
||||
texobj
|
||||
texobjshare
|
||||
texrect
|
||||
texwrap
|
||||
|
||||
@@ -58,6 +58,7 @@ SOURCES = \
|
||||
mapvbo.c \
|
||||
minmag.c \
|
||||
mipgen.c \
|
||||
mipmap_comp.c \
|
||||
mipmap_limits.c \
|
||||
mipmap_view.c \
|
||||
multipal.c \
|
||||
|
||||
@@ -81,6 +81,7 @@ progs = [
|
||||
'mapvbo',
|
||||
'minmag',
|
||||
'mipgen',
|
||||
'mipmap_comp',
|
||||
'mipmap_limits',
|
||||
'mipmap_view',
|
||||
'multipal',
|
||||
|
||||
+20
-23
@@ -1,6 +1,5 @@
|
||||
/*
|
||||
* Test floating point textures.
|
||||
* No actual rendering, yet.
|
||||
*/
|
||||
|
||||
|
||||
@@ -103,7 +102,6 @@ Key(unsigned char key, int x, int y)
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void
|
||||
InitTexture(void)
|
||||
{
|
||||
@@ -141,6 +139,8 @@ InitTexture(void)
|
||||
GL_RGB, GL_FLOAT, ftex);
|
||||
|
||||
|
||||
CheckError(__LINE__);
|
||||
|
||||
/* sanity checks */
|
||||
glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_RED_TYPE_ARB, &t);
|
||||
assert(t == GL_FLOAT);
|
||||
@@ -152,32 +152,26 @@ InitTexture(void)
|
||||
assert(t == GL_FLOAT);
|
||||
|
||||
free(image);
|
||||
free(ftex);
|
||||
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, filter);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, filter);
|
||||
|
||||
#if 0
|
||||
/* read back the texture and make sure values are correct */
|
||||
glGetTexImage(GL_TEXTURE_2D, 0, GL_RGBA, GL_FLOAT, tex2);
|
||||
CheckError(__LINE__);
|
||||
for (i = 0; i < 16; i++) {
|
||||
for (j = 0; j < 16; j++) {
|
||||
if (tex[i][j][0] != tex2[i][j][0] ||
|
||||
tex[i][j][1] != tex2[i][j][1] ||
|
||||
tex[i][j][2] != tex2[i][j][2] ||
|
||||
tex[i][j][3] != tex2[i][j][3]) {
|
||||
printf("tex[%d][%d] %g %g %g %g != tex2[%d][%d] %g %g %g %g\n",
|
||||
i, j,
|
||||
tex[i][j][0], tex[i][j][1], tex[i][j][2], tex[i][j][3],
|
||||
i, j,
|
||||
tex2[i][j][0], tex2[i][j][1], tex2[i][j][2], tex2[i][j][3]);
|
||||
if (1) {
|
||||
/* read back the texture and make sure values are correct */
|
||||
GLfloat *tex2 = (GLfloat *)
|
||||
malloc(imgWidth * imgHeight * 4 * sizeof(GLfloat));
|
||||
glGetTexImage(GL_TEXTURE_2D, 0, imgFormat, GL_FLOAT, tex2);
|
||||
CheckError(__LINE__);
|
||||
for (i = 0; i < imgWidth * imgHeight * 4; i++) {
|
||||
if (ftex[i] != tex2[i]) {
|
||||
printf("tex[%d] %g != tex2[%d] %g\n",
|
||||
i, ftex[i], i, tex2[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
free(ftex);
|
||||
}
|
||||
|
||||
|
||||
@@ -193,7 +187,9 @@ CreateProgram(void)
|
||||
|
||||
assert(program);
|
||||
|
||||
// InitUniforms(program, Uniforms);
|
||||
glUseProgram_func(program);
|
||||
|
||||
InitUniforms(program, Uniforms);
|
||||
|
||||
return program;
|
||||
}
|
||||
@@ -211,8 +207,9 @@ Init(void)
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (!glutExtensionSupported("GL_MESAX_texture_float")) {
|
||||
printf("Sorry, this test requires GL_MESAX_texture_float\n");
|
||||
if (!glutExtensionSupported("GL_MESAX_texture_float") &&
|
||||
!glutExtensionSupported("GL_ARB_texture_float")) {
|
||||
printf("Sorry, this test requires GL_MESAX/ARB_texture_float\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,295 @@
|
||||
/* Copyright (c) Mark J. Kilgard, 1994. */
|
||||
/*
|
||||
* (c) Copyright 1993, Silicon Graphics, Inc.
|
||||
* ALL RIGHTS RESERVED
|
||||
* Permission to use, copy, modify, and distribute this software for
|
||||
* any purpose and without fee is hereby granted, provided that the above
|
||||
* copyright notice appear in all copies and that both the copyright notice
|
||||
* and this permission notice appear in supporting documentation, and that
|
||||
* the name of Silicon Graphics, Inc. not be used in advertising
|
||||
* or publicity pertaining to distribution of the software without specific,
|
||||
* written prior permission.
|
||||
*
|
||||
* THE MATERIAL EMBODIED ON THIS SOFTWARE IS PROVIDED TO YOU "AS-IS"
|
||||
* AND WITHOUT WARRANTY OF ANY KIND, EXPRESS, IMPLIED OR OTHERWISE,
|
||||
* INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY OR
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
|
||||
* GRAPHICS, INC. BE LIABLE TO YOU OR ANYONE ELSE FOR ANY DIRECT,
|
||||
* SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY
|
||||
* KIND, OR ANY DAMAGES WHATSOEVER, INCLUDING WITHOUT LIMITATION,
|
||||
* LOSS OF PROFIT, LOSS OF USE, SAVINGS OR REVENUE, OR THE CLAIMS OF
|
||||
* THIRD PARTIES, WHETHER OR NOT SILICON GRAPHICS, INC. HAS BEEN
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH LOSS, HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE
|
||||
* POSSESSION, USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*
|
||||
* US Government Users Restricted Rights
|
||||
* Use, duplication, or disclosure by the Government is subject to
|
||||
* restrictions set forth in FAR 52.227.19(c)(2) or subparagraph
|
||||
* (c)(1)(ii) of the Rights in Technical Data and Computer Software
|
||||
* clause at DFARS 252.227-7013 and/or in similar or successor
|
||||
* clauses in the FAR or the DOD or NASA FAR Supplement.
|
||||
* Unpublished-- rights reserved under the copyright laws of the
|
||||
* United States. Contractor/manufacturer is Silicon Graphics,
|
||||
* Inc., 2011 N. Shoreline Blvd., Mountain View, CA 94039-7311.
|
||||
*
|
||||
* OpenGL(TM) is a trademark of Silicon Graphics, Inc.
|
||||
*/
|
||||
|
||||
/* mipmap_comp
|
||||
* Test compressed texture mipmaps
|
||||
*
|
||||
* Based on mipmap_limits
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <GL/glew.h>
|
||||
#include <GL/glut.h>
|
||||
|
||||
#include "readtex.h"
|
||||
|
||||
#define SIZE 16 /* not larger then 16 */
|
||||
|
||||
static GLint BaseLevel = 0, MaxLevel = 9;
|
||||
static GLfloat MinLod = -1, MaxLod = 9;
|
||||
static GLfloat LodBias = 0.0;
|
||||
static GLboolean NearestFilter = GL_TRUE;
|
||||
static GLuint texImage;
|
||||
|
||||
|
||||
static void
|
||||
initValues(void)
|
||||
{
|
||||
BaseLevel = 0;
|
||||
MaxLevel = 9;
|
||||
MinLod = -1;
|
||||
MaxLod = 2;
|
||||
LodBias = 5.0;
|
||||
NearestFilter = GL_TRUE;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
makeImage(int level, int width, int height)
|
||||
{
|
||||
#if 0
|
||||
GLubyte img[SIZE*SIZE*3];
|
||||
int i, j;
|
||||
|
||||
(void)size;
|
||||
for (i = 0; i < height; i++) {
|
||||
for (j = 0; j < width; j++) {
|
||||
int k = (i * width + j) * 3;
|
||||
img[k + 0] = 255 * ((level + 1) % 2);
|
||||
img[k + 1] = 255 * ((level + 1) % 2);
|
||||
img[k + 2] = 255 * ((level + 1) % 2);
|
||||
}
|
||||
}
|
||||
|
||||
glTexImage2D(GL_TEXTURE_2D, level, GL_COMPRESSED_RGB_S3TC_DXT1_EXT, width, height, 0,
|
||||
GL_RGB, GL_UNSIGNED_BYTE, img);
|
||||
#else
|
||||
GLubyte img[128];
|
||||
GLint size[] = {
|
||||
128, /* 16x16 */
|
||||
32, /* 8x8 */
|
||||
8, /* 4x4 */
|
||||
8, /* 2x2 */
|
||||
8, /* 1x1 */
|
||||
};
|
||||
int i;
|
||||
int value = ((level + 1) % 2) * 0xffffffff;
|
||||
memset(img, 0, 128);
|
||||
|
||||
/* generate black and white mipmap levels */
|
||||
if (value)
|
||||
for (i = 0; i < size[level] / 4; i += 2)
|
||||
((int*)img)[i] = value;
|
||||
|
||||
glCompressedTexImage2D(GL_TEXTURE_2D, level,
|
||||
GL_COMPRESSED_RGB_S3TC_DXT1_EXT,
|
||||
width, height, 0,
|
||||
size[level], img);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
makeImages(void)
|
||||
{
|
||||
int i, sz;
|
||||
|
||||
for (i = 0, sz = SIZE; sz >= 1; i++, sz /= 2) {
|
||||
makeImage(i, sz, sz);
|
||||
printf("Level %d size: %d x %d\n", i, sz, sz);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
myInit(void)
|
||||
{
|
||||
|
||||
initValues();
|
||||
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
glDepthFunc(GL_LESS);
|
||||
glShadeModel(GL_FLAT);
|
||||
|
||||
glTranslatef(0.0, 0.0, -3.6);
|
||||
|
||||
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
|
||||
glGenTextures(1, &texImage);
|
||||
glBindTexture(GL_TEXTURE_2D, texImage);
|
||||
makeImages();
|
||||
|
||||
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
|
||||
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
|
||||
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL);
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
display(void)
|
||||
{
|
||||
GLfloat tcm = 1.0;
|
||||
glBindTexture(GL_TEXTURE_2D, texImage);
|
||||
|
||||
printf("BASE_LEVEL=%d MAX_LEVEL=%d MIN_LOD=%.2g MAX_LOD=%.2g Bias=%.2g Filter=%s\n",
|
||||
BaseLevel, MaxLevel, MinLod, MaxLod, LodBias,
|
||||
NearestFilter ? "NEAREST" : "LINEAR");
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, BaseLevel);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, MaxLevel);
|
||||
|
||||
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_LOD, MinLod);
|
||||
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_LOD, MaxLod);
|
||||
|
||||
if (NearestFilter) {
|
||||
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
|
||||
GL_NEAREST_MIPMAP_NEAREST);
|
||||
}
|
||||
else {
|
||||
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
|
||||
GL_LINEAR_MIPMAP_LINEAR);
|
||||
}
|
||||
|
||||
glTexEnvf(GL_TEXTURE_FILTER_CONTROL_EXT, GL_TEXTURE_LOD_BIAS_EXT, LodBias);
|
||||
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
glBegin(GL_QUADS);
|
||||
glTexCoord2f(0.0, 0.0); glVertex3f(-2.0, -1.0, 0.0);
|
||||
glTexCoord2f(0.0, tcm); glVertex3f(-2.0, 1.0, 0.0);
|
||||
glTexCoord2f(tcm * 3000.0, tcm); glVertex3f(3000.0, 1.0, -6000.0);
|
||||
glTexCoord2f(tcm * 3000.0, 0.0); glVertex3f(3000.0, -1.0, -6000.0);
|
||||
glEnd();
|
||||
glFlush();
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
myReshape(int w, int h)
|
||||
{
|
||||
glViewport(0, 0, w, h);
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
gluPerspective(60.0, 1.0*(GLfloat)w/(GLfloat)h, 1.0, 30000.0);
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glLoadIdentity();
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
key(unsigned char k, int x, int y)
|
||||
{
|
||||
(void) x;
|
||||
(void) y;
|
||||
switch (k) {
|
||||
case 'b':
|
||||
BaseLevel--;
|
||||
if (BaseLevel < 0)
|
||||
BaseLevel = 0;
|
||||
break;
|
||||
case 'B':
|
||||
BaseLevel++;
|
||||
if (BaseLevel > 10)
|
||||
BaseLevel = 10;
|
||||
break;
|
||||
case 'm':
|
||||
MaxLevel--;
|
||||
if (MaxLevel < 0)
|
||||
MaxLevel = 0;
|
||||
break;
|
||||
case 'M':
|
||||
MaxLevel++;
|
||||
if (MaxLevel > 10)
|
||||
MaxLevel = 10;
|
||||
break;
|
||||
case 'l':
|
||||
LodBias -= 0.25;
|
||||
break;
|
||||
case 'L':
|
||||
LodBias += 0.25;
|
||||
break;
|
||||
case 'n':
|
||||
MinLod -= 0.25;
|
||||
break;
|
||||
case 'N':
|
||||
MinLod += 0.25;
|
||||
break;
|
||||
case 'x':
|
||||
MaxLod -= 0.25;
|
||||
break;
|
||||
case 'X':
|
||||
MaxLod += 0.25;
|
||||
break;
|
||||
case 'f':
|
||||
NearestFilter = !NearestFilter;
|
||||
break;
|
||||
case ' ':
|
||||
initValues();
|
||||
break;
|
||||
case 27: /* Escape */
|
||||
exit(0);
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
glutPostRedisplay();
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
usage(void)
|
||||
{
|
||||
printf("usage:\n");
|
||||
printf(" b/B decrease/increase GL_TEXTURE_BASE_LEVEL\n");
|
||||
printf(" m/M decrease/increase GL_TEXTURE_MAX_LEVEL\n");
|
||||
printf(" n/N decrease/increase GL_TEXTURE_MIN_LOD\n");
|
||||
printf(" x/X decrease/increase GL_TEXTURE_MAX_LOD\n");
|
||||
printf(" l/L decrease/increase GL_TEXTURE_LOD_BIAS\n");
|
||||
printf(" f toggle nearest/linear filtering\n");
|
||||
printf(" SPACE reset values\n");
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
main(int argc, char** argv)
|
||||
{
|
||||
glutInit(&argc, argv);
|
||||
glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB | GLUT_DEPTH);
|
||||
glutInitWindowSize (600, 600);
|
||||
glutCreateWindow (argv[0]);
|
||||
glewInit();
|
||||
myInit();
|
||||
glutReshapeFunc (myReshape);
|
||||
glutDisplayFunc(display);
|
||||
glutKeyboardFunc(key);
|
||||
usage();
|
||||
glutMainLoop();
|
||||
return 0; /* ANSI C requires main to return int. */
|
||||
}
|
||||
+219
-48
@@ -18,12 +18,27 @@
|
||||
|
||||
#define TEXTURE_FILE "../images/arch.rgb"
|
||||
|
||||
static int TexWidth = 256, TexHeight = 256;
|
||||
#define LEVELS 8
|
||||
#define SIZE (1<<LEVELS)
|
||||
static int TexWidth = SIZE, TexHeight = SIZE;
|
||||
static int WinWidth = 1044, WinHeight = 900;
|
||||
static GLfloat Bias = 0.0;
|
||||
static GLboolean ScaleQuads = GL_FALSE;
|
||||
static GLboolean Linear = GL_FALSE;
|
||||
static GLint Win = 0;
|
||||
static GLint RenderTextureLevel = 0;
|
||||
static GLuint TexObj;
|
||||
|
||||
|
||||
|
||||
static void
|
||||
CheckError(int line)
|
||||
{
|
||||
GLenum err = glGetError();
|
||||
if (err) {
|
||||
printf("GL Error 0x%x at line %d\n", (int) err, line);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -37,6 +52,178 @@ PrintString(const char *s)
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
static void
|
||||
MipGenTexture( void )
|
||||
{
|
||||
/* test auto mipmap generation */
|
||||
GLint width, height, i;
|
||||
GLenum format;
|
||||
GLubyte *image = LoadRGBImage(TEXTURE_FILE, &width, &height, &format);
|
||||
if (!image) {
|
||||
printf("Error: could not load texture image %s\n", TEXTURE_FILE);
|
||||
exit(1);
|
||||
}
|
||||
/* resize to TexWidth x TexHeight */
|
||||
if (width != TexWidth || height != TexHeight) {
|
||||
GLubyte *newImage = malloc(TexWidth * TexHeight * 4);
|
||||
|
||||
fprintf(stderr, "rescale %d %d to %d %d\n", width, height,
|
||||
TexWidth, TexHeight);
|
||||
fflush(stderr);
|
||||
|
||||
gluScaleImage(format, width, height, GL_UNSIGNED_BYTE, image,
|
||||
TexWidth, TexHeight, GL_UNSIGNED_BYTE, newImage);
|
||||
free(image);
|
||||
image = newImage;
|
||||
}
|
||||
printf("Using GL_SGIS_generate_mipmap\n");
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP_SGIS, GL_TRUE);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, format, TexWidth, TexHeight, 0,
|
||||
format, GL_UNSIGNED_BYTE, image);
|
||||
free(image);
|
||||
|
||||
/* make sure mipmap was really generated correctly */
|
||||
width = TexWidth;
|
||||
height = TexHeight;
|
||||
for (i = 0; i < 9; i++) {
|
||||
GLint w, h;
|
||||
glGetTexLevelParameteriv(GL_TEXTURE_2D, i, GL_TEXTURE_WIDTH, &w);
|
||||
glGetTexLevelParameteriv(GL_TEXTURE_2D, i, GL_TEXTURE_HEIGHT, &h);
|
||||
printf("Level %d size: %d x %d\n", i, w, h);
|
||||
assert(w == width);
|
||||
assert(h == height);
|
||||
width /= 2;
|
||||
height /= 2;
|
||||
}
|
||||
|
||||
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP_SGIS, GL_FALSE);
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void
|
||||
ResetTextureLevel( int i )
|
||||
{
|
||||
GLubyte tex2d[SIZE*SIZE][4];
|
||||
|
||||
{
|
||||
GLint Width = TexWidth / (1 << i);
|
||||
GLint Height = TexHeight / (1 << i);
|
||||
GLint s, t;
|
||||
|
||||
for (s = 0; s < Width; s++) {
|
||||
for (t = 0; t < Height; t++) {
|
||||
tex2d[t*Width+s][0] = ((s / 16) % 2) ? 0 : 255;
|
||||
tex2d[t*Width+s][1] = ((t / 16) % 2) ? 0 : 255;
|
||||
tex2d[t*Width+s][2] = 128;
|
||||
tex2d[t*Width+s][3] = 255;
|
||||
}
|
||||
}
|
||||
|
||||
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
|
||||
|
||||
glTexImage2D(GL_TEXTURE_2D, i, GL_RGB, Width, Height, 0,
|
||||
GL_RGBA, GL_UNSIGNED_BYTE, tex2d);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
ResetTexture( void )
|
||||
{
|
||||
#if 0
|
||||
/* This doesn't work so well as the arch texture is 512x512.
|
||||
*/
|
||||
LoadRGBMipmaps(TEXTURE_FILE, GL_RGB);
|
||||
#else
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i <= LEVELS; i++)
|
||||
{
|
||||
ResetTextureLevel(i);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
static void
|
||||
RenderTexture( void )
|
||||
{
|
||||
GLenum status;
|
||||
GLuint MyFB;
|
||||
|
||||
fprintf(stderr, "RenderTextureLevel %d\n", RenderTextureLevel);
|
||||
fflush(stderr);
|
||||
|
||||
/* gen framebuffer id, delete it, do some assertions, just for testing */
|
||||
glGenFramebuffersEXT(1, &MyFB);
|
||||
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, MyFB);
|
||||
assert(glIsFramebufferEXT(MyFB));
|
||||
|
||||
CheckError(__LINE__);
|
||||
|
||||
/* Render color to texture */
|
||||
glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT,
|
||||
GL_COLOR_ATTACHMENT0_EXT,
|
||||
GL_TEXTURE_2D, TexObj,
|
||||
RenderTextureLevel);
|
||||
|
||||
|
||||
|
||||
CheckError(__LINE__);
|
||||
|
||||
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
glOrtho(-1.0, 1.0, -1.0, 1.0, 5.0, 25.0);
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glLoadIdentity();
|
||||
glTranslatef(0.0, 0.0, -15.0);
|
||||
|
||||
status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT);
|
||||
if (status != GL_FRAMEBUFFER_COMPLETE_EXT) {
|
||||
printf("Framebuffer incomplete!!!\n");
|
||||
}
|
||||
|
||||
glViewport(0, 0,
|
||||
TexWidth / (1 << RenderTextureLevel),
|
||||
TexHeight / (1 << RenderTextureLevel));
|
||||
|
||||
glClearColor(0.5, 0.5, 1.0, 0.0);
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
|
||||
CheckError(__LINE__);
|
||||
|
||||
glBegin(GL_POLYGON);
|
||||
glColor3f(1, 0, 0);
|
||||
glVertex2f(-1, -1);
|
||||
glColor3f(0, 1, 0);
|
||||
glVertex2f(1, -1);
|
||||
glColor3f(0, 0, 1);
|
||||
glVertex2f(0, 1);
|
||||
glEnd();
|
||||
|
||||
|
||||
/* Bind normal framebuffer */
|
||||
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
|
||||
CheckError(__LINE__);
|
||||
|
||||
glDeleteFramebuffersEXT(1, &MyFB);
|
||||
CheckError(__LINE__);
|
||||
|
||||
glClearColor(0, 0, 0, 0);
|
||||
}
|
||||
|
||||
static void
|
||||
Display(void)
|
||||
{
|
||||
@@ -44,6 +231,8 @@ Display(void)
|
||||
char str[100];
|
||||
int texWidth = TexWidth, texHeight = TexHeight;
|
||||
|
||||
glViewport(0, 0, WinHeight, WinHeight);
|
||||
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
@@ -126,7 +315,6 @@ Reshape(int width, int height)
|
||||
{
|
||||
WinWidth = width;
|
||||
WinHeight = height;
|
||||
glViewport(0, 0, width, height);
|
||||
}
|
||||
|
||||
|
||||
@@ -145,6 +333,21 @@ Key(unsigned char key, int x, int y)
|
||||
case 'l':
|
||||
Linear = !Linear;
|
||||
break;
|
||||
case 'v':
|
||||
RenderTextureLevel++;
|
||||
break;
|
||||
case 'V':
|
||||
RenderTextureLevel--;
|
||||
break;
|
||||
case 'r':
|
||||
RenderTexture();
|
||||
break;
|
||||
case 'X':
|
||||
ResetTexture();
|
||||
break;
|
||||
case 'x':
|
||||
ResetTextureLevel(RenderTextureLevel);
|
||||
break;
|
||||
case '0':
|
||||
case '1':
|
||||
case '2':
|
||||
@@ -160,6 +363,14 @@ Key(unsigned char key, int x, int y)
|
||||
case 's':
|
||||
ScaleQuads = !ScaleQuads;
|
||||
break;
|
||||
case ' ':
|
||||
MipGenTexture();
|
||||
Bias = 0;
|
||||
Linear = 0;
|
||||
RenderTextureLevel = 0;
|
||||
ScaleQuads = 0;
|
||||
break;
|
||||
|
||||
case 27:
|
||||
glutDestroyWindow(Win);
|
||||
exit(0);
|
||||
@@ -186,53 +397,13 @@ Init(void)
|
||||
|
||||
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
|
||||
|
||||
if (1) {
|
||||
/* test auto mipmap generation */
|
||||
GLint width, height, i;
|
||||
GLenum format;
|
||||
GLubyte *image = LoadRGBImage(TEXTURE_FILE, &width, &height, &format);
|
||||
if (!image) {
|
||||
printf("Error: could not load texture image %s\n", TEXTURE_FILE);
|
||||
exit(1);
|
||||
}
|
||||
/* resize to TexWidth x TexHeight */
|
||||
if (width != TexWidth || height != TexHeight) {
|
||||
GLubyte *newImage = malloc(TexWidth * TexHeight * 4);
|
||||
gluScaleImage(format, width, height, GL_UNSIGNED_BYTE, image,
|
||||
TexWidth, TexHeight, GL_UNSIGNED_BYTE, newImage);
|
||||
free(image);
|
||||
image = newImage;
|
||||
}
|
||||
printf("Using GL_SGIS_generate_mipmap\n");
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP_SGIS, GL_TRUE);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, format, TexWidth, TexHeight, 0,
|
||||
format, GL_UNSIGNED_BYTE, image);
|
||||
free(image);
|
||||
|
||||
/* make sure mipmap was really generated correctly */
|
||||
width = TexWidth;
|
||||
height = TexHeight;
|
||||
for (i = 0; i < 9; i++) {
|
||||
GLint w, h;
|
||||
glGetTexLevelParameteriv(GL_TEXTURE_2D, i, GL_TEXTURE_WIDTH, &w);
|
||||
glGetTexLevelParameteriv(GL_TEXTURE_2D, i, GL_TEXTURE_HEIGHT, &h);
|
||||
printf("Level %d size: %d x %d\n", i, w, h);
|
||||
assert(w == width);
|
||||
assert(h == height);
|
||||
width /= 2;
|
||||
height /= 2;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (LoadRGBMipmaps(TEXTURE_FILE, GL_RGB)) {
|
||||
printf("Using gluBuildMipmaps()\n");
|
||||
}
|
||||
else {
|
||||
printf("Error: could not load texture image %s\n", TEXTURE_FILE);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
glGenTextures(1, &TexObj);
|
||||
glBindTexture(GL_TEXTURE_2D, TexObj);
|
||||
|
||||
if (1)
|
||||
MipGenTexture();
|
||||
else
|
||||
ResetTexture();
|
||||
|
||||
/* mipmapping required for this extension */
|
||||
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
|
||||
|
||||
@@ -30,6 +30,7 @@ SOURCES = \
|
||||
fs-tri.c \
|
||||
line-clip.c \
|
||||
line-cull.c \
|
||||
line-flat.c \
|
||||
line-smooth.c \
|
||||
line-stipple-wide.c \
|
||||
line-userclip-clip.c \
|
||||
@@ -138,6 +139,7 @@ SOURCES = \
|
||||
tristrip-flat.c \
|
||||
tristrip.c \
|
||||
vbo-drawarrays.c \
|
||||
vbo-noninterleaved.c \
|
||||
vbo-drawelements.c \
|
||||
vbo-drawrange.c \
|
||||
vp-array.c \
|
||||
@@ -145,6 +147,7 @@ SOURCES = \
|
||||
vp-clip.c \
|
||||
vp-line-clip.c \
|
||||
vp-tri.c \
|
||||
vp-tri-invariant.c \
|
||||
vp-tri-swap.c \
|
||||
vp-tri-tex.c \
|
||||
vp-tri-imm.c \
|
||||
|
||||
@@ -26,6 +26,7 @@ progs = [
|
||||
'fs-tri',
|
||||
'line-clip',
|
||||
'line-cull',
|
||||
'line-flat',
|
||||
'line-smooth',
|
||||
'line-stipple-wide',
|
||||
'line-userclip-clip',
|
||||
@@ -134,6 +135,7 @@ progs = [
|
||||
'tristrip-flat',
|
||||
'tristrip',
|
||||
'vbo-drawarrays',
|
||||
'vbo-noninterleaved',
|
||||
'vbo-drawelements',
|
||||
'vbo-drawrange',
|
||||
'vp-array',
|
||||
@@ -141,6 +143,7 @@ progs = [
|
||||
'vp-clip',
|
||||
'vp-line-clip',
|
||||
'vp-tri',
|
||||
'vp-tri-invariant',
|
||||
'vp-tri-swap',
|
||||
'vp-tri-tex',
|
||||
'vp-tri-imm',
|
||||
|
||||
@@ -0,0 +1,147 @@
|
||||
/*
|
||||
* Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and
|
||||
* its documentation for any purpose is hereby granted without fee, provided
|
||||
* that (i) the above copyright notices and this permission notice appear in
|
||||
* all copies of the software and related documentation, and (ii) the name of
|
||||
* Silicon Graphics may not be used in any advertising or
|
||||
* publicity relating to the software without the specific, prior written
|
||||
* permission of Silicon Graphics.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF
|
||||
* ANY KIND,
|
||||
* EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
|
||||
* WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR
|
||||
* ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
|
||||
* OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
||||
* WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
|
||||
* LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
||||
* OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <GL/glut.h>
|
||||
|
||||
|
||||
#define CI_OFFSET_1 16
|
||||
#define CI_OFFSET_2 32
|
||||
|
||||
|
||||
GLenum doubleBuffer;
|
||||
|
||||
static void Init(void)
|
||||
{
|
||||
fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
|
||||
fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
|
||||
fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
|
||||
fflush(stderr);
|
||||
|
||||
glClearColor(0.0, 0.0, 1.0, 0.0);
|
||||
}
|
||||
|
||||
static void Reshape(int width, int height)
|
||||
{
|
||||
|
||||
glViewport(0, 0, (GLint)width, (GLint)height);
|
||||
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
}
|
||||
|
||||
static void Key(unsigned char key, int x, int y)
|
||||
{
|
||||
|
||||
switch (key) {
|
||||
case 27:
|
||||
exit(1);
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
glutPostRedisplay();
|
||||
}
|
||||
|
||||
static void Draw(void)
|
||||
{
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
glShadeModel(GL_FLAT);
|
||||
|
||||
glBegin(GL_LINES);
|
||||
glColor3f(0,0,.7);
|
||||
glVertex3f( 0.9, -0.9, -30.0);
|
||||
glColor3f(.8,0,0);
|
||||
glVertex3f( 0.9, 0.9, -30.0);
|
||||
|
||||
glColor3f(.8,0,0);
|
||||
glVertex3f( 0.9, 0.9, -30.0);
|
||||
glColor3f(0,.9,0);
|
||||
glVertex3f(-0.9, 0.0, -30.0);
|
||||
|
||||
|
||||
glColor3f(0,.9,0);
|
||||
glVertex3f(-0.9, 0.0, -30.0);
|
||||
glColor3f(0,0,.7);
|
||||
glVertex3f( 0.9, -0.9, -30.0);
|
||||
glEnd();
|
||||
|
||||
glFlush();
|
||||
|
||||
if (doubleBuffer) {
|
||||
glutSwapBuffers();
|
||||
}
|
||||
}
|
||||
|
||||
static GLenum Args(int argc, char **argv)
|
||||
{
|
||||
GLint i;
|
||||
|
||||
doubleBuffer = GL_FALSE;
|
||||
|
||||
for (i = 1; i < argc; i++) {
|
||||
if (strcmp(argv[i], "-sb") == 0) {
|
||||
doubleBuffer = GL_FALSE;
|
||||
} else if (strcmp(argv[i], "-db") == 0) {
|
||||
doubleBuffer = GL_TRUE;
|
||||
} else {
|
||||
fprintf(stderr, "%s (Bad option).\n", argv[i]);
|
||||
return GL_FALSE;
|
||||
}
|
||||
}
|
||||
return GL_TRUE;
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
GLenum type;
|
||||
|
||||
glutInit(&argc, argv);
|
||||
|
||||
if (Args(argc, argv) == GL_FALSE) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);
|
||||
|
||||
type = GLUT_RGB;
|
||||
type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
|
||||
glutInitDisplayMode(type);
|
||||
|
||||
if (glutCreateWindow(*argv) == GL_FALSE) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
Init();
|
||||
|
||||
glutReshapeFunc(Reshape);
|
||||
glutKeyboardFunc(Key);
|
||||
glutDisplayFunc(Draw);
|
||||
glutMainLoop();
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,139 @@
|
||||
/* Basic VBO */
|
||||
|
||||
#include <assert.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <GL/glew.h>
|
||||
#include <GL/glut.h>
|
||||
|
||||
|
||||
struct {
|
||||
GLfloat pos[4][4];
|
||||
GLfloat col[4][4];
|
||||
} verts =
|
||||
{
|
||||
/* Position: a quad
|
||||
*/
|
||||
{
|
||||
{ 0.9, -0.9, 0.0, 1.0 },
|
||||
{ 0.9, 0.9, 0.0, 1.0 },
|
||||
{ -0.9, 0.9, 0.0, 1.0 },
|
||||
{ -0.9, -0.9, 0.0, 1.0 },
|
||||
},
|
||||
|
||||
/* Color: all red
|
||||
*/
|
||||
{
|
||||
{ 1.0, 0.0, 0.0, 1.0 },
|
||||
{ 1.0, 0.0, 0.0, 1.0 },
|
||||
{ 1.0, 0.0, 0.0, 1.0 },
|
||||
{ 1.0, 0.0, 0.0, 1.0 },
|
||||
},
|
||||
|
||||
|
||||
};
|
||||
|
||||
GLuint arrayObj, elementObj;
|
||||
|
||||
static void Init( void )
|
||||
{
|
||||
GLint errno;
|
||||
GLuint prognum;
|
||||
|
||||
static const char *prog1 =
|
||||
"!!ARBvp1.0\n"
|
||||
"MOV result.color, vertex.color;\n"
|
||||
"MOV result.position, vertex.position;\n"
|
||||
"END\n";
|
||||
|
||||
glGenProgramsARB(1, &prognum);
|
||||
glBindProgramARB(GL_VERTEX_PROGRAM_ARB, prognum);
|
||||
glProgramStringARB(GL_VERTEX_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
|
||||
strlen(prog1), (const GLubyte *) prog1);
|
||||
|
||||
assert(glIsProgramARB(prognum));
|
||||
errno = glGetError();
|
||||
printf("glGetError = %d\n", errno);
|
||||
if (errno != GL_NO_ERROR)
|
||||
{
|
||||
GLint errorpos;
|
||||
|
||||
glGetIntegerv(GL_PROGRAM_ERROR_POSITION_ARB, &errorpos);
|
||||
printf("errorpos: %d\n", errorpos);
|
||||
printf("%s\n", (char *)glGetString(GL_PROGRAM_ERROR_STRING_ARB));
|
||||
}
|
||||
|
||||
|
||||
glEnableClientState( GL_VERTEX_ARRAY );
|
||||
glEnableClientState( GL_COLOR_ARRAY );
|
||||
|
||||
glGenBuffersARB(1, &arrayObj);
|
||||
glBindBufferARB(GL_ARRAY_BUFFER_ARB, arrayObj);
|
||||
glBufferDataARB(GL_ARRAY_BUFFER_ARB, sizeof(verts), &verts, GL_STATIC_DRAW_ARB);
|
||||
|
||||
glVertexPointer( 4, GL_FLOAT, sizeof(verts.pos[0]), 0 );
|
||||
glColorPointer( 4, GL_FLOAT, sizeof(verts.col[0]), (void *)(4*4*sizeof(float)) );
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void Display( void )
|
||||
{
|
||||
glClearColor(0.3, 0.3, 0.3, 1);
|
||||
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
|
||||
|
||||
glEnable(GL_VERTEX_PROGRAM_ARB);
|
||||
|
||||
// glDrawArrays( GL_TRIANGLES, 0, 3 );
|
||||
// glDrawArrays( GL_TRIANGLES, 1, 3 );
|
||||
glDrawArrays( GL_QUADS, 0, 4 );
|
||||
|
||||
glFlush();
|
||||
}
|
||||
|
||||
|
||||
static void Reshape( int width, int height )
|
||||
{
|
||||
glViewport( 0, 0, width, height );
|
||||
glMatrixMode( GL_PROJECTION );
|
||||
glLoadIdentity();
|
||||
glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
|
||||
glMatrixMode( GL_MODELVIEW );
|
||||
glLoadIdentity();
|
||||
/*glTranslatef( 0.0, 0.0, -15.0 );*/
|
||||
}
|
||||
|
||||
|
||||
static void Key( unsigned char key, int x, int y )
|
||||
{
|
||||
(void) x;
|
||||
(void) y;
|
||||
switch (key) {
|
||||
case 27:
|
||||
exit(0);
|
||||
break;
|
||||
}
|
||||
glutPostRedisplay();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
int main( int argc, char *argv[] )
|
||||
{
|
||||
glutInit( &argc, argv );
|
||||
glutInitWindowPosition( 0, 0 );
|
||||
glutInitWindowSize( 250, 250 );
|
||||
glutInitDisplayMode( GLUT_RGB | GLUT_SINGLE | GLUT_DEPTH );
|
||||
glutCreateWindow(argv[0]);
|
||||
glewInit();
|
||||
glutReshapeFunc( Reshape );
|
||||
glutKeyboardFunc( Key );
|
||||
glutDisplayFunc( Display );
|
||||
Init();
|
||||
glutMainLoop();
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,147 @@
|
||||
/* Test glGenProgramsNV(), glIsProgramNV(), glLoadProgramNV() */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <GL/glew.h>
|
||||
#include <GL/glut.h>
|
||||
|
||||
|
||||
#define CI_OFFSET_1 16
|
||||
#define CI_OFFSET_2 32
|
||||
|
||||
|
||||
GLenum doubleBuffer;
|
||||
|
||||
static void Init(void)
|
||||
{
|
||||
GLint errno;
|
||||
GLuint prognum;
|
||||
|
||||
static const char *prog1 =
|
||||
"!!ARBvp1.0\n"
|
||||
"OPTION ARB_position_invariant ;"
|
||||
"MOV result.color, vertex.color;\n"
|
||||
"END\n";
|
||||
|
||||
|
||||
glGenProgramsARB(1, &prognum);
|
||||
|
||||
glBindProgramARB(GL_VERTEX_PROGRAM_ARB, prognum);
|
||||
glProgramStringARB(GL_VERTEX_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
|
||||
strlen(prog1), (const GLubyte *) prog1);
|
||||
|
||||
errno = glGetError();
|
||||
printf("glGetError = %d\n", errno);
|
||||
if (errno != GL_NO_ERROR)
|
||||
{
|
||||
GLint errorpos;
|
||||
|
||||
glGetIntegerv(GL_PROGRAM_ERROR_POSITION_ARB, &errorpos);
|
||||
printf("errorpos: %d\n", errorpos);
|
||||
printf("%s\n", (char *)glGetString(GL_PROGRAM_ERROR_STRING_ARB));
|
||||
}
|
||||
|
||||
fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
|
||||
fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
|
||||
fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
|
||||
fflush(stderr);
|
||||
|
||||
glClearColor(0.0, 0.0, 1.0, 0.0);
|
||||
}
|
||||
|
||||
static void Reshape(int width, int height)
|
||||
{
|
||||
|
||||
glViewport(0, 0, (GLint)width, (GLint)height);
|
||||
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
/* glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0); */
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
}
|
||||
|
||||
static void Key(unsigned char key, int x, int y)
|
||||
{
|
||||
|
||||
switch (key) {
|
||||
case 27:
|
||||
exit(1);
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
glutPostRedisplay();
|
||||
}
|
||||
|
||||
static void Draw(void)
|
||||
{
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
|
||||
glEnable(GL_VERTEX_PROGRAM_ARB);
|
||||
|
||||
glBegin(GL_TRIANGLES);
|
||||
glColor3f(0,0,.7);
|
||||
glVertex3f( 0.9, -0.9, -0.0);
|
||||
glColor3f(.8,0,0);
|
||||
glVertex3f( 0.9, 0.9, -0.0);
|
||||
glColor3f(0,.9,0);
|
||||
glVertex3f(-0.9, 0.0, -0.0);
|
||||
glEnd();
|
||||
|
||||
glFlush();
|
||||
|
||||
if (doubleBuffer) {
|
||||
glutSwapBuffers();
|
||||
}
|
||||
}
|
||||
|
||||
static GLenum Args(int argc, char **argv)
|
||||
{
|
||||
GLint i;
|
||||
|
||||
doubleBuffer = GL_FALSE;
|
||||
|
||||
for (i = 1; i < argc; i++) {
|
||||
if (strcmp(argv[i], "-sb") == 0) {
|
||||
doubleBuffer = GL_FALSE;
|
||||
} else if (strcmp(argv[i], "-db") == 0) {
|
||||
doubleBuffer = GL_TRUE;
|
||||
} else {
|
||||
fprintf(stderr, "%s (Bad option).\n", argv[i]);
|
||||
return GL_FALSE;
|
||||
}
|
||||
}
|
||||
return GL_TRUE;
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
GLenum type;
|
||||
|
||||
glutInit(&argc, argv);
|
||||
|
||||
if (Args(argc, argv) == GL_FALSE) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);
|
||||
|
||||
type = GLUT_RGB | GLUT_ALPHA;
|
||||
type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
|
||||
glutInitDisplayMode(type);
|
||||
|
||||
if (glutCreateWindow(*argv) == GL_FALSE) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
glewInit();
|
||||
Init();
|
||||
|
||||
glutReshapeFunc(Reshape);
|
||||
glutKeyboardFunc(Key);
|
||||
glutDisplayFunc(Draw);
|
||||
glutMainLoop();
|
||||
return 0;
|
||||
}
|
||||
@@ -385,6 +385,10 @@ draw( Display *dpy, Window win )
|
||||
} else
|
||||
do_draw();
|
||||
|
||||
glDeleteLists(gear1, 1);
|
||||
glDeleteLists(gear2, 1);
|
||||
glDeleteLists(gear3, 1);
|
||||
|
||||
glXSwapBuffers(dpy, win);
|
||||
glXDestroyContext(dpy, ctx);
|
||||
}
|
||||
|
||||
@@ -317,6 +317,8 @@ def generate(env):
|
||||
if gcc:
|
||||
if debug:
|
||||
cflags += ['-O0', '-g3']
|
||||
elif env['toolchain'] == 'crossmingw':
|
||||
cflags += ['-O0', '-g3'] # mingw 4.2.1 optimizer is broken
|
||||
else:
|
||||
cflags += ['-O3', '-g3']
|
||||
if env['profile']:
|
||||
|
||||
@@ -398,6 +398,8 @@ def generate(env):
|
||||
if gcc:
|
||||
if debug:
|
||||
ccflags += ['-O0', '-g3']
|
||||
elif env['toolchain'] == 'crossmingw':
|
||||
ccflags += ['-O0', '-g3'] # mingw 4.2.1 optimizer is broken
|
||||
else:
|
||||
ccflags += ['-O3', '-g0']
|
||||
if env['profile']:
|
||||
|
||||
@@ -26,8 +26,6 @@ $(TOP)/$(LIB_DIR)/demodriver.so: $(OBJECTS)
|
||||
$(OBJECTS)
|
||||
|
||||
install:
|
||||
$(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR)
|
||||
$(INSTALL) $(TOP)/$(LIB_DIR)/demodriver.so $(DESTDIR)$(INSTALL_LIB_DIR)
|
||||
|
||||
clean:
|
||||
-rm -f *.o
|
||||
|
||||
@@ -29,6 +29,7 @@ for driver in env['drivers']:
|
||||
|
||||
SConscript('state_trackers/python/SConscript')
|
||||
SConscript('state_trackers/glx/xlib/SConscript')
|
||||
SConscript('state_trackers/dri/SConscript')
|
||||
|
||||
if platform == 'windows':
|
||||
SConscript('state_trackers/wgl/SConscript')
|
||||
|
||||
@@ -57,6 +57,7 @@ struct draw_stage
|
||||
struct draw_context *draw; /**< parent context */
|
||||
|
||||
struct draw_stage *next; /**< next stage in pipeline */
|
||||
const char *name; /**< for debugging */
|
||||
|
||||
struct vertex_header **tmp; /**< temp vert storage, such as for clipping */
|
||||
unsigned nr_tmps;
|
||||
|
||||
@@ -746,6 +746,7 @@ draw_aaline_stage(struct draw_context *draw)
|
||||
goto fail;
|
||||
|
||||
aaline->stage.draw = draw;
|
||||
aaline->stage.name = "aaline";
|
||||
aaline->stage.next = NULL;
|
||||
aaline->stage.point = draw_pipe_passthrough_point;
|
||||
aaline->stage.line = aaline_first_line;
|
||||
|
||||
@@ -757,6 +757,7 @@ draw_aapoint_stage(struct draw_context *draw)
|
||||
goto fail;
|
||||
|
||||
aapoint->stage.draw = draw;
|
||||
aapoint->stage.name = "aapoint";
|
||||
aapoint->stage.next = NULL;
|
||||
aapoint->stage.point = aapoint_first_point;
|
||||
aapoint->stage.line = draw_pipe_passthrough_line;
|
||||
|
||||
@@ -496,6 +496,7 @@ struct draw_stage *draw_clip_stage( struct draw_context *draw )
|
||||
goto fail;
|
||||
|
||||
clipper->stage.draw = draw;
|
||||
clipper->stage.name = "clipper";
|
||||
clipper->stage.point = clip_point;
|
||||
clipper->stage.line = clip_first_line;
|
||||
clipper->stage.tri = clip_first_tri;
|
||||
|
||||
@@ -129,6 +129,7 @@ struct draw_stage *draw_cull_stage( struct draw_context *draw )
|
||||
goto fail;
|
||||
|
||||
cull->stage.draw = draw;
|
||||
cull->stage.name = "cull";
|
||||
cull->stage.next = NULL;
|
||||
cull->stage.point = draw_pipe_passthrough_point;
|
||||
cull->stage.line = draw_pipe_passthrough_line;
|
||||
|
||||
@@ -261,6 +261,7 @@ struct draw_stage *draw_flatshade_stage( struct draw_context *draw )
|
||||
goto fail;
|
||||
|
||||
flatshade->stage.draw = draw;
|
||||
flatshade->stage.name = "flatshade";
|
||||
flatshade->stage.next = NULL;
|
||||
flatshade->stage.point = draw_pipe_passthrough_point;
|
||||
flatshade->stage.line = flatshade_first_line;
|
||||
|
||||
@@ -166,6 +166,7 @@ struct draw_stage *draw_offset_stage( struct draw_context *draw )
|
||||
draw_alloc_temp_verts( &offset->stage, 3 );
|
||||
|
||||
offset->stage.draw = draw;
|
||||
offset->stage.name = "offset";
|
||||
offset->stage.next = NULL;
|
||||
offset->stage.point = draw_pipe_passthrough_point;
|
||||
offset->stage.line = draw_pipe_passthrough_line;
|
||||
|
||||
@@ -586,6 +586,7 @@ draw_pstip_stage(struct draw_context *draw)
|
||||
draw_alloc_temp_verts( &pstip->stage, 8 );
|
||||
|
||||
pstip->stage.draw = draw;
|
||||
pstip->stage.name = "pstip";
|
||||
pstip->stage.next = NULL;
|
||||
pstip->stage.point = draw_pipe_passthrough_point;
|
||||
pstip->stage.line = draw_pipe_passthrough_line;
|
||||
|
||||
@@ -238,6 +238,7 @@ struct draw_stage *draw_stipple_stage( struct draw_context *draw )
|
||||
draw_alloc_temp_verts( &stipple->stage, 2 );
|
||||
|
||||
stipple->stage.draw = draw;
|
||||
stipple->stage.name = "stipple";
|
||||
stipple->stage.next = NULL;
|
||||
stipple->stage.point = stipple_reset_point;
|
||||
stipple->stage.line = stipple_first_line;
|
||||
|
||||
@@ -181,6 +181,7 @@ struct draw_stage *draw_twoside_stage( struct draw_context *draw )
|
||||
goto fail;
|
||||
|
||||
twoside->stage.draw = draw;
|
||||
twoside->stage.name = "twoside";
|
||||
twoside->stage.next = NULL;
|
||||
twoside->stage.point = draw_pipe_passthrough_point;
|
||||
twoside->stage.line = draw_pipe_passthrough_line;
|
||||
|
||||
@@ -184,6 +184,7 @@ struct draw_stage *draw_unfilled_stage( struct draw_context *draw )
|
||||
goto fail;
|
||||
|
||||
unfilled->stage.draw = draw;
|
||||
unfilled->stage.name = "unfilled";
|
||||
unfilled->stage.next = NULL;
|
||||
unfilled->stage.tmp = NULL;
|
||||
unfilled->stage.point = draw_pipe_passthrough_point;
|
||||
|
||||
@@ -262,7 +262,15 @@ static struct draw_stage *validate_pipeline( struct draw_stage *stage )
|
||||
|
||||
|
||||
draw->pipeline.first = next;
|
||||
return next;
|
||||
|
||||
if (0) {
|
||||
debug_printf("draw pipeline:\n");
|
||||
for (next = draw->pipeline.first; next ; next = next->next )
|
||||
debug_printf(" %s\n", next->name);
|
||||
debug_printf("\n");
|
||||
}
|
||||
|
||||
return draw->pipeline.first;
|
||||
}
|
||||
|
||||
static void validate_tri( struct draw_stage *stage,
|
||||
@@ -318,6 +326,7 @@ struct draw_stage *draw_validate_stage( struct draw_context *draw )
|
||||
return NULL;
|
||||
|
||||
stage->draw = draw;
|
||||
stage->name = "validate";
|
||||
stage->next = NULL;
|
||||
stage->point = validate_point;
|
||||
stage->line = validate_line;
|
||||
|
||||
@@ -446,6 +446,7 @@ struct draw_stage *draw_vbuf_stage( struct draw_context *draw,
|
||||
goto fail;
|
||||
|
||||
vbuf->stage.draw = draw;
|
||||
vbuf->stage.name = "vbuf";
|
||||
vbuf->stage.point = vbuf_first_point;
|
||||
vbuf->stage.line = vbuf_first_line;
|
||||
vbuf->stage.tri = vbuf_first_tri;
|
||||
|
||||
@@ -168,6 +168,7 @@ struct draw_stage *draw_wide_line_stage( struct draw_context *draw )
|
||||
draw_alloc_temp_verts( &wide->stage, 4 );
|
||||
|
||||
wide->stage.draw = draw;
|
||||
wide->stage.name = "wide-line";
|
||||
wide->stage.next = NULL;
|
||||
wide->stage.point = draw_pipe_passthrough_point;
|
||||
wide->stage.line = wideline_line;
|
||||
|
||||
@@ -279,6 +279,7 @@ struct draw_stage *draw_wide_point_stage( struct draw_context *draw )
|
||||
goto fail;
|
||||
|
||||
wide->stage.draw = draw;
|
||||
wide->stage.name = "wide-point";
|
||||
wide->stage.next = NULL;
|
||||
wide->stage.point = widepoint_first_point;
|
||||
wide->stage.line = draw_pipe_passthrough_line;
|
||||
|
||||
@@ -187,6 +187,7 @@ struct pt_emit *draw_pt_emit_create( struct draw_context *draw );
|
||||
|
||||
struct pt_fetch;
|
||||
void draw_pt_fetch_prepare( struct pt_fetch *fetch,
|
||||
unsigned vertex_input_count,
|
||||
unsigned vertex_size );
|
||||
|
||||
void draw_pt_fetch_run( struct pt_fetch *fetch,
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
**************************************************************************/
|
||||
|
||||
#include "util/u_memory.h"
|
||||
#include "util/u_math.h"
|
||||
#include "draw/draw_context.h"
|
||||
#include "draw/draw_private.h"
|
||||
#include "draw/draw_vbuf.h"
|
||||
@@ -56,9 +57,11 @@ struct pt_fetch {
|
||||
*
|
||||
*/
|
||||
void draw_pt_fetch_prepare( struct pt_fetch *fetch,
|
||||
unsigned vs_input_count,
|
||||
unsigned vertex_size )
|
||||
{
|
||||
struct draw_context *draw = fetch->draw;
|
||||
unsigned nr_inputs;
|
||||
unsigned i, nr = 0;
|
||||
unsigned dst_offset = 0;
|
||||
struct translate_key key;
|
||||
@@ -89,8 +92,11 @@ void draw_pt_fetch_prepare( struct pt_fetch *fetch,
|
||||
dst_offset += 4 * sizeof(float);
|
||||
}
|
||||
|
||||
assert( draw->pt.nr_vertex_elements >= vs_input_count );
|
||||
|
||||
for (i = 0; i < draw->pt.nr_vertex_elements; i++) {
|
||||
nr_inputs = MIN2( vs_input_count, draw->pt.nr_vertex_elements );
|
||||
|
||||
for (i = 0; i < nr_inputs; i++) {
|
||||
key.element[nr].input_format = draw->pt.vertex_element[i].src_format;
|
||||
key.element[nr].input_buffer = draw->pt.vertex_element[i].vertex_buffer_index;
|
||||
key.element[nr].input_offset = draw->pt.vertex_element[i].src_offset;
|
||||
|
||||
@@ -77,8 +77,8 @@ static void fetch_pipeline_prepare( struct draw_pt_middle_end *middle,
|
||||
|
||||
|
||||
draw_pt_fetch_prepare( fpme->fetch,
|
||||
vs->info.num_inputs,
|
||||
fpme->vertex_size );
|
||||
|
||||
/* XXX: it's not really gl rasterization rules we care about here,
|
||||
* but gl vs dx9 clip spaces.
|
||||
*/
|
||||
|
||||
@@ -114,6 +114,12 @@ vs_exec_run_linear( struct draw_vertex_shader *shader,
|
||||
#endif
|
||||
|
||||
for (slot = 0; slot < shader->info.num_inputs; slot++) {
|
||||
#if 0
|
||||
assert(!util_is_inf_or_nan(input[slot][0]));
|
||||
assert(!util_is_inf_or_nan(input[slot][1]));
|
||||
assert(!util_is_inf_or_nan(input[slot][2]));
|
||||
assert(!util_is_inf_or_nan(input[slot][3]));
|
||||
#endif
|
||||
machine->Inputs[slot].xyzw[0].f[j] = input[slot][0];
|
||||
machine->Inputs[slot].xyzw[1].f[j] = input[slot][1];
|
||||
machine->Inputs[slot].xyzw[2].f[j] = input[slot][2];
|
||||
|
||||
@@ -71,13 +71,10 @@ static void generate_tris_ushort(
|
||||
unsigned i, j;
|
||||
(void)j;
|
||||
for (j = i = 0; j < nr; j+=6, i+=3) {
|
||||
debug_printf(" line %d %d\n", (int)i, (int)i+1);
|
||||
(out+j)[0] = (ushort)(i);
|
||||
(out+j)[1] = (ushort)(i+1);
|
||||
debug_printf(" line %d %d\n", (int)i+1, (int)i+2);
|
||||
(out+j+2)[0] = (ushort)(i+1);
|
||||
(out+j+2)[1] = (ushort)(i+2);
|
||||
debug_printf(" line %d %d\n", (int)i+2, (int)i);
|
||||
(out+j+4)[0] = (ushort)(i+2);
|
||||
(out+j+4)[1] = (ushort)(i);
|
||||
}
|
||||
@@ -90,13 +87,10 @@ static void generate_tristrip_ushort(
|
||||
unsigned i, j;
|
||||
(void)j;
|
||||
for (j = i = 0; j < nr; j+=6, i++) {
|
||||
debug_printf(" line %d %d\n", (int)i, (int)i+1/*+(i&1)*/);
|
||||
(out+j)[0] = (ushort)(i);
|
||||
(out+j)[1] = (ushort)(i+1/*+(i&1)*/);
|
||||
debug_printf(" line %d %d\n", (int)i+1/*+(i&1)*/, (int)i+2/*-(i&1)*/);
|
||||
(out+j+2)[0] = (ushort)(i+1/*+(i&1)*/);
|
||||
(out+j+2)[1] = (ushort)(i+2/*-(i&1)*/);
|
||||
debug_printf(" line %d %d\n", (int)i+2/*-(i&1)*/, (int)i);
|
||||
(out+j+4)[0] = (ushort)(i+2/*-(i&1)*/);
|
||||
(out+j+4)[1] = (ushort)(i);
|
||||
}
|
||||
@@ -109,13 +103,10 @@ static void generate_trifan_ushort(
|
||||
unsigned i, j;
|
||||
(void)j;
|
||||
for (j = i = 0; j < nr; j+=6, i++) {
|
||||
debug_printf(" line %d %d\n", (int)0, (int)i+1);
|
||||
(out+j)[0] = (ushort)(0);
|
||||
(out+j)[1] = (ushort)(i+1);
|
||||
debug_printf(" line %d %d\n", (int)i+1, (int)i+2);
|
||||
(out+j+2)[0] = (ushort)(i+1);
|
||||
(out+j+2)[1] = (ushort)(i+2);
|
||||
debug_printf(" line %d %d\n", (int)i+2, (int)0);
|
||||
(out+j+4)[0] = (ushort)(i+2);
|
||||
(out+j+4)[1] = (ushort)(0);
|
||||
}
|
||||
@@ -128,16 +119,12 @@ static void generate_quads_ushort(
|
||||
unsigned i, j;
|
||||
(void)j;
|
||||
for (j = i = 0; j < nr; j+=8, i+=4) {
|
||||
debug_printf(" line %d %d\n", (int)i+0, (int)i+1);
|
||||
(out+j)[0] = (ushort)(i+0);
|
||||
(out+j)[1] = (ushort)(i+1);
|
||||
debug_printf(" line %d %d\n", (int)i+1, (int)i+2);
|
||||
(out+j+2)[0] = (ushort)(i+1);
|
||||
(out+j+2)[1] = (ushort)(i+2);
|
||||
debug_printf(" line %d %d\n", (int)i+2, (int)i+3);
|
||||
(out+j+4)[0] = (ushort)(i+2);
|
||||
(out+j+4)[1] = (ushort)(i+3);
|
||||
debug_printf(" line %d %d\n", (int)i+3, (int)i+0);
|
||||
(out+j+6)[0] = (ushort)(i+3);
|
||||
(out+j+6)[1] = (ushort)(i+0);
|
||||
}
|
||||
@@ -150,16 +137,12 @@ static void generate_quadstrip_ushort(
|
||||
unsigned i, j;
|
||||
(void)j;
|
||||
for (j = i = 0; j < nr; j+=8, i+=2) {
|
||||
debug_printf(" line %d %d\n", (int)i+2, (int)i+0);
|
||||
(out+j)[0] = (ushort)(i+2);
|
||||
(out+j)[1] = (ushort)(i+0);
|
||||
debug_printf(" line %d %d\n", (int)i+0, (int)i+1);
|
||||
(out+j+2)[0] = (ushort)(i+0);
|
||||
(out+j+2)[1] = (ushort)(i+1);
|
||||
debug_printf(" line %d %d\n", (int)i+1, (int)i+3);
|
||||
(out+j+4)[0] = (ushort)(i+1);
|
||||
(out+j+4)[1] = (ushort)(i+3);
|
||||
debug_printf(" line %d %d\n", (int)i+3, (int)i+2);
|
||||
(out+j+6)[0] = (ushort)(i+3);
|
||||
(out+j+6)[1] = (ushort)(i+2);
|
||||
}
|
||||
@@ -172,13 +155,10 @@ static void generate_polygon_ushort(
|
||||
unsigned i, j;
|
||||
(void)j;
|
||||
for (j = i = 0; j < nr; j+=6, i++) {
|
||||
debug_printf(" line %d %d\n", (int)0, (int)i+1);
|
||||
(out+j)[0] = (ushort)(0);
|
||||
(out+j)[1] = (ushort)(i+1);
|
||||
debug_printf(" line %d %d\n", (int)i+1, (int)i+2);
|
||||
(out+j+2)[0] = (ushort)(i+1);
|
||||
(out+j+2)[1] = (ushort)(i+2);
|
||||
debug_printf(" line %d %d\n", (int)i+2, (int)0);
|
||||
(out+j+4)[0] = (ushort)(i+2);
|
||||
(out+j+4)[1] = (ushort)(0);
|
||||
}
|
||||
@@ -191,13 +171,10 @@ static void generate_tris_uint(
|
||||
unsigned i, j;
|
||||
(void)j;
|
||||
for (j = i = 0; j < nr; j+=6, i+=3) {
|
||||
debug_printf(" line %d %d\n", (int)i, (int)i+1);
|
||||
(out+j)[0] = (uint)(i);
|
||||
(out+j)[1] = (uint)(i+1);
|
||||
debug_printf(" line %d %d\n", (int)i+1, (int)i+2);
|
||||
(out+j+2)[0] = (uint)(i+1);
|
||||
(out+j+2)[1] = (uint)(i+2);
|
||||
debug_printf(" line %d %d\n", (int)i+2, (int)i);
|
||||
(out+j+4)[0] = (uint)(i+2);
|
||||
(out+j+4)[1] = (uint)(i);
|
||||
}
|
||||
@@ -210,13 +187,10 @@ static void generate_tristrip_uint(
|
||||
unsigned i, j;
|
||||
(void)j;
|
||||
for (j = i = 0; j < nr; j+=6, i++) {
|
||||
debug_printf(" line %d %d\n", (int)i, (int)i+1/*+(i&1)*/);
|
||||
(out+j)[0] = (uint)(i);
|
||||
(out+j)[1] = (uint)(i+1/*+(i&1)*/);
|
||||
debug_printf(" line %d %d\n", (int)i+1/*+(i&1)*/, (int)i+2/*-(i&1)*/);
|
||||
(out+j+2)[0] = (uint)(i+1/*+(i&1)*/);
|
||||
(out+j+2)[1] = (uint)(i+2/*-(i&1)*/);
|
||||
debug_printf(" line %d %d\n", (int)i+2/*-(i&1)*/, (int)i);
|
||||
(out+j+4)[0] = (uint)(i+2/*-(i&1)*/);
|
||||
(out+j+4)[1] = (uint)(i);
|
||||
}
|
||||
@@ -229,13 +203,10 @@ static void generate_trifan_uint(
|
||||
unsigned i, j;
|
||||
(void)j;
|
||||
for (j = i = 0; j < nr; j+=6, i++) {
|
||||
debug_printf(" line %d %d\n", (int)0, (int)i+1);
|
||||
(out+j)[0] = (uint)(0);
|
||||
(out+j)[1] = (uint)(i+1);
|
||||
debug_printf(" line %d %d\n", (int)i+1, (int)i+2);
|
||||
(out+j+2)[0] = (uint)(i+1);
|
||||
(out+j+2)[1] = (uint)(i+2);
|
||||
debug_printf(" line %d %d\n", (int)i+2, (int)0);
|
||||
(out+j+4)[0] = (uint)(i+2);
|
||||
(out+j+4)[1] = (uint)(0);
|
||||
}
|
||||
@@ -248,16 +219,12 @@ static void generate_quads_uint(
|
||||
unsigned i, j;
|
||||
(void)j;
|
||||
for (j = i = 0; j < nr; j+=8, i+=4) {
|
||||
debug_printf(" line %d %d\n", (int)i+0, (int)i+1);
|
||||
(out+j)[0] = (uint)(i+0);
|
||||
(out+j)[1] = (uint)(i+1);
|
||||
debug_printf(" line %d %d\n", (int)i+1, (int)i+2);
|
||||
(out+j+2)[0] = (uint)(i+1);
|
||||
(out+j+2)[1] = (uint)(i+2);
|
||||
debug_printf(" line %d %d\n", (int)i+2, (int)i+3);
|
||||
(out+j+4)[0] = (uint)(i+2);
|
||||
(out+j+4)[1] = (uint)(i+3);
|
||||
debug_printf(" line %d %d\n", (int)i+3, (int)i+0);
|
||||
(out+j+6)[0] = (uint)(i+3);
|
||||
(out+j+6)[1] = (uint)(i+0);
|
||||
}
|
||||
@@ -270,16 +237,12 @@ static void generate_quadstrip_uint(
|
||||
unsigned i, j;
|
||||
(void)j;
|
||||
for (j = i = 0; j < nr; j+=8, i+=2) {
|
||||
debug_printf(" line %d %d\n", (int)i+2, (int)i+0);
|
||||
(out+j)[0] = (uint)(i+2);
|
||||
(out+j)[1] = (uint)(i+0);
|
||||
debug_printf(" line %d %d\n", (int)i+0, (int)i+1);
|
||||
(out+j+2)[0] = (uint)(i+0);
|
||||
(out+j+2)[1] = (uint)(i+1);
|
||||
debug_printf(" line %d %d\n", (int)i+1, (int)i+3);
|
||||
(out+j+4)[0] = (uint)(i+1);
|
||||
(out+j+4)[1] = (uint)(i+3);
|
||||
debug_printf(" line %d %d\n", (int)i+3, (int)i+2);
|
||||
(out+j+6)[0] = (uint)(i+3);
|
||||
(out+j+6)[1] = (uint)(i+2);
|
||||
}
|
||||
@@ -292,13 +255,10 @@ static void generate_polygon_uint(
|
||||
unsigned i, j;
|
||||
(void)j;
|
||||
for (j = i = 0; j < nr; j+=6, i++) {
|
||||
debug_printf(" line %d %d\n", (int)0, (int)i+1);
|
||||
(out+j)[0] = (uint)(0);
|
||||
(out+j)[1] = (uint)(i+1);
|
||||
debug_printf(" line %d %d\n", (int)i+1, (int)i+2);
|
||||
(out+j+2)[0] = (uint)(i+1);
|
||||
(out+j+2)[1] = (uint)(i+2);
|
||||
debug_printf(" line %d %d\n", (int)i+2, (int)0);
|
||||
(out+j+4)[0] = (uint)(i+2);
|
||||
(out+j+4)[1] = (uint)(0);
|
||||
}
|
||||
@@ -313,13 +273,10 @@ static void translate_tris_ubyte2ushort(
|
||||
unsigned i, j;
|
||||
(void)j;
|
||||
for (j = i = 0; j < nr; j+=6, i+=3) {
|
||||
debug_printf(" line %d %d\n", (int)i, (int)i+1);
|
||||
(out+j)[0] = (ushort)in[i];
|
||||
(out+j)[1] = (ushort)in[i+1];
|
||||
debug_printf(" line %d %d\n", (int)i+1, (int)i+2);
|
||||
(out+j+2)[0] = (ushort)in[i+1];
|
||||
(out+j+2)[1] = (ushort)in[i+2];
|
||||
debug_printf(" line %d %d\n", (int)i+2, (int)i);
|
||||
(out+j+4)[0] = (ushort)in[i+2];
|
||||
(out+j+4)[1] = (ushort)in[i];
|
||||
}
|
||||
@@ -334,13 +291,10 @@ static void translate_tristrip_ubyte2ushort(
|
||||
unsigned i, j;
|
||||
(void)j;
|
||||
for (j = i = 0; j < nr; j+=6, i++) {
|
||||
debug_printf(" line %d %d\n", (int)i, (int)i+1/*+(i&1)*/);
|
||||
(out+j)[0] = (ushort)in[i];
|
||||
(out+j)[1] = (ushort)in[i+1/*+(i&1)*/];
|
||||
debug_printf(" line %d %d\n", (int)i+1/*+(i&1)*/, (int)i+2/*-(i&1)*/);
|
||||
(out+j+2)[0] = (ushort)in[i+1/*+(i&1)*/];
|
||||
(out+j+2)[1] = (ushort)in[i+2/*-(i&1)*/];
|
||||
debug_printf(" line %d %d\n", (int)i+2/*-(i&1)*/, (int)i);
|
||||
(out+j+4)[0] = (ushort)in[i+2/*-(i&1)*/];
|
||||
(out+j+4)[1] = (ushort)in[i];
|
||||
}
|
||||
@@ -355,13 +309,10 @@ static void translate_trifan_ubyte2ushort(
|
||||
unsigned i, j;
|
||||
(void)j;
|
||||
for (j = i = 0; j < nr; j+=6, i++) {
|
||||
debug_printf(" line %d %d\n", (int)0, (int)i+1);
|
||||
(out+j)[0] = (ushort)in[0];
|
||||
(out+j)[1] = (ushort)in[i+1];
|
||||
debug_printf(" line %d %d\n", (int)i+1, (int)i+2);
|
||||
(out+j+2)[0] = (ushort)in[i+1];
|
||||
(out+j+2)[1] = (ushort)in[i+2];
|
||||
debug_printf(" line %d %d\n", (int)i+2, (int)0);
|
||||
(out+j+4)[0] = (ushort)in[i+2];
|
||||
(out+j+4)[1] = (ushort)in[0];
|
||||
}
|
||||
@@ -376,16 +327,12 @@ static void translate_quads_ubyte2ushort(
|
||||
unsigned i, j;
|
||||
(void)j;
|
||||
for (j = i = 0; j < nr; j+=8, i+=4) {
|
||||
debug_printf(" line %d %d\n", (int)i+0, (int)i+1);
|
||||
(out+j)[0] = (ushort)in[i+0];
|
||||
(out+j)[1] = (ushort)in[i+1];
|
||||
debug_printf(" line %d %d\n", (int)i+1, (int)i+2);
|
||||
(out+j+2)[0] = (ushort)in[i+1];
|
||||
(out+j+2)[1] = (ushort)in[i+2];
|
||||
debug_printf(" line %d %d\n", (int)i+2, (int)i+3);
|
||||
(out+j+4)[0] = (ushort)in[i+2];
|
||||
(out+j+4)[1] = (ushort)in[i+3];
|
||||
debug_printf(" line %d %d\n", (int)i+3, (int)i+0);
|
||||
(out+j+6)[0] = (ushort)in[i+3];
|
||||
(out+j+6)[1] = (ushort)in[i+0];
|
||||
}
|
||||
@@ -400,16 +347,12 @@ static void translate_quadstrip_ubyte2ushort(
|
||||
unsigned i, j;
|
||||
(void)j;
|
||||
for (j = i = 0; j < nr; j+=8, i+=2) {
|
||||
debug_printf(" line %d %d\n", (int)i+2, (int)i+0);
|
||||
(out+j)[0] = (ushort)in[i+2];
|
||||
(out+j)[1] = (ushort)in[i+0];
|
||||
debug_printf(" line %d %d\n", (int)i+0, (int)i+1);
|
||||
(out+j+2)[0] = (ushort)in[i+0];
|
||||
(out+j+2)[1] = (ushort)in[i+1];
|
||||
debug_printf(" line %d %d\n", (int)i+1, (int)i+3);
|
||||
(out+j+4)[0] = (ushort)in[i+1];
|
||||
(out+j+4)[1] = (ushort)in[i+3];
|
||||
debug_printf(" line %d %d\n", (int)i+3, (int)i+2);
|
||||
(out+j+6)[0] = (ushort)in[i+3];
|
||||
(out+j+6)[1] = (ushort)in[i+2];
|
||||
}
|
||||
@@ -424,13 +367,10 @@ static void translate_polygon_ubyte2ushort(
|
||||
unsigned i, j;
|
||||
(void)j;
|
||||
for (j = i = 0; j < nr; j+=6, i++) {
|
||||
debug_printf(" line %d %d\n", (int)0, (int)i+1);
|
||||
(out+j)[0] = (ushort)in[0];
|
||||
(out+j)[1] = (ushort)in[i+1];
|
||||
debug_printf(" line %d %d\n", (int)i+1, (int)i+2);
|
||||
(out+j+2)[0] = (ushort)in[i+1];
|
||||
(out+j+2)[1] = (ushort)in[i+2];
|
||||
debug_printf(" line %d %d\n", (int)i+2, (int)0);
|
||||
(out+j+4)[0] = (ushort)in[i+2];
|
||||
(out+j+4)[1] = (ushort)in[0];
|
||||
}
|
||||
@@ -445,13 +385,10 @@ static void translate_tris_ubyte2uint(
|
||||
unsigned i, j;
|
||||
(void)j;
|
||||
for (j = i = 0; j < nr; j+=6, i+=3) {
|
||||
debug_printf(" line %d %d\n", (int)i, (int)i+1);
|
||||
(out+j)[0] = (uint)in[i];
|
||||
(out+j)[1] = (uint)in[i+1];
|
||||
debug_printf(" line %d %d\n", (int)i+1, (int)i+2);
|
||||
(out+j+2)[0] = (uint)in[i+1];
|
||||
(out+j+2)[1] = (uint)in[i+2];
|
||||
debug_printf(" line %d %d\n", (int)i+2, (int)i);
|
||||
(out+j+4)[0] = (uint)in[i+2];
|
||||
(out+j+4)[1] = (uint)in[i];
|
||||
}
|
||||
@@ -466,13 +403,10 @@ static void translate_tristrip_ubyte2uint(
|
||||
unsigned i, j;
|
||||
(void)j;
|
||||
for (j = i = 0; j < nr; j+=6, i++) {
|
||||
debug_printf(" line %d %d\n", (int)i, (int)i+1/*+(i&1)*/);
|
||||
(out+j)[0] = (uint)in[i];
|
||||
(out+j)[1] = (uint)in[i+1/*+(i&1)*/];
|
||||
debug_printf(" line %d %d\n", (int)i+1/*+(i&1)*/, (int)i+2/*-(i&1)*/);
|
||||
(out+j+2)[0] = (uint)in[i+1/*+(i&1)*/];
|
||||
(out+j+2)[1] = (uint)in[i+2/*-(i&1)*/];
|
||||
debug_printf(" line %d %d\n", (int)i+2/*-(i&1)*/, (int)i);
|
||||
(out+j+4)[0] = (uint)in[i+2/*-(i&1)*/];
|
||||
(out+j+4)[1] = (uint)in[i];
|
||||
}
|
||||
@@ -487,13 +421,10 @@ static void translate_trifan_ubyte2uint(
|
||||
unsigned i, j;
|
||||
(void)j;
|
||||
for (j = i = 0; j < nr; j+=6, i++) {
|
||||
debug_printf(" line %d %d\n", (int)0, (int)i+1);
|
||||
(out+j)[0] = (uint)in[0];
|
||||
(out+j)[1] = (uint)in[i+1];
|
||||
debug_printf(" line %d %d\n", (int)i+1, (int)i+2);
|
||||
(out+j+2)[0] = (uint)in[i+1];
|
||||
(out+j+2)[1] = (uint)in[i+2];
|
||||
debug_printf(" line %d %d\n", (int)i+2, (int)0);
|
||||
(out+j+4)[0] = (uint)in[i+2];
|
||||
(out+j+4)[1] = (uint)in[0];
|
||||
}
|
||||
@@ -508,16 +439,12 @@ static void translate_quads_ubyte2uint(
|
||||
unsigned i, j;
|
||||
(void)j;
|
||||
for (j = i = 0; j < nr; j+=8, i+=4) {
|
||||
debug_printf(" line %d %d\n", (int)i+0, (int)i+1);
|
||||
(out+j)[0] = (uint)in[i+0];
|
||||
(out+j)[1] = (uint)in[i+1];
|
||||
debug_printf(" line %d %d\n", (int)i+1, (int)i+2);
|
||||
(out+j+2)[0] = (uint)in[i+1];
|
||||
(out+j+2)[1] = (uint)in[i+2];
|
||||
debug_printf(" line %d %d\n", (int)i+2, (int)i+3);
|
||||
(out+j+4)[0] = (uint)in[i+2];
|
||||
(out+j+4)[1] = (uint)in[i+3];
|
||||
debug_printf(" line %d %d\n", (int)i+3, (int)i+0);
|
||||
(out+j+6)[0] = (uint)in[i+3];
|
||||
(out+j+6)[1] = (uint)in[i+0];
|
||||
}
|
||||
@@ -532,16 +459,12 @@ static void translate_quadstrip_ubyte2uint(
|
||||
unsigned i, j;
|
||||
(void)j;
|
||||
for (j = i = 0; j < nr; j+=8, i+=2) {
|
||||
debug_printf(" line %d %d\n", (int)i+2, (int)i+0);
|
||||
(out+j)[0] = (uint)in[i+2];
|
||||
(out+j)[1] = (uint)in[i+0];
|
||||
debug_printf(" line %d %d\n", (int)i+0, (int)i+1);
|
||||
(out+j+2)[0] = (uint)in[i+0];
|
||||
(out+j+2)[1] = (uint)in[i+1];
|
||||
debug_printf(" line %d %d\n", (int)i+1, (int)i+3);
|
||||
(out+j+4)[0] = (uint)in[i+1];
|
||||
(out+j+4)[1] = (uint)in[i+3];
|
||||
debug_printf(" line %d %d\n", (int)i+3, (int)i+2);
|
||||
(out+j+6)[0] = (uint)in[i+3];
|
||||
(out+j+6)[1] = (uint)in[i+2];
|
||||
}
|
||||
@@ -556,13 +479,10 @@ static void translate_polygon_ubyte2uint(
|
||||
unsigned i, j;
|
||||
(void)j;
|
||||
for (j = i = 0; j < nr; j+=6, i++) {
|
||||
debug_printf(" line %d %d\n", (int)0, (int)i+1);
|
||||
(out+j)[0] = (uint)in[0];
|
||||
(out+j)[1] = (uint)in[i+1];
|
||||
debug_printf(" line %d %d\n", (int)i+1, (int)i+2);
|
||||
(out+j+2)[0] = (uint)in[i+1];
|
||||
(out+j+2)[1] = (uint)in[i+2];
|
||||
debug_printf(" line %d %d\n", (int)i+2, (int)0);
|
||||
(out+j+4)[0] = (uint)in[i+2];
|
||||
(out+j+4)[1] = (uint)in[0];
|
||||
}
|
||||
@@ -577,13 +497,10 @@ static void translate_tris_ushort2ushort(
|
||||
unsigned i, j;
|
||||
(void)j;
|
||||
for (j = i = 0; j < nr; j+=6, i+=3) {
|
||||
debug_printf(" line %d %d\n", (int)i, (int)i+1);
|
||||
(out+j)[0] = (ushort)in[i];
|
||||
(out+j)[1] = (ushort)in[i+1];
|
||||
debug_printf(" line %d %d\n", (int)i+1, (int)i+2);
|
||||
(out+j+2)[0] = (ushort)in[i+1];
|
||||
(out+j+2)[1] = (ushort)in[i+2];
|
||||
debug_printf(" line %d %d\n", (int)i+2, (int)i);
|
||||
(out+j+4)[0] = (ushort)in[i+2];
|
||||
(out+j+4)[1] = (ushort)in[i];
|
||||
}
|
||||
@@ -598,13 +515,10 @@ static void translate_tristrip_ushort2ushort(
|
||||
unsigned i, j;
|
||||
(void)j;
|
||||
for (j = i = 0; j < nr; j+=6, i++) {
|
||||
debug_printf(" line %d %d\n", (int)i, (int)i+1/*+(i&1)*/);
|
||||
(out+j)[0] = (ushort)in[i];
|
||||
(out+j)[1] = (ushort)in[i+1/*+(i&1)*/];
|
||||
debug_printf(" line %d %d\n", (int)i+1/*+(i&1)*/, (int)i+2/*-(i&1)*/);
|
||||
(out+j+2)[0] = (ushort)in[i+1/*+(i&1)*/];
|
||||
(out+j+2)[1] = (ushort)in[i+2/*-(i&1)*/];
|
||||
debug_printf(" line %d %d\n", (int)i+2/*-(i&1)*/, (int)i);
|
||||
(out+j+4)[0] = (ushort)in[i+2/*-(i&1)*/];
|
||||
(out+j+4)[1] = (ushort)in[i];
|
||||
}
|
||||
@@ -619,13 +533,10 @@ static void translate_trifan_ushort2ushort(
|
||||
unsigned i, j;
|
||||
(void)j;
|
||||
for (j = i = 0; j < nr; j+=6, i++) {
|
||||
debug_printf(" line %d %d\n", (int)0, (int)i+1);
|
||||
(out+j)[0] = (ushort)in[0];
|
||||
(out+j)[1] = (ushort)in[i+1];
|
||||
debug_printf(" line %d %d\n", (int)i+1, (int)i+2);
|
||||
(out+j+2)[0] = (ushort)in[i+1];
|
||||
(out+j+2)[1] = (ushort)in[i+2];
|
||||
debug_printf(" line %d %d\n", (int)i+2, (int)0);
|
||||
(out+j+4)[0] = (ushort)in[i+2];
|
||||
(out+j+4)[1] = (ushort)in[0];
|
||||
}
|
||||
@@ -640,16 +551,12 @@ static void translate_quads_ushort2ushort(
|
||||
unsigned i, j;
|
||||
(void)j;
|
||||
for (j = i = 0; j < nr; j+=8, i+=4) {
|
||||
debug_printf(" line %d %d\n", (int)i+0, (int)i+1);
|
||||
(out+j)[0] = (ushort)in[i+0];
|
||||
(out+j)[1] = (ushort)in[i+1];
|
||||
debug_printf(" line %d %d\n", (int)i+1, (int)i+2);
|
||||
(out+j+2)[0] = (ushort)in[i+1];
|
||||
(out+j+2)[1] = (ushort)in[i+2];
|
||||
debug_printf(" line %d %d\n", (int)i+2, (int)i+3);
|
||||
(out+j+4)[0] = (ushort)in[i+2];
|
||||
(out+j+4)[1] = (ushort)in[i+3];
|
||||
debug_printf(" line %d %d\n", (int)i+3, (int)i+0);
|
||||
(out+j+6)[0] = (ushort)in[i+3];
|
||||
(out+j+6)[1] = (ushort)in[i+0];
|
||||
}
|
||||
@@ -664,16 +571,12 @@ static void translate_quadstrip_ushort2ushort(
|
||||
unsigned i, j;
|
||||
(void)j;
|
||||
for (j = i = 0; j < nr; j+=8, i+=2) {
|
||||
debug_printf(" line %d %d\n", (int)i+2, (int)i+0);
|
||||
(out+j)[0] = (ushort)in[i+2];
|
||||
(out+j)[1] = (ushort)in[i+0];
|
||||
debug_printf(" line %d %d\n", (int)i+0, (int)i+1);
|
||||
(out+j+2)[0] = (ushort)in[i+0];
|
||||
(out+j+2)[1] = (ushort)in[i+1];
|
||||
debug_printf(" line %d %d\n", (int)i+1, (int)i+3);
|
||||
(out+j+4)[0] = (ushort)in[i+1];
|
||||
(out+j+4)[1] = (ushort)in[i+3];
|
||||
debug_printf(" line %d %d\n", (int)i+3, (int)i+2);
|
||||
(out+j+6)[0] = (ushort)in[i+3];
|
||||
(out+j+6)[1] = (ushort)in[i+2];
|
||||
}
|
||||
@@ -688,13 +591,10 @@ static void translate_polygon_ushort2ushort(
|
||||
unsigned i, j;
|
||||
(void)j;
|
||||
for (j = i = 0; j < nr; j+=6, i++) {
|
||||
debug_printf(" line %d %d\n", (int)0, (int)i+1);
|
||||
(out+j)[0] = (ushort)in[0];
|
||||
(out+j)[1] = (ushort)in[i+1];
|
||||
debug_printf(" line %d %d\n", (int)i+1, (int)i+2);
|
||||
(out+j+2)[0] = (ushort)in[i+1];
|
||||
(out+j+2)[1] = (ushort)in[i+2];
|
||||
debug_printf(" line %d %d\n", (int)i+2, (int)0);
|
||||
(out+j+4)[0] = (ushort)in[i+2];
|
||||
(out+j+4)[1] = (ushort)in[0];
|
||||
}
|
||||
@@ -709,13 +609,10 @@ static void translate_tris_ushort2uint(
|
||||
unsigned i, j;
|
||||
(void)j;
|
||||
for (j = i = 0; j < nr; j+=6, i+=3) {
|
||||
debug_printf(" line %d %d\n", (int)i, (int)i+1);
|
||||
(out+j)[0] = (uint)in[i];
|
||||
(out+j)[1] = (uint)in[i+1];
|
||||
debug_printf(" line %d %d\n", (int)i+1, (int)i+2);
|
||||
(out+j+2)[0] = (uint)in[i+1];
|
||||
(out+j+2)[1] = (uint)in[i+2];
|
||||
debug_printf(" line %d %d\n", (int)i+2, (int)i);
|
||||
(out+j+4)[0] = (uint)in[i+2];
|
||||
(out+j+4)[1] = (uint)in[i];
|
||||
}
|
||||
@@ -730,13 +627,10 @@ static void translate_tristrip_ushort2uint(
|
||||
unsigned i, j;
|
||||
(void)j;
|
||||
for (j = i = 0; j < nr; j+=6, i++) {
|
||||
debug_printf(" line %d %d\n", (int)i, (int)i+1/*+(i&1)*/);
|
||||
(out+j)[0] = (uint)in[i];
|
||||
(out+j)[1] = (uint)in[i+1/*+(i&1)*/];
|
||||
debug_printf(" line %d %d\n", (int)i+1/*+(i&1)*/, (int)i+2/*-(i&1)*/);
|
||||
(out+j+2)[0] = (uint)in[i+1/*+(i&1)*/];
|
||||
(out+j+2)[1] = (uint)in[i+2/*-(i&1)*/];
|
||||
debug_printf(" line %d %d\n", (int)i+2/*-(i&1)*/, (int)i);
|
||||
(out+j+4)[0] = (uint)in[i+2/*-(i&1)*/];
|
||||
(out+j+4)[1] = (uint)in[i];
|
||||
}
|
||||
@@ -751,13 +645,10 @@ static void translate_trifan_ushort2uint(
|
||||
unsigned i, j;
|
||||
(void)j;
|
||||
for (j = i = 0; j < nr; j+=6, i++) {
|
||||
debug_printf(" line %d %d\n", (int)0, (int)i+1);
|
||||
(out+j)[0] = (uint)in[0];
|
||||
(out+j)[1] = (uint)in[i+1];
|
||||
debug_printf(" line %d %d\n", (int)i+1, (int)i+2);
|
||||
(out+j+2)[0] = (uint)in[i+1];
|
||||
(out+j+2)[1] = (uint)in[i+2];
|
||||
debug_printf(" line %d %d\n", (int)i+2, (int)0);
|
||||
(out+j+4)[0] = (uint)in[i+2];
|
||||
(out+j+4)[1] = (uint)in[0];
|
||||
}
|
||||
@@ -772,16 +663,12 @@ static void translate_quads_ushort2uint(
|
||||
unsigned i, j;
|
||||
(void)j;
|
||||
for (j = i = 0; j < nr; j+=8, i+=4) {
|
||||
debug_printf(" line %d %d\n", (int)i+0, (int)i+1);
|
||||
(out+j)[0] = (uint)in[i+0];
|
||||
(out+j)[1] = (uint)in[i+1];
|
||||
debug_printf(" line %d %d\n", (int)i+1, (int)i+2);
|
||||
(out+j+2)[0] = (uint)in[i+1];
|
||||
(out+j+2)[1] = (uint)in[i+2];
|
||||
debug_printf(" line %d %d\n", (int)i+2, (int)i+3);
|
||||
(out+j+4)[0] = (uint)in[i+2];
|
||||
(out+j+4)[1] = (uint)in[i+3];
|
||||
debug_printf(" line %d %d\n", (int)i+3, (int)i+0);
|
||||
(out+j+6)[0] = (uint)in[i+3];
|
||||
(out+j+6)[1] = (uint)in[i+0];
|
||||
}
|
||||
@@ -796,16 +683,12 @@ static void translate_quadstrip_ushort2uint(
|
||||
unsigned i, j;
|
||||
(void)j;
|
||||
for (j = i = 0; j < nr; j+=8, i+=2) {
|
||||
debug_printf(" line %d %d\n", (int)i+2, (int)i+0);
|
||||
(out+j)[0] = (uint)in[i+2];
|
||||
(out+j)[1] = (uint)in[i+0];
|
||||
debug_printf(" line %d %d\n", (int)i+0, (int)i+1);
|
||||
(out+j+2)[0] = (uint)in[i+0];
|
||||
(out+j+2)[1] = (uint)in[i+1];
|
||||
debug_printf(" line %d %d\n", (int)i+1, (int)i+3);
|
||||
(out+j+4)[0] = (uint)in[i+1];
|
||||
(out+j+4)[1] = (uint)in[i+3];
|
||||
debug_printf(" line %d %d\n", (int)i+3, (int)i+2);
|
||||
(out+j+6)[0] = (uint)in[i+3];
|
||||
(out+j+6)[1] = (uint)in[i+2];
|
||||
}
|
||||
@@ -820,13 +703,10 @@ static void translate_polygon_ushort2uint(
|
||||
unsigned i, j;
|
||||
(void)j;
|
||||
for (j = i = 0; j < nr; j+=6, i++) {
|
||||
debug_printf(" line %d %d\n", (int)0, (int)i+1);
|
||||
(out+j)[0] = (uint)in[0];
|
||||
(out+j)[1] = (uint)in[i+1];
|
||||
debug_printf(" line %d %d\n", (int)i+1, (int)i+2);
|
||||
(out+j+2)[0] = (uint)in[i+1];
|
||||
(out+j+2)[1] = (uint)in[i+2];
|
||||
debug_printf(" line %d %d\n", (int)i+2, (int)0);
|
||||
(out+j+4)[0] = (uint)in[i+2];
|
||||
(out+j+4)[1] = (uint)in[0];
|
||||
}
|
||||
@@ -841,13 +721,10 @@ static void translate_tris_uint2ushort(
|
||||
unsigned i, j;
|
||||
(void)j;
|
||||
for (j = i = 0; j < nr; j+=6, i+=3) {
|
||||
debug_printf(" line %d %d\n", (int)i, (int)i+1);
|
||||
(out+j)[0] = (ushort)in[i];
|
||||
(out+j)[1] = (ushort)in[i+1];
|
||||
debug_printf(" line %d %d\n", (int)i+1, (int)i+2);
|
||||
(out+j+2)[0] = (ushort)in[i+1];
|
||||
(out+j+2)[1] = (ushort)in[i+2];
|
||||
debug_printf(" line %d %d\n", (int)i+2, (int)i);
|
||||
(out+j+4)[0] = (ushort)in[i+2];
|
||||
(out+j+4)[1] = (ushort)in[i];
|
||||
}
|
||||
@@ -862,13 +739,10 @@ static void translate_tristrip_uint2ushort(
|
||||
unsigned i, j;
|
||||
(void)j;
|
||||
for (j = i = 0; j < nr; j+=6, i++) {
|
||||
debug_printf(" line %d %d\n", (int)i, (int)i+1/*+(i&1)*/);
|
||||
(out+j)[0] = (ushort)in[i];
|
||||
(out+j)[1] = (ushort)in[i+1/*+(i&1)*/];
|
||||
debug_printf(" line %d %d\n", (int)i+1/*+(i&1)*/, (int)i+2/*-(i&1)*/);
|
||||
(out+j+2)[0] = (ushort)in[i+1/*+(i&1)*/];
|
||||
(out+j+2)[1] = (ushort)in[i+2/*-(i&1)*/];
|
||||
debug_printf(" line %d %d\n", (int)i+2/*-(i&1)*/, (int)i);
|
||||
(out+j+4)[0] = (ushort)in[i+2/*-(i&1)*/];
|
||||
(out+j+4)[1] = (ushort)in[i];
|
||||
}
|
||||
@@ -883,13 +757,10 @@ static void translate_trifan_uint2ushort(
|
||||
unsigned i, j;
|
||||
(void)j;
|
||||
for (j = i = 0; j < nr; j+=6, i++) {
|
||||
debug_printf(" line %d %d\n", (int)0, (int)i+1);
|
||||
(out+j)[0] = (ushort)in[0];
|
||||
(out+j)[1] = (ushort)in[i+1];
|
||||
debug_printf(" line %d %d\n", (int)i+1, (int)i+2);
|
||||
(out+j+2)[0] = (ushort)in[i+1];
|
||||
(out+j+2)[1] = (ushort)in[i+2];
|
||||
debug_printf(" line %d %d\n", (int)i+2, (int)0);
|
||||
(out+j+4)[0] = (ushort)in[i+2];
|
||||
(out+j+4)[1] = (ushort)in[0];
|
||||
}
|
||||
@@ -904,16 +775,12 @@ static void translate_quads_uint2ushort(
|
||||
unsigned i, j;
|
||||
(void)j;
|
||||
for (j = i = 0; j < nr; j+=8, i+=4) {
|
||||
debug_printf(" line %d %d\n", (int)i+0, (int)i+1);
|
||||
(out+j)[0] = (ushort)in[i+0];
|
||||
(out+j)[1] = (ushort)in[i+1];
|
||||
debug_printf(" line %d %d\n", (int)i+1, (int)i+2);
|
||||
(out+j+2)[0] = (ushort)in[i+1];
|
||||
(out+j+2)[1] = (ushort)in[i+2];
|
||||
debug_printf(" line %d %d\n", (int)i+2, (int)i+3);
|
||||
(out+j+4)[0] = (ushort)in[i+2];
|
||||
(out+j+4)[1] = (ushort)in[i+3];
|
||||
debug_printf(" line %d %d\n", (int)i+3, (int)i+0);
|
||||
(out+j+6)[0] = (ushort)in[i+3];
|
||||
(out+j+6)[1] = (ushort)in[i+0];
|
||||
}
|
||||
@@ -928,16 +795,12 @@ static void translate_quadstrip_uint2ushort(
|
||||
unsigned i, j;
|
||||
(void)j;
|
||||
for (j = i = 0; j < nr; j+=8, i+=2) {
|
||||
debug_printf(" line %d %d\n", (int)i+2, (int)i+0);
|
||||
(out+j)[0] = (ushort)in[i+2];
|
||||
(out+j)[1] = (ushort)in[i+0];
|
||||
debug_printf(" line %d %d\n", (int)i+0, (int)i+1);
|
||||
(out+j+2)[0] = (ushort)in[i+0];
|
||||
(out+j+2)[1] = (ushort)in[i+1];
|
||||
debug_printf(" line %d %d\n", (int)i+1, (int)i+3);
|
||||
(out+j+4)[0] = (ushort)in[i+1];
|
||||
(out+j+4)[1] = (ushort)in[i+3];
|
||||
debug_printf(" line %d %d\n", (int)i+3, (int)i+2);
|
||||
(out+j+6)[0] = (ushort)in[i+3];
|
||||
(out+j+6)[1] = (ushort)in[i+2];
|
||||
}
|
||||
@@ -952,13 +815,10 @@ static void translate_polygon_uint2ushort(
|
||||
unsigned i, j;
|
||||
(void)j;
|
||||
for (j = i = 0; j < nr; j+=6, i++) {
|
||||
debug_printf(" line %d %d\n", (int)0, (int)i+1);
|
||||
(out+j)[0] = (ushort)in[0];
|
||||
(out+j)[1] = (ushort)in[i+1];
|
||||
debug_printf(" line %d %d\n", (int)i+1, (int)i+2);
|
||||
(out+j+2)[0] = (ushort)in[i+1];
|
||||
(out+j+2)[1] = (ushort)in[i+2];
|
||||
debug_printf(" line %d %d\n", (int)i+2, (int)0);
|
||||
(out+j+4)[0] = (ushort)in[i+2];
|
||||
(out+j+4)[1] = (ushort)in[0];
|
||||
}
|
||||
@@ -973,13 +833,10 @@ static void translate_tris_uint2uint(
|
||||
unsigned i, j;
|
||||
(void)j;
|
||||
for (j = i = 0; j < nr; j+=6, i+=3) {
|
||||
debug_printf(" line %d %d\n", (int)i, (int)i+1);
|
||||
(out+j)[0] = (uint)in[i];
|
||||
(out+j)[1] = (uint)in[i+1];
|
||||
debug_printf(" line %d %d\n", (int)i+1, (int)i+2);
|
||||
(out+j+2)[0] = (uint)in[i+1];
|
||||
(out+j+2)[1] = (uint)in[i+2];
|
||||
debug_printf(" line %d %d\n", (int)i+2, (int)i);
|
||||
(out+j+4)[0] = (uint)in[i+2];
|
||||
(out+j+4)[1] = (uint)in[i];
|
||||
}
|
||||
@@ -994,13 +851,10 @@ static void translate_tristrip_uint2uint(
|
||||
unsigned i, j;
|
||||
(void)j;
|
||||
for (j = i = 0; j < nr; j+=6, i++) {
|
||||
debug_printf(" line %d %d\n", (int)i, (int)i+1/*+(i&1)*/);
|
||||
(out+j)[0] = (uint)in[i];
|
||||
(out+j)[1] = (uint)in[i+1/*+(i&1)*/];
|
||||
debug_printf(" line %d %d\n", (int)i+1/*+(i&1)*/, (int)i+2/*-(i&1)*/);
|
||||
(out+j+2)[0] = (uint)in[i+1/*+(i&1)*/];
|
||||
(out+j+2)[1] = (uint)in[i+2/*-(i&1)*/];
|
||||
debug_printf(" line %d %d\n", (int)i+2/*-(i&1)*/, (int)i);
|
||||
(out+j+4)[0] = (uint)in[i+2/*-(i&1)*/];
|
||||
(out+j+4)[1] = (uint)in[i];
|
||||
}
|
||||
@@ -1015,13 +869,10 @@ static void translate_trifan_uint2uint(
|
||||
unsigned i, j;
|
||||
(void)j;
|
||||
for (j = i = 0; j < nr; j+=6, i++) {
|
||||
debug_printf(" line %d %d\n", (int)0, (int)i+1);
|
||||
(out+j)[0] = (uint)in[0];
|
||||
(out+j)[1] = (uint)in[i+1];
|
||||
debug_printf(" line %d %d\n", (int)i+1, (int)i+2);
|
||||
(out+j+2)[0] = (uint)in[i+1];
|
||||
(out+j+2)[1] = (uint)in[i+2];
|
||||
debug_printf(" line %d %d\n", (int)i+2, (int)0);
|
||||
(out+j+4)[0] = (uint)in[i+2];
|
||||
(out+j+4)[1] = (uint)in[0];
|
||||
}
|
||||
@@ -1036,16 +887,12 @@ static void translate_quads_uint2uint(
|
||||
unsigned i, j;
|
||||
(void)j;
|
||||
for (j = i = 0; j < nr; j+=8, i+=4) {
|
||||
debug_printf(" line %d %d\n", (int)i+0, (int)i+1);
|
||||
(out+j)[0] = (uint)in[i+0];
|
||||
(out+j)[1] = (uint)in[i+1];
|
||||
debug_printf(" line %d %d\n", (int)i+1, (int)i+2);
|
||||
(out+j+2)[0] = (uint)in[i+1];
|
||||
(out+j+2)[1] = (uint)in[i+2];
|
||||
debug_printf(" line %d %d\n", (int)i+2, (int)i+3);
|
||||
(out+j+4)[0] = (uint)in[i+2];
|
||||
(out+j+4)[1] = (uint)in[i+3];
|
||||
debug_printf(" line %d %d\n", (int)i+3, (int)i+0);
|
||||
(out+j+6)[0] = (uint)in[i+3];
|
||||
(out+j+6)[1] = (uint)in[i+0];
|
||||
}
|
||||
@@ -1060,16 +907,12 @@ static void translate_quadstrip_uint2uint(
|
||||
unsigned i, j;
|
||||
(void)j;
|
||||
for (j = i = 0; j < nr; j+=8, i+=2) {
|
||||
debug_printf(" line %d %d\n", (int)i+2, (int)i+0);
|
||||
(out+j)[0] = (uint)in[i+2];
|
||||
(out+j)[1] = (uint)in[i+0];
|
||||
debug_printf(" line %d %d\n", (int)i+0, (int)i+1);
|
||||
(out+j+2)[0] = (uint)in[i+0];
|
||||
(out+j+2)[1] = (uint)in[i+1];
|
||||
debug_printf(" line %d %d\n", (int)i+1, (int)i+3);
|
||||
(out+j+4)[0] = (uint)in[i+1];
|
||||
(out+j+4)[1] = (uint)in[i+3];
|
||||
debug_printf(" line %d %d\n", (int)i+3, (int)i+2);
|
||||
(out+j+6)[0] = (uint)in[i+3];
|
||||
(out+j+6)[1] = (uint)in[i+2];
|
||||
}
|
||||
@@ -1084,13 +927,10 @@ static void translate_polygon_uint2uint(
|
||||
unsigned i, j;
|
||||
(void)j;
|
||||
for (j = i = 0; j < nr; j+=6, i++) {
|
||||
debug_printf(" line %d %d\n", (int)0, (int)i+1);
|
||||
(out+j)[0] = (uint)in[0];
|
||||
(out+j)[1] = (uint)in[i+1];
|
||||
debug_printf(" line %d %d\n", (int)i+1, (int)i+2);
|
||||
(out+j+2)[0] = (uint)in[i+1];
|
||||
(out+j+2)[1] = (uint)in[i+2];
|
||||
debug_printf(" line %d %d\n", (int)i+2, (int)0);
|
||||
(out+j+4)[0] = (uint)in[i+2];
|
||||
(out+j+4)[1] = (uint)in[0];
|
||||
}
|
||||
|
||||
@@ -99,7 +99,6 @@ def vert( intype, outtype, v0 ):
|
||||
return '(' + outtype + ')in[' + v0 + ']'
|
||||
|
||||
def line( intype, outtype, ptr, v0, v1 ):
|
||||
print ' debug_printf(" line %d %d\\n", (int)' + v0 + ', (int)' + v1 + ');'
|
||||
print ' (' + ptr + ')[0] = ' + vert( intype, outtype, v0 ) + ';'
|
||||
print ' (' + ptr + ')[1] = ' + vert( intype, outtype, v1 ) + ';'
|
||||
|
||||
|
||||
@@ -365,21 +365,22 @@ fenced_buffer_validate(struct pb_buffer *buf,
|
||||
if(fenced_buf->vl && fenced_buf->vl != vl)
|
||||
return PIPE_ERROR_RETRY;
|
||||
|
||||
#if 0
|
||||
/* Do not validate if buffer is still mapped */
|
||||
if(fenced_buf->flags & PIPE_BUFFER_USAGE_CPU_READ_WRITE) {
|
||||
/* TODO: wait for the thread that mapped the buffer to unmap it */
|
||||
return PIPE_ERROR_RETRY;
|
||||
}
|
||||
/* Final sanity checking */
|
||||
assert(!(fenced_buf->flags & PIPE_BUFFER_USAGE_CPU_READ_WRITE));
|
||||
assert(!fenced_buf->mapcount);
|
||||
#endif
|
||||
|
||||
if(fenced_buf->vl == vl &&
|
||||
(fenced_buf->validation_flags & flags) == flags) {
|
||||
/* Nothing to do -- buffer already validated */
|
||||
return PIPE_OK;
|
||||
}
|
||||
|
||||
/* Final sanity checking */
|
||||
assert(!(fenced_buf->flags & PIPE_BUFFER_USAGE_CPU_READ_WRITE));
|
||||
assert(!fenced_buf->mapcount);
|
||||
|
||||
ret = pb_validate(fenced_buf->buffer, vl, flags);
|
||||
if (ret != PIPE_OK)
|
||||
@@ -530,16 +531,17 @@ fenced_buffer_list_dump(struct fenced_buffer_list *fenced_list)
|
||||
|
||||
pipe_mutex_lock(fenced_list->mutex);
|
||||
|
||||
debug_printf("%10s %7s %10s %s\n",
|
||||
"buffer", "reference.count", "fence", "signalled");
|
||||
debug_printf("%10s %7s %7s %10s %s\n",
|
||||
"buffer", "size", "refcount", "fence", "signalled");
|
||||
|
||||
curr = fenced_list->unfenced.next;
|
||||
next = curr->next;
|
||||
while(curr != &fenced_list->unfenced) {
|
||||
fenced_buf = LIST_ENTRY(struct fenced_buffer, curr, head);
|
||||
assert(!fenced_buf->fence);
|
||||
debug_printf("%10p %7u\n",
|
||||
debug_printf("%10p %7u %7u\n",
|
||||
fenced_buf,
|
||||
fenced_buf->base.base.size,
|
||||
fenced_buf->base.base.reference.count);
|
||||
curr = next;
|
||||
next = curr->next;
|
||||
@@ -551,8 +553,9 @@ fenced_buffer_list_dump(struct fenced_buffer_list *fenced_list)
|
||||
int signaled;
|
||||
fenced_buf = LIST_ENTRY(struct fenced_buffer, curr, head);
|
||||
signaled = ops->fence_signalled(ops, fenced_buf->fence, 0);
|
||||
debug_printf("%10p %7u %10p %s\n",
|
||||
debug_printf("%10p %7u %7u %10p %s\n",
|
||||
fenced_buf,
|
||||
fenced_buf->base.base.size,
|
||||
fenced_buf->base.base.reference.count,
|
||||
fenced_buf->fence,
|
||||
signaled == 0 ? "y" : "n");
|
||||
|
||||
@@ -40,6 +40,7 @@
|
||||
#include "util/u_memory.h"
|
||||
#include "util/u_double_list.h"
|
||||
#include "util/u_time.h"
|
||||
#include "util/u_debug_stack.h"
|
||||
|
||||
#include "pb_buffer.h"
|
||||
#include "pb_bufmgr.h"
|
||||
@@ -48,6 +49,10 @@
|
||||
#ifdef DEBUG
|
||||
|
||||
|
||||
#define PB_DEBUG_CREATE_BACKTRACE 8
|
||||
#define PB_DEBUG_MAP_BACKTRACE 8
|
||||
|
||||
|
||||
/**
|
||||
* Convenience macro (type safe).
|
||||
*/
|
||||
@@ -69,6 +74,14 @@ struct pb_debug_buffer
|
||||
|
||||
size_t underflow_size;
|
||||
size_t overflow_size;
|
||||
|
||||
struct debug_stack_frame create_backtrace[PB_DEBUG_CREATE_BACKTRACE];
|
||||
|
||||
pipe_mutex mutex;
|
||||
unsigned map_count;
|
||||
struct debug_stack_frame map_backtrace[PB_DEBUG_MAP_BACKTRACE];
|
||||
|
||||
struct list_head head;
|
||||
};
|
||||
|
||||
|
||||
@@ -80,6 +93,9 @@ struct pb_debug_manager
|
||||
|
||||
size_t underflow_size;
|
||||
size_t overflow_size;
|
||||
|
||||
pipe_mutex mutex;
|
||||
struct list_head list;
|
||||
};
|
||||
|
||||
|
||||
@@ -189,6 +205,9 @@ pb_debug_buffer_check(struct pb_debug_buffer *buf)
|
||||
max_ofs == buf->overflow_size - 1 ? "+" : "");
|
||||
}
|
||||
|
||||
if(underflow || overflow)
|
||||
debug_backtrace_dump(buf->create_backtrace, PB_DEBUG_CREATE_BACKTRACE);
|
||||
|
||||
debug_assert(!underflow && !overflow);
|
||||
|
||||
/* re-fill if not aborted */
|
||||
@@ -207,11 +226,18 @@ static void
|
||||
pb_debug_buffer_destroy(struct pb_buffer *_buf)
|
||||
{
|
||||
struct pb_debug_buffer *buf = pb_debug_buffer(_buf);
|
||||
struct pb_debug_manager *mgr = buf->mgr;
|
||||
|
||||
assert(!pipe_is_referenced(&buf->base.base.reference));
|
||||
|
||||
pb_debug_buffer_check(buf);
|
||||
|
||||
pipe_mutex_lock(mgr->mutex);
|
||||
LIST_DEL(&buf->head);
|
||||
pipe_mutex_unlock(mgr->mutex);
|
||||
|
||||
pipe_mutex_destroy(buf->mutex);
|
||||
|
||||
pb_reference(&buf->buffer, NULL);
|
||||
FREE(buf);
|
||||
}
|
||||
@@ -230,6 +256,13 @@ pb_debug_buffer_map(struct pb_buffer *_buf,
|
||||
if(!map)
|
||||
return NULL;
|
||||
|
||||
if(map) {
|
||||
pipe_mutex_lock(buf->mutex);
|
||||
++buf->map_count;
|
||||
debug_backtrace_capture(buf->map_backtrace, 1, PB_DEBUG_MAP_BACKTRACE);
|
||||
pipe_mutex_unlock(buf->mutex);
|
||||
}
|
||||
|
||||
return (uint8_t *)map + buf->underflow_size;
|
||||
}
|
||||
|
||||
@@ -238,6 +271,13 @@ static void
|
||||
pb_debug_buffer_unmap(struct pb_buffer *_buf)
|
||||
{
|
||||
struct pb_debug_buffer *buf = pb_debug_buffer(_buf);
|
||||
|
||||
pipe_mutex_lock(buf->mutex);
|
||||
assert(buf->map_count);
|
||||
if(buf->map_count)
|
||||
--buf->map_count;
|
||||
pipe_mutex_unlock(buf->mutex);
|
||||
|
||||
pb_unmap(buf->buffer);
|
||||
|
||||
pb_debug_buffer_check(buf);
|
||||
@@ -262,6 +302,14 @@ pb_debug_buffer_validate(struct pb_buffer *_buf,
|
||||
{
|
||||
struct pb_debug_buffer *buf = pb_debug_buffer(_buf);
|
||||
|
||||
pipe_mutex_lock(buf->mutex);
|
||||
if(buf->map_count) {
|
||||
debug_printf("%s: attempting to validate a mapped buffer\n", __FUNCTION__);
|
||||
debug_printf("last map backtrace is\n");
|
||||
debug_backtrace_dump(buf->map_backtrace, PB_DEBUG_MAP_BACKTRACE);
|
||||
}
|
||||
pipe_mutex_unlock(buf->mutex);
|
||||
|
||||
pb_debug_buffer_check(buf);
|
||||
|
||||
return pb_validate(buf->buffer, vl, flags);
|
||||
@@ -288,6 +336,31 @@ pb_debug_buffer_vtbl = {
|
||||
};
|
||||
|
||||
|
||||
static void
|
||||
pb_debug_manager_dump(struct pb_debug_manager *mgr)
|
||||
{
|
||||
struct list_head *curr, *next;
|
||||
struct pb_debug_buffer *buf;
|
||||
|
||||
pipe_mutex_lock(mgr->mutex);
|
||||
|
||||
curr = mgr->list.next;
|
||||
next = curr->next;
|
||||
while(curr != &mgr->list) {
|
||||
buf = LIST_ENTRY(struct pb_debug_buffer, curr, head);
|
||||
|
||||
debug_printf("buffer = %p\n", buf);
|
||||
debug_printf(" .size = %p\n", buf->base.base.size);
|
||||
debug_backtrace_dump(buf->create_backtrace, PB_DEBUG_CREATE_BACKTRACE);
|
||||
|
||||
curr = next;
|
||||
next = curr->next;
|
||||
}
|
||||
|
||||
pipe_mutex_unlock(mgr->mutex);
|
||||
}
|
||||
|
||||
|
||||
static struct pb_buffer *
|
||||
pb_debug_manager_create_buffer(struct pb_manager *_mgr,
|
||||
size_t size,
|
||||
@@ -312,6 +385,13 @@ pb_debug_manager_create_buffer(struct pb_manager *_mgr,
|
||||
&real_desc);
|
||||
if(!buf->buffer) {
|
||||
FREE(buf);
|
||||
#if 0
|
||||
pipe_mutex_lock(mgr->mutex);
|
||||
debug_printf("%s: failed to create buffer\n", __FUNCTION__);
|
||||
if(!LIST_IS_EMPTY(&mgr->list))
|
||||
pb_debug_manager_dump(mgr);
|
||||
pipe_mutex_unlock(mgr->mutex);
|
||||
#endif
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -331,8 +411,16 @@ pb_debug_manager_create_buffer(struct pb_manager *_mgr,
|
||||
buf->underflow_size = mgr->underflow_size;
|
||||
buf->overflow_size = buf->buffer->base.size - buf->underflow_size - size;
|
||||
|
||||
debug_backtrace_capture(buf->create_backtrace, 1, PB_DEBUG_CREATE_BACKTRACE);
|
||||
|
||||
pb_debug_buffer_fill(buf);
|
||||
|
||||
pipe_mutex_init(buf->mutex);
|
||||
|
||||
pipe_mutex_lock(mgr->mutex);
|
||||
LIST_ADDTAIL(&buf->head, &mgr->list);
|
||||
pipe_mutex_unlock(mgr->mutex);
|
||||
|
||||
return &buf->base;
|
||||
}
|
||||
|
||||
@@ -351,6 +439,15 @@ static void
|
||||
pb_debug_manager_destroy(struct pb_manager *_mgr)
|
||||
{
|
||||
struct pb_debug_manager *mgr = pb_debug_manager(_mgr);
|
||||
|
||||
pipe_mutex_lock(mgr->mutex);
|
||||
if(!LIST_IS_EMPTY(&mgr->list)) {
|
||||
debug_printf("%s: unfreed buffers\n", __FUNCTION__);
|
||||
pb_debug_manager_dump(mgr);
|
||||
}
|
||||
pipe_mutex_unlock(mgr->mutex);
|
||||
|
||||
pipe_mutex_destroy(mgr->mutex);
|
||||
mgr->provider->destroy(mgr->provider);
|
||||
FREE(mgr);
|
||||
}
|
||||
@@ -375,7 +472,10 @@ pb_debug_manager_create(struct pb_manager *provider,
|
||||
mgr->provider = provider;
|
||||
mgr->underflow_size = underflow_size;
|
||||
mgr->overflow_size = overflow_size;
|
||||
|
||||
|
||||
pipe_mutex_init(mgr->mutex);
|
||||
LIST_INITHEAD(&mgr->list);
|
||||
|
||||
return &mgr->base;
|
||||
}
|
||||
|
||||
|
||||
@@ -53,6 +53,7 @@
|
||||
#include "pipe/p_compiler.h"
|
||||
#include "pipe/p_state.h"
|
||||
#include "pipe/p_shader_tokens.h"
|
||||
#include "tgsi/tgsi_dump.h"
|
||||
#include "tgsi/tgsi_parse.h"
|
||||
#include "tgsi/tgsi_util.h"
|
||||
#include "tgsi_exec.h"
|
||||
@@ -169,6 +170,56 @@ print_temp(const struct tgsi_exec_machine *mach, uint index)
|
||||
#endif
|
||||
|
||||
|
||||
/**
|
||||
* Check if there's a potential src/dst register data dependency when
|
||||
* using SOA execution.
|
||||
* Example:
|
||||
* MOV T, T.yxwz;
|
||||
* This would expand into:
|
||||
* MOV t0, t1;
|
||||
* MOV t1, t0;
|
||||
* MOV t2, t3;
|
||||
* MOV t3, t2;
|
||||
* The second instruction will have the wrong value for t0 if executed as-is.
|
||||
*/
|
||||
static boolean
|
||||
tgsi_check_soa_dependencies(const struct tgsi_full_instruction *inst)
|
||||
{
|
||||
uint i, chan;
|
||||
|
||||
uint writemask = inst->FullDstRegisters[0].DstRegister.WriteMask;
|
||||
if (writemask == TGSI_WRITEMASK_X ||
|
||||
writemask == TGSI_WRITEMASK_Y ||
|
||||
writemask == TGSI_WRITEMASK_Z ||
|
||||
writemask == TGSI_WRITEMASK_W ||
|
||||
writemask == TGSI_WRITEMASK_NONE) {
|
||||
/* no chance of data dependency */
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* loop over src regs */
|
||||
for (i = 0; i < inst->Instruction.NumSrcRegs; i++) {
|
||||
if ((inst->FullSrcRegisters[i].SrcRegister.File ==
|
||||
inst->FullDstRegisters[0].DstRegister.File) &&
|
||||
(inst->FullSrcRegisters[i].SrcRegister.Index ==
|
||||
inst->FullDstRegisters[0].DstRegister.Index)) {
|
||||
/* loop over dest channels */
|
||||
uint channelsWritten = 0x0;
|
||||
FOR_EACH_ENABLED_CHANNEL(*inst, chan) {
|
||||
/* check if we're reading a channel that's been written */
|
||||
uint swizzle = tgsi_util_get_full_src_register_extswizzle(&inst->FullSrcRegisters[i], chan);
|
||||
if (swizzle <= TGSI_SWIZZLE_W &&
|
||||
(channelsWritten & (1 << swizzle))) {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
channelsWritten |= (1 << chan);
|
||||
}
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Initialize machine state by expanding tokens to full instructions,
|
||||
@@ -280,6 +331,17 @@ tgsi_exec_machine_bind_shader(
|
||||
memcpy(instructions + numInstructions,
|
||||
&parse.FullToken.FullInstruction,
|
||||
sizeof(instructions[0]));
|
||||
|
||||
#if 0
|
||||
if (tgsi_check_soa_dependencies(&parse.FullToken.FullInstruction)) {
|
||||
debug_printf("SOA dependency in instruction:\n");
|
||||
tgsi_dump_instruction(&parse.FullToken.FullInstruction,
|
||||
numInstructions);
|
||||
}
|
||||
#else
|
||||
(void) tgsi_check_soa_dependencies;
|
||||
#endif
|
||||
|
||||
numInstructions++;
|
||||
break;
|
||||
|
||||
|
||||
@@ -1466,6 +1466,31 @@ emit_cmp(
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check if inst src/dest regs use indirect addressing into temporary
|
||||
* register file.
|
||||
*/
|
||||
static boolean
|
||||
indirect_temp_reference(const struct tgsi_full_instruction *inst)
|
||||
{
|
||||
uint i;
|
||||
for (i = 0; i < inst->Instruction.NumSrcRegs; i++) {
|
||||
const struct tgsi_full_src_register *reg = &inst->FullSrcRegisters[i];
|
||||
if (reg->SrcRegister.File == TGSI_FILE_TEMPORARY &&
|
||||
reg->SrcRegister.Indirect)
|
||||
return TRUE;
|
||||
}
|
||||
for (i = 0; i < inst->Instruction.NumDstRegs; i++) {
|
||||
const struct tgsi_full_dst_register *reg = &inst->FullDstRegisters[i];
|
||||
if (reg->DstRegister.File == TGSI_FILE_TEMPORARY &&
|
||||
reg->DstRegister.Indirect)
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
emit_instruction(
|
||||
struct x86_function *func,
|
||||
@@ -1473,6 +1498,10 @@ emit_instruction(
|
||||
{
|
||||
unsigned chan_index;
|
||||
|
||||
/* we can't handle indirect addressing into temp register file yet */
|
||||
if (indirect_temp_reference(inst))
|
||||
return FALSE;
|
||||
|
||||
switch (inst->Instruction.Opcode) {
|
||||
case TGSI_OPCODE_ARL:
|
||||
FOR_EACH_DST0_ENABLED_CHANNEL( *inst, chan_index ) {
|
||||
|
||||
@@ -198,3 +198,30 @@ tgsi_transform_shader(const struct tgsi_token *tokens_in,
|
||||
|
||||
return ctx->ti;
|
||||
}
|
||||
|
||||
|
||||
#include "tgsi_text.h"
|
||||
|
||||
extern int tgsi_transform_foo( struct tgsi_token *tokens_out,
|
||||
uint max_tokens_out );
|
||||
|
||||
/* This function exists only so that tgsi_text_translate() doesn't get
|
||||
* magic-ed out of the libtgsi.a archive by the build system. Don't
|
||||
* remove unless you know this has been fixed - check on mingw/scons
|
||||
* builds as well.
|
||||
*/
|
||||
int
|
||||
tgsi_transform_foo( struct tgsi_token *tokens_out,
|
||||
uint max_tokens_out )
|
||||
{
|
||||
const char *text =
|
||||
"FRAG1.1\n"
|
||||
"DCL IN[0], COLOR, CONSTANT\n"
|
||||
"DCL OUT[0], COLOR\n"
|
||||
" 0: MOV OUT[0], IN[0]\n"
|
||||
" 1: END";
|
||||
|
||||
return tgsi_text_translate( text,
|
||||
tokens_out,
|
||||
max_tokens_out );
|
||||
}
|
||||
|
||||
@@ -721,6 +721,7 @@ void
|
||||
debug_dump_surface_bmp(const char *filename,
|
||||
struct pipe_surface *surface)
|
||||
{
|
||||
#ifndef PIPE_SUBSYSTEM_WINDOWS_MINIPORT
|
||||
struct pipe_transfer *transfer;
|
||||
struct pipe_texture *texture = surface->texture;
|
||||
struct pipe_screen *screen = texture->screen;
|
||||
@@ -733,6 +734,7 @@ debug_dump_surface_bmp(const char *filename,
|
||||
debug_dump_transfer_bmp(filename, transfer);
|
||||
|
||||
screen->tex_transfer_destroy(transfer);
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
@@ -740,32 +742,56 @@ debug_dump_transfer_bmp(const char *filename,
|
||||
struct pipe_transfer *transfer)
|
||||
{
|
||||
#ifndef PIPE_SUBSYSTEM_WINDOWS_MINIPORT
|
||||
struct util_stream *stream;
|
||||
struct bmp_file_header bmfh;
|
||||
struct bmp_info_header bmih;
|
||||
float *rgba;
|
||||
unsigned x, y;
|
||||
|
||||
if (!transfer)
|
||||
goto error1;
|
||||
|
||||
rgba = MALLOC(transfer->width*transfer->height*4*sizeof(float));
|
||||
if(!rgba)
|
||||
goto error1;
|
||||
|
||||
pipe_get_tile_rgba(transfer, 0, 0,
|
||||
transfer->width, transfer->height,
|
||||
rgba);
|
||||
|
||||
debug_dump_float_rgba_bmp(filename,
|
||||
transfer->width, transfer->height,
|
||||
rgba, transfer->width);
|
||||
|
||||
FREE(rgba);
|
||||
error1:
|
||||
;
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
debug_dump_float_rgba_bmp(const char *filename,
|
||||
unsigned width, unsigned height,
|
||||
float *rgba, unsigned stride)
|
||||
{
|
||||
#ifndef PIPE_SUBSYSTEM_WINDOWS_MINIPORT
|
||||
struct util_stream *stream;
|
||||
struct bmp_file_header bmfh;
|
||||
struct bmp_info_header bmih;
|
||||
unsigned x, y;
|
||||
|
||||
if(!rgba)
|
||||
goto error1;
|
||||
|
||||
bmfh.bfType = 0x4d42;
|
||||
bmfh.bfSize = 14 + 40 + transfer->height*transfer->width*4;
|
||||
bmfh.bfSize = 14 + 40 + height*width*4;
|
||||
bmfh.bfReserved1 = 0;
|
||||
bmfh.bfReserved2 = 0;
|
||||
bmfh.bfOffBits = 14 + 40;
|
||||
|
||||
bmih.biSize = 40;
|
||||
bmih.biWidth = transfer->width;
|
||||
bmih.biHeight = transfer->height;
|
||||
bmih.biWidth = width;
|
||||
bmih.biHeight = height;
|
||||
bmih.biPlanes = 1;
|
||||
bmih.biBitCount = 32;
|
||||
bmih.biCompression = 0;
|
||||
bmih.biSizeImage = transfer->height*transfer->width*4;
|
||||
bmih.biSizeImage = height*width*4;
|
||||
bmih.biXPelsPerMeter = 0;
|
||||
bmih.biYPelsPerMeter = 0;
|
||||
bmih.biClrUsed = 0;
|
||||
@@ -773,19 +799,15 @@ debug_dump_transfer_bmp(const char *filename,
|
||||
|
||||
stream = util_stream_create(filename, bmfh.bfSize);
|
||||
if(!stream)
|
||||
goto error2;
|
||||
goto error1;
|
||||
|
||||
util_stream_write(stream, &bmfh, 14);
|
||||
util_stream_write(stream, &bmih, 40);
|
||||
|
||||
pipe_get_tile_rgba(transfer, 0, 0,
|
||||
transfer->width, transfer->height,
|
||||
rgba);
|
||||
|
||||
y = transfer->height;
|
||||
y = height;
|
||||
while(y--) {
|
||||
float *ptr = rgba + (transfer->width * y * 4);
|
||||
for(x = 0; x < transfer->width; ++x)
|
||||
float *ptr = rgba + (stride * y * 4);
|
||||
for(x = 0; x < width; ++x)
|
||||
{
|
||||
struct bmp_rgb_quad pixel;
|
||||
pixel.rgbRed = float_to_ubyte(ptr[x*4 + 0]);
|
||||
@@ -797,8 +819,6 @@ debug_dump_transfer_bmp(const char *filename,
|
||||
}
|
||||
|
||||
util_stream_close(stream);
|
||||
error2:
|
||||
FREE(rgba);
|
||||
error1:
|
||||
;
|
||||
#endif
|
||||
|
||||
@@ -102,6 +102,22 @@ debug_printf(const char *format, ...)
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* ... isn't portable so we need to pass arguments in parentheses.
|
||||
*
|
||||
* usage:
|
||||
* debug_printf_once(("awnser: %i\n", 42));
|
||||
*/
|
||||
#define debug_printf_once(args) \
|
||||
do { \
|
||||
static boolean once = TRUE; \
|
||||
if (once) { \
|
||||
once = FALSE; \
|
||||
debug_printf args; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
|
||||
#ifdef DEBUG
|
||||
#define debug_vprintf(_format, _ap) _debug_vprintf(_format, _ap)
|
||||
#else
|
||||
@@ -347,10 +363,15 @@ void debug_dump_surface_bmp(const char *filename,
|
||||
struct pipe_surface *surface);
|
||||
void debug_dump_transfer_bmp(const char *filename,
|
||||
struct pipe_transfer *transfer);
|
||||
void debug_dump_float_rgba_bmp(const char *filename,
|
||||
unsigned width, unsigned height,
|
||||
float *rgba, unsigned stride);
|
||||
#else
|
||||
#define debug_dump_image(prefix, format, cpp, width, height, stride, data) ((void)0)
|
||||
#define debug_dump_surface(prefix, surface) ((void)0)
|
||||
#define debug_dump_surface_bmp(filename, surface) ((void)0)
|
||||
#define debug_dump_transfer_bmp(filename, transfer) ((void)0)
|
||||
#define debug_dump_rgba_float_bmp(filename, width, height, rgba, stride) ((void)0)
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
@@ -62,6 +62,8 @@ debug_backtrace_capture(struct debug_stack_frame *backtrace,
|
||||
|
||||
#ifdef PIPE_ARCH_X86
|
||||
while(nr_frames) {
|
||||
const void **next_frame_pointer;
|
||||
|
||||
if(!frame_pointer)
|
||||
break;
|
||||
|
||||
@@ -72,7 +74,14 @@ debug_backtrace_capture(struct debug_stack_frame *backtrace,
|
||||
--nr_frames;
|
||||
}
|
||||
|
||||
frame_pointer = (const void **)frame_pointer[0];
|
||||
next_frame_pointer = (const void **)frame_pointer[0];
|
||||
|
||||
/* Limit the stack walk to avoid referencing undefined memory */
|
||||
if((uintptr_t)next_frame_pointer <= (uintptr_t)frame_pointer ||
|
||||
(uintptr_t)next_frame_pointer > (uintptr_t)frame_pointer + 64*1024)
|
||||
break;
|
||||
|
||||
frame_pointer = next_frame_pointer;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -1316,7 +1316,6 @@ util_create_gen_mipmap(struct pipe_context *pipe,
|
||||
for (i = 0; i < 4; i++) {
|
||||
ctx->vertices[i][0][2] = 0.0f; /* z */
|
||||
ctx->vertices[i][0][3] = 1.0f; /* w */
|
||||
ctx->vertices[i][1][2] = 0.0f; /* r */
|
||||
ctx->vertices[i][1][3] = 1.0f; /* q */
|
||||
}
|
||||
|
||||
@@ -1350,29 +1349,104 @@ get_next_slot(struct gen_mipmap_state *ctx)
|
||||
|
||||
|
||||
static unsigned
|
||||
set_vertex_data(struct gen_mipmap_state *ctx, float width, float height)
|
||||
set_vertex_data(struct gen_mipmap_state *ctx,
|
||||
enum pipe_texture_target tex_target,
|
||||
uint face, float width, float height)
|
||||
{
|
||||
unsigned offset;
|
||||
|
||||
/* vert[0].position */
|
||||
ctx->vertices[0][0][0] = 0.0f; /*x*/
|
||||
ctx->vertices[0][0][1] = 0.0f; /*y*/
|
||||
ctx->vertices[0][1][0] = 0.0f; /*s*/
|
||||
ctx->vertices[0][1][1] = 0.0f; /*t*/
|
||||
|
||||
/* vert[1].position */
|
||||
ctx->vertices[1][0][0] = width;
|
||||
ctx->vertices[1][0][1] = 0.0f;
|
||||
ctx->vertices[1][1][0] = 1.0f;
|
||||
ctx->vertices[1][1][1] = 0.0f;
|
||||
|
||||
/* vert[2].position */
|
||||
ctx->vertices[2][0][0] = width;
|
||||
ctx->vertices[2][0][1] = height;
|
||||
ctx->vertices[2][1][0] = 1.0f;
|
||||
ctx->vertices[2][1][1] = 1.0f;
|
||||
|
||||
/* vert[3].position */
|
||||
ctx->vertices[3][0][0] = 0.0f;
|
||||
ctx->vertices[3][0][1] = height;
|
||||
ctx->vertices[3][1][0] = 0.0f;
|
||||
ctx->vertices[3][1][1] = 1.0f;
|
||||
|
||||
/* Setup vertex texcoords. This is a little tricky for cube maps. */
|
||||
if (tex_target == PIPE_TEXTURE_CUBE) {
|
||||
static const float st[4][2] = {
|
||||
{0.0f, 0.0f}, {1.0f, 0.0f}, {1.0f, 1.0f}, {0.0f, 1.0f}
|
||||
};
|
||||
float rx, ry, rz;
|
||||
uint i;
|
||||
|
||||
/* loop over quad verts */
|
||||
for (i = 0; i < 4; i++) {
|
||||
/* Compute sc = +/-scale and tc = +/-scale.
|
||||
* Not +/-1 to avoid cube face selection ambiguity near the edges,
|
||||
* though that can still sometimes happen with this scale factor...
|
||||
*/
|
||||
const float scale = 0.9999;
|
||||
const float sc = (2.0f * st[i][0] - 1.0f) * scale;
|
||||
const float tc = (2.0f * st[i][1] - 1.0f) * scale;
|
||||
|
||||
switch (face) {
|
||||
case PIPE_TEX_FACE_POS_X:
|
||||
rx = 1.0f;
|
||||
ry = -tc;
|
||||
rz = -sc;
|
||||
break;
|
||||
case PIPE_TEX_FACE_NEG_X:
|
||||
rx = -1.0f;
|
||||
ry = -tc;
|
||||
rz = sc;
|
||||
break;
|
||||
case PIPE_TEX_FACE_POS_Y:
|
||||
rx = sc;
|
||||
ry = 1.0f;
|
||||
rz = tc;
|
||||
break;
|
||||
case PIPE_TEX_FACE_NEG_Y:
|
||||
rx = sc;
|
||||
ry = -1.0f;
|
||||
rz = -tc;
|
||||
break;
|
||||
case PIPE_TEX_FACE_POS_Z:
|
||||
rx = sc;
|
||||
ry = -tc;
|
||||
rz = 1.0f;
|
||||
break;
|
||||
case PIPE_TEX_FACE_NEG_Z:
|
||||
rx = -sc;
|
||||
ry = -tc;
|
||||
rz = -1.0f;
|
||||
break;
|
||||
default:
|
||||
assert(0);
|
||||
}
|
||||
|
||||
ctx->vertices[i][1][0] = rx; /*s*/
|
||||
ctx->vertices[i][1][1] = ry; /*t*/
|
||||
ctx->vertices[i][1][2] = rz; /*r*/
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* 1D/2D */
|
||||
ctx->vertices[0][1][0] = 0.0f; /*s*/
|
||||
ctx->vertices[0][1][1] = 0.0f; /*t*/
|
||||
ctx->vertices[0][1][2] = 0.0f; /*r*/
|
||||
|
||||
ctx->vertices[1][1][0] = 1.0f;
|
||||
ctx->vertices[1][1][1] = 0.0f;
|
||||
ctx->vertices[1][1][2] = 0.0f;
|
||||
|
||||
ctx->vertices[2][1][0] = 1.0f;
|
||||
ctx->vertices[2][1][1] = 1.0f;
|
||||
ctx->vertices[2][1][2] = 0.0f;
|
||||
|
||||
ctx->vertices[3][1][0] = 0.0f;
|
||||
ctx->vertices[3][1][1] = 1.0f;
|
||||
ctx->vertices[3][1][2] = 0.0f;
|
||||
}
|
||||
|
||||
offset = get_next_slot( ctx );
|
||||
|
||||
@@ -1503,6 +1577,8 @@ util_gen_mipmap(struct gen_mipmap_state *ctx,
|
||||
|
||||
/* quad coords in window coords (bypassing vs, clip and viewport) */
|
||||
offset = set_vertex_data(ctx,
|
||||
pt->target,
|
||||
face,
|
||||
(float) pt->width[dstLevel],
|
||||
(float) pt->height[dstLevel]);
|
||||
|
||||
|
||||
@@ -1,3 +1,34 @@
|
||||
/**************************************************************************
|
||||
*
|
||||
* Copyright 2009 VMware, Inc.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sub license, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the
|
||||
* next paragraph) shall be included in all copies or substantial portions
|
||||
* of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
|
||||
* IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS 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.
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
/**
|
||||
* Functions for converting tiled data to linear and vice versa.
|
||||
*/
|
||||
|
||||
|
||||
#include "util/u_debug.h"
|
||||
#include "u_linear.h"
|
||||
|
||||
@@ -1,3 +1,34 @@
|
||||
/**************************************************************************
|
||||
*
|
||||
* Copyright 2009 VMware, Inc.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sub license, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the
|
||||
* next paragraph) shall be included in all copies or substantial portions
|
||||
* of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
|
||||
* IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS 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.
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
/**
|
||||
* Functions for converting tiled data to linear and vice versa.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef U_LINEAR_H
|
||||
#define U_LINEAR_H
|
||||
|
||||
@@ -217,4 +217,9 @@ void util_time_sleep(unsigned usecs)
|
||||
} while(start <= curr && curr < end ||
|
||||
end < start && (curr < end || start <= curr));
|
||||
}
|
||||
#elif defined(PIPE_SUBSYSTEM_WINDOWS_USER)
|
||||
void util_time_sleep(unsigned usecs)
|
||||
{
|
||||
Sleep((usecs + 999)/ 1000);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -70,7 +70,7 @@ struct u_upload_mgr *u_upload_create( struct pipe_screen *screen,
|
||||
}
|
||||
|
||||
|
||||
static INLINE void
|
||||
static INLINE enum pipe_error
|
||||
my_buffer_write(struct pipe_screen *screen,
|
||||
struct pipe_buffer *buf,
|
||||
unsigned offset, unsigned size, unsigned dirty_size,
|
||||
@@ -84,12 +84,14 @@ my_buffer_write(struct pipe_screen *screen,
|
||||
assert(size);
|
||||
|
||||
map = pipe_buffer_map_range(screen, buf, offset, size, PIPE_BUFFER_USAGE_CPU_WRITE);
|
||||
assert(map);
|
||||
if(map) {
|
||||
memcpy(map + offset, data, size);
|
||||
pipe_buffer_flush_mapped_range(screen, buf, offset, dirty_size);
|
||||
pipe_buffer_unmap(screen, buf);
|
||||
}
|
||||
if (map == NULL)
|
||||
return PIPE_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
memcpy(map + offset, data, size);
|
||||
pipe_buffer_flush_mapped_range(screen, buf, offset, dirty_size);
|
||||
pipe_buffer_unmap(screen, buf);
|
||||
|
||||
return PIPE_OK;
|
||||
}
|
||||
|
||||
/* Release old buffer.
|
||||
@@ -162,12 +164,14 @@ enum pipe_error u_upload_data( struct u_upload_mgr *upload,
|
||||
|
||||
/* Copy the data, using map_range if available:
|
||||
*/
|
||||
my_buffer_write( upload->screen,
|
||||
upload->buffer,
|
||||
upload->offset,
|
||||
size,
|
||||
alloc_size,
|
||||
data );
|
||||
ret = my_buffer_write( upload->screen,
|
||||
upload->buffer,
|
||||
upload->offset,
|
||||
size,
|
||||
alloc_size,
|
||||
data );
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
/* Emit the return values:
|
||||
*/
|
||||
|
||||
@@ -8,7 +8,6 @@ C_SOURCES = \
|
||||
i915_clear.c \
|
||||
i915_flush.c \
|
||||
i915_context.c \
|
||||
i915_context.c \
|
||||
i915_debug.c \
|
||||
i915_debug_fp.c \
|
||||
i915_state.c \
|
||||
|
||||
@@ -31,7 +31,8 @@ nv04_miptree_layout(struct nv04_miptree *nv04mt)
|
||||
|
||||
for (l = 0; l <= pt->last_level; l++) {
|
||||
|
||||
nv04mt->level[l].image_offset = offset;
|
||||
nv04mt->level[l].image_offset =
|
||||
CALLOC(nr_faces, sizeof(unsigned));
|
||||
offset += nv04mt->level[l].pitch * pt->height[l];
|
||||
}
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ struct nv04_miptree {
|
||||
|
||||
struct {
|
||||
uint pitch;
|
||||
uint image_offset;
|
||||
uint *image_offset;
|
||||
} level[PIPE_MAX_TEXTURE_LEVELS];
|
||||
};
|
||||
|
||||
|
||||
@@ -34,10 +34,6 @@ static boolean r300_draw_range_elements(struct pipe_context* pipe,
|
||||
struct r300_context* r300 = r300_context(pipe);
|
||||
int i;
|
||||
|
||||
if (r300->dirty_state) {
|
||||
r300_emit_dirty_state(r300);
|
||||
}
|
||||
|
||||
for (i = 0; i < r300->vertex_buffer_count; i++) {
|
||||
void* buf = pipe_buffer_map(pipe->screen,
|
||||
r300->vertex_buffers[i].buffer,
|
||||
|
||||
@@ -264,6 +264,11 @@ struct r300_context {
|
||||
/* Draw module. Used mostly for SW TCL. */
|
||||
struct draw_context* draw;
|
||||
|
||||
/* Vertex buffer for rendering. */
|
||||
struct pipe_buffer* vbo;
|
||||
/* Offset into the VBO. */
|
||||
size_t vbo_offset;
|
||||
|
||||
/* Various CSO state objects. */
|
||||
/* Blend state. */
|
||||
struct r300_blend_state* blend_state;
|
||||
@@ -289,7 +294,7 @@ struct r300_context {
|
||||
/* Texture states. */
|
||||
struct r300_texture* textures[8];
|
||||
int texture_count;
|
||||
/* Vertex buffers. */
|
||||
/* Vertex buffers for Gallium. */
|
||||
struct pipe_vertex_buffer vertex_buffers[PIPE_MAX_ATTRIBS];
|
||||
int vertex_buffer_count;
|
||||
/* Vertex information. */
|
||||
@@ -314,11 +319,4 @@ struct draw_stage* r300_draw_stage(struct r300_context* r300);
|
||||
void r300_init_state_functions(struct r300_context* r300);
|
||||
void r300_init_surface_functions(struct r300_context* r300);
|
||||
|
||||
/* Fun with includes: r300_winsys also declares this prototype.
|
||||
* We'll just step out in that case... */
|
||||
#ifndef R300_WINSYS_H
|
||||
struct pipe_context* r300_create_context(struct pipe_screen* screen,
|
||||
struct r300_winsys* r300_winsys);
|
||||
#endif
|
||||
|
||||
#endif /* R300_CONTEXT_H */
|
||||
|
||||
@@ -49,27 +49,27 @@
|
||||
|
||||
#define CS_LOCALS(context) \
|
||||
struct r300_winsys* cs_winsys = context->winsys; \
|
||||
struct radeon_cs* cs = cs_winsys->cs; \
|
||||
int cs_count = 0;
|
||||
|
||||
#define CHECK_CS(size) \
|
||||
cs_winsys->check_cs(cs, (size))
|
||||
cs_winsys->check_cs(cs_winsys, (size))
|
||||
|
||||
#define BEGIN_CS(size) do { \
|
||||
CHECK_CS(size); \
|
||||
debug_printf("r300: BEGIN_CS, count %d, in %s (%s:%d)\n", \
|
||||
size, __FUNCTION__, __FILE__, __LINE__); \
|
||||
cs_winsys->begin_cs(cs, (size), __FILE__, __FUNCTION__, __LINE__); \
|
||||
cs_winsys->begin_cs(cs_winsys, (size), \
|
||||
__FILE__, __FUNCTION__, __LINE__); \
|
||||
cs_count = size; \
|
||||
} while (0)
|
||||
|
||||
#define OUT_CS(value) do { \
|
||||
cs_winsys->write_cs_dword(cs, (value)); \
|
||||
cs_winsys->write_cs_dword(cs_winsys, (value)); \
|
||||
cs_count--; \
|
||||
} while (0)
|
||||
|
||||
#define OUT_CS_32F(value) do { \
|
||||
cs_winsys->write_cs_dword(cs, fui(value)); \
|
||||
cs_winsys->write_cs_dword(cs_winsys, fui(value)); \
|
||||
cs_count--; \
|
||||
} while (0)
|
||||
|
||||
@@ -97,7 +97,7 @@
|
||||
bo, offset); \
|
||||
assert(bo); \
|
||||
OUT_CS(offset); \
|
||||
cs_winsys->write_cs_reloc(cs, bo, rd, wd, flags); \
|
||||
cs_winsys->write_cs_reloc(cs_winsys, bo, rd, wd, flags); \
|
||||
cs_count -= 2; \
|
||||
} while (0)
|
||||
|
||||
@@ -106,13 +106,13 @@
|
||||
__LINE__); \
|
||||
if (cs_count != 0) \
|
||||
debug_printf("r300: Warning: cs_count off by %d\n", cs_count); \
|
||||
cs_winsys->end_cs(cs, __FILE__, __FUNCTION__, __LINE__); \
|
||||
cs_winsys->end_cs(cs_winsys, __FILE__, __FUNCTION__, __LINE__); \
|
||||
} while (0)
|
||||
|
||||
#define FLUSH_CS do { \
|
||||
debug_printf("r300: FLUSH_CS in %s (%s:%d)\n\n", __FUNCTION__, __FILE__, \
|
||||
__LINE__); \
|
||||
cs_winsys->flush_cs(cs); \
|
||||
cs_winsys->flush_cs(cs_winsys); \
|
||||
} while (0)
|
||||
|
||||
#define RADEON_ONE_REG_WR (1 << 15)
|
||||
@@ -138,7 +138,7 @@
|
||||
assert(bo); \
|
||||
OUT_CS(offset); \
|
||||
OUT_CS(count); \
|
||||
cs_winsys->write_cs_reloc(cs, bo, rd, wd, flags); \
|
||||
cs_winsys->write_cs_reloc(cs_winsys, bo, rd, wd, flags); \
|
||||
cs_count -= 2; \
|
||||
} while (0)
|
||||
|
||||
|
||||
@@ -30,81 +30,6 @@ static void r300_dump_fs(struct r300_fragment_shader* fs)
|
||||
}
|
||||
}
|
||||
|
||||
static char* r500_fs_swiz[] = {
|
||||
" R",
|
||||
" G",
|
||||
" B",
|
||||
" A",
|
||||
" 0",
|
||||
".5",
|
||||
" 1",
|
||||
" U",
|
||||
};
|
||||
|
||||
static char* r500_fs_op_rgb[] = {
|
||||
"MAD",
|
||||
"DP3",
|
||||
"DP4",
|
||||
"D2A",
|
||||
"MIN",
|
||||
"MAX",
|
||||
"---",
|
||||
"CND",
|
||||
"CMP",
|
||||
"FRC",
|
||||
"SOP",
|
||||
"MDH",
|
||||
"MDV",
|
||||
};
|
||||
|
||||
static char* r500_fs_op_alpha[] = {
|
||||
"MAD",
|
||||
" DP",
|
||||
"MIN",
|
||||
"MAX",
|
||||
"---",
|
||||
"CND",
|
||||
"CMP",
|
||||
"FRC",
|
||||
"EX2",
|
||||
"LN2",
|
||||
"RCP",
|
||||
"RSQ",
|
||||
"SIN",
|
||||
"COS",
|
||||
"MDH",
|
||||
"MDV",
|
||||
};
|
||||
|
||||
static char* r500_fs_mask[] = {
|
||||
"NONE",
|
||||
"R ",
|
||||
" G ",
|
||||
"RG ",
|
||||
" B ",
|
||||
"R B ",
|
||||
" GB ",
|
||||
"RGB ",
|
||||
" A",
|
||||
"R A",
|
||||
" G A",
|
||||
"RG A",
|
||||
" BA",
|
||||
"R BA",
|
||||
" GBA",
|
||||
"RGBA",
|
||||
};
|
||||
|
||||
static char* r500_fs_tex[] = {
|
||||
" NOP",
|
||||
" LD",
|
||||
"TEXKILL",
|
||||
" PROJ",
|
||||
"LODBIAS",
|
||||
" LOD",
|
||||
" DXDY",
|
||||
};
|
||||
|
||||
void r500_fs_dump(struct r500_fragment_shader* fs)
|
||||
{
|
||||
int i;
|
||||
@@ -225,12 +150,25 @@ void r500_fs_dump(struct r500_fragment_shader* fs)
|
||||
}
|
||||
}
|
||||
|
||||
static void r300_vs_op_dump(uint32_t op)
|
||||
{
|
||||
if (op & 0x81) {
|
||||
debug_printf("PVS_MACRO_OP_2CLK_M2X_ADD\n");
|
||||
} else if (op & 0x80) {
|
||||
debug_printf(" PVS_MACRO_OP_2CLK_MADD\n");
|
||||
} else if (op & 0x40) {
|
||||
debug_printf("%s\n", r300_vs_me_ops[op & 0x1f]);
|
||||
} else {
|
||||
debug_printf("%s\n", r300_vs_ve_ops[op & 0x1f]);
|
||||
}
|
||||
}
|
||||
|
||||
void r300_vs_dump(struct r300_vertex_shader* vs)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < vs->instruction_count; i++) {
|
||||
debug_printf("inst0: 0x%x\n", vs->instructions[i].inst0);
|
||||
r300_vs_op_dump(vs->instructions[i].inst0);
|
||||
debug_printf("inst1: 0x%x\n", vs->instructions[i].inst1);
|
||||
debug_printf("inst2: 0x%x\n", vs->instructions[i].inst2);
|
||||
debug_printf("inst3: 0x%x\n", vs->instructions[i].inst3);
|
||||
|
||||
@@ -27,6 +27,152 @@
|
||||
#include "r300_state_shader.h"
|
||||
#include "r300_state_tcl.h"
|
||||
|
||||
static char* r500_fs_swiz[] = {
|
||||
" R",
|
||||
" G",
|
||||
" B",
|
||||
" A",
|
||||
" 0",
|
||||
".5",
|
||||
" 1",
|
||||
" U",
|
||||
};
|
||||
|
||||
static char* r500_fs_op_rgb[] = {
|
||||
"MAD",
|
||||
"DP3",
|
||||
"DP4",
|
||||
"D2A",
|
||||
"MIN",
|
||||
"MAX",
|
||||
"---",
|
||||
"CND",
|
||||
"CMP",
|
||||
"FRC",
|
||||
"SOP",
|
||||
"MDH",
|
||||
"MDV",
|
||||
};
|
||||
|
||||
static char* r500_fs_op_alpha[] = {
|
||||
"MAD",
|
||||
" DP",
|
||||
"MIN",
|
||||
"MAX",
|
||||
"---",
|
||||
"CND",
|
||||
"CMP",
|
||||
"FRC",
|
||||
"EX2",
|
||||
"LN2",
|
||||
"RCP",
|
||||
"RSQ",
|
||||
"SIN",
|
||||
"COS",
|
||||
"MDH",
|
||||
"MDV",
|
||||
};
|
||||
|
||||
static char* r500_fs_mask[] = {
|
||||
"NONE",
|
||||
"R ",
|
||||
" G ",
|
||||
"RG ",
|
||||
" B ",
|
||||
"R B ",
|
||||
" GB ",
|
||||
"RGB ",
|
||||
" A",
|
||||
"R A",
|
||||
" G A",
|
||||
"RG A",
|
||||
" BA",
|
||||
"R BA",
|
||||
" GBA",
|
||||
"RGBA",
|
||||
};
|
||||
|
||||
static char* r500_fs_tex[] = {
|
||||
" NOP",
|
||||
" LD",
|
||||
"TEXKILL",
|
||||
" PROJ",
|
||||
"LODBIAS",
|
||||
" LOD",
|
||||
" DXDY",
|
||||
};
|
||||
|
||||
static char* r300_vs_ve_ops[] = {
|
||||
/* R300 vector ops */
|
||||
" VE_NO_OP",
|
||||
" VE_DOT_PRODUCT",
|
||||
" VE_MULTIPLY",
|
||||
" VE_ADD",
|
||||
" VE_MULTIPLY_ADD",
|
||||
" VE_DISTANCE_FACTOR",
|
||||
" VE_FRACTION",
|
||||
" VE_MAXIMUM",
|
||||
" VE_MINIMUM",
|
||||
"VE_SET_GREATER_THAN_EQUAL",
|
||||
" VE_SET_LESS_THAN",
|
||||
" VE_MULTIPLYX2_ADD",
|
||||
" VE_MULTIPLY_CLAMP",
|
||||
" VE_FLT2FIX_DX",
|
||||
" VE_FLT2FIX_DX_RND",
|
||||
/* R500 vector ops */
|
||||
" VE_PRED_SET_EQ_PUSH",
|
||||
" VE_PRED_SET_GT_PUSH",
|
||||
" VE_PRED_SET_GTE_PUSH",
|
||||
" VE_PRED_SET_NEQ_PUSH",
|
||||
" VE_COND_WRITE_EQ",
|
||||
" VE_COND_WRITE_GT",
|
||||
" VE_COND_WRITE_GTE",
|
||||
" VE_COND_WRITE_NEQ",
|
||||
" VE_SET_GREATER_THAN",
|
||||
" VE_SET_EQUAL",
|
||||
" VE_SET_NOT_EQUAL",
|
||||
" (reserved)",
|
||||
" (reserved)",
|
||||
" (reserved)",
|
||||
};
|
||||
|
||||
static char* r300_vs_me_ops[] = {
|
||||
/* R300 math ops */
|
||||
" ME_NO_OP",
|
||||
" ME_EXP_BASE2_DX",
|
||||
" ME_LOG_BASE2_DX",
|
||||
" ME_EXP_BASEE_FF",
|
||||
" ME_LIGHT_COEFF_DX",
|
||||
" ME_POWER_FUNC_FF",
|
||||
" ME_RECIP_DX",
|
||||
" ME_RECIP_FF",
|
||||
" ME_RECIP_SQRT_DX",
|
||||
" ME_RECIP_SQRT_FF",
|
||||
" ME_MULTIPLY",
|
||||
" ME_EXP_BASE2_FULL_DX",
|
||||
" ME_LOG_BASE2_FULL_DX",
|
||||
" ME_POWER_FUNC_FF_CLAMP_B",
|
||||
"ME_POWER_FUNC_FF_CLAMP_B1",
|
||||
"ME_POWER_FUNC_FF_CLAMP_01",
|
||||
" ME_SIN",
|
||||
" ME_COS",
|
||||
/* R500 math ops */
|
||||
" ME_LOG_BASE2_IEEE",
|
||||
" ME_RECIP_IEEE",
|
||||
" ME_RECIP_SQRT_IEEE",
|
||||
" ME_PRED_SET_EQ",
|
||||
" ME_PRED_SET_GT",
|
||||
" ME_PRED_SET_GTE",
|
||||
" ME_PRED_SET_NEQ",
|
||||
" ME_PRED_SET_CLR",
|
||||
" ME_PRED_SET_INV",
|
||||
" ME_PRED_SET_POP",
|
||||
" ME_PRED_SET_RESTORE",
|
||||
" (reserved)",
|
||||
" (reserved)",
|
||||
" (reserved)",
|
||||
};
|
||||
|
||||
void r500_fs_dump(struct r500_fragment_shader* fs);
|
||||
|
||||
void r300_vs_dump(struct r300_vertex_shader* vs);
|
||||
|
||||
@@ -152,34 +152,39 @@ void r500_emit_fragment_shader(struct r300_context* r300,
|
||||
END_CS;
|
||||
}
|
||||
|
||||
/* XXX add pitch, stride, clean up */
|
||||
void r300_emit_fb_state(struct r300_context* r300,
|
||||
struct pipe_framebuffer_state* fb)
|
||||
{
|
||||
int i;
|
||||
struct r300_texture* tex;
|
||||
unsigned pixpitch;
|
||||
int i;
|
||||
CS_LOCALS(r300);
|
||||
|
||||
BEGIN_CS((6 * fb->nr_cbufs) + (fb->zsbuf ? 6 : 0) + 4);
|
||||
BEGIN_CS((8 * fb->nr_cbufs) + (fb->zsbuf ? 8 : 0) + 4);
|
||||
for (i = 0; i < fb->nr_cbufs; i++) {
|
||||
tex = (struct r300_texture*)fb->cbufs[i]->texture;
|
||||
pixpitch = tex->stride / tex->tex.block.size;
|
||||
|
||||
OUT_CS_REG_SEQ(R300_RB3D_COLOROFFSET0 + (4 * i), 1);
|
||||
OUT_CS_RELOC(tex->buffer, 0, 0, RADEON_GEM_DOMAIN_VRAM, 0);
|
||||
|
||||
OUT_CS_REG(R300_RB3D_COLORPITCH0 + (4 * i), pixpitch |
|
||||
r300_translate_colorformat(tex->tex.format));
|
||||
|
||||
OUT_CS_REG(R300_US_OUT_FMT_0 + (4 * i),
|
||||
r300_translate_out_fmt(fb->cbufs[i]->format));
|
||||
}
|
||||
|
||||
if (fb->zsbuf) {
|
||||
tex = (struct r300_texture*)fb->zsbuf->texture;
|
||||
pixpitch = (tex->stride / tex->tex.block.size);
|
||||
|
||||
OUT_CS_REG_SEQ(R300_ZB_DEPTHOFFSET, 1);
|
||||
OUT_CS_RELOC(tex->buffer, 0, 0, RADEON_GEM_DOMAIN_VRAM, 0);
|
||||
if (fb->zsbuf->format == PIPE_FORMAT_Z24S8_UNORM) {
|
||||
OUT_CS_REG(R300_ZB_FORMAT,
|
||||
R300_DEPTHFORMAT_24BIT_INT_Z_8BIT_STENCIL);
|
||||
} else {
|
||||
OUT_CS_REG(R300_ZB_FORMAT, 0x0);
|
||||
}
|
||||
|
||||
OUT_CS_REG(R300_ZB_FORMAT, r300_translate_zsformat(tex->tex.format));
|
||||
|
||||
OUT_CS_REG(R300_ZB_DEPTHPITCH, pixpitch);
|
||||
}
|
||||
|
||||
OUT_CS_REG(R300_RB3D_DSTCACHE_CTLSTAT,
|
||||
@@ -291,6 +296,30 @@ void r300_emit_texture(struct r300_context* r300,
|
||||
END_CS;
|
||||
}
|
||||
|
||||
void r300_emit_vertex_buffer(struct r300_context* r300)
|
||||
{
|
||||
CS_LOCALS(r300);
|
||||
|
||||
debug_printf("r300: Preparing vertex buffer %p for render, "
|
||||
"vertex size %d\n", r300->vbo,
|
||||
r300->vertex_info.vinfo.size);
|
||||
/* Set the pointer to our vertex buffer. The emitted values are this:
|
||||
* PACKET3 [3D_LOAD_VBPNTR]
|
||||
* COUNT [1]
|
||||
* FORMAT [size | stride << 8]
|
||||
* OFFSET [offset into BO]
|
||||
* VBPNTR [relocated BO]
|
||||
*/
|
||||
BEGIN_CS(7);
|
||||
OUT_CS_PKT3(R300_PACKET3_3D_LOAD_VBPNTR, 3);
|
||||
OUT_CS(1);
|
||||
OUT_CS(r300->vertex_info.vinfo.size |
|
||||
(r300->vertex_info.vinfo.size << 8));
|
||||
OUT_CS(r300->vbo_offset);
|
||||
OUT_CS_RELOC(r300->vbo, 0, RADEON_GEM_DOMAIN_GTT, 0, 0);
|
||||
END_CS;
|
||||
}
|
||||
|
||||
void r300_emit_vertex_format_state(struct r300_context* r300)
|
||||
{
|
||||
int i;
|
||||
@@ -416,16 +445,45 @@ void r300_flush_textures(struct r300_context* r300)
|
||||
void r300_emit_dirty_state(struct r300_context* r300)
|
||||
{
|
||||
struct r300_screen* r300screen = r300_screen(r300->context.screen);
|
||||
struct r300_texture* tex;
|
||||
int i;
|
||||
int dirty_tex = 0;
|
||||
|
||||
if (!(r300->dirty_state) && !(r300->dirty_hw)) {
|
||||
if (!(r300->dirty_state)) {
|
||||
return;
|
||||
}
|
||||
|
||||
r300_update_derived_state(r300);
|
||||
|
||||
/* XXX check size */
|
||||
/* Color buffers... */
|
||||
for (i = 0; i < r300->framebuffer_state.nr_cbufs; i++) {
|
||||
tex = (struct r300_texture*)r300->framebuffer_state.cbufs[i]->texture;
|
||||
assert(tex && tex->buffer && "cbuf is marked, but NULL!");
|
||||
if (!tex->buffer) return;
|
||||
r300->winsys->add_buffer(r300->winsys, tex->buffer,
|
||||
0, RADEON_GEM_DOMAIN_VRAM);
|
||||
}
|
||||
/* ...depth buffer... */
|
||||
if (r300->framebuffer_state.zsbuf) {
|
||||
tex = (struct r300_texture*)r300->framebuffer_state.zsbuf->texture;
|
||||
assert(tex && tex->buffer && "zsbuf is marked, but NULL!");
|
||||
if (!tex->buffer) return;
|
||||
r300->winsys->add_buffer(r300->winsys, tex->buffer,
|
||||
0, RADEON_GEM_DOMAIN_VRAM);
|
||||
}
|
||||
/* ...and vertex buffer. */
|
||||
if (r300->vbo) {
|
||||
r300->winsys->add_buffer(r300->winsys, r300->vbo,
|
||||
RADEON_GEM_DOMAIN_GTT, 0);
|
||||
} else {
|
||||
debug_printf("No VBO while emitting dirty state!\n");
|
||||
}
|
||||
|
||||
if (r300->winsys->validate(r300->winsys)) {
|
||||
/* XXX */
|
||||
r300->context.flush(&r300->context, 0, NULL);
|
||||
}
|
||||
|
||||
if (r300->dirty_state & R300_NEW_BLEND) {
|
||||
r300_emit_blend_state(r300, r300->blend_state);
|
||||
@@ -506,4 +564,9 @@ void r300_emit_dirty_state(struct r300_context* r300)
|
||||
r300_emit_vertex_format_state(r300);
|
||||
r300->dirty_state &= ~R300_NEW_VERTEX_FORMAT;
|
||||
}
|
||||
|
||||
/* Finally, emit the VBO. */
|
||||
r300_emit_vertex_buffer(r300);
|
||||
|
||||
r300->dirty_hw++;
|
||||
}
|
||||
|
||||
@@ -62,6 +62,8 @@ void r300_emit_scissor_state(struct r300_context* r300,
|
||||
void r300_emit_texture(struct r300_context* r300,
|
||||
struct r300_texture* tex, unsigned offset);
|
||||
|
||||
void r300_emit_vertex_buffer(struct r300_context* r300);
|
||||
|
||||
void r300_emit_vertex_format_state(struct r300_context* r300);
|
||||
|
||||
void r300_emit_vertex_shader(struct r300_context* r300,
|
||||
|
||||
@@ -29,6 +29,8 @@ static void r300_flush(struct pipe_context* pipe,
|
||||
struct r300_context* r300 = r300_context(pipe);
|
||||
CS_LOCALS(r300);
|
||||
|
||||
draw_flush(r300->draw);
|
||||
|
||||
if (r300->dirty_hw) {
|
||||
FLUSH_CS;
|
||||
r300_emit_invariant_state(r300);
|
||||
|
||||
@@ -180,27 +180,10 @@ static void prepare_render(struct r300_render* render, unsigned count)
|
||||
|
||||
CS_LOCALS(r300);
|
||||
|
||||
/* Make sure that all possible state is emitted. */
|
||||
r300_emit_dirty_state(r300);
|
||||
r300->vbo = render->vbo;
|
||||
r300->vbo_offset = render->vbo_offset;
|
||||
|
||||
debug_printf("r300: Preparing vertex buffer %p for render, "
|
||||
"vertex size %d, vertex count %d\n", render->vbo,
|
||||
r300->vertex_info.vinfo.size, count);
|
||||
/* Set the pointer to our vertex buffer. The emitted values are this:
|
||||
* PACKET3 [3D_LOAD_VBPNTR]
|
||||
* COUNT [1]
|
||||
* FORMAT [size | stride << 8]
|
||||
* OFFSET [0]
|
||||
* VBPNTR [relocated BO]
|
||||
*/
|
||||
BEGIN_CS(7);
|
||||
OUT_CS_PKT3(R300_PACKET3_3D_LOAD_VBPNTR, 3);
|
||||
OUT_CS(1);
|
||||
OUT_CS(r300->vertex_info.vinfo.size |
|
||||
(r300->vertex_info.vinfo.size << 8));
|
||||
OUT_CS(render->vbo_offset);
|
||||
OUT_CS_RELOC(render->vbo, 0, RADEON_GEM_DOMAIN_GTT, 0, 0);
|
||||
END_CS;
|
||||
r300_emit_dirty_state(r300);
|
||||
}
|
||||
|
||||
static void r300_render_draw_arrays(struct vbuf_render* render,
|
||||
|
||||
@@ -421,6 +421,7 @@ static void r300_bind_rs_state(struct pipe_context* pipe, void* state)
|
||||
struct r300_context* r300 = r300_context(pipe);
|
||||
struct r300_rs_state* rs = (struct r300_rs_state*)state;
|
||||
|
||||
draw_flush(r300->draw);
|
||||
draw_set_rasterizer_state(r300->draw, &rs->rs);
|
||||
|
||||
r300->rs_state = rs;
|
||||
@@ -528,7 +529,6 @@ static void r300_set_scissor_state(struct pipe_context* pipe,
|
||||
const struct pipe_scissor_state* state)
|
||||
{
|
||||
struct r300_context* r300 = r300_context(pipe);
|
||||
draw_flush(r300->draw);
|
||||
|
||||
if (r300_screen(r300->context.screen)->caps->is_r500) {
|
||||
r300->scissor_state->scissor_top_left =
|
||||
@@ -555,19 +555,24 @@ static void r300_set_viewport_state(struct pipe_context* pipe,
|
||||
{
|
||||
struct r300_context* r300 = r300_context(pipe);
|
||||
|
||||
draw_flush(r300->draw);
|
||||
|
||||
if (r300_screen(r300->context.screen)->caps->has_tcl) {
|
||||
/* Do the transform in HW. */
|
||||
r300->viewport_state->vte_control = R300_VTX_W0_FMT;
|
||||
|
||||
if (state->scale[0] != 1.0f) {
|
||||
assert(state->scale[0] != 0.0f);
|
||||
r300->viewport_state->xscale = state->scale[0];
|
||||
r300->viewport_state->vte_control |= R300_VPORT_X_SCALE_ENA;
|
||||
}
|
||||
if (state->scale[1] != 1.0f) {
|
||||
assert(state->scale[1] != 0.0f);
|
||||
r300->viewport_state->yscale = state->scale[1];
|
||||
r300->viewport_state->vte_control |= R300_VPORT_Y_SCALE_ENA;
|
||||
}
|
||||
if (state->scale[2] != 1.0f) {
|
||||
assert(state->scale[2] != 0.0f);
|
||||
r300->viewport_state->zscale = state->scale[2];
|
||||
r300->viewport_state->vte_control |= R300_VPORT_Z_SCALE_ENA;
|
||||
}
|
||||
@@ -642,6 +647,8 @@ static void r300_bind_vs_state(struct pipe_context* pipe, void* shader)
|
||||
{
|
||||
struct r300_context* r300 = r300_context(pipe);
|
||||
|
||||
draw_flush(r300->draw);
|
||||
|
||||
if (r300_screen(pipe->screen)->caps->has_tcl) {
|
||||
struct r300_vertex_shader* vs = (struct r300_vertex_shader*)shader;
|
||||
|
||||
|
||||
@@ -34,14 +34,20 @@ static void r300_vs_declare(struct r300_vs_asm* assembler,
|
||||
assembler->tab[decl->DeclarationRange.First] = 0;
|
||||
break;
|
||||
case TGSI_SEMANTIC_COLOR:
|
||||
assembler->tab[decl->DeclarationRange.First] = 2;
|
||||
assembler->tab[decl->DeclarationRange.First] =
|
||||
(assembler->point_size ? 1 : 0) +
|
||||
assembler->out_colors;
|
||||
break;
|
||||
case TGSI_SEMANTIC_FOG:
|
||||
case TGSI_SEMANTIC_GENERIC:
|
||||
/* XXX multiple? */
|
||||
assembler->tab[decl->DeclarationRange.First] = 6;
|
||||
assembler->tab[decl->DeclarationRange.First] =
|
||||
(assembler->point_size ? 1 : 0) +
|
||||
assembler->out_colors +
|
||||
assembler->out_texcoords;
|
||||
break;
|
||||
case TGSI_SEMANTIC_PSIZE:
|
||||
assembler->tab[decl->DeclarationRange.First] = 15;
|
||||
assembler->tab[decl->DeclarationRange.First] = 1;
|
||||
break;
|
||||
default:
|
||||
debug_printf("r300: vs: Bad semantic declaration %d\n",
|
||||
@@ -65,16 +71,13 @@ static INLINE unsigned r300_vs_src_type(struct r300_vs_asm* assembler,
|
||||
{
|
||||
switch (src->File) {
|
||||
case TGSI_FILE_NULL:
|
||||
case TGSI_FILE_INPUT:
|
||||
/* Probably a zero or one swizzle */
|
||||
return R300_PVS_SRC_REG_INPUT;
|
||||
break;
|
||||
case TGSI_FILE_INPUT:
|
||||
return R300_PVS_SRC_REG_INPUT;
|
||||
break;
|
||||
case TGSI_FILE_TEMPORARY:
|
||||
return R300_PVS_SRC_REG_TEMPORARY;
|
||||
break;
|
||||
case TGSI_FILE_CONSTANT:
|
||||
case TGSI_FILE_IMMEDIATE:
|
||||
return R300_PVS_SRC_REG_CONSTANT;
|
||||
default:
|
||||
debug_printf("r300: vs: Unimplemented src type %d\n", src->File);
|
||||
@@ -83,16 +86,32 @@ static INLINE unsigned r300_vs_src_type(struct r300_vs_asm* assembler,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static INLINE unsigned r300_vs_src(struct r300_vs_asm* assembler,
|
||||
struct tgsi_src_register* src)
|
||||
{
|
||||
switch (src->File) {
|
||||
case TGSI_FILE_NULL:
|
||||
case TGSI_FILE_INPUT:
|
||||
case TGSI_FILE_TEMPORARY:
|
||||
case TGSI_FILE_CONSTANT:
|
||||
return src->Index;
|
||||
case TGSI_FILE_IMMEDIATE:
|
||||
return src->Index + assembler->imm_offset;
|
||||
default:
|
||||
debug_printf("r300: vs: Unimplemented src type %d\n", src->File);
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static INLINE unsigned r300_vs_dst_type(struct r300_vs_asm* assembler,
|
||||
struct tgsi_dst_register* dst)
|
||||
{
|
||||
switch (dst->File) {
|
||||
case TGSI_FILE_TEMPORARY:
|
||||
return R300_PVS_DST_REG_TEMPORARY;
|
||||
break;
|
||||
case TGSI_FILE_OUTPUT:
|
||||
return R300_PVS_DST_REG_OUT;
|
||||
break;
|
||||
default:
|
||||
debug_printf("r300: vs: Unimplemented dst type %d\n", dst->File);
|
||||
break;
|
||||
@@ -106,10 +125,8 @@ static INLINE unsigned r300_vs_dst(struct r300_vs_asm* assembler,
|
||||
switch (dst->File) {
|
||||
case TGSI_FILE_TEMPORARY:
|
||||
return dst->Index;
|
||||
break;
|
||||
case TGSI_FILE_OUTPUT:
|
||||
return assembler->tab[dst->Index];
|
||||
break;
|
||||
default:
|
||||
debug_printf("r300: vs: Unimplemented dst %d\n", dst->File);
|
||||
break;
|
||||
@@ -129,6 +146,12 @@ static uint32_t r300_vs_op(unsigned op)
|
||||
case TGSI_OPCODE_MOV:
|
||||
case TGSI_OPCODE_SWZ:
|
||||
return R300_VE_ADD;
|
||||
case TGSI_OPCODE_MAX:
|
||||
return R300_VE_MAXIMUM;
|
||||
case TGSI_OPCODE_SLT:
|
||||
return R300_VE_SET_LESS_THAN;
|
||||
case TGSI_OPCODE_RSQ:
|
||||
return R300_PVS_DST_MATH_INST | R300_ME_RECIP_DX;
|
||||
case TGSI_OPCODE_MAD:
|
||||
return R300_PVS_DST_MACRO_INST | R300_PVS_MACRO_OP_2CLK_MADD;
|
||||
default:
|
||||
@@ -152,39 +175,62 @@ static uint32_t r300_vs_swiz(struct tgsi_full_src_register* reg)
|
||||
}
|
||||
}
|
||||
|
||||
/* XXX icky icky icky icky */
|
||||
static uint32_t r300_vs_scalar_swiz(struct tgsi_full_src_register* reg)
|
||||
{
|
||||
if (reg->SrcRegister.Extended) {
|
||||
return reg->SrcRegisterExtSwz.ExtSwizzleX |
|
||||
(reg->SrcRegisterExtSwz.ExtSwizzleX << 3) |
|
||||
(reg->SrcRegisterExtSwz.ExtSwizzleX << 6) |
|
||||
(reg->SrcRegisterExtSwz.ExtSwizzleX << 9);
|
||||
} else {
|
||||
return reg->SrcRegister.SwizzleX |
|
||||
(reg->SrcRegister.SwizzleX << 3) |
|
||||
(reg->SrcRegister.SwizzleX << 6) |
|
||||
(reg->SrcRegister.SwizzleX << 9);
|
||||
}
|
||||
}
|
||||
|
||||
/* XXX scalar stupidity */
|
||||
static void r300_vs_emit_inst(struct r300_vertex_shader* vs,
|
||||
struct r300_vs_asm* assembler,
|
||||
struct tgsi_full_src_register* src,
|
||||
struct tgsi_full_dst_register* dst,
|
||||
unsigned op,
|
||||
unsigned count)
|
||||
unsigned count,
|
||||
boolean is_scalar)
|
||||
{
|
||||
int i = vs->instruction_count;
|
||||
vs->instructions[i].inst0 = R300_PVS_DST_OPCODE(r300_vs_op(op)) |
|
||||
R300_PVS_DST_REG_TYPE(r300_vs_dst_type(assembler, &dst->DstRegister)) |
|
||||
R300_PVS_DST_OFFSET(r300_vs_dst(assembler, &dst->DstRegister)) |
|
||||
R300_PVS_DST_WE_XYZW;
|
||||
R300_PVS_DST_WE(dst->DstRegister.WriteMask);
|
||||
switch (count) {
|
||||
case 3:
|
||||
vs->instructions[i].inst3 =
|
||||
R300_PVS_SRC_REG_TYPE(r300_vs_src_type(assembler,
|
||||
&src[2].SrcRegister)) |
|
||||
R300_PVS_SRC_OFFSET(src[2].SrcRegister.Index) |
|
||||
R300_PVS_SRC_OFFSET(r300_vs_src(assembler,
|
||||
&src[2].SrcRegister)) |
|
||||
R300_PVS_SRC_SWIZZLE(r300_vs_swiz(&src[2]));
|
||||
/* Fall through */
|
||||
case 2:
|
||||
vs->instructions[i].inst2 =
|
||||
R300_PVS_SRC_REG_TYPE(r300_vs_src_type(assembler,
|
||||
&src[1].SrcRegister)) |
|
||||
R300_PVS_SRC_OFFSET(src[1].SrcRegister.Index) |
|
||||
R300_PVS_SRC_OFFSET(r300_vs_src(assembler,
|
||||
&src[1].SrcRegister)) |
|
||||
R300_PVS_SRC_SWIZZLE(r300_vs_swiz(&src[1]));
|
||||
/* Fall through */
|
||||
case 1:
|
||||
vs->instructions[i].inst1 =
|
||||
R300_PVS_SRC_REG_TYPE(r300_vs_src_type(assembler,
|
||||
&src[0].SrcRegister)) |
|
||||
R300_PVS_SRC_OFFSET(src[0].SrcRegister.Index) |
|
||||
R300_PVS_SRC_SWIZZLE(r300_vs_swiz(&src[0]));
|
||||
R300_PVS_SRC_OFFSET(r300_vs_src(assembler,
|
||||
&src[0].SrcRegister)) |
|
||||
/* XXX the icky, it burns */
|
||||
R300_PVS_SRC_SWIZZLE(is_scalar ? r300_vs_scalar_swiz(&src[0])
|
||||
: r300_vs_swiz(&src[0]));
|
||||
break;
|
||||
}
|
||||
vs->instruction_count++;
|
||||
@@ -195,11 +241,18 @@ static void r300_vs_instruction(struct r300_vertex_shader* vs,
|
||||
struct tgsi_full_instruction* inst)
|
||||
{
|
||||
switch (inst->Instruction.Opcode) {
|
||||
case TGSI_OPCODE_ADD:
|
||||
case TGSI_OPCODE_MUL:
|
||||
case TGSI_OPCODE_RSQ:
|
||||
r300_vs_emit_inst(vs, assembler, inst->FullSrcRegisters,
|
||||
&inst->FullDstRegisters[0], inst->Instruction.Opcode,
|
||||
2);
|
||||
1, TRUE);
|
||||
break;
|
||||
case TGSI_OPCODE_ADD:
|
||||
case TGSI_OPCODE_MUL:
|
||||
case TGSI_OPCODE_MAX:
|
||||
case TGSI_OPCODE_SLT:
|
||||
r300_vs_emit_inst(vs, assembler, inst->FullSrcRegisters,
|
||||
&inst->FullDstRegisters[0], inst->Instruction.Opcode,
|
||||
2, FALSE);
|
||||
break;
|
||||
case TGSI_OPCODE_DP3:
|
||||
/* Set alpha swizzle to zero for src0 and src1 */
|
||||
@@ -229,19 +282,19 @@ static void r300_vs_instruction(struct r300_vertex_shader* vs,
|
||||
case TGSI_OPCODE_DP4:
|
||||
r300_vs_emit_inst(vs, assembler, inst->FullSrcRegisters,
|
||||
&inst->FullDstRegisters[0], inst->Instruction.Opcode,
|
||||
2);
|
||||
2, FALSE);
|
||||
break;
|
||||
case TGSI_OPCODE_MOV:
|
||||
case TGSI_OPCODE_SWZ:
|
||||
inst->FullSrcRegisters[1] = r300_constant_zero;
|
||||
r300_vs_emit_inst(vs, assembler, inst->FullSrcRegisters,
|
||||
&inst->FullDstRegisters[0], inst->Instruction.Opcode,
|
||||
2);
|
||||
2, FALSE);
|
||||
break;
|
||||
case TGSI_OPCODE_MAD:
|
||||
r300_vs_emit_inst(vs, assembler, inst->FullSrcRegisters,
|
||||
&inst->FullDstRegisters[0], inst->Instruction.Opcode,
|
||||
3);
|
||||
3, FALSE);
|
||||
break;
|
||||
case TGSI_OPCODE_END:
|
||||
break;
|
||||
@@ -252,6 +305,28 @@ static void r300_vs_instruction(struct r300_vertex_shader* vs,
|
||||
}
|
||||
}
|
||||
|
||||
static void r300_vs_init(struct r300_vertex_shader* vs,
|
||||
struct r300_vs_asm* assembler)
|
||||
{
|
||||
struct tgsi_shader_info* info = &vs->info;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < info->num_outputs; i++) {
|
||||
switch (info->output_semantic_name[i]) {
|
||||
case TGSI_SEMANTIC_PSIZE:
|
||||
assembler->point_size = TRUE;
|
||||
break;
|
||||
case TGSI_SEMANTIC_COLOR:
|
||||
assembler->out_colors++;
|
||||
break;
|
||||
case TGSI_SEMANTIC_FOG:
|
||||
case TGSI_SEMANTIC_GENERIC:
|
||||
assembler->out_texcoords++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void r300_translate_vertex_shader(struct r300_context* r300,
|
||||
struct r300_vertex_shader* vs)
|
||||
{
|
||||
@@ -264,6 +339,10 @@ void r300_translate_vertex_shader(struct r300_context* r300,
|
||||
if (assembler == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* Init assembler. */
|
||||
r300_vs_init(vs, assembler);
|
||||
|
||||
/* Setup starting offset for immediates. */
|
||||
assembler->imm_offset = consts->user_count;
|
||||
|
||||
|
||||
@@ -35,6 +35,10 @@
|
||||
# define R300_VE_DOT_PRODUCT 1
|
||||
# define R300_VE_MULTIPLY 2
|
||||
# define R300_VE_ADD 3
|
||||
# define R300_VE_MAXIMUM 7
|
||||
# define R300_VE_SET_LESS_THAN 10
|
||||
#define R300_PVS_DST_MATH_INST (1 << 6)
|
||||
# define R300_ME_RECIP_DX 6
|
||||
#define R300_PVS_DST_MACRO_INST (1 << 7)
|
||||
# define R300_PVS_MACRO_OP_2CLK_MADD 0
|
||||
#define R300_PVS_DST_REG_TYPE(x) ((x) << 8)
|
||||
@@ -99,7 +103,13 @@ struct r300_vs_asm {
|
||||
unsigned imm_offset;
|
||||
/* Number of immediate constants. */
|
||||
unsigned imm_count;
|
||||
/* Offsets into vertex output memory. */
|
||||
/* Number of colors to write. */
|
||||
unsigned out_colors;
|
||||
/* Number of texcoords to write. */
|
||||
unsigned out_texcoords;
|
||||
/* Whether to emit point size. */
|
||||
boolean point_size;
|
||||
/* Tab of declared outputs to OVM outputs. */
|
||||
unsigned tab[16];
|
||||
};
|
||||
|
||||
@@ -115,7 +125,7 @@ static struct r300_vertex_shader r300_passthrough_vertex_shader = {
|
||||
.instructions[0].inst3 = 0x0,
|
||||
.instructions[1].inst0 = R300_PVS_DST_OPCODE(R300_VE_ADD) |
|
||||
R300_PVS_DST_REG_TYPE(R300_PVS_DST_REG_OUT) |
|
||||
R300_PVS_DST_OFFSET(2) | R300_PVS_DST_WE_XYZW,
|
||||
R300_PVS_DST_OFFSET(1) | R300_PVS_DST_WE_XYZW,
|
||||
.instructions[1].inst1 = R300_PVS_SRC_REG_TYPE(R300_PVS_SRC_REG_INPUT) |
|
||||
R300_PVS_SRC_OFFSET(1) | R300_PVS_SRC_SWIZZLE_XYZW,
|
||||
.instructions[1].inst2 = R300_PVS_SRC_SWIZZLE_ZERO,
|
||||
@@ -134,7 +144,7 @@ static struct r300_vertex_shader r300_texture_vertex_shader = {
|
||||
.instructions[0].inst3 = 0x0,
|
||||
.instructions[1].inst0 = R300_PVS_DST_OPCODE(R300_VE_ADD) |
|
||||
R300_PVS_DST_REG_TYPE(R300_PVS_DST_REG_OUT) |
|
||||
R300_PVS_DST_OFFSET(6) | R300_PVS_DST_WE_XYZW,
|
||||
R300_PVS_DST_OFFSET(1) | R300_PVS_DST_WE_XYZW,
|
||||
.instructions[1].inst1 = R300_PVS_SRC_REG_TYPE(R300_PVS_SRC_REG_INPUT) |
|
||||
R300_PVS_SRC_OFFSET(1) | R300_PVS_SRC_SWIZZLE_XYZW,
|
||||
.instructions[1].inst2 = R300_PVS_SRC_SWIZZLE_ZERO,
|
||||
|
||||
@@ -34,6 +34,13 @@ static void r300_surface_setup(struct pipe_context* pipe,
|
||||
unsigned pixpitch = tex->stride / tex->tex.block.size;
|
||||
CS_LOCALS(r300);
|
||||
|
||||
/* Make sure our target BO is okay. */
|
||||
r300->winsys->add_buffer(r300->winsys, tex->buffer,
|
||||
0, RADEON_GEM_DOMAIN_VRAM);
|
||||
if (r300->winsys->validate(r300->winsys)) {
|
||||
r300->context.flush(&r300->context, 0, NULL);
|
||||
}
|
||||
|
||||
r300_emit_blend_state(r300, &blend_clear_state);
|
||||
r300_emit_blend_color_state(r300, &blend_color_clear_state);
|
||||
r300_emit_dsa_state(r300, &dsa_clear_state);
|
||||
|
||||
@@ -86,8 +86,6 @@ static struct pipe_texture*
|
||||
r300_texture_create(struct pipe_screen* screen,
|
||||
const struct pipe_texture* template)
|
||||
{
|
||||
/* XXX struct r300_screen* r300screen = r300_screen(screen); */
|
||||
|
||||
struct r300_texture* tex = CALLOC_STRUCT(r300_texture);
|
||||
|
||||
if (!tex) {
|
||||
|
||||
@@ -35,8 +35,6 @@ extern "C" {
|
||||
#include "pipe/p_state.h"
|
||||
#include "pipe/internal/p_winsys_screen.h"
|
||||
|
||||
struct radeon_cs;
|
||||
|
||||
struct r300_winsys {
|
||||
/* Parent class */
|
||||
struct pipe_winsys base;
|
||||
@@ -50,39 +48,50 @@ struct r300_winsys {
|
||||
/* GB pipe count */
|
||||
uint32_t gb_pipes;
|
||||
|
||||
/* CS object. This is very much like Intel's batchbuffer.
|
||||
* Fill it full of dwords and relocs and then submit.
|
||||
* Repeat as needed. */
|
||||
struct radeon_cs* cs;
|
||||
/* GART size. */
|
||||
uint32_t gart_size;
|
||||
|
||||
/* VRAM size. */
|
||||
uint32_t vram_size;
|
||||
|
||||
/* Add a pipe_buffer to the list of buffer objects to validate. */
|
||||
void (*add_buffer)(struct r300_winsys* winsys,
|
||||
struct pipe_buffer* pbuffer,
|
||||
uint32_t rd,
|
||||
uint32_t wd);
|
||||
|
||||
/* Revalidate all currently setup pipe_buffers.
|
||||
* Returns TRUE if a flush is required. */
|
||||
boolean (*validate)(struct r300_winsys* winsys);
|
||||
|
||||
/* Check to see if there's room for commands. */
|
||||
boolean (*check_cs)(struct radeon_cs* cs, int size);
|
||||
boolean (*check_cs)(struct r300_winsys* winsys, int size);
|
||||
|
||||
/* Start a command emit. */
|
||||
void (*begin_cs)(struct radeon_cs* cs,
|
||||
int size,
|
||||
const char* file,
|
||||
const char* function,
|
||||
int line);
|
||||
void (*begin_cs)(struct r300_winsys* winsys,
|
||||
int size,
|
||||
const char* file,
|
||||
const char* function,
|
||||
int line);
|
||||
|
||||
/* Write a dword to the command buffer. */
|
||||
void (*write_cs_dword)(struct radeon_cs* cs, uint32_t dword);
|
||||
void (*write_cs_dword)(struct r300_winsys* winsys, uint32_t dword);
|
||||
|
||||
/* Write a relocated dword to the command buffer. */
|
||||
void (*write_cs_reloc)(struct radeon_cs* cs,
|
||||
struct pipe_buffer* bo,
|
||||
uint32_t rd,
|
||||
uint32_t wd,
|
||||
uint32_t flags);
|
||||
void (*write_cs_reloc)(struct r300_winsys* winsys,
|
||||
struct pipe_buffer* bo,
|
||||
uint32_t rd,
|
||||
uint32_t wd,
|
||||
uint32_t flags);
|
||||
|
||||
/* Finish a command emit. */
|
||||
void (*end_cs)(struct radeon_cs* cs,
|
||||
const char* file,
|
||||
const char* function,
|
||||
int line);
|
||||
void (*end_cs)(struct r300_winsys* winsys,
|
||||
const char* file,
|
||||
const char* function,
|
||||
int line);
|
||||
|
||||
/* Flush the CS. */
|
||||
void (*flush_cs)(struct radeon_cs* cs);
|
||||
void (*flush_cs)(struct r300_winsys* winsys);
|
||||
};
|
||||
|
||||
struct pipe_context* r300_create_context(struct pipe_screen* screen,
|
||||
|
||||
@@ -126,14 +126,14 @@ softpipe_is_texture_referenced( struct pipe_context *pipe,
|
||||
struct pipe_texture *texture,
|
||||
unsigned face, unsigned level)
|
||||
{
|
||||
return PIPE_REFERENCED_FOR_READ | PIPE_REFERENCED_FOR_WRITE;
|
||||
return PIPE_UNREFERENCED;
|
||||
}
|
||||
|
||||
static unsigned int
|
||||
softpipe_is_buffer_referenced( struct pipe_context *pipe,
|
||||
struct pipe_buffer *buf)
|
||||
{
|
||||
return PIPE_REFERENCED_FOR_READ | PIPE_REFERENCED_FOR_WRITE;
|
||||
return PIPE_UNREFERENCED;
|
||||
}
|
||||
|
||||
struct pipe_context *
|
||||
|
||||
@@ -399,3 +399,22 @@ softpipe_init_screen_texture_funcs(struct pipe_screen *screen)
|
||||
screen->transfer_map = softpipe_transfer_map;
|
||||
screen->transfer_unmap = softpipe_transfer_unmap;
|
||||
}
|
||||
|
||||
|
||||
boolean
|
||||
softpipe_get_texture_buffer( struct pipe_texture *texture,
|
||||
struct pipe_buffer **buf,
|
||||
unsigned *stride )
|
||||
{
|
||||
struct softpipe_texture *tex = (struct softpipe_texture *)texture;
|
||||
|
||||
if (!tex)
|
||||
return FALSE;
|
||||
|
||||
pipe_buffer_reference(buf, tex->buffer);
|
||||
|
||||
if (stride)
|
||||
*stride = tex->stride[0];
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -52,6 +52,12 @@ struct pipe_screen *
|
||||
softpipe_create_screen(struct pipe_winsys *);
|
||||
|
||||
|
||||
boolean
|
||||
softpipe_get_texture_buffer( struct pipe_texture *texture,
|
||||
struct pipe_buffer **buf,
|
||||
unsigned *stride );
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -132,6 +132,7 @@ enum pipe_texture_target {
|
||||
#define PIPE_TEX_FACE_NEG_Y 3
|
||||
#define PIPE_TEX_FACE_POS_Z 4
|
||||
#define PIPE_TEX_FACE_NEG_Z 5
|
||||
#define PIPE_TEX_FACE_MAX 6
|
||||
|
||||
#define PIPE_TEX_WRAP_REPEAT 0
|
||||
#define PIPE_TEX_WRAP_CLAMP 1
|
||||
@@ -158,14 +159,6 @@ enum pipe_texture_target {
|
||||
#define PIPE_TEX_COMPARE_NONE 0
|
||||
#define PIPE_TEX_COMPARE_R_TO_TEXTURE 1
|
||||
|
||||
#define PIPE_TEX_FACE_POS_X 0
|
||||
#define PIPE_TEX_FACE_NEG_X 1
|
||||
#define PIPE_TEX_FACE_POS_Y 2
|
||||
#define PIPE_TEX_FACE_NEG_Y 3
|
||||
#define PIPE_TEX_FACE_POS_Z 4
|
||||
#define PIPE_TEX_FACE_NEG_Z 5
|
||||
#define PIPE_TEX_FACE_MAX 6
|
||||
|
||||
#define PIPE_TEXTURE_USAGE_RENDER_TARGET 0x1
|
||||
#define PIPE_TEXTURE_USAGE_DISPLAY_TARGET 0x2 /* ie a backbuffer */
|
||||
#define PIPE_TEXTURE_USAGE_PRIMARY 0x4 /* ie a frontbuffer */
|
||||
|
||||
@@ -0,0 +1,82 @@
|
||||
#ifndef _DRI1_API_H_
|
||||
#define _DRI1_API_H_
|
||||
|
||||
#include "pipe/p_compiler.h"
|
||||
#include "pipe/p_screen.h"
|
||||
#include "pipe/p_format.h"
|
||||
|
||||
#include "state_tracker/drm_api.h"
|
||||
|
||||
#include <drm.h>
|
||||
|
||||
struct pipe_screen;
|
||||
struct pipe_winsys;
|
||||
struct pipe_buffer;
|
||||
struct pipe_context;
|
||||
struct pipe_texture;
|
||||
|
||||
struct dri1_api_version
|
||||
{
|
||||
int major;
|
||||
int minor;
|
||||
int patch_level;
|
||||
};
|
||||
|
||||
/**
|
||||
* This callback struct is intended for drivers that need to take
|
||||
* the hardware lock on command submission.
|
||||
*/
|
||||
|
||||
struct dri1_api_lock_funcs
|
||||
{
|
||||
void (*lock) (struct pipe_context * pipe);
|
||||
void (*unlock) (struct pipe_context * locked_pipe);
|
||||
boolean(*is_locked) (struct pipe_context * locked_pipe);
|
||||
boolean(*is_lock_lost) (struct pipe_context * locked_pipe);
|
||||
void (*clear_lost_lock) (struct pipe_context * locked_pipe);
|
||||
};
|
||||
|
||||
struct dri1_api
|
||||
{
|
||||
/**
|
||||
* For flushing to the front buffer. A driver should implement one and only
|
||||
* one of the functions below. The present_locked functions allows a dri1
|
||||
* driver to pageflip.
|
||||
*/
|
||||
|
||||
/*@{ */
|
||||
|
||||
struct pipe_surface *(*front_srf_locked) (struct pipe_context *
|
||||
locked_pipe);
|
||||
|
||||
void (*present_locked) (struct pipe_context * locked_pipe,
|
||||
struct pipe_surface * surf,
|
||||
const struct drm_clip_rect * rect,
|
||||
unsigned int num_clip,
|
||||
int x_draw, int y_draw,
|
||||
const struct drm_clip_rect * src_bbox,
|
||||
struct pipe_fence_handle ** fence);
|
||||
/*@} */
|
||||
};
|
||||
|
||||
struct dri1_create_screen_arg
|
||||
{
|
||||
struct drm_create_screen_arg base;
|
||||
|
||||
struct dri1_api_lock_funcs *lf;
|
||||
void *ddx_info;
|
||||
int ddx_info_size;
|
||||
void *sarea;
|
||||
|
||||
struct dri1_api_version ddx_version;
|
||||
struct dri1_api_version dri_version;
|
||||
struct dri1_api_version drm_version;
|
||||
|
||||
/*
|
||||
* out parameters;
|
||||
*/
|
||||
|
||||
struct dri1_api *api;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -10,13 +10,30 @@ struct pipe_buffer;
|
||||
struct pipe_context;
|
||||
struct pipe_texture;
|
||||
|
||||
enum drm_create_screen_mode {
|
||||
DRM_CREATE_NORMAL = 0,
|
||||
DRM_CREATE_DRI1,
|
||||
DRM_CREATE_DRIVER = 1024,
|
||||
DRM_CREATE_MAX
|
||||
};
|
||||
|
||||
/**
|
||||
* Modes other than DRM_CREATE_NORMAL derive from this struct.
|
||||
*/
|
||||
/*@{*/
|
||||
struct drm_create_screen_arg {
|
||||
enum drm_create_screen_mode mode;
|
||||
};
|
||||
/*@}*/
|
||||
|
||||
struct drm_api
|
||||
{
|
||||
/**
|
||||
* Special buffer functions
|
||||
*/
|
||||
/*@{*/
|
||||
struct pipe_screen* (*create_screen)(int drmFB, int pciID);
|
||||
struct pipe_screen* (*create_screen)(int drm_fd,
|
||||
struct drm_create_screen_arg *arg);
|
||||
struct pipe_context* (*create_context)(struct pipe_screen *screen);
|
||||
/*@}*/
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user