BsGpuParamDesc.h 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. //********************************** Banshee Engine (www.banshee3d.com) **************************************************//
  2. //**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
  3. #pragma once
  4. #include "BsCorePrerequisites.h"
  5. namespace bs
  6. {
  7. /** @addtogroup RenderAPI
  8. * @{
  9. */
  10. /** Describes a single GPU program data (for example int, float, Vector2) parameter. */
  11. struct GpuParamDataDesc
  12. {
  13. String name;
  14. UINT32 elementSize; /**< In multiples of 4 bytes. */
  15. UINT32 arraySize;
  16. UINT32 arrayElementStride; /**< In multiples of 4 bytes. */
  17. GpuParamDataType type;
  18. UINT32 paramBlockSlot;
  19. UINT32 paramBlockSet;
  20. UINT32 gpuMemOffset; /**< In multiples of 4 bytes, or index for parameters not in a buffer. */
  21. UINT32 cpuMemOffset; /**< In multiples of 4 bytes. */
  22. };
  23. /** Describes a single GPU program object (for example texture, sampler state) parameter. */
  24. struct GpuParamObjectDesc
  25. {
  26. String name;
  27. GpuParamObjectType type;
  28. UINT32 slot; /** Slot within a set. Uniquely identifies bind location in the GPU pipeline, together with the set. */
  29. UINT32 set; /** Uniquely identifies the bind location in the GPU pipeline, together with the slot. */
  30. };
  31. /** Describes a GPU program parameter block (collection of GPU program data parameters). */
  32. struct GpuParamBlockDesc
  33. {
  34. String name;
  35. UINT32 slot; /** Slot within a set. Uniquely identifies bind location in the GPU pipeline, together with the set. */
  36. UINT32 set; /** Uniquely identifies the bind location in the GPU pipeline, together with the slot. */
  37. UINT32 blockSize; /**< In multiples of 4 bytes. */
  38. bool isShareable; /** True for blocks that can be shared between different GPU pipeline stages. */
  39. };
  40. /** Contains all parameter information for a GPU program, including data and object parameters, plus parameter blocks. */
  41. struct GpuParamDesc
  42. {
  43. Map<String, GpuParamBlockDesc> paramBlocks;
  44. Map<String, GpuParamDataDesc> params;
  45. Map<String, GpuParamObjectDesc> samplers;
  46. Map<String, GpuParamObjectDesc> textures;
  47. Map<String, GpuParamObjectDesc> loadStoreTextures;
  48. Map<String, GpuParamObjectDesc> buffers;
  49. };
  50. /** @} */
  51. }