Jump to content

  • Log In with Google      Sign In   
  • Create Account

FREE SOFTWARE GIVEAWAY

We have 4 x Pro Licences (valued at $59 each) for 2d modular animation software Spriter to give away in this Thursday's GDNet Direct email newsletter.


Read more in this forum topic or make sure you're signed up (from the right-hand sidebar on the homepage) and read Thursday's newsletter to get in the running!


Is this a driver bug? (Buffer Textures)


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
8 replies to this topic

#1 Chris_F   Members   -  Reputation: 2465

Like
0Likes
Like

Posted 11 February 2014 - 07:31 AM

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.



Sponsor:

#2 radioteeth   Prime Members   -  Reputation: 1146

Like
0Likes
Like

Posted 11 February 2014 - 12:09 PM

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



#3 Chris_F   Members   -  Reputation: 2465

Like
0Likes
Like

Posted 11 February 2014 - 12:54 PM

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.



#4 richardurich   Members   -  Reputation: 1187

Like
0Likes
Like

Posted 11 February 2014 - 05:32 PM

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.



#5 Chris_F   Members   -  Reputation: 2465

Like
0Likes
Like

Posted 11 February 2014 - 11:25 PM

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, 12 February 2014 - 12:31 AM.


#6 radioteeth   Prime Members   -  Reputation: 1146

Like
0Likes
Like

Posted 12 February 2014 - 02:34 AM

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.



#7 Chris_F   Members   -  Reputation: 2465

Like
0Likes
Like

Posted 12 February 2014 - 02:48 AM

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.



#8 Ashaman73   Crossbones+   -  Reputation: 8001

Like
0Likes
Like

Posted 17 February 2014 - 01:24 AM


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.



#9 Mona2000   Members   -  Reputation: 629

Like
0Likes
Like

Posted 17 February 2014 - 09:37 AM

 

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.






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