Reland "Remove more GrContext imports & usage"
This reverts commit75c5168b41
. Reason for revert: Reverted image-cacherator test, for now Original change's description: > Revert "Remove more GrContext imports & usage" > > This reverts commitdd1395526d
. > > Reason for revert: Broke chrome roll > > Original change's description: > > Remove more GrContext imports & usage > > > > Sanity is coming soon! > > > > Change-Id: I109ebeef9efd7dbf4d76a13e1c05df36d59affbc > > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/303661 > > Commit-Queue: Adlai Holler <adlai@google.com> > > Reviewed-by: Robert Phillips <robertphillips@google.com> > > TBR=robertphillips@google.com,adlai@google.com > > Change-Id: I20d770058d4b54193b6cd2fdc9ca5a1e09f84309 > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/304056 > Reviewed-by: Adlai Holler <adlai@google.com> > Commit-Queue: Adlai Holler <adlai@google.com> TBR=robertphillips@google.com,adlai@google.com Change-Id: I940b9f74f7caaa8b4201c241f2a6242b7a24d2a4 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/304062 Reviewed-by: Robert Phillips <robertphillips@google.com> Commit-Queue: Adlai Holler <adlai@google.com>
This commit is contained in:
parent
e875f72dc6
commit
2940538ecd
@ -20,7 +20,6 @@
|
||||
#include "include/core/SkSize.h"
|
||||
#include "include/core/SkString.h"
|
||||
#include "include/core/SkTypes.h"
|
||||
#include "include/gpu/GrContext.h"
|
||||
#include "include/gpu/GrRecordingContext.h"
|
||||
#include "include/private/GrSharedEnums.h"
|
||||
#include "include/private/GrTypesPriv.h"
|
||||
|
@ -17,7 +17,6 @@
|
||||
#include "include/core/SkSize.h"
|
||||
#include "include/core/SkString.h"
|
||||
#include "include/core/SkTypes.h"
|
||||
#include "include/gpu/GrContext.h"
|
||||
#include "include/private/GrSharedEnums.h"
|
||||
#include "include/private/GrTypesPriv.h"
|
||||
#include "src/gpu/GrCaps.h"
|
||||
|
@ -11,7 +11,6 @@
|
||||
#include "include/core/SkColor.h"
|
||||
#include "include/core/SkRect.h"
|
||||
#include "include/core/SkTypes.h"
|
||||
#include "include/gpu/GrContext.h"
|
||||
#include "include/gpu/GrDirectContext.h"
|
||||
#include "include/gpu/GrRecordingContext.h"
|
||||
|
||||
|
@ -16,7 +16,6 @@
|
||||
#include "include/core/SkSize.h"
|
||||
#include "include/core/SkString.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"
|
||||
|
@ -26,7 +26,6 @@
|
||||
#include "include/core/SkTypes.h"
|
||||
#include "include/effects/SkGradientShader.h"
|
||||
#include "include/gpu/GrConfig.h"
|
||||
#include "include/gpu/GrContext.h"
|
||||
#include "include/private/GrTypesPriv.h"
|
||||
#include "include/private/SkColorData.h"
|
||||
#include "src/core/SkMatrixProvider.h"
|
||||
|
@ -18,7 +18,6 @@
|
||||
#include "include/core/SkScalar.h"
|
||||
#include "include/core/SkSize.h"
|
||||
#include "include/core/SkString.h"
|
||||
#include "include/gpu/GrContext.h"
|
||||
#include "include/private/GrSharedEnums.h"
|
||||
#include "include/private/GrTypesPriv.h"
|
||||
#include "src/core/SkTLList.h"
|
||||
|
@ -16,7 +16,6 @@
|
||||
#include "include/core/SkString.h"
|
||||
#include "include/core/SkSurface.h"
|
||||
#include "include/core/SkTypes.h"
|
||||
#include "include/gpu/GrContext.h"
|
||||
#include "include/gpu/GrDirectContext.h"
|
||||
#include "include/gpu/GrRecordingContext.h"
|
||||
#include "include/utils/SkRandom.h"
|
||||
|
@ -28,7 +28,6 @@
|
||||
#include "include/core/SkTextBlob.h"
|
||||
#include "include/core/SkTypeface.h"
|
||||
#include "include/core/SkTypes.h"
|
||||
#include "include/gpu/GrContext.h"
|
||||
#include "include/gpu/GrContextOptions.h"
|
||||
#include "include/gpu/GrDirectContext.h"
|
||||
#include "include/gpu/GrRecordingContext.h"
|
||||
|
@ -17,7 +17,6 @@
|
||||
#include "include/core/SkString.h"
|
||||
#include "include/core/SkTileMode.h"
|
||||
#include "include/core/SkTypes.h"
|
||||
#include "include/gpu/GrContext.h"
|
||||
#include "src/gpu/GrBitmapTextureMaker.h"
|
||||
#include "src/gpu/GrCaps.h"
|
||||
#include "src/gpu/GrContextPriv.h"
|
||||
|
@ -14,7 +14,6 @@
|
||||
#include "include/core/SkRect.h"
|
||||
#include "include/core/SkRefCnt.h"
|
||||
#include "include/core/SkString.h"
|
||||
#include "include/gpu/GrContext.h"
|
||||
#include "include/gpu/GrRecordingContext.h"
|
||||
#include "include/private/GrTypesPriv.h"
|
||||
#include "src/gpu/GrBuffer.h"
|
||||
|
@ -25,7 +25,7 @@
|
||||
#include "include/core/SkString.h"
|
||||
#include "include/core/SkSurface.h"
|
||||
#include "include/core/SkTypes.h"
|
||||
#include "include/gpu/GrContext.h"
|
||||
#include "include/gpu/GrDirectContext.h"
|
||||
#include "include/gpu/GrRecordingContext.h"
|
||||
#include "include/gpu/GrTypes.h"
|
||||
#include "include/private/GrTypesPriv.h"
|
||||
|
@ -8,7 +8,6 @@
|
||||
#include "gm/gm.h"
|
||||
|
||||
#include "include/core/SkPath.h"
|
||||
#include "include/gpu/GrContext.h"
|
||||
#include "include/gpu/GrContextOptions.h"
|
||||
#include "include/gpu/GrRecordingContext.h"
|
||||
#include "src/gpu/GrContextPriv.h"
|
||||
|
@ -15,7 +15,6 @@
|
||||
#include "include/core/SkSize.h"
|
||||
#include "include/core/SkString.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"
|
||||
|
@ -11,7 +11,6 @@
|
||||
#include "include/core/SkMatrix.h"
|
||||
#include "include/core/SkRect.h"
|
||||
#include "include/core/SkTypes.h"
|
||||
#include "include/gpu/GrContext.h"
|
||||
#include "src/gpu/GrBitmapTextureMaker.h"
|
||||
#include "src/gpu/GrContextPriv.h"
|
||||
#include "src/gpu/GrFragmentProcessor.h"
|
||||
|
@ -21,7 +21,6 @@
|
||||
#include "include/core/SkString.h"
|
||||
#include "include/core/SkTypes.h"
|
||||
#include "include/core/SkYUVAIndex.h"
|
||||
#include "include/gpu/GrContext.h"
|
||||
#include "include/private/GrTypesPriv.h"
|
||||
#include "src/gpu/GrBitmapTextureMaker.h"
|
||||
#include "src/gpu/GrContextPriv.h"
|
||||
|
@ -50,7 +50,6 @@
|
||||
#include <new>
|
||||
|
||||
#if SK_SUPPORT_GPU
|
||||
#include "include/gpu/GrContext.h"
|
||||
#include "src/gpu/SkGr.h"
|
||||
#endif
|
||||
|
||||
|
@ -22,7 +22,6 @@
|
||||
#include "src/core/SkValidationUtils.h"
|
||||
#include "src/core/SkWriteBuffer.h"
|
||||
#if SK_SUPPORT_GPU
|
||||
#include "include/gpu/GrContext.h"
|
||||
#include "include/gpu/GrRecordingContext.h"
|
||||
#include "src/gpu/GrColorSpaceXform.h"
|
||||
#include "src/gpu/GrContextPriv.h"
|
||||
|
@ -73,7 +73,7 @@ extern const SkPixelRef* SkBitmapImageGetPixelRef(const SkImage* rasterImage);
|
||||
*
|
||||
* @return true if the image was successfully uploaded and locked into a texture
|
||||
*/
|
||||
bool SkImage_pinAsTexture(const SkImage*, GrContext*);
|
||||
bool SkImage_pinAsTexture(const SkImage*, GrRecordingContext*);
|
||||
|
||||
/**
|
||||
* The balancing call to a successful invokation of SkImage_pinAsTexture. When a balanced number of
|
||||
@ -83,7 +83,7 @@ bool SkImage_pinAsTexture(const SkImage*, GrContext*);
|
||||
*
|
||||
* The context passed to unpin must match the one passed to pin.
|
||||
*/
|
||||
void SkImage_unpinAsTexture(const SkImage*, GrContext*);
|
||||
void SkImage_unpinAsTexture(const SkImage*, GrRecordingContext*);
|
||||
|
||||
/**
|
||||
* Returns the bounds of the image relative to its encoded buffer. For all non-lazy images,
|
||||
|
@ -20,10 +20,6 @@
|
||||
|
||||
#include <new>
|
||||
|
||||
#if SK_SUPPORT_GPU
|
||||
#include "include/gpu/GrContext.h"
|
||||
#endif
|
||||
|
||||
template <typename T> int SafeCount(const T* obj) {
|
||||
return obj ? obj->count() : 0;
|
||||
}
|
||||
|
@ -15,9 +15,8 @@
|
||||
#include "src/image/SkImage_Base.h"
|
||||
|
||||
#if SK_SUPPORT_GPU
|
||||
#include "include/gpu/GrContext.h"
|
||||
#include "include/gpu/GrDirectContext.h"
|
||||
#include "include/gpu/GrRecordingContext.h"
|
||||
#include "src/gpu/GrContextPriv.h"
|
||||
#include "src/gpu/GrImageInfo.h"
|
||||
#include "src/gpu/GrProxyProvider.h"
|
||||
#include "src/gpu/GrRecordingContextPriv.h"
|
||||
|
@ -18,7 +18,6 @@
|
||||
#include "src/core/SkWriteBuffer.h"
|
||||
|
||||
#if SK_SUPPORT_GPU
|
||||
#include "include/gpu/GrContext.h"
|
||||
#include "src/gpu/GrColorInfo.h"
|
||||
#include "src/gpu/effects/generated/GrHighContrastFilterEffect.h"
|
||||
#include "src/gpu/glsl/GrGLSLFragmentProcessor.h"
|
||||
|
@ -14,7 +14,6 @@
|
||||
#include "src/core/SkVM.h"
|
||||
|
||||
#if SK_SUPPORT_GPU
|
||||
#include "include/gpu/GrContext.h"
|
||||
#include "src/gpu/effects/generated/GrLumaColorFilterEffect.h"
|
||||
#include "src/gpu/glsl/GrGLSLFragmentProcessor.h"
|
||||
#include "src/gpu/glsl/GrGLSLFragmentShaderBuilder.h"
|
||||
|
@ -344,7 +344,6 @@ GR_DEFINE_FRAGMENT_PROCESSOR_TEST(ColorTableEffect);
|
||||
|
||||
#if GR_TEST_UTILS
|
||||
|
||||
#include "include/gpu/GrContext.h"
|
||||
|
||||
std::unique_ptr<GrFragmentProcessor> ColorTableEffect::TestCreate(GrProcessorTestData* d) {
|
||||
int flags = 0;
|
||||
|
@ -15,7 +15,6 @@
|
||||
#include "src/core/SkWriteBuffer.h"
|
||||
|
||||
#if SK_SUPPORT_GPU
|
||||
#include "include/gpu/GrContext.h"
|
||||
#include "include/gpu/GrRecordingContext.h"
|
||||
#include "src/gpu/GrCaps.h"
|
||||
#include "src/gpu/GrColorSpaceXform.h"
|
||||
|
@ -24,7 +24,6 @@
|
||||
#include "src/core/SkWriteBuffer.h"
|
||||
|
||||
#if SK_SUPPORT_GPU
|
||||
#include "include/gpu/GrContext.h"
|
||||
#include "src/gpu/GrTextureProxy.h"
|
||||
#include "src/gpu/SkGr.h"
|
||||
#endif
|
||||
|
@ -17,7 +17,6 @@
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
#if SK_SUPPORT_GPU
|
||||
#include "include/gpu/GrContext.h"
|
||||
#include "src/gpu/GrColorSpaceXform.h"
|
||||
#include "src/gpu/effects/GrTextureEffect.h"
|
||||
#include "src/gpu/effects/generated/GrMagnifierEffect.h"
|
||||
|
@ -19,7 +19,6 @@
|
||||
#include "src/gpu/SkGr.h"
|
||||
|
||||
#if SK_SUPPORT_GPU
|
||||
#include "include/gpu/GrContext.h"
|
||||
#include "src/gpu/GrRecordingContextPriv.h"
|
||||
#include "src/gpu/GrTextureProxy.h"
|
||||
#include "src/gpu/effects/GrMatrixConvolutionEffect.h"
|
||||
|
@ -16,7 +16,6 @@
|
||||
#include "src/core/SkWriteBuffer.h"
|
||||
|
||||
#if SK_SUPPORT_GPU
|
||||
#include "include/gpu/GrContext.h"
|
||||
#include "include/gpu/GrRecordingContext.h"
|
||||
#include "src/gpu/GrContextPriv.h"
|
||||
#include "src/gpu/GrRecordingContextPriv.h"
|
||||
|
@ -19,7 +19,7 @@
|
||||
#include <GLES/gl.h>
|
||||
#include <GLES/glext.h>
|
||||
|
||||
#include "include/gpu/GrContext.h"
|
||||
#include "include/gpu/GrDirectContext.h"
|
||||
#include "include/gpu/gl/GrGLTypes.h"
|
||||
#include "src/gpu/GrContextPriv.h"
|
||||
#include "src/gpu/gl/GrGLDefines.h"
|
||||
@ -62,7 +62,13 @@ SkColorType GetSkColorTypeFromBufferFormat(uint32_t bufferFormat) {
|
||||
|
||||
GrBackendFormat GetBackendFormat(GrContext* context, AHardwareBuffer* hardwareBuffer,
|
||||
uint32_t bufferFormat, bool requireKnownFormat) {
|
||||
GrBackendApi backend = context->backend();
|
||||
// CONTEXT TODO: Elevate direct context requirement to Android API.
|
||||
auto dContext = GrAsDirectContext(context);
|
||||
if (!dContext) {
|
||||
SkDEBUGFAIL("Requires direct context.");
|
||||
return GrBackendFormat();
|
||||
}
|
||||
GrBackendApi backend = dContext->backend();
|
||||
|
||||
if (backend == GrBackendApi::kOpenGL) {
|
||||
switch (bufferFormat) {
|
||||
@ -104,7 +110,7 @@ GrBackendFormat GetBackendFormat(GrContext* context, AHardwareBuffer* hardwareBu
|
||||
if (requireKnownFormat) {
|
||||
return GrBackendFormat();
|
||||
} else {
|
||||
GrVkGpu* gpu = static_cast<GrVkGpu*>(context->priv().getGpu());
|
||||
GrVkGpu* gpu = static_cast<GrVkGpu*>(dContext->priv().getGpu());
|
||||
SkASSERT(gpu);
|
||||
VkDevice device = gpu->device();
|
||||
|
||||
@ -169,7 +175,7 @@ public:
|
||||
// eglDestroyImageKHR will remove a ref from the AHardwareBuffer
|
||||
eglDestroyImageKHR(fDisplay, fImage);
|
||||
}
|
||||
void rebind(GrContext* grContext);
|
||||
void rebind(GrDirectContext*);
|
||||
|
||||
private:
|
||||
GrGLuint fTexID;
|
||||
@ -178,7 +184,7 @@ private:
|
||||
GrGLuint fTexTarget;
|
||||
};
|
||||
|
||||
void GLTextureHelper::rebind(GrContext* grContext) {
|
||||
void GLTextureHelper::rebind(GrDirectContext* dContext) {
|
||||
glBindTexture(fTexTarget, fTexID);
|
||||
GLenum status = GL_NO_ERROR;
|
||||
if ((status = glGetError()) != GL_NO_ERROR) {
|
||||
@ -191,7 +197,7 @@ void GLTextureHelper::rebind(GrContext* grContext) {
|
||||
SkDebugf("glEGLImageTargetTexture2DOES failed (%#x)", (int) status);
|
||||
return;
|
||||
}
|
||||
grContext->resetContext(kTextureBinding_GrGLBackendState);
|
||||
dContext->resetContext(kTextureBinding_GrGLBackendState);
|
||||
}
|
||||
|
||||
void delete_gl_texture(void* context) {
|
||||
@ -200,12 +206,18 @@ void delete_gl_texture(void* context) {
|
||||
}
|
||||
|
||||
void update_gl_texture(void* context, GrContext* grContext) {
|
||||
// CONTEXT TODO: Elevate direct context requirement to Android API.
|
||||
auto dContext = GrAsDirectContext(grContext);
|
||||
if (!dContext) {
|
||||
SkDEBUGFAIL("Direct context required.");
|
||||
return;
|
||||
}
|
||||
GLTextureHelper* cleanupHelper = static_cast<GLTextureHelper*>(context);
|
||||
cleanupHelper->rebind(grContext);
|
||||
cleanupHelper->rebind(dContext);
|
||||
}
|
||||
|
||||
static GrBackendTexture make_gl_backend_texture(
|
||||
GrContext* context, AHardwareBuffer* hardwareBuffer,
|
||||
GrDirectContext* dContext, AHardwareBuffer* hardwareBuffer,
|
||||
int width, int height,
|
||||
DeleteImageProc* deleteProc,
|
||||
UpdateImageProc* updateProc,
|
||||
@ -253,7 +265,7 @@ static GrBackendTexture make_gl_backend_texture(
|
||||
eglDestroyImageKHR(display, image);
|
||||
return GrBackendTexture();
|
||||
}
|
||||
context->resetContext(kTextureBinding_GrGLBackendState);
|
||||
dContext->resetContext(kTextureBinding_GrGLBackendState);
|
||||
|
||||
GrGLTextureInfo textureInfo;
|
||||
textureInfo.fID = texID;
|
||||
@ -295,11 +307,13 @@ void delete_vk_image(void* context) {
|
||||
}
|
||||
|
||||
void update_vk_image(void* context, GrContext* grContext) {
|
||||
// CONTEXT TODO: Elevate direct context requirement to Android API.
|
||||
SkASSERT(GrAsDirectContext(grContext));
|
||||
// no op
|
||||
}
|
||||
|
||||
static GrBackendTexture make_vk_backend_texture(
|
||||
GrContext* context, AHardwareBuffer* hardwareBuffer,
|
||||
GrDirectContext* dContext, AHardwareBuffer* hardwareBuffer,
|
||||
int width, int height,
|
||||
DeleteImageProc* deleteProc,
|
||||
UpdateImageProc* updateProc,
|
||||
@ -307,8 +321,8 @@ static GrBackendTexture make_vk_backend_texture(
|
||||
bool isProtectedContent,
|
||||
const GrBackendFormat& backendFormat,
|
||||
bool isRenderable) {
|
||||
SkASSERT(context->backend() == GrBackendApi::kVulkan);
|
||||
GrVkGpu* gpu = static_cast<GrVkGpu*>(context->priv().getGpu());
|
||||
SkASSERT(dContext->backend() == GrBackendApi::kVulkan);
|
||||
GrVkGpu* gpu = static_cast<GrVkGpu*>(dContext->priv().getGpu());
|
||||
|
||||
VkPhysicalDevice physicalDevice = gpu->physicalDevice();
|
||||
VkDevice device = gpu->device();
|
||||
@ -510,8 +524,8 @@ static bool can_import_protected_content_eglimpl() {
|
||||
return equal || atStart || atEnd || inMiddle;
|
||||
}
|
||||
|
||||
static bool can_import_protected_content(GrContext* context) {
|
||||
if (GrBackendApi::kOpenGL == context->backend()) {
|
||||
static bool can_import_protected_content(GrDirectContext* dContext) {
|
||||
if (GrBackendApi::kOpenGL == dContext->backend()) {
|
||||
// Only compute whether the extension is present once the first time this
|
||||
// function is called.
|
||||
static bool hasIt = can_import_protected_content_eglimpl();
|
||||
@ -528,21 +542,24 @@ GrBackendTexture MakeBackendTexture(GrContext* context, AHardwareBuffer* hardwar
|
||||
bool isProtectedContent,
|
||||
const GrBackendFormat& backendFormat,
|
||||
bool isRenderable) {
|
||||
if (context->abandoned()) {
|
||||
// CONTEXT TODO: Elevate direct context requirement to Android API.
|
||||
auto dContext = GrAsDirectContext(context);
|
||||
SkASSERT(dContext);
|
||||
if (!dContext || dContext->abandoned()) {
|
||||
return GrBackendTexture();
|
||||
}
|
||||
bool createProtectedImage = isProtectedContent && can_import_protected_content(context);
|
||||
bool createProtectedImage = isProtectedContent && can_import_protected_content(dContext);
|
||||
|
||||
if (GrBackendApi::kOpenGL == context->backend()) {
|
||||
return make_gl_backend_texture(context, hardwareBuffer, width, height, deleteProc,
|
||||
if (GrBackendApi::kOpenGL == dContext->backend()) {
|
||||
return make_gl_backend_texture(dContext, hardwareBuffer, width, height, deleteProc,
|
||||
updateProc, imageCtx, createProtectedImage, backendFormat,
|
||||
isRenderable);
|
||||
} else {
|
||||
SkASSERT(GrBackendApi::kVulkan == context->backend());
|
||||
SkASSERT(GrBackendApi::kVulkan == dContext->backend());
|
||||
#ifdef SK_VULKAN
|
||||
// Currently we don't support protected images on vulkan
|
||||
SkASSERT(!createProtectedImage);
|
||||
return make_vk_backend_texture(context, hardwareBuffer, width, height, deleteProc,
|
||||
return make_vk_backend_texture(dContext, hardwareBuffer, width, height, deleteProc,
|
||||
updateProc, imageCtx, createProtectedImage, backendFormat,
|
||||
isRenderable);
|
||||
#else
|
||||
|
@ -7,7 +7,6 @@
|
||||
|
||||
#include "include/gpu/GrRecordingContext.h"
|
||||
|
||||
#include "include/gpu/GrContext.h"
|
||||
#include "include/gpu/GrContextThreadSafeProxy.h"
|
||||
#include "src/core/SkArenaAlloc.h"
|
||||
#include "src/gpu/GrAuditTrail.h"
|
||||
|
@ -617,16 +617,16 @@ sk_sp<SkImage> SkImage::MakeFromNV12TexturesCopyWithExternalBackend(
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
bool SkImage_pinAsTexture(const SkImage* image, GrContext* ctx) {
|
||||
bool SkImage_pinAsTexture(const SkImage* image, GrRecordingContext* rContext) {
|
||||
SkASSERT(image);
|
||||
SkASSERT(ctx);
|
||||
return as_IB(image)->onPinAsTexture(ctx);
|
||||
SkASSERT(rContext);
|
||||
return as_IB(image)->onPinAsTexture(rContext);
|
||||
}
|
||||
|
||||
void SkImage_unpinAsTexture(const SkImage* image, GrContext* ctx) {
|
||||
void SkImage_unpinAsTexture(const SkImage* image, GrRecordingContext* rContext) {
|
||||
SkASSERT(image);
|
||||
SkASSERT(ctx);
|
||||
as_IB(image)->onUnpinAsTexture(ctx);
|
||||
SkASSERT(rContext);
|
||||
as_IB(image)->onUnpinAsTexture(rContext);
|
||||
}
|
||||
|
||||
SkIRect SkImage_getSubset(const SkImage* image) {
|
||||
|
@ -127,8 +127,8 @@ public:
|
||||
|
||||
virtual bool onIsValid(GrRecordingContext*) const = 0;
|
||||
|
||||
virtual bool onPinAsTexture(GrContext*) const { return false; }
|
||||
virtual void onUnpinAsTexture(GrContext*) const {}
|
||||
virtual bool onPinAsTexture(GrRecordingContext*) const { return false; }
|
||||
virtual void onUnpinAsTexture(GrRecordingContext*) const {}
|
||||
|
||||
virtual sk_sp<SkImage> onMakeColorTypeAndColorSpace(SkColorType, sk_sp<SkColorSpace>,
|
||||
GrDirectContext*) const = 0;
|
||||
|
@ -9,7 +9,6 @@
|
||||
|
||||
#include "include/core/SkPromiseImageTexture.h"
|
||||
#include "include/gpu/GrBackendSurface.h"
|
||||
#include "include/gpu/GrContext.h"
|
||||
#include "include/gpu/GrDirectContext.h"
|
||||
#include "include/gpu/GrRecordingContext.h"
|
||||
#include "src/core/SkBitmapCache.h"
|
||||
|
@ -20,7 +20,6 @@
|
||||
#include "src/shaders/SkBitmapProcShader.h"
|
||||
|
||||
#if SK_SUPPORT_GPU
|
||||
#include "include/gpu/GrContext.h"
|
||||
#include "src/gpu/GrTextureAdjuster.h"
|
||||
#include "src/gpu/SkGr.h"
|
||||
#endif
|
||||
@ -119,8 +118,8 @@ public:
|
||||
#if SK_SUPPORT_GPU
|
||||
GrSurfaceProxyView refPinnedView(GrRecordingContext* context,
|
||||
uint32_t* uniqueID) const override;
|
||||
bool onPinAsTexture(GrContext*) const override;
|
||||
void onUnpinAsTexture(GrContext*) const override;
|
||||
bool onPinAsTexture(GrRecordingContext*) const override;
|
||||
void onUnpinAsTexture(GrRecordingContext*) const override;
|
||||
#endif
|
||||
|
||||
SkMipmap* onPeekMips() const override { return fBitmap.fMips.get(); }
|
||||
@ -214,14 +213,14 @@ GrSurfaceProxyView SkImage_Raster::refPinnedView(GrRecordingContext*, uint32_t*
|
||||
return {};
|
||||
}
|
||||
|
||||
bool SkImage_Raster::onPinAsTexture(GrContext* ctx) const {
|
||||
bool SkImage_Raster::onPinAsTexture(GrRecordingContext* rContext) const {
|
||||
if (fPinnedView) {
|
||||
SkASSERT(fPinnedCount > 0);
|
||||
SkASSERT(fPinnedUniqueID != 0);
|
||||
} else {
|
||||
SkASSERT(fPinnedCount == 0);
|
||||
SkASSERT(fPinnedUniqueID == 0);
|
||||
fPinnedView = GrRefCachedBitmapView(ctx, fBitmap, GrMipMapped::kNo);
|
||||
fPinnedView = GrRefCachedBitmapView(rContext, fBitmap, GrMipMapped::kNo);
|
||||
if (!fPinnedView) {
|
||||
return false;
|
||||
}
|
||||
@ -233,7 +232,7 @@ bool SkImage_Raster::onPinAsTexture(GrContext* ctx) const {
|
||||
return true;
|
||||
}
|
||||
|
||||
void SkImage_Raster::onUnpinAsTexture(GrContext* ctx) const {
|
||||
void SkImage_Raster::onUnpinAsTexture(GrRecordingContext*) const {
|
||||
// Note: we always decrement, even if fPinnedTexture is null
|
||||
SkASSERT(fPinnedCount > 0);
|
||||
SkASSERT(fPinnedUniqueID != 0);
|
||||
|
@ -8,7 +8,6 @@
|
||||
#include "include/core/SkRefCnt.h"
|
||||
#include "include/core/SkSurface.h"
|
||||
#include "include/gpu/GrBackendSurface.h"
|
||||
#include "include/gpu/GrContext.h"
|
||||
#include "include/gpu/mtl/GrMtlTypes.h"
|
||||
#include "src/gpu/GrContextPriv.h"
|
||||
#include "src/gpu/GrProxyProvider.h"
|
||||
|
@ -89,7 +89,6 @@ skvm::Color SkColorFilterShader::onProgram(skvm::Builder* p,
|
||||
#if SK_SUPPORT_GPU
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "include/gpu/GrContext.h"
|
||||
|
||||
std::unique_ptr<GrFragmentProcessor> SkColorFilterShader::asFragmentProcessor(
|
||||
const GrFPArgs& args) const {
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include <atomic>
|
||||
|
||||
#if SK_SUPPORT_GPU
|
||||
#include "include/gpu/GrDirectContext.h"
|
||||
#include "include/gpu/GrRecordingContext.h"
|
||||
#include "src/gpu/GrCaps.h"
|
||||
#include "src/gpu/GrColorInfo.h"
|
||||
@ -342,8 +343,6 @@ void SkPictureShader::PictureShaderContext::shadeSpan(int x, int y, SkPMColor ds
|
||||
}
|
||||
|
||||
#if SK_SUPPORT_GPU
|
||||
#include "include/gpu/GrContext.h"
|
||||
#include "src/gpu/GrContextPriv.h"
|
||||
|
||||
std::unique_ptr<GrFragmentProcessor> SkPictureShader::asFragmentProcessor(
|
||||
const GrFPArgs& args) const {
|
||||
|
@ -28,6 +28,7 @@
|
||||
|
||||
#include "tests/Test.h"
|
||||
|
||||
#include "src/gpu/GrContextPriv.h"
|
||||
#include "src/gpu/text/GrAtlasManager.h"
|
||||
#include "src/gpu/text/GrTextBlobCache.h"
|
||||
|
||||
|
@ -16,7 +16,6 @@
|
||||
#include "tools/debugger/DebugLayerManager.h"
|
||||
#include "tools/debugger/DrawCommand.h"
|
||||
|
||||
#include "include/gpu/GrContext.h"
|
||||
#include "src/gpu/GrAuditTrail.h"
|
||||
#include "src/gpu/GrRecordingContextPriv.h"
|
||||
#include "src/gpu/GrRenderTargetContext.h"
|
||||
|
@ -10,27 +10,27 @@
|
||||
#include "include/core/SkImage.h"
|
||||
#include "include/core/SkPixmap.h"
|
||||
#include "include/gpu/GrBackendSurface.h"
|
||||
#include "include/gpu/GrContext.h"
|
||||
#include "include/gpu/GrDirectContext.h"
|
||||
#include "src/core/SkAutoPixmapStorage.h"
|
||||
|
||||
namespace {
|
||||
class ManagedBackendTexture : public SkNVRefCnt<ManagedBackendTexture> {
|
||||
public:
|
||||
~ManagedBackendTexture() {
|
||||
if (fContext && fTexture.isValid()) {
|
||||
fContext->submit(true);
|
||||
fContext->deleteBackendTexture(fTexture);
|
||||
if (fDContext && fTexture.isValid()) {
|
||||
fDContext->submit(true);
|
||||
fDContext->deleteBackendTexture(fTexture);
|
||||
}
|
||||
}
|
||||
|
||||
static void Release(void* context) { static_cast<ManagedBackendTexture*>(context)->unref(); }
|
||||
|
||||
template <typename... Args>
|
||||
static sk_sp<ManagedBackendTexture> Make(GrContext* context, Args&&... args) {
|
||||
static sk_sp<ManagedBackendTexture> Make(GrDirectContext* dContext, Args&&... args) {
|
||||
sk_sp<ManagedBackendTexture> mbet(new ManagedBackendTexture);
|
||||
mbet->fContext = context;
|
||||
mbet->fTexture = context->createBackendTexture(std::forward<Args>(args)..., Release,
|
||||
mbet->refAndPassAsContext());
|
||||
mbet->fDContext = dContext;
|
||||
mbet->fTexture = dContext->createBackendTexture(std::forward<Args>(args)..., Release,
|
||||
mbet->refAndPassAsContext());
|
||||
return mbet;
|
||||
}
|
||||
|
||||
@ -43,13 +43,13 @@ public:
|
||||
|
||||
private:
|
||||
ManagedBackendTexture() = default;
|
||||
GrContext* fContext = nullptr;
|
||||
GrDirectContext* fDContext = nullptr;
|
||||
GrBackendTexture fTexture;
|
||||
};
|
||||
} // namespace
|
||||
|
||||
namespace sk_gpu_test {
|
||||
sk_sp<SkImage> MakeBackendTextureImage(GrContext* context,
|
||||
sk_sp<SkImage> MakeBackendTextureImage(GrDirectContext* dContext,
|
||||
const SkPixmap& pixmap,
|
||||
GrRenderable renderable,
|
||||
GrSurfaceOrigin origin) {
|
||||
@ -64,8 +64,8 @@ sk_sp<SkImage> MakeBackendTextureImage(GrContext* context,
|
||||
}
|
||||
src = &temp;
|
||||
}
|
||||
auto mbet = ManagedBackendTexture::Make(context, src, 1, renderable, GrProtected::kNo);
|
||||
return SkImage::MakeFromTexture(context,
|
||||
auto mbet = ManagedBackendTexture::Make(dContext, src, 1, renderable, GrProtected::kNo);
|
||||
return SkImage::MakeFromTexture(dContext,
|
||||
mbet->texture(),
|
||||
origin,
|
||||
src->colorType(),
|
||||
|
@ -8,7 +8,7 @@
|
||||
#include "include/core/SkRefCnt.h"
|
||||
#include "include/gpu/GrTypes.h"
|
||||
|
||||
class GrContext;
|
||||
class GrDirectContext;
|
||||
class SkImage;
|
||||
class SkPixmap;
|
||||
|
||||
@ -20,5 +20,6 @@ namespace sk_gpu_test {
|
||||
* For testing purposes the texture can be made renderable to exercise different code paths for
|
||||
* renderable textures/formats.
|
||||
*/
|
||||
sk_sp<SkImage> MakeBackendTextureImage(GrContext*, const SkPixmap&, GrRenderable, GrSurfaceOrigin);
|
||||
sk_sp<SkImage> MakeBackendTextureImage(GrDirectContext*, const SkPixmap&,
|
||||
GrRenderable, GrSurfaceOrigin);
|
||||
} // namespace sk_gpu_test
|
||||
|
Loading…
Reference in New Issue
Block a user