aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/gpu/GrTest.cpp23
-rw-r--r--tools/gpu/GrTest.h4
2 files changed, 25 insertions, 2 deletions
diff --git a/tools/gpu/GrTest.cpp b/tools/gpu/GrTest.cpp
index 30f73163f0..2e34d2ff5b 100644
--- a/tools/gpu/GrTest.cpp
+++ b/tools/gpu/GrTest.cpp
@@ -7,6 +7,7 @@
#include "GrTest.h"
+#include "GrBackendSurface.h"
#include "GrContextOptions.h"
#include "GrDrawOpAtlas.h"
#include "GrDrawingManager.h"
@@ -54,6 +55,18 @@ void SetupAlwaysEvictAtlas(GrContext* context) {
context->setTextContextAtlasSizes_ForTesting(configs);
}
+
+GrBackendTexture CreateBackendTexture(GrBackend backend, int width, int height,
+ GrPixelConfig config, GrBackendObject handle) {
+ if (kOpenGL_GrBackend == backend) {
+ GrGLTextureInfo* glInfo = (GrGLTextureInfo*)(handle);
+ return GrBackendTexture(width, height, config, glInfo);
+ } else {
+ SkASSERT(kVulkan_GrBackend == backend);
+ GrVkImageInfo* vkInfo = (GrVkImageInfo*)(handle);
+ return GrBackendTexture(width, height, vkInfo);
+ }
+}
};
bool GrSurfaceProxy::isWrapped_ForTesting() const {
@@ -338,7 +351,11 @@ private:
return nullptr;
}
- sk_sp<GrTexture> onWrapBackendTexture(const GrBackendTextureDesc&, GrWrapOwnership) override {
+ sk_sp<GrTexture> onWrapBackendTexture(const GrBackendTexture&,
+ GrSurfaceOrigin,
+ GrBackendTextureFlags,
+ int sampleCnt,
+ GrWrapOwnership) override {
return nullptr;
}
@@ -346,7 +363,9 @@ private:
return nullptr;
}
- sk_sp<GrRenderTarget> onWrapBackendTextureAsRenderTarget(const GrBackendTextureDesc&) override {
+ sk_sp<GrRenderTarget> onWrapBackendTextureAsRenderTarget(const GrBackendTexture&,
+ GrSurfaceOrigin,
+ int sampleCnt) override {
return nullptr;
}
diff --git a/tools/gpu/GrTest.h b/tools/gpu/GrTest.h
index db4c4515b3..d4a4c6dfac 100644
--- a/tools/gpu/GrTest.h
+++ b/tools/gpu/GrTest.h
@@ -8,6 +8,7 @@
#ifndef GrTest_DEFINED
#define GrTest_DEFINED
+#include "GrBackendSurface.h"
#include "GrContext.h"
namespace GrTest {
@@ -16,6 +17,9 @@ namespace GrTest {
* constantly be evicting entries
*/
void SetupAlwaysEvictAtlas(GrContext*);
+
+ GrBackendTexture CreateBackendTexture(GrBackend, int width, int height,
+ GrPixelConfig, GrBackendObject);
};
#endif