Commit fbc37226 authored by Roland Scheidegger's avatar Roland Scheidegger

Merge commit 'origin/master' into gallium-resources

Conflicts:
	src/gallium/drivers/cell/ppu/cell_screen.c
	src/gallium/drivers/i915/i915_buffer.c
	src/gallium/drivers/i915/i915_context.h
	src/gallium/drivers/i915/i915_resource_texture.c
	src/gallium/drivers/i915/i915_screen.c
	src/gallium/drivers/i915/i915_state_emit.c
	src/gallium/drivers/i965/brw_resource_texture.c
	src/gallium/drivers/llvmpipe/lp_screen.c
	src/gallium/drivers/llvmpipe/lp_setup.c
	src/gallium/drivers/nvfx/nv30_fragtex.c
	src/gallium/drivers/nvfx/nv40_fragtex.c
	src/gallium/drivers/nvfx/nvfx_miptree.c
	src/gallium/drivers/nvfx/nvfx_screen.c
	src/gallium/drivers/nvfx/nvfx_transfer.c
	src/gallium/drivers/r300/r300_state.c
	src/gallium/drivers/svga/svga_screen_texture.c
	src/gallium/state_trackers/dri/common/dri_drawable.c
	src/gallium/state_trackers/dri/common/dri_screen.c
	src/gallium/state_trackers/dri/common/dri_st_api.h
	src/gallium/state_trackers/dri/drm/dri1.c
	src/gallium/state_trackers/dri/drm/dri1.h
	src/gallium/state_trackers/dri/drm/dri2.c
	src/gallium/state_trackers/python/st_device.c
	src/gallium/state_trackers/python/st_sample.c
	src/mesa/state_tracker/st_cb_clear.c
	src/mesa/state_tracker/st_cb_drawpixels.c
	src/mesa/state_tracker/st_cb_readpixels.c
	src/mesa/state_tracker/st_cb_texture.c
	src/mesa/state_tracker/st_extensions.c
