[Bf-blender-cvs] [55e206c] viewport_experiments: use common GPU_fx_compositor_ prefix
Campbell Barton
noreply at git.blender.org
Thu Feb 12 18:38:20 CET 2015
Commit: 55e206c5807645048d1f68b6a91e93b44923b3c2
Author: Campbell Barton
Date: Fri Feb 13 04:28:07 2015 +1100
Branches: viewport_experiments
https://developer.blender.org/rB55e206c5807645048d1f68b6a91e93b44923b3c2
use common GPU_fx_compositor_ prefix
also rename darkening -> darken
===================================================================
M source/blender/blenkernel/intern/camera.c
M source/blender/blenkernel/intern/screen.c
M source/blender/editors/render/render_opengl.c
M source/blender/editors/space_view3d/space_view3d.c
M source/blender/editors/space_view3d/view3d_draw.c
M source/blender/gpu/GPU_compositing.h
M source/blender/gpu/intern/gpu_compositing.c
M source/blender/gpu/intern/gpu_extensions.c
M source/blender/makesdna/DNA_gpu_types.h
M source/blender/makesrna/intern/rna_scene.c
===================================================================
diff --git a/source/blender/blenkernel/intern/camera.c b/source/blender/blenkernel/intern/camera.c
index 635185d..e1d771d 100644
--- a/source/blender/blenkernel/intern/camera.c
+++ b/source/blender/blenkernel/intern/camera.c
@@ -69,7 +69,7 @@ void *BKE_camera_add(Main *bmain, const char *name)
cam->flag |= CAM_SHOWPASSEPARTOUT;
cam->passepartalpha = 0.5f;
- GPU_default_dof_settings(&cam->gpu_dof);
+ GPU_fx_compositor_init_dof_settings(&cam->gpu_dof);
return cam;
}
diff --git a/source/blender/blenkernel/intern/screen.c b/source/blender/blenkernel/intern/screen.c
index a1b0c6b..a6ac455 100644
--- a/source/blender/blenkernel/intern/screen.c
+++ b/source/blender/blenkernel/intern/screen.c
@@ -620,6 +620,6 @@ void BKE_screen_gpu_fx_validate(GPUFXSettings *fx_settings)
GPUSSAOSettings *fx_ssao;
fx_ssao = fx_settings->ssao = MEM_callocN(sizeof(GPUSSAOSettings), __func__);
- GPU_default_ssao_settings(fx_ssao);
+ GPU_fx_compositor_init_ssao_settings(fx_ssao);
}
}
diff --git a/source/blender/editors/render/render_opengl.c b/source/blender/editors/render/render_opengl.c
index 3d549f5..402e72d 100644
--- a/source/blender/editors/render/render_opengl.c
+++ b/source/blender/editors/render/render_opengl.c
@@ -521,7 +521,7 @@ 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)
- GGPU_fx_compositor_destroy(oglrender->fx);
+ GPU_fx_compositor_destroy(oglrender->fx);
GPU_offscreen_free(oglrender->ofs);
diff --git a/source/blender/editors/space_view3d/space_view3d.c b/source/blender/editors/space_view3d/space_view3d.c
index 5993f3c..ff212a1 100644
--- a/source/blender/editors/space_view3d/space_view3d.c
+++ b/source/blender/editors/space_view3d/space_view3d.c
@@ -571,7 +571,7 @@ static void view3d_main_area_exit(wmWindowManager *wm, ARegion *ar)
}
if (rv3d->compositor) {
- GGPU_fx_compositor_destroy(rv3d->compositor);
+ GPU_fx_compositor_destroy(rv3d->compositor);
rv3d->compositor = NULL;
}
}
@@ -729,7 +729,7 @@ static void view3d_main_area_free(ARegion *ar)
GPU_offscreen_free(rv3d->gpuoffscreen);
}
if (rv3d->compositor) {
- GGPU_fx_compositor_destroy(rv3d->compositor);
+ GPU_fx_compositor_destroy(rv3d->compositor);
}
MEM_freeN(rv3d);
diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c
index 85d70ea..94d0ffc 100644
--- a/source/blender/editors/space_view3d/view3d_draw.c
+++ b/source/blender/editors/space_view3d/view3d_draw.c
@@ -3528,9 +3528,7 @@ static void view3d_main_area_draw_objects(const bContext *C, Scene *scene, View3
else {
fx_settings.dof = NULL;
}
- do_compositing = GPU_fx_compositor_initialize_passes(
- rv3d->compositor, &ar->winrct, &ar->drawrct,
- &fx_settings);
+ do_compositing = GPU_fx_compositor_initialize_passes(rv3d->compositor, &ar->winrct, &ar->drawrct, &fx_settings);
}
/* clear the background */
diff --git a/source/blender/gpu/GPU_compositing.h b/source/blender/gpu/GPU_compositing.h
index 79569e8..796341d 100644
--- a/source/blender/gpu/GPU_compositing.h
+++ b/source/blender/gpu/GPU_compositing.h
@@ -69,7 +69,7 @@ typedef enum GPUFXShaderEffect {
GPUFX *GPU_fx_compositor_create(void);
/* destroy a text compositor */
-void GGPU_fx_compositor_destroy(GPUFX *fx);
+void GPU_fx_compositor_destroy(GPUFX *fx);
/* initialize a framebuffer with size taken from the viewport */
bool GPU_fx_compositor_initialize_passes(
@@ -79,8 +79,8 @@ bool GPU_fx_compositor_initialize_passes(
/* 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);
-void GPU_default_dof_settings(struct GPUDOFSettings *dof);
-void GPU_default_ssao_settings(struct GPUSSAOSettings *ssao);
+void GPU_fx_compositor_init_dof_settings(struct GPUDOFSettings *dof);
+void GPU_fx_compositor_init_ssao_settings(struct GPUSSAOSettings *ssao);
#ifdef __cplusplus
}
#endif
diff --git a/source/blender/gpu/intern/gpu_compositing.c b/source/blender/gpu/intern/gpu_compositing.c
index ac1319a..f2cd384 100644
--- a/source/blender/gpu/intern/gpu_compositing.c
+++ b/source/blender/gpu/intern/gpu_compositing.c
@@ -4,7 +4,7 @@
* 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.
+ * 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
@@ -58,10 +58,10 @@ static const float fullscreencos[4][2] = {{-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}};
struct GPUFX {
- /* we borrow the term gbuffer from deferred rendering however this is just a regular
+ /* we borrow the term gbuffer from deferred rendering however this is just a regular
* depth/color framebuffer. Could be extended later though */
GPUFrameBuffer *gbuffer;
-
+
/* texture bound to the first color attachment of the gbuffer */
GPUTexture *color_buffer;
@@ -86,20 +86,20 @@ struct GPUFX {
GPUTexture *dof_near_blur;
GPUTexture *dof_far_blur;
GPUTexture *dof_concentric_samples_tex;
-
+
/* texture bound to the depth attachment of the gbuffer */
GPUTexture *depth_buffer;
/* texture used for jittering for various effects */
GPUTexture *jitter_buffer;
-
+
/* texture used for ssao */
int ssao_sample_count;
GPUTexture *ssao_concentric_samples_tex;
/* dimensions of the gbuffer */
int gbuffer_dim[2];
-
+
GPUFXSettings settings;
/* or-ed flags of enabled effects */
@@ -148,8 +148,8 @@ static GPUTexture * create_concentric_sample_texture(int side)
/* generate a new FX compositor */
GPUFX *GPU_fx_compositor_create(void)
{
- GPUFX *fx = (GPUFX *)MEM_callocN(sizeof(GPUFX), "GPUFX compositor");
-
+ GPUFX *fx = MEM_callocN(sizeof(GPUFX), "GPUFX compositor");
+
return fx;
}
@@ -167,7 +167,7 @@ static void cleanup_fx_dof_buffers(GPUFX *fx)
GPU_texture_free(fx->dof_near_coc_final_buffer);
fx->dof_near_coc_final_buffer = NULL;
}
-
+
if (fx->dof_half_downsampled) {
GPU_texture_free(fx->dof_half_downsampled);
fx->dof_half_downsampled = NULL;
@@ -211,7 +211,7 @@ static void cleanup_fx_gl_data(GPUFX *fx, bool do_fbo)
GPU_framebuffer_texture_detach(fx->depth_buffer);
GPU_texture_free(fx->depth_buffer);
fx->depth_buffer = NULL;
- }
+ }
cleanup_fx_dof_buffers(fx);
@@ -219,7 +219,7 @@ static void cleanup_fx_gl_data(GPUFX *fx, bool do_fbo)
GPU_texture_free(fx->ssao_concentric_samples_tex);
fx->ssao_concentric_samples_tex = NULL;
}
-
+
if (fx->jitter_buffer && do_fbo) {
GPU_texture_free(fx->jitter_buffer);
fx->jitter_buffer = NULL;
@@ -232,7 +232,7 @@ static void cleanup_fx_gl_data(GPUFX *fx, bool do_fbo)
}
/* destroy a text compositor */
-void GGPU_fx_compositor_destroy(GPUFX *fx)
+void GPU_fx_compositor_destroy(GPUFX *fx)
{
cleanup_fx_gl_data(fx, true);
MEM_freeN(fx);
@@ -281,7 +281,7 @@ bool GPU_fx_compositor_initialize_passes(
cleanup_fx_gl_data(fx, true);
return false;
}
-
+
fx->num_passes = 0;
/* dof really needs a ping-pong buffer to work */
if (fx_flag & GPU_FX_FLAG_DOF)
@@ -290,44 +290,44 @@ bool GPU_fx_compositor_initialize_passes(
if (fx_flag & GPU_FX_FLAG_SSAO)
num_passes++;
- if (!fx->gbuffer)
+ if (!fx->gbuffer)
fx->gbuffer = GPU_framebuffer_create();
-
+
/* try creating the jitter texture */
if (!fx->jitter_buffer)
fx->jitter_buffer = create_jitter_texture();
- if (!fx->gbuffer)
+ if (!fx->gbuffer)
return false;
-
+
/* 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, GPU_HDR_NONE, 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 || !fx->ssao_concentric_samples_tex) {
if (fx_settings->ssao->samples < 1)
fx_settings->ssao->samples = 1;
-
+
fx->ssao_sample_count = fx_settings->ssao->samples;
-
+
if (fx->ssao_concentric_samples_tex) {
GPU_texture_free(fx->ssao_concentric_samples_tex);
}
-
+
fx->ssao_concentric_samples_tex = create_concentric_sample_texture(fx_settings->ssao->samples);
}
}
@@ -337,7 +337,7 @@ bool GPU_fx_compositor_initialize_passes(
fx->ssao_concentric_samples_tex = NULL;
}
}
-
+
/* create textures for dof effect */
if (fx_flag & GPU_FX_FLAG_DOF) {
if (!fx->dof_near_coc_buffer || !fx->dof_near_coc_blurred_buffer || !fx->dof_near_coc_final_buffer) {
@@ -391,17 +391,17 @@ bool GPU_fx_compositor_initialize_passes(
}
/* bind the buffers */
-
+
/* first depth buffer, because system assumes read/write buffers */
if(!GPU_framebuffer_texture_attach(fx->gbuffer, fx->depth_buffer, 0, err_out))
printf("%.256s\n", err_out);
-
+
if(!GPU_framebuffer_texture_attach(fx->gbuffer, fx->color_buffer, 0, err_out))
printf("%.256s\n", err_out);
-
+
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 */
@@ -410,7 +410,7 @@ bool GPU_fx_compositor_initialize_passes(
int h_sc = BLI_rcti_size_y(scissor_rect) + 1;
glPushAttrib(GL_SCISSOR_BIT);
glEnable(GL_SCISSOR_TEST);
- glScissor(scissor_rect->xmin - rect->xmin, scissor_rect->ymin - rect->ymin,
+ glScissor(scissor_rect->xmin - rect->xmin, scissor_rect-
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list