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
This commit is contained in:
2026-03-18 09:31:47 +01:00
parent d4c59e5b61
commit e04046720b
28 changed files with 791 additions and 243 deletions

View File

@@ -1,5 +1,6 @@
// Well yes, i finally try it
#include <pd/lithium/formatters.hpp>
#include <pd_system/gfx_directx9.hpp>
// Sicher ist sicher
@@ -182,9 +183,9 @@ void GfxDirectX9::SysReset() {
impl->Device->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA);
}
TextureID GfxDirectX9::LoadTexture(const std::vector<PD::u8>& pixels, int w,
int h, TextureFormat type,
TextureFilter filter) {
Li::Texture GfxDirectX9::LoadTexture(const std::vector<PD::u8>& pixels, int w,
int h, TextureFormat type,
TextureFilter filter) {
if (!impl || !impl->Device) return 0;
IDirect3DTexture9* tex = nullptr;
D3DFORMAT fmt = D3DFMT_A8R8G8B8;
@@ -234,15 +235,19 @@ TextureID GfxDirectX9::LoadTexture(const std::vector<PD::u8>& pixels, int w,
}
tex->UnlockRect(0);
PDLOG("GfxDirectX9::LoadTexture -> [{}] 0x{:X}, [{}, {}]", PD::ivec2(w, h),
(TextureID)tex, type, filter);
return (TextureID)tex;
Li::Texture res;
res.SetID((TextureID)tex);
res.SetSize(w, h);
res.SetUV(0.f, 0.f, 1.f, 1.f);
RegisterTexture(res);
PDLOG("GfxDirectX9::LoadTexture -> {{ {} }}, [{}, {}]", res, type, filter);
return res;
}
void GfxDirectX9::DeleteTexture(const TextureID& tex) {
if (!tex) return;
IDirect3DTexture9* t = (IDirect3DTexture9*)tex;
void GfxDirectX9::DeleteTexture(const Li::Texture& tex) {
if (!tex.GetID()) return;
UnRegisterTexture(tex);
IDirect3DTexture9* t = (IDirect3DTexture9*)tex.GetID();
t->Release();
}
} // namespace PD
@@ -257,11 +262,11 @@ void GfxDirectX9::SysDeinit() {}
void GfxDirectX9::Submit(size_t count, size_t start) {}
void GfxDirectX9::BindTexture(TextureID id) {}
void GfxDirectX9::SysReset() {}
TextureID GfxDirectX9::LoadTexture(const std::vector<PD::u8>& pixels, int w,
int h, TextureFormat type,
TextureFilter filter) {
return 0;
Li::Texture GfxDirectX9::LoadTexture(const std::vector<PD::u8>& pixels, int w,
int h, TextureFormat type,
TextureFilter filter) {
return Li::Texture();
}
void GfxDirectX9::DeleteTexture(const TextureID& tex) {}
void GfxDirectX9::DeleteTexture(const Li::Texture& tex) {}
} // namespace PD
#endif