游戏开发论坛

 找回密码
 立即注册
搜索
查看: 1353|回复: 0

关于在PIX调试时,变量被忽略的问题

[复制链接]

7

主题

26

帖子

26

积分

注册会员

Rank: 2

积分
26
发表于 2008-9-11 17:05:00 | 显示全部楼层 |阅读模式
Hi there.
I'm a new guy of learning HLSL.
Here is my question:
我的问题是:

I have several global matrix declared in the effect:
声明了几个全局矩阵变量,当然还有其他一些变量,这里就不贴了

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

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!
但是当用PIX调试时,发现g_mWorld被PIX忽略了!甚至所有与g_mWorld有关的语句都被忽略!

//========= 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 };
//

//========= 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 );

// chage it to the projection space and output to the oPos
oPos=mul( vPos, g_mProj );

// and change it from view space to the light projection space,
// output to the vPosLight
vPosInLight=mul( vPos, g_mViewToLightProj );

// this vertex's normal
vNormal=mul( nor, g_mWorldViewIT );

oTex=iTex;


I compile my HLSL using vs_3_0 and ps_3_0
我是用vs_3_0和ps_3_0来编译我的HLSL的
I'm told that at least there are 256 constant registers in vs_3_0, so it seems that it's not because of the lack of constant registers.
我看过资料说3.0至少有256个C#寄存器,我想这应该不是C#寄存器不够用的问题
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

作品发布|文章投稿|广告合作|关于本站|游戏开发论坛 ( 闽ICP备17032699号-3 )

GMT+8, 2026-1-22 06:16

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表