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

Side by Side Diff: gpu/command_buffer/service/gles2_cmd_decoder_passthrough_doers.cc

Issue 2317363005: Add basic GL functionality to the passthrough command buffer. (Closed)
Patch Set: Created 4 years, 3 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
OLDNEW
1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2016 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/service/gles2_cmd_decoder_passthrough.h" 5 #include "gpu/command_buffer/service/gles2_cmd_decoder_passthrough.h"
6 6
7 #include "base/strings/string_number_conversions.h" 7 #include "base/strings/string_number_conversions.h"
8 8
9 namespace gpu { 9 namespace gpu {
10 namespace gles2 { 10 namespace gles2 {
11 11
12 namespace {
13
14 template <typename ClientType, typename ServiceType, typename GenFunction>
15 error::Error GenHelper(GLsizei n,
16 const volatile ClientType* client_ids,
17 ClientServiceMap<ClientType, ServiceType>* id_map,
18 GenFunction gen_function) {
19 std::vector<ServiceType> service_ids(n, 0);
20 gen_function(n, service_ids.data());
21 for (GLsizei ii = 0; ii < n; ++ii) {
22 ClientType client_id = client_ids[ii];
23 if (id_map->GetServiceID(client_ids[ii], nullptr)) {
24 return error::kInvalidArguments;
25 }
26 id_map->SetIDMapping(client_id, service_ids[ii]);
27 }
28
29 return error::kNoError;
30 }
31
32 template <typename ClientType, typename ServiceType, typename GenFunction>
33 error::Error CreateHelper(ClientType client_id,
34 ClientServiceMap<ClientType, ServiceType>* id_map,
35 GenFunction create_function) {
36 if (id_map->GetServiceID(client_id, nullptr)) {
37 return error::kInvalidArguments;
38 }
39 ServiceType service_id = create_function();
40 id_map->SetIDMapping(client_id, service_id);
41 return error::kNoError;
42 }
43
44 template <typename ClientType, typename ServiceType, typename DeleteFunction>
45 error::Error DeleteHelper(GLsizei n,
46 const volatile ClientType* client_ids,
47 ClientServiceMap<ClientType, ServiceType>* id_map,
48 DeleteFunction delete_function) {
49 std::vector<ServiceType> service_ids(n, 0);
50 for (GLsizei ii = 0; ii < n; ++ii) {
51 ClientType client_id = client_ids[ii];
52 service_ids[ii] = id_map->GetServiceIDOrReserve(client_id);
53 id_map->RemoveClientID(client_id);
54 }
55
56 delete_function(n, service_ids.data());
57
58 return error::kNoError;
59 }
60
61 template <typename ClientType, typename ServiceType, typename DeleteFunction>
62 error::Error DeleteHelper(ClientType client_id,
63 ClientServiceMap<ClientType, ServiceType>* id_map,
64 DeleteFunction delete_function) {
65 delete_function(id_map->GetServiceIDOrReserve(client_id));
66 id_map->RemoveClientID(client_id);
67 return error::kNoError;
68 }
69
70 } // anonymous namespace
71
12 // Implementations of commands 72 // Implementations of commands
13 error::Error GLES2DecoderPassthroughImpl::DoActiveTexture(GLenum texture) { 73 error::Error GLES2DecoderPassthroughImpl::DoActiveTexture(GLenum texture) {
74 glActiveTexture(texture);
75 active_texture_unit_ = static_cast<size_t>(texture) - GL_TEXTURE0;
14 return error::kNoError; 76 return error::kNoError;
15 } 77 }
16 78
17 error::Error GLES2DecoderPassthroughImpl::DoAttachShader(GLuint program, 79 error::Error GLES2DecoderPassthroughImpl::DoAttachShader(GLuint program,
18 GLuint shader) { 80 GLuint shader) {
81 glAttachShader(resources_->program_id_map.GetServiceIDOrReserve(program),
82 resources_->shader_id_map.GetServiceIDOrReserve(shader));
19 return error::kNoError; 83 return error::kNoError;
20 } 84 }
21 85
22 error::Error GLES2DecoderPassthroughImpl::DoBindAttribLocation( 86 error::Error GLES2DecoderPassthroughImpl::DoBindAttribLocation(
23 GLuint program, 87 GLuint program,
24 GLuint index, 88 GLuint index,
25 const char* name) { 89 const char* name) {
90 glBindAttribLocation(
91 resources_->program_id_map.GetServiceIDOrReserve(program), index, name);
26 return error::kNoError; 92 return error::kNoError;
27 } 93 }
28 94
29 error::Error GLES2DecoderPassthroughImpl::DoBindBuffer(GLenum target, 95 error::Error GLES2DecoderPassthroughImpl::DoBindBuffer(GLenum target,
30 GLuint buffer) { 96 GLuint buffer) {
97 glBindBuffer(target, resources_->buffer_id_map.GetServiceIDOrReserve(buffer));
31 return error::kNoError; 98 return error::kNoError;
32 } 99 }
33 100
34 error::Error GLES2DecoderPassthroughImpl::DoBindBufferBase(GLenum target, 101 error::Error GLES2DecoderPassthroughImpl::DoBindBufferBase(GLenum target,
35 GLuint index, 102 GLuint index,
36 GLuint buffer) { 103 GLuint buffer) {
104 glBindBufferBase(target, index,
105 resources_->buffer_id_map.GetServiceIDOrReserve(buffer));
37 return error::kNoError; 106 return error::kNoError;
38 } 107 }
39 108
40 error::Error GLES2DecoderPassthroughImpl::DoBindBufferRange(GLenum target, 109 error::Error GLES2DecoderPassthroughImpl::DoBindBufferRange(GLenum target,
41 GLuint index, 110 GLuint index,
42 GLuint buffer, 111 GLuint buffer,
43 GLintptr offset, 112 GLintptr offset,
44 GLsizeiptr size) { 113 GLsizeiptr size) {
114 glBindBufferRange(target, index,
115 resources_->buffer_id_map.GetServiceIDOrReserve(buffer),
116 offset, size);
45 return error::kNoError; 117 return error::kNoError;
46 } 118 }
47 119
48 error::Error GLES2DecoderPassthroughImpl::DoBindFramebuffer( 120 error::Error GLES2DecoderPassthroughImpl::DoBindFramebuffer(
49 GLenum target, 121 GLenum target,
50 GLuint framebuffer) { 122 GLuint framebuffer) {
123 glBindFramebufferEXT(target,
124 framebuffer_id_map_.GetServiceIDOrReserve(framebuffer));
51 return error::kNoError; 125 return error::kNoError;
52 } 126 }
53 127
54 error::Error GLES2DecoderPassthroughImpl::DoBindRenderbuffer( 128 error::Error GLES2DecoderPassthroughImpl::DoBindRenderbuffer(
55 GLenum target, 129 GLenum target,
56 GLuint renderbuffer) { 130 GLuint renderbuffer) {
131 glBindRenderbufferEXT(
132 target,
133 resources_->renderbuffer_id_map.GetServiceIDOrReserve(renderbuffer));
57 return error::kNoError; 134 return error::kNoError;
58 } 135 }
59 136
60 error::Error GLES2DecoderPassthroughImpl::DoBindSampler(GLuint unit, 137 error::Error GLES2DecoderPassthroughImpl::DoBindSampler(GLuint unit,
61 GLuint sampler) { 138 GLuint sampler) {
139 glBindSampler(unit,
140 resources_->sampler_id_map.GetServiceIDOrReserve(sampler));
62 return error::kNoError; 141 return error::kNoError;
63 } 142 }
64 143
65 error::Error GLES2DecoderPassthroughImpl::DoBindTexture(GLenum target, 144 error::Error GLES2DecoderPassthroughImpl::DoBindTexture(GLenum target,
66 GLuint texture) { 145 GLuint texture) {
146 glBindTexture(target,
147 resources_->texture_id_map.GetServiceIDOrReserve(texture));
148 if (target == GL_TEXTURE_2D &&
149 active_texture_unit_ < bound_textures_.size()) {
150 bound_textures_[active_texture_unit_] = texture;
151 }
67 return error::kNoError; 152 return error::kNoError;
68 } 153 }
69 154
70 error::Error GLES2DecoderPassthroughImpl::DoBindTransformFeedback( 155 error::Error GLES2DecoderPassthroughImpl::DoBindTransformFeedback(
71 GLenum target, 156 GLenum target,
72 GLuint transformfeedback) { 157 GLuint transformfeedback) {
158 glBindTransformFeedback(
159 target,
160 transform_feedback_id_map_.GetServiceIDOrReserve(transformfeedback));
73 return error::kNoError; 161 return error::kNoError;
74 } 162 }
75 163
76 error::Error GLES2DecoderPassthroughImpl::DoBlendColor(GLclampf red, 164 error::Error GLES2DecoderPassthroughImpl::DoBlendColor(GLclampf red,
77 GLclampf green, 165 GLclampf green,
78 GLclampf blue, 166 GLclampf blue,
79 GLclampf alpha) { 167 GLclampf alpha) {
168 glBlendColor(red, green, blue, alpha);
80 return error::kNoError; 169 return error::kNoError;
81 } 170 }
82 171
83 error::Error GLES2DecoderPassthroughImpl::DoBlendEquation(GLenum mode) { 172 error::Error GLES2DecoderPassthroughImpl::DoBlendEquation(GLenum mode) {
173 glBlendEquation(mode);
84 return error::kNoError; 174 return error::kNoError;
85 } 175 }
86 176
87 error::Error GLES2DecoderPassthroughImpl::DoBlendEquationSeparate( 177 error::Error GLES2DecoderPassthroughImpl::DoBlendEquationSeparate(
88 GLenum modeRGB, 178 GLenum modeRGB,
89 GLenum modeAlpha) { 179 GLenum modeAlpha) {
180 glBlendEquationSeparate(modeRGB, modeAlpha);
90 return error::kNoError; 181 return error::kNoError;
91 } 182 }
92 183
93 error::Error GLES2DecoderPassthroughImpl::DoBlendFunc(GLenum sfactor, 184 error::Error GLES2DecoderPassthroughImpl::DoBlendFunc(GLenum sfactor,
94 GLenum dfactor) { 185 GLenum dfactor) {
186 glBlendFunc(sfactor, dfactor);
95 return error::kNoError; 187 return error::kNoError;
96 } 188 }
97 189
98 error::Error GLES2DecoderPassthroughImpl::DoBlendFuncSeparate(GLenum srcRGB, 190 error::Error GLES2DecoderPassthroughImpl::DoBlendFuncSeparate(GLenum srcRGB,
99 GLenum dstRGB, 191 GLenum dstRGB,
100 GLenum srcAlpha, 192 GLenum srcAlpha,
101 GLenum dstAlpha) { 193 GLenum dstAlpha) {
194 glBlendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha);
102 return error::kNoError; 195 return error::kNoError;
103 } 196 }
104 197
105 error::Error GLES2DecoderPassthroughImpl::DoBufferData(GLenum target, 198 error::Error GLES2DecoderPassthroughImpl::DoBufferData(GLenum target,
106 GLsizeiptr size, 199 GLsizeiptr size,
107 const void* data, 200 const void* data,
108 GLenum usage) { 201 GLenum usage) {
202 glBufferData(target, size, data, usage);
109 return error::kNoError; 203 return error::kNoError;
110 } 204 }
111 205
112 error::Error GLES2DecoderPassthroughImpl::DoBufferSubData(GLenum target, 206 error::Error GLES2DecoderPassthroughImpl::DoBufferSubData(GLenum target,
113 GLintptr offset, 207 GLintptr offset,
114 GLsizeiptr size, 208 GLsizeiptr size,
115 const void* data) { 209 const void* data) {
210 glBufferSubData(target, offset, size, data);
116 return error::kNoError; 211 return error::kNoError;
117 } 212 }
118 213
119 error::Error GLES2DecoderPassthroughImpl::DoCheckFramebufferStatus( 214 error::Error GLES2DecoderPassthroughImpl::DoCheckFramebufferStatus(
120 GLenum target, 215 GLenum target,
121 uint32_t* result) { 216 uint32_t* result) {
217 *result = glCheckFramebufferStatusEXT(target);
122 return error::kNoError; 218 return error::kNoError;
123 } 219 }
124 220
125 error::Error GLES2DecoderPassthroughImpl::DoClear(GLbitfield mask) { 221 error::Error GLES2DecoderPassthroughImpl::DoClear(GLbitfield mask) {
222 glClear(mask);
126 return error::kNoError; 223 return error::kNoError;
127 } 224 }
128 225
129 error::Error GLES2DecoderPassthroughImpl::DoClearBufferfi(GLenum buffer, 226 error::Error GLES2DecoderPassthroughImpl::DoClearBufferfi(GLenum buffer,
130 GLint drawbuffers, 227 GLint drawbuffers,
131 GLfloat depth, 228 GLfloat depth,
132 GLint stencil) { 229 GLint stencil) {
230 glClearBufferfi(buffer, drawbuffers, depth, stencil);
133 return error::kNoError; 231 return error::kNoError;
134 } 232 }
135 233
136 error::Error GLES2DecoderPassthroughImpl::DoClearBufferfv( 234 error::Error GLES2DecoderPassthroughImpl::DoClearBufferfv(
137 GLenum buffer, 235 GLenum buffer,
138 GLint drawbuffers, 236 GLint drawbuffers,
139 const volatile GLfloat* value) { 237 const volatile GLfloat* value) {
238 glClearBufferfv(buffer, drawbuffers, const_cast<const GLfloat*>(value));
140 return error::kNoError; 239 return error::kNoError;
141 } 240 }
142 241
143 error::Error GLES2DecoderPassthroughImpl::DoClearBufferiv( 242 error::Error GLES2DecoderPassthroughImpl::DoClearBufferiv(
144 GLenum buffer, 243 GLenum buffer,
145 GLint drawbuffers, 244 GLint drawbuffers,
146 const volatile GLint* value) { 245 const volatile GLint* value) {
246 glClearBufferiv(buffer, drawbuffers, const_cast<const GLint*>(value));
147 return error::kNoError; 247 return error::kNoError;
148 } 248 }
149 249
150 error::Error GLES2DecoderPassthroughImpl::DoClearBufferuiv( 250 error::Error GLES2DecoderPassthroughImpl::DoClearBufferuiv(
151 GLenum buffer, 251 GLenum buffer,
152 GLint drawbuffers, 252 GLint drawbuffers,
153 const volatile GLuint* value) { 253 const volatile GLuint* value) {
254 glClearBufferuiv(buffer, drawbuffers, const_cast<const GLuint*>(value));
154 return error::kNoError; 255 return error::kNoError;
155 } 256 }
156 257
157 error::Error GLES2DecoderPassthroughImpl::DoClearColor(GLclampf red, 258 error::Error GLES2DecoderPassthroughImpl::DoClearColor(GLclampf red,
158 GLclampf green, 259 GLclampf green,
159 GLclampf blue, 260 GLclampf blue,
160 GLclampf alpha) { 261 GLclampf alpha) {
262 glClearColor(red, green, blue, alpha);
161 return error::kNoError; 263 return error::kNoError;
162 } 264 }
163 265
164 error::Error GLES2DecoderPassthroughImpl::DoClearDepthf(GLclampf depth) { 266 error::Error GLES2DecoderPassthroughImpl::DoClearDepthf(GLclampf depth) {
267 glClearDepthf(depth);
165 return error::kNoError; 268 return error::kNoError;
166 } 269 }
167 270
168 error::Error GLES2DecoderPassthroughImpl::DoClearStencil(GLint s) { 271 error::Error GLES2DecoderPassthroughImpl::DoClearStencil(GLint s) {
272 glClearStencil(s);
169 return error::kNoError; 273 return error::kNoError;
170 } 274 }
171 275
172 error::Error GLES2DecoderPassthroughImpl::DoClientWaitSync(GLuint sync, 276 error::Error GLES2DecoderPassthroughImpl::DoClientWaitSync(GLuint sync,
173 GLbitfield flags, 277 GLbitfield flags,
174 GLuint64 timeout, 278 GLuint64 timeout,
175 GLenum* result) { 279 GLenum* result) {
280 DCHECK(false) << "UNIMPLEMENTED";
Zhenyao Mo 2016/09/09 21:22:11 Use NOTIMPLEMENTED() instead. here and all other p
Geoff Lang 2016/09/12 14:21:29 Done.
176 return error::kNoError; 281 return error::kNoError;
177 } 282 }
178 283
179 error::Error GLES2DecoderPassthroughImpl::DoColorMask(GLboolean red, 284 error::Error GLES2DecoderPassthroughImpl::DoColorMask(GLboolean red,
180 GLboolean green, 285 GLboolean green,
181 GLboolean blue, 286 GLboolean blue,
182 GLboolean alpha) { 287 GLboolean alpha) {
288 glColorMask(red, green, blue, alpha);
183 return error::kNoError; 289 return error::kNoError;
184 } 290 }
185 291
186 error::Error GLES2DecoderPassthroughImpl::DoCompileShader(GLuint shader) { 292 error::Error GLES2DecoderPassthroughImpl::DoCompileShader(GLuint shader) {
293 glCompileShader(resources_->shader_id_map.GetServiceIDOrReserve(shader));
187 return error::kNoError; 294 return error::kNoError;
188 } 295 }
189 296
190 error::Error GLES2DecoderPassthroughImpl::DoCompressedTexImage2D( 297 error::Error GLES2DecoderPassthroughImpl::DoCompressedTexImage2D(
191 GLenum target, 298 GLenum target,
192 GLint level, 299 GLint level,
193 GLenum internalformat, 300 GLenum internalformat,
194 GLsizei width, 301 GLsizei width,
195 GLsizei height, 302 GLsizei height,
196 GLint border, 303 GLint border,
197 GLsizei imageSize, 304 GLsizei imageSize,
198 const void* data) { 305 const void* data) {
306 DCHECK(false) << "UNIMPLEMENTED";
199 return error::kNoError; 307 return error::kNoError;
200 } 308 }
201 309
202 error::Error GLES2DecoderPassthroughImpl::DoCompressedTexSubImage2D( 310 error::Error GLES2DecoderPassthroughImpl::DoCompressedTexSubImage2D(
203 GLenum target, 311 GLenum target,
204 GLint level, 312 GLint level,
205 GLint xoffset, 313 GLint xoffset,
206 GLint yoffset, 314 GLint yoffset,
207 GLsizei width, 315 GLsizei width,
208 GLsizei height, 316 GLsizei height,
209 GLenum format, 317 GLenum format,
210 GLsizei imageSize, 318 GLsizei imageSize,
211 const void* data) { 319 const void* data) {
320 DCHECK(false) << "UNIMPLEMENTED";
212 return error::kNoError; 321 return error::kNoError;
213 } 322 }
214 323
215 error::Error GLES2DecoderPassthroughImpl::DoCompressedTexImage3D( 324 error::Error GLES2DecoderPassthroughImpl::DoCompressedTexImage3D(
216 GLenum target, 325 GLenum target,
217 GLint level, 326 GLint level,
218 GLenum internalformat, 327 GLenum internalformat,
219 GLsizei width, 328 GLsizei width,
220 GLsizei height, 329 GLsizei height,
221 GLsizei depth, 330 GLsizei depth,
222 GLint border, 331 GLint border,
223 GLsizei imageSize, 332 GLsizei imageSize,
224 const void* data) { 333 const void* data) {
334 DCHECK(false) << "UNIMPLEMENTED";
225 return error::kNoError; 335 return error::kNoError;
226 } 336 }
227 337
228 error::Error GLES2DecoderPassthroughImpl::DoCompressedTexSubImage3D( 338 error::Error GLES2DecoderPassthroughImpl::DoCompressedTexSubImage3D(
229 GLenum target, 339 GLenum target,
230 GLint level, 340 GLint level,
231 GLint xoffset, 341 GLint xoffset,
232 GLint yoffset, 342 GLint yoffset,
233 GLint zoffset, 343 GLint zoffset,
234 GLsizei width, 344 GLsizei width,
235 GLsizei height, 345 GLsizei height,
236 GLsizei depth, 346 GLsizei depth,
237 GLenum format, 347 GLenum format,
238 GLsizei imageSize, 348 GLsizei imageSize,
239 const void* data) { 349 const void* data) {
350 DCHECK(false) << "UNIMPLEMENTED";
240 return error::kNoError; 351 return error::kNoError;
241 } 352 }
242 353
243 error::Error GLES2DecoderPassthroughImpl::DoCopyBufferSubData( 354 error::Error GLES2DecoderPassthroughImpl::DoCopyBufferSubData(
244 GLenum readtarget, 355 GLenum readtarget,
245 GLenum writetarget, 356 GLenum writetarget,
246 GLintptr readoffset, 357 GLintptr readoffset,
247 GLintptr writeoffset, 358 GLintptr writeoffset,
248 GLsizeiptr size) { 359 GLsizeiptr size) {
360 glCopyBufferSubData(readtarget, writetarget, readoffset, writeoffset, size);
249 return error::kNoError; 361 return error::kNoError;
250 } 362 }
251 363
252 error::Error GLES2DecoderPassthroughImpl::DoCopyTexImage2D( 364 error::Error GLES2DecoderPassthroughImpl::DoCopyTexImage2D(
253 GLenum target, 365 GLenum target,
254 GLint level, 366 GLint level,
255 GLenum internalformat, 367 GLenum internalformat,
256 GLint x, 368 GLint x,
257 GLint y, 369 GLint y,
258 GLsizei width, 370 GLsizei width,
259 GLsizei height, 371 GLsizei height,
260 GLint border) { 372 GLint border) {
373 glCopyTexImage2D(target, level, internalformat, x, y, width, height, border);
261 return error::kNoError; 374 return error::kNoError;
262 } 375 }
263 376
264 error::Error GLES2DecoderPassthroughImpl::DoCopyTexSubImage2D(GLenum target, 377 error::Error GLES2DecoderPassthroughImpl::DoCopyTexSubImage2D(GLenum target,
265 GLint level, 378 GLint level,
266 GLint xoffset, 379 GLint xoffset,
267 GLint yoffset, 380 GLint yoffset,
268 GLint x, 381 GLint x,
269 GLint y, 382 GLint y,
270 GLsizei width, 383 GLsizei width,
271 GLsizei height) { 384 GLsizei height) {
385 glCopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height);
272 return error::kNoError; 386 return error::kNoError;
273 } 387 }
274 388
275 error::Error GLES2DecoderPassthroughImpl::DoCopyTexSubImage3D(GLenum target, 389 error::Error GLES2DecoderPassthroughImpl::DoCopyTexSubImage3D(GLenum target,
276 GLint level, 390 GLint level,
277 GLint xoffset, 391 GLint xoffset,
278 GLint yoffset, 392 GLint yoffset,
279 GLint zoffset, 393 GLint zoffset,
280 GLint x, 394 GLint x,
281 GLint y, 395 GLint y,
282 GLsizei width, 396 GLsizei width,
283 GLsizei height) { 397 GLsizei height) {
398 glCopyTexSubImage3D(target, level, xoffset, yoffset, zoffset, x, y, width,
399 height);
284 return error::kNoError; 400 return error::kNoError;
285 } 401 }
286 402
287 error::Error GLES2DecoderPassthroughImpl::DoCreateProgram(GLuint client_id) { 403 error::Error GLES2DecoderPassthroughImpl::DoCreateProgram(GLuint client_id) {
288 return error::kNoError; 404 return CreateHelper(client_id, &resources_->program_id_map,
405 []() { return glCreateProgram(); });
289 } 406 }
290 407
291 error::Error GLES2DecoderPassthroughImpl::DoCreateShader(GLenum type, 408 error::Error GLES2DecoderPassthroughImpl::DoCreateShader(GLenum type,
292 GLuint client_id) { 409 GLuint client_id) {
293 return error::kNoError; 410 return CreateHelper(client_id, &resources_->shader_id_map,
411 [type]() { return glCreateShader(type); });
294 } 412 }
295 413
296 error::Error GLES2DecoderPassthroughImpl::DoCullFace(GLenum mode) { 414 error::Error GLES2DecoderPassthroughImpl::DoCullFace(GLenum mode) {
415 glCullFace(mode);
297 return error::kNoError; 416 return error::kNoError;
298 } 417 }
299 418
300 error::Error GLES2DecoderPassthroughImpl::DoDeleteBuffers( 419 error::Error GLES2DecoderPassthroughImpl::DoDeleteBuffers(
301 GLsizei n, 420 GLsizei n,
302 const volatile GLuint* buffers) { 421 const volatile GLuint* buffers) {
303 return error::kNoError; 422 return DeleteHelper(
423 n, buffers, &resources_->buffer_id_map,
424 [](GLsizei n, GLuint* buffers) { glDeleteBuffersARB(n, buffers); });
304 } 425 }
305 426
306 error::Error GLES2DecoderPassthroughImpl::DoDeleteFramebuffers( 427 error::Error GLES2DecoderPassthroughImpl::DoDeleteFramebuffers(
307 GLsizei n, 428 GLsizei n,
308 const volatile GLuint* framebuffers) { 429 const volatile GLuint* framebuffers) {
309 return error::kNoError; 430 return DeleteHelper(n, framebuffers, &framebuffer_id_map_,
431 [](GLsizei n, GLuint* framebuffers) {
432 glDeleteFramebuffersEXT(n, framebuffers);
433 });
310 } 434 }
311 435
312 error::Error GLES2DecoderPassthroughImpl::DoDeleteProgram(GLuint program) { 436 error::Error GLES2DecoderPassthroughImpl::DoDeleteProgram(GLuint program) {
313 return error::kNoError; 437 return DeleteHelper(program, &resources_->program_id_map,
438 [](GLuint program) { glDeleteProgram(program); });
314 } 439 }
315 440
316 error::Error GLES2DecoderPassthroughImpl::DoDeleteRenderbuffers( 441 error::Error GLES2DecoderPassthroughImpl::DoDeleteRenderbuffers(
317 GLsizei n, 442 GLsizei n,
318 const volatile GLuint* renderbuffers) { 443 const volatile GLuint* renderbuffers) {
319 return error::kNoError; 444 return DeleteHelper(n, renderbuffers, &resources_->renderbuffer_id_map,
445 [](GLsizei n, GLuint* renderbuffers) {
446 glDeleteRenderbuffersEXT(n, renderbuffers);
447 });
320 } 448 }
321 449
322 error::Error GLES2DecoderPassthroughImpl::DoDeleteSamplers( 450 error::Error GLES2DecoderPassthroughImpl::DoDeleteSamplers(
323 GLsizei n, 451 GLsizei n,
324 const volatile GLuint* samplers) { 452 const volatile GLuint* samplers) {
325 return error::kNoError; 453 return DeleteHelper(
454 n, samplers, &resources_->sampler_id_map,
455 [](GLsizei n, GLuint* samplers) { glDeleteSamplers(n, samplers); });
326 } 456 }
327 457
328 error::Error GLES2DecoderPassthroughImpl::DoDeleteSync(GLuint sync) { 458 error::Error GLES2DecoderPassthroughImpl::DoDeleteSync(GLuint sync) {
329 return error::kNoError; 459 return DeleteHelper(sync, &resources_->sync_id_map, [](uintptr_t sync) {
460 glDeleteSync(reinterpret_cast<GLsync>(sync));
461 });
330 } 462 }
331 463
332 error::Error GLES2DecoderPassthroughImpl::DoDeleteShader(GLuint shader) { 464 error::Error GLES2DecoderPassthroughImpl::DoDeleteShader(GLuint shader) {
333 return error::kNoError; 465 return DeleteHelper(shader, &resources_->shader_id_map,
466 [](GLuint shader) { glDeleteShader(shader); });
334 } 467 }
335 468
336 error::Error GLES2DecoderPassthroughImpl::DoDeleteTextures( 469 error::Error GLES2DecoderPassthroughImpl::DoDeleteTextures(
337 GLsizei n, 470 GLsizei n,
338 const volatile GLuint* textures) { 471 const volatile GLuint* textures) {
339 return error::kNoError; 472 // Textures that are currently associated with a mailbox are stored in the
473 // texture_object_map_ and are deleted automatically when they are
474 // unreferenced. Only delete textures that are not in this map.
475 std::vector<GLuint> non_mailbox_client_ids;
476 for (GLsizei ii = 0; ii < n; ++ii) {
477 GLuint client_id = textures[ii];
478 auto texture_object_iter = resources_->texture_object_map.find(client_id);
479 if (texture_object_iter == resources_->texture_object_map.end()) {
480 // Delete with DeleteHelper
481 non_mailbox_client_ids.push_back(client_id);
482 } else {
483 // Deleted when unreferenced
484 resources_->texture_id_map.RemoveClientID(client_id);
485 resources_->texture_object_map.erase(client_id);
486 }
487 }
488 return DeleteHelper(
489 non_mailbox_client_ids.size(), non_mailbox_client_ids.data(),
490 &resources_->texture_id_map,
491 [](GLsizei n, GLuint* textures) { glDeleteTextures(n, textures); });
340 } 492 }
341 493
342 error::Error GLES2DecoderPassthroughImpl::DoDeleteTransformFeedbacks( 494 error::Error GLES2DecoderPassthroughImpl::DoDeleteTransformFeedbacks(
343 GLsizei n, 495 GLsizei n,
344 const volatile GLuint* ids) { 496 const volatile GLuint* ids) {
345 return error::kNoError; 497 return DeleteHelper(n, ids, &transform_feedback_id_map_,
498 [](GLsizei n, GLuint* transform_feedbacks) {
499 glDeleteTransformFeedbacks(n, transform_feedbacks);
500 });
346 } 501 }
347 502
348 error::Error GLES2DecoderPassthroughImpl::DoDepthFunc(GLenum func) { 503 error::Error GLES2DecoderPassthroughImpl::DoDepthFunc(GLenum func) {
504 glDepthFunc(func);
349 return error::kNoError; 505 return error::kNoError;
350 } 506 }
351 507
352 error::Error GLES2DecoderPassthroughImpl::DoDepthMask(GLboolean flag) { 508 error::Error GLES2DecoderPassthroughImpl::DoDepthMask(GLboolean flag) {
509 glDepthMask(flag);
353 return error::kNoError; 510 return error::kNoError;
354 } 511 }
355 512
356 error::Error GLES2DecoderPassthroughImpl::DoDepthRangef(GLclampf zNear, 513 error::Error GLES2DecoderPassthroughImpl::DoDepthRangef(GLclampf zNear,
357 GLclampf zFar) { 514 GLclampf zFar) {
515 glDepthRangef(zNear, zFar);
358 return error::kNoError; 516 return error::kNoError;
359 } 517 }
360 518
361 error::Error GLES2DecoderPassthroughImpl::DoDetachShader(GLuint program, 519 error::Error GLES2DecoderPassthroughImpl::DoDetachShader(GLuint program,
362 GLuint shader) { 520 GLuint shader) {
521 glDetachShader(resources_->program_id_map.GetServiceIDOrReserve(program),
522 resources_->shader_id_map.GetServiceIDOrReserve(shader));
363 return error::kNoError; 523 return error::kNoError;
364 } 524 }
365 525
366 error::Error GLES2DecoderPassthroughImpl::DoDisable(GLenum cap) { 526 error::Error GLES2DecoderPassthroughImpl::DoDisable(GLenum cap) {
527 glDisable(cap);
367 return error::kNoError; 528 return error::kNoError;
368 } 529 }
369 530
370 error::Error GLES2DecoderPassthroughImpl::DoDisableVertexAttribArray( 531 error::Error GLES2DecoderPassthroughImpl::DoDisableVertexAttribArray(
371 GLuint index) { 532 GLuint index) {
533 glDisableVertexAttribArray(index);
372 return error::kNoError; 534 return error::kNoError;
373 } 535 }
374 536
375 error::Error GLES2DecoderPassthroughImpl::DoDrawArrays(GLenum mode, 537 error::Error GLES2DecoderPassthroughImpl::DoDrawArrays(GLenum mode,
376 GLint first, 538 GLint first,
377 GLsizei count) { 539 GLsizei count) {
540 glDrawArrays(mode, first, count);
378 return error::kNoError; 541 return error::kNoError;
379 } 542 }
380 543
381 error::Error GLES2DecoderPassthroughImpl::DoDrawElements(GLenum mode, 544 error::Error GLES2DecoderPassthroughImpl::DoDrawElements(GLenum mode,
382 GLsizei count, 545 GLsizei count,
383 GLenum type, 546 GLenum type,
384 const void* indices) { 547 const void* indices) {
548 glDrawElements(mode, count, type, indices);
385 return error::kNoError; 549 return error::kNoError;
386 } 550 }
387 551
388 error::Error GLES2DecoderPassthroughImpl::DoEnable(GLenum cap) { 552 error::Error GLES2DecoderPassthroughImpl::DoEnable(GLenum cap) {
553 glEnable(cap);
389 return error::kNoError; 554 return error::kNoError;
390 } 555 }
391 556
392 error::Error GLES2DecoderPassthroughImpl::DoEnableVertexAttribArray( 557 error::Error GLES2DecoderPassthroughImpl::DoEnableVertexAttribArray(
393 GLuint index) { 558 GLuint index) {
559 glEnableVertexAttribArray(index);
394 return error::kNoError; 560 return error::kNoError;
395 } 561 }
396 562
397 error::Error GLES2DecoderPassthroughImpl::DoFenceSync(GLenum condition, 563 error::Error GLES2DecoderPassthroughImpl::DoFenceSync(GLenum condition,
398 GLbitfield flags, 564 GLbitfield flags,
399 GLuint client_id) { 565 GLuint client_id) {
566 DCHECK(false) << "UNIMPLEMENTED";
400 return error::kNoError; 567 return error::kNoError;
401 } 568 }
402 569
403 error::Error GLES2DecoderPassthroughImpl::DoFinish() { 570 error::Error GLES2DecoderPassthroughImpl::DoFinish() {
571 glFinish();
404 return error::kNoError; 572 return error::kNoError;
405 } 573 }
406 574
407 error::Error GLES2DecoderPassthroughImpl::DoFlush() { 575 error::Error GLES2DecoderPassthroughImpl::DoFlush() {
576 glFlush();
408 return error::kNoError; 577 return error::kNoError;
409 } 578 }
410 579
411 error::Error GLES2DecoderPassthroughImpl::DoFramebufferRenderbuffer( 580 error::Error GLES2DecoderPassthroughImpl::DoFramebufferRenderbuffer(
412 GLenum target, 581 GLenum target,
413 GLenum attachment, 582 GLenum attachment,
414 GLenum renderbuffertarget, 583 GLenum renderbuffertarget,
415 GLuint renderbuffer) { 584 GLuint renderbuffer) {
585 // TODO: Handle this case in ANGLE by adding a WebGL validation mode.
Zhenyao Mo 2016/09/09 21:22:11 change all TODO to TODO(geofflang)
Geoff Lang 2016/09/12 14:21:29 Done.
586 if (attachment == GL_DEPTH_STENCIL_ATTACHMENT) {
587 glFramebufferRenderbufferEXT(
588 target, GL_DEPTH_ATTACHMENT, renderbuffertarget,
589 resources_->renderbuffer_id_map.GetServiceIDOrReserve(renderbuffer));
590 glFramebufferRenderbufferEXT(
591 target, GL_STENCIL_ATTACHMENT, renderbuffertarget,
592 resources_->renderbuffer_id_map.GetServiceIDOrReserve(renderbuffer));
593 } else {
594 glFramebufferRenderbufferEXT(
595 target, attachment, renderbuffertarget,
596 resources_->renderbuffer_id_map.GetServiceIDOrReserve(renderbuffer));
597 }
416 return error::kNoError; 598 return error::kNoError;
417 } 599 }
418 600
419 error::Error GLES2DecoderPassthroughImpl::DoFramebufferTexture2D( 601 error::Error GLES2DecoderPassthroughImpl::DoFramebufferTexture2D(
420 GLenum target, 602 GLenum target,
421 GLenum attachment, 603 GLenum attachment,
422 GLenum textarget, 604 GLenum textarget,
423 GLuint texture, 605 GLuint texture,
424 GLint level) { 606 GLint level) {
607 glFramebufferTexture2DEXT(
608 target, attachment, textarget,
609 resources_->texture_id_map.GetServiceIDOrReserve(texture), level);
425 return error::kNoError; 610 return error::kNoError;
426 } 611 }
427 612
428 error::Error GLES2DecoderPassthroughImpl::DoFramebufferTextureLayer( 613 error::Error GLES2DecoderPassthroughImpl::DoFramebufferTextureLayer(
429 GLenum target, 614 GLenum target,
430 GLenum attachment, 615 GLenum attachment,
431 GLuint texture, 616 GLuint texture,
432 GLint level, 617 GLint level,
433 GLint layer) { 618 GLint layer) {
619 glFramebufferTextureLayer(
620 target, attachment,
621 resources_->texture_id_map.GetServiceIDOrReserve(texture), level, layer);
434 return error::kNoError; 622 return error::kNoError;
435 } 623 }
436 624
437 error::Error GLES2DecoderPassthroughImpl::DoFrontFace(GLenum mode) { 625 error::Error GLES2DecoderPassthroughImpl::DoFrontFace(GLenum mode) {
626 glFrontFace(mode);
438 return error::kNoError; 627 return error::kNoError;
439 } 628 }
440 629
441 error::Error GLES2DecoderPassthroughImpl::DoGenBuffers( 630 error::Error GLES2DecoderPassthroughImpl::DoGenBuffers(
442 GLsizei n, 631 GLsizei n,
443 volatile GLuint* buffers) { 632 volatile GLuint* buffers) {
444 return error::kNoError; 633 return GenHelper(
634 n, buffers, &resources_->buffer_id_map,
635 [](GLsizei n, GLuint* buffers) { glGenBuffersARB(n, buffers); });
445 } 636 }
446 637
447 error::Error GLES2DecoderPassthroughImpl::DoGenerateMipmap(GLenum target) { 638 error::Error GLES2DecoderPassthroughImpl::DoGenerateMipmap(GLenum target) {
639 glGenerateMipmapEXT(target);
448 return error::kNoError; 640 return error::kNoError;
449 } 641 }
450 642
451 error::Error GLES2DecoderPassthroughImpl::DoGenFramebuffers( 643 error::Error GLES2DecoderPassthroughImpl::DoGenFramebuffers(
452 GLsizei n, 644 GLsizei n,
453 volatile GLuint* framebuffers) { 645 volatile GLuint* framebuffers) {
454 return error::kNoError; 646 return GenHelper(n, framebuffers, &framebuffer_id_map_,
647 [](GLsizei n, GLuint* framebuffers) {
648 glGenFramebuffersEXT(n, framebuffers);
649 });
455 } 650 }
456 651
457 error::Error GLES2DecoderPassthroughImpl::DoGenRenderbuffers( 652 error::Error GLES2DecoderPassthroughImpl::DoGenRenderbuffers(
458 GLsizei n, 653 GLsizei n,
459 volatile GLuint* renderbuffers) { 654 volatile GLuint* renderbuffers) {
460 return error::kNoError; 655 return GenHelper(n, renderbuffers, &resources_->renderbuffer_id_map,
656 [](GLsizei n, GLuint* renderbuffers) {
657 glGenRenderbuffersEXT(n, renderbuffers);
658 });
461 } 659 }
462 660
463 error::Error GLES2DecoderPassthroughImpl::DoGenSamplers( 661 error::Error GLES2DecoderPassthroughImpl::DoGenSamplers(
464 GLsizei n, 662 GLsizei n,
465 volatile GLuint* samplers) { 663 volatile GLuint* samplers) {
466 return error::kNoError; 664 return GenHelper(
665 n, samplers, &resources_->sampler_id_map,
666 [](GLsizei n, GLuint* samplers) { glGenSamplers(n, samplers); });
467 } 667 }
468 668
469 error::Error GLES2DecoderPassthroughImpl::DoGenTextures( 669 error::Error GLES2DecoderPassthroughImpl::DoGenTextures(
470 GLsizei n, 670 GLsizei n,
471 volatile GLuint* textures) { 671 volatile GLuint* textures) {
472 return error::kNoError; 672 return GenHelper(
673 n, textures, &resources_->texture_id_map,
674 [](GLsizei n, GLuint* textures) { glGenTextures(n, textures); });
473 } 675 }
474 676
475 error::Error GLES2DecoderPassthroughImpl::DoGenTransformFeedbacks( 677 error::Error GLES2DecoderPassthroughImpl::DoGenTransformFeedbacks(
476 GLsizei n, 678 GLsizei n,
477 volatile GLuint* ids) { 679 volatile GLuint* ids) {
478 return error::kNoError; 680 return GenHelper(n, ids, &transform_feedback_id_map_,
681 [](GLsizei n, GLuint* transform_feedbacks) {
682 glGenTransformFeedbacks(n, transform_feedbacks);
683 });
479 } 684 }
480 685
481 error::Error GLES2DecoderPassthroughImpl::DoGetActiveAttrib(GLuint program, 686 error::Error GLES2DecoderPassthroughImpl::DoGetActiveAttrib(GLuint program,
482 GLuint index, 687 GLuint index,
483 GLint* size, 688 GLint* size,
484 GLenum* type, 689 GLenum* type,
485 std::string* name) { 690 std::string* name) {
691 DCHECK(false) << "UNIMPLEMENTED";
486 return error::kNoError; 692 return error::kNoError;
487 } 693 }
488 694
489 error::Error GLES2DecoderPassthroughImpl::DoGetActiveUniform( 695 error::Error GLES2DecoderPassthroughImpl::DoGetActiveUniform(
490 GLuint program, 696 GLuint program,
491 GLuint index, 697 GLuint index,
492 GLint* size, 698 GLint* size,
493 GLenum* type, 699 GLenum* type,
494 std::string* name) { 700 std::string* name) {
701 DCHECK(false) << "UNIMPLEMENTED";
495 return error::kNoError; 702 return error::kNoError;
496 } 703 }
497 704
498 error::Error GLES2DecoderPassthroughImpl::DoGetActiveUniformBlockiv( 705 error::Error GLES2DecoderPassthroughImpl::DoGetActiveUniformBlockiv(
499 GLuint program, 706 GLuint program,
500 GLuint index, 707 GLuint index,
501 GLenum pname, 708 GLenum pname,
502 GLsizei bufSize, 709 GLsizei bufSize,
503 GLsizei* length, 710 GLsizei* length,
504 GLint* params) { 711 GLint* params) {
712 DCHECK(false) << "UNIMPLEMENTED";
505 return error::kNoError; 713 return error::kNoError;
506 } 714 }
507 715
508 error::Error GLES2DecoderPassthroughImpl::DoGetActiveUniformBlockName( 716 error::Error GLES2DecoderPassthroughImpl::DoGetActiveUniformBlockName(
509 GLuint program, 717 GLuint program,
510 GLuint index, 718 GLuint index,
511 std::string* name) { 719 std::string* name) {
720 DCHECK(false) << "UNIMPLEMENTED";
512 return error::kNoError; 721 return error::kNoError;
513 } 722 }
514 723
515 error::Error GLES2DecoderPassthroughImpl::DoGetActiveUniformsiv( 724 error::Error GLES2DecoderPassthroughImpl::DoGetActiveUniformsiv(
516 GLuint program, 725 GLuint program,
517 GLsizei count, 726 GLsizei count,
518 const GLuint* indices, 727 const GLuint* indices,
519 GLenum pname, 728 GLenum pname,
520 GLsizei bufSize, 729 GLsizei bufSize,
521 GLsizei* length, 730 GLsizei* length,
522 GLint* params) { 731 GLint* params) {
732 DCHECK(false) << "UNIMPLEMENTED";
523 return error::kNoError; 733 return error::kNoError;
524 } 734 }
525 735
526 error::Error GLES2DecoderPassthroughImpl::DoGetAttachedShaders( 736 error::Error GLES2DecoderPassthroughImpl::DoGetAttachedShaders(
527 GLuint program, 737 GLuint program,
528 GLsizei maxcount, 738 GLsizei maxcount,
529 GLsizei* count, 739 GLsizei* count,
530 GLuint* shaders) { 740 GLuint* shaders) {
741 DCHECK(false) << "UNIMPLEMENTED";
531 return error::kNoError; 742 return error::kNoError;
532 } 743 }
533 744
534 error::Error GLES2DecoderPassthroughImpl::DoGetAttribLocation(GLuint program, 745 error::Error GLES2DecoderPassthroughImpl::DoGetAttribLocation(GLuint program,
535 const char* name, 746 const char* name,
536 GLint* result) { 747 GLint* result) {
748 DCHECK(false) << "UNIMPLEMENTED";
537 return error::kNoError; 749 return error::kNoError;
538 } 750 }
539 751
540 error::Error GLES2DecoderPassthroughImpl::DoGetBooleanv(GLenum pname, 752 error::Error GLES2DecoderPassthroughImpl::DoGetBooleanv(GLenum pname,
541 GLsizei bufsize, 753 GLsizei bufsize,
542 GLsizei* length, 754 GLsizei* length,
543 GLboolean* params) { 755 GLboolean* params) {
756 // TODO: new-style getter
757 glGetBooleanv(pname, params);
758 *length = 1;
544 return error::kNoError; 759 return error::kNoError;
545 } 760 }
546 761
547 error::Error GLES2DecoderPassthroughImpl::DoGetBufferParameteri64v( 762 error::Error GLES2DecoderPassthroughImpl::DoGetBufferParameteri64v(
548 GLenum target, 763 GLenum target,
549 GLenum pname, 764 GLenum pname,
550 GLsizei bufsize, 765 GLsizei bufsize,
551 GLsizei* length, 766 GLsizei* length,
552 GLint64* params) { 767 GLint64* params) {
768 DCHECK(false) << "UNIMPLEMENTED";
769 // TODO: new-style getter
770 // TODO: missing glGetBufferParameteri64v?
771 // glGetBufferParameteri64v(target, pname, params);
Zhenyao Mo 2016/09/09 21:22:11 command buffer is 32bit, so unnecessary.
Geoff Lang 2016/09/12 14:21:29 Ok, I'll have to come back to this one, may requir
772 *length = 1;
553 return error::kNoError; 773 return error::kNoError;
554 } 774 }
555 775
556 error::Error GLES2DecoderPassthroughImpl::DoGetBufferParameteriv( 776 error::Error GLES2DecoderPassthroughImpl::DoGetBufferParameteriv(
557 GLenum target, 777 GLenum target,
558 GLenum pname, 778 GLenum pname,
559 GLsizei bufsize, 779 GLsizei bufsize,
560 GLsizei* length, 780 GLsizei* length,
561 GLint* params) { 781 GLint* params) {
782 // TODO: new-style getter
783 glGetBufferParameteriv(target, pname, params);
784 *length = 1;
562 return error::kNoError; 785 return error::kNoError;
563 } 786 }
564 787
565 error::Error GLES2DecoderPassthroughImpl::DoGetError(uint32_t* result) { 788 error::Error GLES2DecoderPassthroughImpl::DoGetError(uint32_t* result) {
789 *result = glGetError();
566 return error::kNoError; 790 return error::kNoError;
567 } 791 }
568 792
569 error::Error GLES2DecoderPassthroughImpl::DoGetFloatv(GLenum pname, 793 error::Error GLES2DecoderPassthroughImpl::DoGetFloatv(GLenum pname,
570 GLsizei bufsize, 794 GLsizei bufsize,
571 GLsizei* length, 795 GLsizei* length,
572 GLfloat* params) { 796 GLfloat* params) {
797 // TODO: new-style getter
798 glGetFloatv(pname, params);
799 *length = 1;
573 return error::kNoError; 800 return error::kNoError;
574 } 801 }
575 802
576 error::Error GLES2DecoderPassthroughImpl::DoGetFragDataLocation( 803 error::Error GLES2DecoderPassthroughImpl::DoGetFragDataLocation(
577 GLuint program, 804 GLuint program,
578 const char* name, 805 const char* name,
579 GLint* result) { 806 GLint* result) {
807 DCHECK(false) << "UNIMPLEMENTED";
580 return error::kNoError; 808 return error::kNoError;
581 } 809 }
582 810
583 error::Error GLES2DecoderPassthroughImpl::DoGetFramebufferAttachmentParameteriv( 811 error::Error GLES2DecoderPassthroughImpl::DoGetFramebufferAttachmentParameteriv(
584 GLenum target, 812 GLenum target,
585 GLenum attachment, 813 GLenum attachment,
586 GLenum pname, 814 GLenum pname,
587 GLsizei bufsize, 815 GLsizei bufsize,
588 GLsizei* length, 816 GLsizei* length,
589 GLint* params) { 817 GLint* params) {
818 // TODO: new-style getter
819 glGetFramebufferAttachmentParameterivEXT(target, attachment, pname, params);
820 *length = 1;
590 return error::kNoError; 821 return error::kNoError;
591 } 822 }
592 823
593 error::Error GLES2DecoderPassthroughImpl::DoGetInteger64v(GLenum pname, 824 error::Error GLES2DecoderPassthroughImpl::DoGetInteger64v(GLenum pname,
594 GLsizei bufsize, 825 GLsizei bufsize,
595 GLsizei* length, 826 GLsizei* length,
596 GLint64* params) { 827 GLint64* params) {
828 // TODO: new-style getter
829 glGetInteger64v(pname, params);
830 *length = 1;
597 return error::kNoError; 831 return error::kNoError;
598 } 832 }
599 833
600 error::Error GLES2DecoderPassthroughImpl::DoGetIntegeri_v(GLenum pname, 834 error::Error GLES2DecoderPassthroughImpl::DoGetIntegeri_v(GLenum pname,
601 GLuint index, 835 GLuint index,
602 GLsizei bufsize, 836 GLsizei bufsize,
603 GLsizei* length, 837 GLsizei* length,
604 GLint* data) { 838 GLint* data) {
839 // TODO: new-style getter
840 glGetIntegeri_v(pname, index, data);
841 *length = 1;
605 return error::kNoError; 842 return error::kNoError;
606 } 843 }
607 844
608 error::Error GLES2DecoderPassthroughImpl::DoGetInteger64i_v(GLenum pname, 845 error::Error GLES2DecoderPassthroughImpl::DoGetInteger64i_v(GLenum pname,
609 GLuint index, 846 GLuint index,
610 GLsizei bufsize, 847 GLsizei bufsize,
611 GLsizei* length, 848 GLsizei* length,
612 GLint64* data) { 849 GLint64* data) {
850 // TODO: new-style getter
851 glGetInteger64i_v(pname, index, data);
852 *length = 1;
613 return error::kNoError; 853 return error::kNoError;
614 } 854 }
615 855
616 error::Error GLES2DecoderPassthroughImpl::DoGetIntegerv(GLenum pname, 856 error::Error GLES2DecoderPassthroughImpl::DoGetIntegerv(GLenum pname,
617 GLsizei bufsize, 857 GLsizei bufsize,
618 GLsizei* length, 858 GLsizei* length,
619 GLint* params) { 859 GLint* params) {
860 // TODO: new-style getter
861 glGetIntegerv(pname, params);
862 *length = 1;
863 // HACK: WebGL initialization requires this query
864 if (pname == GL_MAX_VIEWPORT_DIMS) {
865 *length = 2;
866 }
620 return error::kNoError; 867 return error::kNoError;
621 } 868 }
622 869
623 error::Error GLES2DecoderPassthroughImpl::DoGetInternalformativ(GLenum target, 870 error::Error GLES2DecoderPassthroughImpl::DoGetInternalformativ(GLenum target,
624 GLenum format, 871 GLenum format,
625 GLenum pname, 872 GLenum pname,
626 GLsizei bufSize, 873 GLsizei bufSize,
627 GLsizei* length, 874 GLsizei* length,
628 GLint* params) { 875 GLint* params) {
876 // TODO: new-style getter
877 glGetInternalformativ(target, format, pname, bufSize, params);
878 *length = 1;
629 return error::kNoError; 879 return error::kNoError;
630 } 880 }
631 881
632 error::Error GLES2DecoderPassthroughImpl::DoGetProgramiv(GLuint program, 882 error::Error GLES2DecoderPassthroughImpl::DoGetProgramiv(GLuint program,
633 GLenum pname, 883 GLenum pname,
634 GLsizei bufsize, 884 GLsizei bufsize,
635 GLsizei* length, 885 GLsizei* length,
636 GLint* params) { 886 GLint* params) {
887 // TODO: new-style getter
888 glGetProgramiv(resources_->program_id_map.GetServiceIDOrReserve(program),
889 pname, params);
890 *length = 1;
637 return error::kNoError; 891 return error::kNoError;
638 } 892 }
639 893
640 error::Error GLES2DecoderPassthroughImpl::DoGetProgramInfoLog( 894 error::Error GLES2DecoderPassthroughImpl::DoGetProgramInfoLog(
641 GLuint program, 895 GLuint program,
642 std::string* infolog) { 896 std::string* infolog) {
897 GLint info_log_len = 0;
898 glGetProgramiv(resources_->program_id_map.GetServiceIDOrReserve(program),
899 GL_INFO_LOG_LENGTH, &info_log_len);
900
901 std::vector<char> buffer(info_log_len, 0);
902 glGetProgramInfoLog(resources_->program_id_map.GetServiceIDOrReserve(program),
903 info_log_len, nullptr, buffer.data());
904 *infolog = std::string(buffer.data());
643 return error::kNoError; 905 return error::kNoError;
644 } 906 }
645 907
646 error::Error GLES2DecoderPassthroughImpl::DoGetRenderbufferParameteriv( 908 error::Error GLES2DecoderPassthroughImpl::DoGetRenderbufferParameteriv(
647 GLenum target, 909 GLenum target,
648 GLenum pname, 910 GLenum pname,
649 GLsizei bufsize, 911 GLsizei bufsize,
650 GLsizei* length, 912 GLsizei* length,
651 GLint* params) { 913 GLint* params) {
914 DCHECK(false) << "UNIMPLEMENTED";
652 return error::kNoError; 915 return error::kNoError;
653 } 916 }
654 917
655 error::Error GLES2DecoderPassthroughImpl::DoGetSamplerParameterfv( 918 error::Error GLES2DecoderPassthroughImpl::DoGetSamplerParameterfv(
656 GLuint sampler, 919 GLuint sampler,
657 GLenum pname, 920 GLenum pname,
658 GLsizei bufsize, 921 GLsizei bufsize,
659 GLsizei* length, 922 GLsizei* length,
660 GLfloat* params) { 923 GLfloat* params) {
924 // TODO: new-style getter
925 glGetSamplerParameterfv(
926 resources_->sampler_id_map.GetServiceIDOrReserve(sampler), pname, params);
927 *length = 1;
661 return error::kNoError; 928 return error::kNoError;
662 } 929 }
663 930
664 error::Error GLES2DecoderPassthroughImpl::DoGetSamplerParameteriv( 931 error::Error GLES2DecoderPassthroughImpl::DoGetSamplerParameteriv(
665 GLuint sampler, 932 GLuint sampler,
666 GLenum pname, 933 GLenum pname,
667 GLsizei bufsize, 934 GLsizei bufsize,
668 GLsizei* length, 935 GLsizei* length,
669 GLint* params) { 936 GLint* params) {
937 DCHECK(false) << "UNIMPLEMENTED";
938 // TODO: new-style getter
939 // glGetRenderbufferParameterivEXT(target, pname, params);
940 *length = 1;
670 return error::kNoError; 941 return error::kNoError;
671 } 942 }
672 943
673 error::Error GLES2DecoderPassthroughImpl::DoGetShaderiv(GLuint shader, 944 error::Error GLES2DecoderPassthroughImpl::DoGetShaderiv(GLuint shader,
674 GLenum pname, 945 GLenum pname,
675 GLsizei bufsize, 946 GLsizei bufsize,
676 GLsizei* length, 947 GLsizei* length,
677 GLint* params) { 948 GLint* params) {
949 // TODO: new-style getter
950 glGetShaderiv(resources_->shader_id_map.GetServiceIDOrReserve(shader), pname,
951 params);
952 *length = 1;
678 return error::kNoError; 953 return error::kNoError;
679 } 954 }
680 955
681 error::Error GLES2DecoderPassthroughImpl::DoGetShaderInfoLog( 956 error::Error GLES2DecoderPassthroughImpl::DoGetShaderInfoLog(
682 GLuint shader, 957 GLuint shader,
683 std::string* infolog) { 958 std::string* infolog) {
959 GLuint service_id = resources_->shader_id_map.GetServiceIDOrReserve(shader);
960 GLint info_log_len = 0;
961 glGetShaderiv(service_id, GL_INFO_LOG_LENGTH, &info_log_len);
962 std::vector<char> buffer(info_log_len, 0);
963 glGetShaderInfoLog(service_id, info_log_len, nullptr, buffer.data());
964 *infolog = std::string(buffer.data());
684 return error::kNoError; 965 return error::kNoError;
685 } 966 }
686 967
687 error::Error GLES2DecoderPassthroughImpl::DoGetShaderPrecisionFormat( 968 error::Error GLES2DecoderPassthroughImpl::DoGetShaderPrecisionFormat(
688 GLenum shadertype, 969 GLenum shadertype,
689 GLenum precisiontype, 970 GLenum precisiontype,
690 GLint* range, 971 GLint* range,
691 GLint* precision) { 972 GLint* precision) {
973 glGetShaderPrecisionFormat(shadertype, precisiontype, range, precision);
692 return error::kNoError; 974 return error::kNoError;
693 } 975 }
694 976
695 error::Error GLES2DecoderPassthroughImpl::DoGetShaderSource( 977 error::Error GLES2DecoderPassthroughImpl::DoGetShaderSource(
696 GLuint shader, 978 GLuint shader,
697 std::string* source) { 979 std::string* source) {
980 DCHECK(false) << "UNIMPLEMENTED";
698 return error::kNoError; 981 return error::kNoError;
699 } 982 }
700 983
701 error::Error GLES2DecoderPassthroughImpl::DoGetString(GLenum name, 984 error::Error GLES2DecoderPassthroughImpl::DoGetString(GLenum name,
702 const char** result) { 985 const char** result) {
986 // TODO: Append additional CHROMIUM extension strings?
987 *result = reinterpret_cast<const char*>(glGetString(name));
703 return error::kNoError; 988 return error::kNoError;
704 } 989 }
705 990
706 error::Error GLES2DecoderPassthroughImpl::DoGetSynciv(GLuint sync, 991 error::Error GLES2DecoderPassthroughImpl::DoGetSynciv(GLuint sync,
707 GLenum pname, 992 GLenum pname,
708 GLsizei bufsize, 993 GLsizei bufsize,
709 GLsizei* length, 994 GLsizei* length,
710 GLint* values) { 995 GLint* values) {
996 glGetSynciv(reinterpret_cast<GLsync>(
997 resources_->sync_id_map.GetServiceIDOrReserve(sync)),
998 pname, bufsize, length, values);
711 return error::kNoError; 999 return error::kNoError;
712 } 1000 }
713 1001
714 error::Error GLES2DecoderPassthroughImpl::DoGetTexParameterfv(GLenum target, 1002 error::Error GLES2DecoderPassthroughImpl::DoGetTexParameterfv(GLenum target,
715 GLenum pname, 1003 GLenum pname,
716 GLsizei bufsize, 1004 GLsizei bufsize,
717 GLsizei* length, 1005 GLsizei* length,
718 GLfloat* params) { 1006 GLfloat* params) {
1007 // TODO: new-style getter
1008 glGetTexParameterfv(target, pname, params);
1009 *length = 1;
719 return error::kNoError; 1010 return error::kNoError;
720 } 1011 }
721 1012
722 error::Error GLES2DecoderPassthroughImpl::DoGetTexParameteriv(GLenum target, 1013 error::Error GLES2DecoderPassthroughImpl::DoGetTexParameteriv(GLenum target,
723 GLenum pname, 1014 GLenum pname,
724 GLsizei bufsize, 1015 GLsizei bufsize,
725 GLsizei* length, 1016 GLsizei* length,
726 GLint* params) { 1017 GLint* params) {
1018 // TODO: new-style getter
1019 glGetTexParameteriv(target, pname, params);
1020 *length = 1;
727 return error::kNoError; 1021 return error::kNoError;
728 } 1022 }
729 1023
730 error::Error GLES2DecoderPassthroughImpl::DoGetTransformFeedbackVarying( 1024 error::Error GLES2DecoderPassthroughImpl::DoGetTransformFeedbackVarying(
731 GLuint program, 1025 GLuint program,
732 GLuint index, 1026 GLuint index,
733 GLsizei* size, 1027 GLsizei* size,
734 GLenum* type, 1028 GLenum* type,
735 std::string* name) { 1029 std::string* name) {
1030 DCHECK(false) << "UNIMPLEMENTED";
736 return error::kNoError; 1031 return error::kNoError;
737 } 1032 }
738 1033
739 error::Error GLES2DecoderPassthroughImpl::DoGetUniformBlockIndex( 1034 error::Error GLES2DecoderPassthroughImpl::DoGetUniformBlockIndex(
740 GLuint program, 1035 GLuint program,
741 const char* name, 1036 const char* name,
742 GLint* index) { 1037 GLint* index) {
1038 DCHECK(false) << "UNIMPLEMENTED";
743 return error::kNoError; 1039 return error::kNoError;
744 } 1040 }
745 1041
746 error::Error GLES2DecoderPassthroughImpl::DoGetUniformfv(GLuint program, 1042 error::Error GLES2DecoderPassthroughImpl::DoGetUniformfv(GLuint program,
747 GLint location, 1043 GLint location,
748 GLsizei bufsize, 1044 GLsizei bufsize,
749 GLsizei* length, 1045 GLsizei* length,
750 GLfloat* params) { 1046 GLfloat* params) {
1047 // TODO: new-style getter
1048 glGetUniformfv(resources_->program_id_map.GetServiceIDOrReserve(program),
1049 location, params);
1050 *length = 1;
751 return error::kNoError; 1051 return error::kNoError;
752 } 1052 }
753 1053
754 error::Error GLES2DecoderPassthroughImpl::DoGetUniformiv(GLuint program, 1054 error::Error GLES2DecoderPassthroughImpl::DoGetUniformiv(GLuint program,
755 GLint location, 1055 GLint location,
756 GLsizei bufsize, 1056 GLsizei bufsize,
757 GLsizei* length, 1057 GLsizei* length,
758 GLint* params) { 1058 GLint* params) {
1059 // TODO: new-style getter
1060 glGetUniformiv(resources_->program_id_map.GetServiceIDOrReserve(program),
1061 location, params);
1062 *length = 1;
759 return error::kNoError; 1063 return error::kNoError;
760 } 1064 }
761 1065
762 error::Error GLES2DecoderPassthroughImpl::DoGetUniformuiv(GLuint program, 1066 error::Error GLES2DecoderPassthroughImpl::DoGetUniformuiv(GLuint program,
763 GLint location, 1067 GLint location,
764 GLsizei bufsize, 1068 GLsizei bufsize,
765 GLsizei* length, 1069 GLsizei* length,
766 GLuint* params) { 1070 GLuint* params) {
1071 // TODO: new-style getter
1072 glGetUniformuiv(resources_->program_id_map.GetServiceIDOrReserve(program),
1073 location, params);
1074 *length = 1;
767 return error::kNoError; 1075 return error::kNoError;
768 } 1076 }
769 1077
770 error::Error GLES2DecoderPassthroughImpl::DoGetUniformIndices( 1078 error::Error GLES2DecoderPassthroughImpl::DoGetUniformIndices(
771 GLuint program, 1079 GLuint program,
772 GLsizei count, 1080 GLsizei count,
773 const char* const* names, 1081 const char* const* names,
774 GLsizei bufSize, 1082 GLsizei bufSize,
775 GLsizei* length, 1083 GLsizei* length,
776 GLuint* indices) { 1084 GLuint* indices) {
1085 DCHECK(false) << "UNIMPLEMENTED";
777 return error::kNoError; 1086 return error::kNoError;
778 } 1087 }
779 1088
780 error::Error GLES2DecoderPassthroughImpl::DoGetUniformLocation( 1089 error::Error GLES2DecoderPassthroughImpl::DoGetUniformLocation(
781 GLuint program, 1090 GLuint program,
782 const char* name, 1091 const char* name,
783 GLint* location) { 1092 GLint* location) {
1093 *location = glGetUniformLocation(
1094 resources_->program_id_map.GetServiceIDOrReserve(program), name);
784 return error::kNoError; 1095 return error::kNoError;
785 } 1096 }
786 1097
787 error::Error GLES2DecoderPassthroughImpl::DoGetVertexAttribfv(GLuint index, 1098 error::Error GLES2DecoderPassthroughImpl::DoGetVertexAttribfv(GLuint index,
788 GLenum pname, 1099 GLenum pname,
789 GLsizei bufsize, 1100 GLsizei bufsize,
790 GLsizei* length, 1101 GLsizei* length,
791 GLfloat* params) { 1102 GLfloat* params) {
1103 DCHECK(false) << "UNIMPLEMENTED";
792 return error::kNoError; 1104 return error::kNoError;
793 } 1105 }
794 1106
795 error::Error GLES2DecoderPassthroughImpl::DoGetVertexAttribiv(GLuint index, 1107 error::Error GLES2DecoderPassthroughImpl::DoGetVertexAttribiv(GLuint index,
796 GLenum pname, 1108 GLenum pname,
797 GLsizei bufsize, 1109 GLsizei bufsize,
798 GLsizei* length, 1110 GLsizei* length,
799 GLint* params) { 1111 GLint* params) {
1112 DCHECK(false) << "UNIMPLEMENTED";
800 return error::kNoError; 1113 return error::kNoError;
801 } 1114 }
802 1115
803 error::Error GLES2DecoderPassthroughImpl::DoGetVertexAttribIiv(GLuint index, 1116 error::Error GLES2DecoderPassthroughImpl::DoGetVertexAttribIiv(GLuint index,
804 GLenum pname, 1117 GLenum pname,
805 GLsizei bufsize, 1118 GLsizei bufsize,
806 GLsizei* length, 1119 GLsizei* length,
807 GLint* params) { 1120 GLint* params) {
1121 DCHECK(false) << "UNIMPLEMENTED";
808 return error::kNoError; 1122 return error::kNoError;
809 } 1123 }
810 1124
811 error::Error GLES2DecoderPassthroughImpl::DoGetVertexAttribIuiv( 1125 error::Error GLES2DecoderPassthroughImpl::DoGetVertexAttribIuiv(
812 GLuint index, 1126 GLuint index,
813 GLenum pname, 1127 GLenum pname,
814 GLsizei bufsize, 1128 GLsizei bufsize,
815 GLsizei* length, 1129 GLsizei* length,
816 GLuint* params) { 1130 GLuint* params) {
1131 DCHECK(false) << "UNIMPLEMENTED";
817 return error::kNoError; 1132 return error::kNoError;
818 } 1133 }
819 1134
820 error::Error GLES2DecoderPassthroughImpl::DoGetVertexAttribPointerv( 1135 error::Error GLES2DecoderPassthroughImpl::DoGetVertexAttribPointerv(
821 GLuint index, 1136 GLuint index,
822 GLenum pname, 1137 GLenum pname,
823 GLsizei bufsize, 1138 GLsizei bufsize,
824 GLsizei* length, 1139 GLsizei* length,
825 GLuint* pointer) { 1140 GLuint* pointer) {
1141 DCHECK(false) << "UNIMPLEMENTED";
826 return error::kNoError; 1142 return error::kNoError;
827 } 1143 }
828 1144
829 error::Error GLES2DecoderPassthroughImpl::DoHint(GLenum target, GLenum mode) { 1145 error::Error GLES2DecoderPassthroughImpl::DoHint(GLenum target, GLenum mode) {
1146 glHint(target, mode);
830 return error::kNoError; 1147 return error::kNoError;
831 } 1148 }
832 1149
833 error::Error GLES2DecoderPassthroughImpl::DoInvalidateFramebuffer( 1150 error::Error GLES2DecoderPassthroughImpl::DoInvalidateFramebuffer(
834 GLenum target, 1151 GLenum target,
835 GLsizei count, 1152 GLsizei count,
836 const volatile GLenum* attachments) { 1153 const volatile GLenum* attachments) {
1154 std::vector<GLenum> attachments_copy(attachments, attachments + count);
1155 glInvalidateFramebuffer(target, count, attachments_copy.data());
837 return error::kNoError; 1156 return error::kNoError;
838 } 1157 }
839 1158
840 error::Error GLES2DecoderPassthroughImpl::DoInvalidateSubFramebuffer( 1159 error::Error GLES2DecoderPassthroughImpl::DoInvalidateSubFramebuffer(
841 GLenum target, 1160 GLenum target,
842 GLsizei count, 1161 GLsizei count,
843 const volatile GLenum* attachments, 1162 const volatile GLenum* attachments,
844 GLint x, 1163 GLint x,
845 GLint y, 1164 GLint y,
846 GLsizei width, 1165 GLsizei width,
847 GLsizei height) { 1166 GLsizei height) {
1167 std::vector<GLenum> attachments_copy(attachments, attachments + count);
1168 glInvalidateSubFramebuffer(target, count, attachments_copy.data(), x, y,
1169 width, height);
848 return error::kNoError; 1170 return error::kNoError;
849 } 1171 }
850 1172
851 error::Error GLES2DecoderPassthroughImpl::DoIsBuffer(GLuint buffer, 1173 error::Error GLES2DecoderPassthroughImpl::DoIsBuffer(GLuint buffer,
852 uint32_t* result) { 1174 uint32_t* result) {
1175 DCHECK(false) << "UNIMPLEMENTED";
1176 *result = glIsBuffer(resources_->buffer_id_map.GetServiceIDOrReserve(buffer));
853 return error::kNoError; 1177 return error::kNoError;
854 } 1178 }
855 1179
856 error::Error GLES2DecoderPassthroughImpl::DoIsEnabled(GLenum cap, 1180 error::Error GLES2DecoderPassthroughImpl::DoIsEnabled(GLenum cap,
857 uint32_t* result) { 1181 uint32_t* result) {
1182 *result = glIsEnabled(cap);
858 return error::kNoError; 1183 return error::kNoError;
859 } 1184 }
860 1185
861 error::Error GLES2DecoderPassthroughImpl::DoIsFramebuffer(GLuint framebuffer, 1186 error::Error GLES2DecoderPassthroughImpl::DoIsFramebuffer(GLuint framebuffer,
862 uint32_t* result) { 1187 uint32_t* result) {
1188 *result = glIsFramebufferEXT(
1189 framebuffer_id_map_.GetServiceIDOrReserve(framebuffer));
863 return error::kNoError; 1190 return error::kNoError;
864 } 1191 }
865 1192
866 error::Error GLES2DecoderPassthroughImpl::DoIsProgram(GLuint program, 1193 error::Error GLES2DecoderPassthroughImpl::DoIsProgram(GLuint program,
867 uint32_t* result) { 1194 uint32_t* result) {
1195 *result =
1196 glIsProgram(resources_->program_id_map.GetServiceIDOrReserve(program));
868 return error::kNoError; 1197 return error::kNoError;
869 } 1198 }
870 1199
871 error::Error GLES2DecoderPassthroughImpl::DoIsRenderbuffer(GLuint renderbuffer, 1200 error::Error GLES2DecoderPassthroughImpl::DoIsRenderbuffer(GLuint renderbuffer,
872 uint32_t* result) { 1201 uint32_t* result) {
1202 DCHECK(false) << "UNIMPLEMENTED";
1203 *result = glIsRenderbufferEXT(
1204 resources_->buffer_id_map.GetServiceIDOrReserve(renderbuffer));
873 return error::kNoError; 1205 return error::kNoError;
874 } 1206 }
875 1207
876 error::Error GLES2DecoderPassthroughImpl::DoIsSampler(GLuint sampler, 1208 error::Error GLES2DecoderPassthroughImpl::DoIsSampler(GLuint sampler,
877 uint32_t* result) { 1209 uint32_t* result) {
1210 *result =
1211 glIsSampler(resources_->sampler_id_map.GetServiceIDOrReserve(sampler));
878 return error::kNoError; 1212 return error::kNoError;
879 } 1213 }
880 1214
881 error::Error GLES2DecoderPassthroughImpl::DoIsShader(GLuint shader, 1215 error::Error GLES2DecoderPassthroughImpl::DoIsShader(GLuint shader,
882 uint32_t* result) { 1216 uint32_t* result) {
1217 *result = glIsShader(resources_->shader_id_map.GetServiceIDOrReserve(shader));
883 return error::kNoError; 1218 return error::kNoError;
884 } 1219 }
885 1220
886 error::Error GLES2DecoderPassthroughImpl::DoIsSync(GLuint sync, 1221 error::Error GLES2DecoderPassthroughImpl::DoIsSync(GLuint sync,
887 uint32_t* result) { 1222 uint32_t* result) {
1223 *result = glIsSync(reinterpret_cast<GLsync>(
1224 resources_->sync_id_map.GetServiceIDOrReserve(sync)));
888 return error::kNoError; 1225 return error::kNoError;
889 } 1226 }
890 1227
891 error::Error GLES2DecoderPassthroughImpl::DoIsTexture(GLuint texture, 1228 error::Error GLES2DecoderPassthroughImpl::DoIsTexture(GLuint texture,
892 uint32_t* result) { 1229 uint32_t* result) {
1230 *result =
1231 glIsTexture(resources_->texture_id_map.GetServiceIDOrReserve(texture));
893 return error::kNoError; 1232 return error::kNoError;
894 } 1233 }
895 1234
896 error::Error GLES2DecoderPassthroughImpl::DoIsTransformFeedback( 1235 error::Error GLES2DecoderPassthroughImpl::DoIsTransformFeedback(
897 GLuint transformfeedback, 1236 GLuint transformfeedback,
898 uint32_t* result) { 1237 uint32_t* result) {
1238 *result = glIsTransformFeedback(
1239 transform_feedback_id_map_.GetServiceIDOrReserve(transformfeedback));
899 return error::kNoError; 1240 return error::kNoError;
900 } 1241 }
901 1242
902 error::Error GLES2DecoderPassthroughImpl::DoLineWidth(GLfloat width) { 1243 error::Error GLES2DecoderPassthroughImpl::DoLineWidth(GLfloat width) {
1244 glLineWidth(width);
903 return error::kNoError; 1245 return error::kNoError;
904 } 1246 }
905 1247
906 error::Error GLES2DecoderPassthroughImpl::DoLinkProgram(GLuint program) { 1248 error::Error GLES2DecoderPassthroughImpl::DoLinkProgram(GLuint program) {
1249 glLinkProgram(resources_->program_id_map.GetServiceIDOrReserve(program));
907 return error::kNoError; 1250 return error::kNoError;
908 } 1251 }
909 1252
910 error::Error GLES2DecoderPassthroughImpl::DoPauseTransformFeedback() { 1253 error::Error GLES2DecoderPassthroughImpl::DoPauseTransformFeedback() {
1254 glPauseTransformFeedback();
911 return error::kNoError; 1255 return error::kNoError;
912 } 1256 }
913 1257
914 error::Error GLES2DecoderPassthroughImpl::DoPixelStorei(GLenum pname, 1258 error::Error GLES2DecoderPassthroughImpl::DoPixelStorei(GLenum pname,
915 GLint param) { 1259 GLint param) {
1260 glPixelStorei(pname, param);
916 return error::kNoError; 1261 return error::kNoError;
917 } 1262 }
918 1263
919 error::Error GLES2DecoderPassthroughImpl::DoPolygonOffset(GLfloat factor, 1264 error::Error GLES2DecoderPassthroughImpl::DoPolygonOffset(GLfloat factor,
920 GLfloat units) { 1265 GLfloat units) {
1266 glPolygonOffset(factor, units);
921 return error::kNoError; 1267 return error::kNoError;
922 } 1268 }
923 1269
924 error::Error GLES2DecoderPassthroughImpl::DoReadBuffer(GLenum src) { 1270 error::Error GLES2DecoderPassthroughImpl::DoReadBuffer(GLenum src) {
1271 glReadBuffer(src);
925 return error::kNoError; 1272 return error::kNoError;
926 } 1273 }
927 1274
928 error::Error GLES2DecoderPassthroughImpl::DoReadPixels(GLint x, 1275 error::Error GLES2DecoderPassthroughImpl::DoReadPixels(GLint x,
929 GLint y, 1276 GLint y,
930 GLsizei width, 1277 GLsizei width,
931 GLsizei height, 1278 GLsizei height,
932 GLenum format, 1279 GLenum format,
933 GLenum type, 1280 GLenum type,
934 GLsizei bufsize, 1281 GLsizei bufsize,
935 GLsizei* length, 1282 GLsizei* length,
936 void* pixels) { 1283 void* pixels) {
1284 glReadPixels(x, y, width, height, format, type, pixels);
1285
1286 // HACK: Calculate the length here without taking into account the unpack
1287 // parameters.
1288 // Move into an ANGLE extension.
1289 size_t componentCount = 4;
1290 switch (format) {
1291 case GL_RGBA:
1292 componentCount = 4;
1293 break;
1294 case GL_RGB:
1295 componentCount = 3;
1296 break;
1297 case GL_RG:
1298 componentCount = 2;
1299 break;
1300 case GL_RED:
1301 componentCount = 1;
1302 break;
1303 }
1304 *length = width * height * componentCount * 4;
1305
937 return error::kNoError; 1306 return error::kNoError;
938 } 1307 }
939 1308
940 error::Error GLES2DecoderPassthroughImpl::DoReleaseShaderCompiler() { 1309 error::Error GLES2DecoderPassthroughImpl::DoReleaseShaderCompiler() {
1310 glReleaseShaderCompiler();
941 return error::kNoError; 1311 return error::kNoError;
942 } 1312 }
943 1313
944 error::Error GLES2DecoderPassthroughImpl::DoRenderbufferStorage( 1314 error::Error GLES2DecoderPassthroughImpl::DoRenderbufferStorage(
945 GLenum target, 1315 GLenum target,
946 GLenum internalformat, 1316 GLenum internalformat,
947 GLsizei width, 1317 GLsizei width,
948 GLsizei height) { 1318 GLsizei height) {
1319 glRenderbufferStorageEXT(target, internalformat, width, height);
949 return error::kNoError; 1320 return error::kNoError;
950 } 1321 }
951 1322
952 error::Error GLES2DecoderPassthroughImpl::DoResumeTransformFeedback() { 1323 error::Error GLES2DecoderPassthroughImpl::DoResumeTransformFeedback() {
1324 glResumeTransformFeedback();
953 return error::kNoError; 1325 return error::kNoError;
954 } 1326 }
955 1327
956 error::Error GLES2DecoderPassthroughImpl::DoSampleCoverage(GLclampf value, 1328 error::Error GLES2DecoderPassthroughImpl::DoSampleCoverage(GLclampf value,
957 GLboolean invert) { 1329 GLboolean invert) {
1330 glSampleCoverage(value, invert);
958 return error::kNoError; 1331 return error::kNoError;
959 } 1332 }
960 1333
961 error::Error GLES2DecoderPassthroughImpl::DoSamplerParameterf(GLuint sampler, 1334 error::Error GLES2DecoderPassthroughImpl::DoSamplerParameterf(GLuint sampler,
962 GLenum pname, 1335 GLenum pname,
963 GLfloat param) { 1336 GLfloat param) {
1337 glSamplerParameterf(resources_->sampler_id_map.GetServiceIDOrReserve(sampler),
1338 pname, param);
964 return error::kNoError; 1339 return error::kNoError;
965 } 1340 }
966 1341
967 error::Error GLES2DecoderPassthroughImpl::DoSamplerParameterfv( 1342 error::Error GLES2DecoderPassthroughImpl::DoSamplerParameterfv(
968 GLuint sampler, 1343 GLuint sampler,
969 GLenum pname, 1344 GLenum pname,
970 const volatile GLfloat* params) { 1345 const volatile GLfloat* params) {
1346 // TODO: new-style setter, needs to make only one copy
1347 glSamplerParameterfv(
1348 resources_->sampler_id_map.GetServiceIDOrReserve(sampler), pname,
1349 const_cast<const GLfloat*>(params));
971 return error::kNoError; 1350 return error::kNoError;
972 } 1351 }
973 1352
974 error::Error GLES2DecoderPassthroughImpl::DoSamplerParameteri(GLuint sampler, 1353 error::Error GLES2DecoderPassthroughImpl::DoSamplerParameteri(GLuint sampler,
975 GLenum pname, 1354 GLenum pname,
976 GLint param) { 1355 GLint param) {
1356 glSamplerParameteri(resources_->sampler_id_map.GetServiceIDOrReserve(sampler),
1357 pname, param);
977 return error::kNoError; 1358 return error::kNoError;
978 } 1359 }
979 1360
980 error::Error GLES2DecoderPassthroughImpl::DoSamplerParameteriv( 1361 error::Error GLES2DecoderPassthroughImpl::DoSamplerParameteriv(
981 GLuint sampler, 1362 GLuint sampler,
982 GLenum pname, 1363 GLenum pname,
983 const volatile GLint* params) { 1364 const volatile GLint* params) {
1365 // TODO: new-style setter, needs to make only one copy
1366 glSamplerParameteriv(
1367 resources_->sampler_id_map.GetServiceIDOrReserve(sampler), pname,
1368 const_cast<const GLint*>(params));
984 return error::kNoError; 1369 return error::kNoError;
985 } 1370 }
986 1371
987 error::Error GLES2DecoderPassthroughImpl::DoScissor(GLint x, 1372 error::Error GLES2DecoderPassthroughImpl::DoScissor(GLint x,
988 GLint y, 1373 GLint y,
989 GLsizei width, 1374 GLsizei width,
990 GLsizei height) { 1375 GLsizei height) {
991 glScissor(x, y, width, height); 1376 glScissor(x, y, width, height);
992 return error::kNoError; 1377 return error::kNoError;
993 } 1378 }
994 1379
995 error::Error GLES2DecoderPassthroughImpl::DoShaderBinary(GLsizei n, 1380 error::Error GLES2DecoderPassthroughImpl::DoShaderBinary(GLsizei n,
996 const GLuint* shaders, 1381 const GLuint* shaders,
997 GLenum binaryformat, 1382 GLenum binaryformat,
998 const void* binary, 1383 const void* binary,
999 GLsizei length) { 1384 GLsizei length) {
1385 DCHECK(false) << "UNIMPLEMENTED";
1000 return error::kNoError; 1386 return error::kNoError;
1001 } 1387 }
1002 1388
1003 error::Error GLES2DecoderPassthroughImpl::DoShaderSource(GLuint shader, 1389 error::Error GLES2DecoderPassthroughImpl::DoShaderSource(GLuint shader,
1004 GLsizei count, 1390 GLsizei count,
1005 const char** string, 1391 const char** string,
1006 const GLint* length) { 1392 const GLint* length) {
1393 glShaderSource(resources_->shader_id_map.GetServiceIDOrReserve(shader), count,
1394 string, length);
1007 return error::kNoError; 1395 return error::kNoError;
1008 } 1396 }
1009 1397
1010 error::Error GLES2DecoderPassthroughImpl::DoStencilFunc(GLenum func, 1398 error::Error GLES2DecoderPassthroughImpl::DoStencilFunc(GLenum func,
1011 GLint ref, 1399 GLint ref,
1012 GLuint mask) { 1400 GLuint mask) {
1401 glStencilFunc(func, ref, mask);
1013 return error::kNoError; 1402 return error::kNoError;
1014 } 1403 }
1015 1404
1016 error::Error GLES2DecoderPassthroughImpl::DoStencilFuncSeparate(GLenum face, 1405 error::Error GLES2DecoderPassthroughImpl::DoStencilFuncSeparate(GLenum face,
1017 GLenum func, 1406 GLenum func,
1018 GLint ref, 1407 GLint ref,
1019 GLuint mask) { 1408 GLuint mask) {
1409 glStencilFuncSeparate(face, func, ref, mask);
1020 return error::kNoError; 1410 return error::kNoError;
1021 } 1411 }
1022 1412
1023 error::Error GLES2DecoderPassthroughImpl::DoStencilMask(GLuint mask) { 1413 error::Error GLES2DecoderPassthroughImpl::DoStencilMask(GLuint mask) {
1414 glStencilMask(mask);
1024 return error::kNoError; 1415 return error::kNoError;
1025 } 1416 }
1026 1417
1027 error::Error GLES2DecoderPassthroughImpl::DoStencilMaskSeparate(GLenum face, 1418 error::Error GLES2DecoderPassthroughImpl::DoStencilMaskSeparate(GLenum face,
1028 GLuint mask) { 1419 GLuint mask) {
1420 glStencilMaskSeparate(face, mask);
1029 return error::kNoError; 1421 return error::kNoError;
1030 } 1422 }
1031 1423
1032 error::Error GLES2DecoderPassthroughImpl::DoStencilOp(GLenum fail, 1424 error::Error GLES2DecoderPassthroughImpl::DoStencilOp(GLenum fail,
1033 GLenum zfail, 1425 GLenum zfail,
1034 GLenum zpass) { 1426 GLenum zpass) {
1427 glStencilOp(fail, zfail, zpass);
1035 return error::kNoError; 1428 return error::kNoError;
1036 } 1429 }
1037 1430
1038 error::Error GLES2DecoderPassthroughImpl::DoStencilOpSeparate(GLenum face, 1431 error::Error GLES2DecoderPassthroughImpl::DoStencilOpSeparate(GLenum face,
1039 GLenum fail, 1432 GLenum fail,
1040 GLenum zfail, 1433 GLenum zfail,
1041 GLenum zpass) { 1434 GLenum zpass) {
1435 glStencilOpSeparate(face, fail, zfail, zpass);
1042 return error::kNoError; 1436 return error::kNoError;
1043 } 1437 }
1044 1438
1045 error::Error GLES2DecoderPassthroughImpl::DoTexImage2D(GLenum target, 1439 error::Error GLES2DecoderPassthroughImpl::DoTexImage2D(GLenum target,
1046 GLint level, 1440 GLint level,
1047 GLint internalformat, 1441 GLint internalformat,
1048 GLsizei width, 1442 GLsizei width,
1049 GLsizei height, 1443 GLsizei height,
1050 GLint border, 1444 GLint border,
1051 GLenum format, 1445 GLenum format,
1052 GLenum type, 1446 GLenum type,
1053 GLsizei imagesize, 1447 GLsizei imagesize,
1054 const void* pixels) { 1448 const void* pixels) {
1449 // TODO: validate using imagesize
1450 glTexImage2D(target, level, internalformat, width, height, border, format,
1451 type, pixels);
1055 return error::kNoError; 1452 return error::kNoError;
1056 } 1453 }
1057 1454
1058 error::Error GLES2DecoderPassthroughImpl::DoTexImage3D(GLenum target, 1455 error::Error GLES2DecoderPassthroughImpl::DoTexImage3D(GLenum target,
1059 GLint level, 1456 GLint level,
1060 GLint internalformat, 1457 GLint internalformat,
1061 GLsizei width, 1458 GLsizei width,
1062 GLsizei height, 1459 GLsizei height,
1063 GLsizei depth, 1460 GLsizei depth,
1064 GLint border, 1461 GLint border,
1065 GLenum format, 1462 GLenum format,
1066 GLenum type, 1463 GLenum type,
1067 GLsizei imagesize, 1464 GLsizei imagesize,
1068 const void* pixels) { 1465 const void* pixels) {
1466 // TODO: validate using imagesize
1467 glTexImage3D(target, level, internalformat, width, height, depth, border,
1468 format, type, pixels);
1069 return error::kNoError; 1469 return error::kNoError;
1070 } 1470 }
1071 1471
1072 error::Error GLES2DecoderPassthroughImpl::DoTexParameterf(GLenum target, 1472 error::Error GLES2DecoderPassthroughImpl::DoTexParameterf(GLenum target,
1073 GLenum pname, 1473 GLenum pname,
1074 GLfloat param) { 1474 GLfloat param) {
1475 glTexParameterf(target, pname, param);
1075 return error::kNoError; 1476 return error::kNoError;
1076 } 1477 }
1077 1478
1078 error::Error GLES2DecoderPassthroughImpl::DoTexParameterfv( 1479 error::Error GLES2DecoderPassthroughImpl::DoTexParameterfv(
1079 GLenum target, 1480 GLenum target,
1080 GLenum pname, 1481 GLenum pname,
1081 const volatile GLfloat* params) { 1482 const volatile GLfloat* params) {
1483 // TODO: new-style setter, needs to make only one copy
1484 glTexParameterfv(target, pname, const_cast<const GLfloat*>(params));
1082 return error::kNoError; 1485 return error::kNoError;
1083 } 1486 }
1084 1487
1085 error::Error GLES2DecoderPassthroughImpl::DoTexParameteri(GLenum target, 1488 error::Error GLES2DecoderPassthroughImpl::DoTexParameteri(GLenum target,
1086 GLenum pname, 1489 GLenum pname,
1087 GLint param) { 1490 GLint param) {
1088 glTexParameteri(target, pname, param); 1491 glTexParameteri(target, pname, param);
1089 return error::kNoError; 1492 return error::kNoError;
1090 } 1493 }
1091 1494
1092 error::Error GLES2DecoderPassthroughImpl::DoTexParameteriv( 1495 error::Error GLES2DecoderPassthroughImpl::DoTexParameteriv(
1093 GLenum target, 1496 GLenum target,
1094 GLenum pname, 1497 GLenum pname,
1095 const volatile GLint* params) { 1498 const volatile GLint* params) {
1499 // TODO: new-style setter, needs to make only one copy
1500 glTexParameteriv(target, pname, const_cast<const GLint*>(params));
1096 return error::kNoError; 1501 return error::kNoError;
1097 } 1502 }
1098 1503
1099 error::Error GLES2DecoderPassthroughImpl::DoTexStorage3D(GLenum target, 1504 error::Error GLES2DecoderPassthroughImpl::DoTexStorage3D(GLenum target,
1100 GLsizei levels, 1505 GLsizei levels,
1101 GLenum internalFormat, 1506 GLenum internalFormat,
1102 GLsizei width, 1507 GLsizei width,
1103 GLsizei height, 1508 GLsizei height,
1104 GLsizei depth) { 1509 GLsizei depth) {
1510 glTexStorage3D(target, levels, internalFormat, width, height, depth);
1105 return error::kNoError; 1511 return error::kNoError;
1106 } 1512 }
1107 1513
1108 error::Error GLES2DecoderPassthroughImpl::DoTexSubImage2D(GLenum target, 1514 error::Error GLES2DecoderPassthroughImpl::DoTexSubImage2D(GLenum target,
1109 GLint level, 1515 GLint level,
1110 GLint xoffset, 1516 GLint xoffset,
1111 GLint yoffset, 1517 GLint yoffset,
1112 GLsizei width, 1518 GLsizei width,
1113 GLsizei height, 1519 GLsizei height,
1114 GLenum format, 1520 GLenum format,
1115 GLenum type, 1521 GLenum type,
1116 GLsizei imagesize, 1522 GLsizei imagesize,
1117 const void* pixels) { 1523 const void* pixels) {
1524 // TODO: validate using imagesize
1525 glTexSubImage2D(target, level, xoffset, yoffset, width, height, format, type,
1526 pixels);
1118 return error::kNoError; 1527 return error::kNoError;
1119 } 1528 }
1120 1529
1121 error::Error GLES2DecoderPassthroughImpl::DoTexSubImage3D(GLenum target, 1530 error::Error GLES2DecoderPassthroughImpl::DoTexSubImage3D(GLenum target,
1122 GLint level, 1531 GLint level,
1123 GLint xoffset, 1532 GLint xoffset,
1124 GLint yoffset, 1533 GLint yoffset,
1125 GLint zoffset, 1534 GLint zoffset,
1126 GLsizei width, 1535 GLsizei width,
1127 GLsizei height, 1536 GLsizei height,
1128 GLsizei depth, 1537 GLsizei depth,
1129 GLenum format, 1538 GLenum format,
1130 GLenum type, 1539 GLenum type,
1131 GLsizei imagesize, 1540 GLsizei imagesize,
1132 const void* pixels) { 1541 const void* pixels) {
1542 // TODO: validate using imagesize
1543 glTexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height,
1544 depth, format, type, pixels);
1133 return error::kNoError; 1545 return error::kNoError;
1134 } 1546 }
1135 1547
1136 error::Error GLES2DecoderPassthroughImpl::DoTransformFeedbackVaryings( 1548 error::Error GLES2DecoderPassthroughImpl::DoTransformFeedbackVaryings(
1137 GLuint program, 1549 GLuint program,
1138 GLsizei count, 1550 GLsizei count,
1139 const char** varyings, 1551 const char** varyings,
1140 GLenum buffermode) { 1552 GLenum buffermode) {
1553 glTransformFeedbackVaryings(
1554 resources_->program_id_map.GetServiceIDOrReserve(program), count,
1555 varyings, buffermode);
1141 return error::kNoError; 1556 return error::kNoError;
1142 } 1557 }
1143 1558
1144 error::Error GLES2DecoderPassthroughImpl::DoUniform1f(GLint location, 1559 error::Error GLES2DecoderPassthroughImpl::DoUniform1f(GLint location,
1145 GLfloat x) { 1560 GLfloat x) {
1561 glUniform1f(location, x);
1146 return error::kNoError; 1562 return error::kNoError;
1147 } 1563 }
1148 1564
1149 error::Error GLES2DecoderPassthroughImpl::DoUniform1fv( 1565 error::Error GLES2DecoderPassthroughImpl::DoUniform1fv(
1150 GLint location, 1566 GLint location,
1151 GLsizei count, 1567 GLsizei count,
1152 const volatile GLfloat* v) { 1568 const volatile GLfloat* v) {
1569 glUniform1fv(location, count, const_cast<const GLfloat*>(v));
1153 return error::kNoError; 1570 return error::kNoError;
1154 } 1571 }
1155 1572
1156 error::Error GLES2DecoderPassthroughImpl::DoUniform1i(GLint location, GLint x) { 1573 error::Error GLES2DecoderPassthroughImpl::DoUniform1i(GLint location, GLint x) {
1574 glUniform1i(location, x);
1157 return error::kNoError; 1575 return error::kNoError;
1158 } 1576 }
1159 1577
1160 error::Error GLES2DecoderPassthroughImpl::DoUniform1iv( 1578 error::Error GLES2DecoderPassthroughImpl::DoUniform1iv(
1161 GLint location, 1579 GLint location,
1162 GLsizei count, 1580 GLsizei count,
1163 const volatile GLint* v) { 1581 const volatile GLint* v) {
1582 glUniform1iv(location, count, const_cast<const GLint*>(v));
1164 return error::kNoError; 1583 return error::kNoError;
1165 } 1584 }
1166 1585
1167 error::Error GLES2DecoderPassthroughImpl::DoUniform1ui(GLint location, 1586 error::Error GLES2DecoderPassthroughImpl::DoUniform1ui(GLint location,
1168 GLuint x) { 1587 GLuint x) {
1588 glUniform1ui(location, x);
1169 return error::kNoError; 1589 return error::kNoError;
1170 } 1590 }
1171 1591
1172 error::Error GLES2DecoderPassthroughImpl::DoUniform1uiv( 1592 error::Error GLES2DecoderPassthroughImpl::DoUniform1uiv(
1173 GLint location, 1593 GLint location,
1174 GLsizei count, 1594 GLsizei count,
1175 const volatile GLuint* v) { 1595 const volatile GLuint* v) {
1596 glUniform1uiv(location, count, const_cast<const GLuint*>(v));
1176 return error::kNoError; 1597 return error::kNoError;
1177 } 1598 }
1178 1599
1179 error::Error GLES2DecoderPassthroughImpl::DoUniform2f(GLint location, 1600 error::Error GLES2DecoderPassthroughImpl::DoUniform2f(GLint location,
1180 GLfloat x, 1601 GLfloat x,
1181 GLfloat y) { 1602 GLfloat y) {
1603 glUniform2f(location, x, y);
1182 return error::kNoError; 1604 return error::kNoError;
1183 } 1605 }
1184 1606
1185 error::Error GLES2DecoderPassthroughImpl::DoUniform2fv( 1607 error::Error GLES2DecoderPassthroughImpl::DoUniform2fv(
1186 GLint location, 1608 GLint location,
1187 GLsizei count, 1609 GLsizei count,
1188 const volatile GLfloat* v) { 1610 const volatile GLfloat* v) {
1611 glUniform2fv(location, count, const_cast<const GLfloat*>(v));
1189 return error::kNoError; 1612 return error::kNoError;
1190 } 1613 }
1191 1614
1192 error::Error GLES2DecoderPassthroughImpl::DoUniform2i(GLint location, 1615 error::Error GLES2DecoderPassthroughImpl::DoUniform2i(GLint location,
1193 GLint x, 1616 GLint x,
1194 GLint y) { 1617 GLint y) {
1618 glUniform2i(location, x, y);
1195 return error::kNoError; 1619 return error::kNoError;
1196 } 1620 }
1197 1621
1198 error::Error GLES2DecoderPassthroughImpl::DoUniform2iv( 1622 error::Error GLES2DecoderPassthroughImpl::DoUniform2iv(
1199 GLint location, 1623 GLint location,
1200 GLsizei count, 1624 GLsizei count,
1201 const volatile GLint* v) { 1625 const volatile GLint* v) {
1626 glUniform2iv(location, count, const_cast<const GLint*>(v));
1202 return error::kNoError; 1627 return error::kNoError;
1203 } 1628 }
1204 1629
1205 error::Error GLES2DecoderPassthroughImpl::DoUniform2ui(GLint location, 1630 error::Error GLES2DecoderPassthroughImpl::DoUniform2ui(GLint location,
1206 GLuint x, 1631 GLuint x,
1207 GLuint y) { 1632 GLuint y) {
1633 glUniform2ui(location, x, y);
1208 return error::kNoError; 1634 return error::kNoError;
1209 } 1635 }
1210 1636
1211 error::Error GLES2DecoderPassthroughImpl::DoUniform2uiv( 1637 error::Error GLES2DecoderPassthroughImpl::DoUniform2uiv(
1212 GLint location, 1638 GLint location,
1213 GLsizei count, 1639 GLsizei count,
1214 const volatile GLuint* v) { 1640 const volatile GLuint* v) {
1641 glUniform2uiv(location, count, const_cast<const GLuint*>(v));
1215 return error::kNoError; 1642 return error::kNoError;
1216 } 1643 }
1217 1644
1218 error::Error GLES2DecoderPassthroughImpl::DoUniform3f(GLint location, 1645 error::Error GLES2DecoderPassthroughImpl::DoUniform3f(GLint location,
1219 GLfloat x, 1646 GLfloat x,
1220 GLfloat y, 1647 GLfloat y,
1221 GLfloat z) { 1648 GLfloat z) {
1649 glUniform3f(location, x, y, z);
1222 return error::kNoError; 1650 return error::kNoError;
1223 } 1651 }
1224 1652
1225 error::Error GLES2DecoderPassthroughImpl::DoUniform3fv( 1653 error::Error GLES2DecoderPassthroughImpl::DoUniform3fv(
1226 GLint location, 1654 GLint location,
1227 GLsizei count, 1655 GLsizei count,
1228 const volatile GLfloat* v) { 1656 const volatile GLfloat* v) {
1657 glUniform3fv(location, count, const_cast<const GLfloat*>(v));
1229 return error::kNoError; 1658 return error::kNoError;
1230 } 1659 }
1231 1660
1232 error::Error GLES2DecoderPassthroughImpl::DoUniform3i(GLint location, 1661 error::Error GLES2DecoderPassthroughImpl::DoUniform3i(GLint location,
1233 GLint x, 1662 GLint x,
1234 GLint y, 1663 GLint y,
1235 GLint z) { 1664 GLint z) {
1665 glUniform3i(location, x, y, z);
1236 return error::kNoError; 1666 return error::kNoError;
1237 } 1667 }
1238 1668
1239 error::Error GLES2DecoderPassthroughImpl::DoUniform3iv( 1669 error::Error GLES2DecoderPassthroughImpl::DoUniform3iv(
1240 GLint location, 1670 GLint location,
1241 GLsizei count, 1671 GLsizei count,
1242 const volatile GLint* v) { 1672 const volatile GLint* v) {
1673 glUniform3iv(location, count, const_cast<const GLint*>(v));
1243 return error::kNoError; 1674 return error::kNoError;
1244 } 1675 }
1245 1676
1246 error::Error GLES2DecoderPassthroughImpl::DoUniform3ui(GLint location, 1677 error::Error GLES2DecoderPassthroughImpl::DoUniform3ui(GLint location,
1247 GLuint x, 1678 GLuint x,
1248 GLuint y, 1679 GLuint y,
1249 GLuint z) { 1680 GLuint z) {
1681 glUniform3ui(location, x, y, z);
1250 return error::kNoError; 1682 return error::kNoError;
1251 } 1683 }
1252 1684
1253 error::Error GLES2DecoderPassthroughImpl::DoUniform3uiv( 1685 error::Error GLES2DecoderPassthroughImpl::DoUniform3uiv(
1254 GLint location, 1686 GLint location,
1255 GLsizei count, 1687 GLsizei count,
1256 const volatile GLuint* v) { 1688 const volatile GLuint* v) {
1689 glUniform3uiv(location, count, const_cast<const GLuint*>(v));
1257 return error::kNoError; 1690 return error::kNoError;
1258 } 1691 }
1259 1692
1260 error::Error GLES2DecoderPassthroughImpl::DoUniform4f(GLint location, 1693 error::Error GLES2DecoderPassthroughImpl::DoUniform4f(GLint location,
1261 GLfloat x, 1694 GLfloat x,
1262 GLfloat y, 1695 GLfloat y,
1263 GLfloat z, 1696 GLfloat z,
1264 GLfloat w) { 1697 GLfloat w) {
1698 glUniform4f(location, x, y, z, w);
1265 return error::kNoError; 1699 return error::kNoError;
1266 } 1700 }
1267 1701
1268 error::Error GLES2DecoderPassthroughImpl::DoUniform4fv( 1702 error::Error GLES2DecoderPassthroughImpl::DoUniform4fv(
1269 GLint location, 1703 GLint location,
1270 GLsizei count, 1704 GLsizei count,
1271 const volatile GLfloat* v) { 1705 const volatile GLfloat* v) {
1706 glUniform4fv(location, count, const_cast<const GLfloat*>(v));
1272 return error::kNoError; 1707 return error::kNoError;
1273 } 1708 }
1274 1709
1275 error::Error GLES2DecoderPassthroughImpl::DoUniform4i(GLint location, 1710 error::Error GLES2DecoderPassthroughImpl::DoUniform4i(GLint location,
1276 GLint x, 1711 GLint x,
1277 GLint y, 1712 GLint y,
1278 GLint z, 1713 GLint z,
1279 GLint w) { 1714 GLint w) {
1715 glUniform4i(location, x, y, z, w);
1280 return error::kNoError; 1716 return error::kNoError;
1281 } 1717 }
1282 1718
1283 error::Error GLES2DecoderPassthroughImpl::DoUniform4iv( 1719 error::Error GLES2DecoderPassthroughImpl::DoUniform4iv(
1284 GLint location, 1720 GLint location,
1285 GLsizei count, 1721 GLsizei count,
1286 const volatile GLint* v) { 1722 const volatile GLint* v) {
1723 glUniform4iv(location, count, const_cast<const GLint*>(v));
1287 return error::kNoError; 1724 return error::kNoError;
1288 } 1725 }
1289 1726
1290 error::Error GLES2DecoderPassthroughImpl::DoUniform4ui(GLint location, 1727 error::Error GLES2DecoderPassthroughImpl::DoUniform4ui(GLint location,
1291 GLuint x, 1728 GLuint x,
1292 GLuint y, 1729 GLuint y,
1293 GLuint z, 1730 GLuint z,
1294 GLuint w) { 1731 GLuint w) {
1732 glUniform4ui(location, x, y, z, w);
1295 return error::kNoError; 1733 return error::kNoError;
1296 } 1734 }
1297 1735
1298 error::Error GLES2DecoderPassthroughImpl::DoUniform4uiv( 1736 error::Error GLES2DecoderPassthroughImpl::DoUniform4uiv(
1299 GLint location, 1737 GLint location,
1300 GLsizei count, 1738 GLsizei count,
1301 const volatile GLuint* v) { 1739 const volatile GLuint* v) {
1740 glUniform4uiv(location, count, const_cast<const GLuint*>(v));
1302 return error::kNoError; 1741 return error::kNoError;
1303 } 1742 }
1304 1743
1305 error::Error GLES2DecoderPassthroughImpl::DoUniformBlockBinding( 1744 error::Error GLES2DecoderPassthroughImpl::DoUniformBlockBinding(
1306 GLuint program, 1745 GLuint program,
1307 GLuint index, 1746 GLuint index,
1308 GLuint binding) { 1747 GLuint binding) {
1748 glUniformBlockBinding(
1749 resources_->program_id_map.GetServiceIDOrReserve(program), index,
1750 binding);
1309 return error::kNoError; 1751 return error::kNoError;
1310 } 1752 }
1311 1753
1312 error::Error GLES2DecoderPassthroughImpl::DoUniformMatrix2fv( 1754 error::Error GLES2DecoderPassthroughImpl::DoUniformMatrix2fv(
1313 GLint location, 1755 GLint location,
1314 GLsizei count, 1756 GLsizei count,
1315 GLboolean transpose, 1757 GLboolean transpose,
1316 const volatile GLfloat* value) { 1758 const volatile GLfloat* value) {
1759 glUniformMatrix2fv(location, count, transpose,
1760 const_cast<const GLfloat*>(value));
1317 return error::kNoError; 1761 return error::kNoError;
1318 } 1762 }
1319 1763
1320 error::Error GLES2DecoderPassthroughImpl::DoUniformMatrix2x3fv( 1764 error::Error GLES2DecoderPassthroughImpl::DoUniformMatrix2x3fv(
1321 GLint location, 1765 GLint location,
1322 GLsizei count, 1766 GLsizei count,
1323 GLboolean transpose, 1767 GLboolean transpose,
1324 const volatile GLfloat* value) { 1768 const volatile GLfloat* value) {
1769 glUniformMatrix2x3fv(location, count, transpose,
1770 const_cast<const GLfloat*>(value));
1325 return error::kNoError; 1771 return error::kNoError;
1326 } 1772 }
1327 1773
1328 error::Error GLES2DecoderPassthroughImpl::DoUniformMatrix2x4fv( 1774 error::Error GLES2DecoderPassthroughImpl::DoUniformMatrix2x4fv(
1329 GLint location, 1775 GLint location,
1330 GLsizei count, 1776 GLsizei count,
1331 GLboolean transpose, 1777 GLboolean transpose,
1332 const volatile GLfloat* value) { 1778 const volatile GLfloat* value) {
1779 glUniformMatrix2x4fv(location, count, transpose,
1780 const_cast<const GLfloat*>(value));
1333 return error::kNoError; 1781 return error::kNoError;
1334 } 1782 }
1335 1783
1336 error::Error GLES2DecoderPassthroughImpl::DoUniformMatrix3fv( 1784 error::Error GLES2DecoderPassthroughImpl::DoUniformMatrix3fv(
1337 GLint location, 1785 GLint location,
1338 GLsizei count, 1786 GLsizei count,
1339 GLboolean transpose, 1787 GLboolean transpose,
1340 const volatile GLfloat* value) { 1788 const volatile GLfloat* value) {
1789 glUniformMatrix3fv(location, count, transpose,
1790 const_cast<const GLfloat*>(value));
1341 return error::kNoError; 1791 return error::kNoError;
1342 } 1792 }
1343 1793
1344 error::Error GLES2DecoderPassthroughImpl::DoUniformMatrix3x2fv( 1794 error::Error GLES2DecoderPassthroughImpl::DoUniformMatrix3x2fv(
1345 GLint location, 1795 GLint location,
1346 GLsizei count, 1796 GLsizei count,
1347 GLboolean transpose, 1797 GLboolean transpose,
1348 const volatile GLfloat* value) { 1798 const volatile GLfloat* value) {
1799 glUniformMatrix3x2fv(location, count, transpose,
1800 const_cast<const GLfloat*>(value));
1349 return error::kNoError; 1801 return error::kNoError;
1350 } 1802 }
1351 1803
1352 error::Error GLES2DecoderPassthroughImpl::DoUniformMatrix3x4fv( 1804 error::Error GLES2DecoderPassthroughImpl::DoUniformMatrix3x4fv(
1353 GLint location, 1805 GLint location,
1354 GLsizei count, 1806 GLsizei count,
1355 GLboolean transpose, 1807 GLboolean transpose,
1356 const volatile GLfloat* value) { 1808 const volatile GLfloat* value) {
1809 glUniformMatrix3x4fv(location, count, transpose,
1810 const_cast<const GLfloat*>(value));
1357 return error::kNoError; 1811 return error::kNoError;
1358 } 1812 }
1359 1813
1360 error::Error GLES2DecoderPassthroughImpl::DoUniformMatrix4fv( 1814 error::Error GLES2DecoderPassthroughImpl::DoUniformMatrix4fv(
1361 GLint location, 1815 GLint location,
1362 GLsizei count, 1816 GLsizei count,
1363 GLboolean transpose, 1817 GLboolean transpose,
1364 const volatile GLfloat* value) { 1818 const volatile GLfloat* value) {
1819 glUniformMatrix4fv(location, count, transpose,
1820 const_cast<const GLfloat*>(value));
1365 return error::kNoError; 1821 return error::kNoError;
1366 } 1822 }
1367 1823
1368 error::Error GLES2DecoderPassthroughImpl::DoUniformMatrix4x2fv( 1824 error::Error GLES2DecoderPassthroughImpl::DoUniformMatrix4x2fv(
1369 GLint location, 1825 GLint location,
1370 GLsizei count, 1826 GLsizei count,
1371 GLboolean transpose, 1827 GLboolean transpose,
1372 const volatile GLfloat* value) { 1828 const volatile GLfloat* value) {
1829 glUniformMatrix4x2fv(location, count, transpose,
1830 const_cast<const GLfloat*>(value));
1373 return error::kNoError; 1831 return error::kNoError;
1374 } 1832 }
1375 1833
1376 error::Error GLES2DecoderPassthroughImpl::DoUniformMatrix4x3fv( 1834 error::Error GLES2DecoderPassthroughImpl::DoUniformMatrix4x3fv(
1377 GLint location, 1835 GLint location,
1378 GLsizei count, 1836 GLsizei count,
1379 GLboolean transpose, 1837 GLboolean transpose,
1380 const volatile GLfloat* value) { 1838 const volatile GLfloat* value) {
1839 glUniformMatrix4x3fv(location, count, transpose,
1840 const_cast<const GLfloat*>(value));
1381 return error::kNoError; 1841 return error::kNoError;
1382 } 1842 }
1383 1843
1384 error::Error GLES2DecoderPassthroughImpl::DoUseProgram(GLuint program) { 1844 error::Error GLES2DecoderPassthroughImpl::DoUseProgram(GLuint program) {
1845 glUseProgram(resources_->program_id_map.GetServiceIDOrReserve(program));
1385 return error::kNoError; 1846 return error::kNoError;
1386 } 1847 }
1387 1848
1388 error::Error GLES2DecoderPassthroughImpl::DoValidateProgram(GLuint program) { 1849 error::Error GLES2DecoderPassthroughImpl::DoValidateProgram(GLuint program) {
1850 glValidateProgram(resources_->program_id_map.GetServiceIDOrReserve(program));
1389 return error::kNoError; 1851 return error::kNoError;
1390 } 1852 }
1391 1853
1392 error::Error GLES2DecoderPassthroughImpl::DoVertexAttrib1f(GLuint indx, 1854 error::Error GLES2DecoderPassthroughImpl::DoVertexAttrib1f(GLuint indx,
1393 GLfloat x) { 1855 GLfloat x) {
1856 glVertexAttrib1f(indx, x);
1394 return error::kNoError; 1857 return error::kNoError;
1395 } 1858 }
1396 1859
1397 error::Error GLES2DecoderPassthroughImpl::DoVertexAttrib1fv( 1860 error::Error GLES2DecoderPassthroughImpl::DoVertexAttrib1fv(
1398 GLuint indx, 1861 GLuint indx,
1399 const volatile GLfloat* values) { 1862 const volatile GLfloat* values) {
1863 glVertexAttrib1fv(indx, const_cast<const GLfloat*>(values));
1400 return error::kNoError; 1864 return error::kNoError;
1401 } 1865 }
1402 1866
1403 error::Error GLES2DecoderPassthroughImpl::DoVertexAttrib2f(GLuint indx, 1867 error::Error GLES2DecoderPassthroughImpl::DoVertexAttrib2f(GLuint indx,
1404 GLfloat x, 1868 GLfloat x,
1405 GLfloat y) { 1869 GLfloat y) {
1870 glVertexAttrib2f(indx, x, y);
1406 return error::kNoError; 1871 return error::kNoError;
1407 } 1872 }
1408 1873
1409 error::Error GLES2DecoderPassthroughImpl::DoVertexAttrib2fv( 1874 error::Error GLES2DecoderPassthroughImpl::DoVertexAttrib2fv(
1410 GLuint indx, 1875 GLuint indx,
1411 const volatile GLfloat* values) { 1876 const volatile GLfloat* values) {
1877 glVertexAttrib2fv(indx, const_cast<const GLfloat*>(values));
1412 return error::kNoError; 1878 return error::kNoError;
1413 } 1879 }
1414 1880
1415 error::Error GLES2DecoderPassthroughImpl::DoVertexAttrib3f(GLuint indx, 1881 error::Error GLES2DecoderPassthroughImpl::DoVertexAttrib3f(GLuint indx,
1416 GLfloat x, 1882 GLfloat x,
1417 GLfloat y, 1883 GLfloat y,
1418 GLfloat z) { 1884 GLfloat z) {
1885 glVertexAttrib3f(indx, x, y, z);
1419 return error::kNoError; 1886 return error::kNoError;
1420 } 1887 }
1421 1888
1422 error::Error GLES2DecoderPassthroughImpl::DoVertexAttrib3fv( 1889 error::Error GLES2DecoderPassthroughImpl::DoVertexAttrib3fv(
1423 GLuint indx, 1890 GLuint indx,
1424 const volatile GLfloat* values) { 1891 const volatile GLfloat* values) {
1892 glVertexAttrib3fv(indx, const_cast<const GLfloat*>(values));
1425 return error::kNoError; 1893 return error::kNoError;
1426 } 1894 }
1427 1895
1428 error::Error GLES2DecoderPassthroughImpl::DoVertexAttrib4f(GLuint indx, 1896 error::Error GLES2DecoderPassthroughImpl::DoVertexAttrib4f(GLuint indx,
1429 GLfloat x, 1897 GLfloat x,
1430 GLfloat y, 1898 GLfloat y,
1431 GLfloat z, 1899 GLfloat z,
1432 GLfloat w) { 1900 GLfloat w) {
1901 glVertexAttrib4f(indx, x, y, z, w);
1433 return error::kNoError; 1902 return error::kNoError;
1434 } 1903 }
1435 1904
1436 error::Error GLES2DecoderPassthroughImpl::DoVertexAttrib4fv( 1905 error::Error GLES2DecoderPassthroughImpl::DoVertexAttrib4fv(
1437 GLuint indx, 1906 GLuint indx,
1438 const volatile GLfloat* values) { 1907 const volatile GLfloat* values) {
1908 glVertexAttrib4fv(indx, const_cast<const GLfloat*>(values));
1439 return error::kNoError; 1909 return error::kNoError;
1440 } 1910 }
1441 1911
1442 error::Error GLES2DecoderPassthroughImpl::DoVertexAttribI4i(GLuint indx, 1912 error::Error GLES2DecoderPassthroughImpl::DoVertexAttribI4i(GLuint indx,
1443 GLint x, 1913 GLint x,
1444 GLint y, 1914 GLint y,
1445 GLint z, 1915 GLint z,
1446 GLint w) { 1916 GLint w) {
1917 glVertexAttribI4i(indx, x, y, z, w);
1447 return error::kNoError; 1918 return error::kNoError;
1448 } 1919 }
1449 1920
1450 error::Error GLES2DecoderPassthroughImpl::DoVertexAttribI4iv( 1921 error::Error GLES2DecoderPassthroughImpl::DoVertexAttribI4iv(
1451 GLuint indx, 1922 GLuint indx,
1452 const volatile GLint* values) { 1923 const volatile GLint* values) {
1924 glVertexAttribI4iv(indx, const_cast<const GLint*>(values));
1453 return error::kNoError; 1925 return error::kNoError;
1454 } 1926 }
1455 1927
1456 error::Error GLES2DecoderPassthroughImpl::DoVertexAttribI4ui(GLuint indx, 1928 error::Error GLES2DecoderPassthroughImpl::DoVertexAttribI4ui(GLuint indx,
1457 GLuint x, 1929 GLuint x,
1458 GLuint y, 1930 GLuint y,
1459 GLuint z, 1931 GLuint z,
1460 GLuint w) { 1932 GLuint w) {
1933 glVertexAttribI4ui(indx, x, y, z, w);
1461 return error::kNoError; 1934 return error::kNoError;
1462 } 1935 }
1463 1936
1464 error::Error GLES2DecoderPassthroughImpl::DoVertexAttribI4uiv( 1937 error::Error GLES2DecoderPassthroughImpl::DoVertexAttribI4uiv(
1465 GLuint indx, 1938 GLuint indx,
1466 const volatile GLuint* values) { 1939 const volatile GLuint* values) {
1940 glVertexAttribI4uiv(indx, const_cast<const GLuint*>(values));
1467 return error::kNoError; 1941 return error::kNoError;
1468 } 1942 }
1469 1943
1470 error::Error GLES2DecoderPassthroughImpl::DoVertexAttribIPointer( 1944 error::Error GLES2DecoderPassthroughImpl::DoVertexAttribIPointer(
1471 GLuint indx, 1945 GLuint indx,
1472 GLint size, 1946 GLint size,
1473 GLenum type, 1947 GLenum type,
1474 GLsizei stride, 1948 GLsizei stride,
1475 const void* ptr) { 1949 const void* ptr) {
1950 glVertexAttribIPointer(indx, size, type, stride, ptr);
1476 return error::kNoError; 1951 return error::kNoError;
1477 } 1952 }
1478 1953
1479 error::Error GLES2DecoderPassthroughImpl::DoVertexAttribPointer( 1954 error::Error GLES2DecoderPassthroughImpl::DoVertexAttribPointer(
1480 GLuint indx, 1955 GLuint indx,
1481 GLint size, 1956 GLint size,
1482 GLenum type, 1957 GLenum type,
1483 GLboolean normalized, 1958 GLboolean normalized,
1484 GLsizei stride, 1959 GLsizei stride,
1485 const void* ptr) { 1960 const void* ptr) {
1961 glVertexAttribPointer(indx, size, type, normalized, stride, ptr);
1486 return error::kNoError; 1962 return error::kNoError;
1487 } 1963 }
1488 1964
1489 error::Error GLES2DecoderPassthroughImpl::DoViewport(GLint x, 1965 error::Error GLES2DecoderPassthroughImpl::DoViewport(GLint x,
1490 GLint y, 1966 GLint y,
1491 GLsizei width, 1967 GLsizei width,
1492 GLsizei height) { 1968 GLsizei height) {
1969 glViewport(x, y, width, height);
1493 return error::kNoError; 1970 return error::kNoError;
1494 } 1971 }
1495 1972
1496 error::Error GLES2DecoderPassthroughImpl::DoWaitSync(GLuint sync, 1973 error::Error GLES2DecoderPassthroughImpl::DoWaitSync(GLuint sync,
1497 GLbitfield flags, 1974 GLbitfield flags,
1498 GLuint64 timeout) { 1975 GLuint64 timeout) {
1976 DCHECK(false) << "UNIMPLEMENTED";
1499 return error::kNoError; 1977 return error::kNoError;
1500 } 1978 }
1501 1979
1502 error::Error GLES2DecoderPassthroughImpl::DoBlitFramebufferCHROMIUM( 1980 error::Error GLES2DecoderPassthroughImpl::DoBlitFramebufferCHROMIUM(
1503 GLint srcX0, 1981 GLint srcX0,
1504 GLint srcY0, 1982 GLint srcY0,
1505 GLint srcX1, 1983 GLint srcX1,
1506 GLint srcY1, 1984 GLint srcY1,
1507 GLint dstX0, 1985 GLint dstX0,
1508 GLint dstY0, 1986 GLint dstY0,
1509 GLint dstX1, 1987 GLint dstX1,
1510 GLint dstY1, 1988 GLint dstY1,
1511 GLbitfield mask, 1989 GLbitfield mask,
1512 GLenum filter) { 1990 GLenum filter) {
1991 glBlitFramebufferANGLE(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1,
1992 mask, filter);
1513 return error::kNoError; 1993 return error::kNoError;
1514 } 1994 }
1515 1995
1516 error::Error 1996 error::Error
1517 GLES2DecoderPassthroughImpl::DoRenderbufferStorageMultisampleCHROMIUM( 1997 GLES2DecoderPassthroughImpl::DoRenderbufferStorageMultisampleCHROMIUM(
1518 GLenum target, 1998 GLenum target,
1519 GLsizei samples, 1999 GLsizei samples,
1520 GLenum internalformat, 2000 GLenum internalformat,
1521 GLsizei width, 2001 GLsizei width,
1522 GLsizei height) { 2002 GLsizei height) {
2003 glRenderbufferStorageMultisampleANGLE(target, samples, internalformat, width,
2004 height);
1523 return error::kNoError; 2005 return error::kNoError;
1524 } 2006 }
1525 2007
1526 error::Error GLES2DecoderPassthroughImpl::DoRenderbufferStorageMultisampleEXT( 2008 error::Error GLES2DecoderPassthroughImpl::DoRenderbufferStorageMultisampleEXT(
1527 GLenum target, 2009 GLenum target,
1528 GLsizei samples, 2010 GLsizei samples,
1529 GLenum internalformat, 2011 GLenum internalformat,
1530 GLsizei width, 2012 GLsizei width,
1531 GLsizei height) { 2013 GLsizei height) {
2014 glRenderbufferStorageMultisampleANGLE(target, samples, internalformat, width,
2015 height);
1532 return error::kNoError; 2016 return error::kNoError;
1533 } 2017 }
1534 2018
1535 error::Error GLES2DecoderPassthroughImpl::DoFramebufferTexture2DMultisampleEXT( 2019 error::Error GLES2DecoderPassthroughImpl::DoFramebufferTexture2DMultisampleEXT(
1536 GLenum target, 2020 GLenum target,
1537 GLenum attachment, 2021 GLenum attachment,
1538 GLenum textarget, 2022 GLenum textarget,
1539 GLuint texture, 2023 GLuint texture,
1540 GLint level, 2024 GLint level,
1541 GLsizei samples) { 2025 GLsizei samples) {
2026 DCHECK(false) << "UNIMPLEMENTED";
1542 return error::kNoError; 2027 return error::kNoError;
1543 } 2028 }
1544 2029
1545 error::Error GLES2DecoderPassthroughImpl::DoTexStorage2DEXT( 2030 error::Error GLES2DecoderPassthroughImpl::DoTexStorage2DEXT(
1546 GLenum target, 2031 GLenum target,
1547 GLsizei levels, 2032 GLsizei levels,
1548 GLenum internalFormat, 2033 GLenum internalFormat,
1549 GLsizei width, 2034 GLsizei width,
1550 GLsizei height) { 2035 GLsizei height) {
1551 glTexStorage2DEXT(target, levels, internalFormat, width, height); 2036 glTexStorage2DEXT(target, levels, internalFormat, width, height);
1552 return error::kNoError; 2037 return error::kNoError;
1553 } 2038 }
1554 2039
1555 error::Error GLES2DecoderPassthroughImpl::DoGenQueriesEXT( 2040 error::Error GLES2DecoderPassthroughImpl::DoGenQueriesEXT(
1556 GLsizei n, 2041 GLsizei n,
1557 volatile GLuint* queries) { 2042 volatile GLuint* queries) {
1558 return error::kNoError; 2043 return GenHelper(n, queries, &query_id_map_, [](GLsizei n, GLuint* queries) {
2044 glGenQueries(n, queries);
2045 });
1559 } 2046 }
1560 2047
1561 error::Error GLES2DecoderPassthroughImpl::DoDeleteQueriesEXT( 2048 error::Error GLES2DecoderPassthroughImpl::DoDeleteQueriesEXT(
1562 GLsizei n, 2049 GLsizei n,
1563 const volatile GLuint* queries) { 2050 const volatile GLuint* queries) {
1564 return error::kNoError; 2051 return DeleteHelper(
2052 n, queries, &query_id_map_,
2053 [](GLsizei n, GLuint* queries) { glDeleteQueries(n, queries); });
1565 } 2054 }
1566 2055
1567 error::Error GLES2DecoderPassthroughImpl::DoQueryCounterEXT(GLuint id, 2056 error::Error GLES2DecoderPassthroughImpl::DoQueryCounterEXT(GLuint id,
1568 GLenum target) { 2057 GLenum target) {
2058 glQueryCounter(query_id_map_.GetServiceIDOrReserve(id), target);
1569 return error::kNoError; 2059 return error::kNoError;
1570 } 2060 }
1571 2061
1572 error::Error GLES2DecoderPassthroughImpl::DoBeginQueryEXT(GLenum target, 2062 error::Error GLES2DecoderPassthroughImpl::DoBeginQueryEXT(GLenum target,
1573 GLuint id) { 2063 GLuint id) {
2064 // TODO: Track active queries
2065 glBeginQuery(target, query_id_map_.GetServiceIDOrReserve(id));
1574 return error::kNoError; 2066 return error::kNoError;
1575 } 2067 }
1576 2068
1577 error::Error GLES2DecoderPassthroughImpl::DoBeginTransformFeedback( 2069 error::Error GLES2DecoderPassthroughImpl::DoBeginTransformFeedback(
1578 GLenum primitivemode) { 2070 GLenum primitivemode) {
2071 glBeginTransformFeedback(primitivemode);
1579 return error::kNoError; 2072 return error::kNoError;
1580 } 2073 }
1581 2074
1582 error::Error GLES2DecoderPassthroughImpl::DoEndQueryEXT(GLenum target) { 2075 error::Error GLES2DecoderPassthroughImpl::DoEndQueryEXT(GLenum target) {
2076 // TODO: Track active queries
2077 glEndQuery(target);
1583 return error::kNoError; 2078 return error::kNoError;
1584 } 2079 }
1585 2080
1586 error::Error GLES2DecoderPassthroughImpl::DoEndTransformFeedback() { 2081 error::Error GLES2DecoderPassthroughImpl::DoEndTransformFeedback() {
2082 glEndTransformFeedback();
1587 return error::kNoError; 2083 return error::kNoError;
1588 } 2084 }
1589 2085
1590 error::Error GLES2DecoderPassthroughImpl::DoSetDisjointValueSyncCHROMIUM( 2086 error::Error GLES2DecoderPassthroughImpl::DoSetDisjointValueSyncCHROMIUM(
1591 DisjointValueSync* sync) { 2087 DisjointValueSync* sync) {
2088 DCHECK(false) << "UNIMPLEMENTED";
1592 return error::kNoError; 2089 return error::kNoError;
1593 } 2090 }
1594 2091
1595 error::Error GLES2DecoderPassthroughImpl::DoInsertEventMarkerEXT( 2092 error::Error GLES2DecoderPassthroughImpl::DoInsertEventMarkerEXT(
1596 GLsizei length, 2093 GLsizei length,
1597 const char* marker) { 2094 const char* marker) {
2095 // DCHECK(false) << "UNIMPLEMENTED";
1598 return error::kNoError; 2096 return error::kNoError;
1599 } 2097 }
1600 2098
1601 error::Error GLES2DecoderPassthroughImpl::DoPushGroupMarkerEXT( 2099 error::Error GLES2DecoderPassthroughImpl::DoPushGroupMarkerEXT(
1602 GLsizei length, 2100 GLsizei length,
1603 const char* marker) { 2101 const char* marker) {
2102 // DCHECK(false) << "UNIMPLEMENTED";
1604 return error::kNoError; 2103 return error::kNoError;
1605 } 2104 }
1606 2105
1607 error::Error GLES2DecoderPassthroughImpl::DoPopGroupMarkerEXT() { 2106 error::Error GLES2DecoderPassthroughImpl::DoPopGroupMarkerEXT() {
2107 // DCHECK(false) << "UNIMPLEMENTED";
1608 return error::kNoError; 2108 return error::kNoError;
1609 } 2109 }
1610 2110
1611 error::Error GLES2DecoderPassthroughImpl::DoGenVertexArraysOES( 2111 error::Error GLES2DecoderPassthroughImpl::DoGenVertexArraysOES(
1612 GLsizei n, 2112 GLsizei n,
1613 volatile GLuint* arrays) { 2113 volatile GLuint* arrays) {
1614 return error::kNoError; 2114 return GenHelper(
2115 n, arrays, &vertex_array_id_map_,
2116 [](GLsizei n, GLuint* arrays) { glGenVertexArraysOES(n, arrays); });
1615 } 2117 }
1616 2118
1617 error::Error GLES2DecoderPassthroughImpl::DoDeleteVertexArraysOES( 2119 error::Error GLES2DecoderPassthroughImpl::DoDeleteVertexArraysOES(
1618 GLsizei n, 2120 GLsizei n,
1619 const volatile GLuint* arrays) { 2121 const volatile GLuint* arrays) {
1620 return error::kNoError; 2122 return DeleteHelper(
2123 n, arrays, &vertex_array_id_map_,
2124 [](GLsizei n, GLuint* arrays) { glDeleteVertexArraysOES(n, arrays); });
1621 } 2125 }
1622 2126
1623 error::Error GLES2DecoderPassthroughImpl::DoIsVertexArrayOES(GLuint array, 2127 error::Error GLES2DecoderPassthroughImpl::DoIsVertexArrayOES(GLuint array,
1624 uint32_t* result) { 2128 uint32_t* result) {
2129 *result =
2130 glIsVertexArrayOES(vertex_array_id_map_.GetServiceIDOrReserve(array));
1625 return error::kNoError; 2131 return error::kNoError;
1626 } 2132 }
1627 2133
1628 error::Error GLES2DecoderPassthroughImpl::DoBindVertexArrayOES(GLuint array) { 2134 error::Error GLES2DecoderPassthroughImpl::DoBindVertexArrayOES(GLuint array) {
2135 glBindVertexArrayOES(vertex_array_id_map_.GetServiceIDOrReserve(array));
1629 return error::kNoError; 2136 return error::kNoError;
1630 } 2137 }
1631 2138
1632 error::Error GLES2DecoderPassthroughImpl::DoSwapBuffers() { 2139 error::Error GLES2DecoderPassthroughImpl::DoSwapBuffers() {
2140 gfx::SwapResult result = surface_->SwapBuffers();
2141 if (result == gfx::SwapResult::SWAP_FAILED) {
2142 LOG(ERROR) << "Context lost because SwapBuffers failed.";
2143 }
2144 // TODO: force the context loss?
1633 return error::kNoError; 2145 return error::kNoError;
1634 } 2146 }
1635 2147
1636 error::Error GLES2DecoderPassthroughImpl::DoGetMaxValueInBufferCHROMIUM( 2148 error::Error GLES2DecoderPassthroughImpl::DoGetMaxValueInBufferCHROMIUM(
1637 GLuint buffer_id, 2149 GLuint buffer_id,
1638 GLsizei count, 2150 GLsizei count,
1639 GLenum type, 2151 GLenum type,
1640 GLuint offset, 2152 GLuint offset,
1641 uint32_t* result) { 2153 uint32_t* result) {
2154 DCHECK(false) << "UNIMPLEMENTED";
1642 return error::kNoError; 2155 return error::kNoError;
1643 } 2156 }
1644 2157
1645 error::Error GLES2DecoderPassthroughImpl::DoEnableFeatureCHROMIUM( 2158 error::Error GLES2DecoderPassthroughImpl::DoEnableFeatureCHROMIUM(
1646 const char* feature) { 2159 const char* feature) {
2160 DCHECK(false) << "UNIMPLEMENTED";
1647 return error::kNoError; 2161 return error::kNoError;
1648 } 2162 }
1649 2163
1650 error::Error GLES2DecoderPassthroughImpl::DoMapBufferRange(GLenum target, 2164 error::Error GLES2DecoderPassthroughImpl::DoMapBufferRange(GLenum target,
1651 GLintptr offset, 2165 GLintptr offset,
1652 GLsizeiptr size, 2166 GLsizeiptr size,
1653 GLbitfield access, 2167 GLbitfield access,
1654 void** ptr) { 2168 void** ptr) {
2169 DCHECK(false) << "UNIMPLEMENTED";
1655 return error::kNoError; 2170 return error::kNoError;
1656 } 2171 }
1657 2172
1658 error::Error GLES2DecoderPassthroughImpl::DoUnmapBuffer(GLenum target) { 2173 error::Error GLES2DecoderPassthroughImpl::DoUnmapBuffer(GLenum target) {
2174 DCHECK(false) << "UNIMPLEMENTED";
1659 return error::kNoError; 2175 return error::kNoError;
1660 } 2176 }
1661 2177
1662 error::Error GLES2DecoderPassthroughImpl::DoResizeCHROMIUM(GLuint width, 2178 error::Error GLES2DecoderPassthroughImpl::DoResizeCHROMIUM(GLuint width,
1663 GLuint height, 2179 GLuint height,
1664 GLfloat scale_factor, 2180 GLfloat scale_factor,
1665 GLboolean alpha) { 2181 GLboolean alpha) {
2182 // DCHECK(false) << "UNIMPLEMENTED";
1666 return error::kNoError; 2183 return error::kNoError;
1667 } 2184 }
1668 2185
1669 error::Error GLES2DecoderPassthroughImpl::DoGetRequestableExtensionsCHROMIUM( 2186 error::Error GLES2DecoderPassthroughImpl::DoGetRequestableExtensionsCHROMIUM(
1670 const char** extensions) { 2187 const char** extensions) {
2188 *extensions = "";
2189 // DCHECK(false) << "UNIMPLEMENTED";
1671 return error::kNoError; 2190 return error::kNoError;
1672 } 2191 }
1673 2192
1674 error::Error GLES2DecoderPassthroughImpl::DoRequestExtensionCHROMIUM( 2193 error::Error GLES2DecoderPassthroughImpl::DoRequestExtensionCHROMIUM(
1675 const char* extension) { 2194 const char* extension) {
2195 DCHECK(false) << "UNIMPLEMENTED";
1676 return error::kNoError; 2196 return error::kNoError;
1677 } 2197 }
1678 2198
2199 namespace {
2200
2201 template <typename T>
2202 void InsertValueIntoBuffer(std::vector<uint8_t>* data,
2203 const T& value,
2204 size_t offset) {
2205 DCHECK_LE(offset + sizeof(T), data->size());
2206 memcpy(data->data() + offset, &value, sizeof(T));
2207 }
2208
2209 template <typename T>
2210 void AppendValueToBuffer(std::vector<uint8_t>* data, const T& value) {
2211 size_t old_size = data->size();
2212 data->resize(old_size + sizeof(T));
2213 memcpy(data->data() + old_size, &value, sizeof(T));
2214 }
2215
2216 void AppendStringToBuffer(std::vector<uint8_t>* data,
2217 const char* str,
2218 size_t len) {
2219 size_t old_size = data->size();
2220 data->resize(old_size + len);
2221 memcpy(data->data() + old_size, str, len);
2222 }
2223
2224 } // anonymous namespace
Zhenyao Mo 2016/09/09 21:22:10 Can we move this to the top of the file?
Geoff Lang 2016/09/12 14:21:29 Done.
2225
1679 error::Error GLES2DecoderPassthroughImpl::DoGetProgramInfoCHROMIUM( 2226 error::Error GLES2DecoderPassthroughImpl::DoGetProgramInfoCHROMIUM(
1680 GLuint program, 2227 GLuint program,
1681 std::vector<uint8_t>* data) { 2228 std::vector<uint8_t>* data) {
2229 GLuint service_program =
2230 resources_->program_id_map.GetServiceIDOrReserve(program);
Zhenyao Mo 2016/09/09 21:22:11 We can't reserve a program id, can we? Should we u
Geoff Lang 2016/09/12 14:21:29 Done.
2231
2232 GLint num_attributes = 0;
2233 glGetProgramiv(service_program, GL_ACTIVE_ATTRIBUTES, &num_attributes);
2234
2235 GLint num_uniforms = 0;
2236 glGetProgramiv(service_program, GL_ACTIVE_UNIFORMS, &num_uniforms);
2237
2238 data->resize(sizeof(ProgramInfoHeader) +
2239 ((num_attributes + num_uniforms) * sizeof(ProgramInput)),
2240 0);
2241
2242 GLint link_status = 0;
2243 glGetProgramiv(service_program, GL_LINK_STATUS, &link_status);
Zhenyao Mo 2016/09/09 21:22:11 Should we return early if link_status is 0?
Geoff Lang 2016/09/12 14:21:29 I think that it's safe to always do the queries.
Zhenyao Mo 2016/09/12 18:15:35 You are saying we will only call this function if
2244
2245 ProgramInfoHeader header;
2246 header.link_status = link_status;
2247 header.num_attribs = num_attributes;
2248 header.num_uniforms = num_uniforms;
2249 InsertValueIntoBuffer(data, header, 0);
2250
2251 GLint active_attribute_max_length = 0;
2252 glGetProgramiv(service_program, GL_ACTIVE_ATTRIBUTE_MAX_LENGTH,
2253 &active_attribute_max_length);
2254
2255 std::vector<char> attrib_name_buf(active_attribute_max_length, 0);
2256 for (GLint attrib_index = 0; attrib_index < num_attributes; attrib_index++) {
2257 GLsizei length = 0;
2258 GLint size = 0;
2259 GLenum type = GL_NONE;
2260 glGetActiveAttrib(service_program, attrib_index, attrib_name_buf.size(),
2261 &length, &size, &type, attrib_name_buf.data());
2262
2263 ProgramInput input;
2264 input.size = size;
2265 input.type = type;
2266
2267 int32_t location =
2268 glGetAttribLocation(service_program, attrib_name_buf.data());
2269 input.location_offset = data->size();
2270 AppendValueToBuffer(data, location);
2271
2272 input.name_offset = data->size();
2273 input.name_length = length;
2274 AppendStringToBuffer(data, attrib_name_buf.data(), length);
2275
2276 InsertValueIntoBuffer(
2277 data, input,
2278 sizeof(ProgramInfoHeader) + (attrib_index * sizeof(ProgramInput)));
2279 }
2280
2281 GLint active_uniform_max_length = 0;
2282 glGetProgramiv(service_program, GL_ACTIVE_UNIFORM_MAX_LENGTH,
2283 &active_uniform_max_length);
2284
2285 std::vector<char> uniform_name_buf(active_uniform_max_length, 0);
2286 for (GLint uniform_index = 0; uniform_index < num_uniforms; uniform_index++) {
2287 GLsizei length = 0;
2288 GLint size = 0;
2289 GLenum type = GL_NONE;
2290 glGetActiveUniform(service_program, uniform_index, uniform_name_buf.size(),
2291 &length, &size, &type, uniform_name_buf.data());
2292
2293 ProgramInput input;
2294 input.size = size;
2295 input.type = type;
2296
2297 input.location_offset = data->size();
2298 int32_t base_location =
2299 glGetUniformLocation(service_program, uniform_name_buf.data());
2300 AppendValueToBuffer(data, base_location);
2301
2302 GLSLArrayName parsed_service_name(uniform_name_buf.data());
2303 if (size > 1 || parsed_service_name.IsArrayName()) {
2304 for (GLint location_index = 1; location_index < size; location_index++) {
2305 std::string array_element_name = parsed_service_name.base_name() + "[" +
2306 base::IntToString(location_index) +
2307 "]";
2308 int32_t element_location =
2309 glGetUniformLocation(service_program, array_element_name.c_str());
2310 AppendValueToBuffer(data, element_location);
2311 }
2312 }
2313
2314 input.name_offset = data->size();
2315 input.name_length = length;
2316 AppendStringToBuffer(data, uniform_name_buf.data(), length);
2317
2318 InsertValueIntoBuffer(data, input, sizeof(ProgramInfoHeader) +
2319 ((num_attributes + uniform_index) *
2320 sizeof(ProgramInput)));
2321 }
2322
1682 return error::kNoError; 2323 return error::kNoError;
1683 } 2324 }
1684 2325
1685 error::Error GLES2DecoderPassthroughImpl::DoGetUniformBlocksCHROMIUM( 2326 error::Error GLES2DecoderPassthroughImpl::DoGetUniformBlocksCHROMIUM(
1686 GLuint program, 2327 GLuint program,
1687 std::vector<uint8_t>* data) { 2328 std::vector<uint8_t>* data) {
2329 DCHECK(false) << "UNIMPLEMENTED";
1688 return error::kNoError; 2330 return error::kNoError;
1689 } 2331 }
1690 2332
1691 error::Error 2333 error::Error
1692 GLES2DecoderPassthroughImpl::DoGetTransformFeedbackVaryingsCHROMIUM( 2334 GLES2DecoderPassthroughImpl::DoGetTransformFeedbackVaryingsCHROMIUM(
1693 GLuint program, 2335 GLuint program,
1694 std::vector<uint8_t>* data) { 2336 std::vector<uint8_t>* data) {
2337 DCHECK(false) << "UNIMPLEMENTED";
1695 return error::kNoError; 2338 return error::kNoError;
1696 } 2339 }
1697 2340
1698 error::Error GLES2DecoderPassthroughImpl::DoGetUniformsES3CHROMIUM( 2341 error::Error GLES2DecoderPassthroughImpl::DoGetUniformsES3CHROMIUM(
1699 GLuint program, 2342 GLuint program,
1700 std::vector<uint8_t>* data) { 2343 std::vector<uint8_t>* data) {
2344 DCHECK(false) << "UNIMPLEMENTED";
1701 return error::kNoError; 2345 return error::kNoError;
1702 } 2346 }
1703 2347
1704 error::Error GLES2DecoderPassthroughImpl::DoGetTranslatedShaderSourceANGLE( 2348 error::Error GLES2DecoderPassthroughImpl::DoGetTranslatedShaderSourceANGLE(
1705 GLuint shader, 2349 GLuint shader,
1706 std::string* source) { 2350 std::string* source) {
2351 DCHECK(false) << "UNIMPLEMENTED";
1707 return error::kNoError; 2352 return error::kNoError;
1708 } 2353 }
1709 2354
1710 error::Error GLES2DecoderPassthroughImpl::DoPostSubBufferCHROMIUM( 2355 error::Error GLES2DecoderPassthroughImpl::DoPostSubBufferCHROMIUM(
1711 GLint x, 2356 GLint x,
1712 GLint y, 2357 GLint y,
1713 GLint width, 2358 GLint width,
1714 GLint height) { 2359 GLint height) {
2360 gfx::SwapResult result = surface_->PostSubBuffer(x, y, width, height);
2361 if (result == gfx::SwapResult::SWAP_FAILED) {
2362 LOG(ERROR) << "Context lost because PostSubBuffer failed.";
2363 }
2364 // TODO: force the context loss?
1715 return error::kNoError; 2365 return error::kNoError;
1716 } 2366 }
1717 2367
1718 error::Error GLES2DecoderPassthroughImpl::DoCopyTextureCHROMIUM( 2368 error::Error GLES2DecoderPassthroughImpl::DoCopyTextureCHROMIUM(
1719 GLenum source_id, 2369 GLenum source_id,
1720 GLenum dest_id, 2370 GLenum dest_id,
1721 GLint internalformat, 2371 GLint internalformat,
1722 GLenum dest_type, 2372 GLenum dest_type,
1723 GLboolean unpack_flip_y, 2373 GLboolean unpack_flip_y,
1724 GLboolean unpack_premultiply_alpha, 2374 GLboolean unpack_premultiply_alpha,
1725 GLboolean unpack_unmultiply_alpha) { 2375 GLboolean unpack_unmultiply_alpha) {
2376 glCopyTextureCHROMIUM(
2377 resources_->texture_id_map.GetServiceIDOrReserve(source_id),
2378 resources_->texture_id_map.GetServiceIDOrReserve(dest_id), internalformat,
2379 dest_type, unpack_flip_y, unpack_premultiply_alpha,
2380 unpack_unmultiply_alpha);
1726 return error::kNoError; 2381 return error::kNoError;
1727 } 2382 }
1728 2383
1729 error::Error GLES2DecoderPassthroughImpl::DoCopySubTextureCHROMIUM( 2384 error::Error GLES2DecoderPassthroughImpl::DoCopySubTextureCHROMIUM(
1730 GLenum source_id, 2385 GLenum source_id,
1731 GLenum dest_id, 2386 GLenum dest_id,
1732 GLint xoffset, 2387 GLint xoffset,
1733 GLint yoffset, 2388 GLint yoffset,
1734 GLint x, 2389 GLint x,
1735 GLint y, 2390 GLint y,
1736 GLsizei width, 2391 GLsizei width,
1737 GLsizei height, 2392 GLsizei height,
1738 GLboolean unpack_flip_y, 2393 GLboolean unpack_flip_y,
1739 GLboolean unpack_premultiply_alpha, 2394 GLboolean unpack_premultiply_alpha,
1740 GLboolean unpack_unmultiply_alpha) { 2395 GLboolean unpack_unmultiply_alpha) {
2396 glCopySubTextureCHROMIUM(
2397 resources_->texture_id_map.GetServiceIDOrReserve(source_id),
2398 resources_->texture_id_map.GetServiceIDOrReserve(dest_id), xoffset,
2399 yoffset, x, y, width, height, unpack_flip_y, unpack_premultiply_alpha,
2400 unpack_unmultiply_alpha);
1741 return error::kNoError; 2401 return error::kNoError;
1742 } 2402 }
1743 2403
1744 error::Error GLES2DecoderPassthroughImpl::DoCompressedCopyTextureCHROMIUM( 2404 error::Error GLES2DecoderPassthroughImpl::DoCompressedCopyTextureCHROMIUM(
1745 GLenum source_id, 2405 GLenum source_id,
1746 GLenum dest_id) { 2406 GLenum dest_id) {
2407 glCompressedCopyTextureCHROMIUM(
2408 resources_->texture_id_map.GetServiceIDOrReserve(source_id),
2409 resources_->texture_id_map.GetServiceIDOrReserve(dest_id));
1747 return error::kNoError; 2410 return error::kNoError;
1748 } 2411 }
1749 2412
1750 error::Error GLES2DecoderPassthroughImpl::DoDrawArraysInstancedANGLE( 2413 error::Error GLES2DecoderPassthroughImpl::DoDrawArraysInstancedANGLE(
1751 GLenum mode, 2414 GLenum mode,
1752 GLint first, 2415 GLint first,
1753 GLsizei count, 2416 GLsizei count,
1754 GLsizei primcount) { 2417 GLsizei primcount) {
2418 glDrawArraysInstancedANGLE(mode, first, count, primcount);
1755 return error::kNoError; 2419 return error::kNoError;
1756 } 2420 }
1757 2421
1758 error::Error GLES2DecoderPassthroughImpl::DoDrawElementsInstancedANGLE( 2422 error::Error GLES2DecoderPassthroughImpl::DoDrawElementsInstancedANGLE(
1759 GLenum mode, 2423 GLenum mode,
1760 GLsizei count, 2424 GLsizei count,
1761 GLenum type, 2425 GLenum type,
1762 const void* indices, 2426 const void* indices,
1763 GLsizei primcount) { 2427 GLsizei primcount) {
2428 glDrawElementsInstancedANGLE(mode, count, type, indices, primcount);
1764 return error::kNoError; 2429 return error::kNoError;
1765 } 2430 }
1766 2431
1767 error::Error GLES2DecoderPassthroughImpl::DoVertexAttribDivisorANGLE( 2432 error::Error GLES2DecoderPassthroughImpl::DoVertexAttribDivisorANGLE(
1768 GLuint index, 2433 GLuint index,
1769 GLuint divisor) { 2434 GLuint divisor) {
2435 glVertexAttribDivisorANGLE(index, divisor);
1770 return error::kNoError; 2436 return error::kNoError;
1771 } 2437 }
1772 2438
1773 error::Error GLES2DecoderPassthroughImpl::DoProduceTextureCHROMIUM( 2439 error::Error GLES2DecoderPassthroughImpl::DoProduceTextureCHROMIUM(
1774 GLenum target, 2440 GLenum target,
1775 const volatile GLbyte* mailbox) { 2441 const volatile GLbyte* mailbox) {
2442 // TODO: validation
2443
2444 GLuint texture = bound_textures_[active_texture_unit_];
2445 TexturePassthrough* texture_passthrough = nullptr;
2446
2447 auto texture_object_iter = resources_->texture_object_map.find(texture);
2448 if (texture_object_iter != resources_->texture_object_map.end()) {
2449 texture_passthrough = texture_object_iter->second.get();
2450 } else {
2451 GLuint service_id =
2452 resources_->texture_id_map.GetServiceIDOrReserve(texture);
2453 texture_passthrough = new TexturePassthrough(service_id);
2454 resources_->texture_object_map.insert(
2455 std::make_pair(texture, texture_passthrough));
2456 }
2457
2458 const Mailbox& mb = Mailbox::FromVolatile(
2459 *reinterpret_cast<const volatile Mailbox*>(mailbox));
2460 mailbox_manager_->ProduceTexture(mb, texture_passthrough);
1776 return error::kNoError; 2461 return error::kNoError;
1777 } 2462 }
1778 2463
1779 error::Error GLES2DecoderPassthroughImpl::DoProduceTextureDirectCHROMIUM( 2464 error::Error GLES2DecoderPassthroughImpl::DoProduceTextureDirectCHROMIUM(
1780 GLuint texture, 2465 GLuint texture_client_id,
1781 GLenum target, 2466 GLenum target,
1782 const volatile GLbyte* mailbox) { 2467 const volatile GLbyte* mailbox) {
2468 // TODO: validation
2469
2470 TexturePassthrough* texture = nullptr;
2471 auto texture_object_iter =
2472 resources_->texture_object_map.find(texture_client_id);
2473 if (texture_object_iter != resources_->texture_object_map.end()) {
2474 texture = texture_object_iter->second.get();
2475 } else {
2476 GLuint service_id =
2477 resources_->texture_id_map.GetServiceIDOrReserve(texture_client_id);
2478 texture = new TexturePassthrough(service_id);
2479 resources_->texture_object_map.insert(
2480 std::make_pair(texture_client_id, texture));
2481 }
2482
2483 const Mailbox& mb = Mailbox::FromVolatile(
2484 *reinterpret_cast<const volatile Mailbox*>(mailbox));
2485 mailbox_manager_->ProduceTexture(mb, texture);
1783 return error::kNoError; 2486 return error::kNoError;
1784 } 2487 }
1785 2488
1786 error::Error GLES2DecoderPassthroughImpl::DoConsumeTextureCHROMIUM( 2489 error::Error GLES2DecoderPassthroughImpl::DoConsumeTextureCHROMIUM(
1787 GLenum target, 2490 GLenum target,
1788 const volatile GLbyte* mailbox) { 2491 const volatile GLbyte* mailbox) {
2492 // TODO: validation
2493
2494 const Mailbox& mb = Mailbox::FromVolatile(
2495 *reinterpret_cast<const volatile Mailbox*>(mailbox));
2496 TexturePassthrough* texture = static_cast<TexturePassthrough*>(
2497 group_->mailbox_manager()->ConsumeTexture(mb));
2498 if (texture == nullptr) {
2499 // TODO: error, missing mailbox
2500 return error::kNoError;
2501 }
2502
2503 GLuint client_id = bound_textures_[active_texture_unit_];
2504 resources_->texture_id_map.SetIDMapping(client_id, texture->service_id());
2505 resources_->texture_object_map.erase(client_id);
2506 resources_->texture_object_map.insert(std::make_pair(client_id, texture));
1789 return error::kNoError; 2507 return error::kNoError;
1790 } 2508 }
1791 2509
1792 error::Error GLES2DecoderPassthroughImpl::DoCreateAndConsumeTextureINTERNAL( 2510 error::Error GLES2DecoderPassthroughImpl::DoCreateAndConsumeTextureINTERNAL(
1793 GLenum target, 2511 GLenum target,
1794 GLuint texture, 2512 GLuint texture_client_id,
1795 const volatile GLbyte* mailbox) { 2513 const volatile GLbyte* mailbox) {
2514 // TODO: validation
2515
2516 if (resources_->texture_id_map.GetServiceID(texture_client_id, nullptr)) {
2517 return error::kInvalidArguments;
2518 }
2519 const Mailbox& mb = Mailbox::FromVolatile(
2520 *reinterpret_cast<const volatile Mailbox*>(mailbox));
2521 TexturePassthrough* texture = static_cast<TexturePassthrough*>(
2522 group_->mailbox_manager()->ConsumeTexture(mb));
2523 if (texture == nullptr) {
2524 // TODO: error, missing mailbox
2525 return error::kNoError;
2526 }
2527
2528 resources_->texture_id_map.SetIDMapping(texture_client_id,
2529 texture->service_id());
2530 resources_->texture_object_map.erase(texture_client_id);
2531 resources_->texture_object_map.insert(
2532 std::make_pair(texture_client_id, texture));
1796 return error::kNoError; 2533 return error::kNoError;
1797 } 2534 }
1798 2535
1799 error::Error GLES2DecoderPassthroughImpl::DoBindUniformLocationCHROMIUM( 2536 error::Error GLES2DecoderPassthroughImpl::DoBindUniformLocationCHROMIUM(
1800 GLuint program, 2537 GLuint program,
1801 GLint location, 2538 GLint location,
1802 const char* name) { 2539 const char* name) {
2540 glBindUniformLocationCHROMIUM(
2541 resources_->program_id_map.GetServiceIDOrReserve(program), location,
2542 name);
1803 return error::kNoError; 2543 return error::kNoError;
1804 } 2544 }
1805 2545
1806 error::Error GLES2DecoderPassthroughImpl::DoBindTexImage2DCHROMIUM( 2546 error::Error GLES2DecoderPassthroughImpl::DoBindTexImage2DCHROMIUM(
1807 GLenum target, 2547 GLenum target,
1808 GLint imageId) { 2548 GLint imageId) {
2549 // TODO: error handling
2550 gl::GLImage* image = image_manager_->LookupImage(imageId);
2551 if (!image->BindTexImage(target)) {
2552 image->CopyTexImage(target);
2553 }
1809 return error::kNoError; 2554 return error::kNoError;
1810 } 2555 }
1811 2556
1812 error::Error GLES2DecoderPassthroughImpl::DoReleaseTexImage2DCHROMIUM( 2557 error::Error GLES2DecoderPassthroughImpl::DoReleaseTexImage2DCHROMIUM(
1813 GLenum target, 2558 GLenum target,
1814 GLint imageId) { 2559 GLint imageId) {
2560 // TODO: error handling
2561 gl::GLImage* image = image_manager_->LookupImage(imageId);
2562 image->ReleaseTexImage(target);
1815 return error::kNoError; 2563 return error::kNoError;
1816 } 2564 }
1817 2565
1818 error::Error GLES2DecoderPassthroughImpl::DoTraceBeginCHROMIUM( 2566 error::Error GLES2DecoderPassthroughImpl::DoTraceBeginCHROMIUM(
1819 const char* category_name, 2567 const char* category_name,
1820 const char* trace_name) { 2568 const char* trace_name) {
2569 // DCHECK(false) << "UNIMPLEMENTED";
1821 return error::kNoError; 2570 return error::kNoError;
1822 } 2571 }
1823 2572
1824 error::Error GLES2DecoderPassthroughImpl::DoTraceEndCHROMIUM() { 2573 error::Error GLES2DecoderPassthroughImpl::DoTraceEndCHROMIUM() {
2574 // DCHECK(false) << "UNIMPLEMENTED";
1825 return error::kNoError; 2575 return error::kNoError;
1826 } 2576 }
1827 2577
1828 error::Error GLES2DecoderPassthroughImpl::DoDiscardFramebufferEXT( 2578 error::Error GLES2DecoderPassthroughImpl::DoDiscardFramebufferEXT(
1829 GLenum target, 2579 GLenum target,
1830 GLsizei count, 2580 GLsizei count,
1831 const volatile GLenum* attachments) { 2581 const volatile GLenum* attachments) {
2582 std::vector<GLenum> attachments_copy(attachments, attachments + count);
2583 glDiscardFramebufferEXT(target, count, attachments_copy.data());
1832 return error::kNoError; 2584 return error::kNoError;
1833 } 2585 }
1834 2586
1835 error::Error GLES2DecoderPassthroughImpl::DoLoseContextCHROMIUM(GLenum current, 2587 error::Error GLES2DecoderPassthroughImpl::DoLoseContextCHROMIUM(GLenum current,
1836 GLenum other) { 2588 GLenum other) {
2589 DCHECK(false) << "UNIMPLEMENTED";
1837 return error::kNoError; 2590 return error::kNoError;
1838 } 2591 }
1839 2592
1840 error::Error GLES2DecoderPassthroughImpl::DoDescheduleUntilFinishedCHROMIUM() { 2593 error::Error GLES2DecoderPassthroughImpl::DoDescheduleUntilFinishedCHROMIUM() {
2594 DCHECK(false) << "UNIMPLEMENTED";
1841 return error::kNoError; 2595 return error::kNoError;
1842 } 2596 }
1843 2597
1844 error::Error GLES2DecoderPassthroughImpl::DoInsertFenceSyncCHROMIUM( 2598 error::Error GLES2DecoderPassthroughImpl::DoInsertFenceSyncCHROMIUM(
1845 GLuint64 release_count) { 2599 GLuint64 release_count) {
2600 if (!fence_sync_release_callback_.is_null())
2601 fence_sync_release_callback_.Run(release_count);
1846 return error::kNoError; 2602 return error::kNoError;
1847 } 2603 }
1848 2604
1849 error::Error GLES2DecoderPassthroughImpl::DoWaitSyncTokenCHROMIUM( 2605 error::Error GLES2DecoderPassthroughImpl::DoWaitSyncTokenCHROMIUM(
1850 CommandBufferNamespace namespace_id, 2606 CommandBufferNamespace namespace_id,
1851 CommandBufferId command_buffer_id, 2607 CommandBufferId command_buffer_id,
1852 GLuint64 release_count) { 2608 GLuint64 release_count) {
1853 return error::kNoError; 2609 if (wait_fence_sync_callback_.is_null()) {
2610 return error::kNoError;
2611 }
2612 return wait_fence_sync_callback_.Run(namespace_id, command_buffer_id,
2613 release_count)
2614 ? error::kNoError
2615 : error::kDeferCommandUntilLater;
1854 } 2616 }
1855 2617
1856 error::Error GLES2DecoderPassthroughImpl::DoDrawBuffersEXT( 2618 error::Error GLES2DecoderPassthroughImpl::DoDrawBuffersEXT(
1857 GLsizei count, 2619 GLsizei count,
1858 const volatile GLenum* bufs) { 2620 const volatile GLenum* bufs) {
2621 std::vector<GLenum> bufs_copy(bufs, bufs + count);
2622 glDrawBuffersARB(count, bufs_copy.data());
1859 return error::kNoError; 2623 return error::kNoError;
1860 } 2624 }
1861 2625
1862 error::Error GLES2DecoderPassthroughImpl::DoDiscardBackbufferCHROMIUM() { 2626 error::Error GLES2DecoderPassthroughImpl::DoDiscardBackbufferCHROMIUM() {
2627 // CHECK(false) << "UNIMPLEMENTED";
1863 return error::kNoError; 2628 return error::kNoError;
1864 } 2629 }
1865 2630
1866 error::Error GLES2DecoderPassthroughImpl::DoScheduleOverlayPlaneCHROMIUM( 2631 error::Error GLES2DecoderPassthroughImpl::DoScheduleOverlayPlaneCHROMIUM(
1867 GLint plane_z_order, 2632 GLint plane_z_order,
1868 GLenum plane_transform, 2633 GLenum plane_transform,
1869 GLuint overlay_texture_id, 2634 GLuint overlay_texture_id,
1870 GLint bounds_x, 2635 GLint bounds_x,
1871 GLint bounds_y, 2636 GLint bounds_y,
1872 GLint bounds_width, 2637 GLint bounds_width,
1873 GLint bounds_height, 2638 GLint bounds_height,
1874 GLfloat uv_x, 2639 GLfloat uv_x,
1875 GLfloat uv_y, 2640 GLfloat uv_y,
1876 GLfloat uv_width, 2641 GLfloat uv_width,
1877 GLfloat uv_height) { 2642 GLfloat uv_height) {
2643 DCHECK(false) << "UNIMPLEMENTED";
1878 return error::kNoError; 2644 return error::kNoError;
1879 } 2645 }
1880 2646
1881 error::Error GLES2DecoderPassthroughImpl::DoScheduleCALayerSharedStateCHROMIUM( 2647 error::Error GLES2DecoderPassthroughImpl::DoScheduleCALayerSharedStateCHROMIUM(
1882 GLfloat opacity, 2648 GLfloat opacity,
1883 GLboolean is_clipped, 2649 GLboolean is_clipped,
1884 const GLfloat* clip_rect, 2650 const GLfloat* clip_rect,
1885 GLint sorting_context_id, 2651 GLint sorting_context_id,
1886 const GLfloat* transform) { 2652 const GLfloat* transform) {
2653 DCHECK(false) << "UNIMPLEMENTED";
1887 return error::kNoError; 2654 return error::kNoError;
1888 } 2655 }
1889 2656
1890 error::Error GLES2DecoderPassthroughImpl::DoScheduleCALayerCHROMIUM( 2657 error::Error GLES2DecoderPassthroughImpl::DoScheduleCALayerCHROMIUM(
1891 GLuint contents_texture_id, 2658 GLuint contents_texture_id,
1892 const GLfloat* contents_rect, 2659 const GLfloat* contents_rect,
1893 GLuint background_color, 2660 GLuint background_color,
1894 GLuint edge_aa_mask, 2661 GLuint edge_aa_mask,
1895 const GLfloat* bounds_rect) { 2662 const GLfloat* bounds_rect) {
2663 CHECK(false) << "UNIMPLEMENTED";
1896 return error::kNoError; 2664 return error::kNoError;
1897 } 2665 }
1898 2666
1899 error::Error GLES2DecoderPassthroughImpl::DoScheduleCALayerInUseQueryCHROMIUM( 2667 error::Error GLES2DecoderPassthroughImpl::DoScheduleCALayerInUseQueryCHROMIUM(
1900 GLuint n, 2668 GLuint n,
1901 const volatile GLuint* textures) { 2669 const volatile GLuint* textures) {
2670 CHECK(false) << "UNIMPLEMENTED";
1902 return error::kNoError; 2671 return error::kNoError;
1903 } 2672 }
1904 2673
1905 error::Error GLES2DecoderPassthroughImpl::DoCommitOverlayPlanesCHROMIUM() { 2674 error::Error GLES2DecoderPassthroughImpl::DoCommitOverlayPlanesCHROMIUM() {
2675 CHECK(false) << "UNIMPLEMENTED";
1906 return error::kNoError; 2676 return error::kNoError;
1907 } 2677 }
1908 2678
1909 error::Error GLES2DecoderPassthroughImpl::DoSwapInterval(GLint interval) { 2679 error::Error GLES2DecoderPassthroughImpl::DoSwapInterval(GLint interval) {
2680 context_->SetSwapInterval(interval);
1910 return error::kNoError; 2681 return error::kNoError;
1911 } 2682 }
1912 2683
1913 error::Error GLES2DecoderPassthroughImpl::DoFlushDriverCachesCHROMIUM() { 2684 error::Error GLES2DecoderPassthroughImpl::DoFlushDriverCachesCHROMIUM() {
2685 // DCHECK(false) << "UNIMPLEMENTED";
1914 return error::kNoError; 2686 return error::kNoError;
1915 } 2687 }
1916 2688
1917 error::Error GLES2DecoderPassthroughImpl::DoMatrixLoadfCHROMIUM( 2689 error::Error GLES2DecoderPassthroughImpl::DoMatrixLoadfCHROMIUM(
1918 GLenum matrixMode, 2690 GLenum matrixMode,
1919 const volatile GLfloat* m) { 2691 const volatile GLfloat* m) {
2692 DCHECK(false) << "UNIMPLEMENTED";
1920 return error::kNoError; 2693 return error::kNoError;
1921 } 2694 }
1922 2695
1923 error::Error GLES2DecoderPassthroughImpl::DoMatrixLoadIdentityCHROMIUM( 2696 error::Error GLES2DecoderPassthroughImpl::DoMatrixLoadIdentityCHROMIUM(
1924 GLenum matrixMode) { 2697 GLenum matrixMode) {
2698 DCHECK(false) << "UNIMPLEMENTED";
1925 return error::kNoError; 2699 return error::kNoError;
1926 } 2700 }
1927 2701
1928 error::Error GLES2DecoderPassthroughImpl::DoGenPathsCHROMIUM(GLuint path, 2702 error::Error GLES2DecoderPassthroughImpl::DoGenPathsCHROMIUM(GLuint path,
1929 GLsizei range) { 2703 GLsizei range) {
2704 DCHECK(false) << "UNIMPLEMENTED";
1930 return error::kNoError; 2705 return error::kNoError;
1931 } 2706 }
1932 2707
1933 error::Error GLES2DecoderPassthroughImpl::DoDeletePathsCHROMIUM(GLuint path, 2708 error::Error GLES2DecoderPassthroughImpl::DoDeletePathsCHROMIUM(GLuint path,
1934 GLsizei range) { 2709 GLsizei range) {
2710 DCHECK(false) << "UNIMPLEMENTED";
1935 return error::kNoError; 2711 return error::kNoError;
1936 } 2712 }
1937 2713
1938 error::Error GLES2DecoderPassthroughImpl::DoIsPathCHROMIUM(GLuint path, 2714 error::Error GLES2DecoderPassthroughImpl::DoIsPathCHROMIUM(GLuint path,
1939 uint32_t* result) { 2715 uint32_t* result) {
2716 DCHECK(false) << "UNIMPLEMENTED";
1940 return error::kNoError; 2717 return error::kNoError;
1941 } 2718 }
1942 2719
1943 error::Error GLES2DecoderPassthroughImpl::DoPathCommandsCHROMIUM( 2720 error::Error GLES2DecoderPassthroughImpl::DoPathCommandsCHROMIUM(
1944 GLuint path, 2721 GLuint path,
1945 GLsizei numCommands, 2722 GLsizei numCommands,
1946 const GLubyte* commands, 2723 const GLubyte* commands,
1947 GLsizei numCoords, 2724 GLsizei numCoords,
1948 GLenum coordType, 2725 GLenum coordType,
1949 const GLvoid* coords, 2726 const GLvoid* coords,
1950 GLsizei coords_bufsize) { 2727 GLsizei coords_bufsize) {
2728 DCHECK(false) << "UNIMPLEMENTED";
1951 return error::kNoError; 2729 return error::kNoError;
1952 } 2730 }
1953 2731
1954 error::Error GLES2DecoderPassthroughImpl::DoPathParameterfCHROMIUM( 2732 error::Error GLES2DecoderPassthroughImpl::DoPathParameterfCHROMIUM(
1955 GLuint path, 2733 GLuint path,
1956 GLenum pname, 2734 GLenum pname,
1957 GLfloat value) { 2735 GLfloat value) {
2736 DCHECK(false) << "UNIMPLEMENTED";
1958 return error::kNoError; 2737 return error::kNoError;
1959 } 2738 }
1960 2739
1961 error::Error GLES2DecoderPassthroughImpl::DoPathParameteriCHROMIUM( 2740 error::Error GLES2DecoderPassthroughImpl::DoPathParameteriCHROMIUM(
1962 GLuint path, 2741 GLuint path,
1963 GLenum pname, 2742 GLenum pname,
1964 GLint value) { 2743 GLint value) {
2744 DCHECK(false) << "UNIMPLEMENTED";
1965 return error::kNoError; 2745 return error::kNoError;
1966 } 2746 }
1967 2747
1968 error::Error GLES2DecoderPassthroughImpl::DoPathStencilFuncCHROMIUM( 2748 error::Error GLES2DecoderPassthroughImpl::DoPathStencilFuncCHROMIUM(
1969 GLenum func, 2749 GLenum func,
1970 GLint ref, 2750 GLint ref,
1971 GLuint mask) { 2751 GLuint mask) {
2752 DCHECK(false) << "UNIMPLEMENTED";
1972 return error::kNoError; 2753 return error::kNoError;
1973 } 2754 }
1974 2755
1975 error::Error GLES2DecoderPassthroughImpl::DoStencilFillPathCHROMIUM( 2756 error::Error GLES2DecoderPassthroughImpl::DoStencilFillPathCHROMIUM(
1976 GLuint path, 2757 GLuint path,
1977 GLenum fillMode, 2758 GLenum fillMode,
1978 GLuint mask) { 2759 GLuint mask) {
2760 DCHECK(false) << "UNIMPLEMENTED";
1979 return error::kNoError; 2761 return error::kNoError;
1980 } 2762 }
1981 2763
1982 error::Error GLES2DecoderPassthroughImpl::DoStencilStrokePathCHROMIUM( 2764 error::Error GLES2DecoderPassthroughImpl::DoStencilStrokePathCHROMIUM(
1983 GLuint path, 2765 GLuint path,
1984 GLint reference, 2766 GLint reference,
1985 GLuint mask) { 2767 GLuint mask) {
2768 DCHECK(false) << "UNIMPLEMENTED";
1986 return error::kNoError; 2769 return error::kNoError;
1987 } 2770 }
1988 2771
1989 error::Error GLES2DecoderPassthroughImpl::DoCoverFillPathCHROMIUM( 2772 error::Error GLES2DecoderPassthroughImpl::DoCoverFillPathCHROMIUM(
1990 GLuint path, 2773 GLuint path,
1991 GLenum coverMode) { 2774 GLenum coverMode) {
2775 DCHECK(false) << "UNIMPLEMENTED";
1992 return error::kNoError; 2776 return error::kNoError;
1993 } 2777 }
1994 2778
1995 error::Error GLES2DecoderPassthroughImpl::DoCoverStrokePathCHROMIUM( 2779 error::Error GLES2DecoderPassthroughImpl::DoCoverStrokePathCHROMIUM(
1996 GLuint path, 2780 GLuint path,
1997 GLenum coverMode) { 2781 GLenum coverMode) {
2782 DCHECK(false) << "UNIMPLEMENTED";
1998 return error::kNoError; 2783 return error::kNoError;
1999 } 2784 }
2000 2785
2001 error::Error GLES2DecoderPassthroughImpl::DoStencilThenCoverFillPathCHROMIUM( 2786 error::Error GLES2DecoderPassthroughImpl::DoStencilThenCoverFillPathCHROMIUM(
2002 GLuint path, 2787 GLuint path,
2003 GLenum fillMode, 2788 GLenum fillMode,
2004 GLuint mask, 2789 GLuint mask,
2005 GLenum coverMode) { 2790 GLenum coverMode) {
2791 DCHECK(false) << "UNIMPLEMENTED";
2006 return error::kNoError; 2792 return error::kNoError;
2007 } 2793 }
2008 2794
2009 error::Error GLES2DecoderPassthroughImpl::DoStencilThenCoverStrokePathCHROMIUM( 2795 error::Error GLES2DecoderPassthroughImpl::DoStencilThenCoverStrokePathCHROMIUM(
2010 GLuint path, 2796 GLuint path,
2011 GLint reference, 2797 GLint reference,
2012 GLuint mask, 2798 GLuint mask,
2013 GLenum coverMode) { 2799 GLenum coverMode) {
2800 DCHECK(false) << "UNIMPLEMENTED";
2014 return error::kNoError; 2801 return error::kNoError;
2015 } 2802 }
2016 2803
2017 error::Error GLES2DecoderPassthroughImpl::DoStencilFillPathInstancedCHROMIUM( 2804 error::Error GLES2DecoderPassthroughImpl::DoStencilFillPathInstancedCHROMIUM(
2018 GLsizei numPaths, 2805 GLsizei numPaths,
2019 GLenum pathNameType, 2806 GLenum pathNameType,
2020 const GLvoid* paths, 2807 const GLvoid* paths,
2021 GLsizei pathsBufsize, 2808 GLsizei pathsBufsize,
2022 GLuint pathBase, 2809 GLuint pathBase,
2023 GLenum fillMode, 2810 GLenum fillMode,
2024 GLuint mask, 2811 GLuint mask,
2025 GLenum transformType, 2812 GLenum transformType,
2026 const GLfloat* transformValues, 2813 const GLfloat* transformValues,
2027 GLsizei transformValuesBufsize) { 2814 GLsizei transformValuesBufsize) {
2815 DCHECK(false) << "UNIMPLEMENTED";
2028 return error::kNoError; 2816 return error::kNoError;
2029 } 2817 }
2030 2818
2031 error::Error GLES2DecoderPassthroughImpl::DoStencilStrokePathInstancedCHROMIUM( 2819 error::Error GLES2DecoderPassthroughImpl::DoStencilStrokePathInstancedCHROMIUM(
2032 GLsizei numPaths, 2820 GLsizei numPaths,
2033 GLenum pathNameType, 2821 GLenum pathNameType,
2034 const GLvoid* paths, 2822 const GLvoid* paths,
2035 GLsizei pathsBufsize, 2823 GLsizei pathsBufsize,
2036 GLuint pathBase, 2824 GLuint pathBase,
2037 GLint reference, 2825 GLint reference,
2038 GLuint mask, 2826 GLuint mask,
2039 GLenum transformType, 2827 GLenum transformType,
2040 const GLfloat* transformValues, 2828 const GLfloat* transformValues,
2041 GLsizei transformValuesBufsize) { 2829 GLsizei transformValuesBufsize) {
2830 DCHECK(false) << "UNIMPLEMENTED";
2042 return error::kNoError; 2831 return error::kNoError;
2043 } 2832 }
2044 2833
2045 error::Error GLES2DecoderPassthroughImpl::DoCoverFillPathInstancedCHROMIUM( 2834 error::Error GLES2DecoderPassthroughImpl::DoCoverFillPathInstancedCHROMIUM(
2046 GLsizei numPaths, 2835 GLsizei numPaths,
2047 GLenum pathNameType, 2836 GLenum pathNameType,
2048 const GLvoid* paths, 2837 const GLvoid* paths,
2049 GLsizei pathsBufsize, 2838 GLsizei pathsBufsize,
2050 GLuint pathBase, 2839 GLuint pathBase,
2051 GLenum coverMode, 2840 GLenum coverMode,
2052 GLenum transformType, 2841 GLenum transformType,
2053 const GLfloat* transformValues, 2842 const GLfloat* transformValues,
2054 GLsizei transformValuesBufsize) { 2843 GLsizei transformValuesBufsize) {
2844 DCHECK(false) << "UNIMPLEMENTED";
2055 return error::kNoError; 2845 return error::kNoError;
2056 } 2846 }
2057 2847
2058 error::Error GLES2DecoderPassthroughImpl::DoCoverStrokePathInstancedCHROMIUM( 2848 error::Error GLES2DecoderPassthroughImpl::DoCoverStrokePathInstancedCHROMIUM(
2059 GLsizei numPaths, 2849 GLsizei numPaths,
2060 GLenum pathNameType, 2850 GLenum pathNameType,
2061 const GLvoid* paths, 2851 const GLvoid* paths,
2062 GLsizei pathsBufsize, 2852 GLsizei pathsBufsize,
2063 GLuint pathBase, 2853 GLuint pathBase,
2064 GLenum coverMode, 2854 GLenum coverMode,
2065 GLenum transformType, 2855 GLenum transformType,
2066 const GLfloat* transformValues, 2856 const GLfloat* transformValues,
2067 GLsizei transformValuesBufsize) { 2857 GLsizei transformValuesBufsize) {
2858 DCHECK(false) << "UNIMPLEMENTED";
2068 return error::kNoError; 2859 return error::kNoError;
2069 } 2860 }
2070 2861
2071 error::Error 2862 error::Error
2072 GLES2DecoderPassthroughImpl::DoStencilThenCoverFillPathInstancedCHROMIUM( 2863 GLES2DecoderPassthroughImpl::DoStencilThenCoverFillPathInstancedCHROMIUM(
2073 GLsizei numPaths, 2864 GLsizei numPaths,
2074 GLenum pathNameType, 2865 GLenum pathNameType,
2075 const GLvoid* paths, 2866 const GLvoid* paths,
2076 GLsizei pathsBufsize, 2867 GLsizei pathsBufsize,
2077 GLuint pathBase, 2868 GLuint pathBase,
2078 GLenum fillMode, 2869 GLenum fillMode,
2079 GLuint mask, 2870 GLuint mask,
2080 GLenum coverMode, 2871 GLenum coverMode,
2081 GLenum transformType, 2872 GLenum transformType,
2082 const GLfloat* transformValues, 2873 const GLfloat* transformValues,
2083 GLsizei transformValuesBufsize) { 2874 GLsizei transformValuesBufsize) {
2875 DCHECK(false) << "UNIMPLEMENTED";
2084 return error::kNoError; 2876 return error::kNoError;
2085 } 2877 }
2086 2878
2087 error::Error 2879 error::Error
2088 GLES2DecoderPassthroughImpl::DoStencilThenCoverStrokePathInstancedCHROMIUM( 2880 GLES2DecoderPassthroughImpl::DoStencilThenCoverStrokePathInstancedCHROMIUM(
2089 GLsizei numPaths, 2881 GLsizei numPaths,
2090 GLenum pathNameType, 2882 GLenum pathNameType,
2091 const GLvoid* paths, 2883 const GLvoid* paths,
2092 GLsizei pathsBufsize, 2884 GLsizei pathsBufsize,
2093 GLuint pathBase, 2885 GLuint pathBase,
2094 GLint reference, 2886 GLint reference,
2095 GLuint mask, 2887 GLuint mask,
2096 GLenum coverMode, 2888 GLenum coverMode,
2097 GLenum transformType, 2889 GLenum transformType,
2098 const GLfloat* transformValues, 2890 const GLfloat* transformValues,
2099 GLsizei transformValuesBufsize) { 2891 GLsizei transformValuesBufsize) {
2892 DCHECK(false) << "UNIMPLEMENTED";
2100 return error::kNoError; 2893 return error::kNoError;
2101 } 2894 }
2102 2895
2103 error::Error GLES2DecoderPassthroughImpl::DoBindFragmentInputLocationCHROMIUM( 2896 error::Error GLES2DecoderPassthroughImpl::DoBindFragmentInputLocationCHROMIUM(
2104 GLuint program, 2897 GLuint program,
2105 GLint location, 2898 GLint location,
2106 const char* name) { 2899 const char* name) {
2900 DCHECK(false) << "UNIMPLEMENTED";
2107 return error::kNoError; 2901 return error::kNoError;
2108 } 2902 }
2109 2903
2110 error::Error GLES2DecoderPassthroughImpl::DoProgramPathFragmentInputGenCHROMIUM( 2904 error::Error GLES2DecoderPassthroughImpl::DoProgramPathFragmentInputGenCHROMIUM(
2111 GLuint program, 2905 GLuint program,
2112 GLint location, 2906 GLint location,
2113 GLenum genMode, 2907 GLenum genMode,
2114 GLint components, 2908 GLint components,
2115 const GLfloat* coeffs, 2909 const GLfloat* coeffs,
2116 GLsizei coeffsBufsize) { 2910 GLsizei coeffsBufsize) {
2911 DCHECK(false) << "UNIMPLEMENTED";
2117 return error::kNoError; 2912 return error::kNoError;
2118 } 2913 }
2119 2914
2120 error::Error GLES2DecoderPassthroughImpl::DoCoverageModulationCHROMIUM( 2915 error::Error GLES2DecoderPassthroughImpl::DoCoverageModulationCHROMIUM(
2121 GLenum components) { 2916 GLenum components) {
2917 DCHECK(false) << "UNIMPLEMENTED";
2122 return error::kNoError; 2918 return error::kNoError;
2123 } 2919 }
2124 2920
2125 error::Error GLES2DecoderPassthroughImpl::DoBlendBarrierKHR() { 2921 error::Error GLES2DecoderPassthroughImpl::DoBlendBarrierKHR() {
2922 DCHECK(false) << "UNIMPLEMENTED";
2126 return error::kNoError; 2923 return error::kNoError;
2127 } 2924 }
2128 2925
2129 error::Error 2926 error::Error
2130 GLES2DecoderPassthroughImpl::DoApplyScreenSpaceAntialiasingCHROMIUM() { 2927 GLES2DecoderPassthroughImpl::DoApplyScreenSpaceAntialiasingCHROMIUM() {
2928 DCHECK(false) << "UNIMPLEMENTED";
2131 return error::kNoError; 2929 return error::kNoError;
2132 } 2930 }
2133 2931
2134 error::Error GLES2DecoderPassthroughImpl::DoBindFragDataLocationIndexedEXT( 2932 error::Error GLES2DecoderPassthroughImpl::DoBindFragDataLocationIndexedEXT(
2135 GLuint program, 2933 GLuint program,
2136 GLuint colorNumber, 2934 GLuint colorNumber,
2137 GLuint index, 2935 GLuint index,
2138 const char* name) { 2936 const char* name) {
2937 DCHECK(false) << "UNIMPLEMENTED";
2139 return error::kNoError; 2938 return error::kNoError;
2140 } 2939 }
2141 2940
2142 error::Error GLES2DecoderPassthroughImpl::DoBindFragDataLocationEXT( 2941 error::Error GLES2DecoderPassthroughImpl::DoBindFragDataLocationEXT(
2143 GLuint program, 2942 GLuint program,
2144 GLuint colorNumber, 2943 GLuint colorNumber,
2145 const char* name) { 2944 const char* name) {
2945 DCHECK(false) << "UNIMPLEMENTED";
2146 return error::kNoError; 2946 return error::kNoError;
2147 } 2947 }
2148 2948
2149 error::Error GLES2DecoderPassthroughImpl::DoGetFragDataIndexEXT( 2949 error::Error GLES2DecoderPassthroughImpl::DoGetFragDataIndexEXT(
2150 GLuint program, 2950 GLuint program,
2151 const char* name, 2951 const char* name,
2152 GLint* index) { 2952 GLint* index) {
2953 DCHECK(false) << "UNIMPLEMENTED";
2153 return error::kNoError; 2954 return error::kNoError;
2154 } 2955 }
2155 2956
2156 error::Error 2957 error::Error
2157 GLES2DecoderPassthroughImpl::DoUniformMatrix4fvStreamTextureMatrixCHROMIUM( 2958 GLES2DecoderPassthroughImpl::DoUniformMatrix4fvStreamTextureMatrixCHROMIUM(
2158 GLint location, 2959 GLint location,
2159 GLboolean transpose, 2960 GLboolean transpose,
2160 const volatile GLfloat* defaultValue) { 2961 const volatile GLfloat* defaultValue) {
2962 DCHECK(false) << "UNIMPLEMENTED";
2161 return error::kNoError; 2963 return error::kNoError;
2162 } 2964 }
2163 2965
2164 } // namespace gles2 2966 } // namespace gles2
2165 } // namespace gpu 2967 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698