Path: blob/21.2-virgl/src/gallium/drivers/softpipe/sp_quad.h
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**************************************************************************/2627/* Authors: Keith Whitwell <[email protected]>28*/2930#ifndef SP_QUAD_H31#define SP_QUAD_H3233#include "pipe/p_state.h"34#include "tgsi/tgsi_exec.h"353637#define QUAD_PRIM_POINT 138#define QUAD_PRIM_LINE 239#define QUAD_PRIM_TRI 3404142/* The rasterizer generates 2x2 quads of fragment and feeds them to43* the current fp_machine (see below).44* Remember that Y=0=top with Y increasing down the window.45*/46#define QUAD_TOP_LEFT 047#define QUAD_TOP_RIGHT 148#define QUAD_BOTTOM_LEFT 249#define QUAD_BOTTOM_RIGHT 35051#define MASK_TOP_LEFT (1 << QUAD_TOP_LEFT)52#define MASK_TOP_RIGHT (1 << QUAD_TOP_RIGHT)53#define MASK_BOTTOM_LEFT (1 << QUAD_BOTTOM_LEFT)54#define MASK_BOTTOM_RIGHT (1 << QUAD_BOTTOM_RIGHT)55#define MASK_ALL 0xf565758/**59* Quad stage inputs (pos, coverage, front/back face, etc)60*/61struct quad_header_input62{63int x0, y0; /**< quad window pos, always even */64unsigned layer;65unsigned viewport_index;66float coverage[TGSI_QUAD_SIZE]; /**< fragment coverage for antialiasing */67unsigned facing:1; /**< Front (0) or back (1) facing? */68unsigned prim:2; /**< QUAD_PRIM_POINT, LINE, TRI */69};707172/**73* Quad stage inputs/outputs.74*/75struct quad_header_inout76{77unsigned mask:4;78};798081/**82* Quad stage outputs (color & depth).83*/84struct quad_header_output85{86/** colors in SOA format (rrrr, gggg, bbbb, aaaa) */87float color[PIPE_MAX_COLOR_BUFS][TGSI_NUM_CHANNELS][TGSI_QUAD_SIZE];88float depth[TGSI_QUAD_SIZE];89uint8_t stencil[TGSI_QUAD_SIZE];90};919293/**94* Encodes everything we need to know about a 2x2 pixel block. Uses95* "Channel-Serial" or "SoA" layout.96*/97struct quad_header {98struct quad_header_input input;99struct quad_header_inout inout;100struct quad_header_output output;101102/* Redundant/duplicated:103*/104const struct tgsi_interp_coef *posCoef;105const struct tgsi_interp_coef *coef;106};107108#endif /* SP_QUAD_H */109110111