Replace the OpenGL rendering backend with Vulkan across the engine: - Graphics: add VulkanContext (instance/device/swapchain/renderpass with depth-stencil), port Canvas to nanovg-on-Vulkan and DebugGUI to the imgui Vulkan backend, drop GLEW. Wait for the Wayland configure handshake before the first present and rebuild the swapchain to the confirmed size so the window maps reliably on fractional-scale outputs. - RasterRender: reimplement RenderBuffer, shaders and object pipeline on Vulkan (offscreen VkImage target with MSAA resolve, SPIR-V pipelines, push-constant MVP, depth remap for Vulkan clip space). - Sketch3D: port the stroke renderer (geometry-shader line expansion) and stroke GPU buffers to Vulkan. - 3DEditor: port the path-tracer texture upload to a Vulkan staging upload and keep raster/path-tracer viewports oriented consistently. - Add a nanovg external-VkImage bridge plus a render-target registry so 3D render targets can be shown inside the 2D canvas. - Prefer the Wayland platform in GLFW regardless of DISPLAY. - Widgets: make BasicLayout size distribution converge with a sub-pixel epsilon instead of an exact-zero comparison, which could otherwise spin forever on fractional-scale displays and block the first frame. Vendor nanovg_vulkan and add a standalone VulkanGraphics module.
26 lines
871 B
C++
26 lines
871 B
C++
#pragma once
|
|
|
|
#include "Mat.hpp"
|
|
|
|
namespace tp {
|
|
|
|
// Converts an OpenGL-style clip space to Vulkan's for solid mesh rendering:
|
|
// - flip Y: Vulkan's clip space has +Y pointing down relative to OpenGL, so
|
|
// without this the offscreen render is mirrored vertically.
|
|
// - remap Z from the OpenGL [-w, w] range to Vulkan's [0, w], since the
|
|
// fragment shader reads gl_FragCoord.z directly for depth shading.
|
|
// Note: the Y flip mirrors screen-space X handedness for the viewer, so the
|
|
// 3D navigation (orbit/pan) compensates the horizontal mouse delta.
|
|
inline Mat4F vulkanClipCorrection() {
|
|
Mat4F c;
|
|
c[0] = Vec4F(1, 0, 0, 0);
|
|
c[1] = Vec4F(0, -1, 0, 0);
|
|
c[2] = Vec4F(0, 0, 0.5f, 0.5f);
|
|
c[3] = Vec4F(0, 0, 0, 1);
|
|
return c;
|
|
}
|
|
|
|
inline Mat4F vulkanCameraMatrix(const Mat4F& glCameraMatrix) {
|
|
return vulkanClipCorrection() * glCameraMatrix;
|
|
}
|
|
}
|