Blender V4.5
COM_ocio_color_space_conversion_shader.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 <cstdint>
8#include <string>
9
10#include "BLI_map.hh"
11
13
14struct GPUShader;
15
16namespace blender::compositor {
17
18class Context;
19
20/* ------------------------------------------------------------------------------------------------
21 * OCIO Color Space Conversion Shader Key.
22 */
24 public:
25 std::string source;
26 std::string target;
27 std::string config_cache_id;
28
30 const std::string &target,
31 const std::string &config_cache_id);
32
33 uint64_t hash() const;
34};
35
38
40
41/* -------------------------------------------------------------------------------------------------
42 * OCIO Color Space Conversion Shader.
43 *
44 * A cached resource that creates and caches a GPU shader that converts the source OCIO color space
45 * of an image into a different target OCIO color space. */
47 private:
48 std::shared_ptr<GPUShaderCreator> shader_creator_;
49
50 public:
51 OCIOColorSpaceConversionShader(Context &context, std::string source, std::string target);
52
53 GPUShader *bind_shader_and_resources();
54
56
57 const char *input_sampler_name();
58
59 const char *output_image_name();
60};
61
62/* ------------------------------------------------------------------------------------------------
63 * OCIO Color Space Conversion Shader Container.
64 */
66 private:
68
69 public:
70 void reset() override;
71
72 /* Check if there is an available OCIOColorSpaceConversionShader cached resource with the given
73 * parameters in the container, if one exists, return it, otherwise, return a newly created one
74 * and add it to the container. In both cases, tag the cached resource as needed to keep it
75 * cached for the next evaluation. */
76 OCIOColorSpaceConversionShader &get(Context &context, std::string source, std::string target);
77};
78
79} // namespace blender::compositor
unsigned long long int uint64_t
OCIOColorSpaceConversionShader & get(Context &context, std::string source, std::string target)
OCIOColorSpaceConversionShaderKey(const std::string &source, const std::string &target, const std::string &config_cache_id)
OCIOColorSpaceConversionShader(Context &context, std::string source, std::string target)
bool operator==(const BokehKernelKey &a, const BokehKernelKey &b)