|
Blender V4.5
|
#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 | init ()=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_srgb_uniform (Context *ctx, GPUShader *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 56 of file gpu_shader.cc.
|
virtual |
Definition at line 61 of file gpu_shader.cc.
References BLI_assert_msg, blender::gpu::Context::get(), and interface.
|
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.
Referenced by blender::gpu::ShaderCompiler::compile().
|
pure virtual |
Implemented in blender::gpu::GLShader, blender::gpu::MTLShader, and blender::gpu::VKShader.
Referenced by blender::gpu::ShaderCompiler::compile(), and GPU_shader_create_ex().
| std::string Shader::defines_declare | ( | const shader::ShaderCreateInfo & | info | ) | const |
Definition at line 34 of file gpu_shader.cc.
References info.
Referenced by blender::gpu::ShaderCompiler::compile().
|
pure virtual |
Implemented in blender::gpu::GLShader, blender::gpu::MTLShader, and blender::gpu::VKShader.
Referenced by blender::gpu::ShaderCompiler::compile(), and GPU_shader_create_ex().
|
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(), and GPU_shader_create_ex().
|
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().
|
pure virtual |
Implemented in blender::gpu::GLShader, blender::gpu::MTLShader, and blender::gpu::VKShader.
Referenced by blender::gpu::ShaderCompiler::compile(), and GPU_shader_create_ex().
|
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(), and GPU_shader_create_ex().
|
inline |
Definition at line 105 of file gpu_shader_private.hh.
References name.
Referenced by blender::gpu::VKDescriptorSetPoolUpdator::allocate_new_descriptor_set(), blender::gpu::Context::assert_framebuffer_shader_compatibility(), blender::gpu::MTLShader::bind(), blender::gpu::debug::check_gl_resources(), blender::gpu::compile_ex(), 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::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::uniform_float(), blender::gpu::MTLShader::uniform_int(), and blender::gpu::MSLGeneratorInterface::use_argument_buffer_for_samplers().
|
inline |
Definition at line 115 of file gpu_shader_private.hh.
References parent_shader_.
|
inline |
Definition at line 110 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(), blender::StringRefNull::c_str(), CLG_color_support_get(), CLG_FLAG_USE, CLG_log_str(), CLG_SEVERITY_ERROR, CLG_SEVERITY_WARN, blender::gpu::LogCursor::column, 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, 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, stage, blender::StringRefBase::substr(), this, CLG_LogRef::type, 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.
Referenced by blender::gpu::ShaderCompiler::compile().
|
static |
Definition at line 797 of file gpu_shader.cc.
References blender::gpu::Context::get(), 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(), and blender::gpu::VKFrameBuffer::bind().
|
static |
Definition at line 788 of file gpu_shader.cc.
References GPU_shader_get_builtin_uniform(), GPU_shader_uniform_int_ex(), GPU_UNIFORM_SRGB_TRANSFORM, blender::gpu::Context::shader_builtin_srgb_is_dirty, and blender::gpu::Context::shader_builtin_srgb_transform.
| void Shader::specialization_constants_init | ( | const shader::ShaderCreateInfo & | info | ) |
Definition at line 523 of file gpu_shader.cc.
References blender::Vector< T, InlineBufferCapacity, Allocator >::append(), info, blender::gpu::shader::SpecializationConstants::types, and blender::gpu::shader::SpecializationConstants::values.
Referenced by blender::gpu::ShaderCompiler::compile().
|
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.
Referenced by blender::gpu::ShaderCompiler::compile(), and GPU_shader_create_ex().
|
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_bind(), GPU_shader_create_ex(), blender::gpu::GLShader::init(), blender::gpu::GLShader::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(), and blender::gpu::ShaderCompiler::compile().
| 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::VKShader::fragment_interface_declare(), blender::gpu::MTLShader::get_interface(), blender::gpu::VKShader::interface_get(), blender::gpu::MTLShader::set_interface(), and blender::gpu::GLVaoCache::vao_get().
| bool blender::gpu::Shader::is_polyline = false |
Definition at line 56 of file gpu_shader_private.hh.
|
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::init(), blender::gpu::GLShader::init(), and name_get().
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().