We started redesigning GpuMemoryBuffer interface to handle multiple buffers [0].
[chromium-blink-merge.git] / gpu / command_buffer / client / gles2_implementation_impl_autogen.h
blob98447bf54cfc2611df63468ee6250723886c0f8d
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::GetSynciv(GLsync sync,
1290 GLenum pname,
1291 GLsizei bufsize,
1292 GLsizei* length,
1293 GLint* values) {
1294 GPU_CLIENT_SINGLE_THREAD_CHECK();
1295 GPU_CLIENT_VALIDATE_DESTINATION_OPTIONAL_INITALIZATION(GLsizei, length);
1296 GPU_CLIENT_VALIDATE_DESTINATION_INITALIZATION(GLint, values);
1297 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetSynciv(" << sync << ", "
1298 << GLES2Util::GetStringSyncParameter(pname) << ", "
1299 << bufsize << ", " << static_cast<const void*>(length)
1300 << ", " << static_cast<const void*>(values) << ")");
1301 if (bufsize < 0) {
1302 SetGLError(GL_INVALID_VALUE, "glGetSynciv", "bufsize < 0");
1303 return;
1305 TRACE_EVENT0("gpu", "GLES2Implementation::GetSynciv");
1306 if (GetSyncivHelper(sync, pname, bufsize, length, values)) {
1307 return;
1309 typedef cmds::GetSynciv::Result Result;
1310 Result* result = GetResultAs<Result*>();
1311 if (!result) {
1312 return;
1314 result->SetNumResults(0);
1315 helper_->GetSynciv(ToGLuint(sync), pname, GetResultShmId(),
1316 GetResultShmOffset());
1317 WaitForCmd();
1318 result->CopyResult(values);
1319 GPU_CLIENT_LOG_CODE_BLOCK({
1320 for (int32_t i = 0; i < result->GetNumResults(); ++i) {
1321 GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]);
1324 if (length) {
1325 *length = result->GetNumResults();
1327 CheckGLError();
1329 void GLES2Implementation::GetTexParameterfv(GLenum target,
1330 GLenum pname,
1331 GLfloat* params) {
1332 GPU_CLIENT_SINGLE_THREAD_CHECK();
1333 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetTexParameterfv("
1334 << GLES2Util::GetStringGetTexParamTarget(target) << ", "
1335 << GLES2Util::GetStringTextureParameter(pname) << ", "
1336 << static_cast<const void*>(params) << ")");
1337 TRACE_EVENT0("gpu", "GLES2Implementation::GetTexParameterfv");
1338 if (GetTexParameterfvHelper(target, pname, params)) {
1339 return;
1341 typedef cmds::GetTexParameterfv::Result Result;
1342 Result* result = GetResultAs<Result*>();
1343 if (!result) {
1344 return;
1346 result->SetNumResults(0);
1347 helper_->GetTexParameterfv(target, pname, GetResultShmId(),
1348 GetResultShmOffset());
1349 WaitForCmd();
1350 result->CopyResult(params);
1351 GPU_CLIENT_LOG_CODE_BLOCK({
1352 for (int32_t i = 0; i < result->GetNumResults(); ++i) {
1353 GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]);
1356 CheckGLError();
1358 void GLES2Implementation::GetTexParameteriv(GLenum target,
1359 GLenum pname,
1360 GLint* params) {
1361 GPU_CLIENT_SINGLE_THREAD_CHECK();
1362 GPU_CLIENT_VALIDATE_DESTINATION_INITALIZATION(GLint, params);
1363 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetTexParameteriv("
1364 << GLES2Util::GetStringGetTexParamTarget(target) << ", "
1365 << GLES2Util::GetStringTextureParameter(pname) << ", "
1366 << static_cast<const void*>(params) << ")");
1367 TRACE_EVENT0("gpu", "GLES2Implementation::GetTexParameteriv");
1368 if (GetTexParameterivHelper(target, pname, params)) {
1369 return;
1371 typedef cmds::GetTexParameteriv::Result Result;
1372 Result* result = GetResultAs<Result*>();
1373 if (!result) {
1374 return;
1376 result->SetNumResults(0);
1377 helper_->GetTexParameteriv(target, pname, GetResultShmId(),
1378 GetResultShmOffset());
1379 WaitForCmd();
1380 result->CopyResult(params);
1381 GPU_CLIENT_LOG_CODE_BLOCK({
1382 for (int32_t i = 0; i < result->GetNumResults(); ++i) {
1383 GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]);
1386 CheckGLError();
1388 void GLES2Implementation::Hint(GLenum target, GLenum mode) {
1389 GPU_CLIENT_SINGLE_THREAD_CHECK();
1390 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glHint("
1391 << GLES2Util::GetStringHintTarget(target) << ", "
1392 << GLES2Util::GetStringHintMode(mode) << ")");
1393 helper_->Hint(target, mode);
1394 CheckGLError();
1397 void GLES2Implementation::InvalidateFramebuffer(GLenum target,
1398 GLsizei count,
1399 const GLenum* attachments) {
1400 GPU_CLIENT_SINGLE_THREAD_CHECK();
1401 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glInvalidateFramebuffer("
1402 << GLES2Util::GetStringFrameBufferTarget(target) << ", "
1403 << count << ", " << static_cast<const void*>(attachments)
1404 << ")");
1405 GPU_CLIENT_LOG_CODE_BLOCK({
1406 for (GLsizei i = 0; i < count; ++i) {
1407 GPU_CLIENT_LOG(" " << i << ": " << attachments[0 + i * 1]);
1410 if (count < 0) {
1411 SetGLError(GL_INVALID_VALUE, "glInvalidateFramebuffer", "count < 0");
1412 return;
1414 helper_->InvalidateFramebufferImmediate(target, count, attachments);
1415 CheckGLError();
1418 void GLES2Implementation::InvalidateSubFramebuffer(GLenum target,
1419 GLsizei count,
1420 const GLenum* attachments,
1421 GLint x,
1422 GLint y,
1423 GLsizei width,
1424 GLsizei height) {
1425 GPU_CLIENT_SINGLE_THREAD_CHECK();
1426 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glInvalidateSubFramebuffer("
1427 << GLES2Util::GetStringFrameBufferTarget(target) << ", "
1428 << count << ", " << static_cast<const void*>(attachments)
1429 << ", " << x << ", " << y << ", " << width << ", "
1430 << height << ")");
1431 GPU_CLIENT_LOG_CODE_BLOCK({
1432 for (GLsizei i = 0; i < count; ++i) {
1433 GPU_CLIENT_LOG(" " << i << ": " << attachments[0 + i * 1]);
1436 if (count < 0) {
1437 SetGLError(GL_INVALID_VALUE, "glInvalidateSubFramebuffer", "count < 0");
1438 return;
1440 if (width < 0) {
1441 SetGLError(GL_INVALID_VALUE, "glInvalidateSubFramebuffer", "width < 0");
1442 return;
1444 if (height < 0) {
1445 SetGLError(GL_INVALID_VALUE, "glInvalidateSubFramebuffer", "height < 0");
1446 return;
1448 helper_->InvalidateSubFramebufferImmediate(target, count, attachments, x, y,
1449 width, height);
1450 CheckGLError();
1453 GLboolean GLES2Implementation::IsBuffer(GLuint buffer) {
1454 GPU_CLIENT_SINGLE_THREAD_CHECK();
1455 TRACE_EVENT0("gpu", "GLES2Implementation::IsBuffer");
1456 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glIsBuffer(" << buffer << ")");
1457 typedef cmds::IsBuffer::Result Result;
1458 Result* result = GetResultAs<Result*>();
1459 if (!result) {
1460 return GL_FALSE;
1462 *result = 0;
1463 helper_->IsBuffer(buffer, GetResultShmId(), GetResultShmOffset());
1464 WaitForCmd();
1465 GLboolean result_value = *result != 0;
1466 GPU_CLIENT_LOG("returned " << result_value);
1467 CheckGLError();
1468 return result_value;
1471 GLboolean GLES2Implementation::IsFramebuffer(GLuint framebuffer) {
1472 GPU_CLIENT_SINGLE_THREAD_CHECK();
1473 TRACE_EVENT0("gpu", "GLES2Implementation::IsFramebuffer");
1474 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glIsFramebuffer(" << framebuffer
1475 << ")");
1476 typedef cmds::IsFramebuffer::Result Result;
1477 Result* result = GetResultAs<Result*>();
1478 if (!result) {
1479 return GL_FALSE;
1481 *result = 0;
1482 helper_->IsFramebuffer(framebuffer, GetResultShmId(), GetResultShmOffset());
1483 WaitForCmd();
1484 GLboolean result_value = *result != 0;
1485 GPU_CLIENT_LOG("returned " << result_value);
1486 CheckGLError();
1487 return result_value;
1490 GLboolean GLES2Implementation::IsProgram(GLuint program) {
1491 GPU_CLIENT_SINGLE_THREAD_CHECK();
1492 TRACE_EVENT0("gpu", "GLES2Implementation::IsProgram");
1493 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glIsProgram(" << program << ")");
1494 typedef cmds::IsProgram::Result Result;
1495 Result* result = GetResultAs<Result*>();
1496 if (!result) {
1497 return GL_FALSE;
1499 *result = 0;
1500 helper_->IsProgram(program, GetResultShmId(), GetResultShmOffset());
1501 WaitForCmd();
1502 GLboolean result_value = *result != 0;
1503 GPU_CLIENT_LOG("returned " << result_value);
1504 CheckGLError();
1505 return result_value;
1508 GLboolean GLES2Implementation::IsRenderbuffer(GLuint renderbuffer) {
1509 GPU_CLIENT_SINGLE_THREAD_CHECK();
1510 TRACE_EVENT0("gpu", "GLES2Implementation::IsRenderbuffer");
1511 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glIsRenderbuffer(" << renderbuffer
1512 << ")");
1513 typedef cmds::IsRenderbuffer::Result Result;
1514 Result* result = GetResultAs<Result*>();
1515 if (!result) {
1516 return GL_FALSE;
1518 *result = 0;
1519 helper_->IsRenderbuffer(renderbuffer, GetResultShmId(), GetResultShmOffset());
1520 WaitForCmd();
1521 GLboolean result_value = *result != 0;
1522 GPU_CLIENT_LOG("returned " << result_value);
1523 CheckGLError();
1524 return result_value;
1527 GLboolean GLES2Implementation::IsSampler(GLuint sampler) {
1528 GPU_CLIENT_SINGLE_THREAD_CHECK();
1529 TRACE_EVENT0("gpu", "GLES2Implementation::IsSampler");
1530 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glIsSampler(" << sampler << ")");
1531 typedef cmds::IsSampler::Result Result;
1532 Result* result = GetResultAs<Result*>();
1533 if (!result) {
1534 return GL_FALSE;
1536 *result = 0;
1537 helper_->IsSampler(sampler, GetResultShmId(), GetResultShmOffset());
1538 WaitForCmd();
1539 GLboolean result_value = *result != 0;
1540 GPU_CLIENT_LOG("returned " << result_value);
1541 CheckGLError();
1542 return result_value;
1545 GLboolean GLES2Implementation::IsShader(GLuint shader) {
1546 GPU_CLIENT_SINGLE_THREAD_CHECK();
1547 TRACE_EVENT0("gpu", "GLES2Implementation::IsShader");
1548 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glIsShader(" << shader << ")");
1549 typedef cmds::IsShader::Result Result;
1550 Result* result = GetResultAs<Result*>();
1551 if (!result) {
1552 return GL_FALSE;
1554 *result = 0;
1555 helper_->IsShader(shader, GetResultShmId(), GetResultShmOffset());
1556 WaitForCmd();
1557 GLboolean result_value = *result != 0;
1558 GPU_CLIENT_LOG("returned " << result_value);
1559 CheckGLError();
1560 return result_value;
1563 GLboolean GLES2Implementation::IsSync(GLsync sync) {
1564 GPU_CLIENT_SINGLE_THREAD_CHECK();
1565 TRACE_EVENT0("gpu", "GLES2Implementation::IsSync");
1566 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glIsSync(" << sync << ")");
1567 typedef cmds::IsSync::Result Result;
1568 Result* result = GetResultAs<Result*>();
1569 if (!result) {
1570 return GL_FALSE;
1572 *result = 0;
1573 helper_->IsSync(ToGLuint(sync), GetResultShmId(), GetResultShmOffset());
1574 WaitForCmd();
1575 GLboolean result_value = *result != 0;
1576 GPU_CLIENT_LOG("returned " << result_value);
1577 CheckGLError();
1578 return result_value;
1581 GLboolean GLES2Implementation::IsTexture(GLuint texture) {
1582 GPU_CLIENT_SINGLE_THREAD_CHECK();
1583 TRACE_EVENT0("gpu", "GLES2Implementation::IsTexture");
1584 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glIsTexture(" << texture << ")");
1585 typedef cmds::IsTexture::Result Result;
1586 Result* result = GetResultAs<Result*>();
1587 if (!result) {
1588 return GL_FALSE;
1590 *result = 0;
1591 helper_->IsTexture(texture, GetResultShmId(), GetResultShmOffset());
1592 WaitForCmd();
1593 GLboolean result_value = *result != 0;
1594 GPU_CLIENT_LOG("returned " << result_value);
1595 CheckGLError();
1596 return result_value;
1599 GLboolean GLES2Implementation::IsTransformFeedback(GLuint transformfeedback) {
1600 GPU_CLIENT_SINGLE_THREAD_CHECK();
1601 TRACE_EVENT0("gpu", "GLES2Implementation::IsTransformFeedback");
1602 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glIsTransformFeedback("
1603 << transformfeedback << ")");
1604 typedef cmds::IsTransformFeedback::Result Result;
1605 Result* result = GetResultAs<Result*>();
1606 if (!result) {
1607 return GL_FALSE;
1609 *result = 0;
1610 helper_->IsTransformFeedback(transformfeedback, GetResultShmId(),
1611 GetResultShmOffset());
1612 WaitForCmd();
1613 GLboolean result_value = *result != 0;
1614 GPU_CLIENT_LOG("returned " << result_value);
1615 CheckGLError();
1616 return result_value;
1619 void GLES2Implementation::LineWidth(GLfloat width) {
1620 GPU_CLIENT_SINGLE_THREAD_CHECK();
1621 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glLineWidth(" << width << ")");
1622 helper_->LineWidth(width);
1623 CheckGLError();
1626 void GLES2Implementation::PauseTransformFeedback() {
1627 GPU_CLIENT_SINGLE_THREAD_CHECK();
1628 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glPauseTransformFeedback("
1629 << ")");
1630 helper_->PauseTransformFeedback();
1631 CheckGLError();
1634 void GLES2Implementation::PolygonOffset(GLfloat factor, GLfloat units) {
1635 GPU_CLIENT_SINGLE_THREAD_CHECK();
1636 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glPolygonOffset(" << factor << ", "
1637 << units << ")");
1638 helper_->PolygonOffset(factor, units);
1639 CheckGLError();
1642 void GLES2Implementation::ReadBuffer(GLenum src) {
1643 GPU_CLIENT_SINGLE_THREAD_CHECK();
1644 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glReadBuffer("
1645 << GLES2Util::GetStringEnum(src) << ")");
1646 helper_->ReadBuffer(src);
1647 CheckGLError();
1650 void GLES2Implementation::ReleaseShaderCompiler() {
1651 GPU_CLIENT_SINGLE_THREAD_CHECK();
1652 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glReleaseShaderCompiler("
1653 << ")");
1654 helper_->ReleaseShaderCompiler();
1655 CheckGLError();
1658 void GLES2Implementation::RenderbufferStorage(GLenum target,
1659 GLenum internalformat,
1660 GLsizei width,
1661 GLsizei height) {
1662 GPU_CLIENT_SINGLE_THREAD_CHECK();
1663 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glRenderbufferStorage("
1664 << GLES2Util::GetStringRenderBufferTarget(target) << ", "
1665 << GLES2Util::GetStringRenderBufferFormat(internalformat)
1666 << ", " << width << ", " << height << ")");
1667 if (width < 0) {
1668 SetGLError(GL_INVALID_VALUE, "glRenderbufferStorage", "width < 0");
1669 return;
1671 if (height < 0) {
1672 SetGLError(GL_INVALID_VALUE, "glRenderbufferStorage", "height < 0");
1673 return;
1675 helper_->RenderbufferStorage(target, internalformat, width, height);
1676 CheckGLError();
1679 void GLES2Implementation::ResumeTransformFeedback() {
1680 GPU_CLIENT_SINGLE_THREAD_CHECK();
1681 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glResumeTransformFeedback("
1682 << ")");
1683 helper_->ResumeTransformFeedback();
1684 CheckGLError();
1687 void GLES2Implementation::SampleCoverage(GLclampf value, GLboolean invert) {
1688 GPU_CLIENT_SINGLE_THREAD_CHECK();
1689 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glSampleCoverage(" << value << ", "
1690 << GLES2Util::GetStringBool(invert) << ")");
1691 helper_->SampleCoverage(value, invert);
1692 CheckGLError();
1695 void GLES2Implementation::SamplerParameterf(GLuint sampler,
1696 GLenum pname,
1697 GLfloat param) {
1698 GPU_CLIENT_SINGLE_THREAD_CHECK();
1699 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glSamplerParameterf(" << sampler
1700 << ", " << GLES2Util::GetStringSamplerParameter(pname)
1701 << ", " << param << ")");
1702 helper_->SamplerParameterf(sampler, pname, param);
1703 CheckGLError();
1706 void GLES2Implementation::SamplerParameterfv(GLuint sampler,
1707 GLenum pname,
1708 const GLfloat* params) {
1709 GPU_CLIENT_SINGLE_THREAD_CHECK();
1710 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glSamplerParameterfv(" << sampler
1711 << ", " << GLES2Util::GetStringSamplerParameter(pname)
1712 << ", " << static_cast<const void*>(params) << ")");
1713 size_t count = 1;
1714 for (size_t ii = 0; ii < count; ++ii)
1715 GPU_CLIENT_LOG("value[" << ii << "]: " << params[ii]);
1716 helper_->SamplerParameterfvImmediate(sampler, pname, params);
1717 CheckGLError();
1720 void GLES2Implementation::SamplerParameteri(GLuint sampler,
1721 GLenum pname,
1722 GLint param) {
1723 GPU_CLIENT_SINGLE_THREAD_CHECK();
1724 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glSamplerParameteri(" << sampler
1725 << ", " << GLES2Util::GetStringSamplerParameter(pname)
1726 << ", " << param << ")");
1727 helper_->SamplerParameteri(sampler, pname, param);
1728 CheckGLError();
1731 void GLES2Implementation::SamplerParameteriv(GLuint sampler,
1732 GLenum pname,
1733 const GLint* params) {
1734 GPU_CLIENT_SINGLE_THREAD_CHECK();
1735 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glSamplerParameteriv(" << sampler
1736 << ", " << GLES2Util::GetStringSamplerParameter(pname)
1737 << ", " << static_cast<const void*>(params) << ")");
1738 size_t count = 1;
1739 for (size_t ii = 0; ii < count; ++ii)
1740 GPU_CLIENT_LOG("value[" << ii << "]: " << params[ii]);
1741 helper_->SamplerParameterivImmediate(sampler, pname, params);
1742 CheckGLError();
1745 void GLES2Implementation::Scissor(GLint x,
1746 GLint y,
1747 GLsizei width,
1748 GLsizei height) {
1749 GPU_CLIENT_SINGLE_THREAD_CHECK();
1750 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glScissor(" << x << ", " << y
1751 << ", " << width << ", " << height << ")");
1752 if (width < 0) {
1753 SetGLError(GL_INVALID_VALUE, "glScissor", "width < 0");
1754 return;
1756 if (height < 0) {
1757 SetGLError(GL_INVALID_VALUE, "glScissor", "height < 0");
1758 return;
1760 helper_->Scissor(x, y, width, height);
1761 CheckGLError();
1764 void GLES2Implementation::ShaderSource(GLuint shader,
1765 GLsizei count,
1766 const GLchar* const* str,
1767 const GLint* length) {
1768 GPU_CLIENT_SINGLE_THREAD_CHECK();
1769 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glShaderSource(" << shader << ", "
1770 << count << ", " << static_cast<const void*>(str) << ", "
1771 << static_cast<const void*>(length) << ")");
1772 GPU_CLIENT_LOG_CODE_BLOCK({
1773 for (GLsizei ii = 0; ii < count; ++ii) {
1774 if (str[ii]) {
1775 if (length && length[ii] >= 0) {
1776 const std::string my_str(str[ii], length[ii]);
1777 GPU_CLIENT_LOG(" " << ii << ": ---\n" << my_str << "\n---");
1778 } else {
1779 GPU_CLIENT_LOG(" " << ii << ": ---\n" << str[ii] << "\n---");
1781 } else {
1782 GPU_CLIENT_LOG(" " << ii << ": NULL");
1786 if (count < 0) {
1787 SetGLError(GL_INVALID_VALUE, "glShaderSource", "count < 0");
1788 return;
1791 if (!PackStringsToBucket(count, str, length, "glShaderSource")) {
1792 return;
1794 helper_->ShaderSourceBucket(shader, kResultBucketId);
1795 helper_->SetBucketSize(kResultBucketId, 0);
1796 CheckGLError();
1799 void GLES2Implementation::StencilFunc(GLenum func, GLint ref, GLuint mask) {
1800 GPU_CLIENT_SINGLE_THREAD_CHECK();
1801 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glStencilFunc("
1802 << GLES2Util::GetStringCmpFunction(func) << ", " << ref
1803 << ", " << mask << ")");
1804 helper_->StencilFunc(func, ref, mask);
1805 CheckGLError();
1808 void GLES2Implementation::StencilFuncSeparate(GLenum face,
1809 GLenum func,
1810 GLint ref,
1811 GLuint mask) {
1812 GPU_CLIENT_SINGLE_THREAD_CHECK();
1813 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glStencilFuncSeparate("
1814 << GLES2Util::GetStringFaceType(face) << ", "
1815 << GLES2Util::GetStringCmpFunction(func) << ", " << ref
1816 << ", " << mask << ")");
1817 helper_->StencilFuncSeparate(face, func, ref, mask);
1818 CheckGLError();
1821 void GLES2Implementation::StencilMask(GLuint mask) {
1822 GPU_CLIENT_SINGLE_THREAD_CHECK();
1823 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glStencilMask(" << mask << ")");
1824 helper_->StencilMask(mask);
1825 CheckGLError();
1828 void GLES2Implementation::StencilMaskSeparate(GLenum face, GLuint mask) {
1829 GPU_CLIENT_SINGLE_THREAD_CHECK();
1830 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glStencilMaskSeparate("
1831 << GLES2Util::GetStringFaceType(face) << ", " << mask
1832 << ")");
1833 helper_->StencilMaskSeparate(face, mask);
1834 CheckGLError();
1837 void GLES2Implementation::StencilOp(GLenum fail, GLenum zfail, GLenum zpass) {
1838 GPU_CLIENT_SINGLE_THREAD_CHECK();
1839 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glStencilOp("
1840 << GLES2Util::GetStringStencilOp(fail) << ", "
1841 << GLES2Util::GetStringStencilOp(zfail) << ", "
1842 << GLES2Util::GetStringStencilOp(zpass) << ")");
1843 helper_->StencilOp(fail, zfail, zpass);
1844 CheckGLError();
1847 void GLES2Implementation::StencilOpSeparate(GLenum face,
1848 GLenum fail,
1849 GLenum zfail,
1850 GLenum zpass) {
1851 GPU_CLIENT_SINGLE_THREAD_CHECK();
1852 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glStencilOpSeparate("
1853 << GLES2Util::GetStringFaceType(face) << ", "
1854 << GLES2Util::GetStringStencilOp(fail) << ", "
1855 << GLES2Util::GetStringStencilOp(zfail) << ", "
1856 << GLES2Util::GetStringStencilOp(zpass) << ")");
1857 helper_->StencilOpSeparate(face, fail, zfail, zpass);
1858 CheckGLError();
1861 void GLES2Implementation::TexParameterf(GLenum target,
1862 GLenum pname,
1863 GLfloat param) {
1864 GPU_CLIENT_SINGLE_THREAD_CHECK();
1865 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glTexParameterf("
1866 << GLES2Util::GetStringTextureBindTarget(target) << ", "
1867 << GLES2Util::GetStringTextureParameter(pname) << ", "
1868 << param << ")");
1869 helper_->TexParameterf(target, pname, param);
1870 CheckGLError();
1873 void GLES2Implementation::TexParameterfv(GLenum target,
1874 GLenum pname,
1875 const GLfloat* params) {
1876 GPU_CLIENT_SINGLE_THREAD_CHECK();
1877 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glTexParameterfv("
1878 << GLES2Util::GetStringTextureBindTarget(target) << ", "
1879 << GLES2Util::GetStringTextureParameter(pname) << ", "
1880 << static_cast<const void*>(params) << ")");
1881 size_t count = 1;
1882 for (size_t ii = 0; ii < count; ++ii)
1883 GPU_CLIENT_LOG("value[" << ii << "]: " << params[ii]);
1884 helper_->TexParameterfvImmediate(target, pname, params);
1885 CheckGLError();
1888 void GLES2Implementation::TexParameteri(GLenum target,
1889 GLenum pname,
1890 GLint param) {
1891 GPU_CLIENT_SINGLE_THREAD_CHECK();
1892 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glTexParameteri("
1893 << GLES2Util::GetStringTextureBindTarget(target) << ", "
1894 << GLES2Util::GetStringTextureParameter(pname) << ", "
1895 << param << ")");
1896 helper_->TexParameteri(target, pname, param);
1897 CheckGLError();
1900 void GLES2Implementation::TexParameteriv(GLenum target,
1901 GLenum pname,
1902 const GLint* params) {
1903 GPU_CLIENT_SINGLE_THREAD_CHECK();
1904 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glTexParameteriv("
1905 << GLES2Util::GetStringTextureBindTarget(target) << ", "
1906 << GLES2Util::GetStringTextureParameter(pname) << ", "
1907 << static_cast<const void*>(params) << ")");
1908 size_t count = 1;
1909 for (size_t ii = 0; ii < count; ++ii)
1910 GPU_CLIENT_LOG("value[" << ii << "]: " << params[ii]);
1911 helper_->TexParameterivImmediate(target, pname, params);
1912 CheckGLError();
1915 void GLES2Implementation::TexStorage3D(GLenum target,
1916 GLsizei levels,
1917 GLenum internalFormat,
1918 GLsizei width,
1919 GLsizei height,
1920 GLsizei depth) {
1921 GPU_CLIENT_SINGLE_THREAD_CHECK();
1922 GPU_CLIENT_LOG(
1923 "[" << GetLogPrefix() << "] glTexStorage3D("
1924 << GLES2Util::GetStringTexture3DTarget(target) << ", " << levels
1925 << ", "
1926 << GLES2Util::GetStringTextureInternalFormatStorage(internalFormat)
1927 << ", " << width << ", " << height << ", " << depth << ")");
1928 if (levels < 0) {
1929 SetGLError(GL_INVALID_VALUE, "glTexStorage3D", "levels < 0");
1930 return;
1932 if (width < 0) {
1933 SetGLError(GL_INVALID_VALUE, "glTexStorage3D", "width < 0");
1934 return;
1936 if (height < 0) {
1937 SetGLError(GL_INVALID_VALUE, "glTexStorage3D", "height < 0");
1938 return;
1940 if (depth < 0) {
1941 SetGLError(GL_INVALID_VALUE, "glTexStorage3D", "depth < 0");
1942 return;
1944 helper_->TexStorage3D(target, levels, internalFormat, width, height, depth);
1945 CheckGLError();
1948 void GLES2Implementation::TransformFeedbackVaryings(GLuint program,
1949 GLsizei count,
1950 const char* const* varyings,
1951 GLenum buffermode) {
1952 GPU_CLIENT_SINGLE_THREAD_CHECK();
1953 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glTransformFeedbackVaryings("
1954 << program << ", " << count << ", "
1955 << static_cast<const void*>(varyings) << ", "
1956 << GLES2Util::GetStringBufferMode(buffermode) << ")");
1957 GPU_CLIENT_LOG_CODE_BLOCK({
1958 for (GLsizei ii = 0; ii < count; ++ii) {
1959 if (varyings[ii]) {
1960 GPU_CLIENT_LOG(" " << ii << ": ---\n" << varyings[ii] << "\n---");
1961 } else {
1962 GPU_CLIENT_LOG(" " << ii << ": NULL");
1966 if (count < 0) {
1967 SetGLError(GL_INVALID_VALUE, "glTransformFeedbackVaryings", "count < 0");
1968 return;
1971 if (!PackStringsToBucket(count, varyings, NULL,
1972 "glTransformFeedbackVaryings")) {
1973 return;
1975 helper_->TransformFeedbackVaryingsBucket(program, kResultBucketId,
1976 buffermode);
1977 helper_->SetBucketSize(kResultBucketId, 0);
1978 CheckGLError();
1981 void GLES2Implementation::Uniform1f(GLint location, GLfloat x) {
1982 GPU_CLIENT_SINGLE_THREAD_CHECK();
1983 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform1f(" << location << ", "
1984 << x << ")");
1985 helper_->Uniform1f(location, x);
1986 CheckGLError();
1989 void GLES2Implementation::Uniform1fv(GLint location,
1990 GLsizei count,
1991 const GLfloat* v) {
1992 GPU_CLIENT_SINGLE_THREAD_CHECK();
1993 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform1fv(" << location << ", "
1994 << count << ", " << static_cast<const void*>(v) << ")");
1995 GPU_CLIENT_LOG_CODE_BLOCK({
1996 for (GLsizei i = 0; i < count; ++i) {
1997 GPU_CLIENT_LOG(" " << i << ": " << v[0 + i * 1]);
2000 if (count < 0) {
2001 SetGLError(GL_INVALID_VALUE, "glUniform1fv", "count < 0");
2002 return;
2004 helper_->Uniform1fvImmediate(location, count, v);
2005 CheckGLError();
2008 void GLES2Implementation::Uniform1i(GLint location, GLint x) {
2009 GPU_CLIENT_SINGLE_THREAD_CHECK();
2010 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform1i(" << location << ", "
2011 << x << ")");
2012 helper_->Uniform1i(location, x);
2013 CheckGLError();
2016 void GLES2Implementation::Uniform1iv(GLint location,
2017 GLsizei count,
2018 const GLint* v) {
2019 GPU_CLIENT_SINGLE_THREAD_CHECK();
2020 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform1iv(" << location << ", "
2021 << count << ", " << static_cast<const void*>(v) << ")");
2022 GPU_CLIENT_LOG_CODE_BLOCK({
2023 for (GLsizei i = 0; i < count; ++i) {
2024 GPU_CLIENT_LOG(" " << i << ": " << v[0 + i * 1]);
2027 if (count < 0) {
2028 SetGLError(GL_INVALID_VALUE, "glUniform1iv", "count < 0");
2029 return;
2031 helper_->Uniform1ivImmediate(location, count, v);
2032 CheckGLError();
2035 void GLES2Implementation::Uniform1ui(GLint location, GLuint x) {
2036 GPU_CLIENT_SINGLE_THREAD_CHECK();
2037 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform1ui(" << location << ", "
2038 << x << ")");
2039 helper_->Uniform1ui(location, x);
2040 CheckGLError();
2043 void GLES2Implementation::Uniform1uiv(GLint location,
2044 GLsizei count,
2045 const GLuint* v) {
2046 GPU_CLIENT_SINGLE_THREAD_CHECK();
2047 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform1uiv(" << location << ", "
2048 << count << ", " << static_cast<const void*>(v) << ")");
2049 GPU_CLIENT_LOG_CODE_BLOCK({
2050 for (GLsizei i = 0; i < count; ++i) {
2051 GPU_CLIENT_LOG(" " << i << ": " << v[0 + i * 1]);
2054 if (count < 0) {
2055 SetGLError(GL_INVALID_VALUE, "glUniform1uiv", "count < 0");
2056 return;
2058 helper_->Uniform1uivImmediate(location, count, v);
2059 CheckGLError();
2062 void GLES2Implementation::Uniform2f(GLint location, GLfloat x, GLfloat y) {
2063 GPU_CLIENT_SINGLE_THREAD_CHECK();
2064 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform2f(" << location << ", "
2065 << x << ", " << y << ")");
2066 helper_->Uniform2f(location, x, y);
2067 CheckGLError();
2070 void GLES2Implementation::Uniform2fv(GLint location,
2071 GLsizei count,
2072 const GLfloat* v) {
2073 GPU_CLIENT_SINGLE_THREAD_CHECK();
2074 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform2fv(" << location << ", "
2075 << count << ", " << static_cast<const void*>(v) << ")");
2076 GPU_CLIENT_LOG_CODE_BLOCK({
2077 for (GLsizei i = 0; i < count; ++i) {
2078 GPU_CLIENT_LOG(" " << i << ": " << v[0 + i * 2] << ", " << v[1 + i * 2]);
2081 if (count < 0) {
2082 SetGLError(GL_INVALID_VALUE, "glUniform2fv", "count < 0");
2083 return;
2085 helper_->Uniform2fvImmediate(location, count, v);
2086 CheckGLError();
2089 void GLES2Implementation::Uniform2i(GLint location, GLint x, GLint y) {
2090 GPU_CLIENT_SINGLE_THREAD_CHECK();
2091 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform2i(" << location << ", "
2092 << x << ", " << y << ")");
2093 helper_->Uniform2i(location, x, y);
2094 CheckGLError();
2097 void GLES2Implementation::Uniform2iv(GLint location,
2098 GLsizei count,
2099 const GLint* v) {
2100 GPU_CLIENT_SINGLE_THREAD_CHECK();
2101 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform2iv(" << location << ", "
2102 << count << ", " << static_cast<const void*>(v) << ")");
2103 GPU_CLIENT_LOG_CODE_BLOCK({
2104 for (GLsizei i = 0; i < count; ++i) {
2105 GPU_CLIENT_LOG(" " << i << ": " << v[0 + i * 2] << ", " << v[1 + i * 2]);
2108 if (count < 0) {
2109 SetGLError(GL_INVALID_VALUE, "glUniform2iv", "count < 0");
2110 return;
2112 helper_->Uniform2ivImmediate(location, count, v);
2113 CheckGLError();
2116 void GLES2Implementation::Uniform2ui(GLint location, GLuint x, GLuint y) {
2117 GPU_CLIENT_SINGLE_THREAD_CHECK();
2118 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform2ui(" << location << ", "
2119 << x << ", " << y << ")");
2120 helper_->Uniform2ui(location, x, y);
2121 CheckGLError();
2124 void GLES2Implementation::Uniform2uiv(GLint location,
2125 GLsizei count,
2126 const GLuint* v) {
2127 GPU_CLIENT_SINGLE_THREAD_CHECK();
2128 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform2uiv(" << location << ", "
2129 << count << ", " << static_cast<const void*>(v) << ")");
2130 GPU_CLIENT_LOG_CODE_BLOCK({
2131 for (GLsizei i = 0; i < count; ++i) {
2132 GPU_CLIENT_LOG(" " << i << ": " << v[0 + i * 2] << ", " << v[1 + i * 2]);
2135 if (count < 0) {
2136 SetGLError(GL_INVALID_VALUE, "glUniform2uiv", "count < 0");
2137 return;
2139 helper_->Uniform2uivImmediate(location, count, v);
2140 CheckGLError();
2143 void GLES2Implementation::Uniform3f(GLint location,
2144 GLfloat x,
2145 GLfloat y,
2146 GLfloat z) {
2147 GPU_CLIENT_SINGLE_THREAD_CHECK();
2148 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform3f(" << location << ", "
2149 << x << ", " << y << ", " << z << ")");
2150 helper_->Uniform3f(location, x, y, z);
2151 CheckGLError();
2154 void GLES2Implementation::Uniform3fv(GLint location,
2155 GLsizei count,
2156 const GLfloat* v) {
2157 GPU_CLIENT_SINGLE_THREAD_CHECK();
2158 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform3fv(" << location << ", "
2159 << count << ", " << static_cast<const void*>(v) << ")");
2160 GPU_CLIENT_LOG_CODE_BLOCK({
2161 for (GLsizei i = 0; i < count; ++i) {
2162 GPU_CLIENT_LOG(" " << i << ": " << v[0 + i * 3] << ", " << v[1 + i * 3]
2163 << ", " << v[2 + i * 3]);
2166 if (count < 0) {
2167 SetGLError(GL_INVALID_VALUE, "glUniform3fv", "count < 0");
2168 return;
2170 helper_->Uniform3fvImmediate(location, count, v);
2171 CheckGLError();
2174 void GLES2Implementation::Uniform3i(GLint location, GLint x, GLint y, GLint z) {
2175 GPU_CLIENT_SINGLE_THREAD_CHECK();
2176 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform3i(" << location << ", "
2177 << x << ", " << y << ", " << z << ")");
2178 helper_->Uniform3i(location, x, y, z);
2179 CheckGLError();
2182 void GLES2Implementation::Uniform3iv(GLint location,
2183 GLsizei count,
2184 const GLint* v) {
2185 GPU_CLIENT_SINGLE_THREAD_CHECK();
2186 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform3iv(" << location << ", "
2187 << count << ", " << static_cast<const void*>(v) << ")");
2188 GPU_CLIENT_LOG_CODE_BLOCK({
2189 for (GLsizei i = 0; i < count; ++i) {
2190 GPU_CLIENT_LOG(" " << i << ": " << v[0 + i * 3] << ", " << v[1 + i * 3]
2191 << ", " << v[2 + i * 3]);
2194 if (count < 0) {
2195 SetGLError(GL_INVALID_VALUE, "glUniform3iv", "count < 0");
2196 return;
2198 helper_->Uniform3ivImmediate(location, count, v);
2199 CheckGLError();
2202 void GLES2Implementation::Uniform3ui(GLint location,
2203 GLuint x,
2204 GLuint y,
2205 GLuint z) {
2206 GPU_CLIENT_SINGLE_THREAD_CHECK();
2207 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform3ui(" << location << ", "
2208 << x << ", " << y << ", " << z << ")");
2209 helper_->Uniform3ui(location, x, y, z);
2210 CheckGLError();
2213 void GLES2Implementation::Uniform3uiv(GLint location,
2214 GLsizei count,
2215 const GLuint* v) {
2216 GPU_CLIENT_SINGLE_THREAD_CHECK();
2217 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform3uiv(" << location << ", "
2218 << count << ", " << static_cast<const void*>(v) << ")");
2219 GPU_CLIENT_LOG_CODE_BLOCK({
2220 for (GLsizei i = 0; i < count; ++i) {
2221 GPU_CLIENT_LOG(" " << i << ": " << v[0 + i * 3] << ", " << v[1 + i * 3]
2222 << ", " << v[2 + i * 3]);
2225 if (count < 0) {
2226 SetGLError(GL_INVALID_VALUE, "glUniform3uiv", "count < 0");
2227 return;
2229 helper_->Uniform3uivImmediate(location, count, v);
2230 CheckGLError();
2233 void GLES2Implementation::Uniform4f(GLint location,
2234 GLfloat x,
2235 GLfloat y,
2236 GLfloat z,
2237 GLfloat w) {
2238 GPU_CLIENT_SINGLE_THREAD_CHECK();
2239 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform4f(" << location << ", "
2240 << x << ", " << y << ", " << z << ", " << w << ")");
2241 helper_->Uniform4f(location, x, y, z, w);
2242 CheckGLError();
2245 void GLES2Implementation::Uniform4fv(GLint location,
2246 GLsizei count,
2247 const GLfloat* v) {
2248 GPU_CLIENT_SINGLE_THREAD_CHECK();
2249 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform4fv(" << location << ", "
2250 << count << ", " << static_cast<const void*>(v) << ")");
2251 GPU_CLIENT_LOG_CODE_BLOCK({
2252 for (GLsizei i = 0; i < count; ++i) {
2253 GPU_CLIENT_LOG(" " << i << ": " << v[0 + i * 4] << ", " << v[1 + i * 4]
2254 << ", " << v[2 + i * 4] << ", " << v[3 + i * 4]);
2257 if (count < 0) {
2258 SetGLError(GL_INVALID_VALUE, "glUniform4fv", "count < 0");
2259 return;
2261 helper_->Uniform4fvImmediate(location, count, v);
2262 CheckGLError();
2265 void GLES2Implementation::Uniform4i(GLint location,
2266 GLint x,
2267 GLint y,
2268 GLint z,
2269 GLint w) {
2270 GPU_CLIENT_SINGLE_THREAD_CHECK();
2271 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform4i(" << location << ", "
2272 << x << ", " << y << ", " << z << ", " << w << ")");
2273 helper_->Uniform4i(location, x, y, z, w);
2274 CheckGLError();
2277 void GLES2Implementation::Uniform4iv(GLint location,
2278 GLsizei count,
2279 const GLint* v) {
2280 GPU_CLIENT_SINGLE_THREAD_CHECK();
2281 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform4iv(" << location << ", "
2282 << count << ", " << static_cast<const void*>(v) << ")");
2283 GPU_CLIENT_LOG_CODE_BLOCK({
2284 for (GLsizei i = 0; i < count; ++i) {
2285 GPU_CLIENT_LOG(" " << i << ": " << v[0 + i * 4] << ", " << v[1 + i * 4]
2286 << ", " << v[2 + i * 4] << ", " << v[3 + i * 4]);
2289 if (count < 0) {
2290 SetGLError(GL_INVALID_VALUE, "glUniform4iv", "count < 0");
2291 return;
2293 helper_->Uniform4ivImmediate(location, count, v);
2294 CheckGLError();
2297 void GLES2Implementation::Uniform4ui(GLint location,
2298 GLuint x,
2299 GLuint y,
2300 GLuint z,
2301 GLuint w) {
2302 GPU_CLIENT_SINGLE_THREAD_CHECK();
2303 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform4ui(" << location << ", "
2304 << x << ", " << y << ", " << z << ", " << w << ")");
2305 helper_->Uniform4ui(location, x, y, z, w);
2306 CheckGLError();
2309 void GLES2Implementation::Uniform4uiv(GLint location,
2310 GLsizei count,
2311 const GLuint* v) {
2312 GPU_CLIENT_SINGLE_THREAD_CHECK();
2313 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform4uiv(" << location << ", "
2314 << count << ", " << static_cast<const void*>(v) << ")");
2315 GPU_CLIENT_LOG_CODE_BLOCK({
2316 for (GLsizei i = 0; i < count; ++i) {
2317 GPU_CLIENT_LOG(" " << i << ": " << v[0 + i * 4] << ", " << v[1 + i * 4]
2318 << ", " << v[2 + i * 4] << ", " << v[3 + i * 4]);
2321 if (count < 0) {
2322 SetGLError(GL_INVALID_VALUE, "glUniform4uiv", "count < 0");
2323 return;
2325 helper_->Uniform4uivImmediate(location, count, v);
2326 CheckGLError();
2329 void GLES2Implementation::UniformMatrix2fv(GLint location,
2330 GLsizei count,
2331 GLboolean transpose,
2332 const GLfloat* value) {
2333 GPU_CLIENT_SINGLE_THREAD_CHECK();
2334 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniformMatrix2fv(" << location
2335 << ", " << count << ", "
2336 << GLES2Util::GetStringBool(transpose) << ", "
2337 << static_cast<const void*>(value) << ")");
2338 GPU_CLIENT_LOG_CODE_BLOCK({
2339 for (GLsizei i = 0; i < count; ++i) {
2340 GPU_CLIENT_LOG(" " << i << ": " << value[0 + i * 4] << ", "
2341 << value[1 + i * 4] << ", " << value[2 + i * 4]
2342 << ", " << value[3 + i * 4]);
2345 if (count < 0) {
2346 SetGLError(GL_INVALID_VALUE, "glUniformMatrix2fv", "count < 0");
2347 return;
2349 if (transpose != false) {
2350 SetGLError(GL_INVALID_VALUE, "glUniformMatrix2fv",
2351 "transpose GL_INVALID_VALUE");
2352 return;
2354 helper_->UniformMatrix2fvImmediate(location, count, value);
2355 CheckGLError();
2358 void GLES2Implementation::UniformMatrix2x3fv(GLint location,
2359 GLsizei count,
2360 GLboolean transpose,
2361 const GLfloat* value) {
2362 GPU_CLIENT_SINGLE_THREAD_CHECK();
2363 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniformMatrix2x3fv(" << location
2364 << ", " << count << ", "
2365 << GLES2Util::GetStringBool(transpose) << ", "
2366 << static_cast<const void*>(value) << ")");
2367 GPU_CLIENT_LOG_CODE_BLOCK({
2368 for (GLsizei i = 0; i < count; ++i) {
2369 GPU_CLIENT_LOG(" " << i << ": " << value[0 + i * 6] << ", "
2370 << value[1 + i * 6] << ", " << value[2 + i * 6]
2371 << ", " << value[3 + i * 6] << ", "
2372 << value[4 + i * 6] << ", " << value[5 + i * 6]);
2375 if (count < 0) {
2376 SetGLError(GL_INVALID_VALUE, "glUniformMatrix2x3fv", "count < 0");
2377 return;
2379 if (transpose != false) {
2380 SetGLError(GL_INVALID_VALUE, "glUniformMatrix2x3fv",
2381 "transpose GL_INVALID_VALUE");
2382 return;
2384 helper_->UniformMatrix2x3fvImmediate(location, count, value);
2385 CheckGLError();
2388 void GLES2Implementation::UniformMatrix2x4fv(GLint location,
2389 GLsizei count,
2390 GLboolean transpose,
2391 const GLfloat* value) {
2392 GPU_CLIENT_SINGLE_THREAD_CHECK();
2393 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniformMatrix2x4fv(" << location
2394 << ", " << count << ", "
2395 << GLES2Util::GetStringBool(transpose) << ", "
2396 << static_cast<const void*>(value) << ")");
2397 GPU_CLIENT_LOG_CODE_BLOCK({
2398 for (GLsizei i = 0; i < count; ++i) {
2399 GPU_CLIENT_LOG(
2400 " " << i << ": " << value[0 + i * 8] << ", " << value[1 + i * 8]
2401 << ", " << value[2 + i * 8] << ", " << value[3 + i * 8] << ", "
2402 << value[4 + i * 8] << ", " << value[5 + i * 8] << ", "
2403 << value[6 + i * 8] << ", " << value[7 + i * 8]);
2406 if (count < 0) {
2407 SetGLError(GL_INVALID_VALUE, "glUniformMatrix2x4fv", "count < 0");
2408 return;
2410 if (transpose != false) {
2411 SetGLError(GL_INVALID_VALUE, "glUniformMatrix2x4fv",
2412 "transpose GL_INVALID_VALUE");
2413 return;
2415 helper_->UniformMatrix2x4fvImmediate(location, count, value);
2416 CheckGLError();
2419 void GLES2Implementation::UniformMatrix3fv(GLint location,
2420 GLsizei count,
2421 GLboolean transpose,
2422 const GLfloat* value) {
2423 GPU_CLIENT_SINGLE_THREAD_CHECK();
2424 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniformMatrix3fv(" << location
2425 << ", " << count << ", "
2426 << GLES2Util::GetStringBool(transpose) << ", "
2427 << static_cast<const void*>(value) << ")");
2428 GPU_CLIENT_LOG_CODE_BLOCK({
2429 for (GLsizei i = 0; i < count; ++i) {
2430 GPU_CLIENT_LOG(" " << i << ": " << value[0 + i * 9] << ", "
2431 << value[1 + i * 9] << ", " << value[2 + i * 9]
2432 << ", " << value[3 + i * 9] << ", "
2433 << value[4 + i * 9] << ", " << value[5 + i * 9]
2434 << ", " << value[6 + i * 9] << ", "
2435 << value[7 + i * 9] << ", " << value[8 + i * 9]);
2438 if (count < 0) {
2439 SetGLError(GL_INVALID_VALUE, "glUniformMatrix3fv", "count < 0");
2440 return;
2442 if (transpose != false) {
2443 SetGLError(GL_INVALID_VALUE, "glUniformMatrix3fv",
2444 "transpose GL_INVALID_VALUE");
2445 return;
2447 helper_->UniformMatrix3fvImmediate(location, count, value);
2448 CheckGLError();
2451 void GLES2Implementation::UniformMatrix3x2fv(GLint location,
2452 GLsizei count,
2453 GLboolean transpose,
2454 const GLfloat* value) {
2455 GPU_CLIENT_SINGLE_THREAD_CHECK();
2456 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniformMatrix3x2fv(" << location
2457 << ", " << count << ", "
2458 << GLES2Util::GetStringBool(transpose) << ", "
2459 << static_cast<const void*>(value) << ")");
2460 GPU_CLIENT_LOG_CODE_BLOCK({
2461 for (GLsizei i = 0; i < count; ++i) {
2462 GPU_CLIENT_LOG(" " << i << ": " << value[0 + i * 6] << ", "
2463 << value[1 + i * 6] << ", " << value[2 + i * 6]
2464 << ", " << value[3 + i * 6] << ", "
2465 << value[4 + i * 6] << ", " << value[5 + i * 6]);
2468 if (count < 0) {
2469 SetGLError(GL_INVALID_VALUE, "glUniformMatrix3x2fv", "count < 0");
2470 return;
2472 if (transpose != false) {
2473 SetGLError(GL_INVALID_VALUE, "glUniformMatrix3x2fv",
2474 "transpose GL_INVALID_VALUE");
2475 return;
2477 helper_->UniformMatrix3x2fvImmediate(location, count, value);
2478 CheckGLError();
2481 void GLES2Implementation::UniformMatrix3x4fv(GLint location,
2482 GLsizei count,
2483 GLboolean transpose,
2484 const GLfloat* value) {
2485 GPU_CLIENT_SINGLE_THREAD_CHECK();
2486 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniformMatrix3x4fv(" << location
2487 << ", " << count << ", "
2488 << GLES2Util::GetStringBool(transpose) << ", "
2489 << static_cast<const void*>(value) << ")");
2490 GPU_CLIENT_LOG_CODE_BLOCK({
2491 for (GLsizei i = 0; i < count; ++i) {
2492 GPU_CLIENT_LOG(
2493 " " << i << ": " << value[0 + i * 12] << ", " << value[1 + i * 12]
2494 << ", " << value[2 + i * 12] << ", " << value[3 + i * 12] << ", "
2495 << value[4 + i * 12] << ", " << value[5 + i * 12] << ", "
2496 << value[6 + i * 12] << ", " << value[7 + i * 12] << ", "
2497 << value[8 + i * 12] << ", " << value[9 + i * 12] << ", "
2498 << value[10 + i * 12] << ", " << value[11 + i * 12]);
2501 if (count < 0) {
2502 SetGLError(GL_INVALID_VALUE, "glUniformMatrix3x4fv", "count < 0");
2503 return;
2505 if (transpose != false) {
2506 SetGLError(GL_INVALID_VALUE, "glUniformMatrix3x4fv",
2507 "transpose GL_INVALID_VALUE");
2508 return;
2510 helper_->UniformMatrix3x4fvImmediate(location, count, value);
2511 CheckGLError();
2514 void GLES2Implementation::UniformMatrix4fv(GLint location,
2515 GLsizei count,
2516 GLboolean transpose,
2517 const GLfloat* value) {
2518 GPU_CLIENT_SINGLE_THREAD_CHECK();
2519 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniformMatrix4fv(" << location
2520 << ", " << count << ", "
2521 << GLES2Util::GetStringBool(transpose) << ", "
2522 << static_cast<const void*>(value) << ")");
2523 GPU_CLIENT_LOG_CODE_BLOCK({
2524 for (GLsizei i = 0; i < count; ++i) {
2525 GPU_CLIENT_LOG(
2526 " " << i << ": " << value[0 + i * 16] << ", " << value[1 + i * 16]
2527 << ", " << value[2 + i * 16] << ", " << value[3 + i * 16] << ", "
2528 << value[4 + i * 16] << ", " << value[5 + i * 16] << ", "
2529 << value[6 + i * 16] << ", " << value[7 + i * 16] << ", "
2530 << value[8 + i * 16] << ", " << value[9 + i * 16] << ", "
2531 << value[10 + i * 16] << ", " << value[11 + i * 16] << ", "
2532 << value[12 + i * 16] << ", " << value[13 + i * 16] << ", "
2533 << value[14 + i * 16] << ", " << value[15 + i * 16]);
2536 if (count < 0) {
2537 SetGLError(GL_INVALID_VALUE, "glUniformMatrix4fv", "count < 0");
2538 return;
2540 if (transpose != false) {
2541 SetGLError(GL_INVALID_VALUE, "glUniformMatrix4fv",
2542 "transpose GL_INVALID_VALUE");
2543 return;
2545 helper_->UniformMatrix4fvImmediate(location, count, value);
2546 CheckGLError();
2549 void GLES2Implementation::UniformMatrix4x2fv(GLint location,
2550 GLsizei count,
2551 GLboolean transpose,
2552 const GLfloat* value) {
2553 GPU_CLIENT_SINGLE_THREAD_CHECK();
2554 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniformMatrix4x2fv(" << location
2555 << ", " << count << ", "
2556 << GLES2Util::GetStringBool(transpose) << ", "
2557 << static_cast<const void*>(value) << ")");
2558 GPU_CLIENT_LOG_CODE_BLOCK({
2559 for (GLsizei i = 0; i < count; ++i) {
2560 GPU_CLIENT_LOG(
2561 " " << i << ": " << value[0 + i * 8] << ", " << value[1 + i * 8]
2562 << ", " << value[2 + i * 8] << ", " << value[3 + i * 8] << ", "
2563 << value[4 + i * 8] << ", " << value[5 + i * 8] << ", "
2564 << value[6 + i * 8] << ", " << value[7 + i * 8]);
2567 if (count < 0) {
2568 SetGLError(GL_INVALID_VALUE, "glUniformMatrix4x2fv", "count < 0");
2569 return;
2571 if (transpose != false) {
2572 SetGLError(GL_INVALID_VALUE, "glUniformMatrix4x2fv",
2573 "transpose GL_INVALID_VALUE");
2574 return;
2576 helper_->UniformMatrix4x2fvImmediate(location, count, value);
2577 CheckGLError();
2580 void GLES2Implementation::UniformMatrix4x3fv(GLint location,
2581 GLsizei count,
2582 GLboolean transpose,
2583 const GLfloat* value) {
2584 GPU_CLIENT_SINGLE_THREAD_CHECK();
2585 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniformMatrix4x3fv(" << location
2586 << ", " << count << ", "
2587 << GLES2Util::GetStringBool(transpose) << ", "
2588 << static_cast<const void*>(value) << ")");
2589 GPU_CLIENT_LOG_CODE_BLOCK({
2590 for (GLsizei i = 0; i < count; ++i) {
2591 GPU_CLIENT_LOG(
2592 " " << i << ": " << value[0 + i * 12] << ", " << value[1 + i * 12]
2593 << ", " << value[2 + i * 12] << ", " << value[3 + i * 12] << ", "
2594 << value[4 + i * 12] << ", " << value[5 + i * 12] << ", "
2595 << value[6 + i * 12] << ", " << value[7 + i * 12] << ", "
2596 << value[8 + i * 12] << ", " << value[9 + i * 12] << ", "
2597 << value[10 + i * 12] << ", " << value[11 + i * 12]);
2600 if (count < 0) {
2601 SetGLError(GL_INVALID_VALUE, "glUniformMatrix4x3fv", "count < 0");
2602 return;
2604 if (transpose != false) {
2605 SetGLError(GL_INVALID_VALUE, "glUniformMatrix4x3fv",
2606 "transpose GL_INVALID_VALUE");
2607 return;
2609 helper_->UniformMatrix4x3fvImmediate(location, count, value);
2610 CheckGLError();
2613 void GLES2Implementation::UseProgram(GLuint program) {
2614 GPU_CLIENT_SINGLE_THREAD_CHECK();
2615 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUseProgram(" << program << ")");
2616 if (IsProgramReservedId(program)) {
2617 SetGLError(GL_INVALID_OPERATION, "UseProgram", "program reserved id");
2618 return;
2620 UseProgramHelper(program);
2621 CheckGLError();
2624 void GLES2Implementation::ValidateProgram(GLuint program) {
2625 GPU_CLIENT_SINGLE_THREAD_CHECK();
2626 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glValidateProgram(" << program
2627 << ")");
2628 helper_->ValidateProgram(program);
2629 CheckGLError();
2632 void GLES2Implementation::VertexAttrib1f(GLuint indx, GLfloat x) {
2633 GPU_CLIENT_SINGLE_THREAD_CHECK();
2634 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glVertexAttrib1f(" << indx << ", "
2635 << x << ")");
2636 helper_->VertexAttrib1f(indx, x);
2637 CheckGLError();
2640 void GLES2Implementation::VertexAttrib1fv(GLuint indx, const GLfloat* values) {
2641 GPU_CLIENT_SINGLE_THREAD_CHECK();
2642 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glVertexAttrib1fv(" << indx << ", "
2643 << static_cast<const void*>(values) << ")");
2644 size_t count = 1;
2645 for (size_t ii = 0; ii < count; ++ii)
2646 GPU_CLIENT_LOG("value[" << ii << "]: " << values[ii]);
2647 helper_->VertexAttrib1fvImmediate(indx, values);
2648 CheckGLError();
2651 void GLES2Implementation::VertexAttrib2f(GLuint indx, GLfloat x, GLfloat y) {
2652 GPU_CLIENT_SINGLE_THREAD_CHECK();
2653 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glVertexAttrib2f(" << indx << ", "
2654 << x << ", " << y << ")");
2655 helper_->VertexAttrib2f(indx, x, y);
2656 CheckGLError();
2659 void GLES2Implementation::VertexAttrib2fv(GLuint indx, const GLfloat* values) {
2660 GPU_CLIENT_SINGLE_THREAD_CHECK();
2661 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glVertexAttrib2fv(" << indx << ", "
2662 << static_cast<const void*>(values) << ")");
2663 size_t count = 2;
2664 for (size_t ii = 0; ii < count; ++ii)
2665 GPU_CLIENT_LOG("value[" << ii << "]: " << values[ii]);
2666 helper_->VertexAttrib2fvImmediate(indx, values);
2667 CheckGLError();
2670 void GLES2Implementation::VertexAttrib3f(GLuint indx,
2671 GLfloat x,
2672 GLfloat y,
2673 GLfloat z) {
2674 GPU_CLIENT_SINGLE_THREAD_CHECK();
2675 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glVertexAttrib3f(" << indx << ", "
2676 << x << ", " << y << ", " << z << ")");
2677 helper_->VertexAttrib3f(indx, x, y, z);
2678 CheckGLError();
2681 void GLES2Implementation::VertexAttrib3fv(GLuint indx, const GLfloat* values) {
2682 GPU_CLIENT_SINGLE_THREAD_CHECK();
2683 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glVertexAttrib3fv(" << indx << ", "
2684 << static_cast<const void*>(values) << ")");
2685 size_t count = 3;
2686 for (size_t ii = 0; ii < count; ++ii)
2687 GPU_CLIENT_LOG("value[" << ii << "]: " << values[ii]);
2688 helper_->VertexAttrib3fvImmediate(indx, values);
2689 CheckGLError();
2692 void GLES2Implementation::VertexAttrib4f(GLuint indx,
2693 GLfloat x,
2694 GLfloat y,
2695 GLfloat z,
2696 GLfloat w) {
2697 GPU_CLIENT_SINGLE_THREAD_CHECK();
2698 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glVertexAttrib4f(" << indx << ", "
2699 << x << ", " << y << ", " << z << ", " << w << ")");
2700 helper_->VertexAttrib4f(indx, x, y, z, w);
2701 CheckGLError();
2704 void GLES2Implementation::VertexAttrib4fv(GLuint indx, const GLfloat* values) {
2705 GPU_CLIENT_SINGLE_THREAD_CHECK();
2706 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glVertexAttrib4fv(" << indx << ", "
2707 << static_cast<const void*>(values) << ")");
2708 size_t count = 4;
2709 for (size_t ii = 0; ii < count; ++ii)
2710 GPU_CLIENT_LOG("value[" << ii << "]: " << values[ii]);
2711 helper_->VertexAttrib4fvImmediate(indx, values);
2712 CheckGLError();
2715 void GLES2Implementation::VertexAttribI4i(GLuint indx,
2716 GLint x,
2717 GLint y,
2718 GLint z,
2719 GLint w) {
2720 GPU_CLIENT_SINGLE_THREAD_CHECK();
2721 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glVertexAttribI4i(" << indx << ", "
2722 << x << ", " << y << ", " << z << ", " << w << ")");
2723 helper_->VertexAttribI4i(indx, x, y, z, w);
2724 CheckGLError();
2727 void GLES2Implementation::VertexAttribI4iv(GLuint indx, const GLint* values) {
2728 GPU_CLIENT_SINGLE_THREAD_CHECK();
2729 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glVertexAttribI4iv(" << indx
2730 << ", " << static_cast<const void*>(values) << ")");
2731 size_t count = 4;
2732 for (size_t ii = 0; ii < count; ++ii)
2733 GPU_CLIENT_LOG("value[" << ii << "]: " << values[ii]);
2734 helper_->VertexAttribI4ivImmediate(indx, values);
2735 CheckGLError();
2738 void GLES2Implementation::VertexAttribI4ui(GLuint indx,
2739 GLuint x,
2740 GLuint y,
2741 GLuint z,
2742 GLuint w) {
2743 GPU_CLIENT_SINGLE_THREAD_CHECK();
2744 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glVertexAttribI4ui(" << indx
2745 << ", " << x << ", " << y << ", " << z << ", " << w
2746 << ")");
2747 helper_->VertexAttribI4ui(indx, x, y, z, w);
2748 CheckGLError();
2751 void GLES2Implementation::VertexAttribI4uiv(GLuint indx, const GLuint* values) {
2752 GPU_CLIENT_SINGLE_THREAD_CHECK();
2753 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glVertexAttribI4uiv(" << indx
2754 << ", " << static_cast<const void*>(values) << ")");
2755 size_t count = 4;
2756 for (size_t ii = 0; ii < count; ++ii)
2757 GPU_CLIENT_LOG("value[" << ii << "]: " << values[ii]);
2758 helper_->VertexAttribI4uivImmediate(indx, values);
2759 CheckGLError();
2762 void GLES2Implementation::Viewport(GLint x,
2763 GLint y,
2764 GLsizei width,
2765 GLsizei height) {
2766 GPU_CLIENT_SINGLE_THREAD_CHECK();
2767 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glViewport(" << x << ", " << y
2768 << ", " << width << ", " << height << ")");
2769 if (width < 0) {
2770 SetGLError(GL_INVALID_VALUE, "glViewport", "width < 0");
2771 return;
2773 if (height < 0) {
2774 SetGLError(GL_INVALID_VALUE, "glViewport", "height < 0");
2775 return;
2777 helper_->Viewport(x, y, width, height);
2778 CheckGLError();
2781 void GLES2Implementation::BlitFramebufferCHROMIUM(GLint srcX0,
2782 GLint srcY0,
2783 GLint srcX1,
2784 GLint srcY1,
2785 GLint dstX0,
2786 GLint dstY0,
2787 GLint dstX1,
2788 GLint dstY1,
2789 GLbitfield mask,
2790 GLenum filter) {
2791 GPU_CLIENT_SINGLE_THREAD_CHECK();
2792 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBlitFramebufferCHROMIUM("
2793 << srcX0 << ", " << srcY0 << ", " << srcX1 << ", " << srcY1
2794 << ", " << dstX0 << ", " << dstY0 << ", " << dstX1 << ", "
2795 << dstY1 << ", " << mask << ", "
2796 << GLES2Util::GetStringBlitFilter(filter) << ")");
2797 helper_->BlitFramebufferCHROMIUM(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0,
2798 dstX1, dstY1, mask, filter);
2799 CheckGLError();
2802 void GLES2Implementation::RenderbufferStorageMultisampleCHROMIUM(
2803 GLenum target,
2804 GLsizei samples,
2805 GLenum internalformat,
2806 GLsizei width,
2807 GLsizei height) {
2808 GPU_CLIENT_SINGLE_THREAD_CHECK();
2809 GPU_CLIENT_LOG(
2810 "[" << GetLogPrefix() << "] glRenderbufferStorageMultisampleCHROMIUM("
2811 << GLES2Util::GetStringRenderBufferTarget(target) << ", " << samples
2812 << ", " << GLES2Util::GetStringRenderBufferFormat(internalformat)
2813 << ", " << width << ", " << height << ")");
2814 if (samples < 0) {
2815 SetGLError(GL_INVALID_VALUE, "glRenderbufferStorageMultisampleCHROMIUM",
2816 "samples < 0");
2817 return;
2819 if (width < 0) {
2820 SetGLError(GL_INVALID_VALUE, "glRenderbufferStorageMultisampleCHROMIUM",
2821 "width < 0");
2822 return;
2824 if (height < 0) {
2825 SetGLError(GL_INVALID_VALUE, "glRenderbufferStorageMultisampleCHROMIUM",
2826 "height < 0");
2827 return;
2829 helper_->RenderbufferStorageMultisampleCHROMIUM(
2830 target, samples, internalformat, width, height);
2831 CheckGLError();
2834 void GLES2Implementation::RenderbufferStorageMultisampleEXT(
2835 GLenum target,
2836 GLsizei samples,
2837 GLenum internalformat,
2838 GLsizei width,
2839 GLsizei height) {
2840 GPU_CLIENT_SINGLE_THREAD_CHECK();
2841 GPU_CLIENT_LOG(
2842 "[" << GetLogPrefix() << "] glRenderbufferStorageMultisampleEXT("
2843 << GLES2Util::GetStringRenderBufferTarget(target) << ", " << samples
2844 << ", " << GLES2Util::GetStringRenderBufferFormat(internalformat)
2845 << ", " << width << ", " << height << ")");
2846 if (samples < 0) {
2847 SetGLError(GL_INVALID_VALUE, "glRenderbufferStorageMultisampleEXT",
2848 "samples < 0");
2849 return;
2851 if (width < 0) {
2852 SetGLError(GL_INVALID_VALUE, "glRenderbufferStorageMultisampleEXT",
2853 "width < 0");
2854 return;
2856 if (height < 0) {
2857 SetGLError(GL_INVALID_VALUE, "glRenderbufferStorageMultisampleEXT",
2858 "height < 0");
2859 return;
2861 helper_->RenderbufferStorageMultisampleEXT(target, samples, internalformat,
2862 width, height);
2863 CheckGLError();
2866 void GLES2Implementation::FramebufferTexture2DMultisampleEXT(GLenum target,
2867 GLenum attachment,
2868 GLenum textarget,
2869 GLuint texture,
2870 GLint level,
2871 GLsizei samples) {
2872 GPU_CLIENT_SINGLE_THREAD_CHECK();
2873 GPU_CLIENT_LOG("[" << GetLogPrefix()
2874 << "] glFramebufferTexture2DMultisampleEXT("
2875 << GLES2Util::GetStringFrameBufferTarget(target) << ", "
2876 << GLES2Util::GetStringAttachment(attachment) << ", "
2877 << GLES2Util::GetStringTextureTarget(textarget) << ", "
2878 << texture << ", " << level << ", " << samples << ")");
2879 if (level != 0) {
2880 SetGLError(GL_INVALID_VALUE, "glFramebufferTexture2DMultisampleEXT",
2881 "level GL_INVALID_VALUE");
2882 return;
2884 if (samples < 0) {
2885 SetGLError(GL_INVALID_VALUE, "glFramebufferTexture2DMultisampleEXT",
2886 "samples < 0");
2887 return;
2889 helper_->FramebufferTexture2DMultisampleEXT(target, attachment, textarget,
2890 texture, samples);
2891 CheckGLError();
2894 void GLES2Implementation::TexStorage2DEXT(GLenum target,
2895 GLsizei levels,
2896 GLenum internalFormat,
2897 GLsizei width,
2898 GLsizei height) {
2899 GPU_CLIENT_SINGLE_THREAD_CHECK();
2900 GPU_CLIENT_LOG(
2901 "[" << GetLogPrefix() << "] glTexStorage2DEXT("
2902 << GLES2Util::GetStringTextureTarget(target) << ", " << levels << ", "
2903 << GLES2Util::GetStringTextureInternalFormatStorage(internalFormat)
2904 << ", " << width << ", " << height << ")");
2905 if (levels < 0) {
2906 SetGLError(GL_INVALID_VALUE, "glTexStorage2DEXT", "levels < 0");
2907 return;
2909 if (width < 0) {
2910 SetGLError(GL_INVALID_VALUE, "glTexStorage2DEXT", "width < 0");
2911 return;
2913 if (height < 0) {
2914 SetGLError(GL_INVALID_VALUE, "glTexStorage2DEXT", "height < 0");
2915 return;
2917 helper_->TexStorage2DEXT(target, levels, internalFormat, width, height);
2918 CheckGLError();
2921 void GLES2Implementation::GenQueriesEXT(GLsizei n, GLuint* queries) {
2922 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGenQueriesEXT(" << n << ", "
2923 << static_cast<const void*>(queries) << ")");
2924 if (n < 0) {
2925 SetGLError(GL_INVALID_VALUE, "glGenQueriesEXT", "n < 0");
2926 return;
2928 GPU_CLIENT_SINGLE_THREAD_CHECK();
2929 IdAllocator* id_allocator = GetIdAllocator(id_namespaces::kQueries);
2930 for (GLsizei ii = 0; ii < n; ++ii)
2931 queries[ii] = id_allocator->AllocateID();
2932 GenQueriesEXTHelper(n, queries);
2933 helper_->GenQueriesEXTImmediate(n, queries);
2934 if (share_group_->bind_generates_resource())
2935 helper_->CommandBufferHelper::Flush();
2936 GPU_CLIENT_LOG_CODE_BLOCK({
2937 for (GLsizei i = 0; i < n; ++i) {
2938 GPU_CLIENT_LOG(" " << i << ": " << queries[i]);
2941 CheckGLError();
2944 void GLES2Implementation::DeleteQueriesEXT(GLsizei n, const GLuint* queries) {
2945 GPU_CLIENT_SINGLE_THREAD_CHECK();
2946 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDeleteQueriesEXT(" << n << ", "
2947 << static_cast<const void*>(queries) << ")");
2948 GPU_CLIENT_LOG_CODE_BLOCK({
2949 for (GLsizei i = 0; i < n; ++i) {
2950 GPU_CLIENT_LOG(" " << i << ": " << queries[i]);
2953 GPU_CLIENT_DCHECK_CODE_BLOCK({
2954 for (GLsizei i = 0; i < n; ++i) {
2955 DCHECK(queries[i] != 0);
2958 if (n < 0) {
2959 SetGLError(GL_INVALID_VALUE, "glDeleteQueriesEXT", "n < 0");
2960 return;
2962 DeleteQueriesEXTHelper(n, queries);
2963 CheckGLError();
2966 void GLES2Implementation::BeginTransformFeedback(GLenum primitivemode) {
2967 GPU_CLIENT_SINGLE_THREAD_CHECK();
2968 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBeginTransformFeedback("
2969 << GLES2Util::GetStringTransformFeedbackPrimitiveMode(
2970 primitivemode) << ")");
2971 helper_->BeginTransformFeedback(primitivemode);
2972 CheckGLError();
2975 void GLES2Implementation::EndTransformFeedback() {
2976 GPU_CLIENT_SINGLE_THREAD_CHECK();
2977 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glEndTransformFeedback("
2978 << ")");
2979 helper_->EndTransformFeedback();
2980 CheckGLError();
2983 void GLES2Implementation::GenVertexArraysOES(GLsizei n, GLuint* arrays) {
2984 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGenVertexArraysOES(" << n << ", "
2985 << static_cast<const void*>(arrays) << ")");
2986 if (n < 0) {
2987 SetGLError(GL_INVALID_VALUE, "glGenVertexArraysOES", "n < 0");
2988 return;
2990 GPU_CLIENT_SINGLE_THREAD_CHECK();
2991 GetIdHandler(id_namespaces::kVertexArrays)->MakeIds(this, 0, n, arrays);
2992 GenVertexArraysOESHelper(n, arrays);
2993 helper_->GenVertexArraysOESImmediate(n, arrays);
2994 if (share_group_->bind_generates_resource())
2995 helper_->CommandBufferHelper::Flush();
2996 GPU_CLIENT_LOG_CODE_BLOCK({
2997 for (GLsizei i = 0; i < n; ++i) {
2998 GPU_CLIENT_LOG(" " << i << ": " << arrays[i]);
3001 CheckGLError();
3004 void GLES2Implementation::DeleteVertexArraysOES(GLsizei n,
3005 const GLuint* arrays) {
3006 GPU_CLIENT_SINGLE_THREAD_CHECK();
3007 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDeleteVertexArraysOES(" << n
3008 << ", " << static_cast<const void*>(arrays) << ")");
3009 GPU_CLIENT_LOG_CODE_BLOCK({
3010 for (GLsizei i = 0; i < n; ++i) {
3011 GPU_CLIENT_LOG(" " << i << ": " << arrays[i]);
3014 GPU_CLIENT_DCHECK_CODE_BLOCK({
3015 for (GLsizei i = 0; i < n; ++i) {
3016 DCHECK(arrays[i] != 0);
3019 if (n < 0) {
3020 SetGLError(GL_INVALID_VALUE, "glDeleteVertexArraysOES", "n < 0");
3021 return;
3023 DeleteVertexArraysOESHelper(n, arrays);
3024 CheckGLError();
3027 GLboolean GLES2Implementation::IsVertexArrayOES(GLuint array) {
3028 GPU_CLIENT_SINGLE_THREAD_CHECK();
3029 TRACE_EVENT0("gpu", "GLES2Implementation::IsVertexArrayOES");
3030 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glIsVertexArrayOES(" << array
3031 << ")");
3032 typedef cmds::IsVertexArrayOES::Result Result;
3033 Result* result = GetResultAs<Result*>();
3034 if (!result) {
3035 return GL_FALSE;
3037 *result = 0;
3038 helper_->IsVertexArrayOES(array, GetResultShmId(), GetResultShmOffset());
3039 WaitForCmd();
3040 GLboolean result_value = *result != 0;
3041 GPU_CLIENT_LOG("returned " << result_value);
3042 CheckGLError();
3043 return result_value;
3046 void GLES2Implementation::BindVertexArrayOES(GLuint array) {
3047 GPU_CLIENT_SINGLE_THREAD_CHECK();
3048 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBindVertexArrayOES(" << array
3049 << ")");
3050 if (IsVertexArrayReservedId(array)) {
3051 SetGLError(GL_INVALID_OPERATION, "BindVertexArrayOES", "array reserved id");
3052 return;
3054 BindVertexArrayOESHelper(array);
3055 CheckGLError();
3058 void GLES2Implementation::GetTranslatedShaderSourceANGLE(GLuint shader,
3059 GLsizei bufsize,
3060 GLsizei* length,
3061 char* source) {
3062 GPU_CLIENT_SINGLE_THREAD_CHECK();
3063 GPU_CLIENT_VALIDATE_DESTINATION_OPTIONAL_INITALIZATION(GLsizei, length);
3064 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetTranslatedShaderSourceANGLE"
3065 << "(" << shader << ", " << bufsize << ", "
3066 << static_cast<void*>(length) << ", "
3067 << static_cast<void*>(source) << ")");
3068 helper_->SetBucketSize(kResultBucketId, 0);
3069 helper_->GetTranslatedShaderSourceANGLE(shader, kResultBucketId);
3070 std::string str;
3071 GLsizei max_size = 0;
3072 if (GetBucketAsString(kResultBucketId, &str)) {
3073 if (bufsize > 0) {
3074 max_size = std::min(static_cast<size_t>(bufsize) - 1, str.size());
3075 memcpy(source, str.c_str(), max_size);
3076 source[max_size] = '\0';
3077 GPU_CLIENT_LOG("------\n" << source << "\n------");
3080 if (length != NULL) {
3081 *length = max_size;
3083 CheckGLError();
3085 void GLES2Implementation::TexImageIOSurface2DCHROMIUM(GLenum target,
3086 GLsizei width,
3087 GLsizei height,
3088 GLuint ioSurfaceId,
3089 GLuint plane) {
3090 GPU_CLIENT_SINGLE_THREAD_CHECK();
3091 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glTexImageIOSurface2DCHROMIUM("
3092 << GLES2Util::GetStringTextureBindTarget(target) << ", "
3093 << width << ", " << height << ", " << ioSurfaceId << ", "
3094 << plane << ")");
3095 if (width < 0) {
3096 SetGLError(GL_INVALID_VALUE, "glTexImageIOSurface2DCHROMIUM", "width < 0");
3097 return;
3099 if (height < 0) {
3100 SetGLError(GL_INVALID_VALUE, "glTexImageIOSurface2DCHROMIUM", "height < 0");
3101 return;
3103 helper_->TexImageIOSurface2DCHROMIUM(target, width, height, ioSurfaceId,
3104 plane);
3105 CheckGLError();
3108 void GLES2Implementation::CopyTextureCHROMIUM(GLenum target,
3109 GLenum source_id,
3110 GLenum dest_id,
3111 GLint internalformat,
3112 GLenum dest_type) {
3113 GPU_CLIENT_SINGLE_THREAD_CHECK();
3114 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glCopyTextureCHROMIUM("
3115 << GLES2Util::GetStringEnum(target) << ", "
3116 << GLES2Util::GetStringEnum(source_id) << ", "
3117 << GLES2Util::GetStringEnum(dest_id) << ", "
3118 << internalformat << ", "
3119 << GLES2Util::GetStringPixelType(dest_type) << ")");
3120 helper_->CopyTextureCHROMIUM(target, source_id, dest_id, internalformat,
3121 dest_type);
3122 CheckGLError();
3125 void GLES2Implementation::CopySubTextureCHROMIUM(GLenum target,
3126 GLenum source_id,
3127 GLenum dest_id,
3128 GLint xoffset,
3129 GLint yoffset) {
3130 GPU_CLIENT_SINGLE_THREAD_CHECK();
3131 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glCopySubTextureCHROMIUM("
3132 << GLES2Util::GetStringEnum(target) << ", "
3133 << GLES2Util::GetStringEnum(source_id) << ", "
3134 << GLES2Util::GetStringEnum(dest_id) << ", " << xoffset
3135 << ", " << yoffset << ")");
3136 helper_->CopySubTextureCHROMIUM(target, source_id, dest_id, xoffset, yoffset);
3137 CheckGLError();
3140 void GLES2Implementation::GenValuebuffersCHROMIUM(GLsizei n, GLuint* buffers) {
3141 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGenValuebuffersCHROMIUM(" << n
3142 << ", " << static_cast<const void*>(buffers) << ")");
3143 if (n < 0) {
3144 SetGLError(GL_INVALID_VALUE, "glGenValuebuffersCHROMIUM", "n < 0");
3145 return;
3147 GPU_CLIENT_SINGLE_THREAD_CHECK();
3148 GetIdHandler(id_namespaces::kValuebuffers)->MakeIds(this, 0, n, buffers);
3149 GenValuebuffersCHROMIUMHelper(n, buffers);
3150 helper_->GenValuebuffersCHROMIUMImmediate(n, buffers);
3151 if (share_group_->bind_generates_resource())
3152 helper_->CommandBufferHelper::Flush();
3153 GPU_CLIENT_LOG_CODE_BLOCK({
3154 for (GLsizei i = 0; i < n; ++i) {
3155 GPU_CLIENT_LOG(" " << i << ": " << buffers[i]);
3158 CheckGLError();
3161 void GLES2Implementation::DeleteValuebuffersCHROMIUM(
3162 GLsizei n,
3163 const GLuint* valuebuffers) {
3164 GPU_CLIENT_SINGLE_THREAD_CHECK();
3165 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDeleteValuebuffersCHROMIUM(" << n
3166 << ", " << static_cast<const void*>(valuebuffers) << ")");
3167 GPU_CLIENT_LOG_CODE_BLOCK({
3168 for (GLsizei i = 0; i < n; ++i) {
3169 GPU_CLIENT_LOG(" " << i << ": " << valuebuffers[i]);
3172 GPU_CLIENT_DCHECK_CODE_BLOCK({
3173 for (GLsizei i = 0; i < n; ++i) {
3174 DCHECK(valuebuffers[i] != 0);
3177 if (n < 0) {
3178 SetGLError(GL_INVALID_VALUE, "glDeleteValuebuffersCHROMIUM", "n < 0");
3179 return;
3181 DeleteValuebuffersCHROMIUMHelper(n, valuebuffers);
3182 CheckGLError();
3185 GLboolean GLES2Implementation::IsValuebufferCHROMIUM(GLuint valuebuffer) {
3186 GPU_CLIENT_SINGLE_THREAD_CHECK();
3187 TRACE_EVENT0("gpu", "GLES2Implementation::IsValuebufferCHROMIUM");
3188 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glIsValuebufferCHROMIUM("
3189 << valuebuffer << ")");
3190 typedef cmds::IsValuebufferCHROMIUM::Result Result;
3191 Result* result = GetResultAs<Result*>();
3192 if (!result) {
3193 return GL_FALSE;
3195 *result = 0;
3196 helper_->IsValuebufferCHROMIUM(valuebuffer, GetResultShmId(),
3197 GetResultShmOffset());
3198 WaitForCmd();
3199 GLboolean result_value = *result != 0;
3200 GPU_CLIENT_LOG("returned " << result_value);
3201 CheckGLError();
3202 return result_value;
3205 void GLES2Implementation::BindValuebufferCHROMIUM(GLenum target,
3206 GLuint valuebuffer) {
3207 GPU_CLIENT_SINGLE_THREAD_CHECK();
3208 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBindValuebufferCHROMIUM("
3209 << GLES2Util::GetStringValueBufferTarget(target) << ", "
3210 << valuebuffer << ")");
3211 if (IsValuebufferReservedId(valuebuffer)) {
3212 SetGLError(GL_INVALID_OPERATION, "BindValuebufferCHROMIUM",
3213 "valuebuffer reserved id");
3214 return;
3216 BindValuebufferCHROMIUMHelper(target, valuebuffer);
3217 CheckGLError();
3220 void GLES2Implementation::SubscribeValueCHROMIUM(GLenum target,
3221 GLenum subscription) {
3222 GPU_CLIENT_SINGLE_THREAD_CHECK();
3223 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glSubscribeValueCHROMIUM("
3224 << GLES2Util::GetStringValueBufferTarget(target) << ", "
3225 << GLES2Util::GetStringSubscriptionTarget(subscription)
3226 << ")");
3227 helper_->SubscribeValueCHROMIUM(target, subscription);
3228 CheckGLError();
3231 void GLES2Implementation::PopulateSubscribedValuesCHROMIUM(GLenum target) {
3232 GPU_CLIENT_SINGLE_THREAD_CHECK();
3233 GPU_CLIENT_LOG("[" << GetLogPrefix()
3234 << "] glPopulateSubscribedValuesCHROMIUM("
3235 << GLES2Util::GetStringValueBufferTarget(target) << ")");
3236 helper_->PopulateSubscribedValuesCHROMIUM(target);
3237 CheckGLError();
3240 void GLES2Implementation::UniformValuebufferCHROMIUM(GLint location,
3241 GLenum target,
3242 GLenum subscription) {
3243 GPU_CLIENT_SINGLE_THREAD_CHECK();
3244 GPU_CLIENT_LOG(
3245 "[" << GetLogPrefix() << "] glUniformValuebufferCHROMIUM(" << location
3246 << ", " << GLES2Util::GetStringValueBufferTarget(target) << ", "
3247 << GLES2Util::GetStringSubscriptionTarget(subscription) << ")");
3248 helper_->UniformValuebufferCHROMIUM(location, target, subscription);
3249 CheckGLError();
3252 void GLES2Implementation::BindTexImage2DCHROMIUM(GLenum target, GLint imageId) {
3253 GPU_CLIENT_SINGLE_THREAD_CHECK();
3254 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBindTexImage2DCHROMIUM("
3255 << GLES2Util::GetStringTextureBindTarget(target) << ", "
3256 << imageId << ")");
3257 helper_->BindTexImage2DCHROMIUM(target, imageId);
3258 CheckGLError();
3261 void GLES2Implementation::ReleaseTexImage2DCHROMIUM(GLenum target,
3262 GLint imageId) {
3263 GPU_CLIENT_SINGLE_THREAD_CHECK();
3264 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glReleaseTexImage2DCHROMIUM("
3265 << GLES2Util::GetStringTextureBindTarget(target) << ", "
3266 << imageId << ")");
3267 helper_->ReleaseTexImage2DCHROMIUM(target, imageId);
3268 CheckGLError();
3271 void GLES2Implementation::DiscardFramebufferEXT(GLenum target,
3272 GLsizei count,
3273 const GLenum* attachments) {
3274 GPU_CLIENT_SINGLE_THREAD_CHECK();
3275 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDiscardFramebufferEXT("
3276 << GLES2Util::GetStringEnum(target) << ", " << count
3277 << ", " << static_cast<const void*>(attachments) << ")");
3278 GPU_CLIENT_LOG_CODE_BLOCK({
3279 for (GLsizei i = 0; i < count; ++i) {
3280 GPU_CLIENT_LOG(" " << i << ": " << attachments[0 + i * 1]);
3283 if (count < 0) {
3284 SetGLError(GL_INVALID_VALUE, "glDiscardFramebufferEXT", "count < 0");
3285 return;
3287 helper_->DiscardFramebufferEXTImmediate(target, count, attachments);
3288 CheckGLError();
3291 void GLES2Implementation::LoseContextCHROMIUM(GLenum current, GLenum other) {
3292 GPU_CLIENT_SINGLE_THREAD_CHECK();
3293 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glLoseContextCHROMIUM("
3294 << GLES2Util::GetStringResetStatus(current) << ", "
3295 << GLES2Util::GetStringResetStatus(other) << ")");
3296 helper_->LoseContextCHROMIUM(current, other);
3297 CheckGLError();
3300 void GLES2Implementation::WaitSyncPointCHROMIUM(GLuint sync_point) {
3301 GPU_CLIENT_SINGLE_THREAD_CHECK();
3302 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glWaitSyncPointCHROMIUM("
3303 << sync_point << ")");
3304 helper_->WaitSyncPointCHROMIUM(sync_point);
3305 CheckGLError();
3308 void GLES2Implementation::DrawBuffersEXT(GLsizei count, const GLenum* bufs) {
3309 GPU_CLIENT_SINGLE_THREAD_CHECK();
3310 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDrawBuffersEXT(" << count << ", "
3311 << static_cast<const void*>(bufs) << ")");
3312 GPU_CLIENT_LOG_CODE_BLOCK({
3313 for (GLsizei i = 0; i < count; ++i) {
3314 GPU_CLIENT_LOG(" " << i << ": " << bufs[0 + i * 1]);
3317 if (count < 0) {
3318 SetGLError(GL_INVALID_VALUE, "glDrawBuffersEXT", "count < 0");
3319 return;
3321 helper_->DrawBuffersEXTImmediate(count, bufs);
3322 CheckGLError();
3325 void GLES2Implementation::DiscardBackbufferCHROMIUM() {
3326 GPU_CLIENT_SINGLE_THREAD_CHECK();
3327 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDiscardBackbufferCHROMIUM("
3328 << ")");
3329 helper_->DiscardBackbufferCHROMIUM();
3330 CheckGLError();
3333 void GLES2Implementation::ScheduleOverlayPlaneCHROMIUM(
3334 GLint plane_z_order,
3335 GLenum plane_transform,
3336 GLuint overlay_texture_id,
3337 GLint bounds_x,
3338 GLint bounds_y,
3339 GLint bounds_width,
3340 GLint bounds_height,
3341 GLfloat uv_x,
3342 GLfloat uv_y,
3343 GLfloat uv_width,
3344 GLfloat uv_height) {
3345 GPU_CLIENT_SINGLE_THREAD_CHECK();
3346 GPU_CLIENT_LOG(
3347 "[" << GetLogPrefix() << "] glScheduleOverlayPlaneCHROMIUM("
3348 << plane_z_order << ", " << GLES2Util::GetStringEnum(plane_transform)
3349 << ", " << overlay_texture_id << ", " << bounds_x << ", " << bounds_y
3350 << ", " << bounds_width << ", " << bounds_height << ", " << uv_x
3351 << ", " << uv_y << ", " << uv_width << ", " << uv_height << ")");
3352 helper_->ScheduleOverlayPlaneCHROMIUM(
3353 plane_z_order, plane_transform, overlay_texture_id, bounds_x, bounds_y,
3354 bounds_width, bounds_height, uv_x, uv_y, uv_width, uv_height);
3355 CheckGLError();
3358 void GLES2Implementation::MatrixLoadfCHROMIUM(GLenum matrixMode,
3359 const GLfloat* m) {
3360 GPU_CLIENT_SINGLE_THREAD_CHECK();
3361 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glMatrixLoadfCHROMIUM("
3362 << GLES2Util::GetStringMatrixMode(matrixMode) << ", "
3363 << static_cast<const void*>(m) << ")");
3364 size_t count = 16;
3365 for (size_t ii = 0; ii < count; ++ii)
3366 GPU_CLIENT_LOG("value[" << ii << "]: " << m[ii]);
3367 helper_->MatrixLoadfCHROMIUMImmediate(matrixMode, m);
3368 CheckGLError();
3371 void GLES2Implementation::MatrixLoadIdentityCHROMIUM(GLenum matrixMode) {
3372 GPU_CLIENT_SINGLE_THREAD_CHECK();
3373 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glMatrixLoadIdentityCHROMIUM("
3374 << GLES2Util::GetStringMatrixMode(matrixMode) << ")");
3375 helper_->MatrixLoadIdentityCHROMIUM(matrixMode);
3376 CheckGLError();
3379 void GLES2Implementation::BlendBarrierKHR() {
3380 GPU_CLIENT_SINGLE_THREAD_CHECK();
3381 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBlendBarrierKHR("
3382 << ")");
3383 helper_->BlendBarrierKHR();
3384 CheckGLError();
3387 #endif // GPU_COMMAND_BUFFER_CLIENT_GLES2_IMPLEMENTATION_IMPL_AUTOGEN_H_