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

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: codereview fixes 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 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 ext_shader_texture_lod(false), 136 ext_shader_texture_lod(false),
137 use_async_readpixels(false), 137 use_async_readpixels(false),
138 map_buffer_range(false), 138 map_buffer_range(false),
139 ext_discard_framebuffer(false), 139 ext_discard_framebuffer(false),
140 angle_depth_texture(false), 140 angle_depth_texture(false),
141 is_angle(false), 141 is_angle(false),
142 is_swiftshader(false), 142 is_swiftshader(false),
143 angle_texture_usage(false), 143 angle_texture_usage(false),
144 ext_texture_storage(false), 144 ext_texture_storage(false),
145 chromium_path_rendering(false), 145 chromium_path_rendering(false),
146 ext_blend_minmax(false) { 146 ext_blend_minmax(false),
147 blend_equation_advanced(false) {
147 } 148 }
148 149
149 FeatureInfo::Workarounds::Workarounds() : 150 FeatureInfo::Workarounds::Workarounds() :
150 #define GPU_OP(type, name) name(false), 151 #define GPU_OP(type, name) name(false),
151 GPU_DRIVER_BUG_WORKAROUNDS(GPU_OP) 152 GPU_DRIVER_BUG_WORKAROUNDS(GPU_OP)
152 #undef GPU_OP 153 #undef GPU_OP
153 max_texture_size(0), 154 max_texture_size(0),
154 max_cube_map_texture_size(0), 155 max_cube_map_texture_size(0),
155 max_fragment_uniform_vectors(0), 156 max_fragment_uniform_vectors(0),
156 max_varying_vectors(0), 157 max_varying_vectors(0),
(...skipping 688 matching lines...) Expand 10 before | Expand all | Expand 10 after
845 // DiscardFramebufferEXT is automatically bound to InvalidateFramebuffer. 846 // DiscardFramebufferEXT is automatically bound to InvalidateFramebuffer.
846 AddExtensionString("GL_EXT_discard_framebuffer"); 847 AddExtensionString("GL_EXT_discard_framebuffer");
847 feature_flags_.ext_discard_framebuffer = true; 848 feature_flags_.ext_discard_framebuffer = true;
848 } 849 }
849 850
850 if (ui_gl_fence_works) { 851 if (ui_gl_fence_works) {
851 AddExtensionString("GL_CHROMIUM_sync_query"); 852 AddExtensionString("GL_CHROMIUM_sync_query");
852 feature_flags_.chromium_sync_query = true; 853 feature_flags_.chromium_sync_query = true;
853 } 854 }
854 855
856 bool blend_equation_advanced_coherent =
857 extensions.Contains("GL_NV_blend_equation_advanced_coherent") ||
858 extensions.Contains("GL_KHR_blend_equation_advanced_coherent");
859
860 if (blend_equation_advanced_coherent ||
861 extensions.Contains("GL_NV_blend_equation_advanced") ||
862 extensions.Contains("GL_KHR_blend_equation_advanced")) {
863 const GLenum equations[] = {GL_MULTIPLY_KHR,
864 GL_SCREEN_KHR,
865 GL_OVERLAY_KHR,
866 GL_DARKEN_KHR,
867 GL_LIGHTEN_KHR,
868 GL_COLORDODGE_KHR,
869 GL_COLORBURN_KHR,
870 GL_HARDLIGHT_KHR,
871 GL_SOFTLIGHT_KHR,
872 GL_DIFFERENCE_KHR,
873 GL_EXCLUSION_KHR,
874 GL_HSL_HUE_KHR,
875 GL_HSL_SATURATION_KHR,
876 GL_HSL_COLOR_KHR,
877 GL_HSL_LUMINOSITY_KHR};
878
879 for (GLenum equation : equations)
880 validators_.equation.AddValue(equation);
881 if (blend_equation_advanced_coherent)
882 AddExtensionString("GL_KHR_blend_equation_advanced_coherent");
piman 2014/10/17 21:36:29 nit: indent wrong (should be +2)
Erik Dahlström (inactive) 2014/10/20 15:32:21 Done.
883 else
884 AddExtensionString("GL_KHR_blend_equation_advanced");
piman 2014/10/17 21:36:29 We should add this one either way.
Erik Dahlström (inactive) 2014/10/20 15:32:21 Done.
885
886 feature_flags_.blend_equation_advanced = true;
887 feature_flags_.blend_equation_advanced_coherent =
888 blend_equation_advanced_coherent;
889 }
890
855 if (extensions.Contains("GL_NV_path_rendering")) { 891 if (extensions.Contains("GL_NV_path_rendering")) {
856 if (extensions.Contains("GL_EXT_direct_state_access") || is_es3) { 892 if (extensions.Contains("GL_EXT_direct_state_access") || is_es3) {
857 AddExtensionString("GL_CHROMIUM_path_rendering"); 893 AddExtensionString("GL_CHROMIUM_path_rendering");
858 feature_flags_.chromium_path_rendering = true; 894 feature_flags_.chromium_path_rendering = true;
859 validators_.g_l_state.AddValue(GL_PATH_MODELVIEW_MATRIX_CHROMIUM); 895 validators_.g_l_state.AddValue(GL_PATH_MODELVIEW_MATRIX_CHROMIUM);
860 validators_.g_l_state.AddValue(GL_PATH_PROJECTION_MATRIX_CHROMIUM); 896 validators_.g_l_state.AddValue(GL_PATH_PROJECTION_MATRIX_CHROMIUM);
861 } 897 }
862 } 898 }
863 } 899 }
864 900
865 void FeatureInfo::AddExtensionString(const char* s) { 901 void FeatureInfo::AddExtensionString(const char* s) {
866 std::string str(s); 902 std::string str(s);
867 size_t pos = extensions_.find(str); 903 size_t pos = extensions_.find(str);
868 while (pos != std::string::npos && 904 while (pos != std::string::npos &&
869 pos + str.length() < extensions_.length() && 905 pos + str.length() < extensions_.length() &&
870 extensions_.substr(pos + str.length(), 1) != " ") { 906 extensions_.substr(pos + str.length(), 1) != " ") {
871 // This extension name is a substring of another. 907 // This extension name is a substring of another.
872 pos = extensions_.find(str, pos + str.length()); 908 pos = extensions_.find(str, pos + str.length());
873 } 909 }
874 if (pos == std::string::npos) { 910 if (pos == std::string::npos) {
875 extensions_ += (extensions_.empty() ? "" : " ") + str; 911 extensions_ += (extensions_.empty() ? "" : " ") + str;
876 } 912 }
877 } 913 }
878 914
879 FeatureInfo::~FeatureInfo() { 915 FeatureInfo::~FeatureInfo() {
880 } 916 }
881 917
882 } // namespace gles2 918 } // namespace gles2
883 } // namespace gpu 919 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698