SPIRV Reflection crashing due scalar destructor heap corruption
Pikachuxxxx opened this issue · 3 comments
While reflecting shaders spirv priitives and rzaizx data types which is causing heap corruption while pushing into vectors
============================================================
Razix Engine Stats
Version : 0.30.0
Configuration : [Debug | Release | Distribution]
Release Stage : Development
OS : Windows 10 Home
Processor : Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz 2.60 GHz
Vulkan API Version : 1.3.225
GPU Name : NVIDIA GeForce RTX 2060
Vendor ID : 4318
Device Type : DISCRETE GPU
Driver Version : 512.316.0
Decreased the frequency of crashes using RZMalloc/RZFree
and converting RZDescriptor
into a pointer as of commit 7c7306d6b8263c5815e7fdaceaa6e7a7f8e635a7
// TODO: Use smart pointers from rzstl
and proper cleanup of spirv primitives memory to mitigate heap corruption and crashes.
resolved in PR #181
-
So when using SPIRVReflect the first call to
spvReflectCreateShaderModule
holds all the input, descriptor and push constant variables. Now any subsequent calls using the SPIRV reflect API such asspvReflectEnumerateInputVariables
will get the same pointers and can be a bit buggy when allocating memory and freeing as they belong to the module, yes these can be used separately to query on demand but since we are reflecting the entire shader in one go and using the module to parse through the shader can make things (memory allocs) simple and no Razix Descriptors API refactoring was needed. -
As for the EventCallback fn crash we check for the RZENativeWindow and ImGui Context to not be nullptrs before call anything else