wined3d: Get rid of surface_set_texture_target().
This commit is contained in:
parent
23eed88fde
commit
5cf9fe1c63
|
@ -671,8 +671,6 @@ static HRESULT surface_private_setup(struct wined3d_surface *surface)
|
||||||
|
|
||||||
TRACE("surface %p.\n", surface);
|
TRACE("surface %p.\n", surface);
|
||||||
|
|
||||||
surface->texture_target = GL_TEXTURE_2D;
|
|
||||||
|
|
||||||
/* Non-power2 support */
|
/* Non-power2 support */
|
||||||
if (gl_info->supported[ARB_TEXTURE_NON_POWER_OF_TWO] || gl_info->supported[WINED3D_GL_NORMALIZED_TEXRECT]
|
if (gl_info->supported[ARB_TEXTURE_NON_POWER_OF_TWO] || gl_info->supported[WINED3D_GL_NORMALIZED_TEXRECT]
|
||||||
|| gl_info->supported[ARB_TEXTURE_RECTANGLE])
|
|| gl_info->supported[ARB_TEXTURE_RECTANGLE])
|
||||||
|
@ -1436,26 +1434,6 @@ static const struct wined3d_surface_ops gdi_surface_ops =
|
||||||
gdi_surface_unmap,
|
gdi_surface_unmap,
|
||||||
};
|
};
|
||||||
|
|
||||||
void surface_set_texture_target(struct wined3d_surface *surface, GLenum target, GLint level)
|
|
||||||
{
|
|
||||||
TRACE("surface %p, target %#x.\n", surface, target);
|
|
||||||
|
|
||||||
if (surface->texture_target != target)
|
|
||||||
{
|
|
||||||
if (target == GL_TEXTURE_RECTANGLE_ARB)
|
|
||||||
{
|
|
||||||
surface->flags &= ~SFLAG_NORMCOORD;
|
|
||||||
}
|
|
||||||
else if (surface->texture_target == GL_TEXTURE_RECTANGLE_ARB)
|
|
||||||
{
|
|
||||||
surface->flags |= SFLAG_NORMCOORD;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
surface->texture_target = target;
|
|
||||||
surface->texture_level = level;
|
|
||||||
surface_force_reload(surface);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* This call just downloads data, the caller is responsible for binding the
|
/* This call just downloads data, the caller is responsible for binding the
|
||||||
* correct texture. */
|
* correct texture. */
|
||||||
/* Context activation is done by the caller. */
|
/* Context activation is done by the caller. */
|
||||||
|
@ -6300,7 +6278,7 @@ cpu:
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT surface_init(struct wined3d_surface *surface, struct wined3d_texture *container,
|
static HRESULT surface_init(struct wined3d_surface *surface, struct wined3d_texture *container,
|
||||||
const struct wined3d_resource_desc *desc, DWORD flags)
|
const struct wined3d_resource_desc *desc, GLenum target, GLint level, DWORD flags)
|
||||||
{
|
{
|
||||||
struct wined3d_device *device = container->resource.device;
|
struct wined3d_device *device = container->resource.device;
|
||||||
const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
|
const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
|
||||||
|
@ -6370,7 +6348,8 @@ static HRESULT surface_init(struct wined3d_surface *surface, struct wined3d_text
|
||||||
list_init(&surface->overlays);
|
list_init(&surface->overlays);
|
||||||
|
|
||||||
/* Flags */
|
/* Flags */
|
||||||
surface->flags |= SFLAG_NORMCOORD; /* Default to normalized coords. */
|
if (target != GL_TEXTURE_RECTANGLE_ARB)
|
||||||
|
surface->flags |= SFLAG_NORMCOORD;
|
||||||
if (flags & WINED3D_SURFACE_DISCARD)
|
if (flags & WINED3D_SURFACE_DISCARD)
|
||||||
surface->flags |= SFLAG_DISCARD;
|
surface->flags |= SFLAG_DISCARD;
|
||||||
if (flags & WINED3D_SURFACE_PIN_SYSMEM)
|
if (flags & WINED3D_SURFACE_PIN_SYSMEM)
|
||||||
|
@ -6379,6 +6358,8 @@ static HRESULT surface_init(struct wined3d_surface *surface, struct wined3d_text
|
||||||
surface->resource.access_flags |= WINED3D_RESOURCE_ACCESS_CPU;
|
surface->resource.access_flags |= WINED3D_RESOURCE_ACCESS_CPU;
|
||||||
|
|
||||||
surface->map_binding = WINED3D_LOCATION_SYSMEM;
|
surface->map_binding = WINED3D_LOCATION_SYSMEM;
|
||||||
|
surface->texture_target = target;
|
||||||
|
surface->texture_level = level;
|
||||||
|
|
||||||
/* Call the private setup routine */
|
/* Call the private setup routine */
|
||||||
hr = surface->surface_ops->surface_private_setup(surface);
|
hr = surface->surface_ops->surface_private_setup(surface);
|
||||||
|
@ -6407,8 +6388,8 @@ static HRESULT surface_init(struct wined3d_surface *surface, struct wined3d_text
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT CDECL wined3d_surface_create(struct wined3d_texture *container,
|
HRESULT wined3d_surface_create(struct wined3d_texture *container, const struct wined3d_resource_desc *desc,
|
||||||
const struct wined3d_resource_desc *desc, DWORD flags, struct wined3d_surface **surface)
|
GLenum target, GLint level, DWORD flags, struct wined3d_surface **surface)
|
||||||
{
|
{
|
||||||
struct wined3d_device_parent *device_parent = container->resource.device->device_parent;
|
struct wined3d_device_parent *device_parent = container->resource.device->device_parent;
|
||||||
const struct wined3d_parent_ops *parent_ops;
|
const struct wined3d_parent_ops *parent_ops;
|
||||||
|
@ -6416,16 +6397,16 @@ HRESULT CDECL wined3d_surface_create(struct wined3d_texture *container,
|
||||||
void *parent;
|
void *parent;
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
|
||||||
TRACE("container %p, width %u, height %u, format %s, usage %s (%#x), "
|
TRACE("container %p, width %u, height %u, format %s, usage %s (%#x), pool %s, "
|
||||||
"pool %s, multisample_type %#x, multisample_quality %u, flags %#x, surface %p.\n",
|
"multisample_type %#x, multisample_quality %u, target %#x, level %d, flags %#x, surface %p.\n",
|
||||||
container, desc->width, desc->height, debug_d3dformat(desc->format),
|
container, desc->width, desc->height, debug_d3dformat(desc->format),
|
||||||
debug_d3dusage(desc->usage), desc->usage, debug_d3dpool(desc->pool),
|
debug_d3dusage(desc->usage), desc->usage, debug_d3dpool(desc->pool),
|
||||||
desc->multisample_type, desc->multisample_quality, flags, surface);
|
desc->multisample_type, desc->multisample_quality, target, level, flags, surface);
|
||||||
|
|
||||||
if (!(object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object))))
|
if (!(object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object))))
|
||||||
return E_OUTOFMEMORY;
|
return E_OUTOFMEMORY;
|
||||||
|
|
||||||
if (FAILED(hr = surface_init(object, container, desc, flags)))
|
if (FAILED(hr = surface_init(object, container, desc, target, level, flags)))
|
||||||
{
|
{
|
||||||
WARN("Failed to initialize surface, returning %#x.\n", hr);
|
WARN("Failed to initialize surface, returning %#x.\n", hr);
|
||||||
HeapFree(GetProcessHeap(), 0, object);
|
HeapFree(GetProcessHeap(), 0, object);
|
||||||
|
|
|
@ -744,7 +744,6 @@ static void texture2d_sub_resource_cleanup(struct wined3d_resource *sub_resource
|
||||||
{
|
{
|
||||||
struct wined3d_surface *surface = surface_from_resource(sub_resource);
|
struct wined3d_surface *surface = surface_from_resource(sub_resource);
|
||||||
|
|
||||||
surface_set_texture_target(surface, 0, 0);
|
|
||||||
surface_set_container(surface, NULL);
|
surface_set_container(surface, NULL);
|
||||||
wined3d_surface_decref(surface);
|
wined3d_surface_decref(surface);
|
||||||
}
|
}
|
||||||
|
@ -879,14 +878,14 @@ static HRESULT cubetexture_init(struct wined3d_texture *texture, const struct wi
|
||||||
UINT idx = j * texture->level_count + i;
|
UINT idx = j * texture->level_count + i;
|
||||||
struct wined3d_surface *surface;
|
struct wined3d_surface *surface;
|
||||||
|
|
||||||
if (FAILED(hr = wined3d_surface_create(texture, &surface_desc, surface_flags, &surface)))
|
if (FAILED(hr = wined3d_surface_create(texture, &surface_desc,
|
||||||
|
cube_targets[j], i, surface_flags, &surface)))
|
||||||
{
|
{
|
||||||
WARN("Failed to create surface, hr %#x.\n", hr);
|
WARN("Failed to create surface, hr %#x.\n", hr);
|
||||||
wined3d_texture_cleanup(texture);
|
wined3d_texture_cleanup(texture);
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
|
||||||
surface_set_texture_target(surface, cube_targets[j], i);
|
|
||||||
texture->sub_resources[idx] = &surface->resource;
|
texture->sub_resources[idx] = &surface->resource;
|
||||||
TRACE("Created surface level %u @ %p.\n", i, surface);
|
TRACE("Created surface level %u @ %p.\n", i, surface);
|
||||||
}
|
}
|
||||||
|
@ -1033,14 +1032,14 @@ static HRESULT texture_init(struct wined3d_texture *texture, const struct wined3
|
||||||
{
|
{
|
||||||
struct wined3d_surface *surface;
|
struct wined3d_surface *surface;
|
||||||
|
|
||||||
if (FAILED(hr = wined3d_surface_create(texture, &surface_desc, surface_flags, &surface)))
|
if (FAILED(hr = wined3d_surface_create(texture, &surface_desc,
|
||||||
|
texture->target, i, surface_flags, &surface)))
|
||||||
{
|
{
|
||||||
WARN("Failed to create surface, hr %#x.\n", hr);
|
WARN("Failed to create surface, hr %#x.\n", hr);
|
||||||
wined3d_texture_cleanup(texture);
|
wined3d_texture_cleanup(texture);
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
|
||||||
surface_set_texture_target(surface, texture->target, i);
|
|
||||||
texture->sub_resources[i] = &surface->resource;
|
texture->sub_resources[i] = &surface->resource;
|
||||||
TRACE("Created surface level %u @ %p.\n", i, surface);
|
TRACE("Created surface level %u @ %p.\n", i, surface);
|
||||||
/* Calculate the next mipmap level. */
|
/* Calculate the next mipmap level. */
|
||||||
|
|
|
@ -2299,8 +2299,8 @@ void surface_update_draw_binding(struct wined3d_surface *surface) DECLSPEC_HIDDE
|
||||||
HRESULT surface_upload_from_surface(struct wined3d_surface *dst_surface, const POINT *dst_point,
|
HRESULT surface_upload_from_surface(struct wined3d_surface *dst_surface, const POINT *dst_point,
|
||||||
struct wined3d_surface *src_surface, const RECT *src_rect) DECLSPEC_HIDDEN;
|
struct wined3d_surface *src_surface, const RECT *src_rect) DECLSPEC_HIDDEN;
|
||||||
void surface_validate_location(struct wined3d_surface *surface, DWORD location) DECLSPEC_HIDDEN;
|
void surface_validate_location(struct wined3d_surface *surface, DWORD location) DECLSPEC_HIDDEN;
|
||||||
HRESULT CDECL wined3d_surface_create(struct wined3d_texture *container,
|
HRESULT wined3d_surface_create(struct wined3d_texture *container, const struct wined3d_resource_desc *desc,
|
||||||
const struct wined3d_resource_desc *desc, DWORD flags, struct wined3d_surface **surface) DECLSPEC_HIDDEN;
|
GLenum target, GLint level, DWORD flags, struct wined3d_surface **surface) DECLSPEC_HIDDEN;
|
||||||
void surface_prepare_map_memory(struct wined3d_surface *surface) DECLSPEC_HIDDEN;
|
void surface_prepare_map_memory(struct wined3d_surface *surface) DECLSPEC_HIDDEN;
|
||||||
|
|
||||||
void get_drawable_size_swapchain(const struct wined3d_context *context, UINT *width, UINT *height) DECLSPEC_HIDDEN;
|
void get_drawable_size_swapchain(const struct wined3d_context *context, UINT *width, UINT *height) DECLSPEC_HIDDEN;
|
||||||
|
|
Loading…
Reference in New Issue