wined3d: Use wined3d_texture_get_sub_resource_target() in surface_load_fb_texture().
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
00badb07bc
commit
623ac9fe04
|
@ -1529,15 +1529,17 @@ error:
|
||||||
* switch to a different context and restore the original one before return. */
|
* switch to a different context and restore the original one before return. */
|
||||||
void surface_load_fb_texture(struct wined3d_surface *surface, BOOL srgb, struct wined3d_context *old_ctx)
|
void surface_load_fb_texture(struct wined3d_surface *surface, BOOL srgb, struct wined3d_context *old_ctx)
|
||||||
{
|
{
|
||||||
|
unsigned int sub_resource_idx = surface_get_sub_resource_idx(surface);
|
||||||
struct wined3d_texture *texture = surface->container;
|
struct wined3d_texture *texture = surface->container;
|
||||||
struct wined3d_device *device = texture->resource.device;
|
struct wined3d_device *device = texture->resource.device;
|
||||||
const struct wined3d_gl_info *gl_info;
|
const struct wined3d_gl_info *gl_info;
|
||||||
struct wined3d_context *context = old_ctx;
|
struct wined3d_context *context = old_ctx;
|
||||||
struct wined3d_surface *restore_rt = NULL;
|
struct wined3d_surface *restore_rt = NULL;
|
||||||
|
GLenum target;
|
||||||
|
|
||||||
restore_rt = context_get_rt_surface(old_ctx);
|
restore_rt = context_get_rt_surface(old_ctx);
|
||||||
if (restore_rt != surface)
|
if (restore_rt != surface)
|
||||||
context = context_acquire(device, texture, surface_get_sub_resource_idx(surface));
|
context = context_acquire(device, texture, sub_resource_idx);
|
||||||
else
|
else
|
||||||
restore_rt = NULL;
|
restore_rt = NULL;
|
||||||
|
|
||||||
|
@ -1555,7 +1557,8 @@ void surface_load_fb_texture(struct wined3d_surface *surface, BOOL srgb, struct
|
||||||
gl_info->gl_ops.gl.p_glReadBuffer(wined3d_texture_get_gl_buffer(texture));
|
gl_info->gl_ops.gl.p_glReadBuffer(wined3d_texture_get_gl_buffer(texture));
|
||||||
checkGLcall("glReadBuffer");
|
checkGLcall("glReadBuffer");
|
||||||
|
|
||||||
gl_info->gl_ops.gl.p_glCopyTexSubImage2D(surface->texture_target, surface->texture_level,
|
target = wined3d_texture_get_sub_resource_target(texture, sub_resource_idx);
|
||||||
|
gl_info->gl_ops.gl.p_glCopyTexSubImage2D(target, surface->texture_level,
|
||||||
0, 0, 0, 0, wined3d_texture_get_level_width(texture, surface->texture_level),
|
0, 0, 0, 0, wined3d_texture_get_level_width(texture, surface->texture_level),
|
||||||
wined3d_texture_get_level_height(texture, surface->texture_level));
|
wined3d_texture_get_level_height(texture, surface->texture_level));
|
||||||
checkGLcall("glCopyTexSubImage2D");
|
checkGLcall("glCopyTexSubImage2D");
|
||||||
|
|
|
@ -1394,7 +1394,6 @@ HRESULT CDECL wined3d_texture_update_desc(struct wined3d_texture *texture, UINT
|
||||||
texture->target = GL_TEXTURE_2D_MULTISAMPLE;
|
texture->target = GL_TEXTURE_2D_MULTISAMPLE;
|
||||||
else
|
else
|
||||||
texture->target = GL_TEXTURE_2D;
|
texture->target = GL_TEXTURE_2D;
|
||||||
texture->sub_resources[0].u.surface->texture_target = texture->target;
|
|
||||||
|
|
||||||
if (((width & (width - 1)) || (height & (height - 1))) && !gl_info->supported[ARB_TEXTURE_NON_POWER_OF_TWO]
|
if (((width & (width - 1)) || (height & (height - 1))) && !gl_info->supported[ARB_TEXTURE_NON_POWER_OF_TWO]
|
||||||
&& !gl_info->supported[ARB_TEXTURE_RECTANGLE] && !gl_info->supported[WINED3D_GL_NORMALIZED_TEXRECT])
|
&& !gl_info->supported[ARB_TEXTURE_RECTANGLE] && !gl_info->supported[WINED3D_GL_NORMALIZED_TEXRECT])
|
||||||
|
@ -2213,22 +2212,12 @@ static HRESULT texture_init(struct wined3d_texture *texture, const struct wined3
|
||||||
{
|
{
|
||||||
for (j = 0; j < texture->layer_count; ++j)
|
for (j = 0; j < texture->layer_count; ++j)
|
||||||
{
|
{
|
||||||
static const GLenum cube_targets[6] =
|
|
||||||
{
|
|
||||||
GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB,
|
|
||||||
GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB,
|
|
||||||
GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB,
|
|
||||||
GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB,
|
|
||||||
GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB,
|
|
||||||
GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB,
|
|
||||||
};
|
|
||||||
struct wined3d_texture_sub_resource *sub_resource;
|
struct wined3d_texture_sub_resource *sub_resource;
|
||||||
unsigned int idx = j * texture->level_count + i;
|
unsigned int idx = j * texture->level_count + i;
|
||||||
struct wined3d_surface *surface;
|
struct wined3d_surface *surface;
|
||||||
|
|
||||||
surface = &surfaces[idx];
|
surface = &surfaces[idx];
|
||||||
surface->container = texture;
|
surface->container = texture;
|
||||||
surface->texture_target = desc->usage & WINED3DUSAGE_LEGACY_CUBEMAP ? cube_targets[j] : texture->target;
|
|
||||||
surface->texture_level = i;
|
surface->texture_level = i;
|
||||||
surface->texture_layer = j;
|
surface->texture_layer = j;
|
||||||
list_init(&surface->renderbuffers);
|
list_init(&surface->renderbuffers);
|
||||||
|
|
|
@ -3310,7 +3310,6 @@ struct wined3d_surface
|
||||||
{
|
{
|
||||||
struct wined3d_texture *container;
|
struct wined3d_texture *container;
|
||||||
|
|
||||||
GLenum texture_target;
|
|
||||||
unsigned int texture_level;
|
unsigned int texture_level;
|
||||||
unsigned int texture_layer;
|
unsigned int texture_layer;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue