VisuTwin Canvas
C++ 3D Engine — Metal Backend
Loading...
Searching...
No Matches
metalTaaPass.h
Go to the documentation of this file.
1// SPDX-License-Identifier: Apache-2.0
2// Copyright 2025-2026 Arnis Lektauers
3//
4// TAA (Temporal Anti-Aliasing) resolve pass.
5// Extracted from MetalGraphicsDevice for single-responsibility decomposition.
6//
7#pragma once
8
9#include <array>
10#include <memory>
11#include <vector>
12#include <Metal/Metal.hpp>
13
14namespace visutwin::canvas
15{
16 class BlendState;
17 class DepthState;
18 class Matrix4;
20 class MetalComposePass;
23 class RenderTarget;
24 class Shader;
25 class Texture;
26
32 {
33 public:
36
38 void execute(MTL::RenderCommandEncoder* encoder,
39 Texture* sourceTexture, Texture* historyTexture, Texture* depthTexture,
40 const Matrix4& viewProjectionPrevious, const Matrix4& viewProjectionInverse,
41 const std::array<float, 4>& jitters, const std::array<float, 4>& cameraParams,
42 bool highQuality, bool historyValid,
43 MetalRenderPipeline* pipeline, const std::shared_ptr<RenderTarget>& renderTarget,
44 const std::vector<std::shared_ptr<MetalBindGroupFormat>>& bindGroupFormats,
45 MTL::SamplerState* defaultSampler, MTL::DepthStencilState* defaultDepthStencilState);
46
47 private:
48 void ensureResources();
49
50 MetalGraphicsDevice* _device;
51 MetalComposePass* _composePass;
52
53 std::shared_ptr<Shader> _shader;
54 std::shared_ptr<BlendState> _blendState;
55 std::shared_ptr<DepthState> _depthState;
56 MTL::DepthStencilState* _depthStencilState = nullptr;
57 };
58}
MetalTaaPass(MetalGraphicsDevice *device, MetalComposePass *composePass)
void execute(MTL::RenderCommandEncoder *encoder, Texture *sourceTexture, Texture *historyTexture, Texture *depthTexture, const Matrix4 &viewProjectionPrevious, const Matrix4 &viewProjectionInverse, const std::array< float, 4 > &jitters, const std::array< float, 4 > &cameraParams, bool highQuality, bool historyValid, MetalRenderPipeline *pipeline, const std::shared_ptr< RenderTarget > &renderTarget, const std::vector< std::shared_ptr< MetalBindGroupFormat > > &bindGroupFormats, MTL::SamplerState *defaultSampler, MTL::DepthStencilState *defaultDepthStencilState)
Execute the TAA resolve pass on the active render command encoder.
GPU texture resource supporting 2D, cubemap, volume, and array formats with mipmap management.
Definition texture.h:57
4x4 column-major transformation matrix with SIMD acceleration.
Definition matrix4.h:31