# Hotfix
- 3ds backend -probably i forgot to apply the changes of moving Gfx backends to the PD namespace to the 3ds backend :/
This commit is contained in:
@ -59,7 +59,7 @@ class GfxC3D : public GfxDriver {
|
|||||||
PD::Li::Texture::Filter filter =
|
PD::Li::Texture::Filter filter =
|
||||||
PD::Li::Texture::Filter::LINEAR) override;
|
PD::Li::Texture::Filter::LINEAR) override;
|
||||||
|
|
||||||
Vec<Vertex, LinearAlloc<Vertex>> VertexBuffer;
|
Vec<Li::Vertex, LinearAlloc<Li::Vertex>> VertexBuffer;
|
||||||
Vec<u16, LinearAlloc<u16>> IndexBuffer;
|
Vec<u16, LinearAlloc<u16>> IndexBuffer;
|
||||||
int pLocProjection = 0;
|
int pLocProjection = 0;
|
||||||
DVLB_s* ShaderCode;
|
DVLB_s* ShaderCode;
|
||||||
|
@ -73,21 +73,21 @@ unsigned char li_shader[] = {
|
|||||||
size_t li_shader_size = 0x124;
|
size_t li_shader_size = 0x124;
|
||||||
|
|
||||||
namespace PD {
|
namespace PD {
|
||||||
GPU_TEXCOLOR GetTexFmt(Texture::Type type) {
|
GPU_TEXCOLOR GetTexFmt(Li::Texture::Type type) {
|
||||||
if (type == Texture::RGBA32)
|
if (type == Li::Texture::RGBA32)
|
||||||
return GPU_RGBA8;
|
return GPU_RGBA8;
|
||||||
else if (type == Texture::RGB24)
|
else if (type == Li::Texture::RGB24)
|
||||||
return GPU_RGB8;
|
return GPU_RGB8;
|
||||||
else if (type == Texture::A8)
|
else if (type == Li::Texture::A8)
|
||||||
return GPU_A8;
|
return GPU_A8;
|
||||||
return GPU_RGBA8; // Default
|
return GPU_RGBA8; // Default
|
||||||
}
|
}
|
||||||
int GetBPP(Texture::Type type) {
|
int GetBPP(Li::Texture::Type type) {
|
||||||
if (type == Texture::RGBA32)
|
if (type == Li::Texture::RGBA32)
|
||||||
return 4;
|
return 4;
|
||||||
else if (type == Texture::RGB24)
|
else if (type == Li::Texture::RGB24)
|
||||||
return 3;
|
return 3;
|
||||||
else if (type == Texture::A8)
|
else if (type == Li::Texture::A8)
|
||||||
return 1;
|
return 1;
|
||||||
return 0; // Error
|
return 0; // Error
|
||||||
}
|
}
|
||||||
@ -121,10 +121,9 @@ void GfxC3D::NewFrame() {
|
|||||||
CurrentIndex = 0;
|
CurrentIndex = 0;
|
||||||
CurrentVertex = 0;
|
CurrentVertex = 0;
|
||||||
FrameCounter++;
|
FrameCounter++;
|
||||||
VertexCounter = NumVtx;
|
/** Probably completly incorrect but just do it like that */
|
||||||
IndexCounter = NumIdx;
|
VertexCounter = CurrentVertex;
|
||||||
NumVtx = 0;
|
IndexCounter = CurrentIndex;
|
||||||
NumIdx = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GfxC3D::BindTex(PD::Li::TexAddress addr) {
|
void GfxC3D::BindTex(PD::Li::TexAddress addr) {
|
||||||
@ -161,11 +160,9 @@ void GfxC3D::RenderDrawData(const std::vector<PD::Li::Command::Ref>& Commands) {
|
|||||||
Commands[index]->ScissorRect == ScissorRect) {
|
Commands[index]->ScissorRect == ScissorRect) {
|
||||||
auto c = Commands[index].get();
|
auto c = Commands[index].get();
|
||||||
for (size_t i = 0; i < c->IndexBuffer.Size(); i++) {
|
for (size_t i = 0; i < c->IndexBuffer.Size(); i++) {
|
||||||
NumIdx++;
|
|
||||||
IndexBuffer[CurrentIndex++] = CurrentVertex + c->IndexBuffer.At(i);
|
IndexBuffer[CurrentIndex++] = CurrentVertex + c->IndexBuffer.At(i);
|
||||||
}
|
}
|
||||||
for (size_t i = 0; i < c->VertexBuffer.Size(); i++) {
|
for (size_t i = 0; i < c->VertexBuffer.Size(); i++) {
|
||||||
NumVtx++;
|
|
||||||
VertexBuffer[CurrentVertex++] = c->VertexBuffer.At(i);
|
VertexBuffer[CurrentVertex++] = c->VertexBuffer.At(i);
|
||||||
}
|
}
|
||||||
index++;
|
index++;
|
||||||
@ -182,7 +179,7 @@ void GfxC3D::RenderDrawData(const std::vector<PD::Li::Command::Ref>& Commands) {
|
|||||||
BindTex(Tex->Address);
|
BindTex(Tex->Address);
|
||||||
auto bufInfo = C3D_GetBufInfo();
|
auto bufInfo = C3D_GetBufInfo();
|
||||||
BufInfo_Init(bufInfo);
|
BufInfo_Init(bufInfo);
|
||||||
BufInfo_Add(bufInfo, VertexBuffer.Data(), sizeof(Vertex), 3, 0x210);
|
BufInfo_Add(bufInfo, VertexBuffer.Data(), sizeof(Li::Vertex), 3, 0x210);
|
||||||
|
|
||||||
C3D_DrawElements(GPU_TRIANGLES, CurrentIndex - StartIndex,
|
C3D_DrawElements(GPU_TRIANGLES, CurrentIndex - StartIndex,
|
||||||
C3D_UNSIGNED_SHORT, IndexBuffer.Data() + StartIndex);
|
C3D_UNSIGNED_SHORT, IndexBuffer.Data() + StartIndex);
|
||||||
@ -213,7 +210,7 @@ PD::Li::Texture::Ref GfxC3D::LoadTex(const std::vector<PD::u8>& pixels, int w,
|
|||||||
1.0 - ((float)h / (float)tex_size.y));
|
1.0 - ((float)h / (float)tex_size.y));
|
||||||
|
|
||||||
// Texture Setup
|
// Texture Setup
|
||||||
auto fltr = (filter == Texture::NEAREST ? GPU_NEAREST : GPU_LINEAR);
|
auto fltr = (filter == Li::Texture::NEAREST ? GPU_NEAREST : GPU_LINEAR);
|
||||||
auto tex_fmt = GetTexFmt(type);
|
auto tex_fmt = GetTexFmt(type);
|
||||||
auto tex = new C3D_Tex;
|
auto tex = new C3D_Tex;
|
||||||
C3D_TexInit(tex, (u16)tex_size.x, (u16)tex_size.y, tex_fmt);
|
C3D_TexInit(tex, (u16)tex_size.x, (u16)tex_size.y, tex_fmt);
|
||||||
@ -245,9 +242,9 @@ PD::Li::Texture::Ref GfxC3D::LoadTex(const std::vector<PD::u8>& pixels, int w,
|
|||||||
|
|
||||||
tex->border = 0x00000000;
|
tex->border = 0x00000000;
|
||||||
C3D_TexSetWrap(tex, GPU_REPEAT, GPU_REPEAT);
|
C3D_TexSetWrap(tex, GPU_REPEAT, GPU_REPEAT);
|
||||||
res->Address = (TexAddress)tex;
|
res->Address = (Li::TexAddress)tex;
|
||||||
std::cout << std::format("Tex {:#08x} Addr {:#08X}", (TexAddress)res.get(),
|
std::cout << std::format("Tex {:#08x} Addr {:#08X}",
|
||||||
res->Address)
|
(Li::TexAddress)res.get(), res->Address)
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user