cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

glowingboy
Journeyman III

glClear's result can't be seen when using bindless texture

In my program, I use a additional frame buffer to render something into a texture(only a glClear), which I will reference it's handle in next draw command. And draw the texture back to the default frame buffer. My program almost run like this:

frame buffer create and attached by a GL_TEXTURE_2D texture and other setup 
glGetTextureHandle
glMakeHandleResident 
bind this frame buffer
glclear(1.0f, 0.0f, 0.0f, 1.0f) 
glBindFramebuffer to 0(back to default frame buffer)
ShaderUse//nothing but return texture's color
glUniformHandleui64(location, textureHandle)//witch is the texture above
//if I use normal bind texture, the result will be correct
glDraw*//just draw a quad

Here I got a strange issue, The 2nd glDraw cmd gives an empty result(Back Buffer is an black image). And I also checked the first frame buffer's render texture witch is a pure red image, and it's a correct result. And my GPU is AMD R7 200. But when I change bindless texture to normal bind texture style, and everything is ok finally.Also I checked in NV GPU-GTX650 with same program, and the result is also ok.

I am sure there is no opengl error occurred in my program, and I also checked GL_ARB_bindless_texture extension is supported by my devices.

So I wonder, am I missing some memory sync or coherent?

I also looked up to the document and I found this:

(4) Can texture or sampler objects be modified while they are used by a texture or image handle?

  RESOLVED:  No.  If such changes were permitted, each modification to the texture object would require potential synchronization with one or more texture/image handles extracted 
from the texture.  This seems like a lot of bookkeeping with little benefit.  One exception to this rule is that individual texels of such texture objects may still be updated with
APIs such as TexSubImage* and by rendering to a framebuffer object to which the texture is attached.

One exception to this rule is that individual texels of such texture objects may still be updated with APIs such as TexSubImage* and by rendering to a framebuffer object to which the texture is attached.

Does glClear belong to this exception?

And I have tried put glFinish or glTextureBarrier in between glClear and glDraw, but still can't fix my problem.

0 Likes
0 Replies