diff --git a/src/ComputeSharp/Graphics/Interop/InteropServices.cs b/src/ComputeSharp/Graphics/Interop/InteropServices.cs index 5427cb64..f2847c0e 100644 --- a/src/ComputeSharp/Graphics/Interop/InteropServices.cs +++ b/src/ComputeSharp/Graphics/Interop/InteropServices.cs @@ -57,6 +57,24 @@ public static unsafe class InteropServices buffer.D3D12Resource->QueryInterface(riid, ppvObject).Assert(); } + /// + /// Gets the underlying COM object for a given resource, as a specified interface. This method invokes + /// IUnknown::QueryInterface. + /// + /// The type of items stored on the texture. + /// The input instance in use. + /// A reference to the interface identifier (IID) of the resource interface being queried for. + /// The address of a pointer to an interface with the IID specified in . + /// The instance has been disposed. + /// Thrown if the IUnknown::QueryInterface call doesn't return S_OK. + public static void GetID3D12Resource(Texture1D texture, Guid* riid, void** ppvObject) + where T : unmanaged + { + using var _0 = texture.GetReferenceTrackingLease(); + + texture.D3D12Resource->QueryInterface(riid, ppvObject).Assert(); + } + /// /// Gets the underlying COM object for a given resource, as a specified interface. This method invokes /// IUnknown::QueryInterface. @@ -187,6 +205,27 @@ public static unsafe class InteropServices return buffer.D3D12Resource->QueryInterface(riid, ppvObject); } + /// + /// Tries to get the underlying COM object for a given resource, as a specified interface. This method invokes + /// IUnknown::QueryInterface. + /// + /// The type of items stored on the texture. + /// The input instance in use. + /// A reference to the interface identifier (IID) of the resource interface being queried for. + /// The address of a pointer to an interface with the IID specified in . + /// + /// S_OK if the interface is supported, and E_NOINTERFACE otherwise. + /// If ppvObject (the address) is nullptr, then this method returns E_POINTER. + /// + /// The instance has been disposed. + public static int TryGetID3D12Resource(Texture1D texture, Guid* riid, void** ppvObject) + where T : unmanaged + { + using var _0 = texture.GetReferenceTrackingLease(); + + return texture.D3D12Resource->QueryInterface(riid, ppvObject); + } + /// /// Tries to get the underlying COM object for a given resource, as a specified interface. This method invokes /// IUnknown::QueryInterface.