OLD | NEW |
| (Empty) |
1 // Copyright (c) 2012 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 GPU_COMMAND_BUFFER_SERVICE_TEXTURE_DEFINITION_H_ | |
6 #define GPU_COMMAND_BUFFER_SERVICE_TEXTURE_DEFINITION_H_ | |
7 | |
8 #include <vector> | |
9 | |
10 #include "base/callback.h" | |
11 #include "gpu/command_buffer/service/gl_utils.h" | |
12 #include "gpu/gpu_export.h" | |
13 | |
14 namespace gpu { | |
15 namespace gles2 { | |
16 | |
17 // A saved definition of a texture that still exists in the underlying | |
18 // GLShareGroup and can be used to redefine a client visible texture in any | |
19 // context using the same GLShareGroup with the corresponding service ID. | |
20 class GPU_EXPORT TextureDefinition { | |
21 public: | |
22 struct GPU_EXPORT LevelInfo { | |
23 LevelInfo(GLenum target, | |
24 GLenum internal_format, | |
25 GLsizei width, | |
26 GLsizei height, | |
27 GLsizei depth, | |
28 GLint border, | |
29 GLenum format, | |
30 GLenum type, | |
31 bool cleared); | |
32 LevelInfo(); | |
33 | |
34 GLenum target; | |
35 GLenum internal_format; | |
36 GLsizei width; | |
37 GLsizei height; | |
38 GLsizei depth; | |
39 GLint border; | |
40 GLenum format; | |
41 GLenum type; | |
42 bool cleared; | |
43 }; | |
44 | |
45 typedef std::vector<std::vector<LevelInfo> > LevelInfos; | |
46 | |
47 typedef base::Callback<void(TextureDefinition*)> DestroyCallback; | |
48 | |
49 TextureDefinition(GLenum target, | |
50 GLuint service_id, | |
51 GLenum min_filter, | |
52 GLenum mag_filter, | |
53 GLenum wrap_s, | |
54 GLenum wrap_t, | |
55 GLenum usage, | |
56 bool immutable, | |
57 bool stream_texture, | |
58 const LevelInfos& level_infos); | |
59 ~TextureDefinition(); | |
60 | |
61 GLenum target() const { | |
62 return target_; | |
63 } | |
64 | |
65 GLuint ReleaseServiceId(); | |
66 GLuint service_id() const { return service_id_; } | |
67 GLenum min_filter() const { return min_filter_; } | |
68 GLenum mag_filter() const { return mag_filter_; } | |
69 GLenum wrap_s() const { return wrap_s_; } | |
70 GLenum wrap_t() const { return wrap_t_; } | |
71 GLenum usage() const { return usage_; } | |
72 | |
73 bool immutable() const { return immutable_; } | |
74 bool stream_texture() const { return stream_texture_; } | |
75 | |
76 const LevelInfos& level_infos() const { | |
77 return level_infos_; | |
78 } | |
79 | |
80 private: | |
81 GLenum target_; | |
82 GLuint service_id_; | |
83 GLenum min_filter_; | |
84 GLenum mag_filter_; | |
85 GLenum wrap_s_; | |
86 GLenum wrap_t_; | |
87 GLenum usage_; | |
88 bool immutable_; | |
89 bool stream_texture_; | |
90 std::vector<std::vector<LevelInfo> > level_infos_; | |
91 | |
92 DISALLOW_COPY_AND_ASSIGN(TextureDefinition); | |
93 }; | |
94 | |
95 } // namespage gles2 | |
96 } // namespace gpu | |
97 | |
98 #endif // GPU_COMMAND_BUFFER_SERVICE_TEXTURE_DEFINITION_H_ | |
OLD | NEW |