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

Side by Side Diff: gpu/command_buffer/client/gles2_implementation.cc

Issue 1128933006: Update GL_CHROMIUM_image with support for compressed formats. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Validate format against supported extensions. Created 5 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 | « gpu/GLES2/extensions/CHROMIUM/CHROMIUM_image.txt ('k') | ui/gl/gl_image_memory.cc » ('j') | 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 // A class to emulate GLES2 over command buffers. 5 // A class to emulate GLES2 over command buffers.
6 6
7 #include "gpu/command_buffer/client/gles2_implementation.h" 7 #include "gpu/command_buffer/client/gles2_implementation.h"
8 8
9 #include <GLES2/gl2ext.h> 9 #include <GLES2/gl2ext.h>
10 #include <GLES2/gl2extchromium.h> 10 #include <GLES2/gl2extchromium.h>
(...skipping 5180 matching lines...) Expand 10 before | Expand all | Expand 10 after
5191 GPU_CLIENT_SINGLE_THREAD_CHECK(); 5191 GPU_CLIENT_SINGLE_THREAD_CHECK();
5192 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glRetireSyncPointCHROMIUM(" 5192 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glRetireSyncPointCHROMIUM("
5193 << sync_point << ")"); 5193 << sync_point << ")");
5194 DCHECK(capabilities_.future_sync_points); 5194 DCHECK(capabilities_.future_sync_points);
5195 helper_->CommandBufferHelper::Flush(); 5195 helper_->CommandBufferHelper::Flush();
5196 gpu_control_->RetireSyncPoint(sync_point); 5196 gpu_control_->RetireSyncPoint(sync_point);
5197 } 5197 }
5198 5198
5199 namespace { 5199 namespace {
5200 5200
5201 bool ValidImageFormat(GLenum internalformat) { 5201 bool ValidImageFormat(GLenum internalformat,
5202 const Capabilities& capabilities) {
5202 switch (internalformat) { 5203 switch (internalformat) {
5204 case GL_ATC_RGB_AMD:
5205 case GL_ATC_RGBA_INTERPOLATED_ALPHA_AMD:
5206 return capabilities.texture_format_atc;
5207 case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
5208 return capabilities.texture_format_dxt1;
5209 case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT:
5210 return capabilities.texture_format_dxt5;
5211 case GL_ETC1_RGB8_OES:
5212 return capabilities.texture_format_etc1;
5203 case GL_R8: 5213 case GL_R8:
5204 case GL_RGB: 5214 case GL_RGB:
5205 case GL_RGBA: 5215 case GL_RGBA:
5206 case GL_BGRA_EXT: 5216 case GL_BGRA_EXT:
5207 return true; 5217 return true;
5208 default: 5218 default:
5209 return false; 5219 return false;
5210 } 5220 }
5211 } 5221 }
5212 5222
(...skipping 16 matching lines...) Expand all
5229 if (width <= 0) { 5239 if (width <= 0) {
5230 SetGLError(GL_INVALID_VALUE, "glCreateImageCHROMIUM", "width <= 0"); 5240 SetGLError(GL_INVALID_VALUE, "glCreateImageCHROMIUM", "width <= 0");
5231 return 0; 5241 return 0;
5232 } 5242 }
5233 5243
5234 if (height <= 0) { 5244 if (height <= 0) {
5235 SetGLError(GL_INVALID_VALUE, "glCreateImageCHROMIUM", "height <= 0"); 5245 SetGLError(GL_INVALID_VALUE, "glCreateImageCHROMIUM", "height <= 0");
5236 return 0; 5246 return 0;
5237 } 5247 }
5238 5248
5239 if (!ValidImageFormat(internalformat)) { 5249 if (!ValidImageFormat(internalformat, capabilities_)) {
5240 SetGLError(GL_INVALID_VALUE, "glCreateImageCHROMIUM", "invalid format"); 5250 SetGLError(GL_INVALID_VALUE, "glCreateImageCHROMIUM", "invalid format");
5241 return 0; 5251 return 0;
5242 } 5252 }
5243 5253
5244 int32_t image_id = 5254 int32_t image_id =
5245 gpu_control_->CreateImage(buffer, width, height, internalformat); 5255 gpu_control_->CreateImage(buffer, width, height, internalformat);
5246 if (image_id < 0) { 5256 if (image_id < 0) {
5247 SetGLError(GL_OUT_OF_MEMORY, "glCreateImageCHROMIUM", "image_id < 0"); 5257 SetGLError(GL_OUT_OF_MEMORY, "glCreateImageCHROMIUM", "image_id < 0");
5248 return 0; 5258 return 0;
5249 } 5259 }
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
5291 return 0; 5301 return 0;
5292 } 5302 }
5293 5303
5294 if (height <= 0) { 5304 if (height <= 0) {
5295 SetGLError(GL_INVALID_VALUE, 5305 SetGLError(GL_INVALID_VALUE,
5296 "glCreateGpuMemoryBufferImageCHROMIUM", 5306 "glCreateGpuMemoryBufferImageCHROMIUM",
5297 "height <= 0"); 5307 "height <= 0");
5298 return 0; 5308 return 0;
5299 } 5309 }
5300 5310
5301 if (!ValidImageFormat(internalformat)) { 5311 if (!ValidImageFormat(internalformat, capabilities_)) {
5302 SetGLError(GL_INVALID_VALUE, 5312 SetGLError(GL_INVALID_VALUE,
5303 "glCreateGpuMemoryBufferImageCHROMIUM", 5313 "glCreateGpuMemoryBufferImageCHROMIUM",
5304 "invalid format"); 5314 "invalid format");
5305 return 0; 5315 return 0;
5306 } 5316 }
5307 5317
5308 if (!ValidImageUsage(usage)) { 5318 if (!ValidImageUsage(usage)) {
5309 SetGLError(GL_INVALID_VALUE, 5319 SetGLError(GL_INVALID_VALUE,
5310 "glCreateGpuMemoryBufferImageCHROMIUM", 5320 "glCreateGpuMemoryBufferImageCHROMIUM",
5311 "invalid usage"); 5321 "invalid usage");
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
5500 CheckGLError(); 5510 CheckGLError();
5501 } 5511 }
5502 5512
5503 // Include the auto-generated part of this file. We split this because it means 5513 // Include the auto-generated part of this file. We split this because it means
5504 // we can easily edit the non-auto generated parts right here in this file 5514 // we can easily edit the non-auto generated parts right here in this file
5505 // instead of having to edit some template or the code generator. 5515 // instead of having to edit some template or the code generator.
5506 #include "gpu/command_buffer/client/gles2_implementation_impl_autogen.h" 5516 #include "gpu/command_buffer/client/gles2_implementation_impl_autogen.h"
5507 5517
5508 } // namespace gles2 5518 } // namespace gles2
5509 } // namespace gpu 5519 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/GLES2/extensions/CHROMIUM/CHROMIUM_image.txt ('k') | ui/gl/gl_image_memory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698