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

#include <gl_shader.hh>

Inherits blender::gpu::Shader.

Public Member Functions

void warm_cache (int) override
 
bool get_uses_ssbo_vertex_fetch () const override
 
int get_ssbo_vertex_fetch_output_num_verts () const override
 
bool is_compute () const
 
Creation / Destruction
 GLShader (const char *name)
 
 ~GLShader ()
 
void init (const shader::ShaderCreateInfo &info, bool is_batch_compilation) override
 
Create Info
std::string resources_declare (const shader::ShaderCreateInfo &info) const override
 
std::string constants_declare () 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
 
Transform feedback

TODO(fclem): Should be replaced by compute shaders.

void transform_feedback_names_set (Span< const char * > name_list, eGPUShaderTFBType geom_type) override
 
bool transform_feedback_enable (VertBuf *buf) override
 
void transform_feedback_disable () override
 
Binding
void bind () 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
 
GPUVertFormat from Shader
int program_handle_get () const override
 
- Public Member Functions inherited from blender::gpu::Shader
std::string defines_declare (const shader::ShaderCreateInfo &info) const
 
const char *const name_get () const
 
void parent_set (Shader *parent)
 
Shaderparent_get () const
 
 Shader (const char *name)
 
virtual ~Shader ()
 
void specialization_constants_init (const shader::ShaderCreateInfo &info)
 

Friends

class GLShaderCompiler
 

Specialization Constants

GLSourcesBaked get_sources ()
 

Shader stage creation

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

Additional Inherited Members

- Static Public Member Functions inherited from blender::gpu::Shader
static bool srgb_uniform_dirty_get ()
 
static void set_srgb_uniform (GPUShader *shader)
 
static void set_framebuffer_srgb_target (int use_srgb_to_linear)
 
- Public Attributes inherited from blender::gpu::Shader
ShaderInterfaceinterface = nullptr
 
struct blender::gpu::Shader::Constants constants
 
- Protected Member Functions inherited from blender::gpu::Shader
void print_log (Span< const char * > sources, const char *log, const char *stage, bool error, GPULogParser *parser)
 
- Protected Attributes inherited from blender::gpu::Shader
char name [64]
 
Shaderparent_shader_ = nullptr
 

Detailed Description

Implementation of shader compilation and uniforms handling using OpenGL.

Definition at line 67 of file gl_shader.hh.

Constructor & Destructor Documentation

◆ GLShader()

GLShader::GLShader ( const char * name)

Definition at line 50 of file gl_shader.cc.

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

◆ ~GLShader()

GLShader::~GLShader ( )

Definition at line 58 of file gl_shader.cc.

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

Member Function Documentation

◆ bind()

void GLShader::bind ( )
overridevirtual

Implements blender::gpu::Shader.

Definition at line 1288 of file gl_shader.cc.

◆ compute_layout_declare()

◆ compute_shader_from_glsl()

void GLShader::compute_shader_from_glsl ( MutableSpan< const char * > sources)
overridevirtual

Implements blender::gpu::Shader.

Definition at line 1232 of file gl_shader.cc.

◆ constants_declare()

◆ finalize()

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

◆ fragment_interface_declare()

◆ fragment_shader_from_glsl()

void GLShader::fragment_shader_from_glsl ( MutableSpan< const char * > sources)
overridevirtual

Implements blender::gpu::Shader.

Definition at line 1225 of file gl_shader.cc.

◆ geometry_interface_declare()

◆ geometry_layout_declare()

◆ geometry_shader_from_glsl()

void GLShader::geometry_shader_from_glsl ( MutableSpan< const char * > sources)
overridevirtual

Implements blender::gpu::Shader.

Definition at line 1218 of file gl_shader.cc.

Referenced by finalize().

◆ get_sources()

GLSourcesBaked GLShader::get_sources ( )

◆ get_ssbo_vertex_fetch_output_num_verts()

int blender::gpu::GLShader::get_ssbo_vertex_fetch_output_num_verts ( ) const
inlineoverridevirtual

Implements blender::gpu::Shader.

Definition at line 195 of file gl_shader.hh.

◆ get_uses_ssbo_vertex_fetch()

bool blender::gpu::GLShader::get_uses_ssbo_vertex_fetch ( ) const
inlineoverridevirtual

Implements blender::gpu::Shader.

Definition at line 191 of file gl_shader.hh.

◆ init()

void GLShader::init ( const shader::ShaderCreateInfo & info,
bool is_batch_compilation )
overridevirtual

◆ is_compute()

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

Definition at line 203 of file gl_shader.hh.

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

◆ post_finalize()

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

◆ program_handle_get()

int GLShader::program_handle_get ( ) const
overridevirtual

DEPRECATED: Kept only because of BGL API.

Implements blender::gpu::Shader.

Definition at line 1414 of file gl_shader.cc.

References BLI_assert.

◆ resources_declare()

◆ transform_feedback_disable()

void GLShader::transform_feedback_disable ( )
overridevirtual

Implements blender::gpu::Shader.

Definition at line 1349 of file gl_shader.cc.

◆ transform_feedback_enable()

bool GLShader::transform_feedback_enable ( VertBuf * buf)
overridevirtual

◆ transform_feedback_names_set()

void GLShader::transform_feedback_names_set ( Span< const char * > name_list,
eGPUShaderTFBType geom_type )
overridevirtual

Should be called before linking.

Implements blender::gpu::Shader.

Definition at line 1309 of file gl_shader.cc.

References blender::Span< T >::data(), and blender::Span< T >::size().

◆ unbind()

void GLShader::unbind ( )
overridevirtual

Implements blender::gpu::Shader.

Definition at line 1294 of file gl_shader.cc.

◆ uniform_float()

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

Implements blender::gpu::Shader.

Definition at line 1360 of file gl_shader.cc.

References BLI_assert.

◆ uniform_int()

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

Implements blender::gpu::Shader.

Definition at line 1387 of file gl_shader.cc.

References BLI_assert.

◆ vertex_interface_declare()

◆ vertex_shader_from_glsl()

void GLShader::vertex_shader_from_glsl ( MutableSpan< const char * > sources)
overridevirtual

Return true on success.

Implements blender::gpu::Shader.

Definition at line 1211 of file gl_shader.cc.

◆ warm_cache()

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

Implements blender::gpu::Shader.

Definition at line 168 of file gl_shader.hh.

Friends And Related Symbol Documentation

◆ GLShaderCompiler

friend class GLShaderCompiler
friend

Definition at line 70 of file gl_shader.hh.


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