summaryrefslogtreecommitdiffstats
path: root/gpu/command_buffer/service/texture_definition.cc
blob: 731ff6f983aa8bc9001fbb7840b1b1d57395e678 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
// Copyright (c) 2012 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.

#include "gpu/command_buffer/service/texture_definition.h"

namespace gpu {
namespace gles2 {

TextureDefinition::LevelInfo::LevelInfo(GLenum target,
                                        GLenum internal_format,
                                        GLsizei width,
                                        GLsizei height,
                                        GLsizei depth,
                                        GLint border,
                                        GLenum format,
                                        GLenum type,
                                        bool cleared)
    : target(target),
      internal_format(internal_format),
      width(width),
      height(height),
      depth(depth),
      border(border),
      format(format),
      type(type),
      cleared(cleared) {
}

TextureDefinition::TextureDefinition(GLenum target,
                                     GLuint service_id,
                                     const LevelInfos& level_infos)
    : target_(target),
      service_id_(service_id),
      level_infos_(level_infos) {
}

TextureDefinition::~TextureDefinition() {
  DCHECK_EQ(0U, service_id_) << "TextureDefinition leaked texture.";
}

GLuint TextureDefinition::ReleaseServiceId() {
  GLuint service_id = service_id_;
  service_id_ = 0;
  return service_id;
}

}  // namespace gles2
}  // namespace gpu