2 Copyright (C) Intel Corp. 2006. All Rights Reserved.
3 Intel funded Tungsten Graphics to
4 develop this 3D driver.
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:
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.
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.
26 **********************************************************************/
29 * Keith Whitwell <keithw@vmware.com>
37 #include "brw_context.h"
40 #include "program/program.h"
43 * The VF can't natively handle certain types of attributes, such as GL_FIXED
44 * or most 10_10_10_2 types. These flags enable various VS workarounds to
45 * "fix" attributes at the beginning of shaders.
47 #define BRW_ATTRIB_WA_COMPONENT_MASK 7 /* mask for GL_FIXED scale channel count */
48 #define BRW_ATTRIB_WA_NORMALIZE 8 /* normalize in shader */
49 #define BRW_ATTRIB_WA_BGRA 16 /* swap r/b channels in shader */
50 #define BRW_ATTRIB_WA_SIGN 32 /* interpret as signed in shader */
51 #define BRW_ATTRIB_WA_SCALE 64 /* interpret as scaled in shader */
57 const unsigned *brw_vs_emit(struct brw_context
*brw
,
59 const struct brw_vs_prog_key
*key
,
60 struct brw_vs_prog_data
*prog_data
,
61 struct gl_vertex_program
*vp
,
62 struct gl_shader_program
*shader_prog
,
63 unsigned *program_size
);
64 void brw_vs_debug_recompile(struct brw_context
*brw
,
65 struct gl_shader_program
*prog
,
66 const struct brw_vs_prog_key
*key
);
67 bool brw_vs_prog_data_compare(const void *a
, const void *b
);
70 brw_upload_vs_prog(struct brw_context
*brw
);
73 brw_codegen_vs_prog(struct brw_context
*brw
,
74 struct gl_shader_program
*prog
,
75 struct brw_vertex_program
*vp
,
76 struct brw_vs_prog_key
*key
);
84 class vec4_vs_visitor
: public vec4_visitor
87 vec4_vs_visitor(const struct brw_compiler
*compiler
,
89 const struct brw_vs_prog_key
*key
,
90 struct brw_vs_prog_data
*vs_prog_data
,
91 struct gl_vertex_program
*vp
,
92 struct gl_shader_program
*prog
,
94 int shader_time_index
,
95 bool use_legacy_snorm_formula
);
98 virtual dst_reg
*make_reg_for_system_value(ir_variable
*ir
);
99 virtual void setup_payload();
100 virtual void emit_prolog();
101 virtual void emit_program_code();
102 virtual void emit_thread_end();
103 virtual void emit_urb_write_header(int mrf
);
104 virtual vec4_instruction
*emit_urb_write_opcode(bool complete
);
107 int setup_attributes(int payload_reg
);
108 void setup_vp_regs();
109 dst_reg
get_vp_dst_reg(const prog_dst_register
&dst
);
110 src_reg
get_vp_src_reg(const prog_src_register
&src
);
112 const struct brw_vs_prog_key
*const key
;
113 struct brw_vs_prog_data
* const vs_prog_data
;
114 struct gl_vertex_program
*const vp
;
115 src_reg
*vp_temp_regs
;
118 bool use_legacy_snorm_formula
;
121 } /* namespace brw */