Extension adds support writing to sRGB images from a kernel.

#pragma OPENCL EXTENSION cl_khr_srgb_image_writes : enable


Additions to section 5.8.1 –Creating Program Objects:

The built-in image read functions will perform sRGB to linear RGB conversions if the image is an sRGB image. Writing to sRGB images from a kernel is an optional extension. The cl_khr_srgb_image_writes extension will be reported in the CL_DEVICE_EXTENSIONS string if a device supports writing to sRGB images using write_imagef. clGetSupportedImageFormats will return the supported sRGB images if CL_MEM_READ_WRITE or CL_MEM_WRITE_ONLY is specified in flags argument and the device supports writing to an sRGB image. If cl_khr_srgb_image_writes is supported, the built-in image write functions will perform the linear to sRGB conversion.

Only the R, G and B components are converted from linear to sRGB and vice-versa. The alpha component is returned as is.


OpenCL Specification

Also see

EXTENSION, clCreateProgramWithBinary, clBuildProgram, clCompileProgram,

Copyright © 2007-2013 The Khronos Group Inc. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and/or associated documentation files (the "Materials"), to deal in the Materials without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Materials, and to permit persons to whom the Materials are furnished to do so, subject to the condition that this copyright notice and permission notice shall be included in all copies or substantial portions of the Materials.