1
\$\begingroup\$

Is there some way I can directly access texture memory from fragment shader in GLES2 GLSL? I don't need the sampler to be involved since I am just using it as a look-up table.

\$\endgroup\$
  • \$\begingroup\$ Err? I don't really understand your question. What you describe (i.e. accessing texture memory) is actually what a sampler is meant to do. What do you think is a sampler doing? \$\endgroup\$ – Mario Nov 9 '14 at 8:44
  • 2
    \$\begingroup\$ @Mario You can access textures without samplers in SM4+ IIRC (e.g. HLSL Load()). I doubt this is possible in ES2 though. \$\endgroup\$ – JarkkoL Nov 9 '14 at 12:43
  • \$\begingroup\$ @JarkkoL Okay, interesting. Didn't do anything with newer versions so far. Is it just different syntax or is there some other (dis-)advantage? \$\endgroup\$ – Mario Nov 9 '14 at 18:49
  • \$\begingroup\$ @Mario: The sampler is nice when you want to have mip-mapping, filtering and all sorts of other directly graphics related enhancements, but these will cost extra performance and may add implementation specific artifacts when you are trying to use the texture as a look-up-table. \$\endgroup\$ – Lennart Rolland Nov 10 '14 at 2:36
0
\$\begingroup\$

texelFetch is used for lockups without performing mip-mappnig, filtering..etc. and even with this you still need to pass a sampler.

Otherwise your out of luck, as far as I am aware, making such operation available restricts driver writers from doing certain optimization, for instance they need to keep textures in a certain layout in memory.

\$\endgroup\$
  • \$\begingroup\$ That requires an extension in gles2 right? \$\endgroup\$ – Lennart Rolland Nov 10 '14 at 8:28
  • \$\begingroup\$ @LennartRolland Yes, unfortunately. \$\endgroup\$ – concept3d Nov 10 '14 at 9:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.