Fix crash on app list start page keyboard navigation with <4 apps.
[chromium-blink-merge.git] / gpu / command_buffer / client / gles2_implementation_impl_autogen.h
blob625c7473af16d2f27a780be27faca48f03fbbd15
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 // This file is auto-generated from
6 // gpu/command_buffer/build_gles2_cmd_buffer.py
7 // It's formatted by clang-format using chromium coding style:
8 // clang-format -i -style=chromium filename
9 // DO NOT EDIT!
11 // This file is included by gles2_implementation.cc to define the
12 // GL api functions.
13 #ifndef GPU_COMMAND_BUFFER_CLIENT_GLES2_IMPLEMENTATION_IMPL_AUTOGEN_H_
14 #define GPU_COMMAND_BUFFER_CLIENT_GLES2_IMPLEMENTATION_IMPL_AUTOGEN_H_
16 void GLES2Implementation::AttachShader(GLuint program, GLuint shader) {
17 GPU_CLIENT_SINGLE_THREAD_CHECK();
18 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glAttachShader(" << program << ", "
19 << shader << ")");
20 helper_->AttachShader(program, shader);
21 CheckGLError();
24 void GLES2Implementation::BindBuffer(GLenum target, GLuint buffer) {
25 GPU_CLIENT_SINGLE_THREAD_CHECK();
26 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBindBuffer("
27 << GLES2Util::GetStringBufferTarget(target) << ", "
28 << buffer << ")");
29 if (IsBufferReservedId(buffer)) {
30 SetGLError(GL_INVALID_OPERATION, "BindBuffer", "buffer reserved id");
31 return;
33 BindBufferHelper(target, buffer);
34 CheckGLError();
37 void GLES2Implementation::BindBufferBase(GLenum target,
38 GLuint index,
39 GLuint buffer) {
40 GPU_CLIENT_SINGLE_THREAD_CHECK();
41 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBindBufferBase("
42 << GLES2Util::GetStringIndexedBufferTarget(target) << ", "
43 << index << ", " << buffer << ")");
44 if (IsBufferReservedId(buffer)) {
45 SetGLError(GL_INVALID_OPERATION, "BindBufferBase", "buffer reserved id");
46 return;
48 BindBufferBaseHelper(target, index, buffer);
49 CheckGLError();
52 void GLES2Implementation::BindBufferRange(GLenum target,
53 GLuint index,
54 GLuint buffer,
55 GLintptr offset,
56 GLsizeiptr size) {
57 GPU_CLIENT_SINGLE_THREAD_CHECK();
58 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBindBufferRange("
59 << GLES2Util::GetStringIndexedBufferTarget(target) << ", "
60 << index << ", " << buffer << ", " << offset << ", "
61 << size << ")");
62 if (offset < 0) {
63 SetGLError(GL_INVALID_VALUE, "glBindBufferRange", "offset < 0");
64 return;
66 if (size < 0) {
67 SetGLError(GL_INVALID_VALUE, "glBindBufferRange", "size < 0");
68 return;
70 if (IsBufferReservedId(buffer)) {
71 SetGLError(GL_INVALID_OPERATION, "BindBufferRange", "buffer reserved id");
72 return;
74 BindBufferRangeHelper(target, index, buffer, offset, size);
75 CheckGLError();
78 void GLES2Implementation::BindFramebuffer(GLenum target, GLuint framebuffer) {
79 GPU_CLIENT_SINGLE_THREAD_CHECK();
80 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBindFramebuffer("
81 << GLES2Util::GetStringFrameBufferTarget(target) << ", "
82 << framebuffer << ")");
83 if (IsFramebufferReservedId(framebuffer)) {
84 SetGLError(GL_INVALID_OPERATION, "BindFramebuffer",
85 "framebuffer reserved id");
86 return;
88 BindFramebufferHelper(target, framebuffer);
89 CheckGLError();
92 void GLES2Implementation::BindRenderbuffer(GLenum target, GLuint renderbuffer) {
93 GPU_CLIENT_SINGLE_THREAD_CHECK();
94 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBindRenderbuffer("
95 << GLES2Util::GetStringRenderBufferTarget(target) << ", "
96 << renderbuffer << ")");
97 if (IsRenderbufferReservedId(renderbuffer)) {
98 SetGLError(GL_INVALID_OPERATION, "BindRenderbuffer",
99 "renderbuffer reserved id");
100 return;
102 BindRenderbufferHelper(target, renderbuffer);
103 CheckGLError();
106 void GLES2Implementation::BindSampler(GLuint unit, GLuint sampler) {
107 GPU_CLIENT_SINGLE_THREAD_CHECK();
108 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBindSampler(" << unit << ", "
109 << sampler << ")");
110 if (IsSamplerReservedId(sampler)) {
111 SetGLError(GL_INVALID_OPERATION, "BindSampler", "sampler reserved id");
112 return;
114 BindSamplerHelper(unit, sampler);
115 CheckGLError();
118 void GLES2Implementation::BindTexture(GLenum target, GLuint texture) {
119 GPU_CLIENT_SINGLE_THREAD_CHECK();
120 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBindTexture("
121 << GLES2Util::GetStringTextureBindTarget(target) << ", "
122 << texture << ")");
123 if (IsTextureReservedId(texture)) {
124 SetGLError(GL_INVALID_OPERATION, "BindTexture", "texture reserved id");
125 return;
127 BindTextureHelper(target, texture);
128 CheckGLError();
131 void GLES2Implementation::BindTransformFeedback(GLenum target,
132 GLuint transformfeedback) {
133 GPU_CLIENT_SINGLE_THREAD_CHECK();
134 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBindTransformFeedback("
135 << GLES2Util::GetStringTransformFeedbackBindTarget(target)
136 << ", " << transformfeedback << ")");
137 if (IsTransformFeedbackReservedId(transformfeedback)) {
138 SetGLError(GL_INVALID_OPERATION, "BindTransformFeedback",
139 "transformfeedback reserved id");
140 return;
142 BindTransformFeedbackHelper(target, transformfeedback);
143 CheckGLError();
146 void GLES2Implementation::BlendColor(GLclampf red,
147 GLclampf green,
148 GLclampf blue,
149 GLclampf alpha) {
150 GPU_CLIENT_SINGLE_THREAD_CHECK();
151 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBlendColor(" << red << ", "
152 << green << ", " << blue << ", " << alpha << ")");
153 helper_->BlendColor(red, green, blue, alpha);
154 CheckGLError();
157 void GLES2Implementation::BlendEquation(GLenum mode) {
158 GPU_CLIENT_SINGLE_THREAD_CHECK();
159 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBlendEquation("
160 << GLES2Util::GetStringEquation(mode) << ")");
161 helper_->BlendEquation(mode);
162 CheckGLError();
165 void GLES2Implementation::BlendEquationSeparate(GLenum modeRGB,
166 GLenum modeAlpha) {
167 GPU_CLIENT_SINGLE_THREAD_CHECK();
168 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBlendEquationSeparate("
169 << GLES2Util::GetStringEquation(modeRGB) << ", "
170 << GLES2Util::GetStringEquation(modeAlpha) << ")");
171 helper_->BlendEquationSeparate(modeRGB, modeAlpha);
172 CheckGLError();
175 void GLES2Implementation::BlendFunc(GLenum sfactor, GLenum dfactor) {
176 GPU_CLIENT_SINGLE_THREAD_CHECK();
177 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBlendFunc("
178 << GLES2Util::GetStringSrcBlendFactor(sfactor) << ", "
179 << GLES2Util::GetStringDstBlendFactor(dfactor) << ")");
180 helper_->BlendFunc(sfactor, dfactor);
181 CheckGLError();
184 void GLES2Implementation::BlendFuncSeparate(GLenum srcRGB,
185 GLenum dstRGB,
186 GLenum srcAlpha,
187 GLenum dstAlpha) {
188 GPU_CLIENT_SINGLE_THREAD_CHECK();
189 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBlendFuncSeparate("
190 << GLES2Util::GetStringSrcBlendFactor(srcRGB) << ", "
191 << GLES2Util::GetStringDstBlendFactor(dstRGB) << ", "
192 << GLES2Util::GetStringSrcBlendFactor(srcAlpha) << ", "
193 << GLES2Util::GetStringDstBlendFactor(dstAlpha) << ")");
194 helper_->BlendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha);
195 CheckGLError();
198 GLenum GLES2Implementation::CheckFramebufferStatus(GLenum target) {
199 GPU_CLIENT_SINGLE_THREAD_CHECK();
200 TRACE_EVENT0("gpu", "GLES2Implementation::CheckFramebufferStatus");
201 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glCheckFramebufferStatus("
202 << GLES2Util::GetStringFrameBufferTarget(target) << ")");
203 typedef cmds::CheckFramebufferStatus::Result Result;
204 Result* result = GetResultAs<Result*>();
205 if (!result) {
206 return GL_FRAMEBUFFER_UNSUPPORTED;
208 *result = 0;
209 helper_->CheckFramebufferStatus(target, GetResultShmId(),
210 GetResultShmOffset());
211 WaitForCmd();
212 GLenum result_value = *result;
213 GPU_CLIENT_LOG("returned " << result_value);
214 CheckGLError();
215 return result_value;
218 void GLES2Implementation::Clear(GLbitfield mask) {
219 GPU_CLIENT_SINGLE_THREAD_CHECK();
220 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glClear(" << mask << ")");
221 helper_->Clear(mask);
222 CheckGLError();
225 void GLES2Implementation::ClearBufferfi(GLenum buffer,
226 GLint drawbuffers,
227 GLfloat depth,
228 GLint stencil) {
229 GPU_CLIENT_SINGLE_THREAD_CHECK();
230 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glClearBufferfi("
231 << GLES2Util::GetStringBufferfv(buffer) << ", "
232 << drawbuffers << ", " << depth << ", " << stencil << ")");
233 helper_->ClearBufferfi(buffer, drawbuffers, depth, stencil);
234 CheckGLError();
237 void GLES2Implementation::ClearBufferfv(GLenum buffer,
238 GLint drawbuffers,
239 const GLfloat* value) {
240 GPU_CLIENT_SINGLE_THREAD_CHECK();
241 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glClearBufferfv("
242 << GLES2Util::GetStringBufferfv(buffer) << ", "
243 << drawbuffers << ", " << static_cast<const void*>(value)
244 << ")");
245 size_t count = GLES2Util::CalcClearBufferfvDataCount(buffer);
246 DCHECK_LE(count, 4u);
247 for (size_t ii = 0; ii < count; ++ii)
248 GPU_CLIENT_LOG("value[" << ii << "]: " << value[ii]);
249 helper_->ClearBufferfvImmediate(buffer, drawbuffers, value);
250 CheckGLError();
253 void GLES2Implementation::ClearBufferiv(GLenum buffer,
254 GLint drawbuffers,
255 const GLint* value) {
256 GPU_CLIENT_SINGLE_THREAD_CHECK();
257 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glClearBufferiv("
258 << GLES2Util::GetStringBufferiv(buffer) << ", "
259 << drawbuffers << ", " << static_cast<const void*>(value)
260 << ")");
261 size_t count = GLES2Util::CalcClearBufferivDataCount(buffer);
262 DCHECK_LE(count, 4u);
263 for (size_t ii = 0; ii < count; ++ii)
264 GPU_CLIENT_LOG("value[" << ii << "]: " << value[ii]);
265 helper_->ClearBufferivImmediate(buffer, drawbuffers, value);
266 CheckGLError();
269 void GLES2Implementation::ClearBufferuiv(GLenum buffer,
270 GLint drawbuffers,
271 const GLuint* value) {
272 GPU_CLIENT_SINGLE_THREAD_CHECK();
273 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glClearBufferuiv("
274 << GLES2Util::GetStringBufferuiv(buffer) << ", "
275 << drawbuffers << ", " << static_cast<const void*>(value)
276 << ")");
277 size_t count = 4;
278 for (size_t ii = 0; ii < count; ++ii)
279 GPU_CLIENT_LOG("value[" << ii << "]: " << value[ii]);
280 helper_->ClearBufferuivImmediate(buffer, drawbuffers, value);
281 CheckGLError();
284 void GLES2Implementation::ClearColor(GLclampf red,
285 GLclampf green,
286 GLclampf blue,
287 GLclampf alpha) {
288 GPU_CLIENT_SINGLE_THREAD_CHECK();
289 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glClearColor(" << red << ", "
290 << green << ", " << blue << ", " << alpha << ")");
291 helper_->ClearColor(red, green, blue, alpha);
292 CheckGLError();
295 void GLES2Implementation::ClearDepthf(GLclampf depth) {
296 GPU_CLIENT_SINGLE_THREAD_CHECK();
297 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glClearDepthf(" << depth << ")");
298 helper_->ClearDepthf(depth);
299 CheckGLError();
302 void GLES2Implementation::ClearStencil(GLint s) {
303 GPU_CLIENT_SINGLE_THREAD_CHECK();
304 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glClearStencil(" << s << ")");
305 helper_->ClearStencil(s);
306 CheckGLError();
309 void GLES2Implementation::ColorMask(GLboolean red,
310 GLboolean green,
311 GLboolean blue,
312 GLboolean alpha) {
313 GPU_CLIENT_SINGLE_THREAD_CHECK();
314 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glColorMask("
315 << GLES2Util::GetStringBool(red) << ", "
316 << GLES2Util::GetStringBool(green) << ", "
317 << GLES2Util::GetStringBool(blue) << ", "
318 << GLES2Util::GetStringBool(alpha) << ")");
319 helper_->ColorMask(red, green, blue, alpha);
320 CheckGLError();
323 void GLES2Implementation::CompileShader(GLuint shader) {
324 GPU_CLIENT_SINGLE_THREAD_CHECK();
325 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glCompileShader(" << shader
326 << ")");
327 helper_->CompileShader(shader);
328 CheckGLError();
331 void GLES2Implementation::CopyBufferSubData(GLenum readtarget,
332 GLenum writetarget,
333 GLintptr readoffset,
334 GLintptr writeoffset,
335 GLsizeiptr size) {
336 GPU_CLIENT_SINGLE_THREAD_CHECK();
337 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glCopyBufferSubData("
338 << GLES2Util::GetStringBufferTarget(readtarget) << ", "
339 << GLES2Util::GetStringBufferTarget(writetarget) << ", "
340 << readoffset << ", " << writeoffset << ", " << size
341 << ")");
342 if (readoffset < 0) {
343 SetGLError(GL_INVALID_VALUE, "glCopyBufferSubData", "readoffset < 0");
344 return;
346 if (writeoffset < 0) {
347 SetGLError(GL_INVALID_VALUE, "glCopyBufferSubData", "writeoffset < 0");
348 return;
350 if (size < 0) {
351 SetGLError(GL_INVALID_VALUE, "glCopyBufferSubData", "size < 0");
352 return;
354 helper_->CopyBufferSubData(readtarget, writetarget, readoffset, writeoffset,
355 size);
356 CheckGLError();
359 void GLES2Implementation::CopyTexImage2D(GLenum target,
360 GLint level,
361 GLenum internalformat,
362 GLint x,
363 GLint y,
364 GLsizei width,
365 GLsizei height,
366 GLint border) {
367 GPU_CLIENT_SINGLE_THREAD_CHECK();
368 GPU_CLIENT_LOG(
369 "[" << GetLogPrefix() << "] glCopyTexImage2D("
370 << GLES2Util::GetStringTextureTarget(target) << ", " << level << ", "
371 << GLES2Util::GetStringTextureInternalFormat(internalformat) << ", "
372 << x << ", " << y << ", " << width << ", " << height << ", " << border
373 << ")");
374 if (width < 0) {
375 SetGLError(GL_INVALID_VALUE, "glCopyTexImage2D", "width < 0");
376 return;
378 if (height < 0) {
379 SetGLError(GL_INVALID_VALUE, "glCopyTexImage2D", "height < 0");
380 return;
382 if (border != 0) {
383 SetGLError(GL_INVALID_VALUE, "glCopyTexImage2D", "border GL_INVALID_VALUE");
384 return;
386 helper_->CopyTexImage2D(target, level, internalformat, x, y, width, height);
387 CheckGLError();
390 void GLES2Implementation::CopyTexSubImage2D(GLenum target,
391 GLint level,
392 GLint xoffset,
393 GLint yoffset,
394 GLint x,
395 GLint y,
396 GLsizei width,
397 GLsizei height) {
398 GPU_CLIENT_SINGLE_THREAD_CHECK();
399 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glCopyTexSubImage2D("
400 << GLES2Util::GetStringTextureTarget(target) << ", "
401 << level << ", " << xoffset << ", " << yoffset << ", " << x
402 << ", " << y << ", " << width << ", " << height << ")");
403 if (width < 0) {
404 SetGLError(GL_INVALID_VALUE, "glCopyTexSubImage2D", "width < 0");
405 return;
407 if (height < 0) {
408 SetGLError(GL_INVALID_VALUE, "glCopyTexSubImage2D", "height < 0");
409 return;
411 helper_->CopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width,
412 height);
413 CheckGLError();
416 void GLES2Implementation::CopyTexSubImage3D(GLenum target,
417 GLint level,
418 GLint xoffset,
419 GLint yoffset,
420 GLint zoffset,
421 GLint x,
422 GLint y,
423 GLsizei width,
424 GLsizei height) {
425 GPU_CLIENT_SINGLE_THREAD_CHECK();
426 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glCopyTexSubImage3D("
427 << GLES2Util::GetStringTexture3DTarget(target) << ", "
428 << level << ", " << xoffset << ", " << yoffset << ", "
429 << zoffset << ", " << x << ", " << y << ", " << width
430 << ", " << height << ")");
431 if (width < 0) {
432 SetGLError(GL_INVALID_VALUE, "glCopyTexSubImage3D", "width < 0");
433 return;
435 if (height < 0) {
436 SetGLError(GL_INVALID_VALUE, "glCopyTexSubImage3D", "height < 0");
437 return;
439 helper_->CopyTexSubImage3D(target, level, xoffset, yoffset, zoffset, x, y,
440 width, height);
441 CheckGLError();
444 GLuint GLES2Implementation::CreateProgram() {
445 GPU_CLIENT_SINGLE_THREAD_CHECK();
446 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glCreateProgram("
447 << ")");
448 GLuint client_id;
449 GetIdHandler(id_namespaces::kProgramsAndShaders)
450 ->MakeIds(this, 0, 1, &client_id);
451 helper_->CreateProgram(client_id);
452 GPU_CLIENT_LOG("returned " << client_id);
453 CheckGLError();
454 return client_id;
457 GLuint GLES2Implementation::CreateShader(GLenum type) {
458 GPU_CLIENT_SINGLE_THREAD_CHECK();
459 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glCreateShader("
460 << GLES2Util::GetStringShaderType(type) << ")");
461 GLuint client_id;
462 GetIdHandler(id_namespaces::kProgramsAndShaders)
463 ->MakeIds(this, 0, 1, &client_id);
464 helper_->CreateShader(type, client_id);
465 GPU_CLIENT_LOG("returned " << client_id);
466 CheckGLError();
467 return client_id;
470 void GLES2Implementation::CullFace(GLenum mode) {
471 GPU_CLIENT_SINGLE_THREAD_CHECK();
472 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glCullFace("
473 << GLES2Util::GetStringFaceType(mode) << ")");
474 helper_->CullFace(mode);
475 CheckGLError();
478 void GLES2Implementation::DeleteBuffers(GLsizei n, const GLuint* buffers) {
479 GPU_CLIENT_SINGLE_THREAD_CHECK();
480 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDeleteBuffers(" << n << ", "
481 << static_cast<const void*>(buffers) << ")");
482 GPU_CLIENT_LOG_CODE_BLOCK({
483 for (GLsizei i = 0; i < n; ++i) {
484 GPU_CLIENT_LOG(" " << i << ": " << buffers[i]);
487 GPU_CLIENT_DCHECK_CODE_BLOCK({
488 for (GLsizei i = 0; i < n; ++i) {
489 DCHECK(buffers[i] != 0);
492 if (n < 0) {
493 SetGLError(GL_INVALID_VALUE, "glDeleteBuffers", "n < 0");
494 return;
496 DeleteBuffersHelper(n, buffers);
497 CheckGLError();
500 void GLES2Implementation::DeleteFramebuffers(GLsizei n,
501 const GLuint* framebuffers) {
502 GPU_CLIENT_SINGLE_THREAD_CHECK();
503 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDeleteFramebuffers(" << n << ", "
504 << static_cast<const void*>(framebuffers) << ")");
505 GPU_CLIENT_LOG_CODE_BLOCK({
506 for (GLsizei i = 0; i < n; ++i) {
507 GPU_CLIENT_LOG(" " << i << ": " << framebuffers[i]);
510 GPU_CLIENT_DCHECK_CODE_BLOCK({
511 for (GLsizei i = 0; i < n; ++i) {
512 DCHECK(framebuffers[i] != 0);
515 if (n < 0) {
516 SetGLError(GL_INVALID_VALUE, "glDeleteFramebuffers", "n < 0");
517 return;
519 DeleteFramebuffersHelper(n, framebuffers);
520 CheckGLError();
523 void GLES2Implementation::DeleteProgram(GLuint program) {
524 GPU_CLIENT_SINGLE_THREAD_CHECK();
525 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDeleteProgram(" << program
526 << ")");
527 GPU_CLIENT_DCHECK(program != 0);
528 DeleteProgramHelper(program);
529 CheckGLError();
532 void GLES2Implementation::DeleteRenderbuffers(GLsizei n,
533 const GLuint* renderbuffers) {
534 GPU_CLIENT_SINGLE_THREAD_CHECK();
535 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDeleteRenderbuffers(" << n
536 << ", " << static_cast<const void*>(renderbuffers) << ")");
537 GPU_CLIENT_LOG_CODE_BLOCK({
538 for (GLsizei i = 0; i < n; ++i) {
539 GPU_CLIENT_LOG(" " << i << ": " << renderbuffers[i]);
542 GPU_CLIENT_DCHECK_CODE_BLOCK({
543 for (GLsizei i = 0; i < n; ++i) {
544 DCHECK(renderbuffers[i] != 0);
547 if (n < 0) {
548 SetGLError(GL_INVALID_VALUE, "glDeleteRenderbuffers", "n < 0");
549 return;
551 DeleteRenderbuffersHelper(n, renderbuffers);
552 CheckGLError();
555 void GLES2Implementation::DeleteSamplers(GLsizei n, const GLuint* samplers) {
556 GPU_CLIENT_SINGLE_THREAD_CHECK();
557 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDeleteSamplers(" << n << ", "
558 << static_cast<const void*>(samplers) << ")");
559 GPU_CLIENT_LOG_CODE_BLOCK({
560 for (GLsizei i = 0; i < n; ++i) {
561 GPU_CLIENT_LOG(" " << i << ": " << samplers[i]);
564 GPU_CLIENT_DCHECK_CODE_BLOCK({
565 for (GLsizei i = 0; i < n; ++i) {
566 DCHECK(samplers[i] != 0);
569 if (n < 0) {
570 SetGLError(GL_INVALID_VALUE, "glDeleteSamplers", "n < 0");
571 return;
573 DeleteSamplersHelper(n, samplers);
574 CheckGLError();
577 void GLES2Implementation::DeleteSync(GLsync sync) {
578 GPU_CLIENT_SINGLE_THREAD_CHECK();
579 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDeleteSync(" << sync << ")");
580 GPU_CLIENT_DCHECK(sync != 0);
581 DeleteSyncHelper(sync);
582 CheckGLError();
585 void GLES2Implementation::DeleteShader(GLuint shader) {
586 GPU_CLIENT_SINGLE_THREAD_CHECK();
587 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDeleteShader(" << shader << ")");
588 GPU_CLIENT_DCHECK(shader != 0);
589 DeleteShaderHelper(shader);
590 CheckGLError();
593 void GLES2Implementation::DeleteTextures(GLsizei n, const GLuint* textures) {
594 GPU_CLIENT_SINGLE_THREAD_CHECK();
595 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDeleteTextures(" << n << ", "
596 << static_cast<const void*>(textures) << ")");
597 GPU_CLIENT_LOG_CODE_BLOCK({
598 for (GLsizei i = 0; i < n; ++i) {
599 GPU_CLIENT_LOG(" " << i << ": " << textures[i]);
602 GPU_CLIENT_DCHECK_CODE_BLOCK({
603 for (GLsizei i = 0; i < n; ++i) {
604 DCHECK(textures[i] != 0);
607 if (n < 0) {
608 SetGLError(GL_INVALID_VALUE, "glDeleteTextures", "n < 0");
609 return;
611 DeleteTexturesHelper(n, textures);
612 CheckGLError();
615 void GLES2Implementation::DeleteTransformFeedbacks(GLsizei n,
616 const GLuint* ids) {
617 GPU_CLIENT_SINGLE_THREAD_CHECK();
618 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDeleteTransformFeedbacks(" << n
619 << ", " << static_cast<const void*>(ids) << ")");
620 GPU_CLIENT_LOG_CODE_BLOCK({
621 for (GLsizei i = 0; i < n; ++i) {
622 GPU_CLIENT_LOG(" " << i << ": " << ids[i]);
625 GPU_CLIENT_DCHECK_CODE_BLOCK({
626 for (GLsizei i = 0; i < n; ++i) {
627 DCHECK(ids[i] != 0);
630 if (n < 0) {
631 SetGLError(GL_INVALID_VALUE, "glDeleteTransformFeedbacks", "n < 0");
632 return;
634 DeleteTransformFeedbacksHelper(n, ids);
635 CheckGLError();
638 void GLES2Implementation::DepthFunc(GLenum func) {
639 GPU_CLIENT_SINGLE_THREAD_CHECK();
640 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDepthFunc("
641 << GLES2Util::GetStringCmpFunction(func) << ")");
642 helper_->DepthFunc(func);
643 CheckGLError();
646 void GLES2Implementation::DepthMask(GLboolean flag) {
647 GPU_CLIENT_SINGLE_THREAD_CHECK();
648 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDepthMask("
649 << GLES2Util::GetStringBool(flag) << ")");
650 helper_->DepthMask(flag);
651 CheckGLError();
654 void GLES2Implementation::DepthRangef(GLclampf zNear, GLclampf zFar) {
655 GPU_CLIENT_SINGLE_THREAD_CHECK();
656 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDepthRangef(" << zNear << ", "
657 << zFar << ")");
658 helper_->DepthRangef(zNear, zFar);
659 CheckGLError();
662 void GLES2Implementation::DetachShader(GLuint program, GLuint shader) {
663 GPU_CLIENT_SINGLE_THREAD_CHECK();
664 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDetachShader(" << program << ", "
665 << shader << ")");
666 helper_->DetachShader(program, shader);
667 CheckGLError();
670 GLsync GLES2Implementation::FenceSync(GLenum condition, GLbitfield flags) {
671 GPU_CLIENT_SINGLE_THREAD_CHECK();
672 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glFenceSync("
673 << GLES2Util::GetStringSyncCondition(condition) << ", "
674 << flags << ")");
675 if (condition != GL_SYNC_GPU_COMMANDS_COMPLETE) {
676 SetGLError(GL_INVALID_ENUM, "glFenceSync", "condition GL_INVALID_ENUM");
677 return 0;
679 if (flags != 0) {
680 SetGLError(GL_INVALID_VALUE, "glFenceSync", "flags GL_INVALID_VALUE");
681 return 0;
683 GLuint client_id;
684 GetIdHandler(id_namespaces::kSyncs)->MakeIds(this, 0, 1, &client_id);
685 helper_->FenceSync(client_id);
686 GPU_CLIENT_LOG("returned " << client_id);
687 CheckGLError();
688 return reinterpret_cast<GLsync>(client_id);
691 void GLES2Implementation::FramebufferRenderbuffer(GLenum target,
692 GLenum attachment,
693 GLenum renderbuffertarget,
694 GLuint renderbuffer) {
695 GPU_CLIENT_SINGLE_THREAD_CHECK();
696 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glFramebufferRenderbuffer("
697 << GLES2Util::GetStringFrameBufferTarget(target) << ", "
698 << GLES2Util::GetStringAttachment(attachment) << ", "
699 << GLES2Util::GetStringRenderBufferTarget(
700 renderbuffertarget) << ", " << renderbuffer << ")");
701 helper_->FramebufferRenderbuffer(target, attachment, renderbuffertarget,
702 renderbuffer);
703 CheckGLError();
706 void GLES2Implementation::FramebufferTexture2D(GLenum target,
707 GLenum attachment,
708 GLenum textarget,
709 GLuint texture,
710 GLint level) {
711 GPU_CLIENT_SINGLE_THREAD_CHECK();
712 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glFramebufferTexture2D("
713 << GLES2Util::GetStringFrameBufferTarget(target) << ", "
714 << GLES2Util::GetStringAttachment(attachment) << ", "
715 << GLES2Util::GetStringTextureTarget(textarget) << ", "
716 << texture << ", " << level << ")");
717 if (level != 0) {
718 SetGLError(GL_INVALID_VALUE, "glFramebufferTexture2D",
719 "level GL_INVALID_VALUE");
720 return;
722 helper_->FramebufferTexture2D(target, attachment, textarget, texture);
723 CheckGLError();
726 void GLES2Implementation::FramebufferTextureLayer(GLenum target,
727 GLenum attachment,
728 GLuint texture,
729 GLint level,
730 GLint layer) {
731 GPU_CLIENT_SINGLE_THREAD_CHECK();
732 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glFramebufferTextureLayer("
733 << GLES2Util::GetStringFrameBufferTarget(target) << ", "
734 << GLES2Util::GetStringAttachment(attachment) << ", "
735 << texture << ", " << level << ", " << layer << ")");
736 helper_->FramebufferTextureLayer(target, attachment, texture, level, layer);
737 CheckGLError();
740 void GLES2Implementation::FrontFace(GLenum mode) {
741 GPU_CLIENT_SINGLE_THREAD_CHECK();
742 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glFrontFace("
743 << GLES2Util::GetStringFaceMode(mode) << ")");
744 helper_->FrontFace(mode);
745 CheckGLError();
748 void GLES2Implementation::GenBuffers(GLsizei n, GLuint* buffers) {
749 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGenBuffers(" << n << ", "
750 << static_cast<const void*>(buffers) << ")");
751 if (n < 0) {
752 SetGLError(GL_INVALID_VALUE, "glGenBuffers", "n < 0");
753 return;
755 GPU_CLIENT_SINGLE_THREAD_CHECK();
756 GetIdHandler(id_namespaces::kBuffers)->MakeIds(this, 0, n, buffers);
757 GenBuffersHelper(n, buffers);
758 helper_->GenBuffersImmediate(n, buffers);
759 if (share_group_->bind_generates_resource())
760 helper_->CommandBufferHelper::Flush();
761 GPU_CLIENT_LOG_CODE_BLOCK({
762 for (GLsizei i = 0; i < n; ++i) {
763 GPU_CLIENT_LOG(" " << i << ": " << buffers[i]);
766 CheckGLError();
769 void GLES2Implementation::GenerateMipmap(GLenum target) {
770 GPU_CLIENT_SINGLE_THREAD_CHECK();
771 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGenerateMipmap("
772 << GLES2Util::GetStringTextureBindTarget(target) << ")");
773 helper_->GenerateMipmap(target);
774 CheckGLError();
777 void GLES2Implementation::GenFramebuffers(GLsizei n, GLuint* framebuffers) {
778 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGenFramebuffers(" << n << ", "
779 << static_cast<const void*>(framebuffers) << ")");
780 if (n < 0) {
781 SetGLError(GL_INVALID_VALUE, "glGenFramebuffers", "n < 0");
782 return;
784 GPU_CLIENT_SINGLE_THREAD_CHECK();
785 GetIdHandler(id_namespaces::kFramebuffers)->MakeIds(this, 0, n, framebuffers);
786 GenFramebuffersHelper(n, framebuffers);
787 helper_->GenFramebuffersImmediate(n, framebuffers);
788 if (share_group_->bind_generates_resource())
789 helper_->CommandBufferHelper::Flush();
790 GPU_CLIENT_LOG_CODE_BLOCK({
791 for (GLsizei i = 0; i < n; ++i) {
792 GPU_CLIENT_LOG(" " << i << ": " << framebuffers[i]);
795 CheckGLError();
798 void GLES2Implementation::GenRenderbuffers(GLsizei n, GLuint* renderbuffers) {
799 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGenRenderbuffers(" << n << ", "
800 << static_cast<const void*>(renderbuffers) << ")");
801 if (n < 0) {
802 SetGLError(GL_INVALID_VALUE, "glGenRenderbuffers", "n < 0");
803 return;
805 GPU_CLIENT_SINGLE_THREAD_CHECK();
806 GetIdHandler(id_namespaces::kRenderbuffers)
807 ->MakeIds(this, 0, n, renderbuffers);
808 GenRenderbuffersHelper(n, renderbuffers);
809 helper_->GenRenderbuffersImmediate(n, renderbuffers);
810 if (share_group_->bind_generates_resource())
811 helper_->CommandBufferHelper::Flush();
812 GPU_CLIENT_LOG_CODE_BLOCK({
813 for (GLsizei i = 0; i < n; ++i) {
814 GPU_CLIENT_LOG(" " << i << ": " << renderbuffers[i]);
817 CheckGLError();
820 void GLES2Implementation::GenSamplers(GLsizei n, GLuint* samplers) {
821 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGenSamplers(" << n << ", "
822 << static_cast<const void*>(samplers) << ")");
823 if (n < 0) {
824 SetGLError(GL_INVALID_VALUE, "glGenSamplers", "n < 0");
825 return;
827 GPU_CLIENT_SINGLE_THREAD_CHECK();
828 GetIdHandler(id_namespaces::kSamplers)->MakeIds(this, 0, n, samplers);
829 GenSamplersHelper(n, samplers);
830 helper_->GenSamplersImmediate(n, samplers);
831 if (share_group_->bind_generates_resource())
832 helper_->CommandBufferHelper::Flush();
833 GPU_CLIENT_LOG_CODE_BLOCK({
834 for (GLsizei i = 0; i < n; ++i) {
835 GPU_CLIENT_LOG(" " << i << ": " << samplers[i]);
838 CheckGLError();
841 void GLES2Implementation::GenTextures(GLsizei n, GLuint* textures) {
842 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGenTextures(" << n << ", "
843 << static_cast<const void*>(textures) << ")");
844 if (n < 0) {
845 SetGLError(GL_INVALID_VALUE, "glGenTextures", "n < 0");
846 return;
848 GPU_CLIENT_SINGLE_THREAD_CHECK();
849 GetIdHandler(id_namespaces::kTextures)->MakeIds(this, 0, n, textures);
850 GenTexturesHelper(n, textures);
851 helper_->GenTexturesImmediate(n, textures);
852 if (share_group_->bind_generates_resource())
853 helper_->CommandBufferHelper::Flush();
854 GPU_CLIENT_LOG_CODE_BLOCK({
855 for (GLsizei i = 0; i < n; ++i) {
856 GPU_CLIENT_LOG(" " << i << ": " << textures[i]);
859 CheckGLError();
862 void GLES2Implementation::GenTransformFeedbacks(GLsizei n, GLuint* ids) {
863 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGenTransformFeedbacks(" << n
864 << ", " << static_cast<const void*>(ids) << ")");
865 if (n < 0) {
866 SetGLError(GL_INVALID_VALUE, "glGenTransformFeedbacks", "n < 0");
867 return;
869 GPU_CLIENT_SINGLE_THREAD_CHECK();
870 GetIdHandler(id_namespaces::kTransformFeedbacks)->MakeIds(this, 0, n, ids);
871 GenTransformFeedbacksHelper(n, ids);
872 helper_->GenTransformFeedbacksImmediate(n, ids);
873 if (share_group_->bind_generates_resource())
874 helper_->CommandBufferHelper::Flush();
875 GPU_CLIENT_LOG_CODE_BLOCK({
876 for (GLsizei i = 0; i < n; ++i) {
877 GPU_CLIENT_LOG(" " << i << ": " << ids[i]);
880 CheckGLError();
883 void GLES2Implementation::GetBooleanv(GLenum pname, GLboolean* params) {
884 GPU_CLIENT_SINGLE_THREAD_CHECK();
885 GPU_CLIENT_VALIDATE_DESTINATION_INITALIZATION(GLboolean, params);
886 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetBooleanv("
887 << GLES2Util::GetStringGLState(pname) << ", "
888 << static_cast<const void*>(params) << ")");
889 TRACE_EVENT0("gpu", "GLES2Implementation::GetBooleanv");
890 if (GetBooleanvHelper(pname, params)) {
891 return;
893 typedef cmds::GetBooleanv::Result Result;
894 Result* result = GetResultAs<Result*>();
895 if (!result) {
896 return;
898 result->SetNumResults(0);
899 helper_->GetBooleanv(pname, GetResultShmId(), GetResultShmOffset());
900 WaitForCmd();
901 result->CopyResult(params);
902 GPU_CLIENT_LOG_CODE_BLOCK({
903 for (int32_t i = 0; i < result->GetNumResults(); ++i) {
904 GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]);
907 CheckGLError();
909 void GLES2Implementation::GetBufferParameteriv(GLenum target,
910 GLenum pname,
911 GLint* params) {
912 GPU_CLIENT_SINGLE_THREAD_CHECK();
913 GPU_CLIENT_VALIDATE_DESTINATION_INITALIZATION(GLint, params);
914 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetBufferParameteriv("
915 << GLES2Util::GetStringBufferTarget(target) << ", "
916 << GLES2Util::GetStringBufferParameter(pname) << ", "
917 << static_cast<const void*>(params) << ")");
918 TRACE_EVENT0("gpu", "GLES2Implementation::GetBufferParameteriv");
919 if (GetBufferParameterivHelper(target, pname, params)) {
920 return;
922 typedef cmds::GetBufferParameteriv::Result Result;
923 Result* result = GetResultAs<Result*>();
924 if (!result) {
925 return;
927 result->SetNumResults(0);
928 helper_->GetBufferParameteriv(target, pname, GetResultShmId(),
929 GetResultShmOffset());
930 WaitForCmd();
931 result->CopyResult(params);
932 GPU_CLIENT_LOG_CODE_BLOCK({
933 for (int32_t i = 0; i < result->GetNumResults(); ++i) {
934 GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]);
937 CheckGLError();
939 void GLES2Implementation::GetFloatv(GLenum pname, GLfloat* params) {
940 GPU_CLIENT_SINGLE_THREAD_CHECK();
941 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetFloatv("
942 << GLES2Util::GetStringGLState(pname) << ", "
943 << static_cast<const void*>(params) << ")");
944 TRACE_EVENT0("gpu", "GLES2Implementation::GetFloatv");
945 if (GetFloatvHelper(pname, params)) {
946 return;
948 typedef cmds::GetFloatv::Result Result;
949 Result* result = GetResultAs<Result*>();
950 if (!result) {
951 return;
953 result->SetNumResults(0);
954 helper_->GetFloatv(pname, GetResultShmId(), GetResultShmOffset());
955 WaitForCmd();
956 result->CopyResult(params);
957 GPU_CLIENT_LOG_CODE_BLOCK({
958 for (int32_t i = 0; i < result->GetNumResults(); ++i) {
959 GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]);
962 CheckGLError();
964 void GLES2Implementation::GetFramebufferAttachmentParameteriv(GLenum target,
965 GLenum attachment,
966 GLenum pname,
967 GLint* params) {
968 GPU_CLIENT_SINGLE_THREAD_CHECK();
969 GPU_CLIENT_VALIDATE_DESTINATION_INITALIZATION(GLint, params);
970 GPU_CLIENT_LOG("[" << GetLogPrefix()
971 << "] glGetFramebufferAttachmentParameteriv("
972 << GLES2Util::GetStringFrameBufferTarget(target) << ", "
973 << GLES2Util::GetStringAttachment(attachment) << ", "
974 << GLES2Util::GetStringFrameBufferParameter(pname) << ", "
975 << static_cast<const void*>(params) << ")");
976 TRACE_EVENT0("gpu",
977 "GLES2Implementation::GetFramebufferAttachmentParameteriv");
978 if (GetFramebufferAttachmentParameterivHelper(target, attachment, pname,
979 params)) {
980 return;
982 typedef cmds::GetFramebufferAttachmentParameteriv::Result Result;
983 Result* result = GetResultAs<Result*>();
984 if (!result) {
985 return;
987 result->SetNumResults(0);
988 helper_->GetFramebufferAttachmentParameteriv(
989 target, attachment, pname, GetResultShmId(), GetResultShmOffset());
990 WaitForCmd();
991 result->CopyResult(params);
992 GPU_CLIENT_LOG_CODE_BLOCK({
993 for (int32_t i = 0; i < result->GetNumResults(); ++i) {
994 GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]);
997 CheckGLError();
999 void GLES2Implementation::GetIntegerv(GLenum pname, GLint* params) {
1000 GPU_CLIENT_SINGLE_THREAD_CHECK();
1001 GPU_CLIENT_VALIDATE_DESTINATION_INITALIZATION(GLint, params);
1002 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetIntegerv("
1003 << GLES2Util::GetStringGLState(pname) << ", "
1004 << static_cast<const void*>(params) << ")");
1005 TRACE_EVENT0("gpu", "GLES2Implementation::GetIntegerv");
1006 if (GetIntegervHelper(pname, params)) {
1007 return;
1009 typedef cmds::GetIntegerv::Result Result;
1010 Result* result = GetResultAs<Result*>();
1011 if (!result) {
1012 return;
1014 result->SetNumResults(0);
1015 helper_->GetIntegerv(pname, GetResultShmId(), GetResultShmOffset());
1016 WaitForCmd();
1017 result->CopyResult(params);
1018 GPU_CLIENT_LOG_CODE_BLOCK({
1019 for (int32_t i = 0; i < result->GetNumResults(); ++i) {
1020 GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]);
1023 CheckGLError();
1025 void GLES2Implementation::GetInternalformativ(GLenum target,
1026 GLenum format,
1027 GLenum pname,
1028 GLsizei bufSize,
1029 GLint* params) {
1030 GPU_CLIENT_SINGLE_THREAD_CHECK();
1031 GPU_CLIENT_VALIDATE_DESTINATION_INITALIZATION(GLint, params);
1032 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetInternalformativ("
1033 << GLES2Util::GetStringRenderBufferTarget(target) << ", "
1034 << GLES2Util::GetStringRenderBufferFormat(format) << ", "
1035 << GLES2Util::GetStringRenderBufferParameter(pname) << ", "
1036 << bufSize << ", " << static_cast<const void*>(params)
1037 << ")");
1038 if (bufSize < 0) {
1039 SetGLError(GL_INVALID_VALUE, "glGetInternalformativ", "bufSize < 0");
1040 return;
1042 TRACE_EVENT0("gpu", "GLES2Implementation::GetInternalformativ");
1043 if (GetInternalformativHelper(target, format, pname, bufSize, params)) {
1044 return;
1046 typedef cmds::GetInternalformativ::Result Result;
1047 Result* result = GetResultAs<Result*>();
1048 if (!result) {
1049 return;
1051 result->SetNumResults(0);
1052 helper_->GetInternalformativ(target, format, pname, bufSize, GetResultShmId(),
1053 GetResultShmOffset());
1054 WaitForCmd();
1055 result->CopyResult(params);
1056 GPU_CLIENT_LOG_CODE_BLOCK({
1057 for (int32_t i = 0; i < result->GetNumResults(); ++i) {
1058 GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]);
1061 CheckGLError();
1063 void GLES2Implementation::GetProgramiv(GLuint program,
1064 GLenum pname,
1065 GLint* params) {
1066 GPU_CLIENT_SINGLE_THREAD_CHECK();
1067 GPU_CLIENT_VALIDATE_DESTINATION_INITALIZATION(GLint, params);
1068 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetProgramiv(" << program << ", "
1069 << GLES2Util::GetStringProgramParameter(pname) << ", "
1070 << static_cast<const void*>(params) << ")");
1071 TRACE_EVENT0("gpu", "GLES2Implementation::GetProgramiv");
1072 if (GetProgramivHelper(program, pname, params)) {
1073 return;
1075 typedef cmds::GetProgramiv::Result Result;
1076 Result* result = GetResultAs<Result*>();
1077 if (!result) {
1078 return;
1080 result->SetNumResults(0);
1081 helper_->GetProgramiv(program, pname, GetResultShmId(), GetResultShmOffset());
1082 WaitForCmd();
1083 result->CopyResult(params);
1084 GPU_CLIENT_LOG_CODE_BLOCK({
1085 for (int32_t i = 0; i < result->GetNumResults(); ++i) {
1086 GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]);
1089 CheckGLError();
1091 void GLES2Implementation::GetProgramInfoLog(GLuint program,
1092 GLsizei bufsize,
1093 GLsizei* length,
1094 char* infolog) {
1095 GPU_CLIENT_SINGLE_THREAD_CHECK();
1096 GPU_CLIENT_VALIDATE_DESTINATION_OPTIONAL_INITALIZATION(GLsizei, length);
1097 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetProgramInfoLog"
1098 << "(" << program << ", " << bufsize << ", "
1099 << static_cast<void*>(length) << ", "
1100 << static_cast<void*>(infolog) << ")");
1101 helper_->SetBucketSize(kResultBucketId, 0);
1102 helper_->GetProgramInfoLog(program, kResultBucketId);
1103 std::string str;
1104 GLsizei max_size = 0;
1105 if (GetBucketAsString(kResultBucketId, &str)) {
1106 if (bufsize > 0) {
1107 max_size = std::min(static_cast<size_t>(bufsize) - 1, str.size());
1108 memcpy(infolog, str.c_str(), max_size);
1109 infolog[max_size] = '\0';
1110 GPU_CLIENT_LOG("------\n" << infolog << "\n------");
1113 if (length != NULL) {
1114 *length = max_size;
1116 CheckGLError();
1118 void GLES2Implementation::GetRenderbufferParameteriv(GLenum target,
1119 GLenum pname,
1120 GLint* params) {
1121 GPU_CLIENT_SINGLE_THREAD_CHECK();
1122 GPU_CLIENT_VALIDATE_DESTINATION_INITALIZATION(GLint, params);
1123 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetRenderbufferParameteriv("
1124 << GLES2Util::GetStringRenderBufferTarget(target) << ", "
1125 << GLES2Util::GetStringRenderBufferParameter(pname) << ", "
1126 << static_cast<const void*>(params) << ")");
1127 TRACE_EVENT0("gpu", "GLES2Implementation::GetRenderbufferParameteriv");
1128 if (GetRenderbufferParameterivHelper(target, pname, params)) {
1129 return;
1131 typedef cmds::GetRenderbufferParameteriv::Result Result;
1132 Result* result = GetResultAs<Result*>();
1133 if (!result) {
1134 return;
1136 result->SetNumResults(0);
1137 helper_->GetRenderbufferParameteriv(target, pname, GetResultShmId(),
1138 GetResultShmOffset());
1139 WaitForCmd();
1140 result->CopyResult(params);
1141 GPU_CLIENT_LOG_CODE_BLOCK({
1142 for (int32_t i = 0; i < result->GetNumResults(); ++i) {
1143 GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]);
1146 CheckGLError();
1148 void GLES2Implementation::GetSamplerParameterfv(GLuint sampler,
1149 GLenum pname,
1150 GLfloat* params) {
1151 GPU_CLIENT_SINGLE_THREAD_CHECK();
1152 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetSamplerParameterfv("
1153 << sampler << ", "
1154 << GLES2Util::GetStringSamplerParameter(pname) << ", "
1155 << static_cast<const void*>(params) << ")");
1156 TRACE_EVENT0("gpu", "GLES2Implementation::GetSamplerParameterfv");
1157 if (GetSamplerParameterfvHelper(sampler, pname, params)) {
1158 return;
1160 typedef cmds::GetSamplerParameterfv::Result Result;
1161 Result* result = GetResultAs<Result*>();
1162 if (!result) {
1163 return;
1165 result->SetNumResults(0);
1166 helper_->GetSamplerParameterfv(sampler, pname, GetResultShmId(),
1167 GetResultShmOffset());
1168 WaitForCmd();
1169 result->CopyResult(params);
1170 GPU_CLIENT_LOG_CODE_BLOCK({
1171 for (int32_t i = 0; i < result->GetNumResults(); ++i) {
1172 GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]);
1175 CheckGLError();
1177 void GLES2Implementation::GetSamplerParameteriv(GLuint sampler,
1178 GLenum pname,
1179 GLint* params) {
1180 GPU_CLIENT_SINGLE_THREAD_CHECK();
1181 GPU_CLIENT_VALIDATE_DESTINATION_INITALIZATION(GLint, params);
1182 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetSamplerParameteriv("
1183 << sampler << ", "
1184 << GLES2Util::GetStringSamplerParameter(pname) << ", "
1185 << static_cast<const void*>(params) << ")");
1186 TRACE_EVENT0("gpu", "GLES2Implementation::GetSamplerParameteriv");
1187 if (GetSamplerParameterivHelper(sampler, pname, params)) {
1188 return;
1190 typedef cmds::GetSamplerParameteriv::Result Result;
1191 Result* result = GetResultAs<Result*>();
1192 if (!result) {
1193 return;
1195 result->SetNumResults(0);
1196 helper_->GetSamplerParameteriv(sampler, pname, GetResultShmId(),
1197 GetResultShmOffset());
1198 WaitForCmd();
1199 result->CopyResult(params);
1200 GPU_CLIENT_LOG_CODE_BLOCK({
1201 for (int32_t i = 0; i < result->GetNumResults(); ++i) {
1202 GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]);
1205 CheckGLError();
1207 void GLES2Implementation::GetShaderiv(GLuint shader,
1208 GLenum pname,
1209 GLint* params) {
1210 GPU_CLIENT_SINGLE_THREAD_CHECK();
1211 GPU_CLIENT_VALIDATE_DESTINATION_INITALIZATION(GLint, params);
1212 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetShaderiv(" << shader << ", "
1213 << GLES2Util::GetStringShaderParameter(pname) << ", "
1214 << static_cast<const void*>(params) << ")");
1215 TRACE_EVENT0("gpu", "GLES2Implementation::GetShaderiv");
1216 if (GetShaderivHelper(shader, pname, params)) {
1217 return;
1219 typedef cmds::GetShaderiv::Result Result;
1220 Result* result = GetResultAs<Result*>();
1221 if (!result) {
1222 return;
1224 result->SetNumResults(0);
1225 helper_->GetShaderiv(shader, pname, GetResultShmId(), GetResultShmOffset());
1226 WaitForCmd();
1227 result->CopyResult(params);
1228 GPU_CLIENT_LOG_CODE_BLOCK({
1229 for (int32_t i = 0; i < result->GetNumResults(); ++i) {
1230 GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]);
1233 CheckGLError();
1235 void GLES2Implementation::GetShaderInfoLog(GLuint shader,
1236 GLsizei bufsize,
1237 GLsizei* length,
1238 char* infolog) {
1239 GPU_CLIENT_SINGLE_THREAD_CHECK();
1240 GPU_CLIENT_VALIDATE_DESTINATION_OPTIONAL_INITALIZATION(GLsizei, length);
1241 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetShaderInfoLog"
1242 << "(" << shader << ", " << bufsize << ", "
1243 << static_cast<void*>(length) << ", "
1244 << static_cast<void*>(infolog) << ")");
1245 helper_->SetBucketSize(kResultBucketId, 0);
1246 helper_->GetShaderInfoLog(shader, kResultBucketId);
1247 std::string str;
1248 GLsizei max_size = 0;
1249 if (GetBucketAsString(kResultBucketId, &str)) {
1250 if (bufsize > 0) {
1251 max_size = std::min(static_cast<size_t>(bufsize) - 1, str.size());
1252 memcpy(infolog, str.c_str(), max_size);
1253 infolog[max_size] = '\0';
1254 GPU_CLIENT_LOG("------\n" << infolog << "\n------");
1257 if (length != NULL) {
1258 *length = max_size;
1260 CheckGLError();
1262 void GLES2Implementation::GetShaderSource(GLuint shader,
1263 GLsizei bufsize,
1264 GLsizei* length,
1265 char* source) {
1266 GPU_CLIENT_SINGLE_THREAD_CHECK();
1267 GPU_CLIENT_VALIDATE_DESTINATION_OPTIONAL_INITALIZATION(GLsizei, length);
1268 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetShaderSource"
1269 << "(" << shader << ", " << bufsize << ", "
1270 << static_cast<void*>(length) << ", "
1271 << static_cast<void*>(source) << ")");
1272 helper_->SetBucketSize(kResultBucketId, 0);
1273 helper_->GetShaderSource(shader, kResultBucketId);
1274 std::string str;
1275 GLsizei max_size = 0;
1276 if (GetBucketAsString(kResultBucketId, &str)) {
1277 if (bufsize > 0) {
1278 max_size = std::min(static_cast<size_t>(bufsize) - 1, str.size());
1279 memcpy(source, str.c_str(), max_size);
1280 source[max_size] = '\0';
1281 GPU_CLIENT_LOG("------\n" << source << "\n------");
1284 if (length != NULL) {
1285 *length = max_size;
1287 CheckGLError();
1289 void GLES2Implementation::GetTexParameterfv(GLenum target,
1290 GLenum pname,
1291 GLfloat* params) {
1292 GPU_CLIENT_SINGLE_THREAD_CHECK();
1293 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetTexParameterfv("
1294 << GLES2Util::GetStringGetTexParamTarget(target) << ", "
1295 << GLES2Util::GetStringTextureParameter(pname) << ", "
1296 << static_cast<const void*>(params) << ")");
1297 TRACE_EVENT0("gpu", "GLES2Implementation::GetTexParameterfv");
1298 if (GetTexParameterfvHelper(target, pname, params)) {
1299 return;
1301 typedef cmds::GetTexParameterfv::Result Result;
1302 Result* result = GetResultAs<Result*>();
1303 if (!result) {
1304 return;
1306 result->SetNumResults(0);
1307 helper_->GetTexParameterfv(target, pname, GetResultShmId(),
1308 GetResultShmOffset());
1309 WaitForCmd();
1310 result->CopyResult(params);
1311 GPU_CLIENT_LOG_CODE_BLOCK({
1312 for (int32_t i = 0; i < result->GetNumResults(); ++i) {
1313 GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]);
1316 CheckGLError();
1318 void GLES2Implementation::GetTexParameteriv(GLenum target,
1319 GLenum pname,
1320 GLint* params) {
1321 GPU_CLIENT_SINGLE_THREAD_CHECK();
1322 GPU_CLIENT_VALIDATE_DESTINATION_INITALIZATION(GLint, params);
1323 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetTexParameteriv("
1324 << GLES2Util::GetStringGetTexParamTarget(target) << ", "
1325 << GLES2Util::GetStringTextureParameter(pname) << ", "
1326 << static_cast<const void*>(params) << ")");
1327 TRACE_EVENT0("gpu", "GLES2Implementation::GetTexParameteriv");
1328 if (GetTexParameterivHelper(target, pname, params)) {
1329 return;
1331 typedef cmds::GetTexParameteriv::Result Result;
1332 Result* result = GetResultAs<Result*>();
1333 if (!result) {
1334 return;
1336 result->SetNumResults(0);
1337 helper_->GetTexParameteriv(target, pname, GetResultShmId(),
1338 GetResultShmOffset());
1339 WaitForCmd();
1340 result->CopyResult(params);
1341 GPU_CLIENT_LOG_CODE_BLOCK({
1342 for (int32_t i = 0; i < result->GetNumResults(); ++i) {
1343 GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]);
1346 CheckGLError();
1348 void GLES2Implementation::Hint(GLenum target, GLenum mode) {
1349 GPU_CLIENT_SINGLE_THREAD_CHECK();
1350 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glHint("
1351 << GLES2Util::GetStringHintTarget(target) << ", "
1352 << GLES2Util::GetStringHintMode(mode) << ")");
1353 helper_->Hint(target, mode);
1354 CheckGLError();
1357 void GLES2Implementation::InvalidateFramebuffer(GLenum target,
1358 GLsizei count,
1359 const GLenum* attachments) {
1360 GPU_CLIENT_SINGLE_THREAD_CHECK();
1361 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glInvalidateFramebuffer("
1362 << GLES2Util::GetStringFrameBufferTarget(target) << ", "
1363 << count << ", " << static_cast<const void*>(attachments)
1364 << ")");
1365 GPU_CLIENT_LOG_CODE_BLOCK({
1366 for (GLsizei i = 0; i < count; ++i) {
1367 GPU_CLIENT_LOG(" " << i << ": " << attachments[0 + i * 1]);
1370 if (count < 0) {
1371 SetGLError(GL_INVALID_VALUE, "glInvalidateFramebuffer", "count < 0");
1372 return;
1374 helper_->InvalidateFramebufferImmediate(target, count, attachments);
1375 CheckGLError();
1378 void GLES2Implementation::InvalidateSubFramebuffer(GLenum target,
1379 GLsizei count,
1380 const GLenum* attachments,
1381 GLint x,
1382 GLint y,
1383 GLsizei width,
1384 GLsizei height) {
1385 GPU_CLIENT_SINGLE_THREAD_CHECK();
1386 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glInvalidateSubFramebuffer("
1387 << GLES2Util::GetStringFrameBufferTarget(target) << ", "
1388 << count << ", " << static_cast<const void*>(attachments)
1389 << ", " << x << ", " << y << ", " << width << ", "
1390 << height << ")");
1391 GPU_CLIENT_LOG_CODE_BLOCK({
1392 for (GLsizei i = 0; i < count; ++i) {
1393 GPU_CLIENT_LOG(" " << i << ": " << attachments[0 + i * 1]);
1396 if (count < 0) {
1397 SetGLError(GL_INVALID_VALUE, "glInvalidateSubFramebuffer", "count < 0");
1398 return;
1400 if (width < 0) {
1401 SetGLError(GL_INVALID_VALUE, "glInvalidateSubFramebuffer", "width < 0");
1402 return;
1404 if (height < 0) {
1405 SetGLError(GL_INVALID_VALUE, "glInvalidateSubFramebuffer", "height < 0");
1406 return;
1408 helper_->InvalidateSubFramebufferImmediate(target, count, attachments, x, y,
1409 width, height);
1410 CheckGLError();
1413 GLboolean GLES2Implementation::IsBuffer(GLuint buffer) {
1414 GPU_CLIENT_SINGLE_THREAD_CHECK();
1415 TRACE_EVENT0("gpu", "GLES2Implementation::IsBuffer");
1416 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glIsBuffer(" << buffer << ")");
1417 typedef cmds::IsBuffer::Result Result;
1418 Result* result = GetResultAs<Result*>();
1419 if (!result) {
1420 return GL_FALSE;
1422 *result = 0;
1423 helper_->IsBuffer(buffer, GetResultShmId(), GetResultShmOffset());
1424 WaitForCmd();
1425 GLboolean result_value = *result != 0;
1426 GPU_CLIENT_LOG("returned " << result_value);
1427 CheckGLError();
1428 return result_value;
1431 GLboolean GLES2Implementation::IsFramebuffer(GLuint framebuffer) {
1432 GPU_CLIENT_SINGLE_THREAD_CHECK();
1433 TRACE_EVENT0("gpu", "GLES2Implementation::IsFramebuffer");
1434 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glIsFramebuffer(" << framebuffer
1435 << ")");
1436 typedef cmds::IsFramebuffer::Result Result;
1437 Result* result = GetResultAs<Result*>();
1438 if (!result) {
1439 return GL_FALSE;
1441 *result = 0;
1442 helper_->IsFramebuffer(framebuffer, GetResultShmId(), GetResultShmOffset());
1443 WaitForCmd();
1444 GLboolean result_value = *result != 0;
1445 GPU_CLIENT_LOG("returned " << result_value);
1446 CheckGLError();
1447 return result_value;
1450 GLboolean GLES2Implementation::IsProgram(GLuint program) {
1451 GPU_CLIENT_SINGLE_THREAD_CHECK();
1452 TRACE_EVENT0("gpu", "GLES2Implementation::IsProgram");
1453 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glIsProgram(" << program << ")");
1454 typedef cmds::IsProgram::Result Result;
1455 Result* result = GetResultAs<Result*>();
1456 if (!result) {
1457 return GL_FALSE;
1459 *result = 0;
1460 helper_->IsProgram(program, GetResultShmId(), GetResultShmOffset());
1461 WaitForCmd();
1462 GLboolean result_value = *result != 0;
1463 GPU_CLIENT_LOG("returned " << result_value);
1464 CheckGLError();
1465 return result_value;
1468 GLboolean GLES2Implementation::IsRenderbuffer(GLuint renderbuffer) {
1469 GPU_CLIENT_SINGLE_THREAD_CHECK();
1470 TRACE_EVENT0("gpu", "GLES2Implementation::IsRenderbuffer");
1471 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glIsRenderbuffer(" << renderbuffer
1472 << ")");
1473 typedef cmds::IsRenderbuffer::Result Result;
1474 Result* result = GetResultAs<Result*>();
1475 if (!result) {
1476 return GL_FALSE;
1478 *result = 0;
1479 helper_->IsRenderbuffer(renderbuffer, GetResultShmId(), GetResultShmOffset());
1480 WaitForCmd();
1481 GLboolean result_value = *result != 0;
1482 GPU_CLIENT_LOG("returned " << result_value);
1483 CheckGLError();
1484 return result_value;
1487 GLboolean GLES2Implementation::IsSampler(GLuint sampler) {
1488 GPU_CLIENT_SINGLE_THREAD_CHECK();
1489 TRACE_EVENT0("gpu", "GLES2Implementation::IsSampler");
1490 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glIsSampler(" << sampler << ")");
1491 typedef cmds::IsSampler::Result Result;
1492 Result* result = GetResultAs<Result*>();
1493 if (!result) {
1494 return GL_FALSE;
1496 *result = 0;
1497 helper_->IsSampler(sampler, GetResultShmId(), GetResultShmOffset());
1498 WaitForCmd();
1499 GLboolean result_value = *result != 0;
1500 GPU_CLIENT_LOG("returned " << result_value);
1501 CheckGLError();
1502 return result_value;
1505 GLboolean GLES2Implementation::IsShader(GLuint shader) {
1506 GPU_CLIENT_SINGLE_THREAD_CHECK();
1507 TRACE_EVENT0("gpu", "GLES2Implementation::IsShader");
1508 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glIsShader(" << shader << ")");
1509 typedef cmds::IsShader::Result Result;
1510 Result* result = GetResultAs<Result*>();
1511 if (!result) {
1512 return GL_FALSE;
1514 *result = 0;
1515 helper_->IsShader(shader, GetResultShmId(), GetResultShmOffset());
1516 WaitForCmd();
1517 GLboolean result_value = *result != 0;
1518 GPU_CLIENT_LOG("returned " << result_value);
1519 CheckGLError();
1520 return result_value;
1523 GLboolean GLES2Implementation::IsSync(GLsync sync) {
1524 GPU_CLIENT_SINGLE_THREAD_CHECK();
1525 TRACE_EVENT0("gpu", "GLES2Implementation::IsSync");
1526 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glIsSync(" << sync << ")");
1527 typedef cmds::IsSync::Result Result;
1528 Result* result = GetResultAs<Result*>();
1529 if (!result) {
1530 return GL_FALSE;
1532 *result = 0;
1533 helper_->IsSync(ToGLuint(sync), GetResultShmId(), GetResultShmOffset());
1534 WaitForCmd();
1535 GLboolean result_value = *result != 0;
1536 GPU_CLIENT_LOG("returned " << result_value);
1537 CheckGLError();
1538 return result_value;
1541 GLboolean GLES2Implementation::IsTexture(GLuint texture) {
1542 GPU_CLIENT_SINGLE_THREAD_CHECK();
1543 TRACE_EVENT0("gpu", "GLES2Implementation::IsTexture");
1544 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glIsTexture(" << texture << ")");
1545 typedef cmds::IsTexture::Result Result;
1546 Result* result = GetResultAs<Result*>();
1547 if (!result) {
1548 return GL_FALSE;
1550 *result = 0;
1551 helper_->IsTexture(texture, GetResultShmId(), GetResultShmOffset());
1552 WaitForCmd();
1553 GLboolean result_value = *result != 0;
1554 GPU_CLIENT_LOG("returned " << result_value);
1555 CheckGLError();
1556 return result_value;
1559 GLboolean GLES2Implementation::IsTransformFeedback(GLuint transformfeedback) {
1560 GPU_CLIENT_SINGLE_THREAD_CHECK();
1561 TRACE_EVENT0("gpu", "GLES2Implementation::IsTransformFeedback");
1562 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glIsTransformFeedback("
1563 << transformfeedback << ")");
1564 typedef cmds::IsTransformFeedback::Result Result;
1565 Result* result = GetResultAs<Result*>();
1566 if (!result) {
1567 return GL_FALSE;
1569 *result = 0;
1570 helper_->IsTransformFeedback(transformfeedback, GetResultShmId(),
1571 GetResultShmOffset());
1572 WaitForCmd();
1573 GLboolean result_value = *result != 0;
1574 GPU_CLIENT_LOG("returned " << result_value);
1575 CheckGLError();
1576 return result_value;
1579 void GLES2Implementation::LineWidth(GLfloat width) {
1580 GPU_CLIENT_SINGLE_THREAD_CHECK();
1581 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glLineWidth(" << width << ")");
1582 helper_->LineWidth(width);
1583 CheckGLError();
1586 void GLES2Implementation::PauseTransformFeedback() {
1587 GPU_CLIENT_SINGLE_THREAD_CHECK();
1588 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glPauseTransformFeedback("
1589 << ")");
1590 helper_->PauseTransformFeedback();
1591 CheckGLError();
1594 void GLES2Implementation::PolygonOffset(GLfloat factor, GLfloat units) {
1595 GPU_CLIENT_SINGLE_THREAD_CHECK();
1596 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glPolygonOffset(" << factor << ", "
1597 << units << ")");
1598 helper_->PolygonOffset(factor, units);
1599 CheckGLError();
1602 void GLES2Implementation::ReadBuffer(GLenum src) {
1603 GPU_CLIENT_SINGLE_THREAD_CHECK();
1604 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glReadBuffer("
1605 << GLES2Util::GetStringEnum(src) << ")");
1606 helper_->ReadBuffer(src);
1607 CheckGLError();
1610 void GLES2Implementation::ReleaseShaderCompiler() {
1611 GPU_CLIENT_SINGLE_THREAD_CHECK();
1612 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glReleaseShaderCompiler("
1613 << ")");
1614 helper_->ReleaseShaderCompiler();
1615 CheckGLError();
1618 void GLES2Implementation::RenderbufferStorage(GLenum target,
1619 GLenum internalformat,
1620 GLsizei width,
1621 GLsizei height) {
1622 GPU_CLIENT_SINGLE_THREAD_CHECK();
1623 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glRenderbufferStorage("
1624 << GLES2Util::GetStringRenderBufferTarget(target) << ", "
1625 << GLES2Util::GetStringRenderBufferFormat(internalformat)
1626 << ", " << width << ", " << height << ")");
1627 if (width < 0) {
1628 SetGLError(GL_INVALID_VALUE, "glRenderbufferStorage", "width < 0");
1629 return;
1631 if (height < 0) {
1632 SetGLError(GL_INVALID_VALUE, "glRenderbufferStorage", "height < 0");
1633 return;
1635 helper_->RenderbufferStorage(target, internalformat, width, height);
1636 CheckGLError();
1639 void GLES2Implementation::ResumeTransformFeedback() {
1640 GPU_CLIENT_SINGLE_THREAD_CHECK();
1641 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glResumeTransformFeedback("
1642 << ")");
1643 helper_->ResumeTransformFeedback();
1644 CheckGLError();
1647 void GLES2Implementation::SampleCoverage(GLclampf value, GLboolean invert) {
1648 GPU_CLIENT_SINGLE_THREAD_CHECK();
1649 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glSampleCoverage(" << value << ", "
1650 << GLES2Util::GetStringBool(invert) << ")");
1651 helper_->SampleCoverage(value, invert);
1652 CheckGLError();
1655 void GLES2Implementation::SamplerParameterf(GLuint sampler,
1656 GLenum pname,
1657 GLfloat param) {
1658 GPU_CLIENT_SINGLE_THREAD_CHECK();
1659 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glSamplerParameterf(" << sampler
1660 << ", " << GLES2Util::GetStringSamplerParameter(pname)
1661 << ", " << param << ")");
1662 helper_->SamplerParameterf(sampler, pname, param);
1663 CheckGLError();
1666 void GLES2Implementation::SamplerParameterfv(GLuint sampler,
1667 GLenum pname,
1668 const GLfloat* params) {
1669 GPU_CLIENT_SINGLE_THREAD_CHECK();
1670 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glSamplerParameterfv(" << sampler
1671 << ", " << GLES2Util::GetStringSamplerParameter(pname)
1672 << ", " << static_cast<const void*>(params) << ")");
1673 size_t count = 1;
1674 for (size_t ii = 0; ii < count; ++ii)
1675 GPU_CLIENT_LOG("value[" << ii << "]: " << params[ii]);
1676 helper_->SamplerParameterfvImmediate(sampler, pname, params);
1677 CheckGLError();
1680 void GLES2Implementation::SamplerParameteri(GLuint sampler,
1681 GLenum pname,
1682 GLint param) {
1683 GPU_CLIENT_SINGLE_THREAD_CHECK();
1684 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glSamplerParameteri(" << sampler
1685 << ", " << GLES2Util::GetStringSamplerParameter(pname)
1686 << ", " << param << ")");
1687 helper_->SamplerParameteri(sampler, pname, param);
1688 CheckGLError();
1691 void GLES2Implementation::SamplerParameteriv(GLuint sampler,
1692 GLenum pname,
1693 const GLint* params) {
1694 GPU_CLIENT_SINGLE_THREAD_CHECK();
1695 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glSamplerParameteriv(" << sampler
1696 << ", " << GLES2Util::GetStringSamplerParameter(pname)
1697 << ", " << static_cast<const void*>(params) << ")");
1698 size_t count = 1;
1699 for (size_t ii = 0; ii < count; ++ii)
1700 GPU_CLIENT_LOG("value[" << ii << "]: " << params[ii]);
1701 helper_->SamplerParameterivImmediate(sampler, pname, params);
1702 CheckGLError();
1705 void GLES2Implementation::Scissor(GLint x,
1706 GLint y,
1707 GLsizei width,
1708 GLsizei height) {
1709 GPU_CLIENT_SINGLE_THREAD_CHECK();
1710 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glScissor(" << x << ", " << y
1711 << ", " << width << ", " << height << ")");
1712 if (width < 0) {
1713 SetGLError(GL_INVALID_VALUE, "glScissor", "width < 0");
1714 return;
1716 if (height < 0) {
1717 SetGLError(GL_INVALID_VALUE, "glScissor", "height < 0");
1718 return;
1720 helper_->Scissor(x, y, width, height);
1721 CheckGLError();
1724 void GLES2Implementation::ShaderSource(GLuint shader,
1725 GLsizei count,
1726 const GLchar* const* str,
1727 const GLint* length) {
1728 GPU_CLIENT_SINGLE_THREAD_CHECK();
1729 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glShaderSource(" << shader << ", "
1730 << count << ", " << static_cast<const void*>(str) << ", "
1731 << static_cast<const void*>(length) << ")");
1732 GPU_CLIENT_LOG_CODE_BLOCK({
1733 for (GLsizei ii = 0; ii < count; ++ii) {
1734 if (str[ii]) {
1735 if (length && length[ii] >= 0) {
1736 const std::string my_str(str[ii], length[ii]);
1737 GPU_CLIENT_LOG(" " << ii << ": ---\n" << my_str << "\n---");
1738 } else {
1739 GPU_CLIENT_LOG(" " << ii << ": ---\n" << str[ii] << "\n---");
1741 } else {
1742 GPU_CLIENT_LOG(" " << ii << ": NULL");
1746 if (count < 0) {
1747 SetGLError(GL_INVALID_VALUE, "glShaderSource", "count < 0");
1748 return;
1751 if (!PackStringsToBucket(count, str, length, "glShaderSource")) {
1752 return;
1754 helper_->ShaderSourceBucket(shader, kResultBucketId);
1755 helper_->SetBucketSize(kResultBucketId, 0);
1756 CheckGLError();
1759 void GLES2Implementation::StencilFunc(GLenum func, GLint ref, GLuint mask) {
1760 GPU_CLIENT_SINGLE_THREAD_CHECK();
1761 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glStencilFunc("
1762 << GLES2Util::GetStringCmpFunction(func) << ", " << ref
1763 << ", " << mask << ")");
1764 helper_->StencilFunc(func, ref, mask);
1765 CheckGLError();
1768 void GLES2Implementation::StencilFuncSeparate(GLenum face,
1769 GLenum func,
1770 GLint ref,
1771 GLuint mask) {
1772 GPU_CLIENT_SINGLE_THREAD_CHECK();
1773 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glStencilFuncSeparate("
1774 << GLES2Util::GetStringFaceType(face) << ", "
1775 << GLES2Util::GetStringCmpFunction(func) << ", " << ref
1776 << ", " << mask << ")");
1777 helper_->StencilFuncSeparate(face, func, ref, mask);
1778 CheckGLError();
1781 void GLES2Implementation::StencilMask(GLuint mask) {
1782 GPU_CLIENT_SINGLE_THREAD_CHECK();
1783 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glStencilMask(" << mask << ")");
1784 helper_->StencilMask(mask);
1785 CheckGLError();
1788 void GLES2Implementation::StencilMaskSeparate(GLenum face, GLuint mask) {
1789 GPU_CLIENT_SINGLE_THREAD_CHECK();
1790 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glStencilMaskSeparate("
1791 << GLES2Util::GetStringFaceType(face) << ", " << mask
1792 << ")");
1793 helper_->StencilMaskSeparate(face, mask);
1794 CheckGLError();
1797 void GLES2Implementation::StencilOp(GLenum fail, GLenum zfail, GLenum zpass) {
1798 GPU_CLIENT_SINGLE_THREAD_CHECK();
1799 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glStencilOp("
1800 << GLES2Util::GetStringStencilOp(fail) << ", "
1801 << GLES2Util::GetStringStencilOp(zfail) << ", "
1802 << GLES2Util::GetStringStencilOp(zpass) << ")");
1803 helper_->StencilOp(fail, zfail, zpass);
1804 CheckGLError();
1807 void GLES2Implementation::StencilOpSeparate(GLenum face,
1808 GLenum fail,
1809 GLenum zfail,
1810 GLenum zpass) {
1811 GPU_CLIENT_SINGLE_THREAD_CHECK();
1812 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glStencilOpSeparate("
1813 << GLES2Util::GetStringFaceType(face) << ", "
1814 << GLES2Util::GetStringStencilOp(fail) << ", "
1815 << GLES2Util::GetStringStencilOp(zfail) << ", "
1816 << GLES2Util::GetStringStencilOp(zpass) << ")");
1817 helper_->StencilOpSeparate(face, fail, zfail, zpass);
1818 CheckGLError();
1821 void GLES2Implementation::TexParameterf(GLenum target,
1822 GLenum pname,
1823 GLfloat param) {
1824 GPU_CLIENT_SINGLE_THREAD_CHECK();
1825 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glTexParameterf("
1826 << GLES2Util::GetStringTextureBindTarget(target) << ", "
1827 << GLES2Util::GetStringTextureParameter(pname) << ", "
1828 << param << ")");
1829 helper_->TexParameterf(target, pname, param);
1830 CheckGLError();
1833 void GLES2Implementation::TexParameterfv(GLenum target,
1834 GLenum pname,
1835 const GLfloat* params) {
1836 GPU_CLIENT_SINGLE_THREAD_CHECK();
1837 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glTexParameterfv("
1838 << GLES2Util::GetStringTextureBindTarget(target) << ", "
1839 << GLES2Util::GetStringTextureParameter(pname) << ", "
1840 << static_cast<const void*>(params) << ")");
1841 size_t count = 1;
1842 for (size_t ii = 0; ii < count; ++ii)
1843 GPU_CLIENT_LOG("value[" << ii << "]: " << params[ii]);
1844 helper_->TexParameterfvImmediate(target, pname, params);
1845 CheckGLError();
1848 void GLES2Implementation::TexParameteri(GLenum target,
1849 GLenum pname,
1850 GLint param) {
1851 GPU_CLIENT_SINGLE_THREAD_CHECK();
1852 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glTexParameteri("
1853 << GLES2Util::GetStringTextureBindTarget(target) << ", "
1854 << GLES2Util::GetStringTextureParameter(pname) << ", "
1855 << param << ")");
1856 helper_->TexParameteri(target, pname, param);
1857 CheckGLError();
1860 void GLES2Implementation::TexParameteriv(GLenum target,
1861 GLenum pname,
1862 const GLint* params) {
1863 GPU_CLIENT_SINGLE_THREAD_CHECK();
1864 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glTexParameteriv("
1865 << GLES2Util::GetStringTextureBindTarget(target) << ", "
1866 << GLES2Util::GetStringTextureParameter(pname) << ", "
1867 << static_cast<const void*>(params) << ")");
1868 size_t count = 1;
1869 for (size_t ii = 0; ii < count; ++ii)
1870 GPU_CLIENT_LOG("value[" << ii << "]: " << params[ii]);
1871 helper_->TexParameterivImmediate(target, pname, params);
1872 CheckGLError();
1875 void GLES2Implementation::TexStorage3D(GLenum target,
1876 GLsizei levels,
1877 GLenum internalFormat,
1878 GLsizei width,
1879 GLsizei height,
1880 GLsizei depth) {
1881 GPU_CLIENT_SINGLE_THREAD_CHECK();
1882 GPU_CLIENT_LOG(
1883 "[" << GetLogPrefix() << "] glTexStorage3D("
1884 << GLES2Util::GetStringTexture3DTarget(target) << ", " << levels
1885 << ", "
1886 << GLES2Util::GetStringTextureInternalFormatStorage(internalFormat)
1887 << ", " << width << ", " << height << ", " << depth << ")");
1888 if (levels < 0) {
1889 SetGLError(GL_INVALID_VALUE, "glTexStorage3D", "levels < 0");
1890 return;
1892 if (width < 0) {
1893 SetGLError(GL_INVALID_VALUE, "glTexStorage3D", "width < 0");
1894 return;
1896 if (height < 0) {
1897 SetGLError(GL_INVALID_VALUE, "glTexStorage3D", "height < 0");
1898 return;
1900 if (depth < 0) {
1901 SetGLError(GL_INVALID_VALUE, "glTexStorage3D", "depth < 0");
1902 return;
1904 helper_->TexStorage3D(target, levels, internalFormat, width, height, depth);
1905 CheckGLError();
1908 void GLES2Implementation::TransformFeedbackVaryings(GLuint program,
1909 GLsizei count,
1910 const char* const* varyings,
1911 GLenum buffermode) {
1912 GPU_CLIENT_SINGLE_THREAD_CHECK();
1913 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glTransformFeedbackVaryings("
1914 << program << ", " << count << ", "
1915 << static_cast<const void*>(varyings) << ", "
1916 << GLES2Util::GetStringBufferMode(buffermode) << ")");
1917 GPU_CLIENT_LOG_CODE_BLOCK({
1918 for (GLsizei ii = 0; ii < count; ++ii) {
1919 if (varyings[ii]) {
1920 GPU_CLIENT_LOG(" " << ii << ": ---\n" << varyings[ii] << "\n---");
1921 } else {
1922 GPU_CLIENT_LOG(" " << ii << ": NULL");
1926 if (count < 0) {
1927 SetGLError(GL_INVALID_VALUE, "glTransformFeedbackVaryings", "count < 0");
1928 return;
1931 if (!PackStringsToBucket(count, varyings, NULL,
1932 "glTransformFeedbackVaryings")) {
1933 return;
1935 helper_->TransformFeedbackVaryingsBucket(program, kResultBucketId,
1936 buffermode);
1937 helper_->SetBucketSize(kResultBucketId, 0);
1938 CheckGLError();
1941 void GLES2Implementation::Uniform1f(GLint location, GLfloat x) {
1942 GPU_CLIENT_SINGLE_THREAD_CHECK();
1943 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform1f(" << location << ", "
1944 << x << ")");
1945 helper_->Uniform1f(location, x);
1946 CheckGLError();
1949 void GLES2Implementation::Uniform1fv(GLint location,
1950 GLsizei count,
1951 const GLfloat* v) {
1952 GPU_CLIENT_SINGLE_THREAD_CHECK();
1953 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform1fv(" << location << ", "
1954 << count << ", " << static_cast<const void*>(v) << ")");
1955 GPU_CLIENT_LOG_CODE_BLOCK({
1956 for (GLsizei i = 0; i < count; ++i) {
1957 GPU_CLIENT_LOG(" " << i << ": " << v[0 + i * 1]);
1960 if (count < 0) {
1961 SetGLError(GL_INVALID_VALUE, "glUniform1fv", "count < 0");
1962 return;
1964 helper_->Uniform1fvImmediate(location, count, v);
1965 CheckGLError();
1968 void GLES2Implementation::Uniform1i(GLint location, GLint x) {
1969 GPU_CLIENT_SINGLE_THREAD_CHECK();
1970 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform1i(" << location << ", "
1971 << x << ")");
1972 helper_->Uniform1i(location, x);
1973 CheckGLError();
1976 void GLES2Implementation::Uniform1iv(GLint location,
1977 GLsizei count,
1978 const GLint* v) {
1979 GPU_CLIENT_SINGLE_THREAD_CHECK();
1980 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform1iv(" << location << ", "
1981 << count << ", " << static_cast<const void*>(v) << ")");
1982 GPU_CLIENT_LOG_CODE_BLOCK({
1983 for (GLsizei i = 0; i < count; ++i) {
1984 GPU_CLIENT_LOG(" " << i << ": " << v[0 + i * 1]);
1987 if (count < 0) {
1988 SetGLError(GL_INVALID_VALUE, "glUniform1iv", "count < 0");
1989 return;
1991 helper_->Uniform1ivImmediate(location, count, v);
1992 CheckGLError();
1995 void GLES2Implementation::Uniform1ui(GLint location, GLuint x) {
1996 GPU_CLIENT_SINGLE_THREAD_CHECK();
1997 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform1ui(" << location << ", "
1998 << x << ")");
1999 helper_->Uniform1ui(location, x);
2000 CheckGLError();
2003 void GLES2Implementation::Uniform1uiv(GLint location,
2004 GLsizei count,
2005 const GLuint* v) {
2006 GPU_CLIENT_SINGLE_THREAD_CHECK();
2007 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform1uiv(" << location << ", "
2008 << count << ", " << static_cast<const void*>(v) << ")");
2009 GPU_CLIENT_LOG_CODE_BLOCK({
2010 for (GLsizei i = 0; i < count; ++i) {
2011 GPU_CLIENT_LOG(" " << i << ": " << v[0 + i * 1]);
2014 if (count < 0) {
2015 SetGLError(GL_INVALID_VALUE, "glUniform1uiv", "count < 0");
2016 return;
2018 helper_->Uniform1uivImmediate(location, count, v);
2019 CheckGLError();
2022 void GLES2Implementation::Uniform2f(GLint location, GLfloat x, GLfloat y) {
2023 GPU_CLIENT_SINGLE_THREAD_CHECK();
2024 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform2f(" << location << ", "
2025 << x << ", " << y << ")");
2026 helper_->Uniform2f(location, x, y);
2027 CheckGLError();
2030 void GLES2Implementation::Uniform2fv(GLint location,
2031 GLsizei count,
2032 const GLfloat* v) {
2033 GPU_CLIENT_SINGLE_THREAD_CHECK();
2034 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform2fv(" << location << ", "
2035 << count << ", " << static_cast<const void*>(v) << ")");
2036 GPU_CLIENT_LOG_CODE_BLOCK({
2037 for (GLsizei i = 0; i < count; ++i) {
2038 GPU_CLIENT_LOG(" " << i << ": " << v[0 + i * 2] << ", " << v[1 + i * 2]);
2041 if (count < 0) {
2042 SetGLError(GL_INVALID_VALUE, "glUniform2fv", "count < 0");
2043 return;
2045 helper_->Uniform2fvImmediate(location, count, v);
2046 CheckGLError();
2049 void GLES2Implementation::Uniform2i(GLint location, GLint x, GLint y) {
2050 GPU_CLIENT_SINGLE_THREAD_CHECK();
2051 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform2i(" << location << ", "
2052 << x << ", " << y << ")");
2053 helper_->Uniform2i(location, x, y);
2054 CheckGLError();
2057 void GLES2Implementation::Uniform2iv(GLint location,
2058 GLsizei count,
2059 const GLint* v) {
2060 GPU_CLIENT_SINGLE_THREAD_CHECK();
2061 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform2iv(" << location << ", "
2062 << count << ", " << static_cast<const void*>(v) << ")");
2063 GPU_CLIENT_LOG_CODE_BLOCK({
2064 for (GLsizei i = 0; i < count; ++i) {
2065 GPU_CLIENT_LOG(" " << i << ": " << v[0 + i * 2] << ", " << v[1 + i * 2]);
2068 if (count < 0) {
2069 SetGLError(GL_INVALID_VALUE, "glUniform2iv", "count < 0");
2070 return;
2072 helper_->Uniform2ivImmediate(location, count, v);
2073 CheckGLError();
2076 void GLES2Implementation::Uniform2ui(GLint location, GLuint x, GLuint y) {
2077 GPU_CLIENT_SINGLE_THREAD_CHECK();
2078 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform2ui(" << location << ", "
2079 << x << ", " << y << ")");
2080 helper_->Uniform2ui(location, x, y);
2081 CheckGLError();
2084 void GLES2Implementation::Uniform2uiv(GLint location,
2085 GLsizei count,
2086 const GLuint* v) {
2087 GPU_CLIENT_SINGLE_THREAD_CHECK();
2088 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform2uiv(" << location << ", "
2089 << count << ", " << static_cast<const void*>(v) << ")");
2090 GPU_CLIENT_LOG_CODE_BLOCK({
2091 for (GLsizei i = 0; i < count; ++i) {
2092 GPU_CLIENT_LOG(" " << i << ": " << v[0 + i * 2] << ", " << v[1 + i * 2]);
2095 if (count < 0) {
2096 SetGLError(GL_INVALID_VALUE, "glUniform2uiv", "count < 0");
2097 return;
2099 helper_->Uniform2uivImmediate(location, count, v);
2100 CheckGLError();
2103 void GLES2Implementation::Uniform3f(GLint location,
2104 GLfloat x,
2105 GLfloat y,
2106 GLfloat z) {
2107 GPU_CLIENT_SINGLE_THREAD_CHECK();
2108 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform3f(" << location << ", "
2109 << x << ", " << y << ", " << z << ")");
2110 helper_->Uniform3f(location, x, y, z);
2111 CheckGLError();
2114 void GLES2Implementation::Uniform3fv(GLint location,
2115 GLsizei count,
2116 const GLfloat* v) {
2117 GPU_CLIENT_SINGLE_THREAD_CHECK();
2118 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform3fv(" << location << ", "
2119 << count << ", " << static_cast<const void*>(v) << ")");
2120 GPU_CLIENT_LOG_CODE_BLOCK({
2121 for (GLsizei i = 0; i < count; ++i) {
2122 GPU_CLIENT_LOG(" " << i << ": " << v[0 + i * 3] << ", " << v[1 + i * 3]
2123 << ", " << v[2 + i * 3]);
2126 if (count < 0) {
2127 SetGLError(GL_INVALID_VALUE, "glUniform3fv", "count < 0");
2128 return;
2130 helper_->Uniform3fvImmediate(location, count, v);
2131 CheckGLError();
2134 void GLES2Implementation::Uniform3i(GLint location, GLint x, GLint y, GLint z) {
2135 GPU_CLIENT_SINGLE_THREAD_CHECK();
2136 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform3i(" << location << ", "
2137 << x << ", " << y << ", " << z << ")");
2138 helper_->Uniform3i(location, x, y, z);
2139 CheckGLError();
2142 void GLES2Implementation::Uniform3iv(GLint location,
2143 GLsizei count,
2144 const GLint* v) {
2145 GPU_CLIENT_SINGLE_THREAD_CHECK();
2146 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform3iv(" << location << ", "
2147 << count << ", " << static_cast<const void*>(v) << ")");
2148 GPU_CLIENT_LOG_CODE_BLOCK({
2149 for (GLsizei i = 0; i < count; ++i) {
2150 GPU_CLIENT_LOG(" " << i << ": " << v[0 + i * 3] << ", " << v[1 + i * 3]
2151 << ", " << v[2 + i * 3]);
2154 if (count < 0) {
2155 SetGLError(GL_INVALID_VALUE, "glUniform3iv", "count < 0");
2156 return;
2158 helper_->Uniform3ivImmediate(location, count, v);
2159 CheckGLError();
2162 void GLES2Implementation::Uniform3ui(GLint location,
2163 GLuint x,
2164 GLuint y,
2165 GLuint z) {
2166 GPU_CLIENT_SINGLE_THREAD_CHECK();
2167 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform3ui(" << location << ", "
2168 << x << ", " << y << ", " << z << ")");
2169 helper_->Uniform3ui(location, x, y, z);
2170 CheckGLError();
2173 void GLES2Implementation::Uniform3uiv(GLint location,
2174 GLsizei count,
2175 const GLuint* v) {
2176 GPU_CLIENT_SINGLE_THREAD_CHECK();
2177 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform3uiv(" << location << ", "
2178 << count << ", " << static_cast<const void*>(v) << ")");
2179 GPU_CLIENT_LOG_CODE_BLOCK({
2180 for (GLsizei i = 0; i < count; ++i) {
2181 GPU_CLIENT_LOG(" " << i << ": " << v[0 + i * 3] << ", " << v[1 + i * 3]
2182 << ", " << v[2 + i * 3]);
2185 if (count < 0) {
2186 SetGLError(GL_INVALID_VALUE, "glUniform3uiv", "count < 0");
2187 return;
2189 helper_->Uniform3uivImmediate(location, count, v);
2190 CheckGLError();
2193 void GLES2Implementation::Uniform4f(GLint location,
2194 GLfloat x,
2195 GLfloat y,
2196 GLfloat z,
2197 GLfloat w) {
2198 GPU_CLIENT_SINGLE_THREAD_CHECK();
2199 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform4f(" << location << ", "
2200 << x << ", " << y << ", " << z << ", " << w << ")");
2201 helper_->Uniform4f(location, x, y, z, w);
2202 CheckGLError();
2205 void GLES2Implementation::Uniform4fv(GLint location,
2206 GLsizei count,
2207 const GLfloat* v) {
2208 GPU_CLIENT_SINGLE_THREAD_CHECK();
2209 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform4fv(" << location << ", "
2210 << count << ", " << static_cast<const void*>(v) << ")");
2211 GPU_CLIENT_LOG_CODE_BLOCK({
2212 for (GLsizei i = 0; i < count; ++i) {
2213 GPU_CLIENT_LOG(" " << i << ": " << v[0 + i * 4] << ", " << v[1 + i * 4]
2214 << ", " << v[2 + i * 4] << ", " << v[3 + i * 4]);
2217 if (count < 0) {
2218 SetGLError(GL_INVALID_VALUE, "glUniform4fv", "count < 0");
2219 return;
2221 helper_->Uniform4fvImmediate(location, count, v);
2222 CheckGLError();
2225 void GLES2Implementation::Uniform4i(GLint location,
2226 GLint x,
2227 GLint y,
2228 GLint z,
2229 GLint w) {
2230 GPU_CLIENT_SINGLE_THREAD_CHECK();
2231 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform4i(" << location << ", "
2232 << x << ", " << y << ", " << z << ", " << w << ")");
2233 helper_->Uniform4i(location, x, y, z, w);
2234 CheckGLError();
2237 void GLES2Implementation::Uniform4iv(GLint location,
2238 GLsizei count,
2239 const GLint* v) {
2240 GPU_CLIENT_SINGLE_THREAD_CHECK();
2241 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform4iv(" << location << ", "
2242 << count << ", " << static_cast<const void*>(v) << ")");
2243 GPU_CLIENT_LOG_CODE_BLOCK({
2244 for (GLsizei i = 0; i < count; ++i) {
2245 GPU_CLIENT_LOG(" " << i << ": " << v[0 + i * 4] << ", " << v[1 + i * 4]
2246 << ", " << v[2 + i * 4] << ", " << v[3 + i * 4]);
2249 if (count < 0) {
2250 SetGLError(GL_INVALID_VALUE, "glUniform4iv", "count < 0");
2251 return;
2253 helper_->Uniform4ivImmediate(location, count, v);
2254 CheckGLError();
2257 void GLES2Implementation::Uniform4ui(GLint location,
2258 GLuint x,
2259 GLuint y,
2260 GLuint z,
2261 GLuint w) {
2262 GPU_CLIENT_SINGLE_THREAD_CHECK();
2263 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform4ui(" << location << ", "
2264 << x << ", " << y << ", " << z << ", " << w << ")");
2265 helper_->Uniform4ui(location, x, y, z, w);
2266 CheckGLError();
2269 void GLES2Implementation::Uniform4uiv(GLint location,
2270 GLsizei count,
2271 const GLuint* v) {
2272 GPU_CLIENT_SINGLE_THREAD_CHECK();
2273 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform4uiv(" << location << ", "
2274 << count << ", " << static_cast<const void*>(v) << ")");
2275 GPU_CLIENT_LOG_CODE_BLOCK({
2276 for (GLsizei i = 0; i < count; ++i) {
2277 GPU_CLIENT_LOG(" " << i << ": " << v[0 + i * 4] << ", " << v[1 + i * 4]
2278 << ", " << v[2 + i * 4] << ", " << v[3 + i * 4]);
2281 if (count < 0) {
2282 SetGLError(GL_INVALID_VALUE, "glUniform4uiv", "count < 0");
2283 return;
2285 helper_->Uniform4uivImmediate(location, count, v);
2286 CheckGLError();
2289 void GLES2Implementation::UniformMatrix2fv(GLint location,
2290 GLsizei count,
2291 GLboolean transpose,
2292 const GLfloat* value) {
2293 GPU_CLIENT_SINGLE_THREAD_CHECK();
2294 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniformMatrix2fv(" << location
2295 << ", " << count << ", "
2296 << GLES2Util::GetStringBool(transpose) << ", "
2297 << static_cast<const void*>(value) << ")");
2298 GPU_CLIENT_LOG_CODE_BLOCK({
2299 for (GLsizei i = 0; i < count; ++i) {
2300 GPU_CLIENT_LOG(" " << i << ": " << value[0 + i * 4] << ", "
2301 << value[1 + i * 4] << ", " << value[2 + i * 4]
2302 << ", " << value[3 + i * 4]);
2305 if (count < 0) {
2306 SetGLError(GL_INVALID_VALUE, "glUniformMatrix2fv", "count < 0");
2307 return;
2309 if (transpose != false) {
2310 SetGLError(GL_INVALID_VALUE, "glUniformMatrix2fv",
2311 "transpose GL_INVALID_VALUE");
2312 return;
2314 helper_->UniformMatrix2fvImmediate(location, count, value);
2315 CheckGLError();
2318 void GLES2Implementation::UniformMatrix2x3fv(GLint location,
2319 GLsizei count,
2320 GLboolean transpose,
2321 const GLfloat* value) {
2322 GPU_CLIENT_SINGLE_THREAD_CHECK();
2323 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniformMatrix2x3fv(" << location
2324 << ", " << count << ", "
2325 << GLES2Util::GetStringBool(transpose) << ", "
2326 << static_cast<const void*>(value) << ")");
2327 GPU_CLIENT_LOG_CODE_BLOCK({
2328 for (GLsizei i = 0; i < count; ++i) {
2329 GPU_CLIENT_LOG(" " << i << ": " << value[0 + i * 6] << ", "
2330 << value[1 + i * 6] << ", " << value[2 + i * 6]
2331 << ", " << value[3 + i * 6] << ", "
2332 << value[4 + i * 6] << ", " << value[5 + i * 6]);
2335 if (count < 0) {
2336 SetGLError(GL_INVALID_VALUE, "glUniformMatrix2x3fv", "count < 0");
2337 return;
2339 if (transpose != false) {
2340 SetGLError(GL_INVALID_VALUE, "glUniformMatrix2x3fv",
2341 "transpose GL_INVALID_VALUE");
2342 return;
2344 helper_->UniformMatrix2x3fvImmediate(location, count, value);
2345 CheckGLError();
2348 void GLES2Implementation::UniformMatrix2x4fv(GLint location,
2349 GLsizei count,
2350 GLboolean transpose,
2351 const GLfloat* value) {
2352 GPU_CLIENT_SINGLE_THREAD_CHECK();
2353 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniformMatrix2x4fv(" << location
2354 << ", " << count << ", "
2355 << GLES2Util::GetStringBool(transpose) << ", "
2356 << static_cast<const void*>(value) << ")");
2357 GPU_CLIENT_LOG_CODE_BLOCK({
2358 for (GLsizei i = 0; i < count; ++i) {
2359 GPU_CLIENT_LOG(
2360 " " << i << ": " << value[0 + i * 8] << ", " << value[1 + i * 8]
2361 << ", " << value[2 + i * 8] << ", " << value[3 + i * 8] << ", "
2362 << value[4 + i * 8] << ", " << value[5 + i * 8] << ", "
2363 << value[6 + i * 8] << ", " << value[7 + i * 8]);
2366 if (count < 0) {
2367 SetGLError(GL_INVALID_VALUE, "glUniformMatrix2x4fv", "count < 0");
2368 return;
2370 if (transpose != false) {
2371 SetGLError(GL_INVALID_VALUE, "glUniformMatrix2x4fv",
2372 "transpose GL_INVALID_VALUE");
2373 return;
2375 helper_->UniformMatrix2x4fvImmediate(location, count, value);
2376 CheckGLError();
2379 void GLES2Implementation::UniformMatrix3fv(GLint location,
2380 GLsizei count,
2381 GLboolean transpose,
2382 const GLfloat* value) {
2383 GPU_CLIENT_SINGLE_THREAD_CHECK();
2384 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniformMatrix3fv(" << location
2385 << ", " << count << ", "
2386 << GLES2Util::GetStringBool(transpose) << ", "
2387 << static_cast<const void*>(value) << ")");
2388 GPU_CLIENT_LOG_CODE_BLOCK({
2389 for (GLsizei i = 0; i < count; ++i) {
2390 GPU_CLIENT_LOG(" " << i << ": " << value[0 + i * 9] << ", "
2391 << value[1 + i * 9] << ", " << value[2 + i * 9]
2392 << ", " << value[3 + i * 9] << ", "
2393 << value[4 + i * 9] << ", " << value[5 + i * 9]
2394 << ", " << value[6 + i * 9] << ", "
2395 << value[7 + i * 9] << ", " << value[8 + i * 9]);
2398 if (count < 0) {
2399 SetGLError(GL_INVALID_VALUE, "glUniformMatrix3fv", "count < 0");
2400 return;
2402 if (transpose != false) {
2403 SetGLError(GL_INVALID_VALUE, "glUniformMatrix3fv",
2404 "transpose GL_INVALID_VALUE");
2405 return;
2407 helper_->UniformMatrix3fvImmediate(location, count, value);
2408 CheckGLError();
2411 void GLES2Implementation::UniformMatrix3x2fv(GLint location,
2412 GLsizei count,
2413 GLboolean transpose,
2414 const GLfloat* value) {
2415 GPU_CLIENT_SINGLE_THREAD_CHECK();
2416 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniformMatrix3x2fv(" << location
2417 << ", " << count << ", "
2418 << GLES2Util::GetStringBool(transpose) << ", "
2419 << static_cast<const void*>(value) << ")");
2420 GPU_CLIENT_LOG_CODE_BLOCK({
2421 for (GLsizei i = 0; i < count; ++i) {
2422 GPU_CLIENT_LOG(" " << i << ": " << value[0 + i * 6] << ", "
2423 << value[1 + i * 6] << ", " << value[2 + i * 6]
2424 << ", " << value[3 + i * 6] << ", "
2425 << value[4 + i * 6] << ", " << value[5 + i * 6]);
2428 if (count < 0) {
2429 SetGLError(GL_INVALID_VALUE, "glUniformMatrix3x2fv", "count < 0");
2430 return;
2432 if (transpose != false) {
2433 SetGLError(GL_INVALID_VALUE, "glUniformMatrix3x2fv",
2434 "transpose GL_INVALID_VALUE");
2435 return;
2437 helper_->UniformMatrix3x2fvImmediate(location, count, value);
2438 CheckGLError();
2441 void GLES2Implementation::UniformMatrix3x4fv(GLint location,
2442 GLsizei count,
2443 GLboolean transpose,
2444 const GLfloat* value) {
2445 GPU_CLIENT_SINGLE_THREAD_CHECK();
2446 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniformMatrix3x4fv(" << location
2447 << ", " << count << ", "
2448 << GLES2Util::GetStringBool(transpose) << ", "
2449 << static_cast<const void*>(value) << ")");
2450 GPU_CLIENT_LOG_CODE_BLOCK({
2451 for (GLsizei i = 0; i < count; ++i) {
2452 GPU_CLIENT_LOG(
2453 " " << i << ": " << value[0 + i * 12] << ", " << value[1 + i * 12]
2454 << ", " << value[2 + i * 12] << ", " << value[3 + i * 12] << ", "
2455 << value[4 + i * 12] << ", " << value[5 + i * 12] << ", "
2456 << value[6 + i * 12] << ", " << value[7 + i * 12] << ", "
2457 << value[8 + i * 12] << ", " << value[9 + i * 12] << ", "
2458 << value[10 + i * 12] << ", " << value[11 + i * 12]);
2461 if (count < 0) {
2462 SetGLError(GL_INVALID_VALUE, "glUniformMatrix3x4fv", "count < 0");
2463 return;
2465 if (transpose != false) {
2466 SetGLError(GL_INVALID_VALUE, "glUniformMatrix3x4fv",
2467 "transpose GL_INVALID_VALUE");
2468 return;
2470 helper_->UniformMatrix3x4fvImmediate(location, count, value);
2471 CheckGLError();
2474 void GLES2Implementation::UniformMatrix4fv(GLint location,
2475 GLsizei count,
2476 GLboolean transpose,
2477 const GLfloat* value) {
2478 GPU_CLIENT_SINGLE_THREAD_CHECK();
2479 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniformMatrix4fv(" << location
2480 << ", " << count << ", "
2481 << GLES2Util::GetStringBool(transpose) << ", "
2482 << static_cast<const void*>(value) << ")");
2483 GPU_CLIENT_LOG_CODE_BLOCK({
2484 for (GLsizei i = 0; i < count; ++i) {
2485 GPU_CLIENT_LOG(
2486 " " << i << ": " << value[0 + i * 16] << ", " << value[1 + i * 16]
2487 << ", " << value[2 + i * 16] << ", " << value[3 + i * 16] << ", "
2488 << value[4 + i * 16] << ", " << value[5 + i * 16] << ", "
2489 << value[6 + i * 16] << ", " << value[7 + i * 16] << ", "
2490 << value[8 + i * 16] << ", " << value[9 + i * 16] << ", "
2491 << value[10 + i * 16] << ", " << value[11 + i * 16] << ", "
2492 << value[12 + i * 16] << ", " << value[13 + i * 16] << ", "
2493 << value[14 + i * 16] << ", " << value[15 + i * 16]);
2496 if (count < 0) {
2497 SetGLError(GL_INVALID_VALUE, "glUniformMatrix4fv", "count < 0");
2498 return;
2500 if (transpose != false) {
2501 SetGLError(GL_INVALID_VALUE, "glUniformMatrix4fv",
2502 "transpose GL_INVALID_VALUE");
2503 return;
2505 helper_->UniformMatrix4fvImmediate(location, count, value);
2506 CheckGLError();
2509 void GLES2Implementation::UniformMatrix4x2fv(GLint location,
2510 GLsizei count,
2511 GLboolean transpose,
2512 const GLfloat* value) {
2513 GPU_CLIENT_SINGLE_THREAD_CHECK();
2514 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniformMatrix4x2fv(" << location
2515 << ", " << count << ", "
2516 << GLES2Util::GetStringBool(transpose) << ", "
2517 << static_cast<const void*>(value) << ")");
2518 GPU_CLIENT_LOG_CODE_BLOCK({
2519 for (GLsizei i = 0; i < count; ++i) {
2520 GPU_CLIENT_LOG(
2521 " " << i << ": " << value[0 + i * 8] << ", " << value[1 + i * 8]
2522 << ", " << value[2 + i * 8] << ", " << value[3 + i * 8] << ", "
2523 << value[4 + i * 8] << ", " << value[5 + i * 8] << ", "
2524 << value[6 + i * 8] << ", " << value[7 + i * 8]);
2527 if (count < 0) {
2528 SetGLError(GL_INVALID_VALUE, "glUniformMatrix4x2fv", "count < 0");
2529 return;
2531 if (transpose != false) {
2532 SetGLError(GL_INVALID_VALUE, "glUniformMatrix4x2fv",
2533 "transpose GL_INVALID_VALUE");
2534 return;
2536 helper_->UniformMatrix4x2fvImmediate(location, count, value);
2537 CheckGLError();
2540 void GLES2Implementation::UniformMatrix4x3fv(GLint location,
2541 GLsizei count,
2542 GLboolean transpose,
2543 const GLfloat* value) {
2544 GPU_CLIENT_SINGLE_THREAD_CHECK();
2545 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniformMatrix4x3fv(" << location
2546 << ", " << count << ", "
2547 << GLES2Util::GetStringBool(transpose) << ", "
2548 << static_cast<const void*>(value) << ")");
2549 GPU_CLIENT_LOG_CODE_BLOCK({
2550 for (GLsizei i = 0; i < count; ++i) {
2551 GPU_CLIENT_LOG(
2552 " " << i << ": " << value[0 + i * 12] << ", " << value[1 + i * 12]
2553 << ", " << value[2 + i * 12] << ", " << value[3 + i * 12] << ", "
2554 << value[4 + i * 12] << ", " << value[5 + i * 12] << ", "
2555 << value[6 + i * 12] << ", " << value[7 + i * 12] << ", "
2556 << value[8 + i * 12] << ", " << value[9 + i * 12] << ", "
2557 << value[10 + i * 12] << ", " << value[11 + i * 12]);
2560 if (count < 0) {
2561 SetGLError(GL_INVALID_VALUE, "glUniformMatrix4x3fv", "count < 0");
2562 return;
2564 if (transpose != false) {
2565 SetGLError(GL_INVALID_VALUE, "glUniformMatrix4x3fv",
2566 "transpose GL_INVALID_VALUE");
2567 return;
2569 helper_->UniformMatrix4x3fvImmediate(location, count, value);
2570 CheckGLError();
2573 void GLES2Implementation::UseProgram(GLuint program) {
2574 GPU_CLIENT_SINGLE_THREAD_CHECK();
2575 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUseProgram(" << program << ")");
2576 if (IsProgramReservedId(program)) {
2577 SetGLError(GL_INVALID_OPERATION, "UseProgram", "program reserved id");
2578 return;
2580 UseProgramHelper(program);
2581 CheckGLError();
2584 void GLES2Implementation::ValidateProgram(GLuint program) {
2585 GPU_CLIENT_SINGLE_THREAD_CHECK();
2586 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glValidateProgram(" << program
2587 << ")");
2588 helper_->ValidateProgram(program);
2589 CheckGLError();
2592 void GLES2Implementation::VertexAttrib1f(GLuint indx, GLfloat x) {
2593 GPU_CLIENT_SINGLE_THREAD_CHECK();
2594 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glVertexAttrib1f(" << indx << ", "
2595 << x << ")");
2596 helper_->VertexAttrib1f(indx, x);
2597 CheckGLError();
2600 void GLES2Implementation::VertexAttrib1fv(GLuint indx, const GLfloat* values) {
2601 GPU_CLIENT_SINGLE_THREAD_CHECK();
2602 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glVertexAttrib1fv(" << indx << ", "
2603 << static_cast<const void*>(values) << ")");
2604 size_t count = 1;
2605 for (size_t ii = 0; ii < count; ++ii)
2606 GPU_CLIENT_LOG("value[" << ii << "]: " << values[ii]);
2607 helper_->VertexAttrib1fvImmediate(indx, values);
2608 CheckGLError();
2611 void GLES2Implementation::VertexAttrib2f(GLuint indx, GLfloat x, GLfloat y) {
2612 GPU_CLIENT_SINGLE_THREAD_CHECK();
2613 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glVertexAttrib2f(" << indx << ", "
2614 << x << ", " << y << ")");
2615 helper_->VertexAttrib2f(indx, x, y);
2616 CheckGLError();
2619 void GLES2Implementation::VertexAttrib2fv(GLuint indx, const GLfloat* values) {
2620 GPU_CLIENT_SINGLE_THREAD_CHECK();
2621 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glVertexAttrib2fv(" << indx << ", "
2622 << static_cast<const void*>(values) << ")");
2623 size_t count = 2;
2624 for (size_t ii = 0; ii < count; ++ii)
2625 GPU_CLIENT_LOG("value[" << ii << "]: " << values[ii]);
2626 helper_->VertexAttrib2fvImmediate(indx, values);
2627 CheckGLError();
2630 void GLES2Implementation::VertexAttrib3f(GLuint indx,
2631 GLfloat x,
2632 GLfloat y,
2633 GLfloat z) {
2634 GPU_CLIENT_SINGLE_THREAD_CHECK();
2635 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glVertexAttrib3f(" << indx << ", "
2636 << x << ", " << y << ", " << z << ")");
2637 helper_->VertexAttrib3f(indx, x, y, z);
2638 CheckGLError();
2641 void GLES2Implementation::VertexAttrib3fv(GLuint indx, const GLfloat* values) {
2642 GPU_CLIENT_SINGLE_THREAD_CHECK();
2643 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glVertexAttrib3fv(" << indx << ", "
2644 << static_cast<const void*>(values) << ")");
2645 size_t count = 3;
2646 for (size_t ii = 0; ii < count; ++ii)
2647 GPU_CLIENT_LOG("value[" << ii << "]: " << values[ii]);
2648 helper_->VertexAttrib3fvImmediate(indx, values);
2649 CheckGLError();
2652 void GLES2Implementation::VertexAttrib4f(GLuint indx,
2653 GLfloat x,
2654 GLfloat y,
2655 GLfloat z,
2656 GLfloat w) {
2657 GPU_CLIENT_SINGLE_THREAD_CHECK();
2658 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glVertexAttrib4f(" << indx << ", "
2659 << x << ", " << y << ", " << z << ", " << w << ")");
2660 helper_->VertexAttrib4f(indx, x, y, z, w);
2661 CheckGLError();
2664 void GLES2Implementation::VertexAttrib4fv(GLuint indx, const GLfloat* values) {
2665 GPU_CLIENT_SINGLE_THREAD_CHECK();
2666 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glVertexAttrib4fv(" << indx << ", "
2667 << static_cast<const void*>(values) << ")");
2668 size_t count = 4;
2669 for (size_t ii = 0; ii < count; ++ii)
2670 GPU_CLIENT_LOG("value[" << ii << "]: " << values[ii]);
2671 helper_->VertexAttrib4fvImmediate(indx, values);
2672 CheckGLError();
2675 void GLES2Implementation::VertexAttribI4i(GLuint indx,
2676 GLint x,
2677 GLint y,
2678 GLint z,
2679 GLint w) {
2680 GPU_CLIENT_SINGLE_THREAD_CHECK();
2681 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glVertexAttribI4i(" << indx << ", "
2682 << x << ", " << y << ", " << z << ", " << w << ")");
2683 helper_->VertexAttribI4i(indx, x, y, z, w);
2684 CheckGLError();
2687 void GLES2Implementation::VertexAttribI4iv(GLuint indx, const GLint* values) {
2688 GPU_CLIENT_SINGLE_THREAD_CHECK();
2689 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glVertexAttribI4iv(" << indx
2690 << ", " << static_cast<const void*>(values) << ")");
2691 size_t count = 4;
2692 for (size_t ii = 0; ii < count; ++ii)
2693 GPU_CLIENT_LOG("value[" << ii << "]: " << values[ii]);
2694 helper_->VertexAttribI4ivImmediate(indx, values);
2695 CheckGLError();
2698 void GLES2Implementation::VertexAttribI4ui(GLuint indx,
2699 GLuint x,
2700 GLuint y,
2701 GLuint z,
2702 GLuint w) {
2703 GPU_CLIENT_SINGLE_THREAD_CHECK();
2704 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glVertexAttribI4ui(" << indx
2705 << ", " << x << ", " << y << ", " << z << ", " << w
2706 << ")");
2707 helper_->VertexAttribI4ui(indx, x, y, z, w);
2708 CheckGLError();
2711 void GLES2Implementation::VertexAttribI4uiv(GLuint indx, const GLuint* values) {
2712 GPU_CLIENT_SINGLE_THREAD_CHECK();
2713 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glVertexAttribI4uiv(" << indx
2714 << ", " << static_cast<const void*>(values) << ")");
2715 size_t count = 4;
2716 for (size_t ii = 0; ii < count; ++ii)
2717 GPU_CLIENT_LOG("value[" << ii << "]: " << values[ii]);
2718 helper_->VertexAttribI4uivImmediate(indx, values);
2719 CheckGLError();
2722 void GLES2Implementation::Viewport(GLint x,
2723 GLint y,
2724 GLsizei width,
2725 GLsizei height) {
2726 GPU_CLIENT_SINGLE_THREAD_CHECK();
2727 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glViewport(" << x << ", " << y
2728 << ", " << width << ", " << height << ")");
2729 if (width < 0) {
2730 SetGLError(GL_INVALID_VALUE, "glViewport", "width < 0");
2731 return;
2733 if (height < 0) {
2734 SetGLError(GL_INVALID_VALUE, "glViewport", "height < 0");
2735 return;
2737 helper_->Viewport(x, y, width, height);
2738 CheckGLError();
2741 void GLES2Implementation::BlitFramebufferCHROMIUM(GLint srcX0,
2742 GLint srcY0,
2743 GLint srcX1,
2744 GLint srcY1,
2745 GLint dstX0,
2746 GLint dstY0,
2747 GLint dstX1,
2748 GLint dstY1,
2749 GLbitfield mask,
2750 GLenum filter) {
2751 GPU_CLIENT_SINGLE_THREAD_CHECK();
2752 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBlitFramebufferCHROMIUM("
2753 << srcX0 << ", " << srcY0 << ", " << srcX1 << ", " << srcY1
2754 << ", " << dstX0 << ", " << dstY0 << ", " << dstX1 << ", "
2755 << dstY1 << ", " << mask << ", "
2756 << GLES2Util::GetStringBlitFilter(filter) << ")");
2757 helper_->BlitFramebufferCHROMIUM(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0,
2758 dstX1, dstY1, mask, filter);
2759 CheckGLError();
2762 void GLES2Implementation::RenderbufferStorageMultisampleCHROMIUM(
2763 GLenum target,
2764 GLsizei samples,
2765 GLenum internalformat,
2766 GLsizei width,
2767 GLsizei height) {
2768 GPU_CLIENT_SINGLE_THREAD_CHECK();
2769 GPU_CLIENT_LOG(
2770 "[" << GetLogPrefix() << "] glRenderbufferStorageMultisampleCHROMIUM("
2771 << GLES2Util::GetStringRenderBufferTarget(target) << ", " << samples
2772 << ", " << GLES2Util::GetStringRenderBufferFormat(internalformat)
2773 << ", " << width << ", " << height << ")");
2774 if (samples < 0) {
2775 SetGLError(GL_INVALID_VALUE, "glRenderbufferStorageMultisampleCHROMIUM",
2776 "samples < 0");
2777 return;
2779 if (width < 0) {
2780 SetGLError(GL_INVALID_VALUE, "glRenderbufferStorageMultisampleCHROMIUM",
2781 "width < 0");
2782 return;
2784 if (height < 0) {
2785 SetGLError(GL_INVALID_VALUE, "glRenderbufferStorageMultisampleCHROMIUM",
2786 "height < 0");
2787 return;
2789 helper_->RenderbufferStorageMultisampleCHROMIUM(
2790 target, samples, internalformat, width, height);
2791 CheckGLError();
2794 void GLES2Implementation::RenderbufferStorageMultisampleEXT(
2795 GLenum target,
2796 GLsizei samples,
2797 GLenum internalformat,
2798 GLsizei width,
2799 GLsizei height) {
2800 GPU_CLIENT_SINGLE_THREAD_CHECK();
2801 GPU_CLIENT_LOG(
2802 "[" << GetLogPrefix() << "] glRenderbufferStorageMultisampleEXT("
2803 << GLES2Util::GetStringRenderBufferTarget(target) << ", " << samples
2804 << ", " << GLES2Util::GetStringRenderBufferFormat(internalformat)
2805 << ", " << width << ", " << height << ")");
2806 if (samples < 0) {
2807 SetGLError(GL_INVALID_VALUE, "glRenderbufferStorageMultisampleEXT",
2808 "samples < 0");
2809 return;
2811 if (width < 0) {
2812 SetGLError(GL_INVALID_VALUE, "glRenderbufferStorageMultisampleEXT",
2813 "width < 0");
2814 return;
2816 if (height < 0) {
2817 SetGLError(GL_INVALID_VALUE, "glRenderbufferStorageMultisampleEXT",
2818 "height < 0");
2819 return;
2821 helper_->RenderbufferStorageMultisampleEXT(target, samples, internalformat,
2822 width, height);
2823 CheckGLError();
2826 void GLES2Implementation::FramebufferTexture2DMultisampleEXT(GLenum target,
2827 GLenum attachment,
2828 GLenum textarget,
2829 GLuint texture,
2830 GLint level,
2831 GLsizei samples) {
2832 GPU_CLIENT_SINGLE_THREAD_CHECK();
2833 GPU_CLIENT_LOG("[" << GetLogPrefix()
2834 << "] glFramebufferTexture2DMultisampleEXT("
2835 << GLES2Util::GetStringFrameBufferTarget(target) << ", "
2836 << GLES2Util::GetStringAttachment(attachment) << ", "
2837 << GLES2Util::GetStringTextureTarget(textarget) << ", "
2838 << texture << ", " << level << ", " << samples << ")");
2839 if (level != 0) {
2840 SetGLError(GL_INVALID_VALUE, "glFramebufferTexture2DMultisampleEXT",
2841 "level GL_INVALID_VALUE");
2842 return;
2844 if (samples < 0) {
2845 SetGLError(GL_INVALID_VALUE, "glFramebufferTexture2DMultisampleEXT",
2846 "samples < 0");
2847 return;
2849 helper_->FramebufferTexture2DMultisampleEXT(target, attachment, textarget,
2850 texture, samples);
2851 CheckGLError();
2854 void GLES2Implementation::TexStorage2DEXT(GLenum target,
2855 GLsizei levels,
2856 GLenum internalFormat,
2857 GLsizei width,
2858 GLsizei height) {
2859 GPU_CLIENT_SINGLE_THREAD_CHECK();
2860 GPU_CLIENT_LOG(
2861 "[" << GetLogPrefix() << "] glTexStorage2DEXT("
2862 << GLES2Util::GetStringTextureTarget(target) << ", " << levels << ", "
2863 << GLES2Util::GetStringTextureInternalFormatStorage(internalFormat)
2864 << ", " << width << ", " << height << ")");
2865 if (levels < 0) {
2866 SetGLError(GL_INVALID_VALUE, "glTexStorage2DEXT", "levels < 0");
2867 return;
2869 if (width < 0) {
2870 SetGLError(GL_INVALID_VALUE, "glTexStorage2DEXT", "width < 0");
2871 return;
2873 if (height < 0) {
2874 SetGLError(GL_INVALID_VALUE, "glTexStorage2DEXT", "height < 0");
2875 return;
2877 helper_->TexStorage2DEXT(target, levels, internalFormat, width, height);
2878 CheckGLError();
2881 void GLES2Implementation::GenQueriesEXT(GLsizei n, GLuint* queries) {
2882 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGenQueriesEXT(" << n << ", "
2883 << static_cast<const void*>(queries) << ")");
2884 if (n < 0) {
2885 SetGLError(GL_INVALID_VALUE, "glGenQueriesEXT", "n < 0");
2886 return;
2888 GPU_CLIENT_SINGLE_THREAD_CHECK();
2889 IdAllocator* id_allocator = GetIdAllocator(id_namespaces::kQueries);
2890 for (GLsizei ii = 0; ii < n; ++ii)
2891 queries[ii] = id_allocator->AllocateID();
2892 GenQueriesEXTHelper(n, queries);
2893 helper_->GenQueriesEXTImmediate(n, queries);
2894 if (share_group_->bind_generates_resource())
2895 helper_->CommandBufferHelper::Flush();
2896 GPU_CLIENT_LOG_CODE_BLOCK({
2897 for (GLsizei i = 0; i < n; ++i) {
2898 GPU_CLIENT_LOG(" " << i << ": " << queries[i]);
2901 CheckGLError();
2904 void GLES2Implementation::DeleteQueriesEXT(GLsizei n, const GLuint* queries) {
2905 GPU_CLIENT_SINGLE_THREAD_CHECK();
2906 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDeleteQueriesEXT(" << n << ", "
2907 << static_cast<const void*>(queries) << ")");
2908 GPU_CLIENT_LOG_CODE_BLOCK({
2909 for (GLsizei i = 0; i < n; ++i) {
2910 GPU_CLIENT_LOG(" " << i << ": " << queries[i]);
2913 GPU_CLIENT_DCHECK_CODE_BLOCK({
2914 for (GLsizei i = 0; i < n; ++i) {
2915 DCHECK(queries[i] != 0);
2918 if (n < 0) {
2919 SetGLError(GL_INVALID_VALUE, "glDeleteQueriesEXT", "n < 0");
2920 return;
2922 DeleteQueriesEXTHelper(n, queries);
2923 CheckGLError();
2926 void GLES2Implementation::BeginTransformFeedback(GLenum primitivemode) {
2927 GPU_CLIENT_SINGLE_THREAD_CHECK();
2928 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBeginTransformFeedback("
2929 << GLES2Util::GetStringTransformFeedbackPrimitiveMode(
2930 primitivemode) << ")");
2931 helper_->BeginTransformFeedback(primitivemode);
2932 CheckGLError();
2935 void GLES2Implementation::EndTransformFeedback() {
2936 GPU_CLIENT_SINGLE_THREAD_CHECK();
2937 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glEndTransformFeedback("
2938 << ")");
2939 helper_->EndTransformFeedback();
2940 CheckGLError();
2943 void GLES2Implementation::GenVertexArraysOES(GLsizei n, GLuint* arrays) {
2944 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGenVertexArraysOES(" << n << ", "
2945 << static_cast<const void*>(arrays) << ")");
2946 if (n < 0) {
2947 SetGLError(GL_INVALID_VALUE, "glGenVertexArraysOES", "n < 0");
2948 return;
2950 GPU_CLIENT_SINGLE_THREAD_CHECK();
2951 GetIdHandler(id_namespaces::kVertexArrays)->MakeIds(this, 0, n, arrays);
2952 GenVertexArraysOESHelper(n, arrays);
2953 helper_->GenVertexArraysOESImmediate(n, arrays);
2954 if (share_group_->bind_generates_resource())
2955 helper_->CommandBufferHelper::Flush();
2956 GPU_CLIENT_LOG_CODE_BLOCK({
2957 for (GLsizei i = 0; i < n; ++i) {
2958 GPU_CLIENT_LOG(" " << i << ": " << arrays[i]);
2961 CheckGLError();
2964 void GLES2Implementation::DeleteVertexArraysOES(GLsizei n,
2965 const GLuint* arrays) {
2966 GPU_CLIENT_SINGLE_THREAD_CHECK();
2967 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDeleteVertexArraysOES(" << n
2968 << ", " << static_cast<const void*>(arrays) << ")");
2969 GPU_CLIENT_LOG_CODE_BLOCK({
2970 for (GLsizei i = 0; i < n; ++i) {
2971 GPU_CLIENT_LOG(" " << i << ": " << arrays[i]);
2974 GPU_CLIENT_DCHECK_CODE_BLOCK({
2975 for (GLsizei i = 0; i < n; ++i) {
2976 DCHECK(arrays[i] != 0);
2979 if (n < 0) {
2980 SetGLError(GL_INVALID_VALUE, "glDeleteVertexArraysOES", "n < 0");
2981 return;
2983 DeleteVertexArraysOESHelper(n, arrays);
2984 CheckGLError();
2987 GLboolean GLES2Implementation::IsVertexArrayOES(GLuint array) {
2988 GPU_CLIENT_SINGLE_THREAD_CHECK();
2989 TRACE_EVENT0("gpu", "GLES2Implementation::IsVertexArrayOES");
2990 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glIsVertexArrayOES(" << array
2991 << ")");
2992 typedef cmds::IsVertexArrayOES::Result Result;
2993 Result* result = GetResultAs<Result*>();
2994 if (!result) {
2995 return GL_FALSE;
2997 *result = 0;
2998 helper_->IsVertexArrayOES(array, GetResultShmId(), GetResultShmOffset());
2999 WaitForCmd();
3000 GLboolean result_value = *result != 0;
3001 GPU_CLIENT_LOG("returned " << result_value);
3002 CheckGLError();
3003 return result_value;
3006 void GLES2Implementation::BindVertexArrayOES(GLuint array) {
3007 GPU_CLIENT_SINGLE_THREAD_CHECK();
3008 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBindVertexArrayOES(" << array
3009 << ")");
3010 if (IsVertexArrayReservedId(array)) {
3011 SetGLError(GL_INVALID_OPERATION, "BindVertexArrayOES", "array reserved id");
3012 return;
3014 BindVertexArrayOESHelper(array);
3015 CheckGLError();
3018 void GLES2Implementation::GetTranslatedShaderSourceANGLE(GLuint shader,
3019 GLsizei bufsize,
3020 GLsizei* length,
3021 char* source) {
3022 GPU_CLIENT_SINGLE_THREAD_CHECK();
3023 GPU_CLIENT_VALIDATE_DESTINATION_OPTIONAL_INITALIZATION(GLsizei, length);
3024 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetTranslatedShaderSourceANGLE"
3025 << "(" << shader << ", " << bufsize << ", "
3026 << static_cast<void*>(length) << ", "
3027 << static_cast<void*>(source) << ")");
3028 helper_->SetBucketSize(kResultBucketId, 0);
3029 helper_->GetTranslatedShaderSourceANGLE(shader, kResultBucketId);
3030 std::string str;
3031 GLsizei max_size = 0;
3032 if (GetBucketAsString(kResultBucketId, &str)) {
3033 if (bufsize > 0) {
3034 max_size = std::min(static_cast<size_t>(bufsize) - 1, str.size());
3035 memcpy(source, str.c_str(), max_size);
3036 source[max_size] = '\0';
3037 GPU_CLIENT_LOG("------\n" << source << "\n------");
3040 if (length != NULL) {
3041 *length = max_size;
3043 CheckGLError();
3045 void GLES2Implementation::TexImageIOSurface2DCHROMIUM(GLenum target,
3046 GLsizei width,
3047 GLsizei height,
3048 GLuint ioSurfaceId,
3049 GLuint plane) {
3050 GPU_CLIENT_SINGLE_THREAD_CHECK();
3051 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glTexImageIOSurface2DCHROMIUM("
3052 << GLES2Util::GetStringTextureBindTarget(target) << ", "
3053 << width << ", " << height << ", " << ioSurfaceId << ", "
3054 << plane << ")");
3055 if (width < 0) {
3056 SetGLError(GL_INVALID_VALUE, "glTexImageIOSurface2DCHROMIUM", "width < 0");
3057 return;
3059 if (height < 0) {
3060 SetGLError(GL_INVALID_VALUE, "glTexImageIOSurface2DCHROMIUM", "height < 0");
3061 return;
3063 helper_->TexImageIOSurface2DCHROMIUM(target, width, height, ioSurfaceId,
3064 plane);
3065 CheckGLError();
3068 void GLES2Implementation::CopyTextureCHROMIUM(GLenum target,
3069 GLenum source_id,
3070 GLenum dest_id,
3071 GLint level,
3072 GLint internalformat,
3073 GLenum dest_type) {
3074 GPU_CLIENT_SINGLE_THREAD_CHECK();
3075 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glCopyTextureCHROMIUM("
3076 << GLES2Util::GetStringEnum(target) << ", "
3077 << GLES2Util::GetStringEnum(source_id) << ", "
3078 << GLES2Util::GetStringEnum(dest_id) << ", " << level
3079 << ", " << internalformat << ", "
3080 << GLES2Util::GetStringPixelType(dest_type) << ")");
3081 helper_->CopyTextureCHROMIUM(target, source_id, dest_id, level,
3082 internalformat, dest_type);
3083 CheckGLError();
3086 void GLES2Implementation::GenValuebuffersCHROMIUM(GLsizei n, GLuint* buffers) {
3087 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGenValuebuffersCHROMIUM(" << n
3088 << ", " << static_cast<const void*>(buffers) << ")");
3089 if (n < 0) {
3090 SetGLError(GL_INVALID_VALUE, "glGenValuebuffersCHROMIUM", "n < 0");
3091 return;
3093 GPU_CLIENT_SINGLE_THREAD_CHECK();
3094 GetIdHandler(id_namespaces::kValuebuffers)->MakeIds(this, 0, n, buffers);
3095 GenValuebuffersCHROMIUMHelper(n, buffers);
3096 helper_->GenValuebuffersCHROMIUMImmediate(n, buffers);
3097 if (share_group_->bind_generates_resource())
3098 helper_->CommandBufferHelper::Flush();
3099 GPU_CLIENT_LOG_CODE_BLOCK({
3100 for (GLsizei i = 0; i < n; ++i) {
3101 GPU_CLIENT_LOG(" " << i << ": " << buffers[i]);
3104 CheckGLError();
3107 void GLES2Implementation::DeleteValuebuffersCHROMIUM(
3108 GLsizei n,
3109 const GLuint* valuebuffers) {
3110 GPU_CLIENT_SINGLE_THREAD_CHECK();
3111 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDeleteValuebuffersCHROMIUM(" << n
3112 << ", " << static_cast<const void*>(valuebuffers) << ")");
3113 GPU_CLIENT_LOG_CODE_BLOCK({
3114 for (GLsizei i = 0; i < n; ++i) {
3115 GPU_CLIENT_LOG(" " << i << ": " << valuebuffers[i]);
3118 GPU_CLIENT_DCHECK_CODE_BLOCK({
3119 for (GLsizei i = 0; i < n; ++i) {
3120 DCHECK(valuebuffers[i] != 0);
3123 if (n < 0) {
3124 SetGLError(GL_INVALID_VALUE, "glDeleteValuebuffersCHROMIUM", "n < 0");
3125 return;
3127 DeleteValuebuffersCHROMIUMHelper(n, valuebuffers);
3128 CheckGLError();
3131 GLboolean GLES2Implementation::IsValuebufferCHROMIUM(GLuint valuebuffer) {
3132 GPU_CLIENT_SINGLE_THREAD_CHECK();
3133 TRACE_EVENT0("gpu", "GLES2Implementation::IsValuebufferCHROMIUM");
3134 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glIsValuebufferCHROMIUM("
3135 << valuebuffer << ")");
3136 typedef cmds::IsValuebufferCHROMIUM::Result Result;
3137 Result* result = GetResultAs<Result*>();
3138 if (!result) {
3139 return GL_FALSE;
3141 *result = 0;
3142 helper_->IsValuebufferCHROMIUM(valuebuffer, GetResultShmId(),
3143 GetResultShmOffset());
3144 WaitForCmd();
3145 GLboolean result_value = *result != 0;
3146 GPU_CLIENT_LOG("returned " << result_value);
3147 CheckGLError();
3148 return result_value;
3151 void GLES2Implementation::BindValuebufferCHROMIUM(GLenum target,
3152 GLuint valuebuffer) {
3153 GPU_CLIENT_SINGLE_THREAD_CHECK();
3154 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBindValuebufferCHROMIUM("
3155 << GLES2Util::GetStringValueBufferTarget(target) << ", "
3156 << valuebuffer << ")");
3157 if (IsValuebufferReservedId(valuebuffer)) {
3158 SetGLError(GL_INVALID_OPERATION, "BindValuebufferCHROMIUM",
3159 "valuebuffer reserved id");
3160 return;
3162 BindValuebufferCHROMIUMHelper(target, valuebuffer);
3163 CheckGLError();
3166 void GLES2Implementation::SubscribeValueCHROMIUM(GLenum target,
3167 GLenum subscription) {
3168 GPU_CLIENT_SINGLE_THREAD_CHECK();
3169 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glSubscribeValueCHROMIUM("
3170 << GLES2Util::GetStringValueBufferTarget(target) << ", "
3171 << GLES2Util::GetStringSubscriptionTarget(subscription)
3172 << ")");
3173 helper_->SubscribeValueCHROMIUM(target, subscription);
3174 CheckGLError();
3177 void GLES2Implementation::PopulateSubscribedValuesCHROMIUM(GLenum target) {
3178 GPU_CLIENT_SINGLE_THREAD_CHECK();
3179 GPU_CLIENT_LOG("[" << GetLogPrefix()
3180 << "] glPopulateSubscribedValuesCHROMIUM("
3181 << GLES2Util::GetStringValueBufferTarget(target) << ")");
3182 helper_->PopulateSubscribedValuesCHROMIUM(target);
3183 CheckGLError();
3186 void GLES2Implementation::UniformValuebufferCHROMIUM(GLint location,
3187 GLenum target,
3188 GLenum subscription) {
3189 GPU_CLIENT_SINGLE_THREAD_CHECK();
3190 GPU_CLIENT_LOG(
3191 "[" << GetLogPrefix() << "] glUniformValuebufferCHROMIUM(" << location
3192 << ", " << GLES2Util::GetStringValueBufferTarget(target) << ", "
3193 << GLES2Util::GetStringSubscriptionTarget(subscription) << ")");
3194 helper_->UniformValuebufferCHROMIUM(location, target, subscription);
3195 CheckGLError();
3198 void GLES2Implementation::BindTexImage2DCHROMIUM(GLenum target, GLint imageId) {
3199 GPU_CLIENT_SINGLE_THREAD_CHECK();
3200 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBindTexImage2DCHROMIUM("
3201 << GLES2Util::GetStringTextureBindTarget(target) << ", "
3202 << imageId << ")");
3203 helper_->BindTexImage2DCHROMIUM(target, imageId);
3204 CheckGLError();
3207 void GLES2Implementation::ReleaseTexImage2DCHROMIUM(GLenum target,
3208 GLint imageId) {
3209 GPU_CLIENT_SINGLE_THREAD_CHECK();
3210 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glReleaseTexImage2DCHROMIUM("
3211 << GLES2Util::GetStringTextureBindTarget(target) << ", "
3212 << imageId << ")");
3213 helper_->ReleaseTexImage2DCHROMIUM(target, imageId);
3214 CheckGLError();
3217 void GLES2Implementation::DiscardFramebufferEXT(GLenum target,
3218 GLsizei count,
3219 const GLenum* attachments) {
3220 GPU_CLIENT_SINGLE_THREAD_CHECK();
3221 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDiscardFramebufferEXT("
3222 << GLES2Util::GetStringEnum(target) << ", " << count
3223 << ", " << static_cast<const void*>(attachments) << ")");
3224 GPU_CLIENT_LOG_CODE_BLOCK({
3225 for (GLsizei i = 0; i < count; ++i) {
3226 GPU_CLIENT_LOG(" " << i << ": " << attachments[0 + i * 1]);
3229 if (count < 0) {
3230 SetGLError(GL_INVALID_VALUE, "glDiscardFramebufferEXT", "count < 0");
3231 return;
3233 helper_->DiscardFramebufferEXTImmediate(target, count, attachments);
3234 CheckGLError();
3237 void GLES2Implementation::LoseContextCHROMIUM(GLenum current, GLenum other) {
3238 GPU_CLIENT_SINGLE_THREAD_CHECK();
3239 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glLoseContextCHROMIUM("
3240 << GLES2Util::GetStringResetStatus(current) << ", "
3241 << GLES2Util::GetStringResetStatus(other) << ")");
3242 helper_->LoseContextCHROMIUM(current, other);
3243 CheckGLError();
3246 void GLES2Implementation::WaitSyncPointCHROMIUM(GLuint sync_point) {
3247 GPU_CLIENT_SINGLE_THREAD_CHECK();
3248 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glWaitSyncPointCHROMIUM("
3249 << sync_point << ")");
3250 helper_->WaitSyncPointCHROMIUM(sync_point);
3251 CheckGLError();
3254 void GLES2Implementation::DrawBuffersEXT(GLsizei count, const GLenum* bufs) {
3255 GPU_CLIENT_SINGLE_THREAD_CHECK();
3256 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDrawBuffersEXT(" << count << ", "
3257 << static_cast<const void*>(bufs) << ")");
3258 GPU_CLIENT_LOG_CODE_BLOCK({
3259 for (GLsizei i = 0; i < count; ++i) {
3260 GPU_CLIENT_LOG(" " << i << ": " << bufs[0 + i * 1]);
3263 if (count < 0) {
3264 SetGLError(GL_INVALID_VALUE, "glDrawBuffersEXT", "count < 0");
3265 return;
3267 helper_->DrawBuffersEXTImmediate(count, bufs);
3268 CheckGLError();
3271 void GLES2Implementation::DiscardBackbufferCHROMIUM() {
3272 GPU_CLIENT_SINGLE_THREAD_CHECK();
3273 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDiscardBackbufferCHROMIUM("
3274 << ")");
3275 helper_->DiscardBackbufferCHROMIUM();
3276 CheckGLError();
3279 void GLES2Implementation::ScheduleOverlayPlaneCHROMIUM(
3280 GLint plane_z_order,
3281 GLenum plane_transform,
3282 GLuint overlay_texture_id,
3283 GLint bounds_x,
3284 GLint bounds_y,
3285 GLint bounds_width,
3286 GLint bounds_height,
3287 GLfloat uv_x,
3288 GLfloat uv_y,
3289 GLfloat uv_width,
3290 GLfloat uv_height) {
3291 GPU_CLIENT_SINGLE_THREAD_CHECK();
3292 GPU_CLIENT_LOG(
3293 "[" << GetLogPrefix() << "] glScheduleOverlayPlaneCHROMIUM("
3294 << plane_z_order << ", " << GLES2Util::GetStringEnum(plane_transform)
3295 << ", " << overlay_texture_id << ", " << bounds_x << ", " << bounds_y
3296 << ", " << bounds_width << ", " << bounds_height << ", " << uv_x
3297 << ", " << uv_y << ", " << uv_width << ", " << uv_height << ")");
3298 helper_->ScheduleOverlayPlaneCHROMIUM(
3299 plane_z_order, plane_transform, overlay_texture_id, bounds_x, bounds_y,
3300 bounds_width, bounds_height, uv_x, uv_y, uv_width, uv_height);
3301 CheckGLError();
3304 void GLES2Implementation::MatrixLoadfCHROMIUM(GLenum matrixMode,
3305 const GLfloat* m) {
3306 GPU_CLIENT_SINGLE_THREAD_CHECK();
3307 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glMatrixLoadfCHROMIUM("
3308 << GLES2Util::GetStringMatrixMode(matrixMode) << ", "
3309 << static_cast<const void*>(m) << ")");
3310 size_t count = 16;
3311 for (size_t ii = 0; ii < count; ++ii)
3312 GPU_CLIENT_LOG("value[" << ii << "]: " << m[ii]);
3313 helper_->MatrixLoadfCHROMIUMImmediate(matrixMode, m);
3314 CheckGLError();
3317 void GLES2Implementation::MatrixLoadIdentityCHROMIUM(GLenum matrixMode) {
3318 GPU_CLIENT_SINGLE_THREAD_CHECK();
3319 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glMatrixLoadIdentityCHROMIUM("
3320 << GLES2Util::GetStringMatrixMode(matrixMode) << ")");
3321 helper_->MatrixLoadIdentityCHROMIUM(matrixMode);
3322 CheckGLError();
3325 void GLES2Implementation::BlendBarrierKHR() {
3326 GPU_CLIENT_SINGLE_THREAD_CHECK();
3327 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBlendBarrierKHR("
3328 << ")");
3329 helper_->BlendBarrierKHR();
3330 CheckGLError();
3333 #endif // GPU_COMMAND_BUFFER_CLIENT_GLES2_IMPLEMENTATION_IMPL_AUTOGEN_H_