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

#include <OCIO_gpu_shader_binder.hh>

Inherited by blender::ocio::FallbackGPUShaderBinder.

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 Configconfig_

Detailed Description

Definition at line 65 of file OCIO_gpu_shader_binder.hh.

Constructor & Destructor Documentation

◆ GPUShaderBinder()

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

Definition at line 375 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 597 of file gpu_shader_binder.cc.

◆ 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::FallbackGPUShaderBinder.

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::FallbackGPUShaderBinder.

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 457 of file gpu_shader_binder.cc.

References blender::ocio::internal::TextureSlot::CURVE_MAPPING, blender::ocio::internal::UniformBufferSlot::CURVE_MAPPING, blender::Vector< T, InlineBufferCapacity, Allocator >::data(), data, ShaderCreateInfo::define(), blender::ocio::internal::UniformBufferSlot::DISPLAY, float, blender::gpu::shader::float2_t, blender::gpu::shader::float4_t, blender::gpu::shader::float4x4_t, ShaderCreateInfo::fragment_out(), ShaderCreateInfo::fragment_source(), ShaderCreateInfo::fragment_source_generated, GPU_shader_create_from_info(), GPU_texture_dimensions(), 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::ocio::internal::GPUUniform::name, name, blender::ocio::internal::TextureSlot::OVERLAY, ShaderCreateInfo::push_constant(), ShaderCreateInfo::sampler(), blender::ocio::internal::GPUDisplayShader::shader, StageInterfaceInfo::smooth(), blender::StringRefBase::substr(), texture(), blender::ocio::internal::GPUDisplayShader::textures, ShaderCreateInfo::typedef_source(), ShaderCreateInfo::typedef_source_generated, ShaderCreateInfo::uniform_buf(), blender::ocio::internal::GPUTextures::uniforms, blender::ocio::internal::GPUTextures::uniforms_buffer, blender::ocio::internal::GPUDisplayShader::use_curve_mapping, ShaderCreateInfo::vertex_in(), ShaderCreateInfo::vertex_out(), and ShaderCreateInfo::vertex_source().

Referenced by blender::ocio::FallbackGPUShaderBinder::construct_display_shader(), and blender::ocio::FallbackGPUShaderBinder::construct_scene_linear_shader().

◆ display_bind()

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

◆ 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 423 of file gpu_shader_binder.cc.

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

◆ 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 452 of file gpu_shader_binder.cc.

References immUnbindProgram().

Member Data Documentation

◆ config_

const Config& blender::ocio::GPUShaderBinder::config_
protected

Definition at line 106 of file OCIO_gpu_shader_binder.hh.

Referenced by display_bind(), GPUShaderBinder(), and to_scene_linear_bind().


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