CmD3D11TextureManager.cpp 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #include "CmD3D11TextureManager.h"
  2. #include "CmD3D11Texture.h"
  3. #include "CmD3D11Mappings.h"
  4. #include "CmD3D11RenderSystem.h"
  5. #include "CmD3D11DepthStencilBuffer.h"
  6. namespace CamelotEngine
  7. {
  8. D3D11TextureManager::D3D11TextureManager()
  9. :TextureManager()
  10. { }
  11. D3D11TextureManager::~D3D11TextureManager()
  12. { }
  13. Texture* D3D11TextureManager::createImpl()
  14. {
  15. return new D3D11Texture();
  16. }
  17. DepthStencilBufferPtr D3D11TextureManager::createDepthStencilBuffer(UINT32 bitDepth, UINT32 width,
  18. UINT32 height, UINT32 fsaa, const String& fsaaHint)
  19. {
  20. return DepthStencilBufferPtr(new D3D11DepthStencilBuffer(bitDepth, width, height, fsaa, fsaaHint));
  21. }
  22. PixelFormat D3D11TextureManager::getNativeFormat(TextureType ttype, PixelFormat format, int usage)
  23. {
  24. // Basic filtering
  25. DXGI_FORMAT d3dPF = D3D11Mappings::_getPF(D3D11Mappings::_getClosestSupportedPF(format));
  26. return D3D11Mappings::_getPF(d3dPF);
  27. }
  28. bool D3D11TextureManager::isHardwareFilteringSupported(TextureType ttype, PixelFormat format, int usage,
  29. bool preciseFormatOnly)
  30. {
  31. if (!preciseFormatOnly)
  32. format = getNativeFormat(ttype, format, usage);
  33. D3D11RenderSystem* rs = static_cast<D3D11RenderSystem*>(RenderSystem::instancePtr());
  34. return rs->checkTextureFilteringSupported(ttype, format, usage);
  35. }
  36. }