OLD | NEW |
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 #include "gpu/command_buffer/client/program_info_manager.h" | 5 #include "gpu/command_buffer/client/program_info_manager.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 | 8 |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/synchronization/lock.h" | 10 #include "base/synchronization/lock.h" |
11 #include "gpu/command_buffer/client/gles2_implementation.h" | 11 #include "gpu/command_buffer/client/gles2_implementation.h" |
12 #include "gpu/command_buffer/common/gles2_cmd_utils.h" | 12 #include "gpu/command_buffer/common/gles2_cmd_utils.h" |
13 | 13 |
14 namespace gpu { | 14 namespace gpu { |
15 namespace gles2 { | 15 namespace gles2 { |
16 | 16 |
17 class NonCachedProgramInfoManager : public ProgramInfoManager { | 17 class NonCachedProgramInfoManager : public ProgramInfoManager { |
18 public: | 18 public: |
19 NonCachedProgramInfoManager(); | 19 NonCachedProgramInfoManager(); |
20 virtual ~NonCachedProgramInfoManager(); | 20 ~NonCachedProgramInfoManager() override; |
21 | 21 |
22 virtual void CreateInfo(GLuint program) override; | 22 void CreateInfo(GLuint program) override; |
23 | 23 |
24 virtual void DeleteInfo(GLuint program) override; | 24 void DeleteInfo(GLuint program) override; |
25 | 25 |
26 virtual bool GetProgramiv(GLES2Implementation* gl, | 26 bool GetProgramiv(GLES2Implementation* gl, |
27 GLuint program, | 27 GLuint program, |
28 GLenum pname, | 28 GLenum pname, |
29 GLint* params) override; | 29 GLint* params) override; |
30 | 30 |
31 virtual GLint GetAttribLocation(GLES2Implementation* gl, | 31 GLint GetAttribLocation(GLES2Implementation* gl, |
32 GLuint program, | 32 GLuint program, |
33 const char* name) override; | 33 const char* name) override; |
34 | 34 |
35 virtual GLint GetUniformLocation(GLES2Implementation* gl, | 35 GLint GetUniformLocation(GLES2Implementation* gl, |
36 GLuint program, | 36 GLuint program, |
37 const char* name) override; | 37 const char* name) override; |
38 | 38 |
39 virtual bool GetActiveAttrib(GLES2Implementation* gl, | 39 bool GetActiveAttrib(GLES2Implementation* gl, |
40 GLuint program, | 40 GLuint program, |
41 GLuint index, | 41 GLuint index, |
42 GLsizei bufsize, | 42 GLsizei bufsize, |
43 GLsizei* length, | 43 GLsizei* length, |
44 GLint* size, | 44 GLint* size, |
45 GLenum* type, | 45 GLenum* type, |
46 char* name) override; | 46 char* name) override; |
47 | 47 |
48 virtual bool GetActiveUniform(GLES2Implementation* gl, | 48 bool GetActiveUniform(GLES2Implementation* gl, |
49 GLuint program, | 49 GLuint program, |
50 GLuint index, | 50 GLuint index, |
51 GLsizei bufsize, | 51 GLsizei bufsize, |
52 GLsizei* length, | 52 GLsizei* length, |
53 GLint* size, | 53 GLint* size, |
54 GLenum* type, | 54 GLenum* type, |
55 char* name) override; | 55 char* name) override; |
56 | |
57 }; | 56 }; |
58 | 57 |
59 NonCachedProgramInfoManager::NonCachedProgramInfoManager() { | 58 NonCachedProgramInfoManager::NonCachedProgramInfoManager() { |
60 } | 59 } |
61 | 60 |
62 NonCachedProgramInfoManager::~NonCachedProgramInfoManager() { | 61 NonCachedProgramInfoManager::~NonCachedProgramInfoManager() { |
63 } | 62 } |
64 | 63 |
65 void NonCachedProgramInfoManager::CreateInfo(GLuint /* program */) { | 64 void NonCachedProgramInfoManager::CreateInfo(GLuint /* program */) { |
66 } | 65 } |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 GLES2Implementation* gl, | 97 GLES2Implementation* gl, |
99 GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, | 98 GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, |
100 GLint* size, GLenum* type, char* name) { | 99 GLint* size, GLenum* type, char* name) { |
101 return gl->GetActiveUniformHelper( | 100 return gl->GetActiveUniformHelper( |
102 program, index, bufsize, length, size, type, name); | 101 program, index, bufsize, length, size, type, name); |
103 } | 102 } |
104 | 103 |
105 class CachedProgramInfoManager : public ProgramInfoManager { | 104 class CachedProgramInfoManager : public ProgramInfoManager { |
106 public: | 105 public: |
107 CachedProgramInfoManager(); | 106 CachedProgramInfoManager(); |
108 virtual ~CachedProgramInfoManager(); | 107 ~CachedProgramInfoManager() override; |
109 | 108 |
110 virtual void CreateInfo(GLuint program) override; | 109 void CreateInfo(GLuint program) override; |
111 | 110 |
112 virtual void DeleteInfo(GLuint program) override; | 111 void DeleteInfo(GLuint program) override; |
113 | 112 |
114 virtual bool GetProgramiv(GLES2Implementation* gl, | 113 bool GetProgramiv(GLES2Implementation* gl, |
115 GLuint program, | 114 GLuint program, |
116 GLenum pname, | 115 GLenum pname, |
117 GLint* params) override; | 116 GLint* params) override; |
118 | 117 |
119 virtual GLint GetAttribLocation(GLES2Implementation* gl, | 118 GLint GetAttribLocation(GLES2Implementation* gl, |
120 GLuint program, | 119 GLuint program, |
121 const char* name) override; | 120 const char* name) override; |
122 | 121 |
123 virtual GLint GetUniformLocation(GLES2Implementation* gl, | 122 GLint GetUniformLocation(GLES2Implementation* gl, |
124 GLuint program, | 123 GLuint program, |
125 const char* name) override; | 124 const char* name) override; |
126 | 125 |
127 virtual bool GetActiveAttrib(GLES2Implementation* gl, | 126 bool GetActiveAttrib(GLES2Implementation* gl, |
128 GLuint program, | 127 GLuint program, |
129 GLuint index, | 128 GLuint index, |
130 GLsizei bufsize, | 129 GLsizei bufsize, |
131 GLsizei* length, | 130 GLsizei* length, |
132 GLint* size, | 131 GLint* size, |
133 GLenum* type, | 132 GLenum* type, |
134 char* name) override; | 133 char* name) override; |
135 | 134 |
136 virtual bool GetActiveUniform(GLES2Implementation* gl, | 135 bool GetActiveUniform(GLES2Implementation* gl, |
137 GLuint program, | 136 GLuint program, |
138 GLuint index, | 137 GLuint index, |
139 GLsizei bufsize, | 138 GLsizei bufsize, |
140 GLsizei* length, | 139 GLsizei* length, |
141 GLint* size, | 140 GLint* size, |
142 GLenum* type, | 141 GLenum* type, |
143 char* name) override; | 142 char* name) override; |
144 | 143 |
145 private: | 144 private: |
146 class Program { | 145 class Program { |
147 public: | 146 public: |
148 struct UniformInfo { | 147 struct UniformInfo { |
149 UniformInfo(GLsizei _size, GLenum _type, const std::string& _name); | 148 UniformInfo(GLsizei _size, GLenum _type, const std::string& _name); |
150 | 149 |
151 GLsizei size; | 150 GLsizei size; |
152 GLenum type; | 151 GLenum type; |
153 bool is_array; | 152 bool is_array; |
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
517 if (shared_resources_across_processes) { | 516 if (shared_resources_across_processes) { |
518 return new NonCachedProgramInfoManager(); | 517 return new NonCachedProgramInfoManager(); |
519 } else { | 518 } else { |
520 return new CachedProgramInfoManager(); | 519 return new CachedProgramInfoManager(); |
521 } | 520 } |
522 } | 521 } |
523 | 522 |
524 } // namespace gles2 | 523 } // namespace gles2 |
525 } // namespace gpu | 524 } // namespace gpu |
526 | 525 |
OLD | NEW |