From: Patrick Rudolph Date: Fri, 16 Sep 2016 14:42:50 +0000 (+0200) Subject: st/nine: Return device in NineSurface9_GetContainer X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=c1c8e852c158759ac8c551ab104ff05d683acf19;p=mesa.git 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 --- 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");