CmD3D11TextureManager.cpp 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. #include "CmD3D11TextureManager.h"
  2. #include "CmD3D11Texture.h"
  3. #include "CmD3D11RenderTexture.h"
  4. #include "CmD3D11Mappings.h"
  5. #include "CmD3D11RenderSystem.h"
  6. #include "CmD3D11MultiRenderTexture.h"
  7. namespace CamelotEngine
  8. {
  9. D3D11TextureManager::D3D11TextureManager()
  10. :TextureManager()
  11. { }
  12. D3D11TextureManager::~D3D11TextureManager()
  13. { }
  14. Texture* D3D11TextureManager::createTextureImpl()
  15. {
  16. return new D3D11Texture();
  17. }
  18. RenderTexture* D3D11TextureManager::createRenderTextureImpl()
  19. {
  20. return new D3D11RenderTexture();
  21. }
  22. MultiRenderTexturePtr D3D11TextureManager::createMultiRenderTexture()
  23. {
  24. D3D11MultiRenderTexture* newMRT = new D3D11MultiRenderTexture();
  25. newMRT->initialize();
  26. return MultiRenderTexturePtr(newMRT);
  27. }
  28. PixelFormat D3D11TextureManager::getNativeFormat(TextureType ttype, PixelFormat format, int usage)
  29. {
  30. // Basic filtering
  31. DXGI_FORMAT d3dPF = D3D11Mappings::_getPF(D3D11Mappings::_getClosestSupportedPF(format));
  32. return D3D11Mappings::_getPF(d3dPF);
  33. }
  34. bool D3D11TextureManager::isHardwareFilteringSupported(TextureType ttype, PixelFormat format, int usage,
  35. bool preciseFormatOnly)
  36. {
  37. if (!preciseFormatOnly)
  38. format = getNativeFormat(ttype, format, usage);
  39. D3D11RenderSystem* rs = static_cast<D3D11RenderSystem*>(RenderSystem::instancePtr());
  40. return rs->checkTextureFilteringSupported(ttype, format, usage);
  41. }
  42. }