[PATCH 6/6] wined3d: Remove fbo_entry->d3d_depth_stencil.

Stefan Dösinger stefan at codeweavers.com
Wed Oct 28 09:29:22 CDT 2015


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.

Signed-off-by: Stefan Dösinger <stefan at codeweavers.com>
---
 dlls/wined3d/context.c         | 20 ++++++--------------
 dlls/wined3d/wined3d_private.h |  2 +-
 2 files changed, 7 insertions(+), 15 deletions(-)

diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c
index c557a59..63569b0 100644
--- a/dlls/wined3d/context.c
+++ b/dlls/wined3d/context.c
@@ -413,7 +413,8 @@ static struct fbo_entry *context_create_fbo_entry(const struct wined3d_context *
             FIELD_OFFSET(struct fbo_entry, key.objects[object_count]));
     context_create_fbo_key(&entry->key, render_targets, depth_stencil, color_location, ds_location,
             gl_info->limits.buffers);
-    entry->d3d_depth_stencil = depth_stencil;
+    if (depth_stencil)
+        entry->ds_format_flags = depth_stencil->container->resource.format_flags;
     entry->rt_mask = context_generate_rt_mask(GL_COLOR_ATTACHMENT0);
     entry->attached = FALSE;
     gl_info->fbo_ops.glGenFramebuffers(1, &entry->id);
@@ -435,7 +436,8 @@ static void context_reuse_fbo_entry(struct wined3d_context *context, GLenum targ
 
     context_create_fbo_key(&entry->key, render_targets, depth_stencil, color_location, ds_location,
             gl_info->limits.buffers);
-    entry->d3d_depth_stencil = depth_stencil;
+    if (depth_stencil)
+        entry->ds_format_flags = depth_stencil->container->resource.format_flags;
     entry->attached = FALSE;
 }
 
@@ -546,7 +548,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)
     {
@@ -565,17 +566,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
-    {
-        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 439d02a..1fa1418 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -2384,7 +2384,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