PDA

View Full Version : Cost of a simple texture-access



Jan
06-05-2004, 07:59 AM
Hi there

In a shader i (theoretically) want to fetch a material-value from a texture. However some objects wonīt have such a material, so that itīs value will always be 1 or 0.
Now, instead of writing another shader (and of course switching between lots of only slightly different shaders), i can also bind a "dummy"-texture, which is plain white or black.

Of course such a texture would only be 2x2, or so. So, how expensive is such texture-access ? Should i expect the same performance hit, as if i used a bigger texture, or should it be very fast ?

Thanks,
Jan.

crystall
06-06-2004, 05:48 AM
Originally posted by Jan:
Of course such a texture would only be 2x2, or so. So, how expensive is such texture-access ? Should i expect the same performance hit, as if i used a bigger texture, or should it be very fast ?
If you use a very small texture (like 2x2) every access to it will go to the GPU's caches so you won't use much bandwidth. On the other hand you will still be consuming some fill-rate so depending on the hardware there will be a decrease in performance albeit small.

harsman
06-08-2004, 02:13 AM
You know the answer Jan: benchmark it!

There's no other way to know really. Unless your pixel shader limited and have many texture sampling instructions, I doubt it would make much difference to performance, but it's impossible to know without testing. The shaders I've written are mostly math bound, not texture op bound, but this obviously varies depending on app.

Tzupy
06-09-2004, 04:37 AM
Hi,
Texture binding can be a slow-down factor if you use many textures (thousands). But if you consolidate your 2x2 textures into a larger one, like 128x128, you wouldn't spend much time with the binding.