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

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

Issue 2146603005: Fix CopyTexImage2D when using unsized internal formats (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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 | « gpu/command_buffer/service/gles2_cmd_decoder_unittest_textures.cc ('k') | 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/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 3091 matching lines...) Expand 10 before | Expand all | Expand 10 after
3102 pmd->AddOwnershipEdge(client_guid, service_guid, importance); 3102 pmd->AddOwnershipEdge(client_guid, service_guid, importance);
3103 3103
3104 // Dump all sub-levels held by the texture. They will appear below the main 3104 // Dump all sub-levels held by the texture. They will appear below the main
3105 // gl/textures/client_X/texture_Y dump. 3105 // gl/textures/client_X/texture_Y dump.
3106 ref->texture()->DumpLevelMemory(pmd, memory_tracker_->ClientTracingId(), 3106 ref->texture()->DumpLevelMemory(pmd, memory_tracker_->ClientTracingId(),
3107 dump_name); 3107 dump_name);
3108 } 3108 }
3109 3109
3110 GLenum TextureManager::ExtractFormatFromStorageFormat(GLenum internalformat) { 3110 GLenum TextureManager::ExtractFormatFromStorageFormat(GLenum internalformat) {
3111 switch (internalformat) { 3111 switch (internalformat) {
3112 case GL_RED:
3112 case GL_R8: 3113 case GL_R8:
3113 case GL_R8_SNORM: 3114 case GL_R8_SNORM:
3114 case GL_R16F: 3115 case GL_R16F:
3115 case GL_R32F: 3116 case GL_R32F:
3116 return GL_RED; 3117 return GL_RED;
3117 case GL_R8UI: 3118 case GL_R8UI:
3118 case GL_R8I: 3119 case GL_R8I:
3119 case GL_R16UI: 3120 case GL_R16UI:
3120 case GL_R16I: 3121 case GL_R16I:
3121 case GL_R32UI: 3122 case GL_R32UI:
3122 case GL_R32I: 3123 case GL_R32I:
3123 return GL_RED_INTEGER; 3124 return GL_RED_INTEGER;
3125 case GL_RG:
3124 case GL_RG8: 3126 case GL_RG8:
3125 case GL_RG8_SNORM: 3127 case GL_RG8_SNORM:
3126 case GL_RG16F: 3128 case GL_RG16F:
3127 case GL_RG32F: 3129 case GL_RG32F:
3128 return GL_RG; 3130 return GL_RG;
3129 case GL_RG8UI: 3131 case GL_RG8UI:
3130 case GL_RG8I: 3132 case GL_RG8I:
3131 case GL_RG16UI: 3133 case GL_RG16UI:
3132 case GL_RG16I: 3134 case GL_RG16I:
3133 case GL_RG32UI: 3135 case GL_RG32UI:
(...skipping 14 matching lines...) Expand all
3148 case GL_RGB16F: 3150 case GL_RGB16F:
3149 case GL_RGB32F: 3151 case GL_RGB32F:
3150 return GL_RGB; 3152 return GL_RGB;
3151 case GL_RGB8UI: 3153 case GL_RGB8UI:
3152 case GL_RGB8I: 3154 case GL_RGB8I:
3153 case GL_RGB16UI: 3155 case GL_RGB16UI:
3154 case GL_RGB16I: 3156 case GL_RGB16I:
3155 case GL_RGB32UI: 3157 case GL_RGB32UI:
3156 case GL_RGB32I: 3158 case GL_RGB32I:
3157 return GL_RGB_INTEGER; 3159 return GL_RGB_INTEGER;
3160 case GL_SRGB:
3161 return GL_SRGB;
3158 case GL_ATC_RGBA_EXPLICIT_ALPHA_AMD: 3162 case GL_ATC_RGBA_EXPLICIT_ALPHA_AMD:
3159 case GL_ATC_RGBA_INTERPOLATED_ALPHA_AMD: 3163 case GL_ATC_RGBA_INTERPOLATED_ALPHA_AMD:
3160 case GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG: 3164 case GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG:
3161 case GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG: 3165 case GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG:
3162 case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT: 3166 case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
3163 case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT: 3167 case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT:
3164 case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT: 3168 case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT:
3165 case GL_RGBA: 3169 case GL_RGBA:
3166 case GL_RGBA8: 3170 case GL_RGBA8:
3167 case GL_SRGB8_ALPHA8: 3171 case GL_SRGB8_ALPHA8:
3168 case GL_RGBA8_SNORM: 3172 case GL_RGBA8_SNORM:
3169 case GL_RGBA4: 3173 case GL_RGBA4:
3170 case GL_RGB5_A1: 3174 case GL_RGB5_A1:
3171 case GL_RGB10_A2: 3175 case GL_RGB10_A2:
3172 case GL_RGBA16F: 3176 case GL_RGBA16F:
3173 case GL_RGBA32F: 3177 case GL_RGBA32F:
3174 return GL_RGBA; 3178 return GL_RGBA;
3179 case GL_SRGB_ALPHA:
3180 return GL_SRGB_ALPHA;
3175 case GL_RGBA8UI: 3181 case GL_RGBA8UI:
3176 case GL_RGBA8I: 3182 case GL_RGBA8I:
3177 case GL_RGB10_A2UI: 3183 case GL_RGB10_A2UI:
3178 case GL_RGBA16UI: 3184 case GL_RGBA16UI:
3179 case GL_RGBA16I: 3185 case GL_RGBA16I:
3180 case GL_RGBA32UI: 3186 case GL_RGBA32UI:
3181 case GL_RGBA32I: 3187 case GL_RGBA32I:
3182 return GL_RGBA_INTEGER; 3188 return GL_RGBA_INTEGER;
3189 case GL_BGRA_EXT:
3190 return GL_BGRA_EXT;
3183 case GL_DEPTH_COMPONENT16: 3191 case GL_DEPTH_COMPONENT16:
3184 case GL_DEPTH_COMPONENT24: 3192 case GL_DEPTH_COMPONENT24:
3185 case GL_DEPTH_COMPONENT32F: 3193 case GL_DEPTH_COMPONENT32F:
3186 return GL_DEPTH_COMPONENT; 3194 return GL_DEPTH_COMPONENT;
3187 case GL_DEPTH24_STENCIL8: 3195 case GL_DEPTH24_STENCIL8:
3188 case GL_DEPTH32F_STENCIL8: 3196 case GL_DEPTH32F_STENCIL8:
3189 return GL_DEPTH_STENCIL; 3197 return GL_DEPTH_STENCIL;
3190 case GL_LUMINANCE_ALPHA: 3198 case GL_LUMINANCE_ALPHA:
3191 case GL_LUMINANCE8_ALPHA8_EXT: 3199 case GL_LUMINANCE8_ALPHA8_EXT:
3192 return GL_LUMINANCE_ALPHA; 3200 return GL_LUMINANCE_ALPHA;
(...skipping 17 matching lines...) Expand all
3210 return GL_LUMINANCE_ALPHA; 3218 return GL_LUMINANCE_ALPHA;
3211 case GL_BGRA8_EXT: 3219 case GL_BGRA8_EXT:
3212 return GL_BGRA_EXT; 3220 return GL_BGRA_EXT;
3213 default: 3221 default:
3214 return GL_NONE; 3222 return GL_NONE;
3215 } 3223 }
3216 } 3224 }
3217 3225
3218 GLenum TextureManager::ExtractTypeFromStorageFormat(GLenum internalformat) { 3226 GLenum TextureManager::ExtractTypeFromStorageFormat(GLenum internalformat) {
3219 switch (internalformat) { 3227 switch (internalformat) {
3228 case GL_RED:
3229 case GL_RG:
3220 case GL_RGB: 3230 case GL_RGB:
3231 case GL_SRGB:
3221 case GL_RGBA: 3232 case GL_RGBA:
3233 case GL_BGRA_EXT:
3234 case GL_SRGB_ALPHA:
3222 case GL_LUMINANCE_ALPHA: 3235 case GL_LUMINANCE_ALPHA:
3223 case GL_LUMINANCE: 3236 case GL_LUMINANCE:
3224 case GL_ALPHA: 3237 case GL_ALPHA:
3225 case GL_R8: 3238 case GL_R8:
3226 return GL_UNSIGNED_BYTE; 3239 return GL_UNSIGNED_BYTE;
3227 case GL_R8_SNORM: 3240 case GL_R8_SNORM:
3228 return GL_BYTE; 3241 return GL_BYTE;
3229 case GL_R16F: 3242 case GL_R16F:
3230 return GL_HALF_FLOAT; 3243 return GL_HALF_FLOAT;
3231 case GL_R32F: 3244 case GL_R32F:
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
3364 uint32_t TextureManager::GetServiceIdGeneration() const { 3377 uint32_t TextureManager::GetServiceIdGeneration() const {
3365 return current_service_id_generation_; 3378 return current_service_id_generation_;
3366 } 3379 }
3367 3380
3368 void TextureManager::IncrementServiceIdGeneration() { 3381 void TextureManager::IncrementServiceIdGeneration() {
3369 current_service_id_generation_++; 3382 current_service_id_generation_++;
3370 } 3383 }
3371 3384
3372 } // namespace gles2 3385 } // namespace gles2
3373 } // namespace gpu 3386 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/gles2_cmd_decoder_unittest_textures.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698