/** * Execute the current ATI shader program, operating on the given span. */ void _swrast_exec_fragment_shader(struct gl_context * ctx, SWspan *span) { const struct ati_fragment_shader *shader = ctx->ATIFragmentShader.Current; struct atifs_machine machine; GLuint i; /* incoming colors should be floats */ ASSERT(span->array->ChanType == GL_FLOAT); for (i = 0; i < span->end; i++) { if (span->array->mask[i]) { init_machine(ctx, &machine, shader, span, i); execute_shader(ctx, shader, &machine, span, i); /* store result color */ { const GLfloat *colOut = machine.Registers[0]; /*fprintf(stderr,"outputs %f %f %f %f\n", colOut[0], colOut[1], colOut[2], colOut[3]); */ COPY_4V(span->array->attribs[FRAG_ATTRIB_COL0][i], colOut); } } } }
/** * Execute the current fragment program, operating on the given span. */ void _swrast_exec_fragment_shader(GLcontext * ctx, struct sw_span *span) { const struct ati_fragment_shader *shader = ctx->ATIFragmentShader.Current; GLuint i; ctx->_CurrentProgram = GL_FRAGMENT_SHADER_ATI; for (i = 0; i < span->end; i++) { if (span->array->mask[i]) { init_machine(ctx, &ctx->ATIFragmentShader.Machine, ctx->ATIFragmentShader.Current, span, i); if (execute_shader(ctx, shader, ~0, &ctx->ATIFragmentShader.Machine, span, i)) { span->array->mask[i] = GL_FALSE; } { const GLfloat *colOut = ctx->ATIFragmentShader.Machine.Registers[0]; /*fprintf(stderr,"outputs %f %f %f %f\n", colOut[0], colOut[1], colOut[2], colOut[3]); */ UNCLAMPED_FLOAT_TO_CHAN(span->array->rgba[i][RCOMP], colOut[0]); UNCLAMPED_FLOAT_TO_CHAN(span->array->rgba[i][GCOMP], colOut[1]); UNCLAMPED_FLOAT_TO_CHAN(span->array->rgba[i][BCOMP], colOut[2]); UNCLAMPED_FLOAT_TO_CHAN(span->array->rgba[i][ACOMP], colOut[3]); } } } ctx->_CurrentProgram = 0; }