vid_pickrenderer option?

Advanced OpenGL source port fork from ZDoom, picking up where ZDoomGL left off.
[Home] [Download] [Git builds (Win)] [Git builds (Mac)] [Wiki] [Repo] [Bugs&Suggestions]

Moderator: Graf Zahl

dpJudas
Developer
Developer
Posts: 798
Joined: Sat Jul 23, 2016 7:53

Re: vid_pickrenderer option?

Post by dpJudas »

From a quick Find in Files for vid_renderer it would seem that I_CreateRenderer() only creates the renderer once. My attempt at seeing if it can get away with a window recreate would be roughly as follows:

1. Change I_CreateRenderer to check if currentrenderer is different from vid_renderer, and delete and create a new renderer if it is.
2. Set setmodeneeded to true in the vid_renderer CUSTOM_CVAR handler.
3. In V_DoModeSetup, delete 'screen' and set it to null if vid_renderer changed. Extra points for doing this the zdoom way with some global variable that you set to true in the CUSTOM_CVAR handler. ;)

As with all zdoom video code: Don't try this at home. It may burn down your PC and kill your cat! :D
User avatar
Rachael
Developer
Developer
Posts: 3651
Joined: Sat May 13, 2006 10:30

Re: vid_pickrenderer option?

Post by Rachael »

dpJudas wrote:It may burn down your PC and kill your cat! :D
You can burn down my PC but DON'T KILL MY CAT!!!!! >_<

Anyway, I'll give this a try. What I was doing before was calling these commands inside the CUSTOM_CVAR handler:

Code: Select all

		I_ShutdownGraphics();
		currentrenderer = self;
		I_InitGraphics();
I did setmodeneeded, too, but that didn't have any effect either.
dpJudas
Developer
Developer
Posts: 798
Joined: Sat Jul 23, 2016 7:53

Re: vid_pickrenderer option?

Post by dpJudas »

Ah, but your approach is way too optimistic! It is actually assuming the video code functions do what they say they do! Of course they don't! :D
User avatar
Rachael
Developer
Developer
Posts: 3651
Joined: Sat May 13, 2006 10:30

Re: vid_pickrenderer option?

Post by Rachael »

https://github.com/raa-eruanna/qzdoom/c ... h?expand=1

Well, it was worth a shot. I don't think it actually destroys the window - it still crashes.
dpJudas
Developer
Developer
Posts: 798
Joined: Sat Jul 23, 2016 7:53

Re: vid_pickrenderer option?

Post by dpJudas »

My attempt would roughly be like this:

Code: Select all

bool vid_renderer_changed = false;

CUSTOM_CVAR (Int, vid_renderer, 0, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_NOINITCALL)
{
	vid_renderer_changed = true;
	setmodeneeded = true;
}

bool V_DoModeSetup (int width, int height, int bits)
{
	if (vid_renderer_changed)
	{
		vid_renderer_changed = false;
		delete screen;
		screen = nullptr;
		I_DeleteRenderer();
		Renderer = nullptr;
		I_CreateRenderer();
	}

	DFrameBuffer *buff = I_SetMode (width, height, screen);

	... the rest of the function as it looks like today ..
}
The "setmodeneeded = true" is to fool zdoom into moving to a point in the code where I'm sure it is safe to delete screen. Once screen is deleted, I know the OpenGL window is gone, so we switch renderer. The I_SetMode call then creates a new screen, which the current V_DoModeSetup then assigns to the global screen variable. That means I can be sure that the rest of zdoom can handle a new screen at this point. The big unknown is whether the code can also handle a new renderer at this very spot.

The main reason I don't attempt to do anything in the CUSTOM_CVAR handler is because I have no idea when zdoom might call it in its game loop.
User avatar
Rachael
Developer
Developer
Posts: 3651
Joined: Sat May 13, 2006 10:30

Re: vid_pickrenderer option?

Post by Rachael »

Also crashed - I think I got everything exactly the way you suggested. It may or may not be Win10's DWM, but I do not see it destroying the window at all. The same window is used until it crashes.
dpJudas
Developer
Developer
Posts: 798
Joined: Sat Jul 23, 2016 7:53

Re: vid_pickrenderer option?

Post by dpJudas »

Very close - the I_SetMode call needs to be after the added code in V_DoModeSetup. :) I_SetMode is what creates a new screen. If it still crashes after this, then it probably requires far more extensive changes to get to work.
User avatar
Rachael
Developer
Developer
Posts: 3651
Joined: Sat May 13, 2006 10:30

Re: vid_pickrenderer option?

Post by Rachael »

Still crashed - but I am not gonna give up on this completely. I'll leave the branch where it is to pick it up later. :)

I don't know how it's spawning its window, but that's something that I think needs to be deleted and recreated.
User avatar
Graf Zahl
GZDoom Developer
GZDoom Developer
Posts: 7148
Joined: Wed Jul 20, 2005 9:48
Location: Germany
Contact:

Re: vid_pickrenderer option?

Post by Graf Zahl »

Welcome to a route I already had taken many, many years ago. My suspicion back then was that D3D injects some hooks into the application that make it go belly-up if OpenGL is being initialized, I never could find out what precisely caused it so I gave up.
ibm5155
Posts: 152
Joined: Tue Oct 25, 2011 13:05

Re: vid_pickrenderer option?

Post by ibm5155 »

But I still run zdoom under a win 98 machine with a 1mb 2d gpu :p
haha, I'd prefer to run vanilla doom on it, both gaves low fps on doom2 map01, so you cant even play zdoom mods...
Or, with my powerfull k6-iii+ and a voodoo 3, play the broken doom legacy with the glide render :B
dpJudas
Developer
Developer
Posts: 798
Joined: Sat Jul 23, 2016 7:53

Re: vid_pickrenderer option?

Post by dpJudas »

I'm not sure the term GPU really qualifies for your Tseng ET4000. :p
User avatar
Rachael
Developer
Developer
Posts: 3651
Joined: Sat May 13, 2006 10:30

Re: vid_pickrenderer option?

Post by Rachael »

dpJudas wrote:Tseng ET4000
The days when you were not a true gamer without a SVGA card that virtually no game actually used. :D
dpJudas
Developer
Developer
Posts: 798
Joined: Sat Jul 23, 2016 7:53

Re: vid_pickrenderer option?

Post by dpJudas »

SVGA was for the jpegs you had downloaded from a BBS countries away! :) The ET4000 had faster memory access or something - I can't really remember the details anymore!
User avatar
Rachael
Developer
Developer
Posts: 3651
Joined: Sat May 13, 2006 10:30

Re: vid_pickrenderer option?

Post by Rachael »

I never played with BBS's back in the day. I was too young and my dad was a control freak about the telephone. (Though, he used them, himself)

Ironically my dad had nothing good to say about Doom except for the way it rendered 3D - that was the only thing he liked - imagine how much disapproval I gained with my obsession with the game. :P
dpJudas
Developer
Developer
Posts: 798
Joined: Sat Jul 23, 2016 7:53

Re: vid_pickrenderer option?

Post by dpJudas »

To be honest, I'm a little too young myself to really have played a lot with BBSes. My older brother did that, and then I played the games. My favorites of that era was Doom 2 and Descent because my dad had a small BNC network at home and playing death match was just amazing. It was really only after 1995 or thereabout that I started coding more than playing games. :)
Locked

Return to “GZDoom”