Compare commits
257 Commits
mesa_7_5_r
...
mesa_7_5_r
Author | SHA1 | Date | |
---|---|---|---|
|
418987ff05 | ||
|
21320b24c5 | ||
|
4181a107cb | ||
|
2a41df86a3 | ||
|
318122b60a | ||
|
dd585db687 | ||
|
f08bebfe24 | ||
|
2d86503471 | ||
|
077a06c140 | ||
|
62ad606065 | ||
|
928e1ce47f | ||
|
af7fb892d8 | ||
|
f5dc352e5f | ||
|
e80ecdf659 | ||
|
8e6dd8bf79 | ||
|
aa48becb82 | ||
|
16787c513b | ||
|
ac05996b81 | ||
|
0efd25b502 | ||
|
2ae297c318 | ||
|
ddf64be258 | ||
|
f652f15e6d | ||
|
dd453fa37c | ||
|
2f1c5c58b3 | ||
|
65eaafee25 | ||
|
e139434d44 | ||
|
b04605d544 | ||
|
515513b409 | ||
|
09313043e7 | ||
|
5951ab311d | ||
|
e5b53c071b | ||
|
3c6480ea42 | ||
|
fc0896b50b | ||
|
f4b1a69b7d | ||
|
454a717d94 | ||
|
02edc8da36 | ||
|
08025cd4a5 | ||
|
2102e301a7 | ||
|
541594b044 | ||
|
38ddbc5588 | ||
|
4dafac2b2f | ||
|
aba93643be | ||
|
7e0eaca201 | ||
|
c1f74a6734 | ||
|
f38872473c | ||
|
f66733bbee | ||
|
c4fd947bee | ||
|
c20bb48d3a | ||
|
eb1eee03a6 | ||
|
4bc74a0756 | ||
|
625b0fe268 | ||
|
4031ea1520 | ||
|
84c5e4805b | ||
|
72aed16aee | ||
|
25f6c936fe | ||
|
3e94521912 | ||
|
c9f8c400ab | ||
|
c25534f30d | ||
|
b79e6a59d8 | ||
|
2f184d0d9f | ||
|
9d367d43b2 | ||
|
0584b6e433 | ||
|
19218fe712 | ||
|
a5b7e0c7d7 | ||
|
54f425b5ce | ||
|
810df8317d | ||
|
19ca5ee1db | ||
|
ad0514b24d | ||
|
00e203fe17 | ||
|
abfd56c24c | ||
|
daacac1c24 | ||
|
43bb78f2bb | ||
|
9dfce365c7 | ||
|
a120778c72 | ||
|
3cf92e936a | ||
|
0487656245 | ||
|
8f382fd3f3 | ||
|
21bfd0f4bd | ||
|
d609df1dae | ||
|
2af0173e9e | ||
|
42882897c6 | ||
|
4b4855c717 | ||
|
1b05b5b4fe | ||
|
0491142152 | ||
|
39366ed995 | ||
|
d446d3acac | ||
|
56235ae504 | ||
|
e15aebe10e | ||
|
a70c45bdab | ||
|
ff3da0966f | ||
|
1b8e4dd2c8 | ||
|
cee73ffdaf | ||
|
7805c3b57b | ||
|
97974b7e51 | ||
|
957f3c8c3d | ||
|
66bfd025c8 | ||
|
fbd554d074 | ||
|
6e0df938d4 | ||
|
988b61be27 | ||
|
320a303be0 | ||
|
d9e35d51fd | ||
|
61a2c9668f | ||
|
2770107d87 | ||
|
3f856c6b6b | ||
|
d18c57aaea | ||
|
3705f48688 | ||
|
c6f71eabd8 | ||
|
1bee650ef3 | ||
|
6e24fdeae5 | ||
|
557421b6de | ||
|
25f0c33bb3 | ||
|
c53705ed7b | ||
|
ebe0796ba2 | ||
|
d22828f716 | ||
|
992000cce7 | ||
|
6b917d0b17 | ||
|
742ba08406 | ||
|
3e48dd0445 | ||
|
ed7f4b4230 | ||
|
3463b1479d | ||
|
077c5e62d8 | ||
|
06075711af | ||
|
566bdbe67d | ||
|
d027e8feff | ||
|
227d233cff | ||
|
7585cbffe0 | ||
|
c6af9b2947 | ||
|
053d8eb891 | ||
|
6214c7262f | ||
|
37f2117cd1 | ||
|
c33ef1f7c6 | ||
|
940cb7ce16 | ||
|
5d0cf9ebb4 | ||
|
0e1abced56 | ||
|
db22b35d21 | ||
|
cbe5af766e | ||
|
fb64365642 | ||
|
476685c63c | ||
|
c6de08fff4 | ||
|
3754c4135c | ||
|
322e8556b9 | ||
|
0ddc38309a | ||
|
e1700009b7 | ||
|
d5ba39ad08 | ||
|
de413b1ba9 | ||
|
3f2e006b75 | ||
|
7cafd49c93 | ||
|
862c7b8cd3 | ||
|
bb0b954f12 | ||
|
9d5479eeeb | ||
|
cc09724a50 | ||
|
41cf681535 | ||
|
e3f14f2f3b | ||
|
48d816b8ff | ||
|
96aca15c9d | ||
|
337f559cd2 | ||
|
8fa8669aeb | ||
|
0a4fcabe44 | ||
|
dbab657fe7 | ||
|
9225b67383 | ||
|
88527220e4 | ||
|
506989b20e | ||
|
6f50c9865d | ||
|
5450281ff7 | ||
|
4d16eb5e18 | ||
|
978bca8b2a | ||
|
52411a1951 | ||
|
8bfbb7ec8b | ||
|
76a1017e97 | ||
|
9192347443 | ||
|
cb549775a5 | ||
|
34bb024cf2 | ||
|
7eed6ab5b5 | ||
|
304ba4bba4 | ||
|
77c329a277 | ||
|
b6753adbc7 | ||
|
e09f78d8dc | ||
|
42678dba94 | ||
|
33d6327770 | ||
|
0bced6a326 | ||
|
0d3c8fbf12 | ||
|
fce4ee12a6 | ||
|
4d9d0e6230 | ||
|
283e84bfb3 | ||
|
78dad27564 | ||
|
cfff2a6189 | ||
|
6453605785 | ||
|
5df6468589 | ||
|
9424d81d18 | ||
|
6907650211 | ||
|
d37795c453 | ||
|
45e744dddc | ||
|
fc7f924782 | ||
|
0f50c4fab8 | ||
|
273117ceed | ||
|
840af5fd62 | ||
|
c91df4c153 | ||
|
12e94d892e | ||
|
cb3a9f984d | ||
|
16fbd39129 | ||
|
1aef032d43 | ||
|
003cfd4dd2 | ||
|
69a765df1c | ||
|
503632557e | ||
|
557d2bb423 | ||
|
97f5953ced | ||
|
f989390af6 | ||
|
00e7a60077 | ||
|
3c756ed39f | ||
|
76ad2b4a5a | ||
|
0e8a5a8474 | ||
|
427554211b | ||
|
a5d033e89b | ||
|
ea3ee4791e | ||
|
0ea519f931 | ||
|
fe69b6bdc7 | ||
|
be7c56be06 | ||
|
76f2bacb07 | ||
|
1124f786c1 | ||
|
5bb2074798 | ||
|
8aef306c34 | ||
|
29c6c8eb18 | ||
|
a59575d8fb | ||
|
1045481dd9 | ||
|
c3538969e1 | ||
|
58fadc6242 | ||
|
995456f930 | ||
|
42b747e57d | ||
|
70c4b81e88 | ||
|
8da09e6924 | ||
|
d4fb7615b5 | ||
|
d2f4c2b632 | ||
|
042d9a5132 | ||
|
c99a60c40d | ||
|
7ce105d2e6 | ||
|
adabd0e81e | ||
|
30320f0afb | ||
|
14e5bff97b | ||
|
df37cde309 | ||
|
6e61700541 | ||
|
da0d4e1db6 | ||
|
f2445dfd85 | ||
|
483e247804 | ||
|
65b9cd74e3 | ||
|
09c04db3c9 | ||
|
99960393ed | ||
|
2e4e346890 | ||
|
3e74faa029 | ||
|
7ae4ce9e22 | ||
|
5568f2f601 | ||
|
46b81b0cc8 | ||
|
64f36ff9fb | ||
|
f104e4d666 | ||
|
f5cf181c65 | ||
|
2223615e0a | ||
|
31865904d8 | ||
|
c8c0953294 |
4
Makefile
4
Makefile
@@ -127,6 +127,7 @@ linux-icc \
|
||||
linux-icc-static \
|
||||
linux-llvm \
|
||||
linux-osmesa \
|
||||
linux-osmesa-static \
|
||||
linux-osmesa16 \
|
||||
linux-osmesa16-static \
|
||||
linux-osmesa32 \
|
||||
@@ -181,7 +182,7 @@ ultrix-gcc:
|
||||
|
||||
# Rules for making release tarballs
|
||||
|
||||
VERSION=7.5-rc1
|
||||
VERSION=7.5-rc4
|
||||
DIRECTORY = Mesa-$(VERSION)
|
||||
LIB_NAME = MesaLib-$(VERSION)
|
||||
DEMO_NAME = MesaDemos-$(VERSION)
|
||||
@@ -327,6 +328,7 @@ GALLIUM_FILES = \
|
||||
$(DIRECTORY)/src/gallium/*/*/*/SConscript \
|
||||
$(DIRECTORY)/src/gallium/*/*/*/*.[ch] \
|
||||
$(DIRECTORY)/src/gallium/*/*/*/*.py \
|
||||
$(DIRECTORY)/src/gallium/*/*/*/*/Makefile \
|
||||
$(DIRECTORY)/src/gallium/*/*/*/*/*.[ch] \
|
||||
|
||||
|
||||
|
@@ -66,8 +66,11 @@ if [ $# -ge 2 ] ; then
|
||||
|
||||
elif [ -f "$FILE" ] ; then
|
||||
#echo "$FILE" is a regular file
|
||||
$RM "$DEST/`basename $FILE`"
|
||||
cp "$FILE" "$DEST"
|
||||
# Only copy if the files differ
|
||||
if ! cmp -s $FILE $DEST/`basename $FILE`; then
|
||||
$RM "$DEST/`basename $FILE`"
|
||||
cp "$FILE" "$DEST"
|
||||
fi
|
||||
if [ $MODE ] ; then
|
||||
FILE=`basename "$FILE"`
|
||||
chmod $MODE "$DEST/$FILE"
|
||||
|
19
bin/mklib
19
bin/mklib
@@ -885,6 +885,17 @@ case $ARCH in
|
||||
|
||||
CYGWIN*)
|
||||
# GCC-based environment
|
||||
if [ $NOPREFIX = 1 ] ; then
|
||||
# No "lib" or ".so" part
|
||||
echo "mklib: Making CYGWIN shared library: " ${LIBNAME}
|
||||
OPTS="-shared -Wl,--enable-auto-image-base"
|
||||
if [ "${ALTOPTS}" ] ; then
|
||||
OPTS=${ALTOPTS}
|
||||
fi
|
||||
rm -f ${LIBNAME}
|
||||
${LINK} ${OPTS} ${LDFLAGS} -o ${LIBNAME} ${OBJECTS} ${DEPS}
|
||||
FINAL_LIBS=${LIBNAME}
|
||||
else
|
||||
CYGNAME="cyg${LIBNAME}" # prefix with "cyg"
|
||||
LIBNAME="lib${LIBNAME}" # prefix with "lib"
|
||||
|
||||
@@ -901,11 +912,11 @@ case $ARCH in
|
||||
# finish up
|
||||
FINAL_LIBS=${LIBNAME}.a
|
||||
else
|
||||
OPTS="-shared -Wl,-export-all -Wl,--out-implib=${LIBNAME}-${MAJOR}.dll.a"
|
||||
OPTS="-shared -Wl,--enable-auto-image-base -Wl,-export-all -Wl,--out-implib=${LIBNAME}-${MAJOR}.dll.a"
|
||||
if [ "${ALTOPTS}" ] ; then
|
||||
OPTS=${ALTOPTS}
|
||||
fi
|
||||
echo "mklib: Making" $ARCH "shared library: " ${LIBNAME}-${MAJOR}.dll
|
||||
echo "mklib: Making" $ARCH "shared library: " ${CYGNAME}-${MAJOR}.dll
|
||||
|
||||
if [ $CPLUSPLUS = 1 ] ; then
|
||||
LINK="g++"
|
||||
@@ -914,7 +925,8 @@ case $ARCH in
|
||||
fi
|
||||
|
||||
# rm any old libs
|
||||
rm -f ${LIBNAME}-${MAJOR}.dll
|
||||
rm -f ${CYGNAME}-${MAJOR}.dll
|
||||
rm -f ${LIBNAME}-${MAJOR}.dll.a
|
||||
rm -f ${LIBNAME}.dll.a
|
||||
rm -f ${LIBNAME}.a
|
||||
|
||||
@@ -927,6 +939,7 @@ case $ARCH in
|
||||
# special case for installing in bin
|
||||
FINAL_BINS="${CYGNAME}-${MAJOR}.dll"
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
|
||||
'example')
|
||||
|
@@ -55,7 +55,7 @@ def AddOptions(opts):
|
||||
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'))
|
||||
opts.Add(BoolOption('quiet', 'quiet command lines', 'yes'))
|
||||
opts.Add(EnumOption('machine', 'use machine-specific assembly code', default_machine,
|
||||
allowed_values=('generic', 'ppc', 'x86', 'x86_64')))
|
||||
opts.Add(EnumOption('platform', 'target platform', default_platform,
|
||||
|
37
configs/linux-osmesa-static
Normal file
37
configs/linux-osmesa-static
Normal file
@@ -0,0 +1,37 @@
|
||||
# Configuration for building static libOSMesa.a on Linux, no Xlib driver
|
||||
# This doesn't really have any Linux dependencies, so it should be usable
|
||||
# on other (gcc-based) systems.
|
||||
|
||||
include $(TOP)/configs/default
|
||||
|
||||
CONFIG_NAME = linux-osmesa
|
||||
|
||||
# Compiler and flags
|
||||
CC = gcc -m32
|
||||
CXX = g++ -m32
|
||||
CFLAGS = -O3 -ansi -pedantic -fPIC -ffast-math -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE -D_BSD_SOURCE -DPTHREADS
|
||||
CXXFLAGS = -O3 -ansi -pedantic -fPIC -ffast-math -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE -D_BSD_SOURCE
|
||||
|
||||
MKLIB_OPTIONS = -static
|
||||
|
||||
# Library names (actual file names)
|
||||
GL_LIB_NAME = libGL.a
|
||||
GLU_LIB_NAME = libGLU.a
|
||||
GLUT_LIB_NAME = libglut.a
|
||||
GLW_LIB_NAME = libGLw.a
|
||||
OSMESA_LIB_NAME = libOSMesa.a
|
||||
|
||||
# Directories
|
||||
SRC_DIRS = mesa glu
|
||||
DRIVER_DIRS = osmesa
|
||||
PROGRAM_DIRS = osdemos
|
||||
|
||||
|
||||
# Dependencies
|
||||
GL_LIB_DEPS =
|
||||
OSMESA_LIB_DEPS =
|
||||
GLU_LIB_DEPS =
|
||||
GLUT_LIB_DEPS =
|
||||
GLW_LIB_DEPS =
|
||||
APP_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) \
|
||||
$(EXTRA_LIB_PATH) -lX11 -lXmu -lXt -lXi -lpthread -lstdc++ -lm
|
12
configure.ac
12
configure.ac
@@ -222,6 +222,8 @@ else
|
||||
case "$host_os" in
|
||||
darwin* )
|
||||
LIB_EXTENSION='dylib' ;;
|
||||
cygwin* )
|
||||
LIB_EXTENSION='dll' ;;
|
||||
* )
|
||||
LIB_EXTENSION='so' ;;
|
||||
esac
|
||||
@@ -826,12 +828,12 @@ case "$mesa_driver" in
|
||||
osmesa)
|
||||
# only link libraries with osmesa if shared
|
||||
if test "$enable_static" = no; then
|
||||
OSMESA_LIB_DEPS="-lm -lpthread $SELINUX_LIBS"
|
||||
OSMESA_LIB_DEPS="-lm -lpthread $SELINUX_LIBS $DLOPEN_LIBS"
|
||||
else
|
||||
OSMESA_LIB_DEPS=""
|
||||
fi
|
||||
OSMESA_MESA_DEPS=""
|
||||
OSMESA_PC_LIB_PRIV="-lm -lpthread $SELINUX_LIBS"
|
||||
OSMESA_PC_LIB_PRIV="-lm -lpthread $SELINUX_LIBS $DLOPEN_LIBS"
|
||||
;;
|
||||
*)
|
||||
# Link OSMesa to libGL otherwise
|
||||
@@ -845,9 +847,6 @@ osmesa)
|
||||
OSMESA_PC_REQ="gl"
|
||||
;;
|
||||
esac
|
||||
if test "$enable_static" = no; then
|
||||
OSMESA_LIB_DEPS="$OSMESA_LIB_DEPS"
|
||||
fi
|
||||
OSMESA_PC_LIB_PRIV="$OSMESA_PC_LIB_PRIV"
|
||||
AC_SUBST([OSMESA_LIB_DEPS])
|
||||
AC_SUBST([OSMESA_MESA_DEPS])
|
||||
@@ -1076,6 +1075,9 @@ if test "x$APP_LIB_DEPS" = x; then
|
||||
solaris*)
|
||||
APP_LIB_DEPS="-lX11 -lsocket -lnsl -lm"
|
||||
;;
|
||||
cygwin*)
|
||||
APP_LIB_DEPS="-lX11"
|
||||
;;
|
||||
*)
|
||||
APP_LIB_DEPS="-lm"
|
||||
;;
|
||||
|
@@ -123,48 +123,46 @@ These are the instructions for making a new Mesa release.
|
||||
|
||||
<H3>Get latest source files</H3>
|
||||
<p>
|
||||
Use "cvs update -dAP " to get the latest Mesa files from CVS.
|
||||
Use git to get the latest Mesa files from the git repository, from whatever
|
||||
branch is relevant.
|
||||
</p>
|
||||
|
||||
|
||||
<H3>Verify and update version info</H3>
|
||||
<p>
|
||||
Create/edit the docs/RELNOTES-X.Y file to document what's new in the release.
|
||||
Add the new RELNOTES-X.Y file to <a href="relnotes.html">relnotes.html</a>.
|
||||
Update the docs/VERSIONS file too.
|
||||
Create/edit the docs/relnotes-x.y.html file to document what's new in the release.
|
||||
Add the new relnotes-x.y.html file to <a href="relnotes.html">relnotes.html</a>.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Edit the MESA_MAJOR, MESA_MINOR and MESA_TINY version numbers in
|
||||
Update the MESA_MAJOR, MESA_MINOR and MESA_TINY version numbers in
|
||||
configs/default.
|
||||
Also update the VERSION line in the top-level Makefile.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Make sure the values in src/mesa/main/version.h are correct.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Edit the top-level Makefile and verify that DIRECTORY, LIB_NAME and
|
||||
DEMO_NAME are correct.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Update the docs/news.html file and docs/download.html files.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Check in all updates to CVS.
|
||||
Check in all updates to git.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Tag the CVS files with the release name (in the form <b>mesa_X_Y</b>).
|
||||
Tag the files with the release name (in the form <b>mesa_X_Y</b>)
|
||||
with: <code>git tag -a mesa_X_Y</code>
|
||||
Then: <code>git push origin mesa_X_Y</code>
|
||||
</p>
|
||||
|
||||
|
||||
<H3>Make the tarballs</H3>
|
||||
<p>
|
||||
Make a symbolic link from $(DIRECTORY) to 'Mesa'. For example,
|
||||
ln -s Mesa Mesa-6.3
|
||||
<code>ln -s Mesa Mesa-7.5</code>
|
||||
This is needed in order to make a correct tar file in the next step.
|
||||
</p>
|
||||
|
||||
@@ -177,7 +175,7 @@ Make the distribution files. From inside the Mesa directory:
|
||||
<p>
|
||||
After the tarballs are created, the md5 checksums for the files will
|
||||
be computed.
|
||||
Add them to the docs/news.html file.
|
||||
Add them to the docs/relnotes-X.Y.html file.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
@@ -191,9 +189,21 @@ Follow the directions on SourceForge for creating a new "release" and
|
||||
uploading the tarballs.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Basically, to upload the tarball files with:
|
||||
<br>
|
||||
<code>
|
||||
rsync -avP ssh Mesa*-X.Y.* USERNAME@frs.sourceforge.net:uploads/
|
||||
</code>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Update the web site by copying the docs/ directory's files to
|
||||
/home/users/b/br/brianp/mesa-www/htdocs/
|
||||
/home/users/b/br/brianp/mesa-www/htdocs/ with:
|
||||
<br>
|
||||
<code>
|
||||
sftp USERNAME,mesa3d@web.sourceforge.net
|
||||
</code>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
|
@@ -21,6 +21,7 @@
|
||||
<li><a href="#pkg-config">Building OpenGL programs with pkg-config
|
||||
</ul>
|
||||
<li><a href="#windows">Windows</a>
|
||||
<li><a href="#scons">SCons</a>
|
||||
<li><a href="#other">Other</a>
|
||||
</ol>
|
||||
<br>
|
||||
@@ -328,13 +329,60 @@ For example, compiling and linking a GLUT application can be done with:
|
||||
<H2>2. Windows Compilation and Installation</H1>
|
||||
|
||||
<p>
|
||||
Please see the <a href="README.WIN32">README.WIN32</a> file.
|
||||
Please see the <a href="#scons">instructions on building with SCons</a>.
|
||||
Alternatively see <a href="README.WIN32">README.WIN32</a> file.
|
||||
</p>
|
||||
|
||||
|
||||
|
||||
<a name="scons">
|
||||
<H2>3. Building with SCons</H1>
|
||||
|
||||
<p>
|
||||
To build Mesa with SCons on Linux or Windows do
|
||||
</p>
|
||||
<pre>
|
||||
scons
|
||||
</pre>
|
||||
<p>
|
||||
The build output will be placed in
|
||||
build/<i>platform</i>-<i>machine</i>-<i>debug</i>/..., where <i>platform</i> is for
|
||||
example linux or windows, <i>machine</i> is x86 or x86_64, optionally followed
|
||||
by -debug for debug builds.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
The sample programs are built seperately. To build them do
|
||||
<pre>
|
||||
scons -C progs
|
||||
</pre>
|
||||
And the build output will be placed in progs/build/...
|
||||
</p>
|
||||
|
||||
<p>
|
||||
To build Mesa with SCons for Windows on Linux using the MinGW crosscompiler toolchain do
|
||||
</p>
|
||||
<pre>
|
||||
scons platform=windows toolchain=crossmingw machine=x86 statetrackers=mesa drivers=softpipe,trace winsys=gdi
|
||||
scons -C progs platform=windows toolchain=crossmingw machine=x86 -k
|
||||
</pre>
|
||||
<p>
|
||||
This will create:
|
||||
</p>
|
||||
<ul>
|
||||
<li>build/windows-x86-debug/gallium/winsys/gdi/opengl32.dll — Mesa + Gallium + softpipe, binary compatible with Windows's opengl32.dll
|
||||
<li>build/windows-x86-debug/glut/glx/glut32.dll
|
||||
<li>progs/build/windows-x86-debug/wgl/wglinfo.exe
|
||||
<li>progs/build/windows-x86-debug/trivial/tri.exe
|
||||
<li>and many other samples in progs/build/windows-x86-debug/...
|
||||
</ul>
|
||||
<p>
|
||||
Put them all in the same directory to test them.
|
||||
</p>
|
||||
|
||||
|
||||
<a name="other">
|
||||
<H2>3. Other systems</H1>
|
||||
<H2>4. Other systems</H1>
|
||||
|
||||
<p>
|
||||
Documentation for other environments (some may be very out of date):
|
||||
|
@@ -11,9 +11,25 @@
|
||||
<H1>News</H1>
|
||||
|
||||
|
||||
<h2>May tbd, 2009</h2>
|
||||
<h2>June 23, 2009</h2>
|
||||
<p>
|
||||
<a href="relnotes-7.5.html">Mesa 7.5</a> is released.
|
||||
<a href="relnotes-7.4.4.html">Mesa 7.4.4</a> is released.
|
||||
This is a stable release that fixes a regression in the i915/i965 drivers
|
||||
that slipped into the 7.4.3 release.
|
||||
</p>
|
||||
|
||||
|
||||
<h2>June 19, 2009</h2>
|
||||
<p>
|
||||
<a href="relnotes-7.4.3.html">Mesa 7.4.3</a> is released.
|
||||
This is a stable release fixing bugs since the 7.4.2 release.
|
||||
</p>
|
||||
|
||||
|
||||
<h2>May 15, 2009</h2>
|
||||
<p>
|
||||
<a href="relnotes-7.4.2.html">Mesa 7.4.2</a> is released.
|
||||
This is a stable release fixing bugs since the 7.4.1 release.
|
||||
</p>
|
||||
|
||||
|
||||
|
74
docs/relnotes-7.4.2.html
Normal file
74
docs/relnotes-7.4.2.html
Normal file
@@ -0,0 +1,74 @@
|
||||
<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.2 Release Notes / May 15, 2009</H1>
|
||||
|
||||
<p>
|
||||
Mesa 7.4.2 is a stable development release fixing bugs since the 7.4.1 release.
|
||||
</p>
|
||||
<p>
|
||||
Mesa 7.4.2 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>
|
||||
172f5193154dad731387f97bd44ab68f MesaLib-7.4.2.tar.gz
|
||||
b10a76e32bde4645cfc34ea0416d7d8b MesaLib-7.4.2.tar.bz2
|
||||
cc6dfc2efd424cc342b84e6bcd78ce5d MesaLib-7.4.2.zip
|
||||
182a7e78aa7a480b3650a5c956dbddd1 MesaDemos-7.4.2.tar.gz
|
||||
bf559a0485667a3bfa4513a23501579b MesaDemos-7.4.2.tar.bz2
|
||||
5379e622b65e8c22022dba34aeb6f4f9 MesaDemos-7.4.2.zip
|
||||
7cc43c1c35bf6a279a16e063dea3b8c5 MesaGLUT-7.4.2.tar.gz
|
||||
e0dfc44d537904a030861e5b3c760c11 MesaGLUT-7.4.2.tar.bz2
|
||||
4a6cf5bbbac190d6ba97448b3098b7f4 MesaGLUT-7.4.2.zip
|
||||
</pre>
|
||||
|
||||
|
||||
<h2>Bug fixes</h2>
|
||||
<ul>
|
||||
<li>Fixed segfault when rendering to front buffer with DRI 1.
|
||||
<li>Fixed swrast texture rectangle bug when wrap mode = GL_CLAMP_TO_BORDER and
|
||||
filter mode = GL_LINEAR. (bug 21461)
|
||||
<li>Fixed texture object mem leak during context destruction.
|
||||
<li>Fixed a state validation bug in glCopyTex[Sub]Image()
|
||||
<li>Fixed some i965 GLSL bugs.
|
||||
<li>Fixed an R300 driver texture object bad memory reference.
|
||||
</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>
|
79
docs/relnotes-7.4.3.html
Normal file
79
docs/relnotes-7.4.3.html
Normal file
@@ -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.3 Release Notes / 19 June 2009</H1>
|
||||
|
||||
<p>
|
||||
Mesa 7.4.3 is a stable development release fixing bugs since the 7.4.2 release.
|
||||
</p>
|
||||
<p>
|
||||
Mesa 7.4.3 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>
|
||||
34c5a6c47ed51f31c4fa36e269831352 MesaLib-7.4.3.tar.gz
|
||||
70a983ba3deaa8bd63b18bbab283f698 MesaLib-7.4.3.tar.bz2
|
||||
34f21b3205b271d575030aa98a2dda51 MesaLib-7.4.3.zip
|
||||
56752b7adede212e6097afb10d0c0d59 MesaDemos-7.4.3.tar.gz
|
||||
8ffa51c4833b1e298300a005e2d7ca2a MesaDemos-7.4.3.tar.bz2
|
||||
0037d24d41400d6fb9800ae55b8c863f MesaDemos-7.4.3.zip
|
||||
20e24f6692c0c90e7e3b220f79c4108d MesaGLUT-7.4.3.tar.gz
|
||||
03a4beeef74fc5ef0b1d6d04710e5a8a MesaGLUT-7.4.3.tar.bz2
|
||||
273788230adbdb9d57371309adedcf5f MesaGLUT-7.4.3.zip
|
||||
</pre>
|
||||
|
||||
|
||||
<h2>Bug fixes</h2>
|
||||
<ul>
|
||||
<li>Fixed texture object reference counting bug (bug 21756)
|
||||
<li>Allow depth/stencil textures to be attached to GL_STENCIL_ATTACHMENT point
|
||||
(SF bug 2793846)
|
||||
<li>Added missing glGet case for GL_VERTEX_ARRAY_BINDING_APPLE
|
||||
<li>Fixed some OSMesa build issues
|
||||
<li>Fixed a vertex buffer object crash
|
||||
<li>Fixed broken glTexImage3D() when image type = GL_BITMAP
|
||||
<li>Fixed some GLSL preprocessor bugs
|
||||
<li>Fixed framebuffer mem leak in i945/i965 DRI drivers
|
||||
<li>Fixed texture coordinate repeat bug in swrast (bug 21872)
|
||||
<li>Fixed incorrect viewport clamping (lower bound is zero, not one)
|
||||
<li>GLX fix for glean's makeCurrent test case
|
||||
</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>
|
68
docs/relnotes-7.4.4.html
Normal file
68
docs/relnotes-7.4.4.html
Normal file
@@ -0,0 +1,68 @@
|
||||
<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.4 Release Notes / 23 June 2009</H1>
|
||||
|
||||
<p>
|
||||
Mesa 7.4.4 is a stable development release fixing bugs since the 7.4.3 release.
|
||||
</p>
|
||||
<p>
|
||||
Mesa 7.4.4 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>
|
||||
0b56fe5a88ab0c3c5b2da5068f63f416 MesaLib-7.4.4.tar.gz
|
||||
b66528d314c574dccbe0ed963cac5e93 MesaLib-7.4.4.tar.bz2
|
||||
2818076f3ba23fa87fdfe4602a637a18 MesaLib-7.4.4.zip
|
||||
3e77b208386c47b18165bce5ae317e2c MesaDemos-7.4.4.tar.gz
|
||||
628142ec9a54cd28cc027e6ce26cff47 MesaDemos-7.4.4.tar.bz2
|
||||
d08a30d30ab7174859aa709cba6c726d MesaDemos-7.4.4.zip
|
||||
e6e91ba16e274d40cf3a97ad3218af01 MesaGLUT-7.4.4.tar.gz
|
||||
e14bbb52517e8121b31f1387515365ab MesaGLUT-7.4.4.tar.bz2
|
||||
f10ed20469753c2b3d68c99854f80fd4 MesaGLUT-7.4.4.zip
|
||||
</pre>
|
||||
|
||||
|
||||
<h2>Bug fixes</h2>
|
||||
<ul>
|
||||
<li>Fixed i965/i915 segfault in screen destruction (bug 22408)
|
||||
</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>
|
@@ -46,7 +46,7 @@ tbd
|
||||
|
||||
<h2>New features</h2>
|
||||
<ul>
|
||||
<li>Gallium - this is the new architecture for OS-independent and
|
||||
<li>Gallium3D - this is the new architecture for OS-independent and
|
||||
API-independent 3D drivers.
|
||||
Gallium3D is intended for GPUs that fully support vertex/fragment shaders.
|
||||
The Gallium3D drivers currently included are:
|
||||
@@ -54,8 +54,10 @@ tbd
|
||||
<li>softpipe - a software/reference driver
|
||||
<li>i915 - Intel 915/945 driver
|
||||
<li><a href="cell.html">Cell</a> - IBM/Sony/Toshiba Cell processor driver
|
||||
<li>nouveau - preliminary driver for NVIDIA GPUs (still under development)
|
||||
<li>r300 - preliminary driver for R300 (still under development)
|
||||
<li>nouveau (for NVIDIA GPUs) and R300 for (AMD/ATI R300).
|
||||
<b>PLEASE NOTE: these drivers are incomplete and still under development.
|
||||
It's probably NOT worthwhile to report any bugs unless you have patches.
|
||||
</b>
|
||||
</ul>
|
||||
<li>GL_ARB_framebuffer_object extension (software drivers, i965 driver)
|
||||
<li>Reworked two-sided stencil support.
|
||||
@@ -66,12 +68,16 @@ including GL_ATI_separate_stencil, GL_EXT_stencil_two_side and OpenGL 2.0
|
||||
<li>GL_EXT_texture_swizzle extension (software drivers, i965 driver)
|
||||
<li>Updated SPARC assembly optimizations (David S. Miller)
|
||||
<li>Initial support for separate compilation units in GLSL compiler.
|
||||
<li>Increased max number of generic GLSL varying variables to 16 (formerly 8).
|
||||
<li>GLSL linker now detects when too many varying variables are used.
|
||||
</ul>
|
||||
|
||||
|
||||
<h2>Bug fixes</h2>
|
||||
<ul>
|
||||
<li>Lots of i965 driver bug fixes
|
||||
<li>Fixed some GLSL preprocessor bugs
|
||||
<li>GLSL: continue inside of a for-loop didn't work
|
||||
</ul>
|
||||
|
||||
|
||||
|
@@ -8,19 +8,15 @@
|
||||
|
||||
<H1>Release Notes</H1>
|
||||
|
||||
<p>
|
||||
Mesa uses an even/odd version number scheme like the Linux kernel.
|
||||
Odd numbered versions (such as 7.5) designate new developmental releases.
|
||||
Even numbered versions (such as 7.4) designate stable releases.
|
||||
</p>
|
||||
|
||||
|
||||
<p>
|
||||
The release notes summarize what's new or changed in each Mesa release.
|
||||
</p>
|
||||
|
||||
<UL>
|
||||
<LI><A HREF="relnotes-7.5.html">7.5 release notes</A>
|
||||
<LI><A HREF="relnotes-7.4.4.html">7.4.4 release notes</A>
|
||||
<LI><A HREF="relnotes-7.4.3.html">7.4.3 release notes</A>
|
||||
<LI><A HREF="relnotes-7.4.2.html">7.4.2 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>
|
||||
|
@@ -2702,7 +2702,7 @@ typedef GLenum (GLAPIENTRY * PFNGLCHECKFRAMEBUFFERSTATUSPROC) (GLenum target);
|
||||
typedef void (GLAPIENTRY * PFNGLDELETEFRAMEBUFFERSPROC) (GLsizei n, const GLuint* framebuffers);
|
||||
typedef void (GLAPIENTRY * PFNGLDELETERENDERBUFFERSPROC) (GLsizei n, const GLuint* renderbuffers);
|
||||
typedef void (GLAPIENTRY * PFNGLFRAMEBUFFERRENDERBUFFERPROC) (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
|
||||
typedef void (GLAPIENTRY * PFNGLFRAMEBUFFERTEXTURLAYERPROC) (GLenum target,GLenum attachment, GLuint texture,GLint level,GLint layer);
|
||||
typedef void (GLAPIENTRY * PFNGLFRAMEBUFFERTEXTURELAYERPROC) (GLenum target,GLenum attachment, GLuint texture,GLint level,GLint layer);
|
||||
typedef void (GLAPIENTRY * PFNGLFRAMEBUFFERTEXTURE1DPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
|
||||
typedef void (GLAPIENTRY * PFNGLFRAMEBUFFERTEXTURE2DPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
|
||||
typedef void (GLAPIENTRY * PFNGLFRAMEBUFFERTEXTURE3DPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint layer);
|
||||
@@ -2723,7 +2723,7 @@ typedef void (GLAPIENTRY * PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC) (GLenum targ
|
||||
#define glDeleteFramebuffers GLEW_GET_FUN(__glewDeleteFramebuffers)
|
||||
#define glDeleteRenderbuffers GLEW_GET_FUN(__glewDeleteRenderbuffers)
|
||||
#define glFramebufferRenderbuffer GLEW_GET_FUN(__glewFramebufferRenderbuffer)
|
||||
#define glFramebufferTexturLayer GLEW_GET_FUN(__glewFramebufferTexturLayer)
|
||||
#define glFramebufferTextureLayer GLEW_GET_FUN(__glewFramebufferTextureLayer)
|
||||
#define glFramebufferTexture1D GLEW_GET_FUN(__glewFramebufferTexture1D)
|
||||
#define glFramebufferTexture2D GLEW_GET_FUN(__glewFramebufferTexture2D)
|
||||
#define glFramebufferTexture3D GLEW_GET_FUN(__glewFramebufferTexture3D)
|
||||
@@ -10563,7 +10563,7 @@ GLEW_FUN_EXPORT PFNGLCHECKFRAMEBUFFERSTATUSPROC __glewCheckFramebufferStatus;
|
||||
GLEW_FUN_EXPORT PFNGLDELETEFRAMEBUFFERSPROC __glewDeleteFramebuffers;
|
||||
GLEW_FUN_EXPORT PFNGLDELETERENDERBUFFERSPROC __glewDeleteRenderbuffers;
|
||||
GLEW_FUN_EXPORT PFNGLFRAMEBUFFERRENDERBUFFERPROC __glewFramebufferRenderbuffer;
|
||||
GLEW_FUN_EXPORT PFNGLFRAMEBUFFERTEXTURLAYERPROC __glewFramebufferTexturLayer;
|
||||
GLEW_FUN_EXPORT PFNGLFRAMEBUFFERTEXTURELAYERPROC __glewFramebufferTextureLayer;
|
||||
GLEW_FUN_EXPORT PFNGLFRAMEBUFFERTEXTURE1DPROC __glewFramebufferTexture1D;
|
||||
GLEW_FUN_EXPORT PFNGLFRAMEBUFFERTEXTURE2DPROC __glewFramebufferTexture2D;
|
||||
GLEW_FUN_EXPORT PFNGLFRAMEBUFFERTEXTURE3DPROC __glewFramebufferTexture3D;
|
||||
|
@@ -145,6 +145,13 @@ engine.o: engine.c trackball.h
|
||||
$(APP_CC) -c -I$(INCDIR) $(CFLAGS) engine.c
|
||||
|
||||
|
||||
fbotexture: fbotexture.o
|
||||
$(APP_CC) $(CFLAGS) $(LDFLAGS) fbotexture.o $(LIBS) -o $@
|
||||
|
||||
fbotexture.o: fbotexture.c extfuncs.h
|
||||
$(APP_CC) -c -I$(INCDIR) $(CFLAGS) fbotexture.c
|
||||
|
||||
|
||||
fslight: fslight.o
|
||||
$(APP_CC) $(CFLAGS) $(LDFLAGS) fslight.o $(LIBS) -o $@
|
||||
|
||||
|
@@ -9,13 +9,13 @@
|
||||
*/
|
||||
|
||||
|
||||
#include <GL/glew.h>
|
||||
#include <GL/glut.h>
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
#include "extfuncs.h"
|
||||
|
||||
/* For debug */
|
||||
#define DEPTH 1
|
||||
@@ -80,9 +80,9 @@ RenderTexture(void)
|
||||
glTranslatef(0.0, 0.0, -15.0);
|
||||
|
||||
/* draw to texture image */
|
||||
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, MyFB);
|
||||
glBindFramebuffer_func(GL_FRAMEBUFFER_EXT, MyFB);
|
||||
|
||||
status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT);
|
||||
status = glCheckFramebufferStatus_func(GL_FRAMEBUFFER_EXT);
|
||||
if (status != GL_FRAMEBUFFER_COMPLETE_EXT) {
|
||||
printf("Framebuffer incomplete!!!\n");
|
||||
}
|
||||
@@ -171,7 +171,7 @@ RenderTexture(void)
|
||||
|
||||
#if DRAW
|
||||
/* Bind normal framebuffer */
|
||||
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
|
||||
glBindFramebuffer_func(GL_FRAMEBUFFER_EXT, 0);
|
||||
#endif
|
||||
|
||||
CheckError(__LINE__);
|
||||
@@ -252,12 +252,12 @@ static void
|
||||
CleanUp(void)
|
||||
{
|
||||
#if DEPTH
|
||||
glDeleteRenderbuffersEXT(1, &DepthRB);
|
||||
glDeleteRenderbuffers_func(1, &DepthRB);
|
||||
#endif
|
||||
#if STENCIL
|
||||
glDeleteRenderbuffersEXT(1, &StencilRB);
|
||||
glDeleteRenderbuffers_func(1, &StencilRB);
|
||||
#endif
|
||||
glDeleteFramebuffersEXT(1, &MyFB);
|
||||
glDeleteFramebuffers_func(1, &MyFB);
|
||||
|
||||
glDeleteTextures(1, &TexObj);
|
||||
|
||||
@@ -318,14 +318,14 @@ AttachDepthAndStencilBuffers(GLuint fbo,
|
||||
|
||||
*depthRbOut = *stencilRbOut = 0;
|
||||
|
||||
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fbo);
|
||||
glBindFramebuffer_func(GL_FRAMEBUFFER_EXT, fbo);
|
||||
|
||||
if (tryDepthStencil) {
|
||||
GLuint rb;
|
||||
|
||||
glGenRenderbuffersEXT(1, &rb);
|
||||
glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, rb);
|
||||
glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT,
|
||||
glGenRenderbuffers_func(1, &rb);
|
||||
glBindRenderbuffer_func(GL_RENDERBUFFER_EXT, rb);
|
||||
glRenderbufferStorage_func(GL_RENDERBUFFER_EXT,
|
||||
GL_DEPTH24_STENCIL8_EXT,
|
||||
width, height);
|
||||
if (glGetError())
|
||||
@@ -333,7 +333,7 @@ AttachDepthAndStencilBuffers(GLuint fbo,
|
||||
|
||||
if (bindDepthStencil) {
|
||||
/* attach to both depth and stencil at once */
|
||||
glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT,
|
||||
glFramebufferRenderbuffer_func(GL_FRAMEBUFFER_EXT,
|
||||
GL_DEPTH_STENCIL_ATTACHMENT,
|
||||
GL_RENDERBUFFER_EXT, rb);
|
||||
if (glGetError())
|
||||
@@ -341,21 +341,21 @@ AttachDepthAndStencilBuffers(GLuint fbo,
|
||||
}
|
||||
else {
|
||||
/* attach to depth attachment point */
|
||||
glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT,
|
||||
glFramebufferRenderbuffer_func(GL_FRAMEBUFFER_EXT,
|
||||
GL_DEPTH_ATTACHMENT_EXT,
|
||||
GL_RENDERBUFFER_EXT, rb);
|
||||
if (glGetError())
|
||||
return GL_FALSE;
|
||||
|
||||
/* and attach to stencil attachment point */
|
||||
glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT,
|
||||
glFramebufferRenderbuffer_func(GL_FRAMEBUFFER_EXT,
|
||||
GL_STENCIL_ATTACHMENT_EXT,
|
||||
GL_RENDERBUFFER_EXT, rb);
|
||||
if (glGetError())
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
||||
status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT);
|
||||
status = glCheckFramebufferStatus_func(GL_FRAMEBUFFER_EXT);
|
||||
if (status != GL_FRAMEBUFFER_COMPLETE_EXT)
|
||||
return GL_FALSE;
|
||||
|
||||
@@ -367,22 +367,22 @@ AttachDepthAndStencilBuffers(GLuint fbo,
|
||||
{
|
||||
GLuint rb;
|
||||
|
||||
glGenRenderbuffersEXT(1, &rb);
|
||||
glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, rb);
|
||||
glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT,
|
||||
glGenRenderbuffers_func(1, &rb);
|
||||
glBindRenderbuffer_func(GL_RENDERBUFFER_EXT, rb);
|
||||
glRenderbufferStorage_func(GL_RENDERBUFFER_EXT,
|
||||
GL_DEPTH_COMPONENT,
|
||||
width, height);
|
||||
if (glGetError())
|
||||
return GL_FALSE;
|
||||
|
||||
/* attach to depth attachment point */
|
||||
glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT,
|
||||
glFramebufferRenderbuffer_func(GL_FRAMEBUFFER_EXT,
|
||||
GL_DEPTH_ATTACHMENT_EXT,
|
||||
GL_RENDERBUFFER_EXT, rb);
|
||||
if (glGetError())
|
||||
return GL_FALSE;
|
||||
|
||||
status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT);
|
||||
status = glCheckFramebufferStatus_func(GL_FRAMEBUFFER_EXT);
|
||||
if (status != GL_FRAMEBUFFER_COMPLETE_EXT)
|
||||
return GL_FALSE;
|
||||
|
||||
@@ -393,26 +393,26 @@ AttachDepthAndStencilBuffers(GLuint fbo,
|
||||
{
|
||||
GLuint rb;
|
||||
|
||||
glGenRenderbuffersEXT(1, &rb);
|
||||
glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, rb);
|
||||
glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT,
|
||||
glGenRenderbuffers_func(1, &rb);
|
||||
glBindRenderbuffer_func(GL_RENDERBUFFER_EXT, rb);
|
||||
glRenderbufferStorage_func(GL_RENDERBUFFER_EXT,
|
||||
GL_STENCIL_INDEX,
|
||||
width, height);
|
||||
if (glGetError())
|
||||
return GL_FALSE;
|
||||
|
||||
/* attach to depth attachment point */
|
||||
glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT,
|
||||
glFramebufferRenderbuffer_func(GL_FRAMEBUFFER_EXT,
|
||||
GL_STENCIL_ATTACHMENT_EXT,
|
||||
GL_RENDERBUFFER_EXT, rb);
|
||||
if (glGetError())
|
||||
return GL_FALSE;
|
||||
|
||||
status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT);
|
||||
status = glCheckFramebufferStatus_func(GL_FRAMEBUFFER_EXT);
|
||||
if (status != GL_FRAMEBUFFER_COMPLETE_EXT) {
|
||||
glDeleteRenderbuffersEXT(1, depthRbOut);
|
||||
glDeleteRenderbuffers_func(1, depthRbOut);
|
||||
*depthRbOut = 0;
|
||||
glDeleteRenderbuffersEXT(1, &rb);
|
||||
glDeleteRenderbuffers_func(1, &rb);
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
||||
@@ -463,6 +463,37 @@ ParseArgs(int argc, char *argv[])
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
SetupFunctionPointers(void)
|
||||
{
|
||||
GetExtensionFuncs();
|
||||
|
||||
if (Use_ARB_fbo) {
|
||||
/* no-op: use the ARB functions as-is */
|
||||
}
|
||||
else {
|
||||
/* set the ARB-flavor function pointers to point to the EXT functions */
|
||||
glIsRenderbuffer_func = glIsRenderbufferEXT_func;
|
||||
glBindRenderbuffer_func = glBindRenderbufferEXT_func;
|
||||
glDeleteRenderbuffers_func = glDeleteRenderbuffersEXT_func;
|
||||
glGenRenderbuffers_func = glGenRenderbuffersEXT_func;
|
||||
glRenderbufferStorage_func = glRenderbufferStorageEXT_func;
|
||||
glGetRenderbufferParameteriv_func = glGetRenderbufferParameterivEXT_func;
|
||||
glIsFramebuffer_func = glIsFramebufferEXT_func;
|
||||
glBindFramebuffer_func = glBindFramebufferEXT_func;
|
||||
glDeleteFramebuffers_func = glDeleteFramebuffersEXT_func;
|
||||
glGenFramebuffers_func = glGenFramebuffersEXT_func;
|
||||
glCheckFramebufferStatus_func = glCheckFramebufferStatusEXT_func;
|
||||
glFramebufferTexture1D_func = glFramebufferTexture1DEXT_func;
|
||||
glFramebufferTexture2D_func = glFramebufferTexture2DEXT_func;
|
||||
glFramebufferTexture3D_func = glFramebufferTexture3DEXT_func;
|
||||
glFramebufferRenderbuffer_func = glFramebufferRenderbufferEXT_func;
|
||||
glGetFramebufferAttachmentParameteriv_func = glGetFramebufferAttachmentParameterivEXT_func;
|
||||
glGenerateMipmap_func = glGenerateMipmapEXT_func;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Make FBO to render into given texture.
|
||||
*/
|
||||
@@ -472,10 +503,10 @@ MakeFBO_RenderTexture(GLuint TexObj)
|
||||
GLuint fb;
|
||||
GLint sizeFudge = 0;
|
||||
|
||||
glGenFramebuffersEXT(1, &fb);
|
||||
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fb);
|
||||
glGenFramebuffers_func(1, &fb);
|
||||
glBindFramebuffer_func(GL_FRAMEBUFFER_EXT, fb);
|
||||
/* Render color to texture */
|
||||
glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT,
|
||||
glFramebufferTexture2D_func(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT,
|
||||
TexTarget, TexObj, TextureLevel);
|
||||
|
||||
if (Use_ARB_fbo) {
|
||||
@@ -512,26 +543,26 @@ MakeFBO_RenderTexture(GLuint TexObj)
|
||||
{
|
||||
GLint bits, w, h;
|
||||
|
||||
glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, DepthRB);
|
||||
glGetRenderbufferParameterivEXT(GL_RENDERBUFFER_EXT,
|
||||
glBindRenderbuffer_func(GL_RENDERBUFFER_EXT, DepthRB);
|
||||
glGetRenderbufferParameteriv_func(GL_RENDERBUFFER_EXT,
|
||||
GL_RENDERBUFFER_WIDTH_EXT, &w);
|
||||
glGetRenderbufferParameterivEXT(GL_RENDERBUFFER_EXT,
|
||||
glGetRenderbufferParameteriv_func(GL_RENDERBUFFER_EXT,
|
||||
GL_RENDERBUFFER_HEIGHT_EXT, &h);
|
||||
printf("Color/Texture size: %d x %d\n", TexWidth, TexHeight);
|
||||
printf("Depth buffer size: %d x %d\n", w, h);
|
||||
|
||||
glGetRenderbufferParameterivEXT(GL_RENDERBUFFER_EXT,
|
||||
glGetRenderbufferParameteriv_func(GL_RENDERBUFFER_EXT,
|
||||
GL_RENDERBUFFER_DEPTH_SIZE_EXT, &bits);
|
||||
printf("Depth renderbuffer size = %d bits\n", bits);
|
||||
|
||||
glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, StencilRB);
|
||||
glGetRenderbufferParameterivEXT(GL_RENDERBUFFER_EXT,
|
||||
glBindRenderbuffer_func(GL_RENDERBUFFER_EXT, StencilRB);
|
||||
glGetRenderbufferParameteriv_func(GL_RENDERBUFFER_EXT,
|
||||
GL_RENDERBUFFER_STENCIL_SIZE_EXT, &bits);
|
||||
printf("Stencil renderbuffer size = %d bits\n", bits);
|
||||
}
|
||||
|
||||
/* bind the regular framebuffer */
|
||||
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
|
||||
glBindFramebuffer_func(GL_FRAMEBUFFER_EXT, 0);
|
||||
|
||||
return fb;
|
||||
}
|
||||
@@ -547,6 +578,8 @@ Init(void)
|
||||
|
||||
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
|
||||
|
||||
SetupFunctionPointers();
|
||||
|
||||
/* lighting */
|
||||
{
|
||||
static const GLfloat mat[4] = { 1.0, 0.5, 0.5, 1.0 };
|
||||
@@ -605,7 +638,6 @@ main(int argc, char *argv[])
|
||||
glutInitWindowSize(Width, Height);
|
||||
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE);
|
||||
Win = glutCreateWindow(argv[0]);
|
||||
glewInit();
|
||||
glutReshapeFunc(Reshape);
|
||||
glutKeyboardFunc(Key);
|
||||
glutDisplayFunc(Display);
|
||||
|
@@ -583,10 +583,14 @@ ParseOptions(int argc, char *argv[])
|
||||
int i;
|
||||
for (i = 1; i < argc; i++) {
|
||||
if (strcmp(argv[i], "-fs") == 0) {
|
||||
FragProgFile = argv[i+1];
|
||||
FragProgFile = argv[++i];
|
||||
}
|
||||
else if (strcmp(argv[i], "-vs") == 0) {
|
||||
VertProgFile = argv[i+1];
|
||||
VertProgFile = argv[++i];
|
||||
}
|
||||
else {
|
||||
fprintf(stderr, "unknown option %s\n", argv[i]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -11,7 +11,20 @@ env.Prepend(CPPPATH = [
|
||||
|
||||
env.Prepend(LIBS = ['$GLUT_LIB'])
|
||||
|
||||
env.Program(
|
||||
target = 'fp-tri',
|
||||
source = ['fp-tri.c'],
|
||||
progs = [
|
||||
'fp-tri',
|
||||
'tri-depth',
|
||||
'tri-depth2',
|
||||
'tri-depthwrite',
|
||||
'tri-depthwrite2',
|
||||
'tri-inv',
|
||||
'tri-param',
|
||||
'tri-tex',
|
||||
'point-position',
|
||||
]
|
||||
|
||||
for prog in progs:
|
||||
env.Program(
|
||||
target = prog,
|
||||
source = [prog + '.c'],
|
||||
)
|
||||
|
@@ -89,7 +89,7 @@ static void Init( void )
|
||||
}
|
||||
fprintf(stderr, "%.*s\n", sz, buf);
|
||||
|
||||
if (!glutExtensionSupported("GL_ARB_fragment_program")) {
|
||||
if (!GLEW_ARB_fragment_program) {
|
||||
printf("Error: GL_ARB_fragment_program not supported!\n");
|
||||
exit(1);
|
||||
}
|
||||
|
@@ -2,9 +2,8 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#define GL_GLEXT_PROTOTYPES
|
||||
#include <GL/glew.h>
|
||||
#include <GL/glut.h>
|
||||
#include "GL/gl.h"
|
||||
|
||||
|
||||
|
||||
@@ -17,7 +16,7 @@ static void Init( void )
|
||||
;
|
||||
GLuint modulateProg;
|
||||
|
||||
if (!glutExtensionSupported("GL_ARB_fragment_program")) {
|
||||
if (!GLEW_ARB_fragment_program) {
|
||||
printf("Error: GL_ARB_fragment_program not supported!\n");
|
||||
exit(1);
|
||||
}
|
||||
@@ -109,6 +108,8 @@ int main(int argc, char **argv)
|
||||
exit(1);
|
||||
}
|
||||
|
||||
glewInit();
|
||||
|
||||
Init();
|
||||
|
||||
glutReshapeFunc(Reshape);
|
||||
|
@@ -2,9 +2,8 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#define GL_GLEXT_PROTOTYPES
|
||||
#include <GL/glew.h>
|
||||
#include <GL/glut.h>
|
||||
#include "GL/gl.h"
|
||||
|
||||
|
||||
|
||||
@@ -19,7 +18,7 @@ static void Init( void )
|
||||
;
|
||||
GLuint modulateProg;
|
||||
|
||||
if (!glutExtensionSupported("GL_ARB_fragment_program")) {
|
||||
if (!GLEW_ARB_fragment_program) {
|
||||
printf("Error: GL_ARB_fragment_program not supported!\n");
|
||||
exit(1);
|
||||
}
|
||||
@@ -89,8 +88,6 @@ int main(int argc, char **argv)
|
||||
|
||||
glutInit(&argc, argv);
|
||||
|
||||
|
||||
|
||||
glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);
|
||||
|
||||
type = GLUT_RGB;
|
||||
@@ -101,6 +98,8 @@ int main(int argc, char **argv)
|
||||
exit(1);
|
||||
}
|
||||
|
||||
glewInit();
|
||||
|
||||
Init();
|
||||
|
||||
glutReshapeFunc(Reshape);
|
||||
|
@@ -2,9 +2,8 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#define GL_GLEXT_PROTOTYPES
|
||||
#include <GL/glew.h>
|
||||
#include <GL/glut.h>
|
||||
#include "GL/gl.h"
|
||||
|
||||
|
||||
|
||||
@@ -21,7 +20,7 @@ static void Init( void )
|
||||
;
|
||||
GLuint modulateProg;
|
||||
|
||||
if (!glutExtensionSupported("GL_ARB_fragment_program")) {
|
||||
if (!GLEW_ARB_fragment_program) {
|
||||
printf("Error: GL_ARB_fragment_program not supported!\n");
|
||||
exit(1);
|
||||
}
|
||||
@@ -106,6 +105,8 @@ int main(int argc, char **argv)
|
||||
exit(1);
|
||||
}
|
||||
|
||||
glewInit();
|
||||
|
||||
Init();
|
||||
|
||||
glutReshapeFunc(Reshape);
|
||||
|
@@ -2,7 +2,7 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#define GL_GLEXT_PROTOTYPES
|
||||
#include <GL/glew.h>
|
||||
#include <GL/glut.h>
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ static void Init(void)
|
||||
;
|
||||
GLuint modulateProg;
|
||||
|
||||
if (!glutExtensionSupported("GL_ARB_fragment_program")) {
|
||||
if (!GLEW_ARB_fragment_program) {
|
||||
printf("Error: GL_ARB_fragment_program not supported!\n");
|
||||
exit(1);
|
||||
}
|
||||
@@ -97,6 +97,8 @@ int main(int argc, char **argv)
|
||||
exit(1);
|
||||
}
|
||||
|
||||
glewInit();
|
||||
|
||||
Init();
|
||||
|
||||
glutReshapeFunc(Reshape);
|
||||
|
@@ -2,7 +2,7 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#define GL_GLEXT_PROTOTYPES
|
||||
#include <GL/glew.h>
|
||||
#include <GL/glut.h>
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ static void Init(void)
|
||||
;
|
||||
GLuint modulateProg;
|
||||
|
||||
if (!glutExtensionSupported("GL_ARB_fragment_program")) {
|
||||
if (!GLEW_ARB_fragment_program) {
|
||||
printf("Error: GL_ARB_fragment_program not supported!\n");
|
||||
exit(1);
|
||||
}
|
||||
@@ -97,6 +97,8 @@ int main(int argc, char **argv)
|
||||
exit(1);
|
||||
}
|
||||
|
||||
glewInit();
|
||||
|
||||
Init();
|
||||
|
||||
glutReshapeFunc(Reshape);
|
||||
|
@@ -2,7 +2,7 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#define GL_GLEXT_PROTOTYPES
|
||||
#include <GL/glew.h>
|
||||
#include <GL/glut.h>
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ static void Init( void )
|
||||
;
|
||||
GLuint modulateProg;
|
||||
|
||||
if (!glutExtensionSupported("GL_ARB_fragment_program")) {
|
||||
if (!GLEW_ARB_fragment_program) {
|
||||
printf("Error: GL_ARB_fragment_program not supported!\n");
|
||||
exit(1);
|
||||
}
|
||||
@@ -99,6 +99,8 @@ int main(int argc, char **argv)
|
||||
exit(1);
|
||||
}
|
||||
|
||||
glewInit();
|
||||
|
||||
Init();
|
||||
|
||||
glutReshapeFunc(Reshape);
|
||||
|
@@ -2,9 +2,9 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#define GL_GLEXT_PROTOTYPES
|
||||
#include <GL/glew.h>
|
||||
#include <GL/glut.h>
|
||||
#include "GL/gl.h"
|
||||
|
||||
|
||||
static void Init( void )
|
||||
{
|
||||
@@ -15,7 +15,7 @@ static void Init( void )
|
||||
;
|
||||
GLuint modulateProg;
|
||||
|
||||
if (!glutExtensionSupported("GL_ARB_fragment_program")) {
|
||||
if (!GLEW_ARB_fragment_program) {
|
||||
printf("Error: GL_ARB_fragment_program not supported!\n");
|
||||
exit(1);
|
||||
}
|
||||
@@ -104,6 +104,8 @@ int main(int argc, char **argv)
|
||||
exit(1);
|
||||
}
|
||||
|
||||
glewInit();
|
||||
|
||||
Init();
|
||||
|
||||
glutReshapeFunc(Reshape);
|
||||
|
@@ -3,7 +3,7 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#define GL_GLEXT_PROTOTYPES
|
||||
#include <GL/glew.h>
|
||||
#include <GL/glut.h>
|
||||
|
||||
#include "readtex.c"
|
||||
@@ -23,7 +23,7 @@ static void Init( void )
|
||||
GLuint modulateProg;
|
||||
GLuint Texture;
|
||||
|
||||
if (!glutExtensionSupported("GL_ARB_fragment_program")) {
|
||||
if (!GLEW_ARB_fragment_program) {
|
||||
printf("Error: GL_ARB_fragment_program not supported!\n");
|
||||
exit(1);
|
||||
}
|
||||
@@ -120,6 +120,8 @@ int main(int argc, char **argv)
|
||||
exit(1);
|
||||
}
|
||||
|
||||
glewInit();
|
||||
|
||||
Init();
|
||||
|
||||
glutReshapeFunc(Reshape);
|
||||
|
@@ -80,25 +80,26 @@ clean:
|
||||
-rm -f *.o *~
|
||||
-rm -f extfuncs.h
|
||||
-rm -f shaderutil.*
|
||||
-rm -f readtex.*
|
||||
|
||||
|
||||
|
||||
##### Extra dependencies
|
||||
|
||||
extfuncs.h:
|
||||
cp $(TOP)/progs/util/extfuncs.h .
|
||||
extfuncs.h: $(TOP)/progs/util/extfuncs.h
|
||||
cp $< .
|
||||
|
||||
readtex.c:
|
||||
cp $(TOP)/progs/util/readtex.c .
|
||||
readtex.c: $(TOP)/progs/util/readtex.c
|
||||
cp $< .
|
||||
|
||||
readtex.h:
|
||||
cp $(TOP)/progs/util/readtex.h .
|
||||
readtex.h: $(TOP)/progs/util/readtex.h
|
||||
cp $< .
|
||||
|
||||
shaderutil.c:
|
||||
cp $(TOP)/progs/util/shaderutil.c .
|
||||
shaderutil.c: $(TOP)/progs/util/shaderutil.c
|
||||
cp $< .
|
||||
|
||||
shaderutil.h:
|
||||
cp $(TOP)/progs/util/shaderutil.h .
|
||||
shaderutil.h: $(TOP)/progs/util/shaderutil.h
|
||||
cp $< .
|
||||
|
||||
|
||||
|
||||
|
@@ -271,9 +271,24 @@ CreateProgram(const char *vertProgFile, const char *fragProgFile,
|
||||
|
||||
InitUniforms(program, uniforms);
|
||||
|
||||
VertCoord_attr = glGetAttribLocation_func(program, "VertCoord");
|
||||
if (VertCoord_attr > 0) {
|
||||
/* We want the VertCoord attrib to have position zero so that
|
||||
* the call to glVertexAttrib(0, xyz) triggers vertex processing.
|
||||
* Otherwise, if TexCoord0 or TexCoord1 gets position 0 we'd have
|
||||
* to set that attribute last (which is a PITA to manage).
|
||||
*/
|
||||
glBindAttribLocation_func(program, 0, "VertCoord");
|
||||
/* re-link */
|
||||
glLinkProgram_func(program);
|
||||
/* VertCoord_attr should be zero now */
|
||||
VertCoord_attr = glGetAttribLocation_func(program, "VertCoord");
|
||||
assert(VertCoord_attr == 0);
|
||||
}
|
||||
|
||||
TexCoord0_attr = glGetAttribLocation_func(program, "TexCoord0");
|
||||
TexCoord1_attr = glGetAttribLocation_func(program, "TexCoord1");
|
||||
VertCoord_attr = glGetAttribLocation_func(program, "VertCoord");
|
||||
|
||||
printf("TexCoord0_attr = %d\n", TexCoord0_attr);
|
||||
printf("TexCoord1_attr = %d\n", TexCoord1_attr);
|
||||
printf("VertCoord_attr = %d\n", VertCoord_attr);
|
||||
|
2
progs/tests/.gitignore
vendored
2
progs/tests/.gitignore
vendored
@@ -62,6 +62,8 @@ readrate
|
||||
readtex.c
|
||||
readtex.h
|
||||
rubberband
|
||||
scissor
|
||||
scissor-viewport
|
||||
seccolor
|
||||
shader_api
|
||||
shaderutil.c
|
||||
|
@@ -70,6 +70,8 @@ SOURCES = \
|
||||
random.c \
|
||||
readrate.c \
|
||||
rubberband.c \
|
||||
scissor.c \
|
||||
scissor-viewport.c \
|
||||
seccolor.c \
|
||||
shader_api.c \
|
||||
sharedtex.c \
|
||||
|
@@ -95,6 +95,8 @@ progs = [
|
||||
'random',
|
||||
'readrate',
|
||||
'rubberband',
|
||||
'scissor',
|
||||
'scissor-viewport',
|
||||
'seccolor',
|
||||
'shader_api',
|
||||
'stencil_twoside',
|
||||
|
138
progs/tests/scissor-viewport.c
Normal file
138
progs/tests/scissor-viewport.c
Normal file
@@ -0,0 +1,138 @@
|
||||
/*
|
||||
* Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc.
|
||||
* Copyright (c) 2009 VMware, 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>
|
||||
|
||||
struct program
|
||||
{
|
||||
unsigned width;
|
||||
unsigned height;
|
||||
int i;
|
||||
};
|
||||
|
||||
struct program prog;
|
||||
|
||||
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);
|
||||
|
||||
prog.i = 0;
|
||||
}
|
||||
|
||||
static void reshape(int width, int height)
|
||||
{
|
||||
glViewport(0, 0, 100, 100);
|
||||
|
||||
prog.width = width;
|
||||
prog.height = 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:
|
||||
glutPostRedisplay();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
static void drawQuad(void)
|
||||
{
|
||||
glBegin(GL_QUADS);
|
||||
glVertex2d(-1.0, -1.0);
|
||||
glVertex2d( 1.0, -1.0);
|
||||
glVertex2d( 1.0, 1.0);
|
||||
glVertex2d(-1.0, 1.0);
|
||||
glEnd();
|
||||
}
|
||||
|
||||
static void draw(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
glClearColor(0.0, 0.0, 1.0, 0.0);
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
|
||||
i = prog.i++;
|
||||
if (prog.i >= 3)
|
||||
prog.i = 0;
|
||||
|
||||
glEnable(GL_SCISSOR_TEST);
|
||||
|
||||
{
|
||||
glColor4d(1.0, 0.0, 0.0, 1.0);
|
||||
|
||||
glScissor(i, i, 10 - 2*i, 10 - 2*i);
|
||||
drawQuad();
|
||||
}
|
||||
|
||||
glDisable(GL_SCISSOR_TEST);
|
||||
|
||||
//glutSwapBuffers();
|
||||
glFlush();
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
GLenum type;
|
||||
|
||||
glutInit(&argc, argv);
|
||||
|
||||
prog.width = 200;
|
||||
prog.height = 200;
|
||||
|
||||
glutInitWindowPosition(100, 0);
|
||||
glutInitWindowSize(prog.width, prog.height);
|
||||
|
||||
//type = GLUT_RGB | GLUT_DOUBLE;
|
||||
type = GLUT_RGB | GLUT_SINGLE;
|
||||
glutInitDisplayMode(type);
|
||||
|
||||
if (glutCreateWindow(*argv) == GL_FALSE) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
init();
|
||||
|
||||
glutReshapeFunc(reshape);
|
||||
glutKeyboardFunc(key);
|
||||
glutDisplayFunc(draw);
|
||||
glutMainLoop();
|
||||
return 0;
|
||||
}
|
168
progs/tests/scissor.c
Normal file
168
progs/tests/scissor.c
Normal file
@@ -0,0 +1,168 @@
|
||||
/*
|
||||
* Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc.
|
||||
* Copyright (c) 2009 VMware, 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>
|
||||
|
||||
struct program
|
||||
{
|
||||
unsigned width;
|
||||
unsigned height;
|
||||
unsigned quads;
|
||||
};
|
||||
|
||||
struct program prog;
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
static void reshape(int width, int height)
|
||||
{
|
||||
|
||||
glViewport(0, 0, (GLint)width, (GLint)height);
|
||||
|
||||
prog.width = width;
|
||||
prog.height = 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:
|
||||
prog.quads = !prog.quads;
|
||||
glutPostRedisplay();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
static void drawQuad(void)
|
||||
{
|
||||
|
||||
if (prog.quads) {
|
||||
glBegin(GL_QUADS);
|
||||
glVertex2d(-1.0, -1.0);
|
||||
glVertex2d( 1.0, -1.0);
|
||||
glVertex2d( 1.0, 1.0);
|
||||
glVertex2d(-1.0, 1.0);
|
||||
glEnd();
|
||||
} else {
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
}
|
||||
}
|
||||
|
||||
static void draw(void)
|
||||
{
|
||||
glClearColor(0.0, 0.0, 1.0, 0.0);
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
|
||||
printf("drawing with %s\n", prog.quads ? "quads" : "clears");
|
||||
|
||||
glEnable(GL_SCISSOR_TEST);
|
||||
|
||||
{
|
||||
glClearColor(1.0, 0.0, 0.0, 1.0);
|
||||
glColor4d(1.0, 0.0, 0.0, 1.0);
|
||||
|
||||
glScissor(1, 1, 10, 10);
|
||||
drawQuad();
|
||||
glScissor(1, prog.height - 11, 10, 10);
|
||||
drawQuad();
|
||||
glScissor(prog.width - 11, prog.height - 11, 10, 10);
|
||||
drawQuad();
|
||||
}
|
||||
|
||||
{
|
||||
glClearColor(0.0, 1.0, 0.0, 1.0);
|
||||
glColor4d(0.0, 1.0, 0.0, 1.0);
|
||||
|
||||
glScissor(12, 1, 10, 10);
|
||||
drawQuad();
|
||||
glScissor(12, prog.height - 11, 10, 10);
|
||||
drawQuad();
|
||||
glScissor(prog.width - 22, prog.height - 11, 10, 10);
|
||||
drawQuad();
|
||||
}
|
||||
|
||||
{
|
||||
glClearColor(1.0, 1.0, 0.0, 1.0);
|
||||
glColor4d(1.0, 1.0, 0.0, 1.0);
|
||||
|
||||
glScissor(1, 12, 10, 10);
|
||||
drawQuad();
|
||||
glScissor(1, prog.height - 22, 10, 10);
|
||||
drawQuad();
|
||||
glScissor(prog.width - 11, prog.height - 22, 10, 10);
|
||||
drawQuad();
|
||||
}
|
||||
|
||||
glDisable(GL_SCISSOR_TEST);
|
||||
|
||||
//glutSwapBuffers();
|
||||
glFlush();
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
GLenum type;
|
||||
|
||||
glutInit(&argc, argv);
|
||||
|
||||
prog.width = 200;
|
||||
prog.height = 200;
|
||||
|
||||
glutInitWindowPosition(100, 0);
|
||||
glutInitWindowSize(prog.width, prog.height);
|
||||
|
||||
//type = GLUT_RGB | GLUT_DOUBLE;
|
||||
type = GLUT_RGB | GLUT_SINGLE;
|
||||
glutInitDisplayMode(type);
|
||||
|
||||
if (glutCreateWindow(*argv) == GL_FALSE) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
init();
|
||||
|
||||
glutReshapeFunc(reshape);
|
||||
glutKeyboardFunc(key);
|
||||
glutDisplayFunc(draw);
|
||||
glutMainLoop();
|
||||
return 0;
|
||||
}
|
@@ -21,7 +21,7 @@ static void Display(void)
|
||||
GLfloat min, max;
|
||||
int i;
|
||||
|
||||
glClearColor(0.5, 0.5, 0.5, 0);
|
||||
glClearColor(0.5, 0.5, 0.5, 1.0);
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
/* draw a sphere */
|
||||
@@ -82,7 +82,7 @@ static void Key(unsigned char key, int x, int y)
|
||||
|
||||
static void Init(void)
|
||||
{
|
||||
const GLfloat blue[4] = {.1, .1, 1.0, 0.0};
|
||||
const GLfloat blue[4] = {.1, .1, 1.0, 1.0};
|
||||
const GLfloat gray[4] = {0.2, 0.2, 0.2, 1.0};
|
||||
const GLfloat white[4] = {1.0, 1.0, 1.0, 1.0};
|
||||
const GLfloat pos[4] = {0, 0, 10, 0};
|
||||
|
@@ -57,13 +57,19 @@ static struct { GLenum func; const char *str; } funcs[] =
|
||||
|
||||
static int curFunc = 0;
|
||||
static double clearVal = 1.0;
|
||||
|
||||
static float minZ = 0.0;
|
||||
static float maxZ = 1.0;
|
||||
|
||||
static void usage(void)
|
||||
{
|
||||
printf("t - toggle rendering order of triangles\n");
|
||||
printf("c - toggle Z clear value between 0, 1\n");
|
||||
printf("f - cycle through depth test functions\n");
|
||||
printf("t - toggle rendering order of triangles\n");
|
||||
printf("c - toggle Z clear value between 0, 1\n");
|
||||
printf("f - cycle through depth test functions\n");
|
||||
printf("n/N - decrease/increase depthrange minZ\n");
|
||||
printf("x/X - decrease/increase depthrange maxZ\n");
|
||||
printf("spc - reset\n");
|
||||
printf("z - set to reverse-direction (ztrick) mode\n");
|
||||
fflush(stdout);
|
||||
}
|
||||
|
||||
|
||||
@@ -97,9 +103,11 @@ static void drawRightTriangle(void)
|
||||
|
||||
void display(void)
|
||||
{
|
||||
printf("GL_CLEAR_DEPTH = %f GL_DEPTH_FUNC = %s\n",
|
||||
clearVal, funcs[curFunc].str);
|
||||
printf("GL_CLEAR_DEPTH = %.2f, GL_DEPTH_FUNC = %s, DepthRange(%.1f, %.1f)\n",
|
||||
clearVal, funcs[curFunc].str, minZ, maxZ);
|
||||
fflush(stdout);
|
||||
glClearDepth(clearVal);
|
||||
glDepthRange(minZ, maxZ);
|
||||
glDepthFunc(funcs[curFunc].func);
|
||||
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
@@ -131,27 +139,49 @@ void reshape(int w, int h)
|
||||
void keyboard(unsigned char key, int x, int y)
|
||||
{
|
||||
switch (key) {
|
||||
case 'n':
|
||||
minZ -= .1;
|
||||
break;
|
||||
case 'N':
|
||||
minZ += .1;
|
||||
break;
|
||||
case 'x':
|
||||
maxZ -= .1;
|
||||
break;
|
||||
case 'X':
|
||||
maxZ += .1;
|
||||
break;
|
||||
case 'c':
|
||||
case 'C':
|
||||
clearVal = 1.0 - clearVal;
|
||||
glutPostRedisplay();
|
||||
break;
|
||||
case 'f':
|
||||
case 'F':
|
||||
curFunc = (curFunc + 1) % NUM_FUNCS;
|
||||
glutPostRedisplay();
|
||||
break;
|
||||
case 't':
|
||||
case 'T':
|
||||
leftFirst = !leftFirst;
|
||||
glutPostRedisplay();
|
||||
break;
|
||||
case ' ':
|
||||
curFunc = 0;
|
||||
clearVal = 1.0;
|
||||
minZ = 0.0;
|
||||
maxZ = 1.0;
|
||||
break;
|
||||
case 'z':
|
||||
curFunc = 2;
|
||||
clearVal = 0.0;
|
||||
minZ = 1.0;
|
||||
maxZ = 0.0;
|
||||
break;
|
||||
case 27: /* Escape key */
|
||||
exit(0);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
return;
|
||||
}
|
||||
glutPostRedisplay();
|
||||
}
|
||||
|
||||
/* Main Loop
|
||||
|
@@ -60,6 +60,7 @@ static void Key(unsigned char key, int x, int y)
|
||||
{
|
||||
switch (key) {
|
||||
case 27:
|
||||
glutDestroyWindow(win);
|
||||
exit(0);
|
||||
default:
|
||||
glutPostRedisplay();
|
||||
|
@@ -86,6 +86,57 @@ static PFNGLISVERTEXARRAYAPPLEPROC glIsVertexArrayAPPLE_func = NULL;
|
||||
/* GL_EXT_stencil_two_side */
|
||||
static PFNGLACTIVESTENCILFACEEXTPROC glActiveStencilFaceEXT_func = NULL;
|
||||
|
||||
/* GL_ARB_buffer_object */
|
||||
static PFNGLGENBUFFERSARBPROC glGenBuffersARB_func = NULL;
|
||||
static PFNGLDELETEBUFFERSARBPROC glDeleteBuffersARB_func = NULL;
|
||||
static PFNGLBINDBUFFERARBPROC glBindBufferARB_func = NULL;
|
||||
static PFNGLBUFFERDATAARBPROC glBufferDataARB_func = NULL;
|
||||
static PFNGLBUFFERSUBDATAARBPROC glBufferSubDataARB_func = NULL;
|
||||
static PFNGLMAPBUFFERARBPROC glMapBufferARB_func = NULL;
|
||||
static PFNGLUNMAPBUFFERARBPROC glUnmapBufferARB_func = NULL;
|
||||
|
||||
/* GL_EXT_framebuffer_object */
|
||||
static PFNGLISRENDERBUFFEREXTPROC glIsRenderbufferEXT_func = NULL;
|
||||
static PFNGLBINDRENDERBUFFEREXTPROC glBindRenderbufferEXT_func = NULL;
|
||||
static PFNGLDELETERENDERBUFFERSEXTPROC glDeleteRenderbuffersEXT_func = NULL;
|
||||
static PFNGLGENRENDERBUFFERSEXTPROC glGenRenderbuffersEXT_func = NULL;
|
||||
static PFNGLRENDERBUFFERSTORAGEEXTPROC glRenderbufferStorageEXT_func = NULL;
|
||||
static PFNGLGETRENDERBUFFERPARAMETERIVEXTPROC glGetRenderbufferParameterivEXT_func = NULL;
|
||||
static PFNGLISFRAMEBUFFEREXTPROC glIsFramebufferEXT_func = NULL;
|
||||
static PFNGLBINDFRAMEBUFFEREXTPROC glBindFramebufferEXT_func = NULL;
|
||||
static PFNGLDELETEFRAMEBUFFERSEXTPROC glDeleteFramebuffersEXT_func = NULL;
|
||||
static PFNGLGENFRAMEBUFFERSEXTPROC glGenFramebuffersEXT_func = NULL;
|
||||
static PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC glCheckFramebufferStatusEXT_func = NULL;
|
||||
static PFNGLFRAMEBUFFERTEXTURE1DEXTPROC glFramebufferTexture1DEXT_func = NULL;
|
||||
static PFNGLFRAMEBUFFERTEXTURE2DEXTPROC glFramebufferTexture2DEXT_func = NULL;
|
||||
static PFNGLFRAMEBUFFERTEXTURE3DEXTPROC glFramebufferTexture3DEXT_func = NULL;
|
||||
static PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC glFramebufferRenderbufferEXT_func = NULL;
|
||||
static PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC glGetFramebufferAttachmentParameterivEXT_func = NULL;
|
||||
static PFNGLGENERATEMIPMAPEXTPROC glGenerateMipmapEXT_func = NULL;
|
||||
|
||||
/* GL_ARB_framebuffer_object */
|
||||
static PFNGLISRENDERBUFFERPROC glIsRenderbuffer_func = NULL;
|
||||
static PFNGLBINDRENDERBUFFERPROC glBindRenderbuffer_func = NULL;
|
||||
static PFNGLDELETERENDERBUFFERSPROC glDeleteRenderbuffers_func = NULL;
|
||||
static PFNGLGENRENDERBUFFERSPROC glGenRenderbuffers_func = NULL;
|
||||
static PFNGLRENDERBUFFERSTORAGEPROC glRenderbufferStorage_func = NULL;
|
||||
static PFNGLGETRENDERBUFFERPARAMETERIVPROC glGetRenderbufferParameteriv_func = NULL;
|
||||
static PFNGLISFRAMEBUFFERPROC glIsFramebuffer_func = NULL;
|
||||
static PFNGLBINDFRAMEBUFFERPROC glBindFramebuffer_func = NULL;
|
||||
static PFNGLDELETEFRAMEBUFFERSPROC glDeleteFramebuffers_func = NULL;
|
||||
static PFNGLGENFRAMEBUFFERSPROC glGenFramebuffers_func = NULL;
|
||||
static PFNGLCHECKFRAMEBUFFERSTATUSPROC glCheckFramebufferStatus_func = NULL;
|
||||
static PFNGLFRAMEBUFFERTEXTURE1DPROC glFramebufferTexture1D_func = NULL;
|
||||
static PFNGLFRAMEBUFFERTEXTURE2DPROC glFramebufferTexture2D_func = NULL;
|
||||
static PFNGLFRAMEBUFFERTEXTURE3DPROC glFramebufferTexture3D_func = NULL;
|
||||
static PFNGLFRAMEBUFFERRENDERBUFFERPROC glFramebufferRenderbuffer_func = NULL;
|
||||
static PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC glGetFramebufferAttachmentParameteriv_func = NULL;
|
||||
static PFNGLGENERATEMIPMAPPROC glGenerateMipmap_func = NULL;
|
||||
static PFNGLBLITFRAMEBUFFERPROC glBlitFramebuffer_func = NULL;
|
||||
static PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC glRenderbufferStorageMultisample_func = NULL;
|
||||
static PFNGLFRAMEBUFFERTEXTURELAYERPROC glFramebufferTextureLayer_func = NULL;
|
||||
|
||||
|
||||
|
||||
static void
|
||||
GetExtensionFuncs(void)
|
||||
@@ -173,5 +224,55 @@ GetExtensionFuncs(void)
|
||||
|
||||
/* GL_EXT_stencil_two_side */
|
||||
glActiveStencilFaceEXT_func = (PFNGLACTIVESTENCILFACEEXTPROC) glutGetProcAddress("glActiveStencilFaceEXT");
|
||||
|
||||
/* GL_ARB_vertex_buffer_object */
|
||||
glGenBuffersARB_func = (PFNGLGENBUFFERSARBPROC) glutGetProcAddress("glGenBuffersARB");
|
||||
glDeleteBuffersARB_func = (PFNGLDELETEBUFFERSARBPROC) glutGetProcAddress("glDeleteBuffersARB");
|
||||
glBindBufferARB_func = (PFNGLBINDBUFFERARBPROC) glutGetProcAddress("glBindBufferARB");
|
||||
glBufferDataARB_func = (PFNGLBUFFERDATAARBPROC) glutGetProcAddress("glBufferDataARB");
|
||||
glBufferSubDataARB_func = (PFNGLBUFFERSUBDATAARBPROC) glutGetProcAddress("glBufferSubDataARB");
|
||||
glMapBufferARB_func = (PFNGLMAPBUFFERARBPROC) glutGetProcAddress("glMapBufferARB");
|
||||
glUnmapBufferARB_func = (PFNGLUNMAPBUFFERARBPROC) glutGetProcAddress("glUnmapBufferARB");
|
||||
|
||||
/* GL_EXT_framebuffer_object */
|
||||
glIsRenderbufferEXT_func = (PFNGLISRENDERBUFFEREXTPROC) glutGetProcAddress("glIsRenderbufferEXT");
|
||||
glBindRenderbufferEXT_func = (PFNGLBINDRENDERBUFFEREXTPROC) glutGetProcAddress("glBindRenderbufferEXT");
|
||||
glDeleteRenderbuffersEXT_func = (PFNGLDELETERENDERBUFFERSEXTPROC) glutGetProcAddress("glDeleteRenderbuffersEXT");
|
||||
glGenRenderbuffersEXT_func = (PFNGLGENRENDERBUFFERSEXTPROC) glutGetProcAddress("glGenRenderbuffersEXT");
|
||||
glRenderbufferStorageEXT_func = (PFNGLRENDERBUFFERSTORAGEEXTPROC) glutGetProcAddress("glRenderbufferStorageEXT");
|
||||
glGetRenderbufferParameterivEXT_func = (PFNGLGETRENDERBUFFERPARAMETERIVEXTPROC) glutGetProcAddress("glGetRenderbufferParameterivEXT");
|
||||
glIsFramebufferEXT_func = (PFNGLISFRAMEBUFFEREXTPROC) glutGetProcAddress("glIsFramebufferEXT");
|
||||
glBindFramebufferEXT_func = (PFNGLBINDFRAMEBUFFEREXTPROC) glutGetProcAddress("glBindFramebufferEXT");
|
||||
glDeleteFramebuffersEXT_func = (PFNGLDELETEFRAMEBUFFERSEXTPROC) glutGetProcAddress("glDeleteFramebuffersEXT");
|
||||
glGenFramebuffersEXT_func = (PFNGLGENFRAMEBUFFERSEXTPROC) glutGetProcAddress("glGenFramebuffersEXT");
|
||||
glCheckFramebufferStatusEXT_func = (PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC) glutGetProcAddress("glCheckFramebufferStatusEXT");
|
||||
glFramebufferTexture1DEXT_func = (PFNGLFRAMEBUFFERTEXTURE1DEXTPROC) glutGetProcAddress("glFramebufferTexture1DEXT");
|
||||
glFramebufferTexture2DEXT_func = (PFNGLFRAMEBUFFERTEXTURE2DEXTPROC) glutGetProcAddress("glFramebufferTexture2DEXT");
|
||||
glFramebufferTexture3DEXT_func = (PFNGLFRAMEBUFFERTEXTURE3DEXTPROC) glutGetProcAddress("glFramebufferTexture3DEXT");
|
||||
glFramebufferRenderbufferEXT_func = (PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC) glutGetProcAddress("glFramebufferRenderbufferEXT");
|
||||
glGetFramebufferAttachmentParameterivEXT_func = (PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC) glutGetProcAddress("glGetFramebufferAttachmentParameterivEXT");
|
||||
glGenerateMipmapEXT_func = (PFNGLGENERATEMIPMAPEXTPROC) glutGetProcAddress("glGenerateMipmapEXT");
|
||||
|
||||
/* GL_ARB_framebuffer_object */
|
||||
glIsRenderbuffer_func = (PFNGLISRENDERBUFFERPROC) glutGetProcAddress("glIsRenderbuffer");
|
||||
glBindRenderbuffer_func = (PFNGLBINDRENDERBUFFERPROC) glutGetProcAddress("glBindRenderbuffer");
|
||||
glDeleteRenderbuffers_func = (PFNGLDELETERENDERBUFFERSPROC) glutGetProcAddress("glDeleteRenderbuffers");
|
||||
glGenRenderbuffers_func = (PFNGLGENRENDERBUFFERSPROC) glutGetProcAddress("glGenRenderbuffers");
|
||||
glRenderbufferStorage_func = (PFNGLRENDERBUFFERSTORAGEPROC) glutGetProcAddress("glRenderbufferStorage");
|
||||
glGetRenderbufferParameteriv_func = (PFNGLGETRENDERBUFFERPARAMETERIVPROC) glutGetProcAddress("glGetRenderbufferParameteriv");
|
||||
glIsFramebuffer_func = (PFNGLISFRAMEBUFFERPROC) glutGetProcAddress("glIsFramebuffer");
|
||||
glBindFramebuffer_func = (PFNGLBINDFRAMEBUFFERPROC) glutGetProcAddress("glBindFramebuffer");
|
||||
glDeleteFramebuffers_func = (PFNGLDELETEFRAMEBUFFERSPROC) glutGetProcAddress("glDeleteFramebuffers");
|
||||
glGenFramebuffers_func = (PFNGLGENFRAMEBUFFERSPROC) glutGetProcAddress("glGenFramebuffers");
|
||||
glCheckFramebufferStatus_func = (PFNGLCHECKFRAMEBUFFERSTATUSPROC) glutGetProcAddress("glCheckFramebufferStatus");
|
||||
glFramebufferTexture1D_func = (PFNGLFRAMEBUFFERTEXTURE1DPROC) glutGetProcAddress("glFramebufferTexture1D");
|
||||
glFramebufferTexture2D_func = (PFNGLFRAMEBUFFERTEXTURE2DPROC) glutGetProcAddress("glFramebufferTexture2D");
|
||||
glFramebufferTexture3D_func = (PFNGLFRAMEBUFFERTEXTURE3DPROC) glutGetProcAddress("glFramebufferTexture3D");
|
||||
glFramebufferRenderbuffer_func = (PFNGLFRAMEBUFFERRENDERBUFFERPROC) glutGetProcAddress("glFramebufferRenderbuffer");
|
||||
glGetFramebufferAttachmentParameteriv_func = (PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC) glutGetProcAddress("glGetFramebufferAttachmentParameteriv");
|
||||
glGenerateMipmap_func = (PFNGLGENERATEMIPMAPPROC) glutGetProcAddress("glGenerateMipmap");
|
||||
glBlitFramebuffer_func = (PFNGLBLITFRAMEBUFFERPROC) glutGetProcAddress("glBlitFramebuffer");
|
||||
glRenderbufferStorageMultisample_func = (PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC) glutGetProcAddress("glRenderbufferStorageMultisample");
|
||||
glFramebufferTextureLayer_func = (PFNGLFRAMEBUFFERTEXTURELAYERPROC) glutGetProcAddress("glFramebufferTextureLayer");
|
||||
}
|
||||
|
||||
|
6
progs/vpglsl/psiz-imm.glsl
Normal file
6
progs/vpglsl/psiz-imm.glsl
Normal file
@@ -0,0 +1,6 @@
|
||||
|
||||
void main() {
|
||||
gl_FrontColor = gl_Color;
|
||||
gl_PointSize = 2.0;
|
||||
gl_Position = gl_Vertex;
|
||||
}
|
6
progs/vpglsl/psiz-mul.glsl
Normal file
6
progs/vpglsl/psiz-mul.glsl
Normal file
@@ -0,0 +1,6 @@
|
||||
|
||||
void main() {
|
||||
gl_FrontColor = gl_Color;
|
||||
gl_PointSize = 10 * gl_Color.x;
|
||||
gl_Position = gl_Vertex;
|
||||
}
|
@@ -10,6 +10,10 @@
|
||||
|
||||
static const char *filename = NULL;
|
||||
static GLuint nr_steps = 4;
|
||||
static GLuint prim = GL_TRIANGLES;
|
||||
static GLfloat psz = 1.0;
|
||||
static GLboolean pointsmooth = 0;
|
||||
static GLboolean program_point_size = 0;
|
||||
|
||||
static GLuint fragShader;
|
||||
static GLuint vertShader;
|
||||
@@ -229,6 +233,14 @@ static void subdiv( union vert *v0,
|
||||
}
|
||||
}
|
||||
|
||||
static void enable( GLenum value, GLboolean flag )
|
||||
{
|
||||
if (flag)
|
||||
glEnable(value);
|
||||
else
|
||||
glDisable(value);
|
||||
}
|
||||
|
||||
/** Assignment */
|
||||
#define ASSIGN_3V( V, V0, V1, V2 ) \
|
||||
do { \
|
||||
@@ -241,10 +253,13 @@ static void Display( void )
|
||||
{
|
||||
glClearColor(0.3, 0.3, 0.3, 1);
|
||||
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
|
||||
glPointSize(psz);
|
||||
|
||||
glUseProgram(program);
|
||||
enable( GL_POINT_SMOOTH, pointsmooth );
|
||||
enable( GL_VERTEX_PROGRAM_POINT_SIZE_ARB, program_point_size );
|
||||
|
||||
glBegin(GL_TRIANGLES);
|
||||
glBegin(prim);
|
||||
|
||||
|
||||
{
|
||||
@@ -291,10 +306,41 @@ static void Key( unsigned char key, int x, int y )
|
||||
(void) x;
|
||||
(void) y;
|
||||
switch (key) {
|
||||
case 27:
|
||||
CleanUp();
|
||||
exit(0);
|
||||
break;
|
||||
case 'p':
|
||||
prim = GL_POINTS;
|
||||
break;
|
||||
case 't':
|
||||
prim = GL_TRIANGLES;
|
||||
break;
|
||||
case 's':
|
||||
psz += .5;
|
||||
break;
|
||||
case 'S':
|
||||
if (psz > .5)
|
||||
psz -= .5;
|
||||
break;
|
||||
case 'm':
|
||||
pointsmooth = !pointsmooth;
|
||||
break;
|
||||
case 'z':
|
||||
program_point_size = !program_point_size;
|
||||
break;
|
||||
case '+':
|
||||
nr_steps++;
|
||||
break;
|
||||
case '-':
|
||||
if (nr_steps)
|
||||
nr_steps--;
|
||||
break;
|
||||
case ' ':
|
||||
psz = 1.0;
|
||||
prim = GL_TRIANGLES;
|
||||
nr_steps = 4;
|
||||
break;
|
||||
case 27:
|
||||
CleanUp();
|
||||
exit(0);
|
||||
break;
|
||||
}
|
||||
glutPostRedisplay();
|
||||
}
|
||||
@@ -305,7 +351,7 @@ int main( int argc, char *argv[] )
|
||||
glutInitWindowPosition( 0, 0 );
|
||||
glutInitWindowSize( 250, 250 );
|
||||
glutInitDisplayMode( GLUT_RGB | GLUT_SINGLE | GLUT_DEPTH );
|
||||
glutCreateWindow(argv[0]);
|
||||
glutCreateWindow(argv[argc-1]);
|
||||
glewInit();
|
||||
glutReshapeFunc( Reshape );
|
||||
glutKeyboardFunc( Key );
|
||||
|
@@ -50,6 +50,7 @@ struct window {
|
||||
float Angle;
|
||||
int Id;
|
||||
HGLRC sharedContext;
|
||||
HANDLE hEventInitialised;
|
||||
};
|
||||
|
||||
|
||||
@@ -414,6 +415,10 @@ threadRunner (void *arg)
|
||||
Error("Couldn't obtain HDC");
|
||||
}
|
||||
|
||||
/* Wait for the previous thread */
|
||||
if(tia->id > 0)
|
||||
WaitForSingleObject(Windows[tia->id - 1].hEventInitialised, INFINITE);
|
||||
|
||||
pfd.cColorBits = 24;
|
||||
pfd.cDepthBits = 24;
|
||||
pfd.dwFlags = PFD_DOUBLEBUFFER | PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL;
|
||||
@@ -434,9 +439,16 @@ threadRunner (void *arg)
|
||||
}
|
||||
|
||||
if (win->sharedContext) {
|
||||
wglShareLists(win->sharedContext, win->Context);
|
||||
if(!wglShareLists(win->sharedContext, win->Context))
|
||||
Error("Couldn't share WGL context lists");
|
||||
}
|
||||
|
||||
SetEvent(win->hEventInitialised);
|
||||
|
||||
/* Wait for all threads to initialize otherwise wglShareLists will fail */
|
||||
if(tia->id < NumWindows - 1)
|
||||
WaitForSingleObject(Windows[NumWindows - 1].hEventInitialised, INFINITE);
|
||||
|
||||
SendMessage(win->Win, WM_SIZE, 0, 0);
|
||||
|
||||
while (1) {
|
||||
@@ -511,20 +523,26 @@ main(int argc, char *argv[])
|
||||
h[2] = AddWindow( 10, 350, gCtx);
|
||||
h[3] = AddWindow(330, 350, gCtx);
|
||||
|
||||
if (!wglMakeCurrent(gHDC, gCtx)) {
|
||||
Error("wglMakeCurrent failed for init thread.");
|
||||
return -1;
|
||||
for (i = 0; i < NumWindows; i++) {
|
||||
Windows[i].hEventInitialised = CreateEvent(NULL, TRUE, FALSE, NULL);
|
||||
}
|
||||
|
||||
InitGLstuff();
|
||||
|
||||
for (i = 0; i < NumWindows; i++) {
|
||||
DWORD id;
|
||||
|
||||
tia[i].id = i;
|
||||
threads[i] = CreateThread(NULL, 0, threadRunner, &tia[i], 0, &id);
|
||||
|
||||
WaitForSingleObject(Windows[i].hEventInitialised, INFINITE);
|
||||
}
|
||||
|
||||
if (!wglMakeCurrent(gHDC, gCtx)) {
|
||||
Error("wglMakeCurrent failed for init thread.");
|
||||
return -1;
|
||||
}
|
||||
|
||||
InitGLstuff();
|
||||
|
||||
while (1) {
|
||||
MSG msg;
|
||||
|
||||
|
@@ -348,7 +348,6 @@ print_screen_info(HDC _hdc, GLboolean limits)
|
||||
HWND win;
|
||||
HGLRC ctx;
|
||||
int visinfo;
|
||||
int width = 100, height = 100;
|
||||
HDC hdc;
|
||||
PIXELFORMATDESCRIPTOR pfd;
|
||||
|
||||
@@ -364,18 +363,18 @@ print_screen_info(HDC _hdc, GLboolean limits)
|
||||
win = CreateWindowEx(0,
|
||||
wc.lpszClassName,
|
||||
"wglinfo",
|
||||
WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN,
|
||||
WS_CLIPSIBLINGS | WS_CLIPCHILDREN,
|
||||
CW_USEDEFAULT,
|
||||
CW_USEDEFAULT,
|
||||
CW_USEDEFAULT,
|
||||
CW_USEDEFAULT,
|
||||
width,
|
||||
height,
|
||||
NULL,
|
||||
NULL,
|
||||
wc.hInstance,
|
||||
NULL);
|
||||
if (!win) {
|
||||
fprintf(stderr, "Couldn't create window");
|
||||
exit(1);
|
||||
return;
|
||||
}
|
||||
|
||||
hdc = GetDC(win);
|
||||
@@ -476,7 +475,7 @@ print_visual_attribs_verbose(int iPixelFormat, LPPIXELFORMATDESCRIPTOR ppfd)
|
||||
ppfd->dwFlags & PFD_DRAW_TO_WINDOW ? 1 : 0);
|
||||
printf(" bufferSize=%d level=%d renderType=%s doubleBuffer=%d stereo=%d\n",
|
||||
0 /* ppfd->bufferSize */, 0 /* ppfd->level */,
|
||||
visual_render_type_name(ppfd->dwFlags),
|
||||
visual_render_type_name(ppfd->iPixelType),
|
||||
ppfd->dwFlags & PFD_DOUBLEBUFFER ? 1 : 0,
|
||||
ppfd->dwFlags & PFD_STEREO ? 1 : 0);
|
||||
printf(" rgba: cRedBits=%d cGreenBits=%d cBlueBits=%d cAlphaBits=%d\n",
|
||||
|
@@ -72,6 +72,7 @@ struct winthread {
|
||||
int WinWidth, WinHeight;
|
||||
GLboolean NewSize;
|
||||
HANDLE hEventInitialised;
|
||||
GLboolean Initialized;
|
||||
GLboolean MakeNewTexture;
|
||||
HANDLE hEventRedraw;
|
||||
};
|
||||
@@ -114,20 +115,20 @@ static void
|
||||
MakeNewTexture(struct winthread *wt)
|
||||
{
|
||||
#define TEX_SIZE 128
|
||||
static float step = 0.0;
|
||||
static float step = 0.0f;
|
||||
GLfloat image[TEX_SIZE][TEX_SIZE][4];
|
||||
GLint width;
|
||||
int i, j;
|
||||
|
||||
for (j = 0; j < TEX_SIZE; j++) {
|
||||
for (i = 0; i < TEX_SIZE; i++) {
|
||||
float dt = 5.0 * (j - 0.5 * TEX_SIZE) / TEX_SIZE;
|
||||
float ds = 5.0 * (i - 0.5 * TEX_SIZE) / TEX_SIZE;
|
||||
float dt = 5.0f * (j - 0.5f * TEX_SIZE) / TEX_SIZE;
|
||||
float ds = 5.0f * (i - 0.5f * TEX_SIZE) / TEX_SIZE;
|
||||
float r = dt * dt + ds * ds + step;
|
||||
image[j][i][0] =
|
||||
image[j][i][1] =
|
||||
image[j][i][2] = 0.75 + 0.25 * cos(r);
|
||||
image[j][i][3] = 1.0;
|
||||
image[j][i][2] = 0.75f + 0.25f * (float) cos(r);
|
||||
image[j][i][3] = 1.0f;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -159,7 +160,7 @@ static void
|
||||
draw_object(void)
|
||||
{
|
||||
glPushMatrix();
|
||||
glScalef(0.75, 0.75, 0.75);
|
||||
glScalef(0.75f, 0.75f, 0.75f);
|
||||
|
||||
glColor3f(1, 0, 0);
|
||||
|
||||
@@ -288,6 +289,15 @@ draw_loop(struct winthread *wt)
|
||||
|
||||
wglMakeCurrent(wt->hDC, wt->Context);
|
||||
|
||||
if (!wt->Initialized) {
|
||||
printf("wglthreads: %d: GL_RENDERER = %s\n", wt->Index,
|
||||
(char *) glGetString(GL_RENDERER));
|
||||
if (Texture /*&& wt->Index == 0*/) {
|
||||
MakeNewTexture(wt);
|
||||
}
|
||||
wt->Initialized = GL_TRUE;
|
||||
}
|
||||
|
||||
if (Locking)
|
||||
LeaveCriticalSection(&Mutex);
|
||||
|
||||
@@ -315,13 +325,15 @@ draw_loop(struct winthread *wt)
|
||||
glPushMatrix();
|
||||
glRotatef(wt->Angle, 0, 1, 0);
|
||||
glRotatef(wt->Angle, 1, 0, 0);
|
||||
glScalef(0.7, 0.7, 0.7);
|
||||
glScalef(0.7f, 0.7f, 0.7f);
|
||||
draw_object();
|
||||
glPopMatrix();
|
||||
|
||||
if (Locking)
|
||||
EnterCriticalSection(&Mutex);
|
||||
|
||||
SwapBuffers(wt->hDC);
|
||||
|
||||
if (Locking)
|
||||
LeaveCriticalSection(&Mutex);
|
||||
|
||||
@@ -433,7 +445,7 @@ create_window(struct winthread *wt, HGLRC shareCtx)
|
||||
win = CreateWindowEx(0,
|
||||
wc.lpszClassName,
|
||||
"wglthreads",
|
||||
WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN,
|
||||
WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_TILEDWINDOW,
|
||||
xpos,
|
||||
ypos,
|
||||
width,
|
||||
@@ -471,7 +483,8 @@ create_window(struct winthread *wt, HGLRC shareCtx)
|
||||
}
|
||||
|
||||
if (shareCtx) {
|
||||
wglShareLists(shareCtx, ctx);
|
||||
if(!wglShareLists(shareCtx, ctx))
|
||||
Error("Couldn't share WGL context lists");
|
||||
}
|
||||
|
||||
/* save the info for this window/context */
|
||||
@@ -482,14 +495,6 @@ create_window(struct winthread *wt, HGLRC shareCtx)
|
||||
wt->WinWidth = width;
|
||||
wt->WinHeight = height;
|
||||
wt->NewSize = GL_TRUE;
|
||||
|
||||
wglMakeCurrent(hdc, ctx);
|
||||
printf("wglthreads: %d: GL_RENDERER = %s\n", wt->Index, (char *) glGetString(GL_RENDERER));
|
||||
wglMakeCurrent(NULL, NULL);
|
||||
|
||||
if (Texture/* && wt->Index == 0*/) {
|
||||
MakeNewTexture(wt);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -502,10 +507,22 @@ ThreadProc(void *p)
|
||||
struct winthread *wt = (struct winthread *) p;
|
||||
HGLRC share;
|
||||
|
||||
/* Wait for the previous thread */
|
||||
if(Texture && wt->Index > 0) {
|
||||
WaitForSingleObject(WinThreads[wt->Index - 1].hEventInitialised, INFINITE);
|
||||
share = WinThreads[0].Context;
|
||||
}
|
||||
else
|
||||
share = 0;
|
||||
|
||||
share = (Texture && wt->Index > 0) ? WinThreads[0].Context : 0;
|
||||
create_window(wt, share);
|
||||
SetEvent(wt->hEventInitialised);
|
||||
|
||||
/* Wait for all threads to initialize otherwise wglShareLists will fail */
|
||||
if(wt->Index < NumWinThreads - 1)
|
||||
WaitForSingleObject(WinThreads[NumWinThreads - 1].hEventInitialised, INFINITE);
|
||||
|
||||
draw_loop(wt);
|
||||
return 0;
|
||||
}
|
||||
@@ -539,6 +556,7 @@ main(int argc, char *argv[])
|
||||
for (i = 1; i < argc; i++) {
|
||||
if (strcmp(argv[i], "-h") == 0) {
|
||||
usage();
|
||||
exit(0);
|
||||
}
|
||||
else if (strcmp(argv[i], "-l") == 0) {
|
||||
Locking = 1;
|
||||
@@ -588,13 +606,17 @@ main(int argc, char *argv[])
|
||||
|
||||
printf("wglthreads: creating threads\n");
|
||||
|
||||
/* Create the events */
|
||||
for (i = 0; i < NumWinThreads; i++) {
|
||||
WinThreads[i].Index = i;
|
||||
WinThreads[i].hEventInitialised = CreateEvent(NULL, TRUE, FALSE, NULL);
|
||||
WinThreads[i].hEventRedraw = CreateEvent(NULL, FALSE, FALSE, NULL);
|
||||
}
|
||||
|
||||
/* Create the threads */
|
||||
for (i = 0; i < NumWinThreads; i++) {
|
||||
DWORD id;
|
||||
|
||||
WinThreads[i].Index = i;
|
||||
WinThreads[i].hEventInitialised = CreateEvent(NULL, TRUE, FALSE, NULL);
|
||||
WinThreads[i].hEventRedraw = CreateEvent(NULL, FALSE, FALSE, NULL);
|
||||
WinThreads[i].Thread = CreateThread(NULL,
|
||||
0,
|
||||
ThreadProc,
|
||||
@@ -603,8 +625,6 @@ main(int argc, char *argv[])
|
||||
&id);
|
||||
printf("wglthreads: Created thread %p\n", (void *) WinThreads[i].Thread);
|
||||
|
||||
WaitForSingleObject(WinThreads[i].hEventInitialised, INFINITE);
|
||||
|
||||
threads[i] = WinThreads[i].Thread;
|
||||
}
|
||||
|
||||
|
@@ -20,16 +20,17 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
* This is a port of the infamous "gears" demo to straight GLX (i.e. no GLUT)
|
||||
* Port by Brian Paul 23 March 2001
|
||||
* Version of glxgears that creates/destroys the rendering context for each
|
||||
* frame. Also periodically destroy/recreate the window.
|
||||
* Good for finding memory leaks, etc.
|
||||
*
|
||||
* Command line options:
|
||||
* -info print GL implementation information
|
||||
* -stereo use stereo enabled GLX visual
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#include <assert.h>
|
||||
#include <math.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
@@ -92,13 +93,8 @@ static GLfloat view_rotx = 20.0, view_roty = 30.0, view_rotz = 0.0;
|
||||
static GLint gear1, gear2, gear3;
|
||||
static GLfloat angle = 0.0;
|
||||
|
||||
static GLboolean fullscreen = GL_FALSE; /* Create a single fullscreen window */
|
||||
static GLboolean stereo = GL_FALSE; /* Enable stereo. */
|
||||
static GLfloat eyesep = 5.0; /* Eye separation. */
|
||||
static GLfloat fix_point = 40.0; /* Fixation point distance. */
|
||||
static GLfloat left, right, asp; /* Stereo frustum params. */
|
||||
|
||||
XVisualInfo *visinfo;
|
||||
static XVisualInfo *visinfo = NULL;
|
||||
static int WinWidth = 300, WinHeight = 300;
|
||||
|
||||
|
||||
/*
|
||||
@@ -272,22 +268,13 @@ do_draw(void)
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* new window size or exposure */
|
||||
static void
|
||||
reshape(int width, int height)
|
||||
{
|
||||
glViewport(0, 0, (GLint) width, (GLint) height);
|
||||
|
||||
if (stereo) {
|
||||
GLfloat w;
|
||||
|
||||
asp = (GLfloat) height / (GLfloat) width;
|
||||
w = fix_point * (1.0 / 5.0);
|
||||
|
||||
left = -5.0 * ((w - 0.5 * eyesep) / fix_point);
|
||||
right = 5.0 * ((w + 0.5 * eyesep) / fix_point);
|
||||
} else {
|
||||
{
|
||||
GLfloat h = (GLfloat) height / (GLfloat) width;
|
||||
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
@@ -299,7 +286,6 @@ reshape(int width, int height)
|
||||
glLoadIdentity();
|
||||
glTranslatef(0.0, 0.0, -40.0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void
|
||||
@@ -337,7 +323,7 @@ init(void)
|
||||
|
||||
glEnable(GL_NORMALIZE);
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void
|
||||
draw( Display *dpy, Window win )
|
||||
@@ -354,36 +340,9 @@ draw( Display *dpy, Window win )
|
||||
|
||||
init();
|
||||
|
||||
if (stereo) {
|
||||
/* First left eye. */
|
||||
glDrawBuffer(GL_BACK_LEFT);
|
||||
reshape(WinWidth, WinHeight);
|
||||
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
glFrustum(left, right, -asp, asp, 5.0, 60.0);
|
||||
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
|
||||
glPushMatrix();
|
||||
glTranslated(+0.5 * eyesep, 0.0, 0.0);
|
||||
do_draw();
|
||||
glPopMatrix();
|
||||
|
||||
/* Then right eye. */
|
||||
glDrawBuffer(GL_BACK_RIGHT);
|
||||
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
glFrustum(-right, -left, -asp, asp, 5.0, 60.0);
|
||||
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
|
||||
glPushMatrix();
|
||||
glTranslated(-0.5 * eyesep, 0.0, 0.0);
|
||||
do_draw();
|
||||
glPopMatrix();
|
||||
} else
|
||||
do_draw();
|
||||
do_draw();
|
||||
|
||||
glDeleteLists(gear1, 1);
|
||||
glDeleteLists(gear2, 1);
|
||||
@@ -410,14 +369,6 @@ make_window( Display *dpy, const char *name,
|
||||
GLX_DOUBLEBUFFER,
|
||||
GLX_DEPTH_SIZE, 1,
|
||||
None };
|
||||
int stereoAttribs[] = { GLX_RGBA,
|
||||
GLX_RED_SIZE, 1,
|
||||
GLX_GREEN_SIZE, 1,
|
||||
GLX_BLUE_SIZE, 1,
|
||||
GLX_DOUBLEBUFFER,
|
||||
GLX_DEPTH_SIZE, 1,
|
||||
GLX_STEREO,
|
||||
None };
|
||||
int scrnum;
|
||||
XSetWindowAttributes attr;
|
||||
unsigned long mask;
|
||||
@@ -427,22 +378,9 @@ make_window( Display *dpy, const char *name,
|
||||
scrnum = DefaultScreen( dpy );
|
||||
root = RootWindow( dpy, scrnum );
|
||||
|
||||
if (fullscreen) {
|
||||
x = 0; y = 0;
|
||||
width = DisplayWidth( dpy, scrnum );
|
||||
height = DisplayHeight( dpy, scrnum );
|
||||
}
|
||||
|
||||
if (stereo)
|
||||
visinfo = glXChooseVisual( dpy, scrnum, stereoAttribs );
|
||||
else
|
||||
visinfo = glXChooseVisual( dpy, scrnum, attribs );
|
||||
visinfo = glXChooseVisual( dpy, scrnum, attribs );
|
||||
if (!visinfo) {
|
||||
if (stereo) {
|
||||
printf("Error: couldn't get an RGB, "
|
||||
"Double-buffered, Stereo visual\n");
|
||||
} else
|
||||
printf("Error: couldn't get an RGB, Double-buffered visual\n");
|
||||
printf("Error: couldn't get an RGB, Double-buffered visual\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
@@ -451,7 +389,7 @@ make_window( Display *dpy, const char *name,
|
||||
attr.border_pixel = 0;
|
||||
attr.colormap = XCreateColormap( dpy, root, visinfo->visual, AllocNone);
|
||||
attr.event_mask = StructureNotifyMask | ExposureMask | KeyPressMask;
|
||||
attr.override_redirect = fullscreen;
|
||||
attr.override_redirect = 0;
|
||||
mask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask | CWOverrideRedirect;
|
||||
|
||||
win = XCreateWindow( dpy, root, x, y, width, height,
|
||||
@@ -479,10 +417,9 @@ static void
|
||||
event_loop(Display *dpy)
|
||||
{
|
||||
Window win;
|
||||
make_window(dpy, "glxgears", 0, 0, 300, 300, &win);
|
||||
make_window(dpy, "glxgears", 0, 0, WinWidth, WinHeight, &win);
|
||||
XMapWindow(dpy, win);
|
||||
|
||||
|
||||
while (1) {
|
||||
while (XPending(dpy) > 0) {
|
||||
XEvent event;
|
||||
@@ -492,34 +429,35 @@ event_loop(Display *dpy)
|
||||
/* we'll redraw below */
|
||||
break;
|
||||
case ConfigureNotify:
|
||||
reshape(event.xconfigure.width, event.xconfigure.height);
|
||||
WinWidth = event.xconfigure.width;
|
||||
WinHeight = event.xconfigure.height;
|
||||
break;
|
||||
case KeyPress:
|
||||
{
|
||||
char buffer[10];
|
||||
int r, code;
|
||||
code = XLookupKeysym(&event.xkey, 0);
|
||||
if (code == XK_Left) {
|
||||
view_roty += 5.0;
|
||||
}
|
||||
else if (code == XK_Right) {
|
||||
view_roty -= 5.0;
|
||||
}
|
||||
else if (code == XK_Up) {
|
||||
view_rotx += 5.0;
|
||||
}
|
||||
else if (code == XK_Down) {
|
||||
view_rotx -= 5.0;
|
||||
}
|
||||
else {
|
||||
r = XLookupString(&event.xkey, buffer, sizeof(buffer),
|
||||
NULL, NULL);
|
||||
if (buffer[0] == 27) {
|
||||
/* escape */
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
{
|
||||
char buffer[10];
|
||||
int r, code;
|
||||
code = XLookupKeysym(&event.xkey, 0);
|
||||
if (code == XK_Left) {
|
||||
view_roty += 5.0;
|
||||
}
|
||||
else if (code == XK_Right) {
|
||||
view_roty -= 5.0;
|
||||
}
|
||||
else if (code == XK_Up) {
|
||||
view_rotx += 5.0;
|
||||
}
|
||||
else if (code == XK_Down) {
|
||||
view_rotx -= 5.0;
|
||||
}
|
||||
else {
|
||||
r = XLookupString(&event.xkey, buffer, sizeof(buffer),
|
||||
NULL, NULL);
|
||||
if (buffer[0] == 27) {
|
||||
/* escape */
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -550,9 +488,12 @@ event_loop(Display *dpy)
|
||||
printf("%d frames in %3.1f seconds = %6.3f FPS\n", frames, seconds,
|
||||
fps);
|
||||
tRate0 = t;
|
||||
|
||||
|
||||
/* Destroy window and create new one */
|
||||
XDestroyWindow(dpy, win);
|
||||
make_window(dpy, "glxgears", (int)(fps * 100) % 100, (int)(fps * 100) % 100, 300, 300, &win);
|
||||
make_window(dpy, "glxgears",
|
||||
(int)(fps * 100) % 100, (int)(fps * 100) % 100, /* x,y */
|
||||
WinWidth, WinHeight, &win);
|
||||
XMapWindow(dpy, win);
|
||||
|
||||
frames = 0;
|
||||
@@ -562,7 +503,6 @@ event_loop(Display *dpy)
|
||||
}
|
||||
|
||||
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
@@ -579,12 +519,6 @@ main(int argc, char *argv[])
|
||||
else if (strcmp(argv[i], "-info") == 0) {
|
||||
printInfo = GL_TRUE;
|
||||
}
|
||||
else if (strcmp(argv[i], "-stereo") == 0) {
|
||||
stereo = GL_TRUE;
|
||||
}
|
||||
else if (strcmp(argv[i], "-fullscreen") == 0) {
|
||||
fullscreen = GL_TRUE;
|
||||
}
|
||||
else
|
||||
printf("Warrning: unknown parameter: %s\n", argv[i]);
|
||||
}
|
||||
@@ -596,7 +530,6 @@ main(int argc, char *argv[])
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
if (printInfo) {
|
||||
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
|
||||
printf("GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
|
||||
@@ -604,7 +537,6 @@ main(int argc, char *argv[])
|
||||
printf("GL_EXTENSIONS = %s\n", (char *) glGetString(GL_EXTENSIONS));
|
||||
}
|
||||
|
||||
|
||||
event_loop(dpy);
|
||||
|
||||
XCloseDisplay(dpy);
|
||||
|
@@ -108,7 +108,7 @@ def shlib_emitter(target, source, env):
|
||||
return (target, source)
|
||||
|
||||
|
||||
shlib_action = SCons.Action.Action(shlib_generator, generator=1)
|
||||
shlib_action = SCons.Action.Action(shlib_generator, '$SHLINKCOMSTR', generator=1)
|
||||
|
||||
res_action = SCons.Action.Action('$RCCOM', '$RCCOMSTR')
|
||||
|
||||
|
66
scons/dxsdk.py
Normal file
66
scons/dxsdk.py
Normal file
@@ -0,0 +1,66 @@
|
||||
"""dxsdk
|
||||
|
||||
Tool-specific initialization for Microsoft DirectX SDK
|
||||
|
||||
"""
|
||||
|
||||
#
|
||||
# Copyright (c) 2009 VMware, Inc.
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining
|
||||
# a copy of this software and associated documentation files (the
|
||||
# "Software"), to deal in the Software without restriction, including
|
||||
# without limitation the rights to use, copy, modify, merge, publish,
|
||||
# distribute, sublicense, and/or sell copies of the Software, and to
|
||||
# permit persons to whom the Software is furnished to do so, subject to
|
||||
# the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included
|
||||
# in all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
|
||||
# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
|
||||
# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
#
|
||||
|
||||
import os
|
||||
import os.path
|
||||
|
||||
import SCons.Errors
|
||||
import SCons.Util
|
||||
|
||||
|
||||
def get_dxsdk_root(env):
|
||||
try:
|
||||
return os.environ['DXSDK_DIR']
|
||||
except KeyError:
|
||||
return None
|
||||
|
||||
def get_dxsdk_paths(env):
|
||||
dxsdk_root = get_dxsdk_root(env)
|
||||
if dxsdk_root is None:
|
||||
raise SCons.Errors.InternalError, "DirectX SDK not found"
|
||||
|
||||
if env['machine'] in ('generic', 'x86'):
|
||||
target_cpu = 'x86'
|
||||
elif env['machine'] == 'x86_64':
|
||||
target_cpu = 'x64'
|
||||
else:
|
||||
raise SCons.Errors.InternalError, "Unsupported target machine"
|
||||
include_dir = 'Include'
|
||||
|
||||
env.Append(CPPDEFINES = [('HAVE_DXSDK', '1')])
|
||||
env.Prepend(CPPPATH = [os.path.join(dxsdk_root, 'Include')])
|
||||
env.Prepend(LIBPATH = [os.path.join(dxsdk_root, 'Lib', target_cpu)])
|
||||
|
||||
def generate(env):
|
||||
get_dxsdk_paths(env)
|
||||
|
||||
def exists(env):
|
||||
return get_dxsdk_root(env) is not None
|
||||
|
||||
# vim:set ts=4 sw=4 et:
|
@@ -42,11 +42,17 @@ import SCons.Scanner
|
||||
def quietCommandLines(env):
|
||||
# Quiet command lines
|
||||
# See also http://www.scons.org/wiki/HidingCommandLinesInOutput
|
||||
env['ASCOMSTR'] = "Assembling $SOURCE ..."
|
||||
env['CCCOMSTR'] = "Compiling $SOURCE ..."
|
||||
env['SHCCCOMSTR'] = "Compiling $SOURCE ..."
|
||||
env['CXXCOMSTR'] = "Compiling $SOURCE ..."
|
||||
env['SHCXXCOMSTR'] = "Compiling $SOURCE ..."
|
||||
env['ARCOMSTR'] = "Archiving $TARGET ..."
|
||||
env['RANLIBCOMSTR'] = ""
|
||||
env['RANLIBCOMSTR'] = "Indexing $TARGET ..."
|
||||
env['LINKCOMSTR'] = "Linking $TARGET ..."
|
||||
env['SHLINKCOMSTR'] = "Linking $TARGET ..."
|
||||
env['LDMODULECOMSTR'] = "Linking $TARGET ..."
|
||||
env['SWIGCOMSTR'] = "Generating $TARGET ..."
|
||||
|
||||
|
||||
def createConvenienceLibBuilder(env):
|
||||
@@ -185,9 +191,8 @@ def num_jobs():
|
||||
def generate(env):
|
||||
"""Common environment generation code"""
|
||||
|
||||
# FIXME: this is already too late
|
||||
#if env.get('quiet', False):
|
||||
# quietCommandLines(env)
|
||||
if env.get('quiet', True):
|
||||
quietCommandLines(env)
|
||||
|
||||
# Toolchain
|
||||
platform = env['platform']
|
||||
@@ -313,76 +318,78 @@ def generate(env):
|
||||
env.Append(CPPDEFINES = cppdefines)
|
||||
|
||||
# C compiler options
|
||||
cflags = []
|
||||
cflags = [] # C
|
||||
cxxflags = [] # C++
|
||||
ccflags = [] # C & C++
|
||||
if gcc:
|
||||
if debug:
|
||||
cflags += ['-O0', '-g3']
|
||||
ccflags += ['-O0', '-g3']
|
||||
elif env['toolchain'] == 'crossmingw':
|
||||
cflags += ['-O0', '-g3'] # mingw 4.2.1 optimizer is broken
|
||||
ccflags += ['-O0', '-g3'] # mingw 4.2.1 optimizer is broken
|
||||
else:
|
||||
cflags += ['-O3', '-g3']
|
||||
ccflags += ['-O3', '-g3']
|
||||
if env['profile']:
|
||||
cflags += ['-pg']
|
||||
ccflags += ['-pg']
|
||||
if env['machine'] == 'x86':
|
||||
cflags += [
|
||||
ccflags += [
|
||||
'-m32',
|
||||
#'-march=pentium4',
|
||||
'-mmmx', '-msse', '-msse2', # enable SIMD intrinsics
|
||||
#'-mfpmath=sse',
|
||||
]
|
||||
if env['machine'] == 'x86_64':
|
||||
cflags += ['-m64']
|
||||
ccflags += ['-m64']
|
||||
# See also:
|
||||
# - http://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html
|
||||
cflags += [
|
||||
'-Werror=declaration-after-statement',
|
||||
ccflags += [
|
||||
'-Wall',
|
||||
'-Wmissing-prototypes',
|
||||
'-Wmissing-field-initializers',
|
||||
'-Wpointer-arith',
|
||||
'-Wno-long-long',
|
||||
'-ffast-math',
|
||||
'-std=gnu99',
|
||||
'-fmessage-length=0', # be nice to Eclipse
|
||||
]
|
||||
cflags += [
|
||||
'-Werror=declaration-after-statement',
|
||||
'-Wmissing-prototypes',
|
||||
'-std=gnu99',
|
||||
]
|
||||
if msvc:
|
||||
# See also:
|
||||
# - http://msdn.microsoft.com/en-us/library/19z1t1wy.aspx
|
||||
# - cl /?
|
||||
if debug:
|
||||
cflags += [
|
||||
ccflags += [
|
||||
'/Od', # disable optimizations
|
||||
'/Oi', # enable intrinsic functions
|
||||
'/Oy-', # disable frame pointer omission
|
||||
'/GL-', # disable whole program optimization
|
||||
]
|
||||
else:
|
||||
cflags += [
|
||||
'/Ox', # maximum optimizations
|
||||
'/Oi', # enable intrinsic functions
|
||||
'/Ot', # favor code speed
|
||||
#'/fp:fast', # fast floating point
|
||||
ccflags += [
|
||||
'/O2', # optimize for speed
|
||||
#'/fp:fast', # fast floating point
|
||||
]
|
||||
if env['profile']:
|
||||
cflags += [
|
||||
ccflags += [
|
||||
'/Gh', # enable _penter hook function
|
||||
'/GH', # enable _pexit hook function
|
||||
]
|
||||
cflags += [
|
||||
ccflags += [
|
||||
'/W3', # warning level
|
||||
#'/Wp64', # enable 64 bit porting warnings
|
||||
]
|
||||
if env['machine'] == 'x86':
|
||||
cflags += [
|
||||
ccflags += [
|
||||
#'/QIfist', # Suppress _ftol
|
||||
#'/arch:SSE2', # use the SSE2 instructions
|
||||
]
|
||||
if platform == 'windows':
|
||||
cflags += [
|
||||
ccflags += [
|
||||
# TODO
|
||||
]
|
||||
if platform == 'winddk':
|
||||
cflags += [
|
||||
ccflags += [
|
||||
'/Zl', # omit default library name in .OBJ
|
||||
'/Zp8', # 8bytes struct member alignment
|
||||
'/Gy', # separate functions for linker
|
||||
@@ -401,7 +408,7 @@ def generate(env):
|
||||
]
|
||||
if platform == 'wince':
|
||||
# See also C:\WINCE600\public\common\oak\misc\makefile.def
|
||||
cflags += [
|
||||
ccflags += [
|
||||
'/Zl', # omit default library name in .OBJ
|
||||
'/GF', # enable read-only string pooling
|
||||
'/GR-', # disable C++ RTTI
|
||||
@@ -418,8 +425,9 @@ def generate(env):
|
||||
# See http://scons.tigris.org/issues/show_bug.cgi?id=1656
|
||||
env.EnsureSConsVersion(0, 98, 0)
|
||||
env['PDB'] = '${TARGET.base}.pdb'
|
||||
env.Append(CCFLAGS = ccflags)
|
||||
env.Append(CFLAGS = cflags)
|
||||
env.Append(CXXFLAGS = cflags)
|
||||
env.Append(CXXFLAGS = cxxflags)
|
||||
|
||||
if env['platform'] == 'windows' and msvc:
|
||||
# Choose the appropriate MSVC CRT
|
||||
|
@@ -416,16 +416,18 @@ def generate(env):
|
||||
# See also:
|
||||
# - http://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html
|
||||
ccflags += [
|
||||
'-Werror=declaration-after-statement',
|
||||
'-Wall',
|
||||
'-Wmissing-prototypes',
|
||||
'-Wmissing-field-initializers',
|
||||
'-Wpointer-arith',
|
||||
'-Wno-long-long',
|
||||
'-ffast-math',
|
||||
'-std=gnu99',
|
||||
'-fmessage-length=0', # be nice to Eclipse
|
||||
]
|
||||
cflags += [
|
||||
'-Werror=declaration-after-statement',
|
||||
'-Wmissing-prototypes',
|
||||
'-std=gnu99',
|
||||
]
|
||||
if msvc:
|
||||
# See also:
|
||||
# - http://msdn.microsoft.com/en-us/library/19z1t1wy.aspx
|
||||
|
@@ -60,8 +60,6 @@ struct aaline_fragment_shader
|
||||
struct pipe_shader_state state;
|
||||
void *driver_fs;
|
||||
void *aaline_fs;
|
||||
void *aapoint_fs; /* not yet */
|
||||
void *sprite_fs; /* not yet */
|
||||
uint sampler_unit;
|
||||
int generic_attrib; /**< texcoord/generic used for texture */
|
||||
};
|
||||
@@ -373,10 +371,15 @@ generate_aaline_fs(struct aaline_stage *aaline)
|
||||
aaline->fs->aaline_fs
|
||||
= aaline->driver_create_fs_state(aaline->pipe, &aaline_fs);
|
||||
if (aaline->fs->aaline_fs == NULL)
|
||||
return FALSE;
|
||||
goto fail;
|
||||
|
||||
aaline->fs->generic_attrib = transform.maxGeneric + 1;
|
||||
FREE((void *)aaline_fs.tokens);
|
||||
return TRUE;
|
||||
|
||||
fail:
|
||||
FREE((void *)aaline_fs.tokens);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
@@ -816,6 +819,10 @@ aaline_delete_fs_state(struct pipe_context *pipe, void *fs)
|
||||
struct aaline_fragment_shader *aafs = (struct aaline_fragment_shader *) fs;
|
||||
/* pass-through */
|
||||
aaline->driver_delete_fs_state(aaline->pipe, aafs->driver_fs);
|
||||
|
||||
if (aafs->aaline_fs)
|
||||
aaline->driver_delete_fs_state(aaline->pipe, aafs->aaline_fs);
|
||||
|
||||
FREE(aafs);
|
||||
}
|
||||
|
||||
|
@@ -523,11 +523,15 @@ generate_aapoint_fs(struct aapoint_stage *aapoint)
|
||||
aapoint->fs->aapoint_fs
|
||||
= aapoint->driver_create_fs_state(aapoint->pipe, &aapoint_fs);
|
||||
if (aapoint->fs->aapoint_fs == NULL)
|
||||
return FALSE;
|
||||
goto fail;
|
||||
|
||||
aapoint->fs->generic_attrib = transform.maxGeneric + 1;
|
||||
|
||||
FREE((void *)aapoint_fs.tokens);
|
||||
return TRUE;
|
||||
|
||||
fail:
|
||||
FREE((void *)aapoint_fs.tokens);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
@@ -825,8 +829,13 @@ aapoint_delete_fs_state(struct pipe_context *pipe, void *fs)
|
||||
{
|
||||
struct aapoint_stage *aapoint = aapoint_stage_from_pipe(pipe);
|
||||
struct aapoint_fragment_shader *aafs = (struct aapoint_fragment_shader *) fs;
|
||||
|
||||
/* pass-through */
|
||||
aapoint->driver_delete_fs_state(aapoint->pipe, aafs->driver_fs);
|
||||
|
||||
if (aafs->aapoint_fs)
|
||||
aapoint->driver_delete_fs_state(aapoint->pipe, aafs->aapoint_fs);
|
||||
|
||||
FREE(aafs);
|
||||
}
|
||||
|
||||
|
@@ -358,6 +358,7 @@ generate_pstip_fs(struct pstip_stage *pstip)
|
||||
|
||||
pstip->fs->pstip_fs = pstip->driver_create_fs_state(pstip->pipe, &pstip_fs);
|
||||
|
||||
FREE((void *)pstip_fs.tokens);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -649,6 +650,10 @@ pstip_delete_fs_state(struct pipe_context *pipe, void *fs)
|
||||
struct pstip_fragment_shader *aafs = (struct pstip_fragment_shader *) fs;
|
||||
/* pass-through */
|
||||
pstip->driver_delete_fs_state(pstip->pipe, aafs->driver_fs);
|
||||
|
||||
if (aafs->pstip_fs)
|
||||
pstip->driver_delete_fs_state(pstip->pipe, aafs->pstip_fs);
|
||||
|
||||
FREE(aafs);
|
||||
}
|
||||
|
||||
|
@@ -253,6 +253,7 @@ static void widepoint_flush( struct draw_stage *stage, unsigned flags )
|
||||
{
|
||||
stage->point = widepoint_first_point;
|
||||
stage->next->flush( stage->next, flags );
|
||||
stage->draw->extra_vp_outputs.slot = 0;
|
||||
}
|
||||
|
||||
|
||||
|
@@ -54,7 +54,8 @@ static unsigned elt_ubyte( const void *elts, unsigned idx )
|
||||
|
||||
static unsigned elt_vert( const void *elts, unsigned idx )
|
||||
{
|
||||
return (const ubyte *)elts - (const ubyte *)NULL + idx;
|
||||
/* unsigned index is packed in the pointer */
|
||||
return (unsigned)(uintptr_t)elts + idx;
|
||||
}
|
||||
|
||||
pt_elt_func draw_pt_elt_func( struct draw_context *draw )
|
||||
|
@@ -244,7 +244,7 @@ int u_index_generator( unsigned hw_mask,
|
||||
|
||||
default:
|
||||
assert(0);
|
||||
*out_generate = generate[out_idx][in_pv][out_pv][prim];
|
||||
*out_generate = generate[out_idx][in_pv][out_pv][PIPE_PRIM_POINTS];
|
||||
*out_prim = PIPE_PRIM_POINTS;
|
||||
*out_nr = nr;
|
||||
return U_TRANSLATE_ERROR;
|
||||
|
@@ -71,6 +71,12 @@ struct pb_desc
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Size. Regular (32bit) unsigned for now.
|
||||
*/
|
||||
typedef unsigned pb_size;
|
||||
|
||||
|
||||
/**
|
||||
* Base class for all pb_* buffers.
|
||||
*/
|
||||
@@ -126,7 +132,7 @@ struct pb_vtbl
|
||||
*/
|
||||
void (*get_base_buffer)( struct pb_buffer *buf,
|
||||
struct pb_buffer **base_buf,
|
||||
unsigned *offset );
|
||||
pb_size *offset );
|
||||
|
||||
};
|
||||
|
||||
@@ -177,7 +183,7 @@ pb_unmap(struct pb_buffer *buf)
|
||||
static INLINE void
|
||||
pb_get_base_buffer( struct pb_buffer *buf,
|
||||
struct pb_buffer **base_buf,
|
||||
unsigned *offset )
|
||||
pb_size *offset )
|
||||
{
|
||||
assert(buf);
|
||||
if(!buf) {
|
||||
@@ -241,7 +247,7 @@ pb_reference(struct pb_buffer **dst,
|
||||
* the requested or not.
|
||||
*/
|
||||
static INLINE boolean
|
||||
pb_check_alignment(size_t requested, size_t provided)
|
||||
pb_check_alignment(pb_size requested, pb_size provided)
|
||||
{
|
||||
if(!requested)
|
||||
return TRUE;
|
||||
@@ -269,7 +275,7 @@ pb_check_usage(unsigned requested, unsigned provided)
|
||||
* hardware.
|
||||
*/
|
||||
struct pb_buffer *
|
||||
pb_malloc_buffer_create(size_t size,
|
||||
pb_malloc_buffer_create(pb_size size,
|
||||
const struct pb_desc *desc);
|
||||
|
||||
|
||||
|
@@ -65,11 +65,11 @@ struct fenced_buffer_list
|
||||
|
||||
struct pb_fence_ops *ops;
|
||||
|
||||
size_t numDelayed;
|
||||
pb_size numDelayed;
|
||||
struct list_head delayed;
|
||||
|
||||
#ifdef DEBUG
|
||||
size_t numUnfenced;
|
||||
pb_size numUnfenced;
|
||||
struct list_head unfenced;
|
||||
#endif
|
||||
};
|
||||
@@ -433,7 +433,7 @@ fenced_buffer_fence(struct pb_buffer *buf,
|
||||
static void
|
||||
fenced_buffer_get_base_buffer(struct pb_buffer *buf,
|
||||
struct pb_buffer **base_buf,
|
||||
unsigned *offset)
|
||||
pb_size *offset)
|
||||
{
|
||||
struct fenced_buffer *fenced_buf = fenced_buffer(buf);
|
||||
pb_get_base_buffer(fenced_buf->buffer, base_buf, offset);
|
||||
|
@@ -102,7 +102,7 @@ malloc_buffer_fence(struct pb_buffer *buf,
|
||||
static void
|
||||
malloc_buffer_get_base_buffer(struct pb_buffer *buf,
|
||||
struct pb_buffer **base_buf,
|
||||
unsigned *offset)
|
||||
pb_size *offset)
|
||||
{
|
||||
*base_buf = buf;
|
||||
*offset = 0;
|
||||
@@ -121,7 +121,7 @@ malloc_buffer_vtbl = {
|
||||
|
||||
|
||||
struct pb_buffer *
|
||||
pb_malloc_buffer_create(size_t size,
|
||||
pb_malloc_buffer_create(pb_size size,
|
||||
const struct pb_desc *desc)
|
||||
{
|
||||
struct malloc_buffer *buf;
|
||||
@@ -150,7 +150,7 @@ pb_malloc_buffer_create(size_t size,
|
||||
|
||||
static struct pb_buffer *
|
||||
pb_malloc_bufmgr_create_buffer(struct pb_manager *mgr,
|
||||
size_t size,
|
||||
pb_size size,
|
||||
const struct pb_desc *desc)
|
||||
{
|
||||
return pb_malloc_buffer_create(size, desc);
|
||||
|
@@ -73,7 +73,7 @@ struct pb_manager
|
||||
|
||||
struct pb_buffer *
|
||||
(*create_buffer)( struct pb_manager *mgr,
|
||||
size_t size,
|
||||
pb_size size,
|
||||
const struct pb_desc *desc);
|
||||
|
||||
/**
|
||||
@@ -106,7 +106,7 @@ pb_malloc_bufmgr_create(void);
|
||||
*/
|
||||
struct pb_manager *
|
||||
pool_bufmgr_create(struct pb_manager *provider,
|
||||
size_t n, size_t size,
|
||||
pb_size n, pb_size size,
|
||||
const struct pb_desc *desc);
|
||||
|
||||
|
||||
@@ -119,7 +119,7 @@ pool_bufmgr_create(struct pb_manager *provider,
|
||||
*/
|
||||
struct pb_manager *
|
||||
mm_bufmgr_create(struct pb_manager *provider,
|
||||
size_t size, size_t align2);
|
||||
pb_size size, pb_size align2);
|
||||
|
||||
/**
|
||||
* Same as mm_bufmgr_create.
|
||||
@@ -128,7 +128,7 @@ mm_bufmgr_create(struct pb_manager *provider,
|
||||
*/
|
||||
struct pb_manager *
|
||||
mm_bufmgr_create_from_buffer(struct pb_buffer *buffer,
|
||||
size_t size, size_t align2);
|
||||
pb_size size, pb_size align2);
|
||||
|
||||
|
||||
/**
|
||||
@@ -136,8 +136,8 @@ mm_bufmgr_create_from_buffer(struct pb_buffer *buffer,
|
||||
*/
|
||||
struct pb_manager *
|
||||
pb_slab_manager_create(struct pb_manager *provider,
|
||||
size_t bufSize,
|
||||
size_t slabSize,
|
||||
pb_size bufSize,
|
||||
pb_size slabSize,
|
||||
const struct pb_desc *desc);
|
||||
|
||||
/**
|
||||
@@ -146,9 +146,9 @@ pb_slab_manager_create(struct pb_manager *provider,
|
||||
*/
|
||||
struct pb_manager *
|
||||
pb_slab_range_manager_create(struct pb_manager *provider,
|
||||
size_t minBufSize,
|
||||
size_t maxBufSize,
|
||||
size_t slabSize,
|
||||
pb_size minBufSize,
|
||||
pb_size maxBufSize,
|
||||
pb_size slabSize,
|
||||
const struct pb_desc *desc);
|
||||
|
||||
|
||||
@@ -204,7 +204,7 @@ pb_ondemand_manager_create(struct pb_manager *provider);
|
||||
*/
|
||||
struct pb_manager *
|
||||
pb_debug_manager_create(struct pb_manager *provider,
|
||||
size_t underflow_size, size_t overflow_size);
|
||||
pb_size underflow_size, pb_size overflow_size);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@@ -60,7 +60,7 @@ pb_alt_manager(struct pb_manager *mgr)
|
||||
|
||||
static struct pb_buffer *
|
||||
pb_alt_manager_create_buffer(struct pb_manager *_mgr,
|
||||
size_t size,
|
||||
pb_size size,
|
||||
const struct pb_desc *desc)
|
||||
{
|
||||
struct pb_alt_manager *mgr = pb_alt_manager(_mgr);
|
||||
|
@@ -81,7 +81,7 @@ struct pb_cache_manager
|
||||
pipe_mutex mutex;
|
||||
|
||||
struct list_head delayed;
|
||||
size_t numDelayed;
|
||||
pb_size numDelayed;
|
||||
};
|
||||
|
||||
|
||||
@@ -204,7 +204,7 @@ pb_cache_buffer_fence(struct pb_buffer *_buf,
|
||||
static void
|
||||
pb_cache_buffer_get_base_buffer(struct pb_buffer *_buf,
|
||||
struct pb_buffer **base_buf,
|
||||
unsigned *offset)
|
||||
pb_size *offset)
|
||||
{
|
||||
struct pb_cache_buffer *buf = pb_cache_buffer(_buf);
|
||||
pb_get_base_buffer(buf->buffer, base_buf, offset);
|
||||
@@ -224,7 +224,7 @@ pb_cache_buffer_vtbl = {
|
||||
|
||||
static INLINE boolean
|
||||
pb_cache_is_buffer_compat(struct pb_cache_buffer *buf,
|
||||
size_t size,
|
||||
pb_size size,
|
||||
const struct pb_desc *desc)
|
||||
{
|
||||
if(buf->base.base.size < size)
|
||||
@@ -246,7 +246,7 @@ pb_cache_is_buffer_compat(struct pb_cache_buffer *buf,
|
||||
|
||||
static struct pb_buffer *
|
||||
pb_cache_manager_create_buffer(struct pb_manager *_mgr,
|
||||
size_t size,
|
||||
pb_size size,
|
||||
const struct pb_desc *desc)
|
||||
{
|
||||
struct pb_cache_manager *mgr = pb_cache_manager(_mgr);
|
||||
|
@@ -72,8 +72,8 @@ struct pb_debug_buffer
|
||||
struct pb_buffer *buffer;
|
||||
struct pb_debug_manager *mgr;
|
||||
|
||||
size_t underflow_size;
|
||||
size_t overflow_size;
|
||||
pb_size underflow_size;
|
||||
pb_size overflow_size;
|
||||
|
||||
struct debug_stack_frame create_backtrace[PB_DEBUG_CREATE_BACKTRACE];
|
||||
|
||||
@@ -91,8 +91,8 @@ struct pb_debug_manager
|
||||
|
||||
struct pb_manager *provider;
|
||||
|
||||
size_t underflow_size;
|
||||
size_t overflow_size;
|
||||
pb_size underflow_size;
|
||||
pb_size overflow_size;
|
||||
|
||||
pipe_mutex mutex;
|
||||
struct list_head list;
|
||||
@@ -124,9 +124,9 @@ static const uint8_t random_pattern[32] = {
|
||||
|
||||
|
||||
static INLINE void
|
||||
fill_random_pattern(uint8_t *dst, size_t size)
|
||||
fill_random_pattern(uint8_t *dst, pb_size size)
|
||||
{
|
||||
size_t i = 0;
|
||||
pb_size i = 0;
|
||||
while(size--) {
|
||||
*dst++ = random_pattern[i++];
|
||||
i &= sizeof(random_pattern) - 1;
|
||||
@@ -135,11 +135,11 @@ fill_random_pattern(uint8_t *dst, size_t size)
|
||||
|
||||
|
||||
static INLINE boolean
|
||||
check_random_pattern(const uint8_t *dst, size_t size,
|
||||
size_t *min_ofs, size_t *max_ofs)
|
||||
check_random_pattern(const uint8_t *dst, pb_size size,
|
||||
pb_size *min_ofs, pb_size *max_ofs)
|
||||
{
|
||||
boolean result = TRUE;
|
||||
size_t i;
|
||||
pb_size i;
|
||||
*min_ofs = size;
|
||||
*max_ofs = 0;
|
||||
for(i = 0; i < size; ++i) {
|
||||
@@ -183,7 +183,7 @@ pb_debug_buffer_check(struct pb_debug_buffer *buf)
|
||||
assert(map);
|
||||
if(map) {
|
||||
boolean underflow, overflow;
|
||||
size_t min_ofs, max_ofs;
|
||||
pb_size min_ofs, max_ofs;
|
||||
|
||||
underflow = !check_random_pattern(map, buf->underflow_size,
|
||||
&min_ofs, &max_ofs);
|
||||
@@ -287,7 +287,7 @@ pb_debug_buffer_unmap(struct pb_buffer *_buf)
|
||||
static void
|
||||
pb_debug_buffer_get_base_buffer(struct pb_buffer *_buf,
|
||||
struct pb_buffer **base_buf,
|
||||
unsigned *offset)
|
||||
pb_size *offset)
|
||||
{
|
||||
struct pb_debug_buffer *buf = pb_debug_buffer(_buf);
|
||||
pb_get_base_buffer(buf->buffer, base_buf, offset);
|
||||
@@ -363,13 +363,13 @@ pb_debug_manager_dump(struct pb_debug_manager *mgr)
|
||||
|
||||
static struct pb_buffer *
|
||||
pb_debug_manager_create_buffer(struct pb_manager *_mgr,
|
||||
size_t size,
|
||||
pb_size size,
|
||||
const struct pb_desc *desc)
|
||||
{
|
||||
struct pb_debug_manager *mgr = pb_debug_manager(_mgr);
|
||||
struct pb_debug_buffer *buf;
|
||||
struct pb_desc real_desc;
|
||||
size_t real_size;
|
||||
pb_size real_size;
|
||||
|
||||
buf = CALLOC_STRUCT(pb_debug_buffer);
|
||||
if(!buf)
|
||||
@@ -455,7 +455,7 @@ pb_debug_manager_destroy(struct pb_manager *_mgr)
|
||||
|
||||
struct pb_manager *
|
||||
pb_debug_manager_create(struct pb_manager *provider,
|
||||
size_t underflow_size, size_t overflow_size)
|
||||
pb_size underflow_size, pb_size overflow_size)
|
||||
{
|
||||
struct pb_debug_manager *mgr;
|
||||
|
||||
@@ -485,7 +485,7 @@ pb_debug_manager_create(struct pb_manager *provider,
|
||||
|
||||
struct pb_manager *
|
||||
pb_debug_manager_create(struct pb_manager *provider,
|
||||
size_t underflow_size, size_t overflow_size)
|
||||
pb_size underflow_size, pb_size overflow_size)
|
||||
{
|
||||
return provider;
|
||||
}
|
||||
|
@@ -62,7 +62,7 @@ fenced_pb_manager(struct pb_manager *mgr)
|
||||
|
||||
static struct pb_buffer *
|
||||
fenced_bufmgr_create_buffer(struct pb_manager *mgr,
|
||||
size_t size,
|
||||
pb_size size,
|
||||
const struct pb_desc *desc)
|
||||
{
|
||||
struct fenced_pb_manager *fenced_mgr = fenced_pb_manager(mgr);
|
||||
|
@@ -55,10 +55,10 @@ struct mm_pb_manager
|
||||
|
||||
pipe_mutex mutex;
|
||||
|
||||
size_t size;
|
||||
pb_size size;
|
||||
struct mem_block *heap;
|
||||
|
||||
size_t align2;
|
||||
pb_size align2;
|
||||
|
||||
struct pb_buffer *buffer;
|
||||
void *map;
|
||||
@@ -148,7 +148,7 @@ mm_buffer_fence(struct pb_buffer *buf,
|
||||
static void
|
||||
mm_buffer_get_base_buffer(struct pb_buffer *buf,
|
||||
struct pb_buffer **base_buf,
|
||||
unsigned *offset)
|
||||
pb_size *offset)
|
||||
{
|
||||
struct mm_buffer *mm_buf = mm_buffer(buf);
|
||||
struct mm_pb_manager *mm = mm_buf->mgr;
|
||||
@@ -170,15 +170,15 @@ mm_buffer_vtbl = {
|
||||
|
||||
static struct pb_buffer *
|
||||
mm_bufmgr_create_buffer(struct pb_manager *mgr,
|
||||
size_t size,
|
||||
pb_size size,
|
||||
const struct pb_desc *desc)
|
||||
{
|
||||
struct mm_pb_manager *mm = mm_pb_manager(mgr);
|
||||
struct mm_buffer *mm_buf;
|
||||
|
||||
/* We don't handle alignments larger then the one initially setup */
|
||||
assert(pb_check_alignment(desc->alignment, 1 << mm->align2));
|
||||
if(!pb_check_alignment(desc->alignment, 1 << mm->align2))
|
||||
assert(pb_check_alignment(desc->alignment, (pb_size)1 << mm->align2));
|
||||
if(!pb_check_alignment(desc->alignment, (pb_size)1 << mm->align2))
|
||||
return NULL;
|
||||
|
||||
pipe_mutex_lock(mm->mutex);
|
||||
@@ -198,10 +198,10 @@ mm_bufmgr_create_buffer(struct pb_manager *mgr,
|
||||
|
||||
mm_buf->mgr = mm;
|
||||
|
||||
mm_buf->block = u_mmAllocMem(mm->heap, size, mm->align2, 0);
|
||||
mm_buf->block = u_mmAllocMem(mm->heap, (int)size, (int)mm->align2, 0);
|
||||
if(!mm_buf->block) {
|
||||
debug_printf("warning: heap full\n");
|
||||
#if 0
|
||||
debug_printf("warning: heap full\n");
|
||||
mmDumpMemInfo(mm->heap);
|
||||
#endif
|
||||
FREE(mm_buf);
|
||||
@@ -210,8 +210,8 @@ mm_bufmgr_create_buffer(struct pb_manager *mgr,
|
||||
}
|
||||
|
||||
/* Some sanity checks */
|
||||
assert(0 <= (unsigned)mm_buf->block->ofs && (unsigned)mm_buf->block->ofs < mm->size);
|
||||
assert(size <= (unsigned)mm_buf->block->size && (unsigned)mm_buf->block->ofs + (unsigned)mm_buf->block->size <= mm->size);
|
||||
assert(0 <= (pb_size)mm_buf->block->ofs && (pb_size)mm_buf->block->ofs < mm->size);
|
||||
assert(size <= (pb_size)mm_buf->block->size && (pb_size)mm_buf->block->ofs + (pb_size)mm_buf->block->size <= mm->size);
|
||||
|
||||
pipe_mutex_unlock(mm->mutex);
|
||||
return SUPER(mm_buf);
|
||||
@@ -245,7 +245,7 @@ mm_bufmgr_destroy(struct pb_manager *mgr)
|
||||
|
||||
struct pb_manager *
|
||||
mm_bufmgr_create_from_buffer(struct pb_buffer *buffer,
|
||||
size_t size, size_t align2)
|
||||
pb_size size, pb_size align2)
|
||||
{
|
||||
struct mm_pb_manager *mm;
|
||||
|
||||
@@ -273,7 +273,7 @@ mm_bufmgr_create_from_buffer(struct pb_buffer *buffer,
|
||||
if(!mm->map)
|
||||
goto failure;
|
||||
|
||||
mm->heap = u_mmInit(0, size);
|
||||
mm->heap = u_mmInit(0, (int)size);
|
||||
if (!mm->heap)
|
||||
goto failure;
|
||||
|
||||
@@ -292,7 +292,7 @@ if(mm->heap)
|
||||
|
||||
struct pb_manager *
|
||||
mm_bufmgr_create(struct pb_manager *provider,
|
||||
size_t size, size_t align2)
|
||||
pb_size size, pb_size align2)
|
||||
{
|
||||
struct pb_buffer *buffer;
|
||||
struct pb_manager *mgr;
|
||||
|
@@ -55,7 +55,7 @@ struct pb_ondemand_buffer
|
||||
|
||||
/** Real buffer */
|
||||
struct pb_buffer *buffer;
|
||||
size_t size;
|
||||
pb_size size;
|
||||
struct pb_desc desc;
|
||||
};
|
||||
|
||||
@@ -204,7 +204,7 @@ pb_ondemand_buffer_fence(struct pb_buffer *_buf,
|
||||
static void
|
||||
pb_ondemand_buffer_get_base_buffer(struct pb_buffer *_buf,
|
||||
struct pb_buffer **base_buf,
|
||||
unsigned *offset)
|
||||
pb_size *offset)
|
||||
{
|
||||
struct pb_ondemand_buffer *buf = pb_ondemand_buffer(_buf);
|
||||
|
||||
@@ -232,7 +232,7 @@ pb_ondemand_buffer_vtbl = {
|
||||
|
||||
static struct pb_buffer *
|
||||
pb_ondemand_manager_create_buffer(struct pb_manager *_mgr,
|
||||
size_t size,
|
||||
pb_size size,
|
||||
const struct pb_desc *desc)
|
||||
{
|
||||
struct pb_ondemand_manager *mgr = pb_ondemand_manager(_mgr);
|
||||
|
@@ -58,11 +58,11 @@ struct pool_pb_manager
|
||||
|
||||
pipe_mutex mutex;
|
||||
|
||||
size_t bufSize;
|
||||
size_t bufAlign;
|
||||
pb_size bufSize;
|
||||
pb_size bufAlign;
|
||||
|
||||
size_t numFree;
|
||||
size_t numTot;
|
||||
pb_size numFree;
|
||||
pb_size numTot;
|
||||
|
||||
struct list_head free;
|
||||
|
||||
@@ -89,7 +89,7 @@ struct pool_buffer
|
||||
|
||||
struct list_head head;
|
||||
|
||||
size_t start;
|
||||
pb_size start;
|
||||
};
|
||||
|
||||
|
||||
@@ -162,7 +162,7 @@ pool_buffer_fence(struct pb_buffer *buf,
|
||||
static void
|
||||
pool_buffer_get_base_buffer(struct pb_buffer *buf,
|
||||
struct pb_buffer **base_buf,
|
||||
unsigned *offset)
|
||||
pb_size *offset)
|
||||
{
|
||||
struct pool_buffer *pool_buf = pool_buffer(buf);
|
||||
struct pool_pb_manager *pool = pool_buf->mgr;
|
||||
@@ -184,7 +184,7 @@ pool_buffer_vtbl = {
|
||||
|
||||
static struct pb_buffer *
|
||||
pool_bufmgr_create_buffer(struct pb_manager *mgr,
|
||||
size_t size,
|
||||
pb_size size,
|
||||
const struct pb_desc *desc)
|
||||
{
|
||||
struct pool_pb_manager *pool = pool_pb_manager(mgr);
|
||||
@@ -251,13 +251,13 @@ pool_bufmgr_destroy(struct pb_manager *mgr)
|
||||
|
||||
struct pb_manager *
|
||||
pool_bufmgr_create(struct pb_manager *provider,
|
||||
size_t numBufs,
|
||||
size_t bufSize,
|
||||
pb_size numBufs,
|
||||
pb_size bufSize,
|
||||
const struct pb_desc *desc)
|
||||
{
|
||||
struct pool_pb_manager *pool;
|
||||
struct pool_buffer *pool_buf;
|
||||
size_t i;
|
||||
pb_size i;
|
||||
|
||||
if(!provider)
|
||||
return NULL;
|
||||
|
@@ -68,7 +68,7 @@ struct pb_slab_buffer
|
||||
unsigned mapCount;
|
||||
|
||||
/** Offset relative to the start of the slab buffer. */
|
||||
size_t start;
|
||||
pb_size start;
|
||||
|
||||
/** Use when validating, to signal that all mappings are finished */
|
||||
/* TODO: Actually validation does not reach this stage yet */
|
||||
@@ -83,8 +83,8 @@ struct pb_slab
|
||||
{
|
||||
struct list_head head;
|
||||
struct list_head freeBuffers;
|
||||
size_t numBuffers;
|
||||
size_t numFree;
|
||||
pb_size numBuffers;
|
||||
pb_size numFree;
|
||||
|
||||
struct pb_slab_buffer *buffers;
|
||||
struct pb_slab_manager *mgr;
|
||||
@@ -108,10 +108,10 @@ struct pb_slab_manager
|
||||
struct pb_manager *provider;
|
||||
|
||||
/** Size of the buffers we hand on downstream */
|
||||
size_t bufSize;
|
||||
pb_size bufSize;
|
||||
|
||||
/** Size of the buffers we request upstream */
|
||||
size_t slabSize;
|
||||
pb_size slabSize;
|
||||
|
||||
/**
|
||||
* Alignment, usage to be used to allocate the slab buffers.
|
||||
@@ -150,14 +150,14 @@ struct pb_slab_range_manager
|
||||
|
||||
struct pb_manager *provider;
|
||||
|
||||
size_t minBufSize;
|
||||
size_t maxBufSize;
|
||||
pb_size minBufSize;
|
||||
pb_size maxBufSize;
|
||||
|
||||
/** @sa pb_slab_manager::desc */
|
||||
struct pb_desc desc;
|
||||
|
||||
unsigned numBuckets;
|
||||
size_t *bucketSizes;
|
||||
pb_size *bucketSizes;
|
||||
|
||||
/** Array of pb_slab_manager, one for each bucket size */
|
||||
struct pb_manager **buckets;
|
||||
@@ -270,7 +270,7 @@ pb_slab_buffer_fence(struct pb_buffer *_buf,
|
||||
static void
|
||||
pb_slab_buffer_get_base_buffer(struct pb_buffer *_buf,
|
||||
struct pb_buffer **base_buf,
|
||||
unsigned *offset)
|
||||
pb_size *offset)
|
||||
{
|
||||
struct pb_slab_buffer *buf = pb_slab_buffer(_buf);
|
||||
pb_get_base_buffer(buf->slab->bo, base_buf, offset);
|
||||
@@ -369,7 +369,7 @@ out_err0:
|
||||
|
||||
static struct pb_buffer *
|
||||
pb_slab_manager_create_buffer(struct pb_manager *_mgr,
|
||||
size_t size,
|
||||
pb_size size,
|
||||
const struct pb_desc *desc)
|
||||
{
|
||||
struct pb_slab_manager *mgr = pb_slab_manager(_mgr);
|
||||
@@ -450,8 +450,8 @@ pb_slab_manager_destroy(struct pb_manager *_mgr)
|
||||
|
||||
struct pb_manager *
|
||||
pb_slab_manager_create(struct pb_manager *provider,
|
||||
size_t bufSize,
|
||||
size_t slabSize,
|
||||
pb_size bufSize,
|
||||
pb_size slabSize,
|
||||
const struct pb_desc *desc)
|
||||
{
|
||||
struct pb_slab_manager *mgr;
|
||||
@@ -479,11 +479,11 @@ pb_slab_manager_create(struct pb_manager *provider,
|
||||
|
||||
static struct pb_buffer *
|
||||
pb_slab_range_manager_create_buffer(struct pb_manager *_mgr,
|
||||
size_t size,
|
||||
pb_size size,
|
||||
const struct pb_desc *desc)
|
||||
{
|
||||
struct pb_slab_range_manager *mgr = pb_slab_range_manager(_mgr);
|
||||
size_t bufSize;
|
||||
pb_size bufSize;
|
||||
unsigned i;
|
||||
|
||||
bufSize = mgr->minBufSize;
|
||||
@@ -527,13 +527,13 @@ pb_slab_range_manager_destroy(struct pb_manager *_mgr)
|
||||
|
||||
struct pb_manager *
|
||||
pb_slab_range_manager_create(struct pb_manager *provider,
|
||||
size_t minBufSize,
|
||||
size_t maxBufSize,
|
||||
size_t slabSize,
|
||||
pb_size minBufSize,
|
||||
pb_size maxBufSize,
|
||||
pb_size slabSize,
|
||||
const struct pb_desc *desc)
|
||||
{
|
||||
struct pb_slab_range_manager *mgr;
|
||||
size_t bufSize;
|
||||
pb_size bufSize;
|
||||
unsigned i;
|
||||
|
||||
if(!provider)
|
||||
|
@@ -168,7 +168,7 @@ ppc_allocate_register(struct ppc_function *p)
|
||||
{
|
||||
unsigned i;
|
||||
for (i = 0; i < PPC_NUM_REGS; i++) {
|
||||
const uint64_t mask = 1 << i;
|
||||
const uint32_t mask = 1 << i;
|
||||
if ((p->reg_used & mask) == 0) {
|
||||
p->reg_used |= mask;
|
||||
return i;
|
||||
@@ -200,7 +200,7 @@ ppc_allocate_fp_register(struct ppc_function *p)
|
||||
{
|
||||
unsigned i;
|
||||
for (i = 0; i < PPC_NUM_FP_REGS; i++) {
|
||||
const uint64_t mask = 1 << i;
|
||||
const uint32_t mask = 1 << i;
|
||||
if ((p->fp_used & mask) == 0) {
|
||||
p->fp_used |= mask;
|
||||
return i;
|
||||
@@ -232,7 +232,7 @@ ppc_allocate_vec_register(struct ppc_function *p)
|
||||
{
|
||||
unsigned i;
|
||||
for (i = 0; i < PPC_NUM_VEC_REGS; i++) {
|
||||
const uint64_t mask = 1 << i;
|
||||
const uint32_t mask = 1 << i;
|
||||
if ((p->vec_used & mask) == 0) {
|
||||
p->vec_used |= mask;
|
||||
return i;
|
||||
|
@@ -27,6 +27,7 @@
|
||||
|
||||
#include "util/u_debug.h"
|
||||
#include "util/u_string.h"
|
||||
#include "util/u_math.h"
|
||||
#include "tgsi_dump.h"
|
||||
#include "tgsi_info.h"
|
||||
#include "tgsi_iterate.h"
|
||||
@@ -516,7 +517,7 @@ struct str_dump_ctx
|
||||
struct dump_ctx base;
|
||||
char *str;
|
||||
char *ptr;
|
||||
size_t left;
|
||||
int left;
|
||||
};
|
||||
|
||||
static void
|
||||
@@ -525,13 +526,20 @@ str_dump_ctx_printf(struct dump_ctx *ctx, const char *format, ...)
|
||||
struct str_dump_ctx *sctx = (struct str_dump_ctx *)ctx;
|
||||
|
||||
if(sctx->left > 1) {
|
||||
size_t written;
|
||||
int written;
|
||||
va_list ap;
|
||||
va_start(ap, format);
|
||||
written = util_vsnprintf(sctx->ptr, sctx->left, format, ap);
|
||||
va_end(ap);
|
||||
sctx->ptr += written;
|
||||
sctx->left -= written;
|
||||
|
||||
/* Some complicated logic needed to handle the return value of
|
||||
* vsnprintf:
|
||||
*/
|
||||
if (written > 0) {
|
||||
written = MIN2(sctx->left, written);
|
||||
sctx->ptr += written;
|
||||
sctx->left -= written;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -556,7 +564,7 @@ tgsi_dump_str(
|
||||
ctx.str = str;
|
||||
ctx.str[0] = 0;
|
||||
ctx.ptr = str;
|
||||
ctx.left = size;
|
||||
ctx.left = (int)size;
|
||||
|
||||
tgsi_iterate_shader( tokens, &ctx.base.iter );
|
||||
}
|
||||
|
@@ -34,7 +34,7 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define MAX_LABELS 1024
|
||||
#define MAX_LABELS (4 * 1024) /**< basically, max instructions */
|
||||
|
||||
#define NUM_CHANNELS 4 /* R,G,B,A */
|
||||
#define QUAD_SIZE 4 /* 4 pixel/quad */
|
||||
|
@@ -1385,7 +1385,7 @@ set_vertex_data(struct gen_mipmap_state *ctx,
|
||||
* 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 scale = 0.9999f;
|
||||
const float sc = (2.0f * st[i][0] - 1.0f) * scale;
|
||||
const float tc = (2.0f * st[i][1] - 1.0f) * scale;
|
||||
|
||||
|
@@ -829,7 +829,7 @@ util_vsnprintf(char *str, size_t size, const char *format, va_list args)
|
||||
break;
|
||||
default:
|
||||
intptr = va_arg(args, int *);
|
||||
*intptr = len;
|
||||
*intptr = (int)len;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
@@ -1126,7 +1126,22 @@ pipe_get_tile_z(struct pipe_transfer *pt,
|
||||
for (i = 0; i < h; i++) {
|
||||
for (j = 0; j < w; j++) {
|
||||
/* convert 24-bit Z to 32-bit Z */
|
||||
pDest[j] = (ptrc[j] << 8) | (ptrc[j] & 0xff);
|
||||
pDest[j] = (ptrc[j] << 8) | ((ptrc[j] >> 16) & 0xff);
|
||||
}
|
||||
pDest += dstStride;
|
||||
ptrc += pt->stride/4;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case PIPE_FORMAT_Z24S8_UNORM:
|
||||
case PIPE_FORMAT_Z24X8_UNORM:
|
||||
{
|
||||
const uint *ptrc
|
||||
= (const uint *)(map + y * pt->stride + x*4);
|
||||
for (i = 0; i < h; i++) {
|
||||
for (j = 0; j < w; j++) {
|
||||
/* convert 24-bit Z to 32-bit Z */
|
||||
pDest[j] = (ptrc[j] & 0xffffff00) | ((ptrc[j] >> 24) & 0xff);
|
||||
}
|
||||
pDest += dstStride;
|
||||
ptrc += pt->stride/4;
|
||||
|
@@ -86,6 +86,8 @@ cell_get_param(struct pipe_screen *screen, int param)
|
||||
return 1; /* XXX not really true */
|
||||
case PIPE_CAP_TEXTURE_MIRROR_CLAMP:
|
||||
return 0; /* XXX to do */
|
||||
case PIPE_CAP_TGSI_CONT_SUPPORTED:
|
||||
return 1;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
|
@@ -126,6 +126,22 @@ softpipe_is_texture_referenced( struct pipe_context *pipe,
|
||||
struct pipe_texture *texture,
|
||||
unsigned face, unsigned level)
|
||||
{
|
||||
struct softpipe_context *softpipe = softpipe_context( pipe );
|
||||
unsigned i;
|
||||
|
||||
if(softpipe->dirty_render_cache) {
|
||||
for (i = 0; i < softpipe->framebuffer.nr_cbufs; i++) {
|
||||
if(softpipe->framebuffer.cbufs[i] &&
|
||||
softpipe->framebuffer.cbufs[i]->texture == texture)
|
||||
return PIPE_REFERENCED_FOR_WRITE;
|
||||
}
|
||||
if(softpipe->framebuffer.zsbuf &&
|
||||
softpipe->framebuffer.zsbuf->texture == texture)
|
||||
return PIPE_REFERENCED_FOR_WRITE;
|
||||
}
|
||||
|
||||
/* FIXME: we also need to do the same for the texture cache */
|
||||
|
||||
return PIPE_UNREFERENCED;
|
||||
}
|
||||
|
||||
|
@@ -144,6 +144,8 @@ struct softpipe_context {
|
||||
struct draw_stage *vbuf;
|
||||
struct softpipe_vbuf_render *vbuf_render;
|
||||
|
||||
boolean dirty_render_cache;
|
||||
|
||||
struct softpipe_tile_cache *cbuf_cache[PIPE_MAX_COLOR_BUFS];
|
||||
struct softpipe_tile_cache *zsbuf_cache;
|
||||
|
||||
|
@@ -182,6 +182,8 @@ softpipe_draw_range_elements(struct pipe_context *pipe,
|
||||
/* Note: leave drawing surfaces mapped */
|
||||
softpipe_unmap_constant_buffers(sp);
|
||||
|
||||
sp->dirty_render_cache = TRUE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@@ -71,6 +71,8 @@ softpipe_flush( struct pipe_context *pipe,
|
||||
* to unmap surfaces when flushing.
|
||||
*/
|
||||
softpipe_unmap_transfers(softpipe);
|
||||
|
||||
softpipe->dirty_render_cache = FALSE;
|
||||
}
|
||||
|
||||
/* Enable to dump BMPs of the color/depth buffers each frame */
|
||||
|
@@ -236,7 +236,6 @@ sp_vbuf_draw(struct vbuf_render *vbr, const ushort *indices, uint nr)
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case PIPE_PRIM_TRIANGLES:
|
||||
for (i = 2; i < nr; i += 3) {
|
||||
setup_tri( setup_ctx,
|
||||
@@ -256,7 +255,6 @@ sp_vbuf_draw(struct vbuf_render *vbr, const ushort *indices, uint nr)
|
||||
break;
|
||||
|
||||
case PIPE_PRIM_TRIANGLE_FAN:
|
||||
case PIPE_PRIM_POLYGON:
|
||||
for (i = 2; i < nr; i += 1) {
|
||||
setup_tri( setup_ctx,
|
||||
get_vert(vertex_buffer, indices[0], stride),
|
||||
@@ -264,6 +262,7 @@ sp_vbuf_draw(struct vbuf_render *vbr, const ushort *indices, uint nr)
|
||||
get_vert(vertex_buffer, indices[i-0], stride));
|
||||
}
|
||||
break;
|
||||
|
||||
case PIPE_PRIM_QUADS:
|
||||
for (i = 3; i < nr; i += 4) {
|
||||
setup_tri( setup_ctx,
|
||||
@@ -277,6 +276,7 @@ sp_vbuf_draw(struct vbuf_render *vbr, const ushort *indices, uint nr)
|
||||
get_vert(vertex_buffer, indices[i-0], stride));
|
||||
}
|
||||
break;
|
||||
|
||||
case PIPE_PRIM_QUAD_STRIP:
|
||||
for (i = 3; i < nr; i += 2) {
|
||||
setup_tri( setup_ctx,
|
||||
@@ -290,6 +290,16 @@ sp_vbuf_draw(struct vbuf_render *vbr, const ushort *indices, uint nr)
|
||||
get_vert(vertex_buffer, indices[i-0], stride));
|
||||
}
|
||||
break;
|
||||
|
||||
case PIPE_PRIM_POLYGON:
|
||||
for (i = 2; i < nr; i += 1) {
|
||||
setup_tri( setup_ctx,
|
||||
get_vert(vertex_buffer, indices[0-1], stride),
|
||||
get_vert(vertex_buffer, indices[i-0], stride),
|
||||
get_vert(vertex_buffer, indices[0], stride));
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
assert(0);
|
||||
}
|
||||
@@ -378,7 +388,6 @@ sp_vbuf_draw_arrays(struct vbuf_render *vbr, uint start, uint nr)
|
||||
break;
|
||||
|
||||
case PIPE_PRIM_TRIANGLE_FAN:
|
||||
case PIPE_PRIM_POLYGON:
|
||||
for (i = 2; i < nr; i += 1) {
|
||||
setup_tri( setup_ctx,
|
||||
get_vert(vertex_buffer, 0, stride),
|
||||
@@ -386,6 +395,7 @@ sp_vbuf_draw_arrays(struct vbuf_render *vbr, uint start, uint nr)
|
||||
get_vert(vertex_buffer, i-0, stride));
|
||||
}
|
||||
break;
|
||||
|
||||
case PIPE_PRIM_QUADS:
|
||||
for (i = 3; i < nr; i += 4) {
|
||||
setup_tri( setup_ctx,
|
||||
@@ -412,6 +422,20 @@ sp_vbuf_draw_arrays(struct vbuf_render *vbr, uint start, uint nr)
|
||||
get_vert(vertex_buffer, i-0, stride));
|
||||
}
|
||||
break;
|
||||
|
||||
case PIPE_PRIM_POLYGON:
|
||||
/* Almost same as tri fan but the _first_ vertex specifies the flat
|
||||
* shading color. Note that the first polygon vertex is passed as
|
||||
* the last triangle vertex here.
|
||||
*/
|
||||
for (i = 2; i < nr; i += 1) {
|
||||
setup_tri( setup_ctx,
|
||||
get_vert(vertex_buffer, i-1, stride),
|
||||
get_vert(vertex_buffer, i-0, stride),
|
||||
get_vert(vertex_buffer, 0, stride));
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
assert(0);
|
||||
}
|
||||
|
@@ -87,6 +87,8 @@ softpipe_get_param(struct pipe_screen *screen, int param)
|
||||
return 8; /* max 128x128x128 */
|
||||
case PIPE_CAP_MAX_TEXTURE_CUBE_LEVELS:
|
||||
return 12; /* max 2Kx2K */
|
||||
case PIPE_CAP_TGSI_CONT_SUPPORTED:
|
||||
return 1;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
@@ -127,6 +129,11 @@ softpipe_is_format_supported( struct pipe_screen *screen,
|
||||
unsigned tex_usage,
|
||||
unsigned geom_flags )
|
||||
{
|
||||
assert(target == PIPE_TEXTURE_1D ||
|
||||
target == PIPE_TEXTURE_2D ||
|
||||
target == PIPE_TEXTURE_3D ||
|
||||
target == PIPE_TEXTURE_CUBE);
|
||||
|
||||
switch(format) {
|
||||
case PIPE_FORMAT_DXT1_RGB:
|
||||
case PIPE_FORMAT_DXT1_RGBA:
|
||||
|
@@ -444,7 +444,8 @@ static void flush_spans( struct setup_context *setup )
|
||||
mask |= MASK_TOP_RIGHT;
|
||||
if (x+1 >= xleft1 && x+1 < xright1)
|
||||
mask |= MASK_BOTTOM_RIGHT;
|
||||
EMIT_QUAD( setup, x, setup->span.y, mask );
|
||||
if (mask)
|
||||
EMIT_QUAD( setup, x, setup->span.y, mask );
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -458,7 +459,8 @@ static void flush_spans( struct setup_context *setup )
|
||||
mask |= MASK_TOP_LEFT;
|
||||
if (x+1 >= xleft0 && x+1 < xright0)
|
||||
mask |= MASK_TOP_RIGHT;
|
||||
EMIT_QUAD( setup, x, setup->span.y, mask );
|
||||
if (mask)
|
||||
EMIT_QUAD( setup, x, setup->span.y, mask );
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -472,7 +474,8 @@ static void flush_spans( struct setup_context *setup )
|
||||
mask |= MASK_BOTTOM_LEFT;
|
||||
if (x+1 >= xleft1 && x+1 < xright1)
|
||||
mask |= MASK_BOTTOM_RIGHT;
|
||||
EMIT_QUAD( setup, x, setup->span.y, mask );
|
||||
if (mask)
|
||||
EMIT_QUAD( setup, x, setup->span.y, mask );
|
||||
}
|
||||
break;
|
||||
|
||||
|
@@ -744,7 +744,9 @@ shadow_compare(uint compare_func,
|
||||
break;
|
||||
}
|
||||
|
||||
/* XXX returning result for default GL_DEPTH_TEXTURE_MODE = GL_LUMINANCE */
|
||||
rgba[0][j] = rgba[1][j] = rgba[2][j] = (float) k;
|
||||
rgba[3][j] = 1.0F;
|
||||
}
|
||||
|
||||
|
||||
|
@@ -451,11 +451,11 @@ void trace_dump_float(double value)
|
||||
}
|
||||
|
||||
void trace_dump_bytes(const void *data,
|
||||
long unsigned size)
|
||||
size_t size)
|
||||
{
|
||||
static const char hex_table[16] = "0123456789ABCDEF";
|
||||
const uint8_t *p = data;
|
||||
long unsigned i;
|
||||
size_t i;
|
||||
|
||||
if (!dumping)
|
||||
return;
|
||||
|
@@ -91,7 +91,7 @@ void trace_dump_bool(int value);
|
||||
void trace_dump_int(long long int value);
|
||||
void trace_dump_uint(long long unsigned value);
|
||||
void trace_dump_float(double value);
|
||||
void trace_dump_bytes(const void *data, long unsigned size);
|
||||
void trace_dump_bytes(const void *data, size_t size);
|
||||
void trace_dump_string(const char *str);
|
||||
void trace_dump_enum(const char *value);
|
||||
void trace_dump_array_begin(void);
|
||||
@@ -130,7 +130,7 @@ void trace_dump_transfer_ptr(struct pipe_transfer *_transfer);
|
||||
|
||||
#define trace_dump_array(_type, _obj, _size) \
|
||||
do { \
|
||||
unsigned long idx; \
|
||||
size_t idx; \
|
||||
trace_dump_array_begin(); \
|
||||
for(idx = 0; idx < (_size); ++idx) { \
|
||||
trace_dump_elem_begin(); \
|
||||
@@ -142,7 +142,7 @@ void trace_dump_transfer_ptr(struct pipe_transfer *_transfer);
|
||||
|
||||
#define trace_dump_struct_array(_type, _obj, _size) \
|
||||
do { \
|
||||
unsigned long idx; \
|
||||
size_t idx; \
|
||||
trace_dump_array_begin(); \
|
||||
for(idx = 0; idx < (_size); ++idx) { \
|
||||
trace_dump_elem_begin(); \
|
||||
|
@@ -310,6 +310,7 @@ enum pipe_transfer_usage {
|
||||
#define PIPE_CAP_TEXTURE_MIRROR_CLAMP 24
|
||||
#define PIPE_CAP_TEXTURE_MIRROR_REPEAT 25
|
||||
#define PIPE_CAP_MAX_VERTEX_TEXTURE_UNITS 26
|
||||
#define PIPE_CAP_TGSI_CONT_SUPPORTED 27
|
||||
|
||||
|
||||
/**
|
||||
|
@@ -536,13 +536,39 @@ pf_get_nblocks(const struct pipe_format_block *block, unsigned width, unsigned h
|
||||
return pf_get_nblocksx(block, width)*pf_get_nblocksy(block, height);
|
||||
}
|
||||
|
||||
static INLINE size_t
|
||||
pf_get_stride(const struct pipe_format_block *block, unsigned width)
|
||||
{
|
||||
return pf_get_nblocksx(block, width)*block->size;
|
||||
}
|
||||
|
||||
static INLINE size_t
|
||||
pf_get_2d_size(const struct pipe_format_block *block, size_t stride, unsigned height)
|
||||
{
|
||||
return pf_get_nblocksy(block, height)*stride;
|
||||
}
|
||||
|
||||
static INLINE boolean
|
||||
pf_is_depth_stencil( enum pipe_format format )
|
||||
pf_is_depth_or_stencil( enum pipe_format format )
|
||||
{
|
||||
return (pf_get_component_bits( format, PIPE_FORMAT_COMP_Z ) +
|
||||
pf_get_component_bits( format, PIPE_FORMAT_COMP_S )) != 0;
|
||||
}
|
||||
|
||||
static INLINE boolean
|
||||
pf_is_depth_and_stencil( enum pipe_format format )
|
||||
{
|
||||
return (pf_get_component_bits( format, PIPE_FORMAT_COMP_Z ) != 0 &&
|
||||
pf_get_component_bits( format, PIPE_FORMAT_COMP_S ) != 0);
|
||||
}
|
||||
|
||||
/** DEPRECATED: For backwards compatibility */
|
||||
static INLINE boolean
|
||||
pf_is_depth_stencil( enum pipe_format format )
|
||||
{
|
||||
return pf_is_depth_or_stencil( format );
|
||||
}
|
||||
|
||||
static INLINE boolean
|
||||
pf_is_compressed( enum pipe_format format )
|
||||
{
|
||||
|
@@ -62,29 +62,29 @@ pipe_is_referenced(struct pipe_reference *reference)
|
||||
* Set 'ptr' to point to 'reference' and update reference counting.
|
||||
* The old thing pointed to, if any, will be unreferenced first.
|
||||
* 'reference' may be NULL.
|
||||
*
|
||||
* XXX: thread safety issues!
|
||||
*/
|
||||
static INLINE bool
|
||||
pipe_reference(struct pipe_reference **ptr, struct pipe_reference *reference)
|
||||
{
|
||||
bool destroy = FALSE;
|
||||
|
||||
/* bump the reference.count first */
|
||||
if (reference) {
|
||||
assert(pipe_is_referenced(reference));
|
||||
p_atomic_inc(&reference->count);
|
||||
}
|
||||
|
||||
if (*ptr) {
|
||||
assert(pipe_is_referenced(*ptr));
|
||||
if (p_atomic_dec_zero(&(*ptr)->count)) {
|
||||
destroy = TRUE;
|
||||
if(*ptr != reference) {
|
||||
/* bump the reference.count first */
|
||||
if (reference) {
|
||||
assert(pipe_is_referenced(reference));
|
||||
p_atomic_inc(&reference->count);
|
||||
}
|
||||
|
||||
if (*ptr) {
|
||||
assert(pipe_is_referenced(*ptr));
|
||||
if (p_atomic_dec_zero(&(*ptr)->count)) {
|
||||
destroy = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
*ptr = reference;
|
||||
}
|
||||
|
||||
*ptr = reference;
|
||||
|
||||
return destroy;
|
||||
}
|
||||
|
||||
|
@@ -36,6 +36,7 @@
|
||||
|
||||
|
||||
#include "pipe/p_compiler.h"
|
||||
#include "util/u_debug.h" /* for assert */
|
||||
|
||||
|
||||
#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS)
|
||||
|
@@ -231,7 +231,6 @@ dri_create_buffer(__DRIscreenPrivate * sPriv,
|
||||
if (visual->depthBits) {
|
||||
if (pscreen->is_format_supported(pscreen, PIPE_FORMAT_Z24S8_UNORM,
|
||||
PIPE_TEXTURE_2D,
|
||||
PIPE_TEXTURE_USAGE_RENDER_TARGET |
|
||||
PIPE_TEXTURE_USAGE_DEPTH_STENCIL, 0))
|
||||
depthFormat = PIPE_FORMAT_Z24S8_UNORM;
|
||||
else
|
||||
@@ -242,7 +241,6 @@ dri_create_buffer(__DRIscreenPrivate * sPriv,
|
||||
if (visual->stencilBits) {
|
||||
if (pscreen->is_format_supported(pscreen, PIPE_FORMAT_Z24S8_UNORM,
|
||||
PIPE_TEXTURE_2D,
|
||||
PIPE_TEXTURE_USAGE_RENDER_TARGET |
|
||||
PIPE_TEXTURE_USAGE_DEPTH_STENCIL, 0))
|
||||
stencilFormat = PIPE_FORMAT_Z24S8_UNORM;
|
||||
else
|
||||
|
@@ -1817,7 +1817,7 @@ Fake_glXCreatePixmap( Display *dpy, GLXFBConfig config, Pixmap pixmap,
|
||||
if (!dpy || !config || !pixmap)
|
||||
return 0;
|
||||
|
||||
for (attr = attribList; *attr; attr++) {
|
||||
for (attr = attribList; attr && *attr; attr++) {
|
||||
switch (*attr) {
|
||||
case GLX_TEXTURE_FORMAT_EXT:
|
||||
attr++;
|
||||
|
@@ -43,19 +43,27 @@ except ImportError:
|
||||
return struct.unpack(fmt, buf[offset:offset + size])
|
||||
|
||||
|
||||
def make_image(surface):
|
||||
def make_image(surface, x=None, y=None, w=None, h=None):
|
||||
if x is None:
|
||||
x = 0
|
||||
if y is None:
|
||||
y = 0
|
||||
if w is None:
|
||||
w = surface.width - x
|
||||
if h is None:
|
||||
h = surface.height - y
|
||||
data = surface.get_tile_rgba8(0, 0, surface.width, surface.height)
|
||||
|
||||
import Image
|
||||
outimage = Image.fromstring('RGBA', (surface.width, surface.height), data, "raw", 'RGBA', 0, 1)
|
||||
return outimage
|
||||
|
||||
def save_image(filename, surface):
|
||||
outimage = make_image(surface)
|
||||
def save_image(filename, surface, x=None, y=None, w=None, h=None):
|
||||
outimage = make_image(surface, x, y, w, h)
|
||||
outimage.save(filename, "PNG")
|
||||
|
||||
def show_image(surface, title):
|
||||
outimage = make_image(surface)
|
||||
def show_image(surface, title, x=None, y=None, w=None, h=None):
|
||||
outimage = make_image(surface, x, y, w, h)
|
||||
|
||||
import Tkinter as tk
|
||||
from PIL import Image, ImageTk
|
||||
@@ -305,7 +313,11 @@ class Screen(Object):
|
||||
def get_tex_transfer(self, texture, face, level, zslice, usage, x, y, w, h):
|
||||
if texture is None:
|
||||
return None
|
||||
return Transfer(texture.get_surface(face, level, zslice), x, y, w, h)
|
||||
transfer = Transfer(texture.get_surface(face, level, zslice), x, y, w, h)
|
||||
if transfer and usage != gallium.PIPE_TRANSFER_WRITE:
|
||||
if self.interpreter.options.all:
|
||||
self.interpreter.present(transfer.surface, 'transf_read', x, y, w, h)
|
||||
return transfer
|
||||
|
||||
def tex_transfer_destroy(self, transfer):
|
||||
self.interpreter.unregister_object(transfer)
|
||||
@@ -314,6 +326,8 @@ class Screen(Object):
|
||||
if transfer is None:
|
||||
return
|
||||
transfer.surface.put_tile_raw(transfer.x, transfer.y, transfer.w, transfer.h, data, stride)
|
||||
if self.interpreter.options.all:
|
||||
self.interpreter.present(transfer.surface, 'transf_write', transfer.x, transfer.y, transfer.w, transfer.h)
|
||||
|
||||
def user_buffer_create(self, data, size):
|
||||
# We don't really care to distinguish between user and regular buffers
|
||||
@@ -577,6 +591,14 @@ class Context(Object):
|
||||
self.real.draw_range_elements(indexBuffer, indexSize, minIndex, maxIndex, mode, start, count)
|
||||
self._set_dirty()
|
||||
|
||||
def is_texture_referenced(self, texture, face, level):
|
||||
#return self.real.is_texture_referenced(format, texture, face, level)
|
||||
pass
|
||||
|
||||
def is_buffer_referenced(self, buf):
|
||||
#return self.real.is_buffer_referenced(format, buf)
|
||||
pass
|
||||
|
||||
def _set_dirty(self):
|
||||
if self.interpreter.options.step:
|
||||
self._present()
|
||||
@@ -602,6 +624,9 @@ class Context(Object):
|
||||
|
||||
if self.cbufs and self.cbufs[0]:
|
||||
self.interpreter.present(self.cbufs[0], "cbuf")
|
||||
if self.zsbuf:
|
||||
if self.interpreter.options.all:
|
||||
self.interpreter.present(self.zsbuf, "zsbuf")
|
||||
|
||||
|
||||
class Interpreter(parser.TraceDumper):
|
||||
@@ -671,16 +696,16 @@ class Interpreter(parser.TraceDumper):
|
||||
def verbosity(self, level):
|
||||
return self.options.verbosity >= level
|
||||
|
||||
def present(self, surface, description):
|
||||
def present(self, surface, description, x=None, y=None, w=None, h=None):
|
||||
if self.call_no < self.options.start:
|
||||
return
|
||||
|
||||
if self.options.images:
|
||||
filename = '%s_%04u.png' % (description, self.call_no)
|
||||
save_image(filename, surface)
|
||||
filename = '%04u_%s.png' % (self.call_no, description)
|
||||
save_image(filename, surface, x, y, w, h)
|
||||
else:
|
||||
title = '%u. %s' % (self.call_no, description)
|
||||
show_image(surface, title)
|
||||
show_image(surface, title, x, y, w, h)
|
||||
|
||||
|
||||
class Main(parser.Main):
|
||||
@@ -690,6 +715,7 @@ class Main(parser.Main):
|
||||
optparser.add_option("-q", "--quiet", action="store_const", const=0, dest="verbosity", help="no messages")
|
||||
optparser.add_option("-v", "--verbose", action="count", dest="verbosity", default=1, help="increase verbosity level")
|
||||
optparser.add_option("-i", "--images", action="store_true", dest="images", default=False, help="save images instead of showing them")
|
||||
optparser.add_option("-a", "--all", action="store_true", dest="all", default=False, help="show depth, stencil, and transfers")
|
||||
optparser.add_option("-s", "--step", action="store_true", dest="step", default=False, help="step trhough every draw")
|
||||
optparser.add_option("-f", "--from", action="store", type="int", dest="start", default=0, help="from call no")
|
||||
optparser.add_option("-t", "--to", action="store", type="int", dest="stop", default=0, help="until call no")
|
||||
|
@@ -46,6 +46,14 @@ for name, value in globals().items():
|
||||
if name.startswith("PIPE_FORMAT_") and isinstance(value, int):
|
||||
formats[value] = name
|
||||
|
||||
def is_depth_stencil_format(format):
|
||||
# FIXME: make and use binding to pf_is_depth_stencil
|
||||
return format in (
|
||||
PIPE_FORMAT_Z32_UNORM,
|
||||
PIPE_FORMAT_Z24S8_UNORM,
|
||||
PIPE_FORMAT_Z24X8_UNORM,
|
||||
PIPE_FORMAT_Z16_UNORM,
|
||||
)
|
||||
|
||||
def make_image(width, height, rgba):
|
||||
import Image
|
||||
|
@@ -99,7 +99,7 @@ def is_pot(n):
|
||||
return n & (n - 1) == 0
|
||||
|
||||
|
||||
class TextureTest(TestCase):
|
||||
class TextureColorSampleTest(TestCase):
|
||||
|
||||
tags = (
|
||||
'target',
|
||||
@@ -286,6 +286,206 @@ class TextureTest(TestCase):
|
||||
self.assert_rgba(cbuf, x, y, w, h, expected_rgba, 4.0/256, 0.85)
|
||||
|
||||
|
||||
class TextureDepthSampleTest(TestCase):
|
||||
|
||||
tags = (
|
||||
'target',
|
||||
'format',
|
||||
'width',
|
||||
'height',
|
||||
'depth',
|
||||
'last_level',
|
||||
'face',
|
||||
'level',
|
||||
'zslice',
|
||||
)
|
||||
|
||||
def test(self):
|
||||
dev = self.dev
|
||||
|
||||
target = self.target
|
||||
format = self.format
|
||||
width = self.width
|
||||
height = self.height
|
||||
depth = self.depth
|
||||
last_level = self.last_level
|
||||
face = self.face
|
||||
level = self.level
|
||||
zslice = self.zslice
|
||||
|
||||
tex_usage = PIPE_TEXTURE_USAGE_SAMPLER
|
||||
geom_flags = 0
|
||||
if width != height:
|
||||
geom_flags |= PIPE_TEXTURE_GEOM_NON_SQUARE
|
||||
if not is_pot(width) or not is_pot(height) or not is_pot(depth):
|
||||
geom_flags |= PIPE_TEXTURE_GEOM_NON_POWER_OF_TWO
|
||||
|
||||
if not dev.is_format_supported(format, target, tex_usage, geom_flags):
|
||||
raise TestSkip
|
||||
|
||||
ctx = self.dev.context_create()
|
||||
|
||||
# disabled blending/masking
|
||||
blend = Blend()
|
||||
blend.rgb_src_factor = PIPE_BLENDFACTOR_ONE
|
||||
blend.alpha_src_factor = PIPE_BLENDFACTOR_ONE
|
||||
blend.rgb_dst_factor = PIPE_BLENDFACTOR_ZERO
|
||||
blend.alpha_dst_factor = PIPE_BLENDFACTOR_ZERO
|
||||
blend.colormask = PIPE_MASK_RGBA
|
||||
ctx.set_blend(blend)
|
||||
|
||||
# depth/stencil/alpha
|
||||
depth_stencil_alpha = DepthStencilAlpha()
|
||||
depth_stencil_alpha.depth.enabled = 1
|
||||
depth_stencil_alpha.depth.writemask = 1
|
||||
depth_stencil_alpha.depth.func = PIPE_FUNC_LESS
|
||||
ctx.set_depth_stencil_alpha(depth_stencil_alpha)
|
||||
|
||||
# rasterizer
|
||||
rasterizer = Rasterizer()
|
||||
rasterizer.front_winding = PIPE_WINDING_CW
|
||||
rasterizer.cull_mode = PIPE_WINDING_NONE
|
||||
rasterizer.bypass_vs_clip_and_viewport = 1
|
||||
ctx.set_rasterizer(rasterizer)
|
||||
|
||||
# samplers
|
||||
sampler = Sampler()
|
||||
sampler.wrap_s = PIPE_TEX_WRAP_CLAMP_TO_EDGE
|
||||
sampler.wrap_t = PIPE_TEX_WRAP_CLAMP_TO_EDGE
|
||||
sampler.wrap_r = PIPE_TEX_WRAP_CLAMP_TO_EDGE
|
||||
sampler.min_mip_filter = PIPE_TEX_MIPFILTER_NEAREST
|
||||
sampler.min_img_filter = PIPE_TEX_MIPFILTER_NEAREST
|
||||
sampler.mag_img_filter = PIPE_TEX_MIPFILTER_NEAREST
|
||||
sampler.normalized_coords = 1
|
||||
sampler.min_lod = 0
|
||||
sampler.max_lod = PIPE_MAX_TEXTURE_LEVELS - 1
|
||||
ctx.set_sampler(0, sampler)
|
||||
|
||||
# texture
|
||||
texture = dev.texture_create(
|
||||
target = target,
|
||||
format = format,
|
||||
width = width,
|
||||
height = height,
|
||||
depth = depth,
|
||||
last_level = last_level,
|
||||
tex_usage = tex_usage,
|
||||
)
|
||||
|
||||
expected_rgba = FloatArray(height*width*4)
|
||||
texture.get_surface(
|
||||
face = face,
|
||||
level = level,
|
||||
zslice = zslice,
|
||||
).sample_rgba(expected_rgba)
|
||||
|
||||
ctx.set_sampler_texture(0, texture)
|
||||
|
||||
# framebuffer
|
||||
cbuf_tex = dev.texture_create(
|
||||
PIPE_FORMAT_A8R8G8B8_UNORM,
|
||||
width,
|
||||
height,
|
||||
tex_usage = PIPE_TEXTURE_USAGE_RENDER_TARGET,
|
||||
)
|
||||
|
||||
zsbuf_tex = dev.texture_create(
|
||||
PIPE_FORMAT_Z24X8_UNORM,
|
||||
width,
|
||||
height,
|
||||
tex_usage = PIPE_TEXTURE_USAGE_RENDER_TARGET,
|
||||
)
|
||||
|
||||
cbuf = cbuf_tex.get_surface()
|
||||
zsbuf = zsbuf_tex.get_surface()
|
||||
fb = Framebuffer()
|
||||
fb.width = width
|
||||
fb.height = height
|
||||
fb.nr_cbufs = 1
|
||||
fb.set_cbuf(0, cbuf)
|
||||
fb.set_zsbuf(zsbuf)
|
||||
ctx.set_framebuffer(fb)
|
||||
rgba = FloatArray(4);
|
||||
rgba[0] = 0.5
|
||||
rgba[1] = 0.5
|
||||
rgba[2] = 0.5
|
||||
rgba[3] = 0.5
|
||||
ctx.clear(PIPE_CLEAR_DEPTHSTENCIL, rgba, 1.0, 0)
|
||||
del fb
|
||||
|
||||
# vertex shader
|
||||
vs = Shader('''
|
||||
VERT1.1
|
||||
DCL IN[0], POSITION, CONSTANT
|
||||
DCL IN[1], GENERIC, CONSTANT
|
||||
DCL OUT[0], POSITION, CONSTANT
|
||||
DCL OUT[1], GENERIC, CONSTANT
|
||||
0:MOV OUT[0], IN[0]
|
||||
1:MOV OUT[1], IN[1]
|
||||
2:END
|
||||
''')
|
||||
#vs.dump()
|
||||
ctx.set_vertex_shader(vs)
|
||||
|
||||
# fragment shader
|
||||
op = {
|
||||
PIPE_TEXTURE_1D: "1D",
|
||||
PIPE_TEXTURE_2D: "2D",
|
||||
PIPE_TEXTURE_3D: "3D",
|
||||
PIPE_TEXTURE_CUBE: "CUBE",
|
||||
}[target]
|
||||
fs = Shader('''
|
||||
FRAG1.1
|
||||
DCL IN[0], GENERIC[0], LINEAR
|
||||
DCL SAMP[0], CONSTANT
|
||||
DCL OUT[0].z, POSITION
|
||||
0:TEX OUT[0].z, IN[0], SAMP[0], %s
|
||||
1:END
|
||||
''' % op)
|
||||
#fs.dump()
|
||||
ctx.set_fragment_shader(fs)
|
||||
|
||||
nverts = 4
|
||||
nattrs = 2
|
||||
verts = FloatArray(nverts * nattrs * 4)
|
||||
|
||||
x = 0
|
||||
y = 0
|
||||
w, h = minify((width, height), level)
|
||||
|
||||
pos = [
|
||||
[x, y],
|
||||
[x+w, y],
|
||||
[x+w, y+h],
|
||||
[x, y+h],
|
||||
]
|
||||
|
||||
tex = tex_coords(texture, face, level, zslice)
|
||||
|
||||
for i in range(0, 4):
|
||||
j = 8*i
|
||||
verts[j + 0] = pos[i][0] # x
|
||||
verts[j + 1] = pos[i][1] # y
|
||||
verts[j + 2] = 0.0 # z
|
||||
verts[j + 3] = 1.0 # w
|
||||
verts[j + 4] = tex[i][0] # s
|
||||
verts[j + 5] = tex[i][1] # r
|
||||
verts[j + 6] = tex[i][2] # q
|
||||
verts[j + 7] = 1.0
|
||||
|
||||
ctx.draw_vertices(PIPE_PRIM_TRIANGLE_FAN,
|
||||
nverts,
|
||||
nattrs,
|
||||
verts)
|
||||
|
||||
ctx.flush()
|
||||
|
||||
zsbuf = zsbuf_tex.get_surface()
|
||||
|
||||
self.assert_rgba(zsbuf, x, y, w, h, expected_rgba, 4.0/256, 0.85)
|
||||
|
||||
|
||||
|
||||
|
||||
def main():
|
||||
dev = Device()
|
||||
@@ -297,18 +497,13 @@ def main():
|
||||
PIPE_TEXTURE_3D,
|
||||
]
|
||||
|
||||
formats = [
|
||||
color_formats = [
|
||||
PIPE_FORMAT_A8R8G8B8_UNORM,
|
||||
PIPE_FORMAT_X8R8G8B8_UNORM,
|
||||
#PIPE_FORMAT_A8R8G8B8_SRGB,
|
||||
PIPE_FORMAT_R5G6B5_UNORM,
|
||||
PIPE_FORMAT_A1R5G5B5_UNORM,
|
||||
PIPE_FORMAT_A4R4G4B4_UNORM,
|
||||
#PIPE_FORMAT_Z32_UNORM,
|
||||
#PIPE_FORMAT_Z24S8_UNORM,
|
||||
#PIPE_FORMAT_Z24X8_UNORM,
|
||||
#PIPE_FORMAT_Z16_UNORM,
|
||||
#PIPE_FORMAT_S8_UNORM,
|
||||
PIPE_FORMAT_A8_UNORM,
|
||||
PIPE_FORMAT_L8_UNORM,
|
||||
PIPE_FORMAT_YCBCR,
|
||||
@@ -318,6 +513,13 @@ def main():
|
||||
#PIPE_FORMAT_DXT5_RGBA,
|
||||
]
|
||||
|
||||
depth_formats = [
|
||||
PIPE_FORMAT_Z32_UNORM,
|
||||
PIPE_FORMAT_Z24S8_UNORM,
|
||||
PIPE_FORMAT_Z24X8_UNORM,
|
||||
PIPE_FORMAT_Z16_UNORM,
|
||||
]
|
||||
|
||||
sizes = [64, 32, 16, 8, 4, 2, 1]
|
||||
#sizes = [1020, 508, 252, 62, 30, 14, 6, 3]
|
||||
#sizes = [64]
|
||||
@@ -332,8 +534,8 @@ def main():
|
||||
PIPE_TEX_FACE_NEG_Z,
|
||||
]
|
||||
|
||||
for target in targets:
|
||||
for format in formats:
|
||||
for format in color_formats:
|
||||
for target in targets:
|
||||
for size in sizes:
|
||||
if target == PIPE_TEXTURE_3D:
|
||||
depth = size
|
||||
@@ -347,7 +549,7 @@ def main():
|
||||
for level in range(0, last_level + 1):
|
||||
zslice = 0
|
||||
while zslice < depth >> level:
|
||||
test = TextureTest(
|
||||
test = TextureColorSampleTest(
|
||||
dev = dev,
|
||||
target = target,
|
||||
format = format,
|
||||
@@ -361,6 +563,27 @@ def main():
|
||||
)
|
||||
suite.add_test(test)
|
||||
zslice = (zslice + 1)*2 - 1
|
||||
for format in depth_formats:
|
||||
target = PIPE_TEXTURE_2D
|
||||
depth = 1
|
||||
face = 0
|
||||
last_level = 0
|
||||
level = 0
|
||||
zslice = 0
|
||||
for size in sizes:
|
||||
test = TextureDepthSampleTest(
|
||||
dev = dev,
|
||||
target = target,
|
||||
format = format,
|
||||
width = size,
|
||||
height = size,
|
||||
depth = depth,
|
||||
last_level = last_level,
|
||||
face = face,
|
||||
level = level,
|
||||
zslice = zslice,
|
||||
)
|
||||
suite.add_test(test)
|
||||
suite.run()
|
||||
|
||||
|
||||
|
@@ -54,7 +54,15 @@ DrvCreateLayerContext(
|
||||
HDC hdc,
|
||||
INT iLayerPlane )
|
||||
{
|
||||
return stw_create_layer_context( hdc, iLayerPlane );
|
||||
DHGLRC r;
|
||||
|
||||
r = stw_create_layer_context( hdc, iLayerPlane );
|
||||
|
||||
if (DBG)
|
||||
debug_printf( "%s( %p, %i ) = %u\n",
|
||||
__FUNCTION__, hdc, iLayerPlane, r );
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
DHGLRC APIENTRY
|
||||
@@ -68,7 +76,15 @@ BOOL APIENTRY
|
||||
DrvDeleteContext(
|
||||
DHGLRC dhglrc )
|
||||
{
|
||||
return stw_delete_context( dhglrc );
|
||||
BOOL r;
|
||||
|
||||
r = stw_delete_context( dhglrc );
|
||||
|
||||
if (DBG)
|
||||
debug_printf( "%s( %u ) = %u\n",
|
||||
__FUNCTION__, dhglrc, r );
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
BOOL APIENTRY
|
||||
@@ -126,7 +142,7 @@ DrvGetProcAddress(
|
||||
r = stw_get_proc_address( lpszProc );
|
||||
|
||||
if (DBG)
|
||||
debug_printf( "%s( \", __FUNCTION__%s\" ) = %p\n", lpszProc, r );
|
||||
debug_printf( "%s( \"%s\" ) = %p\n", __FUNCTION__, lpszProc, r );
|
||||
|
||||
return r;
|
||||
}
|
||||
@@ -515,14 +531,16 @@ DrvSetContext(
|
||||
DHGLRC dhglrc,
|
||||
PFN_SETPROCTABLE pfnSetProcTable )
|
||||
{
|
||||
if (DBG)
|
||||
debug_printf( "%s( 0x%p, %u, 0x%p )\n",
|
||||
__FUNCTION__, hdc, dhglrc, pfnSetProcTable );
|
||||
|
||||
PGLCLTPROCTABLE r = (PGLCLTPROCTABLE)&cpt;
|
||||
|
||||
if (!stw_make_current( hdc, dhglrc ))
|
||||
return NULL;
|
||||
r = NULL;
|
||||
|
||||
return (GLCLTPROCTABLE *)&cpt;
|
||||
if (DBG)
|
||||
debug_printf( "%s( 0x%p, %u, 0x%p ) = %p\n",
|
||||
__FUNCTION__, hdc, dhglrc, pfnSetProcTable, r );
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
int APIENTRY
|
||||
|
@@ -47,6 +47,23 @@
|
||||
#include "stw_context.h"
|
||||
#include "stw_tls.h"
|
||||
|
||||
|
||||
static INLINE struct stw_context *
|
||||
stw_context(GLcontext *glctx)
|
||||
{
|
||||
if(!glctx)
|
||||
return NULL;
|
||||
assert(glctx->DriverCtx);
|
||||
return (struct stw_context *)glctx->DriverCtx;
|
||||
}
|
||||
|
||||
static INLINE struct stw_context *
|
||||
stw_current_context(void)
|
||||
{
|
||||
GET_CURRENT_CONTEXT( glctx );
|
||||
return stw_context(glctx);
|
||||
}
|
||||
|
||||
BOOL
|
||||
stw_copy_context(
|
||||
UINT_PTR hglrcSrc,
|
||||
@@ -90,7 +107,7 @@ stw_share_lists(
|
||||
ctx2 = stw_lookup_context_locked( hglrc2 );
|
||||
|
||||
if (ctx1 && ctx2 &&
|
||||
ctx1->pfi == ctx2->pfi) {
|
||||
ctx1->iPixelFormat == ctx2->iPixelFormat) {
|
||||
ret = _mesa_share_state(ctx2->st->ctx, ctx1->st->ctx);
|
||||
}
|
||||
|
||||
@@ -99,57 +116,49 @@ stw_share_lists(
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void
|
||||
stw_viewport(GLcontext * glctx, GLint x, GLint y,
|
||||
GLsizei width, GLsizei height)
|
||||
{
|
||||
struct stw_context *ctx = (struct stw_context *)glctx->DriverCtx;
|
||||
struct stw_framebuffer *fb;
|
||||
|
||||
fb = stw_framebuffer_from_hdc( ctx->hdc );
|
||||
if(fb)
|
||||
stw_framebuffer_update(fb);
|
||||
}
|
||||
|
||||
UINT_PTR
|
||||
stw_create_layer_context(
|
||||
HDC hdc,
|
||||
int iLayerPlane )
|
||||
{
|
||||
uint pfi;
|
||||
const struct stw_pixelformat_info *pf = NULL;
|
||||
int iPixelFormat;
|
||||
const struct stw_pixelformat_info *pfi;
|
||||
GLvisual visual;
|
||||
struct stw_context *ctx = NULL;
|
||||
GLvisual *visual = NULL;
|
||||
struct pipe_screen *screen = NULL;
|
||||
struct pipe_context *pipe = NULL;
|
||||
|
||||
|
||||
if(!stw_dev)
|
||||
return 0;
|
||||
|
||||
if (iLayerPlane != 0)
|
||||
return 0;
|
||||
|
||||
pfi = stw_pixelformat_get( hdc );
|
||||
if (pfi == 0)
|
||||
iPixelFormat = GetPixelFormat(hdc);
|
||||
if(!iPixelFormat)
|
||||
return 0;
|
||||
|
||||
pf = stw_pixelformat_get_info( pfi - 1 );
|
||||
|
||||
|
||||
pfi = stw_pixelformat_get_info( iPixelFormat - 1 );
|
||||
stw_pixelformat_visual(&visual, pfi);
|
||||
|
||||
ctx = CALLOC_STRUCT( stw_context );
|
||||
if (ctx == NULL)
|
||||
goto no_ctx;
|
||||
|
||||
ctx->hdc = hdc;
|
||||
ctx->color_bits = GetDeviceCaps( ctx->hdc, BITSPIXEL );
|
||||
|
||||
/* Create visual based on flags
|
||||
*/
|
||||
visual = _mesa_create_visual(
|
||||
(pf->pfd.iPixelType == PFD_TYPE_RGBA) ? GL_TRUE : GL_FALSE,
|
||||
(pf->pfd.dwFlags & PFD_DOUBLEBUFFER) ? GL_TRUE : GL_FALSE,
|
||||
(pf->pfd.dwFlags & PFD_STEREO) ? GL_TRUE : GL_FALSE,
|
||||
pf->pfd.cRedBits,
|
||||
pf->pfd.cGreenBits,
|
||||
pf->pfd.cBlueBits,
|
||||
pf->pfd.cAlphaBits,
|
||||
(pf->pfd.iPixelType == PFD_TYPE_COLORINDEX) ? pf->pfd.cColorBits : 0,
|
||||
pf->pfd.cDepthBits,
|
||||
pf->pfd.cStencilBits,
|
||||
pf->pfd.cAccumRedBits,
|
||||
pf->pfd.cAccumGreenBits,
|
||||
pf->pfd.cAccumBlueBits,
|
||||
pf->pfd.cAccumAlphaBits,
|
||||
pf->numSamples );
|
||||
if (visual == NULL)
|
||||
goto no_visual;
|
||||
ctx->iPixelFormat = iPixelFormat;
|
||||
|
||||
screen = stw_dev->screen;
|
||||
|
||||
@@ -169,15 +178,16 @@ stw_create_layer_context(
|
||||
pipe = trace_context_create(stw_dev->screen, pipe);
|
||||
#endif
|
||||
|
||||
/* pass to stw_flush_frontbuffer as context_private */
|
||||
assert(!pipe->priv);
|
||||
pipe->priv = hdc;
|
||||
|
||||
ctx->st = st_create_context( pipe, visual, NULL );
|
||||
ctx->st = st_create_context( pipe, &visual, NULL );
|
||||
if (ctx->st == NULL)
|
||||
goto no_st_ctx;
|
||||
|
||||
ctx->st->ctx->DriverCtx = ctx;
|
||||
ctx->pfi = pf;
|
||||
ctx->st->ctx->Driver.Viewport = stw_viewport;
|
||||
|
||||
pipe_mutex_lock( stw_dev->mutex );
|
||||
ctx->hglrc = handle_table_add(stw_dev->ctx_table, ctx);
|
||||
@@ -193,9 +203,7 @@ no_hglrc:
|
||||
no_st_ctx:
|
||||
pipe->destroy( pipe );
|
||||
no_pipe:
|
||||
_mesa_destroy_visual( visual );
|
||||
no_visual:
|
||||
FREE( ctx );
|
||||
FREE(ctx);
|
||||
no_ctx:
|
||||
return 0;
|
||||
}
|
||||
@@ -216,22 +224,12 @@ stw_delete_context(
|
||||
pipe_mutex_unlock( stw_dev->mutex );
|
||||
|
||||
if (ctx) {
|
||||
GLcontext *glctx = ctx->st->ctx;
|
||||
GET_CURRENT_CONTEXT( glcurctx );
|
||||
struct stw_framebuffer *fb;
|
||||
|
||||
/* Unbind current if deleting current context.
|
||||
*/
|
||||
if (glcurctx == glctx)
|
||||
struct stw_context *curctx = stw_current_context();
|
||||
|
||||
/* Unbind current if deleting current context. */
|
||||
if (curctx == ctx)
|
||||
st_make_current( NULL, NULL, NULL );
|
||||
|
||||
fb = stw_framebuffer_from_hdc( ctx->hdc );
|
||||
if (fb)
|
||||
stw_framebuffer_destroy( fb );
|
||||
|
||||
if (WindowFromDC( ctx->hdc ) != NULL)
|
||||
ReleaseDC( WindowFromDC( ctx->hdc ), ctx->hdc );
|
||||
|
||||
st_destroy_context(ctx->st);
|
||||
FREE(ctx);
|
||||
|
||||
@@ -261,13 +259,8 @@ stw_release_context(
|
||||
* current for this thread. We should check that and return False
|
||||
* if not the case.
|
||||
*/
|
||||
{
|
||||
GLcontext *glctx = ctx->st->ctx;
|
||||
GET_CURRENT_CONTEXT( glcurctx );
|
||||
|
||||
if (glcurctx != glctx)
|
||||
return FALSE;
|
||||
}
|
||||
if (ctx != stw_current_context())
|
||||
return FALSE;
|
||||
|
||||
if (stw_make_current( NULL, 0 ) == FALSE)
|
||||
return FALSE;
|
||||
@@ -275,46 +268,13 @@ stw_release_context(
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* Find the width and height of the window named by hdc.
|
||||
*/
|
||||
static void
|
||||
stw_get_window_size( HDC hdc, GLuint *pwidth, GLuint *pheight )
|
||||
{
|
||||
GLuint width, height;
|
||||
HWND hwnd;
|
||||
|
||||
hwnd = WindowFromDC( hdc );
|
||||
if (hwnd) {
|
||||
RECT rect;
|
||||
GetClientRect( hwnd, &rect );
|
||||
width = rect.right - rect.left;
|
||||
height = rect.bottom - rect.top;
|
||||
}
|
||||
else {
|
||||
width = GetDeviceCaps( hdc, HORZRES );
|
||||
height = GetDeviceCaps( hdc, VERTRES );
|
||||
}
|
||||
|
||||
if(width < 1)
|
||||
width = 1;
|
||||
if(height < 1)
|
||||
height = 1;
|
||||
|
||||
*pwidth = width;
|
||||
*pheight = height;
|
||||
}
|
||||
|
||||
UINT_PTR
|
||||
stw_get_current_context( void )
|
||||
{
|
||||
GET_CURRENT_CONTEXT( glcurctx );
|
||||
struct stw_context *ctx;
|
||||
|
||||
if(!glcurctx)
|
||||
return 0;
|
||||
|
||||
ctx = (struct stw_context *)glcurctx->DriverCtx;
|
||||
assert(ctx);
|
||||
ctx = stw_current_context();
|
||||
if(!ctx)
|
||||
return 0;
|
||||
|
||||
@@ -324,14 +284,9 @@ stw_get_current_context( void )
|
||||
HDC
|
||||
stw_get_current_dc( void )
|
||||
{
|
||||
GET_CURRENT_CONTEXT( glcurctx );
|
||||
struct stw_context *ctx;
|
||||
|
||||
if(!glcurctx)
|
||||
return NULL;
|
||||
|
||||
ctx = (struct stw_context *)glcurctx->DriverCtx;
|
||||
assert(ctx);
|
||||
ctx = stw_current_context();
|
||||
if(!ctx)
|
||||
return NULL;
|
||||
|
||||
@@ -343,67 +298,75 @@ stw_make_current(
|
||||
HDC hdc,
|
||||
UINT_PTR hglrc )
|
||||
{
|
||||
struct stw_context *curctx;
|
||||
struct stw_context *ctx;
|
||||
GET_CURRENT_CONTEXT( glcurctx );
|
||||
struct stw_framebuffer *fb;
|
||||
GLuint width = 0;
|
||||
GLuint height = 0;
|
||||
struct stw_context *curctx = NULL;
|
||||
|
||||
if (!stw_dev)
|
||||
return FALSE;
|
||||
goto fail;
|
||||
|
||||
pipe_mutex_lock( stw_dev->mutex );
|
||||
ctx = stw_lookup_context_locked( hglrc );
|
||||
pipe_mutex_unlock( stw_dev->mutex );
|
||||
|
||||
if (glcurctx != NULL) {
|
||||
curctx = (struct stw_context *) glcurctx->DriverCtx;
|
||||
|
||||
if (curctx != ctx)
|
||||
st_flush(glcurctx->st, PIPE_FLUSH_RENDER_CACHE, NULL);
|
||||
curctx = stw_current_context();
|
||||
if (curctx != NULL) {
|
||||
if (curctx->hglrc != hglrc)
|
||||
st_flush(curctx->st, PIPE_FLUSH_RENDER_CACHE, NULL);
|
||||
|
||||
/* Return if already current. */
|
||||
if (curctx->hglrc == hglrc && curctx->hdc == hdc) {
|
||||
ctx = curctx;
|
||||
fb = stw_framebuffer_from_hdc( hdc );
|
||||
goto success;
|
||||
}
|
||||
}
|
||||
|
||||
if (hdc == NULL || hglrc == 0) {
|
||||
st_make_current( NULL, NULL, NULL );
|
||||
return TRUE;
|
||||
return st_make_current( NULL, NULL, NULL );
|
||||
}
|
||||
|
||||
/* Return if already current.
|
||||
*/
|
||||
if (glcurctx != NULL) {
|
||||
if (curctx != NULL && curctx == ctx && ctx->hdc == hdc)
|
||||
return TRUE;
|
||||
pipe_mutex_lock( stw_dev->mutex );
|
||||
|
||||
ctx = stw_lookup_context_locked( hglrc );
|
||||
if(!ctx)
|
||||
goto fail;
|
||||
|
||||
fb = stw_framebuffer_from_hdc_locked( hdc );
|
||||
if(!fb) {
|
||||
/* Applications should call SetPixelFormat before creating a context,
|
||||
* but not all do, and the opengl32 runtime seems to use a default pixel
|
||||
* format in some cases, so we must create a framebuffer for those here
|
||||
*/
|
||||
int iPixelFormat = GetPixelFormat(hdc);
|
||||
if(iPixelFormat)
|
||||
fb = stw_framebuffer_create_locked( hdc, iPixelFormat );
|
||||
if(!fb)
|
||||
goto fail;
|
||||
}
|
||||
|
||||
pipe_mutex_unlock( stw_dev->mutex );
|
||||
|
||||
fb = stw_framebuffer_from_hdc( hdc );
|
||||
if(fb->iPixelFormat != ctx->iPixelFormat)
|
||||
goto fail;
|
||||
|
||||
if (hdc != NULL)
|
||||
stw_get_window_size( hdc, &width, &height );
|
||||
/* Lazy allocation of the frame buffer */
|
||||
if(!stw_framebuffer_allocate(fb))
|
||||
goto fail;
|
||||
|
||||
/* Lazy creation of stw_framebuffers.
|
||||
*/
|
||||
if (fb == NULL && ctx != NULL && hdc != NULL) {
|
||||
GLvisual *visual = &ctx->st->ctx->Visual;
|
||||
|
||||
fb = stw_framebuffer_create( hdc, visual, ctx->pfi, width, height );
|
||||
if (fb == NULL)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (ctx && fb) {
|
||||
pipe_mutex_lock( fb->mutex );
|
||||
st_make_current( ctx->st, fb->stfb, fb->stfb );
|
||||
st_resize_framebuffer( fb->stfb, width, height );
|
||||
pipe_mutex_unlock( fb->mutex );
|
||||
|
||||
ctx->hdc = hdc;
|
||||
ctx->st->pipe->priv = hdc;
|
||||
}
|
||||
else {
|
||||
/* Detach */
|
||||
st_make_current( NULL, NULL, NULL );
|
||||
}
|
||||
/* Bind the new framebuffer */
|
||||
ctx->hdc = hdc;
|
||||
|
||||
/* pass to stw_flush_frontbuffer as context_private */
|
||||
ctx->st->pipe->priv = hdc;
|
||||
|
||||
if(!st_make_current( ctx->st, fb->stfb, fb->stfb ))
|
||||
goto fail;
|
||||
|
||||
success:
|
||||
assert(fb);
|
||||
if(fb)
|
||||
stw_framebuffer_update(fb);
|
||||
|
||||
return TRUE;
|
||||
|
||||
fail:
|
||||
st_make_current( NULL, NULL, NULL );
|
||||
return FALSE;
|
||||
}
|
||||
|
@@ -31,15 +31,13 @@
|
||||
#include <windows.h>
|
||||
|
||||
struct st_context;
|
||||
struct stw_pixelformat_info;
|
||||
|
||||
struct stw_context
|
||||
{
|
||||
struct st_context *st;
|
||||
UINT_PTR hglrc;
|
||||
int iPixelFormat;
|
||||
HDC hdc;
|
||||
DWORD color_bits;
|
||||
const struct stw_pixelformat_info *pfi;
|
||||
};
|
||||
|
||||
#endif /* STW_CONTEXT_H */
|
||||
|
@@ -30,6 +30,7 @@
|
||||
#include "glapi/glthread.h"
|
||||
#include "util/u_debug.h"
|
||||
#include "pipe/p_screen.h"
|
||||
#include "state_tracker/st_public.h"
|
||||
|
||||
#ifdef DEBUG
|
||||
#include "trace/tr_screen.h"
|
||||
@@ -57,21 +58,45 @@ struct stw_device *stw_dev = NULL;
|
||||
* stw_winsys::flush_front_buffer.
|
||||
*/
|
||||
static void
|
||||
st_flush_frontbuffer(struct pipe_screen *screen,
|
||||
stw_flush_frontbuffer(struct pipe_screen *screen,
|
||||
struct pipe_surface *surface,
|
||||
void *context_private )
|
||||
{
|
||||
const struct stw_winsys *stw_winsys = stw_dev->stw_winsys;
|
||||
HDC hdc = (HDC)context_private;
|
||||
struct stw_framebuffer *fb;
|
||||
|
||||
#ifdef DEBUG
|
||||
if(stw_dev->trace_running) {
|
||||
screen = trace_screen(screen)->screen;
|
||||
surface = trace_surface(surface)->surface;
|
||||
}
|
||||
fb = stw_framebuffer_from_hdc( hdc );
|
||||
/* fb can be NULL if window was destroyed already */
|
||||
if (fb) {
|
||||
pipe_mutex_lock( fb->mutex );
|
||||
|
||||
#if DEBUG
|
||||
{
|
||||
struct pipe_surface *surface2;
|
||||
|
||||
if(!st_get_framebuffer_surface( fb->stfb, ST_SURFACE_FRONT_LEFT, &surface2 ))
|
||||
assert(0);
|
||||
else
|
||||
assert(surface2 == surface);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG
|
||||
if(stw_dev->trace_running) {
|
||||
screen = trace_screen(screen)->screen;
|
||||
surface = trace_surface(surface)->surface;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
stw_winsys->flush_frontbuffer(screen, surface, hdc);
|
||||
|
||||
if(fb) {
|
||||
stw_framebuffer_update(fb);
|
||||
|
||||
pipe_mutex_unlock( fb->mutex );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -111,7 +136,7 @@ stw_init(const struct stw_winsys *stw_winsys)
|
||||
stw_dev->screen = screen;
|
||||
#endif
|
||||
|
||||
stw_dev->screen->flush_frontbuffer = st_flush_frontbuffer;
|
||||
stw_dev->screen->flush_frontbuffer = &stw_flush_frontbuffer;
|
||||
|
||||
pipe_mutex_init( stw_dev->mutex );
|
||||
|
||||
@@ -133,20 +158,13 @@ error1:
|
||||
boolean
|
||||
stw_init_thread(void)
|
||||
{
|
||||
if (!stw_tls_init_thread())
|
||||
return FALSE;
|
||||
|
||||
if (!stw_framebuffer_init_thread())
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
return stw_tls_init_thread();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
stw_cleanup_thread(void)
|
||||
{
|
||||
stw_framebuffer_cleanup_thread();
|
||||
stw_tls_cleanup_thread();
|
||||
}
|
||||
|
||||
@@ -173,6 +191,8 @@ stw_cleanup(void)
|
||||
}
|
||||
pipe_mutex_unlock( stw_dev->mutex );
|
||||
|
||||
stw_framebuffer_cleanup();
|
||||
|
||||
pipe_mutex_destroy( stw_dev->mutex );
|
||||
|
||||
stw_dev->screen->destroy(stw_dev->screen);
|
||||
|
@@ -45,11 +45,46 @@
|
||||
#include "stw_tls.h"
|
||||
|
||||
|
||||
static INLINE struct stw_framebuffer *
|
||||
stw_framebuffer_from_hwnd_locked(
|
||||
HWND hwnd )
|
||||
{
|
||||
struct stw_framebuffer *fb;
|
||||
|
||||
for (fb = stw_dev->fb_head; fb != NULL; fb = fb->next)
|
||||
if (fb->hWnd == hwnd)
|
||||
break;
|
||||
|
||||
return fb;
|
||||
}
|
||||
|
||||
|
||||
static INLINE void
|
||||
stw_framebuffer_destroy_locked(
|
||||
struct stw_framebuffer *fb )
|
||||
{
|
||||
struct stw_framebuffer **link;
|
||||
|
||||
link = &stw_dev->fb_head;
|
||||
while (*link != fb)
|
||||
link = &(*link)->next;
|
||||
assert(*link);
|
||||
*link = fb->next;
|
||||
fb->next = NULL;
|
||||
|
||||
st_unreference_framebuffer(fb->stfb);
|
||||
|
||||
pipe_mutex_destroy( fb->mutex );
|
||||
|
||||
FREE( fb );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @sa http://msdn.microsoft.com/en-us/library/ms644975(VS.85).aspx
|
||||
* @sa http://msdn.microsoft.com/en-us/library/ms644960(VS.85).aspx
|
||||
*/
|
||||
static LRESULT CALLBACK
|
||||
LRESULT CALLBACK
|
||||
stw_call_window_proc(
|
||||
int nCode,
|
||||
WPARAM wParam,
|
||||
@@ -69,113 +104,212 @@ stw_call_window_proc(
|
||||
struct stw_framebuffer *fb;
|
||||
|
||||
pipe_mutex_lock( stw_dev->mutex );
|
||||
for (fb = stw_dev->fb_head; fb != NULL; fb = fb->next)
|
||||
if (fb->hWnd == pParams->hwnd)
|
||||
break;
|
||||
fb = stw_framebuffer_from_hwnd_locked( pParams->hwnd );
|
||||
pipe_mutex_unlock( stw_dev->mutex );
|
||||
|
||||
if(fb) {
|
||||
unsigned width = LOWORD( pParams->lParam );
|
||||
unsigned height = HIWORD( pParams->lParam );
|
||||
|
||||
/* FIXME: The mesa statetracker makes the assumptions that only
|
||||
* one context is using the framebuffer, and that that context is the
|
||||
* current one. However neither holds true, as WGL allows more than
|
||||
* one context to be bound to the same drawable, and this function can
|
||||
* be called from any thread.
|
||||
*/
|
||||
pipe_mutex_lock( fb->mutex );
|
||||
st_resize_framebuffer( fb->stfb, width, height );
|
||||
fb->must_resize = TRUE;
|
||||
fb->width = width;
|
||||
fb->height = height;
|
||||
pipe_mutex_unlock( fb->mutex );
|
||||
}
|
||||
}
|
||||
|
||||
if (pParams->message == WM_DESTROY) {
|
||||
struct stw_framebuffer *fb;
|
||||
|
||||
pipe_mutex_lock( stw_dev->mutex );
|
||||
|
||||
fb = stw_framebuffer_from_hwnd_locked( pParams->hwnd );
|
||||
if(fb)
|
||||
stw_framebuffer_destroy_locked(fb);
|
||||
|
||||
pipe_mutex_unlock( stw_dev->mutex );
|
||||
}
|
||||
|
||||
return CallNextHookEx(tls_data->hCallWndProcHook, nCode, wParam, lParam);
|
||||
}
|
||||
|
||||
|
||||
/* Create a new framebuffer object which will correspond to the given HDC.
|
||||
static void
|
||||
stw_framebuffer_get_size( struct stw_framebuffer *fb )
|
||||
{
|
||||
unsigned width, height;
|
||||
RECT rect;
|
||||
|
||||
assert(fb->hWnd);
|
||||
|
||||
GetClientRect( fb->hWnd, &rect );
|
||||
width = rect.right - rect.left;
|
||||
height = rect.bottom - rect.top;
|
||||
|
||||
if(width < 1)
|
||||
width = 1;
|
||||
if(height < 1)
|
||||
height = 1;
|
||||
|
||||
if(width != fb->width || height != fb->height) {
|
||||
fb->must_resize = TRUE;
|
||||
fb->width = width;
|
||||
fb->height = height;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Create a new framebuffer object which will correspond to the given HDC.
|
||||
*/
|
||||
struct stw_framebuffer *
|
||||
stw_framebuffer_create(
|
||||
stw_framebuffer_create_locked(
|
||||
HDC hdc,
|
||||
GLvisual *visual,
|
||||
const struct stw_pixelformat_info *pfi,
|
||||
GLuint width,
|
||||
GLuint height )
|
||||
int iPixelFormat )
|
||||
{
|
||||
enum pipe_format colorFormat, depthFormat, stencilFormat;
|
||||
HWND hWnd;
|
||||
struct stw_framebuffer *fb;
|
||||
const struct stw_pixelformat_info *pfi;
|
||||
|
||||
colorFormat = pfi->color_format;
|
||||
/* We only support drawing to a window. */
|
||||
hWnd = WindowFromDC( hdc );
|
||||
if(!hWnd)
|
||||
return NULL;
|
||||
|
||||
assert(pf_layout( pfi->depth_stencil_format ) == PIPE_FORMAT_LAYOUT_RGBAZS );
|
||||
|
||||
if(pf_get_component_bits( pfi->depth_stencil_format, PIPE_FORMAT_COMP_Z ))
|
||||
depthFormat = pfi->depth_stencil_format;
|
||||
else
|
||||
depthFormat = PIPE_FORMAT_NONE;
|
||||
|
||||
if(pf_get_component_bits( pfi->depth_stencil_format, PIPE_FORMAT_COMP_S ))
|
||||
stencilFormat = pfi->depth_stencil_format;
|
||||
else
|
||||
stencilFormat = PIPE_FORMAT_NONE;
|
||||
|
||||
fb = CALLOC_STRUCT( stw_framebuffer );
|
||||
if (fb == NULL)
|
||||
return NULL;
|
||||
|
||||
fb->hDC = hdc;
|
||||
fb->hWnd = WindowFromDC( hdc );
|
||||
fb->hWnd = hWnd;
|
||||
fb->iPixelFormat = iPixelFormat;
|
||||
|
||||
fb->pfi = pfi = stw_pixelformat_get_info( iPixelFormat - 1 );
|
||||
|
||||
stw_pixelformat_visual(&fb->visual, pfi);
|
||||
|
||||
stw_framebuffer_get_size(fb);
|
||||
|
||||
pipe_mutex_init( fb->mutex );
|
||||
|
||||
fb->stfb = st_create_framebuffer(
|
||||
visual,
|
||||
colorFormat,
|
||||
depthFormat,
|
||||
stencilFormat,
|
||||
width,
|
||||
height,
|
||||
(void *) fb );
|
||||
if(!fb->stfb) {
|
||||
FREE(fb);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
pipe_mutex_lock( stw_dev->mutex );
|
||||
fb->next = stw_dev->fb_head;
|
||||
stw_dev->fb_head = fb;
|
||||
pipe_mutex_unlock( stw_dev->mutex );
|
||||
|
||||
return fb;
|
||||
}
|
||||
|
||||
void
|
||||
stw_framebuffer_destroy(
|
||||
struct stw_framebuffer *fb )
|
||||
|
||||
BOOL
|
||||
stw_framebuffer_allocate(
|
||||
struct stw_framebuffer *fb)
|
||||
{
|
||||
struct stw_framebuffer **link;
|
||||
pipe_mutex_lock( fb->mutex );
|
||||
|
||||
if(!fb->stfb) {
|
||||
const struct stw_pixelformat_info *pfi = fb->pfi;
|
||||
enum pipe_format colorFormat, depthFormat, stencilFormat;
|
||||
|
||||
colorFormat = pfi->color_format;
|
||||
|
||||
assert(pf_layout( pfi->depth_stencil_format ) == PIPE_FORMAT_LAYOUT_RGBAZS );
|
||||
|
||||
if(pf_get_component_bits( pfi->depth_stencil_format, PIPE_FORMAT_COMP_Z ))
|
||||
depthFormat = pfi->depth_stencil_format;
|
||||
else
|
||||
depthFormat = PIPE_FORMAT_NONE;
|
||||
|
||||
if(pf_get_component_bits( pfi->depth_stencil_format, PIPE_FORMAT_COMP_S ))
|
||||
stencilFormat = pfi->depth_stencil_format;
|
||||
else
|
||||
stencilFormat = PIPE_FORMAT_NONE;
|
||||
|
||||
assert(fb->must_resize);
|
||||
assert(fb->width);
|
||||
assert(fb->height);
|
||||
|
||||
fb->stfb = st_create_framebuffer(
|
||||
&fb->visual,
|
||||
colorFormat,
|
||||
depthFormat,
|
||||
stencilFormat,
|
||||
fb->width,
|
||||
fb->height,
|
||||
(void *) fb );
|
||||
|
||||
// to notify the context
|
||||
fb->must_resize = TRUE;
|
||||
}
|
||||
|
||||
pipe_mutex_unlock( fb->mutex );
|
||||
|
||||
return fb->stfb ? TRUE : FALSE;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Update the framebuffer's size if necessary.
|
||||
*/
|
||||
void
|
||||
stw_framebuffer_update(
|
||||
struct stw_framebuffer *fb)
|
||||
{
|
||||
assert(fb->stfb);
|
||||
assert(fb->height);
|
||||
assert(fb->width);
|
||||
|
||||
/* XXX: It would be nice to avoid checking the size again -- in theory
|
||||
* stw_call_window_proc would have cought the resize and stored the right
|
||||
* size already, but unfortunately threads created before the DllMain is
|
||||
* called don't get a DLL_THREAD_ATTACH notification, and there is no way
|
||||
* to know of their existing without using the not very portable PSAPI.
|
||||
*/
|
||||
stw_framebuffer_get_size(fb);
|
||||
|
||||
if(fb->must_resize) {
|
||||
st_resize_framebuffer(fb->stfb, fb->width, fb->height);
|
||||
fb->must_resize = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
stw_framebuffer_cleanup( void )
|
||||
{
|
||||
struct stw_framebuffer *fb;
|
||||
struct stw_framebuffer *next;
|
||||
|
||||
pipe_mutex_lock( stw_dev->mutex );
|
||||
|
||||
link = &stw_dev->fb_head;
|
||||
while (link && *link != fb)
|
||||
link = &(*link)->next;
|
||||
assert(*link);
|
||||
if (link)
|
||||
*link = fb->next;
|
||||
fb->next = NULL;
|
||||
|
||||
fb = stw_dev->fb_head;
|
||||
while (fb) {
|
||||
next = fb->next;
|
||||
stw_framebuffer_destroy_locked(fb);
|
||||
fb = next;
|
||||
}
|
||||
stw_dev->fb_head = NULL;
|
||||
|
||||
pipe_mutex_unlock( stw_dev->mutex );
|
||||
|
||||
st_unreference_framebuffer(fb->stfb);
|
||||
|
||||
pipe_mutex_destroy( fb->mutex );
|
||||
|
||||
FREE( fb );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Given an hdc, return the corresponding stw_framebuffer.
|
||||
*/
|
||||
struct stw_framebuffer *
|
||||
stw_framebuffer_from_hdc_locked(
|
||||
HDC hdc )
|
||||
{
|
||||
struct stw_framebuffer *fb;
|
||||
|
||||
for (fb = stw_dev->fb_head; fb != NULL; fb = fb->next)
|
||||
if (fb->hDC == hdc)
|
||||
break;
|
||||
|
||||
return fb;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Given an hdc, return the corresponding stw_framebuffer.
|
||||
*/
|
||||
@@ -186,15 +320,69 @@ stw_framebuffer_from_hdc(
|
||||
struct stw_framebuffer *fb;
|
||||
|
||||
pipe_mutex_lock( stw_dev->mutex );
|
||||
for (fb = stw_dev->fb_head; fb != NULL; fb = fb->next)
|
||||
if (fb->hDC == hdc)
|
||||
break;
|
||||
fb = stw_framebuffer_from_hdc_locked(hdc);
|
||||
pipe_mutex_unlock( stw_dev->mutex );
|
||||
|
||||
return fb;
|
||||
}
|
||||
|
||||
|
||||
BOOL
|
||||
stw_pixelformat_set(
|
||||
HDC hdc,
|
||||
int iPixelFormat )
|
||||
{
|
||||
uint count;
|
||||
uint index;
|
||||
struct stw_framebuffer *fb;
|
||||
|
||||
index = (uint) iPixelFormat - 1;
|
||||
count = stw_pixelformat_get_extended_count();
|
||||
if (index >= count)
|
||||
return FALSE;
|
||||
|
||||
pipe_mutex_lock( stw_dev->mutex );
|
||||
|
||||
fb = stw_framebuffer_from_hdc_locked(hdc);
|
||||
if(fb) {
|
||||
/* SetPixelFormat must be called only once */
|
||||
pipe_mutex_unlock( stw_dev->mutex );
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
fb = stw_framebuffer_create_locked(hdc, iPixelFormat);
|
||||
if(!fb) {
|
||||
pipe_mutex_unlock( stw_dev->mutex );
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
pipe_mutex_unlock( stw_dev->mutex );
|
||||
|
||||
/* Some applications mistakenly use the undocumented wglSetPixelFormat
|
||||
* function instead of SetPixelFormat, so we call SetPixelFormat here to
|
||||
* avoid opengl32.dll's wglCreateContext to fail */
|
||||
if (GetPixelFormat(hdc) == 0) {
|
||||
SetPixelFormat(hdc, iPixelFormat, NULL);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
stw_pixelformat_get(
|
||||
HDC hdc )
|
||||
{
|
||||
struct stw_framebuffer *fb;
|
||||
|
||||
fb = stw_framebuffer_from_hdc(hdc);
|
||||
if(!fb)
|
||||
return 0;
|
||||
|
||||
return fb->iPixelFormat;
|
||||
}
|
||||
|
||||
|
||||
BOOL
|
||||
stw_swap_buffers(
|
||||
HDC hdc )
|
||||
@@ -207,6 +395,9 @@ stw_swap_buffers(
|
||||
if (fb == NULL)
|
||||
return FALSE;
|
||||
|
||||
if (!(fb->pfi->pfd.dwFlags & PFD_DOUBLEBUFFER))
|
||||
return TRUE;
|
||||
|
||||
pipe_mutex_lock( fb->mutex );
|
||||
|
||||
/* If we're swapping the buffer associated with the current context
|
||||
@@ -231,6 +422,8 @@ stw_swap_buffers(
|
||||
|
||||
stw_dev->stw_winsys->flush_frontbuffer( screen, surface, hdc );
|
||||
|
||||
stw_framebuffer_update(fb);
|
||||
|
||||
pipe_mutex_unlock( fb->mutex );
|
||||
|
||||
return TRUE;
|
||||
@@ -247,38 +440,3 @@ stw_swap_layer_buffers(
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
boolean
|
||||
stw_framebuffer_init_thread(void)
|
||||
{
|
||||
struct stw_tls_data *tls_data;
|
||||
|
||||
tls_data = stw_tls_get_data();
|
||||
if(!tls_data)
|
||||
return FALSE;
|
||||
|
||||
tls_data->hCallWndProcHook = SetWindowsHookEx(WH_CALLWNDPROC,
|
||||
stw_call_window_proc,
|
||||
NULL,
|
||||
GetCurrentThreadId());
|
||||
if(tls_data->hCallWndProcHook == NULL)
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
stw_framebuffer_cleanup_thread(void)
|
||||
{
|
||||
struct stw_tls_data *tls_data;
|
||||
|
||||
tls_data = stw_tls_get_data();
|
||||
if(!tls_data)
|
||||
return;
|
||||
|
||||
if(tls_data->hCallWndProcHook) {
|
||||
UnhookWindowsHookEx(tls_data->hCallWndProcHook);
|
||||
tls_data->hCallWndProcHook = NULL;
|
||||
}
|
||||
}
|
||||
|
@@ -44,33 +44,44 @@ struct stw_framebuffer
|
||||
HDC hDC;
|
||||
HWND hWnd;
|
||||
|
||||
int iPixelFormat;
|
||||
const struct stw_pixelformat_info *pfi;
|
||||
GLvisual visual;
|
||||
|
||||
pipe_mutex mutex;
|
||||
struct st_framebuffer *stfb;
|
||||
|
||||
/* FIXME: Make this work for multiple contexts bound to the same framebuffer */
|
||||
boolean must_resize;
|
||||
unsigned width;
|
||||
unsigned height;
|
||||
|
||||
/** This is protected by stw_device::mutex, not the mutex above */
|
||||
struct stw_framebuffer *next;
|
||||
};
|
||||
|
||||
struct stw_framebuffer *
|
||||
stw_framebuffer_create(
|
||||
stw_framebuffer_create_locked(
|
||||
HDC hdc,
|
||||
GLvisual *visual,
|
||||
const struct stw_pixelformat_info *pfi,
|
||||
GLuint width,
|
||||
GLuint height );
|
||||
int iPixelFormat );
|
||||
|
||||
BOOL
|
||||
stw_framebuffer_allocate(
|
||||
struct stw_framebuffer *fb );
|
||||
|
||||
void
|
||||
stw_framebuffer_destroy(
|
||||
struct stw_framebuffer *fb );
|
||||
stw_framebuffer_update(
|
||||
struct stw_framebuffer *fb);
|
||||
|
||||
void
|
||||
stw_framebuffer_cleanup(void);
|
||||
|
||||
struct stw_framebuffer *
|
||||
stw_framebuffer_from_hdc_locked(
|
||||
HDC hdc );
|
||||
|
||||
struct stw_framebuffer *
|
||||
stw_framebuffer_from_hdc(
|
||||
HDC hdc );
|
||||
|
||||
boolean
|
||||
stw_framebuffer_init_thread(void);
|
||||
|
||||
void
|
||||
stw_framebuffer_cleanup_thread(void);
|
||||
|
||||
#endif /* STW_FRAMEBUFFER_H */
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user