Pandadx9 and shader bugs

I’ve been testing Panda’s compatibility on various video configuration and noticed that the Dx9 pipeline is particularly buggy even for simple shaders.
If no textures are assigned to a model then I get an error

:display:gsg:dxgsg9(error): vertex_element_type_array check not implemented yet

If tangents and binormals are signed to the model, the same error message pops up. (There are other oddities, but these two are the simplest ones.)

I know everything works in PandaGl mode, but the last few days I’ve had a lot of differculties with bad vendor Opengl drivers. I was hoping PandaDx9 would be least offer some basic shader fallback mechanism, but it looks shaders + Pandadx9 = mucho unhappiness.

import direct.directbase.DirectStart
from pandac.PandaModules import *

tex0 = loader.loadTexture( '/c/Panda3D-1.7.1/models/maps/smiley.rgb')
tex0.setMinfilter(Texture.FTLinearMipmapLinear)
tex0.setMagfilter(Texture.FTLinear)
stageTex0 = TextureStage("Tex0")
stageTex0 .setSort(0)

npModel = loader.loadModel('/c/Test/test.egg')
npModel.setTexture(stageTex0,  tex0)

npModel.reparentTo( render )

shader = loader.loadShader('test.c')
npModel.setShader( shader )

base.cam.setPos( 0, 30, 0 )
base.cam.lookAt( 0,0,0)

run()

one triangle egg file

<CoordinateSystem> { Z-Up }

<Group> {
  <VertexPool> sphere {
	<Vertex> 0 {
	  0  0  0
	  <Normal> { 0  1 0 }
	  <UV> { 
		0.034905 0.257873 
        <Tangent> { 0 -3.83044e-009 -1 }
        <Binormal> { -1 -3.83044e-009 0 }
	   }
	 <RGBA> { 1 1 1 1 }
	}
	<Vertex> 1 {
	  0 0 10
	  <Normal> { 0  1 0 }
	  <UV> { 
		0.560034 0.005268
        <Tangent> { 0 -3.83044e-009 -1 }
        <Binormal> { -1 -3.83044e-009 0 }
	   }  
	 <RGBA> { 1 1 1 1 }
     }
	<Vertex> 2 {
	  10 0 0
 	  <Normal> { 0  1 0 }
	  <UV> { 0.055545 0.257958 
        <Tangent> { 0 -3.83044e-009 -1 }
        <Binormal> { -1 -3.83044e-009 0 }  
	   }
	  <RGBA> { 1 1 1 1 } 
	}  
   }
    <Polygon> {
	<VertexRef> { 0 1 2 <Ref> { sphere } }
  }
}

shader

//Cg
//
//Cg profile arbvp1 arbfp1 

void vshader(
	in uniform float4x4 mat_modelproj,
	float4 vtx_position : POSITION,
	in float2 vtx_texcoord0 : TEXCOORD0,
	in float3 vtx_normal: NORMAL,
	in float3 vtx_tangent0 : TANGENT,
	in float3 vtx_binormal0 : BINORMAL,
	
	out float2 l_texcoord0 : TEXCOORD0,
	out float3 l_normal : TEXCOORD1,
	out float4 l_position : POSITION )
{
	l_position = mul(mat_modelproj, vtx_position);
	l_texcoord0 = vtx_texcoord0;
	l_normal = vtx_normal;
}

void fshader( 
	out float4 o_color : COLOR)
{
	o_color = 1;
}

It’s true. In general: shaders + Pandadx9 = mucho unhappiness.

We are planning a directx rewrite for P2, which should bring mucha felicidad, but that would take a while.

I use shaders in directx currently though, and I can do almost anything I need, it’s just tricky and you have to stick to a safe subset of features.

Can you suggest a way to get tangents into the vertex shader?