[Bf-blender-cvs] [4f5e9f0] viewport_experiments: Don't allocate FX, naming of eGPUFXFlags

Antony Riakiotakis noreply at git.blender.org
Thu Feb 12 16:40:25 CET 2015


Commit: 4f5e9f0857642d8120eeb8e059ad000d4c5f2674
Author: Antony Riakiotakis
Date:   Thu Feb 12 15:12:16 2015 +0100
Branches: viewport_experiments
https://developer.blender.org/rB4f5e9f0857642d8120eeb8e059ad000d4c5f2674

Don't allocate FX, naming of eGPUFXFlags

===================================================================

M	source/blender/blenkernel/intern/screen.c
M	source/blender/blenloader/intern/readfile.c
M	source/blender/blenloader/intern/writefile.c
M	source/blender/editors/include/ED_view3d.h
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/shaders/gpu_shader_fx_dof_frag.glsl
M	source/blender/gpu/shaders/gpu_shader_fx_dof_vert.glsl
M	source/blender/gpu/shaders/gpu_shader_fx_ssao_frag.glsl
M	source/blender/makesdna/DNA_gpu_types.h
M	source/blender/makesdna/DNA_view3d_types.h

===================================================================

diff --git a/source/blender/blenkernel/intern/screen.c b/source/blender/blenkernel/intern/screen.c
index 0ca8942..efc50a1 100644
--- a/source/blender/blenkernel/intern/screen.c
+++ b/source/blender/blenkernel/intern/screen.c
@@ -601,20 +601,19 @@ float BKE_screen_view3d_zoom_from_fac(float zoomfac)
 
 void BKE_screen_view3d_ensure_FX(View3D *v3d)
 {
-	if (!v3d->fxoptions) {
-		v3d->fxoptions = MEM_callocN(sizeof(GPUFXOptions), "view3d fx options");
-		v3d->fxoptions->dof_options = MEM_callocN(sizeof(GPUDOFOptions), "view3d dof options");
+	if (!v3d->fxoptions.dof_options || !v3d->fxoptions.ssao_options) {
+		v3d->fxoptions.dof_options = MEM_callocN(sizeof(GPUDOFOptions), "view3d dof options");
 
-		v3d->fxoptions->dof_options->fstop = 128.0f;
-		v3d->fxoptions->dof_options->focal_length = 1.0f;
-		v3d->fxoptions->dof_options->focus_distance = 1.0f;
-		v3d->fxoptions->dof_options->sensor = 1.0f;
+		v3d->fxoptions.dof_options->fstop = 128.0f;
+		v3d->fxoptions.dof_options->focal_length = 1.0f;
+		v3d->fxoptions.dof_options->focus_distance = 1.0f;
+		v3d->fxoptions.dof_options->sensor = 1.0f;
 
-		v3d->fxoptions->ssao_options = MEM_callocN(sizeof(GPUSSAOOptions), "view3d ssao options");
+		v3d->fxoptions.ssao_options = MEM_callocN(sizeof(GPUSSAOOptions), "view3d ssao options");
 
-		v3d->fxoptions->ssao_options->darkening = 1.0f;
-		v3d->fxoptions->ssao_options->distance_max = 0.2f;
-		v3d->fxoptions->ssao_options->attenuation = 1.0f;
-		v3d->fxoptions->ssao_options->num_samples = 4;
+		v3d->fxoptions.ssao_options->darkening = 1.0f;
+		v3d->fxoptions.ssao_options->distance_max = 0.2f;
+		v3d->fxoptions.ssao_options->attenuation = 1.0f;
+		v3d->fxoptions.ssao_options->num_samples = 4;
 	}
 }
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index ca02507..daeba25 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -6561,14 +6561,10 @@ static bool direct_link_screen(FileData *fd, bScreen *sc)
 				if (v3d->drawtype == OB_RENDER)
 					v3d->drawtype = OB_SOLID;
 
-				if (v3d->fxoptions) {
-					v3d->fxoptions = newdataadr(fd, v3d->fxoptions);
-
-					if (v3d->fxoptions->dof_options)
-						v3d->fxoptions->dof_options = newdataadr(fd, v3d->fxoptions->dof_options);
-					if (v3d->fxoptions->ssao_options)
-						v3d->fxoptions->ssao_options = newdataadr(fd, v3d->fxoptions->ssao_options);
-				}
+				if (v3d->fxoptions.dof_options)
+					v3d->fxoptions.dof_options = newdataadr(fd, v3d->fxoptions.dof_options);
+				if (v3d->fxoptions.ssao_options)
+					v3d->fxoptions.ssao_options = newdataadr(fd, v3d->fxoptions.ssao_options);
 				
 				blo_do_versions_view3d_split_250(v3d, &sl->regionbase);
 			}
diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c
index 6a7c97f..11e10ba 100644
--- a/source/blender/blenloader/intern/writefile.c
+++ b/source/blender/blenloader/intern/writefile.c
@@ -2649,13 +2649,11 @@ static void write_screens(WriteData *wd, ListBase *scrbase)
 					for (bgpic= v3d->bgpicbase.first; bgpic; bgpic= bgpic->next)
 						writestruct(wd, DATA, "BGpic", 1, bgpic);
 					if (v3d->localvd) writestruct(wd, DATA, "View3D", 1, v3d->localvd);
-					if (v3d->fxoptions) {
-						writestruct(wd, DATA, "GPUFXOptions", 1, v3d->fxoptions);
-						if (v3d->fxoptions->dof_options)
-							writestruct(wd, DATA, "GPUDOFOptions", 1, v3d->fxoptions->dof_options);
-						if (v3d->fxoptions->ssao_options)
-							writestruct(wd, DATA, "GPUSSAOOptions", 1, v3d->fxoptions->ssao_options);
-					}
+
+					if (v3d->fxoptions.dof_options)
+						writestruct(wd, DATA, "GPUDOFOptions", 1, v3d->fxoptions.dof_options);
+					if (v3d->fxoptions.ssao_options)
+						writestruct(wd, DATA, "GPUSSAOOptions", 1, v3d->fxoptions.ssao_options);
 				}
 				else if (sl->spacetype==SPACE_IPO) {
 					SpaceIpo *sipo= (SpaceIpo *)sl;
diff --git a/source/blender/editors/include/ED_view3d.h b/source/blender/editors/include/ED_view3d.h
index 114acee..c14c72e 100644
--- a/source/blender/editors/include/ED_view3d.h
+++ b/source/blender/editors/include/ED_view3d.h
@@ -64,7 +64,7 @@ struct wmWindow;
 struct GPUFX;
 struct GPUOffScreen;
 struct GPUFXOptions;
-enum eGPUFxFlags;
+enum eGPUFXFlags;
 
 /* for derivedmesh drawing callbacks, for view3d_select, .... */
 typedef struct ViewContext {
@@ -308,7 +308,7 @@ int ED_view3d_scene_layer_set(int lay, const int *values, int *active);
 bool ED_view3d_context_activate(struct bContext *C);
 void ED_view3d_draw_offscreen_init(struct Scene *scene, struct View3D *v3d);
 void ED_view3d_draw_offscreen(struct Scene *scene, struct View3D *v3d, struct ARegion *ar, int winx, int winy, float viewmat[4][4],
-                              float winmat[4][4], bool do_bgpic, bool do_sky, struct GPUFX *fx, bool is_persp, struct GPUOffScreen *ofs, struct GPUFXOptions *fxoptions, enum eGPUFxFlags fxflags);
+                              float winmat[4][4], bool do_bgpic, bool do_sky, struct GPUFX *fx, bool is_persp, struct GPUOffScreen *ofs, struct GPUFXOptions *fxoptions, enum eGPUFXFlags fxflags);
 
 struct ImBuf *ED_view3d_draw_offscreen_imbuf(struct Scene *scene, struct View3D *v3d, struct ARegion *ar, int sizex, int sizey, unsigned int flag,
                                              bool draw_background, int alpha_mode, char err_out[256]);
diff --git a/source/blender/editors/render/render_opengl.c b/source/blender/editors/render/render_opengl.c
index c63478b..a0851f5 100644
--- a/source/blender/editors/render/render_opengl.c
+++ b/source/blender/editors/render/render_opengl.c
@@ -214,8 +214,7 @@ static void screen_opengl_render_apply(OGLRender *oglrender)
 		/* full copy */
 		GPUFXOptions options = {0};
 
-		if (v3d->fxoptions)
-			options = *v3d->fxoptions;
+		options = v3d->fxoptions;
 
 		ED_view3d_draw_offscreen_init(scene, v3d);
 
diff --git a/source/blender/editors/space_view3d/space_view3d.c b/source/blender/editors/space_view3d/space_view3d.c
index a71fbbd..3f5d8d4 100644
--- a/source/blender/editors/space_view3d/space_view3d.c
+++ b/source/blender/editors/space_view3d/space_view3d.c
@@ -420,13 +420,10 @@ static void view3d_free(SpaceLink *sl)
 		MEM_freeN(vd->defmaterial);
 	}
 
-	if (vd->fxoptions) {
-		MEM_freeN(vd->fxoptions->dof_options);
-		if (vd->fxoptions->ssao_options)
-			MEM_freeN(vd->fxoptions->ssao_options);
-		if (vd->fxoptions->dof_options)
-			MEM_freeN(vd->fxoptions);
-	}
+		if (vd->fxoptions.ssao_options)
+			MEM_freeN(vd->fxoptions.ssao_options);
+		if (vd->fxoptions.dof_options)
+			MEM_freeN(vd->fxoptions.dof_options);
 }
 
 
