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

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

Issue 643373003: Add support for all blendmodes if we have GL_KHR_blend_equation_advanced. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix feature_info_unittest Created 6 years, 2 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 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
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), 142 is_angle(false),
143 is_swiftshader(false), 143 is_swiftshader(false),
144 angle_texture_usage(false), 144 angle_texture_usage(false),
145 ext_texture_storage(false), 145 ext_texture_storage(false),
146 chromium_path_rendering(false), 146 chromium_path_rendering(false),
147 ext_blend_minmax(false) { 147 ext_blend_minmax(false),
148 blend_equation_advanced(false),
149 blend_equation_advanced_coherent(false) {
148 } 150 }
149 151
150 FeatureInfo::Workarounds::Workarounds() : 152 FeatureInfo::Workarounds::Workarounds() :
151 #define GPU_OP(type, name) name(false), 153 #define GPU_OP(type, name) name(false),
152 GPU_DRIVER_BUG_WORKAROUNDS(GPU_OP) 154 GPU_DRIVER_BUG_WORKAROUNDS(GPU_OP)
153 #undef GPU_OP 155 #undef GPU_OP
154 max_texture_size(0), 156 max_texture_size(0),
155 max_cube_map_texture_size(0), 157 max_cube_map_texture_size(0),
156 max_fragment_uniform_vectors(0), 158 max_fragment_uniform_vectors(0),
157 max_varying_vectors(0), 159 max_varying_vectors(0),
(...skipping 715 matching lines...) Expand 10 before | Expand all | Expand 10 after
873 // DiscardFramebufferEXT is automatically bound to InvalidateFramebuffer. 875 // DiscardFramebufferEXT is automatically bound to InvalidateFramebuffer.
874 AddExtensionString("GL_EXT_discard_framebuffer"); 876 AddExtensionString("GL_EXT_discard_framebuffer");
875 feature_flags_.ext_discard_framebuffer = true; 877 feature_flags_.ext_discard_framebuffer = true;
876 } 878 }
877 879
878 if (ui_gl_fence_works) { 880 if (ui_gl_fence_works) {
879 AddExtensionString("GL_CHROMIUM_sync_query"); 881 AddExtensionString("GL_CHROMIUM_sync_query");
880 feature_flags_.chromium_sync_query = true; 882 feature_flags_.chromium_sync_query = true;
881 } 883 }
882 884
885 bool blend_equation_advanced_coherent =
886 extensions.Contains("GL_NV_blend_equation_advanced_coherent") ||
887 extensions.Contains("GL_KHR_blend_equation_advanced_coherent");
888
889 if (blend_equation_advanced_coherent ||
890 extensions.Contains("GL_NV_blend_equation_advanced") ||
891 extensions.Contains("GL_KHR_blend_equation_advanced")) {
892 const GLenum equations[] = {GL_MULTIPLY_KHR,
893 GL_SCREEN_KHR,
894 GL_OVERLAY_KHR,
895 GL_DARKEN_KHR,
896 GL_LIGHTEN_KHR,
897 GL_COLORDODGE_KHR,
898 GL_COLORBURN_KHR,
899 GL_HARDLIGHT_KHR,
900 GL_SOFTLIGHT_KHR,
901 GL_DIFFERENCE_KHR,
902 GL_EXCLUSION_KHR,
903 GL_HSL_HUE_KHR,
904 GL_HSL_SATURATION_KHR,
905 GL_HSL_COLOR_KHR,
906 GL_HSL_LUMINOSITY_KHR};
907
908 for (GLenum equation : equations)
909 validators_.equation.AddValue(equation);
910 if (blend_equation_advanced_coherent)
911 AddExtensionString("GL_KHR_blend_equation_advanced_coherent");
912
913 AddExtensionString("GL_KHR_blend_equation_advanced");
914 feature_flags_.blend_equation_advanced = true;
915 feature_flags_.blend_equation_advanced_coherent =
916 blend_equation_advanced_coherent;
917 }
918
883 if (extensions.Contains("GL_NV_path_rendering")) { 919 if (extensions.Contains("GL_NV_path_rendering")) {
884 if (extensions.Contains("GL_EXT_direct_state_access") || is_es3) { 920 if (extensions.Contains("GL_EXT_direct_state_access") || is_es3) {
885 AddExtensionString("GL_CHROMIUM_path_rendering"); 921 AddExtensionString("GL_CHROMIUM_path_rendering");
886 feature_flags_.chromium_path_rendering = true; 922 feature_flags_.chromium_path_rendering = true;
887 validators_.g_l_state.AddValue(GL_PATH_MODELVIEW_MATRIX_CHROMIUM); 923 validators_.g_l_state.AddValue(GL_PATH_MODELVIEW_MATRIX_CHROMIUM);
888 validators_.g_l_state.AddValue(GL_PATH_PROJECTION_MATRIX_CHROMIUM); 924 validators_.g_l_state.AddValue(GL_PATH_PROJECTION_MATRIX_CHROMIUM);
889 } 925 }
890 } 926 }
891 } 927 }
892 928
893 void FeatureInfo::AddExtensionString(const char* s) { 929 void FeatureInfo::AddExtensionString(const char* s) {
894 std::string str(s); 930 std::string str(s);
895 size_t pos = extensions_.find(str); 931 size_t pos = extensions_.find(str);
896 while (pos != std::string::npos && 932 while (pos != std::string::npos &&
897 pos + str.length() < extensions_.length() && 933 pos + str.length() < extensions_.length() &&
898 extensions_.substr(pos + str.length(), 1) != " ") { 934 extensions_.substr(pos + str.length(), 1) != " ") {
899 // This extension name is a substring of another. 935 // This extension name is a substring of another.
900 pos = extensions_.find(str, pos + str.length()); 936 pos = extensions_.find(str, pos + str.length());
901 } 937 }
902 if (pos == std::string::npos) { 938 if (pos == std::string::npos) {
903 extensions_ += (extensions_.empty() ? "" : " ") + str; 939 extensions_ += (extensions_.empty() ? "" : " ") + str;
904 } 940 }
905 } 941 }
906 942
907 FeatureInfo::~FeatureInfo() { 943 FeatureInfo::~FeatureInfo() {
908 } 944 }
909 945
910 } // namespace gles2 946 } // namespace gles2
911 } // namespace gpu 947 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/feature_info.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