Advertisement

Get pointer of backbuffer?

Started by July 20, 2017 12:16 AM
8 comments, last by DividedByZero 7 years, 6 months ago

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 :)

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.

Advertisement

Ooh! Nice!

That's an awesome idea. Thanks man!

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

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.

-potential energy is easily made kinetic-

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?

Advertisement
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.

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?

-potential energy is easily made kinetic-

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!

This topic is closed to new replies.

Advertisement