wined3d: Pass gl_info to surface_bind().
This commit is contained in:
parent
7832577ad7
commit
39aa477e4c
|
@ -5499,7 +5499,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_UpdateSurface(IWineD3DDevice *iface,
|
||||||
|
|
||||||
/* Make sure the surface is loaded and up to date */
|
/* Make sure the surface is loaded and up to date */
|
||||||
surface_internal_preload(dst_impl, SRGB_RGB);
|
surface_internal_preload(dst_impl, SRGB_RGB);
|
||||||
surface_bind(dst_impl, FALSE);
|
surface_bind(dst_impl, gl_info, FALSE);
|
||||||
|
|
||||||
src_w = src_impl->currentDesc.Width;
|
src_w = src_impl->currentDesc.Width;
|
||||||
src_h = src_impl->currentDesc.Height;
|
src_h = src_impl->currentDesc.Height;
|
||||||
|
|
|
@ -694,14 +694,13 @@ void surface_set_texture_target(IWineD3DSurfaceImpl *surface, GLenum target)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Context activation is done by the caller. */
|
/* Context activation is done by the caller. */
|
||||||
void surface_bind(IWineD3DSurfaceImpl *surface, BOOL srgb)
|
void surface_bind(IWineD3DSurfaceImpl *surface, const struct wined3d_gl_info *gl_info, BOOL srgb)
|
||||||
{
|
{
|
||||||
TRACE("surface %p, srgb %#x.\n", surface, srgb);
|
TRACE("surface %p, gl_info %p, srgb %#x.\n", surface, gl_info, srgb);
|
||||||
|
|
||||||
if (surface->container.type == WINED3D_CONTAINER_TEXTURE)
|
if (surface->container.type == WINED3D_CONTAINER_TEXTURE)
|
||||||
{
|
{
|
||||||
IWineD3DBaseTextureImpl *texture = surface->container.u.texture;
|
IWineD3DBaseTextureImpl *texture = surface->container.u.texture;
|
||||||
const struct wined3d_gl_info *gl_info = &texture->resource.device->adapter->gl_info;
|
|
||||||
|
|
||||||
TRACE("Passing to container (%p).\n", texture);
|
TRACE("Passing to container (%p).\n", texture);
|
||||||
texture->baseTexture.texture_ops->texture_bind(texture, gl_info, srgb);
|
texture->baseTexture.texture_ops->texture_bind(texture, gl_info, srgb);
|
||||||
|
@ -746,7 +745,10 @@ void surface_bind(IWineD3DSurfaceImpl *surface, BOOL srgb)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Context activation is done by the caller. */
|
/* Context activation is done by the caller. */
|
||||||
static void surface_bind_and_dirtify(IWineD3DSurfaceImpl *This, BOOL srgb) {
|
static void surface_bind_and_dirtify(IWineD3DSurfaceImpl *surface,
|
||||||
|
const struct wined3d_gl_info *gl_info, BOOL srgb)
|
||||||
|
{
|
||||||
|
IWineD3DDeviceImpl *device = surface->resource.device;
|
||||||
DWORD active_sampler;
|
DWORD active_sampler;
|
||||||
|
|
||||||
/* We don't need a specific texture unit, but after binding the texture the current unit is dirty.
|
/* We don't need a specific texture unit, but after binding the texture the current unit is dirty.
|
||||||
|
@ -764,13 +766,13 @@ static void surface_bind_and_dirtify(IWineD3DSurfaceImpl *This, BOOL srgb) {
|
||||||
ENTER_GL();
|
ENTER_GL();
|
||||||
glGetIntegerv(GL_ACTIVE_TEXTURE, &active_texture);
|
glGetIntegerv(GL_ACTIVE_TEXTURE, &active_texture);
|
||||||
LEAVE_GL();
|
LEAVE_GL();
|
||||||
active_sampler = This->resource.device->rev_tex_unit_map[active_texture - GL_TEXTURE0_ARB];
|
active_sampler = device->rev_tex_unit_map[active_texture - GL_TEXTURE0_ARB];
|
||||||
|
|
||||||
if (active_sampler != WINED3D_UNMAPPED_STAGE)
|
if (active_sampler != WINED3D_UNMAPPED_STAGE)
|
||||||
{
|
{
|
||||||
IWineD3DDeviceImpl_MarkStateDirty(This->resource.device, STATE_SAMPLER(active_sampler));
|
IWineD3DDeviceImpl_MarkStateDirty(device, STATE_SAMPLER(active_sampler));
|
||||||
}
|
}
|
||||||
surface_bind(This, srgb);
|
surface_bind(surface, gl_info, srgb);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This function checks if the primary render target uses the 8bit paletted format. */
|
/* This function checks if the primary render target uses the 8bit paletted format. */
|
||||||
|
@ -1703,7 +1705,7 @@ static void read_from_framebuffer_texture(IWineD3DSurfaceImpl *This, BOOL srgb)
|
||||||
gl_info = context->gl_info;
|
gl_info = context->gl_info;
|
||||||
|
|
||||||
surface_prepare_texture(This, gl_info, srgb);
|
surface_prepare_texture(This, gl_info, srgb);
|
||||||
surface_bind_and_dirtify(This, srgb);
|
surface_bind_and_dirtify(This, gl_info, srgb);
|
||||||
|
|
||||||
TRACE("Reading back offscreen render target %p.\n", This);
|
TRACE("Reading back offscreen render target %p.\n", This);
|
||||||
|
|
||||||
|
@ -1735,7 +1737,7 @@ static void surface_prepare_texture_internal(IWineD3DSurfaceImpl *surface,
|
||||||
if (convert != NO_CONVERSION || format.convert) surface->flags |= SFLAG_CONVERTED;
|
if (convert != NO_CONVERSION || format.convert) surface->flags |= SFLAG_CONVERTED;
|
||||||
else surface->flags &= ~SFLAG_CONVERTED;
|
else surface->flags &= ~SFLAG_CONVERTED;
|
||||||
|
|
||||||
surface_bind_and_dirtify(surface, srgb);
|
surface_bind_and_dirtify(surface, gl_info, srgb);
|
||||||
surface_allocate_surface(surface, gl_info, &format, srgb);
|
surface_allocate_surface(surface, gl_info, &format, srgb);
|
||||||
surface->flags |= alloc_flag;
|
surface->flags |= alloc_flag;
|
||||||
}
|
}
|
||||||
|
@ -2102,13 +2104,13 @@ static void surface_release_client_storage(IWineD3DSurfaceImpl *surface)
|
||||||
glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_FALSE);
|
glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_FALSE);
|
||||||
if (surface->texture_name)
|
if (surface->texture_name)
|
||||||
{
|
{
|
||||||
surface_bind_and_dirtify(surface, FALSE);
|
surface_bind_and_dirtify(surface, context->gl_info, FALSE);
|
||||||
glTexImage2D(surface->texture_target, surface->texture_level,
|
glTexImage2D(surface->texture_target, surface->texture_level,
|
||||||
GL_RGB, 1, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, NULL);
|
GL_RGB, 1, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, NULL);
|
||||||
}
|
}
|
||||||
if (surface->texture_name_srgb)
|
if (surface->texture_name_srgb)
|
||||||
{
|
{
|
||||||
surface_bind_and_dirtify(surface, TRUE);
|
surface_bind_and_dirtify(surface, context->gl_info, TRUE);
|
||||||
glTexImage2D(surface->texture_target, surface->texture_level,
|
glTexImage2D(surface->texture_target, surface->texture_level,
|
||||||
GL_RGB, 1, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, NULL);
|
GL_RGB, 1, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, NULL);
|
||||||
}
|
}
|
||||||
|
@ -4425,7 +4427,7 @@ HRESULT surface_load_location(IWineD3DSurfaceImpl *surface, DWORD flag, const RE
|
||||||
|
|
||||||
if (!device->isInDraw) context = context_acquire(device, NULL);
|
if (!device->isInDraw) context = context_acquire(device, NULL);
|
||||||
|
|
||||||
surface_bind_and_dirtify(surface, !(surface->flags & SFLAG_INTEXTURE));
|
surface_bind_and_dirtify(surface, gl_info, !(surface->flags & SFLAG_INTEXTURE));
|
||||||
surface_download_data(surface, gl_info);
|
surface_download_data(surface, gl_info);
|
||||||
|
|
||||||
if (context) context_release(context);
|
if (context) context_release(context);
|
||||||
|
@ -4571,7 +4573,7 @@ HRESULT surface_load_location(IWineD3DSurfaceImpl *surface, DWORD flag, const RE
|
||||||
if (!device->isInDraw) context = context_acquire(device, NULL);
|
if (!device->isInDraw) context = context_acquire(device, NULL);
|
||||||
|
|
||||||
surface_prepare_texture(surface, gl_info, srgb);
|
surface_prepare_texture(surface, gl_info, srgb);
|
||||||
surface_bind_and_dirtify(surface, srgb);
|
surface_bind_and_dirtify(surface, gl_info, srgb);
|
||||||
|
|
||||||
if (surface->CKeyFlags & WINEDDSD_CKSRCBLT)
|
if (surface->CKeyFlags & WINEDDSD_CKSRCBLT)
|
||||||
{
|
{
|
||||||
|
|
|
@ -2173,7 +2173,7 @@ static inline GLuint surface_get_texture_name(IWineD3DSurfaceImpl *surface,
|
||||||
}
|
}
|
||||||
|
|
||||||
void surface_add_dirty_rect(IWineD3DSurfaceImpl *surface, const RECT *dirty_rect) DECLSPEC_HIDDEN;
|
void surface_add_dirty_rect(IWineD3DSurfaceImpl *surface, const RECT *dirty_rect) DECLSPEC_HIDDEN;
|
||||||
void surface_bind(IWineD3DSurfaceImpl *surface, BOOL srgb) DECLSPEC_HIDDEN;
|
void surface_bind(IWineD3DSurfaceImpl *surface, const struct wined3d_gl_info *gl_info, BOOL srgb) DECLSPEC_HIDDEN;
|
||||||
HRESULT surface_color_fill(IWineD3DSurfaceImpl *s, const RECT *rect, const WINED3DCOLORVALUE *color) DECLSPEC_HIDDEN;
|
HRESULT surface_color_fill(IWineD3DSurfaceImpl *s, const RECT *rect, const WINED3DCOLORVALUE *color) DECLSPEC_HIDDEN;
|
||||||
void surface_gdi_cleanup(IWineD3DSurfaceImpl *This) DECLSPEC_HIDDEN;
|
void surface_gdi_cleanup(IWineD3DSurfaceImpl *This) DECLSPEC_HIDDEN;
|
||||||
GLenum surface_get_gl_buffer(IWineD3DSurfaceImpl *surface) DECLSPEC_HIDDEN;
|
GLenum surface_get_gl_buffer(IWineD3DSurfaceImpl *surface) DECLSPEC_HIDDEN;
|
||||||
|
|
Loading…
Reference in New Issue