From 97b3de834f4f71002896e6a940b2709529cf1f02 Mon Sep 17 00:00:00 2001 From: jaby Date: Thu, 8 Feb 2024 21:29:18 -0500 Subject: [PATCH] Resolve some TODOs --- .../src/Overlay/ScreenCenter/include/frame.hpp | 7 +------ include/PSX/GPU/Primitives/linked_elements.hpp | 12 ++++++------ include/PSX/System/IOPorts/gpu_io.hpp | 2 ++ src/Library/src/BootLoader/gpu_boot.cpp | 1 - 4 files changed, 9 insertions(+), 13 deletions(-) diff --git a/examples/PoolBox/application/src/Overlay/ScreenCenter/include/frame.hpp b/examples/PoolBox/application/src/Overlay/ScreenCenter/include/frame.hpp index dfb6180d..66b34cd7 100644 --- a/examples/PoolBox/application/src/Overlay/ScreenCenter/include/frame.hpp +++ b/examples/PoolBox/application/src/Overlay/ScreenCenter/include/frame.hpp @@ -6,8 +6,6 @@ namespace ScreenCenter { using namespace JabyEngine; - // TODO: Fit these pieces into 16Word buffers (sizeof(T) >> 2 == words) - // TODO: Can we DMA all of this? class Frame { private: struct TopBorder : public GPU::internal::LinkedElementCreator { @@ -90,10 +88,7 @@ namespace ScreenCenter { } void setup() { - // TODO: I want this in one line - this->top_border.concat(this->bottom_border); - this->bottom_border.concat(this->line_border); - this->line_border.concat(this->line_cross); + this->top_border.concat(this->bottom_border.concat(this->line_border.concat(this->line_cross))); } void render() const { diff --git a/include/PSX/GPU/Primitives/linked_elements.hpp b/include/PSX/GPU/Primitives/linked_elements.hpp index 855ff391..61e76ddf 100644 --- a/include/PSX/GPU/Primitives/linked_elements.hpp +++ b/include/PSX/GPU/Primitives/linked_elements.hpp @@ -1,6 +1,7 @@ #pragma once #include "../../Auxiliary/bits.hpp" #include "../../Auxiliary/type_traits.hpp" +#include "../../System/IOPorts/gpu_io.hpp" namespace JabyEngine { namespace GPU { @@ -38,14 +39,14 @@ namespace JabyEngine { } template - enable_if::value, T&>::type concat(T& obj) { + enable_if::value, Link&>::type concat(T& obj) { Link::set_adr(&obj); - return obj; + return *this; } template - enable_if::value, const T&>::type concat(const T& obj) { - return concat(const_cast(obj)); + enable_if::value, const Link&>::type concat(const T& obj) { + return concat(const_cast(obj)); } constexpr void terminate() { @@ -77,8 +78,7 @@ namespace JabyEngine { return &this->element; } - // TODO: Replace this magic number? - static_assert((sizeof(T) >> 2) <= 16); + static_assert((sizeof(T) >> 2) <= GPU_IO::FIFOWordSize); }; namespace internal { diff --git a/include/PSX/System/IOPorts/gpu_io.hpp b/include/PSX/System/IOPorts/gpu_io.hpp index 0c91ffe0..dea49ec4 100644 --- a/include/PSX/System/IOPorts/gpu_io.hpp +++ b/include/PSX/System/IOPorts/gpu_io.hpp @@ -216,6 +216,8 @@ namespace JabyEngine { static constexpr auto TexturePageY256 = Bit(4); }; + static constexpr size_t FIFOWordSize = 16; + __declare_io_port(, GP0, 0x1F801810); __declare_io_port(, GP1, 0x1F801814); diff --git a/src/Library/src/BootLoader/gpu_boot.cpp b/src/Library/src/BootLoader/gpu_boot.cpp index e8713589..1c6d3486 100644 --- a/src/Library/src/BootLoader/gpu_boot.cpp +++ b/src/Library/src/BootLoader/gpu_boot.cpp @@ -48,7 +48,6 @@ namespace JabyEngine { using namespace JabyEngine::GPU; static void configurate_display() { - // Ideal I hope that an offset of 0,0 will produce a well enough centered picture for every TV for now GPU_IO::GP1.write(GPU_IO::Command::DisplayMode(::JabyEngine::GPU::internal::Display::DisplayMode)); GPU::Display::set_offset(0, 0); }