diff options
author | Ilia Mirkin <[email protected]> | 2015-04-07 01:42:05 -0400 |
---|---|---|
committer | Ilia Mirkin <[email protected]> | 2015-04-18 18:27:22 -0400 |
commit | b2e871bd484db229978cfe4b7efa12dfd79067a8 (patch) | |
tree | 4a415684226b993f623f88e10cb177e3bc660223 /src/gallium/auxiliary/indices | |
parent | 1cdb01d716cb8112c67f8538f7d71d0765153eb2 (diff) |
indices: fix provoking vertex for quads/quadstrips
This allows drivers to provide consistent flat shading for quads.
Otherwise a driver that only supported tris would have to force last
provoking vertex when drawing quads (and would have to say that quads
don't follow the provoking vertex convention).
Signed-off-by: Ilia Mirkin <[email protected]>
Reviewed-by: Rob Clark <[email protected]>
Diffstat (limited to 'src/gallium/auxiliary/indices')
-rw-r--r-- | src/gallium/auxiliary/indices/u_indices_gen.py | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/gallium/auxiliary/indices/u_indices_gen.py b/src/gallium/auxiliary/indices/u_indices_gen.py index 687a717db9a..97c8e0d9469 100644 --- a/src/gallium/auxiliary/indices/u_indices_gen.py +++ b/src/gallium/auxiliary/indices/u_indices_gen.py @@ -142,8 +142,12 @@ def do_tri( intype, outtype, ptr, v0, v1, v2, inpv, outpv ): tri( intype, outtype, ptr, v2, v0, v1 ) def do_quad( intype, outtype, ptr, v0, v1, v2, v3, inpv, outpv ): - do_tri( intype, outtype, ptr+'+0', v0, v1, v3, inpv, outpv ); - do_tri( intype, outtype, ptr+'+3', v1, v2, v3, inpv, outpv ); + if inpv == LAST: + do_tri( intype, outtype, ptr+'+0', v0, v1, v3, inpv, outpv ); + do_tri( intype, outtype, ptr+'+3', v1, v2, v3, inpv, outpv ); + else: + do_tri( intype, outtype, ptr+'+0', v0, v1, v2, inpv, outpv ); + do_tri( intype, outtype, ptr+'+3', v0, v2, v3, inpv, outpv ); def name(intype, outtype, inpv, outpv, pr, prim): if intype == GENERATE: @@ -331,7 +335,10 @@ def quadstrip(intype, outtype, inpv, outpv, pr): print ' i += 4;' print ' goto restart;' print ' }' - do_quad( intype, outtype, 'out+j', 'i+2', 'i+0', 'i+1', 'i+3', inpv, outpv ); + if inpv == LAST: + do_quad( intype, outtype, 'out+j', 'i+2', 'i+0', 'i+1', 'i+3', inpv, outpv ); + else: + do_quad( intype, outtype, 'out+j', 'i+0', 'i+1', 'i+3', 'i+2', inpv, outpv ); print ' }' postamble() |