Shader constant size.

Started by
3 comments, last by PumpkinPieman 16 years, 9 months ago
I've been looking around google and gamedev, and I can't seem to find out an exact value as to how many floats can be pushed to the graphics card as constant uniform data. (and the gl equiv for uniform) Just a list will do comparing each version of the shaders will do. Thanks a bunch guys! (hows that for a quick question? :grin:)
Advertisement
I don't know for the other shader languages [smile] but CUDA allows up to 64KB of constants.
The DirectX documentation is the best place to look: Vertex Shader Registers and Pixel Shader Registers

Basically it breaks down like this (remember each constant holds 4 floats):

SM1:
Pixel Shader - 8 Constant registers
Vertex Shader - 96

SM2:
PS - 32
VS - 256

SM3:
PS - 224
VS - 256

DirectX 10 works a bit differently. You no longer have constant registers but constant buffers. Each constant buffer can hold up to 4096 constants and you can have up to 16 constant buffers set at a time. DirectX 10 has unified shaders so the limit is the same for vertex, pixel and geometry shaders.

Game Programming Blog: www.mattnewport.com/blog

u can query this in opengl with a glGet... ( ) command see the back of the gl spec for a list

eg
glGetIntergerv( MAX FRAGMENT UNIFORM COMPONENTS, num );
Great! Thanks a bunch.

This topic is closed to new replies.

Advertisement