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

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

Issue 2862693002: Add more precise DCHECKs to float feature info (Closed)
Patch Set: Created 3 years, 7 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <stddef.h> 7 #include <stddef.h>
8 8
9 #include <set> 9 #include <set>
10 #include <vector> 10 #include <vector>
(...skipping 1360 matching lines...) Expand 10 before | Expand all | Expand 10 after
1371 extensions.Contains("GL_CHROMIUM_copy_compressed_texture"); 1371 extensions.Contains("GL_CHROMIUM_copy_compressed_texture");
1372 feature_flags_.angle_client_arrays = 1372 feature_flags_.angle_client_arrays =
1373 extensions.Contains("GL_ANGLE_client_arrays"); 1373 extensions.Contains("GL_ANGLE_client_arrays");
1374 feature_flags_.angle_request_extension = 1374 feature_flags_.angle_request_extension =
1375 extensions.Contains("GL_ANGLE_request_extension"); 1375 extensions.Contains("GL_ANGLE_request_extension");
1376 feature_flags_.ext_debug_marker = extensions.Contains("GL_EXT_debug_marker"); 1376 feature_flags_.ext_debug_marker = extensions.Contains("GL_EXT_debug_marker");
1377 } 1377 }
1378 1378
1379 void FeatureInfo::InitializeFloatAndHalfFloatFeatures( 1379 void FeatureInfo::InitializeFloatAndHalfFloatFeatures(
1380 const StringSet& extensions) { 1380 const StringSet& extensions) {
1381 // No errors should be present before running this function.
1382 DCHECK_EQ(glGetError(), static_cast<GLuint>(GL_NO_ERROR));
1383
1381 // Check if we should allow GL_OES_texture_float, GL_OES_texture_half_float, 1384 // Check if we should allow GL_OES_texture_float, GL_OES_texture_half_float,
1382 // GL_OES_texture_float_linear, GL_OES_texture_half_float_linear 1385 // GL_OES_texture_float_linear, GL_OES_texture_half_float_linear
1383 bool enable_texture_float = false; 1386 bool enable_texture_float = false;
1384 bool enable_texture_float_linear = false; 1387 bool enable_texture_float_linear = false;
1385 bool enable_texture_half_float = false; 1388 bool enable_texture_half_float = false;
1386 bool enable_texture_half_float_linear = false; 1389 bool enable_texture_half_float_linear = false;
1387 bool enable_ext_color_buffer_float = false; 1390 bool enable_ext_color_buffer_float = false;
1388 bool enable_ext_color_buffer_half_float = false; 1391 bool enable_ext_color_buffer_half_float = false;
1389 1392
1390 bool may_enable_chromium_color_buffer_float = false; 1393 bool may_enable_chromium_color_buffer_float = false;
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
1496 }; 1499 };
1497 GLenum formats[] = { 1500 GLenum formats[] = {
1498 GL_RED, GL_RG, GL_RGBA, GL_RED, GL_RG, GL_RGB, 1501 GL_RED, GL_RG, GL_RGBA, GL_RED, GL_RG, GL_RGB,
1499 }; 1502 };
1500 DCHECK_EQ(arraysize(internal_formats), arraysize(formats)); 1503 DCHECK_EQ(arraysize(internal_formats), arraysize(formats));
1501 for (size_t i = 0; i < arraysize(formats); ++i) { 1504 for (size_t i = 0; i < arraysize(formats); ++i) {
1502 glTexImage2D(GL_TEXTURE_2D, 0, internal_formats[i], width, width, 0, 1505 glTexImage2D(GL_TEXTURE_2D, 0, internal_formats[i], width, width, 0,
1503 formats[i], GL_FLOAT, NULL); 1506 formats[i], GL_FLOAT, NULL);
1504 full_float_support &= glCheckFramebufferStatusEXT(GL_FRAMEBUFFER) == 1507 full_float_support &= glCheckFramebufferStatusEXT(GL_FRAMEBUFFER) ==
1505 GL_FRAMEBUFFER_COMPLETE; 1508 GL_FRAMEBUFFER_COMPLETE;
1509 DCHECK_EQ(glGetError(), static_cast<GLuint>(GL_NO_ERROR))
1510 << " with internal format " << internal_formats[i] << " and format "
1511 << formats[i] << ".";
1506 } 1512 }
1507 enable_ext_color_buffer_float = full_float_support; 1513 enable_ext_color_buffer_float = full_float_support;
1508 } 1514 }
1509 // Likewise for EXT_color_buffer_half_float on ES2 contexts. 1515 // Likewise for EXT_color_buffer_half_float on ES2 contexts.
1510 if (IsWebGL1OrES2Context() && !enable_ext_color_buffer_half_float) { 1516 if (IsWebGL1OrES2Context() && !enable_ext_color_buffer_half_float) {
1511 bool full_half_float_support = true; 1517 bool full_half_float_support = true;
1512 GLenum internal_formats[] = { 1518 GLenum internal_formats[] = {
1513 GL_R16F, GL_RG16F, GL_RGBA16F, 1519 GL_R16F, GL_RG16F, GL_RGBA16F,
1514 }; 1520 };
1515 GLenum formats[] = { 1521 GLenum formats[] = {
1516 GL_RED, GL_RG, GL_RGBA, 1522 GL_RED, GL_RG, GL_RGBA,
1517 }; 1523 };
1518 GLenum data_type = GL_FLOAT; 1524 GLenum data_type = GL_FLOAT;
1519 if (gl_version_info_->is_es2) 1525 if (gl_version_info_->is_es2)
1520 data_type = GL_HALF_FLOAT_OES; 1526 data_type = GL_HALF_FLOAT_OES;
1521 if (gl_version_info_->is_es3) 1527 if (gl_version_info_->is_es3)
1522 data_type = GL_HALF_FLOAT; 1528 data_type = GL_HALF_FLOAT;
1523 DCHECK_EQ(arraysize(internal_formats), arraysize(formats)); 1529 DCHECK_EQ(arraysize(internal_formats), arraysize(formats));
1524 for (size_t i = 0; i < arraysize(formats); ++i) { 1530 for (size_t i = 0; i < arraysize(formats); ++i) {
1525 glTexImage2D(GL_TEXTURE_2D, 0, internal_formats[i], width, width, 0, 1531 glTexImage2D(GL_TEXTURE_2D, 0, internal_formats[i], width, width, 0,
1526 formats[i], data_type, NULL); 1532 formats[i], data_type, NULL);
1527 full_half_float_support &= 1533 full_half_float_support &=
1528 glCheckFramebufferStatusEXT(GL_FRAMEBUFFER) == 1534 glCheckFramebufferStatusEXT(GL_FRAMEBUFFER) ==
1529 GL_FRAMEBUFFER_COMPLETE; 1535 GL_FRAMEBUFFER_COMPLETE;
1536 DCHECK_EQ(glGetError(), static_cast<GLuint>(GL_NO_ERROR))
1537 << " with internal format " << internal_formats[i] << " and format "
1538 << formats[i] << ".";
1530 } 1539 }
1531 enable_ext_color_buffer_half_float = full_half_float_support; 1540 enable_ext_color_buffer_half_float = full_half_float_support;
1532 } 1541 }
1533 1542
1534 glDeleteFramebuffersEXT(1, &fb_id); 1543 glDeleteFramebuffersEXT(1, &fb_id);
1535 glDeleteTextures(1, &tex_id); 1544 glDeleteTextures(1, &tex_id);
1536 1545
1537 glBindFramebufferEXT(GL_FRAMEBUFFER, static_cast<GLuint>(fb_binding)); 1546 glBindFramebufferEXT(GL_FRAMEBUFFER, static_cast<GLuint>(fb_binding));
1538 glBindTexture(GL_TEXTURE_2D, static_cast<GLuint>(tex_binding)); 1547 glBindTexture(GL_TEXTURE_2D, static_cast<GLuint>(tex_binding));
1539 1548
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
1696 if (pos == std::string::npos) { 1705 if (pos == std::string::npos) {
1697 extensions_ += (extensions_.empty() ? "" : " ") + str; 1706 extensions_ += (extensions_.empty() ? "" : " ") + str;
1698 } 1707 }
1699 } 1708 }
1700 1709
1701 FeatureInfo::~FeatureInfo() { 1710 FeatureInfo::~FeatureInfo() {
1702 } 1711 }
1703 1712
1704 } // namespace gles2 1713 } // namespace gles2
1705 } // namespace gpu 1714 } // namespace gpu
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698