Bug 999260 - Ship both d3dcompiler_43 and _46+. - r=mshal
authorJeff Gilbert <jgilbert@mozilla.com>
Fri, 02 May 2014 15:31:05 -0700
changeset 181814 8b48386fc22687fb97c787c8bb4e435f5a2a9fe9
parent 181813 f1f88dcc871db9b3ca1ffc887607a616a7c17d90
child 181815 728803659bcbdbb59611ba6c8a4f03e938c12977
push id272
push userpvanderbeken@mozilla.com
push dateMon, 05 May 2014 16:31:18 +0000
reviewersmshal
bugs999260
milestone32.0a1
Bug 999260 - Ship both d3dcompiler_43 and _46+. - r=mshal
browser/config/mozconfigs/win32/common-opt
browser/config/mozconfigs/win32/debug
browser/installer/Makefile.in
browser/installer/package-manifest.in
configure.in
gfx/angle/Makefile.in
gfx/angle/src/libEGL/Makefile.in
gfx/angle/src/libGLESv2/Makefile.in
gfx/gl/GLLibraryEGL.cpp
gfx/gl/moz.build
toolkit/library/libxul.mk
--- a/browser/config/mozconfigs/win32/common-opt
+++ b/browser/config/mozconfigs/win32/common-opt
@@ -1,15 +1,17 @@
 # This file is sourced by the nightly, beta, and release mozconfigs.
 
 . "$topsrcdir/browser/config/mozconfigs/common"
 
 ac_add_options --enable-update-channel=${MOZ_UPDATE_CHANNEL}
 ac_add_options --enable-update-packaging
 ac_add_options --enable-jemalloc
+ac_add_options --enable-require-all-d3dc-versions
+
 if [ -f /c/builds/gapi.data ]; then
   _gapi_keyfile=/c/builds/gapi.data
 else
   _gapi_keyfile=/e/builds/gapi.data
 fi
 ac_add_options --with-google-api-keyfile=${_gapi_keyfile}
 
 
--- a/browser/config/mozconfigs/win32/debug
+++ b/browser/config/mozconfigs/win32/debug
@@ -1,13 +1,14 @@
 . "$topsrcdir/browser/config/mozconfigs/common"
 
 ac_add_options --enable-debug
 ac_add_options --enable-trace-malloc
 ac_add_options --enable-signmar
+ac_add_options --enable-require-all-d3dc-versions
 
 # Needed to enable breakpad in application.ini
 export MOZILLA_OFFICIAL=1
 
 if test "$PROCESSOR_ARCHITECTURE" = "AMD64" -o "$PROCESSOR_ARCHITEW6432" = "AMD64"; then
   . $topsrcdir/build/win32/mozconfig.vs2010-win64
 else
   . $topsrcdir/build/win32/mozconfig.vs2010
--- a/browser/installer/Makefile.in
+++ b/browser/installer/Makefile.in
@@ -48,17 +48,18 @@ endif
 ifdef _MSC_VER
 DEFINES += -D_MSC_VER=$(_MSC_VER)
 endif
 
 DEFINES += -DJAREXT=
 
 ifdef MOZ_ANGLE_RENDERER
 DEFINES += -DMOZ_ANGLE_RENDERER=$(MOZ_ANGLE_RENDERER)
-DEFINES += -DMOZ_D3DCOMPILER_DLL=$(MOZ_D3DCOMPILER_DLL)
+DEFINES += -DMOZ_D3DCOMPILER_VISTA_DLL=$(MOZ_D3DCOMPILER_VISTA_DLL)
+DEFINES += -DMOZ_D3DCOMPILER_XP_DLL=$(MOZ_D3DCOMPILER_XP_DLL)
 endif
 
 DEFINES += -DMOZ_CHILD_PROCESS_NAME=$(MOZ_CHILD_PROCESS_NAME)
 
 # Set MSVC dlls version to package, if any.
 ifdef WIN32_REDIST_DIR
 DEFINES += -DMOZ_MSVC_REDIST=$(_MSC_VER)
 endif
--- a/browser/installer/package-manifest.in
+++ b/browser/installer/package-manifest.in
@@ -591,19 +591,26 @@
 @BINPATH@/components/nsUrlClassifierLib.js
 @BINPATH@/components/url-classifier.xpt
 #endif
 
 ; ANGLE GLES-on-D3D rendering library
 #ifdef MOZ_ANGLE_RENDERER
 @BINPATH@/libEGL.dll
 @BINPATH@/libGLESv2.dll
