Compiling

This commit is contained in:
Sam Gateau 2018-12-19 20:01:14 -08:00
parent 253a71a20c
commit 80a55e2ae9
5 changed files with 16 additions and 64 deletions

View file

@ -403,7 +403,7 @@ void DebugDeferredBuffer::run(const RenderContextPointer& renderContext, const I
auto& ambientOcclusionFramebuffer = inputs.get3();
auto& velocityFramebuffer = inputs.get4();
auto& frameTransform = inputs.get5();
auto& lightFrame = inputs.get6();
auto& shadowFrame = inputs.get6();
gpu::doInBatch("DebugDeferredBuffer::run", args->_context, [&](gpu::Batch& batch) {
batch.enableStereo(false);
@ -439,16 +439,14 @@ void DebugDeferredBuffer::run(const RenderContextPointer& renderContext, const I
batch.setResourceTexture(Textures::DebugTexture0, velocityFramebuffer->getVelocityTexture());
}
auto lightStage = renderContext->_scene->getStage<LightStage>();
assert(lightStage);
assert(lightStage->getNumLights() > 0);
auto lightAndShadow = lightStage->getCurrentKeyLightAndShadow(*lightFrame);
const auto& globalShadow = lightAndShadow.second;
if (globalShadow) {
batch.setResourceTexture(Textures::Shadow, globalShadow->map);
batch.setUniformBuffer(UBOs::ShadowParams, globalShadow->getBuffer());
batch.setUniformBuffer(UBOs::DeferredFrameTransform, frameTransform->getFrameTransformBuffer());
batch.setUniformBuffer(UBOs::DebugDeferredParams, _parameters);
if (!shadowFrame->_objects.empty()) {
const auto& globalShadow = shadowFrame->_objects[0];
if (globalShadow) {
batch.setResourceTexture(Textures::Shadow, globalShadow->map);
batch.setUniformBuffer(UBOs::ShadowParams, globalShadow->getBuffer());
batch.setUniformBuffer(UBOs::DeferredFrameTransform, frameTransform->getFrameTransformBuffer());
batch.setUniformBuffer(UBOs::DebugDeferredParams, _parameters);
}
}
if (linearDepthTarget) {

View file

@ -46,7 +46,7 @@ public:
AmbientOcclusionFramebufferPointer,
VelocityFramebufferPointer,
DeferredFrameTransformPointer,
LightStage::FramePointer>;
LightStage::ShadowFramePointer>;
using Config = DebugDeferredBufferConfig;
using JobModel = render::Job::ModelI<DebugDeferredBuffer, Inputs, Config>;

View file

@ -350,27 +350,9 @@ LightStage::Index LightStage::addLight(const LightPointer& light, const bool sho
return lightId;
}
LightStage::Index LightStage::addShadow(Index lightIndex, float maxDistance, unsigned int cascadeCount) {
auto light = getLight(lightIndex);
Index shadowId = INVALID_INDEX;
if (light) {
assert(_descs[lightIndex].shadowId == INVALID_INDEX);
shadowId = _shadows.newElement(std::make_shared<Shadow>(light, maxDistance, cascadeCount));
_descs[lightIndex].shadowId = shadowId;
}
return shadowId;
}
LightStage::LightPointer LightStage::removeLight(Index index) {
LightPointer removedLight = _lights.freeElement(index);
if (removedLight) {
auto shadowId = _descs[index].shadowId;
// Remove shadow if one exists for this light
if (shadowId != INVALID_INDEX) {
auto removedShadow = _shadows.freeElement(shadowId);
assert(removedShadow);
assert(removedShadow->getLight() == removedLight);
}
_lightMap.erase(removedLight);
_descs[index] = Desc();
}
@ -394,35 +376,6 @@ LightStage::LightPointer LightStage::getCurrentAmbientLight(const LightStage::Fr
return _lights.get(keyLightId);
}
LightStage::ShadowPointer LightStage::getCurrentKeyShadow(const LightStage::Frame& frame) const {
Index keyLightId { _defaultLightId };
if (!frame._sunLights.empty()) {
keyLightId = frame._sunLights.front();
}
auto shadow = getShadow(keyLightId);
assert(shadow == nullptr || shadow->getLight() == getLight(keyLightId));
return shadow;
}
LightStage::LightAndShadow LightStage::getCurrentKeyLightAndShadow(const LightStage::Frame& frame) const {
Index keyLightId { _defaultLightId };
if (!frame._sunLights.empty()) {
keyLightId = frame._sunLights.front();
}
auto shadow = getShadow(keyLightId);
auto light = getLight(keyLightId);
assert(shadow == nullptr || shadow->getLight() == light);
return LightAndShadow(light, shadow);
}
LightStage::Index LightStage::getShadowId(Index lightId) const {
if (checkLightId(lightId)) {
return _descs[lightId].shadowId;
} else {
return INVALID_INDEX;
}
}
void LightStage::updateLightArrayBuffer(Index lightId) {
auto lightSize = sizeof(graphics::Light::LightSchema);
if (!_lightArrayBuffer) {

View file

@ -218,12 +218,12 @@ void ExtractFrustums::run(const render::RenderContextPointer& renderContext, con
for (auto i = 0; i < SHADOW_CASCADE_FRUSTUM_COUNT; i++) {
auto& shadowFrustum = output[SHADOW_CASCADE0_FRUSTUM+i].edit<ViewFrustumPointer>();
if (lightStage) {
auto globalShadow = lightStage->getCurrentKeyShadow(*lightFrame);
/* auto globalShadow = lightStage->getCurrentKeyShadow(*lightFrame);
if (globalShadow && i<(int)globalShadow->getCascadeCount()) {
auto& cascade = globalShadow->getCascade(i);
shadowFrustum = cascade.getFrustum();
} else {
} else*/ {
shadowFrustum.reset();
}
} else {

View file

@ -298,7 +298,8 @@ void RenderDeferredTaskDebug::build(JobModel& task, const render::Varying& input
// RenderShadowTask out
const auto& shadowOut = inputs.get1();
const auto& renderShadowTaskOut = shadowOut[0];
const auto& renderShadowTaskOut = shadowOut[0];
const auto& shadowFrame = shadowOut[1];
// Extract the Lighting Stages Current frame ( and zones)
const auto lightingStageInputs = inputs.get2();
@ -401,7 +402,7 @@ void RenderDeferredTaskDebug::build(JobModel& task, const render::Varying& input
{
// Debugging Deferred buffer job
const auto debugFramebuffers = DebugDeferredBuffer::Inputs(deferredFramebuffer, linearDepthTarget, surfaceGeometryFramebuffer, ambientOcclusionFramebuffer, velocityBuffer, deferredFrameTransform, lightFrame).asVarying();
const auto debugFramebuffers = DebugDeferredBuffer::Inputs(deferredFramebuffer, linearDepthTarget, surfaceGeometryFramebuffer, ambientOcclusionFramebuffer, velocityBuffer, deferredFrameTransform, shadowFrame).asVarying();
task.addJob<DebugDeferredBuffer>("DebugDeferredBuffer", debugFramebuffers);
const auto debugSubsurfaceScatteringInputs = DebugSubsurfaceScattering::Inputs(deferredFrameTransform, deferredFramebuffer, lightingModel,
@ -446,7 +447,7 @@ void DrawDeferred::run(const RenderContextPointer& renderContext, const Inputs&
const auto& lightFrame = inputs.get2();
const auto& lightingModel = inputs.get3();
const auto& lightClusters = inputs.get4();
// Not used yet but will be: const auto& shadowFrame = inputs.get5();
const auto& shadowFrame = inputs.get5();
const auto jitter = inputs.get6();
auto deferredLightingEffect = DependencyManager::get<DeferredLightingEffect>();