Search Unity

CommandBuffer equivalent to GL.InvalidateState?

Discussion in 'General Graphics' started by cphinton, Feb 21, 2019.

  1. cphinton

    cphinton

    Joined:
    Jul 5, 2018
    Posts:
    18
    Hello,

    We have started drawing static geometry ourselves in a native plugin for better CPU performance. I had assumed that CommandBuffer.IssuePluginEventAndData was supposed to restore render state after the call to the plugin completed. It doesn't, or at least not perfectly on my version of Unity. I issued a bug report, but I just came across GL.InvalidateState. That is exactly what I want, perhaps my assumption was incorrect.

    Is there an API equivalent to GL.InvalidateState when using CommandBuffers? Alternatively, is there a way to use GL at a particular CameraEvent?

    I am currently using a hack-fix in which I render an invisible mesh with enough weird state to make Unity think it needs to change everything. It makes me paranoid.

    Thanks in advance
     
    Fattie likes this.
  2. Fattie

    Fattie

    Joined:
    Jul 5, 2012
    Posts:
    476
    What a good question!