diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-12 05:35:37 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-12 05:35:37 +0000 |
commit | a90a5cba08fdf6c0ceb95101c275108a152a3aed (patch) | |
tree | 532507288f3defd7f4dcf1af49698bcb76034855 /gfx/gl/GLBlitHelper.h | |
parent | Adding debian version 126.0.1-1. (diff) | |
download | firefox-a90a5cba08fdf6c0ceb95101c275108a152a3aed.tar.xz firefox-a90a5cba08fdf6c0ceb95101c275108a152a3aed.zip |
Merging upstream version 127.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'gfx/gl/GLBlitHelper.h')
-rw-r--r-- | gfx/gl/GLBlitHelper.h | 33 |
1 files changed, 20 insertions, 13 deletions
diff --git a/gfx/gl/GLBlitHelper.h b/gfx/gl/GLBlitHelper.h index 8391509097..3f9e066c0e 100644 --- a/gfx/gl/GLBlitHelper.h +++ b/gfx/gl/GLBlitHelper.h @@ -12,6 +12,7 @@ #include <map> #include <memory> #include <unordered_map> +#include <variant> #include "Colorspaces.h" #include "GLConsts.h" #include "GLContextTypes.h" @@ -126,6 +127,8 @@ Mat3 SubRectMat3(const gfx::IntRect& bigSubrect, const gfx::IntSize& smallSize, class DrawBlitProg final { const GLBlitHelper& mParent; + + public: const GLuint mProg; const GLint mLoc_uDestMatrix; const GLint mLoc_uTexMatrix0; @@ -154,7 +157,6 @@ class DrawBlitProg final { gfx::IntSize destSize; // Always needed for (at least) setting the viewport. Maybe<gfx::IntRect> destRect; - Maybe<uint32_t> texUnitForColorLut; }; struct YUVArgs final { Mat3 texMatrix1; @@ -166,15 +168,14 @@ class DrawBlitProg final { class ScopedSaveMultiTex final { GLContext& mGL; - const std::vector<uint8_t> mTexUnits; + const size_t mTexUnits; const GLenum mTexTarget; const GLuint mOldTexUnit; GLuint mOldTexSampler[3]; GLuint mOldTex[3]; public: - ScopedSaveMultiTex(GLContext* gl, const std::vector<uint8_t>& texUnits, - GLenum texTarget); + ScopedSaveMultiTex(GLContext* gl, size_t texUnits, GLenum texTarget); ~ScopedSaveMultiTex(); }; @@ -185,7 +186,8 @@ class GLBlitHelper final { friend class GLContext; GLContext* const mGL; - mutable std::map<DrawBlitProg::Key, const DrawBlitProg*> mDrawBlitProgs; + mutable std::map<DrawBlitProg::Key, std::unique_ptr<const DrawBlitProg>> + mDrawBlitProgs; GLuint mQuadVAO = 0; GLuint mQuadVBO = 0; @@ -197,16 +199,19 @@ class GLBlitHelper final { gfx::IntSize mYuvUploads_UVSize = {0, 0}; public: - struct ColorLutKey { - color::ColorspaceDesc src; - color::ColorspaceDesc dst; + struct ColorLutKey : DeriveCmpOpMembers<ColorLutKey> { + std::variant<gfx::ColorSpace2, gfx::YUVRangedColorSpace> src; + gfx::ColorSpace2 dst; auto Members() const { return std::tie(src, dst); } - INLINE_AUTO_MAPPABLE(ColorLutKey) + + MOZ_MIXIN_DERIVE_CMP_OPS_BY_MEMBERS(ColorLutKey) + + struct Hasher : mozilla::StdHashMembers<ColorLutKey> {}; }; private: - mutable std::unordered_map<ColorLutKey, std::weak_ptr<gl::Texture>, + mutable std::unordered_map<ColorLutKey, std::shared_ptr<gl::Texture>, ColorLutKey::Hasher> mColorLutTexMap; @@ -219,10 +224,11 @@ class GLBlitHelper final { ID3D11Device* GetD3D11() const; #endif - const DrawBlitProg* GetDrawBlitProg(const DrawBlitProg::Key& key) const; + const DrawBlitProg& GetDrawBlitProg(const DrawBlitProg::Key& key) const; private: - const DrawBlitProg* CreateDrawBlitProg(const DrawBlitProg::Key& key) const; + std::unique_ptr<const DrawBlitProg> CreateDrawBlitProg( + const DrawBlitProg::Key& key) const; public: bool BlitPlanarYCbCr(const layers::PlanarYCbCrData&, @@ -326,7 +332,8 @@ extern const char* const kFragSample_ThreePlane; extern const char* const kFragConvert_None; extern const char* const kFragConvert_BGR; extern const char* const kFragConvert_ColorMatrix; -extern const char* const kFragConvert_ColorLut; +extern const char* const kFragConvert_ColorLut3d; +extern const char* const kFragConvert_ColorLut2d; extern const char* const kFragMixin_AlphaMultColors; extern const char* const kFragMixin_AlphaClampColors; |