Refactor the Command / DrawList System
Use Command Pool instead of always allocating. This gives us e big performance diffrence on the 3ds Fixed IDS of ui7 for now
This commit is contained in:
@@ -44,8 +44,7 @@ class GfxGL2 : public GfxDriver {
|
||||
void Deinit() override;
|
||||
void NewFrame() override;
|
||||
void BindTex(PD::Li::TexAddress addr) override;
|
||||
void RenderDrawData(
|
||||
const std::vector<PD::Li::Command::Ref>& Commands) override;
|
||||
void RenderDrawData(const Li::CmdPool& Commands) override;
|
||||
PD::Li::Texture::Ref LoadTex(
|
||||
const std::vector<PD::u8>& pixels, int w, int h,
|
||||
PD::Li::Texture::Type type = PD::Li::Texture::Type::RGBA32,
|
||||
|
||||
@@ -183,22 +183,22 @@ void GfxGL2::BindTex(PD::Li::TexAddress addr) {
|
||||
glUniform1i(pLocAlfa, fmt == GL_ALPHA);
|
||||
}
|
||||
|
||||
void GfxGL2::RenderDrawData(const std::vector<PD::Li::Command::Ref>& Commands) {
|
||||
void GfxGL2::RenderDrawData(const Li::CmdPool& Commands) {
|
||||
size_t index = 0;
|
||||
while (index < Commands.size()) {
|
||||
PD::Li::Texture::Ref Tex = Commands[index]->Tex;
|
||||
while (index < Commands.Size()) {
|
||||
PD::Li::Texture::Ref Tex = Commands.GetCmd(index)->Tex;
|
||||
if (!Tex) {
|
||||
index++;
|
||||
continue;
|
||||
}
|
||||
size_t StartIndex = CurrentIndex;
|
||||
bool ScissorOn = Commands[index]->ScissorOn;
|
||||
ivec4 ScissorRect = Commands[index]->ScissorRect;
|
||||
bool ScissorOn = Commands.GetCmd(index)->ScissorOn;
|
||||
ivec4 ScissorRect = Commands.GetCmd(index)->ScissorRect;
|
||||
|
||||
while (index < Commands.size() && Commands[index]->Tex == Tex &&
|
||||
Commands[index]->ScissorOn == ScissorOn &&
|
||||
Commands[index]->ScissorRect == ScissorRect) {
|
||||
auto c = Commands[index].get();
|
||||
while (index < Commands.Size() && Commands.GetCmd(index)->Tex == Tex &&
|
||||
Commands.GetCmd(index)->ScissorOn == ScissorOn &&
|
||||
Commands.GetCmd(index)->ScissorRect == ScissorRect) {
|
||||
auto c = Commands.GetCmd(index);
|
||||
for (size_t i = 0; i < c->IndexBuffer.size(); i++) {
|
||||
IndexBuffer[CurrentIndex++] = CurrentVertex + c->IndexBuffer.at(i);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user