wined3d: Differentiate between single layer and layered render target views.

Signed-off-by: Józef Kucia <jkucia@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Józef Kucia 2017-04-10 12:27:43 +02:00 committed by Alexandre Julliard
parent e500cf7d97
commit 706652025e
4 changed files with 14 additions and 7 deletions

View File

@ -139,7 +139,7 @@ static void context_attach_gl_texture_fbo(struct wined3d_context *context,
gl_info->fbo_ops.glFramebufferTexture(fbo_target, attachment,
resource->object, resource->level);
}
else if (resource->target == GL_TEXTURE_2D_ARRAY)
else if (resource->target == GL_TEXTURE_2D_ARRAY || resource->target == GL_TEXTURE_3D)
{
if (!gl_info->fbo_ops.glFramebufferTextureLayer)
{
@ -433,8 +433,10 @@ static inline void context_set_fbo_key_for_render_target(const struct wined3d_co
{
key->objects[idx].target = texture->target;
key->objects[idx].level = sub_resource_idx % texture->level_count;
key->objects[idx].layer = WINED3D_ALL_LAYERS;
key->objects[idx].layer = sub_resource_idx / texture->level_count;
}
if (render_target->layer_count != 1)
key->objects[idx].layer = WINED3D_ALL_LAYERS;
switch (location)
{
@ -475,6 +477,7 @@ static void context_generate_fbo_key(const struct wined3d_context *context,
{
depth_stencil.resource = &depth_stencil_surface->container->resource;
depth_stencil.sub_resource_idx = surface_get_sub_resource_idx(depth_stencil_surface);
depth_stencil.layer_count = 1;
}
context_set_fbo_key_for_render_target(context, key, 0, &depth_stencil, ds_location);
@ -738,6 +741,7 @@ void context_apply_fbo_state_blit(struct wined3d_context *context, GLenum target
{
context->blit_targets[0].resource = &render_target->container->resource;
context->blit_targets[0].sub_resource_idx = surface_get_sub_resource_idx(render_target);
context->blit_targets[0].layer_count = 1;
}
context_apply_fbo_state(context, target, context->blit_targets, depth_stencil, location, location);
}
@ -2745,6 +2749,7 @@ BOOL context_apply_clear_state(struct wined3d_context *context, const struct win
context->blit_targets[i].gl_view = rts[i]->gl_view;
context->blit_targets[i].resource = rts[i]->resource;
context->blit_targets[i].sub_resource_idx = rts[i]->sub_resource_idx;
context->blit_targets[i].layer_count = rts[i]->layer_count;
}
if (rts[i] && rts[i]->format->id != WINED3DFMT_NULL)
rt_mask |= (1u << i);
@ -2879,6 +2884,7 @@ void context_state_fb(struct wined3d_context *context, const struct wined3d_stat
context->blit_targets[i].gl_view = fb->render_targets[i]->gl_view;
context->blit_targets[i].resource = fb->render_targets[i]->resource;
context->blit_targets[i].sub_resource_idx = fb->render_targets[i]->sub_resource_idx;
context->blit_targets[i].layer_count = fb->render_targets[i]->layer_count;
}
}
context_apply_fbo_state(context, GL_FRAMEBUFFER, context->blit_targets,

View File

@ -4129,7 +4129,7 @@ HRESULT CDECL wined3d_device_clear_rendertarget_view(struct wined3d_device *devi
return WINED3DERR_INVALIDCALL;
}
if (view->depth > 1)
if (view->layer_count > 1)
{
FIXME("Layered clears not implemented.\n");
return WINED3DERR_INVALIDCALL;

View File

@ -419,7 +419,7 @@ static void wined3d_render_target_view_cs_init(void *object)
depth_or_layer_count = texture->layer_count;
if (resource->format->id != view->format->id
|| (desc->u.texture.layer_count != 1 && desc->u.texture.layer_count != depth_or_layer_count))
|| (view->layer_count != 1 && view->layer_count != depth_or_layer_count))
{
if (resource->format->gl_view_class != view->format->gl_view_class)
{
@ -454,9 +454,9 @@ static HRESULT wined3d_rendertarget_view_init(struct wined3d_rendertarget_view *
if (resource->type == WINED3D_RTYPE_BUFFER)
{
view->sub_resource_idx = 0;
view->layer_count = 1;
view->width = desc->u.buffer.count;
view->height = 1;
view->depth = 1;
}
else
{
@ -465,9 +465,9 @@ static HRESULT wined3d_rendertarget_view_init(struct wined3d_rendertarget_view *
view->sub_resource_idx = desc->u.texture.level_idx;
if (resource->type != WINED3D_RTYPE_TEXTURE_3D)
view->sub_resource_idx += desc->u.texture.layer_idx * texture->level_count;
view->layer_count = desc->u.texture.layer_count;
view->width = wined3d_texture_get_level_width(texture, desc->u.texture.level_idx);
view->height = wined3d_texture_get_level_height(texture, desc->u.texture.level_idx);
view->depth = desc->u.texture.layer_count;
}
wined3d_resource_incref(view->resource = resource);

View File

@ -1643,6 +1643,7 @@ struct wined3d_rendertarget_info
struct wined3d_gl_view gl_view;
struct wined3d_resource *resource;
unsigned int sub_resource_idx;
unsigned int layer_count;
};
#define MAX_GL_FRAGMENT_SAMPLERS 32
@ -3394,10 +3395,10 @@ struct wined3d_rendertarget_view
const struct wined3d_format *format;
unsigned int format_flags;
unsigned int sub_resource_idx;
unsigned int layer_count;
unsigned int width;
unsigned int height;
unsigned int depth;
struct wined3d_view_desc desc;
};