cl_mem
clCreateFromGLTexture3D
(
| cl_context context, |
| cl_mem_flags flags, | |
| GLenum texture_target, | |
| GLint miplevel, | |
| GLuint texture, | |
cl_int * errcode_ret) |
context
A valid OpenCL context created from an OpenGL 3D context.
flags
A bit-field that is used to specify usage information. Refer to
the table at
clCreateBuffer
for a description of flags. Only the valuesCL_MEM_READ_ONLY, CL_MEM_WRITE_ONLY and CL_MEM_READ_WRITE can be used.
texture_target
texture_target
is used only to define the image type of texture. Must be GL_TEXTURE_3D. No reference to a bound GL texture object
is made or implied by this parameter.
miplevel
The mipmap level to be used.
texture
The name of a GL 3D texture object. The texture object must
be a complete texture as
per OpenGL rules on texture completeness.
The texture
format and dimensions defined by
OpenGL for the specified miplevel of the texture will
be used to create the 3D image object.
Only GL texture objects with an internal format that maps 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 at
cl_image_format
can be used to create the 3D image object.
errcode_ret
Returns an appropriate error code as described below.
If errcode_ret is NULL, no error code is returned.
If the state of a GL texture object is modified through the GL API (e.g. the OpenGL functions
glTexImage2D or glTexImage3D,
or the values of the texture parameters GL_TEXTURE_BASE_LEVEL or
GL_TEXTURE_MAX_LEVEL are modified) while there exists a corresponding CL image object,
subsequent use of the CL image object will result in undefined behavior.
The
clRetainMemObject
and
clReleaseMemObject
functions can be used to retain and release
the image objects.
OpenCL 1.0 supports read-only 3D image memory objects. Writes to 3D image objects that are GL 3D textures
are supported if the OpenCL implementation supports the cl_khr_3d_image_writes extension. 3D images
are optional in the embedded profile. If 3D images are not supported by the OpenCL embedded profile, the
errcode_ret argument to clCreateFromGLTexture3D will return CL_INVALID_OPERATION.
Returns a valid non-zero OpenCL image object and errcode_ret 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 errcode_ret:
context
is not a valid context or was not created from a GL context.
.
flags are not valid or if value specified in
texture_target is not one of the values specified
in the description of texture_target.
miplevel is less
than the value of levelbase (for OpenGL
implementations) or zero (for OpenGL ES implementations); or greater than the value of
q (for both OpenGL and OpenGL ES).
levelbase and q
are defined for the texture in
section 3.8.10 (Texture Completeness)
of the OpenGL 2.1 specification and
section 3.7.10 of the OpenGL ES 2.0.
miplevel
is greater than zero
and the OpenGL implementation does not support creating from non-zero mipmap levels.
texture
is not a
GL texture object whose type matches
texture_target, if the specified miplevel of
texture is not defined,
or if the width or height
of the specified miplevel is zero.
Copyright © 2007-2009 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.