'\" t .\" Title: clCreateFromGLRenderbuffer .\" Author: The Khronos Group .\" Generator: DocBook XSL Stylesheets vsnapshot .\" Date: 01/14/2021 .\" Manual: OpenCL Manual .\" Source: The Khronos Group .\" Language: English .\" .TH "CLCREATEFROMGLRENDER" "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" clCreateFromGLRenderbuffer \- Creates an OpenCL 2D image object from an OpenGL renderbuffer object\&. .SH "" .HP \w'cl_mem\ clCreateFromGLRenderbuffer('u .BI "cl_mem clCreateFromGLRenderbuffer(cl_context\ " "context" ", cl_mem_flags\ " "flags" ", GLuint\ " "renderbuffer" ", 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 at \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 renderbuffer \fR .RS 4 The name of a GL renderbuffer object\&. The renderbuffer storage must be specified before the image object can be created\&. The \fIrenderbuffer\fR format and dimensions defined by OpenGL will be used to create the 2D image object\&. Only GL renderbuffers with internal formats that map to appropriate image channel order and data type specified in the table of supported Image Channel Order Values and the table of supported Image Channel Data Types for \fB\fBcl_image_format\fR(3clc)\fR can be used to create the 2D image 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 If the state of a GL renderbuffer object is modified through the GL API (i\&.e\&. changes to the dimensions or format used to represent pixels of the GL renderbuffer using appropriate GL API calls such as \fBglRenderbufferStorage\fR) while there exists a corresponding CL image object, subsequent use of the CL image object will result in undefined behavior\&. .PP The \fBclRetainMemObject\fR(3clc) and \fBclReleaseMemObject\fR(3clc) functions can be used to retain and release the image objects\&. .PP The table below (Table 9\&.4) describes the list of GL texture internal formats and the corresponding CL image formats\&. If a GL texture object with an internal format from the table below is successfully created by OpenGL, then there is guaranteed to be a mapping to one of the corresponding CL image format(s) in that table\&. Texture objects created with other OpenGL internal formats may (but are not guaranteed to) have a mapping to a CL image format; if such mappings exist, they are guaranteed to preserve all color components, data types, and at least the number of bits/component actually allocated by OpenGL for that format\&. .TS allbox center tab(:); cB cB. T{ GL internal format T}:T{ CL image format (channel order, channel data type) T} .T& c c c c c c c c c c c c c c c c c c c c c c c c. T{ \fBGL_RGBA8\fR T}:T{ \fBCL_RGBA, CL_UNORM_INT8 or CL_BGRA, CL_UNORM_INT8\fR T} T{ \fBGL_RGBA\fR, \fBGL_UNSIGNED_INT_8_8_8_8_REV\fR T}:T{ \fBCL_RGBA, CL_UNORM_INT8\fR T} T{ \fBGL_BGRA\fR, \fBGL_UNSIGNED_INT_8_8_8_8_REV\fR T}:T{ \fBCL_BGRA, CL_UNORM_INT8\fR T} T{ \fBGL_RGBA16\fR T}:T{ \fBCL_RGBA, CL_UNORM_INT16\fR T} T{ \fBGL_RGBA8I, GL_RGBA8I_EXT\fR T}:T{ \fBCL_RGBA, CL_SIGNED_INT8\fR T} T{ \fBGL_RGBA16I, GL_RGBA16I_EXT\fR T}:T{ \fBCL_RGBA, CL_SIGNED_INT16\fR T} T{ \fBGL_RGBA32I, GL_RGBA32I_EXT\fR T}:T{ \fBCL_RGBA, CL_SIGNED_INT32\fR T} T{ \fBGL_RGBA8UI, GL_RGBA8UI_EXT\fR T}:T{ \fBCL_RGBA, CL_UNSIGNED_INT8\fR T} T{ \fBGL_RGBA16UI, GL_RGBA16UI_EXT\fR T}:T{ \fBCL_RGBA, CL_UNSIGNED_INT16\fR T} T{ \fBGL_RGBA32UI, GL_RGBA32UI_EXT\fR T}:T{ \fBCL_RGBA, CL_UNSIGNED_INT32\fR T} T{ \fBGL_RGBA16F, GL_RGBA16F_ARB\fR T}:T{ \fBCL_RGBA, CL_HALF_FLOAT\fR T} T{ \fBGL_RGBA32F, GL_RGBA32F_ARB\fR T}:T{ \fBCL_RGBA, CL_FLOAT\fR T} .TE .sp 1 .SH "ERRORS" .PP Returns a valid non\-zero OpenCL image object and \fIerrcode_ret\fR is set to CL_SUCCESS if the image 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 \fIrenderbuffer\fR is not a GL renderbuffer object or if the width or height of \fIrenderbuffer\fR is zero\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} CL_INVALID_IMAGE_FORMAT_DESCRIPTOR if the OpenGL renderbuffer internal format does not map to a supported OpenCL image format\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} CL_INVALID_OPERATION if \fIrenderbuffer\fR is a multi\-sample GL renderbuffer object\&. .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), \fBcl_image_format\fR(3clc), \fBclRetainMemObject\fR(3clc), \fBclReleaseMemObject\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 53, section 9.7.4 - CL Image Objects -> GL Renderbuffers .RE