st/nine: Return device in NineSurface9_GetContainer
authorPatrick Rudolph <siro@das-labor.org>
Fri, 16 Sep 2016 14:42:50 +0000 (16:42 +0200)
committerAxel Davy <axel.davy@ens.fr>
Mon, 10 Oct 2016 21:43:51 +0000 (23:43 +0200)
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@das-labor.org>
Reviewed-by: Axel Davy <axel.davy@ens.fr>
src/gallium/state_trackers/nine/surface9.c

index e6a48e2041b75fb8812b64f636ef02b623efb0f6..bf485bb4375bd54eb80fd1ffade2c8bca6b32982 100644 (file)
@@ -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");