summaryrefslogtreecommitdiff
path: root/src/mesa/swrast/s_fragprog.c
diff options
context:
space:
mode:
authorBrian <brian@yutani.localnet.net>2007-04-19 14:24:10 -0600
committerBrian <brian@yutani.localnet.net>2007-04-19 14:24:10 -0600
commit8b5fce6bcc88cd9dd321f0db95c1714e5e5e85a1 (patch)
tree523051281c03f33fe89a1a6baf2e3386f88d8a24 /src/mesa/swrast/s_fragprog.c
parent020cdb47cf172c6ef8da78abcf6621233439d08b (diff)
Put gl_program_machine into swrast structure rather than using a local variable.
Basically an easy way to make sure the memory gets initialized once (to zero) to avoid lots of valgrind warnings.
Diffstat (limited to 'src/mesa/swrast/s_fragprog.c')
-rw-r--r--src/mesa/swrast/s_fragprog.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/mesa/swrast/s_fragprog.c b/src/mesa/swrast/s_fragprog.c
index 7f7c0d6db5..1b5f20d42d 100644
--- a/src/mesa/swrast/s_fragprog.c
+++ b/src/mesa/swrast/s_fragprog.c
@@ -25,7 +25,6 @@
#include "glheader.h"
#include "colormac.h"
#include "context.h"
-#include "prog_execute.h"
#include "prog_instruction.h"
#include "s_fragprog.h"
@@ -105,7 +104,7 @@ init_machine(GLcontext *ctx, struct gl_program_machine *machine,
if (ctx->FragmentProgram.CallbackEnabled)
inputsRead = ~0;
- if (program->Base.Target == GL_FRAGMENT_PROGRAM_NV) {
+ if (1/*program->Base.Target == GL_FRAGMENT_PROGRAM_NV*/) {
/* Clear temporary registers (undefined for ARB_f_p) */
_mesa_bzero(machine->Temporaries,
MAX_PROGRAM_TEMPS * 4 * sizeof(GLfloat));
@@ -142,19 +141,19 @@ run_program(GLcontext *ctx, SWspan *span, GLuint start, GLuint end)
SWcontext *swrast = SWRAST_CONTEXT(ctx);
const struct gl_fragment_program *program = ctx->FragmentProgram._Current;
const GLbitfield outputsWritten = program->Base.OutputsWritten;
- struct gl_program_machine machine;
+ struct gl_program_machine *machine = &swrast->FragProgMachine;
GLuint i;
for (i = start; i < end; i++) {
if (span->array->mask[i]) {
- init_machine(ctx, &machine, program, span, i);
+ init_machine(ctx, machine, program, span, i);
- if (_mesa_execute_program(ctx, &program->Base, &machine)) {
+ if (_mesa_execute_program(ctx, &program->Base, machine)) {
/* Store result color */
if (outputsWritten & (1 << FRAG_RESULT_COLR)) {
COPY_4V(span->array->attribs[FRAG_ATTRIB_COL0][i],
- machine.Outputs[FRAG_RESULT_COLR]);
+ machine->Outputs[FRAG_RESULT_COLR]);
}
else {
/* Multiple drawbuffers / render targets
@@ -165,14 +164,14 @@ run_program(GLcontext *ctx, SWspan *span, GLuint start, GLuint end)
for (output = 0; output < swrast->_NumColorOutputs; output++) {
if (outputsWritten & (1 << (FRAG_RESULT_DATA0 + output))) {
COPY_4V(span->array->attribs[FRAG_ATTRIB_COL0+output][i],
- machine.Outputs[FRAG_RESULT_DATA0 + output]);
+ machine->Outputs[FRAG_RESULT_DATA0 + output]);
}
}
}
/* Store result depth/z */
if (outputsWritten & (1 << FRAG_RESULT_DEPR)) {
- const GLfloat depth = machine.Outputs[FRAG_RESULT_DEPR][2];
+ const GLfloat depth = machine->Outputs[FRAG_RESULT_DEPR][2];
if (depth <= 0.0)
span->array->z[i] = 0;
else if (depth >= 1.0)