• Hey, guest user. Hope you're enjoying NeoGAF! Have you considered registering for an account? Come join us and add your take to the daily discourse.

GeDoSaTo - Downsampling from Infinity and Beyond!

One3rd

Member
Fixed the issue for me as well. Good catch!

Well, at least for Far Cry 2 and Borderlands. Syndicate still goes unresponsive immediately.

Strange, I was able to get it working with Syndicate.
I did notice when first starting the game there is a very long time with a black screen before the first startup video starts to play though. Like about 30s of nothing but a black screen. I had sweetfx as well the dev menu injector running though and thought it may have been due to all the extra stuff I was doing to the game but it does look like GeDoSaTo after I just tried disabling everything else. Try waiting a bit longer and see if that is what it is for you as well.

Just in case the settings I was using are here if you want to compare.

Oh, I also have noticed that when using the downsampled resolution that sometimes the full resolution screenshot doesn't work, I get the message that it has been sved but nothing actually gets written to the folder. Doing this at 1920x1080 does work though. Frustrating as I'd really like those full resolution images.
 

Alo81

Low Poly Gynecologist
These may end up being useful for the time being.

disable_borderless_windowed_by_aloo81-d7l7oy1.jpg

mouse_settings_gedosato_by_aloo81-d7l7oy4.jpg
 

MadSexual

Member
I can't believe it took me so long to try this out. It works great. Last night I ran Dishonored at 4k max settings consistently over 30fps on my measly 7870. Thank you UE3!

I'm not downsampling any games above DX9 on my machine anyway, so this tool is a godsend. No more registry edits for me!
 

[Asmodean]

Member
Durante, would you consider adding annotations for texture objects in the post fx shaders? For loading external textures. Eg: < string name = "blaa.bmp"; >;. That way I could use hardware lut color correction, and people could use custom color palettes for games then, if they wanted. Instead of my currently used curves. I already have the shader code done, in my eFX suites.

If you're not interested in doing it, I can wait for the source release, no worries.
 

Durante

Member
[Asmodean];115127437 said:
Durante, would you consider adding annotations for texture objects in the post fx shaders? For loading external textures. Eg: < string name = "blaa.bmp"; >;. That way I could use hardware lut color correction, and people could use custom color palettes for games then, if they wanted. Instead of my currently used curves. I already have the shader code done, in my eFX suites.

If you're not interested in doing it, I can wait for the source release, no worries.
I am interested, it's just a matter of time. Anyway, source release today probably, and contributions will be more than welcome.

Does this dump specular maps? Can't seem to find any in Dark Souls 2.
It dumps everything the game loads using the D3DX APIs
 

Super Muffin

Neo Member
Strange, I was able to get it working with Syndicate.
I did notice when first starting the game there is a very long time with a black screen before the first startup video starts to play though. Like about 30s of nothing but a black screen.

Yeah if I wait long enough the title screen pops up, but when I press start the game crashes.

Everything else I've tried works okay with GeDoSaTo, so I'm happy.
 
Hi Durante I got your code compiling and running but I have no idea where to start in order to fix this in GTA IV :

gtaiv2014-06-0813-32-v8sje.jpg


Do you think it's easy to fix ? What portion of code do you think is involved ? Should this be fixed within the generic plugin or should it be dedicated to a new specific plugin ?
EDIT : lol and it's obviously incredibly hard to debug anything in Visual Studio if the game is launched *fullscreen*. I guess you need to have a dual monitor setup for that. 1 monitor for the game, 1 monitor to see what's going on in VS
 

Durante

Member
Hi Durante I got your code compiling and running but I have no idea where to start in order to fix this in GTA IV :

gtaiv2014-06-0813-32-v8sje.jpg


Do you think it's easy to fix ? What portion of code do you think is involved ? Should this be fixed within the generic plugin or should it be dedicated to a new specific plugin ?
EDIT : lol and it's obviously incredibly hard to debug anything in Visual Studio if the game is launched *fullscreen*. I guess you need to have a dual monitor setup for that. 1 monitor for the game, 1 monitor to see what's going on in VS
First of all, great that you got it to compile.

As for your problem, the first thing to do is to figure out where it messes up. The way I'd go about it is to enable the "dumpFrame" key in the settings, use that to generate a framedump and follow what's happening to the buffers through the rendering of the frame. (The framedump creates a .tga of the framebuffer contents of each buffer before and after each switch).

Then, if it's a general issue it should be fixed generally, and if it's a game-specific issue it should be done in a plugin.
 
I figured out why it didn't work : GTA IV doesn't use Present() at all, but EndScene() instead (yeah DX9 was awesome don't ask me why), I should have known earlier, I vaguely remembered about that :/

So I created a new RSManager::redirectEndScene() function that is 99% like redirectPresent() : it calls prePresent(false) before calling the 'real' Endscene
... And it works ingame, I got the OSD showing me the downscale levels and everything... but it's a black screen :/... I checked/dumped the content of realBackBuffer and it has the upscaled image in it BUT backBuffers[0] (in RSManager::prePresent()) is desperately black like it hadn't been initialized earlier, weird...

Then, if it's a general issue it should be fixed generally, and if it's a game-specific issue it should be done in a plugin.
Well here it is more than a game specific issue : there are a few games that use EndScene() so it's worth a shot implementing it overall I guess ?

EDIT : I have memories of Dragon Age Origin being the most awful at this : the menus use Present() and the game itself EndScene() or the other way round, I don't recall exactly... I had to do some stupid hack to handle this particular game... but it's a rare example I guess

EDIT : I just did a quick hack to "feed" the backBuffers[0] with something, then compare the output before and after the scaling :

Code:
		[I]d3ddev->StretchRect(realBackBuffer, NULL, backBuffers[0], NULL, D3DTEXF_NONE);[/I] <- quick hack
		dumpSurface("backBuffers_pre", backBuffers[0]); <- backBuffers_pre.tga is upscaled (2720x1700) but off-centered

		scaler->go(backBufferTextures[0], realBackBuffer);
		dumpSurface("backBuffers_post", realBackBuffer); <- backBuffers_post.tga is downscaled (1680x1050) but still off-centered
So the scaling part does work in itself, but the off-centered image issue still remains :

presse-papiers-2nkfqv.jpg


There's probably some other code involved I'm not aware of...
 

Durante

Member
I figured out why it didn't work : GTA IV doesn't use Present() at all, but EndScene() instead (yeah DX9 was awesome don't ask me why), I should have known earlier, I vaguely remembered about that :/

So I created a new RSManager::redirectEndScene() function that is 99% like redirectPresent() : it calls prePresent(false) before calling the 'real' Endscene
... And it works ingame, I got the OSD showing me the downscale levels and everything... but it's a black screen :/... I checked/dumped the content of realBackBuffer and it has the upscaled image in it BUT backBuffers[0] (in RSManager::prePresent()) is desperately black like it hadn't been initialized earlier, weird...


Well here it is more than a game specific issue : there are a few games that use EndScene() so it's worth a shot implementing it overall I guess ?

EDIT : I have memories of Dragon Age Origin being the most awful at this : the menus use Present() and the game itself EndScene() or the other way round, I don't recall exactly... I had to do some stupid hack to handle this particular game... but it's a rare example I guess

EDIT : I just did a quick hack to "feed" the backBuffers[0] with something, then compare the output before and after the scaling :

Code:
		[I]d3ddev->StretchRect(realBackBuffer, NULL, backBuffers[0], NULL, D3DTEXF_NONE);[/I] <- quick hack
		dumpSurface("backBuffers_pre", backBuffers[0]); <- backBuffers_pre.tga is upscaled (2720x1700) but off-centered

		scaler->go(backBufferTextures[0], realBackBuffer);
		dumpSurface("backBuffers_post", realBackBuffer); <- backBuffers_post.tga is downscaled (1680x1050) but still off-centered
So the scaling part does work in itself, but the off-centered image issue still remains, there's probably some other code involved I'm not aware of
Interesting stuff!

Is calling EndScene without calling present legal at all? I mean you never show what you're drawing?

It seriously doesn't use any Present calls?

WTF.
 

Durante

Member
Where are the dumped frames saved?
In the game executable directory.
(I should probably move those and create a timestamped folder for them -- it's what I generally do manually)

Note that framedumping increases to log level to the maximum for the duration of the frame. So you can play with 0 or a very low level and just get the relavant information for that one frame in the log.
 
Is calling EndScene without calling present legal at all? I mean you never show what you're drawing?
lol "legal", apparently yeah DX9 was too permissive. I found again the portion of code I had written to handle the weird situation :

Code:
HRESULT ID3D9dev::EndScene(void) {

	UseEndScene = true;
	if ((UseEndScene && !UsePresent && !UseSwpChPresent) || IsDragAgeHack) {
		IDirect3DSurface9 *renderTarget = NULL;
		device->GetBackBuffer(0, 0, D3DBACKBUFFER_TYPE_MONO, &renderTarget);
		EnableAAInject(renderTarget);
		//SDLOG("EndScene !");
		SAFERELEASE(renderTarget);
	}

	return (device->EndScene());
}

HRESULT ID3D9dev::Present(CONST RECT* pSourceRect, CONST RECT* pDestRect, HWND hDestWindowOverride, CONST RGNDATA* pDirtyRegion) {

	UsePresent = true;
	if ((UsePresent && !UseEndScene) || (UseEndScene && UsePresent)) { 																	
[B]		// When both EndScene() and Present() are used by the game, 
		// we still favour applying AA in Present() (otherwise its very slow in EndScene() [/B]-> ie. RE5, nullDC...)
		IDirect3DSurface9 *renderTarget = NULL;
		device->GetBackBuffer(0, 0, D3DBACKBUFFER_TYPE_MONO, &renderTarget); 
		EnableAAInject(renderTarget);
		//SDLOG("Present !");
		SAFERELEASE(renderTarget);
	}

	return (device->Present(pSourceRect, pDestRect, hDestWindowOverride, pDirtyRegion));
}
Notice the classy flags to detect whether the game uses one or the other function :D
But it worked fine and yeah like I said some games use both EndScene and Present
Other games like FFIX AR and EVE Online (iirc) use the swapchain::present function (hence the UseSwpChPresent flag)
 

Durante

Member
Hmm, are you sure that Dragon Age isn't using the swapchain present interface as well? I still feel like every game needs to present in some way.

Anyway, I believe the correct thing to do here is to intercept the whole IDirect3DSwapChain9 interface.
 
Well I'm afraid I'm not going to be able to make it, this game is a huge mess anyway. (No I'm not in a bad mood :D) It seems I was able to get rid of the lighting issue by commenting out the following portion of code (the 2nd call to initResources() in redirectCreateDevice) :

Code:
	//if(SUCCEEDED(ret)) {
	//	new hkIDirect3DDevice9(ppReturnedDeviceInterface, pPresentationParameters, d3d9);
	//	get().initResources(false, pPresentationParameters->BackBufferWidth, pPresentationParameters->BackBufferHeight, 0, D3DFMT_UNKNOWN, pPresentationParameters->SwapEffect);
	//	if(fs) WindowManager::get().setFakeFullscreen(pPresentationParameters->BackBufferWidth, pPresentationParameters->BackBufferHeight);
	//} else SDLOG(0, "FAILED creating non-downsampling device -- error: %s\n description: %s\n", DXGetErrorString(ret), DXGetErrorDescription(ret));
But it has the side effect of making the screen flickering (vsync/refresh parameter thus not properly set ?). So the lighting issue is probably caused by something that is initialized twice in the initResources() even though everything already initialized is supposed to be released in there... And yes like I said, the game never calls Present() so you need to implement the scaling even in EndScene()

Anyway, I believe the correct thing to do here is to intercept the whole IDirect3DSwapChain9 interface.
Yup, and once implemented you can test the whole thing against FFIX AR demo. That's what I used to do
 

Durante

Member
I just pushed a commit to github which adds swapchain interception (and a few more bug fixes/improvements). DA:O now works (without a need for any specific hacks) for AA and postprocessing, but I still need to fix the downsampling issue.
 
But I thought... well ok lol, you're right : even GTA IV uses Swapchain::present :/
And now the off-centered issue is gone for good, the upscaling works fine so far, only needs to fix the weird lighting issue. Great job Durante !

EDIT : commenting out this line fixes the lighting bug :
*ppZStencilSurface = depthStencilSurf;
 

Alo81

Low Poly Gynecologist
When you pushed out the source code I thought about taking a look through it, but seeing you guys talk about this together has convinced me that I'm NOWHERE near that experience level yet. But, it's still super interesting to read and see you guys solve these problems and talk about it, and it feels like I'm at least getting a basic level understanding of how this stuff ends up working which is really cool.

So basically hey, cool to see the actual progress being made, rather than just seeing the end result!
 
I pushed something that *should* fix it, but I don't have the game to test.
It does. Now GTA IV is 100% working I guess. I've been playing at 6720x4200, really nice. Game looks like shit without ENB though, but oh well I couldn't make them work together. SweetFX does work in conjunction with Gedo though.

EDIT : omg I'm sorry I feel dumb : I had forgotten to uncomment the line I was talking about earlier and so while your last push is still valid it isn't sufficient. Adding this additional check to redirectGetDepthStencilSurface will really fix the issue (hope it doesn't hurt the performance too much) :
Code:
	if(downsampling) {
[B]		D3DSURFACE_DESC ppZStencilSurfaceDesc;
		(*ppZStencilSurface)->GetDesc(&ppZStencilSurfaceDesc);
		D3DSURFACE_DESC depthStencilSurfDesc;
		depthStencilSurf->GetDesc(&depthStencilSurfDesc);

		if (ppZStencilSurfaceDesc.Format == depthStencilSurfDesc.Format)[/B]
			*ppZStencilSurface = depthStencilSurf;
	}
Ok last post here, the forum is already getting crazy slow due to E3 :)
 

Durante

Member
It does. Now GTA IV is 100% working I guess. I've been playing at 6720x4200, really nice. Game looks like shit without ENB though, but oh well I couldn't make them work together. SweetFX does work in conjunction with Gedo though.

EDIT : omg I'm sorry I feel dumb : I had forgotten to uncomment the line I was talking about earlier and so while your last push is still valid it isn't sufficient. Adding this additional check to redirectGetDepthStencilSurface will really fix the issue (hope it doesn't hurt the performance too much) :
Code:
	if(downsampling) {
[B]		D3DSURFACE_DESC ppZStencilSurfaceDesc;
		(*ppZStencilSurface)->GetDesc(&ppZStencilSurfaceDesc);
		D3DSURFACE_DESC depthStencilSurfDesc;
		depthStencilSurf->GetDesc(&depthStencilSurfDesc);

		if (ppZStencilSurfaceDesc.Format == depthStencilSurfDesc.Format)[/B]
			*ppZStencilSurface = depthStencilSurf;
	}
Ok last post here, the forum is already getting crazy slow due to E3 :)
Ah, now I see what's (probably) going on. The game must det its own depth stencil surface. I was misinterpreting the semantics of GetDepthStencilSurface.
 

Alo81

Low Poly Gynecologist
Hey Durante, next release you probably wanna add "chrome" to the default blacklist. if it isnt blacklisted then whenever you disable gedosato all flash players crash in chrome.
 

Durante

Member
Boulotaur, if you have time please check if the current master handles GTA4 correctly out of the box. I reimplemented the Z/stencil handling, it should make a lot more sense now.
 

Rigbaby

Neo Member
Is there any way to Super Street Fighter IV working with Gedosato?
I LOVE the tool and would really like to see how it stacked up against standard GPU downsampling.

@Durante
Thanks so much all your efforts thus far, this tool has really help me put some new miles on the steam collection ;)

@Boulotaur2024
Thanks for that! You're correct about the CTD at startup, so I appreciate you looking into it.
 
Boulotaur, if you have time please check if the current master handles GTA4 correctly out of the box. I reimplemented the Z/stencil handling, it should make a lot more sense now.
I will, not today but I will.

I'll take a look at SF4 as well since I have the game installed on Steam. I read it was a 'crash on startup' so I'm unsure I can solve it since I'm really unfamiliar with the hooking process but I can report to Durante at least
 

Durante

Member
FUCK YEAH.

I just fixed the crash when alt-tabbing during downsampling.
After another session of 3 hours of heavy debugging, subsequent to at least 2 such previous sessions over the weeks which were unsuccessful.

When I alt-tabbed back into the game and it worked I clapped my hands so hard that now they hurt.

If anyone is interested in background details, read here.
 

Ran Echelon

Neo Member
This works very nicely with Halo:

vCvRXzf.jpg


I have a problem with Consortium though; the image is zoomed in, like it isn't being reduced to fit the screen.
 

Durante

Member
Beta 7 released!
Alt-tabbing for everyone!

http://blog.metaclassofnil.com/?p=544

Tons of other features as well!

Code:
13-06-2014 -- beta 2 - "Seishoujo Sacrifice"
============================================
General:
- Fixed Alt-tab crash when downsampling in fullscreen mode (!)
- Added IDirect3DSwapChain9 interception 
  (fixes compatibility with some games, e.g. Dragon Age Origins)
- Screenshot fallback to full-size if hudless not available
- Fixed Z/stencil buffer format detection (fixes e.g. GTA4)
- Improved handling of automatically generated z/stencil buffers
  (don't duplicate, we don't need an original-res depth buffer when downsampling)
- Potentially fixed compatibility with Windows Vista
Generic Plugin:
- Store screenshots after AA/postprocessing, not before
- Only use float BB if required (should improve AA/post performance on most games)
- Added ability to specify a "marker" pixel shader in the configuration, 
  in order to apply AA/postprocessing before HUD rendering and capture hudless screenshots
GeDoSaToTool:
- Added ability to edit game profiles using the built-in editor 
  (still need to be created externally)
 

Alo81

Low Poly Gynecologist
Beta 7 released!
Alt-tabbing for everyone!

http://blog.metaclassofnil.com/?p=544

Tons of other features as well!

Code:
13-06-2014 -- beta 2 - "Seishoujo Sacrifice"
============================================
General:
- Fixed Alt-tab crash when downsampling in fullscreen mode (!)
- Added IDirect3DSwapChain9 interception 
  (fixes compatibility with some games, e.g. Dragon Age Origins)
- Screenshot fallback to full-size if hudless not available
- Fixed Z/stencil buffer format detection (fixes e.g. GTA4)
- Improved handling of automatically generated z/stencil buffers
  (don't duplicate, we don't need an original-res depth buffer when downsampling)
- Potentially fixed compatibility with Windows Vista
Generic Plugin:
- Store screenshots after AA/postprocessing, not before
- Only use float BB if required (should improve AA/post performance on most games)
- Added ability to specify a "marker" pixel shader in the configuration, 
  in order to apply AA/postprocessing before HUD rendering and capture hudless screenshots
GeDoSaToTool:
- Added ability to edit game profiles using the built-in editor 
  (still need to be created externally)

Hey Durante, Chromes still doing the "This file looks malicious" warning, and I think it might be because of the file host. I tried uploading the file to Mega.co.nz and it seems to download fine without malicious warning. Might be worth looking in to?
 

Alo81

Low Poly Gynecologist
Also, it seems like it's no longer working with Dark Souls II at all.

AA and Post Processing are doing nothing. You can see SSAO is enabled but theres nothing visible either.


It didn't work with my past configs so I downloaded the fresh version and just used it directly and the results are the same as above.
 

Yabbadabado

Neo Member
Hey guys, im trying to get DayZ (standalone) to work with gedosato so I can borderless window it. I have that enabled in settings for gedosato and added DayZ to the white list but it still is in fullscreen and not borderless. Any suggestions?
 

Durante

Member
Also, it seems like it's no longer working with Dark Souls II at all.

AA and Post Processing are doing nothing. You can see SSAO is enabled but theres nothing visible either.



It didn't work with my past configs so I downloaded the fresh version and just used it directly and the results are the same as above.
Anyone else having this issue? I always explicitly test with DS2 and everything worked for me.
 
Dark Souls 2 works fine on my end.

--

I'm trying to get it to work with Killer is Dead but I'm having trouble. If I have borderless set to true this pops up and the game doesn't launch:

kidgameerror_by_realghostvids-d7maxz5.jpg


Disabling borderless allows it to launch but then none of the effects or resolutions show up in-game. What's really weird is that during the intro movies I can't see the GeDoSaTo OSD but it flashes on for a split second between each movie like so:

http://a.pomf.se/oxfcuj.webm

I had a similar thing happen in Brutal Legend.
 

Durante

Member
That's very interesting. Maybe the game is finding some way to render to the actual backbuffer (which it shouldn't). I don't have KiD, but I can try testing Brutal Legend.
 

Echoplx

Member
I noticed you added The Witcher 2 to the whitelist but it's still broken, when downsampling it doesn't scale properly, it just displays the top left corner of the higher resolution image.

Even when not downsampling the game just crashes to desktop right after trying to load anything (like the arena).
 
Top Bottom