parents 86d9225d d97f6963
......@@ -323,6 +323,7 @@ GALLIUM_FILES = \
$(DIRECTORY)/src/gallium/*/Makefile \
$(DIRECTORY)/src/gallium/*/SConscript \
$(DIRECTORY)/src/gallium/*/*/Makefile \
$(DIRECTORY)/src/gallium/*/*/Makefile.egl \
$(DIRECTORY)/src/gallium/*/*/Makefile.template \
$(DIRECTORY)/src/gallium/*/*/SConscript \
$(DIRECTORY)/src/gallium/*/*/*.[ch] \
......@@ -406,6 +407,14 @@ DEMO_FILES = \
$(DIRECTORY)/progs/demos/*.cxx \
$(DIRECTORY)/progs/demos/*.dat \
$(DIRECTORY)/progs/demos/README \
$(DIRECTORY)/progs/egl/Makefile \
$(DIRECTORY)/progs/egl/*.[ch] \
$(DIRECTORY)/progs/es1/*/Makefile \
$(DIRECTORY)/progs/es1/*/*.[ch] \
$(DIRECTORY)/progs/es2/*/Makefile \
$(DIRECTORY)/progs/es2/*/*.[ch] \
$(DIRECTORY)/progs/openvg/*/Makefile \
$(DIRECTORY)/progs/openvg/*/*.[ch] \
$(DIRECTORY)/progs/fbdev/Makefile \
$(DIRECTORY)/progs/fbdev/glfbdevtest.c \
$(DIRECTORY)/progs/objviewer/*.[ch] \
......
......@@ -52,7 +52,7 @@ opts.Add(ListVariable('statetrackers', 'state trackers to build', default_statet
opts.Add(ListVariable('drivers', 'pipe drivers to build', default_drivers,
['softpipe', 'failover', 'svga', 'i915', 'i965', 'trace', 'r300', 'identity', 'llvmpipe']))
opts.Add(ListVariable('winsys', 'winsys drivers to build', default_winsys,
['xlib', 'vmware', 'intel', 'i965', 'gdi', 'radeon']))
['xlib', 'vmware', 'i915', 'i965', 'gdi', 'radeon', 'graw-xlib']))
opts.Add(EnumVariable('MSVS_VERSION', 'MS Visual C++ version', None, allowed_values=('7.1', '8.0', '9.0')))
......
......@@ -24,8 +24,8 @@ RADEON_CFLAGS = @RADEON_CFLAGS@
RADEON_LDFLAGS = @RADEON_LDFLAGS@
INTEL_LIBS = @INTEL_LIBS@
INTEL_CFLAGS = @INTEL_CFLAGS@
X_LIBS = @X_LIBS@
X_CFLAGS = @X_CFLAGS@
X11_LIBS = @X11_LIBS@
X11_CFLAGS = @X11_CFLAGS@
# Assembler
MESA_ASM_SOURCES = @MESA_ASM_SOURCES@
......@@ -76,7 +76,6 @@ GALLIUM_DIRS = @GALLIUM_DIRS@
GALLIUM_DRIVERS_DIRS = @GALLIUM_DRIVERS_DIRS@
GALLIUM_WINSYS_DIRS = @GALLIUM_WINSYS_DIRS@
GALLIUM_TARGET_DIRS = @GALLIUM_TARGET_DIRS@
GALLIUM_WINSYS_DRM_DIRS = @GALLIUM_WINSYS_DRM_DIRS@
GALLIUM_STATE_TRACKERS_DIRS = @GALLIUM_STATE_TRACKERS_DIRS@
GALLIUM_AUXILIARIES = $(TOP)/src/gallium/auxiliary/libgallium.a
GALLIUM_DRIVERS = $(foreach DIR,$(GALLIUM_DRIVERS_DIRS),$(TOP)/src/gallium/drivers/$(DIR)/lib$(DIR).a)
......
......@@ -100,9 +100,8 @@ GALLIUM_DIRS = auxiliary drivers state_trackers
GALLIUM_AUXILIARIES = $(TOP)/src/gallium/auxiliary/libgallium.a
GALLIUM_DRIVERS_DIRS = softpipe trace identity i915 i965 svga r300 nvfx nv50
GALLIUM_DRIVERS = $(foreach DIR,$(GALLIUM_DRIVERS_DIRS),$(TOP)/src/gallium/drivers/$(DIR)/lib$(DIR).a)
GALLIUM_WINSYS_DIRS = null xlib drm
GALLIUM_WINSYS_DIRS = sw sw/xlib
GALLIUM_TARGET_DIRS = libgl-xlib
GALLIUM_WINSYS_DRM_DIRS = swrast
GALLIUM_STATE_TRACKERS_DIRS = glx vega
# native displays EGL should support
......
......@@ -58,9 +58,8 @@ PROGRAM_DIRS := egl $(PROGRAM_DIRS)
EGL_DRIVERS_DIRS = glx
DRIVER_DIRS = dri
GALLIUM_WINSYS_DIRS = null xlib drm
GALLIUM_TARGET_DIRS =
GALLIUM_WINSYS_DRM_DIRS = vmware intel i965
GALLIUM_WINSYS_DIRS = sw sw/xlib drm/vmware drm/intel drm/i965
GALLIUM_TARGET_DIRS = egl-swrast
GALLIUM_STATE_TRACKERS_DIRS = egl
DRI_DIRS = i810 i915 i965 mach64 mga r128 r200 r300 radeon \
......
......@@ -24,6 +24,8 @@ ifeq ($(LLVM_VERSION),)
MESA_LLVM=0
else
MESA_LLVM=1
HAVE_LLVM := 0x0$(subst .,0,$(LLVM_VERSION:svn=))
DEFINES += -DHAVE_LLVM=$(HAVE_LLVM)
# $(info Using LLVM version: $(LLVM_VERSION))
endif
......
......@@ -24,5 +24,5 @@ GALLIUM_STATE_TRACKERS_DIRS = es
# build egl_x11_{swrast,i915}.so
GALLIUM_DRIVERS_DIRS += trace i915
GALLIUM_STATE_TRACKERS_DIRS += egl
GALLIUM_WINSYS_DIRS += drm
GALLIUM_WINSYS_DRM_DIRS += intel swrast
GALLIUM_WINSYS_DIRS += drm/intel
GALLIUM_TARGET_DIRS += egl-swrast egl-i915
......@@ -461,21 +461,20 @@ SRC_DIRS="glew"
GLU_DIRS="sgi"
GALLIUM_DIRS="auxiliary drivers state_trackers"
GALLIUM_TARGET_DIRS=""
GALLIUM_WINSYS_DIRS=""
GALLIUM_WINSYS_DRM_DIRS=""
GALLIUM_WINSYS_DIRS="sw"
GALLIUM_DRIVERS_DIRS="softpipe failover trace identity"
GALLIUM_STATE_TRACKERS_DIRS=""
case "$mesa_driver" in
xlib)
DRIVER_DIRS="x11"
GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS xlib"
GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS sw/xlib"
GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS libgl-xlib"
;;
dri)
SRC_DIRS="$SRC_DIRS glx"
DRIVER_DIRS="dri"
GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS xlib drm"
GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS sw/xlib sw/dri sw/drm"
;;
osmesa)
DRIVER_DIRS="osmesa"
......@@ -487,7 +486,6 @@ AC_SUBST([DRIVER_DIRS])
AC_SUBST([GALLIUM_DIRS])
AC_SUBST([GALLIUM_TARGET_DIRS])
AC_SUBST([GALLIUM_WINSYS_DIRS])
AC_SUBST([GALLIUM_WINSYS_DRM_DIRS])
AC_SUBST([GALLIUM_DRIVERS_DIRS])
AC_SUBST([GALLIUM_STATE_TRACKERS_DIRS])
......@@ -548,9 +546,13 @@ else
fi
dnl Use the autoconf macro if no pkg-config files
if test "$x11_pkgconfig" = yes; then
PKG_CHECK_MODULES([X], [x11])
PKG_CHECK_MODULES([X11], [x11])
else
AC_PATH_XTRA
test -z "$X11_CFLAGS" && X11_CFLAGS="$X_CFLAGS"
test -z "$X11_LIBS" && X11_LIBS="$X_LIBS -lX11"
AC_SUBST([X11_CFLAGS])
AC_SUBST([X11_LIBS])
fi
dnl Try to tell the user that the --x-* options are only used when
......@@ -1178,7 +1180,7 @@ AC_ARG_ENABLE([gallium],
[enable_gallium="$enableval"],
[enable_gallium=yes])
if test "x$enable_gallium" = xyes; then
SRC_DIRS="$SRC_DIRS gallium gallium/winsys"
SRC_DIRS="$SRC_DIRS gallium gallium/winsys gallium/targets"
fi
dnl
......@@ -1203,13 +1205,15 @@ yes)
;;
dri)
GALLIUM_STATE_TRACKERS_DIRS="dri"
HAVE_ST_DRI="yes"
if test "x$enable_egl" = xyes; then
GALLIUM_STATE_TRACKERS_DIRS="$GALLIUM_STATE_TRACKERS_DIRS egl"
HAVE_ST_EGL="yes"
fi
# Have only tested st/xorg on 1.6.0 servers
PKG_CHECK_MODULES(XORG, [xorg-server >= 1.6.0 libdrm >= $LIBDRM_XORG_REQUIRED libkms >= $LIBKMS_XORG_REQUIRED],
HAVE_XORG="yes"; GALLIUM_STATE_TRACKERS_DIRS="$GALLIUM_STATE_TRACKERS_DIRS xorg",
HAVE_XORG="no")
HAVE_ST_XORG="yes"; GALLIUM_STATE_TRACKERS_DIRS="$GALLIUM_STATE_TRACKERS_DIRS xorg",
HAVE_ST_XORG="no")
;;
esac
;;
......@@ -1221,15 +1225,22 @@ yes)
AC_MSG_ERROR([state tracker '$tracker' doesn't exist])
case "$tracker" in
dri)
if test "x$mesa_driver" != xdri; then
AC_MSG_ERROR([cannot build dri state tracker without mesa driver set to dri])
fi
HAVE_ST_DRI="yes"
;;
egl)
if test "x$enable_egl" != xyes; then
AC_MSG_ERROR([cannot build egl state tracker without EGL library])
fi
HAVE_ST_EGL="yes"
;;
xorg)
PKG_CHECK_MODULES([LIBDRM_XORG], [libdrm >= $LIBDRM_XORG_REQUIRED])
PKG_CHECK_MODULES([LIBKMS_XORG], [libkms >= $LIBKMS_XORG_REQUIRED])
HAVE_XORG="yes"
HAVE_ST_XORG="yes"
;;
es)
# mesa/es is required to build es state tracker
......@@ -1241,7 +1252,7 @@ yes)
;;
esac
if test "x$HAVE_XORG" = xyes; then
if test "x$HAVE_ST_XORG" = xyes; then
PKG_CHECK_MODULES(XEXT, [xextproto >= 7.0.99.1],
HAVE_XEXTPROTO_71="yes"; DEFINES="$DEFINES -DHAVE_XEXTPROTO_71",
HAVE_XEXTPROTO_71="no")
......@@ -1305,6 +1316,25 @@ AC_ARG_WITH([max-height],
[AC_MSG_WARN([Large framebuffer: see s_tritemp.h comments.])])]
)
dnl
dnl Gallium helper functions
dnl
gallium_check_st() {
if test "x$HAVE_ST_DRI" = xyes || test "x$HAVE_ST_EGL" = xyes || test "x$HAVE_ST_XORG" = xyes; then
GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS $1"
fi
if test "x$HAVE_ST_DRI" = xyes && test "x$2" != x; then
GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS $2"
fi
if test "x$HAVE_ST_EGL" = xyes && test "x$3" != x; then
GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS $3"
fi
if test "x$HAVE_ST_XORG" = xyes && test "x$4" != x; then
GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS $4"
fi
}
dnl
dnl Gallium SVGA configuration
dnl
......@@ -1314,8 +1344,8 @@ AC_ARG_ENABLE([gallium-svga],
[enable_gallium_svga="$enableval"],
[enable_gallium_svga=auto])
if test "x$enable_gallium_svga" = xyes; then
GALLIUM_WINSYS_DRM_DIRS="$GALLIUM_WINSYS_DRM_DIRS vmware"
GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS svga"
gallium_check_st "svga/drm" "dri-vmwgfx" "egl-vmwgfx" "xorg-vmwgfx"
elif test "x$enable_gallium_svga" = xauto; then
GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS svga"
fi
......@@ -1329,8 +1359,8 @@ AC_ARG_ENABLE([gallium-intel],
[enable_gallium_intel="$enableval"],
[enable_gallium_intel=auto])
if test "x$enable_gallium_intel" = xyes; then
GALLIUM_WINSYS_DRM_DIRS="$GALLIUM_WINSYS_DRM_DIRS intel i965"
GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS i915 i965"
gallium_check_st "i915/drm i965/drm" "dri-i915 dri-i965" "egl-i915 egl-i965" "xorg-i915 xorg-i965"
elif test "x$enable_gallium_intel" = xauto; then
GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS i915 i965"
fi
......@@ -1344,8 +1374,8 @@ AC_ARG_ENABLE([gallium-radeon],
[enable_gallium_radeon="$enableval"],
[enable_gallium_radeon=auto])
if test "x$enable_gallium_radeon" = xyes; then
GALLIUM_WINSYS_DRM_DIRS="$GALLIUM_WINSYS_DRM_DIRS radeon"
GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS r300"
gallium_check_st "radeon/drm" "dri-radeong" "egl-radeon" "xorg-radeon"
elif test "x$enable_gallium_radeon" = xauto; then
GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS r300"
fi
......@@ -1359,8 +1389,8 @@ AC_ARG_ENABLE([gallium-nouveau],
[enable_gallium_nouveau="$enableval"],
[enable_gallium_nouveau=no])
if test "x$enable_gallium_nouveau" = xyes; then
GALLIUM_WINSYS_DRM_DIRS="$GALLIUM_WINSYS_DRM_DIRS nouveau"
GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS nouveau nvfx nv50"
gallium_check_st "nouveau/drm" "dri-nouveau" "egl-nouveau" "xorg-nouveau"
fi
dnl
......@@ -1368,11 +1398,16 @@ dnl Gallium swrast configuration
dnl
AC_ARG_ENABLE([gallium-swrast],
[AS_HELP_STRING([--enable-gallium-swrast],
[build gallium swrast @<:@default=disabled@:>@])],
[build gallium swrast @<:@default=auto@:>@])],
[enable_gallium_swrast="$enableval"],
[enable_gallium_swrast=auto])
if test "x$enable_gallium_swrast" = xyes; then
GALLIUM_WINSYS_DRM_DIRS="$GALLIUM_WINSYS_DRM_DIRS swrast"
if test "x$enable_gallium_swrast" = xyes || test "x$enable_gallium_swrast" = xauto; then
if test "x$HAVE_ST_DRI" = xyes; then
GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS dri-swrast"
fi
if test "x$HAVE_ST_EGL" = xyes; then
GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS egl-swrast"
fi
fi
dnl prepend CORE_DIRS to SRC_DIRS
......@@ -1430,7 +1465,6 @@ if echo "$SRC_DIRS" | grep 'gallium' >/dev/null 2>&1; then
echo " Gallium dirs: $GALLIUM_DIRS"
echo " Target dirs: $GALLIUM_TARGET_DIRS"
echo " Winsys dirs: $GALLIUM_WINSYS_DIRS"
echo " Winsys drm dirs:$GALLIUM_WINSYS_DRM_DIRS"
echo " Driver dirs: $GALLIUM_DRIVERS_DIRS"
echo " Trackers dirs: $GALLIUM_STATE_TRACKERS_DIRS"
else
......
......@@ -106,11 +106,11 @@ noted that the classic <code>libGL</code> is not a state tracker and cannot be
used with EGL (unless the EGL driver in use is <code>egl_glx</code>). To build
the OpenGL state tracker, one may append <code>glx</code> to
<code>--with-state-trackers</code> and manually build
<code>src/gallium/winsys/xlib/</code>.</p>
<code>src/gallium/targets/libgl-xlib/</code>.</p>
<h2>Use EGL</h2>
<p> The demos for OpenGL ES and OpenVG can be found in <code>progs/es1/</code>,
<p>The demos for OpenGL ES and OpenVG can be found in <code>progs/es1/</code>,
<code>progs/es2/</code> and <code>progs/openvg/</code>. You can use them to
test your build. For example,</p>
......
......@@ -10,6 +10,19 @@
<H1>News</H1>
<h2>March 28, 2010</h2>
<p>
<a href="relnotes-7.7.1.html">Mesa 7.7.1</a> is released. This is a bug-fix
release fixing issues found in the 7.7 release.
</p>
<p>
Also, <a href="relnotes-7.8.html">Mesa 7.8</a> is released. This is a new
development release.
</p>
<h2>December 21, 2009</h2>
<p>
<a href="relnotes-7.6.1.html">Mesa 7.6.1</a> is released. This is a bug-fix
......
......@@ -8,7 +8,7 @@
<body bgcolor="#eeeeee">
<H1>Mesa 7.7.1 Release Notes / date tbd</H1>
<H1>Mesa 7.7.1 Release Notes / March 28, 2010</H1>
<p>
Mesa 7.7.1 is a bug-fix release.
......@@ -26,16 +26,18 @@ for DRI hardware acceleration.
<h2>MD5 checksums</h2>
<pre>
tbd
3ab0638cfa7ce8157337a229cf0db2c4 MesaLib-7.7.1.tar.gz
46664d99e03f1e3ac078a7fea02af115 MesaLib-7.7.1.tar.bz2
4e73ba8abb59aff79485eb95d7cefff7 MesaLib-7.7.1.zip
bf1b108983995f7a712cf3343df1c918 MesaDemos-7.7.1.tar.gz
aeb39645d80d656e0adebaa09e5bcd03 MesaDemos-7.7.1.tar.bz2
01c49b7454fd292244eaf8bdc6ed8cf0 MesaDemos-7.7.1.zip
37ec6386693dcb6dc770d1efd63a7a93 MesaGLUT-7.7.1.tar.gz
1e16c85282f843791a21f7bc7b6a1ca8 MesaGLUT-7.7.1.tar.bz2
d352c9e36a8e4d1059f4abc017b131e0 MesaGLUT-7.7.1.zip
</pre>
<h2>New features</h2>
<ul>
<li>tbd
</ul>
<h2>Bug fixes</h2>
<ul>
<li>Assorted fixes to VMware SVGA gallium driver.
......@@ -45,6 +47,12 @@ tbd
<li>Gallium SSE codegen for XPD didn't always work.
<li>Fixed Windows build.
<li>Fixed broken glMultiDrawElements().
<li>Silence bogus GL errors generated in glxinfo.
<li>Fixed several render to texture bugs.
<li>Assorted bug fixes in Mesa/Gallium state tracker including
glCopy/DrawPixels() to FBOs.
<li>Assorted fixes to Gallium drivers.
<li>Fixed broken glPush/PopClientAttrib() for vertex arrays in GLX code.
</ul>
......
......@@ -8,7 +8,7 @@
<body bgcolor="#eeeeee">
<H1>Mesa 7.8 Release Notes / date TBD</H1>
<H1>Mesa 7.8 Release Notes / March 28, 2010</H1>
<p>
Mesa 7.8 is a new development release.
......@@ -28,7 +28,15 @@ for DRI hardware acceleration.
<h2>MD5 checksums</h2>
<pre>
tbd
5fcfde5383eccb3e9fd665f08a0ea59b MesaLib-7.8.tar.gz
85cb891eecb89aae4fdd3499cccd934b MesaLib-7.8.tar.bz2
754f39593006effc1c8ec3c27c2f1296 MesaLib-7.8.zip
c3869c29fa6c3dbdd763f7428d271e12 MesaDemos-7.8.tar.gz
9fe8ec184c7f78691e43c4c0a7f97d56 MesaDemos-7.8.tar.bz2
063a96947f7b83d4ad789c6cf291b184 MesaDemos-7.8.zip
5f4246756b7daaddb4fb3f970cad1e28 MesaGLUT-7.8.tar.gz
ca7048a4aa7a437dcc84cc2c7d731336 MesaGLUT-7.8.tar.bz2
b54581aeb79b585b158d6a32f94feff2 MesaGLUT-7.8.zip
</pre>
......
......@@ -14,10 +14,6 @@ This page describes the features and status of Mesa's support for the
OpenGL Shading Language</a>.
</p>
<p>
Last updated on 15 December 2008.
</p>
<p>
Contents
</p>
......
......@@ -416,15 +416,15 @@ struct __DRIswrastLoaderExtensionRec {
* Put image to drawable
*/
void (*putImage)(__DRIdrawable *drawable, int op,
int x, int y, int width, int height, char *data,
void *loaderPrivate);
int x, int y, int width, int height,
char *data, void *loaderPrivate);
/**
* Get image from drawable
* Get image from readable
*/
void (*getImage)(__DRIdrawable *drawable,
int x, int y, int width, int height, char *data,
void *loaderPrivate);
void (*getImage)(__DRIdrawable *readable,
int x, int y, int width, int height,
char *data, void *loaderPrivate);
};
/**
......
......@@ -56,4 +56,5 @@ SConscript([
'wgl/SConscript',
'perf/SConscript',
'gallium/unit/SConscript',
# 'gallium/raw/SConscript',
])
/**
* Dissolve between two images using randomized stencil buffer
* Dissolve between two images using randomized/patterned stencil buffer
* and varying stencil ref.
*
* Brian Paul
......@@ -9,6 +9,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <GL/glut.h>
#include "readtex.h"
......@@ -28,6 +29,8 @@ static GLfloat ScaleX[2], ScaleY[2];
static GLubyte StencilRef = 0;
static int Mode = 0;
static void
Idle(void)
......@@ -38,13 +41,114 @@ Idle(void)
static void
RandomizeStencilBuffer(void)
FillRandomPixels(GLubyte *b)
{
GLubyte *b = malloc(WinWidth * WinHeight);
int i;
for (i = 0; i < WinWidth * WinHeight; i++) {
b[i] = rand() & 0xff;
}
}
static void
FillRandomRects(GLubyte *b)
{
int i;
memset(b, 0, WinWidth * WinHeight);
for (i = 0; i < 256; i++) {
int x = rand() % WinWidth;
int y = rand() % WinHeight;
int w = rand() % 60;
int h = rand() % 60;
int ix, iy;
if (x + w > WinWidth)
w = WinWidth - x;
if (y + h > WinHeight)
h = WinHeight - y;
for (iy = 0; iy < h; iy++) {
for (ix = 0; ix < w; ix++) {
int p = (y + iy) * WinWidth + x + ix;
b[p] = i;
}
}
}
}
static void
FillWipe(GLubyte *b)
{
int iy, ix;
memset(b, 0, WinWidth * WinHeight);
for (iy = 0; iy < WinHeight; iy++) {
for (ix = 0; ix < WinWidth; ix++) {
int p = iy * WinWidth + ix;
b[p] = 2 * ix + iy / 2;
}
}
}
static void
FillMoire(GLubyte *b)
{
int iy, ix;
memset(b, 0, WinWidth * WinHeight);
for (iy = 0; iy < WinHeight; iy++) {
for (ix = 0; ix < WinWidth; ix++) {
int p = iy * WinWidth + ix;
b[p] = (ix / 2) * (ix / 2) - (iy / 2) * (iy / 2);
}
}
}
static void
FillWaves(GLubyte *b)
{
int iy, ix;