|
Estella 0.113.0
A fast 2D and 3D game engine powered by WebAssembly and ECS
|
Post-processing effects pipeline. More...
#include <PostProcessPipeline.hpp>
Classes | |
| struct | TemporalView |
| What a temporal view would be given by its NEXT begin: the sub-pixel shift and last frame's camera. More... | |
Public Member Functions | |
| PostProcessPipeline (GfxDevice &device, RenderContext &context, resource::ResourceManager &resourceManager, rg::RenderGraph &graph) | |
| Builds a pipeline that declares its chains onto the FRAME's graph. | |
| PostProcessPipeline (GfxDevice &device, RenderContext &context, resource::ResourceManager &resourceManager) | |
| Builds one with no frame behind it; it gets a graph of its own. | |
| ~PostProcessPipeline () | |
| PostProcessPipeline (const PostProcessPipeline &)=delete | |
| PostProcessPipeline & | operator= (const PostProcessPipeline &)=delete |
| void | init (u32 width, u32 height) |
| Initializes the pipeline with given dimensions. | |
| void | shutdown () |
| Shuts down and releases resources. | |
| void | resize (u32 width, u32 height) |
| Resizes the framebuffers. | |
| u32 | addPass (const std::string &name, resource::ShaderHandle shader) |
| Adds a post-processing pass. | |
| u32 | addComputePass (const std::string &name, const std::string &wgsl, const std::vector< std::string > ¶ms, u32 workgroupX, u32 workgroupY) |
| Adds a pass that is a compute shader over the picture instead of a draw. | |
| u32 | addNativePass (const std::string &name, const std::string &kind) |
| Adds a pass the engine implements itself: "voxelGI" (see VoxelGI). Its parameters are set like any pass's, by name. | |
| bool | supportsCompute () const |
| Whether passes added with addComputePass run on this device. | |
| void | setRequestedSamples (u32 samples) |
| The project's multisampling request; 1 = off. Clamped by the device. | |
| u32 | sceneSamples () const |
| u32 | requestedSamples () const |
| What was asked for, before the ceiling. | |
| void | setPassScale (const std::string &passName, f32 scale) |
Draw passName at scale of the chain size (clamped to (0, 1]). | |
| void | setPassContinuesEffect (const std::string &passName) |
Mark passName as a later pass of the effect the pass before it began. | |
| void | setPassUniformFloat (const std::string &passName, const std::string &uniform, f32 value) |
| Sets a float uniform for a pass. | |
| void | setPassTexture (const std::string &passName, const std::string &uniform, u32 glTextureId) |
| Binds a texture to a pass's sampler uniform (unit 2 upward, in registration order). Replaces an existing binding of the same name. | |
| void | setPassUniformVec4 (const std::string &passName, const std::string &uniform, const glm::vec4 &value) |
| Sets a vec4 uniform for a pass. | |
| u32 | getPassCount () const |
| Gets the pass count. | |
| const PostProcessPass * | getPass (u32 index) const |
| Gets a pass by index. | |
| const PostProcessPass * | getPass (const std::string &name) const |
| Gets a pass by name. | |
| void | begin (const f32 *clearColor=nullptr) |
| Begins rendering to the pipeline. | |
| rg::ResourceId | sceneResource () const |
| void | setSelectionMask (rg::ResourceId mask) |
| The editor's selection mask for this chain (RenderFrame::declareSelectionMask): outlined after the last pass. | |
| void | drawSelectionOutline (TextureHandle mask) |
| The selection's outline over what the bound target holds, from its mask. Blended over; the caller sets the viewport. | |
| void | drawSelectionGround (TextureHandle depth) |
| The selection mask's ground, into the bound mask target: the scene's depth in g, nothing covered. | |
| void | declareChain () |
| void | chainDone () |
| bool | temporalActive () |
| Whether this frame's chain holds a temporal effect. | |
| bool | cameraMotionWanted () |
| Whether an enabled pass that keeps no history reads the previous camera (u_prevViewProjection0). | |
| rg::TargetDesc | grabTarget () const |
| The shape of the copy of the opaque scene a refractive surface reads: the chain's own, bilinear. | |
| void | grabScene (bool marked=true) |
| bool | canGrabDepth () |
| rg::TargetDesc | grabDepthTarget () |
| The shape of the copy of the opaque scene's depth: how far each pixel is from the eye, in the red channel of a float target. | |
| void | grabDepth () |
| Draws, into the target being drawn, the distance to the opaque scene at every pixel (the scene's depth, read at its unit). | |
| bool | sceneCoverageWanted () |
| Whether the scene is to be cleared to nothing (all four channels zero) so that its alpha says how much of each pixel geometry covers. | |
| void | trackView (const glm::mat4 &viewProjection, u64 key) |
Records this frame's camera as the view key's current one, and last frame's as its previous. No shift. | |
| bool | velocityWanted () |
| Whether an enabled pass reads how far each moving surface travelled (u_velocity). | |
| TemporalView | peekTemporalView (const glm::mat4 &viewProjection, u64 key) const |
| rg::ResourceId | declareVelocity () |
| The motion pass's target for this frame, declared in the graph (kNoResource when it cannot be made). | |
| bool | coverWanted () |
| Whether an enabled pass reads what stands over each place (u_rainCover). | |
| f32 | coverRange () |
| How far from the camera, in world units, that map reaches each way (the effect's u_shelterRange). | |
| f32 | coverBias () |
| The bias the drawing effect reads the map with (its u_shelterBias), for a pass that only borrows the map. | |
| rg::ResourceId | declareCover (u32 size) |
| The map's target for this frame, declared in the graph (kNoResource when it cannot be made). | |
| void | setCoverMatrix (const glm::mat4 &viewProjection) |
| The matrix the map was drawn through, for the effect to put a world point in it. | |
| u32 | coverTargetId () const |
| bool | sceneHasGBuffer () const |
| Whether this frame's scene target carries a second attachment for the surface's material. | |
| void | setEnvironmentTexture (u32 glTextureId) |
| The frame's environment atlas, for an effect that reflects it (u_environment). | |
| void | setShadowAtlas (u32 glTextureId, rg::ResourceId resource) |
| The frame's shadow atlas, for an effect that asks whether a point of air is in the sun (#pragma lights). | |
| glm::vec2 | beginTemporalView (const glm::mat4 &viewProjection, u64 key) |
Starts a frame of the temporal view key, and answers how far to shift it. | |
| bool | isInitialized () const |
| Checks if pipeline is initialized. | |
| bool | isEngaged () const |
| Whether the scene goes through the graph or straight to the surface. | |
| bool | presentScales () const |
| Whether the chain's own size differs from the rect it lands in. | |
| void | setComputeNeedsDepth (bool needs) |
| The caller has decided this frame needs a present. | |
| void | setPresentRequired (bool required) |
| void | setSelectionWanted (bool wanted) |
| An editor selection is outlined this frame: a screen effect, so the scene is drawn where its depth can be read. | |
| void | setPresentOver (bool over) |
| This camera keeps the colour under it: its present composites over the target by coverage. | |
| void | setBackgroundSky (bool drawn) |
| bool | presentUpscales () const |
| Whether the present is a whole-multiple upscale of the chain. | |
| bool | presentIsWholeMultiple () const |
| void | setBypass (bool bypass) |
| Skip the EFFECTS, not the chain. | |
| void | setLinearOutput (bool linear) |
| Linear-light mode: sRGB-format intermediates (hardware linear blending) and an always-engaged capture+blit whose final pass carries the linear->sRGB encode. Overrides bypass. | |
| const HdrFormatDecision & | hdrFormat () const |
| What this frame's intermediates were asked to be and allowed to be. | |
| void | setSceneNeedsDepth (bool needs) |
| Whether the scene target needs a depth attachment. | |
| bool | linearOutput () const |
| void | setOutputTransform (OutputTransform transform) |
| The curve the final pass applies to scene values. | |
| void | setDisplayLut (u32 glTexture, f32 amount) |
| A graded look the final pass applies to the picture as the display will show it. | |
| bool | displayLutActive () const |
| void | setViewExposure (f32 ev) |
| OutputTransform | outputTransform () const |
| void | clearPasses () |
| Checks if bypass mode is enabled. | |
| void | setOutputTarget (FramebufferHandle target) |
| Sets the output target for the final blit (Default = screen). | |
| void | setOutputViewport (u32 x, u32 y, u32 w, u32 h) |
| Sets the output viewport for the final blit. | |
| void | beginScreenCapture () |
| Begins screen-level capture (all camera output goes into screen FBO). | |
| void | endScreenCapture () |
| Ends screen-level capture. | |
| void | executeScreenPasses () |
| Executes screen-level post-process passes on captured output. | |
| u32 | addScreenPass (const std::string &name, resource::ShaderHandle shader) |
| Adds a screen-level post-process pass. | |
| void | clearScreenPasses () |
| Clears all screen-level passes. | |
| void | setScreenPassUniformFloat (const std::string &passName, const std::string &uniform, f32 value) |
| Sets a float uniform for a screen-level pass. | |
| void | setScreenPassUniformVec4 (const std::string &passName, const std::string &uniform, const glm::vec4 &value) |
| Sets a vec4 uniform for a screen-level pass. | |
| u32 | getScreenPassCount () const |
| Gets the screen pass count. | |
| bool | isScreenCaptureActive () const |
| Checks if screen capture is active. | |
| FramebufferHandle | currentSceneFBO () const |
| The surface the scene is currently rendering into: the screen-capture FBO when the screen stack is live, the per-camera capture when in-frame, else the default target. The main-pass load-op clear must land HERE — rebinding the default target mid-capture breaks the stack. | |
| void | requestSkyCapture (const std::string &passName, u32 width, u32 height) |
Draws pass passName once more, next frame, into a width x height RGBA8 target with its float param u_skyCapture at 1, and reads it back: a sky effect's panorama (see the SDK's defineSkyEffect). | |
| void | encodeRgbm () |
| Draws the texture on unit 0 into the bound target as RGBM over 8 (alpha 0 kept for nothing drawn): a probe capture's face, packed for an 8-bit readback. Called inside a graph pass that reads that texture. | |
| i32 | pollSkyCapture () |
| 0 = not yet, 1 = the pixels are ready (skyCapturePixels), 2 = none was asked for or it failed. Issues the readback itself once the capture has been drawn, so call it between frames, never inside one. | |
| const std::vector< u8 > & | skyCapturePixels () const |
| The captured pixels, RGBA8, rows bottom-up as every readback lands. Valid after poll answered 1. | |
| const PostProcessPass * | cloudShadowCaster (f32 &extentKm, f32 &unitsPerKm) const |
| The sky that casts the sun's cloud shadow this frame, how far its map reaches each way in kilometres, and how many world units its kilometre is (its own u_unitsPerKm where it says, as Sky Atmosphere does; 0 where it leaves it to the project). | |
| void | drawCloudShadow (const glm::mat4 &inverse, const glm::vec4 &rect, const rg::PassContext &ctx) |
Draws the caster's cloud shadow into the tile at rect of the bound target: what of the sun is left in the alpha, white above. | |
| glm::vec4 | bakeSun () const |
| bool | drawProjectedMaterial (u32 material, u32 instances, u32 scratch, const glm::vec4 &sun, const glm::vec4 &receiverWindow, TextureHandle receiverDepth, TextureHandle movingDepth) |
| bool | drawMaterialThrough (u32 material, u32 shader, const std::vector< std::pair< std::string, glm::vec4 > > &overrides, u32 scratch) |
| bool | canDrawMaterialOver (u32 material) |
| bool | drawMaterialOver (u32 material) |
Post-processing effects pipeline.
Owns the scene capture and the effect chains; the chains themselves are declared to a RenderGraph, which decides what physical targets they cost. The per-camera and screen-level chains are the same shape and go through the same builder.
Definition at line 125 of file PostProcessPipeline.hpp.
| esengine::PostProcessPipeline::PostProcessPipeline | ( | GfxDevice & | device, |
| RenderContext & | context, | ||
| resource::ResourceManager & | resourceManager, | ||
| rg::RenderGraph & | graph ) |
Builds a pipeline that declares its chains onto the FRAME's graph.
A chain is not a graph of its own: the frame declares the scene and the effects that read it to one graph and executes it once, so every pass a frame runs is stated in one place.
Definition at line 36 of file PostProcessPipeline.cpp.
Referenced by PostProcessPipeline(), and operator=().
| esengine::PostProcessPipeline::PostProcessPipeline | ( | GfxDevice & | device, |
| RenderContext & | context, | ||
| resource::ResourceManager & | resourceManager ) |
Builds one with no frame behind it; it gets a graph of its own.
The fallback path in the bindings, for a pipeline that exists without a RenderFrame having made one.
Definition at line 47 of file PostProcessPipeline.cpp.
| esengine::PostProcessPipeline::~PostProcessPipeline | ( | ) |
Definition at line 55 of file PostProcessPipeline.cpp.
References shutdown().
|
delete |
References PostProcessPipeline().
| u32 esengine::PostProcessPipeline::addComputePass | ( | const std::string & | name, |
| const std::string & | wgsl, | ||
| const std::vector< std::string > & | params, | ||
| u32 | workgroupX, | ||
| u32 | workgroupY ) |
Adds a pass that is a compute shader over the picture instead of a draw.
The WGSL is handed these, at group 0: @binding(0) the image so far (texture_2d<f32>), @binding(1) the image it writes (texture_storage_2d<rgba16float, write>, the same size), @binding(2) a uniform block of params as f32s in that order, @binding(3) the size as vec4f(w, h, 1/w, 1/h), @binding(4) the scene's depth (texture_depth_2d), @binding(5) a linear clamp sampler. A shader declares the ones it uses. It is dispatched over the whole image in groups of workgroupX x workgroupY, which it declares. Compute needs a device that supportsCompute(): on one that does not the pass is left out of the chain, and the picture goes through as it was.
Definition at line 346 of file PostProcessPipeline.cpp.
References esengine::PostProcessPass::compute, esengine::PostProcessPass::computeParams, esengine::PostProcessPass::enabled, ES_LOG_ERROR, esengine::Invalid, esengine::PostProcessPass::isCompute, esengine::PostProcessPass::name, esengine::PostProcessPass::usesComputeDepth, esengine::WGSL, esengine::PostProcessPass::workgroupX, and esengine::PostProcessPass::workgroupY.
| u32 esengine::PostProcessPipeline::addNativePass | ( | const std::string & | name, |
| const std::string & | kind ) |
Adds a pass the engine implements itself: "voxelGI" (see VoxelGI). Its parameters are set like any pass's, by name.
Needs a device with a compute stage; elsewhere the pass is left out of the chain.
Definition at line 337 of file PostProcessPipeline.cpp.
References esengine::PostProcessPass::enabled, esengine::PostProcessPass::name, and esengine::PostProcessPass::nativeKind.
| u32 esengine::PostProcessPipeline::addPass | ( | const std::string & | name, |
| resource::ShaderHandle | shader ) |
Adds a post-processing pass.
Definition at line 314 of file PostProcessPipeline.cpp.
References esengine::PostProcessPass::enabled, esengine::PostProcessPass::name, and esengine::PostProcessPass::shader.
| u32 esengine::PostProcessPipeline::addScreenPass | ( | const std::string & | name, |
| resource::ShaderHandle | shader ) |
Adds a screen-level post-process pass.
Definition at line 1812 of file PostProcessPipeline.cpp.
References addScreenPass(), esengine::PostProcessPass::enabled, esengine::PostProcessPass::name, and esengine::PostProcessPass::shader.
Referenced by addScreenPass().
| glm::vec4 esengine::PostProcessPipeline::bakeSun | ( | ) | const |
Draws material material through PostProcess shader shader over the pass's viewport (RenderFrame::queueMaterialBake), its block in MaterialStore scratch scratch. False when it could not.
Definition at line 933 of file PostProcessPipeline.cpp.
Begins rendering to the pipeline.
Binds the input framebuffer. Render scene content after this. clearColor (RGBA) colors the capture's load-op clear — the camera background; null = opaque black.
Definition at line 994 of file PostProcessPipeline.cpp.
References begin(), esengine::RenderPassDesc::clearColorValue, ES_LOG_ERROR, esengine::rg::TargetDesc::gbuffer, isEngaged(), esengine::rg::kNoResource, and esengine::rg::TargetDesc::samples.
Referenced by begin().
| void esengine::PostProcessPipeline::beginScreenCapture | ( | ) |
Begins screen-level capture (all camera output goes into screen FBO).
Definition at line 1768 of file PostProcessPipeline.cpp.
References beginScreenCapture().
Referenced by beginScreenCapture().
| glm::vec2 esengine::PostProcessPipeline::beginTemporalView | ( | const glm::mat4 & | viewProjection, |
| u64 | key ) |
Starts a frame of the temporal view key, and answers how far to shift it.
| key | Names the view whose history this is — two cameras must not blend into one history. 0 for the screen. |
Definition at line 505 of file PostProcessPipeline.cpp.
References esengine::renderOrigin(), and esengine::viewProjectionFromOrigin().
| bool esengine::PostProcessPipeline::cameraMotionWanted | ( | ) |
Whether an enabled pass that keeps no history reads the previous camera (u_prevViewProjection0).
Motion blur is one: it needs to know where each pixel was a frame ago, and nothing else of the temporal machinery — no history, and above all no sub-pixel shift, which would shake a picture nothing resolves. The frame then follows the camera with trackView.
Definition at line 450 of file PostProcessPipeline.cpp.
References esengine::MaterialUniformLayout::find().
| bool esengine::PostProcessPipeline::canDrawMaterialOver | ( | u32 | material | ) |
Definition at line 809 of file PostProcessPipeline.cpp.
References esengine::Shader::handle(), and esengine::resource::Handle< T >::isValid().
| bool esengine::PostProcessPipeline::canGrabDepth | ( | ) |
Whether this device can hold the distances a depth copy is made of: a float target. Without one a surface that measures the water in front of what is behind it gets no depth and falls back to a fixed column.
Definition at line 1380 of file PostProcessPipeline.cpp.
References canGrabDepth().
Referenced by canGrabDepth().
| void esengine::PostProcessPipeline::chainDone | ( | ) |
Closes the capture once the graph has run it.
Definition at line 1061 of file PostProcessPipeline.cpp.
References chainDone(), and esengine::Default.
Referenced by chainDone().
| void esengine::PostProcessPipeline::clearPasses | ( | ) |
Checks if bypass mode is enabled.
Clears all passes
Definition at line 1329 of file PostProcessPipeline.cpp.
References clearPasses(), and esengine::Invalid.
Referenced by clearPasses().
| void esengine::PostProcessPipeline::clearScreenPasses | ( | ) |
Clears all screen-level passes.
Definition at line 1822 of file PostProcessPipeline.cpp.
References clearScreenPasses().
Referenced by clearScreenPasses().
| const PostProcessPass * esengine::PostProcessPipeline::cloudShadowCaster | ( | f32 & | extentKm, |
| f32 & | unitsPerKm ) const |
The sky that casts the sun's cloud shadow this frame, how far its map reaches each way in kilometres, and how many world units its kilometre is (its own u_unitsPerKm where it says, as Sky Atmosphere does; 0 where it leaves it to the project).
A pass whose shader declares u_cloudShadowPass (sdk postprocess/cloudShadowParams.ts) and has u_castCloudShadows on, and, where it has a strength (Sky Atmosphere's u_cloudShadow), above nothing. Null when no enabled pass does.
Definition at line 746 of file PostProcessPipeline.cpp.
References esengine::PostProcessPass::enabled, esengine::MaterialUniformLayout::find(), esengine::PostProcessPass::floatUniforms, and esengine::PostProcessPass::shader.
Referenced by drawCloudShadow().
| f32 esengine::PostProcessPipeline::coverBias | ( | ) |
The bias the drawing effect reads the map with (its u_shelterBias), for a pass that only borrows the map.
Definition at line 569 of file PostProcessPipeline.cpp.
References esengine::PostProcessPass::enabled, and esengine::PostProcessPass::floatUniforms.
| f32 esengine::PostProcessPipeline::coverRange | ( | ) |
How far from the camera, in world units, that map reaches each way (the effect's u_shelterRange).
Definition at line 559 of file PostProcessPipeline.cpp.
References esengine::PostProcessPass::enabled, and esengine::PostProcessPass::floatUniforms.
|
inline |
Definition at line 359 of file PostProcessPipeline.hpp.
| bool esengine::PostProcessPipeline::coverWanted | ( | ) |
Whether an enabled pass reads what stands over each place (u_rainCover).
The frame then draws the scene from straight above, depth only, around the camera: a map of the highest surface at each spot, so an effect can tell open ground from ground under an awning.
Definition at line 551 of file PostProcessPipeline.cpp.
References esengine::PostProcessPass::enabled.
| FramebufferHandle esengine::PostProcessPipeline::currentSceneFBO | ( | ) | const |
The surface the scene is currently rendering into: the screen-capture FBO when the screen stack is live, the per-camera capture when in-frame, else the default target. The main-pass load-op clear must land HERE — rebinding the default target mid-capture breaks the stack.
Definition at line 988 of file PostProcessPipeline.cpp.
References currentSceneFBO(), and esengine::Default.
Referenced by currentSceneFBO().
| void esengine::PostProcessPipeline::declareChain | ( | ) |
Declares this camera's chain onto the frame's graph. The frame runs it.
Definition at line 1046 of file PostProcessPipeline.cpp.
References declareChain().
Referenced by declareChain().
| rg::ResourceId esengine::PostProcessPipeline::declareCover | ( | u32 | size | ) |
The map's target for this frame, declared in the graph (kNoResource when it cannot be made).
Definition at line 578 of file PostProcessPipeline.cpp.
References esengine::FramebufferSpec::colorFormat, esengine::Framebuffer::create(), esengine::FramebufferSpec::depthStencil, ES_LOG_ERROR, esengine::FramebufferSpec::height, esengine::rg::kNoResource, esengine::FramebufferSpec::linearFilter, esengine::RGBA8, and esengine::FramebufferSpec::width.
| rg::ResourceId esengine::PostProcessPipeline::declareVelocity | ( | ) |
The motion pass's target for this frame, declared in the graph (kNoResource when it cannot be made).
RGBA32F: xy = how far the surface moved in uv, z = its window depth, w = 1 where something wrote. Depth in a float because the reader compares it with the scene's, and a half cannot tell two surfaces apart near the far plane.
Definition at line 602 of file PostProcessPipeline.cpp.
References esengine::FramebufferSpec::colorFormat, esengine::Framebuffer::create(), esengine::FramebufferSpec::depthStencil, ES_LOG_ERROR, esengine::FramebufferSpec::height, esengine::rg::kNoResource, esengine::FramebufferSpec::linearFilter, esengine::RGBA32F, and esengine::FramebufferSpec::width.
|
inline |
Definition at line 541 of file PostProcessPipeline.hpp.
Referenced by isEngaged().
| void esengine::PostProcessPipeline::drawCloudShadow | ( | const glm::mat4 & | inverse, |
| const glm::vec4 & | rect, | ||
| const rg::PassContext & | ctx ) |
Draws the caster's cloud shadow into the tile at rect of the bound target: what of the sun is left in the alpha, white above.
rect is the tile as the sun reads it (origin and side, in the target's texture coordinates), and inverse takes the tile's corners (clip x and y, -1 to 1) back to the world. The pass covers the target and finds the tile by the same coordinates the lookup uses, so the two agree on either backend whatever its viewport convention. Called from a graph pass that writes the shadow atlas before the scene, so the atlas is not bound for reading while it is drawn.
Definition at line 767 of file PostProcessPipeline.cpp.
References cloudShadowCaster(), esengine::ctx(), esengine::Invalid, esengine::PostProcessPass::name, and esengine::PostProcessPass::paramUbo.
| bool esengine::PostProcessPipeline::drawMaterialOver | ( | u32 | material | ) |
Definition at line 815 of file PostProcessPipeline.cpp.
References esengine::GLSL_ES300, esengine::Shader::hasUniform(), esengine::Invalid, esengine::resource::Handle< T >::isValid(), esengine::kGBufferUnit, esengine::kSceneDepthUnit, esengine::Shader::language(), and esengine::Shader::setUniform().
| bool esengine::PostProcessPipeline::drawMaterialThrough | ( | u32 | material, |
| u32 | shader, | ||
| const std::vector< std::pair< std::string, glm::vec4 > > & | overrides, | ||
| u32 | scratch ) |
Definition at line 793 of file PostProcessPipeline.cpp.
References esengine::Invalid, esengine::kGBufferUnit, and esengine::kSceneDepthUnit.
| bool esengine::PostProcessPipeline::drawProjectedMaterial | ( | u32 | material, |
| u32 | instances, | ||
| u32 | scratch, | ||
| const glm::vec4 & | sun, | ||
| const glm::vec4 & | receiverWindow, | ||
| TextureHandle | receiverDepth, | ||
| TextureHandle | movingDepth ) |
Definition at line 945 of file PostProcessPipeline.cpp.
References esengine::MaterialUniformLayout::findTexture(), esengine::Index, esengine::Invalid, and esengine::GfxContent::retained().
| void esengine::PostProcessPipeline::drawSelectionGround | ( | TextureHandle | depth | ) |
The selection mask's ground, into the bound mask target: the scene's depth in g, nothing covered.
Definition at line 1408 of file PostProcessPipeline.cpp.
References esengine::Shader::commitParams(), drawSelectionGround(), esengine::Shader::hasUniform(), esengine::Invalid, esengine::kSceneDepthUnit, and esengine::Shader::setUniform().
Referenced by drawSelectionGround().
| void esengine::PostProcessPipeline::drawSelectionOutline | ( | TextureHandle | mask | ) |
The selection's outline over what the bound target holds, from its mask. Blended over; the caller sets the viewport.
Definition at line 1390 of file PostProcessPipeline.cpp.
References esengine::Shader::commitParams(), drawSelectionOutline(), esengine::Shader::hasUniform(), esengine::Invalid, and esengine::Shader::setUniform().
Referenced by drawSelectionOutline().
| void esengine::PostProcessPipeline::encodeRgbm | ( | ) |
Draws the texture on unit 0 into the bound target as RGBM over 8 (alpha 0 kept for nothing drawn): a probe capture's face, packed for an 8-bit readback. Called inside a graph pass that reads that texture.
Definition at line 663 of file PostProcessPipeline.cpp.
References esengine::Shader::commitParams(), ES_LOG_ERROR, esengine::Shader::hasUniform(), and esengine::Shader::setUniform().
| void esengine::PostProcessPipeline::endScreenCapture | ( | ) |
Ends screen-level capture.
Definition at line 1780 of file PostProcessPipeline.cpp.
References endScreenCapture().
Referenced by endScreenCapture().
| void esengine::PostProcessPipeline::executeScreenPasses | ( | ) |
Executes screen-level post-process passes on captured output.
Definition at line 1787 of file PostProcessPipeline.cpp.
References executeScreenPasses().
Referenced by executeScreenPasses().
| const PostProcessPass * esengine::PostProcessPipeline::getPass | ( | const std::string & | name | ) | const |
Gets a pass by name.
Definition at line 888 of file PostProcessPipeline.cpp.
References esengine::PostProcessPass::name.
| const PostProcessPass * esengine::PostProcessPipeline::getPass | ( | u32 | index | ) | const |
Gets a pass by index.
Definition at line 883 of file PostProcessPipeline.cpp.
|
inline |
Gets the pass count.
Definition at line 227 of file PostProcessPipeline.hpp.
|
inline |
Gets the screen pass count.
Definition at line 603 of file PostProcessPipeline.hpp.
| void esengine::PostProcessPipeline::grabDepth | ( | ) |
Draws, into the target being drawn, the distance to the opaque scene at every pixel (the scene's depth, read at its unit).
Definition at line 1425 of file PostProcessPipeline.cpp.
References esengine::Shader::commitParams(), ES_LOG_ERROR, grabDepth(), esengine::Shader::hasUniform(), esengine::Invalid, esengine::kSceneDepthUnit, and esengine::Shader::setUniform().
Referenced by grabDepth().
|
inline |
The shape of the copy of the opaque scene's depth: how far each pixel is from the eye, in the red channel of a float target.
Definition at line 293 of file PostProcessPipeline.hpp.
References esengine::rg::TargetDesc::format, and esengine::RGBA16F.
| void esengine::PostProcessPipeline::grabScene | ( | bool | marked = true | ) |
Copies what is bound at unit 0 (the scene, as the pass before drew it) into the target being drawn. No exposure, no curve, no encode: a copy, with the alpha set to a marker (0.5) a shader can tell from the white a texture param falls back to — unless marked is false, for a copy that stands in for the scene itself (kept aside and put back): its alpha is coverage, and is kept.
Definition at line 1362 of file PostProcessPipeline.cpp.
References esengine::Shader::commitParams(), ES_LOG_ERROR, grabScene(), esengine::Shader::hasUniform(), esengine::resource::Handle< T >::isValid(), and esengine::Shader::setUniform().
Referenced by grabScene().
|
inline |
The shape of the copy of the opaque scene a refractive surface reads: the chain's own, bilinear.
Definition at line 282 of file PostProcessPipeline.hpp.
|
inline |
What this frame's intermediates were asked to be and allowed to be.
The committed decision, not a re-derivation: an editor explaining why a linear project is running at 8-bit has to agree with the targets the frame actually made.
Definition at line 506 of file PostProcessPipeline.hpp.
Initializes the pipeline with given dimensions.
Definition at line 61 of file PostProcessPipeline.cpp.
References ES_LOG_ERROR.
|
inline |
Whether the scene goes through the graph or straight to the surface.
Effects to run, the linear pipeline, an output transform, a display LUT or a scaling present engage it. One predicate, because everyone asks at both ends of a frame and a capture opened but never resolved is one edit away.
Definition at line 411 of file PostProcessPipeline.hpp.
References displayLutActive(), esengine::None, and presentScales().
Referenced by begin().
|
inline |
Checks if pipeline is initialized.
Definition at line 403 of file PostProcessPipeline.hpp.
|
inline |
Checks if screen capture is active.
Definition at line 608 of file PostProcessPipeline.hpp.
|
inline |
Definition at line 518 of file PostProcessPipeline.hpp.
|
delete |
References PostProcessPipeline().
|
inline |
Definition at line 545 of file PostProcessPipeline.hpp.
| PostProcessPipeline::TemporalView esengine::PostProcessPipeline::peekTemporalView | ( | const glm::mat4 & | viewProjection, |
| u64 | key ) const |
Read before the scene is drawn, because the motion pass is collected with the scene and the shift is only applied when it is drawn. Changes nothing: beginTemporalView still takes the same step.
Definition at line 525 of file PostProcessPipeline.cpp.
References esengine::PostProcessPipeline::TemporalView::jitter, esengine::PostProcessPipeline::TemporalView::previous, esengine::PostProcessPipeline::TemporalView::previousJitter, and esengine::viewProjectionFromOrigin().
| i32 esengine::PostProcessPipeline::pollSkyCapture | ( | ) |
0 = not yet, 1 = the pixels are ready (skyCapturePixels), 2 = none was asked for or it failed. Issues the readback itself once the capture has been drawn, so call it between frames, never inside one.
Definition at line 685 of file PostProcessPipeline.cpp.
References esengine::Invalid, esengine::Pending, and esengine::Ready.
|
inline |
Definition at line 476 of file PostProcessPipeline.hpp.
References presentScales().
Referenced by presentUpscales().
|
inline |
Whether the chain's own size differs from the rect it lands in.
Inferred rather than flagged: the chain size and the output rect are already two separate calls, so "they disagree" needs no third piece of state to go stale. A scene rendered at one resolution and presented at another is a scale, and a scale needs the blit.
Definition at line 430 of file PostProcessPipeline.hpp.
Referenced by isEngaged(), presentIsWholeMultiple(), and presentUpscales().
|
inline |
Whether the present is a whole-multiple upscale of the chain.
Inferred from the two rects, for the reason presentScales() is: the rect is the one authority, and a filter beside it is a second one to disagree with. A whole multiple copies exactly, and interpolating it blurs a picture that needed no resampling. A present that stretches the chain's picture over a bigger rect by a factor that is not a whole number: where a bilinear copy would blur it, and the blit resamples with a sharper filter instead.
Definition at line 471 of file PostProcessPipeline.hpp.
References presentIsWholeMultiple(), and presentScales().
|
inline |
What was asked for, before the ceiling.
Definition at line 199 of file PostProcessPipeline.hpp.
| void esengine::PostProcessPipeline::requestSkyCapture | ( | const std::string & | passName, |
| u32 | width, | ||
| u32 | height ) |
Draws pass passName once more, next frame, into a width x height RGBA8 target with its float param u_skyCapture at 1, and reads it back: a sky effect's panorama (see the SDK's defineSkyEffect).
The pass is drawn from a copy with a parameter buffer of its own — the same buffer written twice in one frame is one write on WebGPU. A request while one is in flight replaces it.
Definition at line 677 of file PostProcessPipeline.cpp.
References esengine::Invalid.
Resizes the framebuffers.
Definition at line 290 of file PostProcessPipeline.cpp.
References esengine::rg::kNoResource.
| bool esengine::PostProcessPipeline::sceneCoverageWanted | ( | ) |
Whether the scene is to be cleared to nothing (all four channels zero) so that its alpha says how much of each pixel geometry covers.
A sky drawn after the scene (the Sky Atmosphere effect) replaces every pixel whose depth is the far plane. Depth is resolved from one sample of a multisampled target, so a wire narrower than a pixel — covered at some samples, not at the one depth keeps — is painted over wherever that sample missed, and a line becomes dashes. With a clear of (0,0,0,0) the resolved colour is the geometry's share premultiplied and the alpha is its coverage, which is exactly what the sky has to be laid UNDER. An enabled pass asks for it by declaring u_sceneCoverage, unless it keeps the scene's own background (u_panorama above zero): there the cleared pixels are what the picture shows, and they must stay the camera's colour.
Definition at line 469 of file PostProcessPipeline.cpp.
References esengine::MaterialUniformLayout::find().
|
inline |
Whether this frame's scene target carries a second attachment for the surface's material.
Decided when the capture opens, from the passes: an effect whose shader says #pragma gbuffer reads what a surface IS (normal, roughness, metalness), which the scene's own shaders write beside the colour. A frame with no such effect makes none, so the cost is paid only by the project that asked for it.
Definition at line 369 of file PostProcessPipeline.hpp.
|
inline |
The graph resource the scene is captured into, for the frame to declare its scene pass against. kNoResource when no capture is open.
Definition at line 249 of file PostProcessPipeline.hpp.
References esengine::rg::kNoResource.
|
inline |
What the scene target is actually created with: the request after the device's ceiling. The two silently differing is how a project ships at 1x believing it asked for 8.
Definition at line 197 of file PostProcessPipeline.hpp.
|
inline |
Definition at line 459 of file PostProcessPipeline.hpp.
|
inline |
Skip the EFFECTS, not the chain.
It gates the authored passes and nothing else. The linear encode, the output transform and a scaling present all still engage — none of them is an effect, they are how the image reaches the screen, and a camera with no stack still needs them.
Definition at line 490 of file PostProcessPipeline.hpp.
|
inline |
The caller has decided this frame needs a present.
A DECISION, not a rect — which is why it is set rather than inferred like presentScales(). A 1x letterbox and a split-screen viewport are the same geometry, same size and offset, and differ only in intent; the two rects cannot say which is which. A compute pass reads the scene's depth, which only a scene drawn into a target of the graph's has.
Definition at line 444 of file PostProcessPipeline.hpp.
|
inline |
The matrix the map was drawn through, for the effect to put a world point in it.
Definition at line 358 of file PostProcessPipeline.hpp.
A graded look the final pass applies to the picture as the display will show it.
The display stage of the last pass: after the output transform and the transfer function, from a 32x32x32 table laid out as a 1024x32 strip (slice along x is blue). It is a variant of that shader, so it costs one texture read and no pass. It belongs to the chain that set it, and is let go with the passes (clearPasses): a camera that wants it says so each time.
| glTexture | The table's texture, or 0 for none. |
| amount | How far the picture moves toward the table's answer, 0 to 1. |
Definition at line 537 of file PostProcessPipeline.hpp.
|
inline |
The frame's environment atlas, for an effect that reflects it (u_environment).
Handed over by the frame that bound it for the scene: the same atlas the meshes reflect, so a reflection an effect adds where the scene's own ray found nothing is the sky the surface already shows. 0 = none this frame.
Definition at line 378 of file PostProcessPipeline.hpp.
|
inline |
Linear-light mode: sRGB-format intermediates (hardware linear blending) and an always-engaged capture+blit whose final pass carries the linear->sRGB encode. Overrides bypass.
Definition at line 497 of file PostProcessPipeline.hpp.
| void esengine::PostProcessPipeline::setOutputTarget | ( | FramebufferHandle | target | ) |
Sets the output target for the final blit (Default = screen).
Definition at line 1351 of file PostProcessPipeline.cpp.
References setOutputTarget().
Referenced by setOutputTarget().
|
inline |
The curve the final pass applies to scene values.
Costs nothing when the chain is already engaged — the blit was always going to run — so this is a variant of that shader rather than a pass of its own.
Definition at line 527 of file PostProcessPipeline.hpp.
Sets the output viewport for the final blit.
Definition at line 1355 of file PostProcessPipeline.cpp.
References setOutputViewport().
Referenced by setOutputViewport().
| void esengine::PostProcessPipeline::setPassContinuesEffect | ( | const std::string & | passName | ) |
Mark passName as a later pass of the effect the pass before it began.
Definition at line 399 of file PostProcessPipeline.cpp.
| void esengine::PostProcessPipeline::setPassScale | ( | const std::string & | passName, |
| f32 | scale ) |
Draw passName at scale of the chain size (clamped to (0, 1]).
Definition at line 391 of file PostProcessPipeline.cpp.
| void esengine::PostProcessPipeline::setPassTexture | ( | const std::string & | passName, |
| const std::string & | uniform, | ||
| u32 | glTextureId ) |
Binds a texture to a pass's sampler uniform (unit 2 upward, in registration order). Replaces an existing binding of the same name.
Definition at line 864 of file PostProcessPipeline.cpp.
References esengine::PostProcessPass::textureUniforms.
| void esengine::PostProcessPipeline::setPassUniformFloat | ( | const std::string & | passName, |
| const std::string & | uniform, | ||
| f32 | value ) |
Sets a float uniform for a pass.
Definition at line 856 of file PostProcessPipeline.cpp.
References esengine::PostProcessPass::floatUniforms, and esengine::PostProcessPass::paramDirty.
| void esengine::PostProcessPipeline::setPassUniformVec4 | ( | const std::string & | passName, |
| const std::string & | uniform, | ||
| const glm::vec4 & | value ) |
Sets a vec4 uniform for a pass.
Definition at line 874 of file PostProcessPipeline.cpp.
References esengine::PostProcessPass::paramDirty, and esengine::PostProcessPass::vec4Uniforms.
|
inline |
This camera keeps the colour under it: its present composites over the target by coverage.
A camera that does not clear colour (a first-person view model, any overlay) still goes through a capture when the frame is linear or has an output transform, and the capture starts empty. Copied over the target as it was, it replaced the camera underneath with black. Set by the frame when it opens such a camera's pass (its capture is then cleared to transparent); cleared when the camera's chain is done.
Definition at line 457 of file PostProcessPipeline.hpp.
|
inline |
Definition at line 445 of file PostProcessPipeline.hpp.
| void esengine::PostProcessPipeline::setRequestedSamples | ( | u32 | samples | ) |
The project's multisampling request; 1 = off. Clamped by the device.
Definition at line 386 of file PostProcessPipeline.cpp.
|
inline |
Whether the scene target needs a depth attachment.
A depth buffer is per-frame memory and clear bandwidth (≈8MB at 1080p), which a project with no depth layer should not pay for a feature it does not use. A flag and nothing more: the scene target is declared to the graph at every begin(), so the next frame asks the pool for the shape this answer describes and the old one is simply never handed out again.
Definition at line 517 of file PostProcessPipeline.hpp.
| void esengine::PostProcessPipeline::setScreenPassUniformFloat | ( | const std::string & | passName, |
| const std::string & | uniform, | ||
| f32 | value ) |
Sets a float uniform for a screen-level pass.
Definition at line 1836 of file PostProcessPipeline.cpp.
References setScreenPassUniformFloat().
Referenced by setScreenPassUniformFloat().
| void esengine::PostProcessPipeline::setScreenPassUniformVec4 | ( | const std::string & | passName, |
| const std::string & | uniform, | ||
| const glm::vec4 & | value ) |
Sets a vec4 uniform for a screen-level pass.
Definition at line 1844 of file PostProcessPipeline.cpp.
References setScreenPassUniformVec4().
Referenced by setScreenPassUniformVec4().
|
inline |
The editor's selection mask for this chain (RenderFrame::declareSelectionMask): outlined after the last pass.
Definition at line 251 of file PostProcessPipeline.hpp.
|
inline |
An editor selection is outlined this frame: a screen effect, so the scene is drawn where its depth can be read.
Definition at line 447 of file PostProcessPipeline.hpp.
|
inline |
The frame's shadow atlas, for an effect that asks whether a point of air is in the sun (#pragma lights).
The atlas is a graph resource the scene pass names as a dependency; an effect that reads it names it too, or the graph would hand it back to the pool before the effect ran. 0 / kNoResource = no map.
Definition at line 386 of file PostProcessPipeline.hpp.
| void esengine::PostProcessPipeline::setViewExposure | ( | f32 | ev | ) |
The editor view's exposure in stops, applied by the blit. Engages the blit when non-zero, since only the blit carries it; the value rides the frame's time block.
Definition at line 109 of file PostProcessPipeline.cpp.
| void esengine::PostProcessPipeline::shutdown | ( | ) |
Shuts down and releases resources.
Definition at line 206 of file PostProcessPipeline.cpp.
References ES_LOG_INFO, esengine::Invalid, and esengine::rg::kNoResource.
Referenced by ~PostProcessPipeline().
|
inline |
The captured pixels, RGBA8, rows bottom-up as every readback lands. Valid after poll answered 1.
Definition at line 630 of file PostProcessPipeline.hpp.
| bool esengine::PostProcessPipeline::supportsCompute | ( | ) | const |
Whether passes added with addComputePass run on this device.
Definition at line 324 of file PostProcessPipeline.cpp.
| bool esengine::PostProcessPipeline::temporalActive | ( | ) |
Whether this frame's chain holds a temporal effect.
An effect is temporal when its shader declares a u_history texture: the engine then keeps the pass's last output for it and shifts the picture by a sub-pixel amount each frame. The pass list is the answer, so there is no flag to disagree with it.
Definition at line 442 of file PostProcessPipeline.cpp.
| void esengine::PostProcessPipeline::trackView | ( | const glm::mat4 & | viewProjection, |
| u64 | key ) |
Records this frame's camera as the view key's current one, and last frame's as its previous. No shift.
Definition at line 460 of file PostProcessPipeline.cpp.
References esengine::renderOrigin(), and esengine::viewProjectionFromOrigin().
| bool esengine::PostProcessPipeline::velocityWanted | ( | ) |
Whether an enabled pass reads how far each moving surface travelled (u_velocity).
The frame then draws its moving meshes a second time into a target of its own, so a temporal effect can follow an object by its own displacement instead of the camera's.
Definition at line 481 of file PostProcessPipeline.cpp.