felipeagc / vkrender

Vulkan renderer / game engine
25 stars 0 forks source link

Exception thrown in asset_manager.c:20 #3

Closed ompadu closed 4 years ago

ompadu commented 4 years ago

Hello, and thank you for developing vkrender.

When I build and run the example on windows I am getting the following exception thrown:

Exception thrown at 0x00007FFF52A5169C (ucrtbased.dll) in rewrite.exe: 0xC0000005: Access violation reading location 0xFFFFFFFFFFFFFFFF.

It seems the code responsible is in asset_manager.c line 20:

Operating system: Windows 10, version 1809, Built with: Visual Studio Community 2019, version 16.4.2, CMake, version: 3.16.2

Thank you

felipeagc commented 4 years ago

Hey, unfortunately I don't really maintain this project anymore... If the crash happens in realloc at line 20 of asset_manager.c then I'm kinda clueless as to what could be causing it. I mostly tested this project on linux, so it could be something windows-specific.

I'm working on another C vulkan game framework though, with hopefully a bit cleaner code. I'm probably gonna release it on github in a few weeks.

ompadu commented 4 years ago

I kinda fixed it and it works now by adding before line 20 the following:

asset_manager->assets = NULL;

I saw that solution on a stack overflow post but I don't really understand the reasoning behind it.

On nvidia it performs well but on my amd i have weird visual glitches that i will investigate.

Will your next framework have a data oriented design by any chance?

felipeagc commented 4 years ago

I guess I wasn't zero-initializing the asset manager, so there was probably some garbage in asset_manager->assets.

I only tested this on nvidia and intel hardware and it doesn't even work properly with intel haha

My next framework is gonna be pretty modular, so it won't really enforce many design decisions on the renderer part, but I plan on using a data oriented design for the entity management stuff. The biggest difference will be in how I structure the APIs (kind of inspired by this way of doing vtables in C). So it will be easier to add different rendering APIs and backends for creating windows, etc (plus the public interface headers will be a lot cleaner).

ompadu commented 4 years ago

I will use RenderDoc and try to look deeper into the AMD issue. The next weekend most likely. Maybe the problem has the same root as the Intel one.

I am working on my own C/Vulkan framework. My goals are to make it as small and light as possible with a data oriented design. Vulkan only. vkrender is a good learning resource and it is important because there aren't that many C/Vulkan frameworks out there. On GitHub anyways.

felipeagc commented 4 years ago

I'm pretty sure it has something to do with my uniform buffer sub-allocator, more specifically this alignment. If you hard code it to 256 (I think) it works properly on intel.

I think there's also an issue with the image format I'm to do object-picking, it doesn't work at all on intel.

I'm glad people are using this as a learning resource, but I'm still learning as well, so my code is not that good haha

Also good luck on your framework, I'm curious to see how other people implement more dynamic interfaces on top of vulkan. Are you gonna put it up on github?

ompadu commented 4 years ago

Thank you for the pointers. Solving riddles such as this will help me learn Vulkan.

Thank you. I wasn't planing to make something to be released but I think in the end it might be a good learning resource. I might just push it to GitHub and call it an C/Vulkan DOD experiment if it feels half baked haha