On Wed, 13 Jul 2022 09:25:08 GMT, Sergey Bylokhov <[email protected]> wrote:
>> Earlier logic used to draw a rectangle with MTLPrimitiveTypeLineStrip. >> Hence, 5 vertices were specified to draw 4 sides of the rectangle. >> Now, the logic has been changed to use MTLPrimitiveTypeLine. Hence, 4 lines >> need to be specified separately by specifying 8 vertices. There are >> duplicates since the lines are connected. >> >> We cannot use MTLPrimitiveTypeLineStrip if we want to batch the subsequent >> draw calls as it draws an unwanted line between previous rectangle and >> current rectangle. > >> We cannot use MTLPrimitiveTypeLineStrip if we want to batch the subsequent >> draw calls as it draws an unwanted line between previous rectangle and >> current rectangle. > > Even if the alpha will be transparent? Just curious. Yes, there will be a transparent line between previous rectangle and current rectangle. This PR introduces batching of vertices of successive draw calls of the same primitive. If we keep on adding vertices to a common buffer and finally encode draw operation using MTLPrimitiveTypeLineStrip, all those vertices will be connected. If color is changed in between these successive draw calls, we end the current vertex batch and start a new one. ------------- PR: https://git.openjdk.org/jdk/pull/9245
