Bug 987311 - Follow-up: Make CompositorD3D11 use EnumeratedArray to fix the build on MSVC 2012 (where typed enums are actually typed) - no review, bustage fix
authorBenoit Jacob <bjacob@mozilla.com>
Mon, 28 Apr 2014 10:14:00 -0400
changeset 180960 c29805c4ffa139a07526f33607543656b45422e4
parent 180959 e261a64bebf30602acd05a89cac0aa249fd32370
child 180961 828654777f7f596abb8126105e87461bc6f57801
push id272
push userpvanderbeken@mozilla.com
push dateMon, 05 May 2014 16:31:18 +0000
bugs987311
milestone31.0a1
Bug 987311 - Follow-up: Make CompositorD3D11 use EnumeratedArray to fix the build on MSVC 2012 (where typed enums are actually typed) - no review, bustage fix
gfx/layers/d3d11/CompositorD3D11.cpp
--- a/gfx/layers/d3d11/CompositorD3D11.cpp
+++ b/gfx/layers/d3d11/CompositorD3D11.cpp
@@ -11,16 +11,18 @@
 #include "gfxWindowsPlatform.h"
 #include "nsIWidget.h"
 #include "mozilla/layers/ImageHost.h"
 #include "mozilla/layers/ContentHost.h"
 #include "mozilla/layers/Effects.h"
 #include "nsWindowsHelpers.h"
 #include "gfxPrefs.h"
 
+#include "mozilla/EnumeratedArray.h"
+
 #ifdef MOZ_METRO
 #include <DXGI1_2.h>
 #endif
 
 namespace mozilla {
 
 using namespace gfx;
 
@@ -37,24 +39,30 @@ static const GUID sDeviceAttachmentsD3D1
 // {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
 {
+  typedef EnumeratedArray<MaskType, MaskType::NumMaskTypes, RefPtr<ID3D11VertexShader>>
+          VertexShaderArray;
+  typedef EnumeratedArray<MaskType, MaskType::NumMaskTypes, RefPtr<ID3D11PixelShader>>
+          PixelShaderArray;
+
   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<ID3D11PixelShader> mComponentAlphaShader[2];
+
+  VertexShaderArray mVSQuadShader;
+  PixelShaderArray mSolidColorShader;
+  PixelShaderArray mRGBAShader;
+  PixelShaderArray mRGBShader;
+  PixelShaderArray mYCbCrShader;
+  PixelShaderArray mComponentAlphaShader;
   RefPtr<ID3D11Buffer> mPSConstantBuffer;
   RefPtr<ID3D11Buffer> mVSConstantBuffer;
   RefPtr<ID3D11RasterizerState> mRasterizerState;
   RefPtr<ID3D11SamplerState> mLinearSamplerState;
   RefPtr<ID3D11SamplerState> mPointSamplerState;
   RefPtr<ID3D11BlendState> mPremulBlendState;
   RefPtr<ID3D11BlendState> mNonPremulBlendState;
   RefPtr<ID3D11BlendState> mComponentBlendState;