зеркало из https://github.com/mozilla/gecko-dev.git
WIP: Bug 1622846 - Support WebGPU adapter isFallbackAdapter r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D133208
This commit is contained in:
Родитель
a1cfe46ee8
Коммит
c4c52fc4b6
|
@ -26,7 +26,7 @@ Adapter::Adapter(Instance* const aParent,
|
|||
mId(aInfo.id),
|
||||
mFeatures(new AdapterFeatures(this)),
|
||||
mLimits(new SupportedLimits(this, aInfo.limits)),
|
||||
mIsSoftware(aInfo.ty == ffi::WGPUDeviceType_Cpu) {}
|
||||
mIsFallbackAdapter(aInfo.ty == ffi::WGPUDeviceType_Cpu) {}
|
||||
|
||||
Adapter::~Adapter() { Cleanup(); }
|
||||
|
||||
|
@ -39,7 +39,6 @@ void Adapter::Cleanup() {
|
|||
|
||||
const RefPtr<AdapterFeatures>& Adapter::Features() const { return mFeatures; }
|
||||
const RefPtr<SupportedLimits>& Adapter::Limits() const { return mLimits; }
|
||||
bool Adapter::IsSoftware() const { return mIsSoftware; }
|
||||
|
||||
already_AddRefed<dom::Promise> Adapter::RequestDevice(
|
||||
const dom::GPUDeviceDescriptor& aDesc, ErrorResult& aRv) {
|
||||
|
|
|
@ -47,14 +47,14 @@ class Adapter final : public ObjectBase, public ChildOf<Instance> {
|
|||
// to unlink them in CC unlink.
|
||||
RefPtr<AdapterFeatures> mFeatures;
|
||||
RefPtr<SupportedLimits> mLimits;
|
||||
const bool mIsSoftware = false;
|
||||
const bool mIsFallbackAdapter = false;
|
||||
|
||||
public:
|
||||
Adapter(Instance* const aParent, const ffi::WGPUAdapterInformation& aInfo);
|
||||
void GetName(nsString& out) const { out = mName; }
|
||||
const RefPtr<AdapterFeatures>& Features() const;
|
||||
const RefPtr<SupportedLimits>& Limits() const;
|
||||
bool IsSoftware() const;
|
||||
bool IsFallbackAdapter() const { return mIsFallbackAdapter; }
|
||||
|
||||
already_AddRefed<dom::Promise> RequestDevice(
|
||||
const dom::GPUDeviceDescriptor& aDesc, ErrorResult& aRv);
|
||||
|
|
|
@ -235,6 +235,7 @@ ipc::IPCResult WebGPUParent::RecvInstanceRequestAdapter(
|
|||
options.power_preference = static_cast<ffi::WGPUPowerPreference>(
|
||||
aOptions.mPowerPreference.Value());
|
||||
}
|
||||
options.force_fallback_adapter = aOptions.mForceFallbackAdapter;
|
||||
// TODO: make available backends configurable by prefs
|
||||
|
||||
ErrorBuffer error;
|
||||
|
|
|
@ -31,7 +31,7 @@ DEFINE_IPC_SERIALIZER_FFI_ENUM(mozilla::webgpu::ffi::WGPUHostMap);
|
|||
DEFINE_IPC_SERIALIZER_WITHOUT_FIELDS(mozilla::dom::GPUCommandBufferDescriptor);
|
||||
|
||||
DEFINE_IPC_SERIALIZER_WITH_FIELDS(mozilla::dom::GPURequestAdapterOptions,
|
||||
mPowerPreference);
|
||||
mPowerPreference, mForceFallbackAdapter);
|
||||
|
||||
DEFINE_IPC_SERIALIZER_WITH_FIELDS(mozilla::webgpu::ScopedError, operationError,
|
||||
validationMessage);
|
||||
|
|
|
@ -82,6 +82,7 @@ enum GPUPowerPreference {
|
|||
|
||||
dictionary GPURequestAdapterOptions {
|
||||
GPUPowerPreference powerPreference;
|
||||
boolean forceFallbackAdapter = false;
|
||||
};
|
||||
|
||||
[Pref="dom.webgpu.enabled",
|
||||
|
@ -132,7 +133,7 @@ interface GPUAdapter {
|
|||
readonly attribute DOMString name;
|
||||
[SameObject] readonly attribute GPUAdapterFeatures features;
|
||||
[SameObject] readonly attribute GPUSupportedLimits limits;
|
||||
readonly attribute boolean isSoftware;
|
||||
readonly attribute boolean isFallbackAdapter;
|
||||
|
||||
[NewObject]
|
||||
Promise<GPUDevice> requestDevice(optional GPUDeviceDescriptor descriptor = {});
|
||||
|
|
Загрузка…
Ссылка в новой задаче