CWebRender pt2

This commit is contained in:
wuggy 2026-09-18 12:00:30 -07:00
commit fe181d242f
22 changed files with 1623 additions and 489 deletions

View file

@ -34,6 +34,8 @@
#include "nsXULAppAPI.h" // for XRE_GetProcessType
#include "nscore.h" // for NS_IMETHOD
#include <stddef.h>
class nsIWidget;
namespace mozilla {
@ -169,6 +171,12 @@ protected:
public:
virtual CompositorOGL* AsCompositorOGL() override { return this; }
struct WebRenderImageSource {
RefPtr<TextureSource> mSource;
uint32_t mKey;
bool mPremultiplied;
};
virtual already_AddRefed<DataTextureSource>
CreateDataTextureSource(TextureFlags aFlags = TextureFlags::NO_FLAGS) override;
@ -214,14 +222,29 @@ public:
// Consume solid retained-display-list quads through the existing GPU path.
bool DrawWebRenderContext(wr_context* aContext,
const gfx::IntRect& aClipRect);
const gfx::IntRect& aClipRect,
TextureSource* aImageSource = nullptr,
uint32_t aImageKey = 0,
bool aImagePremultiplied = true);
bool DrawWebRenderRect(const gfx::Rect& aRect,
const gfx::Color& aColor,
gfx::Float aOpacity,
const gfx::Matrix4x4& aTransform,
const gfx::IntRect& aClipRect);
bool DrawWebRenderImage(TextureSource* aImageSource,
const gfx::Rect& aRect,
const gfx::Rect& aTexRect,
gfx::Float aOpacity,
const gfx::Matrix4x4& aTransform,
const gfx::IntRect& aClipRect,
bool aPremultiplied);
void DrawWebRenderFrame(const wr_frame& aFrame,
const gfx::IntRect& aClipRect);
const gfx::IntRect& aClipRect,
const WebRenderImageSource* aImageSources,
size_t aImageSourceCount);
void FlushWebRenderScene();
uint32_t RegisterWebRenderImage(TextureSource* aImageSource,
bool aPremultiplied);
virtual void EndFrame() override;
virtual void EndFrameForExternalComposition(const gfx::Matrix& aTransform) override;
@ -340,6 +363,10 @@ private:
/** Currently bound render target */
RefPtr<CompositingRenderTargetOGL> mCurrentRenderTarget;
wr_context* mWebRenderContext;
gfx::IntRect mWebRenderViewport;
bool mWebRenderSceneHasCommands;
nsTArray<WebRenderImageSource> mWebRenderSceneImageSources;
uint32_t mNextWebRenderImageKey;
#ifdef DEBUG
CompositingRenderTargetOGL* mWindowRenderTarget;
#endif