texture2D not compatible with Compute Shaders on android mobile phone?
Asked Answered
F

1

5

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?

Fete answered 10/5, 2016 at 16:50 Comment(0)
H
7

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.

Homology answered 10/5, 2016 at 17:1 Comment(2)
I compile them at runtime.Fete
As mentioned above, then don't use texture2D as it's only available on Vulkan where images are separated from samplers. If you want to read and/or write image data in a compute shader use image2D instead.Homology

© 2022 - 2024 — McMap. All rights reserved.