DXGL r371 - Code Review

Jump to navigation Jump to search
Repository:DXGL
Revision:r370‎ | r371 | r372 >
Date:00:20, 12 May 2013
Author:admin
Status:new
Tags:
Comment:
Add direct state access functions for textures and matrices.
Add else statement for extension availability variables.
Modified paths:
  • /ddraw/glExtensions.cpp (modified) (history)
  • /ddraw/glExtensions.h (modified) (history)

Diff [purge]

Index: ddraw/glExtensions.cpp
@@ -84,6 +84,18 @@
8585 BOOL (APIENTRY *wglSwapIntervalEXT)(int interval) = NULL;
8686 int (APIENTRY *wglGetSwapIntervalEXT)() = NULL;
8787
 88+void (APIENTRY *glTextureParameterfEXT)(GLuint texture, GLenum target, GLenum pname, GLfloat param) = NULL;
 89+void (APIENTRY *glTextureParameterfvEXT)(GLuint texture, GLenum target, GLenum pname, const GLfloat *params) = NULL;
 90+void (APIENTRY *glTextureParameteriEXT)(GLuint texture, GLenum target, GLenum pname, GLint param) = NULL;
 91+void (APIENTRY *glTextureParameterivEXT)(GLuint texture, GLenum target, GLenum pname, const GLint *params) = NULL;
 92+void (APIENTRY *glTextureImage2DEXT)(GLuint texture, GLenum target, GLint level, GLenum internalformat,
 93+ GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels) = NULL;
 94+void (APIENTRY *glTextureSubImage2DEXT)(GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset,
 95+ GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels) = NULL;
 96+void (APIENTRY *glMatrixLoadfEXT)(GLenum mode, const GLfloat *m) = NULL;
 97+void (APIENTRY *glMatrixMultfEXT)(GLenum mode, const GLfloat *m) = NULL;
 98+
 99+
88100 int GLEXT_ARB_framebuffer_object = 0;
89101 int GLEXT_EXT_framebuffer_object = 0;
90102 int GLEXT_NV_packed_depth_stencil = 0;
@@ -93,6 +105,7 @@
94106 int GLEXT_NVX_gpu_memory_info = 0;
95107 int GLEXT_ATI_meminfo = 0;
96108 int GLEXT_ARB_ES2_compatibility = 0;
 109+int GLEXT_EXT_direct_state_access = 0;
97110 int glver_major, glver_minor = 0;
98111 bool atimem = false;
99112
@@ -161,14 +174,25 @@
162175 }
163176 const GLubyte *glextensions = glGetString(GL_EXTENSIONS);
164177 if(strstr((char*)glextensions,"GL_ARB_framebuffer_object")) GLEXT_ARB_framebuffer_object = 1;
 178+ else GLEXT_ARB_framebuffer_object = 0;
165179 if(strstr((char*)glextensions,"GL_EXT_framebuffer_object")) GLEXT_EXT_framebuffer_object = 1;
 180+ else GLEXT_EXT_framebuffer_object = 0;
166181 if(strstr((char*)glextensions,"GL_NV_packed_depth_stencil")) GLEXT_NV_packed_depth_stencil = 1;
 182+ else GLEXT_NV_packed_depth_stencil = 0;
167183 if(strstr((char*)glextensions,"GL_EXT_packed_depth_stencil")) GLEXT_EXT_packed_depth_stencil = 1;
 184+ else GLEXT_EXT_packed_depth_stencil = 0;
168185 if(strstr((char*)glextensions,"GL_ARB_depth_buffer_float")) GLEXT_ARB_depth_buffer_float = 1;
 186+ else GLEXT_ARB_depth_buffer_float = 0;
169187 if(strstr((char*)glextensions,"GL_ARB_depth_texture")) GLEXT_ARB_depth_texture = 1;
 188+ else GLEXT_ARB_depth_texture = 0;
170189 if(strstr((char*)glextensions,"GL_NVX_gpu_memory_info")) GLEXT_NVX_gpu_memory_info = 1;
 190+ else GLEXT_NVX_gpu_memory_info = 0;
171191 if(strstr((char*)glextensions,"GL_ATI_meminfo")) GLEXT_ATI_meminfo = 1;
 192+ else GLEXT_ATI_meminfo = 0;
