Remove GrSurfaceProxy::desc()
Adds a numStencilSamples() getter. Bug: skia: Change-Id: I1e57f19b3cb490a6214ea436622ed8128a5a9303 Reviewed-on: https://skia-review.googlesource.com/16994 Commit-Queue: Brian Salomon <bsalomon@google.com> Reviewed-by: Robert Phillips <robertphillips@google.com>
This commit is contained in:
parent
4d0dab9eca
commit
63e7973d1f
@ -179,9 +179,11 @@ protected:
|
||||
}
|
||||
|
||||
// need to copy the subset into a new texture
|
||||
GrSurfaceDesc desc = fProxy->desc();
|
||||
GrSurfaceDesc desc;
|
||||
desc.fConfig = fProxy->config();
|
||||
desc.fWidth = info.width();
|
||||
desc.fHeight = info.height();
|
||||
desc.fOrigin = fProxy->origin();
|
||||
|
||||
sk_sp<GrSurfaceContext> dstContext(fCtx->contextPriv().makeDeferredSurfaceContext(
|
||||
desc,
|
||||
|
@ -18,7 +18,7 @@ struct GrInstancedPipelineInfo {
|
||||
GrInstancedPipelineInfo(const GrRenderTargetProxy* rtp)
|
||||
: fIsMultisampled(GrFSAAType::kNone != rtp->fsaaType())
|
||||
, fIsMixedSampled(GrFSAAType::kMixedSamples == rtp->fsaaType())
|
||||
, fIsRenderingToFloat(GrPixelConfigIsFloatingPoint(rtp->desc().fConfig)) {}
|
||||
, fIsRenderingToFloat(GrPixelConfigIsFloatingPoint(rtp->config())) {}
|
||||
|
||||
bool canUseCoverageAA() const { return !fIsMultisampled || fIsMixedSampled; }
|
||||
|
||||
|
@ -188,8 +188,6 @@ public:
|
||||
|
||||
static sk_sp<GrTextureProxy> MakeWrappedBackend(GrContext*, GrBackendTexture&, GrSurfaceOrigin);
|
||||
|
||||
const GrSurfaceDesc& desc() const { return fDesc; }
|
||||
|
||||
GrSurfaceOrigin origin() const {
|
||||
SkASSERT(kTopLeft_GrSurfaceOrigin == fDesc.fOrigin ||
|
||||
kBottomLeft_GrSurfaceOrigin == fDesc.fOrigin);
|
||||
@ -198,6 +196,7 @@ public:
|
||||
int width() const { return fDesc.fWidth; }
|
||||
int height() const { return fDesc.fHeight; }
|
||||
GrPixelConfig config() const { return fDesc.fConfig; }
|
||||
bool isMipMapped() const { return fDesc.fIsMipMapped; }
|
||||
|
||||
class UniqueID {
|
||||
public:
|
||||
@ -295,7 +294,7 @@ public:
|
||||
|
||||
// Helper function that creates a temporary SurfaceContext to perform the copy
|
||||
// It always returns a kExact-backed proxy bc it is used when converting an SkSpecialImage
|
||||
// to an SkImage.
|
||||
// to an SkImage. The copy is is not a render target and not multisampled.
|
||||
static sk_sp<GrTextureProxy> Copy(GrContext*, GrSurfaceProxy* src,
|
||||
SkIRect srcRect, SkBudgeted);
|
||||
|
||||
|
@ -163,10 +163,14 @@ sk_sp<GrTextureProxy> GrBackendTextureImageGenerator::onGenerateTexture(GrContex
|
||||
} else {
|
||||
// Otherwise, make a copy of the requested subset. Make sure our temporary is renderable,
|
||||
// because Vulkan will want to do the copy as a draw.
|
||||
GrSurfaceDesc desc = proxy->desc();
|
||||
GrSurfaceDesc desc;
|
||||
desc.fConfig = proxy->config();
|
||||
desc.fWidth = info.width();
|
||||
desc.fHeight = info.height();
|
||||
desc.fOrigin = proxy->origin();
|
||||
desc.fIsMipMapped = proxy->isMipMapped();
|
||||
desc.fFlags = kRenderTarget_GrSurfaceFlag;
|
||||
|
||||
sk_sp<GrSurfaceContext> sContext(context->contextPriv().makeDeferredSurfaceContext(
|
||||
desc, SkBackingFit::kExact, SkBudgeted::kYes));
|
||||
if (!sContext) {
|
||||
|
@ -173,7 +173,7 @@ GrDrawOpAtlas::GrDrawOpAtlas(GrContext* context, sk_sp<GrTextureProxy> proxy,
|
||||
SkDEBUGCODE(fNumPlots = numPlotsX * numPlotsY;)
|
||||
|
||||
// We currently do not support compressed atlases...
|
||||
SkASSERT(!GrPixelConfigIsCompressed(fProxy->desc().fConfig));
|
||||
SkASSERT(!GrPixelConfigIsCompressed(fProxy->config()));
|
||||
|
||||
// set up allocated plots
|
||||
fPlotArray.reset(new sk_sp<Plot>[ numPlotsX * numPlotsY ]);
|
||||
@ -183,7 +183,7 @@ GrDrawOpAtlas::GrDrawOpAtlas(GrContext* context, sk_sp<GrTextureProxy> proxy,
|
||||
for (int x = numPlotsX - 1, c = 0; x >= 0; --x, ++c) {
|
||||
uint32_t index = r * numPlotsX + c;
|
||||
currPlot->reset(
|
||||
new Plot(index, 1, x, y, fPlotWidth, fPlotHeight, fProxy->desc().fConfig));
|
||||
new Plot(index, 1, x, y, fPlotWidth, fPlotHeight, fProxy->config()));
|
||||
|
||||
// build LRU list
|
||||
fPlotList.addToHead(currPlot->get());
|
||||
@ -239,7 +239,7 @@ bool GrDrawOpAtlas::addToAtlas(AtlasID* id, GrDrawOp::Target* target, int width,
|
||||
plotIter.init(fPlotList, PlotList::Iter::kHead_IterStart);
|
||||
Plot* plot;
|
||||
while ((plot = plotIter.get())) {
|
||||
SkASSERT(GrBytesPerPixel(fProxy->desc().fConfig) == plot->bpp());
|
||||
SkASSERT(GrBytesPerPixel(fProxy->config()) == plot->bpp());
|
||||
if (plot->addSubImage(width, height, image, loc)) {
|
||||
return this->updatePlot(target, id, plot);
|
||||
}
|
||||
@ -253,7 +253,7 @@ bool GrDrawOpAtlas::addToAtlas(AtlasID* id, GrDrawOp::Target* target, int width,
|
||||
if (target->hasDrawBeenFlushed(plot->lastUseToken())) {
|
||||
this->processEviction(plot->id());
|
||||
plot->resetRects();
|
||||
SkASSERT(GrBytesPerPixel(fProxy->desc().fConfig) == plot->bpp());
|
||||
SkASSERT(GrBytesPerPixel(fProxy->config()) == plot->bpp());
|
||||
SkDEBUGCODE(bool verify = )plot->addSubImage(width, height, image, loc);
|
||||
SkASSERT(verify);
|
||||
if (!this->updatePlot(target, id, plot)) {
|
||||
@ -279,7 +279,7 @@ bool GrDrawOpAtlas::addToAtlas(AtlasID* id, GrDrawOp::Target* target, int width,
|
||||
newPlot.reset(plot->clone());
|
||||
|
||||
fPlotList.addToHead(newPlot.get());
|
||||
SkASSERT(GrBytesPerPixel(fProxy->desc().fConfig) == newPlot->bpp());
|
||||
SkASSERT(GrBytesPerPixel(fProxy->config()) == newPlot->bpp());
|
||||
SkDEBUGCODE(bool verify = )newPlot->addSubImage(width, height, image, loc);
|
||||
SkASSERT(verify);
|
||||
|
||||
|
@ -246,9 +246,11 @@ sk_sp<GrTextureProxy> GrSurfaceProxy::Copy(GrContext* context,
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
GrSurfaceDesc dstDesc = src->desc();
|
||||
GrSurfaceDesc dstDesc;
|
||||
dstDesc.fConfig = src->config();
|
||||
dstDesc.fWidth = srcRect.width();
|
||||
dstDesc.fHeight = srcRect.height();
|
||||
dstDesc.fOrigin = src->origin();
|
||||
|
||||
sk_sp<GrSurfaceContext> dstContext(context->contextPriv().makeDeferredSurfaceContext(
|
||||
dstDesc,
|
||||
|
@ -2125,7 +2125,8 @@ bool GrGLCaps::initDescForDstCopy(const GrRenderTargetProxy* src, GrSurfaceDesc*
|
||||
}
|
||||
|
||||
{
|
||||
bool srcIsMSAARenderbuffer = src->desc().fSampleCnt > 0 && this->usesMSAARenderBuffers();
|
||||
bool srcIsMSAARenderbuffer = GrFSAAType::kUnifiedMSAA == src->fsaaType() &&
|
||||
this->usesMSAARenderBuffers();
|
||||
if (srcIsMSAARenderbuffer) {
|
||||
// It's illegal to call CopyTexSubImage2D on a MSAA renderbuffer. Set up for FBO
|
||||
// blit or fail.
|
||||
|
@ -219,9 +219,11 @@ bool SkImage_Gpu::onReadPixels(const SkImageInfo& dstInfo, void* dstPixels, size
|
||||
}
|
||||
|
||||
sk_sp<SkImage> SkImage_Gpu::onMakeSubset(const SkIRect& subset) const {
|
||||
GrSurfaceDesc desc = fProxy->desc();
|
||||
GrSurfaceDesc desc;
|
||||
desc.fConfig = fProxy->config();
|
||||
desc.fWidth = subset.width();
|
||||
desc.fHeight = subset.height();
|
||||
desc.fOrigin = fProxy->origin();
|
||||
|
||||
sk_sp<GrSurfaceContext> sContext(fContext->contextPriv().makeDeferredSurfaceContext(
|
||||
desc,
|
||||
|
Loading…
Reference in New Issue
Block a user