DXGL r903 - Code Review

Jump to navigation Jump to search
Repository:DXGL
Revision:r902‎ | r903 | r904 >
Date:20:11, 10 March 2019
Author:admin
Status:new
Tags:
Comment:
Add detection for OpenGL rectangle textures.
Modified paths:
  • /ddraw/glExtensions.c (modified) (history)
  • /ddraw/struct.h (modified) (history)

Diff [purge]

Index: ddraw/glExtensions.c
@@ -35,6 +35,7 @@
3636 const GLubyte *glversion;
3737 const GLubyte *glextensions;
3838 BOOL broken_fbo;
 39+ BOOL broken_texrect;
3940 ZeroMemory(ext, sizeof(glExtensions));
4041 ext->atimem = FALSE;
4142 glversion = glGetString(GL_VERSION);
@@ -130,6 +131,9 @@
131132 if(strstr((char*)glextensions,"GL_EXT_framebuffer_object") && !dxglcfg.DebugNoExtFramebuffer)
132133 ext->GLEXT_EXT_framebuffer_object = 1;
133134 else ext->GLEXT_EXT_framebuffer_object = 0;
 135+ if (strstr((char*)glextensions, "GL_ARB_texture_rectangle") || (ext->glver_major > 3) ||
 136+ ((ext->glver_major == 3) && (ext->glver_minor == 1))) ext->GLEXT_ARB_texture_rectangle = 1;
 137+ else ext->GLEXT_ARB_texture_rectangle = 0;
134138 if(strstr((char*)glextensions,"GL_NV_packed_depth_stencil")) ext->GLEXT_NV_packed_depth_stencil = 1;
135139 else ext->GLEXT_NV_packed_depth_stencil = 0;
136140 if(strstr((char*)glextensions,"GL_EXT_packed_depth_stencil")) ext->GLEXT_EXT_packed_depth_stencil = 1;
@@ -188,6 +192,8 @@
189193 ext->glDeleteFramebuffersEXT = (PFNGLDELETEFRAMEBUFFERSEXTPROC)wglGetProcAddress("glDeleteFramebuffersEXT");
190194 broken_fbo = FALSE;
191195 }
 196+ broken_texrect = TRUE;
 197+ if (ext->GLEXT_ARB_texture_rectangle) broken_texrect = FALSE;
192198 if(ext->GLEXT_EXT_direct_state_access)
193199 {
194200 ext->glTextureParameterfEXT = (PFNGLTEXTUREPARAMETERFEXTPROC)wglGetProcAddress("glTextureParameterfEXT");
@@ -240,6 +246,13 @@
241247 MB_OK|MB_ICONERROR);
242248 ExitProcess(-1);
243249 }
 250+ if(broken_texrect)
 251+ {
 252+ MessageBox(NULL, _T("DXGL requires support for OpenGL Rectangle Textures to function.\n\n\
 253+Please contact your graphics card manufacturer for an updated driver.\n\nThis program will now exit."), _T("Fatal error"),
 254+MB_OK | MB_ICONERROR);
 255+ ExitProcess(-1);
 256+ }
244257 ext->wglSwapIntervalEXT = (PFNWGLSWAPINTERVALEXTPROC)wglGetProcAddress("wglSwapIntervalEXT");
245258 ext->wglGetSwapIntervalEXT = (PFNWGLGETSWAPINTERVALEXTPROC)wglGetProcAddress("wglGetSwapIntervalEXT");
246259 if((!ext->wglSwapIntervalEXT) || (!ext->wglGetSwapIntervalEXT))
Index: ddraw/struct.h
@@ -159,6 +159,7 @@
160160
161161 int GLEXT_ARB_framebuffer_object;
162162 int GLEXT_EXT_framebuffer_object;
 163+ int GLEXT_ARB_texture_rectangle;
163164 int GLEXT_NV_packed_depth_stencil;
164165 int GLEXT_EXT_packed_depth_stencil;
165166 int GLEXT_ARB_depth_buffer_float;