From c630c2acc07259d650e2255b5b5c7c28fdc067a1 Mon Sep 17 00:00:00 2001
From: Henri Verbeet <hverbeet@codeweavers.com>
Date: Mon, 9 Jan 2012 21:40:48 +0100
Subject: [PATCH 3/5] d3d9: Don't expose wined3d internal flags to the application.

---
 dlls/d3d9/buffer.c         |    4 ++--
 dlls/d3d9/cubetexture.c    |    2 +-
 dlls/d3d9/surface.c        |    2 +-
 dlls/d3d9/texture.c        |    2 +-
 dlls/d3d9/volume.c         |    2 +-
 dlls/d3d9/volumetexture.c  |    2 +-
 dlls/d3dx9_36/tests/mesh.c |    6 ++++--
 7 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/dlls/d3d9/buffer.c b/dlls/d3d9/buffer.c
index 84ee9a1..a951130 100644
--- a/dlls/d3d9/buffer.c
+++ b/dlls/d3d9/buffer.c
@@ -245,7 +245,7 @@ static HRESULT WINAPI d3d9_vertexbuffer_GetDesc(IDirect3DVertexBuffer9 *iface,
     wined3d_mutex_unlock();
 
     desc->Format = D3DFMT_VERTEXDATA;
-    desc->Usage = wined3d_desc.usage;
+    desc->Usage = wined3d_desc.usage & WINED3DUSAGE_MASK;
     desc->Pool = wined3d_desc.pool;
     desc->Size = wined3d_desc.size;
     desc->Type = D3DRTYPE_VERTEXBUFFER;
@@ -540,7 +540,7 @@ static HRESULT WINAPI d3d9_indexbuffer_GetDesc(IDirect3DIndexBuffer9 *iface,
     wined3d_mutex_unlock();
 
     desc->Format = d3dformat_from_wined3dformat(buffer->format);
-    desc->Usage = wined3d_desc.usage;
+    desc->Usage = wined3d_desc.usage & WINED3DUSAGE_MASK;
     desc->Pool = wined3d_desc.pool;
     desc->Size = wined3d_desc.size;
     desc->Type = D3DRTYPE_INDEXBUFFER;
diff --git a/dlls/d3d9/cubetexture.c b/dlls/d3d9/cubetexture.c
index 2fdf065..f318cf9 100644
--- a/dlls/d3d9/cubetexture.c
+++ b/dlls/d3d9/cubetexture.c
@@ -311,7 +311,7 @@ static HRESULT WINAPI IDirect3DCubeTexture9Impl_GetLevelDesc(IDirect3DCubeTextur
         wined3d_resource_get_desc(sub_resource, &wined3d_desc);
         desc->Format = d3dformat_from_wined3dformat(wined3d_desc.format);
         desc->Type = wined3d_desc.resource_type;
-        desc->Usage = wined3d_desc.usage;
+        desc->Usage = wined3d_desc.usage & WINED3DUSAGE_MASK;
         desc->Pool = wined3d_desc.pool;
         desc->MultiSampleType = wined3d_desc.multisample_type;
         desc->MultiSampleQuality = wined3d_desc.multisample_quality;
diff --git a/dlls/d3d9/surface.c b/dlls/d3d9/surface.c
index c538ec7..1272543 100644
--- a/dlls/d3d9/surface.c
+++ b/dlls/d3d9/surface.c
@@ -275,7 +275,7 @@ static HRESULT WINAPI IDirect3DSurface9Impl_GetDesc(IDirect3DSurface9 *iface, D3
 
     desc->Format = d3dformat_from_wined3dformat(wined3d_desc.format);
     desc->Type = wined3d_desc.resource_type;
-    desc->Usage = wined3d_desc.usage;
+    desc->Usage = wined3d_desc.usage & WINED3DUSAGE_MASK;
     desc->Pool = wined3d_desc.pool;
     desc->MultiSampleType = wined3d_desc.multisample_type;
     desc->MultiSampleQuality = wined3d_desc.multisample_quality;
diff --git a/dlls/d3d9/texture.c b/dlls/d3d9/texture.c
index 6801058..49e5691 100644
--- a/dlls/d3d9/texture.c
+++ b/dlls/d3d9/texture.c
@@ -305,7 +305,7 @@ static HRESULT WINAPI IDirect3DTexture9Impl_GetLevelDesc(IDirect3DTexture9 *ifac
         wined3d_resource_get_desc(sub_resource, &wined3d_desc);
         desc->Format = d3dformat_from_wined3dformat(wined3d_desc.format);
         desc->Type = wined3d_desc.resource_type;
-        desc->Usage = wined3d_desc.usage;
+        desc->Usage = wined3d_desc.usage & WINED3DUSAGE_MASK;
         desc->Pool = wined3d_desc.pool;
         desc->MultiSampleType = wined3d_desc.multisample_type;
         desc->MultiSampleQuality = wined3d_desc.multisample_quality;
diff --git a/dlls/d3d9/volume.c b/dlls/d3d9/volume.c
index 60d8e12..0ef2ee3 100644
--- a/dlls/d3d9/volume.c
+++ b/dlls/d3d9/volume.c
@@ -206,7 +206,7 @@ static HRESULT WINAPI IDirect3DVolume9Impl_GetDesc(IDirect3DVolume9 *iface, D3DV
 
     desc->Format = d3dformat_from_wined3dformat(wined3d_desc.format);
     desc->Type = wined3d_desc.resource_type;
-    desc->Usage = wined3d_desc.usage;
+    desc->Usage = wined3d_desc.usage & WINED3DUSAGE_MASK;
     desc->Pool = wined3d_desc.pool;
     desc->Width = wined3d_desc.width;
     desc->Height = wined3d_desc.height;
diff --git a/dlls/d3d9/volumetexture.c b/dlls/d3d9/volumetexture.c
index 0cf0ed0..803ec87 100644
--- a/dlls/d3d9/volumetexture.c
+++ b/dlls/d3d9/volumetexture.c
@@ -304,7 +304,7 @@ static HRESULT WINAPI IDirect3DVolumeTexture9Impl_GetLevelDesc(IDirect3DVolumeTe
         wined3d_resource_get_desc(sub_resource, &wined3d_desc);
         desc->Format = d3dformat_from_wined3dformat(wined3d_desc.format);
         desc->Type = wined3d_desc.resource_type;
-        desc->Usage = wined3d_desc.usage;
+        desc->Usage = wined3d_desc.usage & WINED3DUSAGE_MASK;
         desc->Pool = wined3d_desc.pool;
         desc->Width = wined3d_desc.width;
         desc->Height = wined3d_desc.height;
diff --git a/dlls/d3dx9_36/tests/mesh.c b/dlls/d3dx9_36/tests/mesh.c
index af0a9e8..390197d 100644
--- a/dlls/d3dx9_36/tests/mesh.c
+++ b/dlls/d3dx9_36/tests/mesh.c
@@ -328,7 +328,8 @@ static void compare_mesh(const char *name, ID3DXMesh *d3dxmesh, struct mesh *mes
                name, index_buffer_description.Format, D3DFMT_INDEX16);
             ok(index_buffer_description.Type == D3DRTYPE_INDEXBUFFER, "Test %s, result %x, expected %x (D3DRTYPE_INDEXBUFFER)\n",
                name, index_buffer_description.Type, D3DRTYPE_INDEXBUFFER);
-            todo_wine ok(index_buffer_description.Usage == 0, "Test %s, result %x, expected %x\n", name, index_buffer_description.Usage, 0);
+            ok(index_buffer_description.Usage == 0, "Test %s, result %#x, expected %#x.\n",
+                    name, index_buffer_description.Usage, 0);
             ok(index_buffer_description.Pool == D3DPOOL_MANAGED, "Test %s, result %x, expected %x (D3DPOOL_MANAGED)\n",
                name, index_buffer_description.Pool, D3DPOOL_MANAGED);
             expected = number_of_faces * sizeof(WORD) * 3;
@@ -3676,7 +3677,8 @@ static void compare_text_outline_mesh(const char *name, ID3DXMesh *d3dxmesh, str
            name, index_buffer_description.Format, D3DFMT_INDEX16);
         ok(index_buffer_description.Type == D3DRTYPE_INDEXBUFFER, "Test %s, result %x, expected %x (D3DRTYPE_INDEXBUFFER)\n",
            name, index_buffer_description.Type, D3DRTYPE_INDEXBUFFER);
-        todo_wine ok(index_buffer_description.Usage == 0, "Test %s, result %x, expected %x\n", name, index_buffer_description.Usage, 0);
+        ok(index_buffer_description.Usage == 0, "Test %s, result %#x, expected %#x.\n",
+                name, index_buffer_description.Usage, 0);
         ok(index_buffer_description.Pool == D3DPOOL_MANAGED, "Test %s, result %x, expected %x (D3DPOOL_MANAGED)\n",
            name, index_buffer_description.Pool, D3DPOOL_MANAGED);
         expected = number_of_faces * sizeof(WORD) * 3;
-- 
1.7.3.4

