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 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
312 | 312 |
313 // Creates a new texture object from scratch. | 313 // Creates a new texture object from scratch. |
314 Texture2DGLES2* Texture2DGLES2::Create(ServiceLocator* service_locator, | 314 Texture2DGLES2* Texture2DGLES2::Create(ServiceLocator* service_locator, |
315 Texture::Format format, | 315 Texture::Format format, |
316 int levels, | 316 int levels, |
317 int width, | 317 int width, |
318 int height, | 318 int height, |
319 bool enable_render_surfaces) { | 319 bool enable_render_surfaces) { |
320 DLOG(INFO) << "Texture2DGLES2 Create"; | 320 DLOG(INFO) << "Texture2DGLES2 Create"; |
321 DCHECK_NE(format, Texture::UNKNOWN_FORMAT); | 321 DCHECK_NE(format, Texture::UNKNOWN_FORMAT); |
| 322 DCHECK_GE(levels, 0); |
322 RendererGLES2 *renderer = static_cast<RendererGLES2 *>( | 323 RendererGLES2 *renderer = static_cast<RendererGLES2 *>( |
323 service_locator->GetService<Renderer>()); | 324 service_locator->GetService<Renderer>()); |
324 renderer->MakeCurrentLazy(); | 325 renderer->MakeCurrentLazy(); |
325 GLenum gl_internal_format = 0; | 326 GLenum gl_internal_format = 0; |
326 GLenum gl_data_type = 0; | 327 GLenum gl_data_type = 0; |
327 GLenum gl_format = GLFormatFromO3DFormat(format, | 328 GLenum gl_format = GLFormatFromO3DFormat(format, |
328 &gl_internal_format, | 329 &gl_internal_format, |
329 &gl_data_type); | 330 &gl_data_type); |
330 if (gl_internal_format == 0) { | 331 if (gl_internal_format == 0) { |
331 DLOG(ERROR) << "Unsupported format in Texture2DGLES2::Create."; | 332 DLOG(ERROR) << "Unsupported format in Texture2DGLES2::Create."; |
(...skipping 593 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
925 CHECK_GL_ERROR(); | 926 CHECK_GL_ERROR(); |
926 return false; | 927 return false; |
927 } | 928 } |
928 | 929 |
929 const Texture::RGBASwizzleIndices& | 930 const Texture::RGBASwizzleIndices& |
930 TextureCUBEGLES2::GetABGR32FSwizzleIndices() { | 931 TextureCUBEGLES2::GetABGR32FSwizzleIndices() { |
931 return g_gl_abgr32f_swizzle_indices; | 932 return g_gl_abgr32f_swizzle_indices; |
932 } | 933 } |
933 | 934 |
934 } // namespace o3d | 935 } // namespace o3d |
OLD | NEW |