I am trying to do some image processing on the camera feed using the compute shader on Android devices. However I am reading all black from the samplerExternalOES on the Samsung S8.I bind the texture like so:
GLES31.glActiveTexture(GLES31.GL_TEXTURE0);GLES31.glBindTexture(GLES11Ext.GL_TEXTURE_EXTERNAL_OES, mTextures[0]);GLES31.glUniform1i(mCameraUniform[TEXTURE], 0);My compute shader:
"#version 310 es\n" +"#extension GL_OES_EGL_image_external_essl3 : enable\n" +"uniform samplerExternalOES sTexture;\n" +"uniform float width; \n" +"uniform float height; \n" +"layout (local_size_x = 4, local_size_y = 4, local_size_z = 1) in;\n" +"void main()\n" +"{\n" + " ivec2 storePos = ivec2(gl_GlobalInvocationID.xy);\n" + " vec4 cameraColor = texture(sTexture, vec2(float(gl_GlobalInvocationID.x)/width,float(gl_GlobalInvocationID.y)/height)).rgba;\n"
The code compiles and runs without throwing any errors, the shaders are computing. However the camera texture is returning all black (0, 0, 0, 1).The code is working as intended on Adreno GPUs.
Is samplerExternalEOS not supported in compute shaders or am I doing it wrong?