D3DXCreateEffectFromFile()创建失败问题!!

chenjiawei007 2011-05-21 10:34:17
自己两台电脑都安装过DXSDK,程序都可以正常运行,用dependview查看过,也不是缺少DLL。


问题是ERROR_MOD_NOT_FOUND,

在HRESULT CALLBACK OnCreateDevice( IDirect3DDevice9* pd3dDevice, const D3DSURFACE_DESC* pBackBufferSurfaceDesc,void* pUserContext )此回调接口中出现问题,导致创建device失败。


远程跟踪下代码在 D3DXCreateEffectFromFile( pd3dDevice, L"CustomUI.txt", NULL, NULL, dwShaderFlags,
NULL, &g_pEffect, NULL )


这调用这个API时出现问题,对比正常的运行,出问题的只有pd3dDevice 或者CustomUI.txt,

CustomUI.txt内容为

C/C++ code
//--------------------------------------------------------------------------------------
// File: CustomUI.fx
//
// The effect file for the CustomUI sample.
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//--------------------------------------------------------------------------------------


//--------------------------------------------------------------------------------------
// Global variables
//--------------------------------------------------------------------------------------
float g_fTime; // App's time in seconds
float4x4 g_mWorld; // World matrix for object
float4x4 g_mWorldViewProjection; // World * View * Projection matrix
texture g_txScene;

sampler g_samScene =
sampler_state
{
Texture = <g_txScene>;
MinFilter = Linear;
MagFilter = Linear;
MipFilter = Point;
};


void VertScene( float4 Pos : POSITION,
float2 Tex : TEXCOORD0,
out float4 oPos : POSITION,
out float2 oTex : TEXCOORD0 )
{
oPos = mul( Pos, g_mWorldViewProjection );
oTex = Tex;
}


float4 PixScene( float2 Tex : TEXCOORD0 ) : COLOR0
{
return tex2D( g_samScene, Tex );
}


//--------------------------------------------------------------------------------------
// Techniques
//--------------------------------------------------------------------------------------
technique RenderScene
{
pass P0
{
VertexShader = compile vs_2_0 VertScene();
PixelShader = compile ps_2_0 PixScene();
}
}



参数pd3dDevice是回调上来的

我无法控制,如果出现问题,猜测可能是缺少了某些东西,

希望懂的朋友指点下!自己也正在查找中。
...全文
280 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
gamemagic 2011-05-22
  • 打赏
  • 举报
回复
显卡驱动问题?
chenjiawei007 2011-05-22
  • 打赏
  • 举报
回复
解决了,是部分显卡驱动问题,请问这个问题是否只能更新显卡驱动才能解决?
chenjiawei007 2011-05-21
  • 打赏
  • 举报
回复
也有可能是dwShaderFlags设置的问题
目前使用的是D3DXSHADER_DEBUG,可能没有安装过DXSDK的电脑不支持
chenjiawei007 2011-05-21
  • 打赏
  • 举报
回复
在干净的电脑上无法运行,我将DXSDK运行库也包含进去了,我用dxdiag察看了下,也没有缺少库

可是在CALLBACK OnCreateDevice( IDirect3DDevice9* pd3dDevice, const D3DSURFACE_DESC* pBackBufferSurfaceDesc,void* pUserContext )
断言出错,然后弹出框显示不能创建device,希望朋友指点下!
Sou2012 2011-05-21
  • 打赏
  • 举报
回复
还没有解决么? 我这边运行没有问题。

8,303

社区成员

发帖
与我相关
我的任务
社区描述
游戏开发相关内容讨论专区
社区管理员
  • 游戏开发
  • 呆呆敲代码的小Y
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