[Mesa-dev] [PATCH 59/75] st/nine: Return device in NineSurface9_GetContainer

Axel Davy axel.davy at ens.fr
Wed Oct 5 20:09:32 UTC 2016


From: Patrick Rudolph <siro at das-labor.org>

According to MSDN the device is returned for surfaces that do
not have a regular container.

Such surfaces are:
OffscreenPlainSurface, DepthStencilSurface and RenderTarget

Tested and verified on Windows.

Signed-off-by: Patrick Rudolph <siro at das-labor.org>
Reviewed-by: Axel Davy <axel.davy at ens.fr>
---
 src/gallium/state_trackers/nine/surface9.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/src/gallium/state_trackers/nine/surface9.c b/src/gallium/state_trackers/nine/surface9.c
index e6a48e2..bf485bb 100644
--- a/src/gallium/state_trackers/nine/surface9.c
+++ b/src/gallium/state_trackers/nine/surface9.c
@@ -276,8 +276,16 @@ NineSurface9_GetContainer( struct NineSurface9 *This,
     DBG("This=%p riid=%p id=%s ppContainer=%p\n",
         This, riid, riid ? GUID_sprintf(guid_str, riid) : "", ppContainer);
 
-    if (!NineUnknown(This)->container)
-        return E_NOINTERFACE;
+    if (!ppContainer) return E_POINTER;
+
+    /* Return device for OffscreenPlainSurface, DepthStencilSurface and RenderTarget */
+    if (!NineUnknown(This)->container) {
+        *ppContainer = NineUnknown(This)->device;
+        NineUnknown_AddRef(NineUnknown(*ppContainer));
+
+        return D3D_OK;
+    }
+
     hr = NineUnknown_QueryInterface(NineUnknown(This)->container, riid, ppContainer);
     if (FAILED(hr))
         DBG("QueryInterface FAILED!\n");
-- 
2.10.0



More information about the mesa-dev mailing list