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

Question 'image2D' : except for image variables qualified with the format qualifiers <r32f>, <r32i> or <r32ui

Discussion in 'Shaders' started by cyberjoys, Feb 24, 2023.

  1. cyberjoys

    cyberjoys

    Joined:
    Dec 1, 2020
    Posts:
    64
    hi guys
    i m doing a compute shader with RWTexture2D<float4>, which is set with randomReadWrite enabled RT (ARGB32).
    Code (CSharp):
    1. new RenderTexture(_w, _h, depth: 0, RenderTextureFormat.ARGB32, 0)
    2.         {
    3.             enableRandomWrite = true,
    4.             filterMode = _filterMode,
    5.             wrapMode = _wrapMode,
    6.         };

    in editor is fine as expected.
    but when use it on gles 3.2 capable device(APK was built using GLES3), the compute shader failed to compile.

    on RedMi 9A, shader compile failed with the following:
    (RedMi 9A ShaderModel 50 GLES 3.2 support)
    ERROR: 0:26: 'image2D' : except for image variables qualified with the format qualifiers <r32f>, <r32i> or <r32ui>, image variables must specify at least one of the memory qualifiers <readonly>

    does that mean only single channel format : R32f, R32i or R32ui are allowed on GLES platform for RW texture?

    logcat :
    Code (CSharp):
    1. 02-24 16:41:05.053 15364 15430 D Unity   : -------- failed compiling:
    2. 02-24 16:41:05.053 15364 15430 D Unity   : compute evaluation shader
    3. 02-24 16:41:05.053 15364 15430 D Unity   : Compile failed.
    4. 02-24 16:41:05.053 15364 15430 D Unity   : ERROR: 0:26: 'image2D' : except for image variables qualified with the format qualifiers <r32f>, <r32i> or <r32ui>, image variables must specify at least one of the memory qualifiers <readonly> or <writeonly>
    5. 02-24 16:41:05.053 15364 15430 D Unity   : 1 compilation errors. No code generated.

    but on Honor 8X, shader also compile failed, but with different msg:
    (Honor 8X ShaderModel 50 GLES 3.2 support)
    0:26: S0001: Image has to be qualified as 'readonly', 'writeonly' or both.

    logcat :
    Code (CSharp):
    1. 02-24 18:02:23.907 11784 11865 D Unity   : -------- failed compiling:
    2. 02-24 18:02:23.907 11784 11865 D Unity   : compute evaluation shader
    3. 02-24 18:02:23.907 11784 11865 D Unity   : 0:26: S0001: Image has to be qualified as 'readonly', 'writeonly' or both.
    question :
    so what is the problem when on gles platform, single channel format ? or MemoryQualifier ?
    do i need single channel RT for RWTexture to work in Compute Shader On GLES platform ?
    how do i set memory qualifier from unity ?

    by the way, i also built the apk with only vulkan API, the shader compile OK using the above devices.
     
    Last edited: Feb 24, 2023
  2. aleksandrk

    aleksandrk

    Unity Technologies

    Joined:
    Jul 3, 2017
    Posts:
    2,844
    Hi!
    What version of Unity do you use?
     
  3. cyberjoys

    cyberjoys

    Joined:
    Dec 1, 2020
    Posts:
    64
    Unity 2021.3.6f1c1
     
  4. aleksandrk

    aleksandrk

    Unity Technologies

    Joined:
    Jul 3, 2017
    Posts:
    2,844
    Please try updating to the latest 21.3 and see if the error persists. If it does, please submit a bug report.
    Thank you!