summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--o3d/core/cross/renderer.cc6
-rw-r--r--o3d/core/cross/renderer.h4
-rw-r--r--o3d/core/win/d3d9/renderer_d3d9.cc10
-rw-r--r--o3d/plugin/idl/client.idl22
-rw-r--r--o3d/plugin/mac/config_mac.mm3
5 files changed, 35 insertions, 10 deletions
diff --git a/o3d/core/cross/renderer.cc b/o3d/core/cross/renderer.cc
index 0d7b342..65ea374 100644
--- a/o3d/core/cross/renderer.cc
+++ b/o3d/core/cross/renderer.cc
@@ -93,6 +93,12 @@ bool IsSupportedTextureFormat(Texture::Format format,
} // anonymous namespace
+// Returns whether to Force the Software Renderer by checking for the existence
+// of the environment variable O3D_FORCE_SOFTWARE_RENDERER.
+bool Renderer::IsForceSoftwareRenderer() {
+ return getenv("O3D_FORCE_SOFTWARE_RENDERER") != NULL;
+}
+
Renderer::Renderer(ServiceLocator* service_locator)
: clear_client_(true),
need_to_render_(true),
diff --git a/o3d/core/cross/renderer.h b/o3d/core/cross/renderer.h
index d07d10e..e0fdde9 100644
--- a/o3d/core/cross/renderer.h
+++ b/o3d/core/cross/renderer.h
@@ -147,6 +147,10 @@ class Renderer {
// Creates a 'default' renderer, choosing the correct implementation type.
static Renderer* CreateDefaultRenderer(ServiceLocator* service_locator);
+ // Gets whether or not the renderer should attempt to use the software
+ // renderer.
+ static bool IsForceSoftwareRenderer();
+
// Initialises the renderer for use, claiming hardware resources.
InitStatus Init(const DisplayWindow& display, bool off_screen);
diff --git a/o3d/core/win/d3d9/renderer_d3d9.cc b/o3d/core/win/d3d9/renderer_d3d9.cc
index eed5e21..3cad2d9 100644
--- a/o3d/core/win/d3d9/renderer_d3d9.cc
+++ b/o3d/core/win/d3d9/renderer_d3d9.cc
@@ -368,14 +368,6 @@ bool ForceAntiAliasingOff(LPDIRECT3D9* d3d) {
return false;
}
-namespace {
-// Returns whether to Force the Software Renderer by checking for the existence
-// of the environmen variable O3D_FORCE_SOFTWARE_RENDERER.
-bool IsForceSoftwareRendererEnabled() {
- return getenv("O3D_FORCE_SOFTWARE_RENDERER") != NULL;
-}
-}
-
// Helper function that gets the D3D Interface, checks the available
// multisampling modes and selects the most advanced one available to create
// a D3D Device with a back buffer containing depth and stencil buffers that
@@ -394,7 +386,7 @@ Renderer::InitStatus InitializeD3D9Context(
// Check registry to see if the developer has opted to force the software
// renderer.
Renderer::InitStatus status_hardware;
- if (IsForceSoftwareRendererEnabled()) {
+ if (Renderer::IsForceSoftwareRenderer()) {
// Simulate GPU not up to spec.
status_hardware = Renderer::GPU_NOT_UP_TO_SPEC;
} else {
diff --git a/o3d/plugin/idl/client.idl b/o3d/plugin/idl/client.idl
index fb36b53..f8810e7 100644
--- a/o3d/plugin/idl/client.idl
+++ b/o3d/plugin/idl/client.idl
@@ -116,6 +116,28 @@ class ClientInfo {
%[
Whether or not O3D is using the software renderer.
+
+ For testing purposes you can force O3D to use the software renderer
+ by setting the environment variable O3D_FORCE_SOFTWARE_RENDERER to
+ anything.
+
+ \code
+ set O3D_FORCE_SOFTWARE_RENDERER=foo
+ \endcode
+ or
+ \code
+ export O3D_FORCE_SOFTWARE_RENDERER=foo
+ \endcode
+
+ You can set it at a system level if you want to set it for all
+ browser instances or set it from a command line and start your
+ browser from that same command line if you want to effect just
+ that instance of the browser.
+
+ Note that many browers require special command line options to
+ run in a separate process, otherwise they default to finding
+ the browser process already running and using that. For example
+ firefox requires the option -no-remote.
%]
[getter] bool software_renderer;
diff --git a/o3d/plugin/mac/config_mac.mm b/o3d/plugin/mac/config_mac.mm
index ec304da..eb995298 100644
--- a/o3d/plugin/mac/config_mac.mm
+++ b/o3d/plugin/mac/config_mac.mm
@@ -41,6 +41,7 @@
#include <iostream>
#include <fstream>
+#include "core/cross/renderer.h"
#include "plugin/cross/config.h"
#include "plugin/cross/plugin_metrics.h"
#include "plugin_mac.h"
@@ -186,7 +187,7 @@ bool UseSoftwareRenderer() {
is_initialized = true;
}
- return use_software_renderer;
+ return use_software_renderer || Renderer::IsForceSoftwareRenderer();
}
static bool GetVideoCardMetrics(CGDirectDisplayID displayID) {