From 43a064e06dd0d3f7ff7ae23f19248e312c0b03b1 Mon Sep 17 00:00:00 2001 From: marvin24 Date: Thu, 27 Aug 2009 09:22:51 -0600 Subject: [PATCH 1/3] mesa: direct program debug output to stderr instead of stdout --- src/mesa/shader/prog_print.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/mesa/shader/prog_print.c b/src/mesa/shader/prog_print.c index 9967f2978de..5346db7bf62 100644 --- a/src/mesa/shader/prog_print.c +++ b/src/mesa/shader/prog_print.c @@ -529,7 +529,7 @@ void _mesa_print_alu_instruction(const struct prog_instruction *inst, const char *opcode_string, GLuint numRegs) { - fprint_alu_instruction(stdout, inst, opcode_string, + fprint_alu_instruction(stderr, inst, opcode_string, numRegs, PROG_PRINT_DEBUG, NULL); } @@ -750,7 +750,7 @@ _mesa_print_instruction_opt(const struct prog_instruction *inst, gl_prog_print_mode mode, const struct gl_program *prog) { - return _mesa_fprint_instruction_opt(stdout, inst, indent, mode, prog); + return _mesa_fprint_instruction_opt(stderr, inst, indent, mode, prog); } @@ -758,7 +758,7 @@ void _mesa_print_instruction(const struct prog_instruction *inst) { /* note: 4th param should be ignored for PROG_PRINT_DEBUG */ - _mesa_fprint_instruction_opt(stdout, inst, 0, PROG_PRINT_DEBUG, NULL); + _mesa_fprint_instruction_opt(stderr, inst, 0, PROG_PRINT_DEBUG, NULL); } @@ -804,12 +804,12 @@ _mesa_fprint_program_opt(FILE *f, /** - * Print program to stdout, default options. + * Print program to stderr, default options. */ void _mesa_print_program(const struct gl_program *prog) { - _mesa_fprint_program_opt(stdout, prog, PROG_PRINT_DEBUG, GL_TRUE); + _mesa_fprint_program_opt(stderr, prog, PROG_PRINT_DEBUG, GL_TRUE); } @@ -850,12 +850,12 @@ _mesa_fprint_program_parameters(FILE *f, /** - * Print all of a program's parameters/fields to stdout. + * Print all of a program's parameters/fields to stderr. */ void _mesa_print_program_parameters(GLcontext *ctx, const struct gl_program *prog) { - _mesa_fprint_program_parameters(stdout, ctx, prog); + _mesa_fprint_program_parameters(stderr, ctx, prog); } @@ -895,12 +895,12 @@ _mesa_fprint_parameter_list(FILE *f, /** - * Print a program parameter list to stdout. + * Print a program parameter list to stderr. */ void _mesa_print_parameter_list(const struct gl_program_parameter_list *list) { - _mesa_fprint_parameter_list(stdout, list); + _mesa_fprint_parameter_list(stderr, list); } From 8f4d66c5f893b49eb3973aa3b31a856314c045c7 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 27 Aug 2009 16:50:03 -0600 Subject: [PATCH 2/3] swrast: fix incorrect tri culling in selection/feedback mode. See bug 16866. --- src/mesa/swrast/s_feedback.c | 4 ++-- src/mesa/swrast/s_triangle.c | 12 +++++++----- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/mesa/swrast/s_feedback.c b/src/mesa/swrast/s_feedback.c index 7bb914b6589..47ed25ee100 100644 --- a/src/mesa/swrast/s_feedback.c +++ b/src/mesa/swrast/s_feedback.c @@ -58,7 +58,7 @@ void _swrast_feedback_triangle(GLcontext *ctx, const SWvertex *v0, const SWvertex *v1, const SWvertex *v2) { - if (_swrast_culltriangle(ctx, v0, v1, v2)) { + if (!_swrast_culltriangle(ctx, v0, v1, v2)) { _mesa_feedback_token(ctx, (GLfloat) (GLint) GL_POLYGON_TOKEN); _mesa_feedback_token(ctx, (GLfloat) 3); /* three vertices */ @@ -113,7 +113,7 @@ void _swrast_select_triangle(GLcontext *ctx, const SWvertex *v0, const SWvertex *v1, const SWvertex *v2) { - if (_swrast_culltriangle(ctx, v0, v1, v2)) { + if (!_swrast_culltriangle(ctx, v0, v1, v2)) { const GLfloat zs = 1.0F / ctx->DrawBuffer->_DepthMaxF; _mesa_update_hitflag( ctx, v0->attrib[FRAG_ATTRIB_WPOS][2] * zs ); diff --git a/src/mesa/swrast/s_triangle.c b/src/mesa/swrast/s_triangle.c index 9260e35066f..1d2fed71691 100644 --- a/src/mesa/swrast/s_triangle.c +++ b/src/mesa/swrast/s_triangle.c @@ -44,8 +44,9 @@ #include "s_triangle.h" -/* - * Just used for feedback mode. +/** + * Test if a triangle should be culled. Used for feedback and selection mode. + * \return GL_TRUE if the triangle is to be culled, GL_FALSE otherwise. */ GLboolean _swrast_culltriangle( GLcontext *ctx, @@ -53,16 +54,17 @@ _swrast_culltriangle( GLcontext *ctx, const SWvertex *v1, const SWvertex *v2 ) { + SWcontext *swrast = SWRAST_CONTEXT(ctx); GLfloat ex = v1->attrib[FRAG_ATTRIB_WPOS][0] - v0->attrib[FRAG_ATTRIB_WPOS][0]; GLfloat ey = v1->attrib[FRAG_ATTRIB_WPOS][1] - v0->attrib[FRAG_ATTRIB_WPOS][1]; GLfloat fx = v2->attrib[FRAG_ATTRIB_WPOS][0] - v0->attrib[FRAG_ATTRIB_WPOS][0]; GLfloat fy = v2->attrib[FRAG_ATTRIB_WPOS][1] - v0->attrib[FRAG_ATTRIB_WPOS][1]; GLfloat c = ex*fy-ey*fx; - if (c * SWRAST_CONTEXT(ctx)->_BackfaceCullSign > 0) - return 0; + if (c * swrast->_BackfaceSign * swrast->_BackfaceCullSign < 0.0F) + return GL_FALSE; - return 1; + return GL_TRUE; } From 0d7bed9f8973547b675c35c0083996e946d7cecb Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 27 Aug 2009 16:50:44 -0600 Subject: [PATCH 3/3] docs: fix selection/feedback culling bug --- docs/relnotes-7.5.1.html | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/relnotes-7.5.1.html b/docs/relnotes-7.5.1.html index 1a327577bac..df06302624b 100644 --- a/docs/relnotes-7.5.1.html +++ b/docs/relnotes-7.5.1.html @@ -53,6 +53,7 @@ tbd
  • Empty glBegin/glEnd() pair could cause divide by zero (bug 23489)
  • Fixed Gallium glBitmap() Z position bug
  • Setting arrays of sampler uniforms did not work +
  • Selection/Feedback mode didn't handle polygon culling correctly (bug 16866)