Reuse texture in ThebesLayerD3D9

RESOLVED WONTFIX

Status

()

Core
Graphics
RESOLVED WONTFIX
8 years ago
6 years ago

People

(Reporter: bas, Assigned: bas)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment, 1 obsolete attachment)

(Assignee)

Description

8 years ago
Created attachment 456933 [details] [diff] [review]
Reuse ThebesLayerD3D9 hardware textures

We should not create a new texture for D3D9 layers if the bounds of the visible region do not change. In order to do this we need to have a scratch surface though where we can 'ping-pong' to since a self-copy operation is not supported.
Attachment #456933 - Flags: review?(jmuizelaar)
Comment on attachment 456933 [details] [diff] [review]
Reuse ThebesLayerD3D9 hardware textures

> 
> /*
>  * This is the LayerManager used for Direct3D 9. For now this will render on
>@@ -112,16 +114,19 @@ public:
>   virtual already_AddRefed<ColorLayer> CreateColorLayer();
> 
>   virtual already_AddRefed<CanvasLayer> CreateCanvasLayer();
> 
>   virtual already_AddRefed<ImageContainer> CreateImageContainer();
> 
>   virtual LayersBackend GetBackendType() { return LAYERS_D3D9; }
> 
>+  virtual IDirect3DTexture9 *GetScratchTexture(D3DFORMAT aFormat,
>+                                               const gfxIntSize &aSize);
>+

I don't think this needs to be virtual.

>   /*
>    * Helper methods.
>    */
>   void SetClippingEnabled(PRBool aEnabled);
> 
>   IDirect3DDevice9 *device() const { return mDevice; }
> 
>   enum ShaderMode {
>@@ -160,16 +165,19 @@ private:
>   nsRefPtr<IDirect3DPixelShader9> mSolidColorPS;
> 
>   /* Vertex buffer containing our basic vertex structure */
>   nsRefPtr<IDirect3DVertexBuffer9> mVB;
> 
>   /* Our vertex declaration */
>   nsRefPtr<IDirect3DVertexDeclaration9> mVD;
> 
>+  /* Table of scratch surfaces */
>+  nsClassHashtable<nsUint32HashKey, IDirect3DTexture9> mScratchSurfaces;
>+

A hash table is probably overkill for this, but it's also probably not worth worrying about either.
Attachment #456933 - Flags: review?(jmuizelaar) → review+
(Assignee)

Comment 2

7 years ago
Created attachment 471642 [details] [diff] [review]
Reuse ThebesLayerD3D9 hardware textures v2

This patch is updated to the new structure. It also requests a surface two pixels bigger since otherwise NVidia cards seem to fail. This currently can have some minor sync issues with D2D interop, I've got a separate patch for this.
Attachment #456933 - Attachment is obsolete: true

Updated

6 years ago
QA Contact: thebes → bas.schouten
(Assignee)

Comment 3

6 years ago
We're currently not seeing serious performance issues here, let's ignore it until we do. D2D interop is gone now so that solves some problems.
Status: ASSIGNED → RESOLVED
Last Resolved: 6 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.