This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

GL_INVALID_OPERATION setting image2D in computeShader

I am using OpenGL ES 3.2 and the NVIDIA driver 361.00 on a Pixel C tablet with Tegra X1 GPU. I would like to use a compute shader to write data to a colour map and then later I will use some graphics shaders to display the image.

I already have this concept working using desktop GL and now I want to port to mobile. I am implementing the GL in Java rather than in native code. I extend GLSurfaceView and the GLSurfaceView.Renderer and then during the OnSurfaceCreated callback I initialise the shader programs and textures etc.

The compute shader compiles just fine without any errors:

And I initialise a texture

After this I set the image unit in the shader here:

After every call to GL I check for errors using GLES31.glGetError() -- left out here for clarity. This final line is the only one which errors. The error code translates to GL_INVALID_OPERATION. As the documentation describes, glUniform1i can return this error under quite a few circumstances. I have checked all these and also believe that none of them apply. The shader compiles correctly and the program object is valid. The location of the variable is also valid. I have even used glGetActiveUniform() to get the type of the variable and it returns a type of 36941 which translates to GL_IMAGE_2D which I believe is an integer.

I don't know what I can be doing wrong. Am I missing an extension or something? Documentation for GLES in Java for Android is dire.

0