|
|
@ -14,31 +14,37 @@
|
|
|
|
* \{ */
|
|
|
|
* \{ */
|
|
|
|
|
|
|
|
|
|
|
|
/* Standard way. Use gpu_InstanceIndex to index the object data. */
|
|
|
|
/* Standard way. Use gpu_InstanceIndex to index the object data. */
|
|
|
|
GPU_SHADER_CREATE_INFO(draw_resource_id).define("DYNAMIC_RESOURCE_ID");
|
|
|
|
GPU_SHADER_CREATE_INFO(draw_resource_id)
|
|
|
|
|
|
|
|
DEFINE("DYNAMIC_RESOURCE_ID")
|
|
|
|
|
|
|
|
GPU_SHADER_CREATE_END()
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Used if the resource index needs to be passed to the fragment shader.
|
|
|
|
* 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().
|
|
|
|
* IMPORTANT: Vertex and Geometry shaders need to use PASS_RESOURCE_ID in main().
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
GPU_SHADER_NAMED_INTERFACE_INFO(draw_resource_id_iface, drw_ResourceID_iface)
|
|
|
|
GPU_SHADER_NAMED_INTERFACE_INFO(draw_resource_id_iface, drw_ResourceID_iface)
|
|
|
|
.flat(Type::INT, "resource_index");
|
|
|
|
FLAT(INT, resource_index)
|
|
|
|
|
|
|
|
GPU_SHADER_NAMED_INTERFACE_END(drw_ResourceID_iface)
|
|
|
|
|
|
|
|
|
|
|
|
GPU_SHADER_CREATE_INFO(draw_resource_id_varying)
|
|
|
|
GPU_SHADER_CREATE_INFO(draw_resource_id_varying)
|
|
|
|
.vertex_out(draw_resource_id_iface)
|
|
|
|
VERTEX_OUT(draw_resource_id_iface)
|
|
|
|
.geometry_out(draw_resource_id_iface); /* Used if needed. */
|
|
|
|
GEOMETRY_OUT(draw_resource_id_iface)
|
|
|
|
|
|
|
|
GPU_SHADER_CREATE_END() /* Used if needed. */
|
|
|
|
|
|
|
|
|
|
|
|
/* Variation used when drawing multiple instances for one object. */
|
|
|
|
/* Variation used when drawing multiple instances for one object. */
|
|
|
|
GPU_SHADER_CREATE_INFO(draw_resource_id_uniform)
|
|
|
|
GPU_SHADER_CREATE_INFO(draw_resource_id_uniform)
|
|
|
|
.define("UNIFORM_RESOURCE_ID")
|
|
|
|
DEFINE("UNIFORM_RESOURCE_ID")
|
|
|
|
.push_constant(Type::INT, "drw_ResourceID");
|
|
|
|
PUSH_CONSTANT(INT, drw_ResourceID)
|
|
|
|
|
|
|
|
GPU_SHADER_CREATE_END()
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Declare a resource handle that identify a unique object.
|
|
|
|
* Declare a resource handle that identify a unique object.
|
|
|
|
* Requires draw_resource_id[_uniform].
|
|
|
|
* Requires draw_resource_id[_uniform].
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
GPU_SHADER_CREATE_INFO(draw_resource_handle)
|
|
|
|
GPU_SHADER_CREATE_INFO(draw_resource_handle)
|
|
|
|
.define("resource_handle", "(drw_resourceChunk * DRW_RESOURCE_CHUNK_LEN + resource_id)")
|
|
|
|
DEFINE_VALUE("resource_handle", "(drw_resourceChunk * DRW_RESOURCE_CHUNK_LEN + resource_id)")
|
|
|
|
.push_constant(Type::INT, "drw_resourceChunk");
|
|
|
|
PUSH_CONSTANT(INT, drw_resourceChunk)
|
|
|
|
|
|
|
|
GPU_SHADER_CREATE_END()
|
|
|
|
|
|
|
|
|
|
|
|
/** \} */
|
|
|
|
/** \} */
|
|
|
|
|
|
|
|
|
|
|
@ -47,36 +53,38 @@ GPU_SHADER_CREATE_INFO(draw_resource_handle)
|
|
|
|
* \{ */
|
|
|
|
* \{ */
|
|
|
|
|
|
|
|
|
|
|
|
GPU_SHADER_CREATE_INFO(draw_view)
|
|
|
|
GPU_SHADER_CREATE_INFO(draw_view)
|
|
|
|
.uniform_buf(DRW_VIEW_UBO_SLOT, "ViewMatrices", "drw_view_[DRW_VIEW_LEN]", Frequency::PASS)
|
|
|
|
UNIFORM_BUF_FREQ(DRW_VIEW_UBO_SLOT, ViewMatrices, drw_view_[DRW_VIEW_LEN], PASS)
|
|
|
|
.define("DRAW_VIEW_CREATE_INFO")
|
|
|
|
DEFINE("DRAW_VIEW_CREATE_INFO")
|
|
|
|
.define("drw_view", "drw_view_[drw_view_id]")
|
|
|
|
DEFINE_VALUE("drw_view", "drw_view_[drw_view_id]")
|
|
|
|
.typedef_source("draw_shader_shared.hh");
|
|
|
|
TYPEDEF_SOURCE("draw_shader_shared.hh")
|
|
|
|
|
|
|
|
GPU_SHADER_CREATE_END()
|
|
|
|
|
|
|
|
|
|
|
|
GPU_SHADER_CREATE_INFO(draw_view_culling)
|
|
|
|
GPU_SHADER_CREATE_INFO(draw_view_culling)
|
|
|
|
.uniform_buf(DRW_VIEW_CULLING_UBO_SLOT, "ViewCullingData", "drw_view_culling_[DRW_VIEW_LEN]")
|
|
|
|
UNIFORM_BUF(DRW_VIEW_CULLING_UBO_SLOT, ViewCullingData, drw_view_culling_[DRW_VIEW_LEN])
|
|
|
|
.define("DRW_VIEW_CULLING_INFO")
|
|
|
|
DEFINE("DRW_VIEW_CULLING_INFO")
|
|
|
|
.define("drw_view_culling", "drw_view_culling_[drw_view_id]")
|
|
|
|
DEFINE_VALUE("drw_view_culling", "drw_view_culling_[drw_view_id]")
|
|
|
|
.typedef_source("draw_shader_shared.hh");
|
|
|
|
TYPEDEF_SOURCE("draw_shader_shared.hh")
|
|
|
|
|
|
|
|
GPU_SHADER_CREATE_END()
|
|
|
|
|
|
|
|
|
|
|
|
GPU_SHADER_CREATE_INFO(draw_modelmat)
|
|
|
|
GPU_SHADER_CREATE_INFO(draw_modelmat)
|
|
|
|
.uniform_buf(DRW_OBJ_MAT_UBO_SLOT,
|
|
|
|
UNIFORM_BUF_FREQ(DRW_OBJ_MAT_UBO_SLOT, ObjectMatrices, drw_matrices[DRW_RESOURCE_CHUNK_LEN], BATCH)
|
|
|
|
"ObjectMatrices",
|
|
|
|
DEFINE_VALUE("ModelMatrix", "(drw_matrices[resource_id].model)")
|
|
|
|
"drw_matrices[DRW_RESOURCE_CHUNK_LEN]",
|
|
|
|
DEFINE_VALUE("ModelMatrixInverse", "(drw_matrices[resource_id].model_inverse)")
|
|
|
|
Frequency::BATCH)
|
|
|
|
ADDITIONAL_INFO(draw_view)
|
|
|
|
.define("ModelMatrix", "(drw_matrices[resource_id].model)")
|
|
|
|
GPU_SHADER_CREATE_END()
|
|
|
|
.define("ModelMatrixInverse", "(drw_matrices[resource_id].model_inverse)")
|
|
|
|
|
|
|
|
.additional_info("draw_view");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
GPU_SHADER_CREATE_INFO(draw_modelmat_legacy)
|
|
|
|
GPU_SHADER_CREATE_INFO(draw_modelmat_legacy)
|
|
|
|
.define("DRW_LEGACY_MODEL_MATRIX")
|
|
|
|
DEFINE("DRW_LEGACY_MODEL_MATRIX")
|
|
|
|
.push_constant(Type::MAT4, "ModelMatrix")
|
|
|
|
PUSH_CONSTANT(MAT4, ModelMatrix)
|
|
|
|
.push_constant(Type::MAT4, "ModelMatrixInverse")
|
|
|
|
PUSH_CONSTANT(MAT4, ModelMatrixInverse)
|
|
|
|
.additional_info("draw_view");
|
|
|
|
ADDITIONAL_INFO(draw_view)
|
|
|
|
|
|
|
|
GPU_SHADER_CREATE_END()
|
|
|
|
|
|
|
|
|
|
|
|
GPU_SHADER_CREATE_INFO(draw_modelmat_instanced_attr)
|
|
|
|
GPU_SHADER_CREATE_INFO(draw_modelmat_instanced_attr)
|
|
|
|
.push_constant(Type::MAT4, "ModelMatrix")
|
|
|
|
PUSH_CONSTANT(MAT4, ModelMatrix)
|
|
|
|
.push_constant(Type::MAT4, "ModelMatrixInverse")
|
|
|
|
PUSH_CONSTANT(MAT4, ModelMatrixInverse)
|
|
|
|
.additional_info("draw_view");
|
|
|
|
ADDITIONAL_INFO(draw_view)
|
|
|
|
|
|
|
|
GPU_SHADER_CREATE_END()
|
|
|
|
|
|
|
|
|
|
|
|
/** \} */
|
|
|
|
/** \} */
|
|
|
|
|
|
|
|
|
|
|
@ -86,8 +94,9 @@ GPU_SHADER_CREATE_INFO(draw_modelmat_instanced_attr)
|
|
|
|
|
|
|
|
|
|
|
|
GPU_SHADER_CREATE_INFO(drw_clipped)
|
|
|
|
GPU_SHADER_CREATE_INFO(drw_clipped)
|
|
|
|
/* TODO(fclem): Move to engine side. */
|
|
|
|
/* TODO(fclem): Move to engine side. */
|
|
|
|
.uniform_buf(DRW_CLIPPING_UBO_SLOT, "vec4", "drw_clipping_[6]", Frequency::PASS)
|
|
|
|
UNIFORM_BUF_FREQ(DRW_CLIPPING_UBO_SLOT, vec4, drw_clipping_[6], PASS)
|
|
|
|
.define("USE_WORLD_CLIP_PLANES");
|
|
|
|
DEFINE("USE_WORLD_CLIP_PLANES")
|
|
|
|
|
|
|
|
GPU_SHADER_CREATE_END()
|
|
|
|
|
|
|
|
|
|
|
|
/** \} */
|
|
|
|
/** \} */
|
|
|
|
|
|
|
|
|
|
|
@ -96,8 +105,9 @@ GPU_SHADER_CREATE_INFO(drw_clipped)
|
|
|
|
* \{ */
|
|
|
|
* \{ */
|
|
|
|
|
|
|
|
|
|
|
|
GPU_SHADER_CREATE_INFO(draw_globals)
|
|
|
|
GPU_SHADER_CREATE_INFO(draw_globals)
|
|
|
|
.typedef_source("draw_common_shader_shared.hh")
|
|
|
|
TYPEDEF_SOURCE("draw_common_shader_shared.hh")
|
|
|
|
.uniform_buf(7, "GlobalsUboStorage", "globalsBlock", Frequency::PASS);
|
|
|
|
UNIFORM_BUF_FREQ(7, GlobalsUboStorage, globalsBlock, PASS)
|
|
|
|
|
|
|
|
GPU_SHADER_CREATE_END()
|
|
|
|
|
|
|
|
|
|
|
|
/** \} */
|
|
|
|
/** \} */
|
|
|
|
|
|
|
|
|
|
|
@ -106,91 +116,101 @@ GPU_SHADER_CREATE_INFO(draw_globals)
|
|
|
|
* \{ */
|
|
|
|
* \{ */
|
|
|
|
|
|
|
|
|
|
|
|
GPU_SHADER_CREATE_INFO(draw_mesh)
|
|
|
|
GPU_SHADER_CREATE_INFO(draw_mesh)
|
|
|
|
.additional_info("draw_modelmat")
|
|
|
|
ADDITIONAL_INFO(draw_modelmat)
|
|
|
|
.additional_info("draw_resource_id");
|
|
|
|
ADDITIONAL_INFO(draw_resource_id)
|
|
|
|
|
|
|
|
GPU_SHADER_CREATE_END()
|
|
|
|
|
|
|
|
|
|
|
|
GPU_SHADER_CREATE_INFO(draw_mesh_new)
|
|
|
|
GPU_SHADER_CREATE_INFO(draw_mesh_new)
|
|
|
|
.additional_info("draw_modelmat_new")
|
|
|
|
ADDITIONAL_INFO(draw_modelmat_new)
|
|
|
|
.additional_info("draw_resource_id");
|
|
|
|
ADDITIONAL_INFO(draw_resource_id)
|
|
|
|
|
|
|
|
GPU_SHADER_CREATE_END()
|
|
|
|
|
|
|
|
|
|
|
|
GPU_SHADER_CREATE_INFO(draw_hair)
|
|
|
|
GPU_SHADER_CREATE_INFO(draw_hair)
|
|
|
|
.define("HAIR_SHADER")
|
|
|
|
DEFINE("HAIR_SHADER")
|
|
|
|
.define("DRW_HAIR_INFO")
|
|
|
|
DEFINE("DRW_HAIR_INFO")
|
|
|
|
.sampler(15, ImageType::FLOAT_BUFFER, "hairPointBuffer")
|
|
|
|
SAMPLER(15, FLOAT_BUFFER, hairPointBuffer)
|
|
|
|
/* TODO(@fclem): Pack these into one UBO. */
|
|
|
|
/* TODO(@fclem): Pack these into one UBO. */
|
|
|
|
.push_constant(Type::INT, "hairStrandsRes")
|
|
|
|
PUSH_CONSTANT(INT, hairStrandsRes)
|
|
|
|
.push_constant(Type::INT, "hairThicknessRes")
|
|
|
|
PUSH_CONSTANT(INT, hairThicknessRes)
|
|
|
|
.push_constant(Type::FLOAT, "hairRadRoot")
|
|
|
|
PUSH_CONSTANT(FLOAT, hairRadRoot)
|
|
|
|
.push_constant(Type::FLOAT, "hairRadTip")
|
|
|
|
PUSH_CONSTANT(FLOAT, hairRadTip)
|
|
|
|
.push_constant(Type::FLOAT, "hairRadShape")
|
|
|
|
PUSH_CONSTANT(FLOAT, hairRadShape)
|
|
|
|
.push_constant(Type::BOOL, "hairCloseTip")
|
|
|
|
PUSH_CONSTANT(BOOL, hairCloseTip)
|
|
|
|
.push_constant(Type::INT, "hairStrandOffset")
|
|
|
|
PUSH_CONSTANT(INT, hairStrandOffset)
|
|
|
|
.push_constant(Type::MAT4, "hairDupliMatrix")
|
|
|
|
PUSH_CONSTANT(MAT4, hairDupliMatrix)
|
|
|
|
.additional_info("draw_modelmat")
|
|
|
|
ADDITIONAL_INFO(draw_modelmat)
|
|
|
|
.additional_info("draw_resource_id");
|
|
|
|
ADDITIONAL_INFO(draw_resource_id)
|
|
|
|
|
|
|
|
GPU_SHADER_CREATE_END()
|
|
|
|
|
|
|
|
|
|
|
|
GPU_SHADER_CREATE_INFO(draw_hair_new)
|
|
|
|
GPU_SHADER_CREATE_INFO(draw_hair_new)
|
|
|
|
.define("HAIR_SHADER")
|
|
|
|
DEFINE("HAIR_SHADER")
|
|
|
|
.define("DRW_HAIR_INFO")
|
|
|
|
DEFINE("DRW_HAIR_INFO")
|
|
|
|
.sampler(0, ImageType::FLOAT_BUFFER, "hairPointBuffer")
|
|
|
|
SAMPLER(0, FLOAT_BUFFER, hairPointBuffer)
|
|
|
|
/* TODO(@fclem): Pack these into one UBO. */
|
|
|
|
/* TODO(@fclem): Pack these into one UBO. */
|
|
|
|
.push_constant(Type::INT, "hairStrandsRes")
|
|
|
|
PUSH_CONSTANT(INT, hairStrandsRes)
|
|
|
|
.push_constant(Type::INT, "hairThicknessRes")
|
|
|
|
PUSH_CONSTANT(INT, hairThicknessRes)
|
|
|
|
.push_constant(Type::FLOAT, "hairRadRoot")
|
|
|
|
PUSH_CONSTANT(FLOAT, hairRadRoot)
|
|
|
|
.push_constant(Type::FLOAT, "hairRadTip")
|
|
|
|
PUSH_CONSTANT(FLOAT, hairRadTip)
|
|
|
|
.push_constant(Type::FLOAT, "hairRadShape")
|
|
|
|
PUSH_CONSTANT(FLOAT, hairRadShape)
|
|
|
|
.push_constant(Type::BOOL, "hairCloseTip")
|
|
|
|
PUSH_CONSTANT(BOOL, hairCloseTip)
|
|
|
|
.push_constant(Type::INT, "hairStrandOffset")
|
|
|
|
PUSH_CONSTANT(INT, hairStrandOffset)
|
|
|
|
.push_constant(Type::MAT4, "hairDupliMatrix");
|
|
|
|
PUSH_CONSTANT(MAT4, hairDupliMatrix)
|
|
|
|
|
|
|
|
GPU_SHADER_CREATE_END()
|
|
|
|
|
|
|
|
|
|
|
|
GPU_SHADER_CREATE_INFO(draw_pointcloud)
|
|
|
|
GPU_SHADER_CREATE_INFO(draw_pointcloud)
|
|
|
|
.sampler(0, ImageType::FLOAT_BUFFER, "ptcloud_pos_rad_tx", Frequency::BATCH)
|
|
|
|
SAMPLER_FREQ(0, FLOAT_BUFFER, ptcloud_pos_rad_tx, BATCH)
|
|
|
|
.define("POINTCLOUD_SHADER")
|
|
|
|
DEFINE("POINTCLOUD_SHADER")
|
|
|
|
.define("DRW_POINTCLOUD_INFO")
|
|
|
|
DEFINE("DRW_POINTCLOUD_INFO")
|
|
|
|
.additional_info("draw_modelmat_instanced_attr")
|
|
|
|
ADDITIONAL_INFO(draw_modelmat_instanced_attr)
|
|
|
|
.additional_info("draw_resource_id_uniform");
|
|
|
|
ADDITIONAL_INFO(draw_resource_id_uniform)
|
|
|
|
|
|
|
|
GPU_SHADER_CREATE_END()
|
|
|
|
|
|
|
|
|
|
|
|
GPU_SHADER_CREATE_INFO(draw_pointcloud_new)
|
|
|
|
GPU_SHADER_CREATE_INFO(draw_pointcloud_new)
|
|
|
|
.sampler(0, ImageType::FLOAT_BUFFER, "ptcloud_pos_rad_tx", Frequency::BATCH)
|
|
|
|
SAMPLER_FREQ(0, FLOAT_BUFFER, ptcloud_pos_rad_tx, BATCH)
|
|
|
|
.define("POINTCLOUD_SHADER")
|
|
|
|
DEFINE("POINTCLOUD_SHADER")
|
|
|
|
.define("DRW_POINTCLOUD_INFO");
|
|
|
|
DEFINE("DRW_POINTCLOUD_INFO")
|
|
|
|
|
|
|
|
GPU_SHADER_CREATE_END()
|
|
|
|
|
|
|
|
|
|
|
|
GPU_SHADER_CREATE_INFO(draw_volume)
|
|
|
|
GPU_SHADER_CREATE_INFO(draw_volume)
|
|
|
|
.additional_info("draw_modelmat")
|
|
|
|
ADDITIONAL_INFO(draw_modelmat)
|
|
|
|
.additional_info("draw_resource_id_uniform");
|
|
|
|
ADDITIONAL_INFO(draw_resource_id_uniform)
|
|
|
|
|
|
|
|
GPU_SHADER_CREATE_END()
|
|
|
|
|
|
|
|
|
|
|
|
GPU_SHADER_CREATE_INFO(draw_volume_new)
|
|
|
|
GPU_SHADER_CREATE_INFO(draw_volume_new)
|
|
|
|
.additional_info("draw_modelmat_new")
|
|
|
|
ADDITIONAL_INFO(draw_modelmat_new)
|
|
|
|
.additional_info("draw_resource_handle_new");
|
|
|
|
ADDITIONAL_INFO(draw_resource_handle_new)
|
|
|
|
|
|
|
|
GPU_SHADER_CREATE_END()
|
|
|
|
|
|
|
|
|
|
|
|
GPU_SHADER_CREATE_INFO(draw_gpencil)
|
|
|
|
GPU_SHADER_CREATE_INFO(draw_gpencil)
|
|
|
|
.typedef_source("gpencil_shader_shared.h")
|
|
|
|
TYPEDEF_SOURCE("gpencil_shader_shared.h")
|
|
|
|
.define("DRW_GPENCIL_INFO")
|
|
|
|
DEFINE("DRW_GPENCIL_INFO")
|
|
|
|
.sampler(0, ImageType::FLOAT_BUFFER, "gp_pos_tx")
|
|
|
|
SAMPLER(0, FLOAT_BUFFER, gp_pos_tx)
|
|
|
|
.sampler(1, ImageType::FLOAT_BUFFER, "gp_col_tx")
|
|
|
|
SAMPLER(1, FLOAT_BUFFER, gp_col_tx)
|
|
|
|
/* Per Object */
|
|
|
|
/* Per Object */
|
|
|
|
.push_constant(Type::FLOAT, "gpThicknessScale") /* TODO(fclem): Replace with object info. */
|
|
|
|
PUSH_CONSTANT(FLOAT, gpThicknessScale) /* TODO(fclem): Replace with object info. */
|
|
|
|
.push_constant(Type::FLOAT, "gpThicknessWorldScale") /* TODO(fclem): Same as above. */
|
|
|
|
PUSH_CONSTANT(FLOAT, gpThicknessWorldScale) /* TODO(fclem): Same as above. */
|
|
|
|
.define("gpThicknessIsScreenSpace", "(gpThicknessWorldScale < 0.0)")
|
|
|
|
DEFINE_VALUE("gpThicknessIsScreenSpace", "(gpThicknessWorldScale < 0.0)")
|
|
|
|
/* Per Layer */
|
|
|
|
/* Per Layer */
|
|
|
|
.push_constant(Type::FLOAT, "gpThicknessOffset")
|
|
|
|
PUSH_CONSTANT(FLOAT, gpThicknessOffset)
|
|
|
|
.additional_info("draw_modelmat")
|
|
|
|
ADDITIONAL_INFO(draw_modelmat)
|
|
|
|
.additional_info("draw_object_infos");
|
|
|
|
ADDITIONAL_INFO(draw_object_infos)
|
|
|
|
|
|
|
|
GPU_SHADER_CREATE_END()
|
|
|
|
|
|
|
|
|
|
|
|
GPU_SHADER_CREATE_INFO(draw_gpencil_new)
|
|
|
|
GPU_SHADER_CREATE_INFO(draw_gpencil_new)
|
|
|
|
.typedef_source("gpencil_shader_shared.h")
|
|
|
|
TYPEDEF_SOURCE("gpencil_shader_shared.h")
|
|
|
|
.define("DRW_GPENCIL_INFO")
|
|
|
|
DEFINE("DRW_GPENCIL_INFO")
|
|
|
|
.sampler(0, ImageType::FLOAT_BUFFER, "gp_pos_tx")
|
|
|
|
SAMPLER(0, FLOAT_BUFFER, gp_pos_tx)
|
|
|
|
.sampler(1, ImageType::FLOAT_BUFFER, "gp_col_tx")
|
|
|
|
SAMPLER(1, FLOAT_BUFFER, gp_col_tx)
|
|
|
|
/* Per Object */
|
|
|
|
/* Per Object */
|
|
|
|
.push_constant(Type::FLOAT, "gpThicknessScale") /* TODO(fclem): Replace with object info. */
|
|
|
|
PUSH_CONSTANT(FLOAT, gpThicknessScale) /* TODO(fclem): Replace with object info. */
|
|
|
|
.push_constant(Type::FLOAT, "gpThicknessWorldScale") /* TODO(fclem): Same as above. */
|
|
|
|
PUSH_CONSTANT(FLOAT, gpThicknessWorldScale) /* TODO(fclem): Same as above. */
|
|
|
|
.define("gpThicknessIsScreenSpace", "(gpThicknessWorldScale < 0.0)")
|
|
|
|
DEFINE_VALUE("gpThicknessIsScreenSpace", "(gpThicknessWorldScale < 0.0)")
|
|
|
|
/* Per Layer */
|
|
|
|
/* Per Layer */
|
|
|
|
.push_constant(Type::FLOAT, "gpThicknessOffset")
|
|
|
|
PUSH_CONSTANT(FLOAT, gpThicknessOffset)
|
|
|
|
.additional_info("draw_resource_id_varying")
|
|
|
|
ADDITIONAL_INFO(draw_resource_id_varying)
|
|
|
|
.additional_info("draw_view")
|
|
|
|
ADDITIONAL_INFO(draw_view)
|
|
|
|
.additional_info("draw_object_infos_new");
|
|
|
|
ADDITIONAL_INFO(draw_object_infos_new)
|
|
|
|
|
|
|
|
GPU_SHADER_CREATE_END()
|
|
|
|
|
|
|
|
|
|
|
|
/** \} */
|
|
|
|
/** \} */
|
|
|
|
|
|
|
|
|
|
|
@ -199,52 +219,56 @@ GPU_SHADER_CREATE_INFO(draw_gpencil_new)
|
|
|
|
* \{ */
|
|
|
|
* \{ */
|
|
|
|
|
|
|
|
|
|
|
|
GPU_SHADER_CREATE_INFO(draw_resource_finalize)
|
|
|
|
GPU_SHADER_CREATE_INFO(draw_resource_finalize)
|
|
|
|
.do_static_compilation(true)
|
|
|
|
DO_STATIC_COMPILATION()
|
|
|
|
.typedef_source("draw_shader_shared.hh")
|
|
|
|
TYPEDEF_SOURCE("draw_shader_shared.hh")
|
|
|
|
.define("DRAW_FINALIZE_SHADER")
|
|
|
|
DEFINE("DRAW_FINALIZE_SHADER")
|
|
|
|
.local_group_size(DRW_FINALIZE_GROUP_SIZE)
|
|
|
|
LOCAL_GROUP_SIZE(DRW_FINALIZE_GROUP_SIZE)
|
|
|
|
.storage_buf(0, Qualifier::READ, "ObjectMatrices", "matrix_buf[]")
|
|
|
|
STORAGE_BUF(0, READ, ObjectMatrices, matrix_buf[])
|
|
|
|
.storage_buf(1, Qualifier::READ_WRITE, "ObjectBounds", "bounds_buf[]")
|
|
|
|
STORAGE_BUF(1, READ_WRITE, ObjectBounds, bounds_buf[])
|
|
|
|
.storage_buf(2, Qualifier::READ_WRITE, "ObjectInfos", "infos_buf[]")
|
|
|
|
STORAGE_BUF(2, READ_WRITE, ObjectInfos, infos_buf[])
|
|
|
|
.push_constant(Type::INT, "resource_len")
|
|
|
|
PUSH_CONSTANT(INT, resource_len)
|
|
|
|
.compute_source("draw_resource_finalize_comp.glsl");
|
|
|
|
COMPUTE_SOURCE("draw_resource_finalize_comp.glsl")
|
|
|
|
|
|
|
|
GPU_SHADER_CREATE_END()
|
|
|
|
|
|
|
|
|
|
|
|
GPU_SHADER_CREATE_INFO(draw_view_finalize)
|
|
|
|
GPU_SHADER_CREATE_INFO(draw_view_finalize)
|
|
|
|
.do_static_compilation(true)
|
|
|
|
DO_STATIC_COMPILATION()
|
|
|
|
.local_group_size(DRW_VIEW_MAX)
|
|
|
|
LOCAL_GROUP_SIZE(DRW_VIEW_MAX)
|
|
|
|
.define("DRW_VIEW_LEN", STRINGIFY(DRW_VIEW_MAX))
|
|
|
|
DEFINE_VALUE("DRW_VIEW_LEN", STRINGIFY(DRW_VIEW_MAX))
|
|
|
|
.storage_buf(0, Qualifier::READ_WRITE, "ViewCullingData", "view_culling_buf[DRW_VIEW_LEN]")
|
|
|
|
STORAGE_BUF(0, READ_WRITE, ViewCullingData, view_culling_buf[DRW_VIEW_LEN])
|
|
|
|
.compute_source("draw_view_finalize_comp.glsl")
|
|
|
|
COMPUTE_SOURCE("draw_view_finalize_comp.glsl")
|
|
|
|
.additional_info("draw_view");
|
|
|
|
ADDITIONAL_INFO(draw_view)
|
|
|
|
|
|
|
|
GPU_SHADER_CREATE_END()
|
|
|
|
|
|
|
|
|
|
|
|
GPU_SHADER_CREATE_INFO(draw_visibility_compute)
|
|
|
|
GPU_SHADER_CREATE_INFO(draw_visibility_compute)
|
|
|
|
.do_static_compilation(true)
|
|
|
|
DO_STATIC_COMPILATION()
|
|
|
|
.local_group_size(DRW_VISIBILITY_GROUP_SIZE)
|
|
|
|
LOCAL_GROUP_SIZE(DRW_VISIBILITY_GROUP_SIZE)
|
|
|
|
.define("DRW_VIEW_LEN", STRINGIFY(DRW_VIEW_MAX))
|
|
|
|
DEFINE_VALUE("DRW_VIEW_LEN", STRINGIFY(DRW_VIEW_MAX))
|
|
|
|
.storage_buf(0, Qualifier::READ, "ObjectBounds", "bounds_buf[]")
|
|
|
|
STORAGE_BUF(0, READ, ObjectBounds, bounds_buf[])
|
|
|
|
.storage_buf(1, Qualifier::READ_WRITE, "uint", "visibility_buf[]")
|
|
|
|
STORAGE_BUF(1, READ_WRITE, uint, visibility_buf[])
|
|
|
|
.push_constant(Type::INT, "resource_len")
|
|
|
|
PUSH_CONSTANT(INT, resource_len)
|
|
|
|
.push_constant(Type::INT, "view_len")
|
|
|
|
PUSH_CONSTANT(INT, view_len)
|
|
|
|
.push_constant(Type::INT, "visibility_word_per_draw")
|
|
|
|
PUSH_CONSTANT(INT, visibility_word_per_draw)
|
|
|
|
.compute_source("draw_visibility_comp.glsl")
|
|
|
|
COMPUTE_SOURCE("draw_visibility_comp.glsl")
|
|
|
|
.additional_info("draw_view")
|
|
|
|
ADDITIONAL_INFO(draw_view)
|
|
|
|
.additional_info("draw_view_culling");
|
|
|
|
ADDITIONAL_INFO(draw_view_culling)
|
|
|
|
|
|
|
|
GPU_SHADER_CREATE_END()
|
|
|
|
|
|
|
|
|
|
|
|
GPU_SHADER_CREATE_INFO(draw_command_generate)
|
|
|
|
GPU_SHADER_CREATE_INFO(draw_command_generate)
|
|
|
|
.do_static_compilation(true)
|
|
|
|
DO_STATIC_COMPILATION()
|
|
|
|
.typedef_source("draw_shader_shared.hh")
|
|
|
|
TYPEDEF_SOURCE("draw_shader_shared.hh")
|
|
|
|
.typedef_source("draw_command_shared.hh")
|
|
|
|
TYPEDEF_SOURCE("draw_command_shared.hh")
|
|
|
|
.local_group_size(DRW_COMMAND_GROUP_SIZE)
|
|
|
|
LOCAL_GROUP_SIZE(DRW_COMMAND_GROUP_SIZE)
|
|
|
|
.storage_buf(0, Qualifier::READ_WRITE, "DrawGroup", "group_buf[]")
|
|
|
|
STORAGE_BUF(0, READ_WRITE, DrawGroup, group_buf[])
|
|
|
|
.storage_buf(1, Qualifier::READ, "uint", "visibility_buf[]")
|
|
|
|
STORAGE_BUF(1, READ, uint, visibility_buf[])
|
|
|
|
.storage_buf(2, Qualifier::READ, "DrawPrototype", "prototype_buf[]")
|
|
|
|
STORAGE_BUF(2, READ, DrawPrototype, prototype_buf[])
|
|
|
|
.storage_buf(3, Qualifier::WRITE, "DrawCommand", "command_buf[]")
|
|
|
|
STORAGE_BUF(3, WRITE, DrawCommand, command_buf[])
|
|
|
|
.storage_buf(DRW_RESOURCE_ID_SLOT, Qualifier::WRITE, "uint", "resource_id_buf[]")
|
|
|
|
STORAGE_BUF(DRW_RESOURCE_ID_SLOT, WRITE, uint, resource_id_buf[])
|
|
|
|
.push_constant(Type::INT, "prototype_len")
|
|
|
|
PUSH_CONSTANT(INT, prototype_len)
|
|
|
|
.push_constant(Type::INT, "visibility_word_per_draw")
|
|
|
|
PUSH_CONSTANT(INT, visibility_word_per_draw)
|
|
|
|
.push_constant(Type::INT, "view_shift")
|
|
|
|
PUSH_CONSTANT(INT, view_shift)
|
|
|
|
.push_constant(Type::BOOL, "use_custom_ids")
|
|
|
|
PUSH_CONSTANT(BOOL, use_custom_ids)
|
|
|
|
.compute_source("draw_command_generate_comp.glsl");
|
|
|
|
COMPUTE_SOURCE("draw_command_generate_comp.glsl")
|
|
|
|
|
|
|
|
GPU_SHADER_CREATE_END()
|
|
|
|
|
|
|
|
|
|
|
|
/** \} */
|
|
|
|
/** \} */
|
|
|
|
|
|
|
|
|
|
|
@ -254,35 +278,41 @@ GPU_SHADER_CREATE_INFO(draw_command_generate)
|
|
|
|
* \{ */
|
|
|
|
* \{ */
|
|
|
|
|
|
|
|
|
|
|
|
GPU_SHADER_CREATE_INFO(draw_resource_id_new)
|
|
|
|
GPU_SHADER_CREATE_INFO(draw_resource_id_new)
|
|
|
|
.define("UNIFORM_RESOURCE_ID_NEW")
|
|
|
|
DEFINE("UNIFORM_RESOURCE_ID_NEW")
|
|
|
|
/* TODO (Miguel Pozo): This is an int for compatibility.
|
|
|
|
/* TODO (Miguel Pozo): This is an int for compatibility.
|
|
|
|
* It should become uint once the "Next" ports are complete. */
|
|
|
|
* It should become uint once the "Next" ports are complete. */
|
|
|
|
.storage_buf(DRW_RESOURCE_ID_SLOT, Qualifier::READ, "int", "resource_id_buf[]")
|
|
|
|
STORAGE_BUF(DRW_RESOURCE_ID_SLOT, READ, int, resource_id_buf[])
|
|
|
|
.define("drw_ResourceID", "resource_id_buf[gpu_BaseInstance + gl_InstanceID]");
|
|
|
|
DEFINE_VALUE("drw_ResourceID", "resource_id_buf[gpu_BaseInstance + gl_InstanceID]")
|
|
|
|
|
|
|
|
GPU_SHADER_CREATE_END()
|
|
|
|
|
|
|
|
|
|
|
|
GPU_SHADER_CREATE_INFO(draw_resource_with_custom_id_new)
|
|
|
|
GPU_SHADER_CREATE_INFO(draw_resource_with_custom_id_new)
|
|
|
|
.define("UNIFORM_RESOURCE_ID_NEW")
|
|
|
|
DEFINE("UNIFORM_RESOURCE_ID_NEW")
|
|
|
|
.define("WITH_CUSTOM_IDS")
|
|
|
|
DEFINE("WITH_CUSTOM_IDS")
|
|
|
|
.storage_buf(DRW_RESOURCE_ID_SLOT, Qualifier::READ, "int2", "resource_id_buf[]")
|
|
|
|
STORAGE_BUF(DRW_RESOURCE_ID_SLOT, READ, int2, resource_id_buf[])
|
|
|
|
.define("drw_ResourceID", "resource_id_buf[gpu_BaseInstance + gl_InstanceID].x")
|
|
|
|
DEFINE_VALUE("drw_ResourceID", "resource_id_buf[gpu_BaseInstance + gl_InstanceID].x")
|
|
|
|
.define("drw_CustomID", "resource_id_buf[gpu_BaseInstance + gl_InstanceID].y");
|
|
|
|
DEFINE_VALUE("drw_CustomID", "resource_id_buf[gpu_BaseInstance + gl_InstanceID].y")
|
|
|
|
|
|
|
|
GPU_SHADER_CREATE_END()
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Workaround the lack of gl_BaseInstance by binding the resource_id_buf as vertex buf.
|
|
|
|
* Workaround the lack of gl_BaseInstance by binding the resource_id_buf as vertex buf.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
GPU_SHADER_CREATE_INFO(draw_resource_id_fallback)
|
|
|
|
GPU_SHADER_CREATE_INFO(draw_resource_id_fallback)
|
|
|
|
.define("UNIFORM_RESOURCE_ID_NEW")
|
|
|
|
DEFINE("UNIFORM_RESOURCE_ID_NEW")
|
|
|
|
.vertex_in(15, Type::INT, "drw_ResourceID");
|
|
|
|
VERTEX_IN(15, INT, drw_ResourceID)
|
|
|
|
|
|
|
|
GPU_SHADER_CREATE_END()
|
|
|
|
|
|
|
|
|
|
|
|
GPU_SHADER_CREATE_INFO(draw_resource_with_custom_id_fallback)
|
|
|
|
GPU_SHADER_CREATE_INFO(draw_resource_with_custom_id_fallback)
|
|
|
|
.define("UNIFORM_RESOURCE_ID_NEW")
|
|
|
|
DEFINE("UNIFORM_RESOURCE_ID_NEW")
|
|
|
|
.define("WITH_CUSTOM_IDS")
|
|
|
|
DEFINE("WITH_CUSTOM_IDS")
|
|
|
|
.vertex_in(15, Type::IVEC2, "vertex_in_drw_ResourceID")
|
|
|
|
VERTEX_IN(15, IVEC2, vertex_in_drw_ResourceID)
|
|
|
|
.define("drw_ResourceID", "vertex_in_drw_ResourceID.x")
|
|
|
|
DEFINE_VALUE("drw_ResourceID", "vertex_in_drw_ResourceID.x")
|
|
|
|
.define("drw_CustomID", "vertex_in_drw_ResourceID.y");
|
|
|
|
DEFINE_VALUE("drw_CustomID", "vertex_in_drw_ResourceID.y")
|
|
|
|
|
|
|
|
GPU_SHADER_CREATE_END()
|
|
|
|
|
|
|
|
|
|
|
|
/** TODO mask view id bits. */
|
|
|
|
/** TODO mask view id bits. */
|
|
|
|
GPU_SHADER_CREATE_INFO(draw_resource_handle_new).define("resource_handle", "drw_ResourceID");
|
|
|
|
GPU_SHADER_CREATE_INFO(draw_resource_handle_new)
|
|
|
|
|
|
|
|
DEFINE_VALUE("resource_handle", "drw_ResourceID")
|
|
|
|
|
|
|
|
GPU_SHADER_CREATE_END()
|
|
|
|
|
|
|
|
|
|
|
|
/** \} */
|
|
|
|
/** \} */
|
|
|
|
|
|
|
|
|
|
|
@ -291,21 +321,24 @@ GPU_SHADER_CREATE_INFO(draw_resource_handle_new).define("resource_handle", "drw_
|
|
|
|
* \{ */
|
|
|
|
* \{ */
|
|
|
|
|
|
|
|
|
|
|
|
GPU_SHADER_CREATE_INFO(draw_modelmat_new_common)
|
|
|
|
GPU_SHADER_CREATE_INFO(draw_modelmat_new_common)
|
|
|
|
.typedef_source("draw_shader_shared.hh")
|
|
|
|
TYPEDEF_SOURCE("draw_shader_shared.hh")
|
|
|
|
.storage_buf(DRW_OBJ_MAT_SLOT, Qualifier::READ, "ObjectMatrices", "drw_matrix_buf[]")
|
|
|
|
STORAGE_BUF(DRW_OBJ_MAT_SLOT, READ, ObjectMatrices, drw_matrix_buf[])
|
|
|
|
.define("DRAW_MODELMAT_CREATE_INFO")
|
|
|
|
DEFINE("DRAW_MODELMAT_CREATE_INFO")
|
|
|
|
.define("drw_ModelMatrixInverse", "drw_matrix_buf[resource_id].model_inverse")
|
|
|
|
DEFINE_VALUE("drw_ModelMatrixInverse", "drw_matrix_buf[resource_id].model_inverse")
|
|
|
|
.define("drw_ModelMatrix", "drw_matrix_buf[resource_id].model")
|
|
|
|
DEFINE_VALUE("drw_ModelMatrix", "drw_matrix_buf[resource_id].model")
|
|
|
|
/* TODO For compatibility with old shaders. To be removed. */
|
|
|
|
/* TODO For compatibility with old shaders. To be removed. */
|
|
|
|
.define("ModelMatrixInverse", "drw_ModelMatrixInverse")
|
|
|
|
DEFINE_VALUE("ModelMatrixInverse", "drw_ModelMatrixInverse")
|
|
|
|
.define("ModelMatrix", "drw_ModelMatrix");
|
|
|
|
DEFINE_VALUE("ModelMatrix", "drw_ModelMatrix")
|
|
|
|
|
|
|
|
GPU_SHADER_CREATE_END()
|
|
|
|
|
|
|
|
|
|
|
|
GPU_SHADER_CREATE_INFO(draw_modelmat_new)
|
|
|
|
GPU_SHADER_CREATE_INFO(draw_modelmat_new)
|
|
|
|
.additional_info("draw_modelmat_new_common")
|
|
|
|
ADDITIONAL_INFO(draw_modelmat_new_common)
|
|
|
|
.additional_info("draw_resource_id_new");
|
|
|
|
ADDITIONAL_INFO(draw_resource_id_new)
|
|
|
|
|
|
|
|
GPU_SHADER_CREATE_END()
|
|
|
|
|
|
|
|
|
|
|
|
GPU_SHADER_CREATE_INFO(draw_modelmat_new_with_custom_id)
|
|
|
|
GPU_SHADER_CREATE_INFO(draw_modelmat_new_with_custom_id)
|
|
|
|
.additional_info("draw_modelmat_new_common")
|
|
|
|
ADDITIONAL_INFO(draw_modelmat_new_common)
|
|
|
|
.additional_info("draw_resource_with_custom_id_new");
|
|
|
|
ADDITIONAL_INFO(draw_resource_with_custom_id_new)
|
|
|
|
|
|
|
|
GPU_SHADER_CREATE_END()
|
|
|
|
|
|
|
|
|
|
|
|
/** \} */
|
|
|
|
/** \} */
|
|
|
|