本文整理汇总了C++中context_release函数的典型用法代码示例。如果您正苦于以下问题:C++ context_release函数的具体用法?C++ context_release怎么用?C++ context_release使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了context_release函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: wined3d_shader_resource_view_create_texture_view
static void wined3d_shader_resource_view_create_texture_view(struct wined3d_shader_resource_view *view,
const struct wined3d_shader_resource_view_desc *desc, struct wined3d_texture *texture,
const struct wined3d_format *view_format)
{
const struct wined3d_gl_info *gl_info;
struct wined3d_context *context;
struct gl_texture *gl_texture;
context = context_acquire(texture->resource.device, NULL);
gl_info = context->gl_info;
if (!gl_info->supported[ARB_TEXTURE_VIEW])
{
context_release(context);
FIXME("OpenGL implementation does not support texture views.\n");
return;
}
wined3d_texture_prepare_texture(texture, context, FALSE);
gl_texture = wined3d_texture_get_gl_texture(texture, FALSE);
gl_info->gl_ops.gl.p_glGenTextures(1, &view->object);
GL_EXTCALL(glTextureView(view->object, view->target, gl_texture->name, view_format->glInternal,
desc->u.texture.level_idx, desc->u.texture.level_count,
desc->u.texture.layer_idx, desc->u.texture.layer_count));
checkGLcall("Create texture view");
context_release(context);
}
开发者ID:vindo-app,项目名称:wine,代码行数:29,代码来源:view.c
示例2: context_acquire
void *wined3d_resource_map_internal(struct wined3d_resource *resource, DWORD flags)
{
struct wined3d_device *device = resource->device;
struct wined3d_context *context = NULL;
void *mem;
if (device->d3d_initialized)
context = context_acquire(device, NULL);
if (!wined3d_resource_prepare_map_memory(resource, context))
{
WARN("Out of memory.\n");
context_release(context);
return NULL;
}
if (flags & WINED3D_MAP_DISCARD)
{
switch (resource->map_binding)
{
case WINED3D_LOCATION_BUFFER:
resource->map_buffer = wined3d_device_get_bo(device, resource->size,
GL_STREAM_DRAW_ARB, GL_PIXEL_UNPACK_BUFFER_ARB, context);
break;
case WINED3D_LOCATION_SYSMEM:
wined3d_resource_allocate_sysmem(resource);
break;
default:
if (resource->access_fence)
ERR("Location %s does not support DISCARD maps.\n",
wined3d_debug_location(resource->map_binding));
if (resource->pool != WINED3D_POOL_DEFAULT)
FIXME("Discard used on %s pool resource.\n", debug_d3dpool(resource->pool));
}
wined3d_resource_validate_location(resource, resource->map_binding);
}
else
{
wined3d_resource_load_location(resource, context, resource->map_binding);
}
mem = wined3d_resource_get_map_ptr(resource, context, flags);
if (context)
context_release(context);
return mem;
}
开发者ID:zalcyon,项目名称:wine,代码行数:50,代码来源:resource.c
示例3: TRACE
/* Do not call while under the GL lock. */
static struct wined3d_context *swapchain_create_context(struct wined3d_swapchain *swapchain)
{
struct wined3d_context **newArray;
struct wined3d_context *ctx;
TRACE("Creating a new context for swapchain %p, thread %u.\n", swapchain, GetCurrentThreadId());
if (!(ctx = context_create(swapchain, swapchain->front_buffer, swapchain->ds_format)))
{
ERR("Failed to create a new context for the swapchain\n");
return NULL;
}
context_release(ctx);
newArray = HeapAlloc(GetProcessHeap(), 0, sizeof(*newArray) * (swapchain->num_contexts + 1));
if(!newArray) {
ERR("Out of memory when trying to allocate a new context array\n");
context_destroy(swapchain->device, ctx);
return NULL;
}
memcpy(newArray, swapchain->context, sizeof(*newArray) * swapchain->num_contexts);
HeapFree(GetProcessHeap(), 0, swapchain->context);
newArray[swapchain->num_contexts] = ctx;
swapchain->context = newArray;
swapchain->num_contexts++;
TRACE("Returning context %p\n", ctx);
return ctx;
}
开发者ID:mgriepentrog,项目名称:wine,代码行数:30,代码来源:swapchain.c
示例4: wined3d_shader_resource_view_decref
ULONG CDECL wined3d_shader_resource_view_decref(struct wined3d_shader_resource_view *view)
{
ULONG refcount = InterlockedDecrement(&view->refcount);
TRACE("%p decreasing refcount to %u.\n", view, refcount);
if (!refcount)
{
if (view->object)
{
const struct wined3d_gl_info *gl_info;
struct wined3d_context *context;
context = context_acquire(view->resource->device, NULL);
gl_info = context->gl_info;
gl_info->gl_ops.gl.p_glDeleteTextures(1, &view->object);
checkGLcall("glDeleteTextures");
context_release(context);
}
/* Call wined3d_object_destroyed() before releasing the resource,
* since releasing the resource may end up destroying the parent. */
view->parent_ops->wined3d_object_destroyed(view->parent);
wined3d_resource_decref(view->resource);
HeapFree(GetProcessHeap(), 0, view);
}
return refcount;
}
开发者ID:andrei1489,项目名称:wine,代码行数:28,代码来源:view.c
示例5: wined3d_volume_unmap
HRESULT CDECL wined3d_volume_unmap(struct wined3d_volume *volume)
{
TRACE("volume %p.\n", volume);
if (!(volume->flags & WINED3D_VFLAG_LOCKED))
{
WARN("Trying to unlock unlocked volume %p.\n", volume);
return WINED3DERR_INVALIDCALL;
}
if (volume->flags & WINED3D_VFLAG_PBO)
{
struct wined3d_device *device = volume->resource.device;
struct wined3d_context *context = context_acquire(device, NULL);
const struct wined3d_gl_info *gl_info = context->gl_info;
GL_EXTCALL(glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, volume->pbo));
GL_EXTCALL(glUnmapBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB));
GL_EXTCALL(glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, 0));
checkGLcall("Unmap PBO");
context_release(context);
}
volume->flags &= ~WINED3D_VFLAG_LOCKED;
return WINED3D_OK;
}
开发者ID:Kelimion,项目名称:wine,代码行数:28,代码来源:volume.c
示例6: wined3d_volume_unmap
HRESULT CDECL wined3d_volume_unmap(struct wined3d_volume *volume)
{
TRACE("volume %p.\n", volume);
if (!volume->resource.map_count)
{
WARN("Trying to unlock an unlocked volume %p.\n", volume);
return WINED3DERR_INVALIDCALL;
}
if (volume->resource.map_binding == WINED3D_LOCATION_BUFFER)
{
struct wined3d_device *device = volume->resource.device;
struct wined3d_context *context = context_acquire(device, NULL);
const struct wined3d_gl_info *gl_info = context->gl_info;
GL_EXTCALL(glBindBuffer(GL_PIXEL_UNPACK_BUFFER, volume->pbo));
GL_EXTCALL(glUnmapBuffer(GL_PIXEL_UNPACK_BUFFER));
GL_EXTCALL(glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0));
checkGLcall("Unmap PBO");
context_release(context);
}
volume->resource.map_count--;
return WINED3D_OK;
}
开发者ID:karolherbst,项目名称:wine,代码行数:28,代码来源:volume.c
示例7: TRACE
struct wined3d_context *swapchain_create_context_for_thread(IWineD3DSwapChain *iface)
{
IWineD3DSwapChainImpl *This = (IWineD3DSwapChainImpl *) iface;
#ifndef VBOX_WITH_WDDM
struct wined3d_context **newArray;
#endif
struct wined3d_context *ctx;
TRACE("Creating a new context for swapchain %p, thread %d\n", This, GetCurrentThreadId());
if (!(ctx = context_create(This, (IWineD3DSurfaceImpl *)This->frontBuffer, This->ds_format)))
{
ERR("Failed to create a new context for the swapchain\n");
return NULL;
}
context_release(ctx);
#ifdef VBOX_WITH_WDDM
/* no need to do anything since context gets added to the device context list within the context_create call */
#else
newArray = HeapAlloc(GetProcessHeap(), 0, sizeof(*newArray) * (This->num_contexts + 1));
if(!newArray) {
ERR("Out of memory when trying to allocate a new context array\n");
context_destroy(This->device, ctx);
return NULL;
}
memcpy(newArray, This->context, sizeof(*newArray) * This->num_contexts);
HeapFree(GetProcessHeap(), 0, This->context);
newArray[This->num_contexts] = ctx;
This->context = newArray;
This->num_contexts++;
#endif
TRACE("Returning context %p\n", ctx);
return ctx;
}
开发者ID:virendramishra,项目名称:VirtualBox4.1.18,代码行数:34,代码来源:swapchain.c
示例8: pushDisconnect
static void
pushDisconnect(SCDynamicStoreRef store)
{
void *context_info;
void (*context_release)(const void *);
SCDynamicStoreDisconnectCallBack disconnectFunction;
SCDynamicStorePrivateRef storePrivate = (SCDynamicStorePrivateRef)store;
disconnectFunction = storePrivate->disconnectFunction;
if (disconnectFunction == NULL) {
// if no reconnect callout, push empty notification
storePrivate->disconnectForceCallBack = TRUE;
return;
}
if (storePrivate->rlsContext.retain != NULL) {
context_info = (void *)storePrivate->rlsContext.retain(storePrivate->rlsContext.info);
context_release = storePrivate->rlsContext.release;
} else {
context_info = storePrivate->rlsContext.info;
context_release = NULL;
}
(*disconnectFunction)(store, context_info);
if (context_release) {
context_release(context_info);
}
return;
}
开发者ID:010001111,项目名称:darling,代码行数:29,代码来源:SCDOpen.c
示例9: wined3d_texture_preload
void CDECL wined3d_texture_preload(struct wined3d_texture *texture)
{
struct wined3d_context *context;
context = context_acquire(texture->resource.device, NULL);
wined3d_texture_load(texture, context, texture->flags & WINED3D_TEXTURE_IS_SRGB);
context_release(context);
}
开发者ID:alexwgo,项目名称:wine,代码行数:7,代码来源:texture.c
示例10: basetexture_unload
void basetexture_unload(IWineD3DBaseTexture *iface)
{
IWineD3DTextureImpl *This = (IWineD3DTextureImpl *)iface;
IWineD3DDeviceImpl *device = This->resource.device;
#ifdef VBOX_WITH_WDDM
if (VBOXSHRC_IS_SHARED_OPENED(This))
{
This->baseTexture.texture_rgb.name = 0;
This->baseTexture.texture_srgb.name = 0;
}
else
#endif
{
struct wined3d_context *context = NULL;
if (This->baseTexture.texture_rgb.name || This->baseTexture.texture_srgb.name)
{
context = context_acquire(device, NULL, CTXUSAGE_RESOURCELOAD);
}
if(This->baseTexture.texture_rgb.name) {
gltexture_delete(&This->baseTexture.texture_rgb);
}
if(This->baseTexture.texture_srgb.name) {
gltexture_delete(&This->baseTexture.texture_srgb);
}
if (context) context_release(context);
}
This->baseTexture.texture_rgb.dirty = TRUE;
This->baseTexture.texture_srgb.dirty = TRUE;
}
开发者ID:LastRitter,项目名称:vbox-haiku,代码行数:33,代码来源:basetexture.c
示例11: basetexture_unload
void basetexture_unload(IWineD3DBaseTexture *iface)
{
IWineD3DTextureImpl *This = (IWineD3DTextureImpl *)iface;
IWineD3DDeviceImpl *device = This->resource.device;
struct wined3d_context *context = NULL;
if (This->baseTexture.texture_rgb.name || This->baseTexture.texture_srgb.name)
{
context = context_acquire(device, NULL);
}
if(This->baseTexture.texture_rgb.name) {
gltexture_delete(&This->baseTexture.texture_rgb);
}
if(This->baseTexture.texture_srgb.name) {
gltexture_delete(&This->baseTexture.texture_srgb);
}
if (context) context_release(context);
This->baseTexture.texture_rgb.dirty = TRUE;
This->baseTexture.texture_srgb.dirty = TRUE;
resource_unload((IWineD3DResourceImpl *)This);
}
开发者ID:r6144,项目名称:wine,代码行数:25,代码来源:basetexture.c
示例12: texture2d_preload
/* Do not call while under the GL lock. */
static void texture2d_preload(struct wined3d_texture *texture, enum WINED3DSRGB srgb)
{
UINT sub_count = texture->level_count * texture->layer_count;
struct wined3d_device *device = texture->resource.device;
const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
struct wined3d_context *context = NULL;
struct gl_texture *gl_tex;
BOOL srgb_mode;
UINT i;
TRACE("texture %p, srgb %#x.\n", texture, srgb);
srgb_mode = texture_srgb_mode(texture, srgb);
gl_tex = wined3d_texture_get_gl_texture(texture, gl_info, srgb_mode);
if (!device->isInDraw)
{
/* No danger of recursive calls, context_acquire() sets isInDraw to TRUE
* when loading offscreen render targets into the texture. */
context = context_acquire(device, NULL);
}
if (texture->resource.format->id == WINED3DFMT_P8_UINT
|| texture->resource.format->id == WINED3DFMT_P8_UINT_A8_UNORM)
{
for (i = 0; i < sub_count; ++i)
{
struct wined3d_surface *surface = surface_from_resource(texture->sub_resources[i]);
if (palette9_changed(surface))
{
TRACE("Reloading surface %p because the d3d8/9 palette was changed.\n", surface);
/* TODO: This is not necessarily needed with hw palettized texture support. */
surface_load_location(surface, SFLAG_INSYSMEM, NULL);
/* Make sure the texture is reloaded because of the palette
* change, this kills performance though :( */
surface_modify_location(surface, SFLAG_INTEXTURE, FALSE);
}
}
}
if (gl_tex->dirty)
{
/* Reload the surfaces if the texture is marked dirty. */
for (i = 0; i < sub_count; ++i)
{
surface_load(surface_from_resource(texture->sub_resources[i]), srgb_mode);
}
}
else
{
TRACE("Texture %p not dirty, nothing to do.\n", texture);
}
/* No longer dirty. */
gl_tex->dirty = FALSE;
if (context) context_release(context);
}
开发者ID:carlosbislip,项目名称:wine,代码行数:60,代码来源:texture.c
示例13: wined3d_timestamp_query_ops_get_data
static HRESULT wined3d_timestamp_query_ops_get_data(struct wined3d_query *query,
void *data, DWORD size, DWORD flags)
{
struct wined3d_timestamp_query *tq = query->extendedData;
struct wined3d_device *device = query->device;
const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
struct wined3d_context *context;
GLuint available;
GLuint64 timestamp;
HRESULT res;
TRACE("query %p, data %p, size %#x, flags %#x.\n", query, data, size, flags);
if (!tq->context)
query->state = QUERY_CREATED;
if (query->state == QUERY_CREATED)
{
/* D3D allows GetData on a new query, OpenGL doesn't. So just invent the data ourselves. */
TRACE("Query wasn't yet started, returning S_OK.\n");
timestamp = 0;
fill_query_data(data, size, ×tamp, sizeof(timestamp));
return S_OK;
}
if (tq->context->tid != GetCurrentThreadId())
{
FIXME("%p Wrong thread, returning 1.\n", query);
timestamp = 1;
fill_query_data(data, size, ×tamp, sizeof(timestamp));
return S_OK;
}
context = context_acquire(query->device, tq->context->current_rt);
GL_EXTCALL(glGetQueryObjectuiv(tq->id, GL_QUERY_RESULT_AVAILABLE, &available));
checkGLcall("glGetQueryObjectuiv(GL_QUERY_RESULT_AVAILABLE)");
TRACE("available %#x.\n", available);
if (available)
{
if (size)
{
GL_EXTCALL(glGetQueryObjectui64v(tq->id, GL_QUERY_RESULT, ×tamp));
checkGLcall("glGetQueryObjectui64v(GL_QUERY_RESULT)");
TRACE("Returning timestamp %s.\n", wine_dbgstr_longlong(timestamp));
fill_query_data(data, size, ×tamp, sizeof(timestamp));
}
res = S_OK;
}
else
{
res = S_FALSE;
}
context_release(context);
return res;
}
开发者ID:kernelOfTruth,项目名称:wine,代码行数:59,代码来源:query.c
示例14: IWineD3DTextureImpl_SetShRcState
static HRESULT WINAPI IWineD3DTextureImpl_SetShRcState(IWineD3DTexture *iface, VBOXWINEEX_SHRC_STATE enmState) {
IWineD3DTextureImpl *This = (IWineD3DTextureImpl*)iface;
struct wined3d_context *context = NULL;
HRESULT hr = IWineD3DResourceImpl_SetShRcState((IWineD3DResource*)iface, enmState);
unsigned int i;
if (FAILED(hr))
{
ERR("IWineD3DResource_SetShRcState failed");
return hr;
}
for (i = 0; i < This->baseTexture.levels; ++i)
{
if (This->surfaces[i])
{
HRESULT tmpHr = IWineD3DResource_SetShRcState((IWineD3DResource*)This->surfaces[i], enmState);
Assert(tmpHr == S_OK);
}
}
if (!This->resource.device->isInDraw)
{
context = context_acquire(This->resource.device, NULL, CTXUSAGE_RESOURCELOAD);
if (!context)
{
ERR("zero context!");
return E_FAIL;
}
if (!context->valid)
{
ERR("context invalid!");
context_release(context);
return E_FAIL;
}
}
device_cleanup_durtify_texture_target(This->resource.device, This->target);
if (context)
context_release(context);
return WINED3D_OK;
}
开发者ID:virendramishra,项目名称:VirtualBox4.1.18,代码行数:45,代码来源:texture.c
示例15: wined3d_shader_resource_view_cs_init
static void wined3d_shader_resource_view_cs_init(void *object)
{
struct wined3d_shader_resource_view *view = object;
struct wined3d_resource *resource = view->resource;
const struct wined3d_format *view_format;
const struct wined3d_gl_info *gl_info;
const struct wined3d_view_desc *desc;
GLenum view_target;
view_format = view->format;
gl_info = &resource->device->adapter->gl_info;
desc = &view->desc;
if (resource->type == WINED3D_RTYPE_BUFFER)
{
struct wined3d_buffer *buffer = buffer_from_resource(resource);
struct wined3d_context *context;
context = context_acquire(resource->device, NULL, 0);
create_buffer_view(&view->gl_view, context, desc, buffer, view_format);
context_release(context);
}
else
{
struct wined3d_texture *texture = texture_from_resource(resource);
view_target = get_texture_view_target(gl_info, desc, texture);
if (resource->format->id == view_format->id && texture->target == view_target
&& !desc->u.texture.level_idx && desc->u.texture.level_count == texture->level_count
&& !desc->u.texture.layer_idx && desc->u.texture.layer_count == texture->layer_count
&& !is_stencil_view_format(view_format))
{
TRACE("Creating identity shader resource view.\n");
}
else if (texture->swapchain && texture->swapchain->desc.backbuffer_count > 1)
{
FIXME("Swapchain shader resource views not supported.\n");
}
else if (resource->format->typeless_id == view_format->typeless_id
&& resource->format->gl_view_class == view_format->gl_view_class)
{
create_texture_view(&view->gl_view, view_target, desc, texture, view_format);
}
else if (wined3d_format_is_depth_view(resource->format->id, view_format->id))
{
create_texture_view(&view->gl_view, view_target, desc, texture, resource->format);
}
else
{
FIXME("Shader resource view not supported, resource format %s, view format %s.\n",
debug_d3dformat(resource->format->id), debug_d3dformat(view_format->id));
}
}
wined3d_resource_release(resource);
}
开发者ID:Moteesh,项目名称:reactos,代码行数:57,代码来源:view.c
示例16: texture3d_preload
/* Do not call while under the GL lock. */
static void texture3d_preload(struct wined3d_texture *texture, enum WINED3DSRGB srgb)
{
struct wined3d_device *device = texture->resource.device;
struct wined3d_context *context = NULL;
BOOL srgb_was_toggled = FALSE;
unsigned int i;
TRACE("texture %p, srgb %#x.\n", texture, srgb);
if (!device->isInDraw)
context = context_acquire(device, NULL);
else if (texture->bind_count > 0)
{
BOOL texture_srgb = texture->flags & WINED3D_TEXTURE_IS_SRGB;
BOOL sampler_srgb = texture_srgb_mode(texture, srgb);
srgb_was_toggled = !texture_srgb != !sampler_srgb;
if (srgb_was_toggled)
{
if (sampler_srgb)
texture->flags |= WINED3D_TEXTURE_IS_SRGB;
else
texture->flags &= ~WINED3D_TEXTURE_IS_SRGB;
}
}
/* If the texture is marked dirty or the sRGB sampler setting has changed
* since the last load then reload the volumes. */
if (texture->texture_rgb.dirty)
{
for (i = 0; i < texture->level_count; ++i)
{
volume_load(volume_from_resource(texture->sub_resources[i]), i,
texture->flags & WINED3D_TEXTURE_IS_SRGB);
}
}
else if (srgb_was_toggled)
{
for (i = 0; i < texture->level_count; ++i)
{
struct wined3d_volume *volume = volume_from_resource(texture->sub_resources[i]);
volume_add_dirty_box(volume, NULL);
volume_load(volume, i, texture->flags & WINED3D_TEXTURE_IS_SRGB);
}
}
else
{
TRACE("Texture %p not dirty, nothing to do.\n", texture);
}
if (context)
context_release(context);
/* No longer dirty */
texture->texture_rgb.dirty = FALSE;
}
开发者ID:carlosbislip,项目名称:wine,代码行数:57,代码来源:texture.c
示例17: wined3d_sampler_destroy
void wined3d_sampler_destroy(struct wined3d_sampler *sampler)
{
struct wined3d_context *context = context_acquire(sampler->device, NULL);
const struct wined3d_gl_info *gl_info = context->gl_info;
GL_EXTCALL(glDeleteSamplers(1, &sampler->name));
context_release(context);
HeapFree(GetProcessHeap(), 0, sampler);
}
开发者ID:grandhuit,项目名称:wine-patched,代码行数:10,代码来源:sampler.c
示例18: context_acquire
void *ft_calloc(size_t n, size_t size)
{
void *p;
context_acquire();
if (g_ctx.cfg.print_allocated)
ft_mlog(&g_ctx, INFO, "calloc(%zd, %zd)", n, size);
context_release();
p = ft_malloc(n * size);
context_acquire();
if (p)
memset(p, 0, n * size);
else
ft_mlog(&g_ctx, ERROR, "null pointer exception!");
if (g_ctx.cfg.print_nb_blocks)
ft_mlog(&g_ctx, INFO, "Blocks: %zd", g_ctx.stat.nb_blocks);
context_release();
return (p);
}
开发者ID:Esquim,项目名称:Various-Work,代码行数:19,代码来源:api.c
示例19: wined3d_volume_free_pbo
static void wined3d_volume_free_pbo(struct wined3d_volume *volume)
{
struct wined3d_context *context = context_acquire(volume->resource.device, NULL);
const struct wined3d_gl_info *gl_info = context->gl_info;
TRACE("Deleting PBO %u belonging to volume %p.\n", volume->pbo, volume);
GL_EXTCALL(glDeleteBuffersARB(1, &volume->pbo));
checkGLcall("glDeleteBuffersARB");
volume->pbo = 0;
context_release(context);
}
开发者ID:Kelimion,项目名称:wine,代码行数:11,代码来源:volume.c
示例20: wined3d_resource_unmap_internal
void wined3d_resource_unmap_internal(struct wined3d_resource *resource)
{
struct wined3d_device *device = resource->device;
struct wined3d_context *context = NULL;
if (device->d3d_initialized)
context = context_acquire(device, NULL);
wined3d_resource_release_map_ptr(resource, context);
if (context)
context_release(context);
}
开发者ID:zalcyon,项目名称:wine,代码行数:11,代码来源:resource.c
注:本文中的context_release函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论