|
Blender V5.0
|
#include <gpu_shader_private.hh>
Inherited by blender::gpu::GLShader, blender::gpu::MTLShader, and blender::gpu::VKShader.
Public Member Functions | |
| virtual void | init (const shader::ShaderCreateInfo &info, bool is_batch_compilation)=0 |
| virtual void | vertex_shader_from_glsl (MutableSpan< StringRefNull > sources)=0 |
| virtual void | geometry_shader_from_glsl (MutableSpan< StringRefNull > sources)=0 |
| virtual void | fragment_shader_from_glsl (MutableSpan< StringRefNull > sources)=0 |
| virtual void | compute_shader_from_glsl (MutableSpan< StringRefNull > sources)=0 |
| virtual bool | finalize (const shader::ShaderCreateInfo *info=nullptr)=0 |
| virtual void | warm_cache (int limit)=0 |
| virtual void | bind (const shader::SpecializationConstants *constants_state)=0 |
| virtual void | unbind ()=0 |
| virtual void | uniform_float (int location, int comp_len, int array_size, const float *data)=0 |
| virtual void | uniform_int (int location, int comp_len, int array_size, const int *data)=0 |
| std::string | defines_declare (const shader::ShaderCreateInfo &info) const |
| virtual std::string | resources_declare (const shader::ShaderCreateInfo &info) const =0 |
| virtual std::string | vertex_interface_declare (const shader::ShaderCreateInfo &info) const =0 |
| virtual std::string | fragment_interface_declare (const shader::ShaderCreateInfo &info) const =0 |
| virtual std::string | geometry_interface_declare (const shader::ShaderCreateInfo &info) const =0 |
| virtual std::string | geometry_layout_declare (const shader::ShaderCreateInfo &info) const =0 |
| virtual std::string | compute_layout_declare (const shader::ShaderCreateInfo &info) const =0 |
| StringRefNull | name_get () const |
| void | parent_set (Shader *parent) |
| Shader * | parent_get () const |
Creation / Destruction | |
| Shader (const char *name) | |
| virtual | ~Shader () |
Assign specialization constants. | |
| void | specialization_constants_init (const shader::ShaderCreateInfo &info) |
Static Public Member Functions | |
sRGB Rendering Workaround | |
The viewport overlay frame-buffer is sRGB and will expect shaders to output display referred Linear colors. But other frame-buffers (i.e: the area frame-buffers) are not sRGB and require the shader output color to be in sRGB space (assumed display encoded color-space as the time of writing). For this reason we have a uniform to switch the transform on and off depending on the current frame-buffer color-space. | |
| 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) |
Public Attributes | |
| ShaderInterface * | interface = nullptr |
| uint16_t | fragment_output_bits = 0 |
| std::unique_ptr< const shader::SpecializationConstants > | constants |
| bool | is_polyline = false |
Protected Member Functions | |
Debug functions | |
| void | print_log (Span< StringRefNull > sources, const char *log, const char *stage, bool error, GPULogParser *parser) |
Protected Attributes | |
| char | name [64] |
| Shader * | parent_shader_ = nullptr |
Implementation of shader compilation and uniforms handling. Base class which is then specialized for each implementation (GL, VK, ...).
Definition at line 43 of file gpu_shader_private.hh.
| Shader::Shader | ( | const char * | name | ) |
Definition at line 57 of file gpu_shader.cc.
References name, and STRNCPY().
Referenced by blender::gpu::GLShader::GLShader(), blender::gpu::MTLShader::MTLShader(), parent_get(), parent_set(), and blender::gpu::VKShader::VKShader().
|
virtual |
Definition at line 62 of file gpu_shader.cc.
References BLI_assert_msg, blender::gpu::Context::get(), interface, and ~Shader().
Referenced by ~Shader().
|
pure virtual |
Implemented in blender::gpu::GLShader, blender::gpu::MTLShader, and blender::gpu::VKShader.
|
pure virtual |
Implemented in blender::gpu::GLShader, blender::gpu::MTLShader, and blender::gpu::VKShader.
|
pure virtual |
Implemented in blender::gpu::GLShader, blender::gpu::MTLShader, and blender::gpu::VKShader.
| std::string Shader::defines_declare | ( | const shader::ShaderCreateInfo & | info | ) | const |
Definition at line 35 of file gpu_shader.cc.
References blender::gpu::shader::ShaderCreateInfo::defines_.
|
pure virtual |
Implemented in blender::gpu::GLShader, blender::gpu::MTLShader, and blender::gpu::VKShader.
|
pure virtual |
Implemented in blender::gpu::GLShader, blender::gpu::MTLShader, and blender::gpu::VKShader.
|
pure virtual |
Implemented in blender::gpu::GLShader, blender::gpu::MTLShader, and blender::gpu::VKShader.
|
pure virtual |
Implemented in blender::gpu::GLShader, blender::gpu::MTLShader, and blender::gpu::VKShader.
|
pure virtual |
Implemented in blender::gpu::GLShader, blender::gpu::MTLShader, and blender::gpu::VKShader.
|
pure virtual |
Implemented in blender::gpu::GLShader, blender::gpu::MTLShader, and blender::gpu::VKShader.
|
pure virtual |
Implemented in blender::gpu::GLShader, blender::gpu::MTLShader, and blender::gpu::VKShader.
Referenced by blender::eevee::Film::sync().
|
inline |
Definition at line 103 of file gpu_shader_private.hh.
References name.
Referenced by blender::gpu::Context::assert_framebuffer_shader_compatibility(), blender::gpu::MTLShader::bind(), blender::gpu::debug::check_gl_resources(), blender::gpu::MTLImmediate::end(), blender::gpu::VKShader::ensure_and_get_compute_pipeline(), blender::gpu::VKShader::ensure_and_get_graphics_pipeline(), blender::gpu::MTLShader::finalize(), blender::gpu::MTLShader::uniform_float(), and blender::gpu::MTLShader::uniform_int().
|
inline |
Definition at line 113 of file gpu_shader_private.hh.
References parent_shader_, and Shader().
|
inline |
Definition at line 108 of file gpu_shader_private.hh.
References parent_shader_, and Shader().
Referenced by GPU_shader_set_parent().
|
protected |
Definition at line 40 of file gpu_shader_log.cc.
References blender::Vector< T, InlineBufferCapacity, Allocator >::append(), BLI_dynstr_append(), BLI_dynstr_appendf(), BLI_dynstr_free(), BLI_dynstr_get_cstring(), BLI_dynstr_nappend(), BLI_dynstr_new(), blender::StringRefNull::c_str(), CLG_color_support_get(), CLG_LEVEL_ERROR, CLG_LEVEL_WARN, CLG_log_raw(), CLOG_AT_LEVEL, CLOG_CHECK, blender::gpu::LogCursor::column, blender::StringRefBase::copy_utf8_truncated(), blender::gpu::GPULogItem::cursor, DEBUG_CONTEXT_LINES, DEBUG_LOG_SHADER_SRC_ON_ERROR, ELEM, blender::StringRefBase::endswith(), blender::gpu::Error, error(), blender::gpu::LogCursor::file_name_and_error_line, blender::gpu::shader::gpu_shader_dependency_get_filename_from_source_string(), i, blender::Vector< T, InlineBufferCapacity, Allocator >::index_range(), blender::StringRefBase::is_empty(), blender::Vector< T, InlineBufferCapacity, Allocator >::is_empty(), blender::Vector< T, InlineBufferCapacity, Allocator >::last(), blender::gpu::LOG, log, MEM_freeN(), name, blender::gpu::Note, blender::gpu::GPULogParser::parse_line(), blender::gpu::LogCursor::row, blender::gpu::GPULogItem::severity, blender::Span< T >::size(), blender::gpu::LogCursor::source, blender::StringRefBase::substr(), and blender::gpu::Warning.
Referenced by blender::gpu::MTLShader::bake_pipeline_state(), blender::gpu::MTLShader::finalize(), and blender::gpu::GLShader::post_finalize().
|
pure virtual |
Implemented in blender::gpu::GLShader, blender::gpu::MTLShader, and blender::gpu::VKShader.
|
static |
Definition at line 650 of file gpu_shader.cc.
References blender::gpu::Context::get(), set_framebuffer_srgb_target(), blender::gpu::Context::shader_builtin_srgb_is_dirty, and blender::gpu::Context::shader_builtin_srgb_transform.
Referenced by blender::gpu::GLFrameBuffer::bind(), blender::gpu::MTLFrameBuffer::bind(), blender::gpu::VKFrameBuffer::bind(), and set_framebuffer_srgb_target().
|
static |
Definition at line 641 of file gpu_shader.cc.
References GPU_shader_get_builtin_uniform(), GPU_shader_uniform_float_ex(), GPU_UNIFORM_SCENE_LINEAR_XFORM, ptr, blender::colorspace::scene_linear_to_rec709, and set_scene_linear_to_xyz_uniform().
Referenced by GPU_shader_bind(), and set_scene_linear_to_xyz_uniform().
|
static |
Definition at line 632 of file gpu_shader.cc.
References GPU_shader_get_builtin_uniform(), GPU_shader_uniform_int_ex(), GPU_UNIFORM_SRGB_TRANSFORM, set_srgb_uniform(), blender::gpu::Context::shader_builtin_srgb_is_dirty, and blender::gpu::Context::shader_builtin_srgb_transform.
Referenced by GPU_shader_bind(), and set_srgb_uniform().
| void Shader::specialization_constants_init | ( | const shader::ShaderCreateInfo & | info | ) |
Definition at line 359 of file gpu_shader.cc.
References Vector< T, InlineBufferCapacity, Allocator >::append(), constants, blender::gpu::shader::ShaderCreateInfo::specialization_constants_, specialization_constants_init(), blender::gpu::shader::SpecializationConstant::type, blender::gpu::shader::SpecializationConstants::types, blender::gpu::shader::SpecializationConstant::value, and blender::gpu::shader::SpecializationConstants::values.
Referenced by specialization_constants_init().
|
pure virtual |
Implemented in blender::gpu::GLShader, blender::gpu::MTLShader, and blender::gpu::VKShader.
Referenced by GPU_shader_unbind().
|
pure virtual |
Implemented in blender::gpu::GLShader, blender::gpu::MTLShader, and blender::gpu::VKShader.
References data.
|
pure virtual |
Implemented in blender::gpu::GLShader, blender::gpu::MTLShader, and blender::gpu::VKShader.
References data.
|
pure virtual |
Implemented in blender::gpu::GLShader, blender::gpu::MTLShader, and blender::gpu::VKShader.
|
pure virtual |
Implemented in blender::gpu::GLShader, blender::gpu::MTLShader, and blender::gpu::VKShader.
|
pure virtual |
Implemented in blender::gpu::GLShader, blender::gpu::MTLShader, and blender::gpu::VKShader.
| std::unique_ptr<const shader::SpecializationConstants> blender::gpu::Shader::constants |
Definition at line 52 of file gpu_shader_private.hh.
Referenced by blender::gpu::MTLShader::bake_compute_pipeline_state(), blender::gpu::MTLShader::bake_pipeline_state(), blender::gpu::GLShader::compute_shader_from_glsl(), blender::gpu::MTLShader::finalize(), blender::gpu::VKShader::finalize_post(), blender::gpu::GLShader::fragment_shader_from_glsl(), blender::gpu::GLShader::geometry_shader_from_glsl(), GPU_shader_get_default_constant_state(), blender::gpu::GLShader::init(), specialization_constants_init(), and blender::gpu::GLShader::vertex_shader_from_glsl().
| uint16_t blender::gpu::Shader::fragment_output_bits = 0 |
Bit-set indicating the frame-buffer color attachments that this shader writes to.
Definition at line 48 of file gpu_shader_private.hh.
Referenced by blender::gpu::Context::assert_framebuffer_shader_compatibility().
| ShaderInterface* blender::gpu::Shader::interface = nullptr |
Uniform & attribute locations for shader.
Definition at line 46 of file gpu_shader_private.hh.
Referenced by blender::gpu::MTLShader::bind(), blender::gpu::debug_validate_binding_image_format(), blender::gpu::VKShader::fragment_interface_declare(), blender::gpu::MTLShader::geometry_interface_declare(), blender::gpu::VKShader::interface_get(), blender::gpu::MTLShader::MTLShader(), blender::gpu::MTLShader::set_interface(), and ~Shader().
| bool blender::gpu::Shader::is_polyline = false |
Definition at line 56 of file gpu_shader_private.hh.
Referenced by GPU_shader_get_builtin_shader_with_config().
|
protected |
For debugging purpose.
Definition at line 60 of file gpu_shader_private.hh.
Referenced by blender::gpu::MTLShader::bake_compute_pipeline_state(), blender::gpu::MTLShader::bake_pipeline_state(), blender::gpu::GLShader::constants_declare(), blender::gpu::GLShader::finalize(), blender::gpu::MTLShader::finalize(), blender::gpu::GLShader::GLShader(), blender::gpu::GLShader::init(), blender::gpu::MTLShader::MTLShader(), blender::gpu::MTLShader::MTLShader(), name_get(), print_log(), blender::gpu::MTLShader::resources_declare(), Shader(), and blender::gpu::VKShader::VKShader().
Definition at line 66 of file gpu_shader_private.hh.
Referenced by blender::gpu::MTLShader::has_parent_shader(), parent_get(), parent_set(), and blender::gpu::MTLShader::warm_cache().