I am currently working on making a game engine and I have been following the tutorials on http://www.directxtutorial.com/ learning DirectX 11.
Everything was going well until a few hours ago when I hit a brick wall.
I'm currently trying to get a triangle to render. However, the shaders aren't being created and I get an invalid argument return. Also since I have debugging turned on, I get the below read out in the output window.
However, when I run the (near) exact same code from the DirectX tutorial from the DirectX sample browser, the triangle renders just fine, so I know the problem has to be in my code and not my hardware. I've tried v4 with the same result and anything below v3 just crashes.
After comparing my code very closely to all the tutorials I have, I am looking to see if anyone here can help me figure this out.
I've included links to all my code files. They are in the format of a basic game engine and all the included files just need to be compiled in a DirectX ready project.
<br><br>Thanks in advance for looking at this.<br>-Dryak<br><br><!--EDIT--><span class=editedby><!--/EDIT-->[Edited by - Dryak on October 6, 2010 2:06:02 AM]<!--EDIT--></span><!--/EDIT-->
What feature level is your D3D device? (which should match the maximum feature level possible for your video card). It would seem that you probably do not have support for featurelevel 11.0 which is required for sm5.0. You have to compile the shader to at least match the hardware feature level.
The sample is adjusting the compile to work with any of the feature levels. Your video card is DX10 only, so can only create a shader that was compiled to vs_4_0/ps_4_0.
Could you update the code you posted to include the changes. Be sure to add in the variable to detect what feature level device was created. What feature level does it successfully create?
Ah, I see the problem. The feature levels are attempted in order from the featureLevels parameter that you passed to CreateDevice. The first feature level to successfully create will return. In this case, that would be a level 9.1 device, which would require you to compile your shader code to vs_4_0_level_9_1 and ps_4_0_level_9_1 targets. Reorder your feature level array to be in descending order.