本文整理汇总了C++中GrGpu::createTestingOnlyBackendRenderTarget方法的典型用法代码示例。如果您正苦于以下问题:C++ GrGpu::createTestingOnlyBackendRenderTarget方法的具体用法?C++ GrGpu::createTestingOnlyBackendRenderTarget怎么用?C++ GrGpu::createTestingOnlyBackendRenderTarget使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GrGpu
的用法示例。
在下文中一共展示了GrGpu::createTestingOnlyBackendRenderTarget方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: backendRT
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(WrappedProxyTest, reporter, ctxInfo) {
GrProxyProvider* proxyProvider = ctxInfo.grContext()->priv().proxyProvider();
GrContext* context = ctxInfo.grContext();
GrResourceProvider* resourceProvider = context->priv().resourceProvider();
GrGpu* gpu = context->priv().getGpu();
const GrCaps& caps = *context->priv().caps();
static const int kWidthHeight = 100;
for (auto origin : { kBottomLeft_GrSurfaceOrigin, kTopLeft_GrSurfaceOrigin }) {
for (auto colorType : { kAlpha_8_SkColorType, kRGBA_8888_SkColorType,
kRGBA_1010102_SkColorType }) {
// External on-screen render target.
// Tests wrapBackendRenderTarget with a GrBackendRenderTarget
// Our test-only function that creates a backend render target doesn't currently support
// sample counts :(.
if (ctxInfo.grContext()->colorTypeSupportedAsSurface(colorType)) {
GrBackendRenderTarget backendRT = gpu->createTestingOnlyBackendRenderTarget(
kWidthHeight, kWidthHeight, SkColorTypeToGrColorType(colorType));
sk_sp<GrSurfaceProxy> sProxy(
proxyProvider->wrapBackendRenderTarget(backendRT, origin, nullptr,
nullptr));
check_surface(reporter, sProxy.get(), origin, kWidthHeight, kWidthHeight,
backendRT.pixelConfig(), SkBudgeted::kNo);
static constexpr int kExpectedNumSamples = 1;
check_rendertarget(reporter, caps, resourceProvider, sProxy->asRenderTargetProxy(),
kExpectedNumSamples, SkBackingFit::kExact,
caps.maxWindowRectangles());
gpu->deleteTestingOnlyBackendRenderTarget(backendRT);
}
for (auto numSamples : {1, 4}) {
GrPixelConfig config = SkColorType2GrPixelConfig(colorType);
SkASSERT(kUnknown_GrPixelConfig != config);
int supportedNumSamples = caps.getRenderTargetSampleCount(numSamples, config);
if (!supportedNumSamples) {
continue;
}
// Test wrapping FBO 0 (with made up properties). This tests sample count and the
// special case where FBO 0 doesn't support window rectangles.
if (GrBackendApi::kOpenGL == ctxInfo.backend()) {
GrGLFramebufferInfo fboInfo;
fboInfo.fFBOID = 0;
fboInfo.fFormat = GR_GL_RGBA8;
static constexpr int kStencilBits = 8;
GrBackendRenderTarget backendRT(kWidthHeight, kWidthHeight, numSamples,
kStencilBits, fboInfo);
backendRT.setPixelConfig(config);
sk_sp<GrSurfaceProxy> sProxy(
proxyProvider->wrapBackendRenderTarget(backendRT, origin, nullptr,
nullptr));
check_surface(reporter, sProxy.get(), origin,
kWidthHeight, kWidthHeight,
backendRT.pixelConfig(), SkBudgeted::kNo);
check_rendertarget(reporter, caps, resourceProvider,
sProxy->asRenderTargetProxy(),
supportedNumSamples, SkBackingFit::kExact, 0);
}
// Tests wrapBackendRenderTarget with a GrBackendTexture
{
GrBackendTexture backendTex =
context->createBackendTexture(kWidthHeight, kWidthHeight,
colorType,
GrMipMapped::kNo,
GrRenderable::kYes);
sk_sp<GrSurfaceProxy> sProxy = proxyProvider->wrapBackendTextureAsRenderTarget(
backendTex, origin, supportedNumSamples);
if (!sProxy) {
context->deleteBackendTexture(backendTex);
continue; // This can fail on Mesa
}
check_surface(reporter, sProxy.get(), origin,
kWidthHeight, kWidthHeight,
backendTex.pixelConfig(), SkBudgeted::kNo);
check_rendertarget(reporter, caps, resourceProvider,
sProxy->asRenderTargetProxy(),
supportedNumSamples, SkBackingFit::kExact,
caps.maxWindowRectangles());
context->deleteBackendTexture(backendTex);
}
// Tests wrapBackendTexture that is only renderable
{
GrBackendTexture backendTex =
context->createBackendTexture(kWidthHeight, kWidthHeight,
colorType,
GrMipMapped::kNo,
GrRenderable::kYes);
sk_sp<GrSurfaceProxy> sProxy = proxyProvider->wrapRenderableBackendTexture(
backendTex, origin, supportedNumSamples, kBorrow_GrWrapOwnership,
GrWrapCacheable::kNo, nullptr, nullptr);
if (!sProxy) {
context->deleteBackendTexture(backendTex);
continue; // This can fail on Mesa
//.........这里部分代码省略.........