Clean up GrContext references in the src/gpu
This CL tries to remove all uses of GrContext - replacing them with either GrDirectContext or GrRecordingContext. Preferring the recording context wherever possible. Change-Id: I61af94928aa37bc82ff9923acffd57586610f695 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/302904 Commit-Queue: Robert Phillips <robertphillips@google.com> Reviewed-by: Adlai Holler <adlai@google.com>
This commit is contained in:
parent
2b4404b14b
commit
4e105e2e06
@ -7,7 +7,7 @@
|
||||
*/
|
||||
|
||||
#include "include/gpu/GrBackendSurface.h"
|
||||
#include "include/gpu/GrContext.h"
|
||||
#include "include/gpu/GrDirectContext.h"
|
||||
#include "SDL.h"
|
||||
#include "include/core/SkCanvas.h"
|
||||
#include "include/core/SkFont.h"
|
||||
@ -198,7 +198,7 @@ int main(int argc, char** argv) {
|
||||
auto interface = GrGLMakeNativeInterface();
|
||||
|
||||
// setup contexts
|
||||
sk_sp<GrContext> grContext(GrContext::MakeGL(interface));
|
||||
sk_sp<GrDirectContext> grContext(GrDirectContext::MakeGL(interface));
|
||||
SkASSERT(grContext);
|
||||
|
||||
// Wrap the frame buffer object attached to the screen in a Skia render target so Skia can
|
||||
|
@ -5,7 +5,7 @@
|
||||
* found in the LICENSE file.
|
||||
*/
|
||||
|
||||
#include "include/gpu/GrContext.h"
|
||||
#include "include/gpu/GrDirectContext.h"
|
||||
#include "include/gpu/GrRecordingContext.h"
|
||||
#include "src/core/SkMessageBus.h"
|
||||
#include "src/gpu/GrBackendTextureImageGenerator.h"
|
||||
@ -45,7 +45,7 @@ std::unique_ptr<SkImageGenerator>
|
||||
GrBackendTextureImageGenerator::Make(sk_sp<GrTexture> texture, GrSurfaceOrigin origin,
|
||||
std::unique_ptr<GrSemaphore> semaphore, SkColorType colorType,
|
||||
SkAlphaType alphaType, sk_sp<SkColorSpace> colorSpace) {
|
||||
GrContext* context = texture->getContext();
|
||||
GrDirectContext* context = texture->getContext();
|
||||
|
||||
// Attach our texture to this context's resource cache. This ensures that deletion will happen
|
||||
// in the correct thread/context. This adds the only ref to the texture that will persist from
|
||||
|
@ -11,7 +11,6 @@
|
||||
#include "include/private/GrTypesPriv.h"
|
||||
|
||||
class GrClip;
|
||||
class GrContext;
|
||||
class GrPaint;
|
||||
class GrRecordingContext;
|
||||
class GrRenderTarget;
|
||||
|
@ -13,8 +13,6 @@
|
||||
#include "src/gpu/GrAppliedClip.h"
|
||||
#include "src/gpu/GrRenderTargetContext.h"
|
||||
|
||||
class GrContext;
|
||||
|
||||
/**
|
||||
* GrClip is an abstract base class for applying a clip. It constructs a clip mask if necessary, and
|
||||
* fills out a GrAppliedClip instructing the caller on how to set up the draw state.
|
||||
|
@ -32,7 +32,7 @@ public:
|
||||
bool hasUserStencilSettings, GrAppliedClip* out, SkRect* bounds) const final;
|
||||
PreClipResult preApply(const SkRect& drawBounds) const final;
|
||||
|
||||
sk_sp<GrTextureProxy> testingOnly_createClipMask(GrContext*) const;
|
||||
sk_sp<GrTextureProxy> testingOnly_createClipMask(GrRecordingContext*) const;
|
||||
static const char kMaskTestTag[];
|
||||
|
||||
private:
|
||||
|
@ -5,7 +5,7 @@
|
||||
* found in the LICENSE file.
|
||||
*/
|
||||
|
||||
#include "include/gpu/GrContext.h"
|
||||
#include "include/gpu/GrDirectContext.h"
|
||||
|
||||
#include "include/core/SkDeferredDisplayList.h"
|
||||
#include "include/core/SkTraceMemoryDump.h"
|
||||
@ -464,7 +464,7 @@ GrBackendTexture GrContext::createBackendTexture(const SkSurfaceCharacterization
|
||||
}
|
||||
|
||||
static GrBackendTexture create_and_update_backend_texture(
|
||||
GrContext* context,
|
||||
GrDirectContext* context,
|
||||
SkISize dimensions,
|
||||
const GrBackendFormat& backendFormat,
|
||||
GrMipMapped mipMapped,
|
||||
@ -521,8 +521,8 @@ GrBackendTexture GrContext::createBackendTexture(const SkSurfaceCharacterization
|
||||
|
||||
GrGpu::BackendTextureData data(color);
|
||||
GrBackendTexture result = create_and_update_backend_texture(
|
||||
this, {c.width(), c.height()}, format, GrMipMapped(c.isMipMapped()), GrRenderable::kYes,
|
||||
c.isProtected(), std::move(finishedCallback), &data);
|
||||
this->asDirectContext(), {c.width(), c.height()}, format, GrMipMapped(c.isMipMapped()),
|
||||
GrRenderable::kYes, c.isProtected(), std::move(finishedCallback), &data);
|
||||
|
||||
SkASSERT(c.isCompatible(result));
|
||||
return result;
|
||||
@ -551,9 +551,9 @@ GrBackendTexture GrContext::createBackendTexture(int width, int height,
|
||||
}
|
||||
|
||||
GrGpu::BackendTextureData data(color);
|
||||
return create_and_update_backend_texture(this, {width, height}, backendFormat, mipMapped,
|
||||
renderable, isProtected, std::move(finishedCallback),
|
||||
&data);
|
||||
return create_and_update_backend_texture(this->asDirectContext(), {width, height},
|
||||
backendFormat, mipMapped, renderable, isProtected,
|
||||
std::move(finishedCallback), &data);
|
||||
}
|
||||
|
||||
GrBackendTexture GrContext::createBackendTexture(int width, int height,
|
||||
@ -586,9 +586,9 @@ GrBackendTexture GrContext::createBackendTexture(int width, int height,
|
||||
SkColor4f swizzledColor = this->caps()->getWriteSwizzle(format, grColorType).applyTo(color);
|
||||
|
||||
GrGpu::BackendTextureData data(swizzledColor);
|
||||
return create_and_update_backend_texture(this, {width, height}, format, mipMapped,
|
||||
renderable, isProtected, std::move(finishedCallback),
|
||||
&data);
|
||||
return create_and_update_backend_texture(this->asDirectContext(), {width, height}, format,
|
||||
mipMapped, renderable, isProtected,
|
||||
std::move(finishedCallback), &data);
|
||||
}
|
||||
|
||||
GrBackendTexture GrContext::createBackendTexture(const SkPixmap srcData[], int numProvidedLevels,
|
||||
@ -632,8 +632,8 @@ GrBackendTexture GrContext::createBackendTexture(const SkPixmap srcData[], int n
|
||||
GrBackendFormat backendFormat = this->defaultBackendFormat(colorType, renderable);
|
||||
|
||||
GrGpu::BackendTextureData data(srcData);
|
||||
return create_and_update_backend_texture(this, {baseWidth, baseHeight}, backendFormat,
|
||||
mipMapped, renderable, isProtected,
|
||||
return create_and_update_backend_texture(this->asDirectContext(), {baseWidth, baseHeight},
|
||||
backendFormat, mipMapped, renderable, isProtected,
|
||||
std::move(finishedCallback), &data);
|
||||
}
|
||||
|
||||
@ -696,7 +696,7 @@ bool GrContext::updateBackendTexture(const GrBackendTexture& backendTexture,
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static GrBackendTexture create_and_update_compressed_backend_texture(
|
||||
GrContext* context,
|
||||
GrDirectContext* context,
|
||||
SkISize dimensions,
|
||||
const GrBackendFormat& backendFormat,
|
||||
GrMipMapped mipMapped,
|
||||
@ -741,8 +741,8 @@ GrBackendTexture GrContext::createCompressedBackendTexture(int width, int height
|
||||
}
|
||||
|
||||
GrGpu::BackendTextureData data(color);
|
||||
return create_and_update_compressed_backend_texture(this, {width, height}, backendFormat,
|
||||
mipMapped, isProtected,
|
||||
return create_and_update_compressed_backend_texture(this->asDirectContext(), {width, height},
|
||||
backendFormat, mipMapped, isProtected,
|
||||
std::move(finishedCallback), &data);
|
||||
}
|
||||
|
||||
@ -783,8 +783,8 @@ GrBackendTexture GrContext::createCompressedBackendTexture(int width, int height
|
||||
}
|
||||
|
||||
GrGpu::BackendTextureData data(compressedData, dataSize);
|
||||
return create_and_update_compressed_backend_texture(this, {width, height}, backendFormat,
|
||||
mipMapped, isProtected,
|
||||
return create_and_update_compressed_backend_texture(this->asDirectContext(), {width, height},
|
||||
backendFormat, mipMapped, isProtected,
|
||||
std::move(finishedCallback), &data);
|
||||
}
|
||||
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include "src/gpu/GrContextPriv.h"
|
||||
|
||||
#include "include/gpu/GrContextThreadSafeProxy.h"
|
||||
#include "include/gpu/GrDirectContext.h"
|
||||
#include "src/gpu/GrAuditTrail.h"
|
||||
#include "src/gpu/GrContextThreadSafeProxyPriv.h"
|
||||
#include "src/gpu/GrDrawingManager.h"
|
||||
@ -181,9 +182,13 @@ void GrContextPriv::testingOnly_flushAndRemoveOnFlushCallbackObject(GrOnFlushCal
|
||||
bool GrContextPriv::validPMUPMConversionExists() {
|
||||
ASSERT_SINGLE_OWNER
|
||||
|
||||
// CONTEXT TODO: remove this downcast when this class becomes GrDirectContextPriv
|
||||
auto direct = GrAsDirectContext(fContext);
|
||||
SkASSERT(direct);
|
||||
|
||||
if (!fContext->fDidTestPMConversions) {
|
||||
fContext->fPMUPMConversionsRoundTrip =
|
||||
GrConfigConversionEffect::TestForPreservingPMConversions(fContext);
|
||||
GrConfigConversionEffect::TestForPreservingPMConversions(direct);
|
||||
fContext->fDidTestPMConversions = true;
|
||||
}
|
||||
|
||||
|
@ -8,7 +8,7 @@
|
||||
#ifndef GrContextPriv_DEFINED
|
||||
#define GrContextPriv_DEFINED
|
||||
|
||||
#include "include/gpu/GrContext.h"
|
||||
#include "include/gpu/GrDirectContext.h"
|
||||
|
||||
class GrAtlasManager;
|
||||
class GrBackendFormat;
|
||||
|
@ -9,7 +9,6 @@
|
||||
#include "src/gpu/GrContextThreadSafeProxyPriv.h"
|
||||
|
||||
#include "include/core/SkSurfaceCharacterization.h"
|
||||
#include "include/gpu/GrContext.h"
|
||||
#include "src/gpu/GrBaseContextPriv.h"
|
||||
#include "src/gpu/GrCaps.h"
|
||||
#include "src/gpu/effects/GrSkSLFP.h"
|
||||
|
@ -7,10 +7,7 @@
|
||||
|
||||
#include "src/gpu/GrDrawOpAtlas.h"
|
||||
|
||||
#include "include/gpu/GrContext.h"
|
||||
#include "src/core/SkOpts.h"
|
||||
#include "src/gpu/GrContextPriv.h"
|
||||
#include "src/gpu/GrGpu.h"
|
||||
#include "src/gpu/GrOnFlushResourceProvider.h"
|
||||
#include "src/gpu/GrOpFlushState.h"
|
||||
#include "src/gpu/GrProxyProvider.h"
|
||||
|
@ -95,7 +95,7 @@ public:
|
||||
|
||||
void flushIfNecessary();
|
||||
|
||||
static bool ProgramUnitTest(GrContext* context, int maxStages, int maxLevels);
|
||||
static bool ProgramUnitTest(GrDirectContext*, int maxStages, int maxLevels);
|
||||
|
||||
GrSemaphoresSubmitted flushSurfaces(GrSurfaceProxy* proxies[],
|
||||
int cnt,
|
||||
|
@ -109,7 +109,7 @@ SkString GrGpuResource::getResourceName() const {
|
||||
return resourceName;
|
||||
}
|
||||
|
||||
const GrContext* GrGpuResource::getContext() const {
|
||||
const GrDirectContext* GrGpuResource::getContext() const {
|
||||
if (fGpu) {
|
||||
return fGpu->getContext();
|
||||
} else {
|
||||
@ -117,7 +117,7 @@ const GrContext* GrGpuResource::getContext() const {
|
||||
}
|
||||
}
|
||||
|
||||
GrContext* GrGpuResource::getContext() {
|
||||
GrDirectContext* GrGpuResource::getContext() {
|
||||
if (fGpu) {
|
||||
return fGpu->getContext();
|
||||
} else {
|
||||
|
@ -12,7 +12,6 @@
|
||||
#include "include/private/GrTypesPriv.h"
|
||||
#include "include/private/SkNoncopyable.h"
|
||||
|
||||
class GrContext;
|
||||
class GrGpu;
|
||||
class GrResourceCache;
|
||||
class SkTraceMemoryDump;
|
||||
@ -105,8 +104,8 @@ public:
|
||||
* they no longer have an owning context. Destroying a GrContext
|
||||
* automatically releases all its resources.
|
||||
*/
|
||||
const GrContext* getContext() const;
|
||||
GrContext* getContext();
|
||||
const GrDirectContext* getContext() const;
|
||||
GrDirectContext* getContext();
|
||||
|
||||
/**
|
||||
* Retrieves the amount of GPU memory used by this resource in bytes. It is
|
||||
|
@ -8,9 +8,7 @@
|
||||
#include "src/gpu/GrOpsRenderPass.h"
|
||||
|
||||
#include "include/core/SkRect.h"
|
||||
#include "include/gpu/GrContext.h"
|
||||
#include "src/gpu/GrCaps.h"
|
||||
#include "src/gpu/GrContextPriv.h"
|
||||
#include "src/gpu/GrCpuBuffer.h"
|
||||
#include "src/gpu/GrGpu.h"
|
||||
#include "src/gpu/GrPrimitiveProcessor.h"
|
||||
|
@ -15,7 +15,6 @@
|
||||
#include "include/private/SkNoncopyable.h"
|
||||
#include "include/private/SkTArray.h"
|
||||
|
||||
class GrContext;
|
||||
class GrCoverageCountingPathRenderer;
|
||||
|
||||
/**
|
||||
|
@ -5,9 +5,7 @@
|
||||
* found in the LICENSE file.
|
||||
*/
|
||||
|
||||
#include "include/gpu/GrContext.h"
|
||||
#include "include/private/SkSpinlock.h"
|
||||
#include "src/gpu/GrContextPriv.h"
|
||||
#include "src/gpu/GrGeometryProcessor.h"
|
||||
#include "src/gpu/GrMemoryPool.h"
|
||||
#include "src/gpu/GrProcessor.h"
|
||||
|
@ -18,7 +18,6 @@
|
||||
#include "src/gpu/GrSurfaceProxyPriv.h"
|
||||
#include "src/gpu/GrTextureProxy.h"
|
||||
|
||||
class GrContext;
|
||||
class GrResourceProvider;
|
||||
|
||||
/**
|
||||
|
@ -7,14 +7,14 @@
|
||||
|
||||
#include "src/gpu/GrProcessorUnitTest.h"
|
||||
|
||||
#include "include/gpu/GrContext.h"
|
||||
#include "src/gpu/GrContextPriv.h"
|
||||
#include "include/gpu/GrRecordingContext.h"
|
||||
#include "src/gpu/GrFragmentProcessor.h"
|
||||
#include "src/gpu/GrRecordingContextPriv.h"
|
||||
|
||||
#if GR_TEST_UTILS
|
||||
|
||||
GrProcessorTestData::GrProcessorTestData(SkRandom* random,
|
||||
GrContext* context,
|
||||
GrRecordingContext* context,
|
||||
int numViews,
|
||||
const ViewInfo views[])
|
||||
: fRandom(random), fContext(context) {
|
||||
@ -22,9 +22,6 @@ GrProcessorTestData::GrProcessorTestData(SkRandom* random,
|
||||
fArena = std::unique_ptr<SkArenaAlloc>(new SkArenaAlloc(1000));
|
||||
}
|
||||
|
||||
GrResourceProvider* GrProcessorTestData::resourceProvider() {
|
||||
return fContext->priv().resourceProvider();
|
||||
}
|
||||
|
||||
GrProxyProvider* GrProcessorTestData::proxyProvider() { return fContext->priv().proxyProvider(); }
|
||||
|
||||
|
@ -21,7 +21,6 @@
|
||||
|
||||
class SkMatrix;
|
||||
class GrCaps;
|
||||
class GrContext;
|
||||
class GrProxyProvider;
|
||||
class GrRenderTargetContext;
|
||||
class GrProcessorTestData;
|
||||
@ -53,10 +52,9 @@ std::unique_ptr<GrFragmentProcessor> MakeChildFP(GrProcessorTestData*);
|
||||
class GrProcessorTestData {
|
||||
public:
|
||||
using ViewInfo = std::tuple<GrSurfaceProxyView, GrColorType, SkAlphaType>;
|
||||
GrProcessorTestData(SkRandom* random, GrContext* context, int numProxies, const ViewInfo[]);
|
||||
GrProcessorTestData(SkRandom*, GrRecordingContext*, int numProxies, const ViewInfo[]);
|
||||
|
||||
GrContext* context() { return fContext; }
|
||||
GrResourceProvider* resourceProvider();
|
||||
GrRecordingContext* context() { return fContext; }
|
||||
GrProxyProvider* proxyProvider();
|
||||
const GrCaps* caps();
|
||||
SkArenaAlloc* allocator() { return fArena.get(); }
|
||||
@ -67,7 +65,7 @@ public:
|
||||
SkRandom* fRandom;
|
||||
|
||||
private:
|
||||
GrContext* fContext;
|
||||
GrRecordingContext* fContext;
|
||||
SkTArray<ViewInfo> fViews;
|
||||
std::unique_ptr<SkArenaAlloc> fArena;
|
||||
};
|
||||
|
@ -8,9 +8,7 @@
|
||||
|
||||
#include "src/gpu/GrRenderTarget.h"
|
||||
|
||||
#include "include/gpu/GrContext.h"
|
||||
#include "src/core/SkRectPriv.h"
|
||||
#include "src/gpu/GrContextPriv.h"
|
||||
#include "src/gpu/GrGpu.h"
|
||||
#include "src/gpu/GrRenderTargetContext.h"
|
||||
#include "src/gpu/GrRenderTargetPriv.h"
|
||||
|
@ -7,10 +7,8 @@
|
||||
|
||||
#include "src/gpu/GrRenderTargetProxy.h"
|
||||
|
||||
#include "include/gpu/GrContext.h"
|
||||
#include "src/core/SkMathPriv.h"
|
||||
#include "src/gpu/GrCaps.h"
|
||||
#include "src/gpu/GrContextPriv.h"
|
||||
#include "src/gpu/GrGpuResourcePriv.h"
|
||||
#include "src/gpu/GrOpsTask.h"
|
||||
#include "src/gpu/GrRenderTargetPriv.h"
|
||||
@ -18,6 +16,11 @@
|
||||
#include "src/gpu/GrSurfacePriv.h"
|
||||
#include "src/gpu/GrTextureRenderTargetProxy.h"
|
||||
|
||||
#ifdef SK_DEBUG
|
||||
#include "include/gpu/GrDirectContext.h"
|
||||
#include "src/gpu/GrContextPriv.h"
|
||||
#endif
|
||||
|
||||
// Deferred version
|
||||
// TODO: we can probably munge the 'desc' in both the wrapped and deferred
|
||||
// cases to make the sampleConfig/numSamples stuff more rational.
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
#include "src/gpu/GrResourceCache.h"
|
||||
#include <atomic>
|
||||
#include "include/gpu/GrContext.h"
|
||||
#include "include/gpu/GrDirectContext.h"
|
||||
#include "include/private/GrSingleOwner.h"
|
||||
#include "include/private/SkTo.h"
|
||||
#include "include/utils/SkRandom.h"
|
||||
|
@ -8,13 +8,11 @@
|
||||
#include "src/gpu/GrResourceProvider.h"
|
||||
|
||||
#include "include/gpu/GrBackendSemaphore.h"
|
||||
#include "include/gpu/GrContext.h"
|
||||
#include "include/private/GrResourceKey.h"
|
||||
#include "include/private/GrSingleOwner.h"
|
||||
#include "src/core/SkConvertPixels.h"
|
||||
#include "src/core/SkMathPriv.h"
|
||||
#include "src/gpu/GrCaps.h"
|
||||
#include "src/gpu/GrContextPriv.h"
|
||||
#include "src/gpu/GrDataUtils.h"
|
||||
#include "src/gpu/GrGpu.h"
|
||||
#include "src/gpu/GrGpuBuffer.h"
|
||||
|
@ -5,7 +5,6 @@
|
||||
* found in the LICENSE file.
|
||||
*/
|
||||
|
||||
#include "include/gpu/GrContext.h"
|
||||
#include "src/core/SkCompressedDataUtils.h"
|
||||
#include "src/gpu/GrBackendUtils.h"
|
||||
#include "src/gpu/GrRenderTarget.h"
|
||||
|
@ -8,13 +8,11 @@
|
||||
#include "src/gpu/GrSurfaceProxy.h"
|
||||
#include "src/gpu/GrSurfaceProxyPriv.h"
|
||||
|
||||
#include "include/gpu/GrContext.h"
|
||||
#include "include/gpu/GrRecordingContext.h"
|
||||
#include "src/core/SkMathPriv.h"
|
||||
#include "src/core/SkMipmap.h"
|
||||
#include "src/gpu/GrCaps.h"
|
||||
#include "src/gpu/GrClip.h"
|
||||
#include "src/gpu/GrContextPriv.h"
|
||||
#include "src/gpu/GrGpuResourcePriv.h"
|
||||
#include "src/gpu/GrOpsTask.h"
|
||||
#include "src/gpu/GrProxyProvider.h"
|
||||
@ -26,6 +24,8 @@
|
||||
#include "src/gpu/GrTextureRenderTargetProxy.h"
|
||||
|
||||
#ifdef SK_DEBUG
|
||||
#include "include/gpu/GrDirectContext.h"
|
||||
#include "src/gpu/GrContextPriv.h"
|
||||
#include "src/gpu/GrRenderTarget.h"
|
||||
#include "src/gpu/GrRenderTargetPriv.h"
|
||||
|
||||
|
@ -10,7 +10,6 @@
|
||||
#include "include/core/SkMatrix.h"
|
||||
#include "include/core/SkPath.h"
|
||||
#include "include/core/SkRRect.h"
|
||||
#include "include/gpu/GrContext.h"
|
||||
#include "src/core/SkRectPriv.h"
|
||||
#include "src/gpu/GrColorInfo.h"
|
||||
#include "src/gpu/GrProcessorUnitTest.h"
|
||||
|
@ -7,18 +7,21 @@
|
||||
|
||||
#include "include/core/SkMath.h"
|
||||
#include "include/core/SkTypes.h"
|
||||
#include "include/gpu/GrContext.h"
|
||||
#include "include/gpu/GrTypes.h"
|
||||
#include "include/private/GrResourceKey.h"
|
||||
#include "src/core/SkMipmap.h"
|
||||
#include "src/gpu/GrCaps.h"
|
||||
#include "src/gpu/GrContextPriv.h"
|
||||
#include "src/gpu/GrGpu.h"
|
||||
#include "src/gpu/GrRenderTarget.h"
|
||||
#include "src/gpu/GrSurfacePriv.h"
|
||||
#include "src/gpu/GrTexture.h"
|
||||
#include "src/gpu/GrTexturePriv.h"
|
||||
|
||||
#ifdef SK_DEBUG
|
||||
#include "include/gpu/GrDirectContext.h"
|
||||
#include "src/gpu/GrContextPriv.h"
|
||||
#endif
|
||||
|
||||
void GrTexture::markMipMapsDirty() {
|
||||
if (GrMipMapsStatus::kValid == fMipMapsStatus) {
|
||||
fMipMapsStatus = GrMipMapsStatus::kDirty;
|
||||
|
@ -8,7 +8,7 @@
|
||||
#include "src/gpu/GrTextureProxy.h"
|
||||
#include "src/gpu/GrTextureProxyPriv.h"
|
||||
|
||||
#include "include/gpu/GrContext.h"
|
||||
#include "include/gpu/GrDirectContext.h"
|
||||
#include "src/gpu/GrContextPriv.h"
|
||||
#include "src/gpu/GrDeferredProxyUploader.h"
|
||||
#include "src/gpu/GrProxyProvider.h"
|
||||
|
@ -8,7 +8,6 @@
|
||||
#include "src/gpu/GrTextureRenderTargetProxy.h"
|
||||
|
||||
#include "src/gpu/GrCaps.h"
|
||||
#include "src/gpu/GrContextPriv.h"
|
||||
#include "src/gpu/GrRenderTarget.h"
|
||||
#include "src/gpu/GrRenderTargetProxyPriv.h"
|
||||
#include "src/gpu/GrSurfacePriv.h"
|
||||
@ -17,6 +16,11 @@
|
||||
#include "src/gpu/GrTexturePriv.h"
|
||||
#include "src/gpu/GrTextureProxyPriv.h"
|
||||
|
||||
#ifdef SK_DEBUG
|
||||
#include "include/gpu/GrDirectContext.h"
|
||||
#include "src/gpu/GrContextPriv.h"
|
||||
#endif
|
||||
|
||||
// Deferred version
|
||||
// This class is virtually derived from GrSurfaceProxy (via both GrTextureProxy and
|
||||
// GrRenderTargetProxy) so its constructor must be explicitly called.
|
||||
|
@ -12,8 +12,6 @@
|
||||
|
||||
#include "src/gpu/GrAuditTrail.h"
|
||||
|
||||
class GrContext;
|
||||
|
||||
/**
|
||||
* Context level GrTracing macros, classname and op are const char*, context is GrContext
|
||||
*/
|
||||
|
@ -12,7 +12,6 @@
|
||||
#include "include/core/SkData.h"
|
||||
#include "include/core/SkPixelRef.h"
|
||||
#include "include/effects/SkRuntimeEffect.h"
|
||||
#include "include/gpu/GrContext.h"
|
||||
#include "include/gpu/GrRecordingContext.h"
|
||||
#include "include/gpu/GrTypes.h"
|
||||
#include "include/private/SkIDChangeListener.h"
|
||||
@ -32,7 +31,6 @@
|
||||
#include "src/gpu/GrBitmapTextureMaker.h"
|
||||
#include "src/gpu/GrCaps.h"
|
||||
#include "src/gpu/GrColorSpaceXform.h"
|
||||
#include "src/gpu/GrContextPriv.h"
|
||||
#include "src/gpu/GrGpuResourcePriv.h"
|
||||
#include "src/gpu/GrPaint.h"
|
||||
#include "src/gpu/GrProxyProvider.h"
|
||||
|
@ -23,7 +23,6 @@
|
||||
class GrCaps;
|
||||
class GrColorInfo;
|
||||
class GrColorSpaceXform;
|
||||
class GrContext;
|
||||
class GrDirectContext;
|
||||
class GrFragmentProcessor;
|
||||
class GrPaint;
|
||||
|
@ -7,7 +7,6 @@
|
||||
|
||||
#include "src/gpu/d3d/GrD3DOpsRenderPass.h"
|
||||
|
||||
#include "src/gpu/GrContextPriv.h"
|
||||
#include "src/gpu/GrOpFlushState.h"
|
||||
#include "src/gpu/GrProgramDesc.h"
|
||||
#include "src/gpu/GrRenderTargetPriv.h"
|
||||
@ -20,6 +19,11 @@
|
||||
#include "src/gpu/d3d/GrD3DRenderTarget.h"
|
||||
#include "src/gpu/d3d/GrD3DTexture.h"
|
||||
|
||||
#ifdef SK_DEBUG
|
||||
#include "include/gpu/GrDirectContext.h"
|
||||
#include "src/gpu/GrContextPriv.h"
|
||||
#endif
|
||||
|
||||
GrD3DOpsRenderPass::GrD3DOpsRenderPass(GrD3DGpu* gpu) : fGpu(gpu) {}
|
||||
|
||||
bool GrD3DOpsRenderPass::set(GrRenderTarget* rt, GrSurfaceOrigin origin, const SkIRect& bounds,
|
||||
|
@ -8,7 +8,6 @@
|
||||
#include "src/gpu/dawn/GrDawnTextureRenderTarget.h"
|
||||
|
||||
#include "include/core/SkTraceMemoryDump.h"
|
||||
#include "include/gpu/GrContext.h"
|
||||
#include "src/gpu/GrTexturePriv.h"
|
||||
#include "src/gpu/dawn/GrDawnGpu.h"
|
||||
|
||||
|
@ -38,7 +38,6 @@ uniform half4 circleData;
|
||||
}
|
||||
|
||||
@cpp {
|
||||
#include "include/gpu/GrContext.h"
|
||||
#include "include/gpu/GrRecordingContext.h"
|
||||
#include "src/gpu/GrBitmapTextureMaker.h"
|
||||
#include "src/gpu/GrProxyProvider.h"
|
||||
|
@ -8,7 +8,7 @@
|
||||
in fragmentProcessor inputFP;
|
||||
|
||||
@header {
|
||||
#include "include/gpu/GrContext.h"
|
||||
#include "include/gpu/GrDirectContext.h"
|
||||
#include "src/gpu/GrBitmapTextureMaker.h"
|
||||
#include "src/gpu/GrContextPriv.h"
|
||||
#include "src/gpu/GrImageInfo.h"
|
||||
@ -16,11 +16,11 @@ in fragmentProcessor inputFP;
|
||||
}
|
||||
|
||||
@class {
|
||||
static bool TestForPreservingPMConversions(GrContext* context);
|
||||
static bool TestForPreservingPMConversions(GrDirectContext* context);
|
||||
}
|
||||
|
||||
@cppEnd {
|
||||
bool GrConfigConversionEffect::TestForPreservingPMConversions(GrContext* context) {
|
||||
bool GrConfigConversionEffect::TestForPreservingPMConversions(GrDirectContext* context) {
|
||||
static constexpr int kSize = 256;
|
||||
static constexpr GrColorType kColorType = GrColorType::kRGBA_8888;
|
||||
SkAutoTMalloc<uint32_t> data(kSize * kSize * 3);
|
||||
|
@ -484,7 +484,7 @@ std::unique_ptr<GrFragmentProcessor> GrMatrixConvolutionEffect::TestCreate(GrPro
|
||||
auto wm = static_cast<GrSamplerState::WrapMode>(
|
||||
d->fRandom->nextULessThan(GrSamplerState::kWrapModeCount));
|
||||
bool convolveAlpha = d->fRandom->nextBool();
|
||||
return GrMatrixConvolutionEffect::Make(d->context()->priv().asRecordingContext(),
|
||||
return GrMatrixConvolutionEffect::Make(d->context(),
|
||||
std::move(view),
|
||||
bounds,
|
||||
kernelSize,
|
||||
|
@ -14,7 +14,6 @@ layout(ctype=SkRect) uniform float4 proxyRect;
|
||||
uniform half blurRadius;
|
||||
|
||||
@header {
|
||||
#include "include/gpu/GrContext.h"
|
||||
#include "include/gpu/GrRecordingContext.h"
|
||||
#include "src/core/SkBlurPriv.h"
|
||||
#include "src/core/SkGpuBlurUtils.h"
|
||||
|
@ -9,7 +9,6 @@
|
||||
#include <cmath>
|
||||
#include "include/core/SkRect.h"
|
||||
#include "include/core/SkScalar.h"
|
||||
#include "include/gpu/GrContext.h"
|
||||
#include "include/gpu/GrRecordingContext.h"
|
||||
#include "src/core/SkBlurMask.h"
|
||||
#include "src/core/SkMathPriv.h"
|
||||
|
@ -261,7 +261,6 @@ GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrSkSLFP);
|
||||
|
||||
#include "include/effects/SkArithmeticImageFilter.h"
|
||||
#include "include/effects/SkOverdrawColorFilter.h"
|
||||
#include "include/gpu/GrContext.h"
|
||||
#include "src/core/SkColorFilterBase.h"
|
||||
#include "src/gpu/effects/generated/GrConstColorProcessor.h"
|
||||
|
||||
|
@ -10,7 +10,6 @@
|
||||
**************************************************************************************************/
|
||||
#include "GrCircleBlurFragmentProcessor.h"
|
||||
|
||||
#include "include/gpu/GrContext.h"
|
||||
#include "include/gpu/GrRecordingContext.h"
|
||||
#include "src/gpu/GrBitmapTextureMaker.h"
|
||||
#include "src/gpu/GrProxyProvider.h"
|
||||
@ -304,19 +303,19 @@ half dist = length(vec) + (0.5 - %s.z) * %s.w;)SkSL",
|
||||
args.fUniformHandler->getUniformCStr(circleDataVar),
|
||||
args.fUniformHandler->getUniformCStr(circleDataVar),
|
||||
args.fUniformHandler->getUniformCStr(circleDataVar));
|
||||
SkString _input13941(args.fInputColor);
|
||||
SkString _sample13941 = this->invokeChild(0, _input13941.c_str(), args);
|
||||
SkString _input13902(args.fInputColor);
|
||||
SkString _sample13902 = this->invokeChild(0, _input13902.c_str(), args);
|
||||
fragBuilder->codeAppendf(
|
||||
R"SkSL(
|
||||
half4 inputColor = %s;)SkSL",
|
||||
_sample13941.c_str());
|
||||
SkString _coords14001("float2(half2(dist, 0.5))");
|
||||
SkString _sample14001 = this->invokeChild(1, args, _coords14001.c_str());
|
||||
_sample13902.c_str());
|
||||
SkString _coords13962("float2(half2(dist, 0.5))");
|
||||
SkString _sample13962 = this->invokeChild(1, args, _coords13962.c_str());
|
||||
fragBuilder->codeAppendf(
|
||||
R"SkSL(
|
||||
%s = inputColor * %s.w;
|
||||
)SkSL",
|
||||
args.fOutputColor, _sample14001.c_str());
|
||||
args.fOutputColor, _sample13962.c_str());
|
||||
}
|
||||
|
||||
private:
|
||||
|
@ -27,7 +27,7 @@ public:
|
||||
(void)pmConversion;
|
||||
|
||||
fragBuilder->forceHighPrecision();
|
||||
SkString _sample5730 = this->invokeChild(0, args);
|
||||
SkString _sample5748 = this->invokeChild(0, args);
|
||||
fragBuilder->codeAppendf(
|
||||
R"SkSL(%s = floor(%s * 255.0 + 0.5) / 255.0;
|
||||
@switch (%d) {
|
||||
@ -39,7 +39,7 @@ public:
|
||||
break;
|
||||
}
|
||||
)SkSL",
|
||||
args.fOutputColor, _sample5730.c_str(), (int)_outer.pmConversion, args.fOutputColor,
|
||||
args.fOutputColor, _sample5748.c_str(), (int)_outer.pmConversion, args.fOutputColor,
|
||||
args.fOutputColor, args.fOutputColor, args.fOutputColor, args.fOutputColor,
|
||||
args.fOutputColor, args.fOutputColor);
|
||||
}
|
||||
@ -80,7 +80,7 @@ std::unique_ptr<GrFragmentProcessor> GrConfigConversionEffect::TestCreate(
|
||||
}
|
||||
#endif
|
||||
|
||||
bool GrConfigConversionEffect::TestForPreservingPMConversions(GrContext* context) {
|
||||
bool GrConfigConversionEffect::TestForPreservingPMConversions(GrDirectContext* context) {
|
||||
static constexpr int kSize = 256;
|
||||
static constexpr GrColorType kColorType = GrColorType::kRGBA_8888;
|
||||
SkAutoTMalloc<uint32_t> data(kSize * kSize * 3);
|
||||
|
@ -14,7 +14,7 @@
|
||||
#include "include/core/SkM44.h"
|
||||
#include "include/core/SkTypes.h"
|
||||
|
||||
#include "include/gpu/GrContext.h"
|
||||
#include "include/gpu/GrDirectContext.h"
|
||||
#include "src/gpu/GrBitmapTextureMaker.h"
|
||||
#include "src/gpu/GrContextPriv.h"
|
||||
#include "src/gpu/GrImageInfo.h"
|
||||
@ -24,7 +24,7 @@
|
||||
|
||||
class GrConfigConversionEffect : public GrFragmentProcessor {
|
||||
public:
|
||||
static bool TestForPreservingPMConversions(GrContext* context);
|
||||
static bool TestForPreservingPMConversions(GrDirectContext* context);
|
||||
|
||||
static std::unique_ptr<GrFragmentProcessor> Make(std::unique_ptr<GrFragmentProcessor> fp,
|
||||
PMConversion pmConversion) {
|
||||
|
@ -94,19 +94,19 @@ half2 texCoord = translatedFragPos / proxyDims;)SkSL",
|
||||
args.fUniformHandler->getUniformCStr(proxyRectVar),
|
||||
args.fUniformHandler->getUniformCStr(blurRadiusVar),
|
||||
args.fUniformHandler->getUniformCStr(cornerRadiusVar));
|
||||
SkString _input9600(args.fInputColor);
|
||||
SkString _sample9600 = this->invokeChild(0, _input9600.c_str(), args);
|
||||
SkString _input9561(args.fInputColor);
|
||||
SkString _sample9561 = this->invokeChild(0, _input9561.c_str(), args);
|
||||
fragBuilder->codeAppendf(
|
||||
R"SkSL(
|
||||
half4 inputColor = %s;)SkSL",
|
||||
_sample9600.c_str());
|
||||
SkString _coords9660("float2(texCoord)");
|
||||
SkString _sample9660 = this->invokeChild(1, args, _coords9660.c_str());
|
||||
_sample9561.c_str());
|
||||
SkString _coords9621("float2(texCoord)");
|
||||
SkString _sample9621 = this->invokeChild(1, args, _coords9621.c_str());
|
||||
fragBuilder->codeAppendf(
|
||||
R"SkSL(
|
||||
%s = inputColor * %s;
|
||||
)SkSL",
|
||||
args.fOutputColor, _sample9660.c_str());
|
||||
args.fOutputColor, _sample9621.c_str());
|
||||
}
|
||||
|
||||
private:
|
||||
|
@ -14,7 +14,6 @@
|
||||
#include "include/core/SkM44.h"
|
||||
#include "include/core/SkTypes.h"
|
||||
|
||||
#include "include/gpu/GrContext.h"
|
||||
#include "include/gpu/GrRecordingContext.h"
|
||||
#include "src/core/SkBlurPriv.h"
|
||||
#include "src/core/SkGpuBlurUtils.h"
|
||||
|
@ -53,14 +53,14 @@ half xCoverage, yCoverage;
|
||||
rectFVar.isValid() ? args.fUniformHandler->getUniformCStr(rectFVar) : "float4(0)",
|
||||
rectHVar.isValid() ? args.fUniformHandler->getUniformCStr(rectHVar) : "half4(0)",
|
||||
rectHVar.isValid() ? args.fUniformHandler->getUniformCStr(rectHVar) : "half4(0)");
|
||||
SkString _coords7211("float2(half2(xy.x, 0.5))");
|
||||
SkString _sample7211 = this->invokeChild(1, args, _coords7211.c_str());
|
||||
SkString _coords7176("float2(half2(xy.x, 0.5))");
|
||||
SkString _sample7176 = this->invokeChild(1, args, _coords7176.c_str());
|
||||
fragBuilder->codeAppendf(
|
||||
R"SkSL(
|
||||
xCoverage = %s.w;)SkSL",
|
||||
_sample7211.c_str());
|
||||
SkString _coords7269("float2(half2(xy.y, 0.5))");
|
||||
SkString _sample7269 = this->invokeChild(1, args, _coords7269.c_str());
|
||||
_sample7176.c_str());
|
||||
SkString _coords7234("float2(half2(xy.y, 0.5))");
|
||||
SkString _sample7234 = this->invokeChild(1, args, _coords7234.c_str());
|
||||
fragBuilder->codeAppendf(
|
||||
R"SkSL(
|
||||
yCoverage = %s.w;
|
||||
@ -73,36 +73,36 @@ half xCoverage, yCoverage;
|
||||
rect.xy = half2(float2(%s.xy) - sk_FragCoord.xy);
|
||||
rect.zw = half2(sk_FragCoord.xy - float2(%s.zw));
|
||||
})SkSL",
|
||||
_sample7269.c_str(),
|
||||
_sample7234.c_str(),
|
||||
rectFVar.isValid() ? args.fUniformHandler->getUniformCStr(rectFVar) : "float4(0)",
|
||||
rectFVar.isValid() ? args.fUniformHandler->getUniformCStr(rectFVar) : "float4(0)",
|
||||
rectHVar.isValid() ? args.fUniformHandler->getUniformCStr(rectHVar) : "half4(0)",
|
||||
rectHVar.isValid() ? args.fUniformHandler->getUniformCStr(rectHVar) : "half4(0)");
|
||||
SkString _coords8636("float2(half2(rect.x, 0.5))");
|
||||
SkString _sample8636 = this->invokeChild(1, args, _coords8636.c_str());
|
||||
SkString _coords8699("float2(half2(rect.z, 0.5))");
|
||||
SkString _sample8699 = this->invokeChild(1, args, _coords8699.c_str());
|
||||
SkString _coords8601("float2(half2(rect.x, 0.5))");
|
||||
SkString _sample8601 = this->invokeChild(1, args, _coords8601.c_str());
|
||||
SkString _coords8664("float2(half2(rect.z, 0.5))");
|
||||
SkString _sample8664 = this->invokeChild(1, args, _coords8664.c_str());
|
||||
fragBuilder->codeAppendf(
|
||||
R"SkSL(
|
||||
xCoverage = (1.0 - %s.w) - %s.w;)SkSL",
|
||||
_sample8636.c_str(), _sample8699.c_str());
|
||||
SkString _coords8763("float2(half2(rect.y, 0.5))");
|
||||
SkString _sample8763 = this->invokeChild(1, args, _coords8763.c_str());
|
||||
SkString _coords8826("float2(half2(rect.w, 0.5))");
|
||||
SkString _sample8826 = this->invokeChild(1, args, _coords8826.c_str());
|
||||
_sample8601.c_str(), _sample8664.c_str());
|
||||
SkString _coords8728("float2(half2(rect.y, 0.5))");
|
||||
SkString _sample8728 = this->invokeChild(1, args, _coords8728.c_str());
|
||||
SkString _coords8791("float2(half2(rect.w, 0.5))");
|
||||
SkString _sample8791 = this->invokeChild(1, args, _coords8791.c_str());
|
||||
fragBuilder->codeAppendf(
|
||||
R"SkSL(
|
||||
yCoverage = (1.0 - %s.w) - %s.w;
|
||||
})SkSL",
|
||||
_sample8763.c_str(), _sample8826.c_str());
|
||||
SkString _input8895(args.fInputColor);
|
||||
SkString _sample8895 = this->invokeChild(0, _input8895.c_str(), args);
|
||||
_sample8728.c_str(), _sample8791.c_str());
|
||||
SkString _input8860(args.fInputColor);
|
||||
SkString _sample8860 = this->invokeChild(0, _input8860.c_str(), args);
|
||||
fragBuilder->codeAppendf(
|
||||
R"SkSL(
|
||||
half4 inputColor = %s;
|
||||
%s = (inputColor * xCoverage) * yCoverage;
|
||||
)SkSL",
|
||||
_sample8895.c_str(), args.fOutputColor);
|
||||
_sample8860.c_str(), args.fOutputColor);
|
||||
}
|
||||
|
||||
private:
|
||||
|
@ -17,7 +17,6 @@
|
||||
#include <cmath>
|
||||
#include "include/core/SkRect.h"
|
||||
#include "include/core/SkScalar.h"
|
||||
#include "include/gpu/GrContext.h"
|
||||
#include "include/gpu/GrRecordingContext.h"
|
||||
#include "src/core/SkBlurMask.h"
|
||||
#include "src/core/SkMathPriv.h"
|
||||
|
@ -7,10 +7,14 @@
|
||||
|
||||
#include "src/gpu/gl/GrGLOpsRenderPass.h"
|
||||
|
||||
#include "src/gpu/GrContextPriv.h"
|
||||
#include "src/gpu/GrProgramInfo.h"
|
||||
#include "src/gpu/GrRenderTargetPriv.h"
|
||||
|
||||
#ifdef SK_DEBUG
|
||||
#include "include/gpu/GrDirectContext.h"
|
||||
#include "src/gpu/GrContextPriv.h"
|
||||
#endif
|
||||
|
||||
#define GL_CALL(X) GR_GL_CALL(fGpu->glInterface(), X)
|
||||
|
||||
void GrGLOpsRenderPass::set(GrRenderTarget* rt, const SkIRect& contentBounds,
|
||||
|
@ -7,8 +7,6 @@
|
||||
|
||||
#include "src/gpu/mtl/GrMtlPipelineState.h"
|
||||
|
||||
#include "include/gpu/GrContext.h"
|
||||
#include "src/gpu/GrContextPriv.h"
|
||||
#include "src/gpu/GrPipeline.h"
|
||||
#include "src/gpu/GrRenderTarget.h"
|
||||
#include "src/gpu/GrRenderTargetPriv.h"
|
||||
|
@ -203,6 +203,7 @@ void GrAtlasManager::addGlyphToBulkAndSetUseToken(GrDrawOpAtlas::BulkUseTokenUpd
|
||||
}
|
||||
|
||||
#ifdef SK_DEBUG
|
||||
#include "include/gpu/GrDirectContext.h"
|
||||
#include "src/gpu/GrContextPriv.h"
|
||||
#include "src/gpu/GrSurfaceContext.h"
|
||||
#include "src/gpu/GrSurfaceProxy.h"
|
||||
@ -217,7 +218,7 @@ void GrAtlasManager::addGlyphToBulkAndSetUseToken(GrDrawOpAtlas::BulkUseTokenUpd
|
||||
* Write the contents of the surface proxy to a PNG. Returns true if successful.
|
||||
* @param filename Full path to desired file
|
||||
*/
|
||||
static bool save_pixels(GrContext* context, GrSurfaceProxyView view, GrColorType colorType,
|
||||
static bool save_pixels(GrDirectContext* context, GrSurfaceProxyView view, GrColorType colorType,
|
||||
const char* filename) {
|
||||
if (!view.proxy()) {
|
||||
return false;
|
||||
@ -262,7 +263,7 @@ static bool save_pixels(GrContext* context, GrSurfaceProxyView view, GrColorType
|
||||
return true;
|
||||
}
|
||||
|
||||
void GrAtlasManager::dump(GrContext* context) const {
|
||||
void GrAtlasManager::dump(GrDirectContext* context) const {
|
||||
static int gDumpCount = 0;
|
||||
for (int i = 0; i < kMaskFormatCount; ++i) {
|
||||
if (fAtlases[i]) {
|
||||
|
@ -104,7 +104,7 @@ public:
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// Functions intended debug only
|
||||
#ifdef SK_DEBUG
|
||||
void dump(GrContext* context) const;
|
||||
void dump(GrDirectContext*) const;
|
||||
#endif
|
||||
|
||||
void setAtlasDimensionsToMinimum_ForTesting();
|
||||
|
@ -6,7 +6,6 @@
|
||||
*/
|
||||
|
||||
#include "include/core/SkColorFilter.h"
|
||||
#include "include/gpu/GrContext.h"
|
||||
#include "include/gpu/GrRecordingContext.h"
|
||||
#include "include/private/SkTemplates.h"
|
||||
#include "src/core/SkMaskFilterBase.h"
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include "include/core/SkDrawable.h"
|
||||
#include "include/core/SkRect.h"
|
||||
#include "include/gpu/GrBackendDrawableInfo.h"
|
||||
#include "include/gpu/GrDirectContext.h"
|
||||
#include "src/gpu/GrContextPriv.h"
|
||||
#include "src/gpu/GrOpFlushState.h"
|
||||
#include "src/gpu/GrPipeline.h"
|
||||
|
@ -7,9 +7,7 @@
|
||||
|
||||
#include "src/gpu/vk/GrVkPipelineState.h"
|
||||
|
||||
#include "include/gpu/GrContext.h"
|
||||
#include "src/core/SkMipmap.h"
|
||||
#include "src/gpu/GrContextPriv.h"
|
||||
#include "src/gpu/GrPipeline.h"
|
||||
#include "src/gpu/GrRenderTarget.h"
|
||||
#include "src/gpu/GrTexturePriv.h"
|
||||
|
@ -19,7 +19,7 @@
|
||||
#include "src/gpu/GrRenderTargetContext.h"
|
||||
#include "src/gpu/SkGpuDevice.h"
|
||||
|
||||
sk_sp<GrVkSecondaryCBDrawContext> GrVkSecondaryCBDrawContext::Make(GrContext* ctx,
|
||||
sk_sp<GrVkSecondaryCBDrawContext> GrVkSecondaryCBDrawContext::Make(GrRecordingContext* ctx,
|
||||
const SkImageInfo& imageInfo,
|
||||
const GrVkDrawableInfo& vkInfo,
|
||||
const SkSurfaceProps* props) {
|
||||
|
@ -13,7 +13,7 @@
|
||||
#include "include/core/SkTypes.h"
|
||||
|
||||
class GrBackendSemaphore;
|
||||
class GrContext;
|
||||
class GrRecordingContext;
|
||||
struct GrVkDrawableInfo;
|
||||
class SkCanvas;
|
||||
class SkDeferredDisplayList;
|
||||
@ -57,7 +57,7 @@ class SkSurfaceProps;
|
||||
*/
|
||||
class SK_SPI GrVkSecondaryCBDrawContext : public SkRefCnt {
|
||||
public:
|
||||
static sk_sp<GrVkSecondaryCBDrawContext> Make(GrContext*, const SkImageInfo&,
|
||||
static sk_sp<GrVkSecondaryCBDrawContext> Make(GrRecordingContext*, const SkImageInfo&,
|
||||
const GrVkDrawableInfo&,
|
||||
const SkSurfaceProps* props);
|
||||
|
||||
|
@ -676,7 +676,13 @@ sk_sp<SkImage> SkImage::MakeFromAHardwareBufferWithData(GrContext* context,
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
GrBackendFormat backendFormat = GrAHardwareBufferUtils::GetBackendFormat(context,
|
||||
auto direct = GrAsDirectContext(context);
|
||||
if (!direct) {
|
||||
SkDebugf("Direct context required\n");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
GrBackendFormat backendFormat = GrAHardwareBufferUtils::GetBackendFormat(direct,
|
||||
hardwareBuffer,
|
||||
bufferDesc.format,
|
||||
true);
|
||||
@ -690,7 +696,7 @@ sk_sp<SkImage> SkImage::MakeFromAHardwareBufferWithData(GrContext* context,
|
||||
GrAHardwareBufferUtils::TexImageCtx deleteImageCtx = nullptr;
|
||||
|
||||
GrBackendTexture backendTexture =
|
||||
GrAHardwareBufferUtils::MakeBackendTexture(context, hardwareBuffer,
|
||||
GrAHardwareBufferUtils::MakeBackendTexture(direct, hardwareBuffer,
|
||||
bufferDesc.width, bufferDesc.height,
|
||||
&deleteImageProc, &updateImageProc,
|
||||
&deleteImageCtx, false, backendFormat, true);
|
||||
@ -707,7 +713,7 @@ sk_sp<SkImage> SkImage::MakeFromAHardwareBufferWithData(GrContext* context,
|
||||
|
||||
GrColorType grColorType = SkColorTypeToGrColorType(colorType);
|
||||
|
||||
GrProxyProvider* proxyProvider = context->priv().proxyProvider();
|
||||
GrProxyProvider* proxyProvider = direct->priv().proxyProvider();
|
||||
if (!proxyProvider) {
|
||||
return nullptr;
|
||||
}
|
||||
@ -722,20 +728,20 @@ sk_sp<SkImage> SkImage::MakeFromAHardwareBufferWithData(GrContext* context,
|
||||
sk_sp<SkColorSpace> cs = pixmap.refColorSpace();
|
||||
SkAlphaType at = pixmap.alphaType();
|
||||
|
||||
GrSwizzle swizzle = context->priv().caps()->getReadSwizzle(backendFormat, grColorType);
|
||||
GrSwizzle swizzle = direct->priv().caps()->getReadSwizzle(backendFormat, grColorType);
|
||||
GrSurfaceProxyView view(std::move(proxy), surfaceOrigin, swizzle);
|
||||
sk_sp<SkImage> image = sk_make_sp<SkImage_Gpu>(sk_ref_sp(context), kNeedNewImageUniqueID, view,
|
||||
sk_sp<SkImage> image = sk_make_sp<SkImage_Gpu>(sk_ref_sp(direct), kNeedNewImageUniqueID, view,
|
||||
colorType, at, cs);
|
||||
if (!image) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
GrDrawingManager* drawingManager = context->priv().drawingManager();
|
||||
GrDrawingManager* drawingManager = direct->priv().drawingManager();
|
||||
if (!drawingManager) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
GrSurfaceContext surfaceContext(context, std::move(view),
|
||||
GrSurfaceContext surfaceContext(direct, std::move(view),
|
||||
SkColorTypeToGrColorType(pixmap.colorType()),
|
||||
pixmap.alphaType(), cs);
|
||||
|
||||
|
@ -759,7 +759,13 @@ sk_sp<SkSurface> SkSurface::MakeFromAHardwareBuffer(GrContext* context,
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
GrBackendFormat backendFormat = GrAHardwareBufferUtils::GetBackendFormat(context,
|
||||
auto direct = GrAsDirectContext(context);
|
||||
if (!direct) {
|
||||
SkDebugf("Direct context required\n");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
GrBackendFormat backendFormat = GrAHardwareBufferUtils::GetBackendFormat(direct,
|
||||
hardwareBuffer,
|
||||
bufferDesc.format,
|
||||
true);
|
||||
@ -773,7 +779,7 @@ sk_sp<SkSurface> SkSurface::MakeFromAHardwareBuffer(GrContext* context,
|
||||
GrAHardwareBufferUtils::TexImageCtx deleteImageCtx = nullptr;
|
||||
|
||||
GrBackendTexture backendTexture =
|
||||
GrAHardwareBufferUtils::MakeBackendTexture(context, hardwareBuffer,
|
||||
GrAHardwareBufferUtils::MakeBackendTexture(direct, hardwareBuffer,
|
||||
bufferDesc.width, bufferDesc.height,
|
||||
&deleteImageProc, &updateImageProc,
|
||||
&deleteImageCtx, isProtectedContent,
|
||||
@ -785,7 +791,7 @@ sk_sp<SkSurface> SkSurface::MakeFromAHardwareBuffer(GrContext* context,
|
||||
SkColorType colorType =
|
||||
GrAHardwareBufferUtils::GetSkColorTypeFromBufferFormat(bufferDesc.format);
|
||||
|
||||
sk_sp<SkSurface> surface = SkSurface::MakeFromBackendTexture(context, backendTexture,
|
||||
sk_sp<SkSurface> surface = SkSurface::MakeFromBackendTexture(direct, backendTexture,
|
||||
origin, 0, colorType, std::move(colorSpace), surfaceProps, deleteImageProc,
|
||||
deleteImageCtx);
|
||||
|
||||
@ -804,8 +810,7 @@ sk_sp<SkSurface> SkSurface::MakeFromAHardwareBuffer(GrContext* context,
|
||||
void SkSurface::flushAndSubmit() {
|
||||
this->flush(BackendSurfaceAccess::kNoAccess, GrFlushInfo());
|
||||
|
||||
auto direct = this->recordingContext() ? this->recordingContext()->asDirectContext()
|
||||
: nullptr;
|
||||
auto direct = GrAsDirectContext(this->recordingContext());
|
||||
if (direct) {
|
||||
direct->submit();
|
||||
}
|
||||
|
@ -1546,7 +1546,8 @@ DEF_TEST(ClipStack, reporter) {
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
sk_sp<GrTextureProxy> GrClipStackClip::testingOnly_createClipMask(GrContext* context) const {
|
||||
sk_sp<GrTextureProxy> GrClipStackClip::testingOnly_createClipMask(
|
||||
GrRecordingContext* context) const {
|
||||
const GrReducedClip reducedClip(*fStack, SkRect::MakeWH(512, 512), 0);
|
||||
return this->createSoftwareClipMask(context, reducedClip, nullptr).asTextureProxyRef();
|
||||
}
|
||||
|
@ -253,37 +253,35 @@ static void set_random_color_coverage_stages(GrPaint* paint,
|
||||
#endif
|
||||
|
||||
#if !GR_TEST_UTILS
|
||||
bool GrDrawingManager::ProgramUnitTest(GrContext*, int) { return true; }
|
||||
bool GrDrawingManager::ProgramUnitTest(GrDirectContext*, int) { return true; }
|
||||
#else
|
||||
bool GrDrawingManager::ProgramUnitTest(GrContext* context, int maxStages, int maxLevels) {
|
||||
GrDrawingManager* drawingManager = context->priv().drawingManager();
|
||||
GrProxyProvider* proxyProvider = context->priv().proxyProvider();
|
||||
bool GrDrawingManager::ProgramUnitTest(GrDirectContext* direct, int maxStages, int maxLevels) {
|
||||
GrProxyProvider* proxyProvider = direct->priv().proxyProvider();
|
||||
const GrCaps* caps = direct->priv().caps();
|
||||
|
||||
GrProcessorTestData::ViewInfo views[2];
|
||||
|
||||
// setup dummy textures
|
||||
GrMipMapped mipMapped = GrMipMapped(context->priv().caps()->mipMapSupport());
|
||||
GrMipMapped mipMapped = GrMipMapped(caps->mipMapSupport());
|
||||
{
|
||||
static constexpr SkISize kDummyDims = {34, 18};
|
||||
const GrBackendFormat format =
|
||||
context->priv().caps()->getDefaultBackendFormat(GrColorType::kRGBA_8888,
|
||||
GrRenderable::kYes);
|
||||
const GrBackendFormat format = caps->getDefaultBackendFormat(GrColorType::kRGBA_8888,
|
||||
GrRenderable::kYes);
|
||||
auto proxy = proxyProvider->createProxy(format, kDummyDims, GrRenderable::kYes, 1,
|
||||
mipMapped, SkBackingFit::kExact, SkBudgeted::kNo,
|
||||
GrProtected::kNo, GrInternalSurfaceFlags::kNone);
|
||||
GrSwizzle swizzle = context->priv().caps()->getReadSwizzle(format, GrColorType::kRGBA_8888);
|
||||
GrSwizzle swizzle = caps->getReadSwizzle(format, GrColorType::kRGBA_8888);
|
||||
views[0] = {{std::move(proxy), kBottomLeft_GrSurfaceOrigin, swizzle},
|
||||
GrColorType::kRGBA_8888, kPremul_SkAlphaType};
|
||||
}
|
||||
{
|
||||
static constexpr SkISize kDummyDims = {16, 22};
|
||||
const GrBackendFormat format =
|
||||
context->priv().caps()->getDefaultBackendFormat(GrColorType::kAlpha_8,
|
||||
GrRenderable::kNo);
|
||||
const GrBackendFormat format = caps->getDefaultBackendFormat(GrColorType::kAlpha_8,
|
||||
GrRenderable::kNo);
|
||||
auto proxy = proxyProvider->createProxy(format, kDummyDims, GrRenderable::kNo, 1, mipMapped,
|
||||
SkBackingFit::kExact, SkBudgeted::kNo,
|
||||
GrProtected::kNo, GrInternalSurfaceFlags::kNone);
|
||||
GrSwizzle swizzle = context->priv().caps()->getReadSwizzle(format, GrColorType::kAlpha_8);
|
||||
GrSwizzle swizzle = caps->getReadSwizzle(format, GrColorType::kAlpha_8);
|
||||
views[1] = {{std::move(proxy), kTopLeft_GrSurfaceOrigin, swizzle},
|
||||
GrColorType::kAlpha_8, kPremul_SkAlphaType};
|
||||
}
|
||||
@ -297,28 +295,25 @@ bool GrDrawingManager::ProgramUnitTest(GrContext* context, int maxStages, int ma
|
||||
static const int NUM_TESTS = 1024;
|
||||
for (int t = 0; t < NUM_TESTS; t++) {
|
||||
// setup random render target(can fail)
|
||||
auto renderTargetContext =
|
||||
random_render_target_context(context, &random, context->priv().caps());
|
||||
auto renderTargetContext = random_render_target_context(direct, &random, caps);
|
||||
if (!renderTargetContext) {
|
||||
SkDebugf("Could not allocate renderTargetContext");
|
||||
return false;
|
||||
}
|
||||
|
||||
GrPaint paint;
|
||||
GrProcessorTestData ptd(&random, context, 2, views);
|
||||
GrProcessorTestData ptd(&random, direct, 2, views);
|
||||
set_random_color_coverage_stages(&paint, &ptd, maxStages, maxLevels);
|
||||
set_random_xpf(&paint, &ptd);
|
||||
GrDrawRandomOp(&random, renderTargetContext.get(), std::move(paint));
|
||||
}
|
||||
// Flush everything, test passes if flush is successful(ie, no asserts are hit, no crashes)
|
||||
if (drawingManager->flush(nullptr, 0, SkSurface::BackendSurfaceAccess::kNoAccess,
|
||||
GrFlushInfo(), nullptr)) {
|
||||
drawingManager->submitToGpu(false);
|
||||
}
|
||||
direct->flush(GrFlushInfo());
|
||||
direct->submit(false);
|
||||
|
||||
// Validate that GrFPs work correctly without an input.
|
||||
auto renderTargetContext = GrRenderTargetContext::Make(
|
||||
context, GrColorType::kRGBA_8888, nullptr, SkBackingFit::kExact,
|
||||
direct, GrColorType::kRGBA_8888, nullptr, SkBackingFit::kExact,
|
||||
{kRenderTargetWidth, kRenderTargetHeight});
|
||||
if (!renderTargetContext) {
|
||||
SkDebugf("Could not allocate a renderTargetContext");
|
||||
@ -329,7 +324,7 @@ bool GrDrawingManager::ProgramUnitTest(GrContext* context, int maxStages, int ma
|
||||
for (int i = 0; i < fpFactoryCnt; ++i) {
|
||||
// Since FP factories internally randomize, call each 10 times.
|
||||
for (int j = 0; j < 10; ++j) {
|
||||
GrProcessorTestData ptd(&random, context, 2, views);
|
||||
GrProcessorTestData ptd(&random, direct, 2, views);
|
||||
|
||||
GrPaint paint;
|
||||
paint.setXPFactory(GrPorterDuffXPFactory::Get(SkBlendMode::kSrc));
|
||||
@ -337,10 +332,9 @@ bool GrDrawingManager::ProgramUnitTest(GrContext* context, int maxStages, int ma
|
||||
auto blockFP = BlockInputFragmentProcessor::Make(std::move(fp));
|
||||
paint.addColorFragmentProcessor(std::move(blockFP));
|
||||
GrDrawRandomOp(&random, renderTargetContext.get(), std::move(paint));
|
||||
if (drawingManager->flush(nullptr, 0, SkSurface::BackendSurfaceAccess::kNoAccess,
|
||||
GrFlushInfo(), nullptr)) {
|
||||
drawingManager->submitToGpu(false);
|
||||
}
|
||||
|
||||
direct->flush(GrFlushInfo());
|
||||
direct->submit(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user