GLSL compile error with noise1 function

When I use the “noise1” built-in function I get a compile error when running the debugger. This only seems to be when I use the function in a dynamic subroutine. The code compiles when I run the program normally

#version 400 core
#extension GL_EXT_gpu_shader4 : enable
#extension GL_ARB_separate_shader_objects : enable

struct vertex_struct
{
  vec4  colour;
  vec3	fragmentNormal;
  vec3	dummy;
  vec2	texture0;
  vec2	texture1;
};

layout(location = 0, index = 0) out vec4 fFragColour;

subroutine vec4 fetchColour_Type(vec2 p_ST, vec4 p_Vertex_Colour);
subroutine uniform fetchColour_Type u_fetchColour;

//
// procedural texture from slope and height
// 
subroutine (fetchColour_Type)
vec4  fetchTinProceduralColour(vec2 p_ST, vec4 p_Colour)
{
  float mixer = 0;
  mixer = (noise1(p_ST) + 1) / 2.0f;
  return vec4(mixer,1,1,1);

}

in  vertex_struct     vData;
void main()
{
#if (1)
  vec4 colour = vData.colour;
  colour = u_fetchColour(vData.texture0.st,colour);
#else
  float mixer = 0;
  mixer = (noise1(vData.texture0.st) + 1) / 2.0f;
  vec4 colour = vec4(mixer,1,1,1);
#endif
  fFragColour = colour;
}

I am using nSight version 3.1 build 3.1.0.13204, driver 326.19 64bit, nVidia 770

Hi,

Can you post the error message or what you see? What OS are you on? Could you try the latest driver build 326.41?
Thanks

I have installed the beta driver and get the same error

I am using Windows 7 64bit

Error
javascript:void();
We failed to link program Fragment Info
(0) fatal error C9999 *** exception during compilation ***

My compile logic is

compile vertex shader
compile fragment shader
link

ignore that line “javascript:void():” I don’tknow where that can from

Hi tonyo_au,

unfortunately, you are hitting a compiler bug related to function parameter passing we have already fixed, but did not make it into the release driver, yet.

As a workaround until a fixed driver is available you could try the following: Change your subroutine to

vec4 fetchTinProceduralColour(vec2 p_ST, vec4 p_Colour)
{
    vec2 v = p_ST;
    float mixer = (noise1(v) + 1) / 2.0f;
    return vec4(mixer,1,1,1);
}

Thanks,
I have a work around by supplying my own perlin noise function