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

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

Issue 2945673002: Allow creating GLImage-backed textures with glTexStorage2D. (Closed)
Patch Set: rebase Created 3 years, 4 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 1381 matching lines...) Expand 10 before | Expand all | Expand 10 after
1392 if (param < 1) { 1392 if (param < 1) {
1393 return GL_INVALID_VALUE; 1393 return GL_INVALID_VALUE;
1394 } 1394 }
1395 break; 1395 break;
1396 case GL_TEXTURE_USAGE_ANGLE: 1396 case GL_TEXTURE_USAGE_ANGLE:
1397 if (!feature_info->validators()->texture_usage.IsValid(param)) { 1397 if (!feature_info->validators()->texture_usage.IsValid(param)) {
1398 return GL_INVALID_ENUM; 1398 return GL_INVALID_ENUM;
1399 } 1399 }
1400 usage_ = param; 1400 usage_ = param;
1401 break; 1401 break;
1402 case GL_TEXTURE_BUFFER_USAGE_CHROMIUM:
1403 if (!feature_info->validators()->texture_buffer_usage.IsValid(param)) {
1404 return GL_INVALID_ENUM;
1405 }
1406 buffer_usage_ = param;
1407 break;
1402 case GL_TEXTURE_SWIZZLE_R: 1408 case GL_TEXTURE_SWIZZLE_R:
1403 if (!feature_info->validators()->texture_swizzle.IsValid(param)) { 1409 if (!feature_info->validators()->texture_swizzle.IsValid(param)) {
1404 return GL_INVALID_ENUM; 1410 return GL_INVALID_ENUM;
1405 } 1411 }
1406 swizzle_r_ = param; 1412 swizzle_r_ = param;
1407 break; 1413 break;
1408 case GL_TEXTURE_SWIZZLE_G: 1414 case GL_TEXTURE_SWIZZLE_G:
1409 if (!feature_info->validators()->texture_swizzle.IsValid(param)) { 1415 if (!feature_info->validators()->texture_swizzle.IsValid(param)) {
1410 return GL_INVALID_ENUM; 1416 return GL_INVALID_ENUM;
1411 } 1417 }
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
1450 case GL_TEXTURE_WRAP_S: 1456 case GL_TEXTURE_WRAP_S:
1451 case GL_TEXTURE_WRAP_T: 1457 case GL_TEXTURE_WRAP_T:
1452 case GL_TEXTURE_COMPARE_FUNC: 1458 case GL_TEXTURE_COMPARE_FUNC:
1453 case GL_TEXTURE_COMPARE_MODE: 1459 case GL_TEXTURE_COMPARE_MODE:
1454 case GL_TEXTURE_BASE_LEVEL: 1460 case GL_TEXTURE_BASE_LEVEL:
1455 case GL_TEXTURE_MAX_LEVEL: 1461 case GL_TEXTURE_MAX_LEVEL:
1456 case GL_TEXTURE_USAGE_ANGLE: 1462 case GL_TEXTURE_USAGE_ANGLE:
1457 case GL_TEXTURE_SWIZZLE_R: 1463 case GL_TEXTURE_SWIZZLE_R:
1458 case GL_TEXTURE_SWIZZLE_G: 1464 case GL_TEXTURE_SWIZZLE_G:
1459 case GL_TEXTURE_SWIZZLE_B: 1465 case GL_TEXTURE_SWIZZLE_B:
1460 case GL_TEXTURE_SWIZZLE_A: { 1466 case GL_TEXTURE_SWIZZLE_A:
1467 case GL_TEXTURE_BUFFER_USAGE_CHROMIUM: {
1461 GLint iparam = static_cast<GLint>(std::round(param)); 1468 GLint iparam = static_cast<GLint>(std::round(param));
1462 return SetParameteri(feature_info, pname, iparam); 1469 return SetParameteri(feature_info, pname, iparam);
1463 } 1470 }
1464 case GL_TEXTURE_MIN_LOD: 1471 case GL_TEXTURE_MIN_LOD:
1465 sampler_state_.min_lod = param; 1472 sampler_state_.min_lod = param;
1466 break; 1473 break;
1467 case GL_TEXTURE_MAX_LOD: 1474 case GL_TEXTURE_MAX_LOD:
1468 sampler_state_.max_lod = param; 1475 sampler_state_.max_lod = param;
1469 break; 1476 break;
1470 case GL_TEXTURE_MAX_ANISOTROPY_EXT: 1477 case GL_TEXTURE_MAX_ANISOTROPY_EXT:
(...skipping 755 matching lines...) Expand 10 before | Expand all | Expand 10 after
2226 } 2233 }
2227 } else { 2234 } else {
2228 switch (pname) { 2235 switch (pname) {
2229 case GL_TEXTURE_SWIZZLE_R: 2236 case GL_TEXTURE_SWIZZLE_R:
2230 case GL_TEXTURE_SWIZZLE_G: 2237 case GL_TEXTURE_SWIZZLE_G:
2231 case GL_TEXTURE_SWIZZLE_B: 2238 case GL_TEXTURE_SWIZZLE_B:
2232 case GL_TEXTURE_SWIZZLE_A: 2239 case GL_TEXTURE_SWIZZLE_A:
2233 glTexParameteri(texture->target(), pname, 2240 glTexParameteri(texture->target(), pname,
2234 texture->GetCompatibilitySwizzleForChannel(param)); 2241 texture->GetCompatibilitySwizzleForChannel(param));
2235 break; 2242 break;
2243 case GL_TEXTURE_BUFFER_USAGE_CHROMIUM:
2244 break;
2236 default: 2245 default:
2237 glTexParameteri(texture->target(), pname, param); 2246 glTexParameteri(texture->target(), pname, param);
2238 break; 2247 break;
2239 } 2248 }
2240 } 2249 }
2241 } 2250 }
2242 2251
2243 void TextureManager::SetParameterf( 2252 void TextureManager::SetParameterf(
2244 const char* function_name, ErrorState* error_state, 2253 const char* function_name, ErrorState* error_state,
2245 TextureRef* ref, GLenum pname, GLfloat param) { 2254 TextureRef* ref, GLenum pname, GLfloat param) {
(...skipping 1557 matching lines...) Expand 10 before | Expand all | Expand 10 after
3803 uint32_t TextureManager::GetServiceIdGeneration() const { 3812 uint32_t TextureManager::GetServiceIdGeneration() const {
3804 return current_service_id_generation_; 3813 return current_service_id_generation_;
3805 } 3814 }
3806 3815
3807 void TextureManager::IncrementServiceIdGeneration() { 3816 void TextureManager::IncrementServiceIdGeneration() {
3808 current_service_id_generation_++; 3817 current_service_id_generation_++;
3809 } 3818 }
3810 3819
3811 } // namespace gles2 3820 } // namespace gles2
3812 } // namespace gpu 3821 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/texture_manager.h ('k') | gpu/command_buffer/tests/gl_texture_storage_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698