Adds RenderTarget11 type

TRAC #22134

Signed-off-by: Nicolas Capens
Signed-off-by: Daniel Koch

git-svn-id: https://angleproject.googlecode.com/svn/branches/dx11proto@1481 736b8ea6-26fd-11df-bfd4-992fa37f6226
diff --git a/src/libGLESv2/renderer/RenderTarget11.cpp b/src/libGLESv2/renderer/RenderTarget11.cpp
new file mode 100644
index 0000000..737d030
--- /dev/null
+++ b/src/libGLESv2/renderer/RenderTarget11.cpp
@@ -0,0 +1,78 @@
+//
+// Copyright (c) 2012 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// RenderTarget11.cpp: Implements a DX11-specific wrapper for ID3D11View pointers
+// retained by Renderbuffers.
+
+#include "libGLESv2/renderer/RenderTarget11.h"
+#include "libGLESv2/renderer/Renderer11.h"
+
+#include "libGLESv2/renderer/renderer11_utils.h"
+#include "libGLESv2/main.h"
+
+namespace rx
+{
+
+RenderTarget11::RenderTarget11(Renderer *renderer, ID3D11RenderTargetView *view, GLsizei width, GLsizei height)
+{
+    mRenderer = Renderer11::makeRenderer11(renderer);
+    mRenderTarget = view;
+    mDepthStencil = NULL;
+
+    if (mRenderTarget)
+    {
+        D3D11_RENDER_TARGET_VIEW_DESC desc;
+        view->GetDesc(&desc);
+
+        mWidth = width;
+        mHeight = height;
+        
+        mInternalFormat = d3d11_gl::ConvertRenderbufferFormat(desc.Format);
+        mActualFormat = d3d11_gl::ConvertRenderbufferFormat(desc.Format);
+        mSamples = 1; // TEMP?
+    }
+}
+
+RenderTarget11::RenderTarget11(Renderer *renderer, ID3D11DepthStencilView *view, GLsizei width, GLsizei height)
+{
+    mRenderer = Renderer11::makeRenderer11(renderer);
+    mRenderTarget = NULL;
+    mDepthStencil = view;
+
+    if (mDepthStencil)
+    {
+        D3D11_DEPTH_STENCIL_VIEW_DESC desc;
+        view->GetDesc(&desc);
+
+        mWidth = width;
+        mHeight = height;
+        
+        mInternalFormat = d3d11_gl::ConvertRenderbufferFormat(desc.Format);
+        mActualFormat = d3d11_gl::ConvertRenderbufferFormat(desc.Format);
+        mSamples = 1; // TEMP?
+    }
+}
+
+RenderTarget11::~RenderTarget11()
+{
+    if (mRenderTarget)
+    {
+        mRenderTarget->Release();
+    }
+
+    if (mDepthStencil)
+    {
+        mDepthStencil->Release();
+    }
+}
+
+RenderTarget11 *RenderTarget11::makeRenderTarget11(RenderTarget *target)
+{
+    ASSERT(dynamic_cast<rx::RenderTarget11*>(target) != NULL);
+    return static_cast<rx::RenderTarget11*>(target);
+}
+
+}
\ No newline at end of file