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

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

Issue 2445323006: command buffer: remove "unsafe" from autogenerated ES3 apis; cleanly separate ES3 tests (Closed)
Patch Set: address comment 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 491 matching lines...) Expand 10 before | Expand all | Expand 10 after
502 GenHelper<cmds::GenTexturesImmediate>(client_texture_id_); 502 GenHelper<cmds::GenTexturesImmediate>(client_texture_id_);
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 if (init.context_type == CONTEXT_TYPE_WEBGL2 ||
513 bool reset_unsafe_es3_apis_enabled = false; 513 init.context_type == CONTEXT_TYPE_OPENGLES3) {
514 if (!decoder_->unsafe_es3_apis_enabled()) {
515 decoder_->set_unsafe_es3_apis_enabled(true);
516 reset_unsafe_es3_apis_enabled = true;
517 }
518
519 const gl::GLVersionInfo* version = context_->GetVersionInfo();
520 if (version->IsAtLeastGL(3, 3) || version->IsAtLeastGLES(3, 0)) {
521 EXPECT_CALL(*gl_, GenSamplers(_, _)) 514 EXPECT_CALL(*gl_, GenSamplers(_, _))
522 .WillOnce(SetArgPointee<1>(kServiceSamplerId)) 515 .WillOnce(SetArgPointee<1>(kServiceSamplerId))
523 .RetiresOnSaturation(); 516 .RetiresOnSaturation();
524 GenHelper<cmds::GenSamplersImmediate>(client_sampler_id_); 517 GenHelper<cmds::GenSamplersImmediate>(client_sampler_id_);
525 } 518
526 if (version->IsAtLeastGL(4, 0) || version->IsAtLeastGLES(3, 0)) {
527 EXPECT_CALL(*gl_, GenTransformFeedbacks(_, _)) 519 EXPECT_CALL(*gl_, GenTransformFeedbacks(_, _))
528 .WillOnce(SetArgPointee<1>(kServiceTransformFeedbackId)) 520 .WillOnce(SetArgPointee<1>(kServiceTransformFeedbackId))
529 .RetiresOnSaturation(); 521 .RetiresOnSaturation();
530 GenHelper<cmds::GenTransformFeedbacksImmediate>( 522 GenHelper<cmds::GenTransformFeedbacksImmediate>(
531 client_transformfeedback_id_); 523 client_transformfeedback_id_);
532 }
533 524
534 if (init.extensions.find("GL_ARB_sync ") != std::string::npos ||
535 version->IsAtLeastGL(3, 2) || version->IsAtLeastGLES(3, 0)) {
536 DoFenceSync(client_sync_id_, kServiceSyncId); 525 DoFenceSync(client_sync_id_, kServiceSyncId);
537 } 526 }
538 527
539 if (reset_unsafe_es3_apis_enabled) {
540 decoder_->set_unsafe_es3_apis_enabled(false);
541 }
542
543 EXPECT_EQ(GL_NO_ERROR, GetGLError()); 528 EXPECT_EQ(GL_NO_ERROR, GetGLError());
544 } 529 }
545 530
546 void GLES2DecoderTestBase::ResetDecoder() { 531 void GLES2DecoderTestBase::ResetDecoder() {
547 if (!decoder_.get()) 532 if (!decoder_.get())
548 return; 533 return;
549 // All Tests should have read all their GLErrors before getting here. 534 // All Tests should have read all their GLErrors before getting here.
550 EXPECT_EQ(GL_NO_ERROR, GetGLError()); 535 EXPECT_EQ(GL_NO_ERROR, GetGLError());
551 if (!decoder_->WasContextLost()) { 536 if (!decoder_->WasContextLost()) {
552 EXPECT_CALL(*gl_, DeleteBuffersARB(1, _)).Times(2).RetiresOnSaturation(); 537 EXPECT_CALL(*gl_, DeleteBuffersARB(1, _)).Times(2).RetiresOnSaturation();
553 if (group_->feature_info()->feature_flags().native_vertex_array_object) { 538 if (group_->feature_info()->feature_flags().native_vertex_array_object) {
554 EXPECT_CALL(*gl_, 539 EXPECT_CALL(*gl_,
555 DeleteVertexArraysOES(1, Pointee(kServiceVertexArrayId))) 540 DeleteVertexArraysOES(1, Pointee(kServiceVertexArrayId)))
556 .Times(1) 541 .Times(1)
557 .RetiresOnSaturation(); 542 .RetiresOnSaturation();
558 } 543 }
559 if (group_->feature_info()->IsES3Enabled()) { 544 if (group_->feature_info()->IsES3Enabled()) {
560 // fake default transform feedback. 545 // fake default transform feedback.
561 EXPECT_CALL(*gl_, DeleteTransformFeedbacks(1, _)) 546 EXPECT_CALL(*gl_, DeleteTransformFeedbacks(1, _))
562 .Times(1) 547 .Times(1)
563 .RetiresOnSaturation(); 548 .RetiresOnSaturation();
564 } 549 }
565 if (group_->feature_info()->gl_version_info().IsAtLeastGL(4, 0) || 550 if (group_->feature_info()->IsWebGL2OrES3Context()) {
566 group_->feature_info()->gl_version_info().IsAtLeastGLES(3, 0)) {
567 // |client_transformfeedback_id_| 551 // |client_transformfeedback_id_|
568 EXPECT_CALL(*gl_, DeleteTransformFeedbacks(1, _)) 552 EXPECT_CALL(*gl_, DeleteTransformFeedbacks(1, _))
569 .Times(1) 553 .Times(1)
570 .RetiresOnSaturation(); 554 .RetiresOnSaturation();
571 } 555 }
572 } 556 }
573 557
574 decoder_->EndDecoding(); 558 decoder_->EndDecoding();
575 decoder_->Destroy(!decoder_->WasContextLost()); 559 decoder_->Destroy(!decoder_->WasContextLost());
576 decoder_.reset(); 560 decoder_.reset();
(...skipping 1552 matching lines...) Expand 10 before | Expand all | Expand 10 after
2129 SetupDefaultProgram(); 2113 SetupDefaultProgram();
2130 } 2114 }
2131 2115
2132 // Include the auto-generated part of this file. We split this because it means 2116 // 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 2117 // 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. 2118 // instead of having to edit some template or the code generator.
2135 #include "gpu/command_buffer/service/gles2_cmd_decoder_unittest_0_autogen.h" 2119 #include "gpu/command_buffer/service/gles2_cmd_decoder_unittest_0_autogen.h"
2136 2120
2137 } // namespace gles2 2121 } // namespace gles2
2138 } // namespace gpu 2122 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698