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

Side by Side Diff: gpu/blink/webgraphicscontext3d_impl.cc

Issue 1814573002: Move flush id from WebGraphicsContext3DImpl to GLES2Implementation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: lastflush: . Created 4 years, 9 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "gpu/blink/webgraphicscontext3d_impl.h" 5 #include "gpu/blink/webgraphicscontext3d_impl.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include "base/atomicops.h" 9 #include "base/atomicops.h"
10 #include "base/lazy_instance.h" 10 #include "base/lazy_instance.h"
(...skipping 24 matching lines...) Expand all
35 using blink::WGC3Dsizei; 35 using blink::WGC3Dsizei;
36 using blink::WGC3Dsizeiptr; 36 using blink::WGC3Dsizeiptr;
37 using blink::WGC3Dint64; 37 using blink::WGC3Dint64;
38 using blink::WGC3Duint64; 38 using blink::WGC3Duint64;
39 using blink::WGC3Duint; 39 using blink::WGC3Duint;
40 using blink::WebGLId; 40 using blink::WebGLId;
41 using blink::WGC3Dsync; 41 using blink::WGC3Dsync;
42 42
43 namespace gpu_blink { 43 namespace gpu_blink {
44 44
45 namespace {
46
47 uint32_t GenFlushID() {
48 static base::subtle::Atomic32 flush_id = 0;
49
50 base::subtle::Atomic32 my_id = base::subtle::Barrier_AtomicIncrement(
51 &flush_id, 1);
52 return static_cast<uint32_t>(my_id);
53 }
54
55 } // namespace anonymous
56
57 class WebGraphicsContext3DErrorMessageCallback 45 class WebGraphicsContext3DErrorMessageCallback
58 : public ::gpu::gles2::GLES2ImplementationErrorMessageCallback { 46 : public ::gpu::gles2::GLES2ImplementationErrorMessageCallback {
59 public: 47 public:
60 WebGraphicsContext3DErrorMessageCallback( 48 WebGraphicsContext3DErrorMessageCallback(
61 WebGraphicsContext3DImpl* context) 49 WebGraphicsContext3DImpl* context)
62 : graphics_context_(context) { 50 : graphics_context_(context) {
63 } 51 }
64 52
65 void OnErrorMessage(const char* msg, int id) override; 53 void OnErrorMessage(const char* msg, int id) override;
66 54
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 t6 a6, t7 a7, t8 a8, t9 a9, t10 a10,\ 179 t6 a6, t7 a7, t8 a8, t9 a9, t10 a10,\
192 t11 a11, t12 a12) { \ 180 t11 a11, t12 a12) { \
193 gl_->glname(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12); \ 181 gl_->glname(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12); \
194 } 182 }
195 183
196 WebGraphicsContext3DImpl::WebGraphicsContext3DImpl() 184 WebGraphicsContext3DImpl::WebGraphicsContext3DImpl()
197 : initialized_(false), 185 : initialized_(false),
198 initialize_failed_(false), 186 initialize_failed_(false),
199 context_lost_callback_(0), 187 context_lost_callback_(0),
200 error_message_callback_(0), 188 error_message_callback_(0),
201 gl_(NULL), 189 gl_(NULL) {}
202 flush_id_(0) {
203 }
204 190
205 WebGraphicsContext3DImpl::~WebGraphicsContext3DImpl() { 191 WebGraphicsContext3DImpl::~WebGraphicsContext3DImpl() {
206 192
207 } 193 }
208 194
209 void WebGraphicsContext3DImpl::synthesizeGLError(WGC3Denum error) { 195 void WebGraphicsContext3DImpl::synthesizeGLError(WGC3Denum error) {
210 if (std::find(synthetic_errors_.begin(), synthetic_errors_.end(), error) == 196 if (std::find(synthetic_errors_.begin(), synthetic_errors_.end(), error) ==
211 synthetic_errors_.end()) { 197 synthetic_errors_.end()) {
212 synthetic_errors_.push_back(error); 198 synthetic_errors_.push_back(error);
213 } 199 }
214 } 200 }
215 201
216 uint32_t WebGraphicsContext3DImpl::lastFlushID() { 202 DELEGATE_TO_GL_R(lastFlushID, GetLastFlushIdCHROMIUM, WebGLId)
217 return flush_id_;
218 }
219 203
220 DELEGATE_TO_GL_R(insertFenceSyncCHROMIUM, InsertFenceSyncCHROMIUM, WGC3Duint64) 204 DELEGATE_TO_GL_R(insertFenceSyncCHROMIUM, InsertFenceSyncCHROMIUM, WGC3Duint64)
221 205
222 bool WebGraphicsContext3DImpl::genSyncTokenCHROMIUM(WGC3Duint64 fenceSync, 206 bool WebGraphicsContext3DImpl::genSyncTokenCHROMIUM(WGC3Duint64 fenceSync,
223 WGC3Dbyte* syncToken) { 207 WGC3Dbyte* syncToken) {
224 gl_->GenSyncTokenCHROMIUM(fenceSync, syncToken); 208 gl_->GenSyncTokenCHROMIUM(fenceSync, syncToken);
225 return true; 209 return true;
226 } 210 }
227 211
228 DELEGATE_TO_GL_1(waitSyncTokenCHROMIUM, WaitSyncTokenCHROMIUM, const WGC3Dbyte*) 212 DELEGATE_TO_GL_1(waitSyncTokenCHROMIUM, WaitSyncTokenCHROMIUM, const WGC3Dbyte*)
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
366 gl_->DrawElements( 350 gl_->DrawElements(
367 mode, count, type, 351 mode, count, type,
368 reinterpret_cast<void*>(static_cast<intptr_t>(offset))); 352 reinterpret_cast<void*>(static_cast<intptr_t>(offset)));
369 } 353 }
370 354
371 DELEGATE_TO_GL_1(enable, Enable, WGC3Denum) 355 DELEGATE_TO_GL_1(enable, Enable, WGC3Denum)
372 356
373 DELEGATE_TO_GL_1(enableVertexAttribArray, EnableVertexAttribArray, 357 DELEGATE_TO_GL_1(enableVertexAttribArray, EnableVertexAttribArray,
374 WGC3Duint) 358 WGC3Duint)
375 359
376 void WebGraphicsContext3DImpl::finish() { 360 DELEGATE_TO_GL(finish, Finish)
377 flush_id_ = GenFlushID(); 361 DELEGATE_TO_GL(flush, Flush)
378 gl_->Finish();
379 }
380
381 void WebGraphicsContext3DImpl::flush() {
382 flush_id_ = GenFlushID();
383 gl_->Flush();
384 }
385 362
386 DELEGATE_TO_GL_4(framebufferRenderbuffer, FramebufferRenderbuffer, 363 DELEGATE_TO_GL_4(framebufferRenderbuffer, FramebufferRenderbuffer,
387 WGC3Denum, WGC3Denum, WGC3Denum, WebGLId) 364 WGC3Denum, WGC3Denum, WGC3Denum, WebGLId)
388 365
389 DELEGATE_TO_GL_5(framebufferTexture2D, FramebufferTexture2D, 366 DELEGATE_TO_GL_5(framebufferTexture2D, FramebufferTexture2D,
390 WGC3Denum, WGC3Denum, WGC3Denum, WebGLId, WGC3Dint) 367 WGC3Denum, WGC3Denum, WGC3Denum, WebGLId, WGC3Dint)
391 368
392 DELEGATE_TO_GL_1(frontFace, FrontFace, WGC3Denum) 369 DELEGATE_TO_GL_1(frontFace, FrontFace, WGC3Denum)
393 370
394 DELEGATE_TO_GL_1(generateMipmap, GenerateMipmap, WGC3Denum) 371 DELEGATE_TO_GL_1(generateMipmap, GenerateMipmap, WGC3Denum)
(...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after
886 WGC3Dint, 863 WGC3Dint,
887 WGC3Dsizei, 864 WGC3Dsizei,
888 WGC3Dsizei, 865 WGC3Dsizei,
889 WGC3Dboolean, 866 WGC3Dboolean,
890 WGC3Dboolean, 867 WGC3Dboolean,
891 WGC3Dboolean); 868 WGC3Dboolean);
892 869
893 DELEGATE_TO_GL_3(bindUniformLocationCHROMIUM, BindUniformLocationCHROMIUM, 870 DELEGATE_TO_GL_3(bindUniformLocationCHROMIUM, BindUniformLocationCHROMIUM,
894 WebGLId, WGC3Dint, const WGC3Dchar*) 871 WebGLId, WGC3Dint, const WGC3Dchar*)
895 872
896 void WebGraphicsContext3DImpl::shallowFlushCHROMIUM() { 873 DELEGATE_TO_GL(shallowFlushCHROMIUM, ShallowFlushCHROMIUM)
897 flush_id_ = GenFlushID(); 874 DELEGATE_TO_GL(shallowFinishCHROMIUM, ShallowFinishCHROMIUM)
898 gl_->ShallowFlushCHROMIUM();
899 }
900
901 void WebGraphicsContext3DImpl::shallowFinishCHROMIUM() {
902 flush_id_ = GenFlushID();
903 gl_->ShallowFinishCHROMIUM();
904 }
905 875
906 void WebGraphicsContext3DImpl::loseContextCHROMIUM( 876 void WebGraphicsContext3DImpl::loseContextCHROMIUM(
907 WGC3Denum current, WGC3Denum other) { 877 WGC3Denum current, WGC3Denum other) {
908 gl_->LoseContextCHROMIUM(current, other); 878 gl_->LoseContextCHROMIUM(current, other);
909 gl_->Flush(); 879 gl_->Flush();
910 } 880 }
911 881
912 DELEGATE_TO_GL_1(genMailboxCHROMIUM, GenMailboxCHROMIUM, WGC3Dbyte*) 882 DELEGATE_TO_GL_1(genMailboxCHROMIUM, GenMailboxCHROMIUM, WGC3Dbyte*)
913 DELEGATE_TO_GL_2(produceTextureCHROMIUM, ProduceTextureCHROMIUM, 883 DELEGATE_TO_GL_2(produceTextureCHROMIUM, ProduceTextureCHROMIUM,
914 WGC3Denum, const WGC3Dbyte*) 884 WGC3Denum, const WGC3Dbyte*)
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after
1301 output_attribs->context_type = ::gpu::gles2::CONTEXT_TYPE_WEBGL2; 1271 output_attribs->context_type = ::gpu::gles2::CONTEXT_TYPE_WEBGL2;
1302 break; 1272 break;
1303 default: 1273 default:
1304 NOTREACHED(); 1274 NOTREACHED();
1305 output_attribs->context_type = ::gpu::gles2::CONTEXT_TYPE_OPENGLES2; 1275 output_attribs->context_type = ::gpu::gles2::CONTEXT_TYPE_OPENGLES2;
1306 break; 1276 break;
1307 } 1277 }
1308 } 1278 }
1309 1279
1310 } // namespace gpu_blink 1280 } // namespace gpu_blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698