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