metal - efficiency of storing in MTLBuffer -


i want store image float data in unformatted memory location within shader, , mtlbuffer seems answer. firstly, possible? saw within apple docs of mtlbuffer 1 can access pointer pointing buffer. possible use pointer within shader fill allocated memory? secondly, wish idea how fast operation be; fast , efficient operating textures?

i ask need re-engineer lot of code if confirmed mtlbuffer's speed of access comparable operating mtltexture.

first, it's important aware of several restrictions:

  • fragment shaders neither support writing textures nor buffers. you're option rendering textures.
  • vertex shaders support support writes buffers not textures.

so if you're using either of these shader types, don't have choice between texture writes , buffer writes, regardless of performance.
if you're using compute shader , write pattern relatively simple (i.e. 1-to-1 thread id pixel correspondence), i'd expected buffer writes faster. said, there no general advice, best solution try both , profile.


Comments

Popular posts from this blog

c++ - No viable overloaded operator for references a map -

java - Custom OutputStreamAppender not run: LOGBACK: No context given for <MYAPPENDER> -

java - Cannot secure connection using TLS -