46 const SceneEEVEE &sce_eevee = inst_.scene->eevee;
47 const Object *camera_object_eval = inst_.camera_eval_object;
50 camera_object_eval->
data) :
56 if (enabled_ ==
false) {
58 data_.scatter_color_threshold = -1.0f;
62 int sce_flag = sce_eevee.
flag;
68 data_.bokeh_blades =
float(
camera->dof.aperture_blades);
74 const Object *camera_object_eval = inst_.camera_eval_object;
78 camera_object_eval->
data) :
84 "Debug Mode: Depth Of Field Buffers\n"
85 " - Purple: Gap Fill\n"
86 " - Blue: Background\n"
87 " - Red: Slight Out Of Focus\n"
88 " - Yellow: In Focus\n"
89 " - Green: Foreground\n");
92 if (enabled_ ==
false) {
93 jitter_radius_ = 0.0f;
98 float2 anisotropic_scale = {
clamp_f(1.0f / camera_data->dof.aperture_ratio, 1e-5f, 1.0f),
99 clamp_f(camera_data->dof.aperture_ratio, 1e-5f, 1.0f)};
100 data_.bokeh_anisotropic_scale = anisotropic_scale;
101 data_.bokeh_rotation = camera_data->dof.aperture_rotation;
103 data_.bokeh_anisotropic_scale_inv = 1.0f / data_.bokeh_anisotropic_scale;
105 float fstop =
max_ff(camera_data->dof.aperture_fstop, 1e-5f);
107 float aperture = 1.0f / (2.0f * fstop);
108 if (
camera.is_perspective()) {
109 aperture *= camera_data->lens * 1e-3f;
112 if (
camera.is_orthographic()) {
117 if (camera_data->dof.aperture_ratio < 1.0) {
120 aperture /=
max_ff(camera_data->dof.aperture_ratio, 1e-5f);
123 float jitter_radius, fx_radius;
126 if (do_jitter_ && (inst_.sampling.dof_ring_count_get() > 0) && !
camera.is_panoramic() &&
127 !inst_.is_viewport())
132 float minimal_overblur = 1.0f /
sqrtf(inst_.sampling.dof_sample_count_get());
134 fx_radius = (minimal_overblur + user_overblur_) * aperture;
136 jitter_radius =
max_ff(0.0f, aperture - fx_radius);
139 jitter_radius = 0.0f;
140 fx_radius = aperture;
144 if (fx_max_coc_ <= 0.5f) {
148 jitter_radius_ = jitter_radius;
149 fx_radius_ = fx_radius;
151 if (fx_radius_ == 0.0f) {
155 int2 max_render_res = inst_.film.render_extent_get();
159 data_.gather_uv_fac = 1.0f /
float2(reduce_size);
163 data_.scatter_max_rect = (reduce_size.x * reduce_size.y / 4) / 2;
164 scatter_fg_list_buf_.resize(data_.scatter_max_rect);
165 scatter_bg_list_buf_.resize(data_.scatter_max_rect);
167 bokeh_lut_pass_sync();
169 stabilize_pass_sync();
170 downsample_pass_sync();
172 tiles_flatten_pass_sync();
173 tiles_dilate_pass_sync();
177 hole_fill_pass_sync();
183 if (jitter_radius_ == 0.0f) {
188 inst_.sampling.dof_disk_sample_get(&radius, &theta);
190 if (data_.bokeh_blades >= 3.0f) {
191 theta = circle_to_polygon_angle(data_.bokeh_blades, theta);
192 radius *= circle_to_polygon_radius(data_.bokeh_blades, theta);
194 radius *= jitter_radius_;
195 theta += data_.bokeh_rotation;
199 sample *= data_.bokeh_anisotropic_scale;
206 const bool is_ortho = (winmat[2][3] != -1.0f);
208 sample *= focus_distance_;
222void DepthOfField::bokeh_lut_pass_sync()
227 use_bokeh_lut_ =
false;
230 use_bokeh_lut_ =
true;
233 bokeh_lut_ps_.
init();
235 bokeh_lut_ps_.
bind_ubo(
"dof_buf", data_);
236 bokeh_lut_ps_.
bind_image(
"out_gather_lut_img", &bokeh_gather_lut_tx_);
237 bokeh_lut_ps_.
bind_image(
"out_scatter_lut_img", &bokeh_scatter_lut_tx_);
238 bokeh_lut_ps_.
bind_image(
"out_resolve_lut_img", &bokeh_resolve_lut_tx_);
242void DepthOfField::setup_pass_sync()
248 setup_ps_.
bind_texture(
"color_tx", &input_color_tx_, no_filter);
249 setup_ps_.
bind_texture(
"depth_tx", &render_buffers.depth_tx, no_filter);
250 setup_ps_.
bind_ubo(
"dof_buf", data_);
251 setup_ps_.
bind_image(
"out_color_img", &setup_color_tx_);
252 setup_ps_.
bind_image(
"out_coc_img", &setup_coc_tx_);
253 setup_ps_.
dispatch(&dispatch_setup_size_);
257void DepthOfField::stabilize_pass_sync()
259 RenderBuffers &render_buffers = inst_.render_buffers;
260 VelocityModule &
velocity = inst_.velocity;
262 stabilize_ps_.init();
263 stabilize_ps_.shader_set(inst_.shaders.static_shader_get(
DOF_STABILIZE));
268 stabilize_ps_.bind_texture(
"coc_tx", &setup_coc_tx_, no_filter);
269 stabilize_ps_.bind_texture(
"color_tx", &setup_color_tx_, no_filter);
270 stabilize_ps_.bind_texture(
"velocity_tx", &render_buffers.vector_tx, no_filter);
271 stabilize_ps_.bind_texture(
"in_history_tx", &stabilize_input_, with_filter);
272 stabilize_ps_.bind_texture(
"depth_tx", &render_buffers.depth_tx, no_filter);
273 stabilize_ps_.bind_ubo(
"dof_buf", data_);
274 stabilize_ps_.push_constant(
"u_use_history", &stabilize_valid_history_, 1);
275 stabilize_ps_.bind_image(
"out_coc_img", &reduced_coc_mip_views_[0]);
276 stabilize_ps_.bind_image(
"out_color_img", &reduced_color_mip_views_[0]);
277 stabilize_ps_.bind_image(
"out_history_img", &stabilize_output_tx_);
278 stabilize_ps_.dispatch(&dispatch_stabilize_size_);
282void DepthOfField::downsample_pass_sync()
284 downsample_ps_.init();
285 downsample_ps_.shader_set(inst_.shaders.static_shader_get(
DOF_DOWNSAMPLE));
286 downsample_ps_.bind_texture(
"color_tx", &reduced_color_mip_views_[0], no_filter);
287 downsample_ps_.bind_texture(
"coc_tx", &reduced_coc_mip_views_[0], no_filter);
288 downsample_ps_.bind_image(
"out_color_img", &downsample_tx_);
289 downsample_ps_.dispatch(&dispatch_downsample_size_);
293void DepthOfField::reduce_pass_sync()
296 reduce_ps_.shader_set(inst_.shaders.static_shader_get(
DOF_REDUCE));
297 reduce_ps_.bind_ubo(
"dof_buf", data_);
298 reduce_ps_.bind_texture(
"downsample_tx", &downsample_tx_, no_filter);
299 reduce_ps_.bind_ssbo(
"scatter_fg_list_buf", scatter_fg_list_buf_);
300 reduce_ps_.bind_ssbo(
"scatter_bg_list_buf", scatter_bg_list_buf_);
301 reduce_ps_.bind_ssbo(
"scatter_fg_indirect_buf", scatter_fg_indirect_buf_);
302 reduce_ps_.bind_ssbo(
"scatter_bg_indirect_buf", scatter_bg_indirect_buf_);
303 reduce_ps_.bind_image(
"inout_color_lod0_img", &reduced_color_mip_views_[0]);
304 reduce_ps_.bind_image(
"out_color_lod1_img", &reduced_color_mip_views_[1]);
305 reduce_ps_.bind_image(
"out_color_lod2_img", &reduced_color_mip_views_[2]);
306 reduce_ps_.bind_image(
"out_color_lod3_img", &reduced_color_mip_views_[3]);
307 reduce_ps_.bind_image(
"in_coc_lod0_img", &reduced_coc_mip_views_[0]);
308 reduce_ps_.bind_image(
"out_coc_lod1_img", &reduced_coc_mip_views_[1]);
309 reduce_ps_.bind_image(
"out_coc_lod2_img", &reduced_coc_mip_views_[2]);
310 reduce_ps_.bind_image(
"out_coc_lod3_img", &reduced_coc_mip_views_[3]);
311 reduce_ps_.dispatch(&dispatch_reduce_size_);
316void DepthOfField::tiles_flatten_pass_sync()
318 tiles_flatten_ps_.init();
319 tiles_flatten_ps_.shader_set(inst_.shaders.static_shader_get(
DOF_TILES_FLATTEN));
323 tiles_flatten_ps_.bind_texture(
"coc_tx", &setup_coc_tx_, no_filter);
324 tiles_flatten_ps_.bind_image(
"out_tiles_fg_img", &tiles_fg_tx_.current());
325 tiles_flatten_ps_.bind_image(
"out_tiles_bg_img", &tiles_bg_tx_.current());
326 tiles_flatten_ps_.dispatch(&dispatch_tiles_flatten_size_);
330void DepthOfField::tiles_dilate_pass_sync()
332 for (
int pass = 0; pass < 2; pass++) {
333 PassSimple &drw_pass = (pass == 0) ? tiles_dilate_minmax_ps_ : tiles_dilate_minabs_ps_;
336 drw_pass.shader_set(inst_.shaders.static_shader_get(sh_type));
337 drw_pass.bind_image(
"in_tiles_fg_img", &tiles_fg_tx_.previous());
338 drw_pass.bind_image(
"in_tiles_bg_img", &tiles_bg_tx_.previous());
339 drw_pass.bind_image(
"out_tiles_fg_img", &tiles_fg_tx_.current());
340 drw_pass.bind_image(
"out_tiles_bg_img", &tiles_bg_tx_.current());
341 drw_pass.push_constant(
"ring_count", &tiles_dilate_ring_count_, 1);
342 drw_pass.push_constant(
"ring_width_multiplier", &tiles_dilate_ring_width_mul_, 1);
343 drw_pass.dispatch(&dispatch_tiles_dilate_size_);
348void DepthOfField::gather_pass_sync()
354 for (
int pass = 0; pass < 2; pass++) {
355 PassSimple &drw_pass = (pass == 0) ? gather_fg_ps_ : gather_bg_ps_;
356 SwapChain<TextureFromPool, 2> &color_chain = (pass == 0) ? color_fg_tx_ : color_bg_tx_;
357 SwapChain<TextureFromPool, 2> &weight_chain = (pass == 0) ? weight_fg_tx_ : weight_bg_tx_;
363 drw_pass.bind_resources(inst_.sampling);
364 drw_pass.shader_set(inst_.shaders.static_shader_get(sh_type));
365 drw_pass.bind_ubo(
"dof_buf", data_);
366 drw_pass.bind_texture(
"color_bilinear_tx", &reduced_color_tx_, gather_bilinear);
367 drw_pass.bind_texture(
"color_tx", &reduced_color_tx_, gather_nearest);
368 drw_pass.bind_texture(
"coc_tx", &reduced_coc_tx_, gather_nearest);
369 drw_pass.bind_image(
"in_tiles_fg_img", &tiles_fg_tx_.current());
370 drw_pass.bind_image(
"in_tiles_bg_img", &tiles_bg_tx_.current());
371 drw_pass.bind_image(
"out_color_img", &color_chain.current());
372 drw_pass.bind_image(
"out_weight_img", &weight_chain.current());
373 drw_pass.bind_image(
"out_occlusion_img", &occlusion_tx_);
374 drw_pass.bind_texture(
"bokeh_lut_tx", &bokeh_gather_lut_tx_);
375 drw_pass.dispatch(&dispatch_gather_size_);
380void DepthOfField::filter_pass_sync()
382 for (
int pass = 0; pass < 2; pass++) {
383 PassSimple &drw_pass = (pass == 0) ? filter_fg_ps_ : filter_bg_ps_;
384 SwapChain<TextureFromPool, 2> &color_chain = (pass == 0) ? color_fg_tx_ : color_bg_tx_;
385 SwapChain<TextureFromPool, 2> &weight_chain = (pass == 0) ? weight_fg_tx_ : weight_bg_tx_;
387 drw_pass.shader_set(inst_.shaders.static_shader_get(
DOF_FILTER));
388 drw_pass.bind_texture(
"color_tx", &color_chain.previous());
389 drw_pass.bind_texture(
"weight_tx", &weight_chain.previous());
390 drw_pass.bind_image(
"out_color_img", &color_chain.current());
391 drw_pass.bind_image(
"out_weight_img", &weight_chain.current());
392 drw_pass.dispatch(&dispatch_filter_size_);
397void DepthOfField::scatter_pass_sync()
399 for (
int pass = 0; pass < 2; pass++) {
400 PassSimple &drw_pass = (pass == 0) ? scatter_fg_ps_ : scatter_bg_ps_;
403 drw_pass.shader_set(inst_.shaders.static_shader_get(
DOF_SCATTER));
404 drw_pass.bind_ubo(
"dof_buf", data_);
405 drw_pass.push_constant(
"use_bokeh_lut", use_bokeh_lut_);
406 drw_pass.bind_texture(
"bokeh_lut_tx", &bokeh_scatter_lut_tx_);
407 drw_pass.bind_texture(
"occlusion_tx", &occlusion_tx_);
409 drw_pass.bind_ssbo(
"scatter_list_buf", scatter_fg_list_buf_);
415 drw_pass.bind_ssbo(
"scatter_list_buf", scatter_bg_list_buf_);
421void DepthOfField::hole_fill_pass_sync()
427 hole_fill_ps_.init();
428 hole_fill_ps_.bind_resources(inst_.sampling);
430 hole_fill_ps_.bind_ubo(
"dof_buf", data_);
431 hole_fill_ps_.bind_texture(
"color_bilinear_tx", &reduced_color_tx_, gather_bilinear);
432 hole_fill_ps_.bind_texture(
"color_tx", &reduced_color_tx_, gather_nearest);
433 hole_fill_ps_.bind_texture(
"coc_tx", &reduced_coc_tx_, gather_nearest);
434 hole_fill_ps_.bind_image(
"in_tiles_fg_img", &tiles_fg_tx_.current());
435 hole_fill_ps_.bind_image(
"in_tiles_bg_img", &tiles_bg_tx_.current());
436 hole_fill_ps_.bind_image(
"out_color_img", &hole_fill_color_tx_);
437 hole_fill_ps_.bind_image(
"out_weight_img", &hole_fill_weight_tx_);
438 hole_fill_ps_.dispatch(&dispatch_gather_size_);
442void DepthOfField::resolve_pass_sync()
445 RenderBuffers &render_buffers = inst_.render_buffers;
446 gpu::Shader *sh = inst_.shaders.static_shader_get(use_bokeh_lut_ ?
DOF_RESOLVE_LUT :
450 resolve_ps_.specialize_constant(sh,
"do_debug_color", inst_.debug_mode ==
DEBUG_DOF_PLANES);
451 resolve_ps_.shader_set(sh);
452 resolve_ps_.bind_ubo(
"dof_buf", data_);
453 resolve_ps_.bind_texture(
"depth_tx", &render_buffers.depth_tx, no_filter);
454 resolve_ps_.bind_texture(
"color_tx", &input_color_tx_, no_filter);
455 resolve_ps_.bind_texture(
"stable_color_tx", &resolve_stable_color_tx_, no_filter);
456 resolve_ps_.bind_texture(
"color_bg_tx", &color_bg_tx_.current(), with_filter);
457 resolve_ps_.bind_texture(
"color_fg_tx", &color_fg_tx_.current(), with_filter);
458 resolve_ps_.bind_image(
"in_tiles_fg_img", &tiles_fg_tx_.current());
459 resolve_ps_.bind_image(
"in_tiles_bg_img", &tiles_bg_tx_.current());
460 resolve_ps_.bind_texture(
"weight_bg_tx", &weight_bg_tx_.current());
461 resolve_ps_.bind_texture(
"weight_fg_tx", &weight_fg_tx_.current());
462 resolve_ps_.bind_texture(
"color_hole_fill_tx", &hole_fill_color_tx_);
463 resolve_ps_.bind_texture(
"weight_hole_fill_tx", &hole_fill_weight_tx_);
464 resolve_ps_.bind_texture(
"bokeh_lut_tx", &bokeh_resolve_lut_tx_);
465 resolve_ps_.bind_image(
"out_color_img", &output_color_tx_);
466 resolve_ps_.bind_resources(inst_.sampling);
468 resolve_ps_.dispatch(&dispatch_resolve_size_);
478void DepthOfField::update_sample_table()
480 float2 subpixel_offset = inst_.film.pixel_jitter_get();
482 subpixel_offset *= 0.5;
485 const std::array<int2, 4> plus_offsets = {
int2(-1, 0),
int2(0, -1),
int2(1, 0),
int2(0, 1)};
487 const float radius = 1.5f;
489 for (
int2 offset : plus_offsets) {
501 if (fx_radius_ == 0.0f) {
505 input_color_tx_ = *input_tx;
506 output_color_tx_ = *output_tx;
510 const CameraData &cam_data = inst_.camera.data_get();
511 data_.camera_type = cam_data.
type;
513 float3 jitter =
float3(fx_radius_, 0.0f, -focus_distance_);
518 if (inst_.camera.is_orthographic()) {
519 data_.coc_mul = (center[0] - jitter[0]) * 0.5f * extent_[0];
520 data_.coc_bias = focus_distance_ * data_.coc_mul;
523 data_.coc_bias = -(center[0] - jitter[0]) * 0.5f * extent_[0];
524 data_.coc_mul = focus_distance_ * data_.coc_bias;
527 float min_fg_coc = coc_radius_from_camera_depth(data_, -cam_data.
clip_near);
528 float max_bg_coc = coc_radius_from_camera_depth(data_, -cam_data.
clip_far);
532 max_bg_coc = data_.coc_bias;
537 data_.scatter_coc_threshold = 4.0f;
539 update_sample_table();
546 int2 max_render_res = inst_.film.render_extent_get();
554 reduced_color_tx_.acquire_2d(
555 reduce_size, gpu::TextureFormat::SFLOAT_16_16_16_16, usage, DOF_MIP_COUNT);
556 reduced_coc_tx_.acquire_2d(reduce_size, gpu::TextureFormat::SFLOAT_16, usage, DOF_MIP_COUNT);
559 reduced_color_tx_.ensure_mip_views();
560 reduced_coc_tx_.ensure_mip_views();
561 for (
int i = 0; i < DOF_MIP_COUNT; ++i) {
562 reduced_color_mip_views_[i] = reduced_color_tx_.mip_view(i);
563 reduced_coc_mip_views_[i] = reduced_coc_tx_.mip_view(i);
577 dispatch_tiles_dilate_size_ =
int3(
600 bokeh_gather_lut_tx_.acquire_2d(
int2(DOF_BOKEH_LUT_SIZE), gpu::TextureFormat::SFLOAT_16_16);
601 bokeh_scatter_lut_tx_.acquire_2d(
int2(DOF_BOKEH_LUT_SIZE), gpu::TextureFormat::SFLOAT_16);
602 bokeh_resolve_lut_tx_.acquire_2d(
int2(DOF_MAX_SLIGHT_FOCUS_RADIUS * 2 + 1),
603 gpu::TextureFormat::SFLOAT_16);
605 if (use_bokeh_lut_) {
606 drw.
submit(bokeh_lut_ps_, view);
610 setup_color_tx_.acquire_2d(
611 half_res, gpu::TextureFormat::SFLOAT_16_16_16_16, usage_readwrite);
612 setup_coc_tx_.acquire_2d(half_res, gpu::TextureFormat::SFLOAT_16);
614 drw.
submit(setup_ps_, view);
617 stabilize_output_tx_.acquire_2d(half_res, gpu::TextureFormat::SFLOAT_16_16_16_16);
619 half_res, gpu::TextureFormat::SFLOAT_16_16_16_16);
621 if (stabilize_valid_history_ ==
false) {
628 drw.
submit(stabilize_ps_, view);
635 stabilize_output_tx_.release();
636 setup_color_tx_.release();
642 tiles_fg_tx_.previous().acquire_2d(
643 tile_res, gpu::TextureFormat::UFLOAT_11_11_10, usage_readwrite);
644 tiles_bg_tx_.previous().acquire_2d(
645 tile_res, gpu::TextureFormat::UFLOAT_11_11_10, usage_readwrite);
646 tiles_fg_tx_.current().acquire_2d(
647 tile_res, gpu::TextureFormat::UFLOAT_11_11_10, usage_readwrite);
648 tiles_bg_tx_.current().acquire_2d(
649 tile_res, gpu::TextureFormat::UFLOAT_11_11_10, usage_readwrite);
651 drw.
submit(tiles_flatten_ps_, view);
654 setup_coc_tx_.release();
657 const float error_multiplier = 1.0f + 1.0f / (DOF_GATHER_RING_COUNT + 0.5f);
658 int dilation_end_radius =
ceilf((fx_max_coc_ * error_multiplier) / (DOF_TILES_SIZE * 2));
661 for (
int pass = 0; pass < 2; pass++) {
663 int dilation_radius = 0;
664 while (dilation_radius < dilation_end_radius) {
665 int remainder = dilation_end_radius - dilation_radius;
667 int max_multiplier = dilation_radius + 1;
669 int ring_count =
min_ii(DOF_DILATE_RING_COUNT,
ceilf(remainder /
float(max_multiplier)));
670 int multiplier =
min_ii(max_multiplier,
floorf(remainder /
float(ring_count)));
672 dilation_radius += ring_count * multiplier;
674 tiles_dilate_ring_count_ = ring_count;
675 tiles_dilate_ring_width_mul_ = multiplier;
680 drw.
submit((pass == 0) ? tiles_dilate_minmax_ps_ : tiles_dilate_minabs_ps_, view);
684 tiles_fg_tx_.previous().release();
685 tiles_bg_tx_.previous().release();
690 downsample_tx_.acquire_2d(
691 quarter_res, gpu::TextureFormat::SFLOAT_16_16_16_16, usage_readwrite);
693 drw.
submit(downsample_ps_, view);
695 scatter_fg_indirect_buf_.clear_to_zero();
696 scatter_bg_indirect_buf_.clear_to_zero();
698 drw.
submit(reduce_ps_, view);
701 downsample_tx_.release();
706 for (
int is_background = 0; is_background < 2; is_background++) {
711 Framebuffer &scatter_fb = is_background ? scatter_bg_fb_ : scatter_fg_fb_;
712 PassSimple &gather_ps = is_background ? gather_bg_ps_ : gather_fg_ps_;
713 PassSimple &filter_ps = is_background ? filter_bg_ps_ : filter_fg_ps_;
714 PassSimple &scatter_ps = is_background ? scatter_bg_ps_ : scatter_fg_ps_;
717 half_res, gpu::TextureFormat::SFLOAT_16_16_16_16, usage_readwrite_attach);
718 weight_tx.
current().acquire_2d(half_res, gpu::TextureFormat::SFLOAT_16, usage_readwrite);
719 occlusion_tx_.acquire_2d(half_res, gpu::TextureFormat::SFLOAT_16_16);
721 drw.
submit(gather_ps, view);
729 half_res, gpu::TextureFormat::SFLOAT_16_16_16_16, usage_readwrite_attach);
730 weight_tx.
current().acquire_2d(half_res, gpu::TextureFormat::SFLOAT_16, usage_readwrite);
732 drw.
submit(filter_ps, view);
751 drw.
submit(scatter_ps, view);
754 occlusion_tx_.release();
761 bokeh_gather_lut_tx_.release();
762 bokeh_scatter_lut_tx_.release();
764 hole_fill_color_tx_.acquire_2d(
765 half_res, gpu::TextureFormat::SFLOAT_16_16_16_16, usage_readwrite);
766 hole_fill_weight_tx_.acquire_2d(half_res, gpu::TextureFormat::SFLOAT_16, usage_readwrite);
768 drw.
submit(hole_fill_ps_, view);
772 reduced_color_tx_.release();
773 reduced_coc_tx_.release();
782 drw.
submit(resolve_ps_, view);
784 color_bg_tx_.current().release();
785 color_fg_tx_.current().release();
786 weight_bg_tx_.current().release();
787 weight_fg_tx_.current().release();
788 tiles_fg_tx_.current().release();
789 tiles_bg_tx_.current().release();
790 hole_fill_color_tx_.release();
791 hole_fill_weight_tx_.release();
792 bokeh_resolve_lut_tx_.release();
800 std::swap(*input_tx, *output_tx);
Camera data-block and utility functions.
#define GPU_ATTACHMENT_TEXTURE(_texture)
#define GPU_ATTACHMENT_NONE
void ensure(GPUAttachment depth=GPU_ATTACHMENT_NONE, GPUAttachment color1=GPU_ATTACHMENT_NONE, GPUAttachment color2=GPU_ATTACHMENT_NONE, GPUAttachment color3=GPU_ATTACHMENT_NONE, GPUAttachment color4=GPU_ATTACHMENT_NONE, GPUAttachment color5=GPU_ATTACHMENT_NONE, GPUAttachment color6=GPU_ATTACHMENT_NONE, GPUAttachment color7=GPU_ATTACHMENT_NONE, GPUAttachment color8=GPU_ATTACHMENT_NONE)
void submit(PassSimple &pass, View &view)
static void swap(TextureFromPool &a, TextureFromPool &b)
bool acquire_2d(int2 extent, gpu::TextureFormat format, eGPUTextureUsage usage=GPU_TEXTURE_USAGE_GENERAL, int mip_len=1)
void clear(float4 values)
void shader_set(gpu::Shader *shader)
void bind_texture(const char *name, gpu::Texture *texture, GPUSamplerState state=sampler_auto)
void bind_image(const char *name, gpu::Texture *image)
void dispatch(int group_len)
void barrier(GPUBarrier type)
void bind_ubo(const char *name, gpu::UniformBuf *buffer)
void jitter_apply(float4x4 &winmat, float4x4 &viewmat)
void render(View &view, gpu::Texture **input_tx, gpu::Texture **output_tx, DepthOfFieldBuffer &dof_buffer)
RenderBuffers render_buffers
gpu::Shader * static_shader_get(eShaderType shader_type)
void camera(KernelGlobals &kg, const ShadingData &sd, float3 &outview, float &outdepth, float &outdist)
detail::Pass< command::DrawCommandBuf > PassSimple
@ DOF_GATHER_BACKGROUND_LUT
@ DOF_TILES_DILATE_MINABS
@ DOF_TILES_DILATE_MINMAX
@ DOF_GATHER_FOREGROUND_LUT
T length_squared(const VecBase< T, Size > &a)
VecBase< T, Size > divide_ceil(const VecBase< T, Size > &a, const VecBase< T, Size > &b)
VecBase< T, Size > ceil_to_multiple(const VecBase< T, Size > &a, const VecBase< T, Size > &b)
constexpr StringRefNull velocity
constexpr StringRefNull radius
MINLINE float min_ff(float a, float b)
void GPU_framebuffer_bind(gpu::FrameBuffer *fb)
bool GPU_type_matches_ex(GPUDeviceType device, GPUOSType os, GPUDriverType driver, GPUBackendType backend)
void mul_project_m4_v3(const float mat[4][4], float vec[3])
@ GPU_SAMPLER_FILTERING_LINEAR
@ GPU_SAMPLER_FILTERING_MIPMAP
MatBase< float, 4, 4 > float4x4
VecBase< float, 4 > float4
float BKE_camera_object_dof_distance(const struct Object *ob)
VecBase< int32_t, 2 > int2
VecBase< float, 2 > float2
VecBase< int32_t, 3 > int3
MINLINE void add_v2_v2(float r[2], const float a[2])
@ GPU_TEXTURE_USAGE_SHADER_READ
@ GPU_TEXTURE_USAGE_SHADER_WRITE
@ GPU_TEXTURE_USAGE_ATTACHMENT
void GPU_memory_barrier(GPUBarrier barrier)
int GPU_texture_width(const gpu::Texture *texture)
@ GPU_BARRIER_FRAMEBUFFER
@ GPU_BARRIER_TEXTURE_FETCH
@ GPU_BARRIER_SHADER_STORAGE
@ GPU_BARRIER_SHADER_IMAGE_ACCESS
@ DRW_STATE_BLEND_ADD_FULL
void GPU_debug_group_end()
int GPU_texture_height(const gpu::Texture *texture)
MINLINE float max_ff(float a, float b)
MINLINE void sub_v2_v2(float r[2], const float a[2])
VecBase< float, 3 > float3
MINLINE int min_ii(int a, int b)
void GPU_debug_group_begin(const char *name)
MINLINE float clamp_f(float value, float min, float max)
KERNEL_FEATURE_LIGHT_PASSES KERNEL_FEATURE_PATH_GUIDING float
const c_style_mat & ptr() const
TextureFromPool stabilize_history_tx_
float2 bokeh_anisotropic_scale