Blender V4.3
draw_view_info.hh File Reference

Go to the source code of this file.

Functions

Resource ID

This is used to fetch per object data in drw_matrices and other object indexed buffers. There is multiple possibilities depending on how we are drawing the object.

 GPU_SHADER_CREATE_INFO (draw_resource_id).define("DYNAMIC_RESOURCE_ID")
 
 flat (Type::INT, "resource_index")
 
 vertex_out (draw_resource_id_iface) .geometry_out(draw_resource_id_iface)
 
Draw View
 uniform_buf (DRW_VIEW_UBO_SLOT, "ViewMatrices", "drw_view_[DRW_VIEW_LEN]", Frequency::PASS) .define("DRAW_VIEW_CREATE_INFO") .define("drw_view"
 
drw_view_[drw_view_idtypedef_source ("draw_shader_shared.hh")
 
 uniform_buf (DRW_VIEW_CULLING_UBO_SLOT, "ViewCullingData", "drw_view_culling_[DRW_VIEW_LEN]") .define("DRW_VIEW_CULLING_INFO") .define("drw_view_culling"
 
 uniform_buf (DRW_OBJ_MAT_UBO_SLOT, "ObjectMatrices", "drw_matrices[DRW_RESOURCE_CHUNK_LEN]", Frequency::BATCH) .define("ModelMatrix"
 
drw_matrices[resource_id] model define ("ModelMatrixInverse", "(drw_matrices[resource_id].model_inverse)") .additional_info("draw_view")
 
 uniform_buf (DRW_CLIPPING_UBO_SLOT, "vec4", "drw_clipping_[6]", Frequency::PASS) .define("USE_WORLD_CLIP_PLANES")
 
Draw Object Resources
drw_matrix_buf[] define ("DRAW_MODELMAT_CREATE_INFO") .define("drw_ModelMatrixInverse"
 
drw_matrix_buf[] drw_matrix_buf[resource_id] model_inverse define ("drw_ModelMatrix", "drw_matrix_buf[resource_id].model") .define("ModelMatrixInverse"
 
drw_matrix_buf[] drw_matrix_buf[resource_id] model_inverse drw_ModelMatrixInverse define ("ModelMatrix", "drw_ModelMatrix")
 
 additional_info ("draw_modelmat_new_common", "draw_resource_id_new")
 
 additional_info ("draw_modelmat_new_common", "draw_resource_with_custom_id_new")
 

Draw Globals

 GlobalsUboStorage
 
 globalsBlock
 
 typedef_source ("draw_common_shader_shared.hh") .uniform_buf(7
 

Geometry Type

 draw_resource_id
 
hairPointBuffer push_constant(Type::INT, "hairStrandsRes") .push_constant(Type hairPointBuffer push_constant(Type::INT, "hairStrandsRes") .push_constant(Type draw_resource_id_uniform
 
 GPU_SHADER_CREATE_INFO (draw_mesh).additional_info("draw_modelmat"
 
 GPU_SHADER_CREATE_INFO (draw_mesh_new).additional_info("draw_modelmat_new"
 
 define ("HAIR_SHADER") .define("DRW_HAIR_INFO") .sampler(15
 
hairPointBuffer push_constant(Type::INT, "hairStrandsRes") .push_constant(Type hairPointBuffer push_constant(Type::INT, "hairStrandsRes") .push_constant(Type sampler (0, ImageType::FLOAT_BUFFER, "ptcloud_pos_rad_tx", Frequency::BATCH) .define("POINTCLOUD_SHADER") .define("DRW_POINTCLOUD_INFO") .additional_info("draw_modelmat_instanced_attr"
 
 GPU_SHADER_CREATE_INFO (draw_volume).additional_info("draw_modelmat"
 
 additional_info ("draw_modelmat_new", "draw_resource_handle_new")
 
 typedef_source ("gpencil_shader_shared.h") .define("DRW_GPENCIL_INFO") .sampler(0
 

Internal Draw Manager usage

 ObjectMatrices
 
matrix_buf[] ObjectInfos
 
 ViewCullingData
 
 ObjectBounds
 
bounds_buf[] storage_buf(1, Qualifier::READ_WRITE, "uint", "visibility_buf[]") .push_constant(Type DrawGroup
 
bounds_buf[] storage_buf(1, Qualifier::READ_WRITE, "uint", "visibility_buf[]") .push_constant(Type group_buf[] DrawPrototype
 
bounds_buf[] storage_buf(1, Qualifier::READ_WRITE, "uint", "visibility_buf[]") .push_constant(Type group_buf[] prototype_buf[] uint
 
 do_static_compilation (true) .typedef_source("draw_shader_shared.hh") .define("DRAW_FINALIZE_SHADER") .local_group_size(DRW_FINALIZE_GROUP_SIZE) .storage_buf(0
 
matrix_buf[] storage_buf (1, Qualifier::READ_WRITE, "ObjectBounds", "bounds_buf[]") .storage_buf(2
 
matrix_buf[] infos_buf[] push_constant (Type::INT, "resource_len") .compute_source("draw_resource_finalize_comp.glsl")
 
 STRINGIFY (DRW_VIEW_MAX)) .storage_buf(0
 
view_culling_buf[DRW_VIEW_LENcompute_source ("draw_view_finalize_comp.glsl") .additional_info("draw_view")
 
bounds_buf[] storage_buf(1, Qualifier::READ_WRITE, "uint", "visibility_buf[]") .push_constant(Type group_buf[] storage_buf (1, Qualifier::READ, "uint", "visibility_buf[]") .storage_buf(2
 
bounds_buf[] storage_buf(1, Qualifier::READ_WRITE, "uint", "visibility_buf[]") .push_constant(Type group_buf[] prototype_buf[] storage_buf (3, Qualifier::WRITE, "DrawCommand", "command_buf[]") .storage_buf(DRW_RESOURCE_ID_SLOT
 

Draw Resource ID

New implementation using gl_BaseInstance and storage buffers.

 int
 
 int2
 
resource_id_buf[] resource_id_buf[gpu_BaseInstance+gl_InstanceID] y
 
 drw_ResourceID
 
 define ("UNIFORM_RESOURCE_ID_NEW") .storage_buf(DRW_RESOURCE_ID_SLOT
 
resource_id_buf[] define ("drw_ResourceID", "resource_id_buf[gpu_BaseInstance + gl_InstanceID]")
 
resource_id_buf[] define ("drw_ResourceID", "resource_id_buf[gpu_BaseInstance + gl_InstanceID].x") .define("drw_CustomID"
 
vertex_in_drw_ResourceID define ("drw_ResourceID", "vertex_in_drw_ResourceID.x") .define("drw_CustomID"
 
 GPU_SHADER_CREATE_INFO (draw_resource_handle_new).define("resource_handle"
 

Function Documentation

◆ additional_info() [1/3]

additional_info ( "draw_modelmat_new" ,
"draw_resource_handle_new"  )

◆ additional_info() [2/3]

additional_info ( "draw_modelmat_new_common" ,
"draw_resource_id_new"  )

◆ additional_info() [3/3]

additional_info ( "draw_modelmat_new_common" ,
"draw_resource_with_custom_id_new"  )

◆ compute_source()

view_culling_buf[DRW_VIEW_LEN] compute_source ( "draw_view_finalize_comp.glsl" )

◆ define() [1/9]

drw_matrix_buf[] define ( "DRAW_MODELMAT_CREATE_INFO" )

◆ define() [2/9]

drw_matrix_buf[] drw_matrix_buf[resource_id] model_inverse define ( "drw_ModelMatrix" ,
"drw_matrix_buf.model" [resource_id] )

◆ define() [3/9]

resource_id_buf[] define ( "drw_ResourceID" ,
"resource_id_buf" [gpu_BaseInstance+gl_InstanceID] )

◆ define() [4/9]

resource_id_buf[] define ( "drw_ResourceID" ,
"resource_id_buf.x" [gpu_BaseInstance+gl_InstanceID] )

◆ define() [5/9]

vertex_in_drw_ResourceID define ( "drw_ResourceID" ,
"vertex_in_drw_ResourceID.x"  )

◆ define() [6/9]

define ( "HAIR_SHADER" )

◆ define() [7/9]

drw_matrix_buf[] drw_matrix_buf[resource_id] model_inverse drw_ModelMatrixInverse define ( "ModelMatrix" ,
"drw_ModelMatrix"  )

◆ define() [8/9]

drw_matrices[resource_id] model define ( "ModelMatrixInverse" ,
"(drw_matrices[resource_id].model_inverse)"  )

◆ define() [9/9]

define ( "UNIFORM_RESOURCE_ID_NEW" )

Workaround the lack of gl_BaseInstance by binding the resource_id_buf as vertex buf.

◆ do_static_compilation()

do_static_compilation ( true )

Colors, weights, and Circle of confusion radii for the 4 pixels to scatter. Scaling factor for the bokeh distance. Sprite pixel position with origin at sprite center. In pixels.

◆ flat()

flat ( Type::INT ,
"resource_index"  )

Used if the resource index needs to be passed to the fragment shader. IMPORTANT: Vertex and Geometry shaders need to use PASS_RESOURCE_ID in main().

◆ GPU_SHADER_CREATE_INFO() [1/5]

GPU_SHADER_CREATE_INFO ( draw_mesh )

◆ GPU_SHADER_CREATE_INFO() [2/5]

GPU_SHADER_CREATE_INFO ( draw_mesh_new )

◆ GPU_SHADER_CREATE_INFO() [3/5]

GPU_SHADER_CREATE_INFO ( draw_resource_handle_new )

TODO mask view id bits.

◆ GPU_SHADER_CREATE_INFO() [4/5]

GPU_SHADER_CREATE_INFO ( draw_resource_id )

◆ GPU_SHADER_CREATE_INFO() [5/5]

GPU_SHADER_CREATE_INFO ( draw_volume )

◆ push_constant()

matrix_buf[] infos_buf[] push_constant ( Type::INT ,
"resource_len"  )

◆ sampler()

sampler ( 0 ,
ImageType::FLOAT_BUFFER ,
"ptcloud_pos_rad_tx" ,
Frequency::BATCH  )

◆ storage_buf() [1/3]

bounds_buf[] storage_buf(1, Qualifier::READ_WRITE, "uint", "visibility_buf[]") .push_constant(Type group_buf[] storage_buf ( 1 ,
Qualifier::READ ,
"uint" ,
"visibility_buf" [] )

◆ storage_buf() [2/3]

matrix_buf[] storage_buf ( 1 ,
Qualifier::READ_WRITE ,
"ObjectBounds" ,
"bounds_buf" [] )

◆ storage_buf() [3/3]

bounds_buf[] storage_buf(1, Qualifier::READ_WRITE, "uint", "visibility_buf[]") .push_constant(Type group_buf[] prototype_buf[] storage_buf ( 3 ,
Qualifier::WRITE ,
"DrawCommand" ,
"command_buf" [] )

◆ STRINGIFY()

STRINGIFY ( DRW_VIEW_MAX )

◆ typedef_source() [1/3]

typedef_source ( "draw_common_shader_shared.hh" )

◆ typedef_source() [2/3]

drw_view_[drw_view_id] typedef_source ( "draw_shader_shared.hh" )

◆ typedef_source() [3/3]

typedef_source ( "gpencil_shader_shared.h" )

◆ uniform_buf() [1/4]

uniform_buf ( DRW_CLIPPING_UBO_SLOT ,
"vec4" ,
"drw_clipping_" [6],
Frequency::PASS  )

◆ uniform_buf() [2/4]

uniform_buf ( DRW_OBJ_MAT_UBO_SLOT ,
"ObjectMatrices" ,
"drw_matrices" [DRW_RESOURCE_CHUNK_LEN],
Frequency::BATCH  )

◆ uniform_buf() [3/4]

uniform_buf ( DRW_VIEW_CULLING_UBO_SLOT ,
"ViewCullingData" ,
"drw_view_culling_" [DRW_VIEW_LEN] )

◆ uniform_buf() [4/4]

uniform_buf ( DRW_VIEW_UBO_SLOT ,
"ViewMatrices" ,
"drw_view_" [DRW_VIEW_LEN],
Frequency::PASS  )

◆ vertex_out()

vertex_out ( draw_resource_id_iface )

Variable Documentation

◆ draw_resource_id

draw_resource_id

Definition at line 108 of file draw_view_info.hh.

◆ draw_resource_id_uniform

draw_resource_id_uniform

Definition at line 145 of file draw_view_info.hh.

◆ DrawGroup

bounds_buf[] storage_buf(1, Qualifier::READ_WRITE, "uint", "visibility_buf[]") .push_constant(Type DrawGroup

Definition at line 225 of file draw_view_info.hh.

◆ DrawPrototype

bounds_buf[] storage_buf(1, Qualifier::READ_WRITE, "uint", "visibility_buf[]") .push_constant(Type group_buf[] DrawPrototype

Definition at line 227 of file draw_view_info.hh.

◆ drw_ResourceID

drw_ResourceID

Definition at line 263 of file draw_view_info.hh.

◆ globalsBlock

globalsBlock

Definition at line 100 of file draw_view_info.hh.

◆ GlobalsUboStorage

GlobalsUboStorage

Definition at line 100 of file draw_view_info.hh.

◆ int

int

Definition at line 248 of file draw_view_info.hh.

◆ int2

◆ ObjectBounds

ObjectBounds

Definition at line 212 of file draw_view_info.hh.

◆ ObjectInfos

matrix_buf[] ObjectInfos

Definition at line 196 of file draw_view_info.hh.

◆ ObjectMatrices

ObjectMatrices

Definition at line 194 of file draw_view_info.hh.

◆ uint

bounds_buf[] storage_buf(1, Qualifier::READ_WRITE, "uint", "visibility_buf[]") .push_constant(Type group_buf[] prototype_buf[] uint

Definition at line 229 of file draw_view_info.hh.

◆ ViewCullingData

ViewCullingData

Definition at line 204 of file draw_view_info.hh.

◆ y

vertex_in_drw_ResourceID vertex_in_drw_ResourceID y

Definition at line 256 of file draw_view_info.hh.