Blender V4.5
OCIO_gpu_shader_binder.hh
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2025 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
14
15#pragma once
16
17#include <memory>
18#include <string>
19
20#include "BLI_array.hh"
21#include "BLI_span.hh"
22#include "BLI_string_ref.hh"
23
24struct CurveMapping;
25struct GPUShader;
26
27namespace blender::ocio {
28
29class Config;
30
31namespace internal {
33class GPUShaderCache;
34} // namespace internal
35
42 float scale = 1.0f;
43 float exponent = 1.0f;
44 float dither = 0.0f;
45 float temperature = 6500.0f;
46 float tint = 10.0f;
47 bool use_white_balance = false;
48 bool use_predivide = false;
49 bool do_overlay_merge = false;
50 bool use_hdr = false;
51};
52
54 /* Cache of shaders used for conversion to the display space. */
55 std::unique_ptr<internal::GPUShaderCache> display_cache_;
56
57 /* Cache of shaders used for conversion to scene linear space. */
58 std::unique_ptr<internal::GPUShaderCache> scene_linear_cache_;
59
60 public:
61 explicit GPUShaderBinder(const Config &config);
63
70 bool display_bind(const GPUDisplayParameters &display_parameters) const;
71
78 bool to_scene_linear_bind(StringRefNull from_colorspace, bool use_predivide) const;
79
86 void unbind() const;
87
88 protected:
90
96 virtual void construct_display_shader(internal::GPUDisplayShader &display_shader) const = 0;
97
102 virtual void construct_scene_linear_shader(internal::GPUDisplayShader &display_shader) const = 0;
103
108 static bool create_gpu_shader(internal::GPUDisplayShader &display_shader,
109 StringRefNull fragment_source,
110 Span<std::array<StringRefNull, 2>> additional_defines);
111};
112
113} // namespace blender::ocio
virtual void construct_display_shader(internal::GPUDisplayShader &display_shader) const =0
static bool create_gpu_shader(internal::GPUDisplayShader &display_shader, StringRefNull fragment_source, Span< std::array< StringRefNull, 2 > > additional_defines)
bool to_scene_linear_bind(StringRefNull from_colorspace, bool use_predivide) const
bool display_bind(const GPUDisplayParameters &display_parameters) const
virtual void construct_scene_linear_shader(internal::GPUDisplayShader &display_shader) const =0
GPUShaderBinder(const Config &config)