From c1c8e852c158759ac8c551ab104ff05d683acf19 Mon Sep 17 00:00:00 2001 From: Patrick Rudolph Date: Fri, 16 Sep 2016 16:42:50 +0200 Subject: [PATCH] st/nine: Return device in NineSurface9_GetContainer 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 Reviewed-by: Axel Davy --- 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 e6a48e2041b..bf485bb4375 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.30.2