multiview pageflip working on X11 #44327

Closed
opened 2015-04-09 17:54:28 +02:00 by Cédric PAILLE · 18 comments

Just to say that I've been able to activate "pageflip" mode (time sequential) just by adding 1 line in wm_stereo.c :

Only tried with X11/Linux

static void wm_method_draw_stereo3d_pageflip(wmWindow *win)
{
	wmDrawData *drawdata;
	int view;

	for (view = 0; view < 2; view ++) {
		drawdata = BLI_findlink(&win->drawdata, (view * 2) + 1);

		if (view == STEREO_LEFT_ID)
			glDrawBuffer(GL_BACK_LEFT);
		else //STEREO_RIGHT_ID
			glDrawBuffer(GL_BACK_RIGHT);

		wm_triple_draw_textures(win, drawdata->triple, 1.0f);
	}
----->(HERE)	glDrawBuffer(GL_BACK);
}
Just to say that I've been able to activate "pageflip" mode (time sequential) just by adding 1 line in wm_stereo.c : Only tried with X11/Linux ``` static void wm_method_draw_stereo3d_pageflip(wmWindow *win) { wmDrawData *drawdata; int view; for (view = 0; view < 2; view ++) { drawdata = BLI_findlink(&win->drawdata, (view * 2) + 1); if (view == STEREO_LEFT_ID) glDrawBuffer(GL_BACK_LEFT); else //STEREO_RIGHT_ID glDrawBuffer(GL_BACK_RIGHT); wm_triple_draw_textures(win, drawdata->triple, 1.0f); } ----->(HERE) glDrawBuffer(GL_BACK); } ```
Author

Changed status to: 'Open'

Changed status to: 'Open'
Author

Added subscriber: @CedricPAILLE

Added subscriber: @CedricPAILLE

Added subscriber: @dfelinto

Added subscriber: @dfelinto

Can you try something else?
See if what you get from glGetBooleanv(GL_STEREO) before and and after you set your stereo mode to time sequential

(also I committed your patch, thanks)

Can you try something else? See if what you get from glGetBooleanv(GL_STEREO) before and and after you set your stereo mode to time sequential (also I committed your patch, thanks)

For example, try to call the following function:

static bool wm_stereo3d_is_quadbuffer()
{
    int gl_stereo = 0;
    glGetBooleanv(GL_STEREO, (GLboolean *)&gl_stereo);
    return gl_stereo != 0;
}
For example, try to call the following function: ``` static bool wm_stereo3d_is_quadbuffer() { int gl_stereo = 0; glGetBooleanv(GL_STEREO, (GLboolean *)&gl_stereo); return gl_stereo != 0; } ```
Author

I'll try tomorrow but I guess it'll return true cause I've enabled stereo in ghost glx

I'll try tomorrow but I guess it'll return true cause I've enabled stereo in ghost glx

Yes but I wonder if it will return True always, or only after the window is created with the quadbuffer/stereo context. And thanks

Yes but I wonder if it will return True always, or only after the window is created with the quadbuffer/stereo context. And thanks

(updated the code snippet with the correct flag)

(updated the code snippet with the correct flag)
Author

Okay,

For me, pageflipping doesn't require fullscreen mode, so :

static bool wm_stereo3d_is_fullscreen_required(eStereoDisplayMode stereo_display)
{
	return ELEM(stereo_display,
	            S3D_DISPLAY_SIDEBYSIDE,
	            S3D_DISPLAY_TOPBOTTOM/*,
	            S3D_DISPLAY_PAGEFLIP*/);
}

next, I don't know why, I've a crash after "wm_stereo3d_set_exec" at "wm_window_fullscreen_toggle_exec" when switching to pageflip mode, so I've changed to code to this (You don't have to apply this one if you applied the patch above):

 /* fullscreen operator callback */
int wm_window_fullscreen_toggle_exec(bContext *C, wmOperator *UNUSED(op))
{
	wmWindow *window = CTX_wm_window(C);
	GHOST_TWindowState state;

	if (G.background || window == NULL)
		return OPERATOR_CANCELLED;

	state = GHOST_GetWindowState(window->ghostwin);
	if (state != GHOST_kWindowStateFullScreen)
		GHOST_SetWindowState(window->ghostwin, GHOST_kWindowStateFullScreen);
	else
		GHOST_SetWindowState(window->ghostwin, GHOST_kWindowStateNormal);

	return OPERATOR_FINISHED;
	
}

"window" is null here and generates a crash

to finish, yes, before calling "wm_stereo3d_set_exec", glGetBooleanv(GL_STEREO, ..) returns 0 and 1 after, so, it's working normally

Best regards, and thank you.

Okay, For me, pageflipping doesn't require fullscreen mode, so : ``` static bool wm_stereo3d_is_fullscreen_required(eStereoDisplayMode stereo_display) { return ELEM(stereo_display, S3D_DISPLAY_SIDEBYSIDE, S3D_DISPLAY_TOPBOTTOM/*, S3D_DISPLAY_PAGEFLIP*/); } ``` next, I don't know why, I've a crash after "**wm_stereo3d_set_exec**" at "**wm_window_fullscreen_toggle_exec**" when switching to *pageflip* mode, so I've changed to code to this (You don't have to apply this one if you applied the patch above): ``` /* fullscreen operator callback */ int wm_window_fullscreen_toggle_exec(bContext *C, wmOperator *UNUSED(op)) { wmWindow *window = CTX_wm_window(C); GHOST_TWindowState state; if (G.background || window == NULL) return OPERATOR_CANCELLED; state = GHOST_GetWindowState(window->ghostwin); if (state != GHOST_kWindowStateFullScreen) GHOST_SetWindowState(window->ghostwin, GHOST_kWindowStateFullScreen); else GHOST_SetWindowState(window->ghostwin, GHOST_kWindowStateNormal); return OPERATOR_FINISHED; } ``` "**window**" is null here and generates a crash to finish, yes, before calling "**wm_stereo3d_set_exec**", *glGetBooleanv(GL_STEREO, ..)* returns 0 and 1 after, so, it's working normally Best regards, and thank you.

Added subscriber: @Sergey

Added subscriber: @Sergey
Author

This comment was removed by @CedricPAILLE

*This comment was removed by @CedricPAILLE*
Author

I've tested last commit, there's a problem remaining with quadbuffer, the GL_STEREO test is done before creating the new window, and I get an error:
"Quadbuffer not supported"

so, I've tuned the code to that :

int wm_stereo3d_set_exec(bContext *C, wmOperator *op)
{
	wmWindowManager *wm = CTX_wm_manager(C);
	wmWindow *win = CTX_wm_window(C);
	const bool is_fullscreen = WM_window_is_fullscreen(win);
	char display_mode = win->stereo3d_format->display_mode;

	if (G.background)
		return OPERATOR_CANCELLED;

	if (op->customdata) {
		Stereo3dData *s3dd = op->customdata;
		*win->stereo3d_format = s3dd->stereo3d_format;
	}

	/* pageflip requires a new window to be created with the proper OS flags */
	if (win->stereo3d_format->display_mode == S3D_DISPLAY_PAGEFLIP) {
		if (wm_window_duplicate_exec(C, op) == OPERATOR_FINISHED) {
			wm_window_close(C, wm, win);
			win = wm->windows.last;
		}
		else {
			BKE_reportf(op->reports, RPT_ERROR,
			            "Fail to create a window compatible with time sequential (page-flip) display method");
			win->stereo3d_format->display_mode = display_mode;
			return OPERATOR_CANCELLED;
		}
		if (wm_stereo3d_quadbuffer_supported() == false) {
			BKE_reportf(op->reports, RPT_ERROR,
			            "Quadbuffer not supported by the system");
			win->stereo3d_format->display_mode = display_mode;
			return OPERATOR_CANCELLED;
		}
	}

	if (wm_stereo3d_is_fullscreen_required(win->stereo3d_format->display_mode)) {
		if (!is_fullscreen) {
			BKE_reportf(op->reports, RPT_INFO, "Stereo 3D Mode requires the window to be fullscreen");
		}
	}

	if (op->customdata) {
		MEM_freeN(op->customdata);
	}

	WM_event_add_notifier(C, NC_WINDOW, NULL);
	return OPERATOR_FINISHED;
}

and it's ok

I've tested last commit, there's a problem remaining with quadbuffer, the GL_STEREO test is done before creating the new window, and I get an error: "Quadbuffer not supported" so, I've tuned the code to that : ``` int wm_stereo3d_set_exec(bContext *C, wmOperator *op) { wmWindowManager *wm = CTX_wm_manager(C); wmWindow *win = CTX_wm_window(C); const bool is_fullscreen = WM_window_is_fullscreen(win); char display_mode = win->stereo3d_format->display_mode; if (G.background) return OPERATOR_CANCELLED; if (op->customdata) { Stereo3dData *s3dd = op->customdata; *win->stereo3d_format = s3dd->stereo3d_format; } /* pageflip requires a new window to be created with the proper OS flags */ if (win->stereo3d_format->display_mode == S3D_DISPLAY_PAGEFLIP) { if (wm_window_duplicate_exec(C, op) == OPERATOR_FINISHED) { wm_window_close(C, wm, win); win = wm->windows.last; } else { BKE_reportf(op->reports, RPT_ERROR, "Fail to create a window compatible with time sequential (page-flip) display method"); win->stereo3d_format->display_mode = display_mode; return OPERATOR_CANCELLED; } if (wm_stereo3d_quadbuffer_supported() == false) { BKE_reportf(op->reports, RPT_ERROR, "Quadbuffer not supported by the system"); win->stereo3d_format->display_mode = display_mode; return OPERATOR_CANCELLED; } } if (wm_stereo3d_is_fullscreen_required(win->stereo3d_format->display_mode)) { if (!is_fullscreen) { BKE_reportf(op->reports, RPT_INFO, "Stereo 3D Mode requires the window to be fullscreen"); } } if (op->customdata) { MEM_freeN(op->customdata); } WM_event_add_notifier(C, NC_WINDOW, NULL); return OPERATOR_FINISHED; } ``` and it's ok

Can you get on IRC today at some point? There are something else I would like you to try, but it's counterproductive to do it from here.

  • blendercoders my nick is dfelinto Thanks!
Can you get on IRC today at some point? There are something else I would like you to try, but it's counterproductive to do it from here. - blendercoders my nick is dfelinto Thanks!

Or rather, what I still wanted to test is what you get if you add the wm_stereo3d_quadbuffer_supported() test right after the wm_window_close().
I wonder if Blender is already using the new "opengl context". (add a print in the test to see what it returns)

Another option is to add CTX_wm_window_set(C, win); right after the win = wm->windows.last; and add the test after that.

Or rather, what I still wanted to test is what you get if you add the `wm_stereo3d_quadbuffer_supported()` test right after the `wm_window_close()`. I wonder if Blender is already using the new "opengl context". (add a print in the test to see what it returns) Another option is to add `CTX_wm_window_set(C, win);` right after the `win = wm->windows.last;` and add the test after that.
Author

we can chat on irc monday morning if you wish I don't have access to my computer this weekend.

we can chat on irc monday morning if you wish I don't have access to my computer this weekend.
Author

FYI, wm_stereo3d_quadbuffer_supported() returns true after wm_window_close(). I'm on IRC (cedricp) if you wanna chat.

FYI, wm_stereo3d_quadbuffer_supported() returns true after wm_window_close(). I'm on IRC (cedricp) if you wanna chat.
Dalai Felinto was assigned by Sergey Sharybin 2015-04-16 12:48:37 +02:00

Changed status from 'Open' to: 'Resolved'

Changed status from 'Open' to: 'Resolved'

@CedricPAILLE I committed the code based on the code snippets here and it's working fine in a linux + quadro + nvidia 3d vision.
I'll try on my Mac later, to make sure it doesnt crash everything when stereo is not supported.

So far this is enabled only in debug builds, more details in the commit log in efe41ae7fd

Thanks for all the testing.

@CedricPAILLE I committed the code based on the code snippets here and it's working fine in a linux + quadro + nvidia 3d vision. I'll try on my Mac later, to make sure it doesnt crash everything when stereo is not supported. So far this is enabled only in debug builds, more details in the commit log in efe41ae7fd Thanks for all the testing.
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
3 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#44327
No description provided.