Path: blob/21.2-virgl/src/gallium/drivers/softpipe/sp_quad_pipe.c
4570 views
/**************************************************************************1*2* Copyright 2007 VMware, Inc.3* All Rights Reserved.4*5* Permission is hereby granted, free of charge, to any person obtaining a6* copy of this software and associated documentation files (the7* "Software"), to deal in the Software without restriction, including8* without limitation the rights to use, copy, modify, merge, publish,9* distribute, sub license, and/or sell copies of the Software, and to10* permit persons to whom the Software is furnished to do so, subject to11* the following conditions:12*13* The above copyright notice and this permission notice (including the14* next paragraph) shall be included in all copies or substantial portions15* of the Software.16*17* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS18* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF19* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.20* IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR21* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,22* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE23* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.24*25**************************************************************************/262728#include "sp_context.h"29#include "sp_state.h"30#include "pipe/p_shader_tokens.h"313233static void34insert_stage_at_head(struct softpipe_context *sp, struct quad_stage *quad)35{36quad->next = sp->quad.first;37sp->quad.first = quad;38}394041void42sp_build_quad_pipeline(struct softpipe_context *sp)43{44boolean early_depth_test =45(sp->depth_stencil->depth_enabled &&46sp->framebuffer.zsbuf &&47!sp->depth_stencil->alpha_enabled &&48!sp->fs_variant->info.uses_kill &&49!sp->fs_variant->info.writes_z &&50!sp->fs_variant->info.writes_stencil) ||51sp->fs_variant->info.properties[TGSI_PROPERTY_FS_EARLY_DEPTH_STENCIL];5253sp->quad.first = sp->quad.blend;5455sp->early_depth = early_depth_test;56if (early_depth_test) {57insert_stage_at_head( sp, sp->quad.shade );58insert_stage_at_head( sp, sp->quad.depth_test );59}60else {61insert_stage_at_head( sp, sp->quad.depth_test );62insert_stage_at_head( sp, sp->quad.shade );63}6465#if !DO_PSTIPPLE_IN_DRAW_MODULE && !DO_PSTIPPLE_IN_HELPER_MODULE66if (sp->rasterizer->poly_stipple_enable)67insert_stage_at_head( sp, sp->quad.pstipple );68#endif69}70717273