~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

Wine Cross Reference
wine/dlls/d3d10core/buffer.c

Version: ~ [ wine-1.1.33 ] ~ [ wine-1.1.32 ] ~ [ wine-1.1.31 ] ~ [ wine-1.1.30 ] ~ [ wine-1.1.29 ] ~ [ wine-1.1.28 ] ~ [ wine-1.1.27 ] ~ [ wine-1.1.26 ] ~ [ wine-1.1.25 ] ~ [ wine-1.1.24 ] ~ [ wine-1.1.23 ] ~ [ wine-1.1.22 ] ~ [ wine-1.1.21 ] ~ [ wine-1.1.20 ] ~ [ wine-1.1.19 ] ~ [ wine-1.1.18 ] ~ [ wine-1.1.17 ] ~ [ wine-1.1.16 ] ~ [ wine-1.1.15 ] ~ [ wine-1.1.14 ] ~ [ wine-1.1.13 ] ~ [ wine-1.1.12 ] ~ [ wine-1.1.11 ] ~ [ wine-1.1.10 ] ~ [ wine-1.1.9 ] ~ [ wine-1.1.8 ] ~ [ wine-1.1.7 ] ~ [ wine-1.0.1 ] ~ [ wine-1.1.6 ] ~ [ wine-1.1.5 ] ~ [ wine-1.1.4 ] ~ [ wine-1.1.3 ] ~ [ wine-1.1.2 ] ~ [ wine-1.1.1 ] ~ [ wine-1.1.0 ] ~ [ wine-1.0 ] ~

  1 /*
  2  * Copyright 2009 Henri Verbeet for CodeWeavers
  3  *
  4  * This library is free software; you can redistribute it and/or
  5  * modify it under the terms of the GNU Lesser General Public
  6  * License as published by the Free Software Foundation; either
  7  * version 2.1 of the License, or (at your option) any later version.
  8  *
  9  * This library is distributed in the hope that it will be useful,
 10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
 11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 12  * Lesser General Public License for more details.
 13  *
 14  * You should have received a copy of the GNU Lesser General Public
 15  * License along with this library; if not, write to the Free Software
 16  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
 17  *
 18  */
 19 
 20 #include "config.h"
 21 #include "wine/port.h"
 22 
 23 #include "d3d10core_private.h"
 24 
 25 WINE_DEFAULT_DEBUG_CHANNEL(d3d10core);
 26 
 27 /* IUnknown methods */
 28 
 29 static HRESULT STDMETHODCALLTYPE d3d10_buffer_QueryInterface(ID3D10Buffer *iface, REFIID riid, void **object)
 30 {
 31     TRACE("iface %p, riid %s, object %p\n", iface, debugstr_guid(riid), object);
 32 
 33     if (IsEqualGUID(riid, &IID_ID3D10Buffer)
 34             || IsEqualGUID(riid, &IID_ID3D10Resource)
 35             || IsEqualGUID(riid, &IID_ID3D10DeviceChild)
 36             || IsEqualGUID(riid, &IID_IUnknown))
 37     {
 38         IUnknown_AddRef(iface);
 39         *object = iface;
 40         return S_OK;
 41     }
 42 
 43     WARN("%s not implemented, returning E_NOINTERFACE\n", debugstr_guid(riid));
 44 
 45     *object = NULL;
 46     return E_NOINTERFACE;
 47 }
 48 
 49 static ULONG STDMETHODCALLTYPE d3d10_buffer_AddRef(ID3D10Buffer *iface)
 50 {
 51     struct d3d10_buffer *This = (struct d3d10_buffer *)iface;
 52     ULONG refcount = InterlockedIncrement(&This->refcount);
 53 
 54     TRACE("%p increasing refcount to %u\n", This, refcount);
 55 
 56     if (refcount == 1) IWineD3DBuffer_AddRef(This->wined3d_buffer);
 57 
 58     return refcount;
 59 }
 60 
 61 static ULONG STDMETHODCALLTYPE d3d10_buffer_Release(ID3D10Buffer *iface)
 62 {
 63     struct d3d10_buffer *This = (struct d3d10_buffer *)iface;
 64     ULONG refcount = InterlockedDecrement(&This->refcount);
 65 
 66     TRACE("%p decreasing refcount to %u\n", This, refcount);
 67 
 68     if (!refcount)
 69     {
 70         IWineD3DBuffer_Release(This->wined3d_buffer);
 71     }
 72 
 73     return refcount;
 74 }
 75 
 76 /* ID3D10DeviceChild methods */
 77 
 78 static void STDMETHODCALLTYPE d3d10_buffer_GetDevice(ID3D10Buffer *iface, ID3D10Device **device)
 79 {
 80     FIXME("iface %p, device %p stub!\n", iface, device);
 81 }
 82 
 83 static HRESULT STDMETHODCALLTYPE d3d10_buffer_GetPrivateData(ID3D10Buffer *iface,
 84         REFGUID guid, UINT *data_size, void *data)
 85 {
 86     FIXME("iface %p, guid %s, data_size %p, data %p stub!\n",
 87             iface, debugstr_guid(guid), data_size, data);
 88 
 89     return E_NOTIMPL;
 90 }
 91 
 92 static HRESULT STDMETHODCALLTYPE d3d10_buffer_SetPrivateData(ID3D10Buffer *iface,
 93         REFGUID guid, UINT data_size, const void *data)
 94 {
 95     FIXME("iface %p, guid %s, data_size %u, data %p stub!\n",
 96             iface, debugstr_guid(guid), data_size, data);
 97 
 98     return E_NOTIMPL;
 99 }
