DXGL r240 - Code Review

Jump to navigation Jump to search
Repository:DXGL
Revision:r239‎ | r240 | r241 >
Date:22:31, 13 August 2012
Author:admin
Status:new
Tags:
Comment:
Add GetAvailableVidMem.
Add caps bits for blend modes.
Modified paths:
  • /ddraw/glDirect3D.cpp (modified) (history)
  • /ddraw/glDirectDraw.cpp (modified) (history)
  • /ddraw/glExtensions.cpp (modified) (history)
  • /ddraw/glExtensions.h (modified) (history)

Diff [purge]

Index: ddraw/glDirect3D.cpp
@@ -36,8 +36,14 @@
3737 0, // dwMiscCaps
3838 D3DPRASTERCAPS_SUBPIXEL | D3DPRASTERCAPS_ZTEST, //dwRasterCaps
3939 D3DPCMPCAPS_LESSEQUAL, //dwZCmpCaps
40 - 0, //dwSrcBlendCaps
41 - 0, //dwDestBlendCaps
 40+ D3DPBLENDCAPS_ZERO | D3DPBLENDCAPS_ONE | D3DPBLENDCAPS_SRCCOLOR | D3DPBLENDCAPS_INVSRCCOLOR |
 41+ D3DPBLENDCAPS_SRCALPHA | D3DPBLENDCAPS_INVSRCALPHA | D3DPBLENDCAPS_DESTALPHA |
 42+ D3DPBLENDCAPS_INVDESTALPHA | D3DPBLENDCAPS_DESTCOLOR | D3DPBLENDCAPS_INVDESTCOLOR |
 43+ D3DPBLENDCAPS_SRCALPHASAT | D3DPBLENDCAPS_BOTHSRCALPHA | D3DPBLENDCAPS_BOTHINVSRCALPHA, //dwSrcBlendCaps
 44+ D3DPBLENDCAPS_ZERO | D3DPBLENDCAPS_ONE | D3DPBLENDCAPS_SRCCOLOR | D3DPBLENDCAPS_INVSRCCOLOR |
 45+ D3DPBLENDCAPS_SRCALPHA | D3DPBLENDCAPS_INVSRCALPHA | D3DPBLENDCAPS_DESTALPHA |
 46+ D3DPBLENDCAPS_INVDESTALPHA | D3DPBLENDCAPS_DESTCOLOR | D3DPBLENDCAPS_INVDESTCOLOR |
 47+ D3DPBLENDCAPS_SRCALPHASAT | D3DPBLENDCAPS_BOTHSRCALPHA | D3DPBLENDCAPS_BOTHINVSRCALPHA, //dwDestBlendCaps
4248 0, //dwAlphaCmpCaps
4349 D3DPSHADECAPS_COLORGOURAUDRGB, //dwShadeCaps
4450 D3DPTEXTURECAPS_PERSPECTIVE, //dwTextureCaps
@@ -55,8 +61,14 @@
5662 0, // dwMiscCaps
5763 D3DPRASTERCAPS_SUBPIXEL | D3DPRASTERCAPS_ZTEST, //dwRasterCaps
5864 D3DPCMPCAPS_LESSEQUAL, //dwZCmpCaps
59 - 0, //dwSrcBlendCaps
60 - 0, //dwDestBlendCaps
 65+ D3DPBLENDCAPS_ZERO | D3DPBLENDCAPS_ONE | D3DPBLENDCAPS_SRCCOLOR | D3DPBLENDCAPS_INVSRCCOLOR |
 66+ D3DPBLENDCAPS_SRCALPHA | D3DPBLENDCAPS_INVSRCALPHA | D3DPBLENDCAPS_DESTALPHA |
 67+ D3DPBLENDCAPS_INVDESTALPHA | D3DPBLENDCAPS_DESTCOLOR | D3DPBLENDCAPS_INVDESTCOLOR |
 68+ D3DPBLENDCAPS_SRCALPHASAT | D3DPBLENDCAPS_BOTHSRCALPHA | D3DPBLENDCAPS_BOTHINVSRCALPHA, //dwSrcBlendCaps
 69+ D3DPBLENDCAPS_ZERO | D3DPBLENDCAPS_ONE | D3DPBLENDCAPS_SRCCOLOR | D3DPBLENDCAPS_INVSRCCOLOR |
 70+ D3DPBLENDCAPS_SRCALPHA | D3DPBLENDCAPS_INVSRCALPHA | D3DPBLENDCAPS_DESTALPHA |
 71+ D3DPBLENDCAPS_INVDESTALPHA | D3DPBLENDCAPS_DESTCOLOR | D3DPBLENDCAPS_INVDESTCOLOR |
 72+ D3DPBLENDCAPS_SRCALPHASAT | D3DPBLENDCAPS_BOTHSRCALPHA | D3DPBLENDCAPS_BOTHINVSRCALPHA, //dwDestBlendCaps
