Bug 853551 - Implement the doppler part of AudioPannerNode. r=ehsan
[gecko.git] / gfx / layers / CompositorTypes.h
blob9e2214a2f9742fda3244c17e13ffe90ff2e1efa2
1 /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2 * This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #ifndef MOZILLA_LAYERS_COMPOSITORTYPES_H
7 #define MOZILLA_LAYERS_COMPOSITORTYPES_H
9 #include "LayersTypes.h"
11 namespace mozilla {
12 namespace layers {
14 typedef int32_t SurfaceDescriptorType;
15 const SurfaceDescriptorType SURFACEDESCRIPTOR_UNKNOWN = 0;
17 /**
18 * Flags used by texture clients and texture hosts. These are passed from client
19 * side to host side when textures and compositables are created. Usually set
20 * by the compositableCient, they may be modified by either the compositable or
21 * texture clients.
23 typedef uint32_t TextureFlags;
24 // Use nearest-neighbour texture filtering (as opposed to linear filtering).
25 const TextureFlags UseNearestFilter = 0x1;
26 // The texture should be flipped around the y-axis when composited.
27 const TextureFlags NeedsYFlip = 0x2;
28 // Force the texture to be represented using a single tile (note that this means
29 // tiled textures, not tiled layers).
30 const TextureFlags ForceSingleTile = 0x4;
31 // Allow using 'repeat' mode for wrapping.
32 const TextureFlags AllowRepeat = 0x8;
33 // The texture represents a tile which is newly created.
34 const TextureFlags NewTile = 0x10;
35 // The host is responsible for tidying up any shared resources.
36 const TextureFlags HostRelease = 0x20;
38 /**
39 * The kind of memory held by the texture client/host pair. This will
40 * determine how the texture client is drawn into and how the memory
41 * is shared between client and host.
43 enum TextureClientType
45 TEXTURE_CONTENT, // dynamically drawn content
46 TEXTURE_SHMEM, // shared memory
47 TEXTURE_YCBCR, // ShmemYCbCrImage
48 TEXTURE_SHARED_GL, // GLContext::SharedTextureHandle
49 TEXTURE_SHARED_GL_EXTERNAL, // GLContext::SharedTextureHandle, the ownership of
50 // the SurfaceDescriptor passed to the texture
51 // remains with whoever passed it.
52 TEXTURE_STREAM_GL // WebGL streaming buffer
55 /**
56 * How the Compositable should manage textures.
58 enum CompositableType
60 BUFFER_UNKNOWN,
61 BUFFER_IMAGE_SINGLE, // image/canvas with a single texture, single buffered
62 BUFFER_IMAGE_BUFFERED, // image/canvas, double buffered
63 BUFFER_BRIDGE, // image bridge protocol
64 BUFFER_CONTENT, // thebes layer interface, single buffering
65 BUFFER_CONTENT_DIRECT, // thebes layer interface, double buffering
66 BUFFER_TILED, // tiled thebes layer
67 BUFFER_COUNT
70 /**
71 * How the texture host is used for composition,
73 enum TextureHostFlags
75 TEXTURE_HOST_DEFAULT = 0, // The default texture host for the given
76 // SurfaceDescriptor
77 TEXTURE_HOST_TILED = 1 << 0, // A texture host that supports tiling
80 /**
81 * Sent from the compositor to the content-side LayerManager, includes properties
82 * of the compositor and should (in the future) include information about what
83 * kinds of buffer and texture clients to create.
85 struct TextureFactoryIdentifier
87 LayersBackend mParentBackend;
88 int32_t mMaxTextureSize;
90 TextureFactoryIdentifier(LayersBackend aLayersBackend = LAYERS_NONE,
91 int32_t aMaxTextureSize = 0)
92 : mParentBackend(aLayersBackend)
93 , mMaxTextureSize(aMaxTextureSize)
97 /**
98 * Identify a texture to a compositable. Many textures can have the same id, but
99 * the id is unique for any texture owned by a particular compositable.
101 typedef uint32_t TextureIdentifier;
102 const TextureIdentifier TextureFront = 1;
103 const TextureIdentifier TextureBack = 2;
106 * Information required by the compositor from the content-side for creating or
107 * using compositables and textures.
109 struct TextureInfo
111 CompositableType mCompositableType;
112 uint32_t mTextureHostFlags;
113 uint32_t mTextureFlags;
115 TextureInfo()
116 : mCompositableType(BUFFER_UNKNOWN)
117 , mTextureHostFlags(0)
118 , mTextureFlags(0)
121 TextureInfo(CompositableType aType)
122 : mCompositableType(aType)
123 , mTextureHostFlags(0)
124 , mTextureFlags(0)
127 bool operator==(const TextureInfo& aOther) const
129 return mCompositableType == aOther.mCompositableType &&
130 mTextureHostFlags == aOther.mTextureHostFlags &&
131 mTextureFlags == aOther.mTextureFlags;
136 } // namespace layers
137 } // namespace mozilla
139 #endif