Jump to content
  • Advertisement
Sign in to follow this  
TheLinuxhippy

Best way to pass parameters to a glsl shader with very low overhead?

This topic is 3453 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

Hello, I have to draw high-quality antialiased 2D trapezoids. There are very strict quality regulations, so I can't use multisampling of fsaa. The problem I am faicng is that I don't know a good way to transport the trapezoid geometry down to the shader? I experimented using textures accessed by the shader, but to make this route efficiently I would have to render many trapezoids in one go, which makes the loopup-routines (to decide which pixel-value in the command-texture is which trapezoid and so on) very complex and slow. Ideally I would like to draw a single trapezoid per quad I render, with a very low overhead method of telling the shader the properties of the next trapezoid. Whats the preferred way to do so? Something like repeated: 1. Set properties of next trapezoid 2. Render one single trapezoid (shader on quad) I have heard the shader is re-compiled as when uniforms are changed, so that would have way too much overhead. Or is this information outdated? Can the problem above solved efficiently at all? Thank you in advance, Clemens

Share this post


Link to post
Share on other sites
Advertisement
Quote:
Original post by TheLinuxhippy
I have heard the shader is re-compiled as when uniforms are changed, so that would have way too much overhead. Or is this information outdated?
Can the problem above solved efficiently at all?


It was said that on nvidia, when you set certain values for uniforms like 0.0, 0.5, 1.0, 2.0, it would recompile your shader in order to optimize it.
For other values, it does not recompile.
This is a problem for games and application where there is a lot of animation and uniforms are changing all the time.
I don't want my shader to recompile if I suddenly set something to 0.0 because I have hundreds of shaders.
I haven't retested this to see if nvidia changed things.

Share this post


Link to post
Share on other sites
And do you know how slow setting uniforms is, if the driver doesn't do crazy things?
Is it the preferred way to transport small amounts of data into the shader frequently?

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!