Blender V5.3
blender::ocio::GPUShaderBinder Class Referenceabstract

#include <OCIO_gpu_shader_binder.hh>

Inherited by blender::ocio::LibOCIOGPUShaderBinder.

Public Member Functions

 GPUShaderBinder (const Config &config)
virtual ~GPUShaderBinder ()
bool display_bind (const GPUDisplayParameters &display_parameters) const
bool to_scene_linear_bind (StringRefNull from_colorspace, bool use_predivide) const
void unbind () const
void clear_caches () const

Protected Member Functions

virtual void construct_display_shader (internal::GPUDisplayShader &display_shader) const =0
virtual void construct_scene_linear_shader (internal::GPUDisplayShader &display_shader) const =0

Static Protected Member Functions

static bool create_gpu_shader (internal::GPUDisplayShader &display_shader, StringRefNull fragment_source, Span< std::array< StringRefNull, 2 > > additional_defines)

Protected Attributes

const Config & config_

Detailed Description

Definition at line 71 of file OCIO_gpu_shader_binder.hh.

Constructor & Destructor Documentation

◆ GPUShaderBinder()

blender::ocio::GPUShaderBinder::GPUShaderBinder ( const Config & config)
explicit

Definition at line 396 of file gpu_shader_binder.cc.

References config_.

◆ ~GPUShaderBinder()

blender::ocio::GPUShaderBinder::~GPUShaderBinder ( )
virtualdefault

Member Function Documentation

◆ clear_caches()

void blender::ocio::GPUShaderBinder::clear_caches ( ) const

Clear caches when configuration changes.

Definition at line 620 of file gpu_shader_binder.cc.

Referenced by ~GPUShaderBinder().

◆ construct_display_shader()

virtual void blender::ocio::GPUShaderBinder::construct_display_shader ( internal::GPUDisplayShader & display_shader) const
protectedpure virtual

Construct display shader matching requested parameters. The shader has its cache variables (input color space name, view, display, look, whether curve mapping is used or not).

Implemented in blender::ocio::LibOCIOGPUShaderBinder.

Referenced by display_bind().

◆ construct_scene_linear_shader()

virtual void blender::ocio::GPUShaderBinder::construct_scene_linear_shader ( internal::GPUDisplayShader & display_shader) const
protectedpure virtual

Construct display shader which will only perform the to-scene-linear part of conversion, leaving the to-display a no-op function.

Implemented in blender::ocio::LibOCIOGPUShaderBinder.

References create_gpu_shader().

Referenced by to_scene_linear_bind().

◆ create_gpu_shader()

bool blender::ocio::GPUShaderBinder::create_gpu_shader ( internal::GPUDisplayShader & display_shader,
StringRefNull fragment_source,
Span< std::array< StringRefNull, 2 > > additional_defines )
staticprotected

Create GPU shader for the given display shader. Returns true if the shader was successfully created.

Definition at line 479 of file gpu_shader_binder.cc.

References blender::gpu::shader::ShaderCreateInfo::builtins(), blender::ocio::internal::TextureSlot::CURVE_MAPPING, blender::ocio::internal::UniformBufferSlot::CURVE_MAPPING, blender::data, blender::Vector< T, InlineBufferCapacity, Allocator >::data(), blender::gpu::shader::ShaderCreateInfo::define(), blender::ocio::internal::UniformBufferSlot::DISPLAY, float, blender::gpu::shader::float2_t, blender::gpu::shader::float4_t, blender::gpu::shader::float4x4_t, blender::gpu::shader::ShaderCreateInfo::fragment_out(), blender::gpu::shader::ShaderCreateInfo::fragment_source(), blender::gpu::shader::ShaderCreateInfo::generated_sources, blender::GPU_backend_get_type(), blender::GPU_BACKEND_METAL, blender::GPU_shader_create_from_info(), blender::GPU_texture_dimensions(), blender::GPU_uniformbuf_create_ex(), blender::ocio::internal::TextureSlot::IMAGE, blender::ocio::internal::UniformBufferSlot::LUTS, blender::ocio::internal::GPUTextures::luts, blender::ocio::internal::TextureSlot::LUTS_OFFSET, blender::gpu::shader::NO_BUFFER_TYPE_LINTING, blender::ocio::internal::TextureSlot::OVERLAY, blender::gpu::shader::ShaderCreateInfo::push_constant(), blender::gpu::shader::ShaderCreateInfo::sampler(), blender::ocio::internal::GPUDisplayShader::shader, blender::gpu::shader::StageInterfaceInfo::smooth(), blender::StringRefNull::StringRefNull(), blender::blender::StringRefBase::substr(), texture(), blender::ocio::internal::GPUDisplayShader::textures, blender::gpu::shader::ShaderCreateInfo::typedef_source(), blender::gpu::shader::ShaderCreateInfo::typedef_source_generated, uniform, blender::gpu::shader::ShaderCreateInfo::uniform_buf(), blender::ocio::internal::GPUTextures::uniforms, blender::ocio::internal::GPUTextures::uniforms_buffer, blender::ocio::internal::GPUDisplayShader::use_curve_mapping, blender::gpu::shader::ShaderCreateInfo::vertex_in(), blender::gpu::shader::ShaderCreateInfo::vertex_out(), and blender::gpu::shader::ShaderCreateInfo::vertex_source().

