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

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

Issue 499283002: gpu: support immutable texture on Linux Mesa driver and GLES3. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: CompleteHandlingOfGLESandBGRA. Apply CC Created 6 years, 3 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/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 378 matching lines...) Expand 10 before | Expand all | Expand 10 after
389 389
390 if (extensions.Contains("GL_OES_element_index_uint") || 390 if (extensions.Contains("GL_OES_element_index_uint") ||
391 gfx::HasDesktopGLFeatures()) { 391 gfx::HasDesktopGLFeatures()) {
392 AddExtensionString("GL_OES_element_index_uint"); 392 AddExtensionString("GL_OES_element_index_uint");
393 validators_.index_type.AddValue(GL_UNSIGNED_INT); 393 validators_.index_type.AddValue(GL_UNSIGNED_INT);
394 } 394 }
395 395
396 bool enable_texture_format_bgra8888 = false; 396 bool enable_texture_format_bgra8888 = false;
397 bool enable_read_format_bgra = false; 397 bool enable_read_format_bgra = false;
398 bool enable_render_buffer_bgra = false; 398 bool enable_render_buffer_bgra = false;
399 bool enable_immutable_texture_format_bgra_on_es3 =
400 extensions.Contains("GL_APPLE_texture_format_BGRA8888");
399 401
400 // Check if we should allow GL_EXT_texture_format_BGRA8888 402 // Check if we should allow GL_EXT_texture_format_BGRA8888
401 if (extensions.Contains("GL_EXT_texture_format_BGRA8888") || 403 if (extensions.Contains("GL_EXT_texture_format_BGRA8888") ||
402 extensions.Contains("GL_APPLE_texture_format_BGRA8888") || 404 enable_immutable_texture_format_bgra_on_es3 ||
403 extensions.Contains("GL_EXT_bgra")) { 405 extensions.Contains("GL_EXT_bgra")) {
404 enable_texture_format_bgra8888 = true; 406 enable_texture_format_bgra8888 = true;
405 } 407 }
406 408
407 if (extensions.Contains("GL_EXT_bgra")) { 409 if (extensions.Contains("GL_EXT_bgra")) {
408 enable_render_buffer_bgra = true; 410 enable_render_buffer_bgra = true;
409 } 411 }
410 412
411 if (extensions.Contains("GL_EXT_read_format_bgra") || 413 if (extensions.Contains("GL_EXT_read_format_bgra") ||
412 extensions.Contains("GL_EXT_bgra")) { 414 extensions.Contains("GL_EXT_bgra")) {
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
685 validators_.pixel_store.AddValue(GL_PACK_REVERSE_ROW_ORDER_ANGLE); 687 validators_.pixel_store.AddValue(GL_PACK_REVERSE_ROW_ORDER_ANGLE);
686 validators_.g_l_state.AddValue(GL_PACK_REVERSE_ROW_ORDER_ANGLE); 688 validators_.g_l_state.AddValue(GL_PACK_REVERSE_ROW_ORDER_ANGLE);
687 } 689 }
688 690
689 if (extensions.Contains("GL_ANGLE_texture_usage")) { 691 if (extensions.Contains("GL_ANGLE_texture_usage")) {
690 feature_flags_.angle_texture_usage = true; 692 feature_flags_.angle_texture_usage = true;
691 AddExtensionString("GL_ANGLE_texture_usage"); 693 AddExtensionString("GL_ANGLE_texture_usage");
692 validators_.texture_parameter.AddValue(GL_TEXTURE_USAGE_ANGLE); 694 validators_.texture_parameter.AddValue(GL_TEXTURE_USAGE_ANGLE);
693 } 695 }
694 696
695 if (extensions.Contains("GL_EXT_texture_storage")) { 697 // Note: Only APPLE_texture_format_BGRA8888 extension allows BGRA8_EXT in
698 // ES3's glTexStorage2D. We prefer support BGRA to texture storage.
699 // So we don't expose GL_EXT_texture_storage when ES3 +
700 // GL_EXT_texture_format_BGRA8888 because we fail the GL_BGRA8 requirement.
701 // However we expose GL_EXT_texture_storage when just ES3 because we don't
702 // claim to handle GL_BGRA8.
703 bool support_texture_storage_on_es3 =
704 (is_es3 && enable_immutable_texture_format_bgra_on_es3) ||
705 (is_es3 && !enable_texture_format_bgra8888);
706 if (extensions.Contains("GL_EXT_texture_storage") ||
707 extensions.Contains("GL_ARB_texture_storage") ||
708 support_texture_storage_on_es3) {
696 feature_flags_.ext_texture_storage = true; 709 feature_flags_.ext_texture_storage = true;
697 AddExtensionString("GL_EXT_texture_storage"); 710 AddExtensionString("GL_EXT_texture_storage");
698 validators_.texture_parameter.AddValue(GL_TEXTURE_IMMUTABLE_FORMAT_EXT); 711 validators_.texture_parameter.AddValue(GL_TEXTURE_IMMUTABLE_FORMAT_EXT);
699 if (enable_texture_format_bgra8888) 712 if (enable_texture_format_bgra8888)
700 validators_.texture_internal_format_storage.AddValue(GL_BGRA8_EXT); 713 validators_.texture_internal_format_storage.AddValue(GL_BGRA8_EXT);
701 if (enable_texture_float) { 714 if (enable_texture_float) {
702 validators_.texture_internal_format_storage.AddValue(GL_RGBA32F_EXT); 715 validators_.texture_internal_format_storage.AddValue(GL_RGBA32F_EXT);
703 validators_.texture_internal_format_storage.AddValue(GL_RGB32F_EXT); 716 validators_.texture_internal_format_storage.AddValue(GL_RGB32F_EXT);
704 validators_.texture_internal_format_storage.AddValue(GL_ALPHA32F_EXT); 717 validators_.texture_internal_format_storage.AddValue(GL_ALPHA32F_EXT);
705 validators_.texture_internal_format_storage.AddValue( 718 validators_.texture_internal_format_storage.AddValue(
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
854 if (pos == std::string::npos) { 867 if (pos == std::string::npos) {
855 extensions_ += (extensions_.empty() ? "" : " ") + str; 868 extensions_ += (extensions_.empty() ? "" : " ") + str;
856 } 869 }
857 } 870 }
858 871
859 FeatureInfo::~FeatureInfo() { 872 FeatureInfo::~FeatureInfo() {
860 } 873 }
861 874
862 } // namespace gles2 875 } // namespace gles2
863 } // namespace gpu 876 } // namespace gpu
OLDNEW
« no previous file with comments | « cc/test/test_web_graphics_context_3d.h ('k') | gpu/command_buffer/service/feature_info_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698