Problem with compile shader from file

Started by
37 comments, last by Asesh 12 years ago
I find only one problem:
cfae492ce2e9.jpg
before VS all vertexes have different position
2500eb7f542f.jpg
and after VS all 0...so how to fix it?
Advertisement
see that column VTX in PostVS tab? 0 1 2 3...click one of those and debug your vertex shader. IDX are indices, looking that picture, they are not correct either. Am guessing, the homogeneous matrix is not being update in the shader. Debug and find it out

//
// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
//
// Parameters:
//
// float4x4 worldViewProj;
//
//
// Registers:
//
// Name Reg Size
// ------------- ----- ----
// worldViewProj c0 4
//

vs_2_0
def c4, 1, 0, 0, 0
dcl_position v0
dcl_color v1
dcl_texcoord v2
mad r0, v0.xyzx, c4.xxxy, c4.yyyx
dp4 oPos.x, r0, c0
dp4 oPos.y, r0, c1
dp4 oPos.z, r0, c2
dp4 oPos.w, r0, c3
mov oD0, v1
mov oT0.xy, v2

// approximately 7 instruction slots used

if i understand correctly this is 0 vertex debug.
and Registry:
c4 (1.000,0.000,0.000,0.000) float4
v0 (909.163,59.139,-1585.124,1.000) float4

and what is wrong? I can post my VS too.
As far as I remember c# are constant registers and v# are output registers but don't remember much though. Debug your shader in via HLSL rather than going through the disassembled code...anyways, when debugging your shader monitor the value of variables from the variables tab. Look at the value of homogeneous matrix from that tab.
Rather than waiting for someone to reply goto gamedev chat room: [color=#009933][font=arial, sans-serif][size=1]www.[/font]gamedev[color=#009933][font=arial, sans-serif][size=1].net/community/[/font]chat
Rather than waiting for someone to reply goto gamedev chat room: http://www.gamedev.net/community/chat
well i asked there and sb tell me that i can multiply anything by a zero matrix and tend to get null vectors.
...

float4x4 worldViewProj;

struct VS_INPUT
{
float3 position : POSITION;
float4 color0 : COLOR0;
float2 texcoord0 : TEXCOORD0;
};

struct VS_OUTPUT
{
float4 hposition : POSITION;
float4 color0 : COLOR0;
float2 texcoord0 : TEXCOORD0;
};

VS_OUTPUT main( VS_INPUT IN )
{
VS_OUTPUT OUT;

float4 v = float4( IN.position.x,
IN.position.y,
IN.position.z,
1.0f );

OUT.hposition = mul( v, worldViewProj );
OUT.color0 = IN.color0;
OUT.texcoord0 = IN.texcoord0;

return OUT;
}

its my shader code...where can i multiply by a zero here?
well, use PIX to check the value of [color=#000000][size=2]

worldViewProj

in your shader. Am sure that matrix is not being updated in the shader from external source
BTW, there's nothing wrong in that shader...

well, use PIX to check the value of

i tried maybe all...rad SDK and i don't know how to chek it sad.png , can you plz tell me where i can see it?

P.S. If you sure where is the problem - can you simply say how to fix it?

This topic is closed to new replies.

Advertisement