programs are enabled and if they need secondary color input register.
Patch by Karl Rasche, with tweaks by Brian.
#define NEED_SECONDARY_COLOR(CTX) \
(((CTX)->Light.Enabled && \
(CTX)->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR) \
- || (CTX)->Fog.ColorSumEnabled)
+ || (CTX)->Fog.ColorSumEnabled \
+ || ((CTX)->VertexProgram.Enabled && \
+ ((CTX)->VertexProgram.Current->InputsRead & VERT_BIT_COLOR1)) \
+ || ((CTX)->FragmentProgram.Enabled && \
+ ((CTX)->FragmentProgram.Current->InputsRead & FRAG_BIT_COL1)) \
+ )
/**
#define FRAG_ATTRIB_TEX6 10
#define FRAG_ATTRIB_TEX7 11
+/* Bitmasks for the above */
+#define FRAG_BIT_WPOS (1 << FRAG_ATTRIB_WPOS)
+#define FRAG_BIT_COL0 (1 << FRAG_ATTRIB_COL0)
+#define FRAG_BIT_COL1 (1 << FRAG_ATTRIB_COL1)
+#define FRAG_BIT_FOGC (1 << FRAG_ATTRIB_FOGC)
+#define FRAG_BIT_TEX0 (1 << FRAG_ATTRIB_TEX0)
+#define FRAG_BIT_TEX1 (1 << FRAG_ATTRIB_TEX1)
+#define FRAG_BIT_TEX2 (1 << FRAG_ATTRIB_TEX2)
+#define FRAG_BIT_TEX3 (1 << FRAG_ATTRIB_TEX3)
+#define FRAG_BIT_TEX4 (1 << FRAG_ATTRIB_TEX4)
+#define FRAG_BIT_TEX5 (1 << FRAG_ATTRIB_TEX5)
+#define FRAG_BIT_TEX6 (1 << FRAG_ATTRIB_TEX6)
+#define FRAG_BIT_TEX7 (1 << FRAG_ATTRIB_TEX7)
+
+/* output registers */
#define FRAG_OUTPUT_COLR 0
#define FRAG_OUTPUT_COLH 1
#define FRAG_OUTPUT_DEPR 2
#include "context.h"
#include "macros.h"
#include "imports.h"
+#include "nvfragprog.h"
#include "s_aatriangle.h"
#include "s_context.h"
#include "s_span.h"
#include "context.h"
#include "mtypes.h"
#include "texobj.h"
+#include "nvfragprog.h"
#include "swrast.h"
#include "s_blend.h"
_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;
_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;
}
_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;
}
#include "context.h"
#include "colormac.h"
#include "macros.h"
+#include "nvfragprog.h"
#include "s_aaline.h"
#include "s_context.h"
#include "s_depth.h"
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);
}
}
- 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;
#include "context.h"
#include "macros.h"
#include "imports.h"
+#include "nvfragprog.h"
#include "swrast/swrast.h"
#include "tnl/t_context.h"
#include "macros.h"
#include "imports.h"
#include "mtypes.h"
-
+#include "nvfragprog.h"
#include "math/m_matrix.h"
#include "math/m_xform.h"