2
0

CmD3D11TextureManager.cpp 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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. TexturePtr D3D11TextureManager::createTextureImpl()
  15. {
  16. return TexturePtr(new D3D11Texture());
  17. }
  18. RenderTexturePtr D3D11TextureManager::createRenderTextureImpl()
  19. {
  20. return RenderTexturePtr(new D3D11RenderTexture());
  21. }
  22. MultiRenderTexturePtr D3D11TextureManager::createMultiRenderTextureImpl()
  23. {
  24. return MultiRenderTexturePtr(new D3D11MultiRenderTexture());
  25. }
  26. PixelFormat D3D11TextureManager::getNativeFormat(TextureType ttype, PixelFormat format, int usage)
  27. {
  28. // Basic filtering
  29. DXGI_FORMAT d3dPF = D3D11Mappings::_getPF(D3D11Mappings::_getClosestSupportedPF(format));
  30. return D3D11Mappings::_getPF(d3dPF);
  31. }
  32. bool D3D11TextureManager::isHardwareFilteringSupported(TextureType ttype, PixelFormat format, int usage,
  33. bool preciseFormatOnly)
  34. {
  35. if (!preciseFormatOnly)
  36. format = getNativeFormat(ttype, format, usage);
  37. D3D11RenderSystem* rs = static_cast<D3D11RenderSystem*>(RenderSystem::instancePtr());
  38. return rs->checkTextureFilteringSupported(ttype, format, usage);
  39. }
  40. }