mirror of
https://github.com/panda3d/panda3d.git
synced 2025-09-29 08:15:18 -04:00
glgsg: warn if Cg shader uses float4 vtx_normal
See #495; Cg's glslv profile does not handle a float4 vtx_normal well and causes garbage to be in the w coordinate.
This commit is contained in:
parent
4a7266d420
commit
0cfd86d0f4
@ -157,6 +157,16 @@ CLP(CgShaderContext)(CLP(GraphicsStateGuardian) *glgsg, Shader *s) : ShaderConte
|
||||
break;
|
||||
case 2: // gl_Normal
|
||||
loc = CA_normal;
|
||||
if (cgGetParameterColumns(p) == 4) {
|
||||
// Don't declare vtx_normal with 4 coordinates; it results in it
|
||||
// reading the w coordinate from random memory.
|
||||
GLCAT.error()
|
||||
<< "Cg varying " << cgGetParameterName(p);
|
||||
if (cgGetParameterSemantic(p)) {
|
||||
GLCAT.error(false) << " : " << cgGetParameterSemantic(p);
|
||||
}
|
||||
GLCAT.error(false) << " should be declared as float4, not float3!\n";
|
||||
}
|
||||
break;
|
||||
case 3: // gl_Color
|
||||
loc = CA_color;
|
||||
|
Loading…
x
Reference in New Issue
Block a user