Port libkwinglutils from KDebug to QDebug

And another lib doesn't need kde4support any more.
master
Martin Gräßlin 11 years ago
parent 48e8121ab9
commit add219d5bc

@ -59,7 +59,7 @@ macro( KWIN4_ADD_GLUTILS_BACKEND name glinclude )
include_directories(${OPENGLES_EGL_INCLUDE_DIR})
endif()
kde4_add_library(${name} SHARED ${kwin_GLUTILSLIB_SRCS})
target_link_libraries(${name} ${KDE4Support_LIBRARIES} ${kwineffects_QT_LIBS} ${kwineffects_XLIB_LIBS} ${kwineffects_XCB_LIBS} kwineffects)
target_link_libraries(${name} ${kwineffects_QT_LIBS} ${kwineffects_XLIB_LIBS} ${kwineffects_XCB_LIBS} kwineffects)
if(OPENGL_EGL_FOUND)
target_link_libraries(${name} ${OPENGLES_EGL_LIBRARY})
endif()

@ -24,13 +24,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "kwinglplatform.h"
#include "kwinglutils.h"
#include <KDebug>
#include <QByteArrayMatcher>
#include <QDBusConnection>
#include <QDBusError>
#include <QDBusPendingCall>
#include <QDBusPendingCallWatcher>
#include <QDebug>
#include <QPair>
#include <QVector3D>
@ -102,7 +101,7 @@ ColorServerInterface::~ColorServerInterface()
uint ColorServerInterface::versionInfo() const
{
if (!m_versionInfoUpdated)
kWarning(1212) << "Version info not updated";
qWarning() << "Version info not updated";
return m_versionInfo;
}
@ -155,10 +154,10 @@ QDBusPendingReply< RegionalClutMap > ColorServerInterface::getRegionCluts()
void ColorServerInterface::callFinishedSlot(QDBusPendingCallWatcher *watcher)
{
if (watcher == m_versionInfoWatcher) {
kDebug(1212) << "Version info call finished";
qDebug() << "Version info call finished";
QDBusPendingReply< uint > reply = *watcher;
if (reply.isError()) {
kWarning(1212) << reply.error();
qWarning() << reply.error();
if (!m_signaledFail)
emit updateFailed();
m_signaledFail = true;
@ -170,10 +169,10 @@ void ColorServerInterface::callFinishedSlot(QDBusPendingCallWatcher *watcher)
}
if (watcher == m_outputClutsWatcher) {
kDebug(1212) << "Output cluts call finished";
qDebug() << "Output cluts call finished";
QDBusPendingReply< ClutList > reply = *watcher;
if (reply.isError()) {
kWarning(1212) << reply.error();
qWarning() << reply.error();
if (!m_signaledFail)
emit updateFailed();
m_signaledFail = true;
@ -185,10 +184,10 @@ void ColorServerInterface::callFinishedSlot(QDBusPendingCallWatcher *watcher)
}
if (watcher == m_regionClutsWatcher) {
kDebug(1212) << "Region cluts call finished";
qDebug() << "Region cluts call finished";
QDBusPendingReply< RegionalClutMap > reply = *watcher;
if (reply.isError()) {
kWarning(1212) << reply.error();
qWarning() << reply.error();
if (!m_signaledFail)
emit updateFailed();
m_signaledFail = true;
@ -202,7 +201,7 @@ void ColorServerInterface::callFinishedSlot(QDBusPendingCallWatcher *watcher)
if (m_versionInfoUpdated &&
m_outputClutsUpdated &&
m_regionClutsUpdated) {
kDebug(1212) << "Update succeeded";
qDebug() << "Update succeeded";
emit updateSucceeded();
}
}
@ -280,14 +279,14 @@ bool ColorCorrection::setEnabled(bool enabled)
return true;
if (enabled && d->m_hasError) {
kError(1212) << "cannot enable color correction because of a previous error";
qCritical() << "cannot enable color correction because of a previous error";
return false;
}
#ifdef KWIN_HAVE_OPENGLES
const GLPlatform *gl = GLPlatform::instance();
if (enabled && gl->isGLES() && glTexImage3D == 0) {
kError(1212) << "color correction is not supported on OpenGL ES without OES_texture_3D";
qCritical() << "color correction is not supported on OpenGL ES without OES_texture_3D";
d->m_hasError = true;
return false;
}
@ -296,14 +295,14 @@ bool ColorCorrection::setEnabled(bool enabled)
if (enabled) {
// Update all profiles and regions
d->m_csi->update();
kDebug(1212) << "color correction will be enabled after contacting KolorManager";
qDebug() << "color correction will be enabled after contacting KolorManager";
d->m_duringEnablingPhase = true;
// d->m_enabled will be set to true in colorServerUpdateSucceededSlot()
} else {
d->deleteCCTextures();
d->m_enabled = false;
GLShader::sColorCorrect = false;
kDebug(1212) << "color correction has been disabled";
qDebug() << "color correction has been disabled";
// Reload all shaders
ShaderManager::cleanup();
@ -322,7 +321,7 @@ void ColorCorrection::setupForOutput(int screen)
GLShader *shader = ShaderManager::instance()->getBoundShader();
if (!shader) {
kError(1212) << "no bound shader for color correction setup";
qCritical() << "no bound shader for color correction setup";
d->m_hasError = true;
emit errorOccured();
return;
@ -335,14 +334,14 @@ void ColorCorrection::setupForOutput(int screen)
}
if (!shader->setUniform(GLShader::ColorCorrectionLookupTextureUnit, d->m_ccTextureUnit)) {
kError(1212) << "unable to set uniform for the color correction lookup texture";
qCritical() << "unable to set uniform for the color correction lookup texture";
d->m_hasError = true;
emit errorOccured();
return;
}
if (!d->setupCCTextures()) {
kError(1212) << "unable to setup color correction textures";
qCritical() << "unable to setup color correction textures";
d->m_hasError = true;
emit errorOccured();
return;
@ -552,7 +551,7 @@ QByteArray ColorCorrection::prepareFragmentShader(const QByteArray &sourceCode)
bool ColorCorrectionPrivate::setupCCTextures()
{
if (!m_enabled || m_hasError) {
kWarning(1212) << "Color correction not enabled or an error occurred, refusing to set up textures";
qWarning() << "Color correction not enabled or an error occurred, refusing to set up textures";
return false;
}
@ -560,7 +559,7 @@ bool ColorCorrectionPrivate::setupCCTextures()
if (!m_dummyCCTexture) {
glGenTextures(1, &m_dummyCCTexture);
if (!setupCCTexture(m_dummyCCTexture, m_dummyClut)) {
kError(1212) << "unable to setup dummy color correction texture";
qCritical() << "unable to setup dummy color correction texture";
m_dummyCCTexture = 0;
return false;
}
@ -570,7 +569,7 @@ bool ColorCorrectionPrivate::setupCCTextures()
// Setup actual color correction textures
if (m_outputCCTextures.isEmpty() && !m_outputCluts->isEmpty()) {
kDebug(1212) << "setting up output color correction textures";
qDebug() << "setting up output color correction textures";
const int outputCount = m_outputCluts->size();
m_outputCCTextures.resize(outputCount);
@ -578,7 +577,7 @@ bool ColorCorrectionPrivate::setupCCTextures()
for (int i = 0; i < outputCount; ++i)
if (!setupCCTexture(m_outputCCTextures[i], m_outputCluts->at(i))) {
kError(1212) << "unable to set up color correction texture for output" << i;
qCritical() << "unable to set up color correction texture for output" << i;
success = false;
}
}
@ -609,7 +608,7 @@ bool ColorCorrectionPrivate::deleteCCTextures()
bool ColorCorrectionPrivate::setupCCTexture(GLuint texture, const Clut& clut)
{
if ((uint) clut.size() != CLUT_ELEMENT_COUNT) {
kError(1212) << "cannot setup CC texture: invalid color lookup table";
qCritical() << "cannot setup CC texture: invalid color lookup table";
return false;
}
@ -648,7 +647,7 @@ void ColorCorrectionPrivate::colorServerUpdateSucceededSlot()
{
Q_Q(ColorCorrection);
kDebug(1212) << "Update of color profiles succeeded";
qDebug() << "Update of color profiles succeeded";
// Force the color correction textures to be recreated
deleteCCTextures();
@ -658,15 +657,15 @@ void ColorCorrectionPrivate::colorServerUpdateSucceededSlot()
m_duringEnablingPhase = false;
m_enabled = true;
GLShader::sColorCorrect = true;
kDebug(1212) << "Color correction has been enabled";
qDebug() << "Color correction has been enabled";
// Reload all shaders
ShaderManager::cleanup();
if (!ShaderManager::instance()->isValid()) {
kError(1212) << "Shader reinitialization failed, possible compile problems with the shaders "
qCritical() << "Shader reinitialization failed, possible compile problems with the shaders "
"altered for color-correction";
m_hasError = true;
kDebug(1212) << "Color correction has been disabled due to shader issues";
qDebug() << "Color correction has been disabled due to shader issues";
m_enabled = false;
GLShader::sColorCorrect = false;
ShaderManager::cleanup();
@ -683,7 +682,7 @@ void ColorCorrectionPrivate::colorServerUpdateFailedSlot()
m_duringEnablingPhase = false;
kError(1212) << "Update of color profiles failed";
qCritical() << "Update of color profiles failed";
m_hasError = true;
emit q->errorOccured();
}

@ -29,10 +29,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "kwineffects.h"
#include "kwinglplatform.h"
#include "kdebug.h"
#include <KDE/KConfig>
#include <KDE/KConfigGroup>
#include <QDebug>
#include <QPixmap>
#include <QImage>
#include <QHash>
@ -183,7 +183,7 @@ bool checkGLError(const char* txt)
GLenum err = glGetError();
bool hasError = false;
while (err != GL_NO_ERROR) {
kWarning(1212) << "GL error (" << txt << "): " << formatGLError(err);
qWarning() << "GL error (" << txt << "): " << formatGLError(err);
hasError = true;
err = glGetError();
}
@ -311,14 +311,14 @@ bool GLShader::loadFromFiles(const QString &vertexFile, const QString &fragmentF
{
QFile vf(vertexFile);
if (!vf.open(QIODevice::ReadOnly)) {
kError(1212) << "Couldn't open" << vertexFile << "for reading!" << endl;
qCritical() << "Couldn't open" << vertexFile << "for reading!" << endl;
return false;
}
const QByteArray vertexSource = vf.readAll();
QFile ff(fragmentFile);
if (!ff.open(QIODevice::ReadOnly)) {
kError(1212) << "Couldn't open" << fragmentFile << "for reading!" << endl;
qCritical() << "Couldn't open" << fragmentFile << "for reading!" << endl;
return false;
}
const QByteArray fragmentSource = ff.readAll();
@ -345,10 +345,10 @@ bool GLShader::link()
glGetProgramiv(mProgram, GL_LINK_STATUS, &status);
if (status == 0) {
kError(1212) << "Failed to link shader:" << endl << log << endl;
qCritical() << "Failed to link shader:" << endl << log << endl;
mValid = false;
} else if (length > 0) {
kDebug(1212) << "Shader link log:" << log;
qDebug() << "Shader link log:" << log;
}
return mValid;
@ -404,9 +404,9 @@ bool GLShader::compile(GLuint program, GLenum shaderType, const QByteArray &sour
if (status == 0) {
const char *typeName = (shaderType == GL_VERTEX_SHADER ? "vertex" : "fragment");
kError(1212) << "Failed to compile" << typeName << "shader:" << endl << log << endl;
qCritical() << "Failed to compile" << typeName << "shader:" << endl << log << endl;
} else if (length > 0)
kDebug(1212) << "Shader compile log:" << log;
qDebug() << "Shader compile log:" << log;
if (status != 0)
glAttachShader(program, shader);
@ -420,7 +420,7 @@ bool GLShader::load(const QByteArray &vertexSource, const QByteArray &fragmentSo
#ifndef KWIN_HAVE_OPENGLES
// Make sure shaders are actually supported
if (!GLPlatform::instance()->supports(GLSL) || GLPlatform::instance()->supports(LimitedNPOT)) {
kError(1212) << "Shaders are not supported";
qCritical() << "Shaders are not supported";
return false;
}
#endif
@ -1040,7 +1040,7 @@ GLRenderTarget::GLRenderTarget(const GLTexture& color)
if (sSupported && !mTexture.isNull()) {
initFBO();
} else
kError(1212) << "Render targets aren't supported!" << endl;
qCritical() << "Render targets aren't supported!" << endl;
}
GLRenderTarget::~GLRenderTarget()
@ -1053,7 +1053,7 @@ GLRenderTarget::~GLRenderTarget()
bool GLRenderTarget::enable()
{
if (!valid()) {
kError(1212) << "Can't enable invalid render target!" << endl;
qCritical() << "Can't enable invalid render target!" << endl;
return false;
}
@ -1067,7 +1067,7 @@ bool GLRenderTarget::enable()
bool GLRenderTarget::disable()
{
if (!valid()) {
kError(1212) << "Can't disable invalid render target!" << endl;
qCritical() << "Can't disable invalid render target!" << endl;
return false;
}
@ -1116,14 +1116,14 @@ void GLRenderTarget::initFBO()
#if DEBUG_GLRENDERTARGET
GLenum err = glGetError();
if (err != GL_NO_ERROR)
kError(1212) << "Error status when entering GLRenderTarget::initFBO: " << formatGLError(err);
qCritical() << "Error status when entering GLRenderTarget::initFBO: " << formatGLError(err);
#endif
glGenFramebuffers(1, &mFramebuffer);
#if DEBUG_GLRENDERTARGET
if ((err = glGetError()) != GL_NO_ERROR) {
kError(1212) << "glGenFramebuffers failed: " << formatGLError(err);
qCritical() << "glGenFramebuffers failed: " << formatGLError(err);
return;
}
#endif
@ -1132,7 +1132,7 @@ void GLRenderTarget::initFBO()
#if DEBUG_GLRENDERTARGET
if ((err = glGetError()) != GL_NO_ERROR) {
kError(1212) << "glBindFramebuffer failed: " << formatGLError(err);
qCritical() << "glBindFramebuffer failed: " << formatGLError(err);
glDeleteFramebuffers(1, &mFramebuffer);
return;
}
@ -1143,7 +1143,7 @@ void GLRenderTarget::initFBO()
#if DEBUG_GLRENDERTARGET
if ((err = glGetError()) != GL_NO_ERROR) {
kError(1212) << "glFramebufferTexture2D failed: " << formatGLError(err);
qCritical() << "glFramebufferTexture2D failed: " << formatGLError(err);
glBindFramebuffer(GL_FRAMEBUFFER, 0);
glDeleteFramebuffers(1, &mFramebuffer);
return;
@ -1157,9 +1157,9 @@ void GLRenderTarget::initFBO()
if (status != GL_FRAMEBUFFER_COMPLETE) {
// We have an incomplete framebuffer, consider it invalid
if (status == 0)
kError(1212) << "glCheckFramebufferStatus failed: " << formatGLError(glGetError());
qCritical() << "glCheckFramebufferStatus failed: " << formatGLError(glGetError());
else
kError(1212) << "Invalid framebuffer status: " << formatFramebufferStatus(status);
qCritical() << "Invalid framebuffer status: " << formatFramebufferStatus(status);
glDeleteFramebuffers(1, &mFramebuffer);
return;
}

Loading…
Cancel
Save