Sign in to follow this  
zyrolasting

Foreign error message

Recommended Posts

I'm playing around with shaders for the first time, (Man, was I missing out) but made a mistake and tripped one of my DXTrace errors when my shader failed validation. I hit 'No' on the confirmation of debugging the app, and I get the following before the app terminates. Why do I get this, and is there a way to translate the message to English?

Share this post


Link to post
Share on other sites
If I click 'yes', a break point is set and I'm told there is no disassembly available. No surprises there. This is an English installation as far as I can tell. I've been using the SDK long enough to see if I downloaded a different locale... Everything else is English. I've been installing it on several PCs from removable storage. My OS itself is not set to an East Asian locale, although I do have language packs.

It's just these messages that are in... Kanji, right? They seem to change depending on the errors in my shaders. This is bugging me. If they describe errors, I want to know what they say.

Share this post


Link to post
Share on other sites
Quote:
Original post by zyrolasting
It's just these messages that are in... Kanji, right? They seem to change depending on the errors in my shaders. This is bugging me. If they describe errors, I want to know what they say.
It looks like gibberish to me.

I'd say you're calling the Ansi version of D3DXCreateEffectFromFile (or whatever you're calling) which is returning an Ansi string in the ppCompilationErrors object and you're casting it to a wchar_t string - resulting in gibberish. Can you show us the code you're using?

Share this post


Link to post
Share on other sites
That was it, I was casting the compilation errors ID3DXBuffer pointer to a wide character pointer (through TCHAR). The message is now legible. Good eye!

Why does everything else in D3DX resolve to either ANSI or Unicode, but not the methods of ID3DXEffect?

Share this post


Link to post
Share on other sites
Are you using D3DXCreateEffectFromFile to load the effect? Or something else?

The buffer in ppCompilationErrors will contain either an Ansi error message or a Unicode error message depending on whether you call D3DXCreateEffectFromFileA or D3DXCreateEffectFromFileW. If you just call D3DXCreateEffectFromFile (no explicit A or W) it'll just use whatever version TCHAR resolves to. So unless you're explicitly calling the A or W version, it should "just work".

Share this post


Link to post
Share on other sites
But I do use D3DXCreateEffectFromFile. Compilation errors and Set/Get methods use ANSI strings only, while the file name is TCHAR. Here's the working call from the framework, with the correct message output on an error instead of gibberish.

D3DXBuffer d3dxB;
if ( F_HR( D3DXCreateEffectFromFile (
m_pD3DDevice,
_T("ColorShader.fx"),
0,
0,
D3DXSHADER_DEBUG,
0,
&m_Effect,
&d3dxB
) ) )
{
MessageBoxA(m_hWindow,(char*)d3dxB->GetBufferPointer(),0,0);
return false;
}



It seems that although the file name can be either MB or unicode, the strings that have anything to do with the file contents has to be ANSI.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this