RavEngine icon indicating copy to clipboard operation
RavEngine copied to clipboard

[Bug] Mesh rendering causes crash in Debug mode and crashes on exit in Release mode

Open LouChiSoft opened this issue 2 years ago • 4 comments

When trying to use a default lit PBR material with the include cube mesh it application will error out before rendering anything in Debug mode. In Release mode it does still manage to render but will throw an exception on exiting the application. I would hazard a guess that it's because some exception guard is turned off in Release mode until it exits. I tested with both my own project and the HelloCube project with the most recent version on the main branch.

The code trace is : doPassWithCamData(camdata, renderFinalPass) on line 1003 ->function(viewproj, camPos, fullSizeViewport, fullSizeScissor, renderArea); on line 906 ---> renderFromPerspective(viewproj, camPos, unlitRenderPass, [](Ref<Material>&& mat) on line 709 -----> cullTheRenderData(worldOwning->renderData->staticMeshRenderData); on line 444 -------->mainCommandBuffer->DispatchCompute(std::ceil(cubo.numObjects / 64.f) on line 343

And seems to have been introduced with git commit edac438a0845eefb7444ce31d567f07a9fce31c9 . I have tried to see what's causing it to see if there is a fix I could have provided but unfortunately I don't know enough about the RGL that powers the render engine. Hopefully it's enough to help you narrow down what's causing it.

LouChiSoft avatar Dec 19 '23 21:12 LouChiSoft

Thanks for the report. Is there anything in the console log? Check both stdout and the Visual Studio output window (Debug -> Windows -> Output) if you're on Windows.

Ravbug avatar Dec 19 '23 22:12 Ravbug

Not much unforunately: Nothing in stdcout except the standard startup audio subsystem message, As for the debug output in VS there is only:

Unhandled exception at 0x00007FFDACC8CF19 (KernelBase.dll) in ColonySim.exe: 0x0000087A (parameters: 0x0000000000000001, 0x000000A04F6F8A20, 0x000000A04F6FA7F0).

The thread 0xe9c has exited with code 0 (0x0).
Unhandled exception at 0x00007FFDACC8CF19 (KernelBase.dll) in ColonySim.exe: 0x0000087A (parameters: 0x0000000000000001, 0x000000A04F6F8A20, 0x000000A04F6FA7F0).

LouChiSoft avatar Dec 19 '23 22:12 LouChiSoft

I am able to reproduce this in HelloCube, and in the Output window I get this:

D3D12 ERROR: ID3D12CommandList::Dispatch: Resource(0x000001E60C217820:'Depth Texture') (subresource : 0) is bound as DATA_STATIC_WHILE_SET_AT_EXECUTE on this command list, and had a change to a writable state, which indicates a data change, before this Draw/Dispatch call. But it is required to be rebound to the command list before the next (this) Draw/Dispatch call. [ EXECUTION ERROR #1003: DATA_STATIC_WHILE_SET_AT_EXECUTE_DESCRIPTOR_INVALID_DATA_CHANGE] D3D12: BREAK enabled for the previous message, which was: [ ERROR EXECUTION #1003: DATA_STATIC_WHILE_SET_AT_EXECUTE_DESCRIPTOR_INVALID_DATA_CHANGE ]

Will investigate further.

Ravbug avatar Dec 21 '23 04:12 Ravbug

In the meantime, for me, the Vulkan backend appears to work. You can try switching to it by going to Properties -> Debugging -> Environment and setting RGL_BACKEND=vulkan image

Ravbug avatar Dec 21 '23 04:12 Ravbug

I can no longer reproduce the validation assertions on the latest D3D12 Agility SDK.

Ravbug avatar Jun 30 '24 00:06 Ravbug