i915: Update and translate the fragment program along with state updates.

Previously, we were doing it in the midst of the pipeline run, which gave
an opportunity to enable/disable fallbacks, which is certainly the wrong
time to be doing so.  This manifested itself in a NULL dereference for PutRow
after transitioning out of a fallback during a run_pipeline in glean glsl1.
This commit is contained in:
Eric Anholt
2009-07-29 23:37:04 -07:00
parent d6fbf87575
commit 61b512c47c
4 changed files with 26 additions and 14 deletions

View File

@@ -40,6 +40,7 @@
#include "utils.h" #include "utils.h"
#include "i915_reg.h" #include "i915_reg.h"
#include "i915_program.h"
#include "intel_regions.h" #include "intel_regions.h"
#include "intel_batchbuffer.h" #include "intel_batchbuffer.h"
@@ -80,6 +81,8 @@ i915InvalidateState(GLcontext * ctx, GLuint new_state)
i915_update_stencil(ctx); i915_update_stencil(ctx);
if (new_state & (_NEW_LIGHT)) if (new_state & (_NEW_LIGHT))
i915_update_provoking_vertex(ctx); i915_update_provoking_vertex(ctx);
if (new_state & (_NEW_PROGRAM | _NEW_PROGRAM_CONSTANTS))
i915_update_program(ctx);
} }

View File

@@ -1058,6 +1058,28 @@ i915ProgramStringNotify(GLcontext * ctx,
_tnl_program_string(ctx, target, prog); _tnl_program_string(ctx, target, prog);
} }
void
i915_update_program(GLcontext *ctx)
{
struct intel_context *intel = intel_context(ctx);
struct i915_context *i915 = i915_context(&intel->ctx);
struct i915_fragment_program *fp =
(struct i915_fragment_program *) ctx->FragmentProgram._Current;
if (i915->current_program != fp) {
if (i915->current_program) {
i915->current_program->on_hardware = 0;
i915->current_program->params_uptodate = 0;
}
i915->current_program = fp;
}
if (!fp->translated)
translate_program(fp);
FALLBACK(&i915->intel, I915_FALLBACK_PROGRAM, fp->error);
}
void void
i915ValidateFragmentProgram(struct i915_context *i915) i915ValidateFragmentProgram(struct i915_context *i915)
@@ -1075,16 +1097,6 @@ i915ValidateFragmentProgram(struct i915_context *i915)
GLuint s2 = S2_TEXCOORD_NONE; GLuint s2 = S2_TEXCOORD_NONE;
int i, offset = 0; int i, offset = 0;
if (i915->current_program != p) {
if (i915->current_program) {
i915->current_program->on_hardware = 0;
i915->current_program->params_uptodate = 0;
}
i915->current_program = p;
}
/* Important: /* Important:
*/ */
VB->AttribPtr[VERT_ATTRIB_POS] = VB->NdcPtr; VB->AttribPtr[VERT_ATTRIB_POS] = VB->NdcPtr;

View File

@@ -530,8 +530,6 @@ i915_upload_program(struct i915_context *i915,
GLuint program_size = p->csr - p->program; GLuint program_size = p->csr - p->program;
GLuint decl_size = p->decl - p->declarations; GLuint decl_size = p->decl - p->declarations;
FALLBACK(&i915->intel, I915_FALLBACK_PROGRAM, p->error);
/* Could just go straight to the batchbuffer from here: /* Could just go straight to the batchbuffer from here:
*/ */
if (i915->state.ProgramSize != (program_size + decl_size) || if (i915->state.ProgramSize != (program_size + decl_size) ||

View File

@@ -155,7 +155,6 @@ extern void i915_upload_program(struct i915_context *i915,
extern void i915_fini_program(struct i915_fragment_program *p); extern void i915_fini_program(struct i915_fragment_program *p);
extern void i915_update_program(GLcontext *ctx);
#endif #endif