Closed Bug 578173 Opened 14 years ago Closed 13 years ago

Reuse texture in ThebesLayerD3D9

Categories

(Core :: Graphics, defect)

x86
Windows 7
defect
Not set
normal

Tracking

()

RESOLVED WONTFIX

People

(Reporter: bas.schouten, Assigned: bas.schouten)

Details

Attachments

(1 file, 1 obsolete file)

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+
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
QA Contact: thebes → bas.schouten
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
Closed: 13 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: