samplerCubeShadow doesn't work, "Sampler object 1 does not have depth compare enabled"

I want to have soft shadows on my point lights. They work when I used the normal samplerCube shadowMap in my light source. However, as soon I switch to samplerCubeShadow shadowMap I get the following error every frame:

:display:gsg:glgsg(warning): Program undefined behavior warning: Sampler object 1 does not have depth compare enabled. It is being used with depth texture PointLight, by a program that samples it with a shadow sampler. This is undefined behavior.

I doubt this is a shader problem, it sounds like I need to set something differently on the Panda side?
Still, here’s the relevant part of the fragment shader:


float NEAR = 0.05;
float FAR = 20;
in vec4 shadow_coords;
uniform float use_shadows = 1.0;

uniform struct p3d_LightSourceParameters {
  // Primary light color.
  vec4 color;

  // Light color broken up into components, for compatibility with legacy
  // shaders.  These are now deprecated.
  vec4 ambient;
  vec4 diffuse;
  vec4 specular;

  // View-space position.  If w=0, this is a directional light, with the xyz
  // being -direction.
  vec4 position;

  // Spotlight-only settings
  vec3 spotDirection;
  float spotExponent;
  float spotCutoff;
  float spotCosCutoff;

  // Individual attenuation constants
  float constantAttenuation;
  float linearAttenuation;
  float quadraticAttenuation;

  // constant, linear, quadratic attenuation in one vector
  vec3 attenuation;

  // Shadow map for this light source
  //samplerCube shadowMap;
  samplerCubeShadow shadowMap;

  // Transforms view-space coordinates to shadow map coordinates
  mat4 shadowViewMatrix;
} p3d_LightSource[1];

float calcShadow( vec4 shadow_coords )
{
	vec4 coords;
	coords.xyz = shadow_coords.xyz / shadow_coords.w;
	float dist = max(abs(coords.x), max(abs(coords.y), abs(coords.z)));
	coords.w = (NEAR + FAR) / (FAR - NEAR) + ((-2 * FAR * NEAR) / (dist * (FAR - NEAR)));
	coords.w = coords.w * 0.5 + 0.5;

	// Works, with "samplerCube shadowMap":
	// float shadow = (texture( p3d_LightSource[0].shadowMap, coords.xyz, 1e-4 ).r > coords.w) ? 1.0 : 0.0;
	// Should work with "samplerCubeShadow shadowMap"
	float shadow = texture( p3d_LightSource[0].shadowMap, coords );
	return shadow;
}

Has anyone seen this error? Could someone tell me hot to “enable depth compare” for sampler 1? Has anyone used samplerCubeShadow’s for point lights in Panda3D?

After some brief tests, I don’t seem to get the depth comparison error when instantiating samplerCubeShadow.

You seem to be using samplerCubeShadow with a vec4 like the GLSL spec 4.40 describes. My next guess would be that you need some more information from the vertex shader.

I can try around some more, but did you throw together a test that I could run here? Maybe I’m doing something else wrong?

It might also be something with my somewhat outdated hardware - I just thought that shouldn’t be the problem because the compiler doesn’t complain…

It sounds like the depth texture does not have the FT_shadow filter mode enabled.

Can you share more code?