1 /**************************************************************************
3 * Copyright 2020 Red Hat.
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the "Software"),
8 * to deal in the Software without restriction, including without limitation
9 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 * and/or sell copies of the Software, and to permit persons to whom the
11 * Software is furnished to do so, subject to the following conditions:
13 * The above copyright notice and this permission notice shall be included
14 * in all copies or substantial portions of the Software.
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
17 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24 **************************************************************************/
25 #ifndef PIPE_TESSELLATOR_H
26 #define PIPE_TESSELLATOR_H
28 #include "pipe/p_defines.h"
34 struct pipe_tessellator
;
35 struct pipe_tessellation_factors
42 struct pipe_tessellator_data
45 uint32_t num_domain_points
;
48 float *domain_points_u
;
49 float *domain_points_v
;
50 // For Tri: domain_points_w[i] = 1.0f - domain_points_u[i] - domain_points_v[i]
53 /// Allocate and initialize a new tessellation context
54 struct pipe_tessellator
*p_tess_init(enum pipe_prim_type tes_prim_mode
,
55 enum pipe_tess_spacing spacing
,
56 bool tes_vertex_order_cw
, bool tes_point_mode
);
57 /// Destroy & de-allocate tessellation context
58 void p_tess_destroy(struct pipe_tessellator
*pipe_ts
);
61 /// Perform Tessellation
62 void p_tessellate(struct pipe_tessellator
*pipe_ts
,
63 const struct pipe_tessellation_factors
*tess_factors
,
64 struct pipe_tessellator_data
*tess_data
);