Lines Matching refs:ctx
55 _swrast_update_rasterflags( struct gl_context *ctx )
57 SWcontext *swrast = SWRAST_CONTEXT(ctx);
61 if (ctx->Color.AlphaEnabled) rasterMask |= ALPHATEST_BIT;
62 if (ctx->Color.BlendEnabled) rasterMask |= BLEND_BIT;
63 if (ctx->Depth.Test) rasterMask |= DEPTH_BIT;
65 if (ctx->Scissor.Enabled) rasterMask |= CLIP_BIT;
66 if (ctx->Stencil._Enabled) rasterMask |= STENCIL_BIT;
67 for (i = 0; i < ctx->Const.MaxDrawBuffers; i++) {
68 if (!ctx->Color.ColorMask[i][0] ||
69 !ctx->Color.ColorMask[i][1] ||
70 !ctx->Color.ColorMask[i][2] ||
71 !ctx->Color.ColorMask[i][3]) {
76 if (ctx->Color.ColorLogicOpEnabled) rasterMask |= LOGIC_OP_BIT;
77 if (ctx->Texture._EnabledUnits) rasterMask |= TEXTURE_BIT;
78 if ( ctx->Viewport.X < 0
79 || ctx->Viewport.X + ctx->Viewport.Width > (GLint) ctx->DrawBuffer->Width
80 || ctx->Viewport.Y < 0
81 || ctx->Viewport.Y + ctx->Viewport.Height > (GLint) ctx->DrawBuffer->Height) {
85 if (ctx->Query.CurrentOcclusionObject)
93 if (ctx->DrawBuffer->_NumColorDrawBuffers != 1) {
98 for (i = 0; i < ctx->Const.MaxDrawBuffers; i++) {
99 if (ctx->Color.ColorMask[i][0] +
100 ctx->Color.ColorMask[i][1] +
101 ctx->Color.ColorMask[i][2] +
102 ctx->Color.ColorMask[i][3] == 0) {
109 if (_swrast_use_fragment_program(ctx)) {
113 if (ctx->ATIFragmentShader._Enabled) {
118 if (ctx->Color.ClampFragmentColor == GL_TRUE) {
123 SWRAST_CONTEXT(ctx)->_RasterMask = rasterMask;
134 _swrast_update_polygon( struct gl_context *ctx )
138 if (ctx->Polygon.CullFlag) {
139 switch (ctx->Polygon.CullFaceMode) {
156 SWRAST_CONTEXT(ctx)->_BackfaceCullSign = backface_sign;
159 SWRAST_CONTEXT(ctx)->_BackfaceSign
160 = (ctx->Polygon.FrontFace == GL_CW) ? -1.0F : 1.0F;
170 _swrast_update_fog_hint( struct gl_context *ctx )
172 SWcontext *swrast = SWRAST_CONTEXT(ctx);
174 _swrast_use_fragment_program(ctx) ||
175 (ctx->Hint.Fog == GL_NICEST &&
185 _swrast_update_texture_env( struct gl_context *ctx )
187 SWcontext *swrast = SWRAST_CONTEXT(ctx);
192 for (i = 0; i < ctx->Const.MaxTextureUnits; i++) {
194 ctx->Texture.Unit[i]._CurrentCombine;
216 _swrast_update_deferred_texture(struct gl_context *ctx)
218 SWcontext *swrast = SWRAST_CONTEXT(ctx);
219 if (ctx->Color.AlphaEnabled) {
224 GLboolean use_fprog = _swrast_use_fragment_program(ctx);
226 = ctx->FragmentProgram._Current;
234 else if (ctx->Query.CurrentOcclusionObject) {
249 _swrast_update_fog_state( struct gl_context *ctx )
251 SWcontext *swrast = SWRAST_CONTEXT(ctx);
252 const struct gl_fragment_program *fp = ctx->FragmentProgram._Current;
259 swrast->_FogEnabled = (!_swrast_use_fragment_program(ctx) &&
260 ctx->Fog.Enabled);
269 _swrast_update_fragment_program(struct gl_context *ctx, GLbitfield newState)
271 if (!_swrast_use_fragment_program(ctx))
274 _mesa_load_state_parameters(ctx,
275 ctx->FragmentProgram._Current->Base.Parameters);
284 _swrast_update_specular_vertex_add(struct gl_context *ctx)
286 SWcontext *swrast = SWRAST_CONTEXT(ctx);
287 GLboolean separateSpecular = ctx->Fog.ColorSumEnabled ||
288 (ctx->Light.Enabled &&
289 ctx->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR);
292 && ctx->Texture._EnabledUnits == 0x0
293 && !_swrast_use_fragment_program(ctx)
294 && !ctx->ATIFragmentShader._Enabled);
348 _swrast_validate_triangle( struct gl_context *ctx,
353 SWcontext *swrast = SWRAST_CONTEXT(ctx);
355 _swrast_validate_derived( ctx );
356 swrast->choose_triangle( ctx );
365 swrast->Triangle( ctx, v0, v1, v2 );
373 _swrast_validate_line( struct gl_context *ctx, const SWvertex *v0, const SWvertex *v1 )
375 SWcontext *swrast = SWRAST_CONTEXT(ctx);
377 _swrast_validate_derived( ctx );
378 swrast->choose_line( ctx );
386 swrast->Line( ctx, v0, v1 );
394 _swrast_validate_point( struct gl_context *ctx, const SWvertex *v0 )
396 SWcontext *swrast = SWRAST_CONTEXT(ctx);
398 _swrast_validate_derived( ctx );
399 swrast->choose_point( ctx );
406 swrast->Point( ctx, v0 );
415 _swrast_validate_blend_func(struct gl_context *ctx, GLuint n, const GLubyte mask[],
419 SWcontext *swrast = SWRAST_CONTEXT(ctx);
421 _swrast_validate_derived( ctx ); /* why is this needed? */
422 _swrast_choose_blend_func( ctx, chanType );
424 swrast->BlendFunc( ctx, n, mask, src, dst, chanType );
428 _swrast_sleep( struct gl_context *ctx, GLbitfield new_state )
430 (void) ctx; (void) new_state;
435 _swrast_invalidate_state( struct gl_context *ctx, GLbitfield new_state )
437 SWcontext *swrast = SWRAST_CONTEXT(ctx);
464 for (i = 0 ; i < ctx->Const.MaxTextureImageUnits ; i++)
470 _swrast_update_texture_samplers(struct gl_context *ctx)
472 SWcontext *swrast = SWRAST_CONTEXT(ctx);
478 for (u = 0; u < ctx->Const.MaxTextureImageUnits; u++) {
479 struct gl_texture_object *tObj = ctx->Texture.Unit[u]._Current;
483 _mesa_update_fetch_functions(ctx, u);
485 _swrast_choose_texture_sample_func(ctx, tObj,
486 _mesa_get_samplerobj(ctx, u));
496 _swrast_update_active_attribs(struct gl_context *ctx)
498 SWcontext *swrast = SWRAST_CONTEXT(ctx);
504 if (_swrast_use_fragment_program(ctx)) {
506 attribsMask = ctx->FragmentProgram._Current->Base.InputsRead;
509 else if (ctx->ATIFragmentShader._Enabled) {
520 if (ctx->Fog.ColorSumEnabled ||
521 (ctx->Light.Enabled &&
522 ctx->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR)) {
529 attribsMask |= (ctx->Texture._EnabledUnits << FRAG_ATTRIB_TEX0);
542 swrast->_InterpMode[i] = ctx->Light.ShadeModel;
553 _swrast_validate_derived( struct gl_context *ctx )
555 SWcontext *swrast = SWRAST_CONTEXT(ctx);
559 _swrast_update_polygon( ctx );
562 _swrast_update_fog_hint( ctx );
565 _swrast_update_texture_env( ctx );
568 _swrast_update_fog_state( ctx );
571 _swrast_update_fragment_program( ctx, swrast->NewState );
574 _swrast_update_texture_samplers( ctx );
578 _swrast_update_deferred_texture(ctx);
581 _swrast_update_rasterflags( ctx );
588 _swrast_update_active_attribs(ctx);
594 _swrast_update_specular_vertex_add(ctx);
607 _swrast_Quad( struct gl_context *ctx,
612 _mesa_debug(ctx, "_swrast_Quad\n");
613 _swrast_print_vertex( ctx, v0 );
614 _swrast_print_vertex( ctx, v1 );
615 _swrast_print_vertex( ctx, v2 );
616 _swrast_print_vertex( ctx, v3 );
618 SWRAST_CONTEXT(ctx)->Triangle( ctx, v0, v1, v3 );
619 SWRAST_CONTEXT(ctx)->Triangle( ctx, v1, v2, v3 );
623 _swrast_Triangle( struct gl_context *ctx, const SWvertex *v0,
627 _mesa_debug(ctx, "_swrast_Triangle\n");
628 _swrast_print_vertex( ctx, v0 );
629 _swrast_print_vertex( ctx, v1 );
630 _swrast_print_vertex( ctx, v2 );
632 SWRAST_CONTEXT(ctx)->Triangle( ctx, v0, v1, v2 );
636 _swrast_Line( struct gl_context *ctx, const SWvertex *v0, const SWvertex *v1 )
639 _mesa_debug(ctx, "_swrast_Line\n");
640 _swrast_print_vertex( ctx, v0 );
641 _swrast_print_vertex( ctx, v1 );
643 SWRAST_CONTEXT(ctx)->Line( ctx, v0, v1 );
647 _swrast_Point( struct gl_context *ctx, const SWvertex *v0 )
650 _mesa_debug(ctx, "_swrast_Point\n");
651 _swrast_print_vertex( ctx, v0 );
653 SWRAST_CONTEXT(ctx)->Point( ctx, v0 );
657 _swrast_InvalidateState( struct gl_context *ctx, GLbitfield new_state )
660 _mesa_debug(ctx, "_swrast_InvalidateState\n");
662 SWRAST_CONTEXT(ctx)->InvalidateState( ctx, new_state );
666 _swrast_ResetLineStipple( struct gl_context *ctx )
669 _mesa_debug(ctx, "_swrast_ResetLineStipple\n");
671 SWRAST_CONTEXT(ctx)->StippleCounter = 0;
675 _swrast_SetFacing(struct gl_context *ctx, GLuint facing)
677 SWRAST_CONTEXT(ctx)->PointLineFacing = facing;
681 _swrast_allow_vertex_fog( struct gl_context *ctx, GLboolean value )
684 _mesa_debug(ctx, "_swrast_allow_vertex_fog %d\n", value);
686 SWRAST_CONTEXT(ctx)->InvalidateState( ctx, _NEW_HINT );
687 SWRAST_CONTEXT(ctx)->AllowVertexFog = value;
691 _swrast_allow_pixel_fog( struct gl_context *ctx, GLboolean value )
694 _mesa_debug(ctx, "_swrast_allow_pixel_fog %d\n", value);
696 SWRAST_CONTEXT(ctx)->InvalidateState( ctx, _NEW_HINT );
697 SWRAST_CONTEXT(ctx)->AllowPixelFog = value;
720 _swrast_CreateContext( struct gl_context *ctx )
730 assert(ctx->Const.MaxViewportWidth <= SWRAST_MAX_WIDTH);
731 assert(ctx->Const.MaxViewportHeight <= SWRAST_MAX_WIDTH);
733 assert(ctx->Const.MaxRenderbufferSize <= SWRAST_MAX_WIDTH);
736 assert((1 << (ctx->Const.MaxTextureLevels - 1)) <= SWRAST_MAX_WIDTH);
737 assert((1 << (ctx->Const.MaxCubeTextureLevels - 1)) <= SWRAST_MAX_WIDTH);
738 assert((1 << (ctx->Const.Max3DTextureLevels - 1)) <= SWRAST_MAX_WIDTH);
743 _mesa_debug(ctx, "_swrast_CreateContext\n");
800 init_program_native_limits(&ctx->Const.VertexProgram);
801 init_program_native_limits(&ctx->Const.GeometryProgram);
802 init_program_native_limits(&ctx->Const.FragmentProgram);
804 ctx->swrast_context = swrast;
815 _swrast_DestroyContext(ctx);
823 _swrast_DestroyContext( struct gl_context *ctx )
825 SWcontext *swrast = SWRAST_CONTEXT(ctx);
828 _mesa_debug(ctx, "_swrast_DestroyContext\n");
843 ctx->swrast_context = 0;
848 _swrast_GetDeviceDriverReference( struct gl_context *ctx )
850 SWcontext *swrast = SWRAST_CONTEXT(ctx);
855 _swrast_flush( struct gl_context *ctx )
857 SWcontext *swrast = SWRAST_CONTEXT(ctx);
860 _swrast_write_rgba_span(ctx, &(swrast->PointSpan));
866 _swrast_render_primitive( struct gl_context *ctx, GLenum prim )
868 SWcontext *swrast = SWRAST_CONTEXT(ctx);
870 _swrast_flush(ctx);
878 _swrast_span_render_start(struct gl_context *ctx)
880 _swrast_map_textures(ctx);
881 _swrast_map_renderbuffers(ctx);
887 _swrast_span_render_finish(struct gl_context *ctx)
889 _swrast_unmap_textures(ctx);
890 _swrast_unmap_renderbuffers(ctx);
895 _swrast_render_start( struct gl_context *ctx )
897 SWcontext *swrast = SWRAST_CONTEXT(ctx);
899 swrast->Driver.SpanRenderStart( ctx );
904 _swrast_render_finish( struct gl_context *ctx )
906 SWcontext *swrast = SWRAST_CONTEXT(ctx);
908 _swrast_flush(ctx);
911 swrast->Driver.SpanRenderFinish( ctx );
918 _swrast_print_vertex( struct gl_context *ctx, const SWvertex *v )
923 _mesa_debug(ctx, "win %f %f %f %f\n",
929 for (i = 0 ; i < ctx->Const.MaxTextureCoordUnits ; i++)
930 if (ctx->Texture.Unit[i]._ReallyEnabled)
931 _mesa_debug(ctx, "texcoord[%d] %f %f %f %f\n", i,
938 _mesa_debug(ctx, "color %f %f %f %f\n",
941 _mesa_debug(ctx, "color %d %d %d %d\n",
944 _mesa_debug(ctx, "spec %g %g %g %g\n",
949 _mesa_debug(ctx, "fog %f\n", v->attrib[FRAG_ATTRIB_FOGC][0]);
950 _mesa_debug(ctx, "index %f\n", v->attrib[FRAG_ATTRIB_CI][0]);
951 _mesa_debug(ctx, "pointsize %f\n", v->pointSize);
952 _mesa_debug(ctx, "\n");