当前位置: 首页>>代码示例>>C++>>正文


C++ WebGLContext::ErrorImplementationBug方法代码示例

本文整理汇总了C++中WebGLContext::ErrorImplementationBug方法的典型用法代码示例。如果您正苦于以下问题:C++ WebGLContext::ErrorImplementationBug方法的具体用法?C++ WebGLContext::ErrorImplementationBug怎么用?C++ WebGLContext::ErrorImplementationBug使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在WebGLContext的用法示例。


在下文中一共展示了WebGLContext::ErrorImplementationBug方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: map

bool
TexUnpackSurface::TexOrSubImage(bool isSubImage, bool needsRespec, const char* funcName,
                                WebGLTexture* tex, TexImageTarget target, GLint level,
                                const webgl::DriverUnpackInfo* dstDUI, GLint xOffset,
                                GLint yOffset, GLint zOffset,
                                GLenum* const out_error) const
{
    WebGLContext* webgl = tex->mContext;

    WebGLTexelFormat srcFormat;
    uint8_t srcBPP;
    if (!GetFormatForSurf(mSurf, &srcFormat, &srcBPP)) {
        webgl->ErrorImplementationBug("%s: GetFormatForSurf failed for"
                                      " WebGLTexelFormat::%u.",
                                      funcName, uint32_t(mSurf->GetFormat()));
        return false;
    }

    gfx::DataSourceSurface::ScopedMap map(mSurf, gfx::DataSourceSurface::MapType::READ);
    if (!map.IsMapped())
        return false;

    const auto srcBytes = map.GetData();
    const auto srcStride = map.GetStride();

    // CPU conversion. (++numCopies)

    webgl->GenerateWarning("%s: Incurred CPU-side conversion, which is very slow.",
                           funcName);

    const uint8_t* uploadBytes;
    UniqueBuffer tempBuffer;
    if (!ConvertIfNeeded(webgl, funcName, srcBytes, srcStride, srcBPP, srcFormat,
                         dstDUI, &uploadBytes, &tempBuffer))
    {
        return false;
    }

    //////

    gl::GLContext* const gl = webgl->gl;
    MOZ_ALWAYS_TRUE( gl->MakeCurrent() );

    const auto curEffectiveRowLength = FallbackOnZero(webgl->mPixelStore_UnpackRowLength,
                                                      mWidth);

    const bool changeRowLength = (mRowLength != curEffectiveRowLength);
    if (changeRowLength) {
        MOZ_ASSERT(webgl->IsWebGL2());
        gl->fPixelStorei(LOCAL_GL_UNPACK_ROW_LENGTH, mRowLength);
    }

    *out_error = DoTexOrSubImage(isSubImage, gl, target.get(), level, dstDUI, xOffset,
                                 yOffset, zOffset, mWidth, mHeight, mDepth, uploadBytes);

    if (changeRowLength) {
        gl->fPixelStorei(LOCAL_GL_UNPACK_ROW_LENGTH, webgl->mPixelStore_UnpackRowLength);
    }

    return true;
}
开发者ID:subsevenx2001,项目名称:gecko-dev,代码行数:61,代码来源:TexUnpackBlob.cpp


注:本文中的WebGLContext::ErrorImplementationBug方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。