Henri Verbeet : wined3d: Move the OpenGL view class to struct wined3d_format_gl.

Alexandre Julliard julliard at winehq.org
Fri Sep 21 17:04:30 CDT 2018


Module: wine
Branch: master
Commit: e6076c8def3d2039a584a711df42e14543785c9a
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=e6076c8def3d2039a584a711df42e14543785c9a

Author: Henri Verbeet <hverbeet at codeweavers.com>
Date:   Fri Sep 21 17:29:51 2018 +0430

wined3d: Move the OpenGL view class to struct wined3d_format_gl.

Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/wined3d/utils.c           | 16 ++++++++--------
 dlls/wined3d/view.c            | 11 +++++++++--
 dlls/wined3d/wined3d_private.h |  3 ++-
 3 files changed, 19 insertions(+), 11 deletions(-)

diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c
index 45d1f07..8e9b6df 100644
--- a/dlls/wined3d/utils.c
+++ b/dlls/wined3d/utils.c
@@ -2991,23 +2991,23 @@ static GLenum lookup_gl_view_class(GLenum internal_format)
     return GL_NONE;
 }
 
-static void query_view_class(struct wined3d_format *format)
+static void query_view_class(struct wined3d_format_gl *format)
 {
     GLenum internal_view_class, gamma_view_class, rt_view_class;
 
-    internal_view_class = lookup_gl_view_class(format->glInternal);
-    gamma_view_class = lookup_gl_view_class(format->glGammaInternal);
-    rt_view_class = lookup_gl_view_class(format->rtInternal);
+    internal_view_class = lookup_gl_view_class(format->f.glInternal);
+    gamma_view_class = lookup_gl_view_class(format->f.glGammaInternal);
+    rt_view_class = lookup_gl_view_class(format->f.rtInternal);
 
     if (internal_view_class == gamma_view_class || gamma_view_class == rt_view_class)
     {
-        format->gl_view_class = internal_view_class;
+        format->view_class = internal_view_class;
         TRACE("Format %s is member of GL view class %#x.\n",
-                debug_d3dformat(format->id), format->gl_view_class);
+                debug_d3dformat(format->f.id), format->view_class);
     }
     else
     {
-        format->gl_view_class = GL_NONE;
+        format->view_class = GL_NONE;
     }
 }
 
@@ -3083,7 +3083,7 @@ static void query_internal_format(struct wined3d_adapter *adapter,
         }
     }
 
-    query_view_class(format);
+    query_view_class(wined3d_format_gl_mutable(format));
 
     if (format->glInternal && format->flags[WINED3D_GL_RES_TYPE_RB]
             & (WINED3DFMT_FLAG_RENDERTARGET | WINED3DFMT_FLAG_DEPTH | WINED3DFMT_FLAG_STENCIL))
diff --git a/dlls/wined3d/view.c b/dlls/wined3d/view.c
index d167867..dedb9fc 100644
--- a/dlls/wined3d/view.c
+++ b/dlls/wined3d/view.c
@@ -531,7 +531,11 @@ static void wined3d_render_target_view_cs_init(void *object)
         if (resource->format->id != view->format->id
                 || (view->layer_count != 1 && view->layer_count != depth_or_layer_count))
         {
-            if (resource->format->gl_view_class != view->format->gl_view_class)
+            GLenum resource_class, view_class;
+
+            resource_class = wined3d_format_gl(resource->format)->view_class;
+            view_class = wined3d_format_gl(view->format)->view_class;
+            if (resource_class != view_class)
             {
                 FIXME("Render target view not supported, resource format %s, view format %s.\n",
                         debug_d3dformat(resource->format->id), debug_d3dformat(view->format->id));
@@ -722,7 +726,10 @@ static void wined3d_shader_resource_view_cs_init(void *object)
     else
     {
         struct wined3d_texture *texture = texture_from_resource(resource);
+        GLenum resource_class, view_class;
 
+        resource_class = wined3d_format_gl(resource->format)->view_class;
+        view_class = wined3d_format_gl(view_format)->view_class;
         view_target = get_texture_view_target(gl_info, desc, texture);
 
         if (resource->format->id == view_format->id && texture->target == view_target
@@ -737,7 +744,7 @@ static void wined3d_shader_resource_view_cs_init(void *object)
             FIXME("Swapchain shader resource views not supported.\n");
         }
         else if (resource->format->typeless_id == view_format->typeless_id
-                && resource->format->gl_view_class == view_format->gl_view_class)
+                && resource_class == view_class)
         {
             create_texture_view(&view->gl_view, view_target, desc, texture, view_format);
         }
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index e11d613..cb2f442 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -4359,7 +4359,6 @@ struct wined3d_format
             unsigned int width, unsigned int height, unsigned int depth);
 
     enum wined3d_format_id typeless_id;
-    GLenum gl_view_class;
 };
 
 const struct wined3d_format *wined3d_get_format(const struct wined3d_adapter *adapter,
@@ -4385,6 +4384,8 @@ struct wined3d_format_gl
 
     GLenum vtx_type;
     GLint vtx_format;
+
+    GLenum view_class;
 };
 
 static inline const struct wined3d_format_gl *wined3d_format_gl(const struct wined3d_format *format)




More information about the wine-cvs mailing list