Results 1 to 3 of 3

Thread: Write only a single color component

  1. #1
    Junior Member
    Join Date
    Nov 2012
    Posts
    7

    Write only a single color component

    Hi,
    I'm using images to output some precise data. write_imageui accepts a complete BGRA color. My kernel outputs only a single color component. Is there a way to write only a single color component instead of a complete BGRA color?
    Reading color value and then writing it back doesn't seem like a good solution to me - I might get some really strange values if two threads attempt to read/write it at the same time.

    Thank you!

  2. #2
    Senior Member
    Join Date
    Dec 2011
    Posts
    161

    Re: Write only a single color component

    You can't read and write to the same image anyway, so that isn't an option.

    You can't write a single color component using images.

    Other solutions:

    1. Use buffers, which can read/modify/write (but then you simultaneous access issue arises).
    2. If you are really thinking of individual channels separately, use multiple single channel images instead of packed RGB[A] images.
    3. Read from one image, modify the single channel, and write to another image.

  3. #3
    Junior Member
    Join Date
    Nov 2012
    Posts
    7

    Re: Write only a single color component

    Thanks for clarifying!
    I think I'll go with the second solution - I'll write to 4 different single-channel images and then I'll have a separate kernel that will join them into a single image.

Similar Threads

  1. Replies: 1
    Last Post: 08-18-2008, 01:37 PM
  2. Replies: 1
    Last Post: 01-01-1970, 12:00 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •