heyx3 / Bplus.jl

A modern OpenGL 4.6 rendering framework, written in Julia.
Other
69 stars 3 forks source link

Support the use of texture memory barriers #52

Closed heyx3 closed 9 months ago

heyx3 commented 1 year ago

This topic is conceptually complex, but the implementation is extremely trivial. Make sure to write a good doc-string.

Starting in OpenGL 4.5, you can read pixels from the same texture that is currently being used as a framebuffer attachment, as long as the region you are reading from and the region you are writing to are different (accomplished with the use of viewport and scissor rectangles).

However, if you want to read from a previously-written section of a framebuffer, without unbnding the framebuffer, then you have to manually issue a memory barrier with glTextureBarrier().

Refer to this section for more info: https://www.khronos.org/opengl/wiki/Memory_Model#Texture_barrier

glTextureBarrier() will not need to be integrated with B+ in any special way apart from simply offering the function. It doesn't even have parameters.

heyx3 commented 9 months ago

A number of sync operations, including glTextureBarrier(), have been defined in sync.jl and thoroughly documented.