GPUCompositing: Remove entire module.
authorClément Foucault <foucault.clem@gmail.com>
Thu, 22 Mar 2018 15:10:54 +0000 (16:10 +0100)
committerClément Foucault <foucault.clem@gmail.com>
Thu, 22 Mar 2018 15:11:49 +0000 (16:11 +0100)
This module has no use now with the new DrawManager and DrawEngines and it
is using deprecated paths.

Moving gpu_shader_fullscreen_vert.glsl
to draw/modes/shaders/common_fullscreen_vert.glsl

27 files changed:
source/blender/blenkernel/BKE_screen.h
source/blender/blenkernel/BKE_sequencer.h
source/blender/blenkernel/intern/camera.c
source/blender/blenkernel/intern/screen.c
source/blender/blenkernel/intern/sequencer.c
source/blender/draw/CMakeLists.txt
source/blender/draw/engines/eevee/eevee_volumes.c
source/blender/draw/intern/draw_manager_shader.c
source/blender/draw/modes/object_mode.c
source/blender/draw/modes/shaders/common_fullscreen_vert.glsl [moved from source/blender/gpu/shaders/gpu_shader_fullscreen_vert.glsl with 100% similarity]
source/blender/editors/include/ED_view3d.h
source/blender/editors/render/render_opengl.c
source/blender/editors/sculpt_paint/paint_image_proj.c
source/blender/editors/space_sequencer/sequencer_draw.c
source/blender/editors/space_sequencer/space_sequencer.c
source/blender/editors/space_view3d/space_view3d.c
source/blender/editors/space_view3d/view3d_draw.c
source/blender/editors/space_view3d/view3d_draw_legacy.c
source/blender/editors/space_view3d/view3d_intern.h
source/blender/gpu/CMakeLists.txt
source/blender/gpu/GPU_compositing.h [deleted file]
source/blender/gpu/GPU_shader.h
source/blender/gpu/intern/gpu_compositing.c [deleted file]
source/blender/gpu/intern/gpu_shader.c
source/blender/makesrna/intern/rna_scene.c
source/blender/python/intern/gpu_offscreen.c
source/blender/windowmanager/intern/wm_files.c

index 3957641fe3f3146d3ebf01e5003a1c8261a0614f..fd6b3d20fb741f810fd829ad9055e2e418e257c7 100644 (file)
@@ -327,7 +327,6 @@ void BKE_screen_view3d_scene_sync(struct bScreen *sc, struct Scene *scene);
 void BKE_screen_transform_orientation_remove(
         const struct bScreen *screen, const struct WorkSpace *workspace,
         const struct TransformOrientation *orientation) ATTR_NONNULL();
-void BKE_screen_gpu_fx_validate(struct GPUFXSettings *fx_settings);
 bool BKE_screen_is_fullscreen_area(const struct bScreen *screen) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
 bool BKE_screen_is_used(const struct bScreen *screen) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
 
index 62e09809dea782d3f2f1da52b716edc32b69a351..140f3dd513de2f05d17093736aabeb80c8b09d37 100644 (file)
@@ -438,7 +438,7 @@ typedef struct ImBuf *(*SequencerDrawView)(
         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]);
 extern SequencerDrawView sequencer_view3d_cb;
 
 /* copy/paste */
index 869e312614e726c285b1066d45a939bf31610624..4431ce38c23a24ea6bbcbdbfe93426cb870538da 100644 (file)
@@ -61,8 +61,6 @@
 
 #include "MEM_guardedalloc.h"
 
-#include "GPU_compositing.h"
-
 /****************************** Camera Datablock *****************************/
 
 void BKE_camera_init(Camera *cam)
@@ -79,8 +77,6 @@ void BKE_camera_init(Camera *cam)
        cam->flag |= CAM_SHOWPASSEPARTOUT;
        cam->passepartalpha = 0.5f;
 
-       GPU_fx_compositor_init_dof_settings(&cam->gpu_dof);
-
        /* stereoscopy 3d */
        cam->stereo.interocular_distance = 0.065f;
        cam->stereo.convergence_distance = 30.f * 0.065f;
index a985fb9275aceeefe48b8b45aafb9ae5da145e8c..c1b3a4ae0c8a0bad9b368077d7281d2a030b80f5 100644 (file)
@@ -39,8 +39,6 @@
 
 #include "MEM_guardedalloc.h"
 
-#include "GPU_compositing.h"
-
 #include "DNA_scene_types.h"
 #include "DNA_screen_types.h"
 #include "DNA_space_types.h"
@@ -684,29 +682,6 @@ float BKE_screen_view3d_zoom_from_fac(float zoomfac)
        return ((sqrtf(4.0f * zoomfac) - (float)M_SQRT2) * 50.0f);
 }
 
-void BKE_screen_gpu_fx_validate(GPUFXSettings *fx_settings)
-{
-       /* currently we use DOF from the camera _only_,
-        * so we never allocate this, only copy from the Camera */
-#if 0
-       if ((fx_settings->dof == NULL) &&
-           (fx_settings->fx_flag & GPU_FX_FLAG_DOF))
-       {
-               GPUDOFSettings *fx_dof;
-               fx_dof = fx_settings->dof = MEM_callocN(sizeof(GPUDOFSettings), __func__);
-       }
-#endif
-
-       if ((fx_settings->ssao == NULL) &&
-           (fx_settings->fx_flag & GPU_FX_FLAG_SSAO))
-       {
-               GPUSSAOSettings *fx_ssao;
-               fx_ssao = fx_settings->ssao = MEM_callocN(sizeof(GPUSSAOSettings), __func__);
-
-               GPU_fx_compositor_init_ssao_settings(fx_ssao);
-       }
-}
-
 bool BKE_screen_is_fullscreen_area(const bScreen *screen)
 {
        return ELEM(screen->state, SCREENMAXIMIZED, SCREENFULL);
index 66221dd470f00aea6a887f9e8eb38492e51fc27e..5a6f33e0e8cc92c47a65112674c2b829260d8fa2 100644 (file)
@@ -3337,7 +3337,7 @@ static ImBuf *seq_render_scene_strip(const SeqRenderData *context, Sequence *seq
                        context->eval_ctx, scene, view_layer, camera, width, height, IB_rect,
                        draw_flags, context->scene->r.seq_prev_type,
                        scene->r.alphamode, context->gpu_samples, viewname,
-                       context->gpu_fx, context->gpu_offscreen, err_out);
+                       context->gpu_offscreen, err_out);
                if (ibuf == NULL) {
                        fprintf(stderr, "seq_render_scene_strip failed to get opengl buffer: %s\n", err_out);
                }
index 733e4b0b52412113d42076f4ffe88975003dec7a..f7d3a37246eb86e6ec39580fba774a92cc1e7a3e 100644 (file)
@@ -208,6 +208,7 @@ data_to_c_simple(engines/eevee/shaders/volumetric_integration_frag.glsl SRC)
 data_to_c_simple(modes/shaders/common_globals_lib.glsl SRC)
 data_to_c_simple(modes/shaders/common_view_lib.glsl SRC)
 data_to_c_simple(modes/shaders/common_fxaa_lib.glsl SRC)
+data_to_c_simple(modes/shaders/common_fullscreen_vert.glsl SRC)
 data_to_c_simple(modes/shaders/edit_mesh_overlay_frag.glsl SRC)
 data_to_c_simple(modes/shaders/edit_mesh_overlay_vert.glsl SRC)
 data_to_c_simple(modes/shaders/edit_mesh_overlay_geom_tri.glsl SRC)
index 0c0ffa391463a5663e617682209f2b1cb3f6c75a..85b168d1075c90b2aa6aeed79a3b6f25c76d9fe7 100644 (file)
@@ -76,7 +76,7 @@ extern char datatoc_volumetric_resolve_frag_glsl[];
 extern char datatoc_volumetric_scatter_frag_glsl[];
 extern char datatoc_volumetric_integration_frag_glsl[];
 extern char datatoc_volumetric_lib_glsl[];
-extern char datatoc_gpu_shader_fullscreen_vert_glsl[];
+extern char datatoc_common_fullscreen_vert_glsl[];
 
 static void eevee_create_shader_volumes(void)
 {
@@ -126,7 +126,7 @@ static void eevee_create_shader_volumes(void)
                datatoc_volumetric_integration_frag_glsl,
                e_data.volumetric_common_lib, NULL);
        e_data.volumetric_resolve_sh = DRW_shader_create_with_lib(
-               datatoc_gpu_shader_fullscreen_vert_glsl, NULL,
+               datatoc_common_fullscreen_vert_glsl, NULL,
                datatoc_volumetric_resolve_frag_glsl,
                e_data.volumetric_common_lib, NULL);
 }
index d150bcc8d568ee22478a4967aa92c58d29bf6468..5b4971f073057a452ecd97582a638bb71a44ebbd 100644 (file)
@@ -45,7 +45,7 @@
 
 extern char datatoc_gpu_shader_2D_vert_glsl[];
 extern char datatoc_gpu_shader_3D_vert_glsl[];
-extern char datatoc_gpu_shader_fullscreen_vert_glsl[];
+extern char datatoc_common_fullscreen_vert_glsl[];
 
 
 /* -------------------------------------------------------------------- */
@@ -297,7 +297,7 @@ GPUShader *DRW_shader_create_3D(const char *frag, const char *defines)
 
 GPUShader *DRW_shader_create_fullscreen(const char *frag, const char *defines)
 {
-       return GPU_shader_create(datatoc_gpu_shader_fullscreen_vert_glsl, frag, NULL, NULL, defines);
+       return GPU_shader_create(datatoc_common_fullscreen_vert_glsl, frag, NULL, NULL, defines);
 }
 
 GPUShader *DRW_shader_create_3D_depth_only(void)
index ccdac1f8687d3d3278ebe9a311142ff2e743b548..b5127ca634d355ebc17f9470fd90c287cea83ba6 100644 (file)
@@ -83,7 +83,7 @@ extern char datatoc_object_particle_dot_frag_glsl[];
 extern char datatoc_common_globals_lib_glsl[];
 extern char datatoc_common_fxaa_lib_glsl[];
 extern char datatoc_gpu_shader_flat_color_frag_glsl[];
-extern char datatoc_gpu_shader_fullscreen_vert_glsl[];
+extern char datatoc_common_fullscreen_vert_glsl[];
 extern char datatoc_gpu_shader_uniform_color_frag_glsl[];
 
 /* *********** LISTS *********** */
@@ -307,7 +307,7 @@ static void OBJECT_engine_init(void *vedata)
 
        if (!e_data.outline_resolve_aa_sh) {
                e_data.outline_resolve_aa_sh = DRW_shader_create_with_lib(
-                           datatoc_gpu_shader_fullscreen_vert_glsl, NULL,
+                           datatoc_common_fullscreen_vert_glsl, NULL,
                            datatoc_object_outline_resolve_frag_glsl,
                            datatoc_common_fxaa_lib_glsl,
                            "#define FXAA_ALPHA\n"
index 64d749dc7a7490b2449f8944f7aebedba3334259..1619c59ddaca1b1d5a7bb8dd899d01295364d19d 100644 (file)
@@ -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);
index 1f9894b3b9f109647f62268ef6557c4a04c3e923..47e4fc5135139879690a6d4844ee6a3c624abaec 100644 (file)
@@ -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();
index ae5b825e4ae2491674db778378a80c0069b34123..21612339eb5a02fca82a3daf729baf4658fda9db 100644 (file)
@@ -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 */
index db0593ef2d16bb6d607df1d12993ff98ceb969de..f6d18ad0a52c07d1f62068c339e2ecfae41b522f 100644 (file)
@@ -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
index 23387f291e6dba900ccc0869c3660be69262ab1e..da16ac5acaa93037b91be6bab11c3caecf29de31 100644 (file)
@@ -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;
-       }
 }
 
 
index 89e84052c9bd8e9a050c7c2b5ee97ee3ab08e5a2..3cf915cd0298a48889793ce17840cfd1b381c3f6 100644 (file)
@@ -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);
index b14128ab400728b2ade70c28db3208e1913ed968..34db99b5a5da2dd400b62b3e989bcc0c63fc5579 100644 (file)
@@ -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);
 }
 
 /** \} */
index 775169e0b454f94dc6e72d8a3a3f62204ab3d726..b7a1c8663f4a7d6bdaa83cc15ccba3457dae1449 100644 (file)
 #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)
