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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 // Creates a 2D texture. For dynamic textures, create it in the default pool, | 85 // Creates a 2D texture. For dynamic textures, create it in the default pool, |
86 // and a shadow version in the system memory pool (that we can lock). For | 86 // and a shadow version in the system memory pool (that we can lock). For |
87 // regular texture, simply create one in the managed pool. | 87 // regular texture, simply create one in the managed pool. |
88 Texture2DD3D9 *Texture2DD3D9::Create(GAPID3D9 *gapi, | 88 Texture2DD3D9 *Texture2DD3D9::Create(GAPID3D9 *gapi, |
89 unsigned int width, | 89 unsigned int width, |
90 unsigned int height, | 90 unsigned int height, |
91 unsigned int levels, | 91 unsigned int levels, |
92 texture::Format format, | 92 texture::Format format, |
93 unsigned int flags, | 93 unsigned int flags, |
94 bool enable_render_surfaces) { | 94 bool enable_render_surfaces) { |
95 DCHECK_GT(width, 0); | 95 DCHECK_GT(width, 0U); |
96 DCHECK_GT(height, 0); | 96 DCHECK_GT(height, 0U); |
97 DCHECK_GT(levels, 0); | 97 DCHECK_GT(levels, 0U); |
98 D3DFORMAT d3d_format = D3DFormat(format); | 98 D3DFORMAT d3d_format = D3DFormat(format); |
99 IDirect3DDevice9 *device = gapi->d3d_device(); | 99 IDirect3DDevice9 *device = gapi->d3d_device(); |
100 if (enable_render_surfaces) { | 100 if (enable_render_surfaces) { |
101 CComPtr<IDirect3DTexture9> d3d_texture = NULL; | 101 CComPtr<IDirect3DTexture9> d3d_texture = NULL; |
102 HRESULT result = device->CreateTexture(width, height, levels, | 102 HRESULT result = device->CreateTexture(width, height, levels, |
103 D3DUSAGE_RENDERTARGET, d3d_format, | 103 D3DUSAGE_RENDERTARGET, d3d_format, |
104 D3DPOOL_DEFAULT, &d3d_texture, | 104 D3DPOOL_DEFAULT, &d3d_texture, |
105 NULL); | 105 NULL); |
106 if (result != D3D_OK) { | 106 if (result != D3D_OK) { |
107 LOG(ERROR) << "DirectX error when calling CreateTexture: " | 107 LOG(ERROR) << "DirectX error when calling CreateTexture: " |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
262 // and a shadow version in the system memory pool (that we can lock). For | 262 // and a shadow version in the system memory pool (that we can lock). For |
263 // regular texture, simply create one in the managed pool. | 263 // regular texture, simply create one in the managed pool. |
264 Texture3DD3D9 *Texture3DD3D9::Create(GAPID3D9 *gapi, | 264 Texture3DD3D9 *Texture3DD3D9::Create(GAPID3D9 *gapi, |
265 unsigned int width, | 265 unsigned int width, |
266 unsigned int height, | 266 unsigned int height, |
267 unsigned int depth, | 267 unsigned int depth, |
268 unsigned int levels, | 268 unsigned int levels, |
269 texture::Format format, | 269 texture::Format format, |
270 unsigned int flags, | 270 unsigned int flags, |
271 bool enable_render_surfaces) { | 271 bool enable_render_surfaces) { |
272 DCHECK_GT(width, 0); | 272 DCHECK_GT(width, 0U); |
273 DCHECK_GT(height, 0); | 273 DCHECK_GT(height, 0U); |
274 DCHECK_GT(depth, 0); | 274 DCHECK_GT(depth, 0U); |
275 DCHECK_GT(levels, 0); | 275 DCHECK_GT(levels, 0U); |
276 D3DFORMAT d3d_format = D3DFormat(format); | 276 D3DFORMAT d3d_format = D3DFormat(format); |
277 IDirect3DDevice9 *device = gapi->d3d_device(); | 277 IDirect3DDevice9 *device = gapi->d3d_device(); |
278 if (enable_render_surfaces) { | 278 if (enable_render_surfaces) { |
279 CComPtr<IDirect3DVolumeTexture9> d3d_texture = NULL; | 279 CComPtr<IDirect3DVolumeTexture9> d3d_texture = NULL; |
280 HRESULT result = device->CreateVolumeTexture(width, height, depth, levels, | 280 HRESULT result = device->CreateVolumeTexture(width, height, depth, levels, |
281 D3DUSAGE_RENDERTARGET, | 281 D3DUSAGE_RENDERTARGET, |
282 d3d_format, D3DPOOL_DEFAULT, | 282 d3d_format, D3DPOOL_DEFAULT, |
283 &d3d_texture, NULL); | 283 &d3d_texture, NULL); |
284 if (result != D3D_OK) { | 284 if (result != D3D_OK) { |
285 LOG(ERROR) << "DirectX error when calling CreateTexture: " | 285 LOG(ERROR) << "DirectX error when calling CreateTexture: " |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
437 | 437 |
438 // Creates a cube map texture. For dynamic textures, create it in the default | 438 // Creates a cube map texture. For dynamic textures, create it in the default |
439 // pool, and a shadow version in the system memory pool (that we can lock). For | 439 // pool, and a shadow version in the system memory pool (that we can lock). For |
440 // regular texture, simply create one in the managed pool. | 440 // regular texture, simply create one in the managed pool. |
441 TextureCubeD3D9 *TextureCubeD3D9::Create(GAPID3D9 *gapi, | 441 TextureCubeD3D9 *TextureCubeD3D9::Create(GAPID3D9 *gapi, |
442 unsigned int side, | 442 unsigned int side, |
443 unsigned int levels, | 443 unsigned int levels, |
444 texture::Format format, | 444 texture::Format format, |
445 unsigned int flags, | 445 unsigned int flags, |
446 bool enable_render_surfaces) { | 446 bool enable_render_surfaces) { |
447 DCHECK_GT(side, 0); | 447 DCHECK_GT(side, 0U); |
448 DCHECK_GT(levels, 0); | 448 DCHECK_GT(levels, 0U); |
449 D3DFORMAT d3d_format = D3DFormat(format); | 449 D3DFORMAT d3d_format = D3DFormat(format); |
450 IDirect3DDevice9 *device = gapi->d3d_device(); | 450 IDirect3DDevice9 *device = gapi->d3d_device(); |
451 if (enable_render_surfaces) { | 451 if (enable_render_surfaces) { |
452 CComPtr<IDirect3DCubeTexture9> d3d_texture = NULL; | 452 CComPtr<IDirect3DCubeTexture9> d3d_texture = NULL; |
453 HRESULT result = device->CreateCubeTexture(side, levels, | 453 HRESULT result = device->CreateCubeTexture(side, levels, |
454 D3DUSAGE_RENDERTARGET, | 454 D3DUSAGE_RENDERTARGET, |
455 d3d_format, D3DPOOL_DEFAULT, | 455 d3d_format, D3DPOOL_DEFAULT, |
456 &d3d_texture, NULL); | 456 &d3d_texture, NULL); |
457 if (result != D3D_OK) { | 457 if (result != D3D_OK) { |
458 LOG(ERROR) << "DirectX error when calling CreateTexture: " | 458 LOG(ERROR) << "DirectX error when calling CreateTexture: " |
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
718 return BufferSyncInterface::PARSE_INVALID_ARGUMENTS; | 718 return BufferSyncInterface::PARSE_INVALID_ARGUMENTS; |
719 Volume volume = {x, y, z, width, height, depth}; | 719 Volume volume = {x, y, z, width, height, depth}; |
720 return texture->GetData(this, volume, level, face, row_pitch, slice_pitch, | 720 return texture->GetData(this, volume, level, face, row_pitch, slice_pitch, |
721 size, data) ? | 721 size, data) ? |
722 BufferSyncInterface::PARSE_NO_ERROR : | 722 BufferSyncInterface::PARSE_NO_ERROR : |
723 BufferSyncInterface::PARSE_INVALID_ARGUMENTS; | 723 BufferSyncInterface::PARSE_INVALID_ARGUMENTS; |
724 } | 724 } |
725 | 725 |
726 } // namespace command_buffer | 726 } // namespace command_buffer |
727 } // namespace o3d | 727 } // namespace o3d |
OLD | NEW |