gfxD3D9TextureManager.h 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. //-----------------------------------------------------------------------------
  2. // Copyright (c) 2012 GarageGames, LLC
  3. //
  4. // Permission is hereby granted, free of charge, to any person obtaining a copy
  5. // of this software and associated documentation files (the "Software"), to
  6. // deal in the Software without restriction, including without limitation the
  7. // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
  8. // sell copies of the Software, and to permit persons to whom the Software is
  9. // furnished to do so, subject to the following conditions:
  10. //
  11. // The above copyright notice and this permission notice shall be included in
  12. // all copies or substantial portions of the Software.
  13. //
  14. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18. // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  19. // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
  20. // IN THE SOFTWARE.
  21. //-----------------------------------------------------------------------------
  22. #ifndef _GFXD3DTEXTUREMANAGER_H_
  23. #define _GFXD3DTEXTUREMANAGER_H_
  24. #include "gfx/D3D9/gfxD3D9TextureObject.h"
  25. #include "core/util/safeRelease.h"
  26. // #define D3D_TEXTURE_SPEW
  27. //*****************************************************************************
  28. // GFX D3D Texture Manager
  29. //*****************************************************************************
  30. class GFXD3D9TextureManager : public GFXTextureManager
  31. {
  32. friend class GFXD3D9TextureObject;
  33. U32 mAdapterIndex;
  34. public:
  35. GFXD3D9TextureManager( LPDIRECT3DDEVICE9 d3ddevice, U32 adapterIndex );
  36. virtual ~GFXD3D9TextureManager();
  37. protected:
  38. // GFXTextureManager
  39. GFXTextureObject *_createTextureObject( U32 height,
  40. U32 width,
  41. U32 depth,
  42. GFXFormat format,
  43. GFXTextureProfile *profile,
  44. U32 numMipLevels,
  45. bool forceMips = false,
  46. S32 antialiasLevel = 0,
  47. GFXTextureObject *inTex = NULL );
  48. bool _loadTexture(GFXTextureObject *texture, DDSFile *dds);
  49. bool _loadTexture(GFXTextureObject *texture, GBitmap *bmp);
  50. bool _loadTexture(GFXTextureObject *texture, void *raw);
  51. bool _refreshTexture(GFXTextureObject *texture);
  52. bool _freeTexture(GFXTextureObject *texture, bool zombify = false);
  53. private:
  54. U32 mCurTexSet[TEXTURE_STAGE_COUNT];
  55. LPDIRECT3DDEVICE9 mD3DDevice;
  56. D3DCAPS9 mDeviceCaps;
  57. void _innerCreateTexture(GFXD3D9TextureObject *obj, U32 height, U32 width,
  58. U32 depth, GFXFormat format, GFXTextureProfile *profile, U32 numMipLevels,
  59. bool forceMips = false, S32 antialiasLevel = 0);
  60. };
  61. #endif