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

Side by Side Diff: core/cross/client_info.h

Issue 6538102: Add support for runtime fall-back from o3d to o2d. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/o3d/
Patch Set: '' Created 9 years, 10 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 /* 1 /*
2 * Copyright 2009, Google Inc. 2 * Copyright 2009, Google Inc.
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 bool glsl() const { 70 bool glsl() const {
71 #if defined(RENDERER_GLES2) 71 #if defined(RENDERER_GLES2)
72 return true; 72 return true;
73 #else 73 #else
74 return false; 74 return false;
75 #endif 75 #endif
76 } 76 }
77 77
78 // Whether render in 2d Mode 78 // Whether render in 2d Mode
79 bool render_2d() const { 79 bool render_2d() const {
80 #if defined(SUPPORT_CAIRO) && defined(FORCE_CAIRO) 80 return render_2d_;
81 // Force Cairo o2d mode for testing purposes
82 return true;
83 #elif defined(SUPPORT_CAIRO)
84 // Some day when we have fallback from o3d to o2d,
85 // this will have to support logic returning actual o2d vs. o3d mode.
86 return false;
87 #else
88 return false;
89 #endif
90 } 81 }
91 82
92 // Whether or not the underlying GPU supports non power of 2 textures. 83 // Whether or not the underlying GPU supports non power of 2 textures.
93 // NOTE: O3D always supports non power of 2 textures from a public API 84 // NOTE: O3D always supports non power of 2 textures from a public API
94 // point of view and massages the data underneath to make this work. 85 // point of view and massages the data underneath to make this work.
95 // The point of this flag is mostly that if you are doing any kind of 86 // The point of this flag is mostly that if you are doing any kind of
96 // dynamic texture updating, like video, then you might want to use a 87 // dynamic texture updating, like video, then you might want to use a
97 // power of two texture so O3D doesn't have to do extra work of converting 88 // power of two texture so O3D doesn't have to do extra work of converting
98 // your NPOT texture into a POT texture behind the scenes. 89 // your NPOT texture into a POT texture behind the scenes.
99 bool non_power_of_two_textures() const { 90 bool non_power_of_two_textures() const {
100 return non_power_of_two_textures_; 91 return non_power_of_two_textures_;
101 } 92 }
102 93
103 // Gets the O3D version. 94 // Gets the O3D version.
104 const String& version() const { 95 const String& version() const {
105 return version_; 96 return version_;
106 } 97 }
107 98
108 private: 99 private:
109 friend class ClientInfoManager; 100 friend class ClientInfoManager;
110 101
111 int num_objects_; 102 int num_objects_;
112 int texture_memory_used_; 103 int texture_memory_used_;
113 int buffer_memory_used_; 104 int buffer_memory_used_;
114 bool software_renderer_; 105 bool software_renderer_;
115 bool non_power_of_two_textures_; 106 bool non_power_of_two_textures_;
107 bool render_2d_;
116 String version_; 108 String version_;
117 }; 109 };
118 110
119 // A class to manage the client info so other classes can easily look it up. 111 // A class to manage the client info so other classes can easily look it up.
120 class ClientInfoManager { 112 class ClientInfoManager {
121 public: 113 public:
122 static const InterfaceId kInterfaceId; 114 static const InterfaceId kInterfaceId;
123 115
124 explicit ClientInfoManager(ServiceLocator* service_locator); 116 explicit ClientInfoManager(ServiceLocator* service_locator);
125 117
(...skipping 12 matching lines...) Expand all
138 } 130 }
139 131
140 void SetSoftwareRenderer(bool used) { 132 void SetSoftwareRenderer(bool used) {
141 client_info_.software_renderer_ = used; 133 client_info_.software_renderer_ = used;
142 } 134 }
143 135
144 void SetNonPowerOfTwoTextures(bool npot) { 136 void SetNonPowerOfTwoTextures(bool npot) {
145 client_info_.non_power_of_two_textures_ = npot; 137 client_info_.non_power_of_two_textures_ = npot;
146 } 138 }
147 139
140 void SetRenderer2d(bool render2d) {
Tristan Schmelcher 2 2011/02/23 02:08:51 This should be SetRender2d to match the property n
141 client_info_.render_2d_ = render2d;
142 }
143
148 private: 144 private:
149 ServiceImplementation<ClientInfoManager> service_; 145 ServiceImplementation<ClientInfoManager> service_;
150 146
151 ClientInfo client_info_; 147 ClientInfo client_info_;
152 148
153 DISALLOW_COPY_AND_ASSIGN(ClientInfoManager); 149 DISALLOW_COPY_AND_ASSIGN(ClientInfoManager);
154 }; 150 };
155 151
156 } // namespace o3d 152 } // namespace o3d
157 153
158 #endif // O3D_CORE_CROSS_CLIENT_INFO_H_ 154 #endif // O3D_CORE_CROSS_CLIENT_INFO_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698