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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <set> | 9 #include <set> |
10 #include <vector> | 10 #include <vector> |
(...skipping 1488 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1499 }; | 1499 }; |
1500 DCHECK_EQ(arraysize(internal_formats), arraysize(formats)); | 1500 DCHECK_EQ(arraysize(internal_formats), arraysize(formats)); |
1501 for (size_t i = 0; i < arraysize(formats); ++i) { | 1501 for (size_t i = 0; i < arraysize(formats); ++i) { |
1502 glTexImage2D(GL_TEXTURE_2D, 0, internal_formats[i], width, width, 0, | 1502 glTexImage2D(GL_TEXTURE_2D, 0, internal_formats[i], width, width, 0, |
1503 formats[i], GL_FLOAT, NULL); | 1503 formats[i], GL_FLOAT, NULL); |
1504 full_float_support &= glCheckFramebufferStatusEXT(GL_FRAMEBUFFER) == | 1504 full_float_support &= glCheckFramebufferStatusEXT(GL_FRAMEBUFFER) == |
1505 GL_FRAMEBUFFER_COMPLETE; | 1505 GL_FRAMEBUFFER_COMPLETE; |
1506 } | 1506 } |
1507 enable_ext_color_buffer_float = full_float_support; | 1507 enable_ext_color_buffer_float = full_float_support; |
1508 } | 1508 } |
1509 // Likewise for EXT_color_buffer_half_float on ES2 contexts. | 1509 // Likewise for EXT_color_buffer_half_float on ES2 contexts. On desktop, |
1510 if (IsWebGL1OrES2Context() && !enable_ext_color_buffer_half_float) { | 1510 // require at least GL 3.0, to ensure that all formats are defined (ES |
1511 // queries the extension directly). | |
1512 if (IsWebGL1OrES2Context() && !enable_ext_color_buffer_half_float && | |
1513 gl_version_info_->IsAtLeastGL(3, 0)) { | |
Zhenyao Mo
2017/05/04 22:07:23
Sorry, just realized this. gl_version_info_->IsAt
ccameron
2017/05/04 22:18:27
I think there is an implicit gl_version_info_->is_
| |
1511 bool full_half_float_support = true; | 1514 bool full_half_float_support = true; |
1512 GLenum internal_formats[] = { | 1515 GLenum internal_formats[] = { |
1513 GL_R16F, GL_RG16F, GL_RGBA16F, | 1516 GL_R16F, GL_RG16F, GL_RGBA16F, |
1514 }; | 1517 }; |
1515 GLenum formats[] = { | 1518 GLenum formats[] = { |
1516 GL_RED, GL_RG, GL_RGBA, | 1519 GL_RED, GL_RG, GL_RGBA, |
1517 }; | 1520 }; |
1518 GLenum data_type = GL_FLOAT; | 1521 GLenum data_type = GL_FLOAT; |
1519 if (gl_version_info_->is_es2) | 1522 if (gl_version_info_->is_es2) |
1520 data_type = GL_HALF_FLOAT_OES; | 1523 data_type = GL_HALF_FLOAT_OES; |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1696 if (pos == std::string::npos) { | 1699 if (pos == std::string::npos) { |
1697 extensions_ += (extensions_.empty() ? "" : " ") + str; | 1700 extensions_ += (extensions_.empty() ? "" : " ") + str; |
1698 } | 1701 } |
1699 } | 1702 } |
1700 | 1703 |
1701 FeatureInfo::~FeatureInfo() { | 1704 FeatureInfo::~FeatureInfo() { |
1702 } | 1705 } |
1703 | 1706 |
1704 } // namespace gles2 | 1707 } // namespace gles2 |
1705 } // namespace gpu | 1708 } // namespace gpu |
OLD | NEW |