Shader model 5 issue

Started by
3 comments, last by MJP 13 years, 4 months ago
I currently have everything running fine with D3D11 and shader model 4.0, but once I changed the shader profile to "vs_5_0" (only thing that I changed) ID3D11Device::CreateVertexShader() returns invalid argument.

D3DX11CompileFromFile() returns S_OK.

so what's the deal here? My card only supports DirectX 10 if that matters at all.
Advertisement
Yes, shader model 5 will only run on dx11 hardware. Your API is create a dx10 device which you are using through the DX11 API. This setup is called using feature levels. When you create the DX11 device it provides you a return value indicating which feature level the device is. Your shaders will have to be compiled to a target compatible with that featurelevel.

Feature level 10 -> shader model 4.0
Feature level 10.1 -> shader model 4.1
Feature level 11 -> shader model 5.0
Quote:
This setup is called using feature levels. When you create the DX11 device it provides you a return value indicating which feature level the device is.


I use D3D11CreateDeviceAndSwapChain. I don't see anything at MSDN, that tells me that.

Also, I'm kind of confused. Are you saying that I need dx11 hardware to run shader model 5 or are you saying that I can just use feature levels to get it to work? Because I can run the ContactHardeningShadows11 sample executable (it gets past the "compiling shaders" message) albeit 99% of the time the screen is black and 1% of the time I can actually see the brick pillars.

My card is a GeForce 8800 GTS 512.
Take a quick read here. This reference discusses how D3D11 can run on dx9 and up hardware. When the devices is created you can view the pFeatureLevel parameter from D3D11CreateDeviceAndSwapChain() or ID3D11Device->GetFeatureLevel() API. For your 8800GT the maximum feature level the device could successfully be created on will be feature level 10. That means you'll be restricted to just DX10 features plus a few extras like multithreading if you have a recent driver. You will be restricted to only sm 4.0 shaders since that is all your hardware is capable of and that's tied to the feature level.

This should make more sense after reading over that page.
Quote:Original post by 16bit_port
I use D3D11CreateDeviceAndSwapChain. I don't see anything at MSDN, that tells me that.


Take a closer look. Specifically at the "pFeatureLevels" and "pFeatureLevel" parameters.

Quote:Original post by 16bit_port
Also, I'm kind of confused. Are you saying that I need dx11 hardware to run shader model 5 or are you saying that I can just use feature levels to get it to work?


Feature levels just let you create and use a D3D11 device but with a subset of available features. Your 8800 will only let you create up to FEATURE_LEVEL_10_0, which means shader model 4.0 max. See this chart for a list of features per feature level.

This topic is closed to new replies.

Advertisement