Kohi Game Engine
vulkan_shader Struct Reference

Represents a generic Vulkan shader. This uses a set of inputs and parameters, as well as the shader programs contained in SPIR-V files to construct a shader for use in rendering. More...

#include <vulkan_types.h>

Data Fields

kname name
 
void * mapped_uniform_buffer_blocks [VULKAN_RESOURCE_IMAGE_COUNT]
 The block of memory mapped to the each per-colourbuffer-image uniform buffer. More...
 
void * per_draw_push_constant_block
 The block of memory used for push constants, 128B. More...
 
u32 id
 The shader identifier. More...
 
u16 max_descriptor_set_count
 The max number of descriptor sets that can be allocated from this shader. Should typically be a decently high number. More...
 
u8 descriptor_set_count
 The total number of descriptor sets configured for this shader. More...
 
vulkan_descriptor_set_config descriptor_set_configs [VULKAN_SHADER_DESCRIPTOR_SET_LAYOUT_COUNT]
 Descriptor sets, max of 3. Index 0=per_frame, 1=per_group, 2=per_draw. More...
 
u8 attribute_count
 The number of vertex attributes in the shader. More...
 
VkVertexInputAttributeDescription attributes [VULKAN_SHADER_MAX_ATTRIBUTES]
 An array of attribute descriptions for this shader. More...
 
u32 uniform_count
 The number of uniforms in the shader. More...
 
shader_uniformuniforms
 An array of uniforms in the shader. More...
 
u32 attribute_stride
 The size of all attributes combined, a.k.a. the size of a vertex. More...
 
face_cull_mode cull_mode
 Face culling mode, provided by the front end. More...
 
u32 topology_types
 The topology types for the shader pipeline. See primitive_topology_type. Defaults to "triangle list" if unspecified. More...
 
u32 max_groups
 
u32 max_per_draw_count
 
u8 stage_count
 The number of shader stages in this shader. More...
 
vulkan_shader_stage stages [VULKAN_SHADER_MAX_STAGES]
 An array of stages (such as vertex and fragment) for this shader. Count is located in config. More...
 
u32 pool_size_count
 
VkDescriptorPoolSize pool_sizes [3]
 An array of descriptor pool sizes. More...
 
VkDescriptorPool descriptor_pool
 The descriptor pool used for this shader. More...
 
VkDescriptorSetLayout descriptor_set_layouts [VULKAN_SHADER_DESCRIPTOR_SET_LAYOUT_COUNT]
 Descriptor set layouts, max of 3. More...
 
renderbuffer uniform_buffers [VULKAN_RESOURCE_IMAGE_COUNT]
 The uniform buffers used by this shader, one per colourbuffer image. More...
 
vulkan_pipeline ** pipelines
 An array of pointers to pipelines associated with this shader. More...
 
vulkan_pipeline ** wireframe_pipelines
 An array of pointers to wireframe pipelines associated with this shader. More...
 
u8 bound_pipeline_index
 The currently bound pipeline index. More...
 
VkPrimitiveTopology current_topology
 The currently-selected topology. More...
 
vulkan_shader_frequency_state per_frame_state
 The per-frame frequency state. More...
 
vulkan_shader_frequency_stategroup_states
 The per-group frequency states for all groups. More...
 
vulkan_shader_frequency_stateper_draw_states
 The per-draw states for all local things/entities/actors/whatever. More...
 
u64 required_ubo_alignment
 The amount of bytes that are required for UBO alignment. More...
 
vulkan_shader_frequency_info per_frame_info
 
vulkan_shader_frequency_info per_group_info
 
vulkan_shader_frequency_info per_draw_info
 
shader_flags flags
 

Detailed Description

Represents a generic Vulkan shader. This uses a set of inputs and parameters, as well as the shader programs contained in SPIR-V files to construct a shader for use in rendering.

Field Documentation

◆ attribute_count

u8 attribute_count

The number of vertex attributes in the shader.

◆ attribute_stride

u32 attribute_stride

The size of all attributes combined, a.k.a. the size of a vertex.

◆ attributes

VkVertexInputAttributeDescription attributes[VULKAN_SHADER_MAX_ATTRIBUTES]

An array of attribute descriptions for this shader.

◆ bound_pipeline_index

u8 bound_pipeline_index

The currently bound pipeline index.

◆ cull_mode

face_cull_mode cull_mode

Face culling mode, provided by the front end.

◆ current_topology

VkPrimitiveTopology current_topology

The currently-selected topology.

◆ descriptor_pool

VkDescriptorPool descriptor_pool

The descriptor pool used for this shader.

◆ descriptor_set_configs

Descriptor sets, max of 3. Index 0=per_frame, 1=per_group, 2=per_draw.

◆ descriptor_set_count

u8 descriptor_set_count

The total number of descriptor sets configured for this shader.

◆ descriptor_set_layouts

VkDescriptorSetLayout descriptor_set_layouts[VULKAN_SHADER_DESCRIPTOR_SET_LAYOUT_COUNT]

Descriptor set layouts, max of 3.

◆ flags

shader_flags flags

◆ group_states

The per-group frequency states for all groups.

◆ id

u32 id

The shader identifier.

◆ mapped_uniform_buffer_blocks

void* mapped_uniform_buffer_blocks[VULKAN_RESOURCE_IMAGE_COUNT]

The block of memory mapped to the each per-colourbuffer-image uniform buffer.

◆ max_descriptor_set_count

u16 max_descriptor_set_count

The max number of descriptor sets that can be allocated from this shader. Should typically be a decently high number.

◆ max_groups

u32 max_groups

◆ max_per_draw_count

u32 max_per_draw_count

◆ name

kname name

◆ per_draw_info

◆ per_draw_push_constant_block

void* per_draw_push_constant_block

The block of memory used for push constants, 128B.

◆ per_draw_states

The per-draw states for all local things/entities/actors/whatever.

◆ per_frame_info

◆ per_frame_state

The per-frame frequency state.

◆ per_group_info

◆ pipelines

vulkan_pipeline** pipelines

An array of pointers to pipelines associated with this shader.

◆ pool_size_count

u32 pool_size_count

◆ pool_sizes

VkDescriptorPoolSize pool_sizes[3]

An array of descriptor pool sizes.

◆ required_ubo_alignment

u64 required_ubo_alignment

The amount of bytes that are required for UBO alignment.

This is used along with the UBO size to determine the ultimate stride, which is how much the UBOs are spaced out in the buffer. For example, a required alignment of 256 means that the stride must be a multiple of 256 (true for some nVidia cards).

◆ stage_count

u8 stage_count

The number of shader stages in this shader.

◆ stages

An array of stages (such as vertex and fragment) for this shader. Count is located in config.

◆ topology_types

u32 topology_types

The topology types for the shader pipeline. See primitive_topology_type. Defaults to "triangle list" if unspecified.

◆ uniform_buffers

The uniform buffers used by this shader, one per colourbuffer image.

◆ uniform_count

u32 uniform_count

The number of uniforms in the shader.

◆ uniforms

shader_uniform* uniforms

An array of uniforms in the shader.

◆ wireframe_pipelines

vulkan_pipeline** wireframe_pipelines

An array of pointers to wireframe pipelines associated with this shader.


The documentation for this struct was generated from the following file: