Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

113 Neutral

About Mid

  • Rank
  1. Thanks Jason; I considered deferred contexts, but in my understanding it would only work if my post-processing would apply exactly once per rendered frame. That is, still synchronously, even though on a different thread. But I need to apply the effects at a (potentially) different (higher) rate than the game can render, sometimes applying the effect twice (or perhaps more) for the same rendered frame. This makes it visually smoother regardless of relatively low game fps.   In the end, I made it work as 'Yourself' suggested: I made my own ID3D11Texture2D within the game's context with exactly the same parameters as the game rendering target but patched with the 'shared' flag. At the end of the game frame, I CopyResource() to that texture (with appropriate thread interlocks). On another thread, I create a separate device and immediate context, OpenSharedResource() my texture, and apply my processing at whatever rate and instant I want. It didn't even have any noticeable performance effect (on a latest GTX card though).
  2. Ah thanks 'Yourself', this idea sounds plausible. I'll give it a try. I read about OpenSharedResource before, but was stuck with that the original texture was not created shared...   (I tried just CopyResource, but of course it didn't work: it crashes if I 'push' texture to another context, and apparently does nothing if I 'pull' it).
  3. I need to try, but I presume it still happens within the same context, so operations on the copy may still lead to a crash...
  4. It's rather the latter. The game just renders to a texture (I can configure it to do that), and I'll be doing my stuff and calling Present when it suits me. The problem is that it does have to happen asynchronously, while the game may be reusing the ID3D11ShaderResourceView/ID3D11Texture2D it gave me.
  5. Hello, I'm rather new to D3D programming, but I'm thrown at a fairly advanced problem.     I'm writing a plugin for a game that, at the end of each frame, presents me an ID3D11ShaderResourceView with the rendered view on a texture. I can request an ID3D11Texture2D from it; I also have access to the device and the context. However, I don't control creation of these resources, nor do I control the game rendering itself.     What I need to do is to access this texture from another thread asynchronously to do my post-processing on it and present it to the window. This should happen while the game renders the next frame.   Given that it's not possible to do such things in the same context (according to the docs and my trials), I probably need to create a separate device and context. That's OK; the real question is then: how to clone the ID3D11ShaderResourceView (or the texture) into the new context? Is it possible? Or are there simpler ways to achieve multithreading of this sort?   (When the frame is rendered, I get a callback from the main game thread, where I can do the cloning with all the appropriate interlocks. I just can't find how to do it...)
  • Advertisement

Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!