cancel
Showing results for 
Search instead for 
Did you mean: 

OpenGL & Vulkan

ronniko
Adept I

Windows 7 OpenGL 4.5 Radeon HD 7950. FBO not clear depth. Crimson 17.12.1

I created context wglCreateContextAttribsARB with:

WGL_SUPPORT_OPENGL_ARB, GL_TRUE,\

                            WGL_DOUBLE_BUFFER_ARB, GL_TRUE,\

                            WGL_PIXEL_TYPE_ARB, WGL_TYPE_RGBA_ARB,\

                            WGL_COLOR_BITS_ARB, 32,\

                            WGL_DEPTH_BITS_ARB, 16 ,\

                            WGL_SAMPLE_BUFFERS_ARB,GL_TRUE ,\

                            WGL_SAMPLES_ARB,4

I try with WGL_DEPTH_BITS_ARB, 24 ,WGL_STENCIL_BITS_ARB, 8  but result the same.

I created FBO color and depth textures. And i see 3d model teapot and dirt in depth and color fbo textures. My model teapot rotated.

I try create FBO depth with flag GL_DEPTH_COMPONENT not help. Try with GL_DEPTH24_STENCIL8 not help.

I try create glRenderbufferStorageMultisample(GL_RENDERBUFFER, 8, GL_DEPTH_COMPONENT16_ARB, 512,512) not help

When i do render in FBO i do: glClearColor(1.0f, 0.0f, 1.0f,1.0);

       glClear(GL_DEPTH_BUFFER_BIT+GL_COLOR_BUFFER_BIT+ GL_STENCIL_BUFFER_BIT  );

I try clear only Depth but not help.

My question is this bug AMD driver ?!

I draw in FBO plane for clearing dirt. Its help for color FBO texture, but not help for depth FBO.

Its problem will return, when i begin write shadow map technic.

0 Likes
6 Replies
ronniko
Adept I

I found. That's my fault !

I use bindless textures. In fragment shader i do layout (binding = 0, std140) uniform ALL_TEXTURES { sampler2D texs[4000]; };

And FBO color texture GL_COLOR_ATTACHMENT0 !

I removed bindless textures from fragment shader and FBO depth and color textures now cleared.

And i see correct FBO color texture without dirt !

0 Likes

Its AMD driver bug !

I tested on NVIDIA GeForce 1050 ti. And FBO depth cleared. I use bindless textures and FBO render.

Screenshot from GeForce 1050 ti:

nvidia.jpg

But the same program on AMD not clear FBO depth ! In top left coner FBO depth texture.

Screenshot from Radeon HD 7950 and Radeon R380:

rr.jpg

0 Likes

How i do.

I create FBO color and depth textures. As simple GL_TEXTURE_2D. Not msaa !

Check FBO status. Get FRAMEBUFFER status = 0x8CD5 (8CD5=COMPLETE).

Then i do bindless for FBO color and depth textures.

glBindTexture(GL_TEXTURE_2D,FBOColorTexture);

AdrrInt64 = glGetTextureHandleARB(FBOColorTexture);

glMakeTextureHandleResidentARB(AdrrInt64);

Set AdrrInt64 to uniform buffer(buffers.BindlesstextureHandle)

for bindless shader textures. Offset for one texture addres 16 bytes for uniform buf.

glBindTexture(GL_TEXTURE_2D,FBODepthTexture);

AdrrDepthInt64 = glGetTextureHandleARB(FBODepthTexture);

glMakeTextureHandleResidentARB(AdrrDepthInt64);

Set AdrrDepthInt64 to uniform buffer(buffers.BindlesstextureHandle+16) for bindless shader textures.

And glBindBufferBase(GL_UNIFORM_BUFFER, 9,buffers.BindlesstextureHandle);

I use WGL_CONTEXT_FLAGS_ARB,WGL_CONTEXT_DEBUG_BIT_ARB,\

                         WGL_CONTEXT_PROFILE_MASK_ARB, WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB

But debugCallBack function not send me any warnings or messages for AMD videocards.

For NVIDIA i get many messages in log file.

0 Likes

When i do screenshot FBO texture i not see dirt in tga file ! I open in photoshop tga screenshot and see two teapots without dirt and bugs !

void screendump(int W, int H) {

FILE   *out = fopen("screenshot.tga","wb");

char   *pixel_data = new char[3*W*H];

short  TGAhead[] = { 0, 2, 0, 0, 0, 0, W, H, 32 };

glReadBuffer(GL_FRONT);

glReadPixels(0, 0, W, H, GL_BGRA, GL_UNSIGNED_BYTE, pixel_data);

fwrite(&TGAhead,sizeof(TGAhead),1,out);

fwrite(pixel_data, 4*W*H, 1, out);

fclose(out);

delete[] pixel_data; }

0 Likes

Got the same garbage pattern some time ago.

In my app it appeared only once per 2-3 launches and only after I delete and allocate some framebuffers several times. It's very hard to write a minimal reproducible example.

0 Likes
nou
Exemplar

Don't assume that if it work on nVidia that you program is correct. nVidia OpenGL driver is much more forgiving where AMD is more strict. So check official OpenGL specification if you don't do some invalid or undefined operation.

0 Likes