=?UTF-8?Q?J=C3=B3zef=20Kucia=20?=: wined3d: Forbid creating typeless render target views.

Alexandre Julliard julliard at winehq.org
Thu Jun 16 10:20:56 CDT 2016


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

Author: Józef Kucia <jkucia at codeweavers.com>
Date:   Thu Jun 16 11:59:37 2016 +0200

wined3d: Forbid creating typeless render target views.

Signed-off-by: Józef Kucia <jkucia at codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/wined3d/view.c            | 9 ++++++++-
 dlls/wined3d/wined3d_private.h | 5 +++++
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/dlls/wined3d/view.c b/dlls/wined3d/view.c
index ae58b62..52e3f1e 100644
--- a/dlls/wined3d/view.c
+++ b/dlls/wined3d/view.c
@@ -98,6 +98,13 @@ static HRESULT wined3d_rendertarget_view_init(struct wined3d_rendertarget_view *
 
     view->format = wined3d_get_format(gl_info, desc->format_id);
     view->format_flags = view->format->flags[resource->gl_type];
+
+    if (wined3d_format_is_typeless(view->format))
+    {
+        WARN("Trying to create view for typeless format %s.\n", debug_d3dformat(view->format->id));
+        return E_INVALIDARG;
+    }
+
     if (resource->type == WINED3D_RTYPE_BUFFER)
     {
         view->sub_resource_idx = 0;
@@ -277,7 +284,7 @@ static HRESULT wined3d_shader_resource_view_init(struct wined3d_shader_resource_
     const struct wined3d_format *view_format;
 
     view_format = wined3d_get_format(gl_info, desc->format_id);
-    if (view_format->id == view_format->typeless_id)
+    if (wined3d_format_is_typeless(view_format))
     {
         WARN("Trying to create view for typeless format %s.\n", debug_d3dformat(view_format->id));
         return E_INVALIDARG;
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 7e46e47..0ef2414 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -3574,6 +3574,11 @@ void wined3d_format_get_float_color_key(const struct wined3d_format *format,
 const struct wined3d_color_key_conversion * wined3d_format_get_color_key_conversion(
         const struct wined3d_texture *texture, BOOL need_alpha_ck) DECLSPEC_HIDDEN;
 
+static inline BOOL wined3d_format_is_typeless(const struct wined3d_format *format)
+{
+    return format->id == format->typeless_id && format->id != WINED3DFMT_UNKNOWN;
+}
+
 static inline void *wined3d_calloc(SIZE_T count, SIZE_T size)
 {
     if (count > ~(SIZE_T)0 / size)




More information about the wine-cvs mailing list