CmGpuProgramManager.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. #pragma once
  2. #include "CmPrerequisites.h"
  3. #include "CmException.h"
  4. #include "CmGpuProgram.h"
  5. #include "CmModule.h"
  6. namespace BansheeEngine
  7. {
  8. /**
  9. * @brief Handles creation of GPU programs for a specific language. Program source
  10. * will be parses and a usable GPU program which you may bind to the pipeline
  11. * will be returned.
  12. */
  13. class CM_EXPORT GpuProgramManager : public Module<GpuProgramManager>
  14. {
  15. public:
  16. GpuProgramManager();
  17. virtual ~GpuProgramManager();
  18. /**
  19. * @brief Converts a generic GpuProgramProfile identifier into a render-system specific one.
  20. * Obviously this depends on the currently set render system.
  21. * Returns an empty string if conversion can't be done.
  22. */
  23. virtual String gpuProgProfileToRSSpecificProfile(GpuProgramProfile gpuProgProfile) const;
  24. /** Create a GPU program from a string of assembly code.
  25. @remarks
  26. Use this method in preference to the 'load' methods if you wish to define
  27. a GpuProgram, but not load it yet; useful for saving memory.
  28. @par
  29. The assembly code must be compatible with this manager - call the
  30. getSupportedSyntax method for details of the supported syntaxes
  31. @param name The identifying name to give this program, which can be used to
  32. retrieve this program later with getByName.
  33. @param groupName The name of the resource group
  34. @param code A string of assembly code which will form the program to run
  35. @param gptype The type of program to create.
  36. @param syntaxCode The name of the syntax to be used for this program e.g. arbvp1, vs_1_1
  37. */
  38. GpuProgramPtr createProgram(const String& source, const String& entryPoint, GpuProgramType gptype, GpuProgramProfile profile);
  39. protected:
  40. /**
  41. * @brief Internal create method that you should override in GpuProgramManager implementation for a specific language.
  42. */
  43. virtual GpuProgramPtr create(const String& source, const String& entryPoint, GpuProgramType gptype, GpuProgramProfile profile) = 0;
  44. };
  45. }