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


C++ GrContext::getTestTarget方法代码示例

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


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

示例1: SkDebugf

static const GrGLContext* get_gl_context(SkCanvas* canvas) {
    // This bench exclusively tests GL calls directly
    if (NULL == canvas->getGrContext()) {
        return NULL;
    }
    GrContext* context = canvas->getGrContext();

    GrTestTarget tt;
    context->getTestTarget(&tt);
    if (!tt.target()) {
        SkDebugf("Couldn't get Gr test target.");
        return NULL;
    }

    const GrGLContext* ctx = tt.glContext();
    if (!ctx) {
        SkDebugf("Couldn't get an interface\n");
        return NULL;
    }

    // We only care about gpus with drawArraysInstanced support
    if (!ctx->interface()->fFunctions.fDrawArraysInstanced) {
        return NULL;
    }
    return ctx;
}
开发者ID:ReyCG,项目名称:skia,代码行数:26,代码来源:GLInstancedArraysBench.cpp

示例2: texture

DEF_GPUTEST(TessellatingPathRendererTests, reporter, factory) {
    GrContext* context = factory->get(static_cast<GrContextFactory::GLContextType>(0));
    if (nullptr == context) {
        return;
    }
    GrSurfaceDesc desc;
    desc.fFlags = kRenderTarget_GrSurfaceFlag;
    desc.fWidth = 800;
    desc.fHeight = 800;
    desc.fConfig = kSkia8888_GrPixelConfig;
    desc.fOrigin = kTopLeft_GrSurfaceOrigin;
    SkAutoTUnref<GrTexture> texture(context->textureProvider()->createApproxTexture(desc));
    GrTestTarget tt;
    GrRenderTarget* rt = texture->asRenderTarget();
    context->getTestTarget(&tt, rt);
    GrDrawTarget* dt = tt.target();
    GrResourceProvider* rp = tt.resourceProvider();

    test_path(dt, rt, rp, create_path_0());
    test_path(dt, rt, rp, create_path_1());
    test_path(dt, rt, rp, create_path_2());
    test_path(dt, rt, rp, create_path_3());
    test_path(dt, rt, rp, create_path_4());
    test_path(dt, rt, rp, create_path_5());
    test_path(dt, rt, rp, create_path_6());
    test_path(dt, rt, rp, create_path_7());
    test_path(dt, rt, rp, create_path_8());
    test_path(dt, rt, rp, create_path_9());
    test_path(dt, rt, rp, create_path_10());
    test_path(dt, rt, rp, create_path_11());
    test_path(dt, rt, rp, create_path_12());
    test_path(dt, rt, rp, create_path_13());
    test_path(dt, rt, rp, create_path_14());
    test_path(dt, rt, rp, create_path_15());
}
开发者ID:johnkit,项目名称:skia,代码行数:35,代码来源:TessellatingPathRendererTests.cpp

示例3: als

DEF_GPUTEST(GLPrograms, reporter, factory) {
    // Set a locale that would cause shader compilation to fail because of , as decimal separator.
    // skbug 3330
#ifdef SK_BUILD_FOR_WIN
    GrAutoLocaleSetter als("sv-SE");
#else
    GrAutoLocaleSetter als("sv_SE.UTF-8");
#endif

    // We suppress prints to avoid spew
    GrContextOptions opts;
    opts.fSuppressPrints = true;
    GrContextFactory debugFactory(opts);
    for (int type = 0; type < GrContextFactory::kLastGLContextType; ++type) {
        GrContext* context = debugFactory.get(static_cast<GrContextFactory::GLContextType>(type));
        if (context) {
            GrGLGpu* gpu = static_cast<GrGLGpu*>(context->getGpu());

            /*
             * For the time being, we only support the test with desktop GL or for android on
             * ARM platforms
             * TODO When we run ES 3.00 GLSL in more places, test again
             */
            int maxStages;
            if (kGL_GrGLStandard == gpu->glStandard() ||
                kARM_GrGLVendor == gpu->ctxInfo().vendor()) {
                maxStages = 6;
            } else if (kTegra3_GrGLRenderer == gpu->ctxInfo().renderer() ||
                       kOther_GrGLRenderer == gpu->ctxInfo().renderer()) {
                maxStages = 1;
            } else {
                return;
            }
#if SK_ANGLE
            // Some long shaders run out of temporary registers in the D3D compiler on ANGLE.
            if (type == GrContextFactory::kANGLE_GLContextType) {
                maxStages = 2;
            }
#endif
#if SK_COMMAND_BUFFER
            // Some long shaders run out of temporary registers in the D3D compiler on ANGLE.
            // TODO(hendrikw): This only needs to happen with the ANGLE comand buffer backend.
            if (type == GrContextFactory::kCommandBuffer_GLContextType) {
                maxStages = 2;
            }
#endif
            GrTestTarget testTarget;
            context->getTestTarget(&testTarget);
            REPORTER_ASSERT(reporter, GrDrawingManager::ProgramUnitTest(
                                            context, testTarget.target(), maxStages));
        }
    }
}
开发者ID:Liuxiaochuan,项目名称:skia,代码行数:53,代码来源:GLProgramsTest.cpp


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