Blender V5.3
builtin::ColorSpace Struct Reference

#include <gpu_shader_colorspace.bsl.hh>

Public Member Functions

float4 rec709_srgb_to_output_space (float4 srgb_color) const

Static Public Member Functions

static float4 scene_linear_to_rec709_srgb (float3x3 scene_linear_to_rec709, float4 scene_linear_color)

Public Attributes

const bool srgbTarget

Detailed Description

Definition at line 11 of file gpu_shader_colorspace.bsl.hh.

Member Function Documentation

◆ rec709_srgb_to_output_space()

float4 builtin::ColorSpace::rec709_srgb_to_output_space ( float4 srgb_color) const
inline

Input is Rec.709 sRGB. Output is Rec.709 linear if hardware will add a Linear to sRGB conversion, NOOP otherwise.

As per GPU API design, all frame-buffers with SRGBA_8_8_8_8 attachments will always enable SRGB rendering. In this mode the shader output is expected to be in a linear color space. This allows to do the blending stage with linear values (more correct) and then store the result in 8bpc keeping accurate colors.

To ensure consistent result (blending excluded) between a frame-buffer using SRGBA_8_8_8_8 and one using RGBA_8_8_8_8, we need to do the sRGB > linear conversion to counteract the hardware encoding during frame-buffer output.

For reference: https://wikis.khronos.org/opengl/framebuffer#Colorspace

IMPORTANT: srgbTarget denote that the output is expected to be in linear space. https://wikis.khronos.org/opengl/framebuffer#Colorspace

Definition at line 29 of file gpu_shader_colorspace.bsl.hh.

References max, mix, pow, srgbTarget, and step.

◆ scene_linear_to_rec709_srgb()

float4 builtin::ColorSpace::scene_linear_to_rec709_srgb ( float3x3 scene_linear_to_rec709,
float4 scene_linear_color )
inlinestatic

Definition at line 50 of file gpu_shader_colorspace.bsl.hh.

References max, mix, pow, and step.

Referenced by builtin::image::image_frag(), and builtin::image::image_overlay_merge_frag().

Member Data Documentation

◆ srgbTarget

const bool builtin::ColorSpace::srgbTarget

Definition at line 12 of file gpu_shader_colorspace.bsl.hh.

Referenced by rec709_srgb_to_output_space().


The documentation for this struct was generated from the following file: