mellinoe / veldrid-samples

Sample projects for Veldrid
https://mellinoe.github.io/veldrid-docs/
121 stars 49 forks source link

shader compilation fails #11

Open Mathias-Fuchs opened 5 years ago

Mathias-Fuchs commented 5 years ago

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

mellinoe commented 5 years ago

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?

Mathias-Fuchs commented 5 years ago

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 commented 5 years ago

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

mostafa901 commented 5 years ago

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

image