Sign in to follow this  
Chris_F

Is this a driver bug? (Buffer Textures)

Recommended Posts

Chris_F    3030

I am messing around with programmable vertex pulling, using buffer textures to store indices and vertex attributes. The problem is that when I try to bind my index containing buffer texture to GL_TEXTURE0, it doesn't work. If I bind it to any other texture unit, it works. Please excuse the mess. http://pastebin.com/tKQSDPN2

 

Line 254:

glBindMultiTextureEXT(GL_TEXTURE0, GL_TEXTURE_BUFFER, TextureName[TEXTURE_INDEX]);

Change to (for example):

glBindMultiTextureEXT(GL_TEXTURE10, GL_TEXTURE_BUFFER, TextureName[TEXTURE_INDEX]);

Line 287:

glProgramUniform1i(shader_program, 0, 0);

Change to:

glProgramUniform1i(shader_program, 0, 10);

With that change, it suddenly works for me.

Share this post


Link to post
Share on other sites
Chris_F    3030

I'm going to guess that calling glBindTexture(GL_TEXTURE_BUFFER, 0) each time after pointing each texture to its corresponding buffer is overwriting the state of GL_TEXTURE0, because that is the default glActiveTexture

 

Removing them has made no difference.

Share this post


Link to post
Share on other sites
richardurich    1352

When you say removing them made no difference, do you mean you went from not working to not working? If so, that doesn't really rule out anything since you could have broken even more stuff or fixed part of the problem but not all of it.

 

I'd think setting a different active texture is a better way to test what radioteeth was talking about.

Share this post


Link to post
Share on other sites
Chris_F    3030

When you say removing them made no difference, do you mean you went from not working to not working? If so, that doesn't really rule out anything since you could have broken even more stuff or fixed part of the problem but not all of it.

 

I'd think setting a different active texture is a better way to test what radioteeth was talking about.

 

By made no difference I mean everything I said before is still valid.

 

Here is the old code with the glBindTexture calls removed: http://pastebin.com/6gF0Q5si

 

Everything I said before is still valid. It doesn't work, but if you change GL_TEXTURE0 to something else, it does.

 

However, here is an updated version which replaces some of the non-DSA code with what I believe to be the DSA equivalent: http://pastebin.com/75EvACPe

 

For some reason this version works with GL_TEXTURE0.

 

So again, I have no idea if I made some sort of mistake or if I have uncovered some driver bug.

Edited by Chris_F

Share this post


Link to post
Share on other sites
deftware    1778

Using glBindTexture affects whatever texture unit is active (default being GL_TEXTURE0)

 

Calling glBindMultiTextureEXT(GL_TEXTURE0, etc..) and then calling glBindTexture after will be like calling glBindMultiTexture(GL_TEXTURE0, ...) with whatever parameters you are passing glBindTexture.

 

You are effectively overwriting calls to glBindMultiTextureEXT that pass GL_TEXTURE0 when you follow them with glBindTexture calls without changing the active texture unit.

 

Either use glActiveTexture before your glBindTexture calls, to specify what texture unit they should be operating on, or do away with them altogether.

Share this post


Link to post
Share on other sites
Chris_F    3030

Using glBindTexture affects whatever texture unit is active (default being GL_TEXTURE0)

 

Calling glBindMultiTextureEXT(GL_TEXTURE0, etc..) and then calling glBindTexture after will be like calling glBindMultiTexture(GL_TEXTURE0, ...) with whatever parameters you are passing glBindTexture.

 

You are effectively overwriting calls to glBindMultiTextureEXT that pass GL_TEXTURE0 when you follow them with glBindTexture calls without changing the active texture unit.

 

Either use glActiveTexture before your glBindTexture calls, to specify what texture unit they should be operating on, or do away with them altogether.

 

Ah, of course. This is why I prefer DSA.

Share this post


Link to post
Share on other sites
Ashaman73    13715


Line 287:

glProgramUniform1i(shader_program, 0, 0);

Change to:

glProgramUniform1i(shader_program, 0, 10);

With that change, it suddenly works for me.

A common misstake with loading uniforms is, that you do not determine the proper location of the variables. You hardcode them here (0 and 10), but the locations depends on a lot of factors and you should really use glGetUniformLocation to determine the correct location.

Share this post


Link to post
Share on other sites
Mona2000    1967

 

A common misstake with loading uniforms is, that you do not determine the proper location of the variables. You hardcode them here (0 and 10), but the locations depends on a lot of factors and you should really use glGetUniformLocation to determine the correct location.

 

Nope. This is his shader:

layout(location = 0) uniform isamplerBuffer indexBuffer;

Location is always gonna be 0.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this