brw_vs.h revision af3c9803d818fd33139f1247a387d64b967b8992
19f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt/*
29f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt Copyright (C) Intel Corp.  2006.  All Rights Reserved.
39f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt Intel funded Tungsten Graphics (http://www.tungstengraphics.com) to
49f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt develop this 3D driver.
59f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt
69f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt Permission is hereby granted, free of charge, to any person obtaining
79f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt a copy of this software and associated documentation files (the
89f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt "Software"), to deal in the Software without restriction, including
99f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt without limitation the rights to use, copy, modify, merge, publish,
109f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt distribute, sublicense, and/or sell copies of the Software, and to
119f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt permit persons to whom the Software is furnished to do so, subject to
129f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt the following conditions:
139f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt
149f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt The above copyright notice and this permission notice (including the
159f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt next paragraph) shall be included in all copies or substantial
169f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt portions of the Software.
179f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt
189f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
199f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
209f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
219f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
229f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
239f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
249f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
259f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt
269f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt **********************************************************************/
279f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt /*
289f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt  * Authors:
299f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt  *   Keith Whitwell <keith@tungstengraphics.com>
309f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt  */
319f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt
329f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt
339f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt#ifndef BRW_VS_H
349f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt#define BRW_VS_H
359f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt
369f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt
379f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt#include "brw_context.h"
389f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt#include "brw_eu.h"
39ec2b92f98c2e7f161521b447cc1d9a36bce3707cBrian Paul#include "program/program.h"
409f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt
419f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt
429f344b3e7d6e23674dd4747faec253f103563b36Eric Anholtstruct brw_vs_prog_key {
439f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt   GLuint program_string_id;
444176025d463e7733dac19788b45b6472b65d62d4Eric Anholt   /**
454176025d463e7733dac19788b45b6472b65d62d4Eric Anholt    * Number of channels of the vertex attribute that need GL_FIXED rescaling
464176025d463e7733dac19788b45b6472b65d62d4Eric Anholt    */
474176025d463e7733dac19788b45b6472b65d62d4Eric Anholt   uint8_t gl_fixed_input_size[VERT_ATTRIB_MAX];
489f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt   GLuint nr_userclip:4;
499f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt   GLuint copy_edgeflag:1;
5064f5e9059b975e34885e63bc404b30b1b2c28de8Eric Anholt   GLuint point_coord_replace:8;
51e47eacdc53aec6743c42c8d9ab8298f802161733Xiang, Haihao   GLuint two_side_color: 1;
52d22e2ebe35ef9d33ec5f7a67f903f36bcd9fbc91Eric Anholt   GLuint clamp_vertex_color:1;
539f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt};
549f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt
559f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt
569f344b3e7d6e23674dd4747faec253f103563b36Eric Anholtstruct brw_vs_compile {
579f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt   struct brw_compile func;
589f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt   struct brw_vs_prog_key key;
599f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt   struct brw_vs_prog_data prog_data;
60fb4901593c9495714d3f54920a28c271852e2112Eric Anholt   int8_t constant_map[1024];
619f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt
629f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt   struct brw_vertex_program *vp;
639f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt
649f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt   GLuint nr_inputs;
659f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt
669f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt   GLuint first_output;
679f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt   GLuint nr_outputs;
68119eb4094256742013224afb7c5704b6254b6296Brian Paul   GLuint first_overflow_output; /**< VERT_ATTRIB_x */
699f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt
709f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt   GLuint first_tmp;
719f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt   GLuint last_tmp;
729f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt
739f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt   struct brw_reg r0;
749f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt   struct brw_reg r1;
759f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt   struct brw_reg regs[PROGRAM_ADDRESS+1][128];
769f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt   struct brw_reg tmp;
77a78b26fff04026a24189ecad7ec85bfe0df2cce1Zou Nan hai   struct brw_reg stack;
789f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt
79d19d0596daf004b56d80f78fa1a329b43c2ebf94Zou Nan hai   struct {
80d19d0596daf004b56d80f78fa1a329b43c2ebf94Zou Nan hai       GLboolean used_in_src;
81d19d0596daf004b56d80f78fa1a329b43c2ebf94Zou Nan hai       struct brw_reg reg;
82d19d0596daf004b56d80f78fa1a329b43c2ebf94Zou Nan hai   } output_regs[128];
839f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt
849f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt   struct brw_reg userplane[6];
859f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt
86cafea7528052624c8d3e4cd1c5b26a61bf04d1d0Brian Paul   /** we may need up to 3 constants per instruction (if use_const_buffer) */
87cafea7528052624c8d3e4cd1c5b26a61bf04d1d0Brian Paul   struct {
88cafea7528052624c8d3e4cd1c5b26a61bf04d1d0Brian Paul      GLint index;
89cafea7528052624c8d3e4cd1c5b26a61bf04d1d0Brian Paul      struct brw_reg reg;
90cafea7528052624c8d3e4cd1c5b26a61bf04d1d0Brian Paul   } current_const[3];
91c653f5f3872862da396353df63ef93ed86f608faEric Anholt
92c653f5f3872862da396353df63ef93ed86f608faEric Anholt   GLboolean needs_stack;
939f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt};
949f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt
95af3c9803d818fd33139f1247a387d64b967b8992Eric Anholtbool brw_vs_emit(struct brw_vs_compile *c);
96af3c9803d818fd33139f1247a387d64b967b8992Eric Anholtvoid brw_old_vs_emit(struct brw_vs_compile *c);
979f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt
989f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt#endif
99