Merge inbound to m-c.
authorRyan VanderMeulen <ryanvm@gmail.com>
Thu, 09 May 2013 00:17:46 -0400
changeset 131331 ea059733677c6dcf059def235334045c4783b40b
parent 131330 666b239772be4ccb558807f9cb139dda46b8cf19 (current diff)
parent 131319 56425c0947591ca8dc5720ffdc4b45e430192748 (diff)
child 131332 5e5c123ad9e34fc557aa5dba0c835a5ca6468cda
child 131381 82ab0af69c16b2e817529789b94801ca9baac563
child 131609 7e46e0593bbc3971de7c2dcb203df1ce3797b537
push id27803
push userryanvm@gmail.com
push dateThu, 09 May 2013 04:20:22 +0000
treeherdermozilla-inbound@5e5c123ad9e3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
milestone23.0a1
first release with
nightly linux32
ea059733677c / 23.0a1 / 20130509031047 / files
nightly linux64
ea059733677c / 23.0a1 / 20130509031047 / files
nightly mac
ea059733677c / 23.0a1 / 20130509031047 / files
nightly win32
ea059733677c / 23.0a1 / 20130509031047 / files
nightly win64
ea059733677c / 23.0a1 / 20130509031047 / files
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
releases
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Merge inbound to m-c.
gfx/layers/d3d11/CompositorD3D11.cpp
gfx/layers/d3d11/CompositorD3D11.fx
gfx/layers/d3d11/CompositorD3D11.h
gfx/layers/d3d11/CompositorD3D11Shaders.h
gfx/layers/d3d11/TextureD3D11.cpp
gfx/layers/d3d11/TextureD3D11.h
gfx/layers/d3d11/genshaders.sh
js/src/vm/ParallelDo.cpp
js/src/vm/ParallelDo.h
--- a/accessible/src/base/nsAccUtils.cpp
+++ b/accessible/src/base/nsAccUtils.cpp
@@ -434,23 +434,26 @@ nsAccUtils::TextLength(Accessible* aAcce
   return text.Length();
 }
 
 bool
 nsAccUtils::MustPrune(Accessible* aAccessible)
 { 
   roles::Role role = aAccessible->Role();
 
-  // We don't prune buttons any more however AT don't expect children inside of
-  // button in general, we allow menu buttons to have children to make them
-  // accessible.
-  return role == roles::MENUITEM || 
-    role == roles::COMBOBOX_OPTION ||
-    role == roles::OPTION ||
-    role == roles::ENTRY ||
-    role == roles::FLAT_EQUATION ||
-    role == roles::PASSWORD_TEXT ||
-    role == roles::TOGGLE_BUTTON ||
-    role == roles::GRAPHIC ||
-    role == roles::SLIDER ||
-    role == roles::PROGRESSBAR ||
-    role == roles::SEPARATOR;
+  // Don't prune the tree for certain roles if the tree is more complex than
+  // a single text leaf.
+  return
+    (role == roles::MENUITEM ||
+     role == roles::COMBOBOX_OPTION ||
+     role == roles::OPTION ||
+     role == roles::ENTRY ||
+     role == roles::FLAT_EQUATION ||
+     role == roles::PASSWORD_TEXT ||
+     role == roles::PUSHBUTTON ||
+     role == roles::TOGGLE_BUTTON ||
+     role == roles::GRAPHIC ||
+     role == roles::SLIDER ||
+     role == roles::PROGRESSBAR ||
+     role == roles::SEPARATOR) &&
+    aAccessible->ContentChildCount() == 1 &&
+    aAccessible->ContentChildAt(0)->IsTextLeaf();
 }
--- a/accessible/tests/mochitest/hittest/test_general.html
+++ b/accessible/tests/mochitest/hittest/test_general.html
@@ -44,17 +44,17 @@ if (!MAC) {
       testChildAtPoint(txt, -1, 1, null, null);
 
       // ::MustPrune case, point is outside of root accessible.
       testChildAtPoint(txt, -10000, 10000, null, null);
 
       // Not specific case, point is inside of btn accessible.
       var btn = getAccessible("btn");
       var btnText = btn.firstChild;
-      testChildAtPoint(btn, 1, 1, btnText, btnText);
+      testChildAtPoint(btn, 1, 1, btn, btn);
   
       // Not specific case, point is outside of btn accessible.
       testChildAtPoint(btn, -1, 1, null, null);
 
       // Out of flow accessible testing, do not return out of flow accessible
       // because it's not a child of the accessible even visually it is.
       var rectArea = getNode("area").getBoundingClientRect();
       var outOfFlow = getNode("outofflow");
--- a/addon-sdk/mach_commands.py
+++ b/addon-sdk/mach_commands.py
@@ -20,17 +20,18 @@ from mach.decorators import (
 
 class JetpackRunner(MozbuildObject):
     """Run jetpack tests."""
     def run_tests(self, **kwargs):
         self._run_make(target='jetpack-tests')
 
 @CommandProvider
 class MachCommands(MachCommandBase):
-    @Command('jetpack-test', help='Runs the jetpack test suite.')
+    @Command('jetpack-test', category='testing',
+        description='Runs the jetpack test suite.')
     def run_jetpack_test(self, **params):
         # We should probably have a utility function to ensure the tree is
         # ready to run tests. Until then, we just create the state dir (in
         # case the tree wasn't built with mach).
         self._ensure_state_subdir_exists('.')
 
         jetpack = self._spawn(JetpackRunner)
 
--- a/b2g/app/b2g.js
+++ b/b2g/app/b2g.js
@@ -686,10 +686,14 @@ pref("b2g.version", @MOZ_B2G_VERSION@);
 // Disable console buffering to save memory.
 pref("consoleservice.buffered", false);
 
 #ifdef MOZ_WIDGET_GONK
 // Performance testing suggests 2k is a better page size for SQLite.
 pref("toolkit.storage.pageSize", 2048);
 #endif
 
+// Enable captive portal detection.
+pref("captivedetect.canonicalURL", "http://detectportal.firefox.com/success.txt");
+pref("captivedetect.canonicalContent", "success\n");
+
 // The url of the manifest we use for ADU pings.
 pref("ping.manifestURL", "https://marketplace.firefox.com/packaged.webapp");
new file mode 100644
--- /dev/null
+++ b/b2g/config/emulator/config.json
@@ -0,0 +1,22 @@
+{
+    "config_version": 2,
+    "tooltool_manifest": "releng-emulator.tt",
+    "mock_target": "mozilla-centos6-x86_64",
+    "mock_packages": ["ccache", "make", "bison", "flex", "gcc", "g++", "mpfr", "zlib-devel", "ncurses-devel", "zip", "autoconf213", "glibc-static", "perl-Digest-SHA", "wget", "alsa-lib", "atk", "cairo", "dbus-glib", "fontconfig", "freetype", "glib2", "gtk2", "libXRender", "libXt", "pango", "mozilla-python27-mercurial", "openssh-clients", "nss-devel", "glibc-devel.i686", "libstdc++.i686", "zlib-devel.i686", "ncurses-devel.i686", "libX11-devel.i686", "mesa-libGL-devel.i686", "mesa-libGL-devel", "libX11-devel", "git"],
+    "mock_files": [["/home/cltbld/.ssh", "/home/mock_mozilla/.ssh"]],
+    "build_targets": ["droid", "package-emulator"],
+    "upload_files": [
+        "{workdir}/out/emulator.tar.gz",
+        "{objdir}/dist/b2g-*.crashreporter-symbols.zip",
+        "{workdir}/sources.xml"
+    ],
+    "gecko_l10n_root": "http://hg.mozilla.org/l10n-central",
+    "gaia": {
+        "l10n": {
+            "vcs": "hgtool",
+            "root": "http://hg.mozilla.org/gaia-l10n"
+        }
+    },
+    "b2g_manifest": "emulator.xml",
+    "b2g_manifest_branch": "master"
+}
new file mode 100644
--- /dev/null
+++ b/b2g/config/emulator/releng-emulator.tt
@@ -0,0 +1,2 @@
+[
+]
--- a/browser/app/profile/firefox.js
+++ b/browser/app/profile/firefox.js
@@ -598,18 +598,18 @@ pref("network.protocol-handler.expose.nn
 pref("accessibility.typeaheadfind", false);
 pref("accessibility.typeaheadfind.timeout", 5000);
 pref("accessibility.typeaheadfind.linksonly", false);
 pref("accessibility.typeaheadfind.flashBar", 1);
 
 // plugin finder service url
 pref("pfs.datasource.url", "https://pfs.mozilla.org/plugins/PluginFinderService.php?mimetype=%PLUGIN_MIMETYPE%&appID=%APP_ID%&appVersion=%APP_VERSION%&clientOS=%CLIENT_OS%&chromeLocale=%CHROME_LOCALE%&appRelease=%APP_RELEASE%");
 
-// by default we show an infobar message when pages require plugins the user has not installed, or are outdated
-pref("plugins.hide_infobar_for_missing_plugin", false);
+// by default we show an infobar message when pages require plugins that are blocked, or are outdated
+pref("plugins.hide_infobar_for_blocked_plugin", false);
 pref("plugins.hide_infobar_for_outdated_plugin", false);
 
 pref("plugins.update.url", "https://www.mozilla.org/%LOCALE%/plugincheck/");
 pref("plugins.update.notifyUser", false);
 
 pref("plugins.click_to_play", false);
 
 // display door hanger if flash not installed
--- a/browser/base/content/browser-plugins.js
+++ b/browser/base/content/browser-plugins.js
@@ -930,17 +930,17 @@ var gPluginHandler = {
                           },
     };
 
     // If there is already an outdated plugin notification then do nothing
     if (outdatedNotification)
       return;
 
     if (eventType == "PluginBlocklisted") {
-      if (gPrefService.getBoolPref("plugins.hide_infobar_for_missing_plugin")) // XXX add a new pref?
+      if (gPrefService.getBoolPref("plugins.hide_infobar_for_blocked_plugin"))
         return;
 
       if (blockedNotification)
         return;
     }
     else if (eventType == "PluginOutdated") {
       if (gPrefService.getBoolPref("plugins.hide_infobar_for_outdated_plugin"))
         return;
--- a/browser/base/content/test/social/browser_social_markButton.js
+++ b/browser/base/content/test/social/browser_social_markButton.js
@@ -4,17 +4,17 @@
 
 let prefName = "social.enabled",
     gFinishCB;
 
 function test() {
   waitForExplicitFinish();
 
   // Need to load a http/https/ftp/ftps page for the social mark button to appear
-  let tab = gBrowser.selectedTab = gBrowser.addTab("https://example.com", {skipAnimation: true});
+  let tab = gBrowser.selectedTab = gBrowser.addTab("https://test1.example.com", {skipAnimation: true});
   tab.linkedBrowser.addEventListener("load", function tabLoad(event) {
     tab.linkedBrowser.removeEventListener("load", tabLoad, true);
     executeSoon(tabLoaded);
   }, true);
 
   registerCleanupFunction(function() {
     Services.prefs.clearUserPref(prefName);
     gBrowser.removeTab(tab);
@@ -69,20 +69,21 @@ function testInitial(finishcb) {
         });
       });
     });
     markButton.click();
   }, "provider didn't provide page-mark-config");
 }
 
 function testStillMarkedIn2Tabs() {
-  let toMark = "http://example.com";
+  let toMark = "http://test2.example.com";
   let markUri = Services.io.newURI(toMark, null, null);
   let markButton = SocialMark.button;
   let initialTab = gBrowser.selectedTab;
+  info("initialTab has loaded " + gBrowser.currentURI.spec);
   is(markButton.hasAttribute("marked"), false, "SocialMark button should not have 'marked' for the initial tab");
   let tab1 = gBrowser.selectedTab = gBrowser.addTab(toMark);
   let tab1b = gBrowser.getBrowserForTab(tab1);
 
   tab1b.addEventListener("load", function tabLoad(event) {
     tab1b.removeEventListener("load", tabLoad, true);
     let tab2 = gBrowser.selectedTab = gBrowser.addTab(toMark);
     let tab2b = gBrowser.getBrowserForTab(tab2);
@@ -94,41 +95,45 @@ function testStillMarkedIn2Tabs() {
         ok(!marked, "page is unmarked in annotations");
         markButton.click();
         waitForCondition(function() markButton.hasAttribute("marked"), function() {
           Social.isURIMarked(markUri, function(marked) {
             ok(marked, "page is marked in annotations");
             // and switching to the first tab (with the same URL) should still reflect marked.
             gBrowser.selectedTab = tab1;
             is(markButton.hasAttribute("marked"), true, "SocialMark button should reflect the marked state");
+            // wait for tabselect
+            gBrowser.tabContainer.addEventListener("TabSelect", function onTabSelect() {
+              gBrowser.tabContainer.removeEventListener("TabSelect", onTabSelect, false);
+              waitForCondition(function() !markButton.hasAttribute("marked"), function() {
+                gBrowser.selectedTab = tab1;
+      
+                SocialMark.togglePageMark(function() {
+                  Social.isURIMarked(gBrowser.currentURI, function(marked) {
+                    ok(!marked, "page is unmarked in annotations");
+                    is(markButton.hasAttribute("marked"), false, "mark button should not be marked");
+                    gBrowser.removeTab(tab1);
+                    gBrowser.removeTab(tab2);
+                    executeSoon(testStillMarkedAfterReopen);
+                  });
+                });
+              }, "button has been unmarked");
+            }, false);
             // but switching back the initial one should reflect not marked.
             gBrowser.selectedTab = initialTab;
-            waitForCondition(function() !markButton.hasAttribute("marked"), function() {
-              gBrowser.selectedTab = tab1;
-    
-              SocialMark.togglePageMark(function() {
-                Social.isURIMarked(gBrowser.currentURI, function(marked) {
-                  ok(!marked, "page is unmarked in annotations");
-                  is(markButton.hasAttribute("marked"), false, "mark button should not be marked");
-                  gBrowser.removeTab(tab1);
-                  gBrowser.removeTab(tab2);
-                  executeSoon(testStillMarkedAfterReopen);
-                });
-              });
-            }, "button has been unmarked");
           });
         }, "button has been marked");
       });
 
     }, true);
   }, true);
 }
 
 function testStillMarkedAfterReopen() {
-  let toMark = "http://example.com";
+  let toMark = "http://test2.example.com";
   let markButton = SocialMark.button;
 
   is(markButton.hasAttribute("marked"), false, "Reopen: SocialMark button should not have 'marked' for the initial tab");
   let tab = gBrowser.selectedTab = gBrowser.addTab(toMark);
   let tabb = gBrowser.getBrowserForTab(tab);
   tabb.addEventListener("load", function tabLoad(event) {
     tabb.removeEventListener("load", tabLoad, true);
     SocialMark.togglePageMark(function() {
@@ -149,17 +154,17 @@ function testStillMarkedAfterReopen() {
           });
         }, true);
       }, "button is now unmarked");
     });
   }, true);
 }
 
 function testOnlyMarkCertainUrlsTabSwitch() {
-  let toMark = "http://example.com";
+  let toMark = "http://test2.example.com";
   let notSharable = "about:blank";
   let markButton = SocialMark.button;
   let tab = gBrowser.selectedTab = gBrowser.addTab(toMark);
   let tabb = gBrowser.getBrowserForTab(tab);
   tabb.addEventListener("load", function tabLoad(event) {
     tabb.removeEventListener("load", tabLoad, true);
     ok(!markButton.hidden, "SocialMark button not hidden for http url");
     let tab2 = gBrowser.selectedTab = gBrowser.addTab(notSharable);
@@ -174,17 +179,17 @@ function testOnlyMarkCertainUrlsTabSwitc
       gBrowser.removeTab(tab);
       gBrowser.removeTab(tab2);
       executeSoon(testOnlyMarkCertainUrlsSameTab);
     }, true);
   }, true);
 }
 
 function testOnlyMarkCertainUrlsSameTab() {
-  let toMark = "http://example.com";
+  let toMark = "http://test2.example.com";
   let notSharable = "about:blank";
   let markButton = SocialMark.button;
   let tab = gBrowser.selectedTab = gBrowser.addTab(toMark);
   let tabb = gBrowser.getBrowserForTab(tab);
   tabb.addEventListener("load", function tabLoad(event) {
     tabb.removeEventListener("load", tabLoad, true);
     ok(!markButton.disabled, "SocialMark button not disabled for http url");
     tabb.addEventListener("load", function tabLoad(event) {
--- a/browser/components/nsBrowserGlue.js
+++ b/browser/components/nsBrowserGlue.js
@@ -1165,17 +1165,17 @@ BrowserGlue.prototype = {
     var notifyBox = win.gBrowser.getNotificationBox();
     var notification = notifyBox.appendNotification(text, title, null,
                                                     notifyBox.PRIORITY_CRITICAL_MEDIUM,
                                                     buttons);
     notification.persistence = -1; // Until user closes it
   },
 
   _migrateUI: function BG__migrateUI() {
-    const UI_VERSION = 12;
+    const UI_VERSION = 13;
     const BROWSER_DOCURL = "chrome://browser/content/browser.xul#";
     let currentUIVersion = 0;
     try {
       currentUIVersion = Services.prefs.getIntPref("browser.migration.version");
     } catch(ex) {}
     if (currentUIVersion >= UI_VERSION)
       return;
 
@@ -1358,16 +1358,24 @@ BrowserGlue.prototype = {
           // Just append.
           currentset = currentset.replace(/(^|,)window-controls($|,)/,
                                           "$1bookmarks-menu-button,window-controls$2")
         }
         this._setPersist(toolbarResource, currentsetResource, currentset);
       }
     }
 
+    if (currentUIVersion < 13) {
+      try {
+        if (Services.prefs.getBoolPref("plugins.hide_infobar_for_missing_plugin"))
+          Services.prefs.setBoolPref("plugins.notifyMissingFlash", false);
+      }
+      catch (ex) {}
+    }
+
     if (this._dirty)
       this._dataSource.QueryInterface(Ci.nsIRDFRemoteDataSource).Flush();
 
     delete this._rdf;
     delete this._dataSource;
 
     // Update the migration version.
     Services.prefs.setIntPref("browser.migration.version", UI_VERSION);
--- a/browser/installer/windows/nsis/shared.nsh
+++ b/browser/installer/windows/nsis/shared.nsh
@@ -465,17 +465,17 @@ FunctionEnd
   ${If} ${Errors}
     ${If} ${FileExists} "$QUICKLAUNCH\${BrandFullName}.lnk"
       WriteRegDWORD ${RegKey} "$0\InstallInfo" "IconsVisible" 1
     ${Else}
       WriteRegDWORD ${RegKey} "$0\InstallInfo" "IconsVisible" 0
     ${EndIf}
   ${EndIf}
 
-  WriteRegStr ${RegKey} "$0\shell\open\command" "" "$8"
+  WriteRegStr ${RegKey} "$0\shell\open\command" "" "$\"$8$\""
 
   WriteRegStr ${RegKey} "$0\shell\properties" "" "$(CONTEXT_OPTIONS)"
   WriteRegStr ${RegKey} "$0\shell\properties\command" "" "$\"$8$\" -preferences"
 
   WriteRegStr ${RegKey} "$0\shell\safemode" "" "$(CONTEXT_SAFE_MODE)"
   WriteRegStr ${RegKey} "$0\shell\safemode\command" "" "$\"$8$\" -safe-mode"
 
   ; Vista Capabilities registry keys
@@ -577,17 +577,17 @@ FunctionEnd
 
     ; Write the uninstall registry keys
     ${WriteRegStr2} $1 "$0" "Comments" "${BrandFullNameInternal} ${AppVersion} (${ARCH} ${AB_CD})" 0
     ${WriteRegStr2} $1 "$0" "DisplayIcon" "$8\${FileMainEXE},0" 0
     ${WriteRegStr2} $1 "$0" "DisplayName" "${BrandFullNameInternal} ${AppVersion} (${ARCH} ${AB_CD})" 0
     ${WriteRegStr2} $1 "$0" "DisplayVersion" "${AppVersion}" 0
     ${WriteRegStr2} $1 "$0" "InstallLocation" "$8" 0
     ${WriteRegStr2} $1 "$0" "Publisher" "Mozilla" 0
-    ${WriteRegStr2} $1 "$0" "UninstallString" "$8\uninstall\helper.exe" 0
+    ${WriteRegStr2} $1 "$0" "UninstallString" "$\"$8\uninstall\helper.exe$\"" 0
     ${WriteRegStr2} $1 "$0" "URLInfoAbout" "${URLInfoAbout}" 0
     ${WriteRegStr2} $1 "$0" "URLUpdateInfo" "${URLUpdateInfo}" 0
     ${WriteRegDWORD2} $1 "$0" "NoModify" 1 0
     ${WriteRegDWORD2} $1 "$0" "NoRepair" 1 0
 
     ${GetSize} "$8" "/S=0K" $R2 $R3 $R4
     ${WriteRegDWORD2} $1 "$0" "EstimatedSize" $R2 0
 
--- a/browser/metro/base/content/bindings/cssthrobber.xml
+++ b/browser/metro/base/content/bindings/cssthrobber.xml
@@ -7,17 +7,17 @@
 <bindings
     xmlns="http://www.mozilla.org/xbl"
     xmlns:xbl="http://www.mozilla.org/xbl"
     xmlns:html="http://www.w3.org/1999/xhtml"
     xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
   <binding id="cssthrobberBinding" extends="xul:box">
     <content>
       <html:div class="progressContainer">
-        <html:div class="progressBall progressBall" />
-        <html:div class="progressBall progressBall" />
-        <html:div class="progressBall progressBall" />
-        <html:div class="progressBall progressBall" />
-        <html:div class="progressBall progressBall" />
+        <html:div class="progressBall" />
+        <html:div class="progressBall" />
+        <html:div class="progressBall" />
+        <html:div class="progressBall" />
+        <html:div class="progressBall" />
       </html:div>
     </content>
   </binding>
 </bindings>
--- a/build/mach_bootstrap.py
+++ b/build/mach_bootstrap.py
@@ -46,16 +46,51 @@ MACH_MODULES = [
     'python/mozbuild/mozbuild/mach_commands.py',
     'python/mozbuild/mozbuild/frontend/mach_commands.py',
     'testing/marionette/mach_commands.py',
     'testing/mochitest/mach_commands.py',
     'testing/xpcshell/mach_commands.py',
     'tools/mach_commands.py',
 ]
 
+
+CATEGORIES = {
+    'build': {
+        'short': 'Build Commands',
+        'long': 'Interact with the build system',
+        'priority': 80,
+    },
+    'post-build': {
+        'short': 'Post-build Commands',
+        'long': 'Common actions performed after completing a build.',
+        'priority': 70,
+    },
+    'testing': {
+        'short': 'Testing',
+        'long': 'Run tests.',
+        'priority': 60,
+    },
+    'devenv': {
+        'short': 'Development Environment',
+        'long': 'Set up and configure your development environment.',
+        'priority': 50,
+    },
+    'build-dev': {
+        'short': 'Low-level Build System Interaction',
+        'long': 'Interact with specific parts of the build system.',
+        'priority': 20,
+    },
+    'misc': {
+        'short': 'Potpourri',
+        'long': 'Potent potables and assorted snacks.',
+        'priority': 10,
+    }
+}
+
+
 def bootstrap(topsrcdir, mozilla_dir=None):
     if mozilla_dir is None:
         mozilla_dir = topsrcdir
 
     # Ensure we are running Python 2.7+. We put this check here so we generate a
     # user-friendly error message rather than a cryptic stack trace on module
     # import.
     if sys.version_info[0] != 2 or sys.version_info[1] < 7:
@@ -65,11 +100,16 @@ def bootstrap(topsrcdir, mozilla_dir=Non
 
     try:
         import mach.main
     except ImportError:
         sys.path[0:0] = [os.path.join(mozilla_dir, path) for path in SEARCH_PATHS]
         import mach.main
 
     mach = mach.main.Mach(topsrcdir)
+    for category, meta in CATEGORIES.items():
+        mach.define_category(category, meta['short'], meta['long'],
+            meta['priority'])
+
     for path in MACH_MODULES:
         mach.load_commands_from_file(os.path.join(mozilla_dir, path))
+
     return mach
--- a/build/macosx/mozconfig.common
+++ b/build/macosx/mozconfig.common
@@ -20,11 +20,8 @@ if [ -z "$CC" ]; then
 fi
 
 # If not set use the system default clang++
 if [ -z "$CXX" ]; then
     export CXX=clang++
 fi
 
 ac_add_options --with-ccache
-
-# Enable ECMAScript Internationalization API
-ac_add_options --enable-intl-api
--- a/build/mozconfig.vs2010-common
+++ b/build/mozconfig.vs2010-common
@@ -1,11 +1,8 @@
-# Pymake needs Windows-style paths. Use cmd.exe to hack around this.
-mk_export_correct_style() {
-  if test -n "${_PYMAKE}"; then
-    mk_add_options "export $1=$(cmd.exe //c echo %$1%)"
-  else
-    mk_add_options "export $1=$(eval echo \$$1)"
-  fi
-}
-
-# Enable ECMAScript Internationalization API
-ac_add_options --enable-intl-api
+# Pymake needs Windows-style paths. Use cmd.exe to hack around this.
+mk_export_correct_style() {
+  if test -n "${_PYMAKE}"; then
+    mk_add_options "export $1=$(cmd.exe //c echo %$1%)"
+  else
+    mk_add_options "export $1=$(eval echo \$$1)"
+  fi
+}
--- a/build/unix/mozconfig.linux
+++ b/build/unix/mozconfig.linux
@@ -1,7 +1,4 @@
 . "$topsrcdir/build/mozconfig.common"
 
 CC=/tools/gcc-4.5-0moz3/bin/gcc
 CXX=/tools/gcc-4.5-0moz3/bin/g++
-
-# Enable ECMAScript Internationalization API
-ac_add_options --enable-intl-api
--- a/content/base/src/nsCCUncollectableMarker.cpp
+++ b/content/base/src/nsCCUncollectableMarker.cpp
@@ -414,19 +414,17 @@ struct TraceClosure
   uint32_t mGCNumber;
 };
 
 static PLDHashOperator
 TraceActiveWindowGlobal(const uint64_t& aId, nsGlobalWindow*& aWindow, void* aClosure)
 {
   if (aWindow->GetDocShell() && aWindow->IsOuterWindow()) {
     TraceClosure* closure = static_cast<TraceClosure*>(aClosure);
-    if (JSObject* global = aWindow->FastGetGlobalJSObject()) {
-      JS_CallObjectTracer(closure->mTrc, global, "active window global");
-    }
+    aWindow->TraceGlobalJSObject(closure->mTrc);
 #ifdef MOZ_XUL
     nsIDocument* doc = aWindow->GetExtantDoc();
     if (doc && doc->IsXUL()) {
       XULDocument* xulDoc = static_cast<XULDocument*>(doc);
       xulDoc->TraceProtos(closure->mTrc, closure->mGCNumber);
     }
 #endif
   }
--- a/content/base/src/nsContentUtils.cpp
+++ b/content/base/src/nsContentUtils.cpp
@@ -1642,17 +1642,18 @@ nsContentUtils::GetContextFromDocument(n
 void
 nsContentUtils::TraceSafeJSContext(JSTracer* aTrc)
 {
   JSContext* cx = GetSafeJSContext();
   if (!cx) {
     return;
   }
   if (JSObject* global = JS_GetGlobalObject(cx)) {
-    JS_CallObjectTracer(aTrc, global, "safe context");
+    JS_CallObjectTracer(aTrc, &global, "safe context");
+    MOZ_ASSERT(global == JS_GetGlobalObject(cx));
   }
 }
 
 nsPIDOMWindow *
 nsContentUtils::GetWindowFromCaller()
 {
   JSContext *cx = GetCurrentJSContext();
   if (cx) {
--- a/content/base/test/chrome/test_csp_bug768029.html
+++ b/content/base/test/chrome/test_csp_bug768029.html
@@ -23,19 +23,16 @@ Components.utils.import("resource://gre/
 /** Test for Bug 768029 **/
 
 // Note: we don't have to inspect all the different operations of CSP,
 // we're just looking for specific differences in behavior that indicate
 // a default CSP got applied.
 const DEFAULT_CSP_PRIV = "default-src *; script-src 'self'; style-src 'self' 'unsafe-inline'; object-src 'none'";
 const DEFAULT_CSP_CERT = "default-src *; script-src 'self'; style-src 'self'; object-src 'none'";
 
-if (navigator.platform.startsWith("Linux")) {
-  SimpleTest.expectAssertions(0, 1); // bug 846137, ASSERTION: wrong thread: 'PR_GetCurrentThread() == gSocketThread'
-}
 SimpleTest.waitForExplicitFinish();
 
 var gData = [
   {
     app: "https://example.com/manifest.webapp",
     appStatus: Components.interfaces.nsIPrincipal.APP_STATUS_INSTALLED,
     origin: "https://example.com",
     uri: "https://example.com/tests/content/base/test/file_csp_bug768029.html",
--- a/content/events/src/nsDOMAnimationEvent.cpp
+++ b/content/events/src/nsDOMAnimationEvent.cpp
@@ -51,19 +51,23 @@ already_AddRefed<nsDOMAnimationEvent>
 nsDOMAnimationEvent::Constructor(const mozilla::dom::GlobalObject& aGlobal,
                                  const nsAString& aType,
                                  const mozilla::dom::AnimationEventInit& aParam,
                                  mozilla::ErrorResult& aRv)
 {
   nsCOMPtr<mozilla::dom::EventTarget> t = do_QueryInterface(aGlobal.Get());
   nsRefPtr<nsDOMAnimationEvent> e = new nsDOMAnimationEvent(t, nullptr, nullptr);
   bool trusted = e->Init(t);
-  aRv = e->InitAnimationEvent(aType, aParam.mBubbles, aParam.mCancelable,
-                              aParam.mAnimationName, aParam.mElapsedTime,
-                              aParam.mPseudoElement);
+
+  aRv = e->InitEvent(aType, aParam.mBubbles, aParam.mCancelable);
+
+  e->AnimationEvent()->animationName = aParam.mAnimationName;
+  e->AnimationEvent()->elapsedTime = aParam.mElapsedTime;
+  e->AnimationEvent()->pseudoElement = aParam.mPseudoElement;
+
   e->SetTrusted(trusted);
   return e.forget();
 }
 
 NS_IMETHODIMP
 nsDOMAnimationEvent::GetAnimationName(nsAString & aAnimationName)
 {
   aAnimationName = AnimationEvent()->animationName;
@@ -79,33 +83,16 @@ nsDOMAnimationEvent::GetElapsedTime(floa
 
 NS_IMETHODIMP
 nsDOMAnimationEvent::GetPseudoElement(nsAString& aPseudoElement)
 {
   aPseudoElement = AnimationEvent()->pseudoElement;
   return NS_OK;
 }
 
-NS_IMETHODIMP
-nsDOMAnimationEvent::InitAnimationEvent(const nsAString & typeArg,
-                                        bool canBubbleArg,
-                                        bool cancelableArg,
-                                        const nsAString & animationNameArg,
-                                        float elapsedTimeArg,
-                                        const nsAString & pseudoElementArg)
-{
-  nsresult rv = nsDOMEvent::InitEvent(typeArg, canBubbleArg, cancelableArg);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  AnimationEvent()->animationName = animationNameArg;
-  AnimationEvent()->elapsedTime = elapsedTimeArg;
-  AnimationEvent()->pseudoElement = pseudoElementArg;
-  return NS_OK;
-}
-
 nsresult
 NS_NewDOMAnimationEvent(nsIDOMEvent **aInstancePtrResult,
                         mozilla::dom::EventTarget* aOwner,
                         nsPresContext *aPresContext,
                         nsAnimationEvent *aEvent)
 {
   nsDOMAnimationEvent* it =
     new nsDOMAnimationEvent(aOwner, aPresContext, aEvent);
--- a/content/events/src/nsDOMAnimationEvent.h
+++ b/content/events/src/nsDOMAnimationEvent.h
@@ -41,28 +41,16 @@ public:
   // GetAnimationName(nsAString& aAnimationName);
   // GetPseudoElement(nsAString& aPseudoElement);
 
   float ElapsedTime()
   {
     return AnimationEvent()->elapsedTime;
   }
 
-  void InitAnimationEvent(const nsAString& aType,
-                          bool aCanBubble,
-                          bool aCancelable,
-                          const nsAString& aAnimationName,
-                          float aElapsedTime,
-                          const mozilla::dom::Optional<nsAString>& aPseudoElement,
-                          mozilla::ErrorResult& aRv)
-  {
-    aRv = InitAnimationEvent(aType, aCanBubble, aCancelable, aAnimationName,
-                             aElapsedTime, aPseudoElement.WasPassed() ?
-                               aPseudoElement.Value() : EmptyString());
-  }
 private:
   nsAnimationEvent* AnimationEvent() {
     NS_ABORT_IF_FALSE(mEvent->eventStructType == NS_ANIMATION_EVENT,
                       "unexpected struct type");
     return static_cast<nsAnimationEvent*>(mEvent);
   }
 };
 
--- a/content/events/src/nsDOMTransitionEvent.cpp
+++ b/content/events/src/nsDOMTransitionEvent.cpp
@@ -51,19 +51,23 @@ already_AddRefed<nsDOMTransitionEvent>
 nsDOMTransitionEvent::Constructor(const mozilla::dom::GlobalObject& aGlobal,
                                   const nsAString& aType,
                                   const mozilla::dom::TransitionEventInit& aParam,
                                   mozilla::ErrorResult& aRv)
 {
   nsCOMPtr<mozilla::dom::EventTarget> t = do_QueryInterface(aGlobal.Get());
   nsRefPtr<nsDOMTransitionEvent> e = new nsDOMTransitionEvent(t, nullptr, nullptr);
   bool trusted = e->Init(t);
-  aRv = e->InitTransitionEvent(aType, aParam.mBubbles, aParam.mCancelable,
-                               aParam.mPropertyName, aParam.mElapsedTime,
-                               aParam.mPseudoElement);
+
+  aRv = e->InitEvent(aType, aParam.mBubbles, aParam.mCancelable);
+
+  e->TransitionEvent()->propertyName = aParam.mPropertyName;
+  e->TransitionEvent()->elapsedTime = aParam.mElapsedTime;
+  e->TransitionEvent()->pseudoElement = aParam.mPseudoElement;
+
   e->SetTrusted(trusted);
   return e.forget();
 }
 
 NS_IMETHODIMP
 nsDOMTransitionEvent::GetPropertyName(nsAString & aPropertyName)
 {
   aPropertyName = TransitionEvent()->propertyName;
@@ -79,33 +83,16 @@ nsDOMTransitionEvent::GetElapsedTime(flo
 
 NS_IMETHODIMP
 nsDOMTransitionEvent::GetPseudoElement(nsAString& aPseudoElement)
 {
   aPseudoElement = TransitionEvent()->pseudoElement;
   return NS_OK;
 }
 
-NS_IMETHODIMP
-nsDOMTransitionEvent::InitTransitionEvent(const nsAString & typeArg,
-                                          bool canBubbleArg,
-                                          bool cancelableArg,
-                                          const nsAString & propertyNameArg,
-                                          float elapsedTimeArg,
-                                          const nsAString& aPseudoElement)
-{
-  nsresult rv = nsDOMEvent::InitEvent(typeArg, canBubbleArg, cancelableArg);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  TransitionEvent()->propertyName = propertyNameArg;
-  TransitionEvent()->elapsedTime = elapsedTimeArg;
-  TransitionEvent()->pseudoElement = aPseudoElement;
-  return NS_OK;
-}
-
 nsresult
 NS_NewDOMTransitionEvent(nsIDOMEvent **aInstancePtrResult,
                          mozilla::dom::EventTarget* aOwner,
                          nsPresContext *aPresContext,
                          nsTransitionEvent *aEvent)
 {
   nsDOMTransitionEvent *it =
     new nsDOMTransitionEvent(aOwner, aPresContext, aEvent);
--- a/content/events/src/nsDOMTransitionEvent.h
+++ b/content/events/src/nsDOMTransitionEvent.h
@@ -41,28 +41,16 @@ public:
   // GetPropertyName(nsAString& aPropertyName)
   // GetPseudoElement(nsAString& aPreudoElement)
 
   float ElapsedTime()
   {
     return TransitionEvent()->elapsedTime;
   }
 
-  void InitTransitionEvent(const nsAString& aType,
-                           bool aCanBubble,
-                           bool aCancelable,
-                           const nsAString& aPropertyName,
-                           float aElapsedTime,
-                           const mozilla::dom::Optional<nsAString>& aPseudoElement,
-                           mozilla::ErrorResult& aRv)
-  {
-    aRv = InitTransitionEvent(aType, aCanBubble, aCancelable, aPropertyName,
-                              aElapsedTime, aPseudoElement.WasPassed() ?
-                                aPseudoElement.Value() : EmptyString());
-  }
 private:
   nsTransitionEvent* TransitionEvent() {
     NS_ABORT_IF_FALSE(mEvent->eventStructType == NS_TRANSITION_EVENT,
                       "unexpected struct type");
     return static_cast<nsTransitionEvent*>(mEvent);
   }
 };
 
--- a/content/events/src/nsEventDispatcher.cpp
+++ b/content/events/src/nsEventDispatcher.cpp
@@ -834,22 +834,16 @@ nsEventDispatcher::CreateEvent(mozilla::
   if (aEventType.LowerCaseEqualsLiteral("beforeunloadevent"))
     return NS_NewDOMBeforeUnloadEvent(aDOMEvent, aOwner, aPresContext, nullptr);
   if (aEventType.LowerCaseEqualsLiteral("pagetransition"))
     return NS_NewDOMPageTransitionEvent(aDOMEvent, aOwner, aPresContext, nullptr);
   if (aEventType.LowerCaseEqualsLiteral("domtransaction"))
     return NS_NewDOMDOMTransactionEvent(aDOMEvent, aOwner, aPresContext, nullptr);
   if (aEventType.LowerCaseEqualsLiteral("scrollareaevent"))
     return NS_NewDOMScrollAreaEvent(aDOMEvent, aOwner, aPresContext, nullptr);
-  // FIXME: Should get spec to say what the right string is here!  This
-  // is probably wrong!
-  if (aEventType.LowerCaseEqualsLiteral("transitionevent"))
-    return NS_NewDOMTransitionEvent(aDOMEvent, aOwner, aPresContext, nullptr);
-  if (aEventType.LowerCaseEqualsLiteral("animationevent"))
-    return NS_NewDOMAnimationEvent(aDOMEvent, aOwner, aPresContext, nullptr);
   if (aEventType.LowerCaseEqualsLiteral("popstateevent"))
     return NS_NewDOMPopStateEvent(aDOMEvent, aOwner, aPresContext, nullptr);
   if (aEventType.LowerCaseEqualsLiteral("mozaudioavailableevent"))
     return NS_NewDOMAudioAvailableEvent(aDOMEvent, aOwner, aPresContext, nullptr);
   if (aEventType.LowerCaseEqualsLiteral("closeevent"))
     return NS_NewDOMCloseEvent(aDOMEvent, aOwner, aPresContext, nullptr);
   if (aEventType.LowerCaseEqualsLiteral("touchevent") &&
       nsDOMTouchEvent::PrefEnabled())
@@ -860,11 +854,13 @@ nsEventDispatcher::CreateEvent(mozilla::
     return NS_NewDOMCustomEvent(aDOMEvent, aOwner, aPresContext, nullptr);
   if (aEventType.LowerCaseEqualsLiteral("mozsmsevent"))
     return NS_NewDOMMozSmsEvent(aDOMEvent, aOwner, aPresContext, nullptr);
   if (aEventType.LowerCaseEqualsLiteral("mozmmsevent"))
     return NS_NewDOMMozMmsEvent(aDOMEvent, aOwner, aPresContext, nullptr);
   if (aEventType.LowerCaseEqualsLiteral("storageevent")) {
     return NS_NewDOMStorageEvent(aDOMEvent, aOwner, aPresContext, nullptr);
   }
+  // NEW EVENT TYPES SHOULD NOT BE ADDED HERE; THEY SHOULD USE ONLY EVENT
+  // CONSTRUCTORS
 
   return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
 }
--- a/content/html/content/test/Makefile.in
+++ b/content/html/content/test/Makefile.in
@@ -348,16 +348,17 @@ MOCHITEST_FILES = \
 		test_mozLoadFrom.html \
 		test_style_attributes_reflection.html \
 		test_bug629801.html \
 		test_bug839371.html \
 		test_element_prototype.html \
 		test_formData.html \
 		test_audio_wakelock.html \
 		wakelock.ogg \
+		test_bug869040.html \
 		$(NULL)
 
 MOCHITEST_BROWSER_FILES = \
 		browser_bug649778.js \
 		file_bug649778.html \
 		file_bug649778.html^headers^ \
 		$(NULL)
 
new file mode 100644
--- /dev/null
+++ b/content/html/content/test/test_bug869040.html
@@ -0,0 +1,36 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=869040
+-->
+<head>
+  <meta charset="utf-8">
+  <title>Test for Bug 869040</title>
+  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=869040">Mozilla Bug 869040</a>
+<p id="display"></p>
+<div id="content" style="display: none" data-foo="present1" data-bar="present2">
+
+</div>
+<pre id="test">
+</pre>
+  <script type="application/javascript">
+
+  /** Test for Bug 869040 **/
+    var foo = "default1";
+    var dataset = $("content").dataset;
+    for (var i = 0; i < 100000; ++i)
+      foo = dataset.foo;
+
+    var bar = "default2";
+    for (var j = 0; j < 100; ++j)
+      bar = dataset.bar;
+
+    is(foo, "present1", "Our IC should work");
+    is(bar, "present2", "Our non-IC case should work");
+  </script>
+</body>
+</html>
--- a/content/media/MediaStreamGraph.cpp
+++ b/content/media/MediaStreamGraph.cpp
@@ -671,16 +671,18 @@ MediaStreamGraphImpl::NotifyHasCurrentDa
     aStream->mNotifiedHasCurrentData = true;
   }
 }
 
 void
 MediaStreamGraphImpl::CreateOrDestroyAudioStreams(GraphTime aAudioOutputStartTime,
                                                   MediaStream* aStream)
 {
+  MOZ_ASSERT(mRealtime, "Should only attempt to create audio streams in real-time mode");
+
   nsAutoTArray<bool,2> audioOutputStreamsFound;
   for (uint32_t i = 0; i < aStream->mAudioOutputStreams.Length(); ++i) {
     audioOutputStreamsFound.AppendElement(false);
   }
 
   if (!aStream->mAudioOutputs.IsEmpty()) {
     for (StreamBuffer::TrackIter tracks(aStream->GetStreamBuffer(), MediaSegment::AUDIO);
          !tracks.IsEnded(); tracks.Next()) {
@@ -727,16 +729,18 @@ MediaStreamGraphImpl::CreateOrDestroyAud
     }
   }
 }
 
 void
 MediaStreamGraphImpl::PlayAudio(MediaStream* aStream,
                                 GraphTime aFrom, GraphTime aTo)
 {
+  MOZ_ASSERT(mRealtime, "Should only attempt to play audio in realtime mode");
+
   if (aStream->mAudioOutputStreams.IsEmpty()) {
     return;
   }
 
   // When we're playing multiple copies of this stream at the same time, they're
   // perfectly correlated so adding volumes is the right thing to do.
   float volume = 0.0f;
   for (uint32_t i = 0; i < aStream->mAudioOutputs.Length(); ++i) {
@@ -800,16 +804,18 @@ MediaStreamGraphImpl::PlayAudio(MediaStr
       t = end;
     }
   }
 }
 
 void
 MediaStreamGraphImpl::PlayVideo(MediaStream* aStream)
 {
+  MOZ_ASSERT(mRealtime, "Should only attempt to play video in realtime mode");
+
   if (aStream->mVideoOutputs.IsEmpty())
     return;
 
   // Display the next frame a bit early. This is better than letting the current
   // frame be displayed for too long.
   GraphTime framePosition = mCurrentTime + MEDIA_GRAPH_TARGET_PERIOD_MS;
   NS_ASSERTION(framePosition >= aStream->mBufferStartTime, "frame position before buffer?");
   StreamTime frameBufferTime = GraphTimeToStreamTime(aStream, framePosition);
@@ -1005,71 +1011,76 @@ MediaStreamGraphImpl::RunThread()
             ps->ProduceOutput(prevComputedTime, mStateComputedTime);
             NS_ASSERTION(stream->mBuffer.GetEnd() >=
                          GraphTimeToStreamTime(stream, mStateComputedTime),
                        "Stream did not produce enough data");
           }
         }
       }
       NotifyHasCurrentData(stream);
-      CreateOrDestroyAudioStreams(prevComputedTime, stream);
-      PlayAudio(stream, prevComputedTime, mStateComputedTime);
-      audioStreamsActive += stream->mAudioOutputStreams.Length();
-      PlayVideo(stream);
+      if (mRealtime) {
+        // Only playback audio and video in real-time mode
+        CreateOrDestroyAudioStreams(prevComputedTime, stream);
+        PlayAudio(stream, prevComputedTime, mStateComputedTime);
+        audioStreamsActive += stream->mAudioOutputStreams.Length();
+        PlayVideo(stream);
+      }
       SourceMediaStream* is = stream->AsSourceStream();
       if (is) {
         UpdateBufferSufficiencyState(is);
       }
       GraphTime end;
       if (!stream->mBlocked.GetAt(mCurrentTime, &end) || end < GRAPH_TIME_MAX) {
         allBlockedForever = false;
       }
     }
     if (ensureNextIteration || !allBlockedForever || audioStreamsActive > 0) {
       EnsureNextIteration();
     }
 
     // Send updates to the main thread and wait for the next control loop
     // iteration.
     {
-      // Not using MonitorAutoLock since we need to unlock in a way
-      // that doesn't match lexical scopes.
       MonitorAutoLock lock(mMonitor);
       PrepareUpdatesToMainThreadState();
       if (mForceShutDown || (IsEmpty() && mMessageQueue.IsEmpty())) {
         // Enter shutdown mode. The stable-state handler will detect this
         // and complete shutdown. Destroy any streams immediately.
         LOG(PR_LOG_DEBUG, ("MediaStreamGraph %p waiting for main thread cleanup", this));
         // Commit to shutting down this graph object.
         mLifecycleState = LIFECYCLE_WAITING_FOR_MAIN_THREAD_CLEANUP;
         // No need to Destroy streams here. The main-thread owner of each
         // stream is responsible for calling Destroy them.
         return;
       }
 
-      PRIntervalTime timeout = PR_INTERVAL_NO_TIMEOUT;
-      TimeStamp now = TimeStamp::Now();
-      if (mNeedAnotherIteration) {
-        int64_t timeoutMS = MEDIA_GRAPH_TARGET_PERIOD_MS -
-          int64_t((now - mCurrentTimeStamp).ToMilliseconds());
-        // Make sure timeoutMS doesn't overflow 32 bits by waking up at
-        // least once a minute, if we need to wake up at all
-        timeoutMS = std::max<int64_t>(0, std::min<int64_t>(timeoutMS, 60*1000));
-        timeout = PR_MillisecondsToInterval(uint32_t(timeoutMS));
-        LOG(PR_LOG_DEBUG, ("Waiting for next iteration; at %f, timeout=%f",
-                           (now - mInitialTimeStamp).ToSeconds(), timeoutMS/1000.0));
-        mWaitState = WAITSTATE_WAITING_FOR_NEXT_ITERATION;
-      } else {
-        mWaitState = WAITSTATE_WAITING_INDEFINITELY;
-      }
-      if (timeout > 0) {
-        mMonitor.Wait(timeout);
-        LOG(PR_LOG_DEBUG, ("Resuming after timeout; at %f, elapsed=%f",
-                           (TimeStamp::Now() - mInitialTimeStamp).ToSeconds(),
-                           (TimeStamp::Now() - now).ToSeconds()));
+      // No need to wait in non-realtime mode, just churn through the input as soon
+      // as possible.
+      if (mRealtime) {
+        PRIntervalTime timeout = PR_INTERVAL_NO_TIMEOUT;
+        TimeStamp now = TimeStamp::Now();
+        if (mNeedAnotherIteration) {
+          int64_t timeoutMS = MEDIA_GRAPH_TARGET_PERIOD_MS -
+            int64_t((now - mCurrentTimeStamp).ToMilliseconds());
+          // Make sure timeoutMS doesn't overflow 32 bits by waking up at
+          // least once a minute, if we need to wake up at all
+          timeoutMS = std::max<int64_t>(0, std::min<int64_t>(timeoutMS, 60*1000));
+          timeout = PR_MillisecondsToInterval(uint32_t(timeoutMS));
+          LOG(PR_LOG_DEBUG, ("Waiting for next iteration; at %f, timeout=%f",
+                             (now - mInitialTimeStamp).ToSeconds(), timeoutMS/1000.0));
+          mWaitState = WAITSTATE_WAITING_FOR_NEXT_ITERATION;
+        } else {
+          mWaitState = WAITSTATE_WAITING_INDEFINITELY;
+        }
+        if (timeout > 0) {
+          mMonitor.Wait(timeout);
+          LOG(PR_LOG_DEBUG, ("Resuming after timeout; at %f, elapsed=%f",
+                             (TimeStamp::Now() - mInitialTimeStamp).ToSeconds(),
+                             (TimeStamp::Now() - now).ToSeconds()));
+        }
       }
       mWaitState = WAITSTATE_RUNNING;
       mNeedAnotherIteration = false;
       messageQueue.SwapElements(mMessageQueue);
     }
   }
 }
 
@@ -1934,29 +1945,30 @@ ProcessedMediaStream::DestroyImpl()
 }
 
 /**
  * We make the initial mCurrentTime nonzero so that zero times can have
  * special meaning if necessary.
  */
 static const int32_t INITIAL_CURRENT_TIME = 1;
 
-MediaStreamGraphImpl::MediaStreamGraphImpl()
+MediaStreamGraphImpl::MediaStreamGraphImpl(bool aRealtime)
   : mCurrentTime(INITIAL_CURRENT_TIME)
   , mStateComputedTime(INITIAL_CURRENT_TIME)
   , mProcessingGraphUpdateIndex(0)
   , mPortCount(0)
   , mMonitor("MediaStreamGraphImpl")
   , mLifecycleState(LIFECYCLE_THREAD_NOT_STARTED)
   , mWaitState(WAITSTATE_RUNNING)
   , mNeedAnotherIteration(false)
   , mForceShutDown(false)
   , mPostedRunInStableStateEvent(false)
   , mDetectedNotRunning(false)
   , mPostedRunInStableState(false)
+  , mRealtime(aRealtime)
 {
 #ifdef PR_LOGGING
   if (!gMediaStreamGraphLog) {
     gMediaStreamGraphLog = PR_NewLogModule("MediaStreamGraph");
   }
 #endif
 
   mCurrentTimeStamp = mInitialTimeStamp = TimeStamp::Now();
@@ -1987,23 +1999,43 @@ MediaStreamGraph::GetInstance()
   NS_ASSERTION(NS_IsMainThread(), "Main thread only");
 
   if (!gGraph) {
     if (!gShutdownObserverRegistered) {
       gShutdownObserverRegistered = true;
       nsContentUtils::RegisterShutdownObserver(new MediaStreamGraphShutdownObserver());
     }
 
-    gGraph = new MediaStreamGraphImpl();
+    gGraph = new MediaStreamGraphImpl(true);
     LOG(PR_LOG_DEBUG, ("Starting up MediaStreamGraph %p", gGraph));
   }
 
   return gGraph;
 }
 
+MediaStreamGraph*
+MediaStreamGraph::CreateNonRealtimeInstance()
+{
+  NS_ASSERTION(NS_IsMainThread(), "Main thread only");
+
+  MediaStreamGraphImpl* graph = new MediaStreamGraphImpl(false);
+  return graph;
+}
+
+void
+MediaStreamGraph::DestroyNonRealtimeInstance(MediaStreamGraph* aGraph)
+{
+  NS_ASSERTION(NS_IsMainThread(), "Main thread only");
+  MOZ_ASSERT(aGraph != gGraph, "Should not destroy the global graph here");
+
+  MediaStreamGraphImpl* graph = static_cast<MediaStreamGraphImpl*>(aGraph);
+  graph->ForceShutDown();
+  delete graph;
+}
+
 SourceMediaStream*
 MediaStreamGraph::CreateSourceStream(DOMMediaStream* aWrapper)
 {
   SourceMediaStream* stream = new SourceMediaStream(aWrapper);
   NS_ADDREF(stream);
   MediaStreamGraphImpl* graph = static_cast<MediaStreamGraphImpl*>(this);
   stream->SetGraphImpl(graph);
   graph->AppendMessage(new CreateMessage(stream));
--- a/content/media/MediaStreamGraph.h
+++ b/content/media/MediaStreamGraph.h
@@ -882,27 +882,31 @@ protected:
   bool mInCycle;
 };
 
 // Returns ideal audio rate for processing
 inline TrackRate IdealAudioRate() { return 48000; }
 
 /**
  * Initially, at least, we will have a singleton MediaStreamGraph per
- * process.
+ * process.  Each OfflineAudioContext object creates its own MediaStreamGraph
+ * object too.
  */
 class MediaStreamGraph {
 public:
   // We ensure that the graph current time advances in multiples of
   // IdealAudioBlockSize()/IdealAudioRate(). A stream that never blocks
   // and has a track with the ideal audio rate will produce audio in
   // multiples of the block size.
 
   // Main thread only
   static MediaStreamGraph* GetInstance();
+  static MediaStreamGraph* CreateNonRealtimeInstance();
+  static void DestroyNonRealtimeInstance(MediaStreamGraph* aGraph);
+
   // Control API.
   /**
    * Create a stream that a media decoder (or some other source of
    * media data, such as a camera) can write to.
    */
   SourceMediaStream* CreateSourceStream(DOMMediaStream* aWrapper);
   /**
    * Create a stream that will form the union of the tracks of its input
--- a/content/media/MediaStreamGraphImpl.h
+++ b/content/media/MediaStreamGraphImpl.h
@@ -98,21 +98,29 @@ protected:
   MediaStream* mStream;
 };
 
 /**
  * The implementation of a media stream graph. This class is private to this
  * file. It's not in the anonymous namespace because MediaStream needs to
  * be able to friend it.
  *
- * Currently we only have one per process.
+ * Currently we have one global instance per process, and one per each
+ * OfflineAudioContext object.
  */
 class MediaStreamGraphImpl : public MediaStreamGraph {
 public:
-  MediaStreamGraphImpl();
+  /**
+   * Set aRealtime to true in order to create a MediaStreamGraph which provides
+   * support for real-time audio and video.  Set it to false in order to create
+   * a non-realtime instance which just churns through its inputs and produces
+   * output.  Those objects currently only support audio, and are used to
+   * implement OfflineAudioContext.  They do not support MediaStream inputs.
+   */
+  explicit MediaStreamGraphImpl(bool aRealtime);
   ~MediaStreamGraphImpl()
   {
     NS_ASSERTION(IsEmpty(),
                  "All streams should have been destroyed by messages from the main thread");
     LOG(PR_LOG_DEBUG, ("MediaStreamGraph %p destroyed", this));
   }
 
   // Main thread only.
@@ -501,13 +509,18 @@ public:
    * LIFECYCLE_RUNNING, this can be relied on to not change unexpectedly.
    */
   bool mDetectedNotRunning;
   /**
    * True when a stable state runner has been posted to the appshell to run
    * RunInStableState at the next stable state.
    */
   bool mPostedRunInStableState;
+  /**
+   * True when processing real-time audio/video.  False when processing non-realtime
+   * audio.
+   */
+  bool mRealtime;
 };
 
 }
 
 #endif /* MEDIASTREAMGRAPHIMPL_H_ */
--- a/content/svg/content/src/SVGSVGElement.cpp
+++ b/content/svg/content/src/SVGSVGElement.cpp
@@ -701,19 +701,18 @@ SVGSVGElement::ChildrenOnlyTransformChan
   UpdateHasChildrenOnlyTransform();
 
   if (hadChildrenOnlyTransform != mHasChildrenOnlyTransform) {
     // Reconstruct the frame tree to handle stacking context changes:
     // XXXjwatt don't do this for root-<svg> or even outer-<svg>?
     changeHint = nsChangeHint_ReconstructFrame;
   } else {
     // We just assume the old and new transforms are different.
-    changeHint = nsChangeHint(nsChangeHint_RepaintFrame |
-                   nsChangeHint_UpdateOverflow |
-                   nsChangeHint_ChildrenOnlyTransform);
+    changeHint = nsChangeHint(nsChangeHint_UpdateOverflow |
+                              nsChangeHint_ChildrenOnlyTransform);
   }
 
   // If we're not reconstructing the frame tree, then we only call
   // PostRestyleEvent if we're not being called under reflow to avoid recursing
   // to death. See bug 767056 comments 10 and 12. Since our nsSVGOuterSVGFrame
   // is being reflowed we're going to invalidate and repaint its entire area
   // anyway (which will include our children).
   if ((changeHint & nsChangeHint_ReconstructFrame) ||
--- a/content/svg/content/src/nsSVGPathGeometryElement.cpp
+++ b/content/svg/content/src/nsSVGPathGeometryElement.cpp
@@ -1,14 +1,15 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "nsSVGPathGeometryElement.h"
+#include "nsSVGLength2.h"
 
 //----------------------------------------------------------------------
 // Implementation
 
 nsSVGPathGeometryElement::nsSVGPathGeometryElement(already_AddRefed<nsINodeInfo> aNodeInfo)
   : nsSVGPathGeometryElementBase(aNodeInfo)
 {
 }
@@ -23,16 +24,29 @@ nsSVGPathGeometryElement::AttributeDefin
       return true;
     }
   }
 
   return false;
 }
 
 bool
+nsSVGPathGeometryElement::GeometryDependsOnCoordCtx()
+{
+  // Check the nsSVGLength2 attribute
+  LengthAttributesInfo info = const_cast<nsSVGPathGeometryElement*>(this)->GetLengthInfo();
+  for (uint32_t i = 0; i < info.mLengthCount; i++) {
+    if (info.mLengths[i].GetSpecifiedUnitType() == nsIDOMSVGLength::SVG_LENGTHTYPE_PERCENTAGE) {
+      return true;
+    }   
+  }
+  return false;
+}
+
+bool
 nsSVGPathGeometryElement::IsMarkable()
 {
   return false;
 }
 
 void
 nsSVGPathGeometryElement::GetMarkPoints(nsTArray<nsSVGMark> *aMarks)
 {
--- a/content/svg/content/src/nsSVGPathGeometryElement.h
+++ b/content/svg/content/src/nsSVGPathGeometryElement.h
@@ -22,15 +22,27 @@ class gfxContext;
 typedef mozilla::dom::SVGGraphicsElement nsSVGPathGeometryElementBase;
 
 class nsSVGPathGeometryElement : public nsSVGPathGeometryElementBase
 {
 public:
   nsSVGPathGeometryElement(already_AddRefed<nsINodeInfo> aNodeInfo);
 
   virtual bool AttributeDefinesGeometry(const nsIAtom *aName);
+
+  /**
+   * Returns true if this element's geometry depends on the width or height of its
+   * coordinate context (typically the viewport established by its nearest <svg>
+   * ancestor). In other words, returns true if one of the attributes for which
+   * AttributeDefinesGeometry returns true has a percentage value.
+   *
+   * This could be moved up to a more general class so it can be used for non-leaf
+   * elements, but that would require care and for now there's no need.
+   */
+  bool GeometryDependsOnCoordCtx();
+
   virtual bool IsMarkable();
   virtual void GetMarkPoints(nsTArray<nsSVGMark> *aMarks);
   virtual void ConstructPath(gfxContext *aCtx) = 0;
   virtual already_AddRefed<gfxFlattenedPath> GetFlattenedPath(const gfxMatrix &aMatrix);
 };
 
 #endif
--- a/content/xul/content/src/nsXULElement.cpp
+++ b/content/xul/content/src/nsXULElement.cpp
@@ -2335,20 +2335,17 @@ nsXULPrototypeElement::Unlink()
 void
 nsXULPrototypeElement::TraceAllScripts(JSTracer* aTrc)
 {
     for (uint32_t i = 0; i < mChildren.Length(); ++i) {
         nsXULPrototypeNode* child = mChildren[i];
         if (child->mType == nsXULPrototypeNode::eType_Element) {
             static_cast<nsXULPrototypeElement*>(child)->TraceAllScripts(aTrc);
         } else if (child->mType == nsXULPrototypeNode::eType_Script) {
-            JSScript* script = static_cast<nsXULPrototypeScript*>(child)->GetScriptObject();
-            if (script) {
-                JS_CallScriptTracer(aTrc, script, "active window XUL prototype script");
-            }
+            static_cast<nsXULPrototypeScript*>(child)->TraceScriptObject(aTrc);
         }
     }
 }
 
 //----------------------------------------------------------------------
 //
 // nsXULPrototypeScript
 //
--- a/content/xul/content/src/nsXULElement.h
+++ b/content/xul/content/src/nsXULElement.h
@@ -236,16 +236,23 @@ public:
 
     void Set(JSScript* aObject);
 
     JSScript *GetScriptObject()
     {
         return mScriptObject;
     }
 
+    void TraceScriptObject(JSTracer* aTrc)
+    {
+        if (mScriptObject) {
+            JS_CallScriptTracer(aTrc, &mScriptObject, "active window XUL prototype script");
+        }
+    }
+
     nsCOMPtr<nsIURI>         mSrcURI;
     uint32_t                 mLineNo;
     bool                     mSrcLoading;
     bool                     mOutOfLine;
     mozilla::dom::XULDocument* mSrcLoadWaiters;   // [OWNER] but not COMPtr
     uint32_t                 mLangVersion;
 private:
     JSScript*                mScriptObject;
--- a/content/xul/document/src/nsXULPrototypeCache.cpp
+++ b/content/xul/document/src/nsXULPrototypeCache.cpp
@@ -655,17 +655,17 @@ nsXULPrototypeCache::MarkInCCGeneration(
     mXBLDocTable.Enumerate(MarkXBLInCCGeneration, &aGeneration);
     mPrototypeTable.Enumerate(MarkXULInCCGeneration, &aGeneration);
 }
 
 static PLDHashOperator
 MarkScriptsInGC(nsIURI* aKey, CacheScriptEntry& aScriptEntry, void* aClosure)
 {
     JSTracer* trc = static_cast<JSTracer*>(aClosure);
-    JS_CallScriptTracer(trc, aScriptEntry.mScriptObject,
+    JS_CallScriptTracer(trc, &aScriptEntry.mScriptObject,
                         "nsXULPrototypeCache script");
     return PL_DHASH_NEXT;
 }
 
 void
 nsXULPrototypeCache::MarkInGC(JSTracer* aTrc)
 {
     mScriptTable.Enumerate(MarkScriptsInGC, aTrc);
--- a/dom/base/nsGlobalWindow.cpp
+++ b/dom/base/nsGlobalWindow.cpp
@@ -1818,16 +1818,24 @@ nsGlobalWindow::GetContext()
 }
 
 JSObject *
 nsGlobalWindow::GetGlobalJSObject()
 {
   return FastGetGlobalJSObject();
 }
 
+void
+nsGlobalWindow::TraceGlobalJSObject(JSTracer* aTrc)
+{
+  if (mJSObject) {
+    JS_CallObjectTracer(aTrc, &mJSObject, "active window global");
+  }
+}
+
 bool
 nsGlobalWindow::WouldReuseInnerWindow(nsIDocument *aNewDocument)
 {
   // We reuse the inner window when:
   // a. We are currently at our original document.
   // b. At least one of the following conditions are true:
   // -- The new document is the same as the old document. This means that we're
   //    getting called from document.open().
--- a/dom/base/nsGlobalWindow.h
+++ b/dom/base/nsGlobalWindow.h
@@ -298,16 +298,17 @@ public:
   virtual JSObject *GetGlobalJSObject();
 
   // nsIScriptGlobalObject
   virtual nsIScriptContext *GetContext();
   JSObject *FastGetGlobalJSObject()
   {
     return mJSObject;
   }
+  void TraceGlobalJSObject(JSTracer* aTrc);
 
   virtual nsresult EnsureScriptEnvironment();
 
   virtual nsIScriptContext *GetScriptContext();
 
   void PoisonOuterWindowProxy(JSObject *aObject);
   virtual void OnFinalize(JSObject* aObject);
   virtual void SetScriptsEnabled(bool aEnabled, bool aFireTimeouts);
--- a/dom/base/nsWrapperCache.h
+++ b/dom/base/nsWrapperCache.h
@@ -5,16 +5,17 @@
 
 #ifndef nsWrapperCache_h___
 #define nsWrapperCache_h___
 
 #include "nsCycleCollectionParticipant.h"
 #include "mozilla/Assertions.h"
 #include "js/RootingAPI.h"
 
+struct JSTracer;
 class JSObject;
 struct JSContext;
 class XPCWrappedNativeScope;
 
 namespace mozilla {
 namespace dom {
 namespace workers {
 
@@ -184,16 +185,18 @@ private:
     return reinterpret_cast<JSObject*>(mWrapperPtrBits & ~kWrapperBitMask);
   }
   void SetWrapperBits(void *aWrapper)
   {
     mWrapperPtrBits = reinterpret_cast<uintptr_t>(aWrapper) |
                       (mWrapperPtrBits & WRAPPER_IS_DOM_BINDING);
   }
 
+  void TraceJSObjectFromBits(JSTracer *aTrc, const char *aName);
+
   /**
    * If this bit is set then we're preserving the wrapper, which in effect ties
    * the lifetime of the JS object stored in the cache to the lifetime of the
    * native object. We rely on the cycle collector to break the cycle that this
    * causes between the native object and the JS object, so it is important that
    * any native object that supports preserving of its wrapper
    * traces/traverses/unlinks the cached JS object (see
    * NS_IMPL_CYCLE_COLLECTION_TRACE_PRESERVED_WRAPPER,
--- a/dom/base/nsWrapperCacheInlines.h
+++ b/dom/base/nsWrapperCacheInlines.h
@@ -3,16 +3,17 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef nsWrapperCacheInline_h___
 #define nsWrapperCacheInline_h___
 
 #include "nsWrapperCache.h"
 #include "xpcpublic.h"
+#include "jsapi.h"
 
 // We want to encode 3 bits into mWrapperPtrBits, so anything we store in it
 // needs to be aligned on 8 byte boundaries.
 // JS arenas are aligned on 4k boundaries and padded so that the array of
 // JSObjects ends on the end of the arena. If the size of a JSObject is a
 // multiple of 8 then the start of every JSObject in an arena should be aligned
 // on 8 byte boundaries.
 MOZ_STATIC_ASSERT(sizeof(js::shadow::Object) % 8 == 0 && sizeof(JS::Value) == 8,
@@ -51,9 +52,15 @@ nsWrapperCache::IsBlackAndDoesNotNeedTra
     CallQueryInterface(aThis, &participant);
     bool hasGrayObjects = false;
     participant->Trace(aThis, SearchGray, &hasGrayObjects);
     return !hasGrayObjects;
   }
   return false;
 }
 
+inline void
+nsWrapperCache::TraceJSObjectFromBits(JSTracer* aTrc, const char* aName)
+{
+  JS_CallMaskedObjectTracer(aTrc, &mWrapperPtrBits, kWrapperBitMask, aName);
+}
+
 #endif /* nsWrapperCache_h___ */
--- a/dom/bindings/BindingUtils.cpp
+++ b/dom/bindings/BindingUtils.cpp
@@ -1626,16 +1626,17 @@ GetGlobalObject(JSContext* aCx, JSObject
 }
 
 GlobalObject::GlobalObject(JSContext* aCx, JSObject* aObject)
   : mGlobalJSObject(aCx)
 {
   Maybe<JSAutoCompartment> ac;
   mGlobalJSObject = GetGlobalObject<true>(aCx, aObject, ac);
   if (!mGlobalJSObject) {
+    mGlobalObject = nullptr;
     return;
   }
 
   JS::Value val;
   val.setObject(*mGlobalJSObject);
 
   // Switch this to UnwrapDOMObjectToISupports once our global objects are
   // using new bindings.
@@ -1712,24 +1713,28 @@ InterfaceHasInstance(JSContext* cx, JSHa
     *bp = false;
     return true;
   }
 
   JS::Rooted<JSObject*> instanceObject(cx, &vp.toObject());
   return InterfaceHasInstance(cx, obj, instanceObject, bp);
 }
 
-void
+bool
 ReportLenientThisUnwrappingFailure(JSContext* cx, JS::Handle<JSObject*> obj)
 {
   GlobalObject global(cx, obj);
+  if (global.Failed()) {
+    return false;
+  }
   nsCOMPtr<nsPIDOMWindow> window = do_QueryInterface(global.Get());
   if (window && window->GetDoc()) {
     window->GetDoc()->WarnOnceAbout(nsIDocument::eLenientThis);
   }
+  return true;
 }
 
 // Date implementation methods
 Date::Date() :
   mMsecSinceEpoch(MOZ_DOUBLE_NaN())
 {
 }
 
--- a/dom/bindings/BindingUtils.h
+++ b/dom/bindings/BindingUtils.h
@@ -251,19 +251,18 @@ inline void
 TraceProtoAndIfaceCache(JSTracer* trc, JSObject* obj)
 {
   MOZ_ASSERT(js::GetObjectClass(obj)->flags & JSCLASS_DOM_GLOBAL);
 
   if (!HasProtoAndIfaceArray(obj))
     return;
   JSObject** protoAndIfaceArray = GetProtoAndIfaceArray(obj);
   for (size_t i = 0; i < kProtoAndIfaceCacheCount; ++i) {
-    JSObject* proto = protoAndIfaceArray[i];
-    if (proto) {
-      JS_CallObjectTracer(trc, proto, "protoAndIfaceArray[i]");
+    if (protoAndIfaceArray[i]) {
+      JS_CallObjectTracer(trc, &protoAndIfaceArray[i], "protoAndIfaceArray[i]");
     }
   }
 }
 
 inline void
 DestroyProtoAndIfaceCache(JSObject* obj)
 {
   MOZ_ASSERT(js::GetObjectClass(obj)->flags & JSCLASS_DOM_GLOBAL);
@@ -1763,18 +1762,19 @@ ReparentWrapper(JSContext* aCx, JS::Hand
 JSBool
 InterfaceHasInstance(JSContext* cx, JS::Handle<JSObject*> obj,
                      JS::Handle<JSObject*> instance,
                      JSBool* bp);
 JSBool
 InterfaceHasInstance(JSContext* cx, JSHandleObject obj, JSMutableHandleValue vp,
                      JSBool* bp);
 
-// Helper for lenient getters/setters to report to console
-void
+// Helper for lenient getters/setters to report to console.  If this
+// returns false, we couldn't even get a global.
+bool
 ReportLenientThisUnwrappingFailure(JSContext* cx, JS::Handle<JSObject*> obj);
 
 inline JSObject*
 GetUnforgeableHolder(JSObject* aGlobal, prototypes::ID aId)
 {
   JSObject** protoAndIfaceArray = GetProtoAndIfaceArray(aGlobal);
   JSObject* interfaceProto = protoAndIfaceArray[aId];
   return &js::GetReservedSlot(interfaceProto,
--- a/dom/bindings/Codegen.py
+++ b/dom/bindings/Codegen.py
@@ -5005,17 +5005,19 @@ class CGGenericGetter(CGAbstractBindingM
     """
     def __init__(self, descriptor, lenientThis=False):
         args = [Argument('JSContext*', 'cx'), Argument('unsigned', 'argc'),
                 Argument('JS::Value*', 'vp')]
         if lenientThis:
             name = "genericLenientGetter"
             unwrapFailureCode = (
                 "MOZ_ASSERT(!JS_IsExceptionPending(cx));\n"
-                "ReportLenientThisUnwrappingFailure(cx, obj);\n"
+                "if (!ReportLenientThisUnwrappingFailure(cx, obj)) {\n"
+                "  return false;\n"
+                "}\n"
                 "JS_SET_RVAL(cx, vp, JS::UndefinedValue());\n"
                 "return true;")
         else:
             name = "genericGetter"
             unwrapFailureCode = None
         CGAbstractBindingMethod.__init__(self, descriptor, name, args,
                                          unwrapFailureCode)
 
@@ -5082,17 +5084,19 @@ class CGGenericSetter(CGAbstractBindingM
     """
     def __init__(self, descriptor, lenientThis=False):
         args = [Argument('JSContext*', 'cx'), Argument('unsigned', 'argc'),
                 Argument('JS::Value*', 'vp')]
         if lenientThis:
             name = "genericLenientSetter"
             unwrapFailureCode = (
                 "MOZ_ASSERT(!JS_IsExceptionPending(cx));\n"
-                "ReportLenientThisUnwrappingFailure(cx, obj);\n"
+                "if (!ReportLenientThisUnwrappingFailure(cx, obj)) {\n"
+                "  return false;\n"
+                "}\n"
                 "JS_SET_RVAL(cx, vp, JS::UndefinedValue());\n"
                 "return true;")
         else:
             name = "genericSetter"
             unwrapFailureCode = None
         CGAbstractBindingMethod.__init__(self, descriptor, name, args,
                                          unwrapFailureCode)
 
--- a/dom/camera/moz.build
+++ b/dom/camera/moz.build
@@ -19,13 +19,13 @@ XPIDL_FLAGS += [
 ]
 
 MODULE = 'dom'
 
 EXPORTS += [
     'CameraCommon.h',
     'CameraPreviewMediaStream.h',
     'DOMCameraManager.h',
+    'GonkCameraControl.h',
     'GonkNativeWindow.h',
     'GonkNativeWindowClient.h',
-    'GonkCameraControl.h',
 ]
 
--- a/dom/interfaces/events/nsIDOMAnimationEvent.idl
+++ b/dom/interfaces/events/nsIDOMAnimationEvent.idl
@@ -6,20 +6,14 @@
 #include "nsIDOMEvent.idl"
 
 /**
  * Animation events are defined in:
  * http://www.w3.org/TR/css3-animations/#animation-events-
  * http://dev.w3.org/csswg/css3-animations/#animation-events-
  */
 
-[scriptable, builtinclass, uuid(12626092-ee93-44d1-8ecd-160298f98b0f)]
+[scriptable, builtinclass, uuid(b1bea1bc-689b-4e07-8cbc-ef342725f9a6)]
 interface nsIDOMAnimationEvent : nsIDOMEvent {
   readonly attribute DOMString          animationName;
   readonly attribute float              elapsedTime;
   readonly attribute DOMString          pseudoElement;
-  void               initAnimationEvent(in DOMString typeArg,
-                                        in boolean canBubbleArg,
-                                        in boolean cancelableArg,
-                                        in DOMString propertyNameArg,
-                                        in float elapsedTimeArg,
-                                        [optional] in DOMString pseudoElementArg);
 };
--- a/dom/interfaces/events/nsIDOMTransitionEvent.idl
+++ b/dom/interfaces/events/nsIDOMTransitionEvent.idl
@@ -6,20 +6,14 @@
 #include "nsIDOMEvent.idl"
 
 /**
  * Transition events are defined in:
  * http://www.w3.org/TR/css3-transitions/#transition-events-
  * http://dev.w3.org/csswg/css3-transitions/#transition-events-
  */
 
-[scriptable, builtinclass, uuid(eca50ac5-087a-4e50-bdf6-b341f0f9f8ab)]
+[scriptable, builtinclass, uuid(a37171e0-9f43-41ea-a25c-0b78a3329683)]
 interface nsIDOMTransitionEvent : nsIDOMEvent {
   readonly attribute DOMString           propertyName;
   readonly attribute float               elapsedTime;
   readonly attribute DOMString           pseudoElement;
-  void               initTransitionEvent(in DOMString typeArg, 
-                                         in boolean canBubbleArg, 
-                                         in boolean cancelableArg, 
-                                         in DOMString propertyNameArg,
-                                         in float elapsedTimeArg,
-                                         [optional] in DOMString pseudoElement);
 };
--- a/dom/plugins/base/nsJSNPRuntime.cpp
+++ b/dom/plugins/base/nsJSNPRuntime.cpp
@@ -2167,23 +2167,24 @@ NPObjectMember_Trace(JSTracer *trc, JSOb
 {
   NPObjectMemberPrivate *memberPrivate =
     (NPObjectMemberPrivate *)::JS_GetPrivate(obj);
   if (!memberPrivate)
     return;
 
   // Our NPIdentifier is not always interned, so we must root it explicitly.
   jsid id = NPIdentifierToJSId(memberPrivate->methodName);
-  JS_CallIdTracer(trc, id, "NPObjectMemberPrivate.methodName");
+  JS_CallIdTracer(trc, &id, "NPObjectMemberPrivate.methodName");
+  memberPrivate->methodName = JSIdToNPIdentifier(id);
 
   if (!JSVAL_IS_PRIMITIVE(memberPrivate->fieldValue)) {
-    JS_CallValueTracer(trc, memberPrivate->fieldValue,
+    JS_CallValueTracer(trc, &memberPrivate->fieldValue,
                        "NPObject Member => fieldValue");
   }
 
   // There's no strong reference from our private data to the
   // NPObject, so make sure to mark the NPObject wrapper to keep the
   // NPObject alive as long as this NPObjectMember is alive.
   if (memberPrivate->npobjWrapper) {
-    JS_CallObjectTracer(trc, memberPrivate->npobjWrapper,
+    JS_CallObjectTracer(trc, &memberPrivate->npobjWrapper,
                         "NPObject Member => npobjWrapper");
   }
 }
--- a/dom/tests/browser/browser_ConsoleAPITests.js
+++ b/dom/tests/browser/browser_ConsoleAPITests.js
@@ -29,17 +29,17 @@ function test() {
       gTestDriver = observeConsoleTest();
       gTestDriver.next();
     });
 
   }, false);
 }
 
 function testConsoleData(aMessageObject) {
-  let messageWindow = getWindowByWindowId(aMessageObject.ID);
+  let messageWindow = Services.wm.getOuterWindowWithId(aMessageObject.ID);
   is(messageWindow, gWindow, "found correct window by window ID");
 
   is(aMessageObject.level, gLevel, "expected level received");
   ok(aMessageObject.arguments, "we have arguments");
 
   if (gLevel == "trace") {
     is(aMessageObject.arguments.length, 0, "arguments.length matches");
     is(aMessageObject.stacktrace.toSource(), gArgs.toSource(),
@@ -51,17 +51,17 @@ function testConsoleData(aMessageObject)
       is(aMessageObject.arguments[i], a, "correct arg " + i);
     });
   }
 
   gTestDriver.next();
 }
 
 function testLocationData(aMessageObject) {
-  let messageWindow = getWindowByWindowId(aMessageObject.ID);
+  let messageWindow = Services.wm.getOuterWindowWithId(aMessageObject.ID);
   is(messageWindow, gWindow, "found correct window by window ID");
 
   is(aMessageObject.level, gLevel, "expected level received");
   ok(aMessageObject.arguments, "we have arguments");
 
   is(aMessageObject.filename, gArgs[0].filename, "filename matches");
   is(aMessageObject.lineNumber, gArgs[0].lineNumber, "lineNumber matches");
   is(aMessageObject.functionName, gArgs[0].functionName, "functionName matches");
@@ -85,17 +85,17 @@ function startGroupTest() {
     }
   };
   let button = gWindow.document.getElementById("test-groups");
   ok(button, "found #test-groups button");
   EventUtils.synthesizeMouseAtCenter(button, {}, gWindow);
 }
 
 function testConsoleGroup(aMessageObject) {
-  let messageWindow = getWindowByWindowId(aMessageObject.ID);
+  let messageWindow = Services.wm.getOuterWindowWithId(aMessageObject.ID);
   is(messageWindow, gWindow, "found correct window by window ID");
 
   ok(aMessageObject.level == "group" ||
      aMessageObject.level == "groupCollapsed" ||
      aMessageObject.level == "groupEnd",
      "expected level received");
 
   is(aMessageObject.functionName, "testGroups", "functionName matches");
@@ -266,17 +266,17 @@ function startTimeTest() {
   ];
 
   let button = gWindow.document.getElementById("test-time");
   ok(button, "found #test-time button");
   EventUtils.synthesizeMouseAtCenter(button, {}, gWindow);
 }
 
 function testConsoleTime(aMessageObject) {
-  let messageWindow = getWindowByWindowId(aMessageObject.ID);
+  let messageWindow = Services.wm.getOuterWindowWithId(aMessageObject.ID);
   is(messageWindow, gWindow, "found correct window by window ID");
 
   is(aMessageObject.level, gLevel, "expected level received");
 
   is(aMessageObject.filename, gArgs[0].filename, "filename matches");
   is(aMessageObject.lineNumber, gArgs[0].lineNumber, "lineNumber matches");
   is(aMessageObject.functionName, gArgs[0].functionName, "functionName matches");
   is(aMessageObject.timer.name, gArgs[0].timer.name, "timer.name matches");
@@ -309,17 +309,17 @@ function startTimeEndTest() {
   ];
 
   let button = gWindow.document.getElementById("test-timeEnd");
   ok(button, "found #test-timeEnd button");
   EventUtils.synthesizeMouseAtCenter(button, {}, gWindow);
 }
 
 function testConsoleTimeEnd(aMessageObject) {
-  let messageWindow = getWindowByWindowId(aMessageObject.ID);
+  let messageWindow = Services.wm.getOuterWindowWithId(aMessageObject.ID);
   is(messageWindow, gWindow, "found correct window by window ID");
 
   is(aMessageObject.level, gLevel, "expected level received");
   ok(aMessageObject.arguments, "we have arguments");
 
   is(aMessageObject.filename, gArgs[0].filename, "filename matches");
   is(aMessageObject.lineNumber, gArgs[0].lineNumber, "lineNumber matches");
   is(aMessageObject.functionName, gArgs[0].functionName, "functionName matches");
@@ -349,17 +349,17 @@ function startEmptyTimerTest() {
   };
 
   let button = gWindow.document.getElementById("test-namelessTimer");
   ok(button, "found #test-namelessTimer button");
   EventUtils.synthesizeMouseAtCenter(button, {}, gWindow);
 }
 
 function testEmptyTimer(aMessageObject) {
-  let messageWindow = getWindowByWindowId(aMessageObject.ID);
+  let messageWindow = Services.wm.getOuterWindowWithId(aMessageObject.ID);
   is(messageWindow, gWindow, "found correct window by window ID");
 
   ok(aMessageObject.level == "time" || aMessageObject.level == "timeEnd",
      "expected level received");
   is(aMessageObject.arguments.length, 0, "we don't have arguments");
   ok(!aMessageObject.timer, "we don't have a timer");
 
   is(aMessageObject.functionName, "namelessTimer", "functionName matches");
@@ -393,18 +393,8 @@ var ConsoleObserver = {
 };
 
 function getWindowId(aWindow)
 {
   return aWindow.QueryInterface(Ci.nsIInterfaceRequestor)
                 .getInterface(Ci.nsIDOMWindowUtils)
                 .outerWindowID;
 }
-
-function getWindowByWindowId(aId) {
-  let someWindow = Services.wm.getMostRecentWindow("navigator:browser");
-  if (someWindow) {
-    let windowUtils = someWindow.QueryInterface(Ci.nsIInterfaceRequestor)
-                                .getInterface(Ci.nsIDOMWindowUtils);
-    return windowUtils.getOuterWindowWithId(aId);
-  }
-  return null;
-}
--- a/dom/webidl/AnimationEvent.webidl
+++ b/dom/webidl/AnimationEvent.webidl
@@ -18,20 +18,8 @@ interface AnimationEvent : Event {
   readonly attribute DOMString pseudoElement;
 };
 
 dictionary AnimationEventInit : EventInit {
   DOMString animationName = "";
   float elapsedTime = 0;
   DOMString pseudoElement = "";
 };
-
-// initAnimationEvent is a legacy method, and removed from the latest version
-// of the specification.
-partial interface AnimationEvent {
-  [Throws]
-  void initAnimationEvent(DOMString type,
-                          boolean canBubble,
-                          boolean cancelable,
-                          DOMString animationName,
-                          float elapsedTime,
-                          optional DOMString pseudoElement);
-};
--- a/dom/webidl/TransitionEvent.webidl
+++ b/dom/webidl/TransitionEvent.webidl
@@ -18,20 +18,8 @@ interface TransitionEvent : Event {
   readonly attribute DOMString pseudoElement;
 };
 
 dictionary TransitionEventInit : EventInit {
   DOMString propertyName = "";
   float elapsedTime = 0;
   DOMString pseudoElement = "";
 };
-
-// initTransitionEvent is a legacy method, and removed from the latest version
-// of the specification.
-partial interface TransitionEvent {
-  [Throws]
-  void initTransitionEvent(DOMString aType,
-                           boolean aCanBubble,
-                           boolean aCancelable,
-                           DOMString aPropertyName,
-                           float aElapsedTime,
-                           optional DOMString pseudoElement);
-};
--- a/dom/workers/DOMBindingBase.cpp
+++ b/dom/workers/DOMBindingBase.cpp
@@ -34,20 +34,17 @@ NS_IMPL_RELEASE(DOMBindingBase)
 NS_INTERFACE_MAP_BEGIN(DOMBindingBase)
   NS_INTERFACE_MAP_ENTRY(nsISupports)
   NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
 NS_INTERFACE_MAP_END
 
 void
 DOMBindingBase::_trace(JSTracer* aTrc)
 {
-  JSObject* obj = GetJSObject();
-  if (obj) {
-    JS_CallObjectTracer(aTrc, obj, "cached wrapper");
-  }
+  TraceJSObject(aTrc, "cached wrapper");
 }
 
 void
 DOMBindingBase::_finalize(JSFreeOp* aFop)
 {
   ClearWrapper();
   NS_RELEASE_THIS();
 }
--- a/dom/workers/DOMBindingBase.h
+++ b/dom/workers/DOMBindingBase.h
@@ -41,16 +41,23 @@ protected:
   _finalize(JSFreeOp* aFop);
 
 public:
   NS_DECL_ISUPPORTS
 
   JSContext*
   GetJSContext() const;
 
+  void
+  TraceJSObject(JSTracer* aTrc, const char* aName)
+  {
+      if (GetJSObject())
+          TraceJSObjectFromBits(aTrc, aName);
+  }
+
 #ifdef DEBUG
   JSObject*
   GetJSObject() const;
 
   void
   SetJSObject(JSObject* aObject);
 #else
   JSObject*
--- a/dom/workers/EventListenerManager.cpp
+++ b/dom/workers/EventListenerManager.cpp
@@ -180,17 +180,17 @@ EventListenerManager::TraceInternal(JSTr
   for (const ListenerCollection* collection = mCollections.getFirst();
        collection;
        collection = collection->getNext()) {
 
     for (const ListenerData* listenerElem = collection->mListeners.getFirst();
          listenerElem;
          listenerElem = listenerElem->getNext()) {
       JS_CallObjectTracer(aTrc,
-                          listenerElem->mListener,
+                          &const_cast<ListenerData*>(listenerElem)->mListener,
                           "EventListenerManager listener object");
     }
   }
 }
 
 void
 EventListenerManager::FinalizeInternal(JSFreeOp* aFop)
 {
--- a/dom/workers/ScriptLoader.cpp
+++ b/dom/workers/ScriptLoader.cpp
@@ -628,17 +628,17 @@ ScriptExecutorRunnable::WorkerRun(JSCont
     NS_ASSERTION(!loadInfo.mChannel, "Should no longer have a channel!");
     NS_ASSERTION(loadInfo.mExecutionScheduled, "Should be scheduled!");
 
     if (!loadInfo.mExecutionResult) {
       return true;
     }
   }
 
-  JS::RootedObject global(aCx, JS_GetGlobalObject(aCx));
+  JS::RootedObject global(aCx, JS_GetGlobalForScopeChain(aCx));
   NS_ASSERTION(global, "Must have a global by now!");
 
   JSPrincipals* principal = GetWorkerPrincipal();
   NS_ASSERTION(principal, "This should never be null!");
 
   for (uint32_t index = mFirstIndex; index <= mLastIndex; index++) {
     ScriptLoadInfo& loadInfo = loadInfos.ElementAt(index);
 
--- a/dom/workers/WorkerPrivate.cpp
+++ b/dom/workers/WorkerPrivate.cpp
@@ -699,34 +699,32 @@ public:
   {
     JS::Rooted<JSObject*> global(aCx, CreateDedicatedWorkerGlobalScope(aCx));
     if (!global) {
       NS_WARNING("Failed to make global!");
       return false;
     }
 
     JSAutoCompartment ac(aCx, global);
-    JS_SetGlobalObject(aCx, global);
-
     return scriptloader::LoadWorkerScript(aCx);
   }
 };
 
 class CloseEventRunnable : public WorkerRunnable
 {
 public:
   CloseEventRunnable(WorkerPrivate* aWorkerPrivate)
   : WorkerRunnable(aWorkerPrivate, WorkerThread, UnchangedBusyCount,
                    SkipWhenClearing)
   { }
 
   bool
   WorkerRun(JSContext* aCx, WorkerPrivate* aWorkerPrivate)
   {
-    JS::Rooted<JSObject*> target(aCx, JS_GetGlobalObject(aCx));
+    JS::Rooted<JSObject*> target(aCx, JS_GetGlobalForScopeChain(aCx));
     NS_ASSERTION(target, "This must never be null!");
 
     aWorkerPrivate->CloseHandlerStarted();
 
     JSString* type = JS_InternString(aCx, "close");
     if (!type) {
       return false;
     }
@@ -805,17 +803,17 @@ public:
       }
 
       aWorkerPrivate->AssertInnerWindowIsCorrect();
     }
     else {
       NS_ASSERTION(aWorkerPrivate == GetWorkerPrivateFromContext(aCx),
                    "Badness!");
       mainRuntime = false;
-      target = JS_GetGlobalObject(aCx);
+      target = JS_GetGlobalForScopeChain(aCx);
     }
 
     NS_ASSERTION(target, "This should never be null!");
 
     JSObject* event =
       CreateMessageEvent(aCx, buffer, mClonedObjects, mainRuntime);
     if (!event) {
       return false;
@@ -1520,17 +1518,17 @@ WorkerRunnable::Dispatch(JSContext* aCx)
       ok = DispatchInternal();
     }
     PostDispatch(nullptr, mWorkerPrivate, ok);
     return ok;
   }
 
   JSAutoRequest ar(aCx);
 
-  JSObject* global = JS_GetGlobalObject(aCx);
+  JSObject* global = JS_GetGlobalForScopeChain(aCx);
 
   Maybe<JSAutoCompartment> ac;
   if (global) {
     ac.construct(aCx, global);
   }
 
   ok = PreDispatch(aCx, mWorkerPrivate);
 
@@ -1617,17 +1615,17 @@ WorkerRunnable::Run()
       AssertIsOnMainThread();
       pusher.Push(cx);
     }
   }
 
   JS::Rooted<JSObject*> targetCompartmentObject(cx);
 
   if (mTarget == WorkerThread) {
-    targetCompartmentObject = JS_GetGlobalObject(cx);
+    targetCompartmentObject = JS_GetGlobalForScopeChain(cx);
   } else {
     targetCompartmentObject = mWorkerPrivate->GetJSObject();
   }
 
   NS_ASSERTION(cx, "Must have a context!");
 
   JSAutoRequest ar(cx);
 
@@ -3255,20 +3253,20 @@ WorkerPrivate::ResumeInternal(JSContext*
 
 void
 WorkerPrivate::TraceInternal(JSTracer* aTrc)
 {
   AssertIsOnWorkerThread();
 
   for (uint32_t index = 0; index < mTimeouts.Length(); index++) {
     TimeoutInfo* info = mTimeouts[index];
-    JS_CallValueTracer(aTrc, info->mTimeoutVal,
+    JS_CallValueTracer(aTrc, &info->mTimeoutVal,
                        "WorkerPrivate timeout value");
     for (uint32_t index2 = 0; index2 < info->mExtraArgVals.Length(); index2++) {
-      JS_CallValueTracer(aTrc, info->mExtraArgVals[index2],
+      JS_CallValueTracer(aTrc, &info->mExtraArgVals[index2],
                          "WorkerPrivate timeout extra argument value");
     }
   }
 }
 
 bool
 WorkerPrivate::ModifyBusyCountFromWorker(JSContext* aCx, bool aIncrease)
 {
@@ -3594,17 +3592,17 @@ WorkerPrivate::NotifyInternal(JSContext*
 
   // If we've run the close handler, we don't need to do anything else.
   if (mCloseHandlerFinished) {
     return true;
   }
 
   // If the worker script never ran, or failed to compile, we don't need to do
   // anything else, except pretend that we ran the close handler.
-  if (!JS_GetGlobalObject(aCx)) {
+  if (!JS_GetGlobalForScopeChain(aCx)) {
     mCloseHandlerStarted = true;
     mCloseHandlerFinished = true;
     return true;
   }
 
   // If this is the first time our status has changed we also need to schedule
   // the close handler unless we're being shut down.
   if (previousStatus == Running && aStatus != Killing) {
@@ -3919,17 +3917,17 @@ WorkerPrivate::RunExpiredTimeouts(JSCont
   }
 
   NS_ASSERTION(mTimer, "Must have a timer!");
   NS_ASSERTION(!mTimeouts.IsEmpty(), "Should have some work to do!");
 
   bool retval = true;
 
   AutoPtrComparator<TimeoutInfo> comparator = GetAutoPtrComparator(mTimeouts);
-  JS::RootedObject global(aCx, JS_GetGlobalObject(aCx));
+  JS::RootedObject global(aCx, JS_GetGlobalForScopeChain(aCx));
   JSPrincipals* principal = GetWorkerPrincipal();
 
   // We want to make sure to run *something*, even if the timer fired a little
   // early. Fudge the value of now to at least include the first timeout.
   const TimeStamp now = std::max(TimeStamp::Now(), mTimeouts[0]->mTargetTime);
 
   nsAutoTArray<TimeoutInfo*, 10> expiredTimeouts;
   for (uint32_t index = 0; index < mTimeouts.Length(); index++) {
--- a/dom/workers/WorkerScope.cpp
+++ b/dom/workers/WorkerScope.cpp
@@ -123,17 +123,17 @@ protected:
   {
     MOZ_COUNT_DTOR(mozilla::dom::workers::WorkerGlobalScope);
   }
 
   virtual void
   _trace(JSTracer* aTrc) MOZ_OVERRIDE
   {
     for (int32_t i = 0; i < SLOT_COUNT; i++) {
-      JS_CallValueTracer(aTrc, mSlots[i], "WorkerGlobalScope instance slot");
+      JS_CallValueTracer(aTrc, &mSlots[i], "WorkerGlobalScope instance slot");
     }
     mWorker->TraceInternal(aTrc);
     EventTarget::_trace(aTrc);
   }
 
   virtual void
   _finalize(JSFreeOp* aFop) MOZ_OVERRIDE
   {
@@ -350,17 +350,17 @@ private:
 
     if (JSVAL_IS_PRIMITIVE(aVp)) {
       JS_ReportError(aCx, "Not an event listener!");
       return false;
     }
 
     JSFunction* adaptor =
       js::NewFunctionWithReserved(aCx, UnwrapErrorEvent, 1, 0,
-                                  JS_GetGlobalObject(aCx), "unwrap");
+                                  JS_GetGlobalForScopeChain(aCx), "unwrap");
     if (!adaptor) {
       return false;
     }
 
     JSObject* listener = JS_GetFunctionObject(adaptor);
     if (!listener) {
       return false;
     }
--- a/dom/workers/XMLHttpRequest.cpp
+++ b/dom/workers/XMLHttpRequest.cpp
@@ -1416,19 +1416,19 @@ XMLHttpRequest::~XMLHttpRequest()
   mWorkerPrivate->AssertIsOnWorkerThread();
   MOZ_ASSERT(!mJSObjectRooted);
 }
 
 void
 XMLHttpRequest::_trace(JSTracer* aTrc)
 {
   if (mUpload) {
-    JS_CallObjectTracer(aTrc, mUpload->GetJSObject(), "mUpload");
+    mUpload->TraceJSObject(aTrc, "mUpload");
   }
-  JS_CallValueTracer(aTrc, mStateData.mResponse, "mResponse");
+  JS_CallValueTracer(aTrc, &mStateData.mResponse, "mResponse");
   XMLHttpRequestEventTarget::_trace(aTrc);
 }
 
 void
 XMLHttpRequest::_finalize(JSFreeOp* aFop)
 {
   ReleaseProxy(XHRIsGoingAway);
   XMLHttpRequestEventTarget::_finalize(aFop);
--- a/dom/workers/XMLHttpRequestUpload.cpp
+++ b/dom/workers/XMLHttpRequestUpload.cpp
@@ -18,17 +18,17 @@ XMLHttpRequestUpload::Create(JSContext* 
   nsRefPtr<XMLHttpRequestUpload> upload = new XMLHttpRequestUpload(aCx, aXHR);
   return Wrap(aCx, NULL, upload) ? upload : NULL;
 }
 
 void
 XMLHttpRequestUpload::_trace(JSTracer* aTrc)
 {
   if (mXHR) {
-    JS_CallObjectTracer(aTrc, mXHR->GetJSObject(), "mXHR");
+    mXHR->TraceJSObject(aTrc, "mXHR");
   }
   XMLHttpRequestEventTarget::_trace(aTrc);
 }
 
 void
 XMLHttpRequestUpload::_finalize(JSFreeOp* aFop)
 {
   XMLHttpRequestEventTarget::_finalize(aFop);
--- a/editor/txmgr/src/nsTransactionStack.cpp
+++ b/editor/txmgr/src/nsTransactionStack.cpp
@@ -7,94 +7,90 @@
 #include "nsCOMPtr.h"
 #include "nsCycleCollectionParticipant.h"
 #include "nsISupportsUtils.h"
 #include "nsTransactionItem.h"
 #include "nsTransactionStack.h"
 #include "nscore.h"
 
 nsTransactionStack::nsTransactionStack(nsTransactionStack::Type aType)
-  : mQue(0)
-  , mType(aType)
+  : mType(aType)
 {
 }
 
 nsTransactionStack::~nsTransactionStack()
 {
   Clear();
 }
 
 void
 nsTransactionStack::Push(nsTransactionItem *aTransaction)
 {
   if (!aTransaction) {
     return;
   }
 
-  /* nsDeque's Push() method adds new items at the back
-   * of the deque.
-   */
-  NS_ADDREF(aTransaction);
-  mQue.Push(aTransaction);
+  // The stack's bottom is the front of the deque, and the top is the back.
+  mDeque.push_back(aTransaction);
 }
 
 already_AddRefed<nsTransactionItem>
 nsTransactionStack::Pop()
 {
-  /* nsDeque is a FIFO, so the top of our stack is actually
-   * the back of the deque.
-   */
-  return static_cast<nsTransactionItem*> (mQue.Pop());
+  if (mDeque.empty()) {
+    return nullptr;
+  }
+  nsRefPtr<nsTransactionItem> ret = mDeque.back().forget();
+  mDeque.pop_back();
+  return ret.forget();
 }
 
 already_AddRefed<nsTransactionItem>
 nsTransactionStack::PopBottom()
 {
-  /* nsDeque is a FIFO, so the bottom of our stack is actually
-   * the front of the deque.
-   */
-  return static_cast<nsTransactionItem*> (mQue.PopFront());
+  if (mDeque.empty()) {
+    return nullptr;
+  }
+  nsRefPtr<nsTransactionItem> ret = mDeque.front().forget();
+  mDeque.pop_front();
+  return ret.forget();
 }
 
 already_AddRefed<nsTransactionItem>
 nsTransactionStack::Peek()
 {
-  nsRefPtr<nsTransactionItem> transaction;
-  if (mQue.GetSize()) {
-    transaction = static_cast<nsTransactionItem*>(mQue.Last());
+  if (mDeque.empty()) {
+    return nullptr;
   }
-
-  return transaction.forget();
+  nsRefPtr<nsTransactionItem> ret = mDeque.back();
+  return ret.forget();
 }
 
 already_AddRefed<nsTransactionItem>
 nsTransactionStack::GetItem(int32_t aIndex)
 {
-  nsRefPtr<nsTransactionItem> transaction;
-  if (aIndex >= 0 && aIndex < mQue.GetSize()) {
-    transaction = static_cast<nsTransactionItem*>(mQue.ObjectAt(aIndex));
+  if (aIndex < 0 || aIndex >= static_cast<int32_t>(mDeque.size())) {
+    return nullptr;
   }
-
-  return transaction.forget();
+  nsRefPtr<nsTransactionItem> ret = mDeque[aIndex];
+  return ret.forget();
 }
 
 void
 nsTransactionStack::Clear()
 {
-  nsRefPtr<nsTransactionItem> tx;
-
-  do {
-    tx = mType == FOR_UNDO ? Pop() : PopBottom();
-  } while (tx);
+  while (!mDeque.empty()) {
+    nsRefPtr<nsTransactionItem> tx = mType == FOR_UNDO ? Pop() : PopBottom();
+  };
 }
 
 void
 nsTransactionStack::DoTraverse(nsCycleCollectionTraversalCallback &cb)
 {
-  for (int32_t i = 0, qcount = mQue.GetSize(); i < qcount; ++i) {
-    nsTransactionItem *item =
-      static_cast<nsTransactionItem*>(mQue.ObjectAt(i));
+  int32_t size = mDeque.size();
+  for (int32_t i = 0; i < size; ++i) {
+    nsTransactionItem* item = mDeque[i];
     if (item) {
-      NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "transaction stack mQue[i]");
+      NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "transaction stack mDeque[i]");
       cb.NoteNativeChild(item, NS_CYCLE_COLLECTION_PARTICIPANT(nsTransactionItem));
     }
   }
 }
--- a/editor/txmgr/src/nsTransactionStack.h
+++ b/editor/txmgr/src/nsTransactionStack.h
@@ -1,18 +1,18 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef nsTransactionStack_h__
 #define nsTransactionStack_h__
 
-#include "nsCOMPtr.h"
-#include "nsDeque.h"
+#include <deque>
+#include "nsAutoPtr.h"
 
 class nsCycleCollectionTraversalCallback;
 class nsTransactionItem;
 
 class nsTransactionStack
 {
 public:
   enum Type { FOR_UNDO, FOR_REDO };
@@ -21,19 +21,19 @@ public:
   ~nsTransactionStack();
 
   void Push(nsTransactionItem *aTransactionItem);
   already_AddRefed<nsTransactionItem> Pop();
   already_AddRefed<nsTransactionItem> PopBottom();
   already_AddRefed<nsTransactionItem> Peek();
   already_AddRefed<nsTransactionItem> GetItem(int32_t aIndex);
   void Clear();
-  int32_t GetSize() { return mQue.GetSize(); }
+  int32_t GetSize() { return mDeque.size(); }
 
   void DoUnlink() { Clear(); }
   void DoTraverse(nsCycleCollectionTraversalCallback &cb);
 
 private:
-  nsDeque mQue;
+  std::deque<nsRefPtr<nsTransactionItem> > mDeque;
   const Type mType;
 };
 
 #endif // nsTransactionStack_h__
--- a/gfx/2d/moz.build
+++ b/gfx/2d/moz.build
@@ -22,11 +22,11 @@ EXPORTS.mozilla.gfx += [
     'Scale.h',
     'Tools.h',
     'Types.h',
     'UserData.h',
 ]
 
 if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa':
     EXPORTS.mozilla.gfx += [
+        'MacIOSurface.h',
         'QuartzSupport.h',
-        'MacIOSurface.h',
     ]
--- a/gfx/layers/LayersTypes.h
+++ b/gfx/layers/LayersTypes.h
@@ -32,17 +32,16 @@ class SurfaceDescriptor;
 typedef uint32_t TextureFlags;
 
 enum LayersBackend {
   LAYERS_NONE = 0,
   LAYERS_BASIC,
   LAYERS_OPENGL,
   LAYERS_D3D9,
   LAYERS_D3D10,
-  LAYERS_D3D11,
   LAYERS_CLIENT,
   LAYERS_LAST
 };
 
 enum BufferMode {
   BUFFER_NONE,
   BUFFER_BUFFERED
 };
--- a/gfx/layers/Makefile.in
+++ b/gfx/layers/Makefile.in
@@ -9,17 +9,16 @@ srcdir      = @srcdir@
 VPATH       = \
   $(srcdir) \
   $(srcdir)/basic \
   $(srcdir)/client \
   $(srcdir)/composite \
   $(srcdir)/opengl \
   $(srcdir)/d3d9 \
   $(srcdir)/d3d10 \
-  $(srcdir)/d3d11 \
   $(srcdir)/ipc \
   $(NULL)
 
 include $(DEPTH)/config/autoconf.mk
 
 LIBRARY_NAME   = layers
 LIBXUL_LIBRARY = 1
 FORCE_STATIC_LIB = 1
@@ -93,23 +92,21 @@ CPPSRCS += \
         DeviceManagerD3D9.cpp \
         Nv3DVUtils.cpp \
         $(NULL)
 endif
 ifdef MOZ_ENABLE_D3D10_LAYER
 CPPSRCS += \
         CanvasLayerD3D10.cpp \
         ColorLayerD3D10.cpp \
-        CompositorD3D11.cpp \
         ContainerLayerD3D10.cpp \
         ImageLayerD3D10.cpp \
         LayerManagerD3D10.cpp \
         ReadbackManagerD3D10.cpp \
         ShadowLayerUtilsD3D10.cpp \
-        TextureD3D11.cpp \
         ThebesLayerD3D10.cpp \
         $(NULL)
 endif
 endif
 
 CPPSRCS += \
         AsyncCompositionManager.cpp \
         AsyncPanZoomController.cpp \
--- a/gfx/layers/client/CompositableClient.cpp
+++ b/gfx/layers/client/CompositableClient.cpp
@@ -3,20 +3,16 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "mozilla/layers/CompositableClient.h"
 #include "mozilla/layers/TextureClient.h"
 #include "mozilla/layers/TextureClientOGL.h"
 #include "mozilla/layers/LayerTransactionChild.h"
 #include "mozilla/layers/CompositableForwarder.h"
-#ifdef XP_WIN
-#include "mozilla/layers/TextureD3D11.h"
-#include "gfxWindowsPlatform.h"
-#endif
 
 namespace mozilla {
 namespace layers {
 
 CompositableClient::~CompositableClient()
 {
   MOZ_COUNT_DTOR(CompositableClient);
   Destroy();
@@ -95,30 +91,27 @@ CompositableClient::CreateTextureClient(
     }
     break;
   case TEXTURE_STREAM_GL:
     if (parentBackend == LAYERS_OPENGL) {
       result = new TextureClientStreamOGL(GetForwarder(), GetTextureInfo());
     }
     break;
   case TEXTURE_YCBCR:
-    if (parentBackend == LAYERS_OPENGL || parentBackend == LAYERS_D3D11) {
+    if (parentBackend == LAYERS_OPENGL) {
       result = new TextureClientShmemYCbCr(GetForwarder(), GetTextureInfo());
     }
     break;
   case TEXTURE_CONTENT:
-#ifdef XP_WIN
-    if (parentBackend == LAYERS_D3D11 && gfxWindowsPlatform::GetPlatform()->GetD2DDevice()) {
-      result = new TextureClientD3D11(GetForwarder(), GetTextureInfo());
-      break;
-    }
-#endif
      // fall through to TEXTURE_SHMEM
   case TEXTURE_SHMEM:
-    result = new TextureClientShmem(GetForwarder(), GetTextureInfo());
+    if (parentBackend == LAYERS_OPENGL ||
+        parentBackend == LAYERS_BASIC) {
+      result = new TextureClientShmem(GetForwarder(), GetTextureInfo());
+    }
     break;
   default:
     MOZ_ASSERT(false, "Unhandled texture client type");
   }
 
   // If we couldn't create an appropriate texture client,
   // then return nullptr so the caller can chose another
   // type.
--- a/gfx/layers/client/ContentClient.cpp
+++ b/gfx/layers/client/ContentClient.cpp
@@ -5,47 +5,32 @@
 
 #include "mozilla/layers/ContentClient.h"
 #include "mozilla/gfx/2D.h"
 #include "BasicThebesLayer.h"
 #include "nsIWidget.h"
 #include "gfxUtils.h"
 #include "gfxPlatform.h"
 #include "mozilla/layers/LayerManagerComposite.h"
-#ifdef XP_WIN
-#include "gfxWindowsPlatform.h"
-#endif
 
 namespace mozilla {
 
 using namespace gfx;
 
 namespace layers {
 
 /* static */ TemporaryRef<ContentClient>
 ContentClient::CreateContentClient(CompositableForwarder* aForwarder)
 {
   if (aForwarder->GetCompositorBackendType() != LAYERS_OPENGL &&
-      aForwarder->GetCompositorBackendType() != LAYERS_D3D11 &&
       aForwarder->GetCompositorBackendType() != LAYERS_BASIC) {
-        return nullptr;
+    return nullptr;
   }
-
-  bool useDoubleBuffering = false;
-
-#ifdef XP_WIN
-  if (aForwarder->GetCompositorBackendType() == LAYERS_D3D11) {
-    useDoubleBuffering = !!gfxWindowsPlatform::GetPlatform()->GetD2DDevice();
-  } else
-#endif
-  {
-    useDoubleBuffering = LayerManagerComposite::SupportsDirectTexturing();
-  }
-
-  if (useDoubleBuffering || PR_GetEnv("MOZ_FORCE_DOUBLE_BUFFERING")) {
+  if (LayerManagerComposite::SupportsDirectTexturing() ||
+      PR_GetEnv("MOZ_FORCE_DOUBLE_BUFFERING")) {
     return new ContentClientDoubleBuffered(aForwarder);
   }
   return new ContentClientSingleBuffered(aForwarder);
 }
 
 ContentClientBasic::ContentClientBasic(CompositableForwarder* aForwarder,
                                        BasicLayerManager* aManager)
 : ContentClient(aForwarder), mManager(aManager)
--- a/gfx/layers/client/ImageClient.cpp
+++ b/gfx/layers/client/ImageClient.cpp
@@ -23,23 +23,29 @@ namespace layers {
 /* static */ TemporaryRef<ImageClient>
 ImageClient::CreateImageClient(CompositableType aCompositableHostType,
                                CompositableForwarder* aForwarder,
                                TextureFlags aFlags)
 {
   RefPtr<ImageClient> result = nullptr;
   switch (aCompositableHostType) {
   case BUFFER_IMAGE_SINGLE:
-    result = new ImageClientSingle(aForwarder, aFlags, BUFFER_IMAGE_SINGLE);
+    if (ImageClientSingle::SupportsBackend(aForwarder->GetCompositorBackendType())) {
+      result = new ImageClientSingle(aForwarder, aFlags, BUFFER_IMAGE_SINGLE);
+    }
     break;
   case BUFFER_IMAGE_BUFFERED:
-    result = new ImageClientSingle(aForwarder, aFlags, BUFFER_IMAGE_BUFFERED);
+    if (ImageClientSingle::SupportsBackend(aForwarder->GetCompositorBackendType())) {
+      result = new ImageClientSingle(aForwarder, aFlags, BUFFER_IMAGE_BUFFERED);
+    }
     break;
   case BUFFER_BRIDGE:
-    result = new ImageClientBridge(aForwarder, aFlags);
+    if (ImageClientBridge::SupportsBackend(aForwarder->GetCompositorBackendType())) {
+      result = new ImageClientBridge(aForwarder, aFlags);
+    }
     break;
   case BUFFER_UNKNOWN:
     result = nullptr;
     break;
   default:
     MOZ_NOT_REACHED("unhandled program type");
   }
 
@@ -213,16 +219,36 @@ ImageClientSingle::UpdateImage(ImageCont
 }
 
 void
 ImageClientSingle::Updated()
 {
   mForwarder->UpdateTexture(this, 1, mTextureClient->GetDescriptor());
 }
 
+bool
+ImageClientSingle::SupportsBackend(LayersBackend aBackend)
+{
+  if (aBackend == LAYERS_OPENGL ||
+      aBackend == LAYERS_BASIC) {
+    return true;
+  }
+  return false;
+}
+
+bool
+ImageClientBridge::SupportsBackend(LayersBackend aBackend)
+{
+  if (aBackend == LAYERS_OPENGL ||
+      aBackend == LAYERS_BASIC) {
+    return true;
+  }
+  return false;
+}
+
 ImageClientBridge::ImageClientBridge(CompositableForwarder* aFwd,
                                      TextureFlags aFlags)
 : ImageClient(aFwd, BUFFER_BRIDGE)
 , mAsyncContainerID(0)
 , mLayer(nullptr)
 {
 }
 
--- a/gfx/layers/client/ImageClient.h
+++ b/gfx/layers/client/ImageClient.h
@@ -97,16 +97,18 @@ public:
     mTextureClient->SetDescriptorFromReply(aDescriptor);
   }
 
   virtual TextureInfo GetTextureInfo() const MOZ_OVERRIDE
   {
     return mTextureInfo;
   }
 
+  static bool SupportsBackend(LayersBackend aBackend);
+
 private:
   RefPtr<TextureClient> mTextureClient;
   TextureInfo mTextureInfo;
 };
 
 /**
  * Image class to be used for async image uploads using the image bridge
  * protocol.
@@ -126,16 +128,18 @@ public:
     mLayer = aLayer;
   }
 
   virtual TextureInfo GetTextureInfo() const MOZ_OVERRIDE
   {
     return TextureInfo(mType);
   }
 
+  static bool SupportsBackend(LayersBackend aBackend);
+
 protected:
   uint64_t mAsyncContainerID;
   ShadowableLayer* mLayer;
 };
 
 }
 }
 
--- a/gfx/layers/composite/TextureHost.cpp
+++ b/gfx/layers/composite/TextureHost.cpp
@@ -23,42 +23,30 @@ TemporaryRef<TextureHost> CreateBasicTex
 TemporaryRef<TextureHost> CreateTextureHostD3D9(SurfaceDescriptorType aDescriptorType,
                                                 uint32_t aTextureHostFlags,
                                                 uint32_t aTextureFlags)
 {
   NS_RUNTIMEABORT("not implemented");
   return nullptr;
 }
 
-#ifdef XP_WIN
-TemporaryRef<TextureHost> CreateTextureHostD3D11(SurfaceDescriptorType aDescriptorType,
-                                                 uint32_t aTextureHostFlags,
-                                                 uint32_t aTextureFlags);
-#endif
-
 /* static */ TemporaryRef<TextureHost>
 TextureHost::CreateTextureHost(SurfaceDescriptorType aDescriptorType,
                                uint32_t aTextureHostFlags,
                                uint32_t aTextureFlags)
 {
   switch (Compositor::GetBackend()) {
     case LAYERS_OPENGL:
       return CreateTextureHostOGL(aDescriptorType,
                                   aTextureHostFlags,
                                   aTextureFlags);
     case LAYERS_D3D9:
       return CreateTextureHostD3D9(aDescriptorType,
                                    aTextureHostFlags,
                                    aTextureFlags);
-#ifdef XP_WIN
-    case LAYERS_D3D11:
-      return CreateTextureHostD3D11(aDescriptorType,
-                                    aTextureHostFlags,
-                                    aTextureFlags);
-#endif
     case LAYERS_BASIC:
       return CreateBasicTextureHost(aDescriptorType,
                                     aTextureHostFlags,
                                     aTextureFlags);
     default:
       MOZ_NOT_REACHED("Couldn't create texture host");
       return nullptr;
   }
--- a/gfx/layers/composite/TextureHost.h
+++ b/gfx/layers/composite/TextureHost.h
@@ -20,17 +20,16 @@ class gfxImageSurface;
 
 namespace mozilla {
 namespace layers {
 
 class Compositor;
 class SurfaceDescriptor;
 class ISurfaceAllocator;
 class TextureSourceOGL;
-class TextureSourceD3D11;
 class TextureSourceBasic;
 class TextureParent;
 
 /**
  * A view on a TextureHost where the texture is internally represented as tiles
  * (contrast with a tiled buffer, where each texture is a tile). For iteration by
  * the texture's buffer host.
  * This is only useful when the underlying surface is too big to fit in one
@@ -74,21 +73,16 @@ public:
    * size of the current tile.
    */
   virtual gfx::IntSize GetSize() const = 0;
   /**
    * Cast to an TextureSource for the OpenGL backend.
    */
   virtual TextureSourceOGL* AsSourceOGL() { return nullptr; }
 
-  /**
-   * Cast to an TextureSource for the D3D11 backend.
-   */
-  virtual TextureSourceD3D11* AsSourceD3D11() { return nullptr; }
-
   virtual TextureSourceBasic* AsSourceBasic() { return nullptr; }
 
   /**
    * In some rare cases we currently need to consider a group of textures as one
    * TextureSource, that can be split in sub-TextureSources.
    */
   virtual TextureSource* GetSubSource(int index) { return nullptr; }
   /**
deleted file mode 100644
--- a/gfx/layers/d3d11/CompositorD3D11.cpp
+++ /dev/null
@@ -1,782 +0,0 @@
-/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*-
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#include "CompositorD3D11.h"
-
-#include "TextureD3D11.h"
-#include "CompositorD3D11Shaders.h"
-
-#include "gfxWindowsPlatform.h"
-#include "nsIWidget.h"
-#include "mozilla/layers/ImageHost.h"
-#include "mozilla/layers/ContentHost.h"
-#include "mozilla/layers/Effects.h"
-#include "nsWindowsHelpers.h"
-
-#ifdef MOZ_METRO
-#include <DXGI1_2.h>
-#endif
-
-namespace mozilla {
-
-using namespace gfx;
-
-namespace layers {
-
-struct Vertex
-{
-    float position[2];
-};
-
-// {1E4D7BEB-D8EC-4A0B-BF0A-63E6DE129425}
-static const GUID sDeviceAttachmentsD3D11 =
-{ 0x1e4d7beb, 0xd8ec, 0x4a0b, { 0xbf, 0xa, 0x63, 0xe6, 0xde, 0x12, 0x94, 0x25 } };
-// {88041664-C835-4AA8-ACB8-7EC832357ED8}
-static const GUID sLayerManagerCount =
-{ 0x88041664, 0xc835, 0x4aa8, { 0xac, 0xb8, 0x7e, 0xc8, 0x32, 0x35, 0x7e, 0xd8 } };
-
-const FLOAT sBlendFactor[] = { 0, 0, 0, 0 };
-
-struct DeviceAttachmentsD3D11
-{
-  RefPtr<ID3D11InputLayout> mInputLayout;
-  RefPtr<ID3D11Buffer> mVertexBuffer;
-  RefPtr<ID3D11VertexShader> mVSQuadShader[3];
-  RefPtr<ID3D11PixelShader> mSolidColorShader[2];
-  RefPtr<ID3D11PixelShader> mRGBAShader[3];
-  RefPtr<ID3D11PixelShader> mRGBShader[2];
-  RefPtr<ID3D11PixelShader> mYCbCrShader[2];
-  RefPtr<ID3D11Buffer> mPSConstantBuffer;
-  RefPtr<ID3D11Buffer> mVSConstantBuffer;
-  RefPtr<ID3D11RasterizerState> mRasterizerState;
-  RefPtr<ID3D11SamplerState> mLinearSamplerState;
-  RefPtr<ID3D11SamplerState> mPointSamplerState;
-  RefPtr<ID3D11BlendState> mPremulBlendState;
-  RefPtr<ID3D11BlendState> mNonPremulBlendState;
-};
-
-CompositorD3D11::CompositorD3D11(nsIWidget *aWidget)
-  : mWidget(aWidget)
-  , mAttachments(nullptr)
-{
-  sBackend = LAYERS_D3D11;
-}
-
-CompositorD3D11::~CompositorD3D11()
-{
-  if (mDevice) {
-    int referenceCount = 0;
-    UINT size = sizeof(referenceCount);
-    HRESULT hr = mDevice->GetPrivateData(sLayerManagerCount, &size, &referenceCount);
-    NS_ASSERTION(SUCCEEDED(hr), "Reference count not found on device.");
-    referenceCount--;
-    mDevice->SetPrivateData(sLayerManagerCount, sizeof(referenceCount), &referenceCount);
-
-    if (!referenceCount) {
-      DeviceAttachmentsD3D11 *attachments;
-      size = sizeof(attachments);
-      mDevice->GetPrivateData(sDeviceAttachmentsD3D11, &size, &attachments);
-      // No LayerManagers left for this device. Clear out interfaces stored which
-      // hold a reference to the device.
-      mDevice->SetPrivateData(sDeviceAttachmentsD3D11, 0, NULL);
-
-      delete attachments;
-    }
-  }
-}
-
-bool
-CompositorD3D11::Initialize()
-{
-  HRESULT hr;
-
-  mDevice = gfxWindowsPlatform::GetPlatform()->GetD3D11Device();
-
-  if (!mDevice) {
-    return false;
-  }
-
-  mDevice->GetImmediateContext(byRef(mContext));
-
-  if (!mContext) {
-    return false;
-  }
-
-  memset(&mVSConstants, 0, sizeof(VertexShaderConstants));
-
-  int referenceCount = 0;
-  UINT size = sizeof(referenceCount);
-  // If this isn't there yet it'll fail, count will remain 0, which is correct.
-  mDevice->GetPrivateData(sLayerManagerCount, &size, &referenceCount);
-  referenceCount++;
-  mDevice->SetPrivateData(sLayerManagerCount, sizeof(referenceCount), &referenceCount);
-
-  size = sizeof(DeviceAttachmentsD3D11*);
-  if (FAILED(mDevice->GetPrivateData(sDeviceAttachmentsD3D11, &size, &mAttachments))) {
-    mAttachments = new DeviceAttachmentsD3D11;
-    mDevice->SetPrivateData(sDeviceAttachmentsD3D11, sizeof(mAttachments), &mAttachments);
-
-    D3D11_INPUT_ELEMENT_DESC layout[] =
-    {
-      { "POSITION", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0 },
-    };
-
-    hr = mDevice->CreateInputLayout(layout,
-                                    sizeof(layout) / sizeof(D3D11_INPUT_ELEMENT_DESC),
-                                    LayerQuadVS,
-                                    sizeof(LayerQuadVS),
-                                    byRef(mAttachments->mInputLayout));
-
-    if (FAILED(hr)) {
-      return false;
-    }
-
-    Vertex vertices[] = { {0.0, 0.0}, {1.0, 0.0}, {0.0, 1.0}, {1.0, 1.0} };
-    CD3D11_BUFFER_DESC bufferDesc(sizeof(vertices), D3D11_BIND_VERTEX_BUFFER);
-    D3D11_SUBRESOURCE_DATA data;
-    data.pSysMem = (void*)vertices;
-
-    hr = mDevice->CreateBuffer(&bufferDesc, &data, byRef(mAttachments->mVertexBuffer));
-
-    if (FAILED(hr)) {
-      return false;
-    }
-
-    if (!CreateShaders()) {
-      return false;
-    }
-
-    CD3D11_BUFFER_DESC cBufferDesc(sizeof(VertexShaderConstants), D3D11_BIND_CONSTANT_BUFFER,
-                                   D3D11_USAGE_DYNAMIC, D3D11_CPU_ACCESS_WRITE);
-
-    hr = mDevice->CreateBuffer(&cBufferDesc, nullptr, byRef(mAttachments->mVSConstantBuffer));
-    if (FAILED(hr)) {
-      return false;
-    }
-
-    cBufferDesc.ByteWidth = sizeof(PixelShaderConstants);
-    hr = mDevice->CreateBuffer(&cBufferDesc, nullptr, byRef(mAttachments->mPSConstantBuffer));
-    if (FAILED(hr)) {
-      return false;
-    }
-
-    CD3D11_RASTERIZER_DESC rastDesc(D3D11_DEFAULT);
-    rastDesc.CullMode = D3D11_CULL_NONE;
-    rastDesc.ScissorEnable = TRUE;
-
-    hr = mDevice->CreateRasterizerState(&rastDesc, byRef(mAttachments->mRasterizerState));
-    if (FAILED(hr)) {
-      return false;
-    }
-
-    CD3D11_SAMPLER_DESC samplerDesc(D3D11_DEFAULT);
-    samplerDesc.AddressU = samplerDesc.AddressV = D3D11_TEXTURE_ADDRESS_WRAP;
-    hr = mDevice->CreateSamplerState(&samplerDesc, byRef(mAttachments->mLinearSamplerState));
-    if (FAILED(hr)) {
-      return false;
-    }
-
-    samplerDesc.Filter = D3D11_FILTER_MIN_MAG_MIP_POINT;
-    hr = mDevice->CreateSamplerState(&samplerDesc, byRef(mAttachments->mPointSamplerState));
-    if (FAILED(hr)) {
-      return false;
-    }
-
-    CD3D11_BLEND_DESC blendDesc(D3D11_DEFAULT);
-    D3D11_RENDER_TARGET_BLEND_DESC rtBlendPremul = {
-      TRUE,
-      D3D11_BLEND_ONE, D3D11_BLEND_INV_SRC_ALPHA, D3D11_BLEND_OP_ADD,
-      D3D11_BLEND_ONE, D3D11_BLEND_INV_SRC_ALPHA, D3D11_BLEND_OP_ADD,
-      D3D11_COLOR_WRITE_ENABLE_ALL
-    };
-    blendDesc.RenderTarget[0] = rtBlendPremul;
-    hr = mDevice->CreateBlendState(&blendDesc, byRef(mAttachments->mPremulBlendState));
-    if (FAILED(hr)) {
-      return false;
-    }
-
-    D3D11_RENDER_TARGET_BLEND_DESC rtBlendNonPremul = {
-      TRUE,
-      D3D11_BLEND_SRC_ALPHA, D3D11_BLEND_INV_SRC_ALPHA, D3D11_BLEND_OP_ADD,
-      D3D11_BLEND_ONE, D3D11_BLEND_INV_SRC_ALPHA, D3D11_BLEND_OP_ADD,
-      D3D11_COLOR_WRITE_ENABLE_ALL
-    };
-    blendDesc.RenderTarget[0] = rtBlendNonPremul;
-    hr = mDevice->CreateBlendState(&blendDesc, byRef(mAttachments->mNonPremulBlendState));
-    if (FAILED(hr)) {
-      return false;
-    }
-  }
-
-  nsRefPtr<IDXGIDevice> dxgiDevice;
-  nsRefPtr<IDXGIAdapter> dxgiAdapter;
-
-  mDevice->QueryInterface(dxgiDevice.StartAssignment());
-  dxgiDevice->GetAdapter(getter_AddRefs(dxgiAdapter));
-
-#ifdef MOZ_METRO
-  if (IsRunningInWindowsMetro()) {
-    nsRefPtr<IDXGIFactory2> dxgiFactory;
-    dxgiAdapter->GetParent(IID_PPV_ARGS(dxgiFactory.StartAssignment()));
-
-    nsIntRect rect;
-    mWidget->GetClientBounds(rect);
-
-    DXGI_SWAP_CHAIN_DESC1 swapDesc = { 0 };
-    // Automatically detect the width and the height from the winrt CoreWindow
-    swapDesc.Width = rect.width;
-    swapDesc.Height = rect.height;
-    // This is the most common swapchain format
-    swapDesc.Format = DXGI_FORMAT_B8G8R8A8_UNORM;
-    swapDesc.Stereo = false;
-    // Don't use multi-sampling
-    swapDesc.SampleDesc.Count = 1;
-    swapDesc.SampleDesc.Quality = 0;
-    swapDesc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
-    // Use double buffering to enable flip
-    swapDesc.BufferCount = 2;
-    swapDesc.Scaling = DXGI_SCALING_STRETCH;
-    // All Metro style apps must use this SwapEffect
-    swapDesc.SwapEffect = DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL;
-    swapDesc.Flags = 0;
-
-    /**
-     * Create a swap chain, this swap chain will contain the backbuffer for
-     * the window we draw to. The front buffer is the full screen front
-     * buffer.
-    */
-    nsRefPtr<IDXGISwapChain1> swapChain1;
-    hr = dxgiFactory->CreateSwapChainForCoreWindow(
-           dxgiDevice, (IUnknown *)mWidget->GetNativeData(NS_NATIVE_ICOREWINDOW),
-           &swapDesc, nullptr, getter_AddRefs(swapChain1));
-    if (FAILED(hr)) {
-        return false;
-    }
-    mSwapChain = swapChain1;
-  } else
-#endif
-  {
-    nsRefPtr<IDXGIFactory> dxgiFactory;
-    dxgiAdapter->GetParent(IID_PPV_ARGS(dxgiFactory.StartAssignment()));
-
-    DXGI_SWAP_CHAIN_DESC swapDesc;
-    ::ZeroMemory(&swapDesc, sizeof(swapDesc));
-    swapDesc.BufferDesc.Width = 0;
-    swapDesc.BufferDesc.Height = 0;
-    swapDesc.BufferDesc.Format = DXGI_FORMAT_B8G8R8A8_UNORM;
-    swapDesc.BufferDesc.RefreshRate.Numerator = 60;
-    swapDesc.BufferDesc.RefreshRate.Denominator = 1;
-    swapDesc.SampleDesc.Count = 1;
-    swapDesc.SampleDesc.Quality = 0;
-    swapDesc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
-    swapDesc.BufferCount = 1;
-    swapDesc.OutputWindow = (HWND)mWidget->GetNativeData(NS_NATIVE_WINDOW);
-    swapDesc.Windowed = TRUE;
-    // We don't really need this flag, however it seems on some NVidia hardware
-    // smaller area windows do not present properly without this flag. This flag
-    // should have no negative consequences by itself. See bug 613790. This flag
-    // is broken on optimus devices. As a temporary solution we don't set it
-    // there, the only way of reliably detecting we're on optimus is looking for
-    // the DLL. See Bug 623807.
-    if (gfxWindowsPlatform::IsOptimus()) {
-      swapDesc.Flags = 0;
-    } else {
-      swapDesc.Flags = DXGI_SWAP_CHAIN_FLAG_GDI_COMPATIBLE;
-    }
-
-    /**
-     * Create a swap chain, this swap chain will contain the backbuffer for
-     * the window we draw to. The front buffer is the full screen front
-     * buffer.
-     */
-    hr = dxgiFactory->CreateSwapChain(dxgiDevice, &swapDesc, byRef(mSwapChain));
-    if (FAILED(hr)) {
-     return false;
-    }
-
-    // We need this because we don't want DXGI to respond to Alt+Enter.
-    dxgiFactory->MakeWindowAssociation(swapDesc.OutputWindow, DXGI_MWA_NO_WINDOW_CHANGES);
-  }
-
-  return true;
-}
-
-TextureFactoryIdentifier
-CompositorD3D11::GetTextureFactoryIdentifier()
-{
-  TextureFactoryIdentifier ident;
-  ident.mMaxTextureSize = GetMaxTextureSize();
-  ident.mParentBackend = LAYERS_D3D11;
-  return ident;
-}
-
-bool
-CompositorD3D11::CanUseCanvasLayerForSize(const gfxIntSize &aSize)
-{
-  int32_t maxTextureSize = GetMaxTextureSize();
-
-  if (aSize.width > maxTextureSize || aSize.height > maxTextureSize) {
-    return false;
-  }
-
-  return true;
-}
-
-int32_t
-CompositorD3D11::GetMaxTextureSize() const
-{
-  return GetMaxTextureSizeForFeatureLevel(mFeatureLevel);
-}
-
-TemporaryRef<CompositingRenderTarget>
-CompositorD3D11::CreateRenderTarget(const gfx::IntRect &aRect,
-                                    SurfaceInitMode aInit)
-{
-  CD3D11_TEXTURE2D_DESC desc(DXGI_FORMAT_B8G8R8A8_UNORM, aRect.width, aRect.height, 1, 1,
-                             D3D11_BIND_SHADER_RESOURCE | D3D11_BIND_RENDER_TARGET);
-
-  RefPtr<ID3D11Texture2D> texture;
-  mDevice->CreateTexture2D(&desc, NULL, byRef(texture));
-
-  RefPtr<CompositingRenderTargetD3D11> rt = new CompositingRenderTargetD3D11(texture);
-  rt->SetSize(IntSize(aRect.width, aRect.height));
-
-  if (aInit == INIT_MODE_CLEAR) {
-    FLOAT clear[] = { 0, 0, 0, 0 };
-    mContext->ClearRenderTargetView(rt->mRTView, clear);
-  }
-
-  return rt;
-}
-
-// TODO[Bas] this method doesn't actually use aSource
-TemporaryRef<CompositingRenderTarget>
-CompositorD3D11::CreateRenderTargetFromSource(const gfx::IntRect &aRect,
-                                              const CompositingRenderTarget *aSource)
-{
-  CD3D11_TEXTURE2D_DESC desc(DXGI_FORMAT_B8G8R8A8_UNORM, aRect.width, aRect.height, 1, 1,
-                             D3D11_BIND_SHADER_RESOURCE | D3D11_BIND_RENDER_TARGET);
-
-  RefPtr<ID3D11Texture2D> texture;
-  mDevice->CreateTexture2D(&desc, NULL, byRef(texture));
-
-  RefPtr<CompositingRenderTargetD3D11> rt = new CompositingRenderTargetD3D11(texture);
-  rt->SetSize(IntSize(aRect.width, aRect.height));
-
-  return rt;
-}
-
-void
-CompositorD3D11::SetRenderTarget(CompositingRenderTarget *aRenderTarget)
-{
-  MOZ_ASSERT(aRenderTarget);
-  CompositingRenderTargetD3D11 *newRT =
-    static_cast<CompositingRenderTargetD3D11*>(aRenderTarget);
-  ID3D11RenderTargetView *view = newRT->mRTView;
-  mCurrentRT = newRT;
-  mContext->OMSetRenderTargets(1, &view, nullptr);
-  PrepareViewport(newRT->GetSize(), gfxMatrix());
-}
-
-void
-CompositorD3D11::SetPSForEffect(Effect *aEffect, MaskMode aMaskMode)
-{
-  switch (aEffect->mType) {
-  case EFFECT_SOLID_COLOR:
-    mContext->PSSetShader(mAttachments->mSolidColorShader[aMaskMode], nullptr, 0);
-    return;
-  case EFFECT_BGRA:
-  case EFFECT_RENDER_TARGET:
-    mContext->PSSetShader(mAttachments->mRGBAShader[aMaskMode], nullptr, 0);
-    return;
-  case EFFECT_BGRX:
-    mContext->PSSetShader(mAttachments->mRGBShader[aMaskMode], nullptr, 0);
-    return;
-  case EFFECT_YCBCR:
-    mContext->PSSetShader(mAttachments->mYCbCrShader[aMaskMode], nullptr, 0);
-    return;
-  }
-}
-
-void
-CompositorD3D11::DrawQuad(const gfx::Rect &aRect, const gfx::Rect &aClipRect,
-                          const EffectChain &aEffectChain,
-                          gfx::Float aOpacity, const gfx::Matrix4x4 &aTransform,
-                          const gfx::Point &aOffset)
-{
-  MOZ_ASSERT(mCurrentRT, "No render target");
-  memcpy(&mVSConstants.layerTransform, &aTransform._11, 64);
-  mVSConstants.renderTargetOffset[0] = aOffset.x;
-  mVSConstants.renderTargetOffset[1] = aOffset.y;
-  mVSConstants.layerQuad = aRect;
-
-  mPSConstants.layerOpacity[0] = aOpacity;
-
-  bool isPremultiplied = true;
-
-  MaskMode maskMode = UNMASKED;
-
-  if (aEffectChain.mSecondaryEffects[EFFECT_MASK]) {
-    if (aTransform.Is2D()) {
-      maskMode = MASKED;
-    } else {
-      MOZ_ASSERT(aEffectChain.mPrimaryEffect->mType == EFFECT_BGRA);
-      maskMode = MASKED3D;
-    }
-
-    EffectMask *maskEffect = static_cast<EffectMask*>(aEffectChain.mSecondaryEffects[EFFECT_MASK].get());
-    TextureSourceD3D11 *source = maskEffect->mMaskTexture->AsSourceD3D11();
-
-    RefPtr<ID3D11ShaderResourceView> view;
-    mDevice->CreateShaderResourceView(source->GetD3D11Texture(), nullptr, byRef(view));
-
-    ID3D11ShaderResourceView *srView = view;
-    mContext->PSSetShaderResources(3, 1, &srView);
-
-    const gfx::Matrix4x4& maskTransform = maskEffect->mMaskTransform;
-    NS_ASSERTION(maskTransform.Is2D(), "How did we end up with a 3D transform here?!");
-    Rect bounds = Rect(Point(), Size(maskEffect->mSize));
-
-    mVSConstants.maskQuad = maskTransform.As2D().TransformBounds(bounds);
-  }
-
-
-  D3D11_RECT scissor;
-  scissor.left = aClipRect.x;
-  scissor.right = aClipRect.XMost();
-  scissor.top = aClipRect.y;
-  scissor.bottom = aClipRect.YMost();
-  mContext->RSSetScissorRects(1, &scissor);
-  mContext->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP);
-  mContext->VSSetShader(mAttachments->mVSQuadShader[maskMode], nullptr, 0);
-
-  SetPSForEffect(aEffectChain.mPrimaryEffect, maskMode);
-
-  switch (aEffectChain.mPrimaryEffect->mType) {
-  case EFFECT_SOLID_COLOR: {
-      Color color =
-        static_cast<EffectSolidColor*>(aEffectChain.mPrimaryEffect.get())->mColor;
-      mPSConstants.layerColor[0] = color.r * color.a * aOpacity;
-      mPSConstants.layerColor[1] = color.g * color.a * aOpacity;
-      mPSConstants.layerColor[2] = color.b * color.a * aOpacity;
-      mPSConstants.layerColor[3] = color.a * aOpacity;
-    }
-    break;
-  case EFFECT_BGRX:
-  case EFFECT_BGRA:
-  case EFFECT_RENDER_TARGET:
-    {
-      TexturedEffect *texturedEffect = static_cast<TexturedEffect*>(aEffectChain.mPrimaryEffect.get());
-
-      mVSConstants.textureCoords = texturedEffect->mTextureCoords;
-
-      TextureSourceD3D11 *source = texturedEffect->mTexture->AsSourceD3D11();
-
-      RefPtr<ID3D11ShaderResourceView> view;
-      mDevice->CreateShaderResourceView(source->GetD3D11Texture(), nullptr, byRef(view));
-
-      ID3D11ShaderResourceView *srView = view;
-      mContext->PSSetShaderResources(0, 1, &srView);
-
-      isPremultiplied = texturedEffect->mPremultiplied;
-
-      SetSamplerForFilter(texturedEffect->mFilter);
-    }
-    break;
-  case EFFECT_YCBCR: {
-      EffectYCbCr *ycbcrEffect = static_cast<EffectYCbCr*>(aEffectChain.mPrimaryEffect.get());
-
-      SetSamplerForFilter(FILTER_LINEAR);
-
-      mVSConstants.textureCoords = ycbcrEffect->mTextureCoords;
-
-      TextureSourceD3D11 *source = ycbcrEffect->mTexture->AsSourceD3D11();
-      TextureSourceD3D11::YCbCrTextures textures = source->GetYCbCrTextures();
-
-      RefPtr<ID3D11ShaderResourceView> views[3];
-      mDevice->CreateShaderResourceView(textures.mY, nullptr, byRef(views[0]));
-      mDevice->CreateShaderResourceView(textures.mCb, nullptr, byRef(views[1]));
-      mDevice->CreateShaderResourceView(textures.mCr, nullptr, byRef(views[2]));
-
-      ID3D11ShaderResourceView *srViews[3] = { views[0], views[1], views[2] };
-      mContext->PSSetShaderResources(0, 3, srViews);
-    }
-    break;
-  default:
-    return;
-  }
-  UpdateConstantBuffers();
-
-  if (!isPremultiplied) {
-    mContext->OMSetBlendState(mAttachments->mNonPremulBlendState, sBlendFactor, 0xFFFFFFFF);
-  }
-  mContext->Draw(4, 0);
-  if (!isPremultiplied) {
-    mContext->OMSetBlendState(mAttachments->mPremulBlendState, sBlendFactor, 0xFFFFFFFF);
-  }
-}
-
-void
-CompositorD3D11::BeginFrame(const Rect *aClipRectIn,
-                            const gfxMatrix& aTransform,
-                            const Rect& aRenderBounds,
-                            Rect *aClipRectOut,
-                            Rect *aRenderBoundsOut)
-{
-  VerifyBufferSize();
-  UpdateRenderTarget();
-
-  nsIntRect rect;
-  mWidget->GetClientBounds(rect);
-
-  if (rect.IsEmpty()) {
-    *aRenderBoundsOut = Rect();
-    return;
-  }
-
-  mDefaultRT->SetSize(IntSize(rect.width, rect.height));
-
-  mContext->IASetInputLayout(mAttachments->mInputLayout);
-
-  ID3D11Buffer *buffer = mAttachments->mVertexBuffer;
-  UINT size = sizeof(Vertex);
-  UINT offset = 0;
-  mContext->IASetVertexBuffers(0, 1, &buffer, &size, &offset);
-  SetRenderTarget(mDefaultRT);
-
-  if (aClipRectOut) {
-    *aClipRectOut = Rect(0, 0, rect.width, rect.height);
-  }
-  if (aRenderBoundsOut) {
-    *aRenderBoundsOut = Rect(0, 0, rect.width, rect.height);
-  }
-
-  FLOAT black[] = { 0, 0, 0, 0 };
-  mContext->ClearRenderTargetView(mDefaultRT->mRTView, black);
-
-  mContext->OMSetBlendState(mAttachments->mPremulBlendState, sBlendFactor, 0xFFFFFFFF);
-  mContext->RSSetState(mAttachments->mRasterizerState);
-}
-
-void
-CompositorD3D11::EndFrame()
-{
-  mContext->Flush();
-  mSwapChain->Present(0, 0);
-
-  if (mTarget) {
-    PaintToTarget();
-  }
-  mCurrentRT = nullptr;
-}
-
-void
-CompositorD3D11::PrepareViewport(const gfx::IntSize& aSize,
-                                 const gfxMatrix &aWorldTransform)
-{
-  D3D11_VIEWPORT viewport;
-  viewport.MaxDepth = 1.0f;
-  viewport.MinDepth = 0;
-  viewport.Width = aSize.width;
-  viewport.Height = aSize.height;
-  viewport.TopLeftX = 0;
-  viewport.TopLeftY = 0;
-
-  mContext->RSSetViewports(1, &viewport);
-
-  gfxMatrix viewMatrix;
-  viewMatrix.Translate(-gfxPoint(1.0, -1.0));
-  viewMatrix.Scale(2.0f / float(aSize.width), 2.0f / float(aSize.height));
-  viewMatrix.Scale(1.0f, -1.0f);
-
-  viewMatrix = aWorldTransform * viewMatrix;
-
-  gfx3DMatrix projection = gfx3DMatrix::From2D(viewMatrix);
-  projection._33 = 0.0f;
-
-  memcpy(&mVSConstants.projection, &projection, sizeof(mVSConstants.projection));
-}
-
-const nsIntSize&
-CompositorD3D11::GetWidgetSize()
-{
-  nsIntRect rect;
-  mWidget->GetClientBounds(rect);
-
-  mSize = rect.Size();
-
-  return mSize;
-}
-
-void
-CompositorD3D11::VerifyBufferSize()
-{
-  nsIntRect rect;
-  mWidget->GetClientBounds(rect);
-
-  DXGI_SWAP_CHAIN_DESC swapDesc;
-  mSwapChain->GetDesc(&swapDesc);
-
-  if ((swapDesc.BufferDesc.Width == rect.width &&
-      swapDesc.BufferDesc.Height == rect.height) || rect.IsEmpty()) {
-    return;
-  }
-
-  mDefaultRT = nullptr;
-
-  if (gfxWindowsPlatform::IsOptimus()) {
-    mSwapChain->ResizeBuffers(1, rect.width, rect.height,
-                              DXGI_FORMAT_B8G8R8A8_UNORM,
-                              0);
-  } else if (IsRunningInWindowsMetro()) {
-    mSwapChain->ResizeBuffers(2, rect.width, rect.height,
-                              DXGI_FORMAT_B8G8R8A8_UNORM,
-                              0);
-  } else {
-    mSwapChain->ResizeBuffers(1, rect.width, rect.height,
-                              DXGI_FORMAT_B8G8R8A8_UNORM,
-                              DXGI_SWAP_CHAIN_FLAG_GDI_COMPATIBLE);
-  }
-}
-
-void
-CompositorD3D11::UpdateRenderTarget()
-{
-  if (mDefaultRT) {
-    return;
-  }
-
-  HRESULT hr;
-
-  nsRefPtr<ID3D11Texture2D> backBuf;
-
-  hr = mSwapChain->GetBuffer(0, __uuidof(ID3D11Texture2D), (void**)backBuf.StartAssignment());
-  if (FAILED(hr)) {
-    return;
-  }
-
-  mDefaultRT = new CompositingRenderTargetD3D11(nullptr);
-  mDevice->CreateRenderTargetView(backBuf, NULL, byRef(mDefaultRT->mRTView));
-}
-
-bool
-CompositorD3D11::CreateShaders()
-{
-  HRESULT hr;
-
-
-  hr = mDevice->CreateVertexShader(LayerQuadVS, sizeof(LayerQuadVS), nullptr, byRef(mAttachments->mVSQuadShader[UNMASKED]));
-  if (FAILED(hr)) {
-    return false;
-  }
-
-  hr = mDevice->CreateVertexShader(LayerQuadMaskVS, sizeof(LayerQuadMaskVS), nullptr, byRef(mAttachments->mVSQuadShader[MASKED]));
-  if (FAILED(hr)) {
-    return false;
-  }
-
-  hr = mDevice->CreateVertexShader(LayerQuadMask3DVS, sizeof(LayerQuadMask3DVS), nullptr, byRef(mAttachments->mVSQuadShader[MASKED3D]));
-  if (FAILED(hr)) {
-    return false;
-  }
-
-#define LOAD_PIXEL_SHADER(x) hr = mDevice->CreatePixelShader(x, sizeof(x), nullptr, byRef(mAttachments->m##x[UNMASKED])); \
-  if (FAILED(hr)) { \
-    return false; \
-  } \
-  hr = mDevice->CreatePixelShader(x##Mask, sizeof(x##Mask), nullptr, byRef(mAttachments->m##x[MASKED])); \
-  if (FAILED(hr)) { \
-    return false; \
-  }
-
-  LOAD_PIXEL_SHADER(SolidColorShader);
-  LOAD_PIXEL_SHADER(RGBShader);
-  LOAD_PIXEL_SHADER(RGBAShader);
-  LOAD_PIXEL_SHADER(YCbCrShader);
-
-#undef LOAD_PIXEL_SHADER
-
-  hr = mDevice->CreatePixelShader(RGBAShaderMask3D, sizeof(RGBAShaderMask3D), nullptr, byRef(mAttachments->mRGBAShader[MASKED3D]));
-  if (FAILED(hr)) {
-    return false;
-  }
-
-  return true;
-}
-
-void
-CompositorD3D11::UpdateConstantBuffers()
-{
-  D3D11_MAPPED_SUBRESOURCE resource;
-  mContext->Map(mAttachments->mVSConstantBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &resource);
-  *(VertexShaderConstants*)resource.pData = mVSConstants;
-  mContext->Unmap(mAttachments->mVSConstantBuffer, 0);
-  mContext->Map(mAttachments->mPSConstantBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &resource);
-  *(PixelShaderConstants*)resource.pData = mPSConstants;
-  mContext->Unmap(mAttachments->mPSConstantBuffer, 0);
-
-  ID3D11Buffer *buffer = mAttachments->mVSConstantBuffer;
-
-  mContext->VSSetConstantBuffers(0, 1, &buffer);
-
-  buffer = mAttachments->mPSConstantBuffer;
-  mContext->PSSetConstantBuffers(0, 1, &buffer);
-}
-
-void
-CompositorD3D11::SetSamplerForFilter(Filter aFilter)
-{
-  ID3D11SamplerState *sampler;
-  switch (aFilter) {
-  case FILTER_LINEAR:
-    sampler = mAttachments->mLinearSamplerState;
-    break;
-  case FILTER_POINT:
-    sampler = mAttachments->mPointSamplerState;
-    break;
-  }
-
-  mContext->PSSetSamplers(0, 1, &sampler);
-}
-
-void
-CompositorD3D11::PaintToTarget()
-{
-  nsRefPtr<ID3D11Texture2D> backBuf;
-
-  mSwapChain->GetBuffer(0, __uuidof(ID3D11Texture2D), (void**)backBuf.StartAssignment());
-
-  D3D11_TEXTURE2D_DESC bbDesc;
-  backBuf->GetDesc(&bbDesc);
-
-  CD3D11_TEXTURE2D_DESC softDesc(bbDesc.Format, bbDesc.Width, bbDesc.Height);
-  softDesc.MipLevels = 1;
-  softDesc.CPUAccessFlags = D3D11_CPU_ACCESS_READ;
-  softDesc.Usage = D3D11_USAGE_STAGING;
-  softDesc.BindFlags = 0;
-
-  nsRefPtr<ID3D11Texture2D> readTexture;
-
-  HRESULT hr = mDevice->CreateTexture2D(&softDesc, NULL, getter_AddRefs(readTexture));
-  mContext->CopyResource(readTexture, backBuf);
-
-  D3D11_MAPPED_SUBRESOURCE map;
-  mContext->Map(readTexture, 0, D3D11_MAP_READ, 0, &map);
-
-  nsRefPtr<gfxImageSurface> tmpSurface =
-    new gfxImageSurface((unsigned char*)map.pData,
-                        gfxIntSize(bbDesc.Width, bbDesc.Height),
-                        map.RowPitch,
-                        gfxASurface::ImageFormatARGB32);
-
-  mTarget->SetSource(tmpSurface);
-  mTarget->SetOperator(gfxContext::OPERATOR_OVER);
-  mTarget->Paint();
-
-  mContext->Unmap(readTexture, 0);
-}
-
-}
-}
deleted file mode 100644
--- a/gfx/layers/d3d11/CompositorD3D11.fx
+++ /dev/null
@@ -1,303 +0,0 @@
-/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*-
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-typedef float4 rect;
-
-float4x4 mLayerTransform : register(vs, c0);
-float4x4 mProjection : register(vs, c4);
-float4 vRenderTargetOffset : register(vs, c8);
-rect vTextureCoords : register(vs, c9);
-rect vLayerQuad : register(vs, c10);
-rect vMaskQuad : register(vs, c11);
-
-float4 fLayerColor : register(ps, c0);
-float fLayerOpacity : register(ps, c1);
-
-sampler sSampler : register(ps, s0);
-
-BlendState NoBlendDual
-{
-  AlphaToCoverageEnable = FALSE;
-  BlendEnable[0] = FALSE;
-  BlendEnable[1] = FALSE;
-  RenderTargetWriteMask[0] = 0x0F; // All
-  RenderTargetWriteMask[1] = 0x0F; // All
-};
-
-BlendState ComponentAlphaBlend
-{
-  AlphaToCoverageEnable = FALSE;
-  BlendEnable[0] = TRUE;
-  SrcBlend = One;
-  DestBlend = Inv_Src1_Color;
-  BlendOp = Add;
-  SrcBlendAlpha = One;
-  DestBlendAlpha = Inv_Src_Alpha;
-  BlendOpAlpha = Add;
-  RenderTargetWriteMask[0] = 0x0F; // All
-};
-
-Texture2D tRGB;
-Texture2D tY;
-Texture2D tCb;
-Texture2D tCr;
-Texture2D tRGBWhite;
-// Always bind this to slot 3 since this is always available!
-Texture2D tMask : register(ps, t3);
-
-struct VS_INPUT {
-  float2 vPosition : POSITION;
-};
-
-struct VS_OUTPUT {
-  float4 vPosition : SV_Position;
-  float2 vTexCoords : TEXCOORD0;
-};
-
-struct VS_MASK_OUTPUT {
-  float4 vPosition : SV_Position;
-  float2 vTexCoords : TEXCOORD0;
-  float2 vMaskCoords : TEXCOORD1;
-};
-
-struct VS_MASK_3D_OUTPUT {
-  float4 vPosition : SV_Position;
-  float2 vTexCoords : TEXCOORD0;
-  float3 vMaskCoords : TEXCOORD1;
-};
-
-struct PS_OUTPUT {
-  float4 vSrc;
-  float4 vAlpha;
-};
-
-struct PS_DUAL_OUTPUT {
-  float4 vOutput1 : SV_Target0;
-  float4 vOutput2 : SV_Target1;
-};
-
-float2 TexCoords(const float2 aPosition)
-{
-  float2 result;
-  const float2 size = vTextureCoords.zw;
-  result.x = vTextureCoords.x + aPosition.x * size.x;
-  result.y = vTextureCoords.y + aPosition.y * size.y;
-
-  return result;
-}
-
-SamplerState LayerTextureSamplerLinear
-{
-    Filter = MIN_MAG_MIP_LINEAR;
-    AddressU = Clamp;
-    AddressV = Clamp;
-};
-
-float4 TransformedPosition(float2 aInPosition)
-{
-  // the current vertex's position on the quad
-  float4 position = float4(0, 0, 0, 1);
-
-  // We use 4 component floats to uniquely describe a rectangle, by the structure
-  // of x, y, width, height. This allows us to easily generate the 4 corners
-  // of any rectangle from the 4 corners of the 0,0-1,1 quad that we use as the
-  // stream source for our LayerQuad vertex shader. We do this by doing:
-  // Xout = x + Xin * width
-  // Yout = y + Yin * height
-  float2 size = vLayerQuad.zw;
-  position.x = vLayerQuad.x + aInPosition.x * size.x;
-  position.y = vLayerQuad.y + aInPosition.y * size.y;
-
-  position = mul(mLayerTransform, position);
-
-  return position;
-}
-
-float4 VertexPosition(float4 aTransformedPosition)
-{
-  float4 result;
-  result.w = aTransformedPosition.w;
-  result.xyz = aTransformedPosition.xyz / aTransformedPosition.w;
-  result -= vRenderTargetOffset;
-  result.xyz *= result.w;
-
-  result = mul(mProjection, result);
-
-  return result;
-}
-
-VS_OUTPUT LayerQuadVS(const VS_INPUT aVertex)
-{
-  VS_OUTPUT outp;
-  float4 position = TransformedPosition(aVertex.vPosition);
-
-  outp.vPosition = VertexPosition(position);
-  outp.vTexCoords = TexCoords(aVertex.vPosition.xy);
-
-  return outp;
-}
-
-VS_MASK_OUTPUT LayerQuadMaskVS(const VS_INPUT aVertex)
-{
-  VS_MASK_OUTPUT outp;
-  float4 position = TransformedPosition(aVertex.vPosition);
-
-  outp.vPosition = VertexPosition(position);
-
-  // calculate the position on the mask texture
-  outp.vMaskCoords.x = (position.x - vMaskQuad.x) / vMaskQuad.z;
-  outp.vMaskCoords.y = (position.y - vMaskQuad.y) / vMaskQuad.w;
-
-  outp.vTexCoords = TexCoords(aVertex.vPosition.xy);
-
-  return outp;
-}
-
-VS_MASK_3D_OUTPUT LayerQuadMask3DVS(const VS_INPUT aVertex)
-{
-  VS_MASK_3D_OUTPUT outp;
-  float4 position = TransformedPosition(aVertex.vPosition);
-
-  outp.vPosition = VertexPosition(position);
-
-  // calculate the position on the mask texture
-  position.xyz /= position.w;
-  outp.vMaskCoords.x = (position.x - vMaskQuad.x) / vMaskQuad.z;
-  outp.vMaskCoords.y = (position.y - vMaskQuad.y) / vMaskQuad.w;
-  // We use the w coord to do non-perspective correct interpolation:
-  // the quad might be transformed in 3D, in which case it will have some
-  // perspective. The graphics card will do perspective-correct interpolation
-  // of the texture, but our mask is already transformed and so we require
-  // linear interpolation. Therefore, we must correct the interpolation
-  // ourselves, we do this by multiplying all coords by w here, and dividing by
-  // w in the pixel shader (post-interpolation), we pass w in outp.vMaskCoords.z.
-  // See http://en.wikipedia.org/wiki/Texture_mapping#Perspective_correctness
-  outp.vMaskCoords.z = 1;
-  outp.vMaskCoords *= position.w;
-
-  outp.vTexCoords = TexCoords(aVertex.vPosition.xy);
-
-  return outp;
-}
-
-float4 RGBAShaderMask(const VS_MASK_OUTPUT aVertex) : SV_Target
-{
-  float2 maskCoords = aVertex.vMaskCoords;
-  float mask = tMask.Sample(sSampler, maskCoords).a;
-  return tRGB.Sample(sSampler, aVertex.vTexCoords) * fLayerOpacity * mask;
-}
-
-float4 RGBAShaderMask3D(const VS_MASK_3D_OUTPUT aVertex) : SV_Target
-{
-  float2 maskCoords = aVertex.vMaskCoords.xy / aVertex.vMaskCoords.z;
-  float mask = tMask.Sample(LayerTextureSamplerLinear, maskCoords).a;
-  return tRGB.Sample(sSampler, aVertex.vTexCoords) * fLayerOpacity * mask;
-}
-
-float4 RGBShaderMask(const VS_MASK_OUTPUT aVertex) : SV_Target
-{
-  float4 result;
-  result = tRGB.Sample(sSampler, aVertex.vTexCoords) * fLayerOpacity;
-  result.a = fLayerOpacity;
-
-  float2 maskCoords = aVertex.vMaskCoords;
-  float mask = tMask.Sample(sSampler, maskCoords).a;
-  return result * mask;
-}
-
-float4 CalculateYCbCrColor(const float2 aTexCoords)
-{
-  float4 yuv;
-  float4 color;
-
-  yuv.r = tCr.Sample(sSampler, aTexCoords).r - 0.5;
-  yuv.g = tY.Sample(sSampler, aTexCoords).r - 0.0625;
-  yuv.b = tCb.Sample(sSampler, aTexCoords).r - 0.5;
-
-  color.r = yuv.g * 1.164 + yuv.r * 1.596;
-  color.g = yuv.g * 1.164 - 0.813 * yuv.r - 0.391 * yuv.b;
-  color.b = yuv.g * 1.164 + yuv.b * 2.018;
-  color.a = 1.0f;
-
-  return color;
-}
-
-float4 YCbCrShaderMask(const VS_MASK_OUTPUT aVertex) : SV_Target
-{
-  float2 maskCoords = aVertex.vMaskCoords;
-  float mask = tMask.Sample(sSampler, maskCoords).a;
-
-  return CalculateYCbCrColor(aVertex.vTexCoords) * fLayerOpacity * mask;
-}
-
-PS_OUTPUT ComponentAlphaShaderMask(const VS_MASK_OUTPUT aVertex) : SV_Target
-{
-  PS_OUTPUT result;
-
-  result.vSrc = tRGB.Sample(sSampler, aVertex.vTexCoords);
-  result.vAlpha = 1.0 - tRGBWhite.Sample(sSampler, aVertex.vTexCoords) + result.vSrc;
-  result.vSrc.a = result.vAlpha.g;
-
-  float2 maskCoords = aVertex.vMaskCoords;
-  float mask = tMask.Sample(sSampler, maskCoords).a;
-  result.vSrc *= fLayerOpacity * mask;
-  result.vAlpha *= fLayerOpacity * mask;
-
-  return result;
-}
-
-float4 SolidColorShaderMask(const VS_MASK_OUTPUT aVertex) : SV_Target
-{
-  float2 maskCoords = aVertex.vMaskCoords;
-  float mask = tMask.Sample(sSampler, maskCoords).a;
-  return fLayerColor * mask;
-}
-
-/*
- *  Un-masked versions
- *************************************************************
- */
-float4 RGBAShader(const VS_OUTPUT aVertex) : SV_Target
-{
-  return tRGB.Sample(sSampler, aVertex.vTexCoords) * fLayerOpacity;
-}
-
-float4 RGBShader(const VS_OUTPUT aVertex) : SV_Target
-{
-  float4 result;
-  result = tRGB.Sample(sSampler, aVertex.vTexCoords) * fLayerOpacity;
-  result.a = fLayerOpacity;
-  return result;
-}
-
-float4 YCbCrShader(const VS_OUTPUT aVertex) : SV_Target
-{
-  return CalculateYCbCrColor(aVertex.vTexCoords) * fLayerOpacity;
-}
-
-PS_OUTPUT ComponentAlphaShader(const VS_OUTPUT aVertex) : SV_Target
-{
-  PS_OUTPUT result;
-
-  result.vSrc = tRGB.Sample(sSampler, aVertex.vTexCoords);
-  result.vAlpha = 1.0 - tRGBWhite.Sample(sSampler, aVertex.vTexCoords) + result.vSrc;
-  result.vSrc.a = result.vAlpha.g;
-  result.vSrc *= fLayerOpacity;
-  result.vAlpha *= fLayerOpacity;
-  return result;
-}
-
-float4 SolidColorShader(const VS_OUTPUT aVertex) : SV_Target
-{
-  return fLayerColor;
-}
-
-PS_DUAL_OUTPUT AlphaExtractionPrepareShader(const VS_OUTPUT aVertex)
-{
-  PS_DUAL_OUTPUT result;
-  result.vOutput1 = float4(0, 0, 0, 1);
-  result.vOutput2 = float4(1, 1, 1, 1);
-  return result;
-}
deleted file mode 100644
--- a/gfx/layers/d3d11/CompositorD3D11.h
+++ /dev/null
@@ -1,174 +0,0 @@
-/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#ifndef MOZILLA_GFX_COMPOSITORD3D11_H
-#define MOZILLA_GFX_COMPOSITORD3D11_H
-
-#include "mozilla/layers/Compositor.h"
-#include "TextureD3D11.h"
-#include <d3d11.h>
-
-class nsWidget;
-
-namespace mozilla {
-namespace layers {
-
-#define LOGD3D11(param)
-
-struct VertexShaderConstants
-{
-  float layerTransform[4][4];
-  float projection[4][4];
-  float renderTargetOffset[4];
-  gfx::Rect textureCoords;
-  gfx::Rect layerQuad;
-  gfx::Rect maskQuad;
-};
-
-struct PixelShaderConstants
-{
-  float layerColor[4];
-  float layerOpacity[4];
-};
-
-struct DeviceAttachmentsD3D11;
-
-class CompositorD3D11 : public Compositor
-{
-public:
-  CompositorD3D11(nsIWidget *aWidget);
-  ~CompositorD3D11();
-
-  virtual bool Initialize();
-  virtual void Destroy() { }
-
-  virtual TextureFactoryIdentifier
-    GetTextureFactoryIdentifier() MOZ_OVERRIDE;
-
-  virtual bool CanUseCanvasLayerForSize(const gfxIntSize &aSize) MOZ_OVERRIDE;
-  virtual int32_t GetMaxTextureSize() const MOZ_FINAL;
-
-  virtual void SetTargetContext(gfxContext *aTarget) { mTarget = aTarget; }
-
-  virtual void MakeCurrent(MakeCurrentFlags aFlags = 0) { }
-
-  virtual TemporaryRef<CompositingRenderTarget>
-    CreateRenderTarget(const gfx::IntRect &aRect,
-                       SurfaceInitMode aInit) MOZ_OVERRIDE;
-
-  virtual TemporaryRef<CompositingRenderTarget>
-    CreateRenderTargetFromSource(const gfx::IntRect &aRect,
-                                 const CompositingRenderTarget *aSource) MOZ_OVERRIDE;
-
-  virtual void SetRenderTarget(CompositingRenderTarget *aSurface) MOZ_OVERRIDE;
-  virtual CompositingRenderTarget* GetCurrentRenderTarget() MOZ_OVERRIDE
-  {
-    return mCurrentRT;
-  }
-
-  virtual void SetDestinationSurfaceSize(const gfx::IntSize& aSize) MOZ_OVERRIDE { }
-
-  /**
-   * Declare an offset to use when rendering layers. This will be ignored when
-   * rendering to a target instead of the screen.
-   */
-  virtual void SetScreenRenderOffset(const gfx::Point& aOffset) MOZ_OVERRIDE {
-    if (aOffset.x || aOffset.y) {
-      NS_RUNTIMEABORT("SetScreenRenderOffset not supported by CompositorD3D11.");
-    }
-    // If the offset is 0, 0 that's okay.
-  }
-
-  virtual void DrawQuad(const gfx::Rect &aRect, const gfx::Rect &aClipRect,
-                        const EffectChain &aEffectChain,
-                        gfx::Float aOpacity, const gfx::Matrix4x4 &aTransform,
-                        const gfx::Point &aOffset) MOZ_OVERRIDE;
-
-  /**
-   * Start a new frame. If aClipRectIn is null, sets *aClipRectOut to the screen dimensions. 
-   */
-  virtual void BeginFrame(const gfx::Rect *aClipRectIn,
-                          const gfxMatrix& aTransform,
-                          const gfx::Rect& aRenderBounds,
-                          gfx::Rect *aClipRectOut = nullptr,
-                          gfx::Rect *aRenderBoundsOut = nullptr) MOZ_OVERRIDE;
-
-  /**
-   * Flush the current frame to the screen.
-   */
-  virtual void EndFrame() MOZ_OVERRIDE;
-
-  /**
-   * Post rendering stuff if the rendering is outside of this Compositor
-   * e.g., by Composer2D
-   */
-  virtual void EndFrameForExternalComposition(const gfxMatrix& aTransform) MOZ_OVERRIDE { }
-
-  /**
-   * Tidy up if BeginFrame has been called, but EndFrame won't be
-   */
-  virtual void AbortFrame() MOZ_OVERRIDE { }
-
-  /**
-   * Setup the viewport and projection matrix for rendering
-   * to a window of the given dimensions.
-   */
-  virtual void PrepareViewport(const gfx::IntSize& aSize,
-                               const gfxMatrix& aWorldTransform) MOZ_OVERRIDE;
-
-  virtual bool SupportsPartialTextureUpdate() MOZ_OVERRIDE { return true; }
-
-#ifdef MOZ_DUMP_PAINTING
-  virtual const char* Name() const MOZ_OVERRIDE { return "Direct3D 11"; }
-#endif
-
-  virtual void NotifyLayersTransaction() MOZ_OVERRIDE { }
-
-  virtual nsIWidget* GetWidget() const MOZ_OVERRIDE { return mWidget; }
-  virtual const nsIntSize& GetWidgetSize() MOZ_OVERRIDE;
-
-  ID3D11Device *GetDevice() { return mDevice; }
-
-private:
-  enum MaskMode {
-    UNMASKED = 0,
-    MASKED = 1,
-    MASKED3D
-  };
-
-  void VerifyBufferSize();
-  void UpdateRenderTarget();
-  bool CreateShaders();
-  void UpdateConstantBuffers();
-  void SetSamplerForFilter(gfx::Filter aFilter);
-  void SetPSForEffect(Effect *aEffect, MaskMode aMaskMode);
-  void PaintToTarget();
-
-  RefPtr<ID3D11DeviceContext> mContext;
-  RefPtr<ID3D11Device> mDevice;
-  RefPtr<IDXGISwapChain> mSwapChain;
-  RefPtr<CompositingRenderTargetD3D11> mDefaultRT;
-  RefPtr<CompositingRenderTargetD3D11> mCurrentRT;
-
-  DeviceAttachmentsD3D11 *mAttachments;
-
-  nsRefPtr<gfxContext> mTarget;
-
-  nsIWidget *mWidget;
-  // XXX - Bas - wth?
-  nsIntSize mSize;
-
-  HWND mHwnd;
-
-  D3D_FEATURE_LEVEL mFeatureLevel;
-
-  VertexShaderConstants mVSConstants;
-  PixelShaderConstants mPSConstants;
-};
-
-}
-}
-
-#endif
deleted file mode 100644
--- a/gfx/layers/d3d11/CompositorD3D11Shaders.h
+++ /dev/null
@@ -1,4420 +0,0 @@
-#if 0
-//
-// Generated by Microsoft (R) HLSL Shader Compiler 9.30.9200.16384
-//
-//
-///
-// Buffer Definitions: 
-//
-// cbuffer $Globals
-// {
-//
-//   float4x4 mLayerTransform;          // Offset:    0 Size:    64
-//   float4x4 mProjection;              // Offset:   64 Size:    64
-//   float4 vRenderTargetOffset;        // Offset:  128 Size:    16
-//   float4 vTextureCoords;             // Offset:  144 Size:    16
-//   float4 vLayerQuad;                 // Offset:  160 Size:    16
-//   float4 vMaskQuad;                  // Offset:  176 Size:    16 [unused]
-//   float4 fLayerColor;                // Offset:  192 Size:    16 [unused]
-//   float fLayerOpacity;               // Offset:  208 Size:     4 [unused]
-//
-// }
-//
-//
-// Resource Bindings:
-//
-// Name                                 Type  Format         Dim Slot Elements
-// ------------------------------ ---------- ------- ----------- ---- --------
-// $Globals                          cbuffer      NA          NA    0        1
-//
-//
-//
-// Input signature:
-//
-// Name                 Index   Mask Register SysValue  Format   Used
-// -------------------- ----- ------ -------- -------- ------- ------
-// POSITION                 0   xy          0     NONE   float   xy  
-//
-//
-// Output signature:
-//
-// Name                 Index   Mask Register SysValue  Format   Used
-// -------------------- ----- ------ -------- -------- ------- ------
-// SV_Position              0   xyzw        0      POS   float   xyzw
-// TEXCOORD                 0   xy          1     NONE   float   xy  
-//
-//
-// Constant buffer to DX9 shader constant mappings:
-//
-// Target Reg Buffer  Start Reg # of Regs        Data Conversion
-// ---------- ------- --------- --------- ----------------------
-// c1         cb0             0         2  ( FLT, FLT, FLT, FLT)
-// c3         cb0             3         8  ( FLT, FLT, FLT, FLT)
-//
-//
-// Runtime generated constant mappings:
-//
-// Target Reg                               Constant Description
-// ---------- --------------------------------------------------
-// c0                              Vertex Shader position offset
-//
-//
-// Level9 shader bytecode:
-//
-    vs_2_x
-    dcl_texcoord v0
-    mad oT0.xy, v0, c9.zwzw, c9
-    mad r0.xy, v0, c10.zwzw, c10
-    mul r1, r0.y, c2
-    mad r0, c1, r0.x, r1
-    add r0, r0, c3
-    rcp r1.x, r0.w
-    mul r0.xyz, r0, r1.x
-    add r0, r0, -c8
-    mul r0.xyz, r0.w, r0
-    mul r1, r0.y, c5
-    mad r1, c4, r0.x, r1
-    mad r1, c6, r0.z, r1
-    mad r0, c7, r0.w, r1
-    mad oPos.xy, r0.w, c0, r0
-    mov oPos.zw, r0
-
-// approximately 15 instruction slots used
-vs_4_0
-dcl_constantbuffer cb0[11], immediateIndexed
-dcl_input v0.xy
-dcl_output_siv o0.xyzw, position
-dcl_output o1.xy
-dcl_temps 2
-mad r0.xy, v0.xyxx, cb0[10].zwzz, cb0[10].xyxx
-mul r1.xyzw, r0.yyyy, cb0[1].xyzw
-mad r0.xyzw, cb0[0].xyzw, r0.xxxx, r1.xyzw
-add r0.xyzw, r0.xyzw, cb0[3].xyzw
-div r0.xyz, r0.xyzx, r0.wwww
-add r0.xyzw, r0.xyzw, -cb0[8].xyzw
-mul r0.xyz, r0.wwww, r0.xyzx
-mul r1.xyzw, r0.yyyy, cb0[5].xyzw
-mad r1.xyzw, cb0[4].xyzw, r0.xxxx, r1.xyzw
-mad r1.xyzw, cb0[6].xyzw, r0.zzzz, r1.xyzw
-mad o0.xyzw, cb0[7].xyzw, r0.wwww, r1.xyzw
-mad o1.xy, v0.xyxx, cb0[9].zwzz, cb0[9].xyxx
-ret 
-// Approximately 13 instruction slots used
-#endif
-
-const BYTE LayerQuadVS[] =
-{
-     68,  88,  66,  67,  94, 179, 
-     10,  14,  44, 114,  56,  99, 
-     68,  65, 225, 170, 143, 224, 
-    119, 149,   1,   0,   0,   0, 
-    180,   6,   0,   0,   6,   0, 
-      0,   0,  56,   0,   0,   0, 
-    152,   1,   0,   0, 160,   3, 
-      0,   0,  28,   4,   0,   0, 
-     40,   6,   0,   0,  92,   6, 
-      0,   0,  65, 111, 110,  57, 
-     88,   1,   0,   0,  88,   1, 
-      0,   0,   0,   2, 254, 255, 
-     24,   1,   0,   0,  64,   0, 
-      0,   0,   2,   0,  36,   0, 
-      0,   0,  60,   0,   0,   0, 
-     60,   0,   0,   0,  36,   0, 
-      1,   0,  60,   0,   0,   0, 
-      0,   0,   2,   0,   1,   0, 
-      0,   0,   0,   0,   0,   0, 
-      3,   0,   8,   0,   3,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   1,   2, 254, 255, 
-     31,   0,   0,   2,   5,   0, 
-      0, 128,   0,   0,  15, 144, 
-      4,   0,   0,   4,   0,   0, 
-      3, 224,   0,   0, 228, 144, 
-      9,   0, 238, 160,   9,   0, 
-    228, 160,   4,   0,   0,   4, 
-      0,   0,   3, 128,   0,   0, 
-    228, 144,  10,   0, 238, 160, 
-     10,   0, 228, 160,   5,   0, 
-      0,   3,   1,   0,  15, 128, 
-      0,   0,  85, 128,   2,   0, 
-    228, 160,   4,   0,   0,   4, 
-      0,   0,  15, 128,   1,   0, 
-    228, 160,   0,   0,   0, 128, 
-      1,   0, 228, 128,   2,   0, 
-      0,   3,   0,   0,  15, 128, 
-      0,   0, 228, 128,   3,   0, 
-    228, 160,   6,   0,   0,   2, 
-      1,   0,   1, 128,   0,   0, 
-    255, 128,   5,   0,   0,   3, 
-      0,   0,   7, 128,   0,   0, 
-    228, 128,   1,   0,   0, 128, 
-      2,   0,   0,   3,   0,   0, 
-     15, 128,   0,   0, 228, 128, 
-      8,   0, 228, 161,   5,   0, 
-      0,   3,   0,   0,   7, 128, 
-      0,   0, 255, 128,   0,   0, 
-    228, 128,   5,   0,   0,   3, 
-      1,   0,  15, 128,   0,   0, 
-     85, 128,   5,   0, 228, 160, 
-      4,   0,   0,   4,   1,   0, 
-     15, 128,   4,   0, 228, 160, 
-      0,   0,   0, 128,   1,   0, 
-    228, 128,   4,   0,   0,   4, 
-      1,   0,  15, 128,   6,   0, 
-    228, 160,   0,   0, 170, 128, 
-      1,   0, 228, 128,   4,   0, 
-      0,   4,   0,   0,  15, 128, 
-      7,   0, 228, 160,   0,   0, 
-    255, 128,   1,   0, 228, 128, 
-      4,   0,   0,   4,   0,   0, 
-      3, 192,   0,   0, 255, 128, 
-      0,   0, 228, 160,   0,   0, 
-    228, 128,   1,   0,   0,   2, 
-      0,   0,  12, 192,   0,   0, 
-    228, 128, 255, 255,   0,   0, 
-     83,  72,  68,  82,   0,   2, 
-      0,   0,  64,   0,   1,   0, 
-    128,   0,   0,   0,  89,   0, 
-      0,   4,  70, 142,  32,   0, 
-      0,   0,   0,   0,  11,   0, 
-      0,   0,  95,   0,   0,   3, 
-     50,  16,  16,   0,   0,   0, 
-      0,   0, 103,   0,   0,   4, 
-    242,  32,  16,   0,   0,   0, 
-      0,   0,   1,   0,   0,   0, 
-    101,   0,   0,   3,  50,  32, 
-     16,   0,   1,   0,   0,   0, 
-    104,   0,   0,   2,   2,   0, 
-      0,   0,  50,   0,   0,  11, 
-     50,   0,  16,   0,   0,   0, 
-      0,   0,  70,  16,  16,   0, 
-      0,   0,   0,   0, 230, 138, 
-     32,   0,   0,   0,   0,   0, 
-     10,   0,   0,   0,  70, 128, 
-     32,   0,   0,   0,   0,   0, 
-     10,   0,   0,   0,  56,   0, 
-      0,   8, 242,   0,  16,   0, 
-      1,   0,   0,   0,  86,   5, 
-     16,   0,   0,   0,   0,   0, 
-     70, 142,  32,   0,   0,   0, 
-      0,   0,   1,   0,   0,   0, 
-     50,   0,   0,  10, 242,   0, 
-     16,   0,   0,   0,   0,   0, 
-     70, 142,  32,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      6,   0,  16,   0,   0,   0, 
-      0,   0,  70,  14,  16,   0, 
-      1,   0,   0,   0,   0,   0, 
-      0,   8, 242,   0,  16,   0, 
-      0,   0,   0,   0,  70,  14, 
-     16,   0,   0,   0,   0,   0, 
-     70, 142,  32,   0,   0,   0, 
-      0,   0,   3,   0,   0,   0, 
-     14,   0,   0,   7, 114,   0, 
-     16,   0,   0,   0,   0,   0, 
-     70,   2,  16,   0,   0,   0, 
-      0,   0, 246,  15,  16,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   9, 242,   0,  16,   0, 
-      0,   0,   0,   0,  70,  14, 
-     16,   0,   0,   0,   0,   0, 
-     70, 142,  32, 128,  65,   0, 
-      0,   0,   0,   0,   0,   0, 
-      8,   0,   0,   0,  56,   0, 
-      0,   7, 114,   0,  16,   0, 
-      0,   0,   0,   0, 246,  15, 
-     16,   0,   0,   0,   0,   0, 
-     70,   2,  16,   0,   0,   0, 
-      0,   0,  56,   0,   0,   8, 
-    242,   0,  16,   0,   1,   0, 
-      0,   0,  86,   5,  16,   0, 
-      0,   0,   0,   0,  70, 142, 
-     32,   0,   0,   0,   0,   0, 
-      5,   0,   0,   0,  50,   0, 
-      0,  10, 242,   0,  16,   0, 
-      1,   0,   0,   0,  70, 142, 
-     32,   0,   0,   0,   0,   0, 
-      4,   0,   0,   0,   6,   0, 
-     16,   0,   0,   0,   0,   0, 
-     70,  14,  16,   0,   1,   0, 
-      0,   0,  50,   0,   0,  10, 
-    242,   0,  16,   0,   1,   0, 
-      0,   0,  70, 142,  32,   0, 
-      0,   0,   0,   0,   6,   0, 
-      0,   0, 166,  10,  16,   0, 
-      0,   0,   0,   0,  70,  14, 
-     16,   0,   1,   0,   0,   0, 
-     50,   0,   0,  10, 242,  32, 
-     16,   0,   0,   0,   0,   0, 
-     70, 142,  32,   0,   0,   0, 
-      0,   0,   7,   0,   0,   0, 
-    246,  15,  16,   0,   0,   0, 
-      0,   0,  70,  14,  16,   0, 
-      1,   0,   0,   0,  50,   0, 
-      0,  11,  50,  32,  16,   0, 
-      1,   0,   0,   0,  70,  16, 
-     16,   0,   0,   0,   0,   0, 
-    230, 138,  32,   0,   0,   0, 
-      0,   0,   9,   0,   0,   0, 
-     70, 128,  32,   0,   0,   0, 
-      0,   0,   9,   0,   0,   0, 
-     62,   0,   0,   1,  83,  84, 
-     65,  84, 116,   0,   0,   0, 
-     13,   0,   0,   0,   2,   0, 
-      0,   0,   0,   0,   0,   0, 
-      3,   0,   0,   0,   6,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   1,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   2,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,  82,  68,  69,  70, 
-      4,   2,   0,   0,   1,   0, 
-      0,   0,  72,   0,   0,   0, 
-      1,   0,   0,   0,  28,   0, 
-      0,   0,   0,   4, 254, 255, 
-      0,   1,   0,   0, 208,   1, 
-      0,   0,  60,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   1,   0,   0,   0, 
-      0,   0,   0,   0,  36,  71, 
-    108, 111,  98,  97, 108, 115, 
-      0, 171, 171, 171,  60,   0, 
-      0,   0,   8,   0,   0,   0, 
-     96,   0,   0,   0, 224,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,  32,   1, 
-      0,   0,   0,   0,   0,   0, 
-     64,   0,   0,   0,   2,   0, 
-      0,   0,  48,   1,   0,   0, 
-      0,   0,   0,   0,  64,   1, 
-      0,   0,  64,   0,   0,   0, 
-     64,   0,   0,   0,   2,   0, 
-      0,   0,  48,   1,   0,   0, 
-      0,   0,   0,   0,  76,   1, 
-      0,   0, 128,   0,   0,   0, 
-     16,   0,   0,   0,   2,   0, 
-      0,   0,  96,   1,   0,   0, 
-      0,   0,   0,   0, 112,   1, 
-      0,   0, 144,   0,   0,   0, 
-     16,   0,   0,   0,   2,   0, 
-      0,   0, 128,   1,   0,   0, 
-      0,   0,   0,   0, 144,   1, 
-      0,   0, 160,   0,   0,   0, 
-     16,   0,   0,   0,   2,   0, 
-      0,   0, 128,   1,   0,   0, 
-      0,   0,   0,   0, 155,   1, 
-      0,   0, 176,   0,   0,   0, 
-     16,   0,   0,   0,   0,   0, 
-      0,   0, 128,   1,   0,   0, 
-      0,   0,   0,   0, 165,   1, 
-      0,   0, 192,   0,   0,   0, 
-     16,   0,   0,   0,   0,   0, 
-      0,   0,  96,   1,   0,   0, 
-      0,   0,   0,   0, 177,   1, 
-      0,   0, 208,   0,   0,   0, 
-      4,   0,   0,   0,   0,   0, 
-      0,   0, 192,   1,   0,   0, 
-      0,   0,   0,   0, 109,  76, 
-     97, 121, 101, 114,  84, 114, 
-     97, 110, 115, 102, 111, 114, 
-    109,   0,   3,   0,   3,   0, 
-      4,   0,   4,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-    109,  80, 114, 111, 106, 101, 
-     99, 116, 105, 111, 110,   0, 
-    118,  82, 101, 110, 100, 101, 
-    114,  84,  97, 114, 103, 101, 
-    116,  79, 102, 102, 115, 101, 
-    116,   0,   1,   0,   3,   0, 
-      1,   0,   4,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-    118,  84, 101, 120, 116, 117, 
-    114, 101,  67, 111, 111, 114, 
-    100, 115,   0, 171,   1,   0, 
-      3,   0,   1,   0,   4,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0, 118,  76,  97, 121, 
-    101, 114,  81, 117,  97, 100, 
-      0, 118,  77,  97, 115, 107, 
-     81, 117,  97, 100,   0, 102, 
-     76,  97, 121, 101, 114,  67, 
-    111, 108, 111, 114,   0, 102, 
-     76,  97, 121, 101, 114,  79, 
-    112,  97,  99, 105, 116, 121, 
-      0, 171,   0,   0,   3,   0, 
-      1,   0,   1,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-     77, 105,  99, 114, 111, 115, 
-    111, 102, 116,  32,  40,  82, 
-     41,  32,  72,  76,  83,  76, 
-     32,  83, 104,  97, 100, 101, 
-    114,  32,  67, 111, 109, 112, 
-    105, 108, 101, 114,  32,  57, 
-     46,  51,  48,  46,  57,  50, 
-     48,  48,  46,  49,  54,  51, 
-     56,  52,   0, 171,  73,  83, 
-     71,  78,  44,   0,   0,   0, 
-      1,   0,   0,   0,   8,   0, 
-      0,   0,  32,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   3,   0,   0,   0, 
-      0,   0,   0,   0,   3,   3, 
-      0,   0,  80,  79,  83,  73, 
-     84,  73,  79,  78,   0, 171, 
-    171, 171,  79,  83,  71,  78, 
-     80,   0,   0,   0,   2,   0, 
-      0,   0,   8,   0,   0,   0, 
-     56,   0,   0,   0,   0,   0, 
-      0,   0,   1,   0,   0,   0, 
-      3,   0,   0,   0,   0,   0, 
-      0,   0,  15,   0,   0,   0, 
-     68,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      3,   0,   0,   0,   1,   0, 
-      0,   0,   3,  12,   0,   0, 
-     83,  86,  95,  80, 111, 115, 
-    105, 116, 105, 111, 110,   0, 
-     84,  69,  88,  67,  79,  79, 
-     82,  68,   0, 171, 171, 171
-};
-#if 0
-//
-// Generated by Microsoft (R) HLSL Shader Compiler 9.30.9200.16384
-//
-//
-///
-// Buffer Definitions: 
-//
-// cbuffer $Globals
-// {
-//
-//   float4 fLayerColor;                // Offset:    0 Size:    16
-//   float fLayerOpacity;               // Offset:   16 Size:     4 [unused]
-//   float4x4 mLayerTransform;          // Offset:   32 Size:    64 [unused]
-//   float4x4 mProjection;              // Offset:   96 Size:    64 [unused]
-//   float4 vRenderTargetOffset;        // Offset:  160 Size:    16 [unused]
-//   float4 vTextureCoords;             // Offset:  176 Size:    16 [unused]
-//   float4 vLayerQuad;                 // Offset:  192 Size:    16 [unused]
-//   float4 vMaskQuad;                  // Offset:  208 Size:    16 [unused]
-//
-// }
-//
-//
-// Resource Bindings:
-//
-// Name                                 Type  Format         Dim Slot Elements
-// ------------------------------ ---------- ------- ----------- ---- --------
-// $Globals                          cbuffer      NA          NA    0        1
-//
-//
-//
-// Input signature:
-//
-// Name                 Index   Mask Register SysValue  Format   Used
-// -------------------- ----- ------ -------- -------- ------- ------
-// SV_Position              0   xyzw        0      POS   float       
-// TEXCOORD                 0   xy          1     NONE   float       
-//
-//
-// Output signature:
-//
-// Name                 Index   Mask Register SysValue  Format   Used
-// -------------------- ----- ------ -------- -------- ------- ------
-// SV_Target                0   xyzw        0   TARGET   float   xyzw
-//
-//
-// Constant buffer to DX9 shader constant mappings:
-//
-// Target Reg Buffer  Start Reg # of Regs        Data Conversion
-// ---------- ------- --------- --------- ----------------------
-// c0         cb0             0         1  ( FLT, FLT, FLT, FLT)
-//
-//
-// Level9 shader bytecode:
-//
-    ps_2_x
-    mov oC0, c0
-
-// approximately 1 instruction slot used
-ps_4_0
-dcl_constantbuffer cb0[1], immediateIndexed
-dcl_output o0.xyzw
-mov o0.xyzw, cb0[0].xyzw
-ret 
-// Approximately 2 instruction slots used
-#endif
-
-const BYTE SolidColorShader[] =
-{
-     68,  88,  66,  67, 124,  30, 
-    156,  36, 155, 230, 126,   7, 
-    172, 151,  78, 188, 200, 114, 
-    123, 134,   1,   0,   0,   0, 
-    224,   3,   0,   0,   6,   0, 
-      0,   0,  56,   0,   0,   0, 
-    132,   0,   0,   0, 204,   0, 
-      0,   0,  72,   1,   0,   0, 
-     84,   3,   0,   0, 172,   3, 
-      0,   0,  65, 111, 110,  57, 
-     68,   0,   0,   0,  68,   0, 
-      0,   0,   0,   2, 255, 255, 
-     20,   0,   0,   0,  48,   0, 
-      0,   0,   1,   0,  36,   0, 
-      0,   0,  48,   0,   0,   0, 
-     48,   0,   0,   0,  36,   0, 
-      0,   0,  48,   0,   0,   0, 
-      0,   0,   1,   0,   0,   0, 
-      0,   0,   0,   0,   1,   2, 
-    255, 255,   1,   0,   0,   2, 
-      0,   8,  15, 128,   0,   0, 
-    228, 160, 255, 255,   0,   0, 
-     83,  72,  68,  82,  64,   0, 
-      0,   0,  64,   0,   0,   0, 
-     16,   0,   0,   0,  89,   0, 
-      0,   4,  70, 142,  32,   0, 
-      0,   0,   0,   0,   1,   0, 
-      0,   0, 101,   0,   0,   3, 
-    242,  32,  16,   0,   0,   0, 
-      0,   0,  54,   0,   0,   6, 
-    242,  32,  16,   0,   0,   0, 
-      0,   0,  70, 142,  32,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,  62,   0,   0,   1, 
-     83,  84,  65,  84, 116,   0, 
-      0,   0,   2,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   1,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      1,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      2,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,  82,  68, 
-     69,  70,   4,   2,   0,   0, 
-      1,   0,   0,   0,  72,   0, 
-      0,   0,   1,   0,   0,   0, 
-     28,   0,   0,   0,   0,   4, 
-    255, 255,   0,   1,   0,   0, 
-    209,   1,   0,   0,  60,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   1,   0, 
-      0,   0,   0,   0,   0,   0, 
-     36,  71, 108, 111,  98,  97, 
-    108, 115,   0, 171, 171, 171, 
-     60,   0,   0,   0,   8,   0, 
-      0,   0,  96,   0,   0,   0, 
-    224,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-     32,   1,   0,   0,   0,   0, 
-      0,   0,  16,   0,   0,   0, 
-      2,   0,   0,   0,  44,   1, 
-      0,   0,   0,   0,   0,   0, 
-     60,   1,   0,   0,  16,   0, 
-      0,   0,   4,   0,   0,   0, 
-      0,   0,   0,   0,  76,   1, 
-      0,   0,   0,   0,   0,   0, 
-     92,   1,   0,   0,  32,   0, 
-      0,   0,  64,   0,   0,   0, 
-      0,   0,   0,   0, 108,   1, 
-      0,   0,   0,   0,   0,   0, 
-    124,   1,   0,   0,  96,   0, 
-      0,   0,  64,   0,   0,   0, 
-      0,   0,   0,   0, 108,   1, 
-      0,   0,   0,   0,   0,   0, 
-    136,   1,   0,   0, 160,   0, 
-      0,   0,  16,   0,   0,   0, 
-      0,   0,   0,   0,  44,   1, 
-      0,   0,   0,   0,   0,   0, 
-    156,   1,   0,   0, 176,   0, 
-      0,   0,  16,   0,   0,   0, 
-      0,   0,   0,   0, 172,   1, 
-      0,   0,   0,   0,   0,   0, 
-    188,   1,   0,   0, 192,   0, 
-      0,   0,  16,   0,   0,   0, 
-      0,   0,   0,   0, 172,   1, 
-      0,   0,   0,   0,   0,   0, 
-    199,   1,   0,   0, 208,   0, 
-      0,   0,  16,   0,   0,   0, 
-      0,   0,   0,   0, 172,   1, 
-      0,   0,   0,   0,   0,   0, 
-    102,  76,  97, 121, 101, 114, 
-     67, 111, 108, 111, 114,   0, 
-      1,   0,   3,   0,   1,   0, 
-      4,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0, 102,  76, 
-     97, 121, 101, 114,  79, 112, 
-     97,  99, 105, 116, 121,   0, 
-    171, 171,   0,   0,   3,   0, 
-      1,   0,   1,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-    109,  76,  97, 121, 101, 114, 
-     84, 114,  97, 110, 115, 102, 
-    111, 114, 109,   0,   3,   0, 
-      3,   0,   4,   0,   4,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0, 109,  80, 114, 111, 
-    106, 101,  99, 116, 105, 111, 
-    110,   0, 118,  82, 101, 110, 
-    100, 101, 114,  84,  97, 114, 
-    103, 101, 116,  79, 102, 102, 
-    115, 101, 116,   0, 118,  84, 
-    101, 120, 116, 117, 114, 101, 
-     67, 111, 111, 114, 100, 115, 
-      0, 171,   1,   0,   3,   0, 
-      1,   0,   4,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-    118,  76,  97, 121, 101, 114, 
-     81, 117,  97, 100,   0, 118, 
-     77,  97, 115, 107,  81, 117, 
-     97, 100,   0,  77, 105,  99, 
-    114, 111, 115, 111, 102, 116, 
-     32,  40,  82,  41,  32,  72, 
-     76,  83,  76,  32,  83, 104, 
-     97, 100, 101, 114,  32,  67, 
-    111, 109, 112, 105, 108, 101, 
-    114,  32,  57,  46,  51,  48, 
-     46,  57,  50,  48,  48,  46, 
-     49,  54,  51,  56,  52,   0, 
-     73,  83,  71,  78,  80,   0, 
-      0,   0,   2,   0,   0,   0, 
-      8,   0,   0,   0,  56,   0, 
-      0,   0,   0,   0,   0,   0, 
-      1,   0,   0,   0,   3,   0, 
-      0,   0,   0,   0,   0,   0, 
-     15,   0,   0,   0,  68,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   3,   0, 
-      0,   0,   1,   0,   0,   0, 
-      3,   0,   0,   0,  83,  86, 
-     95,  80, 111, 115, 105, 116, 
-    105, 111, 110,   0,  84,  69, 
-     88,  67,  79,  79,  82,  68, 
-      0, 171, 171, 171,  79,  83, 
-     71,  78,  44,   0,   0,   0, 
-      1,   0,   0,   0,   8,   0, 
-      0,   0,  32,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   3,   0,   0,   0, 
-      0,   0,   0,   0,  15,   0, 
-      0,   0,  83,  86,  95,  84, 
-     97, 114, 103, 101, 116,   0, 
-    171, 171
-};
-#if 0
-//
-// Generated by Microsoft (R) HLSL Shader Compiler 9.30.9200.16384
-//
-//
-///
-// Buffer Definitions: 
-//
-// cbuffer $Globals
-// {
-//
-//   float4 fLayerColor;                // Offset:    0 Size:    16 [unused]
-//   float fLayerOpacity;               // Offset:   16 Size:     4
-//   float4x4 mLayerTransform;          // Offset:   32 Size:    64 [unused]
-//   float4x4 mProjection;              // Offset:   96 Size:    64 [unused]
-//   float4 vRenderTargetOffset;        // Offset:  160 Size:    16 [unused]
-//   float4 vTextureCoords;             // Offset:  176 Size:    16 [unused]
-//   float4 vLayerQuad;                 // Offset:  192 Size:    16 [unused]
-//   float4 vMaskQuad;                  // Offset:  208 Size:    16 [unused]
-//
-// }
-//
-//
-// Resource Bindings:
-//
-// Name                                 Type  Format         Dim Slot Elements
-// ------------------------------ ---------- ------- ----------- ---- --------
-// sSampler                          sampler      NA          NA    0        1
-// tRGB                              texture  float4          2d    0        1
-// $Globals                          cbuffer      NA          NA    0        1
-//
-//
-//
-// Input signature:
-//
-// Name                 Index   Mask Register SysValue  Format   Used
-// -------------------- ----- ------ -------- -------- ------- ------
-// SV_Position              0   xyzw        0      POS   float       
-// TEXCOORD                 0   xy          1     NONE   float   xy  
-//
-//
-// Output signature:
-//
-// Name                 Index   Mask Register SysValue  Format   Used
-// -------------------- ----- ------ -------- -------- ------- ------
-// SV_Target                0   xyzw        0   TARGET   float   xyzw
-//
-//
-// Constant buffer to DX9 shader constant mappings:
-//
-// Target Reg Buffer  Start Reg # of Regs        Data Conversion
-// ---------- ------- --------- --------- ----------------------
-// c0         cb0             1         1  ( FLT, FLT, FLT, FLT)
-//
-//
-// Sampler/Resource to DX9 shader sampler mappings:
-//
-// Target Sampler Source Sampler  Source Resource
-// -------------- --------------- ----------------
-// s0             s0              t0               
-//
-//
-// Level9 shader bytecode:
-//
-    ps_2_x
-    dcl t0.xy
-    dcl_2d s0
-    texld r0, t0, s0
-    mul r0.xyz, r0, c0.x
-    mov r0.w, c0.x
-    mov oC0, r0
-
-// approximately 4 instruction slots used (1 texture, 3 arithmetic)
-ps_4_0
-dcl_constantbuffer cb0[2], immediateIndexed
-dcl_sampler s0, mode_default
-dcl_resource_texture2d (float,float,float,float) t0
-dcl_input_ps linear v1.xy
-dcl_output o0.xyzw
-dcl_temps 1
-sample r0.xyzw, v1.xyxx, t0.xyzw, s0
-mul o0.xyz, r0.xyzx, cb0[1].xxxx
-mov o0.w, cb0[1].x
-ret 
-// Approximately 4 instruction slots used
-#endif
-
-const BYTE RGBShader[] =
-{
-     68,  88,  66,  67,  74, 217, 
-     47,  42,  86, 192, 229, 107, 
-    152,  27, 204,  78, 141, 118, 
-    241, 205,   1,   0,   0,   0, 
-    232,   4,   0,   0,   6,   0, 
-      0,   0,  56,   0,   0,   0, 
-    204,   0,   0,   0, 136,   1, 
-      0,   0,   4,   2,   0,   0, 
-     92,   4,   0,   0, 180,   4, 
-      0,   0,  65, 111, 110,  57, 
-    140,   0,   0,   0, 140,   0, 
-      0,   0,   0,   2, 255, 255, 
-     88,   0,   0,   0,  52,   0, 
-      0,   0,   1,   0,  40,   0, 
-      0,   0,  52,   0,   0,   0, 
-     52,   0,   1,   0,  36,   0, 
-      0,   0,  52,   0,   0,   0, 
-      0,   0,   0,   0,   1,   0, 
-      1,   0,   0,   0,   0,   0, 
-      0,   0,   1,   2, 255, 255, 
-     31,   0,   0,   2,   0,   0, 
-      0, 128,   0,   0,   3, 176, 
-     31,   0,   0,   2,   0,   0, 
-      0, 144,   0,   8,  15, 160, 
-     66,   0,   0,   3,   0,   0, 
-     15, 128,   0,   0, 228, 176, 
-      0,   8, 228, 160,   5,   0, 
-      0,   3,   0,   0,   7, 128, 
-      0,   0, 228, 128,   0,   0, 
-      0, 160,   1,   0,   0,   2, 
-      0,   0,   8, 128,   0,   0, 
-      0, 160,   1,   0,   0,   2, 
-      0,   8,  15, 128,   0,   0, 
-    228, 128, 255, 255,   0,   0, 
-     83,  72,  68,  82, 180,   0, 
-      0,   0,  64,   0,   0,   0, 
-     45,   0,   0,   0,  89,   0, 
-      0,   4,  70, 142,  32,   0, 
-      0,   0,   0,   0,   2,   0, 
-      0,   0,  90,   0,   0,   3, 
-      0,  96,  16,   0,   0,   0, 
-      0,   0,  88,  24,   0,   4, 
-      0, 112,  16,   0,   0,   0, 
-      0,   0,  85,  85,   0,   0, 
-     98,  16,   0,   3,  50,  16, 
-     16,   0,   1,   0,   0,   0, 
-    101,   0,   0,   3, 242,  32, 
-     16,   0,   0,   0,   0,   0, 
-    104,   0,   0,   2,   1,   0, 
-      0,   0,  69,   0,   0,   9, 
-    242,   0,  16,   0,   0,   0, 
-      0,   0,  70,  16,  16,   0, 
-      1,   0,   0,   0,  70, 126, 
-     16,   0,   0,   0,   0,   0, 
-      0,  96,  16,   0,   0,   0, 
-      0,   0,  56,   0,   0,   8, 
-    114,  32,  16,   0,   0,   0, 
-      0,   0,  70,   2,  16,   0, 
-      0,   0,   0,   0,   6, 128, 
-     32,   0,   0,   0,   0,   0, 
-      1,   0,   0,   0,  54,   0, 
-      0,   6, 130,  32,  16,   0, 
-      0,   0,   0,   0,  10, 128, 
-     32,   0,   0,   0,   0,   0, 
-      1,   0,   0,   0,  62,   0, 
-      0,   1,  83,  84,  65,  84, 
-    116,   0,   0,   0,   4,   0, 
-      0,   0,   1,   0,   0,   0, 
-      0,   0,   0,   0,   2,   0, 
-      0,   0,   1,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   1,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      1,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   2,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-     82,  68,  69,  70,  80,   2, 
-      0,   0,   1,   0,   0,   0, 
-    148,   0,   0,   0,   3,   0, 
-      0,   0,  28,   0,   0,   0, 
-      0,   4, 255, 255,   0,   1, 
-      0,   0,  29,   2,   0,   0, 
-    124,   0,   0,   0,   3,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      1,   0,   0,   0,   1,   0, 
-      0,   0, 133,   0,   0,   0, 
-      2,   0,   0,   0,   5,   0, 
-      0,   0,   4,   0,   0,   0, 
-    255, 255, 255, 255,   0,   0, 
-      0,   0,   1,   0,   0,   0, 
-     12,   0,   0,   0, 138,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   1,   0, 
-      0,   0,   0,   0,   0,   0, 
-    115,  83,  97, 109, 112, 108, 
-    101, 114,   0, 116,  82,  71, 
-     66,   0,  36,  71, 108, 111, 
-     98,  97, 108, 115,   0, 171, 
-    138,   0,   0,   0,   8,   0, 
-      0,   0, 172,   0,   0,   0, 
-    224,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-    108,   1,   0,   0,   0,   0, 
-      0,   0,  16,   0,   0,   0, 
-      0,   0,   0,   0, 120,   1, 
-      0,   0,   0,   0,   0,   0, 
-    136,   1,   0,   0,  16,   0, 
-      0,   0,   4,   0,   0,   0, 
-      2,   0,   0,   0, 152,   1, 
-      0,   0,   0,   0,   0,   0, 
-    168,   1,   0,   0,  32,   0, 
-      0,   0,  64,   0,   0,   0, 
-      0,   0,   0,   0, 184,   1, 
-      0,   0,   0,   0,   0,   0, 
-    200,   1,   0,   0,  96,   0, 
-      0,   0,  64,   0,   0,   0, 
-      0,   0,   0,   0, 184,   1, 
-      0,   0,   0,   0,   0,   0, 
-    212,   1,   0,   0, 160,   0, 
-      0,   0,  16,   0,   0,   0, 
-      0,   0,   0,   0, 120,   1, 
-      0,   0,   0,   0,   0,   0, 
-    232,   1,   0,   0, 176,   0, 
-      0,   0,  16,   0,   0,   0, 
-      0,   0,   0,   0, 248,   1, 
-      0,   0,   0,   0,   0,   0, 
-      8,   2,   0,   0, 192,   0, 
-      0,   0,  16,   0,   0,   0, 
-      0,   0,   0,   0, 248,   1, 
-      0,   0,   0,   0,   0,   0, 
-     19,   2,   0,   0, 208,   0, 
-      0,   0,  16,   0,   0,   0, 
-      0,   0,   0,   0, 248,   1, 
-      0,   0,   0,   0,   0,   0, 
-    102,  76,  97, 121, 101, 114, 
-     67, 111, 108, 111, 114,   0, 
-      1,   0,   3,   0,   1,   0, 
-      4,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0, 102,  76, 
-     97, 121, 101, 114,  79, 112, 
-     97,  99, 105, 116, 121,   0, 
-    171, 171,   0,   0,   3,   0, 
-      1,   0,   1,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-    109,  76,  97, 121, 101, 114, 
-     84, 114,  97, 110, 115, 102, 
-    111, 114, 109,   0,   3,   0, 
-      3,   0,   4,   0,   4,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0, 109,  80, 114, 111, 
-    106, 101,  99, 116, 105, 111, 
-    110,   0, 118,  82, 101, 110, 
-    100, 101, 114,  84,  97, 114, 
-    103, 101, 116,  79, 102, 102, 
-    115, 101, 116,   0, 118,  84, 
-    101, 120, 116, 117, 114, 101, 
-     67, 111, 111, 114, 100, 115, 
-      0, 171,   1,   0,   3,   0, 
-      1,   0,   4,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-    118,  76,  97, 121, 101, 114, 
-     81, 117,  97, 100,   0, 118, 
-     77,  97, 115, 107,  81, 117, 
-     97, 100,   0,  77, 105,  99, 
-    114, 111, 115, 111, 102, 116, 
-     32,  40,  82,  41,  32,  72, 
-     76,  83,  76,  32,  83, 104, 
-     97, 100, 101, 114,  32,  67, 
-    111, 109, 112, 105, 108, 101, 
-    114,  32,  57,  46,  51,  48, 
-     46,  57,  50,  48,  48,  46, 
-     49,  54,  51,  56,  52,   0, 
-     73,  83,  71,  78,  80,   0, 
-      0,   0,   2,   0,   0,   0, 
-      8,   0,   0,   0,  56,   0, 
-      0,   0,   0,   0,   0,   0, 
-      1,   0,   0,   0,   3,   0, 
-      0,   0,   0,   0,   0,   0, 
-     15,   0,   0,   0,  68,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   3,   0, 
-      0,   0,   1,   0,   0,   0, 
-      3,   3,   0,   0,  83,  86, 
-     95,  80, 111, 115, 105, 116, 
-    105, 111, 110,   0,  84,  69, 
-     88,  67,  79,  79,  82,  68, 
-      0, 171, 171, 171,  79,  83, 
-     71,  78,  44,   0,   0,   0, 
-      1,   0,   0,   0,   8,   0, 
-      0,   0,  32,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   3,   0,   0,   0, 
-      0,   0,   0,   0,  15,   0, 
-      0,   0,  83,  86,  95,  84, 
-     97, 114, 103, 101, 116,   0, 
-    171, 171
-};
-#if 0
-//
-// Generated by Microsoft (R) HLSL Shader Compiler 9.30.9200.16384
-//
-//
-///
-// Buffer Definitions: 
-//
-// cbuffer $Globals
-// {
-//
-//   float4 fLayerColor;                // Offset:    0 Size:    16 [unused]
-//   float fLayerOpacity;               // Offset:   16 Size:     4
-//   float4x4 mLayerTransform;          // Offset:   32 Size:    64 [unused]
-//   float4x4 mProjection;              // Offset:   96 Size:    64 [unused]
-//   float4 vRenderTargetOffset;        // Offset:  160 Size:    16 [unused]
-//   float4 vTextureCoords;             // Offset:  176 Size:    16 [unused]
-//   float4 vLayerQuad;                 // Offset:  192 Size:    16 [unused]
-//   float4 vMaskQuad;                  // Offset:  208 Size:    16 [unused]
-//
-// }
-//
-//
-// Resource Bindings:
-//
-// Name                                 Type  Format         Dim Slot Elements
-// ------------------------------ ---------- ------- ----------- ---- --------
-// sSampler                          sampler      NA          NA    0        1
-// tRGB                              texture  float4          2d    0        1
-// $Globals                          cbuffer      NA          NA    0        1
-//
-//
-//
-// Input signature:
-//
-// Name                 Index   Mask Register SysValue  Format   Used
-// -------------------- ----- ------ -------- -------- ------- ------
-// SV_Position              0   xyzw        0      POS   float       
-// TEXCOORD                 0   xy          1     NONE   float   xy  
-//
-//
-// Output signature:
-//
-// Name                 Index   Mask Register SysValue  Format   Used
-// -------------------- ----- ------ -------- -------- ------- ------
-// SV_Target                0   xyzw        0   TARGET   float   xyzw
-//
-//
-// Constant buffer to DX9 shader constant mappings:
-//
-// Target Reg Buffer  Start Reg # of Regs        Data Conversion
-// ---------- ------- --------- --------- ----------------------
-// c0         cb0             1         1  ( FLT, FLT, FLT, FLT)
-//
-//
-// Sampler/Resource to DX9 shader sampler mappings:
-//
-// Target Sampler Source Sampler  Source Resource
-// -------------- --------------- ----------------
-// s0             s0              t0               
-//
-//
-// Level9 shader bytecode:
-//
-    ps_2_x
-    dcl t0.xy
-    dcl_2d s0
-    texld r0, t0, s0
-    mul r0, r0, c0.x
-    mov oC0, r0
-
-// approximately 3 instruction slots used (1 texture, 2 arithmetic)
-ps_4_0
-dcl_constantbuffer cb0[2], immediateIndexed
-dcl_sampler s0, mode_default
-dcl_resource_texture2d (float,float,float,float) t0
-dcl_input_ps linear v1.xy
-dcl_output o0.xyzw
-dcl_temps 1
-sample r0.xyzw, v1.xyxx, t0.xyzw, s0
-mul o0.xyzw, r0.xyzw, cb0[1].xxxx
-ret 
-// Approximately 3 instruction slots used
-#endif
-
-const BYTE RGBAShader[] =
-{
-     68,  88,  66,  67, 153,  44, 
-    138, 113, 124,  11,  23, 177, 
-    234,  10, 144, 112,  34,  86, 
-    226, 243,   1,   0,   0,   0, 
-    196,   4,   0,   0,   6,   0, 
-      0,   0,  56,   0,   0,   0, 
-    192,   0,   0,   0, 100,   1, 
-      0,   0, 224,   1,   0,   0, 
-     56,   4,   0,   0, 144,   4, 
-      0,   0,  65, 111, 110,  57, 
-    128,   0,   0,   0, 128,   0, 
-      0,   0,   0,   2, 255, 255, 
-     76,   0,   0,   0,  52,   0, 
-      0,   0,   1,   0,  40,   0, 
-      0,   0,  52,   0,   0,   0, 
-     52,   0,   1,   0,  36,   0, 
-      0,   0,  52,   0,   0,   0, 
-      0,   0,   0,   0,   1,   0, 
-      1,   0,   0,   0,   0,   0, 
-      0,   0,   1,   2, 255, 255, 
-     31,   0,   0,   2,   0,   0, 
-      0, 128,   0,   0,   3, 176, 
-     31,   0,   0,   2,   0,   0, 
-      0, 144,   0,   8,  15, 160, 
-     66,   0,   0,   3,   0,   0, 
-     15, 128,   0,   0, 228, 176, 
-      0,   8, 228, 160,   5,   0, 
-      0,   3,   0,   0,  15, 128, 
-      0,   0, 228, 128,   0,   0, 
-      0, 160,   1,   0,   0,   2, 
-      0,   8,  15, 128,   0,   0, 
-    228, 128, 255, 255,   0,   0, 
-     83,  72,  68,  82, 156,   0, 
-      0,   0,  64,   0,   0,   0, 
-     39,   0,   0,   0,  89,   0, 
-      0,   4,  70, 142,  32,   0, 
-      0,   0,   0,   0,   2,   0, 
-      0,   0,  90,   0,   0,   3, 
-      0,  96,  16,   0,   0,   0, 
-      0,   0,  88,  24,   0,   4, 
-      0, 112,  16,   0,   0,   0, 
-      0,   0,  85,  85,   0,   0, 
-     98,  16,   0,   3,  50,  16, 
-     16,   0,   1,   0,   0,   0, 
-    101,   0,   0,   3, 242,  32, 
-     16,   0,   0,   0,   0,   0, 
-    104,   0,   0,   2,   1,   0, 
-      0,   0,  69,   0,   0,   9, 
-    242,   0,  16,   0,   0,   0, 
-      0,   0,  70,  16,  16,   0, 
-      1,   0,   0,   0,  70, 126, 
-     16,   0,   0,   0,   0,   0, 
-      0,  96,  16,   0,   0,   0, 
-      0,   0,  56,   0,   0,   8, 
-    242,  32,  16,   0,   0,   0, 
-      0,   0,  70,  14,  16,   0, 
-      0,   0,   0,   0,   6, 128, 
-     32,   0,   0,   0,   0,   0, 
-      1,   0,   0,   0,  62,   0, 
-      0,   1,  83,  84,  65,  84, 
-    116,   0,   0,   0,   3,   0, 
-      0,   0,   1,   0,   0,   0, 
-      0,   0,   0,   0,   2,   0, 
-      0,   0,   1,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   1,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      1,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   1,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-     82,  68,  69,  70,  80,   2, 
-      0,   0,   1,   0,   0,   0, 
-    148,   0,   0,   0,   3,   0, 
-      0,   0,  28,   0,   0,   0, 
-      0,   4, 255, 255,   0,   1, 
-      0,   0,  29,   2,   0,   0, 
-    124,   0,   0,   0,   3,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      1,   0,   0,   0,   1,   0, 
-      0,   0, 133,   0,   0,   0, 
-      2,   0,   0,   0,   5,   0, 
-      0,   0,   4,   0,   0,   0, 
-    255, 255, 255, 255,   0,   0, 
-      0,   0,   1,   0,   0,   0, 
-     12,   0,   0,   0, 138,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   1,   0, 
-      0,   0,   0,   0,   0,   0, 
-    115,  83,  97, 109, 112, 108, 
-    101, 114,   0, 116,  82,  71, 
-     66,   0,  36,  71, 108, 111, 
-     98,  97, 108, 115,   0, 171, 
-    138,   0,   0,   0,   8,   0, 
-      0,   0, 172,   0,   0,   0, 
-    224,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-    108,   1,   0,   0,   0,   0, 
-      0,   0,  16,   0,   0,   0, 
-      0,   0,   0,   0, 120,   1, 
-      0,   0,   0,   0,   0,   0, 
-    136,   1,   0,   0,  16,   0, 
-      0,   0,   4,   0,   0,   0, 
-      2,   0,   0,   0, 152,   1, 
-      0,   0,   0,   0,   0,   0, 
-    168,   1,   0,   0,  32,   0, 
-      0,   0,  64,   0,   0,   0, 
-      0,   0,   0,   0, 184,   1, 
-      0,   0,   0,   0,   0,   0, 
-    200,   1,   0,   0,  96,   0, 
-      0,   0,  64,   0,   0,   0, 
-      0,   0,   0,   0, 184,   1, 
-      0,   0,   0,   0,   0,   0, 
-    212,   1,   0,   0, 160,   0, 
-      0,   0,  16,   0,   0,   0, 
-      0,   0,   0,   0, 120,   1, 
-      0,   0,   0,   0,   0,   0, 
-    232,   1,   0,   0, 176,   0, 
-      0,   0,  16,   0,   0,   0, 
-      0,   0,   0,   0, 248,   1, 
-      0,   0,   0,   0,   0,   0, 
-      8,   2,   0,   0, 192,   0, 
-      0,   0,  16,   0,   0,   0, 
-      0,   0,   0,   0, 248,   1, 
-      0,   0,   0,   0,   0,   0, 
-     19,   2,   0,   0, 208,   0, 
-      0,   0,  16,   0,   0,   0, 
-      0,   0,   0,   0, 248,   1, 
-      0,   0,   0,   0,   0,   0, 
-    102,  76,  97, 121, 101, 114, 
-     67, 111, 108, 111, 114,   0, 
-      1,   0,   3,   0,   1,   0, 
-      4,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0, 102,  76, 
-     97, 121, 101, 114,  79, 112, 
-     97,  99, 105, 116, 121,   0, 
-    171, 171,   0,   0,   3,   0, 
-      1,   0,   1,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-    109,  76,  97, 121, 101, 114, 
-     84, 114,  97, 110, 115, 102, 
-    111, 114, 109,   0,   3,   0, 
-      3,   0,   4,   0,   4,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0, 109,  80, 114, 111, 
-    106, 101,  99, 116, 105, 111, 
-    110,   0, 118,  82, 101, 110, 
-    100, 101, 114,  84,  97, 114, 
-    103, 101, 116,  79, 102, 102, 
-    115, 101, 116,   0, 118,  84, 
-    101, 120, 116, 117, 114, 101, 
-     67, 111, 111, 114, 100, 115, 
-      0, 171,   1,   0,   3,   0, 
-      1,   0,   4,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-    118,  76,  97, 121, 101, 114, 
-     81, 117,  97, 100,   0, 118, 
-     77,  97, 115, 107,  81, 117, 
-     97, 100,   0,  77, 105,  99, 
-    114, 111, 115, 111, 102, 116, 
-     32,  40,  82,  41,  32,  72, 
-     76,  83,  76,  32,  83, 104, 
-     97, 100, 101, 114,  32,  67, 
-    111, 109, 112, 105, 108, 101, 
-    114,  32,  57,  46,  51,  48, 
-     46,  57,  50,  48,  48,  46, 
-     49,  54,  51,  56,  52,   0, 
-     73,  83,  71,  78,  80,   0, 
-      0,   0,   2,   0,   0,   0, 
-      8,   0,   0,   0,  56,   0, 
-      0,   0,   0,   0,   0,   0, 
-      1,   0,   0,   0,   3,   0, 
-      0,   0,   0,   0,   0,   0, 
-     15,   0,   0,   0,  68,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   3,   0, 
-      0,   0,   1,   0,   0,   0, 
-      3,   3,   0,   0,  83,  86, 
-     95,  80, 111, 115, 105, 116, 
-    105, 111, 110,   0,  84,  69, 
-     88,  67,  79,  79,  82,  68, 
-      0, 171, 171, 171,  79,  83, 
-     71,  78,  44,   0,   0,   0, 
-      1,   0,   0,   0,   8,   0, 
-      0,   0,  32,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   3,   0,   0,   0, 
-      0,   0,   0,   0,  15,   0, 
-      0,   0,  83,  86,  95,  84, 
-     97, 114, 103, 101, 116,   0, 
-    171, 171
-};
-#if 0
-//
-// Generated by Microsoft (R) HLSL Shader Compiler 9.30.9200.16384
-//
-//
-///
-// Buffer Definitions: 
-//
-// cbuffer $Globals
-// {
-//
-//   float4 fLayerColor;                // Offset:    0 Size:    16 [unused]
-//   float fLayerOpacity;               // Offset:   16 Size:     4
-//   float4x4 mLayerTransform;          // Offset:   32 Size:    64 [unused]
-//   float4x4 mProjection;              // Offset:   96 Size:    64 [unused]
-//   float4 vRenderTargetOffset;        // Offset:  160 Size:    16 [unused]
-//   float4 vTextureCoords;             // Offset:  176 Size:    16 [unused]
-//   float4 vLayerQuad;                 // Offset:  192 Size:    16 [unused]
-//   float4 vMaskQuad;                  // Offset:  208 Size:    16 [unused]
-//
-// }
-//
-//
-// Resource Bindings:
-//
-// Name                                 Type  Format         Dim Slot Elements
-// ------------------------------ ---------- ------- ----------- ---- --------
-// sSampler                          sampler      NA          NA    0        1
-// tY                                texture  float4          2d    0        1
-// tCb                               texture  float4          2d    1        1
-// tCr                               texture  float4          2d    2        1
-// $Globals                          cbuffer      NA          NA    0        1
-//
-//
-//
-// Input signature:
-//
-// Name                 Index   Mask Register SysValue  Format   Used
-// -------------------- ----- ------ -------- -------- ------- ------
-// SV_Position              0   xyzw        0      POS   float       
-// TEXCOORD                 0   xy          1     NONE   float   xy  
-//
-//
-// Output signature:
-//
-// Name                 Index   Mask Register SysValue  Format   Used
-// -------------------- ----- ------ -------- -------- ------- ------
-// SV_Target                0   xyzw        0   TARGET   float   xyzw
-//
-//
-// Constant buffer to DX9 shader constant mappings:
-//
-// Target Reg Buffer  Start Reg # of Regs        Data Conversion
-// ---------- ------- --------- --------- ----------------------
-// c0         cb0             1         1  ( FLT, FLT, FLT, FLT)
-//
-//
-// Sampler/Resource to DX9 shader sampler mappings:
-//
-// Target Sampler Source Sampler  Source Resource
-// -------------- --------------- ----------------
-// s0             s0              t0               
-// s1             s0              t1               
-// s2             s0              t2               
-//
-//
-// Level9 shader bytecode:
-//
-    ps_2_x
-    def c1, -0.5, -0.0625, 1.59599996, 0.813000023
-    def c2, 1.16400003, 2.01799989, 0.391000003, 1
-    dcl t0.xy
-    dcl_2d s0
-    dcl_2d s1
-    dcl_2d s2
-    texld r0, t0, s0
-    texld r1, t0, s2
-    add r0.y, r1.x, c1.x
-    mul r0.yz, r0.y, c1.xzww
-    add r0.x, r0.x, c1.y
-    mad r0.z, r0.x, c2.x, -r0.z
-    mad r1.x, r0.x, c2.x, r0.y
-    texld r2, t0, s1
-    add r0.y, r2.x, c1.x
-    mad r1.y, r0.y, -c2.z, r0.z
-    mul r0.y, r0.y, c2.y
-    mad r1.z, r0.x, c2.x, r0.y
-    mov r1.w, c2.w
-    mul r0, r1, c0.x
-    mov oC0, r0
-
-// approximately 15 instruction slots used (3 texture, 12 arithmetic)
-ps_4_0
-dcl_constantbuffer cb0[2], immediateIndexed
-dcl_sampler s0, mode_default
-dcl_resource_texture2d (float,float,float,float) t0
-dcl_resource_texture2d (float,float,float,float) t1
-dcl_resource_texture2d (float,float,float,float) t2
-dcl_input_ps linear v1.xy
-dcl_output o0.xyzw
-dcl_temps 3
-sample r0.xyzw, v1.xyxx, t2.xyzw, s0
-add r0.x, r0.x, l(-0.500000)
-mul r0.xy, r0.xxxx, l(1.596000, 0.813000, 0.000000, 0.000000)
-sample r1.xyzw, v1.xyxx, t0.xyzw, s0
-add r0.z, r1.x, l(-0.062500)
-mad r0.y, r0.z, l(1.164000), -r0.y
-mad r1.x, r0.z, l(1.164000), r0.x
-sample r2.xyzw, v1.xyxx, t1.xyzw, s0
-add r0.x, r2.x, l(-0.500000)
-mad r1.y, -r0.x, l(0.391000), r0.y
-mul r0.x, r0.x, l(2.018000)
-mad r1.z, r0.z, l(1.164000), r0.x
-mov r1.w, l(1.000000)
-mul o0.xyzw, r1.xyzw, cb0[1].xxxx
-ret 
-// Approximately 15 instruction slots used
-#endif
-
-const BYTE YCbCrShader[] =
-{
-     68,  88,  66,  67, 232,  60, 
-    114,  61, 127,   6,  96, 233, 
-     72, 126, 205, 106,  88, 249, 
-     41,  31,   1,   0,   0,   0, 
-    212,   7,   0,   0,   6,   0, 
-      0,   0,  56,   0,   0,   0, 
-    220,   1,   0,   0,  44,   4, 
-      0,   0, 168,   4,   0,   0, 
-     72,   7,   0,   0, 160,   7, 
-      0,   0,  65, 111, 110,  57, 
-    156,   1,   0,   0, 156,   1, 
-      0,   0,   0,   2, 255, 255, 
-     96,   1,   0,   0,  60,   0, 
-      0,   0,   1,   0,  48,   0, 
-      0,   0,  60,   0,   0,   0, 
-     60,   0,   3,   0,  36,   0, 
-      0,   0,  60,   0,   0,   0, 
-      0,   0,   1,   0,   1,   0, 
-      2,   0,   2,   0,   0,   0, 
-      1,   0,   1,   0,   0,   0, 
-      0,   0,   0,   0,   1,   2, 
-    255, 255,  81,   0,   0,   5, 
-      1,   0,  15, 160,   0,   0, 
-      0, 191,   0,   0, 128, 189, 
-    186,  73, 204,  63, 197,  32, 
-     80,  63,  81,   0,   0,   5, 
-      2,   0,  15, 160, 244, 253, 
-    148,  63, 233,  38,   1,  64, 
-     39,  49, 200,  62,   0,   0, 
-    128,  63,  31,   0,   0,   2, 
-      0,   0,   0, 128,   0,   0, 
-      3, 176,  31,   0,   0,   2, 
-      0,   0,   0, 144,   0,   8, 
-     15, 160,  31,   0,   0,   2, 
-      0,   0,   0, 144,   1,   8, 
-     15, 160,  31,   0,   0,   2, 
-      0,   0,   0, 144,   2,   8, 
-     15, 160,  66,   0,   0,   3, 
-      0,   0,  15, 128,   0,   0, 
-    228, 176,   0,   8, 228, 160, 
-     66,   0,   0,   3,   1,   0, 
-     15, 128,   0,   0, 228, 176, 
-      2,   8, 228, 160,   2,   0, 
-      0,   3,   0,   0,   2, 128, 
-      1,   0,   0, 128,   1,   0, 
-      0, 160,   5,   0,   0,   3, 
-      0,   0,   6, 128,   0,   0, 
-     85, 128,   1,   0, 248, 160, 
-      2,   0,   0,   3,   0,   0, 
-      1, 128,   0,   0,   0, 128, 
-      1,   0,  85, 160,   4,   0, 
-      0,   4,   0,   0,   4, 128, 
-      0,   0,   0, 128,   2,   0, 
-      0, 160,   0,   0, 170, 129, 
-      4,   0,   0,   4,   1,   0, 
-      1, 128,   0,   0,   0, 128, 
-      2,   0,   0, 160,   0,   0, 
-     85, 128,  66,   0,   0,   3, 
-      2,   0,  15, 128,   0,   0, 
-    228, 176,   1,   8, 228, 160, 
-      2,   0,   0,   3,   0,   0, 
-      2, 128,   2,   0,   0, 128, 
-      1,   0,   0, 160,   4,   0, 
-      0,   4,   1,   0,   2, 128, 
-      0,   0,  85, 128,   2,   0, 
-    170, 161,   0,   0, 170, 128, 
-      5,   0,   0,   3,   0,   0, 
-      2, 128,   0,   0,  85, 128, 
-      2,   0,  85, 160,   4,   0, 
-      0,   4,   1,   0,   4, 128, 
-      0,   0,   0, 128,   2,   0, 
-      0, 160,   0,   0,  85, 128, 
-      1,   0,   0,   2,   1,   0, 
-      8, 128,   2,   0, 255, 160, 
-      5,   0,   0,   3,   0,   0, 
-     15, 128,   1,   0, 228, 128, 
-      0,   0,   0, 160,   1,   0, 
-      0,   2,   0,   8,  15, 128, 
-      0,   0, 228, 128, 255, 255, 
-      0,   0,  83,  72,  68,  82, 
-     72,   2,   0,   0,  64,   0, 
-      0,   0, 146,   0,   0,   0, 
-     89,   0,   0,   4,  70, 142, 
-     32,   0,   0,   0,   0,   0, 
-      2,   0,   0,   0,  90,   0, 
-      0,   3,   0,  96,  16,   0, 
-      0,   0,   0,   0,  88,  24, 
-      0,   4,   0, 112,  16,   0, 
-      0,   0,   0,   0,  85,  85, 
-      0,   0,  88,  24,   0,   4, 
-      0, 112,  16,   0,   1,   0, 
-      0,   0,  85,  85,   0,   0, 
-     88,  24,   0,   4,   0, 112, 
-     16,   0,   2,   0,   0,   0, 
-     85,  85,   0,   0,  98,  16, 
-      0,   3,  50,  16,  16,   0, 
-      1,   0,   0,   0, 101,   0, 
-      0,   3, 242,  32,  16,   0, 
-      0,   0,   0,   0, 104,   0, 
-      0,   2,   3,   0,   0,   0, 
-     69,   0,   0,   9, 242,   0, 
-     16,   0,   0,   0,   0,   0, 
-     70,  16,  16,   0,   1,   0, 
-      0,   0,  70, 126,  16,   0, 
-      2,   0,   0,   0,   0,  96, 
-     16,   0,   0,   0,   0,   0, 
-      0,   0,   0,   7,  18,   0, 
-     16,   0,   0,   0,   0,   0, 
-     10,   0,  16,   0,   0,   0, 
-      0,   0,   1,  64,   0,   0, 
-      0,   0,   0, 191,  56,   0, 
-      0,  10,  50,   0,  16,   0, 
-      0,   0,   0,   0,   6,   0, 
-     16,   0,   0,   0,   0,   0, 
-      2,  64,   0,   0, 186,  73, 
-    204,  63, 197,  32,  80,  63, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,  69,   0,   0,   9, 
-    242,   0,  16,   0,   1,   0, 
-      0,   0,  70,  16,  16,   0, 
-      1,   0,   0,   0,  70, 126, 
-     16,   0,   0,   0,   0,   0, 
-      0,  96,  16,   0,   0,   0, 
-      0,   0,   0,   0,   0,   7, 
-     66,   0,  16,   0,   0,   0, 
-      0,   0,  10,   0,  16,   0, 
-      1,   0,   0,   0,   1,  64, 
-      0,   0,   0,   0, 128, 189, 
-     50,   0,   0,  10,  34,   0, 
-     16,   0,   0,   0,   0,   0, 
-     42,   0,  16,   0,   0,   0, 
-      0,   0,   1,  64,   0,   0, 
-    244, 253, 148,  63,  26,   0, 
-     16, 128,  65,   0,   0,   0, 
-      0,   0,   0,   0,  50,   0, 
-      0,   9,  18,   0,  16,   0, 
-      1,   0,   0,   0,  42,   0, 
-     16,   0,   0,   0,   0,   0, 
-      1,  64,   0,   0, 244, 253, 
-    148,  63,  10,   0,  16,   0, 
-      0,   0,   0,   0,  69,   0, 
-      0,   9, 242,   0,  16,   0, 
-      2,   0,   0,   0,  70,  16, 
-     16,   0,   1,   0,   0,   0, 
-     70, 126,  16,   0,   1,   0, 
-      0,   0,   0,  96,  16,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   7,  18,   0,  16,   0, 
-      0,   0,   0,   0,  10,   0, 
-     16,   0,   2,   0,   0,   0, 
-      1,  64,   0,   0,   0,   0, 
-      0, 191,  50,   0,   0,  10, 
-     34,   0,  16,   0,   1,   0, 
-      0,   0,  10,   0,  16, 128, 
-     65,   0,   0,   0,   0,   0, 
-      0,   0,   1,  64,   0,   0, 
-     39,  49, 200,  62,  26,   0, 
-     16,   0,   0,   0,   0,   0, 
-     56,   0,   0,   7,  18,   0, 
-     16,   0,   0,   0,   0,   0, 
-     10,   0,  16,   0,   0,   0, 
-      0,   0,   1,  64,   0,   0, 
-    233,  38,   1,  64,  50,   0, 
-      0,   9,  66,   0,  16,   0, 
-      1,   0,   0,   0,  42,   0, 
-     16,   0,   0,   0,   0,   0, 
-      1,  64,   0,   0, 244, 253, 
-    148,  63,  10,   0,  16,   0, 
-      0,   0,   0,   0,  54,   0, 
-      0,   5, 130,   0,  16,   0, 
-      1,   0,   0,   0,   1,  64, 
-      0,   0,   0,   0, 128,  63, 
-     56,   0,   0,   8, 242,  32, 
-     16,   0,   0,   0,   0,   0, 
-     70,  14,  16,   0,   1,   0, 
-      0,   0,   6, 128,  32,   0, 
-      0,   0,   0,   0,   1,   0, 
-      0,   0,  62,   0,   0,   1, 
-     83,  84,  65,  84, 116,   0, 
-      0,   0,  15,   0,   0,   0, 
-      3,   0,   0,   0,   0,   0, 
-      0,   0,   2,   0,   0,   0, 
-      6,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      1,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   3,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      2,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,  82,  68, 
-     69,  70, 152,   2,   0,   0, 
-      1,   0,   0,   0, 220,   0, 
-      0,   0,   5,   0,   0,   0, 
-     28,   0,   0,   0,   0,   4, 
-    255, 255,   0,   1,   0,   0, 
-    101,   2,   0,   0, 188,   0, 
-      0,   0,   3,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   1,   0, 
-      0,   0,   1,   0,   0,   0, 
-    197,   0,   0,   0,   2,   0, 
-      0,   0,   5,   0,   0,   0, 
-      4,   0,   0,   0, 255, 255, 
-    255, 255,   0,   0,   0,   0, 
-      1,   0,   0,   0,  12,   0, 
-      0,   0, 200,   0,   0,   0, 
-      2,   0,   0,   0,   5,   0, 
-      0,   0,   4,   0,   0,   0, 
-    255, 255, 255, 255,   1,   0, 
-      0,   0,   1,   0,   0,   0, 
-     12,   0,   0,   0, 204,   0, 
-      0,   0,   2,   0,   0,   0, 
-      5,   0,   0,   0,   4,   0, 
-      0,   0, 255, 255, 255, 255, 
-      2,   0,   0,   0,   1,   0, 
-      0,   0,  12,   0,   0,   0, 
-    208,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      1,   0,   0,   0,   0,   0, 
-      0,   0, 115,  83,  97, 109, 
-    112, 108, 101, 114,   0, 116, 
-     89,   0, 116,  67,  98,   0, 
-    116,  67, 114,   0,  36,  71, 
-    108, 111,  98,  97, 108, 115, 
-      0, 171, 171, 171, 208,   0, 
-      0,   0,   8,   0,   0,   0, 
-    244,   0,   0,   0, 224,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0, 180,   1, 
-      0,   0,   0,   0,   0,   0, 
-     16,   0,   0,   0,   0,   0, 
-      0,   0, 192,   1,   0,   0, 
-      0,   0,   0,   0, 208,   1, 
-      0,   0,  16,   0,   0,   0, 
-      4,   0,   0,   0,   2,   0, 
-      0,   0, 224,   1,   0,   0, 
-      0,   0,   0,   0, 240,   1, 
-      0,   0,  32,   0,   0,   0, 
-     64,   0,   0,   0,   0,   0, 
-      0,   0,   0,   2,   0,   0, 
-      0,   0,   0,   0,  16,   2, 
-      0,   0,  96,   0,   0,   0, 
-     64,   0,   0,   0,   0,   0, 
-      0,   0,   0,   2,   0,   0, 
-      0,   0,   0,   0,  28,   2, 
-      0,   0, 160,   0,   0,   0, 
-     16,   0,   0,   0,   0,   0, 
-      0,   0, 192,   1,   0,   0, 
-      0,   0,   0,   0,  48,   2, 
-      0,   0, 176,   0,   0,   0, 
-     16,   0,   0,   0,   0,   0, 
-      0,   0,  64,   2,   0,   0, 
-      0,   0,   0,   0,  80,   2, 
-      0,   0, 192,   0,   0,   0, 
-     16,   0,   0,   0,   0,   0, 
-      0,   0,  64,   2,   0,   0, 
-      0,   0,   0,   0,  91,   2, 
-      0,   0, 208,   0,   0,   0, 
-     16,   0,   0,   0,   0,   0, 
-      0,   0,  64,   2,   0,   0, 
-      0,   0,   0,   0, 102,  76, 
-     97, 121, 101, 114,  67, 111, 
-    108, 111, 114,   0,   1,   0, 
-      3,   0,   1,   0,   4,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0, 102,  76,  97, 121, 
-    101, 114,  79, 112,  97,  99, 
-    105, 116, 121,   0, 171, 171, 
-      0,   0,   3,   0,   1,   0, 
-      1,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0, 109,  76, 
-     97, 121, 101, 114,  84, 114, 
-     97, 110, 115, 102, 111, 114, 
-    109,   0,   3,   0,   3,   0, 
-      4,   0,   4,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-    109,  80, 114, 111, 106, 101, 
-     99, 116, 105, 111, 110,   0, 
-    118,  82, 101, 110, 100, 101, 
-    114,  84,  97, 114, 103, 101, 
-    116,  79, 102, 102, 115, 101, 
-    116,   0, 118,  84, 101, 120, 
-    116, 117, 114, 101,  67, 111, 
-    111, 114, 100, 115,   0, 171, 
-      1,   0,   3,   0,   1,   0, 
-      4,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0, 118,  76, 
-     97, 121, 101, 114,  81, 117, 
-     97, 100,   0, 118,  77,  97, 
-    115, 107,  81, 117,  97, 100, 
-      0,  77, 105,  99, 114, 111, 
-    115, 111, 102, 116,  32,  40, 
-     82,  41,  32,  72,  76,  83, 
-     76,  32,  83, 104,  97, 100, 
-    101, 114,  32,  67, 111, 109, 
-    112, 105, 108, 101, 114,  32, 
-     57,  46,  51,  48,  46,  57, 
-     50,  48,  48,  46,  49,  54, 
-     51,  56,  52,   0,  73,  83, 
-     71,  78,  80,   0,   0,   0, 
-      2,   0,   0,   0,   8,   0, 
-      0,   0,  56,   0,   0,   0, 
-      0,   0,   0,   0,   1,   0, 
-      0,   0,   3,   0,   0,   0, 
-      0,   0,   0,   0,  15,   0, 
-      0,   0,  68,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   3,   0,   0,   0, 
-      1,   0,   0,   0,   3,   3, 
-      0,   0,  83,  86,  95,  80, 
-    111, 115, 105, 116, 105, 111, 
-    110,   0,  84,  69,  88,  67, 
-     79,  79,  82,  68,   0, 171, 
-    171, 171,  79,  83,  71,  78, 
-     44,   0,   0,   0,   1,   0, 
-      0,   0,   8,   0,   0,   0, 
-     32,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      3,   0,   0,   0,   0,   0, 
-      0,   0,  15,   0,   0,   0, 
-     83,  86,  95,  84,  97, 114, 
-    103, 101, 116,   0, 171, 171
-};
-#if 0
-//
-// Generated by Microsoft (R) HLSL Shader Compiler 9.30.9200.16384
-//
-//
-///
-// Buffer Definitions: 
-//
-// cbuffer $Globals
-// {
-//
-//   float4x4 mLayerTransform;          // Offset:    0 Size:    64
-//   float4x4 mProjection;              // Offset:   64 Size:    64
-//   float4 vRenderTargetOffset;        // Offset:  128 Size:    16
-//   float4 vTextureCoords;             // Offset:  144 Size:    16
-//   float4 vLayerQuad;                 // Offset:  160 Size:    16
-//   float4 vMaskQuad;                  // Offset:  176 Size:    16
-//   float4 fLayerColor;                // Offset:  192 Size:    16 [unused]
-//   float fLayerOpacity;               // Offset:  208 Size:     4 [unused]
-//
-// }
-//
-//
-// Resource Bindings:
-//
-// Name                                 Type  Format         Dim Slot Elements
-// ------------------------------ ---------- ------- ----------- ---- --------
-// $Globals                          cbuffer      NA          NA    0        1
-//
-//
-//
-// Input signature:
-//
-// Name                 Index   Mask Register SysValue  Format   Used
-// -------------------- ----- ------ -------- -------- ------- ------
-// POSITION                 0   xy          0     NONE   float   xy  
-//
-//
-// Output signature:
-//
-// Name                 Index   Mask Register SysValue  Format   Used
-// -------------------- ----- ------ -------- -------- ------- ------
-// SV_Position              0   xyzw        0      POS   float   xyzw
-// TEXCOORD                 0   xy          1     NONE   float   xy  
-// TEXCOORD                 1     zw        1     NONE   float     zw
-//
-//
-// Constant buffer to DX9 shader constant mappings:
-//
-// Target Reg Buffer  Start Reg # of Regs        Data Conversion
-// ---------- ------- --------- --------- ----------------------
-// c1         cb0             0         2  ( FLT, FLT, FLT, FLT)
-// c3         cb0             3         9  ( FLT, FLT, FLT, FLT)
-//
-//
-// Runtime generated constant mappings:
-//
-// Target Reg                               Constant Description
-// ---------- --------------------------------------------------
-// c0                              Vertex Shader position offset
-//
-//
-// Level9 shader bytecode:
-//
-    vs_2_x
-    dcl_texcoord v0
-    rcp r0.x, c11.z
-    mad r0.yz, v0.xxyw, c10.xzww, c10.xxyw
-    mul r1, r0.z, c2
-    mad r1, c1, r0.y, r1
-    add r1, r1, c3
-    add r0.yz, r1.xxyw, -c11.xxyw
-    mul oT0.w, r0.x, r0.y
-    rcp r0.x, c11.w
-    mul oT0.z, r0.x, r0.z
-    mad oT0.xy, v0, c9.zwzw, c9
-    rcp r0.x, r1.w
-    mul r1.xyz, r0.x, r1
-    add r0, r1, -c8
-    mul r0.xyz, r0.w, r0
-    mul r1, r0.y, c5
-    mad r1, c4, r0.x, r1
-    mad r1, c6, r0.z, r1
-    mad r0, c7, r0.w, r1
-    mad oPos.xy, r0.w, c0, r0
-    mov oPos.zw, r0
-
-// approximately 20 instruction slots used
-vs_4_0
-dcl_constantbuffer cb0[12], immediateIndexed
-dcl_input v0.xy
-dcl_output_siv o0.xyzw, position
-dcl_output o1.xy
-dcl_output o1.zw
-dcl_temps 2
-mad r0.xy, v0.xyxx, cb0[10].zwzz, cb0[10].xyxx
-mul r1.xyzw, r0.yyyy, cb0[1].xyzw
-mad r0.xyzw, cb0[0].xyzw, r0.xxxx, r1.xyzw
-add r0.xyzw, r0.xyzw, cb0[3].xyzw
-div r1.xyz, r0.xyzx, r0.wwww
-mov r1.w, r0.w
-add r0.xy, r0.xyxx, -cb0[11].xyxx
-div o1.zw, r0.xxxy, cb0[11].zzzw
-add r0.xyzw, r1.xyzw, -cb0[8].xyzw
-mul r0.xyz, r0.wwww, r0.xyzx
-mul r1.xyzw, r0.yyyy, cb0[5].xyzw
-mad r1.xyzw, cb0[4].xyzw, r0.xxxx, r1.xyzw
-mad r1.xyzw, cb0[6].xyzw, r0.zzzz, r1.xyzw
-mad o0.xyzw, cb0[7].xyzw, r0.wwww, r1.xyzw
-mad o1.xy, v0.xyxx, cb0[9].zwzz, cb0[9].xyxx
-ret 
-// Approximately 16 instruction slots used
-#endif
-
-const BYTE LayerQuadMaskVS[] =
-{
-     68,  88,  66,  67, 167, 248, 
-     79,  74, 178,   1,  13, 135, 
-    239, 103,  65, 158,  91, 140, 
-    246,  37,   1,   0,   0,   0, 
-    120,   7,   0,   0,   6,   0, 
-      0,   0,  56,   0,   0,   0, 
-    224,   1,   0,   0,  76,   4, 
-      0,   0, 200,   4,   0,   0, 
-    212,   6,   0,   0,   8,   7, 
-      0,   0,  65, 111, 110,  57, 
-    160,   1,   0,   0, 160,   1, 
-      0,   0,   0,   2, 254, 255, 
-     96,   1,   0,   0,  64,   0, 
-      0,   0,   2,   0,  36,   0, 
-      0,   0,  60,   0,   0,   0, 
-     60,   0,   0,   0,  36,   0, 
-      1,   0,  60,   0,   0,   0, 
-      0,   0,   2,   0,   1,   0, 
-      0,   0,   0,   0,   0,   0, 
-      3,   0,   9,   0,   3,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   1,   2, 254, 255, 
-     31,   0,   0,   2,   5,   0, 
-      0, 128,   0,   0,  15, 144, 
-      6,   0,   0,   2,   0,   0, 
-      1, 128,  11,   0, 170, 160, 
-      4,   0,   0,   4,   0,   0, 
-      6, 128,   0,   0, 208, 144, 
-     10,   0, 248, 160,  10,   0, 
-    208, 160,   5,   0,   0,   3, 
-      1,   0,  15, 128,   0,   0, 
-    170, 128,   2,   0, 228, 160, 
-      4,   0,   0,   4,   1,   0, 
-     15, 128,   1,   0, 228, 160, 
-      0,   0,  85, 128,   1,   0, 
-    228, 128,   2,   0,   0,   3, 
-      1,   0,  15, 128,   1,   0, 
-    228, 128,   3,   0, 228, 160, 
-      2,   0,   0,   3,   0,   0, 
-      6, 128,   1,   0, 208, 128, 
-     11,   0, 208, 161,   5,   0, 
-      0,   3,   0,   0,   8, 224, 
-      0,   0,   0, 128,   0,   0, 
-     85, 128,   6,   0,   0,   2, 
-      0,   0,   1, 128,  11,   0, 
-    255, 160,   5,   0,   0,   3, 
-      0,   0,   4, 224,   0,   0, 
-      0, 128,   0,   0, 170, 128, 
-      4,   0,   0,   4,   0,   0, 
-      3, 224,   0,   0, 228, 144, 
-      9,   0, 238, 160,   9,   0, 
-    228, 160,   6,   0,   0,   2, 
-      0,   0,   1, 128,   1,   0, 
-    255, 128,   5,   0,   0,   3, 
-      1,   0,   7, 128,   0,   0, 
-      0, 128,   1,   0, 228, 128, 
-      2,   0,   0,   3,   0,   0, 
-     15, 128,   1,   0, 228, 128, 
-      8,   0, 228, 161,   5,   0, 
-      0,   3,   0,   0,   7, 128, 
-      0,   0, 255, 128,   0,   0, 
-    228, 128,   5,   0,   0,   3, 
-      1,   0,  15, 128,   0,   0, 
-     85, 128,   5,   0, 228, 160, 
-      4,   0,   0,   4,   1,   0, 
-     15, 128,   4,   0, 228, 160, 
-      0,   0,   0, 128,   1,   0, 
-    228, 128,   4,   0,   0,   4, 
-      1,   0,  15, 128,   6,   0, 
-    228, 160,   0,   0, 170, 128, 
-      1,   0, 228, 128,   4,   0, 
-      0,   4,   0,   0,  15, 128, 
-      7,   0, 228, 160,   0,   0, 
-    255, 128,   1,   0, 228, 128, 
-      4,   0,   0,   4,   0,   0, 
-      3, 192,   0,   0, 255, 128, 
-      0,   0, 228, 160,   0,   0, 
-    228, 128,   1,   0,   0,   2, 
-      0,   0,  12, 192,   0,   0, 
-    228, 128, 255, 255,   0,   0, 
-     83,  72,  68,  82, 100,   2, 
-      0,   0,  64,   0,   1,   0, 
-    153,   0,   0,   0,  89,   0, 
-      0,   4,  70, 142,  32,   0, 
-      0,   0,   0,   0,  12,   0, 
-      0,   0,  95,   0,   0,   3, 
-     50,  16,  16,   0,   0,   0, 
-      0,   0, 103,   0,   0,   4, 
-    242,  32,  16,   0,   0,   0, 
-      0,   0,   1,   0,   0,   0, 
-    101,   0,   0,   3,  50,  32, 
-     16,   0,   1,   0,   0,   0, 
-    101,   0,   0,   3, 194,  32, 
-     16,   0,   1,   0,   0,   0, 
-    104,   0,   0,   2,   2,   0, 
-      0,   0,  50,   0,   0,  11, 
-     50,   0,  16,   0,   0,   0, 
-      0,   0,  70,  16,  16,   0, 
-      0,   0,   0,   0, 230, 138, 
-     32,   0,   0,   0,   0,   0, 
-     10,   0,   0,   0,  70, 128, 
-     32,   0,   0,   0,   0,   0, 
-     10,   0,   0,   0,  56,   0, 
-      0,   8, 242,   0,  16,   0, 
-      1,   0,   0,   0,  86,   5, 
-     16,   0,   0,   0,   0,   0, 
-     70, 142,  32,   0,   0,   0, 
-      0,   0,   1,   0,   0,   0, 
-     50,   0,   0,  10, 242,   0, 
-     16,   0,   0,   0,   0,   0, 
-     70, 142,  32,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      6,   0,  16,   0,   0,   0, 
-      0,   0,  70,  14,  16,   0, 
-      1,   0,   0,   0,   0,   0, 
-      0,   8, 242,   0,  16,   0, 
-      0,   0,   0,   0,  70,  14, 
-     16,   0,   0,   0,   0,   0, 
-     70, 142,  32,   0,   0,   0, 
-      0,   0,   3,   0,   0,   0, 
-     14,   0,   0,   7, 114,   0, 
-     16,   0,   1,   0,   0,   0, 
-     70,   2,  16,   0,   0,   0, 
-      0,   0, 246,  15,  16,   0, 
-      0,   0,   0,   0,  54,   0, 
-      0,   5, 130,   0,  16,   0, 
-      1,   0,   0,   0,  58,   0, 
-     16,   0,   0,   0,   0,   0, 
-      0,   0,   0,   9,  50,   0, 
-     16,   0,   0,   0,   0,   0, 
-     70,   0,  16,   0,   0,   0, 
-      0,   0,  70, 128,  32, 128, 
-     65,   0,   0,   0,   0,   0, 
-      0,   0,  11,   0,   0,   0, 
-     14,   0,   0,   8, 194,  32, 
-     16,   0,   1,   0,   0,   0, 
-      6,   4,  16,   0,   0,   0, 
-      0,   0, 166, 142,  32,   0, 
-      0,   0,   0,   0,  11,   0, 
-      0,   0,   0,   0,   0,   9, 
-    242,   0,  16,   0,   0,   0, 
-      0,   0,  70,  14,  16,   0, 
-      1,   0,   0,   0,  70, 142, 
-     32, 128,  65,   0,   0,   0, 
-      0,   0,   0,   0,   8,   0, 
-      0,   0,  56,   0,   0,   7, 
-    114,   0,  16,   0,   0,   0, 
-      0,   0, 246,  15,  16,   0, 
-      0,   0,   0,   0,  70,   2, 
-     16,   0,   0,   0,   0,   0, 
-     56,   0,   0,   8, 242,   0, 
-     16,   0,   1,   0,   0,   0, 
-     86,   5,  16,   0,   0,   0, 
-      0,   0,  70, 142,  32,   0, 
-      0,   0,   0,   0,   5,   0, 
-      0,   0,  50,   0,   0,  10, 
-    242,   0,  16,   0,   1,   0, 
-      0,   0,  70, 142,  32,   0, 
-      0,   0,   0,   0,   4,   0, 
-      0,   0,   6,   0,  16,   0, 
-      0,   0,   0,   0,  70,  14, 
-     16,   0,   1,   0,   0,   0, 
-     50,   0,   0,  10, 242,   0, 
-     16,   0,   1,   0,   0,   0, 
-     70, 142,  32,   0,   0,   0, 
-      0,   0,   6,   0,   0,   0, 
-    166,  10,  16,   0,   0,   0, 
-      0,   0,  70,  14,  16,   0, 
-      1,   0,   0,   0,  50,   0, 
-      0,  10, 242,  32,  16,   0, 
-      0,   0,   0,   0,  70, 142, 
-     32,   0,   0,   0,   0,   0, 
-      7,   0,   0,   0, 246,  15, 
-     16,   0,   0,   0,   0,   0, 
-     70,  14,  16,   0,   1,   0, 
-      0,   0,  50,   0,   0,  11, 
-     50,  32,  16,   0,   1,   0, 
-      0,   0,  70,  16,  16,   0, 
-      0,   0,   0,   0, 230, 138, 
-     32,   0,   0,   0,   0,   0, 
-      9,   0,   0,   0,  70, 128, 
-     32,   0,   0,   0,   0,   0, 
-      9,   0,   0,   0,  62,   0, 
-      0,   1,  83,  84,  65,  84, 
-    116,   0,   0,   0,  16,   0, 
-      0,   0,   2,   0,   0,   0, 
-      0,   0,   0,   0,   4,   0, 
-      0,   0,   8,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   1,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   2,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-     82,  68,  69,  70,   4,   2, 
-      0,   0,   1,   0,   0,   0, 
-     72,   0,   0,   0,   1,   0, 
-      0,   0,  28,   0,   0,   0, 
-      0,   4, 254, 255,   0,   1, 
-      0,   0, 208,   1,   0,   0, 
-     60,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      1,   0,   0,   0,   0,   0, 
-      0,   0,  36,  71, 108, 111, 
-     98,  97, 108, 115,   0, 171, 
-    171, 171,  60,   0,   0,   0, 
-      8,   0,   0,   0,  96,   0, 
-      0,   0, 224,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,  32,   1,   0,   0, 
-      0,   0,   0,   0,  64,   0, 
-      0,   0,   2,   0,   0,   0, 
-     48,   1,   0,   0,   0,   0, 
-      0,   0,  64,   1,   0,   0, 
-     64,   0,   0,   0,  64,   0, 
-      0,   0,   2,   0,   0,   0, 
-     48,   1,   0,   0,   0,   0, 
-      0,   0,  76,   1,   0,   0, 
-    128,   0,   0,   0,  16,   0, 
-      0,   0,   2,   0,   0,   0, 
-     96,   1,   0,   0,   0,   0, 
-      0,   0, 112,   1,   0,   0, 
-    144,   0,   0,   0,  16,   0, 
-      0,   0,   2,   0,   0,   0, 
-    128,   1,   0,   0,   0,   0, 
-      0,   0, 144,   1,   0,   0, 
-    160,   0,   0,   0,  16,   0, 
-      0,   0,   2,   0,   0,   0, 
-    128,   1,   0,   0,   0,   0, 
-      0,   0, 155,   1,   0,   0, 
-    176,   0,   0,   0,  16,   0, 
-      0,   0,   2,   0,   0,   0, 
-    128,   1,   0,   0,   0,   0, 
-      0,   0, 165,   1,   0,   0, 
-    192,   0,   0,   0,  16,   0, 
-      0,   0,   0,   0,   0,   0, 
-     96,   1,   0,   0,   0,   0, 
-      0,   0, 177,   1,   0,   0, 
-    208,   0,   0,   0,   4,   0, 
-      0,   0,   0,   0,   0,   0, 
-    192,   1,   0,   0,   0,   0, 
-      0,   0, 109,  76,  97, 121, 
-    101, 114,  84, 114,  97, 110, 
-    115, 102, 111, 114, 109,   0, 
-      3,   0,   3,   0,   4,   0, 
-      4,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0, 109,  80, 
-    114, 111, 106, 101,  99, 116, 
-    105, 111, 110,   0, 118,  82, 
-    101, 110, 100, 101, 114,  84, 
-     97, 114, 103, 101, 116,  79, 
-    102, 102, 115, 101, 116,   0, 
-      1,   0,   3,   0,   1,   0, 
-      4,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0, 118,  84, 
-    101, 120, 116, 117, 114, 101, 
-     67, 111, 111, 114, 100, 115, 
-      0, 171,   1,   0,   3,   0, 
-      1,   0,   4,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-    118,  76,  97, 121, 101, 114, 
-     81, 117,  97, 100,   0, 118, 
-     77,  97, 115, 107,  81, 117, 
-     97, 100,   0, 102,  76,  97, 
-    121, 101, 114,  67, 111, 108, 
-    111, 114,   0, 102,  76,  97, 
-    121, 101, 114,  79, 112,  97, 
-     99, 105, 116, 121,   0, 171, 
-      0,   0,   3,   0,   1,   0, 
-      1,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,  77, 105, 
-     99, 114, 111, 115, 111, 102, 
-    116,  32,  40,  82,  41,  32, 
-     72,  76,  83,  76,  32,  83, 
-    104,  97, 100, 101, 114,  32, 
-     67, 111, 109, 112, 105, 108, 
-    101, 114,  32,  57,  46,  51, 
-     48,  46,  57,  50,  48,  48, 
-     46,  49,  54,  51,  56,  52, 
-      0, 171,  73,  83,  71,  78, 
-     44,   0,   0,   0,   1,   0, 
-      0,   0,   8,   0,   0,   0, 
-     32,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      3,   0,   0,   0,   0,   0, 
-      0,   0,   3,   3,   0,   0, 
-     80,  79,  83,  73,  84,  73, 
-     79,  78,   0, 171, 171, 171, 
-     79,  83,  71,  78, 104,   0, 
-      0,   0,   3,   0,   0,   0, 
-      8,   0,   0,   0,  80,   0, 
-      0,   0,   0,   0,   0,   0, 
-      1,   0,   0,   0,   3,   0, 
-      0,   0,   0,   0,   0,   0, 
-     15,   0,   0,   0,  92,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   3,   0, 
-      0,   0,   1,   0,   0,   0, 
-      3,  12,   0,   0,  92,   0, 
-      0,   0,   1,   0,   0,   0, 
-      0,   0,   0,   0,   3,   0, 
-      0,   0,   1,   0,   0,   0, 
-     12,   3,   0,   0,  83,  86, 
-     95,  80, 111, 115, 105, 116, 
-    105, 111, 110,   0,  84,  69, 
-     88,  67,  79,  79,  82,  68, 
-      0, 171, 171, 171
-};
-#if 0
-//
-// Generated by Microsoft (R) HLSL Shader Compiler 9.30.9200.16384
-//
-//
-///
-// Buffer Definitions: 
-//
-// cbuffer $Globals
-// {
-//
-//   float4x4 mLayerTransform;          // Offset:    0 Size:    64
-//   float4x4 mProjection;              // Offset:   64 Size:    64
-//   float4 vRenderTargetOffset;        // Offset:  128 Size:    16
-//   float4 vTextureCoords;             // Offset:  144 Size:    16
-//   float4 vLayerQuad;                 // Offset:  160 Size:    16
-//   float4 vMaskQuad;                  // Offset:  176 Size:    16
-//   float4 fLayerColor;                // Offset:  192 Size:    16 [unused]
-//   float fLayerOpacity;               // Offset:  208 Size:     4 [unused]
-//
-// }
-//
-//
-// Resource Bindings:
-//
-// Name                                 Type  Format         Dim Slot Elements
-// ------------------------------ ---------- ------- ----------- ---- --------
-// $Globals                          cbuffer      NA          NA    0        1
-//
-//
-//
-// Input signature:
-//
-// Name                 Index   Mask Register SysValue  Format   Used
-// -------------------- ----- ------ -------- -------- ------- ------
-// POSITION                 0   xy          0     NONE   float   xy  
-//
-//
-// Output signature:
-//
-// Name                 Index   Mask Register SysValue  Format   Used
-// -------------------- ----- ------ -------- -------- ------- ------
-// SV_Position              0   xyzw        0      POS   float   xyzw
-// TEXCOORD                 0   xy          1     NONE   float   xy  
-// TEXCOORD                 1   xyz         2     NONE   float   xyz 
-//
-//
-// Constant buffer to DX9 shader constant mappings:
-//
-// Target Reg Buffer  Start Reg # of Regs        Data Conversion
-// ---------- ------- --------- --------- ----------------------
-// c1         cb0             0         2  ( FLT, FLT, FLT, FLT)
-// c3         cb0             3         9  ( FLT, FLT, FLT, FLT)
-//
-//
-// Runtime generated constant mappings:
-//
-// Target Reg                               Constant Description
-// ---------- --------------------------------------------------
-// c0                              Vertex Shader position offset
-//
-//
-// Level9 shader bytecode:
-//
-    vs_2_x
-    def c12, 1, 0, 0, 0
-    dcl_texcoord v0
-    mov r0.z, c12.x
-    rcp r0.w, c11.z
-    mad r1.xy, v0, c10.zwzw, c10
-    mul r2, r1.y, c2
-    mad r1, c1, r1.x, r2
-    add r1, r1, c3
-    rcp r2.x, r1.w
-    mad r2.yz, r1.xxyw, r2.x, -c11.xxyw
-    mul r1.xyz, r1, r2.x
-    mul r0.x, r0.w, r2.y
-    rcp r0.w, c11.w
-    mul r0.y, r0.w, r2.z
-    mul oT1.xyz, r0, r1.w
-    add r0, r1, -c8
-    mad oT0.xy, v0, c9.zwzw, c9
-    mul r0.xyz, r0.w, r0
-    mul r1, r0.y, c5
-    mad r1, c4, r0.x, r1
-    mad r1, c6, r0.z, r1
-    mad r0, c7, r0.w, r1
-    mad oPos.xy, r0.w, c0, r0
-    mov oPos.zw, r0
-
-// approximately 22 instruction slots used
-vs_4_0
-dcl_constantbuffer cb0[12], immediateIndexed
-dcl_input v0.xy
-dcl_output_siv o0.xyzw, position
-dcl_output o1.xy
-dcl_output o2.xyz
-dcl_temps 3
-mad r0.xy, v0.xyxx, cb0[10].zwzz, cb0[10].xyxx
-mul r1.xyzw, r0.yyyy, cb0[1].xyzw
-mad r0.xyzw, cb0[0].xyzw, r0.xxxx, r1.xyzw
-add r0.xyzw, r0.xyzw, cb0[3].xyzw
-div r0.xyz, r0.xyzx, r0.wwww
-add r1.xyzw, r0.xyzw, -cb0[8].xyzw
-add r0.xy, r0.xyxx, -cb0[11].xyxx
-div r0.xy, r0.xyxx, cb0[11].zwzz
-mul r1.xyz, r1.wwww, r1.xyzx
-mul r2.xyzw, r1.yyyy, cb0[5].xyzw
-mad r2.xyzw, cb0[4].xyzw, r1.xxxx, r2.xyzw
-mad r2.xyzw, cb0[6].xyzw, r1.zzzz, r2.xyzw
-mad o0.xyzw, cb0[7].xyzw, r1.wwww, r2.xyzw
-mad o1.xy, v0.xyxx, cb0[9].zwzz, cb0[9].xyxx
-mov r0.z, l(1.000000)
-mul o2.xyz, r0.wwww, r0.xyzx
-ret 
-// Approximately 17 instruction slots used
-#endif
-
-const BYTE LayerQuadMask3DVS[] =
-{
-     68,  88,  66,  67, 234,   2, 
-    223, 111, 248, 181, 149,  35, 
-    240, 168, 244,  78, 104,  97, 
-    237,  63,   1,   0,   0,   0, 
-    204,   7,   0,   0,   6,   0, 
-      0,   0,  56,   0,   0,   0, 
-     24,   2,   0,   0, 160,   4, 
-      0,   0,  28,   5,   0,   0, 
-     40,   7,   0,   0,  92,   7, 
-      0,   0,  65, 111, 110,  57, 
-    216,   1,   0,   0, 216,   1, 
-      0,   0,   0,   2, 254, 255, 
-    152,   1,   0,   0,  64,   0, 
-      0,   0,   2,   0,  36,   0, 
-      0,   0,  60,   0,   0,   0, 
-     60,   0,   0,   0,  36,   0, 
-      1,   0,  60,   0,   0,   0, 
-      0,   0,   2,   0,   1,   0, 
-      0,   0,   0,   0,   0,   0, 
-      3,   0,   9,   0,   3,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   1,   2, 254, 255, 
-     81,   0,   0,   5,  12,   0, 
-     15, 160,   0,   0, 128,  63, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-     31,   0,   0,   2,   5,   0, 
-      0, 128,   0,   0,  15, 144, 
-      1,   0,   0,   2,   0,   0, 
-      4, 128,  12,   0,   0, 160, 
-      6,   0,   0,   2,   0,   0, 
-      8, 128,  11,   0, 170, 160, 
-      4,   0,   0,   4,   1,   0, 
-      3, 128,   0,   0, 228, 144, 
-     10,   0, 238, 160,  10,   0, 
-    228, 160,   5,   0,   0,   3, 
-      2,   0,  15, 128,   1,   0, 
-     85, 128,   2,   0, 228, 160, 
-      4,   0,   0,   4,   1,   0, 
-     15, 128,   1,   0, 228, 160, 
-      1,   0,   0, 128,   2,   0, 
-    228, 128,   2,   0,   0,   3, 
-      1,   0,  15, 128,   1,   0, 
-    228, 128,   3,   0, 228, 160, 
-      6,   0,   0,   2,   2,   0, 
-      1, 128,   1,   0, 255, 128, 
-      4,   0,   0,   4,   2,   0, 
-      6, 128,   1,   0, 208, 128, 
-      2,   0,   0, 128,  11,   0, 
-    208, 161,   5,   0,   0,   3, 
-      1,   0,   7, 128,   1,   0, 
-    228, 128,   2,   0,   0, 128, 
-      5,   0,   0,   3,   0,   0, 
-      1, 128,   0,   0, 255, 128, 
-      2,   0,  85, 128,   6,   0, 
-      0,   2,   0,   0,   8, 128, 
-     11,   0, 255, 160,   5,   0, 
-      0,   3,   0,   0,   2, 128, 
-      0,   0, 255, 128,   2,   0, 
-    170, 128,   5,   0,   0,   3, 
-      1,   0,   7, 224,   0,   0, 
-    228, 128,   1,   0, 255, 128, 
-      2,   0,   0,   3,   0,   0, 
-     15, 128,   1,   0, 228, 128, 
-      8,   0, 228, 161,   4,   0, 
-      0,   4,   0,   0,   3, 224, 
-      0,   0, 228, 144,   9,   0, 
-    238, 160,   9,   0, 228, 160, 
-      5,   0,   0,   3,   0,   0, 
-      7, 128,   0,   0, 255, 128, 
-      0,   0, 228, 128,   5,   0, 
-      0,   3,   1,   0,  15, 128, 
-      0,   0,  85, 128,   5,   0, 
-    228, 160,   4,   0,   0,   4, 
-      1,   0,  15, 128,   4,   0, 
-    228, 160,   0,   0,   0, 128, 
-      1,   0, 228, 128,   4,   0, 
-      0,   4,   1,   0,  15, 128, 
-      6,   0, 228, 160,   0,   0, 
-    170, 128,   1,   0, 228, 128, 
-      4,   0,   0,   4,   0,   0, 
-     15, 128,   7,   0, 228, 160, 
-      0,   0, 255, 128,   1,   0, 
-    228, 128,   4,   0,   0,   4, 
-      0,   0,   3, 192,   0,   0, 
-    255, 128,   0,   0, 228, 160, 
-      0,   0, 228, 128,   1,   0, 
-      0,   2,   0,   0,  12, 192, 
-      0,   0, 228, 128, 255, 255, 
-      0,   0,  83,  72,  68,  82, 
-    128,   2,   0,   0,  64,   0, 
-      1,   0, 160,   0,   0,   0, 
-     89,   0,   0,   4,  70, 142, 
-     32,   0,   0,   0,   0,   0, 
-     12,   0,   0,   0,  95,   0, 
-      0,   3,  50,  16,  16,   0, 
-      0,   0,   0,   0, 103,   0, 
-      0,   4, 242,  32,  16,   0, 
-      0,   0,   0,   0,   1,   0, 
-      0,   0, 101,   0,   0,   3, 
-     50,  32,  16,   0,   1,   0, 
-      0,   0, 101,   0,   0,   3, 
-    114,  32,  16,   0,   2,   0, 
-      0,   0, 104,   0,   0,   2, 
-      3,   0,   0,   0,  50,   0, 
-      0,  11,  50,   0,  16,   0, 
-      0,   0,   0,   0,  70,  16, 
-     16,   0,   0,   0,   0,   0, 
-    230, 138,  32,   0,   0,   0, 
-      0,   0,  10,   0,   0,   0, 
-     70, 128,  32,   0,   0,   0, 
-      0,   0,  10,   0,   0,   0, 
-     56,   0,   0,   8, 242,   0, 
-     16,   0,   1,   0,   0,   0, 
-     86,   5,  16,   0,   0,   0, 
-      0,   0,  70, 142,  32,   0, 
-      0,   0,   0,   0,   1,   0, 
-      0,   0,  50,   0,   0,  10, 
-    242,   0,  16,   0,   0,   0, 
-      0,   0,  70, 142,  32,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   6,   0,  16,   0, 
-      0,   0,   0,   0,  70,  14, 
-     16,   0,   1,   0,   0,   0, 
-      0,   0,   0,   8, 242,   0, 
-     16,   0,   0,   0,   0,   0, 
-     70,  14,  16,   0,   0,   0, 
-      0,   0,  70, 142,  32,   0, 
-      0,   0,   0,   0,   3,   0, 
-      0,   0,  14,   0,   0,   7, 
-    114,   0,  16,   0,   0,   0, 
-      0,   0,  70,   2,  16,   0, 
-      0,   0,   0,   0, 246,  15, 
-     16,   0,   0,   0,   0,   0, 
-      0,   0,   0,   9, 242,   0, 
-     16,   0,   1,   0,   0,   0, 
-     70,  14,  16,   0,   0,   0, 
-      0,   0,  70, 142,  32, 128, 
-     65,   0,   0,   0,   0,   0, 
-      0,   0,   8,   0,   0,   0, 
-      0,   0,   0,   9,  50,   0, 
-     16,   0,   0,   0,   0,   0, 
-     70,   0,  16,   0,   0,   0, 
-      0,   0,  70, 128,  32, 128, 
-     65,   0,   0,   0,   0,   0, 
-      0,   0,  11,   0,   0,   0, 
-     14,   0,   0,   8,  50,   0, 
-     16,   0,   0,   0,   0,   0, 
-     70,   0,  16,   0,   0,   0, 
-      0,   0, 230, 138,  32,   0, 
-      0,   0,   0,   0,  11,   0, 
-      0,   0,  56,   0,   0,   7, 
-    114,   0,  16,   0,   1,   0, 
-      0,   0, 246,  15,  16,   0, 
-      1,   0,   0,   0,  70,   2, 
-     16,   0,   1,   0,   0,   0, 
-     56,   0,   0,   8, 242,   0, 
-     16,   0,   2,   0,   0,   0, 
-     86,   5,  16,   0,   1,   0, 
-      0,   0,  70, 142,  32,   0, 
-      0,   0,   0,   0,   5,   0, 
-      0,   0,  50,   0,   0,  10, 
-    242,   0,  16,   0,   2,   0, 
-      0,   0,  70, 142,  32,   0, 
-      0,   0,   0,   0,   4,   0, 
-      0,   0,   6,   0,  16,   0, 
-      1,   0,   0,   0,  70,  14, 
-     16,   0,   2,   0,   0,   0, 
-     50,   0,   0,  10, 242,   0, 
-     16,   0,   2,   0,   0,   0, 
-     70, 142,  32,   0,   0,   0, 
-      0,   0,   6,   0,   0,   0, 
-    166,  10,  16,   0,   1,   0, 
-      0,   0,  70,  14,  16,   0, 
-      2,   0,   0,   0,  50,   0, 
-      0,  10, 242,  32,  16,   0, 
-      0,   0,   0,   0,  70, 142, 
-     32,   0,   0,   0,   0,   0, 
-      7,   0,   0,   0, 246,  15, 
-     16,   0,   1,   0,   0,   0, 
-     70,  14,  16,   0,   2,   0, 
-      0,   0,  50,   0,   0,  11, 
-     50,  32,  16,   0,   1,   0, 
-      0,   0,  70,  16,  16,   0, 
-      0,   0,   0,   0, 230, 138, 
-     32,   0,   0,   0,   0,   0, 
-      9,   0,   0,   0,  70, 128, 
-     32,   0,   0,   0,   0,   0, 
-      9,   0,   0,   0,  54,   0, 
-      0,   5,  66,   0,  16,   0, 
-      0,   0,   0,   0,   1,  64, 
-      0,   0,   0,   0, 128,  63, 
-     56,   0,   0,   7, 114,  32, 
-     16,   0,   2,   0,   0,   0, 
-    246,  15,  16,   0,   0,   0, 
-      0,   0,  70,   2,  16,   0, 
-      0,   0,   0,   0,  62,   0, 
-      0,   1,  83,  84,  65,  84, 
-    116,   0,   0,   0,  17,   0, 
-      0,   0,   3,   0,   0,   0, 
-      0,   0,   0,   0,   4,   0, 
-      0,   0,   9,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   1,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   3,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-     82,  68,  69,  70,   4,   2, 
-      0,   0,   1,   0,   0,   0, 
-     72,   0,   0,   0,   1,   0, 
-      0,   0,  28,   0,   0,   0, 
-      0,   4, 254, 255,   0,   1, 
-      0,   0, 208,   1,   0,   0, 
-     60,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      1,   0,   0,   0,   0,   0, 
-      0,   0,  36,  71, 108, 111, 
-     98,  97, 108, 115,   0, 171, 
-    171, 171,  60,   0,   0,   0, 
-      8,   0,   0,   0,  96,   0, 
-      0,   0, 224,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,  32,   1,   0,   0, 
-      0,   0,   0,   0,  64,   0, 
-      0,   0,   2,   0,   0,   0, 
-     48,   1,   0,   0,   0,   0, 
-      0,   0,  64,   1,   0,   0, 
-     64,   0,   0,   0,  64,   0, 
-      0,   0,   2,   0,   0,   0, 
-     48,   1,   0,   0,   0,   0, 
-      0,   0,  76,   1,   0,   0, 
-    128,   0,   0,   0,  16,   0, 
-      0,   0,   2,   0,   0,   0, 
-     96,   1,   0,   0,   0,   0, 
-      0,   0, 112,   1,   0,   0, 
-    144,   0,   0,   0,  16,   0, 
-      0,   0,   2,   0,   0,   0, 
-    128,   1,   0,   0,   0,   0, 
-      0,   0, 144,   1,   0,   0, 
-    160,   0,   0,   0,  16,   0, 
-      0,   0,   2,   0,   0,   0, 
-    128,   1,   0,   0,   0,   0, 
-      0,   0, 155,   1,   0,   0, 
-    176,   0,   0,   0,  16,   0, 
-      0,   0,   2,   0,   0,   0, 
-    128,   1,   0,   0,   0,   0, 
-      0,   0, 165,   1,   0,   0, 
-    192,   0,   0,   0,  16,   0, 
-      0,   0,   0,   0,   0,   0, 
-     96,   1,   0,   0,   0,   0, 
-      0,   0, 177,   1,   0,   0, 
-    208,   0,   0,   0,   4,   0, 
-      0,   0,   0,   0,   0,   0, 
-    192,   1,   0,   0,   0,   0, 
-      0,   0, 109,  76,  97, 121, 
-    101, 114,  84, 114,  97, 110, 
-    115, 102, 111, 114, 109,   0, 
-      3,   0,   3,   0,   4,   0, 
-      4,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0, 109,  80, 
-    114, 111, 106, 101,  99, 116, 
-    105, 111, 110,   0, 118,  82, 
-    101, 110, 100, 101, 114,  84, 
-     97, 114, 103, 101, 116,  79, 
-    102, 102, 115, 101, 116,   0, 
-      1,   0,   3,   0,   1,   0, 
-      4,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0, 118,  84, 
-    101, 120, 116, 117, 114, 101, 
-     67, 111, 111, 114, 100, 115, 
-      0, 171,   1,   0,   3,   0, 
-      1,   0,   4,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-    118,  76,  97, 121, 101, 114, 
-     81, 117,  97, 100,   0, 118, 
-     77,  97, 115, 107,  81, 117, 
-     97, 100,   0, 102,  76,  97, 
-    121, 101, 114,  67, 111, 108, 
-    111, 114,   0, 102,  76,  97, 
-    121, 101, 114,  79, 112,  97, 
-     99, 105, 116, 121,   0, 171, 
-      0,   0,   3,   0,   1,   0, 
-      1,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,  77, 105, 
-     99, 114, 111, 115, 111, 102, 
-    116,  32,  40,  82,  41,  32, 
-     72,  76,  83,  76,  32,  83, 
-    104,  97, 100, 101, 114,  32, 
-     67, 111, 109, 112, 105, 108, 
-    101, 114,  32,  57,  46,  51, 
-     48,  46,  57,  50,  48,  48, 
-     46,  49,  54,  51,  56,  52, 
-      0, 171,  73,  83,  71,  78, 
-     44,   0,   0,   0,   1,   0, 
-      0,   0,   8,   0,   0,   0, 
-     32,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      3,   0,   0,   0,   0,   0, 
-      0,   0,   3,   3,   0,   0, 
-     80,  79,  83,  73,  84,  73, 
-     79,  78,   0, 171, 171, 171, 
-     79,  83,  71,  78, 104,   0, 
-      0,   0,   3,   0,   0,   0, 
-      8,   0,   0,   0,  80,   0, 
-      0,   0,   0,   0,   0,   0, 
-      1,   0,   0,   0,   3,   0, 
-      0,   0,   0,   0,   0,   0, 
-     15,   0,   0,   0,  92,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   3,   0, 
-      0,   0,   1,   0,   0,   0, 
-      3,  12,   0,   0,  92,   0, 
-      0,   0,   1,   0,   0,   0, 
-      0,   0,   0,   0,   3,   0, 
-      0,   0,   2,   0,   0,   0, 
-      7,   8,   0,   0,  83,  86, 
-     95,  80, 111, 115, 105, 116, 
-    105, 111, 110,   0,  84,  69, 
-     88,  67,  79,  79,  82,  68, 
-      0, 171, 171, 171
-};
-#if 0
-//
-// Generated by Microsoft (R) HLSL Shader Compiler 9.30.9200.16384
-//
-//
-///
-// Buffer Definitions: 
-//
-// cbuffer $Globals
-// {
-//
-//   float4 fLayerColor;                // Offset:    0 Size:    16
-//   float fLayerOpacity;               // Offset:   16 Size:     4 [unused]
-//   float4x4 mLayerTransform;          // Offset:   32 Size:    64 [unused]
-//   float4x4 mProjection;              // Offset:   96 Size:    64 [unused]
-//   float4 vRenderTargetOffset;        // Offset:  160 Size:    16 [unused]
-//   float4 vTextureCoords;             // Offset:  176 Size:    16 [unused]
-//   float4 vLayerQuad;                 // Offset:  192 Size:    16 [unused]
-//   float4 vMaskQuad;                  // Offset:  208 Size:    16 [unused]
-//
-// }
-//
-//
-// Resource Bindings:
-//
-// Name                                 Type  Format         Dim Slot Elements
-// ------------------------------ ---------- ------- ----------- ---- --------
-// sSampler                          sampler      NA          NA    0        1
-// tMask                             texture  float4          2d    3        1
-// $Globals                          cbuffer      NA          NA    0        1
-//
-//
-//
-// Input signature:
-//
-// Name                 Index   Mask Register SysValue  Format   Used
-// -------------------- ----- ------ -------- -------- ------- ------
-// SV_Position              0   xyzw        0      POS   float       
-// TEXCOORD                 0   xy          1     NONE   float       
-// TEXCOORD                 1     zw        1     NONE   float     zw
-//
-//
-// Output signature:
-//
-// Name                 Index   Mask Register SysValue  Format   Used
-// -------------------- ----- ------ -------- -------- ------- ------
-// SV_Target                0   xyzw        0   TARGET   float   xyzw
-//
-//
-// Constant buffer to DX9 shader constant mappings:
-//
-// Target Reg Buffer  Start Reg # of Regs        Data Conversion
-// ---------- ------- --------- --------- ----------------------
-// c0         cb0             0         1  ( FLT, FLT, FLT, FLT)
-//
-//
-// Sampler/Resource to DX9 shader sampler mappings:
-//
-// Target Sampler Source Sampler  Source Resource
-// -------------- --------------- ----------------
-// s0             s0              t3               
-//
-//
-// Level9 shader bytecode:
-//
-    ps_2_x
-    dcl t0
-    dcl_2d s0
-    mov r0.xy, t0.wzzw
-    texld r0, r0, s0
-    mul r0, r0.w, c0
-    mov oC0, r0
-
-// approximately 4 instruction slots used (1 texture, 3 arithmetic)
-ps_4_0
-dcl_constantbuffer cb0[1], immediateIndexed
-dcl_sampler s0, mode_default
-dcl_resource_texture2d (float,float,float,float) t3
-dcl_input_ps linear v1.zw
-dcl_output o0.xyzw
-dcl_temps 1
-sample r0.xyzw, v1.zwzz, t3.xyzw, s0
-mul o0.xyzw, r0.wwww, cb0[0].xyzw
-ret 
-// Approximately 3 instruction slots used
-#endif
-
-const BYTE SolidColorShaderMask[] =
-{
-     68,  88,  66,  67,  67, 229, 
-     95, 173, 189,  65, 206,  59, 
-      8, 158, 216, 194,  18, 158, 
-    142, 146,   1,   0,   0,   0, 
-    232,   4,   0,   0,   6,   0, 
-      0,   0,  56,   0,   0,   0, 
-    204,   0,   0,   0, 112,   1, 
-      0,   0, 236,   1,   0,   0, 
-     68,   4,   0,   0, 180,   4, 
-      0,   0,  65, 111, 110,  57, 
-    140,   0,   0,   0, 140,   0, 
-      0,   0,   0,   2, 255, 255, 
-     88,   0,   0,   0,  52,   0, 
-      0,   0,   1,   0,  40,   0, 
-      0,   0,  52,   0,   0,   0, 
-     52,   0,   1,   0,  36,   0, 
-      0,   0,  52,   0,   3,   0, 
-      0,   0,   0,   0,   0,   0, 
-      1,   0,   0,   0,   0,   0, 
-      0,   0,   1,   2, 255, 255, 
-     31,   0,   0,   2,   0,   0, 
-      0, 128,   0,   0,  15, 176, 
-     31,   0,   0,   2,   0,   0, 
-      0, 144,   0,   8,  15, 160, 
-      1,   0,   0,   2,   0,   0, 
-      3, 128,   0,   0, 235, 176, 
-     66,   0,   0,   3,   0,   0, 
-     15, 128,   0,   0, 228, 128, 
-      0,   8, 228, 160,   5,   0, 
-      0,   3,   0,   0,  15, 128, 
-      0,   0, 255, 128,   0,   0, 
-    228, 160,   1,   0,   0,   2, 
-      0,   8,  15, 128,   0,   0, 
-    228, 128, 255, 255,   0,   0, 
-     83,  72,  68,  82, 156,   0, 
-      0,   0,  64,   0,   0,   0, 
-     39,   0,   0,   0,  89,   0, 
-      0,   4,  70, 142,  32,   0, 
-      0,   0,   0,   0,   1,   0, 
-      0,   0,  90,   0,   0,   3, 
-      0,  96,  16,   0,   0,   0, 
-      0,   0,  88,  24,   0,   4, 
-      0, 112,  16,   0,   3,   0, 
-      0,   0,  85,  85,   0,   0, 
-     98,  16,   0,   3, 194,  16, 
-     16,   0,   1,   0,   0,   0, 
-    101,   0,   0,   3, 242,  32, 
-     16,   0,   0,   0,   0,   0, 
-    104,   0,   0,   2,   1,   0, 
-      0,   0,  69,   0,   0,   9, 
-    242,   0,  16,   0,   0,   0, 
-      0,   0, 230,  26,  16,   0, 
-      1,   0,   0,   0,  70, 126, 
-     16,   0,   3,   0,   0,   0, 
-      0,  96,  16,   0,   0,   0, 
-      0,   0,  56,   0,   0,   8, 
-    242,  32,  16,   0,   0,   0, 
-      0,   0, 246,  15,  16,   0, 
-      0,   0,   0,   0,  70, 142, 
-     32,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,  62,   0, 
-      0,   1,  83,  84,  65,  84, 
-    116,   0,   0,   0,   3,   0, 
-      0,   0,   1,   0,   0,   0, 
-      0,   0,   0,   0,   2,   0, 
-      0,   0,   1,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   1,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      1,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   1,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-     82,  68,  69,  70,  80,   2, 
-      0,   0,   1,   0,   0,   0, 
-    148,   0,   0,   0,   3,   0, 
-      0,   0,  28,   0,   0,   0, 
-      0,   4, 255, 255,   0,   1, 
-      0,   0,  29,   2,   0,   0, 
-    124,   0,   0,   0,   3,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      1,   0,   0,   0,   1,   0, 
-      0,   0, 133,   0,   0,   0, 
-      2,   0,   0,   0,   5,   0, 
-      0,   0,   4,   0,   0,   0, 
-    255, 255, 255, 255,   3,   0, 
-      0,   0,   1,   0,   0,   0, 
-     13,   0,   0,   0, 139,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   1,   0, 
-      0,   0,   0,   0,   0,   0, 
-    115,  83,  97, 109, 112, 108, 
-    101, 114,   0, 116,  77,  97, 
-    115, 107,   0,  36,  71, 108, 
-    111,  98,  97, 108, 115,   0, 
-    139,   0,   0,   0,   8,   0, 
-      0,   0, 172,   0,   0,   0, 
-    224,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-    108,   1,   0,   0,   0,   0, 
-      0,   0,  16,   0,   0,   0, 
-      2,   0,   0,   0, 120,   1, 
-      0,   0,   0,   0,   0,   0, 
-    136,   1,   0,   0,  16,   0, 
-      0,   0,   4,   0,   0,   0, 
-      0,   0,   0,   0, 152,   1, 
-      0,   0,   0,   0,   0,   0, 
-    168,   1,   0,   0,  32,   0, 
-      0,   0,  64,   0,   0,   0, 
-      0,   0,   0,   0, 184,   1, 
-      0,   0,   0,   0,   0,   0, 
-    200,   1,   0,   0,  96,   0, 
-      0,   0,  64,   0,   0,   0, 
-      0,   0,   0,   0, 184,   1, 
-      0,   0,   0,   0,   0,   0, 
-    212,   1,   0,   0, 160,   0, 
-      0,   0,  16,   0,   0,   0, 
-      0,   0,   0,   0, 120,   1, 
-      0,   0,   0,   0,   0,   0, 
-    232,   1,   0,   0, 176,   0, 
-      0,   0,  16,   0,   0,   0, 
-      0,   0,   0,   0, 248,   1, 
-      0,   0,   0,   0,   0,   0, 
-      8,   2,   0,   0, 192,   0, 
-      0,   0,  16,   0,   0,   0, 
-      0,   0,   0,   0, 248,   1, 
-      0,   0,   0,   0,   0,   0, 
-     19,   2,   0,   0, 208,   0, 
-      0,   0,  16,   0,   0,   0, 
-      0,   0,   0,   0, 248,   1, 
-      0,   0,   0,   0,   0,   0, 
-    102,  76,  97, 121, 101, 114, 
-     67, 111, 108, 111, 114,   0, 
-      1,   0,   3,   0,   1,   0, 
-      4,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0, 102,  76, 
-     97, 121, 101, 114,  79, 112, 
-     97,  99, 105, 116, 121,   0, 
-    171, 171,   0,   0,   3,   0, 
-      1,   0,   1,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-    109,  76,  97, 121, 101, 114, 
-     84, 114,  97, 110, 115, 102, 
-    111, 114, 109,   0,   3,   0, 
-      3,   0,   4,   0,   4,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0, 109,  80, 114, 111, 
-    106, 101,  99, 116, 105, 111, 
-    110,   0, 118,  82, 101, 110, 
-    100, 101, 114,  84,  97, 114, 
-    103, 101, 116,  79, 102, 102, 
-    115, 101, 116,   0, 118,  84, 
-    101, 120, 116, 117, 114, 101, 
-     67, 111, 111, 114, 100, 115, 
-      0, 171,   1,   0,   3,   0, 
-      1,   0,   4,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-    118,  76,  97, 121, 101, 114, 
-     81, 117,  97, 100,   0, 118, 
-     77,  97, 115, 107,  81, 117, 
-     97, 100,   0,  77, 105,  99, 
-    114, 111, 115, 111, 102, 116, 
-     32,  40,  82,  41,  32,  72, 
-     76,  83,  76,  32,  83, 104, 
-     97, 100, 101, 114,  32,  67, 
-    111, 109, 112, 105, 108, 101, 
-    114,  32,  57,  46,  51,  48, 
-     46,  57,  50,  48,  48,  46, 
-     49,  54,  51,  56,  52,   0, 
-     73,  83,  71,  78, 104,   0, 
-      0,   0,   3,   0,   0,   0, 
-      8,   0,   0,   0,  80,   0, 
-      0,   0,   0,   0,   0,   0, 
-      1,   0,   0,   0,   3,   0, 
-      0,   0,   0,   0,   0,   0, 
-     15,   0,   0,   0,  92,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   3,   0, 
-      0,   0,   1,   0,   0,   0, 
-      3,   0,   0,   0,  92,   0, 
-      0,   0,   1,   0,   0,   0, 
-      0,   0,   0,   0,   3,   0, 
-      0,   0,   1,   0,   0,   0, 
-     12,  12,   0,   0,  83,  86, 
-     95,  80, 111, 115, 105, 116, 
-    105, 111, 110,   0,  84,  69, 
-     88,  67,  79,  79,  82,  68, 
-      0, 171, 171, 171,  79,  83, 
-     71,  78,  44,   0,   0,   0, 
-      1,   0,   0,   0,   8,   0, 
-      0,   0,  32,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   3,   0,   0,   0, 
-      0,   0,   0,   0,  15,   0, 
-      0,   0,  83,  86,  95,  84, 
-     97, 114, 103, 101, 116,   0, 
-    171, 171
-};
-#if 0
-//
-// Generated by Microsoft (R) HLSL Shader Compiler 9.30.9200.16384
-//
-//
-///
-// Buffer Definitions: 
-//
-// cbuffer $Globals
-// {
-//
-//   float4 fLayerColor;                // Offset:    0 Size:    16 [unused]
-//   float fLayerOpacity;               // Offset:   16 Size:     4
-//   float4x4 mLayerTransform;          // Offset:   32 Size:    64 [unused]
-//   float4x4 mProjection;              // Offset:   96 Size:    64 [unused]
-//   float4 vRenderTargetOffset;        // Offset:  160 Size:    16 [unused]
-//   float4 vTextureCoords;             // Offset:  176 Size:    16 [unused]
-//   float4 vLayerQuad;                 // Offset:  192 Size:    16 [unused]
-//   float4 vMaskQuad;                  // Offset:  208 Size:    16 [unused]
-//
-// }
-//
-//
-// Resource Bindings:
-//
-// Name                                 Type  Format         Dim Slot Elements
-// ------------------------------ ---------- ------- ----------- ---- --------
-// sSampler                          sampler      NA          NA    0        1
-// tRGB                              texture  float4          2d    0        1
-// tMask                             texture  float4          2d    3        1
-// $Globals                          cbuffer      NA          NA    0        1
-//
-//
-//
-// Input signature:
-//
-// Name                 Index   Mask Register SysValue  Format   Used
-// -------------------- ----- ------ -------- -------- ------- ------
-// SV_Position              0   xyzw        0      POS   float       
-// TEXCOORD                 0   xy          1     NONE   float   xy  
-// TEXCOORD                 1     zw        1     NONE   float     zw
-//
-//
-// Output signature:
-//
-// Name                 Index   Mask Register SysValue  Format   Used
-// -------------------- ----- ------ -------- -------- ------- ------
-// SV_Target                0   xyzw        0   TARGET   float   xyzw
-//
-//
-// Constant buffer to DX9 shader constant mappings:
-//
-// Target Reg Buffer  Start Reg # of Regs        Data Conversion
-// ---------- ------- --------- --------- ----------------------
-// c0         cb0             1         1  ( FLT, FLT, FLT, FLT)
-//
-//
-// Sampler/Resource to DX9 shader sampler mappings:
-//
-// Target Sampler Source Sampler  Source Resource
-// -------------- --------------- ----------------
-// s0             s0              t3               
-// s1             s0              t0               
-//
-//
-// Level9 shader bytecode:
-//
-    ps_2_x
-    dcl t0
-    dcl_2d s0
-    dcl_2d s1
-    mov r0.xy, t0.wzzw
-    texld r1, t0, s1
-    texld r0, r0, s0
-    mul r1.xyz, r1, c0.x
-    mov r1.w, c0.x
-    mul r0, r0.w, r1
-    mov oC0, r0
-
-// approximately 7 instruction slots used (2 texture, 5 arithmetic)
-ps_4_0
-dcl_constantbuffer cb0[2], immediateIndexed
-dcl_sampler s0, mode_default
-dcl_resource_texture2d (float,float,float,float) t0
-dcl_resource_texture2d (float,float,float,float) t3
-dcl_input_ps linear v1.xy
-dcl_input_ps linear v1.zw
-dcl_output o0.xyzw
-dcl_temps 2
-sample r0.xyzw, v1.xyxx, t0.xyzw, s0
-mul r0.xyz, r0.xyzx, cb0[1].xxxx
-sample r1.xyzw, v1.zwzz, t3.xyzw, s0
-mov r0.w, cb0[1].x
-mul o0.xyzw, r0.xyzw, r1.wwww
-ret 
-// Approximately 6 instruction slots used
-#endif
-
-const BYTE RGBShaderMask[] =
-{
-     68,  88,  66,  67, 213, 196, 
-    202,  78,  84,  61, 164, 168, 
-    203, 139, 239,  65, 240, 126, 
-    180,  98,   1,   0,   0,   0, 
-    192,   5,   0,   0,   6,   0, 
-      0,   0,  56,   0,   0,   0, 
-      8,   1,   0,   0,  32,   2, 
-      0,   0, 156,   2,   0,   0, 
-     28,   5,   0,   0, 140,   5, 
-      0,   0,  65, 111, 110,  57, 
-    200,   0,   0,   0, 200,   0, 
-      0,   0,   0,   2, 255, 255, 
-    144,   0,   0,   0,  56,   0, 
-      0,   0,   1,   0,  44,   0, 
-      0,   0,  56,   0,   0,   0, 
-     56,   0,   2,   0,  36,   0, 
-      0,   0,  56,   0,   3,   0, 
-      0,   0,   0,   0,   1,   0, 
-      0,   0,   1,   0,   1,   0, 
-      0,   0,   0,   0,   0,   0, 
-      1,   2, 255, 255,  31,   0, 
-      0,   2,   0,   0,   0, 128, 
-      0,   0,  15, 176,  31,   0, 
-      0,   2,   0,   0,   0, 144, 
-      0,   8,  15, 160,  31,   0, 
-      0,   2,   0,   0,   0, 144, 
-      1,   8,  15, 160,   1,   0, 
-      0,   2,   0,   0,   3, 128, 
-      0,   0, 235, 176,  66,   0, 
-      0,   3,   1,   0,  15, 128, 
-      0,   0, 228, 176,   1,   8, 
-    228, 160,  66,   0,   0,   3, 
-      0,   0,  15, 128,   0,   0, 
-    228, 128,   0,   8, 228, 160, 
-      5,   0,   0,   3,   1,   0, 
-      7, 128,   1,   0, 228, 128, 
-      0,   0,   0, 160,   1,   0, 
-      0,   2,   1,   0,   8, 128, 
-      0,   0,   0, 160,   5,   0, 
-      0,   3,   0,   0,  15, 128, 
-      0,   0, 255, 128,   1,   0, 
-    228, 128,   1,   0,   0,   2, 
-      0,   8,  15, 128,   0,   0, 
-    228, 128, 255, 255,   0,   0, 
-     83,  72,  68,  82,  16,   1, 
-      0,   0,  64,   0,   0,   0, 
-     68,   0,   0,   0,  89,   0, 
-      0,   4,  70, 142,  32,   0, 
-      0,   0,   0,   0,   2,   0, 
-      0,   0,  90,   0,   0,   3, 
-      0,  96,  16,   0,   0,   0, 
-      0,   0,  88,  24,   0,   4, 
-      0, 112,  16,   0,   0,   0, 
-      0,   0,  85,  85,   0,   0, 
-     88,  24,   0,   4,   0, 112, 
-     16,   0,   3,   0,   0,   0, 
-     85,  85,   0,   0,  98,  16, 
-      0,   3,  50,  16,  16,   0, 
-      1,   0,   0,   0,  98,  16, 
-      0,   3, 194,  16,  16,   0, 
-      1,   0,   0,   0, 101,   0, 
-      0,   3, 242,  32,  16,   0, 
-      0,   0,   0,   0, 104,   0, 
-      0,   2,   2,   0,   0,   0, 
-     69,   0,   0,   9, 242,   0, 
-     16,   0,   0,   0,   0,   0, 
-     70,  16,  16,   0,   1,   0, 
-      0,   0,  70, 126,  16,   0, 
-      0,   0,   0,   0,   0,  96, 
-     16,   0,   0,   0,   0,   0, 
-     56,   0,   0,   8, 114,   0, 
-     16,   0,   0,   0,   0,   0, 
-     70,   2,  16,   0,   0,   0, 
-      0,   0,   6, 128,  32,   0, 
-      0,   0,   0,   0,   1,   0, 
-      0,   0,  69,   0,   0,   9, 
-    242,   0,  16,   0,   1,   0, 
-      0,   0, 230,  26,  16,   0, 
-      1,   0,   0,   0,  70, 126, 
-     16,   0,   3,   0,   0,   0, 
-      0,  96,  16,   0,   0,   0, 
-      0,   0,  54,   0,   0,   6, 
-    130,   0,  16,   0,   0,   0, 
-      0,   0,  10, 128,  32,   0, 
-      0,   0,   0,   0,   1,   0, 
-      0,   0,  56,   0,   0,   7, 
-    242,  32,  16,   0,   0,   0, 
-      0,   0,  70,  14,  16,   0, 
-      0,   0,   0,   0, 246,  15, 
-     16,   0,   1,   0,   0,   0, 
-     62,   0,   0,   1,  83,  84, 
-     65,  84, 116,   0,   0,   0, 
-      6,   0,   0,   0,   2,   0, 
-      0,   0,   0,   0,   0,   0, 
-      3,   0,   0,   0,   2,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   1,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   2,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   2,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,  82,  68,  69,  70, 
-    120,   2,   0,   0,   1,   0, 
-      0,   0, 188,   0,   0,   0, 
-      4,   0,   0,   0,  28,   0, 
-      0,   0,   0,   4, 255, 255, 
-      0,   1,   0,   0,  69,   2, 
-      0,   0, 156,   0,   0,   0, 
-      3,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   1,   0,   0,   0, 
-      1,   0,   0,   0, 165,   0, 
-      0,   0,   2,   0,   0,   0, 
-      5,   0,   0,   0,   4,   0, 
-      0,   0, 255, 255, 255, 255, 
-      0,   0,   0,   0,   1,   0, 
-      0,   0,  12,   0,   0,   0, 
-    170,   0,   0,   0,   2,   0, 
-      0,   0,   5,   0,   0,   0, 
-      4,   0,   0,   0, 255, 255, 
-    255, 255,   3,   0,   0,   0, 
-      1,   0,   0,   0,  13,   0, 
-      0,   0, 176,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   1,   0,   0,   0, 
-      0,   0,   0,   0, 115,  83, 
-     97, 109, 112, 108, 101, 114, 
-      0, 116,  82,  71,  66,   0, 
-    116,  77,  97, 115, 107,   0, 
-     36,  71, 108, 111,  98,  97, 
-    108, 115,   0, 171, 171, 171, 
-    176,   0,   0,   0,   8,   0, 
-      0,   0, 212,   0,   0,   0, 
-    224,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-    148,   1,   0,   0,   0,   0, 
-      0,   0,  16,   0,   0,   0, 
-      0,   0,   0,   0, 160,   1, 
-      0,   0,   0,   0,   0,   0, 
-    176,   1,   0,   0,  16,   0, 
-      0,   0,   4,   0,   0,   0, 
-      2,   0,   0,   0, 192,   1, 
-      0,   0,   0,   0,   0,   0, 
-    208,   1,   0,   0,  32,   0, 
-      0,   0,  64,   0,   0,   0, 
-      0,   0,   0,   0, 224,   1, 
-      0,   0,   0,   0,   0,   0, 
-    240,   1,   0,   0,  96,   0, 
-      0,   0,  64,   0,   0,   0, 
-      0,   0,   0,   0, 224,   1, 
-      0,   0,   0,   0,   0,   0, 
-    252,   1,   0,   0, 160,   0, 
-      0,   0,  16,   0,   0,   0, 
-      0,   0,   0,   0, 160,   1, 
-      0,   0,   0,   0,   0,   0, 
-     16,   2,   0,   0, 176,   0, 
-      0,   0,  16,   0,   0,   0, 
-      0,   0,   0,   0,  32,   2, 
-      0,   0,   0,   0,   0,   0, 
-     48,   2,   0,   0, 192,   0, 
-      0,   0,  16,   0,   0,   0, 
-      0,   0,   0,   0,  32,   2, 
-      0,   0,   0,   0,   0,   0, 
-     59,   2,   0,   0, 208,   0, 
-      0,   0,  16,   0,   0,   0, 
-      0,   0,   0,   0,  32,   2, 
-      0,   0,   0,   0,   0,   0, 
-    102,  76,  97, 121, 101, 114, 
-     67, 111, 108, 111, 114,   0, 
-      1,   0,   3,   0,   1,   0, 
-      4,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0, 102,  76, 
-     97, 121, 101, 114,  79, 112, 
-     97,  99, 105, 116, 121,   0, 
-    171, 171,   0,   0,   3,   0, 
-      1,   0,   1,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-    109,  76,  97, 121, 101, 114, 
-     84, 114,  97, 110, 115, 102, 
-    111, 114, 109,   0,   3,   0, 
-      3,   0,   4,   0,   4,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0, 109,  80, 114, 111, 
-    106, 101,  99, 116, 105, 111, 
-    110,   0, 118,  82, 101, 110, 
-    100, 101, 114,  84,  97, 114, 
-    103, 101, 116,  79, 102, 102, 
-    115, 101, 116,   0, 118,  84, 
-    101, 120, 116, 117, 114, 101, 
-     67, 111, 111, 114, 100, 115, 
-      0, 171,   1,   0,   3,   0, 
-      1,   0,   4,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-    118,  76,  97, 121, 101, 114, 
-     81, 117,  97, 100,   0, 118, 
-     77,  97, 115, 107,  81, 117, 
-     97, 100,   0,  77, 105,  99, 
-    114, 111, 115, 111, 102, 116, 
-     32,  40,  82,  41,  32,  72, 
-     76,  83,  76,  32,  83, 104, 
-     97, 100, 101, 114,  32,  67, 
-    111, 109, 112, 105, 108, 101, 
-    114,  32,  57,  46,  51,  48, 
-     46,  57,  50,  48,  48,  46, 
-     49,  54,  51,  56,  52,   0, 
-     73,  83,  71,  78, 104,   0, 
-      0,   0,   3,   0,   0,   0, 
-      8,   0,   0,   0,  80,   0, 
-      0,   0,   0,   0,   0,   0, 
-      1,   0,   0,   0,   3,   0, 
-      0,   0,   0,   0,   0,   0, 
-     15,   0,   0,   0,  92,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   3,   0, 
-      0,   0,   1,   0,   0,   0, 
-      3,   3,   0,   0,  92,   0, 
-      0,   0,   1,   0,   0,   0, 
-      0,   0,   0,   0,   3,   0, 
-      0,   0,   1,   0,   0,   0, 
-     12,  12,   0,   0,  83,  86, 
-     95,  80, 111, 115, 105, 116, 
-    105, 111, 110,   0,  84,  69, 
-     88,  67,  79,  79,  82,  68, 
-      0, 171, 171, 171,  79,  83, 
-     71,  78,  44,   0,   0,   0, 
-      1,   0,   0,   0,   8,   0, 
-      0,   0,  32,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   3,   0,   0,   0, 
-      0,   0,   0,   0,  15,   0, 
-      0,   0,  83,  86,  95,  84, 
-     97, 114, 103, 101, 116,   0, 
-    171, 171
-};
-#if 0
-//
-// Generated by Microsoft (R) HLSL Shader Compiler 9.30.9200.16384
-//
-//
-///
-// Buffer Definitions: 
-//
-// cbuffer $Globals
-// {
-//
-//   float4 fLayerColor;                // Offset:    0 Size:    16 [unused]
-//   float fLayerOpacity;               // Offset:   16 Size:     4
-//   float4x4 mLayerTransform;          // Offset:   32 Size:    64 [unused]
-//   float4x4 mProjection;              // Offset:   96 Size:    64 [unused]
-//   float4 vRenderTargetOffset;        // Offset:  160 Size:    16 [unused]
-//   float4 vTextureCoords;             // Offset:  176 Size:    16 [unused]
-//   float4 vLayerQuad;                 // Offset:  192 Size:    16 [unused]
-//   float4 vMaskQuad;                  // Offset:  208 Size:    16 [unused]
-//
-// }
-//
-//
-// Resource Bindings:
-//
-// Name                                 Type  Format         Dim Slot Elements
-// ------------------------------ ---------- ------- ----------- ---- --------
-// sSampler                          sampler      NA          NA    0        1
-// tRGB                              texture  float4          2d    0        1
-// tMask                             texture  float4          2d    3        1
-// $Globals                          cbuffer      NA          NA    0        1
-//
-//
-//
-// Input signature:
-//
-// Name                 Index   Mask Register SysValue  Format   Used
-// -------------------- ----- ------ -------- -------- ------- ------
-// SV_Position              0   xyzw        0      POS   float       
-// TEXCOORD                 0   xy          1     NONE   float   xy  
-// TEXCOORD                 1     zw        1     NONE   float     zw
-//
-//
-// Output signature:
-//
-// Name                 Index   Mask Register SysValue  Format   Used
-// -------------------- ----- ------ -------- -------- ------- ------
-// SV_Target                0   xyzw        0   TARGET   float   xyzw
-//
-//
-// Constant buffer to DX9 shader constant mappings:
-//
-// Target Reg Buffer  Start Reg # of Regs        Data Conversion
-// ---------- ------- --------- --------- ----------------------
-// c0         cb0             1         1  ( FLT, FLT, FLT, FLT)
-//
-//
-// Sampler/Resource to DX9 shader sampler mappings:
-//
-// Target Sampler Source Sampler  Source Resource
-// -------------- --------------- ----------------
-// s0             s0              t3               
-// s1             s0              t0               
-//
-//
-// Level9 shader bytecode:
-//
-    ps_2_x
-    dcl t0
-    dcl_2d s0
-    dcl_2d s1
-    mov r0.xy, t0.wzzw
-    texld r1, t0, s1
-    texld r0, r0, s0
-    mul r1, r1, c0.x
-    mul r0, r0.w, r1
-    mov oC0, r0
-
-// approximately 6 instruction slots used (2 texture, 4 arithmetic)
-ps_4_0
-dcl_constantbuffer cb0[2], immediateIndexed
-dcl_sampler s0, mode_default
-dcl_resource_texture2d (float,float,float,float) t0
-dcl_resource_texture2d (float,float,float,float) t3
-dcl_input_ps linear v1.xy
-dcl_input_ps linear v1.zw
-dcl_output o0.xyzw
-dcl_temps 2
-sample r0.xyzw, v1.xyxx, t0.xyzw, s0
-mul r0.xyzw, r0.xyzw, cb0[1].xxxx
-sample r1.xyzw, v1.zwzz, t3.xyzw, s0
-mul o0.xyzw, r0.xyzw, r1.wwww
-ret 
-// Approximately 5 instruction slots used
-#endif
-
-const BYTE RGBAShaderMask[] =
-{
-     68,  88,  66,  67, 174,  35, 
-    246,  49,  60,   2,  72,  73, 
-     23,  21,  26, 163, 118, 201, 
-     84,  68,   1,   0,   0,   0, 
-    156,   5,   0,   0,   6,   0, 
-      0,   0,  56,   0,   0,   0, 
-    252,   0,   0,   0, 252,   1, 
-      0,   0, 120,   2,   0,   0, 
-    248,   4,   0,   0, 104,   5, 
-      0,   0,  65, 111, 110,  57, 
-    188,   0,   0,   0, 188,   0, 
-      0,   0,   0,   2, 255, 255, 
-    132,   0,   0,   0,  56,   0, 
-      0,   0,   1,   0,  44,   0, 
-      0,   0,  56,   0,   0,   0, 
-     56,   0,   2,   0,  36,   0, 
-      0,   0,  56,   0,   3,   0, 
-      0,   0,   0,   0,   1,   0, 
-      0,   0,   1,   0,   1,   0, 
-      0,   0,   0,   0,   0,   0, 
-      1,   2, 255, 255,  31,   0, 
-      0,   2,   0,   0,   0, 128, 
-      0,   0,  15, 176,  31,   0, 
-      0,   2,   0,   0,   0, 144, 
-      0,   8,  15, 160,  31,   0, 
-      0,   2,   0,   0,   0, 144, 
-      1,   8,  15, 160,   1,   0, 
-      0,   2,   0,   0,   3, 128, 
-      0,   0, 235, 176,  66,   0, 
-      0,   3,   1,   0,  15, 128, 
-      0,   0, 228, 176,   1,   8, 
-    228, 160,  66,   0,   0,   3, 
-      0,   0,  15, 128,   0,   0, 
-    228, 128,   0,   8, 228, 160, 
-      5,   0,   0,   3,   1,   0, 
-     15, 128,   1,   0, 228, 128, 
-      0,   0,   0, 160,   5,   0, 
-      0,   3,   0,   0,  15, 128, 
-      0,   0, 255, 128,   1,   0, 
-    228, 128,   1,   0,   0,   2, 
-      0,   8,  15, 128,   0,   0, 
-    228, 128, 255, 255,   0,   0, 
-     83,  72,  68,  82, 248,   0, 
-      0,   0,  64,   0,   0,   0, 
-     62,   0,   0,   0,  89,   0, 
-      0,   4,  70, 142,  32,   0, 
-      0,   0,   0,   0,   2,   0, 
-      0,   0,  90,   0,   0,   3, 
-      0,  96,  16,   0,   0,   0, 
-      0,   0,  88,  24,   0,   4, 
-      0, 112,  16,   0,   0,   0, 
-      0,   0,  85,  85,   0,   0, 
-     88,  24,   0,   4,   0, 112, 
-     16,   0,   3,   0,   0,   0, 
-     85,  85,   0,   0,  98,  16, 
-      0,   3,  50,  16,  16,   0, 
-      1,   0,   0,   0,  98,  16, 
-      0,   3, 194,  16,  16,   0, 
-      1,   0,   0,   0, 101,   0, 
-      0,   3, 242,  32,  16,   0, 
-      0,   0,   0,   0, 104,   0, 
-      0,   2,   2,   0,   0,   0, 
-     69,   0,   0,   9, 242,   0, 
-     16,   0,   0,   0,   0,   0, 
-     70,  16,  16,   0,   1,   0, 
-      0,   0,  70, 126,  16,   0, 
-      0,   0,   0,   0,   0,  96, 
-     16,   0,   0,   0,   0,   0, 
-     56,   0,   0,   8, 242,   0, 
-     16,   0,   0,   0,   0,   0, 
-     70,  14,  16,   0,   0,   0, 
-      0,   0,   6, 128,  32,   0, 
-      0,   0,   0,   0,   1,   0, 
-      0,   0,  69,   0,   0,   9, 
-    242,   0,  16,   0,   1,   0, 
-      0,   0, 230,  26,  16,   0, 
-      1,   0,   0,   0,  70, 126, 
-     16,   0,   3,   0,   0,   0, 
-      0,  96,  16,   0,   0,   0, 
-      0,   0,  56,   0,   0,   7, 
-    242,  32,  16,   0,   0,   0, 
-      0,   0,  70,  14,  16,   0, 
-      0,   0,   0,   0, 246,  15, 
-     16,   0,   1,   0,   0,   0, 
-     62,   0,   0,   1,  83,  84, 
-     65,  84, 116,   0,   0,   0, 
-      5,   0,   0,   0,   2,   0, 
-      0,   0,   0,   0,   0,   0, 
-      3,   0,   0,   0,   2,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   1,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   2,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   1,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,  82,  68,  69,  70, 
-    120,   2,   0,   0,   1,   0, 
-      0,   0, 188,   0,   0,   0, 
-      4,   0,   0,   0,  28,   0, 
-      0,   0,   0,   4, 255, 255, 
-      0,   1,   0,   0,  69,   2, 
-      0,   0, 156,   0,   0,   0, 
-      3,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   1,   0,   0,   0, 
-      1,   0,   0,   0, 165,   0, 
-      0,   0,   2,   0,   0,   0, 
-      5,   0,   0,   0,   4,   0, 
-      0,   0, 255, 255, 255, 255, 
-      0,   0,   0,   0,   1,   0, 
-      0,   0,  12,   0,   0,   0, 
-    170,   0,   0,   0,   2,   0, 
-      0,   0,   5,   0,   0,   0, 
-      4,   0,   0,   0, 255, 255, 
-    255, 255,   3,   0,   0,   0, 
-      1,   0,   0,   0,  13,   0, 
-      0,   0, 176,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   1,   0,   0,   0, 
-      0,   0,   0,   0, 115,  83, 
-     97, 109, 112, 108, 101, 114, 
-      0, 116,  82,  71,  66,   0, 
-    116,  77,  97, 115, 107,   0, 
-     36,  71, 108, 111,  98,  97, 
-    108, 115,   0, 171, 171, 171, 
-    176,   0,   0,   0,   8,   0, 
-      0,   0, 212,   0,   0,   0, 
-    224,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-    148,   1,   0,   0,   0,   0, 
-      0,   0,  16,   0,   0,   0, 
-      0,   0,   0,   0, 160,   1, 
-      0,   0,   0,   0,   0,   0, 
-    176,   1,   0,   0,  16,   0, 
-      0,   0,   4,   0,   0,   0, 
-      2,   0,   0,   0, 192,   1, 
-      0,   0,   0,   0,   0,   0, 
-    208,   1,   0,   0,  32,   0, 
-      0,   0,  64,   0,   0,   0, 
-      0,   0,   0,   0, 224,   1, 
-      0,   0,   0,   0,   0,   0, 
-    240,   1,   0,   0,  96,   0, 
-      0,   0,  64,   0,   0,   0, 
-      0,   0,   0,   0, 224,   1, 
-      0,   0,   0,   0,   0,   0, 
-    252,   1,   0,   0, 160,   0, 
-      0,   0,  16,   0,   0,   0, 
-      0,   0,   0,   0, 160,   1, 
-      0,   0,   0,   0,   0,   0, 
-     16,   2,   0,   0, 176,   0, 
-      0,   0,  16,   0,   0,   0, 
-      0,   0,   0,   0,  32,   2, 
-      0,   0,   0,   0,   0,   0, 
-     48,   2,   0,   0, 192,   0, 
-      0,   0,  16,   0,   0,   0, 
-      0,   0,   0,   0,  32,   2, 
-      0,   0,   0,   0,   0,   0, 
-     59,   2,   0,   0, 208,   0, 
-      0,   0,  16,   0,   0,   0, 
-      0,   0,   0,   0,  32,   2, 
-      0,   0,   0,   0,   0,   0, 
-    102,  76,  97, 121, 101, 114, 
-     67, 111, 108, 111, 114,   0, 
-      1,   0,   3,   0,   1,   0, 
-      4,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0, 102,  76, 
-     97, 121, 101, 114,  79, 112, 
-     97,  99, 105, 116, 121,   0, 
-    171, 171,   0,   0,   3,   0, 
-      1,   0,   1,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-    109,  76,  97, 121, 101, 114, 
-     84, 114,  97, 110, 115, 102, 
-    111, 114, 109,   0,   3,   0, 
-      3,   0,   4,   0,   4,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0, 109,  80, 114, 111, 
-    106, 101,  99, 116, 105, 111, 
-    110,   0, 118,  82, 101, 110, 
-    100, 101, 114,  84,  97, 114, 
-    103, 101, 116,  79, 102, 102, 
-    115, 101, 116,   0, 118,  84, 
-    101, 120, 116, 117, 114, 101, 
-     67, 111, 111, 114, 100, 115, 
-      0, 171,   1,   0,   3,   0, 
-      1,   0,   4,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-    118,  76,  97, 121, 101, 114, 
-     81, 117,  97, 100,   0, 118, 
-     77,  97, 115, 107,  81, 117, 
-     97, 100,   0,  77, 105,  99, 
-    114, 111, 115, 111, 102, 116, 
-     32,  40,  82,  41,  32,  72, 
-     76,  83,  76,  32,  83, 104, 
-     97, 100, 101, 114,  32,  67, 
-    111, 109, 112, 105, 108, 101, 
-    114,  32,  57,  46,  51,  48, 
-     46,  57,  50,  48,  48,  46, 
-     49,  54,  51,  56,  52,   0, 
-     73,  83,  71,  78, 104,   0, 
-      0,   0,   3,   0,   0,   0, 
-      8,   0,   0,   0,  80,   0, 
-      0,   0,   0,   0,   0,   0, 
-      1,   0,   0,   0,   3,   0, 
-      0,   0,   0,   0,   0,   0, 
-     15,   0,   0,   0,  92,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   3,   0, 
-      0,   0,   1,   0,   0,   0, 
-      3,   3,   0,   0,  92,   0, 
-      0,   0,   1,   0,   0,   0, 
-      0,   0,   0,   0,   3,   0, 
-      0,   0,   1,   0,   0,   0, 
-     12,  12,   0,   0,  83,  86, 
-     95,  80, 111, 115, 105, 116, 
-    105, 111, 110,   0,  84,  69, 
-     88,  67,  79,  79,  82,  68, 
-      0, 171, 171, 171,  79,  83, 
-     71,  78,  44,   0,   0,   0, 
-      1,   0,   0,   0,   8,   0, 
-      0,   0,  32,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   3,   0,   0,   0, 
-      0,   0,   0,   0,  15,   0, 
-      0,   0,  83,  86,  95,  84, 
-     97, 114, 103, 101, 116,   0, 
-    171, 171
-};
-#if 0
-//
-// Generated by Microsoft (R) HLSL Shader Compiler 9.30.9200.16384
-//
-//
-///
-// Buffer Definitions: 
-//
-// cbuffer $Globals
-// {
-//
-//   float4 fLayerColor;                // Offset:    0 Size:    16 [unused]
-//   float fLayerOpacity;               // Offset:   16 Size:     4
-//   float4x4 mLayerTransform;          // Offset:   32 Size:    64 [unused]
-//   float4x4 mProjection;              // Offset:   96 Size:    64 [unused]
-//   float4 vRenderTargetOffset;        // Offset:  160 Size:    16 [unused]
-//   float4 vTextureCoords;             // Offset:  176 Size:    16 [unused]
-//   float4 vLayerQuad;                 // Offset:  192 Size:    16 [unused]
-//   float4 vMaskQuad;                  // Offset:  208 Size:    16 [unused]
-//
-// }
-//
-//
-// Resource Bindings:
-//
-// Name                                 Type  Format         Dim Slot Elements
-// ------------------------------ ---------- ------- ----------- ---- --------
-// sSampler                          sampler      NA          NA    0        1
-// LayerTextureSamplerLinear         sampler      NA          NA    1        1
-// tRGB                              texture  float4          2d    0        1
-// tMask                             texture  float4          2d    3        1
-// $Globals                          cbuffer      NA          NA    0        1
-//
-//
-//
-// Input signature:
-//
-// Name                 Index   Mask Register SysValue  Format   Used
-// -------------------- ----- ------ -------- -------- ------- ------
-// SV_Position              0   xyzw        0      POS   float       
-// TEXCOORD                 0   xy          1     NONE   float   xy  
-// TEXCOORD                 1   xyz         2     NONE   float   xyz 
-//
-//
-// Output signature:
-//
-// Name                 Index   Mask Register SysValue  Format   Used
-// -------------------- ----- ------ -------- -------- ------- ------
-// SV_Target                0   xyzw        0   TARGET   float   xyzw
-//
-//
-// Constant buffer to DX9 shader constant mappings:
-//
-// Target Reg Buffer  Start Reg # of Regs        Data Conversion
-// ---------- ------- --------- --------- ----------------------
-// c0         cb0             1         1  ( FLT, FLT, FLT, FLT)
-//
-//
-// Sampler/Resource to DX9 shader sampler mappings:
-//
-// Target Sampler Source Sampler  Source Resource
-// -------------- --------------- ----------------
-// s0             s0              t0               
-// s1             s1              t3               
-//
-//
-// Level9 shader bytecode:
-//
-    ps_2_x
-    dcl t0.xy
-    dcl t1.xyz
-    dcl_2d s0
-    dcl_2d s1
-    rcp r0.w, t1.z
-    mul r0.xy, r0.w, t1
-    texld r1, t0, s0
-    texld r0, r0, s1
-    mul r1, r1, c0.x
-    mul r0, r0.w, r1
-    mov oC0, r0
-
-// approximately 7 instruction slots used (2 texture, 5 arithmetic)
-ps_4_0
-dcl_constantbuffer cb0[2], immediateIndexed
-dcl_sampler s0, mode_default
-dcl_sampler s1, mode_default
-dcl_resource_texture2d (float,float,float,float) t0
-dcl_resource_texture2d (float,float,float,float) t3
-dcl_input_ps linear v1.xy
-dcl_input_ps linear v2.xyz
-dcl_output o0.xyzw
-dcl_temps 2
-div r0.xy, v2.xyxx, v2.zzzz
-sample r0.xyzw, r0.xyxx, t3.xyzw, s1
-sample r1.xyzw, v1.xyxx, t0.xyzw, s0
-mul r1.xyzw, r1.xyzw, cb0[1].xxxx
-mul o0.xyzw, r0.wwww, r1.xyzw
-ret 
-// Approximately 6 instruction slots used
-#endif
-
-const BYTE RGBAShaderMask3D[] =
-{
-     68,  88,  66,  67, 132,   5, 
-     75,  11,  52,  71,  31,  33, 
-     74,  98, 132, 100, 152,  60, 
-     34, 172,   1,   0,   0,   0, 
-     24,   6,   0,   0,   6,   0, 
-      0,   0,  56,   0,   0,   0, 
-     24,   1,   0,   0,  64,   2, 
-      0,   0, 188,   2,   0,   0, 
-    116,   5,   0,   0, 228,   5, 
-      0,   0,  65, 111, 110,  57, 
-    216,   0,   0,   0, 216,   0, 
-      0,   0,   0,   2, 255, 255, 
-    160,   0,   0,   0,  56,   0, 
-      0,   0,   1,   0,  44,   0, 
-      0,   0,  56,   0,   0,   0, 
-     56,   0,   2,   0,  36,   0, 
-      0,   0,  56,   0,   0,   0, 
-      0,   0,   3,   1,   1,   0, 
-      0,   0,   1,   0,   1,   0, 
-      0,   0,   0,   0,   0,   0, 
-      1,   2, 255, 255,  31,   0, 
-      0,   2,   0,   0,   0, 128, 
-      0,   0,   3, 176,  31,   0, 
-      0,   2,   0,   0,   0, 128, 
-      1,   0,   7, 176,  31,   0, 
-      0,   2,   0,   0,   0, 144, 
-      0,   8,  15, 160,  31,   0, 
-      0,   2,   0,   0,   0, 144, 
-      1,   8,  15, 160,   6,   0, 
-      0,   2,   0,   0,   8, 128, 
-      1,   0, 170, 176,   5,   0, 
-      0,   3,   0,   0,   3, 128, 
-      0,   0, 255, 128,   1,   0, 
-    228, 176,  66,   0,   0,   3, 
-      1,   0,  15, 128,   0,   0, 
-    228, 176,   0,   8, 228, 160, 
-     66,   0,   0,   3,   0,   0, 
-     15, 128,   0,   0, 228, 128, 
-      1,   8, 228, 160,   5,   0, 
-      0,   3,   1,   0,  15, 128, 
-      1,   0, 228, 128,   0,   0, 
-      0, 160,   5,   0,   0,   3, 
-      0,   0,  15, 128,   0,   0, 
-    255, 128,   1,   0, 228, 128, 
-      1,   0,   0,   2,   0,   8, 
-     15, 128,   0,   0, 228, 128, 
-    255, 255,   0,   0,  83,  72, 
-     68,  82,  32,   1,   0,   0, 
-     64,   0,   0,   0,  72,   0, 
-      0,   0,  89,   0,   0,   4, 
-     70, 142,  32,   0,   0,   0, 
-      0,   0,   2,   0,   0,   0, 
-     90,   0,   0,   3,   0,  96, 
-     16,   0,   0,   0,   0,   0, 
-     90,   0,   0,   3,   0,  96, 
-     16,   0,   1,   0,   0,   0, 
-     88,  24,   0,   4,   0, 112, 
-     16,   0,   0,   0,   0,   0, 
-     85,  85,   0,   0,  88,  24, 
-      0,   4,   0, 112,  16,   0, 
-      3,   0,   0,   0,  85,  85, 
-      0,   0,  98,  16,   0,   3, 
-     50,  16,  16,   0,   1,   0, 
-      0,   0,  98,  16,   0,   3, 
-    114,  16,  16,   0,   2,   0, 
-      0,   0, 101,   0,   0,   3, 
-    242,  32,  16,   0,   0,   0, 
-      0,   0, 104,   0,   0,   2, 
-      2,   0,   0,   0,  14,   0, 
-      0,   7,  50,   0,  16,   0, 
-      0,   0,   0,   0,  70,  16, 
-     16,   0,   2,   0,   0,   0, 
-    166,  26,  16,   0,   2,   0, 
-      0,   0,  69,   0,   0,   9, 
-    242,   0,  16,   0,   0,   0, 
-      0,   0,  70,   0,  16,   0, 
-      0,   0,   0,   0,  70, 126, 
-     16,   0,   3,   0,   0,   0, 
-      0,  96,  16,   0,   1,   0, 
-      0,   0,  69,   0,   0,   9, 
-    242,   0,  16,   0,   1,   0, 
-      0,   0,  70,  16,  16,   0, 
-      1,   0,   0,   0,  70, 126, 
-     16,   0,   0,   0,   0,   0, 
-      0,  96,  16,   0,   0,   0, 
-      0,   0,  56,   0,   0,   8, 
-    242,   0,  16,   0,   1,   0, 
-      0,   0,  70,  14,  16,   0, 
-      1,   0,   0,   0,   6, 128, 
-     32,   0,   0,   0,   0,   0, 
-      1,   0,   0,   0,  56,   0, 
-      0,   7, 242,  32,  16,   0, 
-      0,   0,   0,   0, 246,  15, 
-     16,   0,   0,   0,   0,   0, 
-     70,  14,  16,   0,   1,   0, 
-      0,   0,  62,   0,   0,   1, 
-     83,  84,  65,  84, 116,   0, 
-      0,   0,   6,   0,   0,   0, 
-      2,   0,   0,   0,   0,   0, 
-      0,   0,   3,   0,   0,   0, 
-      3,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      1,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   2,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      1,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,  82,  68, 
-     69,  70, 176,   2,   0,   0, 
-      1,   0,   0,   0, 244,   0, 
-      0,   0,   5,   0,   0,   0, 
-     28,   0,   0,   0,   0,   4, 
-    255, 255,   0,   1,   0,   0, 
-    125,   2,   0,   0, 188,   0, 
-      0,   0,   3,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   1,   0, 
-      0,   0,   1,   0,   0,   0, 
-    197,   0,   0,   0,   3,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   1,   0,   0,   0, 
-      1,   0,   0,   0,   0,   0, 
-      0,   0, 223,   0,   0,   0, 
-      2,   0,   0,   0,   5,   0, 
-      0,   0,   4,   0,   0,   0, 
-    255, 255, 255, 255,   0,   0, 
-      0,   0,   1,   0,   0,   0, 
-     12,   0,   0,   0, 228,   0, 
-      0,   0,   2,   0,   0,   0, 
-      5,   0,   0,   0,   4,   0, 
-      0,   0, 255, 255, 255, 255, 
-      3,   0,   0,   0,   1,   0, 
-      0,   0,  13,   0,   0,   0, 
-    234,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      1,   0,   0,   0,   0,   0, 
-      0,   0, 115,  83,  97, 109, 
-    112, 108, 101, 114,   0,  76, 
-     97, 121, 101, 114,  84, 101, 
-    120, 116, 117, 114, 101,  83, 
-     97, 109, 112, 108, 101, 114, 
-     76, 105, 110, 101,  97, 114, 
-      0, 116,  82,  71,  66,   0, 
-    116,  77,  97, 115, 107,   0, 
-     36,  71, 108, 111,  98,  97, 
-    108, 115,   0, 171, 234,   0, 
-      0,   0,   8,   0,   0,   0, 
-     12,   1,   0,   0, 224,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0, 204,   1, 
-      0,   0,   0,   0,   0,   0, 
-     16,   0,   0,   0,   0,   0, 
-      0,   0, 216,   1,   0,   0, 
-      0,   0,   0,   0, 232,   1, 
-      0,   0,  16,   0,   0,   0, 
-      4,   0,   0,   0,   2,   0, 
-      0,   0, 248,   1,   0,   0, 
-      0,   0,   0,   0,   8,   2, 
-      0,   0,  32,   0,   0,   0, 
-     64,   0,   0,   0,   0,   0, 
-      0,   0,  24,   2,   0,   0, 
-      0,   0,   0,   0,  40,   2, 
-      0,   0,  96,   0,   0,   0, 
-     64,   0,   0,   0,   0,   0, 
-      0,   0,  24,   2,   0,   0, 
-      0,   0,   0,   0,  52,   2, 
-      0,   0, 160,   0,   0,   0, 
-     16,   0,   0,   0,   0,   0, 
-      0,   0, 216,   1,   0,   0, 
-      0,   0,   0,   0,  72,   2, 
-      0,   0, 176,   0,   0,   0, 
-     16,   0,   0,   0,   0,   0, 
-      0,   0,  88,   2,   0,   0, 
-      0,   0,   0,   0, 104,   2, 
-      0,   0, 192,   0,   0,   0, 
-     16,   0,   0,   0,   0,   0, 
-      0,   0,  88,   2,   0,   0, 
-      0,   0,   0,   0, 115,   2, 
-      0,   0, 208,   0,   0,   0, 
-     16,   0,   0,   0,   0,   0, 
-      0,   0,  88,   2,   0,   0, 
-      0,   0,   0,   0, 102,  76, 
-     97, 121, 101, 114,  67, 111, 
-    108, 111, 114,   0,   1,   0, 
-      3,   0,   1,   0,   4,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0, 102,  76,  97, 121, 
-    101, 114,  79, 112,  97,  99, 
-    105, 116, 121,   0, 171, 171, 
-      0,   0,   3,   0,   1,   0, 
-      1,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0, 109,  76, 
-     97, 121, 101, 114,  84, 114, 
-     97, 110, 115, 102, 111, 114, 
-    109,   0,   3,   0,   3,   0, 
-      4,   0,   4,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-    109,  80, 114, 111, 106, 101, 
-     99, 116, 105, 111, 110,   0, 
-    118,  82, 101, 110, 100, 101, 
-    114,  84,  97, 114, 103, 101, 
-    116,  79, 102, 102, 115, 101, 
-    116,   0, 118,  84, 101, 120, 
-    116, 117, 114, 101,  67, 111, 
-    111, 114, 100, 115,   0, 171, 
-      1,   0,   3,   0,   1,   0, 
-      4,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0, 118,  76, 
-     97, 121, 101, 114,  81, 117, 
-     97, 100,   0, 118,  77,  97, 
-    115, 107,  81, 117,  97, 100, 
-      0,  77, 105,  99, 114, 111, 
-    115, 111, 102, 116,  32,  40, 
-     82,  41,  32,  72,  76,  83, 
-     76,  32,  83, 104,  97, 100, 
-    101, 114,  32,  67, 111, 109, 
-    112, 105, 108, 101, 114,  32, 
-     57,  46,  51,  48,  46,  57, 
-     50,  48,  48,  46,  49,  54, 
-     51,  56,  52,   0,  73,  83, 
-     71,  78, 104,   0,   0,   0, 
-      3,   0,   0,   0,   8,   0, 
-      0,   0,  80,   0,   0,   0, 
-      0,   0,   0,   0,   1,   0, 
-      0,   0,   3,   0,   0,   0, 
-      0,   0,   0,   0,  15,   0, 
-      0,   0,  92,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   3,   0,   0,   0, 
-      1,   0,   0,   0,   3,   3, 
-      0,   0,  92,   0,   0,   0, 
-      1,   0,   0,   0,   0,   0, 
-      0,   0,   3,   0,   0,   0, 
-      2,   0,   0,   0,   7,   7, 
-      0,   0,  83,  86,  95,  80, 
-    111, 115, 105, 116, 105, 111, 
-    110,   0,  84,  69,  88,  67, 
-     79,  79,  82,  68,   0, 171, 
-    171, 171,  79,  83,  71,  78, 
-     44,   0,   0,   0,   1,   0, 
-      0,   0,   8,   0,   0,   0, 
-     32,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      3,   0,   0,   0,   0,   0, 
-      0,   0,  15,   0,   0,   0, 
-     83,  86,  95,  84,  97, 114, 
-    103, 101, 116,   0, 171, 171
-};
-#if 0
-//
-// Generated by Microsoft (R) HLSL Shader Compiler 9.30.9200.16384
-//
-//
-///
-// Buffer Definitions: 
-//
-// cbuffer $Globals
-// {
-//
-//   float4 fLayerColor;                // Offset:    0 Size:    16 [unused]
-//   float fLayerOpacity;               // Offset:   16 Size:     4
-//   float4x4 mLayerTransform;          // Offset:   32 Size:    64 [unused]
-//   float4x4 mProjection;              // Offset:   96 Size:    64 [unused]
-//   float4 vRenderTargetOffset;        // Offset:  160 Size:    16 [unused]
-//   float4 vTextureCoords;             // Offset:  176 Size:    16 [unused]
-//   float4 vLayerQuad;                 // Offset:  192 Size:    16 [unused]
-//   float4 vMaskQuad;                  // Offset:  208 Size:    16 [unused]
-//
-// }
-//
-//
-// Resource Bindings:
-//
-// Name                                 Type  Format         Dim Slot Elements
-// ------------------------------ ---------- ------- ----------- ---- --------
-// sSampler                          sampler      NA          NA    0        1
-// tY                                texture  float4          2d    0        1
-// tCb                               texture  float4          2d    1        1
-// tCr                               texture  float4          2d    2        1
-// tMask                             texture  float4          2d    3        1
-// $Globals                          cbuffer      NA          NA    0        1
-//
-//
-//
-// Input signature:
-//
-// Name                 Index   Mask Register SysValue  Format   Used
-// -------------------- ----- ------ -------- -------- ------- ------
-// SV_Position              0   xyzw        0      POS   float       
-// TEXCOORD                 0   xy          1     NONE   float   xy  
-// TEXCOORD                 1     zw        1     NONE   float     zw
-//
-//
-// Output signature:
-//
-// Name                 Index   Mask Register SysValue  Format   Used
-// -------------------- ----- ------ -------- -------- ------- ------
-// SV_Target                0   xyzw        0   TARGET   float   xyzw
-//
-//
-// Constant buffer to DX9 shader constant mappings:
-//
-// Target Reg Buffer  Start Reg # of Regs        Data Conversion
-// ---------- ------- --------- --------- ----------------------
-// c0         cb0             1         1  ( FLT, FLT, FLT, FLT)
-//
-//
-// Sampler/Resource to DX9 shader sampler mappings:
-//
-// Target Sampler Source Sampler  Source Resource
-// -------------- --------------- ----------------
-// s0             s0              t3               
-// s1             s0              t0               
-// s2             s0              t1               
-// s3             s0              t2               
-//
-//
-// Level9 shader bytecode:
-//
-    ps_2_x
-    def c1, -0.5, -0.0625, 1.59599996, 0.813000023
-    def c2, 1.16400003, 2.01799989, 0.391000003, 1
-    dcl t0
-    dcl_2d s0
-    dcl_2d s1
-    dcl_2d s2
-    dcl_2d s3
-    texld r0, t0, s1
-    texld r1, t0, s3
-    add r0.y, r1.x, c1.x
-    mul r0.yz, r0.y, c1.xzww
-    add r0.x, r0.x, c1.y
-    mad r0.z, r0.x, c2.x, -r0.z
-    mad r1.x, r0.x, c2.x, r0.y
-    mov r2.xy, t0.wzzw
-    texld r3, t0, s2
-    texld r2, r2, s0
-    add r0.y, r3.x, c1.x
-    mad r1.y, r0.y, -c2.z, r0.z
-    mul r0.y, r0.y, c2.y
-    mad r1.z, r0.x, c2.x, r0.y
-    mov r1.w, c2.w
-    mul r0, r1, c0.x
-    mul r0, r2.w, r0
-    mov oC0, r0
-
-// approximately 18 instruction slots used (4 texture, 14 arithmetic)
-ps_4_0
-dcl_constantbuffer cb0[2], immediateIndexed
-dcl_sampler s0, mode_default
-dcl_resource_texture2d (float,float,float,float) t0
-dcl_resource_texture2d (float,float,float,float) t1
-dcl_resource_texture2d (float,float,float,float) t2
-dcl_resource_texture2d (float,float,float,float) t3
-dcl_input_ps linear v1.xy
-dcl_input_ps linear v1.zw
-dcl_output o0.xyzw
-dcl_temps 3
-sample r0.xyzw, v1.xyxx, t2.xyzw, s0
-add r0.x, r0.x, l(-0.500000)
-mul r0.xy, r0.xxxx, l(1.596000, 0.813000, 0.000000, 0.000000)
-sample r1.xyzw, v1.xyxx, t0.xyzw, s0
-add r0.z, r1.x, l(-0.062500)
-mad r0.y, r0.z, l(1.164000), -r0.y
-mad r1.x, r0.z, l(1.164000), r0.x
-sample r2.xyzw, v1.xyxx, t1.xyzw, s0
-add r0.x, r2.x, l(-0.500000)
-mad r1.y, -r0.x, l(0.391000), r0.y
-mul r0.x, r0.x, l(2.018000)
-mad r1.z, r0.z, l(1.164000), r0.x
-mov r1.w, l(1.000000)
-mul r0.xyzw, r1.xyzw, cb0[1].xxxx
-sample r1.xyzw, v1.zwzz, t3.xyzw, s0
-mul o0.xyzw, r0.xyzw, r1.wwww
-ret 
-// Approximately 17 instruction slots used
-#endif
-
-const BYTE YCbCrShaderMask[] =
-{
-     68,  88,  66,  67,  55,  87, 
-     16, 224, 232,  47,  29, 171, 
-     95,   1, 238, 238, 248, 116, 
-     36,  29,   1,   0,   0,   0, 
-    168,   8,   0,   0,   6,   0, 
-      0,   0,  56,   0,   0,   0, 
-     24,   2,   0,   0, 196,   4, 
-      0,   0,  64,   5,   0,   0, 
-      4,   8,   0,   0, 116,   8, 
-      0,   0,  65, 111, 110,  57, 
-    216,   1,   0,   0, 216,   1, 
-      0,   0,   0,   2, 255, 255, 
-    152,   1,   0,   0,  64,   0, 
-      0,   0,   1,   0,  52,   0, 
-      0,   0,  64,   0,   0,   0, 
-     64,   0,   4,   0,  36,   0, 
-      0,   0,  64,   0,   3,   0, 
-      0,   0,   0,   0,   1,   0, 
-      1,   0,   2,   0,   2,   0, 
-      3,   0,   0,   0,   1,   0, 
-      1,   0,   0,   0,   0,   0, 
-      0,   0,   1,   2, 255, 255, 
-     81,   0,   0,   5,   1,   0, 
-     15, 160,   0,   0,   0, 191, 
-      0,   0, 128, 189, 186,  73, 
-    204,  63, 197,  32,  80,  63, 
-     81,   0,   0,   5,   2,   0, 
-     15, 160, 244, 253, 148,  63, 
-    233,  38,   1,  64,  39,  49, 
-    200,  62,   0,   0, 128,  63, 
-     31,   0,   0,   2,   0,   0, 
-      0, 128,   0,   0,  15, 176, 
-     31,   0,   0,   2,   0,   0, 
-      0, 144,   0,   8,  15, 160, 
-     31,   0,   0,   2,   0,   0, 
-      0, 144,   1,   8,  15, 160, 
-     31,   0,   0,   2,   0,   0, 
-      0, 144,   2,   8,  15, 160, 
-     31,   0,   0,   2,   0,   0, 
-      0, 144,   3,   8,  15, 160, 
-     66,   0,   0,   3,   0,   0, 
-     15, 128,   0,   0, 228, 176, 
-      1,   8, 228, 160,  66,   0, 
-      0,   3,   1,   0,  15, 128, 
-      0,   0, 228, 176,   3,   8, 
-    228, 160,   2,   0,   0,   3, 
-      0,   0,   2, 128,   1,   0, 
-      0, 128,   1,   0,   0, 160, 
-      5,   0,   0,   3,   0,   0, 
-      6, 128,   0,   0,  85, 128, 
-      1,   0, 248, 160,   2,   0, 
-      0,   3,   0,   0,   1, 128, 
-      0,   0,   0, 128,   1,   0, 
-     85, 160,   4,   0,   0,   4, 
-      0,   0,   4, 128,   0,   0, 
-      0, 128,   2,   0,   0, 160, 
-      0,   0, 170, 129,   4,   0, 
-      0,   4,   1,   0,   1, 128, 
-      0,   0,   0, 128,   2,   0, 
-      0, 160,   0,   0,  85, 128, 
-      1,   0,   0,   2,   2,   0, 
-      3, 128,   0,   0, 235, 176, 
-     66,   0,   0,   3,   3,   0, 
-     15, 128,   0,   0, 228, 176, 
-      2,   8, 228, 160,  66,   0, 
-      0,   3,   2,   0,  15, 128, 
-      2,   0, 228, 128,   0,   8, 
-    228, 160,   2,   0,   0,   3, 
-      0,   0,   2, 128,   3,   0, 
-      0, 128,   1,   0,   0, 160, 
-      4,   0,   0,   4,   1,   0, 
-      2, 128,   0,   0,  85, 128, 
-      2,   0, 170, 161,   0,   0, 
-    170, 128,   5,   0,   0,   3, 
-      0,   0,   2, 128,   0,   0, 
-     85, 128,   2,   0,  85, 160, 
-      4,   0,   0,   4,   1,   0, 
-      4, 128,   0,   0,   0, 128, 
-      2,   0,   0, 160,   0,   0, 
-     85, 128,   1,   0,   0,   2, 
-      1,   0,   8, 128,   2,   0, 
-    255, 160,   5,   0,   0,   3, 
-      0,   0,  15, 128,   1,   0, 
-    228, 128,   0,   0,   0, 160, 
-      5,   0,   0,   3,   0,   0, 
-     15, 128,   2,   0, 255, 128, 
-      0,   0, 228, 128,   1,   0, 
-      0,   2,   0,   8,  15, 128, 
-      0,   0, 228, 128, 255, 255, 
-      0,   0,  83,  72,  68,  82, 
-    164,   2,   0,   0,  64,   0, 
-      0,   0, 169,   0,   0,   0, 
-     89,   0,   0,   4,  70, 142, 
-     32,   0,   0,   0,   0,   0, 
-      2,   0,   0,   0,  90,   0, 
-      0,   3,   0,  96,  16,   0, 
-      0,   0,   0,   0,  88,  24, 
-      0,   4,   0, 112,  16,   0, 
-      0,   0,   0,   0,  85,  85, 
-      0,   0,  88,  24,   0,   4, 
-      0, 112,  16,   0,   1,   0, 
-      0,   0,  85,  85,   0,   0, 
-     88,  24,   0,   4,   0, 112, 
-     16,   0,   2,   0,   0,   0, 
-     85,  85,   0,   0,  88,  24, 
-      0,   4,   0, 112,  16,   0, 
-      3,   0,   0,   0,  85,  85, 
-      0,   0,  98,  16,   0,   3, 
-     50,  16,  16,   0,   1,   0, 
-      0,   0,  98,  16,   0,   3, 
-    194,  16,  16,   0,   1,   0, 
-      0,   0, 101,   0,   0,   3, 
-    242,  32,  16,   0,   0,   0, 
-      0,   0, 104,   0,   0,   2, 
-      3,   0,   0,   0,  69,   0, 
-      0,   9, 242,   0,  16,   0, 
-      0,   0,   0,   0,  70,  16, 
-     16,   0,   1,   0,   0,   0, 
-     70, 126,  16,   0,   2,   0, 
-      0,   0,   0,  96,  16,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   7,  18,   0,  16,   0, 
-      0,   0,   0,   0,  10,   0, 
-     16,   0,   0,   0,   0,   0, 
-      1,  64,   0,   0,   0,   0, 
-      0, 191,  56,   0,   0,  10, 
-     50,   0,  16,   0,   0,   0, 
-      0,   0,   6,   0,  16,   0, 
-      0,   0,   0,   0,   2,  64, 
-      0,   0, 186,  73, 204,  63, 
-    197,  32,  80,  63,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-     69,   0,   0,   9, 242,   0, 
-     16,   0,   1,   0,   0,   0, 
-     70,  16,  16,   0,   1,   0, 
-      0,   0,  70, 126,  16,   0, 
-      0,   0,   0,   0,   0,  96, 
-     16,   0,   0,   0,   0,   0, 
-      0,   0,   0,   7,  66,   0, 
-     16,   0,   0,   0,   0,   0, 
-     10,   0,  16,   0,   1,   0, 
-      0,   0,   1,  64,   0,   0, 
-      0,   0, 128, 189,  50,   0, 
-      0,  10,  34,   0,  16,   0, 
-      0,   0,   0,   0,  42,   0, 
-     16,   0,   0,   0,   0,   0, 
-      1,  64,   0,   0, 244, 253, 
-    148,  63,  26,   0,  16, 128, 
-     65,   0,   0,   0,   0,   0, 
-      0,   0,  50,   0,   0,   9, 
-     18,   0,  16,   0,   1,   0, 
-      0,   0,  42,   0,  16,   0, 
-      0,   0,   0,   0,   1,  64, 
-      0,   0, 244, 253, 148,  63, 
-     10,   0,  16,   0,   0,   0, 
-      0,   0,  69,   0,   0,   9, 
-    242,   0,  16,   0,   2,   0, 
-      0,   0,  70,  16,  16,   0, 
-      1,   0,   0,   0,  70, 126, 
-     16,   0,   1,   0,   0,   0, 
-      0,  96,  16,   0,   0,   0, 
-      0,   0,   0,   0,   0,   7, 
-     18,   0,  16,   0,   0,   0, 
-      0,   0,  10,   0,  16,   0, 
-      2,   0,   0,   0,   1,  64, 
-      0,   0,   0,   0,   0, 191, 
-     50,   0,   0,  10,  34,   0, 
-     16,   0,   1,   0,   0,   0, 
-     10,   0,  16, 128,  65,   0, 
-      0,   0,   0,   0,   0,   0, 
-      1,  64,   0,   0,  39,  49, 
-    200,  62,  26,   0,  16,   0, 
-      0,   0,   0,   0,  56,   0, 
-      0,   7,  18,   0,  16,   0, 
-      0,   0,   0,   0,  10,   0, 
-     16,   0,   0,   0,   0,   0, 
-      1,  64,   0,   0, 233,  38, 
-      1,  64,  50,   0,   0,   9, 
-     66,   0,  16,   0,   1,   0, 
-      0,   0,  42,   0,  16,   0, 
-      0,   0,   0,   0,   1,  64, 
-      0,   0, 244, 253, 148,  63, 
-     10,   0,  16,   0,   0,   0, 
-      0,   0,  54,   0,   0,   5, 
-    130,   0,  16,   0,   1,   0, 
-      0,   0,   1,  64,   0,   0, 
-      0,   0, 128,  63,  56,   0, 
-      0,   8, 242,   0,  16,   0, 
-      0,   0,   0,   0,  70,  14, 
-     16,   0,   1,   0,   0,   0, 
-      6, 128,  32,   0,   0,   0, 
-      0,   0,   1,   0,   0,   0, 
-     69,   0,   0,   9, 242,   0, 
-     16,   0,   1,   0,   0,   0, 
-    230,  26,  16,   0,   1,   0, 
-      0,   0,  70, 126,  16,   0, 
-      3,   0,   0,   0,   0,  96, 
-     16,   0,   0,   0,   0,   0, 
-     56,   0,   0,   7, 242,  32, 
-     16,   0,   0,   0,   0,   0, 
-     70,  14,  16,   0,   0,   0, 
-      0,   0, 246,  15,  16,   0, 
-      1,   0,   0,   0,  62,   0, 
-      0,   1,  83,  84,  65,  84, 
-    116,   0,   0,   0,  17,   0, 
-      0,   0,   3,   0,   0,   0, 
-      0,   0,   0,   0,   3,   0, 
-      0,   0,   7,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   1,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      4,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   2,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-     82,  68,  69,  70, 188,   2, 
-      0,   0,   1,   0,   0,   0, 
-      0,   1,   0,   0,   6,   0, 
-      0,   0,  28,   0,   0,   0, 
-      0,   4, 255, 255,   0,   1, 
-      0,   0, 137,   2,   0,   0, 
-    220,   0,   0,   0,   3,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      1,   0,   0,   0,   1,   0, 
-      0,   0, 229,   0,   0,   0, 
-      2,   0,   0,   0,   5,   0, 
-      0,   0,   4,   0,   0,   0, 
-    255, 255, 255, 255,   0,   0, 
-      0,   0,   1,   0,   0,   0, 
-     12,   0,   0,   0, 232,   0, 
-      0,   0,   2,   0,   0,   0, 
-      5,   0,   0,   0,   4,   0, 
-      0,   0, 255, 255, 255, 255, 
-      1,   0,   0,   0,   1,   0, 
-      0,   0,  12,   0,   0,   0, 
-    236,   0,   0,   0,   2,   0, 
-      0,   0,   5,   0,   0,   0, 
-      4,   0,   0,   0, 255, 255, 
-    255, 255,   2,   0,   0,   0, 
-      1,   0,   0,   0,  12,   0, 
-      0,   0, 240,   0,   0,   0, 
-      2,   0,   0,   0,   5,   0, 
-      0,   0,   4,   0,   0,   0, 
-    255, 255, 255, 255,   3,   0, 
-      0,   0,   1,   0,   0,   0, 
-     13,   0,   0,   0, 246,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   1,   0, 
-      0,   0,   0,   0,   0,   0, 
-    115,  83,  97, 109, 112, 108, 
-    101, 114,   0, 116,  89,   0, 
-    116,  67,  98,   0, 116,  67, 
-    114,   0, 116,  77,  97, 115, 
-    107,   0,  36,  71, 108, 111, 
-     98,  97, 108, 115,   0, 171, 
-    246,   0,   0,   0,   8,   0, 
-      0,   0,  24,   1,   0,   0, 
-    224,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-    216,   1,   0,   0,   0,   0, 
-      0,   0,  16,   0,   0,   0, 
-      0,   0,   0,   0, 228,   1, 
-      0,   0,   0,   0,   0,   0, 
-    244,   1,   0,   0,  16,   0, 
-      0,   0,   4,   0,   0,   0, 
-      2,   0,   0,   0,   4,   2, 
-      0,   0,   0,   0,   0,   0, 
-     20,   2,   0,   0,  32,   0, 
-      0,   0,  64,   0,   0,   0, 
-      0,   0,   0,   0,  36,   2, 
-      0,   0,   0,   0,   0,   0, 
-     52,   2,   0,   0,  96,   0, 
-      0,   0,  64,   0,   0,   0, 
-      0,   0,   0,   0,  36,   2, 
-      0,   0,   0,   0,   0,   0, 
-     64,   2,   0,   0, 160,   0, 
-      0,   0,  16,   0,   0,   0, 
-      0,   0,   0,   0, 228,   1, 
-      0,   0,   0,   0,   0,   0, 
-     84,   2,   0,   0, 176,   0, 
-      0,   0,  16,   0,   0,   0, 
-      0,   0,   0,   0, 100,   2, 
-      0,   0,   0,   0,   0,   0, 
-    116,   2,   0,   0, 192,   0, 
-      0,   0,  16,   0,   0,   0, 
-      0,   0,   0,   0, 100,   2, 
-      0,   0,   0,   0,   0,   0, 
-    127,   2,   0,   0, 208,   0, 
-      0,   0,  16,   0,   0,   0, 
-      0,   0,   0,   0, 100,   2, 
-      0,   0,   0,   0,   0,   0, 
-    102,  76,  97, 121, 101, 114, 
-     67, 111, 108, 111, 114,   0, 
-      1,   0,   3,   0,   1,   0, 
-      4,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0, 102,  76, 
-     97, 121, 101, 114,  79, 112, 
-     97,  99, 105, 116, 121,   0, 
-    171, 171,   0,   0,   3,   0, 
-      1,   0,   1,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-    109,  76,  97, 121, 101, 114, 
-     84, 114,  97, 110, 115, 102, 
-    111, 114, 109,   0,   3,   0, 
-      3,   0,   4,   0,   4,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0, 109,  80, 114, 111, 
-    106, 101,  99, 116, 105, 111, 
-    110,   0, 118,  82, 101, 110, 
-    100, 101, 114,  84,  97, 114, 
-    103, 101, 116,  79, 102, 102, 
-    115, 101, 116,   0, 118,  84, 
-    101, 120, 116, 117, 114, 101, 
-     67, 111, 111, 114, 100, 115, 
-      0, 171,   1,   0,   3,   0, 
-      1,   0,   4,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-    118,  76,  97, 121, 101, 114, 
-     81, 117,  97, 100,   0, 118, 
-     77,  97, 115, 107,  81, 117, 
-     97, 100,   0,  77, 105,  99, 
-    114, 111, 115, 111, 102, 116, 
-     32,  40,  82,  41,  32,  72, 
-     76,  83,  76,  32,  83, 104, 
-     97, 100, 101, 114,  32,  67, 
-    111, 109, 112, 105, 108, 101, 
-    114,  32,  57,  46,  51,  48, 
-     46,  57,  50,  48,  48,  46, 
-     49,  54,  51,  56,  52,   0, 
-     73,  83,  71,  78, 104,   0, 
-      0,   0,   3,   0,   0,   0, 
-      8,   0,   0,   0,  80,   0, 
-      0,   0,   0,   0,   0,   0, 
-      1,   0,   0,   0,   3,   0, 
-      0,   0,   0,   0,   0,   0, 
-     15,   0,   0,   0,  92,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   0,   0,   3,   0, 
-      0,   0,   1,   0,   0,   0, 
-      3,   3,   0,   0,  92,   0, 
-      0,   0,   1,   0,   0,   0, 
-      0,   0,   0,   0,   3,   0, 
-      0,   0,   1,   0,   0,   0, 
-     12,  12,   0,   0,  83,  86, 
-     95,  80, 111, 115, 105, 116, 
-    105, 111, 110,   0,  84,  69, 
-     88,  67,  79,  79,  82,  68, 
-      0, 171, 171, 171,  79,  83, 
-     71,  78,  44,   0,   0,   0, 
-      1,   0,   0,   0,   8,   0, 
-      0,   0,  32,   0,   0,   0, 
-      0,   0,   0,   0,   0,   0, 
-      0,   0,   3,   0,   0,   0, 
-      0,   0,   0,   0,  15,   0, 
-      0,   0,  83,  86,  95,  84, 
-     97, 114, 103, 101, 116,   0, 
-    171, 171
-};
deleted file mode 100644
--- a/gfx/layers/d3d11/TextureD3D11.cpp
+++ /dev/null
@@ -1,487 +0,0 @@
-/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*-
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#include "TextureD3D11.h"
-#include "CompositorD3D11.h"
-#include "gfxContext.h"
-#include "gfxImageSurface.h"
-#include "Effects.h"
-#include "ipc/AutoOpenSurface.h"
-#include "ShmemYCbCrImage.h"
-#include "gfxWindowsPlatform.h"
-#include "gfxD2DSurface.h"
-
-namespace mozilla {
-
-using namespace gfx;
-
-namespace layers {
-
-TemporaryRef<TextureHost>
-CreateTextureHostD3D11(SurfaceDescriptorType aDescriptorType,
-                       uint32_t aTextureHostFlags,
-                       uint32_t aTextureFlags)
-{
-  RefPtr<TextureHost> result;
-  if (aDescriptorType == SurfaceDescriptor::TYCbCrImage) {
-    result = new TextureHostYCbCrD3D11();
-  } else if (aDescriptorType == SurfaceDescriptor::TSurfaceDescriptorD3D10) {
-    result = new TextureHostDXGID3D11();
-  } else {
-    result = new TextureHostShmemD3D11();
-  }
-
-  result->SetFlags(aTextureFlags);
-
-  return result.forget();
-}
-
-
-CompositingRenderTargetD3D11::CompositingRenderTargetD3D11(ID3D11Texture2D *aTexture)
-{
-  if (!aTexture) {
-    return;
-  }
-  
-  mTextures[0] = aTexture;
-
-  RefPtr<ID3D11Device> device;
-  mTextures[0]->GetDevice(byRef(device));
-
-  HRESULT hr = device->CreateRenderTargetView(mTextures[0], NULL, byRef(mRTView));
-
-  if (FAILED(hr)) {
-    LOGD3D11("Failed to create RenderTargetView.");
-  }
-}
-
-IntSize
-CompositingRenderTargetD3D11::GetSize() const
-{
-  return TextureSourceD3D11::GetSize();
-}
-
-TextureClientD3D11::TextureClientD3D11(CompositableForwarder* aCompositableForwarder, const TextureInfo& aTextureInfo)
-  : TextureClient(aCompositableForwarder, aTextureInfo)
-  , mIsLocked(false)
-{
-  mTextureInfo = aTextureInfo;
-}
-
-TextureClientD3D11::~TextureClientD3D11()
-{
-  mDescriptor = SurfaceDescriptor();
-
-  ClearDT();
-}
-
-void
-TextureClientD3D11::EnsureAllocated(gfx::IntSize aSize, gfxASurface::gfxContentType aType)
-{
-  D3D10_TEXTURE2D_DESC desc;
-
-  if (mTexture) {
-    mTexture->GetDesc(&desc);
-
-    if (desc.Width == aSize.width || desc.Height == aSize.height) {
-      return;
-    }
-
-    mTexture = nullptr;
-    mSurface = nullptr;
-    ClearDT();
-  }
-
-  mSize = aSize;
-
-  ID3D10Device *device = gfxWindowsPlatform::GetPlatform()->GetD3D10Device();
-
-  CD3D10_TEXTURE2D_DESC newDesc(DXGI_FORMAT_B8G8R8A8_UNORM,
-                                aSize.width, aSize.height, 1, 1,
-                                D3D10_BIND_RENDER_TARGET | D3D10_BIND_SHADER_RESOURCE);
-
-  newDesc.MiscFlags = D3D10_RESOURCE_MISC_SHARED_KEYEDMUTEX;
-
-  HRESULT hr = device->CreateTexture2D(&newDesc, nullptr, byRef(mTexture));
-
-  if (FAILED(hr)) {
-    LOGD3D11("Error creating texture for client!");
-    return;
-  }
-
-  RefPtr<IDXGIResource> resource;
-  mTexture->QueryInterface((IDXGIResource**)byRef(resource));
-
-  HANDLE sharedHandle;
-  hr = resource->GetSharedHandle(&sharedHandle);
-
-  if (FAILED(hr)) {
-    LOGD3D11("Error getting shared handle for texture.");
-  }
-
-  mDescriptor = SurfaceDescriptorD3D10((WindowsHandle)sharedHandle, aType == gfxASurface::CONTENT_COLOR_ALPHA);
-
-  mContentType = aType;
-}
-
-gfxASurface*
-TextureClientD3D11::LockSurface()
-{
-  EnsureSurface();
-
-  LockTexture();
-  return mSurface.get();
-}
-
-DrawTarget*
-TextureClientD3D11::LockDrawTarget()
-{
-  EnsureDrawTarget();
-
-  LockTexture();
-  return mDrawTarget.get();
-}
-
-void
-TextureClientD3D11::Unlock()
-{
-  // TODO - Things seem to believe they can hold on to our surface... well...
-  // They shouldn't!!
-  ReleaseTexture();
-}
-
-void
-TextureClientD3D11::SetDescriptor(const SurfaceDescriptor& aDescriptor)
-{
-  if (aDescriptor.type() == SurfaceDescriptor::Tnull_t) {
-    EnsureAllocated(mSize, mContentType);
-    return;
-  }
-
-  mDescriptor = aDescriptor;
-  mSurface = nullptr;
-  ClearDT();
-
-  if (aDescriptor.type() == SurfaceDescriptor::T__None) {
-    return;
-  }
-
-  MOZ_ASSERT(aDescriptor.type() == SurfaceDescriptor::TSurfaceDescriptorD3D10);
-  ID3D10Device *device = gfxWindowsPlatform::GetPlatform()->GetD3D10Device();
-
-  device->OpenSharedResource((HANDLE)aDescriptor.get_SurfaceDescriptorD3D10().handle(),
-                             __uuidof(ID3D10Texture2D),
-                             (void**)(ID3D10Texture2D**)byRef(mTexture));
-}
-
-void
-TextureClientD3D11::EnsureSurface()
-{
-  if (mSurface) {
-    return;
-  }
-
-  LockTexture();
-  mSurface = new gfxD2DSurface(mTexture, mContentType);
-  ReleaseTexture();
-}
-
-void
-TextureClientD3D11::EnsureDrawTarget()
-{
-  if (mDrawTarget) {
-    return;
-  }
-
-  LockTexture();
-
-  SurfaceFormat format;
-  switch (mContentType) {
-  case gfxASurface::CONTENT_ALPHA:
-    format = FORMAT_A8;
-    break;
-  case gfxASurface::CONTENT_COLOR:
-    format = FORMAT_B8G8R8X8;
-    break;
-  case gfxASurface::CONTENT_COLOR_ALPHA:
-    format = FORMAT_B8G8R8A8;
-    break;
-  default:
-    format = FORMAT_B8G8R8A8;
-  }
-
-  mDrawTarget = Factory::CreateDrawTargetForD3D10Texture(mTexture, format);
-  ReleaseTexture();
-}
-
-void
-TextureClientD3D11::LockTexture()
-{
-  RefPtr<IDXGIKeyedMutex> mutex;
-  mTexture->QueryInterface((IDXGIKeyedMutex**)byRef(mutex));
-
-  mutex->AcquireSync(0, INFINITE);
-  mIsLocked = true;
-}
-
-void
-TextureClientD3D11::ReleaseTexture()
-{
-  // TODO - Bas - We seem to have places that unlock without ever having locked,
-  // that's kind of bad.
-  if (!mIsLocked) {
-    return;
-  }
-
-  if (mDrawTarget) {
-    mDrawTarget->Flush();
-  }
-
-  RefPtr<IDXGIKeyedMutex> mutex;
-  mTexture->QueryInterface((IDXGIKeyedMutex**)byRef(mutex));
-
-  mutex->ReleaseSync(0);
-  mIsLocked = false;
-}
-
-void
-TextureClientD3D11::ClearDT()
-{
-  // An Azure DrawTarget needs to be locked when it gets NULL'ed as this is
-  // when it calls EndDraw. This EndDraw should not execute anything so it
-  // shouldn't -really- need the lock but the debug layer chokes on this.
-  //
-  // Perhaps this should be debug only.
-  if (mDrawTarget) {
-    LockTexture();
-    mDrawTarget = nullptr;
-    ReleaseTexture();
-  }
-}
-
-IntSize
-TextureHostShmemD3D11::GetSize() const
-{
-  if (mIterating) {
-    gfx::IntRect rect = GetTileRect(mCurrentTile);
-    return gfx::IntSize(rect.width, rect.height);
-  }
-  return TextureSourceD3D11::GetSize();
-}
-
-nsIntRect
-TextureHostShmemD3D11::GetTileRect()
-{
-  IntRect rect = GetTileRect(mCurrentTile);
-  return nsIntRect(rect.x, rect.y, rect.width, rect.height);
-}
-
-static uint32_t GetRequiredTiles(uint32_t aSize, uint32_t aMaxSize)
-{
-  uint32_t requiredTiles = aSize / aMaxSize;
-  if (aSize % aMaxSize) {
-    requiredTiles++;
-  }
-  return requiredTiles;
-}
-
-void
-TextureHostShmemD3D11::SetCompositor(Compositor* aCompositor)
-{
-  CompositorD3D11 *d3dCompositor = static_cast<CompositorD3D11*>(aCompositor);
-  mDevice = d3dCompositor ? d3dCompositor->GetDevice() : nullptr;
-}
-
-void
-TextureHostShmemD3D11::UpdateImpl(const SurfaceDescriptor& aImage, nsIntRegion *aRegion)
-{
-  MOZ_ASSERT(aImage.type() == SurfaceDescriptor::TShmem);
-
-  AutoOpenSurface openSurf(OPEN_READ_ONLY, aImage);
-
-  nsRefPtr<gfxImageSurface> surf = openSurf.GetAsImage();
-
-  gfxIntSize size = surf->GetSize();
-
-  uint32_t bpp = 0;
-
-  DXGI_FORMAT dxgiFormat;
-  switch (surf->Format()) {
-  case gfxImageSurface::ImageFormatRGB24:
-    mFormat = FORMAT_B8G8R8X8;
-    dxgiFormat = DXGI_FORMAT_B8G8R8A8_UNORM;
-    bpp = 4;
-    break;
-  case gfxImageSurface::ImageFormatARGB32:
-    mFormat = FORMAT_B8G8R8A8;
-    dxgiFormat = DXGI_FORMAT_B8G8R8A8_UNORM;
-    bpp = 4;
-    break;
-  case gfxImageSurface::ImageFormatA8:
-    mFormat = FORMAT_A8;
-    dxgiFormat = DXGI_FORMAT_A8_UNORM;
-    bpp = 1;
-    break;
-  }
-
-  mSize = IntSize(size.width, size.height);
-
-  CD3D11_TEXTURE2D_DESC desc(dxgiFormat, size.width, size.height,
-                            1, 1, D3D11_BIND_SHADER_RESOURCE, D3D11_USAGE_IMMUTABLE);
-
-  int32_t maxSize = GetMaxTextureSizeForFeatureLevel(mDevice->GetFeatureLevel());
-  if (size.width <= maxSize && size.height <= maxSize) {
-    D3D11_SUBRESOURCE_DATA initData;
-    initData.pSysMem = surf->Data();
-    initData.SysMemPitch = surf->Stride();
-
-    mDevice->CreateTexture2D(&desc, &initData, byRef(mTextures[0]));
-    mIsTiled = false;
-  } else {
-    mIsTiled = true;
-    uint32_t tileCount = GetRequiredTiles(size.width, maxSize) *
-                          GetRequiredTiles(size.height, maxSize);
-
-    mTileTextures.resize(tileCount);
-
-    for (uint32_t i = 0; i < tileCount; i++) {
-      IntRect tileRect = GetTileRect(i);
-
-      desc.Width = tileRect.width;
-      desc.Height = tileRect.height;
-
-      D3D11_SUBRESOURCE_DATA initData;
-      initData.pSysMem = surf->Data() + tileRect.y * surf->Stride() + tileRect.x * bpp;
-      initData.SysMemPitch = surf->Stride();
-
-      mDevice->CreateTexture2D(&desc, &initData, byRef(mTileTextures[i]));
-    }
-  }
-}
-
-IntRect
-TextureHostShmemD3D11::GetTileRect(uint32_t aID) const
-{
-  uint32_t maxSize = GetMaxTextureSizeForFeatureLevel(mDevice->GetFeatureLevel());
-  uint32_t horizontalTiles = GetRequiredTiles(mSize.width, maxSize);
-  uint32_t verticalTiles = GetRequiredTiles(mSize.height, maxSize);
-
-  uint32_t verticalTile = aID / horizontalTiles;
-  uint32_t horizontalTile = aID % horizontalTiles;
-
-  return IntRect(horizontalTile * maxSize,
-                 verticalTile * maxSize,
-                 horizontalTile < (horizontalTiles - 1) ? maxSize : mSize.width % maxSize,
-                 verticalTile < (verticalTiles - 1) ? maxSize : mSize.height % maxSize);
-}
-
-void
-TextureHostDXGID3D11::SetCompositor(Compositor* aCompositor)
-{
-  CompositorD3D11 *d3dCompositor = static_cast<CompositorD3D11*>(aCompositor);
-  mDevice = d3dCompositor ? d3dCompositor->GetDevice() : nullptr;
-}
-
-IntSize
-TextureHostDXGID3D11::GetSize() const
-{
-  return TextureSourceD3D11::GetSize();
-}
-
-bool
-TextureHostDXGID3D11::Lock()
-{
-  LockTexture();
-  return true;
-}
-
-void
-TextureHostDXGID3D11::Unlock()
-{
-  ReleaseTexture();
-}
-
-void
-TextureHostDXGID3D11::UpdateImpl(const SurfaceDescriptor& aImage, nsIntRegion *aRegion)
-{
-  MOZ_ASSERT(aImage.type() == SurfaceDescriptor::TSurfaceDescriptorD3D10);
-
-  mDevice->OpenSharedResource((HANDLE)aImage.get_SurfaceDescriptorD3D10().handle(),
-                              __uuidof(ID3D11Texture2D), (void**)(ID3D11Texture2D**)byRef(mTextures[0]));
-  mFormat = aImage.get_SurfaceDescriptorD3D10().hasAlpha() ? FORMAT_B8G8R8A8 : FORMAT_B8G8R8X8;
-
-  D3D11_TEXTURE2D_DESC desc;
-  mTextures[0]->GetDesc(&desc);
-
-  mSize = IntSize(desc.Width, desc.Height);
-}
-
-void
-TextureHostDXGID3D11::LockTexture()
-{
-  RefPtr<IDXGIKeyedMutex> mutex;
-  mTextures[0]->QueryInterface((IDXGIKeyedMutex**)byRef(mutex));
-
-  mutex->AcquireSync(0, INFINITE);
-}
-
-void
-TextureHostDXGID3D11::ReleaseTexture()
-{
-  RefPtr<IDXGIKeyedMutex> mutex;
-  mTextures[0]->QueryInterface((IDXGIKeyedMutex**)byRef(mutex));
-
-  mutex->ReleaseSync(0);
-}
-
-void
-TextureHostYCbCrD3D11::SetCompositor(Compositor* aCompositor)
-{
-  CompositorD3D11 *d3dCompositor = static_cast<CompositorD3D11*>(aCompositor);
-  mDevice = d3dCompositor ? d3dCompositor->GetDevice() : nullptr;
-}
-
-IntSize
-TextureHostYCbCrD3D11::GetSize() const
-{
-  return TextureSourceD3D11::GetSize();
-}
-
-void
-TextureHostYCbCrD3D11::UpdateImpl(const SurfaceDescriptor& aImage, nsIntRegion *aRegion)
-{
-  MOZ_ASSERT(aImage.type() == SurfaceDescriptor::TYCbCrImage);
-
-  ShmemYCbCrImage shmemImage(aImage.get_YCbCrImage().data(),
-                             aImage.get_YCbCrImage().offset());
-
-  gfxIntSize gfxCbCrSize = shmemImage.GetCbCrSize();
-
-  gfxIntSize size = shmemImage.GetYSize();
-
-  D3D11_SUBRESOURCE_DATA initData;
-  initData.pSysMem = shmemImage.GetYData();
-  initData.SysMemPitch = shmemImage.GetYStride();
-
-  CD3D11_TEXTURE2D_DESC desc(DXGI_FORMAT_R8_UNORM, size.width, size.height,
-                              1, 1, D3D11_BIND_SHADER_RESOURCE, D3D11_USAGE_IMMUTABLE);
-
-  mDevice->CreateTexture2D(&desc, &initData, byRef(mTextures[0]));
-
-  initData.pSysMem = shmemImage.GetCbData();
-  initData.SysMemPitch = shmemImage.GetCbCrStride();
-  desc.Width = shmemImage.GetCbCrSize().width;
-  desc.Height = shmemImage.GetCbCrSize().height;
-
-  mDevice->CreateTexture2D(&desc, &initData, byRef(mTextures[1]));
-
-  initData.pSysMem = shmemImage.GetCrData();
-  mDevice->CreateTexture2D(&desc, &initData, byRef(mTextures[2]));
-
-  mSize = IntSize(size.width, size.height);
-}
-
-}
-}
deleted file mode 100644
--- a/gfx/layers/d3d11/TextureD3D11.h
+++ /dev/null
@@ -1,246 +0,0 @@
-/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*-
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#ifndef MOZILLA_GFX_TEXTURED3D11_H
-#define MOZILLA_GFX_TEXTURED3D11_H
-
-#include "mozilla/layers/Compositor.h"
-#include "mozilla/layers/TextureClient.h"
-#include <d3d11.h>
-#include <vector>
-
-class gfxD2DSurface;
-
-namespace mozilla {
-namespace layers {
-
-class TextureSourceD3D11
-{
-public:
-  TextureSourceD3D11()
-  { }
-
-  virtual ID3D11Texture2D *GetD3D11Texture() { return mTextures[0]; }
-  virtual bool IsYCbCrSource() const { return false; }
-
-  struct YCbCrTextures
-  {
-    ID3D11Texture2D *mY;
-    ID3D11Texture2D *mCb;
-    ID3D11Texture2D *mCr;
-  };
-  virtual YCbCrTextures GetYCbCrTextures() {
-    YCbCrTextures textures = { mTextures[0], mTextures[1], mTextures[2] };
-    return textures;
-  }
-protected:
-  virtual gfx::IntSize GetSize() const { return mSize; }
-
-  gfx::IntSize mSize;
-  RefPtr<ID3D11Texture2D> mTextures[3];
-};
-
-class CompositingRenderTargetD3D11 : public CompositingRenderTarget,
-                                     public TextureSourceD3D11
-{
-public:
-  // Use aTexture == nullptr for rendering to the window
-  CompositingRenderTargetD3D11(ID3D11Texture2D *aTexture);
-
-  virtual TextureSourceD3D11* AsSourceD3D11() MOZ_OVERRIDE { return this; }
-
-  virtual gfx::IntSize GetSize() const MOZ_OVERRIDE;
-
-  void SetSize(const gfx::IntSize& aSize) { mSize = aSize; }
-
-private:
-  friend class CompositorD3D11;
-
-  RefPtr<ID3D11RenderTargetView> mRTView;
-};
-
-class TextureClientD3D11 : public TextureClient
-{
-public:
-  TextureClientD3D11(CompositableForwarder* aCompositableForwarder, const TextureInfo& aTextureInfo);
-  ~TextureClientD3D11();
-
-  virtual bool SupportsType(TextureClientType aType) MOZ_OVERRIDE { return aType == TEXTURE_CONTENT; }
-
-  virtual void EnsureAllocated(gfx::IntSize aSize, gfxASurface::gfxContentType aType) MOZ_OVERRIDE;
-
-  virtual gfxASurface* LockSurface() MOZ_OVERRIDE;
-  virtual gfx::DrawTarget* LockDrawTarget() MOZ_OVERRIDE;
-  virtual void Unlock() MOZ_OVERRIDE;
-
-  virtual void SetDescriptor(const SurfaceDescriptor& aDescriptor) MOZ_OVERRIDE;
-  virtual gfxASurface::gfxContentType GetContentType() MOZ_OVERRIDE { return mContentType; }
-
-
-private:
-  void EnsureSurface();
-  void EnsureDrawTarget();
-  void LockTexture();
-  void ReleaseTexture();
-  void ClearDT();
-
-  RefPtr<ID3D10Texture2D> mTexture;
-  nsRefPtr<gfxD2DSurface> mSurface;
-  RefPtr<gfx::DrawTarget> mDrawTarget;
-  gfx::IntSize mSize;
-  bool mIsLocked;
-  gfxContentType mContentType;
-};
-
-class TextureHostShmemD3D11 : public TextureHost
-                            , public TextureSourceD3D11
-                            , public TileIterator
-{
-public:
-  TextureHostShmemD3D11()
-    : mDevice(nullptr)
-    , mIsTiled(false)
-    , mCurrentTile(0)
-    , mIterating(false)
-  {
-  }
-
-  virtual void SetCompositor(Compositor* aCompositor) MOZ_OVERRIDE;
-
-  virtual TextureSourceD3D11* AsSourceD3D11() MOZ_OVERRIDE { return this; }
-
-  virtual ID3D11Texture2D *GetD3D11Texture() MOZ_OVERRIDE {
-    return mIsTiled ? mTileTextures[mCurrentTile] : TextureSourceD3D11::GetD3D11Texture();
-  }
-
-  virtual gfx::IntSize GetSize() const MOZ_OVERRIDE;
-
-  virtual LayerRenderState GetRenderState() { return LayerRenderState(); }
-
-  virtual bool Lock() MOZ_OVERRIDE { return true; }
-
-#ifdef MOZ_LAYERS_HAVE_LOG
-  virtual const char* Name() { return "TextureHostShmemD3D11"; }
-#endif
-
-  virtual void BeginTileIteration() MOZ_OVERRIDE {
-    mIterating = true;
-    mCurrentTile = 0;
-  }
-  virtual void EndTileIteration() MOZ_OVERRIDE {
-    mIterating = false;
-  }
-  virtual nsIntRect GetTileRect() MOZ_OVERRIDE;
-  virtual size_t GetTileCount() MOZ_OVERRIDE { return mTileTextures.size(); }
-  virtual bool NextTile() MOZ_OVERRIDE {
-    return (++mCurrentTile < mTileTextures.size());
-  }
-
-  virtual TileIterator* AsTileIterator() MOZ_OVERRIDE {
-    return mIsTiled ? this : nullptr;
-  }
-protected:
-  virtual void UpdateImpl(const SurfaceDescriptor& aSurface,
-                          nsIntRegion* aRegion) MOZ_OVERRIDE;
-private:
-
-  gfx::IntRect GetTileRect(uint32_t aID) const;
-
-  RefPtr<ID3D11Device> mDevice;
-  bool mIsTiled;
-  std::vector< RefPtr<ID3D11Texture2D> > mTileTextures;
-  uint32_t mCurrentTile;
-  bool mIterating;
-};
-
-class TextureHostDXGID3D11 : public TextureHost
-                           , public TextureSourceD3D11
-{
-public:
-  TextureHostDXGID3D11()
-    : mDevice(nullptr)
-  {
-  }
-
-  virtual void SetCompositor(Compositor* aCompositor) MOZ_OVERRIDE;
-
-  virtual TextureSourceD3D11* AsSourceD3D11() MOZ_OVERRIDE { return this; }
-
-  virtual gfx::IntSize GetSize() const MOZ_OVERRIDE;
-
-  virtual bool Lock() MOZ_OVERRIDE;
-  virtual void Unlock() MOZ_OVERRIDE;
-
-#ifdef MOZ_LAYERS_HAVE_LOG
-  virtual const char* Name() { return "TextureHostDXGID3D11"; }
-#endif
-
-protected:
-  virtual void UpdateImpl(const SurfaceDescriptor& aSurface,
-                          nsIntRegion* aRegion) MOZ_OVERRIDE;
-private:
-  void LockTexture();
-  void ReleaseTexture();
-
-  gfx::IntRect GetTileRect(uint32_t aID) const; // TODO[Bas] not defined anywhere?
-
-  RefPtr<ID3D11Device> mDevice;
-};
-
-class TextureHostYCbCrD3D11 : public TextureHost
-                            , public TextureSourceD3D11
-{
-public:
-  TextureHostYCbCrD3D11()
-    : mDevice(nullptr)
-  {
-    mFormat = gfx::FORMAT_YUV;
-  }
-
-  virtual void SetCompositor(Compositor* aCompositor) MOZ_OVERRIDE;
-
-  virtual TextureSourceD3D11* AsSourceD3D11() MOZ_OVERRIDE { return this; }
-
-  virtual gfx::IntSize GetSize() const MOZ_OVERRIDE;
-
-  virtual bool IsYCbCrSource() const MOZ_OVERRIDE { return true; }
-
-#ifdef MOZ_LAYERS_HAVE_LOG
-  virtual const char* Name() MOZ_OVERRIDE { return "TextureImageTextureHostD3D11"; }
-#endif
-
-protected:
-  virtual void UpdateImpl(const SurfaceDescriptor& aSurface,
-                          nsIntRegion* aRegion) MOZ_OVERRIDE;
-
-private:
-  RefPtr<ID3D11Device> mDevice;
-};
-
-inline uint32_t GetMaxTextureSizeForFeatureLevel(D3D_FEATURE_LEVEL aFeatureLevel)
-{
-  int32_t maxTextureSize;
-  switch (aFeatureLevel) {
-  case D3D_FEATURE_LEVEL_11_1:
-  case D3D_FEATURE_LEVEL_11_0:
-    maxTextureSize = D3D11_REQ_TEXTURE2D_U_OR_V_DIMENSION;
-    break;
-  case D3D_FEATURE_LEVEL_10_1:
-  case D3D_FEATURE_LEVEL_10_0:
-    maxTextureSize = D3D10_REQ_TEXTURE2D_U_OR_V_DIMENSION;
-    break;
-  case D3D_FEATURE_LEVEL_9_3:
-    maxTextureSize = D3D_FL9_3_REQ_TEXTURE2D_U_OR_V_DIMENSION;
-    break;
-  default:
-    maxTextureSize = D3D_FL9_1_REQ_TEXTURE2D_U_OR_V_DIMENSION;
-  }
-  return maxTextureSize;
-}
-
-}
-}
-
-#endif /* MOZILLA_GFX_TEXTURED3D11_H */
deleted file mode 100644
--- a/gfx/layers/d3d11/genshaders.sh
+++ /dev/null
@@ -1,30 +0,0 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-tempfile=tmpShaderHeader
-rm CompositorD3D11Shaders.h
-fxc CompositorD3D11.fx -ELayerQuadVS -nologo -Tvs_4_0_level_9_3 -Fh$tempfile -VnLayerQuadVS
-cat $tempfile >> CompositorD3D11Shaders.h
-fxc CompositorD3D11.fx -ESolidColorShader -Tps_4_0_level_9_3 -nologo -Fh$tempfile -VnSolidColorShader
-cat $tempfile >> CompositorD3D11Shaders.h
-fxc CompositorD3D11.fx -ERGBShader -Tps_4_0_level_9_3 -nologo -Fh$tempfile -VnRGBShader
-cat $tempfile >> CompositorD3D11Shaders.h
-fxc CompositorD3D11.fx -ERGBAShader -Tps_4_0_level_9_3 -nologo -Fh$tempfile -VnRGBAShader
-cat $tempfile >> CompositorD3D11Shaders.h
-fxc CompositorD3D11.fx -EYCbCrShader -Tps_4_0_level_9_3 -nologo -Fh$tempfile -VnYCbCrShader
-cat $tempfile >> CompositorD3D11Shaders.h
-fxc CompositorD3D11.fx -ELayerQuadMaskVS -nologo -Tvs_4_0_level_9_3 -Fh$tempfile -VnLayerQuadMaskVS
-cat $tempfile >> CompositorD3D11Shaders.h
-fxc CompositorD3D11.fx -ELayerQuadMask3DVS -nologo -Tvs_4_0_level_9_3 -Fh$tempfile -VnLayerQuadMask3DVS
-cat $tempfile >> CompositorD3D11Shaders.h
-fxc CompositorD3D11.fx -ESolidColorShaderMask -Tps_4_0_level_9_3 -nologo -Fh$tempfile -VnSolidColorShaderMask
-cat $tempfile >> CompositorD3D11Shaders.h
-fxc CompositorD3D11.fx -ERGBShaderMask -Tps_4_0_level_9_3 -nologo -Fh$tempfile -VnRGBShaderMask
-cat $tempfile >> CompositorD3D11Shaders.h
-fxc CompositorD3D11.fx -ERGBAShaderMask -Tps_4_0_level_9_3 -nologo -Fh$tempfile -VnRGBAShaderMask
-cat $tempfile >> CompositorD3D11Shaders.h
-fxc CompositorD3D11.fx -ERGBAShaderMask3D -Tps_4_0_level_9_3 -nologo -Fh$tempfile -VnRGBAShaderMask3D
-cat $tempfile >> CompositorD3D11Shaders.h
-fxc CompositorD3D11.fx -EYCbCrShaderMask -Tps_4_0_level_9_3 -nologo -Fh$tempfile -VnYCbCrShaderMask
-cat $tempfile >> CompositorD3D11Shaders.h
--- a/gfx/layers/ipc/CompositorParent.cpp
+++ b/gfx/layers/ipc/CompositorParent.cpp
@@ -8,19 +8,16 @@
 
 #include "mozilla/DebugOnly.h"
 
 #include "AsyncPanZoomController.h"
 #include "AutoOpenSurface.h"
 #include "CompositorParent.h"
 #include "mozilla/layers/CompositorOGL.h"
 #include "mozilla/layers/BasicCompositor.h"
-#ifdef XP_WIN
-#include "mozilla/layers/CompositorD3D11.h"
-#endif
 #include "LayerTransactionParent.h"
 #include "nsIWidget.h"
 #include "nsGkAtoms.h"
 #include "RenderTrace.h"
 #include "gfxPlatform.h"
 #include "mozilla/AutoRestore.h"
 #include "mozilla/layers/AsyncCompositionManager.h"
 #include "mozilla/layers/LayerManagerComposite.h"
@@ -566,21 +563,16 @@ CompositorParent::AllocPLayerTransaction
     mLayerManager =
       new LayerManagerComposite(new CompositorOGL(mWidget,
                                                   mEGLSurfaceSize.width,
                                                   mEGLSurfaceSize.height,
                                                   mUseExternalSurfaceSize));
   } else if (aBackendHint == mozilla::layers::LAYERS_BASIC) {
     mLayerManager =
       new LayerManagerComposite(new BasicCompositor(mWidget));
-#ifdef XP_WIN
-  } else if (aBackendHint == mozilla::layers::LAYERS_D3D11) {
-    mLayerManager =
-      new LayerManagerComposite(new CompositorD3D11(mWidget));
-#endif
   } else {
     NS_ERROR("Unsupported backend selected for Async Compositor");
     return nullptr;
   }
 
   mWidget = nullptr;
   mLayerManager->SetCompositorID(mCompositorID);
 
--- a/gfx/layers/moz.build
+++ b/gfx/layers/moz.build
@@ -51,19 +51,17 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'wind
             'DeviceManagerD3D9.h',
         ]
     if CONFIG['MOZ_ENABLE_D3D10_LAYER']:
         EXPORTS += [
             'LayerManagerD3D10.h',
             'ReadbackManagerD3D10.h',
         ]
         EXPORTS.mozilla.layers += [
-            'CompositorD3D11.h',
             'ShadowLayerUtilsD3D10.h',
-            'TextureD3D11.h',
         ]
 
 EXPORTS.gfxipc += [
     'ShadowLayerUtils.h',
 ]
 
 EXPORTS.mozilla.layers += [
     'AsyncCompositionManager.h',
@@ -81,18 +79,18 @@ EXPORTS.mozilla.layers += [
     'CompositorChild.h',
     'CompositorCocoaWidgetHelper.h',
     'CompositorOGL.h',
     'CompositorParent.h',
     'CompositorTypes.h',
     'ContainerLayerComposite.h',
     'ContentClient.h',
     'ContentHost.h',
+    'D3D9SurfaceImage.h',
     'Effects.h',
-    'D3D9SurfaceImage.h',
     'GeckoContentController.h',
     'GestureEventListener.h',
     'ISurfaceAllocator.h',
     'ImageBridgeChild.h',
     'ImageBridgeParent.h',
     'ImageClient.h',
     'ImageHost.h',
     'ImageLayerComposite.h',
--- a/gfx/thebes/gfxWindowsPlatform.cpp
+++ b/gfx/thebes/gfxWindowsPlatform.cpp
@@ -48,18 +48,16 @@ using namespace mozilla::gfx;
 
 #include <d3d10_1.h>
 
 #include "mozilla/gfx/2D.h"
 
 #include "nsMemory.h"
 #endif
 
-#include <d3d11.h>
-
 #include "nsIMemoryReporter.h"
 #include <winternl.h>
 #include "d3dkmtQueryStatistics.h"
 
 using namespace mozilla;
 
 #ifdef CAIRO_HAS_D2D_SURFACE
 
@@ -155,35 +153,22 @@ typedef HRESULT (WINAPI*D3D10CreateDevic
   IDXGIAdapter *pAdapter,
   D3D10_DRIVER_TYPE DriverType,
   HMODULE Software,
   UINT Flags,
   D3D10_FEATURE_LEVEL1 HardwareLevel,
   UINT SDKVersion,
   ID3D10Device1 **ppDevice
 );
-#endif
 
 typedef HRESULT(WINAPI*CreateDXGIFactory1Func)(
   REFIID riid,
   void **ppFactory
 );
-
-typedef HRESULT (WINAPI*D3D11CreateDeviceFunc)(
-  IDXGIAdapter *pAdapter,
-  D3D_DRIVER_TYPE DriverType,
-  HMODULE Software,
-  UINT Flags,
-  D3D_FEATURE_LEVEL *pFeatureLevels,
-  UINT FeatureLevels,
-  UINT SDKVersion,
-  ID3D11Device **ppDevice,
-  D3D_FEATURE_LEVEL *pFeatureLevel,
-  ID3D11DeviceContext *ppImmediateContext
-);
+#endif
 
 class GPUAdapterMultiReporter : public nsIMemoryMultiReporter {
 
     // Callers must Release the DXGIAdapter after use or risk mem-leak
     static bool GetDXGIAdapter(IDXGIAdapter **DXGIAdapter)
     {
         ID3D10Device1 *D2D10Device;
         IDXGIDevice *DXGIDevice;
@@ -327,17 +312,16 @@ static __inline void
 BuildKeyNameFromFontName(nsAString &aName)
 {
     if (aName.Length() >= LF_FACESIZE)
         aName.Truncate(LF_FACESIZE - 1);
     ToLowerCase(aName);
 }
 
 gfxWindowsPlatform::gfxWindowsPlatform()
-  : mD3D11DeviceInitialized(false)
 {
     mPrefFonts.Init(50);
 
     mUseClearTypeForDownloadableFonts = UNINITIALIZED_VALUE;
     mUseClearTypeAlways = UNINITIALIZED_VALUE;
 
     mUsingGDIFonts = false;
 
@@ -539,36 +523,55 @@ gfxWindowsPlatform::VerifyD2DDevice(bool
         }
         mD2DDevice = nullptr;
     }
 
     mozilla::ScopedGfxFeatureReporter reporter("D2D", aAttemptForce);
 
     nsRefPtr<ID3D10Device1> device;
 
+    nsModuleHandle dxgiModule(LoadLibrarySystem32(L"dxgi.dll"));
+    CreateDXGIFactory1Func createDXGIFactory1 = (CreateDXGIFactory1Func)
+        GetProcAddress(dxgiModule, "CreateDXGIFactory1");
+
     int supportedFeatureLevelsCount = ArrayLength(kSupportedFeatureLevels);
     // If we're not running in Metro don't allow DX9.3
     if (!IsRunningInWindowsMetro()) {
       supportedFeatureLevelsCount--;
     }
 
-    nsRefPtr<IDXGIAdapter1> adapter1 = GetDXGIAdapter();
-
-    if (!adapter1) {
-      // Unable to create adapter, abort acceleration.
-      return;
-    }
-
     // It takes a lot of time (5-10% of startup time or ~100ms) to do both
     // a createD3DDevice on D3D10_FEATURE_LEVEL_10_0.  We therefore store
     // the last used feature level to go direct to that.
     int featureLevelIndex = Preferences::GetInt(kFeatureLevelPref, 0);
     if (featureLevelIndex >= supportedFeatureLevelsCount || featureLevelIndex < 0)
       featureLevelIndex = 0;
 
+    // Try to use a DXGI 1.1 adapter in order to share resources
+    // across processes.
+    nsRefPtr<IDXGIAdapter1> adapter1;
+    if (createDXGIFactory1) {
+        nsRefPtr<IDXGIFactory1> factory1;
+        HRESULT hr = createDXGIFactory1(__uuidof(IDXGIFactory1),
+                                        getter_AddRefs(factory1));
+
+        if (FAILED(hr) || !factory1) {
+          // This seems to happen with some people running the iZ3D driver.
+          // They won't get acceleration.
+          return;
+        }
+
+        hr = factory1->EnumAdapters1(0, getter_AddRefs(adapter1));
+        if (FAILED(hr) || !adapter1) {
+          // We should return and not accelerate if we can't obtain
+          // an adapter.
+          return;
+        }
+    }
+
     // Start with the last used feature level, and move to lower DX versions
     // until we find one that works.
     HRESULT hr = E_FAIL;
     for (int i = featureLevelIndex; i < supportedFeatureLevelsCount; i++) {
       hr = CreateDevice(adapter1, i);
       // If it succeeded we found the first available feature level
       if (SUCCEEDED(hr))
         break;
@@ -1424,94 +1427,13 @@ gfxWindowsPlatform::SetupClearTypeParams
 
         GetDWriteFactory()->CreateCustomRenderingParams(gamma, contrast, level,
 	    dwriteGeometry, DWRITE_RENDERING_MODE_CLEARTYPE_GDI_CLASSIC,
             getter_AddRefs(mRenderingParams[TEXT_RENDERING_GDI_CLASSIC]));
     }
 #endif
 }
 
-ID3D11Device*
-gfxWindowsPlatform::GetD3D11Device()
-{
-  if (mD3D11DeviceInitialized) {
-    return mD3D11Device;
-  }
-
-  mD3D11DeviceInitialized = true;
-
-  nsModuleHandle d3d11Module(LoadLibrarySystem32(L"d3d11.dll"));
-  D3D11CreateDeviceFunc d3d11CreateDevice = (D3D11CreateDeviceFunc)
-    GetProcAddress(d3d11Module, "D3D11CreateDevice");
-
-  if (!d3d11CreateDevice) {
-    return nullptr;
-  }
-
-  D3D_FEATURE_LEVEL featureLevels[] = {
-    D3D_FEATURE_LEVEL_11_1,
-    D3D_FEATURE_LEVEL_11_0,
-    D3D_FEATURE_LEVEL_10_1,
-    D3D_FEATURE_LEVEL_10_0,
-    D3D_FEATURE_LEVEL_9_3
-  };
-
-  RefPtr<IDXGIAdapter1> adapter = GetDXGIAdapter();
-
-  if (!adapter) {
-    return nullptr;
-  }
-
-  HRESULT hr = d3d11CreateDevice(adapter, D3D_DRIVER_TYPE_UNKNOWN, NULL,
-                                 D3D11_CREATE_DEVICE_BGRA_SUPPORT,
-                                 featureLevels, sizeof(featureLevels) / sizeof(D3D_FEATURE_LEVEL),
-                                 D3D11_SDK_VERSION, byRef(mD3D11Device), nullptr, nullptr);
-
-  // We leak these everywhere and we need them our entire runtime anyway, let's
-  // leak it here as well.
-  d3d11Module.disown();
-
-  return mD3D11Device;
-}
-
 bool
 gfxWindowsPlatform::IsOptimus()
 {
   return GetModuleHandleA("nvumdshim.dll");
 }
-
-IDXGIAdapter1*
-gfxWindowsPlatform::GetDXGIAdapter()
-{
-  if (mAdapter) {
-    return mAdapter;
-  }
-
-  nsModuleHandle dxgiModule(LoadLibrarySystem32(L"dxgi.dll"));
-  CreateDXGIFactory1Func createDXGIFactory1 = (CreateDXGIFactory1Func)
-    GetProcAddress(dxgiModule, "CreateDXGIFactory1");
-
-  // Try to use a DXGI 1.1 adapter in order to share resources
-  // across processes.
-  if (createDXGIFactory1) {
-    nsRefPtr<IDXGIFactory1> factory1;
-    HRESULT hr = createDXGIFactory1(__uuidof(IDXGIFactory1),
-                                    getter_AddRefs(factory1));
-
-    if (FAILED(hr) || !factory1) {
-      // This seems to happen with some people running the iZ3D driver.
-      // They won't get acceleration.
-      return nullptr;
-    }
-
-    hr = factory1->EnumAdapters1(0, byRef(mAdapter));
-    if (FAILED(hr)) {
-      // We should return and not accelerate if we can't obtain
-      // an adapter.
-      return nullptr;
-    }
-  }
-
-  // We leak this module everywhere, we might as well do so here as well.
-  dxgiModule.disown();
-
-  return mAdapter;
-}
--- a/gfx/thebes/gfxWindowsPlatform.h
+++ b/gfx/thebes/gfxWindowsPlatform.h
@@ -20,28 +20,23 @@
 #include "gfxDWriteFonts.h"
 #endif
 #include "gfxPlatform.h"
 #include "gfxContext.h"
 
 #include "nsTArray.h"
 #include "nsDataHashtable.h"
 
-#include "mozilla/RefPtr.h"
-
 #include <windows.h>
 #include <objbase.h>
 
 #ifdef CAIRO_HAS_D2D_SURFACE
 #include <dxgi.h>
 #endif
 
-class ID3D11Device;
-class IDXGIAdapter1;
-
 class nsIMemoryMultiReporter;
 
 // Utility to get a Windows HDC from a thebes context,
 // used by both GDI and Uniscribe font shapers
 struct DCFromContext {
     DCFromContext(gfxContext *aContext) {
         dc = NULL;
         nsRefPtr<gfxASurface> aSurface = aContext->CurrentSurface();
@@ -255,46 +250,41 @@ public:
     { return mRenderingParams[aRenderMode]; }
 #else
     inline bool DWriteEnabled() { return false; }
 #endif
 #ifdef CAIRO_HAS_D2D_SURFACE
     cairo_device_t *GetD2DDevice() { return mD2DDevice; }
     ID3D10Device1 *GetD3D10Device() { return mD2DDevice ? cairo_d2d_device_get_device(mD2DDevice) : nullptr; }
 #endif
-    ID3D11Device *GetD3D11Device();
 
     static bool IsOptimus();
 
 protected:
     RenderMode mRenderMode;
 
     int8_t mUseClearTypeForDownloadableFonts;
     int8_t mUseClearTypeAlways;
     HDC mScreenDC;
 
 private:
     void Init();
-    IDXGIAdapter1 *GetDXGIAdapter();
 
     bool mUseDirectWrite;
     bool mUsingGDIFonts;
 
 #ifdef CAIRO_HAS_DWRITE_FONT
     nsRefPtr<IDWriteFactory> mDWriteFactory;
     nsRefPtr<IDWriteTextAnalyzer> mDWriteAnalyzer;
     nsRefPtr<IDWriteRenderingParams> mRenderingParams[TEXT_RENDERING_COUNT];
     DWRITE_MEASURING_MODE mMeasuringMode;
 #endif
 #ifdef CAIRO_HAS_D2D_SURFACE
     cairo_device_t *mD2DDevice;
 #endif
-    mozilla::RefPtr<IDXGIAdapter1> mAdapter;
-    mozilla::RefPtr<ID3D11Device> mD3D11Device;
-    bool mD3D11DeviceInitialized;
 
     virtual qcms_profile* GetPlatformCMSOutputProfile();
 
     // TODO: unify this with mPrefFonts (NB: holds families, not fonts) in gfxPlatformFontList
     nsDataHashtable<nsCStringHashKey, nsTArray<nsRefPtr<gfxFontEntry> > > mPrefFonts;
 
     nsIMemoryMultiReporter* mGPUAdapterMultiReporter;
 };
--- a/gfx/thebes/moz.build
+++ b/gfx/thebes/moz.build
@@ -60,19 +60,19 @@ elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'go
         'gfxAndroidPlatform.h',
         'gfxFT2Fonts.h',
         'gfxFT2FontBase.h',
         'gfxPDFSurface.h',
     ]
 elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa':
     EXPORTS += [
         'gfxPlatformMac.h',
-        'gfxQuartzSurface.h',
         'gfxQuartzImageSurface.h',
         'gfxQuartzNativeDrawing.h',
+        'gfxQuartzSurface.h',
     ]
 elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gtk2':
     EXPORTS += [
         'gfxFT2FontBase.h',
         'gfxGdkNativeRenderer.h',
         'gfxPDFSurface.h',
         'gfxPSSurface.h',
         'gfxPlatformGtk.h',
--- a/image/src/imgStatusTracker.cpp
+++ b/image/src/imgStatusTracker.cpp
@@ -535,17 +535,17 @@ imgStatusTracker::CalculateAndApplyDiffe
   // Now that we've calculated the difference in state, synchronize our state
   // with the other tracker.
 
   // First, actually synchronize our state.
   mState |= diff.mDiffState | loadState;
   if (diff.mUnblockedOnload) {
     mState &= ~stateBlockingOnload;
   }
-  mImageStatus = other->mImageStatus;
+
   mIsMultipart = other->mIsMultipart;
   mHadLastPart = other->mHadLastPart;
   mImageStatus |= other->mImageStatus;
   mHasBeenDecoded = mHasBeenDecoded || other->mHasBeenDecoded;
 
   // The error state is sticky and overrides all other bits.
   if (mImageStatus & imgIRequest::STATUS_ERROR) {
     mImageStatus = imgIRequest::STATUS_ERROR;
--- a/js/public/GCAPI.h
+++ b/js/public/GCAPI.h
@@ -234,16 +234,20 @@ class ObjectPtr
     }
 
     ObjectPtr &operator=(JSObject *obj) {
         IncrementalObjectBarrier(value);
         value = obj;
         return *this;
     }
 
+    void trace(JSTracer *trc, const char *name) {
+        JS_CallObjectTracer(trc, &value, name);
+    }
+
     JSObject &operator*() const { return *value; }
     JSObject *operator->() const { return value; }
     operator JSObject *() const { return value; }
 };
 
 /*
  * Unsets the gray bit for anything reachable from |thing|. |kind| should not be
  * JSTRACE_SHAPE. |thing| should be non-null.
--- a/js/src/Makefile.in
+++ b/js/src/Makefile.in
@@ -113,17 +113,16 @@ CPPSRCS		= \
 		Stack.cpp \
 		String.cpp \
 		BytecodeCompiler.cpp \
 		BytecodeEmitter.cpp \
 		CharacterEncoding.cpp \
 		FoldConstants.cpp \
 		Intl.cpp \
 		NameFunctions.cpp \
-		ParallelDo.cpp \
 		ParallelArray.cpp \
 		ParseMaps.cpp \
 		ParseNode.cpp \
 		Parser.cpp \
 		SPSProfiler.cpp \
 		SelfHosting.cpp \
 		TokenStream.cpp \
 		TestingFunctions.cpp \
@@ -701,20 +700,23 @@ endif
 
 ifneq ($(findstring -L,$(NSPR_LIBS)),)
 NSPR_STATIC_PATH = $(subst -L,,$(findstring -L,$(NSPR_LIBS)))
 else
 NSPR_STATIC_PATH = $(DIST)/lib
 endif
 
 ifdef MOZ_VTUNE
-#CXXFLAGS += -IC:/Program\ Files/Intel/VTune/Analyzer/Include
-#EXTRA_DSO_LDOPTS += C:/Program\ Files/Intel/VTune/Analyzer/Lib/VtuneApi.lib
-#LIBS +=  C:/Program\ Files/Intel/VTune/Analyzer/Lib/VtuneApi.lib
-endif
+ifeq ($(OS_ARCH), WINNT)
+EXTRA_DSO_LDOPTS += $(VTUNE_LIBRARIES)
+LIBS += $(VTUNE_LIBRARIES)
+else
+SHARED_LIBRARY_LIBS += $(VTUNE_LIBRARIES)
+endif # WINNT
+endif # MOZ_VTUNE
 
 ifdef MOZ_ETW
 # This will get the ETW provider resources into the library mozjs.dll
 RESFILE = ETWProvider.res
 endif
 
 # HP-UX does not require the extra linking of "-lm"
 ifeq (,$(filter HP-UX WINNT OS2,$(OS_ARCH)))
--- a/js/src/builtin/ParallelArray.js
+++ b/js/src/builtin/ParallelArray.js
@@ -290,19 +290,19 @@ function ParallelArrayBuild(self, shape,
     if (ShouldForceSequential())
       break parallel;
     if (!TRY_PARALLEL(mode))
       break parallel;
     if (computefunc === fillN)
       break parallel;
 
     var chunks = ComputeNumChunks(length);
-    var numSlices = ParallelSlices();
+    var numSlices = ForkJoinSlices();
     var info = ComputeAllSliceBounds(chunks, numSlices);
-    ParallelDo(constructSlice, CheckParallel(mode));
+    ForkJoin(constructSlice, CheckParallel(mode));
     return;
   }
 
   // Sequential fallback:
   ASSERT_SEQUENTIAL_IS_OK(mode);
   computefunc(0, length);
   return;
 
@@ -380,19 +380,19 @@ function ParallelArrayMap(func, mode) {
 
   parallel: for (;;) { // see ParallelArrayBuild() to explain why for(;;) etc
     if (ShouldForceSequential())
       break parallel;
     if (!TRY_PARALLEL(mode))
       break parallel;
 
     var chunks = ComputeNumChunks(length);
-    var numSlices = ParallelSlices();
+    var numSlices = ForkJoinSlices();
     var info = ComputeAllSliceBounds(chunks, numSlices);
-    ParallelDo(mapSlice, CheckParallel(mode));
+    ForkJoin(mapSlice, CheckParallel(mode));
     return NewParallelArray(ParallelArrayView, [length], buffer, 0);
   }
 
   // Sequential fallback:
   ASSERT_SEQUENTIAL_IS_OK(mode);
   for (var i = 0; i < length; i++) {
     // Note: Unlike JS arrays, parallel arrays cannot have holes.
     var v = func(self.get(i), i, self);
@@ -435,23 +435,23 @@ function ParallelArrayReduce(func, mode)
 
   parallel: for (;;) { // see ParallelArrayBuild() to explain why for(;;) etc
     if (ShouldForceSequential())
       break parallel;
     if (!TRY_PARALLEL(mode))
       break parallel;
 
     var chunks = ComputeNumChunks(length);
-    var numSlices = ParallelSlices();
+    var numSlices = ForkJoinSlices();
     if (chunks < numSlices)
       break parallel;
 
     var info = ComputeAllSliceBounds(chunks, numSlices);
     var subreductions = NewDenseArray(numSlices);
-    ParallelDo(reduceSlice, CheckParallel(mode));
+    ForkJoin(reduceSlice, CheckParallel(mode));
     var accumulator = subreductions[0];
     for (var i = 1; i < numSlices; i++)
       accumulator = func(accumulator, subreductions[i]);
     return accumulator;
   }
 
   // Sequential fallback:
   ASSERT_SEQUENTIAL_IS_OK(mode);
@@ -522,23 +522,23 @@ function ParallelArrayScan(func, mode) {
 
   parallel: for (;;) { // see ParallelArrayBuild() to explain why for(;;) etc
     if (ShouldForceSequential())
       break parallel;
     if (!TRY_PARALLEL(mode))
       break parallel;
 
     var chunks = ComputeNumChunks(length);
-    var numSlices = ParallelSlices();
+    var numSlices = ForkJoinSlices();
     if (chunks < numSlices)
       break parallel;
     var info = ComputeAllSliceBounds(chunks, numSlices);
 
     // Scan slices individually (see comment on phase1()).
-    ParallelDo(phase1, CheckParallel(mode));
+    ForkJoin(phase1, CheckParallel(mode));
 
     // Compute intermediates array (see comment on phase2()).
     var intermediates = [];
     var accumulator = buffer[finalElement(0)];
     ARRAY_PUSH(intermediates, accumulator);
     for (var i = 1; i < numSlices - 1; i++) {
       accumulator = func(accumulator, buffer[finalElement(i)]);
       ARRAY_PUSH(intermediates, accumulator);
@@ -548,17 +548,17 @@ function ParallelArrayScan(func, mode) {
     // convert from chunks to indices (see comment on phase2()).
     for (var i = 0; i < numSlices; i++) {
       info[SLICE_POS(i)] = info[SLICE_START(i)] << CHUNK_SHIFT;
       info[SLICE_END(i)] = info[SLICE_END(i)] << CHUNK_SHIFT;
     }
     info[SLICE_END(numSlices - 1)] = std_Math_min(info[SLICE_END(numSlices - 1)], length);
 
     // Complete each slice using intermediates array (see comment on phase2()).
-    ParallelDo(phase2, CheckParallel(mode));
+    ForkJoin(phase2, CheckParallel(mode));
     return NewParallelArray(ParallelArrayView, [length], buffer, 0);
   }
 
   // Sequential fallback:
   ASSERT_SEQUENTIAL_IS_OK(mode);
   scan(self.get(0), 0, length);
   return NewParallelArray(ParallelArrayView, [length], buffer, 0);
 
@@ -799,30 +799,30 @@ function ParallelArrayScatter(targets, d
       ThrowError(JSMSG_PAR_ARRAY_SCATTER_CONFLICT);
 
     return conflictFunc(elem1, elem2);
   }
 
 
   function parDivideOutputRange() {
     var chunks = ComputeNumChunks(targetsLength);
-    var numSlices = ParallelSlices();
+    var numSlices = ForkJoinSlices();
     var checkpoints = NewDenseArray(numSlices);
     for (var i = 0; i < numSlices; i++)
       UnsafeSetElement(checkpoints, i, 0);
 
     var buffer = NewDenseArray(length);
     var conflicts = NewDenseArray(length);
 
     for (var i = 0; i < length; i++) {
       UnsafeSetElement(buffer, i, defaultValue);
       UnsafeSetElement(conflicts, i, false);
     }
 
-    ParallelDo(fill, CheckParallel(mode));
+    ForkJoin(fill, CheckParallel(mode));
     return NewParallelArray(ParallelArrayView, [length], buffer, 0);
 
     function fill(sliceId, numSlices, warmup) {
       var indexPos = checkpoints[sliceId];
       var indexEnd = targetsLength;
       if (warmup)
         indexEnd = std_Math_min(indexEnd, indexPos + CHUNK_SIZE);
 
@@ -844,17 +844,17 @@ function ParallelArrayScatter(targets, d
   }
 
   function parDivideScatterVector() {
     // Subtle: because we will be mutating the localBuffers and
     // conflict arrays in place, we can never replay an entry in the
     // target array for fear of inducing a conflict where none existed
     // before. Therefore, we must proceed not by chunks but rather by
     // individual indices.
-    var numSlices = ParallelSlices();
+    var numSlices = ForkJoinSlices();
     var info = ComputeAllSliceBounds(targetsLength, numSlices);
 
     // FIXME(bug 844890): Use typed arrays here.
     var localBuffers = NewDenseArray(numSlices);
     for (var i = 0; i < numSlices; i++)
       UnsafeSetElement(localBuffers, i, NewDenseArray(length));
     var localConflicts = NewDenseArray(numSlices);
     for (var i = 0; i < numSlices; i++) {
@@ -867,17 +867,17 @@ function ParallelArrayScatter(targets, d
     // Initialize the 0th buffer, which will become the output. For
     // the other buffers, we track which parts have been written to
     // using the conflict buffer so they do not need to be
     // initialized.
     var outputBuffer = localBuffers[0];
     for (var i = 0; i < length; i++)
       UnsafeSetElement(outputBuffer, i, defaultValue);
 
-    ParallelDo(fill, CheckParallel(mode));
+    ForkJoin(fill, CheckParallel(mode));
     mergeBuffers();
     return NewParallelArray(ParallelArrayView, [length], outputBuffer, 0);
 
     function fill(sliceId, numSlices, warmup) {
       var indexPos = info[SLICE_POS(sliceId)];
       var indexEnd = info[SLICE_END(sliceId)];
       if (warmup)
         indexEnd = std_Math_min(indexEnd, indexPos + CHUNK_SIZE);
@@ -967,17 +967,17 @@ function ParallelArrayFilter(func, mode)
 
   parallel: for (;;) { // see ParallelArrayBuild() to explain why for(;;) etc
     if (ShouldForceSequential())
       break parallel;
     if (!TRY_PARALLEL(mode))
       break parallel;
 
     var chunks = ComputeNumChunks(length);
-    var numSlices = ParallelSlices();
+    var numSlices = ForkJoinSlices();
     if (chunks < numSlices * 2)
       break parallel;
 
     var info = ComputeAllSliceBounds(chunks, numSlices);
 
     // Step 1. Compute which items from each slice of the result
     // buffer should be preserved. When we're done, we have an array
     // |survivors| containing a bitset for each chunk, indicating
@@ -985,25 +985,25 @@ function ParallelArrayFilter(func, mode)
     // |counts| containing the total number of items that are being
     // preserved from within one slice.
     //
     // FIXME(bug 844890): Use typed arrays here.
     var counts = NewDenseArray(numSlices);
     for (var i = 0; i < numSlices; i++)
       UnsafeSetElement(counts, i, 0);
     var survivors = NewDenseArray(chunks);
-    ParallelDo(findSurvivorsInSlice, CheckParallel(mode));
+    ForkJoin(findSurvivorsInSlice, CheckParallel(mode));
 
     // Step 2. Compress the slices into one contiguous set.
     var count = 0;
     for (var i = 0; i < numSlices; i++)
       count += counts[i];
     var buffer = NewDenseArray(count);
     if (count > 0)
-      ParallelDo(copySurvivorsInSlice, CheckParallel(mode));
+      ForkJoin(copySurvivorsInSlice, CheckParallel(mode));
 
     return NewParallelArray(ParallelArrayView, [count], buffer, 0);
   }
 
   // Sequential fallback:
   ASSERT_SEQUENTIAL_IS_OK(mode);
   var buffer = [];
   for (var i = 0; i < length; i++) {
@@ -1248,17 +1248,17 @@ function ParallelArrayToString() {
  */
 function AssertSequentialIsOK(mode) {
   if (mode && mode.mode && mode.mode !== "seq" && ParallelTestsShouldPass())
     ThrowError(JSMSG_WRONG_VALUE, "parallel execution", "sequential was forced");
 }
 
 /**
  * Internal debugging tool: returns a function to be supplied to
- * ParallelDo() that will check that the parallel results
+ * ForkJoin() that will check that the parallel results
  * bailout/succeed as expected. Returns null if no mode is supplied
  * or we are building with some strange IF_DEF configuration such that
  * we don't expect parallel execution to work.
  */
 function CheckParallel(mode) {
   if (!mode || !ParallelTestsShouldPass())
     return null;
 
--- a/js/src/builtin/TestingFunctions.cpp
+++ b/js/src/builtin/TestingFunctions.cpp
@@ -710,17 +710,17 @@ CountHeap(JSContext *cx, unsigned argc, 
     }
     countTracer.ok = true;
     countTracer.traceList = NULL;
     countTracer.recycleList = NULL;
 
     if (startValue.isUndefined()) {
         JS_TraceRuntime(&countTracer.base);
     } else {
-        JS_CallValueTracer(&countTracer.base, startValue, "root");
+        JS_CallValueTracer(&countTracer.base, startValue.address(), "root");
     }
 
     counter = 0;
     while ((node = countTracer.traceList) != NULL) {
         if (traceKind == -1 || node->kind == traceKind)
             counter++;
         countTracer.traceList = node->next;
         node->next = countTracer.recycleList;
--- a/js/src/configure.in
+++ b/js/src/configure.in
@@ -1519,19 +1519,16 @@ case "$target" in
     fi
     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
     ;;
 
 *-darwin*)
     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
     MOZ_OPTIMIZE_FLAGS="-O3 -fno-stack-protector"
-    if test -n "$CLANG_CXX"; then
-      MOZ_OPTIMIZE_FLAGS="$MOZ_OPTIMIZE_FLAGS -fno-vectorize"
-    fi
     CFLAGS="$CFLAGS -fno-common"
     CXXFLAGS="$CXXFLAGS -fno-common"
     DLL_SUFFIX=".dylib"
     DSO_LDOPTS=''
     STRIP="$STRIP -x -S"
     _PLATFORM_DEFAULT_TOOLKIT='cairo-cocoa'
     TARGET_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
     LDFLAGS="$LDFLAGS -lobjc"
@@ -1615,19 +1612,16 @@ ia64*-hpux*)
 *-android*|*-linuxandroid*)
     AC_DEFINE(NO_PW_GECOS)
     no_x=yes
     _PLATFORM_DEFAULT_TOOLKIT=cairo-android
     TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
 
     MOZ_GFX_OPTIMIZE_MOBILE=1
     MOZ_OPTIMIZE_FLAGS="-O3 -freorder-blocks -fno-reorder-functions"
-    if test -n "$CLANG_CXX"; then
-      MOZ_OPTIMIZE_FLAGS="$MOZ_OPTIMIZE_FLAGS -fno-vectorize"
-    fi
     # The Maemo builders don't know about this flag
     MOZ_ARM_VFP_FLAGS="-mfpu=vfp"
     ;;
 
 *-*linux*)
     # Note: both GNU_CC and INTEL_CC are set when using Intel's C compiler.
     # Similarly for GNU_CXX and INTEL_CXX.
     if test "$INTEL_CC" -o "$INTEL_CXX"; then
@@ -1640,19 +1634,16 @@ ia64*-hpux*)
         4.5.*)
             # -Os is broken on gcc 4.5.x we need to tweak it to get good results.
             MOZ_OPTIMIZE_SIZE_TWEAK="-finline-limit=50"
         esac
         MOZ_PGO_OPTIMIZE_FLAGS="-O3"
         MOZ_OPTIMIZE_FLAGS="-O3 -freorder-blocks $MOZ_OPTIMIZE_SIZE_TWEAK"
         MOZ_DEBUG_FLAGS="-g"
     fi
-    if test -n "$CLANG_CXX"; then
-      MOZ_OPTIMIZE_FLAGS="$MOZ_OPTIMIZE_FLAGS -fno-vectorize"
-    fi
 
     TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
 
     case "${target_cpu}" in
     alpha*)
     	CFLAGS="$CFLAGS -mieee"
     	CXXFLAGS="$CXXFLAGS -mieee"
     ;;
@@ -3703,16 +3694,35 @@ fi
 dnl ========================================================
 dnl vtune
 dnl ========================================================
 MOZ_ARG_ENABLE_BOOL(vtune,
 [  --enable-vtune          Enable vtune profiling. Implies --enable-profiling.],
     MOZ_VTUNE=1,
     MOZ_VTUNE= )
 if test -n "$MOZ_VTUNE"; then
+    if test -z "$VTUNE_AMPLIFIER_XE_2013_DIR"; then
+        echo "Error: VTUNE_AMPLIFIER_XE_2013_DIR undefined."
+        exit 1
+    fi
+
+    VTUNE_DIR=`echo "$VTUNE_AMPLIFIER_XE_2013_DIR" | sed 's,\\\,/,g'`
+    VTUNE_DIR=`echo "$VTUNE_DIR" | sed 's,(,\\\(,g'`
+    VTUNE_DIR=`echo "$VTUNE_DIR" | sed 's,),\\\),g'`
+    VTUNE_DIR=`echo "$VTUNE_DIR" | sed 's, ,\\\ ,g'`
+
+    VTUNE_LIB=lib32
+    if test "x86_64" = "$TARGET_CPU"; then
+        VTUNE_LIB=lib64
+    fi
+
+    VTUNE_LIBRARIES="${VTUNE_DIR}/${VTUNE_LIB}/${LIB_PREFIX}jitprofiling.${LIB_SUFFIX}"
+    AC_SUBST(VTUNE_LIBRARIES)
+
+    CXXFLAGS="$CXXFLAGS -I${VTUNE_DIR}/include"
     MOZ_PROFILING=1
     AC_DEFINE(MOZ_VTUNE)
 fi
 
 dnl ========================================================
 dnl Profiling
 dnl ========================================================
 if test -n "$MOZ_PROFILING"; then
--- a/js/src/ctypes/CTypes.cpp
+++ b/js/src/ctypes/CTypes.cpp
@@ -3321,36 +3321,38 @@ CType::Trace(JSTracer* trc, JSObject* ob
   case TYPE_struct: {
     slot = obj->getReservedSlot(SLOT_FIELDINFO);
     if (JSVAL_IS_VOID(slot))
       return;
 
     FieldInfoHash* fields =
       static_cast<FieldInfoHash*>(JSVAL_TO_PRIVATE(slot));
     for (FieldInfoHash::Range r = fields->all(); !r.empty(); r.popFront()) {
-      JS_CallStringTracer(trc, r.front().key, "fieldName");
-      JS_CallObjectTracer(trc, r.front().value.mType, "fieldType");
+      JSString *key = r.front().key;
+      JS_CallStringTracer(trc, &key, "fieldName");
+      JS_ASSERT(key == r.front().key);
+      JS_CallObjectTracer(trc, &r.front().value.mType, "fieldType");
     }
 
     break;
   }
   case TYPE_function: {
     // Check if we have a FunctionInfo.
     slot = obj->getReservedSlot(SLOT_FNINFO);
     if (JSVAL_IS_VOID(slot))
       return;
 
     FunctionInfo* fninfo = static_cast<FunctionInfo*>(JSVAL_TO_PRIVATE(slot));
     JS_ASSERT(fninfo);