OgreUnifiedShader.h: How can I use varyings?

Problems building or running the engine, queries about how to use features etc.
slapin
Bronze Sponsor
Bronze Sponsor
Posts: 146
Joined: Fri May 23, 2025 5:04 pm
x 5

OgreUnifiedShader.h: How can I use varyings?

Post by slapin »

Ogre Version: master branch
Operating System: Ubuntu 22.04
Render System: OpennGL ES 2.0
Please help me with shader problem.

Using OgreUnifiedShader.h how can I write equivalent of

Code: Select all

varying mat3 rotMatrix;

? which positions can be used for that? I see that 0-15 are used by attributes,
but I see sample shaders use these indices for OUT(mat3 rotMatrix, TEXCOORD1) which is strange to me. How many varyings can I have?
I'm porting shader with large number of varyings so I wonder...

if I do OUT(mat3 rotMatrix, 17) in vertex shader and IN(mat3 rotMatrix, 17) I get shader linking errors.

paroj
OGRE Team Member
OGRE Team Member
Posts: 2204
Joined: Sun Mar 30, 2014 2:51 pm
x 1188

Re: OgreUnifiedShader.h: How can I use varyings?

Post by paroj »

OUT(mat3 rotMatrix, 17) will work on GLSL but is not portable to HLSL where you must use symbolic semantics. Also keep in mind that older GLSL matches varyings by name and the index is ignored,

The amount of varyings depends on your target hardware. Some ES2 devices only allow 8.

slapin
Bronze Sponsor
Bronze Sponsor
Posts: 146
Joined: Fri May 23, 2025 5:04 pm
x 5

Re: OgreUnifiedShader.h: How can I use varyings?

Post by slapin »

But why are used names match the attribute names like TEXCOORD0?

paroj
OGRE Team Member
OGRE Team Member
Posts: 2204
Joined: Sun Mar 30, 2014 2:51 pm
x 1188

Re: OgreUnifiedShader.h: How can I use varyings?

Post by paroj »

these are HLSL semantics and needed for HLSL compatibility. On GLSL they are just numbers:
https://github.com/OGRECave/ogre/blob/c ... der.h#L166