Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(325)

Side by Side Diff: gpu/command_buffer/service/texture_definition.h

Issue 12717013: Add reference-counting for mailbox textures. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef GPU_COMMAND_BUFFER_SERVICE_TEXTURE_DEFINITION_H_ 5 #ifndef GPU_COMMAND_BUFFER_SERVICE_TEXTURE_DEFINITION_H_
6 #define GPU_COMMAND_BUFFER_SERVICE_TEXTURE_DEFINITION_H_ 6 #define GPU_COMMAND_BUFFER_SERVICE_TEXTURE_DEFINITION_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
11 #include "base/memory/ref_counted.h"
11 #include "gpu/command_buffer/service/gl_utils.h" 12 #include "gpu/command_buffer/service/gl_utils.h"
12 #include "gpu/gpu_export.h" 13 #include "gpu/gpu_export.h"
13 14
14 namespace gpu { 15 namespace gpu {
15 namespace gles2 { 16 namespace gles2 {
16 17
17 // A saved definition of a texture that still exists in the underlying 18 // 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 // 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 // context using the same GLShareGroup with the corresponding service ID.
20 class GPU_EXPORT TextureDefinition { 21 class GPU_EXPORT TextureDefinition :
22 public base::RefCounted<TextureDefinition> {
21 public: 23 public:
22 struct GPU_EXPORT LevelInfo { 24 struct GPU_EXPORT LevelInfo {
23 LevelInfo(GLenum target, 25 LevelInfo(GLenum target,
24 GLenum internal_format, 26 GLenum internal_format,
25 GLsizei width, 27 GLsizei width,
26 GLsizei height, 28 GLsizei height,
27 GLsizei depth, 29 GLsizei depth,
28 GLint border, 30 GLint border,
29 GLenum format, 31 GLenum format,
30 GLenum type, 32 GLenum type,
(...skipping 19 matching lines...) Expand all
50 GLuint service_id, 52 GLuint service_id,
51 GLenum min_filter, 53 GLenum min_filter,
52 GLenum mag_filter, 54 GLenum mag_filter,
53 GLenum wrap_s, 55 GLenum wrap_s,
54 GLenum wrap_t, 56 GLenum wrap_t,
55 GLenum usage, 57 GLenum usage,
56 bool immutable, 58 bool immutable,
57 const LevelInfos& level_infos); 59 const LevelInfos& level_infos);
58 ~TextureDefinition(); 60 ~TextureDefinition();
59 61
62 void SetDestroyCallback(const DestroyCallback& callback) {
63 destroy_callback_ = callback;
64 }
65
60 GLenum target() const { 66 GLenum target() const {
61 return target_; 67 return target_;
62 } 68 }
63 69
64 GLuint ReleaseServiceId(); 70 GLuint ReleaseServiceId();
71 GLuint service_id() const { return service_id_; }
65 GLenum min_filter() const { return min_filter_; } 72 GLenum min_filter() const { return min_filter_; }
66 GLenum mag_filter() const { return mag_filter_; } 73 GLenum mag_filter() const { return mag_filter_; }
67 GLenum wrap_s() const { return wrap_s_; } 74 GLenum wrap_s() const { return wrap_s_; }
68 GLenum wrap_t() const { return wrap_t_; } 75 GLenum wrap_t() const { return wrap_t_; }
69 GLenum usage() const { return usage_; } 76 GLenum usage() const { return usage_; }
70 77
71 bool immutable() const { return immutable_; } 78 bool immutable() const { return immutable_; }
72 79
73 const LevelInfos& level_infos() const { 80 const LevelInfos& level_infos() const {
74 return level_infos_; 81 return level_infos_;
75 } 82 }
76 83
77 private: 84 private:
78 GLenum target_; 85 GLenum target_;
79 GLuint service_id_; 86 GLuint service_id_;
80 GLenum min_filter_; 87 GLenum min_filter_;
81 GLenum mag_filter_; 88 GLenum mag_filter_;
82 GLenum wrap_s_; 89 GLenum wrap_s_;
83 GLenum wrap_t_; 90 GLenum wrap_t_;
84 GLenum usage_; 91 GLenum usage_;
85 bool immutable_; 92 bool immutable_;
86 std::vector<std::vector<LevelInfo> > level_infos_; 93 std::vector<std::vector<LevelInfo> > level_infos_;
94 DestroyCallback destroy_callback_;
87 95
88 DISALLOW_COPY_AND_ASSIGN(TextureDefinition); 96 DISALLOW_COPY_AND_ASSIGN(TextureDefinition);
89 }; 97 };
90 98
91 } // namespage gles2 99 } // namespage gles2
92 } // namespace gpu 100 } // namespace gpu
93 101
94 #endif // GPU_COMMAND_BUFFER_SERVICE_TEXTURE_DEFINITION_H_ 102 #endif // GPU_COMMAND_BUFFER_SERVICE_TEXTURE_DEFINITION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698