forked from mirrors/gecko-dev
Bug 1843891 - Enable to present WebGPU without readback with DX12 on Windows r=webgpu-reviewers,nical
Differential Revision: https://phabricator.services.mozilla.com/D190250
This commit is contained in:
parent
36b74f7869
commit
22fa535fac
5 changed files with 17 additions and 7 deletions
|
|
@ -126,6 +126,9 @@ void CanvasContext::Configure(const dom::GPUCanvasConfiguration& aConfig) {
|
|||
mUseExternalTextureInSwapChain =
|
||||
wgpu_client_use_external_texture_in_swapChain(
|
||||
aConfig.mDevice->mId, ConvertTextureFormat(aConfig.mFormat));
|
||||
if (!gfx::gfxVars::AllowWebGPUPresentWithoutReadback()) {
|
||||
mUseExternalTextureInSwapChain = false;
|
||||
}
|
||||
#ifdef XP_WIN
|
||||
// When WebRender does not use hardware acceleration, disable external texture
|
||||
// in swap chain. Since compositor device might not exist.
|
||||
|
|
|
|||
|
|
@ -101,7 +101,8 @@ class gfxVarReceiver;
|
|||
_(AllowSoftwareWebRenderOGL, bool, false) \
|
||||
_(WebglUseHardware, bool, true) \
|
||||
_(WebRenderOverlayVpAutoHDR, bool, false) \
|
||||
_(WebRenderOverlayVpSuperResolution, bool, false)
|
||||
_(WebRenderOverlayVpSuperResolution, bool, false) \
|
||||
_(AllowWebGPUPresentWithoutReadback, bool, false)
|
||||
|
||||
/* Add new entries above this line. */
|
||||
|
||||
|
|
|
|||
|
|
@ -3162,6 +3162,13 @@ void gfxPlatform::InitWebGPUConfig() {
|
|||
#endif
|
||||
|
||||
gfxVars::SetAllowWebGPU(feature.IsEnabled());
|
||||
|
||||
#if XP_WIN
|
||||
if (IsWin10CreatorsUpdateOrLater() &&
|
||||
StaticPrefs::dom_webgpu_allow_present_without_readback()) {
|
||||
gfxVars::SetAllowWebGPUPresentWithoutReadback(true);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef XP_WIN
|
||||
|
|
|
|||
|
|
@ -1346,10 +1346,6 @@ pub extern "C" fn wgpu_client_use_external_texture_in_swapChain(
|
|||
return false;
|
||||
}
|
||||
|
||||
if !static_prefs::pref!("dom.webgpu.swap-chain.external-texture-dx12") {
|
||||
return false;
|
||||
}
|
||||
|
||||
let supported = match format {
|
||||
wgt::TextureFormat::Bgra8Unorm => true,
|
||||
_ => false,
|
||||
|
|
|
|||
|
|
@ -4637,11 +4637,14 @@
|
|||
mirror: always
|
||||
rust: true
|
||||
|
||||
- name: dom.webgpu.swap-chain.external-texture-dx12
|
||||
- name: dom.webgpu.allow-present-without-readback
|
||||
type: RelaxedAtomicBool
|
||||
#if defined(XP_WIN)
|
||||
value: true
|
||||
#else
|
||||
value: false
|
||||
#endif
|
||||
mirror: always
|
||||
rust: true
|
||||
|
||||
# For testing purposes, crash if we don't get a hardware adapter.
|
||||
- name: dom.webgpu.testing.assert-hardware-adapter
|
||||
|
|
|
|||
Loading…
Reference in a new issue