OpenGL2: Require OpenGL 2.0.

This commit is contained in:
SmileTheory 2016-07-24 21:29:13 -07:00
parent ebc7894777
commit 251c983681
12 changed files with 302 additions and 619 deletions

View file

@ -377,102 +377,59 @@ extern void (APIENTRYP qglUnlockArraysEXT) (void);
#define qglVertexPointer glVertexPointer #define qglVertexPointer glVertexPointer
#define qglViewport glViewport #define qglViewport glViewport
// GL_EXT_draw_range_elements // OpenGL 1.2, was GL_EXT_draw_range_elements
extern void (APIENTRY * qglDrawRangeElementsEXT) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices); extern void (APIENTRY * qglDrawRangeElements) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices);
// GL_EXT_multi_draw_arrays // OpenGL 1.3, was GL_ARB_texture_compression
extern void (APIENTRY * qglMultiDrawArraysEXT) (GLenum mode, const GLint *first, const GLsizei *count, GLsizei primcount); extern void (APIENTRY * qglCompressedTexImage2D) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void *data);
extern void (APIENTRY * qglMultiDrawElementsEXT) (GLenum mode, const GLsizei *count, GLenum type, const GLvoid* *indices, GLsizei primcount); extern void (APIENTRY * qglCompressedTexSubImage2D) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *data);
// GL_ARB_shading_language_100 // OpenGL 1.4, was GL_EXT_multi_draw_arrays
#ifndef GL_ARB_shading_language_100 extern void (APIENTRY * qglMultiDrawElements) (GLenum mode, const GLsizei *count, GLenum type, const GLvoid* *indices, GLsizei primcount);
#define GL_ARB_shading_language_100
#define GL_SHADING_LANGUAGE_VERSION_ARB 0x8B8C
#endif
// GL_ARB_vertex_program // OpenGL 1.5, was GL_ARB_vertex_buffer_object and GL_ARB_occlusion_query
extern void (APIENTRY * qglVertexAttrib4fARB) (GLuint, GLfloat, GLfloat, GLfloat, GLfloat); extern void (APIENTRY * qglGenQueries) (GLsizei n, GLuint *ids);
extern void (APIENTRY * qglVertexAttrib4fvARB) (GLuint, const GLfloat *); extern void (APIENTRY * qglDeleteQueries) (GLsizei n, const GLuint *ids);
extern void (APIENTRY * qglVertexAttribPointerARB) (GLuint index, GLint size, GLenum type, GLboolean normalized, extern void (APIENTRY * qglBeginQuery) (GLenum target, GLuint id);
GLsizei stride, const GLvoid * pointer); extern void (APIENTRY * qglEndQuery) (GLenum target);
extern void (APIENTRY * qglEnableVertexAttribArrayARB) (GLuint index); extern void (APIENTRY * qglGetQueryObjectiv) (GLuint id, GLenum pname, GLint *params);
extern void (APIENTRY * qglDisableVertexAttribArrayARB) (GLuint index); extern void (APIENTRY * qglGetQueryObjectuiv) (GLuint id, GLenum pname, GLuint *params);
extern void (APIENTRY * qglBindBuffer) (GLenum target, GLuint buffer);
extern void (APIENTRY * qglDeleteBuffers) (GLsizei n, const GLuint *buffers);
extern void (APIENTRY * qglGenBuffers) (GLsizei n, GLuint *buffers);
extern void (APIENTRY * qglBufferData) (GLenum target, GLsizeiptr size, const void *data, GLenum usage);
extern void (APIENTRY * qglBufferSubData) (GLenum target, GLintptr offset, GLsizeiptr size, const void *data);
// GL_ARB_vertex_buffer_object // OpenGL 2.0, was GL_ARB_shading_language_100, GL_ARB_vertex_program, GL_ARB_shader_objects, and GL_ARB_vertex_shader
extern void (APIENTRY * qglBindBufferARB) (GLenum target, GLuint buffer); extern void (APIENTRY * qglAttachShader) (GLuint program, GLuint shader);
extern void (APIENTRY * qglDeleteBuffersARB) (GLsizei n, const GLuint * buffers); extern void (APIENTRY * qglBindAttribLocation) (GLuint program, GLuint index, const GLchar *name);
extern void (APIENTRY * qglGenBuffersARB) (GLsizei n, GLuint * buffers); extern void (APIENTRY * qglCompileShader) (GLuint shader);
extern GLboolean(APIENTRY * qglIsBufferARB) (GLuint buffer); extern GLuint (APIENTRY * qglCreateProgram) (void);
extern void (APIENTRY * qglBufferDataARB) (GLenum target, GLsizeiptrARB size, const GLvoid * data, GLenum usage); extern GLuint (APIENTRY * qglCreateShader) (GLenum type);
extern void (APIENTRY * qglBufferSubDataARB) (GLenum target, GLintptrARB offset, GLsizeiptrARB size, const GLvoid * data); extern void (APIENTRY * qglDeleteProgram) (GLuint program);
extern void (APIENTRY * qglGetBufferSubDataARB) (GLenum target, GLintptrARB offset, GLsizeiptrARB size, GLvoid * data); extern void (APIENTRY * qglDeleteShader) (GLuint shader);
extern void (APIENTRY * qglGetBufferParameterivARB) (GLenum target, GLenum pname, GLint * params); extern void (APIENTRY * qglDetachShader) (GLuint program, GLuint shader);
extern void (APIENTRY * qglGetBufferPointervARB) (GLenum target, GLenum pname, GLvoid * *params); extern void (APIENTRY * qglDisableVertexAttribArray) (GLuint index);
extern void (APIENTRY * qglEnableVertexAttribArray) (GLuint index);
// GL_ARB_shader_objects extern void (APIENTRY * qglGetActiveUniform) (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);
extern void (APIENTRY * qglDeleteObjectARB) (GLhandleARB obj); extern void (APIENTRY * qglGetProgramiv) (GLuint program, GLenum pname, GLint *params);
extern GLhandleARB(APIENTRY * qglGetHandleARB) (GLenum pname); extern void (APIENTRY * qglGetProgramInfoLog) (GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
extern void (APIENTRY * qglDetachObjectARB) (GLhandleARB containerObj, GLhandleARB attachedObj); extern void (APIENTRY * qglGetShaderiv) (GLuint shader, GLenum pname, GLint *params);
extern GLhandleARB(APIENTRY * qglCreateShaderObjectARB) (GLenum shaderType); extern void (APIENTRY * qglGetShaderInfoLog) (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
extern void (APIENTRY * qglShaderSourceARB) (GLhandleARB shaderObj, GLsizei count, const GLcharARB * *string, extern void (APIENTRY * qglGetShaderSource) (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source);
const GLint * length); extern GLint (APIENTRY * qglGetUniformLocation) (GLuint program, const GLchar *name);
extern void (APIENTRY * qglCompileShaderARB) (GLhandleARB shaderObj); extern void (APIENTRY * qglLinkProgram) (GLuint program);
extern GLhandleARB(APIENTRY * qglCreateProgramObjectARB) (void); extern void (APIENTRY * qglShaderSource) (GLuint shader, GLsizei count, const GLchar* *string, const GLint *length);
extern void (APIENTRY * qglAttachObjectARB) (GLhandleARB containerObj, GLhandleARB obj); extern void (APIENTRY * qglUseProgram) (GLuint program);
extern void (APIENTRY * qglLinkProgramARB) (GLhandleARB programObj); extern void (APIENTRY * qglUniform1f) (GLint location, GLfloat v0);
extern void (APIENTRY * qglUseProgramObjectARB) (GLhandleARB programObj); extern void (APIENTRY * qglUniform2f) (GLint location, GLfloat v0, GLfloat v1);
extern void (APIENTRY * qglValidateProgramARB) (GLhandleARB programObj); extern void (APIENTRY * qglUniform3f) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
extern void (APIENTRY * qglUniform1fARB) (GLint location, GLfloat v0); extern void (APIENTRY * qglUniform4f) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
extern void (APIENTRY * qglUniform2fARB) (GLint location, GLfloat v0, GLfloat v1); extern void (APIENTRY * qglUniform1i) (GLint location, GLint v0);
extern void (APIENTRY * qglUniform3fARB) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2); extern void (APIENTRY * qglUniform1fv) (GLint location, GLsizei count, const GLfloat *value);
extern void (APIENTRY * qglUniform4fARB) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); extern void (APIENTRY * qglUniformMatrix4fv) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
extern void (APIENTRY * qglUniform1iARB) (GLint location, GLint v0); extern void (APIENTRY * qglValidateProgram) (GLuint program);
extern void (APIENTRY * qglUniform2iARB) (GLint location, GLint v0, GLint v1); extern void (APIENTRY * qglVertexAttribPointer) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void *pointer);
extern void (APIENTRY * qglUniform3iARB) (GLint location, GLint v0, GLint v1, GLint v2);
extern void (APIENTRY * qglUniform4iARB) (GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
extern void (APIENTRY * qglUniform1fvARB) (GLint location, GLsizei count, const GLfloat * value);
extern void (APIENTRY * qglUniform2fvARB) (GLint location, GLsizei count, const GLfloat * value);
extern void (APIENTRY * qglUniform3fvARB) (GLint location, GLsizei count, const GLfloat * value);
extern void (APIENTRY * qglUniform4fvARB) (GLint location, GLsizei count, const GLfloat * value);
extern void (APIENTRY * qglUniform2ivARB) (GLint location, GLsizei count, const GLint * value);
extern void (APIENTRY * qglUniform3ivARB) (GLint location, GLsizei count, const GLint * value);
extern void (APIENTRY * qglUniform4ivARB) (GLint location, GLsizei count, const GLint * value);
extern void (APIENTRY * qglUniformMatrix2fvARB) (GLint location, GLsizei count, GLboolean transpose, const GLfloat * value);
extern void (APIENTRY * qglUniformMatrix3fvARB) (GLint location, GLsizei count, GLboolean transpose, const GLfloat * value);
extern void (APIENTRY * qglUniformMatrix4fvARB) (GLint location, GLsizei count, GLboolean transpose, const GLfloat * value);
extern void (APIENTRY * qglGetObjectParameterfvARB) (GLhandleARB obj, GLenum pname, GLfloat * params);
extern void (APIENTRY * qglGetObjectParameterivARB) (GLhandleARB obj, GLenum pname, GLint * params);
extern void (APIENTRY * qglGetInfoLogARB) (GLhandleARB obj, GLsizei maxLength, GLsizei * length, GLcharARB * infoLog);
extern void (APIENTRY * qglGetAttachedObjectsARB) (GLhandleARB containerObj, GLsizei maxCount, GLsizei * count,
GLhandleARB * obj);
extern GLint(APIENTRY * qglGetUniformLocationARB) (GLhandleARB programObj, const GLcharARB * name);
extern void (APIENTRY * qglGetActiveUniformARB) (GLhandleARB programObj, GLuint index, GLsizei maxIndex, GLsizei * length,
GLint * size, GLenum * type, GLcharARB * name);
extern void (APIENTRY * qglGetUniformfvARB) (GLhandleARB programObj, GLint location, GLfloat * params);
extern void (APIENTRY * qglGetUniformivARB) (GLhandleARB programObj, GLint location, GLint * params);
extern void (APIENTRY * qglGetShaderSourceARB) (GLhandleARB obj, GLsizei maxLength, GLsizei * length, GLcharARB * source);
// GL_ARB_vertex_shader
extern void (APIENTRY * qglBindAttribLocationARB) (GLhandleARB programObj, GLuint index, const GLcharARB * name);
extern void (APIENTRY * qglGetActiveAttribARB) (GLhandleARB programObj, GLuint index, GLsizei maxLength, GLsizei * length,
GLint * size, GLenum * type, GLcharARB * name);
extern GLint(APIENTRY * qglGetAttribLocationARB) (GLhandleARB programObj, const GLcharARB * name);
// GL_ARB_texture_compression
extern void (APIENTRY * qglCompressedTexImage3DARB)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height,
GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data);
extern void (APIENTRY * qglCompressedTexImage2DARB)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height,
GLint border, GLsizei imageSize, const GLvoid *data);
extern void (APIENTRY * qglCompressedTexImage1DARB)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border,
GLsizei imageSize, const GLvoid *data);
extern void (APIENTRY * qglCompressedTexSubImage3DARB)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset,
GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data);
extern void (APIENTRY * qglCompressedTexSubImage2DARB)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width,
GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data);
extern void (APIENTRY * qglCompressedTexSubImage1DARB)(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format,
GLsizei imageSize, const GLvoid *data);
extern void (APIENTRY * qglGetCompressedTexImageARB)(GLenum target, GLint lod,
GLvoid *img);
// GL_NVX_gpu_memory_info // GL_NVX_gpu_memory_info
#ifndef GL_NVX_gpu_memory_info #ifndef GL_NVX_gpu_memory_info
@ -609,25 +566,6 @@ extern void (APIENTRY * qglGenerateMipmapEXT)(GLenum target);
#define GL_TEXTURE_STENCIL_SIZE_EXT 0x88F1 #define GL_TEXTURE_STENCIL_SIZE_EXT 0x88F1
#endif #endif
// GL_ARB_occlusion_query
extern void (APIENTRY * qglGenQueriesARB)(GLsizei n, GLuint *ids);
extern void (APIENTRY * qglDeleteQueriesARB)(GLsizei n, const GLuint *ids);
extern GLboolean (APIENTRY * qglIsQueryARB)(GLuint id);
extern void (APIENTRY * qglBeginQueryARB)(GLenum target, GLuint id);
extern void (APIENTRY * qglEndQueryARB)(GLenum target);
extern void (APIENTRY * qglGetQueryivARB)(GLenum target, GLenum pname, GLint *params);
extern void (APIENTRY * qglGetQueryObjectivARB)(GLuint id, GLenum pname, GLint *params);
extern void (APIENTRY * qglGetQueryObjectuivARB)(GLuint id, GLenum pname, GLuint *params);
#ifndef GL_ARB_occlusion_query
#define GL_ARB_occlusion_query
#define GL_SAMPLES_PASSED_ARB 0x8914
#define GL_QUERY_COUNTER_BITS_ARB 0x8864
#define GL_CURRENT_QUERY_ARB 0x8865
#define GL_QUERY_RESULT_ARB 0x8866
#define GL_QUERY_RESULT_AVAILABLE_ARB 0x8867
#endif
// GL_EXT_framebuffer_blit // GL_EXT_framebuffer_blit
extern void (APIENTRY * qglBlitFramebufferEXT)(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, extern void (APIENTRY * qglBlitFramebufferEXT)(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1,

View file

@ -644,7 +644,7 @@ void RB_RenderDrawSurfList( drawSurf_t *drawSurfs, int numDrawSurfs ) {
} }
if (inQuery) { if (inQuery) {
qglEndQueryARB(GL_SAMPLES_PASSED_ARB); qglEndQuery(GL_SAMPLES_PASSED);
} }
if (glRefConfig.framebufferObject) if (glRefConfig.framebufferObject)
@ -1195,14 +1195,14 @@ const void *RB_DrawSurfs( const void *data ) {
if (glRefConfig.occlusionQuery) if (glRefConfig.occlusionQuery)
{ {
tr.sunFlareQueryActive[tr.sunFlareQueryIndex] = qtrue; tr.sunFlareQueryActive[tr.sunFlareQueryIndex] = qtrue;
qglBeginQueryARB(GL_SAMPLES_PASSED_ARB, tr.sunFlareQuery[tr.sunFlareQueryIndex]); qglBeginQuery(GL_SAMPLES_PASSED, tr.sunFlareQuery[tr.sunFlareQueryIndex]);
} }
RB_DrawSun(0.3, tr.sunFlareShader); RB_DrawSun(0.3, tr.sunFlareShader);
if (glRefConfig.occlusionQuery) if (glRefConfig.occlusionQuery)
{ {
qglEndQueryARB(GL_SAMPLES_PASSED_ARB); qglEndQuery(GL_SAMPLES_PASSED);
} }
FBO_Bind(oldFbo); FBO_Bind(oldFbo);

View file

@ -124,7 +124,7 @@ GLvoid APIENTRY GLDSA_CompressedTextureImage2D(GLuint texture, GLenum target, G
GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data) GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data)
{ {
GL_BindMultiTexture(glDsaState.texunit, target, texture); GL_BindMultiTexture(glDsaState.texunit, target, texture);
qglCompressedTexImage2DARB(target, level, internalformat, width, height, border, imageSize, data); qglCompressedTexImage2D(target, level, internalformat, width, height, border, imageSize, data);
} }
GLvoid APIENTRY GLDSA_CompressedTextureSubImage2D(GLuint texture, GLenum target, GLint level, GLvoid APIENTRY GLDSA_CompressedTextureSubImage2D(GLuint texture, GLenum target, GLint level,
@ -132,7 +132,7 @@ GLvoid APIENTRY GLDSA_CompressedTextureSubImage2D(GLuint texture, GLenum target,
GLsizei imageSize, const GLvoid *data) GLsizei imageSize, const GLvoid *data)
{ {
GL_BindMultiTexture(glDsaState.texunit, target, texture); GL_BindMultiTexture(glDsaState.texunit, target, texture);
qglCompressedTexSubImage2DARB(target, level, xoffset, yoffset, width, height, format, imageSize, data); qglCompressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, imageSize, data);
} }
GLvoid APIENTRY GLDSA_GenerateTextureMipmap(GLuint texture, GLenum target) GLvoid APIENTRY GLDSA_GenerateTextureMipmap(GLuint texture, GLenum target)
@ -143,66 +143,66 @@ GLvoid APIENTRY GLDSA_GenerateTextureMipmap(GLuint texture, GLenum target)
void GL_BindNullProgram() void GL_BindNullProgram()
{ {
qglUseProgramObjectARB(0); qglUseProgram(0);
glDsaState.program = 0; glDsaState.program = 0;
} }
int GL_UseProgramObject(GLuint program) int GL_UseProgram(GLuint program)
{ {
if (glDsaState.program == program) if (glDsaState.program == program)
return 0; return 0;
qglUseProgramObjectARB(program); qglUseProgram(program);
glDsaState.program = program; glDsaState.program = program;
return 1; return 1;
} }
GLvoid APIENTRY GLDSA_ProgramUniform1i(GLuint program, GLint location, GLint v0) GLvoid APIENTRY GLDSA_ProgramUniform1i(GLuint program, GLint location, GLint v0)
{ {
GL_UseProgramObject(program); GL_UseProgram(program);
qglUniform1iARB(location, v0); qglUniform1i(location, v0);
} }
GLvoid APIENTRY GLDSA_ProgramUniform1f(GLuint program, GLint location, GLfloat v0) GLvoid APIENTRY GLDSA_ProgramUniform1f(GLuint program, GLint location, GLfloat v0)
{ {
GL_UseProgramObject(program); GL_UseProgram(program);
qglUniform1fARB(location, v0); qglUniform1f(location, v0);
} }
GLvoid APIENTRY GLDSA_ProgramUniform2f(GLuint program, GLint location, GLvoid APIENTRY GLDSA_ProgramUniform2f(GLuint program, GLint location,
GLfloat v0, GLfloat v1) GLfloat v0, GLfloat v1)
{ {
GL_UseProgramObject(program); GL_UseProgram(program);
qglUniform2fARB(location, v0, v1); qglUniform2f(location, v0, v1);
} }
GLvoid APIENTRY GLDSA_ProgramUniform3f(GLuint program, GLint location, GLvoid APIENTRY GLDSA_ProgramUniform3f(GLuint program, GLint location,
GLfloat v0, GLfloat v1, GLfloat v2) GLfloat v0, GLfloat v1, GLfloat v2)
{ {
GL_UseProgramObject(program); GL_UseProgram(program);
qglUniform3fARB(location, v0, v1, v2); qglUniform3f(location, v0, v1, v2);
} }
GLvoid APIENTRY GLDSA_ProgramUniform4f(GLuint program, GLint location, GLvoid APIENTRY GLDSA_ProgramUniform4f(GLuint program, GLint location,
GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3) GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3)
{ {
GL_UseProgramObject(program); GL_UseProgram(program);
qglUniform4fARB(location, v0, v1, v2, v3); qglUniform4f(location, v0, v1, v2, v3);
} }
GLvoid APIENTRY GLDSA_ProgramUniform1fv(GLuint program, GLint location, GLvoid APIENTRY GLDSA_ProgramUniform1fv(GLuint program, GLint location,
GLsizei count, const GLfloat *value) GLsizei count, const GLfloat *value)
{ {
GL_UseProgramObject(program); GL_UseProgram(program);
qglUniform1fvARB(location, count, value); qglUniform1fv(location, count, value);
} }
GLvoid APIENTRY GLDSA_ProgramUniformMatrix4fv(GLuint program, GLint location, GLvoid APIENTRY GLDSA_ProgramUniformMatrix4fv(GLuint program, GLint location,
GLsizei count, GLboolean transpose, GLsizei count, GLboolean transpose,
const GLfloat *value) const GLfloat *value)
{ {
GL_UseProgramObject(program); GL_UseProgram(program);
qglUniformMatrix4fvARB(location, count, transpose, value); qglUniformMatrix4fv(location, count, transpose, value);
} }
void GL_BindNullFramebuffers() void GL_BindNullFramebuffers()

View file

@ -44,7 +44,7 @@ GLvoid APIENTRY GLDSA_CompressedTextureSubImage2D(GLuint texture, GLenum target,
GLvoid APIENTRY GLDSA_GenerateTextureMipmap(GLuint texture, GLenum target); GLvoid APIENTRY GLDSA_GenerateTextureMipmap(GLuint texture, GLenum target);
void GL_BindNullProgram(void); void GL_BindNullProgram(void);
int GL_UseProgramObject(GLuint program); int GL_UseProgram(GLuint program);
GLvoid APIENTRY GLDSA_ProgramUniform1i(GLuint program, GLint location, GLint v0); GLvoid APIENTRY GLDSA_ProgramUniform1i(GLuint program, GLint location, GLint v0);
GLvoid APIENTRY GLDSA_ProgramUniform1f(GLuint program, GLint location, GLfloat v0); GLvoid APIENTRY GLDSA_ProgramUniform1f(GLuint program, GLint location, GLfloat v0);

View file

@ -30,101 +30,59 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include "tr_local.h" #include "tr_local.h"
#include "tr_dsa.h" #include "tr_dsa.h"
// GL_EXT_draw_range_elements // OpenGL 1.2, was GL_EXT_draw_range_elements
void (APIENTRY * qglDrawRangeElementsEXT) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices); void (APIENTRY * qglDrawRangeElements) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices);
// GL_EXT_multi_draw_arrays // OpenGL 1.3, was GL_ARB_texture_compression
void (APIENTRY * qglMultiDrawArraysEXT) (GLenum mode, const GLint *first, const GLsizei *count, GLsizei primcount); void (APIENTRY * qglCompressedTexImage2D) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void *data);
void (APIENTRY * qglMultiDrawElementsEXT) (GLenum mode, const GLsizei *count, GLenum type, const GLvoid* *indices, GLsizei primcount); void (APIENTRY * qglCompressedTexSubImage2D) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *data);
// GL_ARB_vertex_shader // OpenGL 1.4, was GL_EXT_multi_draw_arrays
void (APIENTRY * qglBindAttribLocationARB) (GLhandleARB programObj, GLuint index, const GLcharARB * name); void (APIENTRY * qglMultiDrawElements) (GLenum mode, const GLsizei *count, GLenum type, const GLvoid* *indices, GLsizei primcount);
void (APIENTRY * qglGetActiveAttribARB) (GLhandleARB programObj, GLuint index, GLsizei maxLength, GLsizei * length,
GLint * size, GLenum * type, GLcharARB * name);
GLint(APIENTRY * qglGetAttribLocationARB) (GLhandleARB programObj, const GLcharARB * name);
// GL_ARB_vertex_program // OpenGL 1.5, previously GL_ARB_vertex_buffer_object
void (APIENTRY * qglVertexAttrib4fARB) (GLuint, GLfloat, GLfloat, GLfloat, GLfloat); void (APIENTRY * qglGenQueries) (GLsizei n, GLuint *ids);
void (APIENTRY * qglVertexAttrib4fvARB) (GLuint, const GLfloat *); void (APIENTRY * qglDeleteQueries) (GLsizei n, const GLuint *ids);
void (APIENTRY * qglVertexAttribPointerARB) (GLuint index, GLint size, GLenum type, GLboolean normalized, void (APIENTRY * qglBeginQuery) (GLenum target, GLuint id);
GLsizei stride, const GLvoid * pointer); void (APIENTRY * qglEndQuery) (GLenum target);
void (APIENTRY * qglEnableVertexAttribArrayARB) (GLuint index); void (APIENTRY * qglGetQueryObjectiv) (GLuint id, GLenum pname, GLint *params);
void (APIENTRY * qglDisableVertexAttribArrayARB) (GLuint index); void (APIENTRY * qglGetQueryObjectuiv) (GLuint id, GLenum pname, GLuint *params);
void (APIENTRY * qglBindBuffer) (GLenum target, GLuint buffer);
void (APIENTRY * qglDeleteBuffers) (GLsizei n, const GLuint *buffers);
void (APIENTRY * qglGenBuffers) (GLsizei n, GLuint *buffers);
void (APIENTRY * qglBufferData) (GLenum target, GLsizeiptr size, const void *data, GLenum usage);
void (APIENTRY * qglBufferSubData) (GLenum target, GLintptr offset, GLsizeiptr size, const void *data);
// GL_ARB_vertex_buffer_object // OpenGL 2.0, previously GL_ARB_shading_language_100, GL_ARB_vertex_program, GL_ARB_shader_objects, and GL_ARB_vertex_shader
void (APIENTRY * qglBindBufferARB) (GLenum target, GLuint buffer); void (APIENTRY * qglAttachShader) (GLuint program, GLuint shader);
void (APIENTRY * qglDeleteBuffersARB) (GLsizei n, const GLuint * buffers); void (APIENTRY * qglBindAttribLocation) (GLuint program, GLuint index, const GLchar *name);
void (APIENTRY * qglGenBuffersARB) (GLsizei n, GLuint * buffers); void (APIENTRY * qglCompileShader) (GLuint shader);
GLuint(APIENTRY * qglCreateProgram) (void);
GLboolean(APIENTRY * qglIsBufferARB) (GLuint buffer); GLuint(APIENTRY * qglCreateShader) (GLenum type);
void (APIENTRY * qglBufferDataARB) (GLenum target, GLsizeiptrARB size, const GLvoid * data, GLenum usage); void (APIENTRY * qglDeleteProgram) (GLuint program);
void (APIENTRY * qglBufferSubDataARB) (GLenum target, GLintptrARB offset, GLsizeiptrARB size, const GLvoid * data); void (APIENTRY * qglDeleteShader) (GLuint shader);
void (APIENTRY * qglGetBufferSubDataARB) (GLenum target, GLintptrARB offset, GLsizeiptrARB size, GLvoid * data); void (APIENTRY * qglDetachShader) (GLuint program, GLuint shader);
void (APIENTRY * qglDisableVertexAttribArray) (GLuint index);
void (APIENTRY * qglGetBufferParameterivARB) (GLenum target, GLenum pname, GLint * params); void (APIENTRY * qglEnableVertexAttribArray) (GLuint index);
void (APIENTRY * qglGetBufferPointervARB) (GLenum target, GLenum pname, GLvoid * *params); void (APIENTRY * qglGetActiveUniform) (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);
void (APIENTRY * qglGetProgramiv) (GLuint program, GLenum pname, GLint *params);
// GL_ARB_shader_objects void (APIENTRY * qglGetProgramInfoLog) (GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
void (APIENTRY * qglDeleteObjectARB) (GLhandleARB obj); void (APIENTRY * qglGetShaderiv) (GLuint shader, GLenum pname, GLint *params);
void (APIENTRY * qglGetShaderInfoLog) (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
GLhandleARB(APIENTRY * qglGetHandleARB) (GLenum pname); void (APIENTRY * qglGetShaderSource) (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source);
void (APIENTRY * qglDetachObjectARB) (GLhandleARB containerObj, GLhandleARB attachedObj); GLint(APIENTRY * qglGetUniformLocation) (GLuint program, const GLchar *name);
void (APIENTRY * qglLinkProgram) (GLuint program);
GLhandleARB(APIENTRY * qglCreateShaderObjectARB) (GLenum shaderType); void (APIENTRY * qglShaderSource) (GLuint shader, GLsizei count, const GLchar* *string, const GLint *length);
void (APIENTRY * qglShaderSourceARB) (GLhandleARB shaderObj, GLsizei count, const GLcharARB * *string, void (APIENTRY * qglUseProgram) (GLuint program);
const GLint * length); void (APIENTRY * qglUniform1f) (GLint location, GLfloat v0);
void (APIENTRY * qglCompileShaderARB) (GLhandleARB shaderObj); void (APIENTRY * qglUniform2f) (GLint location, GLfloat v0, GLfloat v1);
void (APIENTRY * qglUniform3f) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
GLhandleARB(APIENTRY * qglCreateProgramObjectARB) (void); void (APIENTRY * qglUniform4f) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
void (APIENTRY * qglAttachObjectARB) (GLhandleARB containerObj, GLhandleARB obj); void (APIENTRY * qglUniform1i) (GLint location, GLint v0);
void (APIENTRY * qglLinkProgramARB) (GLhandleARB programObj); void (APIENTRY * qglUniform1fv) (GLint location, GLsizei count, const GLfloat *value);
void (APIENTRY * qglUseProgramObjectARB) (GLhandleARB programObj); void (APIENTRY * qglUniformMatrix4fv) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
void (APIENTRY * qglValidateProgramARB) (GLhandleARB programObj); void (APIENTRY * qglValidateProgram) (GLuint program);
void (APIENTRY * qglUniform1fARB) (GLint location, GLfloat v0); void (APIENTRY * qglVertexAttribPointer) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void *pointer);
void (APIENTRY * qglUniform2fARB) (GLint location, GLfloat v0, GLfloat v1);
void (APIENTRY * qglUniform3fARB) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
void (APIENTRY * qglUniform4fARB) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
void (APIENTRY * qglUniform1iARB) (GLint location, GLint v0);
void (APIENTRY * qglUniform2iARB) (GLint location, GLint v0, GLint v1);
void (APIENTRY * qglUniform3iARB) (GLint location, GLint v0, GLint v1, GLint v2);
void (APIENTRY * qglUniform4iARB) (GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
void (APIENTRY * qglUniform1fvARB) (GLint location, GLsizei count, const GLfloat * value);
void (APIENTRY * qglUniform2fvARB) (GLint location, GLsizei count, const GLfloat * value);
void (APIENTRY * qglUniform3fvARB) (GLint location, GLsizei count, const GLfloat * value);
void (APIENTRY * qglUniform4fvARB) (GLint location, GLsizei count, const GLfloat * value);
void (APIENTRY * qglUniform2ivARB) (GLint location, GLsizei count, const GLint * value);
void (APIENTRY * qglUniform3ivARB) (GLint location, GLsizei count, const GLint * value);
void (APIENTRY * qglUniform4ivARB) (GLint location, GLsizei count, const GLint * value);
void (APIENTRY * qglUniformMatrix2fvARB) (GLint location, GLsizei count, GLboolean transpose, const GLfloat * value);
void (APIENTRY * qglUniformMatrix3fvARB) (GLint location, GLsizei count, GLboolean transpose, const GLfloat * value);
void (APIENTRY * qglUniformMatrix4fvARB) (GLint location, GLsizei count, GLboolean transpose, const GLfloat * value);
void (APIENTRY * qglGetObjectParameterfvARB) (GLhandleARB obj, GLenum pname, GLfloat * params);
void (APIENTRY * qglGetObjectParameterivARB) (GLhandleARB obj, GLenum pname, GLint * params);
void (APIENTRY * qglGetInfoLogARB) (GLhandleARB obj, GLsizei maxLength, GLsizei * length, GLcharARB * infoLog);
void (APIENTRY * qglGetAttachedObjectsARB) (GLhandleARB containerObj, GLsizei maxCount, GLsizei * count,
GLhandleARB * obj);
GLint(APIENTRY * qglGetUniformLocationARB) (GLhandleARB programObj, const GLcharARB * name);
void (APIENTRY * qglGetActiveUniformARB) (GLhandleARB programObj, GLuint index, GLsizei maxIndex, GLsizei * length,
GLint * size, GLenum * type, GLcharARB * name);
void (APIENTRY * qglGetUniformfvARB) (GLhandleARB programObj, GLint location, GLfloat * params);
void (APIENTRY * qglGetUniformivARB) (GLhandleARB programObj, GLint location, GLint * params);
void (APIENTRY * qglGetShaderSourceARB) (GLhandleARB obj, GLsizei maxLength, GLsizei * length, GLcharARB * source);
// GL_ARB_texture_compression
void (APIENTRY * qglCompressedTexImage3DARB)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height,
GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data);
void (APIENTRY * qglCompressedTexImage2DARB)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height,
GLint border, GLsizei imageSize, const GLvoid *data);
void (APIENTRY * qglCompressedTexImage1DARB)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border,
GLsizei imageSize, const GLvoid *data);
void (APIENTRY * qglCompressedTexSubImage3DARB)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset,
GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data);
void (APIENTRY * qglCompressedTexSubImage2DARB)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width,
GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data);
void (APIENTRY * qglCompressedTexSubImage1DARB)(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format,
GLsizei imageSize, const GLvoid *data);
void (APIENTRY * qglGetCompressedTexImageARB)(GLenum target, GLint lod,
GLvoid *img);
// GL_EXT_framebuffer_object // GL_EXT_framebuffer_object
GLboolean (APIENTRY * qglIsRenderbufferEXT)(GLuint renderbuffer); GLboolean (APIENTRY * qglIsRenderbufferEXT)(GLuint renderbuffer);
@ -157,16 +115,6 @@ void (APIENTRY * qglGetFramebufferAttachmentParameterivEXT)(GLenum target, GLenu
void (APIENTRY * qglGenerateMipmapEXT)(GLenum target); void (APIENTRY * qglGenerateMipmapEXT)(GLenum target);
// GL_ARB_occlusion_query
void (APIENTRY * qglGenQueriesARB)(GLsizei n, GLuint *ids);
void (APIENTRY * qglDeleteQueriesARB)(GLsizei n, const GLuint *ids);
GLboolean (APIENTRY * qglIsQueryARB)(GLuint id);
void (APIENTRY * qglBeginQueryARB)(GLenum target, GLuint id);
void (APIENTRY * qglEndQueryARB)(GLenum target);
void (APIENTRY * qglGetQueryivARB)(GLenum target, GLenum pname, GLint *params);
void (APIENTRY * qglGetQueryObjectivARB)(GLuint id, GLenum pname, GLint *params);
void (APIENTRY * qglGetQueryObjectuivARB)(GLuint id, GLenum pname, GLuint *params);
// GL_EXT_framebuffer_blit // GL_EXT_framebuffer_blit
void (APIENTRY * qglBlitFramebufferEXT)(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, void (APIENTRY * qglBlitFramebufferEXT)(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1,
@ -240,248 +188,80 @@ void GLimp_InitExtraExtensions()
char *extension; char *extension;
const char* result[3] = { "...ignoring %s\n", "...using %s\n", "...%s not found\n" }; const char* result[3] = { "...ignoring %s\n", "...using %s\n", "...%s not found\n" };
// GL_EXT_draw_range_elements sscanf(glConfig.version_string, "%d.%d", &glRefConfig.openglMajorVersion, &glRefConfig.openglMinorVersion);
extension = "GL_EXT_draw_range_elements"; if (glRefConfig.openglMajorVersion < 2)
glRefConfig.drawRangeElements = qfalse; ri.Error(ERR_FATAL, "OpenGL 2.0 required!");
qglMultiDrawArraysEXT = NULL; ri.Printf(PRINT_ALL, "...using OpenGL %s\n", glConfig.version_string);
qglMultiDrawElementsEXT = NULL;
if( GLimp_HaveExtension( extension ) )
{
qglDrawRangeElementsEXT = (void *) SDL_GL_GetProcAddress("glDrawRangeElementsEXT");
if ( r_ext_draw_range_elements->integer) // OpenGL 1.2, was GL_EXT_draw_range_elements
glRefConfig.drawRangeElements = qtrue; qglDrawRangeElements = (PFNGLDRAWRANGEELEMENTSPROC)SDL_GL_GetProcAddress("glDrawRangeElements");
glRefConfig.drawRangeElements = r_ext_draw_range_elements->integer ? qtrue : qfalse;
ri.Printf(PRINT_ALL, result[glRefConfig.drawRangeElements], "glDrawRangeElements()");
ri.Printf(PRINT_ALL, result[glRefConfig.drawRangeElements], extension); // OpenGL 1.3, was GL_ARB_texture_compression
} qglCompressedTexImage2D = (PFNGLCOMPRESSEDTEXIMAGE2DPROC) SDL_GL_GetProcAddress("glCompressedTexImage2D");
else qglCompressedTexSubImage2D = (PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC) SDL_GL_GetProcAddress("qglCompressedTexSubImage2D");
{
ri.Printf(PRINT_ALL, result[2], extension);
}
// GL_EXT_multi_draw_arrays // OpenGL 1.4, was GL_EXT_multi_draw_arrays
extension = "GL_EXT_multi_draw_arrays"; qglMultiDrawElements = (PFNGLMULTIDRAWELEMENTSPROC)SDL_GL_GetProcAddress("glMultiDrawElements");
glRefConfig.multiDrawArrays = qfalse; glRefConfig.drawRangeElements = r_ext_multi_draw_arrays->integer ? qtrue : qfalse;
qglMultiDrawArraysEXT = NULL; ri.Printf(PRINT_ALL, result[glRefConfig.drawRangeElements], "glMultiDrawElements()");
qglMultiDrawElementsEXT = NULL;
if( GLimp_HaveExtension( extension ) )
{
qglMultiDrawArraysEXT = (PFNGLMULTIDRAWARRAYSEXTPROC) SDL_GL_GetProcAddress("glMultiDrawArraysEXT");
qglMultiDrawElementsEXT = (PFNGLMULTIDRAWELEMENTSEXTPROC) SDL_GL_GetProcAddress("glMultiDrawElementsEXT");
if ( r_ext_multi_draw_arrays->integer ) // OpenGL 1.5, was GL_ARB_vertex_buffer_object and GL_ARB_occlusion_query
glRefConfig.multiDrawArrays = qtrue; qglGenQueries = (PFNGLGENQUERIESPROC) SDL_GL_GetProcAddress("glGenQueries");
qglDeleteQueries = (PFNGLDELETEQUERIESPROC) SDL_GL_GetProcAddress("glDeleteQueries");
qglBeginQuery = (PFNGLBEGINQUERYPROC) SDL_GL_GetProcAddress("glBeginQuery");
qglEndQuery = (PFNGLENDQUERYPROC) SDL_GL_GetProcAddress("glEndQuery");
qglGetQueryObjectiv = (PFNGLGETQUERYOBJECTIVPROC) SDL_GL_GetProcAddress("glGetQueryObjectiv");
qglGetQueryObjectuiv = (PFNGLGETQUERYOBJECTUIVPROC) SDL_GL_GetProcAddress("glGetQueryObjectuiv");
qglBindBuffer = (PFNGLBINDBUFFERPROC) SDL_GL_GetProcAddress("glBindBuffer");
qglDeleteBuffers = (PFNGLDELETEBUFFERSPROC) SDL_GL_GetProcAddress("glDeleteBuffers");
qglGenBuffers = (PFNGLGENBUFFERSPROC) SDL_GL_GetProcAddress("glGenBuffers");
qglBufferData = (PFNGLBUFFERDATAPROC) SDL_GL_GetProcAddress("glBufferData");
qglBufferSubData = (PFNGLBUFFERSUBDATAPROC) SDL_GL_GetProcAddress("glBufferSubData");
glRefConfig.occlusionQuery = qtrue;
ri.Printf(PRINT_ALL, result[glRefConfig.multiDrawArrays], extension); // OpenGL 2.0, was GL_ARB_shading_language_100, GL_ARB_vertex_program, GL_ARB_shader_objects, and GL_ARB_vertex_shader
} qglAttachShader = (PFNGLATTACHSHADERPROC) SDL_GL_GetProcAddress("glAttachShader");
else qglBindAttribLocation = (PFNGLBINDATTRIBLOCATIONPROC) SDL_GL_GetProcAddress("glBindAttribLocation");
{ qglCompileShader = (PFNGLCOMPILESHADERPROC) SDL_GL_GetProcAddress("glCompileShader");
ri.Printf(PRINT_ALL, result[2], extension); qglCreateProgram = (PFNGLCREATEPROGRAMPROC) SDL_GL_GetProcAddress("glCreateProgram");
} qglCreateShader = (PFNGLCREATESHADERPROC) SDL_GL_GetProcAddress("glCreateShader");
qglDeleteProgram = (PFNGLDELETEPROGRAMPROC) SDL_GL_GetProcAddress("glDeleteProgram");
qglDeleteShader = (PFNGLDELETESHADERPROC) SDL_GL_GetProcAddress("glDeleteShader");
qglDetachShader = (PFNGLDETACHSHADERPROC) SDL_GL_GetProcAddress("glDetachShader");
qglDisableVertexAttribArray = (PFNGLDISABLEVERTEXATTRIBARRAYPROC) SDL_GL_GetProcAddress("glDisableVertexAttribArray");
qglEnableVertexAttribArray = (PFNGLENABLEVERTEXATTRIBARRAYPROC) SDL_GL_GetProcAddress("glEnableVertexAttribArray");
qglGetActiveUniform = (PFNGLGETACTIVEUNIFORMPROC) SDL_GL_GetProcAddress("glGetActiveUniform");
qglGetProgramiv = (PFNGLGETPROGRAMIVPROC) SDL_GL_GetProcAddress("glGetProgramiv");
qglGetProgramInfoLog = (PFNGLGETPROGRAMINFOLOGPROC) SDL_GL_GetProcAddress("glGetProgramInfoLog");
qglGetShaderiv = (PFNGLGETSHADERIVPROC) SDL_GL_GetProcAddress("glGetShaderiv");
qglGetShaderInfoLog = (PFNGLGETSHADERINFOLOGPROC) SDL_GL_GetProcAddress("glGetShaderInfoLog");
qglGetShaderSource = (PFNGLGETSHADERSOURCEPROC) SDL_GL_GetProcAddress("glGetShaderSource");
qglGetUniformLocation = (PFNGLGETUNIFORMLOCATIONPROC) SDL_GL_GetProcAddress("glGetUniformLocation");
qglLinkProgram = (PFNGLLINKPROGRAMPROC) SDL_GL_GetProcAddress("glLinkProgram");
qglShaderSource = (PFNGLSHADERSOURCEPROC) SDL_GL_GetProcAddress("glShaderSource");
qglUseProgram = (PFNGLUSEPROGRAMPROC) SDL_GL_GetProcAddress("glUseProgram");
qglUniform1f = (PFNGLUNIFORM1FPROC) SDL_GL_GetProcAddress("glUniform1f");
qglUniform2f = (PFNGLUNIFORM2FPROC) SDL_GL_GetProcAddress("glUniform2f");
qglUniform3f = (PFNGLUNIFORM3FPROC) SDL_GL_GetProcAddress("glUniform3f");
qglUniform4f = (PFNGLUNIFORM4FPROC) SDL_GL_GetProcAddress("glUniform4f");
qglUniform1i = (PFNGLUNIFORM1IPROC) SDL_GL_GetProcAddress("glUniform1i");
qglUniform1fv = (PFNGLUNIFORM1FVPROC) SDL_GL_GetProcAddress("glUniform1fv");
qglUniformMatrix4fv = (PFNGLUNIFORMMATRIX4FVPROC) SDL_GL_GetProcAddress("glUniformMatrix4fv");
qglValidateProgram = (PFNGLVALIDATEPROGRAMPROC) SDL_GL_GetProcAddress("glValidateProgram");
qglVertexAttribPointer = (PFNGLVERTEXATTRIBPOINTERPROC) SDL_GL_GetProcAddress("glVertexAttribPointer");
// GL_ARB_vertex_program if (1)
//glRefConfig.vertexProgram = qfalse;
extension = "GL_ARB_vertex_program";
qglVertexAttrib4fARB = NULL;
qglVertexAttrib4fvARB = NULL;
qglVertexAttribPointerARB = NULL;
qglEnableVertexAttribArrayARB = NULL;
qglDisableVertexAttribArrayARB = NULL;
if( GLimp_HaveExtension( extension ) )
{
qglVertexAttrib4fARB = (PFNGLVERTEXATTRIB4FARBPROC) SDL_GL_GetProcAddress("glVertexAttrib4fARB");
qglVertexAttrib4fvARB = (PFNGLVERTEXATTRIB4FVARBPROC) SDL_GL_GetProcAddress("glVertexAttrib4fvARB");
qglVertexAttribPointerARB = (PFNGLVERTEXATTRIBPOINTERARBPROC) SDL_GL_GetProcAddress("glVertexAttribPointerARB");
qglEnableVertexAttribArrayARB =
(PFNGLENABLEVERTEXATTRIBARRAYARBPROC) SDL_GL_GetProcAddress("glEnableVertexAttribArrayARB");
qglDisableVertexAttribArrayARB =
(PFNGLDISABLEVERTEXATTRIBARRAYARBPROC) SDL_GL_GetProcAddress("glDisableVertexAttribArrayARB");
ri.Printf(PRINT_ALL, result[1], extension);
//glRefConfig.vertexProgram = qtrue;
}
else
{
ri.Error(ERR_FATAL, result[2], extension);
}
// GL_ARB_vertex_buffer_object
//glRefConfig.vertexBufferObject = qfalse;
extension = "GL_ARB_vertex_buffer_object";
qglBindBufferARB = NULL;
qglDeleteBuffersARB = NULL;
qglGenBuffersARB = NULL;
qglIsBufferARB = NULL;
qglBufferDataARB = NULL;
qglBufferSubDataARB = NULL;
qglGetBufferSubDataARB = NULL;
qglGetBufferParameterivARB = NULL;
qglGetBufferPointervARB = NULL;
if( GLimp_HaveExtension( extension ) )
{
qglBindBufferARB = (PFNGLBINDBUFFERARBPROC) SDL_GL_GetProcAddress("glBindBufferARB");
qglDeleteBuffersARB = (PFNGLDELETEBUFFERSARBPROC) SDL_GL_GetProcAddress("glDeleteBuffersARB");
qglGenBuffersARB = (PFNGLGENBUFFERSARBPROC) SDL_GL_GetProcAddress("glGenBuffersARB");
qglIsBufferARB = (PFNGLISBUFFERARBPROC) SDL_GL_GetProcAddress("glIsBufferARB");
qglBufferDataARB = (PFNGLBUFFERDATAARBPROC) SDL_GL_GetProcAddress("glBufferDataARB");
qglBufferSubDataARB = (PFNGLBUFFERSUBDATAARBPROC) SDL_GL_GetProcAddress("glBufferSubDataARB");
qglGetBufferSubDataARB = (PFNGLGETBUFFERSUBDATAARBPROC) SDL_GL_GetProcAddress("glGetBufferSubDataARB");
qglGetBufferParameterivARB = (PFNGLGETBUFFERPARAMETERIVARBPROC) SDL_GL_GetProcAddress("glGetBufferParameterivARB");
qglGetBufferPointervARB = (PFNGLGETBUFFERPOINTERVARBPROC) SDL_GL_GetProcAddress("glGetBufferPointervARB");
ri.Printf(PRINT_ALL, result[1], extension);
//glRefConfig.vertexBufferObject = qtrue;
}
else
{
ri.Error(ERR_FATAL, result[2], extension);
}
// GL_ARB_shader_objects
extension = "GL_ARB_shader_objects";
//glRefConfig.shaderObjects = qfalse;
qglDeleteObjectARB = NULL;
qglGetHandleARB = NULL;
qglDetachObjectARB = NULL;
qglCreateShaderObjectARB = NULL;
qglShaderSourceARB = NULL;
qglCompileShaderARB = NULL;
qglCreateProgramObjectARB = NULL;
qglAttachObjectARB = NULL;
qglLinkProgramARB = NULL;
qglUseProgramObjectARB = NULL;
qglValidateProgramARB = NULL;
qglUniform1fARB = NULL;
qglUniform2fARB = NULL;
qglUniform3fARB = NULL;
qglUniform4fARB = NULL;
qglUniform1iARB = NULL;
qglUniform2iARB = NULL;
qglUniform3iARB = NULL;
qglUniform4iARB = NULL;
qglUniform1fvARB = NULL;
qglUniform2fvARB = NULL;
qglUniform3fvARB = NULL;
qglUniform4fvARB = NULL;
qglUniform2ivARB = NULL;
qglUniform3ivARB = NULL;
qglUniform4ivARB = NULL;
qglUniformMatrix2fvARB = NULL;
qglUniformMatrix3fvARB = NULL;
qglUniformMatrix4fvARB = NULL;
qglGetObjectParameterfvARB = NULL;
qglGetObjectParameterivARB = NULL;
qglGetInfoLogARB = NULL;
qglGetAttachedObjectsARB = NULL;
qglGetUniformLocationARB = NULL;
qglGetActiveUniformARB = NULL;
qglGetUniformfvARB = NULL;
qglGetUniformivARB = NULL;
qglGetShaderSourceARB = NULL;
if( GLimp_HaveExtension( extension ) )
{
qglDeleteObjectARB = (PFNGLDELETEOBJECTARBPROC) SDL_GL_GetProcAddress("glDeleteObjectARB");
qglGetHandleARB = (PFNGLGETHANDLEARBPROC) SDL_GL_GetProcAddress("glGetHandleARB");
qglDetachObjectARB = (PFNGLDETACHOBJECTARBPROC) SDL_GL_GetProcAddress("glDetachObjectARB");
qglCreateShaderObjectARB = (PFNGLCREATESHADEROBJECTARBPROC) SDL_GL_GetProcAddress("glCreateShaderObjectARB");
qglShaderSourceARB = (PFNGLSHADERSOURCEARBPROC) SDL_GL_GetProcAddress("glShaderSourceARB");
qglCompileShaderARB = (PFNGLCOMPILESHADERARBPROC) SDL_GL_GetProcAddress("glCompileShaderARB");
qglCreateProgramObjectARB = (PFNGLCREATEPROGRAMOBJECTARBPROC) SDL_GL_GetProcAddress("glCreateProgramObjectARB");
qglAttachObjectARB = (PFNGLATTACHOBJECTARBPROC) SDL_GL_GetProcAddress("glAttachObjectARB");
qglLinkProgramARB = (PFNGLLINKPROGRAMARBPROC) SDL_GL_GetProcAddress("glLinkProgramARB");
qglUseProgramObjectARB = (PFNGLUSEPROGRAMOBJECTARBPROC) SDL_GL_GetProcAddress("glUseProgramObjectARB");
qglValidateProgramARB = (PFNGLVALIDATEPROGRAMARBPROC) SDL_GL_GetProcAddress("glValidateProgramARB");
qglUniform1fARB = (PFNGLUNIFORM1FARBPROC) SDL_GL_GetProcAddress("glUniform1fARB");
qglUniform2fARB = (PFNGLUNIFORM2FARBPROC) SDL_GL_GetProcAddress("glUniform2fARB");
qglUniform3fARB = (PFNGLUNIFORM3FARBPROC) SDL_GL_GetProcAddress("glUniform3fARB");
qglUniform4fARB = (PFNGLUNIFORM4FARBPROC) SDL_GL_GetProcAddress("glUniform4fARB");
qglUniform1iARB = (PFNGLUNIFORM1IARBPROC) SDL_GL_GetProcAddress("glUniform1iARB");
qglUniform2iARB = (PFNGLUNIFORM2IARBPROC) SDL_GL_GetProcAddress("glUniform2iARB");
qglUniform3iARB = (PFNGLUNIFORM3IARBPROC) SDL_GL_GetProcAddress("glUniform3iARB");
qglUniform4iARB = (PFNGLUNIFORM4IARBPROC) SDL_GL_GetProcAddress("glUniform4iARB");
qglUniform1fvARB = (PFNGLUNIFORM1FVARBPROC) SDL_GL_GetProcAddress("glUniform1fvARB");
qglUniform2fvARB = (PFNGLUNIFORM2FVARBPROC) SDL_GL_GetProcAddress("glUniform2fvARB");
qglUniform3fvARB = (PFNGLUNIFORM3FVARBPROC) SDL_GL_GetProcAddress("glUniform3fvARB");
qglUniform4fvARB = (PFNGLUNIFORM4FVARBPROC) SDL_GL_GetProcAddress("glUniform4fvARB");
qglUniform2ivARB = (PFNGLUNIFORM2IVARBPROC) SDL_GL_GetProcAddress("glUniform2ivARB");
qglUniform3ivARB = (PFNGLUNIFORM3IVARBPROC) SDL_GL_GetProcAddress("glUniform3ivARB");
qglUniform4ivARB = (PFNGLUNIFORM4IVARBPROC) SDL_GL_GetProcAddress("glUniform4ivARB");
qglUniformMatrix2fvARB = (PFNGLUNIFORMMATRIX2FVARBPROC) SDL_GL_GetProcAddress("glUniformMatrix2fvARB");
qglUniformMatrix3fvARB = (PFNGLUNIFORMMATRIX3FVARBPROC) SDL_GL_GetProcAddress("glUniformMatrix3fvARB");
qglUniformMatrix4fvARB = (PFNGLUNIFORMMATRIX4FVARBPROC) SDL_GL_GetProcAddress("glUniformMatrix4fvARB");
qglGetObjectParameterfvARB = (PFNGLGETOBJECTPARAMETERFVARBPROC) SDL_GL_GetProcAddress("glGetObjectParameterfvARB");
qglGetObjectParameterivARB = (PFNGLGETOBJECTPARAMETERIVARBPROC) SDL_GL_GetProcAddress("glGetObjectParameterivARB");
qglGetInfoLogARB = (PFNGLGETINFOLOGARBPROC) SDL_GL_GetProcAddress("glGetInfoLogARB");
qglGetAttachedObjectsARB = (PFNGLGETATTACHEDOBJECTSARBPROC) SDL_GL_GetProcAddress("glGetAttachedObjectsARB");
qglGetUniformLocationARB = (PFNGLGETUNIFORMLOCATIONARBPROC) SDL_GL_GetProcAddress("glGetUniformLocationARB");
qglGetActiveUniformARB = (PFNGLGETACTIVEUNIFORMARBPROC) SDL_GL_GetProcAddress("glGetActiveUniformARB");
qglGetUniformfvARB = (PFNGLGETUNIFORMFVARBPROC) SDL_GL_GetProcAddress("glGetUniformfvARB");
qglGetUniformivARB = (PFNGLGETUNIFORMIVARBPROC) SDL_GL_GetProcAddress("glGetUniformivARB");
qglGetShaderSourceARB = (PFNGLGETSHADERSOURCEARBPROC) SDL_GL_GetProcAddress("glGetShaderSourceARB");
ri.Printf(PRINT_ALL, result[1], extension);
//glRefConfig.shaderObjects = qtrue;
}
else
{
ri.Error(ERR_FATAL, result[2], extension);
}
// GL_ARB_vertex_shader
//glRefConfig.vertexShader = qfalse;
extension = "GL_ARB_vertex_shader";
qglBindAttribLocationARB = NULL;
qglGetActiveAttribARB = NULL;
qglGetAttribLocationARB = NULL;
if( GLimp_HaveExtension( extension ) )
{
//int reservedComponents;
//qglGetIntegerv(GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB, &glConfig.maxVertexUniforms);
//qglGetIntegerv(GL_MAX_VARYING_FLOATS_ARB, &glConfig.maxVaryingFloats);
//qglGetIntegerv(GL_MAX_VERTEX_ATTRIBS_ARB, &glConfig.maxVertexAttribs);
//reservedComponents = 16 * 10; // approximation how many uniforms we have besides the bone matrices
#if 0
if(glConfig.driverType == GLDRV_MESA)
{
// HACK
// restrict to number of vertex uniforms to 512 because of:
// xreal.x86_64: nv50_program.c:4181: nv50_program_validate_data: Assertion `p->param_nr <= 512' failed
glConfig.maxVertexUniforms = Q_bound(0, glConfig.maxVertexUniforms, 512);
}
#endif
//glConfig.maxVertexSkinningBones = (int) Q_bound(0.0, (Q_max(glConfig.maxVertexUniforms - reservedComponents, 0) / 16), MAX_BONES);
//glConfig.vboVertexSkinningAvailable = r_vboVertexSkinning->integer && ((glConfig.maxVertexSkinningBones >= 12) ? qtrue : qfalse);
qglBindAttribLocationARB = (PFNGLBINDATTRIBLOCATIONARBPROC) SDL_GL_GetProcAddress("glBindAttribLocationARB");
qglGetActiveAttribARB = (PFNGLGETACTIVEATTRIBARBPROC) SDL_GL_GetProcAddress("glGetActiveAttribARB");
qglGetAttribLocationARB = (PFNGLGETATTRIBLOCATIONARBPROC) SDL_GL_GetProcAddress("glGetAttribLocationARB");
ri.Printf(PRINT_ALL, result[1], extension);
//glRefConfig.vertexShader = qtrue;
}
else
{
ri.Error(ERR_FATAL, result[2], extension);
}
// GL_ARB_shading_language_100
extension = "GL_ARB_shading_language_100";
if( GLimp_HaveExtension( extension ) )
{ {
char version[256]; char version[256];
Q_strncpyz( version, (char *) qglGetString (GL_SHADING_LANGUAGE_VERSION_ARB), sizeof( version ) ); Q_strncpyz(version, (char *)qglGetString(GL_SHADING_LANGUAGE_VERSION), sizeof(version));
sscanf(version, "%d.%d", &glRefConfig.glslMajorVersion, &glRefConfig.glslMinorVersion); sscanf(version, "%d.%d", &glRefConfig.glslMajorVersion, &glRefConfig.glslMinorVersion);
ri.Printf(PRINT_ALL, "...using GLSL version %s\n", version); ri.Printf(PRINT_ALL, "...using GLSL version %s\n", version);
} }
else
{
ri.Error(ERR_FATAL, result[2], extension);
}
glRefConfig.memInfo = MI_NONE; glRefConfig.memInfo = MI_NONE;
@ -591,27 +371,6 @@ void GLimp_InitExtraExtensions()
ri.Printf(PRINT_ALL, result[2], extension); ri.Printf(PRINT_ALL, result[2], extension);
} }
// GL_ARB_occlusion_query
extension = "GL_ARB_occlusion_query";
glRefConfig.occlusionQuery = qfalse;
if (GLimp_HaveExtension(extension))
{
qglGenQueriesARB = (PFNGLGENQUERIESARBPROC) SDL_GL_GetProcAddress("glGenQueriesARB");
qglDeleteQueriesARB = (PFNGLDELETEQUERIESARBPROC) SDL_GL_GetProcAddress("glDeleteQueriesARB");
qglIsQueryARB = (PFNGLISQUERYARBPROC) SDL_GL_GetProcAddress("glIsQueryARB");
qglBeginQueryARB = (PFNGLBEGINQUERYARBPROC) SDL_GL_GetProcAddress("glBeginQueryARB");
qglEndQueryARB = (PFNGLENDQUERYARBPROC) SDL_GL_GetProcAddress("glEndQueryARB");
qglGetQueryivARB = (PFNGLGETQUERYIVARBPROC) SDL_GL_GetProcAddress("glGetQueryivARB");
qglGetQueryObjectivARB = (PFNGLGETQUERYOBJECTIVARBPROC) SDL_GL_GetProcAddress("glGetQueryObjectivARB");
qglGetQueryObjectuivARB = (PFNGLGETQUERYOBJECTUIVARBPROC) SDL_GL_GetProcAddress("glGetQueryObjectuivARB");
glRefConfig.occlusionQuery = qtrue;
ri.Printf(PRINT_ALL, result[glRefConfig.occlusionQuery], extension);
}
else
{
ri.Printf(PRINT_ALL, result[2], extension);
}
// GL_EXT_framebuffer_blit // GL_EXT_framebuffer_blit
extension = "GL_EXT_framebuffer_blit"; extension = "GL_EXT_framebuffer_blit";
glRefConfig.framebufferBlit = qfalse; glRefConfig.framebufferBlit = qfalse;
@ -626,22 +385,6 @@ void GLimp_InitExtraExtensions()
ri.Printf(PRINT_ALL, result[2], extension); ri.Printf(PRINT_ALL, result[2], extension);
} }
// GL_ARB_texture_compression
extension = "GL_ARB_texture_compression";
glRefConfig.arbTextureCompression = qfalse;
if (GLimp_HaveExtension(extension))
{
qglCompressedTexImage3DARB = (void *)SDL_GL_GetProcAddress("glCompressedTexImage3DARB");
qglCompressedTexImage2DARB = (void *)SDL_GL_GetProcAddress("glCompressedTexImage2DARB");
qglCompressedTexImage1DARB = (void *)SDL_GL_GetProcAddress("glCompressedTexImage1DARB");
qglCompressedTexSubImage3DARB = (void *)SDL_GL_GetProcAddress("glCompressedTexSubImage3DARB");
qglCompressedTexSubImage2DARB = (void *)SDL_GL_GetProcAddress("glCompressedTexSubImage2DARB");
qglCompressedTexSubImage1DARB = (void *)SDL_GL_GetProcAddress("glCompressedTexSubImage1DARB");
qglGetCompressedTexImageARB = (void *)SDL_GL_GetProcAddress("glGetCompressedTexImageARB");
glRefConfig.arbTextureCompression = qtrue;
ri.Printf(PRINT_ALL, result[glRefConfig.arbTextureCompression], extension);
}
// GL_EXT_framebuffer_multisample // GL_EXT_framebuffer_multisample
extension = "GL_EXT_framebuffer_multisample"; extension = "GL_EXT_framebuffer_multisample";
glRefConfig.framebufferMultisample = qfalse; glRefConfig.framebufferMultisample = qfalse;
@ -662,7 +405,7 @@ void GLimp_InitExtraExtensions()
extension = "GL_ARB_texture_compression_rgtc"; extension = "GL_ARB_texture_compression_rgtc";
if (GLimp_HaveExtension(extension)) if (GLimp_HaveExtension(extension))
{ {
if (r_ext_compressed_textures->integer && glRefConfig.arbTextureCompression) if (r_ext_compressed_textures->integer)
glRefConfig.textureCompression |= TCR_RGTC; glRefConfig.textureCompression |= TCR_RGTC;
ri.Printf(PRINT_ALL, result[r_ext_compressed_textures->integer ? 1 : 0], extension); ri.Printf(PRINT_ALL, result[r_ext_compressed_textures->integer ? 1 : 0], extension);

View file

@ -149,7 +149,7 @@ static uniformInfo_t uniformsInfo[] =
}; };
static void GLSL_PrintInfoLog(GLhandleARB object, qboolean developerOnly) static void GLSL_PrintInfoLog(GLuint program, qboolean developerOnly)
{ {
char *msg; char *msg;
static char msgPart[1024]; static char msgPart[1024];
@ -157,7 +157,7 @@ static void GLSL_PrintInfoLog(GLhandleARB object, qboolean developerOnly)
int i; int i;
int printLevel = developerOnly ? PRINT_DEVELOPER : PRINT_ALL; int printLevel = developerOnly ? PRINT_DEVELOPER : PRINT_ALL;
qglGetObjectParameterivARB(object, GL_OBJECT_INFO_LOG_LENGTH_ARB, &maxLength); qglGetProgramiv(program, GL_INFO_LOG_LENGTH, &maxLength);
if (maxLength <= 0) if (maxLength <= 0)
{ {
@ -169,7 +169,7 @@ static void GLSL_PrintInfoLog(GLhandleARB object, qboolean developerOnly)
if (maxLength < 1023) if (maxLength < 1023)
{ {
qglGetInfoLogARB(object, maxLength, &maxLength, msgPart); qglGetProgramInfoLog(program, maxLength, &maxLength, msgPart);
msgPart[maxLength + 1] = '\0'; msgPart[maxLength + 1] = '\0';
@ -179,7 +179,7 @@ static void GLSL_PrintInfoLog(GLhandleARB object, qboolean developerOnly)
{ {
msg = ri.Malloc(maxLength); msg = ri.Malloc(maxLength);
qglGetInfoLogARB(object, maxLength, &maxLength, msg); qglGetProgramInfoLog(program, maxLength, &maxLength, msg);
for(i = 0; i < maxLength; i += 1024) for(i = 0; i < maxLength; i += 1024)
{ {
@ -192,18 +192,18 @@ static void GLSL_PrintInfoLog(GLhandleARB object, qboolean developerOnly)
} }
} }
static void GLSL_PrintShaderSource(GLhandleARB object) static void GLSL_PrintShaderSource(GLuint shader)
{ {
char *msg; char *msg;
static char msgPart[1024]; static char msgPart[1024];
int maxLength = 0; int maxLength = 0;
int i; int i;
qglGetObjectParameterivARB(object, GL_OBJECT_SHADER_SOURCE_LENGTH_ARB, &maxLength); qglGetShaderiv(shader, GL_SHADER_SOURCE_LENGTH, &maxLength);
msg = ri.Malloc(maxLength); msg = ri.Malloc(maxLength);
qglGetShaderSourceARB(object, maxLength, &maxLength, msg); qglShaderSource(shader, 1, (const GLchar **)&msg, &maxLength);
for(i = 0; i < maxLength; i += 1024) for(i = 0; i < maxLength; i += 1024)
{ {
@ -214,7 +214,7 @@ static void GLSL_PrintShaderSource(GLhandleARB object)
ri.Free(msg); ri.Free(msg);
} }
static void GLSL_GetShaderHeader( GLenum shaderType, const GLcharARB *extra, char *dest, int size ) static void GLSL_GetShaderHeader( GLenum shaderType, const GLchar *extra, char *dest, int size )
{ {
float fbufWidthScale, fbufHeightScale; float fbufWidthScale, fbufHeightScale;
@ -225,7 +225,7 @@ static void GLSL_GetShaderHeader( GLenum shaderType, const GLcharARB *extra, cha
{ {
Q_strcat(dest, size, "#version 130\n"); Q_strcat(dest, size, "#version 130\n");
if(shaderType == GL_VERTEX_SHADER_ARB) if(shaderType == GL_VERTEX_SHADER)
{ {
Q_strcat(dest, size, "#define attribute in\n"); Q_strcat(dest, size, "#define attribute in\n");
Q_strcat(dest, size, "#define varying out\n"); Q_strcat(dest, size, "#define varying out\n");
@ -349,20 +349,20 @@ static void GLSL_GetShaderHeader( GLenum shaderType, const GLcharARB *extra, cha
Q_strcat(dest, size, "#line 0\n"); Q_strcat(dest, size, "#line 0\n");
} }
static int GLSL_CompileGPUShader(GLhandleARB program, GLhandleARB *prevShader, const GLcharARB *buffer, int size, GLenum shaderType) static int GLSL_CompileGPUShader(GLuint program, GLuint *prevShader, const GLchar *buffer, int size, GLenum shaderType)
{ {
GLint compiled; GLint compiled;
GLhandleARB shader; GLuint shader;
shader = qglCreateShaderObjectARB(shaderType); shader = qglCreateShader(shaderType);
qglShaderSourceARB(shader, 1, (const GLcharARB **)&buffer, &size); qglShaderSource(shader, 1, (const GLchar **)&buffer, &size);
// compile shader // compile shader
qglCompileShaderARB(shader); qglCompileShader(shader);
// check if shader compiled // check if shader compiled
qglGetObjectParameterivARB(shader, GL_OBJECT_COMPILE_STATUS_ARB, &compiled); qglGetShaderiv(shader, GL_COMPILE_STATUS, &compiled);
if(!compiled) if(!compiled)
{ {
GLSL_PrintShaderSource(shader); GLSL_PrintShaderSource(shader);
@ -376,12 +376,12 @@ static int GLSL_CompileGPUShader(GLhandleARB program, GLhandleARB *prevShader, c
if (*prevShader) if (*prevShader)
{ {
qglDetachObjectARB(program, *prevShader); qglDetachShader(program, *prevShader);
qglDeleteObjectARB(*prevShader); qglDeleteShader(*prevShader);
} }
// attach shader to program // attach shader to program
qglAttachObjectARB(program, shader); qglAttachShader(program, shader);
*prevShader = shader; *prevShader = shader;
@ -392,12 +392,12 @@ static int GLSL_LoadGPUShaderText(const char *name, const char *fallback,
GLenum shaderType, char *dest, int destSize) GLenum shaderType, char *dest, int destSize)
{ {
char filename[MAX_QPATH]; char filename[MAX_QPATH];
GLcharARB *buffer = NULL; GLchar *buffer = NULL;
const GLcharARB *shaderText = NULL; const GLchar *shaderText = NULL;
int size; int size;
int result; int result;
if(shaderType == GL_VERTEX_SHADER_ARB) if(shaderType == GL_VERTEX_SHADER)
{ {
Com_sprintf(filename, sizeof(filename), "glsl/%s_vp.glsl", name); Com_sprintf(filename, sizeof(filename), "glsl/%s_vp.glsl", name);
} }
@ -451,13 +451,13 @@ static int GLSL_LoadGPUShaderText(const char *name, const char *fallback,
return result; return result;
} }
static void GLSL_LinkProgram(GLhandleARB program) static void GLSL_LinkProgram(GLuint program)
{ {
GLint linked; GLint linked;
qglLinkProgramARB(program); qglLinkProgram(program);
qglGetObjectParameterivARB(program, GL_OBJECT_LINK_STATUS_ARB, &linked); qglGetProgramiv(program, GL_LINK_STATUS, &linked);
if(!linked) if(!linked)
{ {
GLSL_PrintInfoLog(program, qfalse); GLSL_PrintInfoLog(program, qfalse);
@ -466,13 +466,13 @@ static void GLSL_LinkProgram(GLhandleARB program)
} }
} }
static void GLSL_ValidateProgram(GLhandleARB program) static void GLSL_ValidateProgram(GLuint program)
{ {
GLint validated; GLint validated;
qglValidateProgramARB(program); qglValidateProgram(program);
qglGetObjectParameterivARB(program, GL_OBJECT_VALIDATE_STATUS_ARB, &validated); qglGetProgramiv(program, GL_VALIDATE_STATUS, &validated);
if(!validated) if(!validated)
{ {
GLSL_PrintInfoLog(program, qfalse); GLSL_PrintInfoLog(program, qfalse);
@ -481,19 +481,19 @@ static void GLSL_ValidateProgram(GLhandleARB program)
} }
} }
static void GLSL_ShowProgramUniforms(GLhandleARB program) static void GLSL_ShowProgramUniforms(GLuint program)
{ {
int i, count, size; int i, count, size;
GLenum type; GLenum type;
char uniformName[1000]; char uniformName[1000];
// query the number of active uniforms // query the number of active uniforms
qglGetObjectParameterivARB(program, GL_OBJECT_ACTIVE_UNIFORMS_ARB, &count); qglGetProgramiv(program, GL_ACTIVE_UNIFORMS, &count);
// Loop over each of the active uniforms, and set their value // Loop over each of the active uniforms, and set their value
for(i = 0; i < count; i++) for(i = 0; i < count; i++)
{ {
qglGetActiveUniformARB(program, i, sizeof(uniformName), NULL, &size, &type, uniformName); qglGetActiveUniform(program, i, sizeof(uniformName), NULL, &size, &type, uniformName);
ri.Printf(PRINT_DEVELOPER, "active uniform: '%s'\n", uniformName); ri.Printf(PRINT_DEVELOPER, "active uniform: '%s'\n", uniformName);
} }
@ -510,64 +510,64 @@ static int GLSL_InitGPUShader2(shaderProgram_t * program, const char *name, int
Q_strncpyz(program->name, name, sizeof(program->name)); Q_strncpyz(program->name, name, sizeof(program->name));
program->program = qglCreateProgramObjectARB(); program->program = qglCreateProgram();
program->attribs = attribs; program->attribs = attribs;
if (!(GLSL_CompileGPUShader(program->program, &program->vertexShader, vpCode, strlen(vpCode), GL_VERTEX_SHADER_ARB))) if (!(GLSL_CompileGPUShader(program->program, &program->vertexShader, vpCode, strlen(vpCode), GL_VERTEX_SHADER)))
{ {
ri.Printf(PRINT_ALL, "GLSL_InitGPUShader2: Unable to load \"%s\" as GL_VERTEX_SHADER_ARB\n", name); ri.Printf(PRINT_ALL, "GLSL_InitGPUShader2: Unable to load \"%s\" as GL_VERTEX_SHADER\n", name);
qglDeleteObjectARB(program->program); qglDeleteProgram(program->program);
return 0; return 0;
} }
if(fpCode) if(fpCode)
{ {
if(!(GLSL_CompileGPUShader(program->program, &program->fragmentShader, fpCode, strlen(fpCode), GL_FRAGMENT_SHADER_ARB))) if(!(GLSL_CompileGPUShader(program->program, &program->fragmentShader, fpCode, strlen(fpCode), GL_FRAGMENT_SHADER)))
{ {
ri.Printf(PRINT_ALL, "GLSL_InitGPUShader2: Unable to load \"%s\" as GL_FRAGMENT_SHADER_ARB\n", name); ri.Printf(PRINT_ALL, "GLSL_InitGPUShader2: Unable to load \"%s\" as GL_FRAGMENT_SHADER\n", name);
qglDeleteObjectARB(program->program); qglDeleteProgram(program->program);
return 0; return 0;
} }
} }
if(attribs & ATTR_POSITION) if(attribs & ATTR_POSITION)
qglBindAttribLocationARB(program->program, ATTR_INDEX_POSITION, "attr_Position"); qglBindAttribLocation(program->program, ATTR_INDEX_POSITION, "attr_Position");
if(attribs & ATTR_TEXCOORD) if(attribs & ATTR_TEXCOORD)
qglBindAttribLocationARB(program->program, ATTR_INDEX_TEXCOORD, "attr_TexCoord0"); qglBindAttribLocation(program->program, ATTR_INDEX_TEXCOORD, "attr_TexCoord0");
if(attribs & ATTR_LIGHTCOORD) if(attribs & ATTR_LIGHTCOORD)
qglBindAttribLocationARB(program->program, ATTR_INDEX_LIGHTCOORD, "attr_TexCoord1"); qglBindAttribLocation(program->program, ATTR_INDEX_LIGHTCOORD, "attr_TexCoord1");
// if(attribs & ATTR_TEXCOORD2) // if(attribs & ATTR_TEXCOORD2)
// qglBindAttribLocationARB(program->program, ATTR_INDEX_TEXCOORD2, "attr_TexCoord2"); // qglBindAttribLocation(program->program, ATTR_INDEX_TEXCOORD2, "attr_TexCoord2");
// if(attribs & ATTR_TEXCOORD3) // if(attribs & ATTR_TEXCOORD3)
// qglBindAttribLocationARB(program->program, ATTR_INDEX_TEXCOORD3, "attr_TexCoord3"); // qglBindAttribLocation(program->program, ATTR_INDEX_TEXCOORD3, "attr_TexCoord3");
if(attribs & ATTR_TANGENT) if(attribs & ATTR_TANGENT)
qglBindAttribLocationARB(program->program, ATTR_INDEX_TANGENT, "attr_Tangent"); qglBindAttribLocation(program->program, ATTR_INDEX_TANGENT, "attr_Tangent");
if(attribs & ATTR_NORMAL) if(attribs & ATTR_NORMAL)
qglBindAttribLocationARB(program->program, ATTR_INDEX_NORMAL, "attr_Normal"); qglBindAttribLocation(program->program, ATTR_INDEX_NORMAL, "attr_Normal");
if(attribs & ATTR_COLOR) if(attribs & ATTR_COLOR)
qglBindAttribLocationARB(program->program, ATTR_INDEX_COLOR, "attr_Color"); qglBindAttribLocation(program->program, ATTR_INDEX_COLOR, "attr_Color");
if(attribs & ATTR_PAINTCOLOR) if(attribs & ATTR_PAINTCOLOR)
qglBindAttribLocationARB(program->program, ATTR_INDEX_PAINTCOLOR, "attr_PaintColor"); qglBindAttribLocation(program->program, ATTR_INDEX_PAINTCOLOR, "attr_PaintColor");
if(attribs & ATTR_LIGHTDIRECTION) if(attribs & ATTR_LIGHTDIRECTION)
qglBindAttribLocationARB(program->program, ATTR_INDEX_LIGHTDIRECTION, "attr_LightDirection"); qglBindAttribLocation(program->program, ATTR_INDEX_LIGHTDIRECTION, "attr_LightDirection");
if(attribs & ATTR_POSITION2) if(attribs & ATTR_POSITION2)
qglBindAttribLocationARB(program->program, ATTR_INDEX_POSITION2, "attr_Position2"); qglBindAttribLocation(program->program, ATTR_INDEX_POSITION2, "attr_Position2");
if(attribs & ATTR_NORMAL2) if(attribs & ATTR_NORMAL2)
qglBindAttribLocationARB(program->program, ATTR_INDEX_NORMAL2, "attr_Normal2"); qglBindAttribLocation(program->program, ATTR_INDEX_NORMAL2, "attr_Normal2");
if(attribs & ATTR_TANGENT2) if(attribs & ATTR_TANGENT2)
qglBindAttribLocationARB(program->program, ATTR_INDEX_TANGENT2, "attr_Tangent2"); qglBindAttribLocation(program->program, ATTR_INDEX_TANGENT2, "attr_Tangent2");
GLSL_LinkProgram(program->program); GLSL_LinkProgram(program->program);
@ -575,7 +575,7 @@ static int GLSL_InitGPUShader2(shaderProgram_t * program, const char *name, int
} }
static int GLSL_InitGPUShader(shaderProgram_t * program, const char *name, static int GLSL_InitGPUShader(shaderProgram_t * program, const char *name,
int attribs, qboolean fragmentShader, const GLcharARB *extra, qboolean addHeader, int attribs, qboolean fragmentShader, const GLchar *extra, qboolean addHeader,
const char *fallback_vp, const char *fallback_fp) const char *fallback_vp, const char *fallback_fp)
{ {
char vpCode[32000]; char vpCode[32000];
@ -587,7 +587,7 @@ static int GLSL_InitGPUShader(shaderProgram_t * program, const char *name,
size = sizeof(vpCode); size = sizeof(vpCode);
if (addHeader) if (addHeader)
{ {
GLSL_GetShaderHeader(GL_VERTEX_SHADER_ARB, extra, vpCode, size); GLSL_GetShaderHeader(GL_VERTEX_SHADER, extra, vpCode, size);
postHeader = &vpCode[strlen(vpCode)]; postHeader = &vpCode[strlen(vpCode)];
size -= strlen(vpCode); size -= strlen(vpCode);
} }
@ -596,7 +596,7 @@ static int GLSL_InitGPUShader(shaderProgram_t * program, const char *name,
postHeader = &vpCode[0]; postHeader = &vpCode[0];
} }
if (!GLSL_LoadGPUShaderText(name, fallback_vp, GL_VERTEX_SHADER_ARB, postHeader, size)) if (!GLSL_LoadGPUShaderText(name, fallback_vp, GL_VERTEX_SHADER, postHeader, size))
{ {
return 0; return 0;
} }
@ -606,7 +606,7 @@ static int GLSL_InitGPUShader(shaderProgram_t * program, const char *name,
size = sizeof(fpCode); size = sizeof(fpCode);
if (addHeader) if (addHeader)
{ {
GLSL_GetShaderHeader(GL_FRAGMENT_SHADER_ARB, extra, fpCode, size); GLSL_GetShaderHeader(GL_FRAGMENT_SHADER, extra, fpCode, size);
postHeader = &fpCode[strlen(fpCode)]; postHeader = &fpCode[strlen(fpCode)];
size -= strlen(fpCode); size -= strlen(fpCode);
} }
@ -615,7 +615,7 @@ static int GLSL_InitGPUShader(shaderProgram_t * program, const char *name,
postHeader = &fpCode[0]; postHeader = &fpCode[0];
} }
if (!GLSL_LoadGPUShaderText(name, fallback_fp, GL_FRAGMENT_SHADER_ARB, postHeader, size)) if (!GLSL_LoadGPUShaderText(name, fallback_fp, GL_FRAGMENT_SHADER, postHeader, size))
{ {
return 0; return 0;
} }
@ -635,7 +635,7 @@ void GLSL_InitUniforms(shaderProgram_t *program)
size = 0; size = 0;
for (i = 0; i < UNIFORM_COUNT; i++) for (i = 0; i < UNIFORM_COUNT; i++)
{ {
uniforms[i] = qglGetUniformLocationARB(program->program, uniformsInfo[i].name); uniforms[i] = qglGetUniformLocation(program->program, uniformsInfo[i].name);
if (uniforms[i] == -1) if (uniforms[i] == -1)
continue; continue;
@ -855,17 +855,17 @@ void GLSL_DeleteGPUShader(shaderProgram_t *program)
{ {
if (program->vertexShader) if (program->vertexShader)
{ {
qglDetachObjectARB(program->program, program->vertexShader); qglDetachShader(program->program, program->vertexShader);
qglDeleteObjectARB(program->vertexShader); qglDeleteShader(program->vertexShader);
} }
if (program->fragmentShader) if (program->fragmentShader)
{ {
qglDetachObjectARB(program->program, program->fragmentShader); qglDetachShader(program->program, program->fragmentShader);
qglDeleteObjectARB(program->fragmentShader); qglDeleteShader(program->fragmentShader);
} }
qglDeleteObjectARB(program->program); qglDeleteProgram(program->program);
if (program->uniformBuffer) if (program->uniformBuffer)
{ {
@ -1360,7 +1360,7 @@ void GLSL_ShutdownGPUShaders(void)
ri.Printf(PRINT_ALL, "------- GLSL_ShutdownGPUShaders -------\n"); ri.Printf(PRINT_ALL, "------- GLSL_ShutdownGPUShaders -------\n");
for (i = 0; i < ATTR_INDEX_COUNT; i++) for (i = 0; i < ATTR_INDEX_COUNT; i++)
qglDisableVertexAttribArrayARB(i); qglDisableVertexAttribArray(i);
GL_BindNullProgram(); GL_BindNullProgram();
@ -1406,7 +1406,7 @@ void GLSL_BindProgram(shaderProgram_t * program)
GLimp_LogComment(va("--- GLSL_BindProgram( %s ) ---\n", name)); GLimp_LogComment(va("--- GLSL_BindProgram( %s ) ---\n", name));
} }
if (GL_UseProgramObject(programObject)) if (GL_UseProgram(programObject))
backEnd.pc.c_glslShaderBinds++; backEnd.pc.c_glslShaderBinds++;
} }

View file

@ -976,8 +976,8 @@ void GL_SetDefaultState( void )
if (glRefConfig.vertexArrayObject) if (glRefConfig.vertexArrayObject)
qglBindVertexArrayARB(0); qglBindVertexArrayARB(0);
qglBindBufferARB(GL_ARRAY_BUFFER_ARB, 0); qglBindBuffer(GL_ARRAY_BUFFER, 0);
qglBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 0); qglBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
glState.currentVao = NULL; glState.currentVao = NULL;
glState.vertexAttribsEnabled = 0; glState.vertexAttribsEnabled = 0;
@ -1380,7 +1380,7 @@ void R_InitQueries(void)
return; return;
if (r_drawSunRays->integer) if (r_drawSunRays->integer)
qglGenQueriesARB(ARRAY_LEN(tr.sunFlareQuery), tr.sunFlareQuery); qglGenQueries(ARRAY_LEN(tr.sunFlareQuery), tr.sunFlareQuery);
} }
void R_ShutDownQueries(void) void R_ShutDownQueries(void)
@ -1389,7 +1389,7 @@ void R_ShutDownQueries(void)
return; return;
if (r_drawSunRays->integer) if (r_drawSunRays->integer)
qglDeleteQueriesARB(ARRAY_LEN(tr.sunFlareQuery), tr.sunFlareQuery); qglDeleteQueries(ARRAY_LEN(tr.sunFlareQuery), tr.sunFlareQuery);
} }
/* /*

View file

@ -706,9 +706,9 @@ typedef struct shaderProgram_s
{ {
char name[MAX_QPATH]; char name[MAX_QPATH];
GLhandleARB program; GLuint program;
GLhandleARB vertexShader; GLuint vertexShader;
GLhandleARB fragmentShader; GLuint fragmentShader;
uint32_t attribs; // vertex array attributes uint32_t attribs; // vertex array attributes
// uniform parameters // uniform parameters
@ -1383,6 +1383,9 @@ typedef enum {
// We can't change glConfig_t without breaking DLL/vms compatibility, so // We can't change glConfig_t without breaking DLL/vms compatibility, so
// store extensions we have here. // store extensions we have here.
typedef struct { typedef struct {
int openglMajorVersion;
int openglMinorVersion;
qboolean drawRangeElements; qboolean drawRangeElements;
qboolean multiDrawArrays; qboolean multiDrawArrays;
qboolean occlusionQuery; qboolean occlusionQuery;
@ -1400,7 +1403,6 @@ typedef struct {
qboolean textureFloat; qboolean textureFloat;
qboolean halfFloatPixel; qboolean halfFloatPixel;
qboolean packedDepthStencil; qboolean packedDepthStencil;
qboolean arbTextureCompression;
textureCompressionRef_t textureCompression; textureCompressionRef_t textureCompression;
qboolean swizzleNormalmap; qboolean swizzleNormalmap;

View file

@ -282,7 +282,7 @@ static qboolean RB_UpdateSunFlareVis(void)
for (iter=0 ; ; ++iter) for (iter=0 ; ; ++iter)
{ {
GLint available = 0; GLint available = 0;
qglGetQueryObjectivARB(tr.sunFlareQuery[tr.sunFlareQueryIndex], GL_QUERY_RESULT_AVAILABLE_ARB, &available); qglGetQueryObjectiv(tr.sunFlareQuery[tr.sunFlareQueryIndex], GL_QUERY_RESULT_AVAILABLE, &available);
if (available) if (available)
break; break;
} }
@ -290,7 +290,7 @@ static qboolean RB_UpdateSunFlareVis(void)
ri.Printf(PRINT_DEVELOPER, "Waited %d iterations\n", iter); ri.Printf(PRINT_DEVELOPER, "Waited %d iterations\n", iter);
} }
qglGetQueryObjectuivARB(tr.sunFlareQuery[tr.sunFlareQueryIndex], GL_QUERY_RESULT_ARB, &sampleCount); qglGetQueryObjectuiv(tr.sunFlareQuery[tr.sunFlareQueryIndex], GL_QUERY_RESULT, &sampleCount);
return sampleCount > 0; return sampleCount > 0;
} }

View file

@ -44,7 +44,7 @@ R_DrawElements
void R_DrawElementsVao( int numIndexes, glIndex_t firstIndex, glIndex_t minIndex, glIndex_t maxIndex ) void R_DrawElementsVao( int numIndexes, glIndex_t firstIndex, glIndex_t minIndex, glIndex_t maxIndex )
{ {
if (glRefConfig.drawRangeElements) if (glRefConfig.drawRangeElements)
qglDrawRangeElementsEXT(GL_TRIANGLES, minIndex, maxIndex, numIndexes, GL_INDEX_TYPE, BUFFER_OFFSET(firstIndex * sizeof(glIndex_t))); qglDrawRangeElements(GL_TRIANGLES, minIndex, maxIndex, numIndexes, GL_INDEX_TYPE, BUFFER_OFFSET(firstIndex * sizeof(glIndex_t)));
else else
qglDrawElements(GL_TRIANGLES, numIndexes, GL_INDEX_TYPE, BUFFER_OFFSET(firstIndex * sizeof(glIndex_t))); qglDrawElements(GL_TRIANGLES, numIndexes, GL_INDEX_TYPE, BUFFER_OFFSET(firstIndex * sizeof(glIndex_t)));
@ -56,7 +56,7 @@ static void R_DrawMultiElementsVao( int multiDrawPrimitives, glIndex_t *multiDra
{ {
if (glRefConfig.multiDrawArrays && multiDrawPrimitives > 1) if (glRefConfig.multiDrawArrays && multiDrawPrimitives > 1)
{ {
qglMultiDrawElementsEXT(GL_TRIANGLES, multiDrawNumIndexes, GL_INDEX_TYPE, (const GLvoid **)multiDrawFirstIndex, multiDrawPrimitives); qglMultiDrawElements(GL_TRIANGLES, multiDrawNumIndexes, GL_INDEX_TYPE, (const GLvoid **)multiDrawFirstIndex, multiDrawPrimitives);
} }
else else
{ {
@ -66,7 +66,7 @@ static void R_DrawMultiElementsVao( int multiDrawPrimitives, glIndex_t *multiDra
{ {
for (i = 0; i < multiDrawPrimitives; i++) for (i = 0; i < multiDrawPrimitives; i++)
{ {
qglDrawRangeElementsEXT(GL_TRIANGLES, multiDrawMinIndex[i], multiDrawMaxIndex[i], multiDrawNumIndexes[i], GL_INDEX_TYPE, multiDrawFirstIndex[i]); qglDrawRangeElements(GL_TRIANGLES, multiDrawMinIndex[i], multiDrawMaxIndex[i], multiDrawNumIndexes[i], GL_INDEX_TYPE, multiDrawFirstIndex[i]);
} }
} }
else else

View file

@ -1624,43 +1624,43 @@ void RB_SurfaceVaoMdvMesh(srfVaoMdvMesh_t * surface)
if (glRefConfig.vertexArrayObject) if (glRefConfig.vertexArrayObject)
{ {
qglBindBufferARB(GL_ARRAY_BUFFER_ARB, surface->vao->vertexesVBO); qglBindBuffer(GL_ARRAY_BUFFER, surface->vao->vertexesVBO);
} }
frameOffset = refEnt->frame * surface->vao->frameSize; frameOffset = refEnt->frame * surface->vao->frameSize;
attribIndex = ATTR_INDEX_POSITION; attribIndex = ATTR_INDEX_POSITION;
vAtb = &surface->vao->attribs[attribIndex]; vAtb = &surface->vao->attribs[attribIndex];
qglVertexAttribPointerARB(attribIndex, vAtb->count, vAtb->type, vAtb->normalized, vAtb->stride, BUFFER_OFFSET(vAtb->offset + frameOffset)); qglVertexAttribPointer(attribIndex, vAtb->count, vAtb->type, vAtb->normalized, vAtb->stride, BUFFER_OFFSET(vAtb->offset + frameOffset));
attribIndex = ATTR_INDEX_NORMAL; attribIndex = ATTR_INDEX_NORMAL;
vAtb = &surface->vao->attribs[attribIndex]; vAtb = &surface->vao->attribs[attribIndex];
qglVertexAttribPointerARB(attribIndex, vAtb->count, vAtb->type, vAtb->normalized, vAtb->stride, BUFFER_OFFSET(vAtb->offset + frameOffset)); qglVertexAttribPointer(attribIndex, vAtb->count, vAtb->type, vAtb->normalized, vAtb->stride, BUFFER_OFFSET(vAtb->offset + frameOffset));
attribIndex = ATTR_INDEX_TANGENT; attribIndex = ATTR_INDEX_TANGENT;
vAtb = &surface->vao->attribs[attribIndex]; vAtb = &surface->vao->attribs[attribIndex];
qglVertexAttribPointerARB(attribIndex, vAtb->count, vAtb->type, vAtb->normalized, vAtb->stride, BUFFER_OFFSET(vAtb->offset + frameOffset)); qglVertexAttribPointer(attribIndex, vAtb->count, vAtb->type, vAtb->normalized, vAtb->stride, BUFFER_OFFSET(vAtb->offset + frameOffset));
frameOffset = refEnt->oldframe * surface->vao->frameSize; frameOffset = refEnt->oldframe * surface->vao->frameSize;
attribIndex = ATTR_INDEX_POSITION2; attribIndex = ATTR_INDEX_POSITION2;
vAtb = &surface->vao->attribs[attribIndex]; vAtb = &surface->vao->attribs[attribIndex];
qglVertexAttribPointerARB(attribIndex, vAtb->count, vAtb->type, vAtb->normalized, vAtb->stride, BUFFER_OFFSET(vAtb->offset + frameOffset)); qglVertexAttribPointer(attribIndex, vAtb->count, vAtb->type, vAtb->normalized, vAtb->stride, BUFFER_OFFSET(vAtb->offset + frameOffset));
attribIndex = ATTR_INDEX_NORMAL2; attribIndex = ATTR_INDEX_NORMAL2;
vAtb = &surface->vao->attribs[attribIndex]; vAtb = &surface->vao->attribs[attribIndex];
qglVertexAttribPointerARB(attribIndex, vAtb->count, vAtb->type, vAtb->normalized, vAtb->stride, BUFFER_OFFSET(vAtb->offset + frameOffset)); qglVertexAttribPointer(attribIndex, vAtb->count, vAtb->type, vAtb->normalized, vAtb->stride, BUFFER_OFFSET(vAtb->offset + frameOffset));
attribIndex = ATTR_INDEX_TANGENT2; attribIndex = ATTR_INDEX_TANGENT2;
vAtb = &surface->vao->attribs[attribIndex]; vAtb = &surface->vao->attribs[attribIndex];
qglVertexAttribPointerARB(attribIndex, vAtb->count, vAtb->type, vAtb->normalized, vAtb->stride, BUFFER_OFFSET(vAtb->offset + frameOffset)); qglVertexAttribPointer(attribIndex, vAtb->count, vAtb->type, vAtb->normalized, vAtb->stride, BUFFER_OFFSET(vAtb->offset + frameOffset));
if (!glRefConfig.vertexArrayObject) if (!glRefConfig.vertexArrayObject)
{ {
attribIndex = ATTR_INDEX_TEXCOORD; attribIndex = ATTR_INDEX_TEXCOORD;
vAtb = &surface->vao->attribs[attribIndex]; vAtb = &surface->vao->attribs[attribIndex];
qglVertexAttribPointerARB(attribIndex, vAtb->count, vAtb->type, vAtb->normalized, vAtb->stride, BUFFER_OFFSET(vAtb->offset)); qglVertexAttribPointer(attribIndex, vAtb->count, vAtb->type, vAtb->normalized, vAtb->stride, BUFFER_OFFSET(vAtb->offset));
} }
} }

View file

@ -196,9 +196,9 @@ void Vao_SetVertexPointers(vao_t *vao)
if (vAtb->enabled) if (vAtb->enabled)
{ {
qglVertexAttribPointerARB(attribIndex, vAtb->count, vAtb->type, vAtb->normalized, vAtb->stride, BUFFER_OFFSET(vAtb->offset)); qglVertexAttribPointer(attribIndex, vAtb->count, vAtb->type, vAtb->normalized, vAtb->stride, BUFFER_OFFSET(vAtb->offset));
if (glRefConfig.vertexArrayObject || !(glState.vertexAttribsEnabled & attribBit)) if (glRefConfig.vertexArrayObject || !(glState.vertexAttribsEnabled & attribBit))
qglEnableVertexAttribArrayARB(attribIndex); qglEnableVertexAttribArray(attribIndex);
if (!glRefConfig.vertexArrayObject || vao == tess.vao) if (!glRefConfig.vertexArrayObject || vao == tess.vao)
glState.vertexAttribsEnabled |= attribBit; glState.vertexAttribsEnabled |= attribBit;
@ -208,7 +208,7 @@ void Vao_SetVertexPointers(vao_t *vao)
// don't disable vertex attribs when using vertex array objects // don't disable vertex attribs when using vertex array objects
// Vao_SetVertexPointers is only called during init when using VAOs, and vertex attribs start disabled anyway // Vao_SetVertexPointers is only called during init when using VAOs, and vertex attribs start disabled anyway
if (!glRefConfig.vertexArrayObject && (glState.vertexAttribsEnabled & attribBit)) if (!glRefConfig.vertexArrayObject && (glState.vertexAttribsEnabled & attribBit))
qglDisableVertexAttribArrayARB(attribIndex); qglDisableVertexAttribArray(attribIndex);
if (!glRefConfig.vertexArrayObject || vao == tess.vao) if (!glRefConfig.vertexArrayObject || vao == tess.vao)
glState.vertexAttribsEnabled &= ~attribBit; glState.vertexAttribsEnabled &= ~attribBit;
@ -229,11 +229,11 @@ vao_t *R_CreateVao(const char *name, byte *vertexes, int vertexesSize, byte *ind
switch (usage) switch (usage)
{ {
case VAO_USAGE_STATIC: case VAO_USAGE_STATIC:
glUsage = GL_STATIC_DRAW_ARB; glUsage = GL_STATIC_DRAW;
break; break;
case VAO_USAGE_DYNAMIC: case VAO_USAGE_DYNAMIC:
glUsage = GL_DYNAMIC_DRAW_ARB; glUsage = GL_DYNAMIC_DRAW;
break; break;
default: default:
@ -269,18 +269,18 @@ vao_t *R_CreateVao(const char *name, byte *vertexes, int vertexesSize, byte *ind
vao->vertexesSize = vertexesSize; vao->vertexesSize = vertexesSize;
qglGenBuffersARB(1, &vao->vertexesVBO); qglGenBuffers(1, &vao->vertexesVBO);
qglBindBufferARB(GL_ARRAY_BUFFER_ARB, vao->vertexesVBO); qglBindBuffer(GL_ARRAY_BUFFER, vao->vertexesVBO);
qglBufferDataARB(GL_ARRAY_BUFFER_ARB, vertexesSize, vertexes, glUsage); qglBufferData(GL_ARRAY_BUFFER, vertexesSize, vertexes, glUsage);
vao->indexesSize = indexesSize; vao->indexesSize = indexesSize;
qglGenBuffersARB(1, &vao->indexesIBO); qglGenBuffers(1, &vao->indexesIBO);
qglBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, vao->indexesIBO); qglBindBuffer(GL_ELEMENT_ARRAY_BUFFER, vao->indexesIBO);
qglBufferDataARB(GL_ELEMENT_ARRAY_BUFFER_ARB, indexesSize, indexes, glUsage); qglBufferData(GL_ELEMENT_ARRAY_BUFFER, indexesSize, indexes, glUsage);
glState.currentVao = vao; glState.currentVao = vao;
@ -304,7 +304,7 @@ vao_t *R_CreateVao2(const char *name, int numVertexes, srfVert_t *verts, int num
int dataSize; int dataSize;
int dataOfs; int dataOfs;
int glUsage = GL_STATIC_DRAW_ARB; int glUsage = GL_STATIC_DRAW;
if(!numVertexes || !numIndexes) if(!numVertexes || !numIndexes)
return NULL; return NULL;
@ -422,19 +422,19 @@ vao_t *R_CreateVao2(const char *name, int numVertexes, srfVert_t *verts, int num
vao->vertexesSize = dataSize; vao->vertexesSize = dataSize;
qglGenBuffersARB(1, &vao->vertexesVBO); qglGenBuffers(1, &vao->vertexesVBO);
qglBindBufferARB(GL_ARRAY_BUFFER_ARB, vao->vertexesVBO); qglBindBuffer(GL_ARRAY_BUFFER, vao->vertexesVBO);
qglBufferDataARB(GL_ARRAY_BUFFER_ARB, vao->vertexesSize, data, glUsage); qglBufferData(GL_ARRAY_BUFFER, vao->vertexesSize, data, glUsage);
// create IBO // create IBO
vao->indexesSize = numIndexes * sizeof(glIndex_t); vao->indexesSize = numIndexes * sizeof(glIndex_t);
qglGenBuffersARB(1, &vao->indexesIBO); qglGenBuffers(1, &vao->indexesIBO);
qglBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, vao->indexesIBO); qglBindBuffer(GL_ELEMENT_ARRAY_BUFFER, vao->indexesIBO);
qglBufferDataARB(GL_ELEMENT_ARRAY_BUFFER_ARB, vao->indexesSize, indexes, glUsage); qglBufferData(GL_ELEMENT_ARRAY_BUFFER, vao->indexesSize, indexes, glUsage);
Vao_SetVertexPointers(vao); Vao_SetVertexPointers(vao);
@ -484,16 +484,16 @@ void R_BindVao(vao_t * vao)
// why you no save GL_ELEMENT_ARRAY_BUFFER binding, Intel? // why you no save GL_ELEMENT_ARRAY_BUFFER binding, Intel?
if (1) if (1)
qglBindBufferARB(GL_ELEMENT_ARRAY_BUFFER, vao->indexesIBO); qglBindBuffer(GL_ELEMENT_ARRAY_BUFFER, vao->indexesIBO);
// tess VAO always has buffers bound // tess VAO always has buffers bound
if (vao == tess.vao) if (vao == tess.vao)
qglBindBufferARB(GL_ARRAY_BUFFER_ARB, vao->vertexesVBO); qglBindBuffer(GL_ARRAY_BUFFER, vao->vertexesVBO);
} }
else else
{ {
qglBindBufferARB(GL_ARRAY_BUFFER_ARB, vao->vertexesVBO); qglBindBuffer(GL_ARRAY_BUFFER, vao->vertexesVBO);
qglBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, vao->indexesIBO); qglBindBuffer(GL_ELEMENT_ARRAY_BUFFER, vao->indexesIBO);
// tess VAO doesn't have vertex pointers set until data is uploaded // tess VAO doesn't have vertex pointers set until data is uploaded
if (vao != tess.vao) if (vao != tess.vao)
@ -518,12 +518,12 @@ void R_BindNullVao(void)
qglBindVertexArrayARB(0); qglBindVertexArrayARB(0);
// why you no save GL_ELEMENT_ARRAY_BUFFER binding, Intel? // why you no save GL_ELEMENT_ARRAY_BUFFER binding, Intel?
if (1) qglBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 0); if (1) qglBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
} }
else else
{ {
qglBindBufferARB(GL_ARRAY_BUFFER_ARB, 0); qglBindBuffer(GL_ARRAY_BUFFER, 0);
qglBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 0); qglBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
} }
glState.currentVao = NULL; glState.currentVao = NULL;
} }
@ -658,12 +658,12 @@ void R_ShutdownVaos(void)
if(vao->vertexesVBO) if(vao->vertexesVBO)
{ {
qglDeleteBuffersARB(1, &vao->vertexesVBO); qglDeleteBuffers(1, &vao->vertexesVBO);
} }
if(vao->indexesIBO) if(vao->indexesIBO)
{ {
qglDeleteBuffersARB(1, &vao->indexesIBO); qglDeleteBuffers(1, &vao->indexesIBO);
} }
} }
@ -737,7 +737,7 @@ void RB_UpdateTessVao(unsigned int attribBits)
R_BindVao(tess.vao); R_BindVao(tess.vao);
// orphan old vertex buffer so we don't stall on it // orphan old vertex buffer so we don't stall on it
qglBufferDataARB(GL_ARRAY_BUFFER_ARB, tess.vao->vertexesSize, NULL, GL_DYNAMIC_DRAW_ARB); qglBufferData(GL_ARRAY_BUFFER, tess.vao->vertexesSize, NULL, GL_DYNAMIC_DRAW);
// if nothing to set, set everything // if nothing to set, set everything
if(!(attribBits & ATTR_BITS)) if(!(attribBits & ATTR_BITS))
@ -761,17 +761,17 @@ void RB_UpdateTessVao(unsigned int attribBits)
if (attribUpload & attribBit) if (attribUpload & attribBit)
{ {
// note: tess has a VBO where stride == size // note: tess has a VBO where stride == size
qglBufferSubDataARB(GL_ARRAY_BUFFER_ARB, vAtb->offset, tess.numVertexes * vAtb->stride, tess.attribPointers[attribIndex]); qglBufferSubData(GL_ARRAY_BUFFER, vAtb->offset, tess.numVertexes * vAtb->stride, tess.attribPointers[attribIndex]);
} }
if (attribBits & attribBit) if (attribBits & attribBit)
{ {
if (!glRefConfig.vertexArrayObject) if (!glRefConfig.vertexArrayObject)
qglVertexAttribPointerARB(attribIndex, vAtb->count, vAtb->type, vAtb->normalized, vAtb->stride, BUFFER_OFFSET(vAtb->offset)); qglVertexAttribPointer(attribIndex, vAtb->count, vAtb->type, vAtb->normalized, vAtb->stride, BUFFER_OFFSET(vAtb->offset));
if (!(glState.vertexAttribsEnabled & attribBit)) if (!(glState.vertexAttribsEnabled & attribBit))
{ {
qglEnableVertexAttribArrayARB(attribIndex); qglEnableVertexAttribArray(attribIndex);
glState.vertexAttribsEnabled |= attribBit; glState.vertexAttribsEnabled |= attribBit;
} }
} }
@ -779,15 +779,15 @@ void RB_UpdateTessVao(unsigned int attribBits)
{ {
if ((glState.vertexAttribsEnabled & attribBit)) if ((glState.vertexAttribsEnabled & attribBit))
{ {
qglDisableVertexAttribArrayARB(attribIndex); qglDisableVertexAttribArray(attribIndex);
glState.vertexAttribsEnabled &= ~attribBit; glState.vertexAttribsEnabled &= ~attribBit;
} }
} }
} }
// orphan old index buffer so we don't stall on it // orphan old index buffer so we don't stall on it
qglBufferDataARB(GL_ELEMENT_ARRAY_BUFFER_ARB, tess.vao->indexesSize, NULL, GL_DYNAMIC_DRAW_ARB); qglBufferData(GL_ELEMENT_ARRAY_BUFFER, tess.vao->indexesSize, NULL, GL_DYNAMIC_DRAW);
qglBufferSubDataARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 0, tess.numIndexes * sizeof(tess.indexes[0]), tess.indexes); qglBufferSubData(GL_ELEMENT_ARRAY_BUFFER, 0, tess.numIndexes * sizeof(tess.indexes[0]), tess.indexes);
} }
} }