GLboolean
_swrast_use_fragment_program(struct gl_context *ctx)
{
- struct gl_fragment_program *fp = ctx->FragmentProgram._Current;
+ struct gl_program *fp = ctx->FragmentProgram._Current;
return fp && !(fp == ctx->FragmentProgram._TexEnvProgram
- && fp->Base.NumInstructions == 0);
+ && fp->arb.NumInstructions == 0);
}
/**
*/
static void
init_machine(struct gl_context *ctx, struct gl_program_machine *machine,
- const struct gl_fragment_program *program,
- const SWspan *span, GLuint col)
+ const struct gl_program *program, const SWspan *span, GLuint col)
{
GLfloat *wpos = span->array->attribs[VARYING_SLOT_POS][col];
/* ARB_fragment_coord_conventions */
- if (program->OriginUpperLeft)
+ if (program->info.fs.origin_upper_left)
wpos[1] = ctx->DrawBuffer->Height - 1 - wpos[1];
- if (!program->PixelCenterInteger) {
+ if (!program->info.fs.pixel_center_integer) {
wpos[0] += 0.5F;
wpos[1] += 0.5F;
}
machine->DerivY = (GLfloat (*)[4]) span->attrStepY;
machine->NumDeriv = VARYING_SLOT_MAX;
- machine->Samplers = program->Base.SamplerUnits;
+ machine->Samplers = program->SamplerUnits;
/* if running a GLSL program (not ARB_fragment_program) */
if (ctx->_Shader->CurrentProgram[MESA_SHADER_FRAGMENT]) {
machine->CurElement = col;
- /* init condition codes */
- machine->CondCodes[0] = COND_EQ;
- machine->CondCodes[1] = COND_EQ;
- machine->CondCodes[2] = COND_EQ;
- machine->CondCodes[3] = COND_EQ;
-
/* init call stack */
machine->StackDepth = 0;
run_program(struct gl_context *ctx, SWspan *span, GLuint start, GLuint end)
{
SWcontext *swrast = SWRAST_CONTEXT(ctx);
- const struct gl_fragment_program *program = ctx->FragmentProgram._Current;
- const GLbitfield64 outputsWritten = program->Base.OutputsWritten;
+ const struct gl_program *program = ctx->FragmentProgram._Current;
+ const GLbitfield64 outputsWritten = program->info.outputs_written;
struct gl_program_machine *machine = &swrast->FragProgMachine;
GLuint i;
if (span->array->mask[i]) {
init_machine(ctx, machine, program, span, i);
- if (_mesa_execute_program(ctx, &program->Base, machine)) {
+ if (_mesa_execute_program(ctx, program, machine)) {
/* Store result color */
if (outputsWritten & BITFIELD64_BIT(FRAG_RESULT_COLOR)) {
void
_swrast_exec_fragment_program( struct gl_context *ctx, SWspan *span )
{
- const struct gl_fragment_program *program = ctx->FragmentProgram._Current;
+ const struct gl_program *program = ctx->FragmentProgram._Current;
/* incoming colors should be floats */
- if (program->Base.InputsRead & VARYING_BIT_COL0) {
+ if (program->info.inputs_read & VARYING_BIT_COL0) {
assert(span->array->ChanType == GL_FLOAT);
}
run_program(ctx, span, 0, span->end);
- if (program->Base.OutputsWritten & BITFIELD64_BIT(FRAG_RESULT_COLOR)) {
+ if (program->info.outputs_written & BITFIELD64_BIT(FRAG_RESULT_COLOR)) {
span->interpMask &= ~SPAN_RGBA;
span->arrayMask |= SPAN_RGBA;
}
- if (program->Base.OutputsWritten & BITFIELD64_BIT(FRAG_RESULT_DEPTH)) {
+ if (program->info.outputs_written & BITFIELD64_BIT(FRAG_RESULT_DEPTH)) {
span->interpMask &= ~SPAN_Z;
span->arrayMask |= SPAN_Z;
}