revel8n / glfx

Automatically exported from code.google.com/p/glfx
BSD 2-Clause "Simplified" License
0 stars 0 forks source link

I tried to use a new glfx 0.7 and i have problem with passing a sctructure to vertex shader with "in" parametr??? #12

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I`m using Visual Studio 2012 and Windows 8 64 bit, the issue is simple

here is shader code:

struct VSInput1
{
    vec3 Position;
    vec2 TexCoord;
};

shader VSmain(in VSInput1 Vsin:0)                                               

{                                                                               

}
When compiling i have an error "Cannot be used with a structure in", how to 
solve this?
If i use an interface declaration instead of struct it says that interface 
cannot be used with vertex shader.

Please help.

Thanks Timur. 

Original issue reported on code.google.com by timur.ku...@stripedarts.com on 8 Apr 2013 at 5:28

GoogleCodeExporter commented 9 years ago
Hi Timur.
In strict GLSL you can't use structs for attributes. It just so happens that 
NVIDIA allows this syntax, so the misconception is that it's ok. AMD's drivers 
are more strict regarding this, and actively disallow this. I think (though not 
sure) that Intel is the same as AMD on this one.

You can solve this taking out the attributes outside of the struct, and declare 
each one independently in the definition of VSMain.

Original comment by max.snif...@gmail.com on 8 Apr 2013 at 8:05

GoogleCodeExporter commented 9 years ago
Very very very big thanks, i lost a day trying to figure out this and the 
answer is so somple.

Thanks again Timur.

Original comment by timur.ku...@stripedarts.com on 8 Apr 2013 at 10:22

GoogleCodeExporter commented 9 years ago
You're welcome

Original comment by max.snif...@gmail.com on 8 Apr 2013 at 10:25

GoogleCodeExporter commented 9 years ago

Original comment by max.snif...@gmail.com on 8 Apr 2013 at 10:27