CLCREATEFROMGLBUFFER(3clc)
π CLCREATEFROMGLBUFFER π
from the OpenCL Manual β yes bestie, we're doing the OpenCL man pages now, and honestly? iconic behavior.
β¨ NAME β¨
clCreateFromGLBuffer β Creates an OpenCL buffer object from an OpenGL buffer object. it's giving crossover episode π¦
cl_mem clCreateFromGLBuffer(cl_context context, cl_mem_flags flags,
GLuint bufobj, cl_int * errcode_ret);
πΈ PARAMETERS πΈ
contextβ A valid OpenCL context created from an OpenGL context. Like, it has to be from a GL context, no exceptions, periodt.flagsβ A bit-field that is used to specify usage information. Refer to the table forclCreateBuffer(3clc)for a description of flags. OnlyCL_MEM_READ_ONLY,CL_MEM_WRITE_ONLYandCL_MEM_READ_WRITEvalues specified in the table atclCreateBuffer(3clc)can be used. That's it, that's the whole guest list π.bufobjβ The name of a GL buffer object. The data store of the GL buffer object must have have been previously created by calling OpenGL functionglBufferData, although its contents need not be initialized. The size of the data store will be used to determine the size of the CL buffer object. So like, the shape has to exist, the vibes inside can be empty π .errcode_retβ Returns an appropriate error code as described below. Iferrcode_retisNULL, no error code is returned. (Skipping the receipt, we love a low-maintenance queen.)
π DESCRIPTION π
The size of the GL buffer object data store at the time clCreateFromGLBuffer is called will be used as the size of buffer object returned by clCreateFromGLBuffer. Locked in at that exact moment, no take-backs.
π¨ big yikes warning: If the state of a GL buffer object is modified through the GL API (e.g. glBufferData) while there exists a corresponding CL buffer object, subsequent use of the CL buffer object will result in undefined behavior. Not "a little weird", not "maybe fine" β undefined. Do not do this. I'm literally begging. π
The clRetainMemObject(3clc) and clReleaseMemObject(3clc) functions can be used to retain and release the buffer object. Hold it, let it go, main character energy either way π«Ά.
The CL buffer object created using clCreateFromGLBuffer can also be used to create a CL 1D image buffer object. Look at her, multitasking β¨.
π ERRORS π
Returns a valid non-zero OpenCL buffer object and errcode_ret is set to CL_SUCCESS if the buffer object is created successfully. Otherwise, it returns a NULL value with one of the following error values returned in errcode_ret:
CL_INVALID_CONTEXTifcontextis not a valid context or was not created from a GL context. (Girl, wrong room π)CL_INVALID_VALUEif values specified inflagsare not valid.CL_INVALID_GL_OBJECTifbufobjis not a GL buffer object or is a GL buffer object but does not have an existing data store e or the size of the buffer is0. .CL_OUT_OF_RESOURCESif there is a failure to allocate resources required by the OpenCL implementation on the device.CL_OUT_OF_HOST_MEMORYif there is a failure to allocate resources required by the OpenCL implementation on the host.
β SPECIFICATION β
OpenCL Specification[1]
π SEE ALSO π
cl_khr_gl_sharing(3clc), clCreateBuffer(3clc), clReleaseMemObject(3clc), clRetainMemObject(3clc)
(go read these too, they're the friend group π§)
π AUTHORS π
The Khronos Group
π COPYRIGHT π
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 condition that this copyright notice and permission notice shall be included in all copies or substantial portions of the Materials.
π NOTES π
- OpenCL Specification β page 49, section 9.7.2 - CL Buffer Objects -> GL Buffer Objects
okay that's the whole page bestie, you ate that π courtesy of The Khronos Group, dated 01/14/2021 β CLCREATEFROMGLBUFFER(3clc) out, mwah ππ¦πΈ
π¦ where this page comes from
- ubuntu jammy: opencl-1.2-man-doc 1.0~svn33624-5 Β· other
- ubuntu noble: opencl-1.2-man-doc 1.0~svn33624-5 Β· other
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms