diff options
author | Dave Airlie <airlied@redhat.com> | 2009-03-20 10:52:17 +1000 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2009-03-20 10:52:17 +1000 |
commit | 407e8ae5b167b0193e1e5b1266a5d61ed836dfb5 (patch) | |
tree | 2d9d05a5c3122f41a13aa8bd9ae921c1176e6b0d /src/mesa/swrast | |
parent | bdaa0341caffc353fd26bbd91865c2d86eed11c1 (diff) | |
parent | 114bb54324f22cb53bcd14607234d0acd74d37bd (diff) |
Merge remote branch 'main/master' into radeon-rewrite
Conflicts:
src/mesa/drivers/dri/r300/r300_cmdbuf.c
src/mesa/drivers/dri/r300/r300_state.c
src/mesa/drivers/dri/r300/r300_swtcl.c
src/mesa/drivers/dri/r300/radeon_ioctl.c
src/mesa/drivers/dri/radeon/radeon_screen.c
Diffstat (limited to 'src/mesa/swrast')
-rw-r--r-- | src/mesa/swrast/s_atifragshader.c | 4 | ||||
-rw-r--r-- | src/mesa/swrast/s_clear.c (renamed from src/mesa/swrast/s_buffers.c) | 7 | ||||
-rw-r--r-- | src/mesa/swrast/s_context.c | 4 | ||||
-rw-r--r-- | src/mesa/swrast/s_context.h | 28 | ||||
-rw-r--r-- | src/mesa/swrast/s_drawpix.c | 11 | ||||
-rw-r--r-- | src/mesa/swrast/s_feedback.c | 8 | ||||
-rw-r--r-- | src/mesa/swrast/s_fragprog.c | 16 | ||||
-rw-r--r-- | src/mesa/swrast/s_span.c | 24 | ||||
-rw-r--r-- | src/mesa/swrast/s_texcombine.c | 95 | ||||
-rw-r--r-- | src/mesa/swrast/s_texfilter.c | 4 | ||||
-rw-r--r-- | src/mesa/swrast/s_triangle.c | 29 | ||||
-rw-r--r-- | src/mesa/swrast/swrast.h | 12 |
12 files changed, 184 insertions, 58 deletions
diff --git a/src/mesa/swrast/s_atifragshader.c b/src/mesa/swrast/s_atifragshader.c index 21cbd3cf37..458fe18163 100644 --- a/src/mesa/swrast/s_atifragshader.c +++ b/src/mesa/swrast/s_atifragshader.c @@ -591,8 +591,6 @@ _swrast_exec_fragment_shader(GLcontext * ctx, SWspan *span) /* incoming colors should be floats */ ASSERT(span->array->ChanType == GL_FLOAT); - ctx->_CurrentProgram = GL_FRAGMENT_SHADER_ATI; - for (i = 0; i < span->end; i++) { if (span->array->mask[i]) { init_machine(ctx, &machine, shader, span, i); @@ -608,6 +606,4 @@ _swrast_exec_fragment_shader(GLcontext * ctx, SWspan *span) } } } - - ctx->_CurrentProgram = 0; } diff --git a/src/mesa/swrast/s_buffers.c b/src/mesa/swrast/s_clear.c index af475ad8cb..35080fd394 100644 --- a/src/mesa/swrast/s_buffers.c +++ b/src/mesa/swrast/s_clear.c @@ -22,8 +22,6 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/** XXX This file should be named s_clear.c */ - #include "main/glheader.h" #include "main/colormac.h" #include "main/macros.h" @@ -317,10 +315,7 @@ _swrast_Clear(GLcontext *ctx, GLbitfield buffers) BUFFER_BIT_DEPTH | BUFFER_BIT_STENCIL | BUFFER_BIT_ACCUM | - BUFFER_BIT_AUX0 | - BUFFER_BIT_AUX1 | - BUFFER_BIT_AUX2 | - BUFFER_BIT_AUX3; + BUFFER_BIT_AUX0; assert((buffers & (~legalBits)) == 0); } #endif diff --git a/src/mesa/swrast/s_context.c b/src/mesa/swrast/s_context.c index 297940adbd..4dbccbb2d5 100644 --- a/src/mesa/swrast/s_context.c +++ b/src/mesa/swrast/s_context.c @@ -61,7 +61,7 @@ _swrast_update_rasterflags( GLcontext *ctx ) if (ctx->Depth.Test) rasterMask |= DEPTH_BIT; if (swrast->_FogEnabled) rasterMask |= FOG_BIT; if (ctx->Scissor.Enabled) rasterMask |= CLIP_BIT; - if (ctx->Stencil.Enabled) rasterMask |= STENCIL_BIT; + if (ctx->Stencil._Enabled) rasterMask |= STENCIL_BIT; if (ctx->Visual.rgbMode) { const GLuint colorMask = *((GLuint *) &ctx->Color.ColorMask); if (colorMask != 0xffffffff) rasterMask |= MASKING_BIT; @@ -206,7 +206,7 @@ _swrast_update_deferred_texture(GLcontext *ctx) else { const struct gl_fragment_program *fprog = ctx->FragmentProgram._Current; - if (fprog && (fprog->Base.OutputsWritten & (1 << FRAG_RESULT_DEPR))) { + if (fprog && (fprog->Base.OutputsWritten & (1 << FRAG_RESULT_DEPTH))) { /* Z comes from fragment program/shader */ swrast->_DeferredTexture = GL_FALSE; } diff --git a/src/mesa/swrast/s_context.h b/src/mesa/swrast/s_context.h index cdd6fa5048..6e8d080704 100644 --- a/src/mesa/swrast/s_context.h +++ b/src/mesa/swrast/s_context.h @@ -289,6 +289,34 @@ swrast_render_finish(GLcontext *ctx) /* + * Fixed point arithmetic macros + */ +#ifndef FIXED_FRAC_BITS +#define FIXED_FRAC_BITS 11 +#endif + +#define FIXED_SHIFT FIXED_FRAC_BITS +#define FIXED_ONE (1 << FIXED_SHIFT) +#define FIXED_HALF (1 << (FIXED_SHIFT-1)) +#define FIXED_FRAC_MASK (FIXED_ONE - 1) +#define FIXED_INT_MASK (~FIXED_FRAC_MASK) +#define FIXED_EPSILON 1 +#define FIXED_SCALE ((float) FIXED_ONE) +#define FIXED_DBL_SCALE ((double) FIXED_ONE) +#define FloatToFixed(X) (IROUND((X) * FIXED_SCALE)) +#define FixedToDouble(X) ((X) * (1.0 / FIXED_DBL_SCALE)) +#define IntToFixed(I) ((I) << FIXED_SHIFT) +#define FixedToInt(X) ((X) >> FIXED_SHIFT) +#define FixedToUns(X) (((unsigned int)(X)) >> FIXED_SHIFT) +#define FixedCeil(X) (((X) + FIXED_ONE - FIXED_EPSILON) & FIXED_INT_MASK) +#define FixedFloor(X) ((X) & FIXED_INT_MASK) +#define FixedToFloat(X) ((X) * (1.0F / FIXED_SCALE)) +#define PosFloatToFixed(X) FloatToFixed(X) +#define SignedFloatToFixed(X) FloatToFixed(X) + + + +/* * XXX these macros are just bandages for now in order to make * CHAN_BITS==32 compile cleanly. * These should probably go elsewhere at some point. diff --git a/src/mesa/swrast/s_drawpix.c b/src/mesa/swrast/s_drawpix.c index 700f76d4bc..a9ef8e685f 100644 --- a/src/mesa/swrast/s_drawpix.c +++ b/src/mesa/swrast/s_drawpix.c @@ -829,6 +829,15 @@ _swrast_DrawPixels( GLcontext *ctx, const GLvoid *pixels ) { SWcontext *swrast = SWRAST_CONTEXT(ctx); + GLboolean save_vp_override = ctx->VertexProgram._Overriden; + + /* We are creating fragments directly, without going through vertex programs. + * + * This override flag tells the fragment processing code that its input comes + * from a non-standard source, and it may therefore not rely on optimizations + * that assume e.g. constant color if there is no color vertex array. + */ + _mesa_set_vp_override(ctx, GL_TRUE); swrast_render_start(ctx); @@ -841,6 +850,7 @@ _swrast_DrawPixels( GLcontext *ctx, pixels = _mesa_map_drawpix_pbo(ctx, unpack, pixels); if (!pixels) { swrast_render_finish(ctx); + _mesa_set_vp_override(ctx, save_vp_override); return; } @@ -880,6 +890,7 @@ _swrast_DrawPixels( GLcontext *ctx, } swrast_render_finish(ctx); + _mesa_set_vp_override(ctx, save_vp_override); _mesa_unmap_drawpix_pbo(ctx, unpack); } diff --git a/src/mesa/swrast/s_feedback.c b/src/mesa/swrast/s_feedback.c index aa79531277..7bb914b658 100644 --- a/src/mesa/swrast/s_feedback.c +++ b/src/mesa/swrast/s_feedback.c @@ -59,8 +59,8 @@ _swrast_feedback_triangle(GLcontext *ctx, const SWvertex *v0, const SWvertex *v1, const SWvertex *v2) { if (_swrast_culltriangle(ctx, v0, v1, v2)) { - FEEDBACK_TOKEN(ctx, (GLfloat) (GLint) GL_POLYGON_TOKEN); - FEEDBACK_TOKEN(ctx, (GLfloat) 3); /* three vertices */ + _mesa_feedback_token(ctx, (GLfloat) (GLint) GL_POLYGON_TOKEN); + _mesa_feedback_token(ctx, (GLfloat) 3); /* three vertices */ if (ctx->Light.ShadeModel == GL_SMOOTH) { feedback_vertex(ctx, v0, v0); @@ -86,7 +86,7 @@ _swrast_feedback_line(GLcontext *ctx, const SWvertex *v0, if (swrast->StippleCounter == 0) token = GL_LINE_RESET_TOKEN; - FEEDBACK_TOKEN(ctx, (GLfloat) (GLint) token); + _mesa_feedback_token(ctx, (GLfloat) (GLint) token); if (ctx->Light.ShadeModel == GL_SMOOTH) { feedback_vertex(ctx, v0, v0); @@ -104,7 +104,7 @@ _swrast_feedback_line(GLcontext *ctx, const SWvertex *v0, void _swrast_feedback_point(GLcontext *ctx, const SWvertex *v) { - FEEDBACK_TOKEN(ctx, (GLfloat) (GLint) GL_POINT_TOKEN); + _mesa_feedback_token(ctx, (GLfloat) (GLint) GL_POINT_TOKEN); feedback_vertex(ctx, v, v); } diff --git a/src/mesa/swrast/s_fragprog.c b/src/mesa/swrast/s_fragprog.c index c6601f5593..ae1dea16a0 100644 --- a/src/mesa/swrast/s_fragprog.c +++ b/src/mesa/swrast/s_fragprog.c @@ -202,9 +202,9 @@ run_program(GLcontext *ctx, SWspan *span, GLuint start, GLuint end) if (_mesa_execute_program(ctx, &program->Base, machine)) { /* Store result color */ - if (outputsWritten & (1 << FRAG_RESULT_COLR)) { + if (outputsWritten & (1 << FRAG_RESULT_COLOR)) { COPY_4V(span->array->attribs[FRAG_ATTRIB_COL0][i], - machine->Outputs[FRAG_RESULT_COLR]); + machine->Outputs[FRAG_RESULT_COLOR]); } else { /* Multiple drawbuffers / render targets @@ -221,8 +221,8 @@ run_program(GLcontext *ctx, SWspan *span, GLuint start, GLuint end) } /* Store result depth/z */ - if (outputsWritten & (1 << FRAG_RESULT_DEPR)) { - const GLfloat depth = machine->Outputs[FRAG_RESULT_DEPR][2]; + if (outputsWritten & (1 << FRAG_RESULT_DEPTH)) { + const GLfloat depth = machine->Outputs[FRAG_RESULT_DEPTH][2]; if (depth <= 0.0) span->array->z[i] = 0; else if (depth >= 1.0) @@ -255,20 +255,16 @@ _swrast_exec_fragment_program( GLcontext *ctx, SWspan *span ) ASSERT(span->array->ChanType == GL_FLOAT); } - ctx->_CurrentProgram = GL_FRAGMENT_PROGRAM_ARB; /* or NV, doesn't matter */ - run_program(ctx, span, 0, span->end); - if (program->Base.OutputsWritten & (1 << FRAG_RESULT_COLR)) { + if (program->Base.OutputsWritten & (1 << FRAG_RESULT_COLOR)) { span->interpMask &= ~SPAN_RGBA; span->arrayMask |= SPAN_RGBA; } - if (program->Base.OutputsWritten & (1 << FRAG_RESULT_DEPR)) { + if (program->Base.OutputsWritten & (1 << FRAG_RESULT_DEPTH)) { span->interpMask &= ~SPAN_Z; span->arrayMask |= SPAN_Z; } - - ctx->_CurrentProgram = 0; } diff --git a/src/mesa/swrast/s_span.c b/src/mesa/swrast/s_span.c index ab7b82b19d..15a783b236 100644 --- a/src/mesa/swrast/s_span.c +++ b/src/mesa/swrast/s_span.c @@ -442,11 +442,10 @@ _swrast_span_interpolate_z( const GLcontext *ctx, SWspan *span ) * Compute mipmap LOD from partial derivatives. * This the ideal solution, as given in the OpenGL spec. */ -#if 0 -static GLfloat -compute_lambda(GLfloat dsdx, GLfloat dsdy, GLfloat dtdx, GLfloat dtdy, - GLfloat dqdx, GLfloat dqdy, GLfloat texW, GLfloat texH, - GLfloat s, GLfloat t, GLfloat q, GLfloat invQ) +GLfloat +_swrast_compute_lambda(GLfloat dsdx, GLfloat dsdy, GLfloat dtdx, GLfloat dtdy, + GLfloat dqdx, GLfloat dqdy, GLfloat texW, GLfloat texH, + GLfloat s, GLfloat t, GLfloat q, GLfloat invQ) { GLfloat dudx = texW * ((s + dsdx) / (q + dqdx) - s * invQ); GLfloat dvdx = texH * ((t + dtdx) / (q + dqdx) - t * invQ); @@ -458,13 +457,13 @@ compute_lambda(GLfloat dsdx, GLfloat dsdy, GLfloat dtdx, GLfloat dtdy, GLfloat lambda = LOG2(rho); return lambda; } -#endif /** * Compute mipmap LOD from partial derivatives. * This is a faster approximation than above function. */ +#if 0 GLfloat _swrast_compute_lambda(GLfloat dsdx, GLfloat dsdy, GLfloat dtdx, GLfloat dtdy, GLfloat dqdx, GLfloat dqdy, GLfloat texW, GLfloat texH, @@ -485,6 +484,7 @@ _swrast_compute_lambda(GLfloat dsdx, GLfloat dsdy, GLfloat dtdx, GLfloat dtdy, lambda = LOG2(rho); return lambda; } +#endif /** @@ -846,11 +846,11 @@ _swrast_write_index_span( GLcontext *ctx, SWspan *span) } /* Stencil and Z testing */ - if (ctx->Depth.Test || ctx->Stencil.Enabled) { + if (ctx->Stencil._Enabled || ctx->Depth.Test) { if (!(span->arrayMask & SPAN_Z)) _swrast_span_interpolate_z(ctx, span); - if (ctx->Stencil.Enabled) { + if (ctx->Stencil._Enabled) { if (!_swrast_stencil_and_ztest_span(ctx, span)) { span->arrayMask = origArrayMask; return; @@ -1211,7 +1211,7 @@ shade_texture_span(GLcontext *ctx, SWspan *span) _swrast_exec_fragment_shader(ctx, span); } } - else if (ctx->Texture._EnabledUnits) { + else if (ctx->Texture._EnabledCoordUnits) { /* conventional texturing */ #if CHAN_BITS == 32 @@ -1250,7 +1250,7 @@ _swrast_write_rgba_span( GLcontext *ctx, SWspan *span) void * const origRgba = span->array->rgba; const GLboolean shader = (ctx->FragmentProgram._Current || ctx->ATIFragmentShader._Enabled); - const GLboolean shaderOrTexture = shader || ctx->Texture._EnabledUnits; + const GLboolean shaderOrTexture = shader || ctx->Texture._EnabledCoordUnits; struct gl_framebuffer *fb = ctx->DrawBuffer; /* @@ -1317,11 +1317,11 @@ _swrast_write_rgba_span( GLcontext *ctx, SWspan *span) } /* Stencil and Z testing */ - if (ctx->Stencil.Enabled || ctx->Depth.Test) { + if (ctx->Stencil._Enabled || ctx->Depth.Test) { if (!(span->arrayMask & SPAN_Z)) _swrast_span_interpolate_z(ctx, span); - if (ctx->Stencil.Enabled && fb->Visual.stencilBits > 0) { + if (ctx->Stencil._Enabled) { /* Combined Z/stencil tests */ if (!_swrast_stencil_and_ztest_span(ctx, span)) { /* all fragments failed test */ diff --git a/src/mesa/swrast/s_texcombine.c b/src/mesa/swrast/s_texcombine.c index 38b5633887..aa28311672 100644 --- a/src/mesa/swrast/s_texcombine.c +++ b/src/mesa/swrast/s_texcombine.c @@ -591,6 +591,25 @@ texture_combine( const GLcontext *ctx, GLuint unit, GLuint n, } } break; + case GL_BUMP_ENVMAP_ATI: + { + /* this produces a fixed rgba color, and the coord calc is done elsewhere */ + for (i = 0; i < n; i++) { + /* rgba result is 0,0,0,1 */ +#if CHAN_TYPE == GL_FLOAT + rgba[i][RCOMP] = 0.0; + rgba[i][GCOMP] = 0.0; + rgba[i][BCOMP] = 0.0; + rgba[i][ACOMP] = 1.0; +#else + rgba[i][RCOMP] = 0; + rgba[i][GCOMP] = 0; + rgba[i][BCOMP] = 0; + rgba[i][ACOMP] = CHAN_MAX; +#endif + } + } + return; /* no alpha processing */ default: _mesa_problem(ctx, "invalid combine mode"); } @@ -1218,12 +1237,86 @@ _swrast_texture_span( GLcontext *ctx, SWspan *span ) if (swrast->_AnyTextureCombine) MEMCPY(primary_rgba, span->array->rgba, 4 * span->end * sizeof(GLchan)); + /* First must sample all bump maps */ + for (unit = 0; unit < ctx->Const.MaxTextureUnits; unit++) { + if (ctx->Texture.Unit[unit]._ReallyEnabled && + ctx->Texture.Unit[unit]._CurrentCombine->ModeRGB == GL_BUMP_ENVMAP_ATI) { + const GLfloat (*texcoords)[4] + = (const GLfloat (*)[4]) + span->array->attribs[FRAG_ATTRIB_TEX0 + unit]; + GLfloat (*targetcoords)[4] + = (GLfloat (*)[4]) + span->array->attribs[FRAG_ATTRIB_TEX0 + + ctx->Texture.Unit[unit].BumpTarget - GL_TEXTURE0]; + + const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit]; + const struct gl_texture_object *curObj = texUnit->_Current; + GLfloat *lambda = span->array->lambda[unit]; + GLchan (*texels)[4] = (GLchan (*)[4]) + (swrast->TexelBuffer + unit * (span->end * 4 * sizeof(GLchan))); + GLuint i; + GLfloat rotMatrix00 = ctx->Texture.Unit[unit].RotMatrix[0]; + GLfloat rotMatrix01 = ctx->Texture.Unit[unit].RotMatrix[1]; + GLfloat rotMatrix10 = ctx->Texture.Unit[unit].RotMatrix[2]; + GLfloat rotMatrix11 = ctx->Texture.Unit[unit].RotMatrix[3]; + + /* adjust texture lod (lambda) */ + if (span->arrayMask & SPAN_LAMBDA) { + if (texUnit->LodBias + curObj->LodBias != 0.0F) { + /* apply LOD bias, but don't clamp yet */ + const GLfloat bias = CLAMP(texUnit->LodBias + curObj->LodBias, + -ctx->Const.MaxTextureLodBias, + ctx->Const.MaxTextureLodBias); + GLuint i; + for (i = 0; i < span->end; i++) { + lambda[i] += bias; + } + } + + if (curObj->MinLod != -1000.0 || curObj->MaxLod != 1000.0) { + /* apply LOD clamping to lambda */ + const GLfloat min = curObj->MinLod; + const GLfloat max = curObj->MaxLod; + GLuint i; + for (i = 0; i < span->end; i++) { + GLfloat l = lambda[i]; + lambda[i] = CLAMP(l, min, max); + } + } + } + + /* Sample the texture (span->end = number of fragments) */ + swrast->TextureSample[unit]( ctx, texUnit->_Current, span->end, + texcoords, lambda, texels ); + + /* manipulate the span values of the bump target + not sure this can work correctly even ignoring + the problem that channel is unsigned */ + for (i = 0; i < span->end; i++) { +#if CHAN_TYPE == GL_FLOAT + targetcoords[i][0] += (texels[i][0] * rotMatrix00 + texels[i][1] * + rotMatrix01) / targetcoords[i][3]; + targetcoords[i][1] += (texels[i][0] * rotMatrix10 + texels[i][1] * + rotMatrix11) / targetcoords[i][3]; +#else + targetcoords[i][0] += (CHAN_TO_FLOAT(texels[i][1]) * rotMatrix00 + + CHAN_TO_FLOAT(texels[i][1]) * rotMatrix01) / + targetcoords[i][3]; + targetcoords[i][1] += (CHAN_TO_FLOAT(texels[i][0]) * rotMatrix10 + + CHAN_TO_FLOAT(texels[i][1]) * rotMatrix11) / + targetcoords[i][3]; +#endif + } + } + } + /* * Must do all texture sampling before combining in order to * accomodate GL_ARB_texture_env_crossbar. */ for (unit = 0; unit < ctx->Const.MaxTextureUnits; unit++) { - if (ctx->Texture.Unit[unit]._ReallyEnabled) { + if (ctx->Texture.Unit[unit]._ReallyEnabled && + ctx->Texture.Unit[unit]._CurrentCombine->ModeRGB != GL_BUMP_ENVMAP_ATI) { const GLfloat (*texcoords)[4] = (const GLfloat (*)[4]) span->array->attribs[FRAG_ATTRIB_TEX0 + unit]; diff --git a/src/mesa/swrast/s_texfilter.c b/src/mesa/swrast/s_texfilter.c index 8d72018cf4..19317c393a 100644 --- a/src/mesa/swrast/s_texfilter.c +++ b/src/mesa/swrast/s_texfilter.c @@ -2830,7 +2830,9 @@ sample_depth_texture( GLcontext *ctx, /* XXXX if tObj->MinFilter != tObj->MagFilter, we're ignoring lambda */ - function = tObj->_Function; + function = (tObj->CompareMode == GL_COMPARE_R_TO_TEXTURE_ARB) ? + tObj->CompareFunc : GL_NONE; + if (tObj->MagFilter == GL_NEAREST) { GLuint i; for (i = 0; i < n; i++) { diff --git a/src/mesa/swrast/s_triangle.c b/src/mesa/swrast/s_triangle.c index 0598052f50..9260e35066 100644 --- a/src/mesa/swrast/s_triangle.c +++ b/src/mesa/swrast/s_triangle.c @@ -132,7 +132,8 @@ _swrast_culltriangle( GLcontext *ctx, #define SETUP_CODE \ struct gl_renderbuffer *rb = ctx->DrawBuffer->_ColorDrawBuffers[0]; \ - struct gl_texture_object *obj = ctx->Texture.Unit[0].Current2D; \ + struct gl_texture_object *obj = \ + ctx->Texture.Unit[0].CurrentTex[TEXTURE_2D_INDEX]; \ const GLint b = obj->BaseLevel; \ const GLfloat twidth = (GLfloat) obj->Image[0][b]->Width; \ const GLfloat theight = (GLfloat) obj->Image[0][b]->Height; \ @@ -183,7 +184,8 @@ _swrast_culltriangle( GLcontext *ctx, #define SETUP_CODE \ struct gl_renderbuffer *rb = ctx->DrawBuffer->_ColorDrawBuffers[0]; \ - struct gl_texture_object *obj = ctx->Texture.Unit[0].Current2D; \ + struct gl_texture_object *obj = \ + ctx->Texture.Unit[0].CurrentTex[TEXTURE_2D_INDEX]; \ const GLint b = obj->BaseLevel; \ const GLfloat twidth = (GLfloat) obj->Image[0][b]->Width; \ const GLfloat theight = (GLfloat) obj->Image[0][b]->Height; \ @@ -264,7 +266,7 @@ affine_span(GLcontext *ctx, SWspan *span, struct affine_info *info) { GLchan sample[4]; /* the filtered texture sample */ - const GLuint texEnableSave = ctx->Texture._EnabledUnits; + const GLuint texEnableSave = ctx->Texture._EnabledCoordUnits; /* Instead of defining a function for each mode, a test is done * between the outer and inner loops. This is to reduce code size @@ -395,7 +397,7 @@ affine_span(GLcontext *ctx, SWspan *span, GLchan *dest = span->array->rgba[0]; /* Disable tex units so they're not re-applied in swrast_write_rgba_span */ - ctx->Texture._EnabledUnits = 0x0; + ctx->Texture._EnabledCoordUnits = 0x0; span->intTex[0] -= FIXED_HALF; span->intTex[1] -= FIXED_HALF; @@ -502,7 +504,7 @@ affine_span(GLcontext *ctx, SWspan *span, _swrast_write_rgba_span(ctx, span); /* re-enable texture units */ - ctx->Texture._EnabledUnits = texEnableSave; + ctx->Texture._EnabledCoordUnits = texEnableSave; #undef SPAN_NEAREST #undef SPAN_LINEAR @@ -524,7 +526,8 @@ affine_span(GLcontext *ctx, SWspan *span, #define SETUP_CODE \ struct affine_info info; \ struct gl_texture_unit *unit = ctx->Texture.Unit+0; \ - struct gl_texture_object *obj = unit->Current2D; \ + struct gl_texture_object *obj = \ + ctx->Texture.Unit[0].CurrentTex[TEXTURE_2D_INDEX]; \ const GLint b = obj->BaseLevel; \ const GLfloat twidth = (GLfloat) obj->Image[0][b]->Width; \ const GLfloat theight = (GLfloat) obj->Image[0][b]->Height; \ @@ -661,8 +664,8 @@ fast_persp_span(GLcontext *ctx, SWspan *span, GLfloat tex_coord[3], tex_step[3]; GLchan *dest = span->array->rgba[0]; - const GLuint savedTexEnable = ctx->Texture._EnabledUnits; - ctx->Texture._EnabledUnits = 0; + const GLuint texEnableSave = ctx->Texture._EnabledCoordUnits; + ctx->Texture._EnabledCoordUnits = 0; tex_coord[0] = span->attrStart[FRAG_ATTRIB_TEX0][0] * (info->smask + 1); tex_step[0] = span->attrStepX[FRAG_ATTRIB_TEX0][0] * (info->smask + 1); @@ -775,7 +778,7 @@ fast_persp_span(GLcontext *ctx, SWspan *span, #undef SPAN_LINEAR /* restore state */ - ctx->Texture._EnabledUnits = savedTexEnable; + ctx->Texture._EnabledCoordUnits = texEnableSave; } @@ -794,7 +797,8 @@ fast_persp_span(GLcontext *ctx, SWspan *span, #define SETUP_CODE \ struct persp_info info; \ const struct gl_texture_unit *unit = ctx->Texture.Unit+0; \ - const struct gl_texture_object *obj = unit->Current2D; \ + struct gl_texture_object *obj = \ + ctx->Texture.Unit[0].CurrentTex[TEXTURE_2D_INDEX]; \ const GLint b = obj->BaseLevel; \ info.texture = (const GLchan *) obj->Image[0][b]->Data; \ info.twidth_log2 = obj->Image[0][b]->WidthLog2; \ @@ -1018,7 +1022,7 @@ _swrast_choose_triangle( GLcontext *ctx ) ctx->Depth.Test && ctx->Depth.Mask == GL_FALSE && ctx->Depth.Func == GL_LESS && - !ctx->Stencil.Enabled) { + !ctx->Stencil._Enabled) { if ((rgbmode && ctx->Color.ColorMask[0] == 0 && ctx->Color.ColorMask[1] == 0 && @@ -1050,7 +1054,8 @@ _swrast_choose_triangle( GLcontext *ctx ) const struct gl_texture_image *texImg; GLenum minFilter, magFilter, envMode; GLint format; - texObj2D = ctx->Texture.Unit[0].Current2D; + texObj2D = ctx->Texture.Unit[0].CurrentTex[TEXTURE_2D_INDEX]; + texImg = texObj2D ? texObj2D->Image[0][texObj2D->BaseLevel] : NULL; format = texImg ? texImg->TexFormat->MesaFormat : -1; minFilter = texObj2D ? texObj2D->MinFilter : (GLenum) 0; diff --git a/src/mesa/swrast/swrast.h b/src/mesa/swrast/swrast.h index 047f7991e6..c319ca62f9 100644 --- a/src/mesa/swrast/swrast.h +++ b/src/mesa/swrast/swrast.h @@ -75,6 +75,12 @@ typedef struct { } SWvertex; +/** + * Fixed point data type. + */ +typedef int GLfixed; + + #define FRAG_ATTRIB_CI FRAG_ATTRIB_COL0 @@ -260,12 +266,6 @@ extern void _swrast_eject_texture_images(GLcontext *ctx); -#if FEATURE_MESA_program_debug -extern void -_swrast_get_program_register(GLcontext *, enum register_file file, - GLuint index, GLfloat val[4]); -#endif /* FEATURE_MESA_program_debug */ - /** * The driver interface for the software rasterizer. |