本文整理汇总了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;
}
示例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());
}
示例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));
}
}
}