Blender V5.3
eevee_pipeline.hh
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2021 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
12
13#pragma once
14
15#include "BLI_math_bits.hh"
16
17#include "DRW_render.hh"
18
19#include "eevee_defines.hh"
20#include "eevee_lut.hh"
21#include "eevee_material.hh"
22#include "eevee_raytrace.hh"
23#include "eevee_subsurface.hh"
25
26namespace blender {
27
28struct Camera;
29
30namespace eevee {
31
32class Instance;
33struct RayTraceBuffer;
34
35/* -------------------------------------------------------------------- */
40
42 private:
43 Instance &inst_;
44
45 PassSimple clear_ps_ = {"World.Background.Clear"};
46 PassSimple world_ps_ = {"World.Background"};
47
48 public:
49 BackgroundPipeline(Instance &inst) : inst_(inst) {};
50
51 void sync(GPUMaterial *gpumat, float background_opacity, float background_blur);
52 void clear(View &view);
53 void render(View &view, Framebuffer &combined_fb);
54};
55
57
58/* -------------------------------------------------------------------- */
63
65 private:
66 Instance &inst_;
67
68 /* Dummy textures: required to reuse background shader and avoid another shader variation. */
69 Texture dummy_renderpass_tx_;
70 Texture dummy_cryptomatte_tx_;
71 Texture dummy_aov_color_tx_;
72 Texture dummy_aov_value_tx_;
73
74 PassSimple cubemap_face_ps_ = {"World.Probe"};
75
76 bool use_lightpath_node_ = false;
77
78 public:
79 WorldPipeline(Instance &inst) : inst_(inst) {};
80
81 void sync(GPUMaterial *gpumat);
82 void render(View &view);
83
84 /* NOTE: Is valid after WorldPipeline::sync. */
85 bool use_lightpath_node() const
86 {
87 return use_lightpath_node_;
88 }
89};
90
92
93/* -------------------------------------------------------------------- */
97
99 private:
100 Instance &inst_;
101 bool is_valid_;
102
103 PassSimple world_ps_ = {"World.Volume"};
104
105 public:
106 WorldVolumePipeline(Instance &inst) : inst_(inst) {};
107
108 void sync(GPUMaterial *gpumat);
109 void render(View &view);
110};
111
113
114/* -------------------------------------------------------------------- */
118
120 private:
121 Instance &inst_;
122
123 /* Shadow update pass. */
124 PassMain render_ps_ = {"Shadow.Surface"};
125 /* Shadow surface render sub-passes. */
126 PassMain::Sub *surface_double_sided_ps_ = nullptr;
127 PassMain::Sub *surface_single_sided_ps_ = nullptr;
128
129 public:
130 ShadowPipeline(Instance &inst) : inst_(inst) {};
131
133
134 void sync();
135
136 void render(View &view);
137};
138
140
141/* -------------------------------------------------------------------- */
146
147class Prepass {
148 Instance &inst_;
149
150 PassMain pass_{"Prepass"};
151 PassMain::Sub *subs_[2 /*hide from raycast*/][2 /*double sided*/][2 /*moving*/][2 /*write id*/] =
152 {{{{nullptr}}}};
153 PassMain::Sub *setup_subs_[2 /*hide from raycast*/][2 /*double sided*/][2 /*moving*/]
154 [2 /*write id*/] = {{{{nullptr}}}};
155
156 DRWState common_state_{};
157 bool supports_motion_vectors_ = false;
158 bool supports_raycast_visibility_ = false;
159
160 /* These are never read in practice,
161 * only needed for GPU API correctness without extra shader variants. */
162 Texture dummy_raycast_depth_tx_{"prepass.dummy_raycast_depth_tx_"};
163 Texture dummy_raycast_id_tx_{"prepass.dummy_raycast_id_tx_"};
164 Texture dummy_raycast_normal_tx_{"prepass.dummy_raycast_normal_tx_"};
165
166 /* Copies of UniformDataModule::pipeline with can_raycast overridden.
167 * Needed so we can render the whole Prepass in a single PassMain. */
168 draw::UniformBuffer<PipelineInfoData> pipeline_buf_copy_{"prepass.pipeline_buf"};
169 draw::UniformBuffer<PipelineInfoData> pipeline_buf_copy_hide_from_raycast_{
170 "prepass.pipeline_buf_hide_from_raycast"};
171 gpu::Texture *fb_depth_tx_;
172
173 public:
174 Prepass(Instance &inst) : inst_(inst) {};
175
176 void init(DRWState extra_state = DRW_STATE_NO_DRAW,
177 bool supports_motion_vectors = true,
178 bool supports_raycast_visibility = true,
179 FunctionRef<void(PassMain &pass)> pass_setup_cb = {});
180
181 PassMain::Sub *add(blender::Material *blender_mat,
182 GPUMaterial *gpumat,
183 bool has_motion,
184 bool hide_from_raycast);
185
186 void end_sync();
187
188 void render(View &view, gpu::Texture *fb_depth_tx, bool can_raycast);
189};
190
192
193/* -------------------------------------------------------------------- */
198
200 private:
201 Instance &inst_;
202
203 Prepass prepass_{inst_};
204
205 PassMain opaque_ps_ = {"Shading"};
206 PassMain::Sub *opaque_subpasses_[2 /*Raycast*/][2 /*Double-Sided*/] = {{nullptr}};
207
208 PassMain::Sub *get_opaque_subpass(blender::Material *blender_mat, GPUMaterial *gpumat)
209 {
210 const bool has_raycast = GPU_material_flag_get(gpumat, GPU_MATFLAG_RAYCAST);
211 const bool double_sided = !(blender_mat->blend_flag & MA_BL_CULL_BACKFACE);
212
213 return opaque_subpasses_[has_raycast][double_sided];
214 }
215
216 PassSortable transparent_ps_ = {"Forward.Transparent"};
217 float3 camera_forward_;
218
219 PassSimple resolve_ps_ = {"Forward.Resolve"};
220
221 bool has_opaque_ = false;
222 bool has_transparent_ = false;
223 bool has_colored_transparency_ = false;
224 bool has_holdout_ = false;
225
226 struct TransparencyBuffer {
227 /* Channels are packed separately for technical reason (see eevee_surf_forward_frag.glsl for
228 * explanation). In the case of monochromatic transparency, the #r_channel_tx actually
229 * contains the whole RGBA and the other textures are dummy texture not attached to the
230 * frame-buffer. The #a_channel_tx is only allocated if holdout or film transparency is
231 * enabled. */
232 TextureFromPool r_channel_tx;
233 TextureFromPool g_channel_tx;
234 TextureFromPool b_channel_tx;
235 TextureFromPool a_channel_tx;
236
237 void acquire(int2 extent, bool use_colored_transparency);
238 void release();
239 } transp_buffer_;
240
241 public:
242 ForwardPipeline(Instance &inst) : inst_(inst) {}
243
244 void sync();
245 void end_sync();
246
248 GPUMaterial *gpumat,
249 bool has_motion);
251 blender::Material *blender_mat,
252 GPUMaterial *gpumat);
253
254 void transparent_add(const Object *ob,
255 const float3 &ob_location,
256 blender::Material *blender_mat,
257 GPUMaterial *gpumat,
258 PassMain::Sub *&r_prepass_subpass,
259 PassMain::Sub *&r_material_subpass);
260
261 bool use_colored_transparency() const;
262
263 void render(View &view,
264 gpu::Texture *depth_tx,
265 Framebuffer &prepass_fb,
266 Framebuffer &transparent_fb,
267 Framebuffer &combined_fb,
268 int2 extent);
269};
270
272
273/* -------------------------------------------------------------------- */
276
279
281
282 PassMain gbuffer_ps_ = {"Shading"};
283 PassMain::Sub *gbuffer_subpasses_[2 /*Hybrid*/][2 /*Raycast*/][2 /*Double-Sided*/] = {
284 {{nullptr}}};
285
287
289 {
290 const bool is_hybrid = GPU_material_flag_get(gpumat, GPU_MATFLAG_SHADER_TO_RGBA) ||
292 const bool has_raycast = GPU_material_flag_get(gpumat, GPU_MATFLAG_RAYCAST);
293 const bool double_sided = !(blender_mat->blend_flag & MA_BL_CULL_BACKFACE);
294
295 return gbuffer_subpasses_[is_hybrid][has_raycast][double_sided];
296 }
297
299
300 /* Closures bits from the materials in this pass. */
302 /* Maximum closure count considering all material in this pass. */
304 /* True if this is a planar probe deferred layer. To be set before sync. */
305 bool is_probe_ = false;
306
307 /* Stencil values used during the deferred pipeline. */
308 enum class StencilBits : uint8_t {
309 /* Bits 0 to 1 are reserved for closure count [0..3]. */
310 CLOSURE_COUNT_0 = (1u << 0u),
311 CLOSURE_COUNT_1 = (1u << 1u),
312 /* Set for pixels have a transmission closure. */
313 TRANSMISSION = (1u << 2u),
315 HEADER_BITS = CLOSURE_COUNT_0 | CLOSURE_COUNT_1 | TRANSMISSION,
316
317 /* Set for materials that uses the shadow amend pass. */
318 THICKNESS_FROM_SHADOW = (1u << 3u),
320 MATERIAL_BITS = THICKNESS_FROM_SHADOW,
321 };
322
323 /* Return the amount of gbuffer layer needed. */
325 {
326 /* Default header. */
327 int count = 1;
328 /* SSS, light linking, shadow offset all require an additional layer to store the object ID.
329 * Since tracking these are not part of the closure bits and are rather common features,
330 * always require one layer for it. */
331 count += 1;
332 return count;
333 }
334
335 /* Return the amount of gbuffer layer needed. */
337 {
338 /* Always allocate 2 layer per closure for interleaved closure data packing in the gbuffer. */
339 return 2 * to_gbuffer_bin_count(closure_bits_);
340 }
341
342 /* Return the amount of gbuffer layer needed. */
344 {
345 /* TODO(fclem): We could count the number of different tangent frame in the shader and use
346 * min(tangent_frame_count, closure_count) once we have the normal reuse optimization.
347 * For now, allocate a custom normal layer for each Closure. */
348 int count = to_gbuffer_bin_count(closure_bits_);
349 /* Count the additional information layer needed by some closures. */
351 return count;
352 }
353
355 {
356 return closure_bits_;
357 }
358
359 void gbuffer_pass_sync(Instance &inst);
360};
361
362class DeferredPipeline;
363
365 friend DeferredPipeline;
366
367 private:
368 Instance &inst_;
369
370 static constexpr int max_lighting_tile_count_ = 128 * 128;
371
372 /* Evaluate all light objects contribution. */
373 PassSimple eval_light_ps_ = {"EvalLights"};
374 /* Combine direct and indirect light contributions and apply BSDF color. */
375 PassSimple combine_ps_ = {"Combine"};
376
385 TextureFromPool direct_radiance_txs_ = {"direct_radiance"};
386 /* Used when there is no indirect radiance buffer. */
387 Texture dummy_black = {"dummy_black"};
388 /* Reference to ray-tracing results. */
389 gpu::Texture *radiance_feedback_tx_ = nullptr;
390
395 Texture tile_mask_tx_ = {"tile_mask_tx_"};
396
397 RayTraceResult indirect_result_;
398
399 bool use_split_radiance_ = true;
400 /* Output radiance from the combine shader instead of copy. Allow passing unclamped result. */
401 bool use_feedback_output_ = false;
402 bool use_raytracing_ = false;
403 bool use_screen_transmission_ = false;
404 bool use_screen_reflection_ = false;
405
406 public:
407 DeferredLayer(Instance &inst) : DeferredLayerBase(inst), inst_(inst)
408 {
409 float4 data(0.0f);
410 dummy_black.ensure_2d(gpu::TextureFormat::RAYTRACE_RADIANCE_FORMAT,
411 int2(1),
413 data);
414 }
415
416 void begin_sync();
417 void end_sync(bool is_first_pass, bool is_last_pass, bool next_layer_has_transmission);
418
420 GPUMaterial *gpumat,
421 bool has_motion,
422 bool hide_from_raycast);
424
425 bool is_empty() const
426 {
427 return closure_count_ == 0;
428 }
429
435
436 /* Do we compute indirect lighting inside the light eval pass. */
437 static bool do_merge_direct_indirect_eval(const Instance &inst);
438 /* Do the clamp or light intensity settings change the radiance in the combine pass.
439 * If so, the radiance cannot be fed back to the next layer as-is. */
440 static bool do_modify_radiance(const Instance &inst);
441 /* Is the radiance split for the lighting pass. */
442 static bool do_split_direct_indirect_radiance(const Instance &inst);
443
444 /* Returns the radiance buffer to feed the next layer. */
445 gpu::Texture *render(View &render_view,
446 Framebuffer &prepass_fb,
447 Framebuffer &combined_fb,
448 Framebuffer &gbuffer_fb,
449 int2 extent,
450 RayTraceBuffer &rt_buffer,
451 gpu::Texture *radiance_behind_tx);
452};
453
455 friend DeferredLayer;
456
457 private:
458 /* Gbuffer filling passes. We could have an arbitrary number of them but for now we just have
459 * a hardcoded number of them. */
460 DeferredLayer opaque_layer_;
461 DeferredLayer refraction_layer_;
462 DeferredLayer volumetric_layer_;
463
464 PassSimple debug_draw_ps_ = {"debug_gbuffer"};
465
466 public:
468 : opaque_layer_(inst), refraction_layer_(inst), volumetric_layer_(inst) {};
469
470 void begin_sync();
471 void end_sync();
472
474 GPUMaterial *gpumat,
475 bool has_motion,
476 bool hide_from_raycast);
478
479 void render(View &main_view,
480 View &render_view,
481 Framebuffer &prepass_fb,
482 Framebuffer &combined_fb,
483 Framebuffer &gbuffer_fb,
484 int2 extent,
485 RayTraceBuffer &rt_buffer_opaque_layer,
486 RayTraceBuffer &rt_buffer_refract_layer);
487
488 /* Return the maximum amount of gbuffer layer needed. */
490 {
491 return max_ii(opaque_layer_.header_layer_count(), refraction_layer_.header_layer_count());
492 }
493
494 /* Return the maximum amount of gbuffer layer needed. */
496 {
497 return max_ii(opaque_layer_.closure_layer_count(), refraction_layer_.closure_layer_count());
498 }
499
500 /* Return the maximum amount of gbuffer layer needed. */
502 {
503 return max_ii(opaque_layer_.normal_layer_count(), refraction_layer_.normal_layer_count());
504 }
505
506 void debug_draw(draw::View &view, gpu::FrameBuffer *combined_fb);
507
508 bool is_empty() const
509 {
510 return opaque_layer_.is_empty() && refraction_layer_.is_empty();
511 }
512
514 {
515 return opaque_layer_.closure_bits_get() | refraction_layer_.closure_bits_get();
516 }
517
518 private:
519 void debug_pass_sync();
520};
521
523
524/* -------------------------------------------------------------------- */
528
530 /* Screen 2D bounds for layer intersection check. */
531 std::optional<Bounds<float2>> screen_bounds;
532 /* Combined bounds in Z. Allow tighter integration bounds. */
533 std::optional<Bounds<float>> z_range;
534
535 VolumeObjectBounds(const Camera &camera, const ObjectHandle &ob_handle, int instance_index);
536};
537
542 public:
543 bool use_hit_list = false;
544 bool is_empty = true;
545 bool finalized = false;
546 bool has_scatter = false;
547 bool has_absorption = false;
548
549 private:
550 Instance &inst_;
551
552 PassMain volume_layer_ps_ = {"Volume.Layer"};
553 /* Sub-passes of volume_layer_ps. */
554 PassMain::Sub *occupancy_ps_;
555 PassMain::Sub *material_ps_;
556 /* List of bounds from all objects contained inside this pass. */
558 /* Combined bounds from object_bounds_. */
559 std::optional<Bounds<float2>> combined_screen_bounds_;
560
561 public:
562 VolumeLayer(Instance &inst) : inst_(inst)
563 {
564 this->sync();
565 }
566
568 const blender::Material *blender_mat,
569 GPUMaterial *gpumat);
571 const blender::Material *blender_mat,
572 GPUMaterial *gpumat);
573
574 /* Return true if the given bounds overlaps any of the contained object in this layer. */
575 bool bounds_overlaps(const VolumeObjectBounds &object_bounds) const;
576
577 void add_object_bound(const VolumeObjectBounds &object_bounds);
578
579 void sync();
580 void render(View &view, Texture &occupancy_tx);
581};
582
584 private:
585 Instance &inst_;
586
588
589 /* Combined bounds in Z. Allow tighter integration bounds. */
590 std::optional<Bounds<float>> object_integration_range_;
591 /* Aggregated properties of all volume objects. */
592 bool has_scatter_ = false;
593 bool has_absorption_ = false;
594
595 public:
596 VolumePipeline(Instance &inst) : inst_(inst) {};
597
598 void sync();
599 void render(View &view, Texture &occupancy_tx);
600
602
603 std::optional<Bounds<float>> object_integration_range() const;
604
605 bool has_scatter() const
606 {
607 for (const auto &layer : layers_) {
608 if (layer->has_scatter) {
609 return true;
610 }
611 }
612 return false;
613 }
614 bool has_absorption() const
615 {
616 for (const auto &layer : layers_) {
617 if (layer->has_absorption) {
618 return true;
619 }
620 }
621 return false;
622 }
623
624 /* Returns true if any volume layer uses the hist list. */
625 bool use_hit_list() const;
626};
627
629
630/* -------------------------------------------------------------------- */
633
635 private:
636 Instance &inst_;
637
638 DeferredLayerBase opaque_layer_;
639
640 PassSimple eval_light_ps_ = {"EvalLights"};
641
642 /* Used when there is no feedback radiance buffer. */
643 Texture dummy_black = {"dummy_black"};
644
645 public:
646 DeferredProbePipeline(Instance &inst) : inst_(inst), opaque_layer_(inst)
647 {
648 float4 data(0.0f);
649 dummy_black.ensure_2d(
650 gpu::TextureFormat::SFLOAT_16_16_16_16, int2(1), GPU_TEXTURE_USAGE_SHADER_READ, data);
651 opaque_layer_.is_probe_ = true;
652 }
653
654 void begin_sync();
655 void end_sync();
656
658 GPUMaterial *gpumat,
659 bool hide_from_raycast);
661
662 void render(View &view,
663 Framebuffer &prepass_fb,
664 Framebuffer &combined_fb,
665 Framebuffer &gbuffer_fb,
666 int2 extent);
667
668 /* Return the maximum amount of gbuffer layer needed. */
670 {
671 return opaque_layer_.header_layer_count();
672 }
673
674 /* Return the maximum amount of gbuffer layer needed. */
676 {
677 return opaque_layer_.closure_layer_count();
678 }
679
680 /* Return the maximum amount of gbuffer layer needed. */
682 {
683 return opaque_layer_.normal_layer_count();
684 }
685};
686
688
689/* -------------------------------------------------------------------- */
692
694 private:
695 Instance &inst_;
696
697 PassSimple eval_light_ps_ = {"EvalLights"};
698
699 /* Used when there is no indirect radiance buffer. */
700 Texture dummy_black_ = {"dummy_black"};
701
702 public:
704 {
705 float4 data(0.0f);
706 dummy_black_.ensure_2d(
707 gpu::TextureFormat::SFLOAT_16_16_16_16, int2(1), GPU_TEXTURE_USAGE_SHADER_READ, data);
708 is_probe_ = true;
709 };
710
711 void begin_sync();
712 void end_sync();
713
715 GPUMaterial *gpumat,
716 bool hide_from_raycast);
718
719 void render(View &view,
720 gpu::Texture *depth_layer_tx,
721 Framebuffer &prepass_fb,
723 Framebuffer &combined_fb,
724 int2 extent);
725};
726
728
729/* -------------------------------------------------------------------- */
733
735 private:
736 Instance &inst_;
737
738 PassMain surface_ps_ = {"Capture.Surface"};
739
740 public:
741 CapturePipeline(Instance &inst) : inst_(inst) {};
742
744 blender::Material *blender_mat,
745 GPUMaterial *gpumat);
746
747 void sync();
748 void render(View &view);
749};
750
752
753/* -------------------------------------------------------------------- */
758
759class UtilityTexture : public Texture {
760 struct Layer {
762 };
763
764 static constexpr int lut_size = UTIL_TEX_SIZE;
765 static constexpr int lut_size_sqr = lut_size * lut_size;
766 static constexpr int layer_count = UTIL_BSDF_LAYER + UTIL_BSDF_LAYER_COUNT;
767
768 public:
770 : Texture("UtilityTx",
773 int2(lut_size),
774 layer_count,
775 nullptr)
776 {
777 Vector<Layer> data(layer_count);
778 {
780 memcpy(layer.data, lut::blue_noise, sizeof(layer));
781 }
782 {
784 for (auto y : IndexRange(lut_size)) {
785 for (auto x : IndexRange(lut_size)) {
786 /* Repeatedly stored on every row for correct interpolation. */
787 layer.data[y][x][0] = lut::burley_sss_profile[x][0];
788 layer.data[y][x][1] = lut::random_walk_sss_profile[x][0];
789 layer.data[y][x][2] = 0.0f;
791 }
792 }
794 }
795 {
796 Layer &layer = data[UTIL_LTC_MAT_LAYER];
797 memcpy(layer.data, lut::ltc_mat_ggx, sizeof(layer));
798 }
799 {
800 Layer &layer = data[UTIL_BRDF_LAYER];
801 for (auto x : IndexRange(lut_size)) {
802 for (auto y : IndexRange(lut_size)) {
803 layer.data[y][x][0] = lut::brdf_ggx[y][x][0];
804 layer.data[y][x][1] = lut::brdf_ggx[y][x][1];
805 layer.data[y][x][2] = lut::brdf_ggx[y][x][2];
806 layer.data[y][x][3] = 0.0f;
807 }
808 }
809 }
810 {
811 for (auto layer_id : IndexRange(16)) {
812 Layer &layer = data[UTIL_BSDF_LAYER + layer_id];
813 for (auto x : IndexRange(lut_size)) {
814 for (auto y : IndexRange(lut_size)) {
815 layer.data[y][x][0] = lut::bsdf_ggx[layer_id][y][x][0];
816 layer.data[y][x][1] = lut::bsdf_ggx[layer_id][y][x][1];
817 layer.data[y][x][2] = lut::bsdf_ggx[layer_id][y][x][2];
818 layer.data[y][x][3] = lut::btdf_ggx[layer_id][y][x][0];
819 }
820 }
821 }
822 }
824 }
825
826 ~UtilityTexture() = default;
827};
828
830
831/* -------------------------------------------------------------------- */
836
838 public:
849
852
853 bool has_raycast = false;
854
856 : background(inst),
857 world(inst),
858 world_volume(inst),
859 probe(inst),
860 planar(inst),
861 deferred(inst),
862 forward(inst),
863 shadow(inst),
864 volume(inst),
865 capture(inst),
866 data(data) {};
867
869 {
870 data.ray_type = RAY_TYPE_CAMERA;
871 data.can_raycast = true;
875 forward.sync();
876 shadow.sync();
877 volume.sync();
878 capture.sync();
879
880 has_raycast = false;
881 }
882
883 void end_sync()
884 {
885 probe.end_sync();
889 }
890
892 blender::Material *blender_mat,
893 GPUMaterial *gpumat,
894 eMaterialPipeline pipeline_type,
895 eMaterialProbe probe_capture)
896 {
898 has_raycast = true;
899 }
900 const bool hide_from_raycast = ob->visibility_flag & OB_HIDE_RAYCAST;
901
902 if (probe_capture == MAT_PROBE_REFLECTION) {
903 switch (pipeline_type) {
905 return probe.prepass_add(blender_mat, gpumat, hide_from_raycast);
907 return probe.material_add(blender_mat, gpumat);
908 default:
910 break;
911 }
912 }
913 if (probe_capture == MAT_PROBE_PLANAR) {
914 switch (pipeline_type) {
916 return planar.prepass_add(blender_mat, gpumat, hide_from_raycast);
918 return planar.material_add(blender_mat, gpumat);
919 default:
921 break;
922 }
923 }
924
925 switch (pipeline_type) {
927 return deferred.prepass_add(blender_mat, gpumat, false, hide_from_raycast);
929 return forward.prepass_opaque_add(blender_mat, gpumat, false);
931 BLI_assert_msg(0, "Overlap prepass should register to the forward pipeline directly.");
932 return nullptr;
933
935 return deferred.prepass_add(blender_mat, gpumat, true, hide_from_raycast);
937 return forward.prepass_opaque_add(blender_mat, gpumat, true);
938
940 return deferred.material_add(blender_mat, gpumat);
941 case MAT_PIPE_FORWARD:
942 return forward.material_opaque_add(ob, blender_mat, gpumat);
943 case MAT_PIPE_SHADOW:
944 return shadow.surface_material_add(blender_mat, gpumat);
945 case MAT_PIPE_CAPTURE:
946 return capture.surface_material_add(ob, blender_mat, gpumat);
947
950 BLI_assert_msg(0, "Volume shaders must register to the volume pipeline directly.");
951 return nullptr;
952
954 /* Should be handled by the `probe_capture == MAT_PROBE_PLANAR` case. */
956 return nullptr;
957 }
958 return nullptr;
959 }
960};
961
963
964} // namespace eevee
965} // namespace blender
#define BLI_assert_unreachable()
#define BLI_assert_msg(a, msg)
constexpr IndexRange()=default
Texture(const char *name="gpu::Texture")
detail::PassBase< command::DrawMultiBuf > Sub
Definition draw_pass.hh:509
void sync(GPUMaterial *gpumat, float background_opacity, float background_blur)
PassMain::Sub * surface_material_add(Object *ob, blender::Material *blender_mat, GPUMaterial *gpumat)
PassMain::Sub * prepass_add(blender::Material *blender_mat, GPUMaterial *gpumat, bool has_motion, bool hide_from_raycast)
void end_sync(bool is_first_pass, bool is_last_pass, bool next_layer_has_transmission)
PassMain::Sub * material_add(blender::Material *blender_mat, GPUMaterial *gpumat)
static bool do_merge_direct_indirect_eval(const Instance &inst)
static bool do_split_direct_indirect_radiance(const Instance &inst)
static bool do_modify_radiance(const Instance &inst)
PassMain::Sub * material_add(blender::Material *blender_mat, GPUMaterial *gpumat)
eClosureBits closure_bits_get() const
PassMain::Sub * prepass_add(blender::Material *blender_mat, GPUMaterial *gpumat, bool has_motion, bool hide_from_raycast)
void debug_draw(draw::View &view, gpu::FrameBuffer *combined_fb)
PassMain::Sub * material_add(blender::Material *blender_mat, GPUMaterial *gpumat)
PassMain::Sub * prepass_add(blender::Material *blender_mat, GPUMaterial *gpumat, bool hide_from_raycast)
void transparent_add(const Object *ob, const float3 &ob_location, blender::Material *blender_mat, GPUMaterial *gpumat, PassMain::Sub *&r_prepass_subpass, PassMain::Sub *&r_material_subpass)
PassMain::Sub * prepass_opaque_add(blender::Material *blender_mat, GPUMaterial *gpumat, bool has_motion)
PassMain::Sub * material_opaque_add(const Object *ob, blender::Material *blender_mat, GPUMaterial *gpumat)
A running instance of the engine.
PassMain::Sub * material_add(Object *ob, blender::Material *blender_mat, GPUMaterial *gpumat, eMaterialPipeline pipeline_type, eMaterialProbe probe_capture)
PipelineModule(Instance &inst, PipelineInfoData &data)
PassMain::Sub * material_add(blender::Material *blender_mat, GPUMaterial *gpumat)
PassMain::Sub * prepass_add(blender::Material *blender_mat, GPUMaterial *gpumat, bool hide_from_raycast)
PassMain::Sub * add(blender::Material *blender_mat, GPUMaterial *gpumat, bool has_motion, bool hide_from_raycast)
PassMain::Sub * surface_material_add(blender::Material *material, GPUMaterial *gpumat)
void add_object_bound(const VolumeObjectBounds &object_bounds)
bool bounds_overlaps(const VolumeObjectBounds &object_bounds) const
PassMain::Sub * occupancy_add(const Object *ob, const blender::Material *blender_mat, GPUMaterial *gpumat)
PassMain::Sub * material_add(const Object *ob, const blender::Material *blender_mat, GPUMaterial *gpumat)
std::optional< Bounds< float > > object_integration_range() const
VolumeLayer * register_and_get_layer(const VolumeObjectBounds &object_bounds)
void sync(GPUMaterial *gpumat)
#define UTIL_DISK_INTEGRAL_COMP
#define UTIL_BSDF_LAYER
#define UTIL_BRDF_LAYER
#define UTIL_DISK_INTEGRAL_LAYER
#define UTIL_LTC_MAT_LAYER
#define UTIL_BSDF_LAYER_COUNT
#define UTIL_SSS_TRANSMITTANCE_PROFILE_LAYER
#define UTIL_TEX_SIZE
#define UTIL_BLUE_NOISE_LAYER
@ SFLOAT_16_16_16_16
#define instance_index
#define layer
void camera(KernelGlobals &kg, const ShadingData &sd, float3 &outview, float &outdepth, float &outdist)
detail::Pass< command::DrawCommandBuf > PassSimple
detail::Pass< command::DrawMultiBuf > PassMain
const float ltc_mat_ggx[64][64][4]
Definition eevee_lut.cc:13
const float burley_sss_profile[64][1]
const float brdf_ggx[64][64][3]
const float random_walk_sss_profile[64][1]
const float ltc_disk_integral[64][64][1]
const float btdf_ggx[16][64][64][1]
const float bsdf_ggx[16][64][64][3]
const float blue_noise[64][64][4]
BMesh Iterators.
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
MINLINE int count_bits_i(unsigned int n)
@ GPU_MATFLAG_SHADER_TO_RGBA
@ GPU_MATFLAG_LIGHTING
@ GPU_MATFLAG_RAYCAST
MINLINE int max_ii(int a, int b)
bool GPU_material_flag_get(const GPUMaterial *mat, eGPUMaterialFlag flag)
VecBase< float, 4 > float4
VecBase< int32_t, 2 > int2
@ GPU_TEXTURE_USAGE_SHADER_READ
@ GPU_TEXTURE_USAGE_SHADER_WRITE
BMesh const char void * data
unsigned char uint8_t
Definition BKE_text.h:79
void GPU_texture_update_mipmap(gpu::Texture *texture, int mip_level, eGPUDataFormat data_format, const void *pixels, uint unpack_row_length=0)
@ DRW_STATE_NO_DRAW
Definition draw_state.hh:29
VecBase< float, 3 > float3
eObject_VisibilityFlag visibility_flag
void gbuffer_pass_sync(Instance &inst)
eClosureBits closure_bits_get() const
PassMain::Sub * gbuffer_subpasses_[2][2][2]
PassMain::Sub * get_gbuffer_subpass(blender::Material *blender_mat, GPUMaterial *gpumat)
std::optional< Bounds< float2 > > screen_bounds
VolumeObjectBounds(const Camera &camera, const ObjectHandle &ob_handle, int instance_index)
std::optional< Bounds< float > > z_range