100 
101 static HRESULT STDMETHODCALLTYPE d3d10_buffer_SetPrivateDataInterface(ID3D10Buffer *iface,
102         REFGUID guid, const IUnknown *data)
103 {
104     FIXME("iface %p, guid %s, data %p stub!\n", iface, debugstr_guid(guid), data);
105 
106     return E_NOTIMPL;
107 }
108 
109 /* ID3D10Resource methods */
110 
111 static void STDMETHODCALLTYPE d3d10_buffer_GetType(ID3D10Buffer *iface, D3D10_RESOURCE_DIMENSION *resource_dimension)
112 {
113     TRACE("iface %p, resource_dimension %p\n", iface, resource_dimension);
114 
115     *resource_dimension = D3D10_RESOURCE_DIMENSION_BUFFER;
116 }
117 
118 static void STDMETHODCALLTYPE d3d10_buffer_SetEvictionPriority(ID3D10Buffer *iface, UINT eviction_priority)
119 {
120     FIXME("iface %p, eviction_priority %u stub!\n", iface, eviction_priority);
121 }
122 
123 static UINT STDMETHODCALLTYPE d3d10_buffer_GetEvictionPriority(ID3D10Buffer *iface)
124 {
125     FIXME("iface %p stub!\n", iface);
126 
127     return 0;
128 }
129 
130 /* ID3D10Buffer methods */
131 
132 static HRESULT STDMETHODCALLTYPE d3d10_buffer_Map(ID3D10Buffer *iface, D3D10_MAP map_type, UINT map_flags, void **data)
133 {
134     FIXME("iface %p, map_type %u, map_flags %#x, data %p stub!\n", iface, map_type, map_flags, data);
135 
136     return E_NOTIMPL;
137 }
138 
139 static void STDMETHODCALLTYPE d3d10_buffer_Unmap(ID3D10Buffer *iface)
140 {
141     FIXME("iface %p stub!\n", iface);
142 }
143 
144 static void STDMETHODCALLTYPE d3d10_buffer_GetDesc(ID3D10Buffer *iface, D3D10_BUFFER_DESC *desc)
145 {
146     FIXME("iface %p, desc %p stub!\n", iface, desc);
147 }
148 
149 static const struct ID3D10BufferVtbl d3d10_buffer_vtbl =
150 {
151     /* IUnknown methods */
152     d3d10_buffer_QueryInterface,
153     d3d10_buffer_AddRef,
154     d3d10_buffer_Release,
155     /* ID3D10DeviceChild methods */
156     d3d10_buffer_GetDevice,
157     d3d10_buffer_GetPrivateData,
158     d3d10_buffer_SetPrivateData,
159     d3d10_buffer_SetPrivateDataInterface,
160     /* ID3D10Resource methods */
161     d3d10_buffer_GetType,
162     d3d10_buffer_SetEvictionPriority,
163     d3d10_buffer_GetEvictionPriority,
164     /* ID3D10Buffer methods */
165     d3d10_buffer_Map,
166     d3d10_buffer_Unmap,
167     d3d10_buffer_GetDesc,
168 };
169 
170 static void STDMETHODCALLTYPE d3d10_buffer_wined3d_object_released(void *parent)
171 {
172     HeapFree(GetProcessHeap(), 0, parent);
173 }
174 
175 static const struct wined3d_parent_ops d3d10_buffer_wined3d_parent_ops =
176 {
177     d3d10_buffer_wined3d_object_released,
178 };
179 
180 HRESULT d3d10_buffer_init(struct d3d10_buffer *buffer, struct d3d10_device *device,
181         const D3D10_BUFFER_DESC *desc, const D3D10_SUBRESOURCE_DATA *data)
182 {
183     struct wined3d_buffer_desc wined3d_desc;
184     HRESULT hr;
185 
186     buffer->vtbl = &d3d10_buffer_vtbl;
187     buffer->refcount = 1;
188 
189     FIXME("Implement DXGI<->wined3d usage conversion\n");
190 
191     wined3d_desc.byte_width = desc->ByteWidth;
192     wined3d_desc.usage = desc->Usage;
193     wined3d_desc.bind_flags = desc->BindFlags;
194     wined3d_desc.cpu_access_flags = desc->CPUAccessFlags;
195     wined3d_desc.misc_flags = desc->MiscFlags;
196 
197     hr = IWineD3DDevice_CreateBuffer(device->wined3d_device, &wined3d_desc,
198             data ? data->pSysMem : NULL, (IUnknown *)buffer, &d3d10_buffer_wined3d_parent_ops,
199             &buffer->wined3d_buffer);
200     if (FAILED(hr))
201     {
202         WARN("Failed to create wined3d buffer, hr %#x.\n", hr);
203         return hr;
204     }
205 
206     return S_OK;
207 }
208 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.