PVRTShader.h 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. /******************************************************************************
  2. @File PVRTShader.h
  3. @Title OGLES2/PVRTShader
  4. @Version
  5. @Copyright Copyright (C) Imagination Technologies Limited.
  6. @Platform ANSI compatible
  7. @Description Shader handling for OpenGL ES 2.0
  8. ******************************************************************************/
  9. #ifndef _PVRTSHADER_H_
  10. #define _PVRTSHADER_H_
  11. #include "PVRTContext.h"
  12. #include "../PVRTString.h"
  13. #include "../PVRTError.h"
  14. /*!***************************************************************************
  15. @Function PVRTShaderLoadSourceFromMemory
  16. @Input pszShaderCode shader source code
  17. @Input Type type of shader (GL_VERTEX_SHADER or GL_FRAGMENT_SHADER)
  18. @Output pObject the resulting shader object
  19. @Output pReturnError the error message if it failed
  20. @Input aszDefineArray Array of defines to be pre-appended to shader string
  21. @Input uiDefArraySize Size of the define array
  22. @Return PVR_SUCCESS on success and PVR_FAIL on failure (also fills the str string)
  23. @Description Loads a shader source code into memory and compiles it.
  24. It also pre-appends the array of defines that have been passed in
  25. to the source code before compilation.
  26. *****************************************************************************/
  27. EPVRTError PVRTShaderLoadSourceFromMemory( const char* pszShaderCode,
  28. const GLenum Type,
  29. GLuint* const pObject,
  30. CPVRTString* const pReturnError,
  31. const char* const* aszDefineArray=0, GLuint uiDefArraySize=0);
  32. /*!***************************************************************************
  33. @Function PVRTShaderLoadBinaryFromMemory
  34. @Input ShaderData shader compiled binary data
  35. @Input Size size of shader binary data in bytes
  36. @Input Type type of shader (GL_VERTEX_SHADER or GL_FRAGMENT_SHADER)
  37. @Input Format shader binary format
  38. @Output pObject the resulting shader object
  39. @Output pReturnError the error message if it failed
  40. @Return PVR_SUCCESS on success and PVR_FAIL on failure (also fills the str string)
  41. @Description Takes a shader binary from memory and passes it to the GL.
  42. *****************************************************************************/
  43. EPVRTError PVRTShaderLoadBinaryFromMemory( const void* const ShaderData,
  44. const size_t Size,
  45. const GLenum Type,
  46. const GLenum Format,
  47. GLuint* const pObject,
  48. CPVRTString* const pReturnError);
  49. /*!***************************************************************************
  50. @Function PVRTShaderLoadFromFile
  51. @Input pszBinFile binary shader filename
  52. @Input pszSrcFile source shader filename
  53. @Input Type type of shader (GL_VERTEX_SHADER or GL_FRAGMENT_SHADER)
  54. @Input Format shader binary format, or 0 for source shader
  55. @Output pObject the resulting shader object
  56. @Output pReturnError the error message if it failed
  57. @Input pContext Context
  58. @Input aszDefineArray Array of defines to be pre-appended to shader string
  59. @Input uiDefArraySize Size of the define array
  60. @Return PVR_SUCCESS on success and PVR_FAIL on failure (also fills pReturnError)
  61. @Description Loads a shader file into memory and passes it to the GL.
  62. It also passes defines that need to be pre-appended to the shader before compilation.
  63. *****************************************************************************/
  64. EPVRTError PVRTShaderLoadFromFile( const char* const pszBinFile,
  65. const char* const pszSrcFile,
  66. const GLenum Type,
  67. const GLenum Format,
  68. GLuint* const pObject,
  69. CPVRTString* const pReturnError,
  70. const SPVRTContext* const pContext=0,
  71. const char* const* aszDefineArray=0, GLuint uiDefArraySize=0);
  72. /*!***************************************************************************
  73. @Function PVRTCreateProgram
  74. @Output pProgramObject the created program object
  75. @Input VertexShader the vertex shader to link
  76. @Input FragmentShader the fragment shader to link
  77. @Input pszAttribs an array of attribute names
  78. @Input i32NumAttribs the number of attributes to bind
  79. @Output pReturnError the error message if it failed
  80. @Returns PVR_SUCCESS on success, PVR_FAIL if failure
  81. @Description Links a shader program.
  82. *****************************************************************************/
  83. EPVRTError PVRTCreateProgram( GLuint* const pProgramObject,
  84. const GLuint VertexShader,
  85. const GLuint FragmentShader,
  86. const char** const pszAttribs,
  87. const int i32NumAttribs,
  88. CPVRTString* const pReturnError);
  89. #endif
  90. /*****************************************************************************
  91. End of file (PVRTShader.h)
  92. *****************************************************************************/