IMAGEFUNCTIONS(3clc)

πŸ“¦
version 1.0~svn33624 Β· 3 versions
, in ubuntu jammy, ubuntu noble

okay so this is IMAGE READ, WRITE, A, page 3 of the OpenCL Manual (you'll see it written as 3clc). It's the glow-up index page for the image read/write/query built-ins β€” every single one of them, and clicking any item in the original table takes you to that function's own page. Bestie, consider this your map. πŸ—ΊοΈβœ¨


✨ NAME ✨

Image_Read_and_Write_Functions β€” built-in functions to read, write, and query image memory objects. Tap any item below and it'll spill the details on that function. 🫢

🌸 the whole roster 🌸

πŸ’… 1D girlies

  • read_imagef1d(3clc) for 1D β€” do an element lookup in the 1D image object, with or without a sampler, and get back floating-point values. πŸ’–
  • read_imagei1d(3clc) for 1D β€” do an element lookup in the 1D image object, with or without a sampler, and get back unnormalized signed integer and unsigned integer values. πŸ”’
  • read_imageh1d(3clc) for 1D β€” OPTIONAL function that does an element lookup in the 1D image object, with or without a sampler, returning floating-point values. It's enabled with cl_khr_fp16(3clc). ✨
  • write_image1d(3clc) for 1D β€” write a color value to a location in the 2D image object. The half type is enabled with cl_khr_fp16(3clc). πŸ–ŠοΈ

πŸ¦‹ 2D besties

  • read_imagef2d(3clc) for 2D β€” do an element lookup in the 2D image object, with or without a sampler, and get back floating-point values. πŸ’–
  • read_imagei2d(3clc) for 2D β€” do an element lookup in the 2D image object, with or without a sampler, and get back unnormalized signed integer and unsigned integer values. πŸ”’
  • read_imageh2d(3clc) for 2D β€” OPTIONAL function that does an element lookup in the 2D image object, with or without a sampler, returning floating-point values. It's enabled with cl_khr_fp16(3clc). ✨
  • write_image2d(3clc) for 2D β€” write a color value to a location in the 2D image object. The half type is enabled with cl_khr_fp16(3clc). πŸ–ŠοΈ

🧚 3D main characters

  • read_imagef3d(3clc) for 3D β€” do an element lookup in the 3D image object, with or without a sampler, and get back floating-point values. πŸ’–
  • read_imagei3d(3clc) for 3D β€” do an element lookup in the 3D image object, with or without a sampler, and get back unnormalized signed integer and unsigned integer values. πŸ”’
  • read_imageh3d(3clc) for 3D β€” OPTIONAL function that does an element lookup in the 3D image object, with or without a sampler, returning floating-point values. It's enabled with cl_khr_fp16(3clc). ✨
  • write_image3d(3clc) for 3D β€” write a color value to a location in the 2D image object. The half type is enabled with cl_khr_fp16(3clc). πŸ–ŠοΈ

πŸ‘‘ the little getters that could (query squad)


fr fr, that's the entire table, no skips, no cuts. πŸ’–

πŸ“ NOTES πŸ’­

okay bestie, listen up, because this is the part where it gets specific. The built-in functions defined in this section can only be used with image memory objects. And an image memory object? It gets accessed by specific function calls that read from and/or write to specific locations in the image. That's the whole vibe. πŸ–ΌοΈβœ¨

Image memory objects that are being read by a kernel should be declared with the accessQualifiers(3clc) qualifier. And if you go and do write_image calls on image memory objects declared with the accessQualifiers(3clc) qualifier? πŸ’€ Compilation error. Straight up. No warning, no mercy.

Image memory objects that are being written to by a kernel should be declared with the accessQualifiers(3clc) qualifier. And flip it: read_image calls to image memory objects declared with the accessQualifiers(3clc) qualifier will generate a compilation error too. 😭

🚨 and bestie, hear me on this one: read_image and write_image calls to the same image memory object in a kernel are not supported. Not "discouraged". Not "a little sketchy". Not supported. periodt.

The read_image calls return a four component floating-point, integer or unsigned integer color value. Those color values are identified as x, y, z, w where:

  • x β€” the red component πŸ“
  • y β€” the green component 🌿
  • z β€” the blue component πŸ¦‹
  • w β€” the alpha component πŸ’œ

like, the alphabet soup is just RGBA wearing a lil disguise. iykyk. πŸ‘‘


πŸ“œ SPECIFICATION πŸ“œ

OpenCL Specification[1]


πŸ‘€ SEE ALSO πŸ‘€

go read those too, they're part of the lore 🫢


✍️ AUTHORS ✍️

The Khronos Group


Copyright Β© 2007-2011 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 following condition:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Materials.

πŸ“Ž NOTES (yes, again β€” these are the footnote ones) πŸ“Ž

  1. OpenCL Specification β€” page 292, section 6.12.14 - Image Read and Write Functions

and that's a wrap, bestie πŸ’– this page is brought to you by The Khronos Group, dated 01/14/2021, filed under IMAGE READ, WRITE, A(3clc) β€” go forth and slay your image reads, but for real, do not read and write the same image object in one kernel, i love u, bye πŸŽ€βœ¨

πŸ“¦ where this page comes from