wined3d: Introduce a helper to retrieve the texture target in context_set_fbo_key_for_render_target().

Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Henri Verbeet 2018-02-21 10:25:28 +03:30 committed by Alexandre Julliard
parent 90696dfe5e
commit 4678dac730
2 changed files with 21 additions and 10 deletions

View File

@ -454,17 +454,11 @@ static inline void context_set_fbo_key_for_render_target(const struct wined3d_co
key->rb_namespace |= 1 << idx; key->rb_namespace |= 1 << idx;
return; return;
} }
key->objects[idx].target = surface->texture_target;
key->objects[idx].level = surface->texture_level;
key->objects[idx].layer = surface->texture_layer;
} }
else key->objects[idx].target = wined3d_texture_get_sub_resource_target(texture, sub_resource_idx);
{
key->objects[idx].target = texture->target;
key->objects[idx].level = sub_resource_idx % texture->level_count; key->objects[idx].level = sub_resource_idx % texture->level_count;
key->objects[idx].layer = sub_resource_idx / texture->level_count; key->objects[idx].layer = sub_resource_idx / texture->level_count;
}
if (render_target->layer_count != 1) if (render_target->layer_count != 1)
key->objects[idx].layer = WINED3D_ALL_LAYERS; key->objects[idx].layer = WINED3D_ALL_LAYERS;

View File

@ -3179,6 +3179,23 @@ static inline struct wined3d_texture *texture_from_resource(struct wined3d_resou
return CONTAINING_RECORD(resource, struct wined3d_texture, resource); return CONTAINING_RECORD(resource, struct wined3d_texture, resource);
} }
static inline GLenum wined3d_texture_get_sub_resource_target(const struct wined3d_texture *texture,
unsigned int sub_resource_idx)
{
static const GLenum cube_targets[] =
{
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,
};
return texture->resource.usage & WINED3DUSAGE_LEGACY_CUBEMAP
? cube_targets[sub_resource_idx / texture->level_count] : texture->target;
}
static inline struct gl_texture *wined3d_texture_get_gl_texture(struct wined3d_texture *texture, static inline struct gl_texture *wined3d_texture_get_gl_texture(struct wined3d_texture *texture,
BOOL srgb) BOOL srgb)
{ {