Skip to main content
gamedev.net
🔒 Locked

Index adder status?

Started by Krohm 5 replies 1.7k views
Original Post
Krohm
Krohm
I have this... rather complex system which is using index adder tricks. Let me say that I have gone away from GL some years ago, let's say one year before GL1.7 GL3.0's release. So I have understood that index adders can be fetched as Draw9 parameters and that they must be transformed to byte offsets for Draw10. I remember I've read something, years ago, on the possibility of adding similar index adder functionality to GL, but I think it was just a rumor. I'm not up to date with those relatively recent "extensions". So, what's the state of Index Adders? I mean, on a per-drawcall basis. Sure I can add this using VertexAttribPointer but it seems a bit too much "oldskool" for my current likings. And I'm not even sure I could trust it. Could you update me on those notions?
Previously "Krohm"
HuntsMan
HuntsMan
You mind to say what an Index Adder is? Perhaps nobody is answering because they don't get what you want.

And glVertexAttribPointer isn't oldschool, actually in GL 3.1 is the only way to specify vertex attributes.
Yann L
Yann L
I'm not sure what you mean by "index adders" either, but from context, I suspect that you refer to instancing. If so then yes, this has been solved.
Krohm
Krohm
Yes, thank you. Reading again my message I figure out I have been a bit too criptic.
The 'index adder' which I am referring to, is a number added to each index fetched from the Index Buffer before accessing the vertex blob in the Vertex Buffer. As such, it's roughtly equivalent to a vertex-aligned offset in VertexAttribPointer.
It's D3D9 "BaseVertexIndex" parameter in DrawIndexedPrimitive.

What's a bit too oldschool with that approach (there's no problem with VertexAttribPointer by itself, I've been using it since it was available) is that I had the feeling this could also be specified rather cheaply in other API's drawcalls.

Do you think I can safely assume that VertexAttribPointer(, newOffset) is shortcircuited?
Previously "Krohm"
V-man
V-man
No, that functionality is not available to GL.
Calling glVertexAttribPointer with a different address is doable but I'm not sure if there is a performance penalty.
The alternate option (the one I use) is to offset the indices before uploading them to the IBO. I do this only at startup.
Krohm
Krohm
I hope we'll see some sort of index adder support in GL4 (uff!).
In the meanwhile, I've found a few options which seem to zero-out the index adder, properly using incremental indices as you say. Looks like the original author already took this in consideration; I still don't understand why an index adder was being used in the first place, but this is another problem.

You see, the inability to ensure a performance pattern is my primary concern.
Previously "Krohm"
V-man
V-man
Quote:
Original post by Krohm
You see, the inability to ensure a performance pattern is my primary concern.


That's why Direct3D was invented.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.