/***************************************************************************** * IDirect3DVertexBuffer7::ProcessVertices * * Processes untransformed Vertices into a transformed or optimized vertex * buffer. It can also perform other operations, such as lighting or clipping * * Params * VertexOp: Operation(s) to perform: D3DVOP_CLIP, _EXTENTS, _LIGHT, _TRANSFORM * DestIndex: Index in the destination buffer(This), where the vertices are * placed * Count: Number of Vertices in the Source buffer to process * SrcBuffer: Source vertex buffer * SrcIndex: Index of the first vertex in the src buffer to process * D3DDevice: Device to use for transformation * Flags: 0 for default, D3DPV_DONOTCOPYDATA to prevent copying * unchaned vertices * * Returns: * D3D_OK on success * DDERR_INVALIDPARAMS If D3DVOP_TRANSFORM wasn't passed * *****************************************************************************/ static HRESULT WINAPI IDirect3DVertexBufferImpl_ProcessVertices(IDirect3DVertexBuffer7 *iface, DWORD VertexOp, DWORD DestIndex, DWORD Count, IDirect3DVertexBuffer7 *SrcBuffer, DWORD SrcIndex, IDirect3DDevice7 *D3DDevice, DWORD Flags) { IDirect3DVertexBufferImpl *This = (IDirect3DVertexBufferImpl *)iface; IDirect3DVertexBufferImpl *Src = (IDirect3DVertexBufferImpl *)SrcBuffer; IDirect3DDeviceImpl *D3D = (IDirect3DDeviceImpl *)D3DDevice; BOOL oldClip, doClip; HRESULT hr; TRACE("iface %p, vertex_op %#x, dst_idx %u, count %u, src_buffer %p, src_idx %u, device %p, flags %#x.\n", iface, VertexOp, DestIndex, Count, SrcBuffer, SrcIndex, D3DDevice, Flags); /* Vertex operations: * D3DVOP_CLIP: Clips vertices outside the viewing frustrum. Needs clipping information * in the vertex buffer (Buffer may not be created with D3DVBCAPS_DONOTCLIP) * D3DVOP_EXTENTS: Causes the screen extents to be updated when rendering the vertices * D3DVOP_LIGHT: Lights the vertices * D3DVOP_TRANSFORM: Transform the vertices. This flag is necessary * * WineD3D only transforms and clips the vertices by now, so EXTENTS and LIGHT * are not implemented. Clipping is disabled ATM, because of unsure conditions. */ if( !(VertexOp & D3DVOP_TRANSFORM) ) return DDERR_INVALIDPARAMS; EnterCriticalSection(&ddraw_cs); /* WineD3D doesn't know d3d7 vertex operation, it uses * render states instead. Set the render states according to * the vertex ops */ doClip = VertexOp & D3DVOP_CLIP ? TRUE : FALSE; wined3d_device_get_render_state(D3D->wined3d_device, WINED3DRS_CLIPPING, (DWORD *)&oldClip); if (doClip != oldClip) wined3d_device_set_render_state(D3D->wined3d_device, WINED3DRS_CLIPPING, doClip); wined3d_device_set_stream_source(D3D->wined3d_device, 0, Src->wineD3DVertexBuffer, 0, get_flexible_vertex_size(Src->fvf)); wined3d_device_set_vertex_declaration(D3D->wined3d_device, Src->wineD3DVertexDeclaration); hr = wined3d_device_process_vertices(D3D->wined3d_device, SrcIndex, DestIndex, Count, This->wineD3DVertexBuffer, NULL, Flags, This->fvf); /* Restore the states if needed */ if (doClip != oldClip) wined3d_device_set_render_state(D3D->wined3d_device, WINED3DRS_CLIPPING, oldClip); LeaveCriticalSection(&ddraw_cs); return hr; }
/***************************************************************************** * IDirect3DVertexBuffer7::ProcessVertices * * Processes untransformed Vertices into a transformed or optimized vertex * buffer. It can also perform other operations, such as lighting or clipping * * Params * VertexOp: Operation(s) to perform: D3DVOP_CLIP, _EXTENTS, _LIGHT, _TRANSFORM * DestIndex: Index in the destination buffer(This), where the vertices are * placed * Count: Number of Vertices in the Source buffer to process * SrcBuffer: Source vertex buffer * SrcIndex: Index of the first vertex in the src buffer to process * D3DDevice: Device to use for transformation * Flags: 0 for default, D3DPV_DONOTCOPYDATA to prevent copying * unchaned vertices * * Returns: * D3D_OK on success * DDERR_INVALIDPARAMS If D3DVOP_TRANSFORM wasn't passed * *****************************************************************************/ static HRESULT WINAPI d3d_vertex_buffer7_ProcessVertices(IDirect3DVertexBuffer7 *iface, DWORD vertex_op, DWORD dst_idx, DWORD count, IDirect3DVertexBuffer7 *src_buffer, DWORD src_idx, IDirect3DDevice7 *device, DWORD flags) { struct d3d_vertex_buffer *dst_buffer_impl = impl_from_IDirect3DVertexBuffer7(iface); struct d3d_vertex_buffer *src_buffer_impl = unsafe_impl_from_IDirect3DVertexBuffer7(src_buffer); struct d3d_device *device_impl = unsafe_impl_from_IDirect3DDevice7(device); BOOL oldClip, doClip; HRESULT hr; TRACE("iface %p, vertex_op %#x, dst_idx %u, count %u, src_buffer %p, src_idx %u, device %p, flags %#x.\n", iface, vertex_op, dst_idx, count, src_buffer, src_idx, device, flags); /* Vertex operations: * D3DVOP_CLIP: Clips vertices outside the viewing frustrum. Needs clipping information * in the vertex buffer (Buffer may not be created with D3DVBCAPS_DONOTCLIP) * D3DVOP_EXTENTS: Causes the screen extents to be updated when rendering the vertices * D3DVOP_LIGHT: Lights the vertices * D3DVOP_TRANSFORM: Transform the vertices. This flag is necessary * * WineD3D only transforms and clips the vertices by now, so EXTENTS and LIGHT * are not implemented. Clipping is disabled ATM, because of unsure conditions. */ if (!(vertex_op & D3DVOP_TRANSFORM)) return DDERR_INVALIDPARAMS; wined3d_mutex_lock(); /* WineD3D doesn't know d3d7 vertex operation, it uses * render states instead. Set the render states according to * the vertex ops */ doClip = !!(vertex_op & D3DVOP_CLIP); oldClip = wined3d_device_get_render_state(device_impl->wined3d_device, WINED3D_RS_CLIPPING); if (doClip != oldClip) wined3d_device_set_render_state(device_impl->wined3d_device, WINED3D_RS_CLIPPING, doClip); wined3d_device_set_stream_source(device_impl->wined3d_device, 0, src_buffer_impl->wineD3DVertexBuffer, 0, get_flexible_vertex_size(src_buffer_impl->fvf)); wined3d_device_set_vertex_declaration(device_impl->wined3d_device, src_buffer_impl->wineD3DVertexDeclaration); hr = wined3d_device_process_vertices(device_impl->wined3d_device, src_idx, dst_idx, count, dst_buffer_impl->wineD3DVertexBuffer, NULL, flags, dst_buffer_impl->fvf); /* Restore the states if needed */ if (doClip != oldClip) wined3d_device_set_render_state(device_impl->wined3d_device, WINED3D_RS_CLIPPING, oldClip); wined3d_mutex_unlock(); return hr; }
/***************************************************************************** * IDirect3DExecuteBufferImpl_Execute * * The main functionality of the execute buffer * It transforms the vertices if necessary, and calls IDirect3DDevice7 * for drawing the vertices. It is called from * IDirect3DDevice::Execute * * TODO: Perhaps some comments about the various opcodes wouldn't hurt * * Don't declare this static, as it's called from device.c, * IDirect3DDevice::Execute * * Params: * Device: 3D Device associated to use for drawing * Viewport: Viewport for this operation * *****************************************************************************/ HRESULT d3d_execute_buffer_execute(IDirect3DExecuteBufferImpl *This, IDirect3DDeviceImpl *lpDevice, IDirect3DViewportImpl *lpViewport) { /* DWORD bs = This->desc.dwBufferSize; */ DWORD vs = This->data.dwVertexOffset; /* DWORD vc = This->data.dwVertexCount; */ DWORD is = This->data.dwInstructionOffset; /* DWORD il = This->data.dwInstructionLength; */ char *instr = (char *)This->desc.lpData + is; if (lpViewport->active_device != lpDevice) { WARN("Viewport %p active device is %p.\n", lpViewport, lpViewport->active_device); return DDERR_INVALIDPARAMS; } /* Activate the viewport */ viewport_activate(lpViewport, FALSE); TRACE("ExecuteData :\n"); if (TRACE_ON(ddraw)) _dump_executedata(&(This->data)); while (1) { LPD3DINSTRUCTION current = (LPD3DINSTRUCTION) instr; BYTE size; WORD count; count = current->wCount; size = current->bSize; instr += sizeof(D3DINSTRUCTION); switch (current->bOpcode) { case D3DOP_POINT: { WARN("POINT-s (%d)\n", count); instr += count * size; } break; case D3DOP_LINE: { WARN("LINE-s (%d)\n", count); instr += count * size; } break; case D3DOP_TRIANGLE: { int i; D3DTLVERTEX *tl_vx = This->vertex_data; TRACE("TRIANGLE (%d)\n", count); if (count*3>This->nb_indices) { This->nb_indices = count * 3; HeapFree(GetProcessHeap(),0,This->indices); This->indices = HeapAlloc(GetProcessHeap(),0,sizeof(WORD)*This->nb_indices); } for (i = 0; i < count; i++) { LPD3DTRIANGLE ci = (LPD3DTRIANGLE) instr; TRACE(" v1: %d v2: %d v3: %d\n",ci->u1.v1, ci->u2.v2, ci->u3.v3); TRACE(" Flags : "); if (TRACE_ON(ddraw)) { /* Wireframe */ if (ci->wFlags & D3DTRIFLAG_EDGEENABLE1) TRACE("EDGEENABLE1 "); if (ci->wFlags & D3DTRIFLAG_EDGEENABLE2) TRACE("EDGEENABLE2 "); if (ci->wFlags & D3DTRIFLAG_EDGEENABLE1) TRACE("EDGEENABLE3 "); /* Strips / Fans */ if (ci->wFlags == D3DTRIFLAG_EVEN) TRACE("EVEN "); if (ci->wFlags == D3DTRIFLAG_ODD) TRACE("ODD "); if (ci->wFlags == D3DTRIFLAG_START) TRACE("START "); if ((ci->wFlags > 0) && (ci->wFlags < 30)) TRACE("STARTFLAT(%u) ", ci->wFlags); TRACE("\n"); } This->indices[(i * 3) ] = ci->u1.v1; This->indices[(i * 3) + 1] = ci->u2.v2; This->indices[(i * 3) + 2] = ci->u3.v3; instr += size; } /* IDirect3DDevices have color keying always enabled - * enable it before drawing. This overwrites any ALPHA* * render state. */ wined3d_device_set_render_state(lpDevice->wined3d_device, WINED3DRS_COLORKEYENABLE, 1); IDirect3DDevice7_DrawIndexedPrimitive(&lpDevice->IDirect3DDevice7_iface, D3DPT_TRIANGLELIST, D3DFVF_TLVERTEX, tl_vx, 0, This->indices, count * 3, 0); } break; case D3DOP_MATRIXLOAD: WARN("MATRIXLOAD-s (%d)\n", count); instr += count * size; break; case D3DOP_MATRIXMULTIPLY: { int i; TRACE("MATRIXMULTIPLY (%d)\n", count); for (i = 0; i < count; ++i) { D3DMATRIXMULTIPLY *ci = (D3DMATRIXMULTIPLY *)instr; D3DMATRIX *a, *b, *c; a = ddraw_get_object(&lpDevice->handle_table, ci->hDestMatrix - 1, DDRAW_HANDLE_MATRIX); b = ddraw_get_object(&lpDevice->handle_table, ci->hSrcMatrix1 - 1, DDRAW_HANDLE_MATRIX); c = ddraw_get_object(&lpDevice->handle_table, ci->hSrcMatrix2 - 1, DDRAW_HANDLE_MATRIX); if (!a || !b || !c) { ERR("Invalid matrix handle (a %#x -> %p, b %#x -> %p, c %#x -> %p).\n", ci->hDestMatrix, a, ci->hSrcMatrix1, b, ci->hSrcMatrix2, c); } else { TRACE("dst %p, src1 %p, src2 %p.\n", a, b, c); multiply_matrix(a, c, b); } instr += size; } } break; case D3DOP_STATETRANSFORM: { int i; TRACE("STATETRANSFORM (%d)\n", count); for (i = 0; i < count; ++i) { D3DSTATE *ci = (D3DSTATE *)instr; D3DMATRIX *m; m = ddraw_get_object(&lpDevice->handle_table, ci->u2.dwArg[0] - 1, DDRAW_HANDLE_MATRIX); if (!m) { ERR("Invalid matrix handle %#x.\n", ci->u2.dwArg[0]); } else { if (ci->u1.dtstTransformStateType == D3DTRANSFORMSTATE_WORLD) lpDevice->world = ci->u2.dwArg[0]; if (ci->u1.dtstTransformStateType == D3DTRANSFORMSTATE_VIEW) lpDevice->view = ci->u2.dwArg[0]; if (ci->u1.dtstTransformStateType == D3DTRANSFORMSTATE_PROJECTION) lpDevice->proj = ci->u2.dwArg[0]; IDirect3DDevice7_SetTransform(&lpDevice->IDirect3DDevice7_iface, ci->u1.dtstTransformStateType, m); } instr += size; } } break; case D3DOP_STATELIGHT: { int i; TRACE("STATELIGHT (%d)\n", count); for (i = 0; i < count; i++) { LPD3DSTATE ci = (LPD3DSTATE) instr; TRACE("(%08x,%08x)\n", ci->u1.dlstLightStateType, ci->u2.dwArg[0]); if (!ci->u1.dlstLightStateType || (ci->u1.dlstLightStateType > D3DLIGHTSTATE_COLORVERTEX)) ERR("Unexpected Light State Type %d\n", ci->u1.dlstLightStateType); else if (ci->u1.dlstLightStateType == D3DLIGHTSTATE_MATERIAL /* 1 */) { IDirect3DMaterialImpl *m; m = ddraw_get_object(&lpDevice->handle_table, ci->u2.dwArg[0] - 1, DDRAW_HANDLE_MATERIAL); if (!m) ERR("Invalid material handle %#x.\n", ci->u2.dwArg[0]); else material_activate(m); } else if (ci->u1.dlstLightStateType == D3DLIGHTSTATE_COLORMODEL /* 3 */) { switch (ci->u2.dwArg[0]) { case D3DCOLOR_MONO: ERR("DDCOLOR_MONO should not happen!\n"); break; case D3DCOLOR_RGB: /* We are already in this mode */ break; default: ERR("Unknown color model!\n"); } } else { D3DRENDERSTATETYPE rs = 0; switch (ci->u1.dlstLightStateType) { case D3DLIGHTSTATE_AMBIENT: /* 2 */ rs = D3DRENDERSTATE_AMBIENT; break; case D3DLIGHTSTATE_FOGMODE: /* 4 */ rs = D3DRENDERSTATE_FOGVERTEXMODE; break; case D3DLIGHTSTATE_FOGSTART: /* 5 */ rs = D3DRENDERSTATE_FOGSTART; break; case D3DLIGHTSTATE_FOGEND: /* 6 */ rs = D3DRENDERSTATE_FOGEND; break; case D3DLIGHTSTATE_FOGDENSITY: /* 7 */ rs = D3DRENDERSTATE_FOGDENSITY; break; case D3DLIGHTSTATE_COLORVERTEX: /* 8 */ rs = D3DRENDERSTATE_COLORVERTEX; break; default: break; } IDirect3DDevice7_SetRenderState(&lpDevice->IDirect3DDevice7_iface, rs, ci->u2.dwArg[0]); } instr += size; } } break; case D3DOP_STATERENDER: { int i; IDirect3DDevice2 *d3d_device2 = &lpDevice->IDirect3DDevice2_iface; TRACE("STATERENDER (%d)\n", count); for (i = 0; i < count; i++) { LPD3DSTATE ci = (LPD3DSTATE) instr; IDirect3DDevice2_SetRenderState(d3d_device2, ci->u1.drstRenderStateType, ci->u2.dwArg[0]); instr += size; } } break; case D3DOP_PROCESSVERTICES: { /* TODO: Share code with IDirect3DVertexBuffer::ProcessVertices and / or * IWineD3DDevice::ProcessVertices */ int i; D3DMATRIX view_mat, world_mat, proj_mat; TRACE("PROCESSVERTICES (%d)\n", count); /* Get the transform and world matrix */ /* Note: D3DMATRIX is compatible with WINED3DMATRIX */ wined3d_device_get_transform(lpDevice->wined3d_device, D3DTRANSFORMSTATE_VIEW, (WINED3DMATRIX *)&view_mat); wined3d_device_get_transform(lpDevice->wined3d_device, D3DTRANSFORMSTATE_PROJECTION, (WINED3DMATRIX *)&proj_mat); wined3d_device_get_transform(lpDevice->wined3d_device, WINED3DTS_WORLDMATRIX(0), (WINED3DMATRIX *)&world_mat); for (i = 0; i < count; i++) { LPD3DPROCESSVERTICES ci = (LPD3DPROCESSVERTICES) instr; TRACE(" Start : %d Dest : %d Count : %d\n", ci->wStart, ci->wDest, ci->dwCount); TRACE(" Flags : "); if (TRACE_ON(ddraw)) { if (ci->dwFlags & D3DPROCESSVERTICES_COPY) TRACE("COPY "); if (ci->dwFlags & D3DPROCESSVERTICES_NOCOLOR) TRACE("NOCOLOR "); if (ci->dwFlags == D3DPROCESSVERTICES_OPMASK) TRACE("OPMASK "); if (ci->dwFlags & D3DPROCESSVERTICES_TRANSFORM) TRACE("TRANSFORM "); if (ci->dwFlags == D3DPROCESSVERTICES_TRANSFORMLIGHT) TRACE("TRANSFORMLIGHT "); if (ci->dwFlags & D3DPROCESSVERTICES_UPDATEEXTENTS) TRACE("UPDATEEXTENTS "); TRACE("\n"); } /* This is where doing Direct3D on top on OpenGL is quite difficult. This method transforms a set of vertices using the CURRENT state (lighting, projection, ...) but does not rasterize them. They will only be put on screen later (with the POINT / LINE and TRIANGLE op-codes). The problem is that you can have a triangle with each point having been transformed using another state... In this implementation, I will emulate only ONE thing : each vertex can have its own "WORLD" transformation (this is used in the TWIST.EXE demo of the 5.2 SDK). I suppose that all vertices of the execute buffer use the same state. If I find applications that change other states, I will try to do a more 'fine-tuned' state emulation (but I may become quite tricky if it changes a light position in the middle of a triangle). In this case, a 'direct' approach (i.e. without using OpenGL, but writing our own 3D rasterizer) would be easier. */ /* The current method (with the hypothesis that only the WORLD matrix will change between two points) is like this : - I transform 'manually' all the vertices with the current WORLD matrix and store them in the vertex buffer - during the rasterization phase, the WORLD matrix will be set to the Identity matrix */ /* Enough for the moment */ if (ci->dwFlags == D3DPROCESSVERTICES_TRANSFORMLIGHT) { unsigned int nb; D3DVERTEX *src = ((LPD3DVERTEX) ((char *)This->desc.lpData + vs)) + ci->wStart; D3DTLVERTEX *dst = ((LPD3DTLVERTEX) (This->vertex_data)) + ci->wDest; D3DMATRIX mat; D3DVIEWPORT* Viewport = &lpViewport->viewports.vp1; if (TRACE_ON(ddraw)) { TRACE(" Projection Matrix : (%p)\n", &proj_mat); dump_D3DMATRIX(&proj_mat); TRACE(" View Matrix : (%p)\n", &view_mat); dump_D3DMATRIX(&view_mat); TRACE(" World Matrix : (%p)\n", &world_mat); dump_D3DMATRIX(&world_mat); } multiply_matrix(&mat,&view_mat,&world_mat); multiply_matrix(&mat,&proj_mat,&mat); for (nb = 0; nb < ci->dwCount; nb++) { /* No lighting yet */ dst->u5.color = 0xFFFFFFFF; /* Opaque white */ dst->u6.specular = 0xFF000000; /* No specular and no fog factor */ dst->u7.tu = src->u7.tu; dst->u8.tv = src->u8.tv; /* Now, the matrix multiplication */ dst->u1.sx = (src->u1.x * mat._11) + (src->u2.y * mat._21) + (src->u3.z * mat._31) + (1.0 * mat._41); dst->u2.sy = (src->u1.x * mat._12) + (src->u2.y * mat._22) + (src->u3.z * mat._32) + (1.0 * mat._42); dst->u3.sz = (src->u1.x * mat._13) + (src->u2.y * mat._23) + (src->u3.z * mat._33) + (1.0 * mat._43); dst->u4.rhw = (src->u1.x * mat._14) + (src->u2.y * mat._24) + (src->u3.z * mat._34) + (1.0 * mat._44); dst->u1.sx = dst->u1.sx / dst->u4.rhw * Viewport->dvScaleX + Viewport->dwX + Viewport->dwWidth / 2; dst->u2.sy = (-dst->u2.sy) / dst->u4.rhw * Viewport->dvScaleY + Viewport->dwY + Viewport->dwHeight / 2; dst->u3.sz /= dst->u4.rhw; dst->u4.rhw = 1 / dst->u4.rhw; src++; dst++; } } else if (ci->dwFlags == D3DPROCESSVERTICES_TRANSFORM) { unsigned int nb; D3DLVERTEX *src = ((LPD3DLVERTEX) ((char *)This->desc.lpData + vs)) + ci->wStart; D3DTLVERTEX *dst = ((LPD3DTLVERTEX) (This->vertex_data)) + ci->wDest; D3DMATRIX mat; D3DVIEWPORT* Viewport = &lpViewport->viewports.vp1; if (TRACE_ON(ddraw)) { TRACE(" Projection Matrix : (%p)\n", &proj_mat); dump_D3DMATRIX(&proj_mat); TRACE(" View Matrix : (%p)\n",&view_mat); dump_D3DMATRIX(&view_mat); TRACE(" World Matrix : (%p)\n", &world_mat); dump_D3DMATRIX(&world_mat); } multiply_matrix(&mat,&view_mat,&world_mat); multiply_matrix(&mat,&proj_mat,&mat); for (nb = 0; nb < ci->dwCount; nb++) { dst->u5.color = src->u4.color; dst->u6.specular = src->u5.specular; dst->u7.tu = src->u6.tu; dst->u8.tv = src->u7.tv; /* Now, the matrix multiplication */ dst->u1.sx = (src->u1.x * mat._11) + (src->u2.y * mat._21) + (src->u3.z * mat._31) + (1.0 * mat._41); dst->u2.sy = (src->u1.x * mat._12) + (src->u2.y * mat._22) + (src->u3.z * mat._32) + (1.0 * mat._42); dst->u3.sz = (src->u1.x * mat._13) + (src->u2.y * mat._23) + (src->u3.z * mat._33) + (1.0 * mat._43); dst->u4.rhw = (src->u1.x * mat._14) + (src->u2.y * mat._24) + (src->u3.z * mat._34) + (1.0 * mat._44); dst->u1.sx = dst->u1.sx / dst->u4.rhw * Viewport->dvScaleX + Viewport->dwX + Viewport->dwWidth / 2; dst->u2.sy = (-dst->u2.sy) / dst->u4.rhw * Viewport->dvScaleY + Viewport->dwY + Viewport->dwHeight / 2; dst->u3.sz /= dst->u4.rhw; dst->u4.rhw = 1 / dst->u4.rhw; src++; dst++; } } else if (ci->dwFlags == D3DPROCESSVERTICES_COPY) { D3DTLVERTEX *src = ((LPD3DTLVERTEX) ((char *)This->desc.lpData + vs)) + ci->wStart; D3DTLVERTEX *dst = ((LPD3DTLVERTEX) (This->vertex_data)) + ci->wDest; memcpy(dst, src, ci->dwCount * sizeof(D3DTLVERTEX)); } else { ERR("Unhandled vertex processing flag %#x.\n", ci->dwFlags); } instr += size; } } break; case D3DOP_TEXTURELOAD: { WARN("TEXTURELOAD-s (%d)\n", count); instr += count * size; } break; case D3DOP_EXIT: { TRACE("EXIT (%d)\n", count); /* We did this instruction */ instr += size; /* Exit this loop */ goto end_of_buffer; } break; case D3DOP_BRANCHFORWARD: { int i; TRACE("BRANCHFORWARD (%d)\n", count); for (i = 0; i < count; i++) { LPD3DBRANCH ci = (LPD3DBRANCH) instr; if ((This->data.dsStatus.dwStatus & ci->dwMask) == ci->dwValue) { if (!ci->bNegate) { TRACE(" Branch to %d\n", ci->dwOffset); if (ci->dwOffset) { instr = (char*)current + ci->dwOffset; break; } } } else { if (ci->bNegate) { TRACE(" Branch to %d\n", ci->dwOffset); if (ci->dwOffset) { instr = (char*)current + ci->dwOffset; break; } } } instr += size; } } break; case D3DOP_SPAN: { WARN("SPAN-s (%d)\n", count); instr += count * size; } break; case D3DOP_SETSTATUS: { int i; TRACE("SETSTATUS (%d)\n", count); for (i = 0; i < count; i++) { LPD3DSTATUS ci = (LPD3DSTATUS) instr; This->data.dsStatus = *ci; instr += size; } } break; default: ERR("Unhandled OpCode %d !!!\n",current->bOpcode); /* Try to save ... */ instr += count * size; break; } } end_of_buffer: return D3D_OK; }