51void *Instance::debug_scope_render_frame =
nullptr;
52void *Instance::debug_scope_render_sample =
nullptr;
53void *Instance::debug_scope_irradiance_setup =
nullptr;
54void *Instance::debug_scope_irradiance_sample =
nullptr;
85 rcti visible_rect = rect;
93 const bool is_panoramic_camera =
115 if (
rv3d && !is_panoramic_camera &&
130 visible_rect.
xmax = vp_size[0];
131 visible_rect.
ymax = vp_size[1];
132 visible_rect.
xmin = visible_rect.
ymin = 0;
143 const rcti *output_rect,
144 const rcti *visible_rect,
146 Depsgraph *depsgraph_,
163 update_eval_members();
214 rcti lookdev_rect = *visible_rect;
309 update_eval_members();
318 rcti empty_rect{0, 0, 0, 0};
341void Instance::set_time(
float time)
345 update_eval_members();
348void Instance::update_eval_members()
419 const bool is_renderable_type =
ELEM(ob->
type,
433 if (!is_renderable_type || (!partsys_is_visible && !object_is_visible)) {
442 if (object_is_visible) {
558void Instance::render_sample()
583 DebugScope debug_scope(debug_scope_render_sample,
"EEVEE.render_sample");
606void Instance::render_read_result(RenderLayer *render_layer,
const char *view_name)
612 if (pass_type == 0) {
619 render_layer, pass_names[pass_offset].c_str(), view_name);
661 for (
const std::string &vector_pass_name :
667 memset(vector_rp->ibuf->float_data_for_write(),
669 sizeof(
float) * 4 * vector_rp->rectx * vector_rp->recty);
686 if (!info_.empty()) {
693 DebugScope debug_scope(debug_scope_render_frame,
"EEVEE.render_frame");
699 this->render_sample();
719 if (
G.background ==
false && first_read) {
737 std::string message = fmt::format(
742 if (!info_.empty()) {
744 engine,
RPT_(
"Errors during render. See the System Console for more info."));
745 printf(
"%s", info_.c_str());
796 "Setting Preferences > System > Shader Compilation Method to Subprocess might improve "
797 "compilation time.");
816 this->render_sample();
852#define CHECK_PASS_LEGACY(name, type, channels, chanid) \
853 if (view_layer->passflag & (SCE_PASS_##name)) { \
854 RE_engine_register_pass( \
855 engine, scene, view_layer, RE_PASSNAME_##name, channels, chanid, type); \
858#define CHECK_PASS_EEVEE(name, type, channels, chanid) \
859 if (view_layer->eevee.render_passes & (EEVEE_RENDER_PASS_##name)) { \
860 RE_engine_register_pass( \
861 engine, scene, view_layer, RE_PASSNAME_##name, channels, chanid, type); \
864#define CHECK_PASS_DENOISING(name, type, channels, chanid) \
865 if (view_layer->eevee.denoising_pass_flags & (EEVEE_DENOISING_PASS_STORE)) { \
866 RE_engine_register_pass( \
867 engine, scene, view_layer, RE_PASSNAME_##name, channels, chanid, type); \
939 auto custom_pipeline_wrapper = [&](
FunctionRef<void()> callback) {
947 auto context_wrapper = [&](
FunctionRef<void()> callback) {
955 custom_pipeline_wrapper([&]() {
976 DebugScope debug_scope(debug_scope_irradiance_setup,
"EEVEE.irradiance_setup");
1006 float time_per_sample_ms_smooth = 16.0f;
1009 context_wrapper([&]() {
1010 DebugScope debug_scope(debug_scope_irradiance_sample,
"EEVEE.irradiance_sample");
1014 int time_budget_ms =
G.background ? 32 : 16;
1016 int sample_count_in_batch =
ceilf(time_budget_ms /
max(0.1f, time_per_sample_ms_smooth));
1018 sample_count_in_batch = std::min({32, sample_count_in_batch, remaining_samples});
1042 float time_per_sample_ms =
float(time_it_end_ms - time_it_begin_ms) / sample_count_in_batch;
1044 time_per_sample_ms_smooth =
interpolate(time_per_sample_ms_smooth, time_per_sample_ms, 0.7f);
1052 if (time_since_last_update_ms > 1.0) {
Camera data-block and utility functions.
General operations, lookup, etc. for blender objects.
Platform independent time functions.
#define CLOG_INFO(clg_ref,...)
#define EEVEE_RENDER_PASS_MAX_BIT
#define RE_PASSNAME_COMBINED
#define SET_FLAG_FROM_TEST(value, test, flag)
constexpr IndexRange()=default
void begin_sync(Object *object_active=nullptr)
bool has_deferred_textures() const
static View & default_get()
void store_metadata(RenderResult *render_result)
static bool do_merge_direct_indirect_eval(const Instance &inst)
static bool do_split_direct_indirect_radiance(const Instance &inst)
eClosureBits closure_bits_get() const
int2 display_extent_get() const
static const Vector< std::string > pass_to_render_pass_names(eViewLayerEEVEEPassType pass_type, const ViewLayer *view_layer)
void update_sample_table()
float * read_pass(eViewLayerEEVEEPassType pass_type, int layer_offset)
bool is_valid_render_extent() const
void write_viewport_compositor_passes()
const FilmData & get_data()
void init(const int2 &full_extent, const rcti *output_rect)
float * read_aov(ViewLayerAOV *aov)
eViewLayerEEVEEPassType enabled_passes_get() const
VolumeProbeModule volume_probes
void render_frame(RenderEngine *engine, RenderLayer *render_layer, const char *view_name)
void draw(Manager &manager) final
SphereProbeModule sphere_probes
ShaderGroups loaded_shaders
AmbientOcclusion ambient_occlusion
RayTraceModule raytracing
void info_append_i18n(const char *msg, Args &&...args)
SubsurfaceModule subsurface
Object * camera_eval_object
ShaderGroups needed_shaders
void light_bake_irradiance(Object &probe, FunctionRef< void()> context_enable, FunctionRef< void()> context_disable, FunctionRef< bool()> stop, FunctionRef< void(LightProbeGridCacheFrame *, float progress)> result_update)
bool needs_lightprobe_sphere_passes() const
bool needs_planar_probe_passes() const
gpu::WorkInFlightPtr samples_in_flight
void object_sync(ObjectRef &ob_ref, Manager &manager) final
RenderBuffers render_buffers
const RenderLayer * render_layer
void init(const int2 &output_res, const rcti *output_rect, const rcti *visible_rect, RenderEngine *render, Depsgraph *depsgraph, Object *camera_object=nullptr, const RenderLayer *render_layer=nullptr, View *drw_view_=nullptr, const View3D *v3d=nullptr, const RegionView3D *rv3d=nullptr)
const DRWContext * draw_ctx
GPUSamplerFiltering anisotropic_filtering
bool is_viewport_image_render
const RegionView3D * rv3d
bool is_viewport_compositor_used
void store_metadata(RenderResult *render_result)
DepthOfField depth_of_field
PlanarProbeModule planar_probes
void draw_viewport_image_render()
static void update_passes(RenderEngine *engine, Scene *scene, ViewLayer *view_layer)
bool is_loaded(ShaderGroups groups) const
bool do_lightprobe_sphere_sync() const
UniformDataModule uniform_data
LightProbeModule light_probes
MotionBlurModule motion_blur
void init_light_bake(Depsgraph *depsgraph, draw::Manager *manager)
Object * camera_orig_object
bool do_planar_probe_sync() const
void init(const Object &probe_object)
void surfels_lights_eval()
void irradiance_capture()
LightProbeGridCacheFrame * read_result_packed()
LightProbeGridCacheFrame * read_result_unpacked()
void surfels_create(const Object &probe_object)
void sync_light(const ObjectRef &ob_ref)
void sync_probe(const ObjectRef &ob_ref)
void init(const rcti *visible_rect)
ShaderGroups default_materials_load_async()
int64_t queued_textures_count
ShaderGroups default_materials_wait_ready()
int64_t queued_optimize_shaders_count
int64_t queued_shaders_count
bool postfx_enabled() const
DeferredPipeline deferred
bool use_raytracing() const
RenderBuffersInfoData & data
uint64_t sample_index() const
bool finished_viewport() const
uint64_t sample_count() const
void init(const Scene *scene)
bool do_render_sync() const
ShaderGroups static_shaders_wait_ready(ShaderGroups request_bits)
bool request_specializations(bool block_until_ready, int render_buffers_shadow_id, int shadow_ray_count, int shadow_ray_step_count, bool use_split_indirect, bool use_lightprobe_eval)
ShaderGroups static_shaders_load_async(ShaderGroups request_bits)
const ShadowSceneData & get_data()
void sync_curves(const ObjectRef &ob_ref, struct HairParticleInfo const *hair_particle=nullptr)
void sync_mesh(const ObjectRef &ob_ref)
void sync_pointcloud(const ObjectRef &ob_ref)
void sync_volume(const ObjectRef &ob_ref)
bool sync_sculpt(const ObjectRef &ob_ref)
void geometry_steps_fill()
bool camera_has_motion() const
static WorkInFlightPtr create(unsigned int max_in_flight)
Simple API to draw debug shapes and log in the viewport.
#define CHECK_PASS_EEVEE(name, type, channels, chanid)
#define CHECK_PASS_LEGACY(name, type, channels, chanid)
#define CHECK_PASS_DENOISING(name, type, channels, chanid)
Quaternion interpolate(Quaternion a, Quaternion b, float t)
@ DEFERRED_CAPTURE_SHADERS
@ DEFERRED_LIGHTING_SHADERS
@ IRRADIANCE_BAKE_SHADERS
@ DEFERRED_PLANAR_SHADERS
void foreach_hair_particle(Instance &inst, ObjectRef &ob_ref, HairHandleCallback callback)
void RE_engine_update_stats(RenderEngine *engine, const char *stats, const char *info)
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
void DRW_custom_pipeline_end(DRWContext &draw_ctx)
void DRW_render_context_enable(Render *render)
char * STRNCPY(char(&dst)[N], const char *src)
void DRW_render_context_disable(Render *render)
bool assign_if_different(T &old_value, T &&new_value)
uint64_t DEG_get_update_count(const Depsgraph *depsgraph)
bool GPU_use_subprocess_compilation()
bool DRW_object_is_renderable(const Object *ob)
bool BKE_camera_view_render_border(const struct Scene *scene, const struct Depsgraph *depsgraph, const struct View3D *v3d, const struct RegionView3D *rv3d, int winx, int winy, rctf *r_border, rctf *r_unrolled_border)
void BLI_mutex_unlock(ThreadMutex *mutex)
GPUBackendType GPU_backend_get_type()
void BLI_rcti_rctf_copy(struct rcti *dst, const struct rctf *src)
void GPU_render_step(bool force_resource_release=false)
MINLINE float fractf(float a)
const rcti * ED_region_visible_rect(ARegion *region)
int DRW_object_visibility_in_active_context(const Object *ob)
void DRW_render_object_iter(RenderEngine *engine, Depsgraph *depsgraph, std::function< void(draw::ObjectRef &, RenderEngine *, Depsgraph *)> callback)
void DRW_render_set_time(RenderEngine *engine, Depsgraph *depsgraph, int frame, float subframe)
void RE_engine_update_progress(RenderEngine *engine, float progress)
@ SCE_EEVEE_SHADOW_JITTERED_VIEWPORT
bool GPU_type_matches(GPUDeviceType device, GPUOSType os, GPUDriverType driver)
BLI_INLINE int BLI_rcti_size_y(const struct rcti *rct)
void BLI_mutex_lock(ThreadMutex *mutex)
VecBase< int32_t, 2 > int2
VecBase< float, 2 > float2
void RE_engine_register_pass(RenderEngine *engine, Scene *scene, ViewLayer *view_layer, const char *name, int channels, const char *chanid, eNodeSocketDatatype type)
T * DEG_get_evaluated(const Depsgraph *depsgraph, T *id)
rctf BKE_camera_view_border(const struct Scene *scene, const struct Depsgraph *depsgraph, const struct View3D *v3d, const struct RegionView3D *rv3d, int winx, int winy, bool no_shift, bool no_zoom, bool no_roll)
int GPU_texture_width(const gpu::Texture *texture)
void GPU_framebuffer_viewport_reset(gpu::FrameBuffer *fb)
void RE_pass_set_buffer_data(RenderPass *pass, float *data)
ViewLayer * DEG_get_evaluated_view_layer(const Depsgraph *graph)
void DRW_custom_pipeline_begin(DRWContext &draw_ctx, Depsgraph *)
void DRW_submission_end()
const DRWContext * DRW_context_get()
BLI_INLINE int BLI_rcti_size_x(const struct rcti *rct)
void BLI_rcti_init(struct rcti *rect, int xmin, int xmax, int ymin, int ymax)
RenderPass * RE_pass_find_by_name(RenderLayer *rl, const char *name, const char *viewname)
void RE_engine_set_error_message(RenderEngine *engine, const char *msg)
void GPU_pass_cache_wait_for_all()
@ EEVEE_RENDER_PASS_CRYPTOMATTE_ASSET
@ EEVEE_RENDER_PASS_CRYPTOMATTE_MATERIAL
@ EEVEE_RENDER_PASS_VECTOR
@ EEVEE_RENDER_PASS_CRYPTOMATTE_OBJECT
int GPU_texture_height(const gpu::Texture *texture)
eViewLayerCryptomatteFlags
@ VIEW_LAYER_CRYPTOMATTE_ASSET
@ VIEW_LAYER_CRYPTOMATTE_MATERIAL
@ VIEW_LAYER_CRYPTOMATTE_OBJECT
void DRW_submission_start()
draw::Manager * DRW_manager_get()
double BLI_time_now_seconds()
Scene * DEG_get_evaluated_scene(const Depsgraph *graph)
void GPU_framebuffer_clear_color_depth(gpu::FrameBuffer *fb, const double4 clear_col, float clear_depth)
VecBase< double, 4 > double4
void DRW_viewport_request_redraw()
void BLI_rcti_rctf_copy_floor(struct rcti *dst, const struct rctf *src)
KERNEL_FEATURE_LIGHT_PASSES KERNEL_FEATURE_PATH_GUIDING float
bool is_transforming() const
bool is_viewport_xr() const
DefaultTextureList * viewport_texture_list_get() const
bool is_navigating() const
bool is_image_render() const
float2 viewport_size_get() const
DefaultFramebufferList * viewport_framebuffer_list_get() const
bool is_viewport_compositor_used() const
bool is_viewport_image_render() const
gpu::FrameBuffer * default_fb
eRegionView3D_Persp persp
ThreadMutex update_render_passes_mutex
ListBaseT< ViewLayerAOV > aovs
eViewLayerCryptomatteFlags cryptomatte_flag