forked from Floorp-Projects/Floorp
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug 1866412 - Add FenceD3D11 for wrapping ID3D11Fence r=gfx-reviewers…
…,jrmuizel The change is a preparation for Bug 1865984, Bug 1863474 and Bug 1861605. FenceD3D11 is going to be used by Bug 1865984 and Bug 1863474. And FileHandleWrapper is going to be added for wrapping shared handle of ID3D11Fence and ID3D11Texture2D(Bug 1861605). For now, FenceInfo is expected to be delivered just during creating TextureHost. It works for WebGL and WebGPU. Differential Revision: https://phabricator.services.mozilla.com/D194612
- Loading branch information
sotaro
committed
Dec 8, 2023
1 parent
2487ce0
commit 1ef38c3
Showing
16 changed files
with
473 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ | ||
/* vim: set ts=8 sts=2 et sw=2 tw=80: */ | ||
/* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
||
#include "FileHandleWrapper.h" | ||
|
||
namespace mozilla::gfx { | ||
|
||
FileHandleWrapper::FileHandleWrapper(mozilla::UniqueFileHandle&& aHandle) | ||
: mHandle(std::move(aHandle)) {} | ||
|
||
FileHandleWrapper::~FileHandleWrapper() {} | ||
|
||
mozilla::detail::FileHandleType FileHandleWrapper::GetHandle() { | ||
return mHandle.get(); | ||
} | ||
|
||
} // namespace mozilla::gfx |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ | ||
/* vim: set ts=8 sts=2 et sw=2 tw=80: */ | ||
/* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
||
#ifndef _include_gfx_ipc_FileHandleWrapper_h__ | ||
#define _include_gfx_ipc_FileHandleWrapper_h__ | ||
|
||
#include "mozilla/UniquePtrExtensions.h" | ||
#include "nsISupportsImpl.h" | ||
|
||
namespace mozilla { | ||
|
||
namespace ipc { | ||
template <typename T> | ||
struct IPDLParamTraits; | ||
} // namespace ipc | ||
|
||
namespace gfx { | ||
|
||
// | ||
// A class for sharing file handle or shared handle among multiple clients. | ||
// | ||
// The file handles or the shared handles consume system resources. The class | ||
// could reduce the number of shared handles in a process. | ||
// | ||
class FileHandleWrapper { | ||
friend struct mozilla::ipc::IPDLParamTraits<gfx::FileHandleWrapper*>; | ||
|
||
public: | ||
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(FileHandleWrapper); | ||
|
||
explicit FileHandleWrapper(mozilla::UniqueFileHandle&& aHandle); | ||
|
||
mozilla::detail::FileHandleType GetHandle(); | ||
|
||
protected: | ||
~FileHandleWrapper(); | ||
|
||
const mozilla::UniqueFileHandle mHandle; | ||
}; | ||
|
||
struct FenceInfo { | ||
FenceInfo() = default; | ||
FenceInfo(FileHandleWrapper* aFenceHandle, uint64_t aFenceValue) | ||
: mFenceHandle(aFenceHandle), mFenceValue(aFenceValue) {} | ||
|
||
bool operator==(const FenceInfo& aOther) const { | ||
return mFenceHandle == aOther.mFenceHandle && | ||
mFenceValue == aOther.mFenceValue; | ||
} | ||
|
||
RefPtr<FileHandleWrapper> mFenceHandle; | ||
uint64_t mFenceValue = 0; | ||
}; | ||
|
||
} // namespace gfx | ||
} // namespace mozilla | ||
|
||
#endif // _include_gfx_ipc_FileHandleWrapper_h__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.