Add backends

- Renamed GfxOpenGL to GfxOPenGL2
- Added GfxOpenGL3 backend for OpenGL 3.3+
- Added WIP DirectX9 backend
- Added structure for Citro3D
- Added linear Allocator
This commit is contained in:
2026-03-17 16:47:19 +01:00
parent fe9194b907
commit d4c59e5b61
25 changed files with 1109 additions and 188 deletions

View File

@@ -1,6 +1,6 @@
#include <iostream>
#include <pd/common.hpp>
void PD::Log(const std::string& txt) {
PD_API void PD::Log(const std::string& txt) {
std::cout << "[PD] " << txt << std::endl;
}

View File

@@ -3,19 +3,20 @@
namespace PD {
PD_API std::unique_ptr<GfxDriver> Gfx::driver;
GfxDriver::GfxDriver(std::string_view name) : DriverInterface(name) {}
PD_API GfxDriver::GfxDriver(std::string_view name) : DriverInterface(name) {}
void GfxDriver::SetViewPort(const ivec2& size) {
PD_API void GfxDriver::SetViewPort(const ivec2& size) {
ViewPort = size;
Projection = Mat4::Ortho(0.f, ViewPort.x, ViewPort.y, 0.f, 1.f, -1.f);
}
void GfxDriver::SetViewPort(int x, int y) {
PD_API void GfxDriver::SetViewPort(int x, int y) {
ViewPort.x = x;
ViewPort.y = y;
Projection = Mat4::Ortho(0.f, ViewPort.x, ViewPort.y, 0.f, 1.f, -1.f);
}
void GfxDriver::Reset() {
PD_API void GfxDriver::Reset() {
CurrentVertex = 0;
CurrentIndex = 0;
ResetPools();

View File

@@ -9,16 +9,16 @@ namespace Li {
PD::Pool<Vertex> pVtxPool;
PD::Pool<u16> pIdxPool;
void InitPools(size_t max_vertices) {
PD_API void InitPools(size_t max_vertices) {
pVtxPool.Init(max_vertices);
pIdxPool.Init(max_vertices * 2);
}
Vertex* AllocateVertices(size_t count) { return pVtxPool.Allocate(count); }
PD_API Vertex* AllocateVertices(size_t count) { return pVtxPool.Allocate(count); }
u16* AllocateIndices(size_t count) { return pIdxPool.Allocate(count); }
PD_API u16* AllocateIndices(size_t count) { return pIdxPool.Allocate(count); }
void ResetPools() {
PD_API void ResetPools() {
pVtxPool.Reset();
pIdxPool.Reset();
}