VisuTwin Canvas
C++ 3D Engine — Metal Backend
Loading...
Searching...
No Matches
metalCoCPass.h
Go to the documentation of this file.
1// SPDX-License-Identifier: Apache-2.0
2// Copyright 2025-2026 Arnis Lektauers
3//
4// Circle of Confusion (CoC) pass for Depth of Field.
5//
6#pragma once
7
8#include <memory>
9#include <vector>
10#include <Metal/Metal.hpp>
11
12namespace visutwin::canvas
13{
14 class BlendState;
15 class DepthState;
17 class MetalComposePass;
20 class RenderTarget;
21 class Shader;
22 class Texture;
23
24 struct CoCPassParams;
25
31 {
32 public:
35
37 void execute(MTL::RenderCommandEncoder* encoder,
38 const CoCPassParams& params,
39 MetalRenderPipeline* pipeline, const std::shared_ptr<RenderTarget>& renderTarget,
40 const std::vector<std::shared_ptr<MetalBindGroupFormat>>& bindGroupFormats,
41 MTL::SamplerState* defaultSampler, MTL::DepthStencilState* defaultDepthStencilState);
42
43 private:
44 void ensureResources();
45
46 MetalGraphicsDevice* _device;
47 MetalComposePass* _composePass;
48
49 std::shared_ptr<Shader> _shader;
50 std::shared_ptr<BlendState> _blendState;
51 std::shared_ptr<DepthState> _depthState;
52 MTL::DepthStencilState* _depthStencilState = nullptr;
53 };
54}
void execute(MTL::RenderCommandEncoder *encoder, const CoCPassParams &params, MetalRenderPipeline *pipeline, const std::shared_ptr< RenderTarget > &renderTarget, const std::vector< std::shared_ptr< MetalBindGroupFormat > > &bindGroupFormats, MTL::SamplerState *defaultSampler, MTL::DepthStencilState *defaultDepthStencilState)
Execute the CoC pass on the active render command encoder.
MetalCoCPass(MetalGraphicsDevice *device, MetalComposePass *composePass)
GPU texture resource supporting 2D, cubemap, volume, and array formats with mipmap management.
Definition texture.h:57