Kohi Game Engine
shader Struct Reference

Represents a shader on the frontend. More...

#include <shader_system.h>

Data Fields

u32 id
 The shader identifier. More...
 
char * name
 
shader_flag_bits flags
 
u32 topology_types
 The types of topologies used by the shader and its pipeline. See primitive_topology_type. More...
 
u64 required_ubo_alignment
 The amount of bytes that are required for UBO alignment. More...
 
u64 global_ubo_size
 The actual size of the global uniform buffer object. More...
 
u64 global_ubo_stride
 The stride of the global uniform buffer object. More...
 
u64 global_ubo_offset
 The offset in bytes for the global UBO from the beginning of the uniform buffer. More...
 
u64 ubo_size
 The actual size of the instance uniform buffer object. More...
 
u64 ubo_stride
 The stride of the instance uniform buffer object. More...
 
u64 push_constant_size
 The total size of all push constant ranges combined. More...
 
u64 push_constant_stride
 The push constant stride, aligned to 4 bytes as required by Vulkan. More...
 
texture_map ** global_texture_maps
 An array of global texture map pointers. Darray. More...
 
u8 instance_texture_count
 The number of instance textures. More...
 
shader_scope bound_scope
 
u32 bound_instance_id
 The identifier of the currently bound instance. More...
 
u32 bound_ubo_offset
 The currently bound instance's ubo offset. More...
 
void * hashtable_block
 The block of memory used by the uniform hashtable. More...
 
hashtable uniform_lookup
 A hashtable to store uniform index/locations by name. More...
 
shader_uniformuniforms
 An array of uniforms in this shader. Darray. More...
 
shader_attributeattributes
 An array of attributes. Darray. More...
 
shader_state state
 The internal state of the shader. More...
 
u8 push_constant_range_count
 The number of push constant ranges. More...
 
range push_constant_ranges [32]
 An array of push constant ranges. More...
 
u16 attribute_stride
 The size of all attributes combined, a.k.a. the size of a vertex. More...
 
u64 render_frame_number
 Used to ensure the shader's globals are only updated once per frame. More...
 
u8 draw_index
 Used to ensure the shader's globals are only updated once per draw. More...
 
void * internal_data
 An opaque pointer to hold renderer API specific data. Renderer is responsible for creation and destruction of this.
More...
 

Detailed Description

Represents a shader on the frontend.

Field Documentation

◆ attribute_stride

u16 attribute_stride

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

◆ attributes

shader_attribute* attributes

An array of attributes. Darray.

◆ bound_instance_id

u32 bound_instance_id

The identifier of the currently bound instance.

◆ bound_scope

shader_scope bound_scope

◆ bound_ubo_offset

u32 bound_ubo_offset

The currently bound instance's ubo offset.

◆ draw_index

u8 draw_index

Used to ensure the shader's globals are only updated once per draw.

◆ flags

◆ global_texture_maps

texture_map** global_texture_maps

An array of global texture map pointers. Darray.

◆ global_ubo_offset

u64 global_ubo_offset

The offset in bytes for the global UBO from the beginning of the uniform buffer.

◆ global_ubo_size

u64 global_ubo_size

The actual size of the global uniform buffer object.

◆ global_ubo_stride

u64 global_ubo_stride

The stride of the global uniform buffer object.

◆ hashtable_block

void* hashtable_block

The block of memory used by the uniform hashtable.

◆ id

u32 id

The shader identifier.

◆ instance_texture_count

u8 instance_texture_count

The number of instance textures.

◆ internal_data

void* internal_data

An opaque pointer to hold renderer API specific data. Renderer is responsible for creation and destruction of this.

◆ name

char* name

◆ push_constant_range_count

u8 push_constant_range_count

The number of push constant ranges.

◆ push_constant_ranges

range push_constant_ranges[32]

An array of push constant ranges.

◆ push_constant_size

u64 push_constant_size

The total size of all push constant ranges combined.

◆ push_constant_stride

u64 push_constant_stride

The push constant stride, aligned to 4 bytes as required by Vulkan.

◆ render_frame_number

u64 render_frame_number

Used to ensure the shader's globals are only updated once per frame.

◆ 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).

◆ state

shader_state state

The internal state of the shader.

◆ topology_types

u32 topology_types

The types of topologies used by the shader and its pipeline. See primitive_topology_type.

◆ ubo_size

u64 ubo_size

The actual size of the instance uniform buffer object.

◆ ubo_stride

u64 ubo_stride

The stride of the instance uniform buffer object.

◆ uniform_lookup

hashtable uniform_lookup

A hashtable to store uniform index/locations by name.

◆ uniforms

shader_uniform* uniforms

An array of uniforms in this shader. Darray.


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