summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorapatrick@google.com <apatrick@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-24 21:35:57 +0000
committerapatrick@google.com <apatrick@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-24 21:35:57 +0000
commitb500fc1b519ab243ad1ae31f64c3fe3bca1dc08f (patch)
tree222e16c8b8847ceb2f7169b8c899a16a7e9e3d38
parent506cb1db9a466aad6b8d3fdce9cb94eb54516e47 (diff)
downloadchromium_src-b500fc1b519ab243ad1ae31f64c3fe3bca1dc08f.zip
chromium_src-b500fc1b519ab243ad1ae31f64c3fe3bca1dc08f.tar.gz
chromium_src-b500fc1b519ab243ad1ae31f64c3fe3bca1dc08f.tar.bz2
Added command buffer unit tests to gyp.
Can optionally override default renderer with environment variable. One of: GYP_DEFINES = "renderer=d3d9" GYP_DEFINES = "renderer=gl" GYP_DEFINES = "renderer=cb cb_service=d3d9" GYP_DEFINES = "renderer=cb cb_service=gl" Fixed some warnings. Works on windows with D3D9 but not GL, mac or linux yet. TEST=none BUG=none Review URL: http://codereview.chromium.org/208037 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@27125 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--o3d/build/common.gypi55
-rw-r--r--o3d/command_buffer/client/cross/cmd_buffer_helper_test.cc2
-rw-r--r--o3d/command_buffer/client/cross/id_allocator_test.cc2
-rw-r--r--o3d/command_buffer/command_buffer.gyp91
-rw-r--r--o3d/command_buffer/service/cross/cmd_buffer_engine_test.cc2
-rw-r--r--o3d/command_buffer/service/cross/gl/effect_gl.h2
-rw-r--r--o3d/core/core.gyp10
-rw-r--r--o3d/core/cross/gl/renderer_gl.cc2
-rw-r--r--o3d/import/cross/precompile.h7
-rw-r--r--o3d/import/import.gyp15
-rw-r--r--o3d/plugin/plugin.gyp2
-rw-r--r--o3d/tests/common/win/testing_common.cc1
-rw-r--r--o3d/tests/tests.gyp6
13 files changed, 147 insertions, 50 deletions
diff --git a/o3d/build/common.gypi b/o3d/build/common.gypi
index aa9ffe5..e847b54 100644
--- a/o3d/build/common.gypi
+++ b/o3d/build/common.gypi
@@ -6,6 +6,7 @@
'variables': {
'antlrdir': 'third_party/antlr3',
'breakpaddir': 'breakpad/src',
+ 'cb_service%': 'none',
'fcolladadir': 'third_party/fcollada/files',
'glewdir': 'third_party/glew/files',
'gtestdir': 'testing/gtest/include',
@@ -41,7 +42,7 @@
['OS == "win"',
{
'variables': {
- 'renderer': 'd3d9',
+ 'renderer%': 'd3d9',
'cgdir': 'third_party/cg/files/win',
'swiftshaderdir': 'o3d-internal/third_party/swiftshader/files',
'LIBRARY_SUFFIX': '.lib',
@@ -49,7 +50,6 @@
'target_defaults': {
'defines': [
'_CRT_SECURE_NO_WARNINGS',
- 'RENDERER_D3D9',
'OS_WIN',
'UNICODE',
'NACL_WINDOWS',
@@ -62,13 +62,12 @@
['OS == "mac"',
{
'variables': {
- 'renderer': 'gl',
+ 'renderer%': 'gl',
'cgdir': 'third_party/cg/files/mac',
'LIBRARY_SUFFIX': '.a',
},
'target_defaults': {
'defines': [
- 'RENDERER_GL',
'OS_MACOSX',
'UNICODE',
'GTEST_NOT_MAC_FRAMEWORK_MODE',
@@ -99,7 +98,7 @@
['OS == "linux"',
{
'variables': {
- 'renderer': 'gl',
+ 'renderer%': 'gl',
'cgdir': 'third_party/cg/files/linux',
'LIBRARY_SUFFIX': '.a',
},
@@ -109,7 +108,6 @@
'MOZ_X11',
'NACL_LINUX=1',
'OS_LINUX',
- 'RENDERER_GL',
'SK_BUILD_FOR_UNIX',
'UNICODE',
'XP_UNIX',
@@ -121,5 +119,50 @@
},
},
],
+ ['renderer == "d3d9"',
+ {
+ 'target_defaults': {
+ 'defines': [
+ 'RENDERER_D3D9',
+ ],
+ },
+ },
+ ],
+ ['renderer == "gl"',
+ {
+ 'target_defaults': {
+ 'defines': [
+ 'RENDERER_GL',
+ ],
+ },
+ },
+ ],
+ ['renderer == "cb"',
+ {
+ 'target_defaults': {
+ 'defines': [
+ 'RENDERER_CB',
+ ],
+ },
+ },
+ ],
+ ['cb_service == "d3d9"',
+ {
+ 'target_defaults': {
+ 'defines': [
+ 'CB_SERVICE_D3D9',
+ ],
+ },
+ },
+ ],
+ ['cb_service == "gl"',
+ {
+ 'target_defaults': {
+ 'defines': [
+ 'CB_SERVICE_GL',
+ ],
+ },
+ },
+ ],
],
}
diff --git a/o3d/command_buffer/client/cross/cmd_buffer_helper_test.cc b/o3d/command_buffer/client/cross/cmd_buffer_helper_test.cc
index 8bb4104..ab7a6a8 100644
--- a/o3d/command_buffer/client/cross/cmd_buffer_helper_test.cc
+++ b/o3d/command_buffer/client/cross/cmd_buffer_helper_test.cc
@@ -100,7 +100,7 @@ class CommandBufferHelperTest : public testing::Test {
// put to the limit) and the bottom side (from 0 to get).
if (put >= parser_put) {
// we're on the top side, check we are below the limit.
- EXPECT_GE(10, limit);
+ EXPECT_GE(10U, limit);
} else {
// we're on the bottom side, check we are below get.
EXPECT_GT(parser_get, limit);
diff --git a/o3d/command_buffer/client/cross/id_allocator_test.cc b/o3d/command_buffer/client/cross/id_allocator_test.cc
index 3cc2674..96ba097 100644
--- a/o3d/command_buffer/client/cross/id_allocator_test.cc
+++ b/o3d/command_buffer/client/cross/id_allocator_test.cc
@@ -82,7 +82,7 @@ TEST_F(IdAllocatorTest, TestAdvanced) {
IdAllocator *allocator = id_allocator();
// Allocate a significant number of resources.
- const int kNumResources = 100;
+ const unsigned int kNumResources = 100;
ResourceID ids[kNumResources];
for (int i = 0; i < kNumResources; ++i) {
ids[i] = allocator->AllocateID();
diff --git a/o3d/command_buffer/command_buffer.gyp b/o3d/command_buffer/command_buffer.gyp
index 4e3df30..9d508cc 100644
--- a/o3d/command_buffer/command_buffer.gyp
+++ b/o3d/command_buffer/command_buffer.gyp
@@ -16,25 +16,6 @@
'../../<(gtestdir)',
'../../<(nacldir)',
],
- 'defines': [
- ],
- 'conditions': [
- ['OS == "win"',
- {
- 'include_dirs': [
- '$(DXSDK_DIR)/Include',
- ],
- }
- ],
- ['OS == "mac" or OS == "linux"',
- {
- 'include_dirs': [
- '../../<(glewdir)/include',
- '../../<(cgdir)/include',
- ],
- },
- ],
- ],
},
'targets': [
{
@@ -64,6 +45,18 @@
],
},
{
+ 'target_name': 'command_buffer_common_test',
+ 'type': 'none',
+ 'direct_dependent_settings': {
+ 'sources': [
+ 'common/cross/bitfield_helpers_test.cc',
+ 'client/cross/cmd_buffer_helper_test.cc',
+ 'client/cross/fenced_allocator_test.cc',
+ 'client/cross/id_allocator_test.cc',
+ ],
+ },
+ },
+ {
'target_name': 'command_buffer_client',
'type': 'static_library',
'dependencies': [
@@ -83,6 +76,18 @@
],
},
{
+ 'target_name': 'command_buffer_client_test',
+ 'type': 'none',
+ 'direct_dependent_settings': {
+ 'sources': [
+ 'client/cross/buffer_sync_proxy_test.cc',
+ 'client/cross/cmd_buffer_helper_test.cc',
+ 'client/cross/fenced_allocator_test.cc',
+ 'client/cross/id_allocator_test.cc',
+ ],
+ },
+ },
+ {
'target_name': 'command_buffer_service',
'type': 'static_library',
'dependencies': [
@@ -110,6 +115,34 @@
'conditions': [
['OS == "win"',
{
+ 'msvs_settings': {
+ 'VCCLCompilerTool': {
+ 'ForcedIncludeFiles':
+ 'command_buffer/service/cross/precompile.h',
+ },
+ },
+ },
+ ],
+ ['OS == "mac"',
+ {
+ 'xcode_settings': {
+ 'GCC_PREFIX_HEADER': 'command_buffer/service/cross/precompile.h',
+ },
+ },
+ ],
+ ['OS == "linux"',
+ {
+ 'cflags': [
+ '-include',
+ 'command_buffer/service/cross/precompile.h',
+ ],
+ },
+ ],
+ ['cb_service == "d3d9"',
+ {
+ 'include_dirs': [
+ '$(DXSDK_DIR)/Include',
+ ],
'sources': [
'service/win/d3d9/d3d9_utils.h',
'service/win/d3d9/effect_d3d9.cc',
@@ -133,8 +166,12 @@
}, # 'direct_dependent_settings'
},
],
- ['OS == "mac" or OS == "linux"',
+ ['cb_service == "gl"',
{
+ 'include_dirs': [
+ '../../<(glewdir)/include',
+ '../../<(cgdir)/include',
+ ],
'sources': [
'service/cross/gl/effect_gl.cc',
'service/cross/gl/effect_gl.h',
@@ -161,5 +198,17 @@
],
], # 'conditions'
},
- ],
+ {
+ 'target_name': 'command_buffer_service_test',
+ 'type': 'none',
+ 'direct_dependent_settings': {
+ 'sources': [
+ 'service/cross/buffer_rpc_test.cc',
+ 'service/cross/cmd_buffer_engine_test.cc',
+ 'service/cross/cmd_parser_test.cc',
+ 'service/cross/resource_test.cc',
+ ],
+ },
+ },
+ ], # 'targets'
}
diff --git a/o3d/command_buffer/service/cross/cmd_buffer_engine_test.cc b/o3d/command_buffer/service/cross/cmd_buffer_engine_test.cc
index c217e4c..5e06153 100644
--- a/o3d/command_buffer/service/cross/cmd_buffer_engine_test.cc
+++ b/o3d/command_buffer/service/cross/cmd_buffer_engine_test.cc
@@ -500,7 +500,7 @@ TEST_F(CommandBufferEngineTest, TestNonRecoverableError) {
entries[put++].value_uint32 = 6;
// we should be beyond the end of the buffer now.
- DCHECK_LT(6, put);
+ DCHECK_LT(6U, put);
put = 0;
engine()->Put(put);
diff --git a/o3d/command_buffer/service/cross/gl/effect_gl.h b/o3d/command_buffer/service/cross/gl/effect_gl.h
index cd81727..8bc8c51 100644
--- a/o3d/command_buffer/service/cross/gl/effect_gl.h
+++ b/o3d/command_buffer/service/cross/gl/effect_gl.h
@@ -35,8 +35,6 @@
#ifndef O3D_COMMAND_BUFFER_SERVICE_CROSS_GL_EFFECT_GL_H_
#define O3D_COMMAND_BUFFER_SERVICE_CROSS_GL_EFFECT_GL_H_
-#include <Cg/cg.h>
-#include <Cg/cgGL.h>
#include <vector>
#include "command_buffer/common/cross/gapi_interface.h"
diff --git a/o3d/core/core.gyp b/o3d/core/core.gyp
index 9041471..13f50a1 100644
--- a/o3d/core/core.gyp
+++ b/o3d/core/core.gyp
@@ -17,6 +17,16 @@
'O3D_PLUGIN_VERSION="<!(python ../plugin/version_info.py --version)"',
],
'conditions': [
+ ['OS == "win"',
+ {
+ 'msvs_settings': {
+ 'VCCLCompilerTool': {
+ 'ForcedIncludeFiles':
+ 'core/cross/precompile.h',
+ },
+ },
+ },
+ ],
['renderer == "d3d9" and OS == "win"',
{
'include_dirs': [
diff --git a/o3d/core/cross/gl/renderer_gl.cc b/o3d/core/cross/gl/renderer_gl.cc
index 9f0955c..02a6942 100644
--- a/o3d/core/cross/gl/renderer_gl.cc
+++ b/o3d/core/cross/gl/renderer_gl.cc
@@ -1190,7 +1190,7 @@ void RendererGL::SetViewportInPixels(int left,
int vieport_top =
RenderSurfaceActive() ? top : display_height() - top - height;
::glViewport(left, vieport_top, width, height);
- UpdateHelperConstant(width, height);
+ UpdateHelperConstant(static_cast<float>(width), static_cast<float>(height));
// If it's the full client area turn off scissor test for speed.
if (left == 0 &&
diff --git a/o3d/import/cross/precompile.h b/o3d/import/cross/precompile.h
index 20671d6..c858aa4 100644
--- a/o3d/import/cross/precompile.h
+++ b/o3d/import/cross/precompile.h
@@ -37,17 +37,20 @@
#include <windows.h>
#include <shellapi.h>
#include <stdlib.h>
-#include <d3dx9.h>
#endif
#ifdef __cplusplus
+#if defined(RENDERER_D3D9)
+#include <d3dx9.h>
+#endif // defined(RENDERER_D3D9)
+
#if defined(RENDERER_GL)
#include <GL/glew.h>
#if defined(OS_WIN)
#include <GL/wglew.h>
#endif
-#endif // defined(RENDERER_GL)
+#endif // defined(RENDERER_GL)
#include <Cg/cg.h>
#include <Cg/cgGL.h>
diff --git a/o3d/import/import.gyp b/o3d/import/import.gyp
index 3dc94b3..4d5f31d 100644
--- a/o3d/import/import.gyp
+++ b/o3d/import/import.gyp
@@ -14,6 +14,7 @@
'..',
'../..',
'../../<(cgdir)/include',
+ '../../<(glewdir)/include',
'../../<(gtestdir)',
],
},
@@ -28,6 +29,7 @@
'../../<(jpegdir)/libjpeg.gyp:libjpeg',
'../../<(pngdir)/libpng.gyp:libpng',
'../../<(zlibdir)/zlib.gyp:zlib',
+ '../build/libs.gyp:cg_libs',
'../compiler/technique/technique.gyp:o3dTechnique',
],
'sources': [
@@ -49,22 +51,11 @@
],
'conditions' : [
- ['renderer == "gl"',
- {
- 'dependencies': [
- '../build/libs.gyp:cg_libs',
- ],
- },
- ],
- ['renderer == "d3d9" and OS == "win"',
+ ['OS == "win"',
{
'include_dirs': [
'$(DXSDK_DIR)/Include',
],
- }
- ],
- ['OS == "win"',
- {
'sources': [
'win/collada_conditioner_win.cc',
],
diff --git a/o3d/plugin/plugin.gyp b/o3d/plugin/plugin.gyp
index a5b2ff6..22894b1 100644
--- a/o3d/plugin/plugin.gyp
+++ b/o3d/plugin/plugin.gyp
@@ -214,7 +214,7 @@
},
},
],
- ['OS == "win" and (renderer == "d3d9" or renderer == "cb")',
+ ['OS == "win" and (renderer == "d3d9" or cb_service == "d3d9")',
{
'link_settings': {
'libraries': [
diff --git a/o3d/tests/common/win/testing_common.cc b/o3d/tests/common/win/testing_common.cc
index 8fb350b..e498331 100644
--- a/o3d/tests/common/win/testing_common.cc
+++ b/o3d/tests/common/win/testing_common.cc
@@ -36,7 +36,6 @@
#include <windows.h>
#include <Shellapi.h>
-#include <d3dx9.h>
#include "tests/common/win/testing_common.h"
#include "core/cross/install_check.h"
diff --git a/o3d/tests/tests.gyp b/o3d/tests/tests.gyp
index 36c9fa0..fc3c5ce 100644
--- a/o3d/tests/tests.gyp
+++ b/o3d/tests/tests.gyp
@@ -28,9 +28,13 @@
'../../base/base.gyp:base',
'../../skia/skia.gyp:skia',
'../../testing/gtest.gyp:gtest',
+ '../../testing/gmock.gyp:gmock',
'../../native_client/src/shared/imc/imc.gyp:google_nacl_imc',
'../compiler/technique/technique.gyp:o3dTechnique',
'../compiler/technique/technique.gyp:o3dTechniqueTest',
+ '../command_buffer/command_buffer.gyp:command_buffer_client_test',
+ '../command_buffer/command_buffer.gyp:command_buffer_common_test',
+ '../command_buffer/command_buffer.gyp:command_buffer_service_test',
'../core/core.gyp:o3dCore',
'../core/core.gyp:o3dCorePlatform',
'../core/core.gyp:o3dCoreTest',
@@ -162,7 +166,7 @@
'editbin /SUBSYSTEM:CONSOLE $(OutDir)/$(TargetFileName)',
},
],
- ['OS == "win" and (renderer == "d3d9" or renderer == "cb")',
+ ['OS == "win" and (renderer == "d3d9" or cb_service == "d3d9")',
{
'sources': [
'common/win/dxcapture.cc',