172193 if(strstr((char*)glextensions,"GL_ARB_ES2_compatibility")) GLEXT_ARB_ES2_compatibility = 1;
 194+ else GLEXT_ARB_ES2_compatibility = 0;
 195+ if(strstr((char*)glextensions,"GL_EXT_direct_state_access")) GLEXT_EXT_direct_state_access = 1;
 196+ else GLEXT_EXT_direct_state_access = 0;
173197 bool broken_fbo = true;
174198 if(GLEXT_ARB_framebuffer_object)
175199 {
@@ -194,6 +218,17 @@
195219 glDeleteFramebuffersEXT = (PFNGLDELETEFRAMEBUFFERSEXTPROC)wglGetProcAddress("glDeleteFramebuffersEXT");
196220 broken_fbo = false;
197221 }
 222+ if(GLEXT_EXT_direct_state_access)
 223+ {
 224+ glTextureParameterfEXT = (PFNGLTEXTUREPARAMETERFEXTPROC)wglGetProcAddress("glTextureParameterfEXT");
 225+ glTextureParameterfvEXT = (PFNGLTEXTUREPARAMETERFVEXTPROC)wglGetProcAddress("glTextureParameterfvEXT");
 226+ glTextureParameteriEXT = (PFNGLTEXTUREPARAMETERIEXTPROC)wglGetProcAddress("glTextureParameteriEXT");
 227+ glTextureParameterivEXT = (PFNGLTEXTUREPARAMETERIVEXTPROC)wglGetProcAddress("glTextureParameterivEXT");
 228+ glTextureImage2DEXT = (PFNGLTEXTUREIMAGE2DEXTPROC)wglGetProcAddress("glTextureImage2DEXT");
 229+ glTextureSubImage2DEXT = (PFNGLTEXTURESUBIMAGE2DEXTPROC)wglGetProcAddress("glTextureSubImage2DEXT");
 230+ glMatrixLoadfEXT = (PFNGLMATRIXLOADFEXTPROC)wglGetProcAddress("glMatrixLoadfEXT");
 231+ glMatrixMultfEXT = (PFNGLMATRIXMULTFEXTPROC)wglGetProcAddress("glMatrixMultfEXT");
 232+ }
198233 if(broken_fbo)
199234 {
200235 MessageBox(NULL,_T("DXGL requires support for OpenGL Framebuffer Objects to function. \
Index: ddraw/glExtensions.h
@@ -35,6 +35,7 @@
3636 extern int GLEXT_NVX_gpu_memory_info;
3737 extern int GLEXT_ATI_meminfo;
3838 extern int GLEXT_ARB_ES2_compatibility;
 39+extern int GLEXT_EXT_direct_state_access;
3940 extern int glver_major;
4041 extern int glver_minor;
4142 #define GL_GPU_MEMORY_INFO_DEDICATED_VIDMEM_NVX 0x9047
@@ -112,6 +113,17 @@
113114 GLAPI BOOL (APIENTRY *wglSwapIntervalEXT)(int interval);
114115 GLAPI int (APIENTRY *wglGetSwapIntervalEXT)();
115116
 117+GLAPI void (APIENTRY *glTextureParameterfEXT)(GLuint texture, GLenum target, GLenum pname, GLfloat param);
 118+GLAPI void (APIENTRY *glTextureParameterfvEXT)(GLuint texture, GLenum target, GLenum pname, const GLfloat *params);
 119+GLAPI void (APIENTRY *glTextureParameteriEXT)(GLuint texture, GLenum target, GLenum pname, GLint param);
 120+GLAPI void (APIENTRY *glTextureParameterivEXT)(GLuint texture, GLenum target, GLenum pname, const GLint *params);
 121+GLAPI void (APIENTRY *glTextureImage2DEXT)(GLuint texture, GLenum target, GLint level, GLenum internalformat,
 122+ GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
 123+GLAPI void (APIENTRY *glTextureSubImage2DEXT)(GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset,
 124+ GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels);
 125+GLAPI void (APIENTRY *glMatrixLoadfEXT)(GLenum mode, const GLfloat *m);
 126+GLAPI void (APIENTRY *glMatrixMultfEXT)(GLenum mode, const GLfloat *m);
 127+
116128 void InitGLExt();
117129
118130 #endif //_GLEXTENSIONS_H