Blender V5.3
blender::gpu::GLShader Class Reference

#include <gl_shader.hh>

Inherits blender::gpu::Shader.

Public Member Functions

const shader::ShaderCreateInfo & patch_create_info (const shader::ShaderCreateInfo &original_info) override
void warm_cache (int) override
bool is_compute () const
Creation / Destruction
 GLShader (const char *name)
 ~GLShader ()
void init (const shader::ShaderCreateInfo &info, bool is_codegen_only) override
Create Info
std::string resources_declare (const shader::ShaderCreateInfo &info) const override
std::string constants_declare (const shader::SpecializationConstants &constants_state) const
std::string vertex_interface_declare (const shader::ShaderCreateInfo &info) const override
std::string fragment_interface_declare (const shader::ShaderCreateInfo &info) const override
std::string geometry_interface_declare (const shader::ShaderCreateInfo &info) const override
std::string geometry_layout_declare (const shader::ShaderCreateInfo &info) const override
std::string compute_layout_declare (const shader::ShaderCreateInfo &info) const override
Binding
void bind (const shader::SpecializationConstants *constants_state) override
void unbind () override
Uniforms setters
void uniform_float (int location, int comp_len, int array_size, const float *data) override
void uniform_int (int location, int comp_len, int array_size, const int *data) override
Public Member Functions inherited from blender::gpu::Shader
StringRefNull name_get () const
void parent_set (Shader *parent)
Shader * parent_get () const
 Shader (const char *name)
virtual ~Shader ()
void specialization_constants_init (const shader::ShaderCreateInfo &info)

Friends

class GLSubprocessShaderCompiler
class GLShaderCompiler

Shader stage creation

void vertex_shader_from_glsl (const shader::ShaderCreateInfo &info, MutableSpan< StringRefNull > sources) override
void geometry_shader_from_glsl (const shader::ShaderCreateInfo &info, MutableSpan< StringRefNull > sources) override
void fragment_shader_from_glsl (const shader::ShaderCreateInfo &info, MutableSpan< StringRefNull > sources) override
void compute_shader_from_glsl (const shader::ShaderCreateInfo &info, MutableSpan< StringRefNull > sources) override
bool finalize (const shader::ShaderCreateInfo *info=nullptr) override
bool post_finalize (const shader::ShaderCreateInfo *info=nullptr)

Specialization Constants

GLSourcesBaked get_sources ()

Additional Inherited Members

Static Public Member Functions inherited from blender::gpu::Shader
static std::string defines_declare (const shader::ShaderCreateInfo &info)
static void dump_source_to_disk (StringRef shader_name, StringRef shader_name_with_stage_name, StringRef extension, StringRef source)
static void set_scene_linear_to_xyz_uniform (gpu::Shader *shader)
static void set_srgb_uniform (Context *ctx, gpu::Shader *shader)
static void set_framebuffer_srgb_target (int use_srgb_to_linear)
static std::string run_preprocessor (StringRef source, bool no_dead_code_elimination)
Public Attributes inherited from blender::gpu::Shader
ShaderInterface * interface = nullptr
uint16_t fragment_output_bits = 0
std::unique_ptr< const shader::SpecializationConstants > constants
bool is_polyline = false
bool skip_preprocessor = false
Protected Member Functions inherited from blender::gpu::Shader
void print_log (Span< StringRefNull > sources, const char *log, const char *stage, bool error, GPULogParser *parser)
Protected Attributes inherited from blender::gpu::Shader
char name [64]
Shader * parent_shader_ = nullptr
std::unique_ptr< PatchedShaderCreateInfo > patched_info_

Detailed Description

Implementation of shader compilation and uniforms handling using OpenGL.

Definition at line 69 of file gl_shader.hh.

Constructor & Destructor Documentation

◆ GLShader()

blender::GLShader::GLShader ( const char * name)

◆ ~GLShader()

blender::GLShader::~GLShader ( )

Definition at line 72 of file gl_shader.cc.

References blender::BLI_assert(), and blender::gpu::GLContext::get().

Member Function Documentation

◆ bind()

void blender::GLShader::bind ( const shader::SpecializationConstants * constants_state)
overridevirtual

