brw_vs.h revision 119eb4094256742013224afb7c5704b6254b6296
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"
39acfeb3b6ea93bcb5b18e6f51a0727e39da608d76Brian#include "shader/program.h"
409f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt
419f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt
429f344b3e7d6e23674dd4747faec253f103563b36Eric Anholtstruct brw_vs_prog_key {
439f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt   GLuint program_string_id;
449f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt   GLuint nr_userclip:4;
459f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt   GLuint copy_edgeflag:1;
46496f9ddf351bd91ea17c257f94e3504e87992202Keith Whitwell   GLuint pad:26;
479f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt};
489f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt
499f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt
509f344b3e7d6e23674dd4747faec253f103563b36Eric Anholtstruct brw_vs_compile {
519f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt   struct brw_compile func;
529f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt   struct brw_vs_prog_key key;
539f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt   struct brw_vs_prog_data prog_data;
549f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt
559f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt   struct brw_vertex_program *vp;
569f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt
579f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt   GLuint nr_inputs;
589f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt
599f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt   GLuint first_output;
609f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt   GLuint nr_outputs;
61119eb4094256742013224afb7c5704b6254b6296Brian Paul   GLuint first_overflow_output; /**< VERT_ATTRIB_x */
629f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt
639f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt   GLuint first_tmp;
649f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt   GLuint last_tmp;
659f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt
669f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt   struct brw_reg r0;
679f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt   struct brw_reg r1;
689f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt   struct brw_reg regs[PROGRAM_ADDRESS+1][128];
699f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt   struct brw_reg tmp;
70a78b26fff04026a24189ecad7ec85bfe0df2cce1Zou Nan hai   struct brw_reg stack;
719f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt
72d19d0596daf004b56d80f78fa1a329b43c2ebf94Zou Nan hai   struct {
73d19d0596daf004b56d80f78fa1a329b43c2ebf94Zou Nan hai       GLboolean used_in_src;
74d19d0596daf004b56d80f78fa1a329b43c2ebf94Zou Nan hai       struct brw_reg reg;
75d19d0596daf004b56d80f78fa1a329b43c2ebf94Zou Nan hai   } output_regs[128];
769f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt
779f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt   struct brw_reg userplane[6];
789f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt
79cafea7528052624c8d3e4cd1c5b26a61bf04d1d0Brian Paul   /** we may need up to 3 constants per instruction (if use_const_buffer) */
80cafea7528052624c8d3e4cd1c5b26a61bf04d1d0Brian Paul   struct {
81cafea7528052624c8d3e4cd1c5b26a61bf04d1d0Brian Paul      GLint index;
82cafea7528052624c8d3e4cd1c5b26a61bf04d1d0Brian Paul      struct brw_reg reg;
83cafea7528052624c8d3e4cd1c5b26a61bf04d1d0Brian Paul   } current_const[3];
849f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt};
859f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt
869f344b3e7d6e23674dd4747faec253f103563b36Eric Anholtvoid brw_vs_emit( struct brw_vs_compile *c );
879f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt
889f344b3e7d6e23674dd4747faec253f103563b36Eric Anholt#endif
89