OLD | NEW |
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 561 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
572 texture_format_validators_[GL_LUMINANCE_ALPHA].AddValue(GL_HALF_FLOAT_OES); | 572 texture_format_validators_[GL_LUMINANCE_ALPHA].AddValue(GL_HALF_FLOAT_OES); |
573 validators_.pixel_type.AddValue(GL_HALF_FLOAT_OES); | 573 validators_.pixel_type.AddValue(GL_HALF_FLOAT_OES); |
574 validators_.read_pixel_type.AddValue(GL_HALF_FLOAT_OES); | 574 validators_.read_pixel_type.AddValue(GL_HALF_FLOAT_OES); |
575 AddExtensionString("GL_OES_texture_half_float"); | 575 AddExtensionString("GL_OES_texture_half_float"); |
576 if (enable_texture_half_float_linear) { | 576 if (enable_texture_half_float_linear) { |
577 AddExtensionString("GL_OES_texture_half_float_linear"); | 577 AddExtensionString("GL_OES_texture_half_float_linear"); |
578 } | 578 } |
579 } | 579 } |
580 | 580 |
581 if (may_enable_chromium_color_buffer_float) { | 581 if (may_enable_chromium_color_buffer_float) { |
582 COMPILE_ASSERT(GL_RGBA32F_ARB == GL_RGBA32F && | 582 static_assert(GL_RGBA32F_ARB == GL_RGBA32F && |
583 GL_RGBA32F_EXT == GL_RGBA32F && | 583 GL_RGBA32F_EXT == GL_RGBA32F && |
584 GL_RGB32F_ARB == GL_RGB32F && | 584 GL_RGB32F_ARB == GL_RGB32F && |
585 GL_RGB32F_EXT == GL_RGB32F, | 585 GL_RGB32F_EXT == GL_RGB32F, |
586 sized_float_internal_format_variations_must_match); | 586 "sized float internal format variations must match"); |
587 // We don't check extension support beyond ARB_texture_float on desktop GL, | 587 // We don't check extension support beyond ARB_texture_float on desktop GL, |
588 // and format support varies between GL configurations. For example, spec | 588 // and format support varies between GL configurations. For example, spec |
589 // prior to OpenGL 3.0 mandates framebuffer support only for one | 589 // prior to OpenGL 3.0 mandates framebuffer support only for one |
590 // implementation-chosen format, and ES3.0 EXT_color_buffer_float does not | 590 // implementation-chosen format, and ES3.0 EXT_color_buffer_float does not |
591 // support rendering to RGB32F. Check for framebuffer completeness with | 591 // support rendering to RGB32F. Check for framebuffer completeness with |
592 // formats that the extensions expose, and only enable an extension when a | 592 // formats that the extensions expose, and only enable an extension when a |
593 // framebuffer created with its texture format is reported as complete. | 593 // framebuffer created with its texture format is reported as complete. |
594 GLint fb_binding = 0; | 594 GLint fb_binding = 0; |
595 GLint tex_binding = 0; | 595 GLint tex_binding = 0; |
596 glGetIntegerv(GL_FRAMEBUFFER_BINDING, &fb_binding); | 596 glGetIntegerv(GL_FRAMEBUFFER_BINDING, &fb_binding); |
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
854 // NV_draw_buffers specification. | 854 // NV_draw_buffers specification. |
855 feature_flags_.nv_draw_buffers = !vendor_agnostic_draw_buffers; | 855 feature_flags_.nv_draw_buffers = !vendor_agnostic_draw_buffers; |
856 | 856 |
857 GLint max_color_attachments = 0; | 857 GLint max_color_attachments = 0; |
858 glGetIntegerv(GL_MAX_COLOR_ATTACHMENTS_EXT, &max_color_attachments); | 858 glGetIntegerv(GL_MAX_COLOR_ATTACHMENTS_EXT, &max_color_attachments); |
859 for (GLenum i = GL_COLOR_ATTACHMENT1_EXT; | 859 for (GLenum i = GL_COLOR_ATTACHMENT1_EXT; |
860 i < static_cast<GLenum>(GL_COLOR_ATTACHMENT0 + max_color_attachments); | 860 i < static_cast<GLenum>(GL_COLOR_ATTACHMENT0 + max_color_attachments); |
861 ++i) { | 861 ++i) { |
862 validators_.attachment.AddValue(i); | 862 validators_.attachment.AddValue(i); |
863 } | 863 } |
864 COMPILE_ASSERT(GL_COLOR_ATTACHMENT0_EXT == GL_COLOR_ATTACHMENT0, | 864 static_assert(GL_COLOR_ATTACHMENT0_EXT == GL_COLOR_ATTACHMENT0, |
865 color_attachment0_variation_must_match); | 865 "GL_COLOR_ATTACHMENT0_EXT should equal GL_COLOR_ATTACHMENT0"); |
866 | 866 |
867 validators_.g_l_state.AddValue(GL_MAX_COLOR_ATTACHMENTS_EXT); | 867 validators_.g_l_state.AddValue(GL_MAX_COLOR_ATTACHMENTS_EXT); |
868 validators_.g_l_state.AddValue(GL_MAX_DRAW_BUFFERS_ARB); | 868 validators_.g_l_state.AddValue(GL_MAX_DRAW_BUFFERS_ARB); |
869 GLint max_draw_buffers = 0; | 869 GLint max_draw_buffers = 0; |
870 glGetIntegerv(GL_MAX_DRAW_BUFFERS_ARB, &max_draw_buffers); | 870 glGetIntegerv(GL_MAX_DRAW_BUFFERS_ARB, &max_draw_buffers); |
871 for (GLenum i = GL_DRAW_BUFFER0_ARB; | 871 for (GLenum i = GL_DRAW_BUFFER0_ARB; |
872 i < static_cast<GLenum>(GL_DRAW_BUFFER0_ARB + max_draw_buffers); | 872 i < static_cast<GLenum>(GL_DRAW_BUFFER0_ARB + max_draw_buffers); |
873 ++i) { | 873 ++i) { |
874 validators_.g_l_state.AddValue(i); | 874 validators_.g_l_state.AddValue(i); |
875 } | 875 } |
876 } | 876 } |
877 | 877 |
878 if (gl_version_info_->is_es3 || | 878 if (gl_version_info_->is_es3 || |
879 extensions.Contains("GL_EXT_blend_minmax") || | 879 extensions.Contains("GL_EXT_blend_minmax") || |
880 gfx::HasDesktopGLFeatures()) { | 880 gfx::HasDesktopGLFeatures()) { |
881 AddExtensionString("GL_EXT_blend_minmax"); | 881 AddExtensionString("GL_EXT_blend_minmax"); |
882 validators_.equation.AddValue(GL_MIN_EXT); | 882 validators_.equation.AddValue(GL_MIN_EXT); |
883 validators_.equation.AddValue(GL_MAX_EXT); | 883 validators_.equation.AddValue(GL_MAX_EXT); |
884 COMPILE_ASSERT(GL_MIN_EXT == GL_MIN && GL_MAX_EXT == GL_MAX, | 884 static_assert(GL_MIN_EXT == GL_MIN && GL_MAX_EXT == GL_MAX, |
885 min_max_variations_must_match); | 885 "min & max variations must match"); |
886 } | 886 } |
887 | 887 |
888 // TODO(dshwang): GLES3 supports gl_FragDepth, not gl_FragDepthEXT. | 888 // TODO(dshwang): GLES3 supports gl_FragDepth, not gl_FragDepthEXT. |
889 if (extensions.Contains("GL_EXT_frag_depth") || gfx::HasDesktopGLFeatures()) { | 889 if (extensions.Contains("GL_EXT_frag_depth") || gfx::HasDesktopGLFeatures()) { |
890 AddExtensionString("GL_EXT_frag_depth"); | 890 AddExtensionString("GL_EXT_frag_depth"); |
891 feature_flags_.ext_frag_depth = true; | 891 feature_flags_.ext_frag_depth = true; |
892 } | 892 } |
893 | 893 |
894 if (extensions.Contains("GL_EXT_shader_texture_lod") || | 894 if (extensions.Contains("GL_EXT_shader_texture_lod") || |
895 gfx::HasDesktopGLFeatures()) { | 895 gfx::HasDesktopGLFeatures()) { |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1033 if (pos == std::string::npos) { | 1033 if (pos == std::string::npos) { |
1034 extensions_ += (extensions_.empty() ? "" : " ") + str; | 1034 extensions_ += (extensions_.empty() ? "" : " ") + str; |
1035 } | 1035 } |
1036 } | 1036 } |
1037 | 1037 |
1038 FeatureInfo::~FeatureInfo() { | 1038 FeatureInfo::~FeatureInfo() { |
1039 } | 1039 } |
1040 | 1040 |
1041 } // namespace gles2 | 1041 } // namespace gles2 |
1042 } // namespace gpu | 1042 } // namespace gpu |
OLD | NEW |