Blender V4.5
blender::gpu::VKShader Class Reference

#include <vk_shader.hh>

Inherits blender::gpu::Shader.

Public Member Functions

 VKShader (const char *name)
 
virtual ~VKShader ()
 
void init (const shader::ShaderCreateInfo &info, bool is_batch_compilation) override
 
void init () override
 
void vertex_shader_from_glsl (MutableSpan< StringRefNull > sources) override
 
void geometry_shader_from_glsl (MutableSpan< StringRefNull > sources) override
 
void fragment_shader_from_glsl (MutableSpan< StringRefNull > sources) override
 
void compute_shader_from_glsl (MutableSpan< StringRefNull > sources) override
 
bool finalize (const shader::ShaderCreateInfo *info=nullptr) override
 
bool finalize_post ()
 
bool is_ready () const
 
void warm_cache (int limit) override
 
void bind (const shader::SpecializationConstants *constants_state) override
 
void unbind () override
 
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
 
std::string resources_declare (const shader::ShaderCreateInfo &info) const override
 
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
 
VkPipeline ensure_and_get_compute_pipeline (const shader::SpecializationConstants &constants_state)
 
VkPipeline ensure_and_get_graphics_pipeline (GPUPrimType primitive, VKVertexAttributeObject &vao, VKStateManager &state_manager, VKFrameBuffer &framebuffer, shader::SpecializationConstants &constants_state)
 
const VKShaderInterfaceinterface_get () const
 
bool has_descriptor_set () const
 
VkDescriptorSetLayout vk_descriptor_set_layout_get () const
 
- Public Member Functions inherited from blender::gpu::Shader
std::string defines_declare (const shader::ShaderCreateInfo &info) const
 
StringRefNull 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)
 

Public Attributes

VKShaderModule vertex_module
 
VKShaderModule geometry_module
 
VKShaderModule fragment_module
 
VKShaderModule compute_module
 
bool compilation_finished = false
 
bool compilation_failed = false
 
VkPipelineLayout vk_pipeline_layout = VK_NULL_HANDLE
 
VKPushConstants push_constants
 
- Public Attributes inherited from blender::gpu::Shader
ShaderInterfaceinterface = nullptr
 
uint16_t fragment_output_bits = 0
 
std::unique_ptr< const shader::SpecializationConstantsconstants
 
bool is_polyline = false
 

Additional Inherited Members

- Static Public Member Functions inherited from blender::gpu::Shader
static void set_srgb_uniform (Context *ctx, GPUShader *shader)
 
static void set_framebuffer_srgb_target (int use_srgb_to_linear)
 
