DXGL r807 - Code Review

Jump to navigation Jump to search
Repository:DXGL
Revision:r806‎ | r807 | r808 >
Date:19:27, 29 April 2018
Author:admin
Status:new
Tags:
Comment:
Delete obsolete DXGL Test project from source folder.
Modified paths:

Diff [purge]

Index: dxgltest/dxgltest.vcxproj.filters
@@ -1,85 +0,0 @@
2 -<?xml version="1.0" encoding="utf-8"?>
3 -<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
4 - <ItemGroup>
5 - <Filter Include="Source Files">
6 - <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
7 - <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
8 - </Filter>
9 - <Filter Include="Header Files">
10 - <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
11 - <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
12 - </Filter>
13 - <Filter Include="Resource Files">
14 - <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
15 - <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
16 - </Filter>
17 - </ItemGroup>
18 - <ItemGroup>
19 - <None Include="ReadMe.txt" />
20 - </ItemGroup>
21 - <ItemGroup>
22 - <ClInclude Include="Resource.h">
23 - <Filter>Header Files</Filter>
24 - </ClInclude>
25 - <ClInclude Include="dxgltest.h">
26 - <Filter>Header Files</Filter>
27 - </ClInclude>
28 - <ClInclude Include="tests.h">
29 - <Filter>Header Files</Filter>
30 - </ClInclude>
31 - <ClInclude Include="surfacegen.h">
32 - <Filter>Header Files</Filter>
33 - </ClInclude>
34 - <ClInclude Include="common.h">
35 - <Filter>Header Files</Filter>
36 - </ClInclude>
37 - <ClInclude Include="palette.h">
38 - <Filter>Header Files</Filter>
39 - </ClInclude>
40 - <ClInclude Include="MultiDD.h">
41 - <Filter>Header Files</Filter>
42 - </ClInclude>
43 - <ClInclude Include="timer.h">
44 - <Filter>Header Files</Filter>
45 - </ClInclude>
46 - <ClInclude Include="misc.h">
47 - <Filter>Header Files</Filter>
48 - </ClInclude>
49 - </ItemGroup>
50 - <ItemGroup>
51 - <ClCompile Include="dxgltest.cpp">
52 - <Filter>Source Files</Filter>
53 - </ClCompile>
54 - <ClCompile Include="surfacegen.cpp">
55 - <Filter>Source Files</Filter>
56 - </ClCompile>
57 - <ClCompile Include="palette.cpp">
58 - <Filter>Source Files</Filter>
59 - </ClCompile>
60 - <ClCompile Include="precomp.cpp">
61 - <Filter>Source Files</Filter>
62 - </ClCompile>
63 - <ClCompile Include="MultiDD.cpp">
64 - <Filter>Source Files</Filter>
65 - </ClCompile>
66 - <ClCompile Include="timer.cpp">
67 - <Filter>Source Files</Filter>
68 - </ClCompile>
69 - <ClCompile Include="dxguid.cpp">
70 - <Filter>Source Files</Filter>
71 - </ClCompile>
72 - <ClCompile Include="tests.cpp">
73 - <Filter>Source Files</Filter>
74 - </ClCompile>
75 - </ItemGroup>
76 - <ItemGroup>
77 - <ResourceCompile Include="dxgltest.rc">
78 - <Filter>Resource Files</Filter>
79 - </ResourceCompile>
80 - </ItemGroup>
81 - <ItemGroup>
82 - <Manifest Include="xp.manifest">
83 - <Filter>Resource Files</Filter>
84 - </Manifest>
85 - </ItemGroup>
86 -</Project>
\ No newline at end of file
Index: dxgltest/dxgltest.rc
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes on: dxgltest/dxgltest.rc
___________________________________________________________________
Deleted: svn:mime-type
## -1 +0,0 ##
87 -application/octet-stream
\ No newline at end of property
Index: dxgltest/timer.cpp
@@ -1,70 +0,0 @@
2 -// DXGL
3 -// Copyright (C) 2011 William Feely
4 -
5 -// This library is free software; you can redistribute it and/or
6 -// modify it under the terms of the GNU Lesser General Public
7 -// License as published by the Free Software Foundation; either
8 -// version 2.1 of the License, or (at your option) any later version.
9 -
10 -// This library is distributed in the hope that it will be useful,
11 -// but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 -// Lesser General Public License for more details.
14 -
15 -// You should have received a copy of the GNU Lesser General Public
16 -// License along with this library; if not, write to the Free Software
17 -// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 -
19 -#include "common.h"
20 -#include <MMSystem.h>
21 -#include "timer.h"
22 -
23 -UINT msg;
24 -double delay;
25 -double lasttime;
26 -double nexttime;
27 -bool stoptimer = true;
28 -HANDLE hThread = NULL;
29 -HWND TimerhWnd;
30 -UINT wndMessage;
31 -
32 -
33 -DWORD WINAPI TimerThread(LPVOID params)
34 -{
35 - int sleeptime;
36 - lasttime = timeGetTime();
37 - nexttime = lasttime + delay;
38 -loop:
39 - while(stoptimer == false)
40 - {
41 - lasttime = timeGetTime();
42 - sleeptime = (int)(nexttime - lasttime - 1);
43 - if(sleeptime > 0) Sleep(sleeptime);
44 - while(nexttime > lasttime)
45 - lasttime = timeGetTime();
46 - SendMessage(TimerhWnd,wndMessage,0,0);
47 - lasttime = timeGetTime();
48 - if(lasttime > nexttime + delay) nexttime = lasttime;
49 - else nexttime += delay;
50 - }
51 - hThread = NULL;
52 - if(!stoptimer) goto loop;
53 - return 0;
54 -}
55 -
56 -void StartTimer(HWND hWnd, UINT message, double framerate)
57 -{
58 - TimerhWnd = hWnd;
59 - wndMessage = message;
60 - delay = (1.0/framerate)*1000.0;
61 - stoptimer = false;
62 - if(!hThread)
63 - {
64 - hThread = CreateThread(NULL,0,TimerThread,NULL,0,NULL);
65 - CloseHandle(hThread);
66 - }
67 -}
68 -void StopTimer()
69 -{
70 - stoptimer = true;
71 -}
Index: dxgltest/surfacegen.cpp
@@ -1,1610 +0,0 @@
2 -// DXGL
3 -// Copyright (C) 2011-2013 William Feely
4 -
5 -// This library is free software; you can redistribute it and/or
6 -// modify it under the terms of the GNU Lesser General Public
7 -// License as published by the Free Software Foundation; either
8 -// version 2.1 of the License, or (at your option) any later version.
9 -
10 -// This library is distributed in the hope that it will be useful,
11 -// but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 -// Lesser General Public License for more details.
14 -
15 -// You should have received a copy of the GNU Lesser General Public
16 -// License along with this library; if not, write to the Free Software
17 -// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 -
19 -#include "common.h"
20 -#include "MultiDD.h"
21 -#include "tests.h"
22 -#include "surfacegen.h"
23 -
24 -#ifndef GRADIENT_FILL_RECT_H
25 -#define GRADIENT_FILL_RECT_H 0
26 -#endif
27 -
28 -inline int NextMultipleOf4(int number){return ((number+3) & (~3));}
29 -
30 -const unsigned char dxgl_logo_bw[] = {
31 -0x82,0x21,0x41,0x42,0x20,0x84,0x11,0x48,0x0a,0x30,0xe4,0x2e,0x92,0x50,0x91,
32 -0x90,0x91,0x97,0x92,0x51,0xe4,0x2e,0x09,0x10,0x11,0x08,0x21,0x04,0x41,0x02,
33 -0x81,0xe1
34 -};
35 -
36 -const unsigned char blt_pattern_8[] = {
37 - 0xED, 0xED, 0xED, 0xF8, 0xF8, 0xF8,
38 - 0xED, 0xED, 0xED, 0xF8, 0xF8, 0xF8,
39 - 0xED, 0xED, 0xED, 0xF8, 0xF8, 0xF8,
40 - 0xF8, 0xF8, 0xF8, 0xED, 0xED, 0xED,
41 - 0xF8, 0xF8, 0xF8, 0xED, 0xED, 0xED,
42 - 0xF8, 0xF8, 0xF8, 0xED, 0xED, 0xED
43 -};
44 -
45 -const unsigned short blt_pattern_15[] = {
46 - 0x7DFF, 0x7DFF, 0x7DFF, 0x3DEF, 0x3DEF, 0x3DEF,
47 - 0x7DFF, 0x7DFF, 0x7DFF, 0x3DEF, 0x3DEF, 0x3DEF,
48 - 0x7DFF, 0x7DFF, 0x7DFF, 0x3DEF, 0x3DEF, 0x3DEF,
49 - 0x3DEF, 0x3DEF, 0x3DEF, 0x7DFF, 0x7DFF, 0x7DFF,
50 - 0x3DEF, 0x3DEF, 0x3DEF, 0x7DFF, 0x7DFF, 0x7DFF,
51 - 0x3DEF, 0x3DEF, 0x3DEF, 0x7DFF, 0x7DFF, 0x7DFF
52 -};
53 -
54 -const unsigned short blt_pattern_16[] = {
55 - 0xFBFF, 0xFBFF, 0xFBFF, 0x7BEF, 0x7BEF, 0x7BEF,
56 - 0xFBFF, 0xFBFF, 0xFBFF, 0x7BEF, 0x7BEF, 0x7BEF,
57 - 0xFBFF, 0xFBFF, 0xFBFF, 0x7BEF, 0x7BEF, 0x7BEF,
58 - 0x7BEF, 0x7BEF, 0x7BEF, 0xFBFF, 0xFBFF, 0xFBFF,
59 - 0x7BEF, 0x7BEF, 0x7BEF, 0xFBFF, 0xFBFF, 0xFBFF,
60 - 0x7BEF, 0x7BEF, 0x7BEF, 0xFBFF, 0xFBFF, 0xFBFF
61 -};
62 -
63 -const unsigned char blt_pattern_24[] = {
64 - 0xFF, 0x7F, 0xFF, 0xFF, 0x7F, 0xFF, 0xFF, 0x7F, 0xFF, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F,
65 - 0xFF, 0x7F, 0xFF, 0xFF, 0x7F, 0xFF, 0xFF, 0x7F, 0xFF, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F,
66 - 0xFF, 0x7F, 0xFF, 0xFF, 0x7F, 0xFF, 0xFF, 0x7F, 0xFF, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F,
67 - 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0xFF, 0x7F, 0xFF, 0xFF, 0x7F, 0xFF, 0xFF, 0x7F, 0xFF,
68 - 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0xFF, 0x7F, 0xFF, 0xFF, 0x7F, 0xFF, 0xFF, 0x7F, 0xFF,
69 - 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0xFF, 0x7F, 0xFF, 0xFF, 0x7F, 0xFF, 0xFF, 0x7F, 0xFF
70 -};
71 -
72 -const unsigned long blt_pattern_32[] = {
73 - 0xFF7FFF, 0xFF7FFF, 0xFF7FFF, 0x7F7F7F, 0x7F7F7F, 0x7F7F7F,
74 - 0xFF7FFF, 0xFF7FFF, 0xFF7FFF, 0x7F7F7F, 0x7F7F7F, 0x7F7F7F,
75 - 0xFF7FFF, 0xFF7FFF, 0xFF7FFF, 0x7F7F7F, 0x7F7F7F, 0x7F7F7F,
76 - 0x7F7F7F, 0x7F7F7F, 0x7F7F7F, 0xFF7FFF, 0xFF7FFF, 0xFF7FFF,
77 - 0x7F7F7F, 0x7F7F7F, 0x7F7F7F, 0xFF7FFF, 0xFF7FFF, 0xFF7FFF,
78 - 0x7F7F7F, 0x7F7F7F, 0x7F7F7F, 0xFF7FFF, 0xFF7FFF, 0xFF7FFF
79 -};
80 -
81 -const unsigned char back_pattern_8[] = {
82 - 0xF8, 0xF8, 0xF8, 0xF8, 0x07, 0x07, 0x07, 0x07,
83 - 0xF8, 0xF8, 0xF8, 0xF8, 0x07, 0x07, 0x07, 0x07,
84 - 0xF8, 0xF8, 0xF8, 0xF8, 0x07, 0x07, 0x07, 0x07,
85 - 0xF8, 0xF8, 0xF8, 0xF8, 0x07, 0x07, 0x07, 0x07,
86 - 0x07, 0x07, 0x07, 0x07, 0xF8, 0xF8, 0xF8, 0xF8,
87 - 0x07, 0x07, 0x07, 0x07, 0xF8, 0xF8, 0xF8, 0xF8,
88 - 0x07, 0x07, 0x07, 0x07, 0xF8, 0xF8, 0xF8, 0xF8,
89 - 0x07, 0x07, 0x07, 0x07, 0xF8, 0xF8, 0xF8, 0xF8
90 -};
91 -
92 -const unsigned short back_pattern_15[] = {
93 - 0x3DEF, 0x3DEF, 0x3DEF, 0x3DEF, 0x6318, 0x6318, 0x6318, 0x6318,
94 - 0x3DEF, 0x3DEF, 0x3DEF, 0x3DEF, 0x6318, 0x6318, 0x6318, 0x6318,
95 - 0x3DEF, 0x3DEF, 0x3DEF, 0x3DEF, 0x6318, 0x6318, 0x6318, 0x6318,
96 - 0x3DEF, 0x3DEF, 0x3DEF, 0x3DEF, 0x6318, 0x6318, 0x6318, 0x6318,
97 - 0x6318, 0x6318, 0x6318, 0x6318, 0x3DEF, 0x3DEF, 0x3DEF, 0x3DEF,
98 - 0x6318, 0x6318, 0x6318, 0x6318, 0x3DEF, 0x3DEF, 0x3DEF, 0x3DEF,
99 - 0x6318, 0x6318, 0x6318, 0x6318, 0x3DEF, 0x3DEF, 0x3DEF, 0x3DEF,
100 - 0x6318, 0x6318, 0x6318, 0x6318, 0x3DEF, 0x3DEF, 0x3DEF, 0x3DEF
101 -};
102 -
103 -const unsigned short back_pattern_16[] = {
104 - 0x7BEF, 0x7BEF, 0x7BEF, 0x7BEF, 0xC618, 0xC618, 0xC618, 0xC618,
105 - 0x7BEF, 0x7BEF, 0x7BEF, 0x7BEF, 0xC618, 0xC618, 0xC618, 0xC618,
106 - 0x7BEF, 0x7BEF, 0x7BEF, 0x7BEF, 0xC618, 0xC618, 0xC618, 0xC618,
107 - 0x7BEF, 0x7BEF, 0x7BEF, 0x7BEF, 0xC618, 0xC618, 0xC618, 0xC618,
108 - 0xC618, 0xC618, 0xC618, 0xC618, 0x7BEF, 0x7BEF, 0x7BEF, 0x7BEF,
109 - 0xC618, 0xC618, 0xC618, 0xC618, 0x7BEF, 0x7BEF, 0x7BEF, 0x7BEF,
110 - 0xC618, 0xC618, 0xC618, 0xC618, 0x7BEF, 0x7BEF, 0x7BEF, 0x7BEF,
111 - 0xC618, 0xC618, 0xC618, 0xC618, 0x7BEF, 0x7BEF, 0x7BEF, 0x7BEF
112 -};
113 -
114 -const unsigned short back_pattern_24[] = {
115 - 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0,
116 - 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0,
117 - 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0,
118 - 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0,
119 - 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F,
120 - 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F,
121 - 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F,
122 - 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F
123 -};
124 -
125 -const unsigned long back_pattern_32[] = {
126 - 0x7F7F7F, 0x7F7F7F, 0x7F7F7F, 0x7F7F7F, 0xC0C0C0, 0xC0C0C0, 0xC0C0C0, 0xC0C0C0,
127 - 0x7F7F7F, 0x7F7F7F, 0x7F7F7F, 0x7F7F7F, 0xC0C0C0, 0xC0C0C0, 0xC0C0C0, 0xC0C0C0,
128 - 0x7F7F7F, 0x7F7F7F, 0x7F7F7F, 0x7F7F7F, 0xC0C0C0, 0xC0C0C0, 0xC0C0C0, 0xC0C0C0,
129 - 0x7F7F7F, 0x7F7F7F, 0x7F7F7F, 0x7F7F7F, 0xC0C0C0, 0xC0C0C0, 0xC0C0C0, 0xC0C0C0,
130 - 0xC0C0C0, 0xC0C0C0, 0xC0C0C0, 0xC0C0C0, 0x7F7F7F, 0x7F7F7F, 0x7F7F7F, 0x7F7F7F,
131 - 0xC0C0C0, 0xC0C0C0, 0xC0C0C0, 0xC0C0C0, 0x7F7F7F, 0x7F7F7F, 0x7F7F7F, 0x7F7F7F,
132 - 0xC0C0C0, 0xC0C0C0, 0xC0C0C0, 0xC0C0C0, 0x7F7F7F, 0x7F7F7F, 0x7F7F7F, 0x7F7F7F,
133 - 0xC0C0C0, 0xC0C0C0, 0xC0C0C0, 0xC0C0C0, 0x7F7F7F, 0x7F7F7F, 0x7F7F7F, 0x7F7F7F
134 -};
135 -
136 -static const DWORD rop_codes[256] = {
137 - 0x00000042, 0x00010289, 0x00020C89, 0x000300AA, 0x00040C88, 0x000500A9, 0x00060865, 0x000702C5,
138 - 0x00080F08, 0x00090245, 0x000A0329, 0x000B0B2A, 0x000C0324, 0x000D0B25, 0x000E08A5, 0x000F0001,
139 - 0x00100C85, 0x001100A6, 0x00120868, 0x001302C8, 0x00140869, 0x001502C9, 0x00165CCA, 0x00171D54,
140 - 0x00180D59, 0x00191CC8, 0x001A06C5, 0x001B0768, 0x001C06CA, 0x001D0766, 0x001E01A5, 0x001F0385,
141 - 0x00200F09, 0x00210248, 0x00220326, 0x00230B24, 0x00240D55, 0x00251CC5, 0x002606C8, 0x00271868,
142 - 0x00280369, 0x002916CA, 0x002A0CC9, 0x002B1D58, 0x002C0784, 0x002D060A, 0x002E064A, 0x002F0E2A,
143 - 0x0030032A, 0x00310B28, 0x00320688, 0x00330008, 0x003406C4, 0x00351864, 0x003601A8, 0x00370388,
144 - 0x0038078A, 0x00390604, 0x003A0644, 0x003B0E24, 0x003C004A, 0x003D18A4, 0x003E1B24, 0x003F00EA,
145 - 0x00400F0A, 0x00410249, 0x00420D5D, 0x00431CC4, 0x00440328, 0x00450B29, 0x004606C6, 0x0047076A,
146 - 0x00480368, 0x004916C5, 0x004A0789, 0x004B0605, 0x004C0CC8, 0x004D1954, 0x004E0645, 0x004F0E25,
147 - 0x00500325, 0x00510B26, 0x005206C9, 0x00530764, 0x005408A9, 0x00550009, 0x005601A9, 0x00570389,
148 - 0x00580785, 0x00590609, 0x005A0049, 0x005B18A9, 0x005C0649, 0x005D0E29, 0x005E1B29, 0x005F00E9,
149 - 0x00600365, 0x006116C6, 0x00620786, 0x00630608, 0x00640788, 0x00650606, 0x00660046, 0x006718A8,
150 - 0x006858A6, 0x00690145, 0x006A01E9, 0x006B178A, 0x006C01E8, 0x006D1785, 0x006E1E28, 0x006F0C65,
151 - 0x00700CC5, 0x00711D5C, 0x00720648, 0x00730E28, 0x00740646, 0x00750E26, 0x00761B28, 0x007700E6,
152 - 0x007801E5, 0x00791786, 0x007A1E29, 0x007B0C68, 0x007C1E24, 0x007D0C69, 0x007E0955, 0x007F03C9,
153 - 0x008003E9, 0x00810975, 0x00820C49, 0x00831E04, 0x00840C48, 0x00851E05, 0x008617A6, 0x008701C5,
154 - 0x008800C6, 0x00891B08, 0x008A0E06, 0x008B0666, 0x008C0E08, 0x008D0668, 0x008E1D7C, 0x008F0CE5,
155 - 0x00900C45, 0x00911E08, 0x009217A9, 0x009301C4, 0x009417AA, 0x009501C9, 0x00960169, 0x0097588A,
156 - 0x00981888, 0x00990066, 0x009A0709, 0x009B07A8, 0x009C0704, 0x009D07A6, 0x009E16E6, 0x009F0345,
157 - 0x00A000C9, 0x00A11B05, 0x00A20E09, 0x00A30669, 0x00A41885, 0x00A50065, 0x00A60706, 0x00A707A5,
158 - 0x00A803A9, 0x00A90189, 0x00AA0029, 0x00AB0889, 0x00AC0744, 0x00AD06E9, 0x00AE0B06, 0x00AF0229,
159 - 0x00B00E05, 0x00B10665, 0x00B21974, 0x00B30CE8, 0x00B4070A, 0x00B507A9, 0x00B616E9, 0x00B70348,
160 - 0x00B8074A, 0x00B906E6, 0x00BA0B09, 0x00BB0226, 0x00BC1CE4, 0x00BD0D7D, 0x00BE0269, 0x00BF08C9,
161 - 0x00C000CA, 0x00C11B04, 0x00C21884, 0x00C3006A, 0x00C40E04, 0x00C50664, 0x00C60708, 0x00C707AA,
162 - 0x00C803A8, 0x00C90184, 0x00CA0749, 0x00CB06E4, 0x00CC0020, 0x00CD0888, 0x00CE0B08, 0x00CF0224,
163 - 0x00D00E0A, 0x00D1066A, 0x00D20705, 0x00D307A4, 0x00D41D78, 0x00D50CE9, 0x00D616EA, 0x00D70349,
164 - 0x00D80745, 0x00D906E8, 0x00DA1CE9, 0x00DB0D75, 0x00DC0B04, 0x00DD0228, 0x00DE0268, 0x00DF08C8,
165 - 0x00E003A5, 0x00E10185, 0x00E20746, 0x00E306EA, 0x00E40748, 0x00E506E5, 0x00E61CE8, 0x00E70D79,
166 - 0x00E81D74, 0x00E95CE6, 0x00EA02E9, 0x00EB0849, 0x00EC02E8, 0x00ED0848, 0x00EE0086, 0x00EF0A08,
167 - 0x00F00021, 0x00F10885, 0x00F20B05, 0x00F3022A, 0x00F40B0A, 0x00F50225, 0x00F60265, 0x00F708C5,
168 - 0x00F802E5, 0x00F90845, 0x00FA0089, 0x00FB0A09, 0x00FC008A, 0x00FD0A0A, 0x00FE02A9, 0x00FF0062
169 -};
170 -
171 -/*
172 -1 - Source
173 -2 - Dest
174 -4 - Pattern */
175 -const DWORD rop_texture_usage[256] = {
176 - 0, 7, 7, 5, 7, 6, 7, 7, 7, 7, 6, 7, 5, 7, 7, 4,
177 - 7, 3, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
178 - 7, 7, 3, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
179 - 5, 7, 7, 1, 7, 7, 7, 7, 7, 7, 7, 7, 5, 7, 7, 5,
180 - 7, 7, 7, 7, 3, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
181 - 6, 7, 7, 7, 7, 2, 7, 7, 7, 7, 6, 7, 7, 7, 7, 6,
182 - 7, 7, 7, 7, 7, 7, 3, 7, 7, 7, 7, 7, 7, 7, 7, 7,
183 - 7, 7, 7, 7, 7, 7, 7, 3, 7, 7, 7, 7, 7, 7, 7, 7,
184 - 7, 7, 7, 7, 7, 7, 7, 7, 3, 7, 7, 7, 7, 7, 7, 7,
185 - 7, 7, 7, 7, 7, 7, 7, 7, 7, 3, 7, 7, 7, 7, 7, 7,
186 - 6, 7, 7, 7, 7, 6, 7, 7, 7, 7, 2, 7, 7, 7, 7, 6,
187 - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 3, 7, 7, 7, 7,
188 - 5, 7, 7, 5, 7, 7, 7, 7, 7, 7, 7, 7, 1, 7, 7, 5,
189 - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 3, 7, 7,
190 - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 3, 7,
191 - 4, 7, 7, 5, 7, 6, 7, 7, 7, 7, 6, 7, 5, 7, 7, 0
192 -};
193 -
194 -BOOL IsRopCodeSupported(DWORD rop, DWORD *ropcaps)
195 -{
196 - DWORD rop32 = rop & 0xFFFFFF;
197 - DWORD ropindex = (rop >> 16) & 0xFF;
198 - DWORD ropword = ropindex >> 5;
199 - DWORD ropbit = ropindex & 0x1F;
200 - if (rop_codes[ropindex] != rop32) return FALSE;
201 - if ((ropcaps[ropword] >> ropbit) & 1)
202 - {
203 - return TRUE;
204 - }
205 - else return FALSE;
206 -}
207 -
208 -void DrawPalette(DDSURFACEDESC2 ddsd, unsigned char *buffer) // Palette test
209 -{
210 - DWORD x,y;
211 - DWORD color;
212 - unsigned short *buffer16 = (unsigned short*) buffer;
213 - unsigned long *buffer32 = (unsigned long*) buffer;
214 - switch(ddsd.ddpfPixelFormat.dwRGBBitCount)
215 - {
216 - case 8:
217 - for(y = 0; y < ddsd.dwHeight; y++)
218 - {
219 - for(x = 0; x < ddsd.dwWidth; x++)
220 - {
221 - buffer[x+(ddsd.lPitch*y)] = (unsigned char)((x/(ddsd.dwWidth/16.)) + 16*floor((y/(ddsd.dwHeight/16.))));
222 - }
223 - }
224 - break;
225 - case 16:
226 - if((ddsd.ddpfPixelFormat.dwRBitMask | ddsd.ddpfPixelFormat.dwGBitMask |
227 - ddsd.ddpfPixelFormat.dwBBitMask) == 0x7FFF)
228 - {
229 - for(y = 0; y < ddsd.dwHeight; y++)
230 - {
231 - for(x = 0; x < ddsd.dwWidth; x++)
232 - {
233 - buffer16[x+((ddsd.lPitch/2)*y)] = (unsigned short)((x/(ddsd.dwWidth/256.)) + 256*floor((y/(ddsd.dwHeight/256.))))/2;
234 - }
235 - }
236 - }
237 - else if((ddsd.ddpfPixelFormat.dwRBitMask | ddsd.ddpfPixelFormat.dwGBitMask |
238 - ddsd.ddpfPixelFormat.dwBBitMask) == 0xFFFF)
239 - {
240 - for(y = 0; y < ddsd.dwHeight; y++)
241 - {
242 - for(x = 0; x < ddsd.dwWidth; x++)
243 - {
244 - buffer16[x+((ddsd.lPitch/2)*y)] = (unsigned short)((x/(ddsd.dwWidth/256.)) + 256*floor((y/(ddsd.dwHeight/256.))));
245 - }
246 - }
247 - }
248 - else
249 - {
250 - for(y = 0; y < ddsd.dwHeight; y++)
251 - {
252 - for(x = 0; x < ddsd.dwWidth; x++)
253 - {
254 - buffer16[x+((ddsd.lPitch/2)*y)] = (unsigned short)((x/(ddsd.dwWidth/64.)) + 64*floor((y/(ddsd.dwHeight/64.))));
255 - }
256 - }
257 - }
258 - break;
259 - case 24:
260 - for(y = 0; y < ddsd.dwHeight; y++)
261 - {
262 - for(x = 0; x < ddsd.dwWidth*3; x+=3)
263 - {
264 - color = (DWORD)(((x/3)/(ddsd.dwWidth/4096.)) + 4096*floor((y/(ddsd.dwHeight/4096.))));
265 - buffer[x+(ddsd.lPitch*y)] = color & 0xFF;
266 - buffer[(x+1)+(ddsd.lPitch*y)] = (color >> 8) & 0xFF;
267 - buffer[(x+2)+(ddsd.lPitch*y)] = (color >> 16) & 0xFF;
268 - }
269 - }
270 - return;
271 - case 32:
272 - for(y = 0; y < ddsd.dwHeight; y++)
273 - {
274 - for(x = 0; x < ddsd.dwWidth; x++)
275 - {
276 - buffer32[x+((ddsd.lPitch/4)*y)] = (unsigned long)((x/(ddsd.dwWidth/4096.)) + 4096*floor((y/(ddsd.dwHeight/4096.))));
277 - }
278 - }
279 - return;
280 - default:
281 - return;
282 - }
283 -}
284 -
285 -void DrawDitheredColor(DDSURFACEDESC2 *ddsd, unsigned char *buffer, DWORD color, BOOL invert)
286 -{
287 - DWORD *dwordptr = (DWORD*)buffer;
288 - WORD *wordptr = (WORD*)buffer;
289 - DWORD ptr;
290 - BOOL pixel;
291 - DWORD x, y;
292 - switch (ddsd->ddpfPixelFormat.dwRGBBitCount)
293 - {
294 - default:
295 - case 8:
296 - for (y = 0; y < ddsd->dwHeight; y++)
297 - {
298 - ptr = ddsd->lPitch * y;
299 - if (y & 1) pixel = TRUE;
300 - else pixel = FALSE;
301 - if (invert) pixel ^= 1;
302 - for (x = 0; x < ddsd->dwWidth; x++)
303 - {
304 - if (pixel) buffer[ptr] = (unsigned char)color;
305 - pixel ^= 1;
306 - ptr++;
307 - }
308 - }
309 - break;
310 - case 15:
311 - case 16:
312 - for (y = 0; y < ddsd->dwHeight; y++)
313 - {
314 - ptr = (ddsd->lPitch / 2) * y;
315 - if (y & 1) pixel = TRUE;
316 - else pixel = FALSE;
317 - if (invert) pixel ^= 1;
318 - for (x = 0; x < ddsd->dwWidth; x++)
319 - {
320 - if (pixel) wordptr[ptr] = (WORD)color;
321 - pixel ^= 1;
322 - ptr++;
323 - }
324 - }
325 - break;
326 - case 24:
327 - for (y = 0; y < ddsd->dwHeight; y++)
328 - {
329 - ptr = ddsd->lPitch * y;
330 - if (y & 1) pixel = TRUE;
331 - else pixel = FALSE;
332 - if (invert) pixel ^= 1;
333 - for (x = 0; x < ddsd->dwWidth; x++)
334 - {
335 - if (pixel) buffer[ptr] = (unsigned char)(color & 255);
336 - ptr++;
337 - if (pixel) buffer[ptr] = (unsigned char)((color >> 8) & 255);
338 - ptr++;
339 - if (pixel) buffer[ptr] = (unsigned char)((color >> 16) & 255);
340 - pixel ^= 1;
341 - ptr++;
342 - }
343 - }
344 - break;
345 - case 32:
346 - for (y = 0; y < ddsd->dwHeight; y++)
347 - {
348 - ptr = (ddsd->lPitch / 4) * y;
349 - if (y & 1) pixel = TRUE;
350 - else pixel = FALSE;
351 - if (invert) pixel ^= 1;
352 - for (x = 0; x < ddsd->dwWidth; x++)
353 - {
354 - if (pixel) dwordptr[ptr] = (DWORD)color;
355 - pixel ^= 1;
356 - ptr++;
357 - }
358 - }
359 - break;
360 - }
361 -}
362 -
363 -void DrawGradient(HDC hdc, int left, int right, int top, int bottom, DWORD color, bool usegdi)
364 -{
365 - int x;
366 - int r,g,b;
367 - RECT rect;
368 - HBRUSH brushcolor;
369 - TRIVERTEX vertex[2];
370 - GRADIENT_RECT grect;
371 - if(usegdi && gradientavailable)
372 - {
373 - vertex[0].x = left;
374 - vertex[1].x = right;
375 - vertex[0].y = top;
376 - vertex[1].y = bottom;
377 - vertex[0].Red = vertex[0].Green = vertex[0].Blue = 0;
378 - vertex[1].Red = (color & 0xff) << 8;
379 - vertex[1].Green = ((color >> 8) & 0xff) << 8;
380 - vertex[1].Blue = ((color >> 16) & 0xff) << 8;
381 - grect.UpperLeft = 0;
382 - grect.LowerRight = 1;
383 - _GradientFill(hdc,vertex,2,&grect,1,GRADIENT_FILL_RECT_H);
384 - }
385 - else
386 - {
387 - for(x = left; x < right; x++)
388 - {
389 - r = (x*(color & 0xff)) / (right-left);
390 - g = (x*((color >> 8) & 0xff)) / (right-left);
391 - b = (x*((color >> 16) & 0xff)) / (right-left);
392 - rect.left = x;
393 - rect.right = x+1;
394 - rect.top = top;
395 - rect.bottom = bottom;
396 - brushcolor = CreateSolidBrush(RGB(r,g,b));
397 - FillRect(hdc,&rect,brushcolor);
398 - DeleteObject(brushcolor);
399 - }
400 - }
401 -}
402 -
403 -void DrawGradients(DDSURFACEDESC2 ddsd, unsigned char *buffer, HWND hwnd, LPDIRECTDRAWPALETTE palette, int type, DWORD color) // Gradients
404 -{
405 - HDC hdcwin = GetDC(hwnd);
406 - DWORD colors[256];
407 - int bitmode = BI_RGB;
408 - DWORD bitmasks[3];
409 - LPBYTE bits;
410 - BITMAPINFO *bmi = (BITMAPINFO*) malloc(sizeof(BITMAPINFOHEADER) + 1024);
411 - if(!bmi) return;
412 - ZeroMemory(bmi,sizeof(BITMAPINFOHEADER) + 1024);
413 - if(ddsd.ddpfPixelFormat.dwRGBBitCount == 8)
414 - {
415 - palette->GetEntries(0,0,256,(LPPALETTEENTRY)colors);
416 - for(int i = 0; i < 256; i++)
417 - colors[i] = ((colors[i]&0x0000FF)<<16) | (colors[i]&0x00FF00) | ((colors[i]&0xFF0000)>>16);
418 - memcpy(bmi->bmiColors,colors,1024);
419 - }
420 - if(ddsd.ddpfPixelFormat.dwRGBBitCount == 16)
421 - {
422 - bitmode = BI_BITFIELDS;
423 - bitmasks[0] = ddsd.ddpfPixelFormat.dwRBitMask;
424 - bitmasks[1] = ddsd.ddpfPixelFormat.dwGBitMask;
425 - bitmasks[2] = ddsd.ddpfPixelFormat.dwBBitMask;
426 - memcpy(bmi->bmiColors,bitmasks,3*sizeof(DWORD));
427 - }
428 - bmi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
429 - bmi->bmiHeader.biWidth = ddsd.lPitch / (ddsd.ddpfPixelFormat.dwRGBBitCount / 8);
430 - bmi->bmiHeader.biHeight = 0-ddsd.dwHeight;
431 - bmi->bmiHeader.biPlanes = 1;
432 - bmi->bmiHeader.biCompression = bitmode;
433 - bmi->bmiHeader.biBitCount = (WORD)ddsd.ddpfPixelFormat.dwRGBBitCount;
434 - HBITMAP bitmap = CreateDIBSection(hdcwin,bmi,DIB_RGB_COLORS,(void**)&bits,NULL,0);
435 - HDC hdcmem = CreateCompatibleDC(hdcwin);
436 - HGDIOBJ hbmold = SelectObject(hdcmem,bitmap);
437 - SetBkMode(hdcmem,TRANSPARENT);
438 - switch(type)
439 - {
440 - case 1:
441 - DrawGradient(hdcmem,0,ddsd.dwWidth,0,ddsd.dwHeight / 7,0x0000FF,false);
442 - DrawGradient(hdcmem,0,ddsd.dwWidth,ddsd.dwHeight / 7, 2*(ddsd.dwHeight/7),0x00FF00,false);
443 - DrawGradient(hdcmem,0,ddsd.dwWidth,2*(ddsd.dwHeight/7),3*(ddsd.dwHeight/7),0xFF0000,false);
444 - DrawGradient(hdcmem,0,ddsd.dwWidth,3*(ddsd.dwHeight/7),4*(ddsd.dwHeight/7),0xFFFF00,false);
445 - DrawGradient(hdcmem,0,ddsd.dwWidth,4*(ddsd.dwHeight/7),5*(ddsd.dwHeight/7),0xFF00FF,false);
446 - DrawGradient(hdcmem,0,ddsd.dwWidth,5*(ddsd.dwHeight/7),6*(ddsd.dwHeight/7),0x00FFFF,false);
447 - DrawGradient(hdcmem,0,ddsd.dwWidth,6*(ddsd.dwHeight/7),ddsd.dwHeight,0xFFFFFF,false);
448 - break;
449 - default:
450 - DrawGradient(hdcmem,0,ddsd.dwWidth,0,ddsd.dwHeight,color,false);
451 - }
452 - for(unsigned int i = 0; i < ddsd.dwHeight; i++)
453 - {
454 - memcpy(buffer+(ddsd.lPitch*i),bits+(NextMultipleOf4(ddsd.lPitch)*i),ddsd.lPitch);
455 - }
456 - SelectObject(hdcmem,hbmold);
457 - DeleteDC(hdcmem);
458 - DeleteObject(bitmap);
459 - ReleaseDC(hwnd,hdcwin);
460 - free(bmi);
461 -}
462 -
463 -const TCHAR ArialName[] = _T("Arial");
464 -const TCHAR TimesName[] = _T("Times New Roman");
465 -const TCHAR CourierName[] = _T("Courier New");
466 -const TCHAR SSerifName[] = _T("MS Sans Serif");
467 -const TCHAR SymbolName[] = _T("Symbol");
468 -const TCHAR WingdingName[] = _T("Wingdings");
469 -
470 -const TCHAR space[] = _T(" ");
471 -
472 -const TCHAR regularname[] = _T(" Regular");
473 -const TCHAR italicname[] = _T(" Italic");
474 -const TCHAR boldname[] = _T(" Bold");
475 -
476 -void DrawTextBlock(HDC hDC, DWORD x, DWORD &y, DWORD bold, BOOL italic, LPCTSTR font)
477 -{
478 - TCHAR str[256];
479 - TCHAR num[32];
480 - TEXTMETRIC tm;
481 - HFONT DefaultFont;
482 - HFONT newfont;
483 - for(int i = -8; i > -25; i-=2)
484 - {
485 - newfont = CreateFont(i,0,0,0,bold,italic,FALSE,FALSE,DEFAULT_CHARSET,
486 - OUT_OUTLINE_PRECIS,CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,FF_DONTCARE,font);
487 - DefaultFont = (HFONT)SelectObject(hDC,newfont);
488 - _tcscpy(str,font);
489 - _tcscat(str,space);
490 - _itot(-i,num,10);
491 - _tcscat(str,num);
492 - if(!italic && bold == FW_NORMAL) _tcscat(str,regularname);
493 - if(bold == FW_BOLD) _tcscat(str,boldname);
494 - if(italic) _tcscat(str,italicname);
495 - TextOut(hDC,x,y,str,_tcslen(str));
496 - GetTextMetrics(hDC,&tm);
497 - y += tm.tmHeight;
498 - newfont = (HFONT)SelectObject(hDC,DefaultFont);
499 - DeleteObject(newfont);
500 - if(i == -14) i -= 2;
501 - if(i == -18) i -= 4;
502 - }
503 -}
504 -
505 -POINT AngleToPoint(int x, int y, int width, int height, double angle)
506 -{
507 - POINT ret;
508 - ret.x = x + (int)((double)width*sin(angle));
509 - ret.y = y + (int)((double)height*cos(angle));
510 - return ret;
511 -}
512 -
513 -void CreatePolygon(POINT *array, int sides, int x, int y, int width, int height)
514 -{
515 - double angle = 0.;
516 - for(int i = 0; i < sides; i++)
517 - {
518 - angle = ((atan(1.)*8.)/(double)sides)*(double)i;
519 - array[i] = AngleToPoint(x,y,width,height,angle);
520 - }
521 -}
522 -
523 -void CreatePattern(HDC hdc, HBRUSH *brush, HPEN *pen, HBITMAP *bmp, int number)
524 -{
525 - switch(number)
526 - {
527 - case 0:
528 - default:
529 - *pen = CreatePen(PS_SOLID,1,RGB(255,255,255));
530 - *brush = CreateSolidBrush(RGB(255,0,0));
531 - break;
532 - case 1:
533 - *pen = CreatePen(PS_SOLID,2,RGB(255,255,255));
534 - *brush = CreateSolidBrush(RGB(0,255,0));
535 - break;
536 - case 2:
537 - *pen = CreatePen(PS_SOLID,3,RGB(255,255,255));
538 - *brush = CreateSolidBrush(RGB(0,0,255));
539 - break;
540 - case 3:
541 - *pen = CreatePen(PS_SOLID,2,RGB(255,255,255));
542 - *brush = CreateSolidBrush(RGB(0,255,255));
543 - break;
544 - case 4:
545 - *pen = CreatePen(PS_SOLID,1,RGB(255,255,255));
546 - *brush = CreateSolidBrush(RGB(255,0,255));
547 - break;
548 - case 5:
549 - *pen = CreatePen(PS_SOLID,2,RGB(255,255,255));
550 - *brush = CreateSolidBrush(RGB(255,255,0));
551 - break;
552 - case 6:
553 - *pen = CreatePen(PS_SOLID,3,RGB(255,255,255));
554 - *brush = CreateSolidBrush(RGB(255,255,255));
555 - break;
556 - case 7:
557 - *pen = CreatePen(PS_SOLID,2,RGB(255,255,255));
558 - *brush = CreateSolidBrush(RGB(0,0,255));
559 - break;
560 - case 8:
561 - SetBkColor(hdc,RGB(0,0,255));
562 - *pen = CreatePen(PS_DOT,1,RGB(255,255,0));
563 - *brush = CreateHatchBrush(HS_BDIAGONAL,RGB(0,255,255));
564 - break;
565 - case 9:
566 - SetBkColor(hdc,RGB(255,0,0));
567 - *pen = CreatePen(PS_DASH,1,RGB(0,255,255));
568 - *brush = CreateHatchBrush(HS_CROSS,RGB(255,0,255));
569 - break;
570 - case 10:
571 - SetBkColor(hdc,RGB(0,255,0));
572 - *pen = CreatePen(PS_DASHDOT,1,RGB(255,0,255));
573 - *brush = CreateHatchBrush(HS_DIAGCROSS,RGB(255,255,0));
574 - break;
575 - case 11:
576 - SetBkColor(hdc,RGB(0,0,255));
577 - *pen = CreatePen(PS_DASHDOTDOT,1,RGB(0,255,0));
578 - *brush = CreateHatchBrush(HS_FDIAGONAL,RGB(0,255,0));
579 - break;
580 - case 12:
581 - SetBkColor(hdc,RGB(0,255,0));
582 - *pen = CreatePen(PS_DOT,1,RGB(0,0,255));
583 - *brush = CreateHatchBrush(HS_HORIZONTAL,RGB(255,0,0));
584 - break;
585 - case 13:
586 - SetBkColor(hdc,RGB(0,0,0));
587 - *pen = CreatePen(PS_DASH,1,RGB(255,0,0));
588 - *brush = CreateHatchBrush(HS_VERTICAL,RGB(0,0,255));
589 - break;
590 - case 14:
591 - SetBkColor(hdc,RGB(255,255,255));
592 - *bmp = CreateBitmap(16,16,1,1,dxgl_logo_bw);
593 - *pen = CreatePen(PS_SOLID,2,RGB(192,192,192));
594 - *brush = CreatePatternBrush(*bmp);
595 - break;
596 - case 15:
597 - *bmp = LoadBitmap(GetModuleHandle(NULL),MAKEINTRESOURCE(IDB_DXGLINV));
598 - *pen = CreatePen(PS_SOLID,2,RGB(192,192,192));
599 - *brush = CreatePatternBrush(*bmp);
600 - break;
601 - }
602 -}
603 -void DestroyPattern(HBRUSH *brush, HPEN *pen, HBITMAP *bmp, int number)
604 -{
605 - if(number >= 14) DeleteObject(*bmp);
606 - DeleteObject(*pen);
607 - DeleteObject(*brush);
608 - *bmp = NULL;
609 - *brush = NULL;
610 - *pen = NULL;
611 -}
612 -
613 -void DrawBitmap(HDC hDC, int x, int y, int w, int h, LPCTSTR bmp, DWORD method)
614 -{
615 - BITMAP bminfo;
616 - HBITMAP bitmap = LoadBitmap(GetModuleHandle(NULL),bmp);
617 - HDC hdcmem = CreateCompatibleDC(hDC);
618 - HBITMAP hbmold = (HBITMAP)SelectObject(hdcmem,bitmap);
619 - GetObject(bitmap,sizeof(bminfo),&bminfo);
620 - if((w == bminfo.bmWidth) && (h == bminfo.bmHeight)) BitBlt(hDC,x,y,w,h,hdcmem,0,0,method);
621 - else StretchBlt(hDC,x,y,w,h,hdcmem,0,0,bminfo.bmWidth,bminfo.bmHeight,method);
622 - SelectObject(hdcmem,hbmold);
623 - DeleteDC(hdcmem);
624 - DeleteObject(bitmap);
625 -}
626 -
627 -void DrawGDIPatterns(DDSURFACEDESC2 ddsd, HDC hDC, int type)
628 -{
629 - int i;
630 - DWORD x,x2;
631 - DWORD y,y2;
632 - int r,g,b;
633 - HPEN pen;
634 - HBRUSH brush;
635 - HBITMAP bmp;
636 - HANDLE tmphandle, tmphandle2;
637 - POINT points[18];
638 - RECT rect;
639 - switch(type)
640 - {
641 - case 0: // Text
642 - y = y2 = 16;
643 - SetBkColor(hDC,RGB(0,0,0));
644 - SetTextColor(hDC,RGB(255,0,0));
645 - DrawTextBlock(hDC,0,y,FW_NORMAL,FALSE,ArialName);
646 - SetTextColor(hDC,RGB(0,255,0));
647 - if(ddsd.dwHeight > y) DrawTextBlock(hDC,0,y,FW_NORMAL,TRUE,ArialName);
648 - SetTextColor(hDC,RGB(0,0,255));
649 - if(ddsd.dwHeight > y) DrawTextBlock(hDC,0,y,FW_BOLD,FALSE,ArialName);
650 - SetTextColor(hDC,RGB(0,255,255));
651 - if(ddsd.dwHeight > y) DrawTextBlock(hDC,0,y,FW_BOLD,TRUE,ArialName);
652 - if(ddsd.dwWidth > 216)
653 - {
654 - y2 = y;
655 - y = 16;
656 - SetTextColor(hDC,RGB(255,0,255));
657 - DrawTextBlock(hDC,216,y,FW_NORMAL,FALSE,TimesName);
658 - SetTextColor(hDC,RGB(255,255,0));
659 - if(ddsd.dwHeight > y) DrawTextBlock(hDC,216,y,FW_NORMAL,TRUE,TimesName);
660 - SetTextColor(hDC,RGB(255,255,255));
661 - if(ddsd.dwHeight > y) DrawTextBlock(hDC,216,y,FW_BOLD,FALSE,TimesName);
662 - SetTextColor(hDC,RGB(255,127,0));
663 - if(ddsd.dwHeight > y) DrawTextBlock(hDC,216,y,FW_BOLD,TRUE,TimesName);
664 - }
665 - y = y2;
666 - SetTextColor(hDC,RGB(0,127,255));
667 - if(ddsd.dwHeight > y) DrawTextBlock(hDC,0,y,FW_NORMAL,FALSE,CourierName);
668 - SetTextColor(hDC,RGB(127,255,0));
669 - if(ddsd.dwHeight > y) DrawTextBlock(hDC,0,y,FW_NORMAL,TRUE,CourierName);
670 - SetTextColor(hDC,RGB(127,0,255));
671 - if(ddsd.dwHeight > y) DrawTextBlock(hDC,0,y,FW_BOLD,FALSE,CourierName);
672 - SetTextColor(hDC,RGB(255,0,127));
673 - if(ddsd.dwHeight > y) DrawTextBlock(hDC,0,y,FW_BOLD,TRUE,CourierName);
674 - y = y2;
675 - if(ddsd.dwWidth > 380)
676 - {
677 - SetTextColor(hDC,RGB(0,255,127));
678 - DrawTextBlock(hDC,380,y,FW_NORMAL,FALSE,SSerifName);
679 - SetTextColor(hDC,RGB(127,127,255));
680 - if(ddsd.dwHeight > y) DrawTextBlock(hDC,380,y,FW_NORMAL,TRUE,SSerifName);
681 - SetTextColor(hDC,RGB(255,127,127));
682 - if(ddsd.dwHeight > y) DrawTextBlock(hDC,380,y,FW_BOLD,FALSE,SSerifName);
683 - SetTextColor(hDC,RGB(255,127,255));
684 - if(ddsd.dwHeight > y) DrawTextBlock(hDC,380,y,FW_BOLD,TRUE,SSerifName);
685 - }
686 - y = 16;
687 - if(ddsd.dwWidth > 560)
688 - {
689 - SetTextColor(hDC,RGB(191,0,0));
690 - DrawTextBlock(hDC,560,y,FW_NORMAL,FALSE,SymbolName);
691 - SetTextColor(hDC,RGB(0,191,0));
692 - if(ddsd.dwHeight > y) DrawTextBlock(hDC,560,y,FW_NORMAL,TRUE,SymbolName);
693 - SetTextColor(hDC,RGB(0,0,191));
694 - if(ddsd.dwHeight > y) DrawTextBlock(hDC,560,y,FW_BOLD,FALSE,SymbolName);
695 - SetTextColor(hDC,RGB(0,191,191));
696 - if(ddsd.dwHeight > y) DrawTextBlock(hDC,560,y,FW_BOLD,TRUE,SymbolName);
697 - }
698 - if((ddsd.dwWidth > 720) && (ddsd.dwHeight > y))
699 - {
700 - SetTextColor(hDC,RGB(191,0,191));
701 - DrawTextBlock(hDC,720,y,FW_NORMAL,FALSE,WingdingName);
702 - SetTextColor(hDC,RGB(191,191,0));
703 - if(ddsd.dwHeight > y) DrawTextBlock(hDC,720,y,FW_NORMAL,TRUE,WingdingName);
704 - SetTextColor(hDC,RGB(191,191,191));
705 - if(ddsd.dwHeight > y) DrawTextBlock(hDC,720,y,FW_BOLD,FALSE,WingdingName);
706 - SetTextColor(hDC,RGB(127,127,127));
707 - if(ddsd.dwHeight > y) DrawTextBlock(hDC,720,y,FW_BOLD,TRUE,WingdingName);
708 - }
709 - SetBkColor(hDC,RGB(0,0,255));
710 - SetTextColor(hDC,RGB(255,255,255));
711 - TextOut(hDC,0,0,_T("Screen 0: Text"),15);
712 - break;
713 - case 1: // Lines
714 - r = g = b = 0;
715 - points[0].x = ddsd.dwWidth/2;
716 - points[0].y = ddsd.dwHeight/2;
717 - points[1].y = 0;
718 - for(x = 1; x <= 10; x++)
719 - {
720 - r = (int)(x * 25.5);
721 - points[1].x = (LONG)(ddsd.dwWidth * (x/10.));
722 - pen = CreatePen(PS_SOLID,0,RGB(r,g,b));
723 - tmphandle = SelectObject(hDC,pen);
724 - Polyline(hDC,points,2);
725 - SelectObject(hDC,tmphandle);
726 - DeleteObject(pen);
727 - }
728 - for(y = 0; y <= 10; y++)
729 - {
730 - r = (int)((10-y) * 25.5);
731 - g = (int)(y * 25.5);
732 - points[1].y = (LONG)(ddsd.dwHeight * (y/10.));
733 - pen = CreatePen(PS_SOLID,y,RGB(r,g,b));
734 - tmphandle = SelectObject(hDC,pen);
735 - Polyline(hDC,points,2);
736 - SelectObject(hDC,tmphandle);
737 - DeleteObject(pen);
738 - }
739 - for(x = 10; x > 0; x--)
740 - {
741 - g = (int)(x * 25.5);
742 - b = (int)((10-x) * 25.5);
743 - points[1].x = (LONG)(ddsd.dwWidth * (x/10.));
744 - pen = CreatePen(PS_SOLID,x,RGB(r,g,b));
745 - tmphandle = SelectObject(hDC,pen);
746 - Polyline(hDC,points,2);
747 - SelectObject(hDC,tmphandle);
748 - DeleteObject(pen);
749 - if(x == 0) break;
750 - }
751 - SetBkColor(hDC,RGB(0,0,0));
752 - for(y = 10; y >= 0; y--)
753 - {
754 - r = g = (int)((10-y) * 25.5);
755 - points[1].y = (LONG)(ddsd.dwHeight * (y/10.));
756 - switch(y)
757 - {
758 - case 1:
759 - case 6:
760 - default:
761 - pen = CreatePen(PS_SOLID,0,RGB(r,g,b));
762 - break;
763 - case 2:
764 - case 7:
765 - pen = CreatePen(PS_DASH,0,RGB(r,g,b));
766 - break;
767 - case 3:
768 - case 8:
769 - pen = CreatePen(PS_DOT,0,RGB(r,g,b));
770 - break;
771 - case 4:
772 - case 9:
773 - pen = CreatePen(PS_DASHDOT,0,RGB(r,g,b));
774 - break;
775 - case 5:
776 - case 10:
777 - pen = CreatePen(PS_DASHDOTDOT,0,RGB(r,g,b));
778 - break;
779 - }
780 - tmphandle = SelectObject(hDC,pen);
781 - Polyline(hDC,points,2);
782 - SelectObject(hDC,tmphandle);
783 - DeleteObject(pen);
784 - if(y == 0) break;
785 - }
786 - SetBkColor(hDC,RGB(0,0,255));
787 - SetTextColor(hDC,RGB(255,255,255));
788 - TextOut(hDC,0,0,_T("Screen 1: Lines"),16);
789 - break;
790 - case 2: // Beziers
791 - points[0].x = 0;
792 - points[1].x = ddsd.dwWidth / 4;
793 - points[2].x = 3*(ddsd.dwWidth/4);
794 - points[3].x = ddsd.dwWidth;
795 - points[0].y = points[3].y = ddsd.dwHeight / 2;
796 - r = g = b = 0;
797 - for(i = 0; i < 50; i++)
798 - {
799 - r = (int)(i*5.1);
800 - points[1].y = (LONG)((ddsd.dwHeight/2.)+(i*(ddsd.dwHeight/30.)));
801 - points[2].y = (LONG)((ddsd.dwHeight/2.)-(i*(ddsd.dwHeight/30.)));
802 - pen = CreatePen(PS_SOLID,0,RGB(r,g,b));
803 - tmphandle = SelectObject(hDC,pen);
804 - PolyBezier(hDC,points,4);
805 - SelectObject(hDC,tmphandle);
806 - DeleteObject(pen);
807 - }
808 - r = 0;
809 - for(i = 0; i < 50; i++)
810 - {
811 - g = b = (int)(i*5.1);
812 - points[1].y = (LONG)((ddsd.dwHeight/2.)-(i*(ddsd.dwHeight/30.)));
813 - points[2].y = (LONG)((ddsd.dwHeight/2.)+(i*(ddsd.dwHeight/30.)));
814 - pen = CreatePen(PS_SOLID,0,RGB(r,g,b));
815 - tmphandle = SelectObject(hDC,pen);
816 - PolyBezier(hDC,points,4);
817 - SelectObject(hDC,tmphandle);
818 - DeleteObject(pen);
819 - }
820 - SetBkColor(hDC,RGB(0,0,255));
821 - SetTextColor(hDC,RGB(255,255,255));
822 - TextOut(hDC,0,0,_T("Screen 2: Beziers"),18);
823 - break;
824 - case 3: // polygons
825 - x2 = (int)(ddsd.dwWidth / 8.1);
826 - y2 = (int)(ddsd.dwHeight / 8.1);
827 - for(i = 0; i < 16; i++)
828 - {
829 - x = (int)(((i&3) * (ddsd.dwWidth/4.))+(ddsd.dwWidth/8));
830 - y = (int)(((i>>2) * (ddsd.dwHeight/4.))+(ddsd.dwHeight/8));
831 - CreatePolygon(points,i+3,x,y,x2,y2);
832 - CreatePattern(hDC,&brush,&pen,&bmp,i);
833 - tmphandle = SelectObject(hDC,pen);
834 - tmphandle2 = SelectObject(hDC,brush);
835 - Polygon(hDC,points,i+3);
836 - SelectObject(hDC,tmphandle2);
837 - SelectObject(hDC,tmphandle);
838 - DestroyPattern(&brush,&pen,&bmp,i);
839 - }
840 - SetBkColor(hDC,RGB(0,0,255));
841 - SetTextColor(hDC,RGB(255,255,255));
842 - TextOut(hDC,0,0,_T("Screen 3: Polygons"),19);
843 - break;
844 - case 4: // rectangles
845 - for(i = 0; i < 16; i++)
846 - {
847 - rect.left = (int)((double)(i&3)*(double)ddsd.dwWidth/4.);
848 - rect.right = rect.left+(int)(ddsd.dwWidth/4.)-8;
849 - rect.top = (int)((double)(i>>2)*(double)ddsd.dwHeight/4);
850 - rect.bottom = rect.top+(int)(ddsd.dwHeight/4.)-8;
851 - CreatePattern(hDC,&brush,&pen,&bmp,i);
852 - tmphandle = SelectObject(hDC,pen);
853 - tmphandle2 = SelectObject(hDC,brush);
854 - if(i <= 7) FillRect(hDC,&rect,brush);
855 - else RoundRect(hDC,rect.left,rect.top,rect.right,rect.bottom,i+8,24-i);
856 - SelectObject(hDC,tmphandle2);
857 - SelectObject(hDC,tmphandle);
858 - DestroyPattern(&brush,&pen,&bmp,i);
859 - }
860 - SetBkColor(hDC,RGB(0,0,255));
861 - SetTextColor(hDC,RGB(255,255,255));
862 - TextOut(hDC,0,0,_T("Screen 4: Rectangles"),21);
863 - break;
864 - case 5: // ellipses
865 - for(i = 0; i < 16; i++)
866 - {
867 - rect.left = (int)((double)(i&3)*(double)ddsd.dwWidth/4.);
868 - rect.right = rect.left+(int)(ddsd.dwWidth/4.)-8;
869 - rect.top = (int)((double)(i>>2)*(double)ddsd.dwHeight/4);
870 - rect.bottom = rect.top+(int)(ddsd.dwHeight/4.)-8;
871 - x = (rect.right-rect.left)/4;
872 - y = (rect.bottom-rect.top)/4;
873 - CreatePattern(hDC,&brush,&pen,&bmp,i);
874 - tmphandle = SelectObject(hDC,pen);
875 - tmphandle2 = SelectObject(hDC,brush);
876 - switch(i)
877 - {
878 - case 0:
879 - default:
880 - Ellipse(hDC,rect.left,rect.top,rect.right,rect.bottom);
881 - break;
882 - case 1:
883 - Ellipse(hDC,rect.left,rect.top+y,rect.right,rect.bottom-y);
884 - break;
885 - case 2:
886 - Ellipse(hDC,rect.left+x,rect.top,rect.right-x,rect.bottom);
887 - break;
888 - case 3:
889 - Ellipse(hDC,rect.left+x,rect.top+y,rect.right-x,rect.bottom-y);
890 - break;
891 - case 4:
892 - Chord(hDC,rect.left,rect.top,rect.right,rect.bottom,rect.left+(2*x),rect.top,rect.left+(2*x),rect.bottom);
893 - break;
894 - case 5:
895 - Chord(hDC,rect.left,rect.top,rect.right,rect.bottom,rect.left,rect.top+(2*y),rect.right,rect.top+(2*y));
896 - break;
897 - case 6:
898 - Chord(hDC,rect.left,rect.top,rect.right,rect.bottom,rect.left,rect.top,rect.right,rect.bottom);
899 - break;
900 - case 7:
901 - Chord(hDC,rect.left,rect.top,rect.right,rect.bottom,rect.right,rect.top,rect.left+x,rect.bottom);
902 - break;
903 - case 8:
904 - Pie(hDC,rect.left,rect.top,rect.right,rect.bottom,rect.right,rect.top,rect.left+(2*x),rect.bottom);
905 - break;
906 - case 9:
907 - Pie(hDC,rect.left,rect.top,rect.right,rect.bottom,rect.left,rect.top,rect.left,rect.bottom);
908 - break;
909 - case 10:
910 - Pie(hDC,rect.left,rect.top,rect.right,rect.bottom,rect.left,rect.top,rect.right,rect.bottom);
911 - break;
912 - case 11:
913 - Pie(hDC,rect.left,rect.top,rect.right,rect.bottom,rect.right,rect.top,rect.left+x,rect.bottom);
914 - break;
915 - case 12:
916 - RoundRect(hDC,rect.left,rect.top,rect.right,rect.bottom,ddsd.dwWidth/5,ddsd.dwHeight/5);
917 - break;
918 - case 13:
919 - RoundRect(hDC,rect.left,rect.top,rect.right,rect.bottom,ddsd.dwWidth/8,ddsd.dwHeight/8);
920 - break;
921 - case 14:
922 - Chord(hDC,rect.left,rect.top,rect.right,rect.bottom,rect.right,rect.top,rect.left+x,rect.bottom);
923 - break;
924 - case 15:
925 - Pie(hDC,rect.left,rect.top,rect.right,rect.bottom,rect.left+x,rect.bottom,rect.right,rect.top);
926 - break;
927 - }
928 - SelectObject(hDC,tmphandle2);
929 - SelectObject(hDC,tmphandle);
930 - DestroyPattern(&brush,&pen,&bmp,i);
931 - }
932 - SetBkColor(hDC,RGB(0,0,255));
933 - SetTextColor(hDC,RGB(255,255,255));
934 - TextOut(hDC,0,0,_T("Screen 5: Ellipses"),19);
935 - break;
936 - case 6: // gradients
937 - DrawGradient(hDC,0,ddsd.dwWidth,0,ddsd.dwHeight / 7,0x0000FF,gradientavailable);
938 - DrawGradient(hDC,0,ddsd.dwWidth,ddsd.dwHeight / 7, 2*(ddsd.dwHeight/7),0x00FF00,gradientavailable);
939 - DrawGradient(hDC,0,ddsd.dwWidth,2*(ddsd.dwHeight/7),3*(ddsd.dwHeight/7),0xFF0000,gradientavailable);
940 - DrawGradient(hDC,0,ddsd.dwWidth,3*(ddsd.dwHeight/7),4*(ddsd.dwHeight/7),0xFFFF00,gradientavailable);
941 - DrawGradient(hDC,0,ddsd.dwWidth,4*(ddsd.dwHeight/7),5*(ddsd.dwHeight/7),0xFF00FF,gradientavailable);
942 - DrawGradient(hDC,0,ddsd.dwWidth,5*(ddsd.dwHeight/7),6*(ddsd.dwHeight/7),0x00FFFF,gradientavailable);
943 - DrawGradient(hDC,0,ddsd.dwWidth,6*(ddsd.dwHeight/7),ddsd.dwHeight,0xFFFFFF,gradientavailable);
944 - SetBkColor(hDC,RGB(0,0,255));
945 - SetTextColor(hDC,RGB(255,255,255));
946 - TextOut(hDC,0,0,_T("Screen 6: Gradients"),20);
947 - break;
948 - case 7: // bitmaps
949 - DrawBitmap(hDC,(int)(ddsd.dwWidth/8.)-8,(int)(ddsd.dwHeight/6.)-8,
950 - 16,16,MAKEINTRESOURCE(IDB_DXGLINV),SRCCOPY);
951 - DrawBitmap(hDC,(int)((ddsd.dwWidth/4.)+(ddsd.dwWidth/8.))-32,(int)(ddsd.dwHeight/6.)-32,
952 - 64,64,MAKEINTRESOURCE(IDB_DXGLINV64),SRCCOPY);
953 - DrawBitmap(hDC,(int)(ddsd.dwWidth/2.),0,(int)(ddsd.dwWidth/4.),
954 - (int)(ddsd.dwHeight/3.),MAKEINTRESOURCE(IDB_DXGLINV),SRCCOPY);
955 - DrawBitmap(hDC,(int)(.75*ddsd.dwWidth),0,(int)(ddsd.dwWidth/4.),
956 - (int)(ddsd.dwHeight/3.),MAKEINTRESOURCE(IDB_DXGLINV64),SRCCOPY);
957 - SetBkColor(hDC,RGB(0,255,255));
958 - brush = CreateHatchBrush(HS_DIAGCROSS,RGB(128,0,128));
959 - tmphandle = SelectObject(hDC,brush);
960 - DrawBitmap(hDC,(int)(ddsd.dwWidth/8.)-8,(int)(ddsd.dwHeight/2.)-8,
961 - 16,16,MAKEINTRESOURCE(IDB_DXGLINV),MERGECOPY);
962 - DrawBitmap(hDC,(int)((ddsd.dwWidth/4.)+(ddsd.dwWidth/8.))-32,(int)(ddsd.dwHeight/2.)-32,
963 - 64,64,MAKEINTRESOURCE(IDB_DXGLINV64),MERGECOPY);
964 - DrawBitmap(hDC,(int)(ddsd.dwWidth/2.),(int)(ddsd.dwHeight/3.),(int)(ddsd.dwWidth/4.),
965 - (int)(ddsd.dwHeight/3.),MAKEINTRESOURCE(IDB_DXGLINV),MERGECOPY);
966 - DrawBitmap(hDC,(int)(.75*ddsd.dwWidth),(int)(ddsd.dwHeight/3.),(int)(ddsd.dwWidth/4.),
967 - (int)(ddsd.dwHeight/3.),MAKEINTRESOURCE(IDB_DXGLINV64),MERGECOPY);
968 - SelectObject(hDC,tmphandle);
969 - DeleteObject(brush);
970 - rect.left = 0;
971 - rect.right = ddsd.dwWidth;
972 - rect.top = (int)((ddsd.dwHeight/3.)*2.);
973 - rect.bottom = ddsd.dwHeight;
974 - FillRect(hDC,&rect,(HBRUSH) (COLOR_WINDOW+1));
975 - DrawBitmap(hDC,(int)(ddsd.dwWidth/8.)-8,(int)((5./6.)*ddsd.dwHeight)-8,
976 - 16,16,MAKEINTRESOURCE(IDB_DXGLINV),SRCINVERT);
977 - DrawBitmap(hDC,(int)((ddsd.dwWidth/4.)+(ddsd.dwWidth/8.))-32,(int)((5./6.)*ddsd.dwHeight)-32,
978 - 64,64,MAKEINTRESOURCE(IDB_DXGLINV64),SRCINVERT);
979 - DrawBitmap(hDC,(int)(ddsd.dwWidth/2.),(int)((ddsd.dwHeight/3.)*2.),(int)(ddsd.dwWidth/4.),
980 - (int)(ddsd.dwHeight/3.),MAKEINTRESOURCE(IDB_DXGLINV),SRCINVERT);
981 - DrawBitmap(hDC,(int)(.75*ddsd.dwWidth),(int)((ddsd.dwHeight/3.)*2.),(int)(ddsd.dwWidth/4.),
982 - (int)(ddsd.dwHeight/3.),MAKEINTRESOURCE(IDB_DXGLINV64),SRCINVERT);
983 - SetBkColor(hDC,RGB(0,0,255));
984 - SetTextColor(hDC,RGB(255,255,255));
985 - TextOut(hDC,0,0,_T("Screen 7: Bitmaps"),18);
986 - break;
987 - }
988 -}
989 -
990 -void DrawROPPatterns(MultiDirectDrawSurface *primary, DDSPRITE *sprites, int backbuffers, int ddver, int bpp, DWORD *ropcaps,
991 - HWND hwnd, LPDIRECTDRAWPALETTE palette)
992 -{
993 - HICON ico_dxglsm;
994 - HICON ico_x16;
995 - HDC hdc;
996 - DDSURFACEDESC2 ddsd;
997 - int bltx, blty;
998 - RECT bltrect;
999 - DDBLTFX bltfx;
1000 - ZeroMemory(&bltfx, sizeof(DDBLTFX));
1001 - bltfx.dwSize = sizeof(DDBLTFX);
1002 - ZeroMemory(&ddsd, sizeof(DDSURFACEDESC2));
1003 - if (ddver > 3)ddsd.dwSize = sizeof(DDSURFACEDESC2);
1004 - else ddsd.dwSize = sizeof(DDSURFACEDESC);
1005 - ico_dxglsm = (HICON)LoadImage(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_DXGLSM), IMAGE_ICON, 16, 16, 0);
1006 - ico_x16 = (HICON)LoadImage(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_X16), IMAGE_ICON, 16, 16, 0);
1007 - bltrect.left = bltrect.top = 0;
1008 - bltrect.bottom = bltrect.right = 16;
1009 - bltfx.dwFillColor = 0;
1010 - sprites[2].surface->Blt(&bltrect, NULL, NULL, DDBLT_COLORFILL, &bltfx);
1011 - sprites[2].surface->GetDC(&hdc);
1012 - DrawIconEx(hdc, 0, 0, ico_dxglsm, 16, 16, 0, NULL, DI_NORMAL);
1013 - sprites[2].surface->ReleaseDC(hdc);
1014 - sprites[3].surface->GetDC(&hdc);
1015 - DrawIconEx(hdc, 0, 0, ico_x16, 16, 16, 0, NULL, DI_NORMAL);
1016 - sprites[3].surface->ReleaseDC(hdc);
1017 - DestroyIcon(ico_x16);
1018 - sprites[4].surface->GetSurfaceDesc(&ddsd);
1019 - sprites[4].surface->Lock(NULL, &ddsd, DDLOCK_WAIT, NULL);
1020 - switch (bpp)
1021 - {
1022 - case 8:
1023 - default:
1024 - for (int i = 0; i < 8; i++)
1025 - memcpy((unsigned char*)ddsd.lpSurface + (i*ddsd.lPitch), &back_pattern_8[8 * i], 8);
1026 - break;
1027 - case 15:
1028 - for (int i = 0; i < 8; i++)
1029 - memcpy((unsigned char *)ddsd.lpSurface + (i*ddsd.lPitch), &back_pattern_15[8 * i], 16);
1030 - break;
1031 - case 16:
1032 - for (int i = 0; i < 8; i++)
1033 - memcpy((unsigned char *)ddsd.lpSurface + (i*ddsd.lPitch), &back_pattern_16[8 * i], 16);
1034 - break;
1035 - case 24:
1036 - for (int i = 0; i < 8; i++)
1037 - memcpy((unsigned char *)ddsd.lpSurface + (i*ddsd.lPitch), &back_pattern_24[24 * i], 24);
1038 - break;
1039 - case 32:
1040 - for (int i = 0; i < 8; i++)
1041 - memcpy((unsigned char *)ddsd.lpSurface + (i*ddsd.lPitch), &back_pattern_32[8 * i], 32);
1042 - break;
1043 - }
1044 - sprites[4].surface->Unlock(NULL);
1045 - sprites[5].surface->GetSurfaceDesc(&ddsd);
1046 - sprites[5].surface->Lock(NULL, &ddsd, DDLOCK_WAIT, NULL);
1047 - switch (bpp)
1048 - {
1049 - case 8:
1050 - default:
1051 - for (int i = 0; i < 6; i++)
1052 - memcpy((unsigned char*)ddsd.lpSurface + (i*ddsd.lPitch), &blt_pattern_8[6 * i], 6);
1053 - break;
1054 - case 15:
1055 - for (int i = 0; i < 6; i++)
1056 - memcpy((unsigned char *)ddsd.lpSurface + (i*ddsd.lPitch), &blt_pattern_15[6 * i], 12);
1057 - break;
1058 - case 16:
1059 - for (int i = 0; i < 6; i++)
1060 - memcpy((unsigned char *)ddsd.lpSurface + (i*ddsd.lPitch), &blt_pattern_16[6 * i], 12);
1061 - break;
1062 - case 24:
1063 - for (int i = 0; i < 6; i++)
1064 - memcpy((unsigned char *)ddsd.lpSurface + (i*ddsd.lPitch), &blt_pattern_24[18 * i], 18);
1065 - break;
1066 - case 32:
1067 - for (int i = 0; i < 6; i++)
1068 - memcpy((unsigned char *)ddsd.lpSurface + (i*ddsd.lPitch), &blt_pattern_32[6 * i], 24);
1069 - break;
1070 - }
1071 - sprites[5].surface->Unlock(NULL);
1072 - for (int y = 0; y < 32; y++)
1073 - {
1074 - for (int x = 0; x < 32; x++)
1075 - {
1076 - bltx = x * 8;
1077 - blty = y * 8;
1078 - bltrect.left = bltx;
1079 - bltrect.right = bltx + 8;
1080 - bltrect.top = blty;
1081 - bltrect.bottom = blty + 8;
1082 - sprites[0].surface->Blt(&bltrect, sprites[4].surface, NULL, DDBLT_WAIT, NULL);
1083 - sprites[1].surface->Blt(&bltrect, sprites[4].surface, NULL, DDBLT_WAIT, NULL);
1084 - }
1085 - }
1086 - for (int i = 0; i < 256; i++)
1087 - {
1088 - bltx = (i & 0xF) * 16;
1089 - blty = (i >> 4) * 16;
1090 - bltrect.left = bltx;
1091 - bltrect.right = bltx + 16;
1092 - bltrect.top = blty;
1093 - bltrect.bottom = blty + 16;
1094 - if (IsRopCodeSupported(rop_codes[i], ropcaps))
1095 - {
1096 - if (rop_texture_usage[i] & 4) bltfx.lpDDSPattern = (LPDIRECTDRAWSURFACE)sprites[5].surface->GetSurface();
1097 - else bltfx.lpDDSPattern = NULL;
1098 - bltfx.dwROP = rop_codes[i];
1099 - sprites[0].surface->Blt(&bltrect, sprites[2].surface, NULL, DDBLT_ROP | DDBLT_WAIT, &bltfx);
1100 - }
1101 - else
1102 - {
1103 - sprites[0].surface->Blt(&bltrect, sprites[3].surface, NULL, DDBLT_WAIT, NULL);
1104 - }
1105 - }
1106 - HDC hdcwin = GetDC(hwnd);
1107 - DWORD colors[256];
1108 - int bitmode = BI_RGB;
1109 - DWORD bitmasks[3];
1110 - LPBYTE bits;
1111 - BITMAPINFO *bmi = (BITMAPINFO*)malloc(sizeof(BITMAPINFOHEADER)+1024);
1112 - if (!bmi) return;
1113 - ZeroMemory(bmi, sizeof(BITMAPINFOHEADER)+1024);
1114 - if (ddsd.ddpfPixelFormat.dwRGBBitCount == 8)
1115 - {
1116 - palette->GetEntries(0, 0, 256, (LPPALETTEENTRY)colors);
1117 - for (int i = 0; i < 256; i++)
1118 - colors[i] = ((colors[i] & 0x0000FF) << 16) | (colors[i] & 0x00FF00) | ((colors[i] & 0xFF0000) >> 16);
1119 - memcpy(bmi->bmiColors, colors, 1024);
1120 - }
1121 - if (ddsd.ddpfPixelFormat.dwRGBBitCount == 16)
1122 - {
1123 - bitmode = BI_BITFIELDS;
1124 - bitmasks[0] = ddsd.ddpfPixelFormat.dwRBitMask;
1125 - bitmasks[1] = ddsd.ddpfPixelFormat.dwGBitMask;
1126 - bitmasks[2] = ddsd.ddpfPixelFormat.dwBBitMask;
1127 - memcpy(bmi->bmiColors, bitmasks, 3 * sizeof(DWORD));
1128 - }
1129 - bmi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
1130 - bmi->bmiHeader.biWidth = 16;
1131 - bmi->bmiHeader.biHeight = -16;
1132 - bmi->bmiHeader.biPlanes = 1;
1133 - bmi->bmiHeader.biCompression = bitmode;
1134 - bmi->bmiHeader.biBitCount = (WORD)ddsd.ddpfPixelFormat.dwRGBBitCount;
1135 - HBITMAP bmpicon = CreateDIBSection(hdcwin, bmi, DIB_RGB_COLORS, (void**)&bits, NULL, 0);
1136 - HDC hdcicon = CreateCompatibleDC(hdcwin);
1137 - HGDIOBJ hbmiconold = SelectObject(hdcicon, bmpicon);
1138 - DrawIconEx(hdcicon, 0, 0, ico_dxglsm, 16, 16, 0, NULL, DI_NORMAL);
1139 - DestroyIcon(ico_dxglsm);
1140 - bmi->bmiHeader.biWidth = 6;
1141 - bmi->bmiHeader.biHeight = -6;
1142 - HBITMAP bmppattern = CreateDIBSection(hdcwin, bmi, DIB_RGB_COLORS, (void**)&bits, NULL, 0);
1143 - int bmpwidth = NextMultipleOf4((bmi->bmiHeader.biBitCount*bmi->bmiHeader.biWidth) / 8);
1144 - switch (bpp)
1145 - {
1146 - case 8:
1147 - default:
1148 - for (int i = 0; i < 6; i++)
1149 - memcpy((unsigned char*)bits + (i*bmpwidth), &blt_pattern_8[6 * i], 6);
1150 - break;
1151 - case 15:
1152 - for (int i = 0; i < 6; i++)
1153 - memcpy((unsigned char *)bits + (i*bmpwidth), &blt_pattern_15[6 * i], 12);
1154 - break;
1155 - case 16:
1156 - for (int i = 0; i < 6; i++)
1157 - memcpy((unsigned char *)bits + (i*bmpwidth), &blt_pattern_16[6 * i], 12);
1158 - break;
1159 - case 24:
1160 - for (int i = 0; i < 6; i++)
1161 - memcpy((unsigned char *)bits + (i*bmpwidth), &blt_pattern_24[18 * i], 18);
1162 - break;
1163 - case 32:
1164 - for (int i = 0; i < 6; i++)
1165 - memcpy((unsigned char *)bits + (i*bmpwidth), &blt_pattern_32[6 * i], 24);
1166 - break;
1167 - }
1168 - HBRUSH hbrpattern = CreatePatternBrush(bmppattern);
1169 - HDC hdcblt;
1170 - sprites[1].surface->GetDC(&hdcblt);
1171 - HGDIOBJ hbrold = SelectObject(hdcblt, hbrpattern);
1172 - for (int i = 0; i < 256; i++)
1173 - {
1174 - bltx = (i & 0xF) * 16;
1175 - blty = (i >> 4) * 16;
1176 - BitBlt(hdcblt, bltx, blty, 16, 16, hdcicon, 0, 0, rop_codes[i]);
1177 - }
1178 - SelectObject(hdcblt, hbrold);
1179 - sprites[1].surface->ReleaseDC(hdcblt);
1180 - primary->GetDC(&hdcblt);
1181 - SetBkColor(hdcblt, RGB(0, 0, 255));
1182 - SetTextColor(hdcblt, RGB(255, 255, 255));
1183 - TextOut(hdcblt, 0, 0, _T("Screen 0: DDraw Blt"),20);
1184 - primary->ReleaseDC(hdcblt);
1185 - primary->BltFast(0, 16, sprites[0].surface, NULL, DDBLTFAST_WAIT);
1186 - if (backbuffers)
1187 - {
1188 - MultiDirectDrawSurface *back;
1189 - DDSCAPS2 ddscaps;
1190 - ZeroMemory(&ddscaps, sizeof(DDSCAPS2));
1191 - ddscaps.dwCaps = DDSCAPS_BACKBUFFER;
1192 - primary->GetAttachedSurface(&ddscaps, &back);
1193 - back->GetDC(&hdcblt);
1194 - SetBkColor(hdcblt, RGB(0, 0, 255));
1195 - SetTextColor(hdcblt, RGB(255, 255, 255));
1196 - TextOut(hdcblt, 0, 0, _T("Screen 1: GDI Blt"), 18);
1197 - back->ReleaseDC(hdcblt);
1198 - back->BltFast(0, 16, sprites[1].surface, NULL, DDBLTFAST_WAIT);
1199 - back->Release();
1200 - }
1201 - free(bmi);
1202 -}
1203 -
1204 -void DrawRotatedBlt(MultiDirectDrawSurface *primary, DDSPRITE *sprites)
1205 -{
1206 -HDC hdc;
1207 -DDBLTFX bltfx;
1208 -ZeroMemory(&bltfx, sizeof(DDBLTFX));
1209 -bltfx.dwSize = sizeof(DDBLTFX);
1210 -sprites[0].surface->GetDC(&hdc);
1211 -DrawBitmap(hdc, 0, 0, 64, 64, MAKEINTRESOURCE(IDB_DXGLINV64), SRCCOPY);
1212 -sprites[0].surface->ReleaseDC(hdc);
1213 -RECT r;
1214 -r.left = 0;
1215 -r.right = 64;
1216 -r.top = 0;
1217 -r.bottom = 64;
1218 -primary->Blt(&r, sprites[0].surface, NULL, DDBLT_DDFX, &bltfx);
1219 -r.left = 64;
1220 -r.right = 128;
1221 -bltfx.dwDDFX = DDBLTFX_MIRRORLEFTRIGHT;
1222 -primary->Blt(&r, sprites[0].surface, NULL, DDBLT_DDFX, &bltfx);
1223 -r.left = 128;
1224 -r.right = 192;
1225 -bltfx.dwDDFX = DDBLTFX_MIRRORUPDOWN;
1226 -primary->Blt(&r, sprites[0].surface, NULL, DDBLT_DDFX, &bltfx);
1227 -r.left = 192;
1228 -r.right = 256;
1229 -bltfx.dwDDFX = DDBLTFX_MIRRORLEFTRIGHT | DDBLTFX_MIRRORUPDOWN;
1230 -primary->Blt(&r, sprites[0].surface, NULL, DDBLT_DDFX, &bltfx);
1231 -r.top = 64;
1232 -r.bottom = 128;
1233 -r.left = 0;
1234 -r.right = 64;
1235 -bltfx.dwDDFX = DDBLTFX_ROTATE90;
1236 -primary->Blt(&r, sprites[0].surface, NULL, DDBLT_DDFX, &bltfx);
1237 -r.left = 64;
1238 -r.right = 128;
1239 -bltfx.dwDDFX = DDBLTFX_ROTATE90 | DDBLTFX_MIRRORLEFTRIGHT;
1240 -primary->Blt(&r, sprites[0].surface, NULL, DDBLT_DDFX, &bltfx);
1241 -r.left = 128;
1242 -r.right = 192;
1243 -bltfx.dwDDFX = DDBLTFX_ROTATE90 | DDBLTFX_MIRRORUPDOWN;
1244 -primary->Blt(&r, sprites[0].surface, NULL, DDBLT_DDFX, &bltfx);
1245 -r.left = 192;
1246 -r.right = 256;
1247 -bltfx.dwDDFX = DDBLTFX_ROTATE90 | DDBLTFX_MIRRORLEFTRIGHT | DDBLTFX_MIRRORUPDOWN;
1248 -primary->Blt(&r, sprites[0].surface, NULL, DDBLT_DDFX, &bltfx);
1249 -r.top = 128;
1250 -r.bottom = 192;
1251 -r.left = 0;
1252 -r.right = 64;
1253 -bltfx.dwDDFX = DDBLTFX_ROTATE180;
1254 -primary->Blt(&r, sprites[0].surface, NULL, DDBLT_DDFX, &bltfx);
1255 -r.left = 64;
1256 -r.right = 128;
1257 -bltfx.dwDDFX = DDBLTFX_ROTATE180 | DDBLTFX_MIRRORLEFTRIGHT;
1258 -primary->Blt(&r, sprites[0].surface, NULL, DDBLT_DDFX, &bltfx);
1259 -r.left = 128;
1260 -r.right = 192;
1261 -bltfx.dwDDFX = DDBLTFX_ROTATE180 | DDBLTFX_MIRRORUPDOWN;
1262 -primary->Blt(&r, sprites[0].surface, NULL, DDBLT_DDFX, &bltfx);
1263 -r.left = 192;
1264 -r.right = 256;
1265 -bltfx.dwDDFX = DDBLTFX_ROTATE180 | DDBLTFX_MIRRORLEFTRIGHT | DDBLTFX_MIRRORUPDOWN;
1266 -primary->Blt(&r, sprites[0].surface, NULL, DDBLT_DDFX, &bltfx);
1267 -r.top = 192;
1268 -r.bottom = 256;
1269 -r.left = 0;
1270 -r.right = 64;
1271 -bltfx.dwDDFX = DDBLTFX_ROTATE270;
1272 -primary->Blt(&r, sprites[0].surface, NULL, DDBLT_DDFX, &bltfx);
1273 -r.left = 64;
1274 -r.right = 128;
1275 -bltfx.dwDDFX = DDBLTFX_ROTATE270 | DDBLTFX_MIRRORLEFTRIGHT;
1276 -primary->Blt(&r, sprites[0].surface, NULL, DDBLT_DDFX, &bltfx);
1277 -r.left = 128;
1278 -r.right = 192;
1279 -bltfx.dwDDFX = DDBLTFX_ROTATE270 | DDBLTFX_MIRRORUPDOWN;
1280 -primary->Blt(&r, sprites[0].surface, NULL, DDBLT_DDFX, &bltfx);
1281 -r.left = 192;
1282 -r.right = 256;
1283 -bltfx.dwDDFX = DDBLTFX_ROTATE270 | DDBLTFX_MIRRORLEFTRIGHT | DDBLTFX_MIRRORUPDOWN;
1284 -primary->Blt(&r, sprites[0].surface, NULL, DDBLT_DDFX, &bltfx);
1285 -}
1286 -
1287 -void DrawColorKeyCompPatterns(DDSURFACEDESC2 ddsd, unsigned char *buffer, int bpp, int index)
1288 -{
1289 - int x, y;
1290 - DWORD i;
1291 - if (index)
1292 - {
1293 - switch (bpp)
1294 - {
1295 - case 8:
1296 - for (int y = 0; y < 16; y++)
1297 - {
1298 - for (int x = 0; x < 16; x++)
1299 - {
1300 - i = x + ((15 - y) << 4);
1301 - buffer[x + (ddsd.lPitch*y)] = i;
1302 - }
1303 - }
1304 - break;
1305 - case 15:
1306 - for (int y = 1; y < 8; y++)
1307 - {
1308 - for (int x = 0; x < 32; x++)
1309 - {
1310 - switch (y)
1311 - {
1312 - case 7:
1313 - i = x << 10;
1314 - break;
1315 - case 6:
1316 - i = x << 5;
1317 - break;
1318 - case 5:
1319 - i = x;
1320 - break;
1321 - case 4:
1322 - i = x + (x << 5);
1323 - break;
1324 - case 3:
1325 - i = x + (x << 10);
1326 - break;
1327 - case 2:
1328 - i = (x << 5) + (x << 10);
1329 - break;
1330 - case 1:
1331 - default:
1332 - i = x + (x << 5) + (x << 10);
1333 - break;
1334 - }
1335 - buffer[(x * 2) + (ddsd.lPitch*(y - 1))] = (char)i;
1336 - buffer[((x * 2) + (ddsd.lPitch*(y - 1))) + 1] = (char)(i >> 8);
1337 - }
1338 - }
1339 - break;
1340 - case 16:
1341 - for (int y = 1; y < 8; y++)
1342 - {
1343 - for (int x = 0; x < 64; x++)
1344 - {
1345 - switch (y)
1346 - {
1347 - case 7:
1348 - i = (x >> 1) << 11;
1349 - break;
1350 - case 6:
1351 - i = x << 5;
1352 - break;
1353 - case 5:
1354 - i = x >> 1;
1355 - break;
1356 - case 4:
1357 - i = (x >> 1) + (x << 5);
1358 - break;
1359 - case 3:
1360 - i = (x >> 1) + ((x >> 1) << 11);
1361 - break;
1362 - case 2:
1363 - i = (x << 5) + ((x >> 1) << 11);
1364 - break;
1365 - case 1:
1366 - default:
1367 - i = (x >> 1) + (x << 5) + ((x >> 1) << 11);
1368 - break;
1369 - }
1370 - buffer[(x * 2) + (ddsd.lPitch*(y - 1))] = (char)i;
1371 - buffer[((x * 2) + (ddsd.lPitch*(y - 1))) + 1] = (char)(i >> 8);
1372 - }
1373 - }
1374 - break;
1375 - case 24:
1376 - for (int y = 1; y < 8; y++)
1377 - {
1378 - for (int x = 0; x < 256; x++)
1379 - {
1380 - switch (y)
1381 - {
1382 - case 7:
1383 - i = x << 16;
1384 - break;
1385 - case 6:
1386 - i = x << 8;
1387 - break;
1388 - case 5:
1389 - i = x;
1390 - break;
1391 - case 4:
1392 - i = x + (x << 8);
1393 - break;
1394 - case 3:
1395 - i = x + (x << 16);
1396 - break;
1397 - case 2:
1398 - i = (x << 8) + (x << 16);
1399 - break;
1400 - case 1:
1401 - default:
1402 - i = x + (x << 8) + (x << 16);
1403 - break;
1404 - }
1405 - buffer[(x * 3) + (ddsd.lPitch*(y - 1))] = (char)i;
1406 - buffer[((x * 3) + (ddsd.lPitch*(y - 1))) + 1] = (char)(i >> 8);
1407 - buffer[((x * 3) + (ddsd.lPitch*(y - 1))) + 2] = (char)(i >> 16);
1408 - }
1409 - }
1410 - break;
1411 - case 32:
1412 - default:
1413 - for (int y = 1; y < 8; y++)
1414 - {
1415 - for (int x = 0; x < 256; x++)
1416 - {
1417 - switch (y)
1418 - {
1419 - case 7:
1420 - i = x << 16;
1421 - break;
1422 - case 6:
1423 - i = x << 8;
1424 - break;
1425 - case 5:
1426 - i = x;
1427 - break;
1428 - case 4:
1429 - i = x + (x << 8);
1430 - break;
1431 - case 3:
1432 - i = x + (x << 16);
1433 - break;
1434 - case 2:
1435 - i = (x << 8) + (x << 16);
1436 - break;
1437 - case 1:
1438 - default:
1439 - i = x + (x << 8) + (x << 16);
1440 - break;
1441 - }
1442 - buffer[(x * 4) + (ddsd.lPitch*(y - 1))] = (char)i;
1443 - buffer[((x * 4) + (ddsd.lPitch*(y - 1))) + 1] = (char)(i >> 8);
1444 - buffer[((x * 4) + (ddsd.lPitch*(y - 1))) + 2] = (char)(i >> 16);
1445 - buffer[((x * 4) + (ddsd.lPitch*(y - 1))) + 3] = 0;
1446 - }
1447 - }
1448 - break;
1449 - }
1450 - }
1451 - else
1452 - {
1453 - switch (bpp)
1454 - {
1455 - case 8:
1456 - for (int y = 0; y < 16; y++)
1457 - {
1458 - for (int x = 0; x < 16; x++)
1459 - {
1460 - i = 255 - (x + ((15 - y) << 4));
1461 - buffer[x + (ddsd.lPitch*y)] = i;
1462 - }
1463 - }
1464 - break;
1465 - case 15:
1466 - for (int y = 1; y < 8; y++)
1467 - {
1468 - for (int x = 0; x < 32; x++)
1469 - {
1470 - switch (y)
1471 - {
1472 - case 1:
1473 - i = (31 - x) << 10;
1474 - break;
1475 - case 2:
1476 - i = (31 - x) << 5;
1477 - break;
1478 - case 3:
1479 - i = (31 - x);
1480 - break;
1481 - case 5:
1482 - i = (31 - x) + ((31 - x) << 5);
1483 - break;
1484 - case 4:
1485 - i = (31 - x) + ((31 - x) << 10);
1486 - break;
1487 - case 6:
1488 - i = ((31 - x) << 5) + ((31 - x) << 10);
1489 - break;
1490 - case 7:
1491 - default:
1492 - i = (31 - x) + ((31 - x) << 5) + ((31 - x) << 10);
1493 - break;
1494 - }
1495 - buffer[(x * 2) + (ddsd.lPitch*(y - 1))] = (char)i;
1496 - buffer[((x * 2) + (ddsd.lPitch*(y - 1))) + 1] = (char)(i >> 8);
1497 - }
1498 - }
1499 - break;
1500 - case 16:
1501 - for (int y = 1; y < 8; y++)
1502 - {
1503 - for (int x = 0; x < 64; x++)
1504 - {
1505 - switch (y)
1506 - {
1507 - case 1:
1508 - i = ((63 - x) >> 1) << 11;
1509 - break;
1510 - case 2:
1511 - i = (63 - x) << 5;
1512 - break;
1513 - case 3:
1514 - i = (63 - x) >> 1;
1515 - break;
1516 - case 5:
1517 - i = ((63 - x) >> 1) + ((63 - x) << 5);
1518 - break;
1519 - case 4:
1520 - i = ((63 - x) >> 1) + (((63 - x) >> 1) << 11);
1521 - break;
1522 - case 6:
1523 - i = ((63 - x) << 5) + (((63 - x) >> 1) << 11);
1524 - break;
1525 - case 7:
1526 - default:
1527 - i = ((63 - x) >> 1) + ((63 - x) << 5) + (((63 - x) >> 1) << 11);
1528 - break;
1529 - }
1530 - buffer[(x * 2) + (ddsd.lPitch*(y - 1))] = (char)i;
1531 - buffer[((x * 2) + (ddsd.lPitch*(y - 1))) + 1] = (char)(i >> 8);
1532 - }
1533 - }
1534 - break;
1535 - case 24:
1536 - for (int y = 1; y < 8; y++)
1537 - {
1538 - for (int x = 0; x < 256; x++)
1539 - {
1540 - switch (y)
1541 - {
1542 - case 1:
1543 - i = (255 - x) << 16;
1544 - break;
1545 - case 2:
1546 - i = (255 - x) << 8;
1547 - break;
1548 - case 3:
1549 - i = (255 - x);
1550 - break;
1551 - case 5:
1552 - i = (255 - x) + ((255 - x) << 8);
1553 - break;
1554 - case 4:
1555 - i = (255 - x) + ((255 - x) << 16);
1556 - break;
1557 - case 6:
1558 - i = ((255 - x) << 8) + ((255 - x) << 16);
1559 - break;
1560 - case 7:
1561 - default:
1562 - i = (255 - x) + ((255 - x) << 8) + ((255 - x) << 16);
1563 - break;
1564 - }
1565 - buffer[(x * 3) + (ddsd.lPitch*(y - 1))] = (char)i;
1566 - buffer[((x * 3) + (ddsd.lPitch*(y - 1))) + 1] = (char)(i >> 8);
1567 - buffer[((x * 3) + (ddsd.lPitch*(y - 1))) + 2] = (char)(i >> 16);
1568 - }
1569 - }
1570 - break;
1571 - case 32:
1572 - default:
1573 - for (int y = 1; y < 8; y++)
1574 - {
1575 - for (int x = 0; x < 256; x++)
1576 - {
1577 - switch (y)
1578 - {
1579 - case 1:
1580 - i = (255 - x) << 16;
1581 - break;
1582 - case 2:
1583 - i = (255 - x) << 8;
1584 - break;
1585 - case 3:
1586 - i = (255 - x);
1587 - break;
1588 - case 5:
1589 - i = (255 - x) + ((255 - x) << 8);
1590 - break;
1591 - case 4:
1592 - i = (255 - x) + ((255 - x) << 16);
1593 - break;
1594 - case 6:
1595 - i = ((255 - x) << 8) + ((255 - x) << 16);
1596 - break;
1597 - case 7:
1598 - default:
1599 - i = (255 - x) + ((255 - x) << 8) + ((255 - x) << 16);
1600 - break;
1601 - }
1602 - buffer[(x * 4) + (ddsd.lPitch*(y - 1))] = (char)i;
1603 - buffer[((x * 4) + (ddsd.lPitch*(y - 1))) + 1] = (char)(i >> 8);
1604 - buffer[((x * 4) + (ddsd.lPitch*(y - 1))) + 2] = (char)(i >> 16);
1605 - buffer[((x * 4) + (ddsd.lPitch*(y - 1))) + 3] = 0;
1606 - }
1607 - }
1608 - break;
1609 - }
1610 - }
1611 -}
\ No newline at end of file
Index: dxgltest/dxguid.cpp
@@ -1,21 +0,0 @@
2 -// DXGL
3 -// Copyright (C) 2011 William Feely
4 -
5 -// This library is free software; you can redistribute it and/or
6 -// modify it under the terms of the GNU Lesser General Public
7 -// License as published by the Free Software Foundation; either
8 -// version 2.1 of the License, or (at your option) any later version.
9 -
10 -// This library is distributed in the hope that it will be useful,
11 -// but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 -// Lesser General Public License for more details.
14 -
15 -// You should have received a copy of the GNU Lesser General Public
16 -// License along with this library; if not, write to the Free Software
17 -// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 -
19 -#define INITGUID
20 -#include <windows.h>
21 -#include "../ddraw/include/ddraw.h"
22 -#include "../ddraw/include/d3d.h"
\ No newline at end of file
Index: dxgltest/timer.h
@@ -1,27 +0,0 @@
2 -// DXGL
3 -// Copyright (C) 2011 William Feely
4 -
5 -// This library is free software; you can redistribute it and/or
6 -// modify it under the terms of the GNU Lesser General Public
7 -// License as published by the Free Software Foundation; either
8 -// version 2.1 of the License, or (at your option) any later version.
9 -
10 -// This library is distributed in the hope that it will be useful,
11 -// but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 -// Lesser General Public License for more details.
14 -
15 -// You should have received a copy of the GNU Lesser General Public
16 -// License along with this library; if not, write to the Free Software
17 -// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 -
19 -#pragma once
20 -#ifndef _TIMER_H
21 -#define _TIMER_H
22 -
23 -
24 -extern bool stoptimer;
25 -void StartTimer(HWND hWnd, UINT message, double framerate);
26 -void StopTimer();
27 -
28 -#endif //_TIMER_H
\ No newline at end of file
Index: dxgltest/surfacegen.h
@@ -1,31 +0,0 @@
2 -// DXGL
3 -// Copyright (C) 2011 William Feely
4 -
5 -// This library is free software; you can redistribute it and/or
6 -// modify it under the terms of the GNU Lesser General Public
7 -// License as published by the Free Software Foundation; either
8 -// version 2.1 of the License, or (at your option) any later version.
9 -
10 -// This library is distributed in the hope that it will be useful,
11 -// but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 -// Lesser General Public License for more details.
14 -
15 -// You should have received a copy of the GNU Lesser General Public
16 -// License along with this library; if not, write to the Free Software
17 -// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 -
19 -#pragma once
20 -#ifndef _SURFACEGEN_H
21 -#define _SURFACEGEN_H
22 -
23 -void DrawPalette(DDSURFACEDESC2 ddsd, unsigned char *buffer); // Palette test
24 -void DrawDitheredColor(DDSURFACEDESC2 *ddsd, unsigned char *buffer, DWORD color, BOOL invert); // Draw a dithered color over the surface
25 -void DrawGradients(DDSURFACEDESC2 ddsd, unsigned char *buffer, HWND hwnd, LPDIRECTDRAWPALETTE palette, int type, DWORD color); // Gradients
26 -void DrawGDIPatterns(DDSURFACEDESC2 ddsd, HDC hDC, int type); // GDI pattern test
27 -void DrawROPPatterns(MultiDirectDrawSurface *primary, DDSPRITE *sprites, int backbuffers, int ddver, int bpp, DWORD *ropcaps,
28 - HWND hwnd, LPDIRECTDRAWPALETTE palette); // ROP pattern test
29 -void DrawRotatedBlt(MultiDirectDrawSurface *primary, DDSPRITE *sprites);
30 -void DrawColorKeyCompPatterns(DDSURFACEDESC2 ddsd, unsigned char *buffer, int bpp, int index);
31 -
32 -#endif //_SURFACEGEN_H
\ No newline at end of file
Index: dxgltest/ReadMe.txt
@@ -1 +0,0 @@
2 -dxgltest is used for testing DXGL functionality against DirectDraw.
\ No newline at end of file
Index: dxgltest/Resource.h
@@ -1,171 +0,0 @@
2 -// DXGL
3 -// Copyright (C) 2011 William Feely
4 -
5 -// This library is free software; you can redistribute it and/or
6 -// modify it under the terms of the GNU Lesser General Public
7 -// License as published by the Free Software Foundation; either
8 -// version 2.1 of the License, or (at your option) any later version.
9 -
10 -// This library is distributed in the hope that it will be useful,
11 -// but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 -// Lesser General Public License for more details.
14 -
15 -// You should have received a copy of the GNU Lesser General Public
16 -// License along with this library; if not, write to the Free Software
17 -// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 -
19 -#ifndef IDC_STATIC
20 -#define IDC_STATIC (-1)
21 -#endif
22 -
23 -// Dialogs
24 -#define IDD_TEXSHADER 103
25 -#define IDD_VERTEXSHADER 104
26 -#define IDD_DXGLTEST 199
27 -
28 -// Tabs
29 -#define IDD_TESTGFX 206
30 -#define IDD_SYSINFO 207
31 -
32 -// Icons
33 -#define IDI_DXGL 301
34 -#define IDI_DXGLSM 302
35 -#define IDI_X16 304
36 -
37 -// Bitmaps
38 -#define IDB_DXGLINV 311
39 -#define IDB_DXGLINV64 312
40 -
41 -// Controls - DXGL Test Dialog
42 -#define IDC_TABS 1002
43 -
44 -// Controls - Graphics Tests Tab
45 -#define IDC_TESTLIST 2601
46 -#define IDC_VIDMODES 2602
47 -#define IDC_WINDOWED 2603
48 -#define IDC_FULLSCREEN 2604
49 -#define IDC_RESIZABLE 2605
50 -#define IDC_TESTVSYNC 2606
51 -#define IDC_APIVER 2607
52 -#define IDC_SPINAPI 2608
53 -#define IDC_BUFFERS 2609
54 -#define IDC_SPINBACK 2610
55 -#define IDC_FRAMERATE 2611
56 -#define IDC_SPINFRAME 2612
57 -#define IDC_FILTERLABEL 2613
58 -#define IDC_FILTER 2614
59 -#define IDC_FSAALABEL 2615
60 -#define IDC_FSAA 2616
61 -#define IDC_TEST 2617
62 -
63 -// Controls - System Information Tab
64 -#define IDC_DDTYPE 2701
65 -#define IDC_DDVER 2702
66 -#define IDC_DXDIAG 2703
67 -
68 -// Controls - Shader Test Dialog Common
69 -#define IDC_DISPLAY 2801
70 -#define IDC_TEXTURE 2802
71 -#define IDC_TEXTUREFILE 2803
72 -#define IDC_TEXTUREBROWSE 2804
73 -#define IDC_VERTEXFOGMODE 2805
74 -#define IDC_PIXELFOGMODE 2806
75 -#define IDC_FOGSTART 2807
76 -#define IDC_FOGEND 2808
77 -#define IDC_FOGDENSITY 2809
78 -#define IDC_RANGEBASEDFOG 2810
79 -#define IDC_FOGENABLE 2811
80 -#define IDC_DIFFUSE 2812
81 -#define IDC_DIFFUSESELECT 2813
82 -#define IDC_SPECULAR 2814
83 -#define IDC_SPECULARSELECT 2815
84 -#define IDC_FACTOR 2816
85 -#define IDC_FACTORSELECT 2817
86 -#define IDC_FOGCOLOR 2818
87 -#define IDC_FOGCOLORSELECT 2819
88 -#define IDC_BGCOLOR 2820
89 -#define IDC_BGCOLORSELECT 2821
90 -
91 -
92 -// Controls - Texture Shader Test Dialog
93 -#define IDC_TEXSTAGE 2901
94 -#define IDC_SPINSTAGE 2902
95 -#define IDC_TEXCOLORKEY 2903
96 -#define IDC_SETTEXCOLORKEY 2904
97 -#define IDC_CARG1 2905
98 -#define IDC_CARG1INV 2906
99 -#define IDC_CARG1A 2907
100 -#define IDC_CARG2 2908
101 -#define IDC_CARG2INV 2909
102 -#define IDC_CARG2A 2910
103 -#define IDC_COLOROP 2911
104 -#define IDC_AARG1 2912
105 -#define IDC_AARG1INV 2913
106 -#define IDC_AARG1A 2914
107 -#define IDC_AARG2 2915
108 -#define IDC_AARG2INV 2916
109 -#define IDC_AARG2A 2917
110 -#define IDC_ALPHAOP 2918
111 -#define IDC_TEXTUREPREVIEW 2919
112 -#define IDC_ALPHABLEND 2920
113 -#define IDC_SRCBLEND 2921
114 -#define IDC_DESTBLEND 2922
115 -#define IDC_ALPHAREF 2923
116 -#define IDC_SPINALPHAREF 2924
117 -#define IDC_ALPHAFUNC 2925
118 -#define IDC_ALPHASTIPPLE 2926
119 -#define IDC_ALPHATEST 2927
120 -#define IDC_COLORKEY 2928
121 -#define IDC_COLORKEYBLEND 2929
122 -#define IDC_LINESTIPPLEPATTERN 2930
123 -#define IDC_LINESTIPPLEREPEAT 2931
124 -#define IDC_SPINLINEREPEAT 2932
125 -#define IDC_FILLSTIPPLELLLABEL 2933
126 -#define IDC_FILLSTIPPLETYPE 2934
127 -#define IDC_FILLSTIPPLEFILE 2935
128 -#define IDC_FILLSTIPPLEBROWSE 2936
129 -#define IDC_FILLSTIPPLEPREVIEW 2937
130 -
131 -// Controls - Vertex Test Dialog
132 -#define IDC_AMBIENT 3001
133 -#define IDC_AMBIENTSELECT 3002
134 -#define IDC_EMISSIVE 3003
135 -#define IDC_EMISSIVESELECT 3004
136 -#define IDC_MATAMBIENT 3005
137 -#define IDC_MATAMBIENTSELECT 3006
138 -#define IDC_MATDIFFUSE 3007
139 -#define IDC_MATDIFFUSESELECT 3008
140 -#define IDC_MATSPECULAR 3009
141 -#define IDC_MATSPECULARSELECT 3010
142 -#define IDC_FILLMODE 3011
143 -#define IDC_SHADEMODE 3012
144 -#define IDC_CULLMODE 3013
145 -#define IDC_ENABLELIGHT 3014
146 -#define IDC_ENABLESPECULAR 3015
147 -#define IDC_VERTEXCOLOR 3016
148 -#define IDC_LOCALVIEWER 3017
149 -#define IDC_DETAIL 3018
150 -#define IDC_SPINDETAIL 3019
151 -#define IDC_DIFFUSESOURCE 3020
152 -#define IDC_AMBIENTSOURCE 3021
153 -#define IDC_SPECULARSOURCE 3022
154 -#define IDC_EMISSIVESOURCE 3023
155 -#define IDC_LIGHTNUMBER 3024
156 -#define IDC_SPINLIGHT 3025
157 -#define IDC_LIGHTDIFFUSE 3026
158 -#define IDC_LIGHTDIFFUSESELECT 3027
159 -#define IDC_LIGHTAMBIENT 3028
160 -#define IDC_LIGHTAMBIENTSELECT 3029
161 -#define IDC_LIGHTTYPE 3030
162 -#define IDC_LIGHTSPECULAR 3031
163 -#define IDC_LIGHTSPECULARSELECT 3032
164 -#define IDC_LIGHTRANGE 3033
165 -#define IDC_LIGHTENABLED 3034
166 -#define IDC_POWER 3035
167 -#define IDC_LIGHTFALLOFF 3036
168 -#define IDC_LIGHTATTEN0 3037
169 -#define IDC_LIGHTATTEN1 3038
170 -#define IDC_LIGHTATTEN2 3039
171 -#define IDC_LIGHTTHETA 3040
172 -#define IDC_LIGHTPHI 3041
Index: dxgltest/common.h
@@ -1,71 +0,0 @@
2 -// DXGL
3 -// Copyright (C) 2011-2012 William Feely
4 -
5 -// This library is free software; you can redistribute it and/or
6 -// modify it under the terms of the GNU Lesser General Public
7 -// License as published by the Free Software Foundation; either
8 -// version 2.1 of the License, or (at your option) any later version.
9 -
10 -// This library is distributed in the hope that it will be useful,
11 -// but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 -// Lesser General Public License for more details.
14 -
15 -// You should have received a copy of the GNU Lesser General Public
16 -// License along with this library; if not, write to the Free Software
17 -// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 -
19 -#pragma once
20 -#ifndef _COMMON_H
21 -#define _COMMON_H
22 -
23 -#define _CRT_SECURE_NO_WARNINGS
24 -
25 -
26 -#define WIN32_LEAN_AND_MEAN
27 -// Windows Header Files:
28 -#include <windows.h>
29 -#include <commctrl.h>
30 -#include <Uxtheme.h>
31 -extern bool gradientavailable;
32 -extern BOOL (WINAPI *_GradientFill)(HDC hdc, TRIVERTEX* pVertices, ULONG nVertices, void* pMesh, ULONG nMeshElements, DWORD dwMode);
33 -
34 -// C RunTime Header Files
35 -#ifdef _DEBUG
36 -#define _CRTDBG_MAP_ALLOC
37 -#endif
38 -#include <stdio.h>
39 -#include <stdlib.h>
40 -#include <process.h>
41 -#ifdef _DEBUG
42 -#include <crtdbg.h>
43 -#endif
44 -#include <malloc.h>
45 -#include <memory.h>
46 -#include <tchar.h>
47 -#include <math.h>
48 -#include <time.h>
49 -#include <string>
50 -#ifdef _DEBUG
51 -#include <crtdbg.h>
52 -#define new DEBUGNEW
53 -#define DEBUGNEW new(_NORMAL_BLOCK,__FILE__,__LINE__)
54 -#endif
55 -using namespace std;
56 -#ifdef _UNICODE
57 -typedef wstring tstring;
58 -#else
59 -typedef string tstring;
60 -#endif
61 -#include "Resource.h"
62 -// DirectX/DXGL headers
63 -#include "../ddraw/include/ddraw.h"
64 -extern const unsigned char DefaultPalette[1024];
65 -
66 -#ifdef _UNICODE
67 -#define _ttof _wtof
68 -#else
69 -#define _ttof atof
70 -#endif
71 -
72 -#endif //_COMMON_H
Index: dxgltest/palette.cpp
@@ -1,86 +0,0 @@
2 -// DXGL
3 -// Copyright (C) 2011 William Feely
4 -
5 -// This library is free software; you can redistribute it and/or
6 -// modify it under the terms of the GNU Lesser General Public
7 -// License as published by the Free Software Foundation; either
8 -// version 2.1 of the License, or (at your option) any later version.
9 -
10 -// This library is distributed in the hope that it will be useful,
11 -// but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 -// Lesser General Public License for more details.
14 -
15 -// You should have received a copy of the GNU Lesser General Public
16 -// License along with this library; if not, write to the Free Software
17 -// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 -
19 -#include "common.h"
20 -#include "palette.h"
21 -
22 -const unsigned char DefaultPalette[1024] = {
23 -0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x80,0x80,0x00,0x00,
24 -0x00,0x00,0x80,0x00,0x80,0x00,0x80,0x00,0x00,0x80,0x80,0x00,0xc0,0xc0,0xc0,0x00,
25 -0xa0,0xa0,0xa0,0x00,0xf0,0xf0,0xf0,0x00,0x40,0x20,0x00,0x00,0x60,0x20,0x00,0x00,
26 -0x80,0x20,0x00,0x00,0xa0,0x20,0x00,0x00,0xc0,0x20,0x00,0x00,0xe0,0x20,0x00,0x00,
27 -0x00,0x40,0x00,0x00,0x20,0x40,0x00,0x00,0x40,0x40,0x00,0x00,0x60,0x40,0x00,0x00,
28 -0x80,0x40,0x00,0x00,0xa0,0x40,0x00,0x00,0xc0,0x40,0x00,0x00,0xe0,0x40,0x00,0x00,
29 -0x00,0x60,0x00,0x00,0x20,0x60,0x00,0x00,0x40,0x60,0x00,0x00,0x60,0x60,0x00,0x00,
30 -0x80,0x60,0x00,0x00,0xa0,0x60,0x00,0x00,0xc0,0x60,0x00,0x00,0xe0,0x60,0x00,0x00,
31 -0x00,0x80,0x00,0x00,0x20,0x80,0x00,0x00,0x40,0x80,0x00,0x00,0x60,0x80,0x00,0x00,
32 -0x80,0x80,0x00,0x00,0xa0,0x80,0x00,0x00,0xc0,0x80,0x00,0x00,0xe0,0x80,0x00,0x00,
33 -0x00,0xa0,0x00,0x00,0x20,0xa0,0x00,0x00,0x40,0xa0,0x00,0x00,0x60,0xa0,0x00,0x00,
34 -0x80,0xa0,0x00,0x00,0xa0,0xa0,0x00,0x00,0xc0,0xa0,0x00,0x00,0xe0,0xa0,0x00,0x00,
35 -0x00,0xc0,0x00,0x00,0x20,0xc0,0x00,0x00,0x40,0xc0,0x00,0x00,0x60,0xc0,0x00,0x00,
36 -0x80,0xc0,0x00,0x00,0xa0,0xc0,0x00,0x00,0xc0,0xc0,0x00,0x00,0xe0,0xc0,0x00,0x00,
37 -0x00,0xe0,0x00,0x00,0x20,0xe0,0x00,0x00,0x40,0xe0,0x00,0x00,0x60,0xe0,0x00,0x00,
38 -0x80,0xe0,0x00,0x00,0xa0,0xe0,0x00,0x00,0xc0,0xe0,0x00,0x00,0xe0,0xe0,0x00,0x00,
39 -0x00,0x00,0x40,0x00,0x20,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x60,0x00,0x40,0x00,
40 -0x80,0x00,0x40,0x00,0xa0,0x00,0x40,0x00,0xc0,0x00,0x40,0x00,0xe0,0x00,0x40,0x00,
41 -0x00,0x20,0x40,0x00,0x20,0x20,0x40,0x00,0x40,0x20,0x40,0x00,0x60,0x20,0x40,0x00,
42 -0x80,0x20,0x40,0x00,0xa0,0x20,0x40,0x00,0xc0,0x20,0x40,0x00,0xe0,0x20,0x40,0x00,
43 -0x00,0x40,0x40,0x00,0x20,0x40,0x40,0x00,0x40,0x40,0x40,0x00,0x60,0x40,0x40,0x00,
44 -0x80,0x40,0x40,0x00,0xa0,0x40,0x40,0x00,0xc0,0x40,0x40,0x00,0xe0,0x40,0x40,0x00,
45 -0x00,0x60,0x40,0x00,0x20,0x60,0x40,0x00,0x40,0x60,0x40,0x00,0x60,0x60,0x40,0x00,
46 -0x80,0x60,0x40,0x00,0xa0,0x60,0x40,0x00,0xc0,0x60,0x40,0x00,0xe0,0x60,0x40,0x00,
47 -0x00,0x80,0x40,0x00,0x20,0x80,0x40,0x00,0x40,0x80,0x40,0x00,0x60,0x80,0x40,0x00,
48 -0x80,0x80,0x40,0x00,0xa0,0x80,0x40,0x00,0xc0,0x80,0x40,0x00,0xe0,0x80,0x40,0x00,
49 -0x00,0xa0,0x40,0x00,0x20,0xa0,0x40,0x00,0x40,0xa0,0x40,0x00,0x60,0xa0,0x40,0x00,
50 -0x80,0xa0,0x40,0x00,0xa0,0xa0,0x40,0x00,0xc0,0xa0,0x40,0x00,0xe0,0xa0,0x40,0x00,
51 -0x00,0xc0,0x40,0x00,0x20,0xc0,0x40,0x00,0x40,0xc0,0x40,0x00,0x60,0xc0,0x40,0x00,
52 -0x80,0xc0,0x40,0x00,0xa0,0xc0,0x40,0x00,0xc0,0xc0,0x40,0x00,0xe0,0xc0,0x40,0x00,
53 -0x00,0xe0,0x40,0x00,0x20,0xe0,0x40,0x00,0x40,0xe0,0x40,0x00,0x60,0xe0,0x40,0x00,
54 -0x80,0xe0,0x40,0x00,0xa0,0xe0,0x40,0x00,0xc0,0xe0,0x40,0x00,0xe0,0xe0,0x40,0x00,
55 -0x00,0x00,0x80,0x00,0x20,0x00,0x80,0x00,0x40,0x00,0x80,0x00,0x60,0x00,0x80,0x00,
56 -0x80,0x00,0x80,0x00,0xa0,0x00,0x80,0x00,0xc0,0x00,0x80,0x00,0xe0,0x00,0x80,0x00,
57 -0x00,0x20,0x80,0x00,0x20,0x20,0x80,0x00,0x40,0x20,0x80,0x00,0x60,0x20,0x80,0x00,
58 -0x80,0x20,0x80,0x00,0xa0,0x20,0x80,0x00,0xc0,0x20,0x80,0x00,0xe0,0x20,0x80,0x00,
59 -0x00,0x40,0x80,0x00,0x20,0x40,0x80,0x00,0x40,0x40,0x80,0x00,0x60,0x40,0x80,0x00,
60 -0x80,0x40,0x80,0x00,0xa0,0x40,0x80,0x00,0xc0,0x40,0x80,0x00,0xe0,0x40,0x80,0x00,
61 -0x00,0x60,0x80,0x00,0x20,0x60,0x80,0x00,0x40,0x60,0x80,0x00,0x60,0x60,0x80,0x00,
62 -0x80,0x60,0x80,0x00,0xa0,0x60,0x80,0x00,0xc0,0x60,0x80,0x00,0xe0,0x60,0x80,0x00,
63 -0x00,0x80,0x80,0x00,0x20,0x80,0x80,0x00,0x40,0x80,0x80,0x00,0x60,0x80,0x80,0x00,
64 -0x80,0x80,0x80,0x00,0xa0,0x80,0x80,0x00,0xc0,0x80,0x80,0x00,0xe0,0x80,0x80,0x00,
65 -0x00,0xa0,0x80,0x00,0x20,0xa0,0x80,0x00,0x40,0xa0,0x80,0x00,0x60,0xa0,0x80,0x00,
66 -0x80,0xa0,0x80,0x00,0xa0,0xa0,0x80,0x00,0xc0,0xa0,0x80,0x00,0xe0,0xa0,0x80,0x00,
67 -0x00,0xc0,0x80,0x00,0x20,0xc0,0x80,0x00,0x40,0xc0,0x80,0x00,0x60,0xc0,0x80,0x00,
68 -0x80,0xc0,0x80,0x00,0xa0,0xc0,0x80,0x00,0xc0,0xc0,0x80,0x00,0xe0,0xc0,0x80,0x00,
69 -0x00,0xe0,0x80,0x00,0x20,0xe0,0x80,0x00,0x40,0xe0,0x80,0x00,0x60,0xe0,0x80,0x00,
70 -0x80,0xe0,0x80,0x00,0xa0,0xe0,0x80,0x00,0xc0,0xe0,0x80,0x00,0xe0,0xe0,0x80,0x00,
71 -0x00,0x00,0xc0,0x00,0x20,0x00,0xc0,0x00,0x40,0x00,0xc0,0x00,0x60,0x00,0xc0,0x00,
72 -0x80,0x00,0xc0,0x00,0xa0,0x00,0xc0,0x00,0xc0,0x00,0xc0,0x00,0xe0,0x00,0xc0,0x00,
73 -0x00,0x20,0xc0,0x00,0x20,0x20,0xc0,0x00,0x40,0x20,0xc0,0x00,0x60,0x20,0xc0,0x00,
74 -0x80,0x20,0xc0,0x00,0xa0,0x20,0xc0,0x00,0xc0,0x20,0xc0,0x00,0xe0,0x20,0xc0,0x00,
75 -0x00,0x40,0xc0,0x00,0x20,0x40,0xc0,0x00,0x40,0x40,0xc0,0x00,0x60,0x40,0xc0,0x00,
76 -0x80,0x40,0xc0,0x00,0xa0,0x40,0xc0,0x00,0xc0,0x40,0xc0,0x00,0xe0,0x40,0xc0,0x00,
77 -0x00,0x60,0xc0,0x00,0x20,0x60,0xc0,0x00,0x40,0x60,0xc0,0x00,0x60,0x60,0xc0,0x00,
78 -0x80,0x60,0xc0,0x00,0xa0,0x60,0xc0,0x00,0xc0,0x60,0xc0,0x00,0xe0,0x60,0xc0,0x00,
79 -0x00,0x80,0xc0,0x00,0x20,0x80,0xc0,0x00,0x40,0x80,0xc0,0x00,0x60,0x80,0xc0,0x00,
80 -0x80,0x80,0xc0,0x00,0xa0,0x80,0xc0,0x00,0xc0,0x80,0xc0,0x00,0xe0,0x80,0xc0,0x00,
81 -0x00,0xa0,0xc0,0x00,0x20,0xa0,0xc0,0x00,0x40,0xa0,0xc0,0x00,0x60,0xa0,0xc0,0x00,
82 -0x80,0xa0,0xc0,0x00,0xa0,0xa0,0xc0,0x00,0xc0,0xa0,0xc0,0x00,0xe0,0xa0,0xc0,0x00,
83 -0x00,0xc0,0xc0,0x00,0x20,0xc0,0xc0,0x00,0x40,0xc0,0xc0,0x00,0x60,0xc0,0xc0,0x00,
84 -0x80,0xc0,0xc0,0x00,0xa0,0xc0,0xc0,0x00,0xff,0xfb,0xf0,0x00,0xa0,0xa0,0xa4,0x00,
85 -0x80,0x80,0x80,0x00,0xff,0x00,0x00,0x00,0x00,0xff,0x00,0x00,0xff,0xff,0x00,0x00,
86 -0x00,0x00,0xff,0x00,0xff,0x00,0xff,0x00,0x00,0xff,0xff,0x00,0xff,0xff,0xff,0x00
87 -}; // Grabbed from a Windows DDRAW run
Index: dxgltest/dxgltest.cpp
@@ -1,629 +0,0 @@
2 -// DXGL
3 -// Copyright (C) 2011-2013 William Feely
4 -
5 -// This library is free software; you can redistribute it and/or
6 -// modify it under the terms of the GNU Lesser General Public
7 -// License as published by the Free Software Foundation; either
8 -// version 2.1 of the License, or (at your option) any later version.
9 -
10 -// This library is distributed in the hope that it will be useful,
11 -// but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 -// Lesser General Public License for more details.
14 -
15 -// You should have received a copy of the GNU Lesser General Public
16 -// License along with this library; if not, write to the Free Software
17 -// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 -
19 -#include "common.h"
20 -#include "dxgltest.h"
21 -#include "MultiDD.h"
22 -#include "tests.h"
23 -
24 -HINSTANCE hinstance;
25 -bool gradientavailable;
26 -BOOL (WINAPI *_GradientFill)(HDC hdc, TRIVERTEX* pVertices, ULONG nVertices, void* pMesh, ULONG nMeshElements, DWORD dwMode) = NULL;
27 -HRESULT (WINAPI *_EnableThemeDialogTexture)(HWND hwnd, DWORD dwFlags) = NULL;
28 -
29 -void GetFileVersion(tstring &version, LPCTSTR filename)
30 -{
31 - UINT outlen;
32 - DWORD verinfosize = GetFileVersionInfoSize(filename,NULL);
33 - void *verinfo = malloc(verinfosize);
34 - VS_FIXEDFILEINFO *rootblock;
35 - if(GetFileVersionInfo(filename,0,verinfosize,verinfo))
36 - {
37 - VerQueryValue(verinfo,_T("\\"),(VOID **)&rootblock,&outlen);
38 - TCHAR number[16];
39 - _itot(HIWORD(rootblock->dwFileVersionMS),number,10);
40 - version.assign(number);
41 - version.append(_T("."));
42 - _itot(LOWORD(rootblock->dwFileVersionMS),number,10);
43 - version.append(number);
44 - version.append(_T("."));
45 - _itot(HIWORD(rootblock->dwFileVersionLS),number,10);
46 - version.append(number);
47 - version.append(_T("."));
48 - _itot(LOWORD(rootblock->dwFileVersionLS),number,10);
49 - version.append(number);
50 - free(verinfo);
51 - }
52 - else
53 - {
54 - version = _T("NOT FOUND");
55 - free(verinfo);
56 - }
57 -}
58 -int modenum = 0;
59 -HRESULT WINAPI EnumModesCallback8(LPDDSURFACEDESC ddsd, void *list)
60 -{
61 - HWND hWnd = (HWND)list;
62 - tstring resolution;
63 - int bpp;
64 - if(ddsd->ddpfPixelFormat.dwRGBBitCount == 16)
65 - {
66 - if((ddsd->ddpfPixelFormat.dwRBitMask | ddsd->ddpfPixelFormat.dwGBitMask |
67 - ddsd->ddpfPixelFormat.dwBBitMask) == 0x7FFF) bpp = 15;
68 - else bpp = 16;
69 - }
70 - else bpp = ddsd->ddpfPixelFormat.dwRGBBitCount;
71 - TCHAR number[16];
72 - _itot(ddsd->dwWidth,number,10);
73 - resolution.append(number);
74 - resolution.append(_T("x"));
75 - _itot(ddsd->dwHeight,number,10);
76 - resolution.append(number);
77 - resolution.append(_T("x"));
78 - _itot(bpp,number,10);
79 - resolution.append(number);
80 - resolution.append(_T(","));
81 - _itot(ddsd->dwRefreshRate,number,10);
82 - resolution.append(number);
83 - resolution.append(_T("Hz"));
84 - int listnum = SendMessage(hWnd,LB_ADDSTRING,0,(LPARAM)resolution.c_str());
85 - if(ddsd->dwWidth == 640 && ddsd->dwHeight == 480 && ddsd->dwRefreshRate == 60 && ddsd->ddpfPixelFormat.dwRGBBitCount == 8)
86 - modenum = listnum;
87 - return DDENUMRET_OK;
88 -}
89 -HRESULT WINAPI EnumModesCallback32(LPDDSURFACEDESC ddsd, void *list)
90 -{
91 - HWND hWnd = (HWND)list;
92 - tstring resolution;
93 - int bpp;
94 - if(ddsd->ddpfPixelFormat.dwRGBBitCount == 16)
95 - {
96 - if((ddsd->ddpfPixelFormat.dwRBitMask | ddsd->ddpfPixelFormat.dwGBitMask |
97 - ddsd->ddpfPixelFormat.dwBBitMask) == 0x7FFF) bpp = 15;
98 - else bpp = 16;
99 - }
100 - else bpp = ddsd->ddpfPixelFormat.dwRGBBitCount;
101 - TCHAR number[16];
102 - _itot(ddsd->dwWidth,number,10);
103 - resolution.append(number);
104 - resolution.append(_T("x"));
105 - _itot(ddsd->dwHeight,number,10);
106 - resolution.append(number);
107 - resolution.append(_T("x"));
108 - _itot(bpp,number,10);
109 - resolution.append(number);
110 - resolution.append(_T(","));
111 - _itot(ddsd->dwRefreshRate,number,10);
112 - resolution.append(number);
113 - resolution.append(_T("Hz"));
114 - int listnum = SendMessage(hWnd,LB_ADDSTRING,0,(LPARAM)resolution.c_str());
115 - if(ddsd->dwWidth == 640 && ddsd->dwHeight == 480 && ddsd->dwRefreshRate == 60 && ddsd->ddpfPixelFormat.dwRGBBitCount == 32)
116 - modenum = listnum;
117 - return DDENUMRET_OK;
118 -}
119 -
120 -void TranslateResolutionString(LPCTSTR str, int &width, int &height, int &bpp, int &refresh)
121 -{
122 - tstring tmp = str;
123 - tstring tmp2 = tmp.substr(0,tmp.find(_T("x")));
124 - width = _ttoi(tmp2.c_str());
125 - tmp = tmp.substr(tmp2.length()+1);
126 - tmp2 = tmp.substr(0,tmp.find(_T("x")));
127 - height = _ttoi(tmp2.c_str());
128 - tmp = tmp.substr(tmp2.length()+1);
129 - tmp2 = tmp.substr(0,tmp.find(_T(",")));
130 - bpp = _ttoi(tmp2.c_str());
131 - tmp = tmp.substr(tmp2.length()+1);
132 - tmp2 = tmp.substr(0,tmp.find(_T("H")));
133 - refresh = _ttoi(tmp2.c_str());
134 -}
135 -
136 -
137 -const TCHAR *dllnames[] = {
138 - _T("ddraw.dll"),
139 -};
140 -
141 -int dllboxes[] = {
142 - IDC_DDVER,
143 -};
144 -
145 -INT_PTR CALLBACK SysTabCallback(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
146 -{
147 - HMODULE mod_ddraw;
148 - BOOL (WINAPI *IsDXGLDDraw)();
149 - int i;
150 - tstring ver;
151 - switch(Msg)
152 - {
153 - case WM_INITDIALOG:
154 - if (_EnableThemeDialogTexture) _EnableThemeDialogTexture(hWnd, ETDT_ENABLETAB);
155 - mod_ddraw = LoadLibrary(_T("ddraw.dll"));
156 - IsDXGLDDraw = GetProcAddress(mod_ddraw,"IsDXGLDDraw");
157 - if(IsDXGLDDraw) SetWindowText(GetDlgItem(hWnd,IDC_DDTYPE),_T("DXGL"));
158 - else SetWindowText(GetDlgItem(hWnd,IDC_DDTYPE),_T("System"));
159 - FreeLibrary(mod_ddraw);
160 - GetFileVersion(ver,dllnames[0]);
161 - SetWindowText(GetDlgItem(hWnd,dllboxes[0]),ver.c_str());
162 - if(!IsDXGLDDraw)
163 - {
164 - for(i = 1; i < 1; i++)
165 - {
166 - GetFileVersion(ver,dllnames[i]);
167 - SetWindowText(GetDlgItem(hWnd,dllboxes[i]),ver.c_str());
168 - }
169 - }
170 - else
171 - {
172 - for(i = 1; i < 1; i++)
173 - SetWindowText(GetDlgItem(hWnd,dllboxes[i]),_T("N/A"));
174 - }
175 - break;
176 - case WM_COMMAND:
177 - switch(LOWORD(wParam))
178 - {
179 - case IDC_DXDIAG:
180 - _spawnlp(_P_NOWAIT,"dxdiag.exe","dxdiag.exe",NULL);
181 - break;
182 - default:
183 - break;
184 - }
185 - break;
186 - default:
187 - return FALSE;
188 - }
189 - return TRUE;
190 -}
191 -
192 -typedef struct
193 -{
194 - int minver;
195 - int maxver;
196 - int buffermin;
197 - int buffermax;
198 - BOOL usesfps;
199 - float defaultfps;
200 - BOOL is3d;
201 - BOOL usestexture;
202 - BOOL usesfsaa;
203 - TCHAR *name;
204 -} TEST_ITEM;
205 -
206 -// Use EXACTLY one line per entry. Don't change layout of the list.
207 -const int START_TESTS = __LINE__;
208 -const TEST_ITEM Tests[] =
209 -{ // minver maxver buffermin max usesfps defaultfps is3d usestexture usesfsaa name
210 - {1, 7, 0, 4, TRUE, 1.0, FALSE, FALSE, FALSE, _T("Color palette and gradient screens (direct surface access)")},
211 - {1, 7, 0, 1, FALSE, 0.0, FALSE, FALSE, FALSE, _T("Random noise (continuous surface upload)")},
212 - {1, 7, 0, 7, TRUE, 1.0, FALSE, FALSE, FALSE, _T("GDI Test patterns (GetDC() test)")},
213 - {1, 7, 0, 0, FALSE, 0.0, FALSE, FALSE, FALSE, _T("Random GDI patterns (does not clear screen between paints)")},
214 - {1, 7, 0, 1, TRUE, 60.0, FALSE, FALSE, FALSE, _T("BltFast background and sprites")},
215 - {1, 7, 0, 0, FALSE, 0.0, FALSE, FALSE, FALSE, _T("Random color fill Blt() paterns")},
216 - {1, 7, 0, 0, FALSE, 0.0, FALSE, FALSE, FALSE, _T("Mouse pointer event test")},
217 - {1, 7, 1, 1, TRUE, 1.0, FALSE, FALSE, FALSE, _T("Raster Operation Blt() test")},
218 - {1, 7, 0, 0, FALSE, 0.0, FALSE, FALSE, FALSE, _T("Mirrored and Rotated Blt() test")},
219 - {1, 7, 0, 1, FALSE, 0.0, FALSE, FALSE, FALSE, _T("Large batch color fill Blt() operations")},
220 - {1, 7, 0, 1, TRUE, 60.0, FALSE, FALSE, FALSE, _T("Source Color Key Override test")},
221 - {1, 7, 0, 1, TRUE, 60.0, FALSE, FALSE, FALSE, _T("Destination Color Key Override test")},
222 - {7, 7, 0, 2, TRUE, 60.0, TRUE, FALSE, TRUE, _T("DrawIndexedPrimitive cube with directional light (DX7)")},
223 - {7, 7, 0, 2, TRUE, 60.0, TRUE, TRUE, TRUE, _T("DrawPrimitive textured cube (DX7)")},
224 - {7, 7, 0, 0, TRUE, 60.0, TRUE, TRUE, TRUE, _T("Texture Stage shaders (Interactive, DX7)")},
225 - {7, 7, 0, 0, TRUE, 60.0, TRUE, TRUE, TRUE, _T("Vertex shaders (Interactive, DX7)")}
226 -};
227 -const int END_TESTS = __LINE__ - 4;
228 -const int numtests = END_TESTS - START_TESTS;
229 -
230 -int currenttest = 0;
231 -int minapi = 1;
232 -int maxapi = 7;
233 -int minbuffer = 0;
234 -int maxbuffer = 4;
235 -int fps_enabled = false;
236 -int api = 1;
237 -int buffer = 1;
238 -int filter = 0;
239 -int msaa = 0;
240 -bool fullscreen = true;
241 -bool resizable = false;
242 -double framerate = 1.00;
243 -TCHAR frameratestring[33];
244 -
245 -TCHAR tmpstring[33];
246 -
247 -INT_PTR CALLBACK TestTabCallback(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
248 -{
249 - int i;
250 - int pos;
251 - double f;
252 - LPDIRECTDRAW lpdd;
253 - HRESULT error;
254 - int width,height,bpp,refresh;
255 - switch(Msg)
256 - {
257 - case WM_INITDIALOG:
258 - if (_EnableThemeDialogTexture) _EnableThemeDialogTexture(hWnd, ETDT_ENABLETAB);
259 - SendDlgItemMessage(hWnd,IDC_FULLSCREEN,BM_SETCHECK,1,0);
260 - for(i = 0; i < numtests; i++)
261 - SendDlgItemMessage(hWnd,IDC_TESTLIST,LB_ADDSTRING,0,(LPARAM)Tests[i].name);
262 - error = DirectDrawCreate(NULL,&lpdd,NULL);
263 - if(error == DD_OK)
264 - {
265 - error = lpdd->EnumDisplayModes(DDEDM_REFRESHRATES,NULL,GetDlgItem(hWnd,IDC_VIDMODES),EnumModesCallback8);
266 - lpdd->Release();
267 - }
268 - SendDlgItemMessage(hWnd,IDC_VIDMODES,LB_SETCURSEL,modenum,0);
269 - break;
270 - case WM_COMMAND:
271 - switch(LOWORD(wParam))
272 - {
273 - case IDC_TESTLIST:
274 - if(HIWORD(wParam) == LBN_SELCHANGE)
275 - {
276 - i = SendDlgItemMessage(hWnd,IDC_TESTLIST,LB_GETCURSEL,0,0);
277 - if(i != -1)
278 - {
279 - currenttest = i;
280 - minapi = Tests[i].minver;
281 - maxapi = Tests[i].maxver;
282 - if (api < minapi)
283 - {
284 - SendDlgItemMessage(hWnd, IDC_APIVER, WM_SETTEXT, 0, (LPARAM)_itot(minapi, tmpstring, 10));
285 - api = minapi;
286 - }
287 - if (api > maxapi)
288 - {
289 - SendDlgItemMessage(hWnd, IDC_APIVER, WM_SETTEXT, 0, (LPARAM)_itot(maxapi, tmpstring, 10));
290 - api = maxapi;
291 - }
292 - minbuffer = Tests[i].buffermin;
293 - maxbuffer = Tests[i].buffermax;
294 - fps_enabled = Tests[i].usesfps;
295 - if(Tests[i].usesfps) framerate = Tests[i].defaultfps;
296 - if((i != 14) && (i != 15))
297 - {
298 - EnableWindow(GetDlgItem(hWnd,IDC_BUFFERS),TRUE);
299 - EnableWindow(GetDlgItem(hWnd,IDC_APIVER),TRUE);
300 - EnableWindow(GetDlgItem(hWnd,IDC_FRAMERATE),fps_enabled);
301 - EnableWindow(GetDlgItem(hWnd,IDC_TEST),TRUE);
302 - EnableWindow(GetDlgItem(hWnd,IDC_WINDOWED),TRUE);
303 - EnableWindow(GetDlgItem(hWnd,IDC_FULLSCREEN),TRUE);
304 - EnableWindow(GetDlgItem(hWnd,IDC_RESIZABLE),TRUE);
305 - EnableWindow(GetDlgItem(hWnd,IDC_TESTVSYNC),TRUE);
306 - EnableWindow(GetDlgItem(hWnd,IDC_VIDMODES),TRUE);
307 - }
308 - else
309 - {
310 - EnableWindow(GetDlgItem(hWnd,IDC_BUFFERS),FALSE);
311 - EnableWindow(GetDlgItem(hWnd,IDC_APIVER),TRUE);
312 - EnableWindow(GetDlgItem(hWnd,IDC_FRAMERATE),FALSE);
313 - EnableWindow(GetDlgItem(hWnd,IDC_TEST),TRUE);
314 - EnableWindow(GetDlgItem(hWnd,IDC_WINDOWED),FALSE);
315 - EnableWindow(GetDlgItem(hWnd,IDC_FULLSCREEN),FALSE);
316 - EnableWindow(GetDlgItem(hWnd,IDC_RESIZABLE),FALSE);
317 - EnableWindow(GetDlgItem(hWnd,IDC_TESTVSYNC),FALSE);
318 - EnableWindow(GetDlgItem(hWnd,IDC_VIDMODES),FALSE);
319 - SendDlgItemMessage(hWnd,IDC_WINDOWED,BM_SETCHECK,BST_CHECKED,0);
320 - SendDlgItemMessage(hWnd,IDC_FULLSCREEN,BM_SETCHECK,BST_UNCHECKED,0);
321 - fullscreen = false;
322 - }
323 - SendDlgItemMessage(hWnd,IDC_BUFFERS,EM_SETLIMITTEXT,2,0);
324 - SendDlgItemMessage(hWnd,IDC_APIVER,EM_SETLIMITTEXT,1,0);
325 - SendDlgItemMessage(hWnd,IDC_FRAMERATE,EM_SETLIMITTEXT,5,0);
326 - SendDlgItemMessage(hWnd,IDC_BUFFERS,WM_SETTEXT,0,(LPARAM)_itot(buffer,tmpstring,10));
327 - SendDlgItemMessage(hWnd,IDC_APIVER,WM_SETTEXT,0,(LPARAM)_itot(api,tmpstring,10));
328 - _stprintf(frameratestring,_T("%.2f"),framerate);
329 - SendDlgItemMessage(hWnd,IDC_FRAMERATE,WM_SETTEXT,0,(LPARAM)frameratestring);
330 - }
331 - }
332 - else if (HIWORD(wParam) == LBN_DBLCLK)
333 - {
334 - if (SendDlgItemMessage(hWnd, IDC_RESIZABLE, BM_GETCHECK, 0, 0)) resizable = true;
335 - else resizable = false;
336 - if (buffer < minbuffer) buffer = minbuffer;
337 - if (buffer > maxbuffer) buffer = maxbuffer;
338 - i = SendDlgItemMessage(hWnd, IDC_VIDMODES, LB_GETCURSEL, 0, 0);
339 - SendDlgItemMessage(hWnd, IDC_VIDMODES, LB_GETTEXT, i, (LPARAM)tmpstring);
340 - TranslateResolutionString(tmpstring, width, height, bpp, refresh);
341 - RunDXGLTest(currenttest, width, height, bpp, refresh, buffer, api,
342 - filter, msaa, framerate, fullscreen, resizable, Tests[currenttest].is3d);
343 - break;
344 - }
345 - break;
346 - case IDC_FRAMERATE:
347 - if(HIWORD(wParam) == EN_CHANGE)
348 - {
349 - SendDlgItemMessage(hWnd,IDC_FRAMERATE,WM_GETTEXT,6,(LPARAM)tmpstring);
350 - if(_tcscmp(frameratestring,tmpstring))
351 - {
352 - pos = LOWORD(SendDlgItemMessage(hWnd,IDC_FRAMERATE,EM_GETSEL,NULL,NULL));
353 - i = _tcslen(tmpstring);
354 - f = _ttof(tmpstring);
355 - if(errno != ERANGE) framerate = f;
356 - if(framerate < 0.5) framerate = 0.5;
357 - if(framerate > 99.99) framerate = 99.99;
358 - _stprintf(frameratestring,_T("%.2f"),framerate);
359 - SendDlgItemMessage(hWnd,IDC_FRAMERATE,WM_SETTEXT,0,(LPARAM)frameratestring);
360 - SendDlgItemMessage(hWnd,IDC_FRAMERATE,EM_SETSEL,pos,pos);
361 - }
362 - }
363 - break;
364 - case IDC_APIVER:
365 - if(HIWORD(wParam) == EN_CHANGE)
366 - {
367 - SendDlgItemMessage(hWnd,IDC_APIVER,WM_GETTEXT,6,(LPARAM)tmpstring);
368 - i = _ttoi(tmpstring);
369 - if(i != api)
370 - {
371 - api = i;
372 - if(api == 5) api = 4;
373 - if(api == 6) api = 7;
374 - if(api < minapi) api = minapi;
375 - if(api > maxapi) api = maxapi;
376 - _itot(api,tmpstring,10);
377 - SendDlgItemMessage(hWnd,IDC_APIVER,WM_SETTEXT,0,(LPARAM)tmpstring);
378 - }
379 - }
380 - break;
381 - case IDC_BUFFERS:
382 - if(HIWORD(wParam) == EN_CHANGE)
383 - {
384 - SendDlgItemMessage(hWnd,IDC_BUFFERS,WM_GETTEXT,6,(LPARAM)tmpstring);
385 - i = _ttoi(tmpstring);
386 - if(i != buffer)
387 - {
388 - buffer = i;
389 - if(buffer < minbuffer) buffer = minbuffer;
390 - if(buffer > maxbuffer) buffer = maxbuffer;
391 - _itot(buffer,tmpstring,10);
392 - SendDlgItemMessage(hWnd,IDC_BUFFERS,WM_SETTEXT,0,(LPARAM)tmpstring);
393 - }
394 - }
395 - break;
396 - case IDC_TEST:
397 - if(SendDlgItemMessage(hWnd,IDC_RESIZABLE,BM_GETCHECK,0,0)) resizable = true;
398 - else resizable = false;
399 - if (buffer < minbuffer) buffer = minbuffer;
400 - if (buffer > maxbuffer) buffer = maxbuffer;
401 - i = SendDlgItemMessage(hWnd, IDC_VIDMODES, LB_GETCURSEL, 0, 0);
402 - SendDlgItemMessage(hWnd,IDC_VIDMODES,LB_GETTEXT,i,(LPARAM)tmpstring);
403 - TranslateResolutionString(tmpstring,width,height,bpp,refresh);
404 - RunDXGLTest(currenttest, width, height, bpp, refresh, buffer, api,
405 - filter, msaa, framerate, fullscreen, resizable, Tests[currenttest].is3d);
406 - break;
407 - case IDC_WINDOWED:
408 - SendDlgItemMessage(hWnd,IDC_FULLSCREEN,BM_SETCHECK,0,0);
409 - SendDlgItemMessage(hWnd,IDC_WINDOWED,BM_SETCHECK,1,0);
410 - fullscreen = false;
411 - break;
412 - case IDC_FULLSCREEN:
413 - SendDlgItemMessage(hWnd,IDC_FULLSCREEN,BM_SETCHECK,1,0);
414 - SendDlgItemMessage(hWnd,IDC_WINDOWED,BM_SETCHECK,0,0);
415 - fullscreen = true;
416 - break;
417 - }
418 - break;
419 - case WM_NOTIFY:
420 - switch(((LPNMHDR)lParam)->code)
421 - {
422 - case UDN_DELTAPOS:
423 - switch(((LPNMHDR)lParam)->idFrom)
424 - {
425 - case IDC_SPINFRAME:
426 - framerate -= ((LPNMUPDOWN)lParam)->iDelta;
427 - if(framerate < 0.01) framerate = 0.01;
428 - if(framerate > 99.99) framerate = 99.99;
429 - _stprintf(frameratestring,_T("%.2f"),framerate);
430 - SendDlgItemMessage(hWnd,IDC_FRAMERATE,WM_SETTEXT,0,(LPARAM)frameratestring);
431 - break;
432 - case IDC_SPINAPI:
433 - if(api < 1) api = 1;
434 - if(api > 7) api = 7;
435 - if(((LPNMUPDOWN)lParam)->iDelta > 0)
436 - {
437 - switch(api)
438 - {
439 - case 1:
440 - case 2:
441 - default:
442 - api = 1;
443 - break;
444 - case 3:
445 - api = 2;
446 - break;
447 - case 4:
448 - api = 3;
449 - break;
450 - case 7:
451 - case 6:
452 - case 5:
453 - api = 4;
454 - }
455 - }
456 - else
457 - {
458 - switch(api)
459 - {
460 - case 1:
461 - default:
462 - api = 2;
463 - break;
464 - case 2:
465 - api = 3;
466 - break;
467 - case 3:
468 - api = 4;
469 - break;
470 - case 4:
471 - case 5:
472 - case 6:
473 - case 7:
474 - api = 7;
475 - }
476 - }
477 - if(api < minapi) api = minapi;
478 - if(api > maxapi) api = maxapi;
479 - SendDlgItemMessage(hWnd,IDC_APIVER,WM_SETTEXT,0,(LPARAM)_itot(api,tmpstring,10));
480 - break;
481 - case IDC_SPINBACK:
482 - buffer -= ((LPNMUPDOWN)lParam)->iDelta;
483 - if(buffer < minbuffer) buffer = minbuffer;
484 - if(buffer > maxbuffer) buffer = maxbuffer;
485 - SendDlgItemMessage(hWnd,IDC_BUFFERS,WM_SETTEXT,0,(LPARAM)_itot(buffer,tmpstring,10));
486 - break;
487 - default:
488 - break;
489 - }
490 - break;
491 - default:
492 - break;
493 - }
494 - break;
495 - default:
496 - return FALSE;
497 - }
498 - return TRUE;
499 -}
500 -
501 -HWND tabwnd[3];
502 -int tabopen;
503 -INT_PTR CALLBACK DXGLTestCallback(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
504 -{
505 - TCITEM tab;
506 - HWND hTab;
507 - RECT tabrect;
508 - NMHDR *nm;
509 - HICON icon;
510 - int newtab;
511 - ZeroMemory(&tab, sizeof(TCITEM));
512 - switch(Msg)
513 - {
514 - case WM_INITDIALOG:
515 - icon = (HICON)LoadImage(hinstance,MAKEINTRESOURCE(IDI_DXGLSM),IMAGE_ICON,
516 - GetSystemMetrics(SM_CXSMICON),GetSystemMetrics(SM_CYSMICON),0);
517 - SendMessage(hWnd,WM_SETICON,ICON_SMALL,(LPARAM)icon);
518 - icon = (HICON)LoadImage(hinstance,MAKEINTRESOURCE(IDI_DXGL),IMAGE_ICON,
519 - GetSystemMetrics(SM_CXICON),GetSystemMetrics(SM_CYICON),0);
520 - SendMessage(hWnd,WM_SETICON,ICON_BIG,(LPARAM)icon);
521 - tab.mask = TCIF_TEXT;
522 - tab.pszText = _T("System");
523 - SendDlgItemMessage(hWnd,IDC_TABS,TCM_INSERTITEM,0,(LPARAM)&tab);
524 - tab.pszText = _T("Graphics tests");
525 - hTab = GetDlgItem(hWnd,IDC_TABS);
526 - SendDlgItemMessage(hWnd,IDC_TABS,TCM_INSERTITEM,1,(LPARAM)&tab);
527 - tabwnd[0] = CreateDialog(hinstance,MAKEINTRESOURCE(IDD_SYSINFO),hTab,SysTabCallback);
528 - tabwnd[1] = CreateDialog(hinstance,MAKEINTRESOURCE(IDD_TESTGFX),hTab,TestTabCallback);
529 - SendDlgItemMessage(hWnd,IDC_TABS,TCM_GETITEMRECT,0,(LPARAM)&tabrect);
530 - SetWindowPos(tabwnd[0],NULL,tabrect.left,tabrect.bottom+3,0,0,SWP_SHOWWINDOW|SWP_NOSIZE);
531 - ShowWindow(tabwnd[1],SW_HIDE);
532 - ShowWindow(tabwnd[2],SW_HIDE);
533 - tabopen = 0;
534 - ShowWindow(hWnd,SW_SHOWNORMAL);
535 - return TRUE;
536 - case WM_COMMAND:
537 - switch(LOWORD(wParam))
538 - {
539 - case IDOK:
540 - case IDCANCEL:
541 - EndDialog(hWnd,IDOK);
542 - break;
543 - }
544 - break;
545 - case WM_CLOSE:
546 - EndDialog(hWnd,IDCANCEL);
547 - break;
548 - case WM_NOTIFY:
549 - nm = (LPNMHDR) lParam;
550 - if(nm->code == TCN_SELCHANGE)
551 - {
552 - newtab = SendDlgItemMessage(hWnd,IDC_TABS,TCM_GETCURSEL,0,0);
553 - if(newtab != tabopen)
554 - {
555 - ShowWindow(tabwnd[tabopen],SW_HIDE);
556 - tabopen = newtab;
557 - SendDlgItemMessage(hWnd,IDC_TABS,TCM_GETITEMRECT,0,(LPARAM)&tabrect);
558 - SetWindowPos(tabwnd[tabopen],NULL,tabrect.left,tabrect.bottom+3,0,0,SWP_SHOWWINDOW|SWP_NOSIZE);
559 - }
560 - }
561 - break;
562 - default:
563 - return FALSE;
564 - }
565 - return TRUE;
566 -}
567 -
568 -#ifdef __GNUC__
569 -#ifndef INITCOMMONCONTROLSEX
570 -typedef struct tagINITCOMMONCONTROLSEX {
571 - DWORD dwSize;
572 - DWORD dwICC;
573 -} INITCOMMONCONTROLSEX, *LPINITCOMMONCONTROLSEX;
574 -#endif
575 -#endif
576 -
577 -int APIENTRY _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow)
578 -{
579 - if(_tcsstr(lpCmdLine,_T("install")))
580 - {
581 - LPDIRECTDRAW lpdd;
582 - DirectDrawCreate(NULL,&lpdd,NULL);
583 - lpdd->Release();
584 - return 0;
585 - }
586 - OSVERSIONINFO verinfo;
587 - verinfo.dwOSVersionInfoSize = sizeof(verinfo);
588 - GetVersionEx(&verinfo);
589 - if(verinfo.dwMajorVersion > 4) gradientavailable = true;
590 - else if(verinfo.dwMajorVersion >= 4 && verinfo.dwMinorVersion >= 1) gradientavailable = true;
591 - else gradientavailable = false;
592 - HMODULE msimg32 = NULL;;
593 - if(gradientavailable)
594 - {
595 - msimg32 = LoadLibrary(_T("msimg32.dll"));
596 - if(!msimg32) gradientavailable = false;
597 - if(gradientavailable) _GradientFill =
598 - (BOOL(_stdcall*)(HDC,TRIVERTEX*,ULONG,void*,ULONG,DWORD))
599 - GetProcAddress(msimg32,"GradientFill");
600 - if(!_GradientFill)
601 - {
602 - if(msimg32)FreeLibrary(msimg32);
603 - msimg32 = NULL;
604 - gradientavailable = false;
605 - }
606 - }
607 - MessageBox(NULL, _T("DXGL Test is no longer a standalone application. This version is no longer maintained. Please use DXGL Config instead."),
608 -_T("Notice"), MB_OK | MB_ICONWARNING);
609 - INITCOMMONCONTROLSEX icc;
610 - icc.dwSize = sizeof(icc);
611 - icc.dwICC = ICC_WIN95_CLASSES;
612 - HMODULE comctl32 = LoadLibrary(_T("comctl32.dll"));
613 - BOOL (WINAPI *iccex)(LPINITCOMMONCONTROLSEX lpInitCtrls);
614 - if(comctl32) iccex =(BOOL (WINAPI *)(LPINITCOMMONCONTROLSEX))
615 - GetProcAddress(comctl32,"InitCommonControlsEx");
616 - if(iccex) iccex(&icc);
617 - else InitCommonControls();
618 - if(comctl32) FreeLibrary(comctl32);
619 - HMODULE uxtheme = LoadLibrary(_T("uxtheme.dll"));
620 - if (uxtheme) _EnableThemeDialogTexture = (HRESULT(WINAPI*)(HWND, DWORD))
621 - GetProcAddress(uxtheme, "EnableThemeDialogTexture");
622 - hinstance = hInstance;
623 - DialogBox(hinstance,MAKEINTRESOURCE(IDD_DXGLTEST),NULL,DXGLTestCallback);
624 - if(msimg32) FreeLibrary(msimg32);
625 - if (uxtheme) FreeLibrary(uxtheme);
626 -#ifdef _DEBUG
627 - _CrtDumpMemoryLeaks();
628 -#endif
629 - return 0;
630 -}
Index: dxgltest/misc.h
@@ -1,33 +0,0 @@
2 -// DXGL
3 -// Copyright (C) 2011 William Feely
4 -
5 -// This library is free software; you can redistribute it and/or
6 -// modify it under the terms of the GNU Lesser General Public
7 -// License as published by the Free Software Foundation; either
8 -// version 2.1 of the License, or (at your option) any later version.
9 -
10 -// This library is distributed in the hope that it will be useful,
11 -// but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 -// Lesser General Public License for more details.
14 -
15 -// You should have received a copy of the GNU Lesser General Public
16 -// License along with this library; if not, write to the Free Software
17 -// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 -
19 -#pragma once
20 -#ifndef _MISC_H
21 -#define _MISC_H
22 -
23 -inline unsigned int rand32(unsigned int &n)
24 -{
25 - return n=(((unsigned int) 1103515245 * n) + (unsigned int) 12345) %
26 - (unsigned int) 0xFFFFFFFF;
27 -}
28 -
29 -inline float randfloat(float multiple)
30 -{
31 - return ((float)rand() / (float)RAND_MAX)*multiple;
32 -}
33 -
34 -#endif //_MISC_H
\ No newline at end of file
Index: dxgltest/MultiDD.cpp
@@ -1,702 +0,0 @@
2 -// DXGL
3 -// Copyright (C) 2011-2013 William Feely
4 -
5 -// This library is free software; you can redistribute it and/or
6 -// modify it under the terms of the GNU Lesser General Public
7 -// License as published by the Free Software Foundation; either
8 -// version 2.1 of the License, or (at your option) any later version.
9 -
10 -// This library is distributed in the hope that it will be useful,
11 -// but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 -// Lesser General Public License for more details.
14 -
15 -// You should have received a copy of the GNU Lesser General Public
16 -// License along with this library; if not, write to the Free Software
17 -// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 -
19 -#include "common.h"
20 -#include "MultiDD.h"
21 -
22 -
23 -MultiDirectDraw::MultiDirectDraw(int version, HRESULT *error, GUID *lpGUID)
24 -{
25 - dd1 = NULL;
26 - dd2 = NULL;
27 - dd4 = NULL;
28 - dd7 = NULL;
29 - this->version = version;
30 - *error = DD_OK;
31 - if(version < 7) *error = DirectDrawCreate(lpGUID,&dd1,NULL);
32 - if(FAILED(*error)) return;
33 - switch(version)
34 - {
35 - case 1:
36 - break;
37 - case 2:
38 - case 3:
39 - *error = dd1->QueryInterface(IID_IDirectDraw2,(LPVOID*)&dd2);
40 - dd1->Release();
41 - dd1 = NULL;
42 - break;
43 - case 4:
44 - *error = dd1->QueryInterface(IID_IDirectDraw4,(LPVOID*)&dd4);
45 - dd1->Release();
46 - dd1 = NULL;
47 - break;
48 - case 7:
49 - *error = DirectDrawCreateEx(lpGUID,(LPVOID*)&dd7,IID_IDirectDraw7,NULL);
50 - break;
51 - default:
52 - *error = DDERR_INVALIDPARAMS;
53 - break;
54 - }
55 - refcount = 1;
56 -}
57 -
58 -MultiDirectDraw::~MultiDirectDraw()
59 -{
60 - if(dd1) dd1->Release();
61 - if(dd2) dd2->Release();
62 - if(dd4) dd4->Release();
63 - if(dd7) dd7->Release();
64 -}
65 -
66 -ULONG MultiDirectDraw::AddRef()
67 -{
68 - refcount++;
69 - return refcount;
70 -}
71 -
72 -ULONG MultiDirectDraw::Release()
73 -{
74 - ULONG ret;
75 - refcount--;
76 - ret = refcount;
77 - if(!refcount) delete this;
78 - return ret;
79 -}
80 -
81 -HRESULT MultiDirectDraw::CreateClipper(DWORD dwFlags, LPDIRECTDRAWCLIPPER FAR *lplpDDClipper, IUnknown FAR *pUnkOuter)
82 -{
83 - switch(version)
84 - {
85 - case 1:
86 - return dd1->CreateClipper(dwFlags,lplpDDClipper,pUnkOuter);
87 - case 2:
88 - case 3:
89 - return dd2->CreateClipper(dwFlags,lplpDDClipper,pUnkOuter);
90 - case 4:
91 - return dd4->CreateClipper(dwFlags,lplpDDClipper,pUnkOuter);
92 - case 7:
93 - return dd7->CreateClipper(dwFlags,lplpDDClipper,pUnkOuter);
94 - default:
95 - return DDERR_GENERIC;
96 - }
97 -}
98 -HRESULT MultiDirectDraw::CreatePalette(DWORD dwFlags, LPPALETTEENTRY lpDDColorArray, LPDIRECTDRAWPALETTE FAR *lplpDDPalette, IUnknown FAR *pUnkOuter)
99 -{
100 - switch(version)
101 - {
102 - case 1:
103 - return dd1->CreatePalette(dwFlags,lpDDColorArray,lplpDDPalette,pUnkOuter);
104 - case 2:
105 - case 3:
106 - return dd2->CreatePalette(dwFlags,lpDDColorArray,lplpDDPalette,pUnkOuter);
107 - case 4:
108 - return dd4->CreatePalette(dwFlags,lpDDColorArray,lplpDDPalette,pUnkOuter);
109 - case 7:
110 - return dd7->CreatePalette(dwFlags,lpDDColorArray,lplpDDPalette,pUnkOuter);
111 - default:
112 - return DDERR_GENERIC;
113 - }
114 -}
115 -HRESULT MultiDirectDraw::CreateSurface(LPDDSURFACEDESC2 lpDDSurfaceDesc2, MultiDirectDrawSurface FAR **lplpDDSurface, IUnknown FAR *pUnkOuter)
116 -{
117 - ddsm = NULL;
118 - HRESULT error;
119 - switch(version)
120 - {
121 - case 1:
122 - error = dd1->CreateSurface((LPDDSURFACEDESC)lpDDSurfaceDesc2,&dds1,pUnkOuter);
123 - if(error != DD_OK) break;
124 - ddsm = new MultiDirectDrawSurface(1,(LPVOID)dds1);
125 - break;
126 - case 2:
127 - error = dd2->CreateSurface((LPDDSURFACEDESC)lpDDSurfaceDesc2,&dds1,pUnkOuter);
128 - if(error != DD_OK) break;
129 - dds1->QueryInterface(IID_IDirectDrawSurface2,(LPVOID*)&dds2);
130 - dds1->Release();
131 - ddsm = new MultiDirectDrawSurface(2,(LPVOID)dds2);
132 - break;
133 - case 3:
134 - error = dd2->CreateSurface((LPDDSURFACEDESC)lpDDSurfaceDesc2,&dds1,pUnkOuter);
135 - if(error != DD_OK) break;
136 - dds1->QueryInterface(IID_IDirectDrawSurface3,(LPVOID*)&dds3);
137 - dds1->Release();
138 - ddsm = new MultiDirectDrawSurface(3,(LPVOID)dds3);
139 - break;
140 - case 4:
141 - error = dd4->CreateSurface(lpDDSurfaceDesc2,&dds4,pUnkOuter);
142 - if(error != DD_OK) break;
143 - ddsm = new MultiDirectDrawSurface(4,(LPVOID)dds4);
144 - break;
145 - case 7:
146 - error = dd7->CreateSurface(lpDDSurfaceDesc2,&dds7,pUnkOuter);
147 - if(error != DD_OK) break;
148 - ddsm = new MultiDirectDrawSurface(7,(LPVOID)dds7);
149 - break;
150 - default:
151 - return DDERR_GENERIC;
152 - }
153 - if(ddsm) *lplpDDSurface = ddsm;
154 - return error;
155 -}
156 -
157 -HRESULT MultiDirectDraw::GetCaps(LPDDCAPS lpDDDriverCaps, LPDDCAPS lpDDHELCaps)
158 -{
159 - switch (version)
160 - {
161 - case 1:
162 - return dd1->GetCaps(lpDDDriverCaps, lpDDHELCaps);
163 - case 2:
164 - case 3:
165 - return dd2->GetCaps(lpDDDriverCaps, lpDDHELCaps);
166 - case 4:
167 - return dd4->GetCaps(lpDDDriverCaps, lpDDHELCaps);
168 - case 7:
169 - return dd7->GetCaps(lpDDDriverCaps, lpDDHELCaps);
170 - default:
171 - return DDERR_GENERIC;
172 - }
173 -}
174 -
175 -HRESULT MultiDirectDraw::SetCooperativeLevel(HWND hWnd, DWORD dwFlags)
176 -{
177 - switch(version)
178 - {
179 - case 1:
180 - return dd1->SetCooperativeLevel(hWnd,dwFlags);
181 - case 2:
182 - case 3:
183 - return dd2->SetCooperativeLevel(hWnd,dwFlags);
184 - case 4:
185 - return dd4->SetCooperativeLevel(hWnd,dwFlags);
186 - case 7:
187 - return dd7->SetCooperativeLevel(hWnd,dwFlags);
188 - default:
189 - return DDERR_GENERIC;
190 - }
191 -}
192 -HRESULT MultiDirectDraw::SetDisplayMode(DWORD dwWidth, DWORD dwHeight, DWORD dwBPP, DWORD dwRefreshRate, DWORD dwFlags)
193 -{
194 - switch(version)
195 - {
196 - case 1:
197 - return dd1->SetDisplayMode(dwWidth,dwHeight,dwBPP);
198 - case 2:
199 - case 3:
200 - return dd2->SetDisplayMode(dwWidth,dwHeight,dwBPP,dwRefreshRate,dwFlags);
201 - case 4:
202 - return dd4->SetDisplayMode(dwWidth,dwHeight,dwBPP,dwRefreshRate,dwFlags);
203 - case 7:
204 - return dd7->SetDisplayMode(dwWidth,dwHeight,dwBPP,dwRefreshRate,dwFlags);
205 - default:
206 - return DDERR_GENERIC;
207 - }
208 -}
209 -HRESULT MultiDirectDraw::QueryInterface(REFIID riid, void** ppvObj)
210 -{
211 - switch(version)
212 - {
213 - case 1:
214 - return dd1->QueryInterface(riid,ppvObj);
215 - case 2:
216 - case 3:
217 - return dd2->QueryInterface(riid,ppvObj);
218 - case 4:
219 - return dd4->QueryInterface(riid,ppvObj);
220 - case 7:
221 - return dd7->QueryInterface(riid,ppvObj);
222 - default:
223 - return NULL;
224 - }
225 -}
226 -
227 -
228 -
229 -MultiDirectDrawSurface::MultiDirectDrawSurface(int version, LPVOID surface)
230 -{
231 - dds1 = NULL;
232 - dds2 = NULL;
233 - dds3 = NULL;
234 - dds4 = NULL;
235 - dds7 = NULL;
236 - this->version = version;
237 - switch(version)
238 - {
239 - case 1:
240 - dds1 = (LPDIRECTDRAWSURFACE)surface;
241 - break;
242 - case 2:
243 - dds2 = (LPDIRECTDRAWSURFACE2)surface;
244 - break;
245 - case 3:
246 - dds3 = (LPDIRECTDRAWSURFACE3)surface;
247 - break;
248 - case 4:
249 - dds4 = (LPDIRECTDRAWSURFACE4)surface;
250 - break;
251 - case 7:
252 - dds7 = (LPDIRECTDRAWSURFACE7)surface;
253 - break;
254 - default:
255 - break;
256 - }
257 - refcount = 1;
258 -}
259 -
260 -MultiDirectDrawSurface::~MultiDirectDrawSurface()
261 -{
262 - if(dds1) dds1->Release();
263 - if(dds2) dds2->Release();
264 - if(dds3) dds3->Release();
265 - if(dds4) dds4->Release();
266 - if(dds7) dds7->Release();
267 -}
268 -
269 -
270 -ULONG MultiDirectDrawSurface::AddRef()
271 -{
272 - refcount++;
273 - return refcount;
274 -}
275 -
276 -ULONG MultiDirectDrawSurface::Release()
277 -{
278 - ULONG ret;
279 - refcount--;
280 - ret = refcount;
281 - if(!refcount) delete this;
282 - return ret;
283 -}
284 -
285 -HRESULT MultiDirectDrawSurface::AddAttachedSurface(MultiDirectDrawSurface *lpDDSAttachedSurface)
286 -{
287 - switch(version)
288 - {
289 - case 1:
290 - return dds1->AddAttachedSurface(lpDDSAttachedSurface->dds1);
291 - case 2:
292 - return dds2->AddAttachedSurface(lpDDSAttachedSurface->dds2);
293 - case 3:
294 - return dds3->AddAttachedSurface(lpDDSAttachedSurface->dds3);
295 - case 4:
296 - return dds4->AddAttachedSurface(lpDDSAttachedSurface->dds4);
297 - case 7:
298 - return dds7->AddAttachedSurface(lpDDSAttachedSurface->dds7);
299 - default:
300 - return DDERR_GENERIC;
301 - }
302 -}
303 -
304 -HRESULT MultiDirectDrawSurface::Lock(LPRECT lpDestRect, LPDDSURFACEDESC2 lpDDSurfaceDesc, DWORD dwFlags, HANDLE hEvent)
305 -{
306 - switch(version)
307 - {
308 - case 1:
309 - return dds1->Lock(lpDestRect,(LPDDSURFACEDESC)lpDDSurfaceDesc,dwFlags,hEvent);
310 - case 2:
311 - return dds2->Lock(lpDestRect,(LPDDSURFACEDESC)lpDDSurfaceDesc,dwFlags,hEvent);
312 - case 3:
313 - return dds3->Lock(lpDestRect,(LPDDSURFACEDESC)lpDDSurfaceDesc,dwFlags,hEvent);
314 - case 4:
315 - return dds4->Lock(lpDestRect,lpDDSurfaceDesc,dwFlags,hEvent);
316 - case 7:
317 - return dds7->Lock(lpDestRect,lpDDSurfaceDesc,dwFlags,hEvent);
318 - default:
319 - return DDERR_GENERIC;
320 - }
321 -}
322 -
323 -HRESULT MultiDirectDrawSurface::Unlock(LPRECT lpRect)
324 -{
325 - switch(version)
326 - {
327 - case 1:
328 - return dds1->Unlock(lpRect);
329 - case 2:
330 - return dds2->Unlock(lpRect);
331 - case 3:
332 - return dds3->Unlock(lpRect);
333 - case 4:
334 - return dds4->Unlock(lpRect);
335 - case 7:
336 - return dds7->Unlock(lpRect);
337 - default:
338 - return DDERR_GENERIC;
339 - }
340 -}
341 -
342 -HRESULT MultiDirectDrawSurface::GetPalette(LPDIRECTDRAWPALETTE FAR *lplpDDPalette)
343 -{
344 - switch(version)
345 - {
346 - case 1:
347 - return dds1->GetPalette(lplpDDPalette);
348 - case 2:
349 - return dds2->GetPalette(lplpDDPalette);
350 - case 3:
351 - return dds3->GetPalette(lplpDDPalette);
352 - case 4:
353 - return dds4->GetPalette(lplpDDPalette);
354 - case 7:
355 - return dds7->GetPalette(lplpDDPalette);
356 - default:
357 - return DDERR_GENERIC;
358 - }
359 -}
360 -HRESULT MultiDirectDrawSurface::SetPalette(LPDIRECTDRAWPALETTE lpDDPalette)
361 -{
362 - switch(version)
363 - {
364 - case 1:
365 - return dds1->SetPalette(lpDDPalette);
366 - case 2:
367 - return dds2->SetPalette(lpDDPalette);
368 - case 3:
369 - return dds3->SetPalette(lpDDPalette);
370 - case 4:
371 - return dds4->SetPalette(lpDDPalette);
372 - case 7:
373 - return dds7->SetPalette(lpDDPalette);
374 - default:
375 - return DDERR_GENERIC;
376 - }
377 -}
378 -
379 -HRESULT MultiDirectDrawSurface::GetClipper(LPDIRECTDRAWCLIPPER FAR *lplpDDClipper)
380 -{
381 - switch(version)
382 - {
383 - case 1:
384 - return dds1->GetClipper(lplpDDClipper);
385 - case 2:
386 - return dds2->GetClipper(lplpDDClipper);
387 - case 3:
388 - return dds3->GetClipper(lplpDDClipper);
389 - case 4:
390 - return dds4->GetClipper(lplpDDClipper);
391 - case 7:
392 - return dds7->GetClipper(lplpDDClipper);
393 - default:
394 - return DDERR_GENERIC;
395 - }
396 -}
397 -HRESULT MultiDirectDrawSurface::SetClipper(LPDIRECTDRAWCLIPPER lpDDClipper)
398 -{
399 - switch(version)
400 - {
401 - case 1:
402 - return dds1->SetClipper(lpDDClipper);
403 - case 2:
404 - return dds2->SetClipper(lpDDClipper);
405 - case 3:
406 - return dds3->SetClipper(lpDDClipper);
407 - case 4:
408 - return dds4->SetClipper(lpDDClipper);
409 - case 7:
410 - return dds7->SetClipper(lpDDClipper);
411 - default:
412 - return DDERR_GENERIC;
413 - }
414 -}
415 -HRESULT MultiDirectDrawSurface::GetSurfaceDesc(LPDDSURFACEDESC2 lpDDSurfaceDesc)
416 -{
417 - switch(version)
418 - {
419 - case 1:
420 - return dds1->GetSurfaceDesc((LPDDSURFACEDESC)lpDDSurfaceDesc);
421 - case 2:
422 - return dds2->GetSurfaceDesc((LPDDSURFACEDESC)lpDDSurfaceDesc);
423 - case 3:
424 - return dds3->GetSurfaceDesc((LPDDSURFACEDESC)lpDDSurfaceDesc);
425 - case 4:
426 - return dds4->GetSurfaceDesc(lpDDSurfaceDesc);
427 - case 7:
428 - return dds7->GetSurfaceDesc(lpDDSurfaceDesc);
429 - default:
430 - return DDERR_GENERIC;
431 - }
432 -}
433 -
434 -
435 -HRESULT MultiDirectDrawSurface::GetAttachedSurface(LPDDSCAPS2 lpDDSCaps, MultiDirectDrawSurface FAR **lplpDDAttachedSurface)
436 -{
437 - VOID *tmpsurface = NULL;
438 - HRESULT error;
439 - switch(version)
440 - {
441 - case 1:
442 - error = dds1->GetAttachedSurface((LPDDSCAPS)lpDDSCaps,(LPDIRECTDRAWSURFACE*)&tmpsurface);
443 - if(error != DD_OK) return error;
444 - break;
445 - case 2:
446 - error = dds2->GetAttachedSurface((LPDDSCAPS)lpDDSCaps,(LPDIRECTDRAWSURFACE2*)&tmpsurface);
447 - if(error != DD_OK) return error;
448 - break;
449 - case 3:
450 - error = dds3->GetAttachedSurface((LPDDSCAPS)lpDDSCaps,(LPDIRECTDRAWSURFACE3*)&tmpsurface);
451 - if(error != DD_OK) return error;
452 - break;
453 - case 4:
454 - error = dds4->GetAttachedSurface(lpDDSCaps,(LPDIRECTDRAWSURFACE4*)&tmpsurface);
455 - if(error != DD_OK) return error;
456 - break;
457 - case 7:
458 - error = dds7->GetAttachedSurface(lpDDSCaps,(LPDIRECTDRAWSURFACE7*)&tmpsurface);
459 - if(error != DD_OK) return error;
460 - break;
461 - default:
462 - return DDERR_GENERIC;
463 - }
464 - if(tmpsurface)
465 - {
466 - switch(version)
467 - {
468 - case 1:
469 - ddsm = new MultiDirectDrawSurface(1,tmpsurface);
470 - *lplpDDAttachedSurface = ddsm;
471 - return DD_OK;
472 - case 2:
473 - ddsm = new MultiDirectDrawSurface(2,tmpsurface);
474 - *lplpDDAttachedSurface = ddsm;
475 - return DD_OK;
476 - case 3:
477 - ddsm = new MultiDirectDrawSurface(3,tmpsurface);
478 - *lplpDDAttachedSurface = ddsm;
479 - return DD_OK;
480 - case 4:
481 - ddsm = new MultiDirectDrawSurface(4,tmpsurface);
482 - *lplpDDAttachedSurface = ddsm;
483 - return DD_OK;
484 - case 7:
485 - ddsm = new MultiDirectDrawSurface(7,tmpsurface);
486 - *lplpDDAttachedSurface = ddsm;
487 - return DD_OK;
488 - default:
489 - return DDERR_GENERIC;
490 - }
491 - }
492 - return DDERR_GENERIC;
493 -}
494 -
495 -HRESULT MultiDirectDrawSurface::Flip(MultiDirectDrawSurface *lpDDSurfaceTargetOverride,DWORD dwFlags)
496 -{
497 - if(lpDDSurfaceTargetOverride)
498 - {
499 - switch(version)
500 - {
501 - case 1:
502 - return dds1->Flip(lpDDSurfaceTargetOverride->dds1,dwFlags);
503 - case 2:
504 - return dds2->Flip(lpDDSurfaceTargetOverride->dds2,dwFlags);
505 - case 3:
506 - return dds3->Flip(lpDDSurfaceTargetOverride->dds3,dwFlags);
507 - case 4:
508 - return dds4->Flip(lpDDSurfaceTargetOverride->dds4,dwFlags);
509 - case 7:
510 - return dds7->Flip(lpDDSurfaceTargetOverride->dds7,dwFlags);
511 - default:
512 - return DDERR_GENERIC;
513 - }
514 - }
515 - else
516 - {
517 - switch(version)
518 - {
519 - case 1:
520 - return dds1->Flip(NULL,dwFlags);
521 - case 2:
522 - return dds2->Flip(NULL,dwFlags);
523 - case 3:
524 - return dds3->Flip(NULL,dwFlags);
525 - case 4:
526 - return dds4->Flip(NULL,dwFlags);
527 - case 7:
528 - return dds7->Flip(NULL,dwFlags);
529 - default:
530 - return DDERR_GENERIC;
531 - }
532 - }
533 - return DDERR_GENERIC;
534 -}
535 -
536 -HRESULT MultiDirectDrawSurface::Blt(LPRECT lpDestRect, MultiDirectDrawSurface *lpDDSrcSurface, LPRECT lpSrcRect, DWORD dwFlags, LPDDBLTFX lpDDBltFx)
537 -{
538 - if(lpDDSrcSurface)
539 - {
540 - switch(version)
541 - {
542 - case 1:
543 - return dds1->Blt(lpDestRect,lpDDSrcSurface->dds1,lpSrcRect,dwFlags,lpDDBltFx);
544 - case 2:
545 - return dds2->Blt(lpDestRect,lpDDSrcSurface->dds2,lpSrcRect,dwFlags,lpDDBltFx);
546 - case 3:
547 - return dds3->Blt(lpDestRect,lpDDSrcSurface->dds3,lpSrcRect,dwFlags,lpDDBltFx);
548 - case 4:
549 - return dds4->Blt(lpDestRect,lpDDSrcSurface->dds4,lpSrcRect,dwFlags,lpDDBltFx);
550 - case 7:
551 - return dds7->Blt(lpDestRect,lpDDSrcSurface->dds7,lpSrcRect,dwFlags,lpDDBltFx);
552 - }
553 - }
554 - else
555 - {
556 - switch(version)
557 - {
558 - case 1:
559 - return dds1->Blt(lpDestRect,NULL,lpSrcRect,dwFlags,lpDDBltFx);
560 - case 2:
561 - return dds2->Blt(lpDestRect,NULL,lpSrcRect,dwFlags,lpDDBltFx);
562 - case 3:
563 - return dds3->Blt(lpDestRect,NULL,lpSrcRect,dwFlags,lpDDBltFx);
564 - case 4:
565 - return dds4->Blt(lpDestRect,NULL,lpSrcRect,dwFlags,lpDDBltFx);
566 - case 7:
567 - return dds7->Blt(lpDestRect,NULL,lpSrcRect,dwFlags,lpDDBltFx);
568 - }
569 - }
570 - return DDERR_GENERIC;
571 -}
572 -
573 -HRESULT MultiDirectDrawSurface::BltFast(DWORD dwX, DWORD dwY, MultiDirectDrawSurface *lpDDSrcSurface, LPRECT lpSrcRect, DWORD dwTrans)
574 -{
575 - if(lpDDSrcSurface)
576 - {
577 - switch(version)
578 - {
579 - case 1:
580 - return dds1->BltFast(dwX,dwY,lpDDSrcSurface->dds1,lpSrcRect,dwTrans);
581 - case 2:
582 - return dds2->BltFast(dwX,dwY,lpDDSrcSurface->dds2,lpSrcRect,dwTrans);
583 - case 3:
584 - return dds3->BltFast(dwX,dwY,lpDDSrcSurface->dds3,lpSrcRect,dwTrans);
585 - case 4:
586 - return dds4->BltFast(dwX,dwY,lpDDSrcSurface->dds4,lpSrcRect,dwTrans);
587 - case 7:
588 - return dds7->BltFast(dwX,dwY,lpDDSrcSurface->dds7,lpSrcRect,dwTrans);
589 - }
590 - }
591 - else
592 - {
593 - switch(version)
594 - {
595 - case 1:
596 - return dds1->BltFast(dwX,dwY,NULL,lpSrcRect,dwTrans);
597 - case 2:
598 - return dds2->BltFast(dwX,dwY,NULL,lpSrcRect,dwTrans);
599 - case 3:
600 - return dds3->BltFast(dwX,dwY,NULL,lpSrcRect,dwTrans);
601 - case 4:
602 - return dds4->BltFast(dwX,dwY,NULL,lpSrcRect,dwTrans);
603 - case 7:
604 - return dds7->BltFast(dwX,dwY,NULL,lpSrcRect,dwTrans);
605 - }
606 - }
607 - return DDERR_GENERIC;
608 -}
609 -
610 -HRESULT MultiDirectDrawSurface::GetDC(HDC FAR *lphDC)
611 -{
612 - switch(version)
613 - {
614 - case 1:
615 - return dds1->GetDC(lphDC);
616 - case 2:
617 - return dds2->GetDC(lphDC);
618 - case 3:
619 - return dds3->GetDC(lphDC);
620 - case 4:
621 - return dds4->GetDC(lphDC);
622 - case 7:
623 - return dds7->GetDC(lphDC);
624 - default:
625 - return DDERR_GENERIC;
626 - }
627 -}
628 -
629 -HRESULT MultiDirectDrawSurface::ReleaseDC(HDC hDC)
630 -{
631 - switch(version)
632 - {
633 - case 1:
634 - return dds1->ReleaseDC(hDC);
635 - case 2:
636 - return dds2->ReleaseDC(hDC);
637 - case 3:
638 - return dds3->ReleaseDC(hDC);
639 - case 4:
640 - return dds4->ReleaseDC(hDC);
641 - case 7:
642 - return dds7->ReleaseDC(hDC);
643 - default:
644 - return DDERR_GENERIC;
645 - }
646 -}
647 -
648 -HRESULT MultiDirectDrawSurface::SetColorKey(DWORD dwFlags, LPDDCOLORKEY lpDDColorKey)
649 -{
650 - switch(version)
651 - {
652 - case 1:
653 - return dds1->SetColorKey(dwFlags,lpDDColorKey);
654 - case 2:
655 - return dds2->SetColorKey(dwFlags,lpDDColorKey);
656 - case 3:
657 - return dds3->SetColorKey(dwFlags,lpDDColorKey);
658 - case 4:
659 - return dds4->SetColorKey(dwFlags,lpDDColorKey);
660 - case 7:
661 - return dds7->SetColorKey(dwFlags,lpDDColorKey);
662 - default:
663 - return DDERR_GENERIC;
664 - }
665 -}
666 -
667 -LPVOID MultiDirectDrawSurface::GetSurface()
668 -{
669 - switch(version)
670 - {
671 - case 1:
672 - return dds1;
673 - case 2:
674 - return dds2;
675 - case 3:
676 - return dds3;
677 - case 4:
678 - return dds4;
679 - case 7:
680 - return dds7;
681 - default:
682 - return NULL;
683 - }
684 -}
685 -
686 -HRESULT MultiDirectDrawSurface::QueryInterface(REFIID riid, void** ppvObj)
687 -{
688 - switch(version)
689 - {
690 - case 1:
691 - return dds1->QueryInterface(riid,ppvObj);
692 - case 2:
693 - return dds2->QueryInterface(riid,ppvObj);
694 - case 3:
695 - return dds3->QueryInterface(riid,ppvObj);
696 - case 4:
697 - return dds4->QueryInterface(riid,ppvObj);
698 - case 7:
699 - return dds7->QueryInterface(riid,ppvObj);
700 - default:
701 - return DDERR_GENERIC;
702 - }
703 -}
Index: dxgltest/tests.cpp
@@ -1,3181 +0,0 @@
2 -// DXGL
3 -// Copyright (C) 2011 William Feely
4 -
5 -// This library is free software; you can redistribute it and/or
6 -// modify it under the terms of the GNU Lesser General Public
7 -// License as published by the Free Software Foundation; either
8 -// version 2.1 of the License, or (at your option) any later version.
9 -
10 -// This library is distributed in the hope that it will be useful,
11 -// but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 -// Lesser General Public License for more details.
14 -
15 -// You should have received a copy of the GNU Lesser General Public
16 -// License along with this library; if not, write to the Free Software
17 -// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 -
19 -#include "common.h"
20 -#include "MultiDD.h"
21 -#include "tests.h"
22 -#include "surfacegen.h"
23 -#include "timer.h"
24 -#include "misc.h"
25 -#define D3D_OVERLOADS
26 -#include "../ddraw/include/d3d.h"
27 -
28 -void InitTest(int test);
29 -void RunTestTimed(int test);
30 -void RunTestLooped(int test);
31 -void RunTestMouse(int test, UINT Msg, WPARAM wParam, LPARAM lParam);
32 -
33 -
34 -static MultiDirectDraw *ddinterface;
35 -static MultiDirectDrawSurface *ddsurface;
36 -static MultiDirectDrawSurface *ddsrender;
37 -static MultiDirectDrawSurface *zbuffer;
38 -static MultiDirectDrawSurface *textures[8];
39 -static IDirectDrawPalette *pal;
40 -static IDirect3D7 *d3d7;
41 -static IDirect3DDevice7 *d3d7dev;
42 -D3DMATERIAL7 material;
43 -static LPDIRECTDRAWCLIPPER ddclipper;
44 -static int width,height,bpp,refresh,backbuffers;
45 -static double fps;
46 -static bool fullscreen,resizable;
47 -static HWND hWnd;
48 -static int testnum;
49 -static unsigned int randnum;
50 -static int testtypes[] = {0,1,0,1,0,1,2,0,2,1,0,0,0,0,0,0};
51 -static DWORD counter;
52 -
53 -#define FVF_COLORVERTEX (D3DFVF_VERTEX | D3DFVF_DIFFUSE | D3DFVF_SPECULAR)
54 -struct COLORVERTEX
55 -{
56 - D3DVALUE x;
57 - D3DVALUE y;
58 - D3DVALUE z;
59 - D3DVALUE nx;
60 - D3DVALUE ny;
61 - D3DVALUE nz;
62 - D3DCOLOR color;
63 - D3DCOLOR specular;
64 - D3DVALUE tu;
65 - D3DVALUE tv;
66 -public:
67 - COLORVERTEX() {};
68 - COLORVERTEX(const D3DVECTOR& v, const D3DVECTOR& n, D3DCOLOR _color,
69 - D3DCOLOR _specular, D3DVALUE _tu, D3DVALUE _tv)
70 - {
71 - x = v.x; y = v.y; z = v.z;
72 - nx = n.x; ny = n.y; nz = n.z;
73 - color = _color; specular = _specular;
74 - tu = _tu; tv = _tv;
75 - }
76 -
77 -};
78 -
79 -static int numpoints = 0;
80 -static int numindices = 0;
81 -static D3DVERTEX *vertices = NULL;
82 -static D3DLVERTEX *litvertices = NULL;
83 -static COLORVERTEX *colorvertices = NULL;
84 -static WORD *mesh = NULL;
85 -static D3DLIGHT7 lights[8];
86 -static BOOL lightenable[8];
87 -static DWORD bgcolor = 0;
88 -
89 -typedef struct
90 -{
91 - DWORD ambient;
92 - DWORD diffuse;
93 - DWORD specular;
94 -} HEXLIGHTCOLOR;
95 -HEXLIGHTCOLOR hexlightcolor[8];
96 -
97 -typedef struct
98 -{
99 - D3DTEXTUREOP colorop;
100 - DWORD colorarg1;
101 - DWORD colorarg2;
102 - D3DTEXTUREOP alphaop;
103 - DWORD alphaarg1;
104 - DWORD alphaarg2;
105 - DWORD texturetype;
106 - TCHAR texturefile[MAX_PATH + 1];
107 - MultiDirectDrawSurface* texture;
108 - BOOL colorkey;
109 - DWORD keycolor;
110 -} TEXSTAGE;
111 -
112 -typedef struct
113 -{
114 - int currentstage;
115 - TEXSTAGE texstages[8];
116 - DWORD diffuse;
117 - DWORD specular;
118 - DWORD factor;
119 - D3DFOGMODE vertexfog;
120 - D3DFOGMODE pixelfog;
121 - FLOAT fogstart;
122 - FLOAT fogend;
123 - FLOAT fogdensity;
124 - BOOL rangefog;
125 - DWORD fogcolor;
126 - BOOL alphatest;
127 - BOOL alphastipple;
128 - BOOL colorkey;
129 - BOOL colorkeyblend;
130 - D3DBLEND srcblend;
131 - D3DBLEND destblend;
132 - BYTE refalpha;
133 - D3DCMPFUNC alphafunc;
134 - D3DLINEPATTERN linepattern;
135 - DWORD fillstippletype;
136 - TCHAR fillstipplefile[MAX_PATH + 1];
137 - DWORD fillstipple[32];
138 -} TEXSHADERSTATE;
139 -
140 -static TEXSHADERSTATE texshaderstate;
141 -const TEXSHADERSTATE defaulttexshaderstate =
142 -{
143 - 0,
144 - {
145 - { D3DTOP_MODULATE,D3DTA_TEXTURE,D3DTA_CURRENT,D3DTOP_SELECTARG1,D3DTA_TEXTURE,D3DTA_CURRENT,0,_T(""),NULL,FALSE,0 },
146 - { D3DTOP_DISABLE,D3DTA_TEXTURE,D3DTA_CURRENT,D3DTOP_DISABLE,D3DTA_TEXTURE,D3DTA_CURRENT,0,_T(""),NULL,FALSE,0 },
147 - { D3DTOP_DISABLE,D3DTA_TEXTURE,D3DTA_CURRENT,D3DTOP_DISABLE,D3DTA_TEXTURE,D3DTA_CURRENT,0,_T(""),NULL,FALSE,0 },
148 - { D3DTOP_DISABLE,D3DTA_TEXTURE,D3DTA_CURRENT,D3DTOP_DISABLE,D3DTA_TEXTURE,D3DTA_CURRENT,0,_T(""),NULL,FALSE,0 },
149 - { D3DTOP_DISABLE,D3DTA_TEXTURE,D3DTA_CURRENT,D3DTOP_DISABLE,D3DTA_TEXTURE,D3DTA_CURRENT,0,_T(""),NULL,FALSE,0 },
150 - { D3DTOP_DISABLE,D3DTA_TEXTURE,D3DTA_CURRENT,D3DTOP_DISABLE,D3DTA_TEXTURE,D3DTA_CURRENT,0,_T(""),NULL,FALSE,0 },
151 - { D3DTOP_DISABLE,D3DTA_TEXTURE,D3DTA_CURRENT,D3DTOP_DISABLE,D3DTA_TEXTURE,D3DTA_CURRENT,0,_T(""),NULL,FALSE,0 },
152 - { D3DTOP_DISABLE,D3DTA_TEXTURE,D3DTA_CURRENT,D3DTOP_DISABLE,D3DTA_TEXTURE,D3DTA_CURRENT,0,_T(""),NULL,FALSE,0 },
153 - },
154 - 0xFFFFFFFF,
155 - 0,
156 - 0xFFFFFFFF,
157 - D3DFOG_NONE,
158 - D3DFOG_NONE,
159 - 0.0,
160 - 1.0,
161 - 1.0,
162 - FALSE,
163 - 0,
164 - FALSE,
165 - FALSE,
166 - FALSE,
167 - FALSE,
168 - D3DBLEND_ONE,
169 - D3DBLEND_ZERO,
170 - 0,
171 - D3DCMP_ALWAYS,
172 - { 0,0 }
173 -};
174 -
175 -typedef struct
176 -{
177 - DWORD texturetype;
178 - TCHAR texturefile[MAX_PATH + 1];
179 - MultiDirectDrawSurface* texture;
180 - int currentlight;
181 -} VERTEXSHADERSTATE;
182 -static VERTEXSHADERSTATE vertexshaderstate;
183 -
184 -static DDSPRITE sprites[16];
185 -
186 -LRESULT CALLBACK DDWndProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
187 -{
188 - bool paintwnd = true;
189 - POINT p;
190 - RECT srcrect,destrect;
191 - HRESULT error;
192 - PAINTSTRUCT paintstruct;
193 - switch(Msg)
194 - {
195 - case WM_CLOSE:
196 - DestroyWindow(hWnd);
197 - break;
198 - case WM_DESTROY:
199 - StopTimer();
200 - for(int i = 0; i < 16; i++)
201 - if(sprites[i].surface) sprites[i].surface->Release();
202 - for (int i = 0; i < 8; i++)
203 - {
204 - if (textures[i])
205 - {
206 - textures[i]->Release();
207 - textures[i] = NULL;
208 - }
209 - }
210 - if (d3d7dev)
211 - {
212 - d3d7dev->Release();
213 - d3d7dev = NULL;
214 - }
215 - if (d3d7)
216 - {
217 - d3d7->Release();
218 - d3d7dev = NULL;
219 - }
220 - if(ddsrender)
221 - {
222 - ddsrender->Release();
223 - ddsrender = NULL;
224 - }
225 - if(ddsurface)
226 - {
227 - ddsurface->Release();
228 - ddsurface = NULL;
229 - }
230 - if (zbuffer)
231 - {
232 - zbuffer->Release();
233 - zbuffer = NULL;
234 - }
235 - if(pal)
236 - {
237 - pal->Release();
238 - pal = NULL;
239 - }
240 - if(ddclipper)
241 - {
242 - ddclipper->Release();
243 - ddclipper = NULL;
244 - }
245 - if(ddinterface)
246 - {
247 - ddinterface->Release();
248 - ddinterface = NULL;
249 - }
250 - if (mesh)
251 - {
252 - free(mesh);
253 - mesh = NULL;
254 - }
255 - if (vertices)
256 - {
257 - free(vertices);
258 - vertices = NULL;
259 - }
260 - if (litvertices)
261 - {
262 - free(litvertices);
263 - litvertices = NULL;
264 - }
265 - if (colorvertices)
266 - {
267 - free(colorvertices);
268 - colorvertices = NULL;
269 - }
270 - PostQuitMessage(0);
271 - break;
272 - case WM_KEYDOWN:
273 - if(wParam == VK_ESCAPE) DestroyWindow(hWnd);
274 - break;
275 - case WM_APP:
276 - RunTestTimed(testnum);
277 - break;
278 - case WM_SIZE:
279 - paintwnd = false;
280 - case WM_PAINT:
281 - if(paintwnd) BeginPaint(hWnd,&paintstruct);
282 - if(!fullscreen)
283 - {
284 - p.x = 0;
285 - p.y = 0;
286 - ClientToScreen(hWnd,&p);
287 - GetClientRect(hWnd,&destrect);
288 - OffsetRect(&destrect,p.x,p.y);
289 - SetRect(&srcrect,0,0,width,height);
290 - if(ddsurface && ddsrender)error = ddsurface->Blt(&destrect,ddsrender,&srcrect,DDBLT_WAIT,NULL);
291 - }
292 - if(paintwnd) EndPaint(hWnd,&paintstruct);
293 - return 0;
294 - case WM_MOUSEMOVE:
295 - case WM_LBUTTONDOWN:
296 - case WM_LBUTTONUP:
297 - case WM_LBUTTONDBLCLK:
298 - case WM_RBUTTONDOWN:
299 - case WM_RBUTTONUP:
300 - case WM_RBUTTONDBLCLK:
301 - case WM_MBUTTONDOWN:
302 - case WM_MBUTTONUP:
303 - case WM_MBUTTONDBLCLK:
304 - case WM_MOUSEWHEEL:
305 - case WM_XBUTTONDOWN:
306 - case WM_XBUTTONUP:
307 - case WM_XBUTTONDBLCLK:
308 - case WM_MOUSEHWHEEL:
309 - RunTestMouse(testnum,Msg,wParam,lParam);
310 - if(!fullscreen)
311 - {
312 - if ((testnum != 4) && (testnum != 10) && (testnum != 11))
313 - {
314 - p.x = 0;
315 - p.y = 0;
316 - ClientToScreen(hWnd, &p);
317 - GetClientRect(hWnd, &destrect);
318 - OffsetRect(&destrect, p.x, p.y);
319 - SetRect(&srcrect, 0, 0, width, height);
320 - if (ddsurface && ddsrender)error = ddsurface->Blt(&destrect, ddsrender, &srcrect, DDBLT_WAIT, NULL);
321 - }
322 - }
323 - break;
324 - default:
325 - return DefWindowProc(hWnd,Msg,wParam,lParam);
326 - }
327 - return FALSE;
328 -}
329 -
330 -static int ddtestnum;
331 -static int d3dver;
332 -static int ddver;
333 -
334 -void RunTestMouse(int test, UINT Msg, WPARAM wParam, LPARAM lParam)
335 -{
336 - if(!ddsrender) return;
337 - DDSURFACEDESC2 ddsd;
338 - ddsd.dwSize = sizeof(DDSURFACEDESC2);
339 - DDBLTFX bltfx;
340 - unsigned char *surface;
341 - int bytes;
342 - unsigned int x,y;
343 - bool out = false;
344 - bool msgbottom = false;
345 - TCHAR message[256];
346 - message[0] = 0;
347 - HDC hDC;
348 - switch(test)
349 - {
350 - case 6:
351 - x = LOWORD(lParam);
352 - y = HIWORD(lParam);
353 - ZeroMemory(&bltfx,sizeof(DDBLTFX));
354 - bltfx.dwSize = sizeof(DDBLTFX);
355 - bltfx.dwFillColor = 0;
356 - ddsrender->Blt(NULL,NULL,NULL,DDBLT_COLORFILL,&bltfx);
357 - if(ddver > 3)ddsd.dwSize = sizeof(DDSURFACEDESC2);
358 - else ddsd.dwSize = sizeof(DDSURFACEDESC);
359 - ddsrender->GetSurfaceDesc(&ddsd);
360 - switch(ddsd.ddpfPixelFormat.dwRGBBitCount)
361 - {
362 - case 8:
363 - bytes=1;
364 - break;
365 - case 15:
366 - case 16:
367 - bytes=2;
368 - break;
369 - case 24:
370 - bytes=3;
371 - break;
372 - case 32:
373 - default:
374 - bytes=4;
375 - }
376 - _tcscpy(message,_T("Message: "));
377 - switch(Msg)
378 - {
379 - case WM_MOUSEMOVE:
380 - _tcscat(message,_T("WM_MOUSEMOVE "));
381 - break;
382 - case WM_LBUTTONDOWN:
383 - _tcscat(message,_T("WM_LBUTTONDOWN "));
384 - break;
385 - case WM_LBUTTONUP:
386 - _tcscat(message,_T("WM_LBUTTONUP "));
387 - break;
388 - case WM_LBUTTONDBLCLK:
389 - _tcscat(message,_T("WM_LBUTTONDBLCLK "));
390 - break;
391 - case WM_RBUTTONDOWN:
392 - _tcscat(message,_T("WM_RBUTTONDOWN "));
393 - break;
394 - case WM_RBUTTONUP:
395 - _tcscat(message,_T("WM_RBUTTONUP "));
396 - break;
397 - case WM_RBUTTONDBLCLK:
398 - _tcscat(message,_T("WM_RBUTTONDBLCLK "));
399 - break;
400 - case WM_MBUTTONDOWN:
401 - _tcscat(message,_T("WM_MBUTTONDOWN "));
402 - break;
403 - case WM_MBUTTONUP:
404 - _tcscat(message,_T("WM_MBUTTONUP "));
405 - break;
406 - case WM_MBUTTONDBLCLK:
407 - _tcscat(message,_T("WM_MBUTTONDBLCLK "));
408 - break;
409 - case WM_MOUSEWHEEL:
410 - _tcscat(message,_T("WM_MOUSEWHEEL "));
411 - break;
412 - case WM_XBUTTONDOWN:
413 - _tcscat(message,_T("WM_XBUTTONDOWN "));
414 - break;
415 - case WM_XBUTTONUP:
416 - _tcscat(message,_T("WM_XBUTTONUP "));
417 - break;
418 - case WM_XBUTTONDBLCLK:
419 - _tcscat(message,_T("WM_XBUTTONDBLCLK "));
420 - break;
421 - case WM_MOUSEHWHEEL:
422 - _tcscat(message,_T("WM_MOUSEHWHEEL "));
423 - break;
424 - default:
425 - _tcscat(message,_T("unknown "));
426 - }
427 - _tcscat(message,_T("Keys: "));
428 - if(wParam & MK_CONTROL) _tcscat(message, _T("CTRL "));
429 - if(wParam & MK_SHIFT) _tcscat(message,_T("SHIFT "));
430 - _tcscat(message,_T("Buttons: "));
431 - if(wParam & MK_LBUTTON) _tcscat(message,_T("L "));
432 - if(wParam & MK_MBUTTON) _tcscat(message,_T("M "));
433 - if(wParam & MK_RBUTTON) _tcscat(message,_T("R "));
434 - if(wParam & MK_XBUTTON1) _tcscat(message,_T("X1 "));
435 - if(wParam & MK_XBUTTON2) _tcscat(message,_T("X2 "));
436 - // Add X and Y
437 - ddsrender->Lock(NULL,&ddsd,DDLOCK_WAIT,NULL);
438 - surface = (unsigned char *)ddsd.lpSurface;
439 - if((x > ddsd.dwWidth) || (y > ddsd.dwHeight))
440 - {
441 - out = true;
442 - _tcscat(message,_T(" OUT OF BOUNDS"));
443 - }
444 - else surface[(x*bytes)+(y*ddsd.lPitch)] = 0xFF;
445 - ddsrender->Unlock(NULL);
446 - ddsrender->GetDC(&hDC);
447 - if(out)SetBkColor(hDC,RGB(255,0,0));
448 - else SetBkColor(hDC,RGB(0,0,255));
449 - SetTextColor(hDC,RGB(255,255,255));
450 - if(y > ddsd.dwHeight / 2) TextOut(hDC,0,0,message,_tcslen(message));
451 - else TextOut(hDC,0,ddsd.dwHeight-16,message,_tcslen(message));
452 - ddsrender->ReleaseDC(hDC);
453 - break;
454 - default:
455 - break;
456 - }
457 -}
458 -
459 -const TCHAR wndclassname[] = _T("DDTestWndClass");
460 -
461 -static HRESULT WINAPI zcallback(DDPIXELFORMAT *ddpf, VOID *context)
462 -{
463 - if (ddpf->dwFlags == DDPF_ZBUFFER)
464 - {
465 - memcpy(context, ddpf, sizeof(DDPIXELFORMAT));
466 - return D3DENUMRET_CANCEL;
467 - }
468 - return D3DENUMRET_OK;
469 -}
470 -
471 -INT_PTR CALLBACK TexShader7Proc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam);
472 -INT_PTR CALLBACK VertexShader7Proc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam);
473 -
474 -void RunDXGLTest(int testnum, int width, int height, int bpp, int refresh, int backbuffers, int apiver,
475 - int filter, int msaa, double fps, bool fullscreen, bool resizable, BOOL is3d)
476 -{
477 - ZeroMemory(sprites,16*sizeof(DDSPRITE));
478 - if(testnum == 14)
479 - {
480 - DialogBox(GetModuleHandle(NULL),MAKEINTRESOURCE(IDD_TEXSHADER),NULL,TexShader7Proc);
481 - return;
482 - }
483 - if(testnum == 15)
484 - {
485 - DialogBox(GetModuleHandle(NULL),MAKEINTRESOURCE(IDD_VERTEXSHADER),NULL,VertexShader7Proc);
486 - return;
487 - }
488 - DDSCAPS2 caps;
489 - DDSURFACEDESC2 ddsd;
490 - DDPIXELFORMAT ddpfz;
491 - BOOL done = false;
492 - ::testnum = testnum;
493 - randnum = (unsigned int)time(NULL);
494 - ZeroMemory(&ddsd,sizeof(DDSURFACEDESC2));
495 - ZeroMemory(textures,8*sizeof(MultiDirectDrawSurface*));
496 - if(apiver > 3) ddsd.dwSize = sizeof(DDSURFACEDESC2);
497 - else ddsd.dwSize = sizeof(DDSURFACEDESC);
498 - ::fullscreen = fullscreen;
499 - ::resizable = resizable;
500 - ::width = width;
501 - ::height = height;
502 - ::bpp = bpp;
503 - ::refresh = refresh;
504 - if(fullscreen)::backbuffers = backbuffers;
505 - else ::backbuffers = backbuffers = 0;
506 - ::fps = fps;
507 - ::testnum = testnum;
508 - d3dver = apiver;
509 - if(apiver == 3) ddver = 4;
510 - else ddver = apiver;
511 - HINSTANCE hinstance = (HINSTANCE)GetModuleHandle(NULL);
512 - WNDCLASSEX wc;
513 - MSG Msg;
514 - ZeroMemory(&wc,sizeof(WNDCLASS));
515 - wc.cbSize = sizeof(WNDCLASSEX);
516 - wc.style = CS_HREDRAW | CS_VREDRAW;
517 - wc.lpfnWndProc = DDWndProc;
518 - wc.hInstance = hinstance;
519 - wc.hIcon = LoadIcon(hinstance,MAKEINTRESOURCE(IDI_DXGL));
520 - wc.hIconSm = LoadIcon(hinstance,MAKEINTRESOURCE(IDI_DXGLSM));
521 - if(testnum == 6) wc.hCursor = LoadCursor(NULL,IDC_CROSS);
522 - else wc.hCursor = LoadCursor(NULL,IDC_ARROW);
523 - wc.hbrBackground = NULL;
524 - wc.lpszClassName = wndclassname;
525 - if(!RegisterClassEx(&wc))
526 - {
527 - MessageBox(NULL,_T("Can not register window class"),_T("Error"),MB_ICONEXCLAMATION|MB_OK);
528 - return;
529 - }
530 - if(resizable)
531 - hWnd = CreateWindowEx(WS_EX_APPWINDOW,wndclassname,_T("DDraw Test Window"),WS_OVERLAPPEDWINDOW,
532 - CW_USEDEFAULT,CW_USEDEFAULT,width,height,NULL,NULL,hinstance,NULL);
533 - else if(!fullscreen)
534 - hWnd = CreateWindowEx(WS_EX_APPWINDOW,wndclassname,_T("DDraw Test Window"),WS_OVERLAPPED|WS_CAPTION|WS_SYSMENU|WS_MINIMIZEBOX,
535 - CW_USEDEFAULT,CW_USEDEFAULT,width,height,NULL,NULL,hinstance,NULL);
536 - else hWnd = CreateWindowEx(0,wndclassname,_T("DDraw Test Window"),WS_POPUP,0,0,
537 - GetSystemMetrics(SM_CXSCREEN),GetSystemMetrics(SM_CYSCREEN),NULL,NULL,hinstance,NULL);
538 - DWORD err = GetLastError();
539 - ShowWindow(hWnd,SW_SHOWNORMAL);
540 - UpdateWindow(hWnd);
541 - RECT r1,r2;
542 - POINT p1;
543 - HRESULT error;
544 - ddinterface = new MultiDirectDraw(ddver,&error,NULL);
545 - if(fullscreen) error = ddinterface->SetCooperativeLevel(hWnd,DDSCL_EXCLUSIVE|DDSCL_FULLSCREEN);
546 - else error = ddinterface->SetCooperativeLevel(hWnd,DDSCL_NORMAL);
547 - if(fullscreen) error = ddinterface->SetDisplayMode(width,height,bpp,refresh,0);
548 - else
549 - {
550 - GetClientRect(hWnd,&r1);
551 - GetWindowRect(hWnd,&r2);
552 - p1.x = (r2.right - r2.left) - r1.right;
553 - p1.y = (r2.bottom - r2.top) - r1.bottom;
554 - MoveWindow(hWnd,r2.left,r2.top,width+p1.x,height+p1.y,TRUE);
555 - }
556 - ddsd.dwFlags = DDSD_CAPS;
557 - ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE;
558 - if(fullscreen)
559 - {
560 - if(backbuffers)ddsd.dwFlags |= DDSD_BACKBUFFERCOUNT;
561 - ddsd.dwBackBufferCount = backbuffers;
562 - if(backbuffers) ddsd.ddsCaps.dwCaps |= DDSCAPS_FLIP | DDSCAPS_COMPLEX;
563 - if(is3d) ddsd.ddsCaps.dwCaps |= DDSCAPS_3DDEVICE;
564 - }
565 - error = ddinterface->CreateSurface(&ddsd,&ddsurface,NULL);
566 - if(!fullscreen)
567 - {
568 - error = ddinterface->CreateClipper(0,&ddclipper,NULL);
569 - error = ddclipper->SetHWnd(0,hWnd);
570 - error = ddsurface->SetClipper(ddclipper);
571 - ZeroMemory(&ddsd,sizeof(ddsd));
572 - if(apiver > 3) ddsd.dwSize = sizeof(DDSURFACEDESC2);
573 - else ddsd.dwSize = sizeof(DDSURFACEDESC);
574 - ddsd.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH;
575 - if(is3d) ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE;
576 - else ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN;
577 - ddsd.dwWidth = width;
578 - ddsd.dwHeight = height;
579 - error = ddinterface->CreateSurface(&ddsd,&ddsrender,NULL);
580 - ddsrender->GetSurfaceDesc(&ddsd);
581 - ::bpp = ddsd.ddpfPixelFormat.dwRGBBitCount;
582 - }
583 - else
584 - {
585 - ddsrender = ddsurface;
586 - ddsrender->AddRef();
587 - }
588 - if(bpp == 8)
589 - {
590 - ddinterface->CreatePalette(DDPCAPS_8BIT|DDPCAPS_ALLOW256,(LPPALETTEENTRY)&DefaultPalette,&pal,NULL);
591 - ddsrender->SetPalette(pal);
592 - }
593 - else pal = NULL;
594 - if (is3d)
595 - {
596 - error = ddinterface->QueryInterface(IID_IDirect3D7, (VOID**)&d3d7);
597 - error = d3d7->EnumZBufferFormats(IID_IDirect3DRGBDevice, zcallback, &ddpfz);
598 - error = ddsrender->GetSurfaceDesc(&ddsd);
599 - ddsd.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT | DDSD_PIXELFORMAT;
600 - ddsd.ddsCaps.dwCaps = DDSCAPS_ZBUFFER | DDSCAPS_VIDEOMEMORY;
601 - memcpy(&ddsd.ddpfPixelFormat, &ddpfz, sizeof(DDPIXELFORMAT));
602 - error = ddinterface->CreateSurface(&ddsd, &zbuffer, NULL);
603 - error = ddsrender->AddAttachedSurface(zbuffer);
604 - error = d3d7->CreateDevice(IID_IDirect3DHALDevice, (LPDIRECTDRAWSURFACE7)ddsrender->GetSurface(), &d3d7dev);
605 - if (error != D3D_OK)
606 - error = d3d7->CreateDevice(IID_IDirect3DRGBDevice, (LPDIRECTDRAWSURFACE7)ddsrender->GetSurface(), &d3d7dev);
607 - ddsrender->GetSurfaceDesc(&ddsd);
608 - D3DVIEWPORT7 vp = { 0,0,ddsd.dwWidth,ddsd.dwHeight,0.0f,1.0f };
609 - error = d3d7dev->SetViewport(&vp);
610 - error = d3d7dev->SetRenderState(D3DRENDERSTATE_ZENABLE, TRUE);
611 - }
612 - InitTest(testnum);
613 - if(!fullscreen) SendMessage(hWnd,WM_PAINT,0,0);
614 - if(testtypes[testnum] == 1)
615 - {
616 - while(!done)
617 - {
618 - if(PeekMessage(&Msg,NULL,0,0,PM_REMOVE))
619 - {
620 - if(Msg.message == WM_PAINT) RunTestLooped(testnum);
621 - else if(Msg.message == WM_QUIT) done = TRUE;
622 - else
623 - {
624 - TranslateMessage(&Msg);
625 - DispatchMessage(&Msg);
626 - }
627 - }
628 - else
629 - {
630 - RunTestLooped(testnum);
631 - }
632 - }
633 - }
634 - else if(testtypes[testnum] == 0)
635 - {
636 - StartTimer(hWnd,WM_APP,fps);
637 - while(GetMessage(&Msg, NULL, 0, 0) > 0)
638 - {
639 - TranslateMessage(&Msg);
640 - DispatchMessage(&Msg);
641 - }
642 - }
643 - else
644 - {
645 - while(GetMessage(&Msg, NULL, 0, 0) > 0)
646 - {
647 - TranslateMessage(&Msg);
648 - DispatchMessage(&Msg);
649 - }
650 - }
651 - UnregisterClass(wndclassname,hinstance);
652 - StopTimer();
653 -}
654 -
655 -void MakeCube3D(float size, int detail)
656 -{
657 - if (detail < 2) return;
658 - D3DVECTOR normals[6];
659 - normals[0] = D3DVECTOR(0.0f, 0.0f, -1.0f);
660 - normals[1] = D3DVECTOR(1.0f, 0.0f, 0.0f);
661 - normals[2] = D3DVECTOR(0.0f, 0.0f, 1.0f);
662 - normals[3] = D3DVECTOR(-1.0f, 0.0f, 0.0f);
663 - normals[4] = D3DVECTOR(0.0f, 1.0f, 0.0f);
664 - normals[5] = D3DVECTOR(0.0f, -1.0f, 0.0f);
665 - int numfacevertices = detail*detail;
666 - D3DVECTOR *face = (D3DVECTOR*)malloc(numfacevertices * sizeof(D3DVECTOR));
667 - int numfaceindices = ((detail - 1)*(detail - 1)) * 6;
668 - WORD *faceindex = (WORD*)malloc(numfaceindices * sizeof(WORD));
669 - int ptr = 0;
670 - float fx, fy;
671 - // Generate points
672 - for (int y = 0; y < detail; y++)
673 - {
674 - fy = (((float)(y / (float)(detail - 1))) - .5f)*size;
675 - for (int x = 0; x < detail; x++)
676 - {
677 - fx = (((float)(x / (float)(detail - 1))) - .5f)*size;
678 - face[ptr] = D3DVECTOR(fx, fy, 0);
679 - ptr++;
680 - }
681 - }
682 - // Generate triangle indices
683 - ptr = 0;
684 - for (int y = 0; y < (detail - 1); y++)
685 - {
686 - for (int x = 0; x < (detail - 1); x++)
687 - {
688 - faceindex[ptr++] = x + (detail*y);
689 - faceindex[ptr++] = x + (detail*(y + 1));
690 - faceindex[ptr++] = (x + 1) + (detail*y);
691 - faceindex[ptr++] = (x + 1) + (detail*y);
692 - faceindex[ptr++] = x + (detail*(y + 1));
693 - faceindex[ptr++] = (x + 1) + (detail*(y + 1));
694 - }
695 - }
696 - numpoints = (detail*detail) * 6;
697 - numindices = ((detail - 1)*(detail - 1)) * 36;
698 - if (vertices) free(vertices);
699 - if (litvertices) free(litvertices);
700 - if (colorvertices) free(colorvertices);
701 - if (mesh) free(mesh);
702 - vertices = (D3DVERTEX*)malloc(numpoints * sizeof(D3DVERTEX));
703 - litvertices = (D3DLVERTEX*)malloc(numpoints * sizeof(D3DLVERTEX));
704 - colorvertices = (COLORVERTEX*)malloc(numpoints * sizeof(COLORVERTEX));
705 - mesh = (WORD*)malloc(numindices * sizeof(WORD));
706 - // Generate vertex list
707 - float u, v;
708 - D3DVECTOR pos;
709 - D3DVECTOR normal;
710 - // Front face
711 - ptr = 0;
712 - for (int y = 0; y < detail; y++)
713 - {
714 - for (int x = 0; x < detail; x++)
715 - {
716 - u = (float)x / (float)(detail - 1);
717 - v = 1.f - ((float)y / (float)(detail - 1));
718 - ptr = x + (detail*y);
719 - pos = D3DVECTOR(face[ptr].x, face[ptr].y, -size / 2.f);
720 - normal = D3DVECTOR(0, 0, -1);
721 - vertices[ptr] = D3DVERTEX(pos, normal, u, v);
722 - litvertices[ptr] = D3DLVERTEX(pos, 0xFFFFFFFF, 0, u, v);
723 - colorvertices[ptr] = COLORVERTEX(pos, normal, 0xFFFFFFFF, 0, u, v);
724 - }
725 - }
726 - // Right face
727 - ptr = 0;
728 - for (int y = 0; y < detail; y++)
729 - {
730 - for (int x = 0; x < detail; x++)
731 - {
732 - u = (float)x / (float)(detail - 1);
733 - v = 1.f - ((float)y / (float)(detail - 1));
734 - ptr = x + (detail*y);
735 - pos = D3DVECTOR(size / 2.f, face[ptr].y, face[ptr].x);
736 - normal = D3DVECTOR(1, 0, 0);
737 - vertices[ptr + numfacevertices] = D3DVERTEX(pos, normal, u, v);
738 - litvertices[ptr + numfacevertices] = D3DLVERTEX(pos, 0xFFFFFFFF, 0, u, v);
739 - colorvertices[ptr + numfacevertices] = COLORVERTEX(pos, normal, 0xFFFFFFFF, 0, u, v);
740 - }
741 - }
742 - // Back face
743 - ptr = 0;
744 - for (int y = 0; y < detail; y++)
745 - {
746 - for (int x = 0; x < detail; x++)
747 - {
748 - u = (float)x / (float)(detail - 1);
749 - v = 1.f - ((float)y / (float)(detail - 1));
750 - ptr = x + (detail*y);
751 - pos = D3DVECTOR(-face[ptr].x, face[ptr].y, size / 2.f);
752 - normal = D3DVECTOR(0, 0, 1);
753 - vertices[ptr + (numfacevertices * 2)] = D3DVERTEX(pos, normal, u, v);
754 - litvertices[ptr + (numfacevertices * 2)] = D3DLVERTEX(pos, 0xFFFFFFFF, 0, u, v);
755 - colorvertices[ptr + (numfacevertices * 2)] = COLORVERTEX(pos, normal, 0xFFFFFFFF, 0, u, v);
756 - }
757 - }
758 - // Left face
759 - ptr = 0;
760 - for (int y = 0; y < detail; y++)
761 - {
762 - for (int x = 0; x < detail; x++)
763 - {
764 - u = (float)x / (float)(detail - 1);
765 - v = 1.f - ((float)y / (float)(detail - 1));
766 - ptr = x + (detail*y);
767 - pos = D3DVECTOR(-size / 2.f, face[ptr].y, -face[ptr].x);
768 - normal = D3DVECTOR(-1, 0, 0);
769 - vertices[ptr + (numfacevertices * 3)] = D3DVERTEX(pos, normal, u, v);
770 - litvertices[ptr + (numfacevertices * 3)] = D3DLVERTEX(pos, 0xFFFFFFFF, 0, u, v);
771 - colorvertices[ptr + (numfacevertices * 3)] = COLORVERTEX(pos, normal, 0xFFFFFFFF, 0, u, v);
772 - }
773 - }
774 - // Top face
775 - for (int y = 0; y < detail; y++)
776 - {
777 - for (int x = 0; x < detail; x++)
778 - {
779 - u = (float)x / (float)(detail - 1);
780 - v = 1.f - ((float)y / (float)(detail - 1));
781 - ptr = x + (detail*y);
782 - pos = D3DVECTOR(face[ptr].x, size / 2.f, face[ptr].y);
783 - normal = D3DVECTOR(0, 1, 0);
784 - vertices[ptr + (numfacevertices * 4)] = D3DVERTEX(pos, normal, u, v);
785 - litvertices[ptr + (numfacevertices * 4)] = D3DLVERTEX(pos, 0xFFFFFFFF, 0, u, v);
786 - colorvertices[ptr + (numfacevertices * 4)] = COLORVERTEX(pos, normal, 0xFFFFFFFF, 0, u, v);
787 - }
788 - }
789 - // Bottom face
790 - for (int y = 0; y < detail; y++)
791 - {
792 - for (int x = 0; x < detail; x++)
793 - {
794 - u = (float)x / (float)(detail - 1);
795 - v = 1.f - ((float)y / (float)(detail - 1));
796 - ptr = x + (detail*y);
797 - pos = D3DVECTOR(face[ptr].x, -size / 2.f, -face[ptr].y);
798 - normal = D3DVECTOR(0, -1, 0);
799 - vertices[ptr + (numfacevertices * 5)] = D3DVERTEX(pos, normal, u, v);
800 - litvertices[ptr + (numfacevertices * 5)] = D3DLVERTEX(pos, 0xFFFFFFFF, 0, u, v);
801 - colorvertices[ptr + (numfacevertices * 5)] = COLORVERTEX(pos, normal, 0xFFFFFFFF, 0, u, v);
802 - }
803 - }
804 - free(face);
805 - // Generate index table
806 - ptr = 0;
807 - for (int i = 0; i < 6; i++)
808 - {
809 - for (int j = 0; j < numfaceindices; j++)
810 - mesh[ptr++] = faceindex[j] + (i*numfacevertices);
811 - }
812 - free(faceindex);
813 -}
814 -
815 -void SetVertexColor(D3DLVERTEX *start, COLORVERTEX *start_color, int count, DWORD color)
816 -{
817 - for (int i = 0; i < count; i++)
818 - {
819 - start[i].color = color;
820 - start_color[i].color = color;
821 - }
822 -}
823 -
824 -void SetVertexSpecular(D3DLVERTEX *start, COLORVERTEX *start_color, int count, DWORD color)
825 -{
826 - for (int i = 0; i < count; i++)
827 - {
828 - start[i].specular = color;
829 - start_color[i].specular = color;
830 - }
831 -}
832 -
833 -
834 -DDPIXELFORMAT texformats[256];
835 -int texformatindex = 0;
836 -
837 -void cleartexformats()
838 -{
839 - ZeroMemory(texformats, 256 * sizeof(DDPIXELFORMAT));
840 - texformatindex = 0;
841 -}
842 -
843 -HRESULT CALLBACK gettexformat(LPDDPIXELFORMAT lpDDPixFmt, LPVOID lpContext)
844 -{
845 - memcpy(&texformats[texformatindex], lpDDPixFmt, sizeof(DDPIXELFORMAT));
846 - texformatindex++;
847 - if (texformatindex >= 256) return D3DENUMRET_CANCEL;
848 - return D3DENUMRET_OK;
849 -}
850 -
851 -static bool gentexture(const DDPIXELFORMAT format, MultiDirectDrawSurface **surface, int width, int height, int pattern)
852 -{
853 - DDSURFACEDESC2 ddsd;
854 - ZeroMemory(&ddsd, sizeof(DDSURFACEDESC2));
855 - ddsd.dwSize = sizeof(DDSURFACEDESC2);
856 - ddsd.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH | DDSD_PIXELFORMAT | DDSD_TEXTURESTAGE;
857 - ddsd.ddsCaps.dwCaps = DDSCAPS_TEXTURE;
858 - ddsd.dwWidth = width;
859 - ddsd.dwHeight = height;
860 - ddsd.ddsCaps.dwCaps2 = DDSCAPS2_TEXTUREMANAGE;
861 - ddsd.ddpfPixelFormat = format;
862 - HRESULT error = ddinterface->CreateSurface(&ddsd, surface, NULL);
863 - if (error != D3D_OK) return false;
864 - switch (pattern)
865 - {
866 - case 0:
867 - default:
868 - (*surface)->Lock(NULL, &ddsd, DDLOCK_WAIT, NULL);
869 - DrawPalette(ddsd, (unsigned char *)ddsd.lpSurface);
870 - (*surface)->Unlock(NULL);
871 - }
872 - return true;
873 -}
874 -
875 -void MakeLights()
876 -{
877 - for (int i = 0; i < 8; i++)
878 - {
879 - lightenable[i] = FALSE;
880 - ZeroMemory(&lights[i], sizeof(D3DLIGHT7));
881 - lights[i].dcvDiffuse.r = lights[i].dcvDiffuse.g = lights[i].dcvDiffuse.b = 1;
882 - lights[i].dltType = D3DLIGHT_DIRECTIONAL;
883 - hexlightcolor[i].diffuse = 0xFFFFFF;
884 - }
885 - lightenable[0] = TRUE;
886 - lights[0].dvPosition = D3DVECTOR(-10, -10, -10);
887 - lights[1].dvPosition = D3DVECTOR(10, -10, -10);
888 - lights[2].dvPosition = D3DVECTOR(-10, 10, -10);
889 - lights[3].dvPosition = D3DVECTOR(10, 10, -10);
890 - lights[4].dvPosition = D3DVECTOR(-10, -10, 10);
891 - lights[5].dvPosition = D3DVECTOR(10, -10, 10);
892 - lights[6].dvPosition = D3DVECTOR(-10, 10, 10);
893 - lights[7].dvPosition = D3DVECTOR(10, 10, 10);
894 - lights[0].dvDirection = D3DVECTOR(1, 1, 1);
895 - lights[1].dvDirection = D3DVECTOR(-1, 1, 1);
896 - lights[2].dvDirection = D3DVECTOR(1, -1, 1);
897 - lights[3].dvDirection = D3DVECTOR(-1, -1, 1);
898 - lights[4].dvDirection = D3DVECTOR(1, 1, -1);
899 - lights[5].dvDirection = D3DVECTOR(-1, 1, -1);
900 - lights[6].dvDirection = D3DVECTOR(1, -1, -1);
901 - lights[7].dvDirection = D3DVECTOR(-1, -1, -1);
902 -}
903 -
904 -static const DDPIXELFORMAT fmt_rgba4444 = { sizeof(DDPIXELFORMAT),DDPF_RGB | DDPF_ALPHAPIXELS,0,16,0xF00,0xF0,0xF,0xF000 };
905 -static const DDPIXELFORMAT fmt_rgba1555 = { sizeof(DDPIXELFORMAT),DDPF_RGB | DDPF_ALPHAPIXELS,0,16,0x7C00,0x3E0,0x1F,0x8000 };
906 -static const DDPIXELFORMAT fmt_rgb565 = { sizeof(DDPIXELFORMAT),DDPF_RGB,0,16,0xF800,0x7E0,0x1F,0 };
907 -static const DDPIXELFORMAT fmt_rgba8888 = { sizeof(DDPIXELFORMAT),DDPF_RGB | DDPF_ALPHAPIXELS,0,32,0xFF0000,0xFF00,0xFF,0xFF000000 };
908 -
909 -void InitTest(int test)
910 -{
911 - DDSURFACEDESC2 ddsd;
912 - DDSCAPS2 ddscaps;
913 - HDC hRenderDC;
914 - ZeroMemory(&ddscaps,sizeof(DDSCAPS2));
915 - LPDIRECTDRAWPALETTE palette;
916 - unsigned char *buffer;
917 - MultiDirectDrawSurface *temp1 = NULL;
918 - MultiDirectDrawSurface *temp2 = NULL;
919 - HRESULT error;
920 - D3DMATRIX matWorld;
921 - D3DMATRIX matView;
922 - D3DMATRIX matProj;
923 - D3DMATRIX mat;
924 - bgcolor = 0;
925 - DDCOLORKEY ckey;
926 - ckey.dwColorSpaceHighValue = ckey.dwColorSpaceLowValue = 0;
927 - if(ddver > 3)ddsd.dwSize = sizeof(DDSURFACEDESC2);
928 - else ddsd.dwSize = sizeof(DDSURFACEDESC);
929 - error = ddsrender->GetSurfaceDesc(&ddsd);
930 - switch (test)
931 - {
932 - case 0:
933 - if (!fullscreen) backbuffers = 0;
934 - buffer = (unsigned char *)malloc(ddsd.lPitch*ddsd.dwHeight);
935 - DrawPalette(ddsd, buffer);
936 - error = ddsrender->Lock(NULL, &ddsd, DDLOCK_WAIT, NULL);
937 - memcpy(ddsd.lpSurface, buffer, ddsd.lPitch*ddsd.dwHeight);
938 - error = ddsrender->Unlock(NULL);
939 - ddsrender->GetPalette(&palette);
940 - if (backbuffers > 0)
941 - {
942 - ddscaps.dwCaps = DDSCAPS_BACKBUFFER;
943 - error = ddsrender->GetAttachedSurface(&ddscaps, &temp1);
944 - DrawGradients(ddsd, buffer, hWnd, palette, 1, 0);
945 - error = temp1->Lock(NULL, &ddsd, DDLOCK_WAIT, NULL);
946 - memcpy(ddsd.lpSurface, buffer, ddsd.lPitch*ddsd.dwHeight);
947 - error = temp1->Unlock(NULL);
948 - }
949 - if (backbuffers > 1)
950 - {
951 - ddscaps.dwCaps = DDSCAPS_FLIP;
952 - error = temp1->GetAttachedSurface(&ddscaps, &temp2);
953 - temp1->Release();
954 - temp1 = temp2;
955 - DrawGradients(ddsd, buffer, hWnd, palette, 0, 0x0000FF);
956 - error = temp1->Lock(NULL, &ddsd, DDLOCK_WAIT, NULL);
957 - memcpy(ddsd.lpSurface, buffer, ddsd.lPitch*ddsd.dwHeight);
958 - error = temp1->Unlock(NULL);
959 - }
960 - if (backbuffers > 2)
961 - {
962 - ddscaps.dwCaps = DDSCAPS_FLIP;
963 - error = temp1->GetAttachedSurface(&ddscaps, &temp2);
964 - temp1->Release();
965 - temp1 = temp2;
966 - DrawGradients(ddsd, buffer, hWnd, palette, 0, 0x00FF00);
967 - error = temp1->Lock(NULL, &ddsd, DDLOCK_WAIT, NULL);
968 - memcpy(ddsd.lpSurface, buffer, ddsd.lPitch*ddsd.dwHeight);
969 - error = temp1->Unlock(NULL);
970 - }
971 - if (backbuffers > 3)
972 - {
973 - ddscaps.dwCaps = DDSCAPS_FLIP;
974 - error = temp1->GetAttachedSurface(&ddscaps, &temp2);
975 - temp1->Release();
976 - temp1 = temp2;
977 - DrawGradients(ddsd, buffer, hWnd, palette, 0, 0xFF0000);
978 - error = temp1->Lock(NULL, &ddsd, DDLOCK_WAIT, NULL);
979 - memcpy(ddsd.lpSurface, buffer, ddsd.lPitch*ddsd.dwHeight);
980 - error = temp1->Unlock(NULL);
981 - }
982 - if (temp1) temp1->Release();
983 - free(buffer);
984 - if (palette) palette->Release();
985 - break;
986 - case 2:
987 - if (!fullscreen) backbuffers = 0;
988 - error = ddsrender->GetDC(&hRenderDC);
989 - DrawGDIPatterns(ddsd, hRenderDC, 0);
990 - ddsrender->ReleaseDC(hRenderDC);
991 - if (backbuffers > 0)
992 - {
993 - ddscaps.dwCaps = DDSCAPS_BACKBUFFER;
994 - error = ddsrender->GetAttachedSurface(&ddscaps, &temp1);
995 - temp1->GetDC(&hRenderDC);
996 - DrawGDIPatterns(ddsd, hRenderDC, 1);
997 - temp1->ReleaseDC(hRenderDC);
998 - }
999 - if (backbuffers > 1)
1000 - {
1001 - ddscaps.dwCaps = DDSCAPS_FLIP;
1002 - error = temp1->GetAttachedSurface(&ddscaps, &temp2);
1003 - temp1->Release();
1004 - temp1 = temp2;
1005 - temp1->GetDC(&hRenderDC);
1006 - DrawGDIPatterns(ddsd, hRenderDC, 2);
1007 - temp1->ReleaseDC(hRenderDC);
1008 - }
1009 - if (backbuffers > 2)
1010 - {
1011 - ddscaps.dwCaps = DDSCAPS_FLIP;
1012 - error = temp1->GetAttachedSurface(&ddscaps, &temp2);
1013 - temp1->Release();
1014 - temp1 = temp2;
1015 - temp1->GetDC(&hRenderDC);
1016 - DrawGDIPatterns(ddsd, hRenderDC, 3);
1017 - temp1->ReleaseDC(hRenderDC);
1018 - }
1019 - if (backbuffers > 3)
1020 - {
1021 - ddscaps.dwCaps = DDSCAPS_FLIP;
1022 - error = temp1->GetAttachedSurface(&ddscaps, &temp2);
1023 - temp1->Release();
1024 - temp1 = temp2;
1025 - temp1->GetDC(&hRenderDC);
1026 - DrawGDIPatterns(ddsd, hRenderDC, 4);
1027 - temp1->ReleaseDC(hRenderDC);
1028 - }
1029 - if (backbuffers > 4)
1030 - {
1031 - ddscaps.dwCaps = DDSCAPS_FLIP;
1032 - error = temp1->GetAttachedSurface(&ddscaps, &temp2);
1033 - temp1->Release();
1034 - temp1 = temp2;
1035 - temp1->GetDC(&hRenderDC);
1036 - DrawGDIPatterns(ddsd, hRenderDC, 5);
1037 - temp1->ReleaseDC(hRenderDC);
1038 - }
1039 - if (backbuffers > 5)
1040 - {
1041 - ddscaps.dwCaps = DDSCAPS_FLIP;
1042 - error = temp1->GetAttachedSurface(&ddscaps, &temp2);
1043 - temp1->Release();
1044 - temp1 = temp2;
1045 - temp1->GetDC(&hRenderDC);
1046 - DrawGDIPatterns(ddsd, hRenderDC, 6);
1047 - temp1->ReleaseDC(hRenderDC);
1048 - }
1049 - if (backbuffers > 6)
1050 - {
1051 - ddscaps.dwCaps = DDSCAPS_FLIP;
1052 - error = temp1->GetAttachedSurface(&ddscaps, &temp2);
1053 - temp1->Release();
1054 - temp1 = temp2;
1055 - temp1->GetDC(&hRenderDC);
1056 - DrawGDIPatterns(ddsd, hRenderDC, 7);
1057 - temp1->ReleaseDC(hRenderDC);
1058 - }
1059 - if (temp1) temp1->Release();
1060 - break;
1061 - case 4:
1062 - ddsrender->GetSurfaceDesc(&ddsd);
1063 - ddsd.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH;
1064 - ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN;
1065 - ddinterface->CreateSurface(&ddsd, &sprites[0].surface, NULL);
1066 - ddsrender->GetPalette(&palette);
1067 - error = sprites[0].surface->Lock(NULL, &ddsd, DDLOCK_WAIT, NULL);
1068 - if(palette) palette->Release();
1069 - DrawGradients(ddsd, (unsigned char *)ddsd.lpSurface, hWnd, palette, 1, 0);
1070 - DrawDitheredColor(&ddsd, (unsigned char *)ddsd.lpSurface, 0, FALSE);
1071 - error = sprites[0].surface->Unlock(NULL);
1072 - sprites[0].width = (float)ddsd.dwWidth;
1073 - sprites[0].height = (float)ddsd.dwHeight;
1074 - sprites[0].rect.left = sprites[0].rect.top = 0;
1075 - sprites[0].rect.right = ddsd.dwWidth;
1076 - sprites[0].rect.bottom = ddsd.dwHeight;
1077 - if (backbuffers) ddsrender->GetAttachedSurface(&ddscaps, &temp1);
1078 - else temp1 = ddsrender;
1079 - temp1->SetColorKey(DDCKEY_DESTBLT, &ckey);
1080 - if (backbuffers) temp1->Release();
1081 - for (int i = 1; i < 16; i++)
1082 - {
1083 - switch ((i - 1 & 3))
1084 - {
1085 - case 0:
1086 - sprites[i].width = sprites[i].height = 64.f;
1087 - sprites[i].ddsd.dwWidth = sprites[i].ddsd.dwHeight =
1088 - sprites[i].rect.right = sprites[i].rect.bottom = 64;
1089 - sprites[i].ddsd.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH;
1090 - sprites[i].ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN;
1091 - if (ddver > 3) sprites[i].ddsd.dwSize = sizeof(DDSURFACEDESC2);
1092 - else sprites[i].ddsd.dwSize = sizeof(DDSURFACEDESC);
1093 - ddinterface->CreateSurface(&sprites[i].ddsd, &sprites[i].surface, NULL);
1094 - error = sprites[i].surface->Lock(NULL, &sprites[i].ddsd, DDLOCK_WAIT, NULL);
1095 - DrawPalette(sprites[i].ddsd, (unsigned char *)sprites[i].ddsd.lpSurface);
1096 - sprites[i].surface->Unlock(NULL);
1097 - break;
1098 - case 1:
1099 - break;
1100 - case 2:
1101 - break;
1102 - case 3:
1103 - break;
1104 - default:
1105 - break;
1106 - }
1107 - if (i < 5) sprites[i].bltflags = 0;
1108 - else if (i < 9)
1109 - {
1110 - sprites[i].bltflags = DDBLTFAST_SRCCOLORKEY;
1111 - if (sprites[i].surface) sprites[i].surface->SetColorKey(DDCKEY_SRCBLT, &ckey);
1112 - }
1113 - else if (i < 13) sprites[i].bltflags = DDBLTFAST_DESTCOLORKEY;
1114 - else
1115 - {
1116 - sprites[i].bltflags = DDBLTFAST_SRCCOLORKEY | DDBLTFAST_DESTCOLORKEY;
1117 - if (sprites[i].surface) sprites[i].surface->SetColorKey(DDCKEY_SRCBLT, &ckey);
1118 - }
1119 - sprites[i].x = randfloat((float)ddsd.dwWidth);
1120 - sprites[i].y = randfloat((float)ddsd.dwHeight);
1121 - sprites[i].xvelocity = randfloat(5);
1122 - sprites[i].yvelocity = randfloat(5);
1123 - }
1124 - break;
1125 - case 7:
1126 - if (!fullscreen) backbuffers = 0;
1127 - ddsrender->GetSurfaceDesc(&ddsd);
1128 - ddsrender->GetPalette(&palette);
1129 - sprites[0].ddsd.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH;
1130 - sprites[0].ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN;
1131 - if (ddver > 3) sprites[0].ddsd.dwSize = sizeof(DDSURFACEDESC2);
1132 - else sprites[0].ddsd.dwSize = sizeof(DDSURFACEDESC);
1133 - memcpy(&sprites[1], &sprites[0], sizeof(DDSPRITE));
1134 - memcpy(&sprites[2], &sprites[0], sizeof(DDSPRITE));
1135 - memcpy(&sprites[3], &sprites[0], sizeof(DDSPRITE));
1136 - memcpy(&sprites[4], &sprites[0], sizeof(DDSPRITE));
1137 - memcpy(&sprites[5], &sprites[0], sizeof(DDSPRITE));
1138 - sprites[0].width = sprites[0].height = 256.0f;
1139 - sprites[1].width = sprites[1].height = 256.0f;
1140 - sprites[2].width = sprites[2].height = 16.0f;
1141 - sprites[3].width = sprites[3].height = 16.0f;
1142 - sprites[4].width = sprites[4].height = 8.0f;
1143 - sprites[5].width = sprites[4].height = 6.0f;
1144 - sprites[0].ddsd.dwWidth = sprites[0].ddsd.dwHeight =
1145 - sprites[0].rect.right = sprites[0].rect.bottom = 256;
1146 - sprites[1].ddsd.dwWidth = sprites[1].ddsd.dwHeight =
1147 - sprites[1].rect.right = sprites[1].rect.bottom = 256;
1148 - sprites[2].ddsd.dwWidth = sprites[2].ddsd.dwHeight =
1149 - sprites[2].rect.right = sprites[2].rect.bottom = 16;
1150 - sprites[3].ddsd.dwWidth = sprites[3].ddsd.dwHeight =
1151 - sprites[3].rect.right = sprites[3].rect.bottom = 16;
1152 - sprites[4].ddsd.dwWidth = sprites[4].ddsd.dwHeight =
1153 - sprites[4].rect.right = sprites[4].rect.bottom = 8;
1154 - sprites[5].ddsd.dwWidth = sprites[5].ddsd.dwHeight =
1155 - sprites[5].rect.right = sprites[5].rect.bottom = 6;
1156 - ddinterface->CreateSurface(&sprites[0].ddsd, &sprites[0].surface, NULL);
1157 - ddinterface->CreateSurface(&sprites[1].ddsd, &sprites[1].surface, NULL);
1158 - ddinterface->CreateSurface(&sprites[2].ddsd, &sprites[2].surface, NULL);
1159 - ddinterface->CreateSurface(&sprites[3].ddsd, &sprites[3].surface, NULL);
1160 - ddinterface->CreateSurface(&sprites[4].ddsd, &sprites[4].surface, NULL);
1161 - ddinterface->CreateSurface(&sprites[5].ddsd, &sprites[5].surface, NULL);
1162 - DDCAPS ddcaps;
1163 - ddcaps.dwSize = sizeof(DDCAPS);
1164 - ddinterface->GetCaps(&ddcaps, NULL);
1165 - DrawROPPatterns(ddsrender, sprites, backbuffers, ddver, bpp, ddcaps.dwRops,hWnd,palette);
1166 - if (palette) palette->Release();
1167 - break;
1168 - case 8:
1169 - ddsrender->GetSurfaceDesc(&ddsd);
1170 - sprites[0].ddsd.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH;
1171 - sprites[0].ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN;
1172 - if (ddver > 3) sprites[0].ddsd.dwSize = sizeof(DDSURFACEDESC2);
1173 - else sprites[0].ddsd.dwSize = sizeof(DDSURFACEDESC);
1174 - sprites[0].ddsd.dwWidth = sprites[0].ddsd.dwHeight =
1175 - sprites[0].rect.right = sprites[0].rect.bottom = 64;
1176 - ddinterface->CreateSurface(&sprites[0].ddsd, &sprites[0].surface, NULL);
1177 - DrawRotatedBlt(ddsrender, sprites);
1178 - break;
1179 - case 9:
1180 - ddsrender->GetSurfaceDesc(&ddsd);
1181 - sprites[0].ddsd.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH;
1182 - sprites[0].ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN;
1183 - if (ddver > 3) sprites[0].ddsd.dwSize = sizeof(DDSURFACEDESC2);
1184 - else sprites[0].ddsd.dwSize = sizeof(DDSURFACEDESC);
1185 - sprites[0].ddsd.dwWidth = sprites[0].ddsd.dwHeight =
1186 - sprites[0].rect.right = sprites[0].rect.bottom = 255;
1187 - ddinterface->CreateSurface(&sprites[0].ddsd, &sprites[0].surface, NULL);
1188 - counter = 0;
1189 - break;
1190 - case 10:
1191 - case 11:
1192 - ddsrender->GetSurfaceDesc(&ddsd);
1193 - sprites[0].ddsd.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH;
1194 - sprites[0].ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN;
1195 - if (ddver > 3) sprites[0].ddsd.dwSize = sizeof(DDSURFACEDESC2);
1196 - else sprites[0].ddsd.dwSize = sizeof(DDSURFACEDESC);
1197 - switch (bpp)
1198 - {
1199 - case 8:
1200 - sprites[0].width = sprites[0].height = 16;
1201 - break;
1202 - case 15:
1203 - sprites[0].width = 32;
1204 - sprites[0].height = 7;
1205 - break;
1206 - case 16:
1207 - sprites[0].width = 64;
1208 - sprites[0].height = 7;
1209 - break;
1210 - case 24:
1211 - case 32:
1212 - default:
1213 - sprites[0].width = 256;
1214 - sprites[0].height = 7;
1215 - break;
1216 - }
1217 - sprites[0].ddsd.dwWidth = sprites[0].width;
1218 - sprites[0].ddsd.dwHeight = sprites[0].height;
1219 - memcpy(&sprites[1], &sprites[0], sizeof(DDSPRITE));
1220 - memcpy(&sprites[2], &sprites[0], sizeof(DDSPRITE));
1221 - ddinterface->CreateSurface(&sprites[0].ddsd, &sprites[0].surface, NULL);
1222 - ddinterface->CreateSurface(&sprites[1].ddsd, &sprites[1].surface, NULL);
1223 - ddinterface->CreateSurface(&sprites[2].ddsd, &sprites[2].surface, NULL);
1224 - sprites[1].surface->Lock(NULL, &sprites[1].ddsd, DDLOCK_WAIT, NULL);
1225 - DrawColorKeyCompPatterns(sprites[1].ddsd, (unsigned char*)sprites[1].ddsd.lpSurface, bpp, 0);
1226 - sprites[1].surface->Unlock(NULL);
1227 - sprites[2].surface->Lock(NULL, &sprites[2].ddsd, DDLOCK_WAIT, NULL);
1228 - DrawColorKeyCompPatterns(sprites[2].ddsd, (unsigned char*)sprites[2].ddsd.lpSurface, bpp, 1);
1229 - sprites[2].surface->Unlock(NULL);
1230 - counter = 0;
1231 - break;
1232 - case 12:
1233 - MakeCube3D(5, 2);
1234 - ZeroMemory(&material, sizeof(D3DMATERIAL7));
1235 - material.ambient.r = 0.5f;
1236 - material.ambient.g = 0.5f;
1237 - material.ambient.b = 0.0f;
1238 - material.diffuse.r = 1.0f;
1239 - material.diffuse.g = 1.0f;
1240 - material.diffuse.b = 1.0f;
1241 - error = d3d7dev->SetMaterial(&material);
1242 - error = d3d7dev->LightEnable(0, TRUE);
1243 - error = d3d7dev->SetRenderState(D3DRENDERSTATE_LIGHTING, TRUE);
1244 - error = d3d7dev->SetRenderState(D3DRENDERSTATE_AMBIENT, 0x7f7f7f7f);
1245 - mat._11 = mat._22 = mat._33 = mat._44 = 1.0f;
1246 - mat._12 = mat._13 = mat._14 = mat._41 = 0.0f;
1247 - mat._21 = mat._23 = mat._24 = mat._42 = 0.0f;
1248 - mat._31 = mat._32 = mat._34 = mat._43 = 0.0f;
1249 - matWorld = mat;
1250 - error = d3d7dev->SetTransform(D3DTRANSFORMSTATE_WORLD, &matWorld);
1251 - matView = mat;
1252 - matView._43 = 10.0f;
1253 - error = d3d7dev->SetTransform(D3DTRANSFORMSTATE_VIEW, &matView);
1254 - matProj = mat;
1255 - matProj._11 = 2.0f;
1256 - matProj._22 = 2.0f;
1257 - matProj._34 = 1.0f;
1258 - matProj._43 = -1.0f;
1259 - matProj._44 = 0.0f;
1260 - error = d3d7dev->SetTransform(D3DTRANSFORMSTATE_PROJECTION, &matProj);
1261 - ZeroMemory(&lights[0], sizeof(D3DLIGHT7));
1262 - lights[0].dltType = D3DLIGHT_DIRECTIONAL;
1263 - lights[0].dcvDiffuse.r = 1;
1264 - lights[0].dcvDiffuse.g = 0;
1265 - lights[0].dcvDiffuse.b = 1;
1266 - lights[0].dvDirection = D3DVECTOR(5, 5, 5);
1267 - lights[0].dvRange = D3DLIGHT_RANGE_MAX;
1268 - lights[0].dvAttenuation1 = 0.4f;
1269 - error = d3d7dev->SetLight(0, &lights[0]);
1270 - break;
1271 - case 13:
1272 - MakeCube3D(5, 2);
1273 - cleartexformats();
1274 - d3d7dev->EnumTextureFormats(gettexformat, NULL);
1275 - gentexture(fmt_rgba4444, &textures[0], 256, 256, 0);
1276 - gentexture(fmt_rgba1555, &textures[1], 256, 256, 0);
1277 - gentexture(fmt_rgb565, &textures[2], 256, 256, 0);
1278 - gentexture(fmt_rgba8888, &textures[3], 256, 256, 0);
1279 - ZeroMemory(&material, sizeof(D3DMATERIAL7));
1280 - material.ambient.r = 1.0f;
1281 - material.ambient.g = 1.0f;
1282 - material.ambient.b = 1.0f;
1283 - material.diffuse.r = 1.0f;
1284 - material.diffuse.g = 1.0f;
1285 - material.diffuse.b = 1.0f;
1286 - error = d3d7dev->SetMaterial(&material);
1287 - error = d3d7dev->LightEnable(0, TRUE);
1288 - error = d3d7dev->SetRenderState(D3DRENDERSTATE_LIGHTING, TRUE);
1289 - error = d3d7dev->SetRenderState(D3DRENDERSTATE_AMBIENT, 0xFFFFFFFF);
1290 - error = d3d7dev->SetRenderState(D3DRENDERSTATE_CULLMODE, D3DCULL_CW);
1291 - mat._11 = mat._22 = mat._33 = mat._44 = 1.0f;
1292 - mat._12 = mat._13 = mat._14 = mat._41 = 0.0f;
1293 - mat._21 = mat._23 = mat._24 = mat._42 = 0.0f;
1294 - mat._31 = mat._32 = mat._34 = mat._43 = 0.0f;
1295 - matWorld = mat;
1296 - error = d3d7dev->SetTransform(D3DTRANSFORMSTATE_WORLD, &matWorld);
1297 - matView = mat;
1298 - matView._43 = 10.0f;
1299 - error = d3d7dev->SetTransform(D3DTRANSFORMSTATE_VIEW, &matView);
1300 - matProj = mat;
1301 - matProj._11 = 2.0f;
1302 - matProj._22 = 2.0f;
1303 - matProj._34 = 1.0f;
1304 - matProj._43 = -1.0f;
1305 - matProj._44 = 0.0f;
1306 - error = d3d7dev->SetTransform(D3DTRANSFORMSTATE_PROJECTION, &matProj);
1307 - ZeroMemory(&lights[0], sizeof(D3DLIGHT7));
1308 - lights[0].dltType = D3DLIGHT_DIRECTIONAL;
1309 - lights[0].dcvDiffuse.r = 1;
1310 - lights[0].dcvDiffuse.g = 0;
1311 - lights[0].dcvDiffuse.b = 1;
1312 - lights[0].dvDirection = D3DVECTOR(5, 5, 5);
1313 - lights[0].dvRange = D3DLIGHT_RANGE_MAX;
1314 - lights[0].dvAttenuation1 = 0.4f;
1315 - error = d3d7dev->SetLight(0, &lights[0]);
1316 - break;
1317 - case 15:
1318 - ZeroMemory(lights, 8 * sizeof(D3DLIGHT7));
1319 - MakeLights();
1320 - case 14:
1321 - MakeCube3D(5, 8);
1322 - ZeroMemory(&material, sizeof(D3DMATERIAL7));
1323 - material.ambient.r = 1.0f;
1324 - material.ambient.g = 1.0f;
1325 - material.ambient.b = 1.0f;
1326 - material.ambient.a = 1.0f;
1327 - material.diffuse.r = 1.0f;
1328 - material.diffuse.g = 1.0f;
1329 - material.diffuse.b = 1.0f;
1330 - material.diffuse.a = 1.0f;
1331 - error = d3d7dev->SetMaterial(&material);
1332 - error = d3d7dev->SetRenderState(D3DRENDERSTATE_LIGHTING, FALSE);
1333 - error = d3d7dev->SetRenderState(D3DRENDERSTATE_AMBIENT, 0xffffffff);
1334 - mat._11 = mat._22 = mat._33 = mat._44 = 1.0f;
1335 - mat._12 = mat._13 = mat._14 = mat._41 = 0.0f;
1336 - mat._21 = mat._23 = mat._24 = mat._42 = 0.0f;
1337 - mat._31 = mat._32 = mat._34 = mat._43 = 0.0f;
1338 - matWorld = mat;
1339 - error = d3d7dev->SetTransform(D3DTRANSFORMSTATE_WORLD, &matWorld);
1340 - matView = mat;
1341 - matView._43 = 10.0f;
1342 - error = d3d7dev->SetTransform(D3DTRANSFORMSTATE_VIEW, &matView);
1343 - matProj = mat;
1344 - matProj._11 = 2.0f;
1345 - matProj._22 = 2.0f;
1346 - matProj._34 = 1.0f;
1347 - matProj._43 = -1.0f;
1348 - matProj._44 = 0.0f;
1349 - error = d3d7dev->SetTransform(D3DTRANSFORMSTATE_PROJECTION, &matProj);
1350 - texshaderstate = defaulttexshaderstate;
1351 - break;
1352 - default:
1353 - break;
1354 - }
1355 -}
1356 -
1357 -void RunTestTimed(int test)
1358 -{
1359 - if(stoptimer) return;
1360 - DDSURFACEDESC2 ddsd;
1361 - DDSCAPS2 ddscaps;
1362 - DDBLTFX bltfx;
1363 - HDC hDCdest, hDCsrc;
1364 - RECT r1, r2;
1365 - POINT p;
1366 - RECT srcrect, destrect;
1367 - HRESULT error;
1368 - D3DMATRIX mat;
1369 - TCHAR message[256];
1370 - bltfx.dwSize = sizeof(DDBLTFX);
1371 - ZeroMemory(&ddscaps,sizeof(DDSCAPS2));
1372 - ddscaps.dwCaps = DDSCAPS_BACKBUFFER;
1373 - MultiDirectDrawSurface *temp1 = NULL;
1374 - ZeroMemory(&ddsd, sizeof(DDSURFACEDESC2));
1375 - if (d3dver >= 3) ddsd.dwSize = sizeof(DDSURFACEDESC2);
1376 - else ddsd.dwSize = sizeof(DDSURFACEDESC);
1377 - float time;
1378 - switch(test)
1379 - {
1380 - case 0: // Palette and gradients
1381 - case 2: // GDI patterns
1382 - case 7: // ROP patterns
1383 - default:
1384 - if(fullscreen) ddsurface->Flip(NULL,DDFLIP_WAIT);
1385 - break;
1386 - case 4: // BltFast sprites
1387 - if (backbuffers) ddsrender->GetAttachedSurface(&ddscaps, &temp1);
1388 - else temp1 = ddsrender;
1389 - bltfx.dwFillColor = 0;
1390 - temp1->Blt(NULL, NULL, NULL, DDBLT_COLORFILL, &bltfx);
1391 - if (backbuffers) temp1->Release();
1392 - for(int i = 0; i < 16; i++)
1393 - {
1394 - sprites[i].x += sprites[i].xvelocity;
1395 - if(sprites[i].xvelocity < 0 && sprites[i].x < 0) sprites[i].xvelocity = -sprites[i].xvelocity;
1396 - if(sprites[i].xvelocity > 0 && (sprites[i].x + sprites[i].width) > width)
1397 - sprites[i].xvelocity = -sprites[i].xvelocity;
1398 - sprites[i].y += sprites[i].yvelocity;
1399 - if(sprites[i].yvelocity < 0 && sprites[i].y < 0) sprites[i].yvelocity = -sprites[i].yvelocity;
1400 - if(sprites[i].yvelocity > 0 && (sprites[i].y + sprites[i].height) > height)
1401 - sprites[i].yvelocity = -sprites[i].yvelocity;
1402 - if(sprites[i].surface)
1403 - {
1404 - if(backbuffers) ddsrender->GetAttachedSurface(&ddscaps,&temp1);
1405 - else temp1 = ddsrender;
1406 - temp1->BltFast((DWORD)sprites[i].x,(DWORD)sprites[i].y,sprites[i].surface,&sprites[i].rect,sprites[i].bltflags);
1407 - if(backbuffers) temp1->Release();
1408 - }
1409 - }
1410 - if (fullscreen)
1411 - {
1412 - if (backbuffers && ddsrender) ddsrender->Flip(NULL, DDFLIP_WAIT);
1413 - }
1414 - else
1415 - {
1416 - p.x = 0;
1417 - p.y = 0;
1418 - ClientToScreen(hWnd, &p);
1419 - GetClientRect(hWnd, &r1);
1420 - OffsetRect(&r1, p.x, p.y);
1421 - SetRect(&r2, 0, 0, width, height);
1422 - if (ddsurface && ddsrender) ddsurface->Blt(&r1, ddsrender, &r2, DDBLT_WAIT, NULL);
1423 - }
1424 - break;
1425 - case 10: // Source Key Override test
1426 - case 11: // Destination Key Override Test
1427 - if (backbuffers) ddsrender->GetAttachedSurface(&ddscaps, &temp1);
1428 - else temp1 = ddsrender;
1429 -
1430 - sprites[0].surface->Blt(NULL, sprites[1].surface, NULL, DDBLT_WAIT, NULL);
1431 - bltfx.dwSize = sizeof(DDBLTFX);
1432 - switch (bpp)
1433 - {
1434 - case 8:
1435 - bltfx.ddckSrcColorkey.dwColorSpaceHighValue = bltfx.ddckSrcColorkey.dwColorSpaceLowValue =
1436 - bltfx.ddckDestColorkey.dwColorSpaceHighValue = bltfx.ddckDestColorkey.dwColorSpaceLowValue = counter;
1437 - counter++;
1438 - if (counter > 255) counter = 0;
1439 - r1.left = r1.top = 0;
1440 - r1.right = r1.bottom = 16;
1441 - break;
1442 - case 15:
1443 - switch (counter >> 5)
1444 - {
1445 - case 0:
1446 - bltfx.ddckSrcColorkey.dwColorSpaceHighValue = bltfx.ddckSrcColorkey.dwColorSpaceLowValue =
1447 - bltfx.ddckDestColorkey.dwColorSpaceHighValue = bltfx.ddckDestColorkey.dwColorSpaceLowValue =
1448 - (counter & 31) << 10;
1449 - break;
1450 - case 1:
1451 - bltfx.ddckSrcColorkey.dwColorSpaceHighValue = bltfx.ddckSrcColorkey.dwColorSpaceLowValue =
1452 - bltfx.ddckDestColorkey.dwColorSpaceHighValue = bltfx.ddckDestColorkey.dwColorSpaceLowValue =
1453 - (counter & 31) << 5;
1454 - break;
1455 - case 2:
1456 - bltfx.ddckSrcColorkey.dwColorSpaceHighValue = bltfx.ddckSrcColorkey.dwColorSpaceLowValue =
1457 - bltfx.ddckDestColorkey.dwColorSpaceHighValue = bltfx.ddckDestColorkey.dwColorSpaceLowValue =
1458 - (counter & 31);
1459 - break;
1460 - case 3:
1461 - bltfx.ddckSrcColorkey.dwColorSpaceHighValue = bltfx.ddckSrcColorkey.dwColorSpaceLowValue =
1462 - bltfx.ddckDestColorkey.dwColorSpaceHighValue = bltfx.ddckDestColorkey.dwColorSpaceLowValue =
1463 - (counter & 31) + ((counter & 31) << 5);
1464 - break;
1465 - case 4:
1466 - bltfx.ddckSrcColorkey.dwColorSpaceHighValue = bltfx.ddckSrcColorkey.dwColorSpaceLowValue =
1467 - bltfx.ddckDestColorkey.dwColorSpaceHighValue = bltfx.ddckDestColorkey.dwColorSpaceLowValue =
1468 - (counter & 31) + ((counter & 31) << 10);
1469 - break;
1470 - case 5:
1471 - bltfx.ddckSrcColorkey.dwColorSpaceHighValue = bltfx.ddckSrcColorkey.dwColorSpaceLowValue =
1472 - bltfx.ddckDestColorkey.dwColorSpaceHighValue = bltfx.ddckDestColorkey.dwColorSpaceLowValue =
1473 - ((counter & 31) << 5) + ((counter & 31) << 10);
1474 - break;
1475 - case 6:
1476 - default:
1477 - bltfx.ddckSrcColorkey.dwColorSpaceHighValue = bltfx.ddckSrcColorkey.dwColorSpaceLowValue =
1478 - bltfx.ddckDestColorkey.dwColorSpaceHighValue = bltfx.ddckDestColorkey.dwColorSpaceLowValue =
1479 - (counter & 31) + ((counter & 31) << 5) + ((counter & 31) << 10);
1480 - break;
1481 - }
1482 - counter++;
1483 - if (counter > 223) counter = 0;
1484 - r1.left = r1.top = 0;
1485 - r1.right = 32;
1486 - r1.bottom = 7;
1487 - break;
1488 - case 16:
1489 - switch (counter >> 6)
1490 - {
1491 - case 0:
1492 - bltfx.ddckSrcColorkey.dwColorSpaceHighValue = bltfx.ddckSrcColorkey.dwColorSpaceLowValue =
1493 - bltfx.ddckDestColorkey.dwColorSpaceHighValue = bltfx.ddckDestColorkey.dwColorSpaceLowValue =
1494 - ((counter & 63) >> 1) << 11;
1495 - break;
1496 - case 1:
1497 - bltfx.ddckSrcColorkey.dwColorSpaceHighValue = bltfx.ddckSrcColorkey.dwColorSpaceLowValue =
1498 - bltfx.ddckDestColorkey.dwColorSpaceHighValue = bltfx.ddckDestColorkey.dwColorSpaceLowValue =
1499 - (counter & 63) << 5;
1500 - break;
1501 - case 2:
1502 - bltfx.ddckSrcColorkey.dwColorSpaceHighValue = bltfx.ddckSrcColorkey.dwColorSpaceLowValue =
1503 - bltfx.ddckDestColorkey.dwColorSpaceHighValue = bltfx.ddckDestColorkey.dwColorSpaceLowValue =
1504 - (counter & 63) >> 1;
1505 - break;
1506 - case 3:
1507 - bltfx.ddckSrcColorkey.dwColorSpaceHighValue = bltfx.ddckSrcColorkey.dwColorSpaceLowValue =
1508 - bltfx.ddckDestColorkey.dwColorSpaceHighValue = bltfx.ddckDestColorkey.dwColorSpaceLowValue =
1509 - ((counter & 63) >> 1) + ((counter & 63) << 5);
1510 - break;
1511 - case 4:
1512 - bltfx.ddckSrcColorkey.dwColorSpaceHighValue = bltfx.ddckSrcColorkey.dwColorSpaceLowValue =
1513 - bltfx.ddckDestColorkey.dwColorSpaceHighValue = bltfx.ddckDestColorkey.dwColorSpaceLowValue =
1514 - ((counter & 63) >> 1) + (((counter & 63) >> 1) << 11);
1515 - break;
1516 - case 5:
1517 - bltfx.ddckSrcColorkey.dwColorSpaceHighValue = bltfx.ddckSrcColorkey.dwColorSpaceLowValue =
1518 - bltfx.ddckDestColorkey.dwColorSpaceHighValue = bltfx.ddckDestColorkey.dwColorSpaceLowValue =
1519 - ((counter & 63) << 5) + (((counter & 63) >> 1) << 11);
1520 - break;
1521 - case 6:
1522 - default:
1523 - bltfx.ddckSrcColorkey.dwColorSpaceHighValue = bltfx.ddckSrcColorkey.dwColorSpaceLowValue =
1524 - bltfx.ddckDestColorkey.dwColorSpaceHighValue = bltfx.ddckDestColorkey.dwColorSpaceLowValue =
1525 - ((counter & 63) >> 1) + ((counter & 63) << 5) + (((counter & 63) >> 1) << 11);
1526 - break;
1527 - }
1528 - counter++;
1529 - if (counter > 447) counter = 0;
1530 - r1.left = r1.top = 0;
1531 - r1.right = 64;
1532 - r1.bottom = 7;
1533 - break;
1534 - case 24:
1535 - case 32:
1536 - default:
1537 - switch (counter >> 8)
1538 - {
1539 - case 0:
1540 - bltfx.ddckSrcColorkey.dwColorSpaceHighValue = bltfx.ddckSrcColorkey.dwColorSpaceLowValue =
1541 - bltfx.ddckDestColorkey.dwColorSpaceHighValue = bltfx.ddckDestColorkey.dwColorSpaceLowValue =
1542 - (counter & 255) << 16;
1543 - break;
1544 - case 1:
1545 - bltfx.ddckSrcColorkey.dwColorSpaceHighValue = bltfx.ddckSrcColorkey.dwColorSpaceLowValue =
1546 - bltfx.ddckDestColorkey.dwColorSpaceHighValue = bltfx.ddckDestColorkey.dwColorSpaceLowValue =
1547 - (counter & 255) << 8;
1548 - break;
1549 - case 2:
1550 - bltfx.ddckSrcColorkey.dwColorSpaceHighValue = bltfx.ddckSrcColorkey.dwColorSpaceLowValue =
1551 - bltfx.ddckDestColorkey.dwColorSpaceHighValue = bltfx.ddckDestColorkey.dwColorSpaceLowValue =
1552 - counter & 255;
1553 - break;
1554 - case 3:
1555 - bltfx.ddckSrcColorkey.dwColorSpaceHighValue = bltfx.ddckSrcColorkey.dwColorSpaceLowValue =
1556 - bltfx.ddckDestColorkey.dwColorSpaceHighValue = bltfx.ddckDestColorkey.dwColorSpaceLowValue =
1557 - (counter & 255) + ((counter & 255) << 8);
1558 - break;
1559 - case 4:
1560 - bltfx.ddckSrcColorkey.dwColorSpaceHighValue = bltfx.ddckSrcColorkey.dwColorSpaceLowValue =
1561 - bltfx.ddckDestColorkey.dwColorSpaceHighValue = bltfx.ddckDestColorkey.dwColorSpaceLowValue =
1562 - (counter & 255) + ((counter & 255) << 16);
1563 - break;
1564 - case 5:
1565 - bltfx.ddckSrcColorkey.dwColorSpaceHighValue = bltfx.ddckSrcColorkey.dwColorSpaceLowValue =
1566 - bltfx.ddckDestColorkey.dwColorSpaceHighValue = bltfx.ddckDestColorkey.dwColorSpaceLowValue =
1567 - ((counter & 255) << 8) + ((counter & 255) << 16);
1568 - break;
1569 - case 6:
1570 - default:
1571 - bltfx.ddckSrcColorkey.dwColorSpaceHighValue = bltfx.ddckSrcColorkey.dwColorSpaceLowValue =
1572 - bltfx.ddckDestColorkey.dwColorSpaceHighValue = bltfx.ddckDestColorkey.dwColorSpaceLowValue =
1573 - (counter & 255) + ((counter & 255) << 8) + ((counter & 255) << 16);
1574 - break;
1575 - }
1576 - counter++;
1577 - if (counter > 1791) counter = 0;
1578 - r1.left = r1.top = 0;
1579 - r1.right = 256;
1580 - r1.bottom = 7;
1581 - break;
1582 - }
1583 - if (test == 10)
1584 - sprites[0].surface->Blt(NULL, sprites[2].surface, NULL, DDBLT_WAIT | DDBLT_KEYSRCOVERRIDE, &bltfx);
1585 - else
1586 - sprites[0].surface->Blt(NULL, sprites[2].surface, NULL, DDBLT_WAIT | DDBLT_KEYDESTOVERRIDE, &bltfx);
1587 - temp1->GetDC(&hDCdest);
1588 - sprites[0].surface->GetDC(&hDCsrc);
1589 - if (ddver > 3) ddsd.dwSize = sizeof(DDSURFACEDESC2);
1590 - else ddsd.dwSize = sizeof(DDSURFACEDESC);
1591 - temp1->GetSurfaceDesc(&ddsd);
1592 - StretchBlt(hDCdest, ((ddsd.dwWidth / 2) - 128), ((ddsd.dwHeight / 2) + 128), 256, -256,
1593 - hDCsrc, 0, 0, r1.right, r1.bottom, SRCCOPY);
1594 - sprites[0].surface->ReleaseDC(hDCsrc);
1595 - SetBkColor(hDCdest, RGB(0, 0, 255));
1596 - SetTextColor(hDCdest, RGB(255, 255, 255));
1597 - if(test == 10)
1598 - _tcscpy(message, _T("Source Color Key Override Test"));
1599 - else
1600 - _tcscpy(message, _T("Destination Color Key Override Test"));
1601 - TextOut(hDCdest, 0, 0, message, _tcslen(message));
1602 - _stprintf(message, _T("Color: 0x%08X "), bltfx.ddckSrcColorkey.dwColorSpaceHighValue);
1603 - TextOut(hDCdest, 0, 16, message, _tcslen(message));
1604 - temp1->ReleaseDC(hDCdest);
1605 - if (backbuffers) temp1->Release();
1606 - if (fullscreen)
1607 - {
1608 - if (backbuffers && ddsrender) ddsrender->Flip(NULL, DDFLIP_WAIT);
1609 - }
1610 - else
1611 - {
1612 - p.x = 0;
1613 - p.y = 0;
1614 - ClientToScreen(hWnd, &p);
1615 - GetClientRect(hWnd, &r1);
1616 - OffsetRect(&r1, p.x, p.y);
1617 - SetRect(&r2, 0, 0, width, height);
1618 - if (ddsurface && ddsrender) ddsurface->Blt(&r1, ddsrender, &r2, DDBLT_WAIT, NULL);
1619 - }
1620 - break;
1621 - case 12:
1622 - error = d3d7dev->Clear(0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, bgcolor, 1.0, 0);
1623 - time = (float)clock() / (float)CLOCKS_PER_SEC;
1624 - mat._11 = mat._22 = mat._33 = mat._44 = 1.0f;
1625 - mat._12 = mat._13 = mat._14 = mat._41 = 0.0f;
1626 - mat._21 = mat._23 = mat._24 = mat._42 = 0.0f;
1627 - mat._31 = mat._32 = mat._34 = mat._43 = 0.0f;
1628 - mat._11 = (FLOAT)cos( (float)time );
1629 - mat._33 = (FLOAT)cos( (float)time );
1630 - mat._13 = -(FLOAT)sin( (float)time );
1631 - mat._31 = (FLOAT)sin( (float)time );
1632 - error = d3d7dev->SetTransform(D3DTRANSFORMSTATE_WORLD, &mat);
1633 - error = d3d7dev->BeginScene();
1634 - error = d3d7dev->DrawIndexedPrimitive(D3DPT_TRIANGLELIST,D3DFVF_VERTEX,vertices,numpoints,mesh,numindices,0);
1635 - error = d3d7dev->EndScene();
1636 - if (fullscreen)
1637 - {
1638 - if (backbuffers) ddsurface->Flip(NULL, DDFLIP_WAIT);
1639 - }
1640 - else
1641 - {
1642 - p.x = 0;
1643 - p.y = 0;
1644 - ClientToScreen(hWnd, &p);
1645 - GetClientRect(hWnd, &destrect);
1646 - OffsetRect(&destrect, p.x, p.y);
1647 - SetRect(&srcrect, 0, 0, width, height);
1648 - if (ddsurface && ddsrender)error = ddsurface->Blt(&destrect, ddsrender, &srcrect, DDBLT_WAIT, NULL);
1649 - }
1650 - break;
1651 - case 13:
1652 - error = d3d7dev->Clear(0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, bgcolor, 1.0, 0);
1653 - time = (float)clock() / (float)CLOCKS_PER_SEC;
1654 - mat._11 = mat._22 = mat._33 = mat._44 = 1.0f;
1655 - mat._12 = mat._13 = mat._14 = mat._41 = 0.0f;
1656 - mat._21 = mat._23 = mat._24 = mat._42 = 0.0f;
1657 - mat._31 = mat._32 = mat._34 = mat._43 = 0.0f;
1658 - mat._11 = (FLOAT)cos( (float)time );
1659 - mat._33 = (FLOAT)cos( (float)time );
1660 - mat._13 = -(FLOAT)sin( (float)time );
1661 - mat._31 = (FLOAT)sin( (float)time );
1662 - error = d3d7dev->SetTransform(D3DTRANSFORMSTATE_WORLD, &mat);
1663 - error = d3d7dev->BeginScene();
1664 - error = d3d7dev->SetTexture(0,(LPDIRECTDRAWSURFACE7)textures[0]->GetSurface());
1665 - error = d3d7dev->DrawPrimitive(D3DPT_TRIANGLESTRIP,D3DFVF_VERTEX,vertices,4,0);
1666 - error = d3d7dev->SetTexture(0,(LPDIRECTDRAWSURFACE7)textures[1]->GetSurface());
1667 - error = d3d7dev->DrawPrimitive(D3DPT_TRIANGLESTRIP,D3DFVF_VERTEX,vertices+4,4,0);
1668 - error = d3d7dev->SetTexture(0,(LPDIRECTDRAWSURFACE7)textures[2]->GetSurface());
1669 - error = d3d7dev->DrawPrimitive(D3DPT_TRIANGLESTRIP,D3DFVF_VERTEX,vertices+8,4,0);
1670 - error = d3d7dev->SetTexture(0,(LPDIRECTDRAWSURFACE7)textures[3]->GetSurface());
1671 - error = d3d7dev->DrawPrimitive(D3DPT_TRIANGLESTRIP,D3DFVF_VERTEX,vertices+12,4,0);
1672 - error = d3d7dev->EndScene();
1673 - if (fullscreen)
1674 - {
1675 - if (backbuffers) ddsurface->Flip(NULL, DDFLIP_WAIT);
1676 - }
1677 - else
1678 - {
1679 - p.x = 0;
1680 - p.y = 0;
1681 - ClientToScreen(hWnd, &p);
1682 - GetClientRect(hWnd, &destrect);
1683 - OffsetRect(&destrect, p.x, p.y);
1684 - SetRect(&srcrect, 0, 0, width, height);
1685 - if (ddsurface && ddsrender)error = ddsurface->Blt(&destrect, ddsrender, &srcrect, DDBLT_WAIT, NULL);
1686 - }
1687 - break;
1688 - case 14:
1689 - error = d3d7dev->Clear(0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, bgcolor, 1.0, 0);
1690 - time = (float)clock() / (float)CLOCKS_PER_SEC;
1691 - mat._11 = mat._22 = mat._33 = mat._44 = 1.0f;
1692 - mat._12 = mat._13 = mat._14 = mat._41 = 0.0f;
1693 - mat._21 = mat._23 = mat._24 = mat._42 = 0.0f;
1694 - mat._31 = mat._32 = mat._34 = mat._43 = 0.0f;
1695 - mat._11 = (FLOAT)cos( (float)time );
1696 - mat._33 = (FLOAT)cos( (float)time );
1697 - mat._13 = -(FLOAT)sin( (float)time );
1698 - mat._31 = (FLOAT)sin( (float)time );
1699 - error = d3d7dev->SetTransform(D3DTRANSFORMSTATE_WORLD, &mat);
1700 - error = d3d7dev->BeginScene();
1701 - error = d3d7dev->DrawIndexedPrimitive(D3DPT_TRIANGLELIST,D3DFVF_LVERTEX,litvertices,numpoints,mesh,numindices,0);
1702 - error = d3d7dev->EndScene();
1703 - if (fullscreen)
1704 - {
1705 - if (backbuffers) ddsurface->Flip(NULL, DDFLIP_WAIT);
1706 - }
1707 - else
1708 - {
1709 - p.x = 0;
1710 - p.y = 0;
1711 - ClientToScreen(hWnd, &p);
1712 - GetClientRect(hWnd, &destrect);
1713 - OffsetRect(&destrect, p.x, p.y);
1714 - SetRect(&srcrect, 0, 0, width, height);
1715 - if (ddsurface && ddsrender)error = ddsurface->Blt(&destrect, ddsrender, &srcrect, DDBLT_WAIT, NULL);
1716 - }
1717 - break;
1718 - case 15:
1719 - error = d3d7dev->Clear(0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, bgcolor, 1.0, 0);
1720 - time = (float)clock() / (float)CLOCKS_PER_SEC;
1721 - mat._11 = mat._22 = mat._33 = mat._44 = 1.0f;
1722 - mat._12 = mat._13 = mat._14 = mat._41 = 0.0f;
1723 - mat._21 = mat._23 = mat._24 = mat._42 = 0.0f;
1724 - mat._31 = mat._32 = mat._34 = mat._43 = 0.0f;
1725 - mat._11 = (FLOAT)cos( (float)time );
1726 - mat._33 = (FLOAT)cos( (float)time );
1727 - mat._13 = -(FLOAT)sin( (float)time );
1728 - mat._31 = (FLOAT)sin( (float)time );
1729 - error = d3d7dev->SetTransform(D3DTRANSFORMSTATE_WORLD, &mat);
1730 - error = d3d7dev->BeginScene();
1731 - error = d3d7dev->DrawIndexedPrimitive(D3DPT_TRIANGLELIST,FVF_COLORVERTEX,colorvertices,numpoints,mesh,numindices,0);
1732 - error = d3d7dev->EndScene();
1733 - if (fullscreen)
1734 - {
1735 - if (backbuffers) ddsurface->Flip(NULL, DDFLIP_WAIT);
1736 - }
1737 - else
1738 - {
1739 - p.x = 0;
1740 - p.y = 0;
1741 - ClientToScreen(hWnd, &p);
1742 - GetClientRect(hWnd, &destrect);
1743 - OffsetRect(&destrect, p.x, p.y);
1744 - SetRect(&srcrect, 0, 0, width, height);
1745 - if (ddsurface && ddsrender)error = ddsurface->Blt(&destrect, ddsrender, &srcrect, DDBLT_WAIT, NULL);
1746 - }
1747 - break;
1748 - }
1749 -}
1750 -
1751 -void RunTestLooped(int test)
1752 -{
1753 - randnum += rand(); // Improves randomness of "snow" patterns at certain resolutions
1754 - HDC hdc;
1755 - unsigned int i;
1756 - POINT p;
1757 - HPEN pen;
1758 - HBRUSH brush;
1759 - HANDLE tmphandle,tmphandle2;
1760 - RECT srcrect,destrect;
1761 - HRESULT error;
1762 - DDSURFACEDESC2 ddsd;
1763 - DDBLTFX bltfx;
1764 - if(ddver > 3)ddsd.dwSize = sizeof(DDSURFACEDESC2);
1765 - else ddsd.dwSize = sizeof(DDSURFACEDESC);
1766 - error = ddsrender->GetSurfaceDesc(&ddsd);
1767 - MultiDirectDrawSurface *temp1 = NULL;
1768 - DDSCAPS2 ddscaps;
1769 - DWORD bitmask;
1770 - ZeroMemory(&ddscaps,sizeof(DDSCAPS2));
1771 - ddscaps.dwCaps = DDSCAPS_BACKBUFFER;
1772 - int op;
1773 - switch(test)
1774 - {
1775 - case 1:
1776 - default:
1777 - if(backbuffers)
1778 - {
1779 - ddsrender->GetAttachedSurface(&ddscaps,&temp1);
1780 - temp1->Lock(NULL,&ddsd,DDLOCK_WAIT,NULL);
1781 - }
1782 - else ddsrender->Lock(NULL,&ddsd,DDLOCK_WAIT,NULL);
1783 -
1784 - for(i = 0; i < ((ddsd.lPitch * ddsd.dwHeight)/4); i++)
1785 - ((DWORD*)ddsd.lpSurface)[i] = rand32(randnum);
1786 -
1787 - if(backbuffers)
1788 - {
1789 - temp1->Unlock(NULL);
1790 - ddsrender->Flip(NULL,DDFLIP_WAIT);
1791 - }
1792 - else ddsrender->Unlock(NULL);
1793 - if(!fullscreen)
1794 - {
1795 - p.x = 0;
1796 - p.y = 0;
1797 - ClientToScreen(hWnd,&p);
1798 - GetClientRect(hWnd,&destrect);
1799 - OffsetRect(&destrect,p.x,p.y);
1800 - SetRect(&srcrect,0,0,width,height);
1801 - if(ddsurface && ddsrender)error = ddsurface->Blt(&destrect,ddsrender,&srcrect,DDBLT_WAIT,NULL);
1802 - }
1803 - break;
1804 - case 3:
1805 - ddsrender->GetDC(&hdc);
1806 - op = rand32(randnum) % 4;
1807 - pen = CreatePen(rand32(randnum) % 5,0,RGB(rand32(randnum)%256,rand32(randnum)%256,rand32(randnum)%256));
1808 - brush = CreateSolidBrush(RGB(rand32(randnum)%256,rand32(randnum)%256,rand32(randnum)%256));
1809 - tmphandle = SelectObject(hdc,pen);
1810 - tmphandle2 = SelectObject(hdc,brush);
1811 - SetBkColor(hdc,RGB(rand32(randnum)%256,rand32(randnum)%256,rand32(randnum)%256));
1812 - switch(op)
1813 - {
1814 - case 0:
1815 - default:
1816 - Rectangle(hdc,rand32(randnum)%ddsd.dwWidth,rand32(randnum)%ddsd.dwHeight,
1817 - rand32(randnum)%ddsd.dwWidth,rand32(randnum)%ddsd.dwHeight);
1818 - break;
1819 - case 1:
1820 - Ellipse(hdc,rand32(randnum)%ddsd.dwWidth,rand32(randnum)%ddsd.dwHeight,
1821 - rand32(randnum)%ddsd.dwWidth,rand32(randnum)%ddsd.dwHeight);
1822 - break;
1823 - case 2:
1824 - MoveToEx(hdc,rand32(randnum)%ddsd.dwWidth,rand32(randnum)%ddsd.dwHeight,NULL);
1825 - LineTo(hdc,rand32(randnum)%ddsd.dwWidth,rand32(randnum)%ddsd.dwHeight);
1826 - break;
1827 - case 3:
1828 - SetTextColor(hdc,RGB(rand32(randnum)%256,rand32(randnum)%256,rand32(randnum)%256));
1829 - TextOut(hdc,rand32(randnum)%ddsd.dwWidth,rand32(randnum)%ddsd.dwHeight,_T("Text"),4);
1830 - break;
1831 - }
1832 - SelectObject(hdc,tmphandle2);
1833 - SelectObject(hdc,tmphandle);
1834 - DeleteObject(brush);
1835 - DeleteObject(pen);
1836 - ddsrender->ReleaseDC(hdc);
1837 - if(!fullscreen)
1838 - {
1839 - p.x = 0;
1840 - p.y = 0;
1841 - ClientToScreen(hWnd,&p);
1842 - GetClientRect(hWnd,&destrect);
1843 - OffsetRect(&destrect,p.x,p.y);
1844 - SetRect(&srcrect,0,0,width,height);
1845 - if(ddsurface && ddsrender)error = ddsurface->Blt(&destrect,ddsrender,&srcrect,DDBLT_WAIT,NULL);
1846 - }
1847 - break;
1848 - case 5:
1849 - rndrect5:
1850 - destrect.bottom = rand32(randnum)%ddsd.dwHeight;
1851 - destrect.top = rand32(randnum)%ddsd.dwHeight;
1852 - destrect.left = rand32(randnum)%ddsd.dwWidth;
1853 - destrect.right = rand32(randnum)%ddsd.dwWidth;
1854 - if((destrect.bottom < destrect.top) || (destrect.right < destrect.left)) goto rndrect5;
1855 - bltfx.dwSize = sizeof(DDBLTFX);
1856 - switch(bpp)
1857 - {
1858 - case 8:
1859 - bltfx.dwFillColor = rand32(randnum) % 0xFF;
1860 - break;
1861 - case 15:
1862 - bltfx.dwFillColor = rand32(randnum) % 0x7FFF;
1863 - break;
1864 - case 16:
1865 - bltfx.dwFillColor = rand32(randnum) % 0xFFFF;
1866 - break;
1867 - case 24:
1868 - case 32:
1869 - default:
1870 - bltfx.dwFillColor = rand32(randnum) % 0xFFFFFF;
1871 - break;
1872 - }
1873 - ddsrender->Blt(&destrect,NULL,NULL,DDBLT_COLORFILL,&bltfx);
1874 - if(!fullscreen)
1875 - {
1876 - p.x = 0;
1877 - p.y = 0;
1878 - ClientToScreen(hWnd,&p);
1879 - GetClientRect(hWnd,&destrect);
1880 - OffsetRect(&destrect,p.x,p.y);
1881 - SetRect(&srcrect,0,0,width,height);
1882 - if(ddsurface && ddsrender)error = ddsurface->Blt(&destrect,ddsrender,&srcrect,DDBLT_WAIT,NULL);
1883 - }
1884 - break;
1885 - case 9:
1886 - bltfx.dwSize = sizeof(DDBLTFX);
1887 - switch (bpp)
1888 - {
1889 - case 8:
1890 - bitmask = 0xFF;
1891 - break;
1892 - case 15:
1893 - bitmask = 0x7FFF;
1894 - break;
1895 - case 16:
1896 - bitmask = 0xFFFF;
1897 - break;
1898 - case 24:
1899 - bitmask = 0xFFFFFF;
1900 - break;
1901 - case 32:
1902 - default:
1903 - bitmask = 0xFFFFFFFF;
1904 - break;
1905 - }
1906 - for (int y = 0; y < 255; y++)
1907 - {
1908 - for (int x = 0; x < 255; x++)
1909 - {
1910 - bltfx.dwFillColor = counter & bitmask;
1911 - destrect.left = x;
1912 - destrect.right = x + 1;
1913 - destrect.top = y;
1914 - destrect.bottom = y + 1;
1915 - counter++;
1916 - sprites[0].surface->Blt(&destrect, NULL, NULL, DDBLT_COLORFILL, &bltfx);
1917 - }
1918 - }
1919 - ddsrender->Blt(NULL, sprites[0].surface, NULL, DDBLT_WAIT, NULL);
1920 - if (!fullscreen)
1921 - {
1922 - p.x = 0;
1923 - p.y = 0;
1924 - ClientToScreen(hWnd, &p);
1925 - GetClientRect(hWnd, &destrect);
1926 - OffsetRect(&destrect, p.x, p.y);
1927 - SetRect(&srcrect, 0, 0, width, height);
1928 - if (ddsurface && ddsrender)error = ddsurface->Blt(&destrect, ddsrender, &srcrect, DDBLT_WAIT, NULL);
1929 - }
1930 - break;
1931 - }
1932 - if(temp1) temp1->Release();
1933 -}
1934 -
1935 -void PopulateArgCombo(HWND hWnd)
1936 -{
1937 - SendMessage(hWnd, CB_ADDSTRING, 0, (LPARAM)_T("Diffuse"));
1938 - SendMessage(hWnd, CB_ADDSTRING, 0, (LPARAM)_T("Current"));
1939 - SendMessage(hWnd, CB_ADDSTRING, 0, (LPARAM)_T("Texture"));
1940 - SendMessage(hWnd, CB_ADDSTRING, 0, (LPARAM)_T("Factor"));
1941 - SendMessage(hWnd, CB_ADDSTRING, 0, (LPARAM)_T("Specular"));
1942 -}
1943 -
1944 -void PopulateOpCombo(HWND hWnd, bool color)
1945 -{
1946 - SendMessage(hWnd, CB_ADDSTRING, 0, (LPARAM)_T("Disable"));
1947 - SendMessage(hWnd, CB_ADDSTRING, 0, (LPARAM)_T("Select Arg 1"));
1948 - SendMessage(hWnd, CB_ADDSTRING, 0, (LPARAM)_T("Select Arg 2"));
1949 - SendMessage(hWnd, CB_ADDSTRING, 0, (LPARAM)_T("Modulate"));
1950 - SendMessage(hWnd, CB_ADDSTRING, 0, (LPARAM)_T("Modulate 2x"));
1951 - SendMessage(hWnd, CB_ADDSTRING, 0, (LPARAM)_T("Modulate 4x"));
1952 - SendMessage(hWnd, CB_ADDSTRING, 0, (LPARAM)_T("Add"));
1953 - SendMessage(hWnd, CB_ADDSTRING, 0, (LPARAM)_T("Add Signed"));
1954 - SendMessage(hWnd, CB_ADDSTRING, 0, (LPARAM)_T("Add Signed 2x"));
1955 - SendMessage(hWnd, CB_ADDSTRING, 0, (LPARAM)_T("Subtract"));
1956 - SendMessage(hWnd, CB_ADDSTRING, 0, (LPARAM)_T("Add Smooth"));
1957 - SendMessage(hWnd, CB_ADDSTRING, 0, (LPARAM)_T("Blend Diffuse Alpha"));
1958 - SendMessage(hWnd, CB_ADDSTRING, 0, (LPARAM)_T("Blend Texture Alpha"));
1959 - SendMessage(hWnd, CB_ADDSTRING, 0, (LPARAM)_T("Blend Factor Alpha"));
1960 - SendMessage(hWnd, CB_ADDSTRING, 0, (LPARAM)_T("Blend Texture Alpha PM"));
1961 - SendMessage(hWnd, CB_ADDSTRING, 0, (LPARAM)_T("Blend Current Alpha"));
1962 - SendMessage(hWnd, CB_ADDSTRING, 0, (LPARAM)_T("Premodulate"));
1963 - if (color)
1964 - {
1965 - SendMessage(hWnd, CB_ADDSTRING, 0, (LPARAM)_T("Modulate Alpha Add Color"));
1966 - SendMessage(hWnd, CB_ADDSTRING, 0, (LPARAM)_T("Modulate Color Add Alpha"));
1967 - SendMessage(hWnd, CB_ADDSTRING, 0, (LPARAM)_T("Modulate Inv. Alpha Add Color"));
1968 - SendMessage(hWnd, CB_ADDSTRING, 0, (LPARAM)_T("Modulate Inv. Color Add Alpha"));
1969 - }
1970 - else
1971 - {
1972 - SendMessage(hWnd, CB_ADDSTRING, 0, (LPARAM)_T("(invalid)"));
1973 - SendMessage(hWnd, CB_ADDSTRING, 0, (LPARAM)_T("(invalid)"));
1974 - SendMessage(hWnd, CB_ADDSTRING, 0, (LPARAM)_T("(invalid)"));
1975 - SendMessage(hWnd, CB_ADDSTRING, 0, (LPARAM)_T("(invalid)"));
1976 - }
1977 - SendMessage(hWnd, CB_ADDSTRING, 0, (LPARAM)_T("Bump Env. Map"));
1978 - SendMessage(hWnd, CB_ADDSTRING, 0, (LPARAM)_T("Bump Env. Map Luminance"));
1979 - if (color) SendMessage(hWnd, CB_ADDSTRING, 0, (LPARAM)_T("Dot Product3"));
1980 -}
1981 -
1982 -void PopulateBlendCombo(HWND hWnd, bool src)
1983 -{
1984 - SendMessage(hWnd, CB_ADDSTRING, 0, (LPARAM)_T("Zero"));
1985 - SendMessage(hWnd, CB_ADDSTRING, 0, (LPARAM)_T("One"));
1986 - SendMessage(hWnd, CB_ADDSTRING, 0, (LPARAM)_T("Source Color"));
1987 - SendMessage(hWnd, CB_ADDSTRING, 0, (LPARAM)_T("Inv. Src. Color"));
1988 - SendMessage(hWnd, CB_ADDSTRING, 0, (LPARAM)_T("Source Alpha"));
1989 - SendMessage(hWnd, CB_ADDSTRING, 0, (LPARAM)_T("Inv. Src. Alpha"));
1990 - SendMessage(hWnd, CB_ADDSTRING, 0, (LPARAM)_T("Dest. Alpha"));
1991 - SendMessage(hWnd, CB_ADDSTRING, 0, (LPARAM)_T("Inv. Dest. Alpha"));
1992 - SendMessage(hWnd, CB_ADDSTRING, 0, (LPARAM)_T("Dest. Color"));
1993 - SendMessage(hWnd, CB_ADDSTRING, 0, (LPARAM)_T("Inv. Dest. Color"));
1994 - SendMessage(hWnd, CB_ADDSTRING, 0, (LPARAM)_T("Src. Alpha Sat."));
1995 - if (src)
1996 - {
1997 - SendMessage(hWnd, CB_ADDSTRING, 0, (LPARAM)_T("Both Src. Alpha"));
1998 - SendMessage(hWnd, CB_ADDSTRING, 0, (LPARAM)_T("Both Inv. Src. Alpha"));
1999 - }
2000 -}
2001 -
2002 -void PopulateCompareCombo(HWND hWnd)
2003 -{
2004 - SendMessage(hWnd, CB_ADDSTRING, 0, (LPARAM)_T("Never"));
2005 - SendMessage(hWnd, CB_ADDSTRING, 0, (LPARAM)_T("Less"));
2006 - SendMessage(hWnd, CB_ADDSTRING, 0, (LPARAM)_T("Equal"));
2007 - SendMessage(hWnd, CB_ADDSTRING, 0, (LPARAM)_T("Less or Equal"));
2008 - SendMessage(hWnd, CB_ADDSTRING, 0, (LPARAM)_T("Greater"));
2009 - SendMessage(hWnd, CB_ADDSTRING, 0, (LPARAM)_T("Not Equal"));
2010 - SendMessage(hWnd, CB_ADDSTRING, 0, (LPARAM)_T("Greater or Equal"));
2011 - SendMessage(hWnd, CB_ADDSTRING, 0, (LPARAM)_T("Always"));
2012 -}
2013 -
2014 -void PopulateFogCombo(HWND hWnd)
2015 -{
2016 - SendMessage(hWnd, CB_ADDSTRING, 0, (LPARAM)_T("None"));
2017 - SendMessage(hWnd, CB_ADDSTRING, 0, (LPARAM)_T("Exponential"));
2018 - SendMessage(hWnd, CB_ADDSTRING, 0, (LPARAM)_T("Exp. Squared"));
2019 - SendMessage(hWnd, CB_ADDSTRING, 0, (LPARAM)_T("Linear"));
2020 -}
2021 -
2022 -void PopulateSourceCombo(HWND hWnd)
2023 -{
2024 - SendMessage(hWnd, CB_ADDSTRING, 0, (LPARAM)_T("Material"));
2025 - SendMessage(hWnd, CB_ADDSTRING, 0, (LPARAM)_T("Color 1"));
2026 - SendMessage(hWnd, CB_ADDSTRING, 0, (LPARAM)_T("Color 2"));
2027 -}
2028 -
2029 -void strupper(TCHAR *str)
2030 -{
2031 - TCHAR *ptr = str;
2032 - while (*ptr != 0)
2033 - {
2034 - *ptr = _totupper(*ptr);
2035 - ptr++;
2036 - }
2037 -}
2038 -
2039 -void paddwordzeroes(TCHAR *str)
2040 -{
2041 - TCHAR str2[16];
2042 - str2[0] = 0;
2043 - int len = _tcslen(str);
2044 - if (len < 8)
2045 - {
2046 - for (int i = 0; i < 8 - len; i++)
2047 - _tcscat(str2, _T("0"));
2048 - _tcscat(str2, str);
2049 - _tcscpy(str, str2);
2050 - }
2051 -}
2052 -
2053 -HRESULT CALLBACK SelectTextureFormatCallback(LPDDPIXELFORMAT lpDDPixFmt, LPVOID lpContext)
2054 -{
2055 - if (lpDDPixFmt->dwFlags & (DDPF_LUMINANCE | DDPF_BUMPLUMINANCE | DDPF_BUMPDUDV)) return D3DENUMRET_OK;
2056 - if (lpDDPixFmt->dwFourCC != 0) return D3DENUMRET_OK;
2057 - if (!(lpDDPixFmt->dwFlags & DDPF_ALPHAPIXELS)) return D3DENUMRET_OK;
2058 - if (lpDDPixFmt->dwRGBBitCount < 32) return D3DENUMRET_OK;
2059 - memcpy(lpContext, lpDDPixFmt, sizeof(DDPIXELFORMAT));
2060 - return D3DENUMRET_CANCEL;
2061 -}
2062 -
2063 -void CreateSurfaceFromBitmap(MultiDirectDrawSurface **surface, DDSURFACEDESC2 *ddsd, HDC hdc, int width, int height)
2064 -{
2065 - ddinterface->CreateSurface(ddsd, surface, NULL);
2066 - HDC surfacedc;
2067 - if (surface)
2068 - {
2069 - (*surface)->GetDC(&surfacedc);
2070 - BitBlt(surfacedc, 0, 0, width, height, hdc, 0, 0, SRCCOPY);
2071 - (*surface)->ReleaseDC(surfacedc);
2072 - }
2073 -}
2074 -
2075 -void SelectTexture(MultiDirectDrawSurface **surface, int type, DWORD colorkey, bool haskey, LPCTSTR file)
2076 -{
2077 - DDSURFACEDESC2 ddsd;
2078 - ZeroMemory(&ddsd, sizeof(DDSURFACEDESC2));
2079 - ddsd.dwSize = sizeof(DDSURFACEDESC2);
2080 - BITMAPV4HEADER bi;
2081 - HBITMAP bitmap;
2082 - HDC hdc;
2083 - HDC hmemdc;
2084 - HBITMAP holdbmp;
2085 - HICON icon;
2086 - VOID *bmpbits;
2087 - ZeroMemory(&bi, sizeof(BITMAPV4HEADER));
2088 - bi.bV4Size = sizeof(BITMAPV4HEADER);
2089 - bi.bV4Planes = 1;
2090 - bi.bV4BitCount = 32;
2091 - bi.bV4V4Compression = BI_BITFIELDS;
2092 - bi.bV4RedMask = 0x00FF0000;
2093 - bi.bV4GreenMask = 0x0000FF00;
2094 - bi.bV4BlueMask = 0x000000FF;
2095 - bi.bV4AlphaMask = 0xFF000000;
2096 - d3d7dev->EnumTextureFormats(SelectTextureFormatCallback, &ddsd.ddpfPixelFormat);
2097 - ddsd.ddsCaps.dwCaps = DDSCAPS_TEXTURE;
2098 - ddsd.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT | DDSD_PIXELFORMAT | DDSD_TEXTURESTAGE;
2099 - DDCOLORKEY ckey;
2100 - ckey.dwColorSpaceHighValue = ckey.dwColorSpaceLowValue = colorkey;
2101 - if (haskey) ddsd.dwFlags |= DDSD_CKSRCBLT;
2102 - if (*surface)
2103 - {
2104 - d3d7dev->SetTexture(texshaderstate.currentstage, NULL);
2105 - (*surface)->Release();
2106 - *surface = NULL;
2107 - }
2108 - switch (type)
2109 - {
2110 - case 0:
2111 - default:
2112 - break;
2113 - case 1:
2114 - break;
2115 - case 2:
2116 - hdc = GetDC(NULL);
2117 - bi.bV4Width = ddsd.dwWidth = bi.bV4Height = ddsd.dwHeight = 16;
2118 - bitmap = CreateDIBSection(hdc, (BITMAPINFO*)&bi, DIB_RGB_COLORS, &bmpbits, NULL, 0);
2119 - hmemdc = CreateCompatibleDC(hdc);
2120 - ReleaseDC(NULL, hdc);
2121 - holdbmp = (HBITMAP)SelectObject(hmemdc, bitmap);
2122 - icon = (HICON)LoadImage(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_DXGL), IMAGE_ICON, 16, 16, 0);
2123 - DrawIconEx(hmemdc, 0, 0, icon, 16, 16, 0, NULL, DI_NORMAL);
2124 - CreateSurfaceFromBitmap(surface, &ddsd, hmemdc, 16, 16);
2125 - SelectObject(hmemdc, holdbmp);
2126 - DeleteDC(hmemdc);
2127 - DeleteObject(bitmap);
2128 - if (*surface && haskey) (*surface)->SetColorKey(DDCKEY_SRCBLT, &ckey);
2129 - if (*surface) d3d7dev->SetTexture(texshaderstate.currentstage, (LPDIRECTDRAWSURFACE7)(*surface)->GetSurface());
2130 - break;
2131 - case 3:
2132 - hdc = GetDC(NULL);
2133 - bi.bV4Width = ddsd.dwWidth = bi.bV4Height = ddsd.dwHeight = 256;
2134 - bitmap = CreateDIBSection(hdc, (BITMAPINFO*)&bi, DIB_RGB_COLORS, &bmpbits, NULL, 0);
2135 - hmemdc = CreateCompatibleDC(hdc);
2136 - ReleaseDC(NULL, hdc);
2137 - holdbmp = (HBITMAP)SelectObject(hmemdc, bitmap);
2138 - icon = (HICON)LoadImage(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_DXGL), IMAGE_ICON, 256, 256, 0);
2139 - DrawIconEx(hmemdc, 0, 0, icon, 256, 256, 0, NULL, DI_NORMAL);
2140 - CreateSurfaceFromBitmap(surface, &ddsd, hmemdc, 256, 256);
2141 - SelectObject(hmemdc, holdbmp);
2142 - DeleteDC(hmemdc);
2143 - DeleteObject(bitmap);
2144 - if (*surface && haskey) (*surface)->SetColorKey(DDCKEY_SRCBLT, &ckey);
2145 - if (*surface) d3d7dev->SetTexture(texshaderstate.currentstage, (LPDIRECTDRAWSURFACE7)(*surface)->GetSurface());
2146 - break;
2147 - case 4:
2148 - break;
2149 - }
2150 -}
2151 -
2152 -void SetShaderArg(HWND hWnd, UINT dropdown, UINT checkalpha, UINT checkinv, DWORD *texarg)
2153 -{
2154 - DWORD arg = SendDlgItemMessage(hWnd, dropdown, CB_GETCURSEL, 0, 0);
2155 - if (SendDlgItemMessage(hWnd, checkalpha, BM_GETCHECK, 0, 0) == BST_CHECKED)
2156 - arg |= D3DTA_ALPHAREPLICATE;
2157 - if (SendDlgItemMessage(hWnd, checkinv, BM_GETCHECK, 0, 0) == BST_CHECKED)
2158 - arg |= D3DTA_COMPLEMENT;
2159 - *texarg = arg;
2160 -}
2161 -
2162 -INT_PTR CALLBACK TexShader7Proc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
2163 -{
2164 - HRESULT error;
2165 - D3DVIEWPORT7 vp;
2166 - HWND hDisplay;
2167 - int number;
2168 - float f;
2169 - TCHAR tmpstring[MAX_PATH + 1];
2170 - switch (Msg)
2171 - {
2172 - case WM_INITDIALOG:
2173 - RECT r;
2174 - DDSCAPS2 caps;
2175 - DDSURFACEDESC2 ddsd;
2176 - DDPIXELFORMAT ddpfz;
2177 - testnum = 14;
2178 - ddinterface = new MultiDirectDraw(7, &error, NULL);
2179 - hDisplay = GetDlgItem(hWnd, IDC_DISPLAY);
2180 - ::hWnd = hDisplay;
2181 - error = ddinterface->SetCooperativeLevel(hDisplay, DDSCL_NORMAL);
2182 - ZeroMemory(&ddsd, sizeof(DDSURFACEDESC2));
2183 - ddsd.dwSize = sizeof(DDSURFACEDESC2);
2184 - ddsd.dwFlags = DDSD_CAPS;
2185 - ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE;
2186 - error = ddinterface->CreateSurface(&ddsd, &ddsurface, NULL);
2187 - error = ddinterface->CreateClipper(0, &ddclipper, NULL);
2188 - error = ddclipper->SetHWnd(0, hDisplay);
2189 - error = ddsurface->SetClipper(ddclipper);
2190 - ZeroMemory(&ddsd, sizeof(DDSURFACEDESC2));
2191 - ddsd.dwSize = sizeof(DDSURFACEDESC2);
2192 - ddsd.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH;
2193 - ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE;
2194 - GetClientRect(hDisplay, &r);
2195 - ddsd.dwWidth = r.right;
2196 - ddsd.dwHeight = r.bottom;
2197 - error = ddinterface->CreateSurface(&ddsd, &ddsrender, NULL);
2198 - error = ddinterface->QueryInterface(IID_IDirect3D7, (VOID**)&d3d7);
2199 - error = d3d7->EnumZBufferFormats(IID_IDirect3DRGBDevice, zcallback, &ddpfz);
2200 - error = ddsrender->GetSurfaceDesc(&ddsd);
2201 - ddsd.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT | DDSD_PIXELFORMAT;
2202 - ddsd.ddsCaps.dwCaps = DDSCAPS_ZBUFFER | DDSCAPS_VIDEOMEMORY;
2203 - memcpy(&ddsd.ddpfPixelFormat, &ddpfz, sizeof(DDPIXELFORMAT));
2204 - error = ddinterface->CreateSurface(&ddsd, &zbuffer, NULL);
2205 - error = ddsrender->AddAttachedSurface(zbuffer);
2206 - error = d3d7->CreateDevice(IID_IDirect3DHALDevice, (LPDIRECTDRAWSURFACE7)ddsrender->GetSurface(), &d3d7dev);
2207 - if (error != D3D_OK)
2208 - error = d3d7->CreateDevice(IID_IDirect3DRGBDevice, (LPDIRECTDRAWSURFACE7)ddsrender->GetSurface(), &d3d7dev);
2209 - ddsrender->GetSurfaceDesc(&ddsd);
2210 - vp.dvMaxZ = 1.0f;
2211 - vp.dvMinZ = 0.0f;
2212 - vp.dwX = vp.dwY = 0;
2213 - vp.dwWidth = ddsd.dwWidth;
2214 - vp.dwHeight = ddsd.dwHeight;
2215 - error = d3d7dev->SetViewport(&vp);
2216 - error = d3d7dev->SetRenderState(D3DRENDERSTATE_ZENABLE, TRUE);
2217 - InitTest(14);
2218 - SendDlgItemMessage(hWnd, IDC_TEXTURE, CB_ADDSTRING, 0, (LPARAM)_T("None"));
2219 - SendDlgItemMessage(hWnd, IDC_TEXTURE, CB_ADDSTRING, 0, (LPARAM)_T("Gradients"));
2220 - SendDlgItemMessage(hWnd, IDC_TEXTURE, CB_ADDSTRING, 0, (LPARAM)_T("DXGL logo (small)"));
2221 - SendDlgItemMessage(hWnd, IDC_TEXTURE, CB_ADDSTRING, 0, (LPARAM)_T("DXGL logo (large)"));
2222 - SendDlgItemMessage(hWnd, IDC_TEXTURE, CB_ADDSTRING, 0, (LPARAM)_T("Texture file"));
2223 - SendDlgItemMessage(hWnd, IDC_TEXTURE, CB_SETCURSEL, 0, 0);
2224 - SendDlgItemMessage(hWnd, IDC_TEXCOLORKEY, WM_SETTEXT, 0, (LPARAM)_T(""));
2225 - PopulateArgCombo(GetDlgItem(hWnd, IDC_CARG1));
2226 - PopulateArgCombo(GetDlgItem(hWnd, IDC_CARG2));
2227 - PopulateArgCombo(GetDlgItem(hWnd, IDC_AARG1));
2228 - PopulateArgCombo(GetDlgItem(hWnd, IDC_AARG2));
2229 - SendDlgItemMessage(hWnd, IDC_CARG1, CB_SETCURSEL, D3DTA_TEXTURE, 0);
2230 - SendDlgItemMessage(hWnd, IDC_CARG2, CB_SETCURSEL, D3DTA_CURRENT, 0);
2231 - SendDlgItemMessage(hWnd, IDC_AARG1, CB_SETCURSEL, D3DTA_TEXTURE, 0);
2232 - SendDlgItemMessage(hWnd, IDC_AARG2, CB_SETCURSEL, D3DTA_CURRENT, 0);
2233 - PopulateOpCombo(GetDlgItem(hWnd, IDC_COLOROP), true);
2234 - PopulateOpCombo(GetDlgItem(hWnd, IDC_ALPHAOP), false);
2235 - SendDlgItemMessage(hWnd, IDC_COLOROP, CB_SETCURSEL, D3DTOP_MODULATE - 1, 0);
2236 - SendDlgItemMessage(hWnd, IDC_ALPHAOP, CB_SETCURSEL, D3DTOP_SELECTARG1 - 1, 0);
2237 - SendDlgItemMessage(hWnd, IDC_DIFFUSE, WM_SETTEXT, 0, (LPARAM)_T("FFFFFFFF"));
2238 - SendDlgItemMessage(hWnd, IDC_SPECULAR, WM_SETTEXT, 0, (LPARAM)_T("00000000"));
2239 - SendDlgItemMessage(hWnd, IDC_FACTOR, WM_SETTEXT, 0, (LPARAM)_T("00000000"));
2240 - SendDlgItemMessage(hWnd, IDC_FOGCOLOR, WM_SETTEXT, 0, (LPARAM)_T("00000000"));
2241 - SendDlgItemMessage(hWnd, IDC_BGCOLOR, WM_SETTEXT, 0, (LPARAM)_T("00000000"));
2242 - PopulateBlendCombo(GetDlgItem(hWnd, IDC_SRCBLEND), true);
2243 - PopulateBlendCombo(GetDlgItem(hWnd, IDC_DESTBLEND), true);
2244 - SendDlgItemMessage(hWnd, IDC_SRCBLEND, CB_SETCURSEL, D3DBLEND_ONE - 1, 0);
2245 - SendDlgItemMessage(hWnd, IDC_DESTBLEND, CB_SETCURSEL, D3DBLEND_ZERO - 1, 0);
2246 - PopulateCompareCombo(GetDlgItem(hWnd, IDC_ALPHAFUNC));
2247 - SendDlgItemMessage(hWnd, IDC_ALPHAFUNC, CB_SETCURSEL, D3DCMP_ALWAYS - 1, 0);
2248 - PopulateFogCombo(GetDlgItem(hWnd, IDC_VERTEXFOGMODE));
2249 - PopulateFogCombo(GetDlgItem(hWnd, IDC_PIXELFOGMODE));
2250 - SendDlgItemMessage(hWnd, IDC_VERTEXFOGMODE, CB_SETCURSEL, D3DFOG_NONE, 0);
2251 - SendDlgItemMessage(hWnd, IDC_PIXELFOGMODE, CB_SETCURSEL, D3DFOG_NONE, 0);
2252 - SendDlgItemMessage(hWnd, IDC_FOGSTART, WM_SETTEXT, 0, (LPARAM)_T("0.0"));
2253 - SendDlgItemMessage(hWnd, IDC_FOGEND, WM_SETTEXT, 0, (LPARAM)_T("1.0"));
2254 - SendDlgItemMessage(hWnd, IDC_FOGDENSITY, WM_SETTEXT, 0, (LPARAM)_T("1.0"));
2255 - SendDlgItemMessage(hWnd, IDC_SPINSTAGE, UDM_SETRANGE32, 0, 7);
2256 - SendDlgItemMessage(hWnd, IDC_SPINALPHAREF, UDM_SETRANGE32, 0, 255);
2257 - ::width = ddsd.dwWidth;
2258 - ::height = ddsd.dwHeight;
2259 - StartTimer(hWnd, WM_APP, 60);
2260 - break;
2261 - case WM_COMMAND:
2262 - switch (LOWORD(wParam))
2263 - {
2264 - case IDC_TEXSTAGE:
2265 - if (HIWORD(wParam) == EN_CHANGE)
2266 - {
2267 - SendDlgItemMessage(hWnd, IDC_TEXSTAGE, WM_GETTEXT, MAX_PATH, (LPARAM)tmpstring);
2268 - number = _ttoi(tmpstring);
2269 - if (number < 0) SendDlgItemMessage(hWnd, IDC_TEXSTAGE, WM_SETTEXT, 0, (LPARAM)_T("0"));
2270 - if (number > 7) SendDlgItemMessage(hWnd, IDC_TEXSTAGE, WM_SETTEXT, 0, (LPARAM)_T("7"));
2271 - if (number < 0) number = 0;
2272 - if (number > 7) number = 7;
2273 - texshaderstate.currentstage = number;
2274 - _itot(texshaderstate.texstages[number].keycolor, tmpstring, 16);
2275 - strupper(tmpstring);
2276 - paddwordzeroes(tmpstring);
2277 - if (texshaderstate.texstages[number].colorkey == FALSE) tmpstring[0] = 0;
2278 - SendDlgItemMessage(hWnd, IDC_TEXCOLORKEY, WM_SETTEXT, 0, (LPARAM)tmpstring);
2279 - SendDlgItemMessage(hWnd, IDC_TEXTURE, CB_SETCURSEL, texshaderstate.texstages[number].texturetype, 0);
2280 - SendDlgItemMessage(hWnd, IDC_TEXTUREFILE, WM_SETTEXT, 0, (LPARAM)texshaderstate.texstages[number].texturefile);
2281 - SendDlgItemMessage(hWnd, IDC_CARG1, CB_SETCURSEL, texshaderstate.texstages[number].colorarg1 & D3DTA_SELECTMASK, 0);
2282 - SendDlgItemMessage(hWnd, IDC_CARG2, CB_SETCURSEL, texshaderstate.texstages[number].colorarg2 & D3DTA_SELECTMASK, 0);
2283 - SendDlgItemMessage(hWnd, IDC_AARG1, CB_SETCURSEL, texshaderstate.texstages[number].alphaarg1 & D3DTA_SELECTMASK, 0);
2284 - SendDlgItemMessage(hWnd, IDC_AARG2, CB_SETCURSEL, texshaderstate.texstages[number].alphaarg2 & D3DTA_SELECTMASK, 0);
2285 - if (texshaderstate.texstages[number].colorarg1 & D3DTA_ALPHAREPLICATE)
2286 - SendDlgItemMessage(hWnd, IDC_CARG1A, BM_SETCHECK, BST_CHECKED, 0);
2287 - else SendDlgItemMessage(hWnd, IDC_CARG1A, BM_SETCHECK, BST_UNCHECKED, 0);
2288 - if (texshaderstate.texstages[number].colorarg2 & D3DTA_ALPHAREPLICATE)
2289 - SendDlgItemMessage(hWnd, IDC_CARG2A, BM_SETCHECK, BST_CHECKED, 0);
2290 - else SendDlgItemMessage(hWnd, IDC_CARG2A, BM_SETCHECK, BST_UNCHECKED, 0);
2291 - if (texshaderstate.texstages[number].alphaarg1 & D3DTA_ALPHAREPLICATE)
2292 - SendDlgItemMessage(hWnd, IDC_AARG1A, BM_SETCHECK, BST_CHECKED, 0);
2293 - else SendDlgItemMessage(hWnd, IDC_AARG1A, BM_SETCHECK, BST_UNCHECKED, 0);
2294 - if (texshaderstate.texstages[number].alphaarg2 & D3DTA_ALPHAREPLICATE)
2295 - SendDlgItemMessage(hWnd, IDC_AARG2A, BM_SETCHECK, BST_CHECKED, 0);
2296 - else SendDlgItemMessage(hWnd, IDC_AARG2A, BM_SETCHECK, BST_UNCHECKED, 0);
2297 - if (texshaderstate.texstages[number].colorarg1 & D3DTA_COMPLEMENT)
2298 - SendDlgItemMessage(hWnd, IDC_CARG1INV, BM_SETCHECK, BST_CHECKED, 0);
2299 - else SendDlgItemMessage(hWnd, IDC_CARG1INV, BM_SETCHECK, BST_UNCHECKED, 0);
2300 - if (texshaderstate.texstages[number].colorarg2 & D3DTA_COMPLEMENT)
2301 - SendDlgItemMessage(hWnd, IDC_CARG2INV, BM_SETCHECK, BST_CHECKED, 0);
2302 - else SendDlgItemMessage(hWnd, IDC_CARG2INV, BM_SETCHECK, BST_UNCHECKED, 0);
2303 - if (texshaderstate.texstages[number].alphaarg1 & D3DTA_COMPLEMENT)
2304 - SendDlgItemMessage(hWnd, IDC_AARG1INV, BM_SETCHECK, BST_CHECKED, 0);
2305 - else SendDlgItemMessage(hWnd, IDC_AARG1INV, BM_SETCHECK, BST_UNCHECKED, 0);
2306 - if (texshaderstate.texstages[number].alphaarg2 & D3DTA_COMPLEMENT)
2307 - SendDlgItemMessage(hWnd, IDC_AARG2INV, BM_SETCHECK, BST_CHECKED, 0);
2308 - else SendDlgItemMessage(hWnd, IDC_AARG2INV, BM_SETCHECK, BST_UNCHECKED, 0);
2309 - SendDlgItemMessage(hWnd, IDC_COLOROP, CB_SETCURSEL, texshaderstate.texstages[number].colorop - 1, 0);
2310 - SendDlgItemMessage(hWnd, IDC_ALPHAOP, CB_SETCURSEL, texshaderstate.texstages[number].alphaop - 1, 0);
2311 - }
2312 - break;
2313 - case IDC_TEXTURE:
2314 - if (HIWORD(wParam) == CBN_SELCHANGE)
2315 - {
2316 - number = texshaderstate.currentstage;
2317 - texshaderstate.texstages[number].texturetype =
2318 - SendDlgItemMessage(hWnd, IDC_TEXTURE, CB_GETCURSEL, 0, 0);
2319 - SelectTexture(&texshaderstate.texstages[number].texture, texshaderstate.texstages[number].texturetype,
2320 - texshaderstate.texstages[number].keycolor, texshaderstate.texstages[number].colorkey,
2321 - texshaderstate.texstages[number].texturefile);
2322 - }
2323 - break;
2324 - case IDC_TEXTUREFILE:
2325 - if (HIWORD(wParam) == EN_KILLFOCUS)
2326 - {
2327 - number = texshaderstate.currentstage;
2328 - SendDlgItemMessage(hWnd, IDC_TEXTUREFILE, WM_GETTEXT, MAX_PATH + 1,
2329 - (LPARAM)texshaderstate.texstages[number].texturefile);
2330 - SelectTexture(&texshaderstate.texstages[number].texture, texshaderstate.texstages[number].texturetype,
2331 - texshaderstate.texstages[number].keycolor, texshaderstate.texstages[number].colorkey,
2332 - texshaderstate.texstages[number].texturefile);
2333 - }
2334 - break;
2335 - case IDC_CARG1:
2336 - if (HIWORD(wParam) == CBN_SELCHANGE)
2337 - {
2338 - number = texshaderstate.currentstage;
2339 - SetShaderArg(hWnd, IDC_CARG1, IDC_CARG1A, IDC_CARG1INV, &texshaderstate.texstages[number].colorarg1);
2340 - d3d7dev->SetTextureStageState(number, D3DTSS_COLORARG1, texshaderstate.texstages[number].colorarg1);
2341 - }
2342 - break;
2343 - case IDC_CARG1A:
2344 - case IDC_CARG1INV:
2345 - if (HIWORD(wParam) == BN_CLICKED)
2346 - {
2347 - number = texshaderstate.currentstage;
2348 - SetShaderArg(hWnd, IDC_CARG1, IDC_CARG1A, IDC_CARG1INV, &texshaderstate.texstages[number].colorarg2);
2349 - d3d7dev->SetTextureStageState(number, D3DTSS_COLORARG1, texshaderstate.texstages[number].colorarg2);
2350 - }
2351 - break;
2352 - case IDC_CARG2:
2353 - if (HIWORD(wParam) == CBN_SELCHANGE)
2354 - {
2355 - number = texshaderstate.currentstage;
2356 - SetShaderArg(hWnd, IDC_CARG2, IDC_CARG2A, IDC_CARG2INV, &texshaderstate.texstages[number].colorarg2);
2357 - d3d7dev->SetTextureStageState(number, D3DTSS_COLORARG2, texshaderstate.texstages[number].colorarg2);
2358 - }
2359 - break;
2360 - case IDC_CARG2A:
2361 - case IDC_CARG2INV:
2362 - if (HIWORD(wParam) == BN_CLICKED)
2363 - {
2364 - number = texshaderstate.currentstage;
2365 - SetShaderArg(hWnd, IDC_CARG2, IDC_CARG2A, IDC_CARG2INV, &texshaderstate.texstages[number].colorarg1);
2366 - d3d7dev->SetTextureStageState(number, D3DTSS_COLORARG2, texshaderstate.texstages[number].colorarg1);
2367 - }
2368 - break;
2369 - case IDC_AARG1:
2370 - if (HIWORD(wParam) == CBN_SELCHANGE)
2371 - {
2372 - number = texshaderstate.currentstage;
2373 - SetShaderArg(hWnd, IDC_AARG1, IDC_AARG1A, IDC_AARG1INV, &texshaderstate.texstages[number].alphaarg1);
2374 - d3d7dev->SetTextureStageState(number, D3DTSS_ALPHAARG1, texshaderstate.texstages[number].alphaarg1);
2375 - }
2376 - break;
2377 - case IDC_AARG1A:
2378 - case IDC_AARG1INV:
2379 - if (HIWORD(wParam) == BN_CLICKED)
2380 - {
2381 - number = texshaderstate.currentstage;
2382 - SetShaderArg(hWnd, IDC_AARG1, IDC_AARG1A, IDC_AARG1INV, &texshaderstate.texstages[number].alphaarg1);
2383 - d3d7dev->SetTextureStageState(number, D3DTSS_ALPHAARG1, texshaderstate.texstages[number].alphaarg1);
2384 - }
2385 - break;
2386 - case IDC_AARG2:
2387 - if (HIWORD(wParam) == CBN_SELCHANGE)
2388 - {
2389 - number = texshaderstate.currentstage;
2390 - SetShaderArg(hWnd, IDC_AARG2, IDC_AARG2A, IDC_AARG2INV, &texshaderstate.texstages[number].alphaarg2);
2391 - d3d7dev->SetTextureStageState(number, D3DTSS_ALPHAARG2, texshaderstate.texstages[number].alphaarg2);
2392 - }
2393 - break;
2394 - case IDC_AARG2A:
2395 - case IDC_AARG2INV:
2396 - if (HIWORD(wParam) == BN_CLICKED)
2397 - {
2398 - number = texshaderstate.currentstage;
2399 - SetShaderArg(hWnd, IDC_AARG2, IDC_AARG2A, IDC_AARG2INV, &texshaderstate.texstages[number].alphaarg2);
2400 - d3d7dev->SetTextureStageState(number, D3DTSS_ALPHAARG2, texshaderstate.texstages[number].alphaarg2);
2401 - }
2402 - break;
2403 - case IDC_COLOROP:
2404 - if (HIWORD(wParam) == CBN_SELCHANGE)
2405 - {
2406 - number = texshaderstate.currentstage;
2407 - texshaderstate.texstages[number].colorop = (D3DTEXTUREOP)(SendDlgItemMessage(hWnd, IDC_COLOROP, CB_GETCURSEL, 0, 0) + 1);
2408 - d3d7dev->SetTextureStageState(number, D3DTSS_COLOROP, texshaderstate.texstages[number].colorop);
2409 - }
2410 - break;
2411 - case IDC_ALPHAOP:
2412 - if (HIWORD(wParam) == CBN_SELCHANGE)
2413 - {
2414 - number = texshaderstate.currentstage;
2415 - texshaderstate.texstages[number].alphaop = (D3DTEXTUREOP)(SendDlgItemMessage(hWnd, IDC_ALPHAOP, CB_GETCURSEL, 0, 0) + 1);
2416 - d3d7dev->SetTextureStageState(number, D3DTSS_ALPHAOP, texshaderstate.texstages[number].alphaop);
2417 - }
2418 - break;
2419 - case IDC_BGCOLOR:
2420 - if (HIWORD(wParam) == EN_CHANGE)
2421 - {
2422 - SendDlgItemMessage(hWnd, IDC_BGCOLOR, WM_GETTEXT, MAX_PATH, (LPARAM)tmpstring);
2423 - if (!_stscanf(tmpstring, _T("%x"), &bgcolor)) bgcolor = 0;
2424 - }
2425 - break;
2426 - case IDC_DIFFUSE:
2427 - if (HIWORD(wParam) == EN_CHANGE)
2428 - {
2429 - SendDlgItemMessage(hWnd, IDC_DIFFUSE, WM_GETTEXT, MAX_PATH, (LPARAM)tmpstring);
2430 - if (!_stscanf(tmpstring, _T("%x"), &number)) number = 0;
2431 - SetVertexColor(litvertices, colorvertices, numpoints, number);
2432 - }
2433 - break;
2434 - case IDC_SPECULAR:
2435 - if (HIWORD(wParam) == EN_CHANGE)
2436 - {
2437 - SendDlgItemMessage(hWnd, IDC_SPECULAR, WM_GETTEXT, MAX_PATH, (LPARAM)tmpstring);
2438 - if (!_stscanf(tmpstring, _T("%x"), &number)) number = 0;
2439 - SetVertexSpecular(litvertices, colorvertices, numpoints, number);
2440 - }
2441 - break;
2442 - case IDC_FACTOR:
2443 - if (HIWORD(wParam) == EN_CHANGE)
2444 - {
2445 - SendDlgItemMessage(hWnd, IDC_FACTOR, WM_GETTEXT, MAX_PATH, (LPARAM)tmpstring);
2446 - if (!_stscanf(tmpstring, _T("%x"), &number)) number = 0;
2447 - d3d7dev->SetRenderState(D3DRENDERSTATE_TEXTUREFACTOR, number);
2448 - }
2449 - break;
2450 - case IDC_FOGCOLOR:
2451 - if (HIWORD(wParam) == EN_CHANGE)
2452 - {
2453 - SendDlgItemMessage(hWnd, IDC_FOGCOLOR, WM_GETTEXT, MAX_PATH, (LPARAM)tmpstring);
2454 - if (!_stscanf(tmpstring, _T("%x"), &number)) number = 0;
2455 - d3d7dev->SetRenderState(D3DRENDERSTATE_FOGCOLOR, number);
2456 - }
2457 - break;
2458 - case IDC_TEXCOLORKEY:
2459 - if (HIWORD(wParam) == EN_CHANGE)
2460 - {
2461 - SendDlgItemMessage(hWnd, IDC_TEXCOLORKEY, WM_GETTEXT, MAX_PATH, (LPARAM)tmpstring);
2462 - number = texshaderstate.currentstage;
2463 - if (tmpstring[0] == 0)
2464 - {
2465 - texshaderstate.texstages[number].colorkey = FALSE;
2466 - texshaderstate.texstages[number].keycolor = 0;
2467 - }
2468 - else
2469 - {
2470 - texshaderstate.texstages[number].colorkey = TRUE;
2471 - if (!_stscanf(tmpstring, _T("%x"), &texshaderstate.texstages[number].keycolor))
2472 - texshaderstate.texstages[number].keycolor = 0;
2473 - }
2474 - SelectTexture(&texshaderstate.texstages[number].texture, texshaderstate.texstages[number].texturetype,
2475 - texshaderstate.texstages[number].keycolor, texshaderstate.texstages[number].colorkey,
2476 - texshaderstate.texstages[number].texturefile);
2477 - }
2478 - case IDC_ALPHABLEND:
2479 - if (HIWORD(wParam) == BN_CLICKED)
2480 - {
2481 - if (SendDlgItemMessage(hWnd, IDC_ALPHABLEND, BM_GETCHECK, 0, 0) == BST_CHECKED)
2482 - d3d7dev->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, TRUE);
2483 - else d3d7dev->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, FALSE);
2484 - }
2485 - break;
2486 - case IDC_SRCBLEND:
2487 - if (HIWORD(wParam) == CBN_SELCHANGE)
2488 - {
2489 - d3d7dev->SetRenderState(D3DRENDERSTATE_SRCBLEND, SendDlgItemMessage(hWnd,
2490 - IDC_SRCBLEND, CB_GETCURSEL, 0, 0) + 1);
2491 - }
2492 - case IDC_DESTBLEND:
2493 - if (HIWORD(wParam) == CBN_SELCHANGE)
2494 - {
2495 - d3d7dev->SetRenderState(D3DRENDERSTATE_DESTBLEND, SendDlgItemMessage(hWnd,
2496 - IDC_DESTBLEND, CB_GETCURSEL, 0, 0) + 1);
2497 - }
2498 - break;
2499 - case IDC_ALPHATEST:
2500 - if (HIWORD(wParam) == BN_CLICKED)
2501 - {
2502 - if (SendDlgItemMessage(hWnd, IDC_ALPHATEST, BM_GETCHECK, 0, 0) == BST_CHECKED)
2503 - d3d7dev->SetRenderState(D3DRENDERSTATE_ALPHATESTENABLE, TRUE);
2504 - else d3d7dev->SetRenderState(D3DRENDERSTATE_ALPHATESTENABLE, FALSE);
2505 - }
2506 - case IDC_ALPHAFUNC:
2507 - if (HIWORD(wParam) == CBN_SELCHANGE)
2508 - {
2509 - d3d7dev->SetRenderState(D3DRENDERSTATE_ALPHAFUNC, SendDlgItemMessage(hWnd,
2510 - IDC_ALPHAFUNC, CB_GETCURSEL, 0, 0) + 1);
2511 - }
2512 - break;
2513 - case IDC_ALPHAREF:
2514 - if (HIWORD(wParam) == EN_CHANGE)
2515 - {
2516 - SendDlgItemMessage(hWnd, IDC_ALPHAREF, WM_GETTEXT, MAX_PATH, (LPARAM)tmpstring);
2517 - number = _ttoi(tmpstring);
2518 - if (number < 0) SendDlgItemMessage(hWnd, IDC_ALPHAREF, WM_SETTEXT, 0, (LPARAM)_T("0"));
2519 - if (number > 255) SendDlgItemMessage(hWnd, IDC_ALPHAREF, WM_SETTEXT, 0, (LPARAM)_T("255"));
2520 - if (number < 0) number = 0;
2521 - if (number > 255) number = 255;
2522 - if (d3d7dev) d3d7dev->SetRenderState(D3DRENDERSTATE_ALPHAREF, number);
2523 - }
2524 - case IDC_COLORKEY:
2525 - if (HIWORD(wParam) == BN_CLICKED)
2526 - {
2527 - if (SendDlgItemMessage(hWnd, IDC_COLORKEY, BM_GETCHECK, 0, 0) == BST_CHECKED)
2528 - d3d7dev->SetRenderState(D3DRENDERSTATE_COLORKEYENABLE, TRUE);
2529 - else d3d7dev->SetRenderState(D3DRENDERSTATE_COLORKEYENABLE, FALSE);
2530 - }
2531 - break;
2532 - case IDC_FOGENABLE:
2533 - if (HIWORD(wParam) == BN_CLICKED)
2534 - {
2535 - if (SendDlgItemMessage(hWnd, IDC_FOGENABLE, BM_GETCHECK, 0, 0) == BST_CHECKED)
2536 - d3d7dev->SetRenderState(D3DRENDERSTATE_FOGENABLE, TRUE);
2537 - else d3d7dev->SetRenderState(D3DRENDERSTATE_FOGENABLE, FALSE);
2538 - }
2539 - break;
2540 - case IDC_VERTEXFOGMODE:
2541 - if (HIWORD(wParam) == CBN_SELCHANGE)
2542 - {
2543 - d3d7dev->SetRenderState(D3DRENDERSTATE_FOGVERTEXMODE, SendDlgItemMessage(hWnd,
2544 - IDC_VERTEXFOGMODE, CB_GETCURSEL, 0, 0));
2545 - }
2546 - break;
2547 - case IDC_PIXELFOGMODE:
2548 - if (HIWORD(wParam) == CBN_SELCHANGE)
2549 - {
2550 - d3d7dev->SetRenderState(D3DRENDERSTATE_FOGTABLEMODE, SendDlgItemMessage(hWnd,
2551 - IDC_PIXELFOGMODE, CB_GETCURSEL, 0, 0));
2552 - }
2553 - break;
2554 - case IDC_FOGSTART:
2555 - if (HIWORD(wParam) == EN_CHANGE)
2556 - {
2557 - SendDlgItemMessage(hWnd, IDC_FOGSTART, WM_GETTEXT, MAX_PATH, (LPARAM)tmpstring);
2558 - f = (float)_ttof(tmpstring);
2559 - d3d7dev->SetRenderState(D3DRENDERSTATE_FOGSTART, *((LPDWORD)(&f)));
2560 - }
2561 - break;
2562 - case IDC_FOGEND:
2563 - if (HIWORD(wParam) == EN_CHANGE)
2564 - {
2565 - SendDlgItemMessage(hWnd, IDC_FOGEND, WM_GETTEXT, MAX_PATH, (LPARAM)tmpstring);
2566 - f = (float)_ttof(tmpstring);
2567 - d3d7dev->SetRenderState(D3DRENDERSTATE_FOGEND, *((LPDWORD)(&f)));
2568 - }
2569 - break;
2570 - case IDC_FOGDENSITY:
2571 - if (HIWORD(wParam) == EN_CHANGE)
2572 - {
2573 - SendDlgItemMessage(hWnd, IDC_FOGDENSITY, WM_GETTEXT, MAX_PATH, (LPARAM)tmpstring);
2574 - f = (float)_ttof(tmpstring);
2575 - d3d7dev->SetRenderState(D3DRENDERSTATE_FOGDENSITY, *((LPDWORD)(&f)));
2576 - }
2577 - break;
2578 - case IDCANCEL:
2579 - SendMessage(hWnd, WM_CLOSE, 0, 0);
2580 - break;
2581 - default:
2582 - return FALSE;
2583 - }
2584 - break;
2585 - case WM_CLOSE:
2586 - StopTimer();
2587 - if (d3d7dev)
2588 - {
2589 - d3d7dev->Release();
2590 - d3d7dev = NULL;
2591 - }
2592 - if (d3d7)
2593 - {
2594 - d3d7->Release();
2595 - d3d7dev = NULL;
2596 - }
2597 - if (ddsrender)
2598 - {
2599 - ddsrender->Release();
2600 - ddsrender = NULL;
2601 - }
2602 - if (ddsurface)
2603 - {
2604 - ddsurface->Release();
2605 - ddsurface = NULL;
2606 - }
2607 - if (zbuffer)
2608 - {
2609 - zbuffer->Release();
2610 - zbuffer = NULL;
2611 - }
2612 - if (ddclipper)
2613 - {
2614 - ddclipper->Release();
2615 - ddclipper = NULL;
2616 - }
2617 - if (ddinterface)
2618 - {
2619 - ddinterface->Release();
2620 - ddinterface = NULL;
2621 - }
2622 - if (mesh)
2623 - {
2624 - free(mesh);
2625 - mesh = NULL;
2626 - }
2627 - if (vertices)
2628 - {
2629 - free(vertices);
2630 - vertices = NULL;
2631 - }
2632 - if (litvertices)
2633 - {
2634 - free(litvertices);
2635 - litvertices = NULL;
2636 - }
2637 - if (colorvertices)
2638 - {
2639 - free(colorvertices);
2640 - colorvertices = NULL;
2641 - }
2642 - EndDialog(hWnd, IDCANCEL);
2643 - break;
2644 - case WM_APP:
2645 - RunTestTimed(testnum);
2646 - break;
2647 - default:
2648 - return FALSE;
2649 - }
2650 - return TRUE;
2651 -
2652 -
2653 -}
2654 -
2655 -INT_PTR CALLBACK VertexShader7Proc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
2656 -{
2657 - HRESULT error;
2658 - D3DVIEWPORT7 vp;
2659 - HWND hDisplay;
2660 - int number;
2661 - float f;
2662 - TCHAR tmpstring[MAX_PATH + 1];
2663 - switch (Msg)
2664 - {
2665 - case WM_INITDIALOG:
2666 - RECT r;
2667 - DDSCAPS2 caps;
2668 - DDSURFACEDESC2 ddsd;
2669 - DDPIXELFORMAT ddpfz;
2670 - testnum = 15;
2671 - ddinterface = new MultiDirectDraw(7, &error, NULL);
2672 - hDisplay = GetDlgItem(hWnd, IDC_DISPLAY);
2673 - ::hWnd = hDisplay;
2674 - error = ddinterface->SetCooperativeLevel(hDisplay, DDSCL_NORMAL);
2675 - ZeroMemory(&ddsd, sizeof(DDSURFACEDESC2));
2676 - ddsd.dwSize = sizeof(DDSURFACEDESC2);
2677 - ddsd.dwFlags = DDSD_CAPS;
2678 - ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE;
2679 - error = ddinterface->CreateSurface(&ddsd, &ddsurface, NULL);
2680 - error = ddinterface->CreateClipper(0, &ddclipper, NULL);
2681 - error = ddclipper->SetHWnd(0, hDisplay);
2682 - error = ddsurface->SetClipper(ddclipper);
2683 - ZeroMemory(&ddsd, sizeof(DDSURFACEDESC2));
2684 - ddsd.dwSize = sizeof(DDSURFACEDESC2);
2685 - ddsd.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH;
2686 - ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE;
2687 - GetClientRect(hDisplay, &r);
2688 - ddsd.dwWidth = r.right;
2689 - ddsd.dwHeight = r.bottom;
2690 - error = ddinterface->CreateSurface(&ddsd, &ddsrender, NULL);
2691 - error = ddinterface->QueryInterface(IID_IDirect3D7, (VOID**)&d3d7);
2692 - error = d3d7->EnumZBufferFormats(IID_IDirect3DRGBDevice, zcallback, &ddpfz);
2693 - error = ddsrender->GetSurfaceDesc(&ddsd);
2694 - ddsd.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT | DDSD_PIXELFORMAT;
2695 - ddsd.ddsCaps.dwCaps = DDSCAPS_ZBUFFER | DDSCAPS_VIDEOMEMORY;
2696 - memcpy(&ddsd.ddpfPixelFormat, &ddpfz, sizeof(DDPIXELFORMAT));
2697 - error = ddinterface->CreateSurface(&ddsd, &zbuffer, NULL);
2698 - error = ddsrender->AddAttachedSurface(zbuffer);
2699 - error = d3d7->CreateDevice(IID_IDirect3DHALDevice, (LPDIRECTDRAWSURFACE7)ddsrender->GetSurface(), &d3d7dev);
2700 - if (error != D3D_OK)
2701 - error = d3d7->CreateDevice(IID_IDirect3DRGBDevice, (LPDIRECTDRAWSURFACE7)ddsrender->GetSurface(), &d3d7dev);
2702 - ddsrender->GetSurfaceDesc(&ddsd);
2703 - vp.dvMaxZ = 1.0f;
2704 - vp.dvMinZ = 0.0f;
2705 - vp.dwX = vp.dwY = 0;
2706 - vp.dwWidth = ddsd.dwWidth;
2707 - vp.dwHeight = ddsd.dwHeight;
2708 - error = d3d7dev->SetViewport(&vp);
2709 - error = d3d7dev->SetRenderState(D3DRENDERSTATE_ZENABLE, TRUE);
2710 - InitTest(15);
2711 - SendDlgItemMessage(hWnd, IDC_TEXTURE, CB_ADDSTRING, 0, (LPARAM)_T("None"));
2712 - SendDlgItemMessage(hWnd, IDC_TEXTURE, CB_ADDSTRING, 0, (LPARAM)_T("Gradients"));
2713 - SendDlgItemMessage(hWnd, IDC_TEXTURE, CB_ADDSTRING, 0, (LPARAM)_T("DXGL logo (small)"));
2714 - SendDlgItemMessage(hWnd, IDC_TEXTURE, CB_ADDSTRING, 0, (LPARAM)_T("DXGL logo (large)"));
2715 - SendDlgItemMessage(hWnd, IDC_TEXTURE, CB_ADDSTRING, 0, (LPARAM)_T("Texture file"));
2716 - SendDlgItemMessage(hWnd, IDC_TEXTURE, CB_SETCURSEL, 0, 0);
2717 - SendDlgItemMessage(hWnd, IDC_DIFFUSE, WM_SETTEXT, 0, (LPARAM)_T("FFFFFFFF"));
2718 - SendDlgItemMessage(hWnd, IDC_SPECULAR, WM_SETTEXT, 0, (LPARAM)_T("00000000"));
2719 - SendDlgItemMessage(hWnd, IDC_FACTOR, WM_SETTEXT, 0, (LPARAM)_T("00000000"));
2720 - SendDlgItemMessage(hWnd, IDC_FOGCOLOR, WM_SETTEXT, 0, (LPARAM)_T("00000000"));
2721 - SendDlgItemMessage(hWnd, IDC_BGCOLOR, WM_SETTEXT, 0, (LPARAM)_T("00000000"));
2722 - SendDlgItemMessage(hWnd, IDC_AMBIENT, WM_SETTEXT, 0, (LPARAM)_T("FFFFFFFF"));
2723 - SendDlgItemMessage(hWnd, IDC_EMISSIVE, WM_SETTEXT, 0, (LPARAM)_T("00000000"));
2724 - SendDlgItemMessage(hWnd, IDC_MATAMBIENT, WM_SETTEXT, 0, (LPARAM)_T("FFFFFFFF"));
2725 - SendDlgItemMessage(hWnd, IDC_MATDIFFUSE, WM_SETTEXT, 0, (LPARAM)_T("FFFFFFFF"));
2726 - SendDlgItemMessage(hWnd, IDC_MATSPECULAR, WM_SETTEXT, 0, (LPARAM)_T("00000000"));
2727 - PopulateFogCombo(GetDlgItem(hWnd, IDC_VERTEXFOGMODE));
2728 - PopulateFogCombo(GetDlgItem(hWnd, IDC_PIXELFOGMODE));
2729 - SendDlgItemMessage(hWnd, IDC_VERTEXFOGMODE, CB_SETCURSEL, D3DFOG_NONE, 0);
2730 - SendDlgItemMessage(hWnd, IDC_PIXELFOGMODE, CB_SETCURSEL, D3DFOG_NONE, 0);
2731 - SendDlgItemMessage(hWnd, IDC_FOGSTART, WM_SETTEXT, 0, (LPARAM)_T("0.0"));
2732 - SendDlgItemMessage(hWnd, IDC_FOGEND, WM_SETTEXT, 0, (LPARAM)_T("1.0"));
2733 - SendDlgItemMessage(hWnd, IDC_FOGDENSITY, WM_SETTEXT, 0, (LPARAM)_T("1.0"));
2734 - SendDlgItemMessage(hWnd, IDC_FILLMODE, CB_ADDSTRING, 0, (LPARAM)_T("Points"));
2735 - SendDlgItemMessage(hWnd, IDC_FILLMODE, CB_ADDSTRING, 0, (LPARAM)_T("Wireframe"));
2736 - SendDlgItemMessage(hWnd, IDC_FILLMODE, CB_ADDSTRING, 0, (LPARAM)_T("Solid"));
2737 - SendDlgItemMessage(hWnd, IDC_FILLMODE, CB_SETCURSEL, 2, 0);
2738 - SendDlgItemMessage(hWnd, IDC_SHADEMODE, CB_ADDSTRING, 0, (LPARAM)_T("Flat"));
2739 - SendDlgItemMessage(hWnd, IDC_SHADEMODE, CB_ADDSTRING, 0, (LPARAM)_T("Gouraud"));
2740 - SendDlgItemMessage(hWnd, IDC_SHADEMODE, CB_ADDSTRING, 0, (LPARAM)_T("Phong"));
2741 - SendDlgItemMessage(hWnd, IDC_SHADEMODE, CB_SETCURSEL, 1, 0);
2742 - SendDlgItemMessage(hWnd, IDC_CULLMODE, CB_ADDSTRING, 0, (LPARAM)_T("None"));
2743 - SendDlgItemMessage(hWnd, IDC_CULLMODE, CB_ADDSTRING, 0, (LPARAM)_T("CW"));
2744 - SendDlgItemMessage(hWnd, IDC_CULLMODE, CB_ADDSTRING, 0, (LPARAM)_T("CCW"));
2745 - SendDlgItemMessage(hWnd, IDC_CULLMODE, CB_SETCURSEL, 2, 0);
2746 - SendDlgItemMessage(hWnd, IDC_VERTEXCOLOR, BM_SETCHECK, BST_CHECKED, 0);
2747 - PopulateSourceCombo(GetDlgItem(hWnd, IDC_DIFFUSESOURCE));
2748 - PopulateSourceCombo(GetDlgItem(hWnd, IDC_SPECULARSOURCE));
2749 - PopulateSourceCombo(GetDlgItem(hWnd, IDC_AMBIENTSOURCE));
2750 - PopulateSourceCombo(GetDlgItem(hWnd, IDC_EMISSIVESOURCE));
2751 - SendDlgItemMessage(hWnd, IDC_DIFFUSESOURCE, CB_SETCURSEL, D3DMCS_COLOR1, 0);
2752 - SendDlgItemMessage(hWnd, IDC_SPECULARSOURCE, CB_SETCURSEL, D3DMCS_COLOR2, 0);
2753 - SendDlgItemMessage(hWnd, IDC_AMBIENTSOURCE, CB_SETCURSEL, D3DMCS_MATERIAL, 0);
2754 - SendDlgItemMessage(hWnd, IDC_EMISSIVESOURCE, CB_SETCURSEL, D3DMCS_MATERIAL, 0);
2755 - SendDlgItemMessage(hWnd, IDC_SPINDETAIL, UDM_SETRANGE32, 2, 64);
2756 - SendDlgItemMessage(hWnd, IDC_SPINDETAIL, UDM_SETPOS32, 0, 8);
2757 - SendDlgItemMessage(hWnd, IDC_SPINLIGHT, UDM_SETRANGE32, 0, 7);
2758 - SendDlgItemMessage(hWnd, IDC_LIGHTDIFFUSE, WM_SETTEXT, 0, (LPARAM)_T("00FFFFFF"));
2759 - SendDlgItemMessage(hWnd, IDC_LIGHTAMBIENT, WM_SETTEXT, 0, (LPARAM)_T("00000000"));
2760 - SendDlgItemMessage(hWnd, IDC_LIGHTSPECULAR, WM_SETTEXT, 0, (LPARAM)_T("00000000"));
2761 - SendDlgItemMessage(hWnd, IDC_LIGHTRANGE, WM_SETTEXT, 0, (LPARAM)_T("0"));
2762 - SendDlgItemMessage(hWnd, IDC_LIGHTFALLOFF, WM_SETTEXT, 0, (LPARAM)_T("0"));
2763 - SendDlgItemMessage(hWnd, IDC_LIGHTTHETA, WM_SETTEXT, 0, (LPARAM)_T("0"));
2764 - SendDlgItemMessage(hWnd, IDC_LIGHTPHI, WM_SETTEXT, 0, (LPARAM)_T("0"));
2765 - SendDlgItemMessage(hWnd, IDC_LIGHTATTEN0, WM_SETTEXT, 0, (LPARAM)_T("0"));
2766 - SendDlgItemMessage(hWnd, IDC_LIGHTATTEN1, WM_SETTEXT, 0, (LPARAM)_T("0"));
2767 - SendDlgItemMessage(hWnd, IDC_LIGHTATTEN2, WM_SETTEXT, 0, (LPARAM)_T("0"));
2768 - SendDlgItemMessage(hWnd, IDC_POWER, WM_SETTEXT, 0, (LPARAM)_T("0"));
2769 - SendDlgItemMessage(hWnd, IDC_LIGHTTYPE, CB_ADDSTRING, 0, (LPARAM)_T("Point"));
2770 - SendDlgItemMessage(hWnd, IDC_LIGHTTYPE, CB_ADDSTRING, 0, (LPARAM)_T("Spot"));
2771 - SendDlgItemMessage(hWnd, IDC_LIGHTTYPE, CB_ADDSTRING, 0, (LPARAM)_T("Directional"));
2772 - SendDlgItemMessage(hWnd, IDC_LIGHTTYPE, CB_ADDSTRING, 0, (LPARAM)_T("Parallel Point"));
2773 - SendDlgItemMessage(hWnd, IDC_LIGHTTYPE, CB_ADDSTRING, 0, (LPARAM)_T("GL Spot"));
2774 - SendDlgItemMessage(hWnd, IDC_LIGHTTYPE, CB_SETCURSEL, D3DLIGHT_DIRECTIONAL - 1, 0);
2775 - SendDlgItemMessage(hWnd, IDC_LIGHTENABLED, BM_SETCHECK, BST_CHECKED, 0);
2776 - ::width = ddsd.dwWidth;
2777 - ::height = ddsd.dwHeight;
2778 - vertexshaderstate.texture = NULL;
2779 - vertexshaderstate.texturefile[0] = 0;
2780 - vertexshaderstate.texturetype = 0;
2781 - vertexshaderstate.currentlight = 0;
2782 - StartTimer(hWnd, WM_APP, 60);
2783 - break;
2784 - case WM_COMMAND:
2785 - switch (LOWORD(wParam))
2786 - {
2787 - case IDC_TEXTURE:
2788 - if (HIWORD(wParam) == CBN_SELCHANGE)
2789 - {
2790 - number = texshaderstate.currentstage;
2791 - vertexshaderstate.texturetype =
2792 - SendDlgItemMessage(hWnd, IDC_TEXTURE, CB_GETCURSEL, 0, 0);
2793 - SelectTexture(&vertexshaderstate.texture, vertexshaderstate.texturetype,
2794 - 0, FALSE, vertexshaderstate.texturefile);
2795 - if ((vertexshaderstate.texturetype == 2) || (vertexshaderstate.texturetype == 3))
2796 - d3d7dev->SetTextureStageState(0, D3DTSS_COLOROP, D3DTOP_BLENDTEXTUREALPHAPM);
2797 - else d3d7dev->SetTextureStageState(0, D3DTSS_COLOROP, D3DTOP_MODULATE);
2798 - }
2799 - break;
2800 - case IDC_TEXTUREFILE:
2801 - if (HIWORD(wParam) == EN_KILLFOCUS)
2802 - {
2803 - number = texshaderstate.currentstage;
2804 - SendDlgItemMessage(hWnd, IDC_TEXTUREFILE, WM_GETTEXT, MAX_PATH + 1,
2805 - (LPARAM)vertexshaderstate.texturefile);
2806 - SelectTexture(&vertexshaderstate.texture, vertexshaderstate.texturetype,
2807 - 0, FALSE, vertexshaderstate.texturefile);
2808 - }
2809 - break;
2810 - case IDC_FOGENABLE:
2811 - if (HIWORD(wParam) == BN_CLICKED)
2812 - {
2813 - if (SendDlgItemMessage(hWnd, IDC_FOGENABLE, BM_GETCHECK, 0, 0) == BST_CHECKED)
2814 - d3d7dev->SetRenderState(D3DRENDERSTATE_FOGENABLE, TRUE);
2815 - else d3d7dev->SetRenderState(D3DRENDERSTATE_FOGENABLE, FALSE);
2816 - }
2817 - break;
2818 - case IDC_VERTEXFOGMODE:
2819 - if (HIWORD(wParam) == CBN_SELCHANGE)
2820 - {
2821 - d3d7dev->SetRenderState(D3DRENDERSTATE_FOGVERTEXMODE, SendDlgItemMessage(hWnd,
2822 - IDC_VERTEXFOGMODE, CB_GETCURSEL, 0, 0));
2823 - }
2824 - break;
2825 - case IDC_PIXELFOGMODE:
2826 - if (HIWORD(wParam) == CBN_SELCHANGE)
2827 - {
2828 - d3d7dev->SetRenderState(D3DRENDERSTATE_FOGTABLEMODE, SendDlgItemMessage(hWnd,
2829 - IDC_PIXELFOGMODE, CB_GETCURSEL, 0, 0));
2830 - }
2831 - break;
2832 - case IDC_FOGSTART:
2833 - if (HIWORD(wParam) == EN_CHANGE)
2834 - {
2835 - SendDlgItemMessage(hWnd, IDC_FOGSTART, WM_GETTEXT, MAX_PATH, (LPARAM)tmpstring);
2836 - f = (float)_ttof(tmpstring);
2837 - d3d7dev->SetRenderState(D3DRENDERSTATE_FOGSTART, *((LPDWORD)(&f)));
2838 - }
2839 - break;
2840 - case IDC_FOGEND:
2841 - if (HIWORD(wParam) == EN_CHANGE)
2842 - {
2843 - SendDlgItemMessage(hWnd, IDC_FOGEND, WM_GETTEXT, MAX_PATH, (LPARAM)tmpstring);
2844 - f = (float)_ttof(tmpstring);
2845 - d3d7dev->SetRenderState(D3DRENDERSTATE_FOGEND, *((LPDWORD)(&f)));
2846 - }
2847 - break;
2848 - case IDC_FOGDENSITY:
2849 - if (HIWORD(wParam) == EN_CHANGE)
2850 - {
2851 - SendDlgItemMessage(hWnd, IDC_FOGDENSITY, WM_GETTEXT, MAX_PATH, (LPARAM)tmpstring);
2852 - f = (float)_ttof(tmpstring);
2853 - d3d7dev->SetRenderState(D3DRENDERSTATE_FOGDENSITY, *((LPDWORD)(&f)));
2854 - }
2855 - break;
2856 - case IDC_RANGEBASEDFOG:
2857 - if (HIWORD(wParam) == BN_CLICKED)
2858 - {
2859 - if (SendDlgItemMessage(hWnd, IDC_RANGEBASEDFOG, BM_GETCHECK, 0, 0) == BST_CHECKED)
2860 - d3d7dev->SetRenderState(D3DRENDERSTATE_RANGEFOGENABLE, TRUE);
2861 - else d3d7dev->SetRenderState(D3DRENDERSTATE_RANGEFOGENABLE, FALSE);
2862 - }
2863 - break;
2864 - case IDC_FILLMODE:
2865 - if (HIWORD(wParam) == CBN_SELCHANGE)
2866 - {
2867 - d3d7dev->SetRenderState(D3DRENDERSTATE_FILLMODE, SendDlgItemMessage(hWnd,
2868 - IDC_FILLMODE, CB_GETCURSEL, 0, 0) + 1);
2869 - }
2870 - break;
2871 - case IDC_SHADEMODE:
2872 - if (HIWORD(wParam) == CBN_SELCHANGE)
2873 - {
2874 - d3d7dev->SetRenderState(D3DRENDERSTATE_SHADEMODE, SendDlgItemMessage(hWnd,
2875 - IDC_SHADEMODE, CB_GETCURSEL, 0, 0) + 1);
2876 - }
2877 - break;
2878 - case IDC_CULLMODE:
2879 - if (HIWORD(wParam) == CBN_SELCHANGE)
2880 - {
2881 - d3d7dev->SetRenderState(D3DRENDERSTATE_CULLMODE, SendDlgItemMessage(hWnd,
2882 - IDC_CULLMODE, CB_GETCURSEL, 0, 0) + 1);
2883 - }
2884 - break;
2885 - case IDC_DIFFUSE:
2886 - if (HIWORD(wParam) == EN_CHANGE)
2887 - {
2888 - SendDlgItemMessage(hWnd, IDC_DIFFUSE, WM_GETTEXT, MAX_PATH, (LPARAM)tmpstring);
2889 - if (!_stscanf(tmpstring, _T("%x"), &number)) number = 0;
2890 - SetVertexColor(litvertices, colorvertices, numpoints, number);
2891 - }
2892 - break;
2893 - case IDC_SPECULAR:
2894 - if (HIWORD(wParam) == EN_CHANGE)
2895 - {
2896 - SendDlgItemMessage(hWnd, IDC_SPECULAR, WM_GETTEXT, MAX_PATH, (LPARAM)tmpstring);
2897 - if (!_stscanf(tmpstring, _T("%x"), &number)) number = 0;
2898 - SetVertexSpecular(litvertices, colorvertices, numpoints, number);
2899 - }
2900 - break;
2901 - case IDC_FACTOR:
2902 - if (HIWORD(wParam) == EN_CHANGE)
2903 - {
2904 - SendDlgItemMessage(hWnd, IDC_FACTOR, WM_GETTEXT, MAX_PATH, (LPARAM)tmpstring);
2905 - if (!_stscanf(tmpstring, _T("%x"), &number)) number = 0;
2906 - d3d7dev->SetRenderState(D3DRENDERSTATE_TEXTUREFACTOR, number);
2907 - }
2908 - break;
2909 - case IDC_FOGCOLOR:
2910 - if (HIWORD(wParam) == EN_CHANGE)
2911 - {
2912 - SendDlgItemMessage(hWnd, IDC_FOGCOLOR, WM_GETTEXT, MAX_PATH, (LPARAM)tmpstring);
2913 - if (!_stscanf(tmpstring, _T("%x"), &number)) number = 0;
2914 - d3d7dev->SetRenderState(D3DRENDERSTATE_FOGCOLOR, number);
2915 - }
2916 - break;
2917 - case IDC_BGCOLOR:
2918 - if (HIWORD(wParam) == EN_CHANGE)
2919 - {
2920 - SendDlgItemMessage(hWnd, IDC_BGCOLOR, WM_GETTEXT, MAX_PATH, (LPARAM)tmpstring);
2921 - if (!_stscanf(tmpstring, _T("%x"), &bgcolor)) bgcolor = 0;
2922 - }
2923 - break;
2924 - case IDC_AMBIENT:
2925 - {
2926 - SendDlgItemMessage(hWnd, IDC_AMBIENT, WM_GETTEXT, MAX_PATH, (LPARAM)tmpstring);
2927 - if (!_stscanf(tmpstring, _T("%x"), &number)) number = 0;
2928 - d3d7dev->SetRenderState(D3DRENDERSTATE_AMBIENT, number);
2929 - }
2930 - break;
2931 - case IDC_EMISSIVE:
2932 - if (HIWORD(wParam) == EN_CHANGE)
2933 - {
2934 - SendDlgItemMessage(hWnd, IDC_EMISSIVE, WM_GETTEXT, MAX_PATH, (LPARAM)tmpstring);
2935 - if (!_stscanf(tmpstring, _T("%x"), &number)) number = 0;
2936 - material.emissive.b = (float)(number & 255) / 255.0;
2937 - material.emissive.g = (float)((number >> 8) & 255) / 255.0;
2938 - material.emissive.r = (float)((number >> 16) & 255) / 255.0;
2939 - material.emissive.a = (float)((number >> 24) & 255) / 255.0;
2940 - d3d7dev->SetMaterial(&material);
2941 - }
2942 - break;
2943 - case IDC_MATAMBIENT:
2944 - if (HIWORD(wParam) == EN_CHANGE)
2945 - {
2946 - SendDlgItemMessage(hWnd, IDC_MATAMBIENT, WM_GETTEXT, MAX_PATH, (LPARAM)tmpstring);
2947 - if (!_stscanf(tmpstring, _T("%x"), &number)) number = 0;
2948 - material.ambient.b = (float)(number & 255) / 255.0;
2949 - material.ambient.g = (float)((number >> 8) & 255) / 255.0;
2950 - material.ambient.r = (float)((number >> 16) & 255) / 255.0;
2951 - material.ambient.a = (float)((number >> 24) & 255) / 255.0;
2952 - d3d7dev->SetMaterial(&material);
2953 - }
2954 - break;
2955 - case IDC_MATDIFFUSE:
2956 - if (HIWORD(wParam) == EN_CHANGE)
2957 - {
2958 - SendDlgItemMessage(hWnd, IDC_MATDIFFUSE, WM_GETTEXT, MAX_PATH, (LPARAM)tmpstring);
2959 - if (!_stscanf(tmpstring, _T("%x"), &number)) number = 0;
2960 - material.diffuse.b = (float)(number & 255) / 255.0;
2961 - material.diffuse.g = (float)((number >> 8) & 255) / 255.0;
2962 - material.diffuse.r = (float)((number >> 16) & 255) / 255.0;
2963 - material.diffuse.a = (float)((number >> 24) & 255) / 255.0;
2964 - d3d7dev->SetMaterial(&material);
2965 - }
2966 - break;
2967 - case IDC_MATSPECULAR:
2968 - if (HIWORD(wParam) == EN_CHANGE)
2969 - {
2970 - SendDlgItemMessage(hWnd, IDC_MATSPECULAR, WM_GETTEXT, MAX_PATH, (LPARAM)tmpstring);
2971 - if (!_stscanf(tmpstring, _T("%x"), &number)) number = 0;
2972 - material.specular.b = (float)(number & 255) / 255.0;
2973 - material.specular.g = (float)((number >> 8) & 255) / 255.0;
2974 - material.specular.r = (float)((number >> 16) & 255) / 255.0;
2975 - material.specular.a = (float)((number >> 24) & 255) / 255.0;
2976 - d3d7dev->SetMaterial(&material);
2977 - }
2978 - break;
2979 - case IDC_POWER:
2980 - if (HIWORD(wParam) == EN_CHANGE)
2981 - {
2982 - SendDlgItemMessage(hWnd, IDC_POWER, WM_GETTEXT, MAX_PATH, (LPARAM)tmpstring);
2983 - material.power = (float)_ttof(tmpstring);
2984 - d3d7dev->SetMaterial(&material);
2985 - }
2986 - break;
2987 - case IDC_ENABLELIGHT:
2988 - if (HIWORD(wParam) == BN_CLICKED)
2989 - {
2990 - if (SendDlgItemMessage(hWnd, IDC_ENABLELIGHT, BM_GETCHECK, 0, 0) == BST_CHECKED)
2991 - {
2992 - d3d7dev->SetRenderState(D3DRENDERSTATE_LIGHTING, TRUE);
2993 - for (int i = 0; i < 8; i++)
2994 - {
2995 - d3d7dev->SetLight(i, &lights[i]);
2996 - d3d7dev->LightEnable(i, lightenable[i]);
2997 - }
2998 - }
2999 - else d3d7dev->SetRenderState(D3DRENDERSTATE_LIGHTING, FALSE);
3000 - }
3001 - break;
3002 - case IDC_VERTEXCOLOR:
3003 - if (HIWORD(wParam) == BN_CLICKED)
3004 - {
3005 - if (SendDlgItemMessage(hWnd, IDC_VERTEXCOLOR, BM_GETCHECK, 0, 0) == BST_CHECKED)
3006 - d3d7dev->SetRenderState(D3DRENDERSTATE_COLORVERTEX, TRUE);
3007 - else d3d7dev->SetRenderState(D3DRENDERSTATE_COLORVERTEX, FALSE);
3008 - }
3009 - break;
3010 - case IDC_DETAIL:
3011 - if (HIWORD(wParam) == EN_CHANGE)
3012 - {
3013 - SendDlgItemMessage(hWnd, IDC_DETAIL, WM_GETTEXT, MAX_PATH, (LPARAM)tmpstring);
3014 - number = _ttoi(tmpstring);
3015 - if (number < 2) SendDlgItemMessage(hWnd, IDC_DETAIL, WM_SETTEXT, 0, (LPARAM)_T("2"));
3016 - if (number > 64) SendDlgItemMessage(hWnd, IDC_DETAIL, WM_SETTEXT, 0, (LPARAM)_T("64"));
3017 - MakeCube3D(5, number);
3018 - }
3019 - break;
3020 - case IDC_DIFFUSESOURCE:
3021 - if (HIWORD(wParam) == CBN_SELCHANGE)
3022 - {
3023 - d3d7dev->SetRenderState(D3DRENDERSTATE_DIFFUSEMATERIALSOURCE, SendDlgItemMessage(hWnd,
3024 - IDC_DIFFUSESOURCE, CB_GETCURSEL, 0, 0));
3025 - }
3026 - break;
3027 - case IDC_SPECULARSOURCE:
3028 - if (HIWORD(wParam) == CBN_SELCHANGE)
3029 - {
3030 - d3d7dev->SetRenderState(D3DRENDERSTATE_SPECULARMATERIALSOURCE, SendDlgItemMessage(hWnd,
3031 - IDC_SPECULARSOURCE, CB_GETCURSEL, 0, 0));
3032 - }
3033 - break;
3034 - case IDC_AMBIENTSOURCE:
3035 - if (HIWORD(wParam) == CBN_SELCHANGE)
3036 - {
3037 - d3d7dev->SetRenderState(D3DRENDERSTATE_AMBIENTMATERIALSOURCE, SendDlgItemMessage(hWnd,
3038 - IDC_AMBIENTSOURCE, CB_GETCURSEL, 0, 0));
3039 - }
3040 - break;
3041 - case IDC_EMISSIVESOURCE:
3042 - if (HIWORD(wParam) == CBN_SELCHANGE)
3043 - {
3044 - d3d7dev->SetRenderState(D3DRENDERSTATE_EMISSIVEMATERIALSOURCE, SendDlgItemMessage(hWnd,
3045 - IDC_EMISSIVESOURCE, CB_GETCURSEL, 0, 0));
3046 - }
3047 - break;
3048 - case IDC_LIGHTNUMBER:
3049 - if (HIWORD(wParam) == EN_CHANGE)
3050 - {
3051 - SendDlgItemMessage(hWnd, IDC_LIGHTNUMBER, WM_GETTEXT, MAX_PATH, (LPARAM)tmpstring);
3052 - number = _ttoi(tmpstring);
3053 - if (number < 0) SendDlgItemMessage(hWnd, IDC_LIGHTNUMBER, WM_SETTEXT, 0, (LPARAM)_T("0"));
3054 - if (number > 7) SendDlgItemMessage(hWnd, IDC_LIGHTNUMBER, WM_SETTEXT, 0, (LPARAM)_T("7"));
3055 - vertexshaderstate.currentlight = number;
3056 - _itot(hexlightcolor[vertexshaderstate.currentlight].ambient, tmpstring, 16);
3057 - strupper(tmpstring); paddwordzeroes(tmpstring);
3058 - SendDlgItemMessage(hWnd, IDC_LIGHTAMBIENT, WM_SETTEXT, 0, (LPARAM)tmpstring);
3059 - _itot(hexlightcolor[vertexshaderstate.currentlight].diffuse, tmpstring, 16);
3060 - strupper(tmpstring); paddwordzeroes(tmpstring);
3061 - SendDlgItemMessage(hWnd, IDC_LIGHTDIFFUSE, WM_SETTEXT, 0, (LPARAM)tmpstring);
3062 - _itot(hexlightcolor[vertexshaderstate.currentlight].specular, tmpstring, 16);
3063 - strupper(tmpstring); paddwordzeroes(tmpstring);
3064 - SendDlgItemMessage(hWnd, IDC_LIGHTSPECULAR, WM_SETTEXT, 0, (LPARAM)tmpstring);
3065 - SendDlgItemMessage(hWnd, IDC_LIGHTTYPE, CB_SETCURSEL, lights[vertexshaderstate.currentlight].dltType - 1, 0);
3066 - if (lightenable[vertexshaderstate.currentlight])
3067 - SendDlgItemMessage(hWnd, IDC_LIGHTENABLED, BM_SETCHECK, BST_CHECKED, 0);
3068 - else SendDlgItemMessage(hWnd, IDC_LIGHTENABLED, BM_SETCHECK, BST_UNCHECKED, 0);
3069 - }
3070 - break;
3071 - case IDC_LIGHTENABLED:
3072 - if (HIWORD(wParam) == BN_CLICKED)
3073 - {
3074 - if (SendDlgItemMessage(hWnd, IDC_LIGHTENABLED, BM_GETCHECK, 0, 0) == BST_CHECKED)
3075 - {
3076 - lightenable[vertexshaderstate.currentlight] = TRUE;
3077 - d3d7dev->LightEnable(vertexshaderstate.currentlight, TRUE);
3078 - }
3079 - else
3080 - {
3081 - lightenable[vertexshaderstate.currentlight] = FALSE;
3082 - d3d7dev->LightEnable(vertexshaderstate.currentlight, FALSE);
3083 - }
3084 - }
3085 - break;
3086 - case IDC_LIGHTTYPE:
3087 - if (HIWORD(wParam) == CBN_SELCHANGE)
3088 - {
3089 - lights[vertexshaderstate.currentlight].dltType = (D3DLIGHTTYPE)
3090 - (SendDlgItemMessage(hWnd, IDC_LIGHTTYPE, CB_GETCURSEL, 0, 0) + 1);
3091 - d3d7dev->SetLight(vertexshaderstate.currentlight, &lights[vertexshaderstate.currentlight]);
3092 - }
3093 - break;
3094 - case IDC_LIGHTRANGE:
3095 - if (HIWORD(wParam) == EN_CHANGE)
3096 - {
3097 - SendDlgItemMessage(hWnd, IDC_LIGHTRANGE, WM_GETTEXT, MAX_PATH, (LPARAM)tmpstring);
3098 - lights[vertexshaderstate.currentlight].dvRange = (float)_ttof(tmpstring);
3099 - d3d7dev->SetLight(vertexshaderstate.currentlight, &lights[vertexshaderstate.currentlight]);
3100 - }
3101 - break;
3102 - case IDCANCEL:
3103 - SendMessage(hWnd, WM_CLOSE, 0, 0);
3104 - break;
3105 - default:
3106 - return FALSE;
3107 - }
3108 - break;
3109 - case WM_CLOSE:
3110 - StopTimer();
3111 - if (d3d7dev)
3112 - {
3113 - d3d7dev->Release();
3114 - d3d7dev = NULL;
3115 - }
3116 - if (d3d7)
3117 - {
3118 - d3d7->Release();
3119 - d3d7dev = NULL;
3120 - }
3121 - if (ddsrender)
3122 - {
3123 - ddsrender->Release();
3124 - ddsrender = NULL;
3125 - }
3126 - if (ddsurface)
3127 - {
3128 - ddsurface->Release();
3129 - ddsurface = NULL;
3130 - }
3131 - if (zbuffer)
3132 - {
3133 - zbuffer->Release();
3134 - zbuffer = NULL;
3135 - }
3136 - if (ddclipper)
3137 - {
3138 - ddclipper->Release();
3139 - ddclipper = NULL;
3140 - }
3141 - if (ddinterface)
3142 - {
3143 - ddinterface->Release();
3144 - ddinterface = NULL;
3145 - }
3146 - if (mesh)
3147 - {
3148 - free(mesh);
3149 - mesh = NULL;
3150 - }
3151 - if (vertices)
3152 - {
3153 - free(vertices);
3154 - vertices = NULL;
3155 - }
3156 - if (litvertices)
3157 - {
3158 - free(litvertices);
3159 - litvertices = NULL;
3160 - }
3161 - if (colorvertices)
3162 - {
3163 - free(colorvertices);
3164 - colorvertices = NULL;
3165 - }
3166 - EndDialog(hWnd, IDCANCEL);
3167 - break;
3168 - case WM_APP:
3169 - RunTestTimed(testnum);
3170 - break;
3171 - default:
3172 - return FALSE;
3173 - }
3174 - return TRUE;
3175 -}
3176 -
3177 -/*
3178 -void DDFlipTestWindow::OnQueryNewPalette(wxQueryNewPaletteEvent& event)
3179 -{
3180 - //if(bpp == 8) ddsurface->SetPalette
3181 -}
3182 -*/
\ No newline at end of file
Index: dxgltest/palette.h
@@ -1,18 +0,0 @@
2 -// DXGL
3 -// Copyright (C) 2011 William Feely
4 -
5 -// This library is free software; you can redistribute it and/or
6 -// modify it under the terms of the GNU Lesser General Public
7 -// License as published by the Free Software Foundation; either
8 -// version 2.1 of the License, or (at your option) any later version.
9 -
10 -// This library is distributed in the hope that it will be useful,
11 -// but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 -// Lesser General Public License for more details.
14 -
15 -// You should have received a copy of the GNU Lesser General Public
16 -// License along with this library; if not, write to the Free Software
17 -// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 -
19 -extern const unsigned char DefaultPalette[1024];
Index: dxgltest/dxgltest.h
@@ -1,20 +0,0 @@
2 -// DXGL
3 -// Copyright (C) 2011 William Feely
4 -
5 -// This library is free software; you can redistribute it and/or
6 -// modify it under the terms of the GNU Lesser General Public
7 -// License as published by the Free Software Foundation; either
8 -// version 2.1 of the License, or (at your option) any later version.
9 -
10 -// This library is distributed in the hope that it will be useful,
11 -// but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 -// Lesser General Public License for more details.
14 -
15 -// You should have received a copy of the GNU Lesser General Public
16 -// License along with this library; if not, write to the Free Software
17 -// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 -
19 -#pragma once
20 -
21 -#include "resource.h"
Index: dxgltest/precomp.cpp
@@ -1,18 +0,0 @@
2 -// DXGL
3 -// Copyright (C) 2011 William Feely
4 -
5 -// This library is free software; you can redistribute it and/or
6 -// modify it under the terms of the GNU Lesser General Public
7 -// License as published by the Free Software Foundation; either
8 -// version 2.1 of the License, or (at your option) any later version.
9 -
10 -// This library is distributed in the hope that it will be useful,
11 -// but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 -// Lesser General Public License for more details.
14 -
15 -// You should have received a copy of the GNU Lesser General Public
16 -// License along with this library; if not, write to the Free Software
17 -// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 -
19 -#include "common.h"
\ No newline at end of file
Index: dxgltest/tests.h
@@ -1,39 +0,0 @@
2 -// DXGL
3 -// Copyright (C) 2011 William Feely
4 -
5 -// This library is free software; you can redistribute it and/or
6 -// modify it under the terms of the GNU Lesser General Public
7 -// License as published by the Free Software Foundation; either
8 -// version 2.1 of the License, or (at your option) any later version.
9 -
10 -// This library is distributed in the hope that it will be useful,
11 -// but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 -// Lesser General Public License for more details.
14 -
15 -// You should have received a copy of the GNU Lesser General Public
16 -// License along with this library; if not, write to the Free Software
17 -// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 -
19 -#pragma once
20 -#ifndef _TESTS_H
21 -#define _TESTS_H
22 -
23 -typedef struct
24 -{
25 - MultiDirectDrawSurface *surface;
26 - DDSURFACEDESC2 ddsd;
27 - float width;
28 - float height;
29 - float x;
30 - float y;
31 - float xvelocity;
32 - float yvelocity;
33 - DWORD bltflags;
34 - RECT rect;
35 -} DDSPRITE;
36 -
37 -void RunDXGLTest(int testnum, int width, int height, int bpp, int refresh, int backbuffers, int apiver,
38 - int filter, int msaa, double fps, bool fullscreen, bool resizable, BOOL is3d);
39 -
40 -#endif //_TESTS_H
Index: dxgltest/MultiDD.h
@@ -1,151 +0,0 @@
2 -// DXGL
3 -// Copyright (C) 2011 William Feely
4 -
5 -// This library is free software; you can redistribute it and/or
6 -// modify it under the terms of the GNU Lesser General Public
7 -// License as published by the Free Software Foundation; either
8 -// version 2.1 of the License, or (at your option) any later version.
9 -
10 -// This library is distributed in the hope that it will be useful,
11 -// but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 -// Lesser General Public License for more details.
14 -
15 -// You should have received a copy of the GNU Lesser General Public
16 -// License along with this library; if not, write to the Free Software
17 -// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 -
19 -#pragma once
20 -#ifndef _MULTIDD_H
21 -#define _MULTIDD_H
22 -
23 -class MultiDirectDrawSurface;
24 -
25 -class MultiDirectDraw
26 -{
27 -public:
28 - MultiDirectDraw(int version, HRESULT *error, GUID *lpGUID);
29 - virtual ~MultiDirectDraw();
30 - HRESULT QueryInterface(REFIID riid, void** ppvObj);
31 - ULONG AddRef();
32 - ULONG Release();
33 - HRESULT Compact();
34 - HRESULT CreateClipper(DWORD dwFlags, LPDIRECTDRAWCLIPPER FAR *lplpDDClipper, IUnknown FAR *pUnkOuter);
35 - HRESULT CreatePalette(DWORD dwFlags, LPPALETTEENTRY lpDDColorArray, LPDIRECTDRAWPALETTE FAR *lplpDDPalette, IUnknown FAR *pUnkOuter);
36 - HRESULT CreateSurface(LPDDSURFACEDESC2 lpDDSurfaceDesc2, MultiDirectDrawSurface FAR **lplpDDSurface, IUnknown FAR *pUnkOuter);
37 - HRESULT DuplicateSurface(MultiDirectDrawSurface *lpDDSurface, MultiDirectDrawSurface FAR **lplpDupDDSurface);
38 - HRESULT EnumDisplayModes(DWORD dwFlags, LPDDSURFACEDESC2 lpDDSurfaceDesc2, LPVOID lpContext, LPDDENUMMODESCALLBACK2 lpEnumModesCallback);
39 - HRESULT EnumSurfaces(DWORD dwFlags, LPDDSURFACEDESC2 lpDDSD2, LPVOID lpContext, LPDDENUMSURFACESCALLBACK7 lpEnumSurfacesCallback);
40 - HRESULT FlipToGDISurface();
41 - HRESULT GetCaps(LPDDCAPS lpDDDriverCaps, LPDDCAPS lpDDHELCaps);
42 - HRESULT GetDisplayMode(LPDDSURFACEDESC2 lpDDSurfaceDesc2);
43 - HRESULT GetFourCCCodes(LPDWORD lpNumCodes, LPDWORD lpCodes);
44 - HRESULT GetGDISurface(MultiDirectDrawSurface FAR **lplpGDIDDSurface);
45 - HRESULT GetMonitorFrequency(LPDWORD lpdwFrequency);
46 - HRESULT GetScanLine(LPDWORD lpdwScanLine);
47 - HRESULT GetVerticalBlankStatus(LPBOOL lpbIsInVB);
48 - HRESULT Initialize(GUID FAR *lpGUID);
49 - HRESULT RestoreDisplayMode();
50 - HRESULT SetCooperativeLevel(HWND hWnd, DWORD dwFlags);
51 - HRESULT SetDisplayMode(DWORD dwWidth, DWORD dwHeight, DWORD dwBPP, DWORD dwRefreshRate, DWORD dwFlags);
52 - HRESULT WaitForVerticalBlank(DWORD dwFlags, HANDLE hEvent);
53 - // ddraw 2+ api
54 - HRESULT WINAPI GetAvailableVidMem(LPDDSCAPS2 lpDDSCaps2, LPDWORD lpdwTotal, LPDWORD lpdwFree);
55 - // ddraw 4+ api
56 - HRESULT WINAPI GetSurfaceFromDC(HDC hdc, MultiDirectDrawSurface **lpDDS);
57 - HRESULT WINAPI RestoreAllSurfaces();
58 - HRESULT WINAPI TestCooperativeLevel();
59 - HRESULT WINAPI GetDeviceIdentifier(LPDDDEVICEIDENTIFIER2 lpdddi, DWORD dwFlags);
60 - // ddraw 7 api
61 - HRESULT WINAPI StartModeTest(LPSIZE lpModesToTest, DWORD dwNumEntries, DWORD dwFlags);
62 - HRESULT WINAPI EvaluateMode(DWORD dwFlags, DWORD *pSecondsUntilTimeout);
63 -private:
64 - ULONG refcount;
65 - int version;
66 - LPDIRECTDRAW dd1;
67 - LPDIRECTDRAW2 dd2;
68 - LPDIRECTDRAW4 dd4;
69 - LPDIRECTDRAW7 dd7;
70 - // temporary storage
71 - LPDIRECTDRAWSURFACE dds1;
72 - LPDIRECTDRAWSURFACE2 dds2;
73 - LPDIRECTDRAWSURFACE3 dds3;
74 - LPDIRECTDRAWSURFACE4 dds4;
75 - LPDIRECTDRAWSURFACE7 dds7;
76 - MultiDirectDrawSurface *ddsm;
77 -};
78 -
79 -class MultiDirectDrawSurface
80 -{
81 -public:
82 - MultiDirectDrawSurface(int version, LPVOID surface);
83 - virtual ~MultiDirectDrawSurface();
84 - // ddraw 1+ api
85 - HRESULT QueryInterface(REFIID riid, void** ppvObj);
86 - ULONG AddRef();
87 - ULONG Release();
88 - HRESULT AddAttachedSurface(MultiDirectDrawSurface *lpDDSAttachedSurface);
89 - HRESULT AddOverlayDirtyRect(LPRECT lpRect);
90 - HRESULT Blt(LPRECT lpDestRect, MultiDirectDrawSurface *lpDDSrcSurface, LPRECT lpSrcRect, DWORD dwFlags, LPDDBLTFX lpDDBltFx);
91 - HRESULT BltBatch(LPDDBLTBATCH lpDDBltBatch, DWORD dwCount, DWORD dwFlags);
92 - HRESULT BltFast(DWORD dwX, DWORD dwY, MultiDirectDrawSurface *lpDDSrcSurface, LPRECT lpSrcRect, DWORD dwTrans);
93 - HRESULT DeleteAttachedSurface(DWORD dwFlags, MultiDirectDrawSurface *lpDDSAttachedSurface);
94 - HRESULT EnumAttachedSurfaces(LPVOID lpContext, LPDDENUMSURFACESCALLBACK7 lpEnumSurfacesCallback);
95 - HRESULT EnumOverlayZOrders(DWORD dwFlags, LPVOID lpContext, LPDDENUMSURFACESCALLBACK7 lpfnCallback);
96 - HRESULT Flip(MultiDirectDrawSurface *lpDDSurfaceTargetOverride, DWORD dwFlags);
97 - HRESULT GetAttachedSurface(LPDDSCAPS2 lpDDSCaps, MultiDirectDrawSurface FAR **lplpDDAttachedSurface);
98 - HRESULT GetBltStatus(DWORD dwFlags);
99 - HRESULT GetCaps(LPDDSCAPS2 lpDDSCaps);
100 - HRESULT GetClipper(LPDIRECTDRAWCLIPPER FAR *lplpDDClipper);
101 - HRESULT GetColorKey(DWORD dwFlags, LPDDCOLORKEY lpDDColorKey);
102 - HRESULT GetDC(HDC FAR *lphDC);
103 - HRESULT GetFlipStatus(DWORD dwFlags);
104 - HRESULT GetOverlayPosition(LPLONG lplX, LPLONG lplY);
105 - HRESULT GetPalette(LPDIRECTDRAWPALETTE FAR *lplpDDPalette);
106 - HRESULT GetPixelFormat(LPDDPIXELFORMAT lpDDPixelFormat);
107 - HRESULT GetSurfaceDesc(LPDDSURFACEDESC2 lpDDSurfaceDesc);
108 - HRESULT Initialize(MultiDirectDraw *lpDD, LPDDSURFACEDESC2 lpDDSurfaceDesc);
109 - HRESULT IsLost();
110 - HRESULT Lock(LPRECT lpDestRect, LPDDSURFACEDESC2 lpDDSurfaceDesc, DWORD dwFlags, HANDLE hEvent);
111 - HRESULT ReleaseDC(HDC hDC);
112 - HRESULT Restore();
113 - HRESULT SetClipper(LPDIRECTDRAWCLIPPER lpDDClipper);
114 - HRESULT SetColorKey(DWORD dwFlags, LPDDCOLORKEY lpDDColorKey);
115 - HRESULT SetOverlayPosition(LONG lX, LONG lY);
116 - HRESULT SetPalette(LPDIRECTDRAWPALETTE lpDDPalette);
117 - HRESULT Unlock(LPRECT lpRect);
118 - HRESULT UpdateOverlay(LPRECT lpSrcRect, MultiDirectDrawSurface *lpDDDestSurface, LPRECT lpDestRect, DWORD dwFlags, LPDDOVERLAYFX lpDDOverlayFx);
119 - HRESULT UpdateOverlayDisplay(DWORD dwFlags);
120 - HRESULT UpdateOverlayZOrder(DWORD dwFlags, MultiDirectDrawSurface *lpDDSReference);
121 - // ddraw 2+ api
122 - HRESULT GetDDInterface(LPVOID FAR *lplpDD);
123 - HRESULT PageLock(DWORD dwFlags);
124 - HRESULT PageUnlock(DWORD dwFlags);
125 - // ddraw 3+ api
126 - HRESULT SetSurfaceDesc(LPDDSURFACEDESC2 lpddsd2, DWORD dwFlags);
127 - // ddraw 4+ api
128 - HRESULT SetPrivateData(REFGUID guidTag, LPVOID lpData, DWORD cbSize, DWORD dwFlags);
129 - HRESULT GetPrivateData(REFGUID guidTag, LPVOID lpBuffer, LPDWORD lpcbBufferSize);
130 - HRESULT FreePrivateData(REFGUID guidTag);
131 - HRESULT GetUniquenessValue(LPDWORD lpValue);
132 - HRESULT ChangeUniquenessValue();
133 - // ddraw 7 api
134 - HRESULT SetPriority(DWORD dwPriority);
135 - HRESULT GetPriority(LPDWORD lpdwPriority);
136 - HRESULT SetLOD(DWORD dwMaxLOD);
137 - HRESULT GetLOD(LPDWORD lpdwMaxLOD);
138 - // Internal functions
139 - LPVOID GetSurface();
140 -private:
141 - int version;
142 - ULONG refcount;
143 - LPDIRECTDRAWSURFACE dds1;
144 - LPDIRECTDRAWSURFACE2 dds2;
145 - LPDIRECTDRAWSURFACE3 dds3;
146 - LPDIRECTDRAWSURFACE4 dds4;
147 - LPDIRECTDRAWSURFACE7 dds7;
148 - // temporary surface
149 - MultiDirectDrawSurface *ddsm;
150 -};
151 -
152 -#endif //_MULTIDD_H
\ No newline at end of file
Index: dxgltest/dxgltest.vcxproj
@@ -1,238 +0,0 @@
2 -<?xml version="1.0" encoding="utf-8"?>
3 -<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
4 - <ItemGroup Label="ProjectConfigurations">
5 - <ProjectConfiguration Include="Debug no DXGL|Win32">
6 - <Configuration>Debug no DXGL</Configuration>
7 - <Platform>Win32</Platform>
8 - </ProjectConfiguration>
9 - <ProjectConfiguration Include="Debug No MSVCRT|Win32">
10 - <Configuration>Debug No MSVCRT</Configuration>
11 - <Platform>Win32</Platform>
12 - </ProjectConfiguration>
13 - <ProjectConfiguration Include="Debug|Win32">
14 - <Configuration>Debug</Configuration>
15 - <Platform>Win32</Platform>
16 - </ProjectConfiguration>
17 - <ProjectConfiguration Include="Release no DXGL|Win32">
18 - <Configuration>Release no DXGL</Configuration>
19 - <Platform>Win32</Platform>
20 - </ProjectConfiguration>
21 - <ProjectConfiguration Include="Release|Win32">
22 - <Configuration>Release</Configuration>
23 - <Platform>Win32</Platform>
24 - </ProjectConfiguration>
25 - </ItemGroup>
26 - <PropertyGroup Label="Globals">
27 - <ProjectGuid>{3A14A469-504B-4E32-8F23-063F8A2A8B5D}</ProjectGuid>
28 - <Keyword>Win32Proj</Keyword>
29 - <RootNamespace>dxgltest</RootNamespace>
30 - </PropertyGroup>
31 - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
32 - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
33 - <ConfigurationType>Application</ConfigurationType>
34 - <UseDebugLibraries>true</UseDebugLibraries>
35 - <CharacterSet>Unicode</CharacterSet>
36 - <PlatformToolset>v100</PlatformToolset>
37 - </PropertyGroup>
38 - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug No MSVCRT|Win32'" Label="Configuration">
39 - <ConfigurationType>Application</ConfigurationType>
40 - <UseDebugLibraries>true</UseDebugLibraries>
41 - <CharacterSet>Unicode</CharacterSet>
42 - <PlatformToolset>v100</PlatformToolset>
43 - </PropertyGroup>
44 - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug no DXGL|Win32'" Label="Configuration">
45 - <ConfigurationType>Application</ConfigurationType>
46 - <UseDebugLibraries>true</UseDebugLibraries>
47 - <CharacterSet>Unicode</CharacterSet>
48 - <PlatformToolset>v100</PlatformToolset>
49 - </PropertyGroup>
50 - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
51 - <ConfigurationType>Application</ConfigurationType>
52 - <UseDebugLibraries>false</UseDebugLibraries>
53 - <WholeProgramOptimization>true</WholeProgramOptimization>
54 - <CharacterSet>Unicode</CharacterSet>
55 - <PlatformToolset>v100</PlatformToolset>
56 - </PropertyGroup>
57 - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release no DXGL|Win32'" Label="Configuration">
58 - <ConfigurationType>Application</ConfigurationType>
59 - <UseDebugLibraries>false</UseDebugLibraries>
60 - <WholeProgramOptimization>true</WholeProgramOptimization>
61 - <CharacterSet>Unicode</CharacterSet>
62 - <PlatformToolset>v100</PlatformToolset>
63 - </PropertyGroup>
64 - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
65 - <ImportGroup Label="ExtensionSettings">
66 - </ImportGroup>
67 - <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
68 - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
69 - </ImportGroup>
70 - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug No MSVCRT|Win32'" Label="PropertySheets">
71 - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
72 - </ImportGroup>
73 - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug no DXGL|Win32'" Label="PropertySheets">
74 - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
75 - </ImportGroup>
76 - <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
77 - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
78 - </ImportGroup>
79 - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release no DXGL|Win32'" Label="PropertySheets">
80 - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
81 - </ImportGroup>
82 - <PropertyGroup Label="UserMacros" />
83 - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
84 - <LinkIncremental>true</LinkIncremental>
85 - <RunCodeAnalysis>false</RunCodeAnalysis>
86 - <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
87 - <GenerateManifest>false</GenerateManifest>
88 - </PropertyGroup>
89 - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug No MSVCRT|Win32'">
90 - <LinkIncremental>true</LinkIncremental>
91 - <RunCodeAnalysis>false</RunCodeAnalysis>
92 - <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
93 - <GenerateManifest>false</GenerateManifest>
94 - </PropertyGroup>
95 - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug no DXGL|Win32'">
96 - <LinkIncremental>true</LinkIncremental>
97 - <RunCodeAnalysis>false</RunCodeAnalysis>
98 - <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
99 - <GenerateManifest>false</GenerateManifest>
100 - </PropertyGroup>
101 - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
102 - <LinkIncremental>false</LinkIncremental>
103 - <GenerateManifest>false</GenerateManifest>
104 - </PropertyGroup>
105 - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release no DXGL|Win32'">
106 - <LinkIncremental>false</LinkIncremental>
107 - <GenerateManifest>false</GenerateManifest>
108 - </PropertyGroup>
109 - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
110 - <ClCompile>
111 - <PrecompiledHeader>Use</PrecompiledHeader>
112 - <WarningLevel>Level3</WarningLevel>
113 - <Optimization>Disabled</Optimization>
114 - <PreprocessorDefinitions>WIN32;_CRT_NON_CONFORMING_SWPRINTFS;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
115 - <EnablePREfast>false</EnablePREfast>
116 - <PrecompiledHeaderFile>common.h</PrecompiledHeaderFile>
117 - </ClCompile>
118 - <Link>
119 - <SubSystem>Windows</SubSystem>
120 - <GenerateDebugInformation>true</GenerateDebugInformation>
121 - <AdditionalLibraryDirectories>$(WXWIN)\lib\vc_lib</AdditionalLibraryDirectories>
122 - <AdditionalDependencies>winmm.lib;comctl32.lib;rpcrt4.lib;wsock32.lib;version.lib;$(OutDir)ddraw.lib;msimg32.lib;%(AdditionalDependencies)</AdditionalDependencies>
123 - </Link>
124 - </ItemDefinitionGroup>
125 - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug No MSVCRT|Win32'">
126 - <ClCompile>
127 - <PrecompiledHeader>Use</PrecompiledHeader>
128 - <WarningLevel>Level3</WarningLevel>
129 - <Optimization>Disabled</Optimization>
130 - <PreprocessorDefinitions>WIN32;_CRT_NON_CONFORMING_SWPRINTFS;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
131 - <EnablePREfast>false</EnablePREfast>
132 - <PrecompiledHeaderFile>common.h</PrecompiledHeaderFile>
133 - </ClCompile>
134 - <Link>
135 - <SubSystem>Windows</SubSystem>
136 - <GenerateDebugInformation>true</GenerateDebugInformation>
137 - <AdditionalLibraryDirectories>$(WXWIN)\lib\vc_lib</AdditionalLibraryDirectories>
138 - <AdditionalDependencies>winmm.lib;comctl32.lib;rpcrt4.lib;wsock32.lib;version.lib;$(OutDir)ddraw.lib;msimg32.lib;%(AdditionalDependencies)</AdditionalDependencies>
139 - <IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>
140 - </Link>
141 - </ItemDefinitionGroup>
142 - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug no DXGL|Win32'">
143 - <ClCompile>
144 - <PrecompiledHeader>Use</PrecompiledHeader>
145 - <WarningLevel>Level3</WarningLevel>
146 - <Optimization>Disabled</Optimization>
147 - <PreprocessorDefinitions>WIN32;_CRT_NON_CONFORMING_SWPRINTFS;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
148 - <EnablePREfast>false</EnablePREfast>
149 - <PrecompiledHeaderFile>common.h</PrecompiledHeaderFile>
150 - </ClCompile>
151 - <Link>
152 - <SubSystem>Windows</SubSystem>
153 - <GenerateDebugInformation>true</GenerateDebugInformation>
154 - <AdditionalDependencies>winmm.lib;comctl32.lib;rpcrt4.lib;wsock32.lib;version.lib;$(OutDir)ddraw.lib;%(AdditionalDependencies)</AdditionalDependencies>
155 - <AdditionalLibraryDirectories>$(WXWIN)\lib\vc_lib</AdditionalLibraryDirectories>
156 - </Link>
157 - </ItemDefinitionGroup>
158 - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
159 - <ClCompile>
160 - <WarningLevel>Level3</WarningLevel>
161 - <PrecompiledHeader>Use</PrecompiledHeader>
162 - <Optimization>MaxSpeed</Optimization>
163 - <FunctionLevelLinking>true</FunctionLevelLinking>
164 - <IntrinsicFunctions>true</IntrinsicFunctions>
165 - <PreprocessorDefinitions>WIN32;_CRT_NON_CONFORMING_SWPRINTFS;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
166 - <PrecompiledHeaderFile>common.h</PrecompiledHeaderFile>
167 - </ClCompile>
168 - <Link>
169 - <SubSystem>Windows</SubSystem>
170 - <GenerateDebugInformation>true</GenerateDebugInformation>
171 - <EnableCOMDATFolding>true</EnableCOMDATFolding>
172 - <OptimizeReferences>true</OptimizeReferences>
173 - <AdditionalDependencies>winmm.lib;comctl32.lib;rpcrt4.lib;wsock32.lib;version.lib;$(OutDir)ddraw.lib;%(AdditionalDependencies)</AdditionalDependencies>
174 - </Link>
175 - </ItemDefinitionGroup>
176 - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release no DXGL|Win32'">
177 - <ClCompile>
178 - <WarningLevel>Level3</WarningLevel>
179 - <PrecompiledHeader>Use</PrecompiledHeader>
180 - <Optimization>MaxSpeed</Optimization>
181 - <FunctionLevelLinking>true</FunctionLevelLinking>
182 - <IntrinsicFunctions>true</IntrinsicFunctions>
183 - <PreprocessorDefinitions>WIN32;_CRT_NON_CONFORMING_SWPRINTFS;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
184 - <PrecompiledHeaderFile>common.h</PrecompiledHeaderFile>
185 - </ClCompile>
186 - <Link>
187 - <SubSystem>Windows</SubSystem>
188 - <GenerateDebugInformation>true</GenerateDebugInformation>
189 - <EnableCOMDATFolding>true</EnableCOMDATFolding>
190 - <OptimizeReferences>true</OptimizeReferences>
191 - <AdditionalDependencies>winmm.lib;comctl32.lib;rpcrt4.lib;wsock32.lib;version.lib;$(OutDir)ddraw.lib;%(AdditionalDependencies)</AdditionalDependencies>
192 - </Link>
193 - </ItemDefinitionGroup>
194 - <ItemGroup>
195 - <None Include="ReadMe.txt" />
196 - </ItemGroup>
197 - <ItemGroup>
198 - <ClInclude Include="common.h" />
199 - <ClInclude Include="dxgltest.h" />
200 - <ClInclude Include="misc.h" />
201 - <ClInclude Include="MultiDD.h" />
202 - <ClInclude Include="palette.h" />
203 - <ClInclude Include="Resource.h" />
204 - <ClInclude Include="surfacegen.h" />
205 - <ClInclude Include="tests.h" />
206 - <ClInclude Include="timer.h" />
207 - </ItemGroup>
208 - <ItemGroup>
209 - <ClCompile Include="dxguid.cpp">
210 - <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug no DXGL|Win32'">NotUsing</PrecompiledHeader>
211 - <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
212 - <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug No MSVCRT|Win32'">NotUsing</PrecompiledHeader>
213 - <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release no DXGL|Win32'">NotUsing</PrecompiledHeader>
214 - <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NotUsing</PrecompiledHeader>
215 - </ClCompile>
216 - <ClCompile Include="MultiDD.cpp" />
217 - <ClCompile Include="tests.cpp" />
218 - <ClCompile Include="dxgltest.cpp" />
219 - <ClCompile Include="palette.cpp" />
220 - <ClCompile Include="precomp.cpp">
221 - <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
222 - <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug No MSVCRT|Win32'">Create</PrecompiledHeader>
223 - <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug no DXGL|Win32'">Create</PrecompiledHeader>
224 - <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release no DXGL|Win32'">Create</PrecompiledHeader>
225 - <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
226 - </ClCompile>
227 - <ClCompile Include="surfacegen.cpp" />
228 - <ClCompile Include="timer.cpp" />
229 - </ItemGroup>
230 - <ItemGroup>
231 - <ResourceCompile Include="dxgltest.rc" />
232 - </ItemGroup>
233 - <ItemGroup>
234 - <Manifest Include="xp.manifest" />
235 - </ItemGroup>
236 - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
237 - <ImportGroup Label="ExtensionTargets">
238 - </ImportGroup>
239 -</Project>
\ No newline at end of file
Index: dxgltest/xp.manifest
@@ -1,36 +0,0 @@
2 -<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
3 -<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3" >
4 -<assemblyIdentity
5 - version="1.0.0.0"
6 - processorArchitecture="X86"
7 - name="WilliamFeely.DXGL.DXGLTest"
8 - type="win32"
9 -/>
10 -<description>DXGL Test Application</description>
11 -<dependency>
12 - <dependentAssembly>
13 - <assemblyIdentity
14 - type="win32"
15 - name="Microsoft.Windows.Common-Controls"
16 - version="6.0.0.0"
17 - processorArchitecture="X86"
18 - publicKeyToken="6595b64144ccf1df"
19 - language="*"
20 - />
21 - </dependentAssembly>
22 -</dependency>
23 - <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
24 - <application>
25 - <supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/>
26 - <supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>
27 - <supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
28 - <supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>
29 - <supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/>
30 - </application>
31 - </compatibility>
32 - <asmv3:application>
33 - <asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">
34 - <dpiAware>true/pm</dpiAware>
35 - </asmv3:windowsSettings>
36 - </asmv3:application>
37 -</assembly>
\ No newline at end of file
Index: dxgltest
Property changes on: dxgltest
___________________________________________________________________
Deleted: svn:ignore
## -1,8 +0,0 ##
38 -bin
39 -Debug
40 -Debug no DXGL
41 -obj
42 -Release
43 -Release no DXGL
44 -dxgltest.vcxproj.user
45 -Debug No MSVCRT
Index: dxgl.sln
@@ -23,11 +23,6 @@
2424 EndProject
2525 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cfgmgr", "cfgmgr\cfgmgr.vcxproj", "{55A95F84-E00E-4C65-BB09-41D27C5845AC}"
2626 EndProject
27 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dxgltest", "dxgltest\dxgltest.vcxproj", "{3A14A469-504B-4E32-8F23-063F8A2A8B5D}"
28 - ProjectSection(ProjectDependencies) = postProject
29 - {9F051466-EA2C-4195-80B1-1B7C5B3F4AC2} = {9F051466-EA2C-4195-80B1-1B7C5B3F4AC2}
30 - EndProjectSection
31 -EndProject
3227 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Help", "Help\Help.vcxproj", "{8041FD11-3A2E-4EE9-A3FF-A9755803B7FB}"
3328 ProjectSection(ProjectDependencies) = postProject
3429 {34883A93-DFE4-42EF-9DAE-BEE4D3FC87D0} = {34883A93-DFE4-42EF-9DAE-BEE4D3FC87D0}
@@ -117,18 +112,6 @@
118113 {55A95F84-E00E-4C65-BB09-41D27C5845AC}.Release no DXGL|Win32.Build.0 = Release no DXGL|Win32
119114 {55A95F84-E00E-4C65-BB09-41D27C5845AC}.Release|Win32.ActiveCfg = Release|Win32
120115 {55A95F84-E00E-4C65-BB09-41D27C5845AC}.Release|Win32.Build.0 = Release|Win32
121 - {3A14A469-504B-4E32-8F23-063F8A2A8B5D}.Debug no DXGL|Win32.ActiveCfg = Debug no DXGL|Win32
122 - {3A14A469-504B-4E32-8F23-063F8A2A8B5D}.Debug no DXGL|Win32.Build.0 = Debug no DXGL|Win32
123 - {3A14A469-504B-4E32-8F23-063F8A2A8B5D}.Debug No MSVCRT|Win32.ActiveCfg = Debug No MSVCRT|Win32
124 - {3A14A469-504B-4E32-8F23-063F8A2A8B5D}.Debug No MSVCRT|Win32.Build.0 = Debug No MSVCRT|Win32
125 - {3A14A469-504B-4E32-8F23-063F8A2A8B5D}.Debug Trace|Win32.ActiveCfg = Debug|Win32
126 - {3A14A469-504B-4E32-8F23-063F8A2A8B5D}.Debug Trace|Win32.Build.0 = Debug|Win32
127 - {3A14A469-504B-4E32-8F23-063F8A2A8B5D}.Debug|Win32.ActiveCfg = Debug|Win32
128 - {3A14A469-504B-4E32-8F23-063F8A2A8B5D}.Debug|Win32.Build.0 = Debug|Win32
129 - {3A14A469-504B-4E32-8F23-063F8A2A8B5D}.Release no DXGL|Win32.ActiveCfg = Release no DXGL|Win32
130 - {3A14A469-504B-4E32-8F23-063F8A2A8B5D}.Release no DXGL|Win32.Build.0 = Release no DXGL|Win32
131 - {3A14A469-504B-4E32-8F23-063F8A2A8B5D}.Release|Win32.ActiveCfg = Release|Win32
132 - {3A14A469-504B-4E32-8F23-063F8A2A8B5D}.Release|Win32.Build.0 = Release|Win32
133116 {8041FD11-3A2E-4EE9-A3FF-A9755803B7FB}.Debug no DXGL|Win32.ActiveCfg = Debug|Win32
134117 {8041FD11-3A2E-4EE9-A3FF-A9755803B7FB}.Debug no DXGL|Win32.Build.0 = Debug|Win32
135118 {8041FD11-3A2E-4EE9-A3FF-A9755803B7FB}.Debug No MSVCRT|Win32.ActiveCfg = Debug No MSVCRT|Win32