BsMaterialProxy.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  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. Vector<MaterialProxyPass> passes;
  67. Vector<GpuParamsPtr> params;
  68. ShaderProxyPtr shader;
  69. Vector<BufferBindInfo> rendererBuffers;
  70. };
  71. }