Blender V5.3
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 {
17
18namespace gpu {
19class Shader;
20} // namespace gpu
21
22namespace compositor {
23
24class Context;
25
26/* ------------------------------------------------------------------------------------------------
27 * OCIO Color Space Conversion Shader Key.
28 */
30 public:
31 std::string source;
32 std::string target;
33 std::string config_cache_id;
34
36 const std::string &target,
37 const std::string &config_cache_id);
38
39 uint64_t hash() const;
40};
41
44
46
47/* -------------------------------------------------------------------------------------------------
48 * OCIO Color Space Conversion Shader.
49 *
50 * A cached resource that creates and caches a GPU shader that converts the source OCIO color space
51 * of an image into a different target OCIO color space. */
53 private:
54 std::shared_ptr<GPUShaderCreator> shader_creator_;
55
56 public:
57 OCIOColorSpaceConversionShader(Context &context, std::string source, std::string target);
58
60
62
63 const char *input_sampler_name();
64
65 const char *output_image_name();
66};
67
68/* ------------------------------------------------------------------------------------------------
69 * OCIO Color Space Conversion Shader Container.
70 */
72 private:
74
75 public:
76 void reset() override;
77
78 /* Check if there is an available OCIOColorSpaceConversionShader cached resource with the given
79 * parameters in the container, if one exists, return it, otherwise, return a newly created one
80 * and add it to the container. In both cases, tag the cached resource as needed to keep it
81 * cached for the next evaluation. */
82 OCIOColorSpaceConversionShader &get(Context &context, std::string source, std::string target);
83};
84
85/* ------------------------------------------------------------------------------------------------
86 * OCIO To Display Shader Key.
87 */
89 public:
90 std::string display_device;
91 std::string view_transform;
92 std::string look;
93 bool inverse;
94 std::string config_cache_id;
95
97 const ColorManagedViewSettings &view_settings,
98 const bool inverse,
99 const std::string &config_cache_id);
100
101 uint64_t hash() const;
102};
103
105
106class GPUShaderCreator;
107
108/* -------------------------------------------------------------------------------------------------
109 * OCIO To Display Shader.
110 *
111 * A cached resource that creates and caches a GPU shader that converts the source OCIO color space
112 * of an image into a different target OCIO color space. */
114 private:
115 std::shared_ptr<GPUShaderCreator> shader_creator_;
116
117 public:
119 const ColorManagedDisplaySettings &display_settings,
120 const ColorManagedViewSettings &view_settings,
121 const bool inverse);
122
124
126
127 const char *input_sampler_name();
128
129 const char *output_image_name();
130};
131
132/* ------------------------------------------------------------------------------------------------
133 * OCIO To Display Shader Container.
134 */
136 private:
138
139 public:
140 void reset() override;
141
142 /* Check if there is an available OCIOToDisplayShader cached resource with the given
143 * parameters in the container, if one exists, return it, otherwise, return a newly created one
144 * and add it to the container. In both cases, tag the cached resource as needed to keep it
145 * cached for the next evaluation. */
147 const ColorManagedDisplaySettings &display_settings,
148 const ColorManagedViewSettings &view_settings,
149 const bool inverse);
150};
151
152} // namespace compositor
153} // namespace blender
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)
BMesh Iterators.
unsigned __int64 uint64_t
Definition BKE_text.h:91