blob: 71c73eba5234f414fbd0c3cd0a45f30ce5becf6d [file] [log] [blame]
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
[DartPackage="mojo_services"]
module mojo.gfx.composition;
import "mojo/services/geometry/interfaces/geometry.mojom";
import "mojo/services/gfx/composition/interfaces/scene_token.mojom";
// Resources are references to foreign objects which are being imported into
// the scene graph, such as images and other scenes. Each resource must be
// given a locally unique identifier when it is bound to the scene.
union Resource {
SceneResource scene;
MailboxTextureResource mailbox_texture;
};
// Scene resource declaration.
//
// Binds a resource id to a scene given its scene token.
//
// If the scene referenced by the token becomes unavailable, the
// |Scene.OnResourceUnavailable| event will be sent.
struct SceneResource {
// The scene token of the referenced scene.
SceneToken scene_token;
};
// Mailbox texture resource declaration.
//
// Binds a resource id to a texture transferred via a GL mailbox.
// Assumes the format is RGBA_8888 and the target is GL_TEXTURE_2D.
//
// If the texture referenced by the token becomes unavailable, the
// |Scene.OnResourceUnavailable| event will be sent.
//
// TODO(jeffbrown): Replace this with Image and ImagePipe.
struct MailboxTextureResource {
// The origin of the texture.
enum Origin {
TOP_LEFT,
BOTTOM_LEFT,
};
// The name of the mailbox, as produced by glGenMailboxCHROMIUM().
array<uint8, 64> mailbox_name;
// The sync point which indicates completion of texture rendering, as
// produced by glInsertSyncPointCHROMIUM().
uint32 sync_point;
// The size of the texture in pixels.
mojo.Size size;
// The origin of the texture.
Origin origin = Origin.TOP_LEFT;
// The callback interface to be notified when it is safe to release or
// recycle the underlying texture storage once the resource has been
// removed from the scene.
MailboxTextureCallback callback;
};
// Release callback for MailboxTextureResources.
interface MailboxTextureCallback {
// Called some time after a mailbox texture is removed from the scene
// to indicate that it is now safe to release or recycle the underlying
// texture storage.
OnMailboxTextureReleased();
};