Bug 743148: Setup input assembler for component alpha filling. r=jrmuizel
authorBas Schouten <bschouten@mozilla.com>
Wed, 11 Apr 2012 16:55:31 +0200
changeset 92761 f99886297f833872e02362515f614f70ccc981d7
parent 92760 2fcf9cbedd48f5303fd1d0d426390b9ebc9c25d7
child 92762 0260266fa8b5fe5e78971e8a61fcd643dd338c44
push idunknown
push userunknown
push dateunknown
reviewersjrmuizel
bugs743148
milestone14.0a1
Bug 743148: Setup input assembler for component alpha filling. r=jrmuizel
gfx/layers/d3d10/LayerManagerD3D10.cpp
gfx/layers/d3d10/LayerManagerD3D10.h
gfx/layers/d3d10/ThebesLayerD3D10.cpp
--- a/gfx/layers/d3d10/LayerManagerD3D10.cpp
+++ b/gfx/layers/d3d10/LayerManagerD3D10.cpp
@@ -533,16 +533,28 @@ LayerManagerD3D10::SetViewport(const nsI
     SetRawValue(&projection._11, 0, 64);
 
   if (FAILED(hr)) {
     NS_WARNING("Failed to set projection matrix.");
   }
 }
 
 void
+LayerManagerD3D10::SetupInputAssembler()
+{
+  mDevice->IASetInputLayout(mInputLayout);
+
+  UINT stride = sizeof(Vertex);
+  UINT offset = 0;
+  ID3D10Buffer *buffer = mVertexBuffer;
+  mDevice->IASetVertexBuffers(0, 1, &buffer, &stride, &offset);
+  mDevice->IASetPrimitiveTopology(D3D10_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP);
+}
+
+void
 LayerManagerD3D10::SetupPipeline()
 {
   VerifyBufferSize();
   UpdateRenderTarget();
 
   nsIntRect rect;
   mWidget->GetClientBounds(rect);
 
@@ -553,23 +565,18 @@ LayerManagerD3D10::SetupPipeline()
 
   if (FAILED(hr)) {
     NS_WARNING("Failed to set Texture Coordinates.");
     return;
   }
 
   ID3D10RenderTargetView *view = mRTView;
   mDevice->OMSetRenderTargets(1, &view, NULL);
-  mDevice->IASetInputLayout(mInputLayout);
 
-  UINT stride = sizeof(Vertex);
-  UINT offset = 0;
-  ID3D10Buffer *buffer = mVertexBuffer;
-  mDevice->IASetVertexBuffers(0, 1, &buffer, &stride, &offset);
-  mDevice->IASetPrimitiveTopology(D3D10_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP);
+  SetupInputAssembler();
 
   SetViewport(nsIntSize(rect.width, rect.height));
 }
 
 void
 LayerManagerD3D10::UpdateRenderTarget()
 {
   if (mRTView) {
--- a/gfx/layers/d3d10/LayerManagerD3D10.h
+++ b/gfx/layers/d3d10/LayerManagerD3D10.h
@@ -179,16 +179,17 @@ public:
   // Public helpers
 
   ID3D10Device1 *device() const { return mDevice; }
 
   ID3D10Effect *effect() const { return mEffect; }
 
   ReadbackManagerD3D10 *readbackManager();
 
+  void SetupInputAssembler();
   void SetViewport(const nsIntSize &aViewport);
   const nsIntSize &GetViewport() { return mViewport; }
 
   /**
    * Return pointer to the Nv3DVUtils instance
    */
   Nv3DVUtils *GetNv3DVUtils()  { return mNv3DVUtils; }
 
--- a/gfx/layers/d3d10/ThebesLayerD3D10.cpp
+++ b/gfx/layers/d3d10/ThebesLayerD3D10.cpp
@@ -408,16 +408,17 @@ ThebesLayerD3D10::FillTexturesBlackWhite
     nsRefPtr<ID3D10RenderTargetView> viewBlack;
     nsRefPtr<ID3D10RenderTargetView> viewWhite;
     device()->CreateRenderTargetView(mTexture, NULL, getter_AddRefs(viewBlack));
     device()->CreateRenderTargetView(mTextureOnWhite, NULL, getter_AddRefs(viewWhite));
 
     D3D10_TEXTURE2D_DESC desc;
     mTexture->GetDesc(&desc);
 
+    mD3DManager->SetupInputAssembler();
     nsIntSize oldVP = mD3DManager->GetViewport();
 
     SetupDualViewports(gfxIntSize(desc.Width, desc.Height));
 
     ID3D10RenderTargetView *views[2] = { viewBlack, viewWhite };
     device()->OMSetRenderTargets(2, views, NULL);
 
     gfx3DMatrix transform;