mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 18:18:06 +02:00
mediafoundation: Remove unused AllocatePipeResourceFromAllocator
Reviewed-by: Pohsiang (John) Hsu <pohhsu@microsoft.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38057>
This commit is contained in:
parent
e873beb33c
commit
ca3ba3f924
2 changed files with 0 additions and 60 deletions
|
|
@ -343,58 +343,3 @@ MFAttachPipeResourceAsSampleExtension( struct pipe_context *pPipeContext,
|
|||
|
||||
return pSample->SetUnknown( guidExtension, spMediaBuffer.Get() );
|
||||
}
|
||||
|
||||
// Helper to convert the allocated IMFSample to pipe_resource*
|
||||
// Returns NULL on failure.
|
||||
struct pipe_resource *
|
||||
AllocatePipeResourceFromAllocator( IMFVideoSampleAllocatorEx *pAllocator,
|
||||
struct pipe_screen *pScreen,
|
||||
const struct pipe_resource *templ )
|
||||
{
|
||||
if( !pAllocator || !pScreen || !templ )
|
||||
return nullptr;
|
||||
|
||||
// Allocate or get a sample from the pool.
|
||||
ComPtr<IMFSample> spSample;
|
||||
HRESULT hr = pAllocator->AllocateSample( &spSample );
|
||||
if( FAILED( hr ) || !spSample )
|
||||
return nullptr;
|
||||
|
||||
// Get the underlying D3D12 resource from the sample
|
||||
ComPtr<IMFMediaBuffer> spBuffer;
|
||||
hr = spSample->GetBufferByIndex( 0, &spBuffer );
|
||||
if( FAILED( hr ) || !spBuffer )
|
||||
return nullptr;
|
||||
|
||||
ComPtr<IMFDXGIBuffer> spDXGIBuffer;
|
||||
hr = spBuffer.As( &spDXGIBuffer );
|
||||
if( FAILED( hr ) || !spDXGIBuffer )
|
||||
return nullptr;
|
||||
|
||||
ComPtr<ID3D12Resource> spResource;
|
||||
hr = spDXGIBuffer->GetResource( IID_PPV_ARGS( &spResource ) );
|
||||
if( FAILED( hr ) || !spResource )
|
||||
return nullptr;
|
||||
|
||||
// Build winsys_handle
|
||||
struct winsys_handle whandle = {};
|
||||
whandle.type = WINSYS_HANDLE_TYPE_D3D12_RES;
|
||||
whandle.com_obj = spResource.Detach();
|
||||
// templ->format contains the desired pipe_format
|
||||
whandle.format = templ->format;
|
||||
|
||||
// Call resource_from_handle with the same templ for resource_create.
|
||||
struct pipe_resource *pres = pScreen->resource_from_handle( pScreen, templ, &whandle, PIPE_USAGE_DEFAULT );
|
||||
|
||||
if( !pres )
|
||||
{
|
||||
// Release the detached COM object if resource_from_handle fails
|
||||
if( whandle.com_obj )
|
||||
{
|
||||
static_cast<ID3D12Resource *>( whandle.com_obj )->Release();
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return pres;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -54,8 +54,3 @@ MFAttachPipeResourceAsSampleExtension( struct pipe_context *pPipeContext,
|
|||
ID3D12CommandQueue *pSyncObjectQueue,
|
||||
REFGUID guidExtension,
|
||||
IMFSample *pSample );
|
||||
|
||||
struct pipe_resource *
|
||||
AllocatePipeResourceFromAllocator( IMFVideoSampleAllocatorEx *pAllocator,
|
||||
struct pipe_screen *pScreen,
|
||||
const struct pipe_resource *templ );
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue