Giter Site home page Giter Site logo

Comments (2)

leadedge avatar leadedge commented on September 26, 2024

Yes for 2.006 there are :

bool spoutGLDXinterop::WriteTexture(ID3D11Texture2D** texture)
bool spoutGLDXinterop::ReadTexture(ID3D11Texture2D** texture)

For a sender you have to make sure the sender is created and the texture sizes match. A receiver has to monitor the sender size to make sure the receiving texture is updated.

I have been working on DirectX examples. You could use the beta code, but I am not happy with the SpoutDX class and it's under revision. Hopefully the examples will give you some idea.

The important thing to note is use of the sender mutex before the shared texture is copied. The 2.007 methods include a frame counter, but that can be removed for 2.006 applications.

Problems I have found are. Matching format is important if you want to create a shader resource view of the received texture. If the sending texture has a keyed mutex, it must be accessed or the texture will not be copied. You will have to check for this if the texture is used to interface with a Vulkan image. I will be updating the mutex check to include keyed mutex if the texture has one.

It might seem ideal to access the sender's shared DirectX texture directly, but it is not that simple. The main difficulty is with CopyResource which is asynchronous. The received texture might not be updated immediately, depending on the command queue. This means that a receiver will display a new frame after a random delay. If this happens to occur right on vertical sync, you could see hesitations.

To overcome that I have introduced a flush and wait until CopyResource is finished. This is not a problem if the DirectX device is created simply for the purpose of creating and copying textures, because there is no queue. But it could be a problem if the application device is used and the command queue is backed up. Then you might get a stall. This is extremely difficult to test, so it is a matter of trying it with or without the flush.

So it is achievable with some caution. The Unity and Unreal Engine plugins use DirectX texture copy already and they are having success. I think they shoud use the sender mutex but it seems to be working for them.

from spout2.

jcelerier avatar jcelerier commented on September 26, 2024

Thanks, that's great, will try to integrate it like that !

from spout2.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.