Clean up some GrContext uses in the GMs
This is part of the effort to replace GrContext with the GrDirectContext/GrRecordingContext pair. It also tries out, a bit, the context naming proposal (i.e., rContext and dContext). Change-Id: Ib4d9881f820a7f8a8c525eba7448b1015526400c Reviewed-on: https://skia-review.googlesource.com/c/skia/+/303627 Reviewed-by: Adlai Holler <adlai@google.com> Commit-Queue: Robert Phillips <robertphillips@google.com>
This commit is contained in:
parent
9f1760bf73
commit
057c33fe63
@ -26,9 +26,10 @@
|
||||
#include "include/core/SkSurface.h"
|
||||
#include "include/core/SkTypes.h"
|
||||
#include "include/gpu/GrContext.h"
|
||||
#include "include/gpu/GrRecordingContext.h"
|
||||
#include "include/gpu/GrTypes.h"
|
||||
#include "include/private/GrTypesPriv.h"
|
||||
#include "src/gpu/GrContextPriv.h"
|
||||
#include "src/gpu/GrRecordingContextPriv.h"
|
||||
#include "src/gpu/GrSamplerState.h"
|
||||
#include "src/gpu/GrSurfaceContext.h"
|
||||
#include "src/gpu/GrTextureProxy.h"
|
||||
@ -125,7 +126,8 @@ DEF_GM( return new ImagePictGM; )
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static std::unique_ptr<SkImageGenerator> make_pic_generator(GrContext*, sk_sp<SkPicture> pic) {
|
||||
static std::unique_ptr<SkImageGenerator> make_pic_generator(GrRecordingContext*,
|
||||
sk_sp<SkPicture> pic) {
|
||||
SkMatrix matrix;
|
||||
matrix.setTranslate(-100, -100);
|
||||
return SkImageGenerator::MakeFromPicture({ 100, 100 }, std::move(pic), &matrix, nullptr,
|
||||
@ -148,7 +150,8 @@ protected:
|
||||
private:
|
||||
SkBitmap fBM;
|
||||
};
|
||||
static std::unique_ptr<SkImageGenerator> make_ras_generator(GrContext*, sk_sp<SkPicture> pic) {
|
||||
static std::unique_ptr<SkImageGenerator> make_ras_generator(GrRecordingContext*,
|
||||
sk_sp<SkPicture> pic) {
|
||||
SkBitmap bm;
|
||||
bm.allocN32Pixels(100, 100);
|
||||
SkCanvas canvas(bm);
|
||||
@ -165,31 +168,31 @@ public:
|
||||
|
||||
class TextureGenerator : public SkImageGenerator {
|
||||
public:
|
||||
TextureGenerator(GrContext* ctx, const SkImageInfo& info, sk_sp<SkPicture> pic)
|
||||
: SkImageGenerator(info)
|
||||
, fCtx(SkRef(ctx)) {
|
||||
TextureGenerator(GrRecordingContext* rContext, const SkImageInfo& info, sk_sp<SkPicture> pic)
|
||||
: SkImageGenerator(info)
|
||||
, fRContext(SkRef(rContext)) {
|
||||
|
||||
sk_sp<SkSurface> surface(SkSurface::MakeRenderTarget(ctx, SkBudgeted::kYes, info, 0,
|
||||
sk_sp<SkSurface> surface(SkSurface::MakeRenderTarget(rContext, SkBudgeted::kYes, info, 0,
|
||||
kTopLeft_GrSurfaceOrigin, nullptr));
|
||||
if (surface) {
|
||||
surface->getCanvas()->clear(0);
|
||||
surface->getCanvas()->translate(-100, -100);
|
||||
surface->getCanvas()->drawPicture(pic);
|
||||
sk_sp<SkImage> image(surface->makeImageSnapshot());
|
||||
const GrSurfaceProxyView* view = as_IB(image)->view(fCtx.get());
|
||||
const GrSurfaceProxyView* view = as_IB(image)->view(rContext);
|
||||
if (view) {
|
||||
fView = *view;
|
||||
}
|
||||
}
|
||||
}
|
||||
protected:
|
||||
GrSurfaceProxyView onGenerateTexture(GrRecordingContext* ctx,
|
||||
GrSurfaceProxyView onGenerateTexture(GrRecordingContext* rContext,
|
||||
const SkImageInfo& info,
|
||||
const SkIPoint& origin,
|
||||
GrMipMapped mipMapped,
|
||||
GrImageTexGenPolicy policy) override {
|
||||
SkASSERT(ctx);
|
||||
SkASSERT(ctx == fCtx.get());
|
||||
SkASSERT(rContext);
|
||||
SkASSERT(rContext == fRContext.get());
|
||||
|
||||
if (!fView) {
|
||||
return {};
|
||||
@ -202,37 +205,37 @@ protected:
|
||||
auto budgeted = policy == GrImageTexGenPolicy::kNew_Uncached_Unbudgeted ? SkBudgeted::kNo
|
||||
: SkBudgeted::kYes;
|
||||
return GrSurfaceProxyView::Copy(
|
||||
fCtx.get(), fView, mipMapped,
|
||||
fRContext.get(), fView, mipMapped,
|
||||
SkIRect::MakeXYWH(origin.x(), origin.y(), info.width(), info.height()),
|
||||
SkBackingFit::kExact, budgeted);
|
||||
}
|
||||
|
||||
private:
|
||||
sk_sp<GrContext> fCtx;
|
||||
GrSurfaceProxyView fView;
|
||||
sk_sp<GrRecordingContext> fRContext;
|
||||
GrSurfaceProxyView fView;
|
||||
};
|
||||
|
||||
static std::unique_ptr<SkImageGenerator> make_tex_generator(GrContext* ctx, sk_sp<SkPicture> pic) {
|
||||
static std::unique_ptr<SkImageGenerator> make_tex_generator(GrRecordingContext* rContext,
|
||||
sk_sp<SkPicture> pic) {
|
||||
const SkImageInfo info = SkImageInfo::MakeN32Premul(100, 100);
|
||||
|
||||
if (!ctx) {
|
||||
if (!rContext) {
|
||||
return std::make_unique<EmptyGenerator>(info);
|
||||
}
|
||||
return std::make_unique<TextureGenerator>(ctx, info, pic);
|
||||
return std::make_unique<TextureGenerator>(rContext, info, pic);
|
||||
}
|
||||
|
||||
class ImageCacheratorGM : public skiagm::GM {
|
||||
SkString fName;
|
||||
std::unique_ptr<SkImageGenerator> (*fFactory)(GrContext*, sk_sp<SkPicture>);
|
||||
sk_sp<SkPicture> fPicture;
|
||||
sk_sp<SkImage> fImage;
|
||||
sk_sp<SkImage> fImageSubset;
|
||||
typedef std::unique_ptr<SkImageGenerator> (*FactoryFunc)(GrRecordingContext*, sk_sp<SkPicture>);
|
||||
|
||||
SkString fName;
|
||||
FactoryFunc fFactory;
|
||||
sk_sp<SkPicture> fPicture;
|
||||
sk_sp<SkImage> fImage;
|
||||
sk_sp<SkImage> fImageSubset;
|
||||
|
||||
public:
|
||||
ImageCacheratorGM(const char suffix[],
|
||||
std::unique_ptr<SkImageGenerator> (*factory)(GrContext*, sk_sp<SkPicture>))
|
||||
: fFactory(factory)
|
||||
{
|
||||
ImageCacheratorGM(const char suffix[], FactoryFunc factory) : fFactory(factory) {
|
||||
fName.printf("image-cacherator-from-%s", suffix);
|
||||
}
|
||||
|
||||
@ -252,13 +255,13 @@ protected:
|
||||
fPicture = recorder.finishRecordingAsPicture();
|
||||
}
|
||||
|
||||
void makeCaches(GrContext* ctx) {
|
||||
auto gen = fFactory(ctx, fPicture);
|
||||
void makeCaches(GrRecordingContext* rContext) {
|
||||
auto gen = fFactory(rContext, fPicture);
|
||||
fImage = SkImage::MakeFromGenerator(std::move(gen));
|
||||
|
||||
const SkIRect subset = SkIRect::MakeLTRB(50, 50, 100, 100);
|
||||
|
||||
gen = fFactory(ctx, fPicture);
|
||||
gen = fFactory(rContext, fPicture);
|
||||
fImageSubset = SkImage::MakeFromGenerator(std::move(gen), &subset);
|
||||
|
||||
SkASSERT(fImage->dimensions() == SkISize::Make(100, 100));
|
||||
@ -286,8 +289,11 @@ protected:
|
||||
return;
|
||||
}
|
||||
|
||||
// CONTEXT TODO: remove this use of the 'backdoor' to create an image
|
||||
GrContext* tmp = canvas->recordingContext()->priv().backdoor();
|
||||
|
||||
// No API to draw a GrTexture directly, so we cheat and create a private image subclass
|
||||
sk_sp<SkImage> texImage(new SkImage_Gpu(sk_ref_sp(canvas->getGrContext()),
|
||||
sk_sp<SkImage> texImage(new SkImage_Gpu(sk_ref_sp(tmp),
|
||||
image->uniqueID(), std::move(view),
|
||||
image->colorType(), image->alphaType(),
|
||||
image->refColorSpace()));
|
||||
@ -309,7 +315,7 @@ protected:
|
||||
}
|
||||
|
||||
void onDraw(SkCanvas* canvas) override {
|
||||
this->makeCaches(canvas->getGrContext());
|
||||
this->makeCaches(canvas->recordingContext());
|
||||
|
||||
canvas->translate(20, 20);
|
||||
|
||||
|
@ -1156,7 +1156,7 @@ protected:
|
||||
}
|
||||
|
||||
// Resize all the backend textures in 'yuvaTextures' to a quarter their size.
|
||||
sk_sp<SkImage> resizeOnGpu(GrContext* context,
|
||||
sk_sp<SkImage> resizeOnGpu(GrDirectContext* dContext,
|
||||
YUVFormat yuvFormat,
|
||||
SkYUVColorSpace yuvColorSpace,
|
||||
bool opaque,
|
||||
@ -1164,14 +1164,14 @@ protected:
|
||||
const SkYUVAIndex yuvaIndices[4],
|
||||
int numTextures,
|
||||
SkISize imageSize) {
|
||||
auto releaseContext = new YUVABackendReleaseContext(context);
|
||||
auto releaseContext = new YUVABackendReleaseContext(dContext);
|
||||
|
||||
for (int i = 0; i < numTextures; ++i) {
|
||||
const GrBackendTexture& curTex = yuvaTextures[i];
|
||||
|
||||
SkColorType ct = get_color_type(curTex.getBackendFormat());
|
||||
if (ct == kUnknown_SkColorType || !context->colorTypeSupportedAsSurface(ct)) {
|
||||
YUVABackendReleaseContext::Unwind(context, releaseContext, true);
|
||||
if (ct == kUnknown_SkColorType || !dContext->colorTypeSupportedAsSurface(ct)) {
|
||||
YUVABackendReleaseContext::Unwind(dContext, releaseContext, true);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@ -1179,25 +1179,25 @@ protected:
|
||||
// We disallow resizing AYUV and Y410 formats on the GPU bc resizing them w/ a
|
||||
// premul draw combines the YUV channels w/ the A channel in an inappropriate
|
||||
// manner.
|
||||
YUVABackendReleaseContext::Unwind(context, releaseContext, true);
|
||||
YUVABackendReleaseContext::Unwind(dContext, releaseContext, true);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
SkISize shrunkPlaneSize = {curTex.width() / 2, curTex.height() / 2 };
|
||||
|
||||
sk_sp<SkImage> wrappedOrig = SkImage::MakeFromTexture(context, curTex,
|
||||
sk_sp<SkImage> wrappedOrig = SkImage::MakeFromTexture(dContext, curTex,
|
||||
kTopLeft_GrSurfaceOrigin,
|
||||
ct,
|
||||
kPremul_SkAlphaType,
|
||||
nullptr);
|
||||
|
||||
GrBackendTexture tmp = context->createBackendTexture(shrunkPlaneSize.width(),
|
||||
shrunkPlaneSize.height(),
|
||||
curTex.getBackendFormat(),
|
||||
GrMipMapped::kNo,
|
||||
GrRenderable::kYes);
|
||||
GrBackendTexture tmp = dContext->createBackendTexture(shrunkPlaneSize.width(),
|
||||
shrunkPlaneSize.height(),
|
||||
curTex.getBackendFormat(),
|
||||
GrMipMapped::kNo,
|
||||
GrRenderable::kYes);
|
||||
if (!tmp.isValid()) {
|
||||
YUVABackendReleaseContext::Unwind(context, releaseContext, true);
|
||||
YUVABackendReleaseContext::Unwind(dContext, releaseContext, true);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@ -1205,11 +1205,11 @@ protected:
|
||||
// uninitialized beTextures don't have any pending work
|
||||
releaseContext->setCreationComplete(i);
|
||||
|
||||
sk_sp<SkSurface> s = SkSurface::MakeFromBackendTexture(context, tmp,
|
||||
sk_sp<SkSurface> s = SkSurface::MakeFromBackendTexture(dContext, tmp,
|
||||
kTopLeft_GrSurfaceOrigin, 0,
|
||||
ct, nullptr, nullptr);
|
||||
if (!s) {
|
||||
YUVABackendReleaseContext::Unwind(context, releaseContext, true);
|
||||
YUVABackendReleaseContext::Unwind(dContext, releaseContext, true);
|
||||
return nullptr;
|
||||
}
|
||||
SkCanvas* c = s->getCanvas();
|
||||
@ -1226,7 +1226,7 @@ protected:
|
||||
|
||||
SkISize shrunkImageSize = { imageSize.width() / 2, imageSize.height() / 2 };
|
||||
|
||||
return SkImage::MakeFromYUVATextures(context,
|
||||
return SkImage::MakeFromYUVATextures(dContext,
|
||||
yuvColorSpace,
|
||||
releaseContext->beTextures(),
|
||||
yuvaIndices,
|
||||
@ -1237,7 +1237,7 @@ protected:
|
||||
releaseContext);
|
||||
}
|
||||
|
||||
bool createImages(GrDirectContext* context) {
|
||||
bool createImages(GrDirectContext* dContext) {
|
||||
int counter = 0;
|
||||
for (bool opaque : { false, true }) {
|
||||
for (int cs = kJPEG_SkYUVColorSpace; cs <= kLastEnum_SkYUVColorSpace; ++cs) {
|
||||
@ -1250,24 +1250,24 @@ protected:
|
||||
|
||||
int numTextures = create_YUV(planes, format, resultBMs, opaque);
|
||||
|
||||
if (context) {
|
||||
if (dContext) {
|
||||
fGpuGeneratedImages = true;
|
||||
|
||||
if (context->abandoned()) {
|
||||
if (dContext->abandoned()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!is_format_natively_supported(context, format)) {
|
||||
if (!is_format_natively_supported(dContext, format)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
auto releaseCtx = new YUVABackendReleaseContext(context);
|
||||
auto releaseCtx = new YUVABackendReleaseContext(dContext);
|
||||
|
||||
for (int i = 0; i < numTextures; ++i) {
|
||||
GrBackendTexture tmp = create_yuva_texture(context, resultBMs[i], i,
|
||||
GrBackendTexture tmp = create_yuva_texture(dContext, resultBMs[i], i,
|
||||
releaseCtx);
|
||||
if (!tmp.isValid()) {
|
||||
YUVABackendReleaseContext::Unwind(context, releaseCtx, false);
|
||||
YUVABackendReleaseContext::Unwind(dContext, releaseCtx, false);
|
||||
return false;
|
||||
}
|
||||
releaseCtx->set(i, tmp);
|
||||
@ -1278,13 +1278,13 @@ protected:
|
||||
bool externalAlphaPlane = !opaque && !planarConfig.hasAlpha();
|
||||
if (!planarConfig.getYUVAIndices(releaseCtx->beTextures(), numTextures,
|
||||
externalAlphaPlane, yuvaIndices)) {
|
||||
YUVABackendReleaseContext::Unwind(context, releaseCtx, false);
|
||||
YUVABackendReleaseContext::Unwind(dContext, releaseCtx, false);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (fQuarterSize) {
|
||||
fImages[opaque][cs][format] =
|
||||
this->resizeOnGpu(context,
|
||||
this->resizeOnGpu(dContext,
|
||||
format,
|
||||
(SkYUVColorSpace)cs,
|
||||
opaque,
|
||||
@ -1292,7 +1292,7 @@ protected:
|
||||
yuvaIndices,
|
||||
numTextures,
|
||||
fOriginalBMs[opaque].dimensions());
|
||||
YUVABackendReleaseContext::Unwind(context, releaseCtx, true);
|
||||
YUVABackendReleaseContext::Unwind(dContext, releaseCtx, true);
|
||||
} else {
|
||||
int counterMod = counter % 3;
|
||||
if (fUseDomain && counterMod == 0) {
|
||||
@ -1307,17 +1307,17 @@ protected:
|
||||
switch (counterMod) {
|
||||
case 0:
|
||||
fImages[opaque][cs][format] = SkImage::MakeFromYUVATexturesCopy(
|
||||
context,
|
||||
dContext,
|
||||
(SkYUVColorSpace)cs,
|
||||
releaseCtx->beTextures(),
|
||||
yuvaIndices,
|
||||
imgSize,
|
||||
kTopLeft_GrSurfaceOrigin);
|
||||
YUVABackendReleaseContext::Unwind(context, releaseCtx, true);
|
||||
YUVABackendReleaseContext::Unwind(dContext, releaseCtx, true);
|
||||
break;
|
||||
case 1:
|
||||
fImages[opaque][cs][format] = SkImage::MakeFromYUVATextures(
|
||||
context,
|
||||
dContext,
|
||||
(SkYUVColorSpace)cs,
|
||||
releaseCtx->beTextures(),
|
||||
yuvaIndices,
|
||||
@ -1330,7 +1330,7 @@ protected:
|
||||
case 2:
|
||||
default: {
|
||||
// TODO: we did a lot of work to delete these here
|
||||
YUVABackendReleaseContext::Unwind(context, releaseCtx, false);
|
||||
YUVABackendReleaseContext::Unwind(dContext, releaseCtx, false);
|
||||
|
||||
SkPixmap yuvaPixmaps[4];
|
||||
for (int i = 0; i < numTextures; ++i) {
|
||||
@ -1338,7 +1338,7 @@ protected:
|
||||
}
|
||||
|
||||
fImages[opaque][cs][format] = SkImage::MakeFromYUVAPixmaps(
|
||||
context,
|
||||
dContext,
|
||||
(SkYUVColorSpace)cs,
|
||||
yuvaPixmaps,
|
||||
yuvaIndices,
|
||||
@ -1360,27 +1360,27 @@ protected:
|
||||
}
|
||||
}
|
||||
|
||||
if (context) {
|
||||
if (dContext) {
|
||||
// Some backends (e.g., Vulkan) require all work be completed for backend textures
|
||||
// before they are deleted. Since we don't know when we'll next have access to a
|
||||
// direct context, flush all the work now.
|
||||
context->flush();
|
||||
context->submit(true);
|
||||
dContext->flush();
|
||||
dContext->submit(true);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
DrawResult onGpuSetup(GrDirectContext* context, SkString* errorMsg) override {
|
||||
DrawResult onGpuSetup(GrDirectContext* dContext, SkString* errorMsg) override {
|
||||
this->createBitmaps();
|
||||
|
||||
if (context && context->abandoned()) {
|
||||
if (dContext && dContext->abandoned()) {
|
||||
// This isn't a GpuGM so a null 'context' is okay but an abandoned context
|
||||
// if forbidden.
|
||||
return DrawResult::kSkip;
|
||||
}
|
||||
|
||||
if (!this->createImages(context)) {
|
||||
if (!this->createImages(dContext)) {
|
||||
*errorMsg = "Failed to create YUV images";
|
||||
return DrawResult::kFail;
|
||||
}
|
||||
|
@ -42,8 +42,8 @@ protected:
|
||||
return SkISize::Make(2*kPad+kImageSize, 2*kPad+kImageSize);
|
||||
}
|
||||
|
||||
DrawResult createYCbCrImage(GrContext* context, SkString* errorMsg) {
|
||||
std::unique_ptr<VkYcbcrSamplerHelper> ycbcrHelper(new VkYcbcrSamplerHelper(context));
|
||||
DrawResult createYCbCrImage(GrDirectContext* dContext, SkString* errorMsg) {
|
||||
std::unique_ptr<VkYcbcrSamplerHelper> ycbcrHelper(new VkYcbcrSamplerHelper(dContext));
|
||||
|
||||
if (!ycbcrHelper->isYCbCrSupported()) {
|
||||
*errorMsg = "YCbCr sampling not supported.";
|
||||
@ -56,7 +56,7 @@ protected:
|
||||
}
|
||||
|
||||
SkASSERT(!fYCbCrImage);
|
||||
fYCbCrImage = SkImage::MakeFromTexture(context, ycbcrHelper->backendTexture(),
|
||||
fYCbCrImage = SkImage::MakeFromTexture(dContext, ycbcrHelper->backendTexture(),
|
||||
kTopLeft_GrSurfaceOrigin, kRGB_888x_SkColorType,
|
||||
kPremul_SkAlphaType, nullptr,
|
||||
release_ycbcrhelper, ycbcrHelper.get());
|
||||
|
@ -8,7 +8,7 @@
|
||||
#include "tools/gpu/YUVUtils.h"
|
||||
|
||||
#include "include/core/SkData.h"
|
||||
#include "include/gpu/GrContext.h"
|
||||
#include "include/gpu/GrDirectContext.h"
|
||||
#include "src/codec/SkCodecImageGenerator.h"
|
||||
#include "src/gpu/GrContextPriv.h"
|
||||
|
||||
@ -86,7 +86,8 @@ bool LazyYUVImage::ensureYUVImage(GrContext* context) {
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
void YUVABackendReleaseContext::Unwind(GrContext* context, YUVABackendReleaseContext* beContext,
|
||||
void YUVABackendReleaseContext::Unwind(GrDirectContext* dContext,
|
||||
YUVABackendReleaseContext* beContext,
|
||||
bool fullFlush) {
|
||||
|
||||
// Some backends (e.g., Vulkan) require that all work associated w/ texture
|
||||
@ -94,29 +95,28 @@ void YUVABackendReleaseContext::Unwind(GrContext* context, YUVABackendReleaseCon
|
||||
if (fullFlush) {
|
||||
// If the release context client performed some operations other than backend texture
|
||||
// creation then we may require a full flush to ensure that all the work is completed.
|
||||
context->flush();
|
||||
context->submit(true);
|
||||
dContext->flush();
|
||||
dContext->submit(true);
|
||||
} else {
|
||||
context->submit();
|
||||
dContext->submit();
|
||||
|
||||
while (!beContext->creationCompleted()) {
|
||||
context->checkAsyncWorkCompletion();
|
||||
dContext->checkAsyncWorkCompletion();
|
||||
}
|
||||
}
|
||||
|
||||
delete beContext;
|
||||
}
|
||||
|
||||
YUVABackendReleaseContext::YUVABackendReleaseContext(GrContext* context) : fContext(context) {
|
||||
SkASSERT(context->priv().getGpu());
|
||||
SkASSERT(context->asDirectContext());
|
||||
YUVABackendReleaseContext::YUVABackendReleaseContext(GrDirectContext* dContext)
|
||||
: fDContext(dContext) {
|
||||
}
|
||||
|
||||
YUVABackendReleaseContext::~YUVABackendReleaseContext() {
|
||||
for (int i = 0; i < 4; ++i) {
|
||||
if (fBETextures[i].isValid()) {
|
||||
SkASSERT(fCreationComplete[i]);
|
||||
fContext->deleteBackendTexture(fBETextures[i]);
|
||||
fDContext->deleteBackendTexture(fBETextures[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -64,9 +64,9 @@ public:
|
||||
|
||||
// Given how and when backend textures are created, just deleting this object often
|
||||
// isn't enough. This helper encapsulates the extra work needed.
|
||||
static void Unwind(GrContext* context, YUVABackendReleaseContext* beContext, bool fullFlush);
|
||||
static void Unwind(GrDirectContext*, YUVABackendReleaseContext* beContext, bool fullFlush);
|
||||
|
||||
YUVABackendReleaseContext(GrContext* context);
|
||||
YUVABackendReleaseContext(GrDirectContext*);
|
||||
~YUVABackendReleaseContext();
|
||||
|
||||
void set(int index, const GrBackendTexture& beTex) {
|
||||
@ -104,7 +104,7 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
GrContext* fContext;
|
||||
GrDirectContext* fDContext;
|
||||
GrBackendTexture fBETextures[4];
|
||||
bool fCreationComplete[4] = { false };
|
||||
};
|
||||
|
@ -9,7 +9,7 @@
|
||||
|
||||
#ifdef SK_VULKAN
|
||||
|
||||
#include "include/gpu/GrContext.h"
|
||||
#include "include/gpu/GrDirectContext.h"
|
||||
#include "src/gpu/GrContextPriv.h"
|
||||
#include "src/gpu/vk/GrVkGpu.h"
|
||||
#include "src/gpu/vk/GrVkUtil.h"
|
||||
@ -23,11 +23,11 @@ std::pair<int, int> VkYcbcrSamplerHelper::GetExpectedUV(int x, int y, int width,
|
||||
}
|
||||
|
||||
GrVkGpu* VkYcbcrSamplerHelper::vkGpu() {
|
||||
return (GrVkGpu*) fContext->priv().getGpu();
|
||||
return (GrVkGpu*) fDContext->priv().getGpu();
|
||||
}
|
||||
|
||||
VkYcbcrSamplerHelper::VkYcbcrSamplerHelper(GrContext* context) : fContext(context) {
|
||||
SkASSERT_RELEASE(context->backend() == GrBackendApi::kVulkan);
|
||||
VkYcbcrSamplerHelper::VkYcbcrSamplerHelper(GrDirectContext* dContext) : fDContext(dContext) {
|
||||
SkASSERT_RELEASE(dContext->backend() == GrBackendApi::kVulkan);
|
||||
}
|
||||
|
||||
VkYcbcrSamplerHelper::~VkYcbcrSamplerHelper() {
|
||||
|
@ -21,7 +21,7 @@ class GrVkGpu;
|
||||
// particularly interesting because its sampler is immutable.
|
||||
class VkYcbcrSamplerHelper {
|
||||
public:
|
||||
VkYcbcrSamplerHelper(GrContext*);
|
||||
VkYcbcrSamplerHelper(GrDirectContext*);
|
||||
~VkYcbcrSamplerHelper();
|
||||
|
||||
bool isYCbCrSupported();
|
||||
@ -36,7 +36,7 @@ public:
|
||||
private:
|
||||
GrVkGpu* vkGpu();
|
||||
|
||||
GrContext* fContext;
|
||||
GrDirectContext* fDContext;
|
||||
|
||||
VkImage fImage = VK_NULL_HANDLE;
|
||||
VkDeviceMemory fImageMemory = VK_NULL_HANDLE;
|
||||
|
Loading…
Reference in New Issue
Block a user