Debian Codegraph @

opencl/source/sharings/gl/gl_texture.h

raw
1 /*
2 * Copyright (C) 2018-2023 Intel Corporation
3 *
4 * SPDX-License-Identifier: MIT
5 *
6 */
7
8 #pragma once
9 #include "opencl/extensions/public/cl_gl_private_intel.h"
10 #include "opencl/source/sharings/gl/gl_sharing.h"
11
12 #include "CL/cl_gl.h"
13
14 namespace NEO {
15 class Context;
16 class Image;
17 class GlTexture : GlSharing {
18 public:
19 static Image *createSharedGlTexture(Context *context, cl_mem_flags flags, cl_GLenum target, cl_GLint miplevel, cl_GLuint texture,
20 cl_int *errcodeRet);
21 void synchronizeObject(UpdateData &updateData) override;
22 cl_int getGlTextureInfo(cl_gl_texture_info paramName, size_t paramValueSize, void *paramValue, size_t *paramValueSizeRet) const;
23 cl_GLint getMiplevel() const { return miplevel; }
24 CL_GL_RESOURCE_INFO *getTextureInfo() { return &textureInfo; }
25 cl_GLenum getTarget() const { return target; }
26
27 static bool setClImageFormat(int glFormat, cl_image_format &clImgFormat);
28 static cl_mem_object_type getClMemObjectType(cl_GLenum glType);
29 static cl_gl_object_type getClGlObjectType(cl_GLenum glType);
30 static cl_GLenum getBaseTargetType(cl_GLenum target);
31
32 protected:
33 GlTexture(GLSharingFunctions *sharingFunctions, unsigned int glObjectType, unsigned int glObjectId, CL_GL_RESOURCE_INFO texInfo,
34 cl_GLenum target, cl_GLint miplevel)
35 : GlSharing(sharingFunctions, glObjectType, glObjectId), target(target), miplevel(miplevel), textureInfo(texInfo){};
36
37 static uint32_t getClObjectType(cl_GLenum glType, bool returnClGlObjectType);
38
39 void releaseResource(MemObj *memObject, uint32_t rootDeviceIndex) override;
40 void resolveGraphicsAllocationChange(osHandle currentSharedHandle, UpdateData *updateData) override;
41
42 cl_GLenum target;
43 cl_GLint miplevel;
44 CL_GL_RESOURCE_INFO textureInfo;
45 };
46 } // namespace NEO