2 // Copyright (c) 2012-2014 The ANGLE Project Authors. All rights reserved.
3 // Use of this source code is governed by a BSD-style license that can be
4 // found in the LICENSE file.
7 // SwapChain11.cpp: Implements a back-end specific class for the D3D11 swap chain.
9 #include "libGLESv2/renderer/d3d/d3d11/SwapChain11.h"
10 #include "libGLESv2/renderer/d3d/d3d11/renderer11_utils.h"
11 #include "libGLESv2/renderer/d3d/d3d11/formatutils11.h"
12 #include "libGLESv2/renderer/d3d/d3d11/Renderer11.h"
14 // Precompiled shaders
15 #include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/passthrough2d11vs.h"
16 #include "libGLESv2/renderer/d3d/d3d11/shaders/compiled/passthroughrgba2d11ps.h"
18 #include "common/features.h"
19 #include "common/NativeWindow.h"
24 SwapChain11::SwapChain11(Renderer11 *renderer, rx::NativeWindow nativeWindow, HANDLE shareHandle,
25 GLenum backBufferFormat, GLenum depthBufferFormat)
26 : mRenderer(renderer),
27 SwapChain(nativeWindow, shareHandle, backBufferFormat, depthBufferFormat)
30 mBackBufferTexture = NULL;
31 mBackBufferRTView = NULL;
32 mOffscreenTexture = NULL;
33 mOffscreenRTView = NULL;
34 mOffscreenSRView = NULL;
35 mDepthStencilTexture = NULL;
36 mDepthStencilDSView = NULL;
37 mDepthStencilSRView = NULL;
39 mPassThroughSampler = NULL;
40 mPassThroughIL = NULL;
41 mPassThroughVS = NULL;
42 mPassThroughPS = NULL;
46 mAppCreatedShareHandle = mShareHandle != NULL;
47 mPassThroughResourcesInit = false;
50 SwapChain11::~SwapChain11()
55 void SwapChain11::release()
57 SafeRelease(mSwapChain);
58 SafeRelease(mBackBufferTexture);
59 SafeRelease(mBackBufferRTView);
60 SafeRelease(mOffscreenTexture);
61 SafeRelease(mOffscreenRTView);
62 SafeRelease(mOffscreenSRView);
63 SafeRelease(mDepthStencilTexture);
64 SafeRelease(mDepthStencilDSView);
65 SafeRelease(mDepthStencilSRView);
67 SafeRelease(mPassThroughSampler);
68 SafeRelease(mPassThroughIL);
69 SafeRelease(mPassThroughVS);
70 SafeRelease(mPassThroughPS);
72 if (!mAppCreatedShareHandle)
78 void SwapChain11::releaseOffscreenTexture()
80 SafeRelease(mOffscreenTexture);
81 SafeRelease(mOffscreenRTView);
82 SafeRelease(mOffscreenSRView);
83 SafeRelease(mDepthStencilTexture);
84 SafeRelease(mDepthStencilDSView);
85 SafeRelease(mDepthStencilSRView);
88 EGLint SwapChain11::resetOffscreenTexture(int backbufferWidth, int backbufferHeight)
90 ID3D11Device *device = mRenderer->getDevice();
92 ASSERT(device != NULL);
94 // D3D11 does not allow zero size textures
95 ASSERT(backbufferWidth >= 1);
96 ASSERT(backbufferHeight >= 1);
98 // Preserve the render target content
99 ID3D11Texture2D *previousOffscreenTexture = mOffscreenTexture;
100 if (previousOffscreenTexture)
102 previousOffscreenTexture->AddRef();
104 const int previousWidth = mWidth;
105 const int previousHeight = mHeight;
107 releaseOffscreenTexture();
109 const d3d11::TextureFormat &backbufferFormatInfo = d3d11::GetTextureFormatInfo(mBackBufferFormat);
111 // If the app passed in a share handle, open the resource
112 // See EGL_ANGLE_d3d_share_handle_client_buffer
113 if (mAppCreatedShareHandle)
115 ID3D11Resource *tempResource11;
116 HRESULT result = device->OpenSharedResource(mShareHandle, __uuidof(ID3D11Resource), (void**)&tempResource11);
120 ERR("Failed to open the swap chain pbuffer share handle: %08lX", result);
122 return EGL_BAD_PARAMETER;
125 result = tempResource11->QueryInterface(__uuidof(ID3D11Texture2D), (void**)&mOffscreenTexture);
126 SafeRelease(tempResource11);
130 ERR("Failed to query texture2d interface in pbuffer share handle: %08lX", result);
132 return EGL_BAD_PARAMETER;
135 // Validate offscreen texture parameters
136 D3D11_TEXTURE2D_DESC offscreenTextureDesc = {0};
137 mOffscreenTexture->GetDesc(&offscreenTextureDesc);
139 if (offscreenTextureDesc.Width != (UINT)backbufferWidth ||
140 offscreenTextureDesc.Height != (UINT)backbufferHeight ||
141 offscreenTextureDesc.Format != backbufferFormatInfo.texFormat ||
142 offscreenTextureDesc.MipLevels != 1 ||
143 offscreenTextureDesc.ArraySize != 1)
145 ERR("Invalid texture parameters in the shared offscreen texture pbuffer");
147 return EGL_BAD_PARAMETER;
152 const bool useSharedResource = !mNativeWindow.getNativeWindow() && mRenderer->getShareHandleSupport();
154 D3D11_TEXTURE2D_DESC offscreenTextureDesc = {0};
155 offscreenTextureDesc.Width = backbufferWidth;
156 offscreenTextureDesc.Height = backbufferHeight;
157 offscreenTextureDesc.Format = backbufferFormatInfo.texFormat;
158 offscreenTextureDesc.MipLevels = 1;
159 offscreenTextureDesc.ArraySize = 1;
160 offscreenTextureDesc.SampleDesc.Count = 1;
161 offscreenTextureDesc.SampleDesc.Quality = 0;
162 offscreenTextureDesc.Usage = D3D11_USAGE_DEFAULT;
163 offscreenTextureDesc.BindFlags = D3D11_BIND_RENDER_TARGET | D3D11_BIND_SHADER_RESOURCE;
164 offscreenTextureDesc.CPUAccessFlags = 0;
165 offscreenTextureDesc.MiscFlags = useSharedResource ? D3D11_RESOURCE_MISC_SHARED : 0;
167 HRESULT result = device->CreateTexture2D(&offscreenTextureDesc, NULL, &mOffscreenTexture);
171 ERR("Could not create offscreen texture: %08lX", result);
174 if (d3d11::isDeviceLostError(result))
176 return EGL_CONTEXT_LOST;
180 return EGL_BAD_ALLOC;
184 d3d11::SetDebugName(mOffscreenTexture, "Offscreen back buffer texture");
186 // EGL_ANGLE_surface_d3d_texture_2d_share_handle requires that we store a share handle for the client
187 if (useSharedResource)
189 IDXGIResource *offscreenTextureResource = NULL;
190 result = mOffscreenTexture->QueryInterface(__uuidof(IDXGIResource), (void**)&offscreenTextureResource);
192 // Fall back to no share handle on failure
195 ERR("Could not query offscreen texture resource: %08lX", result);
199 result = offscreenTextureResource->GetSharedHandle(&mShareHandle);
200 SafeRelease(offscreenTextureResource);
205 ERR("Could not get offscreen texture shared handle: %08lX", result);
212 D3D11_RENDER_TARGET_VIEW_DESC offscreenRTVDesc;
213 offscreenRTVDesc.Format = backbufferFormatInfo.rtvFormat;
214 offscreenRTVDesc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2D;
215 offscreenRTVDesc.Texture2D.MipSlice = 0;
217 HRESULT result = device->CreateRenderTargetView(mOffscreenTexture, &offscreenRTVDesc, &mOffscreenRTView);
218 ASSERT(SUCCEEDED(result));
219 d3d11::SetDebugName(mOffscreenRTView, "Offscreen back buffer render target");
221 D3D11_SHADER_RESOURCE_VIEW_DESC offscreenSRVDesc;
222 offscreenSRVDesc.Format = backbufferFormatInfo.srvFormat;
223 offscreenSRVDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2D;
224 offscreenSRVDesc.Texture2D.MostDetailedMip = 0;
225 offscreenSRVDesc.Texture2D.MipLevels = -1;
227 result = device->CreateShaderResourceView(mOffscreenTexture, &offscreenSRVDesc, &mOffscreenSRView);
228 ASSERT(SUCCEEDED(result));
229 d3d11::SetDebugName(mOffscreenSRView, "Offscreen back buffer shader resource");
231 const d3d11::TextureFormat &depthBufferFormatInfo = d3d11::GetTextureFormatInfo(mDepthBufferFormat);
233 if (mDepthBufferFormat != GL_NONE)
235 D3D11_TEXTURE2D_DESC depthStencilTextureDesc;
236 depthStencilTextureDesc.Width = backbufferWidth;
237 depthStencilTextureDesc.Height = backbufferHeight;
238 depthStencilTextureDesc.Format = depthBufferFormatInfo.texFormat;
239 depthStencilTextureDesc.MipLevels = 1;
240 depthStencilTextureDesc.ArraySize = 1;
241 depthStencilTextureDesc.SampleDesc.Count = 1;
242 depthStencilTextureDesc.SampleDesc.Quality = 0;
243 depthStencilTextureDesc.Usage = D3D11_USAGE_DEFAULT;
244 depthStencilTextureDesc.BindFlags = D3D11_BIND_DEPTH_STENCIL | D3D11_BIND_SHADER_RESOURCE;
245 depthStencilTextureDesc.CPUAccessFlags = 0;
246 depthStencilTextureDesc.MiscFlags = 0;
248 result = device->CreateTexture2D(&depthStencilTextureDesc, NULL, &mDepthStencilTexture);
251 ERR("Could not create depthstencil surface for new swap chain: 0x%08X", result);
254 if (d3d11::isDeviceLostError(result))
256 return EGL_CONTEXT_LOST;
260 return EGL_BAD_ALLOC;
263 d3d11::SetDebugName(mDepthStencilTexture, "Offscreen depth stencil texture");
265 D3D11_DEPTH_STENCIL_VIEW_DESC depthStencilDesc;
266 depthStencilDesc.Format = depthBufferFormatInfo.dsvFormat;
267 depthStencilDesc.ViewDimension = D3D11_DSV_DIMENSION_TEXTURE2D;
268 depthStencilDesc.Flags = 0;
269 depthStencilDesc.Texture2D.MipSlice = 0;
271 result = device->CreateDepthStencilView(mDepthStencilTexture, &depthStencilDesc, &mDepthStencilDSView);
272 ASSERT(SUCCEEDED(result));
273 d3d11::SetDebugName(mDepthStencilDSView, "Offscreen depth stencil view");
275 D3D11_SHADER_RESOURCE_VIEW_DESC depthStencilSRVDesc;
276 depthStencilSRVDesc.Format = depthBufferFormatInfo.srvFormat;
277 depthStencilSRVDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2D;
278 depthStencilSRVDesc.Texture2D.MostDetailedMip = 0;
279 depthStencilSRVDesc.Texture2D.MipLevels = -1;
281 result = device->CreateShaderResourceView(mDepthStencilTexture, &depthStencilSRVDesc, &mDepthStencilSRView);
282 ASSERT(SUCCEEDED(result));
283 d3d11::SetDebugName(mDepthStencilSRView, "Offscreen depth stencil shader resource");
286 mWidth = backbufferWidth;
287 mHeight = backbufferHeight;
289 if (previousOffscreenTexture != NULL)
291 D3D11_BOX sourceBox = {0};
293 sourceBox.right = std::min(previousWidth, mWidth);
294 sourceBox.top = std::max(previousHeight - mHeight, 0);
295 sourceBox.bottom = previousHeight;
299 ID3D11DeviceContext *deviceContext = mRenderer->getDeviceContext();
300 const int yoffset = std::max(mHeight - previousHeight, 0);
301 deviceContext->CopySubresourceRegion(mOffscreenTexture, 0, 0, yoffset, 0, previousOffscreenTexture, 0, &sourceBox);
303 SafeRelease(previousOffscreenTexture);
307 swapRect(0, 0, mWidth, mHeight);
314 EGLint SwapChain11::resize(EGLint backbufferWidth, EGLint backbufferHeight)
316 ID3D11Device *device = mRenderer->getDevice();
320 return EGL_BAD_ACCESS;
323 // EGL allows creating a surface with 0x0 dimension, however, DXGI does not like 0x0 swapchains
324 if (backbufferWidth < 1 || backbufferHeight < 1)
329 // Can only call resize if we have already created our swap buffer and resources
330 ASSERT(mSwapChain && mBackBufferTexture && mBackBufferRTView);
332 SafeRelease(mBackBufferTexture);
333 SafeRelease(mBackBufferRTView);
336 DXGI_SWAP_CHAIN_DESC desc;
337 mSwapChain->GetDesc(&desc);
338 const d3d11::TextureFormat &backbufferFormatInfo = d3d11::GetTextureFormatInfo(mBackBufferFormat);
339 HRESULT result = mSwapChain->ResizeBuffers(desc.BufferCount, backbufferWidth, backbufferHeight, backbufferFormatInfo.texFormat, 0);
343 ERR("Error resizing swap chain buffers: 0x%08X", result);
346 if (d3d11::isDeviceLostError(result))
348 return EGL_CONTEXT_LOST;
352 return EGL_BAD_ALLOC;
356 result = mSwapChain->GetBuffer(0, __uuidof(ID3D11Texture2D), (LPVOID*)&mBackBufferTexture);
357 ASSERT(SUCCEEDED(result));
358 if (SUCCEEDED(result))
360 d3d11::SetDebugName(mBackBufferTexture, "Back buffer texture");
363 result = device->CreateRenderTargetView(mBackBufferTexture, NULL, &mBackBufferRTView);
364 ASSERT(SUCCEEDED(result));
365 if (SUCCEEDED(result))
367 d3d11::SetDebugName(mBackBufferRTView, "Back buffer render target");
370 return resetOffscreenTexture(backbufferWidth, backbufferHeight);
373 EGLint SwapChain11::reset(int backbufferWidth, int backbufferHeight, EGLint swapInterval)
375 ID3D11Device *device = mRenderer->getDevice();
379 return EGL_BAD_ACCESS;
382 // Release specific resources to free up memory for the new render target, while the
383 // old render target still exists for the purpose of preserving its contents.
384 SafeRelease(mSwapChain);
385 SafeRelease(mBackBufferTexture);
386 SafeRelease(mBackBufferRTView);
388 mSwapInterval = static_cast<unsigned int>(swapInterval);
389 if (mSwapInterval > 4)
391 // IDXGISwapChain::Present documentation states that valid sync intervals are in the [0,4] range
392 return EGL_BAD_PARAMETER;
395 // EGL allows creating a surface with 0x0 dimension, however, DXGI does not like 0x0 swapchains
396 if (backbufferWidth < 1 || backbufferHeight < 1)
398 releaseOffscreenTexture();
402 if (mNativeWindow.getNativeWindow())
404 const d3d11::TextureFormat &backbufferFormatInfo = d3d11::GetTextureFormatInfo(mBackBufferFormat);
406 HRESULT result = mNativeWindow.createSwapChain(device, mRenderer->getDxgiFactory(),
407 backbufferFormatInfo.texFormat,
408 backbufferWidth, backbufferHeight, &mSwapChain);
412 ERR("Could not create additional swap chains or offscreen surfaces: %08lX", result);
415 if (d3d11::isDeviceLostError(result))
417 return EGL_CONTEXT_LOST;
421 return EGL_BAD_ALLOC;
425 result = mSwapChain->GetBuffer(0, __uuidof(ID3D11Texture2D), (LPVOID*)&mBackBufferTexture);
426 ASSERT(SUCCEEDED(result));
427 d3d11::SetDebugName(mBackBufferTexture, "Back buffer texture");
429 result = device->CreateRenderTargetView(mBackBufferTexture, NULL, &mBackBufferRTView);
430 ASSERT(SUCCEEDED(result));
431 d3d11::SetDebugName(mBackBufferRTView, "Back buffer render target");
434 // If we are resizing the swap chain, we don't wish to recreate all the static resources
435 if (!mPassThroughResourcesInit)
437 mPassThroughResourcesInit = true;
438 initPassThroughResources();
441 return resetOffscreenTexture(backbufferWidth, backbufferHeight);
444 void SwapChain11::initPassThroughResources()
446 ID3D11Device *device = mRenderer->getDevice();
448 ASSERT(device != NULL);
450 // Make sure our resources are all not allocated, when we create
451 ASSERT(mQuadVB == NULL && mPassThroughSampler == NULL);
452 ASSERT(mPassThroughIL == NULL && mPassThroughVS == NULL && mPassThroughPS == NULL);
454 D3D11_BUFFER_DESC vbDesc;
455 vbDesc.ByteWidth = sizeof(d3d11::PositionTexCoordVertex) * 4;
456 vbDesc.Usage = D3D11_USAGE_DYNAMIC;
457 vbDesc.BindFlags = D3D11_BIND_VERTEX_BUFFER;
458 vbDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
459 vbDesc.MiscFlags = 0;
460 vbDesc.StructureByteStride = 0;
462 HRESULT result = device->CreateBuffer(&vbDesc, NULL, &mQuadVB);
463 ASSERT(SUCCEEDED(result));
464 d3d11::SetDebugName(mQuadVB, "Swap chain quad vertex buffer");
466 D3D11_SAMPLER_DESC samplerDesc;
467 samplerDesc.Filter = D3D11_FILTER_MIN_MAG_MIP_POINT;
468 samplerDesc.AddressU = D3D11_TEXTURE_ADDRESS_CLAMP;
469 samplerDesc.AddressV = D3D11_TEXTURE_ADDRESS_CLAMP;
470 samplerDesc.AddressW = D3D11_TEXTURE_ADDRESS_CLAMP;
471 samplerDesc.MipLODBias = 0.0f;
472 samplerDesc.MaxAnisotropy = 0;
473 samplerDesc.ComparisonFunc = D3D11_COMPARISON_NEVER;
474 samplerDesc.BorderColor[0] = 0.0f;
475 samplerDesc.BorderColor[1] = 0.0f;
476 samplerDesc.BorderColor[2] = 0.0f;
477 samplerDesc.BorderColor[3] = 0.0f;
478 samplerDesc.MinLOD = 0;
479 samplerDesc.MaxLOD = D3D11_FLOAT32_MAX;
481 result = device->CreateSamplerState(&samplerDesc, &mPassThroughSampler);
482 ASSERT(SUCCEEDED(result));
483 d3d11::SetDebugName(mPassThroughSampler, "Swap chain pass through sampler");
485 D3D11_INPUT_ELEMENT_DESC quadLayout[] =
487 { "POSITION", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0 },
488 { "TEXCOORD", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 8, D3D11_INPUT_PER_VERTEX_DATA, 0 },
491 result = device->CreateInputLayout(quadLayout, 2, g_VS_Passthrough2D, sizeof(g_VS_Passthrough2D), &mPassThroughIL);
492 ASSERT(SUCCEEDED(result));
493 d3d11::SetDebugName(mPassThroughIL, "Swap chain pass through layout");
495 result = device->CreateVertexShader(g_VS_Passthrough2D, sizeof(g_VS_Passthrough2D), NULL, &mPassThroughVS);
496 ASSERT(SUCCEEDED(result));
497 d3d11::SetDebugName(mPassThroughVS, "Swap chain pass through vertex shader");
499 result = device->CreatePixelShader(g_PS_PassthroughRGBA2D, sizeof(g_PS_PassthroughRGBA2D), NULL, &mPassThroughPS);
500 ASSERT(SUCCEEDED(result));
501 d3d11::SetDebugName(mPassThroughPS, "Swap chain pass through pixel shader");
504 // parameters should be validated/clamped by caller
505 EGLint SwapChain11::swapRect(EGLint x, EGLint y, EGLint width, EGLint height)
512 ID3D11Device *device = mRenderer->getDevice();
513 ID3D11DeviceContext *deviceContext = mRenderer->getDeviceContext();
516 D3D11_MAPPED_SUBRESOURCE mappedResource;
517 HRESULT result = deviceContext->Map(mQuadVB, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource);
520 return EGL_BAD_ACCESS;
523 d3d11::PositionTexCoordVertex *vertices = static_cast<d3d11::PositionTexCoordVertex*>(mappedResource.pData);
525 // Create a quad in homogeneous coordinates
526 float x1 = (x / float(mWidth)) * 2.0f - 1.0f;
527 float y1 = (y / float(mHeight)) * 2.0f - 1.0f;
528 float x2 = ((x + width) / float(mWidth)) * 2.0f - 1.0f;
529 float y2 = ((y + height) / float(mHeight)) * 2.0f - 1.0f;
531 float u1 = x / float(mWidth);
532 float v1 = y / float(mHeight);
533 float u2 = (x + width) / float(mWidth);
534 float v2 = (y + height) / float(mHeight);
536 d3d11::SetPositionTexCoordVertex(&vertices[0], x1, y1, u1, v1);
537 d3d11::SetPositionTexCoordVertex(&vertices[1], x1, y2, u1, v2);
538 d3d11::SetPositionTexCoordVertex(&vertices[2], x2, y1, u2, v1);
539 d3d11::SetPositionTexCoordVertex(&vertices[3], x2, y2, u2, v2);
541 deviceContext->Unmap(mQuadVB, 0);
543 static UINT stride = sizeof(d3d11::PositionTexCoordVertex);
544 static UINT startIdx = 0;
545 deviceContext->IASetVertexBuffers(0, 1, &mQuadVB, &stride, &startIdx);
548 deviceContext->OMSetDepthStencilState(NULL, 0xFFFFFFFF);
550 static const float blendFactor[4] = { 1.0f, 1.0f, 1.0f, 1.0f };
551 deviceContext->OMSetBlendState(NULL, blendFactor, 0xFFFFFFF);
553 deviceContext->RSSetState(NULL);
556 deviceContext->IASetInputLayout(mPassThroughIL);
557 deviceContext->IASetPrimitiveTopology(D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP);
558 deviceContext->VSSetShader(mPassThroughVS, NULL, 0);
559 deviceContext->PSSetShader(mPassThroughPS, NULL, 0);
560 deviceContext->GSSetShader(NULL, NULL, 0);
562 // Apply render targets
563 mRenderer->setOneTimeRenderTarget(mBackBufferRTView);
566 D3D11_VIEWPORT viewport;
567 viewport.TopLeftX = 0;
568 viewport.TopLeftY = 0;
569 viewport.Width = mWidth;
570 viewport.Height = mHeight;
571 viewport.MinDepth = 0.0f;
572 viewport.MaxDepth = 1.0f;
573 deviceContext->RSSetViewports(1, &viewport);
576 mRenderer->setShaderResource(gl::SAMPLER_PIXEL, 0, mOffscreenSRView);
577 deviceContext->PSSetSamplers(0, 1, &mPassThroughSampler);
580 deviceContext->Draw(4, 0);
582 #if ANGLE_VSYNC == ANGLE_DISABLED
583 result = mSwapChain->Present(0, 0);
585 result = mSwapChain->Present(mSwapInterval, 0);
588 if (result == DXGI_ERROR_DEVICE_REMOVED)
590 HRESULT removedReason = device->GetDeviceRemovedReason();
591 UNUSED_TRACE_VARIABLE(removedReason);
592 ERR("Present failed: the D3D11 device was removed: 0x%08X", removedReason);
593 return EGL_CONTEXT_LOST;
595 else if (result == DXGI_ERROR_DEVICE_RESET)
597 ERR("Present failed: the D3D11 device was reset from a bad command.");
598 return EGL_CONTEXT_LOST;
600 else if (FAILED(result))
602 ERR("Present failed with error code 0x%08X", result);
606 mRenderer->setShaderResource(gl::SAMPLER_PIXEL, 0, NULL);
608 mRenderer->unapplyRenderTargets();
609 mRenderer->markAllStateDirty();
614 ID3D11Texture2D *SwapChain11::getOffscreenTexture()
616 return mOffscreenTexture;
619 ID3D11RenderTargetView *SwapChain11::getRenderTarget()
621 return mOffscreenRTView;
624 ID3D11ShaderResourceView *SwapChain11::getRenderTargetShaderResource()
626 return mOffscreenSRView;
629 ID3D11DepthStencilView *SwapChain11::getDepthStencil()
631 return mDepthStencilDSView;
634 ID3D11ShaderResourceView * SwapChain11::getDepthStencilShaderResource()
636 return mDepthStencilSRView;
639 ID3D11Texture2D *SwapChain11::getDepthStencilTexture()
641 return mDepthStencilTexture;
644 SwapChain11 *SwapChain11::makeSwapChain11(SwapChain *swapChain)
646 ASSERT(HAS_DYNAMIC_TYPE(rx::SwapChain11*, swapChain));
647 return static_cast<rx::SwapChain11*>(swapChain);
650 void SwapChain11::recreate()
652 // possibly should use this method instead of reset