Commit 47bfbd45 authored by Keith Whitwell's avatar Keith Whitwell

Merge commit 'origin/master' into gallium-sampler-view

Conflicts:
	src/gallium/auxiliary/util/u_tile.c
	src/gallium/auxiliary/util/u_tile.h
	src/gallium/drivers/identity/id_context.c
	src/gallium/drivers/llvmpipe/lp_setup.c
	src/gallium/drivers/llvmpipe/lp_setup.h
	src/gallium/drivers/softpipe/sp_tex_tile_cache.c
	src/gallium/include/pipe/p_context.h
	src/mesa/state_tracker/st_cb_bitmap.c
	src/mesa/state_tracker/st_cb_drawpixels.c
parents faa14818 a80e33f4
......@@ -494,13 +494,16 @@ case $ARCH in
OPTS="${OPTS} -Wl,-Mmapfile.scope"
fi
# Check if objects are SPARC v9
# Check if objects are 64-bit
# file says: ELF 64-bit MSB relocatable SPARCV9 Version 1
set ${OBJECTS}
if [ ${LINK} = "cc" -o ${LINK} = "CC" ] ; then
SPARCV9=`file $1 | grep SPARCV9`
if [ "${SPARCV9}" ] ; then
OPTS="${OPTS} -xarch=v9"
ABI64=`file $1 | grep "ELF 64-bit"`
if [ "${ABI64}" ] ; then
case `uname -p` in
sparc) OPTS="${OPTS} -xarch=v9" ;;
i386) OPTS="${OPTS} -xarch=amd64" ;;
esac
fi
fi
if [ "${ALTOPTS}" ] ; then
......
......@@ -100,7 +100,7 @@ GALLIUM_DIRS = auxiliary drivers state_trackers
GALLIUM_AUXILIARIES = $(TOP)/src/gallium/auxiliary/libgallium.a
GALLIUM_DRIVERS_DIRS = softpipe failover svga i915 i965 r300 trace identity
GALLIUM_DRIVERS = $(foreach DIR,$(GALLIUM_DRIVERS_DIRS),$(TOP)/src/gallium/drivers/$(DIR)/lib$(DIR).a)
GALLIUM_WINSYS_DIRS = drm null xlib
GALLIUM_WINSYS_DIRS = null xlib drm
GALLIUM_TARGET_DIRS = libgl-xlib
GALLIUM_WINSYS_DRM_DIRS = swrast
GALLIUM_STATE_TRACKERS_DIRS = glx vega
......
......@@ -58,7 +58,7 @@ PROGRAM_DIRS := egl $(PROGRAM_DIRS)
EGL_DRIVERS_DIRS = glx
DRIVER_DIRS = dri
GALLIUM_WINSYS_DIRS = drm
GALLIUM_WINSYS_DIRS = null xlib drm
GALLIUM_TARGET_DIRS =
GALLIUM_WINSYS_DRM_DIRS = vmware intel i965
GALLIUM_STATE_TRACKERS_DIRS = egl
......
......@@ -22,6 +22,8 @@ LIBDRM_REQUIRED=2.4.15
LIBDRM_RADEON_REQUIRED=2.4.17
DRI2PROTO_REQUIRED=2.1
GLPROTO_REQUIRED=1.4.11
LIBDRM_XORG_REQUIRED=2.4.17
LIBKMS_XORG_REQUIRED=1.0.0
dnl Check for progs
AC_PROG_CPP
......@@ -458,6 +460,7 @@ CORE_DIRS="glsl mesa"
SRC_DIRS="glew"
GLU_DIRS="sgi"
GALLIUM_DIRS="auxiliary drivers state_trackers"
GALLIUM_TARGET_DIRS=""
GALLIUM_WINSYS_DIRS=""
GALLIUM_WINSYS_DRM_DIRS=""
GALLIUM_DRIVERS_DIRS="softpipe failover trace identity"
......@@ -467,11 +470,12 @@ case "$mesa_driver" in
xlib)
DRIVER_DIRS="x11"
GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS xlib"
GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS libgl-xlib"
;;
dri)
SRC_DIRS="$SRC_DIRS glx"
DRIVER_DIRS="dri"
GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS drm"
GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS xlib drm"
;;
osmesa)
DRIVER_DIRS="osmesa"
......@@ -481,6 +485,7 @@ AC_SUBST([SRC_DIRS])
AC_SUBST([GLU_DIRS])
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])
......@@ -1200,7 +1205,7 @@ yes)
GALLIUM_STATE_TRACKERS_DIRS="$GALLIUM_STATE_TRACKERS_DIRS egl"
fi
# Have only tested st/xorg on 1.6.0 servers
PKG_CHECK_MODULES(XORG, [xorg-server >= 1.6.0],
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")
;;
......@@ -1220,9 +1225,9 @@ yes)
fi
;;
xorg)
PKG_CHECK_MODULES(XEXT, [xextproto >= 7.0.99.1],
HAVE_XEXTPROTO_71="yes"; DEFINES="$DEFINES -DHAVE_XEXTPROTO_71",
HAVE_XEXTPROTO_71="no")
PKG_CHECK_MODULES([LIBDRM_XORG], [libdrm >= $LIBDRM_XORG_REQUIRED])
PKG_CHECK_MODULES([LIBKMS_XORG], [libkms >= $LIBKMS_XORG_REQUIRED])
HAVE_XORG="yes"
;;
es)
# mesa/es is required to build es state tracker
......@@ -1234,6 +1239,12 @@ yes)
;;
esac
if test "x$HAVE_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")
fi
AC_ARG_WITH([egl-displays],
[AS_HELP_STRING([--with-egl-displays@<:@=DIRS...@:>@],
[comma delimited native displays libEGL supports, e.g.
......@@ -1415,6 +1426,7 @@ echo ""
if echo "$SRC_DIRS" | grep 'gallium' >/dev/null 2>&1; then
echo " Gallium: yes"
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"
......
......@@ -644,7 +644,7 @@ Hints and Special Features:
- The Voodoo driver supports the GL_EXT_paletted_texture. it works
only with GL_COLOR_INDEX8_EXT, GL_RGBA palettes and the alpha value
is ignored because this is a limitation of the the current Glide
is ignored because this is a limitation of the current Glide
version and of the Voodoo hardware. See Mesa-3.1/3Dfx/demos/paltex.c for
a demo of this extension.
......
......@@ -28,7 +28,7 @@ cards.</p>
<ol>
<li>
<p>Run <code>configure</code> with the desired state trackers and and enable
<p>Run <code>configure</code> with the desired state trackers and enable
the Gallium driver for your hardware. For example</p>
<pre>
......
......@@ -36,6 +36,7 @@ static int tex_width=64, tex_height=64, tex_depth=64;
static float angx=0, angy=0, angz=0;
static int texgen = 2, animate = 1, smooth = 1, wireframe = 0;
static int CurTexture = NOISE_TEXTURE, CurObject = TORUS;
static GLenum Filter = GL_LINEAR;
static void
......@@ -298,8 +299,6 @@ create3Dtexture(void)
printf("setting up 3d texture...\n");
glBindTexture(GL_TEXTURE_3D, NOISE_TEXTURE);
glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_T, GL_REPEAT);
glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_R, GL_REPEAT);
......@@ -406,6 +405,9 @@ drawScene(void)
glDisable(GL_TEXTURE_GEN_R);
}
glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MIN_FILTER, Filter);
glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MAG_FILTER, Filter);
glCallList(CurObject);
glPopMatrix();
......@@ -505,6 +507,12 @@ KeyHandler(unsigned char key, int x, int y)
else
CurObject = TORUS;
break;
case 'f':
if (Filter == GL_LINEAR)
Filter = GL_NEAREST;
else
Filter = GL_LINEAR;
break;
case 'i':
if (CurTexture == NOISE_TEXTURE)
CurTexture = GRADIENT_TEXTURE;
......@@ -513,6 +521,7 @@ KeyHandler(unsigned char key, int x, int y)
glBindTexture(GL_TEXTURE_3D, CurTexture);
break;
case 'a':
case ' ':
animate = !animate;
if (animate)
glutIdleFunc(Idle);
......@@ -559,8 +568,6 @@ create3Dgradient(void)
glBindTexture(GL_TEXTURE_3D, GRADIENT_TEXTURE);
glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_T, GL_REPEAT);
glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_R, GL_REPEAT);
......
......@@ -57,13 +57,13 @@ peglgears: peglgears.o $(HEADERS) $(LIB_DEP)
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIBS) $(LIBDRM_LIB) -lm
xeglgears: xeglgears.o $(HEADERS) $(LIB_DEP)
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIBS) -lX11 -lm
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIBS) -lm -L$(libdir) -lX11
xeglthreads: xeglthreads.o $(HEADERS) $(LIB_DEP)
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIBS) -lX11 -lm
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIBS) -lm -L$(libdir) -lX11
xegl_tri: xegl_tri.o $(HEADERS) $(LIB_DEP)
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIBS) -lX11
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIBS) -lm -L$(libdir) -lX11
clean:
-rm -f *.o *~
......
void main() {
float sum = 0.0;
do {
sum += 0.1;
break;
} while (true);
gl_FragColor = vec4(sum);
}
void main() {
float sum = 0.0;
do {
sum += 0.1;
if (sum < 0.499999)
continue;
break;
} while (true);
gl_FragColor = vec4(sum);
}
uniform int KernelSizeInt;
void main() {
int i;
vec4 sum = vec4(0.0);
for (i = 0; i < KernelSizeInt; ++i) {
sum.g += 0.25;
}
sum.a = 1.0;
gl_FragColor = sum;
}
uniform int KernelSizeInt;
void main() {
int i;
vec4 sum = vec4(0.0);
for (i = 0; i < KernelSizeInt; ++i) {
sum.g += 0.25;
if (i > 0)
break;
}
sum.a = 1.0;
gl_FragColor = sum;
}
......@@ -128,6 +128,11 @@ static void setup_uniforms()
}
{
GLint loci = glGetUniformLocationARB(program, "KernelSizeInt");
if (loci >= 0)
glUniform1i(loci, 4);
}
{
GLint loc1f = glGetUniformLocationARB(program, "KernelValue1f");
GLint loc2f = glGetUniformLocationARB(program, "KernelValue2f");
......
void main() {
// this should always be true
if (gl_FragCoord.x >= 0.0) {
gl_FragColor = vec4(0.5, 0.0, 0.5, 1.0);
}
}
void main() {
float sum = 0.0;
while (sum < 0.499999) {
sum += 0.1;
}
gl_FragColor = vec4(sum);
}
void main() {
float sum = 0.0;
while (true) {
sum += 0.1;
if (sum > 0.8)
break;
}
gl_FragColor = vec4(sum);
}
......@@ -1041,7 +1041,7 @@ glmFacetNormals(GLMmodel* model)
/* glmVertexNormals: Generates smooth vertex normals for a model.
* First builds a list of all the triangles each vertex is in. Then
* loops through each vertex in the the list averaging all the facet
* loops through each vertex in the list averaging all the facet
* normals of the triangles each vertex is in. Finally, sets the
* normal index in the triangle for the vertex to the generated smooth
* normal. If the dot product of a facet normal and the facet normal
......
......@@ -153,7 +153,7 @@ glmFacetNormals(GLMmodel* model);
/* glmVertexNormals: Generates smooth vertex normals for a model.
* First builds a list of all the triangles each vertex is in. Then
* loops through each vertex in the the list averaging all the facet
* loops through each vertex in the list averaging all the facet
* normals of the triangles each vertex is in. Finally, sets the
* normal index in the triangle for the vertex to the generated smooth
* normal. If the dot product of a facet normal and the facet normal
......
......@@ -12,29 +12,39 @@ bezmesh
checker
clip
colormat
combiner
convolution
cube
cubemap
depthcue
dof
double
drawf
feedback
fog
fogcoord
fogindex
font
hello
histogram
image
light
lines
list
material
minmax
mipmap
model
movelight
multisamp
multitex
mvarray
nurbs
pickdepth
picksquare
plane
planet
pointp
polyoff
polys
quadric
......@@ -44,10 +54,12 @@ scene
scenebamb
sceneflat
select
shadowmap
smooth
stencil
stroke
surface
surfpoints
teaambient
teapots
tess
......@@ -56,6 +68,7 @@ texbind
texgen
texprox
texsub
texture3d
texturesurf
torus
trim
......
......@@ -33,7 +33,8 @@ CheckError(int line)
static void
Display( void )
{
GLubyte *buffer = malloc(Width * Height * 4);
GLboolean copyPix = GL_FALSE;
GLboolean blitPix = GL_FALSE;
GLenum status;
CheckError(__LINE__);
......@@ -63,16 +64,43 @@ Display( void )
glutSolidTeapot(2.0);
glPopMatrix();
/* read from user framebuffer */
glReadPixels(0, 0, Width, Height, GL_RGBA, GL_UNSIGNED_BYTE, buffer);
if (copyPix) {
glBindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT, MyFB);
glReadBuffer(GL_COLOR_ATTACHMENT0_EXT);
glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT, 0);
glDrawBuffer(GL_BACK);
/* draw to window */
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
glDisable(GL_DEPTH_TEST); /* in case window has depth buffer */
glWindowPos2iARB(0, 0);
glDrawPixels(Width, Height, GL_RGBA, GL_UNSIGNED_BYTE, buffer);
glDisable(GL_DEPTH_TEST); /* in case window has depth buffer */
glWindowPos2iARB(0, 0);
glCopyPixels(0, 0, Width, Height, GL_COLOR);
}
else if (blitPix) {
glBindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT, MyFB);
glReadBuffer(GL_COLOR_ATTACHMENT0_EXT);
glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT, 0);
glDrawBuffer(GL_BACK);
glDisable(GL_DEPTH_TEST); /* in case window has depth buffer */
glBlitFramebufferEXT(0, 0, Width, Height,
0, 0, Width, Height,
GL_COLOR_BUFFER_BIT, GL_NEAREST);
}
else {
GLubyte *buffer = malloc(Width * Height * 4);
/* read from user framebuffer */
glReadPixels(0, 0, Width, Height, GL_RGBA, GL_UNSIGNED_BYTE, buffer);
/* draw to window */
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
glDisable(GL_DEPTH_TEST); /* in case window has depth buffer */
glWindowPos2iARB(0, 0);
glDrawPixels(Width, Height, GL_RGBA, GL_UNSIGNED_BYTE, buffer);
free(buffer);
}
free(buffer);
glutSwapBuffers();
CheckError(__LINE__);
}
......
......@@ -30,7 +30,7 @@
* it (via \c glPopClientAttrib). After popping, the state of the VAO is
* examined.
*
* According the the APPLE_vertex_array_object spec, the contents of the VAO
* According to the APPLE_vertex_array_object spec, the contents of the VAO
* should be restored to the values that they had when pushed.
*
* \author Ian Romanick <idr@us.ibm.com>
......
......@@ -30,7 +30,7 @@
* it (via \c glPopClientAttrib). After popping, the state of the VAO is
* examined.
*
* According the the APPLE_vertex_array_object spec, the contents of the VAO
* According to the APPLE_vertex_array_object spec, the contents of the VAO
* should be restored to the values that they had when pushed.
*
* \author Ian Romanick <idr@us.ibm.com>
......
......@@ -11,6 +11,7 @@ include $(TOP)/configs/current
LIBS = -L$(TOP)/$(LIB_DIR) -l $(GLEW_LIB) -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) $(APP_LIB_DEPS)
SOURCES = \
clear-fbo-scissor.c \
clear-fbo-tex.c \
clear-fbo.c \
clear-scissor.c \
......
Import('*')
progs = [
'clear-fbo-tex',
'clear-fbo-scissor',
'clear-fbo-tex',
'clear-fbo',
'clear-scissor',
'clear-undefined',
......
/*
* Use scissor to clear the four quadrants of the FBO to different
* colors. Then draw a grey triangle in the middle.
*/
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <GL/glew.h>
#include <GL/glut.h>
#include <GL/glu.h>
static int Width = 512, Height = 512;
static GLuint MyFB, MyRB;
static GLboolean UseTex = GL_FALSE;
static GLboolean UseCopyPix = GL_FALSE;
#define CheckError() \
do { \
GLenum err = glGetError(); \
if (err != GL_NO_ERROR) \
printf("Error: %s\n", gluErrorString(err)); \
assert(err == GL_NO_ERROR); \
} while (0)
static void
Init(void)
{
GLenum status;
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);
if (!glutExtensionSupported("GL_EXT_framebuffer_object")) {
printf("GL_EXT_framebuffer_object not found!\n");
exit(0);
}
glGenFramebuffersEXT(1, &MyFB);
glGenRenderbuffersEXT(1, &MyRB);
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, MyFB);
if (UseTex) {
GLuint tex;
glGenTextures(1, &tex);
glBindTexture(GL_TEXTURE_2D, tex);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, Width, Height, 0,
GL_RGBA, GL_UNSIGNED_BYTE, NULL);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT,
GL_COLOR_ATTACHMENT0_EXT,
GL_TEXTURE_2D, tex, 0);
}
else {
glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, MyRB);
glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT,
GL_COLOR_ATTACHMENT0_EXT,
GL_RENDERBUFFER_EXT, MyRB);
glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_RGB, Width, Height);
}
status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT);
if (status != GL_FRAMEBUFFER_COMPLETE_EXT) {
fprintf(stderr, "Framebuffer object is incomplete (0x%x)!\n", status);
}
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
}
static void
Reshape(int width, int height)
{
glViewport(0, 0, width, height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-1.0, 1.0, -1.0, 1.0, -1.0, 1.0);
glMatrixMode(GL_MODELVIEW);
Width = width;
Height = height;
if (!UseTex) {
glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_RGB, Width, Height);
}
}
static void
Key(unsigned char key, int x, int y)
{
if (key == 27) {
exit(0);
}
glutPostRedisplay();
}
static void
Draw(void)
{
GLboolean scissor = GL_TRUE;
/* draw to user framebuffer */
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, MyFB);
glDrawBuffer(GL_COLOR_ATTACHMENT0_EXT);
glReadBuffer(GL_COLOR_ATTACHMENT0_EXT);
glViewport(0, 0, Width, Height);
CheckError();
if (scissor) {
glEnable(GL_SCISSOR_TEST);
/* lower-left = red */
glClearColor(1, 0, 0, 0);
glScissor(0, 0, Width / 2, Height / 2);
glClear(GL_COLOR_BUFFER_BIT);
/* lower-right = green */
glClearColor(0, 1, 0, 0);
glScissor(Width / 2, 0, Width - Width / 2, Height / 2);
glClear(GL_COLOR_BUFFER_BIT);
/* upper-left = blue */
glClearColor(0, 0, 1, 0);
glScissor(0, Height / 2, Width / 2, Height - Height / 2);
glClear(GL_COLOR_BUFFER_BIT);
/* upper-right = white */
glClearColor(1, 1, 1, 0);
glScissor(Width / 2, Height / 2, Width - Width / 2, Height - Height / 2);
glClear(GL_COLOR_BUFFER_BIT);
glDisable(GL_SCISSOR_TEST);
}
else {
glClearColor(0, 1, 0, 0);