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. Dismiss Notice

Error when instantiating compute shader

Discussion in 'Shaders' started by kulesz, Jun 2, 2016.

  1. kulesz

    kulesz

    Joined:
    Jul 1, 2012
    Posts:
    137
    I'm getting an error while instantiating a compute shader with:
    Code (csharp):
    1.  
    2. var shader = Instantiate(ShaderPrefab);
    3.  
    Error:
    Code (csharp):
    1.  
    2. !(transfer.IsRemapPPtrTransfer() && transfer.IsReadingPPtr())
    3. UnityEngine.Object:Instantiate(ComputeShader)
    4.  
    What is interesting, shader seems to work fine and no issues are noted.
    Is it a bug?
     
  2. Exsight

    Exsight

    Joined:
    Apr 10, 2014
    Posts:
    33
    Same error for me when doing :
    Code (CSharp):
    1. ComputeShader convertCS = Instantiate(Resources.Load("ConvertShader")) as ComputeShader;
    Compute shader is working well when manually assigned in editor.
     
  3. kulesz

    kulesz

    Joined:
    Jul 1, 2012
    Posts:
    137
    Strange this is that shader works fine even with this error message. Or at least seems to be working fine...
     
  4. kulesz

    kulesz

    Joined:
    Jul 1, 2012
    Posts:
    137
    It seems that shader created that way sometimes fail to work (can't debug it precisely yet).
     
  5. kulesz

    kulesz

    Joined:
    Jul 1, 2012
    Posts:
    137
    Bump?
    Still got it in 5.4.
     
  6. insomniaunleashed

    insomniaunleashed

    Joined:
    Mar 29, 2016
    Posts:
    10
    interestingly i get the same error when running the demo scene for the Hair Tool, https://www.assetstore.unity3d.com/en/#!/content/66094

    Registered platform support modules in: 0.0547059s.
    Native extension for WindowsStandalone target not found
    Native extension for Android target not found
    Load scene 'Temp/__Backupscenes/0.backup' time: 0.776700 ms
    The referenced script on this Behaviour is missing!
    (Filename: C:/buildslave/unity/build/Runtime/Mono/MonoBehaviour.cpp Line: 1510)

    The referenced script on this Behaviour (Game Object 'Model') is missing!
    (Filename: C:/buildslave/unity/build/Runtime/Mono/MonoBehaviour.cpp Line: 1656)

    Failed to create Compute Buffer, HRESULT: 0x80070057
    (Filename: C:/buildslave/unity/build/Runtime/GfxDevice/d3d11/GfxDeviceD3D11.cpp Line: 2918)

    Failed to create Compute Buffer UAV, HRESULT: 0x80070057
    (Filename: C:/buildslave/unity/build/Runtime/GfxDevice/d3d11/GfxDeviceD3D11.cpp Line: 2968)

    Failed to create Compute Buffer SRV, HRESULT: 0x80070057
    (Filename: C:/buildslave/unity/build/Runtime/GfxDevice/d3d11/GfxDeviceD3D11.cpp Line: 2990)

    !(transfer.IsRemapPPtrTransfer() && transfer.IsReadingPPtr())
    UnityEngine.Object:Internal_CloneSingle(Object)
    UnityEngine.Object:Instantiate(ComputeShader) (at C:\buildslave\unity\build\Runtime\Export\UnityEngineObject.cs:189)
    Scripts.HairTool.Physics.HairPhysics:Initialize(HairSettings) (at Assets\Hair\Scripts\HairTool\Physics\HairPhysics.cs:23)
    Scripts.HairTool.Settings.Builders.HairBuilder:BuildHair(HairSettings) (at Assets\Hair\Scripts\HairTool\Settings\Builders\HairBuilder.cs:61)
    Scripts.HairTool.Settings.Builders.HairBuilder:Build(HairSettings) (at Assets\Hair\Scripts\HairTool\Settings\Builders\HairBuilder.cs:36)
    Scripts.HairTool.Settings.HairSettings:Start() (at Assets\Hair\Scripts\HairTool\Settings\HairSettings.cs:27)
     
  7. cecarlsen

    cecarlsen

    Joined:
    Jun 30, 2006
    Posts:
    848
    Same problem in Unity 2017 beta 1.
    Code (CSharp):
    1. Assertion failed: Assertion failed on expression: '!(transfer.IsRemapPPtrTransfer() && transfer.IsReadingPPtr())'
    How to deal with this? The compute shader runs a particle system and I need multiple instances, otherwise I will have to upload all properties every frame.
     
  8. cecarlsen

    cecarlsen

    Joined:
    Jun 30, 2006
    Posts:
    848
    This is still an issue in Unity 2017.1.0f3.
     
  9. kulesz

    kulesz

    Joined:
    Jul 1, 2012
    Posts:
    137
    That's true :(
     
  10. cecarlsen

    cecarlsen

    Joined:
    Jun 30, 2006
    Posts:
    848
    Still an issue in Unity 2017.3.0b10.
     
  11. marwi

    marwi

    Joined:
    Aug 13, 2014
    Posts:
    138
    Same in 2018.1.0b1
     
  12. Cotycrg

    Cotycrg

    Joined:
    Jan 7, 2016
    Posts:
    4
    Same result in 2017.3.0p3
     
    DDeathlonger likes this.
  13. fherbst

    fherbst

    Joined:
    Jun 24, 2012
    Posts:
    801
  14. cecarlsen

    cecarlsen

    Joined:
    Jun 30, 2006
    Posts:
    848
    Same in 2018.1.0b12.

    My project console is spammed with 15 error messages every time I run. All from ComputeShaders. It is becoming a huge annoyance.

    EDIT: The issue linked to above is marked as "Fixed in Unity 2018.2". Thats a long wait =(

    EDIT2: I downloaded the Unity 2018.2 beta and the errors are gone! Yah! =D
     
    Last edited: Apr 25, 2018