'\" t .\" Title: clCreateFromGLBuffer .\" Author: The Khronos Group .\" Generator: DocBook XSL Stylesheets vsnapshot .\" Date: 01/14/2021 .\" Manual: OpenCL Manual .\" Source: The Khronos Group .\" Language: English .\" .TH "CLCREATEFROMGLBUFFER" "3clc" "01/14/2021" "The Khronos Group" "OpenCL Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .\" http://bugs.debian.org/507673 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) .ad l .\" ----------------------------------------------------------------- .\" * MAIN CONTENT STARTS HERE * .\" ----------------------------------------------------------------- .SH "NAME" clCreateFromGLBuffer \- Creates an OpenCL buffer object from an OpenGL buffer object\&. .SH "" .HP \w'cl_mem\ clCreateFromGLBuffer('u .BI "cl_mem clCreateFromGLBuffer(cl_context\ " "context" ", cl_mem_flags\ " "flags" ", GLuint\ " "bufobj" ", cl_int\ *" "\ errcode_ret" ");" .SH "PARAMETERS" .PP \fI context \fR .RS 4 A valid OpenCL context created from an OpenGL context\&. .RE .PP \fI flags \fR .RS 4 A bit\-field that is used to specify usage information\&. Refer to the table for \fBclCreateBuffer\fR(3clc)for a description of \fIflags\fR\&. Only \fBCL_MEM_READ_ONLY\fR, \fBCL_MEM_WRITE_ONLY\fR and \fBCL_MEM_READ_WRITE\fR values specified in the table at \fBclCreateBuffer\fR(3clc) can be used\&. .RE .PP \fI bufobj \fR .RS 4 The name of a GL buffer object\&. The data store of the GL buffer object must have have been previously created by calling OpenGL function \fBglBufferData\fR, 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\&. .RE .PP \fI errcode_ret \fR .RS 4 Returns an appropriate error code as described below\&. If \fIerrcode_ret\fR is NULL, no error code is returned\&. .RE .SH "DESCRIPTION" .PP The size of the GL buffer object data store at the time \fBclCreateFromGLBuffer\fR is called will be used as the size of buffer object returned by \fBclCreateFromGLBuffer\fR\&. If the state of a GL buffer object is modified through the GL API (e\&.g\&. \fBglBufferData\fR) while there exists a corresponding CL buffer object, subsequent use of the CL buffer object will result in undefined behavior\&. .PP The \fBclRetainMemObject\fR(3clc) and \fBclReleaseMemObject\fR(3clc) functions can be used to retain and release the buffer object\&. .PP The CL buffer object created using \fBclCreateFromGLBuffer\fR can also be used to create a CL 1D image buffer object .SH "ERRORS" .PP Returns a valid non\-zero OpenCL buffer object and \fIerrcode_ret\fR 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 \fIerrcode_ret\fR: .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} CL_INVALID_CONTEXT if \fIcontext\fR is not a valid context or was not created from a GL context\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} CL_INVALID_VALUE if values specified in \fIflags\fR are not valid\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} CL_INVALID_GL_OBJECT if \fIbufobj\fR is 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 is 0\&. \&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} CL_OUT_OF_RESOURCES if there is a failure to allocate resources required by the OpenCL implementation on the device\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} CL_OUT_OF_HOST_MEMORY if there is a failure to allocate resources required by the OpenCL implementation on the host\&. .RE .SH "SPECIFICATION" .PP \m[blue]\fBOpenCL Specification\fR\m[]\&\s-2\u[1]\d\s+2 .SH "SEE ALSO" .PP \fBcl_khr_gl_sharing\fR(3clc), \fBclCreateBuffer\fR(3clc), \fBclReleaseMemObject\fR(3clc), \fBclRetainMemObject\fR(3clc) .SH "AUTHORS" .PP \fBThe Khronos Group\fR .SH "COPYRIGHT" .br Copyright \(co 2007-2011 The Khronos Group Inc. .br 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. .sp .SH "NOTES" .IP " 1." 4 OpenCL Specification .RS 4 \%page 49, section 9.7.2 - CL Buffer Objects -> GL Buffer Objects .RE