Jump to content

  • Log In with Google      Sign In   
  • Create Account


Validating shader vertex format?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
4 replies to this topic

#1 Telios   Members   -  Reputation: 398

Like
0Likes
Like

Posted 25 July 2012 - 12:54 PM

Hiya,

I'm making a couple of changes to my material/shader system, as it's lacking some validation which I would find helpful. I've finished the shader uniform side, so if a material file (XML) includes a uniform name which doesn't exist in the shader, or it's data type doesn't match, it's able to detect this instead of continuing blindly.

I'm looking for a way to also validate the shader against a vertex buffer format - is anyone aware of a way to get this information out of a compiled shader? It would be great if the system could realise, for example, that a particular shader wants normals but the vertex buffer doesn't have them.

Thanks for any advice!

Cheers.

[Edit] Should have mentioned this is using OpenGL.

Edited by Telios, 25 July 2012 - 01:01 PM.


Sponsor:

#2 Radikalizm   Crossbones+   -  Reputation: 2767

Like
1Likes
Like

Posted 25 July 2012 - 01:09 PM

Which API are you using for rendering?
In D3D10 and D3D11 (I don't know about D3D9, but I assume a reflection API exists for that as well) you can use the shader reflection API to get information about the input signature of your shader.
You could store this signature in your shader/material structure so you can use it to validate your vertex buffer.

Edit:

Ok, this obviously doesn't apply to OpenGL

Edited by Radikalizm, 25 July 2012 - 01:14 PM.


#3 Telios   Members   -  Reputation: 398

Like
0Likes
Like

Posted 25 July 2012 - 02:09 PM

Thanks - I think that's essentially what I need, but an OpenGL equivalent.

#4 teutonicus   Members   -  Reputation: 518

Like
1Likes
Like

Posted 25 July 2012 - 04:54 PM

The OpenGL equivalent is glGetActiveAttrib and related functions. The manpage explains it all very well.

Edited by teutonicus, 25 July 2012 - 04:55 PM.


#5 Telios   Members   -  Reputation: 398

Like
0Likes
Like

Posted 25 July 2012 - 04:55 PM

Perfect, thanks!




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS