title: Compute shader not modifying 3d texture
body: <p>I want to move the initialization of my 3D texture from the CPU to the GPU. As a test, I wrote a shader to set all voxels to a constant value, but the texture is not modified at all. How do I make it work?</p>
  
  <p>Compute shader:</p>
  
  <pre><code>#version 430
  
  layout(local_size_x=1, local_size_y=1, local_size_z=1) in;
  layout(r8, location = 0) uniform image3D volume;
  
  void main()
  {
    imageStore(volume, ivec3(gl_WorkGroupID), vec4(0));
  }
  </code></pre>
  
  <p>Invocation: </p>
  
  <pre><code>glEnable(GL_TEXTURE_3D);
  glActiveTexture(GL_TEXTURE0);
  glGenTextures(1, &amp;volume_tid);
  glBindTexture(GL_TEXTURE_3D, volume_tid);
  glTexImage3D(GL_TEXTURE_3D, 0, GL_R8, volume_dims[0], volume_dims[1], volume_dims[2], 0, GL_RED, GL_UNSIGNED_BYTE, voxels);
  
  ShaderProgram computeVolumeShader;
  computeVolumeShader.loadShader(GL_COMPUTE_SHADER, "compute_volume.glsl");
  computeVolumeShader.link();
  computeVolumeShader.use();
  computeVolumeShader.uniform("volume", 0);
  glBindImageTexture(0, volume_tid, 0, GL_FALSE, 0, GL_READ_WRITE, GL_R8);
  glDispatchCompute(volume_dims[0], volume_dims[1], volume_dims[2]);
  glBindImageTexture(0, 0, 0, GL_FALSE, 0, GL_READ_WRITE, GL_R8);
  computeVolumeShader.unUse();
  glMemoryBarrier(GL_ALL_BARRIER_BITS);
  </code></pre>
  
  <p>Note: <code>voxels</code> fed into <code>glTexImage3D</code> contains the CPU initialized data.</p>