wined3d: Introduce wined3d_texture_use_pbo().
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
ef8162751e
commit
bad4849257
|
@ -518,19 +518,6 @@ static void surface_evict_sysmem(struct wined3d_surface *surface)
|
|||
surface_invalidate_location(surface, WINED3D_LOCATION_SYSMEM);
|
||||
}
|
||||
|
||||
static BOOL surface_use_pbo(const struct wined3d_surface *surface)
|
||||
{
|
||||
const struct wined3d_gl_info *gl_info = &surface->resource.device->adapter->gl_info;
|
||||
struct wined3d_texture *texture = surface->container;
|
||||
|
||||
return texture->resource.pool == WINED3D_POOL_DEFAULT
|
||||
&& surface->resource.access_flags & WINED3D_RESOURCE_ACCESS_CPU
|
||||
&& gl_info->supported[ARB_PIXEL_BUFFER_OBJECT]
|
||||
&& !texture->resource.format->convert
|
||||
&& !(texture->flags & WINED3D_TEXTURE_PIN_SYSMEM)
|
||||
&& !(texture->flags & WINED3D_TEXTURE_COND_NP2_EMULATED);
|
||||
}
|
||||
|
||||
static HRESULT surface_private_setup(struct wined3d_surface *surface)
|
||||
{
|
||||
/* TODO: Check against the maximum texture sizes supported by the video card. */
|
||||
|
@ -597,7 +584,7 @@ static HRESULT surface_private_setup(struct wined3d_surface *surface)
|
|||
if (texture->resource.usage & WINED3DUSAGE_DEPTHSTENCIL)
|
||||
surface->locations = WINED3D_LOCATION_DISCARDED;
|
||||
|
||||
if (surface_use_pbo(surface))
|
||||
if (wined3d_texture_use_pbo(texture, gl_info))
|
||||
surface->resource.map_binding = WINED3D_LOCATION_BUFFER;
|
||||
|
||||
return WINED3D_OK;
|
||||
|
@ -1743,7 +1730,8 @@ HRESULT wined3d_surface_update_desc(struct wined3d_surface *surface, const struc
|
|||
* If the surface didn't use PBOs previously but could now, don't
|
||||
* change it - whatever made us not use PBOs might come back, e.g.
|
||||
* color keys. */
|
||||
if (surface->resource.map_binding == WINED3D_LOCATION_BUFFER && !surface_use_pbo(surface))
|
||||
if (surface->resource.map_binding == WINED3D_LOCATION_BUFFER
|
||||
&& !wined3d_texture_use_pbo(surface->container, gl_info))
|
||||
surface->resource.map_binding = create_dib ? WINED3D_LOCATION_DIB : WINED3D_LOCATION_SYSMEM;
|
||||
|
||||
if (create_dib)
|
||||
|
|
|
@ -28,6 +28,15 @@ WINE_DEFAULT_DEBUG_CHANNEL(d3d_texture);
|
|||
WINE_DECLARE_DEBUG_CHANNEL(d3d_perf);
|
||||
WINE_DECLARE_DEBUG_CHANNEL(winediag);
|
||||
|
||||
BOOL wined3d_texture_use_pbo(const struct wined3d_texture *texture, const struct wined3d_gl_info *gl_info)
|
||||
{
|
||||
return texture->resource.pool == WINED3D_POOL_DEFAULT
|
||||
&& texture->resource.access_flags & WINED3D_RESOURCE_ACCESS_CPU
|
||||
&& gl_info->supported[ARB_PIXEL_BUFFER_OBJECT]
|
||||
&& !texture->resource.format->convert
|
||||
&& !(texture->flags & (WINED3D_TEXTURE_PIN_SYSMEM | WINED3D_TEXTURE_COND_NP2_EMULATED));
|
||||
}
|
||||
|
||||
static HRESULT wined3d_texture_init(struct wined3d_texture *texture, const struct wined3d_texture_ops *texture_ops,
|
||||
UINT layer_count, UINT level_count, const struct wined3d_resource_desc *desc, DWORD flags,
|
||||
struct wined3d_device *device, void *parent, const struct wined3d_parent_ops *parent_ops,
|
||||
|
@ -61,6 +70,8 @@ static HRESULT wined3d_texture_init(struct wined3d_texture *texture, const struc
|
|||
return hr;
|
||||
}
|
||||
wined3d_resource_update_draw_binding(&texture->resource);
|
||||
if ((flags & WINED3D_TEXTURE_CREATE_MAPPABLE) || desc->format == WINED3DFMT_D16_LOCKABLE)
|
||||
texture->resource.access_flags |= WINED3D_RESOURCE_ACCESS_CPU;
|
||||
|
||||
texture->texture_ops = texture_ops;
|
||||
|
||||
|
|
|
@ -489,9 +489,7 @@ HRESULT wined3d_volume_init(struct wined3d_volume *volume, struct wined3d_textur
|
|||
volume->texture_level = level;
|
||||
volume->locations = WINED3D_LOCATION_DISCARDED;
|
||||
|
||||
if (desc->pool == WINED3D_POOL_DEFAULT && desc->usage & WINED3DUSAGE_DYNAMIC
|
||||
&& gl_info->supported[ARB_PIXEL_BUFFER_OBJECT]
|
||||
&& !format->convert)
|
||||
if (wined3d_texture_use_pbo(container, gl_info))
|
||||
{
|
||||
wined3d_resource_free_sysmem(&volume->resource);
|
||||
volume->resource.map_binding = WINED3D_LOCATION_BUFFER;
|
||||
|
|
|
@ -2458,6 +2458,8 @@ void wined3d_texture_remove_buffer_object(struct wined3d_texture *texture,
|
|||
void wined3d_texture_set_dirty(struct wined3d_texture *texture) DECLSPEC_HIDDEN;
|
||||
void wined3d_texture_set_swapchain(struct wined3d_texture *texture,
|
||||
struct wined3d_swapchain *swapchain) DECLSPEC_HIDDEN;
|
||||
BOOL wined3d_texture_use_pbo(const struct wined3d_texture *texture,
|
||||
const struct wined3d_gl_info *gl_info) DECLSPEC_HIDDEN;
|
||||
|
||||
#define WINED3D_LOCATION_DISCARDED 0x00000001
|
||||
#define WINED3D_LOCATION_SYSMEM 0x00000002
|
||||
|
|
Loading…
Reference in New Issue