Blender V5.3
ocio_color_space_conversion_shader.cc
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#include <cstdint>
6#include <memory>
7#include <string>
8
9#include "BLI_assert.hh"
10#include "BLI_hash.hh"
11#include "BLI_map.hh"
12#include "BLI_string_ref.hh"
13#include "BLI_vector.hh"
14#include "BLI_vector_set.hh"
15
16#include "GPU_capabilities.hh"
17#include "GPU_shader.hh"
18#include "GPU_texture.hh"
19#include "GPU_uniform_buffer.hh"
20
22
23#include "COM_context.hh"
25#include "COM_result.hh"
26
28
29#include "CLG_log.h"
30
31#include <OpenColorIO/OpenColorIO.h>
32
33namespace blender::compositor {
34
35static CLG_LogRef LOG = {"compositor.gpu"};
36
37/* --------------------------------------------------------------------
38 * GPU Shader Creator.
39 */
40
41namespace OCIO = OCIO_NAMESPACE;
42using namespace blender::gpu::shader;
43
44/* A subclass of OCIO::GpuShaderCreator that constructs the shader using a ShaderCreateInfo. The
45 * Create method should be used to construct the creator, then the extractGpuShaderInfo() method of
46 * the appropriate OCIO::GPUProcessor should be called passing in the creator. After construction,
47 * the constructed compute shader can be used by calling the bind_shader_and_resources() method,
48 * followed by binding the input texture and output image using their names input_sampler_name()
49 * and output_image_name(), following by dispatching the shader on the domain of the input, and
50 * finally calling the unbind_shader_and_resources() method.
51 *
52 * Upon calling the extractGpuShaderInfo(), all the transforms in the GPU processor will add their
53 * needed resources by calling the respective addUniform() and add[3D]Texture() methods. Then, the
54 * shader code of all transforms will be generated and passed to the createShaderText() method,
55 * generating the full code of the processor. Finally, the finalize() method will be called to
56 * finally create the shader. */
57class GPUShaderCreator : public OCIO::GpuShaderCreator {
58 public:
59 static std::shared_ptr<GPUShaderCreator> Create(ResultPrecision precision)
60 {
61 std::shared_ptr<GPUShaderCreator> instance = std::make_shared<GPUShaderCreator>();
62 instance->setLanguage(OCIO::GPU_LANGUAGE_GLSL_4_0);
63 instance->precision_ = precision;
64 return instance;
65 }
66
67 /* Not used, but needs to be overridden, so return a nullptr. */
68 OCIO::GpuShaderCreatorRcPtr clone() const override
69 {
70 return OCIO::GpuShaderCreatorRcPtr();
71 }
72
73 /* This is ignored since we query using our own GPU capabilities system. */
74 void setTextureMaxWidth(uint /*max_width*/) override {}
75
76 uint getTextureMaxWidth() const noexcept override
77 {
78 return GPU_max_texture_size();
79 }
80
81#if OCIO_VERSION_HEX >= 0x02030000
82 void setAllowTexture1D(bool allowed) override
83 {
84 allow_texture_1D_ = allowed;
85 }
86
87 bool getAllowTexture1D() const override
88 {
89 return allow_texture_1D_;
90 }
91#endif
92
93 bool addUniform(const char *name, const DoubleGetter &get_double) override
94 {
95 /* Check if a resource exists with the same name and assert if it is the case, returning false
96 * indicates failure to add the uniform for the shader creator. */
97 if (!resource_names_.add(std::make_unique<std::string>(name))) {
99 return false;
100 }
101
102 /* Don't use the name argument directly since ShaderCreateInfo only stores references to
103 * resource names, instead, use the name that is stored in resource_names_. */
104 std::string &resource_name = *resource_names_[resource_names_.size() - 1];
105 shader_create_info_.push_constant(Type::float_t, resource_name);
106
107 float_uniforms_.add(resource_name, get_double);
108
109 return true;
110 }
111
112 bool addUniform(const char *name, const BoolGetter &get_bool) override
113 {
114 /* Check if a resource exists with the same name and assert if it is the case, returning false
115 * indicates failure to add the uniform for the shader creator. */
116 if (!resource_names_.add(std::make_unique<std::string>(name))) {
118 return false;
119 }
120
121 /* Don't use the name argument directly since ShaderCreateInfo only stores references to
122 * resource names, instead, use the name that is stored in resource_names_. */
123 const std::string &resource_name = *resource_names_[resource_names_.size() - 1];
124 shader_create_info_.push_constant(Type::bool_t, resource_name);
125
126 boolean_uniforms_.add(name, get_bool);
127
128 return true;
129 }
130
131 bool addUniform(const char *name, const Float3Getter &get_float3) override
132 {
133 /* Check if a resource exists with the same name and assert if it is the case, returning false
134 * indicates failure to add the uniform for the shader creator. */
135 if (!resource_names_.add(std::make_unique<std::string>(name))) {
137 return false;
138 }
139
140 /* Don't use the name argument directly since ShaderCreateInfo only stores references to
141 * resource names, instead, use the name that is stored in resource_names_. */
142 std::string &resource_name = *resource_names_[resource_names_.size() - 1];
143 shader_create_info_.push_constant(Type::float3_t, resource_name);
144
145 vector_uniforms_.add(resource_name, get_float3);
146
147 return true;
148 }
149
150 bool addUniform(const char *name,
151 const SizeGetter &get_size,
152 const VectorFloatGetter &get_vector_float
153#if OCIO_VERSION_HEX >= 0x02050000
154 ,
155 const uint /*maxSize*/
156#endif
157 ) override
158 {
159 /* Check if a resource exists with the same name and assert if it is the case, returning false
160 * indicates failure to add the uniform for the shader creator. */
161 if (!resource_names_.add(std::make_unique<std::string>(name))) {
163 return false;
164 }
165
166 /* Don't use the name argument directly since ShaderCreateInfo only stores references to
167 * resource names, instead, use the name that is stored in resource_names_. */
168 std::string &resource_name = *resource_names_[resource_names_.size() - 1];
169 shader_create_info_.uniform_buf(buffers_sizes_.size(), "float", resource_name);
170
171 float_buffers_.add(resource_name, get_vector_float);
172 buffers_sizes_.add(resource_name, get_size);
173
174 return true;
175 }
176
177 bool addUniform(const char *name,
178 const SizeGetter &get_size,
179 const VectorIntGetter &get_vector_int
180#if OCIO_VERSION_HEX >= 0x02050000
181 ,
182 const uint /*maxSize*/
183#endif
184 ) override
185 {
186 /* Check if a resource exists with the same name and assert if it is the case, returning false
187 * indicates failure to add the uniform for the shader creator. */
188 if (!resource_names_.add(std::make_unique<std::string>(name))) {
190 return false;
191 }
192
193 /* Don't use the name argument directly since ShaderCreateInfo only stores references to
194 * resource names, instead, use the name that is stored in resource_names_. */
195 std::string &resource_name = *resource_names_[resource_names_.size() - 1];
196 shader_create_info_.uniform_buf(buffers_sizes_.size(), "int", resource_name);
197
198 int_buffers_.add(name, get_vector_int);
199 buffers_sizes_.add(name, get_size);
200
201 return true;
202 }
203
204#if OCIO_VERSION_HEX >= 0x02050000
205 uint
206#else
207 void
208#endif
209 addTexture(const char *texture_name,
210 const char *sampler_name,
211 uint width,
212 uint height,
213 TextureType channel,
214#if OCIO_VERSION_HEX >= 0x02030000
215 OCIO::GpuShaderDesc::TextureDimensions dimensions,
216#endif
217 OCIO::Interpolation interpolation,
218 const float *values) override
219 {
220 /* Check if a resource exists with the same name and assert if it is the case. */
221 if (!resource_names_.add(std::make_unique<std::string>(sampler_name))) {
223 }
224
225 /* Don't use the name argument directly since ShaderCreateInfo only stores references to
226 * resource names, instead, use the name that is stored in resource_names_. */
227 const std::string &resource_name = *resource_names_[resource_names_.size() - 1];
228
230 const gpu::TextureFormat base_format = (channel == TEXTURE_RGB_CHANNEL) ?
231 gpu::TextureFormat::SFLOAT_32_32_32 :
232 gpu::TextureFormat::SFLOAT_32;
233 const gpu::TextureFormat texture_format = Result::gpu_texture_format(base_format, precision_);
234 /* A height of 1 indicates a 1D texture according to the OCIO API. */
235#if OCIO_VERSION_HEX >= 0x02030000
236 if (dimensions == OCIO::GpuShaderDesc::TEXTURE_1D)
237#else
238 if (height == 1)
239#endif
240 {
242 texture_name, width, 1, texture_format, GPU_TEXTURE_USAGE_SHADER_READ, values);
243 shader_create_info_.sampler(textures_.size() + 1, ImageType::Float1D, resource_name);
244 }
245 else {
247 texture_name, width, height, 1, texture_format, GPU_TEXTURE_USAGE_SHADER_READ, values);
248 shader_create_info_.sampler(textures_.size() + 1, ImageType::Float2D, resource_name);
249 }
250 GPU_texture_filter_mode(texture, interpolation != OCIO::INTERP_NEAREST);
251
252 textures_.add(sampler_name, texture);
253#if OCIO_VERSION_HEX >= 0x02050000
254 return textures_.size() - 1;
255#endif
256 }
257
258#if OCIO_VERSION_HEX >= 0x02050000
259 uint
260#else
261 void
262#endif
263 add3DTexture(const char *texture_name,
264 const char *sampler_name,
265 uint size,
266 OCIO::Interpolation interpolation,
267 const float *values) override
268 {
269 /* Check if a resource exists with the same name and assert if it is the case. */
270 if (!resource_names_.add(std::make_unique<std::string>(sampler_name))) {
272 }
273
274 /* Don't use the name argument directly since ShaderCreateInfo only stores references to
275 * resource names, instead, use the name that is stored in resource_names_. */
276 const std::string &resource_name = *resource_names_[resource_names_.size() - 1];
277 shader_create_info_.sampler(textures_.size() + 1, ImageType::Float3D, resource_name);
278
280 texture_name,
281 size,
282 size,
283 size,
284 1,
285 Result::gpu_texture_format(gpu::TextureFormat::SFLOAT_32_32_32, precision_),
287 values);
288 GPU_texture_filter_mode(texture, interpolation != OCIO::INTERP_NEAREST);
289
290 textures_.add(sampler_name, texture);
291#if OCIO_VERSION_HEX >= 0x02050000
292 return textures_.size() - 1;
293#endif
294 }
295
296 /* This gets called before the finalize() method to construct the shader code. We just
297 * concatenate the code except for the declarations section. That's because the ShaderCreateInfo
298 * will add the declaration itself. */
299 void createShaderText(const char * /*parameter_declarations*/,
300#if OCIO_VERSION_HEX >= 0x02050000
301 const char * /*texture_declarations*/,
302#endif
303 const char *helper_methods,
304 const char *function_header,
305 const char *function_body,
306 const char *function_footer) override
307 {
308 shader_code_ += helper_methods;
309 shader_code_ += function_header;
310 shader_code_ += function_body;
311 shader_code_ += function_footer;
312 }
313
314 /* This gets called when all resources were added using the respective addUniform() or
315 * add[3D]Texture() methods and the shader code was generated using the createShaderText()
316 * method. That is, we are ready to complete the ShaderCreateInfo and create a shader from it. */
317 void finalize() override
318 {
319 GpuShaderCreator::finalize();
320
321 shader_create_info_.local_group_size(16, 16);
322 shader_create_info_.sampler(0, ImageType::Float2D, input_sampler_name());
323 shader_create_info_.builtins(BuiltinBits::GLOBAL_INVOCATION_ID);
324 shader_create_info_.push_constant(Type::bool_t, "premultiply_output");
325 shader_create_info_.image(0,
328 ImageReadWriteType::Float2D,
330 shader_create_info_.compute_source("gpu_shader_compositor_ocio_processor.glsl");
331 shader_create_info_.generated_sources.append(
332 {"gpu_shader_compositor_ocio_processor_lib.glsl",
333 {},
334 GPU_shader_preprocess_source(shader_code_, shader_create_info_)});
335
336 GPUShaderCreateInfo *info = reinterpret_cast<GPUShaderCreateInfo *>(&shader_create_info_);
337 shader_ = GPU_shader_create_from_info(info);
338 }
339
341 {
342 if (!shader_) {
343 return nullptr;
344 }
345
346 GPU_shader_bind(shader_);
347
348 for (auto item : float_uniforms_.items()) {
349 GPU_shader_uniform_1f(shader_, item.key.c_str(), item.value());
350 }
351
352 for (auto item : boolean_uniforms_.items()) {
353 GPU_shader_uniform_1b(shader_, item.key.c_str(), item.value());
354 }
355
356 for (auto item : vector_uniforms_.items()) {
357 GPU_shader_uniform_3fv(shader_, item.key.c_str(), item.value().data());
358 }
359
360 for (auto item : float_buffers_.items()) {
362 buffers_sizes_.lookup(item.key)(), item.value(), item.key.c_str());
363 const int ubo_location = GPU_shader_get_ubo_binding(shader_, item.key.c_str());
364 GPU_uniformbuf_bind(buffer, ubo_location);
365 uniform_buffers_.append(buffer);
366 }
367
368 for (auto item : int_buffers_.items()) {
370 buffers_sizes_.lookup(item.key)(), item.value(), item.key.c_str());
371 const int ubo_location = GPU_shader_get_ubo_binding(shader_, item.key.c_str());
372 GPU_uniformbuf_bind(buffer, ubo_location);
373 uniform_buffers_.append(buffer);
374 }
375
376 for (auto item : textures_.items()) {
377 const int texture_image_unit = GPU_shader_get_sampler_binding(shader_, item.key.c_str());
378 GPU_texture_bind(item.value, texture_image_unit);
379 }
380
381 return shader_;
382 }
383
385 {
386 for (gpu::UniformBuf *buffer : uniform_buffers_) {
387 GPU_uniformbuf_unbind(buffer);
388 GPU_uniformbuf_free(buffer);
389 }
390
391 for (gpu::Texture *texture : textures_.values()) {
393 }
394
396 }
397
398 const char *input_sampler_name()
399 {
400 return "input_tx";
401 }
402
403 const char *output_image_name()
404 {
405 return "output_img";
406 }
407
409 {
410 for (gpu::Texture *texture : textures_.values()) {
412 }
413
414 GPU_shader_free(shader_);
415 }
416
417 private:
418 /* The processor shader and the ShaderCreateInfo used to construct it. Constructed and
419 * initialized in the finalize() method. */
420 gpu::Shader *shader_ = nullptr;
421 ShaderCreateInfo shader_create_info_ = ShaderCreateInfo("OCIO_Processor");
422
423 /* Stores the generated OCIOMain function as well as a number of helper functions. Initialized in
424 * the createShaderText() method. */
425 std::string shader_code_;
426
427 /* Maps that associates the name of a uniform with a getter function that returns its value.
428 * Initialized in the respective addUniform() methods. */
429 Map<std::string, DoubleGetter> float_uniforms_;
430 Map<std::string, BoolGetter> boolean_uniforms_;
431 Map<std::string, Float3Getter> vector_uniforms_;
432
433 /* Maps that associates the name of uniform buffer objects with a getter function that returns
434 * its values. Initialized in the respective addUniform() methods. */
437
438 /* A map that associates the name of uniform buffer objects with a getter functions that returns
439 * its number of elements. Initialized in the respective addUniform() methods. */
440 Map<std::string, SizeGetter> buffers_sizes_;
441
442 /* A map that associates the name of a sampler with its corresponding texture. Initialized in the
443 * addTexture() and add3DTexture() methods. */
445
446 /* A vector set that stores the names of all the resources used by the shader. This is used to:
447 * 1. Check for name collisions when adding new resources.
448 * 2. Store the resource names throughout the construction of the shader since the
449 * ShaderCreateInfo class only stores references to resources names. */
451
452 /* A vectors that stores the created uniform buffers when bind_shader_and_resources() is called,
453 * so that they can be properly unbound and freed in the unbind_shader_and_resources() method. */
454 Vector<gpu::UniformBuf *> uniform_buffers_;
455
456#if OCIO_VERSION_HEX >= 0x02030000
457 /* Allow creating 1D textures, or only use 2D textures. */
458 bool allow_texture_1D_ = true;
459#endif
460
461 /* The precision of the OCIO resources as well as the output image. */
462 ResultPrecision precision_;
463};
464
465/* ------------------------------------------------------------------------------------------------
466 * OCIO Color Space Conversion Shader Key.
467 */
468
474
479
482{
483 return a.source == b.source && a.target == b.target && a.config_cache_id == b.config_cache_id;
484}
485
486/* --------------------------------------------------------------------
487 * OCIO Color Space Conversion Shader.
488 */
489
491 std::string source,
492 std::string target)
493{
494 /* Create a GPU shader creator and construct it based on the transforms in the default GPU
495 * processor. */
496 shader_creator_ = GPUShaderCreator::Create(context.get_precision());
497
498 /* Get a GPU processor that transforms the source color space to the target color space. */
499 try {
500 OCIO::ConstConfigRcPtr config = OCIO::GetCurrentConfig();
501 OCIO::ConstProcessorRcPtr processor = config->getProcessor(source.c_str(), target.c_str());
502 OCIO::ConstGPUProcessorRcPtr gpu_processor = processor->getDefaultGPUProcessor();
503
504 auto ocio_shader_creator = std::static_pointer_cast<OCIO::GpuShaderCreator>(shader_creator_);
505 gpu_processor->extractGpuShaderInfo(ocio_shader_creator);
506 }
507 catch (const OCIO::Exception &e) {
508 CLOG_ERROR(&LOG, "Failed to create OpenColorIO shader: %s", e.what());
509 }
510}
511
513{
514 return shader_creator_->bind_shader_and_resources();
515}
516
518{
519 shader_creator_->unbind_shader_and_resources();
520}
521
523{
524 return shader_creator_->input_sampler_name();
525}
526
528{
529 return shader_creator_->output_image_name();
530}
531
532/* --------------------------------------------------------------------
533 * OCIO Color Space Conversion Shader Container.
534 */
535
537{
538 /* First, delete all resources that are no longer needed. */
539 map_.remove_if([](auto item) { return !item.value->needed; });
540
541 /* Second, reset the needed status of the remaining resources to false to ready them to track
542 * their needed status for the next evaluation. */
543 for (auto &value : map_.values()) {
544 value->needed = false;
545 }
546}
547
549 std::string source,
550 std::string target)
551{
552 /* Use the config cache ID in the cache key in case the configuration changed at runtime. */
553 std::string config_cache_id = OCIO::GetCurrentConfig()->getCacheID();
554
555 const OCIOColorSpaceConversionShaderKey key(source, target, config_cache_id);
556
557 OCIOColorSpaceConversionShader &shader = *map_.lookup_or_add_cb(key, [&]() {
558 return std::make_unique<OCIOColorSpaceConversionShader>(context, source, target);
559 });
560
561 shader.needed = true;
562 return shader;
563}
564
565/* ------------------------------------------------------------------------------------------------
566 * OCIO To Display Shader Key.
567 */
568
570 const ColorManagedViewSettings &view_settings,
571 const bool inverse,
572 const std::string &config_cache_id)
573 : display_device(display_settings.display_device),
574 view_transform(view_settings.view_transform),
575 look(view_settings.look),
578{
579}
580
587
589{
590 return a.display_device == b.display_device && a.view_transform == b.view_transform &&
591 a.look == b.look && a.inverse == b.inverse && a.config_cache_id == b.config_cache_id;
592}
593
594/* --------------------------------------------------------------------
595 * OCIO To Display Shader.
596 */
597
599 const ColorManagedDisplaySettings &display_settings,
600 const ColorManagedViewSettings &view_settings,
601 const bool inverse)
602{
603 /* Create a GPU shader creator and construct it based on the transforms in the default GPU
604 * processor. */
605 shader_creator_ = GPUShaderCreator::Create(context.get_precision());
606
607 /* Get a GPU processor that transforms the display_device color space to the view_transform color
608 * space. */
609 try {
610 OCIO::ConstConfigRcPtr config = OCIO::GetCurrentConfig();
611
612 OCIO::TransformRcPtr group = ocio::create_ocio_display_transform(
613 config,
614 display_settings.display_device,
615 view_settings.view_transform,
616 view_settings.look,
617 "scene_linear");
618
619 if (inverse) {
620 group->setDirection(OCIO::TRANSFORM_DIR_INVERSE);
621 }
622
623 OCIO::ConstProcessorRcPtr processor = config->getProcessor(group);
624 OCIO::ConstGPUProcessorRcPtr gpu_processor = processor->getDefaultGPUProcessor();
625
626 auto ocio_shader_creator = std::static_pointer_cast<OCIO::GpuShaderCreator>(shader_creator_);
627 gpu_processor->extractGpuShaderInfo(ocio_shader_creator);
628 }
629 catch (const OCIO::Exception &e) {
630 CLOG_ERROR(&LOG, "Failed to create OpenColorIO shader: %s", e.what());
631 }
632}
633
635{
636 return shader_creator_->bind_shader_and_resources();
637}
638
640{
641 shader_creator_->unbind_shader_and_resources();
642}
643
645{
646 return shader_creator_->input_sampler_name();
647}
648
650{
651 return shader_creator_->output_image_name();
652}
653
654/* --------------------------------------------------------------------
655 * OCIO To Display Shader Container.
656 */
657
659{
660 /* First, delete all resources that are no longer needed. */
661 map_.remove_if([](auto item) { return !item.value->needed; });
662
663 /* Second, reset the needed status of the remaining resources to false to ready them to
664 * track their needed status for the next evaluation. */
665 for (auto &value : map_.values()) {
666 value->needed = false;
667 }
668}
669
671 Context &context,
672 const ColorManagedDisplaySettings &display_settings,
673 const ColorManagedViewSettings &view_settings,
674 const bool inverse)
675{
676 /* Use the config cache ID in the cache key in case the configuration changed at runtime. */
677 std::string config_cache_id = OCIO::GetCurrentConfig()->getCacheID();
678
679 const OCIOToDisplayShaderKey key(display_settings, view_settings, inverse, config_cache_id);
680
681 OCIOToDisplayShader &shader = *map_.lookup_or_add_cb(key, [&]() {
682 return std::make_unique<OCIOToDisplayShader>(
683 context, display_settings, view_settings, inverse);
684 });
685
686 shader.needed = true;
687 return shader;
688}
689
690} // namespace blender::compositor
#define CLOG_ERROR(clg_ref,...)
Definition CLG_log.h:188
#define BLI_assert_unreachable()
void add3DTexture(const char *texture_name, const char *sampler_name, uint size, OCIO::Interpolation interpolation, const float *values) override
bool addUniform(const char *name, const SizeGetter &get_size, const VectorFloatGetter &get_vector_float) override
bool addUniform(const char *name, const SizeGetter &get_size, const VectorIntGetter &get_vector_int) override
bool addUniform(const char *name, const Float3Getter &get_float3) override
OCIO::GpuShaderCreatorRcPtr clone() const override
bool addUniform(const char *name, const BoolGetter &get_bool) override
bool addUniform(const char *name, const DoubleGetter &get_double) override
void addTexture(const char *texture_name, const char *sampler_name, uint width, uint height, TextureType channel, OCIO::Interpolation interpolation, const float *values) override
void createShaderText(const char *, const char *helper_methods, const char *function_header, const char *function_body, const char *function_footer) override
static std::shared_ptr< GPUShaderCreator > Create(ResultPrecision precision)
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)
static gpu::TextureFormat gpu_texture_format(ResultType type, ResultPrecision precision)
Definition result.cc:84
MatBase< C, R > inverse(MatBase< C, R >) RET
TEX_TEMPLATE DataVec texture(T, FltCoord, float=0.0f) RET
bool operator==(const BokehKernelKey &a, const BokehKernelKey &b)
OCIO_NAMESPACE::TransformRcPtr create_ocio_display_transform(const OCIO_NAMESPACE::ConstConfigRcPtr &ocio_config, StringRefNull display, StringRefNull view, StringRefNull look, StringRefNull from_colorspace)
int GPU_shader_get_sampler_binding(gpu::Shader *shader, const char *name)
unsigned __int64 uint64_t
Definition BKE_text.h:91
gpu::Texture * GPU_texture_create_1d(const char *name, int width, int mip_len, gpu::TextureFormat format, eGPUTextureUsage usage, const float *data)
unsigned int uint
Definition BKE_text.h:55
void GPU_uniformbuf_free(gpu::UniformBuf *ubo)
std::string GPU_shader_preprocess_source(StringRefNull original, gpu::shader::ShaderCreateInfo &info)
gpu::Shader * GPU_shader_create_from_info(const GPUShaderCreateInfo *_info)
int GPU_max_texture_size()
void GPU_shader_uniform_1b(gpu::Shader *sh, const char *name, bool value)
@ GPU_TEXTURE_USAGE_SHADER_READ
void GPU_shader_unbind()
void GPU_shader_uniform_3fv(gpu::Shader *sh, const char *name, const float data[3])
void GPU_texture_filter_mode(gpu::Texture *texture, bool use_filter)
gpu::Texture * GPU_texture_create_3d(const char *name, int width, int height, int depth, int mip_len, gpu::TextureFormat format, eGPUTextureUsage usage, const void *data)
void GPU_shader_bind(gpu::Shader *shader, const gpu::shader::SpecializationConstants *constants_state=nullptr)
void GPU_uniformbuf_bind(gpu::UniformBuf *ubo, int slot)
gpu::UniformBuf * GPU_uniformbuf_create_ex(size_t size, const void *data, const char *name)
void GPU_shader_uniform_1f(gpu::Shader *sh, const char *name, float value)
void GPU_texture_bind(gpu::Texture *texture, int unit)
void GPU_texture_free(gpu::Texture *texture)
int GPU_shader_get_ubo_binding(gpu::Shader *shader, const char *name)
void GPU_texture_unbind(gpu::Texture *texture)
void GPU_shader_free(gpu::Shader *shader)
void GPU_uniformbuf_unbind(gpu::UniformBuf *ubo)
constexpr uint64_t get_default_hash(const T &v, const Args &...args)
Definition BLI_hash.hh:252
ATTR_WARN_UNUSED_RESULT const BMVert const BMEdge * e
gpu::Texture * GPU_texture_create_2d(const char *name, int width, int height, int mip_len, gpu::TextureFormat format, eGPUTextureUsage usage, const float *data)
Describe inputs & outputs, stage interfaces, resources and sources of a shader. If all data is correc...