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

Side by Side Diff: components/test_runner/test_plugin.cc

Issue 1808403002: Move simple methods [F-S] from WebGraphicsContext3D to GLES2Interface. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bindFoo
Patch Set: simples-fplus: tests 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
« no previous file with comments | « no previous file | content/renderer/media/android/webmediaplayer_android.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "components/test_runner/test_plugin.h" 5 #include "components/test_runner/test_plugin.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 GL_RGBA, 257 GL_RGBA,
258 GL_UNSIGNED_BYTE, 258 GL_UNSIGNED_BYTE,
259 0); 259 0);
260 gl_->BindFramebuffer(GL_FRAMEBUFFER, framebuffer_); 260 gl_->BindFramebuffer(GL_FRAMEBUFFER, framebuffer_);
261 gl_->FramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, 261 gl_->FramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
262 GL_TEXTURE_2D, color_texture_, 0); 262 GL_TEXTURE_2D, color_texture_, 0);
263 263
264 DrawSceneGL(); 264 DrawSceneGL();
265 265
266 gpu::Mailbox mailbox; 266 gpu::Mailbox mailbox;
267 context_->genMailboxCHROMIUM(mailbox.name); 267 gl_->GenMailboxCHROMIUM(mailbox.name);
268 context_->produceTextureCHROMIUM(GL_TEXTURE_2D, mailbox.name); 268 gl_->ProduceTextureCHROMIUM(GL_TEXTURE_2D, mailbox.name);
269 const GLuint64 fence_sync = gl_->InsertFenceSyncCHROMIUM(); 269 const GLuint64 fence_sync = gl_->InsertFenceSyncCHROMIUM();
270 context_->flush(); 270 gl_->Flush();
271 271
272 gpu::SyncToken sync_token; 272 gpu::SyncToken sync_token;
273 context_->genSyncTokenCHROMIUM(fence_sync, sync_token.GetData()); 273 context_->genSyncTokenCHROMIUM(fence_sync, sync_token.GetData());
274 texture_mailbox_ = cc::TextureMailbox(mailbox, sync_token, GL_TEXTURE_2D); 274 texture_mailbox_ = cc::TextureMailbox(mailbox, sync_token, GL_TEXTURE_2D);
275 } else { 275 } else {
276 scoped_ptr<cc::SharedBitmap> bitmap = 276 scoped_ptr<cc::SharedBitmap> bitmap =
277 delegate_->GetSharedBitmapManager()->AllocateSharedBitmap( 277 delegate_->GetSharedBitmapManager()->AllocateSharedBitmap(
278 gfx::Rect(rect_).size()); 278 gfx::Rect(rect_).size());
279 if (!bitmap) { 279 if (!bitmap) {
280 texture_mailbox_ = cc::TextureMailbox(); 280 texture_mailbox_ = cc::TextureMailbox();
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
456 "precision mediump float; \n" 456 "precision mediump float; \n"
457 "uniform vec4 color; \n" 457 "uniform vec4 color; \n"
458 "void main() { \n" 458 "void main() { \n"
459 " gl_FragColor = color; \n" 459 " gl_FragColor = color; \n"
460 "} \n"); 460 "} \n");
461 461
462 scene_.program = LoadProgram(vertex_source, fragment_source); 462 scene_.program = LoadProgram(vertex_source, fragment_source);
463 if (!scene_.program) 463 if (!scene_.program)
464 return false; 464 return false;
465 465
466 scene_.color_location = context_->getUniformLocation(scene_.program, "color"); 466 scene_.color_location = gl_->GetUniformLocation(scene_.program, "color");
467 scene_.position_location = 467 scene_.position_location = gl_->GetAttribLocation(scene_.program, "position");
468 context_->getAttribLocation(scene_.program, "position");
469 return true; 468 return true;
470 } 469 }
471 470
472 bool TestPlugin::InitPrimitive() { 471 bool TestPlugin::InitPrimitive() {
473 DCHECK_EQ(scene_.primitive, PrimitiveTriangle); 472 DCHECK_EQ(scene_.primitive, PrimitiveTriangle);
474 473
475 scene_.vbo = context_->createBuffer(); 474 scene_.vbo = context_->createBuffer();
476 if (!scene_.vbo) 475 if (!scene_.vbo)
477 return false; 476 return false;
478 477
(...skipping 26 matching lines...) Expand all
505 gl_->DrawArrays(GL_TRIANGLES, 0, 3); 504 gl_->DrawArrays(GL_TRIANGLES, 0, 3);
506 } 505 }
507 506
508 unsigned TestPlugin::LoadShader(unsigned type, const std::string& source) { 507 unsigned TestPlugin::LoadShader(unsigned type, const std::string& source) {
509 unsigned shader = context_->createShader(type); 508 unsigned shader = context_->createShader(type);
510 if (shader) { 509 if (shader) {
511 context_->shaderSource(shader, source.data()); 510 context_->shaderSource(shader, source.data());
512 gl_->CompileShader(shader); 511 gl_->CompileShader(shader);
513 512
514 int compiled = 0; 513 int compiled = 0;
515 context_->getShaderiv(shader, GL_COMPILE_STATUS, &compiled); 514 gl_->GetShaderiv(shader, GL_COMPILE_STATUS, &compiled);
516 if (!compiled) { 515 if (!compiled) {
517 context_->deleteShader(shader); 516 context_->deleteShader(shader);
518 shader = 0; 517 shader = 0;
519 } 518 }
520 } 519 }
521 return shader; 520 return shader;
522 } 521 }
523 522
524 unsigned TestPlugin::LoadProgram(const std::string& vertex_source, 523 unsigned TestPlugin::LoadProgram(const std::string& vertex_source,
525 const std::string& fragment_source) { 524 const std::string& fragment_source) {
526 unsigned vertex_shader = LoadShader(GL_VERTEX_SHADER, vertex_source); 525 unsigned vertex_shader = LoadShader(GL_VERTEX_SHADER, vertex_source);
527 unsigned fragment_shader = LoadShader(GL_FRAGMENT_SHADER, fragment_source); 526 unsigned fragment_shader = LoadShader(GL_FRAGMENT_SHADER, fragment_source);
528 unsigned program = context_->createProgram(); 527 unsigned program = context_->createProgram();
529 if (vertex_shader && fragment_shader && program) { 528 if (vertex_shader && fragment_shader && program) {
530 gl_->AttachShader(program, vertex_shader); 529 gl_->AttachShader(program, vertex_shader);
531 gl_->AttachShader(program, fragment_shader); 530 gl_->AttachShader(program, fragment_shader);
532 context_->linkProgram(program); 531 gl_->LinkProgram(program);
533 532
534 int linked = 0; 533 int linked = 0;
535 context_->getProgramiv(program, GL_LINK_STATUS, &linked); 534 gl_->GetProgramiv(program, GL_LINK_STATUS, &linked);
536 if (!linked) { 535 if (!linked) {
537 context_->deleteProgram(program); 536 context_->deleteProgram(program);
538 program = 0; 537 program = 0;
539 } 538 }
540 } 539 }
541 if (vertex_shader) 540 if (vertex_shader)
542 context_->deleteShader(vertex_shader); 541 context_->deleteShader(vertex_shader);
543 if (fragment_shader) 542 if (fragment_shader)
544 context_->deleteShader(fragment_shader); 543 context_->deleteShader(fragment_shader);
545 544
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
732 return kPluginPersistsMimeType; 731 return kPluginPersistsMimeType;
733 } 732 }
734 733
735 bool TestPlugin::IsSupportedMimeType(const blink::WebString& mime_type) { 734 bool TestPlugin::IsSupportedMimeType(const blink::WebString& mime_type) {
736 return mime_type == TestPlugin::MimeType() || 735 return mime_type == TestPlugin::MimeType() ||
737 mime_type == PluginPersistsMimeType() || 736 mime_type == PluginPersistsMimeType() ||
738 mime_type == CanCreateWithoutRendererMimeType(); 737 mime_type == CanCreateWithoutRendererMimeType();
739 } 738 }
740 739
741 } // namespace test_runner 740 } // namespace test_runner
OLDNEW
« no previous file with comments | « no previous file | content/renderer/media/android/webmediaplayer_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698