Implements blender::gpu::Shader.

Definition at line 1410 of file gl_shader.cc.

◆ compute_layout_declare()

◆ compute_shader_from_glsl()

void blender::GLShader::compute_shader_from_glsl ( const shader::ShaderCreateInfo & info,
MutableSpan< StringRefNull > sources )
overridevirtual

Implements blender::gpu::Shader.

Definition at line 1347 of file gl_shader.cc.

References blender::gpu::Shader::constants.

◆ constants_declare()

◆ finalize()

bool blender::GLShader::finalize ( const shader::ShaderCreateInfo * info = nullptr)
overridevirtual

◆ fragment_interface_declare()

◆ fragment_shader_from_glsl()

void blender::GLShader::fragment_shader_from_glsl ( const shader::ShaderCreateInfo & info,
MutableSpan< StringRefNull > sources )
overridevirtual

Implements blender::gpu::Shader.

Definition at line 1339 of file gl_shader.cc.

References blender::gpu::Shader::constants.

◆ geometry_interface_declare()

◆ geometry_layout_declare()

◆ geometry_shader_from_glsl()

void blender::GLShader::geometry_shader_from_glsl ( const shader::ShaderCreateInfo & info,
MutableSpan< StringRefNull > sources )
overridevirtual

Implements blender::gpu::Shader.

Definition at line 1331 of file gl_shader.cc.

References blender::gpu::Shader::constants.

Referenced by finalize().

◆ get_sources()

GLSourcesBaked blender::GLShader::get_sources ( )

Definition at line 1658 of file gl_shader.cc.

References blender::result.

◆ init()

◆ is_compute()

bool blender::gpu::GLShader::is_compute ( ) const
inline

Definition at line 170 of file gl_shader.hh.

Referenced by blender::gpu::GLTexture::check_feedback_loop().

◆ patch_create_info()

const shader::ShaderCreateInfo & blender::gpu::GLShader::patch_create_info ( const shader::ShaderCreateInfo & original_info)
inlineoverridevirtual

Implements blender::gpu::Shader.

Definition at line 137 of file gl_shader.hh.

◆ post_finalize()

bool blender::GLShader::post_finalize ( const shader::ShaderCreateInfo * info = nullptr)

Definition at line 1378 of file gl_shader.cc.

References log, and blender::gpu::Shader::print_log().

Referenced by finalize().

◆ resources_declare()

◆ unbind()

void blender::GLShader::unbind ( )
overridevirtual

Implements blender::gpu::Shader.

Definition at line 1416 of file gl_shader.cc.

◆ uniform_float()

void blender::GLShader::uniform_float ( int location,
int comp_len,
int array_size,
const float * data )
overridevirtual

Implements blender::gpu::Shader.

Definition at line 1429 of file gl_shader.cc.

References blender::BLI_assert(), and blender::data.

◆ uniform_int()

void blender::GLShader::uniform_int ( int location,
int comp_len,
int array_size,
const int * data )
overridevirtual

Implements blender::gpu::Shader.

Definition at line 1456 of file gl_shader.cc.

References blender::BLI_assert(), and blender::data.

◆ vertex_interface_declare()

◆ vertex_shader_from_glsl()

void blender::GLShader::vertex_shader_from_glsl ( const shader::ShaderCreateInfo & info,
MutableSpan< StringRefNull > sources )
overridevirtual

Return true on success.

Implements blender::gpu::Shader.

Definition at line 1323 of file gl_shader.cc.

References blender::gpu::Shader::constants.

◆ warm_cache()

void blender::gpu::GLShader::warm_cache ( int )
inlineoverridevirtual

Implements blender::gpu::Shader.

Definition at line 154 of file gl_shader.hh.

◆ GLShaderCompiler

friend class GLShaderCompiler
friend

Definition at line 73 of file gl_shader.hh.

References GLShaderCompiler.

Referenced by GLShaderCompiler.

◆ GLSubprocessShaderCompiler

friend class GLSubprocessShaderCompiler
friend

Definition at line 72 of file gl_shader.hh.

References GLSubprocessShaderCompiler.

Referenced by GLSubprocessShaderCompiler.


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