mesa: Changes to 'upstream-unstable'
Makefile | 10
bin/mklib | 9
configs/linux-static | 3
configs/linux-x86-64-static | 3
configs/linux-x86-static | 3
docs/fbdev-dri.html | 6
docs/memory.html | 21 +
docs/news.html | 17 +
docs/relnotes-7.0.3.html | 59 +++
docs/relnotes.html | 1
docs/shading.html | 1
include/GL/glutf90.h | 4
progs/trivial/quad-clip-nearplane.c | 43 +-
progs/xdemos/offset.c | 3
src/glut/glx/Makefile | 1
src/glut/glx/glut_event.c | 6
src/glut/glx/glut_fbc.c | 164 -----------
src/glut/glx/glut_fcb.c | 164 +++++++++++
src/glw/glw.pc.in | 2
src/mesa/Makefile | 2
src/mesa/drivers/common/driverfuncs.c | 2
src/mesa/drivers/dri/i915tex/i830_vtbl.c | 62 +++-
src/mesa/drivers/dri/i915tex/i915_vtbl.c | 55 +++
src/mesa/drivers/dri/i915tex/intel_batchbuffer.c | 2
src/mesa/drivers/dri/i915tex/intel_batchbuffer.h | 3
src/mesa/drivers/dri/i915tex/intel_blit.c | 32 +-
src/mesa/drivers/dri/i915tex/intel_buffers.c | 50 +--
src/mesa/drivers/dri/i915tex/intel_context.c | 2
src/mesa/drivers/dri/i915tex/intel_context.h | 1
src/mesa/drivers/dri/i915tex/intel_screen.h | 1
src/mesa/drivers/dri/i915tex/intel_tris.c | 3
src/mesa/drivers/dri/i965/brw_wm_emit.c | 1
src/mesa/drivers/dri/r200/r200_texstate.c | 9
src/mesa/drivers/dri/radeon/radeon_screen.c | 7
src/mesa/drivers/windows/gdi/wgl.c | 16 -
src/mesa/drivers/windows/gdi/wmesa.c | 1
src/mesa/main/config.h | 2
src/mesa/main/context.c | 1
src/mesa/main/dd.h | 5
src/mesa/main/enable.c | 8
src/mesa/main/mtypes.h | 10
src/mesa/main/points.c | 11
src/mesa/main/version.h | 6
src/mesa/shader/arbprogparse.c | 2
src/mesa/shader/prog_execute.c | 128 ++++----
src/mesa/shader/prog_execute.h | 3
src/mesa/shader/prog_parameter.c | 2
src/mesa/shader/prog_statevars.c | 93 ++++++
src/mesa/shader/prog_statevars.h | 8
src/mesa/shader/slang/slang_builtin.c | 16 -
src/mesa/shader/slang/slang_codegen.c | 3
src/mesa/shader/slang/slang_emit.c | 12
src/mesa/swrast/s_aalinetemp.h | 1
src/mesa/swrast/s_aatritemp.h | 10
src/mesa/swrast/s_context.c | 27 +
src/mesa/swrast/s_context.h | 4
src/mesa/swrast/s_fragprog.c | 32 +-
src/mesa/swrast/s_linetemp.h | 3
src/mesa/swrast/s_pointtemp.h | 1
src/mesa/swrast/s_readpix.c | 5
src/mesa/swrast/s_texfilter.c | 35 --
src/mesa/swrast/s_triangle.c | 2
src/mesa/swrast/s_tritemp.h | 11
src/mesa/swrast/swrast.h | 7
src/mesa/swrast_setup/ss_context.c | 3
src/mesa/swrast_setup/ss_triangle.c | 10
src/mesa/swrast_setup/ss_tritmp.h | 2
src/mesa/tnl/t_vb_program.c | 340 +++++++++++++----------
src/mesa/tnl/tnl.h | 8
src/mesa/tnl_dd/t_dd_tritmp.h | 8
70 files changed, 1020 insertions(+), 568 deletions(-)
New commits:
commit 0107acded03c510df2093b0b98bca52b5734dd5b
Author: Michel Dänzer <michel@tungstengraphics.com>
Date: Mon Dec 17 12:20:56 2007 +0100
i915tex: Fix issues with glDrawBuffer(GL_NONE).
Don't dereference NULL renderbuffer pointer, and make sure the software
fallback sticks.
Fixes https://bugs.freedesktop.org/show_bug.cgi?id=13694 .
diff --git a/src/mesa/drivers/dri/i915tex/intel_buffers.c b/src/mesa/drivers/dri/i915tex/intel_buffers.c
index 78fb720..6778fdf 100644
--- a/src/mesa/drivers/dri/i915tex/intel_buffers.c
+++ b/src/mesa/drivers/dri/i915tex/intel_buffers.c
@@ -714,7 +714,8 @@ intel_wait_flips(struct intel_context *intel, GLuint batch_flags)
BUFFER_BIT_FRONT_LEFT ? BUFFER_FRONT_LEFT :
BUFFER_BACK_LEFT);
- if (intel_fb->Base.Name == 0 && intel_rb->pf_pending == intel_fb->pf_seq) {
+ if (intel_fb->Base.Name == 0 && intel_rb &&
+ intel_rb->pf_pending == intel_fb->pf_seq) {
GLint pf_pipes = intel_fb->pf_pipes;
BATCH_LOCALS;
@@ -1019,16 +1020,11 @@ intel_draw_buffer(GLcontext * ctx, struct gl_framebuffer *fb)
/*
* How many color buffers are we drawing into?
*/
- if (fb->_NumColorDrawBuffers[0] != 1
-#if 0
- /* XXX FBO temporary - always use software rendering */
- || 1
-#endif
- ) {
+ if (fb->_NumColorDrawBuffers[0] != 1) {
/* writing to 0 or 2 or 4 color buffers */
/*_mesa_debug(ctx, "Software rendering\n");*/
FALLBACK(intel, INTEL_FALLBACK_DRAW_BUFFER, GL_TRUE);
- front = 1; /* might not have back color buffer */
+ colorRegion = NULL;
}
else {
/* draw to exactly one color buffer */
@@ -1037,30 +1033,30 @@ intel_draw_buffer(GLcontext * ctx, struct gl_framebuffer *fb)
if (fb->_ColorDrawBufferMask[0] == BUFFER_BIT_FRONT_LEFT) {
front = 1;
}
- }
- /*
- * Get the intel_renderbuffer for the colorbuffer we're drawing into.
- * And set up cliprects.
- */
- if (fb->Name == 0) {
- /* drawing to window system buffer */
- if (front) {
- intelSetFrontClipRects(intel);
- colorRegion = intel_get_rb_region(fb, BUFFER_FRONT_LEFT);
+ /*
+ * Get the intel_renderbuffer for the colorbuffer we're drawing into.
+ * And set up cliprects.
+ */
+ if (fb->Name == 0) {
+ /* drawing to window system buffer */
+ if (front) {
+ intelSetFrontClipRects(intel);
+ colorRegion = intel_get_rb_region(fb, BUFFER_FRONT_LEFT);
+ }
+ else {
+ intelSetBackClipRects(intel);
+ colorRegion = intel_get_rb_region(fb, BUFFER_BACK_LEFT);
+ }
}
else {
- intelSetBackClipRects(intel);
- colorRegion = intel_get_rb_region(fb, BUFFER_BACK_LEFT);
+ /* drawing to user-created FBO */
+ struct intel_renderbuffer *irb;
+ intelSetRenderbufferClipRects(intel);
+ irb = intel_renderbuffer(fb->_ColorDrawBuffers[0][0]);
+ colorRegion = (irb && irb->region) ? irb->region : NULL;
}
}
- else {
- /* drawing to user-created FBO */
- struct intel_renderbuffer *irb;
- intelSetRenderbufferClipRects(intel);
- irb = intel_renderbuffer(fb->_ColorDrawBuffers[0][0]);
- colorRegion = (irb && irb->region) ? irb->region : NULL;
- }
/* Update culling direction which changes depending on the
* orientation of the buffer:
commit 2ac5e08d1d41377dc873b31875701f59e74242ec
Author: Brian <brian.paul@tungstengraphics.com>
Date: Fri Dec 14 14:33:53 2007 -0700
fix polygon cull regression
diff --git a/src/mesa/swrast/s_context.c b/src/mesa/swrast/s_context.c
index 47d5035..9b9b73f 100644
--- a/src/mesa/swrast/s_context.c
+++ b/src/mesa/swrast/s_context.c
@@ -1,6 +1,6 @@
/*
* Mesa 3-D graphics library
- * Version: 6.5.3
+ * Version: 7.0.3
*
* Copyright (C) 1999-2007 Brian Paul All Rights Reserved.
*
@@ -128,21 +128,17 @@ _swrast_update_polygon( GLcontext *ctx )
GLfloat backface_sign;
if (ctx->Polygon.CullFlag) {
- backface_sign = 1.0;
switch (ctx->Polygon.CullFaceMode) {
case GL_BACK:
- if (ctx->Polygon.FrontFace == GL_CCW)
- backface_sign = -1.0;
+ backface_sign = -1.0;
break;
case GL_FRONT:
- if (ctx->Polygon.FrontFace != GL_CCW)
- backface_sign = -1.0;
+ backface_sign = 1.0;
break;
case GL_FRONT_AND_BACK:
/* fallthrough */
default:
backface_sign = 0.0;
- break;
}
}
else {
commit 1837b8c214a362ccecc441f7b6880f623e70b8d6
Author: Dan Nicholson <dbn.lists@gmail.com>
Date: Wed Oct 31 17:12:07 2007 -0700
configs: Fix linking with static libGL and --as-needed
Linking of the programs breaks when using a static libGL and the GNU ld
option --as-needed. This is because libXext is needed for the XShm
functions.
(cherry picked from commit 6aaf9bdd418e11d5ccb76a6ab85a8df36b0c8804)
diff --git a/configs/linux-static b/configs/linux-static
index 2a77d4c..1ee16be 100644
--- a/configs/linux-static
+++ b/configs/linux-static
@@ -22,4 +22,5 @@ GLUT_LIB_DEPS =
GLW_LIB_DEPS =
# Need to specify all libraries we may need
-APP_LIB_DEPS = $(EXTRA_LIB_PATH) -lX11 -lXmu -lXt -lXi -lpthread -lstdc++ -lm
+APP_LIB_DEPS = $(EXTRA_LIB_PATH) -lX11 -lXext -lXmu -lXt -lXi -lpthread \
+ -lstdc++ -lm
diff --git a/configs/linux-x86-64-static b/configs/linux-x86-64-static
index 06e6fc3..611abf0 100644
--- a/configs/linux-x86-64-static
+++ b/configs/linux-x86-64-static
@@ -20,4 +20,5 @@ OSMESA_LIB_DEPS =
GLU_LIB_DEPS =
GLUT_LIB_DEPS =
GLW_LIB_DEPS =
-APP_LIB_DEPS = $(EXTRA_LIB_PATH) -lX11 -lXmu -lXt -lXi -lpthread -lstdc++ -lm
+APP_LIB_DEPS = $(EXTRA_LIB_PATH) -lX11 -lXext -lXmu -lXt -lXi -lpthread \
+ -lstdc++ -lm
diff --git a/configs/linux-x86-static b/configs/linux-x86-static
index 2b6478b..645196c 100644
--- a/configs/linux-x86-static
+++ b/configs/linux-x86-static
@@ -20,4 +20,5 @@ OSMESA_LIB_DEPS =
GLU_LIB_DEPS =
GLUT_LIB_DEPS =
GLW_LIB_DEPS =
-APP_LIB_DEPS = $(EXTRA_LIB_PATH) -lX11 -lXmu -lXt -lXi -lpthread -lstdc++ -lm
+APP_LIB_DEPS = $(EXTRA_LIB_PATH) -lX11 -lXext -lXmu -lXt -lXi -lpthread \
+ -lstdc++ -lm
commit 03d2bc1774e3612edca4be48c5aeafaafa2a52b1
Author: Brian <brian.paul@tungstengraphics.com>
Date: Tue Dec 4 14:06:26 2007 -0700
fix gl_FrontFacing
diff --git a/docs/relnotes-7.0.3.html b/docs/relnotes-7.0.3.html
index 640013f..173833d 100644
--- a/docs/relnotes-7.0.3.html
+++ b/docs/relnotes-7.0.3.html
@@ -32,6 +32,7 @@ Mesa 7.0.3 is a stable release with bug fixes since version 7.0.2.
<li>Fix crash upon GLSL variable array indexes (not yet supported)
<li>Two-sided stencil test didn't work in software rendering
<li>Fix two-sided lighting bugs/crashes (bug 13368)
+<li>GLSL gl_FrontFacing didn't work properly
</ul>
commit 385bddbde04ca3ec2a159e8c8a50d9009da25b63
Author: Brian <brian.paul@tungstengraphics.com>
Date: Tue Dec 4 14:06:01 2007 -0700
fix span->facing computation and gl_FrontFacing initialization
diff --git a/src/mesa/swrast/s_fragprog.c b/src/mesa/swrast/s_fragprog.c
index 324afb9..89114eb 100644
--- a/src/mesa/swrast/s_fragprog.c
+++ b/src/mesa/swrast/s_fragprog.c
@@ -118,7 +118,7 @@ init_machine(GLcontext *ctx, struct gl_program_machine *machine,
if (ctx->Shader.CurrentProgram) {
/* Store front/back facing value in register FOGC.Y */
- machine->Attribs[FRAG_ATTRIB_FOGC][col][1] = (GLfloat) span->facing;
+ machine->Attribs[FRAG_ATTRIB_FOGC][col][1] = 1.0 - span->facing;
}
machine->CurElement = col;
diff --git a/src/mesa/swrast/s_tritemp.h b/src/mesa/swrast/s_tritemp.h
index ae30fe5..891eaf6 100644
--- a/src/mesa/swrast/s_tritemp.h
+++ b/src/mesa/swrast/s_tritemp.h
@@ -172,7 +172,7 @@ static void NAME(GLcontext *ctx, const SWvertex *v0,
EdgeT eMaj, eTop, eBot;
GLfloat oneOverArea;
const SWvertex *vMin, *vMid, *vMax; /* Y(vMin)<=Y(vMid)<=Y(vMax) */
- GLfloat bf = SWRAST_CONTEXT(ctx)->_BackfaceCullSign;
+ GLfloat bf = SWRAST_CONTEXT(ctx)->_BackfaceSign;
#if !TRIANGLE_WALK_DOUBLE
const GLint snapMask = ~((FIXED_ONE / (1 << SUB_PIXEL_BITS)) - 1); /* for x/y coord snapping */
#endif
@@ -292,18 +292,16 @@ static void NAME(GLcontext *ctx, const SWvertex *v0,
#else
const GLfloat area = eMaj.dx * eBot.dy - eBot.dx * eMaj.dy;
#endif
- /* Do backface culling */
-
- if (area * bf < 0.0)
+ if (IS_INF_OR_NAN(area) || area == 0.0F)
return;
- if (IS_INF_OR_NAN(area) || area == 0.0F)
+ if (area * bf * swrast->_BackfaceCullSign < 0.0)
return;
oneOverArea = 1.0F / area;
/* 0 = front, 1 = back */
- span.facing = oneOverArea * swrast->_BackfaceSign > 0.0F;
+ span.facing = oneOverArea * bf > 0.0F;
}
/* Edge setup. For a triangle strip these could be reused... */
commit c13542626729a6fe3e4dfbc71f3569119255b668
Author: Brian <brian.paul@tungstengraphics.com>
Date: Tue Dec 4 14:05:11 2007 -0700
Fix gl_FrontFacing compilation problem
diff --git a/src/mesa/shader/slang/slang_codegen.c b/src/mesa/shader/slang/slang_codegen.c
index 675dd83..ef9c0ab 100644
--- a/src/mesa/shader/slang/slang_codegen.c
+++ b/src/mesa/shader/slang/slang_codegen.c
@@ -2344,7 +2344,8 @@ _slang_gen_field(slang_assemble_ctx * A, slang_operation *oper)
return n;
}
else if ( ti.spec.type == SLANG_SPEC_FLOAT
- || ti.spec.type == SLANG_SPEC_INT) {
+ || ti.spec.type == SLANG_SPEC_INT
+ || ti.spec.type == SLANG_SPEC_BOOL) {
const GLuint rows = 1;
slang_swizzle swz;
slang_ir_node *n;
commit 4be0c981205b5530366a10eb96e06b93a2439391
Author: Michel Dänzer <michel@tungstengraphics.com>
Date: Tue Dec 4 10:46:45 2007 +0100
Use -Bsymbolic for linking all shared objects.
Fixes https://bugs.freedesktop.org/show_bug.cgi?id=10132 .
Also remove comment about SONAME, as SONAME only applies to shared libraries.
(cherry picked from commit fc7ddea8535f1a9c196bf30f7864414e4ac18b8a)
diff --git a/bin/mklib b/bin/mklib
index 499e789..0fb9930 100755
--- a/bin/mklib
+++ b/bin/mklib
@@ -209,8 +209,13 @@ case $ARCH in
if [ $NOPREFIX = 1 ] ; then
# No "lib" or ".so" part
echo "mklib: Making" $ARCH "shared library: " ${LIBNAME}
- #OPTS="-shared -Wl,-soname,${LIBNAME}" # soname???
- OPTS="-shared"
+ case $ARCH in 'Linux' | 'GNU' | GNU/*)
+ OPTS="-Xlinker -Bsymbolic -shared"
+ ;;
+ *)
+ OPTS="-shared"
+ ;;
+ esac
# Check if objects are 32-bit and we're running in 64-bit
# environment. If so, pass -m32 flag to linker.
commit e760aebd5aaecc220c6789fe925897909a876acd
Author: Brian <brian@i915.localnet.net>
Date: Mon Dec 3 14:11:46 2007 -0700
fix two-side lighting bug/crash
diff --git a/docs/relnotes-7.0.3.html b/docs/relnotes-7.0.3.html
index 4b41c5d..640013f 100644
--- a/docs/relnotes-7.0.3.html
+++ b/docs/relnotes-7.0.3.html
@@ -31,6 +31,7 @@ Mesa 7.0.3 is a stable release with bug fixes since version 7.0.2.
<li>GLSL gl_FrontLightModelProduct.sceneColor variable wasn't defined
<li>Fix crash upon GLSL variable array indexes (not yet supported)
<li>Two-sided stencil test didn't work in software rendering
+<li>Fix two-sided lighting bugs/crashes (bug 13368)
</ul>
commit 1f6e7d9c297aba2e936352d6ae8a4198b5c64af5
Author: Brian <brian@i915.localnet.net>
Date: Mon Dec 3 14:11:26 2007 -0700
fix DD_TRI_LIGHT_TWOSIDE bug (#13368)
diff --git a/src/mesa/main/enable.c b/src/mesa/main/enable.c
index 1c6167b..0c2bf8c 100644
--- a/src/mesa/main/enable.c
+++ b/src/mesa/main/enable.c
@@ -5,9 +5,9 @@
/*
* Mesa 3-D graphics library
- * Version: 6.5.1
+ * Version: 7.0.3
*
- * Copyright (C) 1999-2006 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2007 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -364,12 +364,12 @@ _mesa_set_enable(GLcontext *ctx, GLenum cap, GLboolean state)
case GL_LIGHTING:
if (ctx->Light.Enabled == state)
return;
+ FLUSH_VERTICES(ctx, _NEW_LIGHT);
+ ctx->Light.Enabled = state;
if (ctx->Light.Enabled && ctx->Light.Model.TwoSide)
ctx->_TriangleCaps |= DD_TRI_LIGHT_TWOSIDE;
else
ctx->_TriangleCaps &= ~DD_TRI_LIGHT_TWOSIDE;
- FLUSH_VERTICES(ctx, _NEW_LIGHT);
- ctx->Light.Enabled = state;
break;
case GL_LINE_SMOOTH:
if (ctx->Line.SmoothFlag == state)
commit c6d421af05ccdd377df5cade301c5c25814ddf0c
Author: Dan Nicholson <dbn.lists@gmail.com>
Date: Mon Dec 3 11:57:14 2007 -0800
Fix the library name in glw.pc
Fix a copy and paste error s/GLU/GLw/ in glw.pc.
(cherry picked from commit 2dc85e8078bed67cb5d8bc3e16484f56c61c61ca)
diff --git a/src/glw/glw.pc.in b/src/glw/glw.pc.in
index 951e2dc..9c2682f 100644
--- a/src/glw/glw.pc.in
+++ b/src/glw/glw.pc.in
@@ -7,5 +7,5 @@ Name: glw
Description: Mesa OpenGL widget library
Requires: gl
Version: @VERSION@
-Libs: -L${libdir} -lGLU
+Libs: -L${libdir} -lGLw
Cflags: -I${includedir}
commit 952df5e493198de91b329983dae5366102eb0a25
Author: Brian <brian.paul@tungstengraphics.com>
Date: Mon Dec 3 11:59:40 2007 -0700
fix two-sided stencil
diff --git a/docs/relnotes-7.0.3.html b/docs/relnotes-7.0.3.html
index 8d46989..4b41c5d 100644
--- a/docs/relnotes-7.0.3.html
+++ b/docs/relnotes-7.0.3.html
@@ -30,6 +30,7 @@ Mesa 7.0.3 is a stable release with bug fixes since version 7.0.2.
<li>Fix GLUT/Fortran issues
<li>GLSL gl_FrontLightModelProduct.sceneColor variable wasn't defined
<li>Fix crash upon GLSL variable array indexes (not yet supported)
+<li>Two-sided stencil test didn't work in software rendering
</ul>
commit 45acb8b058fc0f61a1c2687897c5d4042b534760
Author: Brian <brian.paul@tungstengraphics.com>
Date: Mon Dec 3 11:58:16 2007 -0700
added missing quote char
diff --git a/src/mesa/Makefile b/src/mesa/Makefile
index eea8eb9..d0c19f5 100644
--- a/src/mesa/Makefile
+++ b/src/mesa/Makefile
@@ -65,7 +65,7 @@ linux-solo: depend subdirs libmesa.a
# Stand-alone Mesa libGL, no built-in drivers (DirectFB)
libgl-core: $(CORE_OBJECTS)
- @ $(TOP)/bin/mklib -o $(GL_LIB) -linker '$(CC)' -ldflags '$(LDFLAGS) \
+ @ $(TOP)/bin/mklib -o $(GL_LIB) -linker '$(CC)' -ldflags '$(LDFLAGS)' \
-major $(MESA_MAJOR) -minor $(MESA_MINOR) -patch $(MESA_TINY) \
-install $(TOP)/$(LIB_DIR) $(MKLIB_OPTIONS) $(CORE_OBJECTS) \
$(GL_LIB_DEPS)
commit e8997c0183dbdb59884cc02af81d2faab1beaba1
Author: Michel Dänzer <michel@tungstengraphics.com>
Date: Fri Nov 30 11:40:06 2007 +0100
i915tex: Fix up state changes for i8xx.
(cherry picked from commit 2af613e0b8e6f89cc7528ff5a969e18f077e61fc)
diff --git a/src/mesa/drivers/dri/i915tex/i830_vtbl.c b/src/mesa/drivers/dri/i915tex/i830_vtbl.c
index 5555b74..e76e2e7 100644
--- a/src/mesa/drivers/dri/i915tex/i830_vtbl.c
+++ b/src/mesa/drivers/dri/i915tex/i830_vtbl.c
@@ -378,9 +378,15 @@ do { \
} while (0)
static GLuint
+get_dirty(struct i830_hw_state *state)
+{
+ return state->active & ~state->emitted;
+}
+
+static GLuint
get_state_size(struct i830_hw_state *state)
{
- GLuint dirty = state->active & ~state->emitted;
+ GLuint dirty = get_dirty(state);
GLuint sz = 0;
GLuint i;
@@ -411,7 +417,7 @@ get_state_size(struct i830_hw_state *state)
/* Push the state into the sarea and/or texture memory.
*/
static void
-i830_emit_state(struct intel_context *intel)
+i830_do_emit_state(struct intel_context *intel)
{
struct i830_context *i830 = i830_context(&intel->ctx);
struct i830_hw_state *state = i830->current;
@@ -428,10 +434,32 @@ i830_emit_state(struct intel_context *intel)
*/
intel_batchbuffer_require_space(intel->batch, get_state_size(state), 0);
+ /* Workaround. There are cases I haven't been able to track down
+ * where we aren't emitting a full state at the start of a new
+ * batchbuffer. This code spots that we are on a new batchbuffer
+ * and forces a full state emit no matter what.
+ *
+ * In the normal case state->emitted is already zero, this code is
+ * another set of checks to make sure it really is.
+ */
+ if (intel->batch->id != intel->last_state_batch_id ||
+ intel->batch->map == intel->batch->ptr)
+ {
+ state->emitted = 0;
+ intel_batchbuffer_require_space(intel->batch, get_state_size(state), 0);
+ }
+
/* Do this here as we may have flushed the batchbuffer above,
* causing more state to be dirty!
*/
- dirty = state->active & ~state->emitted;
+ dirty = get_dirty(state);
+ state->emitted |= dirty;
+ assert(get_dirty(state) == 0);
+
+ if (intel->batch->id != intel->last_state_batch_id) {
+ assert(dirty & I830_UPLOAD_CTX);
+ intel->last_state_batch_id = intel->batch->id;
+ }
if (dirty & I830_UPLOAD_INVARIENT) {
DBG("I830_UPLOAD_INVARIENT:\n");
@@ -513,7 +541,30 @@ i830_emit_state(struct intel_context *intel)
}
}
- state->emitted |= dirty;
+ intel->batch->dirty_state &= ~dirty;
+ assert(get_dirty(state) == 0);
+}
+
+static void
+i830_emit_state(struct intel_context *intel)
+{
+ struct i830_context *i830 = i830_context(&intel->ctx);
+
+ i830_do_emit_state( intel );
+
+ /* Second chance - catch batchbuffer wrap in the middle of state
+ * emit. This shouldn't happen but it has been observed in
+ * testing.
+ */
+ if (get_dirty( i830->current )) {
+ /* Force a full re-emit if this happens.
+ */
+ i830->current->emitted = 0;
+ i830_do_emit_state( intel );
+ }
+
+ assert(get_dirty(i830->current) == 0);
+ assert((intel->batch->dirty_state & (1<<1)) == 0);
}
static void
@@ -650,8 +701,7 @@ i830_assert_not_dirty( struct intel_context *intel )
{
struct i830_context *i830 = i830_context(&intel->ctx);
struct i830_hw_state *state = i830->current;
- GLuint dirty = state->active & ~state->emitted;
- assert(!dirty);
+ assert(!get_dirty(state));
}
commit 169e62f563c4eb7dfa9c456a1ee03168af6b546a
Author: Brian <brian@i915.localnet.net>
Date: Fri Nov 30 15:52:41 2007 -0700
fix-build: remove ctx->_Facing assignment
diff --git a/src/mesa/tnl_dd/t_dd_tritmp.h b/src/mesa/tnl_dd/t_dd_tritmp.h
index 0bf32ff..6c2378f 100644
--- a/src/mesa/tnl_dd/t_dd_tritmp.h
+++ b/src/mesa/tnl_dd/t_dd_tritmp.h
@@ -155,10 +155,6 @@ static void TAG(triangle)( GLcontext *ctx, GLuint e0, GLuint e1, GLuint e2 )
{
facing = AREA_IS_CCW( cc ) ^ ctx->Polygon._FrontBit;
- if (DO_TWOSTENCIL && ctx->Stencil.TestTwoSide) {
- ctx->_Facing = facing; /* mixed mode rendering: for 2-sided stencil test */
- }
-
if (DO_UNFILLED) {
if (facing) {
mode = ctx->Polygon.BackMode;
@@ -421,10 +417,6 @@ static void TAG(quad)( GLcontext *ctx,
{
facing = AREA_IS_CCW( cc ) ^ ctx->Polygon._FrontBit;
- if (DO_TWOSTENCIL && ctx->Stencil.TestTwoSide) {
- ctx->_Facing = facing; /* mixed mode rendering: for 2-sided stencil test */
- }
-
if (DO_UNFILLED) {
if (facing) {
mode = ctx->Polygon.BackMode;
commit 1b43babfb126c6318d2f2468ec81b93ee1923774
Author: Brian <brian.paul@tungstengraphics.com>
Date: Fri Nov 30 13:01:42 2007 -0700
fix broken two-sided stencil
diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index 754b1a7..b599638 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -977,7 +977,6 @@ init_attrib_groups(GLcontext *ctx)
/* Miscellaneous */
ctx->NewState = _NEW_ALL;
ctx->ErrorValue = (GLenum) GL_NO_ERROR;
- ctx->_Facing = 0;
return GL_TRUE;
}
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 2cc0622..96c3515 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -3032,12 +3032,6 @@ struct __GLcontextRec
struct gl_list_extensions ListExt; /**< driver dlist extensions */
-
- GLuint _Facing; /**< This is a hack for 2-sided stencil test.
- *
- * We don't have a better way to communicate this value from
- * swrast_setup to swrast. */
-
/** \name For debugging/development only */
/*@{*/
GLboolean FirstTimeCurrent;
diff --git a/src/mesa/swrast/s_aalinetemp.h b/src/mesa/swrast/s_aalinetemp.h
index 80cec0b..074ffe8 100644
--- a/src/mesa/swrast/s_aalinetemp.h
+++ b/src/mesa/swrast/s_aalinetemp.h
@@ -141,6 +141,7 @@ NAME(line)(GLcontext *ctx, const SWvertex *v0, const SWvertex *v1)
return;
INIT_SPAN(line.span, GL_LINE, 0, 0, SPAN_XY | SPAN_COVERAGE);
+ line.span.facing = swrast->PointLineFacing;
line.xAdj = line.dx / line.len * line.halfWidth;
line.yAdj = line.dy / line.len * line.halfWidth;
diff --git a/src/mesa/swrast/s_aatritemp.h b/src/mesa/swrast/s_aatritemp.h
index 9278b5a..b26f21f 100644
--- a/src/mesa/swrast/s_aatritemp.h
+++ b/src/mesa/swrast/s_aatritemp.h
@@ -78,7 +78,7 @@
GLfloat texWidth[FRAG_ATTRIB_MAX];
GLfloat texHeight[FRAG_ATTRIB_MAX];
#endif
- GLfloat bf = SWRAST_CONTEXT(ctx)->_BackfaceSign;
+ GLfloat bf = SWRAST_CONTEXT(ctx)->_BackfaceCullSign;
(void) swrast;
@@ -116,6 +116,7 @@
majDx = vMax->win[0] - vMin->win[0];
majDy = vMax->win[1] - vMin->win[1];
+ /* front/back-face determination and cullling */
{
const GLfloat botDx = vMid->win[0] - vMin->win[0];
const GLfloat botDy = vMid->win[1] - vMin->win[1];
@@ -124,6 +125,8 @@
if (area * bf < 0 || area == 0 || IS_INF_OR_NAN(area))
return;
ltor = (GLboolean) (area < 0.0F);
+
+ span.facing = area * swrast->_BackfaceSign > 0.0F;
}
/* Plane equation setup:
diff --git a/src/mesa/swrast/s_context.c b/src/mesa/swrast/s_context.c
index 2f25edb..47d5035 100644
--- a/src/mesa/swrast/s_context.c
+++ b/src/mesa/swrast/s_context.c
@@ -117,8 +117,8 @@ _swrast_update_rasterflags( GLcontext *ctx )
/**
- * Examine polycon culls tate to compute the _BackfaceSign field.
- * _BackfaceSign will be 0 if no culling, -1 if culling back-faces,
+ * Examine polycon culls tate to compute the _BackfaceCullSign field.
+ * _BackfaceCullSign will be 0 if no culling, -1 if culling back-faces,
* and 1 if culling front-faces. The Polygon FrontFace state also
* factors in.
*/
@@ -149,10 +149,15 @@ _swrast_update_polygon( GLcontext *ctx )
backface_sign = 0.0;
}
- SWRAST_CONTEXT(ctx)->_BackfaceSign = backface_sign;
+ SWRAST_CONTEXT(ctx)->_BackfaceCullSign = backface_sign;
+
+ /* This is for front/back-face determination, but not for culling */
+ SWRAST_CONTEXT(ctx)->_BackfaceSign
+ = (ctx->Polygon.FrontFace == GL_CW) ? -1.0 : 1.0;
}
+
/**
* Update the _PreferPixelFog field to indicate if we need to compute
* fog blend factors (from the fog coords) per-fragment.
@@ -721,6 +726,12 @@ _swrast_ResetLineStipple( GLcontext *ctx )
}
void
+_swrast_SetFacing(GLcontext *ctx, GLuint facing)
+{
+ SWRAST_CONTEXT(ctx)->PointLineFacing = facing;
+}
+
+void
_swrast_allow_vertex_fog( GLcontext *ctx, GLboolean value )
{
if (SWRAST_DEBUG) {
diff --git a/src/mesa/swrast/s_context.h b/src/mesa/swrast/s_context.h
index c8333b8..58841ad 100644
--- a/src/mesa/swrast/s_context.h
+++ b/src/mesa/swrast/s_context.h
@@ -128,7 +128,8 @@ typedef struct
* _swrast_validate_derived():
*/
GLbitfield _RasterMask;
- GLfloat _BackfaceSign;
+ GLfloat _BackfaceSign; /** +1 or -1 */
+ GLfloat _BackfaceCullSign; /** +1, 0, or -1 */
GLboolean _PreferPixelFog; /* Compute fog blend factor per fragment? */
GLboolean _AnyTextureCombine;
GLboolean _FogEnabled;
@@ -151,6 +152,7 @@ typedef struct
/* Working values:
*/
GLuint StippleCounter; /**< Line stipple counter */
+ GLuint PointLineFacing;
GLbitfield NewState;
GLuint StateChanges;
GLenum Primitive; /* current primitive being drawn (ala glBegin) */
diff --git a/src/mesa/swrast/s_fragprog.c b/src/mesa/swrast/s_fragprog.c
index 7fd94c8..324afb9 100644
--- a/src/mesa/swrast/s_fragprog.c
+++ b/src/mesa/swrast/s_fragprog.c
@@ -118,7 +118,7 @@ init_machine(GLcontext *ctx, struct gl_program_machine *machine,
if (ctx->Shader.CurrentProgram) {
/* Store front/back facing value in register FOGC.Y */
- machine->Attribs[FRAG_ATTRIB_FOGC][col][1] = (GLfloat) ctx->_Facing;
+ machine->Attribs[FRAG_ATTRIB_FOGC][col][1] = (GLfloat) span->facing;
}
machine->CurElement = col;
diff --git a/src/mesa/swrast/s_linetemp.h b/src/mesa/swrast/s_linetemp.h
index b6e8f28..9e240a7 100644
--- a/src/mesa/swrast/s_linetemp.h
+++ b/src/mesa/swrast/s_linetemp.h
@@ -317,6 +317,9 @@ NAME( GLcontext *ctx, const SWvertex *vert0, const SWvertex *vert1 )
span.attrStepX[FRAG_ATTRIB_WPOS][3] = 0.0F;
span.attrStepY[FRAG_ATTRIB_WPOS][3] = 0.0F;
+ span.facing = swrast->PointLineFacing;
+
+
/*
* Draw
*/
diff --git a/src/mesa/swrast/s_pointtemp.h b/src/mesa/swrast/s_pointtemp.h
index 9436464..7dcc1fc 100644
--- a/src/mesa/swrast/s_pointtemp.h
+++ b/src/mesa/swrast/s_pointtemp.h
@@ -105,6 +105,7 @@ NAME ( GLcontext *ctx, const SWvertex *vert )
*/
span->interpMask = SPAN_FOG;
span->arrayMask = SPAN_XY | SPAN_Z;
+ span->facing = swrast->PointLineFacing;
span->attrStart[FRAG_ATTRIB_FOGC][0] = vert->attrib[FRAG_ATTRIB_FOGC][0];
span->attrStepX[FRAG_ATTRIB_FOGC][0] = 0.0;
span->attrStepY[FRAG_ATTRIB_FOGC][0] = 0.0;
diff --git a/src/mesa/swrast/s_triangle.c b/src/mesa/swrast/s_triangle.c
index fc9d29b..fc40084 100644
--- a/src/mesa/swrast/s_triangle.c
+++ b/src/mesa/swrast/s_triangle.c
@@ -58,7 +58,7 @@ _swrast_culltriangle( GLcontext *ctx,
GLfloat fy = v2->win[1] - v0->win[1];
GLfloat c = ex*fy-ey*fx;
- if (c * SWRAST_CONTEXT(ctx)->_BackfaceSign > 0)
+ if (c * SWRAST_CONTEXT(ctx)->_BackfaceCullSign > 0)
return 0;
return 1;
diff --git a/src/mesa/swrast/s_tritemp.h b/src/mesa/swrast/s_tritemp.h
index dcc3e95..ae30fe5 100644
--- a/src/mesa/swrast/s_tritemp.h
+++ b/src/mesa/swrast/s_tritemp.h
@@ -172,7 +172,7 @@ static void NAME(GLcontext *ctx, const SWvertex *v0,
EdgeT eMaj, eTop, eBot;
GLfloat oneOverArea;
const SWvertex *vMin, *vMid, *vMax; /* Y(vMin)<=Y(vMid)<=Y(vMax) */
- GLfloat bf = SWRAST_CONTEXT(ctx)->_BackfaceSign;
+ GLfloat bf = SWRAST_CONTEXT(ctx)->_BackfaceCullSign;
#if !TRIANGLE_WALK_DOUBLE
const GLint snapMask = ~((FIXED_ONE / (1 << SUB_PIXEL_BITS)) - 1); /* for x/y coord snapping */
#endif
@@ -293,6 +293,7 @@ static void NAME(GLcontext *ctx, const SWvertex *v0,
const GLfloat area = eMaj.dx * eBot.dy - eBot.dx * eMaj.dy;
#endif
/* Do backface culling */
+
if (area * bf < 0.0)
return;
@@ -300,10 +301,10 @@ static void NAME(GLcontext *ctx, const SWvertex *v0,
return;
oneOverArea = 1.0F / area;
- }
-
- span.facing = ctx->_Facing; /* for 2-sided stencil test */
+ /* 0 = front, 1 = back */
+ span.facing = oneOverArea * swrast->_BackfaceSign > 0.0F;
+ }
/* Edge setup. For a triangle strip these could be reused... */
{
diff --git a/src/mesa/swrast/swrast.h b/src/mesa/swrast/swrast.h
index 12264a1..8640550 100644
--- a/src/mesa/swrast/swrast.h
+++ b/src/mesa/swrast/swrast.h
@@ -140,6 +140,13 @@ _swrast_Accum(GLcontext *ctx, GLenum op, GLfloat value);
extern void
_swrast_ResetLineStipple( GLcontext *ctx );
+/**
+ * Indicates front/back facing for subsequent points/lines when drawing
+ * unfilled polygons. Needed for two-side stencil.
+ */
+extern void
+_swrast_SetFacing(GLcontext *ctx, GLuint facing);
+
/* These will always render the correct point/line/triangle for the
* current state.
*
diff --git a/src/mesa/swrast_setup/ss_context.c b/src/mesa/swrast_setup/ss_context.c
index 3f6d294..43f2696 100644
--- a/src/mesa/swrast_setup/ss_context.c
+++ b/src/mesa/swrast_setup/ss_context.c
@@ -186,6 +186,9 @@ _swsetup_RenderStart( GLcontext *ctx )
swsetup->NewState = 0;
+ /* This will change if drawing unfilled tris */
+ _swrast_SetFacing(ctx, 0);
+
_swrast_render_start(ctx);
/* Important */
diff --git a/src/mesa/swrast_setup/ss_triangle.c b/src/mesa/swrast_setup/ss_triangle.c
index 628e928..830e064 100644
--- a/src/mesa/swrast_setup/ss_triangle.c
+++ b/src/mesa/swrast_setup/ss_triangle.c
@@ -1,8 +1,8 @@
/*
* Mesa 3-D graphics library
- * Version: 6.1
+ * Version: 7.1
*
- * Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2007 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -68,6 +68,8 @@ static void _swsetup_render_line_tri( GLcontext *ctx,
return;
}
+ _swrast_SetFacing(ctx, facing);
+
if (ctx->Light.ShadeModel == GL_FLAT) {
COPY_CHAN4(c[0], v0->color);
COPY_CHAN4(c[1], v1->color);
@@ -127,6 +129,8 @@ static void _swsetup_render_point_tri( GLcontext *ctx,
return;
}
+ _swrast_SetFacing(ctx, facing);
+
if (ctx->Light.ShadeModel == GL_FLAT) {
/* save colors/indexes for v0, v1 vertices */
COPY_CHAN4(c[0], v0->color);
@@ -311,6 +315,4 @@ void _swsetup_choose_trifuncs( GLcontext *ctx )
tnl->Driver.Render.Quad = quad_tab[ind];
tnl->Driver.Render.Line = swsetup_line;
tnl->Driver.Render.Points = swsetup_points;
-
- ctx->_Facing = 0;
}
diff --git a/src/mesa/swrast_setup/ss_tritmp.h b/src/mesa/swrast_setup/ss_tritmp.h
index 59c534e..0e0cbce 100644
--- a/src/mesa/swrast_setup/ss_tritmp.h
+++ b/src/mesa/swrast_setup/ss_tritmp.h
@@ -43,7 +43,6 @@ static void TAG(triangle)(GLcontext *ctx, GLuint e0, GLuint e1, GLuint e2 )
v[1] = &verts[e1];
v[2] = &verts[e2];
-
if (IND & (SS_TWOSIDE_BIT | SS_OFFSET_BIT | SS_UNFILLED_BIT))
{
GLfloat ex = v[0]->win[0] - v[2]->win[0];
@@ -55,7 +54,6 @@ static void TAG(triangle)(GLcontext *ctx, GLuint e0, GLuint e1, GLuint e2 )
if (IND & (SS_TWOSIDE_BIT | SS_UNFILLED_BIT))
{
facing = (cc < 0.0) ^ ctx->Polygon._FrontBit;
- ctx->_Facing = facing;
if (IND & SS_UNFILLED_BIT)
mode = facing ? ctx->Polygon.BackMode : ctx->Polygon.FrontMode;
commit 43e902f774f8c3cd58310eeb44eec9d3f8f81746
Author: Brian <brian.paul@tungstengraphics.com>
Date: Fri Nov 30 09:08:11 2007 -0700
better front-plane clip test
diff --git a/progs/trivial/quad-clip-nearplane.c b/progs/trivial/quad-clip-nearplane.c
index 7e12e58..be9b9c6 100644
--- a/progs/trivial/quad-clip-nearplane.c
+++ b/progs/trivial/quad-clip-nearplane.c
@@ -33,6 +33,7 @@
GLenum doubleBuffer;
+float Z = -6;
static void Init(void)
{
@@ -40,30 +41,36 @@ static void Init(void)
fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
- glClearColor(0.0, 0.0, 1.0, 0.0);
+ fprintf(stderr, "Press z/Z to translate quad\n");
+
+ glClearColor(0.0, 0.0, 1.0, 0.0);
}
Reply to: