DRW: Make use of new multisample resolve pass.
This commit is contained in:
@@ -102,20 +102,21 @@ typedef char DRWViewportEmptyList;
|
||||
}
|
||||
|
||||
/* Use of multisample framebuffers. */
|
||||
#define MULTISAMPLE_SYNC_ENABLE(dfbl) { \
|
||||
#define MULTISAMPLE_SYNC_ENABLE(dfbl, dtxl) { \
|
||||
if (dfbl->multisample_fb != NULL) { \
|
||||
DRW_stats_query_start("Multisample Blit"); \
|
||||
GPU_framebuffer_blit(dfbl->default_fb, 0, dfbl->multisample_fb, 0, GPU_COLOR_BIT | GPU_DEPTH_BIT); \
|
||||
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(); \
|
||||
} \
|
||||
}
|
||||
|
||||
#define MULTISAMPLE_SYNC_DISABLE(dfbl) { \
|
||||
#define MULTISAMPLE_SYNC_DISABLE(dfbl, dtxl) { \
|
||||
if (dfbl->multisample_fb != NULL) { \
|
||||
DRW_stats_query_start("Multisample Resolve"); \
|
||||
GPU_framebuffer_blit(dfbl->multisample_fb, 0, dfbl->default_fb, 0, GPU_COLOR_BIT | GPU_DEPTH_BIT); \
|
||||
GPU_framebuffer_bind(dfbl->default_fb); \
|
||||
DRW_multisamples_resolve(dtxl->multisample_depth, dtxl->multisample_color); \
|
||||
DRW_stats_query_end(); \
|
||||
} \
|
||||
}
|
||||
|
||||
@@ -129,8 +129,9 @@ static void EDIT_ARMATURE_draw_scene(void *vedata)
|
||||
{
|
||||
EDIT_ARMATURE_PassList *psl = ((EDIT_ARMATURE_Data *)vedata)->psl;
|
||||
DefaultFramebufferList *dfbl = DRW_viewport_framebuffer_list_get();
|
||||
DefaultTextureList *dtxl = DRW_viewport_texture_list_get();
|
||||
|
||||
MULTISAMPLE_SYNC_ENABLE(dfbl)
|
||||
MULTISAMPLE_SYNC_ENABLE(dfbl, dtxl)
|
||||
|
||||
DRW_draw_pass(psl->bone_envelope);
|
||||
DRW_draw_pass(psl->bone_outline);
|
||||
@@ -138,7 +139,7 @@ static void EDIT_ARMATURE_draw_scene(void *vedata)
|
||||
DRW_draw_pass(psl->bone_wire);
|
||||
DRW_draw_pass(psl->relationship);
|
||||
|
||||
MULTISAMPLE_SYNC_DISABLE(dfbl)
|
||||
MULTISAMPLE_SYNC_DISABLE(dfbl, dtxl)
|
||||
}
|
||||
|
||||
#if 0
|
||||
|
||||
@@ -285,9 +285,9 @@ static void EDIT_CURVE_draw_scene(void *vedata)
|
||||
DefaultFramebufferList *dfbl = DRW_viewport_framebuffer_list_get();
|
||||
DefaultTextureList *dtxl = DRW_viewport_texture_list_get();
|
||||
|
||||
UNUSED_VARS(fbl, dtxl);
|
||||
UNUSED_VARS(fbl);
|
||||
|
||||
MULTISAMPLE_SYNC_ENABLE(dfbl)
|
||||
MULTISAMPLE_SYNC_ENABLE(dfbl, dtxl)
|
||||
|
||||
/* Show / hide entire passes, swap framebuffers ... whatever you fancy */
|
||||
/*
|
||||
@@ -303,7 +303,7 @@ static void EDIT_CURVE_draw_scene(void *vedata)
|
||||
DRW_draw_pass(psl->overlay_edge_pass);
|
||||
DRW_draw_pass(psl->overlay_vert_pass);
|
||||
|
||||
MULTISAMPLE_SYNC_DISABLE(dfbl)
|
||||
MULTISAMPLE_SYNC_DISABLE(dfbl, dtxl)
|
||||
|
||||
/* If you changed framebuffer, double check you rebind
|
||||
* the default one with its textures attached before finishing */
|
||||
|
||||
@@ -227,9 +227,9 @@ static void EDIT_LATTICE_draw_scene(void *vedata)
|
||||
DefaultFramebufferList *dfbl = DRW_viewport_framebuffer_list_get();
|
||||
DefaultTextureList *dtxl = DRW_viewport_texture_list_get();
|
||||
|
||||
UNUSED_VARS(fbl, dtxl);
|
||||
UNUSED_VARS(fbl);
|
||||
|
||||
MULTISAMPLE_SYNC_ENABLE(dfbl)
|
||||
MULTISAMPLE_SYNC_ENABLE(dfbl, dtxl)
|
||||
|
||||
/* Show / hide entire passes, swap framebuffers ... whatever you fancy */
|
||||
/*
|
||||
@@ -244,7 +244,7 @@ static void EDIT_LATTICE_draw_scene(void *vedata)
|
||||
DRW_draw_pass(psl->wire_pass);
|
||||
DRW_draw_pass(psl->vert_pass);
|
||||
|
||||
MULTISAMPLE_SYNC_DISABLE(dfbl)
|
||||
MULTISAMPLE_SYNC_DISABLE(dfbl, dtxl)
|
||||
|
||||
/* If you changed framebuffer, double check you rebind
|
||||
* the default one with its textures attached before finishing */
|
||||
|
||||
@@ -2189,6 +2189,7 @@ static void OBJECT_draw_scene(void *vedata)
|
||||
OBJECT_FramebufferList *fbl = ((OBJECT_Data *)vedata)->fbl;
|
||||
OBJECT_PrivateData *g_data = stl->g_data;
|
||||
DefaultFramebufferList *dfbl = DRW_viewport_framebuffer_list_get();
|
||||
DefaultTextureList *dtxl = DRW_viewport_texture_list_get();
|
||||
|
||||
int id_ct_select = g_data->id_ofs_select;
|
||||
int id_ct_select_group = g_data->id_ofs_select_group;
|
||||
@@ -2207,7 +2208,7 @@ static void OBJECT_draw_scene(void *vedata)
|
||||
|
||||
float clearcol[4] = {0.0f, 0.0f, 0.0f, 0.0f};
|
||||
|
||||
MULTISAMPLE_SYNC_ENABLE(dfbl)
|
||||
MULTISAMPLE_SYNC_ENABLE(dfbl, dtxl)
|
||||
|
||||
/* This needs to be drawn after the oultine */
|
||||
// DRW_draw_pass(psl->bone_envelope); /* Never drawn in Object mode currently. */
|
||||
@@ -2218,7 +2219,7 @@ static void OBJECT_draw_scene(void *vedata)
|
||||
DRW_draw_pass(psl->particle);
|
||||
DRW_draw_pass(psl->reference_image);
|
||||
|
||||
MULTISAMPLE_SYNC_DISABLE(dfbl)
|
||||
MULTISAMPLE_SYNC_DISABLE(dfbl, dtxl)
|
||||
|
||||
if (DRW_state_is_fbo() && outline_calls > 0) {
|
||||
DRW_stats_group_start("Outlines");
|
||||
|
||||
Reference in New Issue
Block a user