- Protected Member Functions inherited from blender::gpu::Shader
void print_log (Span< StringRefNull > 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

Definition at line 25 of file vk_shader.hh.

Constructor & Destructor Documentation

◆ VKShader()

blender::gpu::VKShader::VKShader ( const char * name)

Definition at line 505 of file vk_shader.cc.

References blender::gpu::VKContext::get().

◆ ~VKShader()

Member Function Documentation

◆ bind()

void blender::gpu::VKShader::bind ( const shader::SpecializationConstants * constants_state)
overridevirtual

◆ compute_layout_declare()

std::string blender::gpu::VKShader::compute_layout_declare ( const shader::ShaderCreateInfo & info) const
overridevirtual

Implements blender::gpu::Shader.

Definition at line 1214 of file vk_shader.cc.

References info.

◆ compute_shader_from_glsl()

void blender::gpu::VKShader::compute_shader_from_glsl ( MutableSpan< StringRefNull > sources)
overridevirtual

Implements blender::gpu::Shader.

Definition at line 583 of file vk_shader.cc.

References compute_module.

◆ ensure_and_get_compute_pipeline()

◆ ensure_and_get_graphics_pipeline()

VkPipeline blender::gpu::VKShader::ensure_and_get_graphics_pipeline ( GPUPrimType primitive,
VKVertexAttributeObject & vao,
VKStateManager & state_manager,
VKFrameBuffer & framebuffer,
shader::SpecializationConstants & constants_state )

Definition at line 1348 of file vk_shader.cc.

References blender::gpu::VKGraphicsInfo::VertexIn::attributes, blender::gpu::VKVertexAttributeObject::attributes, blender::gpu::VKGraphicsInfo::VertexIn::bindings, blender::gpu::VKVertexAttributeObject::bindings, BLI_assert, BLI_assert_msg, blender::Vector< T, InlineBufferCapacity, Allocator >::clear(), blender::gpu::VKGraphicsInfo::FragmentOut::color_attachment_formats, blender::gpu::VKFrameBuffer::color_attachment_formats_get(), blender::gpu::VKFrameBuffer::color_attachment_size, blender::gpu::VKGraphicsInfo::FragmentOut::color_attachment_size, blender::gpu::VKGraphicsInfo::FragmentOut::depth_attachment_format, blender::gpu::VKFrameBuffer::depth_attachment_format_get(), blender::gpu::VKBackend::device, blender::Vector< T, InlineBufferCapacity, Allocator >::extend(), fragment_module, blender::gpu::VKGraphicsInfo::fragment_out, blender::gpu::VKGraphicsInfo::fragment_shader, geometry_module, blender::gpu::VKBackend::get(), blender::gpu::VKPipelinePool::get_or_create_graphics_pipeline(), GPU_PRIM_POINTS, interface_get(), blender::gpu::StateManager::mutable_state, blender::gpu::VKGraphicsInfo::mutable_state, blender::gpu::Shader::name_get(), blender::gpu::debug::object_label(), blender::gpu::VKDevice::pipelines, blender::gpu::VKGraphicsInfo::pre_rasterization, blender::gpu::VKGraphicsInfo::FragmentShader::scissors, blender::gpu::VKGraphicsInfo::specialization_constants, blender::gpu::StateManager::state, blender::gpu::VKGraphicsInfo::state, blender::gpu::VKGraphicsInfo::FragmentOut::stencil_attachment_format, blender::gpu::VKFrameBuffer::stencil_attachment_format_get(), blender::gpu::to_vk_primitive_topology(), blender::gpu::shader::SpecializationConstants::values, blender::gpu::VKGraphicsInfo::vertex_in, vertex_module, blender::gpu::VKGraphicsInfo::FragmentShader::viewports, blender::gpu::VKGraphicsInfo::FragmentShader::vk_fragment_module, blender::gpu::VKGraphicsInfo::PreRasterization::vk_geometry_module, blender::gpu::VKGraphicsInfo::vk_pipeline_layout, vk_pipeline_layout, blender::gpu::VKFrameBuffer::vk_render_areas_append(), blender::gpu::VKFrameBuffer::vk_render_pass, blender::gpu::VKGraphicsInfo::FragmentOut::vk_render_pass, blender::gpu::VKShaderModule::vk_shader_module, blender::gpu::VKGraphicsInfo::VertexIn::vk_topology, blender::gpu::VKGraphicsInfo::PreRasterization::vk_vertex_module, and blender::gpu::VKFrameBuffer::vk_viewports_append().

Referenced by blender::gpu::VKContext::update_pipeline_data().

◆ finalize()

◆ finalize_post()

bool blender::gpu::VKShader::finalize_post ( )

◆ fragment_interface_declare()

◆ fragment_shader_from_glsl()

void blender::gpu::VKShader::fragment_shader_from_glsl ( MutableSpan< StringRefNull > sources)
overridevirtual

Implements blender::gpu::Shader.

Definition at line 578 of file vk_shader.cc.

References fragment_module.

◆ geometry_interface_declare()

std::string blender::gpu::VKShader::geometry_interface_declare ( const shader::ShaderCreateInfo & info) const
overridevirtual

Implements blender::gpu::Shader.

Definition at line 1148 of file vk_shader.cc.

References info, and blender::gpu::to_string().

◆ geometry_layout_declare()

std::string blender::gpu::VKShader::geometry_layout_declare ( const shader::ShaderCreateInfo & info) const
overridevirtual

◆ geometry_shader_from_glsl()

void blender::gpu::VKShader::geometry_shader_from_glsl ( MutableSpan< StringRefNull > sources)
overridevirtual

Implements blender::gpu::Shader.

Definition at line 573 of file vk_shader.cc.

References geometry_module.

Referenced by finalize().

◆ has_descriptor_set()

bool blender::gpu::VKShader::has_descriptor_set ( ) const
inline

Some shaders don't have a descriptor set and should not bind any descriptor set to the pipeline. This function can be used to determine if a descriptor set can be bound when this shader or one of its pipelines are active.

Definition at line 108 of file vk_shader.hh.

◆ init() [1/2]

void blender::gpu::VKShader::init ( )
inlineoverridevirtual

Implements blender::gpu::Shader.

Definition at line 61 of file vk_shader.hh.

◆ init() [2/2]

void blender::gpu::VKShader::init ( const shader::ShaderCreateInfo & info,
bool is_batch_compilation )
overridevirtual

Implements blender::gpu::Shader.

Definition at line 510 of file vk_shader.cc.

References info, and blender::gpu::VKShaderInterface::init().

◆ interface_get()

◆ is_ready()

bool blender::gpu::VKShader::is_ready ( ) const

Check if needed compilation steps have been finished.

Returns true when all modules that needed compilation have finished their compilation steps. Compilations with errors are still considered finished. Returns false when compilation is still needed for one of the shader modules.

Definition at line 680 of file vk_shader.cc.

References compilation_finished.

◆ resources_declare()

◆ unbind()

void blender::gpu::VKShader::unbind ( )
overridevirtual

Implements blender::gpu::Shader.

Definition at line 747 of file vk_shader.cc.

◆ uniform_float()

void blender::gpu::VKShader::uniform_float ( int location,
int comp_len,
int array_size,
const float * data )
overridevirtual

◆ uniform_int()

void blender::gpu::VKShader::uniform_int ( int location,
int comp_len,
int array_size,
const int * data )
overridevirtual

◆ vertex_interface_declare()

std::string blender::gpu::VKShader::vertex_interface_declare ( const shader::ShaderCreateInfo & info) const
overridevirtual

◆ vertex_shader_from_glsl()

void blender::gpu::VKShader::vertex_shader_from_glsl ( MutableSpan< StringRefNull > sources)
overridevirtual

Implements blender::gpu::Shader.

Definition at line 568 of file vk_shader.cc.

References vertex_module.

◆ vk_descriptor_set_layout_get()

VkDescriptorSetLayout blender::gpu::VKShader::vk_descriptor_set_layout_get ( ) const
inline

◆ warm_cache()

void blender::gpu::VKShader::warm_cache ( int limit)
overridevirtual

Implements blender::gpu::Shader.

Definition at line 588 of file vk_shader.cc.

References NOT_YET_IMPLEMENTED.

Member Data Documentation

◆ compilation_failed

bool blender::gpu::VKShader::compilation_failed = false

Definition at line 52 of file vk_shader.hh.

Referenced by finalize().

◆ compilation_finished

bool blender::gpu::VKShader::compilation_finished = false

Definition at line 51 of file vk_shader.hh.

Referenced by finalize(), and is_ready().

◆ compute_module

VKShaderModule blender::gpu::VKShader::compute_module

◆ fragment_module

VKShaderModule blender::gpu::VKShader::fragment_module

◆ geometry_module

VKShaderModule blender::gpu::VKShader::geometry_module

◆ push_constants

◆ vertex_module

VKShaderModule blender::gpu::VKShader::vertex_module

◆ vk_pipeline_layout

VkPipelineLayout blender::gpu::VKShader::vk_pipeline_layout = VK_NULL_HANDLE

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