GPU: Shader Create Info GLSL-C++ stubs #3

Closed
Clément Foucault wants to merge 90 commits from create-info-cpp-macros into glsl-include

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.
Showing only changes of commit 4aa10287d2 - Show all commits

View File

@ -10,12 +10,6 @@
/** \name Shadow pipeline
* \{ */
/* NOTE(Metal): As this is implemented using a fundamental data type, this needs to be specified
* explicitly as uint for code generation, as the MSLShaderGenerator needs to be able to
* distinguish between classes and fundamental types during code generation. */
#define SHADOW_TILE_DATA_PACKED "uint"
#define SHADOW_PAGE_PACKED "uint"
GPU_SHADER_CREATE_INFO(eevee_shadow_clipmap_clear)
.do_static_compilation(true)
.local_group_size(SHADOW_CLIPMAP_GROUP_SIZE)
@ -42,7 +36,7 @@ GPU_SHADER_CREATE_INFO(eevee_shadow_tilemap_init)
.do_static_compilation(true)
.local_group_size(SHADOW_TILEMAP_RES, SHADOW_TILEMAP_RES)
.storage_buf(0, Qualifier::READ_WRITE, "ShadowTileMapData", "tilemaps_buf[]")
.storage_buf(1, Qualifier::READ_WRITE, SHADOW_TILE_DATA_PACKED, "tiles_buf[]")
.storage_buf(1, Qualifier::READ_WRITE, "uint", "tiles_buf[]")
.storage_buf(2, Qualifier::READ_WRITE, "ShadowTileMapClip", "tilemaps_clip_buf[]")
.storage_buf(4, Qualifier::READ_WRITE, "uvec2", "pages_cached_buf[]")
.additional_info("eevee_shared")
@ -52,7 +46,7 @@ GPU_SHADER_CREATE_INFO(eevee_shadow_tag_update)
.do_static_compilation(true)
.local_group_size(1, 1, 1)
.storage_buf(0, Qualifier::READ_WRITE, "ShadowTileMapData", "tilemaps_buf[]")
.storage_buf(1, Qualifier::READ_WRITE, SHADOW_TILE_DATA_PACKED, "tiles_buf[]")
.storage_buf(1, Qualifier::READ_WRITE, "uint", "tiles_buf[]")
.storage_buf(5, Qualifier::READ, "ObjectBounds", "bounds_buf[]")
.storage_buf(6, Qualifier::READ, "uint", "resource_ids_buf[]")
.additional_info("eevee_shared")
@ -64,7 +58,7 @@ GPU_SHADER_CREATE_INFO(eevee_shadow_tag_usage_opaque)
.do_static_compilation(true)
.local_group_size(SHADOW_DEPTH_SCAN_GROUP_SIZE, SHADOW_DEPTH_SCAN_GROUP_SIZE)
.storage_buf(5, Qualifier::READ_WRITE, "ShadowTileMapData", "tilemaps_buf[]")
.storage_buf(6, Qualifier::READ_WRITE, SHADOW_TILE_DATA_PACKED, "tiles_buf[]")
.storage_buf(6, Qualifier::READ_WRITE, "uint", "tiles_buf[]")
.push_constant(Type::IVEC2, "input_depth_extent")
.additional_info(
"eevee_shared", "draw_view", "draw_view_culling", "eevee_hiz_data", "eevee_light_data")
@ -74,7 +68,7 @@ GPU_SHADER_CREATE_INFO(eevee_shadow_tag_usage_surfels)
.do_static_compilation(true)
.local_group_size(SURFEL_GROUP_SIZE)
.storage_buf(6, Qualifier::READ_WRITE, "ShadowTileMapData", "tilemaps_buf[]")
.storage_buf(7, Qualifier::READ_WRITE, SHADOW_TILE_DATA_PACKED, "tiles_buf[]")
.storage_buf(7, Qualifier::READ_WRITE, "uint", "tiles_buf[]")
.push_constant(Type::INT, "directional_level")
.additional_info("eevee_shared")
.additional_info("draw_view")
@ -96,7 +90,7 @@ GPU_SHADER_CREATE_INFO(eevee_shadow_tag_usage_transparent)
.vertex_in(0, Type::VEC3, "pos")
.storage_buf(4, Qualifier::READ, "ObjectBounds", "bounds_buf[]")
.storage_buf(5, Qualifier::READ_WRITE, "ShadowTileMapData", "tilemaps_buf[]")
.storage_buf(6, Qualifier::READ_WRITE, SHADOW_TILE_DATA_PACKED, "tiles_buf[]")
.storage_buf(6, Qualifier::READ_WRITE, "uint", "tiles_buf[]")
.push_constant(Type::IVEC2, "fb_resolution")
.push_constant(Type::INT, "fb_lod")
.vertex_out(eevee_shadow_tag_transparent_iface)
@ -115,7 +109,7 @@ GPU_SHADER_CREATE_INFO(eevee_shadow_tag_usage_volume)
.do_static_compilation(true)
.local_group_size(VOLUME_GROUP_SIZE, VOLUME_GROUP_SIZE, VOLUME_GROUP_SIZE)
.storage_buf(4, Qualifier::READ_WRITE, "ShadowTileMapData", "tilemaps_buf[]")
.storage_buf(5, Qualifier::READ_WRITE, SHADOW_TILE_DATA_PACKED, "tiles_buf[]")
.storage_buf(5, Qualifier::READ_WRITE, "uint", "tiles_buf[]")
.additional_info("eevee_volume_properties_data")
.additional_info("eevee_shared")
.additional_info("draw_view")
@ -130,7 +124,7 @@ GPU_SHADER_CREATE_INFO(eevee_shadow_page_mask)
.local_group_size(SHADOW_TILEMAP_RES, SHADOW_TILEMAP_RES)
.push_constant(Type::INT, "max_view_per_tilemap")
.storage_buf(0, Qualifier::READ_WRITE, "ShadowTileMapData", "tilemaps_buf[]")
.storage_buf(1, Qualifier::READ_WRITE, SHADOW_TILE_DATA_PACKED, "tiles_buf[]")
.storage_buf(1, Qualifier::READ_WRITE, "uint", "tiles_buf[]")
.additional_info("eevee_shared")
.compute_source("eevee_shadow_page_mask_comp.glsl");
@ -138,7 +132,7 @@ GPU_SHADER_CREATE_INFO(eevee_shadow_page_free)
.do_static_compilation(true)
.local_group_size(SHADOW_TILEMAP_LOD0_LEN)
.storage_buf(0, Qualifier::READ_WRITE, "ShadowTileMapData", "tilemaps_buf[]")
.storage_buf(1, Qualifier::READ_WRITE, SHADOW_TILE_DATA_PACKED, "tiles_buf[]")
.storage_buf(1, Qualifier::READ_WRITE, "uint", "tiles_buf[]")
.storage_buf(2, Qualifier::READ_WRITE, "ShadowPagesInfoData", "pages_infos_buf")
.storage_buf(3, Qualifier::READ_WRITE, "uint", "pages_free_buf[]")
.storage_buf(4, Qualifier::READ_WRITE, "uvec2", "pages_cached_buf[]")
@ -149,7 +143,7 @@ GPU_SHADER_CREATE_INFO(eevee_shadow_page_defrag)
.do_static_compilation(true)
.local_group_size(1)
.typedef_source("draw_shader_shared.hh")
.storage_buf(1, Qualifier::READ_WRITE, SHADOW_TILE_DATA_PACKED, "tiles_buf[]")
.storage_buf(1, Qualifier::READ_WRITE, "uint", "tiles_buf[]")
.storage_buf(2, Qualifier::READ_WRITE, "ShadowPagesInfoData", "pages_infos_buf")
.storage_buf(3, Qualifier::READ_WRITE, "uint", "pages_free_buf[]")
.storage_buf(4, Qualifier::READ_WRITE, "uvec2", "pages_cached_buf[]")
@ -164,7 +158,7 @@ GPU_SHADER_CREATE_INFO(eevee_shadow_page_allocate)
.local_group_size(SHADOW_TILEMAP_LOD0_LEN)
.typedef_source("draw_shader_shared.hh")
.storage_buf(0, Qualifier::READ_WRITE, "ShadowTileMapData", "tilemaps_buf[]")
.storage_buf(1, Qualifier::READ_WRITE, SHADOW_TILE_DATA_PACKED, "tiles_buf[]")
.storage_buf(1, Qualifier::READ_WRITE, "uint", "tiles_buf[]")
.storage_buf(2, Qualifier::READ_WRITE, "ShadowPagesInfoData", "pages_infos_buf")
.storage_buf(3, Qualifier::READ_WRITE, "uint", "pages_free_buf[]")
.storage_buf(4, Qualifier::READ_WRITE, "uvec2", "pages_cached_buf[]")
@ -177,7 +171,7 @@ GPU_SHADER_CREATE_INFO(eevee_shadow_tilemap_finalize)
.typedef_source("draw_shader_shared.hh")
.local_group_size(SHADOW_TILEMAP_RES, SHADOW_TILEMAP_RES)
.storage_buf(0, Qualifier::READ, "ShadowTileMapData", "tilemaps_buf[]")
.storage_buf(1, Qualifier::READ, SHADOW_TILE_DATA_PACKED, "tiles_buf[]")
.storage_buf(1, Qualifier::READ, "uint", "tiles_buf[]")
.storage_buf(2, Qualifier::READ_WRITE, "ShadowPagesInfoData", "pages_infos_buf")
.storage_buf(3, Qualifier::READ_WRITE, "ShadowStatistics", "statistics_buf")
.storage_buf(4, Qualifier::WRITE, "ViewMatrices", "view_infos_buf[SHADOW_VIEW_MAX]")
@ -193,12 +187,12 @@ GPU_SHADER_CREATE_INFO(eevee_shadow_tilemap_rendermap)
.local_group_size(SHADOW_TILEMAP_RES, SHADOW_TILEMAP_RES)
.storage_buf(0, Qualifier::READ_WRITE, "ShadowStatistics", "statistics_buf")
.storage_buf(1, Qualifier::READ, "ShadowRenderView", "render_view_buf[SHADOW_VIEW_MAX]")
.storage_buf(2, Qualifier::READ_WRITE, SHADOW_TILE_DATA_PACKED, "tiles_buf[]")
.storage_buf(2, Qualifier::READ_WRITE, "uint", "tiles_buf[]")
.storage_buf(3, Qualifier::READ_WRITE, "DispatchCommand", "clear_dispatch_buf")
.storage_buf(4, Qualifier::READ_WRITE, "DrawCommand", "tile_draw_buf")
.storage_buf(5, Qualifier::WRITE, SHADOW_PAGE_PACKED, "dst_coord_buf[SHADOW_RENDER_MAP_SIZE]")
.storage_buf(6, Qualifier::WRITE, SHADOW_PAGE_PACKED, "src_coord_buf[SHADOW_RENDER_MAP_SIZE]")
.storage_buf(7, Qualifier::WRITE, SHADOW_PAGE_PACKED, "render_map_buf[SHADOW_RENDER_MAP_SIZE]")
.storage_buf(5, Qualifier::WRITE, "uint", "dst_coord_buf[SHADOW_RENDER_MAP_SIZE]")
.storage_buf(6, Qualifier::WRITE, "uint", "src_coord_buf[SHADOW_RENDER_MAP_SIZE]")
.storage_buf(7, Qualifier::WRITE, "uint", "render_map_buf[SHADOW_RENDER_MAP_SIZE]")
.additional_info("eevee_shared")
.compute_source("eevee_shadow_tilemap_rendermap_comp.glsl");
@ -219,7 +213,7 @@ GPU_SHADER_CREATE_INFO(eevee_shadow_page_clear)
.do_static_compilation(true)
.local_group_size(SHADOW_PAGE_CLEAR_GROUP_SIZE, SHADOW_PAGE_CLEAR_GROUP_SIZE)
.storage_buf(2, Qualifier::READ, "ShadowPagesInfoData", "pages_infos_buf")
.storage_buf(6, Qualifier::READ, SHADOW_PAGE_PACKED, "dst_coord_buf[SHADOW_RENDER_MAP_SIZE]")
.storage_buf(6, Qualifier::READ, "uint", "dst_coord_buf[SHADOW_RENDER_MAP_SIZE]")
.additional_info("eevee_shared")
.compute_source("eevee_shadow_page_clear_comp.glsl")
.image(SHADOW_ATLAS_IMG_SLOT,
@ -234,16 +228,16 @@ GPU_SHADER_CREATE_INFO(eevee_shadow_page_tile_clear)
.define("PASS_CLEAR")
.additional_info("eevee_shared")
.builtins(BuiltinBits::VIEWPORT_INDEX | BuiltinBits::LAYER)
.storage_buf(8, Qualifier::READ, SHADOW_PAGE_PACKED, "src_coord_buf[SHADOW_RENDER_MAP_SIZE]")
.storage_buf(8, Qualifier::READ, "uint", "src_coord_buf[SHADOW_RENDER_MAP_SIZE]")
.vertex_source("eevee_shadow_page_tile_vert.glsl")
.fragment_source("eevee_shadow_page_tile_frag.glsl")
.fragment_out(0, Type::FLOAT, "out_tile_depth", DualBlend::NONE, SHADOW_ROG_ID);
#ifdef APPLE
/* Metal supports USHORT which saves a bit of performance here. */
# define PAGE_Z_TYPE Type::USHORT
# define PAGE_Z_TYPE USHORT
#else
# define PAGE_Z_TYPE Type::UINT
# define PAGE_Z_TYPE UINT
#endif
/* Interface for passing precalculated values in accumulation vertex to frag. */
@ -251,7 +245,7 @@ GPU_SHADER_NAMED_INTERFACE_INFO(eevee_shadow_page_tile_store_noperspective_iface
interp_noperspective)
.no_perspective(Type::VEC2, "out_texel_xy");
GPU_SHADER_NAMED_INTERFACE_INFO(eevee_shadow_page_tile_store_flat_iface, interp_flat)
.flat(PAGE_Z_TYPE, "out_page_z");
.flat(Type::PAGE_Z_TYPE, "out_page_z");
#undef PAGE_Z_TYPE
@ -261,8 +255,8 @@ GPU_SHADER_CREATE_INFO(eevee_shadow_page_tile_store)
.define("PASS_DEPTH_STORE")
.additional_info("eevee_shared")
.builtins(BuiltinBits::VIEWPORT_INDEX | BuiltinBits::LAYER)
.storage_buf(7, Qualifier::READ, SHADOW_PAGE_PACKED, "dst_coord_buf[SHADOW_RENDER_MAP_SIZE]")
.storage_buf(8, Qualifier::READ, SHADOW_PAGE_PACKED, "src_coord_buf[SHADOW_RENDER_MAP_SIZE]")
.storage_buf(7, Qualifier::READ, "uint", "dst_coord_buf[SHADOW_RENDER_MAP_SIZE]")
.storage_buf(8, Qualifier::READ, "uint", "src_coord_buf[SHADOW_RENDER_MAP_SIZE]")
.subpass_in(0, Type::FLOAT, "in_tile_depth", SHADOW_ROG_ID)
.image(SHADOW_ATLAS_IMG_SLOT,
GPU_R32UI,
@ -302,7 +296,7 @@ GPU_SHADER_CREATE_INFO(eevee_shadow_debug)
.do_static_compilation(true)
.additional_info("eevee_shared")
.storage_buf(5, Qualifier::READ, "ShadowTileMapData", "tilemaps_buf[]")
.storage_buf(6, Qualifier::READ, SHADOW_TILE_DATA_PACKED, "tiles_buf[]")
.storage_buf(6, Qualifier::READ, "uint", "tiles_buf[]")
.fragment_out(0, Type::VEC4, "out_color_add", DualBlend::SRC_0)
.fragment_out(0, Type::VEC4, "out_color_mul", DualBlend::SRC_1)
.push_constant(Type::INT, "debug_mode")