mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-06 02:18:05 +08:00
based on 'clgl-fork' branch from https://github.com/kallaballa/compute-runtime EGL headers taken from https://github.com/KhronosGroup/EGL-Registry revision: 57b4876de0f33677ece92dd9de0ef105ce69139d Related-To: NEO-3599 Fixes https://github.com/intel/compute-runtime/issues/166 Co-authored-by: Jacek Danecki <jacek.danecki@intel.com> Co-authored-by: Amir Hassan <amir@viel-zu.org> Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
47 lines
1.8 KiB
C++
47 lines
1.8 KiB
C++
/*
|
|
* Copyright (C) 2018-2023 Intel Corporation
|
|
*
|
|
* SPDX-License-Identifier: MIT
|
|
*
|
|
*/
|
|
|
|
#pragma once
|
|
#include "opencl/extensions/public/cl_gl_private_intel.h"
|
|
#include "opencl/source/sharings/gl/gl_sharing.h"
|
|
|
|
#include "CL/cl_gl.h"
|
|
|
|
namespace NEO {
|
|
class Context;
|
|
class Image;
|
|
class GlTexture : GlSharing {
|
|
public:
|
|
static Image *createSharedGlTexture(Context *context, cl_mem_flags flags, cl_GLenum target, cl_GLint miplevel, cl_GLuint texture,
|
|
cl_int *errcodeRet);
|
|
void synchronizeObject(UpdateData &updateData) override;
|
|
cl_int getGlTextureInfo(cl_gl_texture_info paramName, size_t paramValueSize, void *paramValue, size_t *paramValueSizeRet) const;
|
|
cl_GLint getMiplevel() const { return miplevel; }
|
|
CL_GL_RESOURCE_INFO *getTextureInfo() { return &textureInfo; }
|
|
cl_GLenum getTarget() const { return target; }
|
|
|
|
static bool setClImageFormat(int glFormat, cl_image_format &clImgFormat);
|
|
static cl_mem_object_type getClMemObjectType(cl_GLenum glType);
|
|
static cl_gl_object_type getClGlObjectType(cl_GLenum glType);
|
|
static cl_GLenum getBaseTargetType(cl_GLenum target);
|
|
|
|
protected:
|
|
GlTexture(GLSharingFunctions *sharingFunctions, unsigned int glObjectType, unsigned int glObjectId, CL_GL_RESOURCE_INFO texInfo,
|
|
cl_GLenum target, cl_GLint miplevel)
|
|
: GlSharing(sharingFunctions, glObjectType, glObjectId), target(target), miplevel(miplevel), textureInfo(texInfo){};
|
|
|
|
static uint32_t getClObjectType(cl_GLenum glType, bool returnClGlObjectType);
|
|
|
|
void releaseResource(MemObj *memObject, uint32_t rootDeviceIndex) override;
|
|
void resolveGraphicsAllocationChange(osHandle currentSharedHandle, UpdateData *updateData) override;
|
|
|
|
cl_GLenum target;
|
|
cl_GLint miplevel;
|
|
CL_GL_RESOURCE_INFO textureInfo;
|
|
};
|
|
} // namespace NEO
|