Referenced by construct_scene_linear_shader().

◆ display_bind()

bool blender::ocio::GPUShaderBinder::display_bind ( const GPUDisplayParameters & display_parameters) const

Bind GPU shader which performs conversion from the given color space to the display space. Drawing happens in the same immediate mode as when GPU_SHADER_3D_IMAGE_COLOR shader is used.

Returns true if the GPU shader was successfully bound.

Definition at line 407 of file gpu_shader_binder.cc.

References blender::BLI_assert(), config_, construct_display_shader(), blender::ocio::GPUDisplayParameters::curve_mapping, blender::ocio::internal::GPUDisplayShader::curve_mapping, blender::ocio::GPUDisplayParameters::display, blender::ocio::internal::GPUDisplayShader::display, blender::ocio::GPUDisplayParameters::from_colorspace, blender::ocio::internal::GPUDisplayShader::from_colorspace, blender::ocio::internal::GPUDisplayShader::initialize_common(), blender::ocio::internal::GPUDisplayShader::is_valid, blender::ocio::GPUDisplayParameters::look, blender::ocio::internal::GPUDisplayShader::look, blender::ocio::internal::GPUCurveMappping::rasterize(), blender::ocio::internal::GPUDisplayShader::use_curve_mapping, blender::ocio::GPUDisplayParameters::use_display_emulation, blender::ocio::internal::GPUDisplayShader::use_display_emulation, blender::ocio::GPUDisplayParameters::use_hdr_buffer, blender::ocio::internal::GPUDisplayShader::use_hdr_buffer, blender::ocio::GPUDisplayParameters::use_hdr_display, blender::ocio::internal::GPUDisplayShader::use_hdr_display, blender::ocio::GPUDisplayParameters::use_scope_space, blender::ocio::internal::GPUDisplayShader::use_scope_space, blender::ocio::GPUDisplayParameters::view, and blender::ocio::internal::GPUDisplayShader::view.

Referenced by ~GPUShaderBinder().

◆ to_scene_linear_bind()

bool blender::ocio::GPUShaderBinder::to_scene_linear_bind ( StringRefNull from_colorspace,
bool use_predivide ) const

Configures and bind GPU shader for conversion from the given space to scene linear. Drawing happens in the same immediate mode as when GPU_SHADER_3D_IMAGE_COLOR shader is used.

Returns true if the GPU shader was successfully bound.

Definition at line 445 of file gpu_shader_binder.cc.

References blender::BLI_assert(), config_, construct_scene_linear_shader(), blender::ocio::GPUDisplayParameters::from_colorspace, and blender::ocio::GPUDisplayParameters::use_predivide.

Referenced by ~GPUShaderBinder().

◆ unbind()

void blender::ocio::GPUShaderBinder::unbind ( ) const

Unbind previously bound GPU shader.

If the shader was not bound by neither display_bind() nor to_scene_linear_bind() the behavior is undefined.

Definition at line 474 of file gpu_shader_binder.cc.

References blender::immUnbindProgram().

Referenced by ~GPUShaderBinder().

Member Data Documentation

◆ config_


The documentation for this class was generated from the following files: