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.
17 changed files with 1786 additions and 1678 deletions
Showing only changes of commit 89794ba18d - Show all commits

View File

@ -6,19 +6,20 @@
#include "gpu_shader_create_info.hh"
GPU_SHADER_CREATE_INFO(eevee_ambient_occlusion_pass)
.define("HORIZON_OCCLUSION")
.compute_source("eevee_ambient_occlusion_pass_comp.glsl")
.local_group_size(AMBIENT_OCCLUSION_PASS_TILE_SIZE, AMBIENT_OCCLUSION_PASS_TILE_SIZE)
.image(0, GPU_RGBA16F, Qualifier::READ, ImageType::FLOAT_2D_ARRAY, "in_normal_img")
.push_constant(Type::INT, "in_normal_img_layer_index")
.image(1, GPU_R16F, Qualifier::WRITE, ImageType::FLOAT_2D_ARRAY, "out_ao_img")
.push_constant(Type::INT, "out_ao_img_layer_index")
.specialization_constant(Type::INT, "ao_slice_count", 2)
.specialization_constant(Type::INT, "ao_step_count", 8)
.additional_info("draw_view")
.additional_info("eevee_shared")
.additional_info("eevee_hiz_data")
.additional_info("eevee_sampling_data")
.additional_info("eevee_utility_texture")
.additional_info("eevee_global_ubo")
.do_static_compilation(true);
DEFINE("HORIZON_OCCLUSION")
COMPUTE_SOURCE("eevee_ambient_occlusion_pass_comp.glsl")
LOCAL_GROUP_SIZE(AMBIENT_OCCLUSION_PASS_TILE_SIZE, AMBIENT_OCCLUSION_PASS_TILE_SIZE)
IMAGE(0, GPU_RGBA16F, READ, FLOAT_2D_ARRAY, in_normal_img)
PUSH_CONSTANT(INT, in_normal_img_layer_index)
IMAGE(1, GPU_R16F, WRITE, FLOAT_2D_ARRAY, out_ao_img)
PUSH_CONSTANT(INT, out_ao_img_layer_index)
SPECIALIZATION_CONSTANT(INT, ao_slice_count, 2)
SPECIALIZATION_CONSTANT(INT, ao_step_count, 8)
ADDITIONAL_INFO(draw_view)
ADDITIONAL_INFO(eevee_shared)
ADDITIONAL_INFO(eevee_hiz_data)
ADDITIONAL_INFO(eevee_sampling_data)
ADDITIONAL_INFO(eevee_utility_texture)
ADDITIONAL_INFO(eevee_global_ubo)
DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()

View File

@ -19,149 +19,159 @@
* \{ */
GPU_SHADER_CREATE_INFO(eevee_deferred_thickness_amend)
.do_static_compilation(true)
.define("GBUFFER_LOAD")
.sampler(0, ImageType::UINT_2D, "gbuf_header_tx")
.image(0, GPU_RG16, Qualifier::READ_WRITE, ImageType::FLOAT_2D_ARRAY, "gbuf_normal_img")
DO_STATIC_COMPILATION()
DEFINE("GBUFFER_LOAD")
SAMPLER(0, UINT_2D, gbuf_header_tx)
IMAGE(0, GPU_RG16, READ_WRITE, FLOAT_2D_ARRAY, gbuf_normal_img)
/* Early fragment test is needed to discard fragment that do not need this processing. */
.early_fragment_test(true)
.fragment_source("eevee_deferred_thickness_amend_frag.glsl")
.additional_info("draw_view")
.additional_info("draw_fullscreen")
.additional_info("eevee_sampling_data")
.additional_info("eevee_shared")
.additional_info("eevee_light_data")
.additional_info("eevee_shadow_data")
.additional_info("eevee_hiz_data");
EARLY_FRAGMENT_TEST(true)
FRAGMENT_SOURCE("eevee_deferred_thickness_amend_frag.glsl")
ADDITIONAL_INFO(draw_view)
ADDITIONAL_INFO(draw_fullscreen)
ADDITIONAL_INFO(eevee_sampling_data)
ADDITIONAL_INFO(eevee_shared)
ADDITIONAL_INFO(eevee_light_data)
ADDITIONAL_INFO(eevee_shadow_data)
ADDITIONAL_INFO(eevee_hiz_data)
GPU_SHADER_CREATE_END()
/** \} */
GPU_SHADER_CREATE_INFO(eevee_gbuffer_data)
.define("GBUFFER_LOAD")
.sampler(12, ImageType::UINT_2D, "gbuf_header_tx")
.sampler(13, ImageType::FLOAT_2D_ARRAY, "gbuf_closure_tx")
.sampler(14, ImageType::FLOAT_2D_ARRAY, "gbuf_normal_tx");
DEFINE("GBUFFER_LOAD")
SAMPLER(12, UINT_2D, gbuf_header_tx)
SAMPLER(13, FLOAT_2D_ARRAY, gbuf_closure_tx)
SAMPLER(14, FLOAT_2D_ARRAY, gbuf_normal_tx)
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(eevee_deferred_tile_classify)
.fragment_source("eevee_deferred_tile_classify_frag.glsl")
.additional_info("eevee_shared")
.additional_info("draw_fullscreen")
.subpass_in(1, Type::UINT, "in_gbuffer_header", DEFERRED_GBUFFER_ROG_ID)
.typedef_source("draw_shader_shared.hh")
.push_constant(Type::INT, "current_bit")
.do_static_compilation(true);
FRAGMENT_SOURCE("eevee_deferred_tile_classify_frag.glsl")
ADDITIONAL_INFO(eevee_shared)
ADDITIONAL_INFO(draw_fullscreen)
SUBPASS_IN(1, UINT, in_gbuffer_header, DEFERRED_GBUFFER_ROG_ID)
TYPEDEF_SOURCE("draw_shader_shared.hh")
PUSH_CONSTANT(INT, current_bit)
DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(eevee_deferred_light)
.fragment_source("eevee_deferred_light_frag.glsl")
FRAGMENT_SOURCE("eevee_deferred_light_frag.glsl")
/* Early fragment test is needed to avoid processing background fragments. */
.early_fragment_test(true)
.fragment_out(0, Type::VEC4, "out_combined")
EARLY_FRAGMENT_TEST(true)
FRAGMENT_OUT(0, VEC4, out_combined)
/* Chaining to next pass. */
.uimage_out(2, DEFERRED_RADIANCE_FORMAT, "direct_radiance_1_img")
.uimage_out(3, DEFERRED_RADIANCE_FORMAT, "direct_radiance_2_img")
.uimage_out(4, DEFERRED_RADIANCE_FORMAT, "direct_radiance_3_img")
IMAGE_FREQ(2, DEFERRED_RADIANCE_FORMAT, WRITE, UINT_2D, direct_radiance_1_img, PASS)
IMAGE_FREQ(3, DEFERRED_RADIANCE_FORMAT, WRITE, UINT_2D, direct_radiance_2_img, PASS)
IMAGE_FREQ(4, DEFERRED_RADIANCE_FORMAT, WRITE, UINT_2D, direct_radiance_3_img, PASS)
/* Optimized out if use_split_indirect is false. */
.image_out(5, RAYTRACE_RADIANCE_FORMAT, "indirect_radiance_1_img")
.image_out(6, RAYTRACE_RADIANCE_FORMAT, "indirect_radiance_2_img")
.image_out(7, RAYTRACE_RADIANCE_FORMAT, "indirect_radiance_3_img")
.specialization_constant(Type::BOOL, "use_split_indirect", false)
.specialization_constant(Type::BOOL, "use_lightprobe_eval", false)
.specialization_constant(Type::BOOL, "use_transmission", false)
.specialization_constant(Type::INT, "render_pass_shadow_id", -1)
.define("SPECIALIZED_SHADOW_PARAMS")
.specialization_constant(Type::INT, "shadow_ray_count", 1)
.specialization_constant(Type::INT, "shadow_ray_step_count", 6)
.additional_info("eevee_shared")
.additional_info("eevee_gbuffer_data")
.additional_info("eevee_utility_texture")
.additional_info("eevee_sampling_data")
.additional_info("eevee_light_data")
.additional_info("eevee_shadow_data")
.additional_info("eevee_hiz_data")
.additional_info("eevee_lightprobe_data")
.additional_info("eevee_render_pass_out")
.additional_info("draw_fullscreen")
.additional_info("draw_view");
IMAGE_FREQ(5, RAYTRACE_RADIANCE_FORMAT, WRITE, FLOAT_2D, indirect_radiance_1_img, PASS)
IMAGE_FREQ(6, RAYTRACE_RADIANCE_FORMAT, WRITE, FLOAT_2D, indirect_radiance_2_img, PASS)
IMAGE_FREQ(7, RAYTRACE_RADIANCE_FORMAT, WRITE, FLOAT_2D, indirect_radiance_3_img, PASS)
SPECIALIZATION_CONSTANT(BOOL, use_split_indirect, false)
SPECIALIZATION_CONSTANT(BOOL, use_lightprobe_eval, false)
SPECIALIZATION_CONSTANT(BOOL, use_transmission, false)
SPECIALIZATION_CONSTANT(INT, render_pass_shadow_id, -1)
DEFINE("SPECIALIZED_SHADOW_PARAMS")
SPECIALIZATION_CONSTANT(INT, shadow_ray_count, 1)
SPECIALIZATION_CONSTANT(INT, shadow_ray_step_count, 6)
ADDITIONAL_INFO(eevee_shared)
ADDITIONAL_INFO(eevee_gbuffer_data)
ADDITIONAL_INFO(eevee_utility_texture)
ADDITIONAL_INFO(eevee_sampling_data)
ADDITIONAL_INFO(eevee_light_data)
ADDITIONAL_INFO(eevee_shadow_data)
ADDITIONAL_INFO(eevee_hiz_data)
ADDITIONAL_INFO(eevee_lightprobe_data)
ADDITIONAL_INFO(eevee_render_pass_out)
ADDITIONAL_INFO(draw_fullscreen)
ADDITIONAL_INFO(draw_view)
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(eevee_deferred_light_single)
.additional_info("eevee_deferred_light")
.define("LIGHT_CLOSURE_EVAL_COUNT", "1")
.do_static_compilation(true);
ADDITIONAL_INFO(eevee_deferred_light)
DEFINE_VALUE("LIGHT_CLOSURE_EVAL_COUNT", "1")
DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(eevee_deferred_light_double)
.additional_info("eevee_deferred_light")
.define("LIGHT_CLOSURE_EVAL_COUNT", "2")
.do_static_compilation(true);
ADDITIONAL_INFO(eevee_deferred_light)
DEFINE_VALUE("LIGHT_CLOSURE_EVAL_COUNT", "2")
DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(eevee_deferred_light_triple)
.additional_info("eevee_deferred_light")
.define("LIGHT_CLOSURE_EVAL_COUNT", "3")
.do_static_compilation(true);
ADDITIONAL_INFO(eevee_deferred_light)
DEFINE_VALUE("LIGHT_CLOSURE_EVAL_COUNT", "3")
DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(eevee_deferred_combine)
/* Early fragment test is needed to avoid processing fragments background fragments. */
.early_fragment_test(true)
EARLY_FRAGMENT_TEST(true)
/* Inputs. */
.sampler(2, ImageType::UINT_2D, "direct_radiance_1_tx")
.sampler(3, ImageType::UINT_2D, "direct_radiance_2_tx")
.sampler(4, ImageType::UINT_2D, "direct_radiance_3_tx")
.sampler(5, ImageType::FLOAT_2D, "indirect_radiance_1_tx")
.sampler(6, ImageType::FLOAT_2D, "indirect_radiance_2_tx")
.sampler(7, ImageType::FLOAT_2D, "indirect_radiance_3_tx")
.image(5, GPU_RGBA16F, Qualifier::READ_WRITE, ImageType::FLOAT_2D, "radiance_feedback_img")
.fragment_out(0, Type::VEC4, "out_combined")
.additional_info("eevee_shared")
.additional_info("eevee_gbuffer_data")
.additional_info("eevee_render_pass_out")
.additional_info("draw_fullscreen")
.fragment_source("eevee_deferred_combine_frag.glsl")
SAMPLER(2, UINT_2D, direct_radiance_1_tx)
SAMPLER(3, UINT_2D, direct_radiance_2_tx)
SAMPLER(4, UINT_2D, direct_radiance_3_tx)
SAMPLER(5, FLOAT_2D, indirect_radiance_1_tx)
SAMPLER(6, FLOAT_2D, indirect_radiance_2_tx)
SAMPLER(7, FLOAT_2D, indirect_radiance_3_tx)
IMAGE(5, GPU_RGBA16F, READ_WRITE, FLOAT_2D, radiance_feedback_img)
FRAGMENT_OUT(0, VEC4, out_combined)
ADDITIONAL_INFO(eevee_shared)
ADDITIONAL_INFO(eevee_gbuffer_data)
ADDITIONAL_INFO(eevee_render_pass_out)
ADDITIONAL_INFO(draw_fullscreen)
FRAGMENT_SOURCE("eevee_deferred_combine_frag.glsl")
/* NOTE: Both light IDs have a valid specialized assignment of '-1' so only when default is
* present will we instead dynamically look-up ID from the uniform buffer. */
.specialization_constant(Type::BOOL, "render_pass_diffuse_light_enabled", true)
.specialization_constant(Type::BOOL, "render_pass_specular_light_enabled", true)
.specialization_constant(Type::BOOL, "render_pass_normal_enabled", true)
.specialization_constant(Type::BOOL, "use_radiance_feedback", false)
.specialization_constant(Type::BOOL, "use_split_radiance", false)
.do_static_compilation(true);
SPECIALIZATION_CONSTANT(BOOL, render_pass_diffuse_light_enabled, true)
SPECIALIZATION_CONSTANT(BOOL, render_pass_specular_light_enabled, true)
SPECIALIZATION_CONSTANT(BOOL, render_pass_normal_enabled, true)
SPECIALIZATION_CONSTANT(BOOL, use_radiance_feedback, false)
SPECIALIZATION_CONSTANT(BOOL, use_split_radiance, false)
DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(eevee_deferred_capture_eval)
/* Early fragment test is needed to avoid processing fragments without correct GBuffer data. */
.early_fragment_test(true)
EARLY_FRAGMENT_TEST(true)
/* Inputs. */
.fragment_out(0, Type::VEC4, "out_radiance")
.define("LIGHT_CLOSURE_EVAL_COUNT", "1")
.additional_info("eevee_shared")
.additional_info("eevee_gbuffer_data")
.additional_info("eevee_utility_texture")
.additional_info("eevee_sampling_data")
.additional_info("eevee_light_data")
.additional_info("eevee_shadow_data")
.additional_info("eevee_hiz_data")
.additional_info("eevee_volume_probe_data")
.additional_info("draw_view")
.additional_info("draw_fullscreen")
.fragment_source("eevee_deferred_capture_frag.glsl")
.do_static_compilation(true);
FRAGMENT_OUT(0, VEC4, out_radiance)
DEFINE_VALUE("LIGHT_CLOSURE_EVAL_COUNT", "1")
ADDITIONAL_INFO(eevee_shared)
ADDITIONAL_INFO(eevee_gbuffer_data)
ADDITIONAL_INFO(eevee_utility_texture)
ADDITIONAL_INFO(eevee_sampling_data)
ADDITIONAL_INFO(eevee_light_data)
ADDITIONAL_INFO(eevee_shadow_data)
ADDITIONAL_INFO(eevee_hiz_data)
ADDITIONAL_INFO(eevee_volume_probe_data)
ADDITIONAL_INFO(draw_view)
ADDITIONAL_INFO(draw_fullscreen)
FRAGMENT_SOURCE("eevee_deferred_capture_frag.glsl")
DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(eevee_deferred_planar_eval)
/* Early fragment test is needed to avoid processing fragments without correct GBuffer data. */
.early_fragment_test(true)
EARLY_FRAGMENT_TEST(true)
/* Inputs. */
.fragment_out(0, Type::VEC4, "out_radiance")
.define("SPHERE_PROBE")
.define("LIGHT_CLOSURE_EVAL_COUNT", "1")
.additional_info("eevee_shared")
.additional_info("eevee_gbuffer_data")
.additional_info("eevee_utility_texture")
.additional_info("eevee_sampling_data")
.additional_info("eevee_light_data")
.additional_info("eevee_lightprobe_data")
.additional_info("eevee_shadow_data")
.additional_info("eevee_hiz_data")
.additional_info("draw_view")
.additional_info("draw_fullscreen")
.fragment_source("eevee_deferred_planar_frag.glsl")
.do_static_compilation(true);
FRAGMENT_OUT(0, VEC4, out_radiance)
DEFINE("SPHERE_PROBE")
DEFINE_VALUE("LIGHT_CLOSURE_EVAL_COUNT", "1")
ADDITIONAL_INFO(eevee_shared)
ADDITIONAL_INFO(eevee_gbuffer_data)
ADDITIONAL_INFO(eevee_utility_texture)
ADDITIONAL_INFO(eevee_sampling_data)
ADDITIONAL_INFO(eevee_light_data)
ADDITIONAL_INFO(eevee_lightprobe_data)
ADDITIONAL_INFO(eevee_shadow_data)
ADDITIONAL_INFO(eevee_hiz_data)
ADDITIONAL_INFO(draw_view)
ADDITIONAL_INFO(draw_fullscreen)
FRAGMENT_SOURCE("eevee_deferred_planar_frag.glsl")
DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()
#undef image_array_out
#undef image_out
@ -172,14 +182,15 @@ GPU_SHADER_CREATE_INFO(eevee_deferred_planar_eval)
* \{ */
GPU_SHADER_CREATE_INFO(eevee_debug_gbuffer)
.do_static_compilation(true)
.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")
.fragment_source("eevee_debug_gbuffer_frag.glsl")
.additional_info("draw_view")
.additional_info("draw_fullscreen")
.additional_info("eevee_shared")
.additional_info("eevee_gbuffer_data");
DO_STATIC_COMPILATION()
FRAGMENT_OUT_DUAL(0, VEC4, out_color_add, SRC_0)
FRAGMENT_OUT_DUAL(0, VEC4, out_color_mul, SRC_1)
PUSH_CONSTANT(INT, debug_mode)
FRAGMENT_SOURCE("eevee_debug_gbuffer_frag.glsl")
ADDITIONAL_INFO(draw_view)
ADDITIONAL_INFO(draw_fullscreen)
ADDITIONAL_INFO(eevee_shared)
ADDITIONAL_INFO(eevee_gbuffer_data)
GPU_SHADER_CREATE_END()
/** \} */

View File

@ -10,76 +10,81 @@
* \{ */
GPU_SHADER_CREATE_INFO(eevee_depth_of_field_bokeh_lut)
.do_static_compilation(true)
.local_group_size(DOF_BOKEH_LUT_SIZE, DOF_BOKEH_LUT_SIZE)
.additional_info("eevee_shared")
.additional_info("draw_view")
.uniform_buf(6, "DepthOfFieldData", "dof_buf")
.image(0, GPU_RG16F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_gather_lut_img")
.image(1, GPU_R16F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_scatter_lut_img")
.image(2, GPU_R16F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_resolve_lut_img")
.compute_source("eevee_depth_of_field_bokeh_lut_comp.glsl");
DO_STATIC_COMPILATION()
LOCAL_GROUP_SIZE(DOF_BOKEH_LUT_SIZE, DOF_BOKEH_LUT_SIZE)
ADDITIONAL_INFO(eevee_shared)
ADDITIONAL_INFO(draw_view)
UNIFORM_BUF(6, DepthOfFieldData, dof_buf)
IMAGE(0, GPU_RG16F, WRITE, FLOAT_2D, out_gather_lut_img)
IMAGE(1, GPU_R16F, WRITE, FLOAT_2D, out_scatter_lut_img)
IMAGE(2, GPU_R16F, WRITE, FLOAT_2D, out_resolve_lut_img)
COMPUTE_SOURCE("eevee_depth_of_field_bokeh_lut_comp.glsl")
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(eevee_depth_of_field_setup)
.do_static_compilation(true)
.local_group_size(DOF_DEFAULT_GROUP_SIZE, DOF_DEFAULT_GROUP_SIZE)
.additional_info("eevee_shared")
.additional_info("draw_view")
.uniform_buf(6, "DepthOfFieldData", "dof_buf")
.sampler(0, ImageType::FLOAT_2D, "color_tx")
.sampler(1, ImageType::DEPTH_2D, "depth_tx")
.image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_color_img")
.image(1, GPU_R16F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_coc_img")
.compute_source("eevee_depth_of_field_setup_comp.glsl");
DO_STATIC_COMPILATION()
LOCAL_GROUP_SIZE(DOF_DEFAULT_GROUP_SIZE, DOF_DEFAULT_GROUP_SIZE)
ADDITIONAL_INFO(eevee_shared)
ADDITIONAL_INFO(draw_view)
UNIFORM_BUF(6, DepthOfFieldData, dof_buf)
SAMPLER(0, FLOAT_2D, color_tx)
SAMPLER(1, DEPTH_2D, depth_tx)
IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, out_color_img)
IMAGE(1, GPU_R16F, WRITE, FLOAT_2D, out_coc_img)
COMPUTE_SOURCE("eevee_depth_of_field_setup_comp.glsl")
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(eevee_depth_of_field_stabilize)
.do_static_compilation(true)
.local_group_size(DOF_STABILIZE_GROUP_SIZE, DOF_STABILIZE_GROUP_SIZE)
.additional_info("eevee_shared")
.additional_info("draw_view")
.additional_info("eevee_velocity_camera")
.uniform_buf(6, "DepthOfFieldData", "dof_buf")
.sampler(0, ImageType::FLOAT_2D, "coc_tx")
.sampler(1, ImageType::FLOAT_2D, "color_tx")
.sampler(2, ImageType::FLOAT_2D, "velocity_tx")
.sampler(3, ImageType::FLOAT_2D, "in_history_tx")
.sampler(4, ImageType::DEPTH_2D, "depth_tx")
.push_constant(Type::BOOL, "u_use_history")
.image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_color_img")
.image(1, GPU_R16F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_coc_img")
.image(2, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_history_img")
.compute_source("eevee_depth_of_field_stabilize_comp.glsl");
DO_STATIC_COMPILATION()
LOCAL_GROUP_SIZE(DOF_STABILIZE_GROUP_SIZE, DOF_STABILIZE_GROUP_SIZE)
ADDITIONAL_INFO(eevee_shared)
ADDITIONAL_INFO(draw_view)
ADDITIONAL_INFO(eevee_velocity_camera)
UNIFORM_BUF(6, DepthOfFieldData, dof_buf)
SAMPLER(0, FLOAT_2D, coc_tx)
SAMPLER(1, FLOAT_2D, color_tx)
SAMPLER(2, FLOAT_2D, velocity_tx)
SAMPLER(3, FLOAT_2D, in_history_tx)
SAMPLER(4, DEPTH_2D, depth_tx)
PUSH_CONSTANT(BOOL, u_use_history)
IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, out_color_img)
IMAGE(1, GPU_R16F, WRITE, FLOAT_2D, out_coc_img)
IMAGE(2, GPU_RGBA16F, WRITE, FLOAT_2D, out_history_img)
COMPUTE_SOURCE("eevee_depth_of_field_stabilize_comp.glsl")
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(eevee_depth_of_field_downsample)
.do_static_compilation(true)
.local_group_size(DOF_DEFAULT_GROUP_SIZE, DOF_DEFAULT_GROUP_SIZE)
.additional_info("eevee_shared")
.additional_info("draw_view")
.sampler(0, ImageType::FLOAT_2D, "color_tx")
.sampler(1, ImageType::FLOAT_2D, "coc_tx")
.image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_color_img")
.compute_source("eevee_depth_of_field_downsample_comp.glsl");
DO_STATIC_COMPILATION()
LOCAL_GROUP_SIZE(DOF_DEFAULT_GROUP_SIZE, DOF_DEFAULT_GROUP_SIZE)
ADDITIONAL_INFO(eevee_shared)
ADDITIONAL_INFO(draw_view)
SAMPLER(0, FLOAT_2D, color_tx)
SAMPLER(1, FLOAT_2D, coc_tx)
IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, out_color_img)
COMPUTE_SOURCE("eevee_depth_of_field_downsample_comp.glsl")
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(eevee_depth_of_field_reduce)
.do_static_compilation(true)
.local_group_size(DOF_REDUCE_GROUP_SIZE, DOF_REDUCE_GROUP_SIZE)
.additional_info("eevee_shared")
.additional_info("draw_view")
.uniform_buf(6, "DepthOfFieldData", "dof_buf")
.sampler(0, ImageType::FLOAT_2D, "downsample_tx")
.storage_buf(0, Qualifier::WRITE, "ScatterRect", "scatter_fg_list_buf[]")
.storage_buf(1, Qualifier::WRITE, "ScatterRect", "scatter_bg_list_buf[]")
.storage_buf(2, Qualifier::READ_WRITE, "DrawCommand", "scatter_fg_indirect_buf")
.storage_buf(3, Qualifier::READ_WRITE, "DrawCommand", "scatter_bg_indirect_buf")
.image(0, GPU_RGBA16F, Qualifier::READ_WRITE, ImageType::FLOAT_2D, "inout_color_lod0_img")
.image(1, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_color_lod1_img")
.image(2, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_color_lod2_img")
.image(3, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_color_lod3_img")
.image(4, GPU_R16F, Qualifier::READ, ImageType::FLOAT_2D, "in_coc_lod0_img")
.image(5, GPU_R16F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_coc_lod1_img")
.image(6, GPU_R16F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_coc_lod2_img")
.image(7, GPU_R16F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_coc_lod3_img")
.compute_source("eevee_depth_of_field_reduce_comp.glsl");
DO_STATIC_COMPILATION()
LOCAL_GROUP_SIZE(DOF_REDUCE_GROUP_SIZE, DOF_REDUCE_GROUP_SIZE)
ADDITIONAL_INFO(eevee_shared)
ADDITIONAL_INFO(draw_view)
UNIFORM_BUF(6, DepthOfFieldData, dof_buf)
SAMPLER(0, FLOAT_2D, downsample_tx)
STORAGE_BUF(0, WRITE, ScatterRect, scatter_fg_list_buf[])
STORAGE_BUF(1, WRITE, ScatterRect, scatter_bg_list_buf[])
STORAGE_BUF(2, READ_WRITE, DrawCommand, scatter_fg_indirect_buf)
STORAGE_BUF(3, READ_WRITE, DrawCommand, scatter_bg_indirect_buf)
IMAGE(0, GPU_RGBA16F, READ_WRITE, FLOAT_2D, inout_color_lod0_img)
IMAGE(1, GPU_RGBA16F, WRITE, FLOAT_2D, out_color_lod1_img)
IMAGE(2, GPU_RGBA16F, WRITE, FLOAT_2D, out_color_lod2_img)
IMAGE(3, GPU_RGBA16F, WRITE, FLOAT_2D, out_color_lod3_img)
IMAGE(4, GPU_R16F, READ, FLOAT_2D, in_coc_lod0_img)
IMAGE(5, GPU_R16F, WRITE, FLOAT_2D, out_coc_lod1_img)
IMAGE(6, GPU_R16F, WRITE, FLOAT_2D, out_coc_lod2_img)
IMAGE(7, GPU_R16F, WRITE, FLOAT_2D, out_coc_lod3_img)
COMPUTE_SOURCE("eevee_depth_of_field_reduce_comp.glsl")
GPU_SHADER_CREATE_END()
/** \} */
@ -88,39 +93,44 @@ GPU_SHADER_CREATE_INFO(eevee_depth_of_field_reduce)
* \{ */
GPU_SHADER_CREATE_INFO(eevee_depth_of_field_tiles_flatten)
.do_static_compilation(true)
.local_group_size(DOF_TILES_FLATTEN_GROUP_SIZE, DOF_TILES_FLATTEN_GROUP_SIZE)
.additional_info("eevee_shared")
.additional_info("draw_view")
.sampler(0, ImageType::FLOAT_2D, "coc_tx")
.image(2, GPU_R11F_G11F_B10F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_tiles_fg_img")
.image(3, GPU_R11F_G11F_B10F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_tiles_bg_img")
.compute_source("eevee_depth_of_field_tiles_flatten_comp.glsl");
DO_STATIC_COMPILATION()
LOCAL_GROUP_SIZE(DOF_TILES_FLATTEN_GROUP_SIZE, DOF_TILES_FLATTEN_GROUP_SIZE)
ADDITIONAL_INFO(eevee_shared)
ADDITIONAL_INFO(draw_view)
SAMPLER(0, FLOAT_2D, coc_tx)
IMAGE(2, GPU_R11F_G11F_B10F, WRITE, FLOAT_2D, out_tiles_fg_img)
IMAGE(3, GPU_R11F_G11F_B10F, WRITE, FLOAT_2D, out_tiles_bg_img)
COMPUTE_SOURCE("eevee_depth_of_field_tiles_flatten_comp.glsl")
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(eevee_depth_of_field_tiles_dilate)
.additional_info("eevee_shared")
.additional_info("draw_view")
.additional_info("eevee_depth_of_field_tiles_common")
.local_group_size(DOF_TILES_DILATE_GROUP_SIZE, DOF_TILES_DILATE_GROUP_SIZE)
.image(2, GPU_R11F_G11F_B10F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_tiles_fg_img")
.image(3, GPU_R11F_G11F_B10F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_tiles_bg_img")
.push_constant(Type::INT, "ring_count")
.push_constant(Type::INT, "ring_width_multiplier")
.compute_source("eevee_depth_of_field_tiles_dilate_comp.glsl");
ADDITIONAL_INFO(eevee_shared)
ADDITIONAL_INFO(draw_view)
ADDITIONAL_INFO(eevee_depth_of_field_tiles_common)
LOCAL_GROUP_SIZE(DOF_TILES_DILATE_GROUP_SIZE, DOF_TILES_DILATE_GROUP_SIZE)
IMAGE(2, GPU_R11F_G11F_B10F, WRITE, FLOAT_2D, out_tiles_fg_img)
IMAGE(3, GPU_R11F_G11F_B10F, WRITE, FLOAT_2D, out_tiles_bg_img)
PUSH_CONSTANT(INT, ring_count)
PUSH_CONSTANT(INT, ring_width_multiplier)
COMPUTE_SOURCE("eevee_depth_of_field_tiles_dilate_comp.glsl")
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(eevee_depth_of_field_tiles_dilate_minabs)
.do_static_compilation(true)
.define("DILATE_MODE_MIN_MAX", "false")
.additional_info("eevee_depth_of_field_tiles_dilate");
DO_STATIC_COMPILATION()
DEFINE_VALUE("DILATE_MODE_MIN_MAX", "false")
ADDITIONAL_INFO(eevee_depth_of_field_tiles_dilate)
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(eevee_depth_of_field_tiles_dilate_minmax)
.do_static_compilation(true)
.define("DILATE_MODE_MIN_MAX", "true")
.additional_info("eevee_depth_of_field_tiles_dilate");
DO_STATIC_COMPILATION()
DEFINE_VALUE("DILATE_MODE_MIN_MAX", "true")
ADDITIONAL_INFO(eevee_depth_of_field_tiles_dilate)
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(eevee_depth_of_field_tiles_common)
.image(0, GPU_R11F_G11F_B10F, Qualifier::READ, ImageType::FLOAT_2D, "in_tiles_fg_img")
.image(1, GPU_R11F_G11F_B10F, Qualifier::READ, ImageType::FLOAT_2D, "in_tiles_bg_img");
IMAGE(0, GPU_R11F_G11F_B10F, READ, FLOAT_2D, in_tiles_fg_img)
IMAGE(1, GPU_R11F_G11F_B10F, READ, FLOAT_2D, in_tiles_bg_img)
GPU_SHADER_CREATE_END()
/** \} */
@ -129,19 +139,25 @@ GPU_SHADER_CREATE_INFO(eevee_depth_of_field_tiles_common)
* \{ */
GPU_SHADER_CREATE_INFO(eevee_depth_of_field_no_lut)
.define("DOF_BOKEH_TEXTURE", "false")
DEFINE_VALUE("DOF_BOKEH_TEXTURE", "false")
/**
* WORKAROUND(@fclem): This is to keep the code as is for now. The bokeh_lut_tx is referenced
* even if not used after optimization. But we don't want to include it in the create infos.
*/
.define("bokeh_lut_tx", "color_tx");
DEFINE_VALUE("bokeh_lut_tx", "color_tx")
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(eevee_depth_of_field_lut)
.define("DOF_BOKEH_TEXTURE", "true")
.sampler(5, ImageType::FLOAT_2D, "bokeh_lut_tx");
DEFINE_VALUE("DOF_BOKEH_TEXTURE", "true")
SAMPLER(5, FLOAT_2D, bokeh_lut_tx)
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(eevee_depth_of_field_background).define("DOF_FOREGROUND_PASS", "false");
GPU_SHADER_CREATE_INFO(eevee_depth_of_field_foreground).define("DOF_FOREGROUND_PASS", "true");
GPU_SHADER_CREATE_INFO(eevee_depth_of_field_background)
DEFINE_VALUE("DOF_FOREGROUND_PASS", "false")
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(eevee_depth_of_field_foreground)
DEFINE_VALUE("DOF_FOREGROUND_PASS", "true")
GPU_SHADER_CREATE_END()
#define EEVEE_DOF_LUT_VARIATIONS(prefix, ...) \
CREATE_INFO_VARIANT(prefix##_lut, eevee_depth_of_field_lut, __VA_ARGS__) \
@ -158,40 +174,44 @@ GPU_SHADER_CREATE_INFO(eevee_depth_of_field_foreground).define("DOF_FOREGROUND_P
* \{ */
GPU_SHADER_CREATE_INFO(eevee_depth_of_field_gather_common)
.additional_info("eevee_shared")
.additional_info("draw_view")
.additional_info("eevee_depth_of_field_tiles_common")
.additional_info("eevee_sampling_data")
.uniform_buf(6, "DepthOfFieldData", "dof_buf")
.local_group_size(DOF_GATHER_GROUP_SIZE, DOF_GATHER_GROUP_SIZE)
.sampler(0, ImageType::FLOAT_2D, "color_tx")
.sampler(1, ImageType::FLOAT_2D, "color_bilinear_tx")
.sampler(2, ImageType::FLOAT_2D, "coc_tx")
.image(2, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_color_img")
.image(3, GPU_R16F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_weight_img");
ADDITIONAL_INFO(eevee_shared)
ADDITIONAL_INFO(draw_view)
ADDITIONAL_INFO(eevee_depth_of_field_tiles_common)
ADDITIONAL_INFO(eevee_sampling_data)
UNIFORM_BUF(6, DepthOfFieldData, dof_buf)
LOCAL_GROUP_SIZE(DOF_GATHER_GROUP_SIZE, DOF_GATHER_GROUP_SIZE)
SAMPLER(0, FLOAT_2D, color_tx)
SAMPLER(1, FLOAT_2D, color_bilinear_tx)
SAMPLER(2, FLOAT_2D, coc_tx)
IMAGE(2, GPU_RGBA16F, WRITE, FLOAT_2D, out_color_img)
IMAGE(3, GPU_R16F, WRITE, FLOAT_2D, out_weight_img)
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(eevee_depth_of_field_gather)
.image(4, GPU_RG16F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_occlusion_img")
.compute_source("eevee_depth_of_field_gather_comp.glsl")
.additional_info("eevee_depth_of_field_gather_common");
IMAGE(4, GPU_RG16F, WRITE, FLOAT_2D, out_occlusion_img)
COMPUTE_SOURCE("eevee_depth_of_field_gather_comp.glsl")
ADDITIONAL_INFO(eevee_depth_of_field_gather_common)
GPU_SHADER_CREATE_END()
EEVEE_DOF_GROUND_VARIATIONS(eevee_depth_of_field_gather, eevee_depth_of_field_gather)
GPU_SHADER_CREATE_INFO(eevee_depth_of_field_hole_fill)
.do_static_compilation(true)
.compute_source("eevee_depth_of_field_hole_fill_comp.glsl")
.additional_info("eevee_depth_of_field_gather_common")
.additional_info("eevee_depth_of_field_no_lut");
DO_STATIC_COMPILATION()
COMPUTE_SOURCE("eevee_depth_of_field_hole_fill_comp.glsl")
ADDITIONAL_INFO(eevee_depth_of_field_gather_common)
ADDITIONAL_INFO(eevee_depth_of_field_no_lut)
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(eevee_depth_of_field_filter)
.do_static_compilation(true)
.local_group_size(DOF_FILTER_GROUP_SIZE, DOF_FILTER_GROUP_SIZE)
.additional_info("eevee_shared")
.sampler(0, ImageType::FLOAT_2D, "color_tx")
.sampler(1, ImageType::FLOAT_2D, "weight_tx")
.image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_color_img")
.image(1, GPU_R16F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_weight_img")
.compute_source("eevee_depth_of_field_filter_comp.glsl");
DO_STATIC_COMPILATION()
LOCAL_GROUP_SIZE(DOF_FILTER_GROUP_SIZE, DOF_FILTER_GROUP_SIZE)
ADDITIONAL_INFO(eevee_shared)
SAMPLER(0, FLOAT_2D, color_tx)
SAMPLER(1, FLOAT_2D, weight_tx)
IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, out_color_img)
IMAGE(1, GPU_R16F, WRITE, FLOAT_2D, out_weight_img)
COMPUTE_SOURCE("eevee_depth_of_field_filter_comp.glsl")
GPU_SHADER_CREATE_END()
/** \} */
@ -201,34 +221,37 @@ GPU_SHADER_CREATE_INFO(eevee_depth_of_field_filter)
GPU_SHADER_NAMED_INTERFACE_INFO(eevee_depth_of_field_scatter_flat_iface, interp_flat)
/** Colors, weights, and Circle of confusion radii for the 4 pixels to scatter. */
.flat(Type::VEC4, "color_and_coc1")
.flat(Type::VEC4, "color_and_coc2")
.flat(Type::VEC4, "color_and_coc3")
.flat(Type::VEC4, "color_and_coc4")
FLAT(VEC4, color_and_coc1)
FLAT(VEC4, color_and_coc2)
FLAT(VEC4, color_and_coc3)
FLAT(VEC4, color_and_coc4)
/** Scaling factor for the bokeh distance. */
.flat(Type::FLOAT, "distance_scale");
FLAT(FLOAT, distance_scale)
GPU_SHADER_NAMED_INTERFACE_END(interp_flat)
GPU_SHADER_NAMED_INTERFACE_INFO(eevee_depth_of_field_scatter_noperspective_iface,
interp_noperspective)
/** Sprite pixel position with origin at sprite center. In pixels. */
.no_perspective(Type::VEC2, "rect_uv1")
.no_perspective(Type::VEC2, "rect_uv2")
.no_perspective(Type::VEC2, "rect_uv3")
.no_perspective(Type::VEC2, "rect_uv4");
NO_PERSPECTIVE(VEC2, rect_uv1)
NO_PERSPECTIVE(VEC2, rect_uv2)
NO_PERSPECTIVE(VEC2, rect_uv3)
NO_PERSPECTIVE(VEC2, rect_uv4)
GPU_SHADER_NAMED_INTERFACE_END(interp_noperspective)
GPU_SHADER_CREATE_INFO(eevee_depth_of_field_scatter)
.do_static_compilation(true)
.additional_info("eevee_shared")
.additional_info("draw_view")
.sampler(0, ImageType::FLOAT_2D, "occlusion_tx")
.sampler(1, ImageType::FLOAT_2D, "bokeh_lut_tx")
.uniform_buf(6, "DepthOfFieldData", "dof_buf")
.storage_buf(0, Qualifier::READ, "ScatterRect", "scatter_list_buf[]")
.fragment_out(0, Type::VEC4, "out_color")
.push_constant(Type::BOOL, "use_bokeh_lut")
.vertex_out(eevee_depth_of_field_scatter_flat_iface)
.vertex_out(eevee_depth_of_field_scatter_noperspective_iface)
.vertex_source("eevee_depth_of_field_scatter_vert.glsl")
.fragment_source("eevee_depth_of_field_scatter_frag.glsl");
DO_STATIC_COMPILATION()
ADDITIONAL_INFO(eevee_shared)
ADDITIONAL_INFO(draw_view)
SAMPLER(0, FLOAT_2D, occlusion_tx)
SAMPLER(1, FLOAT_2D, bokeh_lut_tx)
UNIFORM_BUF(6, DepthOfFieldData, dof_buf)
STORAGE_BUF(0, READ, ScatterRect, scatter_list_buf[])
FRAGMENT_OUT(0, VEC4, out_color)
PUSH_CONSTANT(BOOL, use_bokeh_lut)
VERTEX_OUT(eevee_depth_of_field_scatter_flat_iface)
VERTEX_OUT(eevee_depth_of_field_scatter_noperspective_iface)
VERTEX_SOURCE("eevee_depth_of_field_scatter_vert.glsl")
FRAGMENT_SOURCE("eevee_depth_of_field_scatter_frag.glsl")
GPU_SHADER_CREATE_END()
/** \} */
@ -237,25 +260,26 @@ GPU_SHADER_CREATE_INFO(eevee_depth_of_field_scatter)
* \{ */
GPU_SHADER_CREATE_INFO(eevee_depth_of_field_resolve)
.define("DOF_RESOLVE_PASS", "true")
.local_group_size(DOF_RESOLVE_GROUP_SIZE, DOF_RESOLVE_GROUP_SIZE)
.specialization_constant(Type::BOOL, "do_debug_color", false)
.additional_info("eevee_shared")
.additional_info("draw_view")
.additional_info("eevee_depth_of_field_tiles_common")
.additional_info("eevee_sampling_data")
.uniform_buf(6, "DepthOfFieldData", "dof_buf")
.sampler(0, ImageType::DEPTH_2D, "depth_tx")
.sampler(1, ImageType::FLOAT_2D, "color_tx")
.sampler(2, ImageType::FLOAT_2D, "color_bg_tx")
.sampler(3, ImageType::FLOAT_2D, "color_fg_tx")
.sampler(4, ImageType::FLOAT_2D, "color_hole_fill_tx")
.sampler(7, ImageType::FLOAT_2D, "weight_bg_tx")
.sampler(8, ImageType::FLOAT_2D, "weight_fg_tx")
.sampler(9, ImageType::FLOAT_2D, "weight_hole_fill_tx")
.sampler(10, ImageType::FLOAT_2D, "stable_color_tx")
.image(2, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_color_img")
.compute_source("eevee_depth_of_field_resolve_comp.glsl");
DEFINE_VALUE("DOF_RESOLVE_PASS", "true")
LOCAL_GROUP_SIZE(DOF_RESOLVE_GROUP_SIZE, DOF_RESOLVE_GROUP_SIZE)
SPECIALIZATION_CONSTANT(BOOL, do_debug_color, false)
ADDITIONAL_INFO(eevee_shared)
ADDITIONAL_INFO(draw_view)
ADDITIONAL_INFO(eevee_depth_of_field_tiles_common)
ADDITIONAL_INFO(eevee_sampling_data)
UNIFORM_BUF(6, DepthOfFieldData, dof_buf)
SAMPLER(0, DEPTH_2D, depth_tx)
SAMPLER(1, FLOAT_2D, color_tx)
SAMPLER(2, FLOAT_2D, color_bg_tx)
SAMPLER(3, FLOAT_2D, color_fg_tx)
SAMPLER(4, FLOAT_2D, color_hole_fill_tx)
SAMPLER(7, FLOAT_2D, weight_bg_tx)
SAMPLER(8, FLOAT_2D, weight_fg_tx)
SAMPLER(9, FLOAT_2D, weight_hole_fill_tx)
SAMPLER(10, FLOAT_2D, stable_color_tx)
IMAGE(2, GPU_RGBA16F, WRITE, FLOAT_2D, out_color_img)
COMPUTE_SOURCE("eevee_depth_of_field_resolve_comp.glsl")
GPU_SHADER_CREATE_END()
EEVEE_DOF_LUT_VARIATIONS(eevee_depth_of_field_resolve, eevee_depth_of_field_resolve)

View File

@ -6,120 +6,131 @@
#include "gpu_shader_create_info.hh"
GPU_SHADER_CREATE_INFO(eevee_film_base)
.sampler(0, ImageType::DEPTH_2D, "depth_tx")
.sampler(1, ImageType::FLOAT_2D, "combined_tx")
.sampler(2, ImageType::FLOAT_2D, "vector_tx")
.sampler(3, ImageType::FLOAT_2D_ARRAY, "rp_color_tx")
.sampler(4, ImageType::FLOAT_2D_ARRAY, "rp_value_tx")
SAMPLER(0, DEPTH_2D, depth_tx)
SAMPLER(1, FLOAT_2D, combined_tx)
SAMPLER(2, FLOAT_2D, vector_tx)
SAMPLER(3, FLOAT_2D_ARRAY, rp_color_tx)
SAMPLER(4, FLOAT_2D_ARRAY, rp_value_tx)
/* Color History for TAA needs to be sampler to leverage bilinear sampling. */
.sampler(5, ImageType::FLOAT_2D, "in_combined_tx")
.sampler(6, ImageType::FLOAT_2D, "cryptomatte_tx")
.image(0, GPU_R32F, Qualifier::READ, ImageType::FLOAT_2D_ARRAY, "in_weight_img")
.image(1, GPU_R32F, Qualifier::WRITE, ImageType::FLOAT_2D_ARRAY, "out_weight_img")
.specialization_constant(Type::UINT, "enabled_categories", 0)
.specialization_constant(Type::INT, "samples_len", 0)
.specialization_constant(Type::BOOL, "use_reprojection", false)
.specialization_constant(Type::INT, "scaling_factor", 1)
.specialization_constant(Type::INT, "combined_id", 0)
.specialization_constant(Type::INT, "display_id", -1)
.specialization_constant(Type::INT, "normal_id", -1)
.additional_info("eevee_shared")
.additional_info("eevee_global_ubo")
.additional_info("eevee_velocity_camera")
.additional_info("draw_view");
SAMPLER(5, FLOAT_2D, in_combined_tx)
SAMPLER(6, FLOAT_2D, cryptomatte_tx)
IMAGE(0, GPU_R32F, READ, FLOAT_2D_ARRAY, in_weight_img)
IMAGE(1, GPU_R32F, WRITE, FLOAT_2D_ARRAY, out_weight_img)
SPECIALIZATION_CONSTANT(UINT, enabled_categories, 0)
SPECIALIZATION_CONSTANT(INT, samples_len, 0)
SPECIALIZATION_CONSTANT(BOOL, use_reprojection, false)
SPECIALIZATION_CONSTANT(INT, scaling_factor, 1)
SPECIALIZATION_CONSTANT(INT, combined_id, 0)
SPECIALIZATION_CONSTANT(INT, display_id, -1)
SPECIALIZATION_CONSTANT(INT, normal_id, -1)
ADDITIONAL_INFO(eevee_shared)
ADDITIONAL_INFO(eevee_global_ubo)
ADDITIONAL_INFO(eevee_velocity_camera)
ADDITIONAL_INFO(draw_view)
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(eevee_film)
/* Color History for TAA needs to be sampler to leverage bilinear sampling. */
//.image(2, GPU_RGBA16F, Qualifier::READ, ImageType::FLOAT_2D, "in_combined_img")
.image(3, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_combined_img")
.image(4, GPU_R32F, Qualifier::READ_WRITE, ImageType::FLOAT_2D, "depth_img")
.image(5, GPU_RGBA16F, Qualifier::READ_WRITE, ImageType::FLOAT_2D_ARRAY, "color_accum_img")
.image(6, GPU_R16F, Qualifier::READ_WRITE, ImageType::FLOAT_2D_ARRAY, "value_accum_img")
.image(7, GPU_RGBA32F, Qualifier::READ_WRITE, ImageType::FLOAT_2D_ARRAY, "cryptomatte_img")
.additional_info("eevee_film_base");
// IMAGE(2, GPU_RGBA16F, READ, FLOAT_2D, in_combined_img)
IMAGE(3, GPU_RGBA16F, WRITE, FLOAT_2D, out_combined_img)
IMAGE(4, GPU_R32F, READ_WRITE, FLOAT_2D, depth_img)
IMAGE(5, GPU_RGBA16F, READ_WRITE, FLOAT_2D_ARRAY, color_accum_img)
IMAGE(6, GPU_R16F, READ_WRITE, FLOAT_2D_ARRAY, value_accum_img)
IMAGE(7, GPU_RGBA32F, READ_WRITE, FLOAT_2D_ARRAY, cryptomatte_img)
ADDITIONAL_INFO(eevee_film_base)
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(eevee_film_frag)
.do_static_compilation(true)
.fragment_out(0, Type::VEC4, "out_color")
.fragment_source("eevee_film_frag.glsl")
.additional_info("draw_fullscreen")
.additional_info("eevee_film")
.depth_write(DepthWrite::ANY);
DO_STATIC_COMPILATION()
FRAGMENT_OUT(0, VEC4, out_color)
FRAGMENT_SOURCE("eevee_film_frag.glsl")
ADDITIONAL_INFO(draw_fullscreen)
ADDITIONAL_INFO(eevee_film)
DEPTH_WRITE(DepthWrite::ANY)
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(eevee_film_comp)
.do_static_compilation(true)
.local_group_size(FILM_GROUP_SIZE, FILM_GROUP_SIZE)
.compute_source("eevee_film_comp.glsl")
.additional_info("eevee_film");
DO_STATIC_COMPILATION()
LOCAL_GROUP_SIZE(FILM_GROUP_SIZE, FILM_GROUP_SIZE)
COMPUTE_SOURCE("eevee_film_comp.glsl")
ADDITIONAL_INFO(eevee_film)
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(eevee_film_cryptomatte_post)
.do_static_compilation(true)
.image(0, GPU_RGBA32F, Qualifier::READ_WRITE, ImageType::FLOAT_2D_ARRAY, "cryptomatte_img")
.push_constant(Type::INT, "cryptomatte_layer_len")
.push_constant(Type::INT, "cryptomatte_samples_per_layer")
.local_group_size(FILM_GROUP_SIZE, FILM_GROUP_SIZE)
.compute_source("eevee_film_cryptomatte_post_comp.glsl")
.additional_info("eevee_global_ubo")
.additional_info("eevee_shared");
DO_STATIC_COMPILATION()
IMAGE(0, GPU_RGBA32F, READ_WRITE, FLOAT_2D_ARRAY, cryptomatte_img)
PUSH_CONSTANT(INT, cryptomatte_layer_len)
PUSH_CONSTANT(INT, cryptomatte_samples_per_layer)
LOCAL_GROUP_SIZE(FILM_GROUP_SIZE, FILM_GROUP_SIZE)
COMPUTE_SOURCE("eevee_film_cryptomatte_post_comp.glsl")
ADDITIONAL_INFO(eevee_global_ubo)
ADDITIONAL_INFO(eevee_shared)
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(eevee_film_copy_frag)
.do_static_compilation(true)
.image(3, GPU_RGBA16F, Qualifier::READ, ImageType::FLOAT_2D, "out_combined_img")
.image(4, GPU_R32F, Qualifier::READ, ImageType::FLOAT_2D, "depth_img")
.image(5, GPU_RGBA16F, Qualifier::READ, ImageType::FLOAT_2D_ARRAY, "color_accum_img")
.image(6, GPU_R16F, Qualifier::READ, ImageType::FLOAT_2D_ARRAY, "value_accum_img")
.image(7, GPU_RGBA32F, Qualifier::READ, ImageType::FLOAT_2D_ARRAY, "cryptomatte_img")
.depth_write(DepthWrite::ANY)
.fragment_out(0, Type::VEC4, "out_color")
.fragment_source("eevee_film_copy_frag.glsl")
.define("FILM_COPY")
.additional_info("draw_fullscreen")
.additional_info("eevee_film_base");
DO_STATIC_COMPILATION()
IMAGE(3, GPU_RGBA16F, READ, FLOAT_2D, out_combined_img)
IMAGE(4, GPU_R32F, READ, FLOAT_2D, depth_img)
IMAGE(5, GPU_RGBA16F, READ, FLOAT_2D_ARRAY, color_accum_img)
IMAGE(6, GPU_R16F, READ, FLOAT_2D_ARRAY, value_accum_img)
IMAGE(7, GPU_RGBA32F, READ, FLOAT_2D_ARRAY, cryptomatte_img)
DEPTH_WRITE(DepthWrite::ANY)
FRAGMENT_OUT(0, VEC4, out_color)
FRAGMENT_SOURCE("eevee_film_copy_frag.glsl")
DEFINE("FILM_COPY")
ADDITIONAL_INFO(draw_fullscreen)
ADDITIONAL_INFO(eevee_film_base)
GPU_SHADER_CREATE_END()
/* The combined pass is stored into its own 2D texture with a format of GPU_RGBA16F. */
GPU_SHADER_CREATE_INFO(eevee_film_pass_convert_combined)
.local_group_size(FILM_GROUP_SIZE, FILM_GROUP_SIZE)
.push_constant(Type::IVEC2, "offset")
.sampler(0, ImageType::FLOAT_2D, "input_tx")
.image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img")
.compute_source("eevee_film_pass_convert_comp.glsl")
.do_static_compilation(true);
LOCAL_GROUP_SIZE(FILM_GROUP_SIZE, FILM_GROUP_SIZE)
PUSH_CONSTANT(IVEC2, offset)
SAMPLER(0, FLOAT_2D, input_tx)
IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img)
COMPUTE_SOURCE("eevee_film_pass_convert_comp.glsl")
DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()
/* The depth pass is stored into its own 2D texture with a format of GPU_R32F. */
GPU_SHADER_CREATE_INFO(eevee_film_pass_convert_depth)
.local_group_size(FILM_GROUP_SIZE, FILM_GROUP_SIZE)
.push_constant(Type::IVEC2, "offset")
.sampler(0, ImageType::FLOAT_2D, "input_tx")
.image(0, GPU_R32F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img")
.compute_source("eevee_film_pass_convert_comp.glsl")
.do_static_compilation(true);
LOCAL_GROUP_SIZE(FILM_GROUP_SIZE, FILM_GROUP_SIZE)
PUSH_CONSTANT(IVEC2, offset)
SAMPLER(0, FLOAT_2D, input_tx)
IMAGE(0, GPU_R32F, WRITE, FLOAT_2D, output_img)
COMPUTE_SOURCE("eevee_film_pass_convert_comp.glsl")
DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()
/* Value passes are stored in a slice of a 2D texture array with a format of GPU_R16F. */
GPU_SHADER_CREATE_INFO(eevee_film_pass_convert_value)
.local_group_size(FILM_GROUP_SIZE, FILM_GROUP_SIZE)
.push_constant(Type::IVEC2, "offset")
.define("IS_ARRAY_INPUT")
.sampler(0, ImageType::FLOAT_2D_ARRAY, "input_tx")
.image(0, GPU_R16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img")
.compute_source("eevee_film_pass_convert_comp.glsl")
.do_static_compilation(true);
LOCAL_GROUP_SIZE(FILM_GROUP_SIZE, FILM_GROUP_SIZE)
PUSH_CONSTANT(IVEC2, offset)
DEFINE("IS_ARRAY_INPUT")
SAMPLER(0, FLOAT_2D_ARRAY, input_tx)
IMAGE(0, GPU_R16F, WRITE, FLOAT_2D, output_img)
COMPUTE_SOURCE("eevee_film_pass_convert_comp.glsl")
DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()
/* Color passes are stored in a slice of a 2D texture array with a format of GPU_RGBA16F. */
GPU_SHADER_CREATE_INFO(eevee_film_pass_convert_color)
.local_group_size(FILM_GROUP_SIZE, FILM_GROUP_SIZE)
.push_constant(Type::IVEC2, "offset")
.define("IS_ARRAY_INPUT")
.sampler(0, ImageType::FLOAT_2D_ARRAY, "input_tx")
.image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img")
.compute_source("eevee_film_pass_convert_comp.glsl")
.do_static_compilation(true);
LOCAL_GROUP_SIZE(FILM_GROUP_SIZE, FILM_GROUP_SIZE)
PUSH_CONSTANT(IVEC2, offset)
DEFINE("IS_ARRAY_INPUT")
SAMPLER(0, FLOAT_2D_ARRAY, input_tx)
IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, output_img)
COMPUTE_SOURCE("eevee_film_pass_convert_comp.glsl")
DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()
/* Cryptomatte passes are stored in a slice of a 2D texture array with a format of GPU_RGBA32F. */
GPU_SHADER_CREATE_INFO(eevee_film_pass_convert_cryptomatte)
.local_group_size(FILM_GROUP_SIZE, FILM_GROUP_SIZE)
.push_constant(Type::IVEC2, "offset")
.define("IS_ARRAY_INPUT")
.sampler(0, ImageType::FLOAT_2D_ARRAY, "input_tx")
.image(0, GPU_RGBA32F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img")
.compute_source("eevee_film_pass_convert_comp.glsl")
.do_static_compilation(true);
LOCAL_GROUP_SIZE(FILM_GROUP_SIZE, FILM_GROUP_SIZE)
PUSH_CONSTANT(IVEC2, offset)
DEFINE("IS_ARRAY_INPUT")
SAMPLER(0, FLOAT_2D_ARRAY, input_tx)
IMAGE(0, GPU_RGBA32F, WRITE, FLOAT_2D, output_img)
COMPUTE_SOURCE("eevee_film_pass_convert_comp.glsl")
DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()

View File

@ -6,39 +6,44 @@
#include "gpu_shader_create_info.hh"
GPU_SHADER_CREATE_INFO(eevee_hiz_data)
.sampler(HIZ_TEX_SLOT, ImageType::FLOAT_2D, "hiz_tx")
.additional_info("eevee_global_ubo");
SAMPLER(HIZ_TEX_SLOT, FLOAT_2D, hiz_tx)
ADDITIONAL_INFO(eevee_global_ubo)
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(eevee_hiz_update_base)
.local_group_size(FILM_GROUP_SIZE, FILM_GROUP_SIZE)
.storage_buf(0, Qualifier::READ_WRITE, "uint", "finished_tile_counter")
.image(0, GPU_R32F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_mip_0")
.image(1, GPU_R32F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_mip_1")
.image(2, GPU_R32F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_mip_2")
.image(3, GPU_R32F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_mip_3")
.image(4, GPU_R32F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_mip_4")
.image(5, GPU_R32F, Qualifier::READ_WRITE, ImageType::FLOAT_2D, "out_mip_5")
.image(6, GPU_R32F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_mip_6")
.specialization_constant(Type::BOOL, "update_mip_0", true)
.compute_source("eevee_hiz_update_comp.glsl");
LOCAL_GROUP_SIZE(FILM_GROUP_SIZE, FILM_GROUP_SIZE)
STORAGE_BUF(0, READ_WRITE, uint, finished_tile_counter)
IMAGE(0, GPU_R32F, WRITE, FLOAT_2D, out_mip_0)
IMAGE(1, GPU_R32F, WRITE, FLOAT_2D, out_mip_1)
IMAGE(2, GPU_R32F, WRITE, FLOAT_2D, out_mip_2)
IMAGE(3, GPU_R32F, WRITE, FLOAT_2D, out_mip_3)
IMAGE(4, GPU_R32F, WRITE, FLOAT_2D, out_mip_4)
IMAGE(5, GPU_R32F, READ_WRITE, FLOAT_2D, out_mip_5)
IMAGE(6, GPU_R32F, WRITE, FLOAT_2D, out_mip_6)
SPECIALIZATION_CONSTANT(BOOL, update_mip_0, true)
COMPUTE_SOURCE("eevee_hiz_update_comp.glsl")
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(eevee_hiz_update)
.do_static_compilation(true)
.sampler(0, ImageType::DEPTH_2D, "depth_tx")
.additional_info("eevee_hiz_update_base");
DO_STATIC_COMPILATION()
SAMPLER(0, DEPTH_2D, depth_tx)
ADDITIONAL_INFO(eevee_hiz_update_base)
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(eevee_hiz_update_layer)
.do_static_compilation(true)
.define("HIZ_LAYER")
.sampler(1, ImageType::DEPTH_2D_ARRAY, "depth_layered_tx")
.push_constant(Type::INT, "layer_id")
.additional_info("eevee_hiz_update_base");
DO_STATIC_COMPILATION()
DEFINE("HIZ_LAYER")
SAMPLER(1, DEPTH_2D_ARRAY, depth_layered_tx)
PUSH_CONSTANT(INT, layer_id)
ADDITIONAL_INFO(eevee_hiz_update_base)
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(eevee_hiz_debug)
.do_static_compilation(true)
.fragment_out(0, Type::VEC4, "out_debug_color_add", DualBlend::SRC_0)
.fragment_out(0, Type::VEC4, "out_debug_color_mul", DualBlend::SRC_1)
.fragment_source("eevee_hiz_debug_frag.glsl")
.additional_info("eevee_shared")
.additional_info("eevee_hiz_data")
.additional_info("draw_fullscreen");
DO_STATIC_COMPILATION()
FRAGMENT_OUT_DUAL(0, VEC4, out_debug_color_add, SRC_0)
FRAGMENT_OUT_DUAL(0, VEC4, out_debug_color_mul, SRC_1)
FRAGMENT_SOURCE("eevee_hiz_debug_frag.glsl")
ADDITIONAL_INFO(eevee_shared)
ADDITIONAL_INFO(eevee_hiz_data)
ADDITIONAL_INFO(draw_fullscreen)
GPU_SHADER_CREATE_END()

View File

@ -10,10 +10,11 @@
* \{ */
GPU_SHADER_CREATE_INFO(eevee_light_data)
.storage_buf(LIGHT_CULL_BUF_SLOT, Qualifier::READ, "LightCullingData", "light_cull_buf")
.storage_buf(LIGHT_BUF_SLOT, Qualifier::READ, "LightData", "light_buf[]")
.storage_buf(LIGHT_ZBIN_BUF_SLOT, Qualifier::READ, "uint", "light_zbin_buf[]")
.storage_buf(LIGHT_TILE_BUF_SLOT, Qualifier::READ, "uint", "light_tile_buf[]");
STORAGE_BUF(LIGHT_CULL_BUF_SLOT, READ, LightCullingData, light_cull_buf)
STORAGE_BUF(LIGHT_BUF_SLOT, READ, LightData, light_buf[])
STORAGE_BUF(LIGHT_ZBIN_BUF_SLOT, READ, uint, light_zbin_buf[])
STORAGE_BUF(LIGHT_TILE_BUF_SLOT, READ, uint, light_tile_buf[])
GPU_SHADER_CREATE_END()
/** \} */
@ -22,63 +23,68 @@ GPU_SHADER_CREATE_INFO(eevee_light_data)
* \{ */
GPU_SHADER_CREATE_INFO(eevee_light_culling_select)
.do_static_compilation(true)
.additional_info("eevee_shared")
.additional_info("draw_view")
.additional_info("draw_view_culling")
.local_group_size(CULLING_SELECT_GROUP_SIZE)
.storage_buf(0, Qualifier::READ_WRITE, "LightCullingData", "light_cull_buf")
.storage_buf(1, Qualifier::READ, "LightData", "in_light_buf[]")
.storage_buf(2, Qualifier::WRITE, "LightData", "out_light_buf[]")
.storage_buf(3, Qualifier::WRITE, "float", "out_zdist_buf[]")
.storage_buf(4, Qualifier::WRITE, "uint", "out_key_buf[]")
.uniform_buf(0, "LightData", "sunlight_buf")
.compute_source("eevee_light_culling_select_comp.glsl");
DO_STATIC_COMPILATION()
ADDITIONAL_INFO(eevee_shared)
ADDITIONAL_INFO(draw_view)
ADDITIONAL_INFO(draw_view_culling)
LOCAL_GROUP_SIZE(CULLING_SELECT_GROUP_SIZE)
STORAGE_BUF(0, READ_WRITE, LightCullingData, light_cull_buf)
STORAGE_BUF(1, READ, LightData, in_light_buf[])
STORAGE_BUF(2, WRITE, LightData, out_light_buf[])
STORAGE_BUF(3, WRITE, float, out_zdist_buf[])
STORAGE_BUF(4, WRITE, uint, out_key_buf[])
UNIFORM_BUF(0, LightData, sunlight_buf)
COMPUTE_SOURCE("eevee_light_culling_select_comp.glsl")
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(eevee_light_culling_sort)
.do_static_compilation(true)
.additional_info("eevee_shared")
.additional_info("draw_view")
.storage_buf(0, Qualifier::READ, "LightCullingData", "light_cull_buf")
.storage_buf(1, Qualifier::READ, "LightData", "in_light_buf[]")
.storage_buf(2, Qualifier::WRITE, "LightData", "out_light_buf[]")
.storage_buf(3, Qualifier::READ, "float", "in_zdist_buf[]")
.storage_buf(4, Qualifier::READ, "uint", "in_key_buf[]")
.local_group_size(CULLING_SORT_GROUP_SIZE)
.compute_source("eevee_light_culling_sort_comp.glsl");
DO_STATIC_COMPILATION()
ADDITIONAL_INFO(eevee_shared)
ADDITIONAL_INFO(draw_view)
STORAGE_BUF(0, READ, LightCullingData, light_cull_buf)
STORAGE_BUF(1, READ, LightData, in_light_buf[])
STORAGE_BUF(2, WRITE, LightData, out_light_buf[])
STORAGE_BUF(3, READ, float, in_zdist_buf[])
STORAGE_BUF(4, READ, uint, in_key_buf[])
LOCAL_GROUP_SIZE(CULLING_SORT_GROUP_SIZE)
COMPUTE_SOURCE("eevee_light_culling_sort_comp.glsl")
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(eevee_light_culling_zbin)
.do_static_compilation(true)
.additional_info("eevee_shared")
.additional_info("draw_view")
.local_group_size(CULLING_ZBIN_GROUP_SIZE)
.storage_buf(0, Qualifier::READ, "LightCullingData", "light_cull_buf")
.storage_buf(1, Qualifier::READ, "LightData", "light_buf[]")
.storage_buf(2, Qualifier::WRITE, "uint", "out_zbin_buf[]")
.compute_source("eevee_light_culling_zbin_comp.glsl");
DO_STATIC_COMPILATION()
ADDITIONAL_INFO(eevee_shared)
ADDITIONAL_INFO(draw_view)
LOCAL_GROUP_SIZE(CULLING_ZBIN_GROUP_SIZE)
STORAGE_BUF(0, READ, LightCullingData, light_cull_buf)
STORAGE_BUF(1, READ, LightData, light_buf[])
STORAGE_BUF(2, WRITE, uint, out_zbin_buf[])
COMPUTE_SOURCE("eevee_light_culling_zbin_comp.glsl")
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(eevee_light_culling_tile)
.do_static_compilation(true)
.additional_info("eevee_shared")
.additional_info("draw_view")
.additional_info("draw_view_culling")
.local_group_size(CULLING_TILE_GROUP_SIZE)
.storage_buf(0, Qualifier::READ, "LightCullingData", "light_cull_buf")
.storage_buf(1, Qualifier::READ, "LightData", "light_buf[]")
.storage_buf(2, Qualifier::WRITE, "uint", "out_light_tile_buf[]")
.compute_source("eevee_light_culling_tile_comp.glsl");
DO_STATIC_COMPILATION()
ADDITIONAL_INFO(eevee_shared)
ADDITIONAL_INFO(draw_view)
ADDITIONAL_INFO(draw_view_culling)
LOCAL_GROUP_SIZE(CULLING_TILE_GROUP_SIZE)
STORAGE_BUF(0, READ, LightCullingData, light_cull_buf)
STORAGE_BUF(1, READ, LightData, light_buf[])
STORAGE_BUF(2, WRITE, uint, out_light_tile_buf[])
COMPUTE_SOURCE("eevee_light_culling_tile_comp.glsl")
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(eevee_light_shadow_setup)
.do_static_compilation(true)
.additional_info("eevee_shared")
.additional_info("eevee_sampling_data")
.additional_info("eevee_global_ubo")
.local_group_size(CULLING_SELECT_GROUP_SIZE)
.storage_buf(0, Qualifier::READ, "LightCullingData", "light_cull_buf")
.storage_buf(1, Qualifier::READ_WRITE, "LightData", "light_buf[]")
.storage_buf(2, Qualifier::READ_WRITE, "ShadowTileMapData", "tilemaps_buf[]")
.storage_buf(3, Qualifier::READ_WRITE, "ShadowTileMapClip", "tilemaps_clip_buf[]")
.compute_source("eevee_light_shadow_setup_comp.glsl");
DO_STATIC_COMPILATION()
ADDITIONAL_INFO(eevee_shared)
ADDITIONAL_INFO(eevee_sampling_data)
ADDITIONAL_INFO(eevee_global_ubo)
LOCAL_GROUP_SIZE(CULLING_SELECT_GROUP_SIZE)
STORAGE_BUF(0, READ, LightCullingData, light_cull_buf)
STORAGE_BUF(1, READ_WRITE, LightData, light_buf[])
STORAGE_BUF(2, READ_WRITE, ShadowTileMapData, tilemaps_buf[])
STORAGE_BUF(3, READ_WRITE, ShadowTileMapClip, tilemaps_clip_buf[])
COMPUTE_SOURCE("eevee_light_shadow_setup_comp.glsl")
GPU_SHADER_CREATE_END()
/** \} */
@ -87,11 +93,15 @@ GPU_SHADER_CREATE_INFO(eevee_light_shadow_setup)
* \{ */
GPU_SHADER_CREATE_INFO(eevee_light_culling_debug)
.do_static_compilation(true)
.fragment_out(0, Type::VEC4, "out_debug_color_add", DualBlend::SRC_0)
.fragment_out(0, Type::VEC4, "out_debug_color_mul", DualBlend::SRC_1)
.fragment_source("eevee_light_culling_debug_frag.glsl")
.additional_info(
"eevee_shared", "draw_view", "draw_fullscreen", "eevee_light_data", "eevee_hiz_data");
DO_STATIC_COMPILATION()
FRAGMENT_OUT_DUAL(0, VEC4, out_debug_color_add, SRC_0)
FRAGMENT_OUT_DUAL(0, VEC4, out_debug_color_mul, SRC_1)
FRAGMENT_SOURCE("eevee_light_culling_debug_frag.glsl")
ADDITIONAL_INFO(eevee_shared)
ADDITIONAL_INFO(draw_view)
ADDITIONAL_INFO(draw_fullscreen)
ADDITIONAL_INFO(eevee_light_data)
ADDITIONAL_INFO(eevee_hiz_data)
GPU_SHADER_CREATE_END()
/** \} */

View File

@ -10,106 +10,111 @@
* \{ */
GPU_SHADER_CREATE_INFO(eevee_lightprobe_sphere_data)
.define("SPHERE_PROBE")
.uniform_buf(SPHERE_PROBE_BUF_SLOT,
"SphereProbeData",
"lightprobe_sphere_buf[SPHERE_PROBE_MAX]")
.sampler(SPHERE_PROBE_TEX_SLOT, ImageType::FLOAT_2D_ARRAY, "lightprobe_spheres_tx");
DEFINE("SPHERE_PROBE")
UNIFORM_BUF(SPHERE_PROBE_BUF_SLOT, SphereProbeData, lightprobe_sphere_buf[SPHERE_PROBE_MAX])
SAMPLER(SPHERE_PROBE_TEX_SLOT, FLOAT_2D_ARRAY, lightprobe_spheres_tx)
GPU_SHADER_CREATE_END()
/* Sample cubemap and remap into an octahedral texture. */
GPU_SHADER_CREATE_INFO(eevee_lightprobe_sphere_remap)
.local_group_size(SPHERE_PROBE_REMAP_GROUP_SIZE, SPHERE_PROBE_REMAP_GROUP_SIZE)
.specialization_constant(Type::BOOL, "extract_sh", true)
.specialization_constant(Type::BOOL, "extract_sun", true)
.push_constant(Type::IVEC4, "probe_coord_packed")
.push_constant(Type::IVEC4, "write_coord_packed")
.push_constant(Type::IVEC4, "world_coord_packed")
.sampler(0, ImageType::FLOAT_CUBE, "cubemap_tx")
.sampler(1, ImageType::FLOAT_2D_ARRAY, "atlas_tx")
.storage_buf(0, Qualifier::WRITE, "SphereProbeHarmonic", "out_sh[]")
.storage_buf(1, Qualifier::WRITE, "SphereProbeSunLight", "out_sun[]")
.image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D_ARRAY, "atlas_img")
.compute_source("eevee_lightprobe_sphere_remap_comp.glsl")
.additional_info("eevee_shared")
.additional_info("eevee_global_ubo")
.do_static_compilation(true);
LOCAL_GROUP_SIZE(SPHERE_PROBE_REMAP_GROUP_SIZE, SPHERE_PROBE_REMAP_GROUP_SIZE)
SPECIALIZATION_CONSTANT(BOOL, extract_sh, true)
SPECIALIZATION_CONSTANT(BOOL, extract_sun, true)
PUSH_CONSTANT(IVEC4, probe_coord_packed)
PUSH_CONSTANT(IVEC4, write_coord_packed)
PUSH_CONSTANT(IVEC4, world_coord_packed)
SAMPLER(0, FLOAT_CUBE, cubemap_tx)
SAMPLER(1, FLOAT_2D_ARRAY, atlas_tx)
STORAGE_BUF(0, WRITE, SphereProbeHarmonic, out_sh[])
STORAGE_BUF(1, WRITE, SphereProbeSunLight, out_sun[])
IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D_ARRAY, atlas_img)
COMPUTE_SOURCE("eevee_lightprobe_sphere_remap_comp.glsl")
ADDITIONAL_INFO(eevee_shared)
ADDITIONAL_INFO(eevee_global_ubo)
DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(eevee_lightprobe_sphere_irradiance)
.local_group_size(SPHERE_PROBE_SH_GROUP_SIZE)
.push_constant(Type::IVEC3, "probe_remap_dispatch_size")
.storage_buf(0, Qualifier::READ, "SphereProbeHarmonic", "in_sh[]")
.storage_buf(1, Qualifier::WRITE, "SphereProbeHarmonic", "out_sh")
.additional_info("eevee_shared")
.do_static_compilation(true)
.compute_source("eevee_lightprobe_sphere_irradiance_comp.glsl");
LOCAL_GROUP_SIZE(SPHERE_PROBE_SH_GROUP_SIZE)
PUSH_CONSTANT(IVEC3, probe_remap_dispatch_size)
STORAGE_BUF(0, READ, SphereProbeHarmonic, in_sh[])
STORAGE_BUF(1, WRITE, SphereProbeHarmonic, out_sh)
ADDITIONAL_INFO(eevee_shared)
DO_STATIC_COMPILATION()
COMPUTE_SOURCE("eevee_lightprobe_sphere_irradiance_comp.glsl")
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(eevee_lightprobe_sphere_sunlight)
.local_group_size(SPHERE_PROBE_SH_GROUP_SIZE)
.push_constant(Type::IVEC3, "probe_remap_dispatch_size")
.storage_buf(0, Qualifier::READ, "SphereProbeSunLight", "in_sun[]")
.storage_buf(1, Qualifier::WRITE, "LightData", "sunlight_buf")
.additional_info("eevee_shared")
.do_static_compilation(true)
.compute_source("eevee_lightprobe_sphere_sunlight_comp.glsl");
LOCAL_GROUP_SIZE(SPHERE_PROBE_SH_GROUP_SIZE)
PUSH_CONSTANT(IVEC3, probe_remap_dispatch_size)
STORAGE_BUF(0, READ, SphereProbeSunLight, in_sun[])
STORAGE_BUF(1, WRITE, LightData, sunlight_buf)
ADDITIONAL_INFO(eevee_shared)
DO_STATIC_COMPILATION()
COMPUTE_SOURCE("eevee_lightprobe_sphere_sunlight_comp.glsl")
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(eevee_lightprobe_sphere_select)
.local_group_size(SPHERE_PROBE_SELECT_GROUP_SIZE)
.storage_buf(0,
Qualifier::READ_WRITE,
"SphereProbeData",
"lightprobe_sphere_buf[SPHERE_PROBE_MAX]")
.push_constant(Type::INT, "lightprobe_sphere_count")
.additional_info("eevee_shared")
.additional_info("eevee_sampling_data")
.additional_info("eevee_global_ubo")
.additional_info("eevee_volume_probe_data")
.compute_source("eevee_lightprobe_sphere_select_comp.glsl")
.do_static_compilation(true);
LOCAL_GROUP_SIZE(SPHERE_PROBE_SELECT_GROUP_SIZE)
STORAGE_BUF(0, READ_WRITE, SphereProbeData, lightprobe_sphere_buf[SPHERE_PROBE_MAX])
PUSH_CONSTANT(INT, lightprobe_sphere_count)
ADDITIONAL_INFO(eevee_shared)
ADDITIONAL_INFO(eevee_sampling_data)
ADDITIONAL_INFO(eevee_global_ubo)
ADDITIONAL_INFO(eevee_volume_probe_data)
COMPUTE_SOURCE("eevee_lightprobe_sphere_select_comp.glsl")
DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(eevee_lightprobe_sphere_convolve)
.local_group_size(SPHERE_PROBE_GROUP_SIZE, SPHERE_PROBE_GROUP_SIZE)
.additional_info("eevee_shared")
.push_constant(Type::IVEC4, "probe_coord_packed")
.push_constant(Type::IVEC4, "write_coord_packed")
.push_constant(Type::IVEC4, "read_coord_packed")
.push_constant(Type::INT, "read_lod")
.sampler(0, ImageType::FLOAT_CUBE, "cubemap_tx")
.sampler(1, ImageType::FLOAT_2D_ARRAY, "in_atlas_mip_tx")
.image(1, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D_ARRAY, "out_atlas_mip_img")
.compute_source("eevee_lightprobe_sphere_convolve_comp.glsl")
.do_static_compilation(true);
LOCAL_GROUP_SIZE(SPHERE_PROBE_GROUP_SIZE, SPHERE_PROBE_GROUP_SIZE)
ADDITIONAL_INFO(eevee_shared)
PUSH_CONSTANT(IVEC4, probe_coord_packed)
PUSH_CONSTANT(IVEC4, write_coord_packed)
PUSH_CONSTANT(IVEC4, read_coord_packed)
PUSH_CONSTANT(INT, read_lod)
SAMPLER(0, FLOAT_CUBE, cubemap_tx)
SAMPLER(1, FLOAT_2D_ARRAY, in_atlas_mip_tx)
IMAGE(1, GPU_RGBA16F, WRITE, FLOAT_2D_ARRAY, out_atlas_mip_img)
COMPUTE_SOURCE("eevee_lightprobe_sphere_convolve_comp.glsl")
DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()
GPU_SHADER_INTERFACE_INFO(eevee_display_lightprobe_sphere_iface)
.smooth(Type::VEC3, "P")
.smooth(Type::VEC2, "lP")
.flat(Type::INT, "probe_index");
SMOOTH(VEC3, P)
SMOOTH(VEC2, lP)
FLAT(INT, probe_index)
GPU_SHADER_INTERFACE_END()
GPU_SHADER_CREATE_INFO(eevee_display_lightprobe_sphere)
.additional_info("eevee_shared")
.additional_info("draw_view")
.additional_info("eevee_lightprobe_sphere_data")
.storage_buf(0, Qualifier::READ, "SphereProbeDisplayData", "display_data_buf[]")
.vertex_source("eevee_display_lightprobe_sphere_vert.glsl")
.vertex_out(eevee_display_lightprobe_sphere_iface)
.fragment_source("eevee_display_lightprobe_sphere_frag.glsl")
.fragment_out(0, Type::VEC4, "out_color")
.do_static_compilation(true);
ADDITIONAL_INFO(eevee_shared)
ADDITIONAL_INFO(draw_view)
ADDITIONAL_INFO(eevee_lightprobe_sphere_data)
STORAGE_BUF(0, READ, SphereProbeDisplayData, display_data_buf[])
VERTEX_SOURCE("eevee_display_lightprobe_sphere_vert.glsl")
VERTEX_OUT(eevee_display_lightprobe_sphere_iface)
FRAGMENT_SOURCE("eevee_display_lightprobe_sphere_frag.glsl")
FRAGMENT_OUT(0, VEC4, out_color)
DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()
GPU_SHADER_INTERFACE_INFO(eevee_display_lightprobe_planar_iface)
.flat(Type::VEC3, "probe_normal")
.flat(Type::INT, "probe_index");
FLAT(VEC3, probe_normal)
FLAT(INT, probe_index)
GPU_SHADER_INTERFACE_END()
GPU_SHADER_CREATE_INFO(eevee_display_lightprobe_planar)
.push_constant(Type::IVEC4, "world_coord_packed")
.additional_info("eevee_shared")
.additional_info("draw_view")
.additional_info("eevee_lightprobe_planar_data")
.additional_info("eevee_lightprobe_sphere_data")
.storage_buf(0, Qualifier::READ, "PlanarProbeDisplayData", "display_data_buf[]")
.vertex_source("eevee_display_lightprobe_planar_vert.glsl")
.vertex_out(eevee_display_lightprobe_planar_iface)
.fragment_source("eevee_display_lightprobe_planar_frag.glsl")
.fragment_out(0, Type::VEC4, "out_color")
.do_static_compilation(true);
PUSH_CONSTANT(IVEC4, world_coord_packed)
ADDITIONAL_INFO(eevee_shared)
ADDITIONAL_INFO(draw_view)
ADDITIONAL_INFO(eevee_lightprobe_planar_data)
ADDITIONAL_INFO(eevee_lightprobe_sphere_data)
STORAGE_BUF(0, READ, PlanarProbeDisplayData, display_data_buf[])
VERTEX_SOURCE("eevee_display_lightprobe_planar_vert.glsl")
VERTEX_OUT(eevee_display_lightprobe_planar_iface)
FRAGMENT_SOURCE("eevee_display_lightprobe_planar_frag.glsl")
FRAGMENT_OUT(0, VEC4, out_color)
DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()
/** \} */

View File

@ -10,58 +10,65 @@
* \{ */
GPU_SHADER_INTERFACE_INFO(eevee_debug_surfel_iface)
.smooth(Type::VEC3, "P")
.flat(Type::INT, "surfel_index");
SMOOTH(VEC3, P)
FLAT(INT, surfel_index)
GPU_SHADER_INTERFACE_END()
GPU_SHADER_CREATE_INFO(eevee_debug_surfels)
.additional_info("eevee_shared")
.additional_info("draw_view")
.vertex_source("eevee_debug_surfels_vert.glsl")
.vertex_out(eevee_debug_surfel_iface)
.fragment_source("eevee_debug_surfels_frag.glsl")
.fragment_out(0, Type::VEC4, "out_color")
.storage_buf(0, Qualifier::READ, "Surfel", "surfels_buf[]")
.push_constant(Type::FLOAT, "debug_surfel_radius")
.push_constant(Type::INT, "debug_mode")
.do_static_compilation(true);
ADDITIONAL_INFO(eevee_shared)
ADDITIONAL_INFO(draw_view)
VERTEX_SOURCE("eevee_debug_surfels_vert.glsl")
VERTEX_OUT(eevee_debug_surfel_iface)
FRAGMENT_SOURCE("eevee_debug_surfels_frag.glsl")
FRAGMENT_OUT(0, VEC4, out_color)
STORAGE_BUF(0, READ, Surfel, surfels_buf[])
PUSH_CONSTANT(FLOAT, debug_surfel_radius)
PUSH_CONSTANT(INT, debug_mode)
DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()
GPU_SHADER_INTERFACE_INFO(eevee_debug_irradiance_grid_iface).smooth(Type::VEC4, "interp_color");
GPU_SHADER_INTERFACE_INFO(eevee_debug_irradiance_grid_iface)
SMOOTH(VEC4, interp_color)
GPU_SHADER_INTERFACE_END()
GPU_SHADER_CREATE_INFO(eevee_debug_irradiance_grid)
.additional_info("eevee_shared")
.additional_info("draw_view")
.fragment_out(0, Type::VEC4, "out_color")
.vertex_out(eevee_debug_irradiance_grid_iface)
.sampler(0, ImageType::FLOAT_3D, "debug_data_tx")
.push_constant(Type::MAT4, "grid_mat")
.push_constant(Type::INT, "debug_mode")
.push_constant(Type::FLOAT, "debug_value")
.vertex_source("eevee_debug_irradiance_grid_vert.glsl")
.fragment_source("eevee_debug_irradiance_grid_frag.glsl")
.do_static_compilation(true);
ADDITIONAL_INFO(eevee_shared)
ADDITIONAL_INFO(draw_view)
FRAGMENT_OUT(0, VEC4, out_color)
VERTEX_OUT(eevee_debug_irradiance_grid_iface)
SAMPLER(0, FLOAT_3D, debug_data_tx)
PUSH_CONSTANT(MAT4, grid_mat)
PUSH_CONSTANT(INT, debug_mode)
PUSH_CONSTANT(FLOAT, debug_value)
VERTEX_SOURCE("eevee_debug_irradiance_grid_vert.glsl")
FRAGMENT_SOURCE("eevee_debug_irradiance_grid_frag.glsl")
DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()
GPU_SHADER_INTERFACE_INFO(eevee_display_lightprobe_volume_iface)
.smooth(Type::VEC2, "lP")
.flat(Type::IVEC3, "cell");
SMOOTH(VEC2, lP)
FLAT(IVEC3, cell)
GPU_SHADER_INTERFACE_END()
GPU_SHADER_CREATE_INFO(eevee_display_lightprobe_volume)
.additional_info("eevee_shared")
.additional_info("draw_view")
.vertex_source("eevee_display_lightprobe_volume_vert.glsl")
.vertex_out(eevee_display_lightprobe_volume_iface)
.fragment_source("eevee_display_lightprobe_volume_frag.glsl")
.fragment_out(0, Type::VEC4, "out_color")
.push_constant(Type::FLOAT, "sphere_radius")
.push_constant(Type::IVEC3, "grid_resolution")
.push_constant(Type::MAT4, "grid_to_world")
.push_constant(Type::MAT4, "world_to_grid")
.push_constant(Type::BOOL, "display_validity")
.sampler(0, ImageType::FLOAT_3D, "irradiance_a_tx")
.sampler(1, ImageType::FLOAT_3D, "irradiance_b_tx")
.sampler(2, ImageType::FLOAT_3D, "irradiance_c_tx")
.sampler(3, ImageType::FLOAT_3D, "irradiance_d_tx")
.sampler(4, ImageType::FLOAT_3D, "validity_tx")
.do_static_compilation(true);
ADDITIONAL_INFO(eevee_shared)
ADDITIONAL_INFO(draw_view)
VERTEX_SOURCE("eevee_display_lightprobe_volume_vert.glsl")
VERTEX_OUT(eevee_display_lightprobe_volume_iface)
FRAGMENT_SOURCE("eevee_display_lightprobe_volume_frag.glsl")
FRAGMENT_OUT(0, VEC4, out_color)
PUSH_CONSTANT(FLOAT, sphere_radius)
PUSH_CONSTANT(IVEC3, grid_resolution)
PUSH_CONSTANT(MAT4, grid_to_world)
PUSH_CONSTANT(MAT4, world_to_grid)
PUSH_CONSTANT(BOOL, display_validity)
SAMPLER(0, FLOAT_3D, irradiance_a_tx)
SAMPLER(1, FLOAT_3D, irradiance_b_tx)
SAMPLER(2, FLOAT_3D, irradiance_c_tx)
SAMPLER(3, FLOAT_3D, irradiance_d_tx)
SAMPLER(4, FLOAT_3D, validity_tx)
DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()
/** \} */
@ -70,108 +77,117 @@ GPU_SHADER_CREATE_INFO(eevee_display_lightprobe_volume)
* \{ */
GPU_SHADER_CREATE_INFO(eevee_surfel_common)
.storage_buf(SURFEL_BUF_SLOT, Qualifier::READ_WRITE, "Surfel", "surfel_buf[]")
.storage_buf(CAPTURE_BUF_SLOT, Qualifier::READ, "CaptureInfoData", "capture_info_buf");
STORAGE_BUF(SURFEL_BUF_SLOT, READ_WRITE, Surfel, surfel_buf[])
STORAGE_BUF(CAPTURE_BUF_SLOT, READ, CaptureInfoData, capture_info_buf)
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(eevee_surfel_light)
.define("LIGHT_ITER_FORCE_NO_CULLING")
.define("LIGHT_CLOSURE_EVAL_COUNT", "1")
.local_group_size(SURFEL_GROUP_SIZE)
.additional_info("eevee_shared")
.additional_info("draw_view")
.additional_info("eevee_global_ubo")
.additional_info("eevee_utility_texture")
.additional_info("eevee_surfel_common")
.additional_info("eevee_light_data")
.additional_info("eevee_shadow_data")
.compute_source("eevee_surfel_light_comp.glsl")
.do_static_compilation(true);
DEFINE("LIGHT_ITER_FORCE_NO_CULLING")
DEFINE_VALUE("LIGHT_CLOSURE_EVAL_COUNT", "1")
LOCAL_GROUP_SIZE(SURFEL_GROUP_SIZE)
ADDITIONAL_INFO(eevee_shared)
ADDITIONAL_INFO(draw_view)
ADDITIONAL_INFO(eevee_global_ubo)
ADDITIONAL_INFO(eevee_utility_texture)
ADDITIONAL_INFO(eevee_surfel_common)
ADDITIONAL_INFO(eevee_light_data)
ADDITIONAL_INFO(eevee_shadow_data)
COMPUTE_SOURCE("eevee_surfel_light_comp.glsl")
DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(eevee_surfel_cluster_build)
.local_group_size(SURFEL_GROUP_SIZE)
.builtins(BuiltinBits::TEXTURE_ATOMIC)
.additional_info("eevee_shared")
.additional_info("eevee_surfel_common")
.additional_info("draw_view")
.image(0, GPU_R32I, Qualifier::READ_WRITE, ImageType::INT_3D_ATOMIC, "cluster_list_img")
.compute_source("eevee_surfel_cluster_build_comp.glsl")
.do_static_compilation(true);
LOCAL_GROUP_SIZE(SURFEL_GROUP_SIZE)
BUILTINS(BuiltinBits::TEXTURE_ATOMIC)
ADDITIONAL_INFO(eevee_shared)
ADDITIONAL_INFO(eevee_surfel_common)
ADDITIONAL_INFO(draw_view)
IMAGE(0, GPU_R32I, READ_WRITE, INT_3D_ATOMIC, cluster_list_img)
COMPUTE_SOURCE("eevee_surfel_cluster_build_comp.glsl")
DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(eevee_surfel_list_build)
.local_group_size(SURFEL_GROUP_SIZE)
.builtins(BuiltinBits::TEXTURE_ATOMIC)
.additional_info("eevee_shared")
.additional_info("eevee_surfel_common")
.additional_info("draw_view")
.storage_buf(0, Qualifier::READ_WRITE, "int", "list_start_buf[]")
.storage_buf(6, Qualifier::READ_WRITE, "SurfelListInfoData", "list_info_buf")
.compute_source("eevee_surfel_list_build_comp.glsl")
.do_static_compilation(true);
LOCAL_GROUP_SIZE(SURFEL_GROUP_SIZE)
BUILTINS(BuiltinBits::TEXTURE_ATOMIC)
ADDITIONAL_INFO(eevee_shared)
ADDITIONAL_INFO(eevee_surfel_common)
ADDITIONAL_INFO(draw_view)
STORAGE_BUF(0, READ_WRITE, int, list_start_buf[])
STORAGE_BUF(6, READ_WRITE, SurfelListInfoData, list_info_buf)
COMPUTE_SOURCE("eevee_surfel_list_build_comp.glsl")
DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(eevee_surfel_list_sort)
.local_group_size(SURFEL_LIST_GROUP_SIZE)
.additional_info("eevee_shared")
.additional_info("eevee_surfel_common")
.additional_info("draw_view")
.storage_buf(0, Qualifier::READ_WRITE, "int", "list_start_buf[]")
.storage_buf(6, Qualifier::READ, "SurfelListInfoData", "list_info_buf")
.compute_source("eevee_surfel_list_sort_comp.glsl")
.do_static_compilation(true);
LOCAL_GROUP_SIZE(SURFEL_LIST_GROUP_SIZE)
ADDITIONAL_INFO(eevee_shared)
ADDITIONAL_INFO(eevee_surfel_common)
ADDITIONAL_INFO(draw_view)
STORAGE_BUF(0, READ_WRITE, int, list_start_buf[])
STORAGE_BUF(6, READ, SurfelListInfoData, list_info_buf)
COMPUTE_SOURCE("eevee_surfel_list_sort_comp.glsl")
DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(eevee_surfel_ray)
.local_group_size(SURFEL_GROUP_SIZE)
.additional_info("eevee_shared")
.additional_info("eevee_surfel_common")
.additional_info("eevee_lightprobe_sphere_data")
.additional_info("draw_view")
.push_constant(Type::INT, "radiance_src")
.push_constant(Type::INT, "radiance_dst")
.compute_source("eevee_surfel_ray_comp.glsl")
.do_static_compilation(true);
LOCAL_GROUP_SIZE(SURFEL_GROUP_SIZE)
ADDITIONAL_INFO(eevee_shared)
ADDITIONAL_INFO(eevee_surfel_common)
ADDITIONAL_INFO(eevee_lightprobe_sphere_data)
ADDITIONAL_INFO(draw_view)
PUSH_CONSTANT(INT, radiance_src)
PUSH_CONSTANT(INT, radiance_dst)
COMPUTE_SOURCE("eevee_surfel_ray_comp.glsl")
DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(eevee_lightprobe_volume_bounds)
.do_static_compilation(true)
.local_group_size(IRRADIANCE_BOUNDS_GROUP_SIZE)
.storage_buf(0, Qualifier::READ_WRITE, "CaptureInfoData", "capture_info_buf")
.storage_buf(1, Qualifier::READ, "ObjectBounds", "bounds_buf[]")
.push_constant(Type::INT, "resource_len")
.typedef_source("draw_shader_shared.hh")
.additional_info("eevee_shared")
.compute_source("eevee_lightprobe_volume_bounds_comp.glsl");
DO_STATIC_COMPILATION()
LOCAL_GROUP_SIZE(IRRADIANCE_BOUNDS_GROUP_SIZE)
STORAGE_BUF(0, READ_WRITE, CaptureInfoData, capture_info_buf)
STORAGE_BUF(1, READ, ObjectBounds, bounds_buf[])
PUSH_CONSTANT(INT, resource_len)
TYPEDEF_SOURCE("draw_shader_shared.hh")
ADDITIONAL_INFO(eevee_shared)
COMPUTE_SOURCE("eevee_lightprobe_volume_bounds_comp.glsl")
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(eevee_lightprobe_volume_ray)
.local_group_size(IRRADIANCE_GRID_GROUP_SIZE,
LOCAL_GROUP_SIZE(IRRADIANCE_GRID_GROUP_SIZE,
IRRADIANCE_GRID_GROUP_SIZE,
IRRADIANCE_GRID_GROUP_SIZE)
.additional_info("eevee_shared")
.additional_info("eevee_surfel_common")
.additional_info("eevee_lightprobe_sphere_data")
.additional_info("draw_view")
.push_constant(Type::INT, "radiance_src")
.storage_buf(0, Qualifier::READ, "int", "list_start_buf[]")
.storage_buf(6, Qualifier::READ, "SurfelListInfoData", "list_info_buf")
.image(0, GPU_RGBA32F, Qualifier::READ_WRITE, ImageType::FLOAT_3D, "irradiance_L0_img")
.image(1, GPU_RGBA32F, Qualifier::READ_WRITE, ImageType::FLOAT_3D, "irradiance_L1_a_img")
.image(2, GPU_RGBA32F, Qualifier::READ_WRITE, ImageType::FLOAT_3D, "irradiance_L1_b_img")
.image(3, GPU_RGBA32F, Qualifier::READ_WRITE, ImageType::FLOAT_3D, "irradiance_L1_c_img")
.image(4, GPU_RGBA16F, Qualifier::READ, ImageType::FLOAT_3D, "virtual_offset_img")
.image(5, GPU_R32F, Qualifier::READ_WRITE, ImageType::FLOAT_3D, "validity_img")
.compute_source("eevee_lightprobe_volume_ray_comp.glsl")
.do_static_compilation(true);
ADDITIONAL_INFO(eevee_shared)
ADDITIONAL_INFO(eevee_surfel_common)
ADDITIONAL_INFO(eevee_lightprobe_sphere_data)
ADDITIONAL_INFO(draw_view)
PUSH_CONSTANT(INT, radiance_src)
STORAGE_BUF(0, READ, int, list_start_buf[])
STORAGE_BUF(6, READ, SurfelListInfoData, list_info_buf)
IMAGE(0, GPU_RGBA32F, READ_WRITE, FLOAT_3D, irradiance_L0_img)
IMAGE(1, GPU_RGBA32F, READ_WRITE, FLOAT_3D, irradiance_L1_a_img)
IMAGE(2, GPU_RGBA32F, READ_WRITE, FLOAT_3D, irradiance_L1_b_img)
IMAGE(3, GPU_RGBA32F, READ_WRITE, FLOAT_3D, irradiance_L1_c_img)
IMAGE(4, GPU_RGBA16F, READ, FLOAT_3D, virtual_offset_img)
IMAGE(5, GPU_R32F, READ_WRITE, FLOAT_3D, validity_img)
COMPUTE_SOURCE("eevee_lightprobe_volume_ray_comp.glsl")
DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(eevee_lightprobe_volume_offset)
.local_group_size(IRRADIANCE_GRID_GROUP_SIZE,
LOCAL_GROUP_SIZE(IRRADIANCE_GRID_GROUP_SIZE,
IRRADIANCE_GRID_GROUP_SIZE,
IRRADIANCE_GRID_GROUP_SIZE)
.additional_info("eevee_shared")
.additional_info("eevee_surfel_common")
.additional_info("draw_view")
.storage_buf(0, Qualifier::READ, "int", "list_start_buf[]")
.storage_buf(6, Qualifier::READ, "SurfelListInfoData", "list_info_buf")
.image(0, GPU_R32I, Qualifier::READ, ImageType::INT_3D_ATOMIC, "cluster_list_img")
.image(1, GPU_RGBA16F, Qualifier::READ_WRITE, ImageType::FLOAT_3D, "virtual_offset_img")
.compute_source("eevee_lightprobe_volume_offset_comp.glsl")
.do_static_compilation(true);
ADDITIONAL_INFO(eevee_shared)
ADDITIONAL_INFO(eevee_surfel_common)
ADDITIONAL_INFO(draw_view)
STORAGE_BUF(0, READ, int, list_start_buf[])
STORAGE_BUF(6, READ, SurfelListInfoData, list_info_buf)
IMAGE(0, GPU_R32I, READ, INT_3D_ATOMIC, cluster_list_img)
IMAGE(1, GPU_RGBA16F, READ_WRITE, FLOAT_3D, virtual_offset_img)
COMPUTE_SOURCE("eevee_lightprobe_volume_offset_comp.glsl")
DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()
/** \} */
@ -180,68 +196,71 @@ GPU_SHADER_CREATE_INFO(eevee_lightprobe_volume_offset)
* \{ */
GPU_SHADER_CREATE_INFO(eevee_lightprobe_volume_world)
.local_group_size(IRRADIANCE_GRID_BRICK_SIZE,
LOCAL_GROUP_SIZE(IRRADIANCE_GRID_BRICK_SIZE,
IRRADIANCE_GRID_BRICK_SIZE,
IRRADIANCE_GRID_BRICK_SIZE)
.define("IRRADIANCE_GRID_UPLOAD")
.additional_info("eevee_shared")
.additional_info("eevee_global_ubo")
.push_constant(Type::INT, "grid_index")
.storage_buf(0, Qualifier::READ, "uint", "bricks_infos_buf[]")
.storage_buf(1, Qualifier::READ, "SphereProbeHarmonic", "harmonic_buf")
.uniform_buf(0, "VolumeProbeData", "grids_infos_buf[IRRADIANCE_GRID_MAX]")
.image(0, VOLUME_PROBE_FORMAT, Qualifier::WRITE, ImageType::FLOAT_3D, "irradiance_atlas_img")
.compute_source("eevee_lightprobe_volume_world_comp.glsl")
.do_static_compilation(true);
DEFINE("IRRADIANCE_GRID_UPLOAD")
ADDITIONAL_INFO(eevee_shared)
ADDITIONAL_INFO(eevee_global_ubo)
PUSH_CONSTANT(INT, grid_index)
STORAGE_BUF(0, READ, uint, bricks_infos_buf[])
STORAGE_BUF(1, READ, SphereProbeHarmonic, harmonic_buf)
UNIFORM_BUF(0, VolumeProbeData, grids_infos_buf[IRRADIANCE_GRID_MAX])
IMAGE(0, VOLUME_PROBE_FORMAT, WRITE, FLOAT_3D, irradiance_atlas_img)
COMPUTE_SOURCE("eevee_lightprobe_volume_world_comp.glsl")
DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(eevee_lightprobe_volume_load)
.local_group_size(IRRADIANCE_GRID_BRICK_SIZE,
LOCAL_GROUP_SIZE(IRRADIANCE_GRID_BRICK_SIZE,
IRRADIANCE_GRID_BRICK_SIZE,
IRRADIANCE_GRID_BRICK_SIZE)
.define("IRRADIANCE_GRID_UPLOAD")
.additional_info("eevee_shared")
.additional_info("eevee_global_ubo")
.push_constant(Type::MAT4, "grid_local_to_world")
.push_constant(Type::INT, "grid_index")
.push_constant(Type::INT, "grid_start_index")
.push_constant(Type::FLOAT, "validity_threshold")
.push_constant(Type::FLOAT, "dilation_threshold")
.push_constant(Type::FLOAT, "dilation_radius")
.push_constant(Type::FLOAT, "grid_intensity_factor")
.uniform_buf(0, "VolumeProbeData", "grids_infos_buf[IRRADIANCE_GRID_MAX]")
.storage_buf(0, Qualifier::READ, "uint", "bricks_infos_buf[]")
.sampler(0, ImageType::FLOAT_3D, "irradiance_a_tx")
.sampler(1, ImageType::FLOAT_3D, "irradiance_b_tx")
.sampler(2, ImageType::FLOAT_3D, "irradiance_c_tx")
.sampler(3, ImageType::FLOAT_3D, "irradiance_d_tx")
.sampler(4, ImageType::FLOAT_3D, "visibility_a_tx")
.sampler(5, ImageType::FLOAT_3D, "visibility_b_tx")
.sampler(6, ImageType::FLOAT_3D, "visibility_c_tx")
.sampler(7, ImageType::FLOAT_3D, "visibility_d_tx")
.sampler(8, ImageType::FLOAT_3D, "irradiance_atlas_tx")
.sampler(9, ImageType::FLOAT_3D, "validity_tx")
.image(0, VOLUME_PROBE_FORMAT, Qualifier::WRITE, ImageType::FLOAT_3D, "irradiance_atlas_img")
.compute_source("eevee_lightprobe_volume_load_comp.glsl")
.do_static_compilation(true);
DEFINE("IRRADIANCE_GRID_UPLOAD")
ADDITIONAL_INFO(eevee_shared)
ADDITIONAL_INFO(eevee_global_ubo)
PUSH_CONSTANT(MAT4, grid_local_to_world)
PUSH_CONSTANT(INT, grid_index)
PUSH_CONSTANT(INT, grid_start_index)
PUSH_CONSTANT(FLOAT, validity_threshold)
PUSH_CONSTANT(FLOAT, dilation_threshold)
PUSH_CONSTANT(FLOAT, dilation_radius)
PUSH_CONSTANT(FLOAT, grid_intensity_factor)
UNIFORM_BUF(0, VolumeProbeData, grids_infos_buf[IRRADIANCE_GRID_MAX])
STORAGE_BUF(0, READ, uint, bricks_infos_buf[])
SAMPLER(0, FLOAT_3D, irradiance_a_tx)
SAMPLER(1, FLOAT_3D, irradiance_b_tx)
SAMPLER(2, FLOAT_3D, irradiance_c_tx)
SAMPLER(3, FLOAT_3D, irradiance_d_tx)
SAMPLER(4, FLOAT_3D, visibility_a_tx)
SAMPLER(5, FLOAT_3D, visibility_b_tx)
SAMPLER(6, FLOAT_3D, visibility_c_tx)
SAMPLER(7, FLOAT_3D, visibility_d_tx)
SAMPLER(8, FLOAT_3D, irradiance_atlas_tx)
SAMPLER(9, FLOAT_3D, validity_tx)
IMAGE(0, VOLUME_PROBE_FORMAT, WRITE, FLOAT_3D, irradiance_atlas_img)
COMPUTE_SOURCE("eevee_lightprobe_volume_load_comp.glsl")
DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(eevee_volume_probe_data)
.uniform_buf(IRRADIANCE_GRID_BUF_SLOT,
"VolumeProbeData",
"grids_infos_buf[IRRADIANCE_GRID_MAX]")
UNIFORM_BUF(IRRADIANCE_GRID_BUF_SLOT, VolumeProbeData, grids_infos_buf[IRRADIANCE_GRID_MAX])
/* NOTE: Use uint instead of IrradianceBrickPacked because Metal needs to know the exact type.
*/
.storage_buf(IRRADIANCE_BRICK_BUF_SLOT, Qualifier::READ, "uint", "bricks_infos_buf[]")
.sampler(VOLUME_PROBE_TEX_SLOT, ImageType::FLOAT_3D, "irradiance_atlas_tx")
.define("IRRADIANCE_GRID_SAMPLING");
STORAGE_BUF(IRRADIANCE_BRICK_BUF_SLOT, READ, uint, bricks_infos_buf[])
SAMPLER(VOLUME_PROBE_TEX_SLOT, FLOAT_3D, irradiance_atlas_tx)
DEFINE("IRRADIANCE_GRID_SAMPLING")
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(eevee_lightprobe_data)
.additional_info("eevee_lightprobe_sphere_data")
.additional_info("eevee_volume_probe_data");
ADDITIONAL_INFO(eevee_lightprobe_sphere_data)
ADDITIONAL_INFO(eevee_volume_probe_data)
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(eevee_lightprobe_planar_data)
.define("SPHERE_PROBE")
.uniform_buf(PLANAR_PROBE_BUF_SLOT, "PlanarProbeData", "probe_planar_buf[PLANAR_PROBE_MAX]")
.sampler(PLANAR_PROBE_RADIANCE_TEX_SLOT, ImageType::FLOAT_2D_ARRAY, "planar_radiance_tx")
.sampler(PLANAR_PROBE_DEPTH_TEX_SLOT, ImageType::DEPTH_2D_ARRAY, "planar_depth_tx");
DEFINE("SPHERE_PROBE")
UNIFORM_BUF(PLANAR_PROBE_BUF_SLOT, PlanarProbeData, probe_planar_buf[PLANAR_PROBE_MAX])
SAMPLER(PLANAR_PROBE_RADIANCE_TEX_SLOT, FLOAT_2D_ARRAY, planar_radiance_tx)
SAMPLER(PLANAR_PROBE_DEPTH_TEX_SLOT, DEPTH_2D_ARRAY, planar_depth_tx)
GPU_SHADER_CREATE_END()
/** \} */

View File

@ -6,18 +6,20 @@
#include "gpu_shader_create_info.hh"
GPU_SHADER_INTERFACE_INFO(eevee_lookdev_display_iface)
.smooth(Type::VEC2, "uv_coord")
.flat(Type::UINT, "sphere_id");
SMOOTH(VEC2, uv_coord)
FLAT(UINT, sphere_id)
GPU_SHADER_INTERFACE_END()
GPU_SHADER_CREATE_INFO(eevee_lookdev_display)
.vertex_source("eevee_lookdev_display_vert.glsl")
.vertex_out(eevee_lookdev_display_iface)
.push_constant(Type::VEC2, "viewportSize")
.push_constant(Type::VEC2, "invertedViewportSize")
.push_constant(Type::IVEC2, "anchor")
.sampler(0, ImageType::FLOAT_2D, "metallic_tx")
.sampler(1, ImageType::FLOAT_2D, "diffuse_tx")
.fragment_out(0, Type::VEC4, "out_color")
.fragment_source("eevee_lookdev_display_frag.glsl")
.depth_write(DepthWrite::ANY)
.do_static_compilation(true);
VERTEX_SOURCE("eevee_lookdev_display_vert.glsl")
VERTEX_OUT(eevee_lookdev_display_iface)
PUSH_CONSTANT(VEC2, viewportSize)
PUSH_CONSTANT(VEC2, invertedViewportSize)
PUSH_CONSTANT(IVEC2, anchor)
SAMPLER(0, FLOAT_2D, metallic_tx)
SAMPLER(1, FLOAT_2D, diffuse_tx)
FRAGMENT_OUT(0, VEC4, out_color)
FRAGMENT_SOURCE("eevee_lookdev_display_frag.glsl")
DEPTH_WRITE(DepthWrite::ANY)
DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()

View File

@ -5,10 +5,11 @@
#include "eevee_defines.hh"
GPU_SHADER_CREATE_INFO(eevee_lut)
.local_group_size(LUT_WORKGROUP_SIZE, LUT_WORKGROUP_SIZE, 1)
.push_constant(Type::INT, "table_type")
.push_constant(Type::IVEC3, "table_extent")
.image(0, GPU_RGBA32F, Qualifier::READ_WRITE, ImageType::FLOAT_3D, "table_img")
.additional_info("eevee_shared")
.compute_source("eevee_lut_comp.glsl")
.do_static_compilation(true);
LOCAL_GROUP_SIZE(LUT_WORKGROUP_SIZE, LUT_WORKGROUP_SIZE, 1)
PUSH_CONSTANT(INT, table_type)
PUSH_CONSTANT(IVEC3, table_extent)
IMAGE(0, GPU_RGBA32F, READ_WRITE, FLOAT_3D, table_img)
ADDITIONAL_INFO(eevee_shared)
COMPUTE_SOURCE("eevee_lut_comp.glsl")
DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()

View File

@ -11,28 +11,34 @@
/* TODO(@fclem): This is a bit out of place at the moment. */
GPU_SHADER_CREATE_INFO(eevee_shared)
.typedef_source("eevee_defines.hh")
.typedef_source("eevee_shader_shared.hh");
TYPEDEF_SOURCE("eevee_defines.hh")
TYPEDEF_SOURCE("eevee_shader_shared.hh")
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(eevee_global_ubo)
.uniform_buf(UNIFORM_BUF_SLOT, "UniformData", "uniform_buf");
UNIFORM_BUF(UNIFORM_BUF_SLOT, UniformData, uniform_buf)
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(eevee_sampling_data)
.define("EEVEE_SAMPLING_DATA")
.additional_info("eevee_shared")
.storage_buf(SAMPLING_BUF_SLOT, Qualifier::READ, "SamplingData", "sampling_buf");
DEFINE("EEVEE_SAMPLING_DATA")
ADDITIONAL_INFO(eevee_shared)
STORAGE_BUF(SAMPLING_BUF_SLOT, READ, SamplingData, sampling_buf)
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(eevee_utility_texture)
.define("EEVEE_UTILITY_TX")
.sampler(RBUFS_UTILITY_TEX_SLOT, ImageType::FLOAT_2D_ARRAY, "utility_tx");
DEFINE("EEVEE_UTILITY_TX")
SAMPLER(RBUFS_UTILITY_TEX_SLOT, FLOAT_2D_ARRAY, utility_tx)
GPU_SHADER_CREATE_END()
GPU_SHADER_NAMED_INTERFACE_INFO(eevee_clip_plane_iface, clip_interp)
.smooth(Type::FLOAT, "clip_distance");
SMOOTH(FLOAT, clip_distance)
GPU_SHADER_NAMED_INTERFACE_END(clip_interp)
GPU_SHADER_CREATE_INFO(eevee_clip_plane)
.vertex_out(eevee_clip_plane_iface)
.uniform_buf(CLIP_PLANE_BUF, "ClipPlaneData", "clip_plane")
.define("MAT_CLIP_PLANE");
VERTEX_OUT(eevee_clip_plane_iface)
UNIFORM_BUF(CLIP_PLANE_BUF, ClipPlaneData, clip_plane)
DEFINE("MAT_CLIP_PLANE")
GPU_SHADER_CREATE_END()
/** \} */
@ -43,98 +49,109 @@ GPU_SHADER_CREATE_INFO(eevee_clip_plane)
/* Common interface */
GPU_SHADER_NAMED_INTERFACE_INFO(eevee_surf_iface, interp)
/* World Position. */
.smooth(Type::VEC3, "P")
SMOOTH(VEC3, P)
/* World Normal. */
.smooth(Type::VEC3, "N");
SMOOTH(VEC3, N)
GPU_SHADER_NAMED_INTERFACE_END(interp)
GPU_SHADER_CREATE_INFO(eevee_geom_mesh)
.additional_info("eevee_shared")
.define("MAT_GEOM_MESH")
.vertex_in(0, Type::VEC3, "pos")
.vertex_in(1, Type::VEC3, "nor")
.vertex_source("eevee_geom_mesh_vert.glsl")
.vertex_out(eevee_surf_iface)
.additional_info("draw_modelmat_new")
.additional_info("draw_object_infos_new")
.additional_info("draw_resource_id_varying")
.additional_info("draw_view");
ADDITIONAL_INFO(eevee_shared)
DEFINE("MAT_GEOM_MESH")
VERTEX_IN(0, VEC3, pos)
VERTEX_IN(1, VEC3, nor)
VERTEX_SOURCE("eevee_geom_mesh_vert.glsl")
VERTEX_OUT(eevee_surf_iface)
ADDITIONAL_INFO(draw_modelmat_new)
ADDITIONAL_INFO(draw_object_infos_new)
ADDITIONAL_INFO(draw_resource_id_varying)
ADDITIONAL_INFO(draw_view)
GPU_SHADER_CREATE_END()
GPU_SHADER_NAMED_INTERFACE_INFO(eevee_surf_point_cloud_iface, point_cloud_interp)
.smooth(Type::FLOAT, "radius")
.smooth(Type::VEC3, "position");
SMOOTH(FLOAT, radius)
SMOOTH(VEC3, position)
GPU_SHADER_NAMED_INTERFACE_END(point_cloud_interp)
GPU_SHADER_NAMED_INTERFACE_INFO(eevee_surf_point_cloud_flat_iface, point_cloud_interp_flat)
.flat(Type::INT, "id");
FLAT(INT, id)
GPU_SHADER_NAMED_INTERFACE_END(point_cloud_interp_flat)
GPU_SHADER_CREATE_INFO(eevee_geom_point_cloud)
.additional_info("eevee_shared")
.define("MAT_GEOM_POINT_CLOUD")
.vertex_source("eevee_geom_point_cloud_vert.glsl")
.vertex_out(eevee_surf_iface)
.vertex_out(eevee_surf_point_cloud_iface)
.vertex_out(eevee_surf_point_cloud_flat_iface)
.additional_info("draw_pointcloud_new")
.additional_info("draw_modelmat_new")
.additional_info("draw_object_infos_new")
.additional_info("draw_resource_id_varying")
.additional_info("draw_view");
ADDITIONAL_INFO(eevee_shared)
DEFINE("MAT_GEOM_POINT_CLOUD")
VERTEX_SOURCE("eevee_geom_point_cloud_vert.glsl")
VERTEX_OUT(eevee_surf_iface)
VERTEX_OUT(eevee_surf_point_cloud_iface)
VERTEX_OUT(eevee_surf_point_cloud_flat_iface)
ADDITIONAL_INFO(draw_pointcloud_new)
ADDITIONAL_INFO(draw_modelmat_new)
ADDITIONAL_INFO(draw_object_infos_new)
ADDITIONAL_INFO(draw_resource_id_varying)
ADDITIONAL_INFO(draw_view)
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(eevee_geom_volume)
.additional_info("eevee_shared")
.define("MAT_GEOM_VOLUME")
.vertex_in(0, Type::VEC3, "pos")
.vertex_out(eevee_surf_iface)
.vertex_source("eevee_geom_volume_vert.glsl")
.additional_info("draw_modelmat_new")
.additional_info("draw_object_infos_new")
.additional_info("draw_resource_id_varying")
.additional_info("draw_volume_infos")
.additional_info("draw_view");
ADDITIONAL_INFO(eevee_shared)
DEFINE("MAT_GEOM_VOLUME")
VERTEX_IN(0, VEC3, pos)
VERTEX_OUT(eevee_surf_iface)
VERTEX_SOURCE("eevee_geom_volume_vert.glsl")
ADDITIONAL_INFO(draw_modelmat_new)
ADDITIONAL_INFO(draw_object_infos_new)
ADDITIONAL_INFO(draw_resource_id_varying)
ADDITIONAL_INFO(draw_volume_infos)
ADDITIONAL_INFO(draw_view)
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(eevee_geom_gpencil)
.additional_info("eevee_shared")
.define("MAT_GEOM_GPENCIL")
.vertex_source("eevee_geom_gpencil_vert.glsl")
.vertex_out(eevee_surf_iface)
.additional_info("draw_gpencil_new")
.additional_info("draw_modelmat_new")
.additional_info("draw_object_infos_new")
.additional_info("draw_resource_id_varying")
.additional_info("draw_resource_id_new");
ADDITIONAL_INFO(eevee_shared)
DEFINE("MAT_GEOM_GPENCIL")
VERTEX_SOURCE("eevee_geom_gpencil_vert.glsl")
VERTEX_OUT(eevee_surf_iface)
ADDITIONAL_INFO(draw_gpencil_new)
ADDITIONAL_INFO(draw_modelmat_new)
ADDITIONAL_INFO(draw_object_infos_new)
ADDITIONAL_INFO(draw_resource_id_varying)
ADDITIONAL_INFO(draw_resource_id_new)
GPU_SHADER_CREATE_END()
GPU_SHADER_NAMED_INTERFACE_INFO(eevee_surf_curve_iface, curve_interp)
.smooth(Type::VEC2, "barycentric_coords")
.smooth(Type::VEC3, "tangent")
.smooth(Type::VEC3, "binormal")
.smooth(Type::FLOAT, "time")
.smooth(Type::FLOAT, "time_width")
.smooth(Type::FLOAT, "thickness");
SMOOTH(VEC2, barycentric_coords)
SMOOTH(VEC3, tangent)
SMOOTH(VEC3, binormal)
SMOOTH(FLOAT, time)
SMOOTH(FLOAT, time_width)
SMOOTH(FLOAT, thickness)
GPU_SHADER_NAMED_INTERFACE_END(curve_interp)
GPU_SHADER_NAMED_INTERFACE_INFO(eevee_surf_curve_flat_iface, curve_interp_flat)
.flat(Type::INT, "strand_id");
FLAT(INT, strand_id)
GPU_SHADER_NAMED_INTERFACE_END(curve_interp_flat)
GPU_SHADER_CREATE_INFO(eevee_geom_curves)
.additional_info("eevee_shared")
.define("MAT_GEOM_CURVES")
.vertex_source("eevee_geom_curves_vert.glsl")
.vertex_out(eevee_surf_iface)
.vertex_out(eevee_surf_curve_iface)
.vertex_out(eevee_surf_curve_flat_iface)
.additional_info("draw_modelmat_new")
.additional_info("draw_object_infos_new")
.additional_info("draw_resource_id_varying")
.additional_info("draw_view")
.additional_info("draw_hair_new")
.additional_info("draw_curves_infos");
ADDITIONAL_INFO(eevee_shared)
DEFINE("MAT_GEOM_CURVES")
VERTEX_SOURCE("eevee_geom_curves_vert.glsl")
VERTEX_OUT(eevee_surf_iface)
VERTEX_OUT(eevee_surf_curve_iface)
VERTEX_OUT(eevee_surf_curve_flat_iface)
ADDITIONAL_INFO(draw_modelmat_new)
ADDITIONAL_INFO(draw_object_infos_new)
ADDITIONAL_INFO(draw_resource_id_varying)
ADDITIONAL_INFO(draw_view)
ADDITIONAL_INFO(draw_hair_new)
ADDITIONAL_INFO(draw_curves_infos)
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(eevee_geom_world)
.additional_info("eevee_shared")
.define("MAT_GEOM_WORLD")
.builtins(BuiltinBits::VERTEX_ID)
.vertex_source("eevee_geom_world_vert.glsl")
.vertex_out(eevee_surf_iface)
.additional_info("draw_modelmat_new")
.additional_info("draw_object_infos_new") /* Unused, but allow debug compilation. */
.additional_info("draw_resource_id_varying")
.additional_info("draw_view");
ADDITIONAL_INFO(eevee_shared)
DEFINE("MAT_GEOM_WORLD")
BUILTINS(BuiltinBits::VERTEX_ID)
VERTEX_SOURCE("eevee_geom_world_vert.glsl")
VERTEX_OUT(eevee_surf_iface)
ADDITIONAL_INFO(draw_modelmat_new)
ADDITIONAL_INFO(draw_object_infos_new) /* Unused, but allow debug compilation. */
ADDITIONAL_INFO(draw_resource_id_varying)
ADDITIONAL_INFO(draw_view)
GPU_SHADER_CREATE_END()
/** \} */
@ -148,156 +165,161 @@ GPU_SHADER_CREATE_INFO(eevee_geom_world)
image(slot, format, qualifier, ImageType::FLOAT_2D_ARRAY, name, Frequency::PASS)
GPU_SHADER_CREATE_INFO(eevee_render_pass_out)
.define("MAT_RENDER_PASS_SUPPORT")
.additional_info("eevee_global_ubo")
.image_array_out(RBUFS_COLOR_SLOT, Qualifier::WRITE, GPU_RGBA16F, "rp_color_img")
.image_array_out(RBUFS_VALUE_SLOT, Qualifier::WRITE, GPU_R16F, "rp_value_img");
DEFINE("MAT_RENDER_PASS_SUPPORT")
ADDITIONAL_INFO(eevee_global_ubo)
IMAGE_FREQ(RBUFS_COLOR_SLOT, GPU_RGBA16F, WRITE, FLOAT_2D, rp_color_img, PASS)
IMAGE_FREQ(RBUFS_VALUE_SLOT, GPU_R16F, WRITE, FLOAT_2D, rp_value_img, PASS)
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(eevee_cryptomatte_out)
.storage_buf(CRYPTOMATTE_BUF_SLOT, Qualifier::READ, "vec2", "cryptomatte_object_buf[]")
.image_out(RBUFS_CRYPTOMATTE_SLOT, Qualifier::WRITE, GPU_RGBA32F, "rp_cryptomatte_img");
STORAGE_BUF(CRYPTOMATTE_BUF_SLOT, READ, vec2, cryptomatte_object_buf[])
IMAGE_FREQ(RBUFS_CRYPTOMATTE_SLOT, GPU_RGBA32F, WRITE, FLOAT_2D, rp_cryptomatte_img, PASS)
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(eevee_surf_deferred_base)
.define("MAT_DEFERRED")
.define("GBUFFER_WRITE")
DEFINE("MAT_DEFERRED")
DEFINE("GBUFFER_WRITE")
/* NOTE: This removes the possibility of using gl_FragDepth. */
.early_fragment_test(true)
EARLY_FRAGMENT_TEST(true)
/* Direct output. (Emissive, Holdout) */
.fragment_out(0, Type::VEC4, "out_radiance")
.fragment_out(1, Type::UINT, "out_gbuf_header", DualBlend::NONE, DEFERRED_GBUFFER_ROG_ID)
.fragment_out(2, Type::VEC2, "out_gbuf_normal")
.fragment_out(3, Type::VEC4, "out_gbuf_closure1")
.fragment_out(4, Type::VEC4, "out_gbuf_closure2")
FRAGMENT_OUT(0, VEC4, out_radiance)
FRAGMENT_OUT_ROG(1, UINT, out_gbuf_header, DEFERRED_GBUFFER_ROG_ID)
FRAGMENT_OUT(2, VEC2, out_gbuf_normal)
FRAGMENT_OUT(3, VEC4, out_gbuf_closure1)
FRAGMENT_OUT(4, VEC4, out_gbuf_closure2)
/* Everything is stored inside a two layered target, one for each format. This is to fit the
* limitation of the number of images we can bind on a single shader. */
.image_array_out(GBUF_CLOSURE_SLOT, Qualifier::WRITE, GPU_RGB10_A2, "out_gbuf_closure_img")
.image_array_out(GBUF_NORMAL_SLOT, Qualifier::WRITE, GPU_RG16, "out_gbuf_normal_img")
IMAGE_FREQ(GBUF_CLOSURE_SLOT, GPU_RGB10_A2, WRITE, FLOAT_2D, out_gbuf_closure_img, PASS)
IMAGE_FREQ(GBUF_NORMAL_SLOT, GPU_RG16, WRITE, FLOAT_2D, out_gbuf_normal_img, PASS)
/* Added at runtime because of test shaders not having `node_tree`. */
// .additional_info("eevee_render_pass_out")
// .additional_info("eevee_cryptomatte_out")
.additional_info("eevee_global_ubo")
.additional_info("eevee_utility_texture")
.additional_info("eevee_sampling_data")
.additional_info("eevee_hiz_data");
// ADDITIONAL_INFO(eevee_render_pass_out)
// ADDITIONAL_INFO(eevee_cryptomatte_out)
ADDITIONAL_INFO(eevee_global_ubo)
ADDITIONAL_INFO(eevee_utility_texture)
ADDITIONAL_INFO(eevee_sampling_data)
ADDITIONAL_INFO(eevee_hiz_data)
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(eevee_surf_deferred)
.fragment_source("eevee_surf_deferred_frag.glsl")
.additional_info("eevee_surf_deferred_base");
FRAGMENT_SOURCE("eevee_surf_deferred_frag.glsl")
ADDITIONAL_INFO(eevee_surf_deferred_base)
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(eevee_surf_deferred_hybrid)
.fragment_source("eevee_surf_hybrid_frag.glsl")
.additional_info("eevee_surf_deferred_base")
.additional_info("eevee_light_data")
.additional_info("eevee_lightprobe_data")
.additional_info("eevee_shadow_data");
FRAGMENT_SOURCE("eevee_surf_hybrid_frag.glsl")
ADDITIONAL_INFO(eevee_surf_deferred_base)
ADDITIONAL_INFO(eevee_light_data)
ADDITIONAL_INFO(eevee_lightprobe_data)
ADDITIONAL_INFO(eevee_shadow_data)
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(eevee_surf_forward)
.define("MAT_FORWARD")
DEFINE("MAT_FORWARD")
/* Early fragment test is needed for render passes support for forward surfaces. */
/* NOTE: This removes the possibility of using gl_FragDepth. */
.early_fragment_test(true)
.fragment_out(0, Type::VEC4, "out_radiance", DualBlend::SRC_0)
.fragment_out(0, Type::VEC4, "out_transmittance", DualBlend::SRC_1)
.fragment_source("eevee_surf_forward_frag.glsl")
EARLY_FRAGMENT_TEST(true)
FRAGMENT_OUT_DUAL(0, VEC4, out_radiance, SRC_0)
FRAGMENT_OUT_DUAL(0, VEC4, out_transmittance, SRC_1)
FRAGMENT_SOURCE("eevee_surf_forward_frag.glsl")
/* Optionally added depending on the material. */
// .additional_info("eevee_render_pass_out")
// .additional_info("eevee_cryptomatte_out")
.additional_info("eevee_global_ubo")
.additional_info("eevee_light_data")
.additional_info("eevee_lightprobe_data")
.additional_info("eevee_utility_texture")
.additional_info("eevee_sampling_data")
.additional_info("eevee_shadow_data")
.additional_info("eevee_hiz_data")
.additional_info("eevee_volume_lib");
// ADDITIONAL_INFO(eevee_render_pass_out)
// ADDITIONAL_INFO(eevee_cryptomatte_out)
ADDITIONAL_INFO(eevee_global_ubo)
ADDITIONAL_INFO(eevee_light_data)
ADDITIONAL_INFO(eevee_lightprobe_data)
ADDITIONAL_INFO(eevee_utility_texture)
ADDITIONAL_INFO(eevee_sampling_data)
ADDITIONAL_INFO(eevee_shadow_data)
ADDITIONAL_INFO(eevee_hiz_data)
ADDITIONAL_INFO(eevee_volume_lib)
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(eevee_surf_capture)
.define("MAT_CAPTURE")
.storage_buf(SURFEL_BUF_SLOT, Qualifier::WRITE, "Surfel", "surfel_buf[]")
.storage_buf(CAPTURE_BUF_SLOT, Qualifier::READ_WRITE, "CaptureInfoData", "capture_info_buf")
.push_constant(Type::BOOL, "is_double_sided")
.fragment_source("eevee_surf_capture_frag.glsl")
.additional_info("eevee_global_ubo")
.additional_info("eevee_utility_texture");
DEFINE("MAT_CAPTURE")
STORAGE_BUF(SURFEL_BUF_SLOT, WRITE, Surfel, surfel_buf[])
STORAGE_BUF(CAPTURE_BUF_SLOT, READ_WRITE, CaptureInfoData, capture_info_buf)
PUSH_CONSTANT(BOOL, is_double_sided)
FRAGMENT_SOURCE("eevee_surf_capture_frag.glsl")
ADDITIONAL_INFO(eevee_global_ubo)
ADDITIONAL_INFO(eevee_utility_texture)
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(eevee_surf_depth)
.define("MAT_DEPTH")
.fragment_source("eevee_surf_depth_frag.glsl")
.additional_info("eevee_global_ubo")
.additional_info("eevee_sampling_data")
.additional_info("eevee_utility_texture");
DEFINE("MAT_DEPTH")
FRAGMENT_SOURCE("eevee_surf_depth_frag.glsl")
ADDITIONAL_INFO(eevee_global_ubo)
ADDITIONAL_INFO(eevee_sampling_data)
ADDITIONAL_INFO(eevee_utility_texture)
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(eevee_surf_world)
.push_constant(Type::FLOAT, "world_opacity_fade")
.push_constant(Type::FLOAT, "world_background_blur")
.push_constant(Type::IVEC4, "world_coord_packed")
.early_fragment_test(true)
.fragment_out(0, Type::VEC4, "out_background")
.fragment_source("eevee_surf_world_frag.glsl")
.additional_info("eevee_global_ubo")
.additional_info("eevee_lightprobe_sphere_data")
.additional_info("eevee_volume_probe_data")
.additional_info("eevee_sampling_data")
PUSH_CONSTANT(FLOAT, world_opacity_fade)
PUSH_CONSTANT(FLOAT, world_background_blur)
PUSH_CONSTANT(IVEC4, world_coord_packed)
EARLY_FRAGMENT_TEST(true)
FRAGMENT_OUT(0, VEC4, out_background)
FRAGMENT_SOURCE("eevee_surf_world_frag.glsl")
ADDITIONAL_INFO(eevee_global_ubo)
ADDITIONAL_INFO(eevee_lightprobe_sphere_data)
ADDITIONAL_INFO(eevee_volume_probe_data)
ADDITIONAL_INFO(eevee_sampling_data)
/* Optionally added depending on the material. */
// .additional_info("eevee_render_pass_out")
// .additional_info("eevee_cryptomatte_out")
.additional_info("eevee_utility_texture");
// ADDITIONAL_INFO(eevee_render_pass_out)
// ADDITIONAL_INFO(eevee_cryptomatte_out)
ADDITIONAL_INFO(eevee_utility_texture)
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(eevee_renderpass_clear)
.fragment_out(0, Type::VEC4, "out_background")
.fragment_source("eevee_renderpass_clear_frag.glsl")
.additional_info("draw_fullscreen")
.additional_info("eevee_global_ubo")
.additional_info("eevee_render_pass_out")
.additional_info("eevee_cryptomatte_out")
.additional_info("eevee_shared")
.do_static_compilation(true);
FRAGMENT_OUT(0, VEC4, out_background)
FRAGMENT_SOURCE("eevee_renderpass_clear_frag.glsl")
ADDITIONAL_INFO(draw_fullscreen)
ADDITIONAL_INFO(eevee_global_ubo)
ADDITIONAL_INFO(eevee_render_pass_out)
ADDITIONAL_INFO(eevee_cryptomatte_out)
ADDITIONAL_INFO(eevee_shared)
DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()
GPU_SHADER_NAMED_INTERFACE_INFO(eevee_surf_shadow_atomic_iface, shadow_iface)
.flat(Type::INT, "shadow_view_id");
FLAT(INT, shadow_view_id)
GPU_SHADER_NAMED_INTERFACE_END(shadow_iface)
GPU_SHADER_NAMED_INTERFACE_INFO(eevee_surf_shadow_clipping_iface, shadow_clip)
.smooth(Type::VEC3, "position")
.smooth(Type::VEC3, "vector");
SMOOTH(VEC3, position)
SMOOTH(VEC3, vector)
GPU_SHADER_NAMED_INTERFACE_END(shadow_clip)
GPU_SHADER_CREATE_INFO(eevee_surf_shadow)
.define("DRW_VIEW_LEN", STRINGIFY(SHADOW_VIEW_MAX))
.define("MAT_SHADOW")
.builtins(BuiltinBits::VIEWPORT_INDEX)
.vertex_out(eevee_surf_shadow_clipping_iface)
.storage_buf(SHADOW_RENDER_VIEW_BUF_SLOT,
Qualifier::READ,
"ShadowRenderView",
"render_view_buf[SHADOW_VIEW_MAX]")
.fragment_source("eevee_surf_shadow_frag.glsl")
.additional_info("eevee_global_ubo")
.additional_info("eevee_utility_texture")
.additional_info("eevee_sampling_data");
DEFINE_VALUE("DRW_VIEW_LEN", STRINGIFY(SHADOW_VIEW_MAX))
DEFINE("MAT_SHADOW")
BUILTINS(BuiltinBits::VIEWPORT_INDEX)
VERTEX_OUT(eevee_surf_shadow_clipping_iface)
STORAGE_BUF(SHADOW_RENDER_VIEW_BUF_SLOT, READ, ShadowRenderView, render_view_buf[SHADOW_VIEW_MAX])
FRAGMENT_SOURCE("eevee_surf_shadow_frag.glsl")
ADDITIONAL_INFO(eevee_global_ubo)
ADDITIONAL_INFO(eevee_utility_texture)
ADDITIONAL_INFO(eevee_sampling_data)
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(eevee_surf_shadow_atomic)
.additional_info("eevee_surf_shadow")
.define("SHADOW_UPDATE_ATOMIC_RASTER")
.builtins(BuiltinBits::TEXTURE_ATOMIC)
.vertex_out(eevee_surf_shadow_atomic_iface)
.storage_buf(SHADOW_RENDER_MAP_BUF_SLOT,
Qualifier::READ,
"uint",
"render_map_buf[SHADOW_RENDER_MAP_SIZE]")
.image(SHADOW_ATLAS_IMG_SLOT,
GPU_R32UI,
Qualifier::READ_WRITE,
ImageType::UINT_2D_ARRAY_ATOMIC,
"shadow_atlas_img");
ADDITIONAL_INFO(eevee_surf_shadow)
DEFINE("SHADOW_UPDATE_ATOMIC_RASTER")
BUILTINS(BuiltinBits::TEXTURE_ATOMIC)
VERTEX_OUT(eevee_surf_shadow_atomic_iface)
STORAGE_BUF(SHADOW_RENDER_MAP_BUF_SLOT, READ, uint, render_map_buf[SHADOW_RENDER_MAP_SIZE])
IMAGE(SHADOW_ATLAS_IMG_SLOT, GPU_R32UI, READ_WRITE, UINT_2D_ARRAY_ATOMIC, shadow_atlas_img)
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(eevee_surf_shadow_tbdr)
.additional_info("eevee_surf_shadow")
.define("SHADOW_UPDATE_TBDR")
.builtins(BuiltinBits::LAYER)
ADDITIONAL_INFO(eevee_surf_shadow)
DEFINE("SHADOW_UPDATE_TBDR")
BUILTINS(BuiltinBits::LAYER)
/* Use greater depth write to avoid loosing the early Z depth test but ensure correct fragment
* ordering after slope bias. */
.depth_write(DepthWrite::GREATER)
DEPTH_WRITE(DepthWrite::GREATER)
/* F32 color attachment for on-tile depth accumulation without atomics. */
.fragment_out(0, Type::FLOAT, "out_depth", DualBlend::NONE, SHADOW_ROG_ID);
FRAGMENT_OUT_ROG(0, FLOAT, out_depth, SHADOW_ROG_ID)
GPU_SHADER_CREATE_END()
#undef image_out
#undef image_array_out
@ -309,67 +331,39 @@ GPU_SHADER_CREATE_INFO(eevee_surf_shadow_tbdr)
* \{ */
GPU_SHADER_CREATE_INFO(eevee_surf_volume)
.define("MAT_VOLUME")
DEFINE("MAT_VOLUME")
/* Only the front fragments have to be invoked. */
.early_fragment_test(true)
.image(VOLUME_PROP_SCATTERING_IMG_SLOT,
GPU_R11F_G11F_B10F,
Qualifier::READ_WRITE,
ImageType::FLOAT_3D,
"out_scattering_img")
.image(VOLUME_PROP_EXTINCTION_IMG_SLOT,
GPU_R11F_G11F_B10F,
Qualifier::READ_WRITE,
ImageType::FLOAT_3D,
"out_extinction_img")
.image(VOLUME_PROP_EMISSION_IMG_SLOT,
GPU_R11F_G11F_B10F,
Qualifier::READ_WRITE,
ImageType::FLOAT_3D,
"out_emissive_img")
.image(VOLUME_PROP_PHASE_IMG_SLOT,
GPU_R16F,
Qualifier::READ_WRITE,
ImageType::FLOAT_3D,
"out_phase_img")
.image(VOLUME_PROP_PHASE_WEIGHT_IMG_SLOT,
GPU_R16F,
Qualifier::READ_WRITE,
ImageType::FLOAT_3D,
"out_phase_weight_img")
.image(VOLUME_OCCUPANCY_SLOT,
GPU_R32UI,
Qualifier::READ,
ImageType::UINT_3D_ATOMIC,
"occupancy_img")
.fragment_source("eevee_surf_volume_frag.glsl")
.additional_info("draw_modelmat_new_common")
.additional_info("draw_view")
.additional_info("eevee_shared")
.additional_info("eevee_global_ubo")
.additional_info("eevee_sampling_data")
.additional_info("eevee_utility_texture");
EARLY_FRAGMENT_TEST(true)
IMAGE(
VOLUME_PROP_SCATTERING_IMG_SLOT, GPU_R11F_G11F_B10F, READ_WRITE, FLOAT_3D, out_scattering_img)
IMAGE(
VOLUME_PROP_EXTINCTION_IMG_SLOT, GPU_R11F_G11F_B10F, READ_WRITE, FLOAT_3D, out_extinction_img)
IMAGE(VOLUME_PROP_EMISSION_IMG_SLOT, GPU_R11F_G11F_B10F, READ_WRITE, FLOAT_3D, out_emissive_img)
IMAGE(VOLUME_PROP_PHASE_IMG_SLOT, GPU_R16F, READ_WRITE, FLOAT_3D, out_phase_img)
IMAGE(VOLUME_PROP_PHASE_WEIGHT_IMG_SLOT, GPU_R16F, READ_WRITE, FLOAT_3D, out_phase_weight_img)
IMAGE(VOLUME_OCCUPANCY_SLOT, GPU_R32UI, READ, UINT_3D_ATOMIC, occupancy_img)
FRAGMENT_SOURCE("eevee_surf_volume_frag.glsl")
ADDITIONAL_INFO(draw_modelmat_new_common)
ADDITIONAL_INFO(draw_view)
ADDITIONAL_INFO(eevee_shared)
ADDITIONAL_INFO(eevee_global_ubo)
ADDITIONAL_INFO(eevee_sampling_data)
ADDITIONAL_INFO(eevee_utility_texture)
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(eevee_surf_occupancy)
.define("MAT_OCCUPANCY")
DEFINE("MAT_OCCUPANCY")
/* All fragments need to be invoked even if we write to the depth buffer. */
.early_fragment_test(false)
.builtins(BuiltinBits::TEXTURE_ATOMIC)
.push_constant(Type::BOOL, "use_fast_method")
.image(VOLUME_HIT_DEPTH_SLOT, GPU_R32F, Qualifier::WRITE, ImageType::FLOAT_3D, "hit_depth_img")
.image(VOLUME_HIT_COUNT_SLOT,
GPU_R32UI,
Qualifier::READ_WRITE,
ImageType::UINT_2D_ATOMIC,
"hit_count_img")
.image(VOLUME_OCCUPANCY_SLOT,
GPU_R32UI,
Qualifier::READ_WRITE,
ImageType::UINT_3D_ATOMIC,
"occupancy_img")
.fragment_source("eevee_surf_occupancy_frag.glsl")
.additional_info("eevee_global_ubo")
.additional_info("eevee_sampling_data");
EARLY_FRAGMENT_TEST(false)
BUILTINS(BuiltinBits::TEXTURE_ATOMIC)
PUSH_CONSTANT(BOOL, use_fast_method)
IMAGE(VOLUME_HIT_DEPTH_SLOT, GPU_R32F, WRITE, FLOAT_3D, hit_depth_img)
IMAGE(VOLUME_HIT_COUNT_SLOT, GPU_R32UI, READ_WRITE, UINT_2D_ATOMIC, hit_count_img)
IMAGE(VOLUME_OCCUPANCY_SLOT, GPU_R32UI, READ_WRITE, UINT_3D_ATOMIC, occupancy_img)
FRAGMENT_SOURCE("eevee_surf_occupancy_frag.glsl")
ADDITIONAL_INFO(eevee_global_ubo)
ADDITIONAL_INFO(eevee_sampling_data)
GPU_SHADER_CREATE_END()
/** \} */
@ -383,9 +377,10 @@ GPU_SHADER_CREATE_INFO(eevee_surf_occupancy)
/* Stub functions defined by the material evaluation. */
GPU_SHADER_CREATE_INFO(eevee_material_stub)
.define("EEVEE_MATERIAL_STUBS")
DEFINE("EEVEE_MATERIAL_STUBS")
/* Dummy uniform buffer to detect overlap with material node-tree. */
.uniform_buf(0, "int", "node_tree");
UNIFORM_BUF(0, int, node_tree)
GPU_SHADER_CREATE_END()
# define EEVEE_MAT_GEOM_VARIATIONS(prefix, ...) \
CREATE_INFO_VARIANT(prefix##_world, eevee_geom_world, __VA_ARGS__) \

View File

@ -6,47 +6,52 @@
#include "gpu_shader_create_info.hh"
GPU_SHADER_CREATE_INFO(eevee_motion_blur_tiles_flatten)
.local_group_size(MOTION_BLUR_GROUP_SIZE, MOTION_BLUR_GROUP_SIZE)
.additional_info("eevee_shared")
.additional_info("draw_view")
.additional_info("eevee_velocity_camera")
.uniform_buf(6, "MotionBlurData", "motion_blur_buf")
.sampler(0, ImageType::DEPTH_2D, "depth_tx")
.image(1, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_tiles_img")
.compute_source("eevee_motion_blur_flatten_comp.glsl");
LOCAL_GROUP_SIZE(MOTION_BLUR_GROUP_SIZE, MOTION_BLUR_GROUP_SIZE)
ADDITIONAL_INFO(eevee_shared)
ADDITIONAL_INFO(draw_view)
ADDITIONAL_INFO(eevee_velocity_camera)
UNIFORM_BUF(6, MotionBlurData, motion_blur_buf)
SAMPLER(0, DEPTH_2D, depth_tx)
IMAGE(1, GPU_RGBA16F, WRITE, FLOAT_2D, out_tiles_img)
COMPUTE_SOURCE("eevee_motion_blur_flatten_comp.glsl")
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(eevee_motion_blur_tiles_flatten_rg)
.do_static_compilation(true)
.define("FLATTEN_RG")
.image(0, GPU_RG16F, Qualifier::READ_WRITE, ImageType::FLOAT_2D, "velocity_img")
.additional_info("eevee_motion_blur_tiles_flatten");
DO_STATIC_COMPILATION()
DEFINE("FLATTEN_RG")
IMAGE(0, GPU_RG16F, READ_WRITE, FLOAT_2D, velocity_img)
ADDITIONAL_INFO(eevee_motion_blur_tiles_flatten)
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(eevee_motion_blur_tiles_flatten_rgba)
.do_static_compilation(true)
.image(0, GPU_RGBA16F, Qualifier::READ_WRITE, ImageType::FLOAT_2D, "velocity_img")
.additional_info("eevee_motion_blur_tiles_flatten");
DO_STATIC_COMPILATION()
IMAGE(0, GPU_RGBA16F, READ_WRITE, FLOAT_2D, velocity_img)
ADDITIONAL_INFO(eevee_motion_blur_tiles_flatten)
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(eevee_motion_blur_tiles_dilate)
.do_static_compilation(true)
.local_group_size(MOTION_BLUR_GROUP_SIZE, MOTION_BLUR_GROUP_SIZE)
.additional_info("eevee_shared")
DO_STATIC_COMPILATION()
LOCAL_GROUP_SIZE(MOTION_BLUR_GROUP_SIZE, MOTION_BLUR_GROUP_SIZE)
ADDITIONAL_INFO(eevee_shared)
/* NOTE: See MotionBlurTileIndirection. */
.storage_buf(0, Qualifier::READ_WRITE, "uint", "tile_indirection_buf[]")
.image(1, GPU_RGBA16F, Qualifier::READ, ImageType::FLOAT_2D, "in_tiles_img")
.compute_source("eevee_motion_blur_dilate_comp.glsl");
STORAGE_BUF(0, READ_WRITE, uint, tile_indirection_buf[])
IMAGE(1, GPU_RGBA16F, READ, FLOAT_2D, in_tiles_img)
COMPUTE_SOURCE("eevee_motion_blur_dilate_comp.glsl")
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(eevee_motion_blur_gather)
.do_static_compilation(true)
.local_group_size(MOTION_BLUR_GROUP_SIZE, MOTION_BLUR_GROUP_SIZE)
.additional_info("eevee_shared")
.additional_info("draw_view")
.additional_info("eevee_sampling_data")
.uniform_buf(6, "MotionBlurData", "motion_blur_buf")
.sampler(0, ImageType::DEPTH_2D, "depth_tx")
.sampler(1, ImageType::FLOAT_2D, "velocity_tx")
.sampler(2, ImageType::FLOAT_2D, "in_color_tx")
DO_STATIC_COMPILATION()
LOCAL_GROUP_SIZE(MOTION_BLUR_GROUP_SIZE, MOTION_BLUR_GROUP_SIZE)
ADDITIONAL_INFO(eevee_shared)
ADDITIONAL_INFO(draw_view)
ADDITIONAL_INFO(eevee_sampling_data)
UNIFORM_BUF(6, MotionBlurData, motion_blur_buf)
SAMPLER(0, DEPTH_2D, depth_tx)
SAMPLER(1, FLOAT_2D, velocity_tx)
SAMPLER(2, FLOAT_2D, in_color_tx)
/* NOTE: See MotionBlurTileIndirection. */
.storage_buf(0, Qualifier::READ, "uint", "tile_indirection_buf[]")
.image(0, GPU_RGBA16F, Qualifier::READ, ImageType::FLOAT_2D, "in_tiles_img")
.image(1, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_color_img")
.compute_source("eevee_motion_blur_gather_comp.glsl");
STORAGE_BUF(0, READ, uint, tile_indirection_buf[])
IMAGE(0, GPU_RGBA16F, READ, FLOAT_2D, in_tiles_img)
IMAGE(1, GPU_RGBA16F, WRITE, FLOAT_2D, out_color_img)
COMPUTE_SOURCE("eevee_motion_blur_gather_comp.glsl")
GPU_SHADER_CREATE_END()

View File

@ -11,227 +11,245 @@
* \{ */
GPU_SHADER_CREATE_INFO(eevee_shadow_clipmap_clear)
.do_static_compilation(true)
.local_group_size(SHADOW_CLIPMAP_GROUP_SIZE)
.storage_buf(0, Qualifier::WRITE, "ShadowTileMapClip", "tilemaps_clip_buf[]")
.push_constant(Type::INT, "tilemaps_clip_buf_len")
.additional_info("eevee_shared")
.compute_source("eevee_shadow_clipmap_clear_comp.glsl");
DO_STATIC_COMPILATION()
LOCAL_GROUP_SIZE(SHADOW_CLIPMAP_GROUP_SIZE)
STORAGE_BUF(0, WRITE, ShadowTileMapClip, tilemaps_clip_buf[])
PUSH_CONSTANT(INT, tilemaps_clip_buf_len)
ADDITIONAL_INFO(eevee_shared)
COMPUTE_SOURCE("eevee_shadow_clipmap_clear_comp.glsl")
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(eevee_shadow_tilemap_bounds)
.do_static_compilation(true)
.local_group_size(SHADOW_BOUNDS_GROUP_SIZE)
.storage_buf(LIGHT_BUF_SLOT, Qualifier::READ_WRITE, "LightData", "light_buf[]")
.storage_buf(LIGHT_CULL_BUF_SLOT, Qualifier::READ, "LightCullingData", "light_cull_buf")
.storage_buf(4, Qualifier::READ, "uint", "casters_id_buf[]")
.storage_buf(5, Qualifier::READ_WRITE, "ShadowTileMapData", "tilemaps_buf[]")
.storage_buf(6, Qualifier::READ, "ObjectBounds", "bounds_buf[]")
.storage_buf(7, Qualifier::READ_WRITE, "ShadowTileMapClip", "tilemaps_clip_buf[]")
.push_constant(Type::INT, "resource_len")
.typedef_source("draw_shader_shared.hh")
.additional_info("eevee_shared")
.compute_source("eevee_shadow_tilemap_bounds_comp.glsl");
DO_STATIC_COMPILATION()
LOCAL_GROUP_SIZE(SHADOW_BOUNDS_GROUP_SIZE)
STORAGE_BUF(LIGHT_BUF_SLOT, READ_WRITE, LightData, light_buf[])
STORAGE_BUF(LIGHT_CULL_BUF_SLOT, READ, LightCullingData, light_cull_buf)
STORAGE_BUF(4, READ, uint, casters_id_buf[])
STORAGE_BUF(5, READ_WRITE, ShadowTileMapData, tilemaps_buf[])
STORAGE_BUF(6, READ, ObjectBounds, bounds_buf[])
STORAGE_BUF(7, READ_WRITE, ShadowTileMapClip, tilemaps_clip_buf[])
PUSH_CONSTANT(INT, resource_len)
TYPEDEF_SOURCE("draw_shader_shared.hh")
ADDITIONAL_INFO(eevee_shared)
COMPUTE_SOURCE("eevee_shadow_tilemap_bounds_comp.glsl")
GPU_SHADER_CREATE_END()
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, "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")
.compute_source("eevee_shadow_tilemap_init_comp.glsl");
DO_STATIC_COMPILATION()
LOCAL_GROUP_SIZE(SHADOW_TILEMAP_RES, SHADOW_TILEMAP_RES)
STORAGE_BUF(0, READ_WRITE, ShadowTileMapData, tilemaps_buf[])
STORAGE_BUF(1, READ_WRITE, uint, tiles_buf[])
STORAGE_BUF(2, READ_WRITE, ShadowTileMapClip, tilemaps_clip_buf[])
STORAGE_BUF(4, READ_WRITE, uvec2, pages_cached_buf[])
ADDITIONAL_INFO(eevee_shared)
COMPUTE_SOURCE("eevee_shadow_tilemap_init_comp.glsl")
GPU_SHADER_CREATE_END()
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, "uint", "tiles_buf[]")
.storage_buf(5, Qualifier::READ, "ObjectBounds", "bounds_buf[]")
.storage_buf(6, Qualifier::READ, "uint", "resource_ids_buf[]")
.additional_info("eevee_shared")
.additional_info("draw_view")
.additional_info("draw_view_culling")
.compute_source("eevee_shadow_tag_update_comp.glsl");
DO_STATIC_COMPILATION()
LOCAL_GROUP_SIZE(1, 1, 1)
STORAGE_BUF(0, READ_WRITE, ShadowTileMapData, tilemaps_buf[])
STORAGE_BUF(1, READ_WRITE, uint, tiles_buf[])
STORAGE_BUF(5, READ, ObjectBounds, bounds_buf[])
STORAGE_BUF(6, READ, uint, resource_ids_buf[])
ADDITIONAL_INFO(eevee_shared)
ADDITIONAL_INFO(draw_view)
ADDITIONAL_INFO(draw_view_culling)
COMPUTE_SOURCE("eevee_shadow_tag_update_comp.glsl")
GPU_SHADER_CREATE_END()
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, "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")
.compute_source("eevee_shadow_tag_usage_comp.glsl");
DO_STATIC_COMPILATION()
LOCAL_GROUP_SIZE(SHADOW_DEPTH_SCAN_GROUP_SIZE, SHADOW_DEPTH_SCAN_GROUP_SIZE)
STORAGE_BUF(5, READ_WRITE, ShadowTileMapData, tilemaps_buf[])
STORAGE_BUF(6, READ_WRITE, uint, tiles_buf[])
PUSH_CONSTANT(IVEC2, input_depth_extent)
ADDITIONAL_INFO(eevee_shared)
ADDITIONAL_INFO(draw_view)
ADDITIONAL_INFO(draw_view_culling)
ADDITIONAL_INFO(eevee_hiz_data)
ADDITIONAL_INFO(eevee_light_data)
COMPUTE_SOURCE("eevee_shadow_tag_usage_comp.glsl")
GPU_SHADER_CREATE_END()
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, "uint", "tiles_buf[]")
.push_constant(Type::INT, "directional_level")
.additional_info("eevee_shared")
.additional_info("draw_view")
.additional_info("draw_view_culling")
.additional_info("eevee_light_data")
.additional_info("eevee_global_ubo")
.additional_info("eevee_surfel_common")
.compute_source("eevee_shadow_tag_usage_surfels_comp.glsl");
DO_STATIC_COMPILATION()
LOCAL_GROUP_SIZE(SURFEL_GROUP_SIZE)
STORAGE_BUF(6, READ_WRITE, ShadowTileMapData, tilemaps_buf[])
STORAGE_BUF(7, READ_WRITE, uint, tiles_buf[])
PUSH_CONSTANT(INT, directional_level)
ADDITIONAL_INFO(eevee_shared)
ADDITIONAL_INFO(draw_view)
ADDITIONAL_INFO(draw_view_culling)
ADDITIONAL_INFO(eevee_light_data)
ADDITIONAL_INFO(eevee_global_ubo)
ADDITIONAL_INFO(eevee_surfel_common)
COMPUTE_SOURCE("eevee_shadow_tag_usage_surfels_comp.glsl")
GPU_SHADER_CREATE_END()
GPU_SHADER_NAMED_INTERFACE_INFO(eevee_shadow_tag_transparent_iface, interp)
.smooth(Type::VEC3, "P")
.smooth(Type::VEC3, "vP");
SMOOTH(VEC3, P)
SMOOTH(VEC3, vP)
GPU_SHADER_NAMED_INTERFACE_END(interp)
GPU_SHADER_NAMED_INTERFACE_INFO(eevee_shadow_tag_transparent_flat_iface, interp_flat)
.flat(Type::VEC3, "ls_aabb_min")
.flat(Type::VEC3, "ls_aabb_max");
FLAT(VEC3, ls_aabb_min)
FLAT(VEC3, ls_aabb_max)
GPU_SHADER_NAMED_INTERFACE_END(interp_flat)
GPU_SHADER_CREATE_INFO(eevee_shadow_tag_usage_transparent)
.do_static_compilation(true)
.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, "uint", "tiles_buf[]")
.push_constant(Type::IVEC2, "fb_resolution")
.push_constant(Type::INT, "fb_lod")
.vertex_out(eevee_shadow_tag_transparent_iface)
.vertex_out(eevee_shadow_tag_transparent_flat_iface)
.additional_info("eevee_shared")
.additional_info("draw_resource_id_varying")
.additional_info("draw_view")
.additional_info("draw_view_culling")
.additional_info("draw_modelmat_new")
.additional_info("eevee_hiz_data")
.additional_info("eevee_light_data")
.vertex_source("eevee_shadow_tag_usage_vert.glsl")
.fragment_source("eevee_shadow_tag_usage_frag.glsl");
DO_STATIC_COMPILATION()
VERTEX_IN(0, VEC3, pos)
STORAGE_BUF(4, READ, ObjectBounds, bounds_buf[])
STORAGE_BUF(5, READ_WRITE, ShadowTileMapData, tilemaps_buf[])
STORAGE_BUF(6, READ_WRITE, uint, tiles_buf[])
PUSH_CONSTANT(IVEC2, fb_resolution)
PUSH_CONSTANT(INT, fb_lod)
VERTEX_OUT(eevee_shadow_tag_transparent_iface)
VERTEX_OUT(eevee_shadow_tag_transparent_flat_iface)
ADDITIONAL_INFO(eevee_shared)
ADDITIONAL_INFO(draw_resource_id_varying)
ADDITIONAL_INFO(draw_view)
ADDITIONAL_INFO(draw_view_culling)
ADDITIONAL_INFO(draw_modelmat_new)
ADDITIONAL_INFO(eevee_hiz_data)
ADDITIONAL_INFO(eevee_light_data)
VERTEX_SOURCE("eevee_shadow_tag_usage_vert.glsl")
FRAGMENT_SOURCE("eevee_shadow_tag_usage_frag.glsl")
GPU_SHADER_CREATE_END()
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, "uint", "tiles_buf[]")
.additional_info("eevee_volume_properties_data")
.additional_info("eevee_shared")
.additional_info("draw_view")
.additional_info("draw_view_culling")
.additional_info("eevee_hiz_data")
.additional_info("eevee_light_data")
.additional_info("eevee_sampling_data")
.compute_source("eevee_shadow_tag_usage_volume_comp.glsl");
DO_STATIC_COMPILATION()
LOCAL_GROUP_SIZE(VOLUME_GROUP_SIZE, VOLUME_GROUP_SIZE, VOLUME_GROUP_SIZE)
STORAGE_BUF(4, READ_WRITE, ShadowTileMapData, tilemaps_buf[])
STORAGE_BUF(5, READ_WRITE, uint, tiles_buf[])
ADDITIONAL_INFO(eevee_volume_properties_data)
ADDITIONAL_INFO(eevee_shared)
ADDITIONAL_INFO(draw_view)
ADDITIONAL_INFO(draw_view_culling)
ADDITIONAL_INFO(eevee_hiz_data)
ADDITIONAL_INFO(eevee_light_data)
ADDITIONAL_INFO(eevee_sampling_data)
COMPUTE_SOURCE("eevee_shadow_tag_usage_volume_comp.glsl")
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(eevee_shadow_page_mask)
.do_static_compilation(true)
.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, "uint", "tiles_buf[]")
.additional_info("eevee_shared")
.compute_source("eevee_shadow_page_mask_comp.glsl");
DO_STATIC_COMPILATION()
LOCAL_GROUP_SIZE(SHADOW_TILEMAP_RES, SHADOW_TILEMAP_RES)
PUSH_CONSTANT(INT, max_view_per_tilemap)
STORAGE_BUF(0, READ_WRITE, ShadowTileMapData, tilemaps_buf[])
STORAGE_BUF(1, READ_WRITE, uint, tiles_buf[])
ADDITIONAL_INFO(eevee_shared)
COMPUTE_SOURCE("eevee_shadow_page_mask_comp.glsl")
GPU_SHADER_CREATE_END()
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, "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[]")
.additional_info("eevee_shared")
.compute_source("eevee_shadow_page_free_comp.glsl");
DO_STATIC_COMPILATION()
LOCAL_GROUP_SIZE(SHADOW_TILEMAP_LOD0_LEN)
STORAGE_BUF(0, READ_WRITE, ShadowTileMapData, tilemaps_buf[])
STORAGE_BUF(1, READ_WRITE, uint, tiles_buf[])
STORAGE_BUF(2, READ_WRITE, ShadowPagesInfoData, pages_infos_buf)
STORAGE_BUF(3, READ_WRITE, uint, pages_free_buf[])
STORAGE_BUF(4, READ_WRITE, uvec2, pages_cached_buf[])
ADDITIONAL_INFO(eevee_shared)
COMPUTE_SOURCE("eevee_shadow_page_free_comp.glsl")
GPU_SHADER_CREATE_END()
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, "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[]")
.storage_buf(5, Qualifier::WRITE, "DispatchCommand", "clear_dispatch_buf")
.storage_buf(6, Qualifier::WRITE, "DrawCommand", "tile_draw_buf")
.storage_buf(7, Qualifier::READ_WRITE, "ShadowStatistics", "statistics_buf")
.additional_info("eevee_shared")
.compute_source("eevee_shadow_page_defrag_comp.glsl");
DO_STATIC_COMPILATION()
LOCAL_GROUP_SIZE(1)
TYPEDEF_SOURCE("draw_shader_shared.hh")
STORAGE_BUF(1, READ_WRITE, uint, tiles_buf[])
STORAGE_BUF(2, READ_WRITE, ShadowPagesInfoData, pages_infos_buf)
STORAGE_BUF(3, READ_WRITE, uint, pages_free_buf[])
STORAGE_BUF(4, READ_WRITE, uvec2, pages_cached_buf[])
STORAGE_BUF(5, WRITE, DispatchCommand, clear_dispatch_buf)
STORAGE_BUF(6, WRITE, DrawCommand, tile_draw_buf)
STORAGE_BUF(7, READ_WRITE, ShadowStatistics, statistics_buf)
ADDITIONAL_INFO(eevee_shared)
COMPUTE_SOURCE("eevee_shadow_page_defrag_comp.glsl")
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(eevee_shadow_page_allocate)
.do_static_compilation(true)
.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, "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[]")
.storage_buf(6, Qualifier::READ_WRITE, "ShadowStatistics", "statistics_buf")
.additional_info("eevee_shared")
.compute_source("eevee_shadow_page_allocate_comp.glsl");
DO_STATIC_COMPILATION()
LOCAL_GROUP_SIZE(SHADOW_TILEMAP_LOD0_LEN)
TYPEDEF_SOURCE("draw_shader_shared.hh")
STORAGE_BUF(0, READ_WRITE, ShadowTileMapData, tilemaps_buf[])
STORAGE_BUF(1, READ_WRITE, uint, tiles_buf[])
STORAGE_BUF(2, READ_WRITE, ShadowPagesInfoData, pages_infos_buf)
STORAGE_BUF(3, READ_WRITE, uint, pages_free_buf[])
STORAGE_BUF(4, READ_WRITE, uvec2, pages_cached_buf[])
STORAGE_BUF(6, READ_WRITE, ShadowStatistics, statistics_buf)
ADDITIONAL_INFO(eevee_shared)
COMPUTE_SOURCE("eevee_shadow_page_allocate_comp.glsl")
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(eevee_shadow_tilemap_finalize)
.do_static_compilation(true)
.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, "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]")
.storage_buf(5, Qualifier::WRITE, "ShadowRenderView", "render_view_buf[SHADOW_VIEW_MAX]")
.storage_buf(6, Qualifier::READ, "ShadowTileMapClip", "tilemaps_clip_buf[]")
.image(0, GPU_R32UI, Qualifier::WRITE, ImageType::UINT_2D, "tilemaps_img")
.additional_info("eevee_shared")
.compute_source("eevee_shadow_tilemap_finalize_comp.glsl");
DO_STATIC_COMPILATION()
TYPEDEF_SOURCE("draw_shader_shared.hh")
LOCAL_GROUP_SIZE(SHADOW_TILEMAP_RES, SHADOW_TILEMAP_RES)
STORAGE_BUF(0, READ, ShadowTileMapData, tilemaps_buf[])
STORAGE_BUF(1, READ, uint, tiles_buf[])
STORAGE_BUF(2, READ_WRITE, ShadowPagesInfoData, pages_infos_buf)
STORAGE_BUF(3, READ_WRITE, ShadowStatistics, statistics_buf)
STORAGE_BUF(4, WRITE, ViewMatrices, view_infos_buf[SHADOW_VIEW_MAX])
STORAGE_BUF(5, WRITE, ShadowRenderView, render_view_buf[SHADOW_VIEW_MAX])
STORAGE_BUF(6, READ, ShadowTileMapClip, tilemaps_clip_buf[])
IMAGE(0, GPU_R32UI, WRITE, UINT_2D, tilemaps_img)
ADDITIONAL_INFO(eevee_shared)
COMPUTE_SOURCE("eevee_shadow_tilemap_finalize_comp.glsl")
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(eevee_shadow_tilemap_rendermap)
.do_static_compilation(true)
.typedef_source("draw_shader_shared.hh")
.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, "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, "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");
DO_STATIC_COMPILATION()
TYPEDEF_SOURCE("draw_shader_shared.hh")
LOCAL_GROUP_SIZE(SHADOW_TILEMAP_RES, SHADOW_TILEMAP_RES)
STORAGE_BUF(0, READ_WRITE, ShadowStatistics, statistics_buf)
STORAGE_BUF(1, READ, ShadowRenderView, render_view_buf[SHADOW_VIEW_MAX])
STORAGE_BUF(2, READ_WRITE, uint, tiles_buf[])
STORAGE_BUF(3, READ_WRITE, DispatchCommand, clear_dispatch_buf)
STORAGE_BUF(4, READ_WRITE, DrawCommand, tile_draw_buf)
STORAGE_BUF(5, WRITE, uint, dst_coord_buf[SHADOW_RENDER_MAP_SIZE])
STORAGE_BUF(6, WRITE, uint, src_coord_buf[SHADOW_RENDER_MAP_SIZE])
STORAGE_BUF(7, WRITE, uint, render_map_buf[SHADOW_RENDER_MAP_SIZE])
ADDITIONAL_INFO(eevee_shared)
COMPUTE_SOURCE("eevee_shadow_tilemap_rendermap_comp.glsl")
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(eevee_shadow_tilemap_amend)
.do_static_compilation(true)
.local_group_size(SHADOW_TILEMAP_RES, SHADOW_TILEMAP_RES)
.image(0, GPU_R32UI, Qualifier::READ_WRITE, ImageType::UINT_2D, "tilemaps_img")
.storage_buf(LIGHT_CULL_BUF_SLOT, Qualifier::READ, "LightCullingData", "light_cull_buf")
.storage_buf(LIGHT_BUF_SLOT, Qualifier::READ_WRITE, "LightData", "light_buf[]")
DO_STATIC_COMPILATION()
LOCAL_GROUP_SIZE(SHADOW_TILEMAP_RES, SHADOW_TILEMAP_RES)
IMAGE(0, GPU_R32UI, READ_WRITE, UINT_2D, tilemaps_img)
STORAGE_BUF(LIGHT_CULL_BUF_SLOT, READ, LightCullingData, light_cull_buf)
STORAGE_BUF(LIGHT_BUF_SLOT, READ_WRITE, LightData, light_buf[])
/* The call bind_resources(lights) also uses LIGHT_ZBIN_BUF_SLOT and LIGHT_TILE_BUF_SLOT. */
.storage_buf(4, Qualifier::READ, "ShadowTileMapData", "tilemaps_buf[]")
.additional_info("eevee_shared")
.additional_info("draw_view")
.compute_source("eevee_shadow_tilemap_amend_comp.glsl");
STORAGE_BUF(4, READ, ShadowTileMapData, tilemaps_buf[])
ADDITIONAL_INFO(eevee_shared)
ADDITIONAL_INFO(draw_view)
COMPUTE_SOURCE("eevee_shadow_tilemap_amend_comp.glsl")
GPU_SHADER_CREATE_END()
/* AtomicMin clear implementation. */
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, "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,
GPU_R32UI,
Qualifier::READ_WRITE,
ImageType::UINT_2D_ARRAY_ATOMIC,
"shadow_atlas_img");
DO_STATIC_COMPILATION()
LOCAL_GROUP_SIZE(SHADOW_PAGE_CLEAR_GROUP_SIZE, SHADOW_PAGE_CLEAR_GROUP_SIZE)
STORAGE_BUF(2, READ, ShadowPagesInfoData, pages_infos_buf)
STORAGE_BUF(6, 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, GPU_R32UI, READ_WRITE, UINT_2D_ARRAY_ATOMIC, shadow_atlas_img)
GPU_SHADER_CREATE_END()
/* TBDR clear implementation. */
GPU_SHADER_CREATE_INFO(eevee_shadow_page_tile_clear)
.do_static_compilation(true)
.define("PASS_CLEAR")
.additional_info("eevee_shared")
.builtins(BuiltinBits::VIEWPORT_INDEX | BuiltinBits::LAYER)
.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);
DO_STATIC_COMPILATION()
DEFINE("PASS_CLEAR")
ADDITIONAL_INFO(eevee_shared)
BUILTINS(BuiltinBits::VIEWPORT_INDEX | BuiltinBits::LAYER)
STORAGE_BUF(8, 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_ROG(0, FLOAT, out_tile_depth, SHADOW_ROG_ID)
GPU_SHADER_CREATE_END()
#ifdef APPLE
/* Metal supports USHORT which saves a bit of performance here. */
@ -243,30 +261,29 @@ GPU_SHADER_CREATE_INFO(eevee_shadow_page_tile_clear)
/* Interface for passing precalculated values in accumulation vertex to frag. */
GPU_SHADER_NAMED_INTERFACE_INFO(eevee_shadow_page_tile_store_noperspective_iface,
interp_noperspective)
.no_perspective(Type::VEC2, "out_texel_xy");
NO_PERSPECTIVE(VEC2, out_texel_xy)
GPU_SHADER_NAMED_INTERFACE_END(interp_noperspective)
GPU_SHADER_NAMED_INTERFACE_INFO(eevee_shadow_page_tile_store_flat_iface, interp_flat)
.flat(Type::PAGE_Z_TYPE, "out_page_z");
FLAT(PAGE_Z_TYPE, out_page_z)
GPU_SHADER_NAMED_INTERFACE_END(interp_flat)
#undef PAGE_Z_TYPE
/* 2nd tile pass to store shadow depths in atlas. */
GPU_SHADER_CREATE_INFO(eevee_shadow_page_tile_store)
.do_static_compilation(true)
.define("PASS_DEPTH_STORE")
.additional_info("eevee_shared")
.builtins(BuiltinBits::VIEWPORT_INDEX | BuiltinBits::LAYER)
.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,
Qualifier::READ_WRITE,
ImageType::UINT_2D_ARRAY,
"shadow_atlas_img")
.vertex_out(eevee_shadow_page_tile_store_noperspective_iface)
.vertex_out(eevee_shadow_page_tile_store_flat_iface)
.vertex_source("eevee_shadow_page_tile_vert.glsl")
.fragment_source("eevee_shadow_page_tile_frag.glsl");
DO_STATIC_COMPILATION()
DEFINE("PASS_DEPTH_STORE")
ADDITIONAL_INFO(eevee_shared)
BUILTINS(BuiltinBits::VIEWPORT_INDEX | BuiltinBits::LAYER)
STORAGE_BUF(7, READ, uint, dst_coord_buf[SHADOW_RENDER_MAP_SIZE])
STORAGE_BUF(8, READ, uint, src_coord_buf[SHADOW_RENDER_MAP_SIZE])
SUBPASS_IN(0, FLOAT, in_tile_depth, SHADOW_ROG_ID)
IMAGE(SHADOW_ATLAS_IMG_SLOT, GPU_R32UI, READ_WRITE, UINT_2D_ARRAY, shadow_atlas_img)
VERTEX_OUT(eevee_shadow_page_tile_store_noperspective_iface)
VERTEX_OUT(eevee_shadow_page_tile_store_flat_iface)
VERTEX_SOURCE("eevee_shadow_page_tile_vert.glsl")
FRAGMENT_SOURCE("eevee_shadow_page_tile_frag.glsl")
GPU_SHADER_CREATE_END()
/** \} */
@ -277,14 +294,16 @@ GPU_SHADER_CREATE_INFO(eevee_shadow_page_tile_store)
GPU_SHADER_CREATE_INFO(eevee_shadow_data)
/* SHADOW_READ_ATOMIC macro indicating shadow functions should use `usampler2DArrayAtomic` as
* the atlas type. */
.define("SHADOW_READ_ATOMIC")
.builtins(BuiltinBits::TEXTURE_ATOMIC)
.sampler(SHADOW_ATLAS_TEX_SLOT, ImageType::UINT_2D_ARRAY_ATOMIC, "shadow_atlas_tx")
.sampler(SHADOW_TILEMAPS_TEX_SLOT, ImageType::UINT_2D, "shadow_tilemaps_tx");
DEFINE("SHADOW_READ_ATOMIC")
BUILTINS(BuiltinBits::TEXTURE_ATOMIC)
SAMPLER(SHADOW_ATLAS_TEX_SLOT, UINT_2D_ARRAY_ATOMIC, shadow_atlas_tx)
SAMPLER(SHADOW_TILEMAPS_TEX_SLOT, UINT_2D, shadow_tilemaps_tx)
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(eevee_shadow_data_non_atomic)
.sampler(SHADOW_ATLAS_TEX_SLOT, ImageType::UINT_2D_ARRAY, "shadow_atlas_tx")
.sampler(SHADOW_TILEMAPS_TEX_SLOT, ImageType::UINT_2D, "shadow_tilemaps_tx");
SAMPLER(SHADOW_ATLAS_TEX_SLOT, UINT_2D_ARRAY, shadow_atlas_tx)
SAMPLER(SHADOW_TILEMAPS_TEX_SLOT, UINT_2D, shadow_tilemaps_tx)
GPU_SHADER_CREATE_END()
/** \} */
@ -293,17 +312,21 @@ GPU_SHADER_CREATE_INFO(eevee_shadow_data_non_atomic)
* \{ */
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, "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")
.push_constant(Type::INT, "debug_tilemap_index")
.depth_write(DepthWrite::ANY)
.fragment_source("eevee_shadow_debug_frag.glsl")
.additional_info(
"draw_fullscreen", "draw_view", "eevee_hiz_data", "eevee_light_data", "eevee_shadow_data");
DO_STATIC_COMPILATION()
ADDITIONAL_INFO(eevee_shared)
STORAGE_BUF(5, READ, ShadowTileMapData, tilemaps_buf[])
STORAGE_BUF(6, READ, uint, tiles_buf[])
FRAGMENT_OUT_DUAL(0, VEC4, out_color_add, SRC_0)
FRAGMENT_OUT_DUAL(0, VEC4, out_color_mul, SRC_1)
PUSH_CONSTANT(INT, debug_mode)
PUSH_CONSTANT(INT, debug_tilemap_index)
DEPTH_WRITE(DepthWrite::ANY)
FRAGMENT_SOURCE("eevee_shadow_debug_frag.glsl")
ADDITIONAL_INFO(draw_fullscreen)
ADDITIONAL_INFO(draw_view)
ADDITIONAL_INFO(eevee_hiz_data)
ADDITIONAL_INFO(eevee_light_data)
ADDITIONAL_INFO(eevee_shadow_data)
GPU_SHADER_CREATE_END()
/** \} */

View File

@ -6,37 +6,34 @@
#include "gpu_shader_create_info.hh"
GPU_SHADER_CREATE_INFO(eevee_subsurface_setup)
.do_static_compilation(true)
.local_group_size(SUBSURFACE_GROUP_SIZE, SUBSURFACE_GROUP_SIZE)
.typedef_source("draw_shader_shared.hh")
.additional_info("draw_view")
.additional_info("eevee_shared")
.additional_info("eevee_gbuffer_data")
.sampler(2, ImageType::DEPTH_2D, "depth_tx")
.image(0, DEFERRED_RADIANCE_FORMAT, Qualifier::READ, ImageType::UINT_2D, "direct_light_img")
.image(1, RAYTRACE_RADIANCE_FORMAT, Qualifier::READ, ImageType::FLOAT_2D, "indirect_light_img")
.image(2, SUBSURFACE_OBJECT_ID_FORMAT, Qualifier::WRITE, ImageType::UINT_2D, "object_id_img")
.image(3, SUBSURFACE_RADIANCE_FORMAT, Qualifier::WRITE, ImageType::FLOAT_2D, "radiance_img")
.storage_buf(0, Qualifier::WRITE, "uint", "convolve_tile_buf[]")
.storage_buf(1, Qualifier::READ_WRITE, "DispatchCommand", "convolve_dispatch_buf")
.compute_source("eevee_subsurface_setup_comp.glsl");
DO_STATIC_COMPILATION()
LOCAL_GROUP_SIZE(SUBSURFACE_GROUP_SIZE, SUBSURFACE_GROUP_SIZE)
TYPEDEF_SOURCE("draw_shader_shared.hh")
ADDITIONAL_INFO(draw_view)
ADDITIONAL_INFO(eevee_shared)
ADDITIONAL_INFO(eevee_gbuffer_data)
SAMPLER(2, DEPTH_2D, depth_tx)
IMAGE(0, DEFERRED_RADIANCE_FORMAT, READ, UINT_2D, direct_light_img)
IMAGE(1, RAYTRACE_RADIANCE_FORMAT, READ, FLOAT_2D, indirect_light_img)
IMAGE(2, SUBSURFACE_OBJECT_ID_FORMAT, WRITE, UINT_2D, object_id_img)
IMAGE(3, SUBSURFACE_RADIANCE_FORMAT, WRITE, FLOAT_2D, radiance_img)
STORAGE_BUF(0, WRITE, uint, convolve_tile_buf[])
STORAGE_BUF(1, READ_WRITE, DispatchCommand, convolve_dispatch_buf)
COMPUTE_SOURCE("eevee_subsurface_setup_comp.glsl")
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(eevee_subsurface_convolve)
.do_static_compilation(true)
.local_group_size(SUBSURFACE_GROUP_SIZE, SUBSURFACE_GROUP_SIZE)
.additional_info("draw_view")
.additional_info("eevee_shared")
.additional_info("eevee_gbuffer_data")
.additional_info("eevee_global_ubo")
.sampler(2, ImageType::FLOAT_2D, "radiance_tx")
.sampler(3, ImageType::DEPTH_2D, "depth_tx")
.sampler(4, ImageType::UINT_2D, "object_id_tx")
.storage_buf(0, Qualifier::READ, "uint", "tiles_coord_buf[]")
.image(
0, DEFERRED_RADIANCE_FORMAT, Qualifier::WRITE, ImageType::UINT_2D, "out_direct_light_img")
.image(1,
RAYTRACE_RADIANCE_FORMAT,
Qualifier::WRITE,
ImageType::FLOAT_2D,
"out_indirect_light_img")
.compute_source("eevee_subsurface_convolve_comp.glsl");
DO_STATIC_COMPILATION()
LOCAL_GROUP_SIZE(SUBSURFACE_GROUP_SIZE, SUBSURFACE_GROUP_SIZE)
ADDITIONAL_INFO(draw_view)
ADDITIONAL_INFO(eevee_shared)
ADDITIONAL_INFO(eevee_gbuffer_data)
ADDITIONAL_INFO(eevee_global_ubo)
SAMPLER(2, FLOAT_2D, radiance_tx)
SAMPLER(3, DEPTH_2D, depth_tx)
SAMPLER(4, UINT_2D, object_id_tx)
STORAGE_BUF(0, READ, uint, tiles_coord_buf[])
IMAGE(0, DEFERRED_RADIANCE_FORMAT, WRITE, UINT_2D, out_direct_light_img)
IMAGE(1, RAYTRACE_RADIANCE_FORMAT, WRITE, FLOAT_2D, out_indirect_light_img)
COMPUTE_SOURCE("eevee_subsurface_convolve_comp.glsl")
GPU_SHADER_CREATE_END()

View File

@ -15,250 +15,266 @@
image(slot, format, Qualifier::READ, type, name, Frequency::PASS)
GPU_SHADER_CREATE_INFO(eevee_ray_tile_classify)
.do_static_compilation(true)
.local_group_size(RAYTRACE_GROUP_SIZE, RAYTRACE_GROUP_SIZE)
.additional_info("eevee_shared")
.additional_info("eevee_gbuffer_data")
.additional_info("eevee_global_ubo")
.typedef_source("draw_shader_shared.hh")
.image_out(0, RAYTRACE_TILEMASK_FORMAT, ImageType::UINT_2D_ARRAY, "tile_raytrace_denoise_img")
.image_out(1, RAYTRACE_TILEMASK_FORMAT, ImageType::UINT_2D_ARRAY, "tile_raytrace_tracing_img")
.image_out(2, RAYTRACE_TILEMASK_FORMAT, ImageType::UINT_2D_ARRAY, "tile_horizon_denoise_img")
.image_out(3, RAYTRACE_TILEMASK_FORMAT, ImageType::UINT_2D_ARRAY, "tile_horizon_tracing_img")
.compute_source("eevee_ray_tile_classify_comp.glsl");
DO_STATIC_COMPILATION()
LOCAL_GROUP_SIZE(RAYTRACE_GROUP_SIZE, RAYTRACE_GROUP_SIZE)
ADDITIONAL_INFO(eevee_shared)
ADDITIONAL_INFO(eevee_gbuffer_data)
ADDITIONAL_INFO(eevee_global_ubo)
TYPEDEF_SOURCE("draw_shader_shared.hh")
IMAGE_FREQ(0, RAYTRACE_TILEMASK_FORMAT, WRITE, UINT_2D_ARRAY, tile_raytrace_denoise_img, PASS)
IMAGE_FREQ(1, RAYTRACE_TILEMASK_FORMAT, WRITE, UINT_2D_ARRAY, tile_raytrace_tracing_img, PASS)
IMAGE_FREQ(2, RAYTRACE_TILEMASK_FORMAT, WRITE, UINT_2D_ARRAY, tile_horizon_denoise_img, PASS)
IMAGE_FREQ(3, RAYTRACE_TILEMASK_FORMAT, WRITE, UINT_2D_ARRAY, tile_horizon_tracing_img, PASS)
COMPUTE_SOURCE("eevee_ray_tile_classify_comp.glsl")
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(eevee_ray_tile_compact)
.do_static_compilation(true)
.local_group_size(RAYTRACE_GROUP_SIZE, RAYTRACE_GROUP_SIZE)
.additional_info("eevee_shared")
.additional_info("eevee_global_ubo")
.typedef_source("draw_shader_shared.hh")
.image_in(0, RAYTRACE_TILEMASK_FORMAT, ImageType::UINT_2D_ARRAY, "tile_raytrace_denoise_img")
.image_in(1, RAYTRACE_TILEMASK_FORMAT, ImageType::UINT_2D_ARRAY, "tile_raytrace_tracing_img")
.storage_buf(0, Qualifier::READ_WRITE, "DispatchCommand", "raytrace_tracing_dispatch_buf")
.storage_buf(1, Qualifier::READ_WRITE, "DispatchCommand", "raytrace_denoise_dispatch_buf")
.storage_buf(4, Qualifier::WRITE, "uint", "raytrace_tracing_tiles_buf[]")
.storage_buf(5, Qualifier::WRITE, "uint", "raytrace_denoise_tiles_buf[]")
.specialization_constant(Type::INT, "closure_index", 0)
.specialization_constant(Type::INT, "resolution_scale", 2)
.compute_source("eevee_ray_tile_compact_comp.glsl");
DO_STATIC_COMPILATION()
LOCAL_GROUP_SIZE(RAYTRACE_GROUP_SIZE, RAYTRACE_GROUP_SIZE)
ADDITIONAL_INFO(eevee_shared)
ADDITIONAL_INFO(eevee_global_ubo)
TYPEDEF_SOURCE("draw_shader_shared.hh")
IMAGE_FREQ(0, RAYTRACE_TILEMASK_FORMAT, READ, UINT_2D_ARRAY, tile_raytrace_denoise_img, PASS)
IMAGE_FREQ(1, RAYTRACE_TILEMASK_FORMAT, READ, UINT_2D_ARRAY, tile_raytrace_tracing_img, PASS)
STORAGE_BUF(0, READ_WRITE, DispatchCommand, raytrace_tracing_dispatch_buf)
STORAGE_BUF(1, READ_WRITE, DispatchCommand, raytrace_denoise_dispatch_buf)
STORAGE_BUF(4, WRITE, uint, raytrace_tracing_tiles_buf[])
STORAGE_BUF(5, WRITE, uint, raytrace_denoise_tiles_buf[])
SPECIALIZATION_CONSTANT(INT, closure_index, 0)
SPECIALIZATION_CONSTANT(INT, resolution_scale, 2)
COMPUTE_SOURCE("eevee_ray_tile_compact_comp.glsl")
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(eevee_ray_generate)
.do_static_compilation(true)
.local_group_size(RAYTRACE_GROUP_SIZE, RAYTRACE_GROUP_SIZE)
.additional_info("eevee_shared")
.additional_info("eevee_gbuffer_data")
.additional_info("eevee_global_ubo")
.additional_info("eevee_sampling_data")
.additional_info("draw_view")
.additional_info("eevee_utility_texture")
.image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_ray_data_img")
.storage_buf(4, Qualifier::READ, "uint", "tiles_coord_buf[]")
.specialization_constant(Type::INT, "closure_index", 0)
.compute_source("eevee_ray_generate_comp.glsl");
DO_STATIC_COMPILATION()
LOCAL_GROUP_SIZE(RAYTRACE_GROUP_SIZE, RAYTRACE_GROUP_SIZE)
ADDITIONAL_INFO(eevee_shared)
ADDITIONAL_INFO(eevee_gbuffer_data)
ADDITIONAL_INFO(eevee_global_ubo)
ADDITIONAL_INFO(eevee_sampling_data)
ADDITIONAL_INFO(draw_view)
ADDITIONAL_INFO(eevee_utility_texture)
IMAGE(0, GPU_RGBA16F, WRITE, FLOAT_2D, out_ray_data_img)
STORAGE_BUF(4, READ, uint, tiles_coord_buf[])
SPECIALIZATION_CONSTANT(INT, closure_index, 0)
COMPUTE_SOURCE("eevee_ray_generate_comp.glsl")
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(eevee_ray_trace_fallback)
.do_static_compilation(true)
.local_group_size(RAYTRACE_GROUP_SIZE, RAYTRACE_GROUP_SIZE)
.additional_info("eevee_shared")
.additional_info("eevee_gbuffer_data")
.additional_info("eevee_global_ubo")
.additional_info("draw_view")
.additional_info("eevee_sampling_data")
.additional_info("eevee_lightprobe_data")
.image(0, GPU_RGBA16F, Qualifier::READ, ImageType::FLOAT_2D, "ray_data_img")
.image(1, RAYTRACE_RAYTIME_FORMAT, Qualifier::WRITE, ImageType::FLOAT_2D, "ray_time_img")
.image(2, RAYTRACE_RADIANCE_FORMAT, Qualifier::WRITE, ImageType::FLOAT_2D, "ray_radiance_img")
.sampler(1, ImageType::DEPTH_2D, "depth_tx")
.storage_buf(5, Qualifier::READ, "uint", "tiles_coord_buf[]")
.specialization_constant(Type::INT, "closure_index", 0)
.compute_source("eevee_ray_trace_fallback_comp.glsl");
DO_STATIC_COMPILATION()
LOCAL_GROUP_SIZE(RAYTRACE_GROUP_SIZE, RAYTRACE_GROUP_SIZE)
ADDITIONAL_INFO(eevee_shared)
ADDITIONAL_INFO(eevee_gbuffer_data)
ADDITIONAL_INFO(eevee_global_ubo)
ADDITIONAL_INFO(draw_view)
ADDITIONAL_INFO(eevee_sampling_data)
ADDITIONAL_INFO(eevee_lightprobe_data)
IMAGE(0, GPU_RGBA16F, READ, FLOAT_2D, ray_data_img)
IMAGE(1, RAYTRACE_RAYTIME_FORMAT, WRITE, FLOAT_2D, ray_time_img)
IMAGE(2, RAYTRACE_RADIANCE_FORMAT, WRITE, FLOAT_2D, ray_radiance_img)
SAMPLER(1, DEPTH_2D, depth_tx)
STORAGE_BUF(5, READ, uint, tiles_coord_buf[])
SPECIALIZATION_CONSTANT(INT, closure_index, 0)
COMPUTE_SOURCE("eevee_ray_trace_fallback_comp.glsl")
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(eevee_ray_trace_planar)
.do_static_compilation(true)
.local_group_size(RAYTRACE_GROUP_SIZE, RAYTRACE_GROUP_SIZE)
.define("PLANAR_PROBES")
.additional_info("eevee_shared")
.additional_info("eevee_global_ubo")
.additional_info("eevee_sampling_data")
.additional_info("eevee_gbuffer_data")
.additional_info("draw_view")
.additional_info("eevee_lightprobe_data")
.additional_info("eevee_lightprobe_planar_data")
.image(0, GPU_RGBA16F, Qualifier::READ_WRITE, ImageType::FLOAT_2D, "ray_data_img")
.image(1, RAYTRACE_RAYTIME_FORMAT, Qualifier::WRITE, ImageType::FLOAT_2D, "ray_time_img")
.image(2, RAYTRACE_RADIANCE_FORMAT, Qualifier::WRITE, ImageType::FLOAT_2D, "ray_radiance_img")
.sampler(2, ImageType::DEPTH_2D, "depth_tx")
.storage_buf(5, Qualifier::READ, "uint", "tiles_coord_buf[]")
.specialization_constant(Type::INT, "closure_index", 0)
.compute_source("eevee_ray_trace_planar_comp.glsl");
DO_STATIC_COMPILATION()
LOCAL_GROUP_SIZE(RAYTRACE_GROUP_SIZE, RAYTRACE_GROUP_SIZE)
DEFINE("PLANAR_PROBES")
ADDITIONAL_INFO(eevee_shared)
ADDITIONAL_INFO(eevee_global_ubo)
ADDITIONAL_INFO(eevee_sampling_data)
ADDITIONAL_INFO(eevee_gbuffer_data)
ADDITIONAL_INFO(draw_view)
ADDITIONAL_INFO(eevee_lightprobe_data)
ADDITIONAL_INFO(eevee_lightprobe_planar_data)
IMAGE(0, GPU_RGBA16F, READ_WRITE, FLOAT_2D, ray_data_img)
IMAGE(1, RAYTRACE_RAYTIME_FORMAT, WRITE, FLOAT_2D, ray_time_img)
IMAGE(2, RAYTRACE_RADIANCE_FORMAT, WRITE, FLOAT_2D, ray_radiance_img)
SAMPLER(2, DEPTH_2D, depth_tx)
STORAGE_BUF(5, READ, uint, tiles_coord_buf[])
SPECIALIZATION_CONSTANT(INT, closure_index, 0)
COMPUTE_SOURCE("eevee_ray_trace_planar_comp.glsl")
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(eevee_ray_trace_screen)
.do_static_compilation(true)
.local_group_size(RAYTRACE_GROUP_SIZE, RAYTRACE_GROUP_SIZE)
.additional_info("eevee_shared")
.additional_info("eevee_global_ubo")
.additional_info("eevee_sampling_data")
.additional_info("eevee_gbuffer_data")
.additional_info("draw_view")
.additional_info("eevee_hiz_data")
.additional_info("eevee_lightprobe_data")
.image(0, GPU_RGBA16F, Qualifier::READ, ImageType::FLOAT_2D, "ray_data_img")
.image(1, RAYTRACE_RAYTIME_FORMAT, Qualifier::WRITE, ImageType::FLOAT_2D, "ray_time_img")
.image(2, RAYTRACE_RADIANCE_FORMAT, Qualifier::WRITE, ImageType::FLOAT_2D, "ray_radiance_img")
.sampler(0, ImageType::DEPTH_2D, "depth_tx")
.sampler(1, ImageType::FLOAT_2D, "radiance_front_tx")
.sampler(2, ImageType::FLOAT_2D, "radiance_back_tx")
.sampler(4, ImageType::FLOAT_2D, "hiz_front_tx")
.sampler(5, ImageType::FLOAT_2D, "hiz_back_tx")
.storage_buf(5, Qualifier::READ, "uint", "tiles_coord_buf[]")
.compute_source("eevee_ray_trace_screen_comp.glsl")
DO_STATIC_COMPILATION()
LOCAL_GROUP_SIZE(RAYTRACE_GROUP_SIZE, RAYTRACE_GROUP_SIZE)
ADDITIONAL_INFO(eevee_shared)
ADDITIONAL_INFO(eevee_global_ubo)
ADDITIONAL_INFO(eevee_sampling_data)
ADDITIONAL_INFO(eevee_gbuffer_data)
ADDITIONAL_INFO(draw_view)
ADDITIONAL_INFO(eevee_hiz_data)
ADDITIONAL_INFO(eevee_lightprobe_data)
IMAGE(0, GPU_RGBA16F, READ, FLOAT_2D, ray_data_img)
IMAGE(1, RAYTRACE_RAYTIME_FORMAT, WRITE, FLOAT_2D, ray_time_img)
IMAGE(2, RAYTRACE_RADIANCE_FORMAT, WRITE, FLOAT_2D, ray_radiance_img)
SAMPLER(0, DEPTH_2D, depth_tx)
SAMPLER(1, FLOAT_2D, radiance_front_tx)
SAMPLER(2, FLOAT_2D, radiance_back_tx)
SAMPLER(4, FLOAT_2D, hiz_front_tx)
SAMPLER(5, FLOAT_2D, hiz_back_tx)
STORAGE_BUF(5, READ, uint, tiles_coord_buf[])
COMPUTE_SOURCE("eevee_ray_trace_screen_comp.glsl")
/* Metal: Provide compiler with hint to tune per-thread resource allocation. */
.mtl_max_total_threads_per_threadgroup(400)
.specialization_constant(Type::BOOL, "trace_refraction", true)
.specialization_constant(Type::INT, "closure_index", 0)
.compute_source("eevee_ray_trace_screen_comp.glsl");
MTL_MAX_TOTAL_THREADS_PER_THREADGROUP(400)
SPECIALIZATION_CONSTANT(BOOL, trace_refraction, true)
SPECIALIZATION_CONSTANT(INT, closure_index, 0)
COMPUTE_SOURCE("eevee_ray_trace_screen_comp.glsl")
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(eevee_ray_denoise_spatial)
.do_static_compilation(true)
.local_group_size(RAYTRACE_GROUP_SIZE, RAYTRACE_GROUP_SIZE)
.additional_info("eevee_shared")
.additional_info("eevee_gbuffer_data")
.additional_info("eevee_global_ubo")
.additional_info("eevee_sampling_data")
.additional_info("draw_view")
.additional_info("eevee_utility_texture")
.sampler(3, ImageType::DEPTH_2D, "depth_tx")
.image(0, GPU_RGBA16F, Qualifier::READ, ImageType::FLOAT_2D, "ray_data_img")
.image(1, RAYTRACE_RAYTIME_FORMAT, Qualifier::READ, ImageType::FLOAT_2D, "ray_time_img")
.image(2, RAYTRACE_RADIANCE_FORMAT, Qualifier::READ, ImageType::FLOAT_2D, "ray_radiance_img")
.image(3, RAYTRACE_RADIANCE_FORMAT, Qualifier::WRITE, ImageType::FLOAT_2D, "out_radiance_img")
.image(4, RAYTRACE_VARIANCE_FORMAT, Qualifier::WRITE, ImageType::FLOAT_2D, "out_variance_img")
.image(5, GPU_R32F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_hit_depth_img")
.image(6, RAYTRACE_TILEMASK_FORMAT, Qualifier::READ, ImageType::UINT_2D_ARRAY, "tile_mask_img")
.storage_buf(4, Qualifier::READ, "uint", "tiles_coord_buf[]")
DO_STATIC_COMPILATION()
LOCAL_GROUP_SIZE(RAYTRACE_GROUP_SIZE, RAYTRACE_GROUP_SIZE)
ADDITIONAL_INFO(eevee_shared)
ADDITIONAL_INFO(eevee_gbuffer_data)
ADDITIONAL_INFO(eevee_global_ubo)
ADDITIONAL_INFO(eevee_sampling_data)
ADDITIONAL_INFO(draw_view)
ADDITIONAL_INFO(eevee_utility_texture)
SAMPLER(3, DEPTH_2D, depth_tx)
IMAGE(0, GPU_RGBA16F, READ, FLOAT_2D, ray_data_img)
IMAGE(1, RAYTRACE_RAYTIME_FORMAT, READ, FLOAT_2D, ray_time_img)
IMAGE(2, RAYTRACE_RADIANCE_FORMAT, READ, FLOAT_2D, ray_radiance_img)
IMAGE(3, RAYTRACE_RADIANCE_FORMAT, WRITE, FLOAT_2D, out_radiance_img)
IMAGE(4, RAYTRACE_VARIANCE_FORMAT, WRITE, FLOAT_2D, out_variance_img)
IMAGE(5, GPU_R32F, WRITE, FLOAT_2D, out_hit_depth_img)
IMAGE(6, RAYTRACE_TILEMASK_FORMAT, READ, UINT_2D_ARRAY, tile_mask_img)
STORAGE_BUF(4, READ, uint, tiles_coord_buf[])
/* Metal: Provide compiler with hint to tune per-thread resource allocation. */
.mtl_max_total_threads_per_threadgroup(316)
.specialization_constant(Type::INT, "raytrace_resolution_scale", 2)
.specialization_constant(Type::BOOL, "skip_denoise", false)
.specialization_constant(Type::INT, "closure_index", 0)
.compute_source("eevee_ray_denoise_spatial_comp.glsl");
MTL_MAX_TOTAL_THREADS_PER_THREADGROUP(316)
SPECIALIZATION_CONSTANT(INT, raytrace_resolution_scale, 2)
SPECIALIZATION_CONSTANT(BOOL, skip_denoise, false)
SPECIALIZATION_CONSTANT(INT, closure_index, 0)
COMPUTE_SOURCE("eevee_ray_denoise_spatial_comp.glsl")
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(eevee_ray_denoise_temporal)
.do_static_compilation(true)
.local_group_size(RAYTRACE_GROUP_SIZE, RAYTRACE_GROUP_SIZE)
.additional_info("eevee_shared")
.additional_info("eevee_global_ubo")
.additional_info("draw_view")
.sampler(0, ImageType::FLOAT_2D, "radiance_history_tx")
.sampler(1, ImageType::FLOAT_2D, "variance_history_tx")
.sampler(2, ImageType::UINT_2D_ARRAY, "tilemask_history_tx")
.sampler(3, ImageType::DEPTH_2D, "depth_tx")
.image(0, GPU_R32F, Qualifier::READ, ImageType::FLOAT_2D, "hit_depth_img")
.image(1, RAYTRACE_RADIANCE_FORMAT, Qualifier::READ, ImageType::FLOAT_2D, "in_radiance_img")
.image(2, RAYTRACE_RADIANCE_FORMAT, Qualifier::WRITE, ImageType::FLOAT_2D, "out_radiance_img")
.image(3, RAYTRACE_VARIANCE_FORMAT, Qualifier::READ, ImageType::FLOAT_2D, "in_variance_img")
.image(4, RAYTRACE_VARIANCE_FORMAT, Qualifier::WRITE, ImageType::FLOAT_2D, "out_variance_img")
.storage_buf(4, Qualifier::READ, "uint", "tiles_coord_buf[]")
.compute_source("eevee_ray_denoise_temporal_comp.glsl")
DO_STATIC_COMPILATION()
LOCAL_GROUP_SIZE(RAYTRACE_GROUP_SIZE, RAYTRACE_GROUP_SIZE)
ADDITIONAL_INFO(eevee_shared)
ADDITIONAL_INFO(eevee_global_ubo)
ADDITIONAL_INFO(draw_view)
SAMPLER(0, FLOAT_2D, radiance_history_tx)
SAMPLER(1, FLOAT_2D, variance_history_tx)
SAMPLER(2, UINT_2D_ARRAY, tilemask_history_tx)
SAMPLER(3, DEPTH_2D, depth_tx)
IMAGE(0, GPU_R32F, READ, FLOAT_2D, hit_depth_img)
IMAGE(1, RAYTRACE_RADIANCE_FORMAT, READ, FLOAT_2D, in_radiance_img)
IMAGE(2, RAYTRACE_RADIANCE_FORMAT, WRITE, FLOAT_2D, out_radiance_img)
IMAGE(3, RAYTRACE_VARIANCE_FORMAT, READ, FLOAT_2D, in_variance_img)
IMAGE(4, RAYTRACE_VARIANCE_FORMAT, WRITE, FLOAT_2D, out_variance_img)
STORAGE_BUF(4, READ, uint, tiles_coord_buf[])
COMPUTE_SOURCE("eevee_ray_denoise_temporal_comp.glsl")
/* Metal: Provide compiler with hint to tune per-thread resource allocation. */
.mtl_max_total_threads_per_threadgroup(512)
.specialization_constant(Type::INT, "closure_index", 0)
.compute_source("eevee_ray_denoise_temporal_comp.glsl");
MTL_MAX_TOTAL_THREADS_PER_THREADGROUP(512)
SPECIALIZATION_CONSTANT(INT, closure_index, 0)
COMPUTE_SOURCE("eevee_ray_denoise_temporal_comp.glsl")
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(eevee_ray_denoise_bilateral)
.do_static_compilation(true)
.local_group_size(RAYTRACE_GROUP_SIZE, RAYTRACE_GROUP_SIZE)
.additional_info("eevee_shared")
.additional_info("eevee_gbuffer_data")
.additional_info("eevee_global_ubo")
.additional_info("eevee_sampling_data")
.additional_info("draw_view")
.sampler(1, ImageType::DEPTH_2D, "depth_tx")
.image(1, RAYTRACE_RADIANCE_FORMAT, Qualifier::READ, ImageType::FLOAT_2D, "in_radiance_img")
.image(2, RAYTRACE_RADIANCE_FORMAT, Qualifier::WRITE, ImageType::FLOAT_2D, "out_radiance_img")
.image(3, RAYTRACE_VARIANCE_FORMAT, Qualifier::READ, ImageType::FLOAT_2D, "in_variance_img")
.image(6, RAYTRACE_TILEMASK_FORMAT, Qualifier::READ, ImageType::UINT_2D_ARRAY, "tile_mask_img")
.storage_buf(4, Qualifier::READ, "uint", "tiles_coord_buf[]")
.specialization_constant(Type::INT, "closure_index", 0)
.compute_source("eevee_ray_denoise_bilateral_comp.glsl");
DO_STATIC_COMPILATION()
LOCAL_GROUP_SIZE(RAYTRACE_GROUP_SIZE, RAYTRACE_GROUP_SIZE)
ADDITIONAL_INFO(eevee_shared)
ADDITIONAL_INFO(eevee_gbuffer_data)
ADDITIONAL_INFO(eevee_global_ubo)
ADDITIONAL_INFO(eevee_sampling_data)
ADDITIONAL_INFO(draw_view)
SAMPLER(1, DEPTH_2D, depth_tx)
IMAGE(1, RAYTRACE_RADIANCE_FORMAT, READ, FLOAT_2D, in_radiance_img)
IMAGE(2, RAYTRACE_RADIANCE_FORMAT, WRITE, FLOAT_2D, out_radiance_img)
IMAGE(3, RAYTRACE_VARIANCE_FORMAT, READ, FLOAT_2D, in_variance_img)
IMAGE(6, RAYTRACE_TILEMASK_FORMAT, READ, UINT_2D_ARRAY, tile_mask_img)
STORAGE_BUF(4, READ, uint, tiles_coord_buf[])
SPECIALIZATION_CONSTANT(INT, closure_index, 0)
COMPUTE_SOURCE("eevee_ray_denoise_bilateral_comp.glsl")
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(eevee_horizon_setup)
.do_static_compilation(true)
.local_group_size(RAYTRACE_GROUP_SIZE, RAYTRACE_GROUP_SIZE)
.additional_info("eevee_shared")
.additional_info("eevee_gbuffer_data")
.additional_info("eevee_global_ubo")
.additional_info("draw_view")
.sampler(0, ImageType::DEPTH_2D, "depth_tx")
.sampler(1, ImageType::FLOAT_2D, "in_radiance_tx")
.image(2, RAYTRACE_RADIANCE_FORMAT, Qualifier::WRITE, ImageType::FLOAT_2D, "out_radiance_img")
.image(3, GPU_RGB10_A2, Qualifier::WRITE, ImageType::FLOAT_2D, "out_normal_img")
.compute_source("eevee_horizon_setup_comp.glsl");
DO_STATIC_COMPILATION()
LOCAL_GROUP_SIZE(RAYTRACE_GROUP_SIZE, RAYTRACE_GROUP_SIZE)
ADDITIONAL_INFO(eevee_shared)
ADDITIONAL_INFO(eevee_gbuffer_data)
ADDITIONAL_INFO(eevee_global_ubo)
ADDITIONAL_INFO(draw_view)
SAMPLER(0, DEPTH_2D, depth_tx)
SAMPLER(1, FLOAT_2D, in_radiance_tx)
IMAGE(2, RAYTRACE_RADIANCE_FORMAT, WRITE, FLOAT_2D, out_radiance_img)
IMAGE(3, GPU_RGB10_A2, WRITE, FLOAT_2D, out_normal_img)
COMPUTE_SOURCE("eevee_horizon_setup_comp.glsl")
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(eevee_horizon_scan)
.do_static_compilation(true)
.local_group_size(RAYTRACE_GROUP_SIZE, RAYTRACE_GROUP_SIZE)
.additional_info("eevee_shared")
.additional_info("eevee_gbuffer_data")
.additional_info("eevee_global_ubo")
.additional_info("eevee_sampling_data")
.additional_info("eevee_utility_texture")
.additional_info("eevee_hiz_data")
.additional_info("draw_view")
.specialization_constant(Type::INT, "fast_gi_slice_count", 2)
.specialization_constant(Type::INT, "fast_gi_step_count", 8)
.specialization_constant(Type::BOOL, "fast_gi_ao_only", false)
.sampler(0, ImageType::FLOAT_2D, "screen_radiance_tx")
.sampler(1, ImageType::FLOAT_2D, "screen_normal_tx")
.image(2, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "horizon_radiance_0_img")
.image(3, GPU_RGBA8, Qualifier::WRITE, ImageType::FLOAT_2D, "horizon_radiance_1_img")
.image(4, GPU_RGBA8, Qualifier::WRITE, ImageType::FLOAT_2D, "horizon_radiance_2_img")
.image(5, GPU_RGBA8, Qualifier::WRITE, ImageType::FLOAT_2D, "horizon_radiance_3_img")
.storage_buf(7, Qualifier::READ, "uint", "tiles_coord_buf[]")
DO_STATIC_COMPILATION()
LOCAL_GROUP_SIZE(RAYTRACE_GROUP_SIZE, RAYTRACE_GROUP_SIZE)
ADDITIONAL_INFO(eevee_shared)
ADDITIONAL_INFO(eevee_gbuffer_data)
ADDITIONAL_INFO(eevee_global_ubo)
ADDITIONAL_INFO(eevee_sampling_data)
ADDITIONAL_INFO(eevee_utility_texture)
ADDITIONAL_INFO(eevee_hiz_data)
ADDITIONAL_INFO(draw_view)
SPECIALIZATION_CONSTANT(INT, fast_gi_slice_count, 2)
SPECIALIZATION_CONSTANT(INT, fast_gi_step_count, 8)
SPECIALIZATION_CONSTANT(BOOL, fast_gi_ao_only, false)
SAMPLER(0, FLOAT_2D, screen_radiance_tx)
SAMPLER(1, FLOAT_2D, screen_normal_tx)
IMAGE(2, GPU_RGBA16F, WRITE, FLOAT_2D, horizon_radiance_0_img)
IMAGE(3, GPU_RGBA8, WRITE, FLOAT_2D, horizon_radiance_1_img)
IMAGE(4, GPU_RGBA8, WRITE, FLOAT_2D, horizon_radiance_2_img)
IMAGE(5, GPU_RGBA8, WRITE, FLOAT_2D, horizon_radiance_3_img)
STORAGE_BUF(7, READ, uint, tiles_coord_buf[])
/* Metal: Provide compiler with hint to tune per-thread resource allocation. */
.mtl_max_total_threads_per_threadgroup(400)
.compute_source("eevee_horizon_scan_comp.glsl");
MTL_MAX_TOTAL_THREADS_PER_THREADGROUP(400)
COMPUTE_SOURCE("eevee_horizon_scan_comp.glsl")
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(eevee_horizon_denoise)
.do_static_compilation(true)
.local_group_size(RAYTRACE_GROUP_SIZE, RAYTRACE_GROUP_SIZE)
.additional_info(
"eevee_shared", "eevee_global_ubo", "eevee_sampling_data", "eevee_hiz_data", "draw_view")
.sampler(2, ImageType::FLOAT_2D, "in_sh_0_tx")
.sampler(4, ImageType::FLOAT_2D, "in_sh_1_tx")
.sampler(5, ImageType::FLOAT_2D, "in_sh_2_tx")
.sampler(6, ImageType::FLOAT_2D, "in_sh_3_tx")
.sampler(7, ImageType::FLOAT_2D, "screen_normal_tx")
.image(2, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "out_sh_0_img")
.image(3, GPU_RGBA8, Qualifier::WRITE, ImageType::FLOAT_2D, "out_sh_1_img")
.image(4, GPU_RGBA8, Qualifier::WRITE, ImageType::FLOAT_2D, "out_sh_2_img")
.image(5, GPU_RGBA8, Qualifier::WRITE, ImageType::FLOAT_2D, "out_sh_3_img")
.storage_buf(7, Qualifier::READ, "uint", "tiles_coord_buf[]")
.compute_source("eevee_horizon_denoise_comp.glsl");
DO_STATIC_COMPILATION()
LOCAL_GROUP_SIZE(RAYTRACE_GROUP_SIZE, RAYTRACE_GROUP_SIZE)
ADDITIONAL_INFO(eevee_shared)
ADDITIONAL_INFO(eevee_global_ubo)
ADDITIONAL_INFO(eevee_sampling_data)
ADDITIONAL_INFO(eevee_hiz_data)
ADDITIONAL_INFO(draw_view)
SAMPLER(2, FLOAT_2D, in_sh_0_tx)
SAMPLER(4, FLOAT_2D, in_sh_1_tx)
SAMPLER(5, FLOAT_2D, in_sh_2_tx)
SAMPLER(6, FLOAT_2D, in_sh_3_tx)
SAMPLER(7, FLOAT_2D, screen_normal_tx)
IMAGE(2, GPU_RGBA16F, WRITE, FLOAT_2D, out_sh_0_img)
IMAGE(3, GPU_RGBA8, WRITE, FLOAT_2D, out_sh_1_img)
IMAGE(4, GPU_RGBA8, WRITE, FLOAT_2D, out_sh_2_img)
IMAGE(5, GPU_RGBA8, WRITE, FLOAT_2D, out_sh_3_img)
STORAGE_BUF(7, READ, uint, tiles_coord_buf[])
COMPUTE_SOURCE("eevee_horizon_denoise_comp.glsl")
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(eevee_horizon_resolve)
.do_static_compilation(true)
.local_group_size(RAYTRACE_GROUP_SIZE, RAYTRACE_GROUP_SIZE)
.additional_info("eevee_shared")
.additional_info("eevee_gbuffer_data")
.additional_info("eevee_global_ubo")
.additional_info("eevee_sampling_data")
.additional_info("eevee_lightprobe_data")
.additional_info("draw_view")
.sampler(1, ImageType::DEPTH_2D, "depth_tx")
.sampler(2, ImageType::FLOAT_2D, "horizon_radiance_0_tx")
.sampler(3, ImageType::FLOAT_2D, "horizon_radiance_1_tx")
.sampler(4, ImageType::FLOAT_2D, "horizon_radiance_2_tx")
.sampler(5, ImageType::FLOAT_2D, "horizon_radiance_3_tx")
.sampler(8, ImageType::FLOAT_2D, "screen_normal_tx")
.image(3, RAYTRACE_RADIANCE_FORMAT, Qualifier::READ_WRITE, ImageType::FLOAT_2D, "closure0_img")
.image(4, RAYTRACE_RADIANCE_FORMAT, Qualifier::READ_WRITE, ImageType::FLOAT_2D, "closure1_img")
.image(5, RAYTRACE_RADIANCE_FORMAT, Qualifier::READ_WRITE, ImageType::FLOAT_2D, "closure2_img")
.storage_buf(7, Qualifier::READ, "uint", "tiles_coord_buf[]")
DO_STATIC_COMPILATION()
LOCAL_GROUP_SIZE(RAYTRACE_GROUP_SIZE, RAYTRACE_GROUP_SIZE)
ADDITIONAL_INFO(eevee_shared)
ADDITIONAL_INFO(eevee_gbuffer_data)
ADDITIONAL_INFO(eevee_global_ubo)
ADDITIONAL_INFO(eevee_sampling_data)
ADDITIONAL_INFO(eevee_lightprobe_data)
ADDITIONAL_INFO(draw_view)
SAMPLER(1, DEPTH_2D, depth_tx)
SAMPLER(2, FLOAT_2D, horizon_radiance_0_tx)
SAMPLER(3, FLOAT_2D, horizon_radiance_1_tx)
SAMPLER(4, FLOAT_2D, horizon_radiance_2_tx)
SAMPLER(5, FLOAT_2D, horizon_radiance_3_tx)
SAMPLER(8, FLOAT_2D, screen_normal_tx)
IMAGE(3, RAYTRACE_RADIANCE_FORMAT, READ_WRITE, FLOAT_2D, closure0_img)
IMAGE(4, RAYTRACE_RADIANCE_FORMAT, READ_WRITE, FLOAT_2D, closure1_img)
IMAGE(5, RAYTRACE_RADIANCE_FORMAT, READ_WRITE, FLOAT_2D, closure2_img)
STORAGE_BUF(7, READ, uint, tiles_coord_buf[])
/* Metal: Provide compiler with hint to tune per-thread resource allocation. */
.mtl_max_total_threads_per_threadgroup(400)
.compute_source("eevee_horizon_resolve_comp.glsl");
MTL_MAX_TOTAL_THREADS_PER_THREADGROUP(400)
COMPUTE_SOURCE("eevee_horizon_resolve_comp.glsl")
GPU_SHADER_CREATE_END()
#undef image_out
#undef image_in

View File

@ -15,37 +15,38 @@
/* Pass world space deltas to the fragment shader.
* This is to make sure that the resulting motion vectors are valid even with displacement. */
GPU_SHADER_NAMED_INTERFACE_INFO(eevee_velocity_surface_iface, motion)
.smooth(Type::VEC3, "prev")
.smooth(Type::VEC3, "next");
SMOOTH(VEC3, prev)
SMOOTH(VEC3, next)
GPU_SHADER_NAMED_INTERFACE_END(motion)
GPU_SHADER_CREATE_INFO(eevee_velocity_camera)
.define("VELOCITY_CAMERA")
.uniform_buf(VELOCITY_CAMERA_PREV_BUF, "CameraData", "camera_prev")
.uniform_buf(VELOCITY_CAMERA_CURR_BUF, "CameraData", "camera_curr")
.uniform_buf(VELOCITY_CAMERA_NEXT_BUF, "CameraData", "camera_next");
DEFINE("VELOCITY_CAMERA")
UNIFORM_BUF(VELOCITY_CAMERA_PREV_BUF, CameraData, camera_prev)
UNIFORM_BUF(VELOCITY_CAMERA_CURR_BUF, CameraData, camera_curr)
UNIFORM_BUF(VELOCITY_CAMERA_NEXT_BUF, CameraData, camera_next)
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(eevee_velocity_geom)
.define("MAT_VELOCITY")
.storage_buf(VELOCITY_OBJ_PREV_BUF_SLOT, Qualifier::READ, "mat4", "velocity_obj_prev_buf[]")
.storage_buf(VELOCITY_OBJ_NEXT_BUF_SLOT, Qualifier::READ, "mat4", "velocity_obj_next_buf[]")
.storage_buf(VELOCITY_GEO_PREV_BUF_SLOT, Qualifier::READ, "vec4", "velocity_geo_prev_buf[]")
.storage_buf(VELOCITY_GEO_NEXT_BUF_SLOT, Qualifier::READ, "vec4", "velocity_geo_next_buf[]")
.storage_buf(VELOCITY_INDIRECTION_BUF_SLOT,
Qualifier::READ,
"VelocityIndex",
"velocity_indirection_buf[]")
.vertex_out(eevee_velocity_surface_iface)
.fragment_out(0, Type::VEC4, "out_velocity")
.additional_info("eevee_velocity_camera");
DEFINE("MAT_VELOCITY")
STORAGE_BUF(VELOCITY_OBJ_PREV_BUF_SLOT, READ, mat4, velocity_obj_prev_buf[])
STORAGE_BUF(VELOCITY_OBJ_NEXT_BUF_SLOT, READ, mat4, velocity_obj_next_buf[])
STORAGE_BUF(VELOCITY_GEO_PREV_BUF_SLOT, READ, vec4, velocity_geo_prev_buf[])
STORAGE_BUF(VELOCITY_GEO_NEXT_BUF_SLOT, READ, vec4, velocity_geo_next_buf[])
STORAGE_BUF(VELOCITY_INDIRECTION_BUF_SLOT, READ, VelocityIndex, velocity_indirection_buf[])
VERTEX_OUT(eevee_velocity_surface_iface)
FRAGMENT_OUT(0, VEC4, out_velocity)
ADDITIONAL_INFO(eevee_velocity_camera)
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(eevee_vertex_copy)
.compute_source("eevee_vertex_copy_comp.glsl")
.local_group_size(VERTEX_COPY_GROUP_SIZE)
.storage_buf(0, Qualifier::READ, "float", "in_buf[]")
.storage_buf(1, Qualifier::WRITE, "vec4", "out_buf[]")
.push_constant(Type::INT, "start_offset")
.push_constant(Type::INT, "vertex_stride")
.push_constant(Type::INT, "vertex_count")
.do_static_compilation(true);
COMPUTE_SOURCE("eevee_vertex_copy_comp.glsl")
LOCAL_GROUP_SIZE(VERTEX_COPY_GROUP_SIZE)
STORAGE_BUF(0, READ, float, in_buf[])
STORAGE_BUF(1, WRITE, vec4, out_buf[])
PUSH_CONSTANT(INT, start_offset)
PUSH_CONSTANT(INT, vertex_stride)
PUSH_CONSTANT(INT, vertex_count)
DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()
/** \} */

View File

@ -8,106 +8,88 @@
/* Used for shaders that need the final accumulated volume transmittance and scattering. */
GPU_SHADER_CREATE_INFO(eevee_volume_lib)
.additional_info("eevee_shared")
.additional_info("eevee_global_ubo")
.additional_info("draw_view")
.sampler(VOLUME_SCATTERING_TEX_SLOT, ImageType::FLOAT_3D, "volume_scattering_tx")
.sampler(VOLUME_TRANSMITTANCE_TEX_SLOT, ImageType::FLOAT_3D, "volume_transmittance_tx");
ADDITIONAL_INFO(eevee_shared)
ADDITIONAL_INFO(eevee_global_ubo)
ADDITIONAL_INFO(draw_view)
SAMPLER(VOLUME_SCATTERING_TEX_SLOT, FLOAT_3D, volume_scattering_tx)
SAMPLER(VOLUME_TRANSMITTANCE_TEX_SLOT, FLOAT_3D, volume_transmittance_tx)
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(eevee_volume_properties_data)
.additional_info("eevee_global_ubo")
.image(VOLUME_PROP_SCATTERING_IMG_SLOT,
GPU_R11F_G11F_B10F,
Qualifier::READ,
ImageType::FLOAT_3D,
"in_scattering_img")
.image(VOLUME_PROP_EXTINCTION_IMG_SLOT,
GPU_R11F_G11F_B10F,
Qualifier::READ,
ImageType::FLOAT_3D,
"in_extinction_img")
.image(VOLUME_PROP_EMISSION_IMG_SLOT,
GPU_R11F_G11F_B10F,
Qualifier::READ,
ImageType::FLOAT_3D,
"in_emission_img")
.image(
VOLUME_PROP_PHASE_IMG_SLOT, GPU_R16F, Qualifier::READ, ImageType::FLOAT_3D, "in_phase_img")
.image(VOLUME_PROP_PHASE_WEIGHT_IMG_SLOT,
GPU_R16F,
Qualifier::READ,
ImageType::FLOAT_3D,
"in_phase_weight_img");
ADDITIONAL_INFO(eevee_global_ubo)
IMAGE(VOLUME_PROP_SCATTERING_IMG_SLOT, GPU_R11F_G11F_B10F, READ, FLOAT_3D, in_scattering_img)
IMAGE(VOLUME_PROP_EXTINCTION_IMG_SLOT, GPU_R11F_G11F_B10F, READ, FLOAT_3D, in_extinction_img)
IMAGE(VOLUME_PROP_EMISSION_IMG_SLOT, GPU_R11F_G11F_B10F, READ, FLOAT_3D, in_emission_img)
IMAGE(VOLUME_PROP_PHASE_IMG_SLOT, GPU_R16F, READ, FLOAT_3D, in_phase_img)
IMAGE(VOLUME_PROP_PHASE_WEIGHT_IMG_SLOT, GPU_R16F, READ, FLOAT_3D, in_phase_weight_img)
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(eevee_volume_scatter)
.local_group_size(VOLUME_GROUP_SIZE, VOLUME_GROUP_SIZE, VOLUME_GROUP_SIZE)
.additional_info("eevee_shared")
.additional_info("eevee_global_ubo")
.additional_info("draw_resource_id_varying")
.additional_info("draw_view")
.additional_info("eevee_light_data")
.additional_info("eevee_lightprobe_data")
.additional_info("eevee_shadow_data")
.additional_info("eevee_sampling_data")
.additional_info("eevee_utility_texture")
.additional_info("eevee_volume_properties_data")
.sampler(0, ImageType::FLOAT_3D, "scattering_history_tx")
.sampler(1, ImageType::FLOAT_3D, "extinction_history_tx")
.image(5, GPU_R11F_G11F_B10F, Qualifier::WRITE, ImageType::FLOAT_3D, "out_scattering_img")
.image(6, GPU_R11F_G11F_B10F, Qualifier::WRITE, ImageType::FLOAT_3D, "out_extinction_img")
.compute_source("eevee_volume_scatter_comp.glsl")
.do_static_compilation(true);
LOCAL_GROUP_SIZE(VOLUME_GROUP_SIZE, VOLUME_GROUP_SIZE, VOLUME_GROUP_SIZE)
ADDITIONAL_INFO(eevee_shared)
ADDITIONAL_INFO(eevee_global_ubo)
ADDITIONAL_INFO(draw_resource_id_varying)
ADDITIONAL_INFO(draw_view)
ADDITIONAL_INFO(eevee_light_data)
ADDITIONAL_INFO(eevee_lightprobe_data)
ADDITIONAL_INFO(eevee_shadow_data)
ADDITIONAL_INFO(eevee_sampling_data)
ADDITIONAL_INFO(eevee_utility_texture)
ADDITIONAL_INFO(eevee_volume_properties_data)
SAMPLER(0, FLOAT_3D, scattering_history_tx)
SAMPLER(1, FLOAT_3D, extinction_history_tx)
IMAGE(5, GPU_R11F_G11F_B10F, WRITE, FLOAT_3D, out_scattering_img)
IMAGE(6, GPU_R11F_G11F_B10F, WRITE, FLOAT_3D, out_extinction_img)
COMPUTE_SOURCE("eevee_volume_scatter_comp.glsl")
DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(eevee_volume_scatter_with_lights)
.additional_info("eevee_volume_scatter")
.define("VOLUME_LIGHTING")
.define("VOLUME_IRRADIANCE")
.define("VOLUME_SHADOW")
.sampler(9, ImageType::FLOAT_3D, "extinction_tx")
.do_static_compilation(true);
ADDITIONAL_INFO(eevee_volume_scatter)
DEFINE("VOLUME_LIGHTING")
DEFINE("VOLUME_IRRADIANCE")
DEFINE("VOLUME_SHADOW")
SAMPLER(9, FLOAT_3D, extinction_tx)
DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(eevee_volume_occupancy_convert)
.additional_info("eevee_shared")
.additional_info("eevee_global_ubo")
.additional_info("draw_fullscreen")
.builtins(BuiltinBits::TEXTURE_ATOMIC)
.image(VOLUME_HIT_DEPTH_SLOT, GPU_R32F, Qualifier::READ, ImageType::FLOAT_3D, "hit_depth_img")
.image(VOLUME_HIT_COUNT_SLOT,
GPU_R32UI,
Qualifier::READ_WRITE,
ImageType::UINT_2D,
"hit_count_img")
.image(VOLUME_OCCUPANCY_SLOT,
GPU_R32UI,
Qualifier::READ_WRITE,
ImageType::UINT_3D_ATOMIC,
"occupancy_img")
.fragment_source("eevee_occupancy_convert_frag.glsl")
.do_static_compilation(true);
ADDITIONAL_INFO(eevee_shared)
ADDITIONAL_INFO(eevee_global_ubo)
ADDITIONAL_INFO(draw_fullscreen)
BUILTINS(BuiltinBits::TEXTURE_ATOMIC)
IMAGE(VOLUME_HIT_DEPTH_SLOT, GPU_R32F, READ, FLOAT_3D, hit_depth_img)
IMAGE(VOLUME_HIT_COUNT_SLOT, GPU_R32UI, READ_WRITE, UINT_2D, hit_count_img)
IMAGE(VOLUME_OCCUPANCY_SLOT, GPU_R32UI, READ_WRITE, UINT_3D_ATOMIC, occupancy_img)
FRAGMENT_SOURCE("eevee_occupancy_convert_frag.glsl")
DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(eevee_volume_integration)
.additional_info("eevee_shared")
.additional_info("eevee_global_ubo")
.additional_info("draw_view")
.additional_info("eevee_sampling_data")
.compute_source("eevee_volume_integration_comp.glsl")
.local_group_size(VOLUME_INTEGRATION_GROUP_SIZE, VOLUME_INTEGRATION_GROUP_SIZE, 1)
ADDITIONAL_INFO(eevee_shared)
ADDITIONAL_INFO(eevee_global_ubo)
ADDITIONAL_INFO(draw_view)
ADDITIONAL_INFO(eevee_sampling_data)
COMPUTE_SOURCE("eevee_volume_integration_comp.glsl")
LOCAL_GROUP_SIZE(VOLUME_INTEGRATION_GROUP_SIZE, VOLUME_INTEGRATION_GROUP_SIZE, 1)
/* Inputs. */
.sampler(0, ImageType::FLOAT_3D, "in_scattering_tx")
.sampler(1, ImageType::FLOAT_3D, "in_extinction_tx")
SAMPLER(0, FLOAT_3D, in_scattering_tx)
SAMPLER(1, FLOAT_3D, in_extinction_tx)
/* Outputs. */
.image(0, GPU_R11F_G11F_B10F, Qualifier::WRITE, ImageType::FLOAT_3D, "out_scattering_img")
.image(1, GPU_R11F_G11F_B10F, Qualifier::WRITE, ImageType::FLOAT_3D, "out_transmittance_img")
.do_static_compilation(true);
IMAGE(0, GPU_R11F_G11F_B10F, WRITE, FLOAT_3D, out_scattering_img)
IMAGE(1, GPU_R11F_G11F_B10F, WRITE, FLOAT_3D, out_transmittance_img)
DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()
GPU_SHADER_CREATE_INFO(eevee_volume_resolve)
.additional_info("eevee_shared")
.additional_info("eevee_volume_lib")
.additional_info("draw_fullscreen")
.additional_info("eevee_render_pass_out")
.additional_info("eevee_hiz_data")
.fragment_source("eevee_volume_resolve_frag.glsl")
.fragment_out(0, Type::VEC4, "out_radiance", DualBlend::SRC_0)
.fragment_out(0, Type::VEC4, "out_transmittance", DualBlend::SRC_1)
ADDITIONAL_INFO(eevee_shared)
ADDITIONAL_INFO(eevee_volume_lib)
ADDITIONAL_INFO(draw_fullscreen)
ADDITIONAL_INFO(eevee_render_pass_out)
ADDITIONAL_INFO(eevee_hiz_data)
FRAGMENT_SOURCE("eevee_volume_resolve_frag.glsl")
FRAGMENT_OUT_DUAL(0, VEC4, out_radiance, SRC_0)
FRAGMENT_OUT_DUAL(0, VEC4, out_transmittance, SRC_1)
/** TODO(Miguel Pozo): Volume RenderPasses. */
.do_static_compilation(true);
DO_STATIC_COMPILATION()
GPU_SHADER_CREATE_END()