Revert of Merge duplicate code in invalidation helper. (patchset #2 id:40001 of https...
[chromium-blink-merge.git] / gpu / command_buffer / client / gles2_implementation_impl_autogen.h
blob9f8bfba251ac4a266ea0f1caa68de5751421cc54
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(
697 "[" << GetLogPrefix() << "] glFramebufferRenderbuffer("
698 << GLES2Util::GetStringFrameBufferTarget(target) << ", "
699 << GLES2Util::GetStringAttachment(attachment) << ", "
700 << GLES2Util::GetStringRenderBufferTarget(renderbuffertarget) << ", "
701 << renderbuffer << ")");
702 helper_->FramebufferRenderbuffer(target, attachment, renderbuffertarget,
703 renderbuffer);
704 CheckGLError();
707 void GLES2Implementation::FramebufferTexture2D(GLenum target,
708 GLenum attachment,
709 GLenum textarget,
710 GLuint texture,
711 GLint level) {
712 GPU_CLIENT_SINGLE_THREAD_CHECK();
713 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glFramebufferTexture2D("
714 << GLES2Util::GetStringFrameBufferTarget(target) << ", "
715 << GLES2Util::GetStringAttachment(attachment) << ", "
716 << GLES2Util::GetStringTextureTarget(textarget) << ", "
717 << texture << ", " << level << ")");
718 if (level != 0) {
719 SetGLError(GL_INVALID_VALUE, "glFramebufferTexture2D",
720 "level GL_INVALID_VALUE");
721 return;
723 helper_->FramebufferTexture2D(target, attachment, textarget, texture);
724 CheckGLError();
727 void GLES2Implementation::FramebufferTextureLayer(GLenum target,
728 GLenum attachment,
729 GLuint texture,
730 GLint level,
731 GLint layer) {
732 GPU_CLIENT_SINGLE_THREAD_CHECK();
733 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glFramebufferTextureLayer("
734 << GLES2Util::GetStringFrameBufferTarget(target) << ", "
735 << GLES2Util::GetStringAttachment(attachment) << ", "
736 << texture << ", " << level << ", " << layer << ")");
737 helper_->FramebufferTextureLayer(target, attachment, texture, level, layer);
738 CheckGLError();
741 void GLES2Implementation::FrontFace(GLenum mode) {
742 GPU_CLIENT_SINGLE_THREAD_CHECK();
743 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glFrontFace("
744 << GLES2Util::GetStringFaceMode(mode) << ")");
745 helper_->FrontFace(mode);
746 CheckGLError();
749 void GLES2Implementation::GenBuffers(GLsizei n, GLuint* buffers) {
750 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGenBuffers(" << n << ", "
751 << static_cast<const void*>(buffers) << ")");
752 if (n < 0) {
753 SetGLError(GL_INVALID_VALUE, "glGenBuffers", "n < 0");
754 return;
756 GPU_CLIENT_SINGLE_THREAD_CHECK();
757 GetIdHandler(id_namespaces::kBuffers)->MakeIds(this, 0, n, buffers);
758 GenBuffersHelper(n, buffers);
759 helper_->GenBuffersImmediate(n, buffers);
760 if (share_group_->bind_generates_resource())
761 helper_->CommandBufferHelper::Flush();
762 GPU_CLIENT_LOG_CODE_BLOCK({
763 for (GLsizei i = 0; i < n; ++i) {
764 GPU_CLIENT_LOG(" " << i << ": " << buffers[i]);
767 CheckGLError();
770 void GLES2Implementation::GenerateMipmap(GLenum target) {
771 GPU_CLIENT_SINGLE_THREAD_CHECK();
772 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGenerateMipmap("
773 << GLES2Util::GetStringTextureBindTarget(target) << ")");
774 helper_->GenerateMipmap(target);
775 CheckGLError();
778 void GLES2Implementation::GenFramebuffers(GLsizei n, GLuint* framebuffers) {
779 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGenFramebuffers(" << n << ", "
780 << static_cast<const void*>(framebuffers) << ")");
781 if (n < 0) {
782 SetGLError(GL_INVALID_VALUE, "glGenFramebuffers", "n < 0");
783 return;
785 GPU_CLIENT_SINGLE_THREAD_CHECK();
786 GetIdHandler(id_namespaces::kFramebuffers)->MakeIds(this, 0, n, framebuffers);
787 GenFramebuffersHelper(n, framebuffers);
788 helper_->GenFramebuffersImmediate(n, framebuffers);
789 if (share_group_->bind_generates_resource())
790 helper_->CommandBufferHelper::Flush();
791 GPU_CLIENT_LOG_CODE_BLOCK({
792 for (GLsizei i = 0; i < n; ++i) {
793 GPU_CLIENT_LOG(" " << i << ": " << framebuffers[i]);
796 CheckGLError();
799 void GLES2Implementation::GenRenderbuffers(GLsizei n, GLuint* renderbuffers) {
800 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGenRenderbuffers(" << n << ", "
801 << static_cast<const void*>(renderbuffers) << ")");
802 if (n < 0) {
803 SetGLError(GL_INVALID_VALUE, "glGenRenderbuffers", "n < 0");
804 return;
806 GPU_CLIENT_SINGLE_THREAD_CHECK();
807 GetIdHandler(id_namespaces::kRenderbuffers)
808 ->MakeIds(this, 0, n, renderbuffers);
809 GenRenderbuffersHelper(n, renderbuffers);
810 helper_->GenRenderbuffersImmediate(n, renderbuffers);
811 if (share_group_->bind_generates_resource())
812 helper_->CommandBufferHelper::Flush();
813 GPU_CLIENT_LOG_CODE_BLOCK({
814 for (GLsizei i = 0; i < n; ++i) {
815 GPU_CLIENT_LOG(" " << i << ": " << renderbuffers[i]);
818 CheckGLError();
821 void GLES2Implementation::GenSamplers(GLsizei n, GLuint* samplers) {
822 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGenSamplers(" << n << ", "
823 << static_cast<const void*>(samplers) << ")");
824 if (n < 0) {
825 SetGLError(GL_INVALID_VALUE, "glGenSamplers", "n < 0");
826 return;
828 GPU_CLIENT_SINGLE_THREAD_CHECK();
829 GetIdHandler(id_namespaces::kSamplers)->MakeIds(this, 0, n, samplers);
830 GenSamplersHelper(n, samplers);
831 helper_->GenSamplersImmediate(n, samplers);
832 if (share_group_->bind_generates_resource())
833 helper_->CommandBufferHelper::Flush();
834 GPU_CLIENT_LOG_CODE_BLOCK({
835 for (GLsizei i = 0; i < n; ++i) {
836 GPU_CLIENT_LOG(" " << i << ": " << samplers[i]);
839 CheckGLError();
842 void GLES2Implementation::GenTextures(GLsizei n, GLuint* textures) {
843 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGenTextures(" << n << ", "
844 << static_cast<const void*>(textures) << ")");
845 if (n < 0) {
846 SetGLError(GL_INVALID_VALUE, "glGenTextures", "n < 0");
847 return;
849 GPU_CLIENT_SINGLE_THREAD_CHECK();
850 GetIdHandler(id_namespaces::kTextures)->MakeIds(this, 0, n, textures);
851 GenTexturesHelper(n, textures);
852 helper_->GenTexturesImmediate(n, textures);
853 if (share_group_->bind_generates_resource())
854 helper_->CommandBufferHelper::Flush();
855 GPU_CLIENT_LOG_CODE_BLOCK({
856 for (GLsizei i = 0; i < n; ++i) {
857 GPU_CLIENT_LOG(" " << i << ": " << textures[i]);
860 CheckGLError();
863 void GLES2Implementation::GenTransformFeedbacks(GLsizei n, GLuint* ids) {
864 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGenTransformFeedbacks(" << n
865 << ", " << static_cast<const void*>(ids) << ")");
866 if (n < 0) {
867 SetGLError(GL_INVALID_VALUE, "glGenTransformFeedbacks", "n < 0");
868 return;
870 GPU_CLIENT_SINGLE_THREAD_CHECK();
871 GetIdHandler(id_namespaces::kTransformFeedbacks)->MakeIds(this, 0, n, ids);
872 GenTransformFeedbacksHelper(n, ids);
873 helper_->GenTransformFeedbacksImmediate(n, ids);
874 if (share_group_->bind_generates_resource())
875 helper_->CommandBufferHelper::Flush();
876 GPU_CLIENT_LOG_CODE_BLOCK({
877 for (GLsizei i = 0; i < n; ++i) {
878 GPU_CLIENT_LOG(" " << i << ": " << ids[i]);
881 CheckGLError();
884 void GLES2Implementation::GetBooleanv(GLenum pname, GLboolean* params) {
885 GPU_CLIENT_SINGLE_THREAD_CHECK();
886 GPU_CLIENT_VALIDATE_DESTINATION_INITALIZATION(GLboolean, params);
887 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetBooleanv("
888 << GLES2Util::GetStringGLState(pname) << ", "
889 << static_cast<const void*>(params) << ")");
890 TRACE_EVENT0("gpu", "GLES2Implementation::GetBooleanv");
891 if (GetBooleanvHelper(pname, params)) {
892 return;
894 typedef cmds::GetBooleanv::Result Result;
895 Result* result = GetResultAs<Result*>();
896 if (!result) {
897 return;
899 result->SetNumResults(0);
900 helper_->GetBooleanv(pname, GetResultShmId(), GetResultShmOffset());
901 WaitForCmd();
902 result->CopyResult(params);
903 GPU_CLIENT_LOG_CODE_BLOCK({
904 for (int32_t i = 0; i < result->GetNumResults(); ++i) {
905 GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]);
908 CheckGLError();
910 void GLES2Implementation::GetBufferParameteri64v(GLenum target,
911 GLenum pname,
912 GLint64* params) {
913 GPU_CLIENT_SINGLE_THREAD_CHECK();
914 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetBufferParameteri64v("
915 << GLES2Util::GetStringBufferTarget(target) << ", "
916 << GLES2Util::GetStringBufferParameter64(pname) << ", "
917 << static_cast<const void*>(params) << ")");
918 TRACE_EVENT0("gpu", "GLES2Implementation::GetBufferParameteri64v");
919 if (GetBufferParameteri64vHelper(target, pname, params)) {
920 return;
922 typedef cmds::GetBufferParameteri64v::Result Result;
923 Result* result = GetResultAs<Result*>();
924 if (!result) {
925 return;
927 result->SetNumResults(0);
928 helper_->GetBufferParameteri64v(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::GetBufferParameteriv(GLenum target,
940 GLenum pname,
941 GLint* params) {
942 GPU_CLIENT_SINGLE_THREAD_CHECK();
943 GPU_CLIENT_VALIDATE_DESTINATION_INITALIZATION(GLint, params);
944 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetBufferParameteriv("
945 << GLES2Util::GetStringBufferTarget(target) << ", "
946 << GLES2Util::GetStringBufferParameter(pname) << ", "
947 << static_cast<const void*>(params) << ")");
948 TRACE_EVENT0("gpu", "GLES2Implementation::GetBufferParameteriv");
949 if (GetBufferParameterivHelper(target, pname, params)) {
950 return;
952 typedef cmds::GetBufferParameteriv::Result Result;
953 Result* result = GetResultAs<Result*>();
954 if (!result) {
955 return;
957 result->SetNumResults(0);
958 helper_->GetBufferParameteriv(target, pname, GetResultShmId(),
959 GetResultShmOffset());
960 WaitForCmd();
961 result->CopyResult(params);
962 GPU_CLIENT_LOG_CODE_BLOCK({
963 for (int32_t i = 0; i < result->GetNumResults(); ++i) {
964 GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]);
967 CheckGLError();
969 void GLES2Implementation::GetFloatv(GLenum pname, GLfloat* params) {
970 GPU_CLIENT_SINGLE_THREAD_CHECK();
971 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetFloatv("
972 << GLES2Util::GetStringGLState(pname) << ", "
973 << static_cast<const void*>(params) << ")");
974 TRACE_EVENT0("gpu", "GLES2Implementation::GetFloatv");
975 if (GetFloatvHelper(pname, params)) {
976 return;
978 typedef cmds::GetFloatv::Result Result;
979 Result* result = GetResultAs<Result*>();
980 if (!result) {
981 return;
983 result->SetNumResults(0);
984 helper_->GetFloatv(pname, GetResultShmId(), GetResultShmOffset());
985 WaitForCmd();
986 result->CopyResult(params);
987 GPU_CLIENT_LOG_CODE_BLOCK({
988 for (int32_t i = 0; i < result->GetNumResults(); ++i) {
989 GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]);
992 CheckGLError();
994 void GLES2Implementation::GetFramebufferAttachmentParameteriv(GLenum target,
995 GLenum attachment,
996 GLenum pname,
997 GLint* params) {
998 GPU_CLIENT_SINGLE_THREAD_CHECK();
999 GPU_CLIENT_VALIDATE_DESTINATION_INITALIZATION(GLint, params);
1000 GPU_CLIENT_LOG("[" << GetLogPrefix()
1001 << "] glGetFramebufferAttachmentParameteriv("
1002 << GLES2Util::GetStringFrameBufferTarget(target) << ", "
1003 << GLES2Util::GetStringAttachment(attachment) << ", "
1004 << GLES2Util::GetStringFrameBufferParameter(pname) << ", "
1005 << static_cast<const void*>(params) << ")");
1006 TRACE_EVENT0("gpu",
1007 "GLES2Implementation::GetFramebufferAttachmentParameteriv");
1008 if (GetFramebufferAttachmentParameterivHelper(target, attachment, pname,
1009 params)) {
1010 return;
1012 typedef cmds::GetFramebufferAttachmentParameteriv::Result Result;
1013 Result* result = GetResultAs<Result*>();
1014 if (!result) {
1015 return;
1017 result->SetNumResults(0);
1018 helper_->GetFramebufferAttachmentParameteriv(
1019 target, attachment, pname, GetResultShmId(), GetResultShmOffset());
1020 WaitForCmd();
1021 result->CopyResult(params);
1022 GPU_CLIENT_LOG_CODE_BLOCK({
1023 for (int32_t i = 0; i < result->GetNumResults(); ++i) {
1024 GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]);
1027 CheckGLError();
1029 void GLES2Implementation::GetInteger64v(GLenum pname, GLint64* params) {
1030 GPU_CLIENT_SINGLE_THREAD_CHECK();
1031 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetInteger64v("
1032 << GLES2Util::GetStringGLState(pname) << ", "
1033 << static_cast<const void*>(params) << ")");
1034 TRACE_EVENT0("gpu", "GLES2Implementation::GetInteger64v");
1035 if (GetInteger64vHelper(pname, params)) {
1036 return;
1038 typedef cmds::GetInteger64v::Result Result;
1039 Result* result = GetResultAs<Result*>();
1040 if (!result) {
1041 return;
1043 result->SetNumResults(0);
1044 helper_->GetInteger64v(pname, GetResultShmId(), GetResultShmOffset());
1045 WaitForCmd();
1046 result->CopyResult(params);
1047 GPU_CLIENT_LOG_CODE_BLOCK({
1048 for (int32_t i = 0; i < result->GetNumResults(); ++i) {
1049 GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]);
1052 CheckGLError();
1054 void GLES2Implementation::GetIntegeri_v(GLenum pname,
1055 GLuint index,
1056 GLint* data) {
1057 GPU_CLIENT_SINGLE_THREAD_CHECK();
1058 GPU_CLIENT_VALIDATE_DESTINATION_INITALIZATION(GLint, data);
1059 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetIntegeri_v("
1060 << GLES2Util::GetStringIndexedGLState(pname) << ", "
1061 << index << ", " << static_cast<const void*>(data) << ")");
1062 TRACE_EVENT0("gpu", "GLES2Implementation::GetIntegeri_v");
1063 if (GetIntegeri_vHelper(pname, index, data)) {
1064 return;
1066 typedef cmds::GetIntegeri_v::Result Result;
1067 Result* result = GetResultAs<Result*>();
1068 if (!result) {
1069 return;
1071 result->SetNumResults(0);
1072 helper_->GetIntegeri_v(pname, index, GetResultShmId(), GetResultShmOffset());
1073 WaitForCmd();
1074 result->CopyResult(data);
1075 GPU_CLIENT_LOG_CODE_BLOCK({
1076 for (int32_t i = 0; i < result->GetNumResults(); ++i) {
1077 GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]);
1080 CheckGLError();
1082 void GLES2Implementation::GetInteger64i_v(GLenum pname,
1083 GLuint index,
1084 GLint64* data) {
1085 GPU_CLIENT_SINGLE_THREAD_CHECK();
1086 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetInteger64i_v("
1087 << GLES2Util::GetStringIndexedGLState(pname) << ", "
1088 << index << ", " << static_cast<const void*>(data) << ")");
1089 TRACE_EVENT0("gpu", "GLES2Implementation::GetInteger64i_v");
1090 if (GetInteger64i_vHelper(pname, index, data)) {
1091 return;
1093 typedef cmds::GetInteger64i_v::Result Result;
1094 Result* result = GetResultAs<Result*>();
1095 if (!result) {
1096 return;
1098 result->SetNumResults(0);
1099 helper_->GetInteger64i_v(pname, index, GetResultShmId(),
1100 GetResultShmOffset());
1101 WaitForCmd();
1102 result->CopyResult(data);
1103 GPU_CLIENT_LOG_CODE_BLOCK({
1104 for (int32_t i = 0; i < result->GetNumResults(); ++i) {
1105 GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]);
1108 CheckGLError();
1110 void GLES2Implementation::GetIntegerv(GLenum pname, GLint* params) {
1111 GPU_CLIENT_SINGLE_THREAD_CHECK();
1112 GPU_CLIENT_VALIDATE_DESTINATION_INITALIZATION(GLint, params);
1113 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetIntegerv("
1114 << GLES2Util::GetStringGLState(pname) << ", "
1115 << static_cast<const void*>(params) << ")");
1116 TRACE_EVENT0("gpu", "GLES2Implementation::GetIntegerv");
1117 if (GetIntegervHelper(pname, params)) {
1118 return;
1120 typedef cmds::GetIntegerv::Result Result;
1121 Result* result = GetResultAs<Result*>();
1122 if (!result) {
1123 return;
1125 result->SetNumResults(0);
1126 helper_->GetIntegerv(pname, GetResultShmId(), GetResultShmOffset());
1127 WaitForCmd();
1128 result->CopyResult(params);
1129 GPU_CLIENT_LOG_CODE_BLOCK({
1130 for (int32_t i = 0; i < result->GetNumResults(); ++i) {
1131 GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]);
1134 CheckGLError();
1136 void GLES2Implementation::GetProgramiv(GLuint program,
1137 GLenum pname,
1138 GLint* params) {
1139 GPU_CLIENT_SINGLE_THREAD_CHECK();
1140 GPU_CLIENT_VALIDATE_DESTINATION_INITALIZATION(GLint, params);
1141 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetProgramiv(" << program << ", "
1142 << GLES2Util::GetStringProgramParameter(pname) << ", "
1143 << static_cast<const void*>(params) << ")");
1144 TRACE_EVENT0("gpu", "GLES2Implementation::GetProgramiv");
1145 if (GetProgramivHelper(program, pname, params)) {
1146 return;
1148 typedef cmds::GetProgramiv::Result Result;
1149 Result* result = GetResultAs<Result*>();
1150 if (!result) {
1151 return;
1153 result->SetNumResults(0);
1154 helper_->GetProgramiv(program, pname, GetResultShmId(), GetResultShmOffset());
1155 WaitForCmd();
1156 result->CopyResult(params);
1157 GPU_CLIENT_LOG_CODE_BLOCK({
1158 for (int32_t i = 0; i < result->GetNumResults(); ++i) {
1159 GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]);
1162 CheckGLError();
1164 void GLES2Implementation::GetProgramInfoLog(GLuint program,
1165 GLsizei bufsize,
1166 GLsizei* length,
1167 char* infolog) {
1168 GPU_CLIENT_SINGLE_THREAD_CHECK();
1169 GPU_CLIENT_VALIDATE_DESTINATION_OPTIONAL_INITALIZATION(GLsizei, length);
1170 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetProgramInfoLog"
1171 << "(" << program << ", " << bufsize << ", "
1172 << static_cast<void*>(length) << ", "
1173 << static_cast<void*>(infolog) << ")");
1174 helper_->SetBucketSize(kResultBucketId, 0);
1175 helper_->GetProgramInfoLog(program, kResultBucketId);
1176 std::string str;
1177 GLsizei max_size = 0;
1178 if (GetBucketAsString(kResultBucketId, &str)) {
1179 if (bufsize > 0) {
1180 max_size = std::min(static_cast<size_t>(bufsize) - 1, str.size());
1181 memcpy(infolog, str.c_str(), max_size);
1182 infolog[max_size] = '\0';
1183 GPU_CLIENT_LOG("------\n" << infolog << "\n------");
1186 if (length != NULL) {
1187 *length = max_size;
1189 CheckGLError();
1191 void GLES2Implementation::GetRenderbufferParameteriv(GLenum target,
1192 GLenum pname,
1193 GLint* params) {
1194 GPU_CLIENT_SINGLE_THREAD_CHECK();
1195 GPU_CLIENT_VALIDATE_DESTINATION_INITALIZATION(GLint, params);
1196 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetRenderbufferParameteriv("
1197 << GLES2Util::GetStringRenderBufferTarget(target) << ", "
1198 << GLES2Util::GetStringRenderBufferParameter(pname) << ", "
1199 << static_cast<const void*>(params) << ")");
1200 TRACE_EVENT0("gpu", "GLES2Implementation::GetRenderbufferParameteriv");
1201 if (GetRenderbufferParameterivHelper(target, pname, params)) {
1202 return;
1204 typedef cmds::GetRenderbufferParameteriv::Result Result;
1205 Result* result = GetResultAs<Result*>();
1206 if (!result) {
1207 return;
1209 result->SetNumResults(0);
1210 helper_->GetRenderbufferParameteriv(target, pname, GetResultShmId(),
1211 GetResultShmOffset());
1212 WaitForCmd();
1213 result->CopyResult(params);
1214 GPU_CLIENT_LOG_CODE_BLOCK({
1215 for (int32_t i = 0; i < result->GetNumResults(); ++i) {
1216 GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]);
1219 CheckGLError();
1221 void GLES2Implementation::GetSamplerParameterfv(GLuint sampler,
1222 GLenum pname,
1223 GLfloat* params) {
1224 GPU_CLIENT_SINGLE_THREAD_CHECK();
1225 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetSamplerParameterfv("
1226 << sampler << ", "
1227 << GLES2Util::GetStringSamplerParameter(pname) << ", "
1228 << static_cast<const void*>(params) << ")");
1229 TRACE_EVENT0("gpu", "GLES2Implementation::GetSamplerParameterfv");
1230 if (GetSamplerParameterfvHelper(sampler, pname, params)) {
1231 return;
1233 typedef cmds::GetSamplerParameterfv::Result Result;
1234 Result* result = GetResultAs<Result*>();
1235 if (!result) {
1236 return;
1238 result->SetNumResults(0);
1239 helper_->GetSamplerParameterfv(sampler, pname, GetResultShmId(),
1240 GetResultShmOffset());
1241 WaitForCmd();
1242 result->CopyResult(params);
1243 GPU_CLIENT_LOG_CODE_BLOCK({
1244 for (int32_t i = 0; i < result->GetNumResults(); ++i) {
1245 GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]);
1248 CheckGLError();
1250 void GLES2Implementation::GetSamplerParameteriv(GLuint sampler,
1251 GLenum pname,
1252 GLint* params) {
1253 GPU_CLIENT_SINGLE_THREAD_CHECK();
1254 GPU_CLIENT_VALIDATE_DESTINATION_INITALIZATION(GLint, params);
1255 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetSamplerParameteriv("
1256 << sampler << ", "
1257 << GLES2Util::GetStringSamplerParameter(pname) << ", "
1258 << static_cast<const void*>(params) << ")");
1259 TRACE_EVENT0("gpu", "GLES2Implementation::GetSamplerParameteriv");
1260 if (GetSamplerParameterivHelper(sampler, pname, params)) {
1261 return;
1263 typedef cmds::GetSamplerParameteriv::Result Result;
1264 Result* result = GetResultAs<Result*>();
1265 if (!result) {
1266 return;
1268 result->SetNumResults(0);
1269 helper_->GetSamplerParameteriv(sampler, pname, GetResultShmId(),
1270 GetResultShmOffset());
1271 WaitForCmd();
1272 result->CopyResult(params);
1273 GPU_CLIENT_LOG_CODE_BLOCK({
1274 for (int32_t i = 0; i < result->GetNumResults(); ++i) {
1275 GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]);
1278 CheckGLError();
1280 void GLES2Implementation::GetShaderiv(GLuint shader,
1281 GLenum pname,
1282 GLint* params) {
1283 GPU_CLIENT_SINGLE_THREAD_CHECK();
1284 GPU_CLIENT_VALIDATE_DESTINATION_INITALIZATION(GLint, params);
1285 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetShaderiv(" << shader << ", "
1286 << GLES2Util::GetStringShaderParameter(pname) << ", "
1287 << static_cast<const void*>(params) << ")");
1288 TRACE_EVENT0("gpu", "GLES2Implementation::GetShaderiv");
1289 if (GetShaderivHelper(shader, pname, params)) {
1290 return;
1292 typedef cmds::GetShaderiv::Result Result;
1293 Result* result = GetResultAs<Result*>();
1294 if (!result) {
1295 return;
1297 result->SetNumResults(0);
1298 helper_->GetShaderiv(shader, pname, GetResultShmId(), GetResultShmOffset());
1299 WaitForCmd();
1300 result->CopyResult(params);
1301 GPU_CLIENT_LOG_CODE_BLOCK({
1302 for (int32_t i = 0; i < result->GetNumResults(); ++i) {
1303 GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]);
1306 CheckGLError();
1308 void GLES2Implementation::GetShaderInfoLog(GLuint shader,
1309 GLsizei bufsize,
1310 GLsizei* length,
1311 char* infolog) {
1312 GPU_CLIENT_SINGLE_THREAD_CHECK();
1313 GPU_CLIENT_VALIDATE_DESTINATION_OPTIONAL_INITALIZATION(GLsizei, length);
1314 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetShaderInfoLog"
1315 << "(" << shader << ", " << bufsize << ", "
1316 << static_cast<void*>(length) << ", "
1317 << static_cast<void*>(infolog) << ")");
1318 helper_->SetBucketSize(kResultBucketId, 0);
1319 helper_->GetShaderInfoLog(shader, kResultBucketId);
1320 std::string str;
1321 GLsizei max_size = 0;
1322 if (GetBucketAsString(kResultBucketId, &str)) {
1323 if (bufsize > 0) {
1324 max_size = std::min(static_cast<size_t>(bufsize) - 1, str.size());
1325 memcpy(infolog, str.c_str(), max_size);
1326 infolog[max_size] = '\0';
1327 GPU_CLIENT_LOG("------\n" << infolog << "\n------");
1330 if (length != NULL) {
1331 *length = max_size;
1333 CheckGLError();
1335 void GLES2Implementation::GetShaderSource(GLuint shader,
1336 GLsizei bufsize,
1337 GLsizei* length,
1338 char* source) {
1339 GPU_CLIENT_SINGLE_THREAD_CHECK();
1340 GPU_CLIENT_VALIDATE_DESTINATION_OPTIONAL_INITALIZATION(GLsizei, length);
1341 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetShaderSource"
1342 << "(" << shader << ", " << bufsize << ", "
1343 << static_cast<void*>(length) << ", "
1344 << static_cast<void*>(source) << ")");
1345 helper_->SetBucketSize(kResultBucketId, 0);
1346 helper_->GetShaderSource(shader, kResultBucketId);
1347 std::string str;
1348 GLsizei max_size = 0;
1349 if (GetBucketAsString(kResultBucketId, &str)) {
1350 if (bufsize > 0) {
1351 max_size = std::min(static_cast<size_t>(bufsize) - 1, str.size());
1352 memcpy(source, str.c_str(), max_size);
1353 source[max_size] = '\0';
1354 GPU_CLIENT_LOG("------\n" << source << "\n------");
1357 if (length != NULL) {
1358 *length = max_size;
1360 CheckGLError();
1362 void GLES2Implementation::GetSynciv(GLsync sync,
1363 GLenum pname,
1364 GLsizei bufsize,
1365 GLsizei* length,
1366 GLint* values) {
1367 GPU_CLIENT_SINGLE_THREAD_CHECK();
1368 GPU_CLIENT_VALIDATE_DESTINATION_OPTIONAL_INITALIZATION(GLsizei, length);
1369 GPU_CLIENT_VALIDATE_DESTINATION_INITALIZATION(GLint, values);
1370 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetSynciv(" << sync << ", "
1371 << GLES2Util::GetStringSyncParameter(pname) << ", "
1372 << bufsize << ", " << static_cast<const void*>(length)
1373 << ", " << static_cast<const void*>(values) << ")");
1374 if (bufsize < 0) {
1375 SetGLError(GL_INVALID_VALUE, "glGetSynciv", "bufsize < 0");
1376 return;
1378 TRACE_EVENT0("gpu", "GLES2Implementation::GetSynciv");
1379 if (GetSyncivHelper(sync, pname, bufsize, length, values)) {
1380 return;
1382 typedef cmds::GetSynciv::Result Result;
1383 Result* result = GetResultAs<Result*>();
1384 if (!result) {
1385 return;
1387 result->SetNumResults(0);
1388 helper_->GetSynciv(ToGLuint(sync), pname, GetResultShmId(),
1389 GetResultShmOffset());
1390 WaitForCmd();
1391 result->CopyResult(values);
1392 GPU_CLIENT_LOG_CODE_BLOCK({
1393 for (int32_t i = 0; i < result->GetNumResults(); ++i) {
1394 GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]);
1397 if (length) {
1398 *length = result->GetNumResults();
1400 CheckGLError();
1402 void GLES2Implementation::GetTexParameterfv(GLenum target,
1403 GLenum pname,
1404 GLfloat* params) {
1405 GPU_CLIENT_SINGLE_THREAD_CHECK();
1406 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetTexParameterfv("
1407 << GLES2Util::GetStringGetTexParamTarget(target) << ", "
1408 << GLES2Util::GetStringTextureParameter(pname) << ", "
1409 << static_cast<const void*>(params) << ")");
1410 TRACE_EVENT0("gpu", "GLES2Implementation::GetTexParameterfv");
1411 if (GetTexParameterfvHelper(target, pname, params)) {
1412 return;
1414 typedef cmds::GetTexParameterfv::Result Result;
1415 Result* result = GetResultAs<Result*>();
1416 if (!result) {
1417 return;
1419 result->SetNumResults(0);
1420 helper_->GetTexParameterfv(target, pname, GetResultShmId(),
1421 GetResultShmOffset());
1422 WaitForCmd();
1423 result->CopyResult(params);
1424 GPU_CLIENT_LOG_CODE_BLOCK({
1425 for (int32_t i = 0; i < result->GetNumResults(); ++i) {
1426 GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]);
1429 CheckGLError();
1431 void GLES2Implementation::GetTexParameteriv(GLenum target,
1432 GLenum pname,
1433 GLint* params) {
1434 GPU_CLIENT_SINGLE_THREAD_CHECK();
1435 GPU_CLIENT_VALIDATE_DESTINATION_INITALIZATION(GLint, params);
1436 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetTexParameteriv("
1437 << GLES2Util::GetStringGetTexParamTarget(target) << ", "
1438 << GLES2Util::GetStringTextureParameter(pname) << ", "
1439 << static_cast<const void*>(params) << ")");
1440 TRACE_EVENT0("gpu", "GLES2Implementation::GetTexParameteriv");
1441 if (GetTexParameterivHelper(target, pname, params)) {
1442 return;
1444 typedef cmds::GetTexParameteriv::Result Result;
1445 Result* result = GetResultAs<Result*>();
1446 if (!result) {
1447 return;
1449 result->SetNumResults(0);
1450 helper_->GetTexParameteriv(target, pname, GetResultShmId(),
1451 GetResultShmOffset());
1452 WaitForCmd();
1453 result->CopyResult(params);
1454 GPU_CLIENT_LOG_CODE_BLOCK({
1455 for (int32_t i = 0; i < result->GetNumResults(); ++i) {
1456 GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]);
1459 CheckGLError();
1461 void GLES2Implementation::Hint(GLenum target, GLenum mode) {
1462 GPU_CLIENT_SINGLE_THREAD_CHECK();
1463 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glHint("
1464 << GLES2Util::GetStringHintTarget(target) << ", "
1465 << GLES2Util::GetStringHintMode(mode) << ")");
1466 helper_->Hint(target, mode);
1467 CheckGLError();
1470 void GLES2Implementation::InvalidateFramebuffer(GLenum target,
1471 GLsizei count,
1472 const GLenum* attachments) {
1473 GPU_CLIENT_SINGLE_THREAD_CHECK();
1474 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glInvalidateFramebuffer("
1475 << GLES2Util::GetStringInvalidateFrameBufferTarget(target)
1476 << ", " << count << ", "
1477 << static_cast<const void*>(attachments) << ")");
1478 GPU_CLIENT_LOG_CODE_BLOCK({
1479 for (GLsizei i = 0; i < count; ++i) {
1480 GPU_CLIENT_LOG(" " << i << ": " << attachments[0 + i * 1]);
1483 if (count < 0) {
1484 SetGLError(GL_INVALID_VALUE, "glInvalidateFramebuffer", "count < 0");
1485 return;
1487 helper_->InvalidateFramebufferImmediate(target, count, attachments);
1488 CheckGLError();
1491 void GLES2Implementation::InvalidateSubFramebuffer(GLenum target,
1492 GLsizei count,
1493 const GLenum* attachments,
1494 GLint x,
1495 GLint y,
1496 GLsizei width,
1497 GLsizei height) {
1498 GPU_CLIENT_SINGLE_THREAD_CHECK();
1499 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glInvalidateSubFramebuffer("
1500 << GLES2Util::GetStringInvalidateFrameBufferTarget(target)
1501 << ", " << count << ", "
1502 << static_cast<const void*>(attachments) << ", " << x
1503 << ", " << y << ", " << width << ", " << height << ")");
1504 GPU_CLIENT_LOG_CODE_BLOCK({
1505 for (GLsizei i = 0; i < count; ++i) {
1506 GPU_CLIENT_LOG(" " << i << ": " << attachments[0 + i * 1]);
1509 if (count < 0) {
1510 SetGLError(GL_INVALID_VALUE, "glInvalidateSubFramebuffer", "count < 0");
1511 return;
1513 if (width < 0) {
1514 SetGLError(GL_INVALID_VALUE, "glInvalidateSubFramebuffer", "width < 0");
1515 return;
1517 if (height < 0) {
1518 SetGLError(GL_INVALID_VALUE, "glInvalidateSubFramebuffer", "height < 0");
1519 return;
1521 helper_->InvalidateSubFramebufferImmediate(target, count, attachments, x, y,
1522 width, height);
1523 CheckGLError();
1526 GLboolean GLES2Implementation::IsBuffer(GLuint buffer) {
1527 GPU_CLIENT_SINGLE_THREAD_CHECK();
1528 TRACE_EVENT0("gpu", "GLES2Implementation::IsBuffer");
1529 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glIsBuffer(" << buffer << ")");
1530 typedef cmds::IsBuffer::Result Result;
1531 Result* result = GetResultAs<Result*>();
1532 if (!result) {
1533 return GL_FALSE;
1535 *result = 0;
1536 helper_->IsBuffer(buffer, GetResultShmId(), GetResultShmOffset());
1537 WaitForCmd();
1538 GLboolean result_value = *result != 0;
1539 GPU_CLIENT_LOG("returned " << result_value);
1540 CheckGLError();
1541 return result_value;
1544 GLboolean GLES2Implementation::IsFramebuffer(GLuint framebuffer) {
1545 GPU_CLIENT_SINGLE_THREAD_CHECK();
1546 TRACE_EVENT0("gpu", "GLES2Implementation::IsFramebuffer");
1547 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glIsFramebuffer(" << framebuffer
1548 << ")");
1549 typedef cmds::IsFramebuffer::Result Result;
1550 Result* result = GetResultAs<Result*>();
1551 if (!result) {
1552 return GL_FALSE;
1554 *result = 0;
1555 helper_->IsFramebuffer(framebuffer, GetResultShmId(), GetResultShmOffset());
1556 WaitForCmd();
1557 GLboolean result_value = *result != 0;
1558 GPU_CLIENT_LOG("returned " << result_value);
1559 CheckGLError();
1560 return result_value;
1563 GLboolean GLES2Implementation::IsProgram(GLuint program) {
1564 GPU_CLIENT_SINGLE_THREAD_CHECK();
1565 TRACE_EVENT0("gpu", "GLES2Implementation::IsProgram");
1566 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glIsProgram(" << program << ")");
1567 typedef cmds::IsProgram::Result Result;
1568 Result* result = GetResultAs<Result*>();
1569 if (!result) {
1570 return GL_FALSE;
1572 *result = 0;
1573 helper_->IsProgram(program, GetResultShmId(), GetResultShmOffset());
1574 WaitForCmd();
1575 GLboolean result_value = *result != 0;
1576 GPU_CLIENT_LOG("returned " << result_value);
1577 CheckGLError();
1578 return result_value;
1581 GLboolean GLES2Implementation::IsRenderbuffer(GLuint renderbuffer) {
1582 GPU_CLIENT_SINGLE_THREAD_CHECK();
1583 TRACE_EVENT0("gpu", "GLES2Implementation::IsRenderbuffer");
1584 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glIsRenderbuffer(" << renderbuffer
1585 << ")");
1586 typedef cmds::IsRenderbuffer::Result Result;
1587 Result* result = GetResultAs<Result*>();
1588 if (!result) {
1589 return GL_FALSE;
1591 *result = 0;
1592 helper_->IsRenderbuffer(renderbuffer, GetResultShmId(), GetResultShmOffset());
1593 WaitForCmd();
1594 GLboolean result_value = *result != 0;
1595 GPU_CLIENT_LOG("returned " << result_value);
1596 CheckGLError();
1597 return result_value;
1600 GLboolean GLES2Implementation::IsSampler(GLuint sampler) {
1601 GPU_CLIENT_SINGLE_THREAD_CHECK();
1602 TRACE_EVENT0("gpu", "GLES2Implementation::IsSampler");
1603 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glIsSampler(" << sampler << ")");
1604 typedef cmds::IsSampler::Result Result;
1605 Result* result = GetResultAs<Result*>();
1606 if (!result) {
1607 return GL_FALSE;
1609 *result = 0;
1610 helper_->IsSampler(sampler, GetResultShmId(), GetResultShmOffset());
1611 WaitForCmd();
1612 GLboolean result_value = *result != 0;
1613 GPU_CLIENT_LOG("returned " << result_value);
1614 CheckGLError();
1615 return result_value;
1618 GLboolean GLES2Implementation::IsShader(GLuint shader) {
1619 GPU_CLIENT_SINGLE_THREAD_CHECK();
1620 TRACE_EVENT0("gpu", "GLES2Implementation::IsShader");
1621 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glIsShader(" << shader << ")");
1622 typedef cmds::IsShader::Result Result;
1623 Result* result = GetResultAs<Result*>();
1624 if (!result) {
1625 return GL_FALSE;
1627 *result = 0;
1628 helper_->IsShader(shader, GetResultShmId(), GetResultShmOffset());
1629 WaitForCmd();
1630 GLboolean result_value = *result != 0;
1631 GPU_CLIENT_LOG("returned " << result_value);
1632 CheckGLError();
1633 return result_value;
1636 GLboolean GLES2Implementation::IsSync(GLsync sync) {
1637 GPU_CLIENT_SINGLE_THREAD_CHECK();
1638 TRACE_EVENT0("gpu", "GLES2Implementation::IsSync");
1639 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glIsSync(" << sync << ")");
1640 typedef cmds::IsSync::Result Result;
1641 Result* result = GetResultAs<Result*>();
1642 if (!result) {
1643 return GL_FALSE;
1645 *result = 0;
1646 helper_->IsSync(ToGLuint(sync), GetResultShmId(), GetResultShmOffset());
1647 WaitForCmd();
1648 GLboolean result_value = *result != 0;
1649 GPU_CLIENT_LOG("returned " << result_value);
1650 CheckGLError();
1651 return result_value;
1654 GLboolean GLES2Implementation::IsTexture(GLuint texture) {
1655 GPU_CLIENT_SINGLE_THREAD_CHECK();
1656 TRACE_EVENT0("gpu", "GLES2Implementation::IsTexture");
1657 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glIsTexture(" << texture << ")");
1658 typedef cmds::IsTexture::Result Result;
1659 Result* result = GetResultAs<Result*>();
1660 if (!result) {
1661 return GL_FALSE;
1663 *result = 0;
1664 helper_->IsTexture(texture, GetResultShmId(), GetResultShmOffset());
1665 WaitForCmd();
1666 GLboolean result_value = *result != 0;
1667 GPU_CLIENT_LOG("returned " << result_value);
1668 CheckGLError();
1669 return result_value;
1672 GLboolean GLES2Implementation::IsTransformFeedback(GLuint transformfeedback) {
1673 GPU_CLIENT_SINGLE_THREAD_CHECK();
1674 TRACE_EVENT0("gpu", "GLES2Implementation::IsTransformFeedback");
1675 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glIsTransformFeedback("
1676 << transformfeedback << ")");
1677 typedef cmds::IsTransformFeedback::Result Result;
1678 Result* result = GetResultAs<Result*>();
1679 if (!result) {
1680 return GL_FALSE;
1682 *result = 0;
1683 helper_->IsTransformFeedback(transformfeedback, GetResultShmId(),
1684 GetResultShmOffset());
1685 WaitForCmd();
1686 GLboolean result_value = *result != 0;
1687 GPU_CLIENT_LOG("returned " << result_value);
1688 CheckGLError();
1689 return result_value;
1692 void GLES2Implementation::LineWidth(GLfloat width) {
1693 GPU_CLIENT_SINGLE_THREAD_CHECK();
1694 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glLineWidth(" << width << ")");
1695 helper_->LineWidth(width);
1696 CheckGLError();
1699 void GLES2Implementation::PauseTransformFeedback() {
1700 GPU_CLIENT_SINGLE_THREAD_CHECK();
1701 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glPauseTransformFeedback("
1702 << ")");
1703 helper_->PauseTransformFeedback();
1704 CheckGLError();
1707 void GLES2Implementation::PolygonOffset(GLfloat factor, GLfloat units) {
1708 GPU_CLIENT_SINGLE_THREAD_CHECK();
1709 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glPolygonOffset(" << factor << ", "
1710 << units << ")");
1711 helper_->PolygonOffset(factor, units);
1712 CheckGLError();
1715 void GLES2Implementation::ReadBuffer(GLenum src) {
1716 GPU_CLIENT_SINGLE_THREAD_CHECK();
1717 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glReadBuffer("
1718 << GLES2Util::GetStringReadBuffer(src) << ")");
1719 helper_->ReadBuffer(src);
1720 CheckGLError();
1723 void GLES2Implementation::ReleaseShaderCompiler() {
1724 GPU_CLIENT_SINGLE_THREAD_CHECK();
1725 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glReleaseShaderCompiler("
1726 << ")");
1727 helper_->ReleaseShaderCompiler();
1728 CheckGLError();
1731 void GLES2Implementation::RenderbufferStorage(GLenum target,
1732 GLenum internalformat,
1733 GLsizei width,
1734 GLsizei height) {
1735 GPU_CLIENT_SINGLE_THREAD_CHECK();
1736 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glRenderbufferStorage("
1737 << GLES2Util::GetStringRenderBufferTarget(target) << ", "
1738 << GLES2Util::GetStringRenderBufferFormat(internalformat)
1739 << ", " << width << ", " << height << ")");
1740 if (width < 0) {
1741 SetGLError(GL_INVALID_VALUE, "glRenderbufferStorage", "width < 0");
1742 return;
1744 if (height < 0) {
1745 SetGLError(GL_INVALID_VALUE, "glRenderbufferStorage", "height < 0");
1746 return;
1748 helper_->RenderbufferStorage(target, internalformat, width, height);
1749 CheckGLError();
1752 void GLES2Implementation::ResumeTransformFeedback() {
1753 GPU_CLIENT_SINGLE_THREAD_CHECK();
1754 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glResumeTransformFeedback("
1755 << ")");
1756 helper_->ResumeTransformFeedback();
1757 CheckGLError();
1760 void GLES2Implementation::SampleCoverage(GLclampf value, GLboolean invert) {
1761 GPU_CLIENT_SINGLE_THREAD_CHECK();
1762 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glSampleCoverage(" << value << ", "
1763 << GLES2Util::GetStringBool(invert) << ")");
1764 helper_->SampleCoverage(value, invert);
1765 CheckGLError();
1768 void GLES2Implementation::SamplerParameterf(GLuint sampler,
1769 GLenum pname,
1770 GLfloat param) {
1771 GPU_CLIENT_SINGLE_THREAD_CHECK();
1772 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glSamplerParameterf(" << sampler
1773 << ", " << GLES2Util::GetStringSamplerParameter(pname)
1774 << ", " << param << ")");
1775 helper_->SamplerParameterf(sampler, pname, param);
1776 CheckGLError();
1779 void GLES2Implementation::SamplerParameterfv(GLuint sampler,
1780 GLenum pname,
1781 const GLfloat* params) {
1782 GPU_CLIENT_SINGLE_THREAD_CHECK();
1783 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glSamplerParameterfv(" << sampler
1784 << ", " << GLES2Util::GetStringSamplerParameter(pname)
1785 << ", " << static_cast<const void*>(params) << ")");
1786 size_t count = 1;
1787 for (size_t ii = 0; ii < count; ++ii)
1788 GPU_CLIENT_LOG("value[" << ii << "]: " << params[ii]);
1789 helper_->SamplerParameterfvImmediate(sampler, pname, params);
1790 CheckGLError();
1793 void GLES2Implementation::SamplerParameteri(GLuint sampler,
1794 GLenum pname,
1795 GLint param) {
1796 GPU_CLIENT_SINGLE_THREAD_CHECK();
1797 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glSamplerParameteri(" << sampler
1798 << ", " << GLES2Util::GetStringSamplerParameter(pname)
1799 << ", " << param << ")");
1800 helper_->SamplerParameteri(sampler, pname, param);
1801 CheckGLError();
1804 void GLES2Implementation::SamplerParameteriv(GLuint sampler,
1805 GLenum pname,
1806 const GLint* params) {
1807 GPU_CLIENT_SINGLE_THREAD_CHECK();
1808 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glSamplerParameteriv(" << sampler
1809 << ", " << GLES2Util::GetStringSamplerParameter(pname)
1810 << ", " << static_cast<const void*>(params) << ")");
1811 size_t count = 1;
1812 for (size_t ii = 0; ii < count; ++ii)
1813 GPU_CLIENT_LOG("value[" << ii << "]: " << params[ii]);
1814 helper_->SamplerParameterivImmediate(sampler, pname, params);
1815 CheckGLError();
1818 void GLES2Implementation::Scissor(GLint x,
1819 GLint y,
1820 GLsizei width,
1821 GLsizei height) {
1822 GPU_CLIENT_SINGLE_THREAD_CHECK();
1823 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glScissor(" << x << ", " << y
1824 << ", " << width << ", " << height << ")");
1825 if (width < 0) {
1826 SetGLError(GL_INVALID_VALUE, "glScissor", "width < 0");
1827 return;
1829 if (height < 0) {
1830 SetGLError(GL_INVALID_VALUE, "glScissor", "height < 0");
1831 return;
1833 helper_->Scissor(x, y, width, height);
1834 CheckGLError();
1837 void GLES2Implementation::ShaderSource(GLuint shader,
1838 GLsizei count,
1839 const GLchar* const* str,
1840 const GLint* length) {
1841 GPU_CLIENT_SINGLE_THREAD_CHECK();
1842 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glShaderSource(" << shader << ", "
1843 << count << ", " << static_cast<const void*>(str) << ", "
1844 << static_cast<const void*>(length) << ")");
1845 GPU_CLIENT_LOG_CODE_BLOCK({
1846 for (GLsizei ii = 0; ii < count; ++ii) {
1847 if (str[ii]) {
1848 if (length && length[ii] >= 0) {
1849 const std::string my_str(str[ii], length[ii]);
1850 GPU_CLIENT_LOG(" " << ii << ": ---\n" << my_str << "\n---");
1851 } else {
1852 GPU_CLIENT_LOG(" " << ii << ": ---\n" << str[ii] << "\n---");
1854 } else {
1855 GPU_CLIENT_LOG(" " << ii << ": NULL");
1859 if (count < 0) {
1860 SetGLError(GL_INVALID_VALUE, "glShaderSource", "count < 0");
1861 return;
1864 if (!PackStringsToBucket(count, str, length, "glShaderSource")) {
1865 return;
1867 helper_->ShaderSourceBucket(shader, kResultBucketId);
1868 helper_->SetBucketSize(kResultBucketId, 0);
1869 CheckGLError();
1872 void GLES2Implementation::StencilFunc(GLenum func, GLint ref, GLuint mask) {
1873 GPU_CLIENT_SINGLE_THREAD_CHECK();
1874 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glStencilFunc("
1875 << GLES2Util::GetStringCmpFunction(func) << ", " << ref
1876 << ", " << mask << ")");
1877 helper_->StencilFunc(func, ref, mask);
1878 CheckGLError();
1881 void GLES2Implementation::StencilFuncSeparate(GLenum face,
1882 GLenum func,
1883 GLint ref,
1884 GLuint mask) {
1885 GPU_CLIENT_SINGLE_THREAD_CHECK();
1886 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glStencilFuncSeparate("
1887 << GLES2Util::GetStringFaceType(face) << ", "
1888 << GLES2Util::GetStringCmpFunction(func) << ", " << ref
1889 << ", " << mask << ")");
1890 helper_->StencilFuncSeparate(face, func, ref, mask);
1891 CheckGLError();
1894 void GLES2Implementation::StencilMask(GLuint mask) {
1895 GPU_CLIENT_SINGLE_THREAD_CHECK();
1896 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glStencilMask(" << mask << ")");
1897 helper_->StencilMask(mask);
1898 CheckGLError();
1901 void GLES2Implementation::StencilMaskSeparate(GLenum face, GLuint mask) {
1902 GPU_CLIENT_SINGLE_THREAD_CHECK();
1903 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glStencilMaskSeparate("
1904 << GLES2Util::GetStringFaceType(face) << ", " << mask
1905 << ")");
1906 helper_->StencilMaskSeparate(face, mask);
1907 CheckGLError();
1910 void GLES2Implementation::StencilOp(GLenum fail, GLenum zfail, GLenum zpass) {
1911 GPU_CLIENT_SINGLE_THREAD_CHECK();
1912 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glStencilOp("
1913 << GLES2Util::GetStringStencilOp(fail) << ", "
1914 << GLES2Util::GetStringStencilOp(zfail) << ", "
1915 << GLES2Util::GetStringStencilOp(zpass) << ")");
1916 helper_->StencilOp(fail, zfail, zpass);
1917 CheckGLError();
1920 void GLES2Implementation::StencilOpSeparate(GLenum face,
1921 GLenum fail,
1922 GLenum zfail,
1923 GLenum zpass) {
1924 GPU_CLIENT_SINGLE_THREAD_CHECK();
1925 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glStencilOpSeparate("
1926 << GLES2Util::GetStringFaceType(face) << ", "
1927 << GLES2Util::GetStringStencilOp(fail) << ", "
1928 << GLES2Util::GetStringStencilOp(zfail) << ", "
1929 << GLES2Util::GetStringStencilOp(zpass) << ")");
1930 helper_->StencilOpSeparate(face, fail, zfail, zpass);
1931 CheckGLError();
1934 void GLES2Implementation::TexParameterf(GLenum target,
1935 GLenum pname,
1936 GLfloat param) {
1937 GPU_CLIENT_SINGLE_THREAD_CHECK();
1938 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glTexParameterf("
1939 << GLES2Util::GetStringTextureBindTarget(target) << ", "
1940 << GLES2Util::GetStringTextureParameter(pname) << ", "
1941 << param << ")");
1942 helper_->TexParameterf(target, pname, param);
1943 CheckGLError();
1946 void GLES2Implementation::TexParameterfv(GLenum target,
1947 GLenum pname,
1948 const GLfloat* params) {
1949 GPU_CLIENT_SINGLE_THREAD_CHECK();
1950 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glTexParameterfv("
1951 << GLES2Util::GetStringTextureBindTarget(target) << ", "
1952 << GLES2Util::GetStringTextureParameter(pname) << ", "
1953 << static_cast<const void*>(params) << ")");
1954 size_t count = 1;
1955 for (size_t ii = 0; ii < count; ++ii)
1956 GPU_CLIENT_LOG("value[" << ii << "]: " << params[ii]);
1957 helper_->TexParameterfvImmediate(target, pname, params);
1958 CheckGLError();
1961 void GLES2Implementation::TexParameteri(GLenum target,
1962 GLenum pname,
1963 GLint param) {
1964 GPU_CLIENT_SINGLE_THREAD_CHECK();
1965 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glTexParameteri("
1966 << GLES2Util::GetStringTextureBindTarget(target) << ", "
1967 << GLES2Util::GetStringTextureParameter(pname) << ", "
1968 << param << ")");
1969 helper_->TexParameteri(target, pname, param);
1970 CheckGLError();
1973 void GLES2Implementation::TexParameteriv(GLenum target,
1974 GLenum pname,
1975 const GLint* params) {
1976 GPU_CLIENT_SINGLE_THREAD_CHECK();
1977 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glTexParameteriv("
1978 << GLES2Util::GetStringTextureBindTarget(target) << ", "
1979 << GLES2Util::GetStringTextureParameter(pname) << ", "
1980 << static_cast<const void*>(params) << ")");
1981 size_t count = 1;
1982 for (size_t ii = 0; ii < count; ++ii)
1983 GPU_CLIENT_LOG("value[" << ii << "]: " << params[ii]);
1984 helper_->TexParameterivImmediate(target, pname, params);
1985 CheckGLError();
1988 void GLES2Implementation::TexStorage3D(GLenum target,
1989 GLsizei levels,
1990 GLenum internalFormat,
1991 GLsizei width,
1992 GLsizei height,
1993 GLsizei depth) {
1994 GPU_CLIENT_SINGLE_THREAD_CHECK();
1995 GPU_CLIENT_LOG(
1996 "[" << GetLogPrefix() << "] glTexStorage3D("
1997 << GLES2Util::GetStringTexture3DTarget(target) << ", " << levels
1998 << ", "
1999 << GLES2Util::GetStringTextureInternalFormatStorage(internalFormat)
2000 << ", " << width << ", " << height << ", " << depth << ")");
2001 if (levels < 0) {
2002 SetGLError(GL_INVALID_VALUE, "glTexStorage3D", "levels < 0");
2003 return;
2005 if (width < 0) {
2006 SetGLError(GL_INVALID_VALUE, "glTexStorage3D", "width < 0");
2007 return;
2009 if (height < 0) {
2010 SetGLError(GL_INVALID_VALUE, "glTexStorage3D", "height < 0");
2011 return;
2013 if (depth < 0) {
2014 SetGLError(GL_INVALID_VALUE, "glTexStorage3D", "depth < 0");
2015 return;
2017 helper_->TexStorage3D(target, levels, internalFormat, width, height, depth);
2018 CheckGLError();
2021 void GLES2Implementation::TransformFeedbackVaryings(GLuint program,
2022 GLsizei count,
2023 const char* const* varyings,
2024 GLenum buffermode) {
2025 GPU_CLIENT_SINGLE_THREAD_CHECK();
2026 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glTransformFeedbackVaryings("
2027 << program << ", " << count << ", "
2028 << static_cast<const void*>(varyings) << ", "
2029 << GLES2Util::GetStringBufferMode(buffermode) << ")");
2030 GPU_CLIENT_LOG_CODE_BLOCK({
2031 for (GLsizei ii = 0; ii < count; ++ii) {
2032 if (varyings[ii]) {
2033 GPU_CLIENT_LOG(" " << ii << ": ---\n" << varyings[ii] << "\n---");
2034 } else {
2035 GPU_CLIENT_LOG(" " << ii << ": NULL");
2039 if (count < 0) {
2040 SetGLError(GL_INVALID_VALUE, "glTransformFeedbackVaryings", "count < 0");
2041 return;
2044 if (!PackStringsToBucket(count, varyings, NULL,
2045 "glTransformFeedbackVaryings")) {
2046 return;
2048 helper_->TransformFeedbackVaryingsBucket(program, kResultBucketId,
2049 buffermode);
2050 helper_->SetBucketSize(kResultBucketId, 0);
2051 CheckGLError();
2054 void GLES2Implementation::Uniform1f(GLint location, GLfloat x) {
2055 GPU_CLIENT_SINGLE_THREAD_CHECK();
2056 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform1f(" << location << ", "
2057 << x << ")");
2058 helper_->Uniform1f(location, x);
2059 CheckGLError();
2062 void GLES2Implementation::Uniform1fv(GLint location,
2063 GLsizei count,
2064 const GLfloat* v) {
2065 GPU_CLIENT_SINGLE_THREAD_CHECK();
2066 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform1fv(" << location << ", "
2067 << count << ", " << static_cast<const void*>(v) << ")");
2068 GPU_CLIENT_LOG_CODE_BLOCK({
2069 for (GLsizei i = 0; i < count; ++i) {
2070 GPU_CLIENT_LOG(" " << i << ": " << v[0 + i * 1]);
2073 if (count < 0) {
2074 SetGLError(GL_INVALID_VALUE, "glUniform1fv", "count < 0");
2075 return;
2077 helper_->Uniform1fvImmediate(location, count, v);
2078 CheckGLError();
2081 void GLES2Implementation::Uniform1i(GLint location, GLint x) {
2082 GPU_CLIENT_SINGLE_THREAD_CHECK();
2083 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform1i(" << location << ", "
2084 << x << ")");
2085 helper_->Uniform1i(location, x);
2086 CheckGLError();
2089 void GLES2Implementation::Uniform1iv(GLint location,
2090 GLsizei count,
2091 const GLint* v) {
2092 GPU_CLIENT_SINGLE_THREAD_CHECK();
2093 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform1iv(" << location << ", "
2094 << count << ", " << static_cast<const void*>(v) << ")");
2095 GPU_CLIENT_LOG_CODE_BLOCK({
2096 for (GLsizei i = 0; i < count; ++i) {
2097 GPU_CLIENT_LOG(" " << i << ": " << v[0 + i * 1]);
2100 if (count < 0) {
2101 SetGLError(GL_INVALID_VALUE, "glUniform1iv", "count < 0");
2102 return;
2104 helper_->Uniform1ivImmediate(location, count, v);
2105 CheckGLError();
2108 void GLES2Implementation::Uniform1ui(GLint location, GLuint x) {
2109 GPU_CLIENT_SINGLE_THREAD_CHECK();
2110 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform1ui(" << location << ", "
2111 << x << ")");
2112 helper_->Uniform1ui(location, x);
2113 CheckGLError();
2116 void GLES2Implementation::Uniform1uiv(GLint location,
2117 GLsizei count,
2118 const GLuint* v) {
2119 GPU_CLIENT_SINGLE_THREAD_CHECK();
2120 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform1uiv(" << location << ", "
2121 << count << ", " << static_cast<const void*>(v) << ")");
2122 GPU_CLIENT_LOG_CODE_BLOCK({
2123 for (GLsizei i = 0; i < count; ++i) {
2124 GPU_CLIENT_LOG(" " << i << ": " << v[0 + i * 1]);
2127 if (count < 0) {
2128 SetGLError(GL_INVALID_VALUE, "glUniform1uiv", "count < 0");
2129 return;
2131 helper_->Uniform1uivImmediate(location, count, v);
2132 CheckGLError();
2135 void GLES2Implementation::Uniform2f(GLint location, GLfloat x, GLfloat y) {
2136 GPU_CLIENT_SINGLE_THREAD_CHECK();
2137 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform2f(" << location << ", "
2138 << x << ", " << y << ")");
2139 helper_->Uniform2f(location, x, y);
2140 CheckGLError();
2143 void GLES2Implementation::Uniform2fv(GLint location,
2144 GLsizei count,
2145 const GLfloat* v) {
2146 GPU_CLIENT_SINGLE_THREAD_CHECK();
2147 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform2fv(" << location << ", "
2148 << count << ", " << static_cast<const void*>(v) << ")");
2149 GPU_CLIENT_LOG_CODE_BLOCK({
2150 for (GLsizei i = 0; i < count; ++i) {
2151 GPU_CLIENT_LOG(" " << i << ": " << v[0 + i * 2] << ", " << v[1 + i * 2]);
2154 if (count < 0) {
2155 SetGLError(GL_INVALID_VALUE, "glUniform2fv", "count < 0");
2156 return;
2158 helper_->Uniform2fvImmediate(location, count, v);
2159 CheckGLError();
2162 void GLES2Implementation::Uniform2i(GLint location, GLint x, GLint y) {
2163 GPU_CLIENT_SINGLE_THREAD_CHECK();
2164 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform2i(" << location << ", "
2165 << x << ", " << y << ")");
2166 helper_->Uniform2i(location, x, y);
2167 CheckGLError();
2170 void GLES2Implementation::Uniform2iv(GLint location,
2171 GLsizei count,
2172 const GLint* v) {
2173 GPU_CLIENT_SINGLE_THREAD_CHECK();
2174 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform2iv(" << location << ", "
2175 << count << ", " << static_cast<const void*>(v) << ")");
2176 GPU_CLIENT_LOG_CODE_BLOCK({
2177 for (GLsizei i = 0; i < count; ++i) {
2178 GPU_CLIENT_LOG(" " << i << ": " << v[0 + i * 2] << ", " << v[1 + i * 2]);
2181 if (count < 0) {
2182 SetGLError(GL_INVALID_VALUE, "glUniform2iv", "count < 0");
2183 return;
2185 helper_->Uniform2ivImmediate(location, count, v);
2186 CheckGLError();
2189 void GLES2Implementation::Uniform2ui(GLint location, GLuint x, GLuint y) {
2190 GPU_CLIENT_SINGLE_THREAD_CHECK();
2191 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform2ui(" << location << ", "
2192 << x << ", " << y << ")");
2193 helper_->Uniform2ui(location, x, y);
2194 CheckGLError();
2197 void GLES2Implementation::Uniform2uiv(GLint location,
2198 GLsizei count,
2199 const GLuint* v) {
2200 GPU_CLIENT_SINGLE_THREAD_CHECK();
2201 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform2uiv(" << location << ", "
2202 << count << ", " << static_cast<const void*>(v) << ")");
2203 GPU_CLIENT_LOG_CODE_BLOCK({
2204 for (GLsizei i = 0; i < count; ++i) {
2205 GPU_CLIENT_LOG(" " << i << ": " << v[0 + i * 2] << ", " << v[1 + i * 2]);
2208 if (count < 0) {
2209 SetGLError(GL_INVALID_VALUE, "glUniform2uiv", "count < 0");
2210 return;
2212 helper_->Uniform2uivImmediate(location, count, v);
2213 CheckGLError();
2216 void GLES2Implementation::Uniform3f(GLint location,
2217 GLfloat x,
2218 GLfloat y,
2219 GLfloat z) {
2220 GPU_CLIENT_SINGLE_THREAD_CHECK();
2221 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform3f(" << location << ", "
2222 << x << ", " << y << ", " << z << ")");
2223 helper_->Uniform3f(location, x, y, z);
2224 CheckGLError();
2227 void GLES2Implementation::Uniform3fv(GLint location,
2228 GLsizei count,
2229 const GLfloat* v) {
2230 GPU_CLIENT_SINGLE_THREAD_CHECK();
2231 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform3fv(" << location << ", "
2232 << count << ", " << static_cast<const void*>(v) << ")");
2233 GPU_CLIENT_LOG_CODE_BLOCK({
2234 for (GLsizei i = 0; i < count; ++i) {
2235 GPU_CLIENT_LOG(" " << i << ": " << v[0 + i * 3] << ", " << v[1 + i * 3]
2236 << ", " << v[2 + i * 3]);
2239 if (count < 0) {
2240 SetGLError(GL_INVALID_VALUE, "glUniform3fv", "count < 0");
2241 return;
2243 helper_->Uniform3fvImmediate(location, count, v);
2244 CheckGLError();
2247 void GLES2Implementation::Uniform3i(GLint location, GLint x, GLint y, GLint z) {
2248 GPU_CLIENT_SINGLE_THREAD_CHECK();
2249 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform3i(" << location << ", "
2250 << x << ", " << y << ", " << z << ")");
2251 helper_->Uniform3i(location, x, y, z);
2252 CheckGLError();
2255 void GLES2Implementation::Uniform3iv(GLint location,
2256 GLsizei count,
2257 const GLint* v) {
2258 GPU_CLIENT_SINGLE_THREAD_CHECK();
2259 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform3iv(" << location << ", "
2260 << count << ", " << static_cast<const void*>(v) << ")");
2261 GPU_CLIENT_LOG_CODE_BLOCK({
2262 for (GLsizei i = 0; i < count; ++i) {
2263 GPU_CLIENT_LOG(" " << i << ": " << v[0 + i * 3] << ", " << v[1 + i * 3]
2264 << ", " << v[2 + i * 3]);
2267 if (count < 0) {
2268 SetGLError(GL_INVALID_VALUE, "glUniform3iv", "count < 0");
2269 return;
2271 helper_->Uniform3ivImmediate(location, count, v);
2272 CheckGLError();
2275 void GLES2Implementation::Uniform3ui(GLint location,
2276 GLuint x,
2277 GLuint y,
2278 GLuint z) {
2279 GPU_CLIENT_SINGLE_THREAD_CHECK();
2280 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform3ui(" << location << ", "
2281 << x << ", " << y << ", " << z << ")");
2282 helper_->Uniform3ui(location, x, y, z);
2283 CheckGLError();
2286 void GLES2Implementation::Uniform3uiv(GLint location,
2287 GLsizei count,
2288 const GLuint* v) {
2289 GPU_CLIENT_SINGLE_THREAD_CHECK();
2290 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform3uiv(" << location << ", "
2291 << count << ", " << static_cast<const void*>(v) << ")");
2292 GPU_CLIENT_LOG_CODE_BLOCK({
2293 for (GLsizei i = 0; i < count; ++i) {
2294 GPU_CLIENT_LOG(" " << i << ": " << v[0 + i * 3] << ", " << v[1 + i * 3]
2295 << ", " << v[2 + i * 3]);
2298 if (count < 0) {
2299 SetGLError(GL_INVALID_VALUE, "glUniform3uiv", "count < 0");
2300 return;
2302 helper_->Uniform3uivImmediate(location, count, v);
2303 CheckGLError();
2306 void GLES2Implementation::Uniform4f(GLint location,
2307 GLfloat x,
2308 GLfloat y,
2309 GLfloat z,
2310 GLfloat w) {
2311 GPU_CLIENT_SINGLE_THREAD_CHECK();
2312 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform4f(" << location << ", "
2313 << x << ", " << y << ", " << z << ", " << w << ")");
2314 helper_->Uniform4f(location, x, y, z, w);
2315 CheckGLError();
2318 void GLES2Implementation::Uniform4fv(GLint location,
2319 GLsizei count,
2320 const GLfloat* v) {
2321 GPU_CLIENT_SINGLE_THREAD_CHECK();
2322 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform4fv(" << location << ", "
2323 << count << ", " << static_cast<const void*>(v) << ")");
2324 GPU_CLIENT_LOG_CODE_BLOCK({
2325 for (GLsizei i = 0; i < count; ++i) {
2326 GPU_CLIENT_LOG(" " << i << ": " << v[0 + i * 4] << ", " << v[1 + i * 4]
2327 << ", " << v[2 + i * 4] << ", " << v[3 + i * 4]);
2330 if (count < 0) {
2331 SetGLError(GL_INVALID_VALUE, "glUniform4fv", "count < 0");
2332 return;
2334 helper_->Uniform4fvImmediate(location, count, v);
2335 CheckGLError();
2338 void GLES2Implementation::Uniform4i(GLint location,
2339 GLint x,
2340 GLint y,
2341 GLint z,
2342 GLint w) {
2343 GPU_CLIENT_SINGLE_THREAD_CHECK();
2344 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform4i(" << location << ", "
2345 << x << ", " << y << ", " << z << ", " << w << ")");
2346 helper_->Uniform4i(location, x, y, z, w);
2347 CheckGLError();
2350 void GLES2Implementation::Uniform4iv(GLint location,
2351 GLsizei count,
2352 const GLint* v) {
2353 GPU_CLIENT_SINGLE_THREAD_CHECK();
2354 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform4iv(" << location << ", "
2355 << count << ", " << static_cast<const void*>(v) << ")");
2356 GPU_CLIENT_LOG_CODE_BLOCK({
2357 for (GLsizei i = 0; i < count; ++i) {
2358 GPU_CLIENT_LOG(" " << i << ": " << v[0 + i * 4] << ", " << v[1 + i * 4]
2359 << ", " << v[2 + i * 4] << ", " << v[3 + i * 4]);
2362 if (count < 0) {
2363 SetGLError(GL_INVALID_VALUE, "glUniform4iv", "count < 0");
2364 return;
2366 helper_->Uniform4ivImmediate(location, count, v);
2367 CheckGLError();
2370 void GLES2Implementation::Uniform4ui(GLint location,
2371 GLuint x,
2372 GLuint y,
2373 GLuint z,
2374 GLuint w) {
2375 GPU_CLIENT_SINGLE_THREAD_CHECK();
2376 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform4ui(" << location << ", "
2377 << x << ", " << y << ", " << z << ", " << w << ")");
2378 helper_->Uniform4ui(location, x, y, z, w);
2379 CheckGLError();
2382 void GLES2Implementation::Uniform4uiv(GLint location,
2383 GLsizei count,
2384 const GLuint* v) {
2385 GPU_CLIENT_SINGLE_THREAD_CHECK();
2386 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform4uiv(" << location << ", "
2387 << count << ", " << static_cast<const void*>(v) << ")");
2388 GPU_CLIENT_LOG_CODE_BLOCK({
2389 for (GLsizei i = 0; i < count; ++i) {
2390 GPU_CLIENT_LOG(" " << i << ": " << v[0 + i * 4] << ", " << v[1 + i * 4]
2391 << ", " << v[2 + i * 4] << ", " << v[3 + i * 4]);
2394 if (count < 0) {
2395 SetGLError(GL_INVALID_VALUE, "glUniform4uiv", "count < 0");
2396 return;
2398 helper_->Uniform4uivImmediate(location, count, v);
2399 CheckGLError();
2402 void GLES2Implementation::UniformMatrix2fv(GLint location,
2403 GLsizei count,
2404 GLboolean transpose,
2405 const GLfloat* value) {
2406 GPU_CLIENT_SINGLE_THREAD_CHECK();
2407 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniformMatrix2fv(" << location
2408 << ", " << count << ", "
2409 << GLES2Util::GetStringBool(transpose) << ", "
2410 << static_cast<const void*>(value) << ")");
2411 GPU_CLIENT_LOG_CODE_BLOCK({
2412 for (GLsizei i = 0; i < count; ++i) {
2413 GPU_CLIENT_LOG(" " << i << ": " << value[0 + i * 4] << ", "
2414 << value[1 + i * 4] << ", " << value[2 + i * 4]
2415 << ", " << value[3 + i * 4]);
2418 if (count < 0) {
2419 SetGLError(GL_INVALID_VALUE, "glUniformMatrix2fv", "count < 0");
2420 return;
2422 if (transpose != false) {
2423 SetGLError(GL_INVALID_VALUE, "glUniformMatrix2fv",
2424 "transpose GL_INVALID_VALUE");
2425 return;
2427 helper_->UniformMatrix2fvImmediate(location, count, value);
2428 CheckGLError();
2431 void GLES2Implementation::UniformMatrix2x3fv(GLint location,
2432 GLsizei count,
2433 GLboolean transpose,
2434 const GLfloat* value) {
2435 GPU_CLIENT_SINGLE_THREAD_CHECK();
2436 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniformMatrix2x3fv(" << location
2437 << ", " << count << ", "
2438 << GLES2Util::GetStringBool(transpose) << ", "
2439 << static_cast<const void*>(value) << ")");
2440 GPU_CLIENT_LOG_CODE_BLOCK({
2441 for (GLsizei i = 0; i < count; ++i) {
2442 GPU_CLIENT_LOG(" " << i << ": " << value[0 + i * 6] << ", "
2443 << value[1 + i * 6] << ", " << value[2 + i * 6]
2444 << ", " << value[3 + i * 6] << ", "
2445 << value[4 + i * 6] << ", " << value[5 + i * 6]);
2448 if (count < 0) {
2449 SetGLError(GL_INVALID_VALUE, "glUniformMatrix2x3fv", "count < 0");
2450 return;
2452 if (transpose != false) {
2453 SetGLError(GL_INVALID_VALUE, "glUniformMatrix2x3fv",
2454 "transpose GL_INVALID_VALUE");
2455 return;
2457 helper_->UniformMatrix2x3fvImmediate(location, count, value);
2458 CheckGLError();
2461 void GLES2Implementation::UniformMatrix2x4fv(GLint location,
2462 GLsizei count,
2463 GLboolean transpose,
2464 const GLfloat* value) {
2465 GPU_CLIENT_SINGLE_THREAD_CHECK();
2466 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniformMatrix2x4fv(" << location
2467 << ", " << count << ", "
2468 << GLES2Util::GetStringBool(transpose) << ", "
2469 << static_cast<const void*>(value) << ")");
2470 GPU_CLIENT_LOG_CODE_BLOCK({
2471 for (GLsizei i = 0; i < count; ++i) {
2472 GPU_CLIENT_LOG(
2473 " " << i << ": " << value[0 + i * 8] << ", " << value[1 + i * 8]
2474 << ", " << value[2 + i * 8] << ", " << value[3 + i * 8] << ", "
2475 << value[4 + i * 8] << ", " << value[5 + i * 8] << ", "
2476 << value[6 + i * 8] << ", " << value[7 + i * 8]);
2479 if (count < 0) {
2480 SetGLError(GL_INVALID_VALUE, "glUniformMatrix2x4fv", "count < 0");
2481 return;
2483 if (transpose != false) {
2484 SetGLError(GL_INVALID_VALUE, "glUniformMatrix2x4fv",
2485 "transpose GL_INVALID_VALUE");
2486 return;
2488 helper_->UniformMatrix2x4fvImmediate(location, count, value);
2489 CheckGLError();
2492 void GLES2Implementation::UniformMatrix3fv(GLint location,
2493 GLsizei count,
2494 GLboolean transpose,
2495 const GLfloat* value) {
2496 GPU_CLIENT_SINGLE_THREAD_CHECK();
2497 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniformMatrix3fv(" << location
2498 << ", " << count << ", "
2499 << GLES2Util::GetStringBool(transpose) << ", "
2500 << static_cast<const void*>(value) << ")");
2501 GPU_CLIENT_LOG_CODE_BLOCK({
2502 for (GLsizei i = 0; i < count; ++i) {
2503 GPU_CLIENT_LOG(" " << i << ": " << value[0 + i * 9] << ", "
2504 << value[1 + i * 9] << ", " << value[2 + i * 9]
2505 << ", " << value[3 + i * 9] << ", "
2506 << value[4 + i * 9] << ", " << value[5 + i * 9]
2507 << ", " << value[6 + i * 9] << ", "
2508 << value[7 + i * 9] << ", " << value[8 + i * 9]);
2511 if (count < 0) {
2512 SetGLError(GL_INVALID_VALUE, "glUniformMatrix3fv", "count < 0");
2513 return;
2515 if (transpose != false) {
2516 SetGLError(GL_INVALID_VALUE, "glUniformMatrix3fv",
2517 "transpose GL_INVALID_VALUE");
2518 return;
2520 helper_->UniformMatrix3fvImmediate(location, count, value);
2521 CheckGLError();
2524 void GLES2Implementation::UniformMatrix3x2fv(GLint location,
2525 GLsizei count,
2526 GLboolean transpose,
2527 const GLfloat* value) {
2528 GPU_CLIENT_SINGLE_THREAD_CHECK();
2529 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniformMatrix3x2fv(" << location
2530 << ", " << count << ", "
2531 << GLES2Util::GetStringBool(transpose) << ", "
2532 << static_cast<const void*>(value) << ")");
2533 GPU_CLIENT_LOG_CODE_BLOCK({
2534 for (GLsizei i = 0; i < count; ++i) {
2535 GPU_CLIENT_LOG(" " << i << ": " << value[0 + i * 6] << ", "
2536 << value[1 + i * 6] << ", " << value[2 + i * 6]
2537 << ", " << value[3 + i * 6] << ", "
2538 << value[4 + i * 6] << ", " << value[5 + i * 6]);
2541 if (count < 0) {
2542 SetGLError(GL_INVALID_VALUE, "glUniformMatrix3x2fv", "count < 0");
2543 return;
2545 if (transpose != false) {
2546 SetGLError(GL_INVALID_VALUE, "glUniformMatrix3x2fv",
2547 "transpose GL_INVALID_VALUE");
2548 return;
2550 helper_->UniformMatrix3x2fvImmediate(location, count, value);
2551 CheckGLError();
2554 void GLES2Implementation::UniformMatrix3x4fv(GLint location,
2555 GLsizei count,
2556 GLboolean transpose,
2557 const GLfloat* value) {
2558 GPU_CLIENT_SINGLE_THREAD_CHECK();
2559 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniformMatrix3x4fv(" << location
2560 << ", " << count << ", "
2561 << GLES2Util::GetStringBool(transpose) << ", "
2562 << static_cast<const void*>(value) << ")");
2563 GPU_CLIENT_LOG_CODE_BLOCK({
2564 for (GLsizei i = 0; i < count; ++i) {
2565 GPU_CLIENT_LOG(
2566 " " << i << ": " << value[0 + i * 12] << ", " << value[1 + i * 12]
2567 << ", " << value[2 + i * 12] << ", " << value[3 + i * 12] << ", "
2568 << value[4 + i * 12] << ", " << value[5 + i * 12] << ", "
2569 << value[6 + i * 12] << ", " << value[7 + i * 12] << ", "
2570 << value[8 + i * 12] << ", " << value[9 + i * 12] << ", "
2571 << value[10 + i * 12] << ", " << value[11 + i * 12]);
2574 if (count < 0) {
2575 SetGLError(GL_INVALID_VALUE, "glUniformMatrix3x4fv", "count < 0");
2576 return;
2578 if (transpose != false) {
2579 SetGLError(GL_INVALID_VALUE, "glUniformMatrix3x4fv",
2580 "transpose GL_INVALID_VALUE");
2581 return;
2583 helper_->UniformMatrix3x4fvImmediate(location, count, value);
2584 CheckGLError();
2587 void GLES2Implementation::UniformMatrix4fv(GLint location,
2588 GLsizei count,
2589 GLboolean transpose,
2590 const GLfloat* value) {
2591 GPU_CLIENT_SINGLE_THREAD_CHECK();
2592 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniformMatrix4fv(" << location
2593 << ", " << count << ", "
2594 << GLES2Util::GetStringBool(transpose) << ", "
2595 << static_cast<const void*>(value) << ")");
2596 GPU_CLIENT_LOG_CODE_BLOCK({
2597 for (GLsizei i = 0; i < count; ++i) {
2598 GPU_CLIENT_LOG(
2599 " " << i << ": " << value[0 + i * 16] << ", " << value[1 + i * 16]
2600 << ", " << value[2 + i * 16] << ", " << value[3 + i * 16] << ", "
2601 << value[4 + i * 16] << ", " << value[5 + i * 16] << ", "
2602 << value[6 + i * 16] << ", " << value[7 + i * 16] << ", "
2603 << value[8 + i * 16] << ", " << value[9 + i * 16] << ", "
2604 << value[10 + i * 16] << ", " << value[11 + i * 16] << ", "
2605 << value[12 + i * 16] << ", " << value[13 + i * 16] << ", "
2606 << value[14 + i * 16] << ", " << value[15 + i * 16]);
2609 if (count < 0) {
2610 SetGLError(GL_INVALID_VALUE, "glUniformMatrix4fv", "count < 0");
2611 return;
2613 if (transpose != false) {
2614 SetGLError(GL_INVALID_VALUE, "glUniformMatrix4fv",
2615 "transpose GL_INVALID_VALUE");
2616 return;
2618 helper_->UniformMatrix4fvImmediate(location, count, value);
2619 CheckGLError();
2622 void GLES2Implementation::UniformMatrix4x2fv(GLint location,
2623 GLsizei count,
2624 GLboolean transpose,
2625 const GLfloat* value) {
2626 GPU_CLIENT_SINGLE_THREAD_CHECK();
2627 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniformMatrix4x2fv(" << location
2628 << ", " << count << ", "
2629 << GLES2Util::GetStringBool(transpose) << ", "
2630 << static_cast<const void*>(value) << ")");
2631 GPU_CLIENT_LOG_CODE_BLOCK({
2632 for (GLsizei i = 0; i < count; ++i) {
2633 GPU_CLIENT_LOG(
2634 " " << i << ": " << value[0 + i * 8] << ", " << value[1 + i * 8]
2635 << ", " << value[2 + i * 8] << ", " << value[3 + i * 8] << ", "
2636 << value[4 + i * 8] << ", " << value[5 + i * 8] << ", "
2637 << value[6 + i * 8] << ", " << value[7 + i * 8]);
2640 if (count < 0) {
2641 SetGLError(GL_INVALID_VALUE, "glUniformMatrix4x2fv", "count < 0");
2642 return;
2644 if (transpose != false) {
2645 SetGLError(GL_INVALID_VALUE, "glUniformMatrix4x2fv",
2646 "transpose GL_INVALID_VALUE");
2647 return;
2649 helper_->UniformMatrix4x2fvImmediate(location, count, value);
2650 CheckGLError();
2653 void GLES2Implementation::UniformMatrix4x3fv(GLint location,
2654 GLsizei count,
2655 GLboolean transpose,
2656 const GLfloat* value) {
2657 GPU_CLIENT_SINGLE_THREAD_CHECK();
2658 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniformMatrix4x3fv(" << location
2659 << ", " << count << ", "
2660 << GLES2Util::GetStringBool(transpose) << ", "
2661 << static_cast<const void*>(value) << ")");
2662 GPU_CLIENT_LOG_CODE_BLOCK({
2663 for (GLsizei i = 0; i < count; ++i) {
2664 GPU_CLIENT_LOG(
2665 " " << i << ": " << value[0 + i * 12] << ", " << value[1 + i * 12]
2666 << ", " << value[2 + i * 12] << ", " << value[3 + i * 12] << ", "
2667 << value[4 + i * 12] << ", " << value[5 + i * 12] << ", "
2668 << value[6 + i * 12] << ", " << value[7 + i * 12] << ", "
2669 << value[8 + i * 12] << ", " << value[9 + i * 12] << ", "
2670 << value[10 + i * 12] << ", " << value[11 + i * 12]);
2673 if (count < 0) {
2674 SetGLError(GL_INVALID_VALUE, "glUniformMatrix4x3fv", "count < 0");
2675 return;
2677 if (transpose != false) {
2678 SetGLError(GL_INVALID_VALUE, "glUniformMatrix4x3fv",
2679 "transpose GL_INVALID_VALUE");
2680 return;
2682 helper_->UniformMatrix4x3fvImmediate(location, count, value);
2683 CheckGLError();
2686 void GLES2Implementation::UseProgram(GLuint program) {
2687 GPU_CLIENT_SINGLE_THREAD_CHECK();
2688 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUseProgram(" << program << ")");
2689 if (IsProgramReservedId(program)) {
2690 SetGLError(GL_INVALID_OPERATION, "UseProgram", "program reserved id");
2691 return;
2693 UseProgramHelper(program);
2694 CheckGLError();
2697 void GLES2Implementation::ValidateProgram(GLuint program) {
2698 GPU_CLIENT_SINGLE_THREAD_CHECK();
2699 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glValidateProgram(" << program
2700 << ")");
2701 helper_->ValidateProgram(program);
2702 CheckGLError();
2705 void GLES2Implementation::VertexAttrib1f(GLuint indx, GLfloat x) {
2706 GPU_CLIENT_SINGLE_THREAD_CHECK();
2707 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glVertexAttrib1f(" << indx << ", "
2708 << x << ")");
2709 helper_->VertexAttrib1f(indx, x);
2710 CheckGLError();
2713 void GLES2Implementation::VertexAttrib1fv(GLuint indx, const GLfloat* values) {
2714 GPU_CLIENT_SINGLE_THREAD_CHECK();
2715 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glVertexAttrib1fv(" << indx << ", "
2716 << static_cast<const void*>(values) << ")");
2717 size_t count = 1;
2718 for (size_t ii = 0; ii < count; ++ii)
2719 GPU_CLIENT_LOG("value[" << ii << "]: " << values[ii]);
2720 helper_->VertexAttrib1fvImmediate(indx, values);
2721 CheckGLError();
2724 void GLES2Implementation::VertexAttrib2f(GLuint indx, GLfloat x, GLfloat y) {
2725 GPU_CLIENT_SINGLE_THREAD_CHECK();
2726 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glVertexAttrib2f(" << indx << ", "
2727 << x << ", " << y << ")");
2728 helper_->VertexAttrib2f(indx, x, y);
2729 CheckGLError();
2732 void GLES2Implementation::VertexAttrib2fv(GLuint indx, const GLfloat* values) {
2733 GPU_CLIENT_SINGLE_THREAD_CHECK();
2734 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glVertexAttrib2fv(" << indx << ", "
2735 << static_cast<const void*>(values) << ")");
2736 size_t count = 2;
2737 for (size_t ii = 0; ii < count; ++ii)
2738 GPU_CLIENT_LOG("value[" << ii << "]: " << values[ii]);
2739 helper_->VertexAttrib2fvImmediate(indx, values);
2740 CheckGLError();
2743 void GLES2Implementation::VertexAttrib3f(GLuint indx,
2744 GLfloat x,
2745 GLfloat y,
2746 GLfloat z) {
2747 GPU_CLIENT_SINGLE_THREAD_CHECK();
2748 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glVertexAttrib3f(" << indx << ", "
2749 << x << ", " << y << ", " << z << ")");
2750 helper_->VertexAttrib3f(indx, x, y, z);
2751 CheckGLError();
2754 void GLES2Implementation::VertexAttrib3fv(GLuint indx, const GLfloat* values) {
2755 GPU_CLIENT_SINGLE_THREAD_CHECK();
2756 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glVertexAttrib3fv(" << indx << ", "
2757 << static_cast<const void*>(values) << ")");
2758 size_t count = 3;
2759 for (size_t ii = 0; ii < count; ++ii)
2760 GPU_CLIENT_LOG("value[" << ii << "]: " << values[ii]);
2761 helper_->VertexAttrib3fvImmediate(indx, values);
2762 CheckGLError();
2765 void GLES2Implementation::VertexAttrib4f(GLuint indx,
2766 GLfloat x,
2767 GLfloat y,
2768 GLfloat z,
2769 GLfloat w) {
2770 GPU_CLIENT_SINGLE_THREAD_CHECK();
2771 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glVertexAttrib4f(" << indx << ", "
2772 << x << ", " << y << ", " << z << ", " << w << ")");
2773 helper_->VertexAttrib4f(indx, x, y, z, w);
2774 CheckGLError();
2777 void GLES2Implementation::VertexAttrib4fv(GLuint indx, const GLfloat* values) {
2778 GPU_CLIENT_SINGLE_THREAD_CHECK();
2779 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glVertexAttrib4fv(" << indx << ", "
2780 << static_cast<const void*>(values) << ")");
2781 size_t count = 4;
2782 for (size_t ii = 0; ii < count; ++ii)
2783 GPU_CLIENT_LOG("value[" << ii << "]: " << values[ii]);
2784 helper_->VertexAttrib4fvImmediate(indx, values);
2785 CheckGLError();
2788 void GLES2Implementation::VertexAttribI4i(GLuint indx,
2789 GLint x,
2790 GLint y,
2791 GLint z,
2792 GLint w) {
2793 GPU_CLIENT_SINGLE_THREAD_CHECK();
2794 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glVertexAttribI4i(" << indx << ", "
2795 << x << ", " << y << ", " << z << ", " << w << ")");
2796 helper_->VertexAttribI4i(indx, x, y, z, w);
2797 CheckGLError();
2800 void GLES2Implementation::VertexAttribI4iv(GLuint indx, const GLint* values) {
2801 GPU_CLIENT_SINGLE_THREAD_CHECK();
2802 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glVertexAttribI4iv(" << indx
2803 << ", " << static_cast<const void*>(values) << ")");
2804 size_t count = 4;
2805 for (size_t ii = 0; ii < count; ++ii)
2806 GPU_CLIENT_LOG("value[" << ii << "]: " << values[ii]);
2807 helper_->VertexAttribI4ivImmediate(indx, values);
2808 CheckGLError();
2811 void GLES2Implementation::VertexAttribI4ui(GLuint indx,
2812 GLuint x,
2813 GLuint y,
2814 GLuint z,
2815 GLuint w) {
2816 GPU_CLIENT_SINGLE_THREAD_CHECK();
2817 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glVertexAttribI4ui(" << indx
2818 << ", " << x << ", " << y << ", " << z << ", " << w
2819 << ")");
2820 helper_->VertexAttribI4ui(indx, x, y, z, w);
2821 CheckGLError();
2824 void GLES2Implementation::VertexAttribI4uiv(GLuint indx, const GLuint* values) {
2825 GPU_CLIENT_SINGLE_THREAD_CHECK();
2826 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glVertexAttribI4uiv(" << indx
2827 << ", " << static_cast<const void*>(values) << ")");
2828 size_t count = 4;
2829 for (size_t ii = 0; ii < count; ++ii)
2830 GPU_CLIENT_LOG("value[" << ii << "]: " << values[ii]);
2831 helper_->VertexAttribI4uivImmediate(indx, values);
2832 CheckGLError();
2835 void GLES2Implementation::Viewport(GLint x,
2836 GLint y,
2837 GLsizei width,
2838 GLsizei height) {
2839 GPU_CLIENT_SINGLE_THREAD_CHECK();
2840 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glViewport(" << x << ", " << y
2841 << ", " << width << ", " << height << ")");
2842 if (width < 0) {
2843 SetGLError(GL_INVALID_VALUE, "glViewport", "width < 0");
2844 return;
2846 if (height < 0) {
2847 SetGLError(GL_INVALID_VALUE, "glViewport", "height < 0");
2848 return;
2850 helper_->Viewport(x, y, width, height);
2851 CheckGLError();
2854 void GLES2Implementation::BlitFramebufferCHROMIUM(GLint srcX0,
2855 GLint srcY0,
2856 GLint srcX1,
2857 GLint srcY1,
2858 GLint dstX0,
2859 GLint dstY0,
2860 GLint dstX1,
2861 GLint dstY1,
2862 GLbitfield mask,
2863 GLenum filter) {
2864 GPU_CLIENT_SINGLE_THREAD_CHECK();
2865 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBlitFramebufferCHROMIUM("
2866 << srcX0 << ", " << srcY0 << ", " << srcX1 << ", " << srcY1
2867 << ", " << dstX0 << ", " << dstY0 << ", " << dstX1 << ", "
2868 << dstY1 << ", " << mask << ", "
2869 << GLES2Util::GetStringBlitFilter(filter) << ")");
2870 helper_->BlitFramebufferCHROMIUM(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0,
2871 dstX1, dstY1, mask, filter);
2872 CheckGLError();
2875 void GLES2Implementation::RenderbufferStorageMultisampleCHROMIUM(
2876 GLenum target,
2877 GLsizei samples,
2878 GLenum internalformat,
2879 GLsizei width,
2880 GLsizei height) {
2881 GPU_CLIENT_SINGLE_THREAD_CHECK();
2882 GPU_CLIENT_LOG(
2883 "[" << GetLogPrefix() << "] glRenderbufferStorageMultisampleCHROMIUM("
2884 << GLES2Util::GetStringRenderBufferTarget(target) << ", " << samples
2885 << ", " << GLES2Util::GetStringRenderBufferFormat(internalformat)
2886 << ", " << width << ", " << height << ")");
2887 if (samples < 0) {
2888 SetGLError(GL_INVALID_VALUE, "glRenderbufferStorageMultisampleCHROMIUM",
2889 "samples < 0");
2890 return;
2892 if (width < 0) {
2893 SetGLError(GL_INVALID_VALUE, "glRenderbufferStorageMultisampleCHROMIUM",
2894 "width < 0");
2895 return;
2897 if (height < 0) {
2898 SetGLError(GL_INVALID_VALUE, "glRenderbufferStorageMultisampleCHROMIUM",
2899 "height < 0");
2900 return;
2902 helper_->RenderbufferStorageMultisampleCHROMIUM(
2903 target, samples, internalformat, width, height);
2904 CheckGLError();
2907 void GLES2Implementation::RenderbufferStorageMultisampleEXT(
2908 GLenum target,
2909 GLsizei samples,
2910 GLenum internalformat,
2911 GLsizei width,
2912 GLsizei height) {
2913 GPU_CLIENT_SINGLE_THREAD_CHECK();
2914 GPU_CLIENT_LOG(
2915 "[" << GetLogPrefix() << "] glRenderbufferStorageMultisampleEXT("
2916 << GLES2Util::GetStringRenderBufferTarget(target) << ", " << samples
2917 << ", " << GLES2Util::GetStringRenderBufferFormat(internalformat)
2918 << ", " << width << ", " << height << ")");
2919 if (samples < 0) {
2920 SetGLError(GL_INVALID_VALUE, "glRenderbufferStorageMultisampleEXT",
2921 "samples < 0");
2922 return;
2924 if (width < 0) {
2925 SetGLError(GL_INVALID_VALUE, "glRenderbufferStorageMultisampleEXT",
2926 "width < 0");
2927 return;
2929 if (height < 0) {
2930 SetGLError(GL_INVALID_VALUE, "glRenderbufferStorageMultisampleEXT",
2931 "height < 0");
2932 return;
2934 helper_->RenderbufferStorageMultisampleEXT(target, samples, internalformat,
2935 width, height);
2936 CheckGLError();
2939 void GLES2Implementation::FramebufferTexture2DMultisampleEXT(GLenum target,
2940 GLenum attachment,
2941 GLenum textarget,
2942 GLuint texture,
2943 GLint level,
2944 GLsizei samples) {
2945 GPU_CLIENT_SINGLE_THREAD_CHECK();
2946 GPU_CLIENT_LOG("[" << GetLogPrefix()
2947 << "] glFramebufferTexture2DMultisampleEXT("
2948 << GLES2Util::GetStringFrameBufferTarget(target) << ", "
2949 << GLES2Util::GetStringAttachment(attachment) << ", "
2950 << GLES2Util::GetStringTextureTarget(textarget) << ", "
2951 << texture << ", " << level << ", " << samples << ")");
2952 if (level != 0) {
2953 SetGLError(GL_INVALID_VALUE, "glFramebufferTexture2DMultisampleEXT",
2954 "level GL_INVALID_VALUE");
2955 return;
2957 if (samples < 0) {
2958 SetGLError(GL_INVALID_VALUE, "glFramebufferTexture2DMultisampleEXT",
2959 "samples < 0");
2960 return;
2962 helper_->FramebufferTexture2DMultisampleEXT(target, attachment, textarget,
2963 texture, samples);
2964 CheckGLError();
2967 void GLES2Implementation::TexStorage2DEXT(GLenum target,
2968 GLsizei levels,
2969 GLenum internalFormat,
2970 GLsizei width,
2971 GLsizei height) {
2972 GPU_CLIENT_SINGLE_THREAD_CHECK();
2973 GPU_CLIENT_LOG(
2974 "[" << GetLogPrefix() << "] glTexStorage2DEXT("
2975 << GLES2Util::GetStringTextureBindTarget(target) << ", " << levels
2976 << ", "
2977 << GLES2Util::GetStringTextureInternalFormatStorage(internalFormat)
2978 << ", " << width << ", " << height << ")");
2979 if (levels < 0) {
2980 SetGLError(GL_INVALID_VALUE, "glTexStorage2DEXT", "levels < 0");
2981 return;
2983 if (width < 0) {
2984 SetGLError(GL_INVALID_VALUE, "glTexStorage2DEXT", "width < 0");
2985 return;
2987 if (height < 0) {
2988 SetGLError(GL_INVALID_VALUE, "glTexStorage2DEXT", "height < 0");
2989 return;
2991 helper_->TexStorage2DEXT(target, levels, internalFormat, width, height);
2992 CheckGLError();
2995 void GLES2Implementation::GenQueriesEXT(GLsizei n, GLuint* queries) {
2996 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGenQueriesEXT(" << n << ", "
2997 << static_cast<const void*>(queries) << ")");
2998 if (n < 0) {
2999 SetGLError(GL_INVALID_VALUE, "glGenQueriesEXT", "n < 0");
3000 return;
3002 GPU_CLIENT_SINGLE_THREAD_CHECK();
3003 IdAllocator* id_allocator = GetIdAllocator(id_namespaces::kQueries);
3004 for (GLsizei ii = 0; ii < n; ++ii)
3005 queries[ii] = id_allocator->AllocateID();
3006 GenQueriesEXTHelper(n, queries);
3007 helper_->GenQueriesEXTImmediate(n, queries);
3008 if (share_group_->bind_generates_resource())
3009 helper_->CommandBufferHelper::Flush();
3010 GPU_CLIENT_LOG_CODE_BLOCK({
3011 for (GLsizei i = 0; i < n; ++i) {
3012 GPU_CLIENT_LOG(" " << i << ": " << queries[i]);
3015 CheckGLError();
3018 void GLES2Implementation::DeleteQueriesEXT(GLsizei n, const GLuint* queries) {
3019 GPU_CLIENT_SINGLE_THREAD_CHECK();
3020 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDeleteQueriesEXT(" << n << ", "
3021 << static_cast<const void*>(queries) << ")");
3022 GPU_CLIENT_LOG_CODE_BLOCK({
3023 for (GLsizei i = 0; i < n; ++i) {
3024 GPU_CLIENT_LOG(" " << i << ": " << queries[i]);
3027 GPU_CLIENT_DCHECK_CODE_BLOCK({
3028 for (GLsizei i = 0; i < n; ++i) {
3029 DCHECK(queries[i] != 0);
3032 if (n < 0) {
3033 SetGLError(GL_INVALID_VALUE, "glDeleteQueriesEXT", "n < 0");
3034 return;
3036 DeleteQueriesEXTHelper(n, queries);
3037 CheckGLError();
3040 void GLES2Implementation::BeginTransformFeedback(GLenum primitivemode) {
3041 GPU_CLIENT_SINGLE_THREAD_CHECK();
3042 GPU_CLIENT_LOG(
3043 "[" << GetLogPrefix() << "] glBeginTransformFeedback("
3044 << GLES2Util::GetStringTransformFeedbackPrimitiveMode(primitivemode)
3045 << ")");
3046 helper_->BeginTransformFeedback(primitivemode);
3047 CheckGLError();
3050 void GLES2Implementation::EndTransformFeedback() {
3051 GPU_CLIENT_SINGLE_THREAD_CHECK();
3052 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glEndTransformFeedback("
3053 << ")");
3054 helper_->EndTransformFeedback();
3055 CheckGLError();
3058 void GLES2Implementation::GenVertexArraysOES(GLsizei n, GLuint* arrays) {
3059 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGenVertexArraysOES(" << n << ", "
3060 << static_cast<const void*>(arrays) << ")");
3061 if (n < 0) {
3062 SetGLError(GL_INVALID_VALUE, "glGenVertexArraysOES", "n < 0");
3063 return;
3065 GPU_CLIENT_SINGLE_THREAD_CHECK();
3066 GetIdHandler(id_namespaces::kVertexArrays)->MakeIds(this, 0, n, arrays);
3067 GenVertexArraysOESHelper(n, arrays);
3068 helper_->GenVertexArraysOESImmediate(n, arrays);
3069 if (share_group_->bind_generates_resource())
3070 helper_->CommandBufferHelper::Flush();
3071 GPU_CLIENT_LOG_CODE_BLOCK({
3072 for (GLsizei i = 0; i < n; ++i) {
3073 GPU_CLIENT_LOG(" " << i << ": " << arrays[i]);
3076 CheckGLError();
3079 void GLES2Implementation::DeleteVertexArraysOES(GLsizei n,
3080 const GLuint* arrays) {
3081 GPU_CLIENT_SINGLE_THREAD_CHECK();
3082 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDeleteVertexArraysOES(" << n
3083 << ", " << static_cast<const void*>(arrays) << ")");
3084 GPU_CLIENT_LOG_CODE_BLOCK({
3085 for (GLsizei i = 0; i < n; ++i) {
3086 GPU_CLIENT_LOG(" " << i << ": " << arrays[i]);
3089 GPU_CLIENT_DCHECK_CODE_BLOCK({
3090 for (GLsizei i = 0; i < n; ++i) {
3091 DCHECK(arrays[i] != 0);
3094 if (n < 0) {
3095 SetGLError(GL_INVALID_VALUE, "glDeleteVertexArraysOES", "n < 0");
3096 return;
3098 DeleteVertexArraysOESHelper(n, arrays);
3099 CheckGLError();
3102 GLboolean GLES2Implementation::IsVertexArrayOES(GLuint array) {
3103 GPU_CLIENT_SINGLE_THREAD_CHECK();
3104 TRACE_EVENT0("gpu", "GLES2Implementation::IsVertexArrayOES");
3105 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glIsVertexArrayOES(" << array
3106 << ")");
3107 typedef cmds::IsVertexArrayOES::Result Result;
3108 Result* result = GetResultAs<Result*>();
3109 if (!result) {
3110 return GL_FALSE;
3112 *result = 0;
3113 helper_->IsVertexArrayOES(array, GetResultShmId(), GetResultShmOffset());
3114 WaitForCmd();
3115 GLboolean result_value = *result != 0;
3116 GPU_CLIENT_LOG("returned " << result_value);
3117 CheckGLError();
3118 return result_value;
3121 void GLES2Implementation::BindVertexArrayOES(GLuint array) {
3122 GPU_CLIENT_SINGLE_THREAD_CHECK();
3123 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBindVertexArrayOES(" << array
3124 << ")");
3125 if (IsVertexArrayReservedId(array)) {
3126 SetGLError(GL_INVALID_OPERATION, "BindVertexArrayOES", "array reserved id");
3127 return;
3129 BindVertexArrayOESHelper(array);
3130 CheckGLError();
3133 void GLES2Implementation::GetTranslatedShaderSourceANGLE(GLuint shader,
3134 GLsizei bufsize,
3135 GLsizei* length,
3136 char* source) {
3137 GPU_CLIENT_SINGLE_THREAD_CHECK();
3138 GPU_CLIENT_VALIDATE_DESTINATION_OPTIONAL_INITALIZATION(GLsizei, length);
3139 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetTranslatedShaderSourceANGLE"
3140 << "(" << shader << ", " << bufsize << ", "
3141 << static_cast<void*>(length) << ", "
3142 << static_cast<void*>(source) << ")");
3143 helper_->SetBucketSize(kResultBucketId, 0);
3144 helper_->GetTranslatedShaderSourceANGLE(shader, kResultBucketId);
3145 std::string str;
3146 GLsizei max_size = 0;
3147 if (GetBucketAsString(kResultBucketId, &str)) {
3148 if (bufsize > 0) {
3149 max_size = std::min(static_cast<size_t>(bufsize) - 1, str.size());
3150 memcpy(source, str.c_str(), max_size);
3151 source[max_size] = '\0';
3152 GPU_CLIENT_LOG("------\n" << source << "\n------");
3155 if (length != NULL) {
3156 *length = max_size;
3158 CheckGLError();
3160 void GLES2Implementation::TexImageIOSurface2DCHROMIUM(GLenum target,
3161 GLsizei width,
3162 GLsizei height,
3163 GLuint ioSurfaceId,
3164 GLuint plane) {
3165 GPU_CLIENT_SINGLE_THREAD_CHECK();
3166 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glTexImageIOSurface2DCHROMIUM("
3167 << GLES2Util::GetStringTextureBindTarget(target) << ", "
3168 << width << ", " << height << ", " << ioSurfaceId << ", "
3169 << plane << ")");
3170 if (width < 0) {
3171 SetGLError(GL_INVALID_VALUE, "glTexImageIOSurface2DCHROMIUM", "width < 0");
3172 return;
3174 if (height < 0) {
3175 SetGLError(GL_INVALID_VALUE, "glTexImageIOSurface2DCHROMIUM", "height < 0");
3176 return;
3178 helper_->TexImageIOSurface2DCHROMIUM(target, width, height, ioSurfaceId,
3179 plane);
3180 CheckGLError();
3183 void GLES2Implementation::CopyTextureCHROMIUM(
3184 GLenum target,
3185 GLenum source_id,
3186 GLenum dest_id,
3187 GLint internalformat,
3188 GLenum dest_type,
3189 GLboolean unpack_flip_y,
3190 GLboolean unpack_premultiply_alpha,
3191 GLboolean unpack_unmultiply_alpha) {
3192 GPU_CLIENT_SINGLE_THREAD_CHECK();
3193 GPU_CLIENT_LOG(
3194 "[" << GetLogPrefix() << "] glCopyTextureCHROMIUM("
3195 << GLES2Util::GetStringEnum(target) << ", "
3196 << GLES2Util::GetStringEnum(source_id) << ", "
3197 << GLES2Util::GetStringEnum(dest_id) << ", " << internalformat << ", "
3198 << GLES2Util::GetStringPixelType(dest_type) << ", "
3199 << GLES2Util::GetStringBool(unpack_flip_y) << ", "
3200 << GLES2Util::GetStringBool(unpack_premultiply_alpha) << ", "
3201 << GLES2Util::GetStringBool(unpack_unmultiply_alpha) << ")");
3202 helper_->CopyTextureCHROMIUM(
3203 target, source_id, dest_id, internalformat, dest_type, unpack_flip_y,
3204 unpack_premultiply_alpha, unpack_unmultiply_alpha);
3205 CheckGLError();
3208 void GLES2Implementation::CopySubTextureCHROMIUM(
3209 GLenum target,
3210 GLenum source_id,
3211 GLenum dest_id,
3212 GLint xoffset,
3213 GLint yoffset,
3214 GLint x,
3215 GLint y,
3216 GLsizei width,
3217 GLsizei height,
3218 GLboolean unpack_flip_y,
3219 GLboolean unpack_premultiply_alpha,
3220 GLboolean unpack_unmultiply_alpha) {
3221 GPU_CLIENT_SINGLE_THREAD_CHECK();
3222 GPU_CLIENT_LOG(
3223 "[" << GetLogPrefix() << "] glCopySubTextureCHROMIUM("
3224 << GLES2Util::GetStringEnum(target) << ", "
3225 << GLES2Util::GetStringEnum(source_id) << ", "
3226 << GLES2Util::GetStringEnum(dest_id) << ", " << xoffset << ", "
3227 << yoffset << ", " << x << ", " << y << ", " << width << ", "
3228 << height << ", " << GLES2Util::GetStringBool(unpack_flip_y) << ", "
3229 << GLES2Util::GetStringBool(unpack_premultiply_alpha) << ", "
3230 << GLES2Util::GetStringBool(unpack_unmultiply_alpha) << ")");
3231 if (width < 0) {
3232 SetGLError(GL_INVALID_VALUE, "glCopySubTextureCHROMIUM", "width < 0");
3233 return;
3235 if (height < 0) {
3236 SetGLError(GL_INVALID_VALUE, "glCopySubTextureCHROMIUM", "height < 0");
3237 return;
3239 helper_->CopySubTextureCHROMIUM(
3240 target, source_id, dest_id, xoffset, yoffset, x, y, width, height,
3241 unpack_flip_y, unpack_premultiply_alpha, unpack_unmultiply_alpha);
3242 CheckGLError();
3245 void GLES2Implementation::CompressedCopyTextureCHROMIUM(GLenum target,
3246 GLenum source_id,
3247 GLenum dest_id) {
3248 GPU_CLIENT_SINGLE_THREAD_CHECK();
3249 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glCompressedCopyTextureCHROMIUM("
3250 << GLES2Util::GetStringEnum(target) << ", "
3251 << GLES2Util::GetStringEnum(source_id) << ", "
3252 << GLES2Util::GetStringEnum(dest_id) << ")");
3253 helper_->CompressedCopyTextureCHROMIUM(target, source_id, dest_id);
3254 CheckGLError();
3257 void GLES2Implementation::CompressedCopySubTextureCHROMIUM(GLenum target,
3258 GLenum source_id,
3259 GLenum dest_id,
3260 GLint xoffset,
3261 GLint yoffset,
3262 GLint x,
3263 GLint y,
3264 GLsizei width,
3265 GLsizei height) {
3266 GPU_CLIENT_SINGLE_THREAD_CHECK();
3267 GPU_CLIENT_LOG("[" << GetLogPrefix()
3268 << "] glCompressedCopySubTextureCHROMIUM("
3269 << GLES2Util::GetStringEnum(target) << ", "
3270 << GLES2Util::GetStringEnum(source_id) << ", "
3271 << GLES2Util::GetStringEnum(dest_id) << ", " << xoffset
3272 << ", " << yoffset << ", " << x << ", " << y << ", "
3273 << width << ", " << height << ")");
3274 if (width < 0) {
3275 SetGLError(GL_INVALID_VALUE, "glCompressedCopySubTextureCHROMIUM",
3276 "width < 0");
3277 return;
3279 if (height < 0) {
3280 SetGLError(GL_INVALID_VALUE, "glCompressedCopySubTextureCHROMIUM",
3281 "height < 0");
3282 return;
3284 helper_->CompressedCopySubTextureCHROMIUM(target, source_id, dest_id, xoffset,
3285 yoffset, x, y, width, height);
3286 CheckGLError();
3289 void GLES2Implementation::GenValuebuffersCHROMIUM(GLsizei n, GLuint* buffers) {
3290 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGenValuebuffersCHROMIUM(" << n
3291 << ", " << static_cast<const void*>(buffers) << ")");
3292 if (n < 0) {
3293 SetGLError(GL_INVALID_VALUE, "glGenValuebuffersCHROMIUM", "n < 0");
3294 return;
3296 GPU_CLIENT_SINGLE_THREAD_CHECK();
3297 GetIdHandler(id_namespaces::kValuebuffers)->MakeIds(this, 0, n, buffers);
3298 GenValuebuffersCHROMIUMHelper(n, buffers);
3299 helper_->GenValuebuffersCHROMIUMImmediate(n, buffers);
3300 if (share_group_->bind_generates_resource())
3301 helper_->CommandBufferHelper::Flush();
3302 GPU_CLIENT_LOG_CODE_BLOCK({
3303 for (GLsizei i = 0; i < n; ++i) {
3304 GPU_CLIENT_LOG(" " << i << ": " << buffers[i]);
3307 CheckGLError();
3310 void GLES2Implementation::DeleteValuebuffersCHROMIUM(
3311 GLsizei n,
3312 const GLuint* valuebuffers) {
3313 GPU_CLIENT_SINGLE_THREAD_CHECK();
3314 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDeleteValuebuffersCHROMIUM(" << n
3315 << ", " << static_cast<const void*>(valuebuffers) << ")");
3316 GPU_CLIENT_LOG_CODE_BLOCK({
3317 for (GLsizei i = 0; i < n; ++i) {
3318 GPU_CLIENT_LOG(" " << i << ": " << valuebuffers[i]);
3321 GPU_CLIENT_DCHECK_CODE_BLOCK({
3322 for (GLsizei i = 0; i < n; ++i) {
3323 DCHECK(valuebuffers[i] != 0);
3326 if (n < 0) {
3327 SetGLError(GL_INVALID_VALUE, "glDeleteValuebuffersCHROMIUM", "n < 0");
3328 return;
3330 DeleteValuebuffersCHROMIUMHelper(n, valuebuffers);
3331 CheckGLError();
3334 GLboolean GLES2Implementation::IsValuebufferCHROMIUM(GLuint valuebuffer) {
3335 GPU_CLIENT_SINGLE_THREAD_CHECK();
3336 TRACE_EVENT0("gpu", "GLES2Implementation::IsValuebufferCHROMIUM");
3337 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glIsValuebufferCHROMIUM("
3338 << valuebuffer << ")");
3339 typedef cmds::IsValuebufferCHROMIUM::Result Result;
3340 Result* result = GetResultAs<Result*>();
3341 if (!result) {
3342 return GL_FALSE;
3344 *result = 0;
3345 helper_->IsValuebufferCHROMIUM(valuebuffer, GetResultShmId(),
3346 GetResultShmOffset());
3347 WaitForCmd();
3348 GLboolean result_value = *result != 0;
3349 GPU_CLIENT_LOG("returned " << result_value);
3350 CheckGLError();
3351 return result_value;
3354 void GLES2Implementation::BindValuebufferCHROMIUM(GLenum target,
3355 GLuint valuebuffer) {
3356 GPU_CLIENT_SINGLE_THREAD_CHECK();
3357 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBindValuebufferCHROMIUM("
3358 << GLES2Util::GetStringValueBufferTarget(target) << ", "
3359 << valuebuffer << ")");
3360 if (IsValuebufferReservedId(valuebuffer)) {
3361 SetGLError(GL_INVALID_OPERATION, "BindValuebufferCHROMIUM",
3362 "valuebuffer reserved id");
3363 return;
3365 BindValuebufferCHROMIUMHelper(target, valuebuffer);
3366 CheckGLError();
3369 void GLES2Implementation::SubscribeValueCHROMIUM(GLenum target,
3370 GLenum subscription) {
3371 GPU_CLIENT_SINGLE_THREAD_CHECK();
3372 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glSubscribeValueCHROMIUM("
3373 << GLES2Util::GetStringValueBufferTarget(target) << ", "
3374 << GLES2Util::GetStringSubscriptionTarget(subscription)
3375 << ")");
3376 helper_->SubscribeValueCHROMIUM(target, subscription);
3377 CheckGLError();
3380 void GLES2Implementation::PopulateSubscribedValuesCHROMIUM(GLenum target) {
3381 GPU_CLIENT_SINGLE_THREAD_CHECK();
3382 GPU_CLIENT_LOG("[" << GetLogPrefix()
3383 << "] glPopulateSubscribedValuesCHROMIUM("
3384 << GLES2Util::GetStringValueBufferTarget(target) << ")");
3385 helper_->PopulateSubscribedValuesCHROMIUM(target);
3386 CheckGLError();
3389 void GLES2Implementation::UniformValuebufferCHROMIUM(GLint location,
3390 GLenum target,
3391 GLenum subscription) {
3392 GPU_CLIENT_SINGLE_THREAD_CHECK();
3393 GPU_CLIENT_LOG(
3394 "[" << GetLogPrefix() << "] glUniformValuebufferCHROMIUM(" << location
3395 << ", " << GLES2Util::GetStringValueBufferTarget(target) << ", "
3396 << GLES2Util::GetStringSubscriptionTarget(subscription) << ")");
3397 helper_->UniformValuebufferCHROMIUM(location, target, subscription);
3398 CheckGLError();
3401 void GLES2Implementation::BindTexImage2DCHROMIUM(GLenum target, GLint imageId) {
3402 GPU_CLIENT_SINGLE_THREAD_CHECK();
3403 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBindTexImage2DCHROMIUM("
3404 << GLES2Util::GetStringTextureBindTarget(target) << ", "
3405 << imageId << ")");
3406 helper_->BindTexImage2DCHROMIUM(target, imageId);
3407 CheckGLError();
3410 void GLES2Implementation::ReleaseTexImage2DCHROMIUM(GLenum target,
3411 GLint imageId) {
3412 GPU_CLIENT_SINGLE_THREAD_CHECK();
3413 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glReleaseTexImage2DCHROMIUM("
3414 << GLES2Util::GetStringTextureBindTarget(target) << ", "
3415 << imageId << ")");
3416 helper_->ReleaseTexImage2DCHROMIUM(target, imageId);
3417 CheckGLError();
3420 void GLES2Implementation::DiscardFramebufferEXT(GLenum target,
3421 GLsizei count,
3422 const GLenum* attachments) {
3423 GPU_CLIENT_SINGLE_THREAD_CHECK();
3424 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDiscardFramebufferEXT("
3425 << GLES2Util::GetStringEnum(target) << ", " << count
3426 << ", " << static_cast<const void*>(attachments) << ")");
3427 GPU_CLIENT_LOG_CODE_BLOCK({
3428 for (GLsizei i = 0; i < count; ++i) {
3429 GPU_CLIENT_LOG(" " << i << ": " << attachments[0 + i * 1]);
3432 if (count < 0) {
3433 SetGLError(GL_INVALID_VALUE, "glDiscardFramebufferEXT", "count < 0");
3434 return;
3436 helper_->DiscardFramebufferEXTImmediate(target, count, attachments);
3437 CheckGLError();
3440 void GLES2Implementation::LoseContextCHROMIUM(GLenum current, GLenum other) {
3441 GPU_CLIENT_SINGLE_THREAD_CHECK();
3442 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glLoseContextCHROMIUM("
3443 << GLES2Util::GetStringResetStatus(current) << ", "
3444 << GLES2Util::GetStringResetStatus(other) << ")");
3445 helper_->LoseContextCHROMIUM(current, other);
3446 CheckGLError();
3449 void GLES2Implementation::WaitSyncPointCHROMIUM(GLuint sync_point) {
3450 GPU_CLIENT_SINGLE_THREAD_CHECK();
3451 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glWaitSyncPointCHROMIUM("
3452 << sync_point << ")");
3453 helper_->WaitSyncPointCHROMIUM(sync_point);
3454 CheckGLError();
3457 void GLES2Implementation::DrawBuffersEXT(GLsizei count, const GLenum* bufs) {
3458 GPU_CLIENT_SINGLE_THREAD_CHECK();
3459 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDrawBuffersEXT(" << count << ", "
3460 << static_cast<const void*>(bufs) << ")");
3461 GPU_CLIENT_LOG_CODE_BLOCK({
3462 for (GLsizei i = 0; i < count; ++i) {
3463 GPU_CLIENT_LOG(" " << i << ": " << bufs[0 + i * 1]);
3466 if (count < 0) {
3467 SetGLError(GL_INVALID_VALUE, "glDrawBuffersEXT", "count < 0");
3468 return;
3470 helper_->DrawBuffersEXTImmediate(count, bufs);
3471 CheckGLError();
3474 void GLES2Implementation::DiscardBackbufferCHROMIUM() {
3475 GPU_CLIENT_SINGLE_THREAD_CHECK();
3476 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDiscardBackbufferCHROMIUM("
3477 << ")");
3478 helper_->DiscardBackbufferCHROMIUM();
3479 CheckGLError();
3482 void GLES2Implementation::ScheduleOverlayPlaneCHROMIUM(
3483 GLint plane_z_order,
3484 GLenum plane_transform,
3485 GLuint overlay_texture_id,
3486 GLint bounds_x,
3487 GLint bounds_y,
3488 GLint bounds_width,
3489 GLint bounds_height,
3490 GLfloat uv_x,
3491 GLfloat uv_y,
3492 GLfloat uv_width,
3493 GLfloat uv_height) {
3494 GPU_CLIENT_SINGLE_THREAD_CHECK();
3495 GPU_CLIENT_LOG(
3496 "[" << GetLogPrefix() << "] glScheduleOverlayPlaneCHROMIUM("
3497 << plane_z_order << ", " << GLES2Util::GetStringEnum(plane_transform)
3498 << ", " << overlay_texture_id << ", " << bounds_x << ", " << bounds_y
3499 << ", " << bounds_width << ", " << bounds_height << ", " << uv_x
3500 << ", " << uv_y << ", " << uv_width << ", " << uv_height << ")");
3501 helper_->ScheduleOverlayPlaneCHROMIUM(
3502 plane_z_order, plane_transform, overlay_texture_id, bounds_x, bounds_y,
3503 bounds_width, bounds_height, uv_x, uv_y, uv_width, uv_height);
3504 CheckGLError();
3507 void GLES2Implementation::FlushDriverCachesCHROMIUM() {
3508 GPU_CLIENT_SINGLE_THREAD_CHECK();
3509 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glFlushDriverCachesCHROMIUM("
3510 << ")");
3511 helper_->FlushDriverCachesCHROMIUM();
3512 CheckGLError();
3515 void GLES2Implementation::MatrixLoadfCHROMIUM(GLenum matrixMode,
3516 const GLfloat* m) {
3517 GPU_CLIENT_SINGLE_THREAD_CHECK();
3518 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glMatrixLoadfCHROMIUM("
3519 << GLES2Util::GetStringMatrixMode(matrixMode) << ", "
3520 << static_cast<const void*>(m) << ")");
3521 size_t count = 16;
3522 for (size_t ii = 0; ii < count; ++ii)
3523 GPU_CLIENT_LOG("value[" << ii << "]: " << m[ii]);
3524 helper_->MatrixLoadfCHROMIUMImmediate(matrixMode, m);
3525 CheckGLError();
3528 void GLES2Implementation::MatrixLoadIdentityCHROMIUM(GLenum matrixMode) {
3529 GPU_CLIENT_SINGLE_THREAD_CHECK();
3530 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glMatrixLoadIdentityCHROMIUM("
3531 << GLES2Util::GetStringMatrixMode(matrixMode) << ")");
3532 helper_->MatrixLoadIdentityCHROMIUM(matrixMode);
3533 CheckGLError();
3536 GLboolean GLES2Implementation::IsPathCHROMIUM(GLuint path) {
3537 GPU_CLIENT_SINGLE_THREAD_CHECK();
3538 TRACE_EVENT0("gpu", "GLES2Implementation::IsPathCHROMIUM");
3539 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glIsPathCHROMIUM(" << path << ")");
3540 typedef cmds::IsPathCHROMIUM::Result Result;
3541 Result* result = GetResultAs<Result*>();
3542 if (!result) {
3543 return GL_FALSE;
3545 *result = 0;
3546 helper_->IsPathCHROMIUM(path, GetResultShmId(), GetResultShmOffset());
3547 WaitForCmd();
3548 GLboolean result_value = *result != 0;
3549 GPU_CLIENT_LOG("returned " << result_value);
3550 CheckGLError();
3551 return result_value;
3554 void GLES2Implementation::PathParameterfCHROMIUM(GLuint path,
3555 GLenum pname,
3556 GLfloat value) {
3557 GPU_CLIENT_SINGLE_THREAD_CHECK();
3558 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glPathParameterfCHROMIUM(" << path
3559 << ", " << GLES2Util::GetStringPathParameter(pname) << ", "
3560 << value << ")");
3561 helper_->PathParameterfCHROMIUM(path, pname, value);
3562 CheckGLError();
3565 void GLES2Implementation::PathParameteriCHROMIUM(GLuint path,
3566 GLenum pname,
3567 GLint value) {
3568 GPU_CLIENT_SINGLE_THREAD_CHECK();
3569 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glPathParameteriCHROMIUM(" << path
3570 << ", " << GLES2Util::GetStringPathParameter(pname) << ", "
3571 << value << ")");
3572 helper_->PathParameteriCHROMIUM(path, pname, value);
3573 CheckGLError();
3576 void GLES2Implementation::PathStencilFuncCHROMIUM(GLenum func,
3577 GLint ref,
3578 GLuint mask) {
3579 GPU_CLIENT_SINGLE_THREAD_CHECK();
3580 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glPathStencilFuncCHROMIUM("
3581 << GLES2Util::GetStringCmpFunction(func) << ", " << ref
3582 << ", " << mask << ")");
3583 helper_->PathStencilFuncCHROMIUM(func, ref, mask);
3584 CheckGLError();
3587 void GLES2Implementation::StencilFillPathCHROMIUM(GLuint path,
3588 GLenum fillMode,
3589 GLuint mask) {
3590 GPU_CLIENT_SINGLE_THREAD_CHECK();
3591 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glStencilFillPathCHROMIUM(" << path
3592 << ", " << GLES2Util::GetStringPathFillMode(fillMode)
3593 << ", " << mask << ")");
3594 helper_->StencilFillPathCHROMIUM(path, fillMode, mask);
3595 CheckGLError();
3598 void GLES2Implementation::StencilStrokePathCHROMIUM(GLuint path,
3599 GLint reference,
3600 GLuint mask) {
3601 GPU_CLIENT_SINGLE_THREAD_CHECK();
3602 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glStencilStrokePathCHROMIUM("
3603 << path << ", " << reference << ", " << mask << ")");
3604 helper_->StencilStrokePathCHROMIUM(path, reference, mask);
3605 CheckGLError();
3608 void GLES2Implementation::CoverFillPathCHROMIUM(GLuint path, GLenum coverMode) {
3609 GPU_CLIENT_SINGLE_THREAD_CHECK();
3610 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glCoverFillPathCHROMIUM(" << path
3611 << ", " << GLES2Util::GetStringPathCoverMode(coverMode)
3612 << ")");
3613 helper_->CoverFillPathCHROMIUM(path, coverMode);
3614 CheckGLError();
3617 void GLES2Implementation::CoverStrokePathCHROMIUM(GLuint path,
3618 GLenum coverMode) {
3619 GPU_CLIENT_SINGLE_THREAD_CHECK();
3620 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glCoverStrokePathCHROMIUM(" << path
3621 << ", " << GLES2Util::GetStringPathCoverMode(coverMode)
3622 << ")");
3623 helper_->CoverStrokePathCHROMIUM(path, coverMode);
3624 CheckGLError();
3627 void GLES2Implementation::StencilThenCoverFillPathCHROMIUM(GLuint path,
3628 GLenum fillMode,
3629 GLuint mask,
3630 GLenum coverMode) {
3631 GPU_CLIENT_SINGLE_THREAD_CHECK();
3632 GPU_CLIENT_LOG(
3633 "[" << GetLogPrefix() << "] glStencilThenCoverFillPathCHROMIUM(" << path
3634 << ", " << GLES2Util::GetStringPathFillMode(fillMode) << ", " << mask
3635 << ", " << GLES2Util::GetStringPathCoverMode(coverMode) << ")");
3636 helper_->StencilThenCoverFillPathCHROMIUM(path, fillMode, mask, coverMode);
3637 CheckGLError();
3640 void GLES2Implementation::StencilThenCoverStrokePathCHROMIUM(GLuint path,
3641 GLint reference,
3642 GLuint mask,
3643 GLenum coverMode) {
3644 GPU_CLIENT_SINGLE_THREAD_CHECK();
3645 GPU_CLIENT_LOG("[" << GetLogPrefix()
3646 << "] glStencilThenCoverStrokePathCHROMIUM(" << path
3647 << ", " << reference << ", " << mask << ", "
3648 << GLES2Util::GetStringPathCoverMode(coverMode) << ")");
3649 helper_->StencilThenCoverStrokePathCHROMIUM(path, reference, mask, coverMode);
3650 CheckGLError();
3653 void GLES2Implementation::BlendBarrierKHR() {
3654 GPU_CLIENT_SINGLE_THREAD_CHECK();
3655 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBlendBarrierKHR("
3656 << ")");
3657 helper_->BlendBarrierKHR();
3658 CheckGLError();
3661 void GLES2Implementation::ApplyScreenSpaceAntialiasingCHROMIUM() {
3662 GPU_CLIENT_SINGLE_THREAD_CHECK();
3663 GPU_CLIENT_LOG("[" << GetLogPrefix()
3664 << "] glApplyScreenSpaceAntialiasingCHROMIUM("
3665 << ")");
3666 helper_->ApplyScreenSpaceAntialiasingCHROMIUM();
3667 CheckGLError();
3670 #endif // GPU_COMMAND_BUFFER_CLIENT_GLES2_IMPLEMENTATION_IMPL_AUTOGEN_H_