00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #include "sp_context.h"
00030 #include "sp_state.h"
00031 #include "pipe/p_shader_tokens.h"
00032
00033 static void
00034 sp_push_quad_first(
00035 struct softpipe_context *sp,
00036 struct quad_stage *quad,
00037 uint i )
00038 {
00039 quad->next = sp->quad[i].first;
00040 sp->quad[i].first = quad;
00041 }
00042
00043 static void
00044 sp_build_depth_stencil(
00045 struct softpipe_context *sp,
00046 uint i )
00047 {
00048 if (sp->depth_stencil->stencil[0].enabled ||
00049 sp->depth_stencil->stencil[1].enabled) {
00050 sp_push_quad_first( sp, sp->quad[i].stencil_test, i );
00051 }
00052 else if (sp->depth_stencil->depth.enabled &&
00053 sp->framebuffer.zsbuf) {
00054 sp_push_quad_first( sp, sp->quad[i].depth_test, i );
00055 }
00056 }
00057
00058 void
00059 sp_build_quad_pipeline(struct softpipe_context *sp)
00060 {
00061 uint i;
00062
00063 boolean early_depth_test =
00064 sp->depth_stencil->depth.enabled &&
00065 sp->framebuffer.zsbuf &&
00066 !sp->depth_stencil->alpha.enabled &&
00067 !sp->fs->info.uses_kill &&
00068 !sp->fs->info.writes_z;
00069
00070
00071 for (i = 0; i < SP_NUM_QUAD_THREADS; i++) {
00072 sp->quad[i].first = sp->quad[i].output;
00073
00074 if (sp->blend->colormask != 0xf) {
00075 sp_push_quad_first( sp, sp->quad[i].colormask, i );
00076 }
00077
00078 if (sp->blend->blend_enable ||
00079 sp->blend->logicop_enable) {
00080 sp_push_quad_first( sp, sp->quad[i].blend, i );
00081 }
00082
00083 if (sp->depth_stencil->depth.occlusion_count) {
00084 sp_push_quad_first( sp, sp->quad[i].occlusion, i );
00085 }
00086
00087 if (sp->rasterizer->poly_smooth ||
00088 sp->rasterizer->line_smooth ||
00089 sp->rasterizer->point_smooth) {
00090 sp_push_quad_first( sp, sp->quad[i].coverage, i );
00091 }
00092
00093 if (!early_depth_test) {
00094 sp_build_depth_stencil( sp, i );
00095 }
00096
00097 if (sp->depth_stencil->alpha.enabled) {
00098 sp_push_quad_first( sp, sp->quad[i].alpha_test, i );
00099 }
00100
00101
00102 if (1) {
00103 sp_push_quad_first( sp, sp->quad[i].shade, i );
00104 }
00105
00106 if (early_depth_test) {
00107 sp_build_depth_stencil( sp, i );
00108 sp_push_quad_first( sp, sp->quad[i].earlyz, i );
00109 }
00110
00111 #if !USE_DRAW_STAGE_PSTIPPLE
00112 if (sp->rasterizer->poly_stipple_enable) {
00113 sp_push_quad_first( sp, sp->quad[i].polygon_stipple, i );
00114 }
00115 #endif
00116 }
00117 }
00118