diff options
author | gman@google.com <gman@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-27 18:27:16 +0000 |
---|---|---|
committer | gman@google.com <gman@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-27 18:27:16 +0000 |
commit | 529ade741466e0a73632c6283ab8b6cc9f6b9f7c (patch) | |
tree | 45654825eb8ed69fe9ce237b08022c81da412c0d /o3d | |
parent | 1bb81a4b7a25ed4c98468e138224bd6be50b348b (diff) | |
download | chromium_src-529ade741466e0a73632c6283ab8b6cc9f6b9f7c.zip chromium_src-529ade741466e0a73632c6283ab8b6cc9f6b9f7c.tar.gz chromium_src-529ade741466e0a73632c6283ab8b6cc9f6b9f7c.tar.bz2 |
temp fix for bug with compressed texture clearing
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@24631 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'o3d')
-rw-r--r-- | o3d/core/win/d3d9/texture_d3d9.cc | 39 |
1 files changed, 20 insertions, 19 deletions
diff --git a/o3d/core/win/d3d9/texture_d3d9.cc b/o3d/core/win/d3d9/texture_d3d9.cc index b2e309f..68ca0bc 100644 --- a/o3d/core/win/d3d9/texture_d3d9.cc +++ b/o3d/core/win/d3d9/texture_d3d9.cc @@ -400,30 +400,30 @@ Texture2DD3D9* Texture2DD3D9::Create(ServiceLocator* service_locator, resize_to_pot, enable_render_surfaces); + if (resize_to_pot) { + texture->backing_bitmap_->Allocate(format, width, height, levels, + Bitmap::IMAGE); + } + // Clear the texture. // This is platform specific because some platforms, (command-buffers), // will guarantee the textures are cleared so we don't have to. { - size_t row_size = image::ComputeMipChainSize(mip_width, 1, format, 1); + size_t row_size = image::ComputeMipChainSize(width, 1, format, 1); scoped_array<uint8> zero(new uint8[row_size]); memset(zero.get(), 0, row_size); for (int level = 0; level < levels; ++level) { if (enable_render_surfaces) { texture->GetRenderSurface(level); - } else { + } else if (!texture->IsCompressed()) { texture->SetRect(level, 0, 0, - image::ComputeMipDimension(level, mip_width), - image::ComputeMipDimension(level, mip_height), + image::ComputeMipDimension(level, width), + image::ComputeMipDimension(level, height), zero.get(), 0); } } } - if (resize_to_pot) { - texture->backing_bitmap_->Allocate(format, width, height, levels, - Bitmap::IMAGE); - } - return texture; } @@ -739,32 +739,33 @@ TextureCUBED3D9* TextureCUBED3D9::Create(ServiceLocator* service_locator, resize_to_pot, enable_render_surfaces); + if (resize_to_pot) { + for (int ii = 0; ii < static_cast<int>(NUMBER_OF_FACES); ++ii) { + texture->backing_bitmaps_[ii]->Allocate( + format, edge_length, edge_length, levels, Bitmap::IMAGE); + } + } + // Clear the texture. // This is platform specific because some platforms, (command-buffers), will // guarantee the textures are cleared so we don't have to. { - size_t row_size = image::ComputeMipChainSize(edge, 1, format, 1); + size_t row_size = image::ComputeMipChainSize(edge_length, 1, format, 1); scoped_array<uint8> zero(new uint8[row_size]); memset(zero.get(), 0, row_size); for (int level = 0; level < levels; ++level) { for (int face = 0; face < static_cast<int>(NUMBER_OF_FACES); ++face) { if (enable_render_surfaces) { texture->GetRenderSurface(static_cast<CubeFace>(face), level); - } else { + } else if (!texture->IsCompressed()) { texture->SetRect(static_cast<CubeFace>(face),level , 0, 0, - image::ComputeMipDimension(level, edge), - image::ComputeMipDimension(level, edge), + image::ComputeMipDimension(level, edge_length), + image::ComputeMipDimension(level, edge_length), zero.get(), 0); } } } } - if (resize_to_pot) { - for (int ii = 0; ii < static_cast<int>(NUMBER_OF_FACES); ++ii) { - texture->backing_bitmaps_[ii]->Allocate( - format, edge_length, edge_length, levels, Bitmap::IMAGE); - } - } return texture; } |