DXGL r600 - Code Review

Jump to navigation Jump to search
Repository:DXGL
Revision:r599‎ | r600 | r601 >
Date:01:53, 7 March 2015
Author:admin
Status:new
Tags:
Comment:
Sync renderer when creating a surface.
Fix Depth Fill Blt.
Add large batch Blt test case.
Fix Debug Trace build.
Modified paths:
  • /ddraw/ddraw.vcxproj (modified) (history)
  • /ddraw/glDirectDrawSurface.cpp (modified) (history)
  • /ddraw/glRenderer.cpp (modified) (history)
  • /dxgltest/Tests2D.cpp (modified) (history)
  • /dxgltest/dxgltest.cpp (modified) (history)

Diff [purge]

Index: ddraw/ddraw.vcxproj
@@ -191,7 +191,7 @@
192192 <SubSystem>Windows</SubSystem>
193193 <GenerateDebugInformation>true</GenerateDebugInformation>
194194 <ModuleDefinitionFile>ddraw.def</ModuleDefinitionFile>
195 - <AdditionalDependencies>$(OutDir)libMinHook.x86.lib;$(OutDir)cfgmgr.lib;glu32.lib;opengl32.lib;winmm.lib;%(AdditionalDependencies)</AdditionalDependencies>
 195+ <AdditionalDependencies>$(OutDir)..\Debug\libMinHook.x86.lib;$(OutDir)cfgmgr.lib;glu32.lib;opengl32.lib;winmm.lib;%(AdditionalDependencies)</AdditionalDependencies>
196196 <ImportLibrary>$(OutDir)ddraw.lib</ImportLibrary>
197197 </Link>
198198 <PostBuildEvent />
Index: ddraw/glDirectDrawSurface.cpp
@@ -401,6 +401,7 @@
402402 glDirectDrawSurface7::~glDirectDrawSurface7()
403403 {
404404 TRACE_ENTER(1,14,this);
 405+ glRenderer_Sync(ddInterface->renderer, 0);
405406 AddRef();
406407 if (dds1) delete dds1;
407408 if (dds2) delete dds2;
Index: ddraw/glRenderer.cpp
@@ -816,7 +816,7 @@
817817 EnterCriticalSection(&This->commandcs);
818818 RECT emptyrect = nullrect;
819819 if (!lpDestRect) lpDestRect = &emptyrect;
820 - glRenderer_AddQueue(This, OP_DEPTHFILL, 0, 4 + (sizeof(RECT) / 4) + (sizeof(DDBLTFX) / 4),
 820+ glRenderer_AddQueue(This, OP_DEPTHFILL, 0, 6 + (sizeof(RECT) / 4) + (sizeof(DDBLTFX) / 4),
821821 3, 4, dest, sizeof(RECT), lpDestRect, sizeof(DDBLTFX), lpDDBltFx);
822822 LeaveCriticalSection(&This->commandcs);
823823 }
Index: dxgltest/Tests2D.cpp
@@ -39,7 +39,8 @@
4040 static HWND hWnd;
4141 static int testnum;
4242 static unsigned int randnum;
43 -static int testtypes[] = {0,1,0,1,0,1,2};
 43+static int testtypes[] = {0,1,0,1,0,1,2,2,2,1};
 44+static DWORD counter;
4445
4546 static DDSPRITE sprites[16];
4647
@@ -678,6 +679,17 @@
679680 ddinterface->CreateSurface(&sprites[0].ddsd, &sprites[0].surface, NULL);
680681 DrawRotatedBlt(ddsrender, sprites);
681682 break;
 683+ case 9:
 684+ ddsrender->GetSurfaceDesc(&ddsd);
 685+ sprites[0].ddsd.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH;
 686+ sprites[0].ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN;
 687+ if (ddver > 3) sprites[0].ddsd.dwSize = sizeof(DDSURFACEDESC2);
 688+ else sprites[0].ddsd.dwSize = sizeof(DDSURFACEDESC);
 689+ sprites[0].ddsd.dwWidth = sprites[0].ddsd.dwHeight =
 690+ sprites[0].rect.right = sprites[0].rect.bottom = 255;
 691+ ddinterface->CreateSurface(&sprites[0].ddsd, &sprites[0].surface, NULL);
 692+ counter = 0;
 693+ break;
682694 }
683695 }
684696
@@ -737,6 +749,7 @@
738750 error = ddsrender->GetSurfaceDesc(&ddsd);
739751 MultiDirectDrawSurface *temp1 = NULL;
740752 DDSCAPS2 ddscaps;
 753+ DWORD bitmask;
741754 ZeroMemory(&ddscaps,sizeof(DDSCAPS2));
742755 ddscaps.dwCaps = DDSCAPS_BACKBUFFER;
743756 int op;
@@ -852,6 +865,52 @@
853866 if(ddsurface && ddsrender)error = ddsurface->Blt(&destrect,ddsrender,&srcrect,DDBLT_WAIT,NULL);
854867 }
855868 break;
 869+ case 9:
 870+ bltfx.dwSize = sizeof(DDBLTFX);
 871+ switch (bpp)
 872+ {
 873+ case 8:
 874+ bitmask = 0xFF;
 875+ break;
 876+ case 15:
 877+ bitmask = 0x7FFF;
 878+ break;
 879+ case 16:
 880+ bitmask = 0xFFFF;
 881+ break;
 882+ case 24:
 883+ bitmask = 0xFFFFFF;
 884+ break;
 885+ case 32:
 886+ default:
 887+ bitmask = 0xFFFFFFFF;
 888+ break;
 889+ }
 890+ for (int y = 0; y < 255; y++)
 891+ {
 892+ for (int x = 0; x < 255; x++)
 893+ {
 894+ bltfx.dwFillColor = counter & bitmask;
 895+ destrect.left = x;
 896+ destrect.right = x + 1;
 897+ destrect.top = y;
 898+ destrect.bottom = y + 1;
 899+ counter++;
 900+ sprites[0].surface->Blt(&destrect, NULL, NULL, DDBLT_COLORFILL, &bltfx);
 901+ }
 902+ }
 903+ ddsrender->Blt(NULL, sprites[0].surface, NULL, DDBLT_WAIT, NULL);
 904+ if (!fullscreen)
 905+ {
 906+ p.x = 0;
 907+ p.y = 0;
 908+ ClientToScreen(hWnd, &p);
 909+ GetClientRect(hWnd, &destrect);
 910+ OffsetRect(&destrect, p.x, p.y);
 911+ SetRect(&srcrect, 0, 0, width, height);
 912+ if (ddsurface && ddsrender)error = ddsurface->Blt(&destrect, ddsrender, &srcrect, DDBLT_WAIT, NULL);
 913+ }
 914+ break;
856915 }
857916 if(temp1) temp1->Release();
858917 }
Index: dxgltest/dxgltest.cpp
@@ -227,7 +227,8 @@
228228 {1, 7, 0, 0, false, 0.0, false, false, _T("Random color fill Blt() paterns")},
229229 {1, 7, 0, 0, false, 0.0, false, false, _T("Mouse pointer event test")},
230230 {1, 7, 1, 1, true, 1.0, false, false, _T("Raster Operation Blt() test")},
231 - {1, 7, 0, 0, false, 0.0, false, false, _T("Mirrored and Rotated Blt() test")}
 231+ {1, 7, 0, 0, false, 0.0, false, false, _T("Mirrored and Rotated Blt() test")},
 232+ {1, 7, 0, 1, false, 0.0, false, false, _T("Large batch color fill Blt() operations")}
232233 };
233234 const int END_2D = __LINE__ - 4;
234235 const int numtests2d = END_2D - START_2D;