2 * Mesa 3-D graphics library
4 * Copyright (C) 2014 LunarG, Inc.
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 OR
17 * 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
21 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 * DEALINGS IN THE SOFTWARE.
25 * Chia-I Wu <olv@lunarg.com>
28 #ifndef ILO_BUILDER_3D_H
29 #define ILO_BUILDER_3D_H
31 #include "genhw/genhw.h"
35 #include "ilo_builder_3d_top.h"
36 #include "ilo_builder_3d_bottom.h"
38 struct gen6_3dprimitive_info
{
39 enum gen_3dprim_type topology
;
42 uint32_t vertex_count
;
43 uint32_t vertex_start
;
44 uint32_t instance_count
;
45 uint32_t instance_start
;
50 gen6_3DPRIMITIVE(struct ilo_builder
*builder
,
51 const struct gen6_3dprimitive_info
*info
)
53 const uint8_t cmd_len
= 6;
56 ILO_DEV_ASSERT(builder
->dev
, 6, 6);
58 ilo_builder_batch_pointer(builder
, cmd_len
, &dw
);
60 dw
[0] = GEN6_RENDER_CMD(3D
, 3DPRIMITIVE
) | (cmd_len
- 2) |
61 info
->topology
<< GEN6_3DPRIM_DW0_TYPE__SHIFT
;
63 dw
[0] |= GEN6_3DPRIM_DW0_ACCESS_RANDOM
;
65 dw
[1] = info
->vertex_count
;
66 dw
[2] = info
->vertex_start
;
67 dw
[3] = info
->instance_count
;
68 dw
[4] = info
->instance_start
;
69 dw
[5] = info
->vertex_base
;
73 gen7_3DPRIMITIVE(struct ilo_builder
*builder
,
74 const struct gen6_3dprimitive_info
*info
)
76 const uint8_t cmd_len
= 7;
79 ILO_DEV_ASSERT(builder
->dev
, 7, 8);
81 ilo_builder_batch_pointer(builder
, cmd_len
, &dw
);
83 dw
[0] = GEN6_RENDER_CMD(3D
, 3DPRIMITIVE
) | (cmd_len
- 2);
85 dw
[1] = info
->topology
<< GEN7_3DPRIM_DW1_TYPE__SHIFT
;
87 dw
[1] |= GEN7_3DPRIM_DW1_ACCESS_RANDOM
;
89 dw
[2] = info
->vertex_count
;
90 dw
[3] = info
->vertex_start
;
91 dw
[4] = info
->instance_count
;
92 dw
[5] = info
->instance_start
;
93 dw
[6] = info
->vertex_base
;
96 #endif /* ILO_BUILDER_3D_H */