minor cleanup: remove unneeded complexity
This commit is contained in:
committed by
Mathias Agopian
parent
4de71f7239
commit
d5178f862a
@@ -132,8 +132,6 @@ FEngine::FEngine(Backend backend, Platform* platform, void* sharedGLContext) :
|
||||
mTransformManager(),
|
||||
mLightManager(*this),
|
||||
mCameraManager(*this),
|
||||
mPerViewUib(PerViewUib::getUib()),
|
||||
mPostProcessUib(PostProcessingUib::getUib()),
|
||||
mCommandBufferQueue(CONFIG_MIN_COMMAND_BUFFERS_SIZE, CONFIG_COMMAND_BUFFERS_SIZE),
|
||||
mPerRenderPassAllocator("per-renderpass allocator", CONFIG_PER_RENDER_PASS_ARENA_SIZE),
|
||||
mEngineEpoch(std::chrono::steady_clock::now()),
|
||||
|
||||
@@ -35,13 +35,12 @@ using namespace filament::details;
|
||||
|
||||
void PostProcessManager::init(FEngine& engine) noexcept {
|
||||
mEngine = &engine;
|
||||
|
||||
mPostProcessUb = UniformBuffer(engine.getPerPostProcessUib().getSize());
|
||||
mPostProcessUb = UniformBuffer(PostProcessingUib::getUib().getSize());
|
||||
|
||||
// create sampler for post-process FBO
|
||||
DriverApi& driver = engine.getDriverApi();
|
||||
mPostProcessSbh = driver.createSamplerGroup(PostProcessSib::SAMPLER_COUNT);
|
||||
mPostProcessUbh = driver.createUniformBuffer(engine.getPerPostProcessUib().getSize(),
|
||||
mPostProcessUbh = driver.createUniformBuffer(mPostProcessUb.getSize(),
|
||||
driver::BufferUsage::DYNAMIC);
|
||||
driver.bindSamplers(BindingPoints::POST_PROCESS, mPostProcessSbh);
|
||||
driver.bindUniformBuffer(BindingPoints::POST_PROCESS, mPostProcessUbh);
|
||||
|
||||
@@ -59,7 +59,7 @@ static constexpr uint8_t VISIBLE_ALL = VISIBLE_RENDERABLE | VISIBLE_SHADOW_CASTE
|
||||
|
||||
FView::FView(FEngine& engine)
|
||||
: mFroxelizer(engine),
|
||||
mPerViewUb(engine.getPerViewUib().getSize()),
|
||||
mPerViewUb(PerViewUib::getUib().getSize()),
|
||||
mPerViewSb(PerViewSib::SAMPLER_COUNT),
|
||||
mDirectionalShadowMap(engine) {
|
||||
DriverApi& driver = engine.getDriverApi();
|
||||
@@ -285,8 +285,6 @@ void FView::prepareShadowing(FEngine& engine, driver::DriverApi& driver,
|
||||
// TODO: for now we only consider THE directional light
|
||||
|
||||
auto& lcm = engine.getLightManager();
|
||||
UniformBuffer& u = getUb();
|
||||
FScene* const scene = mScene;
|
||||
|
||||
// dominant directional light is always as index 0
|
||||
FLightManager::Instance directionalLight = lightData.elementAt<FScene::LIGHT_INSTANCE>(0);
|
||||
@@ -294,14 +292,15 @@ void FView::prepareShadowing(FEngine& engine, driver::DriverApi& driver,
|
||||
if (UTILS_UNLIKELY(mHasShadowing)) {
|
||||
// compute the frustum for this light
|
||||
ShadowMap& shadowMap = mDirectionalShadowMap;
|
||||
shadowMap.update(lightData, 0, scene, mViewingCameraInfo, mVisibleLayers);
|
||||
shadowMap.update(lightData, 0, mScene, mViewingCameraInfo, mVisibleLayers);
|
||||
if (shadowMap.hasVisibleShadows()) {
|
||||
// Cull shadow casters
|
||||
UniformBuffer& u = mPerViewUb;
|
||||
Frustum const& frustum = shadowMap.getCamera().getFrustum();
|
||||
FView::prepareVisibleShadowCasters(engine.getJobSystem(), frustum, renderableData);
|
||||
|
||||
// allocates shadowmap driver resources
|
||||
shadowMap.prepare(driver, getUs());
|
||||
shadowMap.prepare(driver, mPerViewSb);
|
||||
|
||||
mat4f const& lightFromWorldMatrix = shadowMap.getLightSpaceMatrix();
|
||||
u.setUniform(offsetof(PerViewUib, lightFromWorldMatrix), lightFromWorldMatrix);
|
||||
@@ -322,7 +321,7 @@ void FView::prepareLighting(FEngine& engine, FEngine::DriverApi& driver, ArenaSc
|
||||
filament::Viewport const& viewport) noexcept {
|
||||
SYSTRACE_CALL();
|
||||
|
||||
UniformBuffer& u = getUb();
|
||||
UniformBuffer& u = mPerViewUb;
|
||||
const CameraInfo& camera = mViewingCameraInfo;
|
||||
FScene* const scene = mScene;
|
||||
|
||||
@@ -562,8 +561,8 @@ void FView::prepare(FEngine& engine, driver::DriverApi& driver, ArenaScope& aren
|
||||
*/
|
||||
|
||||
float fraction = (engine.getEngineTime().count() % 1000000000) / 1000000000.0f;
|
||||
getUb().setUniform(offsetof(PerViewUib, time), fraction);
|
||||
getUb().setUniform(offsetof(PerViewUib, userTime), userTime);
|
||||
mPerViewUb.setUniform(offsetof(PerViewUib, time), fraction);
|
||||
mPerViewUb.setUniform(offsetof(PerViewUib, userTime), userTime);
|
||||
|
||||
// upload the renderables's dirty UBOs
|
||||
engine.getRenderableManager().prepare(driver,
|
||||
@@ -615,7 +614,7 @@ void FView::prepareCamera(const CameraInfo& camera, const filament::Viewport& vi
|
||||
const mat4f clipFromWorld(clipFromView * viewFromWorld);
|
||||
const mat4f worldFromClip(worldFromView * viewFromClip);
|
||||
|
||||
UniformBuffer& u = getUb();
|
||||
UniformBuffer& u = mPerViewUb;
|
||||
u.setUniform(offsetof(PerViewUib, viewFromWorldMatrix), viewFromWorld); // view
|
||||
u.setUniform(offsetof(PerViewUib, worldFromViewMatrix), worldFromView); // model
|
||||
u.setUniform(offsetof(PerViewUib, clipFromViewMatrix), clipFromView); // projection
|
||||
|
||||
@@ -53,9 +53,6 @@
|
||||
#include <utils/JobSystem.h>
|
||||
#include <utils/CountDownLatch.h>
|
||||
|
||||
#include <math/mat4.h>
|
||||
#include <math/quat.h>
|
||||
|
||||
#include <chrono>
|
||||
#include <memory>
|
||||
#include <unordered_map>
|
||||
@@ -119,11 +116,6 @@ public:
|
||||
DriverApi& getDriverApi() noexcept { return mCommandStream; }
|
||||
DFG* getDFG() const noexcept { return mDFG.get(); }
|
||||
|
||||
|
||||
// Uniforms...
|
||||
const UniformInterfaceBlock& getPerViewUib() const noexcept { return mPerViewUib; }
|
||||
const UniformInterfaceBlock& getPerPostProcessUib() const noexcept { return mPostProcessUib; }
|
||||
|
||||
// the per-frame Area is used by all Renderer, so they must run in sequence and
|
||||
// have freed all allocated memory when done. If this needs to change in the future,
|
||||
// we'll simply have to use separate Areas (for instance).
|
||||
@@ -317,12 +309,6 @@ private:
|
||||
|
||||
std::unique_ptr<DFG> mDFG;
|
||||
|
||||
// Per-view Uniform interface block
|
||||
UniformInterfaceBlock mPerViewUib;
|
||||
|
||||
// post-process interface blocks
|
||||
UniformInterfaceBlock mPostProcessUib;
|
||||
|
||||
std::thread mDriverThread;
|
||||
CommandBufferQueue mCommandBufferQueue;
|
||||
DriverApi mCommandStream;
|
||||
|
||||
@@ -297,9 +297,6 @@ private:
|
||||
mutable UniformBuffer mPerViewUb;
|
||||
mutable SamplerGroup mPerViewSb;
|
||||
|
||||
SamplerGroup& getUs() const noexcept { return mPerViewSb; }
|
||||
UniformBuffer& getUb() const noexcept { return mPerViewUb; }
|
||||
|
||||
utils::CString mName;
|
||||
|
||||
// the following values are set by prepare()
|
||||
|
||||
Reference in New Issue
Block a user