updated on Thu Jan 19 16:10:29 UTC 2012
[aur-mirror.git] / wine-laa / wine-laa.patch
blobb892f45bc38bd1b6af746bc7458c4a594ffb6832
1 diff -urB wine/dlls/kernel32/heap.c wine/dlls/kernel32/heap.c
2 --- wine/dlls/kernel32/heap.c 2011-12-16 19:15:33.000000000 +0000
3 +++ wine/dlls/kernel32/heap.c 2011-12-19 17:08:41.686061500 +0000
4 @@ -1351,6 +1351,7 @@
6 /* values are limited to 2Gb unless the app has the IMAGE_FILE_LARGE_ADDRESS_AWARE flag */
7 /* page file sizes are not limited (Adobe Illustrator 8 depends on this) */
8 + /*
9 if (!(nt->FileHeader.Characteristics & IMAGE_FILE_LARGE_ADDRESS_AWARE))
11 if (lpBuffer->dwTotalPhys > MAXLONG) lpBuffer->dwTotalPhys = MAXLONG;
12 @@ -1358,6 +1359,7 @@
13 if (lpBuffer->dwTotalVirtual > MAXLONG) lpBuffer->dwTotalVirtual = MAXLONG;
14 if (lpBuffer->dwAvailVirtual > MAXLONG) lpBuffer->dwAvailVirtual = MAXLONG;
16 + */
18 /* work around for broken photoshop 4 installer */
19 if ( lpBuffer->dwAvailPhys + lpBuffer->dwAvailPageFile >= 2U*1024*1024*1024)
20 diff -urB wine/dlls/ntdll/loader.c wine/dlls/ntdll/loader.c
21 --- wine/dlls/ntdll/loader.c 2011-12-16 19:15:33.000000000 +0000
22 +++ wine/dlls/ntdll/loader.c 2011-12-19 17:04:12.512726601 +0000
23 @@ -2663,7 +2663,8 @@
24 status = wine_call_on_stack( attach_process_wine/dlls, wm, NtCurrentTeb()->Tib.StackBase );
25 if (status != STATUS_SUCCESS) goto error;
27 - virtual_release_address_space( nt->FileHeader.Characteristics & IMAGE_FILE_LARGE_ADDRESS_AWARE );
28 + //virtual_release_address_space( nt->FileHeader.Characteristics & IMAGE_FILE_LARGE_ADDRESS_AWARE );
29 + virtual_release_address_space( IMAGE_FILE_LARGE_ADDRESS_AWARE );
30 virtual_clear_thread_stack();
31 wine_switch_to_stack( start_process, kernel_start, NtCurrentTeb()->Tib.StackBase );
33 diff -urB wine/dlls/wined3d/directx.c wine/dlls/wined3d/directx.c
34 --- wine/dlls/wined3d/directx.c
35 +++ wine/dlls/wined3d/directx.c
36 @@ -4673,8 +4673,13 @@ HRESULT CDECL wined3d_get_device_caps(const struct wined3d *wined3d, UINT adapte
37 caps->MaxUserClipPlanes = gl_info->limits.clipplanes;
38 caps->MaxActiveLights = gl_info->limits.lights;
40 - caps->MaxVertexBlendMatrices = gl_info->limits.blends;
41 - caps->MaxVertexBlendMatrixIndex = 0;
42 + if (gl_info->supported[ARB_VERTEX_BLEND]) {
43 + caps->MaxVertexBlendMatrices = gl_info->limits.blends;
44 + caps->MaxVertexBlendMatrixIndex = 0;
45 + } else {
46 + caps->MaxVertexBlendMatrices = 4;
47 + caps->MaxVertexBlendMatrixIndex = 255;
48 + }
50 caps->MaxAnisotropy = gl_info->limits.anisotropy;
51 caps->MaxPointSize = gl_info->limits.pointsize_max;
52 diff -urB wine/dlls/wined3d/drawprim.c wine/dlls/wined3d/drawprim.c
53 --- wine/dlls/wined3d/drawprim.c
54 +++ wine/dlls/wined3d/drawprim.c
55 @@ -60,6 +60,75 @@ static void drawStridedFast(const struct wined3d_gl_info *gl_info, GLenum primit
59 + * Emit a vertex using swoftware vertex blending
60 + */
61 +static void emitBlendedVertex(struct wined3d_stateblock *stateBlock,
62 + const float *weights, int nweights, const BYTE *indices,
63 + const float *pos, const float *norm)
65 + const float *m;
66 + float vec[4];
67 + float mat[4*4];
68 + float last = 1.f;
69 + int i, j;
71 + /* compute the weighted sum of the matrices */
72 + m = &stateBlock->state.transforms[WINED3DTS_WORLDMATRIX((indices ? indices[0] : 0))].u.m[0][0];
73 + for (j = 0; j < 16; j++)
74 + mat[j] = m[j] * weights[0];
75 + last -= weights[0];
77 + for (i = 1; i < nweights; i++) {
78 + if (weights[i]) {
79 + m = &stateBlock->state.transforms[WINED3DTS_WORLDMATRIX((indices ? indices[i] : i))].u.m[0][0];
80 + for (j = 0; j < 16; j++)
81 + mat[j] += m[j] * weights[i];
82 + last -= weights[i];
83 + }
84 + }
86 + /* do the last */
87 + if (last) {
88 + m = &stateBlock->state.transforms[WINED3DTS_WORLDMATRIX((indices ? indices[i] : i))].u.m[0][0];
89 + for (j = 0; j < 16; j++)
90 + mat[j] += m[j] * last;
91 + }
93 + if (norm) {
94 + /* compute the resulting normal */
95 + vec[0] = norm[0] * mat[0] + norm[1] * mat[4] + norm[2] * mat[8];
96 + vec[1] = norm[0] * mat[1] + norm[1] * mat[5] + norm[2] * mat[9];
97 + vec[2] = norm[0] * mat[2] + norm[1] * mat[6] + norm[2] * mat[10];
98 + /* normalize */
99 + vec[3] = vec[0]*vec[0] + vec[1]*vec[1] + vec[2]*vec[2];
100 + if (vec[3]) {
101 + vec[3] = 1.f / sqrtf(vec[3]);
102 + vec[0] *= vec[3];
103 + vec[1] *= vec[3];
104 + vec[2] *= vec[3];
107 + glNormal3fv(vec);
110 + if (pos) {
111 + /* compute the resulting position */
112 + vec[0] = pos[0] * mat[0] + pos[1] * mat[4] + pos[2] * mat[8] + mat[12];
113 + vec[1] = pos[0] * mat[1] + pos[1] * mat[5] + pos[2] * mat[9] + mat[13];
114 + vec[2] = pos[0] * mat[2] + pos[1] * mat[6] + pos[2] * mat[10] + mat[14];
115 + vec[3] = pos[0] * mat[3] + pos[1] * mat[7] + pos[2] * mat[11] + mat[15];
116 + /* normalize */
117 + if (vec[3]) {
118 + vec[0] /= vec[3];
119 + vec[1] /= vec[3];
120 + vec[2] /= vec[3];
123 + glVertex3fv(vec);
128 * Actually draw using the supplied information.
129 * Slower GL version which extracts info about each vertex in turn
131 @@ -78,7 +147,8 @@ static void drawStridedSlow(const struct wined3d_device *device, const struct wi
132 BOOL pixelShader = use_ps(state);
133 BOOL specular_fog = FALSE;
134 const BYTE *texCoords[WINED3DDP_MAXTEXCOORD];
135 - const BYTE *diffuse = NULL, *specular = NULL, *normal = NULL, *position = NULL;
136 + const BYTE *diffuse = NULL, *specular = NULL, *normal = NULL, *position = NULL, *weights = NULL, *indices = NULL;
137 + int nweights = 0;
138 const struct wined3d_gl_info *gl_info = context->gl_info;
139 UINT texture_stages = gl_info->limits.texture_stages;
140 const struct wined3d_stream_info_element *element;
141 @@ -171,6 +241,31 @@ static void drawStridedSlow(const struct wined3d_device *device, const struct wi
142 GL_EXTCALL(glSecondaryColor3fEXT)(0, 0, 0);
145 + if (device->vertexBlendSW) {
146 + if (!si->elements[WINED3D_FFP_BLENDWEIGHT].data.addr) {
147 + WARN("vertex blending enabled but blendWeights.data=NULL\n");
148 + } else if (si->elements[WINED3D_FFP_BLENDWEIGHT].format->gl_vtx_type != GL_FLOAT) {
149 + FIXME("unsupported blend weights datatype (%d)\n", si->elements[WINED3D_FFP_BLENDWEIGHT].format->id);
150 + } else if (position && si->elements[WINED3D_FFP_POSITION].format->emit_idx != WINED3D_FFP_EMIT_FLOAT3) {
151 + FIXME("unsupported postion datatype (%d)\n", si->elements[WINED3D_FFP_POSITION].format->id);
152 + } else if (normal && si->elements[WINED3D_FFP_NORMAL].format->emit_idx != WINED3D_FFP_EMIT_FLOAT3) {
153 + FIXME("unsupported normal datatype (%d)\n", si->elements[WINED3D_FFP_NORMAL].format->id);
154 + } else {
155 + element = &si->elements[WINED3D_FFP_BLENDWEIGHT];
156 + weights = element->data.addr;
157 + nweights = element->format->gl_vtx_format;
160 + if (si->elements[WINED3D_FFP_BLENDINDICES].data.addr) {
161 + if (si->elements[WINED3D_FFP_BLENDINDICES].format->emit_idx != WINED3D_FFP_EMIT_UBYTE4) {
162 + FIXME("unsupported blend indices datatype (%d)\n", si->elements[WINED3D_FFP_BLENDINDICES].format->id);
163 + } else {
164 + element = &si->elements[WINED3D_FFP_BLENDINDICES];
165 + indices = element->data.addr;
170 for (textureNo = 0; textureNo < texture_stages; ++textureNo)
172 int coordIdx = state->texture_states[textureNo][WINED3DTSS_TEXCOORDINDEX];
173 @@ -287,17 +382,25 @@ static void drawStridedSlow(const struct wined3d_device *device, const struct wi
177 - /* Normal -------------------------------- */
178 + if (weights) {
179 + emitBlendedVertex(device->stateBlock,
180 + (const float*)(weights + SkipnStrides * si->elements[WINED3D_FFP_BLENDWEIGHT].stride), nweights,
181 + indices ? (indices + SkipnStrides * si->elements[WINED3D_FFP_BLENDINDICES].stride) : NULL,
182 + (const float*)(position ? (position + SkipnStrides * si->elements[WINED3D_FFP_POSITION].stride) : NULL),
183 + (const float*)(normal ? (normal + SkipnStrides * si->elements[WINED3D_FFP_NORMAL].stride) : NULL));
184 + } else {
185 + /* Normal -------------------------------- */
186 if (normal)
188 - const void *ptrToCoords = normal + SkipnStrides * si->elements[WINED3D_FFP_NORMAL].stride;
189 + const void *ptrToCoords = normal + SkipnStrides * si->elements[WINED3D_FFP_NORMAL].stride;
190 normal_funcs[si->elements[WINED3D_FFP_NORMAL].format->emit_idx](ptrToCoords);
194 - /* Position -------------------------------- */
195 - if (position) {
196 - const void *ptrToCoords = position + SkipnStrides * si->elements[WINED3D_FFP_POSITION].stride;
197 + /* Position -------------------------------- */
198 + if (position) {
199 + const void *ptrToCoords = position + SkipnStrides * si->elements[WINED3D_FFP_POSITION].stride;
200 position_funcs[si->elements[WINED3D_FFP_POSITION].format->emit_idx](ptrToCoords);
204 /* For non indexed mode, step onto next parts */
205 @@ -696,6 +799,17 @@ void drawPrimitive(struct wined3d_device *device, UINT index_count, UINT StartId
207 emulation = TRUE;
209 + else if (device->vertexBlendSW)
211 + static BOOL warned;
212 + if (!warned) {
213 + FIXME("Using software emulation because vertex blending is enabled\n");
214 + warned = TRUE;
215 + } else {
216 + TRACE("Using software emulation because vertex blending is enabled\n");
218 + emulation = TRUE;
221 if(emulation) {
222 stream_info = &stridedlcl;
223 diff -urB wine/dlls/wined3d/state.c wine/dlls/wined3d/state.c
224 --- wine/dlls/wined3d/state.c
225 +++ wine/dlls/wined3d/state.c
226 @@ -3662,7 +3662,7 @@ static void transform_world(struct wined3d_context *context, const struct wined3
227 glLoadIdentity();
228 checkGLcall("glLoadIdentity()");
230 - else
231 + else if (!context->swapchain->device->vertexBlendSW)
233 /* In the general case, the view matrix is the identity matrix */
234 if (context->swapchain->device->view_ident)
235 @@ -3677,6 +3677,9 @@ static void transform_world(struct wined3d_context *context, const struct wined3
236 glMultMatrixf(&state->transforms[WINED3DTS_WORLDMATRIX(0)].u.m[0][0]);
237 checkGLcall("glMultMatrixf");
239 + } else {
240 + glLoadMatrixf(&state->transforms[WINED3DTS_VIEW].u.m[0][0]);
241 + checkGLcall("glLoadMatrixf");
245 @@ -3812,11 +3812,30 @@ static void state_vertexblend_w(struct wined3d_context *context, const struct wi
246 enum wined3d_vertex_blend_flags f = state->render_states[WINED3D_RS_VERTEXBLEND];
247 static unsigned int once;
249 - if (f == WINED3D_VBF_DISABLE)
250 - return;
252 - if (!once++) FIXME("Vertex blend flags %#x not supported.\n", f);
253 - else WARN("Vertex blend flags %#x not supported.\n", f);
254 + switch (f) {
255 + case WINED3D_VBF_0WEIGHTS:
256 + case WINED3D_VBF_1WEIGHTS:
257 + case WINED3D_VBF_2WEIGHTS:
258 + case WINED3D_VBF_3WEIGHTS:
259 + if(!once) {
260 + once = TRUE;
261 + FIXME("Vertex blending enabled, but not supported by hardware. Using software emulation.\n");
263 + if (!context->swapchain->device->vertexBlendSW) {
264 + context->swapchain->device->vertexBlendSW = TRUE;
265 + transform_world(context, state, state_id);
267 + break;
268 + case WINED3D_VBF_TWEENING:
269 + WARN("Vertex blend flags %#x not supported.\n", f);
270 + /* fall through */
271 + default:
272 + if (context->swapchain->device->vertexBlendSW) {
273 + context->swapchain->device->vertexBlendSW = FALSE;
274 + transform_world(context, state, state_id);
276 + break;
280 static void state_vertexblend(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
281 diff -urB wine/dlls/wined3d/vertexdeclaration.c wine/dlls/wined3d/vertexdeclaration.c
282 --- wine/dlls/wined3d/vertexdeclaration.c
283 +++ wine/dlls/wined3d/vertexdeclaration.c
284 @@ -107,6 +107,15 @@ static BOOL declaration_element_valid_ffp(const WINED3DVERTEXELEMENT *element)
285 return FALSE;
288 + case WINED3DDECLUSAGE_BLENDINDICES:
289 + switch(element->format)
291 + case WINED3DFMT_R8G8B8A8_UINT:
292 + return TRUE;
293 + default:
294 + return FALSE;
297 case WINED3DDECLUSAGE_NORMAL:
298 switch(element->format)
300 diff -urB wine/dlls/wined3d/wined3d_private.h wine/dlls/wined3d/wined3d_private.h
301 --- wine/dlls/wined3d/wined3d_private.h
302 +++ wine/dlls/wined3d/wined3d_private.h
303 @@ -1672,6 +1672,7 @@ struct wined3d_device
305 WORD view_ident : 1; /* true iff view matrix is identity */
306 WORD vertexBlendUsed : 1; /* To avoid needless setting of the blend matrices */
307 + WORD vertexBlendSW : 1; /* vertexBlend software fallback used */
308 WORD isRecordingState : 1;
309 WORD isInDraw : 1;
310 WORD bCursorVisible : 1;