BsMaterialProxy.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. #pragma once
  2. #include "BsCorePrerequisites.h"
  3. namespace BansheeEngine
  4. {
  5. /**
  6. * @brief Contains data about a single pass in a material used by the
  7. * material proxy.
  8. */
  9. struct BS_CORE_EXPORT MaterialProxyPass
  10. {
  11. HGpuProgram vertexProg;
  12. HGpuProgram fragmentProg;
  13. HGpuProgram geometryProg;
  14. HGpuProgram hullProg;
  15. HGpuProgram domainProg;
  16. HGpuProgram computeProg;
  17. UINT32 vertexProgParamsIdx;
  18. UINT32 fragmentProgParamsIdx;
  19. UINT32 geometryProgParamsIdx;
  20. UINT32 hullProgParamsIdx;
  21. UINT32 domainProgParamsIdx;
  22. UINT32 computeProgParamsIdx;
  23. HBlendState blendState;
  24. HRasterizerState rasterizerState;
  25. HDepthStencilState depthStencilState;
  26. UINT32 stencilRefValue;
  27. };
  28. /**
  29. * @brief Contains material information as seen by the core thread.
  30. * (Used for rendering and such.)
  31. */
  32. struct BS_CORE_EXPORT MaterialProxy
  33. {
  34. /**
  35. * @brief Contains a hardware GPU parameter buffer and index of the parameters and the slot
  36. * it binds to in a material proxy.
  37. */
  38. struct BS_CORE_EXPORT BufferBindInfo
  39. {
  40. BufferBindInfo(UINT32 paramsIdx, UINT32 slotIdx, const GpuParamBlockBufferPtr& buffer)
  41. :paramsIdx(paramsIdx), slotIdx(slotIdx), buffer(buffer)
  42. { }
  43. UINT32 paramsIdx;
  44. UINT32 slotIdx;
  45. GpuParamBlockBufferPtr buffer;
  46. };
  47. /**
  48. * @brief Contains GPU parameters and index of the parameters it binds to in the material proxy.
  49. */
  50. struct BS_CORE_EXPORT ParamsBindInfo
  51. {
  52. // Note: Manually allocated. Must not have a constructor/destructor.
  53. UINT32 paramsIdx;
  54. GpuParamsPtr params;
  55. };
  56. /**
  57. * @brief Contains a set of GPU params that need updating on the core thread.
  58. */
  59. struct BS_CORE_EXPORT DirtyParamsInfo
  60. {
  61. // Note: Manually allocated. Must not have a constructor/destructor.
  62. ParamsBindInfo* entries;
  63. UINT32 numEntries;
  64. FrameAlloc* owner;
  65. /**
  66. * @brief Allocates and constructs a new object. You must release it
  67. * manually using the same frame allocator.
  68. */
  69. static DirtyParamsInfo* create(FrameAlloc* alloc, UINT32 numParams);
  70. /**
  71. * @brief Deallocates and destructs a previously allocated params info object.
  72. */
  73. static void destroy(DirtyParamsInfo* paramsInfo);
  74. };
  75. Vector<MaterialProxyPass> passes;
  76. Vector<GpuParamsPtr> params;
  77. ShaderProxyPtr shader;
  78. Vector<BufferBindInfo> rendererBuffers;
  79. };
  80. }