From 853bda3e7c4dfa7d8cc462729f6a3dce89e44963 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 9 Dec 2003 01:53:03 +0000 Subject: Update NEED_SECONDARY_COLOR macro to test if either vertex/fragment programs are enabled and if they need secondary color input register. Patch by Karl Rasche, with tweaks by Brian. --- src/mesa/swrast/s_aatriangle.c | 1 + src/mesa/swrast/s_context.c | 13 ++++++++++--- src/mesa/swrast/s_lines.c | 1 + src/mesa/swrast/s_span.c | 2 +- src/mesa/swrast/s_triangle.c | 2 +- 5 files changed, 14 insertions(+), 5 deletions(-) (limited to 'src/mesa/swrast') diff --git a/src/mesa/swrast/s_aatriangle.c b/src/mesa/swrast/s_aatriangle.c index b05a7ea28d..1bcaa95d33 100644 --- a/src/mesa/swrast/s_aatriangle.c +++ b/src/mesa/swrast/s_aatriangle.c @@ -34,6 +34,7 @@ #include "context.h" #include "macros.h" #include "imports.h" +#include "nvfragprog.h" #include "s_aatriangle.h" #include "s_context.h" #include "s_span.h" diff --git a/src/mesa/swrast/s_context.c b/src/mesa/swrast/s_context.c index fb09eb3060..c69d4cfd5d 100644 --- a/src/mesa/swrast/s_context.c +++ b/src/mesa/swrast/s_context.c @@ -30,6 +30,7 @@ #include "context.h" #include "mtypes.h" #include "texobj.h" +#include "nvfragprog.h" #include "swrast.h" #include "s_blend.h" @@ -226,7 +227,9 @@ _swrast_validate_triangle( GLcontext *ctx, _swrast_validate_derived( ctx ); swrast->choose_triangle( ctx ); - if (ctx->Texture._EnabledUnits == 0 && NEED_SECONDARY_COLOR(ctx)) { + if (ctx->Texture._EnabledUnits == 0 + && NEED_SECONDARY_COLOR(ctx) + && !ctx->FragmentProgram.Enabled) { /* separate specular color, but no texture */ swrast->SpecTriangle = swrast->Triangle; swrast->Triangle = _swrast_add_spec_terms_triangle; @@ -243,7 +246,9 @@ _swrast_validate_line( GLcontext *ctx, const SWvertex *v0, const SWvertex *v1 ) _swrast_validate_derived( ctx ); swrast->choose_line( ctx ); - if (ctx->Texture._EnabledUnits == 0 && NEED_SECONDARY_COLOR(ctx)) { + if (ctx->Texture._EnabledUnits == 0 + && NEED_SECONDARY_COLOR(ctx) + && !ctx->FragmentProgram.Enabled) { swrast->SpecLine = swrast->Line; swrast->Line = _swrast_add_spec_terms_line; } @@ -260,7 +265,9 @@ _swrast_validate_point( GLcontext *ctx, const SWvertex *v0 ) _swrast_validate_derived( ctx ); swrast->choose_point( ctx ); - if (ctx->Texture._EnabledUnits == 0 && NEED_SECONDARY_COLOR(ctx)) { + if (ctx->Texture._EnabledUnits == 0 + && NEED_SECONDARY_COLOR(ctx) + && !ctx->FragmentProgram.Enabled) { swrast->SpecPoint = swrast->Point; swrast->Point = _swrast_add_spec_terms_point; } diff --git a/src/mesa/swrast/s_lines.c b/src/mesa/swrast/s_lines.c index f003395d42..4d9fe58920 100644 --- a/src/mesa/swrast/s_lines.c +++ b/src/mesa/swrast/s_lines.c @@ -27,6 +27,7 @@ #include "context.h" #include "colormac.h" #include "macros.h" +#include "nvfragprog.h" #include "s_aaline.h" #include "s_context.h" #include "s_depth.h" diff --git a/src/mesa/swrast/s_span.c b/src/mesa/swrast/s_span.c index 769b551e71..118cec47e3 100644 --- a/src/mesa/swrast/s_span.c +++ b/src/mesa/swrast/s_span.c @@ -1207,7 +1207,7 @@ _swrast_write_texture_span( GLcontext *ctx, struct sw_span *span) span->primitive == GL_POLYGON || span->primitive == GL_BITMAP); ASSERT(span->end <= MAX_WIDTH); ASSERT((span->interpMask & span->arrayMask) == 0); - ASSERT(ctx->Texture._EnabledCoordUnits); + ASSERT(ctx->Texture._EnabledCoordUnits || ctx->FragmentProgram.Enabled); /* printf("%s() interp 0x%x array 0x%x\n", __FUNCTION__, span->interpMask, span->arrayMask); diff --git a/src/mesa/swrast/s_triangle.c b/src/mesa/swrast/s_triangle.c index 5af74ee3ab..3e42966467 100644 --- a/src/mesa/swrast/s_triangle.c +++ b/src/mesa/swrast/s_triangle.c @@ -1055,7 +1055,7 @@ _swrast_choose_triangle( GLcontext *ctx ) } } - if (ctx->Texture._EnabledCoordUnits) { + if (ctx->Texture._EnabledCoordUnits || ctx->FragmentProgram.Enabled) { /* Ugh, we do a _lot_ of tests to pick the best textured tri func */ const struct gl_texture_object *texObj2D; const struct gl_texture_image *texImg; -- cgit v1.2.3