Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8090991

Reduce Vertex Buffer Overhead: Constant Color Attribute vs. Array Color Attributes

XMLWordPrintable

      I noticed this code segment appeared in 2 of 3 inlined add quad methods:

             byte barr[] = colorArray;
             byte r = this.r, g = this.g, b = this.b, a = this.a;
             int j = BYTES_PER_VERT * idx;
             barr[ j] = r; barr[++j] = g; barr[++j] = b; barr[++j] = a;
             barr[++j] = r; barr[++j] = g; barr[++j] = b; barr[++j] = a;
             barr[++j] = r; barr[++j] = g; barr[++j] = b; barr[++j] = a;
             barr[++j] = r; barr[++j] = g; barr[++j] = b; barr[++j] = a;

      We should avoid storing constants in attribute arrays as it is a waste of bandwidth and memory. This is a 12.5% saving given that we have 7 floats per cood and 1 float per color.


      (Filed on behalf of Chien)

            Unassigned Unassigned
            rbair Richard Bair (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Imported: