Esempio n. 1
0
/*****************************************************************************
 * IDirect3DMaterial3::GetHandle
 *
 * Returns a handle for the material interface. The handle is simply a
 * pointer to the material implementation
 *
 * Params:
 *  Direct3DDevice3: The device this handle is assigned to
 *  Handle: Address to write the handle to
 *
 * Returns:
 *  D3D_OK on success
 *  DDERR_INVALIDPARAMS if Handle is NULL
 *
 *****************************************************************************/
static HRESULT WINAPI d3d_material3_GetHandle(IDirect3DMaterial3 *iface,
        IDirect3DDevice3 *device, D3DMATERIALHANDLE *handle)
{
    struct d3d_material *material = impl_from_IDirect3DMaterial3(iface);
    struct d3d_device *device_impl = unsafe_impl_from_IDirect3DDevice3(device);

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

    wined3d_mutex_lock();
    material->active_device = device_impl;
    if (!material->Handle)
    {
        DWORD h = ddraw_allocate_handle(&device_impl->handle_table, material, DDRAW_HANDLE_MATERIAL);
        if (h == DDRAW_INVALID_HANDLE)
        {
            ERR("Failed to allocate a material handle.\n");
            wined3d_mutex_unlock();
            return DDERR_INVALIDPARAMS;   /* Unchecked */
        }

        material->Handle = h + 1;
    }
    *handle = material->Handle;
    TRACE(" returning handle %08x.\n", *handle);
    wined3d_mutex_unlock();

    return D3D_OK;
}
Esempio n. 2
0
static HRESULT WINAPI d3d_vertex_buffer1_Optimize(IDirect3DVertexBuffer *iface,
        IDirect3DDevice3 *device, DWORD flags)
{
    struct d3d_vertex_buffer *buffer = impl_from_IDirect3DVertexBuffer(iface);
    struct d3d_device *device_impl = unsafe_impl_from_IDirect3DDevice3(device);

    TRACE("iface %p, device %p, flags %#x.\n", iface, device, flags);

    return d3d_vertex_buffer7_Optimize(&buffer->IDirect3DVertexBuffer7_iface,
            device_impl ? &device_impl->IDirect3DDevice7_iface : NULL, flags);
}
Esempio n. 3
0
static HRESULT WINAPI IDirect3DVertexBufferImpl_1_Optimize(IDirect3DVertexBuffer *iface,
        IDirect3DDevice3 *device, DWORD Flags)
{
    IDirect3DVertexBufferImpl *This = impl_from_IDirect3DVertexBuffer(iface);
    IDirect3DDeviceImpl *device_impl = unsafe_impl_from_IDirect3DDevice3(device);

    TRACE("iface %p, device %p, flags %#x.\n", iface, device, Flags);

    return IDirect3DVertexBuffer7_Optimize(&This->IDirect3DVertexBuffer7_iface,
            device_impl ? &device_impl->IDirect3DDevice7_iface : NULL, Flags);
}
Esempio n. 4
0
static HRESULT WINAPI d3d_vertex_buffer1_ProcessVertices(IDirect3DVertexBuffer *iface,
        DWORD vertex_op, DWORD dst_idx, DWORD count, IDirect3DVertexBuffer *src_buffer,
        DWORD src_idx, IDirect3DDevice3 *device, DWORD flags)
{
    struct d3d_vertex_buffer *dst_buffer_impl = impl_from_IDirect3DVertexBuffer(iface);
    struct d3d_vertex_buffer *src_buffer_impl = unsafe_impl_from_IDirect3DVertexBuffer(src_buffer);
    struct d3d_device *device_impl = unsafe_impl_from_IDirect3DDevice3(device);

    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);

    return d3d_vertex_buffer7_ProcessVertices(&dst_buffer_impl->IDirect3DVertexBuffer7_iface, vertex_op,
            dst_idx, count, &src_buffer_impl->IDirect3DVertexBuffer7_iface, src_idx,
            device_impl ? &device_impl->IDirect3DDevice7_iface : NULL, flags);
}
Esempio n. 5
0
static HRESULT WINAPI IDirect3DVertexBufferImpl_1_ProcessVertices(IDirect3DVertexBuffer *iface,
        DWORD VertexOp, DWORD DestIndex, DWORD Count, IDirect3DVertexBuffer *SrcBuffer,
        DWORD SrcIndex, IDirect3DDevice3 *device, DWORD Flags)
{
    IDirect3DVertexBufferImpl *This = impl_from_IDirect3DVertexBuffer(iface);
    IDirect3DVertexBufferImpl *Src = unsafe_impl_from_IDirect3DVertexBuffer(SrcBuffer);
    IDirect3DDeviceImpl *device_impl = unsafe_impl_from_IDirect3DDevice3(device);

    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, device, Flags);

    return IDirect3DVertexBuffer7_ProcessVertices(&This->IDirect3DVertexBuffer7_iface, VertexOp,
            DestIndex, Count, &Src->IDirect3DVertexBuffer7_iface, SrcIndex,
            device_impl ? &device_impl->IDirect3DDevice7_iface : NULL, Flags);
}