struct VS_INPUT
{
float3 Position : POSITION;
float3 Normal : NORMAL;
float2 Tex0 : TEXCOORD0;
float4 Weights : TEXCOORD1;
float4 Indices : TEXCOORD2;
};
struct VS_OUTPUT
{
float4 Pos : POSITION;
float3 Diffuse : COLOR;
float2 Tex0 : TEXCOORD0;
};
VS_OUTPUT main(VS_INPUT IN,
uniform float4x3 mWorldMatrixArray[22],
uniform float4x4 WorldViewProj)
{
VS_OUTPUT OUT;
float3 Normal = 0.0f;
float i; // Index into matrix palette
float4 inPos;
inPos.xyz = IN.Position;
inPos.w = 1;
float3 tempPos, tempNormal;
/////////////////////////////////////////////////////////////////////
// FIRST BONE
// We don't worry about the ELSE condition because we defined the
// initial conditions.
// grab first bone matrix
i = IN.Indices.x;
// First transformed position and normal
tempPos = mul(inPos, mWorldMatrixArray) * IN.Weights.x;
tempNormal = mul(IN.Normal, (float3x3)mWorldMatrixArray) * IN.Weights.x;
/////////////////////////////////////////////////////////////////////
// SECOND BONE
// Next bone.
i = IN.Indices.y;
// Add second transformed position and normal
tempPos += mul(inPos, mWorldMatrixArray) * IN.Weights.y;
tempNormal += mul(IN.Normal, (float3x3)mWorldMatrixArray) * IN.Weights.y;
/////////////////////////////////////////////////////////////////////
// THIRD BONE
// Note we only skin the normal by the first two bones, these are by
// far the most significant.
i = IN.Indices.z;
// Add third transformed position only
tempPos += mul(inPos, mWorldMatrixArray) * IN.Weights.z;
/////////////////////////////////////////////////////////////////////
// FOURTH BONE
i = IN.Indices.w;
// Add fourth transformed position only
tempPos += mul(inPos, mWorldMatrixArray) * IN.Weights.w;
// normalize normals
Normal = normalize(tempNormal);
//OUT.Diffuse.xyz = max(dot(Normal, lhtDir), 0).xxx;
OUT.Diffuse.x=1;
OUT.Diffuse.y=1;
OUT.Diffuse.z=1;
// copy the input texture coordinate through
OUT.Tex0 = IN.Tex0.xy;
float4 finalPos;
finalPos.xyz = tempPos;
finalPos.w = 1;
// Transform the final skinned position
OUT.Pos = mul(finalPos, WorldViewProj);
return OUT;
}
nvidia cgc 1.5 hangs??
I have a vertex shader that compiles without problems with cgc 1.4.1
but when i try to compile it with cgc 1.5 (beta 1 or 2), cgc hangs (100% cpu) and never compiles the program, it only output the name of the input file and stops there without ever finishing,
im using vs_1_1
cgc 1.4.1 doesnt have any profileopts for it
cgc 1.5 has a profileopt for max constant register, which i set to 255
any ideas??? :( :(
here is the program (not mine)
bump. is my question that stupid ??? [bawling][bawling][bawling]
[Edited by - PinkFish on September 14, 2006 6:49:18 AM]
[Edited by - PinkFish on September 14, 2006 6:49:18 AM]
Quote:Original post by PinkFish
bump. is my question that stupid ??? [bawling][bawling][bawling]
Well cg 1.5 IS still in beta-phase, you might wanna report this to nVidia. I bet that this shader is too complicated for vs_1_1 profile, I tested this on linux and it hanged on me too. Worked with vs_2_0 profile though.
ch.
ah thanx a lot for trying it out!
this shader was writting with vs_1_1 in mind (at least that what the author says)
and it compiles ok with vs_1_1 with cgc 1.4.1 as i mentioned b4.
do u think it makes sense reporting it to nvidia? (will they even look at it?)
and whats the best way to do that? their developer feedback form?
clicky
this shader was writting with vs_1_1 in mind (at least that what the author says)
and it compiles ok with vs_1_1 with cgc 1.4.1 as i mentioned b4.
do u think it makes sense reporting it to nvidia? (will they even look at it?)
and whats the best way to do that? their developer feedback form?
clicky
I work on the NVIDIA Cg runtime team, I'll check into this.
My NVIDIA email is tgrimes@nvidia.com incase you have other Cg issues.
Thanks.
My NVIDIA email is tgrimes@nvidia.com incase you have other Cg issues.
Thanks.
Ok I see what you mean.
With the latest code we have as of RIGHT NOW, I don't get a hang but the compiler does give an assertion about "profile does not support spilling."
Since I don't work on the compiler I'm not 100% sure what they mean by that, but I'll file a bug report since I can see, like you say, it does work in 1.4.1.
For now you'll have to use vs_2_0 or higher since compilation works fine in those profiles.
Thanks.
With the latest code we have as of RIGHT NOW, I don't get a hang but the compiler does give an assertion about "profile does not support spilling."
Since I don't work on the compiler I'm not 100% sure what they mean by that, but I'll file a bug report since I can see, like you say, it does work in 1.4.1.
For now you'll have to use vs_2_0 or higher since compilation works fine in those profiles.
Thanks.
If 1.4 does everything you need then you can stick with it for a while longer. Or you could stay with 1.5 and not use vs_1_1, but instead 2_0 or higher as long as that's an option for you.
However, 1.5 improved the D3D9 runtime A LOT so if you're using D3D9, it would be best to use 1.5 if possible.
However, 1.5 improved the D3D9 runtime A LOT so if you're using D3D9, it would be best to use 1.5 if possible.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement