这篇教程C++ surface_from_resource函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中surface_from_resource函数的典型用法代码示例。如果您正苦于以下问题:C++ surface_from_resource函数的具体用法?C++ surface_from_resource怎么用?C++ surface_from_resource使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了surface_from_resource函数的29个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: wined3d_swapchain_get_front_buffer_dataHRESULT CDECL wined3d_swapchain_get_front_buffer_data(const struct wined3d_swapchain *swapchain, struct wined3d_texture *dst_texture, unsigned int sub_resource_idx){ struct wined3d_surface *src_surface, *dst_surface; struct wined3d_resource *sub_resource; RECT src_rect, dst_rect; TRACE("swapchain %p, dst_texture %p, sub_resource_idx %u./n", swapchain, dst_texture, sub_resource_idx); if (!(sub_resource = wined3d_texture_get_sub_resource(dst_texture, sub_resource_idx)) || sub_resource->type != WINED3D_RTYPE_SURFACE) return WINED3DERR_INVALIDCALL; dst_surface = surface_from_resource(sub_resource); src_surface = surface_from_resource(wined3d_texture_get_sub_resource(swapchain->front_buffer, 0)); SetRect(&src_rect, 0, 0, src_surface->resource.width, src_surface->resource.height); dst_rect = src_rect; if (swapchain->desc.windowed) { MapWindowPoints(swapchain->win_handle, NULL, (POINT *)&dst_rect, 2); FIXME("Using destination rect %s in windowed mode, this is likely wrong./n", wine_dbgstr_rect(&dst_rect)); } return wined3d_surface_blt(dst_surface, &dst_rect, src_surface, &src_rect, 0, NULL, WINED3D_TEXF_POINT);}
开发者ID:AlexSteel,项目名称:wine,代码行数:27,
示例2: 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,
示例3: swapchain_gdi_presentstatic void swapchain_gdi_present(struct wined3d_swapchain *swapchain, const RECT *src_rect_in, const RECT *dst_rect_in, const RGNDATA *dirty_region, DWORD flags){ struct wined3d_surface *front, *back; front = surface_from_resource(wined3d_texture_get_sub_resource(swapchain->front_buffer, 0)); back = surface_from_resource(wined3d_texture_get_sub_resource(swapchain->back_buffers[0], 0)); /* Flip the DC. */ { HDC tmp; tmp = front->hDC; front->hDC = back->hDC; back->hDC = tmp; } /* Flip the DIBsection. */ { HBITMAP tmp; tmp = front->dib.DIBsection; front->dib.DIBsection = back->dib.DIBsection; back->dib.DIBsection = tmp; } /* Flip the surface data. */ { void *tmp; tmp = front->dib.bitmap_data; front->dib.bitmap_data = back->dib.bitmap_data; back->dib.bitmap_data = tmp; if (front->resource.heap_memory) ERR("GDI Surface %p has heap memory allocated./n", front); if (back->resource.heap_memory) ERR("GDI Surface %p has heap memory allocated./n", back); } /* FPS support */ if (TRACE_ON(fps)) { static LONG prev_time, frames; DWORD time = GetTickCount(); ++frames; /* every 1.5 seconds */ if (time - prev_time > 1500) { TRACE_(fps)("@ approx %.2ffps/n", 1000.0 * frames / (time - prev_time)); prev_time = time; frames = 0; } } x11_copy_to_screen(swapchain, NULL);}
开发者ID:AlexSteel,项目名称:wine,代码行数:58,
示例4: texture_cleanupstatic void texture_cleanup(IWineD3DBaseTextureImpl *This){ unsigned int i; TRACE("(%p) : Cleaning up/n", This); for (i = 0; i < This->baseTexture.level_count; ++i) { struct wined3d_resource *sub_resource = This->baseTexture.sub_resources[i]; if (sub_resource) { IWineD3DSurfaceImpl *surface = surface_from_resource(sub_resource); /* Clean out the texture name we gave to the surface so that the * surface doesn't try and release it */ surface_set_texture_name(surface, 0, TRUE); surface_set_texture_name(surface, 0, FALSE); surface_set_texture_target(surface, 0); surface_set_container(surface, WINED3D_CONTAINER_NONE, NULL); IWineD3DSurface_Release((IWineD3DSurface *)surface); } } TRACE("(%p) : Cleaning up base texture/n", This); basetexture_cleanup((IWineD3DBaseTextureImpl *)This);}
开发者ID:dvdhoo,项目名称:wine,代码行数:27,
示例5: TRACEstatic 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, surface_from_resource(wined3d_texture_get_sub_resource(swapchain->front_buffer, 0)), 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:AlexSteel,项目名称:wine,代码行数:31,
示例6: texture2d_sub_resource_cleanupstatic void texture2d_sub_resource_cleanup(struct wined3d_resource *sub_resource){ struct wined3d_surface *surface = surface_from_resource(sub_resource); surface_set_texture_target(surface, 0, 0); surface_set_container(surface, NULL); wined3d_surface_decref(surface);}
开发者ID:Dimillian,项目名称:wine,代码行数:8,
示例7: texture2d_sub_resource_add_dirty_regionstatic void texture2d_sub_resource_add_dirty_region(struct wined3d_resource *sub_resource, const struct wined3d_box *dirty_region){ struct wined3d_surface *surface = surface_from_resource(sub_resource); surface_prepare_map_memory(surface); surface_load_location(surface, surface->resource.map_binding); surface_invalidate_location(surface, ~surface->resource.map_binding);}
开发者ID:alexwgo,项目名称:wine,代码行数:9,
示例8: texture2d_bind/* Context activation is done by the caller. */static HRESULT texture2d_bind(struct wined3d_texture *texture, const struct wined3d_gl_info *gl_info, BOOL srgb){ BOOL set_gl_texture_desc; HRESULT hr; TRACE("texture %p, gl_info %p, srgb %#x./n", texture, gl_info, srgb); hr = wined3d_texture_bind(texture, gl_info, srgb, &set_gl_texture_desc); if (set_gl_texture_desc && SUCCEEDED(hr)) { UINT sub_count = texture->level_count * texture->layer_count; BOOL srgb_tex = !gl_info->supported[EXT_TEXTURE_SRGB_DECODE] && (texture->flags & WINED3D_TEXTURE_IS_SRGB); struct gl_texture *gl_tex; UINT i; gl_tex = wined3d_texture_get_gl_texture(texture, gl_info, srgb_tex); for (i = 0; i < sub_count; ++i) { struct wined3d_surface *surface = surface_from_resource(texture->sub_resources[i]); surface_set_texture_name(surface, gl_tex->name, srgb_tex); } /* Conditinal non power of two textures use a different clamping * default. If we're using the GL_WINE_normalized_texrect partial * driver emulation, we're dealing with a GL_TEXTURE_2D texture which * has the address mode set to repeat - something that prevents us * from hitting the accelerated codepath. Thus manually set the GL * state. The same applies to filtering. Even if the texture has only * one mip level, the default LINEAR_MIPMAP_LINEAR filter causes a SW * fallback on macos. */ if (texture->flags & WINED3D_TEXTURE_COND_NP2) { GLenum target = texture->target; ENTER_GL(); glTexParameteri(target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); checkGLcall("glTexParameteri(target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE)"); glTexParameteri(target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); checkGLcall("glTexParameteri(target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE)"); glTexParameteri(target, GL_TEXTURE_MIN_FILTER, GL_NEAREST); checkGLcall("glTexParameteri(target, GL_TEXTURE_MIN_FILTER, GL_NEAREST)"); glTexParameteri(target, GL_TEXTURE_MAG_FILTER, GL_NEAREST); checkGLcall("glTexParameteri(target, GL_TEXTURE_MAG_FILTER, GL_NEAREST)"); LEAVE_GL(); gl_tex->states[WINED3DTEXSTA_ADDRESSU] = WINED3DTADDRESS_CLAMP; gl_tex->states[WINED3DTEXSTA_ADDRESSV] = WINED3DTADDRESS_CLAMP; gl_tex->states[WINED3DTEXSTA_MAGFILTER] = WINED3DTEXF_POINT; gl_tex->states[WINED3DTEXSTA_MINFILTER] = WINED3DTEXF_POINT; gl_tex->states[WINED3DTEXSTA_MIPFILTER] = WINED3DTEXF_NONE; } } return hr;}
开发者ID:carlosbislip,项目名称:wine,代码行数:58,
示例9: texture2d_sub_resource_add_dirty_regionstatic void texture2d_sub_resource_add_dirty_region(struct wined3d_resource *sub_resource, const struct wined3d_box *dirty_region){ struct wined3d_surface *surface = surface_from_resource(sub_resource); struct wined3d_context *context; context = context_acquire(surface->resource.device, NULL); wined3d_resource_prepare_map_memory(&surface->resource, context); wined3d_resource_load_location(&surface->resource, context, surface->resource.map_binding); context_release(context); wined3d_resource_invalidate_location(&surface->resource, ~surface->resource.map_binding);}
开发者ID:Dimillian,项目名称:wine,代码行数:12,
示例10: texture2d_sub_resource_cleanupstatic void texture2d_sub_resource_cleanup(struct wined3d_resource *sub_resource){ struct wined3d_surface *surface = surface_from_resource(sub_resource); /* Clean out the texture name we gave to the surface so that the * surface doesn't try and release it. */ surface_set_texture_name(surface, 0, TRUE); surface_set_texture_name(surface, 0, FALSE); surface_set_texture_target(surface, 0, 0); surface_set_container(surface, WINED3D_CONTAINER_NONE, NULL); wined3d_surface_decref(surface);}
开发者ID:pombredanne,项目名称:wine,代码行数:12,
示例11: wined3d_palette_set_entriesHRESULT CDECL wined3d_palette_set_entries(struct wined3d_palette *palette, DWORD flags, DWORD start, DWORD count, const PALETTEENTRY *entries){ struct wined3d_resource *resource; TRACE("palette %p, flags %#x, start %u, count %u, entries %p./n", palette, flags, start, count, entries); TRACE("Palette flags: %#x./n", palette->flags); if (palette->flags & WINEDDPCAPS_8BITENTRIES) { const BYTE *entry = (const BYTE *)entries; unsigned int i; for (i = start; i < count + start; ++i) palette->palents[i].peRed = *entry++; } else { memcpy(palette->palents + start, entries, count * sizeof(*palette->palents)); /* When WINEDDCAPS_ALLOW256 isn't set we need to override entry 0 with black and 255 with white */ if (!(palette->flags & WINEDDPCAPS_ALLOW256)) { TRACE("WINEDDPCAPS_ALLOW256 set, overriding palette entry 0 with black and 255 with white/n"); palette->palents[0].peRed = 0; palette->palents[0].peGreen = 0; palette->palents[0].peBlue = 0; palette->palents[255].peRed = 255; palette->palents[255].peGreen = 255; palette->palents[255].peBlue = 255; } if (palette->hpal) SetPaletteEntries(palette->hpal, start, count, palette->palents + start); } /* If the palette is attached to the render target, update all render targets */ LIST_FOR_EACH_ENTRY(resource, &palette->device->resources, struct wined3d_resource, resource_list_entry) { if (resource->type == WINED3D_RTYPE_SURFACE) { struct wined3d_surface *surface = surface_from_resource(resource); if (surface->palette == palette) surface->surface_ops->surface_realize_palette(surface); } } return WINED3D_OK;}
开发者ID:klickverbot,项目名称:wine,代码行数:51,
示例12: x11_copy_to_screen/* Helper function that blits the front buffer contents to the target window. */void x11_copy_to_screen(const struct wined3d_swapchain *swapchain, const RECT *rect){ struct wined3d_surface *front; POINT offset = {0, 0}; HDC src_dc, dst_dc; RECT draw_rect; HWND window; TRACE("swapchain %p, rect %s./n", swapchain, wine_dbgstr_rect(rect)); front = surface_from_resource(wined3d_texture_get_sub_resource(swapchain->front_buffer, 0)); if (swapchain->palette) wined3d_palette_apply_to_dc(swapchain->palette, front->hDC); if (front->resource.map_count) ERR("Trying to blit a mapped surface./n"); TRACE("Copying surface %p to screen./n", front); surface_load_location(front, NULL, WINED3D_LOCATION_DIB); src_dc = front->hDC; window = swapchain->win_handle; dst_dc = GetDCEx(window, 0, DCX_CLIPSIBLINGS | DCX_CACHE); /* Front buffer coordinates are screen coordinates. Map them to the * destination window if not fullscreened. */ if (swapchain->desc.windowed) ClientToScreen(window, &offset); TRACE("offset %s./n", wine_dbgstr_point(&offset)); draw_rect.left = 0; draw_rect.right = front->resource.width; draw_rect.top = 0; draw_rect.bottom = front->resource.height; if (rect) IntersectRect(&draw_rect, &draw_rect, rect); BitBlt(dst_dc, draw_rect.left - offset.x, draw_rect.top - offset.y, draw_rect.right - draw_rect.left, draw_rect.bottom - draw_rect.top, src_dc, draw_rect.left, draw_rect.top, SRCCOPY); ReleaseDC(window, dst_dc);}
开发者ID:AlexSteel,项目名称:wine,代码行数:46,
示例13: texture_unload/* Do not call while under the GL lock. */static void texture_unload(struct wined3d_resource *resource){ IWineD3DBaseTextureImpl *texture = basetexture_from_resource(resource); unsigned int i; TRACE("texture %p./n", texture); for (i = 0; i < texture->baseTexture.level_count; ++i) { struct wined3d_resource *sub_resource = texture->baseTexture.sub_resources[i]; IWineD3DSurfaceImpl *surface = surface_from_resource(sub_resource); sub_resource->resource_ops->resource_unload(sub_resource); surface_set_texture_name(surface, 0, FALSE); /* Delete rgb name */ surface_set_texture_name(surface, 0, TRUE); /* delete srgb name */ } basetexture_unload(texture);}
开发者ID:dvdhoo,项目名称:wine,代码行数:20,
示例14: IWineD3DTextureImpl_AddDirtyRegionstatic HRESULT WINAPI IWineD3DTextureImpl_AddDirtyRegion(IWineD3DBaseTexture *iface, UINT layer, const WINED3DBOX *dirty_region){ IWineD3DBaseTextureImpl *texture = (IWineD3DBaseTextureImpl *)iface; struct wined3d_resource *sub_resource; TRACE("iface %p, layer %u, dirty_region %p./n", iface, layer, dirty_region); if (!(sub_resource = basetexture_get_sub_resource(texture, layer * texture->baseTexture.level_count))) { WARN("Failed to get sub-resource./n"); return WINED3DERR_INVALIDCALL; } basetexture_set_dirty(texture, TRUE); surface_add_dirty_rect(surface_from_resource(sub_resource), dirty_region); return WINED3D_OK;}
开发者ID:dvdhoo,项目名称:wine,代码行数:19,
示例15: texture2d_unload/* Do not call while under the GL lock. */static void texture2d_unload(struct wined3d_resource *resource){ struct wined3d_texture *texture = wined3d_texture_from_resource(resource); UINT sub_count = texture->level_count * texture->layer_count; UINT i; TRACE("texture %p./n", texture); for (i = 0; i < sub_count; ++i) { struct wined3d_resource *sub_resource = texture->sub_resources[i]; struct wined3d_surface *surface = surface_from_resource(sub_resource); sub_resource->resource_ops->resource_unload(sub_resource); surface_set_texture_name(surface, 0, FALSE); /* Delete RGB name */ surface_set_texture_name(surface, 0, TRUE); /* Delete sRGB name */ } wined3d_texture_unload(texture);}
开发者ID:pombredanne,项目名称:wine,代码行数:21,
示例16: wined3d_swapchain_get_front_buffer_dataHRESULT CDECL wined3d_swapchain_get_front_buffer_data(const struct wined3d_swapchain *swapchain, struct wined3d_surface *dst_surface){ struct wined3d_surface *src_surface; RECT src_rect, dst_rect; TRACE("swapchain %p, dst_surface %p./n", swapchain, dst_surface); src_surface = surface_from_resource(wined3d_texture_get_sub_resource(swapchain->front_buffer, 0)); SetRect(&src_rect, 0, 0, src_surface->resource.width, src_surface->resource.height); dst_rect = src_rect; if (swapchain->desc.windowed) { MapWindowPoints(swapchain->win_handle, NULL, (POINT *)&dst_rect, 2); FIXME("Using destination rect %s in windowed mode, this is likely wrong./n", wine_dbgstr_rect(&dst_rect)); } return wined3d_surface_blt(dst_surface, &dst_rect, src_surface, &src_rect, 0, NULL, WINED3D_TEXF_POINT);}
开发者ID:RPG-7,项目名称:reactos,代码行数:21,
示例17: wined3d_rendertarget_view_create_from_sub_resourceHRESULT CDECL wined3d_rendertarget_view_create_from_sub_resource(struct wined3d_texture *texture, unsigned int sub_resource_idx, void *parent, const struct wined3d_parent_ops *parent_ops, struct wined3d_rendertarget_view **view){ struct wined3d_resource *sub_resource; TRACE("texture %p, sub_resource_idx %u, parent %p, parent_ops %p, view %p./n", texture, sub_resource_idx, parent, parent_ops, view); if (!(sub_resource = wined3d_texture_get_sub_resource(texture, sub_resource_idx))) return WINED3DERR_INVALIDCALL; if (sub_resource->type != WINED3D_RTYPE_SURFACE) { FIXME("Not implemented for %s resources./n", debug_d3dresourcetype(texture->resource.type)); return WINED3DERR_INVALIDCALL; } return wined3d_rendertarget_view_create_from_surface(surface_from_resource(sub_resource), parent, parent_ops, view);}
开发者ID:Strongc,项目名称:reactos,代码行数:21,
示例18: 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 (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:pombredanne,项目名称:wine,代码行数:41,
示例19: wined3d_resource_is_offscreenBOOL wined3d_resource_is_offscreen(struct wined3d_resource *resource){ struct wined3d_swapchain *swapchain; if (resource->type == WINED3D_RTYPE_SURFACE) resource = &surface_from_resource(resource)->container->resource; /* Only texture resources can be onscreen. */ if (resource->type != WINED3D_RTYPE_TEXTURE) return TRUE; /* Not on a swapchain - must be offscreen */ if (!(swapchain = wined3d_texture_from_resource(resource)->swapchain)) return TRUE; /* The front buffer is always onscreen */ if (resource == &swapchain->front_buffer->resource) return FALSE; /* If the swapchain is rendered to an FBO, the backbuffer is * offscreen, otherwise onscreen */ return swapchain->render_to_fbo;}
开发者ID:PigFlyGames,项目名称:wine,代码行数:23,
示例20: wined3d_swapchain_get_back_bufferstruct wined3d_surface * CDECL wined3d_swapchain_get_back_buffer(const struct wined3d_swapchain *swapchain, UINT back_buffer_idx, enum wined3d_backbuffer_type type){ TRACE("swapchain %p, back_buffer_idx %u, type %#x./n", swapchain, back_buffer_idx, type); /* Return invalid if there is no backbuffer array, otherwise it will * crash when ddraw is used (there swapchain->back_buffers is always * NULL). We need this because this function is called from * stateblock_init_default_state() to get the default scissorrect * dimensions. */ if (!swapchain->back_buffers || back_buffer_idx >= swapchain->desc.backbuffer_count) { WARN("Invalid back buffer index./n"); /* Native d3d9 doesn't set NULL here, just as wine's d3d9. But set it * here in wined3d to avoid problems in other libs. */ return NULL; } TRACE("Returning back buffer %p./n", swapchain->back_buffers[back_buffer_idx]); return surface_from_resource(wined3d_texture_get_sub_resource(swapchain->back_buffers[back_buffer_idx], 0));}
开发者ID:RPG-7,项目名称:reactos,代码行数:23,
示例21: wined3d_resource_syncstatic void wined3d_resource_sync(struct wined3d_resource *resource){ struct wined3d_resource *real_res = resource; struct wined3d_surface *surface; struct wined3d_volume *volume; switch (resource->type) { case WINED3D_RTYPE_SURFACE: surface = surface_from_resource(resource); if (surface->container) real_res = &surface->container->resource; break; case WINED3D_RTYPE_VOLUME: volume = volume_from_resource(resource); real_res = &volume->container->resource; break; default: break; } wined3d_resource_wait_fence(real_res);}
开发者ID:zalcyon,项目名称:wine,代码行数:24,
示例22: swapchain_gl_presentstatic void swapchain_gl_present(struct wined3d_swapchain *swapchain, const RECT *src_rect_in, const RECT *dst_rect_in, const RGNDATA *dirty_region, DWORD flags){ struct wined3d_surface *back_buffer = swapchain->back_buffers[0]; const struct wined3d_fb_state *fb = &swapchain->device->fb; const struct wined3d_gl_info *gl_info; struct wined3d_context *context; RECT src_rect, dst_rect; BOOL render_to_fbo; context = context_acquire(swapchain->device, back_buffer); if (!context->valid) { context_release(context); WARN("Invalid context, skipping present./n"); return; } gl_info = context->gl_info; if (swapchain->device->logo_texture) { struct wined3d_surface *src_surface = surface_from_resource( wined3d_texture_get_sub_resource(swapchain->device->logo_texture, 0)); RECT rect = {0, 0, src_surface->resource.width, src_surface->resource.height}; /* Blit the logo into the upper left corner of the drawable. */ wined3d_surface_blt(back_buffer, &rect, src_surface, &rect, WINEDDBLT_ALPHATEST, NULL, WINED3D_TEXF_POINT); } if (swapchain->device->bCursorVisible && swapchain->device->cursor_texture && !swapchain->device->hardwareCursor) { struct wined3d_surface *cursor = surface_from_resource( wined3d_texture_get_sub_resource(swapchain->device->cursor_texture, 0)); RECT destRect = { swapchain->device->xScreenSpace - swapchain->device->xHotSpot, swapchain->device->yScreenSpace - swapchain->device->yHotSpot, swapchain->device->xScreenSpace + swapchain->device->cursorWidth - swapchain->device->xHotSpot, swapchain->device->yScreenSpace + swapchain->device->cursorHeight - swapchain->device->yHotSpot, }; TRACE("Rendering the software cursor./n"); if (swapchain->desc.windowed) MapWindowPoints(NULL, swapchain->win_handle, (POINT *)&destRect, 2); wined3d_surface_blt(back_buffer, &destRect, cursor, NULL, WINEDDBLT_ALPHATEST, NULL, WINED3D_TEXF_POINT); } TRACE("Presenting HDC %p./n", context->hdc); render_to_fbo = swapchain->render_to_fbo; if (src_rect_in) { src_rect = *src_rect_in; if (!render_to_fbo && (src_rect.left || src_rect.top || src_rect.right != swapchain->desc.backbuffer_width || src_rect.bottom != swapchain->desc.backbuffer_height)) { render_to_fbo = TRUE; } } else { src_rect.left = 0; src_rect.top = 0; src_rect.right = swapchain->desc.backbuffer_width; src_rect.bottom = swapchain->desc.backbuffer_height; } if (dst_rect_in) dst_rect = *dst_rect_in; else if (context->surface && !swapchain->desc.windowed) { dst_rect.left = 0; dst_rect.top = 0; dst_rect.right = swapchain->front_buffer->resource.width; dst_rect.bottom = swapchain->front_buffer->resource.height; } else GetClientRect(swapchain->win_handle, &dst_rect); if (!render_to_fbo && (dst_rect.left || dst_rect.top || dst_rect.right != swapchain->desc.backbuffer_width || dst_rect.bottom != swapchain->desc.backbuffer_height)) render_to_fbo = TRUE; /* Rendering to a window of different size, presenting partial rectangles, * or rendering to a different window needs help from FBO_blit or a textured * draw. Render the swapchain to a FBO in the future. * * Note that FBO_blit from the backbuffer to the frontbuffer cannot solve * all these issues - this fails if the window is smaller than the backbuffer. */ if (!swapchain->render_to_fbo && render_to_fbo && wined3d_settings.offscreen_rendering_mode == ORM_FBO) {//.........这里部分代码省略.........
开发者ID:coreyoconnor,项目名称:wine,代码行数:101,
示例23: texture2d_sub_resource_loadstatic void texture2d_sub_resource_load(struct wined3d_resource *sub_resource, struct wined3d_context *context, BOOL srgb){ surface_load(surface_from_resource(sub_resource), srgb);}
开发者ID:alexwgo,项目名称:wine,代码行数:5,
示例24: texture_preload/* Do not call while under the GL lock. */static void texture_preload(IWineD3DBaseTextureImpl *texture, enum WINED3DSRGB srgb){ IWineD3DDeviceImpl *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; unsigned int i; BOOL srgb_mode; TRACE("texture %p, srgb %#x./n", texture, srgb); switch (srgb) { case SRGB_RGB: srgb_mode = FALSE; break; case SRGB_BOTH: texture_preload(texture, SRGB_RGB); /* Fallthrough */ case SRGB_SRGB: srgb_mode = TRUE; break; default: srgb_mode = texture->baseTexture.is_srgb; break; } gl_tex = basetexture_get_gl_texture(texture, gl_info, srgb_mode); if (!device->isInDraw) { /* context_acquire() sets isInDraw to TRUE when loading a pbuffer into a texture, * thus no danger of recursive calls. */ 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 < texture->baseTexture.level_count; ++i) { IWineD3DSurfaceImpl *surface = surface_from_resource(texture->baseTexture.sub_resources[i]); if (palette9_changed(surface)) { TRACE("Reloading surface because the d3d8/9 palette was changed./n"); /* 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 the texture is marked dirty or the srgb sampler setting has changed * since the last load then reload the surfaces. */ if (gl_tex->dirty) { for (i = 0; i < texture->baseTexture.level_count; ++i) { surface_load(surface_from_resource(texture->baseTexture.sub_resources[i]), srgb_mode); } } else { TRACE("Texture %p not dirty, nothing to do./n", texture); } if (context) context_release(context); /* No longer dirty. */ gl_tex->dirty = FALSE;}
开发者ID:dvdhoo,项目名称:wine,代码行数:76,
示例25: texture2d_sub_resource_cleanupstatic void texture2d_sub_resource_cleanup(struct wined3d_resource *sub_resource){ struct wined3d_surface *surface = surface_from_resource(sub_resource); wined3d_surface_destroy(surface);}
开发者ID:alexwgo,项目名称:wine,代码行数:6,
示例26: texture2d_sub_resource_add_dirty_regionstatic void texture2d_sub_resource_add_dirty_region(struct wined3d_resource *sub_resource, const struct wined3d_box *dirty_region){ surface_add_dirty_rect(surface_from_resource(sub_resource), dirty_region);}
开发者ID:pombredanne,项目名称:wine,代码行数:5,
示例27: swapchain_initstatic HRESULT swapchain_init(struct wined3d_swapchain *swapchain, struct wined3d_device *device, struct wined3d_swapchain_desc *desc, void *parent, const struct wined3d_parent_ops *parent_ops){ const struct wined3d_adapter *adapter = device->adapter; struct wined3d_resource_desc texture_desc; struct wined3d_surface *front_buffer; BOOL displaymode_set = FALSE; RECT client_rect; HWND window; HRESULT hr; UINT i; if (desc->backbuffer_count > 1) { FIXME("The application requested more than one back buffer, this is not properly supported./n" "Please configure the application to use double buffering (1 back buffer) if possible./n"); } if (device->wined3d->flags & WINED3D_NO3D) swapchain->swapchain_ops = &swapchain_gdi_ops; else swapchain->swapchain_ops = &swapchain_gl_ops; window = desc->device_window ? desc->device_window : device->create_parms.focus_window; swapchain->device = device; swapchain->parent = parent; swapchain->parent_ops = parent_ops; swapchain->ref = 1; swapchain->win_handle = window; swapchain->device_window = window; if (FAILED(hr = wined3d_get_adapter_display_mode(device->wined3d, adapter->ordinal, &swapchain->original_mode, NULL))) { ERR("Failed to get current display mode, hr %#x./n", hr); goto err; } GetClientRect(window, &client_rect); if (desc->windowed && (!desc->backbuffer_width || !desc->backbuffer_height || desc->backbuffer_format == WINED3DFMT_UNKNOWN)) { if (!desc->backbuffer_width) { desc->backbuffer_width = client_rect.right; TRACE("Updating width to %u./n", desc->backbuffer_width); } if (!desc->backbuffer_height) { desc->backbuffer_height = client_rect.bottom; TRACE("Updating height to %u./n", desc->backbuffer_height); } if (desc->backbuffer_format == WINED3DFMT_UNKNOWN) { desc->backbuffer_format = swapchain->original_mode.format_id; TRACE("Updating format to %s./n", debug_d3dformat(swapchain->original_mode.format_id)); } } swapchain->desc = *desc; swapchain_update_render_to_fbo(swapchain); TRACE("Creating front buffer./n"); texture_desc.resource_type = WINED3D_RTYPE_TEXTURE; texture_desc.format = swapchain->desc.backbuffer_format; texture_desc.multisample_type = swapchain->desc.multisample_type; texture_desc.multisample_quality = swapchain->desc.multisample_quality; texture_desc.usage = 0; texture_desc.pool = WINED3D_POOL_DEFAULT; texture_desc.width = swapchain->desc.backbuffer_width; texture_desc.height = swapchain->desc.backbuffer_height; texture_desc.depth = 1; texture_desc.size = 0; if (FAILED(hr = device->device_parent->ops->create_swapchain_texture(device->device_parent, parent, &texture_desc, &swapchain->front_buffer))) { WARN("Failed to create front buffer, hr %#x./n", hr); goto err; } wined3d_texture_set_swapchain(swapchain->front_buffer, swapchain); front_buffer = surface_from_resource(wined3d_texture_get_sub_resource(swapchain->front_buffer, 0)); if (!(device->wined3d->flags & WINED3D_NO3D)) { surface_validate_location(front_buffer, WINED3D_LOCATION_DRAWABLE); surface_invalidate_location(front_buffer, ~WINED3D_LOCATION_DRAWABLE); } /* MSDN says we're only allowed a single fullscreen swapchain per device, * so we should really check to see if there is a fullscreen swapchain * already. Does a single head count as full screen? */ if (!desc->windowed) {//.........这里部分代码省略.........
开发者ID:AlexSteel,项目名称:wine,代码行数:101,
示例28: swapchain_gl_presentstatic void swapchain_gl_present(struct wined3d_swapchain *swapchain, const RECT *src_rect_in, const RECT *dst_rect_in, const RGNDATA *dirty_region, DWORD flags, struct wined3d_surface *depth_stencil){ struct wined3d_surface *back_buffer = swapchain->back_buffers[0]; const struct wined3d_gl_info *gl_info; struct wined3d_context *context; RECT src_rect, dst_rect; BOOL render_to_fbo; context = context_acquire(swapchain->device, back_buffer); if (!context->valid) { context_release(context); WARN("Invalid context, skipping present./n"); return; } gl_info = context->gl_info; if (swapchain->device->logo_texture) { struct wined3d_surface *src_surface = surface_from_resource( wined3d_texture_get_sub_resource(swapchain->device->logo_texture, 0)); RECT rect = {0, 0, src_surface->resource.width, src_surface->resource.height}; /* Blit the logo into the upper left corner of the drawable. */ wined3d_surface_blt(back_buffer, &rect, src_surface, &rect, WINEDDBLT_ALPHATEST, NULL, WINED3D_TEXF_POINT); } TRACE("Presenting HDC %p./n", context->hdc); render_to_fbo = swapchain->render_to_fbo; if (src_rect_in) { src_rect = *src_rect_in; if (!render_to_fbo && (src_rect.left || src_rect.top || src_rect.right != swapchain->desc.backbuffer_width || src_rect.bottom != swapchain->desc.backbuffer_height)) { render_to_fbo = TRUE; } } else { src_rect.left = 0; src_rect.top = 0; src_rect.right = swapchain->desc.backbuffer_width; src_rect.bottom = swapchain->desc.backbuffer_height; } if (dst_rect_in) dst_rect = *dst_rect_in; else GetClientRect(swapchain->win_handle, &dst_rect); if (!render_to_fbo && (dst_rect.left || dst_rect.top || dst_rect.right != swapchain->desc.backbuffer_width || dst_rect.bottom != swapchain->desc.backbuffer_height)) render_to_fbo = TRUE; /* Rendering to a window of different size, presenting partial rectangles, * or rendering to a different window needs help from FBO_blit or a textured * draw. Render the swapchain to a FBO in the future. * * Note that FBO_blit from the backbuffer to the frontbuffer cannot solve * all these issues - this fails if the window is smaller than the backbuffer. */ if (!swapchain->render_to_fbo && render_to_fbo && wined3d_settings.offscreen_rendering_mode == ORM_FBO) { wined3d_resource_load_location(&back_buffer->resource, context, WINED3D_LOCATION_TEXTURE_RGB); wined3d_resource_invalidate_location(&back_buffer->resource, WINED3D_LOCATION_DRAWABLE); swapchain->render_to_fbo = TRUE; swapchain_update_draw_bindings(swapchain); } else { wined3d_resource_load_location(&back_buffer->resource, context, back_buffer->draw_binding); } if (swapchain->render_to_fbo) { static unsigned int once; if (swapchain->desc.swap_effect == WINED3D_SWAP_EFFECT_FLIP && !once++) FIXME("WINED3D_SWAP_EFFECT_FLIP not implemented./n"); swapchain_blit(swapchain, context, &src_rect, &dst_rect); } if (swapchain->num_contexts > 1 && !wined3d_settings.cs_multithreaded) gl_info->gl_ops.gl.p_glFlush(); /* call wglSwapBuffers through the gl table to avoid confusing the Steam overlay */ gl_info->gl_ops.wgl.p_wglSwapBuffers(context->hdc); /* TODO: cycle through the swapchain buffers */ TRACE("SwapBuffers called, Starting new frame/n"); /* FPS support *///.........这里部分代码省略.........
开发者ID:Dimillian,项目名称:wine,代码行数:101,
示例29: swapchain_blit/* A GL context is provided by the caller */static void swapchain_blit(const struct wined3d_swapchain *swapchain, struct wined3d_context *context, const RECT *src_rect, const RECT *dst_rect){ struct wined3d_surface *backbuffer = surface_from_resource( wined3d_texture_get_sub_resource(swapchain->back_buffers[0], 0)); UINT src_w = src_rect->right - src_rect->left; UINT src_h = src_rect->bottom - src_rect->top; GLenum gl_filter; const struct wined3d_gl_info *gl_info = context->gl_info; RECT win_rect; UINT win_h; TRACE("swapchain %p, context %p, src_rect %s, dst_rect %s./n", swapchain, context, wine_dbgstr_rect(src_rect), wine_dbgstr_rect(dst_rect)); if (src_w == dst_rect->right - dst_rect->left && src_h == dst_rect->bottom - dst_rect->top) gl_filter = GL_NEAREST; else gl_filter = GL_LINEAR; GetClientRect(swapchain->win_handle, &win_rect); win_h = win_rect.bottom - win_rect.top; if (gl_info->fbo_ops.glBlitFramebuffer && is_identity_fixup(backbuffer->resource.format->color_fixup)) { DWORD location = WINED3D_LOCATION_TEXTURE_RGB; if (backbuffer->resource.multisample_type) { location = WINED3D_LOCATION_RB_RESOLVED; surface_load_location(backbuffer, context, location); } context_apply_fbo_state_blit(context, GL_READ_FRAMEBUFFER, backbuffer, NULL, location); gl_info->gl_ops.gl.p_glReadBuffer(GL_COLOR_ATTACHMENT0); context_check_fbo_status(context, GL_READ_FRAMEBUFFER); context_apply_fbo_state_blit(context, GL_DRAW_FRAMEBUFFER, surface_from_resource(wined3d_texture_get_sub_resource(swapchain->front_buffer, 0)), NULL, WINED3D_LOCATION_DRAWABLE); context_set_draw_buffer(context, GL_BACK); context_invalidate_state(context, STATE_FRAMEBUFFER); gl_info->gl_ops.gl.p_glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); context_invalidate_state(context, STATE_RENDER(WINED3D_RS_COLORWRITEENABLE)); context_invalidate_state(context, STATE_RENDER(WINED3D_RS_COLORWRITEENABLE1)); context_invalidate_state(context, STATE_RENDER(WINED3D_RS_COLORWRITEENABLE2)); context_invalidate_state(context, STATE_RENDER(WINED3D_RS_COLORWRITEENABLE3)); gl_info->gl_ops.gl.p_glDisable(GL_SCISSOR_TEST); context_invalidate_state(context, STATE_RENDER(WINED3D_RS_SCISSORTESTENABLE)); /* Note that the texture is upside down */ gl_info->fbo_ops.glBlitFramebuffer(src_rect->left, src_rect->top, src_rect->right, src_rect->bottom, dst_rect->left, win_h - dst_rect->top, dst_rect->right, win_h - dst_rect->bottom, GL_COLOR_BUFFER_BIT, gl_filter); checkGLcall("Swapchain present blit(EXT_framebuffer_blit)/n"); } else { struct wined3d_device *device = swapchain->device; struct wined3d_context *context2; float tex_left = src_rect->left; float tex_top = src_rect->top; float tex_right = src_rect->right; float tex_bottom = src_rect->bottom; context2 = context_acquire(device, backbuffer); context_apply_blit_state(context2, device); if (backbuffer->container->flags & WINED3D_TEXTURE_NORMALIZED_COORDS) { tex_left /= backbuffer->pow2Width; tex_right /= backbuffer->pow2Width; tex_top /= backbuffer->pow2Height; tex_bottom /= backbuffer->pow2Height; } if (is_complex_fixup(backbuffer->resource.format->color_fixup)) gl_filter = GL_NEAREST; context_apply_fbo_state_blit(context2, GL_FRAMEBUFFER, surface_from_resource(wined3d_texture_get_sub_resource(swapchain->front_buffer, 0)), NULL, WINED3D_LOCATION_DRAWABLE); context_bind_texture(context2, backbuffer->texture_target, backbuffer->container->texture_rgb.name); /* Set up the texture. The surface is not in a wined3d_texture * container, so there are no D3D texture settings to dirtify. */ device->blitter->set_shader(device->blit_priv, context2, backbuffer, NULL); gl_info->gl_ops.gl.p_glTexParameteri(backbuffer->texture_target, GL_TEXTURE_MIN_FILTER, gl_filter); gl_info->gl_ops.gl.p_glTexParameteri(backbuffer->texture_target, GL_TEXTURE_MAG_FILTER, gl_filter); context_set_draw_buffer(context, GL_BACK); /* Set the viewport to the destination rectandle, disable any projection * transformation set up by context_apply_blit_state(), and draw a * (-1,-1)-(1,1) quad. * * Back up viewport and matrix to avoid breaking last_was_blit//.........这里部分代码省略.........
开发者ID:AlexSteel,项目名称:wine,代码行数:101,
注:本文中的surface_from_resource函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ suser函数代码示例 C++ surf函数代码示例 |