CmGpuProgramManager.h 3.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. /*
  2. -----------------------------------------------------------------------------
  3. This source file is part of OGRE
  4. (Object-oriented Graphics Rendering Engine)
  5. For the latest info, see http://www.ogre3d.org/
  6. Copyright (c) 2000-2011 Torus Knot Software Ltd
  7. Permission is hereby granted, free of charge, to any person obtaining a copy
  8. of this software and associated documentation files (the "Software"), to deal
  9. in the Software without restriction, including without limitation the rights
  10. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  11. copies of the Software, and to permit persons to whom the Software is
  12. furnished to do so, subject to the following conditions:
  13. The above copyright notice and this permission notice shall be included in
  14. all copies or substantial portions of the Software.
  15. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  16. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  17. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  18. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  19. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  20. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  21. THE SOFTWARE.
  22. -----------------------------------------------------------------------------
  23. */
  24. #ifndef __GpuProgramManager_H_
  25. #define __GpuProgramManager_H_
  26. // Precompiler options
  27. #include "CmPrerequisites.h"
  28. #include "CmException.h"
  29. #include "CmGpuProgram.h"
  30. #include "CmModule.h"
  31. namespace CamelotFramework {
  32. /** \addtogroup Core
  33. * @{
  34. */
  35. /** \addtogroup Resources
  36. * @{
  37. */
  38. class CM_EXPORT GpuProgramManager : public Module<GpuProgramManager>
  39. {
  40. public:
  41. typedef Set<String>::type SyntaxCodes;
  42. protected:
  43. /** General create method
  44. */
  45. virtual GpuProgramPtr create(const String& source, const String& entryPoint, const String& language, GpuProgramType gptype, GpuProgramProfile profile) = 0;
  46. public:
  47. GpuProgramManager();
  48. virtual ~GpuProgramManager();
  49. /** Returns the syntaxes that this manager supports. */
  50. virtual const SyntaxCodes& getSupportedSyntax(void) const;
  51. /** Returns whether a given syntax code (e.g. "ps_1_3", "fp20", "arbvp1") is supported. */
  52. virtual bool isSyntaxSupported(const String& syntaxCode) const;
  53. /** Converts a generic GpuProgramProfile identifier into a render-system specific one.
  54. *
  55. * Returns an empty string if it can't convert it.
  56. */
  57. virtual String gpuProgProfileToRSSpecificProfile(GpuProgramProfile gpuProgProfile) const;
  58. /** Create a GPU program from a string of assembly code.
  59. @remarks
  60. Use this method in preference to the 'load' methods if you wish to define
  61. a GpuProgram, but not load it yet; useful for saving memory.
  62. @par
  63. The assembly code must be compatible with this manager - call the
  64. getSupportedSyntax method for details of the supported syntaxes
  65. @param name The identifying name to give this program, which can be used to
  66. retrieve this program later with getByName.
  67. @param groupName The name of the resource group
  68. @param code A string of assembly code which will form the program to run
  69. @param gptype The type of program to create.
  70. @param syntaxCode The name of the syntax to be used for this program e.g. arbvp1, vs_1_1
  71. */
  72. GpuProgramPtr createProgram(const String& source, const String& entryPoint, const String& language, GpuProgramType gptype, GpuProgramProfile profile);
  73. };
  74. /** @} */
  75. /** @} */
  76. }
  77. #endif