本文整理汇总了C++中WebGLContext::GeneratePerfWarning方法的典型用法代码示例。如果您正苦于以下问题:C++ WebGLContext::GeneratePerfWarning方法的具体用法?C++ WebGLContext::GeneratePerfWarning怎么用?C++ WebGLContext::GeneratePerfWarning使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WebGLContext
的用法示例。
在下文中一共展示了WebGLContext::GeneratePerfWarning方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: scopedFB
//.........这里部分代码省略.........
fallbackReason = "non-zero UNPACK_SKIP_* not yet supported";
break;
}
const auto fnHasPremultMismatch = [&]() {
if (mSrcAlphaType == gfxAlphaType::Opaque)
return false;
const bool srcIsPremult = (mSrcAlphaType == gfxAlphaType::Premult);
const auto& dstIsPremult = webgl->mPixelStore_PremultiplyAlpha;
if (srcIsPremult == dstIsPremult)
return false;
if (dstIsPremult) {
fallbackReason = "UNPACK_PREMULTIPLY_ALPHA_WEBGL is not true";
} else {
fallbackReason = "UNPACK_PREMULTIPLY_ALPHA_WEBGL is not false";
}
return true;
};
if (fnHasPremultMismatch())
break;
if (dui->unpackFormat != LOCAL_GL_RGB && dui->unpackFormat != LOCAL_GL_RGBA) {
fallbackReason = "`format` is not RGB or RGBA";
break;
}
if (dui->unpackType != LOCAL_GL_UNSIGNED_BYTE) {
fallbackReason = "`type` is not UNSIGNED_BYTE";
break;
}
gl::ScopedFramebuffer scopedFB(gl);
gl::ScopedBindFramebuffer bindFB(gl, scopedFB.FB());
{
gl::GLContext::LocalErrorScope errorScope(*gl);
gl->fFramebufferTexture2D(LOCAL_GL_FRAMEBUFFER, LOCAL_GL_COLOR_ATTACHMENT0,
target.get(), tex->mGLName, level);
if (errorScope.GetError()) {
fallbackReason = "bug: failed to attach to FB for blit";
break;
}
}
const GLenum status = gl->fCheckFramebufferStatus(LOCAL_GL_FRAMEBUFFER);
if (status != LOCAL_GL_FRAMEBUFFER_COMPLETE) {
fallbackReason = "bug: failed to confirm FB for blit";
break;
}
const gfx::IntSize destSize(mWidth, mHeight);
const auto dstOrigin = (webgl->mPixelStore_FlipY ? gl::OriginPos::TopLeft
: gl::OriginPos::BottomLeft);
if (!gl->BlitHelper()->BlitImageToFramebuffer(mImage, destSize, scopedFB.FB(),
dstOrigin))
{
fallbackReason = "likely bug: failed to blit";
break;
}
// Blitting was successful, so we're done!
*out_error = 0;
return true;
} while (false);
const nsPrintfCString perfMsg("%s: Failed to hit GPU-copy fast-path: %s (src type %u)",
funcName, fallbackReason, uint32_t(mImage->GetFormat()));
if (webgl->mPixelStore_RequireFastPath) {
webgl->ErrorInvalidOperation("%s", perfMsg.BeginReading());
return false;
}
webgl->GeneratePerfWarning("%s Falling back to CPU upload.",
perfMsg.BeginReading());
const RefPtr<gfx::SourceSurface> surf = mImage->GetAsSourceSurface();
RefPtr<gfx::DataSourceSurface> dataSurf;
if (surf) {
// WARNING: OSX can lose our MakeCurrent here.
dataSurf = surf->GetDataSurface();
}
if (!dataSurf) {
webgl->ErrorOutOfMemory("%s: GetAsSourceSurface or GetDataSurface failed after"
" blit failed for TexUnpackImage.",
funcName);
return false;
}
const TexUnpackSurface surfBlob(webgl, target, mWidth, mHeight, mDepth, dataSurf,
mSrcAlphaType);
return surfBlob.TexOrSubImage(isSubImage, needsRespec, funcName, tex, target, level,
dui, xOffset, yOffset, zOffset, pi, out_error);
}