Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Calling GLX Extension from Unity

Discussion in 'General Graphics' started by pixelord, Mar 23, 2020.

  1. pixelord

    pixelord

    Joined:
    Mar 23, 2020
    Posts:
    4
    Hi,

    I am trying to do some low level rendering stuff where I need to copy a rendertexture from Unity process to another running process avoinf CPU copy. OpenGL has an extension call GLX_NV_COPY_IMAGE that is suggested to allow texture copt from one context to another context within GPU.

    Howevrer, I have no idea if it is possible to do using Unity in unity sahder or any other way?
    Can anyone suggest if it is possible to write a custom shader in Unity that would allow us to copy the texture using the low level API extension?

    Thanks,
    M
     
  2. aleksandrk

    aleksandrk

    Unity Technologies

    Joined:
    Jul 3, 2017
    Posts:
    2,864
    Hi!
    You need to write a C++ plugin to do that.
     
    pixelord likes this.
  3. pixelord

    pixelord

    Joined:
    Mar 23, 2020
    Posts:
    4
    Thanks for your reply.
    I am assuming this would be same way we create C++ dll and use it from unity script?
    Or Do I need the Code license?


    How do I get the device context in Unity (In case of directX) or OpenGL context in case of OpenGL/Linux build in Unity to pass it to my plugin dll?

    Thanks,
    M
     
  4. aleksandrk

    aleksandrk

    Unity Technologies

    Joined:
    Jul 3, 2017
    Posts:
    2,864
    Yes, I was referring to that.
    Not sure about DX, but I think for GL you could use the regular GLXGetCurrentDisplay and friends to query the current rendering context.
     
  5. pixelord

    pixelord

    Joined:
    Mar 23, 2020
    Posts:
    4
    Thanks.
    It was a great help.
     
    aleksandrk likes this.