title: Mipmapping with compute shader
body: <p>I have 3D textures of colors, normals and other data of my voxelized scene and because some of this data can't be just averaged i need to calculate mip levels by my own. The 3D texture sizes are (128+64) x 128 x 128, the additional 64 x 128 x 128 are for mip levels.</p>
  
  <p>So when i take the first mip level, which is at (0, 0, 0) with a size of 128 x 128 x 128 and just copy voxels to the second level, which is at (128, 0, 0) the data appears there, but as soon as i copy the second level at (128, 0, 0) to the third at (128, 0, 64) the data doesn't appear at the 3rd level.</p>
  
  <p>shader code:</p>
  
  <pre><code>#version 450 core
  
  layout (local_size_x = 1,
          local_size_y = 1,
          local_size_z = 1) in;
  
  layout (location = 0) uniform unsigned int resolution;
  layout (binding = 0, rgba32f) uniform image3D voxel_texture;
  
  void main()
  {
      ivec3 index = ivec3(gl_WorkGroupID);
      ivec3 spread_index = index * 2;
  
      vec4 voxel = imageLoad(voxel_texture, spread_index);
      imageStore(voxel_texture, index + ivec3(resolution, 0, 0), voxel);
  
      // This isn't working
      voxel = imageLoad(voxel_texture, spread_index + 
                        ivec3(resolution, 0, 0));
      imageStore(voxel_texture, index + ivec3(resolution, 0, 64), voxel);
  }
  </code></pre>
  
  <p>The shader program is dispatched with</p>
  
  <pre><code>glUniform1ui(0, OCTREE_RES);
  
  glBindImageTexture(0, voxel_textures[0], 0, GL_TRUE, 0, GL_READ_WRITE, 
                     GL_RGBA32F);
  
  glDispatchCompute(64, 64, 64);
  </code></pre>
  
  <p>I don't know if i missed some basic thing, this is my first compute shader. I also tried to use memory barriers but it didn't change a thing.</p>