| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2016 Google Inc. | 3 * Copyright 2016 Google Inc. |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 #ifndef TestContext_DEFINED | 9 #ifndef TestContext_DEFINED |
| 10 #define TestContext_DEFINED | 10 #define TestContext_DEFINED |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 * work on the GPU (since all of the subclasses create primary buffers for | 47 * work on the GPU (since all of the subclasses create primary buffers for |
| 48 * testing that are small and not meant to be rendered to the screen). | 48 * testing that are small and not meant to be rendered to the screen). |
| 49 * | 49 * |
| 50 * If the platform supports fence syncs (OpenGL 3.2+ or EGL_KHR_fence_sync), | 50 * If the platform supports fence syncs (OpenGL 3.2+ or EGL_KHR_fence_sync), |
| 51 * this will not swap any buffers, but rather emulate triple buffer synchron
ization | 51 * this will not swap any buffers, but rather emulate triple buffer synchron
ization |
| 52 * using fences. | 52 * using fences. |
| 53 * | 53 * |
| 54 * Otherwise it will call the platform SwapBuffers method. This may or may | 54 * Otherwise it will call the platform SwapBuffers method. This may or may |
| 55 * not perform some sort of synchronization, depending on whether the | 55 * not perform some sort of synchronization, depending on whether the |
| 56 * drawing surface provided by the platform is double buffered. | 56 * drawing surface provided by the platform is double buffered. |
| 57 * |
| 58 * Implicitly performs a submit(). |
| 57 */ | 59 */ |
| 58 void waitOnSyncOrSwap(); | 60 void waitOnSyncOrSwap(); |
| 59 | 61 |
| 60 /** | 62 /** |
| 61 * This notifies the context that we are deliberately testing abandoning | 63 * This notifies the context that we are deliberately testing abandoning |
| 62 * the context. It is useful for debugging contexts that would otherwise | 64 * the context. It is useful for debugging contexts that would otherwise |
| 63 * test that GPU resources are properly deleted. It also allows a debugging | 65 * test that GPU resources are properly deleted. It also allows a debugging |
| 64 * context to test that further API calls are not made by Skia GPU code. | 66 * context to test that further API calls are not made by Skia GPU code. |
| 65 */ | 67 */ |
| 66 virtual void testAbandon(); | 68 virtual void testAbandon(); |
| 67 | 69 |
| 70 /** Ensures all work is submitted to the GPU for execution. */ |
| 71 virtual void submit() = 0; |
| 72 |
| 73 /** Wait until all GPU work is finished. */ |
| 74 virtual void finish() = 0; |
| 75 |
| 68 /** | 76 /** |
| 69 * returns the fencesync object owned by this GLTestContext | 77 * returns the fencesync object owned by this GLTestContext |
| 70 */ | 78 */ |
| 71 SkGpuFenceSync *fenceSync() { return fFenceSync; } | 79 SkGpuFenceSync *fenceSync() { return fFenceSync; } |
| 72 | 80 |
| 73 protected: | 81 protected: |
| 74 SkGpuFenceSync* fFenceSync; | 82 SkGpuFenceSync* fFenceSync; |
| 75 | 83 |
| 76 TestContext(); | 84 TestContext(); |
| 77 | 85 |
| 78 /** This should destroy the 3D context. */ | 86 /** This should destroy the 3D context. */ |
| 79 virtual void teardown(); | 87 virtual void teardown(); |
| 80 | 88 |
| 81 virtual void onPlatformMakeCurrent() const = 0; | 89 virtual void onPlatformMakeCurrent() const = 0; |
| 82 virtual void onPlatformSwapBuffers() const = 0; | 90 virtual void onPlatformSwapBuffers() const = 0; |
| 83 | 91 |
| 84 private: | 92 private: |
| 85 enum { | 93 enum { |
| 86 kMaxFrameLag = 3 | 94 kMaxFrameLag = 3 |
| 87 }; | 95 }; |
| 88 | 96 |
| 89 SkPlatformGpuFence fFrameFences[kMaxFrameLag - 1]; | 97 SkPlatformGpuFence fFrameFences[kMaxFrameLag - 1]; |
| 90 int fCurrentFenceIdx; | 98 int fCurrentFenceIdx; |
| 91 | 99 |
| 92 typedef SkNoncopyable INHERITED; | 100 typedef SkNoncopyable INHERITED; |
| 93 }; | 101 }; |
| 94 } // namespace sk_gpu_test | 102 } // namespace sk_gpu_test |
| 95 #endif | 103 #endif |
| OLD | NEW |