intel: Convert from GLboolean to 'bool' from stdbool.h.
[mesa.git] / src / mesa / drivers / dri / i965 / brw_vs.h
1 /*
2 Copyright (C) Intel Corp. 2006. All Rights Reserved.
3 Intel funded Tungsten Graphics (http://www.tungstengraphics.com) to
4 develop this 3D driver.
5
6 Permission is hereby granted, free of charge, to any person obtaining
7 a copy of this software and associated documentation files (the
8 "Software"), to deal in the Software without restriction, including
9 without limitation the rights to use, copy, modify, merge, publish,
10 distribute, sublicense, and/or sell copies of the Software, and to
11 permit persons to whom the Software is furnished to do so, subject to
12 the following conditions:
13
14 The above copyright notice and this permission notice (including the
15 next paragraph) shall be included in all copies or substantial
16 portions of the Software.
17
18 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
21 IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
22 LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
23 OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
24 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25
26 **********************************************************************/
27 /*
28 * Authors:
29 * Keith Whitwell <keith@tungstengraphics.com>
30 */
31
32
33 #ifndef BRW_VS_H
34 #define BRW_VS_H
35
36
37 #include "brw_context.h"
38 #include "brw_eu.h"
39 #include "program/program.h"
40
41
42 struct brw_vs_prog_key {
43 GLuint program_string_id;
44 /**
45 * Number of channels of the vertex attribute that need GL_FIXED rescaling
46 */
47 uint8_t gl_fixed_input_size[VERT_ATTRIB_MAX];
48
49 /**
50 * True if at least one clip flag is enabled, regardless of whether the
51 * shader uses clip planes or gl_ClipDistance.
52 */
53 GLuint userclip_active:1;
54
55 /**
56 * How many user clipping planes are being uploaded to the vertex shader as
57 * push constants.
58 */
59 GLuint nr_userclip_plane_consts:4;
60
61 /**
62 * True if the shader uses gl_ClipDistance, regardless of whether any clip
63 * flags are enabled.
64 */
65 GLuint uses_clip_distance:1;
66
67 /**
68 * For pre-Gen6 hardware, a bitfield indicating which clipping planes are
69 * enabled. This is used to compact clip planes.
70 *
71 * For Gen6 and later hardware, clip planes are not compacted, so this
72 * value is zero to avoid provoking unnecessary shader recompiles.
73 */
74 GLuint userclip_planes_enabled_gen_4_5:MAX_CLIP_PLANES;
75
76 GLuint copy_edgeflag:1;
77 GLuint point_coord_replace:8;
78 GLuint clamp_vertex_color:1;
79 };
80
81
82 struct brw_vs_compile {
83 struct brw_compile func;
84 struct brw_vs_prog_key key;
85 struct brw_vs_prog_data prog_data;
86 int8_t constant_map[1024];
87
88 struct brw_vertex_program *vp;
89
90 GLuint nr_inputs;
91
92 struct brw_vue_map vue_map;
93 GLuint first_output;
94 GLuint last_scratch;
95
96 GLuint first_tmp;
97 GLuint last_tmp;
98
99 struct brw_reg r0;
100 struct brw_reg r1;
101 struct brw_reg regs[PROGRAM_ADDRESS+1][128];
102 struct brw_reg tmp;
103 struct brw_reg stack;
104
105 struct {
106 bool used_in_src;
107 struct brw_reg reg;
108 } output_regs[128];
109
110 struct brw_reg userplane[MAX_CLIP_PLANES];
111
112 /** we may need up to 3 constants per instruction (if use_const_buffer) */
113 struct {
114 GLint index;
115 struct brw_reg reg;
116 } current_const[3];
117
118 bool needs_stack;
119 };
120
121 bool brw_vs_emit(struct gl_shader_program *prog, struct brw_vs_compile *c);
122 void brw_old_vs_emit(struct brw_vs_compile *c);
123 bool brw_vs_precompile(struct gl_context *ctx, struct gl_shader_program *prog);
124
125 #endif