2
0

BsD3D11TextureManager.cpp 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. //__________________________ Banshee Project - A modern game development toolkit _________________________________//
  2. //_____________________________________ www.banshee-project.com __________________________________________________//
  3. //________________________ Copyright (c) 2014 Marko Pintera. All rights reserved. ________________________________//
  4. #include "BsD3D11TextureManager.h"
  5. #include "BsD3D11Texture.h"
  6. #include "BsD3D11RenderTexture.h"
  7. #include "BsD3D11Mappings.h"
  8. #include "BsD3D11RenderSystem.h"
  9. #include "BsD3D11MultiRenderTexture.h"
  10. namespace BansheeEngine
  11. {
  12. D3D11TextureManager::D3D11TextureManager()
  13. :TextureManager()
  14. { }
  15. D3D11TextureManager::~D3D11TextureManager()
  16. { }
  17. TexturePtr D3D11TextureManager::createTextureImpl()
  18. {
  19. D3D11Texture* tex = new (bs_alloc<D3D11Texture, PoolAlloc>()) D3D11Texture();
  20. return bs_core_ptr<D3D11Texture, PoolAlloc>(tex);
  21. }
  22. RenderTexturePtr D3D11TextureManager::createRenderTextureImpl()
  23. {
  24. D3D11RenderTexture* tex = new (bs_alloc<D3D11RenderTexture, PoolAlloc>()) D3D11RenderTexture();
  25. return bs_core_ptr<D3D11RenderTexture, PoolAlloc>(tex);
  26. }
  27. MultiRenderTexturePtr D3D11TextureManager::createMultiRenderTextureImpl()
  28. {
  29. D3D11MultiRenderTexture* tex = new (bs_alloc<D3D11MultiRenderTexture, PoolAlloc>()) D3D11MultiRenderTexture();
  30. return bs_core_ptr<D3D11MultiRenderTexture, PoolAlloc>(tex);
  31. }
  32. PixelFormat D3D11TextureManager::getNativeFormat(TextureType ttype, PixelFormat format, int usage, bool hwGamma)
  33. {
  34. // Basic filtering
  35. DXGI_FORMAT d3dPF = D3D11Mappings::getPF(D3D11Mappings::getClosestSupportedPF(format, hwGamma), hwGamma);
  36. return D3D11Mappings::getPF(d3dPF);
  37. }
  38. }