markwalberg
markwalberg

Reputation: 321

texture2D not compatible with Compute Shaders on android mobile phone?

I am trying to use texture2D() to read a value from a sampler2d texture in a compute shader. On PC it is working fine, but on a android mobile device (using version 310 es) the compilation for the same code fails with the folowing error:

'texture2D' : type is for Vulkan api only  

Isn't this call somehow compatible with compute shaders?

Upvotes: 5

Views: 1487

Answers (1)

Sascha Willems
Sascha Willems

Reputation: 5808

It's not 100% clear from your question what tool you use to compile your shaders, or do you compile at runtime?. texture2D has been depcrecated for sampling in OpenGL (ES) shaders.

For Vulkan (as the message says) there is a "texture2D" that is used to read form a texture that's separated from the sampler (for detail see https://www.khronos.org/registry/vulkan/specs/misc/GL_KHR_vulkan_glsl.txt).

For OpenGL ES 2.x (and up) you would use sampler2D (or sampler2DShadow) for sampling from a texture or image2D for read and writes in a compute shader.

Upvotes: 7

Related Questions