44void *Instance::debug_scope_render_sample =
nullptr;
45void *Instance::debug_scope_irradiance_setup =
nullptr;
46void *Instance::debug_scope_irradiance_sample =
nullptr;
77 rcti visible_rect = rect;
88 if (!is_default_border && use_border) {
112 if (
draw_ctx->is_viewport_image_render()) {
114 visible_rect.
xmax = vp_size[0];
115 visible_rect.
ymax = vp_size[1];
116 visible_rect.
xmin = visible_rect.
ymin = 0;
127 const rcti *output_rect,
128 const rcti *visible_rect,
130 Depsgraph *depsgraph_,
147 update_eval_members();
165 draw_ctx->is_viewport_compositor_enabled()))
172 if (output_res !=
film.display_extent_get()) {
178 if (offset !=
film.get_data().offset || extent !=
film.get_data().extent) {
198 film.init(output_res, output_rect);
236 bool ready =
shaders.request_specializations(
267 update_eval_members();
276 rcti empty_rect{0, 0, 0, 0};
296void Instance::set_time(
float time)
300 update_eval_members();
303void Instance::update_eval_members()
374 const bool is_renderable_type =
ELEM(ob->
type,
388 if (!is_renderable_type || (!partsys_is_visible && !object_is_visible)) {
394 if (partsys_is_visible && ob !=
draw_ctx->object_edit) {
398 ob->object_to_world());
399 sync.sync_curves(ob, hair_handle, ob_ref, _res_handle, &md, &particle_sys);
404 if (object_is_visible) {
407 lights.sync_light(ob, ob_handle);
410 if (!
sync.sync_sculpt(ob, ob_handle, ob_ref)) {
411 sync.sync_mesh(ob, ob_handle, ob_ref);
415 sync.sync_pointcloud(ob, ob_handle, ob_ref);
418 sync.sync_volume(ob, ob_handle, ob_ref);
421 sync.sync_curves(ob, ob_handle, ob_ref);
441 bool use_volume =
volume.will_enable();
497 return (
materials.queued_shaders_count == 0) && (
materials.queued_textures_count == 0) &&
508 return (
materials.queued_shaders_count == 0) && (
materials.queued_textures_count == 0) &&
518void Instance::render_sample()
542 DebugScope debug_scope(debug_scope_render_sample,
"EEVEE.render_sample");
562void Instance::render_read_result(RenderLayer *render_layer,
const char *view_name)
568 if (pass_type == 0) {
573 for (
int64_t pass_offset : IndexRange(pass_names.
size())) {
575 render_layer, pass_names[pass_offset].c_str(), view_name);
579 float *
result =
film.read_pass(pass_type, pass_offset);
617 for (
const std::string &vector_pass_name :
625 sizeof(
float) * 4 * vector_rp->
rectx * vector_rp->
recty);
642 if (!info_.empty()) {
650 this->render_sample();
652 if ((
sampling.sample_index() == 1) || ((
sampling.sample_index() % 25) == 0) ||
656 std::string re_info =
"Rendering " + std::to_string(
sampling.sample_index()) +
" / " +
657 std::to_string(
sampling.sample_count()) +
" samples";
673 if (
G.background ==
false && first_read) {
685 this->
film.cryptomatte_sort();
689 if (!info_.empty()) {
691 engine,
RPT_(
"Errors during render. See the System Console for more info."));
692 printf(
"%s", info_.c_str());
720 this->
film.write_viewport_compositor_passes();
731 if (
materials.queued_textures_count > 0) {
734 if (
materials.queued_shaders_count > 0) {
743 "Setting Preferences > System > Shader Compilation Method to Subprocess might improve "
744 "compilation time.");
749 else if (
materials.queued_optimize_shaders_count > 0) {
762 this->render_sample();
763 }
while (!
sampling.finished_viewport());
767 this->
film.write_viewport_compositor_passes();
796#define CHECK_PASS_LEGACY(name, type, channels, chanid) \
797 if (view_layer->passflag & (SCE_PASS_##name)) { \
798 RE_engine_register_pass( \
799 engine, scene, view_layer, RE_PASSNAME_##name, channels, chanid, type); \
802#define CHECK_PASS_EEVEE(name, type, channels, chanid) \
803 if (view_layer->eevee.render_passes & (EEVEE_RENDER_PASS_##name)) { \
804 RE_engine_register_pass( \
805 engine, scene, view_layer, RE_PASSNAME_##name, channels, chanid, type); \
846 if (
view_layer->cryptomatte_flag & cryptomatte_layer) {
872 auto custom_pipeline_wrapper = [&](
FunctionRef<void()> callback) {
880 auto context_wrapper = [&](
FunctionRef<void()> callback) {
888 custom_pipeline_wrapper([&]() {
890 while ((
materials.queued_shaders_count > 0) || (
materials.queued_textures_count > 0)) {
907 DebugScope debug_scope(debug_scope_irradiance_setup,
"EEVEE.irradiance_setup");
933 context_wrapper([&]() {
934 DebugScope debug_scope(debug_scope_irradiance_sample,
"EEVEE.irradiance_sample");
939 for (
int i = 0;
i < 16 && !
sampling.finished();
i++) {
963 result_update(cache_frame,
progress);
General operations, lookup, etc. for blender objects.
#define LISTBASE_FOREACH(type, var, list)
BLI_INLINE int BLI_rcti_size_y(const struct rcti *rct)
void BLI_rcti_init(struct rcti *rect, int xmin, int xmax, int ymin, int ymax)
void BLI_rctf_init(struct rctf *rect, float xmin, float xmax, float ymin, float ymax)
BLI_INLINE int BLI_rcti_size_x(const struct rcti *rct)
BLI_INLINE float BLI_rctf_size_x(const struct rctf *rct)
BLI_INLINE float BLI_rctf_size_y(const struct rctf *rct)
bool BLI_rctf_compare(const struct rctf *rect_a, const struct rctf *rect_b, float limit)
char * STRNCPY(char(&dst)[N], const char *src)
void BLI_mutex_lock(ThreadMutex *mutex)
void BLI_mutex_unlock(ThreadMutex *mutex)
Platform independent time functions.
#define SET_FLAG_FROM_TEST(value, test, flag)
uint64_t DEG_get_update_count(const Depsgraph *depsgraph)
Scene * DEG_get_evaluated_scene(const Depsgraph *graph)
ViewLayer * DEG_get_evaluated_view_layer(const Depsgraph *graph)
T * DEG_get_evaluated(const Depsgraph *depsgraph, T *id)
ID and Library types, which are fundamental for SDNA.
eViewLayerCryptomatteFlags
@ VIEW_LAYER_CRYPTOMATTE_MATERIAL
@ VIEW_LAYER_CRYPTOMATTE_ASSET
@ VIEW_LAYER_CRYPTOMATTE_OBJECT
#define EEVEE_RENDER_PASS_MAX_BIT
@ EEVEE_RENDER_PASS_CRYPTOMATTE_MATERIAL
@ EEVEE_RENDER_PASS_CRYPTOMATTE_OBJECT
@ EEVEE_RENDER_PASS_CRYPTOMATTE_ASSET
@ EEVEE_RENDER_PASS_VECTOR
struct ViewLayerAOV ViewLayerAOV
#define RE_PASSNAME_COMBINED
@ SCE_EEVEE_SHADOW_JITTERED_VIEWPORT
void DRW_submission_end()
void DRW_render_context_disable(Render *render)
void DRW_submission_start()
void DRW_render_context_enable(Render *render)
const rcti * ED_region_visible_rect(ARegion *region)
void ED_view3d_calc_camera_border(const Scene *scene, const Depsgraph *depsgraph, const ARegion *region, const View3D *v3d, const RegionView3D *rv3d, bool no_shift, rctf *r_viewborder)
bool GPU_use_subprocess_compilation()
void GPU_render_step(bool force_resource_release=false)
eGPUBackendType GPU_backend_get_type()
void GPU_framebuffer_viewport_reset(GPUFrameBuffer *fb)
void GPU_framebuffer_clear_color_depth(GPUFrameBuffer *fb, const float clear_col[4], float clear_depth)
void GPU_pass_cache_wait_for_all()
int GPU_texture_height(const GPUTexture *texture)
int GPU_texture_width(const GPUTexture *texture)
BPy_StructRNA * depsgraph
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
static View & default_get()
static bool do_merge_direct_indirect_eval(const Instance &inst)
static bool do_split_direct_indirect_radiance(const Instance &inst)
static const Vector< std::string > pass_to_render_pass_names(eViewLayerEEVEEPassType pass_type, const ViewLayer *view_layer)
VolumeProbeModule volume_probes
void render_frame(RenderEngine *engine, RenderLayer *render_layer, const char *view_name)
void draw(Manager &manager) final
bool is_viewport_compositor_enabled
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
void object_sync(ObjectRef &ob_ref, Manager &manager) final
RenderBuffers render_buffers
const RenderLayer * render_layer
const DRWContext * draw_ctx
bool is_viewport_image_render
const RegionView3D * rv3d
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
int64_t queued_textures_count
int64_t queued_shaders_count
bool finished_viewport() const
bool do_render_sync() const
const DRWContext * DRW_context_get()
void DRW_custom_pipeline_begin(DRWContext &draw_ctx, Depsgraph *)
void DRW_render_object_iter(RenderEngine *engine, Depsgraph *depsgraph, std::function< void(blender::draw::ObjectRef &, RenderEngine *, Depsgraph *)> callback)
bool DRW_object_is_renderable(const Object *ob)
int DRW_object_visibility_in_active_context(const Object *ob)
void DRW_render_set_time(RenderEngine *engine, Depsgraph *depsgraph, int frame, float subframe)
void DRW_custom_pipeline_end(DRWContext &draw_ctx)
void DRW_viewport_request_redraw()
blender::draw::Manager * DRW_manager_get()
#define CHECK_PASS_EEVEE(name, type, channels, chanid)
#define CHECK_PASS_LEGACY(name, type, channels, chanid)
void RE_engine_update_stats(RenderEngine *engine, const char *stats, const char *info)
void RE_engine_set_error_message(RenderEngine *engine, const char *msg)
void RE_engine_register_pass(RenderEngine *engine, Scene *scene, ViewLayer *view_layer, const char *name, int channels, const char *chanid, eNodeSocketDatatype type)
void RE_engine_update_progress(RenderEngine *engine, float progress)
MINLINE float fractf(float a)
@ DEFERRED_CAPTURE_SHADERS
@ DEFERRED_LIGHTING_SHADERS
@ IRRADIANCE_BAKE_SHADERS
@ DEFERRED_PLANAR_SHADERS
void foreach_hair_particle_handle(ObjectRef &ob_ref, ObjectHandle ob_handle, HairHandleCallback callback)
bool assign_if_different(T &old_value, T new_value)
VecBase< float, 4 > float4
VecBase< int32_t, 2 > int2
VecBase< float, 2 > float2
void RE_pass_set_buffer_data(RenderPass *pass, float *data)
RenderPass * RE_pass_find_by_name(RenderLayer *rl, const char *name, const char *viewname)
GPUFrameBuffer * default_fb
ImBufFloatBuffer float_buffer