@@ -468,12 +465,10 @@ static SpaceLink *view3d_duplicate(SpaceLink *sl)
 	}
 
 	v3dn->properties_storage = NULL;
-	if (v3do->fxoptions)
-	{
-		v3dn->fxoptions = MEM_callocN(sizeof(GPUFXOptions), "view3d fx options");
-		v3dn->fxoptions->dof_options = MEM_dupallocN(v3do->fxoptions->dof_options);
-		v3dn->fxoptions->ssao_options = MEM_dupallocN(v3do->fxoptions->ssao_options);
-	}
+	if (v3dn->fxoptions.dof_options)
+		v3dn->fxoptions.dof_options = MEM_dupallocN(v3do->fxoptions.dof_options);
+	if (v3dn->fxoptions.ssao_options)
+		v3dn->fxoptions.ssao_options = MEM_dupallocN(v3do->fxoptions.ssao_options);
 
 	return (SpaceLink *)v3dn;
 }
diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c
index e845625..f17d39b 100644
--- a/source/blender/editors/space_view3d/view3d_draw.c
+++ b/source/blender/editors/space_view3d/view3d_draw.c
@@ -3052,7 +3052,7 @@ static void view3d_main_area_clear(Scene *scene, View3D *v3d, ARegion *ar, bool
  */
 void ED_view3d_draw_offscreen(Scene *scene, View3D *v3d, ARegion *ar, int winx, int winy,
                               float viewmat[4][4], float winmat[4][4],
-                              bool do_bgpic, bool do_sky, GPUFX *fx, bool is_persp, GPUOffScreen *ofs, GPUFXOptions *fxoptions, eGPUFxFlags fxflags)
+                              bool do_bgpic, bool do_sky, GPUFX *fx, bool is_persp, GPUOffScreen *ofs, GPUFXOptions *fxoptions, eGPUFXFlags fxflags)
 {
 	struct bThemeState theme_state;
 	int bwinx, bwiny;
@@ -3507,7 +3507,7 @@ static void view3d_main_area_draw_objects(const bContext *C, Scene *scene, View3
 	if (v3d->shader_fx) {
 		GPUFXOptions options;
 		BKE_screen_view3d_ensure_FX(v3d);
-		options = *v3d->fxoptions;
+		options = v3d->fxoptions;
 		if (!rv3d->compositor)
 			rv3d->compositor = GPU_create_fx_compositor();
 		
diff --git a/source/blender/gpu/GPU_compositing.h b/source/blender/gpu/GPU_compositing.h
index 33dbd44..ba24619 100644
--- a/source/blender/gpu/GPU_compositing.h
+++ b/source/blender/gpu/GPU_compositing.h
@@ -71,7 +71,7 @@ GPUFX *GPU_create_fx_compositor(void);
 void GPU_destroy_fx_compositor(GPUFX *fx);
 
 /* initialize a framebuffer with size taken from the viewport */
-bool GPU_initialize_fx_passes(GPUFX *fx, struct rcti *rect, rcti *scissor_rect, enum eGPUFxFlags fxflags, struct GPUFXOptions *options);
+bool GPU_initialize_fx_passes(GPUFX *fx, struct rcti *rect, rcti *scissor_rect, enum eGPUFXFlags fxflags, struct GPUFXOptions *options);
 
 /* 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);
diff --git a/source/blender/gpu/intern/gpu_compositing.c b/source/blender/gpu/intern/gpu_compositing.c
index 0fbe33f..63a9273 100644
--- a/source/blender/gpu/intern/gpu_compositing.c
+++ b/source/blender/gpu/intern/gpu_compositing.c
@@ -253,7 +253,7 @@ static GPUTexture * create_jitter_texture(void)
 }
 
 
-bool GPU_initialize_fx_passes(GPUFX *fx, rcti *rect, rcti *scissor_rect, eGPUFxFlags fxflags, GPUFXOptions *options)
+bool GPU_initialize_fx_passes(GPUFX *fx, rcti *rect, rcti *scissor_rect, eGPUFXFlags fxflags, GPUFXOptions *options)
 {
 	int w = BLI_rcti_size_x(rect) + 1, h = BLI_rcti_size_y(rect) + 1;
 	char err_out[256];
diff --git a/source/blender/gpu/shaders/gpu_shader_fx_dof_frag.glsl b/source/blender/gpu/shaders/gpu_shader_fx_dof_frag.glsl
index ffe1118..d52ab22 100644
--- a/source/blender/gpu/shaders/gpu_shader_fx_dof_frag.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_fx_dof_frag.gls

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list