Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorJeroen Bakker <jeroen@blender.org>2019-12-05 16:21:57 +0300
committerJeroen Bakker <jeroen@blender.org>2019-12-06 09:45:07 +0300
commit15abc9fe743e09f2ec7ef3a6bcfb8f4954bcf28c (patch)
tree49fc31a16b2e89d0fd67f8756dc164c82098a23c /source
parent601eafd104ca66e3baaa45e9ecb00989395c55d9 (diff)
Draw: Removal of MultiSample Buffers
Multisample buffers were used for smooth line drawing. As we now have an algorithm that doesn't need the multisample buffers we can remove them. The user preference for viewport multi_sampling is replaced by single toggle overlay `use_overlay_smooth_wire`. By default this setting is enabled as the new drawing is really quick (<1ms) and uses zero hacks. Reviewed By: fclem Differential Revision: https://developer.blender.org/D6367
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenkernel/BKE_blender_version.h2
-rw-r--r--source/blender/blenkernel/BKE_sequencer.h1
-rw-r--r--source/blender/blenkernel/intern/sequencer.c1
-rw-r--r--source/blender/blenloader/intern/versioning_userdef.c14
-rw-r--r--source/blender/draw/engines/overlay/overlay_antialiasing.c9
-rw-r--r--source/blender/draw/intern/DRW_render.h38
-rw-r--r--source/blender/editors/include/ED_view3d.h2
-rw-r--r--source/blender/editors/render/render_opengl.c7
-rw-r--r--source/blender/editors/sculpt_paint/paint_image_proj.c1
-rw-r--r--source/blender/editors/space_view3d/view3d_draw.c5
-rw-r--r--source/blender/makesdna/DNA_userdef_types.h1
-rw-r--r--source/blender/makesrna/intern/rna_userdef.c9
-rw-r--r--source/blender/windowmanager/intern/wm_files.c2
13 files changed, 23 insertions, 69 deletions
diff --git a/source/blender/blenkernel/BKE_blender_version.h b/source/blender/blenkernel/BKE_blender_version.h
index f1c45ac0b45..a26b76e7069 100644
--- a/source/blender/blenkernel/BKE_blender_version.h
+++ b/source/blender/blenkernel/BKE_blender_version.h
@@ -27,7 +27,7 @@
* \note Use #STRINGIFY() rather than defining with quotes.
*/
#define BLENDER_VERSION 282
-#define BLENDER_SUBVERSION 3
+#define BLENDER_SUBVERSION 4
/** Several breakages with 280, e.g. collections vs layers. */
#define BLENDER_MINVERSION 280
#define BLENDER_MINSUBVERSION 0
diff --git a/source/blender/blenkernel/BKE_sequencer.h b/source/blender/blenkernel/BKE_sequencer.h
index 1ae1772e094..770318883c0 100644
--- a/source/blender/blenkernel/BKE_sequencer.h
+++ b/source/blender/blenkernel/BKE_sequencer.h
@@ -531,7 +531,6 @@ typedef struct ImBuf *(*SequencerDrawView)(struct Depsgraph *depsgraph,
unsigned int flag,
unsigned int draw_flags,
int alpha_mode,
- int samples,
const char *viewname,
struct GPUOffScreen *ofs,
char err_out[256]);
diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c
index b99d6e1684a..b05724ca6af 100644
--- a/source/blender/blenkernel/intern/sequencer.c
+++ b/source/blender/blenkernel/intern/sequencer.c
@@ -3558,7 +3558,6 @@ static ImBuf *seq_render_scene_strip(const SeqRenderData *context,
IB_rect,
draw_flags,
scene->r.alphamode,
- U.ogl_multisamples,
viewname,
context->gpu_offscreen,
err_out);
diff --git a/source/blender/blenloader/intern/versioning_userdef.c b/source/blender/blenloader/intern/versioning_userdef.c
index ad06d512266..4c85b5abd97 100644
--- a/source/blender/blenloader/intern/versioning_userdef.c
+++ b/source/blender/blenloader/intern/versioning_userdef.c
@@ -667,10 +667,7 @@ void BLO_version_defaults_userpref_blend(Main *bmain, UserDef *userdef)
userdef->file_space_data.filter_id = U_default.file_space_data.filter_id;
}
- /**
- * Include next version bump.
- */
- {
+ if (!USER_VERSION_ATLEAST(282, 4)) {
if (userdef->view_rotate_sensitivity_turntable == 0.0f) {
userdef->view_rotate_sensitivity_turntable = DEG2RADF(0.4f);
userdef->view_rotate_sensitivity_trackball = 1.0f;
@@ -678,6 +675,15 @@ void BLO_version_defaults_userpref_blend(Main *bmain, UserDef *userdef)
if (userdef->scrollback == 0) {
userdef->scrollback = U_default.scrollback;
}
+
+ /* Enable Overlay Engine Smooth Wire by default */
+ userdef->gpu_flag |= USER_GPU_FLAG_OVERLAY_SMOOTH_WIRE;
+ }
+
+ /**
+ * Include next version bump.
+ */
+ {
/* pass */
}
diff --git a/source/blender/draw/engines/overlay/overlay_antialiasing.c b/source/blender/draw/engines/overlay/overlay_antialiasing.c
index 54bcd91441c..8c50bfac908 100644
--- a/source/blender/draw/engines/overlay/overlay_antialiasing.c
+++ b/source/blender/draw/engines/overlay/overlay_antialiasing.c
@@ -76,8 +76,8 @@ void OVERLAY_antialiasing_init(OVERLAY_Data *vedata)
}
bool need_wire_expansion = (G_draw.block.sizePixel > 1.0f);
- /* TODO Get real userpref option and remove MSAA buffer. */
- pd->antialiasing.enabled = (dtxl->multisample_color != NULL) || need_wire_expansion;
+ pd->antialiasing.enabled = need_wire_expansion ||
+ ((U.gpu_flag & USER_GPU_FLAG_OVERLAY_SMOOTH_WIRE) > 0);
GPUTexture *color_tex = NULL;
GPUTexture *line_tex = NULL;
@@ -122,8 +122,9 @@ void OVERLAY_antialiasing_cache_init(OVERLAY_Data *vedata)
DRWShadingGroup *grp;
if (pd->antialiasing.enabled) {
- /* TODO Get real userpref option and remove MSAA buffer. */
- const bool do_smooth_lines = (dtxl->multisample_color != NULL);
+ /* `antialiasing.enabled` is also enabled for wire expansion. Check here if
+ * anti aliasing is needed. */
+ const bool do_smooth_lines = (U.gpu_flag & USER_GPU_FLAG_OVERLAY_SMOOTH_WIRE) > 0;
DRW_PASS_CREATE(psl->antialiasing_ps, DRW_STATE_WRITE_COLOR | DRW_STATE_BLEND_ALPHA_PREMUL);
diff --git a/source/blender/draw/intern/DRW_render.h b/source/blender/draw/intern/DRW_render.h
index 27b43ee8c17..8037bd03383 100644
--- a/source/blender/draw/intern/DRW_render.h
+++ b/source/blender/draw/intern/DRW_render.h
@@ -101,41 +101,6 @@ typedef char DRWViewportEmptyList;
DRW_VIEWPORT_LIST_SIZE(*(((ty *)NULL)->stl)), \
}
-/* Use of multisample framebuffers. */
-#define MULTISAMPLE_SYNC_ENABLE(dfbl, dtxl) \
- { \
- if (dfbl->multisample_fb != NULL && DRW_state_is_fbo()) { \
- DRW_stats_query_start("Multisample Blit"); \
- GPU_framebuffer_bind(dfbl->multisample_fb); \
- /* TODO clear only depth but need to do alpha to coverage for transparencies. */ \
- GPU_framebuffer_clear_color_depth(dfbl->multisample_fb, (const float[4]){0.0f}, 1.0f); \
- DRW_stats_query_end(); \
- } \
- } \
- ((void)0)
-
-#define MULTISAMPLE_SYNC_DISABLE(dfbl, dtxl) \
- { \
- if (dfbl->multisample_fb != NULL && DRW_state_is_fbo()) { \
- DRW_stats_query_start("Multisample Resolve"); \
- GPU_framebuffer_bind(dfbl->default_fb); \
- DRW_multisamples_resolve(dtxl->multisample_depth, dtxl->multisample_color, true); \
- DRW_stats_query_end(); \
- } \
- } \
- ((void)0)
-
-#define MULTISAMPLE_SYNC_DISABLE_NO_DEPTH(dfbl, dtxl) \
- { \
- if (dfbl->multisample_fb != NULL && DRW_state_is_fbo()) { \
- DRW_stats_query_start("Multisample Resolve"); \
- GPU_framebuffer_bind(dfbl->default_fb); \
- DRW_multisamples_resolve(dtxl->multisample_depth, dtxl->multisample_color, false); \
- DRW_stats_query_end(); \
- } \
- } \
- ((void)0)
-
typedef struct DrawEngineDataSize {
int fbl_len;
int txl_len;
@@ -176,15 +141,12 @@ typedef struct DefaultFramebufferList {
struct GPUFrameBuffer *in_front_fb;
struct GPUFrameBuffer *color_only_fb;
struct GPUFrameBuffer *depth_only_fb;
- struct GPUFrameBuffer *multisample_fb;
} DefaultFramebufferList;
typedef struct DefaultTextureList {
struct GPUTexture *color;
struct GPUTexture *depth;
struct GPUTexture *depth_in_front;
- struct GPUTexture *multisample_color;
- struct GPUTexture *multisample_depth;
} DefaultTextureList;
#endif
diff --git a/source/blender/editors/include/ED_view3d.h b/source/blender/editors/include/ED_view3d.h
index 83caef29ca3..37ffb1b9d6d 100644
--- a/source/blender/editors/include/ED_view3d.h
+++ b/source/blender/editors/include/ED_view3d.h
@@ -593,7 +593,6 @@ struct ImBuf *ED_view3d_draw_offscreen_imbuf(struct Depsgraph *depsgraph,
int sizey,
unsigned int flag,
int alpha_mode,
- int samples,
const char *viewname,
struct GPUOffScreen *ofs,
char err_out[256]);
@@ -607,7 +606,6 @@ struct ImBuf *ED_view3d_draw_offscreen_imbuf_simple(struct Depsgraph *depsgraph,
unsigned int flag,
unsigned int draw_flags,
int alpha_mode,
- int samples,
const char *viewname,
struct GPUOffScreen *ofs,
char err_out[256]);
diff --git a/source/blender/editors/render/render_opengl.c b/source/blender/editors/render/render_opengl.c
index ad5f8ba6834..10244cfa3fd 100644
--- a/source/blender/editors/render/render_opengl.c
+++ b/source/blender/editors/render/render_opengl.c
@@ -114,7 +114,6 @@ typedef struct OGLRender {
ImageUser iuser;
GPUOffScreen *ofs;
- int ofs_samples;
int sizex, sizey;
int write_still;
@@ -371,7 +370,6 @@ static void screen_opengl_render_doit(const bContext *C, OGLRender *oglrender, R
sizey,
output_flags,
alpha_mode,
- oglrender->ofs_samples,
viewname,
oglrender->ofs,
err_out);
@@ -392,7 +390,6 @@ static void screen_opengl_render_doit(const bContext *C, OGLRender *oglrender, R
output_flags,
V3D_OFSDRAW_SHOW_ANNOTATION,
alpha_mode,
- oglrender->ofs_samples,
viewname,
oglrender->ofs,
err_out);
@@ -539,7 +536,6 @@ static bool screen_opengl_render_init(bContext *C, wmOperator *op)
const bool is_write_still = RNA_boolean_get(op->ptr, "write_still");
const eImageFormatDepth color_depth = (is_animation) ? scene->r.im_format.depth :
R_IMF_CHAN_DEPTH_32;
- const int samples = U.ogl_multisamples;
char err_out[256] = "unknown";
if (G.background) {
@@ -584,7 +580,7 @@ static bool screen_opengl_render_init(bContext *C, wmOperator *op)
/* corrects render size with actual size, not every card supports non-power-of-two dimensions */
DRW_opengl_context_enable(); /* Offscreen creation needs to be done in DRW context. */
- ofs = GPU_offscreen_create(sizex, sizey, samples, true, true, err_out);
+ ofs = GPU_offscreen_create(sizex, sizey, 0, true, true, err_out);
DRW_opengl_context_disable();
if (!ofs) {
@@ -607,7 +603,6 @@ static bool screen_opengl_render_init(bContext *C, wmOperator *op)
* output video handles, which does need evaluated scene. */
oglrender->depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
oglrender->cfrao = scene->r.cfra;
- oglrender->ofs_samples = samples;
oglrender->write_still = is_write_still && !is_animation;
oglrender->is_animation = is_animation;
diff --git a/source/blender/editors/sculpt_paint/paint_image_proj.c b/source/blender/editors/sculpt_paint/paint_image_proj.c
index fa4e250871e..510d734451b 100644
--- a/source/blender/editors/sculpt_paint/paint_image_proj.c
+++ b/source/blender/editors/sculpt_paint/paint_image_proj.c
@@ -6209,7 +6209,6 @@ static int texture_paint_image_from_view_exec(bContext *C, wmOperator *op)
h,
IB_rect,
R_ALPHAPREMUL,
- 0,
NULL,
NULL,
err_out);
diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c
index 5f029e840d3..6235f994272 100644
--- a/source/blender/editors/space_view3d/view3d_draw.c
+++ b/source/blender/editors/space_view3d/view3d_draw.c
@@ -1688,7 +1688,6 @@ ImBuf *ED_view3d_draw_offscreen_imbuf(Depsgraph *depsgraph,
int sizey,
uint flag,
int alpha_mode,
- int samples,
const char *viewname,
/* output vars */
GPUOffScreen *ofs,
@@ -1717,7 +1716,7 @@ ImBuf *ED_view3d_draw_offscreen_imbuf(Depsgraph *depsgraph,
if (own_ofs) {
/* bind */
- ofs = GPU_offscreen_create(sizex, sizey, samples, true, false, err_out);
+ ofs = GPU_offscreen_create(sizex, sizey, 0, true, false, err_out);
if (ofs == NULL) {
DRW_opengl_context_disable();
return NULL;
@@ -1835,7 +1834,6 @@ ImBuf *ED_view3d_draw_offscreen_imbuf_simple(Depsgraph *depsgraph,
uint flag,
uint draw_flags,
int alpha_mode,
- int samples,
const char *viewname,
GPUOffScreen *ofs,
char err_out[256])
@@ -1909,7 +1907,6 @@ ImBuf *ED_view3d_draw_offscreen_imbuf_simple(Depsgraph *depsgraph,
height,
flag,
alpha_mode,
- samples,
viewname,
ofs,
err_out);
diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h
index 11a0e441392..eb1b3036767 100644
--- a/source/blender/makesdna/DNA_userdef_types.h
+++ b/source/blender/makesdna/DNA_userdef_types.h
@@ -1042,6 +1042,7 @@ typedef enum eUserpref_UI_Flag2 {
typedef enum eUserpref_GPU_Flag {
USER_GPU_FLAG_NO_DEPT_PICK = (1 << 0),
USER_GPU_FLAG_NO_EDIT_MODE_SMOOTH_WIRE = (1 << 1),
+ USER_GPU_FLAG_OVERLAY_SMOOTH_WIRE = (1 << 2),
} eUserpref_GPU_Flag;
/** #UserDef.tablet_api */
diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c
index 5d2bf161020..64bca38882f 100644
--- a/source/blender/makesrna/intern/rna_userdef.c
+++ b/source/blender/makesrna/intern/rna_userdef.c
@@ -5062,12 +5062,11 @@ static void rna_def_userdef_system(BlenderRNA *brna)
/* OpenGL */
- /* Full scene anti-aliasing */
- prop = RNA_def_property(srna, "multi_sample", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_bitflag_sdna(prop, NULL, "ogl_multisamples");
- RNA_def_property_enum_items(prop, multi_sample_levels);
+ /* Viewport anti-aliasing */
+ prop = RNA_def_property(srna, "use_overlay_smooth_wire", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "gpu_flag", USER_GPU_FLAG_OVERLAY_SMOOTH_WIRE);
RNA_def_property_ui_text(
- prop, "MultiSample", "Enable OpenGL multi-sampling, only for systems that support it");
+ prop, "Overlay Smooth Wires", "Enable overlay smooth wires, reducing aliasing");
RNA_def_property_update(prop, 0, "rna_userdef_dpi_update");
prop = RNA_def_property(srna, "use_edit_mode_smooth_wire", PROP_BOOLEAN, PROP_NONE);
diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c
index f96a8c3d7fd..aa74aa81a74 100644
--- a/source/blender/windowmanager/intern/wm_files.c
+++ b/source/blender/windowmanager/intern/wm_files.c
@@ -1251,7 +1251,6 @@ static ImBuf *blend_file_thumb(const bContext *C,
IB_rect,
V3D_OFSDRAW_NONE,
R_ALPHAPREMUL,
- 0,
NULL,
NULL,
err_out);
@@ -1266,7 +1265,6 @@ static ImBuf *blend_file_thumb(const bContext *C,
BLEN_THUMB_SIZE * 2,
IB_rect,
R_ALPHAPREMUL,
- 0,
NULL,
NULL,
err_out);