From f38923a72a6343fbeffae335dd09d56c79423389 Mon Sep 17 00:00:00 2001 From: averne Date: Tue, 3 Jun 2025 12:09:35 +0200 Subject: [PATCH] Fix default Y-axis direction fixes rendering when compiled with gcc 15 --- Primer.md | 10 +++++----- include/deko3d.h | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Primer.md b/Primer.md index 27956c9..b4c3489 100644 --- a/Primer.md +++ b/Primer.md @@ -68,7 +68,7 @@ In order to create a handle, a code section like the following will be used: // Describe the device we're about to make DkDeviceMaker maker; dkDeviceMakerDefaults(&maker); -maker.flags = DkDeviceFlags_OriginLowerLeft; +maker.flags = DkDeviceFlags_OriginLowerLeft | DkDeviceFlags_YAxisPointsUp; // Create the device DkDevice device = dkDeviceCreate(&maker); @@ -79,7 +79,7 @@ DkDevice device = dkDeviceCreate(&maker); // Create the device in one go // In the C++ wrapper, Maker objects follow the factory pattern dk::Device device = dk::DeviceMaker{} - .setFlags(DkDeviceFlags_OriginLowerLeft) + .setFlags(DkDeviceFlags_OriginLowerLeft | DkDeviceFlags_YAxisPointsUp) .create(); ``` @@ -103,7 +103,7 @@ In C++, an additional series of handle holder types exist (marked with `Unique` // Create the device // dk::UniqueDevice contains a destructor which will automatically call destroy() dk::UniqueDevice device = dk::DeviceMaker{} - .setFlags(DkDeviceFlags_OriginLowerLeft) + .setFlags(DkDeviceFlags_OriginLowerLeft | DkDeviceFlags_YAxisPointsUp) .create(); ``` @@ -203,8 +203,8 @@ Field | Default | Description `DepthMinusOneToOne` | | Clip space Z is [-1, 1] like OpenGL `OriginUpperLeft` | ✓ | Image rows are stored sequentially from top to bottom, with 0.0 corresponding to the top edge of the image and 1.0 (or the image height if non-normalized) corresponding to the bottom `OriginLowerLeft` | | Image rows are stored sequentially from bottom to top, with 0.0 corresponding to the bottom edge of the image and 1.0 (or the image height if non-normalized) corresponding to the top -`YAxisPointsUp` | ✓ | Clip space Y axis points up like OpenGL/Direct3D/Metal -`YAxisPointsDown` | | Clip space Y axis points down like Vulkan +`YAxisPointsUp` | | Clip space Y axis points up like OpenGL/Direct3D/Metal +`YAxisPointsDown` | ✓ | Clip space Y axis points down like Vulkan The debugging version of the library can use an optional callback (`cbDebug`). There are two situations in which deko3d makes usage of the debug callback: diff --git a/include/deko3d.h b/include/deko3d.h index a83874c..7bcebfe 100644 --- a/include/deko3d.h +++ b/include/deko3d.h @@ -136,7 +136,7 @@ DK_CONSTEXPR void dkDeviceMakerDefaults(DkDeviceMaker* maker) maker->cbDebug = NULL; maker->cbAlloc = NULL; maker->cbFree = NULL; - maker->flags = DkDeviceFlags_DepthZeroToOne | DkDeviceFlags_OriginUpperLeft; + maker->flags = DkDeviceFlags_DepthZeroToOne | DkDeviceFlags_OriginUpperLeft | DkDeviceFlags_YAxisPointsDown; } #define DK_MEMBLOCK_ALIGNMENT 0x1000