blob: e82dc6cac0d71beb4593e40f6cc61780f5f3f7bc [file] [log] [blame]
shannon.woods@transgaming.combdf2d802013-02-28 23:16:20 +00001#include "precompiled.h"
daniel@transgaming.comb6b27bc2012-11-28 20:54:30 +00002//
3// Copyright (c) 2012 The ANGLE Project Authors. All rights reserved.
4// Use of this source code is governed by a BSD-style license that can be
5// found in the LICENSE file.
6//
7
8// RenderTarget11.cpp: Implements a DX11-specific wrapper for ID3D11View pointers
9// retained by Renderbuffers.
10
11#include "libGLESv2/renderer/RenderTarget11.h"
12#include "libGLESv2/renderer/Renderer11.h"
13
14#include "libGLESv2/renderer/renderer11_utils.h"
15#include "libGLESv2/main.h"
16
17namespace rx
18{
19
shannon.woods%transgaming.com@gtempaccount.com27ac40e2013-04-13 03:43:17 +000020static bool getTextureProperties(ID3D11Resource *resource, unsigned int *mipLevels, unsigned int *samples)
21{
22 ID3D11Texture1D *texture1D = d3d11::DynamicCastComObject<ID3D11Texture1D>(resource);
23 if (texture1D)
24 {
25 D3D11_TEXTURE1D_DESC texDesc;
26 texture1D->GetDesc(&texDesc);
27 texture1D->Release();
28
29 *mipLevels = texDesc.MipLevels;
30 *samples = 0;
31
32 return true;
33 }
34
35 ID3D11Texture2D *texture2D = d3d11::DynamicCastComObject<ID3D11Texture2D>(resource);
36 if (texture2D)
37 {
38 D3D11_TEXTURE2D_DESC texDesc;
39 texture2D->GetDesc(&texDesc);
40 texture2D->Release();
41
42 *mipLevels = texDesc.MipLevels;
43 *samples = texDesc.SampleDesc.Count > 1 ? texDesc.SampleDesc.Count : 0;
44
45 return true;
46 }
47
48 ID3D11Texture3D *texture3D = d3d11::DynamicCastComObject<ID3D11Texture3D>(resource);
49 if (texture3D)
50 {
51 D3D11_TEXTURE3D_DESC texDesc;
52 texture3D->GetDesc(&texDesc);
53 texture3D->Release();
54
55 *mipLevels = texDesc.MipLevels;
56 *samples = 0;
57
58 return true;
59 }
60
61 return false;
62}
63
64static unsigned int getRTVSubresourceIndex(ID3D11Resource *resource, ID3D11RenderTargetView *view)
daniel@transgaming.comb68d2bb2013-01-11 04:10:15 +000065{
66 D3D11_RENDER_TARGET_VIEW_DESC rtvDesc;
67 view->GetDesc(&rtvDesc);
68
daniel@transgaming.comb68d2bb2013-01-11 04:10:15 +000069 unsigned int mipSlice = 0;
70 unsigned int arraySlice = 0;
daniel@transgaming.comb68d2bb2013-01-11 04:10:15 +000071
72 switch (rtvDesc.ViewDimension)
73 {
74 case D3D11_RTV_DIMENSION_TEXTURE1D:
75 mipSlice = rtvDesc.Texture1D.MipSlice;
76 arraySlice = 0;
77 break;
78
79 case D3D11_RTV_DIMENSION_TEXTURE1DARRAY:
80 mipSlice = rtvDesc.Texture1DArray.MipSlice;
81 arraySlice = rtvDesc.Texture1DArray.FirstArraySlice;
82 break;
83
84 case D3D11_RTV_DIMENSION_TEXTURE2D:
85 mipSlice = rtvDesc.Texture2D.MipSlice;
86 arraySlice = 0;
87 break;
88
89 case D3D11_RTV_DIMENSION_TEXTURE2DARRAY:
90 mipSlice = rtvDesc.Texture2DArray.MipSlice;
91 arraySlice = rtvDesc.Texture2DArray.FirstArraySlice;
92 break;
93
94 case D3D11_RTV_DIMENSION_TEXTURE2DMS:
95 mipSlice = 0;
96 arraySlice = 0;
97 break;
98
99 case D3D11_RTV_DIMENSION_TEXTURE2DMSARRAY:
100 mipSlice = 0;
101 arraySlice = rtvDesc.Texture2DMSArray.FirstArraySlice;
102 break;
103
104 case D3D11_RTV_DIMENSION_TEXTURE3D:
105 mipSlice = rtvDesc.Texture3D.MipSlice;
106 arraySlice = 0;
107 break;
108
109 case D3D11_RTV_DIMENSION_UNKNOWN:
110 case D3D11_RTV_DIMENSION_BUFFER:
111 UNIMPLEMENTED();
112 break;
113
114 default:
115 UNREACHABLE();
116 break;
117 }
118
shannon.woods%transgaming.com@gtempaccount.com27ac40e2013-04-13 03:43:17 +0000119 unsigned int mipLevels, samples;
120 getTextureProperties(resource, &mipLevels, &samples);
121
daniel@transgaming.comb68d2bb2013-01-11 04:10:15 +0000122 return D3D11CalcSubresource(mipSlice, arraySlice, mipLevels);
123}
124
shannon.woods%transgaming.com@gtempaccount.com27ac40e2013-04-13 03:43:17 +0000125static unsigned int getDSVSubresourceIndex(ID3D11Resource *resource, ID3D11DepthStencilView *view)
daniel@transgaming.comb68d2bb2013-01-11 04:10:15 +0000126{
127 D3D11_DEPTH_STENCIL_VIEW_DESC dsvDesc;
128 view->GetDesc(&dsvDesc);
129
daniel@transgaming.comb68d2bb2013-01-11 04:10:15 +0000130 unsigned int mipSlice = 0;
131 unsigned int arraySlice = 0;
daniel@transgaming.comb68d2bb2013-01-11 04:10:15 +0000132
133 switch (dsvDesc.ViewDimension)
134 {
135 case D3D11_DSV_DIMENSION_TEXTURE1D:
136 mipSlice = dsvDesc.Texture1D.MipSlice;
137 arraySlice = 0;
138 break;
139
140 case D3D11_DSV_DIMENSION_TEXTURE1DARRAY:
141 mipSlice = dsvDesc.Texture1DArray.MipSlice;
142 arraySlice = dsvDesc.Texture1DArray.FirstArraySlice;
143 break;
144
145 case D3D11_DSV_DIMENSION_TEXTURE2D:
146 mipSlice = dsvDesc.Texture2D.MipSlice;
147 arraySlice = 0;
148 break;
149
150 case D3D11_DSV_DIMENSION_TEXTURE2DARRAY:
151 mipSlice = dsvDesc.Texture2DArray.MipSlice;
152 arraySlice = dsvDesc.Texture2DArray.FirstArraySlice;
153 break;
154
155 case D3D11_DSV_DIMENSION_TEXTURE2DMS:
156 mipSlice = 0;
157 arraySlice = 0;
158 break;
159
160 case D3D11_DSV_DIMENSION_TEXTURE2DMSARRAY:
161 mipSlice = 0;
162 arraySlice = dsvDesc.Texture2DMSArray.FirstArraySlice;
163 break;
164
shannon.woods%transgaming.com@gtempaccount.com27ac40e2013-04-13 03:43:17 +0000165 case D3D11_DSV_DIMENSION_UNKNOWN:
daniel@transgaming.comb68d2bb2013-01-11 04:10:15 +0000166 UNIMPLEMENTED();
167 break;
168
169 default:
170 UNREACHABLE();
171 break;
172 }
173
shannon.woods%transgaming.com@gtempaccount.com27ac40e2013-04-13 03:43:17 +0000174 unsigned int mipLevels, samples;
175 getTextureProperties(resource, &mipLevels, &samples);
176
daniel@transgaming.comb68d2bb2013-01-11 04:10:15 +0000177 return D3D11CalcSubresource(mipSlice, arraySlice, mipLevels);
178}
179
shannonwoods@chromium.org7faf3ec2013-05-30 00:03:45 +0000180RenderTarget11::RenderTarget11(Renderer *renderer, ID3D11RenderTargetView *rtv, ID3D11Resource *resource,
181 ID3D11ShaderResourceView *srv, GLsizei width, GLsizei height, GLsizei depth)
daniel@transgaming.comb6b27bc2012-11-28 20:54:30 +0000182{
183 mRenderer = Renderer11::makeRenderer11(renderer);
shannon.woods%transgaming.com@gtempaccount.com27ac40e2013-04-13 03:43:17 +0000184 mTexture = resource;
shannon.woods@transgaming.com183408d2013-01-25 21:50:07 +0000185 mRenderTarget = rtv;
daniel@transgaming.comb6b27bc2012-11-28 20:54:30 +0000186 mDepthStencil = NULL;
shannon.woods@transgaming.com183408d2013-01-25 21:50:07 +0000187 mShaderResource = srv;
shannon.woods@transgaming.com3e3da582013-02-28 23:09:03 +0000188 mSubresourceIndex = 0;
daniel@transgaming.comb6b27bc2012-11-28 20:54:30 +0000189
shannon.woods@transgaming.com7e232852013-02-28 23:06:15 +0000190 if (mRenderTarget && mTexture)
daniel@transgaming.comb6b27bc2012-11-28 20:54:30 +0000191 {
192 D3D11_RENDER_TARGET_VIEW_DESC desc;
shannon.woods@transgaming.com183408d2013-01-25 21:50:07 +0000193 mRenderTarget->GetDesc(&desc);
daniel@transgaming.comb6b27bc2012-11-28 20:54:30 +0000194
shannon.woods%transgaming.com@gtempaccount.com27ac40e2013-04-13 03:43:17 +0000195 unsigned int mipLevels, samples;
196 getTextureProperties(mTexture, &mipLevels, &samples);
shannon.woods@transgaming.com7e232852013-02-28 23:06:15 +0000197
198 mSubresourceIndex = getRTVSubresourceIndex(mTexture, mRenderTarget);
daniel@transgaming.comb6b27bc2012-11-28 20:54:30 +0000199 mWidth = width;
200 mHeight = height;
shannonwoods@chromium.org7faf3ec2013-05-30 00:03:45 +0000201 mDepth = depth;
shannon.woods%transgaming.com@gtempaccount.com27ac40e2013-04-13 03:43:17 +0000202 mSamples = samples;
daniel@transgaming.comb68d2bb2013-01-11 04:10:15 +0000203
shannon.woods@transgaming.com183408d2013-01-25 21:50:07 +0000204 mInternalFormat = d3d11_gl::ConvertTextureInternalFormat(desc.Format);
205 mActualFormat = d3d11_gl::ConvertTextureInternalFormat(desc.Format);
daniel@transgaming.comb6b27bc2012-11-28 20:54:30 +0000206 }
207}
208
shannonwoods@chromium.org7faf3ec2013-05-30 00:03:45 +0000209RenderTarget11::RenderTarget11(Renderer *renderer, ID3D11DepthStencilView *dsv, ID3D11Resource *resource,
210 ID3D11ShaderResourceView *srv, GLsizei width, GLsizei height, GLsizei depth)
daniel@transgaming.comb6b27bc2012-11-28 20:54:30 +0000211{
212 mRenderer = Renderer11::makeRenderer11(renderer);
shannon.woods%transgaming.com@gtempaccount.com27ac40e2013-04-13 03:43:17 +0000213 mTexture = resource;
daniel@transgaming.comb6b27bc2012-11-28 20:54:30 +0000214 mRenderTarget = NULL;
shannon.woods@transgaming.com183408d2013-01-25 21:50:07 +0000215 mDepthStencil = dsv;
216 mShaderResource = srv;
shannon.woods@transgaming.com3e3da582013-02-28 23:09:03 +0000217 mSubresourceIndex = 0;
daniel@transgaming.comb6b27bc2012-11-28 20:54:30 +0000218
shannon.woods@transgaming.com7e232852013-02-28 23:06:15 +0000219 if (mDepthStencil && mTexture)
daniel@transgaming.comb6b27bc2012-11-28 20:54:30 +0000220 {
221 D3D11_DEPTH_STENCIL_VIEW_DESC desc;
shannon.woods@transgaming.com183408d2013-01-25 21:50:07 +0000222 mDepthStencil->GetDesc(&desc);
daniel@transgaming.comb6b27bc2012-11-28 20:54:30 +0000223
shannon.woods%transgaming.com@gtempaccount.com27ac40e2013-04-13 03:43:17 +0000224 unsigned int mipLevels, samples;
225 getTextureProperties(mTexture, &mipLevels, &samples);
shannon.woods@transgaming.com7e232852013-02-28 23:06:15 +0000226
227 mSubresourceIndex = getDSVSubresourceIndex(mTexture, mDepthStencil);
daniel@transgaming.comb6b27bc2012-11-28 20:54:30 +0000228 mWidth = width;
229 mHeight = height;
shannonwoods@chromium.org7faf3ec2013-05-30 00:03:45 +0000230 mDepth = depth;
shannon.woods%transgaming.com@gtempaccount.com27ac40e2013-04-13 03:43:17 +0000231 mSamples = samples;
daniel@transgaming.comb68d2bb2013-01-11 04:10:15 +0000232
shannon.woods@transgaming.com183408d2013-01-25 21:50:07 +0000233 mInternalFormat = d3d11_gl::ConvertTextureInternalFormat(desc.Format);
234 mActualFormat = d3d11_gl::ConvertTextureInternalFormat(desc.Format);
daniel@transgaming.comb6b27bc2012-11-28 20:54:30 +0000235 }
236}
237
shannonwoods@chromium.org7faf3ec2013-05-30 00:03:45 +0000238RenderTarget11::RenderTarget11(Renderer *renderer, GLsizei width, GLsizei height, GLenum format, GLsizei samples, bool depthStencil)
daniel@transgaming.comc9a501d2013-01-11 04:08:46 +0000239{
240 mRenderer = Renderer11::makeRenderer11(renderer);
shannon.woods@transgaming.com7e232852013-02-28 23:06:15 +0000241 mTexture = NULL;
daniel@transgaming.comc9a501d2013-01-11 04:08:46 +0000242 mRenderTarget = NULL;
243 mDepthStencil = NULL;
shannon.woods@transgaming.com183408d2013-01-25 21:50:07 +0000244 mShaderResource = NULL;
daniel@transgaming.comc9a501d2013-01-11 04:08:46 +0000245
246 DXGI_FORMAT requestedFormat = gl_d3d11::ConvertRenderbufferFormat(format);
daniel@transgaming.comc9a501d2013-01-11 04:08:46 +0000247
shannon.woods@transgaming.comae84f732013-02-28 23:05:57 +0000248 int supportedSamples = mRenderer->getNearestSupportedSamples(requestedFormat, samples);
249 if (supportedSamples < 0)
daniel@transgaming.comc9a501d2013-01-11 04:08:46 +0000250 {
shannon.woods@transgaming.com779aa262013-02-28 23:04:58 +0000251 gl::error(GL_OUT_OF_MEMORY);
daniel@transgaming.comc9a501d2013-01-11 04:08:46 +0000252 return;
253 }
254
daniel@transgaming.comc9a501d2013-01-11 04:08:46 +0000255 if (width > 0 && height > 0)
256 {
257 // Create texture resource
258 D3D11_TEXTURE2D_DESC desc;
259 desc.Width = width;
260 desc.Height = height;
261 desc.MipLevels = 1;
262 desc.ArraySize = 1;
263 desc.Format = requestedFormat;
shannon.woods@transgaming.comae84f732013-02-28 23:05:57 +0000264 desc.SampleDesc.Count = (supportedSamples == 0) ? 1 : supportedSamples;
daniel@transgaming.comc9a501d2013-01-11 04:08:46 +0000265 desc.SampleDesc.Quality = 0;
266 desc.Usage = D3D11_USAGE_DEFAULT;
267 desc.CPUAccessFlags = 0;
268 desc.MiscFlags = 0;
shannonwoods@chromium.org7faf3ec2013-05-30 00:03:45 +0000269 desc.BindFlags = (depthStencil ? D3D11_BIND_DEPTH_STENCIL : (D3D11_BIND_RENDER_TARGET | D3D11_BIND_SHADER_RESOURCE));
daniel@transgaming.comc9a501d2013-01-11 04:08:46 +0000270
271 ID3D11Device *device = mRenderer->getDevice();
shannon.woods%transgaming.com@gtempaccount.com27ac40e2013-04-13 03:43:17 +0000272 ID3D11Texture2D *texture = NULL;
273 HRESULT result = device->CreateTexture2D(&desc, NULL, &texture);
274 mTexture = texture;
daniel@transgaming.comc9a501d2013-01-11 04:08:46 +0000275
shannon.woods@transgaming.com8d8814b2013-02-28 23:10:53 +0000276 if (result == E_OUTOFMEMORY)
daniel@transgaming.comc9a501d2013-01-11 04:08:46 +0000277 {
shannon.woods@transgaming.com779aa262013-02-28 23:04:58 +0000278 gl::error(GL_OUT_OF_MEMORY);
daniel@transgaming.comc9a501d2013-01-11 04:08:46 +0000279 return;
280 }
daniel@transgaming.comc9a501d2013-01-11 04:08:46 +0000281 ASSERT(SUCCEEDED(result));
shannon.woods@transgaming.com183408d2013-01-25 21:50:07 +0000282
shannonwoods@chromium.org7faf3ec2013-05-30 00:03:45 +0000283 if (depthStencil)
shannon.woods@transgaming.com183408d2013-01-25 21:50:07 +0000284 {
285 D3D11_DEPTH_STENCIL_VIEW_DESC dsvDesc;
286 dsvDesc.Format = requestedFormat;
shannon.woods@transgaming.comae84f732013-02-28 23:05:57 +0000287 dsvDesc.ViewDimension = (supportedSamples == 0) ? D3D11_DSV_DIMENSION_TEXTURE2D : D3D11_DSV_DIMENSION_TEXTURE2DMS;
shannon.woods@transgaming.com183408d2013-01-25 21:50:07 +0000288 dsvDesc.Texture2D.MipSlice = 0;
289 dsvDesc.Flags = 0;
shannon.woods@transgaming.com7e232852013-02-28 23:06:15 +0000290 result = device->CreateDepthStencilView(mTexture, &dsvDesc, &mDepthStencil);
shannon.woods@transgaming.com183408d2013-01-25 21:50:07 +0000291
shannon.woods@transgaming.com8d8814b2013-02-28 23:10:53 +0000292 if (result == E_OUTOFMEMORY)
shannon.woods@transgaming.com183408d2013-01-25 21:50:07 +0000293 {
shannon.woods@transgaming.com7e232852013-02-28 23:06:15 +0000294 mTexture->Release();
295 mTexture = NULL;
shannon.woods@transgaming.com779aa262013-02-28 23:04:58 +0000296 gl::error(GL_OUT_OF_MEMORY);
shannon.woods@transgaming.com183408d2013-01-25 21:50:07 +0000297 }
298 ASSERT(SUCCEEDED(result));
299 }
300 else
301 {
302 D3D11_RENDER_TARGET_VIEW_DESC rtvDesc;
303 rtvDesc.Format = requestedFormat;
shannon.woods@transgaming.comae84f732013-02-28 23:05:57 +0000304 rtvDesc.ViewDimension = (supportedSamples == 0) ? D3D11_RTV_DIMENSION_TEXTURE2D : D3D11_RTV_DIMENSION_TEXTURE2DMS;
shannon.woods@transgaming.com183408d2013-01-25 21:50:07 +0000305 rtvDesc.Texture2D.MipSlice = 0;
shannon.woods@transgaming.com7e232852013-02-28 23:06:15 +0000306 result = device->CreateRenderTargetView(mTexture, &rtvDesc, &mRenderTarget);
shannon.woods@transgaming.com183408d2013-01-25 21:50:07 +0000307
shannon.woods@transgaming.com8d8814b2013-02-28 23:10:53 +0000308 if (result == E_OUTOFMEMORY)
shannon.woods@transgaming.com183408d2013-01-25 21:50:07 +0000309 {
shannon.woods@transgaming.com7e232852013-02-28 23:06:15 +0000310 mTexture->Release();
311 mTexture = NULL;
shannon.woods@transgaming.com779aa262013-02-28 23:04:58 +0000312 gl::error(GL_OUT_OF_MEMORY);
shannon.woods@transgaming.com183408d2013-01-25 21:50:07 +0000313 return;
314 }
315 ASSERT(SUCCEEDED(result));
316
317 D3D11_SHADER_RESOURCE_VIEW_DESC srvDesc;
318 srvDesc.Format = requestedFormat;
shannon.woods@transgaming.comae84f732013-02-28 23:05:57 +0000319 srvDesc.ViewDimension = (supportedSamples == 0) ? D3D11_SRV_DIMENSION_TEXTURE2D : D3D11_SRV_DIMENSION_TEXTURE2DMS;
shannon.woods@transgaming.com183408d2013-01-25 21:50:07 +0000320 srvDesc.Texture2D.MostDetailedMip = 0;
321 srvDesc.Texture2D.MipLevels = 1;
shannon.woods@transgaming.com7e232852013-02-28 23:06:15 +0000322 result = device->CreateShaderResourceView(mTexture, &srvDesc, &mShaderResource);
shannon.woods@transgaming.com183408d2013-01-25 21:50:07 +0000323
shannon.woods@transgaming.com8d8814b2013-02-28 23:10:53 +0000324 if (result == E_OUTOFMEMORY)
shannon.woods@transgaming.com183408d2013-01-25 21:50:07 +0000325 {
shannon.woods@transgaming.com7e232852013-02-28 23:06:15 +0000326 mTexture->Release();
327 mTexture = NULL;
shannon.woods@transgaming.com183408d2013-01-25 21:50:07 +0000328 mRenderTarget->Release();
shannon.woods@transgaming.com7e232852013-02-28 23:06:15 +0000329 mRenderTarget = NULL;
shannon.woods@transgaming.com779aa262013-02-28 23:04:58 +0000330 gl::error(GL_OUT_OF_MEMORY);
shannon.woods@transgaming.com183408d2013-01-25 21:50:07 +0000331 return;
332 }
333 ASSERT(SUCCEEDED(result));
334 }
daniel@transgaming.comc9a501d2013-01-11 04:08:46 +0000335 }
336
337 mWidth = width;
338 mHeight = height;
shannonwoods@chromium.org7faf3ec2013-05-30 00:03:45 +0000339 mDepth = 1;
daniel@transgaming.comc9a501d2013-01-11 04:08:46 +0000340 mInternalFormat = format;
341 mSamples = supportedSamples;
shannon.woods@transgaming.comb3f4be02013-02-28 23:05:52 +0000342 mActualFormat = d3d11_gl::ConvertTextureInternalFormat(requestedFormat);
daniel@transgaming.comb68d2bb2013-01-11 04:10:15 +0000343 mSubresourceIndex = D3D11CalcSubresource(0, 0, 1);
daniel@transgaming.comc9a501d2013-01-11 04:08:46 +0000344}
345
daniel@transgaming.comb6b27bc2012-11-28 20:54:30 +0000346RenderTarget11::~RenderTarget11()
347{
shannon.woods@transgaming.com7e232852013-02-28 23:06:15 +0000348 if (mTexture)
349 {
350 mTexture->Release();
351 mTexture = NULL;
352 }
353
daniel@transgaming.comb6b27bc2012-11-28 20:54:30 +0000354 if (mRenderTarget)
355 {
356 mRenderTarget->Release();
shannon.woods@transgaming.com183408d2013-01-25 21:50:07 +0000357 mRenderTarget = NULL;
daniel@transgaming.comb6b27bc2012-11-28 20:54:30 +0000358 }
359
360 if (mDepthStencil)
361 {
362 mDepthStencil->Release();
shannon.woods@transgaming.com183408d2013-01-25 21:50:07 +0000363 mDepthStencil = NULL;
364 }
365
366 if (mShaderResource)
367 {
368 mShaderResource->Release();
369 mShaderResource = NULL;
daniel@transgaming.comb6b27bc2012-11-28 20:54:30 +0000370 }
371}
372
373RenderTarget11 *RenderTarget11::makeRenderTarget11(RenderTarget *target)
374{
apatrick@chromium.org8b400b12013-01-30 21:53:40 +0000375 ASSERT(HAS_DYNAMIC_TYPE(rx::RenderTarget11*, target));
daniel@transgaming.comb6b27bc2012-11-28 20:54:30 +0000376 return static_cast<rx::RenderTarget11*>(target);
377}
378
shannon.woods%transgaming.com@gtempaccount.com27ac40e2013-04-13 03:43:17 +0000379ID3D11Resource *RenderTarget11::getTexture() const
shannon.woods@transgaming.com7e232852013-02-28 23:06:15 +0000380{
381 if (mTexture)
382 {
383 mTexture->AddRef();
384 }
385
386 return mTexture;
387}
388
daniel@transgaming.com816c7f32012-11-28 21:02:01 +0000389// Adds reference, caller must call Release
390ID3D11RenderTargetView *RenderTarget11::getRenderTargetView() const
391{
392 if (mRenderTarget)
393 {
394 mRenderTarget->AddRef();
395 }
396
397 return mRenderTarget;
398}
399
400// Adds reference, caller must call Release
401ID3D11DepthStencilView *RenderTarget11::getDepthStencilView() const
402{
403 if (mDepthStencil)
404 {
405 mDepthStencil->AddRef();
406 }
407
408 return mDepthStencil;
409}
410
shannon.woods@transgaming.com183408d2013-01-25 21:50:07 +0000411// Adds reference, caller must call Release
412ID3D11ShaderResourceView *RenderTarget11::getShaderResourceView() const
413{
414 if (mShaderResource)
415 {
416 mShaderResource->AddRef();
417 }
418
419 return mShaderResource;
420}
421
daniel@transgaming.comb68d2bb2013-01-11 04:10:15 +0000422unsigned int RenderTarget11::getSubresourceIndex() const
423{
424 return mSubresourceIndex;
425}
426
shannon.woods@transgaming.com183408d2013-01-25 21:50:07 +0000427}