Git Product home page Git Product logo

Comments (7)

davidAlgis avatar davidAlgis commented on June 3, 2024

The texture that has been created in Unity with DX11 API, will have the type DXGI_FORMAT_R32G32B32A32_TYPELESS in native plugin. Therefore, they can't be used like that to be registered in CUDA with cudaGraphicsD3D11RegisterResource, because it doesn't accept this format.

from interopunitycuda.

davidAlgis avatar davidAlgis commented on June 3, 2024

I use this code to see that :

    ID3D11Texture2D *d3dtex = (ID3D11Texture2D *)_textureHandle;
    assert(d3dtex);
    D3D11_TEXTURE2D_DESC texDesc;
    d3dtex->GetDesc(&texDesc);

    DXGI_FORMAT format = texDesc.Format;
    Log::log().debugLog(std::to_string(format));

from interopunitycuda.

davidAlgis avatar davidAlgis commented on June 3, 2024

This issue was already reported here : see issue tracker

from interopunitycuda.

davidAlgis avatar davidAlgis commented on June 3, 2024

To solve this issue I have to create another texture and copy the content of the texture created in Unity into it. This will cause an overhead...

from interopunitycuda.

deibich avatar deibich commented on June 3, 2024

Hello @davidAlgis,

we also plan to use Unity with Cuda and got some code working. During my research I stumbled over your project which looks very promising.

Because we focus on windows + directx I started to implement d3d11.
https://github.com/deibich/InteropUnityCUDA/commits/d3d11

As you can see I used Texture2D and Texture2DArray instead of RenderTexture to get rid of the problem with format ..._TYPLESS.

To solve this issue I have to create another texture and copy the content of the texture created in Unity into it. This will cause an overhead...

Does the "action_sample_texture_array" work with this workaround?

from interopunitycuda.

davidAlgis avatar davidAlgis commented on June 3, 2024

Hi @deibich,
Nice to see that my work is being useful to someone.
Thanks for the tips to change RenderTexture to Texture2D, after I saw the issue tracker, I had completely given up to make it work without a copy.
This morning I push a first version that work for texture 2D with this copy, but as I except it cause a big overhead. Thanks to you, I push another version that work for texture 2D without a copy and the performances are better ! Now I will tackle the problem of the texture 2D array.

To solve this issue I have to create another texture and copy the content of the texture created in Unity into it. This will cause an overhead...

Does the "action_sample_texture_array" work with this workaround?

On OpenGL, I could registered directly the texture array into a cuda surface object, that was then written with surf3DWrite. Therefore, no copy was needed. I hope to find a similar solution for dx11. Do not hesitate if you have any questions.

from interopunitycuda.

davidAlgis avatar davidAlgis commented on June 3, 2024

One drawback of using Texture2D instead of RenderTexture is that a Texture2D cannot be written in a compute shader. You get the following error if you try :

Attempting to bind texture as UAV but the texture wasn't created with the UAV usage flag set!

I think I will let the 2 options (with and without copy), just in case.

from interopunitycuda.

Related Issues (11)

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.