|
Blender V4.3
|
#include <gpu_shader_private.hh>
Inherited by blender::gpu::GLShader, blender::gpu::MTLShader, and blender::gpu::VKShader.
Classes | |
| struct | Constants |
Public Member Functions | |
| virtual void | init (const shader::ShaderCreateInfo &info, bool is_batch_compilation)=0 |
| virtual void | vertex_shader_from_glsl (MutableSpan< const char * > sources)=0 |
| virtual void | geometry_shader_from_glsl (MutableSpan< const char * > sources)=0 |
| virtual void | fragment_shader_from_glsl (MutableSpan< const char * > sources)=0 |
| virtual void | compute_shader_from_glsl (MutableSpan< const char * > sources)=0 |
| virtual bool | finalize (const shader::ShaderCreateInfo *info=nullptr)=0 |
| virtual void | warm_cache (int limit)=0 |
| virtual void | transform_feedback_names_set (Span< const char * > name_list, eGPUShaderTFBType geom_type)=0 |
| virtual bool | transform_feedback_enable (VertBuf *)=0 |
| virtual void | transform_feedback_disable ()=0 |
| virtual void | bind ()=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 |
| virtual int | program_handle_get () const =0 |
| virtual bool | get_uses_ssbo_vertex_fetch () const =0 |
| virtual int | get_ssbo_vertex_fetch_output_num_verts () const =0 |
| const char *const | 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 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 | |
| ShaderInterface * | interface = nullptr |
| struct blender::gpu::Shader::Constants | constants |
Protected Member Functions | |
Debug functions | |
| void | print_log (Span< const char * > 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 44 of file gpu_shader_private.hh.
| Shader::Shader | ( | const char * | name | ) |
Definition at line 55 of file gpu_shader.cc.
References STRNCPY.
|
virtual |
Definition at line 60 of file gpu_shader.cc.
|
pure virtual |
Implemented in blender::gpu::GLShader, blender::gpu::MTLShader, and blender::gpu::VKShader.
Referenced by GPU_shader_bind().
|
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 33 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.
|
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::gpu::ShaderCompiler::compile().
|
inline |
Definition at line 126 of file gpu_shader_private.hh.
References name.
Referenced by blender::gpu::MTLShader::bind(), blender::gpu::debug::check_gl_resources(), blender::gpu::MTLImmediate::end(), blender::gpu::MTLShader::finalize(), blender::gpu::MSLGeneratorInterface::generate_msl_compute_entry_stub(), blender::gpu::MSLGeneratorInterface::generate_msl_fragment_entry_stub(), blender::gpu::MSLGeneratorInterface::generate_msl_vertex_entry_stub(), blender::gpu::MTLShader::ssbo_vertex_fetch_bind_attributes_end(), blender::gpu::MTLShader::uniform_float(), blender::gpu::MTLShader::uniform_int(), and blender::gpu::MSLGeneratorInterface::use_argument_buffer_for_samplers().
|
inline |
Definition at line 136 of file gpu_shader_private.hh.
References parent_shader_.
|
inline |
Definition at line 131 of file gpu_shader_private.hh.
References parent_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(), BLI_string_join_arrayN(), blender::StringRefNull::c_str(), CLG_color_support_get(), CLG_FLAG_USE, CLG_log_str(), CLG_SEVERITY_ERROR, CLG_SEVERITY_WARN, blender::gpu::LogCursor::column, copy(), blender::gpu::GPULogItem::cursor, blender::Span< T >::data(), 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, CLG_LogType::flag, blender::gpu::shader::gpu_shader_dependency_get_filename_from_source_string(), blender::Vector< T, InlineBufferCapacity, Allocator >::index_range(), blender::StringRefBase::is_empty(), blender::Vector< T, InlineBufferCapacity, Allocator >::is_empty(), blender::Vector< T, InlineBufferCapacity, Allocator >::last(), CLG_LogType::level, blender::gpu::LOG, log(), MEM_freeN(), 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::gpu::GPULogItem::source_base_row, stage, blender::StringRefBase::substr(), CLG_LogRef::type, and blender::gpu::Warning.
Referenced by blender::gpu::MTLShader::bake_pipeline_state(), and blender::gpu::MTLShader::finalize().
|
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.
|
static |
Definition at line 796 of file gpu_shader.cc.
References blender::gpu::g_shader_builtin_srgb_is_dirty, and blender::gpu::g_shader_builtin_srgb_transform.
Referenced by blender::gpu::GLFrameBuffer::bind(), blender::gpu::MTLFrameBuffer::bind(), and blender::gpu::VKFrameBuffer::bind().
|
static |
Definition at line 787 of file gpu_shader.cc.
References blender::gpu::g_shader_builtin_srgb_is_dirty, blender::gpu::g_shader_builtin_srgb_transform, GPU_shader_get_builtin_uniform(), GPU_shader_uniform_int_ex(), and GPU_UNIFORM_SRGB_TRANSFORM.
| void Shader::specialization_constants_init | ( | const shader::ShaderCreateInfo & | info | ) |
Definition at line 481 of file gpu_shader.cc.
References blender::gpu::shader::ShaderCreateInfo::specialization_constants_.
|
static |
Definition at line 782 of file gpu_shader.cc.
References blender::gpu::g_shader_builtin_srgb_is_dirty.
|
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 GPU_shader_unbind().
|
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.
| struct blender::gpu::Shader::Constants blender::gpu::Shader::constants |
Referenced by blender::gpu::MTLShader::bake_compute_pipeline_state(), blender::gpu::MTLShader::bake_current_pipeline_state(), blender::gpu::MTLShader::bake_pipeline_state(), blender::gpu::GLShader::constants_declare(), blender::gpu::VKShader::ensure_and_get_compute_pipeline(), blender::gpu::VKShader::ensure_and_get_graphics_pipeline(), blender::gpu::MTLContext::ensure_compute_pipeline_state(), blender::gpu::MTLShader::finalize(), and blender::gpu::MTLParallelShaderCompiler::precompile_specializations().
| ShaderInterface* blender::gpu::Shader::interface = nullptr |
Uniform & attribute locations for shader.
Definition at line 47 of file gpu_shader_private.hh.
Referenced by blender::gpu::MTLShader::bind(), blender::gpu::MTLShader::get_interface(), blender::gpu::VKShader::interface_get(), blender::gpu::MTLParallelShaderCompiler::precompile_specializations(), blender::gpu::MTLShader::prepare_ssbo_vertex_fetch_metadata(), and blender::gpu::MTLShader::set_interface().
|
protected |
For debugging purpose.
Definition at line 70 of file gpu_shader_private.hh.
Referenced by blender::gpu::MTLShader::bake_compute_pipeline_state(), blender::gpu::MTLShader::bake_pipeline_state(), blender::gpu::MTLShader::finalize(), and name_get().
|
protected |
Definition at line 76 of file gpu_shader_private.hh.
Referenced by blender::gpu::MTLShader::has_parent_shader(), parent_get(), parent_set(), and blender::gpu::MTLShader::warm_cache().