Author SHA1 Message Date
tobid7 39e91b588f reset layers and give menus a base layer to gather perfect ordered rendering 2026-09-06 15:58:20 +02:00
tobid7 7bb1406365 Add FontStack to UI7 and uncomment layer lines 2026-09-06 15:58:20 +02:00
tobid7 438584e4f2 move and fix scrolling to layout
Scrolling was hardcoded to 3ds sCrEeNhEiGhT wTh
2026-09-06 15:58:20 +02:00
tobid7 acc4fd11eb Layers are back 2026-09-06 15:58:19 +02:00
tobid7 72bb76dcbc hotfix 2026-09-06 15:58:19 +02:00
tobid7 272b66f7f0 Add Hid3DS 2026-09-06 15:58:19 +02:00
tobid7 6637a3692b Bring back global lithium pools
why?
cause sorting around the global driver pool would basically use more cpu power then just copy data sequences into the right order
And sorting data references costs 0 performance at all
2026-09-06 15:58:19 +02:00
tobid7 feeb3b1ba8 Add Drawlist Vertex and Indexcount geteter (for debugging usage only) 2026-09-06 15:58:19 +02:00
tobid7 5a56bf3986 Fix The rest of UI7 Mem leaks
Throw OneFrame living objs into a pool
2026-09-06 15:58:19 +02:00
tobid7 1dfc538ae3 stop leaking idobj memory (and coloredit layout mem) 2026-09-06 15:58:19 +02:00
tobid7 36c05a9138 dx9: update device size on window size change 2026-09-06 15:58:18 +02:00
tobid7 a8d841c63c format documents 2026-09-06 15:58:18 +02:00
tobid7 8983371806 unload debugfont and add Gfx debug menu 2026-09-06 15:58:18 +02:00
tobid7 2b4c4bacd6 fix random garbage ptr issues 2026-09-06 15:58:18 +02:00
tobid7 859a4c96ae Fix Indexorder issues and patchfixsomehow dx9 tex filtering 2026-09-06 15:58:18 +02:00
tobid7 0e0d576954 No big update without msvc compiler errors :/ 2026-09-06 15:58:18 +02:00
tobid7 4a29cb4330 More timings 2026-09-06 15:58:18 +02:00
tobid7 e0b86ee3f6 UI7 is BACK!
took me about a full week to get something to render again withour shared_ptrs
as of now this is very unstable, untested and lacking a lot of features due to lithium is lacking the base for that
Added JetBrainsMono font as debug font for the metrics
2026-09-06 15:58:17 +02:00
tobid7 b121001db7 Add missing GetDriverName to Os 2026-09-06 15:58:17 +02:00
tobid7 2059772ad1 Draw the line (oder so) 2026-09-06 15:58:17 +02:00
tobid7 81aa08485b Load the font async for now 2026-09-06 15:58:17 +02:00
tobid7 ecadf0a44c n3ds-boost 2026-09-06 15:58:17 +02:00
tobid7 6dfc04378a SDF & MONOSPACE FONT RENDERING 2026-09-06 15:58:17 +02:00
tobid7 e3ffcbb596 save 75% of font memory 2026-09-06 15:58:16 +02:00
tobid7 469cd535fd Upload pools once per Gfx::Draw and FIX DX9 2026-09-06 15:58:16 +02:00
tobid7 b594e09bdb reset pools on newframe 2026-09-06 15:58:16 +02:00
tobid7 41b25e4476 move global pools into gfx driver
prevents double copy problems
saves memory
(needs to be optimized...)
2026-09-06 15:58:16 +02:00
tobid7 25607b865c faster rect command creation 2026-09-06 15:58:16 +02:00
tobid7 1bf103c894 cache ascii chars directly 2026-09-06 15:58:16 +02:00
tobid7 11a480136b insane performance boost (on 3ds) 2026-09-06 15:58:16 +02:00
tobid7 e6fcfe0650 time trace is back 2026-09-06 15:58:15 +02:00
tobid7 a8a80cfa47 implement Image::Convert and Image::Flip 2026-09-06 15:58:15 +02:00
tobid7 b7f1037b18 pool append move and copy 2026-09-06 15:58:15 +02:00
tobid7 de51a35734 # small fixes
- Fix Os::GetTimeNano()
- only build tests on non vendored usage
2026-09-06 15:58:15 +02:00
tobid7 13152a317a Fix 2026-09-06 15:58:15 +02:00
tobid7 5dd5907c43 Fix 3ds build and update libpicasso 2026-09-06 15:58:15 +02:00
tobid7 673e53935a remove poc func 2026-09-06 15:58:15 +02:00
tobid7 dda8258064 Add support for rotated gradients 2026-09-06 15:58:14 +02:00
tobid7 0c55291f9c Add stick and trigger input support 2026-09-06 15:58:14 +02:00
tobid7 c5f6f0cb33 Fix clang warning 2026-09-06 15:58:14 +02:00
tobid7 391eea100a fix preset names for Selection Views 2026-09-06 15:58:14 +02:00
tobid7 d70a9970e9 Add NX Hid Driver Template
- Add WIP HidNX Driver (clangd not working with devkitpro for switch on windows)
- Add default-release as default search path for compile_commands.json
- remove mingw preset (casue its exactly the default target)
- Move Mouse pos cycle into HidDriver::Update
- Test around with HidGlfw on Nintendo switch
2026-09-06 15:58:14 +02:00
tobid7 0f044538cc Add proper Gamepad support (WIP) 2026-09-06 15:58:14 +02:00
tobid7 546940aa77 allo wPD::Color in Drawlist 2026-09-06 15:58:14 +02:00
tobid7 dc365bc658 Add Input functionality to Ultra
- Add point InSpace check to PD::Li::Math
- Add Universal AlignmentCenter flag for Horizontal and and Vertical Alignment
-  Add Fallbackfont to Layout (if you dont want to set font per object)
- Add Button Object WIP
- Rename OnHover to OnFocus and add OnUnfocus
- Move font and FontScale to ElementBase (for fallback logic etc)
- Add UpdateInput func to ElementBase
- Corectly Set fontScale in Text Rendering
- Update ecample
2026-09-06 15:58:13 +02:00
tobid7 1ccc7075fa Allow implicit usage of "#ffffffff" etc 2026-09-06 15:58:13 +02:00
tobid7 b069f10841 Add HidDriver base and small HidGLFW driver 2026-09-06 15:58:13 +02:00
tobid7 bf3eef8d28 rename PDBackendFlags to PDGfxBackendFlags 2026-09-06 15:58:13 +02:00
tobid7 6298d4c816 Implement VCanvas and Update TextElem
- Text now requires a font and is able to take an individual scale
- Container requires &ref for Elements to make sure they always exist
- SetViewport now sets the canvas as well
- SetBaseViewport Sets the Virtual Canvas Size
- Layout Now requires a Drawlist reference in Render function
- main.cpp: updated the template
2026-09-06 15:58:13 +02:00
tobid7 212ba0c617 Actually implement ultra-rendering 2026-09-06 15:58:13 +02:00
tobid7 b4a7260cf2 Rework Project Ultra
- Added container
- Made container the base of Layout
- Set Containers theirself as pParent for Elements on Push
2026-09-06 15:58:13 +02:00
tobid7 5cf9ff0109 Fix path rects 2026-09-06 15:58:12 +02:00
tobid7 69b5e74d91 Fixing riunded rects 2026-09-06 15:58:12 +02:00
tobid7 9b69d78118 Add a default preset (for linux/macos default builds) 2026-09-06 15:58:12 +02:00
tobid7 e573523511 Add cmake presets
- MSVC requires cmake for Windows
- mingw only builds when GLSLANG is excluded due to wrong header generation
2026-09-06 15:58:12 +02:00
tobid7 1317599475 build 3dsx and nro in ALL stage 2026-09-06 15:58:12 +02:00
tobid7 1876ab9365 More stuff done at Project Ultra
- Added renderspace
- Revision System (to not always update pRenderspace
- added some test scene
2026-09-06 15:58:12 +02:00
tobid7 ce2dc94121 WIP (Codename Ultra) UI lib 2026-09-06 15:58:12 +02:00
tobid7 bef8ced350 implement font deletion 2026-09-06 15:58:11 +02:00
tobid7 dd038883a0 Fix font bugs 2026-09-06 15:58:11 +02:00
tobid7 7ad2b8b0c5 Add debug getters (and somehow text is not rendering :/) 2026-09-06 15:58:11 +02:00
tobid7 63fb09189d Fix Vertex Alloc usage at Index Alloc 2026-09-06 15:58:11 +02:00
tobid7 306ddfed53 Readd font support (not workign yet) 2026-09-06 15:58:11 +02:00
tobid7 c2b0fa01db Update lazyvec / vec api as well as rect are mostly constexpr now 2026-09-06 15:58:11 +02:00
tobid7 594cf5cca4 Always disable glslang build for NintendoSwitch on Windows 2026-09-06 15:58:10 +02:00
tobid7 191bca26d5 Present DX9 Frames ... 2026-09-06 15:58:10 +02:00
tobid7 85a92f8371 Add a PositionTranslate func and add Errors for TextureSize mismatch 2026-09-06 15:58:10 +02:00
tobid7 f3d326c237 Add PD::Image and add a setter for logfilter 2026-09-06 15:58:10 +02:00
tobid7 fda39b3d36 Forgot about dx9 (UNTESTED!!!) 2026-09-06 15:58:10 +02:00
tobid7 8e09025c40 Add Os Bridge into test framework 2026-09-06 15:58:10 +02:00
tobid7 2a57b7c08c Refactor PD::Li Pools system, Upgrade PD::Pool and add better logging
- Add ResetFast to Pool using c++20 concept
- Add Put function to Pool
- Use Pool Index instead of pointers in Command
- Add accessor to Li Pools to prevent wrong command usage
- Add Command Formatter
- Use ResetFast for all Pools
- Add Reset func to Li::Vertex (for ResetFast)
- Add Pool Expandor and Put funcs to Lithium pools
- Add getters for GfxDriverBase to PD::Li Pools
2026-09-06 15:58:10 +02:00
tobid7 9d0565f60c Add nintendo switch support 2026-09-06 15:58:09 +02:00
tobid7 4691d158a9 Remove Gfx Driver Vertex and IndexBuffer size config 2026-09-06 15:58:09 +02:00
tobid7 57c376a822 Add Drawlist
- Add Pool iterator support
- Add Pool Expandability
- Add Pool::Push
- Add Lithium Maths API
- Remove InitPools
- update spirv-helper
2026-09-06 15:58:09 +02:00
tobid7 d72c447875 Replace spirv-helper stuff with a library that combines everything 2026-09-06 15:58:09 +02:00
tobid7 518015afb1 Add the shaders 2026-09-06 15:58:09 +02:00
tobid7 e6a60e90d1 Add pdsg (palladium spirv-generator)
- remove glslang from pd-system
- use spirv blobs instead of glsl 460
- Use Legacy shaders for OpenGL2 backend
- add devnotes
2026-09-06 15:58:09 +02:00
tobid7 9d63a17700 Add SpirvHelper (Shader cross compilation)
- Make OpenGL2 and OpenGL3 use the same base shaders (using SpirvHelper)
- Add Transpose func to Mat4
2026-09-06 15:58:09 +02:00
tobid7 fd498c5ea2 Add missing sources 2026-09-06 15:58:08 +02:00
tobid7 0cc886315d Full 3ds support and fix dx9 2026-09-06 15:58:08 +02:00
tobid7 1b9876f64b Work at 3ds support and backend upgrades
- Track textures (not sure if this is done tbh)
- Add lithium formatters and move TextureID, TextureFormat and TextureFilter to lithium
- Only include gl-helper if any glDriver is included
- Add Li::Rect for UV stuff
- Add Li::Texture as Info holder (still thinking of making them to ptrs
- Add Check if textures are still loaded on exit
2026-09-06 15:58:08 +02:00
tobid7 cd904ea544 Add backends
- Renamed GfxOpenGL to GfxOPenGL2
- Added GfxOpenGL3 backend for OpenGL 3.3+
- Added WIP DirectX9 backend
- Added structure for Citro3D
- Added linear Allocator
2026-09-06 15:58:08 +02:00
tobid7 e43cb41377 More work to drivers
- Add gfx_test
- add texture loading to GfxOpenGL
- add full submit code
- add debug logging
- add construct and destroy functionality to Pool
- add command functionality
- add vertex and index pools to lithium (static and not threadsafe yet)
- Update GfxDriver Matrix with SetViewPort
- Add glfw (only dependency of gfx_test) maybe later required for input driver
2026-09-06 15:58:08 +02:00
tobid7 b2d3d203a2 - Update pool to use template allocator directly instead of std::vector
- Add a GfxDriver config Template to be able to modify settings like allocators / Types for specific Drivers
- Add glad
2026-09-06 15:58:04 +02:00
tobid7 f1a63fe383 0.7.0 rewrite dev
- remove everyting
- keep core
-rename bit_utils to bits
- add formatter for  color
- add float getters to color
- start with new drivers api
2026-09-06 15:57:14 +02:00
22 changed files with 764 additions and 930 deletions
@@ -29,7 +29,6 @@ class GfxCitro3D : public GfxDriverBase<GfxCitro3DConfig> {
TextureFilter filter = TextureFilter::Linear) override; TextureFilter filter = TextureFilter::Linear) override;
void DeleteTexture(const Li::Texture& tex) override; void DeleteTexture(const Li::Texture& tex) override;
void UploadPools() override; void UploadPools() override;
void ClipRect() override;
private: private:
struct Impl; struct Impl;
@@ -29,7 +29,6 @@ class GfxDirectX9 : public GfxDriverBase<GfxDirectX9Config> {
TextureFilter filter = TextureFilter::Linear) override; TextureFilter filter = TextureFilter::Linear) override;
void DeleteTexture(const Li::Texture& tex) override; void DeleteTexture(const Li::Texture& tex) override;
void UploadPools() override; void UploadPools() override;
void ClipRect() override;
private: private:
struct Impl; struct Impl;
@@ -28,7 +28,6 @@ class GfxOpenGL2 : public GfxDriverBase<GfxOpenGL2Config> {
TextureFilter filter = TextureFilter::Linear) override; TextureFilter filter = TextureFilter::Linear) override;
void DeleteTexture(const Li::Texture& tex) override; void DeleteTexture(const Li::Texture& tex) override;
void UploadPools() override; void UploadPools() override;
void ClipRect() override;
private: private:
void pSetupShaderAttribs(u32 shader); void pSetupShaderAttribs(u32 shader);
@@ -28,7 +28,6 @@ class GfxOpenGL3 : public GfxDriverBase<GfxOpenGL3Config> {
TextureFilter filter = TextureFilter::Linear) override; TextureFilter filter = TextureFilter::Linear) override;
void DeleteTexture(const Li::Texture& tex) override; void DeleteTexture(const Li::Texture& tex) override;
void UploadPools() override; void UploadPools() override;
void ClipRect() override;
private: private:
u32 pShader = 0; u32 pShader = 0;
-12
View File
@@ -141,9 +141,6 @@ void GfxCitro3D::SysInit() {
PDLOG("GfxCitro3D::SysInit();"); PDLOG("GfxCitro3D::SysInit();");
impl = new Impl(); impl = new Impl();
Flags |= PDGfxBackendFlags_FlipUV_Y; Flags |= PDGfxBackendFlags_FlipUV_Y;
Flags |= PDGfxBackendFlags_HasClipRect;
Flags |= PDGfxBackendFlags_ReqPow2;
Flags |= PDGfxBackendFlags_ApproxSDF;
impl->pShaderRaw = Pica::AssembleCode(LIShaderCTR); impl->pShaderRaw = Pica::AssembleCode(LIShaderCTR);
impl->pCode = DVLB_ParseFile((uint32_t*)impl->pShaderRaw.data(), impl->pCode = DVLB_ParseFile((uint32_t*)impl->pShaderRaw.data(),
impl->pShaderRaw.size()); impl->pShaderRaw.size());
@@ -267,14 +264,6 @@ void GfxCitro3D::UploadPools() {
BufInfo_Init(buf); BufInfo_Init(buf);
BufInfo_Add(buf, GetVertexBufPtr(0), sizeof(Li::Vertex), 3, 0x210); BufInfo_Add(buf, GetVertexBufPtr(0), sizeof(Li::Vertex), 3, 0x210);
} }
void GfxCitro3D::ClipRect() {
// This is so cursed but it works
C3D_SetScissor(CurrentHasClip ? GPU_SCISSOR_NORMAL : GPU_SCISSOR_DISABLE,
ViewPort.y - CurrentClip.w - CurrentClip.y,
ViewPort.x - CurrentClip.z - CurrentClip.x,
ViewPort.y - CurrentClip.y, ViewPort.x - CurrentClip.x);
}
} // namespace PD } // namespace PD
#else #else
namespace PD { namespace PD {
@@ -294,6 +283,5 @@ Li::Texture GfxCitro3D::LoadTexture(const std::vector<PD::u8>& pixels, int w,
} }
void GfxCitro3D::DeleteTexture(const Li::Texture& tex) {} void GfxCitro3D::DeleteTexture(const Li::Texture& tex) {}
void GfxCitro3D::UploadPools() {} void GfxCitro3D::UploadPools() {}
void GfxCitro3D::ClipRect() {}
} // namespace PD } // namespace PD
#endif #endif
-17
View File
@@ -112,7 +112,6 @@ void GfxDirectX9::SysInit() {
} }
if (psBlob) psBlob->Release(); if (psBlob) psBlob->Release();
if (errBlob) errBlob->Release(); if (errBlob) errBlob->Release();
Flags |= PDGfxBackendFlags_HasClipRect;
} else { } else {
PDERR( PDERR(
"GfxDirectX9::SysInit Error: pDevice is not set!\nYOu need to include " "GfxDirectX9::SysInit Error: pDevice is not set!\nYOu need to include "
@@ -286,21 +285,6 @@ void GfxDirectX9::UploadPools() {
memcpy(iptr, GetIndexBufPtr(0), GetIndexPoolSize() * sizeof(u16)); memcpy(iptr, GetIndexBufPtr(0), GetIndexPoolSize() * sizeof(u16));
impl->IBO->Unlock(); impl->IBO->Unlock();
} }
void GfxDirectX9::ClipRect() {
if (CurrentHasClip) {
RECT r;
r.left = CurrentClip.x;
r.top = CurrentClip.y;
r.right = CurrentClip.x + CurrentClip.z;
r.bottom = CurrentClip.y + CurrentClip.w;
impl->Device->SetScissorRect(&r);
impl->Device->SetRenderState(D3DRS_SCISSORTESTENABLE, TRUE);
} else {
impl->Device->SetRenderState(D3DRS_SCISSORTESTENABLE, FALSE);
}
}
} // namespace PD } // namespace PD
#else #else
namespace PD { namespace PD {
@@ -320,6 +304,5 @@ Li::Texture GfxDirectX9::LoadTexture(const std::vector<PD::u8>& pixels, int w,
} }
void GfxDirectX9::DeleteTexture(const Li::Texture& tex) {} void GfxDirectX9::DeleteTexture(const Li::Texture& tex) {}
void GfxDirectX9::UploadPools() {} void GfxDirectX9::UploadPools() {}
void GfxDirectX9::ClipRect() {}
} // namespace PD } // namespace PD
#endif #endif
-12
View File
@@ -73,7 +73,6 @@ void GfxOpenGL2::pSetupShaderAttribs(u32 shader) {
} }
void GfxOpenGL2::SysInit() { void GfxOpenGL2::SysInit() {
Flags |= PDGfxBackendFlags_HasClipRect;
pShader = CreateShaderProgram(pVertCode, pFragCode); pShader = CreateShaderProgram(pVertCode, pFragCode);
glUseProgram(pShader); glUseProgram(pShader);
glGenBuffers(1, &VBO); glGenBuffers(1, &VBO);
@@ -184,16 +183,6 @@ void GfxOpenGL2::UploadPools() {
glBufferData(GL_ELEMENT_ARRAY_BUFFER, GetIndexPoolSize() * sizeof(u16), glBufferData(GL_ELEMENT_ARRAY_BUFFER, GetIndexPoolSize() * sizeof(u16),
GetIndexBufPtr(0), GL_DYNAMIC_DRAW); GetIndexBufPtr(0), GL_DYNAMIC_DRAW);
} }
void GfxOpenGL2::ClipRect() {
if (CurrentHasClip) {
glEnable(GL_SCISSOR_TEST);
glScissor(CurrentClip.x, ViewPort.y - (CurrentClip.y + CurrentClip.w),
CurrentClip.z, CurrentClip.w);
} else {
glDisable(GL_SCISSOR_TEST);
}
}
} // namespace PD } // namespace PD
#else #else
namespace PD { namespace PD {
@@ -214,6 +203,5 @@ Li::Texture GfxOpenGL2::LoadTexture(const std::vector<PD::u8>& pixels, int w,
void GfxOpenGL2::DeleteTexture(const Li::Texture& tex) {} void GfxOpenGL2::DeleteTexture(const Li::Texture& tex) {}
void GfxOpenGL2::pSetupShaderAttribs(u32 shader) {} void GfxOpenGL2::pSetupShaderAttribs(u32 shader) {}
void GfxOpenGL2::UploadPools() {} void GfxOpenGL2::UploadPools() {}
void GfxOpenGL2::ClipRect() {}
} // namespace PD } // namespace PD
#endif #endif
-12
View File
@@ -11,7 +11,6 @@
namespace PD { namespace PD {
void GfxOpenGL3::SysInit() { void GfxOpenGL3::SysInit() {
Flags |= PDGfxBackendFlags_HasClipRect;
std::string vcode = SpirvHelper::SPV2GLSL( std::string vcode = SpirvHelper::SPV2GLSL(
std::vector<unsigned int>( std::vector<unsigned int>(
Shaders::VertexShader, Shaders::VertexShader,
@@ -160,16 +159,6 @@ void GfxOpenGL3::UploadPools() {
glBindVertexArray(0); glBindVertexArray(0);
} }
void GfxOpenGL3::ClipRect() {
if (CurrentHasClip) {
glEnable(GL_SCISSOR_TEST);
glScissor(CurrentClip.x, ViewPort.y - (CurrentClip.y + CurrentClip.w),
CurrentClip.z, CurrentClip.w);
} else {
glDisable(GL_SCISSOR_TEST);
}
}
} // namespace PD } // namespace PD
#else #else
namespace PD { namespace PD {
@@ -189,6 +178,5 @@ Li::Texture GfxOpenGL3::LoadTexture(const std::vector<PD::u8>& pixels, int w,
} }
void GfxOpenGL3::DeleteTexture(const Li::Texture& tex) {} void GfxOpenGL3::DeleteTexture(const Li::Texture& tex) {}
void GfxOpenGL3::UploadPools() {} void GfxOpenGL3::UploadPools() {}
void GfxOpenGL3::ClipRect() {}
} // namespace PD } // namespace PD
#endif #endif
+3 -14
View File
@@ -10,10 +10,7 @@ using PDGfxBackendFlags = PD::u32;
enum PDGfxBackendFlags_ { enum PDGfxBackendFlags_ {
PDGfxBackendFlags_None = 0, PDGfxBackendFlags_None = 0,
PDGfxBackendFlags_FlipUV_Y = 1 << 0, // Essential for font loading PDGfxBackendFlags_FlipUV_Y = 1 << 0, // Essential for font loading
PDGfxBackendFlags_WindingCW = 1 << 1, // Use CW instead of CCW winding PDGfxBackendFlags_WindingCW = 1 << 0, // Use CW instead of CCW winding
PDGfxBackendFlags_HasClipRect = 1 << 2, // Clip rects supported
PDGfxBackendFlags_ReqPow2 = 1 << 3, // Tex size must be pow of 2
PDGfxBackendFlags_ApproxSDF = 1 << 4, // Fake SDF for non smoothstep systems
}; };
namespace PD { namespace PD {
@@ -68,7 +65,6 @@ class PD_API GfxDriver : public DriverInterface {
virtual void SysReset() {} virtual void SysReset() {}
virtual void Submit(size_t count, size_t start) {} virtual void Submit(size_t count, size_t start) {}
virtual void UploadPools() {} // not every driver requires it virtual void UploadPools() {} // not every driver requires it
virtual void ClipRect() {}
void RegisterTexture(const Li::Texture& tex); void RegisterTexture(const Li::Texture& tex);
void UnregisterTexture(const Li::Texture& tex); void UnregisterTexture(const Li::Texture& tex);
@@ -84,8 +80,6 @@ class PD_API GfxDriver : public DriverInterface {
// State Variables oder so // State Variables oder so
TextureID CurrentTex = 0; TextureID CurrentTex = 0;
bool CurrentTexIsSDF = false; bool CurrentTexIsSDF = false;
bool CurrentHasClip = false;
fvec4 CurrentClip = 0;
Mat4 Projection; Mat4 Projection;
ivec2 ViewPort; ivec2 ViewPort;
std::unordered_map<TextureID, Li::Texture> pTextureRegestry; std::unordered_map<TextureID, Li::Texture> pTextureRegestry;
@@ -142,7 +136,7 @@ class GfxDriverBase : public GfxDriver {
for (size_t i = 0; i < commands.size(); i++) { for (size_t i = 0; i < commands.size(); i++) {
const auto& cmd = commands[i]; const auto& cmd = commands[i];
if (cmd.VertexCount > 0) { if (cmd.VertexCount > 0) {
std::memcpy(reinterpret_cast<void*>(pVtxPool.begin() + current_vtx), std::memcpy(pVtxPool.begin() + current_vtx,
vpool.begin() + cmd.FirstVertex, vpool.begin() + cmd.FirstVertex,
cmd.VertexCount * sizeof(Li::Vertex)); cmd.VertexCount * sizeof(Li::Vertex));
} }
@@ -162,19 +156,14 @@ class GfxDriverBase : public GfxDriver {
while (index < commands.size()) { while (index < commands.size()) {
CurrentTex = commands[index].Tex; CurrentTex = commands[index].Tex;
CurrentTexIsSDF = commands[index].SDF; CurrentTexIsSDF = commands[index].SDF;
CurrentHasClip = commands[index].ClipRectUsed;
CurrentClip = commands[index].ClipRect;
if (!CurrentTex) { if (!CurrentTex) {
CurrentTex = pWhite.GetID(); CurrentTex = pWhite.GetID();
} }
size_t num_indices = 0; size_t num_indices = 0;
ClipRect();
while (index < commands.size() && while (index < commands.size() &&
CurrentTexIsSDF == commands[index].SDF && CurrentTexIsSDF == commands[index].SDF &&
(CurrentTex == commands[index].Tex || (CurrentTex == commands[index].Tex ||
(CurrentTex == pWhite.GetID() && commands[index].Tex == 0)) && (CurrentTex == pWhite.GetID() && commands[index].Tex == 0))) {
CurrentClip == commands[index].ClipRect &&
CurrentHasClip == commands[index].ClipRectUsed) {
num_indices += commands[index].IndexCount; num_indices += commands[index].IndexCount;
index++; index++;
} }
-3
View File
@@ -28,9 +28,6 @@ class Command {
// Todo: implement // Todo: implement
size_t VertexCountMax = 0; size_t VertexCountMax = 0;
size_t IndexCountMax = 0; size_t IndexCountMax = 0;
// ClipRect
PD::fvec4 ClipRect;
bool ClipRectUsed = false;
}; };
} // namespace Li } // namespace Li
} // namespace PD } // namespace PD
+2 -7
View File
@@ -128,18 +128,13 @@ class PD_API Drawlist {
void PrimTriangle(Command& cmd, const fvec2& a, const fvec2& b, void PrimTriangle(Command& cmd, const fvec2& a, const fvec2& b,
const fvec2& c, const PD::Color& color); const fvec2& c, const PD::Color& color);
void PushClipRect(const fvec4& r) { pClipRects.push_back(r); }
void PopClipRect() {
if (!pClipRects.empty()) pClipRects.pop_back();
}
bool HasClipRect() { return !pClipRects.empty(); }
private: private:
Texture pCurrentTexture; Texture pCurrentTexture;
int pCurrentLayer = 0; int pCurrentLayer = 0;
Pool<Command> pCommands; Pool<Command> pCommands;
Pool<fvec2> pPath; Pool<fvec2> pPath;
std::vector<fvec4> pClipRects; Pool<Vertex> pVertices;
Pool<u16> pIndices;
Font* pFont = nullptr; Font* pFont = nullptr;
float pFontScale = 1.f; float pFontScale = 1.f;
}; };
+1 -1
View File
@@ -48,7 +48,7 @@ class PD_API Container {
*/ */
Container(const fvec4& box) Container(const fvec4& box)
: pos(fvec2(box.x, box.y)), size(fvec2(box.z - box.x, box.w - box.y)) {} : pos(fvec2(box.x, box.y)), size(fvec2(box.z - box.x, box.w - box.y)) {}
virtual ~Container() = default; ~Container() = default;
/** /**
* Init Function Required by every Object that uses * Init Function Required by every Object that uses
-2
View File
@@ -87,8 +87,6 @@ enum UI7LytAdd_ {
UI7LytAdd_NoCursorUpdate = 1 << 0, ///< Add without cursor alignment UI7LytAdd_NoCursorUpdate = 1 << 0, ///< Add without cursor alignment
UI7LytAdd_NoScrollHandle = 1 << 1, ///< Skip HandleScrolling UI7LytAdd_NoScrollHandle = 1 << 1, ///< Skip HandleScrolling
UI7LytAdd_Front = 1 << 2, ///< Add in front of the list UI7LytAdd_Front = 1 << 2, ///< Add in front of the list
UI7LytAdd_NoGlobalClipping = 1 << 3, ///< Dont use global Layout clip rect
UI7LytAdd_NoClipTitlebar = 1 << 4, ///< Dont clip content behind the titlebar
}; };
/** /**
-2
View File
@@ -56,8 +56,6 @@ void Command::Reset() {
VertexCount = 0; VertexCount = 0;
VertexCountMax = 0; VertexCountMax = 0;
IndexCountMax = 0; IndexCountMax = 0;
ClipRect = 0.f;
ClipRectUsed = false;
} }
Command& Command::Add(const Vertex& vtx) { Command& Command::Add(const Vertex& vtx) {
-5
View File
@@ -43,7 +43,6 @@ PD_API void Drawlist::Clear() {
pPath.ResetFast(); pPath.ResetFast();
pCommands.NoReset(); pCommands.NoReset();
pCurrentLayer = 0; pCurrentLayer = 0;
pClipRects.clear();
} }
/** Command Allocation */ /** Command Allocation */
@@ -52,10 +51,6 @@ PD_API Command& Drawlist::NewCommand() {
cmd->Reset(); cmd->Reset();
cmd->Layer = pCurrentLayer; cmd->Layer = pCurrentLayer;
cmd->Tex = pCurrentTexture.GetID(); cmd->Tex = pCurrentTexture.GetID();
if (HasClipRect()) {
cmd->ClipRectUsed = HasClipRect();
cmd->ClipRect = pClipRects.back();
}
return *cmd; return *cmd;
} }
+2 -2
View File
@@ -44,13 +44,13 @@ PD_API void Container::HandleInternalInput() {
/** Internal function */ /** Internal function */
PD_API void Container::PreDraw() { PD_API void Container::PreDraw() {
if (pCLipRectUsed) { if (pCLipRectUsed) {
list->PushClipRect(pClipRect); // list->PushClipRect(pClipRect);
} }
} }
/** Internal function */ /** Internal function */
PD_API void Container::PostDraw() { PD_API void Container::PostDraw() {
if (pCLipRectUsed) { if (pCLipRectUsed) {
list->PopClipRect(); // list->PopClipRect();
} }
} }
} // namespace UI7 } // namespace UI7
+1 -1
View File
@@ -28,7 +28,7 @@ SOFTWARE.
namespace PD { namespace PD {
PD_API UI7::IO::IO() : CurrentViewPort("", 0), DeltaStats(60) { PD_API UI7::IO::IO() : DeltaStats(60), CurrentViewPort("", 0) {
/** Probably not the best solution i guess */ /** Probably not the best solution i guess */
// CurrentViewPort = // CurrentViewPort =
// ViewPort::New("Default", ivec4(ivec2(0, 0), pCtx.Gfx()->ViewPort)); // ViewPort::New("Default", ivec4(ivec2(0, 0), pCtx.Gfx()->ViewPort));
+4 -14
View File
@@ -77,10 +77,6 @@ PD_API void Layout::AddObject(Container* obj) {
obj->Update(); obj->Update();
CursorMove(obj->GetSize()); CursorMove(obj->GetSize());
obj->HandleScrolling(ScrollOffset, WorkRect); obj->HandleScrolling(ScrollOffset, WorkRect);
if (Flags & UI7LayoutFlags_UseClipRect) {
obj->SetClipRect(
fvec4(Pos.x, Pos.y + WorkRect.y, Size.x, Size.y - WorkRect.y));
}
Objects.push_back(obj); Objects.push_back(obj);
} }
@@ -97,15 +93,6 @@ PD_API void Layout::AddObjectEx(Container* obj, u32 flags) {
if (!(flags & UI7LytAdd_NoScrollHandle)) { if (!(flags & UI7LytAdd_NoScrollHandle)) {
obj->HandleScrolling(ScrollOffset, WorkRect); obj->HandleScrolling(ScrollOffset, WorkRect);
} }
if (Flags & UI7LayoutFlags_UseClipRect &&
!(flags & UI7LytAdd_NoGlobalClipping)) {
if (flags & UI7LytAdd_NoClipTitlebar) {
obj->SetClipRect(fvec4(Pos.x, Pos.y, Size.x, Size.y));
} else {
obj->SetClipRect(
fvec4(Pos.x, Pos.y + WorkRect.y, Size.x, Size.y - WorkRect.y));
}
}
if (flags & UI7LytAdd_Front) { if (flags & UI7LytAdd_Front) {
Objects.push_front(obj); Objects.push_front(obj);
} else { } else {
@@ -184,6 +171,9 @@ PD_API void Layout::Update() {
it->SetPos(it->GetPos() + Pos); it->SetPos(it->GetPos() + Pos);
it->HandleInput(); it->HandleInput();
it->UnlockInput(); it->UnlockInput();
if (Flags & UI7LayoutFlags_UseClipRect) {
it->SetClipRect(fvec4(Pos, Size));
}
it->PreDraw(); it->PreDraw();
it->Draw(); it->Draw();
it->PostDraw(); it->PostDraw();
@@ -211,7 +201,7 @@ PD_API void Layout::Label(const std::string& label) {
// Layout API // Layout API
auto r = IO.LabelPool.Allocate(); auto r = IO.LabelPool.Allocate();
*r = UI7::Label(label, IO); *r = UI7::Label(label, IO);
// r->SetClipRect(fvec4(GetPosition(), GetSize())); r->SetClipRect(fvec4(GetPosition(), GetPosition() + GetSize()));
AddObject(r); AddObject(r);
} }
Executable → Regular
+5 -9
View File
@@ -27,7 +27,7 @@ SOFTWARE.
namespace PD { namespace PD {
namespace UI7 { namespace UI7 {
Menu::Menu(const ID& id, IO& io) : pLayout(id, io), pIO(io), pID(id) { Menu::Menu(const ID& id, IO& io) : pIO(io), pID(id), pLayout(id, io) {
TitleBarHeight = pIO.FontScale * pIO.Font->PixelHeight + pIO.MenuPadding.y; TitleBarHeight = pIO.FontScale * pIO.Font->PixelHeight + pIO.MenuPadding.y;
pLayout.WorkRect.y += TitleBarHeight; pLayout.WorkRect.y += TitleBarHeight;
pLayout.Flags |= UI7LayoutFlags_UseClipRect; pLayout.Flags |= UI7LayoutFlags_UseClipRect;
@@ -248,7 +248,7 @@ PD_API void Menu::DrawBaseLayout() {
fvec2(pLayout.GetSize().x, pLayout.GetSize().y - TitleBarHeight)); fvec2(pLayout.GetSize().x, pLayout.GetSize().y - TitleBarHeight));
r->SetPos(fvec2(0, TitleBarHeight)); r->SetPos(fvec2(0, TitleBarHeight));
pLayout.AddObjectEx(r, UI7LytAdd_NoCursorUpdate | UI7LytAdd_NoScrollHandle | pLayout.AddObjectEx(r, UI7LytAdd_NoCursorUpdate | UI7LytAdd_NoScrollHandle |
UI7LytAdd_Front | UI7LytAdd_NoClipTitlebar); UI7LytAdd_Front);
} }
if (!(Flags & UI7MenuFlags_NoTitlebar)) { if (!(Flags & UI7MenuFlags_NoTitlebar)) {
DynObj* r = pIO.DynObjPool.Allocate(); DynObj* r = pIO.DynObjPool.Allocate();
@@ -273,8 +273,7 @@ PD_API void Menu::DrawBaseLayout() {
}); });
r->SetSize(fvec2(pLayout.GetSize().x, TitleBarHeight)); r->SetSize(fvec2(pLayout.GetSize().x, TitleBarHeight));
r->SetPos(0); r->SetPos(0);
pLayout.AddObjectEx(r, UI7LytAdd_NoCursorUpdate | UI7LytAdd_NoScrollHandle | pLayout.AddObjectEx(r, UI7LytAdd_NoCursorUpdate | UI7LytAdd_NoScrollHandle);
UI7LytAdd_NoClipTitlebar);
/** Collapse Sym */ /** Collapse Sym */
if (!(Flags & UI7MenuFlags_NoCollapse)) { if (!(Flags & UI7MenuFlags_NoCollapse)) {
@@ -297,9 +296,8 @@ PD_API void Menu::DrawBaseLayout() {
}); });
r->SetSize(TitleBarHeight - pIO.FramePadding.y * 2); r->SetSize(TitleBarHeight - pIO.FramePadding.y * 2);
r->SetPos(pIO.FramePadding); r->SetPos(pIO.FramePadding);
pLayout.AddObjectEx(r, UI7LytAdd_NoCursorUpdate | pLayout.AddObjectEx(r,
UI7LytAdd_NoScrollHandle | UI7LytAdd_NoCursorUpdate | UI7LytAdd_NoScrollHandle);
UI7LytAdd_NoClipTitlebar);
} }
/** Close Sym (only shown if pIsShown is not nullptr) */ /** Close Sym (only shown if pIsShown is not nullptr) */
if (!(Flags & UI7MenuFlags_NoClose) && pIsShown) { if (!(Flags & UI7MenuFlags_NoClose) && pIsShown) {
@@ -312,13 +310,11 @@ PD_API void Menu::DrawBaseLayout() {
fvec2 cpos = fvec2 cpos =
fvec2(pLayout.Pos.x + pLayout.Size.x - size.x - pIO.FramePadding.x, fvec2(pLayout.Pos.x + pLayout.Size.x - size.x - pIO.FramePadding.x,
pLayout.Pos.y + pIO.FramePadding.y); pLayout.Pos.y + pIO.FramePadding.y);
pLayout.DrawList.SetLayer(21);
pLayout.DrawList.DrawLine(cpos, cpos + size, pLayout.DrawList.DrawLine(cpos, cpos + size,
pIO.Theme.Get(UI7Color_FrameBackground), 2); pIO.Theme.Get(UI7Color_FrameBackground), 2);
pLayout.DrawList.DrawLine(cpos + fvec2(0, size.y), pLayout.DrawList.DrawLine(cpos + fvec2(0, size.y),
cpos + fvec2(size.x, 0), cpos + fvec2(size.x, 0),
pIO.Theme.Get(UI7Color_FrameBackground), 2); pIO.Theme.Get(UI7Color_FrameBackground), 2);
pLayout.DrawList.SetLayer(0);
} }
} }
} }
+2 -12
View File
@@ -158,7 +158,7 @@ PD_API void Context::AboutMenu(bool* show) {
if (auto m = BeginMenu("About UI7", UI7MenuFlags_Scrolling, show)) { if (auto m = BeginMenu("About UI7", UI7MenuFlags_Scrolling, show)) {
m->Label("Palladium UI7 " + GetVersion()); m->Label("Palladium UI7 " + GetVersion());
m->Separator(); m->Separator();
m->Label("(c) 2023-2026 René Amthor"); m->Label("(c) 2023-2025 René Amthor");
m->Label("UI7 is licensed under the MIT License."); m->Label("UI7 is licensed under the MIT License.");
m->Label("See LICENSE for more information."); m->Label("See LICENSE for more information.");
static bool show_build; static bool show_build;
@@ -207,17 +207,7 @@ PD_API void Context::MetricsMenu(bool* show) {
} }
m->SeparatorText("Palladium Info"); m->SeparatorText("Palladium Info");
m->Label("Os Driver: {}", PD::Os::GetDriverName()); m->Label("Os Driver: {}", PD::Os::GetDriverName());
if (m->BeginTreeNode( m->Label("Renderer: {}", PD::Gfx::GetDriverName());
std::format("Gfx Driver: {}", PD::Gfx::GetDriverName()))) {
m->SeparatorText("Features");
if (PD::Gfx::GetFlags() & PDGfxBackendFlags_HasClipRect)
m->Label("ClipRects");
if (PD::Gfx::GetFlags() & PDGfxBackendFlags_ReqPow2)
m->Label("Texture As Pow of 2");
if (PD::Gfx::GetFlags() & PDGfxBackendFlags_ApproxSDF)
m->Label("SDF Approximation");
m->EndTreeNode();
}
if (m->BeginTreeNode( if (m->BeginTreeNode(
std::string(std::string("Input: ") + PD::Hid::GetDriverName()))) { std::string(std::string("Input: ") + PD::Hid::GetDriverName()))) {
/* if (pIO.pCtx.Hid()->Flags & PD::HidDriver::Flags_HasKeyboard) { /* if (pIO.pCtx.Hid()->Flags & PD::HidDriver::Flags_HasKeyboard) {
-55
View File
@@ -1,55 +0,0 @@
cmake_minimum_required(VERSION 3.22)
project(test)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED true)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
set(CMAKE_EXPORT_COMPILE_COMMANDS true)
if(${CMAKE_SYSTEM_NAME} STREQUAL "Nintendo3DS")
if(${PD_BUILD_SHARED})
message(ERROR "3DS Only supports Static libraries")
endif()
endif()
add_subdirectory(../ palladium)
if(${CMAKE_SYSTEM_NAME} STREQUAL "Nintendo3DS")
add_subdirectory(../backends/3ds pd-3ds)
else()
add_subdirectory(../backends/desktop pd-desktop)
endif()
add_executable(test source/main.cpp
${BKND_SRC})
if(${CMAKE_SYSTEM_NAME} STREQUAL "Nintendo3DS")
target_link_libraries(test PUBLIC pd-3ds palladium)
else()
target_link_libraries(test PUBLIC pd-desktop palladium)
endif()
if(${CMAKE_SYSTEM_NAME} STREQUAL "Nintendo3DS")
target_compile_options(palladium PRIVATE
$<$<COMPILE_LANGUAGE:C>:-Wall>
$<$<COMPILE_LANGUAGE:C>:-Wno-psabi>
$<$<COMPILE_LANGUAGE:CXX>:-fno-exceptions>
)
endif()
if(CMAKE_BUILD_TYPE STREQUAL "Release")
target_compile_options(palladium PRIVATE
$<$<CONFIG:Debug>:-O0 -g>
$<$<CONFIG:Release>:-O3>
)
endif()
# set(RC_FILES
# testassets/ComicNeue.ttf
# testassets/logo.png
# testassets/test.png)
# install(FILES ${RC_FILES} DESTINATION ".")
# else()
# target_link_libraries(test PUBLIC pd-backend-3ds ctru citro3d)
# endif()
+1 -3
View File
@@ -210,7 +210,6 @@ int main(int argc, char** argv) {
ui7.GetIO().Font = &font; ui7.GetIO().Font = &font;
ui7.AddViewPort("Default", PD::ivec4(0, 0, 1280, 720)); ui7.AddViewPort("Default", PD::ivec4(0, 0, 1280, 720));
ui7.UseViewPort("Default"); ui7.UseViewPort("Default");
bool pMetricsWin = true;
while (pOs->Mainloop()) { while (pOs->Mainloop()) {
PD::TT::End("OSCTX::MainLoop"); PD::TT::End("OSCTX::MainLoop");
pOs->ClearViewPort(); pOs->ClearViewPort();
@@ -316,8 +315,7 @@ int main(int argc, char** argv) {
m->PopFont(); m->PopFont();
ui7.EndMenu(); ui7.EndMenu();
} }
ui7.MetricsMenu(&pMetricsWin); ui7.MetricsMenu();
ui7.StyleEditor();
PD::TT::End("BuildUI7Menus"); PD::TT::End("BuildUI7Menus");
PD::TT::Beg("UI7::Context::Update"); PD::TT::Beg("UI7::Context::Update");
ui7.Update(); ui7.Update();