Blender V5.0
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
12#include "DNA_color_types.h"
13
15
16namespace blender::gpu {
17class Shader;
18} // namespace blender::gpu
19
20namespace blender::compositor {
21
22class Context;
23
24/* ------------------------------------------------------------------------------------------------
25 * OCIO Color Space Conversion Shader Key.
26 */
28 public:
29 std::string source;
30 std::string target;
31 std::string config_cache_id;
32
34 const std::string &target,
35 const std::string &config_cache_id);
36
37 uint64_t hash() const;
38};
39
42
44
45/* -------------------------------------------------------------------------------------------------
46 * OCIO Color Space Conversion Shader.
47 *
48 * A cached resource that creates and caches a GPU shader that converts the source OCIO color space
49 * of an image into a different target OCIO color space. */
51 private:
52 std::shared_ptr<GPUShaderCreator> shader_creator_;
53
54 public:
55 OCIOColorSpaceConversionShader(Context &context, std::string source, std::string target);
56
58
60
61 const char *input_sampler_name();
62
63 const char *output_image_name();
64};
65
66/* ------------------------------------------------------------------------------------------------
67 * OCIO Color Space Conversion Shader Container.
68 */
70 private:
72
73 public:
74 void reset() override;
75
76 /* Check if there is an available OCIOColorSpaceConversionShader cached resource with the given
77 * parameters in the container, if one exists, return it, otherwise, return a newly created one
78 * and add it to the container. In both cases, tag the cached resource as needed to keep it
79 * cached for the next evaluation. */
80 OCIOColorSpaceConversionShader &get(Context &context, std::string source, std::string target);
81};
82
83/* ------------------------------------------------------------------------------------------------
84 * OCIO To Display Shader Key.
85 */
87 public:
88 std::string display_device;
89 std::string view_transform;
90 std::string look;
91 bool inverse;
92 std::string config_cache_id;
93
95 const ColorManagedViewSettings &view_settings,
96 const bool inverse,
97 const std::string &config_cache_id);
98
99 uint64_t hash() const;
100};
101
103
104class GPUShaderCreator;
105
106/* -------------------------------------------------------------------------------------------------
107 * OCIO To Display Shader.
108 *
109 * A cached resource that creates and caches a GPU shader that converts the source OCIO color space
110 * of an image into a different target OCIO color space. */
112 private:
113 std::shared_ptr<GPUShaderCreator> shader_creator_;
114
115 public:
117 const ColorManagedDisplaySettings &display_settings,
118 const ColorManagedViewSettings &view_settings,
119 const bool inverse);
120
122
124
125 const char *input_sampler_name();
126
127 const char *output_image_name();
128};
129
130/* ------------------------------------------------------------------------------------------------
131 * OCIO To Display Shader Container.
132 */
134 private:
136
137 public:
138 void reset() override;
139
140 /* Check if there is an available OCIOToDisplayShader cached resource with the given
141 * parameters in the container, if one exists, return it, otherwise, return a newly created one
142 * and add it to the container. In both cases, tag the cached resource as needed to keep it
143 * cached for the next evaluation. */
145 const ColorManagedDisplaySettings &display_settings,
146 const ColorManagedViewSettings &view_settings,
147 const bool inverse);
148};
149
150} // 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)
OCIOToDisplayShader & get(Context &context, const ColorManagedDisplaySettings &display_settings, const ColorManagedViewSettings &view_settings, const bool inverse)
OCIOToDisplayShaderKey(const ColorManagedDisplaySettings &display_settings, const ColorManagedViewSettings &view_settings, const bool inverse, const std::string &config_cache_id)
OCIOToDisplayShader(Context &context, const ColorManagedDisplaySettings &display_settings, const ColorManagedViewSettings &view_settings, const bool inverse)
MatBase< C, R > inverse(MatBase< C, R >) RET
bool operator==(const BokehKernelKey &a, const BokehKernelKey &b)