veldrid / veldrid

A low-level, portable graphics library for .NET.
https://veldrid.dev/
MIT License
2.49k stars 272 forks source link

What do I have to consider with linux? #225

Open NevsDev opened 5 years ago

NevsDev commented 5 years ago

I write a project on my Windows machine. There everything works well with GraphicsBackend.Direct3D11. Now I try to get this project to run on Linux-Ubuntu 18 and get this error:

Unhandled Exception: System.NullReferenceException: Object reference not set to an instance of an object. at Veldrid.Vk.VkCommandList.GetStagingBuffer(UInt32 size) in C:\projects\veldrid\src\Veldrid\Vk\VkCommandList.cs:line 1163 at Veldrid.Vk.VkCommandList.UpdateBufferCore(DeviceBuffer buffer, UInt32 bufferOffsetInBytes, IntPtr source, UInt32 sizeInBytes) in C:\projects\veldrid\src\Veldrid\Vk\VkCommandList.cs:line 728 at Veldrid.CommandList.UpdateBuffer[T](DeviceBuffer buffer, UInt32 bufferOffsetInBytes, T[] source) in C:\projects\veldrid\src\Veldrid\CommandList.cs:line 826

I first tried GraphicsBackend.OpenGL and then I installed GraphicsBackend.Vulkan. Every time the same error.

GraphicsDevice and Window seem to work and a black window opens up to this error, when i try to update the first Buffer cl.UpdateBuffer(_vb, 0, s_vertices), _vb and s_vertices are not null. Is it maybe a permission thing?

Would be really great if someone could help me, thanks

mellinoe commented 5 years ago

This is very poor error behavior in this case, but I suspect you have forgotten to call Begin() on the CommandList instance before calling UpdateBuffer. I could be wrong about that, but I'd need some more information to make a diagnosis. Unfortunately, not all of the backends have the same behavior in error cases, although I do try to align them when possible.