static HRESULT WINAPI IWineD3DVolumeImpl_LockBox(IWineD3DVolume *iface, WINED3DLOCKED_BOX* pLockedVolume, CONST WINED3DBOX* pBox, DWORD Flags) { IWineD3DVolumeImpl *This = (IWineD3DVolumeImpl *)iface; FIXME("(%p) : pBox=%p stub\n", This, pBox); /* fixme: should we really lock as such? */ TRACE("(%p) : box=%p, output pbox=%p, allMem=%p\n", This, pBox, pLockedVolume, This->resource.allocatedMemory); pLockedVolume->RowPitch = This->bytesPerPixel * This->currentDesc.Width; /* Bytes / row */ pLockedVolume->SlicePitch = This->bytesPerPixel * This->currentDesc.Width * This->currentDesc.Height; /* Bytes / slice */ if (!pBox) { TRACE("No box supplied - all is ok\n"); pLockedVolume->pBits = This->resource.allocatedMemory; This->lockedBox.Left = 0; This->lockedBox.Top = 0; This->lockedBox.Front = 0; This->lockedBox.Right = This->currentDesc.Width; This->lockedBox.Bottom = This->currentDesc.Height; This->lockedBox.Back = This->currentDesc.Depth; } else { TRACE("Lock Box (%p) = l %d, t %d, r %d, b %d, fr %d, ba %d\n", pBox, pBox->Left, pBox->Top, pBox->Right, pBox->Bottom, pBox->Front, pBox->Back); pLockedVolume->pBits = This->resource.allocatedMemory + (pLockedVolume->SlicePitch * pBox->Front) + /* FIXME: is front < back or vica versa? */ (pLockedVolume->RowPitch * pBox->Top) + (pBox->Left * This->bytesPerPixel); This->lockedBox.Left = pBox->Left; This->lockedBox.Top = pBox->Top; This->lockedBox.Front = pBox->Front; This->lockedBox.Right = pBox->Right; This->lockedBox.Bottom = pBox->Bottom; This->lockedBox.Back = pBox->Back; } if (Flags & (WINED3DLOCK_NO_DIRTY_UPDATE | WINED3DLOCK_READONLY)) { /* Don't dirtify */ } else { /** * Dirtify on lock * as seen in msdn docs */ IWineD3DVolume_AddDirtyBox(iface, &This->lockedBox); /** Dirtify Container if needed */ if (NULL != This->container) { IWineD3DVolumeTexture *cont = (IWineD3DVolumeTexture*) This->container; WINED3DRESOURCETYPE containerType = IWineD3DBaseTexture_GetType((IWineD3DBaseTexture *) cont); if (containerType == WINED3DRTYPE_VOLUMETEXTURE) { IWineD3DBaseTextureImpl* pTexture = (IWineD3DBaseTextureImpl*) cont; pTexture->baseTexture.dirty = TRUE; } else { FIXME("Set dirty on container type %d\n", containerType); } } } This->locked = TRUE; TRACE("returning memory@%p rpitch(%d) spitch(%d)\n", pLockedVolume->pBits, pLockedVolume->RowPitch, pLockedVolume->SlicePitch); return WINED3D_OK; }
static D3DRESOURCETYPE WINAPI IDirect3DVolumeTexture9Impl_GetType(LPDIRECT3DVOLUMETEXTURE9 iface) { IDirect3DVolumeTexture9Impl *This = (IDirect3DVolumeTexture9Impl *)iface; D3DRESOURCETYPE type; TRACE("iface %p.\n", iface); wined3d_mutex_lock(); type = IWineD3DBaseTexture_GetType(This->wined3d_texture); wined3d_mutex_unlock(); return type; }
static D3DRESOURCETYPE WINAPI IDirect3DVolumeTexture8Impl_GetType(IDirect3DVolumeTexture8 *iface) { IDirect3DVolumeTexture8Impl *This = impl_from_IDirect3DVolumeTexture8(iface); D3DRESOURCETYPE type; TRACE("iface %p.\n", iface); wined3d_mutex_lock(); type = IWineD3DBaseTexture_GetType(This->wined3d_texture); wined3d_mutex_unlock(); return type; }
static D3DRESOURCETYPE WINAPI IDirect3DBaseTexture8Impl_GetType(LPDIRECT3DBASETEXTURE8 iface) { IDirect3DBaseTexture8Impl *This = (IDirect3DBaseTexture8Impl *)iface; TRACE("(%p) Relay\n" , This); return IWineD3DBaseTexture_GetType(This->wineD3DBaseTexture); }
/* Routine common to the draw primitive and draw indexed primitive routines */ void drawPrimitive(IWineD3DDevice *iface, UINT index_count, UINT StartIdx, UINT idxSize, const void *idxData) { IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; IWineD3DSurfaceImpl *target; struct wined3d_context *context; unsigned int i; if (!index_count) return; if (This->stateBlock->renderState[WINED3DRS_COLORWRITEENABLE]) { /* Invalidate the back buffer memory so LockRect will read it the next time */ for (i = 0; i < This->adapter->gl_info.limits.buffers; ++i) { target = (IWineD3DSurfaceImpl *)This->render_targets[i]; if (target) { IWineD3DSurface_LoadLocation((IWineD3DSurface *)target, SFLAG_INDRAWABLE, NULL); IWineD3DSurface_ModifyLocation((IWineD3DSurface *)target, SFLAG_INDRAWABLE, TRUE); } } } /* Signals other modules that a drawing is in progress and the stateblock finalized */ This->isInDraw = TRUE; context = context_acquire(This, This->render_targets[0], CTXUSAGE_DRAWPRIM); if (!context->valid) { context_release(context); WARN("Invalid context, skipping draw.\n"); return; } #if defined(VBOX_WITH_WDDM) DBGL_CHECK_DRAWPRIM(context->gl_info, This); #endif if (This->stencilBufferTarget) { /* Note that this depends on the context_acquire() call above to set * This->render_offscreen properly. We don't currently take the * Z-compare function into account, but we could skip loading the * depthstencil for D3DCMP_NEVER and D3DCMP_ALWAYS as well. Also note * that we never copy the stencil data.*/ DWORD location = context->render_offscreen ? SFLAG_DS_OFFSCREEN : SFLAG_DS_ONSCREEN; if (This->stateBlock->renderState[WINED3DRS_ZWRITEENABLE] || This->stateBlock->renderState[WINED3DRS_ZENABLE]) surface_load_ds_location(This->stencilBufferTarget, context, location); if (This->stateBlock->renderState[WINED3DRS_ZWRITEENABLE]) surface_modify_ds_location(This->stencilBufferTarget, location); } /* Ok, we will be updating the screen from here onwards so grab the lock */ ENTER_GL(); { GLenum glPrimType = This->stateBlock->gl_primitive_type; BOOL emulation = FALSE; const struct wined3d_stream_info *stream_info = &This->strided_streams; struct wined3d_stream_info stridedlcl; if (!use_vs(This->stateBlock)) { if (!This->strided_streams.position_transformed && context->num_untracked_materials && This->stateBlock->renderState[WINED3DRS_LIGHTING]) { static BOOL warned; if (!warned) { FIXME("Using software emulation because not all material properties could be tracked\n"); warned = TRUE; } else { TRACE("Using software emulation because not all material properties could be tracked\n"); } emulation = TRUE; } else if (context->fog_coord && This->stateBlock->renderState[WINED3DRS_FOGENABLE]) { /* Either write a pipeline replacement shader or convert the specular alpha from unsigned byte * to a float in the vertex buffer */ static BOOL warned; if (!warned) { FIXME("Using software emulation because manual fog coordinates are provided\n"); warned = TRUE; } else { TRACE("Using software emulation because manual fog coordinates are provided\n"); } emulation = TRUE; } if(emulation) { stream_info = &stridedlcl; memcpy(&stridedlcl, &This->strided_streams, sizeof(stridedlcl)); remove_vbos(This, &stridedlcl); } } if (This->useDrawStridedSlow || emulation) { /* Immediate mode drawing */ if (use_vs(This->stateBlock)) { static BOOL warned; if (!warned) { FIXME("Using immediate mode with vertex shaders for half float emulation\n"); warned = TRUE; } else { TRACE("Using immediate mode with vertex shaders for half float emulation\n"); } drawStridedSlowVs(iface, stream_info, index_count, glPrimType, idxData, idxSize, StartIdx); } else { drawStridedSlow(iface, context, stream_info, index_count, glPrimType, idxData, idxSize, StartIdx); } } else if(This->instancedDraw) { /* Instancing emulation with mixing immediate mode and arrays */ drawStridedInstanced(iface, &This->strided_streams, index_count, glPrimType, idxData, idxSize, StartIdx); } else { drawStridedFast(iface, glPrimType, index_count, idxSize, idxData, StartIdx); } } /* Finished updating the screen, restore lock */ LEAVE_GL(); for(i = 0; i < This->num_buffer_queries; i++) { wined3d_event_query_issue(This->buffer_queries[i], This); } if (wined3d_settings.strict_draw_ordering) wglFlush(); /* Flush to ensure ordering across contexts. */ context_release(context); TRACE("Done all gl drawing\n"); /* Diagnostics */ #ifdef SHOW_FRAME_MAKEUP { static long int primCounter = 0; /* NOTE: set primCounter to the value reported by drawprim before you want to to write frame makeup to /tmp */ if (primCounter >= 0) { WINED3DLOCKED_RECT r; char buffer[80]; IWineD3DSurface_LockRect(This->render_targets[0], &r, NULL, WINED3DLOCK_READONLY); sprintf(buffer, "/tmp/backbuffer_%ld.tga", primCounter); TRACE("Saving screenshot %s\n", buffer); IWineD3DSurface_SaveSnapshot(This->render_targets[0], buffer); IWineD3DSurface_UnlockRect(This->render_targets[0]); #ifdef SHOW_TEXTURE_MAKEUP { IWineD3DSurface *pSur; int textureNo; for (textureNo = 0; textureNo < MAX_COMBINED_SAMPLERS; ++textureNo) { if (This->stateBlock->textures[textureNo] != NULL) { sprintf(buffer, "/tmp/texture_%p_%ld_%d.tga", This->stateBlock->textures[textureNo], primCounter, textureNo); TRACE("Saving texture %s\n", buffer); if (IWineD3DBaseTexture_GetType(This->stateBlock->textures[textureNo]) == WINED3DRTYPE_TEXTURE) { IWineD3DTexture_GetSurfaceLevel(This->stateBlock->textures[textureNo], 0, &pSur); IWineD3DSurface_SaveSnapshot(pSur, buffer); IWineD3DSurface_Release(pSur); } else { FIXME("base Texture isn't of type texture %d\n", IWineD3DBaseTexture_GetType(This->stateBlock->textures[textureNo])); } } } } #endif } TRACE("drawprim #%ld\n", primCounter); ++primCounter; } #endif /* Control goes back to the device, stateblock values may change again */ This->isInDraw = FALSE; }