Hi,
I’ve a stupid question: what is the cost of textureSize ?
My concern: if we know at compilation time the size of texture, does it worth to bake the size as a “#define” or a “const int” ?
Thanks
Hi,
I’ve a stupid question: what is the cost of textureSize ?
My concern: if we know at compilation time the size of texture, does it worth to bake the size as a “#define” or a “const int” ?
Thanks
You may be able to choose particular filtering kernels and code paths when texture sizes are known in advance. Thus not using textureSize could win in some cases.
In simpler cases where textureSize is not involved in selecting which code paths to use, I’d say it is pretty safe to assume textureSize doesn’t have a cost. There might be a partial recompilation of the program when used with different kind of textures. But that cost could be there even if you did not use textureSize.
Most cards implement textureSize as access to uniform value, so:
Thanks for those answers !