*/
sk_sp<GrDrawContext> drawContext(sk_sp<GrRenderTarget> rt, const SkSurfaceProps* = nullptr);
+ enum BackingFit {
+ kTight_BackingFit,
+ kLoose_BackingFit
+ };
+
+ /**
+ * Create both a GrRenderTarget and a matching GrDrawContext to wrap it.
+ * The created GrRenderTarget will always be budgeted.
+ */
+ sk_sp<GrDrawContext> newDrawContext(BackingFit fit,
+ int width, int height,
+ GrPixelConfig config,
+ int sampleCnt = 0,
+ GrSurfaceOrigin origin = kDefault_GrSurfaceOrigin);
+
///////////////////////////////////////////////////////////////////////////
// Misc.
paint.addColorFragmentProcessor(fp.get());
paint.setPorterDuffXPFactory(SkXfermode::kSrc_Mode);
- GrSurfaceDesc desc;
- desc.fFlags = kRenderTarget_GrSurfaceFlag;
- desc.fWidth = bounds.width();
- desc.fHeight = bounds.height();
- desc.fConfig = kRGBA_8888_GrPixelConfig;
-
- sk_sp<GrTexture> dst(context->textureProvider()->createApproxTexture(desc));
- if (!dst) {
- return nullptr;
- }
-
- sk_sp<GrDrawContext> drawContext(context->drawContext(sk_ref_sp(dst->asRenderTarget())));
+ sk_sp<GrDrawContext> drawContext(context->newDrawContext(GrContext::kLoose_BackingFit,
+ bounds.width(), bounds.height(),
+ kRGBA_8888_GrPixelConfig));
if (!drawContext) {
return nullptr;
}
return SkSpecialImage::MakeFromGpu(SkIRect::MakeWH(bounds.width(), bounds.height()),
kNeedNewImageUniqueID_SpecialImage,
- std::move(dst));
+ drawContext->asTexture());
}
#endif
sk_sp<GrTexture> SkAlphaThresholdFilterImpl::createMaskTexture(GrContext* context,
const SkMatrix& inMatrix,
const SkIRect& bounds) const {
- GrSurfaceDesc maskDesc;
+ GrPixelConfig config;
if (context->caps()->isConfigRenderable(kAlpha_8_GrPixelConfig, false)) {
- maskDesc.fConfig = kAlpha_8_GrPixelConfig;
+ config = kAlpha_8_GrPixelConfig;
} else {
- maskDesc.fConfig = kRGBA_8888_GrPixelConfig;
- }
- maskDesc.fFlags = kRenderTarget_GrSurfaceFlag;
- // Add one pixel of border to ensure that clamp mode will be all zeros
- // the outside.
- maskDesc.fWidth = bounds.width();
- maskDesc.fHeight = bounds.height();
- sk_sp<GrTexture> maskTexture(context->textureProvider()->createApproxTexture(maskDesc));
- if (!maskTexture) {
- return nullptr;
+ config = kRGBA_8888_GrPixelConfig;
}
- sk_sp<GrDrawContext> drawContext(
- context->drawContext(sk_ref_sp(maskTexture->asRenderTarget())));
+ sk_sp<GrDrawContext> drawContext(context->newDrawContext(GrContext::kLoose_BackingFit,
+ bounds.width(), bounds.height(),
+ config));
if (!drawContext) {
return nullptr;
}
iter.next();
}
- return maskTexture;
+ return drawContext->asTexture();
}
#endif
return nullptr;
}
- GrSurfaceDesc desc;
- desc.fFlags = kRenderTarget_GrSurfaceFlag;
- desc.fWidth = bounds.width();
- desc.fHeight = bounds.height();
- desc.fConfig = kSkia8888_GrPixelConfig;
-
- sk_sp<GrTexture> dst(context->textureProvider()->createApproxTexture(desc));
- if (!dst) {
- return nullptr;
- }
-
GrPaint paint;
SkMatrix offsetMatrix = GrCoordTransform::MakeDivByTextureWHMatrix(displTexture.get());
offsetMatrix.preTranslate(SkIntToScalar(colorOffset.fX - displOffset.fX),
SkMatrix matrix;
matrix.setTranslate(-SkIntToScalar(colorBounds.x()), -SkIntToScalar(colorBounds.y()));
- sk_sp<GrDrawContext> drawContext(context->drawContext(sk_ref_sp(dst->asRenderTarget())));
+ sk_sp<GrDrawContext> drawContext(context->newDrawContext(GrContext::kLoose_BackingFit,
+ bounds.width(), bounds.height(),
+ kSkia8888_GrPixelConfig));
if (!drawContext) {
return nullptr;
}
offset->fY = bounds.top();
return SkSpecialImage::MakeFromGpu(SkIRect::MakeWH(bounds.width(), bounds.height()),
kNeedNewImageUniqueID_SpecialImage,
- std::move(dst));
+ drawContext->asTexture());
}
#endif
sk_sp<GrTexture> inputTexture(input->asTextureRef(context));
SkASSERT(inputTexture);
- GrSurfaceDesc desc;
- desc.fFlags = kRenderTarget_GrSurfaceFlag,
- desc.fWidth = offsetBounds.width();
- desc.fHeight = offsetBounds.height();
- desc.fConfig = kRGBA_8888_GrPixelConfig;
-
- sk_sp<GrTexture> dst(context->textureProvider()->createApproxTexture(desc));
- if (!dst) {
- return nullptr;
- }
-
- sk_sp<GrDrawContext> drawContext(context->drawContext(sk_ref_sp(dst->asRenderTarget())));
+ sk_sp<GrDrawContext> drawContext(context->newDrawContext(GrContext::kLoose_BackingFit,
+ offsetBounds.width(),
+ offsetBounds.height(),
+ kRGBA_8888_GrPixelConfig));
if (!drawContext) {
return nullptr;
}
return SkSpecialImage::MakeFromGpu(SkIRect::MakeWH(offsetBounds.width(), offsetBounds.height()),
kNeedNewImageUniqueID_SpecialImage,
- std::move(dst));
+ drawContext->asTexture());
}
#endif
SkASSERT(srcTexture);
// setup new clip
- GrClip clip(SkRect::MakeWH(SkIntToScalar(srcTexture->width()),
- SkIntToScalar(srcTexture->height())));
-
- SkIRect dstRect = SkIRect::MakeWH(rect.width(), rect.height());
- GrSurfaceDesc desc;
- desc.fFlags = kRenderTarget_GrSurfaceFlag;
- desc.fWidth = rect.width();
- desc.fHeight = rect.height();
- desc.fConfig = kSkia8888_GrPixelConfig;
+ const GrClip clip(SkRect::MakeWH(SkIntToScalar(srcTexture->width()),
+ SkIntToScalar(srcTexture->height())));
+
+ const SkIRect dstRect = SkIRect::MakeWH(rect.width(), rect.height());
SkIRect srcRect = rect;
SkASSERT(radius.width() > 0 || radius.height() > 0);
if (radius.fWidth > 0) {
- GrTexture* scratch = context->textureProvider()->createApproxTexture(desc);
- if (!scratch) {
- return nullptr;
- }
- sk_sp<GrDrawContext> dstDrawContext(
- context->drawContext(sk_ref_sp(scratch->asRenderTarget())));
+ sk_sp<GrDrawContext> dstDrawContext(context->newDrawContext(GrContext::kLoose_BackingFit,
+ rect.width(), rect.height(),
+ kSkia8888_GrPixelConfig));
if (!dstDrawContext) {
return nullptr;
}
Gr1DKernelEffect::kX_Direction);
SkIRect clearRect = SkIRect::MakeXYWH(dstRect.fLeft, dstRect.fBottom,
dstRect.width(), radius.fHeight);
- GrColor clearColor = GrMorphologyEffect::kErode_MorphologyType == morphType ?
- SK_ColorWHITE :
- SK_ColorTRANSPARENT;
+ GrColor clearColor = GrMorphologyEffect::kErode_MorphologyType == morphType
+ ? SK_ColorWHITE
+ : SK_ColorTRANSPARENT;
dstDrawContext->clear(&clearRect, clearColor, false);
- srcTexture.reset(scratch);
+ srcTexture = dstDrawContext->asTexture();
srcRect = dstRect;
}
if (radius.fHeight > 0) {
- GrTexture* scratch = context->textureProvider()->createApproxTexture(desc);
- if (!scratch) {
- return nullptr;
- }
- sk_sp<GrDrawContext> dstDrawContext(
- context->drawContext(sk_ref_sp(scratch->asRenderTarget())));
+ sk_sp<GrDrawContext> dstDrawContext(context->newDrawContext(GrContext::kLoose_BackingFit,
+ rect.width(), rect.height(),
+ kSkia8888_GrPixelConfig));
if (!dstDrawContext) {
return nullptr;
}
srcRect, dstRect, radius.fHeight, morphType,
Gr1DKernelEffect::kY_Direction);
- srcTexture.reset(scratch);
+ srcTexture = dstDrawContext->asTexture();
}
return SkSpecialImage::MakeFromGpu(SkIRect::MakeWH(rect.width(), rect.height()),
foregroundTex = foreground->asTextureRef(context);
}
- GrSurfaceDesc desc;
- desc.fFlags = kRenderTarget_GrSurfaceFlag;
- desc.fWidth = bounds.width();
- desc.fHeight = bounds.height();
- desc.fConfig = kSkia8888_GrPixelConfig;
- sk_sp<GrTexture> dst(context->textureProvider()->createApproxTexture(desc));
- if (!dst) {
- return nullptr;
- }
-
GrPaint paint;
// SRGBTODO: AllowSRGBInputs?
SkAutoTUnref<const GrFragmentProcessor> bgFP;
mode.reset(new SkProcCoeffXfermode(rec, SkXfermode::kSrcOver_Mode));
}
- SkAutoTUnref<const GrFragmentProcessor> xferFP(mode->getFragmentProcessorForImageFilter(bgFP));
+ sk_sp<const GrFragmentProcessor> xferFP(mode->getFragmentProcessorForImageFilter(bgFP));
// A null 'xferFP' here means kSrc_Mode was used in which case we can just proceed
if (xferFP) {
- paint.addColorFragmentProcessor(xferFP);
+ paint.addColorFragmentProcessor(xferFP.get());
}
} else {
paint.addColorFragmentProcessor(bgFP);
paint.setPorterDuffXPFactory(SkXfermode::kSrc_Mode);
- sk_sp<GrDrawContext> drawContext(context->drawContext(sk_ref_sp(dst->asRenderTarget())));
+ sk_sp<GrDrawContext> drawContext(context->newDrawContext(GrContext::kLoose_BackingFit,
+ bounds.width(), bounds.height(),
+ kSkia8888_GrPixelConfig));
if (!drawContext) {
return nullptr;
}
return SkSpecialImage::MakeFromGpu(SkIRect::MakeWH(bounds.width(), bounds.height()),
kNeedNewImageUniqueID_SpecialImage,
- std::move(dst));
+ drawContext->asTexture());
}
#endif
}
// Create a mask of 'devPath' and place the result in 'mask'.
-static GrTexture* create_mask_GPU(GrContext* context,
- SkRect* maskRect,
- const SkPath& devPath,
- const GrStrokeInfo& strokeInfo,
- bool doAA,
- int sampleCnt) {
+static sk_sp<GrTexture> create_mask_GPU(GrContext* context,
+ SkRect* maskRect,
+ const SkPath& devPath,
+ const GrStrokeInfo& strokeInfo,
+ bool doAA,
+ int sampleCnt) {
// This mask will ultimately be drawn as a non-AA rect (see draw_mask).
// Non-AA rects have a bad habit of snapping arbitrarily. Integerize here
// so the mask draws in a reproducible manner.
*maskRect = SkRect::Make(maskRect->roundOut());
- GrSurfaceDesc desc;
- desc.fFlags = kRenderTarget_GrSurfaceFlag;
- desc.fWidth = SkScalarCeilToInt(maskRect->width());
- desc.fHeight = SkScalarCeilToInt(maskRect->height());
- desc.fSampleCnt = doAA ? sampleCnt : 0;
- // We actually only need A8, but it often isn't supported as a
- // render target so default to RGBA_8888
- desc.fConfig = kRGBA_8888_GrPixelConfig;
-
- if (context->caps()->isConfigRenderable(kAlpha_8_GrPixelConfig, desc.fSampleCnt > 0)) {
- desc.fConfig = kAlpha_8_GrPixelConfig;
+ if (!doAA) {
+ // Don't need MSAA if mask isn't AA
+ sampleCnt = 0;
}
- GrTexture* mask = context->textureProvider()->createApproxTexture(desc);
- if (nullptr == mask) {
- return nullptr;
+ // We actually only need A8, but it often isn't supported as a
+ // render target so default to RGBA_8888
+ GrPixelConfig config = kRGBA_8888_GrPixelConfig;
+ if (context->caps()->isConfigRenderable(kAlpha_8_GrPixelConfig, sampleCnt > 0)) {
+ config = kAlpha_8_GrPixelConfig;
}
- SkRect clipRect = SkRect::MakeWH(maskRect->width(), maskRect->height());
-
- sk_sp<GrDrawContext> drawContext(context->drawContext(sk_ref_sp(mask->asRenderTarget())));
+ sk_sp<GrDrawContext> drawContext(context->newDrawContext(GrContext::kLoose_BackingFit,
+ SkScalarCeilToInt(maskRect->width()),
+ SkScalarCeilToInt(maskRect->height()),
+ config,
+ sampleCnt));
if (!drawContext) {
return nullptr;
}
tempPaint.setCoverageSetOpXPFactory(SkRegion::kReplace_Op);
// setup new clip
+ const SkRect clipRect = SkRect::MakeWH(maskRect->width(), maskRect->height());
GrClip clip(clipRect);
// Draw the mask into maskTexture with the path's integerized top-left at
SkMatrix translate;
translate.setTranslate(-maskRect->fLeft, -maskRect->fTop);
drawContext->drawPath(clip, tempPaint, translate, devPath, strokeInfo);
- return mask;
+ return drawContext->asTexture();;
}
static void draw_path_with_mask_filter(GrContext* context,
return;
}
- SkAutoTUnref<GrTexture> mask(create_mask_GPU(context,
- &maskRect,
- *devPathPtr,
- strokeInfo,
- paint->isAntiAlias(),
- drawContext->numColorSamples()));
+ sk_sp<GrTexture> mask(create_mask_GPU(context,
+ &maskRect,
+ *devPathPtr,
+ strokeInfo,
+ paint->isAntiAlias(),
+ drawContext->numColorSamples()));
if (mask) {
GrTexture* filtered;
- if (maskFilter->filterMaskGPU(mask, viewMatrix, maskRect, &filtered, true)) {
+ if (maskFilter->filterMaskGPU(mask.get(), viewMatrix, maskRect, &filtered, true)) {
// filterMaskGPU gives us ownership of a ref to the result
SkAutoTUnref<GrTexture> atu(filtered);
if (draw_mask(drawContext, clip, viewMatrix, maskRect, paint, filtered)) {
return fDrawingManager->drawContext(std::move(rt), surfaceProps);
}
+sk_sp<GrDrawContext> GrContext::newDrawContext(BackingFit fit,
+ int width, int height,
+ GrPixelConfig config,
+ int sampleCnt,
+ GrSurfaceOrigin origin) {
+ GrSurfaceDesc desc;
+ desc.fFlags = kRenderTarget_GrSurfaceFlag;
+ desc.fOrigin = origin;
+ desc.fWidth = width;
+ desc.fHeight = height;
+ desc.fConfig = config;
+ desc.fSampleCnt = sampleCnt;
+
+ sk_sp<GrTexture> tex;
+ if (kTight_BackingFit == fit) {
+ tex.reset(this->textureProvider()->createTexture(desc, SkBudgeted::kYes));
+ } else {
+ tex.reset(this->textureProvider()->createApproxTexture(desc));
+ }
+ if (!tex) {
+ return nullptr;
+ }
+
+ sk_sp<GrDrawContext> drawContext(this->drawContext(sk_ref_sp(tex->asRenderTarget())));
+ if (!drawContext) {
+ return nullptr;
+ }
+
+ return drawContext;
+}
+
bool GrContext::abandoned() const {
ASSERT_SINGLE_OWNER
return fDrawingManager->abandoned();
return nullptr;
}
- GrSurfaceDesc dstDesc;
+ const int width = yuvSizes[0].fWidth;
+ const int height = yuvSizes[0].fHeight;
+
// Needs to be a render target in order to draw to it for the yuv->rgb conversion.
- dstDesc.fFlags = kRenderTarget_GrSurfaceFlag;
- dstDesc.fOrigin = origin;
- dstDesc.fWidth = yuvSizes[0].fWidth;
- dstDesc.fHeight = yuvSizes[0].fHeight;
- dstDesc.fConfig = kRGBA_8888_GrPixelConfig;
- dstDesc.fSampleCnt = 0;
-
- SkAutoTUnref<GrTexture> dst(ctx->textureProvider()->createTexture(dstDesc, SkBudgeted::kYes));
- if (!dst) {
+ sk_sp<GrDrawContext> drawContext(ctx->newDrawContext(GrContext::kTight_BackingFit,
+ width, height,
+ kRGBA_8888_GrPixelConfig,
+ 0,
+ origin));
+ if (!drawContext) {
return nullptr;
}
paint.addColorFragmentProcessor(GrYUVEffect::CreateYUVToRGB(yTex, uTex, vTex, yuvSizes,
colorSpace))->unref();
- const SkRect rect = SkRect::MakeWH(SkIntToScalar(dstDesc.fWidth),
- SkIntToScalar(dstDesc.fHeight));
- sk_sp<GrDrawContext> drawContext(ctx->drawContext(sk_ref_sp(dst->asRenderTarget())));
- if (!drawContext) {
- return nullptr;
- }
+ const SkRect rect = SkRect::MakeWH(SkIntToScalar(width), SkIntToScalar(height));
drawContext->drawRect(GrClip::WideOpen(), paint, SkMatrix::I(), rect);
- ctx->flushSurfaceWrites(dst);
- return sk_make_sp<SkImage_Gpu>(dstDesc.fWidth, dstDesc.fHeight, kNeedNewImageUniqueID,
- kOpaque_SkAlphaType, dst, budgeted);
+ ctx->flushSurfaceWrites(drawContext->accessRenderTarget());
+ return sk_make_sp<SkImage_Gpu>(width, height, kNeedNewImageUniqueID,
+ kOpaque_SkAlphaType,
+ drawContext->asTexture().get(), budgeted);
}
static sk_sp<SkImage> create_image_from_maker(GrTextureMaker* maker, SkAlphaType at, uint32_t id) {
return true;
}
-// We only really need the DC, but currently the DC doesn't own the RT so we also ref it, but that
-// could be dropped when DC is a proper owner of its RT.
-static bool reset_dc(sk_sp<GrDrawContext>* dc, SkAutoTUnref<GrSurface>* rtKeepAlive,
- GrContext* context, int w, int h) {
+static bool reset_dc(sk_sp<GrDrawContext>* dc, GrContext* context, int w, int h) {
SkDEBUGCODE(uint32_t oldID = 0;)
if (*dc) {
SkDEBUGCODE(oldID = (*dc)->accessRenderTarget()->getUniqueID();)
- rtKeepAlive->reset(nullptr);
dc->reset(nullptr);
}
context->freeGpuResources();
- GrTextureDesc desc;
- desc.fWidth = w;
- desc.fHeight = h;
- desc.fConfig = kRGBA_8888_GrPixelConfig;
- desc.fFlags = kRenderTarget_GrSurfaceFlag;
+ *dc = context->newDrawContext(GrContext::kTight_BackingFit, w, h, kRGBA_8888_GrPixelConfig);
+
+ SkASSERT((*dc)->accessRenderTarget()->getUniqueID() != oldID);
- rtKeepAlive->reset(context->textureProvider()->createTexture(desc, SkBudgeted::kYes));
- if (!(*rtKeepAlive)) {
- return false;
- }
- GrRenderTarget* rt = (*rtKeepAlive)->asRenderTarget();
- SkASSERT(rt->getUniqueID() != oldID);
- *dc = context->drawContext(sk_ref_sp(rt));
return *dc != nullptr;
}
SkIRect fullRect = SkIRect::MakeWH(kW, kH);
sk_sp<GrDrawContext> drawContext;
- SkAutoTUnref<GrSurface> rtKeepAlive;
// A rectangle that is inset by one on all sides and the 1-pixel wide rectangles that surround
// it.
static const GrColor kColor1 = 0xABCDEF01;
static const GrColor kColor2 = ~kColor1;
- if (!reset_dc(&drawContext, &rtKeepAlive, context, kW, kH)) {
+ if (!reset_dc(&drawContext, context, kW, kH)) {
ERRORF(reporter, "Could not create draw context.");
return;
}
failX, failY);
}
- if (!reset_dc(&drawContext, &rtKeepAlive, context, kW, kH)) {
+ if (!reset_dc(&drawContext, context, kW, kH)) {
ERRORF(reporter, "Could not create draw context.");
return;
}
failX, failY);
}
- if (!reset_dc(&drawContext, &rtKeepAlive, context, kW, kH)) {
+ if (!reset_dc(&drawContext, context, kW, kH)) {
ERRORF(reporter, "Could not create draw context.");
return;
}
failX, failY);
}
- if (!reset_dc(&drawContext, &rtKeepAlive, context, kW, kH)) {
+ if (!reset_dc(&drawContext, context, kW, kH)) {
ERRORF(reporter, "Could not create draw context.");
return;
}
failX, failY);
}
- if (!reset_dc(&drawContext, &rtKeepAlive, context, kW, kH)) {
+ if (!reset_dc(&drawContext, context, kW, kH)) {
ERRORF(reporter, "Could not create draw context.");
return;
}
failX, failY);
}
- if (!reset_dc(&drawContext, &rtKeepAlive, context, kW, kH)) {
+ if (!reset_dc(&drawContext, context, kW, kH)) {
ERRORF(reporter, "Could not create draw context.");
return;
}
failX, failY);
}
- if (!reset_dc(&drawContext, &rtKeepAlive, context, kW, kH)) {
+ if (!reset_dc(&drawContext, context, kW, kH)) {
ERRORF(reporter, "Could not create draw context.");
return;
}
failX, failY);
}
- if (!reset_dc(&drawContext, &rtKeepAlive, context, kW, kH)) {
+ if (!reset_dc(&drawContext, context, kW, kH)) {
ERRORF(reporter, "Could not create draw context.");
return;
}
failX, failY);
}
- if (!reset_dc(&drawContext, &rtKeepAlive, context, kW, kH)) {
+ if (!reset_dc(&drawContext, context, kW, kH)) {
ERRORF(reporter, "Could not create draw context.");
return;
}
static const int kXSize = 100;
static const int kYSize = 100;
- GrSurfaceDesc desc;
- desc.fFlags = kRenderTarget_GrSurfaceFlag;
- desc.fConfig = kAlpha_8_GrPixelConfig;
- desc.fWidth = kXSize;
- desc.fHeight = kYSize;
-
- SkAutoTUnref<GrTexture> texture(
- ctxInfo.fGrContext->textureProvider()->createTexture(desc, SkBudgeted::kYes, nullptr, 0));
- if (!texture) {
- return;
- }
-
- SkIRect intScreen = SkIRect::MakeWH(kXSize, kYSize);
- SkRect screen = SkRect::Make(intScreen);
+ const SkIRect intScreen = SkIRect::MakeWH(kXSize, kYSize);
+ const SkRect screen = SkRect::Make(intScreen);
SkRect clipRect(screen);
clipRect.outset(10, 10);
clipData.setClipStack(&stack);
SkIRect devGrClipBound;
- clipData.getConservativeBounds(texture->width(), texture->height(),
+ clipData.getConservativeBounds(kXSize, kYSize,
&devGrClipBound,
&isIntersectionOfRects);
DEF_GPUTEST_FOR_ALL_GL_CONTEXTS(VertexAttributeCount, reporter, ctxInfo) {
GrContext* context = ctxInfo.fGrContext;
- GrTextureDesc desc;
- desc.fHeight = 1;
- desc.fWidth = 1;
- desc.fFlags = kRenderTarget_GrSurfaceFlag;
- desc.fConfig = kRGBA_8888_GrPixelConfig;
- SkAutoTUnref<GrTexture> target(context->textureProvider()->createTexture(desc,
- SkBudgeted::kYes));
- if (!target) {
- ERRORF(reporter, "Could not create render target.");
- return;
- }
- sk_sp<GrDrawContext> dc(context->drawContext(sk_ref_sp(target->asRenderTarget())));
+
+ sk_sp<GrDrawContext> dc(context->newDrawContext(GrContext::kLoose_BackingFit,
+ 1, 1, kRGBA_8888_GrPixelConfig));
if (!dc) {
ERRORF(reporter, "Could not create draw context.");
return;
#endif
SkAutoTUnref<GrDrawBatch> batch;
GrPipelineBuilder pb;
- pb.setRenderTarget(target->asRenderTarget());
+ pb.setRenderTarget(dc->accessRenderTarget());
// This one should succeed.
batch.reset(new Batch(attribCnt));
dc->drawContextPriv().testingOnly_drawBatch(pb, batch);