From 47b29f511a8e917c65536fde90397d54d2ad23d3 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Wed, 4 May 2005 11:44:44 +0000 Subject: Add a facility to route all rasterization through a fragment program which is automatically generated to match the current texture environment state. Introduces a new value ctx->FragmentProgram._Active which is true when either _Enabled is true or there is such a fragment program ready to run. To test out on a driver running the software rasterizer, set MESA_TEX_PROG=t in the environment. It goes without saying that performance is lower for the software rasterizer in this mode. --- src/mesa/swrast/s_span.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'src/mesa/swrast/s_span.c') diff --git a/src/mesa/swrast/s_span.c b/src/mesa/swrast/s_span.c index a541b66ceb5..e6afee1eaa0 100644 --- a/src/mesa/swrast/s_span.c +++ b/src/mesa/swrast/s_span.c @@ -128,7 +128,7 @@ _swrast_span_default_texcoords( GLcontext *ctx, struct sw_span *span ) GLuint i; for (i = 0; i < ctx->Const.MaxTextureUnits; i++) { const GLfloat *tc = ctx->Current.RasterTexCoords[i]; - if (ctx->FragmentProgram._Enabled || ctx->ATIFragmentShader._Enabled) { + if (ctx->FragmentProgram._Active || ctx->ATIFragmentShader._Enabled) { COPY_4V(span->tex[i], tc); } else if (tc[3] > 0.0F) { @@ -406,7 +406,7 @@ interpolate_texcoords(GLcontext *ctx, struct sw_span *span) if (obj) { const struct gl_texture_image *img = obj->Image[0][obj->BaseLevel]; needLambda = (obj->MinFilter != obj->MagFilter) - || ctx->FragmentProgram._Enabled; + || ctx->FragmentProgram._Active; texW = img->WidthScale; texH = img->HeightScale; } @@ -431,7 +431,7 @@ interpolate_texcoords(GLcontext *ctx, struct sw_span *span) GLfloat r = span->tex[u][2]; GLfloat q = span->tex[u][3]; GLuint i; - if (ctx->FragmentProgram._Enabled) { + if (ctx->FragmentProgram._Active) { /* do perspective correction but don't divide s, t, r by q */ const GLfloat dwdx = span->dwdx; GLfloat w = span->w; @@ -482,7 +482,7 @@ interpolate_texcoords(GLcontext *ctx, struct sw_span *span) GLfloat r = span->tex[u][2]; GLfloat q = span->tex[u][3]; GLuint i; - if (ctx->FragmentProgram._Enabled) { + if (ctx->FragmentProgram._Active) { /* do perspective correction but don't divide s, t, r by q */ const GLfloat dwdx = span->dwdx; GLfloat w = span->w; @@ -540,7 +540,7 @@ interpolate_texcoords(GLcontext *ctx, struct sw_span *span) if (obj) { const struct gl_texture_image *img = obj->Image[0][obj->BaseLevel]; needLambda = (obj->MinFilter != obj->MagFilter) - || ctx->FragmentProgram._Enabled; + || ctx->FragmentProgram._Active; texW = (GLfloat) img->WidthScale; texH = (GLfloat) img->HeightScale; } @@ -565,7 +565,7 @@ interpolate_texcoords(GLcontext *ctx, struct sw_span *span) GLfloat r = span->tex[0][2]; GLfloat q = span->tex[0][3]; GLuint i; - if (ctx->FragmentProgram._Enabled) { + if (ctx->FragmentProgram._Active) { /* do perspective correction but don't divide s, t, r by q */ const GLfloat dwdx = span->dwdx; GLfloat w = span->w; @@ -616,7 +616,7 @@ interpolate_texcoords(GLcontext *ctx, struct sw_span *span) GLfloat r = span->tex[0][2]; GLfloat q = span->tex[0][3]; GLuint i; - if (ctx->FragmentProgram._Enabled) { + if (ctx->FragmentProgram._Active) { /* do perspective correction but don't divide s, t, r by q */ const GLfloat dwdx = span->dwdx; GLfloat w = span->w; @@ -1174,7 +1174,7 @@ _swrast_write_rgba_span( GLcontext *ctx, struct sw_span *span) interpolate_fog(ctx, span); /* Compute fragment colors with fragment program or texture lookups */ - if (ctx->FragmentProgram._Enabled) + if (ctx->FragmentProgram._Active) /* XXX interpolate depth values here??? */ _swrast_exec_fragment_program( ctx, span ); else if (ctx->ATIFragmentShader._Enabled) @@ -1252,7 +1252,7 @@ _swrast_write_rgba_span( GLcontext *ctx, struct sw_span *span) if (span->interpMask & SPAN_FOG) interpolate_fog(ctx, span); - if (ctx->FragmentProgram._Enabled) + if (ctx->FragmentProgram._Active) _swrast_exec_fragment_program( ctx, span ); else if (ctx->ATIFragmentShader._Enabled) _swrast_exec_fragment_shader( ctx, span ); @@ -1262,7 +1262,7 @@ _swrast_write_rgba_span( GLcontext *ctx, struct sw_span *span) ASSERT(span->arrayMask & SPAN_RGBA); - if (!ctx->FragmentProgram._Enabled) { + if (!ctx->FragmentProgram._Active) { /* Add base and specular colors */ if (ctx->Fog.ColorSumEnabled || (ctx->Light.Enabled && -- cgit v1.2.3