-@BINPATH@/@MOZ_D3DCOMPILER_DLL@
+
+#ifdef MOZ_D3DCOMPILER_VISTA_DLL
+@BINPATH@/@MOZ_D3DCOMPILER_VISTA_DLL@
 #endif
 
+#ifdef MOZ_D3DCOMPILER_XP_DLL
+@BINPATH@/@MOZ_D3DCOMPILER_XP_DLL@
+#endif
+#endif # MOZ_ANGLE_RENDERER
+
 ; [Browser Chrome Files]
 @BINPATH@/browser/chrome.manifest
 @BINPATH@/browser/chrome/browser@JAREXT@
 @BINPATH@/browser/chrome/browser.manifest
 @BINPATH@/browser/chrome/pdfjs.manifest
 @BINPATH@/browser/chrome/pdfjs/*
 #ifdef NIGHTLY_BUILD
 @BINPATH@/browser/chrome/shumway.manifest
--- a/configure.in
+++ b/configure.in
@@ -5700,163 +5700,187 @@ if test -n "${JAVA_BIN_PATH}" -o \
   fi
 fi
 
 dnl ========================================================
 dnl = ANGLE OpenGL->D3D translator for WebGL
 dnl = * only applies to win32
 dnl = * enabled by default (shipping build); requires explicit --disable to disable
 dnl ========================================================
+
 MOZ_ANGLE_RENDERER=
-MOZ_DIRECTX_SDK_CPU_SUFFIX=
+MOZ_D3D_CPU_SUFFIX=
+MOZ_HAS_WINSDK_WITH_D3D=
+MOZ_D3DCOMPILER_VISTA_DLL=
+MOZ_D3DCOMPILER_VISTA_DLL_PATH=
 MOZ_DIRECTX_SDK_PATH=
-MOZ_D3DCOMPILER_DLL=
-MOZ_HAS_WINSDK_WITH_D3D=
-MOZ_D3DCOMPILER_DLL_PATH=
-MOZ_D3DCOMPILER_CAB=
+MOZ_D3DCOMPILER_XP_DLL=
+MOZ_D3DCOMPILER_XP_CAB=
+
 case "$target_os" in
 *mingw*)
     MOZ_ANGLE_RENDERER=1
     ;;
 esac
 
 # The DirectX SDK libraries are split into x86 and x64 sub-directories
 case "${target_cpu}" in
 i*86)
-  MOZ_DIRECTX_SDK_CPU_SUFFIX=x86
+  MOZ_D3D_CPU_SUFFIX=x86
   ;;
 x86_64)
-  MOZ_DIRECTX_SDK_CPU_SUFFIX=x64
+  MOZ_D3D_CPU_SUFFIX=x64
   ;;
 esac
 
 MOZ_ARG_DISABLE_BOOL(webgl,
 [  --disable-webgl     Disable building of the WebGL implementation],
     MOZ_WEBGL_DISABLED=1,
     MOZ_WEBGL_DISABLED=)
 
-MOZ_ARG_ENABLE_BOOL(winsdk-directx,
-[  --enable-winsdk-directx use DirectX SDK in Windows SDK],
-    MOZ_WINSDK_DIRECTX=1,
-    MOZ_WINSDK_DIRECTX=)
+MOZ_ARG_ENABLE_BOOL(require-all-d3dc-versions,
+[  --enable-require-all-d3dc-versions Require all versions of the D3D compiler needed for supported Windows systems.],
+    MOZ_REQUIRE_ALL_D3DCS=1,
+    MOZ_REQUIRE_ALL_D3DCS=)
 
 if test -n "$MOZ_WEBGL_DISABLED"; then
   MOZ_WEBGL=
   MOZ_ANGLE_RENDERER=
 fi
 
 if test -n "$MOZ_WEBGL"; then
   AC_DEFINE(MOZ_WEBGL)
 fi
 
 if test -n "$MOZ_WEBGL_CONFORMANT"; then
   AC_DEFINE(MOZ_WEBGL_CONFORMANT)
 fi
 
-
-# Locate a DirectX SDK here so we can use it for both ANGLE and
-# Joystick support.
-if test "$OS_TARGET" = "WINNT" -a -z "$CROSS_COMPILE"; then
+dnl ========================================================
+dnl D3D compiler DLL
+dnl ========================================================
+MOZ_FOUND_D3D_COMPILERS=
+
+if test -n "$MOZ_ANGLE_RENDERER"; then
+  if test -z "$MOZ_D3D_CPU_SUFFIX"; then
+    AC_MSG_ERROR([Couldn't determine MOZ_D3D_CPU_SUFFIX.])
+  fi
+
+  ######################################
+  # Find _46+ for use by Vista+.
+
+  # Find a D3D compiler DLL in a Windows SDK.
+  MOZ_D3DCOMPILER_VISTA_DLL=
+  case "$MOZ_WINSDK_MAXVER" in
+  0x0603*)
+    MOZ_D3DCOMPILER_VISTA_DLL=d3dcompiler_47.dll
+    AC_MSG_RESULT([Found D3D compiler in Windows SDK 8.1.])
+  ;;
+  0x0602*)
+    MOZ_D3DCOMPILER_VISTA_DLL=d3dcompiler_46.dll
+    AC_MSG_RESULT([Found D3D compiler in Windows SDK 8.0.])
+  ;;
+  esac
+
+  if test -n "$MOZ_D3DCOMPILER_VISTA_DLL"; then
+    # We have a name, now track down the path.
+    if test -n "$WINDOWSSDKDIR"; then
+      MOZ_D3DCOMPILER_VISTA_DLL_PATH="$WINDOWSSDKDIR/Redist/D3D/$MOZ_D3D_CPU_SUFFIX/$MOZ_D3DCOMPILER_VISTA_DLL"
+      if test -f "$MOZ_D3DCOMPILER_VISTA_DLL_PATH"; then
+        MOZ_HAS_WINSDK_WITH_D3D=1
+        AC_MSG_RESULT([Found MOZ_D3DCOMPILER_VISTA_DLL_PATH: $MOZ_D3DCOMPILER_VISTA_DLL_PATH])
+      else
+        AC_MSG_RESULT([MOZ_D3DCOMPILER_VISTA_DLL_PATH doesn't exist: $MOZ_D3DCOMPILER_VISTA_DLL_PATH])
+      fi
+    else
+      AC_MSG_RESULT([WINDOWSSDKDIR is missing.])
+    fi
+  fi
+
+  ######################################
+  # Find _43 for use by XP.
+
   # Get the SDK path from the registry.
   # First try to get the June 2010 SDK
   MOZ_DIRECTX_SDK_REG_KEY=`reg query 'HKLM\Software\Microsoft\DirectX' //s | grep 'Microsoft DirectX SDK (June 2010)' | head -n 1`
   if test -z "$MOZ_DIRECTX_SDK_REG_KEY" ; then
     # Otherwise just take whatever comes first
     MOZ_DIRECTX_SDK_REG_KEY=`reg query 'HKLM\Software\Microsoft\DirectX' //s | grep 'Microsoft DirectX SDK' | head -n 1`
   fi
   MOZ_DIRECTX_SDK_PATH=`reg query "$MOZ_DIRECTX_SDK_REG_KEY" //v InstallPath | grep REG_SZ | sed 's/.*\([[a-zA-Z]]\)\\:\\\\/\\1\\:\\\\/' | sed 's,\\\\,/,g'`
 
   if test -n "$MOZ_DIRECTX_SDK_PATH" &&
-     test -f "$MOZ_DIRECTX_SDK_PATH"/lib/$MOZ_DIRECTX_SDK_CPU_SUFFIX/dxguid.lib ; then
+     test -f "$MOZ_DIRECTX_SDK_PATH"/lib/$MOZ_D3D_CPU_SUFFIX/dxguid.lib ; then
     AC_MSG_RESULT([Found DirectX SDK via registry, using $MOZ_DIRECTX_SDK_PATH])
   else
     AC_MSG_RESULT([Couldn't find the DirectX SDK.])
+    MOZ_DIRECTX_SDK_PATH=
   fi
-fi
-
-# On mingw, check if headers are provided by toolchain.
-if test "$OS_TARGET" = "WINNT" -a -n "$GNU_CC"; then
-  MOZ_CHECK_HEADER(d3d10.h, MOZ_HAS_WINSDK_WITH_D3D=1)
-fi
-
-dnl ========================================================
-dnl D3D compiler DLL
-dnl ========================================================
-
-if test -n "$MOZ_ANGLE_RENDERER"; then
+
   # Check that our DirectX SDK is acceptable.
   if test -n "$MOZ_DIRECTX_SDK_PATH"; then
     if test -n "`echo $MOZ_DIRECTX_SDK_REG_KEY | grep 'February 2010'`" ; then
       AC_MSG_RESULT([Found the February 2010 DirectX SDK, which is unacceptable to ANGLE.])
-      MOZ_DIRECTX_SDK_PATH_BAD=1
-    fi
-
-    if test -n "$MOZ_DIRECTX_SDK_PATH" &&
-       test -f "$MOZ_DIRECTX_SDK_PATH"/include/d3dx9.h &&
-       test -f "$MOZ_DIRECTX_SDK_PATH"/lib/$MOZ_DIRECTX_SDK_CPU_SUFFIX/dxguid.lib ; then
-      AC_MSG_RESULT([Found acceptable DirectX SDK for ANGLE.])
-    else
-      AC_MSG_RESULT([Found DirectX SDK is unacceptable for ANGLE.])
-      MOZ_DIRECTX_SDK_PATH_BAD=1
+      MOZ_DIRECTX_SDK_PATH=
     fi
   fi
 
-  if test -n "$MOZ_DIRECTX_SDK_PATH_BAD"; then
-    AC_MSG_ERROR([Couldn't find an acceptable DirectX SDK for ANGLE. Either install DirectX SDK (June 2010 version or newer), or reconfigure with --disable-webgl.])
-  fi
-
-  # Find a D3D compiler DLL in a Windows SDK.
-  MOZ_D3DCOMPILER_DLL=
-  if test -n "$MOZ_WINSDK_DIRECTX"; then
-    case "$MOZ_WINSDK_MAXVER" in
-    0x0603*)
-      MOZ_D3DCOMPILER_DLL=d3dcompiler_47.dll
-      AC_MSG_RESULT([Found D3D compiler in Windows SDK 8.1.])
-    ;;
-    0x0602*)
-      MOZ_D3DCOMPILER_DLL=d3dcompiler_46.dll
-      AC_MSG_RESULT([Found D3D compiler in Windows SDK 8.0.])
-    ;;
-    esac
-  fi
-
-  if test -n "$MOZ_D3DCOMPILER_DLL"; then
-    # We have a name, now track down the path.
-    if test -n "$WINDOWSSDKDIR"; then
-      MOZ_D3DCOMPILER_DLL_PATH="$WINDOWSSDKDIR/Redist/D3D/$MOZ_DIRECTX_SDK_CPU_SUFFIX/$MOZ_D3DCOMPILER_DLL"
-      if test -f "$MOZ_D3DCOMPILER_DLL_PATH"; then
-        MOZ_HAS_WINSDK_WITH_D3D=1
-        AC_MSG_RESULT([Found MOZ_D3DCOMPILER_DLL_PATH: $MOZ_D3DCOMPILER_DLL_PATH])
-      else
-        AC_MSG_RESULT([MOZ_D3DCOMPILER_DLL_PATH doesn't exist: $MOZ_D3DCOMPILER_DLL_PATH])
-      fi
-    else
-      AC_MSG_RESULT([WINDOWSSDKDIR is missing.])
-    fi
-  fi
-
-  # Find a D3D compiler DLL in the DirectX SDK, if we didn't find one already.
-  # Get the SDK numeric version (e.g. 43) by looking at the dependencies of d3dx9.lib
-  if test -z "$MOZ_HAS_WINSDK_WITH_D3D"; then
-    MOZ_D3DX9_VERSION=`dumpbin //headers "$MOZ_DIRECTX_SDK_PATH"/lib/$MOZ_DIRECTX_SDK_CPU_SUFFIX/d3dx9.lib | egrep d3dx9_[[0-9]][[0-9]]\.dll | head -n1 | sed 's/.*\([[0-9]][[0-9]]\).*/\\1/g'`
+  if test -n "$MOZ_DIRECTX_SDK_PATH"; then
+    # Find a D3D compiler DLL in the DirectX SDK, if we didn't find one already.
+    # Get the SDK numeric version (e.g. 43) by looking at the dependencies of d3dx9.lib
+    MOZ_D3DX9_VERSION=`dumpbin //headers "$MOZ_DIRECTX_SDK_PATH"/lib/$MOZ_D3D_CPU_SUFFIX/d3dx9.lib | egrep d3dx9_[[0-9]][[0-9]]\.dll | head -n1 | sed 's/.*\([[0-9]][[0-9]]\).*/\\1/g'`
 
     if test -n "$MOZ_D3DX9_VERSION" ; then
-      MOZ_D3DCOMPILER_CAB=`find "$MOZ_DIRECTX_SDK_PATH"/Redist -name *D3DCompiler_${MOZ_D3DX9_VERSION}_${MOZ_DIRECTX_SDK_CPU_SUFFIX}.cab | head -n1`
-      MOZ_D3DCOMPILER_DLL=D3DCompiler_$MOZ_D3DX9_VERSION.dll
+      MOZ_D3DCOMPILER_XP_CAB=`find "$MOZ_DIRECTX_SDK_PATH"/Redist -name *D3DCompiler_${MOZ_D3DX9_VERSION}_${MOZ_D3D_CPU_SUFFIX}.cab | head -n1`
+      MOZ_D3DCOMPILER_XP_DLL=D3DCompiler_$MOZ_D3DX9_VERSION.dll
     else
       AC_MSG_RESULT([Couldn't determine the D3DX9 version for the DirectX SDK.])
     fi
 
-    if test -z "$MOZ_D3DCOMPILER_CAB"; then
+    if test -z "$MOZ_D3DCOMPILER_XP_CAB"; then
       AC_MSG_RESULT([Couldn't find a CAB containing the D3D compiler DLL.])
-    fi
+      MOZ_DIRECTX_SDK_PATH=
+      MOZ_D3DCOMPILER_XP_DLL=
+    fi
+  else
+    AC_MSG_RESULT([Couldn't find an acceptable DirectX SDK for ANGLE, needed for d3dcompiler_43.])
+    AC_MSG_RESULT([  Either ignore, install DirectX SDK (June 2010 version or newer), or reconfigure with --disable-webgl.])
+    MOZ_DIRECTX_SDK_PATH=
+    MOZ_D3DCOMPILER_XP_DLL=
   fi
 
-  if test -z "$MOZ_D3DCOMPILER_DLL_PATH" -a -z "$MOZ_D3DCOMPILER_CAB" -a -z "$CROSS_COMPILE"; then
-    AC_MSG_ERROR([Couldn't find an acceptable D3D compiler DLL. Either install Windows SDK 8.0+ and reconfigure with --enable-winsdk-directx, install DirectX SDK (June 2010 version or newer), or reconfigure with --disable-webgl.])
+  ######################################
+  # Check that we found what we needed.
+  MOZ_FOUND_A_D3D_COMPILER=
+  MOZ_FOUND_BOTH_D3D_COMPILERS=1
+
+  if test -n "$MOZ_D3DCOMPILER_VISTA_DLL"; then
+    MOZ_FOUND_A_D3D_COMPILER=1
+    AC_MSG_RESULT([Found d3dcompiler DLL for Vista+: $MOZ_D3DCOMPILER_VISTA_DLL])
+  else
+    MOZ_FOUND_BOTH_D3D_COMPILERS=
+  fi
+
+  if test -n "$MOZ_D3DCOMPILER_XP_DLL"; then
+    MOZ_FOUND_A_D3D_COMPILER=1
+    AC_MSG_RESULT([Found d3dcompiler DLL for XP: $MOZ_D3DCOMPILER_XP_DLL])
+  else
+    MOZ_FOUND_BOTH_D3D_COMPILERS=
+  fi
+
+  if test -z "$CROSS_COMPILE"; then
+    if test -z "MOZ_FOUND_A_D3D_COMPILER"; then
+      AC_MSG_ERROR([Couldn't find an acceptable D3D compiler DLL.])
+      AC_MSG_ERROR([  Either install Windows SDK 8.0+, install DirectX SDK (June 2010 version or newer), or reconfigure with --disable-webgl.])
+    fi
+
+    if test -n "$MOZ_REQUIRE_ALL_D3DCS" -a -z "$MOZ_FOUND_BOTH_D3D_COMPILERS"; then
+      AC_MSG_ERROR([Both D3D compilers _43 and _46+ are required by --enable-require-d3d-compilers.])
+      AC_MSG_ERROR([  Install Windows SDK 8.0+, as well as DirectX SDK (June 2010 version or newer), or reconfigure without this flag.])
+    fi
   fi
 fi
 
 
 dnl ========================================================
 dnl Gamepad support
 dnl ========================================================
 MOZ_GAMEPAD=
@@ -8452,22 +8476,23 @@ AC_SUBST(MOZ_CRASHREPORTER_INJECTOR)
 AC_SUBST(MOZ_CRASHREPORTER_UPLOAD_FULL_SYMBOLS)
 AC_SUBST(MOZ_MAINTENANCE_SERVICE)
 AC_SUBST(MOZ_STUB_INSTALLER)
 AC_SUBST(MOZ_VERIFY_MAR_SIGNATURE)
 AC_SUBST(MOZ_ENABLE_SIGNMAR)
 AC_SUBST(MOZ_UPDATER)
 
 AC_SUBST(MOZ_ANGLE_RENDERER)
-AC_SUBST(MOZ_DIRECTX_SDK_CPU_SUFFIX)
+AC_SUBST(MOZ_D3D_CPU_SUFFIX)
+AC_SUBST(MOZ_HAS_WINSDK_WITH_D3D)
+AC_SUBST(MOZ_D3DCOMPILER_VISTA_DLL)
+AC_SUBST(MOZ_D3DCOMPILER_VISTA_DLL_PATH)
 AC_SUBST(MOZ_DIRECTX_SDK_PATH)
-AC_SUBST(MOZ_D3DCOMPILER_DLL)
-AC_SUBST(MOZ_HAS_WINSDK_WITH_D3D)
-AC_SUBST(MOZ_D3DCOMPILER_DLL_PATH)
-AC_SUBST(MOZ_D3DCOMPILER_CAB)
+AC_SUBST(MOZ_D3DCOMPILER_XP_DLL)
+AC_SUBST(MOZ_D3DCOMPILER_XP_CAB)
 
 AC_SUBST(MOZ_METRO)
 
 AC_SUBST(MOZ_ANDROID_HISTORY)
 AC_SUBST(MOZ_WEBSMS_BACKEND)
 AC_SUBST(MOZ_ANDROID_BEAM)
 AC_SUBST(MOZ_ANDROID_SYNTHAPKS)
 AC_SUBST(MOZ_DISABLE_GECKOVIEW)
--- a/gfx/angle/Makefile.in
+++ b/gfx/angle/Makefile.in
@@ -1,21 +1,21 @@
 # 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/.
 
 ifdef MOZ_ANGLE_RENDERER
 
 libs::
-ifdef MOZ_D3DCOMPILER_DLL_PATH
-	cp -fp "$(MOZ_D3DCOMPILER_DLL_PATH)" "$(DIST)/bin"
-else
-ifdef MOZ_D3DCOMPILER_CAB
-	expand '$(MOZ_D3DCOMPILER_CAB)' -F:$(MOZ_D3DCOMPILER_DLL) '$(DIST)/bin'
+ifdef MOZ_D3DCOMPILER_VISTA_DLL_PATH
+	cp -fp "$(MOZ_D3DCOMPILER_VISTA_DLL_PATH)" "$(DIST)/bin"
 endif
+
+ifdef MOZ_D3DCOMPILER_XP_CAB
+	expand '$(MOZ_D3DCOMPILER_XP_CAB)' -F:$(MOZ_D3DCOMPILER_XP_DLL) '$(DIST)/bin'
 endif
 
 endif
 
 include $(topsrcdir)/config/rules.mk
 
 # We have to filter out -pedantic, because of
 # comma-at-end-of-enumerator list failures.  We can try to get this fixed
--- a/gfx/angle/src/libEGL/Makefile.in
+++ b/gfx/angle/src/libEGL/Makefile.in
@@ -24,14 +24,14 @@ ifdef GNU_CC
 OS_CXXFLAGS := $(filter-out -fno-exceptions,$(OS_CXXFLAGS)) -fexceptions
 OS_LIBS += -ld3d9 -llibGLESv2
 
 else
 
 ifdef MOZ_HAS_WINSDK_WITH_D3D
 EXTRA_DSO_LDOPTS = d3d9.lib "$(DIST)/lib/libGLESv2.lib" delayimp.lib
 else
-EXTRA_DSO_LDOPTS = '$(MOZ_DIRECTX_SDK_PATH)/lib/$(MOZ_DIRECTX_SDK_CPU_SUFFIX)/d3d9.lib' \
+EXTRA_DSO_LDOPTS = '$(MOZ_DIRECTX_SDK_PATH)/lib/$(MOZ_D3D_CPU_SUFFIX)/d3d9.lib' \
                    '$(DIST)/lib/libGLESv2.lib' \
                    delayimp.lib
 endif
 
 endif
--- a/gfx/angle/src/libGLESv2/Makefile.in
+++ b/gfx/angle/src/libGLESv2/Makefile.in
@@ -15,11 +15,11 @@ include $(topsrcdir)/config/rules.mk
 
 ifndef MOZ_HAS_WINSDK_WITH_D3D
 CXXFLAGS += -I'$(MOZ_DIRECTX_SDK_PATH)/include'
 endif
 
 ifdef MOZ_HAS_WINSDK_WITH_D3D
 EXTRA_DSO_LDOPTS = $(call EXPAND_LIBNAME,d3d9 dxguid)
 else
-EXTRA_DSO_LDOPTS = $(call EXPAND_LIBNAME_PATH,d3d9 dxguid,'$(MOZ_DIRECTX_SDK_PATH)/lib/$(MOZ_DIRECTX_SDK_CPU_SUFFIX)')
+EXTRA_DSO_LDOPTS = $(call EXPAND_LIBNAME_PATH,d3d9 dxguid,'$(MOZ_DIRECTX_SDK_PATH)/lib/$(MOZ_D3D_CPU_SUFFIX)')
 endif
 EXTRA_DSO_LDOPTS += $(call EXPAND_LIBNAME,delayimp)
--- a/gfx/gl/GLLibraryEGL.cpp
+++ b/gfx/gl/GLLibraryEGL.cpp
@@ -73,17 +73,17 @@ static PRLibrary* LoadApitraceLibrary()
 #endif // ANDROID
 
 #ifdef XP_WIN
 // see the comment in GLLibraryEGL::EnsureInitialized() for the rationale here.
 static PRLibrary*
 LoadLibraryForEGLOnWindows(const nsAString& filename)
 {
     nsCOMPtr<nsIFile> file;
-	nsresult rv = NS_GetSpecialDirectory(NS_GRE_DIR, getter_AddRefs(file));
+    nsresult rv = NS_GetSpecialDirectory(NS_GRE_DIR, getter_AddRefs(file));
     if (NS_FAILED(rv))
         return nullptr;
 
     file->Append(filename);
     PRLibrary* lib = nullptr;
     rv = file->Load(&lib);
     if (NS_FAILED(rv)) {
         nsPrintfCString msg("Failed to load %s - Expect EGL initialization to fail",
@@ -107,31 +107,41 @@ GLLibraryEGL::EnsureInitialized()
 #ifdef MOZ_WEBGL
     if (!mEGLLibrary) {
         // On Windows, the GLESv2, EGL and DXSDK libraries are shipped with libxul and
         // we should look for them there. We have to load the libs in this
         // order, because libEGL.dll depends on libGLESv2.dll which depends on the DXSDK
         // libraries. This matters especially for WebRT apps which are in a different directory.
         // See bug 760323 and bug 749459
 
-#ifndef MOZ_D3DCOMPILER_DLL
-#error MOZ_D3DCOMPILER_DLL should have been defined by the Makefile
+        // Also note that we intentionally leak the libs we load.
+
+        do {
+            // Windows 8.1 has d3dcompiler_47.dll in the system directory.
+            // Try it first. Note that _46 will never be in the system
+            // directory and we ship with at least _43. So there is no point
+            // trying _46 and _43 in the system directory.
+
+            if (LoadLibrarySystem32(L"d3dcompiler_47.dll"))
+                break;
+
+#ifdef MOZ_D3DCOMPILER_VISTA_DLL
+            if (LoadLibraryForEGLOnWindows(NS_LITERAL_STRING(NS_STRINGIFY(MOZ_D3DCOMPILER_VISTA_DLL))))
+                break;
 #endif
-        // Windows 8.1 has d3dcompiler_47.dll in the system directory.
-        // Try it first. Note that _46 will never be in the system
-        // directory and we ship with at least _43. So there is no point
-        // trying _46 and _43 in the system directory.
-        if (!LoadLibrarySystem32(L"d3dcompiler_47.dll")) {
-            // Fall back to the version that we shipped with.
-            LoadLibraryForEGLOnWindows(NS_LITERAL_STRING(NS_STRINGIFY(MOZ_D3DCOMPILER_DLL)));
-        }
-        // intentionally leak the D3DCOMPILER_DLL library
+
+#ifdef MOZ_D3DCOMPILER_XP_DLL
+            if (LoadLibraryForEGLOnWindows(NS_LITERAL_STRING(NS_STRINGIFY(MOZ_D3DCOMPILER_XP_DLL))))
+                break;
+#endif
+
+            MOZ_ASSERT(false, "d3dcompiler DLL loading failed.");
+        } while (false);
 
         LoadLibraryForEGLOnWindows(NS_LITERAL_STRING("libGLESv2.dll"));
-        // intentionally leak the libGLESv2.dll library
 
         mEGLLibrary = LoadLibraryForEGLOnWindows(NS_LITERAL_STRING("libEGL.dll"));
 
         if (!mEGLLibrary)
             return false;
     }
 #endif // MOZ_WEBGL
 #else // !Windows
@@ -201,17 +211,17 @@ GLLibraryEGL::EnsureInitialized()
     mEGLDisplay = fGetDisplay(EGL_DEFAULT_DISPLAY);
     if (!fInitialize(mEGLDisplay, nullptr, nullptr))
         return false;
 
     const char *vendor = (const char*) fQueryString(mEGLDisplay, LOCAL_EGL_VENDOR);
     if (vendor && (strstr(vendor, "TransGaming") != 0 || strstr(vendor, "Google Inc.") != 0)) {
         mIsANGLE = true;
     }
-    
+
     InitExtensions();
 
     GLLibraryLoader::PlatformLookupFunction lookupFunction =
             (GLLibraryLoader::PlatformLookupFunction)mSymbols.fGetProcAddress;
 
     if (IsExtensionSupported(KHR_lock_surface)) {
         GLLibraryLoader::SymLoadStruct lockSymbols[] = {
             { (PRFuncPtr*) &mSymbols.fLockSurface,   { "eglLockSurfaceKHR",   nullptr } },
--- a/gfx/gl/moz.build
+++ b/gfx/gl/moz.build
@@ -145,13 +145,15 @@ UNIFIED_SOURCES += [
 FAIL_ON_WARNINGS = True
 
 MSVC_ENABLE_PGO = True
 
 include('/ipc/chromium/chromium-config.mozbuild')
 
 FINAL_LIBRARY = 'xul'
 
-if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows' and CONFIG['MOZ_WEBGL']:
-    DEFINES['MOZ_D3DCOMPILER_DLL'] = CONFIG['MOZ_D3DCOMPILER_DLL']
+if CONFIG['MOZ_D3DCOMPILER_VISTA_DLL']:
+    DEFINES['MOZ_D3DCOMPILER_VISTA_DLL'] = CONFIG['MOZ_D3DCOMPILER_VISTA_DLL']
+if CONFIG['MOZ_D3DCOMPILER_XP_DLL']:
+    DEFINES['MOZ_D3DCOMPILER_XP_DLL'] = CONFIG['MOZ_D3DCOMPILER_XP_DLL']
 
 if CONFIG['MOZ_ANDROID_OMTC']:
     DEFINES['MOZ_ANDROID_OMTC'] = True
--- a/toolkit/library/libxul.mk
+++ b/toolkit/library/libxul.mk
@@ -94,17 +94,17 @@ EXTRA_DSO_LDOPTS += $(call EXPAND_LIBNAM
 endif
 
 EXTRA_DSO_LDOPTS += $(call EXPAND_LIBNAME_PATH,gkmedias,$(DIST)/lib)
 
 ifdef MOZ_WEBRTC
 ifeq (WINNT,$(OS_TARGET))
 ifndef MOZ_HAS_WINSDK_WITH_D3D
 EXTRA_DSO_LDOPTS += \
-  -LIBPATH:'$(MOZ_DIRECTX_SDK_PATH)/lib/$(MOZ_DIRECTX_SDK_CPU_SUFFIX)' \
+  -LIBPATH:'$(MOZ_DIRECTX_SDK_PATH)/lib/$(MOZ_D3D_CPU_SUFFIX)' \
   $(NULL)
 endif
 OS_LIBS += $(call EXPAND_LIBNAME,secur32 crypt32 iphlpapi strmiids dmoguids wmcodecdspuuid amstrmid msdmo wininet)
 endif
 endif
 
 ifdef MOZ_ALSA
 EXTRA_DSO_LDOPTS += $(MOZ_ALSA_LIBS)