directx - D3DX11CompileFromFile Invalid Arguments C++ -
i'm overlooking simple, compilation of shader compilation call claiming there no instance of overloaded function, despite code working in other projects.
//globals idxgiswapchain *swapchain; //pointer swapchain interface id3d11device *dev; //pointer direct3d device interface id3d11devicecontext *devcon; //pointer direct3d device context id3d11rendertargetview *backbuffer; //shaders id3d11vertexshader* pvs; id3d11pixelshader* pps; void initpipeline() { //load , compile shaders id3d10blob *vs; id3d10blob *ps; d3dx11compilefromfile(l"shader.shader", 0, 0, "vshader", "vs_4_0", 0, 0, 0, &vs, 0, 0); d3dx11compilefromfile(l"shader.shader", 0, 0, "pshader", "ps_4_0", 0, 0, 0, &ps, 0, 0); //encapsulate shaders shader objects dev->createvertexshader(vs->getbufferpointer(), vs->getbuffersize(), null, &pvs); dev->createpixelshader(ps->getbufferpointer(), ps->getbuffersize(), null, &pps); //set shader objects devcon->vssetshader(pvs, 0, 0); devcon->pssetshader(pps, 0, 0); }
the error is:
no instance of overloaded function "d3dx11compilefromfilea" matches argument list argument types are: (const wchar_t [14], int, int, const char [8], const char [7], int, int, int, id3d10blob **, int, int)
d3dx11compilefromfilea
ansi string method. attempting pass wide character constant first parameter (l"shader.shader"
). see question more details on difference between ansi , unicode functions in windows apis.
you either need change project settings, characterset property unicode (see here documentation), or can pass in utf-8 string (and continue use ansi method), removing l
in front of string constant.
Comments
Post a Comment