Go to the source code of this file.
Functions | |
static void | stipple_quad (struct quad_stage *qs, struct quad_header *quad) |
quad polygon stipple stage | |
static void | stipple_begin (struct quad_stage *qs) |
static void | stipple_destroy (struct quad_stage *qs) |
struct quad_stage * | sp_quad_polygon_stipple_stage (struct softpipe_context *softpipe) |
struct quad_stage* sp_quad_polygon_stipple_stage | ( | struct softpipe_context * | softpipe | ) | [read] |
Definition at line 83 of file sp_quad_stipple.c.
References quad_stage::begin, CALLOC_STRUCT, quad_stage::destroy, quad_stage::run, quad_stage::softpipe, stipple_begin(), stipple_destroy(), and stipple_quad().
00085 { 00086 struct quad_stage *stage = CALLOC_STRUCT(quad_stage); 00087 00088 stage->softpipe = softpipe; 00089 stage->begin = stipple_begin; 00090 stage->run = stipple_quad; 00091 stage->destroy = stipple_destroy; 00092 00093 return stage;
static void stipple_begin | ( | struct quad_stage * | qs | ) | [static] |
Definition at line 70 of file sp_quad_stipple.c.
References quad_stage::begin, and quad_stage::next.
static void stipple_destroy | ( | struct quad_stage * | qs | ) | [static] |
static void stipple_quad | ( | struct quad_stage * | qs, | |
struct quad_header * | quad | |||
) | [static] |
quad polygon stipple stage
Apply polygon stipple to quads produced by triangle rasterization
Definition at line 17 of file sp_quad_stipple.c.
References softpipe_context::framebuffer, pipe_framebuffer_state::height, quad_header::inout, quad_header::input, quad_header_inout::mask, MASK_BOTTOM_LEFT, MASK_BOTTOM_RIGHT, MASK_TOP_LEFT, MASK_TOP_RIGHT, quad_stage::next, pipe_rasterizer_state::origin_lower_left, softpipe_context::poly_stipple, quad_header_input::prim, PRIM_TRI, softpipe_context::rasterizer, quad_stage::run, quad_stage::softpipe, pipe_poly_stipple::stipple, quad_header_input::x0, and quad_header_input::y0.
00018 { 00019 static const uint bit31 = 1 << 31; 00020 static const uint bit30 = 1 << 30; 00021 00022 if (quad->input.prim == PRIM_TRI) { 00023 struct softpipe_context *softpipe = qs->softpipe; 00024 /* need to invert Y to index into OpenGL's stipple pattern */ 00025 int y0, y1; 00026 uint stipple0, stipple1; 00027 if (softpipe->rasterizer->origin_lower_left) { 00028 y0 = softpipe->framebuffer.height - 1 - quad->input.y0; 00029 y1 = y0 - 1; 00030 } 00031 else { 00032 y0 = quad->input.y0; 00033 y1 = y0 + 1; 00034 } 00035 stipple0 = softpipe->poly_stipple.stipple[y0 % 32]; 00036 stipple1 = softpipe->poly_stipple.stipple[y1 % 32]; 00037 00038 #if 1 00039 { 00040 const int col0 = quad->input.x0 % 32; 00041 if ((stipple0 & (bit31 >> col0)) == 0) 00042 quad->inout.mask &= ~MASK_TOP_LEFT; 00043 00044 if ((stipple0 & (bit30 >> col0)) == 0) 00045 quad->inout.mask &= ~MASK_TOP_RIGHT; 00046 00047 if ((stipple1 & (bit31 >> col0)) == 0) 00048 quad->inout.mask &= ~MASK_BOTTOM_LEFT; 00049 00050 if ((stipple1 & (bit30 >> col0)) == 0) 00051 quad->inout.mask &= ~MASK_BOTTOM_RIGHT; 00052 } 00053 #else 00054 /* We'd like to use this code, but we'd need to redefine 00055 * MASK_TOP_LEFT to be (1 << 1) and MASK_TOP_RIGHT to be (1 << 0), 00056 * and similarly for the BOTTOM bits. But that may have undesirable 00057 * side effects elsewhere. 00058 */ 00059 const int col0 = 30 - (quad->input.x0 % 32); 00060 quad->inout.mask &= (((stipple0 >> col0) & 0x3) | 00061 (((stipple1 >> col0) & 0x3) << 2)); 00062 #endif 00063 if (!quad->inout.mask) 00064 return; 00065 } 00066 00067 qs->next->run(qs->next, quad);