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

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

Issue 2945673002: Allow creating GLImage-backed textures with glTexStorage2D. (Closed)
Patch Set: add extension spec and don't enable for webgl Created 3 years, 6 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/texture_manager.h" 5 #include "gpu/command_buffer/service/texture_manager.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 1347 matching lines...) Expand 10 before | Expand all | Expand 10 after
1358 if (param < 1) { 1358 if (param < 1) {
1359 return GL_INVALID_VALUE; 1359 return GL_INVALID_VALUE;
1360 } 1360 }
1361 break; 1361 break;
1362 case GL_TEXTURE_USAGE_ANGLE: 1362 case GL_TEXTURE_USAGE_ANGLE:
1363 if (!feature_info->validators()->texture_usage.IsValid(param)) { 1363 if (!feature_info->validators()->texture_usage.IsValid(param)) {
1364 return GL_INVALID_ENUM; 1364 return GL_INVALID_ENUM;
1365 } 1365 }
1366 usage_ = param; 1366 usage_ = param;
1367 break; 1367 break;
1368 case GL_TEXTURE_BUFFER_USAGE_CHROMIUM:
1369 if (!feature_info->validators()->texture_buffer_usage.IsValid(param)) {
1370 return GL_INVALID_ENUM;
1371 }
1372 buffer_usage_ = param;
1373 break;
1368 case GL_TEXTURE_SWIZZLE_R: 1374 case GL_TEXTURE_SWIZZLE_R:
1369 if (!feature_info->validators()->texture_swizzle.IsValid(param)) { 1375 if (!feature_info->validators()->texture_swizzle.IsValid(param)) {
1370 return GL_INVALID_ENUM; 1376 return GL_INVALID_ENUM;
1371 } 1377 }
1372 swizzle_r_ = param; 1378 swizzle_r_ = param;
1373 break; 1379 break;
1374 case GL_TEXTURE_SWIZZLE_G: 1380 case GL_TEXTURE_SWIZZLE_G:
1375 if (!feature_info->validators()->texture_swizzle.IsValid(param)) { 1381 if (!feature_info->validators()->texture_swizzle.IsValid(param)) {
1376 return GL_INVALID_ENUM; 1382 return GL_INVALID_ENUM;
1377 } 1383 }
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
1416 case GL_TEXTURE_WRAP_S: 1422 case GL_TEXTURE_WRAP_S:
1417 case GL_TEXTURE_WRAP_T: 1423 case GL_TEXTURE_WRAP_T:
1418 case GL_TEXTURE_COMPARE_FUNC: 1424 case GL_TEXTURE_COMPARE_FUNC:
1419 case GL_TEXTURE_COMPARE_MODE: 1425 case GL_TEXTURE_COMPARE_MODE:
1420 case GL_TEXTURE_BASE_LEVEL: 1426 case GL_TEXTURE_BASE_LEVEL:
1421 case GL_TEXTURE_MAX_LEVEL: 1427 case GL_TEXTURE_MAX_LEVEL:
1422 case GL_TEXTURE_USAGE_ANGLE: 1428 case GL_TEXTURE_USAGE_ANGLE:
1423 case GL_TEXTURE_SWIZZLE_R: 1429 case GL_TEXTURE_SWIZZLE_R:
1424 case GL_TEXTURE_SWIZZLE_G: 1430 case GL_TEXTURE_SWIZZLE_G:
1425 case GL_TEXTURE_SWIZZLE_B: 1431 case GL_TEXTURE_SWIZZLE_B:
1426 case GL_TEXTURE_SWIZZLE_A: { 1432 case GL_TEXTURE_SWIZZLE_A:
1433 case GL_TEXTURE_BUFFER_USAGE_CHROMIUM: {
1427 GLint iparam = static_cast<GLint>(std::round(param)); 1434 GLint iparam = static_cast<GLint>(std::round(param));
1428 return SetParameteri(feature_info, pname, iparam); 1435 return SetParameteri(feature_info, pname, iparam);
1429 } 1436 }
1430 case GL_TEXTURE_MIN_LOD: 1437 case GL_TEXTURE_MIN_LOD:
1431 sampler_state_.min_lod = param; 1438 sampler_state_.min_lod = param;
1432 break; 1439 break;
1433 case GL_TEXTURE_MAX_LOD: 1440 case GL_TEXTURE_MAX_LOD:
1434 sampler_state_.max_lod = param; 1441 sampler_state_.max_lod = param;
1435 break; 1442 break;
1436 case GL_TEXTURE_MAX_ANISOTROPY_EXT: 1443 case GL_TEXTURE_MAX_ANISOTROPY_EXT:
(...skipping 755 matching lines...) Expand 10 before | Expand all | Expand 10 after
2192 } 2199 }
2193 } else { 2200 } else {
2194 switch (pname) { 2201 switch (pname) {
2195 case GL_TEXTURE_SWIZZLE_R: 2202 case GL_TEXTURE_SWIZZLE_R:
2196 case GL_TEXTURE_SWIZZLE_G: 2203 case GL_TEXTURE_SWIZZLE_G:
2197 case GL_TEXTURE_SWIZZLE_B: 2204 case GL_TEXTURE_SWIZZLE_B:
2198 case GL_TEXTURE_SWIZZLE_A: 2205 case GL_TEXTURE_SWIZZLE_A:
2199 glTexParameteri(texture->target(), pname, 2206 glTexParameteri(texture->target(), pname,
2200 texture->GetCompatibilitySwizzleForChannel(param)); 2207 texture->GetCompatibilitySwizzleForChannel(param));
2201 break; 2208 break;
2209 case GL_TEXTURE_BUFFER_USAGE_CHROMIUM:
2210 break;
2202 default: 2211 default:
2203 glTexParameteri(texture->target(), pname, param); 2212 glTexParameteri(texture->target(), pname, param);
2204 break; 2213 break;
2205 } 2214 }
2206 } 2215 }
2207 } 2216 }
2208 2217
2209 void TextureManager::SetParameterf( 2218 void TextureManager::SetParameterf(
2210 const char* function_name, ErrorState* error_state, 2219 const char* function_name, ErrorState* error_state,
2211 TextureRef* ref, GLenum pname, GLfloat param) { 2220 TextureRef* ref, GLenum pname, GLfloat param) {
(...skipping 1549 matching lines...) Expand 10 before | Expand all | Expand 10 after
3761 uint32_t TextureManager::GetServiceIdGeneration() const { 3770 uint32_t TextureManager::GetServiceIdGeneration() const {
3762 return current_service_id_generation_; 3771 return current_service_id_generation_;
3763 } 3772 }
3764 3773
3765 void TextureManager::IncrementServiceIdGeneration() { 3774 void TextureManager::IncrementServiceIdGeneration() {
3766 current_service_id_generation_++; 3775 current_service_id_generation_++;
3767 } 3776 }
3768 3777
3769 } // namespace gles2 3778 } // namespace gles2
3770 } // namespace gpu 3779 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698