index 0eb7a964fdf44589d8fbbb18947fff9eb8247000..56e5c4e932c9e405466aff3a8027112f70cabb46 100644 (file)
@@ -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__ */
index 5c0115d967ae0fccf82023b8e3f1315d9ba72f2a..e1f99b4dc649b3888c8bfb8a75267523c5900b1e 100644 (file)
@@ -55,7 +55,6 @@ set(SRC
        intern/gpu_batch_presets.c
        intern/gpu_buffers.c
        intern/gpu_codegen.c
-       intern/gpu_compositing.c
        intern/gpu_debug.c
        intern/gpu_draw.c
        intern/gpu_extensions.c
@@ -99,7 +98,6 @@ set(SRC
        GPU_basic_shader.h
        GPU_batch.h
        GPU_buffers.h
-       GPU_compositing.h
        GPU_debug.h
        GPU_draw.h
        GPU_extensions.h
@@ -222,15 +220,6 @@ data_to_c_simple(shaders/gpu_shader_vertex.glsl SRC)
 data_to_c_simple(shaders/gpu_shader_vertex_world.glsl SRC)
 data_to_c_simple(shaders/gpu_shader_vsm_store_frag.glsl SRC)
 data_to_c_simple(shaders/gpu_shader_vsm_store_vert.glsl SRC)
-data_to_c_simple(shaders/gpu_shader_fullscreen_vert.glsl SRC)
-data_to_c_simple(shaders/gpu_shader_fx_ssao_frag.glsl SRC)
-data_to_c_simple(shaders/gpu_shader_fx_dof_frag.glsl SRC)
-data_to_c_simple(shaders/gpu_shader_fx_dof_vert.glsl SRC)
-data_to_c_simple(shaders/gpu_shader_fx_dof_hq_frag.glsl SRC)
-data_to_c_simple(shaders/gpu_shader_fx_dof_hq_vert.glsl SRC)
-data_to_c_simple(shaders/gpu_shader_fx_dof_hq_geo.glsl SRC)
-data_to_c_simple(shaders/gpu_shader_fx_depth_resolve.glsl SRC)
-data_to_c_simple(shaders/gpu_shader_fx_lib.glsl SRC)
 
 if(WITH_GAMEENGINE)
        add_definitions(-DWITH_GAMEENGINE)
diff --git a/source/blender/gpu/GPU_compositing.h b/source/blender/gpu/GPU_compositing.h
deleted file mode 100644 (file)
index d506d91..0000000
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2005 Blender Foundation.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Antony Riakiotakis.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file GPU_compositing.h
- *  \ingroup gpu
- */
-
-#ifndef __GPU_COMPOSITING_H__
-#define __GPU_COMPOSITING_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* opaque handle for framebuffer compositing effects (defined in gpu_compositing.c )*/
-typedef struct GPUFX GPUFX;
-struct GPUDOFSettings;
-struct GPUSSAOSettings;
-struct GPUOffScreen;
-struct GPUFXSettings;
-struct rcti;
-struct Scene;
-struct GPUShader;
-enum eGPUFXFlags;
-
-/**** Public API *****/
-
-typedef enum GPUFXShaderEffect {
-       /* Screen space ambient occlusion shader */
-       GPU_SHADER_FX_SSAO = 1,
-
-       /* depth of field passes. Yep, quite a complex effect */
-       GPU_SHADER_FX_DEPTH_OF_FIELD_PASS_ONE = 2,
-       GPU_SHADER_FX_DEPTH_OF_FIELD_PASS_TWO = 3,
-       GPU_SHADER_FX_DEPTH_OF_FIELD_PASS_THREE = 4,
-       GPU_SHADER_FX_DEPTH_OF_FIELD_PASS_FOUR = 5,
-       GPU_SHADER_FX_DEPTH_OF_FIELD_PASS_FIVE = 6,
-
-       /* high quality */
-       GPU_SHADER_FX_DEPTH_OF_FIELD_HQ_PASS_ONE = 7,
-       GPU_SHADER_FX_DEPTH_OF_FIELD_HQ_PASS_TWO = 8,
-       GPU_SHADER_FX_DEPTH_OF_FIELD_HQ_PASS_THREE = 9,
-
-       GPU_SHADER_FX_DEPTH_RESOLVE = 10,
-} GPUFXShaderEffect;
-
-/* keep in synch with enum above! */
-#define MAX_FX_SHADERS 11
-
-/* generate a new FX compositor */
-GPUFX *GPU_fx_compositor_create(void);
-
-/* destroy a text compositor */
-void GPU_fx_compositor_destroy(GPUFX *fx);
-
-/* initialize a framebuffer with size taken from the viewport */
-bool GPU_fx_compositor_initialize_passes(
-        GPUFX *fx, const struct rcti *rect, const struct rcti *scissor_rect,
-        const struct GPUFXSettings *fx_settings);
-
-/* do compositing on the fx passes that have been initialized */
-bool GPU_fx_do_composite_pass(
-        GPUFX *fx, float projmat[4][4], bool is_persp,
-        struct Scene *scene, struct GPUOffScreen *ofs);
-
-/* bind new depth buffer for XRay pass */
-void GPU_fx_compositor_setup_XRay_pass(GPUFX *fx, bool do_xray);
-
-/* resolve a final depth buffer by compositing the XRay and normal depth buffers */
-void GPU_fx_compositor_XRay_resolve(GPUFX *fx);
-
-void GPU_fx_compositor_init_dof_settings(struct GPUDOFSettings *dof);
-void GPU_fx_compositor_init_ssao_settings(struct GPUSSAOSettings *ssao);
-
-
-/* initialize and cache the shader unform interface for effects */
-void GPU_fx_shader_init_interface(struct GPUShader *shader, GPUFXShaderEffect effect);
-#ifdef __cplusplus
-}
-#endif
-
-#endif // __GPU_COMPOSITING_H__
index def0b0bfbc7fb55a1e541ebed00ffc17b71fc791..41218bd2edfff531c84023fb92deb6630365d829 100644 (file)
@@ -72,9 +72,6 @@ int GPU_shader_get_program(GPUShader *shader);
 
 void *GPU_shader_get_interface(GPUShader *shader);
 
-void *GPU_fx_shader_get_interface(GPUShader *shader);
-void GPU_fx_shader_set_interface(GPUShader *shader, void *interface);
-
 int GPU_shader_get_uniform(GPUShader *shader, const char *name);
 int GPU_shader_get_builtin_uniform(GPUShader *shader, int builtin);
 int GPU_shader_get_uniform_block(GPUShader *shader, const char *name);
@@ -191,7 +188,6 @@ typedef enum GPUInterlaceShader {
 } GPUInterlaceShader;
 
 GPUShader *GPU_shader_get_builtin_shader(GPUBuiltinShader shader);
-GPUShader *GPU_shader_get_builtin_fx_shader(int effects, bool persp);
 
 void GPU_shader_free_builtin_shaders(void);
 
diff --git a/source/blender/gpu/intern/gpu_compositing.c b/source/blender/gpu/intern/gpu_compositing.c
deleted file mode 100644 (file)
index ca81ca7..0000000
+++ /dev/null
@@ -1,1494 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2006 Blender Foundation.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Antony Riakiotakis.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file blender/gpu/intern/gpu_compositing.c
- *  \ingroup gpu
- *
- * System that manages framebuffer compositing.
- */
-
-#include "BLI_sys_types.h"
-#include "BLI_rect.h"
-#include "BLI_math.h"
-
-#include "BLI_rand.h"
-
-#include "DNA_vec_types.h"
-#include "DNA_scene_types.h"
-#include "DNA_gpu_types.h"
-
-#include "GPU_compositing.h"
-#include "GPU_draw.h"
-#include "GPU_extensions.h"
-#include "GPU_framebuffer.h"
-#include "GPU_glew.h"
-#include "GPU_shader.h"
-#include "GPU_texture.h"
-#include "GPU_batch.h"
-
-#include "MEM_guardedalloc.h"
-
-static const float fullscreencos[4][2] = {{-1.0f, -1.0f}, {1.0f, -1.0f}, {-1.0f, 1.0f}, {1.0f, 1.0f}};
-static const float fullscreenuvs[4][2] = {{0.0f, 0.0f}, {1.0f, 0.0f}, {0.0f, 1.0f}, {1.0f, 1.0f}};
-
-
-/* shader interfaces (legacy GL 2 style, without uniform buffer objects) */
-
-typedef struct {
-       int ssao_uniform;
-       int ssao_color_uniform;
-       int color_uniform;
-       int depth_uniform;
-       int viewvecs_uniform;
-       int ssao_sample_params_uniform;
-       int ssao_concentric_tex;
-       int ssao_jitter_uniform;
-} GPUSSAOShaderInterface;
-
-typedef struct {
-       int invrendertargetdim_uniform;
-       int color_uniform;
-       int dof_uniform;
-       int depth_uniform;
-       int viewvecs_uniform;
-} GPUDOFHQPassOneInterface;
-
-typedef struct {
-       int rendertargetdim_uniform;
-       int color_uniform;
-       int coc_uniform;
-       int select_uniform;
-       int dof_uniform;
-} GPUDOFHQPassTwoInterface;
-
-typedef struct {
-       int dof_uniform;
-       int invrendertargetdim_uniform;
-       int color_uniform;
-       int far_uniform;
-       int near_uniform;
-       int viewvecs_uniform;
-       int depth_uniform;
-} GPUDOFHQPassThreeInterface;
-
-typedef struct {
-       int dof_uniform;
-       int invrendertargetdim_uniform;
-       int color_uniform;
-       int depth_uniform;
-       int viewvecs_uniform;
-} GPUDOFPassOneInterface;
-
-typedef struct {
-       int dof_uniform;
-       int invrendertargetdim_uniform;
-       int color_uniform;
-       int depth_uniform;
-       int viewvecs_uniform;
-} GPUDOFPassTwoInterface;
-
-typedef struct {
-       int near_coc_downsampled;
-       int near_coc_blurred;
-} GPUDOFPassThreeInterface;
-
-typedef struct {
-       int near_coc_downsampled;
-       int invrendertargetdim_uniform;
-} GPUDOFPassFourInterface;
-
-typedef struct {
-       int medium_blurred_uniform;
-       int high_blurred_uniform;
-       int dof_uniform;
-       int invrendertargetdim_uniform;
-       int original_uniform;
-       int depth_uniform;
-       int viewvecs_uniform;
-} GPUDOFPassFiveInterface;
-
-typedef struct {
-       int depth_uniform;
-} GPUDepthResolveInterface;
-
-
-struct GPUFX {
-       /* we borrow the term gbuffer from deferred rendering however this is just a regular
-        * depth/color framebuffer. Could be extended later though */
-       GPUFrameBuffer *gbuffer;
-
-       /* dimensions of the gbuffer */
-       int gbuffer_dim[2];
-
-       /* texture bound to the first color attachment of the gbuffer */
-       GPUTexture *color_buffer;
-
-       /* second texture used for ping-pong compositing */
-       GPUTexture *color_buffer_sec;
-       /* texture bound to the depth attachment of the gbuffer */
-       GPUTexture *depth_buffer;
-       GPUTexture *depth_buffer_xray;
-
-       /* texture used for jittering for various effects */
-       GPUTexture *jitter_buffer;
-
-       /* all those buffers below have to coexist.
-        * Fortunately they are all quarter sized (1/16th of memory) of original framebuffer */
-       int dof_downsampled_w;
-       int dof_downsampled_h;
-
-       /* texture used for near coc and color blurring calculation */
-       GPUTexture *dof_near_coc_buffer;
-       /* blurred near coc buffer. */
-       GPUTexture *dof_near_coc_blurred_buffer;
-       /* final near coc buffer. */
-       GPUTexture *dof_near_coc_final_buffer;
-
-       /* half size blur buffer */
-       GPUTexture *dof_half_downsampled_near;
-       GPUTexture *dof_half_downsampled_far;
-       /* high quality dof texture downsamplers. 6 levels means 64 pixels wide - should be enough */
-       GPUTexture *dof_nearfar_coc;
-       GPUTexture *dof_near_blur;
-       GPUTexture *dof_far_blur;
-
-       /* for high quality we use again a spiral texture with radius adapted */
-       bool dof_high_quality;
-
-       /* texture used for ssao */
-       int ssao_sample_count_cache;
-       GPUTexture *ssao_spiral_samples_tex;
-
-
-       GPUFXSettings settings;
-
-       /* or-ed flags of enabled effects */
-       int effects;
-
-       /* number of passes, needed to detect if ping pong buffer allocation is needed */
-       int num_passes;
-
-       /* we have a stencil, restore the previous state */
-       bool restore_stencil;
-
-       Gwn_Batch *quad_batch;
-       Gwn_Batch *point_batch;
-};
-
-#if 0
-/* concentric mapping, see "A Low Distortion Map Between Disk and Square" and
- * http://psgraphics.blogspot.nl/2011/01/improved-code-for-concentric-map.html */
-static GPUTexture * create_concentric_sample_texture(int side)
-{
-       GPUTexture *tex;
-       float midpoint = 0.5f * (side - 1);
-       float *texels = (float *)MEM_mallocN(sizeof(float) * 2 * side * side, "concentric_tex");
-       int i, j;
-
-       for (i = 0; i < side; i++) {
-               for (j = 0; j < side; j++) {
-                       int index = (i * side + j) * 2;
-                       float a = 1.0f - i / midpoint;
-                       float b = 1.0f - j / midpoint;
-                       float phi, r;
-                       if (a * a > b * b) {
-                               r = a;
-                               phi = (M_PI_4) * (b / a);
-                       }
-                       else {
-                               r = b;
-                               phi = M_PI_2 - (M_PI_4) * (a / b);
-                       }
-                       texels[index] = r * cos(phi);
-                       texels[index + 1] = r * sin(phi);
-               }
-       }
-
-       tex = GPU_texture_create_1D_custom(side * side, 2, GPU_RG16F, (float *)texels, NULL);
-
-       /* Set parameters */
-       GPU_texture_bind(tex, 0);
-       GPU_texture_filter_mode(tex, false);
-       GPU_texture_unbind(tex);
-
-       MEM_freeN(texels);
-       return tex;
-}
-#endif
-
-static GPUTexture *create_spiral_sample_texture(int numsaples)
-{
-       GPUTexture *tex;
-       float (*texels)[2] = MEM_mallocN(sizeof(float[2]) * numsaples, "concentric_tex");
-       const float numsaples_inv = 1.0f / numsaples;
-       int i;
-       /* arbitrary number to ensure we don't get conciding samples every circle */
-       const float spirals = 7.357;
-
-       for (i = 0; i < numsaples; i++) {
-               float r = (i + 0.5f) * numsaples_inv;
-               float phi = r * spirals * (float)(2.0 * M_PI);
-               texels[i][0] = r * cosf(phi);
-               texels[i][1] = r * sinf(phi);
-       }
-
-       tex = GPU_texture_create_1D_custom(numsaples, 2, GPU_RG16F, (float *)texels, NULL);
-
-       /* Set parameters */
-       GPU_texture_bind(tex, 0);
-       GPU_texture_filter_mode(tex, false);
-       GPU_texture_unbind(tex);
-
-       MEM_freeN(texels);
-       return tex;
-}
-
-/* generate a new FX compositor */
-GPUFX *GPU_fx_compositor_create(void)
-{
-       GPUFX *fx = MEM_callocN(sizeof(GPUFX), "GPUFX compositor");
-
-       /* Quad buffer */
-       static Gwn_VertFormat format = {0};
-       static unsigned int pos, uvs;
-       if (format.attrib_ct == 0) {
-               pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
-               uvs = GWN_vertformat_attr_add(&format, "uvs", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
-       }
-       Gwn_VertBuf *vbo = GWN_vertbuf_create_with_format(&format);
-       GWN_vertbuf_data_alloc(vbo, 4);
-       for (int i = 0; i < 4; ++i) {
-               GWN_vertbuf_attr_set(vbo, pos, i, fullscreencos[i]);
-               GWN_vertbuf_attr_set(vbo, uvs, i, fullscreenuvs[i]);
-       }
-       fx->quad_batch = GWN_batch_create_ex(GWN_PRIM_TRI_STRIP, vbo, NULL, GWN_BATCH_OWNS_VBO);
-
-       /* Point Buffer */
-       static Gwn_VertFormat format_point = {0};
-       static unsigned int dummy_attrib;
-       if (format_point.attrib_ct == 0) {
-               dummy_attrib = GWN_vertformat_attr_add(&format_point, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
-       }
-       float dummy[2] = {0.0f, 0.0f};
-       Gwn_VertBuf *vbo_point = GWN_vertbuf_create_with_format(&format_point);
-       GWN_vertbuf_data_alloc(vbo_point, 1);
-       GWN_vertbuf_attr_set(vbo_point, dummy_attrib, 0, &dummy);
-       fx->point_batch = GWN_batch_create_ex(GWN_PRIM_POINTS, vbo_point, NULL, GWN_BATCH_OWNS_VBO);
-
-       return fx;
-}
-
-static void cleanup_fx_dof_buffers(GPUFX *fx)
-{
-       if (fx->dof_near_coc_blurred_buffer) {
-               GPU_texture_free(fx->dof_near_coc_blurred_buffer);
-               fx->dof_near_coc_blurred_buffer = NULL;
-       }
-       if (fx->dof_near_coc_buffer) {
-               GPU_texture_free(fx->dof_near_coc_buffer);
-               fx->dof_near_coc_buffer = NULL;
-       }
-       if (fx->dof_near_coc_final_buffer) {
-               GPU_texture_free(fx->dof_near_coc_final_buffer);
-               fx->dof_near_coc_final_buffer = NULL;
-       }
-
-       if (fx->dof_half_downsampled_near) {
-               GPU_texture_free(fx->dof_half_downsampled_near);
-               fx->dof_half_downsampled_near = NULL;
-       }
-       if (fx->dof_half_downsampled_far) {
-               GPU_texture_free(fx->dof_half_downsampled_far);
-               fx->dof_half_downsampled_far = NULL;
-       }
-       if (fx->dof_nearfar_coc) {
-               GPU_texture_free(fx->dof_nearfar_coc);
-               fx->dof_nearfar_coc = NULL;
-       }
-       if (fx->dof_near_blur) {
-               GPU_texture_free(fx->dof_near_blur);
-               fx->dof_near_blur = NULL;
-       }
-       if (fx->dof_far_blur) {
-               GPU_texture_free(fx->dof_far_blur);
-               fx->dof_far_blur = NULL;
-       }
-}
-
-static void cleanup_fx_gl_data(GPUFX *fx, bool do_fbo)
-{
-       if (fx->color_buffer) {
-               GPU_framebuffer_texture_detach(fx->color_buffer);
-               GPU_texture_free(fx->color_buffer);
-               fx->color_buffer = NULL;
-       }
-
-       if (fx->color_buffer_sec) {
-               GPU_framebuffer_texture_detach(fx->color_buffer_sec);
-               GPU_texture_free(fx->color_buffer_sec);
-               fx->color_buffer_sec = NULL;
-       }
-
-       if (fx->depth_buffer) {
-               GPU_framebuffer_texture_detach(fx->depth_buffer);
-               GPU_texture_free(fx->depth_buffer);
-               fx->depth_buffer = NULL;
-       }
-
-       if (fx->depth_buffer_xray) {
-               GPU_framebuffer_texture_detach(fx->depth_buffer_xray);
-               GPU_texture_free(fx->depth_buffer_xray);
-               fx->depth_buffer_xray = NULL;
-       }
-
-       cleanup_fx_dof_buffers(fx);
-
-       if (fx->ssao_spiral_samples_tex) {
-               GPU_texture_free(fx->ssao_spiral_samples_tex);
-               fx->ssao_spiral_samples_tex = NULL;
-       }
-
-       if (fx->jitter_buffer && do_fbo) {
-               GPU_texture_free(fx->jitter_buffer);
-               fx->jitter_buffer = NULL;
-       }
-
-       if (fx->gbuffer && do_fbo) {
-               GPU_framebuffer_free(fx->gbuffer);
-               fx->gbuffer = NULL;
-       }
-}
-
-/* destroy a text compositor */
-void GPU_fx_compositor_destroy(GPUFX *fx)
-{
-       cleanup_fx_gl_data(fx, true);
-       GWN_batch_discard(fx->quad_batch);
-       GWN_batch_discard(fx->point_batch);
-       MEM_freeN(fx);
-}
-
-static GPUTexture * create_jitter_texture(void)
-{
-       GPUTexture *tex;
-       float jitter[64 * 64][2];
-       int i;
-
-       for (i = 0; i < 64 * 64; i++) {
-               jitter[i][0] = 2.0f * BLI_frand() - 1.0f;
-               jitter[i][1] = 2.0f * BLI_frand() - 1.0f;
-               normalize_v2(jitter[i]);
-       }
-
-       tex = GPU_texture_create_2D_custom(64, 64, 2, GPU_RG16F, &jitter[0][0], NULL);
-
-       /* Set parameters */
-       GPU_texture_bind(tex, 0);
-       GPU_texture_filter_mode(tex, false);
-       GPU_texture_wrap_mode(tex, true);
-       GPU_texture_unbind(tex);
-
-       return tex;
-}
-
-
-bool GPU_fx_compositor_initialize_passes(
-        GPUFX *fx, const rcti *rect, const rcti *scissor_rect,
-        const GPUFXSettings *fx_settings)
-{
-       int w = BLI_rcti_size_x(rect), h = BLI_rcti_size_y(rect);
-       char err_out[256];
-       int num_passes = 0;
-       char fx_flag;
-
-       fx->effects = 0;
-
-       if (!fx_settings) {
-               cleanup_fx_gl_data(fx, true);
-               return false;
-       }
-
-       fx_flag = fx_settings->fx_flag;
-
-       /* disable effects if no options passed for them */
-       if (!fx_settings->dof) {
-               fx_flag &= ~GPU_FX_FLAG_DOF;
-       }
-       if (!fx_settings->ssao || fx_settings->ssao->samples < 1) {
-               fx_flag &= ~GPU_FX_FLAG_SSAO;
-       }
-
-       if (!fx_flag) {
-               cleanup_fx_gl_data(fx, true);
-               return false;
-       }
-
-       /* scissor is missing when drawing offscreen, in that case, dimensions match exactly. In opposite case
-        * add one to match viewport dimensions */
-       if (scissor_rect) {
-               w++;
-               h++;
-       }
-
-       fx->num_passes = 0;
-       /* dof really needs a ping-pong buffer to work */
-       if (fx_flag & GPU_FX_FLAG_DOF)
-               num_passes++;
-
-       if (fx_flag & GPU_FX_FLAG_SSAO)
-               num_passes++;
-
-       if (!fx->gbuffer) {
-               fx->gbuffer = GPU_framebuffer_create();
-
-               if (!fx->gbuffer) {
-                       return false;
-               }
-       }
-
-       /* try creating the jitter texture */
-       if (!fx->jitter_buffer)
-               fx->jitter_buffer = create_jitter_texture();
-
-       /* check if color buffers need recreation */
-       if (!fx->color_buffer || !fx->depth_buffer || w != fx->gbuffer_dim[0] || h != fx->gbuffer_dim[1]) {
-               cleanup_fx_gl_data(fx, false);
-
-               if (!(fx->color_buffer = GPU_texture_create_2D(w, h, NULL, err_out))) {
-                       printf(".256%s\n", err_out);
-                       cleanup_fx_gl_data(fx, true);
-                       return false;
-               }
-
-               if (!(fx->depth_buffer = GPU_texture_create_depth(w, h, err_out))) {
-                       printf("%.256s\n", err_out);
-                       cleanup_fx_gl_data(fx, true);
-                       return false;
-               }
-       }
-
-       if (fx_flag & GPU_FX_FLAG_SSAO) {
-               if (fx_settings->ssao->samples != fx->ssao_sample_count_cache || !fx->ssao_spiral_samples_tex) {
-                       if (fx_settings->ssao->samples < 1)
-                               fx_settings->ssao->samples = 1;
-
-                       fx->ssao_sample_count_cache = fx_settings->ssao->samples;
-
-                       if (fx->ssao_spiral_samples_tex) {
-                               GPU_texture_free(fx->ssao_spiral_samples_tex);
-                       }
-
-                       fx->ssao_spiral_samples_tex = create_spiral_sample_texture(fx_settings->ssao->samples);
-               }
-       }
-       else {
-               if (fx->ssao_spiral_samples_tex) {
-                       GPU_texture_free(fx->ssao_spiral_samples_tex);
-                       fx->ssao_spiral_samples_tex = NULL;
-               }
-       }
-
-       /* create textures for dof effect */
-       if (fx_flag & GPU_FX_FLAG_DOF) {
-               bool dof_high_quality = (fx_settings->dof->high_quality != 0);
-
-               /* cleanup buffers if quality setting has changed (no need to keep more buffers around than necessary ) */
-               if (dof_high_quality != fx->dof_high_quality)
-                       cleanup_fx_dof_buffers(fx);
-
-               if (dof_high_quality) {
-                       fx->dof_downsampled_w = w / 2;
-                       fx->dof_downsampled_h = h / 2;
-
-                       if (!fx->dof_half_downsampled_near || !fx->dof_nearfar_coc || !fx->dof_near_blur ||
-                           !fx->dof_far_blur || !fx->dof_half_downsampled_far)
-                       {
-
-                               if (!(fx->dof_half_downsampled_near = GPU_texture_create_2D(
-                                     fx->dof_downsampled_w, fx->dof_downsampled_h, NULL, err_out)))
-                               {
-                                       printf("%.256s\n", err_out);
-                                       cleanup_fx_gl_data(fx, true);
-                                       return false;
-                               }
-                               if (!(fx->dof_half_downsampled_far = GPU_texture_create_2D(
-                                     fx->dof_downsampled_w, fx->dof_downsampled_h, NULL, err_out)))
-                               {
-                                       printf("%.256s\n", err_out);
-                                       cleanup_fx_gl_data(fx, true);
-                                       return false;
-                               }
-
-                               if (!(fx->dof_nearfar_coc = GPU_texture_create_2D_custom(
-                                   fx->dof_downsampled_w, fx->dof_downsampled_h, 2, GPU_RG16F, NULL, err_out)))
-                               {
-                                       printf("%.256s\n", err_out);
-                                       cleanup_fx_gl_data(fx, true);
-                                       return false;
-                               }
-                               GPU_texture_bind(fx->dof_nearfar_coc, 0);
-                               GPU_texture_filter_mode(fx->dof_nearfar_coc, false);
-                               GPU_texture_wrap_mode(fx->dof_nearfar_coc, false);
-                               GPU_texture_unbind(fx->dof_nearfar_coc);
-
-                               if (!(fx->dof_near_blur = GPU_texture_create_2D_custom(
-                                   fx->dof_downsampled_w, fx->dof_downsampled_h, 4, GPU_RGBA16F, NULL, err_out)))
-                               {
-                                       printf("%.256s\n", err_out);
-                                       cleanup_fx_gl_data(fx, true);
-                                       return false;
-                               }
-
-                               if (!(fx->dof_far_blur = GPU_texture_create_2D_custom(
-                                   fx->dof_downsampled_w, fx->dof_downsampled_h, 4, GPU_RGBA16F, NULL, err_out)))
-                               {
-                                       printf("%.256s\n", err_out);
-                                       cleanup_fx_gl_data(fx, true);
-                                       return false;
-                               }
-                       }
-               }
-               else {
-                       fx->dof_downsampled_w = w / 4;
-                       fx->dof_downsampled_h = h / 4;
-
-                       if (!fx->dof_near_coc_buffer || !fx->dof_near_coc_blurred_buffer || !fx->dof_near_coc_final_buffer) {
-
-                               if (!(fx->dof_near_coc_buffer = GPU_texture_create_2D(
-                                         fx->dof_downsampled_w, fx->dof_downsampled_h, NULL, err_out)))
-                               {
-                                       printf("%.256s\n", err_out);
-                                       cleanup_fx_gl_data(fx, true);
-                                       return false;
-                               }
-                               if (!(fx->dof_near_coc_blurred_buffer = GPU_texture_create_2D(
-                                         fx->dof_downsampled_w, fx->dof_downsampled_h, NULL, err_out)))
-                               {
-                                       printf("%.256s\n", err_out);
-                                       cleanup_fx_gl_data(fx, true);
-                                       return false;
-                               }
-                               if (!(fx->dof_near_coc_final_buffer = GPU_texture_create_2D(
-                                         fx->dof_downsampled_w, fx->dof_downsampled_h, NULL, err_out)))
-                               {
-                                       printf("%.256s\n", err_out);
-                                       cleanup_fx_gl_data(fx, true);
-                                       return false;
-                               }
-                       }
-               }
-
-               fx->dof_high_quality = dof_high_quality;
-       }
-       else {
-               /* cleanup unnecessary buffers */
-               cleanup_fx_dof_buffers(fx);
-       }
-
-       /* we need to pass data between shader stages, allocate an extra color buffer */
-       if (num_passes > 1) {
-               if (!fx->color_buffer_sec) {
-                       if (!(fx->color_buffer_sec = GPU_texture_create_2D(w, h, NULL, err_out))) {
-                               printf(".256%s\n", err_out);
-                               cleanup_fx_gl_data(fx, true);
-                               return false;
-                       }
-               }
-       }
-       else {
-               if (fx->color_buffer_sec) {
-                       GPU_framebuffer_texture_detach(fx->color_buffer_sec);
-                       GPU_texture_free(fx->color_buffer_sec);
-                       fx->color_buffer_sec = NULL;
-               }
-       }
-
-       /* bind the buffers */
-
-       /* first depth buffer, because system assumes read/write buffers */
-       GPU_framebuffer_texture_attach(fx->gbuffer, fx->depth_buffer, 0, 0);
-       GPU_framebuffer_texture_attach(fx->gbuffer, fx->color_buffer, 0, 0);
-
-       if (!GPU_framebuffer_check_valid(fx->gbuffer, err_out))
-               printf("%.256s\n", err_out);
-
-       GPU_texture_bind_as_framebuffer(fx->color_buffer);
-
-       /* enable scissor test. It's needed to ensure sculpting works correctly */
-       if (scissor_rect) {
-               int w_sc = BLI_rcti_size_x(scissor_rect) + 1;
-               int h_sc = BLI_rcti_size_y(scissor_rect) + 1;
-               gpuPushAttrib(GPU_SCISSOR_BIT);
-               glEnable(GL_SCISSOR_TEST);
-               glScissor(scissor_rect->xmin - rect->xmin, scissor_rect->ymin - rect->ymin,
-                         w_sc, h_sc);
-               fx->restore_stencil = true;
-       }
-       else {
-               fx->restore_stencil = false;
-       }
-
-       fx->effects = fx_flag;
-
-       if (fx_settings)
-               fx->settings = *fx_settings;
-       fx->gbuffer_dim[0] = w;
-       fx->gbuffer_dim[1] = h;
-
-       fx->num_passes = num_passes;
-
-       return true;
-}
-
-static void gpu_fx_bind_render_target(int *passes_left, GPUFX *fx, struct GPUOffScreen *ofs, GPUTexture *target)
-{
-       if ((*passes_left)-- == 1) {
-               GPU_framebuffer_texture_unbind(fx->gbuffer, NULL);
-               if (ofs) {
-                       GPU_offscreen_bind(ofs, false);
-               }
-               else
-                       GPU_framebuffer_restore();
-       }
-       else {
-               /* bind the ping buffer to the color buffer */
-               GPU_framebuffer_texture_attach(fx->gbuffer, target, 0, 0);
-       }
-}
-
-void GPU_fx_compositor_setup_XRay_pass(GPUFX *fx, bool do_xray)
-{
-       char err_out[256];
-
-       if (do_xray) {
-               if (!fx->depth_buffer_xray &&
-                   !(fx->depth_buffer_xray = GPU_texture_create_depth(fx->gbuffer_dim[0], fx->gbuffer_dim[1], err_out)))
-               {
-                       printf("%.256s\n", err_out);
-                       cleanup_fx_gl_data(fx, true);
-                       return;
-               }
-       }
-       else {
-               if (fx->depth_buffer_xray) {
-                       GPU_framebuffer_texture_detach(fx->depth_buffer_xray);
-                       GPU_texture_free(fx->depth_buffer_xray);
-                       fx->depth_buffer_xray = NULL;
-               }
-               return;
-       }
-
-       GPU_framebuffer_texture_detach(fx->depth_buffer);
-
-       /* first depth buffer, because system assumes read/write buffers */
-       GPU_framebuffer_texture_attach(fx->gbuffer, fx->depth_buffer_xray, 0, 0);
-}
-
-
-void GPU_fx_compositor_XRay_resolve(GPUFX *fx)
-{
-       GPUShader *depth_resolve_shader;
-       GPU_framebuffer_texture_detach(fx->depth_buffer_xray);
-
-       /* attach regular framebuffer */
-       GPU_framebuffer_texture_attach(fx->gbuffer, fx->depth_buffer, 0, 0);
-
-       /* full screen quad where we will always write to depth buffer */
-       gpuPushAttrib(GPU_DEPTH_BUFFER_BIT | GPU_SCISSOR_BIT);
-       glDepthFunc(GL_ALWAYS);
-       /* disable scissor from sculpt if any */
-       glDisable(GL_SCISSOR_TEST);
-       /* disable writing to color buffer, it's depth only pass */
-       glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
-
-       depth_resolve_shader = GPU_shader_get_builtin_fx_shader(GPU_SHADER_FX_DEPTH_RESOLVE, false);
-
-       if (depth_resolve_shader) {
-               GPUDepthResolveInterface *interface = GPU_fx_shader_get_interface(depth_resolve_shader);
-
-               /* set up quad buffer */
-               GWN_batch_program_set(fx->quad_batch, GPU_shader_get_program(depth_resolve_shader), GPU_shader_get_interface(depth_resolve_shader));
-
-               GPU_texture_bind(fx->depth_buffer_xray, 0);
-               GPU_texture_compare_mode(fx->depth_buffer_xray, false);
-               GPU_texture_filter_mode(fx->depth_buffer_xray, true);
-               GPU_shader_uniform_texture(depth_resolve_shader, interface->depth_uniform, fx->depth_buffer_xray);
-
-               /* draw */
-               GWN_batch_draw(fx->quad_batch);
-
-               /* disable bindings */
-               GPU_texture_compare_mode(fx->depth_buffer_xray, true);
-               GPU_texture_filter_mode(fx->depth_buffer_xray, false);
-               GPU_texture_unbind(fx->depth_buffer_xray);
-
-               GPU_shader_unbind();
-       }
-
-       glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
-
-       gpuPopAttrib();
-}
-
-
-bool GPU_fx_do_composite_pass(
-        GPUFX *fx, float projmat[4][4], bool is_persp,
-        struct Scene *scene, struct GPUOffScreen *ofs)
-{
-       GPUTexture *src, *target;
-       int numslots = 0;
-       float invproj[4][4];
-       int i;
-       float dfdyfac[2];
-       /* number of passes left. when there are no more passes, the result is passed to the frambuffer */
-       int passes_left = fx->num_passes;
-       /* view vectors for the corners of the view frustum. Can be used to recreate the world space position easily */
-       float viewvecs[3][4] = {
-           {-1.0f, -1.0f, -1.0f, 1.0f},
-           {1.0f, -1.0f, -1.0f, 1.0f},
-           {-1.0f, 1.0f, -1.0f, 1.0f}
-       };
-
-       if (fx->effects == 0)
-               return false;
-
-       GPU_get_dfdy_factors(dfdyfac);
-       /* first, unbind the render-to-texture framebuffer */
-       GPU_framebuffer_texture_detach(fx->color_buffer);
-       GPU_framebuffer_texture_detach(fx->depth_buffer);
-
-       if (fx->restore_stencil) {
-               gpuPopAttrib();
-       }
-
-       src = fx->color_buffer;
-       target = fx->color_buffer_sec;
-
-       /* full screen FX pass */
-
-       /* invert the view matrix */
-       invert_m4_m4(invproj, projmat);
-
-       /* convert the view vectors to view space */
-       for (i = 0; i < 3; i++) {
-               mul_m4_v4(invproj, viewvecs[i]);
-               /* normalized trick see http://www.derschmale.com/2014/01/26/reconstructing-positions-from-the-depth-buffer */
-               mul_v3_fl(viewvecs[i], 1.0f / viewvecs[i][3]);
-               if (is_persp)
-                       mul_v3_fl(viewvecs[i], 1.0f / viewvecs[i][2]);
-               viewvecs[i][3] = 1.0;
-       }
-
-       /* we need to store the differences */
-       viewvecs[1][0] -= viewvecs[0][0];
-       viewvecs[1][1] = viewvecs[2][1] - viewvecs[0][1];
-
-       /* calculate a depth offset as well */
-       if (!is_persp) {
-               float vec_far[] = {-1.0f, -1.0f, 1.0f, 1.0f};
-               mul_m4_v4(invproj, vec_far);
-               mul_v3_fl(vec_far, 1.0f / vec_far[3]);
-               viewvecs[1][2] = vec_far[2] - viewvecs[0][2];
-       }
-
-       glDisable(GL_DEPTH_TEST);
-
-       /* ssao pass */
-       if (fx->effects & GPU_FX_FLAG_SSAO) {
-               GPUShader *ssao_shader;
-               ssao_shader = GPU_shader_get_builtin_fx_shader(GPU_SHADER_FX_SSAO, is_persp);
-               if (ssao_shader) {
-                       const GPUSSAOSettings *fx_ssao = fx->settings.ssao;
-                       /* adjust attenuation to be scale invariant */
-                       float attenuation = fx_ssao->attenuation / (fx_ssao->distance_max * fx_ssao->distance_max);
-                       float ssao_params[4] = {fx_ssao->distance_max, fx_ssao->factor, attenuation, 0.0f};
-                       float sample_params[3];
-
-                       sample_params[0] = fx->ssao_sample_count_cache;
-                       /* multiplier so we tile the random texture on screen */
-                       sample_params[1] = fx->gbuffer_dim[0] / 64.0;
-                       sample_params[2] = fx->gbuffer_dim[1] / 64.0;
-
-                       ssao_params[3] = (passes_left == 1 && !ofs) ? dfdyfac[0] : dfdyfac[1];
-
-                       GPUSSAOShaderInterface *interface = GPU_fx_shader_get_interface(ssao_shader);
-
-                       GWN_batch_program_set(fx->quad_batch, GPU_shader_get_program(ssao_shader), GPU_shader_get_interface(ssao_shader));
-
-                       GPU_shader_uniform_vector(ssao_shader, interface->ssao_uniform, 4, 1, ssao_params);
-                       GPU_shader_uniform_vector(ssao_shader, interface->ssao_color_uniform, 4, 1, fx_ssao->color);
-                       GPU_shader_uniform_vector(ssao_shader, interface->viewvecs_uniform, 4, 3, viewvecs[0]);
-                       GPU_shader_uniform_vector(ssao_shader, interface->ssao_sample_params_uniform, 3, 1, sample_params);
-
-                       GPU_texture_bind(src, numslots++);
-                       GPU_shader_uniform_texture(ssao_shader, interface->color_uniform, src);
-
-                       GPU_texture_bind(fx->depth_buffer, numslots++);
-                       GPU_texture_compare_mode(fx->depth_buffer, false);
-                       GPU_texture_filter_mode(fx->depth_buffer, true);
-                       GPU_shader_uniform_texture(ssao_shader, interface->depth_uniform, fx->depth_buffer);
-
-                       GPU_texture_bind(fx->jitter_buffer, numslots++);
-                       GPU_shader_uniform_texture(ssao_shader, interface->ssao_jitter_uniform, fx->jitter_buffer);
-
-                       GPU_texture_bind(fx->ssao_spiral_samples_tex, numslots++);
-                       GPU_shader_uniform_texture(ssao_shader, interface->ssao_concentric_tex, fx->ssao_spiral_samples_tex);
-
-                       /* draw */
-                       gpu_fx_bind_render_target(&passes_left, fx, ofs, target);
-
-                       GWN_batch_draw(fx->quad_batch);
-
-                       /* disable bindings */
-                       GPU_texture_unbind(src);
-                       GPU_texture_compare_mode(fx->depth_buffer, true);
-                       GPU_texture_filter_mode(fx->depth_buffer, false);
-                       GPU_texture_unbind(fx->depth_buffer);
-                       GPU_texture_unbind(fx->jitter_buffer);
-                       GPU_texture_unbind(fx->ssao_spiral_samples_tex);
-
-                       /* may not be attached, in that case this just returns */
-                       if (target) {
-                               GPU_framebuffer_texture_detach(target);
-                               if (ofs) {
-                                       GPU_offscreen_bind(ofs, false);
-                               }
-                               else {
-                                       GPU_framebuffer_restore();
-                               }
-                       }
-
-                       /* swap here, after src/target have been unbound */
-                       SWAP(GPUTexture *, target, src);
-                       numslots = 0;
-               }
-       }
-
-       /* second pass, dof */
-       if (fx->effects & GPU_FX_FLAG_DOF) {
-               const GPUDOFSettings *fx_dof = fx->settings.dof;
-               float dof_params[4];
-               float scale = scene->unit.system ? scene->unit.scale_length : 1.0f;
-               /* this is factor that converts to the scene scale. focal length and sensor are expressed in mm
-                * unit.scale_length is how many meters per blender unit we have. We want to convert to blender units though
-                * because the shader reads coordinates in world space, which is in blender units.
-                * Note however that focus_distance is already in blender units and shall not be scaled here (see T48157). */
-               float scale_camera = 0.001f / scale;
-               /* we want radius here for the aperture number  */
-               float aperture = 0.5f * scale_camera * fx_dof->focal_length / fx_dof->fstop;
-
-               dof_params[0] = aperture * fabsf(scale_camera * fx_dof->focal_length /
-                                                (fx_dof->focus_distance - scale_camera * fx_dof->focal_length));
-               dof_params[1] = fx_dof->focus_distance;
-               dof_params[2] = fx->gbuffer_dim[0] / (scale_camera * fx_dof->sensor);
-               dof_params[3] = fx_dof->num_blades;
-
-               if (fx->dof_high_quality) {
-                       GPUShader *dof_shader_pass1, *dof_shader_pass2, *dof_shader_pass3;
-
-                       /* custom shaders close to the effect described in CryEngine 3 Graphics Gems */
-                       dof_shader_pass1 = GPU_shader_get_builtin_fx_shader(GPU_SHADER_FX_DEPTH_OF_FIELD_HQ_PASS_ONE, is_persp);
-                       dof_shader_pass2 = GPU_shader_get_builtin_fx_shader(GPU_SHADER_FX_DEPTH_OF_FIELD_HQ_PASS_TWO, is_persp);
-                       dof_shader_pass3 = GPU_shader_get_builtin_fx_shader(GPU_SHADER_FX_DEPTH_OF_FIELD_HQ_PASS_THREE, is_persp);
-
-                       /* error occured, restore framebuffers and return */
-                       if (!(dof_shader_pass1 && dof_shader_pass2 && dof_shader_pass3)) {
-                               GPU_framebuffer_texture_unbind(fx->gbuffer, NULL);
-                               GPU_framebuffer_restore();
-
-                               GPU_shader_unbind();
-                               return false;
-                       }
-
-                       /* pass first, downsample the color buffer to near/far targets and calculate coc texture */
-                       {
-                               float invrendertargetdim[2] = {1.0f / fx->dof_downsampled_w, 1.0f / fx->dof_downsampled_h};
-
-                               GPUDOFHQPassOneInterface *interface = GPU_fx_shader_get_interface(dof_shader_pass1);
-
-                               GWN_batch_program_set(fx->quad_batch, GPU_shader_get_program(dof_shader_pass1), GPU_shader_get_interface(dof_shader_pass1));
-
-                               GPU_shader_uniform_vector(dof_shader_pass1, interface->dof_uniform, 4, 1, dof_params);
-                               GPU_shader_uniform_vector(dof_shader_pass1, interface->invrendertargetdim_uniform, 2, 1, invrendertargetdim);
-                               GPU_shader_uniform_vector(dof_shader_pass1, interface->viewvecs_uniform, 4, 3, viewvecs[0]);
-
-                               GPU_shader_uniform_vector(dof_shader_pass1, interface->invrendertargetdim_uniform, 2, 1, invrendertargetdim);
-
-                               GPU_texture_bind(fx->depth_buffer, numslots++);
-                               GPU_texture_compare_mode(fx->depth_buffer, false);
-                               GPU_texture_filter_mode(fx->depth_buffer, false);
-                               GPU_shader_uniform_texture(dof_shader_pass1, interface->depth_uniform, fx->depth_buffer);
-
-                               GPU_texture_bind(src, numslots++);
-                               /* disable filtering for the texture so custom downsample can do the right thing */
-                               GPU_texture_filter_mode(src, false);
-                               GPU_shader_uniform_texture(dof_shader_pass2, interface->color_uniform, src);
-
-                               /* target is the downsampled coc buffer */
-                               GPU_framebuffer_texture_attach(fx->gbuffer, fx->dof_half_downsampled_near, 0, 0);
-                               GPU_framebuffer_texture_attach(fx->gbuffer, fx->dof_half_downsampled_far, 1, 0);
-                               GPU_framebuffer_texture_attach(fx->gbuffer, fx->dof_nearfar_coc, 2, 0);
-                               /* binding takes care of setting the viewport to the downsampled size */
-                               GPU_framebuffer_slots_bind(fx->gbuffer, 0);
-
-                               GPU_framebuffer_check_valid(fx->gbuffer, NULL);
-
-                               GWN_batch_draw(fx->quad_batch);
-
-                               /* disable bindings */
-                               GPU_texture_filter_mode(src, true);
-                               GPU_texture_unbind(src);
-                               GPU_texture_compare_mode(fx->depth_buffer, true);
-                               GPU_texture_filter_mode(fx->depth_buffer, false);
-                               GPU_texture_unbind(fx->depth_buffer);
-
-                               GPU_framebuffer_texture_detach(fx->dof_half_downsampled_near);
-                               GPU_framebuffer_texture_detach(fx->dof_half_downsampled_far);
-                               GPU_framebuffer_texture_detach(fx->dof_nearfar_coc);
-                               GPU_framebuffer_texture_unbind(fx->gbuffer, fx->dof_half_downsampled_near);
-
-                               numslots = 0;
-                       }
-
-                       /* second pass, shoot quads for every pixel in the downsampled buffers, scaling according
-                        * to circle of confusion */
-                       {
-                               int rendertargetdim[2] = {fx->dof_downsampled_w, fx->dof_downsampled_h};
-                               float selection[2] = {0.0f, 1.0f};
-
-                               GPUDOFHQPassTwoInterface *interface = GPU_fx_shader_get_interface(dof_shader_pass2);
-
-                               GWN_batch_program_set(fx->point_batch, GPU_shader_get_program(dof_shader_pass2), GPU_shader_get_interface(dof_shader_pass2));
-
-                               GPU_texture_bind(fx->dof_nearfar_coc, numslots++);
-                               GPU_texture_bind(fx->dof_half_downsampled_far, numslots++);
-                               GPU_texture_bind(fx->dof_half_downsampled_near, numslots++);
-
-                               GPU_shader_uniform_vector(dof_shader_pass2, interface->dof_uniform, 4, 1, dof_params);
-                               GPU_shader_uniform_vector_int(dof_shader_pass2, interface->rendertargetdim_uniform, 2, 1, rendertargetdim);
-                               GPU_shader_uniform_vector(dof_shader_pass2, interface->select_uniform, 2, 1, selection);
-                               GPU_shader_uniform_texture(dof_shader_pass2, interface->coc_uniform, fx->dof_nearfar_coc);
-                               GPU_shader_uniform_texture(dof_shader_pass2, interface->color_uniform, fx->dof_half_downsampled_far);
-                               GPU_texture_filter_mode(fx->dof_half_downsampled_far, false);
-
-                               /* target is the downsampled coc buffer */
-                               GPU_framebuffer_texture_attach(fx->gbuffer, fx->dof_far_blur, 0, 0);
-                               GPU_texture_bind_as_framebuffer(fx->dof_far_blur);
-
-                               glDisable(GL_DEPTH_TEST);
-                               glEnable(GL_BLEND);
-                               glBlendFunc(GL_ONE, GL_ONE);
-                               glPointSize(1.0f);
-                               /* have to clear the buffer unfortunately */
-                               glClearColor(0.0, 0.0, 0.0, 0.0);
-                               glClear(GL_COLOR_BUFFER_BIT);
-                               /* the draw call we all waited for, draw a point per pixel, scaled per circle of confusion */
-                               // GWN_batch_draw_stupid_instanced(fx->point_batch, 0, fx->dof_downsampled_w * fx->dof_downsampled_h, 0, 0, 0, NULL, NULL);
-
-                               GPU_texture_unbind(fx->dof_half_downsampled_far);
-                               GPU_framebuffer_texture_detach(fx->dof_far_blur);
-
-                               selection[0] = 1.0f;
-                               selection[1] = 0.0f;
-
-                               GPU_shader_uniform_vector(dof_shader_pass2, interface->select_uniform, 2, 1, selection);
-                               GPU_shader_uniform_texture(dof_shader_pass2, interface->color_uniform, fx->dof_half_downsampled_near);
-                               GPU_texture_filter_mode(fx->dof_half_downsampled_near, false);
-
-                               GPU_framebuffer_texture_attach(fx->gbuffer, fx->dof_near_blur, 0, 0);
-                               /* have to clear the buffer unfortunately */
-                               glClear(GL_COLOR_BUFFER_BIT);
-                               /* the draw call we all waited for, draw a point per pixel, scaled per circle of confusion */
-                               // GWN_batch_draw_stupid_instanced(fx->point_batch, 0, fx->dof_downsampled_w * fx->dof_downsampled_h, 0, 0, 0, NULL, NULL);
-                               GWN_batch_program_use_end(fx->point_batch);
-
-                               /* disable bindings */
-                               glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
-                               glDisable(GL_BLEND);
-
-                               GPU_framebuffer_texture_detach(fx->dof_near_blur);
-
-                               GPU_texture_unbind(fx->dof_half_downsampled_near);
-                               GPU_texture_unbind(fx->dof_nearfar_coc);
-
-                               GPU_framebuffer_texture_unbind(fx->gbuffer, fx->dof_far_blur);
-                               numslots = 0;
-                       }
-
-                       /* third pass, accumulate the near/far blur fields */
-                       {
-                               float invrendertargetdim[2] = {1.0f / fx->dof_downsampled_w, 1.0f / fx->dof_downsampled_h};
-
-                               GPUDOFHQPassThreeInterface *interface = GPU_fx_shader_get_interface(dof_shader_pass3);
-
-                               GWN_batch_program_set(fx->quad_batch, GPU_shader_get_program(dof_shader_pass3), GPU_shader_get_interface(dof_shader_pass3));
-
-                               GPU_shader_uniform_vector(dof_shader_pass3, interface->dof_uniform, 4, 1, dof_params);
-
-                               GPU_shader_uniform_vector(dof_shader_pass3, interface->invrendertargetdim_uniform, 2, 1, invrendertargetdim);
-                               GPU_shader_uniform_vector(dof_shader_pass3, interface->viewvecs_uniform, 4, 3, viewvecs[0]);
-
-                               GPU_texture_bind(fx->dof_near_blur, numslots++);
-                               GPU_shader_uniform_texture(dof_shader_pass3, interface->near_uniform, fx->dof_near_blur);
-                               GPU_texture_filter_mode(fx->dof_near_blur, true);
-
-                               GPU_texture_bind(fx->dof_far_blur, numslots++);
-                               GPU_shader_uniform_texture(dof_shader_pass3, interface->far_uniform, fx->dof_far_blur);
-                               GPU_texture_filter_mode(fx->dof_far_blur, true);
-
-                               GPU_texture_bind(fx->depth_buffer, numslots++);
-                               GPU_texture_compare_mode(fx->depth_buffer, false);
-                               GPU_texture_filter_mode(fx->depth_buffer, false);
-                               GPU_shader_uniform_texture(dof_shader_pass3, interface->depth_uniform, fx->depth_buffer);
-
-                               GPU_texture_bind(src, numslots++);
-                               GPU_shader_uniform_texture(dof_shader_pass3, interface->color_uniform, src);
-
-                               /* if this is the last pass, prepare for rendering on the frambuffer */
-                               gpu_fx_bind_render_target(&passes_left, fx, ofs, target);
-
-                               GWN_batch_draw(fx->quad_batch);
-
-                               /* disable bindings */
-                               GPU_texture_unbind(fx->dof_near_blur);
-                               GPU_texture_unbind(fx->dof_far_blur);
-                               GPU_texture_unbind(src);
-                               GPU_texture_compare_mode(fx->depth_buffer, true);
-                               GPU_texture_unbind(fx->depth_buffer);
-
-                               /* may not be attached, in that case this just returns */
-                               if (target) {
-                                       GPU_framebuffer_texture_detach(target);
-                                       if (ofs) {
-                                               GPU_offscreen_bind(ofs, false);
-                                       }
-                                       else {
-                                               GPU_framebuffer_restore();
-                                       }
-                               }
-
-                               numslots = 0;
-                       }
-               }
-               else {
-                       GPUShader *dof_shader_pass1, *dof_shader_pass2, *dof_shader_pass3, *dof_shader_pass4, *dof_shader_pass5;
-
-                       /* DOF effect has many passes but most of them are performed
-                        * on a texture whose dimensions are 4 times less than the original
-                        * (16 times lower than original screen resolution).
-                        * Technique used is not very exact but should be fast enough and is based
-                        * on "Practical Post-Process Depth of Field"
-                        * see http://http.developer.nvidia.com/GPUGems3/gpugems3_ch28.html */
-                       dof_shader_pass1 = GPU_shader_get_builtin_fx_shader(GPU_SHADER_FX_DEPTH_OF_FIELD_PASS_ONE, is_persp);
-                       dof_shader_pass2 = GPU_shader_get_builtin_fx_shader(GPU_SHADER_FX_DEPTH_OF_FIELD_PASS_TWO, is_persp);
-                       dof_shader_pass3 = GPU_shader_get_builtin_fx_shader(GPU_SHADER_FX_DEPTH_OF_FIELD_PASS_THREE, is_persp);
-                       dof_shader_pass4 = GPU_shader_get_builtin_fx_shader(GPU_SHADER_FX_DEPTH_OF_FIELD_PASS_FOUR, is_persp);
-                       dof_shader_pass5 = GPU_shader_get_builtin_fx_shader(GPU_SHADER_FX_DEPTH_OF_FIELD_PASS_FIVE, is_persp);
-
-                       /* error occured, restore framebuffers and return */
-                       if (!(dof_shader_pass1 && dof_shader_pass2 && dof_shader_pass3 && dof_shader_pass4 && dof_shader_pass5)) {
-                               GPU_framebuffer_texture_unbind(fx->gbuffer, NULL);
-                               GPU_framebuffer_restore();
-
-                               GPU_shader_unbind();
-                               return false;
-                       }
-
-                       /* pass first, first level of blur in low res buffer */
-                       {
-                               float invrendertargetdim[2] = {1.0f / fx->gbuffer_dim[0], 1.0f / fx->gbuffer_dim[1]};
-
-                               GPUDOFPassOneInterface *interface = GPU_fx_shader_get_interface(dof_shader_pass1);
-
-                               GWN_batch_program_set(fx->quad_batch, GPU_shader_get_program(dof_shader_pass1), GPU_shader_get_interface(dof_shader_pass1));
-
-                               GPU_shader_uniform_vector(dof_shader_pass1, interface->dof_uniform, 4, 1, dof_params);
-                               GPU_shader_uniform_vector(dof_shader_pass1, interface->invrendertargetdim_uniform, 2, 1, invrendertargetdim);
-                               GPU_shader_uniform_vector(dof_shader_pass1, interface->viewvecs_uniform, 4, 3, viewvecs[0]);
-
-                               GPU_texture_bind(src, numslots++);
-                               GPU_shader_uniform_texture(dof_shader_pass1, interface->color_uniform, src);
-
-                               GPU_texture_bind(fx->depth_buffer, numslots++);
-                               GPU_texture_compare_mode(fx->depth_buffer, false);
-                               GPU_texture_filter_mode(fx->depth_buffer, true);
-                               GPU_shader_uniform_texture(dof_shader_pass1, interface->depth_uniform, fx->depth_buffer);
-
-                               /* target is the downsampled coc buffer */
-                               GPU_framebuffer_texture_attach(fx->gbuffer, fx->dof_near_coc_buffer, 0, 0);
-                               /* binding takes care of setting the viewport to the downsampled size */
-                               GPU_texture_bind_as_framebuffer(fx->dof_near_coc_buffer);
-
-                               GWN_batch_draw(fx->quad_batch);
-                               /* disable bindings */
-                               GPU_texture_unbind(src);
-                               GPU_texture_compare_mode(fx->depth_buffer, true);
-                               GPU_texture_filter_mode(fx->depth_buffer, false);
-                               GPU_texture_unbind(fx->depth_buffer);
-
-                               GPU_framebuffer_texture_detach(fx->dof_near_coc_buffer);
-                               numslots = 0;
-                       }
-
-                       /* second pass, gaussian blur the downsampled image */
-                       {
-                               float invrendertargetdim[2] = {1.0f / GPU_texture_width(fx->dof_near_coc_blurred_buffer),
-                                                              1.0f / GPU_texture_height(fx->dof_near_coc_blurred_buffer)};
-                               float tmp = invrendertargetdim[0];
-                               invrendertargetdim[0] = 0.0f;
-
-                               GPUDOFPassTwoInterface *interface = GPU_fx_shader_get_interface(dof_shader_pass2);
-
-                               dof_params[2] = GPU_texture_width(fx->dof_near_coc_blurred_buffer) / (scale_camera * fx_dof->sensor);
-
-                               /* Blurring vertically */
-                               GWN_batch_program_set(fx->quad_batch, GPU_shader_get_program(dof_shader_pass2), GPU_shader_get_interface(dof_shader_pass2));
-
-                               GPU_shader_uniform_vector(dof_shader_pass2, interface->dof_uniform, 4, 1, dof_params);
-                               GPU_shader_uniform_vector(dof_shader_pass2, interface->invrendertargetdim_uniform, 2, 1, invrendertargetdim);
-                               GPU_shader_uniform_vector(dof_shader_pass2, interface->viewvecs_uniform, 4, 3, viewvecs[0]);
-
-                               GPU_texture_bind(fx->depth_buffer, numslots++);
-                               GPU_texture_compare_mode(fx->depth_buffer, false);
-                               GPU_texture_filter_mode(fx->depth_buffer, true);
-                               GPU_shader_uniform_texture(dof_shader_pass2, interface->depth_uniform, fx->depth_buffer);
-
-                               GPU_texture_bind(fx->dof_near_coc_buffer, numslots++);
-                               GPU_shader_uniform_texture(dof_shader_pass2, interface->color_uniform, fx->dof_near_coc_buffer);
-
-                               /* use final buffer as a temp here */
-                               GPU_framebuffer_texture_attach(fx->gbuffer, fx->dof_near_coc_final_buffer, 0, 0);
-
-                               /* Drawing quad */
-                               GWN_batch_draw(fx->quad_batch);
-
-                               /* Rebind Shader */
-                               GWN_batch_program_set(fx->quad_batch, GPU_shader_get_program(dof_shader_pass2), GPU_shader_get_interface(dof_shader_pass2));
-
-                               /* *unbind/detach */
-                               GPU_texture_unbind(fx->dof_near_coc_buffer);
-
-                               GPU_framebuffer_texture_detach(fx->dof_near_coc_final_buffer);
-
-                               /* Blurring horizontally */
-                               invrendertargetdim[0] = tmp;
-                               invrendertargetdim[1] = 0.0f;
-                               GPU_shader_uniform_vector(dof_shader_pass2, interface->invrendertargetdim_uniform, 2, 1, invrendertargetdim);
-
-                               GPU_texture_bind(fx->dof_near_coc_final_buffer, numslots++);
-                               GPU_shader_uniform_texture(dof_shader_pass2, interface->color_uniform, fx->dof_near_coc_final_buffer);
-
-                               GPU_framebuffer_texture_attach(fx->gbuffer, fx->dof_near_coc_blurred_buffer, 0, 0);
-
-                               GWN_batch_draw(fx->quad_batch);
-
-                               /* *unbind/detach */
-                               GPU_texture_compare_mode(fx->depth_buffer, true);
-                               GPU_texture_filter_mode(fx->depth_buffer, false);
-                               GPU_texture_unbind(fx->depth_buffer);
-
-                               GPU_texture_unbind(fx->dof_near_coc_final_buffer);
-                               GPU_framebuffer_texture_detach(fx->dof_near_coc_blurred_buffer);
-
-                               dof_params[2] = fx->gbuffer_dim[0] / (scale_camera * fx_dof->sensor);
-
-                               numslots = 0;
-                       }
-
-                       /* third pass, calculate near coc */
-                       {
-                               GPUDOFPassThreeInterface *interface = GPU_fx_shader_get_interface(dof_shader_pass3);
-
-                               GWN_batch_program_set(fx->quad_batch, GPU_shader_get_program(dof_shader_pass3), GPU_shader_get_interface(dof_shader_pass3));
-
-                               GPU_texture_bind(fx->dof_near_coc_buffer, numslots++);
-                               GPU_shader_uniform_texture(dof_shader_pass3, interface->near_coc_downsampled, fx->dof_near_coc_buffer);
-
-                               GPU_texture_bind(fx->dof_near_coc_blurred_buffer, numslots++);
-                               GPU_shader_uniform_texture(dof_shader_pass3, interface->near_coc_blurred, fx->dof_near_coc_blurred_buffer);
-
-                               GPU_framebuffer_texture_attach(fx->gbuffer, fx->dof_near_coc_final_buffer, 0, 0);
-
-                               GWN_batch_draw(fx->quad_batch);
-                               /* disable bindings */
-                               GPU_texture_unbind(fx->dof_near_coc_buffer);
-                               GPU_texture_unbind(fx->dof_near_coc_blurred_buffer);
-
-                               /* unbinding here restores the size to the original */
-                               GPU_framebuffer_texture_detach(fx->dof_near_coc_final_buffer);
-
-                               numslots = 0;
-                       }
-
-                       /* fourth pass blur final coc once to eliminate discontinuities */
-                       {
-                               float invrendertargetdim[2] = {1.0f / GPU_texture_width(fx->dof_near_coc_blurred_buffer),
-                                                              1.0f / GPU_texture_height(fx->dof_near_coc_blurred_buffer)};
-
-                               GPUDOFPassFourInterface *interface = GPU_fx_shader_get_interface(dof_shader_pass4);
-
-                               GWN_batch_program_set(fx->quad_batch, GPU_shader_get_program(dof_shader_pass4), GPU_shader_get_interface(dof_shader_pass4));
-
-                               GPU_texture_bind(fx->dof_near_coc_final_buffer, numslots++);
-                               GPU_shader_uniform_texture(dof_shader_pass4, interface->near_coc_downsampled, fx->dof_near_coc_final_buffer);
-                               GPU_shader_uniform_vector(dof_shader_pass4, interface->invrendertargetdim_uniform, 2, 1, invrendertargetdim);
-
-                               GPU_framebuffer_texture_attach(fx->gbuffer, fx->dof_near_coc_buffer, 0, 0);
-
-                               GWN_batch_draw(fx->quad_batch);
-                               /* disable bindings */
-                               GPU_texture_unbind(fx->dof_near_coc_final_buffer);
-
-                               /* unbinding here restores the size to the original */
-                               GPU_framebuffer_texture_unbind(fx->gbuffer, fx->dof_near_coc_buffer);
-                               GPU_framebuffer_texture_detach(fx->dof_near_coc_buffer);
-
-                               numslots = 0;
-                       }
-
-                       /* final pass, merge blurred layers according to final calculated coc */
-                       {
-                               float invrendertargetdim[2] = {1.0f / fx->gbuffer_dim[0], 1.0f / fx->gbuffer_dim[1]};
-
-                               GPUDOFPassFiveInterface *interface = GPU_fx_shader_get_interface(dof_shader_pass5);
-
-                               GWN_batch_program_set(fx->quad_batch, GPU_shader_get_program(dof_shader_pass5), GPU_shader_get_interface(dof_shader_pass5));
-
-                               GPU_shader_uniform_vector(dof_shader_pass5, interface->dof_uniform, 4, 1, dof_params);
-                               GPU_shader_uniform_vector(dof_shader_pass5, interface->invrendertargetdim_uniform, 2, 1, invrendertargetdim);
-                               GPU_shader_uniform_vector(dof_shader_pass5, interface->viewvecs_uniform, 4, 3, viewvecs[0]);
-
-                               GPU_texture_bind(src, numslots++);
-                               GPU_shader_uniform_texture(dof_shader_pass5, interface->original_uniform, src);
-
-                               GPU_texture_bind(fx->dof_near_coc_blurred_buffer, numslots++);
-                               GPU_shader_uniform_texture(dof_shader_pass5, interface->high_blurred_uniform, fx->dof_near_coc_blurred_buffer);
-
-                               GPU_texture_bind(fx->dof_near_coc_buffer, numslots++);
-                               GPU_shader_uniform_texture(dof_shader_pass5, interface->medium_blurred_uniform, fx->dof_near_coc_buffer);
-
-                               GPU_texture_bind(fx->depth_buffer, numslots++);
-                               GPU_texture_compare_mode(fx->depth_buffer, false);
-                               GPU_texture_filter_mode(fx->depth_buffer, true);
-                               GPU_shader_uniform_texture(dof_shader_pass5, interface->depth_uniform, fx->depth_buffer);
-
-                               /* if this is the last pass, prepare for rendering on the frambuffer */
-                               gpu_fx_bind_render_target(&passes_left, fx, ofs, target);
-
-                               GWN_batch_draw(fx->quad_batch);
-                               /* disable bindings */
-                               GPU_texture_unbind(fx->dof_near_coc_buffer);
-                               GPU_texture_unbind(fx->dof_near_coc_blurred_buffer);
-                               GPU_texture_unbind(src);
-                               GPU_texture_compare_mode(fx->depth_buffer, true);
-                               GPU_texture_filter_mode(fx->depth_buffer, false);
-                               GPU_texture_unbind(fx->depth_buffer);
-
-                               /* may not be attached, in that case this just returns */
-                               if (target) {
-                                       GPU_framebuffer_texture_detach(target);
-                                       if (ofs) {
-                                               GPU_offscreen_bind(ofs, false);
-                                       }
-                                       else {
-                                               GPU_framebuffer_restore();
-                                       }
-                               }
-
-                               SWAP(GPUTexture *, target, src);
-                               numslots = 0;
-                       }
-               }
-       }
-
-       GPU_shader_unbind();
-
-       return true;
-}
-
-void GPU_fx_compositor_init_dof_settings(GPUDOFSettings *fx_dof)
-{
-       fx_dof->fstop = 128.0f;
-       fx_dof->focal_length = 1.0f;
-       fx_dof->focus_distance = 1.0f;
-       fx_dof->sensor = 1.0f;
-       fx_dof->num_blades = 6;
-       fx_dof->ratio = 1.0f;
-}
-
-void GPU_fx_compositor_init_ssao_settings(GPUSSAOSettings *fx_ssao)
-{
-       fx_ssao->factor = 1.0f;
-       fx_ssao->distance_max = 0.2f;
-       fx_ssao->attenuation = 1.0f;
-       fx_ssao->samples = 20;
-}
-
-void GPU_fx_shader_init_interface(GPUShader *shader, GPUFXShaderEffect effect)
-{
-       if (!shader)
-               return;
-
-       switch (effect) {
-               case GPU_SHADER_FX_SSAO:
-               {
-                       GPUSSAOShaderInterface *interface = MEM_mallocN(sizeof(GPUSSAOShaderInterface), "GPUSSAOShaderInterface");
-
-                       interface->ssao_uniform = GPU_shader_get_uniform(shader, "ssao_params");
-                       interface->ssao_color_uniform = GPU_shader_get_uniform(shader, "ssao_color");
-                       interface->color_uniform = GPU_shader_get_uniform(shader, "colorbuffer");
-                       interface->depth_uniform = GPU_shader_get_uniform(shader, "depthbuffer");
-                       interface->viewvecs_uniform = GPU_shader_get_uniform(shader, "viewvecs");
-                       interface->ssao_sample_params_uniform = GPU_shader_get_uniform(shader, "ssao_sample_params");
-                       interface->ssao_concentric_tex = GPU_shader_get_uniform(shader, "ssao_concentric_tex");
-                       interface->ssao_jitter_uniform = GPU_shader_get_uniform(shader, "jitter_tex");
-
-                       GPU_fx_shader_set_interface(shader, interface);
-                       break;
-               }
-
-               case GPU_SHADER_FX_DEPTH_OF_FIELD_HQ_PASS_ONE:
-               {
-                       GPUDOFHQPassOneInterface *interface = MEM_mallocN(sizeof(GPUDOFHQPassOneInterface), "GPUDOFHQPassOneInterface");
-
-                       interface->invrendertargetdim_uniform = GPU_shader_get_uniform(shader, "invrendertargetdim");
-                       interface->color_uniform = GPU_shader_get_uniform(shader, "colorbuffer");
-                       interface->dof_uniform = GPU_shader_get_uniform(shader, "dof_params");
-                       interface->depth_uniform = GPU_shader_get_uniform(shader, "depthbuffer");
-                       interface->viewvecs_uniform = GPU_shader_get_uniform(shader, "viewvecs");
-
-                       GPU_fx_shader_set_interface(shader, interface);
-                       break;
-               }
-
-               case GPU_SHADER_FX_DEPTH_OF_FIELD_HQ_PASS_TWO:
-               {
-                       GPUDOFHQPassTwoInterface *interface = MEM_mallocN(sizeof(GPUDOFHQPassTwoInterface), "GPUDOFHQPassTwoInterface");
-
-                       interface->rendertargetdim_uniform = GPU_shader_get_uniform(shader, "rendertargetdim");
-                       interface->color_uniform = GPU_shader_get_uniform(shader, "colorbuffer");
-                       interface->coc_uniform = GPU_shader_get_uniform(shader, "cocbuffer");
-                       interface->select_uniform = GPU_shader_get_uniform(shader, "layerselection");
-                       interface->dof_uniform = GPU_shader_get_uniform(shader, "dof_params");
-
-                       GPU_fx_shader_set_interface(shader, interface);
-                       break;
-               }
-
-               case GPU_SHADER_FX_DEPTH_OF_FIELD_HQ_PASS_THREE:
-               {
-                       GPUDOFHQPassThreeInterface *interface = MEM_mallocN(sizeof(GPUDOFHQPassThreeInterface), "GPUDOFHQPassThreeInterface");
-
-                       interface->dof_uniform = GPU_shader_get_uniform(shader, "dof_params");
-                       interface->invrendertargetdim_uniform = GPU_shader_get_uniform(shader, "invrendertargetdim");
-                       interface->color_uniform = GPU_shader_get_uniform(shader, "colorbuffer");
-                       interface->far_uniform = GPU_shader_get_uniform(shader, "farbuffer");
-                       interface->near_uniform = GPU_shader_get_uniform(shader, "nearbuffer");
-                       interface->viewvecs_uniform = GPU_shader_get_uniform(shader, "viewvecs");
-                       interface->depth_uniform = GPU_shader_get_uniform(shader, "depthbuffer");
-
-                       GPU_fx_shader_set_interface(shader, interface);
-                       break;
-               }
-
-               case GPU_SHADER_FX_DEPTH_OF_FIELD_PASS_ONE:
-               {
-                       GPUDOFPassOneInterface *interface = MEM_mallocN(sizeof(GPUDOFPassOneInterface), "GPUDOFPassOneInterface");
-
-                       interface->dof_uniform = GPU_shader_get_uniform(shader, "dof_params");
-                       interface->invrendertargetdim_uniform = GPU_shader_get_uniform(shader, "invrendertargetdim");
-                       interface->color_uniform = GPU_shader_get_uniform(shader, "colorbuffer");
-                       interface->depth_uniform = GPU_shader_get_uniform(shader, "depthbuffer");
-                       interface->viewvecs_uniform = GPU_shader_get_uniform(shader, "viewvecs");
-
-                       GPU_fx_shader_set_interface(shader, interface);
-                       break;
-               }
-               case GPU_SHADER_FX_DEPTH_OF_FIELD_PASS_TWO:
-               {
-                       GPUDOFPassTwoInterface *interface = MEM_mallocN(sizeof(GPUDOFPassTwoInterface), "GPUDOFPassTwoInterface");
-
-                       interface->dof_uniform = GPU_shader_get_uniform(shader, "dof_params");
-                       interface->invrendertargetdim_uniform = GPU_shader_get_uniform(shader, "invrendertargetdim");
-                       interface->color_uniform = GPU_shader_get_uniform(shader, "colorbuffer");
-                       interface->depth_uniform = GPU_shader_get_uniform(shader, "depthbuffer");
-                       interface->viewvecs_uniform = GPU_shader_get_uniform(shader, "viewvecs");
-
-                       GPU_fx_shader_set_interface(shader, interface);
-                       break;
-               }
-               case GPU_SHADER_FX_DEPTH_OF_FIELD_PASS_THREE:
-               {
-                       GPUDOFPassThreeInterface *interface = MEM_mallocN(sizeof(GPUDOFPassThreeInterface), "GPUDOFPassThreeInterface");
-
-                       interface->near_coc_downsampled = GPU_shader_get_uniform(shader, "colorbuffer");
-                       interface->near_coc_blurred = GPU_shader_get_uniform(shader, "blurredcolorbuffer");
-
-                       GPU_fx_shader_set_interface(shader, interface);
-                       break;
-               }
-               case GPU_SHADER_FX_DEPTH_OF_FIELD_PASS_FOUR:
-               {
-                       GPUDOFPassFourInterface *interface = MEM_mallocN(sizeof(GPUDOFPassFourInterface), "GPUDOFPassFourInterface");
-
-                       interface->near_coc_downsampled = GPU_shader_get_uniform(shader, "colorbuffer");
-                       interface->invrendertargetdim_uniform = GPU_shader_get_uniform(shader, "invrendertargetdim");
-
-                       GPU_fx_shader_set_interface(shader, interface);
-                       break;
-               }
-               case GPU_SHADER_FX_DEPTH_OF_FIELD_PASS_FIVE:
-               {
-                       GPUDOFPassFiveInterface *interface = MEM_mallocN(sizeof(GPUDOFPassFiveInterface), "GPUDOFPassFiveInterface");
-
-                       interface->medium_blurred_uniform = GPU_shader_get_uniform(shader, "mblurredcolorbuffer");
-                       interface->high_blurred_uniform = GPU_shader_get_uniform(shader, "blurredcolorbuffer");
-                       interface->dof_uniform = GPU_shader_get_uniform(shader, "dof_params");
-                       interface->invrendertargetdim_uniform = GPU_shader_get_uniform(shader, "invrendertargetdim");
-                       interface->original_uniform = GPU_shader_get_uniform(shader, "colorbuffer");
-                       interface->depth_uniform = GPU_shader_get_uniform(shader, "depthbuffer");
-                       interface->viewvecs_uniform = GPU_shader_get_uniform(shader, "viewvecs");
-
-                       GPU_fx_shader_set_interface(shader, interface);
-                       break;
-               }
-
-               case GPU_SHADER_FX_DEPTH_RESOLVE:
-               {
-                       GPUDepthResolveInterface *interface = MEM_mallocN(sizeof(GPUDepthResolveInterface), "GPUDepthResolveInterface");
-
-                       interface->depth_uniform = GPU_shader_get_uniform(shader, "depthbuffer");
-
-                       GPU_fx_shader_set_interface(shader, interface);
-                       break;
-               }
-
-               default:
-                       break;
-       }
-}
-
index b06ee56c21f1cc5699309f792a9317fea91479a6..2cb3476d568d2cd8ff7f1264b1b54b4541fad6a4 100644 (file)
@@ -37,7 +37,6 @@
 
 #include "DNA_space_types.h"
 
-#include "GPU_compositing.h"
 #include "GPU_extensions.h"
 #include "GPU_matrix.h"
 #include "GPU_shader.h"
@@ -145,22 +144,10 @@ extern char datatoc_gpu_shader_vsm_store_vert_glsl[];
 extern char datatoc_gpu_shader_vsm_store_frag_glsl[];
 extern char datatoc_gpu_shader_sep_gaussian_blur_vert_glsl[];
 extern char datatoc_gpu_shader_sep_gaussian_blur_frag_glsl[];
-extern char datatoc_gpu_shader_fullscreen_vert_glsl[];
-extern char datatoc_gpu_shader_fx_ssao_frag_glsl[];
-extern char datatoc_gpu_shader_fx_dof_frag_glsl[];
-extern char datatoc_gpu_shader_fx_dof_vert_glsl[];
-extern char datatoc_gpu_shader_fx_dof_hq_frag_glsl[];
-extern char datatoc_gpu_shader_fx_dof_hq_vert_glsl[];
-extern char datatoc_gpu_shader_fx_dof_hq_geo_glsl[];
-extern char datatoc_gpu_shader_fx_depth_resolve_glsl[];
-extern char datatoc_gpu_shader_fx_lib_glsl[];
 
 /* cache of built-in shaders (each is created on first use) */
 static GPUShader *builtin_shaders[GPU_NUM_BUILTIN_SHADERS] = { NULL };
 
-/* cache for shader fx. Those can exist in combinations so store them here */
-static GPUShader *fx_shaders[MAX_FX_SHADERS * 2] = { NULL };
-
 typedef struct {
        const char *vert;
        const char *frag;
@@ -574,11 +561,6 @@ int GPU_shader_get_uniform_block(GPUShader *shader, const char *name)
        return ubo ? ubo->location : -1;
 }
 
-void *GPU_fx_shader_get_interface(GPUShader *shader)
-{
-       return shader->uniform_interface;
-}
-
 void *GPU_shader_get_interface(GPUShader *shader)
 {
        return shader->interface;
@@ -590,11 +572,6 @@ int GPU_shader_get_program(GPUShader *shader)
        return (int)shader->program;
 }
 
-void GPU_fx_shader_set_interface(GPUShader *shader, void *interface)
-{
-       shader->uniform_interface = interface;
-}
-
 void GPU_shader_uniform_vector(GPUShader *UNUSED(shader), int location, int length, int arraysize, const float *value)
 {
        if (location == -1 || value == NULL)
@@ -641,32 +618,17 @@ void GPU_shader_uniform_buffer(GPUShader *shader, int location, GPUUniformBuffer
 void GPU_shader_uniform_texture(GPUShader *UNUSED(shader), int location, GPUTexture *tex)
 {
        int number = GPU_texture_bound_number(tex);
-       int bindcode = GPU_texture_opengl_bindcode(tex);
-       int target = GPU_texture_target(tex);
 
-       if (number >= GPU_max_textures()) {
-               fprintf(stderr, "Not enough texture slots.\n");
+       if (number == -1) {
+               fprintf(stderr, "Texture is not bound.\n");
+               BLI_assert(0);
                return;
        }
-               
-       if (number == -1)
-               return;
 
        if (location == -1)
                return;
 
-       if (number != 0)
-               glActiveTexture(GL_TEXTURE0 + number);
-
-       if (bindcode != 0)
-               glBindTexture(target, bindcode);
-       else
-               GPU_invalid_tex_bind(target);
-
        glUniform1i(location, number);
-
-       if (number != 0)
-               glActiveTexture(GL_TEXTURE0);
 }
 
 int GPU_shader_get_attribute(GPUShader *shader, const char *name)
@@ -885,82 +847,6 @@ GPUShader *GPU_shader_get_builtin_shader(GPUBuiltinShader shader)
 
 #define MAX_DEFINES 100
 
-GPUShader *GPU_shader_get_builtin_fx_shader(int effect, bool persp)
-{
-       int offset;
-       char defines[MAX_DEFINES] = "";
-       /* avoid shaders out of range */
-       if (effect >= MAX_FX_SHADERS)
-               return NULL;
-
-       offset = 2 * effect;
-
-       if (persp) {
-               offset += 1;
-               strcat(defines, "#define PERSP_MATRIX\n");
-       }
-
-       if (!fx_shaders[offset]) {
-               GPUShader *shader = NULL;
-
-               switch (effect) {
-                       case GPU_SHADER_FX_SSAO:
-                               shader = GPU_shader_create(datatoc_gpu_shader_fullscreen_vert_glsl, datatoc_gpu_shader_fx_ssao_frag_glsl, NULL, datatoc_gpu_shader_fx_lib_glsl, defines);
-                               break;
-
-                       case GPU_SHADER_FX_DEPTH_OF_FIELD_PASS_ONE:
-                               strcat(defines, "#define FIRST_PASS\n");
-                               shader = GPU_shader_create(datatoc_gpu_shader_fx_dof_vert_glsl, datatoc_gpu_shader_fx_dof_frag_glsl, NULL, datatoc_gpu_shader_fx_lib_glsl, defines);
-                               break;
-
-                       case GPU_SHADER_FX_DEPTH_OF_FIELD_PASS_TWO:
-                               strcat(defines, "#define SECOND_PASS\n");
-                               shader = GPU_shader_create(datatoc_gpu_shader_fx_dof_vert_glsl, datatoc_gpu_shader_fx_dof_frag_glsl, NULL, datatoc_gpu_shader_fx_lib_glsl, defines);
-                               break;
-
-                       case GPU_SHADER_FX_DEPTH_OF_FIELD_PASS_THREE:
-                               strcat(defines, "#define THIRD_PASS\n");
-                               shader = GPU_shader_create(datatoc_gpu_shader_fx_dof_vert_glsl, datatoc_gpu_shader_fx_dof_frag_glsl, NULL, datatoc_gpu_shader_fx_lib_glsl, defines);
-                               break;
-
-                       case GPU_SHADER_FX_DEPTH_OF_FIELD_PASS_FOUR:
-                               strcat(defines, "#define FOURTH_PASS\n");
-                               shader = GPU_shader_create(datatoc_gpu_shader_fx_dof_vert_glsl, datatoc_gpu_shader_fx_dof_frag_glsl, NULL, datatoc_gpu_shader_fx_lib_glsl, defines);
-                               break;
-
-                       case GPU_SHADER_FX_DEPTH_OF_FIELD_PASS_FIVE:
-                               strcat(defines, "#define FIFTH_PASS\n");
-                               shader = GPU_shader_create(datatoc_gpu_shader_fx_dof_vert_glsl, datatoc_gpu_shader_fx_dof_frag_glsl, NULL, datatoc_gpu_shader_fx_lib_glsl, defines);
-                               break;
-
-                       case GPU_SHADER_FX_DEPTH_OF_FIELD_HQ_PASS_ONE:
-                               strcat(defines, "#define FIRST_PASS\n");
-                               shader = GPU_shader_create(datatoc_gpu_shader_fx_dof_hq_vert_glsl, datatoc_gpu_shader_fx_dof_hq_frag_glsl, NULL, datatoc_gpu_shader_fx_lib_glsl, defines);
-                               break;
-
-                       case GPU_SHADER_FX_DEPTH_OF_FIELD_HQ_PASS_TWO:
-                               strcat(defines, "#define SECOND_PASS\n");
-                               shader = GPU_shader_create(datatoc_gpu_shader_fx_dof_hq_vert_glsl, datatoc_gpu_shader_fx_dof_hq_frag_glsl, datatoc_gpu_shader_fx_dof_hq_geo_glsl, datatoc_gpu_shader_fx_lib_glsl, defines);
-                               break;
-
-                       case GPU_SHADER_FX_DEPTH_OF_FIELD_HQ_PASS_THREE:
-                               strcat(defines, "#define THIRD_PASS\n");
-                               shader = GPU_shader_create(datatoc_gpu_shader_fx_dof_hq_vert_glsl, datatoc_gpu_shader_fx_dof_hq_frag_glsl, NULL, datatoc_gpu_shader_fx_lib_glsl, defines);
-                               break;
-
-                       case GPU_SHADER_FX_DEPTH_RESOLVE:
-                               shader = GPU_shader_create(datatoc_gpu_shader_fullscreen_vert_glsl, datatoc_gpu_shader_fx_depth_resolve_glsl, NULL, NULL, defines);
-                               break;
-               }
-
-               fx_shaders[offset] = shader;
-               GPU_fx_shader_init_interface(shader, effect);
-       }
-
-       return fx_shaders[offset];
-}
-
-
 void GPU_shader_free_builtin_shaders(void)
 {
        for (int i = 0; i < GPU_NUM_BUILTIN_SHADERS; ++i) {
@@ -969,11 +855,4 @@ void GPU_shader_free_builtin_shaders(void)
                        builtin_shaders[i] = NULL;
                }
        }
-
-       for (int i = 0; i < 2 * MAX_FX_SHADERS; ++i) {
-               if (fx_shaders[i]) {
-                       GPU_shader_free(fx_shaders[i]);
-                       fx_shaders[i] = NULL;
-               }
-       }
 }
index 955cc5cc884aef02a4f541d862d0eac1373e3446..5d91cd50935ed447267e5b0e8067cb2b89daa302 100644 (file)
@@ -1925,13 +1925,6 @@ char *rna_GPUDOF_path(PointerRNA *ptr)
        return BLI_strdup("");
 }
 
-static void rna_GPUFXSettings_fx_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
-{
-       GPUFXSettings *fx_settings = ptr->data;
-
-       BKE_screen_gpu_fx_validate(fx_settings);
-}
-
 static void rna_GPUDOFSettings_blades_set(PointerRNA *ptr, const int value)
 {
        GPUDOFSettings *dofsettings = (GPUDOFSettings *)ptr->data;
@@ -4839,7 +4832,7 @@ static void rna_def_gpu_fx(BlenderRNA *brna)
        RNA_def_property_boolean_sdna(prop, NULL, "fx_flag", GPU_FX_FLAG_DOF);
        RNA_def_property_ui_text(prop, "Depth Of Field",
                                 "Use depth of field on viewport using the values from active camera");
-       RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, "rna_GPUFXSettings_fx_update");
+       RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
 
 
        prop = RNA_def_property(srna, "ssao", PROP_POINTER, PROP_NONE);
@@ -4850,7 +4843,7 @@ static void rna_def_gpu_fx(BlenderRNA *brna)
        prop = RNA_def_property(srna, "use_ssao", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "fx_flag", GPU_FX_FLAG_SSAO);
        RNA_def_property_ui_text(prop, "SSAO", "Use screen space ambient occlusion of field on viewport");
-       RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, "rna_GPUFXSettings_fx_update");
+       RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
 }
 
 static void rna_def_view_layers(BlenderRNA *brna, PropertyRNA *cprop)
index 2da0227cdcac6d4d220723ae6203561bbfdcc4b7..72d338bd5db058b9cb4c769feb1fcd20bbaaf84d 100644 (file)
@@ -37,7 +37,6 @@
 
 #include "ED_screen.h"
 
-#include "GPU_compositing.h"
 #include "GPU_framebuffer.h"
 #include "GPU_texture.h"
 
index 4efd634bb45e55b051babedc3cbcbe983acecf46..e7ad8127f3937b636bb55c7f2b71ba88f13497ca 100644 (file)
@@ -1046,14 +1046,14 @@ static ImBuf *blend_file_thumb(const bContext *C, Scene *scene, ViewLayer *view_
                        &eval_ctx, scene, view_layer, scene->camera,
                        BLEN_THUMB_SIZE * 2, BLEN_THUMB_SIZE * 2,
                        IB_rect, V3D_OFSDRAW_NONE, OB_SOLID, R_ALPHAPREMUL, 0, NULL,
-                       NULL, NULL, err_out);
+                       NULL, err_out);
        }
        else {
                ibuf = ED_view3d_draw_offscreen_imbuf(
                        &eval_ctx, scene, view_layer, v3d, ar,
                        BLEN_THUMB_SIZE * 2, BLEN_THUMB_SIZE * 2,
                        IB_rect, V3D_OFSDRAW_NONE, R_ALPHAPREMUL, 0, NULL,
-                       NULL, NULL, err_out);
+                       NULL, err_out);
        }
 
        if (ibuf) {