Search Unity

Shader error in 'Hidden/Universal/CoreBlit': invalid subscript 'positionCS' at

Discussion in 'Universal Render Pipeline' started by radiantboy, Apr 3, 2022.

  1. radiantboy

    radiantboy

    Joined:
    Nov 21, 2012
    Posts:
    1,633
    im trying to build a urp project for webgl but always see these errors

    Shader error in 'Hidden/Universal/CoreBlit': invalid subscript 'positionCS' at Library/PackageCache/com.unity.render-pipelines.core@12.1.6/Runtime/Utilities/Blit.hlsl(92) (on gles)

    Shader error in 'Hidden/kMotion/CameraMotionVectors': SV_VertexID semantic is not supported on GLES 2.0 at line 11 (on gles)

    Compiling Subshader: 0, Pass: , Vertex program with <no keywords>
    Platform defines: SHADER_API_DESKTOP UNITY_COLORSPACE_GAMMA UNITY_ENABLE_DETAIL_NORMALMAP UNITY_ENABLE_REFLECTION_BUFFERS UNITY_LIGHTMAP_RGBM_ENCODING UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BLENDING UNITY_SPECCUBE_BOX_PROJECTION UNITY_USE_DITHER_MASK_FOR_ALPHABLENDED_SHADOWS
    Disabled keywords: SHADER_API_GLES30 UNITY_ASTC_NORMALMAP_ENCODING UNITY_ENABLE_NATIVE_SHADOW_LOOKUPS UNITY_FRAMEBUFFER_FETCH_AVAILABLE UNITY_HALF_PRECISION_FRAGMENT_SHADER_REGISTERS UNITY_HARDWARE_TIER1 UNITY_HARDWARE_TIER2 UNITY_HARDWARE_TIER3 UNITY_LIGHTMAP_DLDR_ENCODING UNITY_LIGHTMAP_FULL_HDR UNITY_LIGHT_PROBE_PROXY_VOLUME UNITY_METAL_SHADOWS_USE_POINT_FILTERING UNITY_NO_DXT5nm UNITY_NO_FULL_STANDARD_SHADER UNITY_NO_SCREENSPACE_SHADOWS UNITY_PBS_USE_BRDF2 UNITY_PBS_USE_BRDF3 UNITY_PRETRANSFORM_TO_DISPLAY_ORIENTATION UNITY_UNIFIED_SHADER_PRECISION_MODEL UNITY_VIRTUAL_TEXTURING

    thoughts?
     
    zyzyx and Tarkiainen like this.
  2. Chezus

    Chezus

    Joined:
    Aug 25, 2020
    Posts:
    1
    Tarkiainen likes this.
  3. Gordyus

    Gordyus

    Joined:
    Mar 3, 2016
    Posts:
    9
    Same issue with unity 2021.2.18 at Android build.
     
    Stormer2020 and Tarkiainen like this.
  4. dhindman

    dhindman

    Joined:
    Jan 28, 2016
    Posts:
    17
    Bump. Seeing this in the new 2021.3.0f1 LTS release building for WebGL. I'm also getting a shader-related warning following the two errors:

    Shader warning in 'Hidden/Universal Render Pipeline/CopyDepth': implicit truncation of vector type at ~/Library/PackageCache/com.unity.render-pipelines.universal@12.1.6/Shaders/Utils/CopyDepthPass.hlsl(104) (on gles)
     
    Last edited: Apr 13, 2022
    akaBase and zyzyx like this.
  5. StaggartCreations

    StaggartCreations

    Joined:
    Feb 18, 2015
    Posts:
    2,266
    This definitely seems like an unintentional oversight. Removing OpenGLES 2.0 from the graphics API list will likely work around this.

    You can do this in the Player Settings, uncheck "Auto Graphics API" then remove it from the list that pops up.
     
    hamboozy, leykin and zyzyx like this.
  6. zyzyx

    zyzyx

    Joined:
    Jul 9, 2012
    Posts:
    227
    Having the same issue (2021.3.0f1 LTS, WebGL, URP)
     
    Stormer2020 likes this.
  7. dhindman

    dhindman

    Joined:
    Jan 28, 2016
    Posts:
    17
    Can confirm this works around the issue. For others that may want to do this, note that OpenGLES 2.0 is listed as WebGL 1 (Deprecated) in 2021.3.0f1.
     
    gpachecus, aoikiwi and CodeFluegel2 like this.
  8. mpeter_nmy

    mpeter_nmy

    Joined:
    Apr 2, 2019
    Posts:
    6
    I can also confirm that removing OpenGLES 2.0 will solve the issue. But for me it was necassary to use the "Clean Build" option to get rid of the build-error.
     
  9. zyzyx

    zyzyx

    Joined:
    Jul 9, 2012
    Posts:
    227
    Can confirm too.
    Note: OpenGLES 2.0/WebGL 1 was already removed in my project but I had to add and remove it again to make this work.
     
    sakibstunishing likes this.
  10. AltkeyMolling

    AltkeyMolling

    Joined:
    Mar 26, 2021
    Posts:
    2
    Bug appears in 2021.3.1f1 URP but only when doing a "Build And Run".
    Slightly problematic as we have to support ogengles2.0 and produce app bundles. Meaning we're forced to upload the builds to test them.
    Embedding the packages and applying the edits from the PR seem to fix the issue.
     
  11. jessmwoodward

    jessmwoodward

    Joined:
    May 13, 2021
    Posts:
    4
    This worked for me, thank you!
     
  12. abhimanyu-singh

    abhimanyu-singh

    Joined:
    May 24, 2016
    Posts:
    11
    @AltkeyMolling could you give some more details regarding what packages need to be embedded and how.
    Also, while I made the changes described in the Github link you shared, they all get reverted back to original buggy code the moment I go back to Unity Editor window. Can you guide me as to how did you resolve it?
     
  13. AltkeyMolling

    AltkeyMolling

    Joined:
    Mar 26, 2021
    Posts:
    2
    1. The packages modified in the PR. So com.unity.render-pipelines.core and com.unity.render-pipelines.universal
    2. Some documentation on how to embed packages
      1. From unity https://docs.unity3d.com/Manual/upm-embed.html
      2. From a nice guy on the forums, not tested https://forum.unity.com/threads/easily-embed-packages-to-your-project-with-this-extension.766733/
    Embedding the packages will prevent them from reverting, as the package manager will revalidate and restore modified scripts in non-embedded packages.
     
    Last edited: May 2, 2022
    umarautarhanov and PrimeStudio like this.
  14. maxximme

    maxximme

    Joined:
    Aug 18, 2021
    Posts:
    12
    Unity 2021.3.0f1 with android here.
    Got it sorted by going in Edit -> Rendering -> Generate shaders includes
     
    glukdev, ltomov, XJonOneX and 4 others like this.
  15. SuperLowPoly

    SuperLowPoly

    Joined:
    Mar 27, 2017
    Posts:
    4
    Hello, I tried the PR link you mentioned, but they led me to Frogbuz something that only allow to access through a company email or something that I cannot download the package. What should I do? can I just update Unity and things will be sorted out? this bug haunted me for months. Thanks
     
  16. kloot

    kloot

    Joined:
    Mar 14, 2018
    Posts:
    78
    I tried every suggested solution here (on Unity 2022.3.3) and the only workaround I found is to Build and then deploy manually... Totally bananas...
     
  17. speedy1000

    speedy1000

    Joined:
    Aug 24, 2018
    Posts:
    7
    I finally solved it. :confused:I was getting loads of these URP 'Hidden/..." shader errors when trying to build and run.

    1. I had to go to my "Project Settings>Player" and then go to the "Graphics APIs" section and remove OpenGLES2 from the list.

    2. Right-click on the 'Universal RP' package in the packages section of your asset browser and (wait DO NOT hit "Re-import all') Just hit Reimport.

    Those two steps solved it for me. All credit goes to this Japanese website where I found this info.
    https://zenn.dev/r_ngtm/articles/urp14-07-shader-bug
     

    Attached Files:

    radiantboy likes this.
  18. umarautarhanov

    umarautarhanov

    Joined:
    Aug 23, 2023
    Posts:
    4
    This worked! Thanks!