Supervised user import: Listen for profile creation/deletion
[chromium-blink-merge.git] / gpu / command_buffer / client / gles2_implementation_impl_autogen.h
blob652855463872b846b567cfd56d696e1277866795
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::GetInteger64v(GLenum pname, GLint64* params) {
1000 GPU_CLIENT_SINGLE_THREAD_CHECK();
1001 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetInteger64v("
1002 << GLES2Util::GetStringGLState(pname) << ", "
1003 << static_cast<const void*>(params) << ")");
1004 TRACE_EVENT0("gpu", "GLES2Implementation::GetInteger64v");
1005 if (GetInteger64vHelper(pname, params)) {
1006 return;
1008 typedef cmds::GetInteger64v::Result Result;
1009 Result* result = GetResultAs<Result*>();
1010 if (!result) {
1011 return;
1013 result->SetNumResults(0);
1014 helper_->GetInteger64v(pname, GetResultShmId(), GetResultShmOffset());
1015 WaitForCmd();
1016 result->CopyResult(params);
1017 GPU_CLIENT_LOG_CODE_BLOCK({
1018 for (int32_t i = 0; i < result->GetNumResults(); ++i) {
1019 GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]);
1022 CheckGLError();
1024 void GLES2Implementation::GetIntegeri_v(GLenum pname,
1025 GLuint index,
1026 GLint* data) {
1027 GPU_CLIENT_SINGLE_THREAD_CHECK();
1028 GPU_CLIENT_VALIDATE_DESTINATION_INITALIZATION(GLint, data);
1029 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetIntegeri_v("
1030 << GLES2Util::GetStringIndexedGLState(pname) << ", "
1031 << index << ", " << static_cast<const void*>(data) << ")");
1032 TRACE_EVENT0("gpu", "GLES2Implementation::GetIntegeri_v");
1033 if (GetIntegeri_vHelper(pname, index, data)) {
1034 return;
1036 typedef cmds::GetIntegeri_v::Result Result;
1037 Result* result = GetResultAs<Result*>();
1038 if (!result) {
1039 return;
1041 result->SetNumResults(0);
1042 helper_->GetIntegeri_v(pname, index, GetResultShmId(), GetResultShmOffset());
1043 WaitForCmd();
1044 result->CopyResult(data);
1045 GPU_CLIENT_LOG_CODE_BLOCK({
1046 for (int32_t i = 0; i < result->GetNumResults(); ++i) {
1047 GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]);
1050 CheckGLError();
1052 void GLES2Implementation::GetInteger64i_v(GLenum pname,
1053 GLuint index,
1054 GLint64* data) {
1055 GPU_CLIENT_SINGLE_THREAD_CHECK();
1056 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetInteger64i_v("
1057 << GLES2Util::GetStringIndexedGLState(pname) << ", "
1058 << index << ", " << static_cast<const void*>(data) << ")");
1059 TRACE_EVENT0("gpu", "GLES2Implementation::GetInteger64i_v");
1060 if (GetInteger64i_vHelper(pname, index, data)) {
1061 return;
1063 typedef cmds::GetInteger64i_v::Result Result;
1064 Result* result = GetResultAs<Result*>();
1065 if (!result) {
1066 return;
1068 result->SetNumResults(0);
1069 helper_->GetInteger64i_v(pname, index, GetResultShmId(),
1070 GetResultShmOffset());
1071 WaitForCmd();
1072 result->CopyResult(data);
1073 GPU_CLIENT_LOG_CODE_BLOCK({
1074 for (int32_t i = 0; i < result->GetNumResults(); ++i) {
1075 GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]);
1078 CheckGLError();
1080 void GLES2Implementation::GetIntegerv(GLenum pname, GLint* params) {
1081 GPU_CLIENT_SINGLE_THREAD_CHECK();
1082 GPU_CLIENT_VALIDATE_DESTINATION_INITALIZATION(GLint, params);
1083 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetIntegerv("
1084 << GLES2Util::GetStringGLState(pname) << ", "
1085 << static_cast<const void*>(params) << ")");
1086 TRACE_EVENT0("gpu", "GLES2Implementation::GetIntegerv");
1087 if (GetIntegervHelper(pname, params)) {
1088 return;
1090 typedef cmds::GetIntegerv::Result Result;
1091 Result* result = GetResultAs<Result*>();
1092 if (!result) {
1093 return;
1095 result->SetNumResults(0);
1096 helper_->GetIntegerv(pname, GetResultShmId(), GetResultShmOffset());
1097 WaitForCmd();
1098 result->CopyResult(params);
1099 GPU_CLIENT_LOG_CODE_BLOCK({
1100 for (int32_t i = 0; i < result->GetNumResults(); ++i) {
1101 GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]);
1104 CheckGLError();
1106 void GLES2Implementation::GetInternalformativ(GLenum target,
1107 GLenum format,
1108 GLenum pname,
1109 GLsizei bufSize,
1110 GLint* params) {
1111 GPU_CLIENT_SINGLE_THREAD_CHECK();
1112 GPU_CLIENT_VALIDATE_DESTINATION_INITALIZATION(GLint, params);
1113 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetInternalformativ("
1114 << GLES2Util::GetStringRenderBufferTarget(target) << ", "
1115 << GLES2Util::GetStringRenderBufferFormat(format) << ", "
1116 << GLES2Util::GetStringRenderBufferParameter(pname) << ", "
1117 << bufSize << ", " << static_cast<const void*>(params)
1118 << ")");
1119 if (bufSize < 0) {
1120 SetGLError(GL_INVALID_VALUE, "glGetInternalformativ", "bufSize < 0");
1121 return;
1123 TRACE_EVENT0("gpu", "GLES2Implementation::GetInternalformativ");
1124 if (GetInternalformativHelper(target, format, pname, bufSize, params)) {
1125 return;
1127 typedef cmds::GetInternalformativ::Result Result;
1128 Result* result = GetResultAs<Result*>();
1129 if (!result) {
1130 return;
1132 result->SetNumResults(0);
1133 helper_->GetInternalformativ(target, format, pname, bufSize, GetResultShmId(),
1134 GetResultShmOffset());
1135 WaitForCmd();
1136 result->CopyResult(params);
1137 GPU_CLIENT_LOG_CODE_BLOCK({
1138 for (int32_t i = 0; i < result->GetNumResults(); ++i) {
1139 GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]);
1142 CheckGLError();
1144 void GLES2Implementation::GetProgramiv(GLuint program,
1145 GLenum pname,
1146 GLint* params) {
1147 GPU_CLIENT_SINGLE_THREAD_CHECK();
1148 GPU_CLIENT_VALIDATE_DESTINATION_INITALIZATION(GLint, params);
1149 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetProgramiv(" << program << ", "
1150 << GLES2Util::GetStringProgramParameter(pname) << ", "
1151 << static_cast<const void*>(params) << ")");
1152 TRACE_EVENT0("gpu", "GLES2Implementation::GetProgramiv");
1153 if (GetProgramivHelper(program, pname, params)) {
1154 return;
1156 typedef cmds::GetProgramiv::Result Result;
1157 Result* result = GetResultAs<Result*>();
1158 if (!result) {
1159 return;
1161 result->SetNumResults(0);
1162 helper_->GetProgramiv(program, pname, GetResultShmId(), GetResultShmOffset());
1163 WaitForCmd();
1164 result->CopyResult(params);
1165 GPU_CLIENT_LOG_CODE_BLOCK({
1166 for (int32_t i = 0; i < result->GetNumResults(); ++i) {
1167 GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]);
1170 CheckGLError();
1172 void GLES2Implementation::GetProgramInfoLog(GLuint program,
1173 GLsizei bufsize,
1174 GLsizei* length,
1175 char* infolog) {
1176 GPU_CLIENT_SINGLE_THREAD_CHECK();
1177 GPU_CLIENT_VALIDATE_DESTINATION_OPTIONAL_INITALIZATION(GLsizei, length);
1178 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetProgramInfoLog"
1179 << "(" << program << ", " << bufsize << ", "
1180 << static_cast<void*>(length) << ", "
1181 << static_cast<void*>(infolog) << ")");
1182 helper_->SetBucketSize(kResultBucketId, 0);
1183 helper_->GetProgramInfoLog(program, kResultBucketId);
1184 std::string str;
1185 GLsizei max_size = 0;
1186 if (GetBucketAsString(kResultBucketId, &str)) {
1187 if (bufsize > 0) {
1188 max_size = std::min(static_cast<size_t>(bufsize) - 1, str.size());
1189 memcpy(infolog, str.c_str(), max_size);
1190 infolog[max_size] = '\0';
1191 GPU_CLIENT_LOG("------\n" << infolog << "\n------");
1194 if (length != NULL) {
1195 *length = max_size;
1197 CheckGLError();
1199 void GLES2Implementation::GetRenderbufferParameteriv(GLenum target,
1200 GLenum pname,
1201 GLint* params) {
1202 GPU_CLIENT_SINGLE_THREAD_CHECK();
1203 GPU_CLIENT_VALIDATE_DESTINATION_INITALIZATION(GLint, params);
1204 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetRenderbufferParameteriv("
1205 << GLES2Util::GetStringRenderBufferTarget(target) << ", "
1206 << GLES2Util::GetStringRenderBufferParameter(pname) << ", "
1207 << static_cast<const void*>(params) << ")");
1208 TRACE_EVENT0("gpu", "GLES2Implementation::GetRenderbufferParameteriv");
1209 if (GetRenderbufferParameterivHelper(target, pname, params)) {
1210 return;
1212 typedef cmds::GetRenderbufferParameteriv::Result Result;
1213 Result* result = GetResultAs<Result*>();
1214 if (!result) {
1215 return;
1217 result->SetNumResults(0);
1218 helper_->GetRenderbufferParameteriv(target, pname, GetResultShmId(),
1219 GetResultShmOffset());
1220 WaitForCmd();
1221 result->CopyResult(params);
1222 GPU_CLIENT_LOG_CODE_BLOCK({
1223 for (int32_t i = 0; i < result->GetNumResults(); ++i) {
1224 GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]);
1227 CheckGLError();
1229 void GLES2Implementation::GetSamplerParameterfv(GLuint sampler,
1230 GLenum pname,
1231 GLfloat* params) {
1232 GPU_CLIENT_SINGLE_THREAD_CHECK();
1233 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetSamplerParameterfv("
1234 << sampler << ", "
1235 << GLES2Util::GetStringSamplerParameter(pname) << ", "
1236 << static_cast<const void*>(params) << ")");
1237 TRACE_EVENT0("gpu", "GLES2Implementation::GetSamplerParameterfv");
1238 if (GetSamplerParameterfvHelper(sampler, pname, params)) {
1239 return;
1241 typedef cmds::GetSamplerParameterfv::Result Result;
1242 Result* result = GetResultAs<Result*>();
1243 if (!result) {
1244 return;
1246 result->SetNumResults(0);
1247 helper_->GetSamplerParameterfv(sampler, pname, GetResultShmId(),
1248 GetResultShmOffset());
1249 WaitForCmd();
1250 result->CopyResult(params);
1251 GPU_CLIENT_LOG_CODE_BLOCK({
1252 for (int32_t i = 0; i < result->GetNumResults(); ++i) {
1253 GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]);
1256 CheckGLError();
1258 void GLES2Implementation::GetSamplerParameteriv(GLuint sampler,
1259 GLenum pname,
1260 GLint* params) {
1261 GPU_CLIENT_SINGLE_THREAD_CHECK();
1262 GPU_CLIENT_VALIDATE_DESTINATION_INITALIZATION(GLint, params);
1263 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetSamplerParameteriv("
1264 << sampler << ", "
1265 << GLES2Util::GetStringSamplerParameter(pname) << ", "
1266 << static_cast<const void*>(params) << ")");
1267 TRACE_EVENT0("gpu", "GLES2Implementation::GetSamplerParameteriv");
1268 if (GetSamplerParameterivHelper(sampler, pname, params)) {
1269 return;
1271 typedef cmds::GetSamplerParameteriv::Result Result;
1272 Result* result = GetResultAs<Result*>();
1273 if (!result) {
1274 return;
1276 result->SetNumResults(0);
1277 helper_->GetSamplerParameteriv(sampler, pname, GetResultShmId(),
1278 GetResultShmOffset());
1279 WaitForCmd();
1280 result->CopyResult(params);
1281 GPU_CLIENT_LOG_CODE_BLOCK({
1282 for (int32_t i = 0; i < result->GetNumResults(); ++i) {
1283 GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]);
1286 CheckGLError();
1288 void GLES2Implementation::GetShaderiv(GLuint shader,
1289 GLenum pname,
1290 GLint* params) {
1291 GPU_CLIENT_SINGLE_THREAD_CHECK();
1292 GPU_CLIENT_VALIDATE_DESTINATION_INITALIZATION(GLint, params);
1293 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetShaderiv(" << shader << ", "
1294 << GLES2Util::GetStringShaderParameter(pname) << ", "
1295 << static_cast<const void*>(params) << ")");
1296 TRACE_EVENT0("gpu", "GLES2Implementation::GetShaderiv");
1297 if (GetShaderivHelper(shader, pname, params)) {
1298 return;
1300 typedef cmds::GetShaderiv::Result Result;
1301 Result* result = GetResultAs<Result*>();
1302 if (!result) {
1303 return;
1305 result->SetNumResults(0);
1306 helper_->GetShaderiv(shader, pname, GetResultShmId(), GetResultShmOffset());
1307 WaitForCmd();
1308 result->CopyResult(params);
1309 GPU_CLIENT_LOG_CODE_BLOCK({
1310 for (int32_t i = 0; i < result->GetNumResults(); ++i) {
1311 GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]);
1314 CheckGLError();
1316 void GLES2Implementation::GetShaderInfoLog(GLuint shader,
1317 GLsizei bufsize,
1318 GLsizei* length,
1319 char* infolog) {
1320 GPU_CLIENT_SINGLE_THREAD_CHECK();
1321 GPU_CLIENT_VALIDATE_DESTINATION_OPTIONAL_INITALIZATION(GLsizei, length);
1322 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetShaderInfoLog"
1323 << "(" << shader << ", " << bufsize << ", "
1324 << static_cast<void*>(length) << ", "
1325 << static_cast<void*>(infolog) << ")");
1326 helper_->SetBucketSize(kResultBucketId, 0);
1327 helper_->GetShaderInfoLog(shader, kResultBucketId);
1328 std::string str;
1329 GLsizei max_size = 0;
1330 if (GetBucketAsString(kResultBucketId, &str)) {
1331 if (bufsize > 0) {
1332 max_size = std::min(static_cast<size_t>(bufsize) - 1, str.size());
1333 memcpy(infolog, str.c_str(), max_size);
1334 infolog[max_size] = '\0';
1335 GPU_CLIENT_LOG("------\n" << infolog << "\n------");
1338 if (length != NULL) {
1339 *length = max_size;
1341 CheckGLError();
1343 void GLES2Implementation::GetShaderSource(GLuint shader,
1344 GLsizei bufsize,
1345 GLsizei* length,
1346 char* source) {
1347 GPU_CLIENT_SINGLE_THREAD_CHECK();
1348 GPU_CLIENT_VALIDATE_DESTINATION_OPTIONAL_INITALIZATION(GLsizei, length);
1349 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetShaderSource"
1350 << "(" << shader << ", " << bufsize << ", "
1351 << static_cast<void*>(length) << ", "
1352 << static_cast<void*>(source) << ")");
1353 helper_->SetBucketSize(kResultBucketId, 0);
1354 helper_->GetShaderSource(shader, kResultBucketId);
1355 std::string str;
1356 GLsizei max_size = 0;
1357 if (GetBucketAsString(kResultBucketId, &str)) {
1358 if (bufsize > 0) {
1359 max_size = std::min(static_cast<size_t>(bufsize) - 1, str.size());
1360 memcpy(source, str.c_str(), max_size);
1361 source[max_size] = '\0';
1362 GPU_CLIENT_LOG("------\n" << source << "\n------");
1365 if (length != NULL) {
1366 *length = max_size;
1368 CheckGLError();
1370 void GLES2Implementation::GetSynciv(GLsync sync,
1371 GLenum pname,
1372 GLsizei bufsize,
1373 GLsizei* length,
1374 GLint* values) {
1375 GPU_CLIENT_SINGLE_THREAD_CHECK();
1376 GPU_CLIENT_VALIDATE_DESTINATION_OPTIONAL_INITALIZATION(GLsizei, length);
1377 GPU_CLIENT_VALIDATE_DESTINATION_INITALIZATION(GLint, values);
1378 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetSynciv(" << sync << ", "
1379 << GLES2Util::GetStringSyncParameter(pname) << ", "
1380 << bufsize << ", " << static_cast<const void*>(length)
1381 << ", " << static_cast<const void*>(values) << ")");
1382 if (bufsize < 0) {
1383 SetGLError(GL_INVALID_VALUE, "glGetSynciv", "bufsize < 0");
1384 return;
1386 TRACE_EVENT0("gpu", "GLES2Implementation::GetSynciv");
1387 if (GetSyncivHelper(sync, pname, bufsize, length, values)) {
1388 return;
1390 typedef cmds::GetSynciv::Result Result;
1391 Result* result = GetResultAs<Result*>();
1392 if (!result) {
1393 return;
1395 result->SetNumResults(0);
1396 helper_->GetSynciv(ToGLuint(sync), pname, GetResultShmId(),
1397 GetResultShmOffset());
1398 WaitForCmd();
1399 result->CopyResult(values);
1400 GPU_CLIENT_LOG_CODE_BLOCK({
1401 for (int32_t i = 0; i < result->GetNumResults(); ++i) {
1402 GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]);
1405 if (length) {
1406 *length = result->GetNumResults();
1408 CheckGLError();
1410 void GLES2Implementation::GetTexParameterfv(GLenum target,
1411 GLenum pname,
1412 GLfloat* params) {
1413 GPU_CLIENT_SINGLE_THREAD_CHECK();
1414 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetTexParameterfv("
1415 << GLES2Util::GetStringGetTexParamTarget(target) << ", "
1416 << GLES2Util::GetStringTextureParameter(pname) << ", "
1417 << static_cast<const void*>(params) << ")");
1418 TRACE_EVENT0("gpu", "GLES2Implementation::GetTexParameterfv");
1419 if (GetTexParameterfvHelper(target, pname, params)) {
1420 return;
1422 typedef cmds::GetTexParameterfv::Result Result;
1423 Result* result = GetResultAs<Result*>();
1424 if (!result) {
1425 return;
1427 result->SetNumResults(0);
1428 helper_->GetTexParameterfv(target, pname, GetResultShmId(),
1429 GetResultShmOffset());
1430 WaitForCmd();
1431 result->CopyResult(params);
1432 GPU_CLIENT_LOG_CODE_BLOCK({
1433 for (int32_t i = 0; i < result->GetNumResults(); ++i) {
1434 GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]);
1437 CheckGLError();
1439 void GLES2Implementation::GetTexParameteriv(GLenum target,
1440 GLenum pname,
1441 GLint* params) {
1442 GPU_CLIENT_SINGLE_THREAD_CHECK();
1443 GPU_CLIENT_VALIDATE_DESTINATION_INITALIZATION(GLint, params);
1444 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetTexParameteriv("
1445 << GLES2Util::GetStringGetTexParamTarget(target) << ", "
1446 << GLES2Util::GetStringTextureParameter(pname) << ", "
1447 << static_cast<const void*>(params) << ")");
1448 TRACE_EVENT0("gpu", "GLES2Implementation::GetTexParameteriv");
1449 if (GetTexParameterivHelper(target, pname, params)) {
1450 return;
1452 typedef cmds::GetTexParameteriv::Result Result;
1453 Result* result = GetResultAs<Result*>();
1454 if (!result) {
1455 return;
1457 result->SetNumResults(0);
1458 helper_->GetTexParameteriv(target, pname, GetResultShmId(),
1459 GetResultShmOffset());
1460 WaitForCmd();
1461 result->CopyResult(params);
1462 GPU_CLIENT_LOG_CODE_BLOCK({
1463 for (int32_t i = 0; i < result->GetNumResults(); ++i) {
1464 GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]);
1467 CheckGLError();
1469 void GLES2Implementation::Hint(GLenum target, GLenum mode) {
1470 GPU_CLIENT_SINGLE_THREAD_CHECK();
1471 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glHint("
1472 << GLES2Util::GetStringHintTarget(target) << ", "
1473 << GLES2Util::GetStringHintMode(mode) << ")");
1474 helper_->Hint(target, mode);
1475 CheckGLError();
1478 void GLES2Implementation::InvalidateFramebuffer(GLenum target,
1479 GLsizei count,
1480 const GLenum* attachments) {
1481 GPU_CLIENT_SINGLE_THREAD_CHECK();
1482 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glInvalidateFramebuffer("
1483 << GLES2Util::GetStringFrameBufferTarget(target) << ", "
1484 << count << ", " << static_cast<const void*>(attachments)
1485 << ")");
1486 GPU_CLIENT_LOG_CODE_BLOCK({
1487 for (GLsizei i = 0; i < count; ++i) {
1488 GPU_CLIENT_LOG(" " << i << ": " << attachments[0 + i * 1]);
1491 if (count < 0) {
1492 SetGLError(GL_INVALID_VALUE, "glInvalidateFramebuffer", "count < 0");
1493 return;
1495 helper_->InvalidateFramebufferImmediate(target, count, attachments);
1496 CheckGLError();
1499 void GLES2Implementation::InvalidateSubFramebuffer(GLenum target,
1500 GLsizei count,
1501 const GLenum* attachments,
1502 GLint x,
1503 GLint y,
1504 GLsizei width,
1505 GLsizei height) {
1506 GPU_CLIENT_SINGLE_THREAD_CHECK();
1507 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glInvalidateSubFramebuffer("
1508 << GLES2Util::GetStringFrameBufferTarget(target) << ", "
1509 << count << ", " << static_cast<const void*>(attachments)
1510 << ", " << x << ", " << y << ", " << width << ", "
1511 << height << ")");
1512 GPU_CLIENT_LOG_CODE_BLOCK({
1513 for (GLsizei i = 0; i < count; ++i) {
1514 GPU_CLIENT_LOG(" " << i << ": " << attachments[0 + i * 1]);
1517 if (count < 0) {
1518 SetGLError(GL_INVALID_VALUE, "glInvalidateSubFramebuffer", "count < 0");
1519 return;
1521 if (width < 0) {
1522 SetGLError(GL_INVALID_VALUE, "glInvalidateSubFramebuffer", "width < 0");
1523 return;
1525 if (height < 0) {
1526 SetGLError(GL_INVALID_VALUE, "glInvalidateSubFramebuffer", "height < 0");
1527 return;
1529 helper_->InvalidateSubFramebufferImmediate(target, count, attachments, x, y,
1530 width, height);
1531 CheckGLError();
1534 GLboolean GLES2Implementation::IsBuffer(GLuint buffer) {
1535 GPU_CLIENT_SINGLE_THREAD_CHECK();
1536 TRACE_EVENT0("gpu", "GLES2Implementation::IsBuffer");
1537 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glIsBuffer(" << buffer << ")");
1538 typedef cmds::IsBuffer::Result Result;
1539 Result* result = GetResultAs<Result*>();
1540 if (!result) {
1541 return GL_FALSE;
1543 *result = 0;
1544 helper_->IsBuffer(buffer, GetResultShmId(), GetResultShmOffset());
1545 WaitForCmd();
1546 GLboolean result_value = *result != 0;
1547 GPU_CLIENT_LOG("returned " << result_value);
1548 CheckGLError();
1549 return result_value;
1552 GLboolean GLES2Implementation::IsFramebuffer(GLuint framebuffer) {
1553 GPU_CLIENT_SINGLE_THREAD_CHECK();
1554 TRACE_EVENT0("gpu", "GLES2Implementation::IsFramebuffer");
1555 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glIsFramebuffer(" << framebuffer
1556 << ")");
1557 typedef cmds::IsFramebuffer::Result Result;
1558 Result* result = GetResultAs<Result*>();
1559 if (!result) {
1560 return GL_FALSE;
1562 *result = 0;
1563 helper_->IsFramebuffer(framebuffer, GetResultShmId(), GetResultShmOffset());
1564 WaitForCmd();
1565 GLboolean result_value = *result != 0;
1566 GPU_CLIENT_LOG("returned " << result_value);
1567 CheckGLError();
1568 return result_value;
1571 GLboolean GLES2Implementation::IsProgram(GLuint program) {
1572 GPU_CLIENT_SINGLE_THREAD_CHECK();
1573 TRACE_EVENT0("gpu", "GLES2Implementation::IsProgram");
1574 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glIsProgram(" << program << ")");
1575 typedef cmds::IsProgram::Result Result;
1576 Result* result = GetResultAs<Result*>();
1577 if (!result) {
1578 return GL_FALSE;
1580 *result = 0;
1581 helper_->IsProgram(program, GetResultShmId(), GetResultShmOffset());
1582 WaitForCmd();
1583 GLboolean result_value = *result != 0;
1584 GPU_CLIENT_LOG("returned " << result_value);
1585 CheckGLError();
1586 return result_value;
1589 GLboolean GLES2Implementation::IsRenderbuffer(GLuint renderbuffer) {
1590 GPU_CLIENT_SINGLE_THREAD_CHECK();
1591 TRACE_EVENT0("gpu", "GLES2Implementation::IsRenderbuffer");
1592 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glIsRenderbuffer(" << renderbuffer
1593 << ")");
1594 typedef cmds::IsRenderbuffer::Result Result;
1595 Result* result = GetResultAs<Result*>();
1596 if (!result) {
1597 return GL_FALSE;
1599 *result = 0;
1600 helper_->IsRenderbuffer(renderbuffer, GetResultShmId(), GetResultShmOffset());
1601 WaitForCmd();
1602 GLboolean result_value = *result != 0;
1603 GPU_CLIENT_LOG("returned " << result_value);
1604 CheckGLError();
1605 return result_value;
1608 GLboolean GLES2Implementation::IsSampler(GLuint sampler) {
1609 GPU_CLIENT_SINGLE_THREAD_CHECK();
1610 TRACE_EVENT0("gpu", "GLES2Implementation::IsSampler");
1611 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glIsSampler(" << sampler << ")");
1612 typedef cmds::IsSampler::Result Result;
1613 Result* result = GetResultAs<Result*>();
1614 if (!result) {
1615 return GL_FALSE;
1617 *result = 0;
1618 helper_->IsSampler(sampler, GetResultShmId(), GetResultShmOffset());
1619 WaitForCmd();
1620 GLboolean result_value = *result != 0;
1621 GPU_CLIENT_LOG("returned " << result_value);
1622 CheckGLError();
1623 return result_value;
1626 GLboolean GLES2Implementation::IsShader(GLuint shader) {
1627 GPU_CLIENT_SINGLE_THREAD_CHECK();
1628 TRACE_EVENT0("gpu", "GLES2Implementation::IsShader");
1629 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glIsShader(" << shader << ")");
1630 typedef cmds::IsShader::Result Result;
1631 Result* result = GetResultAs<Result*>();
1632 if (!result) {
1633 return GL_FALSE;
1635 *result = 0;
1636 helper_->IsShader(shader, GetResultShmId(), GetResultShmOffset());
1637 WaitForCmd();
1638 GLboolean result_value = *result != 0;
1639 GPU_CLIENT_LOG("returned " << result_value);
1640 CheckGLError();
1641 return result_value;
1644 GLboolean GLES2Implementation::IsSync(GLsync sync) {
1645 GPU_CLIENT_SINGLE_THREAD_CHECK();
1646 TRACE_EVENT0("gpu", "GLES2Implementation::IsSync");
1647 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glIsSync(" << sync << ")");
1648 typedef cmds::IsSync::Result Result;
1649 Result* result = GetResultAs<Result*>();
1650 if (!result) {
1651 return GL_FALSE;
1653 *result = 0;
1654 helper_->IsSync(ToGLuint(sync), GetResultShmId(), GetResultShmOffset());
1655 WaitForCmd();
1656 GLboolean result_value = *result != 0;
1657 GPU_CLIENT_LOG("returned " << result_value);
1658 CheckGLError();
1659 return result_value;
1662 GLboolean GLES2Implementation::IsTexture(GLuint texture) {
1663 GPU_CLIENT_SINGLE_THREAD_CHECK();
1664 TRACE_EVENT0("gpu", "GLES2Implementation::IsTexture");
1665 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glIsTexture(" << texture << ")");
1666 typedef cmds::IsTexture::Result Result;
1667 Result* result = GetResultAs<Result*>();
1668 if (!result) {
1669 return GL_FALSE;
1671 *result = 0;
1672 helper_->IsTexture(texture, GetResultShmId(), GetResultShmOffset());
1673 WaitForCmd();
1674 GLboolean result_value = *result != 0;
1675 GPU_CLIENT_LOG("returned " << result_value);
1676 CheckGLError();
1677 return result_value;
1680 GLboolean GLES2Implementation::IsTransformFeedback(GLuint transformfeedback) {
1681 GPU_CLIENT_SINGLE_THREAD_CHECK();
1682 TRACE_EVENT0("gpu", "GLES2Implementation::IsTransformFeedback");
1683 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glIsTransformFeedback("
1684 << transformfeedback << ")");
1685 typedef cmds::IsTransformFeedback::Result Result;
1686 Result* result = GetResultAs<Result*>();
1687 if (!result) {
1688 return GL_FALSE;
1690 *result = 0;
1691 helper_->IsTransformFeedback(transformfeedback, GetResultShmId(),
1692 GetResultShmOffset());
1693 WaitForCmd();
1694 GLboolean result_value = *result != 0;
1695 GPU_CLIENT_LOG("returned " << result_value);
1696 CheckGLError();
1697 return result_value;
1700 void GLES2Implementation::LineWidth(GLfloat width) {
1701 GPU_CLIENT_SINGLE_THREAD_CHECK();
1702 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glLineWidth(" << width << ")");
1703 helper_->LineWidth(width);
1704 CheckGLError();
1707 void GLES2Implementation::PauseTransformFeedback() {
1708 GPU_CLIENT_SINGLE_THREAD_CHECK();
1709 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glPauseTransformFeedback("
1710 << ")");
1711 helper_->PauseTransformFeedback();
1712 CheckGLError();
1715 void GLES2Implementation::PolygonOffset(GLfloat factor, GLfloat units) {
1716 GPU_CLIENT_SINGLE_THREAD_CHECK();
1717 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glPolygonOffset(" << factor << ", "
1718 << units << ")");
1719 helper_->PolygonOffset(factor, units);
1720 CheckGLError();
1723 void GLES2Implementation::ReadBuffer(GLenum src) {
1724 GPU_CLIENT_SINGLE_THREAD_CHECK();
1725 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glReadBuffer("
1726 << GLES2Util::GetStringEnum(src) << ")");
1727 helper_->ReadBuffer(src);
1728 CheckGLError();
1731 void GLES2Implementation::ReleaseShaderCompiler() {
1732 GPU_CLIENT_SINGLE_THREAD_CHECK();
1733 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glReleaseShaderCompiler("
1734 << ")");
1735 helper_->ReleaseShaderCompiler();
1736 CheckGLError();
1739 void GLES2Implementation::RenderbufferStorage(GLenum target,
1740 GLenum internalformat,
1741 GLsizei width,
1742 GLsizei height) {
1743 GPU_CLIENT_SINGLE_THREAD_CHECK();
1744 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glRenderbufferStorage("
1745 << GLES2Util::GetStringRenderBufferTarget(target) << ", "
1746 << GLES2Util::GetStringRenderBufferFormat(internalformat)
1747 << ", " << width << ", " << height << ")");
1748 if (width < 0) {
1749 SetGLError(GL_INVALID_VALUE, "glRenderbufferStorage", "width < 0");
1750 return;
1752 if (height < 0) {
1753 SetGLError(GL_INVALID_VALUE, "glRenderbufferStorage", "height < 0");
1754 return;
1756 helper_->RenderbufferStorage(target, internalformat, width, height);
1757 CheckGLError();
1760 void GLES2Implementation::ResumeTransformFeedback() {
1761 GPU_CLIENT_SINGLE_THREAD_CHECK();
1762 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glResumeTransformFeedback("
1763 << ")");
1764 helper_->ResumeTransformFeedback();
1765 CheckGLError();
1768 void GLES2Implementation::SampleCoverage(GLclampf value, GLboolean invert) {
1769 GPU_CLIENT_SINGLE_THREAD_CHECK();
1770 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glSampleCoverage(" << value << ", "
1771 << GLES2Util::GetStringBool(invert) << ")");
1772 helper_->SampleCoverage(value, invert);
1773 CheckGLError();
1776 void GLES2Implementation::SamplerParameterf(GLuint sampler,
1777 GLenum pname,
1778 GLfloat param) {
1779 GPU_CLIENT_SINGLE_THREAD_CHECK();
1780 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glSamplerParameterf(" << sampler
1781 << ", " << GLES2Util::GetStringSamplerParameter(pname)
1782 << ", " << param << ")");
1783 helper_->SamplerParameterf(sampler, pname, param);
1784 CheckGLError();
1787 void GLES2Implementation::SamplerParameterfv(GLuint sampler,
1788 GLenum pname,
1789 const GLfloat* params) {
1790 GPU_CLIENT_SINGLE_THREAD_CHECK();
1791 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glSamplerParameterfv(" << sampler
1792 << ", " << GLES2Util::GetStringSamplerParameter(pname)
1793 << ", " << static_cast<const void*>(params) << ")");
1794 size_t count = 1;
1795 for (size_t ii = 0; ii < count; ++ii)
1796 GPU_CLIENT_LOG("value[" << ii << "]: " << params[ii]);
1797 helper_->SamplerParameterfvImmediate(sampler, pname, params);
1798 CheckGLError();
1801 void GLES2Implementation::SamplerParameteri(GLuint sampler,
1802 GLenum pname,
1803 GLint param) {
1804 GPU_CLIENT_SINGLE_THREAD_CHECK();
1805 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glSamplerParameteri(" << sampler
1806 << ", " << GLES2Util::GetStringSamplerParameter(pname)
1807 << ", " << param << ")");
1808 helper_->SamplerParameteri(sampler, pname, param);
1809 CheckGLError();
1812 void GLES2Implementation::SamplerParameteriv(GLuint sampler,
1813 GLenum pname,
1814 const GLint* params) {
1815 GPU_CLIENT_SINGLE_THREAD_CHECK();
1816 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glSamplerParameteriv(" << sampler
1817 << ", " << GLES2Util::GetStringSamplerParameter(pname)
1818 << ", " << static_cast<const void*>(params) << ")");
1819 size_t count = 1;
1820 for (size_t ii = 0; ii < count; ++ii)
1821 GPU_CLIENT_LOG("value[" << ii << "]: " << params[ii]);
1822 helper_->SamplerParameterivImmediate(sampler, pname, params);
1823 CheckGLError();
1826 void GLES2Implementation::Scissor(GLint x,
1827 GLint y,
1828 GLsizei width,
1829 GLsizei height) {
1830 GPU_CLIENT_SINGLE_THREAD_CHECK();
1831 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glScissor(" << x << ", " << y
1832 << ", " << width << ", " << height << ")");
1833 if (width < 0) {
1834 SetGLError(GL_INVALID_VALUE, "glScissor", "width < 0");
1835 return;
1837 if (height < 0) {
1838 SetGLError(GL_INVALID_VALUE, "glScissor", "height < 0");
1839 return;
1841 helper_->Scissor(x, y, width, height);
1842 CheckGLError();
1845 void GLES2Implementation::ShaderSource(GLuint shader,
1846 GLsizei count,
1847 const GLchar* const* str,
1848 const GLint* length) {
1849 GPU_CLIENT_SINGLE_THREAD_CHECK();
1850 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glShaderSource(" << shader << ", "
1851 << count << ", " << static_cast<const void*>(str) << ", "
1852 << static_cast<const void*>(length) << ")");
1853 GPU_CLIENT_LOG_CODE_BLOCK({
1854 for (GLsizei ii = 0; ii < count; ++ii) {
1855 if (str[ii]) {
1856 if (length && length[ii] >= 0) {
1857 const std::string my_str(str[ii], length[ii]);
1858 GPU_CLIENT_LOG(" " << ii << ": ---\n" << my_str << "\n---");
1859 } else {
1860 GPU_CLIENT_LOG(" " << ii << ": ---\n" << str[ii] << "\n---");
1862 } else {
1863 GPU_CLIENT_LOG(" " << ii << ": NULL");
1867 if (count < 0) {
1868 SetGLError(GL_INVALID_VALUE, "glShaderSource", "count < 0");
1869 return;
1872 if (!PackStringsToBucket(count, str, length, "glShaderSource")) {
1873 return;
1875 helper_->ShaderSourceBucket(shader, kResultBucketId);
1876 helper_->SetBucketSize(kResultBucketId, 0);
1877 CheckGLError();
1880 void GLES2Implementation::StencilFunc(GLenum func, GLint ref, GLuint mask) {
1881 GPU_CLIENT_SINGLE_THREAD_CHECK();
1882 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glStencilFunc("
1883 << GLES2Util::GetStringCmpFunction(func) << ", " << ref
1884 << ", " << mask << ")");
1885 helper_->StencilFunc(func, ref, mask);
1886 CheckGLError();
1889 void GLES2Implementation::StencilFuncSeparate(GLenum face,
1890 GLenum func,
1891 GLint ref,
1892 GLuint mask) {
1893 GPU_CLIENT_SINGLE_THREAD_CHECK();
1894 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glStencilFuncSeparate("
1895 << GLES2Util::GetStringFaceType(face) << ", "
1896 << GLES2Util::GetStringCmpFunction(func) << ", " << ref
1897 << ", " << mask << ")");
1898 helper_->StencilFuncSeparate(face, func, ref, mask);
1899 CheckGLError();
1902 void GLES2Implementation::StencilMask(GLuint mask) {
1903 GPU_CLIENT_SINGLE_THREAD_CHECK();
1904 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glStencilMask(" << mask << ")");
1905 helper_->StencilMask(mask);
1906 CheckGLError();
1909 void GLES2Implementation::StencilMaskSeparate(GLenum face, GLuint mask) {
1910 GPU_CLIENT_SINGLE_THREAD_CHECK();
1911 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glStencilMaskSeparate("
1912 << GLES2Util::GetStringFaceType(face) << ", " << mask
1913 << ")");
1914 helper_->StencilMaskSeparate(face, mask);
1915 CheckGLError();
1918 void GLES2Implementation::StencilOp(GLenum fail, GLenum zfail, GLenum zpass) {
1919 GPU_CLIENT_SINGLE_THREAD_CHECK();
1920 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glStencilOp("
1921 << GLES2Util::GetStringStencilOp(fail) << ", "
1922 << GLES2Util::GetStringStencilOp(zfail) << ", "
1923 << GLES2Util::GetStringStencilOp(zpass) << ")");
1924 helper_->StencilOp(fail, zfail, zpass);
1925 CheckGLError();
1928 void GLES2Implementation::StencilOpSeparate(GLenum face,
1929 GLenum fail,
1930 GLenum zfail,
1931 GLenum zpass) {
1932 GPU_CLIENT_SINGLE_THREAD_CHECK();
1933 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glStencilOpSeparate("
1934 << GLES2Util::GetStringFaceType(face) << ", "
1935 << GLES2Util::GetStringStencilOp(fail) << ", "
1936 << GLES2Util::GetStringStencilOp(zfail) << ", "
1937 << GLES2Util::GetStringStencilOp(zpass) << ")");
1938 helper_->StencilOpSeparate(face, fail, zfail, zpass);
1939 CheckGLError();
1942 void GLES2Implementation::TexParameterf(GLenum target,
1943 GLenum pname,
1944 GLfloat param) {
1945 GPU_CLIENT_SINGLE_THREAD_CHECK();
1946 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glTexParameterf("
1947 << GLES2Util::GetStringTextureBindTarget(target) << ", "
1948 << GLES2Util::GetStringTextureParameter(pname) << ", "
1949 << param << ")");
1950 helper_->TexParameterf(target, pname, param);
1951 CheckGLError();
1954 void GLES2Implementation::TexParameterfv(GLenum target,
1955 GLenum pname,
1956 const GLfloat* params) {
1957 GPU_CLIENT_SINGLE_THREAD_CHECK();
1958 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glTexParameterfv("
1959 << GLES2Util::GetStringTextureBindTarget(target) << ", "
1960 << GLES2Util::GetStringTextureParameter(pname) << ", "
1961 << static_cast<const void*>(params) << ")");
1962 size_t count = 1;
1963 for (size_t ii = 0; ii < count; ++ii)
1964 GPU_CLIENT_LOG("value[" << ii << "]: " << params[ii]);
1965 helper_->TexParameterfvImmediate(target, pname, params);
1966 CheckGLError();
1969 void GLES2Implementation::TexParameteri(GLenum target,
1970 GLenum pname,
1971 GLint param) {
1972 GPU_CLIENT_SINGLE_THREAD_CHECK();
1973 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glTexParameteri("
1974 << GLES2Util::GetStringTextureBindTarget(target) << ", "
1975 << GLES2Util::GetStringTextureParameter(pname) << ", "
1976 << param << ")");
1977 helper_->TexParameteri(target, pname, param);
1978 CheckGLError();
1981 void GLES2Implementation::TexParameteriv(GLenum target,
1982 GLenum pname,
1983 const GLint* params) {
1984 GPU_CLIENT_SINGLE_THREAD_CHECK();
1985 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glTexParameteriv("
1986 << GLES2Util::GetStringTextureBindTarget(target) << ", "
1987 << GLES2Util::GetStringTextureParameter(pname) << ", "
1988 << static_cast<const void*>(params) << ")");
1989 size_t count = 1;
1990 for (size_t ii = 0; ii < count; ++ii)
1991 GPU_CLIENT_LOG("value[" << ii << "]: " << params[ii]);
1992 helper_->TexParameterivImmediate(target, pname, params);
1993 CheckGLError();
1996 void GLES2Implementation::TexStorage3D(GLenum target,
1997 GLsizei levels,
1998 GLenum internalFormat,
1999 GLsizei width,
2000 GLsizei height,
2001 GLsizei depth) {
2002 GPU_CLIENT_SINGLE_THREAD_CHECK();
2003 GPU_CLIENT_LOG(
2004 "[" << GetLogPrefix() << "] glTexStorage3D("
2005 << GLES2Util::GetStringTexture3DTarget(target) << ", " << levels
2006 << ", "
2007 << GLES2Util::GetStringTextureInternalFormatStorage(internalFormat)
2008 << ", " << width << ", " << height << ", " << depth << ")");
2009 if (levels < 0) {
2010 SetGLError(GL_INVALID_VALUE, "glTexStorage3D", "levels < 0");
2011 return;
2013 if (width < 0) {
2014 SetGLError(GL_INVALID_VALUE, "glTexStorage3D", "width < 0");
2015 return;
2017 if (height < 0) {
2018 SetGLError(GL_INVALID_VALUE, "glTexStorage3D", "height < 0");
2019 return;
2021 if (depth < 0) {
2022 SetGLError(GL_INVALID_VALUE, "glTexStorage3D", "depth < 0");
2023 return;
2025 helper_->TexStorage3D(target, levels, internalFormat, width, height, depth);
2026 CheckGLError();
2029 void GLES2Implementation::TransformFeedbackVaryings(GLuint program,
2030 GLsizei count,
2031 const char* const* varyings,
2032 GLenum buffermode) {
2033 GPU_CLIENT_SINGLE_THREAD_CHECK();
2034 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glTransformFeedbackVaryings("
2035 << program << ", " << count << ", "
2036 << static_cast<const void*>(varyings) << ", "
2037 << GLES2Util::GetStringBufferMode(buffermode) << ")");
2038 GPU_CLIENT_LOG_CODE_BLOCK({
2039 for (GLsizei ii = 0; ii < count; ++ii) {
2040 if (varyings[ii]) {
2041 GPU_CLIENT_LOG(" " << ii << ": ---\n" << varyings[ii] << "\n---");
2042 } else {
2043 GPU_CLIENT_LOG(" " << ii << ": NULL");
2047 if (count < 0) {
2048 SetGLError(GL_INVALID_VALUE, "glTransformFeedbackVaryings", "count < 0");
2049 return;
2052 if (!PackStringsToBucket(count, varyings, NULL,
2053 "glTransformFeedbackVaryings")) {
2054 return;
2056 helper_->TransformFeedbackVaryingsBucket(program, kResultBucketId,
2057 buffermode);
2058 helper_->SetBucketSize(kResultBucketId, 0);
2059 CheckGLError();
2062 void GLES2Implementation::Uniform1f(GLint location, GLfloat x) {
2063 GPU_CLIENT_SINGLE_THREAD_CHECK();
2064 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform1f(" << location << ", "
2065 << x << ")");
2066 helper_->Uniform1f(location, x);
2067 CheckGLError();
2070 void GLES2Implementation::Uniform1fv(GLint location,
2071 GLsizei count,
2072 const GLfloat* v) {
2073 GPU_CLIENT_SINGLE_THREAD_CHECK();
2074 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform1fv(" << 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 * 1]);
2081 if (count < 0) {
2082 SetGLError(GL_INVALID_VALUE, "glUniform1fv", "count < 0");
2083 return;
2085 helper_->Uniform1fvImmediate(location, count, v);
2086 CheckGLError();
2089 void GLES2Implementation::Uniform1i(GLint location, GLint x) {
2090 GPU_CLIENT_SINGLE_THREAD_CHECK();
2091 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform1i(" << location << ", "
2092 << x << ")");
2093 helper_->Uniform1i(location, x);
2094 CheckGLError();
2097 void GLES2Implementation::Uniform1iv(GLint location,
2098 GLsizei count,
2099 const GLint* v) {
2100 GPU_CLIENT_SINGLE_THREAD_CHECK();
2101 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform1iv(" << 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 * 1]);
2108 if (count < 0) {
2109 SetGLError(GL_INVALID_VALUE, "glUniform1iv", "count < 0");
2110 return;
2112 helper_->Uniform1ivImmediate(location, count, v);
2113 CheckGLError();
2116 void GLES2Implementation::Uniform1ui(GLint location, GLuint x) {
2117 GPU_CLIENT_SINGLE_THREAD_CHECK();
2118 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform1ui(" << location << ", "
2119 << x << ")");
2120 helper_->Uniform1ui(location, x);
2121 CheckGLError();
2124 void GLES2Implementation::Uniform1uiv(GLint location,
2125 GLsizei count,
2126 const GLuint* v) {
2127 GPU_CLIENT_SINGLE_THREAD_CHECK();
2128 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform1uiv(" << 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 * 1]);
2135 if (count < 0) {
2136 SetGLError(GL_INVALID_VALUE, "glUniform1uiv", "count < 0");
2137 return;
2139 helper_->Uniform1uivImmediate(location, count, v);
2140 CheckGLError();
2143 void GLES2Implementation::Uniform2f(GLint location, GLfloat x, GLfloat y) {
2144 GPU_CLIENT_SINGLE_THREAD_CHECK();
2145 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform2f(" << location << ", "
2146 << x << ", " << y << ")");
2147 helper_->Uniform2f(location, x, y);
2148 CheckGLError();
2151 void GLES2Implementation::Uniform2fv(GLint location,
2152 GLsizei count,
2153 const GLfloat* v) {
2154 GPU_CLIENT_SINGLE_THREAD_CHECK();
2155 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform2fv(" << location << ", "
2156 << count << ", " << static_cast<const void*>(v) << ")");
2157 GPU_CLIENT_LOG_CODE_BLOCK({
2158 for (GLsizei i = 0; i < count; ++i) {
2159 GPU_CLIENT_LOG(" " << i << ": " << v[0 + i * 2] << ", " << v[1 + i * 2]);
2162 if (count < 0) {
2163 SetGLError(GL_INVALID_VALUE, "glUniform2fv", "count < 0");
2164 return;
2166 helper_->Uniform2fvImmediate(location, count, v);
2167 CheckGLError();
2170 void GLES2Implementation::Uniform2i(GLint location, GLint x, GLint y) {
2171 GPU_CLIENT_SINGLE_THREAD_CHECK();
2172 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform2i(" << location << ", "
2173 << x << ", " << y << ")");
2174 helper_->Uniform2i(location, x, y);
2175 CheckGLError();
2178 void GLES2Implementation::Uniform2iv(GLint location,
2179 GLsizei count,
2180 const GLint* v) {
2181 GPU_CLIENT_SINGLE_THREAD_CHECK();
2182 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform2iv(" << location << ", "
2183 << count << ", " << static_cast<const void*>(v) << ")");
2184 GPU_CLIENT_LOG_CODE_BLOCK({
2185 for (GLsizei i = 0; i < count; ++i) {
2186 GPU_CLIENT_LOG(" " << i << ": " << v[0 + i * 2] << ", " << v[1 + i * 2]);
2189 if (count < 0) {
2190 SetGLError(GL_INVALID_VALUE, "glUniform2iv", "count < 0");
2191 return;
2193 helper_->Uniform2ivImmediate(location, count, v);
2194 CheckGLError();
2197 void GLES2Implementation::Uniform2ui(GLint location, GLuint x, GLuint y) {
2198 GPU_CLIENT_SINGLE_THREAD_CHECK();
2199 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform2ui(" << location << ", "
2200 << x << ", " << y << ")");
2201 helper_->Uniform2ui(location, x, y);
2202 CheckGLError();
2205 void GLES2Implementation::Uniform2uiv(GLint location,
2206 GLsizei count,
2207 const GLuint* v) {
2208 GPU_CLIENT_SINGLE_THREAD_CHECK();
2209 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform2uiv(" << location << ", "
2210 << count << ", " << static_cast<const void*>(v) << ")");
2211 GPU_CLIENT_LOG_CODE_BLOCK({
2212 for (GLsizei i = 0; i < count; ++i) {
2213 GPU_CLIENT_LOG(" " << i << ": " << v[0 + i * 2] << ", " << v[1 + i * 2]);
2216 if (count < 0) {
2217 SetGLError(GL_INVALID_VALUE, "glUniform2uiv", "count < 0");
2218 return;
2220 helper_->Uniform2uivImmediate(location, count, v);
2221 CheckGLError();
2224 void GLES2Implementation::Uniform3f(GLint location,
2225 GLfloat x,
2226 GLfloat y,
2227 GLfloat z) {
2228 GPU_CLIENT_SINGLE_THREAD_CHECK();
2229 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform3f(" << location << ", "
2230 << x << ", " << y << ", " << z << ")");
2231 helper_->Uniform3f(location, x, y, z);
2232 CheckGLError();
2235 void GLES2Implementation::Uniform3fv(GLint location,
2236 GLsizei count,
2237 const GLfloat* v) {
2238 GPU_CLIENT_SINGLE_THREAD_CHECK();
2239 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform3fv(" << location << ", "
2240 << count << ", " << static_cast<const void*>(v) << ")");
2241 GPU_CLIENT_LOG_CODE_BLOCK({
2242 for (GLsizei i = 0; i < count; ++i) {
2243 GPU_CLIENT_LOG(" " << i << ": " << v[0 + i * 3] << ", " << v[1 + i * 3]
2244 << ", " << v[2 + i * 3]);
2247 if (count < 0) {
2248 SetGLError(GL_INVALID_VALUE, "glUniform3fv", "count < 0");
2249 return;
2251 helper_->Uniform3fvImmediate(location, count, v);
2252 CheckGLError();
2255 void GLES2Implementation::Uniform3i(GLint location, GLint x, GLint y, GLint z) {
2256 GPU_CLIENT_SINGLE_THREAD_CHECK();
2257 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform3i(" << location << ", "
2258 << x << ", " << y << ", " << z << ")");
2259 helper_->Uniform3i(location, x, y, z);
2260 CheckGLError();
2263 void GLES2Implementation::Uniform3iv(GLint location,
2264 GLsizei count,
2265 const GLint* v) {
2266 GPU_CLIENT_SINGLE_THREAD_CHECK();
2267 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform3iv(" << location << ", "
2268 << count << ", " << static_cast<const void*>(v) << ")");
2269 GPU_CLIENT_LOG_CODE_BLOCK({
2270 for (GLsizei i = 0; i < count; ++i) {
2271 GPU_CLIENT_LOG(" " << i << ": " << v[0 + i * 3] << ", " << v[1 + i * 3]
2272 << ", " << v[2 + i * 3]);
2275 if (count < 0) {
2276 SetGLError(GL_INVALID_VALUE, "glUniform3iv", "count < 0");
2277 return;
2279 helper_->Uniform3ivImmediate(location, count, v);
2280 CheckGLError();
2283 void GLES2Implementation::Uniform3ui(GLint location,
2284 GLuint x,
2285 GLuint y,
2286 GLuint z) {
2287 GPU_CLIENT_SINGLE_THREAD_CHECK();
2288 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform3ui(" << location << ", "
2289 << x << ", " << y << ", " << z << ")");
2290 helper_->Uniform3ui(location, x, y, z);
2291 CheckGLError();
2294 void GLES2Implementation::Uniform3uiv(GLint location,
2295 GLsizei count,
2296 const GLuint* v) {
2297 GPU_CLIENT_SINGLE_THREAD_CHECK();
2298 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform3uiv(" << location << ", "
2299 << count << ", " << static_cast<const void*>(v) << ")");
2300 GPU_CLIENT_LOG_CODE_BLOCK({
2301 for (GLsizei i = 0; i < count; ++i) {
2302 GPU_CLIENT_LOG(" " << i << ": " << v[0 + i * 3] << ", " << v[1 + i * 3]
2303 << ", " << v[2 + i * 3]);
2306 if (count < 0) {
2307 SetGLError(GL_INVALID_VALUE, "glUniform3uiv", "count < 0");
2308 return;
2310 helper_->Uniform3uivImmediate(location, count, v);
2311 CheckGLError();
2314 void GLES2Implementation::Uniform4f(GLint location,
2315 GLfloat x,
2316 GLfloat y,
2317 GLfloat z,
2318 GLfloat w) {
2319 GPU_CLIENT_SINGLE_THREAD_CHECK();
2320 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform4f(" << location << ", "
2321 << x << ", " << y << ", " << z << ", " << w << ")");
2322 helper_->Uniform4f(location, x, y, z, w);
2323 CheckGLError();
2326 void GLES2Implementation::Uniform4fv(GLint location,
2327 GLsizei count,
2328 const GLfloat* v) {
2329 GPU_CLIENT_SINGLE_THREAD_CHECK();
2330 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform4fv(" << location << ", "
2331 << count << ", " << static_cast<const void*>(v) << ")");
2332 GPU_CLIENT_LOG_CODE_BLOCK({
2333 for (GLsizei i = 0; i < count; ++i) {
2334 GPU_CLIENT_LOG(" " << i << ": " << v[0 + i * 4] << ", " << v[1 + i * 4]
2335 << ", " << v[2 + i * 4] << ", " << v[3 + i * 4]);
2338 if (count < 0) {
2339 SetGLError(GL_INVALID_VALUE, "glUniform4fv", "count < 0");
2340 return;
2342 helper_->Uniform4fvImmediate(location, count, v);
2343 CheckGLError();
2346 void GLES2Implementation::Uniform4i(GLint location,
2347 GLint x,
2348 GLint y,
2349 GLint z,
2350 GLint w) {
2351 GPU_CLIENT_SINGLE_THREAD_CHECK();
2352 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform4i(" << location << ", "
2353 << x << ", " << y << ", " << z << ", " << w << ")");
2354 helper_->Uniform4i(location, x, y, z, w);
2355 CheckGLError();
2358 void GLES2Implementation::Uniform4iv(GLint location,
2359 GLsizei count,
2360 const GLint* v) {
2361 GPU_CLIENT_SINGLE_THREAD_CHECK();
2362 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform4iv(" << location << ", "
2363 << count << ", " << static_cast<const void*>(v) << ")");
2364 GPU_CLIENT_LOG_CODE_BLOCK({
2365 for (GLsizei i = 0; i < count; ++i) {
2366 GPU_CLIENT_LOG(" " << i << ": " << v[0 + i * 4] << ", " << v[1 + i * 4]
2367 << ", " << v[2 + i * 4] << ", " << v[3 + i * 4]);
2370 if (count < 0) {
2371 SetGLError(GL_INVALID_VALUE, "glUniform4iv", "count < 0");
2372 return;
2374 helper_->Uniform4ivImmediate(location, count, v);
2375 CheckGLError();
2378 void GLES2Implementation::Uniform4ui(GLint location,
2379 GLuint x,
2380 GLuint y,
2381 GLuint z,
2382 GLuint w) {
2383 GPU_CLIENT_SINGLE_THREAD_CHECK();
2384 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform4ui(" << location << ", "
2385 << x << ", " << y << ", " << z << ", " << w << ")");
2386 helper_->Uniform4ui(location, x, y, z, w);
2387 CheckGLError();
2390 void GLES2Implementation::Uniform4uiv(GLint location,
2391 GLsizei count,
2392 const GLuint* v) {
2393 GPU_CLIENT_SINGLE_THREAD_CHECK();
2394 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform4uiv(" << location << ", "
2395 << count << ", " << static_cast<const void*>(v) << ")");
2396 GPU_CLIENT_LOG_CODE_BLOCK({
2397 for (GLsizei i = 0; i < count; ++i) {
2398 GPU_CLIENT_LOG(" " << i << ": " << v[0 + i * 4] << ", " << v[1 + i * 4]
2399 << ", " << v[2 + i * 4] << ", " << v[3 + i * 4]);
2402 if (count < 0) {
2403 SetGLError(GL_INVALID_VALUE, "glUniform4uiv", "count < 0");
2404 return;
2406 helper_->Uniform4uivImmediate(location, count, v);
2407 CheckGLError();
2410 void GLES2Implementation::UniformMatrix2fv(GLint location,
2411 GLsizei count,
2412 GLboolean transpose,
2413 const GLfloat* value) {
2414 GPU_CLIENT_SINGLE_THREAD_CHECK();
2415 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniformMatrix2fv(" << location
2416 << ", " << count << ", "
2417 << GLES2Util::GetStringBool(transpose) << ", "
2418 << static_cast<const void*>(value) << ")");
2419 GPU_CLIENT_LOG_CODE_BLOCK({
2420 for (GLsizei i = 0; i < count; ++i) {
2421 GPU_CLIENT_LOG(" " << i << ": " << value[0 + i * 4] << ", "
2422 << value[1 + i * 4] << ", " << value[2 + i * 4]
2423 << ", " << value[3 + i * 4]);
2426 if (count < 0) {
2427 SetGLError(GL_INVALID_VALUE, "glUniformMatrix2fv", "count < 0");
2428 return;
2430 if (transpose != false) {
2431 SetGLError(GL_INVALID_VALUE, "glUniformMatrix2fv",
2432 "transpose GL_INVALID_VALUE");
2433 return;
2435 helper_->UniformMatrix2fvImmediate(location, count, value);
2436 CheckGLError();
2439 void GLES2Implementation::UniformMatrix2x3fv(GLint location,
2440 GLsizei count,
2441 GLboolean transpose,
2442 const GLfloat* value) {
2443 GPU_CLIENT_SINGLE_THREAD_CHECK();
2444 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniformMatrix2x3fv(" << location
2445 << ", " << count << ", "
2446 << GLES2Util::GetStringBool(transpose) << ", "
2447 << static_cast<const void*>(value) << ")");
2448 GPU_CLIENT_LOG_CODE_BLOCK({
2449 for (GLsizei i = 0; i < count; ++i) {
2450 GPU_CLIENT_LOG(" " << i << ": " << value[0 + i * 6] << ", "
2451 << value[1 + i * 6] << ", " << value[2 + i * 6]
2452 << ", " << value[3 + i * 6] << ", "
2453 << value[4 + i * 6] << ", " << value[5 + i * 6]);
2456 if (count < 0) {
2457 SetGLError(GL_INVALID_VALUE, "glUniformMatrix2x3fv", "count < 0");
2458 return;
2460 if (transpose != false) {
2461 SetGLError(GL_INVALID_VALUE, "glUniformMatrix2x3fv",
2462 "transpose GL_INVALID_VALUE");
2463 return;
2465 helper_->UniformMatrix2x3fvImmediate(location, count, value);
2466 CheckGLError();
2469 void GLES2Implementation::UniformMatrix2x4fv(GLint location,
2470 GLsizei count,
2471 GLboolean transpose,
2472 const GLfloat* value) {
2473 GPU_CLIENT_SINGLE_THREAD_CHECK();
2474 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniformMatrix2x4fv(" << location
2475 << ", " << count << ", "
2476 << GLES2Util::GetStringBool(transpose) << ", "
2477 << static_cast<const void*>(value) << ")");
2478 GPU_CLIENT_LOG_CODE_BLOCK({
2479 for (GLsizei i = 0; i < count; ++i) {
2480 GPU_CLIENT_LOG(
2481 " " << i << ": " << value[0 + i * 8] << ", " << value[1 + i * 8]
2482 << ", " << value[2 + i * 8] << ", " << value[3 + i * 8] << ", "
2483 << value[4 + i * 8] << ", " << value[5 + i * 8] << ", "
2484 << value[6 + i * 8] << ", " << value[7 + i * 8]);
2487 if (count < 0) {
2488 SetGLError(GL_INVALID_VALUE, "glUniformMatrix2x4fv", "count < 0");
2489 return;
2491 if (transpose != false) {
2492 SetGLError(GL_INVALID_VALUE, "glUniformMatrix2x4fv",
2493 "transpose GL_INVALID_VALUE");
2494 return;
2496 helper_->UniformMatrix2x4fvImmediate(location, count, value);
2497 CheckGLError();
2500 void GLES2Implementation::UniformMatrix3fv(GLint location,
2501 GLsizei count,
2502 GLboolean transpose,
2503 const GLfloat* value) {
2504 GPU_CLIENT_SINGLE_THREAD_CHECK();
2505 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniformMatrix3fv(" << location
2506 << ", " << count << ", "
2507 << GLES2Util::GetStringBool(transpose) << ", "
2508 << static_cast<const void*>(value) << ")");
2509 GPU_CLIENT_LOG_CODE_BLOCK({
2510 for (GLsizei i = 0; i < count; ++i) {
2511 GPU_CLIENT_LOG(" " << i << ": " << value[0 + i * 9] << ", "
2512 << value[1 + i * 9] << ", " << value[2 + i * 9]
2513 << ", " << value[3 + i * 9] << ", "
2514 << value[4 + i * 9] << ", " << value[5 + i * 9]
2515 << ", " << value[6 + i * 9] << ", "
2516 << value[7 + i * 9] << ", " << value[8 + i * 9]);
2519 if (count < 0) {
2520 SetGLError(GL_INVALID_VALUE, "glUniformMatrix3fv", "count < 0");
2521 return;
2523 if (transpose != false) {
2524 SetGLError(GL_INVALID_VALUE, "glUniformMatrix3fv",
2525 "transpose GL_INVALID_VALUE");
2526 return;
2528 helper_->UniformMatrix3fvImmediate(location, count, value);
2529 CheckGLError();
2532 void GLES2Implementation::UniformMatrix3x2fv(GLint location,
2533 GLsizei count,
2534 GLboolean transpose,
2535 const GLfloat* value) {
2536 GPU_CLIENT_SINGLE_THREAD_CHECK();
2537 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniformMatrix3x2fv(" << location
2538 << ", " << count << ", "
2539 << GLES2Util::GetStringBool(transpose) << ", "
2540 << static_cast<const void*>(value) << ")");
2541 GPU_CLIENT_LOG_CODE_BLOCK({
2542 for (GLsizei i = 0; i < count; ++i) {
2543 GPU_CLIENT_LOG(" " << i << ": " << value[0 + i * 6] << ", "
2544 << value[1 + i * 6] << ", " << value[2 + i * 6]
2545 << ", " << value[3 + i * 6] << ", "
2546 << value[4 + i * 6] << ", " << value[5 + i * 6]);
2549 if (count < 0) {
2550 SetGLError(GL_INVALID_VALUE, "glUniformMatrix3x2fv", "count < 0");
2551 return;
2553 if (transpose != false) {
2554 SetGLError(GL_INVALID_VALUE, "glUniformMatrix3x2fv",
2555 "transpose GL_INVALID_VALUE");
2556 return;
2558 helper_->UniformMatrix3x2fvImmediate(location, count, value);
2559 CheckGLError();
2562 void GLES2Implementation::UniformMatrix3x4fv(GLint location,
2563 GLsizei count,
2564 GLboolean transpose,
2565 const GLfloat* value) {
2566 GPU_CLIENT_SINGLE_THREAD_CHECK();
2567 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniformMatrix3x4fv(" << location
2568 << ", " << count << ", "
2569 << GLES2Util::GetStringBool(transpose) << ", "
2570 << static_cast<const void*>(value) << ")");
2571 GPU_CLIENT_LOG_CODE_BLOCK({
2572 for (GLsizei i = 0; i < count; ++i) {
2573 GPU_CLIENT_LOG(
2574 " " << i << ": " << value[0 + i * 12] << ", " << value[1 + i * 12]
2575 << ", " << value[2 + i * 12] << ", " << value[3 + i * 12] << ", "
2576 << value[4 + i * 12] << ", " << value[5 + i * 12] << ", "
2577 << value[6 + i * 12] << ", " << value[7 + i * 12] << ", "
2578 << value[8 + i * 12] << ", " << value[9 + i * 12] << ", "
2579 << value[10 + i * 12] << ", " << value[11 + i * 12]);
2582 if (count < 0) {
2583 SetGLError(GL_INVALID_VALUE, "glUniformMatrix3x4fv", "count < 0");
2584 return;
2586 if (transpose != false) {
2587 SetGLError(GL_INVALID_VALUE, "glUniformMatrix3x4fv",
2588 "transpose GL_INVALID_VALUE");
2589 return;
2591 helper_->UniformMatrix3x4fvImmediate(location, count, value);
2592 CheckGLError();
2595 void GLES2Implementation::UniformMatrix4fv(GLint location,
2596 GLsizei count,
2597 GLboolean transpose,
2598 const GLfloat* value) {
2599 GPU_CLIENT_SINGLE_THREAD_CHECK();
2600 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniformMatrix4fv(" << location
2601 << ", " << count << ", "
2602 << GLES2Util::GetStringBool(transpose) << ", "
2603 << static_cast<const void*>(value) << ")");
2604 GPU_CLIENT_LOG_CODE_BLOCK({
2605 for (GLsizei i = 0; i < count; ++i) {
2606 GPU_CLIENT_LOG(
2607 " " << i << ": " << value[0 + i * 16] << ", " << value[1 + i * 16]
2608 << ", " << value[2 + i * 16] << ", " << value[3 + i * 16] << ", "
2609 << value[4 + i * 16] << ", " << value[5 + i * 16] << ", "
2610 << value[6 + i * 16] << ", " << value[7 + i * 16] << ", "
2611 << value[8 + i * 16] << ", " << value[9 + i * 16] << ", "
2612 << value[10 + i * 16] << ", " << value[11 + i * 16] << ", "
2613 << value[12 + i * 16] << ", " << value[13 + i * 16] << ", "
2614 << value[14 + i * 16] << ", " << value[15 + i * 16]);
2617 if (count < 0) {
2618 SetGLError(GL_INVALID_VALUE, "glUniformMatrix4fv", "count < 0");
2619 return;
2621 if (transpose != false) {
2622 SetGLError(GL_INVALID_VALUE, "glUniformMatrix4fv",
2623 "transpose GL_INVALID_VALUE");
2624 return;
2626 helper_->UniformMatrix4fvImmediate(location, count, value);
2627 CheckGLError();
2630 void GLES2Implementation::UniformMatrix4x2fv(GLint location,
2631 GLsizei count,
2632 GLboolean transpose,
2633 const GLfloat* value) {
2634 GPU_CLIENT_SINGLE_THREAD_CHECK();
2635 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniformMatrix4x2fv(" << location
2636 << ", " << count << ", "
2637 << GLES2Util::GetStringBool(transpose) << ", "
2638 << static_cast<const void*>(value) << ")");
2639 GPU_CLIENT_LOG_CODE_BLOCK({
2640 for (GLsizei i = 0; i < count; ++i) {
2641 GPU_CLIENT_LOG(
2642 " " << i << ": " << value[0 + i * 8] << ", " << value[1 + i * 8]
2643 << ", " << value[2 + i * 8] << ", " << value[3 + i * 8] << ", "
2644 << value[4 + i * 8] << ", " << value[5 + i * 8] << ", "
2645 << value[6 + i * 8] << ", " << value[7 + i * 8]);
2648 if (count < 0) {
2649 SetGLError(GL_INVALID_VALUE, "glUniformMatrix4x2fv", "count < 0");
2650 return;
2652 if (transpose != false) {
2653 SetGLError(GL_INVALID_VALUE, "glUniformMatrix4x2fv",
2654 "transpose GL_INVALID_VALUE");
2655 return;
2657 helper_->UniformMatrix4x2fvImmediate(location, count, value);
2658 CheckGLError();
2661 void GLES2Implementation::UniformMatrix4x3fv(GLint location,
2662 GLsizei count,
2663 GLboolean transpose,
2664 const GLfloat* value) {
2665 GPU_CLIENT_SINGLE_THREAD_CHECK();
2666 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniformMatrix4x3fv(" << location
2667 << ", " << count << ", "
2668 << GLES2Util::GetStringBool(transpose) << ", "
2669 << static_cast<const void*>(value) << ")");
2670 GPU_CLIENT_LOG_CODE_BLOCK({
2671 for (GLsizei i = 0; i < count; ++i) {
2672 GPU_CLIENT_LOG(
2673 " " << i << ": " << value[0 + i * 12] << ", " << value[1 + i * 12]
2674 << ", " << value[2 + i * 12] << ", " << value[3 + i * 12] << ", "
2675 << value[4 + i * 12] << ", " << value[5 + i * 12] << ", "
2676 << value[6 + i * 12] << ", " << value[7 + i * 12] << ", "
2677 << value[8 + i * 12] << ", " << value[9 + i * 12] << ", "
2678 << value[10 + i * 12] << ", " << value[11 + i * 12]);
2681 if (count < 0) {
2682 SetGLError(GL_INVALID_VALUE, "glUniformMatrix4x3fv", "count < 0");
2683 return;
2685 if (transpose != false) {
2686 SetGLError(GL_INVALID_VALUE, "glUniformMatrix4x3fv",
2687 "transpose GL_INVALID_VALUE");
2688 return;
2690 helper_->UniformMatrix4x3fvImmediate(location, count, value);
2691 CheckGLError();
2694 void GLES2Implementation::UseProgram(GLuint program) {
2695 GPU_CLIENT_SINGLE_THREAD_CHECK();
2696 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUseProgram(" << program << ")");
2697 if (IsProgramReservedId(program)) {
2698 SetGLError(GL_INVALID_OPERATION, "UseProgram", "program reserved id");
2699 return;
2701 UseProgramHelper(program);
2702 CheckGLError();
2705 void GLES2Implementation::ValidateProgram(GLuint program) {
2706 GPU_CLIENT_SINGLE_THREAD_CHECK();
2707 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glValidateProgram(" << program
2708 << ")");
2709 helper_->ValidateProgram(program);
2710 CheckGLError();
2713 void GLES2Implementation::VertexAttrib1f(GLuint indx, GLfloat x) {
2714 GPU_CLIENT_SINGLE_THREAD_CHECK();
2715 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glVertexAttrib1f(" << indx << ", "
2716 << x << ")");
2717 helper_->VertexAttrib1f(indx, x);
2718 CheckGLError();
2721 void GLES2Implementation::VertexAttrib1fv(GLuint indx, const GLfloat* values) {
2722 GPU_CLIENT_SINGLE_THREAD_CHECK();
2723 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glVertexAttrib1fv(" << indx << ", "
2724 << static_cast<const void*>(values) << ")");
2725 size_t count = 1;
2726 for (size_t ii = 0; ii < count; ++ii)
2727 GPU_CLIENT_LOG("value[" << ii << "]: " << values[ii]);
2728 helper_->VertexAttrib1fvImmediate(indx, values);
2729 CheckGLError();
2732 void GLES2Implementation::VertexAttrib2f(GLuint indx, GLfloat x, GLfloat y) {
2733 GPU_CLIENT_SINGLE_THREAD_CHECK();
2734 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glVertexAttrib2f(" << indx << ", "
2735 << x << ", " << y << ")");
2736 helper_->VertexAttrib2f(indx, x, y);
2737 CheckGLError();
2740 void GLES2Implementation::VertexAttrib2fv(GLuint indx, const GLfloat* values) {
2741 GPU_CLIENT_SINGLE_THREAD_CHECK();
2742 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glVertexAttrib2fv(" << indx << ", "
2743 << static_cast<const void*>(values) << ")");
2744 size_t count = 2;
2745 for (size_t ii = 0; ii < count; ++ii)
2746 GPU_CLIENT_LOG("value[" << ii << "]: " << values[ii]);
2747 helper_->VertexAttrib2fvImmediate(indx, values);
2748 CheckGLError();
2751 void GLES2Implementation::VertexAttrib3f(GLuint indx,
2752 GLfloat x,
2753 GLfloat y,
2754 GLfloat z) {
2755 GPU_CLIENT_SINGLE_THREAD_CHECK();
2756 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glVertexAttrib3f(" << indx << ", "
2757 << x << ", " << y << ", " << z << ")");
2758 helper_->VertexAttrib3f(indx, x, y, z);
2759 CheckGLError();
2762 void GLES2Implementation::VertexAttrib3fv(GLuint indx, const GLfloat* values) {
2763 GPU_CLIENT_SINGLE_THREAD_CHECK();
2764 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glVertexAttrib3fv(" << indx << ", "
2765 << static_cast<const void*>(values) << ")");
2766 size_t count = 3;
2767 for (size_t ii = 0; ii < count; ++ii)
2768 GPU_CLIENT_LOG("value[" << ii << "]: " << values[ii]);
2769 helper_->VertexAttrib3fvImmediate(indx, values);
2770 CheckGLError();
2773 void GLES2Implementation::VertexAttrib4f(GLuint indx,
2774 GLfloat x,
2775 GLfloat y,
2776 GLfloat z,
2777 GLfloat w) {
2778 GPU_CLIENT_SINGLE_THREAD_CHECK();
2779 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glVertexAttrib4f(" << indx << ", "
2780 << x << ", " << y << ", " << z << ", " << w << ")");
2781 helper_->VertexAttrib4f(indx, x, y, z, w);
2782 CheckGLError();
2785 void GLES2Implementation::VertexAttrib4fv(GLuint indx, const GLfloat* values) {
2786 GPU_CLIENT_SINGLE_THREAD_CHECK();
2787 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glVertexAttrib4fv(" << indx << ", "
2788 << static_cast<const void*>(values) << ")");
2789 size_t count = 4;
2790 for (size_t ii = 0; ii < count; ++ii)
2791 GPU_CLIENT_LOG("value[" << ii << "]: " << values[ii]);
2792 helper_->VertexAttrib4fvImmediate(indx, values);
2793 CheckGLError();
2796 void GLES2Implementation::VertexAttribI4i(GLuint indx,
2797 GLint x,
2798 GLint y,
2799 GLint z,
2800 GLint w) {
2801 GPU_CLIENT_SINGLE_THREAD_CHECK();
2802 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glVertexAttribI4i(" << indx << ", "
2803 << x << ", " << y << ", " << z << ", " << w << ")");
2804 helper_->VertexAttribI4i(indx, x, y, z, w);
2805 CheckGLError();
2808 void GLES2Implementation::VertexAttribI4iv(GLuint indx, const GLint* values) {
2809 GPU_CLIENT_SINGLE_THREAD_CHECK();
2810 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glVertexAttribI4iv(" << indx
2811 << ", " << static_cast<const void*>(values) << ")");
2812 size_t count = 4;
2813 for (size_t ii = 0; ii < count; ++ii)
2814 GPU_CLIENT_LOG("value[" << ii << "]: " << values[ii]);
2815 helper_->VertexAttribI4ivImmediate(indx, values);
2816 CheckGLError();
2819 void GLES2Implementation::VertexAttribI4ui(GLuint indx,
2820 GLuint x,
2821 GLuint y,
2822 GLuint z,
2823 GLuint w) {
2824 GPU_CLIENT_SINGLE_THREAD_CHECK();
2825 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glVertexAttribI4ui(" << indx
2826 << ", " << x << ", " << y << ", " << z << ", " << w
2827 << ")");
2828 helper_->VertexAttribI4ui(indx, x, y, z, w);
2829 CheckGLError();
2832 void GLES2Implementation::VertexAttribI4uiv(GLuint indx, const GLuint* values) {
2833 GPU_CLIENT_SINGLE_THREAD_CHECK();
2834 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glVertexAttribI4uiv(" << indx
2835 << ", " << static_cast<const void*>(values) << ")");
2836 size_t count = 4;
2837 for (size_t ii = 0; ii < count; ++ii)
2838 GPU_CLIENT_LOG("value[" << ii << "]: " << values[ii]);
2839 helper_->VertexAttribI4uivImmediate(indx, values);
2840 CheckGLError();
2843 void GLES2Implementation::Viewport(GLint x,
2844 GLint y,
2845 GLsizei width,
2846 GLsizei height) {
2847 GPU_CLIENT_SINGLE_THREAD_CHECK();
2848 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glViewport(" << x << ", " << y
2849 << ", " << width << ", " << height << ")");
2850 if (width < 0) {
2851 SetGLError(GL_INVALID_VALUE, "glViewport", "width < 0");
2852 return;
2854 if (height < 0) {
2855 SetGLError(GL_INVALID_VALUE, "glViewport", "height < 0");
2856 return;
2858 helper_->Viewport(x, y, width, height);
2859 CheckGLError();
2862 void GLES2Implementation::BlitFramebufferCHROMIUM(GLint srcX0,
2863 GLint srcY0,
2864 GLint srcX1,
2865 GLint srcY1,
2866 GLint dstX0,
2867 GLint dstY0,
2868 GLint dstX1,
2869 GLint dstY1,
2870 GLbitfield mask,
2871 GLenum filter) {
2872 GPU_CLIENT_SINGLE_THREAD_CHECK();
2873 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBlitFramebufferCHROMIUM("
2874 << srcX0 << ", " << srcY0 << ", " << srcX1 << ", " << srcY1
2875 << ", " << dstX0 << ", " << dstY0 << ", " << dstX1 << ", "
2876 << dstY1 << ", " << mask << ", "
2877 << GLES2Util::GetStringBlitFilter(filter) << ")");
2878 helper_->BlitFramebufferCHROMIUM(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0,
2879 dstX1, dstY1, mask, filter);
2880 CheckGLError();
2883 void GLES2Implementation::RenderbufferStorageMultisampleCHROMIUM(
2884 GLenum target,
2885 GLsizei samples,
2886 GLenum internalformat,
2887 GLsizei width,
2888 GLsizei height) {
2889 GPU_CLIENT_SINGLE_THREAD_CHECK();
2890 GPU_CLIENT_LOG(
2891 "[" << GetLogPrefix() << "] glRenderbufferStorageMultisampleCHROMIUM("
2892 << GLES2Util::GetStringRenderBufferTarget(target) << ", " << samples
2893 << ", " << GLES2Util::GetStringRenderBufferFormat(internalformat)
2894 << ", " << width << ", " << height << ")");
2895 if (samples < 0) {
2896 SetGLError(GL_INVALID_VALUE, "glRenderbufferStorageMultisampleCHROMIUM",
2897 "samples < 0");
2898 return;
2900 if (width < 0) {
2901 SetGLError(GL_INVALID_VALUE, "glRenderbufferStorageMultisampleCHROMIUM",
2902 "width < 0");
2903 return;
2905 if (height < 0) {
2906 SetGLError(GL_INVALID_VALUE, "glRenderbufferStorageMultisampleCHROMIUM",
2907 "height < 0");
2908 return;
2910 helper_->RenderbufferStorageMultisampleCHROMIUM(
2911 target, samples, internalformat, width, height);
2912 CheckGLError();
2915 void GLES2Implementation::RenderbufferStorageMultisampleEXT(
2916 GLenum target,
2917 GLsizei samples,
2918 GLenum internalformat,
2919 GLsizei width,
2920 GLsizei height) {
2921 GPU_CLIENT_SINGLE_THREAD_CHECK();
2922 GPU_CLIENT_LOG(
2923 "[" << GetLogPrefix() << "] glRenderbufferStorageMultisampleEXT("
2924 << GLES2Util::GetStringRenderBufferTarget(target) << ", " << samples
2925 << ", " << GLES2Util::GetStringRenderBufferFormat(internalformat)
2926 << ", " << width << ", " << height << ")");
2927 if (samples < 0) {
2928 SetGLError(GL_INVALID_VALUE, "glRenderbufferStorageMultisampleEXT",
2929 "samples < 0");
2930 return;
2932 if (width < 0) {
2933 SetGLError(GL_INVALID_VALUE, "glRenderbufferStorageMultisampleEXT",
2934 "width < 0");
2935 return;
2937 if (height < 0) {
2938 SetGLError(GL_INVALID_VALUE, "glRenderbufferStorageMultisampleEXT",
2939 "height < 0");
2940 return;
2942 helper_->RenderbufferStorageMultisampleEXT(target, samples, internalformat,
2943 width, height);
2944 CheckGLError();
2947 void GLES2Implementation::FramebufferTexture2DMultisampleEXT(GLenum target,
2948 GLenum attachment,
2949 GLenum textarget,
2950 GLuint texture,
2951 GLint level,
2952 GLsizei samples) {
2953 GPU_CLIENT_SINGLE_THREAD_CHECK();
2954 GPU_CLIENT_LOG("[" << GetLogPrefix()
2955 << "] glFramebufferTexture2DMultisampleEXT("
2956 << GLES2Util::GetStringFrameBufferTarget(target) << ", "
2957 << GLES2Util::GetStringAttachment(attachment) << ", "
2958 << GLES2Util::GetStringTextureTarget(textarget) << ", "
2959 << texture << ", " << level << ", " << samples << ")");
2960 if (level != 0) {
2961 SetGLError(GL_INVALID_VALUE, "glFramebufferTexture2DMultisampleEXT",
2962 "level GL_INVALID_VALUE");
2963 return;
2965 if (samples < 0) {
2966 SetGLError(GL_INVALID_VALUE, "glFramebufferTexture2DMultisampleEXT",
2967 "samples < 0");
2968 return;
2970 helper_->FramebufferTexture2DMultisampleEXT(target, attachment, textarget,
2971 texture, samples);
2972 CheckGLError();
2975 void GLES2Implementation::TexStorage2DEXT(GLenum target,
2976 GLsizei levels,
2977 GLenum internalFormat,
2978 GLsizei width,
2979 GLsizei height) {
2980 GPU_CLIENT_SINGLE_THREAD_CHECK();
2981 GPU_CLIENT_LOG(
2982 "[" << GetLogPrefix() << "] glTexStorage2DEXT("
2983 << GLES2Util::GetStringTextureTarget(target) << ", " << levels << ", "
2984 << GLES2Util::GetStringTextureInternalFormatStorage(internalFormat)
2985 << ", " << width << ", " << height << ")");
2986 if (levels < 0) {
2987 SetGLError(GL_INVALID_VALUE, "glTexStorage2DEXT", "levels < 0");
2988 return;
2990 if (width < 0) {
2991 SetGLError(GL_INVALID_VALUE, "glTexStorage2DEXT", "width < 0");
2992 return;
2994 if (height < 0) {
2995 SetGLError(GL_INVALID_VALUE, "glTexStorage2DEXT", "height < 0");
2996 return;
2998 helper_->TexStorage2DEXT(target, levels, internalFormat, width, height);
2999 CheckGLError();
3002 void GLES2Implementation::GenQueriesEXT(GLsizei n, GLuint* queries) {
3003 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGenQueriesEXT(" << n << ", "
3004 << static_cast<const void*>(queries) << ")");
3005 if (n < 0) {
3006 SetGLError(GL_INVALID_VALUE, "glGenQueriesEXT", "n < 0");
3007 return;
3009 GPU_CLIENT_SINGLE_THREAD_CHECK();
3010 IdAllocator* id_allocator = GetIdAllocator(id_namespaces::kQueries);
3011 for (GLsizei ii = 0; ii < n; ++ii)
3012 queries[ii] = id_allocator->AllocateID();
3013 GenQueriesEXTHelper(n, queries);
3014 helper_->GenQueriesEXTImmediate(n, queries);
3015 if (share_group_->bind_generates_resource())
3016 helper_->CommandBufferHelper::Flush();
3017 GPU_CLIENT_LOG_CODE_BLOCK({
3018 for (GLsizei i = 0; i < n; ++i) {
3019 GPU_CLIENT_LOG(" " << i << ": " << queries[i]);
3022 CheckGLError();
3025 void GLES2Implementation::DeleteQueriesEXT(GLsizei n, const GLuint* queries) {
3026 GPU_CLIENT_SINGLE_THREAD_CHECK();
3027 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDeleteQueriesEXT(" << n << ", "
3028 << static_cast<const void*>(queries) << ")");
3029 GPU_CLIENT_LOG_CODE_BLOCK({
3030 for (GLsizei i = 0; i < n; ++i) {
3031 GPU_CLIENT_LOG(" " << i << ": " << queries[i]);
3034 GPU_CLIENT_DCHECK_CODE_BLOCK({
3035 for (GLsizei i = 0; i < n; ++i) {
3036 DCHECK(queries[i] != 0);
3039 if (n < 0) {
3040 SetGLError(GL_INVALID_VALUE, "glDeleteQueriesEXT", "n < 0");
3041 return;
3043 DeleteQueriesEXTHelper(n, queries);
3044 CheckGLError();
3047 void GLES2Implementation::BeginTransformFeedback(GLenum primitivemode) {
3048 GPU_CLIENT_SINGLE_THREAD_CHECK();
3049 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBeginTransformFeedback("
3050 << GLES2Util::GetStringTransformFeedbackPrimitiveMode(
3051 primitivemode) << ")");
3052 helper_->BeginTransformFeedback(primitivemode);
3053 CheckGLError();
3056 void GLES2Implementation::EndTransformFeedback() {
3057 GPU_CLIENT_SINGLE_THREAD_CHECK();
3058 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glEndTransformFeedback("
3059 << ")");
3060 helper_->EndTransformFeedback();
3061 CheckGLError();
3064 void GLES2Implementation::GenVertexArraysOES(GLsizei n, GLuint* arrays) {
3065 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGenVertexArraysOES(" << n << ", "
3066 << static_cast<const void*>(arrays) << ")");
3067 if (n < 0) {
3068 SetGLError(GL_INVALID_VALUE, "glGenVertexArraysOES", "n < 0");
3069 return;
3071 GPU_CLIENT_SINGLE_THREAD_CHECK();
3072 GetIdHandler(id_namespaces::kVertexArrays)->MakeIds(this, 0, n, arrays);
3073 GenVertexArraysOESHelper(n, arrays);
3074 helper_->GenVertexArraysOESImmediate(n, arrays);
3075 if (share_group_->bind_generates_resource())
3076 helper_->CommandBufferHelper::Flush();
3077 GPU_CLIENT_LOG_CODE_BLOCK({
3078 for (GLsizei i = 0; i < n; ++i) {
3079 GPU_CLIENT_LOG(" " << i << ": " << arrays[i]);
3082 CheckGLError();
3085 void GLES2Implementation::DeleteVertexArraysOES(GLsizei n,
3086 const GLuint* arrays) {
3087 GPU_CLIENT_SINGLE_THREAD_CHECK();
3088 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDeleteVertexArraysOES(" << n
3089 << ", " << static_cast<const void*>(arrays) << ")");
3090 GPU_CLIENT_LOG_CODE_BLOCK({
3091 for (GLsizei i = 0; i < n; ++i) {
3092 GPU_CLIENT_LOG(" " << i << ": " << arrays[i]);
3095 GPU_CLIENT_DCHECK_CODE_BLOCK({
3096 for (GLsizei i = 0; i < n; ++i) {
3097 DCHECK(arrays[i] != 0);
3100 if (n < 0) {
3101 SetGLError(GL_INVALID_VALUE, "glDeleteVertexArraysOES", "n < 0");
3102 return;
3104 DeleteVertexArraysOESHelper(n, arrays);
3105 CheckGLError();
3108 GLboolean GLES2Implementation::IsVertexArrayOES(GLuint array) {
3109 GPU_CLIENT_SINGLE_THREAD_CHECK();
3110 TRACE_EVENT0("gpu", "GLES2Implementation::IsVertexArrayOES");
3111 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glIsVertexArrayOES(" << array
3112 << ")");
3113 typedef cmds::IsVertexArrayOES::Result Result;
3114 Result* result = GetResultAs<Result*>();
3115 if (!result) {
3116 return GL_FALSE;
3118 *result = 0;
3119 helper_->IsVertexArrayOES(array, GetResultShmId(), GetResultShmOffset());
3120 WaitForCmd();
3121 GLboolean result_value = *result != 0;
3122 GPU_CLIENT_LOG("returned " << result_value);
3123 CheckGLError();
3124 return result_value;
3127 void GLES2Implementation::BindVertexArrayOES(GLuint array) {
3128 GPU_CLIENT_SINGLE_THREAD_CHECK();
3129 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBindVertexArrayOES(" << array
3130 << ")");
3131 if (IsVertexArrayReservedId(array)) {
3132 SetGLError(GL_INVALID_OPERATION, "BindVertexArrayOES", "array reserved id");
3133 return;
3135 BindVertexArrayOESHelper(array);
3136 CheckGLError();
3139 void GLES2Implementation::GetTranslatedShaderSourceANGLE(GLuint shader,
3140 GLsizei bufsize,
3141 GLsizei* length,
3142 char* source) {
3143 GPU_CLIENT_SINGLE_THREAD_CHECK();
3144 GPU_CLIENT_VALIDATE_DESTINATION_OPTIONAL_INITALIZATION(GLsizei, length);
3145 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetTranslatedShaderSourceANGLE"
3146 << "(" << shader << ", " << bufsize << ", "
3147 << static_cast<void*>(length) << ", "
3148 << static_cast<void*>(source) << ")");
3149 helper_->SetBucketSize(kResultBucketId, 0);
3150 helper_->GetTranslatedShaderSourceANGLE(shader, kResultBucketId);
3151 std::string str;
3152 GLsizei max_size = 0;
3153 if (GetBucketAsString(kResultBucketId, &str)) {
3154 if (bufsize > 0) {
3155 max_size = std::min(static_cast<size_t>(bufsize) - 1, str.size());
3156 memcpy(source, str.c_str(), max_size);
3157 source[max_size] = '\0';
3158 GPU_CLIENT_LOG("------\n" << source << "\n------");
3161 if (length != NULL) {
3162 *length = max_size;
3164 CheckGLError();
3166 void GLES2Implementation::TexImageIOSurface2DCHROMIUM(GLenum target,
3167 GLsizei width,
3168 GLsizei height,
3169 GLuint ioSurfaceId,
3170 GLuint plane) {
3171 GPU_CLIENT_SINGLE_THREAD_CHECK();
3172 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glTexImageIOSurface2DCHROMIUM("
3173 << GLES2Util::GetStringTextureBindTarget(target) << ", "
3174 << width << ", " << height << ", " << ioSurfaceId << ", "
3175 << plane << ")");
3176 if (width < 0) {
3177 SetGLError(GL_INVALID_VALUE, "glTexImageIOSurface2DCHROMIUM", "width < 0");
3178 return;
3180 if (height < 0) {
3181 SetGLError(GL_INVALID_VALUE, "glTexImageIOSurface2DCHROMIUM", "height < 0");
3182 return;
3184 helper_->TexImageIOSurface2DCHROMIUM(target, width, height, ioSurfaceId,
3185 plane);
3186 CheckGLError();
3189 void GLES2Implementation::CopyTextureCHROMIUM(GLenum target,
3190 GLenum source_id,
3191 GLenum dest_id,
3192 GLint internalformat,
3193 GLenum dest_type) {
3194 GPU_CLIENT_SINGLE_THREAD_CHECK();
3195 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glCopyTextureCHROMIUM("
3196 << GLES2Util::GetStringEnum(target) << ", "
3197 << GLES2Util::GetStringEnum(source_id) << ", "
3198 << GLES2Util::GetStringEnum(dest_id) << ", "
3199 << internalformat << ", "
3200 << GLES2Util::GetStringPixelType(dest_type) << ")");
3201 helper_->CopyTextureCHROMIUM(target, source_id, dest_id, internalformat,
3202 dest_type);
3203 CheckGLError();
3206 void GLES2Implementation::CopySubTextureCHROMIUM(GLenum target,
3207 GLenum source_id,
3208 GLenum dest_id,
3209 GLint xoffset,
3210 GLint yoffset) {
3211 GPU_CLIENT_SINGLE_THREAD_CHECK();
3212 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glCopySubTextureCHROMIUM("
3213 << GLES2Util::GetStringEnum(target) << ", "
3214 << GLES2Util::GetStringEnum(source_id) << ", "
3215 << GLES2Util::GetStringEnum(dest_id) << ", " << xoffset
3216 << ", " << yoffset << ")");
3217 helper_->CopySubTextureCHROMIUM(target, source_id, dest_id, xoffset, yoffset);
3218 CheckGLError();
3221 void GLES2Implementation::GenValuebuffersCHROMIUM(GLsizei n, GLuint* buffers) {
3222 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGenValuebuffersCHROMIUM(" << n
3223 << ", " << static_cast<const void*>(buffers) << ")");
3224 if (n < 0) {
3225 SetGLError(GL_INVALID_VALUE, "glGenValuebuffersCHROMIUM", "n < 0");
3226 return;
3228 GPU_CLIENT_SINGLE_THREAD_CHECK();
3229 GetIdHandler(id_namespaces::kValuebuffers)->MakeIds(this, 0, n, buffers);
3230 GenValuebuffersCHROMIUMHelper(n, buffers);
3231 helper_->GenValuebuffersCHROMIUMImmediate(n, buffers);
3232 if (share_group_->bind_generates_resource())
3233 helper_->CommandBufferHelper::Flush();
3234 GPU_CLIENT_LOG_CODE_BLOCK({
3235 for (GLsizei i = 0; i < n; ++i) {
3236 GPU_CLIENT_LOG(" " << i << ": " << buffers[i]);
3239 CheckGLError();
3242 void GLES2Implementation::DeleteValuebuffersCHROMIUM(
3243 GLsizei n,
3244 const GLuint* valuebuffers) {
3245 GPU_CLIENT_SINGLE_THREAD_CHECK();
3246 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDeleteValuebuffersCHROMIUM(" << n
3247 << ", " << static_cast<const void*>(valuebuffers) << ")");
3248 GPU_CLIENT_LOG_CODE_BLOCK({
3249 for (GLsizei i = 0; i < n; ++i) {
3250 GPU_CLIENT_LOG(" " << i << ": " << valuebuffers[i]);
3253 GPU_CLIENT_DCHECK_CODE_BLOCK({
3254 for (GLsizei i = 0; i < n; ++i) {
3255 DCHECK(valuebuffers[i] != 0);
3258 if (n < 0) {
3259 SetGLError(GL_INVALID_VALUE, "glDeleteValuebuffersCHROMIUM", "n < 0");
3260 return;
3262 DeleteValuebuffersCHROMIUMHelper(n, valuebuffers);
3263 CheckGLError();
3266 GLboolean GLES2Implementation::IsValuebufferCHROMIUM(GLuint valuebuffer) {
3267 GPU_CLIENT_SINGLE_THREAD_CHECK();
3268 TRACE_EVENT0("gpu", "GLES2Implementation::IsValuebufferCHROMIUM");
3269 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glIsValuebufferCHROMIUM("
3270 << valuebuffer << ")");
3271 typedef cmds::IsValuebufferCHROMIUM::Result Result;
3272 Result* result = GetResultAs<Result*>();
3273 if (!result) {
3274 return GL_FALSE;
3276 *result = 0;
3277 helper_->IsValuebufferCHROMIUM(valuebuffer, GetResultShmId(),
3278 GetResultShmOffset());
3279 WaitForCmd();
3280 GLboolean result_value = *result != 0;
3281 GPU_CLIENT_LOG("returned " << result_value);
3282 CheckGLError();
3283 return result_value;
3286 void GLES2Implementation::BindValuebufferCHROMIUM(GLenum target,
3287 GLuint valuebuffer) {
3288 GPU_CLIENT_SINGLE_THREAD_CHECK();
3289 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBindValuebufferCHROMIUM("
3290 << GLES2Util::GetStringValueBufferTarget(target) << ", "
3291 << valuebuffer << ")");
3292 if (IsValuebufferReservedId(valuebuffer)) {
3293 SetGLError(GL_INVALID_OPERATION, "BindValuebufferCHROMIUM",
3294 "valuebuffer reserved id");
3295 return;
3297 BindValuebufferCHROMIUMHelper(target, valuebuffer);
3298 CheckGLError();
3301 void GLES2Implementation::SubscribeValueCHROMIUM(GLenum target,
3302 GLenum subscription) {
3303 GPU_CLIENT_SINGLE_THREAD_CHECK();
3304 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glSubscribeValueCHROMIUM("
3305 << GLES2Util::GetStringValueBufferTarget(target) << ", "
3306 << GLES2Util::GetStringSubscriptionTarget(subscription)
3307 << ")");
3308 helper_->SubscribeValueCHROMIUM(target, subscription);
3309 CheckGLError();
3312 void GLES2Implementation::PopulateSubscribedValuesCHROMIUM(GLenum target) {
3313 GPU_CLIENT_SINGLE_THREAD_CHECK();
3314 GPU_CLIENT_LOG("[" << GetLogPrefix()
3315 << "] glPopulateSubscribedValuesCHROMIUM("
3316 << GLES2Util::GetStringValueBufferTarget(target) << ")");
3317 helper_->PopulateSubscribedValuesCHROMIUM(target);
3318 CheckGLError();
3321 void GLES2Implementation::UniformValuebufferCHROMIUM(GLint location,
3322 GLenum target,
3323 GLenum subscription) {
3324 GPU_CLIENT_SINGLE_THREAD_CHECK();
3325 GPU_CLIENT_LOG(
3326 "[" << GetLogPrefix() << "] glUniformValuebufferCHROMIUM(" << location
3327 << ", " << GLES2Util::GetStringValueBufferTarget(target) << ", "
3328 << GLES2Util::GetStringSubscriptionTarget(subscription) << ")");
3329 helper_->UniformValuebufferCHROMIUM(location, target, subscription);
3330 CheckGLError();
3333 void GLES2Implementation::BindTexImage2DCHROMIUM(GLenum target, GLint imageId) {
3334 GPU_CLIENT_SINGLE_THREAD_CHECK();
3335 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBindTexImage2DCHROMIUM("
3336 << GLES2Util::GetStringTextureBindTarget(target) << ", "
3337 << imageId << ")");
3338 helper_->BindTexImage2DCHROMIUM(target, imageId);
3339 CheckGLError();
3342 void GLES2Implementation::ReleaseTexImage2DCHROMIUM(GLenum target,
3343 GLint imageId) {
3344 GPU_CLIENT_SINGLE_THREAD_CHECK();
3345 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glReleaseTexImage2DCHROMIUM("
3346 << GLES2Util::GetStringTextureBindTarget(target) << ", "
3347 << imageId << ")");
3348 helper_->ReleaseTexImage2DCHROMIUM(target, imageId);
3349 CheckGLError();
3352 void GLES2Implementation::DiscardFramebufferEXT(GLenum target,
3353 GLsizei count,
3354 const GLenum* attachments) {
3355 GPU_CLIENT_SINGLE_THREAD_CHECK();
3356 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDiscardFramebufferEXT("
3357 << GLES2Util::GetStringEnum(target) << ", " << count
3358 << ", " << static_cast<const void*>(attachments) << ")");
3359 GPU_CLIENT_LOG_CODE_BLOCK({
3360 for (GLsizei i = 0; i < count; ++i) {
3361 GPU_CLIENT_LOG(" " << i << ": " << attachments[0 + i * 1]);
3364 if (count < 0) {
3365 SetGLError(GL_INVALID_VALUE, "glDiscardFramebufferEXT", "count < 0");
3366 return;
3368 helper_->DiscardFramebufferEXTImmediate(target, count, attachments);
3369 CheckGLError();
3372 void GLES2Implementation::LoseContextCHROMIUM(GLenum current, GLenum other) {
3373 GPU_CLIENT_SINGLE_THREAD_CHECK();
3374 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glLoseContextCHROMIUM("
3375 << GLES2Util::GetStringResetStatus(current) << ", "
3376 << GLES2Util::GetStringResetStatus(other) << ")");
3377 helper_->LoseContextCHROMIUM(current, other);
3378 CheckGLError();
3381 void GLES2Implementation::WaitSyncPointCHROMIUM(GLuint sync_point) {
3382 GPU_CLIENT_SINGLE_THREAD_CHECK();
3383 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glWaitSyncPointCHROMIUM("
3384 << sync_point << ")");
3385 helper_->WaitSyncPointCHROMIUM(sync_point);
3386 CheckGLError();
3389 void GLES2Implementation::DrawBuffersEXT(GLsizei count, const GLenum* bufs) {
3390 GPU_CLIENT_SINGLE_THREAD_CHECK();
3391 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDrawBuffersEXT(" << count << ", "
3392 << static_cast<const void*>(bufs) << ")");
3393 GPU_CLIENT_LOG_CODE_BLOCK({
3394 for (GLsizei i = 0; i < count; ++i) {
3395 GPU_CLIENT_LOG(" " << i << ": " << bufs[0 + i * 1]);
3398 if (count < 0) {
3399 SetGLError(GL_INVALID_VALUE, "glDrawBuffersEXT", "count < 0");
3400 return;
3402 helper_->DrawBuffersEXTImmediate(count, bufs);
3403 CheckGLError();
3406 void GLES2Implementation::DiscardBackbufferCHROMIUM() {
3407 GPU_CLIENT_SINGLE_THREAD_CHECK();
3408 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDiscardBackbufferCHROMIUM("
3409 << ")");
3410 helper_->DiscardBackbufferCHROMIUM();
3411 CheckGLError();
3414 void GLES2Implementation::ScheduleOverlayPlaneCHROMIUM(
3415 GLint plane_z_order,
3416 GLenum plane_transform,
3417 GLuint overlay_texture_id,
3418 GLint bounds_x,
3419 GLint bounds_y,
3420 GLint bounds_width,
3421 GLint bounds_height,
3422 GLfloat uv_x,
3423 GLfloat uv_y,
3424 GLfloat uv_width,
3425 GLfloat uv_height) {
3426 GPU_CLIENT_SINGLE_THREAD_CHECK();
3427 GPU_CLIENT_LOG(
3428 "[" << GetLogPrefix() << "] glScheduleOverlayPlaneCHROMIUM("
3429 << plane_z_order << ", " << GLES2Util::GetStringEnum(plane_transform)
3430 << ", " << overlay_texture_id << ", " << bounds_x << ", " << bounds_y
3431 << ", " << bounds_width << ", " << bounds_height << ", " << uv_x
3432 << ", " << uv_y << ", " << uv_width << ", " << uv_height << ")");
3433 helper_->ScheduleOverlayPlaneCHROMIUM(
3434 plane_z_order, plane_transform, overlay_texture_id, bounds_x, bounds_y,
3435 bounds_width, bounds_height, uv_x, uv_y, uv_width, uv_height);
3436 CheckGLError();
3439 void GLES2Implementation::MatrixLoadfCHROMIUM(GLenum matrixMode,
3440 const GLfloat* m) {
3441 GPU_CLIENT_SINGLE_THREAD_CHECK();
3442 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glMatrixLoadfCHROMIUM("
3443 << GLES2Util::GetStringMatrixMode(matrixMode) << ", "
3444 << static_cast<const void*>(m) << ")");
3445 size_t count = 16;
3446 for (size_t ii = 0; ii < count; ++ii)
3447 GPU_CLIENT_LOG("value[" << ii << "]: " << m[ii]);
3448 helper_->MatrixLoadfCHROMIUMImmediate(matrixMode, m);
3449 CheckGLError();
3452 void GLES2Implementation::MatrixLoadIdentityCHROMIUM(GLenum matrixMode) {
3453 GPU_CLIENT_SINGLE_THREAD_CHECK();
3454 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glMatrixLoadIdentityCHROMIUM("
3455 << GLES2Util::GetStringMatrixMode(matrixMode) << ")");
3456 helper_->MatrixLoadIdentityCHROMIUM(matrixMode);
3457 CheckGLError();
3460 void GLES2Implementation::BlendBarrierKHR() {
3461 GPU_CLIENT_SINGLE_THREAD_CHECK();
3462 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBlendBarrierKHR("
3463 << ")");
3464 helper_->BlendBarrierKHR();
3465 CheckGLError();
3468 #endif // GPU_COMMAND_BUFFER_CLIENT_GLES2_IMPLEMENTATION_IMPL_AUTOGEN_H_