I'm trying to write to an OpenCL image (CL_RGBA, CL_UNORM_INT8), shared with Direct3D 10 (DXGI_FORMAT_R8G8B8A8_UNORM). The color I'm putting in the image with can be (for example) (float4) (0.2f, 0.f, 0.f, 1.f) (just a little bit of red). The color displayed on the screen is (1.f, 0.f, 0.f, 1.0) as if the colors were normalized. Trying to write grey results in a white image. The same bug does not appear using write_imageui in the same project. I don't know if the bug is related to the d3d10 interop. I will not try to isolate the bug, I'm writing simple code to start a project and problems keep coming out from everywhere, I'm going to test everything on an nvidia card.
I'm running on windows 7 64 bit, compiling with visual studio 32 bit compiler. My graphics card is a mobility radeon HD 5470, with ATI catalyst 11.9 drivers. The OpenCL implementations is the 32 bit OpenCL.lib file found in the AMD APP SDK version 2.5.
I didn't want to shock you with this incredibly complicated kernel, but there it is:
kernel void writePixel(write_only image2d_t image, int imageWidth)
int id = get_global_id(0);
write_imagef(image, (int2) (id%imageWidth, id/imageWidth), (float4) (0.2f, 0.f, 0.f, 1.f));
This writes a red image ((1, 0, 0, 1)).