BsD3D11RenderTexture.cpp 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. //********************************** Banshee Engine (www.banshee3d.com) **************************************************//
  2. //**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
  3. #include "BsD3D11RenderTexture.h"
  4. #include "BsD3D11TextureView.h"
  5. namespace bs
  6. {
  7. D3D11RenderTexture::D3D11RenderTexture(const RENDER_TEXTURE_DESC& desc)
  8. :RenderTexture(desc), mProperties(desc, false)
  9. {
  10. }
  11. namespace ct
  12. {
  13. D3D11RenderTexture::D3D11RenderTexture(const RENDER_TEXTURE_DESC& desc, UINT32 deviceIdx)
  14. :RenderTexture(desc, deviceIdx), mProperties(desc, false)
  15. {
  16. assert(deviceIdx == 0 && "Multiple GPUs not supported natively on DirectX 11.");
  17. }
  18. void D3D11RenderTexture::getCustomAttribute(const String& name, void* data) const
  19. {
  20. if(name == "RTV")
  21. {
  22. ID3D11RenderTargetView** rtvs = (ID3D11RenderTargetView**)data;
  23. for (UINT32 i = 0; i < BS_MAX_MULTIPLE_RENDER_TARGETS; ++i)
  24. {
  25. if (mColorSurfaces[i] == nullptr)
  26. continue;
  27. D3D11TextureView* textureView = static_cast<D3D11TextureView*>(mColorSurfaces[i].get());
  28. rtvs[i] = textureView->getRTV();
  29. }
  30. }
  31. else if(name == "DSV")
  32. {
  33. if (mDepthStencilSurface == nullptr)
  34. return;
  35. ID3D11DepthStencilView** dsv = (ID3D11DepthStencilView**)data;
  36. D3D11TextureView* depthStencilView = static_cast<D3D11TextureView*>(mDepthStencilSurface.get());
  37. *dsv = depthStencilView->getDSV(false);
  38. }
  39. else if (name == "RODSV")
  40. {
  41. if (mDepthStencilSurface == nullptr)
  42. return;
  43. ID3D11DepthStencilView** dsv = (ID3D11DepthStencilView**)data;
  44. D3D11TextureView* depthStencilView = static_cast<D3D11TextureView*>(mDepthStencilSurface.get());
  45. *dsv = depthStencilView->getDSV(true);
  46. }
  47. }
  48. }}