mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-05 15:28:39 +09:00
Issue #2393 - Part 2 - Add D3D11YCbCrImage type and related methods
Will allow to directly upload a YUV420 buffer into a D3D11 texture.
This commit is contained in:
parent
1fc1753d4d
commit
74a22e5c00
9 changed files with 568 additions and 69 deletions
|
|
@ -35,6 +35,8 @@
|
|||
#ifdef XP_WIN
|
||||
#include "gfxWindowsPlatform.h"
|
||||
#include <d3d10_1.h>
|
||||
#include "mozilla/gfx/DeviceManagerDx.h"
|
||||
#include "mozilla/layers/D3D11YCbCrImage.h"
|
||||
#endif
|
||||
|
||||
namespace mozilla {
|
||||
|
|
@ -395,6 +397,40 @@ ImageContainer::NotifyCompositeInternal(const ImageCompositeNotification& aNotif
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef XP_WIN
|
||||
D3D11YCbCrRecycleAllocator*
|
||||
ImageContainer::GetD3D11YCbCrRecycleAllocator(KnowsCompositor* aAllocator)
|
||||
{
|
||||
if (mD3D11YCbCrRecycleAllocator &&
|
||||
aAllocator == mD3D11YCbCrRecycleAllocator->GetAllocator()) {
|
||||
return mD3D11YCbCrRecycleAllocator;
|
||||
}
|
||||
|
||||
RefPtr<ID3D11Device> device = gfx::DeviceManagerDx::Get()->GetContentDevice();
|
||||
if (!device) {
|
||||
device = gfx::DeviceManagerDx::Get()->GetCompositorDevice();
|
||||
}
|
||||
|
||||
LayersBackend backend = aAllocator->GetCompositorBackendType();
|
||||
if (!device || backend != LayersBackend::LAYERS_D3D11) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
RefPtr<ID3D10Multithread> multi;
|
||||
HRESULT hr =
|
||||
device->QueryInterface((ID3D10Multithread**)getter_AddRefs(multi));
|
||||
if (FAILED(hr) || !multi) {
|
||||
gfxWarning() << "Multithread safety interface not supported. " << hr;
|
||||
return nullptr;
|
||||
}
|
||||
multi->SetMultithreadProtected(TRUE);
|
||||
|
||||
mD3D11YCbCrRecycleAllocator =
|
||||
new D3D11YCbCrRecycleAllocator(aAllocator, device);
|
||||
return mD3D11YCbCrRecycleAllocator;
|
||||
}
|
||||
#endif
|
||||
|
||||
PlanarYCbCrImage::PlanarYCbCrImage()
|
||||
: Image(nullptr, ImageFormat::PLANAR_YCBCR)
|
||||
, mOffscreenFormat(SurfaceFormat::UNKNOWN)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue