diff options
author | Timothy Arceri <[email protected]> | 2016-10-19 13:23:37 +1100 |
---|---|---|
committer | Timothy Arceri <[email protected]> | 2016-10-26 14:29:36 +1100 |
commit | 3423488d55b9c483fcdb3996eb89b424c1031d24 (patch) | |
tree | 270d90fe3fd4c090f2c8e59a3b20d0afe7d98e72 /src/mesa/swrast | |
parent | 17e28a1571b6141368fefc84cc8b0a3b4e52f8ee (diff) |
st/mesa/r200/i915/i965: eliminate gl_fragment_program
Here we move OriginUpperLeft and PixelCenterInteger into gl_program
all other fields have been replace by shader_info.
V2: Don't use anonymous union/structs to hold vertex/fragment fields
suggested by Ian.
Reviewed-by: Jason Ekstrand <[email protected]>
Diffstat (limited to 'src/mesa/swrast')
-rw-r--r-- | src/mesa/swrast/s_context.c | 15 | ||||
-rw-r--r-- | src/mesa/swrast/s_fragprog.c | 23 | ||||
-rw-r--r-- | src/mesa/swrast/s_span.c | 4 |
3 files changed, 20 insertions, 22 deletions
diff --git a/src/mesa/swrast/s_context.c b/src/mesa/swrast/s_context.c index 325a0a84ad5..3eb931fd3ad 100644 --- a/src/mesa/swrast/s_context.c +++ b/src/mesa/swrast/s_context.c @@ -220,13 +220,12 @@ _swrast_update_deferred_texture(struct gl_context *ctx) } else { GLboolean use_fprog = _swrast_use_fragment_program(ctx); - const struct gl_fragment_program *fprog - = ctx->FragmentProgram._Current; - if (use_fprog && (fprog->Base.OutputsWritten & (1 << FRAG_RESULT_DEPTH))) { + const struct gl_program *fprog = ctx->FragmentProgram._Current; + if (use_fprog && (fprog->OutputsWritten & (1 << FRAG_RESULT_DEPTH))) { /* Z comes from fragment program/shader */ swrast->_DeferredTexture = GL_FALSE; } - else if (use_fprog && fprog->Base.info.fs.uses_discard) { + else if (use_fprog && fprog->info.fs.uses_discard) { swrast->_DeferredTexture = GL_FALSE; } else if (ctx->Query.CurrentOcclusionObject) { @@ -247,9 +246,9 @@ static void _swrast_update_fog_state( struct gl_context *ctx ) { SWcontext *swrast = SWRAST_CONTEXT(ctx); - const struct gl_fragment_program *fp = ctx->FragmentProgram._Current; + const struct gl_program *fp = ctx->FragmentProgram._Current; - assert(fp == NULL || fp->Base.Target == GL_FRAGMENT_PROGRAM_ARB); + assert(fp == NULL || fp->Target == GL_FRAGMENT_PROGRAM_ARB); (void) fp; /* silence unused var warning */ /* determine if fog is needed, and if so, which fog mode */ @@ -269,7 +268,7 @@ _swrast_update_fragment_program(struct gl_context *ctx, GLbitfield newState) return; _mesa_load_state_parameters(ctx, - ctx->FragmentProgram._Current->Base.Parameters); + ctx->FragmentProgram._Current->Parameters); } @@ -500,7 +499,7 @@ _swrast_update_active_attribs(struct gl_context *ctx) */ if (_swrast_use_fragment_program(ctx)) { /* fragment program/shader */ - attribsMask = ctx->FragmentProgram._Current->Base.InputsRead; + attribsMask = ctx->FragmentProgram._Current->InputsRead; attribsMask &= ~VARYING_BIT_POS; /* WPOS is always handled specially */ } else if (ctx->ATIFragmentShader._Enabled) { diff --git a/src/mesa/swrast/s_fragprog.c b/src/mesa/swrast/s_fragprog.c index 022fb17b6fd..3530b50eecd 100644 --- a/src/mesa/swrast/s_fragprog.c +++ b/src/mesa/swrast/s_fragprog.c @@ -41,9 +41,9 @@ 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->NumInstructions == 0); } /** @@ -159,8 +159,7 @@ fetch_texel_deriv( struct gl_context *ctx, const GLfloat texcoord[4], */ 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]; @@ -179,7 +178,7 @@ init_machine(struct gl_context *ctx, struct gl_program_machine *machine, 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]) { @@ -204,8 +203,8 @@ static void 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->OutputsWritten; struct gl_program_machine *machine = &swrast->FragProgMachine; GLuint i; @@ -213,7 +212,7 @@ run_program(struct gl_context *ctx, SWspan *span, GLuint start, GLuint end) 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)) { @@ -263,21 +262,21 @@ run_program(struct gl_context *ctx, SWspan *span, GLuint start, GLuint end) 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->InputsRead & 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->OutputsWritten & BITFIELD64_BIT(FRAG_RESULT_COLOR)) { span->interpMask &= ~SPAN_RGBA; span->arrayMask |= SPAN_RGBA; } - if (program->Base.OutputsWritten & BITFIELD64_BIT(FRAG_RESULT_DEPTH)) { + if (program->OutputsWritten & BITFIELD64_BIT(FRAG_RESULT_DEPTH)) { span->interpMask &= ~SPAN_Z; span->arrayMask |= SPAN_Z; } diff --git a/src/mesa/swrast/s_span.c b/src/mesa/swrast/s_span.c index cd939ba9510..949c2303fd4 100644 --- a/src/mesa/swrast/s_span.c +++ b/src/mesa/swrast/s_span.c @@ -1310,10 +1310,10 @@ _swrast_write_rgba_span( struct gl_context *ctx, SWspan *span) */ { const GLuint numBuffers = fb->_NumColorDrawBuffers; - const struct gl_fragment_program *fp = ctx->FragmentProgram._Current; + const struct gl_program *fp = ctx->FragmentProgram._Current; const GLboolean multiFragOutputs = _swrast_use_fragment_program(ctx) - && fp->Base.OutputsWritten >= (1 << FRAG_RESULT_DATA0); + && fp->OutputsWritten >= (1 << FRAG_RESULT_DATA0); /* Save srcColorType because convert_color_type() can change it */ const GLenum srcColorType = span->array->ChanType; GLuint buf; |