Blender V4.3
COM_smaa_precomputed_textures.hh
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2023 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
5#pragma once
6
7#include <memory>
8
9#include "GPU_shader.hh"
10#include "GPU_texture.hh"
11
13
15
16/* -------------------------------------------------------------------------------------------------
17 * SMAA Precomputed Textures.
18 *
19 * A cached resource that caches the precomputed textures needed by the SMAA algorithm. The
20 * precomputed textures are constants, so this is a parameterless cached resource. */
22 private:
23 GPUTexture *search_texture_ = nullptr;
24 GPUTexture *area_texture_ = nullptr;
25
26 public:
28
30
31 void bind_search_texture(GPUShader *shader, const char *sampler_name) const;
32
33 void unbind_search_texture() const;
34
35 void bind_area_texture(GPUShader *shader, const char *sampler_name) const;
36
37 void unbind_area_texture() const;
38};
39
40/* ------------------------------------------------------------------------------------------------
41 * SMAA Precomputed Textures Container.
42 */
44 private:
45 std::unique_ptr<SMAAPrecomputedTextures> textures_;
46
47 public:
48 void reset() override;
49
50 /* Check if a cached SMAA precomputed texture exists, if it does, return it, otherwise, return
51 * a newly created one and store it in the container. In both cases, tag the cached resource as
52 * needed to keep it cached for the next evaluation. */
54};
55
56} // namespace blender::realtime_compositor
struct GPUShader GPUShader
void bind_search_texture(GPUShader *shader, const char *sampler_name) const
void bind_area_texture(GPUShader *shader, const char *sampler_name) const