OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |