if (ctx->DrawBuffer->Visual.depthBits <= 16)
span->z = FloatToFixed(ctx->Current.RasterPos[2] * depthMax + 0.5F);
else {
if (ctx->DrawBuffer->Visual.depthBits <= 16)
span->z = FloatToFixed(ctx->Current.RasterPos[2] * depthMax + 0.5F);
else {
const GLuint attr = VARYING_SLOT_TEX0 + i;
const GLfloat *tc = ctx->Current.RasterTexCoords[i];
if (_swrast_use_fragment_program(ctx) ||
const GLuint attr = VARYING_SLOT_TEX0 + i;
const GLfloat *tc = ctx->Current.RasterTexCoords[i];
if (_swrast_use_fragment_program(ctx) ||
if (span->interpMask & SPAN_FLAT) {
GLfloat r = FixedToFloat(span->red);
GLfloat g = FixedToFloat(span->green);
if (span->interpMask & SPAN_FLAT) {
GLfloat r = FixedToFloat(span->red);
GLfloat g = FixedToFloat(span->green);
GLfloat x = sqrtf(dudx * dudx + dvdx * dvdx);
GLfloat y = sqrtf(dudy * dudy + dvdy * dvdy);
GLfloat rho = MAX2(x, y);
GLfloat x = sqrtf(dudx * dudx + dvdx * dvdx);
GLfloat y = sqrtf(dudy * dudy + dvdy * dvdy);
GLfloat rho = MAX2(x, y);
GLfloat dsdy2 = (s + dsdy) / (q + dqdy) - s * invQ;
GLfloat dtdy2 = (t + dtdy) / (q + dqdy) - t * invQ;
GLfloat maxU, maxV, rho, lambda;
GLfloat dsdy2 = (s + dsdy) / (q + dqdy) - s * invQ;
GLfloat dtdy2 = (t + dtdy) / (q + dqdy) - t * invQ;
GLfloat maxU, maxV, rho, lambda;
maxU = MAX2(dsdx2, dsdy2) * texW;
maxV = MAX2(dtdx2, dtdy2) * texH;
rho = MAX2(maxU, maxV);
maxU = MAX2(dsdx2, dsdy2) * texW;
maxV = MAX2(dtdx2, dtdy2) * texH;
rho = MAX2(maxU, maxV);
const struct swrast_texture_image *swImg =
swrast_texture_image_const(img);
const struct gl_sampler_object *samp = _mesa_get_samplerobj(ctx, u);
const struct swrast_texture_image *swImg =
swrast_texture_image_const(img);
const struct gl_sampler_object *samp = _mesa_get_samplerobj(ctx, u);
/* LOD is calculated directly in the ansiotropic filter, we can
* skip the normal lambda function as the result is ignored.
*/
/* LOD is calculated directly in the ansiotropic filter, we can
* skip the normal lambda function as the result is ignored.
*/
/* do perspective correction but don't divide s, t, r by q */
const GLfloat dwdx = span->attrStepX[VARYING_SLOT_POS][3];
GLfloat w = span->attrStart[VARYING_SLOT_POS][3] + span->leftClip * dwdx;
/* do perspective correction but don't divide s, t, r by q */
const GLfloat dwdx = span->attrStepX[VARYING_SLOT_POS][3];
GLfloat w = span->attrStart[VARYING_SLOT_POS][3] + span->leftClip * dwdx;
/* do perspective correction but don't divide s, t, r by q */
const GLfloat dwdx = span->attrStepX[VARYING_SLOT_POS][3];
GLfloat w = span->attrStart[VARYING_SLOT_POS][3] + span->leftClip * dwdx;
/* do perspective correction but don't divide s, t, r by q */
const GLfloat dwdx = span->attrStepX[VARYING_SLOT_POS][3];
GLfloat w = span->attrStart[VARYING_SLOT_POS][3] + span->leftClip * dwdx;
/* Clip 'leftClip' pixels from the left side.
* The span->leftClip field will be applied when we interpolate
/* Clip 'leftClip' pixels from the left side.
* The span->leftClip field will be applied when we interpolate
* For arrays of values, shift them left.
*/
for (i = 0; i < VARYING_SLOT_MAX; i++) {
* For arrays of values, shift them left.
*/
for (i = 0; i < VARYING_SLOT_MAX; i++) {
memmove(ARRAY, ARRAY + (SHIFT), (LEN) * sizeof(ARRAY[0]))
for (i = 0; i < VARYING_SLOT_MAX; i++) {
memmove(ARRAY, ARRAY + (SHIFT), (LEN) * sizeof(ARRAY[0]))
for (i = 0; i < VARYING_SLOT_MAX; i++) {
/* shift array elements left by 'leftClip' */
SHIFT_ARRAY(span->array->attribs[i], leftClip, n - leftClip);
}
/* shift array elements left by 'leftClip' */
SHIFT_ARRAY(span->array->attribs[i], leftClip, n - leftClip);
}
- ASSERT(span->x >= xmin);
- ASSERT(span->x + span->end <= xmax);
- ASSERT(span->y >= ymin);
- ASSERT(span->y < ymax);
+ assert(span->x >= xmin);
+ assert(span->x + span->end <= xmax);
+ assert(span->y >= ymin);
+ assert(span->y < ymax);
- ASSERT(!_swrast_use_fragment_program(ctx));
- ASSERT(span->arrayMask & SPAN_RGBA);
- ASSERT(swrast->_ActiveAttribMask & VARYING_BIT_COL1);
+ assert(!_swrast_use_fragment_program(ctx));
+ assert(span->arrayMask & SPAN_RGBA);
+ assert(swrast->_ActiveAttribMask & VARYING_BIT_COL1);
GLubyte (*rgba)[4] = span->array->rgba8;
for (i = 0; i < span->end; i++) {
const GLfloat a = rgba[i][ACOMP] * coverage[i];
GLubyte (*rgba)[4] = span->array->rgba8;
for (i = 0; i < span->end; i++) {
const GLfloat a = rgba[i][ACOMP] * coverage[i];
- rgba[i][ACOMP] = (GLubyte) CLAMP(a, 0.0, 255.0);
- ASSERT(coverage[i] >= 0.0);
- ASSERT(coverage[i] <= 1.0);
+ rgba[i][ACOMP] = (GLubyte) CLAMP(a, 0.0F, 255.0F);
+ assert(coverage[i] >= 0.0F);
+ assert(coverage[i] <= 1.0F);
}
}
else if (span->array->ChanType == GL_UNSIGNED_SHORT) {
GLushort (*rgba)[4] = span->array->rgba16;
for (i = 0; i < span->end; i++) {
const GLfloat a = rgba[i][ACOMP] * coverage[i];
}
}
else if (span->array->ChanType == GL_UNSIGNED_SHORT) {
GLushort (*rgba)[4] = span->array->rgba16;
for (i = 0; i < span->end; i++) {
const GLfloat a = rgba[i][ACOMP] * coverage[i];
for (i = 0; i < span->end; i++) {
rgba[i][RCOMP] = CLAMP(rgba[i][RCOMP], 0.0F, 1.0F);
rgba[i][GCOMP] = CLAMP(rgba[i][GCOMP], 0.0F, 1.0F);
for (i = 0; i < span->end; i++) {
rgba[i][RCOMP] = CLAMP(rgba[i][RCOMP], 0.0F, 1.0F);
rgba[i][GCOMP] = CLAMP(rgba[i][GCOMP], 0.0F, 1.0F);
-convert_color_type(SWspan *span, GLenum newType, GLuint output)
+convert_color_type(SWspan *span, GLenum srcType, GLenum newType, GLuint output)
shade_texture_span(struct gl_context *ctx, SWspan *span)
{
if (_swrast_use_fragment_program(ctx) ||
shade_texture_span(struct gl_context *ctx, SWspan *span)
{
if (_swrast_use_fragment_program(ctx) ||
- convert_color_type(span, GL_FLOAT, 0);
+ convert_color_type(span, span->array->ChanType, GL_FLOAT, 0);
GLuint count, const GLint x[], const GLint y[],
const void *values, const GLubyte *mask)
{
GLuint count, const GLint x[], const GLint y[],
const void *values, const GLubyte *mask)
{
_swrast_write_rgba_span( struct gl_context *ctx, SWspan *span)
{
const SWcontext *swrast = SWRAST_CONTEXT(ctx);
_swrast_write_rgba_span( struct gl_context *ctx, SWspan *span)
{
const SWcontext *swrast = SWRAST_CONTEXT(ctx);
const GLbitfield origInterpMask = span->interpMask;
const GLbitfield origArrayMask = span->arrayMask;
const GLbitfield64 origArrayAttribs = span->arrayAttribs;
const GLenum origChanType = span->array->ChanType;
void * const origRgba = span->array->rgba;
const GLboolean shader = (_swrast_use_fragment_program(ctx)
const GLbitfield origInterpMask = span->interpMask;
const GLbitfield origArrayMask = span->arrayMask;
const GLbitfield64 origArrayAttribs = span->arrayAttribs;
const GLenum origChanType = span->array->ChanType;
void * const origRgba = span->array->rgba;
const GLboolean shader = (_swrast_use_fragment_program(ctx)
const GLboolean shaderOrTexture = shader || ctx->Texture._EnabledCoordUnits;
struct gl_framebuffer *fb = ctx->DrawBuffer;
/*
const GLboolean shaderOrTexture = shader || ctx->Texture._EnabledCoordUnits;
struct gl_framebuffer *fb = ctx->DrawBuffer;
/*
span->primitive == GL_LINE ||
span->primitive == GL_POLYGON ||
span->primitive == GL_BITMAP);
span->primitive == GL_LINE ||
span->primitive == GL_POLYGON ||
span->primitive == GL_BITMAP);
if (!(span->arrayMask & SPAN_Z))
_swrast_span_interpolate_z(ctx, span);
if (!(span->arrayMask & SPAN_Z))
_swrast_span_interpolate_z(ctx, span);
/* Combined Z/stencil tests */
if (!_swrast_stencil_and_ztest_span(ctx, span)) {
/* all fragments failed test */
/* Combined Z/stencil tests */
if (!_swrast_stencil_and_ztest_span(ctx, span)) {
/* all fragments failed test */
if (!_swrast_depth_test_span(ctx, span)) {
/* all fragments failed test */
goto end;
if (!_swrast_depth_test_span(ctx, span)) {
/* all fragments failed test */
goto end;
/* We had to wait until now to check for glColorMask(0,0,0,0) because of
* the occlusion test.
*/
/* We had to wait until now to check for glColorMask(0,0,0,0) because of
* the occlusion test.
*/
if (span->primitive == GL_BITMAP || !swrast->SpecularVertexAdd) {
/* Add primary and specular (diffuse + specular) colors */
if (span->primitive == GL_BITMAP || !swrast->SpecularVertexAdd) {
/* Add primary and specular (diffuse + specular) colors */
- const struct gl_fragment_program *fp = ctx->FragmentProgram._Current;
- const GLboolean multiFragOutputs =
+ const struct gl_program *fp = ctx->FragmentProgram._Current;
+ const GLboolean multiFragOutputs =
- && fp->Base.OutputsWritten >= (1 << FRAG_RESULT_DATA0);
+ && fp->info.outputs_written >= (1 << FRAG_RESULT_DATA0);
+ /* Save srcColorType because convert_color_type() can change it */
+ const GLenum srcColorType = span->array->ChanType;
/* re-use one of the attribute array buffers for rgbaSave */
GLchan (*rgbaSave)[4] = (GLchan (*)[4]) span->array->attribs[0];
struct swrast_renderbuffer *srb = swrast_renderbuffer(rb);
/* re-use one of the attribute array buffers for rgbaSave */
GLchan (*rgbaSave)[4] = (GLchan (*)[4]) span->array->attribs[0];
struct swrast_renderbuffer *srb = swrast_renderbuffer(rb);
- if (span->array->ChanType != colorType) {
- convert_color_type(span, colorType, 0);
+ if (srcColorType != dstColorType) {
+ convert_color_type(span, srcColorType, dstColorType,
+ multiFragOutputs ? buf : 0);
rb->_BaseFormat == GL_RGB ||
rb->_BaseFormat == GL_RED ||
rb->_BaseFormat == GL_RG ||
rb->_BaseFormat == GL_RGB ||
rb->_BaseFormat == GL_RED ||
rb->_BaseFormat == GL_RG ||
_swrast_mask_rgba_span(ctx, rb, span, buf);
}
_swrast_mask_rgba_span(ctx, rb, span, buf);
}
rb->_BaseFormat == GL_RGB ||
rb->_BaseFormat == GL_RG ||
rb->_BaseFormat == GL_RED ||
rb->_BaseFormat == GL_RGB ||
rb->_BaseFormat == GL_RG ||
rb->_BaseFormat == GL_RED ||