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;
}