| Index: ddraw/common.h |
| — | — | @@ -25,7 +25,6 @@ |
| 26 | 26 | #include <MMSystem.h>
|
| 27 | 27 | #include "include/winedef.h"
|
| 28 | 28 | #include "include/ddraw.h"
|
| 29 | | -#define D3D_OVERLOADS
|
| 30 | 29 | #include "include/d3d.h"
|
| 31 | 30 | #include "GL/gl.h"
|
| 32 | 31 | #include "include/GL/glext.h"
|
| Index: ddraw/glDirect3DDevice.cpp |
| — | — | @@ -1711,7 +1711,7 @@ |
| 1712 | 1712 | if(!this) TRACE_RET(HRESULT,23,DDERR_INVALIDOBJECT);
|
| 1713 | 1713 | memcpy(&viewport,lpViewport,sizeof(D3DVIEWPORT7));
|
| 1714 | 1714 | transform_dirty = true;
|
| 1715 | | - glRenderer_SetViewport(renderer, lpViewport);
|
| | 1715 | + glRenderer_SetD3DViewport(renderer, lpViewport);
|
| 1716 | 1716 | TRACE_EXIT(23,D3D_OK);
|
| 1717 | 1717 | return D3D_OK;
|
| 1718 | 1718 | }
|
| Index: ddraw/glDirect3DLight.cpp |
| — | — | @@ -30,6 +30,7 @@ |
| 31 | 31 |
|
| 32 | 32 | glDirect3DLight::glDirect3DLight()
|
| 33 | 33 | {
|
| | 34 | + D3DVECTOR dir = { 0,0,1.0 };
|
| 34 | 35 | TRACE_ENTER(1,14,this);
|
| 35 | 36 | refcount=1;
|
| 36 | 37 | viewport = NULL;
|
| — | — | @@ -37,7 +38,7 @@ |
| 38 | 39 | ZeroMemory(&light,sizeof(D3DLIGHT7));
|
| 39 | 40 | light.dltType = D3DLIGHT_DIRECTIONAL;
|
| 40 | 41 | light.dcvDiffuse.r = light.dcvDiffuse.g = light.dcvDiffuse.b = 1.0f;
|
| 41 | | - light.dvDirection = D3DVECTOR(0,0,1.0);
|
| | 42 | + light.dvDirection = dir;
|
| 42 | 43 | TRACE_EXIT(-1,0);
|
| 43 | 44 | }
|
| 44 | 45 | glDirect3DLight::glDirect3DLight(D3DLIGHT7 *light_in)
|
| Index: ddraw/glRenderer.cpp |
| — | — | @@ -296,7 +296,7 @@ |
| 297 | 297 | case OP_SETLIGHT: // Sets one of the Direct3D fixed-function light states.
|
| 298 | 298 | error = DDERR_CURRENTLYNOTAVAIL;
|
| 299 | 299 | break;
|
| 300 | | - case OP_SETVIEWPORT: // Sets the Direct3D viewport. May be
|
| | 300 | + case OP_SETD3DVIEWPORT: // Sets the Direct3D viewport. May be
|
| 301 | 301 | error = DDERR_CURRENTLYNOTAVAIL;
|
| 302 | 302 | break;
|
| 303 | 303 | case OP_SETTEXTURECOLORKEY: // Sets a color key or colorkey range on a texture object.
|
| — | — | @@ -1093,17 +1093,17 @@ |
| 1094 | 1094 | }
|
| 1095 | 1095 |
|
| 1096 | 1096 | /**
|
| 1097 | | - * Sets the viewport for the renderer.
|
| | 1097 | + * Sets the Direct3D viewport for the renderer.
|
| 1098 | 1098 | * @param This
|
| 1099 | 1099 | * Pointer to glRenderer object
|
| 1100 | 1100 | * @param lpViewport
|
| 1101 | 1101 | * New viewport parameters for renderer.
|
| 1102 | 1102 | */
|
| 1103 | | -void glRenderer_SetViewport(glRenderer *This, LPD3DVIEWPORT7 lpViewport)
|
| | 1103 | +void glRenderer_SetD3DViewport(glRenderer *This, LPD3DVIEWPORT7 lpViewport)
|
| 1104 | 1104 | {
|
| 1105 | 1105 | EnterCriticalSection(&This->cs);
|
| 1106 | 1106 | This->inputs[0] = lpViewport;
|
| 1107 | | - This->opcode = OP_SETVIEWPORT;
|
| | 1107 | + This->opcode = OP_SETD3DVIEWPORT;
|
| 1108 | 1108 | SetEvent(This->start);
|
| 1109 | 1109 | WaitForSingleObject(This->busy, INFINITE);
|
| 1110 | 1110 | LeaveCriticalSection(&This->cs);
|
| — | — | @@ -1186,7 +1186,11 @@ |
| 1187 | 1187 | void glRenderer_EndCommand(glRenderer *This, BOOL wait, BOOL in_cs)
|
| 1188 | 1188 | {
|
| 1189 | 1189 | if (!in_cs) EnterCriticalSection(&This->cs);
|
| 1190 | | - if (!This->state.cmd->write_ptr_cmd) return; // Don't flip buffers if the front one is empty.
|
| | 1190 | + if (!This->state.cmd->write_ptr_cmd)
|
| | 1191 | + {
|
| | 1192 | + if (!in_cs) LeaveCriticalSection(&This->cs);
|
| | 1193 | + return; // Don't flip buffers if the front one is empty.
|
| | 1194 | + }
|
| 1191 | 1195 | This->opcode = OP_ENDCOMMAND;
|
| 1192 | 1196 | This->inputs[0] = (void*)wait;
|
| 1193 | 1197 | SetEvent(This->start);
|
| — | — | @@ -1326,8 +1330,8 @@ |
| 1327 | 1331 | case OP_REMOVELIGHT:
|
| 1328 | 1332 | glRenderer__RemoveLight(This, (DWORD)This->inputs[0]);
|
| 1329 | 1333 | break;
|
| 1330 | | - case OP_SETVIEWPORT:
|
| 1331 | | - glRenderer__SetViewport(This, (LPD3DVIEWPORT7)This->inputs[0]);
|
| | 1334 | + case OP_SETD3DVIEWPORT:
|
| | 1335 | + glRenderer__SetD3DViewport(This, (LPD3DVIEWPORT7)This->inputs[0]);
|
| 1332 | 1336 | break;
|
| 1333 | 1337 | case OP_SETTEXTURECOLORKEY:
|
| 1334 | 1338 | glRenderer__SetTextureColorKey(This, (glTexture*)This->inputs[0], (DWORD)This->inputs[1],
|
| — | — | @@ -3271,7 +3275,7 @@ |
| 3272 | 3276 | }
|
| 3273 | 3277 | }
|
| 3274 | 3278 |
|
| 3275 | | -void glRenderer__SetViewport(glRenderer *This, LPD3DVIEWPORT7 lpViewport)
|
| | 3279 | +void glRenderer__SetD3DViewport(glRenderer *This, LPD3DVIEWPORT7 lpViewport)
|
| 3276 | 3280 | {
|
| 3277 | 3281 | memcpy(&This->viewport, lpViewport, sizeof(D3DVIEWPORT7));
|
| 3278 | 3282 | SetEvent(This->busy);
|
| Index: ddraw/glRenderer.h |
| — | — | @@ -86,7 +86,7 @@ |
| 87 | 87 | #define OP_SETMATERIAL 19
|
| 88 | 88 | #define OP_SETLIGHT 20
|
| 89 | 89 | #define OP_REMOVELIGHT 21
|
| 90 | | -#define OP_SETVIEWPORT 22
|
| | 90 | +#define OP_SETD3DVIEWPORT 22
|
| 91 | 91 | #define OP_DXGLBREAK 23
|
| 92 | 92 | #define OP_SETTEXTURECOLORKEY 24
|
| 93 | 93 | #define OP_MAKETEXTUREPRIMARY 25
|
| — | — | @@ -174,7 +174,7 @@ |
| 175 | 175 | void glRenderer_SetMaterial(glRenderer *This, LPD3DMATERIAL7 lpMaterial);
|
| 176 | 176 | void glRenderer_SetLight(glRenderer *This, DWORD index, LPD3DLIGHT7 light);
|
| 177 | 177 | void glRenderer_RemoveLight(glRenderer *This, DWORD index);
|
| 178 | | -void glRenderer_SetViewport(glRenderer *This, LPD3DVIEWPORT7 lpViewport);
|
| | 178 | +void glRenderer_SetD3DViewport(glRenderer *This, LPD3DVIEWPORT7 lpViewport);
|
| 179 | 179 | void glRenderer_SetTextureColorKey(glRenderer *This, glTexture *texture, DWORD dwFlags, LPDDCOLORKEY lpDDColorKey, GLint level);
|
| 180 | 180 | void glRenderer_MakeTexturePrimary(glRenderer *This, glTexture *texture, glTexture *parent, BOOL primary);
|
| 181 | 181 | void glRenderer_DXGLBreak(glRenderer *This);
|
| — | — | @@ -216,7 +216,7 @@ |
| 217 | 217 | void glRenderer__SetMaterial(glRenderer *This, LPD3DMATERIAL7 lpMaterial);
|
| 218 | 218 | void glRenderer__SetLight(glRenderer *This, DWORD index, LPD3DLIGHT7 light);
|
| 219 | 219 | void glRenderer__RemoveLight(glRenderer *This, DWORD index);
|
| 220 | | -void glRenderer__SetViewport(glRenderer *This, LPD3DVIEWPORT7 lpViewport);
|
| | 220 | +void glRenderer__SetD3DViewport(glRenderer *This, LPD3DVIEWPORT7 lpViewport);
|
| 221 | 221 | void glRenderer__SetTextureColorKey(glRenderer *This, glTexture *texture, DWORD dwFlags, LPDDCOLORKEY lpDDColorKey, GLint level);
|
| 222 | 222 | void glRenderer__MakeTexturePrimary(glRenderer *This, glTexture *texture, glTexture *parent, BOOL primary);
|
| 223 | 223 | void glRenderer__SetDepthComp(glRenderer *This);
|
| Index: ddraw/struct_command.h |
| — | — | @@ -117,8 +117,11 @@ |
| 118 | 118 | DWORD opcode;
|
| 119 | 119 | DWORD size;
|
| 120 | 120 | DWORD count;
|
| 121 | | - D3DRENDERSTATETYPE dwRendStateType;
|
| 122 | | - DWORD dwRenderState;
|
| | 121 | + struct
|
| | 122 | + {
|
| | 123 | + D3DRENDERSTATETYPE dwRendStateType;
|
| | 124 | + DWORD dwRenderState;
|
| | 125 | + } state[1];
|
| 123 | 126 | // For count over 1, use additional pairs to store state changes.
|
| 124 | 127 | } SetRenderStateCmd;
|
| 125 | 128 | typedef struct SetTextureCmd
|
| — | — | @@ -126,8 +129,11 @@ |
| 127 | 130 | DWORD opcode;
|
| 128 | 131 | DWORD size;
|
| 129 | 132 | DWORD count;
|
| 130 | | - DWORD stage;
|
| 131 | | - glTexture *texture;
|
| | 133 | + struct
|
| | 134 | + {
|
| | 135 | + DWORD stage;
|
| | 136 | + glTexture *texture;
|
| | 137 | + } texstage[1];
|
| 132 | 138 | // For count over 1, use additional pairs to store texture changes.
|
| 133 | 139 | } SetTextureCmd;
|
| 134 | 140 | typedef struct SetTextureStageStateCmd
|
| — | — | @@ -136,8 +142,11 @@ |
| 137 | 143 | DWORD size;
|
| 138 | 144 | DWORD count;
|
| 139 | 145 | DWORD dwStage;
|
| 140 | | - D3DTEXTURESTAGESTATETYPE dwState;
|
| 141 | | - DWORD dwValue;
|
| | 146 | + struct
|
| | 147 | + {
|
| | 148 | + D3DTEXTURESTAGESTATETYPE dwState;
|
| | 149 | + DWORD dwValue;
|
| | 150 | + } state[1];
|
| 142 | 151 | // For count over 1, use additional sets to store texture state changes.
|
| 143 | 152 | } SetTextureStageStateCmd;
|
| 144 | 153 | typedef struct SetTransformCmd
|
| — | — | @@ -144,8 +153,12 @@ |
| 145 | 154 | {
|
| 146 | 155 | DWORD opcode;
|
| 147 | 156 | DWORD size;
|
| 148 | | - D3DTRANSFORMSTATETYPE dtstTransformStateType;
|
| 149 | | - D3DMATRIX matrix;
|
| | 157 | + DWORD count;
|
| | 158 | + struct
|
| | 159 | + {
|
| | 160 | + D3DTRANSFORMSTATETYPE dtstTransformStateType;
|
| | 161 | + D3DMATRIX matrix;
|
| | 162 | + } transform[1];
|
| 150 | 163 | } SetTransformCmd;
|
| 151 | 164 | typedef struct SetMaterialCmd
|
| 152 | 165 | {
|
| — | — | @@ -159,7 +172,7 @@ |
| 160 | 173 | DWORD size;
|
| 161 | 174 | DWORD count;
|
| 162 | 175 | DWORD index;
|
| 163 | | - D3DLIGHT7 light;
|
| | 176 | + D3DLIGHT7 light[1];
|
| 164 | 177 | // For count over 1, use additional pairs to store lights
|
| 165 | 178 | } SetLightCmd;
|
| 166 | 179 | typedef struct RemoveLightCmd
|
| — | — | @@ -167,7 +180,77 @@ |
| 168 | 181 | DWORD opcode;
|
| 169 | 182 | DWORD size;
|
| 170 | 183 | DWORD count;
|
| 171 | | - DWORD index;
|
| | 184 | + DWORD index[1];
|
| 172 | 185 | // For count over 1, use additional indices
|
| 173 | 186 | } RemoveLightCmd;
|
| | 187 | +typedef struct SetD3DViewportCmd
|
| | 188 | +{
|
| | 189 | + DWORD opcode;
|
| | 190 | + DWORD size;
|
| | 191 | + D3DVIEWPORT7 viewport;
|
| | 192 | +} SetD3DViewportCmd;
|
| | 193 | +typedef struct SetTextureColorKeyCmd
|
| | 194 | +{
|
| | 195 | + DWORD opcode;
|
| | 196 | + DWORD size;
|
| | 197 | + glTexture *texture;
|
| | 198 | + DWORD flags;
|
| | 199 | + DDCOLORKEY colorkey;
|
| | 200 | + GLint level;
|
| | 201 | +} SetTextureColorKeyCmd;
|
| | 202 | +typedef struct MakeTexturePrimaryCmd
|
| | 203 | +{
|
| | 204 | + DWORD opcode;
|
| | 205 | + DWORD size;
|
| | 206 | + glTexture *texture;
|
| | 207 | + glTexture *parent;
|
| | 208 | + BOOL primary;
|
| | 209 | +} MakeTexturePrimaryCmd;
|
| | 210 | +typedef struct DXGLBreakCmd
|
| | 211 | +{
|
| | 212 | + DWORD opcode;
|
| | 213 | + DWORD size;
|
| | 214 | +} DXGLBreakCmd;
|
| | 215 | +typedef struct InitTextureStageCmd
|
| | 216 | +{
|
| | 217 | + DWORD opcode;
|
| | 218 | + DWORD size;
|
| | 219 | + DWORD count;
|
| | 220 | + DWORD stage[1];
|
| | 221 | +} InitTextureStageCmd;
|
| | 222 | +
|
| | 223 | +typedef struct MIN_STORAGE_Cmd
|
| | 224 | +{
|
| | 225 | + BYTE data[256];
|
| | 226 | +} MIN_STORAGE_CMD;
|
| | 227 | +
|
| | 228 | +typedef union QueueCmd
|
| | 229 | +{
|
| | 230 | + MakeTextureCmd MakeTexture;
|
| | 231 | + UploadTextureCmd UploadTexture;
|
| | 232 | + DownloadTextureCmd DownloadTexture;
|
| | 233 | + DeleteTextureCmd DeleteTexture;
|
| | 234 | + BltCmd Blt;
|
| | 235 | + DrawScreenCmd DrawScreen;
|
| | 236 | + InitD3DCmd InitD3D;
|
| | 237 | + ClearCmd Clear;
|
| | 238 | + FlushCmd Flush;
|
| | 239 | + DrawPrimitivesCmd DrawPrimitives;
|
| | 240 | + UpdateClipperCmd UpdateClipper;
|
| | 241 | + DepthFillCmd DepthFill;
|
| | 242 | + SetRenderStateCmd SetRenderState;
|
| | 243 | + SetTextureCmd SetTexture;
|
| | 244 | + SetTextureStageStateCmd SetTextureStageState;
|
| | 245 | + SetTransformCmd SetTransform;
|
| | 246 | + SetMaterialCmd SetMaterial;
|
| | 247 | + SetLightCmd SetLight;
|
| | 248 | + RemoveLightCmd RemoveLight;
|
| | 249 | + SetD3DViewportCmd SetD3DViewport;
|
| | 250 | + SetTextureColorKeyCmd SetTextureColorKey;
|
| | 251 | + MakeTexturePrimaryCmd MakeTexturePrimary;
|
| | 252 | + DXGLBreakCmd DXGLBreak;
|
| | 253 | + InitTextureStageCmd InitTextureStage;
|
| | 254 | + MIN_STORAGE_CMD MIN_STORAGE;
|
| | 255 | +} QueueCmd;
|
| | 256 | +
|
| 174 | 257 | #endif //__STRUCT_COMMAND_H |
| \ No newline at end of file |