i965: Move ClipPlanesEnabled state to VS cache key.
[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 * Number of user clip planes (or clip distances) that are active.
51 */
52 GLuint nr_userclip:4;
53
54 /**
55 * True if the shader uses gl_ClipDistance, regardless of whether any clip
56 * flags are enabled.
57 */
58 GLuint uses_clip_distance:1;
59
60 /**
61 * Which user clip planes are active. Zero if the shader uses
62 * gl_ClipDistance.
63 */
64 GLuint userclip_planes_enabled:MAX_CLIP_PLANES;
65
66 GLuint copy_edgeflag:1;
67 GLuint point_coord_replace:8;
68 GLuint clamp_vertex_color:1;
69 };
70
71
72 struct brw_vs_compile {
73 struct brw_compile func;
74 struct brw_vs_prog_key key;
75 struct brw_vs_prog_data prog_data;
76 int8_t constant_map[1024];
77
78 struct brw_vertex_program *vp;
79
80 GLuint nr_inputs;
81
82 struct brw_vue_map vue_map;
83 GLuint first_output;
84 GLuint last_scratch;
85
86 GLuint first_tmp;
87 GLuint last_tmp;
88
89 struct brw_reg r0;
90 struct brw_reg r1;
91 struct brw_reg regs[PROGRAM_ADDRESS+1][128];
92 struct brw_reg tmp;
93 struct brw_reg stack;
94
95 struct {
96 GLboolean used_in_src;
97 struct brw_reg reg;
98 } output_regs[128];
99
100 struct brw_reg userplane[MAX_CLIP_PLANES];
101
102 /** we may need up to 3 constants per instruction (if use_const_buffer) */
103 struct {
104 GLint index;
105 struct brw_reg reg;
106 } current_const[3];
107
108 GLboolean needs_stack;
109 };
110
111 bool brw_vs_emit(struct gl_shader_program *prog, struct brw_vs_compile *c);
112 void brw_old_vs_emit(struct brw_vs_compile *c);
113 bool brw_vs_precompile(struct gl_context *ctx, struct gl_shader_program *prog);
114
115 #endif