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

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

Issue 780433006: Add framebuffer object related commands to command buffer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@tex
Patch Set: Created 6 years 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/feature_info.h" 5 #include "gpu/command_buffer/service/feature_info.h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 enable_shader_name_hashing(false), 132 enable_shader_name_hashing(false),
133 enable_samplers(false), 133 enable_samplers(false),
134 ext_draw_buffers(false), 134 ext_draw_buffers(false),
135 nv_draw_buffers(false), 135 nv_draw_buffers(false),
136 ext_frag_depth(false), 136 ext_frag_depth(false),
137 ext_shader_texture_lod(false), 137 ext_shader_texture_lod(false),
138 use_async_readpixels(false), 138 use_async_readpixels(false),
139 map_buffer_range(false), 139 map_buffer_range(false),
140 ext_discard_framebuffer(false), 140 ext_discard_framebuffer(false),
141 angle_depth_texture(false), 141 angle_depth_texture(false),
142 is_angle(false),
143 is_swiftshader(false), 142 is_swiftshader(false),
144 angle_texture_usage(false), 143 angle_texture_usage(false),
145 ext_texture_storage(false), 144 ext_texture_storage(false),
146 chromium_path_rendering(false), 145 chromium_path_rendering(false),
147 blend_equation_advanced(false), 146 blend_equation_advanced(false),
148 blend_equation_advanced_coherent(false), 147 blend_equation_advanced_coherent(false),
149 ext_texture_rg(false), 148 ext_texture_rg(false),
150 enable_subscribe_uniform(false) { 149 enable_subscribe_uniform(false) {
151 } 150 }
152 151
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 return result; 263 return result;
265 } 264 }
266 265
267 void FeatureInfo::InitializeFeatures() { 266 void FeatureInfo::InitializeFeatures() {
268 // Figure out what extensions to turn on. 267 // Figure out what extensions to turn on.
269 StringSet extensions( 268 StringSet extensions(
270 reinterpret_cast<const char*>(glGetString(GL_EXTENSIONS))); 269 reinterpret_cast<const char*>(glGetString(GL_EXTENSIONS)));
271 270
272 const char* renderer_str = 271 const char* renderer_str =
273 reinterpret_cast<const char*>(glGetString(GL_RENDERER)); 272 reinterpret_cast<const char*>(glGetString(GL_RENDERER));
274 if (renderer_str) {
275 feature_flags_.is_angle = StartsWithASCII(renderer_str, "ANGLE", true);
276 }
277
278 bool is_es3 = false;
279 const char* version_str = 273 const char* version_str =
280 reinterpret_cast<const char*>(glGetString(GL_VERSION)); 274 reinterpret_cast<const char*>(glGetString(GL_VERSION));
281 if (version_str) { 275
282 std::string lstr(base::StringToLowerASCII(std::string(version_str))); 276 gl_version_info_.reset(new gfx::GLVersionInfo(version_str, renderer_str));
283 is_es3 = (lstr.substr(0, 12) == "opengl es 3.");
284 }
285 277
286 AddExtensionString("GL_ANGLE_translated_shader_source"); 278 AddExtensionString("GL_ANGLE_translated_shader_source");
287 AddExtensionString("GL_CHROMIUM_async_pixel_transfers"); 279 AddExtensionString("GL_CHROMIUM_async_pixel_transfers");
288 AddExtensionString("GL_CHROMIUM_bind_uniform_location"); 280 AddExtensionString("GL_CHROMIUM_bind_uniform_location");
289 AddExtensionString("GL_CHROMIUM_command_buffer_query"); 281 AddExtensionString("GL_CHROMIUM_command_buffer_query");
290 AddExtensionString("GL_CHROMIUM_command_buffer_latency_query"); 282 AddExtensionString("GL_CHROMIUM_command_buffer_latency_query");
291 AddExtensionString("GL_CHROMIUM_copy_texture"); 283 AddExtensionString("GL_CHROMIUM_copy_texture");
292 AddExtensionString("GL_CHROMIUM_get_error_query"); 284 AddExtensionString("GL_CHROMIUM_get_error_query");
293 AddExtensionString("GL_CHROMIUM_lose_context"); 285 AddExtensionString("GL_CHROMIUM_lose_context");
294 AddExtensionString("GL_CHROMIUM_pixel_transfer_buffer_object"); 286 AddExtensionString("GL_CHROMIUM_pixel_transfer_buffer_object");
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
379 // 371 //
380 // Therefore we made up GL_GOOGLE_depth_texture / GL_CHROMIUM_depth_texture. 372 // Therefore we made up GL_GOOGLE_depth_texture / GL_CHROMIUM_depth_texture.
381 // 373 //
382 // GL_GOOGLE_depth_texture is legacy. As we exposed it into NaCl we can't 374 // GL_GOOGLE_depth_texture is legacy. As we exposed it into NaCl we can't
383 // get rid of it. 375 // get rid of it.
384 // 376 //
385 bool enable_depth_texture = false; 377 bool enable_depth_texture = false;
386 if (!workarounds_.disable_depth_texture && 378 if (!workarounds_.disable_depth_texture &&
387 (extensions.Contains("GL_ARB_depth_texture") || 379 (extensions.Contains("GL_ARB_depth_texture") ||
388 extensions.Contains("GL_OES_depth_texture") || 380 extensions.Contains("GL_OES_depth_texture") ||
389 extensions.Contains("GL_ANGLE_depth_texture") || is_es3)) { 381 extensions.Contains("GL_ANGLE_depth_texture") ||
382 gl_version_info_->is_es3)) {
390 enable_depth_texture = true; 383 enable_depth_texture = true;
391 feature_flags_.angle_depth_texture = 384 feature_flags_.angle_depth_texture =
392 extensions.Contains("GL_ANGLE_depth_texture"); 385 extensions.Contains("GL_ANGLE_depth_texture");
393 } 386 }
394 387
395 if (enable_depth_texture) { 388 if (enable_depth_texture) {
396 AddExtensionString("GL_CHROMIUM_depth_texture"); 389 AddExtensionString("GL_CHROMIUM_depth_texture");
397 AddExtensionString("GL_GOOGLE_depth_texture"); 390 AddExtensionString("GL_GOOGLE_depth_texture");
398 texture_format_validators_[GL_DEPTH_COMPONENT].AddValue(GL_UNSIGNED_SHORT); 391 texture_format_validators_[GL_DEPTH_COMPONENT].AddValue(GL_UNSIGNED_SHORT);
399 texture_format_validators_[GL_DEPTH_COMPONENT].AddValue(GL_UNSIGNED_INT); 392 texture_format_validators_[GL_DEPTH_COMPONENT].AddValue(GL_UNSIGNED_INT);
400 validators_.texture_internal_format.AddValue(GL_DEPTH_COMPONENT); 393 validators_.texture_internal_format.AddValue(GL_DEPTH_COMPONENT);
401 validators_.texture_format.AddValue(GL_DEPTH_COMPONENT); 394 validators_.texture_format.AddValue(GL_DEPTH_COMPONENT);
402 validators_.pixel_type.AddValue(GL_UNSIGNED_SHORT); 395 validators_.pixel_type.AddValue(GL_UNSIGNED_SHORT);
403 validators_.pixel_type.AddValue(GL_UNSIGNED_INT); 396 validators_.pixel_type.AddValue(GL_UNSIGNED_INT);
404 } 397 }
405 398
406 if (extensions.Contains("GL_EXT_packed_depth_stencil") || 399 if (extensions.Contains("GL_EXT_packed_depth_stencil") ||
407 extensions.Contains("GL_OES_packed_depth_stencil") || is_es3) { 400 extensions.Contains("GL_OES_packed_depth_stencil") ||
401 gl_version_info_->is_es3) {
408 AddExtensionString("GL_OES_packed_depth_stencil"); 402 AddExtensionString("GL_OES_packed_depth_stencil");
409 feature_flags_.packed_depth24_stencil8 = true; 403 feature_flags_.packed_depth24_stencil8 = true;
410 if (enable_depth_texture) { 404 if (enable_depth_texture) {
411 texture_format_validators_[GL_DEPTH_STENCIL] 405 texture_format_validators_[GL_DEPTH_STENCIL]
412 .AddValue(GL_UNSIGNED_INT_24_8); 406 .AddValue(GL_UNSIGNED_INT_24_8);
413 validators_.texture_internal_format.AddValue(GL_DEPTH_STENCIL); 407 validators_.texture_internal_format.AddValue(GL_DEPTH_STENCIL);
414 validators_.texture_format.AddValue(GL_DEPTH_STENCIL); 408 validators_.texture_format.AddValue(GL_DEPTH_STENCIL);
415 validators_.pixel_type.AddValue(GL_UNSIGNED_INT_24_8); 409 validators_.pixel_type.AddValue(GL_UNSIGNED_INT_24_8);
416 } 410 }
417 validators_.render_buffer_format.AddValue(GL_DEPTH24_STENCIL8); 411 validators_.render_buffer_format.AddValue(GL_DEPTH24_STENCIL8);
418 } 412 }
419 413
420 if (is_es3 || extensions.Contains("GL_OES_vertex_array_object") || 414 if (gl_version_info_->is_es3 ||
415 extensions.Contains("GL_OES_vertex_array_object") ||
421 extensions.Contains("GL_ARB_vertex_array_object") || 416 extensions.Contains("GL_ARB_vertex_array_object") ||
422 extensions.Contains("GL_APPLE_vertex_array_object")) { 417 extensions.Contains("GL_APPLE_vertex_array_object")) {
423 feature_flags_.native_vertex_array_object = true; 418 feature_flags_.native_vertex_array_object = true;
424 } 419 }
425 420
426 // If we're using client_side_arrays we have to emulate 421 // If we're using client_side_arrays we have to emulate
427 // vertex array objects since vertex array objects do not work 422 // vertex array objects since vertex array objects do not work
428 // with client side arrays. 423 // with client side arrays.
429 if (workarounds_.use_client_side_arrays_for_stream_buffers) { 424 if (workarounds_.use_client_side_arrays_for_stream_buffers) {
430 feature_flags_.native_vertex_array_object = false; 425 feature_flags_.native_vertex_array_object = false;
431 } 426 }
432 427
433 if (is_es3 || extensions.Contains("GL_OES_element_index_uint") || 428 if (gl_version_info_->is_es3 ||
429 extensions.Contains("GL_OES_element_index_uint") ||
434 gfx::HasDesktopGLFeatures()) { 430 gfx::HasDesktopGLFeatures()) {
435 AddExtensionString("GL_OES_element_index_uint"); 431 AddExtensionString("GL_OES_element_index_uint");
436 validators_.index_type.AddValue(GL_UNSIGNED_INT); 432 validators_.index_type.AddValue(GL_UNSIGNED_INT);
437 } 433 }
438 434
439 // With EXT_sRGB, unsized SRGB_EXT and SRGB_ALPHA_EXT are accepted by the 435 // With EXT_sRGB, unsized SRGB_EXT and SRGB_ALPHA_EXT are accepted by the
440 // <format> and <internalformat> parameter of TexImage2D. GLES3 adds support 436 // <format> and <internalformat> parameter of TexImage2D. GLES3 adds support
441 // for SRGB Textures but the accepted internal formats for TexImage2D are only 437 // for SRGB Textures but the accepted internal formats for TexImage2D are only
442 // sized formats GL_SRGB8 and GL_SRGB8_ALPHA8. Also, SRGB_EXT isn't a valid 438 // sized formats GL_SRGB8 and GL_SRGB8_ALPHA8. Also, SRGB_EXT isn't a valid
443 // <format> in this case. So, even with GLES3 explicitly check for 439 // <format> in this case. So, even with GLES3 explicitly check for
444 // GL_EXT_sRGB. 440 // GL_EXT_sRGB.
445 if (((is_es3 || extensions.Contains("GL_OES_rgb8_rgba8")) && 441 if (((gl_version_info_->is_es3 ||
442 extensions.Contains("GL_OES_rgb8_rgba8")) &&
446 extensions.Contains("GL_EXT_sRGB")) || gfx::HasDesktopGLFeatures()) { 443 extensions.Contains("GL_EXT_sRGB")) || gfx::HasDesktopGLFeatures()) {
447 AddExtensionString("GL_EXT_sRGB"); 444 AddExtensionString("GL_EXT_sRGB");
448 texture_format_validators_[GL_SRGB_EXT].AddValue(GL_UNSIGNED_BYTE); 445 texture_format_validators_[GL_SRGB_EXT].AddValue(GL_UNSIGNED_BYTE);
449 texture_format_validators_[GL_SRGB_ALPHA_EXT].AddValue(GL_UNSIGNED_BYTE); 446 texture_format_validators_[GL_SRGB_ALPHA_EXT].AddValue(GL_UNSIGNED_BYTE);
450 validators_.texture_internal_format.AddValue(GL_SRGB_EXT); 447 validators_.texture_internal_format.AddValue(GL_SRGB_EXT);
451 validators_.texture_internal_format.AddValue(GL_SRGB_ALPHA_EXT); 448 validators_.texture_internal_format.AddValue(GL_SRGB_ALPHA_EXT);
452 validators_.texture_format.AddValue(GL_SRGB_EXT); 449 validators_.texture_format.AddValue(GL_SRGB_EXT);
453 validators_.texture_format.AddValue(GL_SRGB_ALPHA_EXT); 450 validators_.texture_format.AddValue(GL_SRGB_ALPHA_EXT);
454 validators_.render_buffer_format.AddValue(GL_SRGB8_ALPHA8_EXT); 451 validators_.render_buffer_format.AddValue(GL_SRGB8_ALPHA8_EXT);
455 validators_.frame_buffer_parameter.AddValue( 452 validators_.frame_buffer_parameter.AddValue(
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
496 validators_.render_buffer_format.AddValue(GL_BGRA8_EXT); 493 validators_.render_buffer_format.AddValue(GL_BGRA8_EXT);
497 } 494 }
498 495
499 if (extensions.Contains("GL_OES_rgb8_rgba8") || gfx::HasDesktopGLFeatures()) { 496 if (extensions.Contains("GL_OES_rgb8_rgba8") || gfx::HasDesktopGLFeatures()) {
500 AddExtensionString("GL_OES_rgb8_rgba8"); 497 AddExtensionString("GL_OES_rgb8_rgba8");
501 validators_.render_buffer_format.AddValue(GL_RGB8_OES); 498 validators_.render_buffer_format.AddValue(GL_RGB8_OES);
502 validators_.render_buffer_format.AddValue(GL_RGBA8_OES); 499 validators_.render_buffer_format.AddValue(GL_RGBA8_OES);
503 } 500 }
504 501
505 // Check if we should allow GL_OES_texture_npot 502 // Check if we should allow GL_OES_texture_npot
506 if (is_es3 || extensions.Contains("GL_ARB_texture_non_power_of_two") || 503 if (gl_version_info_->is_es3 ||
504 extensions.Contains("GL_ARB_texture_non_power_of_two") ||
507 extensions.Contains("GL_OES_texture_npot")) { 505 extensions.Contains("GL_OES_texture_npot")) {
508 AddExtensionString("GL_OES_texture_npot"); 506 AddExtensionString("GL_OES_texture_npot");
509 feature_flags_.npot_ok = true; 507 feature_flags_.npot_ok = true;
510 } 508 }
511 509
512 // Check if we should allow GL_OES_texture_float, GL_OES_texture_half_float, 510 // Check if we should allow GL_OES_texture_float, GL_OES_texture_half_float,
513 // GL_OES_texture_float_linear, GL_OES_texture_half_float_linear 511 // GL_OES_texture_float_linear, GL_OES_texture_half_float_linear
514 bool enable_texture_float = false; 512 bool enable_texture_float = false;
515 bool enable_texture_float_linear = false; 513 bool enable_texture_float_linear = false;
516 bool enable_texture_half_float = false; 514 bool enable_texture_half_float = false;
(...skipping 11 matching lines...) Expand all
528 // GLES3 adds support for Float type by default but it doesn't support all 526 // GLES3 adds support for Float type by default but it doesn't support all
529 // formats as GL_OES_texture_float(i.e.LUMINANCE_ALPHA,LUMINANCE and Alpha) 527 // formats as GL_OES_texture_float(i.e.LUMINANCE_ALPHA,LUMINANCE and Alpha)
530 if (extensions.Contains("GL_OES_texture_float")) { 528 if (extensions.Contains("GL_OES_texture_float")) {
531 enable_texture_float = true; 529 enable_texture_float = true;
532 if (extensions.Contains("GL_OES_texture_float_linear")) { 530 if (extensions.Contains("GL_OES_texture_float_linear")) {
533 enable_texture_float_linear = true; 531 enable_texture_float_linear = true;
534 } 532 }
535 // This extension allows a variety of floating point formats to be 533 // This extension allows a variety of floating point formats to be
536 // rendered to via framebuffer objects. Enable it's usage only if 534 // rendered to via framebuffer objects. Enable it's usage only if
537 // support for Floating textures is enabled. 535 // support for Floating textures is enabled.
538 if ((is_es3 && extensions.Contains("GL_EXT_color_buffer_float")) || 536 if ((gl_version_info_->is_es3 &&
539 feature_flags_.is_angle) { 537 extensions.Contains("GL_EXT_color_buffer_float")) ||
538 gl_version_info_->is_angle) {
540 may_enable_chromium_color_buffer_float = true; 539 may_enable_chromium_color_buffer_float = true;
541 } 540 }
542 } 541 }
543 542
544 // TODO(dshwang): GLES3 supports half float by default but GL_HALF_FLOAT_OES 543 // TODO(dshwang): GLES3 supports half float by default but GL_HALF_FLOAT_OES
545 // isn't equal to GL_HALF_FLOAT. 544 // isn't equal to GL_HALF_FLOAT.
546 if (extensions.Contains("GL_OES_texture_half_float")) { 545 if (extensions.Contains("GL_OES_texture_half_float")) {
547 enable_texture_half_float = true; 546 enable_texture_half_float = true;
548 if (extensions.Contains("GL_OES_texture_half_float_linear")) { 547 if (extensions.Contains("GL_OES_texture_half_float_linear")) {
549 enable_texture_half_float_linear = true; 548 enable_texture_half_float_linear = true;
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
631 if (statusRGB == GL_FRAMEBUFFER_COMPLETE) { 630 if (statusRGB == GL_FRAMEBUFFER_COMPLETE) {
632 validators_.texture_internal_format.AddValue(GL_RGB32F); 631 validators_.texture_internal_format.AddValue(GL_RGB32F);
633 feature_flags_.chromium_color_buffer_float_rgb = true; 632 feature_flags_.chromium_color_buffer_float_rgb = true;
634 AddExtensionString("GL_CHROMIUM_color_buffer_float_rgb"); 633 AddExtensionString("GL_CHROMIUM_color_buffer_float_rgb");
635 } 634 }
636 } 635 }
637 636
638 // Check for multisample support 637 // Check for multisample support
639 if (!workarounds_.disable_multisampling) { 638 if (!workarounds_.disable_multisampling) {
640 bool ext_has_multisample = 639 bool ext_has_multisample =
641 extensions.Contains("GL_EXT_framebuffer_multisample") || is_es3; 640 extensions.Contains("GL_EXT_framebuffer_multisample") ||
642 if (feature_flags_.is_angle) { 641 gl_version_info_->is_es3;
642 if (gl_version_info_->is_angle) {
643 ext_has_multisample |= 643 ext_has_multisample |=
644 extensions.Contains("GL_ANGLE_framebuffer_multisample"); 644 extensions.Contains("GL_ANGLE_framebuffer_multisample");
645 } 645 }
646 feature_flags_.use_core_framebuffer_multisample = is_es3; 646 feature_flags_.use_core_framebuffer_multisample = gl_version_info_->is_es3;
647 if (ext_has_multisample) { 647 if (ext_has_multisample) {
648 feature_flags_.chromium_framebuffer_multisample = true; 648 feature_flags_.chromium_framebuffer_multisample = true;
649 validators_.frame_buffer_target.AddValue(GL_READ_FRAMEBUFFER_EXT); 649 validators_.frame_buffer_target.AddValue(GL_READ_FRAMEBUFFER_EXT);
650 validators_.frame_buffer_target.AddValue(GL_DRAW_FRAMEBUFFER_EXT); 650 validators_.frame_buffer_target.AddValue(GL_DRAW_FRAMEBUFFER_EXT);
651 validators_.g_l_state.AddValue(GL_READ_FRAMEBUFFER_BINDING_EXT); 651 validators_.g_l_state.AddValue(GL_READ_FRAMEBUFFER_BINDING_EXT);
652 validators_.g_l_state.AddValue(GL_MAX_SAMPLES_EXT); 652 validators_.g_l_state.AddValue(GL_MAX_SAMPLES_EXT);
653 validators_.render_buffer_parameter.AddValue(GL_RENDERBUFFER_SAMPLES_EXT); 653 validators_.render_buffer_parameter.AddValue(GL_RENDERBUFFER_SAMPLES_EXT);
654 AddExtensionString("GL_CHROMIUM_framebuffer_multisample"); 654 AddExtensionString("GL_CHROMIUM_framebuffer_multisample");
655 } 655 }
656 if (extensions.Contains("GL_EXT_multisampled_render_to_texture")) { 656 if (extensions.Contains("GL_EXT_multisampled_render_to_texture")) {
657 feature_flags_.multisampled_render_to_texture = true; 657 feature_flags_.multisampled_render_to_texture = true;
658 } else if (extensions.Contains("GL_IMG_multisampled_render_to_texture")) { 658 } else if (extensions.Contains("GL_IMG_multisampled_render_to_texture")) {
659 feature_flags_.multisampled_render_to_texture = true; 659 feature_flags_.multisampled_render_to_texture = true;
660 feature_flags_.use_img_for_multisampled_render_to_texture = true; 660 feature_flags_.use_img_for_multisampled_render_to_texture = true;
661 } 661 }
662 if (feature_flags_.multisampled_render_to_texture) { 662 if (feature_flags_.multisampled_render_to_texture) {
663 validators_.render_buffer_parameter.AddValue( 663 validators_.render_buffer_parameter.AddValue(
664 GL_RENDERBUFFER_SAMPLES_EXT); 664 GL_RENDERBUFFER_SAMPLES_EXT);
665 validators_.g_l_state.AddValue(GL_MAX_SAMPLES_EXT); 665 validators_.g_l_state.AddValue(GL_MAX_SAMPLES_EXT);
666 validators_.frame_buffer_parameter.AddValue( 666 validators_.frame_buffer_parameter.AddValue(
667 GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_SAMPLES_EXT); 667 GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_SAMPLES_EXT);
668 AddExtensionString("GL_EXT_multisampled_render_to_texture"); 668 AddExtensionString("GL_EXT_multisampled_render_to_texture");
669 } 669 }
670 } 670 }
671 671
672 if (extensions.Contains("GL_OES_depth24") || gfx::HasDesktopGLFeatures() || 672 if (extensions.Contains("GL_OES_depth24") || gfx::HasDesktopGLFeatures() ||
673 is_es3) { 673 gl_version_info_->is_es3) {
674 AddExtensionString("GL_OES_depth24"); 674 AddExtensionString("GL_OES_depth24");
675 feature_flags_.oes_depth24 = true; 675 feature_flags_.oes_depth24 = true;
676 validators_.render_buffer_format.AddValue(GL_DEPTH_COMPONENT24); 676 validators_.render_buffer_format.AddValue(GL_DEPTH_COMPONENT24);
677 } 677 }
678 678
679 if (!workarounds_.disable_oes_standard_derivatives && 679 if (!workarounds_.disable_oes_standard_derivatives &&
680 (is_es3 || extensions.Contains("GL_OES_standard_derivatives") || 680 (gl_version_info_->is_es3 ||
681 extensions.Contains("GL_OES_standard_derivatives") ||
681 gfx::HasDesktopGLFeatures())) { 682 gfx::HasDesktopGLFeatures())) {
682 AddExtensionString("GL_OES_standard_derivatives"); 683 AddExtensionString("GL_OES_standard_derivatives");
683 feature_flags_.oes_standard_derivatives = true; 684 feature_flags_.oes_standard_derivatives = true;
684 validators_.hint_target.AddValue(GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES); 685 validators_.hint_target.AddValue(GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES);
685 validators_.g_l_state.AddValue(GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES); 686 validators_.g_l_state.AddValue(GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES);
686 } 687 }
687 688
688 if (extensions.Contains("GL_OES_EGL_image_external")) { 689 if (extensions.Contains("GL_OES_EGL_image_external")) {
689 AddExtensionString("GL_OES_EGL_image_external"); 690 AddExtensionString("GL_OES_EGL_image_external");
690 feature_flags_.oes_egl_image_external = true; 691 feature_flags_.oes_egl_image_external = true;
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
764 validators_.texture_parameter.AddValue(GL_TEXTURE_USAGE_ANGLE); 765 validators_.texture_parameter.AddValue(GL_TEXTURE_USAGE_ANGLE);
765 } 766 }
766 767
767 // Note: Only APPLE_texture_format_BGRA8888 extension allows BGRA8_EXT in 768 // Note: Only APPLE_texture_format_BGRA8888 extension allows BGRA8_EXT in
768 // ES3's glTexStorage2D. We prefer support BGRA to texture storage. 769 // ES3's glTexStorage2D. We prefer support BGRA to texture storage.
769 // So we don't expose GL_EXT_texture_storage when ES3 + 770 // So we don't expose GL_EXT_texture_storage when ES3 +
770 // GL_EXT_texture_format_BGRA8888 because we fail the GL_BGRA8 requirement. 771 // GL_EXT_texture_format_BGRA8888 because we fail the GL_BGRA8 requirement.
771 // However we expose GL_EXT_texture_storage when just ES3 because we don't 772 // However we expose GL_EXT_texture_storage when just ES3 because we don't
772 // claim to handle GL_BGRA8. 773 // claim to handle GL_BGRA8.
773 bool support_texture_storage_on_es3 = 774 bool support_texture_storage_on_es3 =
774 (is_es3 && enable_immutable_texture_format_bgra_on_es3) || 775 (gl_version_info_->is_es3 &&
775 (is_es3 && !enable_texture_format_bgra8888); 776 enable_immutable_texture_format_bgra_on_es3) ||
777 (gl_version_info_->is_es3 &&
778 !enable_texture_format_bgra8888);
776 if (extensions.Contains("GL_EXT_texture_storage") || 779 if (extensions.Contains("GL_EXT_texture_storage") ||
777 extensions.Contains("GL_ARB_texture_storage") || 780 extensions.Contains("GL_ARB_texture_storage") ||
778 support_texture_storage_on_es3) { 781 support_texture_storage_on_es3) {
779 feature_flags_.ext_texture_storage = true; 782 feature_flags_.ext_texture_storage = true;
780 AddExtensionString("GL_EXT_texture_storage"); 783 AddExtensionString("GL_EXT_texture_storage");
781 validators_.texture_parameter.AddValue(GL_TEXTURE_IMMUTABLE_FORMAT_EXT); 784 validators_.texture_parameter.AddValue(GL_TEXTURE_IMMUTABLE_FORMAT_EXT);
782 if (enable_texture_format_bgra8888) 785 if (enable_texture_format_bgra8888)
783 validators_.texture_internal_format_storage.AddValue(GL_BGRA8_EXT); 786 validators_.texture_internal_format_storage.AddValue(GL_BGRA8_EXT);
784 if (enable_texture_float) { 787 if (enable_texture_float) {
785 validators_.texture_internal_format_storage.AddValue(GL_RGBA32F_EXT); 788 validators_.texture_internal_format_storage.AddValue(GL_RGBA32F_EXT);
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
818 !have_ext_occlusion_query_boolean && have_arb_occlusion_query2; 821 !have_ext_occlusion_query_boolean && have_arb_occlusion_query2;
819 feature_flags_.use_arb_occlusion_query_for_occlusion_query_boolean = 822 feature_flags_.use_arb_occlusion_query_for_occlusion_query_boolean =
820 !have_ext_occlusion_query_boolean && have_arb_occlusion_query && 823 !have_ext_occlusion_query_boolean && have_arb_occlusion_query &&
821 !have_arb_occlusion_query2; 824 !have_arb_occlusion_query2;
822 } 825 }
823 826
824 if (!workarounds_.disable_angle_instanced_arrays && 827 if (!workarounds_.disable_angle_instanced_arrays &&
825 (extensions.Contains("GL_ANGLE_instanced_arrays") || 828 (extensions.Contains("GL_ANGLE_instanced_arrays") ||
826 (extensions.Contains("GL_ARB_instanced_arrays") && 829 (extensions.Contains("GL_ARB_instanced_arrays") &&
827 extensions.Contains("GL_ARB_draw_instanced")) || 830 extensions.Contains("GL_ARB_draw_instanced")) ||
828 is_es3)) { 831 gl_version_info_->is_es3)) {
829 AddExtensionString("GL_ANGLE_instanced_arrays"); 832 AddExtensionString("GL_ANGLE_instanced_arrays");
830 feature_flags_.angle_instanced_arrays = true; 833 feature_flags_.angle_instanced_arrays = true;
831 validators_.vertex_attribute.AddValue(GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE); 834 validators_.vertex_attribute.AddValue(GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE);
832 } 835 }
833 836
834 bool vendor_agnostic_draw_buffers = 837 bool vendor_agnostic_draw_buffers =
835 extensions.Contains("GL_ARB_draw_buffers") || 838 extensions.Contains("GL_ARB_draw_buffers") ||
836 extensions.Contains("GL_EXT_draw_buffers"); 839 extensions.Contains("GL_EXT_draw_buffers");
837 if (!workarounds_.disable_ext_draw_buffers && 840 if (!workarounds_.disable_ext_draw_buffers &&
838 (vendor_agnostic_draw_buffers || 841 (vendor_agnostic_draw_buffers ||
839 (extensions.Contains("GL_NV_draw_buffers") && is_es3))) { 842 (extensions.Contains("GL_NV_draw_buffers") &&
843 gl_version_info_->is_es3))) {
840 AddExtensionString("GL_EXT_draw_buffers"); 844 AddExtensionString("GL_EXT_draw_buffers");
841 feature_flags_.ext_draw_buffers = true; 845 feature_flags_.ext_draw_buffers = true;
842 846
843 // This flag is set to enable emulation of EXT_draw_buffers when we're 847 // This flag is set to enable emulation of EXT_draw_buffers when we're
844 // running on GLES 3.0+, NV_draw_buffers extension is supported and 848 // running on GLES 3.0+, NV_draw_buffers extension is supported and
845 // glDrawBuffers from GLES 3.0 core has been bound. It toggles using the 849 // glDrawBuffers from GLES 3.0 core has been bound. It toggles using the
846 // NV_draw_buffers extension directive instead of EXT_draw_buffers extension 850 // NV_draw_buffers extension directive instead of EXT_draw_buffers extension
847 // directive in ESSL 100 shaders translated by ANGLE, enabling them to write 851 // directive in ESSL 100 shaders translated by ANGLE, enabling them to write
848 // into multiple gl_FragData values, which is not by default possible in 852 // into multiple gl_FragData values, which is not by default possible in
849 // ESSL 100 with core GLES 3.0. For more information, see the 853 // ESSL 100 with core GLES 3.0. For more information, see the
(...skipping 14 matching lines...) Expand all
864 validators_.g_l_state.AddValue(GL_MAX_DRAW_BUFFERS_ARB); 868 validators_.g_l_state.AddValue(GL_MAX_DRAW_BUFFERS_ARB);
865 GLint max_draw_buffers = 0; 869 GLint max_draw_buffers = 0;
866 glGetIntegerv(GL_MAX_DRAW_BUFFERS_ARB, &max_draw_buffers); 870 glGetIntegerv(GL_MAX_DRAW_BUFFERS_ARB, &max_draw_buffers);
867 for (GLenum i = GL_DRAW_BUFFER0_ARB; 871 for (GLenum i = GL_DRAW_BUFFER0_ARB;
868 i < static_cast<GLenum>(GL_DRAW_BUFFER0_ARB + max_draw_buffers); 872 i < static_cast<GLenum>(GL_DRAW_BUFFER0_ARB + max_draw_buffers);
869 ++i) { 873 ++i) {
870 validators_.g_l_state.AddValue(i); 874 validators_.g_l_state.AddValue(i);
871 } 875 }
872 } 876 }
873 877
874 if (is_es3 || extensions.Contains("GL_EXT_blend_minmax") || 878 if (gl_version_info_->is_es3 ||
879 extensions.Contains("GL_EXT_blend_minmax") ||
875 gfx::HasDesktopGLFeatures()) { 880 gfx::HasDesktopGLFeatures()) {
876 AddExtensionString("GL_EXT_blend_minmax"); 881 AddExtensionString("GL_EXT_blend_minmax");
877 validators_.equation.AddValue(GL_MIN_EXT); 882 validators_.equation.AddValue(GL_MIN_EXT);
878 validators_.equation.AddValue(GL_MAX_EXT); 883 validators_.equation.AddValue(GL_MAX_EXT);
879 COMPILE_ASSERT(GL_MIN_EXT == GL_MIN && GL_MAX_EXT == GL_MAX, 884 COMPILE_ASSERT(GL_MIN_EXT == GL_MIN && GL_MAX_EXT == GL_MAX,
880 min_max_variations_must_match); 885 min_max_variations_must_match);
881 } 886 }
882 887
883 // TODO(dshwang): GLES3 supports gl_FragDepth, not gl_FragDepthEXT. 888 // TODO(dshwang): GLES3 supports gl_FragDepth, not gl_FragDepthEXT.
884 if (extensions.Contains("GL_EXT_frag_depth") || gfx::HasDesktopGLFeatures()) { 889 if (extensions.Contains("GL_EXT_frag_depth") || gfx::HasDesktopGLFeatures()) {
(...skipping 14 matching lines...) Expand all
899 if (workarounds_.disable_egl_khr_wait_sync) { 904 if (workarounds_.disable_egl_khr_wait_sync) {
900 gfx::g_driver_egl.ext.b_EGL_KHR_wait_sync = false; 905 gfx::g_driver_egl.ext.b_EGL_KHR_wait_sync = false;
901 } 906 }
902 #endif 907 #endif
903 if (workarounds_.disable_arb_sync) 908 if (workarounds_.disable_arb_sync)
904 gfx::g_driver_gl.ext.b_GL_ARB_sync = false; 909 gfx::g_driver_gl.ext.b_GL_ARB_sync = false;
905 bool ui_gl_fence_works = gfx::GLFence::IsSupported(); 910 bool ui_gl_fence_works = gfx::GLFence::IsSupported();
906 UMA_HISTOGRAM_BOOLEAN("GPU.FenceSupport", ui_gl_fence_works); 911 UMA_HISTOGRAM_BOOLEAN("GPU.FenceSupport", ui_gl_fence_works);
907 912
908 feature_flags_.map_buffer_range = 913 feature_flags_.map_buffer_range =
909 is_es3 || extensions.Contains("GL_ARB_map_buffer_range") || 914 gl_version_info_->is_es3 ||
915 extensions.Contains("GL_ARB_map_buffer_range") ||
910 extensions.Contains("GL_EXT_map_buffer_range"); 916 extensions.Contains("GL_EXT_map_buffer_range");
911 917
912 // Really it's part of core OpenGL 2.1 and up, but let's assume the 918 // Really it's part of core OpenGL 2.1 and up, but let's assume the
913 // extension is still advertised. 919 // extension is still advertised.
914 bool has_pixel_buffers = 920 bool has_pixel_buffers =
915 is_es3 || extensions.Contains("GL_ARB_pixel_buffer_object") || 921 gl_version_info_->is_es3 ||
922 extensions.Contains("GL_ARB_pixel_buffer_object") ||
916 extensions.Contains("GL_NV_pixel_buffer_object"); 923 extensions.Contains("GL_NV_pixel_buffer_object");
917 924
918 // We will use either glMapBuffer() or glMapBufferRange() for async readbacks. 925 // We will use either glMapBuffer() or glMapBufferRange() for async readbacks.
919 if (has_pixel_buffers && ui_gl_fence_works && 926 if (has_pixel_buffers && ui_gl_fence_works &&
920 !workarounds_.disable_async_readpixels) { 927 !workarounds_.disable_async_readpixels) {
921 feature_flags_.use_async_readpixels = true; 928 feature_flags_.use_async_readpixels = true;
922 } 929 }
923 930
924 if (is_es3 || extensions.Contains("GL_ARB_sampler_objects")) { 931 if (gl_version_info_->is_es3 ||
932 extensions.Contains("GL_ARB_sampler_objects")) {
925 feature_flags_.enable_samplers = true; 933 feature_flags_.enable_samplers = true;
926 // TODO(dsinclair): Add AddExtensionString("GL_CHROMIUM_sampler_objects") 934 // TODO(dsinclair): Add AddExtensionString("GL_CHROMIUM_sampler_objects")
927 // when available. 935 // when available.
928 } 936 }
929 937
930 if ((is_es3 || extensions.Contains("GL_EXT_discard_framebuffer")) && 938 if ((gl_version_info_->is_es3 ||
939 extensions.Contains("GL_EXT_discard_framebuffer")) &&
931 !workarounds_.disable_ext_discard_framebuffer) { 940 !workarounds_.disable_ext_discard_framebuffer) {
932 // DiscardFramebufferEXT is automatically bound to InvalidateFramebuffer. 941 // DiscardFramebufferEXT is automatically bound to InvalidateFramebuffer.
933 AddExtensionString("GL_EXT_discard_framebuffer"); 942 AddExtensionString("GL_EXT_discard_framebuffer");
934 feature_flags_.ext_discard_framebuffer = true; 943 feature_flags_.ext_discard_framebuffer = true;
935 } 944 }
936 945
937 if (ui_gl_fence_works) { 946 if (ui_gl_fence_works) {
938 AddExtensionString("GL_CHROMIUM_sync_query"); 947 AddExtensionString("GL_CHROMIUM_sync_query");
939 feature_flags_.chromium_sync_query = true; 948 feature_flags_.chromium_sync_query = true;
940 } 949 }
(...skipping 26 matching lines...) Expand all
967 if (blend_equation_advanced_coherent) 976 if (blend_equation_advanced_coherent)
968 AddExtensionString("GL_KHR_blend_equation_advanced_coherent"); 977 AddExtensionString("GL_KHR_blend_equation_advanced_coherent");
969 978
970 AddExtensionString("GL_KHR_blend_equation_advanced"); 979 AddExtensionString("GL_KHR_blend_equation_advanced");
971 feature_flags_.blend_equation_advanced = true; 980 feature_flags_.blend_equation_advanced = true;
972 feature_flags_.blend_equation_advanced_coherent = 981 feature_flags_.blend_equation_advanced_coherent =
973 blend_equation_advanced_coherent; 982 blend_equation_advanced_coherent;
974 } 983 }
975 984
976 if (extensions.Contains("GL_NV_path_rendering")) { 985 if (extensions.Contains("GL_NV_path_rendering")) {
977 if (extensions.Contains("GL_EXT_direct_state_access") || is_es3) { 986 if (extensions.Contains("GL_EXT_direct_state_access") ||
987 gl_version_info_->is_es3) {
978 AddExtensionString("GL_CHROMIUM_path_rendering"); 988 AddExtensionString("GL_CHROMIUM_path_rendering");
979 feature_flags_.chromium_path_rendering = true; 989 feature_flags_.chromium_path_rendering = true;
980 validators_.g_l_state.AddValue(GL_PATH_MODELVIEW_MATRIX_CHROMIUM); 990 validators_.g_l_state.AddValue(GL_PATH_MODELVIEW_MATRIX_CHROMIUM);
981 validators_.g_l_state.AddValue(GL_PATH_PROJECTION_MATRIX_CHROMIUM); 991 validators_.g_l_state.AddValue(GL_PATH_PROJECTION_MATRIX_CHROMIUM);
982 } 992 }
983 } 993 }
984 994
985 if ((is_es3 || extensions.Contains("GL_EXT_texture_rg") || 995 if ((gl_version_info_->is_es3 || extensions.Contains("GL_EXT_texture_rg") ||
986 extensions.Contains("GL_ARB_texture_rg")) && 996 extensions.Contains("GL_ARB_texture_rg")) &&
987 IsGL_REDSupportedOnFBOs()) { 997 IsGL_REDSupportedOnFBOs()) {
988 feature_flags_.ext_texture_rg = true; 998 feature_flags_.ext_texture_rg = true;
989 AddExtensionString("GL_EXT_texture_rg"); 999 AddExtensionString("GL_EXT_texture_rg");
990 1000
991 validators_.texture_format.AddValue(GL_RED_EXT); 1001 validators_.texture_format.AddValue(GL_RED_EXT);
992 validators_.texture_format.AddValue(GL_RG_EXT); 1002 validators_.texture_format.AddValue(GL_RG_EXT);
993 validators_.texture_internal_format.AddValue(GL_RED_EXT); 1003 validators_.texture_internal_format.AddValue(GL_RED_EXT);
994 validators_.texture_internal_format.AddValue(GL_RG_EXT); 1004 validators_.texture_internal_format.AddValue(GL_RG_EXT);
995 validators_.read_pixel_format.AddValue(GL_RED_EXT); 1005 validators_.read_pixel_format.AddValue(GL_RED_EXT);
(...skipping 27 matching lines...) Expand all
1023 if (pos == std::string::npos) { 1033 if (pos == std::string::npos) {
1024 extensions_ += (extensions_.empty() ? "" : " ") + str; 1034 extensions_ += (extensions_.empty() ? "" : " ") + str;
1025 } 1035 }
1026 } 1036 }
1027 1037
1028 FeatureInfo::~FeatureInfo() { 1038 FeatureInfo::~FeatureInfo() {
1029 } 1039 }
1030 1040
1031 } // namespace gles2 1041 } // namespace gles2
1032 } // namespace gpu 1042 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698