title: write_imagef seems to not change any values
body: <p>I'm trying to write texture data using opencl and displaying it with opengl. The goal is to compare the performance with and without interoperability. But right now I am failing to generate the texture itself. I first wanted to try to do it without the interoperability:</p>
  <p>cl Buffer initialization and kernel creation:</p>
  <pre><code>this-&gt;imageBuffer = new cl::Image2D(*context, CL_MEM_WRITE_ONLY, cl::ImageFormat(CL_RGBA, CL_FLOAT), this-&gt;width, this-&gt;height); //this-&gt;imageBuffer is a cl::Image*
  
  //create kernel
  this-&gt;kernel = new cl::Kernel(program, &quot;simple_kernel&quot;);
  
  //set kernel arguments
  this-&gt;kernel-&gt;setArg(0, *(this-&gt;imageBuffer));
  this-&gt;kernel-&gt;setArg(1, this-&gt;offset); 
  </code></pre>
  <p>kernel execution (happening in loop):</p>
  <pre><code>cl::size_t&lt;3&gt; origin;
  origin[0] = 0; origin[1] = 0; origin[2] = 0;
  cl::size_t&lt;3&gt;  range;
  range[0] = this-&gt;width; range[1] = this-&gt;height; range[2] = 1;
  
  //Not necessary needed, but shows my point
  this-&gt;queue-&gt;enqueueWriteImage(*(this-&gt;imageBuffer), CL_TRUE, origin, range, 0, 0, this-&gt;imageOutput);
  
  //enqueue kernel with NDRange
  this-&gt;queue-&gt;enqueueNDRangeKernel(*(this-&gt;kernel), cl::NullRange, *(this-&gt;global_size), cl::NullRange);
  
  this-&gt;queue-&gt;enqueueReadImage(*(this-&gt;imageBuffer), CL_TRUE, origin, range, 0, 0, this-&gt;imageOutput);
  
  this-&gt;queue-&gt;finish();
  
  std::cout &lt;&lt; &quot;fancy output: &quot; &lt;&lt; std::endl;;
  for(int y = 0; y &lt; this-&gt;height; y++) {
      for(int x = 0; x &lt; this-&gt;width; x++) {
          std::cout &lt;&lt; this-&gt;imageOutput[(y * this-&gt;width) + x] &lt;&lt; &quot;;&quot;;
      }
      std::cout &lt;&lt; std::endl;
  }
  </code></pre>
  <p>OpenCL kernel:</p>
  <pre><code>__kernel void simple_kernel(__global __write_only image2d_t texture, float offset) { //offset is not used for testing
      int x = get_global_id(0);
      int y = get_global_id(1);
  
      int2 pixelPos = (int2)(x, y);
      float4 pixelColor = (float4)(0.5f, 0.0f, 0.0f, 1.0f);
  
      write_imagef(texture, pixelPos, pixelColor);
  };
  </code></pre>
  <p>All solutions that I found for similar problems are related to the internal format and format used in glTexImage2D (used at the beginning in OpenGL rendering part) so it might actually be the same problem here, but I am not seeing what I am doing wrong.</p>
  <p>The expected result would be a red quad. But it only displays the initialized texture (so white in this case. Or black if initialized with 0.0f. Or grey if initialized with 0.4f). By enqueuing also the writeImage, I was able to narrow down that the kernel seems to not change the buffer at all. If writeImage is commented out it displays a black quad. So reading the buffer seems to work, as it reads an empty buffer in that case (resulting in the black quad).</p>
  <p>This is reinforced by the fact, that the fancy output (used at the end in kernel execution part) only prints the initialized values (e.g. 1s or 0.4s. Or it prints 0s when writeImage is not used)</p>