| Index: ddraw/glRenderer.cpp |
| — | — | @@ -161,14 +161,23 @@ |
| 162 | 162 | {
|
| 163 | 163 | argsize = va_arg(params, int);
|
| 164 | 164 | argptr = va_arg(params, void*);
|
| 165 | | - if (!argsize) continue;
|
| | 165 | + if (!argsize)
|
| | 166 | + {
|
| | 167 | + This->queue[This->queue_write++] = argsize;
|
| | 168 | + size -= 1;
|
| | 169 | + continue;
|
| | 170 | + }
|
| 166 | 171 | if ((NextMultipleOf4(argsize) / 4) > size) break;
|
| 167 | 172 | This->queue[This->queue_write++] = argsize;
|
| 168 | 173 | if (argptr) memcpy(This->queue + This->queue_write, argptr, argsize);
|
| 169 | 174 | This->queue_write += (NextMultipleOf4(argsize) / 4);
|
| 170 | | - size -= (NextMultipleOf4(argsize) / 4);
|
| | 175 | + size -= 1 + (NextMultipleOf4(argsize) / 4);
|
| 171 | 176 | }
|
| 172 | 177 | va_end(params);
|
| | 178 | + if (size != 0)
|
| | 179 | + {
|
| | 180 | + FIXME("Opcode size mismatch!\n")
|
| | 181 | + }
|
| 173 | 182 | This->queuelength++;
|
| 174 | 183 | if (!This->running) SetEvent(This->start);
|
| 175 | 184 | LeaveCriticalSection(&This->queuecs);
|
| — | — | @@ -742,9 +751,9 @@ |
| 743 | 752 | DWORD vertsize = 0;
|
| 744 | 753 | DWORD indexsize = 0;
|
| 745 | 754 | if (!indices) indexcount = 0;
|
| 746 | | - vertsize = (stride * count) / 4;
|
| 747 | | - indexsize = NextMultipleOf2(indexcount) / 2;
|
| 748 | | - glRenderer_AddQueue(This, OP_DRAWPRIMITIVES, 0, 16 + vertsize + indexsize, 8, 4, &device,
|
| | 755 | + vertsize = stride * count;
|
| | 756 | + indexsize = NextMultipleOf4(indexcount * 2);
|
| | 757 | + glRenderer_AddQueue(This, OP_DRAWPRIMITIVES, 0, 16 + ((vertsize + indexsize)/4), 8, 4, &device,
|
| 749 | 758 | 4, &mode, 4, &stride, 4, &dwVertexTypeDesc, 4, &count, 4, &indexcount,
|
| 750 | 759 | vertsize, vertices, indexsize, indices);
|
| 751 | 760 | if (flags & D3DDP_WAIT) glRenderer_Sync(This, 0);
|
| — | — | @@ -876,7 +885,7 @@ |
| 877 | 886 | {
|
| 878 | 887 | EnterCriticalSection(&This->commandcs);
|
| 879 | 888 | if (!This->running) memcpy(&This->transform[dtstTransformStateType], lpD3DMatrix, sizeof(D3DMATRIX));
|
| 880 | | - else glRenderer_AddQueue(This, OP_SETTRANSFORM, 0, 4 + (sizeof(D3DMATRIX) / 4), 2,
|
| | 889 | + else glRenderer_AddQueue(This, OP_SETTRANSFORM, 0, 5 + (sizeof(D3DMATRIX) / 4), 2,
|
| 881 | 890 | 4, &dtstTransformStateType, sizeof(D3DMATRIX), lpD3DMatrix);
|
| 882 | 891 | LeaveCriticalSection(&This->commandcs);
|
| 883 | 892 | }
|
| — | — | @@ -892,8 +901,8 @@ |
| 893 | 902 | {
|
| 894 | 903 | EnterCriticalSection(&This->commandcs);
|
| 895 | 904 | if (!This->running) memcpy(&This->material, lpMaterial, sizeof(D3DMATERIAL7));
|
| 896 | | - glRenderer_AddQueue(This, OP_SETMATERIAL, 0, 2 + (sizeof(D3DMATERIAL7) / 4), 1,
|
| 897 | | - sizeof(D3DMATERIAL), lpMaterial);
|
| | 905 | + glRenderer_AddQueue(This, OP_SETMATERIAL, 0, 3 + (sizeof(D3DMATERIAL7) / 4), 1,
|
| | 906 | + sizeof(D3DMATERIAL7), lpMaterial);
|
| 898 | 907 | LeaveCriticalSection(&This->commandcs);
|
| 899 | 908 | }
|
| 900 | 909 |
|
| — | — | @@ -917,7 +926,7 @@ |
| 918 | 927 | DWORD _remove = remove;
|
| 919 | 928 | if (light) light7 = light;
|
| 920 | 929 | else light7 = &null_light;
|
| 921 | | - glRenderer_AddQueue(This, OP_SETLIGHT, 0, 6 + (sizeof(D3DLIGHT7) / 4), 3, 4, &index,
|
| | 930 | + glRenderer_AddQueue(This, OP_SETLIGHT, 0, 7 + (sizeof(D3DLIGHT7) / 4), 3, 4, &index,
|
| 922 | 931 | 4, &_remove, sizeof(D3DLIGHT7), light7);
|
| 923 | 932 | LeaveCriticalSection(&This->commandcs);
|
| 924 | 933 | }
|
| — | — | @@ -932,7 +941,7 @@ |
| 933 | 942 | void glRenderer_SetViewport(glRenderer *This, LPD3DVIEWPORT7 lpViewport)
|
| 934 | 943 | {
|
| 935 | 944 | EnterCriticalSection(&This->commandcs);
|
| 936 | | - glRenderer_AddQueue(This, OP_SETVIEWPORT, 0, 2 + (sizeof(D3DVIEWPORT7) / 4), 1,
|
| | 945 | + glRenderer_AddQueue(This, OP_SETVIEWPORT, 0, 3 + (sizeof(D3DVIEWPORT7) / 4), 1,
|
| 937 | 946 | sizeof(D3DVIEWPORT7), lpViewport);
|
| 938 | 947 | LeaveCriticalSection(&This->commandcs);
|
| 939 | 948 | }
|
| — | — | @@ -1111,21 +1120,21 @@ |
| 1112 | 1121 | (D3DTEXTURESTAGESTATETYPE)This->queue[This->queue_read + 5], (DWORD)This->queue[This->queue_read + 7]);
|
| 1113 | 1122 | break;
|
| 1114 | 1123 | case OP_SETTRANSFORM:
|
| 1115 | | - if (This->queue[This->queue_read + 1] != (4 + (sizeof(D3DMATRIX) / 4))) break;
|
| | 1124 | + if (This->queue[This->queue_read + 1] != (5 + (sizeof(D3DMATRIX) / 4))) break;
|
| 1116 | 1125 | glRenderer__SetTransform(This, (D3DTRANSFORMSTATETYPE)This->queue[This->queue_read + 3],
|
| 1117 | 1126 | (LPD3DMATRIX)&This->queue[This->queue_read + 5]);
|
| 1118 | 1127 | break;
|
| 1119 | 1128 | case OP_SETMATERIAL:
|
| 1120 | | - if (This->queue[This->queue_read + 1] != (2 + (sizeof(D3DMATERIAL7) / 4))) break;
|
| | 1129 | + if (This->queue[This->queue_read + 1] != (3 + (sizeof(D3DMATERIAL7) / 4))) break;
|
| 1121 | 1130 | glRenderer__SetMaterial(This, (LPD3DMATERIAL7)&This->queue[This->queue_read + 3]);
|
| 1122 | 1131 | break;
|
| 1123 | 1132 | case OP_SETLIGHT:
|
| 1124 | | - if (This->queue[This->queue_read + 1] != (6 + (sizeof(D3DLIGHT7) / 4))) break;
|
| | 1133 | + if (This->queue[This->queue_read + 1] != (7 + (sizeof(D3DLIGHT7) / 4))) break;
|
| 1125 | 1134 | glRenderer__SetLight(This, (DWORD)This->queue[This->queue_read + 3], (LPD3DLIGHT7)&This->queue[This->queue_read + 7],
|
| 1126 | 1135 | (BOOL)This->queue[This->queue_read + 5]);
|
| 1127 | 1136 | break;
|
| 1128 | 1137 | case OP_SETVIEWPORT:
|
| 1129 | | - if (This->queue[This->queue_read + 1] != (2 + (sizeof(D3DVIEWPORT7) / 4))) break;
|
| | 1138 | + if (This->queue[This->queue_read + 1] != (3 + (sizeof(D3DVIEWPORT7) / 4))) break;
|
| 1130 | 1139 | glRenderer__SetViewport(This, (LPD3DVIEWPORT7)&This->queue[This->queue_read + 3]);
|
| 1131 | 1140 | break;
|
| 1132 | 1141 | case OP_RESETQUEUE:
|