Jump to content
  • Advertisement
Sign in to follow this  
lonewolff

DX11 Get pointer of backbuffer?

Recommended Posts

Hi Guys,

I am just wondering if it is possible to acquire the address of the backbuffer if an API (based on DX11) only exposes the 'device' and 'context' pointers?

Any advice would be greatly appreciated :)

Share this post


Link to post
Share on other sites
Advertisement

If the context is set up so that you're rendering to the backbuffer already, you can use OMGetRenderTargets from the immediate context to get the view, and then GetResource on the view to get the back buffer.

Share this post


Link to post
Share on other sites

Quick question, do you want these addresses so you can read and write directly to said buffer from the CPU?  Because if so it would be really slow and might not even be easily doable because they would be in a swizzled format.  If you want to work with those buffers directly you would have to go about it differently, like using a dynamic texture or some such.

Share this post


Link to post
Share on other sites
11 hours ago, lonewolff said:

Do you know if it is possible to retrieve the address of the swap chain also?

I'm not 100% positive, I'd have to try it to check, but I think that if you QueryInterface the resource for IDXGIResource/IDXGIObject and use GetParent, it should return the swapchain instead of the device.

I am curious - what's the reason you need to get at these objects?

Share this post


Link to post
Share on other sites
14 hours ago, SoldierOfLight said:

I'm not 100% positive, I'd have to try it to check, but I think that if you QueryInterface the resource for IDXGIResource/IDXGIObject and use GetParent, it should return the swapchain instead of the device.

I am curious - what's the reason you need to get at these objects?

 

I am looking at overriding a large section of the GameMaker renderer. 

At this stage I can inject models, shaders, textures, etc via DLL. But even in an empty GM project there are over 100 state changes, draw calls, shader changes, etc... just for a simple empty window.

I can disable the draw event, which stops the renderer doing anything and was hoping to take over a lot of the functionality myself.

In pure DX11 I can render a whole scene in around 8 state changes.

So, essentially it is about boosting performance in GM. Could possibly be an OCD optimization thing though, I admit - LOL.

Share this post


Link to post
Share on other sites
8 hours ago, lonewolff said:

But even in an empty GM project there are over 100 state changes, draw calls, shader changes, etc... just for a simple empty window.

Have you tried a small project to see if that number increases?  It might just be its going through the motions even though its an empty project.  Also where'd you learn how to inject?

Share this post


Link to post
Share on other sites
On ‎22‎/‎07‎/‎2017 at 11:29 PM, Infinisearch said:

Have you tried a small project to see if that number increases?  It might just be its going through the motions even though its an empty project.  Also where'd you learn how to inject?

Yeah, it does increase. There are a lot of redundant calls in there.

As for the injection part. All self taught. I submitted a request a few years back asking if they would add a function to return the handle of the D3DDevice. It was one of the few requests that ever got through. Which was great, as it allowed me to create the worlds first video player extension where you could manipulate the video as if it were a regular sprite.

I still get asked to this day how I pulled that one off. Hehe!

Edited by lonewolff

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!