gfxD3D11PrimitiveBuffer.h 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. //-----------------------------------------------------------------------------
  2. // Copyright (c) 2015 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 _GFXD3D11PRIMITIVEBUFFER_H_
  23. #define _GFXD3D11PRIMITIVEBUFFER_H_
  24. #include "gfx/gfxPrimitiveBuffer.h"
  25. class GFXD3D11PrimitiveBuffer : public GFXPrimitiveBuffer
  26. {
  27. public:
  28. ID3D11Buffer *ib;
  29. StrongRefPtr<GFXD3D11PrimitiveBuffer> mVolatileBuffer;
  30. U32 mVolatileStart;
  31. U32 mIndexStart;
  32. U32 mIndexEnd;
  33. #ifdef TORQUE_DEBUG
  34. #define _PBGuardString "GFX_PRIMTIVE_BUFFER_GUARD_STRING"
  35. U8 *mDebugGuardBuffer;
  36. U32 mLockedSize;
  37. #endif TORQUE_DEBUG
  38. void *mLockedBuffer;
  39. bool mLocked;
  40. bool mIsFirstLock;
  41. GFXD3D11PrimitiveBuffer( GFXDevice *device,
  42. U32 indexCount,
  43. U32 primitiveCount,
  44. GFXBufferType bufferType );
  45. virtual ~GFXD3D11PrimitiveBuffer();
  46. virtual void lock(U32 indexStart, U32 indexEnd, void **indexPtr);
  47. virtual void unlock();
  48. virtual void prepare();
  49. // GFXResource interface
  50. virtual void zombify();
  51. virtual void resurrect();
  52. };
  53. inline GFXD3D11PrimitiveBuffer::GFXD3D11PrimitiveBuffer( GFXDevice *device,
  54. U32 indexCount,
  55. U32 primitiveCount,
  56. GFXBufferType bufferType )
  57. : GFXPrimitiveBuffer( device, indexCount, primitiveCount, bufferType )
  58. {
  59. mVolatileStart = 0;
  60. ib = NULL;
  61. mIsFirstLock = true;
  62. mLocked = false;
  63. #ifdef TORQUE_DEBUG
  64. mDebugGuardBuffer = NULL;
  65. mLockedSize = 0;
  66. #endif
  67. mIndexStart = 0;
  68. mIndexEnd = 0;
  69. mLockedBuffer = NULL;
  70. }
  71. #endif