Page 1 of 2 12 LastLast
Results 1 to 10 of 15

Thread: Crashes with ARB_texture_buffer_object

  1. #1
    Member Contributor
    Join Date
    Feb 2004
    Location
    Germany
    Posts
    59

    Crashes with ARB_texture_buffer_object

    I have written a shader using this extension but each time I activate the code that calls texelFetchBuffer I get a crash (division by zero) in the driver. The worst is that the crash occurs in a secondary thread so I can't track this down to anything.

    I verified my texture buffers and they contain the proper data. I also checked that they are bound to the proper texture units - but this doesn't seem to matter regarding the crash. No matter how much of my data I initialize, I always get the same crash in the driver and I'm out of ideas.

    I tried to strip the shader down to the barest minimum - and it still crashes.

    Can anyone here point me to some demo code which sets up and uses a texture buffer? Hopefully that may give me some clues what is wrong with my code.

  2. #2
    Senior Member OpenGL Lord
    Join Date
    Mar 2015
    Posts
    6,677

    Re: Crashes with ARB_texture_buffer_object

    This is probably a driver bug. Submit it to the maker for your graphics card.

  3. #3
    Member Contributor
    Join Date
    Feb 2004
    Location
    Germany
    Posts
    59

    Re: Crashes with ARB_texture_buffer_object

    Yeah, sure, that may well be the cause. But I'd really like to make sure first that I didn't overlook something really stupid, that's why I asked for working demo code because I can't seem to find any.

    I'm using a Geforce 8600GT with 190.62 drivers btw.

  4. #4
    Senior Member Regular Contributor
    Join Date
    Aug 2005
    Posts
    145

    Re: Crashes with ARB_texture_buffer_object

    Fwiw, my preliminary (albeit trivial) testing has proved fruitful on NV hardware (GF8800-190.57).

    A thing or 2 to look out for:
    - No TexParameter calls with TEXTURE_BUFFER as target
    - Check for valid format (3.1 spec, p. 140)

    As a sanity check you basically ...
    - create a buffer with target TEXTURE_BUFFER
    - create a texture with a valid format
    - make texture active and attach buffer (TexBuffer)
    - bind texture to a sampleBuffer in shader (like you would a normal texture)
    - sample with {i|u}texelFetch

  5. #5
    Member Contributor
    Join Date
    Feb 2004
    Location
    Germany
    Posts
    59

    Re: Crashes with ARB_texture_buffer_object

    I went back to the start trying to get the most simple shader to run, I was partially successful but now I got a problem that's even weirder.

    This is my shader:

    Code :
    #version 120
    #extension GL_EXT_gpu_shader4 : enable
    uniform samplerBuffer lightRGB;
    uniform sampler2D tex;
     
    void main()
    {
    	int index = int(clamp(gl_TexCoord[0].s, 0, 32.0));
    	vec4 light = texelFetchBuffer(lightRGB, index);
    	vec4 texel = texture2D(tex, gl_TexCoord[0].st);
     
    	gl_FragColor = texel*2.0 + light/20.0;
    }

    But I can't seem to get the data from both samplers. Using only one is fine and I get the proper data for both as long as the other one is not accessed.
    But as soon as I try to get data from both the one from the first sampler is just ignored. In the code above I only get the regular textures but if I switch the 2 lines of code around I only get the data from the texture buffer. I also tried to use #pragma optimize but that makes no difference.

    Here's the code that sets up the texture buffer. This seems to work fine as I can get the data out of this if I don't try to access the other texture:

    Code :
    	glGenBuffers(1, &idbuffer);
    	glBindBuffer(GL_TEXTURE_BUFFER, idbuffer);
    	static unsigned char testdata[] = {
    		255,255,255,0,
    		255,  0,  0,0,
    		  0,255,  0,0,
    		  0,  0,255,0,
    		255,255,  0,0,
    		  0,255,255,0,
    		255,  0,255,0,
    		255,255,255,0,
    		255,  0,  0,0,
    		  0,255,  0,0,
    		  0,  0,255,0,
    		255,255,  0,0,
    		  0,255,255,0,
    		255,  0,255,0,
    		255,255,255,0,
    		255,  0,  0,0,
    		  0,255,  0,0,
    		  0,  0,255,0,
    		255,255,  0,0,
    		  0,255,255,0,
    		255,  0,255,0,
    		255,255,255,0,
    		255,  0,  0,0,
    		  0,255,  0,0,
    		  0,  0,255,0,
    		255,255,  0,0,
    		  0,255,255,0,
    		255,  0,255,0,
    		128, 64,  0,0,
    		 64, 32,  0,0,
    		  0,128,255,0,
    		  0, 64,128,0,
    	};
    	glBufferData(GL_TEXTURE_BUFFER, 128, &testdata[0], GL_STREAM_DRAW);
     
    	glGenTextures(1, &idtexture);
    	glBindTexture(GL_TEXTURE_BUFFER, idtexture);
    	glTexBufferARB(GL_TEXTURE_BUFFER, GL_RGBA8, idbuffer);
     
    	glActiveTexture(GL_TEXTURE14);
    	glBindTexture(GL_TEXTURE_BUFFER, idtexture);
     
    	glActiveTexture(GL_TEXTURE0);
    	glBindTexture(GL_TEXTURE_2D, 0);

    I am using NVidia's latest beta driver which I installed in the hope that the crash I had yesterday would go away but it didn't help there.

  6. #6
    Senior Member OpenGL Pro dletozeun's Avatar
    Join Date
    Jan 2006
    Location
    FRANCE
    Posts
    1,367

    Re: Crashes with ARB_texture_buffer_object

    Your texture bindings are confusing. Why are you binding the texture to the 15th texture unit?
    Looks like you are binding the texture name "idtexture" to the TU0 then specifiying its data, then binding again the same name but to TU14 and then binding the default texture name to the TU0.

    What kind of texture is bound to TU0 finally? Is it the one sampled by the sampler "tex"? Are you sure that the samplers "tex" and "lightRGB" are "attached" to the right texture unit?

  7. #7
    Member Contributor
    Join Date
    Feb 2004
    Location
    Germany
    Posts
    59

    Re: Crashes with ARB_texture_buffer_object

    Quote Originally Posted by dletozeun
    Your texture bindings are confusing. Why are you binding the texture to the 15th texture unit?
    Looks like you are binding the texture name "idtexture" to the TU0 then specifiying its data, then binding again the same name but to TU14 and then binding the default texture name to the TU0.
    I did this because I thought that binding it to TU14 for initialization was the reason for the errors. Turned out it wasn't. It doesn't work either way.

    Why am I using TU14? The test code is from a larger project which already had TU14 properly initialized.



    What kind of texture is bound to TU0 finally? Is it the one sampled by the sampler "tex"? Are you sure that the samplers "tex" and "lightRGB" are "attached" to the right texture unit?
    TU0 will finally contain just a regular RGBA8 texture. Yes, it's the one sampled in 'tex'. Yes, I am sure that the textures are attached correctly. As I said, each one being used alone in the shader produces correct results. Just when I sample both I only get the value from the second one, whichever that is.

  8. #8
    Senior Member Frequent Contributor arekkusu's Avatar
    Join Date
    Nov 2003
    Posts
    891

    Re: Crashes with ARB_texture_buffer_object

    So, where do you set your sampler uniforms? They need to match the bound units.

  9. #9
    Member Contributor
    Join Date
    Feb 2004
    Location
    Germany
    Posts
    59

    Re: Crashes with ARB_texture_buffer_object

    The samplers are set correctly.
    Do I need to repeat again that I get the correct data out of both samplers as long as I only use one?

    If I hadn't set the samplers properly that wouldn't work, would it?

    So again. If I use:

    Code :
    #version 120
    #extension GL_EXT_gpu_shader4 : enable
    uniform samplerBuffer lightRGB;
    uniform sampler2D tex;
     
    void main()
    {
    	int index = int(clamp(gl_TexCoord[0].s, 0, 32.0));
    	vec4 light = texelFetchBuffer(lightRGB, index);
    	vec4 texel = texture2D(tex, gl_TexCoord[0].st);
     
    	gl_FragColor = texel*2.0 + light/20.0;
    }

    I only get the data fron 'tex'.

    And if I use

    Code :
    #version 120
    #extension GL_EXT_gpu_shader4 : enable
    uniform samplerBuffer lightRGB;
    uniform sampler2D tex;
     
    void main()
    {
    	int index = int(clamp(gl_TexCoord[0].s, 0, 32.0));
    	vec4 texel = texture2D(tex, gl_TexCoord[0].st);
    	vec4 light = texelFetchBuffer(lightRGB, index);
     
    	gl_FragColor = texel*2.0 + light/20.0;
    }

    I only get the data from lightRGB. No changes to my C++ code whatsoever.

  10. #10
    Senior Member OpenGL Pro dletozeun's Avatar
    Join Date
    Jan 2006
    Location
    FRANCE
    Posts
    1,367

    Re: Crashes with ARB_texture_buffer_object

    That's crazy, you just switch two lines which are completely independent of the result of the other one and you get totally different results...

    Is possible to post the assembly code? I'll try to compile this with the cg compiler when I would have time.

Page 1 of 2 12 LastLast

Similar Threads

  1. glGetUniformiv crashes on ATI?
    By imported_pjcozzi in forum OpenGL: Advanced Coding
    Replies: 2
    Last Post: 12-16-2009, 12:25 PM
  2. Glu Tesselator Crashes!
    By glfreak in forum OpenGL: Advanced Coding
    Replies: 5
    Last Post: 10-30-2008, 08:05 AM
  3. pc crashes
    By in forum OpenGL: User Software
    Replies: 0
    Last Post: 03-14-2002, 03:32 AM
  4. Crashes on GF3
    By Humus in forum OpenGL: Advanced Coding
    Replies: 31
    Last Post: 02-25-2002, 11:33 AM
  5. Quake III - Crashes
    By in forum OpenGL: User Software
    Replies: 4
    Last Post: 12-24-2000, 05:39 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean