KWin
Loading...
Searching...
No Matches
src
opengl
eglimagetexture.cpp
Go to the documentation of this file.
1
/*
2
KWin - the KDE window manager
3
This file is part of the KDE project.
4
5
SPDX-FileCopyrightText: 2020 Aleix Pol Gonzalez <aleixpol@kde.org>
6
7
SPDX-License-Identifier: GPL-2.0-or-later
8
*/
9
10
#include "
eglimagetexture.h
"
11
#include "
egldisplay.h
"
12
#include "
opengl/gltexture_p.h
"
13
14
#include <QDebug>
15
#include <epoxy/egl.h>
16
17
namespace
KWin
18
{
19
20
EGLImageTexture::EGLImageTexture
(
EglDisplay
*display, EGLImage image, uint textureId,
int
internalFormat
,
const
QSize &size, uint32_t target)
21
:
GLTexture
(target, textureId,
internalFormat
, size, 1, true,
OutputTransform
::FlipY)
22
, m_image(image)
23
, m_display(display)
24
{
25
}
26
27
EGLImageTexture::~EGLImageTexture
()
28
{
29
eglDestroyImageKHR(
m_display
->
handle
(),
m_image
);
30
}
31
32
std::shared_ptr<EGLImageTexture>
EGLImageTexture::create
(
EglDisplay
*display,
EGLImageKHR
image,
int
internalFormat
,
const
QSize &size,
bool
externalOnly)
33
{
34
if
(image == EGL_NO_IMAGE) {
35
return
nullptr
;
36
}
37
GLuint
texture
= 0;
38
glGenTextures(1, &
texture
);
39
if
(!
texture
) {
40
return
nullptr
;
41
}
42
const
uint32_t
target
= externalOnly ? GL_TEXTURE_EXTERNAL_OES : GL_TEXTURE_2D;
43
glBindTexture(
target
,
texture
);
44
glEGLImageTargetTexture2DOES(
target
, image);
45
glBindTexture(
target
, 0);
46
return
std::make_shared<EGLImageTexture>(display, image,
texture
,
internalFormat
,
size
,
target
);
47
}
48
49
}
// namespace KWin
KWin::EGLImageTexture::m_image
EGLImageKHR m_image
Definition
eglimagetexture.h:30
KWin::EGLImageTexture::~EGLImageTexture
~EGLImageTexture() override
Definition
eglimagetexture.cpp:27
KWin::EGLImageTexture::EGLImageTexture
EGLImageTexture(EglDisplay *display, EGLImageKHR image, uint textureId, int internalFormat, const QSize &size, uint32_t target)
Definition
eglimagetexture.cpp:20
KWin::EGLImageTexture::m_display
EglDisplay *const m_display
Definition
eglimagetexture.h:31
KWin::EglDisplay
Definition
egldisplay.h:26
KWin::EglDisplay::handle
::EGLDisplay handle() const
Definition
egldisplay.cpp:98
KWin::GLTexture
Definition
gltexture.h:40
KWin::GLTexture::size
QSize size() const
Definition
gltexture.cpp:186
KWin::GLTexture::texture
GLuint texture() const
Definition
gltexture.cpp:403
KWin::GLTexture::internalFormat
GLenum internalFormat() const
Definition
gltexture.cpp:418
KWin::GLTexture::create
bool create()
Definition
gltexture.cpp:111
KWin::GLTexture::target
GLenum target() const
Definition
gltexture.cpp:408
KWin::OutputTransform
Definition
output.h:37
egldisplay.h
eglimagetexture.h
EGLImageKHR
void * EGLImageKHR
Definition
eglimagetexture.h:14
gltexture_p.h
KWin
Definition
activation_test.cpp:20
KWin::internalFormat
GLenum internalFormat
Definition
gltexture.cpp:48
Generated on Sat Feb 17 2024 01:42:09 for KWin by
1.10.0