diff --git a/engine/gl/gl_backend.c b/engine/gl/gl_backend.c index 70ca64d60..cae33f15e 100644 --- a/engine/gl/gl_backend.c +++ b/engine/gl/gl_backend.c @@ -940,7 +940,7 @@ void GLBE_SetupVAO(vbo_t *vbo, unsigned int vaodynamic, unsigned int vaostatic) } } -void GL_SelectProgram(int program) +void GL_SelectProgram(GLuint program) { if (shaderstate.currentprogram != program) { diff --git a/engine/gl/gl_vidcommon.c b/engine/gl/gl_vidcommon.c index b515b0dac..0b940e2be 100644 --- a/engine/gl/gl_vidcommon.c +++ b/engine/gl/gl_vidcommon.c @@ -84,11 +84,11 @@ void (APIENTRY *qglDeleteFramebuffersEXT)(GLsizei n, const GLuint* ids); void (APIENTRY *qglBindFramebufferEXT)(GLenum target, GLuint id); void (APIENTRY *qglDeleteRenderbuffersEXT)(GLsizei n, const GLuint* ids); void (APIENTRY *qglFramebufferTexture2DEXT)(GLenum target, GLenum attachmentPoint, GLenum textureTarget, GLuint textureId, GLint level); -FTEPFNGLVERTEXATTRIBPOINTER qglVertexAttribPointer; -FTEPFNGLVERTEXATTRIB4FARBPROC qglVertexAttrib4f; -FTEPFNGLGETVERTEXATTRIBIV qglGetVertexAttribiv; -FTEPFNGLENABLEVERTEXATTRIBARRAY qglEnableVertexAttribArray; -FTEPFNGLDISABLEVERTEXATTRIBARRAY qglDisableVertexAttribArray; +FTEPFNGLVERTEXATTRIBPOINTERPROC qglVertexAttribPointer; +FTEPFNGLVERTEXATTRIB4FPROC qglVertexAttrib4f; +FTEPFNGLGETVERTEXATTRIBIVPROC qglGetVertexAttribiv; +FTEPFNGLENABLEVERTEXATTRIBARRAYPROC qglEnableVertexAttribArray; +FTEPFNGLDISABLEVERTEXATTRIBARRAYPROC qglDisableVertexAttribArray; void (APIENTRY *qglStencilOpSeparate) (GLenum face, GLenum fail, GLenum zfail, GLenum zpass); void (APIENTRY *qglGetFramebufferAttachmentParameteriv)(GLenum target, GLenum attachment, GLenum pname, GLint * params); void (APIENTRY *qglGetVertexAttribPointerv) (GLuint index, GLenum pname, GLvoid* *pointer); @@ -99,35 +99,35 @@ BINDTEXFUNCPTR qglBindTexture; /*glslang - arb_shader_objects gl core uses different names/distinctions from the extension */ -FTEPFNGLCREATEPROGRAMOBJECTARBPROC qglCreateProgramObjectARB; -FTEPFNGLDELETEOBJECTARBPROC qglDeleteProgramObject_; -FTEPFNGLDELETEOBJECTARBPROC qglDeleteShaderObject_; -FTEPFNGLUSEPROGRAMOBJECTARBPROC qglUseProgramObjectARB; -FTEPFNGLCREATESHADEROBJECTARBPROC qglCreateShaderObjectARB; -FTEPFNGLSHADERSOURCEARBPROC qglShaderSourceARB; -FTEPFNGLCOMPILESHADERARBPROC qglCompileShaderARB; -FTEPFNGLGETOBJECTPARAMETERIVARBPROC qglGetShaderParameteriv_; -FTEPFNGLGETOBJECTPARAMETERIVARBPROC qglGetProgramParameteriv_; -FTEPFNGLATTACHOBJECTARBPROC qglAttachObjectARB; -FTEPFNGLGETINFOLOGARBPROC qglGetShaderInfoLog_; -FTEPFNGLGETINFOLOGARBPROC qglGetProgramInfoLog_; -FTEPFNGLLINKPROGRAMARBPROC qglLinkProgramARB; -FTEPFNGLBINDATTRIBLOCATIONARBPROC qglBindAttribLocationARB; -FTEPFNGLGETATTRIBLOCATIONARBPROC qglGetAttribLocationARB; -FTEPFNGLGETUNIFORMLOCATIONARBPROC qglGetUniformLocationARB; -FTEPFNGLUNIFORMMATRIXPROC qglUniformMatrix4fvARB; -FTEPFNGLUNIFORMMATRIXPROC qglUniformMatrix3fvARB; -FTEPFNGLUNIFORM4FARBPROC qglUniform4fARB; -FTEPFNGLUNIFORM4FVARBPROC qglUniform4fvARB; -FTEPFNGLUNIFORM3FARBPROC qglUniform3fARB; -FTEPFNGLUNIFORM3FVARBPROC qglUniform3fvARB; -FTEPFNGLUNIFORM4FVARBPROC qglUniform2fvARB; -FTEPFNGLUNIFORM1IARBPROC qglUniform1iARB; -FTEPFNGLUNIFORM1FARBPROC qglUniform1fARB; -FTEPFNGLGETSHADERSOURCEARBPROC qglGetShaderSource; +FTEPFNGLCREATEPROGRAMPROC qglCreateProgramObjectARB; +FTEPFNGLDELETEPROGRAMPROC qglDeleteProgramObject_; +FTEPFNGLDELETESHADERPROC qglDeleteShaderObject_; +FTEPFNGLUSEPROGRAMPROC qglUseProgramObjectARB; +FTEPFNGLCREATESHADERPROC qglCreateShaderObjectARB; +FTEPFNGLSHADERSOURCEPROC qglShaderSourceARB; +FTEPFNGLCOMPILESHADERPROC qglCompileShaderARB; +FTEPFNGLGETSHADERIVPROC qglGetShaderParameteriv_; +FTEPFNGLGETPROGRAMIVPROC qglGetProgramParameteriv_; +FTEPFNGLATTACHSHADERPROC qglAttachObjectARB; +FTEPFNGLGETSHADERINFOLOGPROC qglGetShaderInfoLog_; +FTEPFNGLGETPROGRAMINFOLOGPROC qglGetProgramInfoLog_; +FTEPFNGLLINKPROGRAMPROC qglLinkProgramARB; +FTEPFNGLBINDATTRIBLOCATIONPROC qglBindAttribLocationARB; +FTEPFNGLGETATTRIBLOCATIONPROC qglGetAttribLocationARB; +FTEPFNGLGETUNIFORMLOCATIONPROC qglGetUniformLocationARB; +FTEPFNGLUNIFORMMATRIX4FVPROC qglUniformMatrix4fvARB; +FTEPFNGLUNIFORMMATRIX3FVPROC qglUniformMatrix3fvARB; +FTEPFNGLUNIFORM4FPROC qglUniform4fARB; +FTEPFNGLUNIFORM4FVPROC qglUniform4fvARB; +FTEPFNGLUNIFORM3FPROC qglUniform3fARB; +FTEPFNGLUNIFORM3FVPROC qglUniform3fvARB; +FTEPFNGLUNIFORM4FVPROC qglUniform2fvARB; +FTEPFNGLUNIFORM1IPROC qglUniform1iARB; +FTEPFNGLUNIFORM1FPROC qglUniform1fARB; +FTEPFNGLGETSHADERSOURCEPROC qglGetShaderSource; #endif -FTEPFNGLUNIFORMMATRIXPROC qglUniformMatrix3x4fv; -FTEPFNGLUNIFORMMATRIXPROC qglUniformMatrix4x3fv; +FTEPFNGLUNIFORMMATRIX3X4FVPROC qglUniformMatrix3x4fv; +FTEPFNGLUNIFORMMATRIX4X3FVPROC qglUniformMatrix4x3fv; //GL_ARB_occlusion_query @@ -1120,7 +1120,9 @@ static qboolean GL_CheckExtensions (void *(*getglfunction) (char *name)) else Con_Printf(CON_ERROR"GL version specifies GLSL support, but GLSL functions are not available\n"); } - else if (GL_CheckExtension("GL_ARB_fragment_shader") +#ifdef GL_ARB_shader_objects + else if (sizeof(GLhandleARB) == sizeof(GLuint) //buggy when __APPLE__ is defined. + && GL_CheckExtension("GL_ARB_fragment_shader") && GL_CheckExtension("GL_ARB_vertex_shader") && GL_CheckExtension("GL_ARB_shader_objects")) { @@ -1162,6 +1164,7 @@ static qboolean GL_CheckExtensions (void *(*getglfunction) (char *name)) Con_DPrintf("GLSL available\n"); } +#endif #endif if (Cvar_Get("gl_blacklist_invariant", "0", CVAR_VIDEOLATCH, "gl blacklists")->ival) @@ -2245,9 +2248,9 @@ static qboolean GLSlang_GenerateIncludes(struct glslparts_s *glsl, const char *s // glslang helper api function definitions // type should be GL_FRAGMENT_SHADER_ARB or GL_VERTEX_SHADER_ARB //doesn't check to see if it was okay. use FinishShader for that. -static GLhandleARB GLSlang_CreateShader (program_t *prog, const char *name, int ver, const char **precompilerconstants, const char *shadersource, GLenum shadertype, qboolean silent) +static GLuint GLSlang_CreateShader (program_t *prog, const char *name, int ver, const char **precompilerconstants, const char *shadersource, GLenum shadertype, qboolean silent) { - GLhandleARB shader; + GLuint shader; int i; struct glslparts_s glsl; char verline[64]; @@ -2508,7 +2511,7 @@ static GLhandleARB GLSlang_CreateShader (program_t *prog, const char *name, int if (developer.ival) { - GLcharARB *combined; + GLchar *combined; int totallen = 1; for (i = 0; i < glsl.strings; i++) totallen += glsl.len[i] + 64 + (glsl.file[i]?strlen(glsl.file[i]):0); @@ -2540,7 +2543,7 @@ static GLhandleARB GLSlang_CreateShader (program_t *prog, const char *name, int totallen += glsl.len[i]; combined[totallen] = 0; } - qglShaderSourceARB(shader, 1, (const GLcharARB**)&combined, NULL); + qglShaderSourceARB(shader, 1, (const GLchar*const*)&combined, NULL); free(combined); } else if (gl_workaround_ati_shadersource.ival) @@ -2563,7 +2566,7 @@ static GLhandleARB GLSlang_CreateShader (program_t *prog, const char *name, int totallen += glsl.len[i]; combined[totallen] = 0; } - qglShaderSourceARB(shader, 1, (const GLcharARB**)&combined, NULL); + qglShaderSourceARB(shader, 1, (const GLcharARB*const*)&combined, NULL); free(combined); } else @@ -2575,7 +2578,7 @@ static GLhandleARB GLSlang_CreateShader (program_t *prog, const char *name, int //called after CreateShader. Checks for success. //Splitting creation allows for both vertex+fragment shaders to be processed simultaneously if the driver threads glCompileShaderARB. -static GLhandleARB GLSlang_FinishShader(GLhandleARB shader, const char *name, GLenum shadertype, qboolean *silent) +static GLuint GLSlang_FinishShader(GLuint shader, const char *name, GLenum shadertype, qboolean *silent) { GLint compiled; int loglen; @@ -2682,10 +2685,10 @@ static GLhandleARB GLSlang_FinishShader(GLhandleARB shader, const char *name, GL return shader; } -GLhandleARB GLSlang_CreateProgramObject (program_t *prog, const char *name, GLhandleARB vert, GLhandleARB cont, GLhandleARB eval, GLhandleARB geom, GLhandleARB frag) +GLuint GLSlang_CreateProgramObject (program_t *prog, const char *name, GLuint vert, GLuint cont, GLuint eval, GLuint geom, GLuint frag) { int i; - GLhandleARB program; + GLuint program; program = qglCreateProgramObjectARB(); if (vert) qglAttachObjectARB(program, vert); @@ -2729,7 +2732,7 @@ qboolean GLSlang_ValidateProgram(union programhandle_u *h, const char *name, qbo qglDeleteProgramObject_(h->glsl.handle); h->glsl.handle = 0; - return (GLhandleARB)0; + return false; } if (h->glsl.handle && blobfile && qglGetProgramBinary) @@ -2759,11 +2762,11 @@ qboolean GLSlang_ValidateProgram(union programhandle_u *h, const char *name, qbo union programhandle_u GLSlang_CreateProgram(program_t *prog, const char *name, int ver, const char **precompilerconstants, const char *vert, const char *cont, const char *eval, const char *geom, const char *frag, qboolean silent, vfsfile_t *blobfile) { union programhandle_u ret; - GLhandleARB vs; - GLhandleARB gs; - GLhandleARB fs; - GLhandleARB cs; - GLhandleARB es; + GLuint vs; + GLuint gs; + GLuint fs; + GLuint cs; + GLuint es; const char *nullconstants = NULL; memset(&ret, 0, sizeof(ret)); @@ -2862,7 +2865,7 @@ qboolean GLSlang_CreateProgramPermu(program_t *prog, struct programpermu_s *perm return false; } -GLint GLSlang_GetUniformLocation (int prog, char *name) +GLint GLSlang_GetUniformLocation (GLuint prog, char *name) { int i = qglGetUniformLocationARB(prog, name); if (i == -1) diff --git a/engine/gl/glquake.h b/engine/gl/glquake.h index 5b88ce1d6..6c9eaac7e 100644 --- a/engine/gl/glquake.h +++ b/engine/gl/glquake.h @@ -142,33 +142,39 @@ typedef void (APIENTRY *FTEPFNGLPNTRIANGLESIATIPROC)(GLenum pname, GLint param); typedef void (APIENTRY *FTEPFNGLPNTRIANGLESFATIPROC)(GLenum pname, GLfloat param); typedef void (APIENTRY *FTEPFNGLACTIVESTENCILFACEEXTPROC) (GLenum face); -typedef GLhandleARB (APIENTRYP FTEPFNGLCREATEPROGRAMOBJECTARBPROC) (void); -typedef void (APIENTRYP FTEPFNGLDELETEOBJECTARBPROC) (GLhandleARB obj); -typedef void (APIENTRYP FTEPFNGLUSEPROGRAMOBJECTARBPROC) (GLhandleARB programObj); -typedef GLhandleARB (APIENTRYP FTEPFNGLCREATESHADEROBJECTARBPROC) (GLenum shaderType); -typedef void (APIENTRYP FTEPFNGLSHADERSOURCEARBPROC) (GLhandleARB shaderObj, GLsizei count, const GLcharARB* *string, const GLint *length); -typedef void (APIENTRYP FTEPFNGLCOMPILESHADERARBPROC) (GLhandleARB shaderObj); -typedef void (APIENTRYP FTEPFNGLGETOBJECTPARAMETERIVARBPROC) (GLhandleARB obj, GLenum pname, GLint *params); -typedef void (APIENTRYP FTEPFNGLATTACHOBJECTARBPROC) (GLhandleARB containerObj, GLhandleARB obj); -typedef void (APIENTRYP FTEPFNGLGETINFOLOGARBPROC) (GLhandleARB obj, GLsizei maxLength, GLsizei *length, GLcharARB *infoLog); -typedef void (APIENTRYP FTEPFNGLLINKPROGRAMARBPROC) (GLhandleARB programObj); -typedef void (APIENTRYP FTEPFNGLBINDATTRIBLOCATIONARBPROC) (GLhandleARB programObj, GLuint index, GLcharARB *name); -typedef GLint (APIENTRYP FTEPFNGLGETATTRIBLOCATIONARBPROC) (GLhandleARB programObj, const GLcharARB *name); -typedef void (APIENTRYP FTEPFNGLVERTEXATTRIBPOINTER) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *pointer); -typedef void (APIENTRYP FTEPFNGLVERTEXATTRIB4FARBPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); -typedef void (APIENTRYP FTEPFNGLENABLEVERTEXATTRIBARRAY) (GLuint index); -typedef void (APIENTRYP FTEPFNGLDISABLEVERTEXATTRIBARRAY) (GLuint index); -typedef GLint (APIENTRYP FTEPFNGLGETUNIFORMLOCATIONARBPROC) (GLhandleARB programObj, const GLcharARB *name); -typedef void (APIENTRYP FTEPFNGLGETVERTEXATTRIBIV) (GLuint index, GLenum pname, GLint *params); -typedef void (APIENTRYP FTEPFNGLUNIFORM4FARBPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); -typedef void (APIENTRYP FTEPFNGLUNIFORMMATRIXPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void (APIENTRYP FTEPFNGLUNIFORM4FVARBPROC) (GLint location, GLsizei count, const GLfloat *value); -typedef void (APIENTRYP FTEPFNGLUNIFORM3FARBPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2); -typedef void (APIENTRYP FTEPFNGLUNIFORM3FVARBPROC) (GLint location, GLsizei count, const GLfloat *value); -typedef void (APIENTRYP FTEPFNGLUNIFORM2FVARBPROC) (GLint location, GLsizei count, const GLfloat *value); -typedef void (APIENTRYP FTEPFNGLUNIFORM1IARBPROC) (GLint location, GLint v0); -typedef void (APIENTRYP FTEPFNGLUNIFORM1FARBPROC) (GLint location, GLfloat v0); -typedef void (APIENTRYP FTEPFNGLGETSHADERSOURCEARBPROC) (GLhandleARB obj, GLsizei maxLength, GLsizei *length, GLcharARB *source); +typedef GLuint (APIENTRYP FTEPFNGLCREATEPROGRAMPROC) (void); +typedef void (APIENTRYP FTEPFNGLDELETEPROGRAMPROC) (GLuint obj); +typedef void (APIENTRYP FTEPFNGLDELETESHADERPROC) (GLuint obj); +typedef void (APIENTRYP FTEPFNGLUSEPROGRAMPROC) (GLuint programObj); +typedef GLuint (APIENTRYP FTEPFNGLCREATESHADERPROC) (GLenum shaderType); +typedef void (APIENTRYP FTEPFNGLSHADERSOURCEPROC) (GLuint shaderObj, GLsizei count, const GLchar* const*string, const GLint *length); +typedef void (APIENTRYP FTEPFNGLCOMPILESHADERPROC) (GLuint shaderObj); +typedef void (APIENTRYP FTEPFNGLGETPROGRAMIVPROC) (GLuint obj, GLenum pname, GLint *params); +typedef void (APIENTRYP FTEPFNGLGETSHADERIVPROC) (GLuint obj, GLenum pname, GLint *params); +typedef void (APIENTRYP FTEPFNGLATTACHSHADERPROC) (GLuint containerObj, GLuint obj); +typedef void (APIENTRYP FTEPFNGLGETPROGRAMINFOLOGPROC) (GLuint obj, GLsizei maxLength, GLsizei *length, GLchar *infoLog); +typedef void (APIENTRYP FTEPFNGLGETSHADERINFOLOGPROC) (GLuint obj, GLsizei maxLength, GLsizei *length, GLchar *infoLog); +typedef void (APIENTRYP FTEPFNGLLINKPROGRAMPROC) (GLuint programObj); +typedef void (APIENTRYP FTEPFNGLBINDATTRIBLOCATIONPROC) (GLuint programObj, GLuint index, const GLchar *name); +typedef GLint (APIENTRYP FTEPFNGLGETATTRIBLOCATIONPROC) (GLuint programObj, const GLchar *name); +typedef void (APIENTRYP FTEPFNGLVERTEXATTRIBPOINTERPROC) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *pointer); +typedef void (APIENTRYP FTEPFNGLVERTEXATTRIB4FPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +typedef void (APIENTRYP FTEPFNGLENABLEVERTEXATTRIBARRAYPROC) (GLuint index); +typedef void (APIENTRYP FTEPFNGLDISABLEVERTEXATTRIBARRAYPROC)(GLuint index); +typedef GLint (APIENTRYP FTEPFNGLGETUNIFORMLOCATIONPROC) (GLuint programObj, const GLchar *name); +typedef void (APIENTRYP FTEPFNGLGETVERTEXATTRIBIVPROC) (GLuint index, GLenum pname, GLint *params); +typedef void (APIENTRYP FTEPFNGLUNIFORM4FPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); +typedef void (APIENTRYP FTEPFNGLUNIFORMMATRIX4FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP FTEPFNGLUNIFORMMATRIX3FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP FTEPFNGLUNIFORMMATRIX4X3FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP FTEPFNGLUNIFORMMATRIX3X4FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP FTEPFNGLUNIFORM4FVPROC) (GLint location, GLsizei count, const GLfloat *value); +typedef void (APIENTRYP FTEPFNGLUNIFORM3FPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2); +typedef void (APIENTRYP FTEPFNGLUNIFORM3FVPROC) (GLint location, GLsizei count, const GLfloat *value); +typedef void (APIENTRYP FTEPFNGLUNIFORM2FVPROC) (GLint location, GLsizei count, const GLfloat *value); +typedef void (APIENTRYP FTEPFNGLUNIFORM1IPROC) (GLint location, GLint v0); +typedef void (APIENTRYP FTEPFNGLUNIFORM1FPROC) (GLint location, GLfloat v0); +typedef void (APIENTRYP FTEPFNGLGETSHADERSOURCEPROC) (GLuint obj, GLsizei maxLength, GLsizei *length, GLchar *source); typedef void (APIENTRY * FTEPFNGLLOCKARRAYSEXTPROC) (GLint first, GLsizei count); typedef void (APIENTRY * FTEPFNGLUNLOCKARRAYSEXTPROC) (void); @@ -664,36 +670,38 @@ extern GLenum (APIENTRY *qglCheckFramebufferStatusEXT)(GLenum target); extern void (APIENTRY *qglGetFramebufferAttachmentParameteriv)(GLenum target, GLenum attachment, GLenum pname, GLint * params); //glslang - arb_shader_objects -extern FTEPFNGLCREATEPROGRAMOBJECTARBPROC qglCreateProgramObjectARB; -extern FTEPFNGLDELETEOBJECTARBPROC qglDeleteProgramObject_; -extern FTEPFNGLDELETEOBJECTARBPROC qglDeleteShaderObject_; -extern FTEPFNGLUSEPROGRAMOBJECTARBPROC qglUseProgramObjectARB; -extern FTEPFNGLCREATESHADEROBJECTARBPROC qglCreateShaderObjectARB; -extern FTEPFNGLSHADERSOURCEARBPROC qglShaderSourceARB; -extern FTEPFNGLCOMPILESHADERARBPROC qglCompileShaderARB; -extern FTEPFNGLGETOBJECTPARAMETERIVARBPROC qglGetProgramParameteriv_; -extern FTEPFNGLGETOBJECTPARAMETERIVARBPROC qglGetShaderParameteriv_; -extern FTEPFNGLATTACHOBJECTARBPROC qglAttachObjectARB; -extern FTEPFNGLGETINFOLOGARBPROC qglGetProgramInfoLog_; -extern FTEPFNGLGETINFOLOGARBPROC qglGetShaderInfoLog_; -extern FTEPFNGLLINKPROGRAMARBPROC qglLinkProgramARB; -extern FTEPFNGLBINDATTRIBLOCATIONARBPROC qglBindAttribLocationARB; -extern FTEPFNGLGETATTRIBLOCATIONARBPROC qglGetAttribLocationARB; -extern FTEPFNGLGETUNIFORMLOCATIONARBPROC qglGetUniformLocationARB; -extern FTEPFNGLUNIFORMMATRIXPROC qglUniformMatrix4fvARB; -extern FTEPFNGLUNIFORMMATRIXPROC qglUniformMatrix3fvARB; -extern FTEPFNGLUNIFORM4FARBPROC qglUniform4fARB; -extern FTEPFNGLUNIFORM4FVARBPROC qglUniform4fvARB; -extern FTEPFNGLUNIFORM3FARBPROC qglUniform3fARB; -extern FTEPFNGLUNIFORM3FVARBPROC qglUniform3fvARB; -extern FTEPFNGLUNIFORM2FVARBPROC qglUniform2fvARB; -extern FTEPFNGLUNIFORM1IARBPROC qglUniform1iARB; -extern FTEPFNGLUNIFORM1FARBPROC qglUniform1fARB; -extern FTEPFNGLVERTEXATTRIB4FARBPROC qglVertexAttrib4f; -extern FTEPFNGLVERTEXATTRIBPOINTER qglVertexAttribPointer; -extern FTEPFNGLGETVERTEXATTRIBIV qglGetVertexAttribiv; -extern FTEPFNGLENABLEVERTEXATTRIBARRAY qglEnableVertexAttribArray; -extern FTEPFNGLDISABLEVERTEXATTRIBARRAY qglDisableVertexAttribArray; +extern FTEPFNGLCREATEPROGRAMPROC qglCreateProgramObjectARB; +extern FTEPFNGLDELETEPROGRAMPROC qglDeleteProgramObject_; +extern FTEPFNGLDELETESHADERPROC qglDeleteShaderObject_; +extern FTEPFNGLUSEPROGRAMPROC qglUseProgramObjectARB; +extern FTEPFNGLCREATESHADERPROC qglCreateShaderObjectARB; +extern FTEPFNGLSHADERSOURCEPROC qglShaderSourceARB; +extern FTEPFNGLCOMPILESHADERPROC qglCompileShaderARB; +extern FTEPFNGLGETPROGRAMIVPROC qglGetProgramParameteriv_; +extern FTEPFNGLGETSHADERIVPROC qglGetShaderParameteriv_; +extern FTEPFNGLATTACHSHADERPROC qglAttachObjectARB; +extern FTEPFNGLGETPROGRAMINFOLOGPROC qglGetProgramInfoLog_; +extern FTEPFNGLGETSHADERINFOLOGPROC qglGetShaderInfoLog_; +extern FTEPFNGLLINKPROGRAMPROC qglLinkProgramARB; +extern FTEPFNGLBINDATTRIBLOCATIONPROC qglBindAttribLocationARB; +extern FTEPFNGLGETATTRIBLOCATIONPROC qglGetAttribLocationARB; +extern FTEPFNGLGETUNIFORMLOCATIONPROC qglGetUniformLocationARB; +extern FTEPFNGLUNIFORMMATRIX4FVPROC qglUniformMatrix4fvARB; +extern FTEPFNGLUNIFORMMATRIX3FVPROC qglUniformMatrix3fvARB; +extern FTEPFNGLUNIFORMMATRIX4X3FVPROC qglUniformMatrix4x3fvARB; //gl2.1+ +extern FTEPFNGLUNIFORMMATRIX3X4FVPROC qglUniformMatrix3x4fvARB; //gl2.1+ +extern FTEPFNGLUNIFORM4FPROC qglUniform4fARB; +extern FTEPFNGLUNIFORM4FVPROC qglUniform4fvARB; +extern FTEPFNGLUNIFORM3FPROC qglUniform3fARB; +extern FTEPFNGLUNIFORM3FVPROC qglUniform3fvARB; +extern FTEPFNGLUNIFORM2FVPROC qglUniform2fvARB; +extern FTEPFNGLUNIFORM1IPROC qglUniform1iARB; +extern FTEPFNGLUNIFORM1FPROC qglUniform1fARB; +extern FTEPFNGLVERTEXATTRIB4FPROC qglVertexAttrib4f; +extern FTEPFNGLVERTEXATTRIBPOINTERPROC qglVertexAttribPointer; +extern FTEPFNGLGETVERTEXATTRIBIVPROC qglGetVertexAttribiv; +extern FTEPFNGLENABLEVERTEXATTRIBARRAYPROC qglEnableVertexAttribArray; +extern FTEPFNGLDISABLEVERTEXATTRIBARRAYPROC qglDisableVertexAttribArray; extern void (APIENTRY *qglGenBuffersARB)(GLsizei n, GLuint* ids); extern void (APIENTRY *qglDeleteBuffersARB)(GLsizei n, GLuint* ids); @@ -1000,8 +1008,8 @@ extern void (APIENTRY *qglTexSubImage3D) (GLenum target, GLint level, GLint xoff extern void (APIENTRY *qglTranslated) (GLdouble x, GLdouble y, GLdouble z); extern void (APIENTRY *qglTranslatef) (GLfloat x, GLfloat y, GLfloat z); -extern FTEPFNGLUNIFORMMATRIXPROC qglUniformMatrix4x3fv; -extern FTEPFNGLUNIFORMMATRIXPROC qglUniformMatrix3x4fv; +extern FTEPFNGLUNIFORMMATRIX4X3FVPROC qglUniformMatrix4x3fv; +extern FTEPFNGLUNIFORMMATRIX3X4FVPROC qglUniformMatrix3x4fv; extern FTEPFNGLCOMPRESSEDTEXIMAGE3DARBPROC qglCompressedTexImage3D; extern void (APIENTRY *qglCompressedTexSubImage3D) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *data); //gl1.3 @@ -1071,8 +1079,8 @@ extern void (APIENTRY *qglTexStorage3D)(GLenum target, GLsizei levels, GLenum in //glslang helper api struct programshared_s; union programhandle_u GLSlang_CreateProgram(struct programshared_s *prog, const char *name, int ver, const char **precompilerconstants, const char *vert, const char *cont, const char *eval, const char *geom, const char *frag, qboolean silent, vfsfile_t *blobfile); -GLint GLSlang_GetUniformLocation (int prog, char *name); -void GL_SelectProgram(int program); +GLint GLSlang_GetUniformLocation (GLuint prog, char *name); +void GL_SelectProgram(GLuint program); #define GLSlang_UseProgram(prog) GL_SelectProgram(prog) #define GLSlang_SetUniform1i(uni, parm0) qglUniform1iARB(uni, parm0) #define GLSlang_SetUniform1f(uni, parm0) qglUniform1fARB(uni, parm0) diff --git a/engine/gl/glsupp.h b/engine/gl/glsupp.h index e8f0e70ef..9296169c0 100644 --- a/engine/gl/glsupp.h +++ b/engine/gl/glsupp.h @@ -571,7 +571,11 @@ typedef GLboolean (APIENTRYP PFNGLISPROGRAMARBPROC) (GLuint program); #define GL_SAMPLER_2D_RECT_ARB 0x8B63 #define GL_SAMPLER_2D_RECT_SHADOW_ARB 0x8B64 // dont know if these two should go somewhere better: +#if 1//def __APPLE__ +typedef void *GLhandleARB; //Royally Fucked. +#else typedef unsigned int GLhandleARB; +#endif typedef char GLcharARB; typedef void (APIENTRYP PFNGLDELETEOBJECTARBPROC) (GLhandleARB obj); typedef GLhandleARB (APIENTRYP PFNGLGETHANDLEARBPROC) (GLenum pname); diff --git a/engine/gl/shader.h b/engine/gl/shader.h index 6856d44fd..66b16ca73 100644 --- a/engine/gl/shader.h +++ b/engine/gl/shader.h @@ -502,7 +502,7 @@ struct programpermu_s #ifdef GLQUAKE struct { - int handle; + unsigned int handle; qboolean usetesselation; } glsl; #endif