Skip to main content
gamedev.net
🔒 Locked

WTF?

Started by Etnu 5 replies 650+ views
Original Post
Etnu
Etnu

HRESULT WINAPI
    D3DXCompileShaderFromFileW(
        LPCWSTR                         pSrcFile,
        CONST D3DXMACRO*                pDefines,
        LPD3DXINCLUDE                   pInclude,
        LPCSTR                          pFunctionName,
        LPCSTR                          pProfile,
        DWORD                           Flags,
        LPD3DXBUFFER*                   ppShader,
        LPD3DXBUFFER*                   ppErrorMsgs,
        LPD3DXCONSTANTTABLE*            ppConstantTable);
Why on earth would you do that? The W is supposed to mean "hey, everything here uses wide characters", not "some things might use wide characters...others will use ordinary characters!" *smack*
---------------------------Hello, and Welcome to some arbitrary temporal location in the space-time continuum.
xyzzy00
xyzzy00
Its because the shader code, entrypoint name, and profile name, are only allowed to be ascii. Not much point for the function to take everything in unicode, if it will just convert it back.

xyzzy
Muhammad Haggag
Muhammad Haggag
Just a minor comment: You're a really senior member Etnu. So you should've created the topic with a meaningful title (like D3DXCompilerShaderFromFileW oddness)

IFooBar
IFooBar
Must be one of those ->[totally]<- days.
[size=2]aliak.net
Etnu
Etnu
Actually, it was a late night spent trying to figure out why after altering my shader loaders to work with multiple versions it stopped compiling.

I came up with a work around, but the whole thing just seemd kind of counter-intuitive. Sorry about the title.

---------------------------Hello, and Welcome to some arbitrary temporal location in the space-time continuum.
SiCrane
SiCrane
Quote:
Original post by Etnu
Why on earth would you do that? The W is supposed to mean "hey, everything here uses wide characters", not "some things might use wide characters...others will use ordinary characters!"

*smack*

Actually it means all the strings designated as T strings in the non A/W declaration will be treated as wide character strings. There are actually quite a few areas in Windows programming where even when using wide character versions of functions you need narrow strings. The original rich edit control comes to mind immediately.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.