This live stream documents Cherno's ongoing efforts to rewrite the renderer for the Hazel game engine, transitioning from a custom Vulkan implementation to NVIDIA's NVRHI backend. The primary focus of this session is the re-integration and stabilization of the ImGui user interface within the new rendering architecture. The video details the complex process of implementing GPU-to-CPU image copying, meticulously debugging texture state transitions, and correctly initializing ImGui's rendering backend. A significant milestone is achieved with the successful rendering of the first frame. Subsequent performance profiling reveals a critical bug: an accidental double-rendering of frames, which, once fixed, dramatically improves performance. The stream concludes with a functional ImGui interface running on the new renderer, although some minor visual artifacts remain for future refinement.
Summarizing the Hazel Engine Renderer Rewrite (NVRHI Integration)
0:00 Renderer Rewrite & NVRHI Backend: Cherno is actively rewriting the renderer for the Hazel game engine ("Renderer 2025"), migrating from a custom Vulkan implementation to NVIDIA's NVRHI backend. The immediate objective is to get the ImGui user interface up and running with the new system.
0:53 Platform Support Decisions: Hazel is planned to support Windows, Linux, and macOS (leveraging MoltenVK for Metal on Mac). Mobile platform support is explicitly excluded due to Cherno's challenging past experiences with mobile game development at EA, including difficult debugging, Samsung driver issues, and slow build times.
19:00 Implementing GPU-to-CPU Image Copying: A core development task involves implementing the image_copy_to_host_buffer function, which is necessary to transfer pixel data from the GPU to a CPU-accessible buffer for editor functionality. This requires careful handling of NVRHI's texture state tracking, resource transitions, and Vulkan barriers.
51:00 ImGui Integration and Initialization: The process includes setting up the ImGui context, porting its rendering backend to NVRHI, and ensuring proper integration with GLFW for windowing and input management. Issues with uninitialized backend data are addressed, and font texture creation is handled.
1:56:00 Debugging Texture States: Persistent warnings about "unknown prior state" for textures are debugged, revealing the necessity for explicit state transitions (e.g., from copy source to shader resource) and proper usage flags (transfer = true) during image creation within NVRHI.
2:26:00 First Frame Rendered Success! π: A significant achievement is reached as the first frame successfully renders using the new NVRHI backend. Initially, the ImGui interface appears upside down and exhibits flickering.
2:39:00 Fixing Coordinate Systems: The upside-down rendering is quickly corrected by adjusting a Y-coordinate flip in the shader, making the ImGui interface functional and interactive.
2:39:00 Performance Bottleneck Discovered: A major performance issue is identified, with the application running at a surprising 30 frames per second (FPS) instead of the expected monitor refresh rate (~144 FPS).
3:20:00 Resolving Double-Rendering Bug: Through profiling with tools like Visual Studio, Tracy, and RenderDoc, the performance problem is traced back to a critical bug: the application was inadvertently calling animate, render, and present functions twice per frame. Fixing this redundant rendering dramatically improves performance to around 1-2 ms per frame when VSync is disabled.
3:49:00 Remaining Visual Issues: Despite the significant progress, some visual artifacts, such as a grayed-out content browser and unusual icon appearances, persist. Potential VSync synchronization issues are noted for future investigation.