45 PassSimple clear_ps_ = {
"World.Background.Clear"};
51 void sync(
GPUMaterial *gpumat,
float background_opacity,
float background_blur);
76 bool use_lightpath_node_ =
false;
87 return use_lightpath_node_;
124 PassMain render_ps_ = {
"Shadow.Surface"};
154 [2 ] = {{{{
nullptr}}}};
157 bool supports_motion_vectors_ =
false;
158 bool supports_raycast_visibility_ =
false;
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_"};
170 "prepass.pipeline_buf_hide_from_raycast"};
177 bool supports_motion_vectors =
true,
178 bool supports_raycast_visibility =
true,
184 bool hide_from_raycast);
213 return opaque_subpasses_[has_raycast][double_sided];
221 bool has_opaque_ =
false;
222 bool has_transparent_ =
false;
223 bool has_colored_transparency_ =
false;
224 bool has_holdout_ =
false;
226 struct TransparencyBuffer {
255 const float3 &ob_location,
310 CLOSURE_COUNT_0 = (1u << 0u),
311 CLOSURE_COUNT_1 = (1u << 1u),
313 TRANSMISSION = (1u << 2u),
315 HEADER_BITS = CLOSURE_COUNT_0 | CLOSURE_COUNT_1 | TRANSMISSION,
318 THICKNESS_FROM_SHADOW = (1u << 3u),
320 MATERIAL_BITS = THICKNESS_FROM_SHADOW,
365 friend DeferredPipeline;
370 static constexpr int max_lighting_tile_count_ = 128 * 128;
387 Texture dummy_black = {
"dummy_black"};
395 Texture tile_mask_tx_ = {
"tile_mask_tx_"};
399 bool use_split_radiance_ =
true;
401 bool use_feedback_output_ =
false;
402 bool use_raytracing_ =
false;
403 bool use_screen_transmission_ =
false;
404 bool use_screen_reflection_ =
false;
410 dummy_black.ensure_2d(gpu::TextureFormat::RAYTRACE_RADIANCE_FORMAT,
417 void end_sync(
bool is_first_pass,
bool is_last_pass,
bool next_layer_has_transmission);
422 bool hide_from_raycast);
455 friend DeferredLayer;
460 DeferredLayer opaque_layer_;
461 DeferredLayer refraction_layer_;
462 DeferredLayer volumetric_layer_;
464 PassSimple debug_draw_ps_ = {
"debug_gbuffer"};
468 : opaque_layer_(inst), refraction_layer_(inst), volumetric_layer_(inst) {};
476 bool hide_from_raycast);
491 return max_ii(opaque_layer_.header_layer_count(), refraction_layer_.header_layer_count());
497 return max_ii(opaque_layer_.closure_layer_count(), refraction_layer_.closure_layer_count());
503 return max_ii(opaque_layer_.normal_layer_count(), refraction_layer_.normal_layer_count());
510 return opaque_layer_.is_empty() && refraction_layer_.is_empty();
515 return opaque_layer_.closure_bits_get() | refraction_layer_.closure_bits_get();
519 void debug_pass_sync();
552 PassMain volume_layer_ps_ = {
"Volume.Layer"};
559 std::optional<Bounds<float2>> combined_screen_bounds_;
590 std::optional<Bounds<float>> object_integration_range_;
592 bool has_scatter_ =
false;
593 bool has_absorption_ =
false;
607 for (
const auto &
layer : layers_) {
608 if (
layer->has_scatter) {
616 for (
const auto &
layer : layers_) {
617 if (
layer->has_absorption) {
643 Texture dummy_black = {
"dummy_black"};
649 dummy_black.ensure_2d(
651 opaque_layer_.is_probe_ =
true;
659 bool hide_from_raycast);
671 return opaque_layer_.header_layer_count();
677 return opaque_layer_.closure_layer_count();
683 return opaque_layer_.normal_layer_count();
700 Texture dummy_black_ = {
"dummy_black"};
706 dummy_black_.ensure_2d(
716 bool hide_from_raycast);
738 PassMain surface_ps_ = {
"Capture.Surface"};
765 static constexpr int lut_size_sqr = lut_size * lut_size;
871 data.can_raycast =
true;
903 switch (pipeline_type) {
914 switch (pipeline_type) {
925 switch (pipeline_type) {
931 BLI_assert_msg(0,
"Overlap prepass should register to the forward pipeline directly.");
950 BLI_assert_msg(0,
"Volume shaders must register to the volume pipeline directly.");
#define BLI_assert_unreachable()
#define BLI_assert_msg(a, msg)
constexpr IndexRange()=default
Texture(const char *name="gpu::Texture")
detail::PassBase< command::DrawMultiBuf > Sub
void sync(GPUMaterial *gpumat, float background_opacity, float background_blur)
BackgroundPipeline(Instance &inst)
PassMain::Sub * surface_material_add(Object *ob, blender::Material *blender_mat, GPUMaterial *gpumat)
CapturePipeline(Instance &inst)
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)
DeferredLayer(Instance &inst)
bool has_transmission() const
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)
int normal_layer_count() const
eClosureBits closure_bits_get() const
int closure_layer_count() const
PassMain::Sub * prepass_add(blender::Material *blender_mat, GPUMaterial *gpumat, bool has_motion, bool hide_from_raycast)
DeferredPipeline(Instance &inst)
void debug_draw(draw::View &view, gpu::FrameBuffer *combined_fb)
int header_layer_count() const
int closure_layer_count() const
PassMain::Sub * material_add(blender::Material *blender_mat, GPUMaterial *gpumat)
DeferredProbePipeline(Instance &inst)
int normal_layer_count() const
PassMain::Sub * prepass_add(blender::Material *blender_mat, GPUMaterial *gpumat, bool hide_from_raycast)
int header_layer_count() const
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)
bool use_colored_transparency() const
ForwardPipeline(Instance &inst)
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)
WorldVolumePipeline world_volume
DeferredProbePipeline probe
UtilityTexture utility_tx
BackgroundPipeline background
PipelineModule(Instance &inst, PipelineInfoData &data)
PlanarProbePipeline planar
DeferredPipeline deferred
PlanarProbePipeline(Instance &inst)
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)
ShadowPipeline(Instance &inst)
~UtilityTexture()=default
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)
VolumeLayer(Instance &inst)
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)
bool has_absorption() const
bool use_hit_list() const
VolumePipeline(Instance &inst)
WorldPipeline(Instance &inst)
void sync(GPUMaterial *gpumat)
bool use_lightpath_node() const
void sync(GPUMaterial *gpumat)
WorldVolumePipeline(Instance &inst)
#define UTIL_DISK_INTEGRAL_COMP
#define UTIL_DISK_INTEGRAL_LAYER
#define UTIL_LTC_MAT_LAYER
#define UTIL_BSDF_LAYER_COUNT
#define UTIL_SSS_TRANSMITTANCE_PROFILE_LAYER
#define UTIL_BLUE_NOISE_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]
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]
@ MAT_PIPE_PREPASS_FORWARD_VELOCITY
@ MAT_PIPE_VOLUME_MATERIAL
@ MAT_PIPE_PREPASS_DEFERRED
@ MAT_PIPE_PREPASS_OVERLAP
@ MAT_PIPE_PREPASS_PLANAR
@ MAT_PIPE_PREPASS_DEFERRED_VELOCITY
@ MAT_PIPE_VOLUME_OCCUPANCY
@ MAT_PIPE_PREPASS_FORWARD
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
MINLINE int count_bits_i(unsigned int n)
@ GPU_MATFLAG_SHADER_TO_RGBA
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
void GPU_texture_update_mipmap(gpu::Texture *texture, int mip_level, eGPUDataFormat data_format, const void *pixels, uint unpack_row_length=0)
VecBase< float, 3 > float3
eObject_VisibilityFlag visibility_flag
eClosureBits closure_bits_
gpu::Texture * radiance_behind_tx_
int header_layer_count() const
int closure_layer_count() const
PassSimple clear_aovs_ps_
DeferredLayerBase(Instance &inst)
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)
int normal_layer_count() const
std::optional< Bounds< float2 > > screen_bounds
VolumeObjectBounds(const Camera &camera, const ObjectHandle &ob_handle, int instance_index)
std::optional< Bounds< float > > z_range