diff options
Diffstat (limited to 'source/blender/editors')
9 files changed, 22 insertions, 125 deletions
diff --git a/source/blender/editors/include/ED_view3d.h b/source/blender/editors/include/ED_view3d.h index 64d749dc7a7..1619c59ddac 100644 --- a/source/blender/editors/include/ED_view3d.h +++ b/source/blender/editors/include/ED_view3d.h @@ -388,7 +388,7 @@ void ED_view3d_draw_offscreen( const struct EvaluationContext *eval_ctx, struct Scene *scene, struct ViewLayer *view_layer, struct View3D *v3d, struct ARegion *ar, int winx, int winy, float viewmat[4][4], float winmat[4][4], bool do_bgpic, bool do_sky, bool is_persp, const char *viewname, - struct GPUFX *fx, struct GPUFXSettings *fx_settings, + struct GPUFXSettings *fx_settings, struct GPUOffScreen *ofs, struct GPUViewport *viewport); void ED_view3d_draw_setup_view( struct wmWindow *win, const struct EvaluationContext *eval_ctx, struct Scene *scene, struct ARegion *ar, struct View3D *v3d, @@ -411,13 +411,13 @@ struct ImBuf *ED_view3d_draw_offscreen_imbuf( struct ViewLayer *view_layer, struct View3D *v3d, struct ARegion *ar, int sizex, int sizey, unsigned int flag, unsigned int draw_flags, int alpha_mode, int samples, const char *viewname, - struct GPUFX *fx, struct GPUOffScreen *ofs, char err_out[256]); + struct GPUOffScreen *ofs, char err_out[256]); struct ImBuf *ED_view3d_draw_offscreen_imbuf_simple( const struct EvaluationContext *eval_ctx, struct Scene *scene, struct ViewLayer *view_layer, struct Object *camera, int width, int height, unsigned int flag, unsigned int draw_flags, int drawtype, int alpha_mode, int samples, const char *viewname, - struct GPUFX *fx, struct GPUOffScreen *ofs, char err_out[256]); + struct GPUOffScreen *ofs, char err_out[256]); struct Base *ED_view3d_give_base_under_cursor(struct bContext *C, const int mval[2]); void ED_view3d_quadview_update(struct ScrArea *sa, struct ARegion *ar, bool do_clip); diff --git a/source/blender/editors/render/render_opengl.c b/source/blender/editors/render/render_opengl.c index 1f9894b3b9f..47e4fc51351 100644 --- a/source/blender/editors/render/render_opengl.c +++ b/source/blender/editors/render/render_opengl.c @@ -74,7 +74,6 @@ #include "RNA_access.h" #include "RNA_define.h" -#include "GPU_compositing.h" #include "GPU_framebuffer.h" #include "GPU_glew.h" #include "GPU_matrix.h" @@ -122,7 +121,6 @@ typedef struct OGLRender { GPUOffScreen *ofs; int ofs_samples; bool ofs_full_samples; - GPUFX *fx; int sizex, sizey; int write_still; @@ -365,7 +363,7 @@ static void screen_opengl_render_doit(const bContext *C, OGLRender *oglrender, R ibuf_view = ED_view3d_draw_offscreen_imbuf( &eval_ctx, scene, view_layer, v3d, ar, sizex, sizey, IB_rectfloat, draw_flags, alpha_mode, oglrender->ofs_samples, viewname, - oglrender->fx, oglrender->ofs, err_out); + oglrender->ofs, err_out); /* for stamp only */ if (rv3d->persp == RV3D_CAMOB && v3d->camera) { @@ -378,7 +376,7 @@ static void screen_opengl_render_doit(const bContext *C, OGLRender *oglrender, R &eval_ctx, scene, view_layer, scene->camera, oglrender->sizex, oglrender->sizey, IB_rectfloat, draw_flags, OB_SOLID, alpha_mode, oglrender->ofs_samples, viewname, - oglrender->fx, oglrender->ofs, err_out); + oglrender->ofs, err_out); camera = scene->camera; } @@ -545,7 +543,6 @@ static void screen_opengl_render_apply(const bContext *C, OGLRender *oglrender) for (view_id = 0; view_id < oglrender->views_len; view_id++) { context.view_id = view_id; context.gpu_offscreen = oglrender->ofs; - context.gpu_fx = oglrender->fx; context.gpu_full_samples = oglrender->ofs_full_samples; oglrender->seq_data.ibufs_arr[view_id] = BKE_sequencer_give_ibuf(&context, CFRA, chanshown); @@ -706,19 +703,6 @@ static bool screen_opengl_render_init(bContext *C, wmOperator *op) /* apply immediately in case we're rendering from a script, * running notifiers again will overwrite */ oglrender->scene->customdata_mask |= oglrender->scene->customdata_mask_modal; - - if (oglrender->v3d->fx_settings.fx_flag & (GPU_FX_FLAG_DOF | GPU_FX_FLAG_SSAO)) { - oglrender->fx = GPU_fx_compositor_create(); - } - } - else if (is_sequencer) { - /* NOTE: We allow animation of DoF setting for flexibility in edits, so - * we can't check in advance whether we need FX compositor or not. - * We just always allocated it and make sure it doesn't add extra - * overhead rather than memory allocation here if it's not really - * needed. - */ - oglrender->fx = GPU_fx_compositor_create(); } /* create render */ @@ -844,9 +828,6 @@ static void screen_opengl_render_end(bContext *C, OGLRender *oglrender) WM_event_add_notifier(C, NC_SCENE | ND_RENDER_RESULT, oglrender->scene); - if (oglrender->fx) - GPU_fx_compositor_destroy(oglrender->fx); - DRW_opengl_context_enable(); GPU_offscreen_free(oglrender->ofs); DRW_opengl_context_disable(); diff --git a/source/blender/editors/sculpt_paint/paint_image_proj.c b/source/blender/editors/sculpt_paint/paint_image_proj.c index ae5b825e4ae..21612339eb5 100644 --- a/source/blender/editors/sculpt_paint/paint_image_proj.c +++ b/source/blender/editors/sculpt_paint/paint_image_proj.c @@ -5478,7 +5478,7 @@ static int texture_paint_image_from_view_exec(bContext *C, wmOperator *op) ibuf = ED_view3d_draw_offscreen_imbuf( &eval_ctx, scene, view_layer, CTX_wm_view3d(C), CTX_wm_region(C), w, h, IB_rect, V3D_OFSDRAW_NONE, R_ALPHAPREMUL, 0, NULL, - NULL, NULL, err_out); + NULL, err_out); if (!ibuf) { /* Mostly happens when OpenGL offscreen buffer was failed to create, */ /* but could be other reasons. Should be handled in the future. nazgul */ diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c b/source/blender/editors/space_sequencer/sequencer_draw.c index db0593ef2d1..f6d18ad0a52 100644 --- a/source/blender/editors/space_sequencer/sequencer_draw.c +++ b/source/blender/editors/space_sequencer/sequencer_draw.c @@ -58,7 +58,6 @@ #include "BIF_glutil.h" -#include "GPU_compositing.h" #include "GPU_immediate.h" #include "GPU_immediate_util.h" #include "GPU_matrix.h" @@ -924,12 +923,6 @@ ImBuf *sequencer_ibuf_get(struct Main *bmain, Scene *scene, SpaceSeq *sseq, int rectx, recty, proxy_size, &context); context.view_id = BKE_scene_multiview_view_id_get(&scene->r, viewname); - if (scene->r.seq_flag & R_SEQ_CAMERA_DOF) { - if (sseq->compositor == NULL) { - sseq->compositor = GPU_fx_compositor_create(); - } - context.gpu_fx = sseq->compositor; - } /* sequencer could start rendering, in this case we need to be sure it wouldn't be canceled * by Esc pressed somewhere in the past diff --git a/source/blender/editors/space_sequencer/space_sequencer.c b/source/blender/editors/space_sequencer/space_sequencer.c index 23387f291e6..da16ac5acaa 100644 --- a/source/blender/editors/space_sequencer/space_sequencer.c +++ b/source/blender/editors/space_sequencer/space_sequencer.c @@ -60,8 +60,6 @@ #include "IMB_imbuf.h" -#include "GPU_compositing.h" - #include "sequencer_intern.h" // own include /**************************** common state *****************************/ @@ -220,11 +218,6 @@ static void sequencer_free(SpaceLink *sl) if (scopes->histogram_ibuf) IMB_freeImBuf(scopes->histogram_ibuf); - - if (sseq->compositor != NULL) { - GPU_fx_compositor_destroy(sseq->compositor); - sseq->compositor = NULL; - } } diff --git a/source/blender/editors/space_view3d/space_view3d.c b/source/blender/editors/space_view3d/space_view3d.c index 89e84052c9b..3cf915cd029 100644 --- a/source/blender/editors/space_view3d/space_view3d.c +++ b/source/blender/editors/space_view3d/space_view3d.c @@ -59,7 +59,6 @@ #include "ED_screen.h" #include "ED_transform.h" -#include "GPU_compositing.h" #include "GPU_framebuffer.h" #include "GPU_material.h" #include "GPU_viewport.h" @@ -568,11 +567,6 @@ static void view3d_main_region_exit(wmWindowManager *wm, ARegion *ar) rv3d->gpuoffscreen = NULL; } - if (rv3d->compositor) { - GPU_fx_compositor_destroy(rv3d->compositor); - rv3d->compositor = NULL; - } - if (rv3d->viewport) { DRW_opengl_context_enable(); GPU_viewport_free(rv3d->viewport); @@ -756,9 +750,6 @@ static void view3d_main_region_free(ARegion *ar) if (rv3d->gpuoffscreen) { GPU_offscreen_free(rv3d->gpuoffscreen); } - if (rv3d->compositor) { - GPU_fx_compositor_destroy(rv3d->compositor); - } if (rv3d->viewport) { DRW_opengl_context_enable(); GPU_viewport_free(rv3d->viewport); diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c index b14128ab400..34db99b5a5d 100644 --- a/source/blender/editors/space_view3d/view3d_draw.c +++ b/source/blender/editors/space_view3d/view3d_draw.c @@ -78,7 +78,6 @@ #include "GPU_immediate_util.h" #include "GPU_material.h" #include "GPU_viewport.h" -#include "GPU_compositing.h" #include "MEM_guardedalloc.h" @@ -1988,11 +1987,10 @@ void ED_view3d_draw_offscreen( const EvaluationContext *eval_ctx, Scene *scene, ViewLayer *view_layer, View3D *v3d, ARegion *ar, int winx, int winy, float viewmat[4][4], float winmat[4][4], - bool do_bgpic, bool do_sky, bool is_persp, const char *viewname, - GPUFX *fx, GPUFXSettings *fx_settings, + bool do_bgpic, bool do_sky, bool UNUSED(is_persp), const char *viewname, + GPUFXSettings *UNUSED(fx_settings), GPUOffScreen *ofs, GPUViewport *viewport) { - bool do_compositing = false; RegionView3D *rv3d = ar->regiondata; /* set temporary new size */ @@ -2035,30 +2033,7 @@ void ED_view3d_draw_offscreen( /* main drawing call */ RenderEngineType *engine_type = eval_ctx->engine_type; if (engine_type->flag & RE_USE_LEGACY_PIPELINE) { - - /* framebuffer fx needed, we need to draw offscreen first */ - if (v3d->fx_settings.fx_flag && fx) { - GPUSSAOSettings *ssao = NULL; - - if (v3d->drawtype < OB_SOLID) { - ssao = v3d->fx_settings.ssao; - v3d->fx_settings.ssao = NULL; - } - - do_compositing = GPU_fx_compositor_initialize_passes(fx, &ar->winrct, NULL, fx_settings); - - if (ssao) - v3d->fx_settings.ssao = ssao; - } - - VP_deprecated_view3d_draw_objects(NULL, eval_ctx, scene, v3d, ar, NULL, do_bgpic, true, do_compositing ? fx : NULL); - - /* post process */ - if (do_compositing) { - if (!winmat) - is_persp = rv3d->is_persp; - GPU_fx_do_composite_pass(fx, winmat, is_persp, scene, ofs); - } + VP_deprecated_view3d_draw_objects(NULL, eval_ctx, scene, v3d, ar, NULL, do_bgpic, true); if ((v3d->flag2 & V3D_RENDER_SHADOW) == 0) { /* draw grease-pencil stuff */ @@ -2104,7 +2079,7 @@ ImBuf *ED_view3d_draw_offscreen_imbuf( unsigned int flag, unsigned int draw_flags, int alpha_mode, int samples, const char *viewname, /* output vars */ - GPUFX *fx, GPUOffScreen *ofs, char err_out[256]) + GPUOffScreen *ofs, char err_out[256]) { const Depsgraph *depsgraph = eval_ctx->depsgraph; RegionView3D *rv3d = ar->regiondata; @@ -2178,7 +2153,7 @@ ImBuf *ED_view3d_draw_offscreen_imbuf( ED_view3d_draw_offscreen( eval_ctx, scene, view_layer, v3d, ar, sizex, sizey, NULL, winmat, draw_background, draw_sky, !is_ortho, viewname, - fx, &fx_settings, ofs, NULL); + &fx_settings, ofs, NULL); if (ibuf->rect_float) { GPU_offscreen_read_pixels(ofs, GL_FLOAT, ibuf->rect_float); @@ -2202,7 +2177,7 @@ ImBuf *ED_view3d_draw_offscreen_imbuf( ED_view3d_draw_offscreen( eval_ctx, scene, view_layer, v3d, ar, sizex, sizey, NULL, winmat, draw_background, draw_sky, !is_ortho, viewname, - fx, &fx_settings, ofs, viewport); + &fx_settings, ofs, viewport); GPU_offscreen_read_pixels(ofs, GL_FLOAT, accum_buffer); /* skip the first sample */ @@ -2216,7 +2191,7 @@ ImBuf *ED_view3d_draw_offscreen_imbuf( ED_view3d_draw_offscreen( eval_ctx, scene, view_layer, v3d, ar, sizex, sizey, NULL, winmat_jitter, draw_background, draw_sky, !is_ortho, viewname, - fx, &fx_settings, ofs, viewport); + &fx_settings, ofs, viewport); GPU_offscreen_read_pixels(ofs, GL_FLOAT, rect_temp); unsigned int i = sizex * sizey * 4; @@ -2281,7 +2256,7 @@ ImBuf *ED_view3d_draw_offscreen_imbuf_simple( Object *camera, int width, int height, unsigned int flag, unsigned int draw_flags, int drawtype, int alpha_mode, int samples, const char *viewname, - GPUFX *fx, GPUOffScreen *ofs, char err_out[256]) + GPUOffScreen *ofs, char err_out[256]) { View3D v3d = {NULL}; ARegion ar = {NULL}; @@ -2340,7 +2315,7 @@ ImBuf *ED_view3d_draw_offscreen_imbuf_simple( return ED_view3d_draw_offscreen_imbuf( eval_ctx, scene, view_layer, &v3d, &ar, width, height, flag, - draw_flags, alpha_mode, samples, viewname, fx, ofs, err_out); + draw_flags, alpha_mode, samples, viewname, ofs, err_out); } /** \} */ diff --git a/source/blender/editors/space_view3d/view3d_draw_legacy.c b/source/blender/editors/space_view3d/view3d_draw_legacy.c index 775169e0b45..b7a1c8663f4 100644 --- a/source/blender/editors/space_view3d/view3d_draw_legacy.c +++ b/source/blender/editors/space_view3d/view3d_draw_legacy.c @@ -100,7 +100,6 @@ #include "GPU_framebuffer.h" #include "GPU_lamp.h" #include "GPU_material.h" -#include "GPU_compositing.h" #include "GPU_extensions.h" #include "GPU_immediate.h" #include "GPU_immediate_util.h" @@ -1425,7 +1424,7 @@ static void gpu_update_lamps_shadows_world(const EvaluationContext *eval_ctx, Sc ED_view3d_draw_offscreen( eval_ctx, scene, eval_ctx->view_layer, v3d, &ar, winsize, winsize, viewmat, winmat, false, false, true, - NULL, NULL, NULL, NULL, NULL); + NULL, NULL, NULL, NULL); GPU_lamp_shadow_buffer_unbind(shadow->lamp); v3d->drawtype = drawtype; @@ -1499,7 +1498,7 @@ static void view3d_draw_objects( const EvaluationContext *eval_ctx, Scene *scene, View3D *v3d, ARegion *ar, const char **grid_unit, - const bool do_bgpic, const bool draw_offscreen, GPUFX *fx) + const bool do_bgpic, const bool draw_offscreen) { ViewLayer *view_layer = C ? CTX_data_view_layer(C) : BKE_view_layer_from_scene_get(scene); Depsgraph *depsgraph = CTX_data_depsgraph(C); @@ -1510,8 +1509,7 @@ static void view3d_draw_objects( const bool draw_grids = !draw_offscreen && (v3d->flag2 & V3D_RENDER_OVERRIDE) == 0; const bool draw_floor = (rv3d->view == RV3D_VIEW_USER) || (rv3d->persp != RV3D_ORTHO); /* only draw grids after in solid modes, else it hovers over mesh wires */ - const bool draw_grids_after = draw_grids && draw_floor && (v3d->drawtype > OB_WIRE) && fx; - bool do_composite_xray = false; + const bool draw_grids_after = draw_grids && draw_floor && (v3d->drawtype > OB_WIRE); bool xrayclear = true; if (!draw_offscreen) { @@ -1636,19 +1634,9 @@ static void view3d_draw_objects( /* transp and X-ray afterdraw stuff */ if (v3d->afterdraw_transp.first) view3d_draw_transp(eval_ctx, scene, view_layer, ar, v3d); - /* always do that here to cleanup depth buffers if none needed */ - if (fx) { - do_composite_xray = v3d->zbuf && (v3d->afterdraw_xray.first || v3d->afterdraw_xraytransp.first); - GPU_fx_compositor_setup_XRay_pass(fx, do_composite_xray); - } - if (v3d->afterdraw_xray.first) view3d_draw_xray(eval_ctx, scene, view_layer, ar, v3d, &xrayclear); if (v3d->afterdraw_xraytransp.first) view3d_draw_xraytransp(eval_ctx, scene, view_layer, ar, v3d, xrayclear); - if (fx && do_composite_xray) { - GPU_fx_compositor_XRay_resolve(fx); - } - if (!draw_offscreen) { ED_region_draw_cb_draw(C, ar, REGION_DRAW_POST_VIEW); } @@ -1957,9 +1945,6 @@ static void view3d_main_region_draw_objects( CTX_data_eval_ctx(C, &eval_ctx); - /* post processing */ - bool do_compositing = false; - /* shadow buffers, before we setup matrices */ if (draw_glsl_material(&eval_ctx, scene, view_layer, NULL, v3d, v3d->drawtype)) gpu_update_lamps_shadows_world(&eval_ctx, scene, v3d); @@ -1987,30 +1972,9 @@ static void view3d_main_region_draw_objects( update_lods(scene, rv3d->viewinv[3]); } #endif - - /* framebuffer fx needed, we need to draw offscreen first */ - if (v3d->fx_settings.fx_flag && v3d->drawtype >= OB_SOLID) { - BKE_screen_gpu_fx_validate(&v3d->fx_settings); - GPUFXSettings fx_settings = v3d->fx_settings; - if (!rv3d->compositor) - rv3d->compositor = GPU_fx_compositor_create(); - - if (rv3d->persp == RV3D_CAMOB && v3d->camera) - BKE_camera_to_gpu_dof(v3d->camera, &fx_settings); - else { - fx_settings.dof = NULL; - } - - do_compositing = GPU_fx_compositor_initialize_passes(rv3d->compositor, &ar->winrct, &ar->drawrct, &fx_settings); - } /* main drawing call */ - view3d_draw_objects(C, &eval_ctx, scene, v3d, ar, grid_unit, true, false, do_compositing ? rv3d->compositor : NULL); - - /* post process */ - if (do_compositing) { - GPU_fx_do_composite_pass(rv3d->compositor, rv3d->winmat, rv3d->is_persp, scene, NULL); - } + view3d_draw_objects(C, &eval_ctx, scene, v3d, ar, grid_unit, true, false); if (v3d->lay_used != lay_used) { /* happens when loading old files or loading with UI load */ /* find header and force tag redraw */ @@ -2170,9 +2134,9 @@ void VP_deprecated_view3d_draw_objects( const EvaluationContext *eval_ctx, Scene *scene, View3D *v3d, ARegion *ar, const char **grid_unit, - const bool do_bgpic, const bool draw_offscreen, GPUFX *fx) + const bool do_bgpic, const bool draw_offscreen) { - view3d_draw_objects(C, eval_ctx, scene, v3d, ar, grid_unit, do_bgpic, draw_offscreen, fx); + view3d_draw_objects(C, eval_ctx, scene, v3d, ar, grid_unit, do_bgpic, draw_offscreen); } void VP_deprecated_gpu_update_lamps_shadows_world(const EvaluationContext *eval_ctx, Scene *scene, View3D *v3d) diff --git a/source/blender/editors/space_view3d/view3d_intern.h b/source/blender/editors/space_view3d/view3d_intern.h index 0eb7a964fdf..56e5c4e932c 100644 --- a/source/blender/editors/space_view3d/view3d_intern.h +++ b/source/blender/editors/space_view3d/view3d_intern.h @@ -402,6 +402,6 @@ void VP_deprecated_view3d_draw_objects( const struct EvaluationContext *eval_ctx, Scene *scene, View3D *v3d, ARegion *ar, const char **grid_unit, - const bool do_bgpic, const bool draw_offscreen, struct GPUFX *fx); + const bool do_bgpic, const bool draw_offscreen); #endif /* __VIEW3D_INTERN_H__ */ |