您的位置:首页 > 运维架构

Missing Variable in HLSL because of Optimization

2008-11-15 20:53 309 查看
  I'm suck!
  I've encountered a effect problem described like this:

 

  While I was debugging a effect by PIX, one of the matrix variable was missing in the ASM codes!

 

float4x4 g_mWorld;
float4x4 g_mView;
float4x4 g_mWorldViewIT;
float4x4 g_mProj;
float4x4 g_mViewToLightProj;

//========= ASM register declaration comments ===============
//
// Generated by Microsoft (R) HLSL Shader Compiler 9.22.949.2248
//
// Parameters:
//
// float4x4 g_mProj;
// float4x4 g_mView;
// float4x4 g_mViewToLightProj;
// float4x4 g_mWorldViewIT;

//
//
// Registers:
//
// Name Reg Size
// ------------------ ----- ----
// g_mView c0 4
// g_mProj c4 4
// g_mViewToLightProj c8 4
// g_mWorldViewIT c12 3

//
//
// Default values:
//
// g_mView
// c0 = { 0, 0, 0, 0 };
// c1 = { 0, 0, 0, 0 };
// c2 = { 0, 0, 0, 0 };
// c3 = { 0, 0, 0, 0 };
//
// g_mProj
// c4 = { 0, 0, 0, 0 };
// c5 = { 0, 0, 0, 0 };
// c6 = { 0, 0, 0, 0 };
// c7 = { 0, 0, 0, 0 };
//
// g_mViewToLightProj
// c8 = { 0, 0, 0, 0 };
// c9 = { 0, 0, 0, 0 };
// c10 = { 0, 0, 0, 0 };
// c11 = { 0, 0, 0, 0 };
//
// g_mWorldViewIT
// c12 = { 0, 0, 0, 0 };
// c13 = { 0, 0, 0, 0 };
// c14 = { 0, 0, 0, 0 };
//

  However, while I'm debuging this effect in PIX, I see that the matrix g_mWorld is missing!
And even all the instructions which use g_mWorld are ignored by the PIX!
I'm so puzzled!

 

//========= ASM instructions ===============
vs_3_0
dcl_position v0 // iPos<0,1,2,3>
dcl_normal v1 // nor<0,1,2,3>
dcl_texcoord v2 // iTex<0,1>
dcl_position o0
dcl_texcoord o1.xy
dcl_texcoord1 o2
dcl_texcoord2 o3.xyz
dcl_texcoord3 o4
dp4 r0.x, v0, c0 // vPos<0>
dp4 r0.y, v0, c1 // vPos<1>
dp4 r0.z, v0, c2 // vPos<2>
dp4 r0.w, v0, c3 // vPos<3>
mov o2.x, r0.x // vPos<0>
mov o2.y, r0.y // vPos<1>
mov o2.z, r0.z // vPos<2>
mov o2.w, r0.w // vPos<3>
dp4 o0.x, r0, c4 // oPos<0>
dp4 o0.y, r0, c5 // oPos<1>
dp4 o0.z, r0, c6 // oPos<2>
dp4 o0.w, r0, c7 // oPos<3>
dp4 o4.x, r0, c8 // vPosInLight<0>
dp4 o4.y, r0, c9 // vPosInLight<1>
dp4 o4.z, r0, c10 // vPosInLight<2>
dp4 o4.w, r0, c11 // vPosInLight<3>
dp4 o3.x, v1, c12 // vNormal<0>
dp4 o3.y, v1, c13 // vNormal<1>
dp4 o3.z, v1, c14 // vNormal<2>
mov o1.xy, v2 // oTex<0,1>

// approximately 20 instruction slots used

//============== HLSL edition ====================
vPos=mul( iPos, g_mWorld );// this statement is ignored by the PIX
vPos=mul( iPos, g_mView );
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
相关文章推荐