Commit 4678dac7 authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

wined3d: Introduce a helper to retrieve the texture target in…

wined3d: Introduce a helper to retrieve the texture target in context_set_fbo_key_for_render_target(). Signed-off-by: 's avatarHenri Verbeet <hverbeet@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent 90696dfe
......@@ -454,17 +454,11 @@ static inline void context_set_fbo_key_for_render_target(const struct wined3d_co
key->rb_namespace |= 1 << idx;
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 = texture->target;
key->objects[idx].level = sub_resource_idx % texture->level_count;
key->objects[idx].layer = sub_resource_idx / texture->level_count;
}
key->objects[idx].target = wined3d_texture_get_sub_resource_target(texture, sub_resource_idx);
key->objects[idx].level = sub_resource_idx % texture->level_count;
key->objects[idx].layer = sub_resource_idx / texture->level_count;
if (render_target->layer_count != 1)
key->objects[idx].layer = WINED3D_ALL_LAYERS;
......
......@@ -3179,6 +3179,23 @@ static inline struct wined3d_texture *texture_from_resource(struct wined3d_resou
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,
BOOL srgb)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment