diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
commit | 26a029d407be480d791972afb5975cf62c9360a6 (patch) | |
tree | f435a8308119effd964b339f76abb83a57c29483 /gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/MappedSubresourceVerifier11.h | |
parent | Initial commit. (diff) | |
download | firefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz firefox-26a029d407be480d791972afb5975cf62c9360a6.zip |
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/MappedSubresourceVerifier11.h')
-rw-r--r-- | gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/MappedSubresourceVerifier11.h | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/MappedSubresourceVerifier11.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/MappedSubresourceVerifier11.h new file mode 100644 index 0000000000..f0fc70eb85 --- /dev/null +++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/MappedSubresourceVerifier11.h @@ -0,0 +1,63 @@ +// +// Copyright 2019 The ANGLE Project Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +// + +// MappedSubresourceVerifier11.h: Defines the rx::MappedSubresourceVerifier11 +// class, a simple wrapper to D3D11 Texture2D mapped memory so that ASAN +// MSAN can catch memory errors done with a pointer to the mapped texture +// memory. + +#ifndef LIBANGLE_RENDERER_D3D_D3D11_MAPPED_SUBRESOURCE_VERIFIER11_H_ +#define LIBANGLE_RENDERER_D3D_D3D11_MAPPED_SUBRESOURCE_VERIFIER11_H_ + +#include "common/MemoryBuffer.h" +#include "common/angleutils.h" + +namespace rx +{ + +class MappedSubresourceVerifier11 final : angle::NonCopyable +{ + public: + MappedSubresourceVerifier11(); + ~MappedSubresourceVerifier11(); + + void setDesc(const D3D11_TEXTURE2D_DESC &desc); + void setDesc(const D3D11_TEXTURE3D_DESC &desc); + void reset(); + + bool wrap(D3D11_MAP mapType, D3D11_MAPPED_SUBRESOURCE *map); + void unwrap(); + + private: +#if defined(ADDRESS_SANITIZER) || defined(MEMORY_SANITIZER) || defined(ANGLE_ENABLE_ASSERTS) + UINT D3D11_MAPPED_SUBRESOURCE::*mPitchType = nullptr; + size_t mPitchCount = 0; + angle::MemoryBuffer mWrapData; + uint8_t *mOrigData = nullptr; +#endif +}; + +#if !(defined(ADDRESS_SANITIZER) || defined(MEMORY_SANITIZER) || defined(ANGLE_ENABLE_ASSERTS)) + +inline MappedSubresourceVerifier11::MappedSubresourceVerifier11() = default; +inline MappedSubresourceVerifier11::~MappedSubresourceVerifier11() = default; + +inline void MappedSubresourceVerifier11::setDesc(const D3D11_TEXTURE2D_DESC &desc) {} +inline void MappedSubresourceVerifier11::setDesc(const D3D11_TEXTURE3D_DESC &desc) {} +inline void MappedSubresourceVerifier11::reset() {} + +inline bool MappedSubresourceVerifier11::wrap(D3D11_MAP mapType, D3D11_MAPPED_SUBRESOURCE *map) +{ + return true; +} + +inline void MappedSubresourceVerifier11::unwrap() {} + +#endif + +} // namespace rx + +#endif // LIBANGLE_RENDERER_D3D_D3D11_MAPPED_SUBRESOURCE_VERIFIER11_H_ |