Jump to content

  • Log In with Google      Sign In   
  • Create Account


glTextureBarrier not working according to specs


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
No replies to this topic

#1 RPTD   Members   -  Reputation: 316

Like
0Likes
Like

Posted 16 April 2013 - 02:32 PM

I read recently about glTextureBarrier or rather the extension about it: NV_texture_barrier. The idea behind it is simple. It allows to render to the same texture you read from (bound to a texture unit and used as FBO attachment) under the condition that you render and read from/to different locations in the same texture. Once you want to read again from a written area you need to call glTextureBarrier . So far the specs but the reality doesn't work like this.

 

Let's say I have a texture 1024x1024. I use now a 512x512 texture on the left side (A) and a 256x256 on the right side (B). Plenty of room between them to not get into troubles. I do now the following:

 

Step 1: Render from some other source texture to A

Step 2: Bind A to texture unit 1 and leave it as attachment.

Step 3: glTextureBarrier (as we want to read from A)

Step 4: Render from A to B (down-sampling)

Step 5: glTextureBarrier (so B can be read again)

Step 6: Render from B to A (down-sampling to 128x128)

rince and repeat a couple of times.

 

The problem is the following. Step 1-4 work correctly. Step 6 though fails. The image written is all black not reading the pixels written by step 4. The problem happens on ATI as well as on nVidia so no vendor specific problem or computer specific problem. It looks like glTextureBarrier in step 3 works but not in step 5.

 

But what is wrong? Why does glTextureBarrier not work as advertized in step 5 but not in step 3 it does? Did I miss something special I have to do to get glTextureBarrier working? Or is glTextureBarrier totally not working as advertized but the binding in step 2 made it look like it works?

 

Has anybody experience with glTextureBarrier and got it working? It would save me GPU memory if I could get ping-pong working with a single texture this way.


Life's like a Hydra... cut off one problem just to have two more popping out.
Leader and Coder: Project Epsylon | Drag[en]gine Game Engine

Sponsor:



Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS