27#include <fmt/format.h>
38 return &get_static_cache().get();
43 get_static_cache().release();
49 const char *name = static_shader_create_info_name_get(
eShaderType(i));
51 if (name ==
nullptr) {
52 std::cerr <<
"EEVEE: Missing case for eShaderType(" << i
53 <<
") in static_shader_create_info_name_get().";
57 BLI_assert_msg(create_info !=
nullptr,
"EEVEE: Missing create info for static shader.");
86 bool block_until_ready)
88 std::lock_guard
lock(mutex_);
92 if (request_bits & bit) {
93 bool all_loaded =
true;
95 if (shaders_[
shader].is_ready()) {
98 else if (block_until_ready) {
102 shaders_[shader].ensure_compile_async();
112#define AS_SPAN(arr) Span<eShaderType>(arr, ARRAY_SIZE(arr))
275 int render_buffers_shadow_id,
276 int shadow_ray_count,
277 int shadow_ray_step_count,
278 bool use_split_indirect,
279 bool use_lightprobe_eval)
281 std::lock_guard
lock(mutex_);
284 {render_buffers_shadow_id,
286 shadow_ray_step_count,
288 use_lightprobe_eval},
299 auto set_value = [&](
const char *name,
auto value) {
303 for (
bool use_transmission : {
false,
true}) {
304 set_value(
"render_pass_shadow_id", render_buffers_shadow_id);
305 set_value(
"use_split_indirect", use_split_indirect);
306 set_value(
"use_lightprobe_eval", use_lightprobe_eval);
307 set_value(
"use_transmission", use_transmission);
308 set_value(
"shadow_ray_count", shadow_ray_count);
309 set_value(
"shadow_ray_step_count", shadow_ray_step_count);
318 bool is_ready =
true;
332const char *ShaderModule::static_shader_create_info_name_get(
eShaderType shader_type)
334 switch (shader_type) {
336 return "eevee_ambient_occlusion_pass";
338 return "eevee_film_copy_frag";
340 return "eevee_film_comp";
342 return "eevee_film_comp_panoramic";
344 return "eevee_film_cryptomatte_post";
346 return "eevee_film_frag";
348 return "eevee_film_pass_convert_combined";
350 return "eevee_film_pass_convert_depth";
352 return "eevee_film_pass_convert_value";
354 return "eevee_film_pass_convert_color";
356 return "eevee_film_pass_convert_cryptomatte";
358 return "eevee_deferred_combine";
360 return "eevee_deferred_light_single";
362 return "eevee_deferred_light_double";
364 return "eevee_deferred_light_triple";
366 return "eevee_deferred_aov_clear";
368 return "eevee_deferred_sphere_eval";
370 return "eevee_deferred_planar_eval";
372 return "eevee_deferred_thickness_amend";
374 return "eevee_deferred_tile_classify";
376 return "eevee_deferred_tile_classify_fallback";
378 return "eevee_hiz_debug";
380 return "eevee_hiz_update";
382 return "eevee_hiz_update_layer";
384 return "eevee_fast_gi_denoise";
386 return "eevee_fast_gi_resolve";
388 return "eevee_fast_gi_scan";
390 return "eevee_fast_gi_setup";
392 return "eevee_lookdev_copy_world";
394 return "eevee_lookdev_display";
396 return "eevee_motion_blur_gather";
398 return "eevee_motion_blur_tiles_dilate";
400 return "eevee_motion_blur_tiles_flatten_rgba";
402 return "eevee_motion_blur_tiles_flatten_rg";
404 return "eevee_debug_surfels";
406 return "eevee_debug_irradiance_grid";
408 return "eevee_debug_gbuffer";
410 return "eevee_display_lightprobe_volume";
412 return "eevee_display_lightprobe_sphere";
414 return "eevee_display_lightprobe_planar";
416 return "eevee_depth_of_field_bokeh_lut";
418 return "eevee_depth_of_field_downsample";
420 return "eevee_depth_of_field_filter";
422 return "eevee_depth_of_field_gather_foreground_lut";
424 return "eevee_depth_of_field_gather_foreground_no_lut";
426 return "eevee_depth_of_field_gather_background_lut";
428 return "eevee_depth_of_field_gather_background_no_lut";
430 return "eevee_depth_of_field_hole_fill";
432 return "eevee_depth_of_field_reduce";
434 return "eevee_depth_of_field_resolve_no_lut";
436 return "eevee_depth_of_field_resolve_lut";
438 return "eevee_depth_of_field_setup";
440 return "eevee_depth_of_field_scatter";
442 return "eevee_depth_of_field_stabilize";
444 return "eevee_depth_of_field_tiles_dilate_minabs";
446 return "eevee_depth_of_field_tiles_dilate_minmax";
448 return "eevee_depth_of_field_tiles_flatten";
450 return "eevee_light_culling_debug";
452 return "eevee_light_culling_cull";
454 return "eevee_light_culling_sort";
456 return "eevee_light_culling_tile";
458 return "eevee_light_culling_zbin";
460 return "eevee_light_shape_display";
462 return "eevee_light_shadow_setup";
464 return "eevee_raytracing_denoise_spatial";
466 return "eevee_raytracing_denoise_temporal";
468 return "eevee_raytracing_denoise_bilateral";
470 return "eevee_ray_generate";
472 return "eevee_ray_trace_fallback";
474 return "eevee_ray_trace_planar";
476 return "eevee_ray_trace_screen";
478 return "eevee_ray_tile_classify";
480 return "eevee_ray_tile_compact";
482 return "eevee_renderpass_clear";
484 return "eevee_lightprobe_volume_bounds";
486 return "eevee_lightprobe_volume_offset";
488 return "eevee_lightprobe_volume_ray";
490 return "eevee_lightprobe_volume_load";
492 return "eevee_lightprobe_volume_world";
494 return "eevee_lightprobe_sphere_convolve";
496 return "eevee_lightprobe_sphere_remap";
498 return "eevee_lightprobe_sphere_irradiance";
500 return "eevee_lightprobe_sphere_select";
502 return "eevee_lightprobe_sphere_sunlight";
504 return "eevee_shadow_tilemap_bounds_init";
506 return "eevee_shadow_debug";
508 return "eevee_shadow_page_allocate";
510 return "eevee_shadow_page_clear";
512 return "eevee_shadow_page_defrag";
514 return "eevee_shadow_page_free";
516 return "eevee_shadow_page_mask";
518 return "eevee_shadow_tilemap_amend";
520 return "eevee_shadow_tilemap_bounds";
522 return "eevee_shadow_tilemap_finalize";
524 return "eevee_shadow_tilemap_rendermap";
526 return "eevee_shadow_tilemap_init";
528 return "eevee_shadow_tag_update";
530 return "eevee_shadow_tag_update_propagate";
532 return "eevee_shadow_tag_usage_opaque";
534 return "eevee_shadow_tag_usage_surfels";
536 return "eevee_shadow_tag_usage_transparent";
538 return "eevee_shadow_tag_usage_volume";
540 return "eevee_shadow_view_visibility";
542 return "eevee_subsurface_convolve";
544 return "eevee_subsurface_setup";
546 return "eevee_surfel_cluster_build";
548 return "eevee_surfel_light";
550 return "eevee_surfel_list_build";
552 return "eevee_surfel_list_flatten";
554 return "eevee_surfel_list_prefix";
556 return "eevee_surfel_list_prepare";
558 return "eevee_surfel_list_sort";
560 return "eevee_surfel_ray";
562 return "eevee_forward_resolve";
564 return "eevee_vertex_copy";
566 return "eevee_volume_integration";
568 return "eevee_volume_occupancy_convert";
570 return "eevee_volume_resolve";
572 return "eevee_volume_scatter";
574 return "eevee_volume_scatter_with_lights";
584 return shaders_[shader_type].get();
600 int total_requested_samplers_ = 0;
601 bool sampler_overflow_ =
false;
604 bool vertex_id_overflow_ =
false;
611 bool is_gpumat_info =
true)
615 if (!info_conditions.is_empty() && info_conditions.
evaluate(constants) ==
false) {
619 if (!visited_infos.add_overwrite(info.
name_)) {
626 conditions.extend(info_conditions);
627 return conditions.
evaluate(constants);
643 if (!is_gpumat_info) {
659 conditions.extend(info_conditions);
662 reserve_slots_recursive(other_info, constants, conditions,
false);
680 available_samplers_ &= ~(
uint32_t(1) << slot);
681 total_requested_samplers_ =
count_bits_i(~available_samplers_);
686 return sampler_overflow_;
691 return total_requested_samplers_;
696 return vertex_id_overflow_;
701 int next_sampler = available_samplers_ == 0 ? total_requested_samplers_ :
703 total_requested_samplers_++;
706 sampler_overflow_ =
true;
716 if ((available_vertex_id_ & bit) == 0) {
718 vertex_id_overflow_ =
true;
720 available_vertex_id_ &= ~bit;
727 const bool use_shader_to_rgba,
728 const bool use_lighting_nodes,
729 const bool use_ao_node,
730 const bool use_raycast,
731 const bool use_additional_data)
737 (use_shader_to_rgba || use_lighting_nodes);
760 "use_forward_lighting",
768 switch (geometry_type) {
770 switch (pipeline_type) {
772 pipeline_info_name =
"eevee_surf_volume_infos_";
773 info.
name_ +=
"_world_volume";
781 pipeline_info_name =
"eevee_surf_world_infos_";
782 info.
name_ +=
"_world";
783 info.
define(
"closure_to_rgba",
"closure_to_rgba_world");
792 switch (pipeline_type) {
795 pipeline_info_name =
"eevee_surf_depthTtrue_infos_";
796 info.
name_ +=
"_depth_velocity";
798 info.
define(
"closure_to_rgba",
"closure_to_rgba_depth");
807 pipeline_info_name =
"eevee_surf_depthTfalse_infos_";
808 info.
name_ +=
"_depth";
811 info.
define(
"closure_to_rgba",
"closure_to_rgba_depth");
818 pipeline_info_name =
"eevee_surf_depthTfalse_infos_";
819 info.
name_ +=
"_depth_clip";
822 info.
define(
"closure_to_rgba",
"closure_to_rgba_depth");
829 pipeline_info_name =
"eevee_surf_shadow_infos_";
830 info.
name_ +=
"_shadow";
834 info.
define(
"closure_to_rgba",
"closure_to_rgba_shadow");
841 pipeline_info_name =
"eevee_surf_occupancy_infos_";
842 info.
name_ +=
"_occupancy";
851 pipeline_info_name =
"eevee_surf_volume_infos_";
855 info.
name_ +=
"_volume";
862 pipeline_info_name =
"eevee_surf_capture_infos_";
863 info.
name_ +=
"_capture";
866 info.
define(
"closure_to_rgba",
"closure_to_rgba_capture");
874 pipeline_info_name =
"eevee_surf_hybrid_infos_";
875 if (use_shader_to_rgba) {
876 info.
define(
"closure_to_rgba",
"closure_to_rgba_hybrid");
878 info.
name_ +=
"_deferred_hybrid";
887 pipeline_info_name =
"eevee_surf_deferred_infos_";
888 info.
name_ +=
"_deferred";
898 pipeline_info_name =
"eevee_surf_forward_infos_";
899 info.
define(
"closure_to_rgba",
"closure_to_rgba_forward");
903 info.
name_ +=
"_forward";
918 switch (geometry_type) {
920 geometry_info_name =
"eevee_geom_world_infos_";
921 info.
name_ +=
"_world";
928 geometry_info_name =
"eevee_geom_curves_infos_";
929 info.
name_ +=
"_curves";
936 geometry_info_name =
"eevee_geom_gsplat_infos_";
937 info.
name_ +=
"_gsplat";
944 geometry_info_name =
"eevee_geom_mesh_infos_";
945 info.
name_ +=
"_mesh";
952 geometry_info_name =
"eevee_geom_pointcloud_infos_";
953 info.
name_ +=
"_pointcloud";
960 geometry_info_name =
"eevee_geom_volume_infos_";
961 info.
name_ +=
"_volume";
972 if (!pipeline_info_name.
is_empty()) {
975 if (!geometry_info_name.
is_empty()) {
1003 return available_slots;
1018 bool transparent_shadows;
1019 material_type_from_shader_uuid(shader_uuid,
1024 transparent_shadows);
1043 info.
define(
"UNI_ATTR(a)",
"float4(0.0)");
1060 geometry_type_has_surface(geometry_type));
1062 bool use_transparency =
false;
1065 use_transparency =
true;
1100 const eClosureBits closure_bits = shader_closure_bits_from_flag(gpumat);
1102 int32_t closure_bin_count = to_gbuffer_bin_count(closure_bits);
1109 "gbuffer_has_reflection",
1112 "gbuffer_has_refraction",
1115 "gbuffer_has_subsurface",
1118 "gbuffer_has_translucent",
1123 "gbuffer_reflection_colorless",
1127 "gbuffer_refraction_colorless",
1133 bool use_simple_layout =
false;
1134 if (closure_bin_count == 2) {
1141 int closure_layer_count = 0;
1143 closure_layer_count += 1;
1146 closure_layer_count += 2;
1149 closure_layer_count += colorless_reflection ? 1 : 2;
1152 closure_layer_count += colorless_refraction ? 1 : 2;
1155 closure_layer_count += 1;
1158 closure_layer_count += colorless_reflection ? 1 : 2;
1161 if (closure_layer_count <= 2) {
1162 use_simple_layout =
true;
1170 int transmit_eval_count = 0;
1171 if ((pipeline_type ==
MAT_PIPE_FORWARD) || use_shader_to_rgba || use_lighting_nodes) {
1172 transmit_eval_count = (closure_bits &
1209 use_additional_data);
1211 std::stringstream global_vars;
1212 switch (geometry_type) {
1220 for (
auto &input : vertex_inputs) {
1223 vertex_inputs.clear();
1236 for (
auto &input : vertex_inputs) {
1237 if (input.name ==
"orco") {
1239 global_vars << input.type <<
" " << input.name <<
";\n";
1246 vertex_inputs.clear();
1252 for (
auto &input : vertex_inputs) {
1255 vertex_inputs.clear();
1261 for (
auto &input : vertex_inputs) {
1262 global_vars << input.type <<
" " << input.name <<
";\n";
1264 vertex_inputs.clear();
1268 for (
auto &input : vertex_inputs) {
1271 vertex_inputs.clear();
1275 for (
auto &vert_in : vertex_inputs) {
1277 info.
vertex_in(vert_in.index, vert_in.type, vert_in.name);
1283 !support_volume_attributes);
1289 global_vars <<
"struct " << iface.
name <<
" {\n";
1291 global_vars <<
" " <<
inout.type <<
" " <<
inout.name <<
";\n";
1293 global_vars <<
"};\n";
1299 const char *domain_type_frag =
"";
1300 const char *domain_type_vert =
"";
1301 switch (geometry_type) {
1305 domain_type_vert =
"MeshVertex";
1313 domain_type_vert =
"PointCloudPoint";
1318 domain_type_vert =
"CurvesPoint";
1323 domain_type_vert =
"WorldPoint";
1326 domain_type_frag = domain_type_vert =
"VolumePoint";
1330 std::stringstream attr_load;
1333 attr_load <<
"}\n\n";
1335 std::stringstream vert_gen, frag_gen;
1337 if (do_vertex_attrib_load) {
1338 vert_gen << global_vars.str() <<
"void attrib_load(" << domain_type_vert <<
" domain)"
1340 frag_gen <<
"void attrib_load(" << domain_type_frag <<
" domain) {}\n";
1343 vert_gen <<
"void attrib_load(" << domain_type_vert <<
" domain) {}\n";
1344 frag_gen << global_vars.str() <<
"void attrib_load(" << domain_type_frag <<
" domain)"
1351 res.info_name =
"eevee_node_tree";
1354 res.info_name =
"eevee_node_tree";
1357 res.info_name =
"eevee_node_tree";
1362 generated_resource_header +=
"#ifdef CREATE_INFO_RES_PASS_eevee_node_tree\n";
1363 generated_resource_header +=
"CREATE_INFO_RES_PASS_eevee_node_tree\n";
1364 generated_resource_header +=
"#endif\n";
1365 generated_resource_header +=
"#ifdef CREATE_INFO_RES_BATCH_eevee_node_tree\n";
1366 generated_resource_header +=
"CREATE_INFO_RES_BATCH_eevee_node_tree\n";
1367 generated_resource_header +=
"#endif\n";
1368 generated_resource_header +=
"#ifdef CREATE_INFO_RES_GEOMETRY_eevee_node_tree\n";
1369 generated_resource_header +=
"CREATE_INFO_RES_GEOMETRY_eevee_node_tree\n";
1370 generated_resource_header +=
"#endif\n";
1371 generated_resource_header +=
"\n";
1373 info.
generated_sources.append({
"eevee_nodetree_type.bsl.hh", {}, generated_resource_header});
1374 info.
generated_sources.append({
"gpu_shader_material_interface.bsl.hh", {},
""});
1383 dependencies.
append(
"eevee_nodetree_lib.bsl.hh");
1385 if (use_vertex_displacement) {
1387 vert_gen << graph.serialized;
1388 dependencies.
extend(graph.dependencies);
1392 vert_gen <<
"#line 1 \"" __FILE__
"\"\n";
1393 vert_gen <<
"#line " STRINGIFY(__LINE__)
"\n";
1394 vert_gen <<
"float3 nodetree_displacement(KernelGlobals kg, _ref(ShadingData, sd))\n";
1397 "return float3(0);\n");
1398 vert_gen <<
"}\n\n";
1400 if (use_vertex_displacement) {
1401 dependencies.
append(
"eevee_geom_types_lib.bsl.hh");
1406 {
"eevee_nodetree_vert_lib.bsl.hh", dependencies, vert_gen.str()});
1411 dependencies.
append(
"eevee_nodetree_type.bsl.hh");
1412 dependencies.
append(
"eevee_geom_types_lib.bsl.hh");
1413 dependencies.
append(
"eevee_nodetree_lib.bsl.hh");
1416 frag_gen << graph.serialized;
1417 dependencies.
extend(graph.dependencies);
1422 info.
define(
"MAT_DISPLACEMENT_BUMP");
1424 frag_gen <<
"#line 1 \"" __FILE__
"\"\n";
1425 frag_gen <<
"#line " STRINGIFY(__LINE__)
"\n";
1426 frag_gen <<
"float3 nodetree_displacement(KernelGlobals kg, _ref(ShadingData, sd))\n";
1430 frag_gen <<
"}\n\n";
1434 frag_gen <<
"#line 1 \"" __FILE__
"\"\n";
1435 frag_gen <<
"#line " STRINGIFY(__LINE__)
"\n";
1437 frag_gen <<
"Closure nodetree_surface(KernelGlobals kg, _ref(ShadingData, sd), float "
1440 frag_gen <<
" closure_weights_reset(kg, sd, closure_rand);\n";
1443 frag_gen <<
"}\n\n";
1445 frag_gen <<
"float nodetree_thickness(KernelGlobals kg, _ref(ShadingData, sd))\n";
1452 frag_gen <<
"return 0.0;\n";
1457 frag_gen <<
"ObjectMatrices obj = _object_matrices_get(kg, sd);\n";
1458 frag_gen <<
"float3 ob_scale;\n";
1459 frag_gen <<
"ob_scale.x = length(obj.model[0].xyz);\n";
1460 frag_gen <<
"ob_scale.y = length(obj.model[1].xyz);\n";
1461 frag_gen <<
"ob_scale.z = length(obj.model[2].xyz);\n";
1462 frag_gen <<
"ObjectInfos infos = _object_infos_get(kg, sd);\n";
1463 frag_gen <<
"float3 ls_dimensions = safe_rcp(abs(infos.orco_mul.xyz));\n";
1464 frag_gen <<
"float3 ws_dimensions = ob_scale * ls_dimensions;\n";
1466 frag_gen <<
"return reduce_min(ws_dimensions);\n";
1473 frag_gen <<
"}\n\n";
1475 frag_gen <<
"Closure nodetree_volume(KernelGlobals kg, _ref(ShadingData, sd))\n";
1477 frag_gen <<
" closure_weights_reset(kg, sd, 0.0);\n";
1480 frag_gen <<
"}\n\n";
1483 {
"eevee_nodetree_frag_lib.bsl.hh", dependencies, frag_gen.str()});
1486 const char *material_name = (info.
name_.c_str() + 2);
1490 std::cerr <<
"Error: EEVEE: Material " << material_name <<
" uses too many attributes."
1499 std::cerr << fmt::format(
"Error: EEVEE: Material {} uses too many samplers. ({}/{})",
1508 material_create_info_pipelines_amend(geometry_type, pipeline_type, info);
1538 bool transparent_shadows;
1539 material_type_from_shader_uuid(shader_uuid,
1544 transparent_shadows);
1547 bool is_prepass =
ELEM(pipeline_type,
1559 bool has_shadow_transparency = has_transparency && transparent_shadows;
1560 bool has_raytraced_transmission = blender_mat && (blender_mat->blend_flag &
MA_BL_SS_REFRACTION);
1563 bool can_use_default = (is_shadow_pass &&
1564 (!has_vertex_displacement && !has_shadow_transparency)) ||
1565 (is_prepass && (!has_vertex_displacement && !has_transparency &&
1566 !has_raytraced_transmission && !has_raycast));
1567 if (can_use_default) {
1592 std::lock_guard
lock(tree_orig->runtime->shader_node_errors_mutex);
1593 tree_orig->runtime->shader_node_errors.lookup_or_add_default(error.
node->
identifier)
1603 bool deferred_compilation,
1609 uint64_t shader_uuid = shader_uuid_from_material_type(
1610 pipeline_type, geometry_type, displacement_type, thickness_type, blender_mat->blend_flag);
1614 bool is_default_material = default_mat ==
nullptr && geometry_type !=
MAT_GEOM_GSPLAT;
1622 &blender_mat->gpumaterial,
1623 blender_mat->id.name,
1626 deferred_compilation,
1631 return material_from_tree.
material;
1637 bool deferred_compilation)
1646 &blender_world->gpumaterial,
1647 blender_world->id.name,
1650 deferred_compilation,
1654 return material_from_tree.
material;
1664void ShaderModule::material_create_info_pipelines_amend(
eMaterialGeometry geometry_type,
1670 switch (pipeline_type) {
1683 .
depth_format(gpu::TextureTargetFormat::SFLOAT_32_DEPTH_UINT_8)
1684 .
stencil_format(gpu::TextureTargetFormat::SFLOAT_32_DEPTH_UINT_8);
1701 .
color_format(gpu::TextureTargetFormat::SFLOAT_16_16_16_16);
1714 .
depth_format(gpu::TextureTargetFormat::SFLOAT_32_DEPTH_UINT_8)
1715 .
stencil_format(gpu::TextureTargetFormat::SFLOAT_32_DEPTH_UINT_8)
1716 .
color_format(gpu::TextureTargetFormat::SFLOAT_16_16_16_16);
1730 switch (pipeline_type) {
1743 .
depth_format(gpu::TextureTargetFormat::SFLOAT_32_DEPTH_UINT_8)
1744 .
stencil_format(gpu::TextureTargetFormat::SFLOAT_32_DEPTH_UINT_8)
1758 .
depth_format(gpu::TextureTargetFormat::SFLOAT_32_DEPTH_UINT_8)
1759 .
stencil_format(gpu::TextureTargetFormat::SFLOAT_32_DEPTH_UINT_8)
1776 .
depth_format(gpu::TextureTargetFormat::SFLOAT_32_DEPTH_UINT_8)
1777 .
stencil_format(gpu::TextureTargetFormat::SFLOAT_32_DEPTH_UINT_8)
1792 .
depth_format(gpu::TextureTargetFormat::SFLOAT_32_DEPTH_UINT_8)
1793 .
stencil_format(gpu::TextureTargetFormat::SFLOAT_32_DEPTH_UINT_8)
1794 .
color_format(gpu::TextureTargetFormat::SFLOAT_16_16_16_16)
1797 .
color_format(gpu::TextureTargetFormat::UNORM_10_10_10_2)
1798 .
color_format(gpu::TextureTargetFormat::UNORM_10_10_10_2);
1811 .
depth_format(gpu::TextureTargetFormat::SFLOAT_32_DEPTH)
1812 .
color_format(gpu::TextureTargetFormat::UFLOAT_11_11_10)
1815 .
color_format(gpu::TextureTargetFormat::UNORM_10_10_10_2)
1816 .
color_format(gpu::TextureTargetFormat::UNORM_10_10_10_2);
1832 .
depth_format(gpu::TextureTargetFormat::SFLOAT_32_DEPTH_UINT_8)
1833 .
stencil_format(gpu::TextureTargetFormat::SFLOAT_32_DEPTH_UINT_8)
1848 .
depth_format(gpu::TextureTargetFormat::SFLOAT_32_DEPTH_UINT_8)
1849 .
stencil_format(gpu::TextureTargetFormat::SFLOAT_32_DEPTH_UINT_8)
1864 .
depth_format(gpu::TextureTargetFormat::SFLOAT_32_DEPTH_UINT_8)
1865 .
stencil_format(gpu::TextureTargetFormat::SFLOAT_32_DEPTH_UINT_8)
1866 .
color_format(gpu::TextureTargetFormat::SFLOAT_16_16_16_16);
1895 .
depth_format(gpu::TextureTargetFormat::SFLOAT_32_DEPTH)
1896 .
color_format(gpu::TextureTargetFormat::UFLOAT_11_11_10)
1899 .
color_format(gpu::TextureTargetFormat::UNORM_10_10_10_2)
1900 .
color_format(gpu::TextureTargetFormat::UNORM_10_10_10_2);
1916 .
depth_format(gpu::TextureTargetFormat::SFLOAT_32_DEPTH_UINT_8)
1917 .
stencil_format(gpu::TextureTargetFormat::SFLOAT_32_DEPTH_UINT_8);
1933 .
depth_format(gpu::TextureTargetFormat::SFLOAT_32_DEPTH_UINT_8)
1934 .
stencil_format(gpu::TextureTargetFormat::SFLOAT_32_DEPTH_UINT_8);
General operations, lookup, etc. for materials.
#define BLI_assert_unreachable()
#define BLI_assert_msg(a, msg)
constexpr IndexRange()=default
void append(const T &value)
void extend(Span< T > array)
constexpr bool is_empty() const
bool request_specializations(bool block_until_ready, int render_buffers_shadow_id, int shadow_ray_count, int shadow_ray_step_count, bool use_split_indirect, bool use_lightprobe_eval)
static void module_free()
GPUMaterial * world_shader_get(blender::World *blender_world, bNodeTree *nodetree, eMaterialPipeline pipeline_type, bool deferred_compilation)
void material_create_info_amend(GPUMaterial *mat, GPUCodegenOutput *codegen)
GPUMaterial * material_shader_get(blender::Material *blender_mat, bNodeTree *nodetree, eMaterialPipeline pipeline_type, eMaterialGeometry geometry_type, bool deferred_compilation, blender::Material *default_mat)
gpu::Shader * static_shader_get(eShaderType shader_type)
static ShaderModule * module_get()
void reserve_sampler_slot(int slot)
bool vertex_id_overflow() const
void reserve_slots(gpu::shader::ShaderCreateInfo &info)
bool sampler_overflow() const
void set_vertex_input(int index)
int requested_sampler_count() const
#define RADIANCE_PREVIOUS_LAYER_TEX_SLOT
#define HIZ_PREVIOUS_LAYER_TEX_SLOT
void set_value(float val, float &outval)
@ DEFERRED_TILE_CLASSIFY_FALLBACK
@ DOF_GATHER_BACKGROUND_LUT
@ SHADOW_TILEMAP_TAG_USAGE_SURFELS
@ SHADOW_TILEMAP_RENDERMAP
@ LIGHTPROBE_IRRADIANCE_RAY
@ DOF_TILES_DILATE_MINABS
@ SHADOW_TILEMAP_FINALIZE
@ DOF_TILES_DILATE_MINMAX
@ MOTION_BLUR_TILE_FLATTEN_RGBA
@ DEFERRED_THICKNESS_AMEND
@ SHADOW_TILEMAP_TAG_USAGE_OPAQUE
@ VOLUME_SCATTER_WITH_LIGHTS
@ MOTION_BLUR_TILE_FLATTEN_RG
@ DOF_GATHER_FOREGROUND_LUT
@ SPHERE_PROBE_IRRADIANCE
@ SHADOW_TILEMAP_TAG_USAGE_TRANSPARENT
@ FILM_PASS_CONVERT_COMBINED
@ FILM_PASS_CONVERT_CRYPTOMATTE
@ LIGHTPROBE_IRRADIANCE_LOAD
@ VOLUME_OCCUPANCY_CONVERT
@ SHADOW_TILEMAP_TAG_USAGE_VOLUME
@ MOTION_BLUR_TILE_DILATE
@ FILM_PASS_CONVERT_COLOR
@ LIGHTPROBE_IRRADIANCE_OFFSET
@ SHADOW_TILEMAP_TAG_UPDATE_PROPAGATE
@ SHADOW_TILEMAP_TAG_UPDATE
@ FILM_PASS_CONVERT_VALUE
@ LIGHTPROBE_IRRADIANCE_WORLD
@ LIGHTPROBE_IRRADIANCE_BOUNDS
@ FILM_PASS_CONVERT_DEPTH
static GPUPass * pass_replacement_cb(void *void_thunk, GPUMaterial *mat)
@ DEFERRED_CAPTURE_SHADERS
@ DEFERRED_LIGHTING_SHADERS
@ IRRADIANCE_BAKE_SHADERS
@ DEFERRED_PLANAR_SHADERS
@ AMBIENT_OCCLUSION_SHADERS
static void store_node_tree_errors(GPUMaterialFromNodeTreeResult &material_from_tree)
static SlotAllocator add_pipeline_create_info(gpu::shader::ShaderCreateInfo &info, eMaterialPipeline pipeline_type, eMaterialGeometry geometry_type, const bool use_shader_to_rgba, const bool use_lighting_nodes, const bool use_ao_node, const bool use_raycast, const bool use_additional_data)
static void codegen_callback(void *void_thunk, GPUMaterial *mat, GPUCodegenOutput *codegen)
@ MAT_PIPE_PREPASS_FORWARD_VELOCITY
@ MAT_PIPE_VOLUME_MATERIAL
@ MAT_PIPE_PREPASS_DEFERRED
@ MAT_PIPE_PREPASS_OVERLAP
@ MAT_PIPE_PREPASS_PLANAR
@ MAT_PIPE_PREPASS_DEFERRED_VELOCITY
@ MAT_PIPE_VOLUME_OCCUPANCY
@ MAT_PIPE_PREPASS_FORWARD
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
unsigned __int64 uint64_t
bool GPU_material_has_displacement_output(GPUMaterial *mat)
bool DEG_is_active(const Depsgraph *depsgraph)
int GPU_shader_get_constant(gpu::Shader *shader, const char *name)
MINLINE int count_bits_i(unsigned int n)
@ GPU_MATFLAG_SHADER_TO_RGBA
@ GPU_MATFLAG_LIGHT_ATTRIBUTE
@ GPU_MATFLAG_TRANSLUCENT
@ GPU_MATFLAG_BARYCENTRIC
@ GPU_MATFLAG_REFLECTION_MAYBE_COLORED
@ GPU_MATFLAG_REFRACTION_MAYBE_COLORED
@ GPU_MATFLAG_TRANSPARENT
bool GPU_material_flag_get(const GPUMaterial *mat, eGPUMaterialFlag flag)
void GPU_shader_async_specialization_cancel(AsyncSpecializationHandle &handle)
AsyncSpecializationHandle GPU_shader_async_specialization(const ShaderSpecialization &specialization, CompilationPriority priority=CompilationPriority::High)
MINLINE unsigned int bitscan_forward_clear_uint(unsigned int *a)
@ GPU_DEPTH_GREATER_EQUAL
GPUPass * GPU_material_get_pass(GPUMaterial *material)
int64_t AsyncSpecializationHandle
GPUMaterialFromNodeTreeResult GPU_material_from_nodetree(Material *ma, bNodeTree *ntree, ListBaseT< LinkData > *gpumaterials, const char *name, eGPUMaterialEngine engine, uint64_t shader_uuid, bool deferred_compilation, GPUCodegenCallbackFn callback, void *thunk, GPUMaterialPassReplacementCallbackFn pass_replacement_cb=nullptr)
const DRWContext * DRW_context_get()
T * DEG_get_original(T *id)
const GPUShaderCreateInfo * GPU_shader_create_info_get(const char *info_name)
uint64_t GPU_material_uuid_get(GPUMaterial *mat)
bool GPU_stencil_export_support()
bool GPU_multi_viewport_support()
Material * GPU_material_get_material(GPUMaterial *material)
const GPUUniformAttrList * GPU_material_uniform_attributes(const GPUMaterial *material)
bool GPU_shader_async_specialization_is_ready(AsyncSpecializationHandle &handle)
const gpu::shader::SpecializationConstants & GPU_shader_get_default_constant_state(gpu::Shader *sh)
GPUGraphOutput displacement
GPUShaderCreateInfo * create_info
Vector< GPUGraphOutput > material_functions
std::string serialized_or_default(std::string value) const
Vector< StringRefNull > dependencies
bool evaluate(Span< CompilationConstant > constants) const
gpu::shader::SpecializationConstants constants
blender::Material * default_mat
ShaderModule * shader_module
Self & stencil_format(TextureTargetFormat stencil_format)
Self & viewports(uint32_t viewport_count)
Self & depth_format(TextureTargetFormat depth_format)
Self & color_format(TextureTargetFormat color_format)
Self & primitive(GPUPrimType primitive_type)
Self & state(GPUWriteMask write_mask, GPUBlend blend, GPUFaceCullTest culling_test, GPUDepthTest depth_test, GPUStencilTest stencil_test, GPUStencilOp stencil_op, GPUProvokingVertex provoking_vert)
bool evaluate(Span< CompilationConstant > constants) const
Describe inputs & outputs, stage interfaces, resources and sources of a shader. If all data is correc...
Vector< Resource, 0 > geometry_resources_
Self & compilation_constant(Type type, StringRefNull name, double default_value)
Self & fragment_source(StringRefNull filename)
Self & vertex_in(int slot, Type type, StringRefNull name, ConditionFn cond=nullptr)
Vector< CompilationConstant, 0 > compilation_constants_
GeneratedSourceList generated_sources
Vector< AdditionalInfo, 0 > additional_infos_
Vector< VertIn, 0 > vertex_inputs_
Vector< StageInterfaceInfoHandle, 0 > vertex_out_interfaces_
Self & vertex_function(StringRefNull function_name)
Self & additional_info(StringRefNull info_name)
Vector< Resource, 0 > pass_resources_
std::string typedef_source_generated
Self & builtins(BuiltinBits builtin, ConditionFn cond=nullptr)
Self & vertex_source(StringRefNull filename)
Vector< Resource, 0 > batch_resources_
Self & fragment_function(StringRefNull function_name)
PipelineState & pipeline_state()
Create a new pipeline state.
Self & sampler(int slot, ImageType type, StringRefNull name, Frequency freq=Frequency::PASS, ConditionFn cond=nullptr)
Self & define(StringRefNull name, StringRefNull value="")
void set_value(int index, uint32_t value)
StringRefNull instance_name