mesa: Remove _Active and _UseTexEnvProgram flags from fragment programs.
There was a note in state.c about _Active deserving to die, and there were potential issues with it due to i965 forgetting to set _UseTexEnvProgram. Removing both simplifies things. Reviewed-by: Brian Paul <brianp@vmware.com>
This commit is contained in:

committed by
Alan Hourihane

parent
5e116e52a2
commit
510916f509
@@ -171,7 +171,6 @@ i915CreateContext(const __GLcontextModes * mesaVis,
|
|||||||
ctx->Const.FragmentProgram.MaxNativeAddressRegs = 0; /* I don't think we have one */
|
ctx->Const.FragmentProgram.MaxNativeAddressRegs = 0; /* I don't think we have one */
|
||||||
|
|
||||||
ctx->FragmentProgram._MaintainTexEnvProgram = GL_TRUE;
|
ctx->FragmentProgram._MaintainTexEnvProgram = GL_TRUE;
|
||||||
ctx->FragmentProgram._UseTexEnvProgram = GL_TRUE;
|
|
||||||
|
|
||||||
driInitExtensions(ctx, i915_extensions, GL_FALSE);
|
driInitExtensions(ctx, i915_extensions, GL_FALSE);
|
||||||
|
|
||||||
|
@@ -569,7 +569,7 @@ i915_update_fog(GLcontext * ctx)
|
|||||||
GLboolean enabled;
|
GLboolean enabled;
|
||||||
GLboolean try_pixel_fog;
|
GLboolean try_pixel_fog;
|
||||||
|
|
||||||
if (ctx->FragmentProgram._Active) {
|
if (ctx->FragmentProgram._Current) {
|
||||||
/* Pull in static fog state from program */
|
/* Pull in static fog state from program */
|
||||||
mode = ctx->FragmentProgram._Current->FogOption;
|
mode = ctx->FragmentProgram._Current->FogOption;
|
||||||
enabled = (mode != GL_NONE);
|
enabled = (mode != GL_NONE);
|
||||||
|
@@ -386,27 +386,6 @@ intelDrawPixels(GLcontext * ctx,
|
|||||||
if (INTEL_DEBUG & DEBUG_PIXEL)
|
if (INTEL_DEBUG & DEBUG_PIXEL)
|
||||||
_mesa_printf("%s: fallback to swrast\n", __FUNCTION__);
|
_mesa_printf("%s: fallback to swrast\n", __FUNCTION__);
|
||||||
|
|
||||||
if (ctx->FragmentProgram._Current == ctx->FragmentProgram._TexEnvProgram) {
|
_swrast_DrawPixels(ctx, x, y, width, height, format, type,
|
||||||
/*
|
unpack, pixels);
|
||||||
* We don't want the i915 texenv program to be applied to DrawPixels.
|
|
||||||
* This is really just a performance optimization (mesa will other-
|
|
||||||
* wise happily run the fragment program on each pixel in the image).
|
|
||||||
*/
|
|
||||||
struct gl_fragment_program *fpSave = ctx->FragmentProgram._Current;
|
|
||||||
/* can't just set current frag prog to 0 here as on buffer resize
|
|
||||||
we'll get new state checks which will segfault. Remains a hack. */
|
|
||||||
ctx->FragmentProgram._Current = NULL;
|
|
||||||
ctx->FragmentProgram._UseTexEnvProgram = GL_FALSE;
|
|
||||||
ctx->FragmentProgram._Active = GL_FALSE;
|
|
||||||
_swrast_DrawPixels( ctx, x, y, width, height, format, type,
|
|
||||||
unpack, pixels );
|
|
||||||
ctx->FragmentProgram._Current = fpSave;
|
|
||||||
ctx->FragmentProgram._UseTexEnvProgram = GL_TRUE;
|
|
||||||
ctx->FragmentProgram._Active = GL_TRUE;
|
|
||||||
_swrast_InvalidateState(ctx, _NEW_PROGRAM);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
_swrast_DrawPixels( ctx, x, y, width, height, format, type,
|
|
||||||
unpack, pixels );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@@ -1226,7 +1226,6 @@ _mesa_initialize_context(GLcontext *ctx,
|
|||||||
|
|
||||||
ctx->FragmentProgram._MaintainTexEnvProgram
|
ctx->FragmentProgram._MaintainTexEnvProgram
|
||||||
= (_mesa_getenv("MESA_TEX_PROG") != NULL);
|
= (_mesa_getenv("MESA_TEX_PROG") != NULL);
|
||||||
ctx->FragmentProgram._UseTexEnvProgram = ctx->FragmentProgram._MaintainTexEnvProgram;
|
|
||||||
|
|
||||||
ctx->VertexProgram._MaintainTnlProgram
|
ctx->VertexProgram._MaintainTnlProgram
|
||||||
= (_mesa_getenv("MESA_TNL_PROG") != NULL);
|
= (_mesa_getenv("MESA_TNL_PROG") != NULL);
|
||||||
|
@@ -2014,8 +2014,6 @@ struct gl_fragment_program_state
|
|||||||
|
|
||||||
/** Should fixed-function texturing be implemented with a fragment prog? */
|
/** Should fixed-function texturing be implemented with a fragment prog? */
|
||||||
GLboolean _MaintainTexEnvProgram;
|
GLboolean _MaintainTexEnvProgram;
|
||||||
GLboolean _UseTexEnvProgram;
|
|
||||||
GLboolean _Active; /**< Use internal texenv program? */
|
|
||||||
|
|
||||||
/** Program to emulate fixed-function texture env/combine (see above) */
|
/** Program to emulate fixed-function texture env/combine (see above) */
|
||||||
struct gl_fragment_program *_TexEnvProgram;
|
struct gl_fragment_program *_TexEnvProgram;
|
||||||
|
@@ -254,17 +254,6 @@ update_program(GLcontext *ctx)
|
|||||||
_mesa_reference_vertprog(ctx, &ctx->VertexProgram._Current, NULL);
|
_mesa_reference_vertprog(ctx, &ctx->VertexProgram._Current, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* XXX: get rid of _Active flag.
|
|
||||||
*/
|
|
||||||
#if 1
|
|
||||||
ctx->FragmentProgram._Active = ctx->FragmentProgram._Enabled;
|
|
||||||
if (ctx->FragmentProgram._MaintainTexEnvProgram &&
|
|
||||||
!ctx->FragmentProgram._Enabled) {
|
|
||||||
if (ctx->FragmentProgram._UseTexEnvProgram)
|
|
||||||
ctx->FragmentProgram._Active = GL_TRUE;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Let the driver know what's happening:
|
/* Let the driver know what's happening:
|
||||||
*/
|
*/
|
||||||
if (ctx->FragmentProgram._Current != prevFP && ctx->Driver.BindProgram) {
|
if (ctx->FragmentProgram._Current != prevFP && ctx->Driver.BindProgram) {
|
||||||
|
@@ -76,7 +76,7 @@ NAME(plot)(GLcontext *ctx, struct LineInfo *line, int ix, int iy)
|
|||||||
ATTRIB_LOOP_BEGIN
|
ATTRIB_LOOP_BEGIN
|
||||||
GLfloat (*attribArray)[4] = line->span.array->attribs[attr];
|
GLfloat (*attribArray)[4] = line->span.array->attribs[attr];
|
||||||
if (attr >= FRAG_ATTRIB_TEX0 && attr < FRAG_ATTRIB_VAR0
|
if (attr >= FRAG_ATTRIB_TEX0 && attr < FRAG_ATTRIB_VAR0
|
||||||
&& !ctx->FragmentProgram._Active) {
|
&& !ctx->FragmentProgram._Current) {
|
||||||
/* texcoord w/ divide by Q */
|
/* texcoord w/ divide by Q */
|
||||||
const GLuint unit = attr - FRAG_ATTRIB_TEX0;
|
const GLuint unit = attr - FRAG_ATTRIB_TEX0;
|
||||||
const GLfloat invQ = solve_plane_recip(fx, fy, line->attrPlane[attr][3]);
|
const GLfloat invQ = solve_plane_recip(fx, fy, line->attrPlane[attr][3]);
|
||||||
|
@@ -140,7 +140,7 @@ _tnl_InvalidateState( GLcontext *ctx, GLuint new_state )
|
|||||||
/* fixed-function fog */
|
/* fixed-function fog */
|
||||||
RENDERINPUTS_SET( tnl->render_inputs_bitset, _TNL_ATTRIB_FOG );
|
RENDERINPUTS_SET( tnl->render_inputs_bitset, _TNL_ATTRIB_FOG );
|
||||||
}
|
}
|
||||||
else if (ctx->FragmentProgram._Active || ctx->FragmentProgram._Current) {
|
else if (ctx->FragmentProgram._Current) {
|
||||||
struct gl_fragment_program *fp = ctx->FragmentProgram._Current;
|
struct gl_fragment_program *fp = ctx->FragmentProgram._Current;
|
||||||
if (fp) {
|
if (fp) {
|
||||||
if (fp->FogOption != GL_NONE || (fp->Base.InputsRead & FRAG_BIT_FOGC)) {
|
if (fp->FogOption != GL_NONE || (fp->Base.InputsRead & FRAG_BIT_FOGC)) {
|
||||||
|
Reference in New Issue
Block a user