cancel
Showing results for 
Search instead for 
Did you mean: 

OpenGL & Vulkan

peng
Journeyman III

GLSL uniform struct init in shader error!

Jump to solution

Hello,

When I want to initialize uniform struct variable an unexpected error is generated.

link program fail!Vertex shader(s) failed to link, fragment shader(s) failed to link.

unexpected error.

unexpected error.

The shader codes:

struct LightSource{

    vec4 ambient;

    vec4 diffuse;

    vec4 specular;

    vec4 position;

    float attenConstant;

   float attenLinear;

    float attenQuadratic;

   bool enableAtten;//Enable or disable attenuation

};

uniform LightSource defaultLightSource=LightSource( vec4(0.1,0.1,0.1,1.0),//ambient

vec4(1.0,1.0,1.0,1.0),//diffuse

vec4(1.0,1.0,1.0,1.0),//specular

vec4(-0.0,0.0,5.0,1.0),//position

1.0,0.005,0.0005,false);

I tested these code on windows 7 with ATI mobility Radeon HD 3470. Is it a bug ?

Thanks!


0 Kudos
Reply
1 Solution

Accepted Solutions
farosis
Adept I

Re: GLSL uniform struct init in shader error!

Jump to solution

It has been fixed internally, you will get it in future release, thanks!

View solution in original post

4 Replies
gsellers
Staff
Staff

Re: GLSL uniform struct init in shader error!

Jump to solution

Hi peng,

Yes, whenever you see "Unexpected Error", that's effectively an internal compiler error and shouldn't happen, even for illegal shaders. You have hit a bug - thanks very much for finding it! I just reproduced it on our internal builds, so it's still there. I'll have our compiler guys take a look at it.

Thanks,

Graham

0 Kudos
Reply
farosis
Adept I

Re: GLSL uniform struct init in shader error!

Jump to solution

Can you post all the shader source you used for linking? I tried with you code piece, but It links successfully.

0 Kudos
Reply
peng
Journeyman III

Re: GLSL uniform struct init in shader error!

Jump to solution

Hi,

farosis 撰写:

Can you post all the shader source you used for linking? I tried with you code piece, but It links successfully.

The complete shader files are attached (It is annoying to paste the codes into the reply which takes each row as separated part ). It is a simple implementation of Phong shading.

Thanks!

0 Kudos
Reply
farosis
Adept I

Re: GLSL uniform struct init in shader error!

Jump to solution

It has been fixed internally, you will get it in future release, thanks!

View solution in original post