OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <set> | 5 #include <set> |
6 #include <string> | 6 #include <string> |
7 #include "gpu/command_buffer/service/feature_info.h" | 7 #include "gpu/command_buffer/service/feature_info.h" |
8 #include "gpu/command_buffer/service/gl_utils.h" | 8 #include "gpu/command_buffer/service/gl_utils.h" |
9 #include "ui/gfx/gl/gl_implementation.h" | 9 #include "ui/gfx/gl/gl_implementation.h" |
10 | 10 |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 validators_.texture_internal_format.AddValue(GL_BGRA_EXT); | 225 validators_.texture_internal_format.AddValue(GL_BGRA_EXT); |
226 validators_.texture_format.AddValue(GL_BGRA_EXT); | 226 validators_.texture_format.AddValue(GL_BGRA_EXT); |
227 } | 227 } |
228 | 228 |
229 if (enable_read_format_bgra) { | 229 if (enable_read_format_bgra) { |
230 AddExtensionString("GL_EXT_read_format_bgra"); | 230 AddExtensionString("GL_EXT_read_format_bgra"); |
231 validators_.read_pixel_format.AddValue(GL_BGRA_EXT); | 231 validators_.read_pixel_format.AddValue(GL_BGRA_EXT); |
232 } | 232 } |
233 | 233 |
234 if (ext.Desire("GL_OES_rgb8_rgba8")) { | 234 if (ext.Desire("GL_OES_rgb8_rgba8")) { |
235 if (ext.Have("GL_OES_rgb8_rgba8") || | 235 if (ext.Have("GL_OES_rgb8_rgba8") || gfx::HasDesktopGLFeatures()) { |
236 gfx::GetGLImplementation() == gfx::kGLImplementationDesktopGL) { | |
237 AddExtensionString("GL_OES_rgb8_rgba8"); | 236 AddExtensionString("GL_OES_rgb8_rgba8"); |
238 validators_.render_buffer_format.AddValue(GL_RGB8_OES); | 237 validators_.render_buffer_format.AddValue(GL_RGB8_OES); |
239 validators_.render_buffer_format.AddValue(GL_RGBA8_OES); | 238 validators_.render_buffer_format.AddValue(GL_RGBA8_OES); |
240 } | 239 } |
241 } | 240 } |
242 | 241 |
243 // Check if we should allow GL_OES_texture_npot | 242 // Check if we should allow GL_OES_texture_npot |
244 if (ext.Desire("GL_OES_texture_npot") && | 243 if (ext.Desire("GL_OES_texture_npot") && |
245 (ext.Have("GL_ARB_texture_non_power_of_two") || | 244 (ext.Have("GL_ARB_texture_non_power_of_two") || |
246 ext.Have("GL_OES_texture_npot"))) { | 245 ext.Have("GL_OES_texture_npot"))) { |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
309 feature_flags_.chromium_framebuffer_multisample = true; | 308 feature_flags_.chromium_framebuffer_multisample = true; |
310 validators_.frame_buffer_target.AddValue(GL_READ_FRAMEBUFFER_EXT); | 309 validators_.frame_buffer_target.AddValue(GL_READ_FRAMEBUFFER_EXT); |
311 validators_.frame_buffer_target.AddValue(GL_DRAW_FRAMEBUFFER_EXT); | 310 validators_.frame_buffer_target.AddValue(GL_DRAW_FRAMEBUFFER_EXT); |
312 validators_.g_l_state.AddValue(GL_READ_FRAMEBUFFER_BINDING_EXT); | 311 validators_.g_l_state.AddValue(GL_READ_FRAMEBUFFER_BINDING_EXT); |
313 validators_.g_l_state.AddValue(GL_MAX_SAMPLES_EXT); | 312 validators_.g_l_state.AddValue(GL_MAX_SAMPLES_EXT); |
314 validators_.render_buffer_parameter.AddValue(GL_RENDERBUFFER_SAMPLES_EXT); | 313 validators_.render_buffer_parameter.AddValue(GL_RENDERBUFFER_SAMPLES_EXT); |
315 AddExtensionString("GL_CHROMIUM_framebuffer_multisample"); | 314 AddExtensionString("GL_CHROMIUM_framebuffer_multisample"); |
316 } | 315 } |
317 | 316 |
318 if (ext.HaveAndDesire("GL_OES_depth24") || | 317 if (ext.HaveAndDesire("GL_OES_depth24") || |
319 (gfx::GetGLImplementation() == gfx::kGLImplementationDesktopGL && | 318 (gfx::HasDesktopGLFeatures() && ext.Desire("GL_OES_depth24"))) { |
320 ext.Desire("GL_OES_depth24"))) { | |
321 AddExtensionString("GL_OES_depth24"); | 319 AddExtensionString("GL_OES_depth24"); |
322 validators_.render_buffer_format.AddValue(GL_DEPTH_COMPONENT24); | 320 validators_.render_buffer_format.AddValue(GL_DEPTH_COMPONENT24); |
323 } | 321 } |
324 | 322 |
325 if (ext.HaveAndDesire("GL_OES_standard_derivatives") || | 323 if (ext.HaveAndDesire("GL_OES_standard_derivatives") || |
326 (gfx::GetGLImplementation() == gfx::kGLImplementationDesktopGL && | 324 (gfx::HasDesktopGLFeatures() && |
327 ext.Desire("GL_OES_standard_derivatives"))) { | 325 ext.Desire("GL_OES_standard_derivatives"))) { |
328 AddExtensionString("GL_OES_standard_derivatives"); | 326 AddExtensionString("GL_OES_standard_derivatives"); |
329 feature_flags_.oes_standard_derivatives = true; | 327 feature_flags_.oes_standard_derivatives = true; |
330 validators_.hint_target.AddValue(GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES); | 328 validators_.hint_target.AddValue(GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES); |
331 validators_.g_l_state.AddValue(GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES); | 329 validators_.g_l_state.AddValue(GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES); |
332 } | 330 } |
333 | 331 |
334 if (ext.HaveAndDesire("GL_OES_EGL_image_external")) { | 332 if (ext.HaveAndDesire("GL_OES_EGL_image_external")) { |
335 AddExtensionString("GL_OES_EGL_image_external"); | 333 AddExtensionString("GL_OES_EGL_image_external"); |
336 feature_flags_.oes_egl_image_external = true; | 334 feature_flags_.oes_egl_image_external = true; |
(...skipping 14 matching lines...) Expand all Loading... |
351 } | 349 } |
352 | 350 |
353 void FeatureInfo::AddExtensionString(const std::string& str) { | 351 void FeatureInfo::AddExtensionString(const std::string& str) { |
354 if (extensions_.find(str) == std::string::npos) { | 352 if (extensions_.find(str) == std::string::npos) { |
355 extensions_ += (extensions_.empty() ? "" : " ") + str; | 353 extensions_ += (extensions_.empty() ? "" : " ") + str; |
356 } | 354 } |
357 } | 355 } |
358 | 356 |
359 } // namespace gles2 | 357 } // namespace gles2 |
360 } // namespace gpu | 358 } // namespace gpu |
OLD | NEW |