diff options
author | apatrick@google.com <apatrick@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-15 21:51:41 +0000 |
---|---|---|
committer | apatrick@google.com <apatrick@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-15 21:51:41 +0000 |
commit | 973c0eda70048d5d9c6e7a02c14fb25e48a3d218 (patch) | |
tree | 22da99c6dc904d927d0ffb5d7311d7f878d9d84d /o3d | |
parent | a5a6e25bfb05924c0acb74ee42085b4456608c19 (diff) | |
download | chromium_src-973c0eda70048d5d9c6e7a02c14fb25e48a3d218.zip chromium_src-973c0eda70048d5d9c6e7a02c14fb25e48a3d218.tar.gz chromium_src-973c0eda70048d5d9c6e7a02c14fb25e48a3d218.tar.bz2 |
Made gyp file for command buffer libraries.
Gyp build works on Windows. Mac and linux won't work yet.
Fixed some warnings.
Switched from dxerr.lib to dxerr9.lib.
Implemented a Texture::SetRect case for DXT compressed textures.
Fixed division by zero for zero stride vertex buffers.
TEST=none
BUG=none
Review URL: http://codereview.chromium.org/200127
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@26271 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'o3d')
22 files changed, 265 insertions, 44 deletions
diff --git a/o3d/command_buffer/client/cross/cmd_buffer_helper.cc b/o3d/command_buffer/client/cross/cmd_buffer_helper.cc index 481f0c7..f844576 100644 --- a/o3d/command_buffer/client/cross/cmd_buffer_helper.cc +++ b/o3d/command_buffer/client/cross/cmd_buffer_helper.cc @@ -162,7 +162,7 @@ void CommandBufferHelper::WaitForAvailableEntries(unsigned int count) { // buffer, so we need to wrap. We will add noops all the way to the end, // but we need to make sure get wraps first, actually that get is 1 or // more (since put will wrap to 0 after we add the noops). - DCHECK_LE(1, put_); + DCHECK_LE(1U, put_); Flush(); while (get_ > put_ || get_ == 0) WaitForGetChange(); // Add the noops. By convention, a noop is a command 0 with no args. diff --git a/o3d/command_buffer/client/cross/effect_helper.cc b/o3d/command_buffer/client/cross/effect_helper.cc index 1f05dd8..ced1b3b 100644 --- a/o3d/command_buffer/client/cross/effect_helper.cc +++ b/o3d/command_buffer/client/cross/effect_helper.cc @@ -175,7 +175,7 @@ bool EffectHelper::GetParamStrings(EffectParamDesc *desc) { const char *raw_desc_string = reinterpret_cast<char *>(raw_desc); if (raw_desc->name_offset) { DCHECK_LE(raw_desc->name_offset + raw_desc->name_size, raw_desc->size); - DCHECK_GT(raw_desc->name_size, 0); + DCHECK_GT(raw_desc->name_size, 0U); DCHECK_EQ(raw_desc_string[raw_desc->name_offset + raw_desc->name_size - 1], 0); desc->name = String(raw_desc_string + raw_desc->name_offset, @@ -186,7 +186,7 @@ bool EffectHelper::GetParamStrings(EffectParamDesc *desc) { if (raw_desc->semantic_offset) { DCHECK_LE(raw_desc->semantic_offset + raw_desc->semantic_size, raw_desc->size); - DCHECK_GT(raw_desc->semantic_size, 0); + DCHECK_GT(raw_desc->semantic_size, 0U); DCHECK_EQ(raw_desc_string[raw_desc->semantic_offset + raw_desc->semantic_size - 1], 0); diff --git a/o3d/command_buffer/command_buffer.gyp b/o3d/command_buffer/command_buffer.gyp new file mode 100644 index 0000000..4e3df30 --- /dev/null +++ b/o3d/command_buffer/command_buffer.gyp @@ -0,0 +1,165 @@ +# Copyright (c) 2009 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'variables': { + 'chromium_code': 1, + }, + 'includes': [ + '../build/common.gypi', + ], + 'target_defaults': { + 'include_dirs': [ + '..', + '../..', + '../../<(gtestdir)', + '../../<(nacldir)', + ], + 'defines': [ + ], + 'conditions': [ + ['OS == "win"', + { + 'include_dirs': [ + '$(DXSDK_DIR)/Include', + ], + } + ], + ['OS == "mac" or OS == "linux"', + { + 'include_dirs': [ + '../../<(glewdir)/include', + '../../<(cgdir)/include', + ], + }, + ], + ], + }, + 'targets': [ + { + 'target_name': 'command_buffer_common', + 'type': 'static_library', + 'dependencies': [ + '../../native_client/src/shared/imc/imc.gyp:google_nacl_imc', + '../../native_client/src/shared/imc/imc.gyp:libgoogle_nacl_imc_c', + '../../native_client/src/shared/platform/platform.gyp:platform', + '../../native_client/src/trusted/desc/desc.gyp:nrd_xfer', + '../../native_client/src/trusted/service_runtime/service_runtime.gyp:gio', + ], + 'sources': [ + 'common/cross/bitfield_helpers.h', + 'common/cross/buffer_sync_api.cc', + 'common/cross/buffer_sync_api.h', + 'common/cross/cmd_buffer_format.h', + 'common/cross/gapi_interface.h', + 'common/cross/logging.h', + 'common/cross/mocks.h', + 'common/cross/resource.cc', + 'common/cross/resource.h', + 'common/cross/rpc.h', + 'common/cross/rpc_imc.cc', + 'common/cross/rpc_imc.h', + 'common/cross/types.h', + ], + }, + { + 'target_name': 'command_buffer_client', + 'type': 'static_library', + 'dependencies': [ + 'command_buffer_common', + ], + 'sources': [ + 'client/cross/buffer_sync_proxy.cc', + 'client/cross/buffer_sync_proxy.h', + 'client/cross/cmd_buffer_helper.cc', + 'client/cross/cmd_buffer_helper.h', + 'client/cross/effect_helper.cc', + 'client/cross/effect_helper.h', + 'client/cross/fenced_allocator.cc', + 'client/cross/fenced_allocator.h', + 'client/cross/id_allocator.cc', + 'client/cross/id_allocator.h', + ], + }, + { + 'target_name': 'command_buffer_service', + 'type': 'static_library', + 'dependencies': [ + 'command_buffer_common', + ], + 'sources': [ + 'service/cross/buffer_rpc.cc', + 'service/cross/buffer_rpc.h', + 'service/cross/cmd_buffer_engine.cc', + 'service/cross/cmd_buffer_engine.h', + 'service/cross/cmd_parser.cc', + 'service/cross/cmd_parser.h', + 'service/cross/effect_utils.cc', + 'service/cross/effect_utils.h', + 'service/cross/gapi_decoder.cc', + 'service/cross/gapi_decoder.h', + 'service/cross/mocks.h', + 'service/cross/precompile.cc', + 'service/cross/precompile.h', + 'service/cross/resource.cc', + 'service/cross/resource.h', + 'service/cross/texture_utils.cc', + 'service/cross/texture_utils.h', + ], + 'conditions': [ + ['OS == "win"', + { + 'sources': [ + 'service/win/d3d9/d3d9_utils.h', + 'service/win/d3d9/effect_d3d9.cc', + 'service/win/d3d9/effect_d3d9.h', + 'service/win/d3d9/gapi_d3d9.cc', + 'service/win/d3d9/gapi_d3d9.h', + 'service/win/d3d9/geometry_d3d9.cc', + 'service/win/d3d9/geometry_d3d9.h', + 'service/win/d3d9/render_surface_d3d9.cc', + 'service/win/d3d9/render_surface_d3d9.h', + 'service/win/d3d9/sampler_d3d9.cc', + 'service/win/d3d9/sampler_d3d9.h', + 'service/win/d3d9/states_d3d9.cc', + 'service/win/d3d9/texture_d3d9.cc', + 'service/win/d3d9/texture_d3d9.h', + ], # 'sources' + 'direct_dependent_settings': { + 'include_dirs': [ + '$(DXSDK_DIR)/Include', + ], + }, # 'direct_dependent_settings' + }, + ], + ['OS == "mac" or OS == "linux"', + { + 'sources': [ + 'service/cross/gl/effect_gl.cc', + 'service/cross/gl/effect_gl.h', + 'service/cross/gl/gapi_gl.cc', + 'service/cross/gl/gapi_gl.h', + 'service/cross/gl/geometry_gl.cc', + 'service/cross/gl/geometry_gl.h', + 'service/cross/gl/gl_utils.h', + 'service/cross/gl/sampler_gl.cc', + 'service/cross/gl/sampler_gl.h', + 'service/cross/gl/states_gl.cc', + 'service/cross/gl/texture_gl.cc', + 'service/cross/gl/texture_gl.h', + ], # 'sources' + }, + ], + ['OS == "linux"', + { + 'sources': [ + 'service/linux/x_utils.cc', + 'service/linux/x_utils.h', + ], + }, + ], + ], # 'conditions' + }, + ], +} diff --git a/o3d/command_buffer/common/cross/buffer_sync_api.h b/o3d/command_buffer/common/cross/buffer_sync_api.h index a561205..62d6011 100644 --- a/o3d/command_buffer/common/cross/buffer_sync_api.h +++ b/o3d/command_buffer/common/cross/buffer_sync_api.h @@ -41,7 +41,7 @@ namespace o3d { namespace command_buffer { // Command buffer type. -typedef ptrdiff_t CommandBufferOffset; +typedef size_t CommandBufferOffset; // Interface class for the Command Buffer Synchronous API. // This is the part of the command buffer API that is accessible through the diff --git a/o3d/command_buffer/common/cross/resource.h b/o3d/command_buffer/common/cross/resource.h index e6b6f09..5557d67 100644 --- a/o3d/command_buffer/common/cross/resource.h +++ b/o3d/command_buffer/common/cross/resource.h @@ -197,7 +197,7 @@ unsigned int GetBlockSizeY(Format format); // down. static unsigned int GetMipMapDimension(unsigned int base, unsigned int level) { - DCHECK_GT(base, 0); + DCHECK_GT(base, 0U); return std::max(1U, base >> level); } } // namespace texture diff --git a/o3d/command_buffer/common/cross/rpc.h b/o3d/command_buffer/common/cross/rpc.h index fb55a88..6e95ee2 100644 --- a/o3d/command_buffer/common/cross/rpc.h +++ b/o3d/command_buffer/common/cross/rpc.h @@ -35,7 +35,7 @@ #include "base/basictypes.h" -#include "third_party/native_client/googleclient/native_client/src/shared/imc/nacl_htp.h" +#include "native_client/src/shared/imc/nacl_htp.h" namespace o3d { namespace command_buffer { diff --git a/o3d/command_buffer/common/cross/rpc_fake.cc b/o3d/command_buffer/common/cross/rpc_fake.cc index ed09b90..028c753 100644 --- a/o3d/command_buffer/common/cross/rpc_fake.cc +++ b/o3d/command_buffer/common/cross/rpc_fake.cc @@ -141,7 +141,7 @@ bool RPCServer::Processor::ProcessMessage() { RPCMessage input; in_queue_->GetMessage(&input); RPCImplInterface::ReturnValue result = 0; - int continue_processing = true; + bool continue_processing = true; if (input.message_id == POISONED_MESSAGE_ID) { continue_processing = false; } else { diff --git a/o3d/command_buffer/common/cross/rpc_fake.h b/o3d/command_buffer/common/cross/rpc_fake.h index c7727c5..11eb258 100644 --- a/o3d/command_buffer/common/cross/rpc_fake.h +++ b/o3d/command_buffer/common/cross/rpc_fake.h @@ -40,6 +40,7 @@ #include <windows.h> #include <queue> +#include "base/scoped_ptr.h" #include "core/cross/types.h" #include "command_buffer/common/cross/rpc.h" diff --git a/o3d/command_buffer/common/cross/rpc_imc.cc b/o3d/command_buffer/common/cross/rpc_imc.cc index 5d6c1f7..f5c3c9e 100644 --- a/o3d/command_buffer/common/cross/rpc_imc.cc +++ b/o3d/command_buffer/common/cross/rpc_imc.cc @@ -33,7 +33,7 @@ #include <algorithm> #include "command_buffer/common/cross/logging.h" #include "command_buffer/common/cross/rpc_imc.h" -#include "third_party/native_client/googleclient/native_client/src/shared/imc/nacl_htp.h" +#include "native_client/src/shared/imc/nacl_htp.h" namespace o3d { namespace command_buffer { diff --git a/o3d/command_buffer/common/cross/rpc_imc.h b/o3d/command_buffer/common/cross/rpc_imc.h index 8e4aed4..097fb1c 100644 --- a/o3d/command_buffer/common/cross/rpc_imc.h +++ b/o3d/command_buffer/common/cross/rpc_imc.h @@ -33,7 +33,7 @@ #ifndef O3D_COMMAND_BUFFER_COMMON_CROSS_RPC_IMC_H_ #define O3D_COMMAND_BUFFER_COMMON_CROSS_RPC_IMC_H_ -#include "third_party/native_client/googleclient/native_client/src/shared/imc/nacl_imc.h" +#include "native_client/src/shared/imc/nacl_imc.h" #include "base/scoped_ptr.h" #include "command_buffer/common/cross/rpc.h" diff --git a/o3d/command_buffer/service/cross/gapi_decoder.cc b/o3d/command_buffer/service/cross/gapi_decoder.cc index d37f7e0..3087733 100644 --- a/o3d/command_buffer/service/cross/gapi_decoder.cc +++ b/o3d/command_buffer/service/cross/gapi_decoder.cc @@ -472,8 +472,10 @@ BufferSyncInterface::ParseError GAPIDecoder::DoCommand( Uint32 enables = args[0].value_uint32; if (cmd::Unused::Get(enables) != 0) return BufferSyncInterface::PARSE_INVALID_ARGUMENTS; - bool line_smooth = cmd::LineSmoothEnable::Get(enables); - bool point_sprite = cmd::PointSpriteEnable::Get(enables); + // !! to convert int to bool in a way that does not generate a + // warning in visual studio. + bool line_smooth = !!cmd::LineSmoothEnable::Get(enables); + bool point_sprite = !!cmd::PointSpriteEnable::Get(enables); float point_size = args[1].value_float; gapi_->SetPointLineRaster(line_smooth, point_sprite, point_size); return BufferSyncInterface::PARSE_NO_ERROR; @@ -673,7 +675,7 @@ BufferSyncInterface::ParseError GAPIDecoder::DecodeCreateTexture2D( (unused != 0) || (format >= texture::NUM_FORMATS)) return BufferSyncInterface::PARSE_INVALID_ARGUMENTS; if (levels == 0) levels = max_levels; - bool enable_render_surfaces = flags; + bool enable_render_surfaces = !!flags; return gapi_->CreateTexture2D(id, width, height, levels, static_cast<texture::Format>(format), flags, enable_render_surfaces); @@ -707,7 +709,7 @@ BufferSyncInterface::ParseError GAPIDecoder::DecodeCreateTexture3D( (format >= texture::NUM_FORMATS)) return BufferSyncInterface::PARSE_INVALID_ARGUMENTS; if (levels == 0) levels = max_levels; - bool enable_render_surfaces = flags; + bool enable_render_surfaces = !!flags; return gapi_->CreateTexture3D(id, width, height, depth, levels, static_cast<texture::Format>(format), flags, enable_render_surfaces); @@ -736,7 +738,7 @@ BufferSyncInterface::ParseError GAPIDecoder::DecodeCreateTextureCube( (unused2 != 0) || (format >= texture::NUM_FORMATS)) return BufferSyncInterface::PARSE_INVALID_ARGUMENTS; if (levels == 0) levels = max_levels; - bool enable_render_surfaces = flags; + bool enable_render_surfaces = !!flags; return gapi_->CreateTextureCube(id, side, levels, static_cast<texture::Format>(format), flags, enable_render_surfaces); diff --git a/o3d/command_buffer/service/cross/texture_utils.h b/o3d/command_buffer/service/cross/texture_utils.h index aa186b5..1f25ca2 100644 --- a/o3d/command_buffer/service/cross/texture_utils.h +++ b/o3d/command_buffer/service/cross/texture_utils.h @@ -75,8 +75,8 @@ struct TransferInfo { // Round a value up, so that it is divisible by the block size. static inline unsigned int RoundToBlockSize(unsigned int base, unsigned int block) { - DCHECK_GT(base, 0); - DCHECK_GT(block, 0); + DCHECK_GT(base, 0U); + DCHECK_GT(block, 0U); return block + base - 1 - (base - 1) % block; } diff --git a/o3d/command_buffer/service/win/d3d9/geometry_d3d9.cc b/o3d/command_buffer/service/win/d3d9/geometry_d3d9.cc index b81dcc3..e5f32b9 100644 --- a/o3d/command_buffer/service/win/d3d9/geometry_d3d9.cc +++ b/o3d/command_buffer/service/win/d3d9/geometry_d3d9.cc @@ -206,7 +206,15 @@ unsigned int VertexStructD3D9::SetStreams(GAPID3D9 *gapi) { } HR(d3d_device->SetStreamSource(i, vertex_buffer->d3d_vertex_buffer(), 0, pair.second)); - max_vertices = std::min(max_vertices, vertex_buffer->size()/pair.second); + + // TODO(apatrick): A zero size stride is valid. It means the first element + // in the vertex buffer will be used for every vertex. There doesn't seem + // to be enough information here to determine whether a zero stride + // vertex buffer is big enough to contain a single element. + if (pair.second != 0) { + max_vertices = std::min(max_vertices, + vertex_buffer->size() / pair.second); + } } return max_vertices; } diff --git a/o3d/command_buffer/service/win/d3d9/sampler_d3d9.cc b/o3d/command_buffer/service/win/d3d9/sampler_d3d9.cc index 928d577..3645a5d 100644 --- a/o3d/command_buffer/service/win/d3d9/sampler_d3d9.cc +++ b/o3d/command_buffer/service/win/d3d9/sampler_d3d9.cc @@ -116,7 +116,7 @@ void SamplerD3D9::SetStates(sampler::AddressingMode addressing_u, // These are validated in GAPIDecoder.cc DCHECK_NE(mag_filter, sampler::NONE); DCHECK_NE(min_filter, sampler::NONE); - DCHECK_GT(max_anisotropy, 0); + DCHECK_GT(max_anisotropy, 0U); d3d_address_u_ = AddressModeToD3D(addressing_u); d3d_address_v_ = AddressModeToD3D(addressing_v); d3d_address_w_ = AddressModeToD3D(addressing_w); diff --git a/o3d/command_buffer/service/win/d3d9/texture_d3d9.cc b/o3d/command_buffer/service/win/d3d9/texture_d3d9.cc index 121bf6f..d570fda 100644 --- a/o3d/command_buffer/service/win/d3d9/texture_d3d9.cc +++ b/o3d/command_buffer/service/win/d3d9/texture_d3d9.cc @@ -92,9 +92,9 @@ Texture2DD3D9 *Texture2DD3D9::Create(GAPID3D9 *gapi, texture::Format format, unsigned int flags, bool enable_render_surfaces) { - DCHECK_GT(width, 0); - DCHECK_GT(height, 0); - DCHECK_GT(levels, 0); + DCHECK_GT(width, 0U); + DCHECK_GT(height, 0U); + DCHECK_GT(levels, 0U); D3DFORMAT d3d_format = D3DFormat(format); IDirect3DDevice9 *device = gapi->d3d_device(); if (enable_render_surfaces) { @@ -269,10 +269,10 @@ Texture3DD3D9 *Texture3DD3D9::Create(GAPID3D9 *gapi, texture::Format format, unsigned int flags, bool enable_render_surfaces) { - DCHECK_GT(width, 0); - DCHECK_GT(height, 0); - DCHECK_GT(depth, 0); - DCHECK_GT(levels, 0); + DCHECK_GT(width, 0U); + DCHECK_GT(height, 0U); + DCHECK_GT(depth, 0U); + DCHECK_GT(levels, 0U); D3DFORMAT d3d_format = D3DFormat(format); IDirect3DDevice9 *device = gapi->d3d_device(); if (enable_render_surfaces) { @@ -444,8 +444,8 @@ TextureCubeD3D9 *TextureCubeD3D9::Create(GAPID3D9 *gapi, texture::Format format, unsigned int flags, bool enable_render_surfaces) { - DCHECK_GT(side, 0); - DCHECK_GT(levels, 0); + DCHECK_GT(side, 0U); + DCHECK_GT(levels, 0U); D3DFORMAT d3d_format = D3DFormat(format); IDirect3DDevice9 *device = gapi->d3d_device(); if (enable_render_surfaces) { diff --git a/o3d/core/core.gyp b/o3d/core/core.gyp index b38c8e7..9041471 100644 --- a/o3d/core/core.gyp +++ b/o3d/core/core.gyp @@ -308,6 +308,8 @@ 'type': 'static_library', 'dependencies': [ '../../skia/skia.gyp:skia', + '../command_buffer/command_buffer.gyp:command_buffer_client', + '../command_buffer/command_buffer.gyp:command_buffer_service', ], 'sources': [ ], @@ -379,6 +381,42 @@ ], }, ], + ['renderer == "cb"', + { + 'sources': [ + 'cross/command_buffer/buffer_cb.cc', + 'cross/command_buffer/buffer_cb.h', + 'cross/command_buffer/effect_cb.cc', + 'cross/command_buffer/effect_cb.h', + 'cross/command_buffer/install_check.cc', + 'cross/command_buffer/install_check.h', + 'cross/command_buffer/param_cache_cb.cc', + 'cross/command_buffer/param_cache_cb.h', + 'cross/command_buffer/primitive_cb.cc', + 'cross/command_buffer/primitive_cb.h', + 'cross/command_buffer/renderer_cb.cc', + 'cross/command_buffer/renderer_cb.h', + 'cross/command_buffer/render_surface_cb.cc', + 'cross/command_buffer/render_surface_cb.h', + 'cross/command_buffer/sampler_cb.cc', + 'cross/command_buffer/sampler_cb.h', + 'cross/command_buffer/states_cb.cc', + 'cross/command_buffer/states_cb.h', + 'cross/command_buffer/stream_bank_cb.cc', + 'cross/command_buffer/stream_bank_cb.h', + 'cross/command_buffer/texture_cb.cc', + 'cross/command_buffer/texture_cb.h', + ], + }, + ], + ['renderer == "cb" and OS == "win"', + { + 'sources': [ + 'win/command_buffer/win32_cb_server.cc', + 'win/command_buffer/win32_cb_server.h', + ], + }, + ], ], }, { diff --git a/o3d/core/cross/command_buffer/renderer_cb.cc b/o3d/core/cross/command_buffer/renderer_cb.cc index 4272c83..e2d3998 100644 --- a/o3d/core/cross/command_buffer/renderer_cb.cc +++ b/o3d/core/cross/command_buffer/renderer_cb.cc @@ -72,8 +72,8 @@ RendererCB::RendererCB(ServiceLocator* service_locator, cb_server_(NULL), frame_token_(0), state_manager_(new StateManager) { - DCHECK_GT(command_buffer_size, 0); - DCHECK_GT(transfer_memory_size, 0); + DCHECK_GT(command_buffer_size, 0U); + DCHECK_GT(transfer_memory_size, 0U); transfer_shm_ = command_buffer::CreateShm(transfer_memory_size); transfer_shm_address_ = command_buffer::MapShm(transfer_shm_, transfer_memory_size); diff --git a/o3d/core/cross/command_buffer/texture_cb.cc b/o3d/core/cross/command_buffer/texture_cb.cc index 4c401f9..73f53fc 100644 --- a/o3d/core/cross/command_buffer/texture_cb.cc +++ b/o3d/core/cross/command_buffer/texture_cb.cc @@ -106,13 +106,20 @@ void SetTextureDataBuffer(Texture::Format format, unsigned int dst_pitch) { const uint8* src = static_cast<const uint8*>(src_data); uint8* dst = static_cast<uint8*>(dst_buffer); - size_t bytes_per_line = image::ComputePitch(format, src_width); - for (unsigned yy = 0; yy < src_height; ++yy) { - memcpy(dst, src, bytes_per_line); + + size_t bytes_per_row = image::ComputePitch(format, src_width); + unsigned num_rows = src_height; + if (Texture::IsCompressedFormat(format)) { + num_rows = (num_rows + 3) / 4; + } + + for (unsigned yy = 0; yy < num_rows; ++yy) { + memcpy(dst, src, bytes_per_row); src += src_pitch; dst += dst_pitch; } } + // Sends the SET_TEXTURE_DATA command after formatting the args properly. void SetTextureData(RendererCB *renderer, ResourceID texture_id, @@ -402,7 +409,7 @@ bool Texture2DCB::PlatformSpecificLock( DCHECK_EQ(backing_bitmap_->width(), width()); DCHECK_EQ(backing_bitmap_->height(), height()); DCHECK_EQ(backing_bitmap_->format(), format()); - DCHECK_GT(backing_bitmap_->num_mipmaps(), level); + DCHECK_GT(backing_bitmap_->num_mipmaps(), static_cast<unsigned int>(level)); CopyBackResourceToBitmap(renderer_, resource_id_, level, TextureCUBE::FACE_POSITIVE_X, *backing_bitmap_.Get()); @@ -421,7 +428,7 @@ bool Texture2DCB::PlatformSpecificUnlock(int level) { DCHECK_EQ(backing_bitmap_->width(), width()); DCHECK_EQ(backing_bitmap_->height(), height()); DCHECK_EQ(backing_bitmap_->format(), format()); - DCHECK_GT(backing_bitmap_->num_mipmaps(), level); + DCHECK_GT(backing_bitmap_->num_mipmaps(), static_cast<unsigned int>(level)); if (LockedMode(level) != kReadOnly) { UpdateResourceFromBitmap(renderer_, resource_id_, level, TextureCUBE::FACE_POSITIVE_X, @@ -634,7 +641,7 @@ bool TextureCUBECB::PlatformSpecificLock( DCHECK_EQ(backing_bitmap->width(), edge_length()); DCHECK_EQ(backing_bitmap->height(), edge_length()); DCHECK_EQ(backing_bitmap->format(), format()); - DCHECK_GT(backing_bitmap->num_mipmaps(), level); + DCHECK_GT(backing_bitmap->num_mipmaps(), static_cast<unsigned int>(level)); CopyBackResourceToBitmap(renderer_, resource_id_, level, TextureCUBE::FACE_POSITIVE_X, *backing_bitmap); has_levels_[face] |= 1 << level; @@ -652,7 +659,7 @@ bool TextureCUBECB::PlatformSpecificUnlock(CubeFace face, int level) { DCHECK_EQ(backing_bitmap->width(), edge_length()); DCHECK_EQ(backing_bitmap->height(), edge_length()); DCHECK_EQ(backing_bitmap->format(), format()); - DCHECK_GT(backing_bitmap->num_mipmaps(), level); + DCHECK_GT(backing_bitmap->num_mipmaps(), static_cast<unsigned int>(level)); if (LockedMode(face, level) != kReadOnly) { UpdateResourceFromBitmap(renderer_, resource_id_, level, face, diff --git a/o3d/core/cross/command_buffer/texture_cb.h b/o3d/core/cross/command_buffer/texture_cb.h index e0e85d2..31bbb69 100644 --- a/o3d/core/cross/command_buffer/texture_cb.h +++ b/o3d/core/cross/command_buffer/texture_cb.h @@ -112,7 +112,7 @@ class Texture2DCB : public Texture2D { // Returns true if the backing bitmap has the data for the level. bool HasLevel(unsigned int level) { - DCHECK_LT(level, levels()); + DCHECK_LT(level, static_cast<unsigned int>(levels())); return (has_levels_ & (1 << level)) != 0; } @@ -192,7 +192,7 @@ class TextureCUBECB : public TextureCUBE { // Returns true if the backing bitmap has the data for the level. bool HasLevel(CubeFace face, unsigned int level) { - DCHECK_LT(level, levels()); + DCHECK_LT(level, static_cast<unsigned int>(levels())); return (has_levels_[face] & (1 << level)) != 0; } diff --git a/o3d/core/win/d3d9/utils_d3d9.h b/o3d/core/win/d3d9/utils_d3d9.h index 0bca546..03d4ca5 100644 --- a/o3d/core/win/d3d9/utils_d3d9.h +++ b/o3d/core/win/d3d9/utils_d3d9.h @@ -37,7 +37,7 @@ #define O3D_CORE_WIN_D3D9_UTILS_D3D9_H_ #include <d3d9.h> -#include <dxerr9.h> +#include <dxerr.h> #include "base/logging.h" #include "core/cross/stream.h" @@ -52,7 +52,7 @@ inline bool VerifyHResult(HRESULT hr, const char* file, int line, if (FAILED(hr)) { DLOG(ERROR) << "DX Error in file " << file << " line " << line << L": " - << DXGetErrorString9(hr) << L": " << call; + << DXGetErrorString(hr) << L": " << call; return false; } return true; diff --git a/o3d/plugin/plugin.gyp b/o3d/plugin/plugin.gyp index 53c24a2..a5b2ff6 100644 --- a/o3d/plugin/plugin.gyp +++ b/o3d/plugin/plugin.gyp @@ -214,11 +214,11 @@ }, }, ], - ['OS == "win" and renderer == "d3d9"', + ['OS == "win" and (renderer == "d3d9" or renderer == "cb")', { 'link_settings': { 'libraries': [ - '"$(DXSDK_DIR)/Lib/x86/DxErr9.lib"', + '"$(DXSDK_DIR)/Lib/x86/DxErr.lib"', '"$(DXSDK_DIR)/Lib/x86/d3dx9.lib"', '-ld3d9.lib', ], diff --git a/o3d/tests/tests.gyp b/o3d/tests/tests.gyp index a8c6766..36c9fa0 100644 --- a/o3d/tests/tests.gyp +++ b/o3d/tests/tests.gyp @@ -162,7 +162,7 @@ 'editbin /SUBSYSTEM:CONSOLE $(OutDir)/$(TargetFileName)', }, ], - ['OS == "win" and renderer == "d3d9"', + ['OS == "win" and (renderer == "d3d9" or renderer == "cb")', { 'sources': [ 'common/win/dxcapture.cc', @@ -173,7 +173,7 @@ 'msvs_settings': { 'VCLinkerTool': { 'AdditionalDependencies': [ - '"$(DXSDK_DIR)/Lib/x86/DxErr9.lib"', + '"$(DXSDK_DIR)/Lib/x86/DxErr.lib"', '"$(DXSDK_DIR)/Lib/x86/d3dx9.lib"', 'd3d9.lib', ], |