diff --git a/filament/src/RenderPass.cpp b/filament/src/RenderPass.cpp index 72614612ee..113e53e855 100644 --- a/filament/src/RenderPass.cpp +++ b/filament/src/RenderPass.cpp @@ -901,6 +901,10 @@ void RenderPass::Executor::execute(FEngine const& engine, DriverApi& driver, size_t const capacity = engine.getMinCommandBufferSize(); CircularBuffer const& circularBuffer = driver.getCircularBuffer(); + utils::slog.e <<"circularBuffer: " << circularBuffer.size() << " used: " << + circularBuffer.getUsed() << + " commandCount: " << last - first << utils::io::endl; + // b/479079631: Log the number of commands in this render pass. size_t const commandCount = last - first; if (Platform* platform = engine.getPlatform(); platform->hasDebugUpdateStatFunc()) { diff --git a/filament/src/details/Engine.cpp b/filament/src/details/Engine.cpp index 4010eb30db..fdeca7ee33 100644 --- a/filament/src/details/Engine.cpp +++ b/filament/src/details/Engine.cpp @@ -264,8 +264,9 @@ FEngine::FEngine(Builder const& builder) : mLightManager(*this), mCameraManager(*this), mCommandBufferQueue( + builder->mConfig.minCommandBufferSizeMB * MiB, builder->mConfig.minCommandBufferSizeMB * MiB, - builder->mConfig.commandBufferSizeMB * MiB, +// builder->mConfig.commandBufferSizeMB * MiB, builder->mPaused), mPerRenderPassArena( "FEngine::mPerRenderPassAllocator", @@ -277,6 +278,7 @@ FEngine::FEngine(Builder const& builder) : mMainThreadId(ThreadUtils::getThreadId()), mConfig(builder->mConfig) { + // update all the features flags specified in the builder for (auto const& [feature, value] : builder->mFeatureFlags) { auto* const p = getFeatureFlagPtr(feature.c_str_safe(), true); @@ -348,7 +350,6 @@ void FEngine::init() { LOG(INFO) << "Backend feature level: " << int(driverApi.getFeatureLevel()); LOG(INFO) << "FEngine feature level: " << int(mActiveFeatureLevel); - mResourceAllocatorDisposer = std::make_shared(driverApi); mFullScreenTriangleVb = downcast(VertexBuffer::Builder() @@ -744,12 +745,13 @@ void FEngine::prepare(DriverApi& driver) { if (item->getMaterial()->getMaterialDomain() == MaterialDomain::SURFACE) { // If the remaining space is less than half the capacity, we flush right // away to allow some headroom for commands that might come later. - if (UTILS_UNLIKELY(driver.getCircularBuffer().getUsed() > capacity / 2)) { + if (UTILS_UNLIKELY(driver.getCircularBuffer().getUsed() > capacity / 2) && false) { flush(); } item->commit(driver, uboManager); } }); + } if (useUboBatching) { diff --git a/samples/hellopbr.cpp b/samples/hellopbr.cpp index c5b0af2d4b..5b1dc7f8cf 100644 --- a/samples/hellopbr.cpp +++ b/samples/hellopbr.cpp @@ -36,13 +36,20 @@ #include #include // for printing usage/help +#include "filament/MaterialInstance.h" #include "generated/resources/resources.h" #include "generated/resources/monkey.h" +#include + using namespace filament; using namespace filamesh; using namespace filament::math; +namespace { +std::vector instances; +} + using Backend = Engine::Backend; struct App { @@ -152,6 +159,19 @@ int main(int argc, char** argv) { auto& tcm = engine->getTransformManager(); auto ti = tcm.getInstance(app.mesh.renderable); tcm.setTransform(ti, app.transform * mat4f::rotation(now, float3{ 0, 1, 0 })); + + static int count = 0; + constexpr int allSize = 12000; + if (count++ == 5) { + for (size_t i = 0; i < allSize; ++i) { + auto mi = app.materialInstance = app.material->createInstance(); + mi->setParameter("baseColor", RgbType::LINEAR, float3{0.8}); + mi->setParameter("metallic", 1.0f); + mi->setParameter("roughness", 0.4f); + mi->setParameter("reflectance", 0.5f); + instances.push_back(mi); + } + } }); FilamentApp::get().run(app.config, setup, cleanup);