1 /**************************************************************************
3 * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas.
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the
8 * "Software"), to deal in the Software without restriction, including
9 * without limitation the rights to use, copy, modify, merge, publish,
10 * distribute, sub license, and/or sell copies of the Software, and to
11 * permit persons to whom the Software is furnished to do so, subject to
12 * the following conditions:
14 * The above copyright notice and this permission notice (including the
15 * next paragraph) shall be included in all copies or substantial portions
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
21 * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
22 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
23 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
24 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26 **************************************************************************/
29 #include "lp_context.h"
31 #include "pipe/p_shader_tokens.h"
35 struct llvmpipe_context
*lp
,
36 struct quad_stage
*quad
,
39 quad
->next
= lp
->quad
[i
].first
;
40 lp
->quad
[i
].first
= quad
;
44 lp_build_depth_stencil(
45 struct llvmpipe_context
*lp
,
48 if (lp
->depth_stencil
->stencil
[0].enabled
||
49 lp
->depth_stencil
->stencil
[1].enabled
) {
50 lp_push_quad_first( lp
, lp
->quad
[i
].stencil_test
, i
);
52 else if (lp
->depth_stencil
->depth
.enabled
&&
53 lp
->framebuffer
.zsbuf
) {
54 lp_push_quad_first( lp
, lp
->quad
[i
].depth_test
, i
);
59 lp_build_quad_pipeline(struct llvmpipe_context
*lp
)
63 boolean early_depth_test
=
64 lp
->depth_stencil
->depth
.enabled
&&
65 lp
->framebuffer
.zsbuf
&&
66 !lp
->depth_stencil
->alpha
.enabled
&&
67 !lp
->fs
->info
.uses_kill
&&
68 !lp
->fs
->info
.writes_z
;
70 /* build up the pipeline in reverse order... */
71 for (i
= 0; i
< LP_NUM_QUAD_THREADS
; i
++) {
72 lp
->quad
[i
].first
= lp
->quad
[i
].output
;
74 if (lp
->blend
->colormask
!= 0xf) {
75 lp_push_quad_first( lp
, lp
->quad
[i
].colormask
, i
);
78 if (lp
->blend
->blend_enable
||
79 lp
->blend
->logicop_enable
) {
80 lp_push_quad_first( lp
, lp
->quad
[i
].blend
, i
);
83 if (lp
->active_query_count
) {
84 lp_push_quad_first( lp
, lp
->quad
[i
].occlusion
, i
);
87 if (lp
->rasterizer
->poly_smooth
||
88 lp
->rasterizer
->line_smooth
||
89 lp
->rasterizer
->point_smooth
) {
90 lp_push_quad_first( lp
, lp
->quad
[i
].coverage
, i
);
93 if (!early_depth_test
) {
94 lp_build_depth_stencil( lp
, i
);
97 if (lp
->depth_stencil
->alpha
.enabled
) {
98 lp_push_quad_first( lp
, lp
->quad
[i
].alpha_test
, i
);
101 /* XXX always enable shader? */
103 lp_push_quad_first( lp
, lp
->quad
[i
].shade
, i
);
106 if (early_depth_test
) {
107 lp_build_depth_stencil( lp
, i
);
108 lp_push_quad_first( lp
, lp
->quad
[i
].earlyz
, i
);
111 #if !USE_DRAW_STAGE_PSTIPPLE
112 if (lp
->rasterizer
->poly_stipple_enable
) {
113 lp_push_quad_first( lp
, lp
->quad
[i
].polygon_stipple
, i
);