2006-08-09 19:14:05 +00:00
|
|
|
/*
|
|
|
|
Copyright (C) Intel Corp. 2006. All Rights Reserved.
|
s/Tungsten Graphics/VMware/
Tungsten Graphics Inc. was acquired by VMware Inc. in 2008. Leaving the
old copyright name is creating unnecessary confusion, hence this change.
This was the sed script I used:
$ cat tg2vmw.sed
# Run as:
#
# git reset --hard HEAD && find include scons src -type f -not -name 'sed*' -print0 | xargs -0 sed -i -f tg2vmw.sed
#
# Rename copyrights
s/Tungsten Gra\(ph\|hp\)ics,\? [iI]nc\.\?\(, Cedar Park\)\?\(, Austin\)\?\(, \(Texas\|TX\)\)\?\.\?/VMware, Inc./g
/Copyright/s/Tungsten Graphics\(,\? [iI]nc\.\)\?\(, Cedar Park\)\?\(, Austin\)\?\(, \(Texas\|TX\)\)\?\.\?/VMware, Inc./
s/TUNGSTEN GRAPHICS/VMWARE/g
# Rename emails
s/alanh@tungstengraphics.com/alanh@vmware.com/
s/jens@tungstengraphics.com/jowen@vmware.com/g
s/jrfonseca-at-tungstengraphics-dot-com/jfonseca-at-vmware-dot-com/
s/jrfonseca\?@tungstengraphics.com/jfonseca@vmware.com/g
s/keithw\?@tungstengraphics.com/keithw@vmware.com/g
s/michel@tungstengraphics.com/daenzer@vmware.com/g
s/thomas-at-tungstengraphics-dot-com/thellstom-at-vmware-dot-com/
s/zack@tungstengraphics.com/zackr@vmware.com/
# Remove dead links
s@Tungsten Graphics (http://www.tungstengraphics.com)@Tungsten Graphics@g
# C string src/gallium/state_trackers/vega/api_misc.c
s/"Tungsten Graphics, Inc"/"VMware, Inc"/
Reviewed-by: Brian Paul <brianp@vmware.com>
2014-01-17 16:27:50 +00:00
|
|
|
Intel funded Tungsten Graphics to
|
2006-08-09 19:14:05 +00:00
|
|
|
develop this 3D driver.
|
2013-11-25 15:46:34 -08:00
|
|
|
|
2006-08-09 19:14:05 +00:00
|
|
|
Permission is hereby granted, free of charge, to any person obtaining
|
|
|
|
a copy of this software and associated documentation files (the
|
|
|
|
"Software"), to deal in the Software without restriction, including
|
|
|
|
without limitation the rights to use, copy, modify, merge, publish,
|
|
|
|
distribute, sublicense, and/or sell copies of the Software, and to
|
|
|
|
permit persons to whom the Software is furnished to do so, subject to
|
|
|
|
the following conditions:
|
2013-11-25 15:46:34 -08:00
|
|
|
|
2006-08-09 19:14:05 +00:00
|
|
|
The above copyright notice and this permission notice (including the
|
|
|
|
next paragraph) shall be included in all copies or substantial
|
|
|
|
portions of the Software.
|
2013-11-25 15:46:34 -08:00
|
|
|
|
2006-08-09 19:14:05 +00:00
|
|
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
|
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
|
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
|
|
IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
|
|
|
|
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
|
|
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
|
|
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
2013-11-25 15:46:34 -08:00
|
|
|
|
2006-08-09 19:14:05 +00:00
|
|
|
**********************************************************************/
|
|
|
|
/*
|
|
|
|
* Authors:
|
s/Tungsten Graphics/VMware/
Tungsten Graphics Inc. was acquired by VMware Inc. in 2008. Leaving the
old copyright name is creating unnecessary confusion, hence this change.
This was the sed script I used:
$ cat tg2vmw.sed
# Run as:
#
# git reset --hard HEAD && find include scons src -type f -not -name 'sed*' -print0 | xargs -0 sed -i -f tg2vmw.sed
#
# Rename copyrights
s/Tungsten Gra\(ph\|hp\)ics,\? [iI]nc\.\?\(, Cedar Park\)\?\(, Austin\)\?\(, \(Texas\|TX\)\)\?\.\?/VMware, Inc./g
/Copyright/s/Tungsten Graphics\(,\? [iI]nc\.\)\?\(, Cedar Park\)\?\(, Austin\)\?\(, \(Texas\|TX\)\)\?\.\?/VMware, Inc./
s/TUNGSTEN GRAPHICS/VMWARE/g
# Rename emails
s/alanh@tungstengraphics.com/alanh@vmware.com/
s/jens@tungstengraphics.com/jowen@vmware.com/g
s/jrfonseca-at-tungstengraphics-dot-com/jfonseca-at-vmware-dot-com/
s/jrfonseca\?@tungstengraphics.com/jfonseca@vmware.com/g
s/keithw\?@tungstengraphics.com/keithw@vmware.com/g
s/michel@tungstengraphics.com/daenzer@vmware.com/g
s/thomas-at-tungstengraphics-dot-com/thellstom-at-vmware-dot-com/
s/zack@tungstengraphics.com/zackr@vmware.com/
# Remove dead links
s@Tungsten Graphics (http://www.tungstengraphics.com)@Tungsten Graphics@g
# C string src/gallium/state_trackers/vega/api_misc.c
s/"Tungsten Graphics, Inc"/"VMware, Inc"/
Reviewed-by: Brian Paul <brianp@vmware.com>
2014-01-17 16:27:50 +00:00
|
|
|
* Keith Whitwell <keithw@vmware.com>
|
2006-08-09 19:14:05 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef BRW_CLIP_H
|
|
|
|
#define BRW_CLIP_H
|
|
|
|
|
2017-03-18 12:02:45 -07:00
|
|
|
#include "brw_compiler.h"
|
|
|
|
#include "brw_eu.h"
|
2006-08-09 19:14:05 +00:00
|
|
|
|
2013-07-07 22:51:02 +12:00
|
|
|
/* Initial 3 verts, plus at most 6 additional verts from intersections
|
|
|
|
* with fixed planes, plus at most 8 additional verts from intersections
|
|
|
|
* with user clip planes
|
|
|
|
*/
|
|
|
|
#define MAX_VERTS (3+6+8)
|
2006-08-09 19:14:05 +00:00
|
|
|
|
|
|
|
#define PRIM_MASK (0x1f)
|
|
|
|
|
|
|
|
struct brw_clip_compile {
|
2015-04-16 11:06:57 -07:00
|
|
|
struct brw_codegen func;
|
2006-08-09 19:14:05 +00:00
|
|
|
struct brw_clip_prog_key key;
|
|
|
|
struct brw_clip_prog_data prog_data;
|
2013-11-25 15:46:34 -08:00
|
|
|
|
2006-08-09 19:14:05 +00:00
|
|
|
struct {
|
|
|
|
struct brw_reg R0;
|
|
|
|
struct brw_reg vertex[MAX_VERTS];
|
|
|
|
|
|
|
|
struct brw_reg t;
|
|
|
|
struct brw_reg t0, t1;
|
|
|
|
struct brw_reg dp0, dp1;
|
|
|
|
|
|
|
|
struct brw_reg dpPrev;
|
|
|
|
struct brw_reg dp;
|
|
|
|
struct brw_reg loopcount;
|
|
|
|
struct brw_reg nr_verts;
|
|
|
|
struct brw_reg planemask;
|
|
|
|
|
|
|
|
struct brw_reg inlist;
|
|
|
|
struct brw_reg outlist;
|
|
|
|
struct brw_reg freelist;
|
|
|
|
|
|
|
|
struct brw_reg dir;
|
|
|
|
struct brw_reg tmp0, tmp1;
|
|
|
|
struct brw_reg offset;
|
2013-11-25 15:46:34 -08:00
|
|
|
|
2006-08-09 19:14:05 +00:00
|
|
|
struct brw_reg fixed_planes;
|
|
|
|
struct brw_reg plane_equation;
|
2013-11-25 15:46:34 -08:00
|
|
|
|
2009-07-30 14:45:11 +08:00
|
|
|
struct brw_reg ff_sync;
|
2013-05-20 21:51:43 +12:00
|
|
|
|
|
|
|
/* Bitmask indicating which coordinate attribute should be used for
|
|
|
|
* comparison to each clipping plane. A 0 indicates that VARYING_SLOT_POS
|
|
|
|
* should be used, because it's one of the fixed +/- x/y/z planes that
|
|
|
|
* constitute the bounds of the view volume. A 1 indicates that
|
|
|
|
* VARYING_SLOT_CLIP_VERTEX should be used (if available) since it's a user-
|
|
|
|
* defined clipping plane.
|
|
|
|
*/
|
|
|
|
struct brw_reg vertex_src_mask;
|
2013-08-04 05:20:17 +12:00
|
|
|
|
|
|
|
/* Offset into the vertex of the current plane's clipdistance value */
|
|
|
|
struct brw_reg clipdistance_offset;
|
2006-08-09 19:14:05 +00:00
|
|
|
} reg;
|
|
|
|
|
2011-08-26 09:30:35 -07:00
|
|
|
/* Number of registers storing VUE data */
|
2006-08-09 19:14:05 +00:00
|
|
|
GLuint nr_regs;
|
|
|
|
|
|
|
|
GLuint first_tmp;
|
|
|
|
GLuint last_tmp;
|
|
|
|
|
2011-10-07 12:26:50 -07:00
|
|
|
bool need_direction;
|
2006-08-09 19:14:05 +00:00
|
|
|
|
2011-08-24 19:51:54 -07:00
|
|
|
struct brw_vue_map vue_map;
|
2006-08-09 19:14:05 +00:00
|
|
|
};
|
|
|
|
|
2011-08-25 13:27:57 -07:00
|
|
|
/**
|
2013-03-22 09:39:11 -07:00
|
|
|
* True if the given varying is one of the outputs of the vertex shader.
|
2011-08-25 13:27:57 -07:00
|
|
|
*/
|
2013-03-22 09:39:11 -07:00
|
|
|
static inline bool brw_clip_have_varying(struct brw_clip_compile *c,
|
|
|
|
GLuint varying)
|
2011-08-25 13:27:57 -07:00
|
|
|
{
|
2013-03-22 09:39:11 -07:00
|
|
|
return (c->key.attrs & BITFIELD64_BIT(varying)) ? 1 : 0;
|
2011-08-25 13:27:57 -07:00
|
|
|
}
|
|
|
|
|
2006-08-09 19:14:05 +00:00
|
|
|
/* Points are only culled, so no need for a clip routine, however it
|
|
|
|
* works out easier to have a dummy one.
|
|
|
|
*/
|
|
|
|
void brw_emit_unfilled_clip( struct brw_clip_compile *c );
|
|
|
|
void brw_emit_tri_clip( struct brw_clip_compile *c );
|
|
|
|
void brw_emit_line_clip( struct brw_clip_compile *c );
|
|
|
|
void brw_emit_point_clip( struct brw_clip_compile *c );
|
|
|
|
|
|
|
|
/* brw_clip_tri.c, for use by the unfilled clip routine:
|
|
|
|
*/
|
|
|
|
void brw_clip_tri_init_vertices( struct brw_clip_compile *c );
|
|
|
|
void brw_clip_tri_flat_shade( struct brw_clip_compile *c );
|
|
|
|
void brw_clip_tri( struct brw_clip_compile *c );
|
|
|
|
void brw_clip_tri_emit_polygon( struct brw_clip_compile *c );
|
2013-11-25 15:46:34 -08:00
|
|
|
void brw_clip_tri_alloc_regs( struct brw_clip_compile *c,
|
2006-08-09 19:14:05 +00:00
|
|
|
GLuint nr_verts );
|
|
|
|
|
|
|
|
|
|
|
|
/* Utils:
|
|
|
|
*/
|
|
|
|
|
|
|
|
void brw_clip_interp_vertex( struct brw_clip_compile *c,
|
|
|
|
struct brw_indirect dest_ptr,
|
|
|
|
struct brw_indirect v0_ptr, /* from */
|
|
|
|
struct brw_indirect v1_ptr, /* to */
|
|
|
|
struct brw_reg t0,
|
2011-10-07 12:26:50 -07:00
|
|
|
bool force_edgeflag );
|
2006-08-09 19:14:05 +00:00
|
|
|
|
|
|
|
void brw_clip_init_planes( struct brw_clip_compile *c );
|
|
|
|
|
2013-11-25 15:46:34 -08:00
|
|
|
void brw_clip_emit_vue(struct brw_clip_compile *c,
|
2006-08-09 19:14:05 +00:00
|
|
|
struct brw_indirect vert,
|
i965: Allow C++ type safety in the use of enum brw_urb_write_flags.
(From a suggestion by Francisco Jerez)
If an enum represents a bitfield of flags, e.g.:
enum E {
A = 1,
B = 2,
C = 4,
D = 8,
};
then C++ normally prohibits statements like this:
enum E x = A | B;
because A and B are implicitly converted to ints before OR-ing them,
and an int can't be stored in an enum without a type cast. C, on the
other hand, allows an int to be implicitly converted to an enum
without casting.
In the past we've dealt with this situation by storing flag bitfields
as ints. This avoids ugly casting at the expense of some type safety
that C++ would normally have offered (e.g. we get no warning if we
accidentally use the wrong enum type).
However, we can get the best of both worlds if we override the |
operator. The ugly casting is confined to the operator overload, and
we still get the benefit of C++ making sure we don't use the wrong
enum type.
v2: Remove unnecessary comment and unnecessary use of "enum" keyword.
Use static_cast.
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
2013-08-23 13:19:19 -07:00
|
|
|
enum brw_urb_write_flags flags,
|
2006-08-09 19:14:05 +00:00
|
|
|
GLuint header);
|
|
|
|
|
|
|
|
void brw_clip_kill_thread(struct brw_clip_compile *c);
|
|
|
|
|
|
|
|
struct brw_reg brw_clip_plane_stride( struct brw_clip_compile *c );
|
|
|
|
struct brw_reg brw_clip_plane0_address( struct brw_clip_compile *c );
|
|
|
|
|
2013-07-07 19:47:19 +12:00
|
|
|
void brw_clip_copy_flatshaded_attributes( struct brw_clip_compile *c,
|
|
|
|
GLuint to, GLuint from );
|
2006-08-09 19:14:05 +00:00
|
|
|
|
|
|
|
void brw_clip_init_clipmask( struct brw_clip_compile *c );
|
|
|
|
|
2008-08-21 15:01:36 -07:00
|
|
|
struct brw_reg get_tmp( struct brw_clip_compile *c );
|
|
|
|
|
|
|
|
void brw_clip_project_position(struct brw_clip_compile *c,
|
|
|
|
struct brw_reg pos );
|
2009-07-13 10:48:43 +08:00
|
|
|
void brw_clip_ff_sync(struct brw_clip_compile *c);
|
2009-07-30 14:45:11 +08:00
|
|
|
void brw_clip_init_ff_sync(struct brw_clip_compile *c);
|
2017-03-18 12:02:45 -07:00
|
|
|
|
2006-08-09 19:14:05 +00:00
|
|
|
#endif
|