mirror of
https://github.com/Armored-Dragon/overte.git
synced 2025-03-11 16:13:16 +01:00
Integrating the tag flags to the render item key and adding configration of the render pipelien with the Tag information
This commit is contained in:
parent
04efaa0f92
commit
1fd4c5c1a4
7 changed files with 16 additions and 12 deletions
|
@ -20,7 +20,7 @@ using RenderArgsPointer = std::shared_ptr<RenderArgs>;
|
|||
|
||||
void MainRenderTask::build(JobModel& task, const render::Varying& inputs, render::Varying& outputs, render::CullFunctor cullFunctor, bool isDeferred) {
|
||||
|
||||
task.addJob<RenderShadowTask>("RenderShadowTask", cullFunctor);
|
||||
task.addJob<RenderShadowTask>("RenderShadowTask", cullFunctor, render::ItemKey::TAG_BITS_1, render::ItemKey::TAG_BITS_1);
|
||||
const auto items = task.addJob<RenderFetchCullSortTask>("FetchCullSort", cullFunctor, render::ItemKey::TAG_BITS_1, render::ItemKey::TAG_BITS_1);
|
||||
assert(items.canCast<RenderFetchCullSortTask::Output>());
|
||||
if (!isDeferred) {
|
||||
|
|
|
@ -216,7 +216,7 @@ void RenderShadowTask::build(JobModel& task, const render::Varying& input, rende
|
|||
task.addJob<RenderShadowSetup>("ShadowSetup");
|
||||
|
||||
for (auto i = 0; i < SHADOW_CASCADE_MAX_COUNT; i++) {
|
||||
const auto setupOutput = task.addJob<RenderShadowCascadeSetup>("ShadowCascadeSetup", i);
|
||||
const auto setupOutput = task.addJob<RenderShadowCascadeSetup>("ShadowCascadeSetup", i, tagBits, tagMask);
|
||||
const auto shadowFilter = setupOutput.getN<RenderShadowCascadeSetup::Outputs>(1);
|
||||
|
||||
// CPU jobs:
|
||||
|
@ -259,14 +259,12 @@ void RenderShadowCascadeSetup::run(const render::RenderContextPointer& renderCon
|
|||
// Cache old render args
|
||||
RenderArgs* args = renderContext->args;
|
||||
|
||||
// const auto& filterMask = inputs;
|
||||
|
||||
output.edit0() = args->_renderMode;
|
||||
output.edit2() = args->_sizeScale;
|
||||
|
||||
const auto globalShadow = lightStage->getCurrentKeyShadow();
|
||||
if (globalShadow && _cascadeIndex<globalShadow->getCascadeCount()) {
|
||||
output.edit1() = ItemFilter::Builder::visibleWorldItems().withTypeShape().withOpaque().withoutLayered();
|
||||
output.edit1() = ItemFilter::Builder::visibleWorldItems().withTypeShape().withOpaque().withoutLayered().withTagBits(_tagBits, _tagMask);
|
||||
|
||||
globalShadow->setKeylightCascadeFrustum(_cascadeIndex, args->getViewFrustum(), SHADOW_FRUSTUM_NEAR, SHADOW_FRUSTUM_FAR);
|
||||
|
||||
|
|
|
@ -67,12 +67,14 @@ public:
|
|||
using Outputs = render::VaryingSet3<RenderArgs::RenderMode, render::ItemFilter, float>;
|
||||
using JobModel = render::Job::ModelO<RenderShadowCascadeSetup, Outputs>;
|
||||
|
||||
RenderShadowCascadeSetup(unsigned int cascadeIndex) : _cascadeIndex{ cascadeIndex } {}
|
||||
RenderShadowCascadeSetup(unsigned int cascadeIndex, uint8_t tagBits = 0x00, uint8_t tagMask = 0x00) : _cascadeIndex{ cascadeIndex }, _tagBits(tagBits), _tagMask(tagMask) {}
|
||||
void run(const render::RenderContextPointer& renderContext, Outputs& output);
|
||||
|
||||
private:
|
||||
|
||||
unsigned int _cascadeIndex;
|
||||
uint8_t _tagBits{ 0x00 };
|
||||
uint8_t _tagMask{ 0x00 };
|
||||
};
|
||||
|
||||
class RenderShadowCascadeTeardown {
|
||||
|
|
|
@ -28,7 +28,7 @@ void RenderViewTask::build(JobModel& task, const render::Varying& input, render:
|
|||
const auto threshold = 1e-3f;
|
||||
return relativeBoundRadius > threshold;
|
||||
return true;
|
||||
});
|
||||
}, tagBits, tagMask);
|
||||
|
||||
const auto items = task.addJob<RenderFetchCullSortTask>("FetchCullSort", cullFunctor, tagBits, tagMask);
|
||||
assert(items.canCast<RenderFetchCullSortTask::Output>());
|
||||
|
|
|
@ -61,7 +61,7 @@ void render::cullItems(const RenderContextPointer& renderContext, const CullFunc
|
|||
details._rendered += (int)outItems.size();
|
||||
}
|
||||
|
||||
void FetchNonspatialItems::run(const RenderContextPointer& renderContext, ItemBounds& outItems) {
|
||||
void FetchNonspatialItems::run(const RenderContextPointer& renderContext, const ItemFilter& filter, ItemBounds& outItems) {
|
||||
assert(renderContext->args);
|
||||
assert(renderContext->args->hasViewFrustum());
|
||||
auto& scene = renderContext->_scene;
|
||||
|
@ -72,7 +72,9 @@ void FetchNonspatialItems::run(const RenderContextPointer& renderContext, ItemBo
|
|||
outItems.reserve(items.size());
|
||||
for (auto& id : items) {
|
||||
auto& item = scene->getItem(id);
|
||||
outItems.emplace_back(ItemBound(id, item.getBound()));
|
||||
if (filter.test(item.getKey())) {
|
||||
outItems.emplace_back(ItemBound(id, item.getBound()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -24,8 +24,8 @@ namespace render {
|
|||
|
||||
class FetchNonspatialItems {
|
||||
public:
|
||||
using JobModel = Job::ModelO<FetchNonspatialItems, ItemBounds>;
|
||||
void run(const RenderContextPointer& renderContext, ItemBounds& outItems);
|
||||
using JobModel = Job::ModelIO<FetchNonspatialItems, ItemFilter, ItemBounds>;
|
||||
void run(const RenderContextPointer& renderContext, const ItemFilter& filter, ItemBounds& outItems);
|
||||
};
|
||||
|
||||
class FetchSpatialTreeConfig : public Job::Config {
|
||||
|
|
|
@ -29,7 +29,9 @@ void RenderFetchCullSortTask::build(JobModel& task, const Varying& input, Varyin
|
|||
const auto culledSpatialSelection = task.addJob<CullSpatialSelection>("CullSceneSelection", cullInputs, cullFunctor, RenderDetails::ITEM);
|
||||
|
||||
// Overlays are not culled
|
||||
const auto nonspatialSelection = task.addJob<FetchNonspatialItems>("FetchOverlaySelection");
|
||||
const ItemFilter overlayfilter = ItemFilter::Builder().withVisible().withTagBits(tagBits, tagMask);
|
||||
const auto nonspatialFilter = render::Varying(overlayfilter);
|
||||
const auto nonspatialSelection = task.addJob<FetchNonspatialItems>("FetchOverlaySelection", nonspatialFilter);
|
||||
|
||||
// Multi filter visible items into different buckets
|
||||
const int NUM_SPATIAL_FILTERS = 4;
|
||||
|
|
Loading…
Reference in a new issue