View Full Version : gl_VertexID alternative?
02-26-2012, 06:16 AM
Hello, my latest GLES2 shader (iPhone 3GS+) can be highly optimised if it knew which index was being processed. I don't want to send an ID stream as that would be an additional 32bits for the large amount of indices required. I need an alternative to gl_VertexID please, any ideas?
Also, no logical operations? (var &15) ...seems like things are being restricted somewhere. Are operations on a lowp int expected to be used, as 'ubyte' for example is also missing. TIA.
Unfortunately an ID stream is the only possible alternative, unless your vertices are e.g. arranged as a grid so that you have a simple relation between index and position.
GLES2 implementations are not actually required to have an integer ALU - all operations allowed with integers can be performed using floating point math.
03-01-2012, 08:07 AM
Thanks for clarifying. Looks like you guessed why a vertex ID would have been interesting to me...I was experimenting with voxels. Conclusion: Would now love to see a dedicated voxel chip with *zero* indices per voxel. Initially I thought 2 per voxel (position ID and preset ID), but that doesn't make sense from an editing point of view (though I guess a push to chunk system could work). The only semi-sane VBO I could come up with was slow. So it's back to the nice optimised mesh for me lol, cheers!
Also yes I've been starting to manually compute the other requirements. Just checking I wasn't reinventing the wheel, certainly at vertex level things are fast enough to perform allsorts of antics :-)
Powered by vBulletin® Version 4.2.2 Copyright © 2014 vBulletin Solutions, Inc. All rights reserved.