Gray textures in Panda3d 1.9 (Even text!)

I know I shouldn’t expect stability from the snapshots, but this is just too weird. It happens with all published snaphots, but not in 1.8.1:

I was hoping someone might recognize this as a symptom of me doing something wrong.

Apparently it happens if there is a hand-crafterd Geom anywhere in the scene

But only with setShaderAuto.

Minimal code to reproduce:

import direct.directbase.DirectStart
from direct.gui.OnscreenText import OnscreenText

from panda3d.core import *

base.setBackgroundColor(0.5, 0.5, 0.5)

t = OnscreenText(text='asdallaskjf')
t.reparentTo(base.aspect2d)

vertexformat = GeomVertexFormat.getV3n3t2()
vertexdata = GeomVertexData('data', vertexformat, Geom.UHStatic)

vertex_writer = GeomVertexWriter(vertexdata, 'vertex')
normal_writer = GeomVertexWriter(vertexdata, 'normal')
texcoord_writer = GeomVertexWriter(vertexdata, 'texcoord')

for i in range(3):
    vertex_writer.addData3f(i, i, i)
    normal_writer.addData3f(0, 0, 0)
    texcoord_writer.addData2f(0, 0)

primitive = GeomTriangles(Geom.UHStatic)
primitive.addVertices(0, 1, 2)

geom = Geom(vertexdata)
geom.addPrimitive(primitive)
gnode = GeomNode('gn')
gnode.addGeom(geom)

# if either of these two lines is missing, the onscreenttext is fine.
render.setShaderAuto()
base.render.attachNewNode(gnode)

run()

Yep, basic-shaders-only fixes it.

But with basic-shaders-only there are no shaders at all. Here are the (compiled) broken shaders:

vertex

// glslv output by Cg compiler
// cgc version 3.1.0013, build date Apr 18 2012
// command line args: -q -no_uniform_blocks -profile glslv -entry vshader
//vendor NVIDIA Corporation
//version 3.1.0.13
//profile glslv
//program vshader
//semantic vshader.mat_modelproj
//var float4x4 mat_modelproj :  : _mat_modelproj1[0], 4 : 2 : 1
//var float4 vtx_position : $vin.POSITION : ATTR0 : 0 : 1
//var float4 l_position : $vout.POSITION : HPOS : 1 : 1

#version 110

vec4 _l_position1;
uniform vec4 _mat_modelproj1[4];
vec4 _r0002;

 // main procedure, the original name was vshader
void main()
{


    _r0002.x = dot(_mat_modelproj1[0], gl_Vertex);
    _r0002.y = dot(_mat_modelproj1[1], gl_Vertex);
    _r0002.z = dot(_mat_modelproj1[2], gl_Vertex);
    _r0002.w = dot(_mat_modelproj1[3], gl_Vertex);
    _l_position1 = _r0002;
    gl_Position = _r0002;
} // main end

fragment (no texture lookups :frowning: )

// glslf output by Cg compiler
// cgc version 3.1.0013, build date Apr 18 2012
// command line args: -q -no_uniform_blocks -profile glslf -entry fshader
//vendor NVIDIA Corporation
//version 3.1.0.13
//profile glslf
//program fshader
//semantic fshader.attr_color
//semantic fshader.attr_colorscale
//var float4 attr_colorscale :  : _attr_colorscale1 : 2 : 1
//var float4 o_color : $vout.COLOR0 : COL : 0 : 1

#version 110

vec4 _o_color1;
uniform vec4 _attr_colorscale1;

 // main procedure, the original name was fshader
void main()
{


    _o_color1 = _attr_colorscale1*1.00000095E+000;
    gl_FragColor = _o_color1;
} // main end

This is on an AMD HD7970

This is the code you get when you put loadPrcFileData("", “dump-generated-shaders 1”) in your script?

Shouldn’t the auto-shader generate cg code? This looks like glsl.

No, this is what the Cg compiles to. I’m seeing this in AMD CodeXL. This is the Cg dump:

//Cg
/* Generated shader for render state 0000000004FF8918:
  ShaderAttrib
*/
void vshader(
	 float4 vtx_position : POSITION,
	 out float4 l_position : POSITION,
	 uniform float4x4 mat_modelproj
) {
	 l_position = mul(mat_modelproj, vtx_position);
}

void fshader(
	 out float4 o_color : COLOR0,
	 uniform float4 attr_color,
	 uniform float4 attr_colorscale
) {
	 float4 result;
	 // Fetch all textures.
	 result = float4(1,1,1,1);
	 result *= attr_colorscale;
	 o_color = result * 1.000001;
}

I confirm this problem. For this reason, I rolled back from 1.9dev to 1.8.1

Bug report, please.