|
发表于 2011-4-26 21:03:00
|
显示全部楼层
Re:使用Effect时出现的问题(龙书第19章)
这个论坛之前有人说过了·······
error X3025: global variables are implicitly constant, enable compatibility mode to allow modification
全局变量是extern也是常量,在shader里面不能修改,但可以从宿主程序里改。
以前的编译器没有强制这一点,新DirectX版本强化了这一要求。
解决方法:
extern的值不能修改 也就是说错误是因为该shader修改了。
new一个vector/float4 然后把不能修改的赋值
源程序代码相关部分替换示例代码:
//////////////////////////////////////////////////////////////////////////////////////
float4 LD=LightDirection;
LD.w = 0.0f;
input.normal.w = 0.0f;
LD = mul(LD, WorldViewMatrix);
input.normal = mul(input.normal, WorldViewMatrix);
//
// Compute the 1D texture coordinate for toon rendering.
//
float u = dot(LD, input.normal); |
|