17abc78a9678cf09e7a39869549ed369802c43d58Brian/************************************************************************** 27abc78a9678cf09e7a39869549ed369802c43d58Brian * 37abc78a9678cf09e7a39869549ed369802c43d58Brian * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas. 47abc78a9678cf09e7a39869549ed369802c43d58Brian * All Rights Reserved. 57abc78a9678cf09e7a39869549ed369802c43d58Brian * 67abc78a9678cf09e7a39869549ed369802c43d58Brian * Permission is hereby granted, free of charge, to any person obtaining a 77abc78a9678cf09e7a39869549ed369802c43d58Brian * copy of this software and associated documentation files (the 87abc78a9678cf09e7a39869549ed369802c43d58Brian * "Software"), to deal in the Software without restriction, including 97abc78a9678cf09e7a39869549ed369802c43d58Brian * without limitation the rights to use, copy, modify, merge, publish, 107abc78a9678cf09e7a39869549ed369802c43d58Brian * distribute, sub license, and/or sell copies of the Software, and to 117abc78a9678cf09e7a39869549ed369802c43d58Brian * permit persons to whom the Software is furnished to do so, subject to 127abc78a9678cf09e7a39869549ed369802c43d58Brian * the following conditions: 137abc78a9678cf09e7a39869549ed369802c43d58Brian * 147abc78a9678cf09e7a39869549ed369802c43d58Brian * The above copyright notice and this permission notice (including the 157abc78a9678cf09e7a39869549ed369802c43d58Brian * next paragraph) shall be included in all copies or substantial portions 167abc78a9678cf09e7a39869549ed369802c43d58Brian * of the Software. 177abc78a9678cf09e7a39869549ed369802c43d58Brian * 187abc78a9678cf09e7a39869549ed369802c43d58Brian * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 197abc78a9678cf09e7a39869549ed369802c43d58Brian * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 207abc78a9678cf09e7a39869549ed369802c43d58Brian * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. 217abc78a9678cf09e7a39869549ed369802c43d58Brian * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR 227abc78a9678cf09e7a39869549ed369802c43d58Brian * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 237abc78a9678cf09e7a39869549ed369802c43d58Brian * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 247abc78a9678cf09e7a39869549ed369802c43d58Brian * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 257abc78a9678cf09e7a39869549ed369802c43d58Brian * 267abc78a9678cf09e7a39869549ed369802c43d58Brian **************************************************************************/ 27fb5cdbd078d4d44fb43d417843debe41148f3714Brian 28fb5cdbd078d4d44fb43d417843debe41148f3714Brian 29fb5cdbd078d4d44fb43d417843debe41148f3714Brian#include "sp_context.h" 307f718f047676e88b660618784f256a96f7e8ed58Michal Krol#include "sp_state.h" 31abd5e8e41d54f7f491f91af9354f19c8d24d3572Michal Krol#include "pipe/p_shader_tokens.h" 32fb5cdbd078d4d44fb43d417843debe41148f3714Brian 33f16d97feaa394826456e27250d5dfdb24df5cd57Brian Paul 347f718f047676e88b660618784f256a96f7e8ed58Michal Krolstatic void 35f16d97feaa394826456e27250d5dfdb24df5cd57Brian Paulinsert_stage_at_head(struct softpipe_context *sp, struct quad_stage *quad) 367f718f047676e88b660618784f256a96f7e8ed58Michal Krol{ 376153a1c28f118be1a74ffee0e19c16fb83b5cab7Keith Whitwell quad->next = sp->quad.first; 386153a1c28f118be1a74ffee0e19c16fb83b5cab7Keith Whitwell sp->quad.first = quad; 397f718f047676e88b660618784f256a96f7e8ed58Michal Krol} 407f718f047676e88b660618784f256a96f7e8ed58Michal Krol 41fb5cdbd078d4d44fb43d417843debe41148f3714Brian 42fb5cdbd078d4d44fb43d417843debe41148f3714Brianvoid 43fb5cdbd078d4d44fb43d417843debe41148f3714Briansp_build_quad_pipeline(struct softpipe_context *sp) 44fb5cdbd078d4d44fb43d417843debe41148f3714Brian{ 45012391357fcbefd2b34e999eed91a129d5efd77cBrian boolean early_depth_test = 46ab9fb5167023a26566b53e98f206dd73a18000f3Keith Whitwell sp->depth_stencil->depth.enabled && 47ab9fb5167023a26566b53e98f206dd73a18000f3Keith Whitwell sp->framebuffer.zsbuf && 48ab9fb5167023a26566b53e98f206dd73a18000f3Keith Whitwell !sp->depth_stencil->alpha.enabled && 49c534f11164bbecf25eb2b1e697f9511eceb0c86fBrian Paul !sp->fs_variant->info.uses_kill && 50c534f11164bbecf25eb2b1e697f9511eceb0c86fBrian Paul !sp->fs_variant->info.writes_z && 51c534f11164bbecf25eb2b1e697f9511eceb0c86fBrian Paul !sp->fs_variant->info.writes_stencil; 527f718f047676e88b660618784f256a96f7e8ed58Michal Krol 53a2f7ab1d155da52c689f7c6390c233e4eae44643Keith Whitwell sp->quad.first = sp->quad.blend; 54ab9fb5167023a26566b53e98f206dd73a18000f3Keith Whitwell 55ab9fb5167023a26566b53e98f206dd73a18000f3Keith Whitwell if (early_depth_test) { 56f16d97feaa394826456e27250d5dfdb24df5cd57Brian Paul insert_stage_at_head( sp, sp->quad.shade ); 57f16d97feaa394826456e27250d5dfdb24df5cd57Brian Paul insert_stage_at_head( sp, sp->quad.depth_test ); 58bac8e34c9e4077d370923773d67fe565ce154849Keith Whitwell } 59bac8e34c9e4077d370923773d67fe565ce154849Keith Whitwell else { 60f16d97feaa394826456e27250d5dfdb24df5cd57Brian Paul insert_stage_at_head( sp, sp->quad.depth_test ); 61f16d97feaa394826456e27250d5dfdb24df5cd57Brian Paul insert_stage_at_head( sp, sp->quad.shade ); 62ab9fb5167023a26566b53e98f206dd73a18000f3Keith Whitwell } 6344519e18a410016fde7ad8a66cd042bbc90c8940Brian Paul 6457aa597b3d5dac0fc59c05557dafec59e14e1019Brian Paul#if !DO_PSTIPPLE_IN_DRAW_MODULE && !DO_PSTIPPLE_IN_HELPER_MODULE 6544519e18a410016fde7ad8a66cd042bbc90c8940Brian Paul if (sp->rasterizer->poly_stipple_enable) 66f16d97feaa394826456e27250d5dfdb24df5cd57Brian Paul insert_stage_at_head( sp, sp->quad.pstipple ); 6744519e18a410016fde7ad8a66cd042bbc90c8940Brian Paul#endif 68fb5cdbd078d4d44fb43d417843debe41148f3714Brian} 69ebe6160d7c9ccbddd8b1cc4b0e25b3d61c54293dMichal Krol 70