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

Side by Side Diff: gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.cc

Issue 2444813002: Remove unsafe mode to enable es3 api by default for WebGL2 and ES3 context (Closed)
Patch Set: remove runtime flag unsafeES3APIs from blink webgl module Created 4 years, 1 month 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/command_buffer/service/gles2_cmd_decoder_unittest_base.h" 5 #include "gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after
503 EXPECT_CALL(*gl_, GenBuffersARB(_, _)) 503 EXPECT_CALL(*gl_, GenBuffersARB(_, _))
504 .WillOnce(SetArgPointee<1>(kServiceElementBufferId)) 504 .WillOnce(SetArgPointee<1>(kServiceElementBufferId))
505 .RetiresOnSaturation(); 505 .RetiresOnSaturation();
506 GenHelper<cmds::GenBuffersImmediate>(client_element_buffer_id_); 506 GenHelper<cmds::GenBuffersImmediate>(client_element_buffer_id_);
507 GenHelper<cmds::GenQueriesEXTImmediate>(client_query_id_); 507 GenHelper<cmds::GenQueriesEXTImmediate>(client_query_id_);
508 508
509 DoCreateProgram(client_program_id_, kServiceProgramId); 509 DoCreateProgram(client_program_id_, kServiceProgramId);
510 DoCreateShader(GL_VERTEX_SHADER, client_shader_id_, kServiceShaderId); 510 DoCreateShader(GL_VERTEX_SHADER, client_shader_id_, kServiceShaderId);
511 511
512 // Unsafe commands. 512 // Unsafe commands.
513 bool reset_unsafe_es3_apis_enabled = false; 513 bool reset_es3_apis_enabled = false;
514 if (!decoder_->unsafe_es3_apis_enabled()) { 514 if (!decoder_->es3_apis_enabled()) {
515 decoder_->set_unsafe_es3_apis_enabled(true); 515 decoder_->set_es3_apis_enabled(true);
516 reset_unsafe_es3_apis_enabled = true; 516 reset_es3_apis_enabled = true;
517 } 517 }
518 518
519 const gl::GLVersionInfo* version = context_->GetVersionInfo(); 519 const gl::GLVersionInfo* version = context_->GetVersionInfo();
520 if (version->IsAtLeastGL(3, 3) || version->IsAtLeastGLES(3, 0)) { 520 if (version->IsAtLeastGL(3, 3) || version->IsAtLeastGLES(3, 0)) {
521 EXPECT_CALL(*gl_, GenSamplers(_, _)) 521 EXPECT_CALL(*gl_, GenSamplers(_, _))
522 .WillOnce(SetArgPointee<1>(kServiceSamplerId)) 522 .WillOnce(SetArgPointee<1>(kServiceSamplerId))
523 .RetiresOnSaturation(); 523 .RetiresOnSaturation();
524 GenHelper<cmds::GenSamplersImmediate>(client_sampler_id_); 524 GenHelper<cmds::GenSamplersImmediate>(client_sampler_id_);
525 } 525 }
526 if (version->IsAtLeastGL(4, 0) || version->IsAtLeastGLES(3, 0)) { 526 if (version->IsAtLeastGL(4, 0) || version->IsAtLeastGLES(3, 0)) {
527 EXPECT_CALL(*gl_, GenTransformFeedbacks(_, _)) 527 EXPECT_CALL(*gl_, GenTransformFeedbacks(_, _))
528 .WillOnce(SetArgPointee<1>(kServiceTransformFeedbackId)) 528 .WillOnce(SetArgPointee<1>(kServiceTransformFeedbackId))
529 .RetiresOnSaturation(); 529 .RetiresOnSaturation();
530 GenHelper<cmds::GenTransformFeedbacksImmediate>( 530 GenHelper<cmds::GenTransformFeedbacksImmediate>(
531 client_transformfeedback_id_); 531 client_transformfeedback_id_);
532 } 532 }
533 533
534 if (init.extensions.find("GL_ARB_sync ") != std::string::npos || 534 if (init.extensions.find("GL_ARB_sync ") != std::string::npos ||
535 version->IsAtLeastGL(3, 2) || version->IsAtLeastGLES(3, 0)) { 535 version->IsAtLeastGL(3, 2) || version->IsAtLeastGLES(3, 0)) {
536 DoFenceSync(client_sync_id_, kServiceSyncId); 536 DoFenceSync(client_sync_id_, kServiceSyncId);
537 } 537 }
538 538
539 if (reset_unsafe_es3_apis_enabled) { 539 if (reset_es3_apis_enabled) {
540 decoder_->set_unsafe_es3_apis_enabled(false); 540 decoder_->set_es3_apis_enabled(false);
541 } 541 }
542 542
543 EXPECT_EQ(GL_NO_ERROR, GetGLError()); 543 EXPECT_EQ(GL_NO_ERROR, GetGLError());
544 } 544 }
545 545
546 void GLES2DecoderTestBase::ResetDecoder() { 546 void GLES2DecoderTestBase::ResetDecoder() {
547 if (!decoder_.get()) 547 if (!decoder_.get())
548 return; 548 return;
549 // All Tests should have read all their GLErrors before getting here. 549 // All Tests should have read all their GLErrors before getting here.
550 EXPECT_EQ(GL_NO_ERROR, GetGLError()); 550 EXPECT_EQ(GL_NO_ERROR, GetGLError());
(...skipping 1578 matching lines...) Expand 10 before | Expand all | Expand 10 after
2129 SetupDefaultProgram(); 2129 SetupDefaultProgram();
2130 } 2130 }
2131 2131
2132 // Include the auto-generated part of this file. We split this because it means 2132 // Include the auto-generated part of this file. We split this because it means
2133 // we can easily edit the non-auto generated parts right here in this file 2133 // we can easily edit the non-auto generated parts right here in this file
2134 // instead of having to edit some template or the code generator. 2134 // instead of having to edit some template or the code generator.
2135 #include "gpu/command_buffer/service/gles2_cmd_decoder_unittest_0_autogen.h" 2135 #include "gpu/command_buffer/service/gles2_cmd_decoder_unittest_0_autogen.h"
2136 2136
2137 } // namespace gles2 2137 } // namespace gles2
2138 } // namespace gpu 2138 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698