Jump to content
  • Advertisement
Sign in to follow this  
Ataru

CG optimization

This topic is 4875 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I've been looking at my debugger output for shader performance using CG and I found some distressing stuff. To confirm, I ran some of NVIDIA's cg examples and I'm getting the same calls. Something like this: glGetProgramivARB(GL_FRAGMENT_PROGRAM_ARB,GL_PROGRAM_BINDING_ARB,0x....) glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB,8) glProgramLoacalParamter4dvARB(GL_FRAGMENT_PROGRAM_ARB,0,....) glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB,8) glGetProgramivARB(GL_FRAGMENT_PROGRAM_ARB,GL_PROGRAM_BINDING_ARB,0x....) glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB,8) glProgramLoacalParamter4dvARB(GL_FRAGMENT_PROGRAM_ARB,1,....) glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB,8) and so on... and this process repeats for every single local parameter. I thought the idea was to have glProgramLocalParam() glProgramLocalParam() glProgramLocalParam() . . . and then one call to glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB,8) or whatever the fragment program. Anyone know why CG has to call glGetProgramivARB every single time? I doubt the driver is ignoring all the glBindProgram calls. Is Cg really this inefficient, or are there ways to prevent this? Any info is appreciated.

Share this post


Link to post
Share on other sites
Advertisement
Quote:
I ran some of NVIDIA's cg examples

examples are usually writen (i hope) for (*)clarity first, performance shouldnt be part of the equation

(*)though many aint even written with that

Share this post


Link to post
Share on other sites
I understand that, but it seems to me like this is a Cg thing in general. I mean these calls are not being made by the examples, they're being made by Cg. I can't believe it's that inefficient.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!