| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2009, Google Inc. | 2 * Copyright 2009, Google Inc. |
| 3 * All rights reserved. | 3 * All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
| 7 * met: | 7 * met: |
| 8 * | 8 * |
| 9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 glDeleteTextures(1, &gl_texture_); | 202 glDeleteTextures(1, &gl_texture_); |
| 203 CHECK_GL_ERROR(); | 203 CHECK_GL_ERROR(); |
| 204 } | 204 } |
| 205 | 205 |
| 206 Texture2DGL *Texture2DGL::Create(unsigned int width, | 206 Texture2DGL *Texture2DGL::Create(unsigned int width, |
| 207 unsigned int height, | 207 unsigned int height, |
| 208 unsigned int levels, | 208 unsigned int levels, |
| 209 texture::Format format, | 209 texture::Format format, |
| 210 unsigned int flags, | 210 unsigned int flags, |
| 211 bool enable_render_surfaces) { | 211 bool enable_render_surfaces) { |
| 212 DCHECK_GT(width, 0); | 212 DCHECK_GT(width, 0U); |
| 213 DCHECK_GT(height, 0); | 213 DCHECK_GT(height, 0U); |
| 214 DCHECK_GT(levels, 0); | 214 DCHECK_GT(levels, 0U); |
| 215 GLenum gl_internal_format = 0; | 215 GLenum gl_internal_format = 0; |
| 216 GLenum gl_format = 0; | 216 GLenum gl_format = 0; |
| 217 GLenum gl_type = 0; | 217 GLenum gl_type = 0; |
| 218 bool r = GetGLFormatType(format, &gl_internal_format, &gl_format, &gl_type); | 218 bool r = GetGLFormatType(format, &gl_internal_format, &gl_format, &gl_type); |
| 219 DCHECK(r); // Was checked in the decoder. | 219 DCHECK(r); // Was checked in the decoder. |
| 220 GLuint gl_texture = 0; | 220 GLuint gl_texture = 0; |
| 221 glGenTextures(1, &gl_texture); | 221 glGenTextures(1, &gl_texture); |
| 222 glBindTexture(GL_TEXTURE_2D, gl_texture); | 222 glBindTexture(GL_TEXTURE_2D, gl_texture); |
| 223 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, levels - 1); | 223 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, levels - 1); |
| 224 // glCompressedTexImage2D does't accept NULL as a parameter, so we need | 224 // glCompressedTexImage2D does't accept NULL as a parameter, so we need |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 340 return true; | 340 return true; |
| 341 } | 341 } |
| 342 | 342 |
| 343 Texture3DGL *Texture3DGL::Create(unsigned int width, | 343 Texture3DGL *Texture3DGL::Create(unsigned int width, |
| 344 unsigned int height, | 344 unsigned int height, |
| 345 unsigned int depth, | 345 unsigned int depth, |
| 346 unsigned int levels, | 346 unsigned int levels, |
| 347 texture::Format format, | 347 texture::Format format, |
| 348 unsigned int flags, | 348 unsigned int flags, |
| 349 bool enable_render_surfaces) { | 349 bool enable_render_surfaces) { |
| 350 DCHECK_GT(width, 0); | 350 DCHECK_GT(width, 0U); |
| 351 DCHECK_GT(height, 0); | 351 DCHECK_GT(height, 0U); |
| 352 DCHECK_GT(depth, 0); | 352 DCHECK_GT(depth, 0U); |
| 353 DCHECK_GT(levels, 0); | 353 DCHECK_GT(levels, 0U); |
| 354 GLenum gl_internal_format = 0; | 354 GLenum gl_internal_format = 0; |
| 355 GLenum gl_format = 0; | 355 GLenum gl_format = 0; |
| 356 GLenum gl_type = 0; | 356 GLenum gl_type = 0; |
| 357 bool r = GetGLFormatType(format, &gl_internal_format, &gl_format, &gl_type); | 357 bool r = GetGLFormatType(format, &gl_internal_format, &gl_format, &gl_type); |
| 358 DCHECK(r); // Was checked in the decoder. | 358 DCHECK(r); // Was checked in the decoder. |
| 359 GLuint gl_texture = 0; | 359 GLuint gl_texture = 0; |
| 360 glGenTextures(1, &gl_texture); | 360 glGenTextures(1, &gl_texture); |
| 361 glBindTexture(GL_TEXTURE_3D, gl_texture); | 361 glBindTexture(GL_TEXTURE_3D, gl_texture); |
| 362 glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MAX_LEVEL, levels - 1); | 362 glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MAX_LEVEL, levels - 1); |
| 363 // glCompressedTexImage3D does't accept NULL as a parameter, so we need | 363 // glCompressedTexImage3D does't accept NULL as a parameter, so we need |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 467 bool Texture3DGL::InstallFrameBufferObjects( | 467 bool Texture3DGL::InstallFrameBufferObjects( |
| 468 RenderSurfaceGL *gl_surface) { | 468 RenderSurfaceGL *gl_surface) { |
| 469 return false; | 469 return false; |
| 470 } | 470 } |
| 471 | 471 |
| 472 TextureCubeGL *TextureCubeGL::Create(unsigned int side, | 472 TextureCubeGL *TextureCubeGL::Create(unsigned int side, |
| 473 unsigned int levels, | 473 unsigned int levels, |
| 474 texture::Format format, | 474 texture::Format format, |
| 475 unsigned int flags, | 475 unsigned int flags, |
| 476 bool enable_render_surfaces) { | 476 bool enable_render_surfaces) { |
| 477 DCHECK_GT(side, 0); | 477 DCHECK_GT(side, 0U); |
| 478 DCHECK_GT(levels, 0); | 478 DCHECK_GT(levels, 0U); |
| 479 GLenum gl_internal_format = 0; | 479 GLenum gl_internal_format = 0; |
| 480 GLenum gl_format = 0; | 480 GLenum gl_format = 0; |
| 481 GLenum gl_type = 0; | 481 GLenum gl_type = 0; |
| 482 bool r = GetGLFormatType(format, &gl_internal_format, &gl_format, &gl_type); | 482 bool r = GetGLFormatType(format, &gl_internal_format, &gl_format, &gl_type); |
| 483 DCHECK(r); // Was checked in the decoder. | 483 DCHECK(r); // Was checked in the decoder. |
| 484 GLuint gl_texture = 0; | 484 GLuint gl_texture = 0; |
| 485 glGenTextures(1, &gl_texture); | 485 glGenTextures(1, &gl_texture); |
| 486 glBindTexture(GL_TEXTURE_CUBE_MAP, gl_texture); | 486 glBindTexture(GL_TEXTURE_CUBE_MAP, gl_texture); |
| 487 glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MAX_LEVEL, | 487 glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MAX_LEVEL, |
| 488 levels-1); | 488 levels-1); |
| (...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 740 // sampler parameters. | 740 // sampler parameters. |
| 741 DirtyEffect(); | 741 DirtyEffect(); |
| 742 return texture->GetData(volume, level, face, row_pitch, slice_pitch, | 742 return texture->GetData(volume, level, face, row_pitch, slice_pitch, |
| 743 size, data) ? | 743 size, data) ? |
| 744 BufferSyncInterface::kParseNoError : | 744 BufferSyncInterface::kParseNoError : |
| 745 BufferSyncInterface::kParseInvalidArguments; | 745 BufferSyncInterface::kParseInvalidArguments; |
| 746 } | 746 } |
| 747 | 747 |
| 748 } // namespace command_buffer | 748 } // namespace command_buffer |
| 749 } // namespace o3d | 749 } // namespace o3d |
| OLD | NEW |