diff options
author | apatrick@google.com <apatrick@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-04 20:33:42 +0000 |
---|---|---|
committer | apatrick@google.com <apatrick@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-04 20:33:42 +0000 |
commit | 7d5b7657e9bf4d446395c843aee23c11f473389e (patch) | |
tree | 0894232c82acf551abc9f51c4484288bab1f7320 /o3d | |
parent | c7287a9c5154d8ce9f213d5e741021b13dfcbe66 (diff) | |
download | chromium_src-7d5b7657e9bf4d446395c843aee23c11f473389e.zip chromium_src-7d5b7657e9bf4d446395c843aee23c11f473389e.tar.gz chromium_src-7d5b7657e9bf4d446395c843aee23c11f473389e.tar.bz2 |
Removed command_buffer dependency on vectormath (indirectly via core/types.h).
Changed common.gypi to automatically select cb_service of d3d9 pr gl in chrome builds.
Review URL: http://codereview.chromium.org/360018
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@30987 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'o3d')
-rw-r--r-- | o3d/build/common.gypi | 78 | ||||
-rw-r--r-- | o3d/command_buffer/command_buffer.gyp | 5 | ||||
-rw-r--r-- | o3d/command_buffer/service/cross/cmd_parser.h | 1 | ||||
-rw-r--r-- | o3d/command_buffer/service/cross/common_decoder.h | 219 | ||||
-rw-r--r-- | o3d/command_buffer/service/cross/gapi_decoder.h | 1 | ||||
-rw-r--r-- | o3d/command_buffer/service/cross/resource.h | 3 | ||||
-rw-r--r-- | o3d/gpu_plugin/gpu_plugin.gyp | 4 | ||||
-rw-r--r-- | o3d/gpu_plugin/np_utils/np_browser.cc | 2 | ||||
-rw-r--r-- | o3d/gpu_plugin/np_utils/np_headers.h | 2 |
9 files changed, 172 insertions, 143 deletions
diff --git a/o3d/build/common.gypi b/o3d/build/common.gypi index 7f39a0d..383240e 100644 --- a/o3d/build/common.gypi +++ b/o3d/build/common.gypi @@ -20,36 +20,70 @@ 'seleniumdir': 'third_party/selenium_rc/files', 'skiadir': 'third_party/skia/include', 'zlibdir': 'third_party/zlib', - # If the DEPS file exists two levels up, then we're in a Chrome tree. - 'o3d_in_chrome%': '<!(python <(DEPTH)/o3d/build/file_exists.py <(DEPTH)/DEPS)', + + # Hack to ensure that these variables (specifically "renderer" and + # "cb_service") are available later in the file. Long term solution is late + # evaluation of variables. + 'variables': { + # If the DEPS file exists two levels up, then we're in a Chrome tree. + 'o3d_in_chrome%': '<!(python <(DEPTH)/o3d/build/file_exists.py <(DEPTH)/DEPS)', + 'conditions' : [ + # These have to come first because GYP doesn't like it when + # they're part of the same conditional as a conditions clause that + # uses them. + ['OS == "win"', + { + 'cgdir': 'third_party/cg/files/win', + 'renderer%': 'd3d9', + 'cb_service%': 'none', + 'swiftshaderdir': 'o3d-internal/third_party/swiftshader/files', + }, + ], + ['OS == "mac"', + { + 'cgdir': 'third_party/cg/files/mac', + 'renderer%': 'gl', + 'cb_service%': 'none', + 'swiftshaderdir': '', + }, + ], + ['OS == "linux"', + { + 'cgdir': 'third_party/cg/files/linux', + 'renderer%': 'gl', + 'cb_service%': 'none', + 'swiftshaderdir': '', + }, + ], + ], + }, + 'o3d_in_chrome%': '<(o3d_in_chrome)', + 'renderer%': '<(renderer)', + 'cgdir%': '<(cgdir)', + 'swiftshaderdir%': '<(swiftshaderdir)', + 'cb_service%': '<(cb_service)', + # We default to building everything only if the assets exist. # (and the teapot is the least likely asset to change). # This is so that chrome developers get a much reduced dependency set. 'o3d_developer%': '<!(python <(DEPTH)/o3d/build/file_exists.py ' '<(DEPTH)/o3d/o3d_assets/samples/convert_assets/teapot.zip)', 'selenium_screenshots%': 0, - 'cb_service%': 'none', + 'conditions' : [ - # These have to come first because GYP doesn't like it when - # they're part of the same conditional as a conditions clause that - # uses them. - ['OS == "win"', - { - 'cgdir': 'third_party/cg/files/win', - 'renderer%': 'd3d9', - 'swiftshaderdir': 'o3d-internal/third_party/swiftshader/files', - }, - ], - ['OS == "mac"', + ['o3d_in_chrome == "True"', { - 'cgdir': 'third_party/cg/files/mac', - 'renderer%': 'gl', - }, - ], - ['OS == "linux"', - { - 'cgdir': 'third_party/cg/files/linux', - 'renderer%': 'gl', + 'renderer': 'cb', + 'conditions': [ + ['OS == "win"', + { + 'cb_service': 'd3d9', + }, + { + 'cb_service': 'gl', + }, + ], + ], }, ], ], diff --git a/o3d/command_buffer/command_buffer.gyp b/o3d/command_buffer/command_buffer.gyp index e6faceb..23e9c48 100644 --- a/o3d/command_buffer/command_buffer.gyp +++ b/o3d/command_buffer/command_buffer.gyp @@ -165,6 +165,11 @@ 'include_dirs': [ '$(DXSDK_DIR)/Include', ], + 'link_settings': { + 'libraries': [ + '"$(DXSDK_DIR)/Lib/x86/DxErr.lib"', + ], + }, }, # 'all_dependent_settings' 'sources': [ 'service/win/d3d9/d3d9_utils.h', diff --git a/o3d/command_buffer/service/cross/cmd_parser.h b/o3d/command_buffer/service/cross/cmd_parser.h index 1b6268c..d1c245c 100644 --- a/o3d/command_buffer/service/cross/cmd_parser.h +++ b/o3d/command_buffer/service/cross/cmd_parser.h @@ -35,7 +35,6 @@ #ifndef O3D_COMMAND_BUFFER_SERVICE_CROSS_CMD_PARSER_H_ #define O3D_COMMAND_BUFFER_SERVICE_CROSS_CMD_PARSER_H_ -#include "core/cross/types.h" #include "command_buffer/common/cross/constants.h" #include "command_buffer/common/cross/cmd_buffer_common.h" diff --git a/o3d/command_buffer/service/cross/common_decoder.h b/o3d/command_buffer/service/cross/common_decoder.h index 3180417..8ad041a 100644 --- a/o3d/command_buffer/service/cross/common_decoder.h +++ b/o3d/command_buffer/service/cross/common_decoder.h @@ -1,110 +1,109 @@ -/*
- * Copyright 2009, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef O3D_COMMAND_BUFFER_SERVICE_CROSS_COMMON_DECODER_H_
-#define O3D_COMMAND_BUFFER_SERVICE_CROSS_COMMON_DECODER_H_
-
-#include "core/cross/types.h"
-#include "command_buffer/service/cross/cmd_parser.h"
-
-namespace o3d {
-namespace command_buffer {
-
-class CommandBufferEngine;
-
-// This class is a helper base class for implementing the common parts of the
-// o3d/gl2 command buffer decoder.
-class CommonDecoder : public AsyncAPIInterface {
- public:
- typedef parse_error::ParseError ParseError;
-
- CommonDecoder() : engine_(NULL) {
- }
- virtual ~CommonDecoder() {
- }
-
- // Sets the engine, to get shared memory buffers from, and to set the token
- // to.
- void set_engine(CommandBufferEngine* engine) {
- engine_ = engine;
- }
-
- protected:
- // Executes a common command.
- // Parameters:
- // command: the command index.
- // arg_count: the number of CommandBufferEntry arguments.
- // cmd_data: the command data.
- // Returns:
- // parse_error::NO_ERROR if no error was found, one of
- // parse_error::ParseError otherwise.
- parse_error::ParseError DoCommonCommand(
- unsigned int command,
- unsigned int arg_count,
- const void* cmd_data);
-
- // Gets the address of shared memory data, given a shared memory ID and an
- // offset. Also checks that the size is consistent with the shared memory
- // size.
- // Parameters:
- // shm_id: the id of the shared memory buffer.
- // offset: the offset of the data in the shared memory buffer.
- // size: the size of the data.
- // Returns:
- // NULL if shm_id isn't a valid shared memory buffer ID or if the size
- // check fails. Return a pointer to the data otherwise.
- void* GetAddressAndCheckSize(unsigned int shm_id,
- unsigned int offset,
- unsigned int size);
-
- // Gets an name for a common command.
- const char* GetCommonCommandName(cmd::CommandId command_id) const;
-
- private:
- // Generate a member function prototype for each command in an automated and
- // typesafe way.
- #define COMMON_COMMAND_BUFFER_CMD_OP(name) \
- parse_error::ParseError Handle ## name( \
- unsigned int arg_count, \
- const cmd::name& args); \
-
- COMMON_COMMAND_BUFFER_CMDS(COMMON_COMMAND_BUFFER_CMD_OP)
-
- #undef COMMON_COMMAND_BUFFER_CMD_OP
-
- CommandBufferEngine* engine_;
-};
-
-} // namespace command_buffer
-} // namespace o3d
-
-#endif // O3D_COMMAND_BUFFER_SERVICE_CROSS_COMMON_DECODER_H_
-
+/* + * Copyright 2009, Google Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef O3D_COMMAND_BUFFER_SERVICE_CROSS_COMMON_DECODER_H_ +#define O3D_COMMAND_BUFFER_SERVICE_CROSS_COMMON_DECODER_H_ + +#include "command_buffer/service/cross/cmd_parser.h" + +namespace o3d { +namespace command_buffer { + +class CommandBufferEngine; + +// This class is a helper base class for implementing the common parts of the +// o3d/gl2 command buffer decoder. +class CommonDecoder : public AsyncAPIInterface { + public: + typedef parse_error::ParseError ParseError; + + CommonDecoder() : engine_(NULL) { + } + virtual ~CommonDecoder() { + } + + // Sets the engine, to get shared memory buffers from, and to set the token + // to. + void set_engine(CommandBufferEngine* engine) { + engine_ = engine; + } + + protected: + // Executes a common command. + // Parameters: + // command: the command index. + // arg_count: the number of CommandBufferEntry arguments. + // cmd_data: the command data. + // Returns: + // parse_error::NO_ERROR if no error was found, one of + // parse_error::ParseError otherwise. + parse_error::ParseError DoCommonCommand( + unsigned int command, + unsigned int arg_count, + const void* cmd_data); + + // Gets the address of shared memory data, given a shared memory ID and an + // offset. Also checks that the size is consistent with the shared memory + // size. + // Parameters: + // shm_id: the id of the shared memory buffer. + // offset: the offset of the data in the shared memory buffer. + // size: the size of the data. + // Returns: + // NULL if shm_id isn't a valid shared memory buffer ID or if the size + // check fails. Return a pointer to the data otherwise. + void* GetAddressAndCheckSize(unsigned int shm_id, + unsigned int offset, + unsigned int size); + + // Gets an name for a common command. + const char* GetCommonCommandName(cmd::CommandId command_id) const; + + private: + // Generate a member function prototype for each command in an automated and + // typesafe way. + #define COMMON_COMMAND_BUFFER_CMD_OP(name) \ + parse_error::ParseError Handle ## name( \ + unsigned int arg_count, \ + const cmd::name& args); \ + + COMMON_COMMAND_BUFFER_CMDS(COMMON_COMMAND_BUFFER_CMD_OP) + + #undef COMMON_COMMAND_BUFFER_CMD_OP + + CommandBufferEngine* engine_; +}; + +} // namespace command_buffer +} // namespace o3d + +#endif // O3D_COMMAND_BUFFER_SERVICE_CROSS_COMMON_DECODER_H_ + diff --git a/o3d/command_buffer/service/cross/gapi_decoder.h b/o3d/command_buffer/service/cross/gapi_decoder.h index 26dfa79..dbef832 100644 --- a/o3d/command_buffer/service/cross/gapi_decoder.h +++ b/o3d/command_buffer/service/cross/gapi_decoder.h @@ -35,7 +35,6 @@ #ifndef O3D_COMMAND_BUFFER_SERVICE_CROSS_GAPI_DECODER_H_ #define O3D_COMMAND_BUFFER_SERVICE_CROSS_GAPI_DECODER_H_ -#include "core/cross/types.h" #include "command_buffer/service/cross/common_decoder.h" #include "command_buffer/common/cross/o3d_cmd_format.h" diff --git a/o3d/command_buffer/service/cross/resource.h b/o3d/command_buffer/service/cross/resource.h index fccfce8..d5125cb 100644 --- a/o3d/command_buffer/service/cross/resource.h +++ b/o3d/command_buffer/service/cross/resource.h @@ -37,7 +37,6 @@ #include <vector> #include "base/scoped_ptr.h" -#include "core/cross/types.h" #include "command_buffer/common/cross/resource.h" namespace o3d { @@ -259,7 +258,7 @@ template<class T> class ResourceMap { } // Gets a resource by ID. T *Get(ResourceId id) { - return down_cast<T*>(container_.Get(id)); + return static_cast<T*>(container_.Get(id)); } private: ResourceMapBase container_; diff --git a/o3d/gpu_plugin/gpu_plugin.gyp b/o3d/gpu_plugin/gpu_plugin.gyp index 8fcd89b..923f003 100644 --- a/o3d/gpu_plugin/gpu_plugin.gyp +++ b/o3d/gpu_plugin/gpu_plugin.gyp @@ -187,13 +187,9 @@ 'conditions': [ ['OS == "win" and (renderer == "d3d9" or renderer == "cb")', { - # These dependencies are temporary until the command buffer code - # loads D3D and D3DX dynamically. 'link_settings': { 'libraries': [ '"$(DXSDK_DIR)/Lib/x86/DxErr.lib"', - '"$(DXSDK_DIR)/Lib/x86/d3dx9.lib"', - '-ld3d9.lib', ], }, }, diff --git a/o3d/gpu_plugin/np_utils/np_browser.cc b/o3d/gpu_plugin/np_utils/np_browser.cc index e3756c7..b7d5a7e 100644 --- a/o3d/gpu_plugin/np_utils/np_browser.cc +++ b/o3d/gpu_plugin/np_utils/np_browser.cc @@ -124,7 +124,7 @@ void* NPBrowser::MapMemory(NPP npp, // NPN_MapMemory is an experiment. It only exists in NPNetscapeFuncs in // a hacked version of Chromium. #if defined(O3D_IN_CHROME) - return netscape_funcs_->mapmemory(npp, object, size); + return NULL; #else return NPN_MapMemory(npp, object, size); #endif diff --git a/o3d/gpu_plugin/np_utils/np_headers.h b/o3d/gpu_plugin/np_utils/np_headers.h index f11a054..3ba3c30 100644 --- a/o3d/gpu_plugin/np_utils/np_headers.h +++ b/o3d/gpu_plugin/np_utils/np_headers.h @@ -20,8 +20,6 @@ // Deliberately not including a directory name because Chromium and O3D put // these headers in different directories. -//#include "npapi.h" -//#include "npruntime.h" #undef utf8characters #undef utf8length |