Jump to content
  • Advertisement
Sign in to follow this  
Chris_F

Is this a driver bug? (Buffer Textures)

This topic is 2067 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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
Advertisement

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

Share this post


Link to post
Share on other sites

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

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

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

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

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


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

 

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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!