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?
Hi,
Our driver team has reviewed this, and unfortunately it looks like a bug our side. It definitely is intended to work in compute shaders, but some of the required driver logic is missing when the extension is used on the compute shader path. Unfortunately it looks like all currently shipping drivers are impacted; I'll update this ticket when a DDK release with the fix is available (although updating any specific device is out of our control).
Thanks for reporting, Pete
Thanks Peter, looking forward to the update!
Hello Peter, Do you have any updates on this? It seems like this issue impacts other cases when external images are used in compute shaders. Thanks.
Hi Denis,
The issue has been fixed in our released drivers for ~8 months, but whether a device gets an update is controlled by the device manufacturer and not under our control.
For Midgard devices (Mali-Txxx) you need driver release r23p0 or higher.
For Bifrost devices (Mali-Gxx) you need driver release r10p0 or higher.
Cheers, Pete