本文整理汇总了C++中IDirect3DDevice9Ex_AddRef函数的典型用法代码示例。如果您正苦于以下问题:C++ IDirect3DDevice9Ex_AddRef函数的具体用法?C++ IDirect3DDevice9Ex_AddRef怎么用?C++ IDirect3DDevice9Ex_AddRef使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了IDirect3DDevice9Ex_AddRef函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: stateblock_init
HRESULT stateblock_init(struct d3d9_stateblock *stateblock, struct d3d9_device *device,
D3DSTATEBLOCKTYPE type, struct wined3d_stateblock *wined3d_stateblock)
{
HRESULT hr;
stateblock->IDirect3DStateBlock9_iface.lpVtbl = &d3d9_stateblock_vtbl;
stateblock->refcount = 1;
if (wined3d_stateblock)
{
stateblock->wined3d_stateblock = wined3d_stateblock;
}
else
{
wined3d_mutex_lock();
hr = wined3d_stateblock_create(device->wined3d_device,
(enum wined3d_stateblock_type)type, &stateblock->wined3d_stateblock);
wined3d_mutex_unlock();
if (FAILED(hr))
{
WARN("Failed to create wined3d stateblock, hr %#x.\n", hr);
return hr;
}
}
stateblock->parent_device = &device->IDirect3DDevice9Ex_iface;
IDirect3DDevice9Ex_AddRef(stateblock->parent_device);
return D3D_OK;
}
示例2: pixelshader_init
HRESULT pixelshader_init(struct d3d9_pixelshader *shader, struct d3d9_device *device, const DWORD *byte_code)
{
struct wined3d_shader_desc desc;
HRESULT hr;
shader->refcount = 1;
shader->IDirect3DPixelShader9_iface.lpVtbl = &d3d9_pixelshader_vtbl;
desc.byte_code = byte_code;
desc.byte_code_size = ~(size_t)0;
wined3d_mutex_lock();
hr = wined3d_shader_create_ps(device->wined3d_device, &desc, shader,
&d3d9_pixelshader_wined3d_parent_ops, &shader->wined3d_shader);
wined3d_mutex_unlock();
if (FAILED(hr))
{
WARN("Failed to created wined3d pixel shader, hr %#x.\n", hr);
return hr;
}
shader->parent_device = &device->IDirect3DDevice9Ex_iface;
IDirect3DDevice9Ex_AddRef(shader->parent_device);
return D3D_OK;
}
示例3: stateblock_init
HRESULT stateblock_init(IDirect3DStateBlock9Impl *stateblock, IDirect3DDevice9Impl *device,
D3DSTATEBLOCKTYPE type, struct wined3d_stateblock *wined3d_stateblock)
{
HRESULT hr;
stateblock->lpVtbl = &Direct3DStateBlock9_Vtbl;
stateblock->ref = 1;
if (wined3d_stateblock)
{
stateblock->wined3d_stateblock = wined3d_stateblock;
}
else
{
wined3d_mutex_lock();
hr = IWineD3DDevice_CreateStateBlock(device->WineD3DDevice,
(WINED3DSTATEBLOCKTYPE)type, &stateblock->wined3d_stateblock);
wined3d_mutex_unlock();
if (FAILED(hr))
{
WARN("Failed to create wined3d stateblock, hr %#x.\n", hr);
return hr;
}
}
stateblock->parentDevice = (IDirect3DDevice9Ex *)device;
IDirect3DDevice9Ex_AddRef(stateblock->parentDevice);
return D3D_OK;
}
示例4: IDirect3DSurface9Impl_AddRef
static ULONG WINAPI IDirect3DSurface9Impl_AddRef(IDirect3DSurface9 *iface)
{
IDirect3DSurface9Impl *This = impl_from_IDirect3DSurface9(iface);
TRACE("iface %p.\n", iface);
if (This->forwardReference) {
/* Forward refcounting */
TRACE("(%p) : Forwarding to %p\n", This, This->forwardReference);
return IUnknown_AddRef(This->forwardReference);
} else {
/* No container, handle our own refcounting */
ULONG ref = InterlockedIncrement(&This->ref);
TRACE("%p increasing refcount to %u.\n", iface, ref);
if (ref == 1)
{
if (This->parentDevice) IDirect3DDevice9Ex_AddRef(This->parentDevice);
wined3d_mutex_lock();
wined3d_surface_incref(This->wined3d_surface);
wined3d_mutex_unlock();
}
return ref;
}
}
示例5: pixelshader_init
HRESULT pixelshader_init(struct d3d9_pixelshader *shader, struct d3d9_device *device, const DWORD *byte_code)
{
struct wined3d_shader_desc desc;
HRESULT hr;
shader->refcount = 1;
shader->IDirect3DPixelShader9_iface.lpVtbl = &d3d9_pixelshader_vtbl;
desc.byte_code = byte_code;
desc.byte_code_size = ~(size_t)0;
desc.format = WINED3D_SHADER_BYTE_CODE_FORMAT_SM1;
desc.input_signature.element_count = 0;
desc.output_signature.element_count = 0;
desc.patch_constant_signature.element_count = 0;
desc.max_version = 3;
wined3d_mutex_lock();
hr = wined3d_shader_create_ps(device->wined3d_device, &desc, shader,
&d3d9_pixelshader_wined3d_parent_ops, &shader->wined3d_shader);
wined3d_mutex_unlock();
if (FAILED(hr))
{
WARN("Failed to created wined3d pixel shader, hr %#x.\n", hr);
return hr;
}
shader->parent_device = &device->IDirect3DDevice9Ex_iface;
IDirect3DDevice9Ex_AddRef(shader->parent_device);
return D3D_OK;
}
示例6: IDirect3DDevice9Impl_CreateVertexShader
/* IDirect3DDevice9 IDirect3DVertexShader9 Methods follow: */
HRESULT WINAPI IDirect3DDevice9Impl_CreateVertexShader(LPDIRECT3DDEVICE9EX iface, CONST DWORD* pFunction, IDirect3DVertexShader9** ppShader) {
IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
HRESULT hrc = D3D_OK;
IDirect3DVertexShader9Impl *object;
/* Setup a stub object for now */
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
TRACE("(%p) : pFunction(%p), ppShader(%p)\n", This, pFunction, ppShader);
if (NULL == object) {
FIXME("Allocation of memory failed, returning D3DERR_OUTOFVIDEOMEMORY\n");
return D3DERR_OUTOFVIDEOMEMORY;
}
object->ref = 1;
object->lpVtbl = &Direct3DVertexShader9_Vtbl;
EnterCriticalSection(&d3d9_cs);
hrc= IWineD3DDevice_CreateVertexShader(This->WineD3DDevice, NULL /* declaration */, pFunction, &object->wineD3DVertexShader, (IUnknown *)object);
LeaveCriticalSection(&d3d9_cs);
if (FAILED(hrc)) {
/* free up object */
FIXME("Call to IWineD3DDevice_CreateVertexShader failed\n");
HeapFree(GetProcessHeap(), 0, object);
}else{
IDirect3DDevice9Ex_AddRef(iface);
object->parentDevice = iface;
*ppShader = (IDirect3DVertexShader9 *)object;
TRACE("(%p) : Created vertex shader %p\n", This, object);
}
TRACE("(%p) : returning %p\n", This, *ppShader);
return hrc;
}
示例7: d3d9_surface_AddRef
static ULONG WINAPI d3d9_surface_AddRef(IDirect3DSurface9 *iface)
{
struct d3d9_surface *surface = impl_from_IDirect3DSurface9(iface);
ULONG refcount;
TRACE("iface %p.\n", iface);
if (surface->texture)
{
TRACE("Forwarding to %p.\n", surface->texture);
return IDirect3DBaseTexture9_AddRef(&surface->texture->IDirect3DBaseTexture9_iface);
}
refcount = InterlockedIncrement(&surface->resource.refcount);
TRACE("%p increasing refcount to %u.\n", iface, refcount);
if (refcount == 1)
{
if (surface->parent_device)
IDirect3DDevice9Ex_AddRef(surface->parent_device);
wined3d_mutex_lock();
if (surface->wined3d_rtv)
wined3d_rendertarget_view_incref(surface->wined3d_rtv);
wined3d_surface_incref(surface->wined3d_surface);
wined3d_mutex_unlock();
}
return refcount;
}
示例8: indexbuffer_init
HRESULT indexbuffer_init(IDirect3DIndexBuffer9Impl *buffer, IDirect3DDevice9Impl *device,
UINT size, DWORD usage, D3DFORMAT format, D3DPOOL pool)
{
HRESULT hr;
buffer->lpVtbl = &Direct3DIndexBuffer9_Vtbl;
buffer->ref = 1;
buffer->format = wined3dformat_from_d3dformat(format);
wined3d_mutex_lock();
hr = IWineD3DDevice_CreateIndexBuffer(device->WineD3DDevice, size,
usage & WINED3DUSAGE_MASK, (WINED3DPOOL)pool, &buffer->wineD3DIndexBuffer,
(IUnknown *)buffer, &d3d9_indexbuffer_wined3d_parent_ops);
wined3d_mutex_unlock();
if (FAILED(hr))
{
WARN("Failed to create wined3d buffer, hr %#x.\n", hr);
return hr;
}
buffer->parentDevice = (IDirect3DDevice9Ex *)device;
IDirect3DDevice9Ex_AddRef(buffer->parentDevice);
return D3D_OK;
}
示例9: d3d9_surface_AddRef
static ULONG WINAPI d3d9_surface_AddRef(IDirect3DSurface9 *iface)
{
struct d3d9_surface *surface = impl_from_IDirect3DSurface9(iface);
ULONG refcount;
TRACE("iface %p.\n", iface);
if (surface->forwardReference)
{
TRACE("Forwarding to %p.\n", surface->forwardReference);
return IUnknown_AddRef(surface->forwardReference);
}
refcount = InterlockedIncrement(&surface->refcount);
TRACE("%p increasing refcount to %u.\n", iface, refcount);
if (refcount == 1)
{
if (surface->parent_device)
IDirect3DDevice9Ex_AddRef(surface->parent_device);
wined3d_mutex_lock();
wined3d_surface_incref(surface->wined3d_surface);
wined3d_mutex_unlock();
}
return refcount;
}
示例10: surface_init
HRESULT surface_init(struct d3d9_surface *surface, struct d3d9_device *device, UINT width, UINT height,
D3DFORMAT format, DWORD flags, DWORD usage, D3DPOOL pool, D3DMULTISAMPLE_TYPE multisample_type,
DWORD multisample_quality
#ifdef VBOX_WITH_WDDM
, HANDLE *shared_handle
, void *pvClientMem
#endif
)
{
HRESULT hr;
surface->IDirect3DSurface9_iface.lpVtbl = &d3d9_surface_vtbl;
surface->refcount = 1;
switch (format)
{
case D3DFMT_A8R8G8B8:
case D3DFMT_X8R8G8B8:
case D3DFMT_R5G6B5:
case D3DFMT_X1R5G5B5:
case D3DFMT_A1R5G5B5:
case D3DFMT_R8G8B8:
surface->getdc_supported = TRUE;
break;
default:
surface->getdc_supported = FALSE;
break;
}
/* FIXME: Check MAX bounds of MultisampleQuality. */
if (multisample_quality > 0)
{
FIXME("Multisample quality set to %u, substituting 0.\n", multisample_quality);
multisample_quality = 0;
}
wined3d_mutex_lock();
hr = wined3d_surface_create(device->wined3d_device, width, height, wined3dformat_from_d3dformat(format),
usage & WINED3DUSAGE_MASK, (enum wined3d_pool)pool, multisample_type, multisample_quality,
flags, surface, &d3d9_surface_wined3d_parent_ops, &surface->wined3d_surface
#ifdef VBOX_WITH_WDDM
, shared_handle
, pvClientMem
#endif
);
wined3d_mutex_unlock();
if (FAILED(hr))
{
WARN("Failed to create wined3d surface, hr %#x.\n", hr);
return hr;
}
surface->parent_device = &device->IDirect3DDevice9Ex_iface;
IDirect3DDevice9Ex_AddRef(surface->parent_device);
return D3D_OK;
}
示例11: swapchain_init
HRESULT swapchain_init(IDirect3DSwapChain9Impl *swapchain, IDirect3DDevice9Impl *device,
D3DPRESENT_PARAMETERS *present_parameters)
{
struct wined3d_swapchain_desc desc;
HRESULT hr;
swapchain->ref = 1;
swapchain->lpVtbl = &Direct3DSwapChain9_Vtbl;
desc.backbuffer_width = present_parameters->BackBufferWidth;
desc.backbuffer_height = present_parameters->BackBufferHeight;
desc.backbuffer_format = wined3dformat_from_d3dformat(present_parameters->BackBufferFormat);
desc.backbuffer_count = max(1, present_parameters->BackBufferCount);
desc.multisample_type = present_parameters->MultiSampleType;
desc.multisample_quality = present_parameters->MultiSampleQuality;
desc.swap_effect = present_parameters->SwapEffect;
desc.device_window = present_parameters->hDeviceWindow;
desc.windowed = present_parameters->Windowed;
desc.enable_auto_depth_stencil = present_parameters->EnableAutoDepthStencil;
desc.auto_depth_stencil_format = wined3dformat_from_d3dformat(present_parameters->AutoDepthStencilFormat);
desc.flags = present_parameters->Flags;
desc.refresh_rate = present_parameters->FullScreen_RefreshRateInHz;
desc.swap_interval = present_parameters->PresentationInterval;
desc.auto_restore_display_mode = TRUE;
wined3d_mutex_lock();
hr = wined3d_swapchain_create(device->wined3d_device, &desc,
WINED3D_SURFACE_TYPE_OPENGL, swapchain, &d3d9_swapchain_wined3d_parent_ops,
&swapchain->wined3d_swapchain);
wined3d_mutex_unlock();
present_parameters->BackBufferWidth = desc.backbuffer_width;
present_parameters->BackBufferHeight = desc.backbuffer_height;
present_parameters->BackBufferFormat = d3dformat_from_wined3dformat(desc.backbuffer_format);
present_parameters->BackBufferCount = desc.backbuffer_count;
present_parameters->MultiSampleType = desc.multisample_type;
present_parameters->MultiSampleQuality = desc.multisample_quality;
present_parameters->SwapEffect = desc.swap_effect;
present_parameters->hDeviceWindow = desc.device_window;
present_parameters->Windowed = desc.windowed;
present_parameters->EnableAutoDepthStencil = desc.enable_auto_depth_stencil;
present_parameters->AutoDepthStencilFormat = d3dformat_from_wined3dformat(desc.auto_depth_stencil_format);
present_parameters->Flags = desc.flags;
present_parameters->FullScreen_RefreshRateInHz = desc.refresh_rate;
present_parameters->PresentationInterval = desc.swap_interval;
if (FAILED(hr))
{
WARN("Failed to create wined3d swapchain, hr %#x.\n", hr);
return hr;
}
swapchain->parentDevice = &device->IDirect3DDevice9Ex_iface;
IDirect3DDevice9Ex_AddRef(swapchain->parentDevice);
return D3D_OK;
}
示例12: swapchain_init
HRESULT swapchain_init(IDirect3DSwapChain9Impl *swapchain, IDirect3DDevice9Impl *device,
D3DPRESENT_PARAMETERS *present_parameters)
{
WINED3DPRESENT_PARAMETERS wined3d_parameters;
HRESULT hr;
swapchain->ref = 1;
swapchain->lpVtbl = &Direct3DSwapChain9_Vtbl;
wined3d_parameters.BackBufferWidth = present_parameters->BackBufferWidth;
wined3d_parameters.BackBufferHeight = present_parameters->BackBufferHeight;
wined3d_parameters.BackBufferFormat = wined3dformat_from_d3dformat(present_parameters->BackBufferFormat);
wined3d_parameters.BackBufferCount = max(1, present_parameters->BackBufferCount);
wined3d_parameters.MultiSampleType = present_parameters->MultiSampleType;
wined3d_parameters.MultiSampleQuality = present_parameters->MultiSampleQuality;
wined3d_parameters.SwapEffect = present_parameters->SwapEffect;
wined3d_parameters.hDeviceWindow = present_parameters->hDeviceWindow;
wined3d_parameters.Windowed = present_parameters->Windowed;
wined3d_parameters.EnableAutoDepthStencil = present_parameters->EnableAutoDepthStencil;
wined3d_parameters.AutoDepthStencilFormat = wined3dformat_from_d3dformat(present_parameters->AutoDepthStencilFormat);
wined3d_parameters.Flags = present_parameters->Flags;
wined3d_parameters.FullScreen_RefreshRateInHz = present_parameters->FullScreen_RefreshRateInHz;
wined3d_parameters.PresentationInterval = present_parameters->PresentationInterval;
wined3d_parameters.AutoRestoreDisplayMode = TRUE;
wined3d_mutex_lock();
hr = wined3d_swapchain_create(device->wined3d_device, &wined3d_parameters,
SURFACE_OPENGL, swapchain, &d3d9_swapchain_wined3d_parent_ops,
&swapchain->wined3d_swapchain);
wined3d_mutex_unlock();
present_parameters->BackBufferWidth = wined3d_parameters.BackBufferWidth;
present_parameters->BackBufferHeight = wined3d_parameters.BackBufferHeight;
present_parameters->BackBufferFormat = d3dformat_from_wined3dformat(wined3d_parameters.BackBufferFormat);
present_parameters->BackBufferCount = wined3d_parameters.BackBufferCount;
present_parameters->MultiSampleType = wined3d_parameters.MultiSampleType;
present_parameters->MultiSampleQuality = wined3d_parameters.MultiSampleQuality;
present_parameters->SwapEffect = wined3d_parameters.SwapEffect;
present_parameters->hDeviceWindow = wined3d_parameters.hDeviceWindow;
present_parameters->Windowed = wined3d_parameters.Windowed;
present_parameters->EnableAutoDepthStencil = wined3d_parameters.EnableAutoDepthStencil;
present_parameters->AutoDepthStencilFormat = d3dformat_from_wined3dformat(wined3d_parameters.AutoDepthStencilFormat);
present_parameters->Flags = wined3d_parameters.Flags;
present_parameters->FullScreen_RefreshRateInHz = wined3d_parameters.FullScreen_RefreshRateInHz;
present_parameters->PresentationInterval = wined3d_parameters.PresentationInterval;
if (FAILED(hr))
{
WARN("Failed to create wined3d swapchain, hr %#x.\n", hr);
return hr;
}
swapchain->parentDevice = &device->IDirect3DDevice9Ex_iface;
IDirect3DDevice9Ex_AddRef(swapchain->parentDevice);
return D3D_OK;
}
示例13: IDirect3DSwapChain9Impl_AddRef
static ULONG WINAPI IDirect3DSwapChain9Impl_AddRef(LPDIRECT3DSWAPCHAIN9 iface) {
IDirect3DSwapChain9Impl *This = (IDirect3DSwapChain9Impl *)iface;
ULONG ref = InterlockedIncrement(&This->ref);
TRACE("%p increasing refcount to %u.\n", iface, ref);
if(ref == 1 && This->parentDevice) IDirect3DDevice9Ex_AddRef(This->parentDevice);
return ref;
}
示例14: surface_init
HRESULT surface_init(IDirect3DSurface9Impl *surface, IDirect3DDevice9Impl *device,
UINT width, UINT height, D3DFORMAT format, BOOL lockable, BOOL discard, UINT level,
DWORD usage, D3DPOOL pool, D3DMULTISAMPLE_TYPE multisample_type, DWORD multisample_quality)
{
DWORD flags = 0;
HRESULT hr;
surface->IDirect3DSurface9_iface.lpVtbl = &Direct3DSurface9_Vtbl;
surface->ref = 1;
switch (format)
{
case D3DFMT_A8R8G8B8:
case D3DFMT_X8R8G8B8:
case D3DFMT_R5G6B5:
case D3DFMT_X1R5G5B5:
case D3DFMT_A1R5G5B5:
case D3DFMT_R8G8B8:
surface->getdc_supported = TRUE;
break;
default:
surface->getdc_supported = FALSE;
break;
}
/* FIXME: Check MAX bounds of MultisampleQuality. */
if (multisample_quality > 0)
{
FIXME("Multisample quality set to %u, substituting 0.\n", multisample_quality);
multisample_quality = 0;
}
if (lockable)
flags |= WINED3D_SURFACE_MAPPABLE;
if (discard)
flags |= WINED3D_SURFACE_DISCARD;
wined3d_mutex_lock();
hr = wined3d_surface_create(device->wined3d_device, width, height, wined3dformat_from_d3dformat(format),
level, usage & WINED3DUSAGE_MASK, (WINED3DPOOL)pool, multisample_type, multisample_quality,
SURFACE_OPENGL, flags, surface, &d3d9_surface_wined3d_parent_ops, &surface->wined3d_surface);
wined3d_mutex_unlock();
if (FAILED(hr))
{
WARN("Failed to create wined3d surface, hr %#x.\n", hr);
return hr;
}
surface->parentDevice = &device->IDirect3DDevice9Ex_iface;
IDirect3DDevice9Ex_AddRef(surface->parentDevice);
return D3D_OK;
}
示例15: cubetexture_init
HRESULT cubetexture_init(struct d3d9_texture *texture, struct d3d9_device *device,
UINT edge_length, UINT levels, DWORD usage, D3DFORMAT format, D3DPOOL pool
#ifdef VBOX_WITH_WDDM
, HANDLE *shared_handle
, void **pavClientMem
#endif
)
{
struct wined3d_resource_desc desc;
DWORD surface_flags = 0;
HRESULT hr;
texture->IDirect3DBaseTexture9_iface.lpVtbl = (const IDirect3DBaseTexture9Vtbl *)&d3d9_texture_cube_vtbl;
texture->refcount = 1;
desc.resource_type = WINED3D_RTYPE_CUBE_TEXTURE;
desc.format = wined3dformat_from_d3dformat(format);
desc.multisample_type = WINED3D_MULTISAMPLE_NONE;
desc.multisample_quality = 0;
desc.usage = usage & WINED3DUSAGE_MASK;
desc.pool = pool;
desc.width = edge_length;
desc.height = edge_length;
desc.depth = 1;
desc.size = 0;
if (pool != D3DPOOL_DEFAULT || (usage & D3DUSAGE_DYNAMIC))
surface_flags |= WINED3D_SURFACE_MAPPABLE;
wined3d_mutex_lock();
hr = wined3d_texture_create_cube(device->wined3d_device, &desc, levels, surface_flags,
texture, &d3d9_texture_wined3d_parent_ops, &texture->wined3d_texture
#ifdef VBOX_WITH_WDDM
, shared_handle
, pavClientMem
#endif
);
wined3d_mutex_unlock();
if (FAILED(hr))
{
WARN("Failed to create wined3d cube texture, hr %#x.\n", hr);
return hr;
}
texture->parent_device = &device->IDirect3DDevice9Ex_iface;
IDirect3DDevice9Ex_AddRef(texture->parent_device);
return D3D_OK;
}