MCPcopy Create free account
hub / github.com/NVIDIAGameWorks/HBAOPlus / AttachShader

Method AttachShader

src/GLSLProgram.h:124–150  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

122 }
123
124 static GLuint AttachShader(const GFSDK_SSAO_GLFunctions& GL, GLuint Program, GLenum ShaderType, const char *ShaderSource)
125 {
126 GLuint Shader = GL.glCreateShader(ShaderType);
127
128 const GLchar *VersionDirective = "#version";
129 if (!strncmp(ShaderSource, VersionDirective, strlen(VersionDirective)))
130 {
131 GL.glShaderSource(Shader, 1, &ShaderSource, 0);
132 }
133 else
134 {
135#if USE_GLES
136 const GLchar* ShaderVersion = GLSL_VERSION_300ES;
137#else
138 const GLchar* ShaderVersion = GLSL_VERSION_150;
139#endif
140 const GLchar* Strings[] = { ShaderVersion, ShaderSource };
141 GL.glShaderSource(Shader, SIZEOF_ARRAY(Strings), Strings, 0);
142 }
143
144 GL.glCompileShader(Shader);
145 CheckCompileError(GL, Shader);
146
147 GL.glAttachShader(Program, Shader);
148
149 return Shader;
150 }
151
152 GLuint CompileProgram(const GFSDK_SSAO_GLFunctions& GL, const char *pVertexShaderGLSL, const char *pFragmentShaderGLSL)
153 {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected