From e6076c8def3d2039a584a711df42e14543785c9a Mon Sep 17 00:00:00 2001 From: Henri Verbeet Date: Fri, 21 Sep 2018 17:11:51 +0430 Subject: [PATCH] wined3d: Move the OpenGL view class to struct wined3d_format_gl. Signed-off-by: Henri Verbeet Signed-off-by: Alexandre Julliard --- 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 45d1f07b39c..8e9b6dfafd6 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 d1678670bfe..dedb9fc8047 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 e11d61379c2..cb2f44212c4 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)