6173 0, //dwAlphaCmpCaps
6274 D3DPSHADECAPS_COLORGOURAUDRGB, //dwShadeCaps
6375 D3DPTEXTURECAPS_PERSPECTIVE, //dwTextureCaps
Index: ddraw/glDirectDraw.cpp
@@ -1342,8 +1342,20 @@
13431343 HRESULT WINAPI glDirectDraw7::GetAvailableVidMem(LPDDSCAPS2 lpDDSCaps2, LPDWORD lpdwTotal, LPDWORD lpdwFree)
13441344 {
13451345 if(!this) return DDERR_INVALIDPARAMS;
1346 - FIXME("IDirectDraw::GetAvailableVidMem: stub\n");
1347 - ERR(DDERR_GENERIC);
 1346+ if(GLEXT_NVX_gpu_memory_info)
 1347+ {
 1348+ if(lpdwTotal) glGetIntegerv(GL_GPU_MEMORY_INFO_DEDICATED_VIDMEM_NVX,(GLint*)lpdwTotal);
 1349+ if(lpdwFree) glGetIntegerv(GL_GPU_MEMORY_INFO_CURRENT_AVAILABLE_VIDMEM_NVX,(GLint*)lpdwFree);
 1350+ return DD_OK;
 1351+ }
 1352+ else
 1353+ {
 1354+ MEMORYSTATUS memstat;
 1355+ GlobalMemoryStatus(&memstat);
 1356+ if(lpdwTotal) *lpdwTotal = memstat.dwTotalVirtual;
 1357+ if(lpdwFree) *lpdwFree = memstat.dwAvailVirtual;
 1358+ return DD_OK;
 1359+ }
13481360 }
13491361 HRESULT WINAPI glDirectDraw7::GetSurfaceFromDC(HDC hdc, LPDIRECTDRAWSURFACE7 *lpDDS)
13501362 {
Index: ddraw/glExtensions.cpp
@@ -89,7 +89,10 @@
9090 int GLEXT_EXT_packed_depth_stencil = 0;
9191 int GLEXT_ARB_depth_buffer_float = 0;
9292 int GLEXT_ARB_depth_texture = 0;
 93+int GLEXT_NVX_gpu_memory_info = 0;
 94+int GLEXT_ATI_meminfo = 0;
9395 int glver_major, glver_minor = 0;
 96+bool atimem = false;
9497
9598 void InitGLExt()
9699 {
@@ -159,6 +162,8 @@
160163 if(strstr((char*)glextensions,"GL_EXT_packed_depth_stencil")) GLEXT_EXT_packed_depth_stencil = 1;
161164 if(strstr((char*)glextensions,"GL_ARB_depth_buffer_float")) GLEXT_ARB_depth_buffer_float = 1;
162165 if(strstr((char*)glextensions,"GL_ARB_depth_texture")) GLEXT_ARB_depth_texture = 1;
 166+ if(strstr((char*)glextensions,"GL_NVX_gpu_memory_info")) GLEXT_NVX_gpu_memory_info = 1;
 167+ if(strstr((char*)glextensions,"GL_ATI_meminfo")) GLEXT_ATI_meminfo = 1;
163168 bool broken_fbo = true;
164169 if(GLEXT_ARB_framebuffer_object)
165170 {
Index: ddraw/glExtensions.h
@@ -32,6 +32,10 @@
3333 extern int GLEXT_EXT_packed_depth_stencil;
3434 extern int GLEXT_ARB_depth_buffer_float;
3535 extern int GLEXT_ARB_depth_texture;
 36+extern int GLEXT_NVX_gpu_memory_info;
 37+extern int GLEXT_ATI_meminfo;
 38+#define GL_GPU_MEMORY_INFO_DEDICATED_VIDMEM_NVX 0x9047
 39+#define GL_GPU_MEMORY_INFO_CURRENT_AVAILABLE_VIDMEM_NVX 0x9049
3640
3741 #ifdef __GNUC__
3842 #undef GLAPI