opengl: require support for fbos

It's effectively required already, as they're used everywhere
This commit is contained in:
Xaver Hugl 2024-02-27 21:28:00 +01:00
parent e763cd9eec
commit feeacf37db
9 changed files with 7 additions and 31 deletions

View file

@ -22,12 +22,10 @@ namespace KWin
void GLFramebuffer::initStatic()
{
if (GLPlatform::instance()->isGLES()) {
s_supported = true;
s_supportsPackedDepthStencil = hasGLVersion(3, 0) || hasGLExtension(QByteArrayLiteral("GL_OES_packed_depth_stencil"));
s_supportsDepth24 = hasGLVersion(3, 0) || hasGLExtension(QByteArrayLiteral("GL_OES_depth24"));
s_blitSupported = hasGLVersion(3, 0);
} else {
s_supported = hasGLVersion(3, 0) || hasGLExtension(QByteArrayLiteral("GL_ARB_framebuffer_object")) || hasGLExtension(QByteArrayLiteral("GL_EXT_framebuffer_object"));
s_supportsPackedDepthStencil = hasGLVersion(3, 0) || hasGLExtension(QByteArrayLiteral("GL_ARB_framebuffer_object")) || hasGLExtension(QByteArrayLiteral("GL_EXT_packed_depth_stencil"));
s_blitSupported = hasGLVersion(3, 0) || hasGLExtension(QByteArrayLiteral("GL_ARB_framebuffer_object")) || hasGLExtension(QByteArrayLiteral("GL_EXT_framebuffer_blit"));
}
@ -36,7 +34,6 @@ void GLFramebuffer::initStatic()
void GLFramebuffer::cleanup()
{
Q_ASSERT(s_fbos.isEmpty());
s_supported = false;
s_blitSupported = false;
}
@ -109,11 +106,6 @@ GLFramebuffer::GLFramebuffer(GLTexture *colorAttachment, Attachment attachment)
: m_size(colorAttachment->size())
, m_colorAttachment(colorAttachment)
{
if (!s_supported) {
qCCritical(KWIN_OPENGL) << "Framebuffer objects aren't supported!";
return;
}
GLuint prevFbo = 0;
if (const GLFramebuffer *current = currentFramebuffer()) {
prevFbo = current->handle();

View file

@ -82,10 +82,6 @@ public:
}
static void initStatic();
static bool supported()
{
return s_supported;
}
/**
* Returns the last bound framebuffer, or @c null if no framebuffer is current.
@ -138,7 +134,6 @@ private:
friend void KWin::cleanupGL();
static void cleanup();
inline static bool s_supported = false;
inline static bool s_supportsPackedDepthStencil = false;
inline static bool s_supportsDepth24 = false;
inline static bool s_blitSupported = false;

View file

@ -29,7 +29,6 @@ namespace KWin
// GLTexture
//****************************************
bool GLTexturePrivate::s_supportsFramebufferObjects = false;
bool GLTexturePrivate::s_supportsARGB32 = false;
bool GLTexturePrivate::s_supportsUnpack = false;
bool GLTexturePrivate::s_supportsTextureStorage = false;
@ -144,7 +143,6 @@ GLTexturePrivate::~GLTexturePrivate()
void GLTexturePrivate::initStatic()
{
if (!GLPlatform::instance()->isGLES()) {
s_supportsFramebufferObjects = hasGLVersion(3, 0) || hasGLExtension("GL_ARB_framebuffer_object") || hasGLExtension(QByteArrayLiteral("GL_EXT_framebuffer_object"));
s_supportsTextureStorage = hasGLVersion(4, 2) || hasGLExtension(QByteArrayLiteral("GL_ARB_texture_storage"));
s_supportsTextureSwizzle = hasGLVersion(3, 3) || hasGLExtension(QByteArrayLiteral("GL_ARB_texture_swizzle"));
// see https://www.opengl.org/registry/specs/ARB/texture_rg.txt
@ -153,7 +151,6 @@ void GLTexturePrivate::initStatic()
s_supportsARGB32 = true;
s_supportsUnpack = true;
} else {
s_supportsFramebufferObjects = true;
s_supportsTextureStorage = hasGLVersion(3, 0) || hasGLExtension(QByteArrayLiteral("GL_EXT_texture_storage"));
s_supportsTextureSwizzle = hasGLVersion(3, 0);
// see https://www.khronos.org/registry/gles/extensions/EXT/EXT_texture_rg.txt
@ -170,7 +167,6 @@ void GLTexturePrivate::initStatic()
void GLTexturePrivate::cleanup()
{
s_supportsFramebufferObjects = false;
s_supportsARGB32 = false;
if (s_fbo) {
glDeleteFramebuffers(1, &s_fbo);
@ -321,7 +317,7 @@ void GLTexture::bind()
void GLTexture::generateMipmaps()
{
if (d->m_canUseMipmaps && d->s_supportsFramebufferObjects) {
if (d->m_canUseMipmaps) {
glGenerateMipmap(d->m_target);
}
}
@ -423,7 +419,7 @@ GLenum GLTexture::internalFormat() const
void GLTexture::clear()
{
Q_ASSERT(d->m_owning);
if (!GLTexturePrivate::s_fbo && GLFramebuffer::supported() && GLPlatform::instance()->driver() != Driver_Catalyst) { // fail. -> bug #323065
if (!GLTexturePrivate::s_fbo && GLPlatform::instance()->driver() != Driver_Catalyst) { // fail. -> bug #323065
glGenFramebuffers(1, &GLTexturePrivate::s_fbo);
}
@ -553,11 +549,6 @@ QMatrix4x4 GLTexture::matrix(TextureCoordinateType type) const
return d->m_matrix[type];
}
bool GLTexture::framebufferObjectSupported()
{
return GLTexturePrivate::s_supportsFramebufferObjects;
}
bool GLTexture::supportsSwizzle()
{
return GLTexturePrivate::s_supportsTextureSwizzle;

View file

@ -112,8 +112,6 @@ public:
void generateMipmaps();
static bool framebufferObjectSupported();
/**
* Returns true if texture swizzle is supported, and false otherwise
*

View file

@ -58,7 +58,6 @@ public:
static void initStatic();
static bool s_supportsFramebufferObjects;
static bool s_supportsARGB32;
static bool s_supportsUnpack;
static bool s_supportsTextureStorage;

View file

@ -119,7 +119,8 @@ bool OpenGlContext::checkSupported() const
const bool supportsGLSL = m_isOpenglES || (hasOpenglExtension("GL_ARB_shader_objects") && hasOpenglExtension("GL_ARB_fragment_shader") && hasOpenglExtension("GL_ARB_vertex_shader"));
const bool supportsNonPowerOfTwoTextures = m_isOpenglES || hasOpenglExtension("GL_ARB_texture_non_power_of_two");
const bool supports3DTextures = !m_isOpenglES || hasVersion(Version(3, 0)) || hasOpenglExtension("GL_OES_texture_3D");
return supportsGLSL && supportsNonPowerOfTwoTextures && supports3DTextures;
const bool supportsFBOs = m_isOpenglES || hasVersion(Version(3, 0)) || hasOpenglExtension("GL_ARB_framebuffer_object") || hasOpenglExtension(QByteArrayLiteral("GL_EXT_framebuffer_object"));
return supportsGLSL && supportsNonPowerOfTwoTextures && supports3DTextures && supportsFBOs;
}
void OpenGlContext::setShaderManager(ShaderManager *manager)

View file

@ -297,7 +297,7 @@ bool ContrastEffect::enabledByDefault()
bool ContrastEffect::supported()
{
bool supported = effects->isOpenGLCompositing() && GLFramebuffer::supported();
bool supported = effects->isOpenGLCompositing();
if (supported) {
int maxTexSize;

View file

@ -371,7 +371,7 @@ bool BlurEffect::enabledByDefault()
bool BlurEffect::supported()
{
return effects->isOpenGLCompositing() && GLFramebuffer::supported() && GLFramebuffer::blitSupported();
return effects->isOpenGLCompositing() && GLFramebuffer::blitSupported();
}
bool BlurEffect::decorationSupportsBlurBehind(const EffectWindow *w) const

View file

@ -85,7 +85,7 @@ static void convertFromGLImage(QImage &img, int w, int h, const OutputTransform
bool ScreenShotEffect::supported()
{
return effects->isOpenGLCompositing() && GLFramebuffer::supported();
return effects->isOpenGLCompositing();
}
ScreenShotEffect::ScreenShotEffect()