Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(101)

Side by Side Diff: tools/gpu/gl/GLTestContext.cpp

Issue 1974913003: Implement vulkan fence syncs for nanobench (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: -Address comments and fix compilation of non-vulkan build Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « tools/gpu/TestContext.cpp ('k') | tools/gpu/gl/egl/CreatePlatformGLTestContext_egl.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2013 Google Inc. 2 * Copyright 2013 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "GLTestContext.h" 8 #include "GLTestContext.h"
9 #include "gl/GrGLUtil.h" 9 #include "gl/GrGLUtil.h"
10 10
11 namespace sk_gpu_test { 11 namespace sk_gpu_test {
12 class GLTestContext::GLFenceSync : public SkGpuFenceSync { 12 class GLTestContext::GLFenceSync : public SkGpuFenceSync {
13 public: 13 public:
14 static GLFenceSync* CreateIfSupported(const GLTestContext*); 14 static GLFenceSync* CreateIfSupported(const GLTestContext*);
15 15
16 SkPlatformGpuFence SK_WARN_UNUSED_RESULT insertFence() const override; 16 SkPlatformGpuFence SK_WARN_UNUSED_RESULT insertFence() const override;
17 bool waitFence(SkPlatformGpuFence fence, bool flush) const override; 17 bool waitFence(SkPlatformGpuFence fence) const override;
18 void deleteFence(SkPlatformGpuFence fence) const override; 18 void deleteFence(SkPlatformGpuFence fence) const override;
19 19
20 private: 20 private:
21 GLFenceSync() {} 21 GLFenceSync() {}
22 22
23 static const GrGLenum GL_SYNC_GPU_COMMANDS_COMPLETE = 0x9117; 23 static const GrGLenum GL_SYNC_GPU_COMMANDS_COMPLETE = 0x9117;
24 static const GrGLenum GL_WAIT_FAILED = 0x911d; 24 static const GrGLenum GL_WAIT_FAILED = 0x911d;
25 static const GrGLbitfield GL_SYNC_FLUSH_COMMANDS_BIT = 0x00000001; 25 static const GrGLbitfield GL_SYNC_FLUSH_COMMANDS_BIT = 0x00000001;
26 26
27 typedef struct __GLsync *GLsync; 27 typedef struct __GLsync *GLsync;
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 return nullptr; 105 return nullptr;
106 } 106 }
107 107
108 return ret.release(); 108 return ret.release();
109 } 109 }
110 110
111 SkPlatformGpuFence GLTestContext::GLFenceSync::insertFence() const { 111 SkPlatformGpuFence GLTestContext::GLFenceSync::insertFence() const {
112 return fGLFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0); 112 return fGLFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0);
113 } 113 }
114 114
115 bool GLTestContext::GLFenceSync::waitFence(SkPlatformGpuFence fence, bool flush) const { 115 bool GLTestContext::GLFenceSync::waitFence(SkPlatformGpuFence fence) const {
116 GLsync glsync = static_cast<GLsync>(fence); 116 GLsync glsync = static_cast<GLsync>(fence);
117 return GL_WAIT_FAILED != fGLClientWaitSync(glsync, flush ? GL_SYNC_FLUSH_COM MANDS_BIT : 0, -1); 117 return GL_WAIT_FAILED != fGLClientWaitSync(glsync, GL_SYNC_FLUSH_COMMANDS_BI T, -1);
118 } 118 }
119 119
120 void GLTestContext::GLFenceSync::deleteFence(SkPlatformGpuFence fence) const { 120 void GLTestContext::GLFenceSync::deleteFence(SkPlatformGpuFence fence) const {
121 GLsync glsync = static_cast<GLsync>(fence); 121 GLsync glsync = static_cast<GLsync>(fence);
122 fGLDeleteSync(glsync); 122 fGLDeleteSync(glsync);
123 } 123 }
124 124
125 GrGLint GLTestContext::createTextureRectangle(int width, int height, GrGLenum in ternalFormat, 125 GrGLint GLTestContext::createTextureRectangle(int width, int height, GrGLenum in ternalFormat,
126 GrGLenum externalFormat, GrGLenum exte rnalType, 126 GrGLenum externalFormat, GrGLenum exte rnalType,
127 GrGLvoid* data) { 127 GrGLvoid* data) {
(...skipping 15 matching lines...) Expand all
143 GR_GL_NEAREST)); 143 GR_GL_NEAREST));
144 GR_GL_CALL(fGL, TexParameteri(GR_GL_TEXTURE_RECTANGLE, GR_GL_TEXTURE_WRAP_S, 144 GR_GL_CALL(fGL, TexParameteri(GR_GL_TEXTURE_RECTANGLE, GR_GL_TEXTURE_WRAP_S,
145 GR_GL_CLAMP_TO_EDGE)); 145 GR_GL_CLAMP_TO_EDGE));
146 GR_GL_CALL(fGL, TexParameteri(GR_GL_TEXTURE_RECTANGLE, GR_GL_TEXTURE_WRAP_T, 146 GR_GL_CALL(fGL, TexParameteri(GR_GL_TEXTURE_RECTANGLE, GR_GL_TEXTURE_WRAP_T,
147 GR_GL_CLAMP_TO_EDGE)); 147 GR_GL_CLAMP_TO_EDGE));
148 GR_GL_CALL(fGL, TexImage2D(GR_GL_TEXTURE_RECTANGLE, 0, internalFormat, width , height, 0, 148 GR_GL_CALL(fGL, TexImage2D(GR_GL_TEXTURE_RECTANGLE, 0, internalFormat, width , height, 0,
149 externalFormat, externalType, data)); 149 externalFormat, externalType, data));
150 return id; 150 return id;
151 } 151 }
152 } // namespace sk_gpu_test 152 } // namespace sk_gpu_test
OLDNEW
« no previous file with comments | « tools/gpu/TestContext.cpp ('k') | tools/gpu/gl/egl/CreatePlatformGLTestContext_egl.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698