Shaders Demo explanation of low level shader language

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
WhyMe
Posts: 10
Joined: Sat Jan 26, 2013 5:31 pm

Shaders Demo explanation of low level shader language

Post by WhyMe »

Hello.
I study shader tutorial, and i can't understand how to manage with registers, when I want to use Assembler language.

In the example:

Code: Select all

 
//Shader Tutorial
if (UseHighLevelShaders)
            services->setVertexShaderConstant("mInvWorld", invWorld.pointer(), 16);
        else
            services->setVertexShaderConstant(invWorld.pointer(), 0, 4);
 
I understand, that, in HLSL, last factor means size (e.g. matrix4(4x4) = 16, pos(x,y,z) = 3, scolor(a,r,g,b) = 4, etc.).

I have read documentation and I understand, that in case Assembler language, if is written (0,4) it means range, use first register on position 0 to register number 3 (use all 4) . Text from documentation "constantAmount,: Amount of registers to be set. One register consists of 4 floats." did it means, that in one register I can store four vaules (for matrix4 do I need have 4 registers, not 16) ?
But how much registers can I use ? I tried change the numbers, but sometimes shaders are not drawn or have different colour (green or red mixed with yellow I think).
I don't get idea about these registers.

Best regards.
Post Reply