diff options
-rw-r--r-- | src/adaptationlayers/qsgeglfsthreadedtexturemanager.cpp | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/src/adaptationlayers/qsgeglfsthreadedtexturemanager.cpp b/src/adaptationlayers/qsgeglfsthreadedtexturemanager.cpp index b868979..9a285eb 100644 --- a/src/adaptationlayers/qsgeglfsthreadedtexturemanager.cpp +++ b/src/adaptationlayers/qsgeglfsthreadedtexturemanager.cpp @@ -107,8 +107,6 @@ static inline void qgl_byteSwapImage(QImage &img) void QSGEglFSThreadedTextureManager::uploadInThread(TextureReference *texture, const QImage &im, UploadHints hints) { - while (glGetError() != GL_NO_ERROR) printf("bust...\n"); - #ifdef DO_TIMING QTime time; time.start(); @@ -126,17 +124,12 @@ void QSGEglFSThreadedTextureManager::uploadInThread(TextureReference *texture, c int bpl = image.bytesPerLine(); const uchar *bits = image.constBits(); - // This should not be neccesary... - if (d->uploadsScanlines) - makeThreadContextCurrent(); - GLuint id; glGenTextures(1, &id); glBindTexture(GL_TEXTURE_2D, id); if (d->uploadsScanlines) { glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); - glBindTexture(GL_TEXTURE_2D, id); // Should also not be required, but it fails without... driver bug, for sure.. for (int y=0; y<h; ++y) { glTexSubImage2D(GL_TEXTURE_2D, 0, 0, y, w, 1, GL_RGBA, GL_UNSIGNED_BYTE, y * bpl + bits); if (glGetError() != GL_NO_ERROR) { @@ -147,18 +140,22 @@ void QSGEglFSThreadedTextureManager::uploadInThread(TextureReference *texture, c } } else { glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, bits); + if (glGetError() != GL_NO_ERROR) { + qWarning("ERROR: failed to upload chunk...\n"); + } } glBindTexture(GL_TEXTURE_2D, 0); #ifdef DO_TIMING int time_upload = time.elapsed(); - printf("EGLFS Threaded upload: byteSwap: %d ms, upload: %d ms\n", + printf("EGLFS Threaded upload: byteSwap: %d ms, upload: %d ms, id: %d\n", time_byteswap, - time_upload); + time_upload, + id); #endif - + texture->setAlphaChannel(image.hasAlphaChannel()); texture->setOwnsTexture(true); texture->setTextureId(id); texture->setTextureSize(image.size()); |