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

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

Issue 153173002: Add a gpu driver bug workaround to count in all varyings in packing check. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 // 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_PROGRAM_MANAGER_H_ 5 #ifndef GPU_COMMAND_BUFFER_SERVICE_PROGRAM_MANAGER_H_
6 #define GPU_COMMAND_BUFFER_SERVICE_PROGRAM_MANAGER_H_ 6 #define GPU_COMMAND_BUFFER_SERVICE_PROGRAM_MANAGER_H_
7 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 16 matching lines...) Expand all
27 class ShaderManager; 27 class ShaderManager;
28 class ShaderTranslator; 28 class ShaderTranslator;
29 29
30 // This is used to track which attributes a particular program needs 30 // This is used to track which attributes a particular program needs
31 // so we can verify at glDrawXXX time that every attribute is either disabled 31 // so we can verify at glDrawXXX time that every attribute is either disabled
32 // or if enabled that it points to a valid source. 32 // or if enabled that it points to a valid source.
33 class GPU_EXPORT Program : public base::RefCounted<Program> { 33 class GPU_EXPORT Program : public base::RefCounted<Program> {
34 public: 34 public:
35 static const int kMaxAttachedShaders = 2; 35 static const int kMaxAttachedShaders = 2;
36 36
37 enum VaryingsPackingOption {
38 kCountOnlyStaticallyUsed,
39 kCountAll
40 };
41
37 struct UniformInfo { 42 struct UniformInfo {
38 UniformInfo(); 43 UniformInfo();
39 UniformInfo( 44 UniformInfo(
40 GLsizei _size, GLenum _type, GLint _fake_location_base, 45 GLsizei _size, GLenum _type, GLint _fake_location_base,
41 const std::string& _name); 46 const std::string& _name);
42 ~UniformInfo(); 47 ~UniformInfo();
43 48
44 bool IsValid() const { 49 bool IsValid() const {
45 return size != 0; 50 return size != 0;
46 } 51 }
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 199
195 // Return true if a varying is statically used in fragment shader, but it 200 // Return true if a varying is statically used in fragment shader, but it
196 // is not declared in vertex shader. 201 // is not declared in vertex shader.
197 bool DetectVaryingsMismatch(std::string* conflicting_name) const; 202 bool DetectVaryingsMismatch(std::string* conflicting_name) const;
198 203
199 // Return true if an uniform and an attribute share the same name. 204 // Return true if an uniform and an attribute share the same name.
200 bool DetectGlobalNameConflicts(std::string* conflicting_name) const; 205 bool DetectGlobalNameConflicts(std::string* conflicting_name) const;
201 206
202 // Return false if varyings can't be packed into the max available 207 // Return false if varyings can't be packed into the max available
203 // varying registers. 208 // varying registers.
204 bool CheckVaryingsPacking() const; 209 bool CheckVaryingsPacking(VaryingsPackingOption option) const;
205 210
206 // Visible for testing 211 // Visible for testing
207 const LocationMap& bind_attrib_location_map() const { 212 const LocationMap& bind_attrib_location_map() const {
208 return bind_attrib_location_map_; 213 return bind_attrib_location_map_;
209 } 214 }
210 215
211 private: 216 private:
212 friend class base::RefCounted<Program>; 217 friend class base::RefCounted<Program>;
213 friend class ProgramManager; 218 friend class ProgramManager;
214 219
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 // TODO(gman): Choose a faster container. 402 // TODO(gman): Choose a faster container.
398 typedef std::map<GLuint, scoped_refptr<Program> > ProgramMap; 403 typedef std::map<GLuint, scoped_refptr<Program> > ProgramMap;
399 ProgramMap programs_; 404 ProgramMap programs_;
400 405
401 // Counts the number of Program allocated with 'this' as its manager. 406 // Counts the number of Program allocated with 'this' as its manager.
402 // Allows to check no Program will outlive this. 407 // Allows to check no Program will outlive this.
403 unsigned int program_count_; 408 unsigned int program_count_;
404 409
405 bool have_context_; 410 bool have_context_;
406 411
407 bool disable_workarounds_;
408
409 // Used to clear uniforms. 412 // Used to clear uniforms.
410 std::vector<uint8> zero_; 413 std::vector<uint8> zero_;
411 414
412 ProgramCache* program_cache_; 415 ProgramCache* program_cache_;
413 416
414 uint32 max_varying_vectors_; 417 uint32 max_varying_vectors_;
415 418
416 DISALLOW_COPY_AND_ASSIGN(ProgramManager); 419 DISALLOW_COPY_AND_ASSIGN(ProgramManager);
417 }; 420 };
418 421
419 } // namespace gles2 422 } // namespace gles2
420 } // namespace gpu 423 } // namespace gpu
421 424
422 #endif // GPU_COMMAND_BUFFER_SERVICE_PROGRAM_MANAGER_H_ 425 #endif // GPU_COMMAND_BUFFER_SERVICE_PROGRAM_MANAGER_H_
OLDNEW
« no previous file with comments | « no previous file | gpu/command_buffer/service/program_manager.cc » ('j') | gpu/command_buffer/service/program_manager.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698