summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorErik Faye-Lund <[email protected]>2019-07-17 10:21:08 +0200
committerDylan Baker <[email protected]>2019-09-04 16:13:57 -0700
commit451ddeb42945384a92c994023054931d7c55b179 (patch)
tree46d1c11155221394f05731a058b92ee79d0f1ef9
parent6ac1d9b46e2b1478c0715c3ed84563b89b83dfb0 (diff)
gallium/auxiliary/indices: consistently apply start only to input
The majority of these only apply the start argument to the input, but a few of them also does for the output-array. util_primconvert, the only user of this argument expects this pass a non-zero start-argument does not expect this to be applied to the output; if it is, it will write outside of allocated memory, leading to VRAM corruption. The reason this doesn't seem to have been noticed before, is that no driver currently use util_primconvert to convert a primitive-type to itself, which is the cases where this was broken. But for Zink, this will no longer be true, because we need to eliminate the use of 8-bit index-buffers. Signed-off-by: Erik Faye-Lund <[email protected]> Fixes: 28f3f8d413f ("gallium/auxiliary/indices: add start param") Reviewed-by: Rob Clark <[email protected]> (cherry picked from commit 52af1427c6d248829130ce25b86cd27a31d34633)
-rw-r--r--src/gallium/auxiliary/indices/u_indices_gen.py20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/gallium/auxiliary/indices/u_indices_gen.py b/src/gallium/auxiliary/indices/u_indices_gen.py
index 2d9297854c5..498878746d2 100644
--- a/src/gallium/auxiliary/indices/u_indices_gen.py
+++ b/src/gallium/auxiliary/indices/u_indices_gen.py
@@ -211,15 +211,15 @@ def postamble():
def points(intype, outtype, inpv, outpv, pr):
preamble(intype, outtype, inpv, outpv, pr, prim='points')
- print(' for (i = start; i < (out_nr+start); i++) { ')
- do_point( intype, outtype, 'out+i', 'i' );
+ print(' for (i = start, j = 0; j < out_nr; j++, i++) { ')
+ do_point( intype, outtype, 'out+j', 'i' );
print(' }')
postamble()
def lines(intype, outtype, inpv, outpv, pr):
preamble(intype, outtype, inpv, outpv, pr, prim='lines')
- print(' for (i = start; i < (out_nr+start); i+=2) { ')
- do_line( intype, outtype, 'out+i', 'i', 'i+1', inpv, outpv );
+ print(' for (i = start, j = 0; j < out_nr; j+=2, i+=2) { ')
+ do_line( intype, outtype, 'out+j', 'i', 'i+1', inpv, outpv );
print(' }')
postamble()
@@ -240,8 +240,8 @@ def lineloop(intype, outtype, inpv, outpv, pr):
def tris(intype, outtype, inpv, outpv, pr):
preamble(intype, outtype, inpv, outpv, pr, prim='tris')
- print(' for (i = start; i < (out_nr+start); i+=3) { ')
- do_tri( intype, outtype, 'out+i', 'i', 'i+1', 'i+2', inpv, outpv );
+ print(' for (i = start, j = 0; j < out_nr; j+=3, i+=3) { ')
+ do_tri( intype, outtype, 'out+j', 'i', 'i+1', 'i+2', inpv, outpv );
print(' }')
postamble()
@@ -377,8 +377,8 @@ def quadstrip(intype, outtype, inpv, outpv, pr):
def linesadj(intype, outtype, inpv, outpv, pr):
preamble(intype, outtype, inpv, outpv, pr, prim='linesadj')
- print(' for (i = start; i < (out_nr+start); i+=4) { ')
- do_lineadj( intype, outtype, 'out+i', 'i+0', 'i+1', 'i+2', 'i+3', inpv, outpv )
+ print(' for (i = start, j = 0; j < out_nr; j+=4, i+=4) { ')
+ do_lineadj( intype, outtype, 'out+j', 'i+0', 'i+1', 'i+2', 'i+3', inpv, outpv )
print(' }')
postamble()
@@ -393,8 +393,8 @@ def linestripadj(intype, outtype, inpv, outpv, pr):
def trisadj(intype, outtype, inpv, outpv, pr):
preamble(intype, outtype, inpv, outpv, pr, prim='trisadj')
- print(' for (i = start; i < (out_nr+start); i+=6) { ')
- do_triadj( intype, outtype, 'out+i', 'i+0', 'i+1', 'i+2', 'i+3',
+ print(' for (i = start, j = 0; j < out_nr; j+=6, i+=6) { ')
+ do_triadj( intype, outtype, 'out+j', 'i+0', 'i+1', 'i+2', 'i+3',
'i+4', 'i+5', inpv, outpv )
print(' }')
postamble()