Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HLSL compiled to DXIL won't load in DirectX11 #63

Open
CallumCVM opened this issue Feb 27, 2021 · 1 comment
Open

HLSL compiled to DXIL won't load in DirectX11 #63

CallumCVM opened this issue Feb 27, 2021 · 1 comment

Comments

@CallumCVM
Copy link

Describe the bug
A HLSL vertex shader I am compiling to DXIL refuses to be created via ID3D11Device::CreateVertexShader due to the following error code:

D3D11 ERROR: ID3D11Device::CreateVertexShader: Vertex Shader is corrupt or in an unrecognized format. [ STATE_CREATION ERROR #166: CREATEVERTEXSHADER_INVALIDSHADERBYTECODE]
D3D11 ERROR: ID3D11Device::CreateVertexShader: Shader is corrupt or in an unrecognized format. [ STATE_CREATION ERROR #166: CREATEVERTEXSHADER_INVALIDSHADERBYTECODE]

To Reproduce
Shaders.zip
Steps to reproduce the behavior:

  1. Input shader attached [Mesh.vs], I have also attached the compiled vso [Compiled/Mesh.vso]
  2. Full parameters:

`Compiler::ResultDesc CompileShader(const std::string& data, ShaderStage stage)
{
Compiler::SourceDesc sourceDesc{};
Compiler::TargetDesc targetDesc{};

sourceDesc.source = data.c_str();
sourceDesc.stage = stage;
sourceDesc.entryPoint = "ShaderMain";
sourceDesc.numDefines = 0;
sourceDesc.defines = nullptr;
sourceDesc.loadIncludeCallback = LoadInclude;

Compiler::Options opts;
opts.optimizationLevel = 0;

targetDesc.asModule = false;
targetDesc.language = ShadingLanguage::Dxil;
targetDesc.version = nullptr;

auto result = Compiler::Compile(sourceDesc, {}, targetDesc);

return result;

}`
You may note that the constant buffer is commented out, this is due to another bug I have reported with the Dx shader compiler here: microsoft/DirectXShaderCompiler#3511

Expected behavior
I should be able to compile to DXIL, and load with Dx11.

@gongminmin
Copy link
Contributor

No, D3D11 doesn't support DXIL. It's a by design behavior of DXC. Check microsoft/DirectXShaderCompiler#621.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants