🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

DX9 Rendering to backbuffer larger than window resolution

Started by
6 comments, last by JohnnyCode 3 years, 8 months ago

I am working on adding a VR support to an old DX9 game. It is a mod, all done without source code access. I got it all working, but current issue is that resolution too low, and it is basically matching the size of a window.

I am trying DX9 C++ samples and I noticed that specifying backbuffer width/height is tied to the actual window size - passing bigger backbuffer dimensions makes window bigger as well. And the biggest problem it stops growing when it reaches desktop resolution. Yeah, I could work it around with DSR, but it is a bit too much, I'd like to keep window small and avoid being limited by the window size in terms of resolution.

I guess my question is: how could I render to a very large backbuffer, independently of a window size? I would appreciate a general overview of the flow. I imagine I could easily scale down big backbuffer to Present it into the window, and use full size in VR, but I am not sure of the overall flow.

One more thing - when I change CreateDevice params to use larger dimensions for the BB, game simply goes black - any ideas what exaclty might be going on? If I set values below the window size, game renders, but image is stretched. Thanks!

Advertisement

Bigger back buffer than presented buffer, which is down sampled, results in high grade edge-antialiasing effect solution. That is the flow you wanna know about?

try rendering to a large texture :

https://gamedev.net/forums/topic/620712-c-directx9-render-to-texture/4915418/

see how it goes… but yes watch out for down scaling quality issues…

for the black output, check if you're rendering within begin/end pair

UPDATED: also check if you have any DX9 TRACE errors , turn on in Diagnostics and see..

Until then ?

@JohnnyCode yes, I would really appreciate if you could walk me through it, this sounds exactly what I need. Graphics is my hobby, but I am not making living off it, so there are many blind spots in my knowledge or something I did a long time ago and forgot, and right now I am a bit stuck and need an expert advice.

In fact, before going to bed yesterday, I realized what seems to be important thing to me: I don't even care if main game window shows anything. All I need this window for is to use as a boundary for mouse, that's it. For VR, I need huge backbuffer which I copy into DX11 after each render pass. If it can be done nicely to downscale to 800x600 for main window - great. Obviously, because it is a mod I am hoping for the least invasive solution.

@ddlox thanks for raising the debug output question and I will review that link. Is it even possible to enable debug output in DX9 process without #define D3D_DEBUG_INFO, which is something I obviously cannot do for the main game? Well, I tried to define that in my .dll before include of <d3d9.h> and device creation (I am trying to raise size of the back buffer by hooking CreateDevice) and that did not seem to produce any DX9 output in the debugger.

And DX9 CP looks like this, debug output level grayed out. What am I missing? I get debug output from my DX11 device, and it is super helpful.

you must install the debug version of dx9 libraries, that is, if u can still find them…

forgive me if i'm wrong, it's been a while i haven't used dx9, but:

check (or run) your dx9c installer and see if the debug libs are an option to install. If not, maybe a google search ?

Have fun ?

@undefined Ah I see - that'd require Win7 to work ?

I got it to display menu in high res, so getting closer, just the main render output is still in 800x600 for some reason, displays in upper left corner ? I am having fun for sure, trust me :D

EDIT: I made some progress and it looks like stuff is rendered at desired resolution, yet window is small, which is what I want (I would still appreciate overall overview of the flow of downsampling). Atm the only weird thing I am aware of is Pix shows depth stencil as low res in Render window, but dimension in the resource list matches the one I requested. Now have to deal with comical problem where clicks don't work because game isn't aware window size does not match render target size :D

Do power of two growth of original sample, that means if you have 800x600 main buffer, render to 1600x1200 buffer. Then, either, create mipmap for level 2 only from the big buffer, and use it as a texture directly on main buffer quad, or manualy downsample by averaging 4 pixels to one pixel. This will result in no blur of color output, yet a heavy duty elimination of edge aliasing.

This topic is closed to new replies.

Advertisement