Failed to create compute shader - Shader Model 5.1, DirectX 11.3

Started by
6 comments, last by SoldierOfLight 7 years, 5 months ago

Hi,
when I call


ID3D11Device3::CreateComputeShader 

it fails with an error from debug layer stating:

"D3D11 ERROR: ID3D11Device::CreateComputeShader: Shader must be cs_4_0, cs_4_1 or cs_5_0. Shader version provided: UNRECOGNIZED [ STATE_CREATION ERROR #2097323: CREATECOMPUTESHADER_INVALIDSHADERTYPE]"

This happens when I pass shader bytecode compiled for Shader Model 5.1. It works just fine for Shader Model 5.0.

My setup:

Windows 10,
Windows SDK version 10.0.14393.0,
Microsoft Visual Studio 2015 Update 3,
NVIDIA GeForce GTX 1080,
GeForce Game Ready Driver 375.95, release date: 11/18/2016.

My project is configured to use the newest SDK. I compiled the shader using fxc.exe from within Visual Studio. But it failed also when I compiled shaders in runtime.

I create my device using D3D_FEATURE_LEVEL_11_1 as feature level and D3D11_SDK_VERSION, which equals to 7. I also succeeded at using other DirectX 11.3 feature (loading vectors from UAVs).

I am clueless as to what causes this error and why DirectX API doesn't recognize cs_5_1 as a correct shader model. I tried to reinstall the Windows SDK, but it didn't help. I also tried to cast my ComPtr< ID3D11Device > pointer to ComPtr< ID3D11Device3 > using ComPtr::As method, but it didn't help either.

Any help or suggestions would be really appreciated.

Advertisement

Shader model 5.1 is only supported by D3D12, not D3D11.

In the first line under Shader Model 5.1 documentation: https://msdn.microsoft.com/en-us/library/windows/desktop/dn933277%28v=vs.85%29.aspx?f=255&MSPPError=-2147217396

they write: "This section contains the reference pages for HLSL Shader Model 5.1, introduced with D3D12 and D3D11.3."

So I assume it is supported by D3D11. Am I wrong?

The only shader model 5.1 feature that relate to dx11.3 is for the pixel shader using the conservative rasterisation ( plus stencil output ). The compute shader is virtually unmodified from 5.0 to 5.1 in regards to dx11.3, It is safe to assume that rejecting a 5.1 shader here is excessive, but it is not like you would have need it anyway.

In the first line under Shader Model 5.1 documentation: https://msdn.microsoft.com/en-us/library/windows/desktop/dn933277%28v=vs.85%29.aspx?f=255&MSPPError=-2147217396

they write: "This section contains the reference pages for HLSL Shader Model 5.1, introduced with D3D12 and D3D11.3."

So I assume it is supported by D3D11. Am I wrong?

I think the documentation is wrong, Jesse Natalie (the user who replied) is working on DirectX at Microsoft..

The only shader model 5.1 feature that relate to dx11.3 is for the pixel shader using the conservative rasterisation ( plus stencil output ). The compute shader is virtually unmodified from 5.0 to 5.1 in regards to dx11.3, It is safe to assume that rejecting a 5.1 shader here is excessive, but it is not like you would have need it anyway.

I believe that's just a D3D11.3 feature, that was added to SM5.0, not a SM5.1 feature. I'll get the documentation updated.

OK, thank you very much for your answers. I was hoping to stay in D3D11 for a while, but it seems I will have to switch to D3D12.

But just to be 100% sure - the feature I'm looking for is indexable buffers and textures within a shader using a variable (such as loop counter). That is not available in SM5.0, right?

Correct, that's only available in D3D12, unless you're willing/able to limit yourself to texture arrays or arrays in structured buffers.

This topic is closed to new replies.

Advertisement