|
Blender V5.3
|
#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_codegen_only)=0 |
| virtual const shader::ShaderCreateInfo & | patch_create_info (const shader::ShaderCreateInfo &original_info)=0 |
| virtual void | vertex_shader_from_glsl (const shader::ShaderCreateInfo &info, MutableSpan< StringRefNull > sources)=0 |
| virtual void | geometry_shader_from_glsl (const shader::ShaderCreateInfo &info, MutableSpan< StringRefNull > sources)=0 |
| virtual void | fragment_shader_from_glsl (const shader::ShaderCreateInfo &info, MutableSpan< StringRefNull > sources)=0 |
| virtual void | compute_shader_from_glsl (const shader::ShaderCreateInfo &info, 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 |
| 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 | |
| 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) |
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) |
Interface. | |
| static std::string | run_preprocessor (StringRef source, bool no_dead_code_elimination) |
Public Attributes | |
| 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 | |
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 |
| std::unique_ptr< PatchedShaderCreateInfo > | patched_info_ |
Implementation of shader compilation and uniforms handling. Base class which is then specialized for each implementation (GL, VK, ...).
Definition at line 52 of file gpu_shader_private.hh.
| Shader::Shader | ( | const char * | name | ) |
Definition at line 112 of file gpu_shader.cc.
References name, and blender::STRNCPY().
Referenced by blender::gpu::GLShader::GLShader(), blender::gpu::MTLShader::MTLShader(), parent_get(), parent_set(), and blender::gpu::VKShader::VKShader().
|
virtual |
Definition at line 127 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.
|
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 91 of file gpu_shader.cc.
References blender::gpu::shader::ShaderCreateInfo::defines_.
Referenced by uniform_int().
|
static |
Definition at line 43 of file gpu_shader.cc.
References blender::blender::StringRefBase::endswith(), blender::blender::StringRefBase::find(), blender::G, blender::blender::StringRefBase::size(), blender::blender::StringRefBase::startswith(), and blender::blender::StringRefBase::substr().
Referenced by blender::gpu::compile_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.
|
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::DeferredLayer::begin_sync(), blender::eevee::Film::sync(), and blender::eevee::ForwardPipeline::sync().
|
inline |
Definition at line 128 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::MTLContext::compute_dispatch(), blender::gpu::MTLContext::compute_dispatch_indirect(), blender::gpu::MTLImmediate::end(), blender::gpu::VKShader::ensure_and_get_compute_pipeline(), blender::gpu::VKShader::ensure_and_get_graphics_pipeline(), blender::gpu::VKShader::ensure_graphics_pipelines(), and blender::gpu::MTLShader::finalize().
|
inline |
Definition at line 138 of file gpu_shader_private.hh.
References parent_shader_, and Shader().
|
inline |
Definition at line 133 of file gpu_shader_private.hh.
References parent_shader_, and Shader().
Referenced by blender::GPU_shader_set_parent().
|
pure virtual |
Implemented in blender::gpu::GLShader, blender::gpu::MTLShader, and blender::gpu::VKShader.
|
protected |
Definition at line 43 of file gpu_shader_log.cc.
References blender::BLI_dynstr_append(), blender::BLI_dynstr_appendf(), blender::BLI_dynstr_free(), blender::BLI_dynstr_get_cstring(), blender::BLI_dynstr_nappend(), blender::BLI_dynstr_new(), CLG_color_support_get(), CLG_LEVEL_ERROR, CLG_LEVEL_WARN, CLG_log_raw(), CLOG_AT_LEVEL, CLOG_CHECK, blender::gpu::LogCursor::column, blender::gpu::GPULogItem::cursor, DEBUG_CONTEXT_LINES, DEBUG_LOG_SHADER_SRC_ON_ERROR, ELEM, blender::blender::StringRefBase::endswith(), blender::gpu::Error, blender::gpu::LogCursor::file_name_and_error_line, blender::gpu::shader::parser::filename(), blender::gpu::shader::gpu_shader_dependency_get_filename_from_source_string(), blender::LOG, log, name, blender::gpu::Note, blender::gpu::LogCursor::row, blender::gpu::GPULogItem::severity, blender::Span< T >::size(), blender::gpu::LogCursor::source, blender::StringRefNull::StringRefNull(), blender::blender::StringRefBase::substr(), and blender::gpu::Warning.
Referenced by blender::gpu::GLShader::post_finalize().
|
pure virtual |
Implemented in blender::gpu::GLShader, blender::gpu::MTLShader, and blender::gpu::VKShader.
|
static |
Definition at line 1654 of file gpu_shader_preprocessor.cc.
References BLI_assert_msg, blender::blender::StringRefBase::find(), blender::G, blender::G_DEBUG_GPU_SHADER_NO_PREPROCESSOR, blender::gpu::Preprocessor::optimize(), blender::gpu::Preprocessor::preprocess(), and blender::gpu::Preprocessor::result_get().
Referenced by blender::gpu::compile_ex(), and blender::gpu::tests::test_shader_preprocessor().
|
static |
Definition at line 780 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 772 of file gpu_shader.cc.
References blender::GPU_shader_get_builtin_uniform(), blender::GPU_shader_uniform_float_ex(), blender::GPU_UNIFORM_SCENE_LINEAR_XFORM, blender::colorspace::scene_linear_to_rec709, and set_scene_linear_to_xyz_uniform().
Referenced by blender::GPU_shader_bind(), and set_scene_linear_to_xyz_uniform().
|
static |
Definition at line 763 of file gpu_shader.cc.
References blender::GPU_shader_get_builtin_uniform(), blender::GPU_shader_uniform_int_ex(), blender::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 blender::GPU_shader_bind(), and set_srgb_uniform().
| void Shader::specialization_constants_init | ( | const shader::ShaderCreateInfo & | info | ) |
Definition at line 485 of file gpu_shader.cc.
References constants, blender::gpu::shader::ShaderCreateInfo::specialization_constants_, blender::gpu::shader::SpecializationConstant::type, blender::gpu::shader::SpecializationConstants::types, blender::gpu::shader::SpecializationConstant::value, and blender::gpu::shader::SpecializationConstants::values.
Referenced by uniform_int().
|
pure virtual |
Implemented in blender::gpu::GLShader, blender::gpu::MTLShader, and blender::gpu::VKShader.
Referenced by blender::GPU_shader_unbind().
|
pure virtual |
Implemented in blender::gpu::GLShader, blender::gpu::MTLShader, and blender::gpu::VKShader.
References blender::data.
|
pure virtual |
Implemented in blender::gpu::GLShader, blender::gpu::MTLShader, and blender::gpu::VKShader.
References blender::data, defines_declare(), and specialization_constants_init().
|
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 61 of file gpu_shader_private.hh.
Referenced by blender::gpu::MTLShader::bake_compute_pipeline_state(), blender::gpu::MTLShader::bake_graphic_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(), blender::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 57 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 55 of file gpu_shader_private.hh.
Referenced by blender::gpu::MTLShader::bake_current_pipeline_state(), blender::gpu::MTLShader::bake_graphic_pipeline_state(), blender::gpu::MTLShader::bind(), blender::gpu::debug_validate_binding_image_format(), blender::gpu::VKShader::fragment_interface_declare(), blender::gpu::MTLShader::get_interface(), blender::gpu::VKShader::interface_get(), and ~Shader().
| bool blender::gpu::Shader::is_polyline = false |
Definition at line 65 of file gpu_shader_private.hh.
Referenced by blender::gpu::GLImmediate::begin(), blender::gpu::GLImmediate::end(), blender::gpu::MTLImmediate::end(), blender::gpu::VKImmediate::end(), and blender::GPU_shader_get_builtin_shader_with_config().
|
protected |
For debugging purpose.
Definition at line 74 of file gpu_shader_private.hh.
Referenced by 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(), name_get(), print_log(), Shader(), and blender::gpu::VKShader::VKShader().
Definition at line 80 of file gpu_shader_private.hh.
Referenced by blender::gpu::MTLShader::has_parent_shader(), parent_get(), parent_set(), and blender::gpu::MTLShader::warm_cache().
|
protected |
Definition at line 84 of file gpu_shader_private.hh.
Referenced by blender::gpu::MTLShader::patch_create_info().
| bool blender::gpu::Shader::skip_preprocessor = false |
Definition at line 70 of file gpu_shader_private.hh.