blob: 18d176925b6ae980752902db88707d9c67503a88 [file] [log] [blame]
Adam Barth932befc2014-11-17 13:53:24 -08001// Copyright 2014 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef MOJO_GPU_GL_TEXTURE_H_
6#define MOJO_GPU_GL_TEXTURE_H_
7
Adam Barth932befc2014-11-17 13:53:24 -08008#include "mojo/gpu/gl_context.h"
Viet-Trung Luu84765c42015-10-10 01:07:51 -07009#include "mojo/services/geometry/interfaces/geometry.mojom.h"
Adam Barth932befc2014-11-17 13:53:24 -080010
11namespace mojo {
12
Jeff Brownd3074d02016-04-19 13:58:54 -070013// Manages a GL texture.
14//
15// Instances of this object are not thread-safe and must be used on the same
16// thread as the GL context was created on.
Adam Barth932befc2014-11-17 13:53:24 -080017class GLTexture {
18 public:
Jeff Brownd3074d02016-04-19 13:58:54 -070019 GLTexture(const GLContext::Scope& gl_scope, const mojo::Size& size);
Adam Barth932befc2014-11-17 13:53:24 -080020 ~GLTexture();
21
Jeff Brownd3074d02016-04-19 13:58:54 -070022 const scoped_refptr<GLContext>& gl_context() const { return gl_context_; }
Adam Barth932befc2014-11-17 13:53:24 -080023 const mojo::Size& size() const { return size_; }
24 uint32_t texture_id() const { return texture_id_; }
25
26 private:
Jeff Brownd3074d02016-04-19 13:58:54 -070027 scoped_refptr<GLContext> gl_context_;
Adam Barth932befc2014-11-17 13:53:24 -080028 mojo::Size size_;
29 uint32_t texture_id_;
30
31 DISALLOW_COPY_AND_ASSIGN(GLTexture);
32};
33
34} // namespace mojo
35
36#endif // MOJO_GPU_GL_TEXTURE_H_