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:
44
backends/include/pd_system/gfx_opengl3.hpp
Normal file
44
backends/include/pd_system/gfx_opengl3.hpp
Normal file
@@ -0,0 +1,44 @@
|
||||
#pragma once
|
||||
|
||||
#include <pd/drivers/gfx.hpp>
|
||||
|
||||
namespace PD {
|
||||
struct GfxOpenGL3Config {
|
||||
// Vertex Allocator
|
||||
template <typename T>
|
||||
using VertexAlloc = std::allocator<T>;
|
||||
// Index Allocator
|
||||
template <typename T>
|
||||
using IndexAlloc = std::allocator<T>;
|
||||
|
||||
static constexpr size_t NumVertices = 32768; // 8192*4
|
||||
static constexpr size_t NumIndices = 49152; // 8192*6
|
||||
};
|
||||
|
||||
class GfxOpenGL3 : public GfxDriverBase<GfxOpenGL3Config> {
|
||||
public:
|
||||
GfxOpenGL3() : GfxDriverBase("OpenGL3") {}
|
||||
~GfxOpenGL3() {}
|
||||
|
||||
void SysInit() override;
|
||||
void SysDeinit() override;
|
||||
void Submit(size_t count, size_t start) override;
|
||||
void BindTexture(TextureID id) override;
|
||||
void SysReset() override;
|
||||
TextureID LoadTexture(const std::vector<PD::u8>& pixels, int w, int h,
|
||||
TextureFormat type = TextureFormat::RGBA32,
|
||||
TextureFilter filter = TextureFilter::Linear) override;
|
||||
void DeleteTexture(const TextureID& tex) override;
|
||||
|
||||
private:
|
||||
u32 pShader = 0;
|
||||
u32 VBO = 0;
|
||||
u32 IBO = 0;
|
||||
u32 VAO = 0;
|
||||
int pLocTex = 0;
|
||||
int pLocAlfa = 0;
|
||||
int pLocProjection = 0;
|
||||
static const char* pVertCode;
|
||||
static const char* pFragCode;
|
||||
};
|
||||
} // namespace PD
|
||||
Reference in New Issue
Block a user