Fix T47204: selection failing directly after disabling multisample in user prefs.
Now store the multisample setting each window was created with.
This commit is contained in:
@@ -6060,9 +6060,12 @@ static void direct_link_windowmanager(FileData *fd, wmWindowManager *wm)
|
|||||||
win->drawfail = 0;
|
win->drawfail = 0;
|
||||||
win->active = 0;
|
win->active = 0;
|
||||||
|
|
||||||
win->cursor = 0;
|
win->cursor = 0;
|
||||||
win->lastcursor = 0;
|
win->lastcursor = 0;
|
||||||
win->modalcursor = 0;
|
win->modalcursor = 0;
|
||||||
|
win->grabcursor = 0;
|
||||||
|
win->addmousemove = 0;
|
||||||
|
win->multisamples = 0;
|
||||||
win->stereo3d_format = newdataadr(fd, win->stereo3d_format);
|
win->stereo3d_format = newdataadr(fd, win->stereo3d_format);
|
||||||
|
|
||||||
/* multiview always fallback to anaglyph at file opening
|
/* multiview always fallback to anaglyph at file opening
|
||||||
|
|||||||
@@ -74,6 +74,7 @@ typedef struct ViewContext {
|
|||||||
struct Object *obedit;
|
struct Object *obedit;
|
||||||
struct ARegion *ar;
|
struct ARegion *ar;
|
||||||
struct View3D *v3d;
|
struct View3D *v3d;
|
||||||
|
struct wmWindow *win;
|
||||||
struct RegionView3D *rv3d;
|
struct RegionView3D *rv3d;
|
||||||
struct BMEditMesh *em;
|
struct BMEditMesh *em;
|
||||||
int mval[2];
|
int mval[2];
|
||||||
|
|||||||
@@ -1310,7 +1310,7 @@ static void drawviewborder(Scene *scene, ARegion *ar, View3D *v3d)
|
|||||||
|
|
||||||
/* *********************** backdraw for selection *************** */
|
/* *********************** backdraw for selection *************** */
|
||||||
|
|
||||||
static void backdrawview3d(Scene *scene, ARegion *ar, View3D *v3d)
|
static void backdrawview3d(Scene *scene, wmWindow *win, ARegion *ar, View3D *v3d)
|
||||||
{
|
{
|
||||||
RegionView3D *rv3d = ar->regiondata;
|
RegionView3D *rv3d = ar->regiondata;
|
||||||
struct Base *base = scene->basact;
|
struct Base *base = scene->basact;
|
||||||
@@ -1365,7 +1365,7 @@ static void backdrawview3d(Scene *scene, ARegion *ar, View3D *v3d)
|
|||||||
if (multisample_enabled)
|
if (multisample_enabled)
|
||||||
glDisable(GL_MULTISAMPLE);
|
glDisable(GL_MULTISAMPLE);
|
||||||
|
|
||||||
if (U.ogl_multisamples != USER_MULTISAMPLE_NONE) {
|
if (win->multisamples != USER_MULTISAMPLE_NONE) {
|
||||||
/* for multisample we use an offscreen FBO. multisample drawing can fail
|
/* for multisample we use an offscreen FBO. multisample drawing can fail
|
||||||
* with color coded selection drawing, and reading back depths from such
|
* with color coded selection drawing, and reading back depths from such
|
||||||
* a buffer can also cause a few seconds freeze on OS X / NVidia. */
|
* a buffer can also cause a few seconds freeze on OS X / NVidia. */
|
||||||
@@ -1456,7 +1456,7 @@ static void view3d_opengl_read_Z_pixels(ARegion *ar, int x, int y, int w, int h,
|
|||||||
void ED_view3d_backbuf_validate(ViewContext *vc)
|
void ED_view3d_backbuf_validate(ViewContext *vc)
|
||||||
{
|
{
|
||||||
if (vc->v3d->flag & V3D_INVALID_BACKBUF)
|
if (vc->v3d->flag & V3D_INVALID_BACKBUF)
|
||||||
backdrawview3d(vc->scene, vc->ar, vc->v3d);
|
backdrawview3d(vc->scene, vc->win, vc->ar, vc->v3d);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -3830,6 +3830,7 @@ static void update_lods(Scene *scene, float camera_pos[3])
|
|||||||
static void view3d_main_region_draw_objects(const bContext *C, Scene *scene, View3D *v3d,
|
static void view3d_main_region_draw_objects(const bContext *C, Scene *scene, View3D *v3d,
|
||||||
ARegion *ar, const char **grid_unit)
|
ARegion *ar, const char **grid_unit)
|
||||||
{
|
{
|
||||||
|
wmWindow *win = CTX_wm_window(C);
|
||||||
RegionView3D *rv3d = ar->regiondata;
|
RegionView3D *rv3d = ar->regiondata;
|
||||||
unsigned int lay_used = v3d->lay_used;
|
unsigned int lay_used = v3d->lay_used;
|
||||||
|
|
||||||
@@ -3883,7 +3884,7 @@ static void view3d_main_region_draw_objects(const bContext *C, Scene *scene, Vie
|
|||||||
view3d_main_region_clear(scene, v3d, ar);
|
view3d_main_region_clear(scene, v3d, ar);
|
||||||
|
|
||||||
/* enables anti-aliasing for 3D view drawing */
|
/* enables anti-aliasing for 3D view drawing */
|
||||||
if (U.ogl_multisamples != USER_MULTISAMPLE_NONE) {
|
if (win->multisamples != USER_MULTISAMPLE_NONE) {
|
||||||
glEnable(GL_MULTISAMPLE);
|
glEnable(GL_MULTISAMPLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3896,7 +3897,7 @@ static void view3d_main_region_draw_objects(const bContext *C, Scene *scene, Vie
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Disable back anti-aliasing */
|
/* Disable back anti-aliasing */
|
||||||
if (U.ogl_multisamples != USER_MULTISAMPLE_NONE) {
|
if (win->multisamples != USER_MULTISAMPLE_NONE) {
|
||||||
glDisable(GL_MULTISAMPLE);
|
glDisable(GL_MULTISAMPLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -108,6 +108,7 @@ void view3d_set_viewcontext(bContext *C, ViewContext *vc)
|
|||||||
vc->ar = CTX_wm_region(C);
|
vc->ar = CTX_wm_region(C);
|
||||||
vc->scene = CTX_data_scene(C);
|
vc->scene = CTX_data_scene(C);
|
||||||
vc->v3d = CTX_wm_view3d(C);
|
vc->v3d = CTX_wm_view3d(C);
|
||||||
|
vc->win = CTX_wm_window(C);
|
||||||
vc->rv3d = CTX_wm_region_view3d(C);
|
vc->rv3d = CTX_wm_region_view3d(C);
|
||||||
vc->obact = CTX_data_active_object(C);
|
vc->obact = CTX_data_active_object(C);
|
||||||
vc->obedit = CTX_data_edit_object(C);
|
vc->obedit = CTX_data_edit_object(C);
|
||||||
|
|||||||
@@ -190,6 +190,8 @@ typedef struct wmWindow {
|
|||||||
short modalcursor; /* the current modal cursor */
|
short modalcursor; /* the current modal cursor */
|
||||||
short grabcursor; /* cursor grab mode */
|
short grabcursor; /* cursor grab mode */
|
||||||
short addmousemove; /* internal: tag this for extra mousemove event, makes cursors/buttons active on UI switching */
|
short addmousemove; /* internal: tag this for extra mousemove event, makes cursors/buttons active on UI switching */
|
||||||
|
short multisamples; /* amount of samples for OpenGL FSA the ghost window was created with, if zero no FSA */
|
||||||
|
short pad[3];
|
||||||
|
|
||||||
int winid; /* winid also in screens, is for retrieving this window after read */
|
int winid; /* winid also in screens, is for retrieving this window after read */
|
||||||
|
|
||||||
|
|||||||
@@ -182,6 +182,7 @@ static void wm_window_match_init(bContext *C, ListBase *wmlist)
|
|||||||
static void wm_window_substitute_old(wmWindowManager *wm, wmWindow *oldwin, wmWindow *win)
|
static void wm_window_substitute_old(wmWindowManager *wm, wmWindow *oldwin, wmWindow *win)
|
||||||
{
|
{
|
||||||
win->ghostwin = oldwin->ghostwin;
|
win->ghostwin = oldwin->ghostwin;
|
||||||
|
win->multisamples = oldwin->multisamples;
|
||||||
win->active = oldwin->active;
|
win->active = oldwin->active;
|
||||||
if (win->active)
|
if (win->active)
|
||||||
wm->winactive = win;
|
wm->winactive = win;
|
||||||
@@ -190,6 +191,7 @@ static void wm_window_substitute_old(wmWindowManager *wm, wmWindow *oldwin, wmWi
|
|||||||
GHOST_SetWindowUserData(win->ghostwin, win); /* pointer back */
|
GHOST_SetWindowUserData(win->ghostwin, win); /* pointer back */
|
||||||
|
|
||||||
oldwin->ghostwin = NULL;
|
oldwin->ghostwin = NULL;
|
||||||
|
oldwin->multisamples = 0;
|
||||||
|
|
||||||
win->eventstate = oldwin->eventstate;
|
win->eventstate = oldwin->eventstate;
|
||||||
oldwin->eventstate = NULL;
|
oldwin->eventstate = NULL;
|
||||||
|
|||||||
@@ -163,6 +163,7 @@ static void wm_ghostwindow_destroy(wmWindow *win)
|
|||||||
if (win->ghostwin) {
|
if (win->ghostwin) {
|
||||||
GHOST_DisposeWindow(g_system, win->ghostwin);
|
GHOST_DisposeWindow(g_system, win->ghostwin);
|
||||||
win->ghostwin = NULL;
|
win->ghostwin = NULL;
|
||||||
|
win->multisamples = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -433,6 +434,9 @@ static void wm_window_ghostwindow_add(wmWindowManager *wm, const char *title, wm
|
|||||||
if (win->eventstate == NULL)
|
if (win->eventstate == NULL)
|
||||||
win->eventstate = MEM_callocN(sizeof(wmEvent), "window event state");
|
win->eventstate = MEM_callocN(sizeof(wmEvent), "window event state");
|
||||||
|
|
||||||
|
/* store multisamples window was created with, in case user prefs change */
|
||||||
|
win->multisamples = multisamples;
|
||||||
|
|
||||||
/* store actual window size in blender window */
|
/* store actual window size in blender window */
|
||||||
bounds = GHOST_GetClientBounds(win->ghostwin);
|
bounds = GHOST_GetClientBounds(win->ghostwin);
|
||||||
win->sizex = GHOST_GetWidthRectangle(bounds);
|
win->sizex = GHOST_GetWidthRectangle(bounds);
|
||||||
|
|||||||
Reference in New Issue
Block a user