Showing the changes to libraries/render-utils/src/RenderDeferredTask.cpp (1 of 436 files). Show all
Unified · Split
| @@ -12,12 +12,15 @@ · 11 unmodified lines | |||
| 12 | 12 | ||
| 13 | #include "RenderDeferredTask.h" | 13 | #include "RenderDeferredTask.h" |
| 14 | 14 | ||
| 15 | #include <QtCore/qglobal.h> | ||
| 16 | |||
| 15 | #include <DependencyManager.h> | 17 | #include <DependencyManager.h> |
| 16 | 18 | ||
| 17 | #include <PerfStat.h> | 19 | #include <PerfStat.h> |
| 18 | #include <PathUtils.h> | 20 | #include <PathUtils.h> |
| 19 | #include <ViewFrustum.h> | 21 | #include <ViewFrustum.h> |
| 20 | #include <gpu/Context.h> | 22 | #include <gpu/Context.h> |
| 23 | #include <graphics/ShaderConstants.h> | ||
| 21 | 24 | ||
| 22 | #include <render/CullTask.h> | 25 | #include <render/CullTask.h> |
| 23 | #include <render/FilterTask.h> | 26 | #include <render/FilterTask.h> |
| @@ -29,6 +32,7 @@ · 5 unmodified lines | |||
| 29 | #include <render/ResampleTask.h> | 32 | #include <render/ResampleTask.h> |
| 30 | 33 | ||
| 31 | #include "RenderHifi.h" | 34 | #include "RenderHifi.h" |
| 35 | #include "render-utils/ShaderConstants.h" | ||
| 32 | #include "RenderCommonTask.h" | 36 | #include "RenderCommonTask.h" |
| 33 | #include "LightingModel.h" | 37 | #include "LightingModel.h" |
| 34 | #include "StencilMaskPass.h" | 38 | #include "StencilMaskPass.h" |
| @@ -56,6 +60,17 @@ · 21 unmodified lines | |||
| 56 | using namespace render; | 60 | using namespace render; |
| 57 | extern void initDeferredPipelines(render::ShapePlumber& plumber, const render::ShapePipeline::BatchSetter& batchSetter, const render::ShapePipeline::ItemSetter& itemSetter); | 61 | extern void initDeferredPipelines(render::ShapePlumber& plumber, const render::ShapePipeline::BatchSetter& batchSetter, const render::ShapePipeline::ItemSetter& itemSetter); |
| 58 | 62 | ||
| 63 | namespace ru { | ||
| 64 | using render_utils::slot::texture::Texture; | ||
| 65 | using render_utils::slot::buffer::Buffer; | ||
| 66 | } | ||
| 67 | |||
| 68 | namespace gr { | ||
| 69 | using graphics::slot::texture::Texture; | ||
| 70 | using graphics::slot::buffer::Buffer; | ||
| 71 | } | ||
| 72 | |||
| 73 | |||
| 59 | RenderDeferredTask::RenderDeferredTask() | 74 | RenderDeferredTask::RenderDeferredTask() |
| 60 | { | 75 | { |
| 61 | } | 76 | } |
| @@ -358,27 +373,18 @@ void DrawDeferred::run(const RenderContextPointer& renderContext, const Inputs& · 296 unmodified lines | |||
| 358 | batch.setViewTransform(viewMat); | 373 | batch.setViewTransform(viewMat); |
| 359 | 374 | ||
| 360 | // Setup lighting model for all items; | 375 | // Setup lighting model for all items; |
| 361 | batch.setUniformBuffer(render::ShapePipeline::Slot::LIGHTING_MODEL, lightingModel->getParametersBuffer()); | 376 | batch.setUniformBuffer(ru::Buffer::LightModel, lightingModel->getParametersBuffer()); |
| 362 | 377 | ||
| 363 | // Set the light | 378 | // Set the light |
| 364 | deferredLightingEffect->setupKeyLightBatch(args, batch, | 379 | deferredLightingEffect->setupKeyLightBatch(args, batch); |
| 365 | render::ShapePipeline::Slot::KEY_LIGHT, | 380 | deferredLightingEffect->setupLocalLightsBatch(batch, lightClusters); |
| 366 | render::ShapePipeline::Slot::LIGHT_AMBIENT_BUFFER, | ||
| 367 | render::ShapePipeline::Slot::LIGHT_AMBIENT_MAP); | ||
| 368 | |||
| 369 | deferredLightingEffect->setupLocalLightsBatch(batch, | ||
| 370 | render::ShapePipeline::Slot::LIGHT_ARRAY_BUFFER, | ||
| 371 | render::ShapePipeline::Slot::LIGHT_CLUSTER_GRID_CLUSTER_GRID_SLOT, | ||
| 372 | render::ShapePipeline::Slot::LIGHT_CLUSTER_GRID_CLUSTER_CONTENT_SLOT, | ||
| 373 | render::ShapePipeline::Slot::LIGHT_CLUSTER_GRID_FRUSTUM_GRID_SLOT, | ||
| 374 | lightClusters); | ||
| 375 | 381 | ||
| 376 | // Setup haze if current zone has haze | 382 | // Setup haze if current zone has haze |
| 377 | auto hazeStage = args->_scene->getStage<HazeStage>(); | 383 | auto hazeStage = args->_scene->getStage<HazeStage>(); |
| 378 | if (hazeStage && hazeStage->_currentFrame._hazes.size() > 0) { | 384 | if (hazeStage && hazeStage->_currentFrame._hazes.size() > 0) { |
| 379 | graphics::HazePointer hazePointer = hazeStage->getHaze(hazeStage->_currentFrame._hazes.front()); | 385 | graphics::HazePointer hazePointer = hazeStage->getHaze(hazeStage->_currentFrame._hazes.front()); |
| 380 | if (hazePointer) { | 386 | if (hazePointer) { |
| 381 | batch.setUniformBuffer(render::ShapePipeline::Slot::HAZE_MODEL, hazePointer->getHazeParametersBuffer()); | 387 | batch.setUniformBuffer(ru::Buffer::HazeParams, hazePointer->getHazeParametersBuffer()); |
| 382 | } | 388 | } |
| 383 | } | 389 | } |
| 384 | 390 | ||
| @@ -396,16 +402,8 @@ void DrawDeferred::run(const RenderContextPointer& renderContext, const Inputs& · 11 unmodified lines | |||
| 396 | args->_batch = nullptr; | 402 | args->_batch = nullptr; |
| 397 | args->_globalShapeKey = 0; | 403 | args->_globalShapeKey = 0; |
| 398 | 404 | ||
| 399 | deferredLightingEffect->unsetLocalLightsBatch(batch, | 405 | deferredLightingEffect->unsetLocalLightsBatch(batch); |
| 400 | render::ShapePipeline::Slot::LIGHT_ARRAY_BUFFER, | 406 | deferredLightingEffect->unsetKeyLightBatch(batch); |
| 401 | render::ShapePipeline::Slot::LIGHT_CLUSTER_GRID_CLUSTER_GRID_SLOT, | ||
| 402 | render::ShapePipeline::Slot::LIGHT_CLUSTER_GRID_CLUSTER_CONTENT_SLOT, | ||
| 403 | render::ShapePipeline::Slot::LIGHT_CLUSTER_GRID_FRUSTUM_GRID_SLOT); | ||
| 404 | |||
| 405 | deferredLightingEffect->unsetKeyLightBatch(batch, | ||
| 406 | render::ShapePipeline::Slot::KEY_LIGHT, | ||
| 407 | render::ShapePipeline::Slot::LIGHT_AMBIENT_BUFFER, | ||
| 408 | render::ShapePipeline::Slot::LIGHT_AMBIENT_MAP); | ||
| 409 | }); | 407 | }); |
| 410 | 408 | ||
| 411 | config->setNumDrawn((int)inItems.size()); | 409 | config->setNumDrawn((int)inItems.size()); |
| @@ -440,7 +438,7 @@ void DrawStateSortDeferred::run(const RenderContextPointer& renderContext, const · 28 unmodified lines | |||
| 440 | batch.setViewTransform(viewMat); | 438 | batch.setViewTransform(viewMat); |
| 441 | 439 | ||
| 442 | // Setup lighting model for all items; | 440 | // Setup lighting model for all items; |
| 443 | batch.setUniformBuffer(render::ShapePipeline::Slot::LIGHTING_MODEL, lightingModel->getParametersBuffer()); | 441 | batch.setUniformBuffer(ru::Buffer::LightModel, lightingModel->getParametersBuffer()); |
| 444 | 442 | ||
| 445 | // From the lighting model define a global shapeKey ORED with individiual keys | 443 | // From the lighting model define a global shapeKey ORED with individiual keys |
| 446 | ShapeKey::Builder keyBuilder; | 444 | ShapeKey::Builder keyBuilder; |