Jump to content
  • Advertisement
Sign in to follow this  
Yours3!f

compute shader image store frustration

This topic is 1634 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

hi,

 

I'm trying to store some values into a texture using image store, however when I grab the data back with glGetTexImage() I get weird values (3131961357 ???).

I'm on AMD A8-4500m win7 64 bit Catalyst 13.12, no errors etc.

 

cpu side:

//set up texture
GLuint tex = 0;
glGenTextures( 1, &tex );
glBindTexture( GL_TEXTURE_1D, tex );
glTexImage1D( GL_TEXTURE_1D, 0, GL_R32UI, 32, 0, GL_RED_INTEGER, GL_UNSIGNED_INT, 0 );

//...

//render using compute shader
glUseProgram( shader );

glBindImageTexture( 0, tex, 0, GL_FALSE, 0, GL_WRITE_ONLY, GL_R32UI );

glDispatchCompute( 32, 1, 1 );

glMemoryBarrier( GL_SHADER_IMAGE_ACCESS_BARRIER_BIT );
glFinish(); //not really needed just to make sure

//get back results
unsigned data[32] = {0};
glBindTexture( GL_TEXTURE_1D, tex );
glGetTexImage( GL_TEXTURE_1D, 0, GL_RED_INTEGER, GL_UNSIGNED_INT, data );

compute shader:

#version 430
layout(local_size_x = 1) in; //local workgroup size

layout(location=0, r32ui) uniform uimage1D result;

void main()
{
  ivec2 global_id = ivec2( gl_GlobalInvocationID.xy ); //this should go [0...31] right?

  imageStore(result, int(global_id.x), uvec4(1)); //write to each pixel of the texture 1
}

what am I doing wrong?

 

edit: seems like these are the same values as if the compute shader didn't run at all. Sooo the stores aren't happening or what...

 

SOLVED:

you need to put
 

glTexParameteri( GL_TEXTURE_1D, GL_TEXTURE_MIN_FILTER, GL_NEAREST );
glTexParameteri( GL_TEXTURE_1D, GL_TEXTURE_MAG_FILTER, GL_NEAREST );

after glTexImage1D on AMD. aaaaaaaaaaaaaaargh :D

 

best regards,

Yours3!f

Edited by Yours3!f

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

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

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!