veldrid-samples icon indicating copy to clipboard operation
veldrid-samples copied to clipboard

shader compilation fails

Open Mathias-Fuchs opened this issue 5 years ago • 4 comments

Hello! I can build the getting started sample fine, using the nuget version 4.5.0 of velgrid, but .net core host seems to crash during the spirv shader compilation:

$ dotnet run

Unhandled Exception: SharpDX.SharpDXException: HRESULT: [0x80070057], Module: [General], ApiCode: [E_INVALIDARG/Invalid Arguments], Message: Falscher Parameter.

   at SharpDX.Result.CheckError()
   at SharpDX.Direct3D11.Device.CreateVertexShader(IntPtr shaderBytecodeRef, PointerSize bytecodeLength, ClassLinkage classLinkageRef, VertexShader vertexShaderOut)
   at SharpDX.Direct3D11.VertexShader..ctor(Device device, Byte[] shaderBytecode, ClassLinkage linkage)
   at Veldrid.D3D11.D3D11Shader..ctor(Device device, ShaderDescription description) in C:\projects\veldrid\src\Veldrid\D3D11\D3D11Shader.cs:line 33
   at Veldrid.D3D11.D3D11ResourceFactory.CreateShaderCore(ShaderDescription& description) in C:\projects\veldrid\src\Veldrid\D3D11\D3D11ResourceFactory.cs:line 60
   at Veldrid.SPIRV.ResourceFactoryExtensions.CreateFromSpirv(ResourceFactory factory, ShaderDescription vertexShaderDescription, ShaderDescription fragmentShaderDescription, CrossCompileOptions options)
   at Veldrid.SPIRV.ResourceFactoryExtensions.CreateFromSpirv(ResourceFactory factory, ShaderDescription vertexShaderDescription, ShaderDescription fragmentShaderDescription)
   at GettingStarted.Program.CreateResources() in C:\Users\Dell\source\repos\K3D_Mesher\MF\Visualizer2\main.cs:line 111
   at GettingStarted.Program.Main(String[] args) in C:\Users\Dell\source\repos\K3D_Mesher\MF\Visualizer2\main.cs:line 59

This happens in the line

            _shaders = factory.CreateFromSpirv(vertexShaderDesc, fragmentShaderDesc);

Any help appreciated! MF

Mathias-Fuchs avatar Mar 19 '19 10:03 Mathias-Fuchs

Have you made any modifications to the example code? I'm able to run the GettingStarted project under D3D11 without the above problem. The error indicates that the VertexLayoutDescription might have been modified from what is in the repo -- is that the case?

mellinoe avatar Mar 19 '19 14:03 mellinoe

Hello mellinoe, thanks for answer. No, I can't seem to find any difference. It alsow works on Linux. The vertex layout is still

VertexLayoutDescription vertexLayout = new VertexLayoutDescription(
                new VertexElementDescription("Position", VertexElementSemantic.TextureCoordinate, VertexElementFormat.Float2),
                new VertexElementDescription("Color", VertexElementSemantic.TextureCoordinate, VertexElementFormat.Float4)
                );

and the class VertexLayoutDescription hasn't changed either.

Mathias-Fuchs avatar Mar 21 '19 16:03 Mathias-Fuchs

Any new thoughts on this issue? It keeps nagging me ....

Mathias-Fuchs avatar Jul 31 '19 07:07 Mathias-Fuchs

yep. Same here... could it be the reason if i have DirectX12 not 11 under windows 10?

image

mostafa901 avatar Aug 08 '19 17:08 mostafa901