floooh/oryol

Dequeue error when adding lots of DrawStates

danhambleton opened this issue · 1 comments

I'm writing an app the has to render a lot of meshes. In the default Gfx config I can create up to 128 objects in the scene like this:

        DrawState ds;
        ds.Mesh[0] = Oryol::Gfx::CreateResource(*meshDisplayData.meshSetup.get());
        ds.Pipeline = sceneTransient->phongPipeline;

This creates a new DrawState for each object. However, after 128 of these I get an error in Queue.h:

template<class TYPE> TYPE
Queue<TYPE>::Dequeue() {
    o_assert_dbg(this->buffer.size() > 0);
    return std::move(this->buffer.popFront());
}

I can fix this by adjusting the DefaultResourcePoolSize in GfxConfig.h. Is there another way?

You can pass pool sizes for all resource types in the Gfx::Setup() call, for instance see the BlendTest sample, which increases the pool size for Pipeline objects to 512:

auto gfxSetup = GfxSetup::Window(1024, 768, "Oryol Blend Sample");
gfxSetup.ResourcePoolSize[GfxResourceType::Pipeline] = 512;
Gfx::Setup(gfxSetup);