Move SkGLContext and some GrGLInterface implementations to skgputest module
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1815823002
CQ_EXTRA_TRYBOTS=client.skia.compile:Build-Ubuntu-GCC-x86_64-Release-CMake-Trybot,Build-Mac-Clang-x86_64-Release-CMake-Trybot
Committed: https://skia.googlesource.com/skia/+/fe3456cb006110d045b26ff3f8681b893a757b58
Review URL: https://codereview.chromium.org/1815823002
diff --git a/tests/EGLImageTest.cpp b/tests/EGLImageTest.cpp
index f19592c..7f0d7ea 100644
--- a/tests/EGLImageTest.cpp
+++ b/tests/EGLImageTest.cpp
@@ -11,9 +11,11 @@
#include "GrContextFactory.h"
#include "gl/GrGLGpu.h"
#include "gl/GrGLUtil.h"
-#include "gl/SkGLContext.h"
+#include "gl/GLContext.h"
-static void cleanup(SkGLContext* glctx0, GrGLuint texID0, SkGLContext* glctx1, GrContext* grctx1,
+using sk_gpu_test::GLContext;
+
+static void cleanup(GLContext* glctx0, GrGLuint texID0, GLContext* glctx1, GrContext* grctx1,
const GrGLTextureInfo* grbackendtex1, GrEGLImage image1) {
if (glctx1) {
glctx1->makeCurrent();
@@ -91,7 +93,7 @@
return;
}
- SkAutoTDelete<SkGLContext> glCtx1 = glCtx0->createNew();
+ SkAutoTDelete<GLContext> glCtx1 = glCtx0->createNew();
if (!glCtx1) {
return;
}
diff --git a/tests/GLProgramsTest.cpp b/tests/GLProgramsTest.cpp
index 03938fb..57274e0 100644
--- a/tests/GLProgramsTest.cpp
+++ b/tests/GLProgramsTest.cpp
@@ -455,7 +455,7 @@
// We suppress prints to avoid spew
GrContextOptions opts;
opts.fSuppressPrints = true;
- GrContextFactory debugFactory(opts);
+ sk_gpu_test::GrContextFactory debugFactory(opts);
skiatest::RunWithGPUTestContexts(test_glprograms_native, skiatest::kNative_GPUTestContexts,
reporter, &debugFactory);
skiatest::RunWithGPUTestContexts(test_glprograms_other_contexts,
diff --git a/tests/GrContextFactoryTest.cpp b/tests/GrContextFactoryTest.cpp
index 800b18c..bd18883 100644
--- a/tests/GrContextFactoryTest.cpp
+++ b/tests/GrContextFactoryTest.cpp
@@ -13,6 +13,8 @@
#include "GrCaps.h"
#include "Test.h"
+using sk_gpu_test::GrContextFactory;
+
DEF_GPUTEST(GrContextFactory_NVPRContextOptionHasPathRenderingSupport, reporter, /*factory*/) {
// Test that if NVPR is requested, the context always has path rendering
// or the context creation fails.
diff --git a/tests/GrPorterDuffTest.cpp b/tests/GrPorterDuffTest.cpp
index 54fcfc1..566ec12 100644
--- a/tests/GrPorterDuffTest.cpp
+++ b/tests/GrPorterDuffTest.cpp
@@ -1147,8 +1147,8 @@
DEF_GPUTEST(PorterDuffNoDualSourceBlending, reporter, /*factory*/) {
GrContextOptions opts;
opts.fSuppressDualSourceBlending = true;
- GrContextFactory mockFactory(opts);
- GrContext* ctx = mockFactory.get(GrContextFactory::kNull_GLContextType);
+ sk_gpu_test::GrContextFactory mockFactory(opts);
+ GrContext* ctx = mockFactory.get(sk_gpu_test::GrContextFactory::kNull_GLContextType);
if (!ctx) {
SkFAIL("Failed to create null context without ARB_blend_func_extended.");
return;
diff --git a/tests/ImageTest.cpp b/tests/ImageTest.cpp
index 15ee54c..8485fda 100644
--- a/tests/ImageTest.cpp
+++ b/tests/ImageTest.cpp
@@ -26,6 +26,8 @@
#include "SkUtils.h"
#include "Test.h"
+using sk_gpu_test::GrContextFactory;
+
static void assert_equal(skiatest::Reporter* reporter, SkImage* a, const SkIRect* subsetA,
SkImage* b) {
const int widthA = subsetA ? subsetA->width() : a->width();
diff --git a/tests/RectangleTextureTest.cpp b/tests/RectangleTextureTest.cpp
index 114207d..fc9e65e 100644
--- a/tests/RectangleTextureTest.cpp
+++ b/tests/RectangleTextureTest.cpp
@@ -11,7 +11,7 @@
#include "GrDrawContext.h"
#include "gl/GrGLGpu.h"
#include "gl/GrGLUtil.h"
-#include "gl/SkGLContext.h"
+#include "gl/GLContext.h"
static void test_read_pixels(skiatest::Reporter* reporter, GrContext* context,
GrTexture* rectangleTexture, uint32_t expectedPixelValues[]) {
diff --git a/tests/Test.h b/tests/Test.h
index 4b19a85..119976f 100644
--- a/tests/Test.h
+++ b/tests/Test.h
@@ -11,9 +11,11 @@
#include "SkTRegistry.h"
#include "SkTypes.h"
+namespace sk_gpu_test {
class GrContextFactory;
+class GLContext;
+} // namespace sk_gpu_test
class GrContext;
-class SkGLContext;
namespace skiatest {
@@ -41,7 +43,7 @@
#define REPORT_FAILURE(reporter, cond, message) \
reporter->reportFailed(skiatest::Failure(__FILE__, __LINE__, cond, message))
-typedef void (*TestProc)(skiatest::Reporter*, GrContextFactory*);
+typedef void (*TestProc)(skiatest::Reporter*, sk_gpu_test::GrContextFactory*);
struct Test {
Test(const char* n, bool g, TestProc p) : name(n), needsGpu(g), proc(p) {}
@@ -83,7 +85,7 @@
};
template<typename T>
void RunWithGPUTestContexts(T testFunction, GPUTestContexts contexts, Reporter* reporter,
- GrContextFactory* factory);
+ sk_gpu_test::GrContextFactory* factory);
/** Timer provides wall-clock duration since its creation. */
class Timer {
@@ -133,32 +135,32 @@
} \
} while (0)
-#define DEF_TEST(name, reporter) \
- static void test_##name(skiatest::Reporter*, GrContextFactory*); \
- skiatest::TestRegistry name##TestRegistry( \
- skiatest::Test(#name, false, test_##name)); \
- void test_##name(skiatest::Reporter* reporter, GrContextFactory*)
+#define DEF_TEST(name, reporter) \
+ static void test_##name(skiatest::Reporter*, sk_gpu_test::GrContextFactory*); \
+ skiatest::TestRegistry name##TestRegistry( \
+ skiatest::Test(#name, false, test_##name)); \
+ void test_##name(skiatest::Reporter* reporter, sk_gpu_test::GrContextFactory*)
#define GPUTEST_EXPAND_MSVC(x) x
#define GPUTEST_APPLY(C, ...) GPUTEST_EXPAND_MSVC(C(__VA_ARGS__))
#define GPUTEST_SELECT(a1, a2, N, ...) N
#define GPUTEST_CONTEXT_ARGS1(a1) GrContext* a1
-#define GPUTEST_CONTEXT_ARGS2(a1, a2) GrContext* a1, SkGLContext* a2
+#define GPUTEST_CONTEXT_ARGS2(a1, a2) GrContext* a1, sk_gpu_test::GLContext* a2
#define GPUTEST_CONTEXT_ARGS(...) \
GPUTEST_APPLY(GPUTEST_SELECT(__VA_ARGS__, GPUTEST_CONTEXT_ARGS2, GPUTEST_CONTEXT_ARGS1), \
__VA_ARGS__)
-#define DEF_GPUTEST(name, reporter, factory) \
- static void test_##name(skiatest::Reporter*, GrContextFactory*); \
- skiatest::TestRegistry name##TestRegistry( \
- skiatest::Test(#name, true, test_##name)); \
- void test_##name(skiatest::Reporter* reporter, GrContextFactory* factory)
+#define DEF_GPUTEST(name, reporter, factory) \
+ static void test_##name(skiatest::Reporter*, sk_gpu_test::GrContextFactory*); \
+ skiatest::TestRegistry name##TestRegistry( \
+ skiatest::Test(#name, true, test_##name)); \
+ void test_##name(skiatest::Reporter* reporter, sk_gpu_test::GrContextFactory* factory)
#define DEF_GPUTEST_FOR_CONTEXTS(name, contexts, reporter, ...) \
static void test_##name(skiatest::Reporter*, GPUTEST_CONTEXT_ARGS(__VA_ARGS__)); \
static void test_gpu_contexts_##name(skiatest::Reporter* reporter, \
- GrContextFactory* factory) { \
+ sk_gpu_test::GrContextFactory* factory) { \
skiatest::RunWithGPUTestContexts(test_##name, contexts, reporter, factory); \
} \
skiatest::TestRegistry name##TestRegistry( \
diff --git a/tests/TestConfigParsing.cpp b/tests/TestConfigParsing.cpp
index 9c030ed..4057a37 100644
--- a/tests/TestConfigParsing.cpp
+++ b/tests/TestConfigParsing.cpp
@@ -9,6 +9,8 @@
#include "Test.h"
#include <initializer_list>
+using sk_gpu_test::GrContextFactory;
+
namespace {
// The code
// SkCommandLineFlags::StringArray FLAGS_config1 = make_string_array({"a", "b"})
diff --git a/tests/TestTest.cpp b/tests/TestTest.cpp
index 890042e..05ab9ff 100644
--- a/tests/TestTest.cpp
+++ b/tests/TestTest.cpp
@@ -9,7 +9,7 @@
#if SK_SUPPORT_GPU
#include "GrContext.h"
-#include "gl/SkGLContext.h"
+#include "gl/GLContext.h"
#endif
@@ -64,7 +64,7 @@
#endif
// This is an example of a GPU test that tests a property that should work for all GPU contexts.
-// It uses the additional SkGLContext* glContext to implement the test.
+// It uses the additional GLContext* glContext to implement the test.
#if SK_SUPPORT_GPU
DEF_GPUTEST_FOR_ALL_CONTEXTS(TestGpuGrContextAndGLContext, reporter, context, glContext) {
REPORTER_ASSERT(reporter, reporter);
diff --git a/tests/TextureStorageAllocator.cpp b/tests/TextureStorageAllocator.cpp
index 1d22686..dd08354 100644
--- a/tests/TextureStorageAllocator.cpp
+++ b/tests/TextureStorageAllocator.cpp
@@ -8,9 +8,9 @@
#include "Test.h"
#if SK_SUPPORT_GPU
#include "gl/GrGLGpu.h"
+#include "gl/GLContext.h"
#include "GrContext.h"
#include "SkSurface_Gpu.h"
-#include "../include/gpu/gl/SkGLContext.h"
#include "../include/gpu/GrTypes.h"
#include "../include/private/SkTemplates.h"
diff --git a/tests/skia_test.cpp b/tests/skia_test.cpp
index 5d21d1e..9783db8 100644
--- a/tests/skia_test.cpp
+++ b/tests/skia_test.cpp
@@ -24,6 +24,7 @@
#endif
using namespace skiatest;
+using namespace sk_gpu_test;
DEFINE_bool2(extendedTest, x, false, "run extended tests for pathOps.");