1f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org/**************************************************************************
2f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org *
3f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * Copyright 2009 VMware, Inc.
4f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * All Rights Reserved.
5f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org *
6f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * Permission is hereby granted, free of charge, to any person obtaining a
7f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * copy of this software and associated documentation files (the
8f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * "Software"), to deal in the Software without restriction, including
9f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * without limitation the rights to use, copy, modify, merge, publish,
10f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * distribute, sub license, and/or sell copies of the Software, and to
11f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * permit persons to whom the Software is furnished to do so, subject to
12f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * the following conditions:
13f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org *
14f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * The above copyright notice and this permission notice (including the
15f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * next paragraph) shall be included in all copies or substantial portions
16f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * of the Software.
17f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org *
18f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
21f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
22f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
23f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
24f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org *
26f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org **************************************************************************/
27f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
28f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org/**
29f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * The rast code is concerned with rasterization of command bins.
30f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * Each screen tile has a bin associated with it.  To render the
31f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * scene we iterate over the tile bins and execute the commands
32f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * in each bin.
33f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * We'll do that with multiple threads...
34f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org */
35f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
36f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
37f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#ifndef LP_RAST_H
38f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#define LP_RAST_H
39f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
40f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#include "pipe/p_compiler.h"
41f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#include "lp_jit.h"
42f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
43f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
44f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstruct lp_rasterizer;
45f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstruct lp_scene;
46f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstruct lp_fence;
47f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstruct cmd_bin;
48f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
49f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org/** For sub-pixel positioning */
50f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#define FIXED_ORDER 4
51f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#define FIXED_ONE (1<<FIXED_ORDER)
52f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
53f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
54f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstruct lp_rasterizer_task;
55f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
56f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
57f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org/**
58f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * Rasterization state.
59f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * Objects of this type are put into the shared data bin and pointed
60f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * to by commands in the per-tile bins.
61f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org */
62f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstruct lp_rast_state {
63f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   /* State for the shader.  This also contains state which feeds into
64f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    * the fragment shader, such as blend color and alpha ref value.
65f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    */
66f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   struct lp_jit_context jit_context;
67f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
68f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   /* The shader itself.  Probably we also need to pass a pointer to
69f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org    * the tile color/z/stencil data somehow
70f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org     */
71f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   struct lp_fragment_shader_variant *variant;
72f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org};
73f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
74f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
75f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org/**
76f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * Coefficients necessary to run the shader at a given location.
77f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * First coefficient is position.
78f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * These pointers point into the bin data buffer.
79f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org */
80f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstruct lp_rast_shader_inputs {
81f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   unsigned frontfacing:1;      /** True for front-facing */
82f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   unsigned disable:1;          /** Partially binned, disable this command */
83f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   unsigned opaque:1;           /** Is opaque */
84f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   unsigned pad0:29;            /* wasted space */
85f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   unsigned stride;             /* how much to advance data between a0, dadx, dady */
86f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   unsigned pad2;               /* wasted space */
87f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   unsigned pad3;               /* wasted space */
88f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   /* followed by a0, dadx, dady and planes[] */
89f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org};
90f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
91f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org/* Note: the order of these values is important as they are loaded by
92f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * sse code in rasterization:
93f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org */
94f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstruct lp_rast_plane {
95f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   /* edge function values at minx,miny ?? */
96f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   int c;
97f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
98f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   int dcdx;
99f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   int dcdy;
100f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
101f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   /* one-pixel sized trivial reject offsets for each plane */
102f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   int eo;
103f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org};
104f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
105f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org/**
106f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * Rasterization information for a triangle known to be in this bin,
107f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * plus inputs to run the shader:
108f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * These fields are tile- and bin-independent.
109f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * Objects of this type are put into the lp_setup_context::data buffer.
110f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org */
111f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstruct lp_rast_triangle {
112f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#ifdef DEBUG
113f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   float v[3][2];
114f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   float pad0;
115f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   float pad1;
116f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#endif
117f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
118f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   /* inputs for the shader */
119f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   struct lp_rast_shader_inputs inputs;
120f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   /* planes are also allocated here */
121f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org};
122f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
123f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
124f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#define GET_A0(inputs) ((float (*)[4])((inputs)+1))
125f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#define GET_DADX(inputs) ((float (*)[4])((char *)((inputs) + 1) + (inputs)->stride))
126f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#define GET_DADY(inputs) ((float (*)[4])((char *)((inputs) + 1) + 2 * (inputs)->stride))
127f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#define GET_PLANES(tri) ((struct lp_rast_plane *)((char *)(&(tri)->inputs + 1) + 3 * (tri)->inputs.stride))
128f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
129f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
130f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
131f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstruct lp_rasterizer *
132f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orglp_rast_create( unsigned num_threads );
133f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
134f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgvoid
135f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orglp_rast_destroy( struct lp_rasterizer * );
136f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
137f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgunsigned
138f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orglp_rast_get_num_threads( struct lp_rasterizer * );
139f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
140f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgvoid
141f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orglp_rast_queue_scene( struct lp_rasterizer *rast,
142f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                     struct lp_scene *scene );
143f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
144f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgvoid
145f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orglp_rast_finish( struct lp_rasterizer *rast );
146f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
147f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
148f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgunion lp_rast_cmd_arg {
149f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   const struct lp_rast_shader_inputs *shade_tile;
150f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   struct {
151f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org      const struct lp_rast_triangle *tri;
152f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org      unsigned plane_mask;
153f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   } triangle;
154f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   const struct lp_rast_state *set_state;
155f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   uint8_t clear_color[4];
156f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   struct {
157f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org      uint32_t value;
158f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org      uint32_t mask;
159f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   } clear_zstencil;
160f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   const struct lp_rast_state *state;
161f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   struct lp_fence *fence;
162f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   struct llvmpipe_query *query_obj;
163f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org};
164f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
165f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
166f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org/* Cast wrappers.  Hopefully these compile to noops!
167f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org */
168f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstatic INLINE union lp_rast_cmd_arg
169f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orglp_rast_arg_inputs( const struct lp_rast_shader_inputs *shade_tile )
170f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org{
171f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   union lp_rast_cmd_arg arg;
172f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   arg.shade_tile = shade_tile;
173f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   return arg;
174f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org}
175f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
176f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstatic INLINE union lp_rast_cmd_arg
177f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orglp_rast_arg_triangle( const struct lp_rast_triangle *triangle,
178f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                      unsigned plane_mask)
179f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org{
180f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   union lp_rast_cmd_arg arg;
181f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   arg.triangle.tri = triangle;
182f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   arg.triangle.plane_mask = plane_mask;
183f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   return arg;
184f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org}
185f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
186f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org/**
187f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * Build argument for a contained triangle.
188f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org *
189f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * All planes are enabled, so instead of the plane mask we pass the upper
190f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * left coordinates of the a block that fully encloses the triangle.
191f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org */
192f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstatic INLINE union lp_rast_cmd_arg
193f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orglp_rast_arg_triangle_contained( const struct lp_rast_triangle *triangle,
194f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org                                unsigned x, unsigned y)
195f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org{
196f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   union lp_rast_cmd_arg arg;
197f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   arg.triangle.tri = triangle;
198f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   arg.triangle.plane_mask = x | (y << 8);
199f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   return arg;
200f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org}
201f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
202f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstatic INLINE union lp_rast_cmd_arg
203f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orglp_rast_arg_state( const struct lp_rast_state *state )
204f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org{
205f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   union lp_rast_cmd_arg arg;
206f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   arg.set_state = state;
207f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   return arg;
208f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org}
209f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
210f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstatic INLINE union lp_rast_cmd_arg
211f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orglp_rast_arg_fence( struct lp_fence *fence )
212f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org{
213f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   union lp_rast_cmd_arg arg;
214f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   arg.fence = fence;
215f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   return arg;
216f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org}
217f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
218f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
219f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstatic INLINE union lp_rast_cmd_arg
220f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orglp_rast_arg_clearzs( unsigned value, unsigned mask )
221f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org{
222f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   union lp_rast_cmd_arg arg;
223f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   arg.clear_zstencil.value = value;
224f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   arg.clear_zstencil.mask = mask;
225f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   return arg;
226f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org}
227f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
228f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
229f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstatic INLINE union lp_rast_cmd_arg
230f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orglp_rast_arg_query( struct llvmpipe_query *pq )
231f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org{
232f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   union lp_rast_cmd_arg arg;
233f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   arg.query_obj = pq;
234f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   return arg;
235f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org}
236f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
237f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstatic INLINE union lp_rast_cmd_arg
238f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orglp_rast_arg_null( void )
239f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org{
240f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   union lp_rast_cmd_arg arg;
241f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   arg.set_state = NULL;
242f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org   return arg;
243f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org}
244f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
245f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
246f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org/**
247f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * Binnable Commands.
248f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * These get put into bins by the setup code and are called when
249f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * the bins are executed.
250f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org */
251f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#define LP_RAST_OP_CLEAR_COLOR       0x0
252f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#define LP_RAST_OP_CLEAR_ZSTENCIL    0x1
253f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#define LP_RAST_OP_TRIANGLE_1        0x2
254f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#define LP_RAST_OP_TRIANGLE_2        0x3
255f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#define LP_RAST_OP_TRIANGLE_3        0x4
256f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#define LP_RAST_OP_TRIANGLE_4        0x5
257f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#define LP_RAST_OP_TRIANGLE_5        0x6
258f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#define LP_RAST_OP_TRIANGLE_6        0x7
259f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#define LP_RAST_OP_TRIANGLE_7        0x8
260f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#define LP_RAST_OP_TRIANGLE_8        0x9
261f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#define LP_RAST_OP_TRIANGLE_3_4      0xa
262f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#define LP_RAST_OP_TRIANGLE_3_16     0xb
263f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#define LP_RAST_OP_TRIANGLE_4_16     0xc
264f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#define LP_RAST_OP_SHADE_TILE        0xd
265f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#define LP_RAST_OP_SHADE_TILE_OPAQUE 0xe
266f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#define LP_RAST_OP_BEGIN_QUERY       0xf
267f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#define LP_RAST_OP_END_QUERY         0x10
268f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#define LP_RAST_OP_SET_STATE         0x11
269f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
270f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#define LP_RAST_OP_MAX               0x12
271f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#define LP_RAST_OP_MASK              0xff
272f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
273f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgvoid
274f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orglp_debug_bins( struct lp_scene *scene );
275f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgvoid
276f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orglp_debug_draw_bins_by_cmd_length( struct lp_scene *scene );
277f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgvoid
278f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orglp_debug_draw_bins_by_coverage( struct lp_scene *scene );
279f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
280f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org
281f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#endif
282