[PATCH 6/8] wined3d: Remove fbo_entry->d3d_depth_stencil.
Stefan Dösinger
stefandoesinger at gmx.at
Sun Feb 14 14:33:57 CST 2016
Instead of storing the format flags we could store the depth and stencil
attachments as separate objects in the key. However, I don't think it is
worth making the key bigger. The depth and stencil attachment will
always be the same object.
---
dlls/wined3d/context.c | 24 ++++++++++--------------
dlls/wined3d/wined3d_private.h | 2 +-
2 files changed, 11 insertions(+), 15 deletions(-)
diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c
index 012dab1..42cbb64 100644
--- a/dlls/wined3d/context.c
+++ b/dlls/wined3d/context.c
@@ -412,7 +412,10 @@ static struct fbo_entry *context_create_fbo_entry(const struct wined3d_context *
FIELD_OFFSET(struct fbo_entry, key.objects[object_count]));
memset(&entry->key, 0, FIELD_OFFSET(struct wined3d_fbo_entry_key, objects[object_count]));
context_generate_fbo_key(context, &entry->key, render_targets, depth_stencil, color_location, ds_location);
- entry->d3d_depth_stencil = depth_stencil;
+ if (depth_stencil)
+ entry->ds_format_flags = depth_stencil->container->resource.format_flags;
+ else
+ entry->ds_format_flags = 0;
entry->rt_mask = context_generate_rt_mask(GL_COLOR_ATTACHMENT0);
entry->attached = FALSE;
gl_info->fbo_ops.glGenFramebuffers(1, &entry->id);
@@ -433,7 +436,10 @@ static void context_reuse_fbo_entry(struct wined3d_context *context, GLenum targ
context_clean_fbo_attachments(gl_info, target);
context_generate_fbo_key(context, &entry->key, render_targets, depth_stencil, color_location, ds_location);
- entry->d3d_depth_stencil = depth_stencil;
+ if (depth_stencil)
+ entry->ds_format_flags = depth_stencil->container->resource.format_flags;
+ else
+ entry->ds_format_flags = 0;
entry->attached = FALSE;
}
@@ -544,7 +550,6 @@ static void context_apply_fbo_entry(struct wined3d_context *context, GLenum targ
const struct wined3d_gl_info *gl_info = context->gl_info;
unsigned int i;
GLuint read_binding, draw_binding;
- struct wined3d_surface *depth_stencil = entry->d3d_depth_stencil;
if (entry->attached)
{
@@ -563,17 +568,8 @@ static void context_apply_fbo_entry(struct wined3d_context *context, GLenum targ
entry->key.rb_namespace & (1 << (i + 1)));
}
- if (depth_stencil)
- {
- DWORD format_flags = depth_stencil->container->resource.format_flags;
- context_attach_depth_stencil_fbo(context, target, &entry->key.objects[0],
- entry->key.rb_namespace & 0x1, format_flags);
- }
- else
- {
- static const struct wined3d_fbo_resource resource = {0};
- context_attach_depth_stencil_fbo(context, target, &resource, FALSE, 0);
- }
+ context_attach_depth_stencil_fbo(context, target, &entry->key.objects[0],
+ entry->key.rb_namespace & 0x1, entry->ds_format_flags);
/* Set valid read and draw buffer bindings to satisfy pedantic pre-ES2_compatibility
* GL contexts requirements. */
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index e2d9cef..f136b1c 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -2478,7 +2478,7 @@ struct wined3d_fbo_resource
struct fbo_entry
{
struct list entry;
- struct wined3d_surface *d3d_depth_stencil;
+ DWORD ds_format_flags;
DWORD rt_mask;
BOOL attached;
GLuint id;
--
2.4.10
More information about the wine-patches
mailing list