示例#1
0
文件: testgpu.cpp 项目: derric/libavg
    void runMipmapTest(OGLMemoryMode memoryMode, const string& sFName)
    {
        cerr << "    Testing mipmap support, " << sFName << ", " << 
                oglMemoryMode2String(memoryMode) << endl;
        BitmapPtr pOrigBmp = loadTestBmp(sFName);
        GLContextManager* pCM = GLContextManager::get();
        MCTexturePtr pTex = pCM->createTextureFromBmp(pOrigBmp, true);
        pCM->uploadData();
        pTex->generateMipmaps();

        if (GLContext::getCurrent()->isGLES()) {
            // GLES doesn't support attaching texture mipmap levels other than 0 to
            // FBOs, so moveTextureToBmp() will fail. Skip result image comparison.
            return;
        }
        BitmapPtr pResultBmp = pTex->moveTextureToBmp(1);
        IntPoint newSize(pOrigBmp->getSize()/2);
        TEST(pResultBmp->getSize() == newSize);
        FilterResizeBilinear resizer(newSize);
        BitmapPtr pBaselineBmp = resizer.apply(pOrigBmp);
        string sName;
        if (memoryMode == MM_PBO) {
            sName = "pbo-mipmap";
        } else {
            sName = "ogl-mipmap";
        }
        testEqual(*pResultBmp, *pBaselineBmp, sName, 7, 15);
    }
示例#2
0
文件: testgpu.cpp 项目: derric/libavg
 void runTests() 
 {
     BitmapPtr pOrigBmp = loadTestBmp("rgb24-64x64");
     GLContextManager* pCM = GLContextManager::get();
     MCTexturePtr pTex = pCM->createTextureFromBmp(pOrigBmp);
     pCM->uploadData();
     GPURGB2YUVFilter f(pOrigBmp->getSize());
     f.apply(pTex->getCurTex());
     BitmapPtr pResultBmp = f.getResults();
     pResultBmp = convertYUVX444ToRGB(pResultBmp);
     testEqual(*pResultBmp, *pOrigBmp, "RGB2YUV", 1, 2);
 }
示例#3
0
文件: testgpu.cpp 项目: derric/libavg
    void runCompressionTest(OGLMemoryMode memoryMode, const string& sFName)
    {
        cerr << "    Testing B5G6R5 compression, " << sFName << ", " << 
                oglMemoryMode2String(memoryMode) << endl;
        BitmapPtr pFileBmp = loadTestBmp(sFName);
        BitmapPtr pOrigBmp(new Bitmap(pFileBmp->getSize(), B5G6R5));
        pOrigBmp->copyPixels(*pFileBmp);
        GLContextManager* pCM = GLContextManager::get();
        MCTexturePtr pTex = pCM->createTextureFromBmp(pOrigBmp);
        pCM->uploadData();

        BitmapPtr pDestBmp = pTex->moveTextureToBmp();
    }
示例#4
0
文件: testgpu.cpp 项目: derric/libavg
 void runImageTest(bool bPOT, OGLMemoryMode memoryMode, const string& sFName)
 {
     string sResultFName = sFName + "-" + oglMemoryMode2String(memoryMode) + "-";
     if (bPOT) {
         sResultFName += "pot";
     } else {
         sResultFName += "npot";
     }
     cerr << "    Testing " << sResultFName << endl;
     BitmapPtr pOrigBmp = loadTestBmp(sFName);
     {
         GLContextManager* pCM = GLContextManager::get();
         MCTexturePtr pTex = pCM->createTextureFromBmp(pOrigBmp, false,
                 GL_CLAMP_TO_EDGE, GL_CLAMP_TO_EDGE, bPOT, 0);
         pCM->uploadData();
         BitmapPtr pDestBmp = pTex->moveTextureToBmp();
         testEqual(*pDestBmp, *pOrigBmp, sResultFName+"-move", 0.01, 0.1);
     }
 }