summaryrefslogtreecommitdiff
path: root/lib/mesa/src/gallium/auxiliary/tessellator/p_tessellator.h
blob: 47abc2e4aced84bf5bfc2678b16faf7ab6e485d6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
/**************************************************************************
 *
 * Copyright 2020 Red Hat.
 * All Rights Reserved.
 *
 * Permission is hereby granted, free of charge, to any person obtaining a
 * copy of this software and associated documentation files (the "Software"),
 * to deal in the Software without restriction, including without limitation
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
 * and/or sell copies of the Software, and to permit persons to whom the
 * Software is furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included
 * in all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 *
 **************************************************************************/
#ifndef PIPE_TESSELLATOR_H
#define PIPE_TESSELLATOR_H

#include "pipe/p_defines.h"

#ifdef __cplusplus
extern "C" {
#endif

struct pipe_tessellator;
struct pipe_tessellation_factors
{
   float outer_tf[4];
   float inner_tf[2];
   float pad[2];
};

struct pipe_tessellator_data
{
   uint32_t num_indices;
   uint32_t num_domain_points;

   uint32_t *indices;
   float    *domain_points_u;
   float    *domain_points_v;
    // For Tri: domain_points_w[i] = 1.0f - domain_points_u[i] - domain_points_v[i]
};

/// Allocate and initialize a new tessellation context
struct pipe_tessellator *p_tess_init(enum pipe_prim_type tes_prim_mode,
                                     enum pipe_tess_spacing spacing,
                                     bool tes_vertex_order_cw, bool tes_point_mode);
/// Destroy & de-allocate tessellation context
void p_tess_destroy(struct pipe_tessellator *pipe_ts);


/// Perform Tessellation
void p_tessellate(struct pipe_tessellator *pipe_ts,
                  const struct pipe_tessellation_factors *tess_factors,
                  struct pipe_tessellator_data *tess_data);

#ifdef __cplusplus
}
#endif
#endif