CmD3D11TextureManager.cpp 1.7 KB

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