Example #1
0
static void STDMETHODCALLTYPE d3d10_texture3d_Unmap(ID3D10Texture3D *iface, UINT sub_resource_idx)
{
    struct d3d10_texture3d *texture = impl_from_ID3D10Texture3D(iface);
    struct wined3d_resource *sub_resource;

    TRACE("iface %p, sub_resource_idx %u.\n", iface, sub_resource_idx);

    if (!(sub_resource = wined3d_texture_get_sub_resource(texture->wined3d_texture, sub_resource_idx)))
        return;

    wined3d_volume_unmap(wined3d_volume_from_resource(sub_resource));
}
Example #2
0
static HRESULT WINAPI d3d8_volume_UnlockBox(IDirect3DVolume8 *iface)
{
    struct d3d8_volume *volume = impl_from_IDirect3DVolume8(iface);
    HRESULT hr;

    TRACE("iface %p.\n", iface);

    wined3d_mutex_lock();
    hr = wined3d_volume_unmap(volume->wined3d_volume);
    wined3d_mutex_unlock();

    return hr;
}
Example #3
0
static HRESULT WINAPI IDirect3DVolume9Impl_UnlockBox(IDirect3DVolume9 *iface)
{
    IDirect3DVolume9Impl *This = impl_from_IDirect3DVolume9(iface);
    HRESULT hr;

    TRACE("iface %p.\n", iface);

    wined3d_mutex_lock();
    hr = wined3d_volume_unmap(This->wined3d_volume);
    wined3d_mutex_unlock();

    return hr;
}
HRESULT CDECL wined3d_device_blt_vol(struct wined3d_device *device, struct wined3d_volume *src, struct wined3d_volume *dst,
        const struct wined3d_box *pSrcBoxArg,
        const VBOXPOINT3D *pDstPoin3D)
{
    struct wined3d_map_desc src_desc, dst_desc;
    HRESULT hr;
    struct wined3d_box DstBox, SrcBox;
    const struct wined3d_box *pDstBox;
    const struct wined3d_box *pSrcBox;
    int dstW, dstH, dstD, srcW, srcH, srcD;
    int j, k;
    uint8_t * pDstBits;
    uint8_t * pSrcBits;


    TRACE("device %p, src_volume %p, dst_volume %p.\n",
            device, src, dst);

    pSrcBox = pSrcBoxArg;
    if (!pSrcBox)
    {
        SrcBox.left   = 0;
        SrcBox.top    = 0;
        SrcBox.front  = 0;
        SrcBox.right  = src->resource.width;
        SrcBox.bottom = src->resource.height;
        SrcBox.back   = src->resource.depth;
        pSrcBox = &SrcBox;
    }

    if (!pDstPoin3D)
        pDstBox = pSrcBox;
    else
    {
        vboxWddmBoxTranslated((VBOXBOX3D*)&DstBox, (const VBOXBOX3D *)pSrcBox, pDstPoin3D->x, pDstPoin3D->y, pDstPoin3D->z);
        pDstBox = &DstBox;
    }

    dstW = pDstBox->right - pDstBox->left;
    dstH = pDstBox->bottom - pDstBox->top;
    dstD = pDstBox->back - pDstBox->front;

    srcW = pSrcBox->right - pSrcBox->left;
    srcH = pSrcBox->bottom - pSrcBox->top;
    srcD = pSrcBox->back - pSrcBox->front;

    if (srcW != dstW || srcH != dstH || srcD != dstD)
    {
        ERR("dimensions do not match, stretching not supported for volumes!");
        return WINED3DERR_INVALIDCALL;
    }

    /* TODO: Implement direct loading into the gl volume instead of using memcpy and
     * dirtification to improve loading performance.
     */
    hr = wined3d_volume_map(src, &src_desc, pSrcBox, WINED3D_MAP_READONLY);
    if(FAILED(hr))
    {
        ERR("wined3d_volume_map src failed");
        return hr;
    }

    hr = wined3d_volume_map(dst, &dst_desc, pDstBox, WINED3D_MAP_DISCARD);
    if(FAILED(hr))
    {
        ERR("wined3d_volume_map dst failed");
        wined3d_volume_unmap(src);
        return hr;
    }

    pDstBits = dst_desc.data;
    pSrcBits = src_desc.data;
    for (k = 0; k < srcD; ++k)
    {
        uint8_t * pRowDstBits = pDstBits;
        uint8_t * pRowSrcBits = pSrcBits;

        for (j = 0; j < srcH; ++j)
        {
            memcpy(pRowDstBits, pRowSrcBits, srcW * dst->resource.format->byte_count);
            pRowDstBits += dst_desc.row_pitch;
            pRowSrcBits += src_desc.row_pitch;
        }
        pDstBits += dst_desc.slice_pitch;
        pSrcBits += src_desc.slice_pitch;
    }

    hr = wined3d_volume_unmap(dst);
    if(FAILED(hr)) {
        wined3d_volume_unmap(src);
    } else {
        hr = wined3d_volume_unmap(src);
    }
    return hr;
}