Reland "Non-SFI mode: Switch to newlib. (patchset #4 id:60001 of https://codereview...
[chromium-blink-merge.git] / gpu / command_buffer / client / gles2_implementation_impl_autogen.h
blob37867994591f1739b559b5b0f3fa258848d631ce
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 // This file is auto-generated from
6 // gpu/command_buffer/build_gles2_cmd_buffer.py
7 // It's formatted by clang-format using chromium coding style:
8 // clang-format -i -style=chromium filename
9 // DO NOT EDIT!
11 // This file is included by gles2_implementation.cc to define the
12 // GL api functions.
13 #ifndef GPU_COMMAND_BUFFER_CLIENT_GLES2_IMPLEMENTATION_IMPL_AUTOGEN_H_
14 #define GPU_COMMAND_BUFFER_CLIENT_GLES2_IMPLEMENTATION_IMPL_AUTOGEN_H_
16 void GLES2Implementation::AttachShader(GLuint program, GLuint shader) {
17 GPU_CLIENT_SINGLE_THREAD_CHECK();
18 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glAttachShader(" << program << ", "
19 << shader << ")");
20 helper_->AttachShader(program, shader);
21 CheckGLError();
24 void GLES2Implementation::BindBuffer(GLenum target, GLuint buffer) {
25 GPU_CLIENT_SINGLE_THREAD_CHECK();
26 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBindBuffer("
27 << GLES2Util::GetStringBufferTarget(target) << ", "
28 << buffer << ")");
29 if (IsBufferReservedId(buffer)) {
30 SetGLError(GL_INVALID_OPERATION, "BindBuffer", "buffer reserved id");
31 return;
33 BindBufferHelper(target, buffer);
34 CheckGLError();
37 void GLES2Implementation::BindBufferBase(GLenum target,
38 GLuint index,
39 GLuint buffer) {
40 GPU_CLIENT_SINGLE_THREAD_CHECK();
41 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBindBufferBase("
42 << GLES2Util::GetStringIndexedBufferTarget(target) << ", "
43 << index << ", " << buffer << ")");
44 if (IsBufferReservedId(buffer)) {
45 SetGLError(GL_INVALID_OPERATION, "BindBufferBase", "buffer reserved id");
46 return;
48 BindBufferBaseHelper(target, index, buffer);
49 CheckGLError();
52 void GLES2Implementation::BindBufferRange(GLenum target,
53 GLuint index,
54 GLuint buffer,
55 GLintptr offset,
56 GLsizeiptr size) {
57 GPU_CLIENT_SINGLE_THREAD_CHECK();
58 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBindBufferRange("
59 << GLES2Util::GetStringIndexedBufferTarget(target) << ", "
60 << index << ", " << buffer << ", " << offset << ", "
61 << size << ")");
62 if (offset < 0) {
63 SetGLError(GL_INVALID_VALUE, "glBindBufferRange", "offset < 0");
64 return;
66 if (size < 0) {
67 SetGLError(GL_INVALID_VALUE, "glBindBufferRange", "size < 0");
68 return;
70 if (IsBufferReservedId(buffer)) {
71 SetGLError(GL_INVALID_OPERATION, "BindBufferRange", "buffer reserved id");
72 return;
74 BindBufferRangeHelper(target, index, buffer, offset, size);
75 CheckGLError();
78 void GLES2Implementation::BindFramebuffer(GLenum target, GLuint framebuffer) {
79 GPU_CLIENT_SINGLE_THREAD_CHECK();
80 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBindFramebuffer("
81 << GLES2Util::GetStringFrameBufferTarget(target) << ", "
82 << framebuffer << ")");
83 if (IsFramebufferReservedId(framebuffer)) {
84 SetGLError(GL_INVALID_OPERATION, "BindFramebuffer",
85 "framebuffer reserved id");
86 return;
88 BindFramebufferHelper(target, framebuffer);
89 CheckGLError();
92 void GLES2Implementation::BindRenderbuffer(GLenum target, GLuint renderbuffer) {
93 GPU_CLIENT_SINGLE_THREAD_CHECK();
94 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBindRenderbuffer("
95 << GLES2Util::GetStringRenderBufferTarget(target) << ", "
96 << renderbuffer << ")");
97 if (IsRenderbufferReservedId(renderbuffer)) {
98 SetGLError(GL_INVALID_OPERATION, "BindRenderbuffer",
99 "renderbuffer reserved id");
100 return;
102 BindRenderbufferHelper(target, renderbuffer);
103 CheckGLError();
106 void GLES2Implementation::BindSampler(GLuint unit, GLuint sampler) {
107 GPU_CLIENT_SINGLE_THREAD_CHECK();
108 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBindSampler(" << unit << ", "
109 << sampler << ")");
110 if (IsSamplerReservedId(sampler)) {
111 SetGLError(GL_INVALID_OPERATION, "BindSampler", "sampler reserved id");
112 return;
114 BindSamplerHelper(unit, sampler);
115 CheckGLError();
118 void GLES2Implementation::BindTexture(GLenum target, GLuint texture) {
119 GPU_CLIENT_SINGLE_THREAD_CHECK();
120 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBindTexture("
121 << GLES2Util::GetStringTextureBindTarget(target) << ", "
122 << texture << ")");
123 if (IsTextureReservedId(texture)) {
124 SetGLError(GL_INVALID_OPERATION, "BindTexture", "texture reserved id");
125 return;
127 BindTextureHelper(target, texture);
128 CheckGLError();
131 void GLES2Implementation::BindTransformFeedback(GLenum target,
132 GLuint transformfeedback) {
133 GPU_CLIENT_SINGLE_THREAD_CHECK();
134 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBindTransformFeedback("
135 << GLES2Util::GetStringTransformFeedbackBindTarget(target)
136 << ", " << transformfeedback << ")");
137 if (IsTransformFeedbackReservedId(transformfeedback)) {
138 SetGLError(GL_INVALID_OPERATION, "BindTransformFeedback",
139 "transformfeedback reserved id");
140 return;
142 BindTransformFeedbackHelper(target, transformfeedback);
143 CheckGLError();
146 void GLES2Implementation::BlendColor(GLclampf red,
147 GLclampf green,
148 GLclampf blue,
149 GLclampf alpha) {
150 GPU_CLIENT_SINGLE_THREAD_CHECK();
151 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBlendColor(" << red << ", "
152 << green << ", " << blue << ", " << alpha << ")");
153 helper_->BlendColor(red, green, blue, alpha);
154 CheckGLError();
157 void GLES2Implementation::BlendEquation(GLenum mode) {
158 GPU_CLIENT_SINGLE_THREAD_CHECK();
159 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBlendEquation("
160 << GLES2Util::GetStringEquation(mode) << ")");
161 helper_->BlendEquation(mode);
162 CheckGLError();
165 void GLES2Implementation::BlendEquationSeparate(GLenum modeRGB,
166 GLenum modeAlpha) {
167 GPU_CLIENT_SINGLE_THREAD_CHECK();
168 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBlendEquationSeparate("
169 << GLES2Util::GetStringEquation(modeRGB) << ", "
170 << GLES2Util::GetStringEquation(modeAlpha) << ")");
171 helper_->BlendEquationSeparate(modeRGB, modeAlpha);
172 CheckGLError();
175 void GLES2Implementation::BlendFunc(GLenum sfactor, GLenum dfactor) {
176 GPU_CLIENT_SINGLE_THREAD_CHECK();
177 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBlendFunc("
178 << GLES2Util::GetStringSrcBlendFactor(sfactor) << ", "
179 << GLES2Util::GetStringDstBlendFactor(dfactor) << ")");
180 helper_->BlendFunc(sfactor, dfactor);
181 CheckGLError();
184 void GLES2Implementation::BlendFuncSeparate(GLenum srcRGB,
185 GLenum dstRGB,
186 GLenum srcAlpha,
187 GLenum dstAlpha) {
188 GPU_CLIENT_SINGLE_THREAD_CHECK();
189 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBlendFuncSeparate("
190 << GLES2Util::GetStringSrcBlendFactor(srcRGB) << ", "
191 << GLES2Util::GetStringDstBlendFactor(dstRGB) << ", "
192 << GLES2Util::GetStringSrcBlendFactor(srcAlpha) << ", "
193 << GLES2Util::GetStringDstBlendFactor(dstAlpha) << ")");
194 helper_->BlendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha);
195 CheckGLError();
198 GLenum GLES2Implementation::CheckFramebufferStatus(GLenum target) {
199 GPU_CLIENT_SINGLE_THREAD_CHECK();
200 TRACE_EVENT0("gpu", "GLES2Implementation::CheckFramebufferStatus");
201 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glCheckFramebufferStatus("
202 << GLES2Util::GetStringFrameBufferTarget(target) << ")");
203 typedef cmds::CheckFramebufferStatus::Result Result;
204 Result* result = GetResultAs<Result*>();
205 if (!result) {
206 return GL_FRAMEBUFFER_UNSUPPORTED;
208 *result = 0;
209 helper_->CheckFramebufferStatus(target, GetResultShmId(),
210 GetResultShmOffset());
211 WaitForCmd();
212 GLenum result_value = *result;
213 GPU_CLIENT_LOG("returned " << result_value);
214 CheckGLError();
215 return result_value;
218 void GLES2Implementation::Clear(GLbitfield mask) {
219 GPU_CLIENT_SINGLE_THREAD_CHECK();
220 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glClear(" << mask << ")");
221 helper_->Clear(mask);
222 CheckGLError();
225 void GLES2Implementation::ClearBufferfi(GLenum buffer,
226 GLint drawbuffers,
227 GLfloat depth,
228 GLint stencil) {
229 GPU_CLIENT_SINGLE_THREAD_CHECK();
230 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glClearBufferfi("
231 << GLES2Util::GetStringBufferfv(buffer) << ", "
232 << drawbuffers << ", " << depth << ", " << stencil << ")");
233 helper_->ClearBufferfi(buffer, drawbuffers, depth, stencil);
234 CheckGLError();
237 void GLES2Implementation::ClearBufferfv(GLenum buffer,
238 GLint drawbuffers,
239 const GLfloat* value) {
240 GPU_CLIENT_SINGLE_THREAD_CHECK();
241 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glClearBufferfv("
242 << GLES2Util::GetStringBufferfv(buffer) << ", "
243 << drawbuffers << ", " << static_cast<const void*>(value)
244 << ")");
245 size_t count = GLES2Util::CalcClearBufferfvDataCount(buffer);
246 DCHECK_LE(count, 4u);
247 for (size_t ii = 0; ii < count; ++ii)
248 GPU_CLIENT_LOG("value[" << ii << "]: " << value[ii]);
249 helper_->ClearBufferfvImmediate(buffer, drawbuffers, value);
250 CheckGLError();
253 void GLES2Implementation::ClearBufferiv(GLenum buffer,
254 GLint drawbuffers,
255 const GLint* value) {
256 GPU_CLIENT_SINGLE_THREAD_CHECK();
257 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glClearBufferiv("
258 << GLES2Util::GetStringBufferiv(buffer) << ", "
259 << drawbuffers << ", " << static_cast<const void*>(value)
260 << ")");
261 size_t count = GLES2Util::CalcClearBufferivDataCount(buffer);
262 DCHECK_LE(count, 4u);
263 for (size_t ii = 0; ii < count; ++ii)
264 GPU_CLIENT_LOG("value[" << ii << "]: " << value[ii]);
265 helper_->ClearBufferivImmediate(buffer, drawbuffers, value);
266 CheckGLError();
269 void GLES2Implementation::ClearBufferuiv(GLenum buffer,
270 GLint drawbuffers,
271 const GLuint* value) {
272 GPU_CLIENT_SINGLE_THREAD_CHECK();
273 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glClearBufferuiv("
274 << GLES2Util::GetStringBufferuiv(buffer) << ", "
275 << drawbuffers << ", " << static_cast<const void*>(value)
276 << ")");
277 size_t count = 4;
278 for (size_t ii = 0; ii < count; ++ii)
279 GPU_CLIENT_LOG("value[" << ii << "]: " << value[ii]);
280 helper_->ClearBufferuivImmediate(buffer, drawbuffers, value);
281 CheckGLError();
284 void GLES2Implementation::ClearColor(GLclampf red,
285 GLclampf green,
286 GLclampf blue,
287 GLclampf alpha) {
288 GPU_CLIENT_SINGLE_THREAD_CHECK();
289 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glClearColor(" << red << ", "
290 << green << ", " << blue << ", " << alpha << ")");
291 helper_->ClearColor(red, green, blue, alpha);
292 CheckGLError();
295 void GLES2Implementation::ClearDepthf(GLclampf depth) {
296 GPU_CLIENT_SINGLE_THREAD_CHECK();
297 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glClearDepthf(" << depth << ")");
298 helper_->ClearDepthf(depth);
299 CheckGLError();
302 void GLES2Implementation::ClearStencil(GLint s) {
303 GPU_CLIENT_SINGLE_THREAD_CHECK();
304 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glClearStencil(" << s << ")");
305 helper_->ClearStencil(s);
306 CheckGLError();
309 void GLES2Implementation::ColorMask(GLboolean red,
310 GLboolean green,
311 GLboolean blue,
312 GLboolean alpha) {
313 GPU_CLIENT_SINGLE_THREAD_CHECK();
314 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glColorMask("
315 << GLES2Util::GetStringBool(red) << ", "
316 << GLES2Util::GetStringBool(green) << ", "
317 << GLES2Util::GetStringBool(blue) << ", "
318 << GLES2Util::GetStringBool(alpha) << ")");
319 helper_->ColorMask(red, green, blue, alpha);
320 CheckGLError();
323 void GLES2Implementation::CompileShader(GLuint shader) {
324 GPU_CLIENT_SINGLE_THREAD_CHECK();
325 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glCompileShader(" << shader
326 << ")");
327 helper_->CompileShader(shader);
328 CheckGLError();
331 void GLES2Implementation::CopyBufferSubData(GLenum readtarget,
332 GLenum writetarget,
333 GLintptr readoffset,
334 GLintptr writeoffset,
335 GLsizeiptr size) {
336 GPU_CLIENT_SINGLE_THREAD_CHECK();
337 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glCopyBufferSubData("
338 << GLES2Util::GetStringBufferTarget(readtarget) << ", "
339 << GLES2Util::GetStringBufferTarget(writetarget) << ", "
340 << readoffset << ", " << writeoffset << ", " << size
341 << ")");
342 if (readoffset < 0) {
343 SetGLError(GL_INVALID_VALUE, "glCopyBufferSubData", "readoffset < 0");
344 return;
346 if (writeoffset < 0) {
347 SetGLError(GL_INVALID_VALUE, "glCopyBufferSubData", "writeoffset < 0");
348 return;
350 if (size < 0) {
351 SetGLError(GL_INVALID_VALUE, "glCopyBufferSubData", "size < 0");
352 return;
354 helper_->CopyBufferSubData(readtarget, writetarget, readoffset, writeoffset,
355 size);
356 CheckGLError();
359 void GLES2Implementation::CopyTexImage2D(GLenum target,
360 GLint level,
361 GLenum internalformat,
362 GLint x,
363 GLint y,
364 GLsizei width,
365 GLsizei height,
366 GLint border) {
367 GPU_CLIENT_SINGLE_THREAD_CHECK();
368 GPU_CLIENT_LOG(
369 "[" << GetLogPrefix() << "] glCopyTexImage2D("
370 << GLES2Util::GetStringTextureTarget(target) << ", " << level << ", "
371 << GLES2Util::GetStringTextureInternalFormat(internalformat) << ", "
372 << x << ", " << y << ", " << width << ", " << height << ", " << border
373 << ")");
374 if (width < 0) {
375 SetGLError(GL_INVALID_VALUE, "glCopyTexImage2D", "width < 0");
376 return;
378 if (height < 0) {
379 SetGLError(GL_INVALID_VALUE, "glCopyTexImage2D", "height < 0");
380 return;
382 if (border != 0) {
383 SetGLError(GL_INVALID_VALUE, "glCopyTexImage2D", "border GL_INVALID_VALUE");
384 return;
386 helper_->CopyTexImage2D(target, level, internalformat, x, y, width, height);
387 CheckGLError();
390 void GLES2Implementation::CopyTexSubImage2D(GLenum target,
391 GLint level,
392 GLint xoffset,
393 GLint yoffset,
394 GLint x,
395 GLint y,
396 GLsizei width,
397 GLsizei height) {
398 GPU_CLIENT_SINGLE_THREAD_CHECK();
399 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glCopyTexSubImage2D("
400 << GLES2Util::GetStringTextureTarget(target) << ", "
401 << level << ", " << xoffset << ", " << yoffset << ", " << x
402 << ", " << y << ", " << width << ", " << height << ")");
403 if (width < 0) {
404 SetGLError(GL_INVALID_VALUE, "glCopyTexSubImage2D", "width < 0");
405 return;
407 if (height < 0) {
408 SetGLError(GL_INVALID_VALUE, "glCopyTexSubImage2D", "height < 0");
409 return;
411 helper_->CopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width,
412 height);
413 CheckGLError();
416 void GLES2Implementation::CopyTexSubImage3D(GLenum target,
417 GLint level,
418 GLint xoffset,
419 GLint yoffset,
420 GLint zoffset,
421 GLint x,
422 GLint y,
423 GLsizei width,
424 GLsizei height) {
425 GPU_CLIENT_SINGLE_THREAD_CHECK();
426 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glCopyTexSubImage3D("
427 << GLES2Util::GetStringTexture3DTarget(target) << ", "
428 << level << ", " << xoffset << ", " << yoffset << ", "
429 << zoffset << ", " << x << ", " << y << ", " << width
430 << ", " << height << ")");
431 if (width < 0) {
432 SetGLError(GL_INVALID_VALUE, "glCopyTexSubImage3D", "width < 0");
433 return;
435 if (height < 0) {
436 SetGLError(GL_INVALID_VALUE, "glCopyTexSubImage3D", "height < 0");
437 return;
439 helper_->CopyTexSubImage3D(target, level, xoffset, yoffset, zoffset, x, y,
440 width, height);
441 CheckGLError();
444 GLuint GLES2Implementation::CreateProgram() {
445 GPU_CLIENT_SINGLE_THREAD_CHECK();
446 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glCreateProgram("
447 << ")");
448 GLuint client_id;
449 GetIdHandler(id_namespaces::kProgramsAndShaders)
450 ->MakeIds(this, 0, 1, &client_id);
451 helper_->CreateProgram(client_id);
452 GPU_CLIENT_LOG("returned " << client_id);
453 CheckGLError();
454 return client_id;
457 GLuint GLES2Implementation::CreateShader(GLenum type) {
458 GPU_CLIENT_SINGLE_THREAD_CHECK();
459 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glCreateShader("
460 << GLES2Util::GetStringShaderType(type) << ")");
461 GLuint client_id;
462 GetIdHandler(id_namespaces::kProgramsAndShaders)
463 ->MakeIds(this, 0, 1, &client_id);
464 helper_->CreateShader(type, client_id);
465 GPU_CLIENT_LOG("returned " << client_id);
466 CheckGLError();
467 return client_id;
470 void GLES2Implementation::CullFace(GLenum mode) {
471 GPU_CLIENT_SINGLE_THREAD_CHECK();
472 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glCullFace("
473 << GLES2Util::GetStringFaceType(mode) << ")");
474 helper_->CullFace(mode);
475 CheckGLError();
478 void GLES2Implementation::DeleteBuffers(GLsizei n, const GLuint* buffers) {
479 GPU_CLIENT_SINGLE_THREAD_CHECK();
480 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDeleteBuffers(" << n << ", "
481 << static_cast<const void*>(buffers) << ")");
482 GPU_CLIENT_LOG_CODE_BLOCK({
483 for (GLsizei i = 0; i < n; ++i) {
484 GPU_CLIENT_LOG(" " << i << ": " << buffers[i]);
487 GPU_CLIENT_DCHECK_CODE_BLOCK({
488 for (GLsizei i = 0; i < n; ++i) {
489 DCHECK(buffers[i] != 0);
492 if (n < 0) {
493 SetGLError(GL_INVALID_VALUE, "glDeleteBuffers", "n < 0");
494 return;
496 DeleteBuffersHelper(n, buffers);
497 CheckGLError();
500 void GLES2Implementation::DeleteFramebuffers(GLsizei n,
501 const GLuint* framebuffers) {
502 GPU_CLIENT_SINGLE_THREAD_CHECK();
503 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDeleteFramebuffers(" << n << ", "
504 << static_cast<const void*>(framebuffers) << ")");
505 GPU_CLIENT_LOG_CODE_BLOCK({
506 for (GLsizei i = 0; i < n; ++i) {
507 GPU_CLIENT_LOG(" " << i << ": " << framebuffers[i]);
510 GPU_CLIENT_DCHECK_CODE_BLOCK({
511 for (GLsizei i = 0; i < n; ++i) {
512 DCHECK(framebuffers[i] != 0);
515 if (n < 0) {
516 SetGLError(GL_INVALID_VALUE, "glDeleteFramebuffers", "n < 0");
517 return;
519 DeleteFramebuffersHelper(n, framebuffers);
520 CheckGLError();
523 void GLES2Implementation::DeleteProgram(GLuint program) {
524 GPU_CLIENT_SINGLE_THREAD_CHECK();
525 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDeleteProgram(" << program
526 << ")");
527 GPU_CLIENT_DCHECK(program != 0);
528 DeleteProgramHelper(program);
529 CheckGLError();
532 void GLES2Implementation::DeleteRenderbuffers(GLsizei n,
533 const GLuint* renderbuffers) {
534 GPU_CLIENT_SINGLE_THREAD_CHECK();
535 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDeleteRenderbuffers(" << n
536 << ", " << static_cast<const void*>(renderbuffers) << ")");
537 GPU_CLIENT_LOG_CODE_BLOCK({
538 for (GLsizei i = 0; i < n; ++i) {
539 GPU_CLIENT_LOG(" " << i << ": " << renderbuffers[i]);
542 GPU_CLIENT_DCHECK_CODE_BLOCK({
543 for (GLsizei i = 0; i < n; ++i) {
544 DCHECK(renderbuffers[i] != 0);
547 if (n < 0) {
548 SetGLError(GL_INVALID_VALUE, "glDeleteRenderbuffers", "n < 0");
549 return;
551 DeleteRenderbuffersHelper(n, renderbuffers);
552 CheckGLError();
555 void GLES2Implementation::DeleteSamplers(GLsizei n, const GLuint* samplers) {
556 GPU_CLIENT_SINGLE_THREAD_CHECK();
557 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDeleteSamplers(" << n << ", "
558 << static_cast<const void*>(samplers) << ")");
559 GPU_CLIENT_LOG_CODE_BLOCK({
560 for (GLsizei i = 0; i < n; ++i) {
561 GPU_CLIENT_LOG(" " << i << ": " << samplers[i]);
564 GPU_CLIENT_DCHECK_CODE_BLOCK({
565 for (GLsizei i = 0; i < n; ++i) {
566 DCHECK(samplers[i] != 0);
569 if (n < 0) {
570 SetGLError(GL_INVALID_VALUE, "glDeleteSamplers", "n < 0");
571 return;
573 DeleteSamplersHelper(n, samplers);
574 CheckGLError();
577 void GLES2Implementation::DeleteSync(GLsync sync) {
578 GPU_CLIENT_SINGLE_THREAD_CHECK();
579 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDeleteSync(" << sync << ")");
580 GPU_CLIENT_DCHECK(sync != 0);
581 DeleteSyncHelper(sync);
582 CheckGLError();
585 void GLES2Implementation::DeleteShader(GLuint shader) {
586 GPU_CLIENT_SINGLE_THREAD_CHECK();
587 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDeleteShader(" << shader << ")");
588 GPU_CLIENT_DCHECK(shader != 0);
589 DeleteShaderHelper(shader);
590 CheckGLError();
593 void GLES2Implementation::DeleteTextures(GLsizei n, const GLuint* textures) {
594 GPU_CLIENT_SINGLE_THREAD_CHECK();
595 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDeleteTextures(" << n << ", "
596 << static_cast<const void*>(textures) << ")");
597 GPU_CLIENT_LOG_CODE_BLOCK({
598 for (GLsizei i = 0; i < n; ++i) {
599 GPU_CLIENT_LOG(" " << i << ": " << textures[i]);
602 GPU_CLIENT_DCHECK_CODE_BLOCK({
603 for (GLsizei i = 0; i < n; ++i) {
604 DCHECK(textures[i] != 0);
607 if (n < 0) {
608 SetGLError(GL_INVALID_VALUE, "glDeleteTextures", "n < 0");
609 return;
611 DeleteTexturesHelper(n, textures);
612 CheckGLError();
615 void GLES2Implementation::DeleteTransformFeedbacks(GLsizei n,
616 const GLuint* ids) {
617 GPU_CLIENT_SINGLE_THREAD_CHECK();
618 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDeleteTransformFeedbacks(" << n
619 << ", " << static_cast<const void*>(ids) << ")");
620 GPU_CLIENT_LOG_CODE_BLOCK({
621 for (GLsizei i = 0; i < n; ++i) {
622 GPU_CLIENT_LOG(" " << i << ": " << ids[i]);
625 GPU_CLIENT_DCHECK_CODE_BLOCK({
626 for (GLsizei i = 0; i < n; ++i) {
627 DCHECK(ids[i] != 0);
630 if (n < 0) {
631 SetGLError(GL_INVALID_VALUE, "glDeleteTransformFeedbacks", "n < 0");
632 return;
634 DeleteTransformFeedbacksHelper(n, ids);
635 CheckGLError();
638 void GLES2Implementation::DepthFunc(GLenum func) {
639 GPU_CLIENT_SINGLE_THREAD_CHECK();
640 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDepthFunc("
641 << GLES2Util::GetStringCmpFunction(func) << ")");
642 helper_->DepthFunc(func);
643 CheckGLError();
646 void GLES2Implementation::DepthMask(GLboolean flag) {
647 GPU_CLIENT_SINGLE_THREAD_CHECK();
648 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDepthMask("
649 << GLES2Util::GetStringBool(flag) << ")");
650 helper_->DepthMask(flag);
651 CheckGLError();
654 void GLES2Implementation::DepthRangef(GLclampf zNear, GLclampf zFar) {
655 GPU_CLIENT_SINGLE_THREAD_CHECK();
656 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDepthRangef(" << zNear << ", "
657 << zFar << ")");
658 helper_->DepthRangef(zNear, zFar);
659 CheckGLError();
662 void GLES2Implementation::DetachShader(GLuint program, GLuint shader) {
663 GPU_CLIENT_SINGLE_THREAD_CHECK();
664 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDetachShader(" << program << ", "
665 << shader << ")");
666 helper_->DetachShader(program, shader);
667 CheckGLError();
670 GLsync GLES2Implementation::FenceSync(GLenum condition, GLbitfield flags) {
671 GPU_CLIENT_SINGLE_THREAD_CHECK();
672 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glFenceSync("
673 << GLES2Util::GetStringSyncCondition(condition) << ", "
674 << flags << ")");
675 if (condition != GL_SYNC_GPU_COMMANDS_COMPLETE) {
676 SetGLError(GL_INVALID_ENUM, "glFenceSync", "condition GL_INVALID_ENUM");
677 return 0;
679 if (flags != 0) {
680 SetGLError(GL_INVALID_VALUE, "glFenceSync", "flags GL_INVALID_VALUE");
681 return 0;
683 GLuint client_id;
684 GetIdHandler(id_namespaces::kSyncs)->MakeIds(this, 0, 1, &client_id);
685 helper_->FenceSync(client_id);
686 GPU_CLIENT_LOG("returned " << client_id);
687 CheckGLError();
688 return reinterpret_cast<GLsync>(client_id);
691 void GLES2Implementation::FramebufferRenderbuffer(GLenum target,
692 GLenum attachment,
693 GLenum renderbuffertarget,
694 GLuint renderbuffer) {
695 GPU_CLIENT_SINGLE_THREAD_CHECK();
696 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glFramebufferRenderbuffer("
697 << GLES2Util::GetStringFrameBufferTarget(target) << ", "
698 << GLES2Util::GetStringAttachment(attachment) << ", "
699 << GLES2Util::GetStringRenderBufferTarget(
700 renderbuffertarget) << ", " << renderbuffer << ")");
701 helper_->FramebufferRenderbuffer(target, attachment, renderbuffertarget,
702 renderbuffer);
703 CheckGLError();
706 void GLES2Implementation::FramebufferTexture2D(GLenum target,
707 GLenum attachment,
708 GLenum textarget,
709 GLuint texture,
710 GLint level) {
711 GPU_CLIENT_SINGLE_THREAD_CHECK();
712 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glFramebufferTexture2D("
713 << GLES2Util::GetStringFrameBufferTarget(target) << ", "
714 << GLES2Util::GetStringAttachment(attachment) << ", "
715 << GLES2Util::GetStringTextureTarget(textarget) << ", "
716 << texture << ", " << level << ")");
717 if (level != 0) {
718 SetGLError(GL_INVALID_VALUE, "glFramebufferTexture2D",
719 "level GL_INVALID_VALUE");
720 return;
722 helper_->FramebufferTexture2D(target, attachment, textarget, texture);
723 CheckGLError();
726 void GLES2Implementation::FramebufferTextureLayer(GLenum target,
727 GLenum attachment,
728 GLuint texture,
729 GLint level,
730 GLint layer) {
731 GPU_CLIENT_SINGLE_THREAD_CHECK();
732 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glFramebufferTextureLayer("
733 << GLES2Util::GetStringFrameBufferTarget(target) << ", "
734 << GLES2Util::GetStringAttachment(attachment) << ", "
735 << texture << ", " << level << ", " << layer << ")");
736 helper_->FramebufferTextureLayer(target, attachment, texture, level, layer);
737 CheckGLError();
740 void GLES2Implementation::FrontFace(GLenum mode) {
741 GPU_CLIENT_SINGLE_THREAD_CHECK();
742 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glFrontFace("
743 << GLES2Util::GetStringFaceMode(mode) << ")");
744 helper_->FrontFace(mode);
745 CheckGLError();
748 void GLES2Implementation::GenBuffers(GLsizei n, GLuint* buffers) {
749 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGenBuffers(" << n << ", "
750 << static_cast<const void*>(buffers) << ")");
751 if (n < 0) {
752 SetGLError(GL_INVALID_VALUE, "glGenBuffers", "n < 0");
753 return;
755 GPU_CLIENT_SINGLE_THREAD_CHECK();
756 GetIdHandler(id_namespaces::kBuffers)->MakeIds(this, 0, n, buffers);
757 GenBuffersHelper(n, buffers);
758 helper_->GenBuffersImmediate(n, buffers);
759 if (share_group_->bind_generates_resource())
760 helper_->CommandBufferHelper::Flush();
761 GPU_CLIENT_LOG_CODE_BLOCK({
762 for (GLsizei i = 0; i < n; ++i) {
763 GPU_CLIENT_LOG(" " << i << ": " << buffers[i]);
766 CheckGLError();
769 void GLES2Implementation::GenerateMipmap(GLenum target) {
770 GPU_CLIENT_SINGLE_THREAD_CHECK();
771 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGenerateMipmap("
772 << GLES2Util::GetStringTextureBindTarget(target) << ")");
773 helper_->GenerateMipmap(target);
774 CheckGLError();
777 void GLES2Implementation::GenFramebuffers(GLsizei n, GLuint* framebuffers) {
778 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGenFramebuffers(" << n << ", "
779 << static_cast<const void*>(framebuffers) << ")");
780 if (n < 0) {
781 SetGLError(GL_INVALID_VALUE, "glGenFramebuffers", "n < 0");
782 return;
784 GPU_CLIENT_SINGLE_THREAD_CHECK();
785 GetIdHandler(id_namespaces::kFramebuffers)->MakeIds(this, 0, n, framebuffers);
786 GenFramebuffersHelper(n, framebuffers);
787 helper_->GenFramebuffersImmediate(n, framebuffers);
788 if (share_group_->bind_generates_resource())
789 helper_->CommandBufferHelper::Flush();
790 GPU_CLIENT_LOG_CODE_BLOCK({
791 for (GLsizei i = 0; i < n; ++i) {
792 GPU_CLIENT_LOG(" " << i << ": " << framebuffers[i]);
795 CheckGLError();
798 void GLES2Implementation::GenRenderbuffers(GLsizei n, GLuint* renderbuffers) {
799 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGenRenderbuffers(" << n << ", "
800 << static_cast<const void*>(renderbuffers) << ")");
801 if (n < 0) {
802 SetGLError(GL_INVALID_VALUE, "glGenRenderbuffers", "n < 0");
803 return;
805 GPU_CLIENT_SINGLE_THREAD_CHECK();
806 GetIdHandler(id_namespaces::kRenderbuffers)
807 ->MakeIds(this, 0, n, renderbuffers);
808 GenRenderbuffersHelper(n, renderbuffers);
809 helper_->GenRenderbuffersImmediate(n, renderbuffers);
810 if (share_group_->bind_generates_resource())
811 helper_->CommandBufferHelper::Flush();
812 GPU_CLIENT_LOG_CODE_BLOCK({
813 for (GLsizei i = 0; i < n; ++i) {
814 GPU_CLIENT_LOG(" " << i << ": " << renderbuffers[i]);
817 CheckGLError();
820 void GLES2Implementation::GenSamplers(GLsizei n, GLuint* samplers) {
821 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGenSamplers(" << n << ", "
822 << static_cast<const void*>(samplers) << ")");
823 if (n < 0) {
824 SetGLError(GL_INVALID_VALUE, "glGenSamplers", "n < 0");
825 return;
827 GPU_CLIENT_SINGLE_THREAD_CHECK();
828 GetIdHandler(id_namespaces::kSamplers)->MakeIds(this, 0, n, samplers);
829 GenSamplersHelper(n, samplers);
830 helper_->GenSamplersImmediate(n, samplers);
831 if (share_group_->bind_generates_resource())
832 helper_->CommandBufferHelper::Flush();
833 GPU_CLIENT_LOG_CODE_BLOCK({
834 for (GLsizei i = 0; i < n; ++i) {
835 GPU_CLIENT_LOG(" " << i << ": " << samplers[i]);
838 CheckGLError();
841 void GLES2Implementation::GenTextures(GLsizei n, GLuint* textures) {
842 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGenTextures(" << n << ", "
843 << static_cast<const void*>(textures) << ")");
844 if (n < 0) {
845 SetGLError(GL_INVALID_VALUE, "glGenTextures", "n < 0");
846 return;
848 GPU_CLIENT_SINGLE_THREAD_CHECK();
849 GetIdHandler(id_namespaces::kTextures)->MakeIds(this, 0, n, textures);
850 GenTexturesHelper(n, textures);
851 helper_->GenTexturesImmediate(n, textures);
852 if (share_group_->bind_generates_resource())
853 helper_->CommandBufferHelper::Flush();
854 GPU_CLIENT_LOG_CODE_BLOCK({
855 for (GLsizei i = 0; i < n; ++i) {
856 GPU_CLIENT_LOG(" " << i << ": " << textures[i]);
859 CheckGLError();
862 void GLES2Implementation::GenTransformFeedbacks(GLsizei n, GLuint* ids) {
863 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGenTransformFeedbacks(" << n
864 << ", " << static_cast<const void*>(ids) << ")");
865 if (n < 0) {
866 SetGLError(GL_INVALID_VALUE, "glGenTransformFeedbacks", "n < 0");
867 return;
869 GPU_CLIENT_SINGLE_THREAD_CHECK();
870 GetIdHandler(id_namespaces::kTransformFeedbacks)->MakeIds(this, 0, n, ids);
871 GenTransformFeedbacksHelper(n, ids);
872 helper_->GenTransformFeedbacksImmediate(n, ids);
873 if (share_group_->bind_generates_resource())
874 helper_->CommandBufferHelper::Flush();
875 GPU_CLIENT_LOG_CODE_BLOCK({
876 for (GLsizei i = 0; i < n; ++i) {
877 GPU_CLIENT_LOG(" " << i << ": " << ids[i]);
880 CheckGLError();
883 void GLES2Implementation::GetBooleanv(GLenum pname, GLboolean* params) {
884 GPU_CLIENT_SINGLE_THREAD_CHECK();
885 GPU_CLIENT_VALIDATE_DESTINATION_INITALIZATION(GLboolean, params);
886 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetBooleanv("
887 << GLES2Util::GetStringGLState(pname) << ", "
888 << static_cast<const void*>(params) << ")");
889 TRACE_EVENT0("gpu", "GLES2Implementation::GetBooleanv");
890 if (GetBooleanvHelper(pname, params)) {
891 return;
893 typedef cmds::GetBooleanv::Result Result;
894 Result* result = GetResultAs<Result*>();
895 if (!result) {
896 return;
898 result->SetNumResults(0);
899 helper_->GetBooleanv(pname, GetResultShmId(), GetResultShmOffset());
900 WaitForCmd();
901 result->CopyResult(params);
902 GPU_CLIENT_LOG_CODE_BLOCK({
903 for (int32_t i = 0; i < result->GetNumResults(); ++i) {
904 GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]);
907 CheckGLError();
909 void GLES2Implementation::GetBufferParameteriv(GLenum target,
910 GLenum pname,
911 GLint* params) {
912 GPU_CLIENT_SINGLE_THREAD_CHECK();
913 GPU_CLIENT_VALIDATE_DESTINATION_INITALIZATION(GLint, params);
914 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetBufferParameteriv("
915 << GLES2Util::GetStringBufferTarget(target) << ", "
916 << GLES2Util::GetStringBufferParameter(pname) << ", "
917 << static_cast<const void*>(params) << ")");
918 TRACE_EVENT0("gpu", "GLES2Implementation::GetBufferParameteriv");
919 if (GetBufferParameterivHelper(target, pname, params)) {
920 return;
922 typedef cmds::GetBufferParameteriv::Result Result;
923 Result* result = GetResultAs<Result*>();
924 if (!result) {
925 return;
927 result->SetNumResults(0);
928 helper_->GetBufferParameteriv(target, pname, GetResultShmId(),
929 GetResultShmOffset());
930 WaitForCmd();
931 result->CopyResult(params);
932 GPU_CLIENT_LOG_CODE_BLOCK({
933 for (int32_t i = 0; i < result->GetNumResults(); ++i) {
934 GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]);
937 CheckGLError();
939 void GLES2Implementation::GetFloatv(GLenum pname, GLfloat* params) {
940 GPU_CLIENT_SINGLE_THREAD_CHECK();
941 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetFloatv("
942 << GLES2Util::GetStringGLState(pname) << ", "
943 << static_cast<const void*>(params) << ")");
944 TRACE_EVENT0("gpu", "GLES2Implementation::GetFloatv");
945 if (GetFloatvHelper(pname, params)) {
946 return;
948 typedef cmds::GetFloatv::Result Result;
949 Result* result = GetResultAs<Result*>();
950 if (!result) {
951 return;
953 result->SetNumResults(0);
954 helper_->GetFloatv(pname, GetResultShmId(), GetResultShmOffset());
955 WaitForCmd();
956 result->CopyResult(params);
957 GPU_CLIENT_LOG_CODE_BLOCK({
958 for (int32_t i = 0; i < result->GetNumResults(); ++i) {
959 GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]);
962 CheckGLError();
964 void GLES2Implementation::GetFramebufferAttachmentParameteriv(GLenum target,
965 GLenum attachment,
966 GLenum pname,
967 GLint* params) {
968 GPU_CLIENT_SINGLE_THREAD_CHECK();
969 GPU_CLIENT_VALIDATE_DESTINATION_INITALIZATION(GLint, params);
970 GPU_CLIENT_LOG("[" << GetLogPrefix()
971 << "] glGetFramebufferAttachmentParameteriv("
972 << GLES2Util::GetStringFrameBufferTarget(target) << ", "
973 << GLES2Util::GetStringAttachment(attachment) << ", "
974 << GLES2Util::GetStringFrameBufferParameter(pname) << ", "
975 << static_cast<const void*>(params) << ")");
976 TRACE_EVENT0("gpu",
977 "GLES2Implementation::GetFramebufferAttachmentParameteriv");
978 if (GetFramebufferAttachmentParameterivHelper(target, attachment, pname,
979 params)) {
980 return;
982 typedef cmds::GetFramebufferAttachmentParameteriv::Result Result;
983 Result* result = GetResultAs<Result*>();
984 if (!result) {
985 return;
987 result->SetNumResults(0);
988 helper_->GetFramebufferAttachmentParameteriv(
989 target, attachment, pname, GetResultShmId(), GetResultShmOffset());
990 WaitForCmd();
991 result->CopyResult(params);
992 GPU_CLIENT_LOG_CODE_BLOCK({
993 for (int32_t i = 0; i < result->GetNumResults(); ++i) {
994 GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]);
997 CheckGLError();
999 void GLES2Implementation::GetInteger64v(GLenum pname, GLint64* params) {
1000 GPU_CLIENT_SINGLE_THREAD_CHECK();
1001 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetInteger64v("
1002 << GLES2Util::GetStringGLState(pname) << ", "
1003 << static_cast<const void*>(params) << ")");
1004 TRACE_EVENT0("gpu", "GLES2Implementation::GetInteger64v");
1005 if (GetInteger64vHelper(pname, params)) {
1006 return;
1008 typedef cmds::GetInteger64v::Result Result;
1009 Result* result = GetResultAs<Result*>();
1010 if (!result) {
1011 return;
1013 result->SetNumResults(0);
1014 helper_->GetInteger64v(pname, GetResultShmId(), GetResultShmOffset());
1015 WaitForCmd();
1016 result->CopyResult(params);
1017 GPU_CLIENT_LOG_CODE_BLOCK({
1018 for (int32_t i = 0; i < result->GetNumResults(); ++i) {
1019 GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]);
1022 CheckGLError();
1024 void GLES2Implementation::GetIntegeri_v(GLenum pname,
1025 GLuint index,
1026 GLint* data) {
1027 GPU_CLIENT_SINGLE_THREAD_CHECK();
1028 GPU_CLIENT_VALIDATE_DESTINATION_INITALIZATION(GLint, data);
1029 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetIntegeri_v("
1030 << GLES2Util::GetStringIndexedGLState(pname) << ", "
1031 << index << ", " << static_cast<const void*>(data) << ")");
1032 TRACE_EVENT0("gpu", "GLES2Implementation::GetIntegeri_v");
1033 if (GetIntegeri_vHelper(pname, index, data)) {
1034 return;
1036 typedef cmds::GetIntegeri_v::Result Result;
1037 Result* result = GetResultAs<Result*>();
1038 if (!result) {
1039 return;
1041 result->SetNumResults(0);
1042 helper_->GetIntegeri_v(pname, index, GetResultShmId(), GetResultShmOffset());
1043 WaitForCmd();
1044 result->CopyResult(data);
1045 GPU_CLIENT_LOG_CODE_BLOCK({
1046 for (int32_t i = 0; i < result->GetNumResults(); ++i) {
1047 GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]);
1050 CheckGLError();
1052 void GLES2Implementation::GetInteger64i_v(GLenum pname,
1053 GLuint index,
1054 GLint64* data) {
1055 GPU_CLIENT_SINGLE_THREAD_CHECK();
1056 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetInteger64i_v("
1057 << GLES2Util::GetStringIndexedGLState(pname) << ", "
1058 << index << ", " << static_cast<const void*>(data) << ")");
1059 TRACE_EVENT0("gpu", "GLES2Implementation::GetInteger64i_v");
1060 if (GetInteger64i_vHelper(pname, index, data)) {
1061 return;
1063 typedef cmds::GetInteger64i_v::Result Result;
1064 Result* result = GetResultAs<Result*>();
1065 if (!result) {
1066 return;
1068 result->SetNumResults(0);
1069 helper_->GetInteger64i_v(pname, index, GetResultShmId(),
1070 GetResultShmOffset());
1071 WaitForCmd();
1072 result->CopyResult(data);
1073 GPU_CLIENT_LOG_CODE_BLOCK({
1074 for (int32_t i = 0; i < result->GetNumResults(); ++i) {
1075 GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]);
1078 CheckGLError();
1080 void GLES2Implementation::GetIntegerv(GLenum pname, GLint* params) {
1081 GPU_CLIENT_SINGLE_THREAD_CHECK();
1082 GPU_CLIENT_VALIDATE_DESTINATION_INITALIZATION(GLint, params);
1083 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetIntegerv("
1084 << GLES2Util::GetStringGLState(pname) << ", "
1085 << static_cast<const void*>(params) << ")");
1086 TRACE_EVENT0("gpu", "GLES2Implementation::GetIntegerv");
1087 if (GetIntegervHelper(pname, params)) {
1088 return;
1090 typedef cmds::GetIntegerv::Result Result;
1091 Result* result = GetResultAs<Result*>();
1092 if (!result) {
1093 return;
1095 result->SetNumResults(0);
1096 helper_->GetIntegerv(pname, GetResultShmId(), GetResultShmOffset());
1097 WaitForCmd();
1098 result->CopyResult(params);
1099 GPU_CLIENT_LOG_CODE_BLOCK({
1100 for (int32_t i = 0; i < result->GetNumResults(); ++i) {
1101 GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]);
1104 CheckGLError();
1106 void GLES2Implementation::GetProgramiv(GLuint program,
1107 GLenum pname,
1108 GLint* params) {
1109 GPU_CLIENT_SINGLE_THREAD_CHECK();
1110 GPU_CLIENT_VALIDATE_DESTINATION_INITALIZATION(GLint, params);
1111 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetProgramiv(" << program << ", "
1112 << GLES2Util::GetStringProgramParameter(pname) << ", "
1113 << static_cast<const void*>(params) << ")");
1114 TRACE_EVENT0("gpu", "GLES2Implementation::GetProgramiv");
1115 if (GetProgramivHelper(program, pname, params)) {
1116 return;
1118 typedef cmds::GetProgramiv::Result Result;
1119 Result* result = GetResultAs<Result*>();
1120 if (!result) {
1121 return;
1123 result->SetNumResults(0);
1124 helper_->GetProgramiv(program, pname, GetResultShmId(), GetResultShmOffset());
1125 WaitForCmd();
1126 result->CopyResult(params);
1127 GPU_CLIENT_LOG_CODE_BLOCK({
1128 for (int32_t i = 0; i < result->GetNumResults(); ++i) {
1129 GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]);
1132 CheckGLError();
1134 void GLES2Implementation::GetProgramInfoLog(GLuint program,
1135 GLsizei bufsize,
1136 GLsizei* length,
1137 char* infolog) {
1138 GPU_CLIENT_SINGLE_THREAD_CHECK();
1139 GPU_CLIENT_VALIDATE_DESTINATION_OPTIONAL_INITALIZATION(GLsizei, length);
1140 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetProgramInfoLog"
1141 << "(" << program << ", " << bufsize << ", "
1142 << static_cast<void*>(length) << ", "
1143 << static_cast<void*>(infolog) << ")");
1144 helper_->SetBucketSize(kResultBucketId, 0);
1145 helper_->GetProgramInfoLog(program, kResultBucketId);
1146 std::string str;
1147 GLsizei max_size = 0;
1148 if (GetBucketAsString(kResultBucketId, &str)) {
1149 if (bufsize > 0) {
1150 max_size = std::min(static_cast<size_t>(bufsize) - 1, str.size());
1151 memcpy(infolog, str.c_str(), max_size);
1152 infolog[max_size] = '\0';
1153 GPU_CLIENT_LOG("------\n" << infolog << "\n------");
1156 if (length != NULL) {
1157 *length = max_size;
1159 CheckGLError();
1161 void GLES2Implementation::GetRenderbufferParameteriv(GLenum target,
1162 GLenum pname,
1163 GLint* params) {
1164 GPU_CLIENT_SINGLE_THREAD_CHECK();
1165 GPU_CLIENT_VALIDATE_DESTINATION_INITALIZATION(GLint, params);
1166 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetRenderbufferParameteriv("
1167 << GLES2Util::GetStringRenderBufferTarget(target) << ", "
1168 << GLES2Util::GetStringRenderBufferParameter(pname) << ", "
1169 << static_cast<const void*>(params) << ")");
1170 TRACE_EVENT0("gpu", "GLES2Implementation::GetRenderbufferParameteriv");
1171 if (GetRenderbufferParameterivHelper(target, pname, params)) {
1172 return;
1174 typedef cmds::GetRenderbufferParameteriv::Result Result;
1175 Result* result = GetResultAs<Result*>();
1176 if (!result) {
1177 return;
1179 result->SetNumResults(0);
1180 helper_->GetRenderbufferParameteriv(target, pname, GetResultShmId(),
1181 GetResultShmOffset());
1182 WaitForCmd();
1183 result->CopyResult(params);
1184 GPU_CLIENT_LOG_CODE_BLOCK({
1185 for (int32_t i = 0; i < result->GetNumResults(); ++i) {
1186 GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]);
1189 CheckGLError();
1191 void GLES2Implementation::GetSamplerParameterfv(GLuint sampler,
1192 GLenum pname,
1193 GLfloat* params) {
1194 GPU_CLIENT_SINGLE_THREAD_CHECK();
1195 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetSamplerParameterfv("
1196 << sampler << ", "
1197 << GLES2Util::GetStringSamplerParameter(pname) << ", "
1198 << static_cast<const void*>(params) << ")");
1199 TRACE_EVENT0("gpu", "GLES2Implementation::GetSamplerParameterfv");
1200 if (GetSamplerParameterfvHelper(sampler, pname, params)) {
1201 return;
1203 typedef cmds::GetSamplerParameterfv::Result Result;
1204 Result* result = GetResultAs<Result*>();
1205 if (!result) {
1206 return;
1208 result->SetNumResults(0);
1209 helper_->GetSamplerParameterfv(sampler, pname, GetResultShmId(),
1210 GetResultShmOffset());
1211 WaitForCmd();
1212 result->CopyResult(params);
1213 GPU_CLIENT_LOG_CODE_BLOCK({
1214 for (int32_t i = 0; i < result->GetNumResults(); ++i) {
1215 GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]);
1218 CheckGLError();
1220 void GLES2Implementation::GetSamplerParameteriv(GLuint sampler,
1221 GLenum pname,
1222 GLint* params) {
1223 GPU_CLIENT_SINGLE_THREAD_CHECK();
1224 GPU_CLIENT_VALIDATE_DESTINATION_INITALIZATION(GLint, params);
1225 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetSamplerParameteriv("
1226 << sampler << ", "
1227 << GLES2Util::GetStringSamplerParameter(pname) << ", "
1228 << static_cast<const void*>(params) << ")");
1229 TRACE_EVENT0("gpu", "GLES2Implementation::GetSamplerParameteriv");
1230 if (GetSamplerParameterivHelper(sampler, pname, params)) {
1231 return;
1233 typedef cmds::GetSamplerParameteriv::Result Result;
1234 Result* result = GetResultAs<Result*>();
1235 if (!result) {
1236 return;
1238 result->SetNumResults(0);
1239 helper_->GetSamplerParameteriv(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::GetShaderiv(GLuint shader,
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() << "] glGetShaderiv(" << shader << ", "
1256 << GLES2Util::GetStringShaderParameter(pname) << ", "
1257 << static_cast<const void*>(params) << ")");
1258 TRACE_EVENT0("gpu", "GLES2Implementation::GetShaderiv");
1259 if (GetShaderivHelper(shader, pname, params)) {
1260 return;
1262 typedef cmds::GetShaderiv::Result Result;
1263 Result* result = GetResultAs<Result*>();
1264 if (!result) {
1265 return;
1267 result->SetNumResults(0);
1268 helper_->GetShaderiv(shader, pname, GetResultShmId(), GetResultShmOffset());
1269 WaitForCmd();
1270 result->CopyResult(params);
1271 GPU_CLIENT_LOG_CODE_BLOCK({
1272 for (int32_t i = 0; i < result->GetNumResults(); ++i) {
1273 GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]);
1276 CheckGLError();
1278 void GLES2Implementation::GetShaderInfoLog(GLuint shader,
1279 GLsizei bufsize,
1280 GLsizei* length,
1281 char* infolog) {
1282 GPU_CLIENT_SINGLE_THREAD_CHECK();
1283 GPU_CLIENT_VALIDATE_DESTINATION_OPTIONAL_INITALIZATION(GLsizei, length);
1284 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetShaderInfoLog"
1285 << "(" << shader << ", " << bufsize << ", "
1286 << static_cast<void*>(length) << ", "
1287 << static_cast<void*>(infolog) << ")");
1288 helper_->SetBucketSize(kResultBucketId, 0);
1289 helper_->GetShaderInfoLog(shader, kResultBucketId);
1290 std::string str;
1291 GLsizei max_size = 0;
1292 if (GetBucketAsString(kResultBucketId, &str)) {
1293 if (bufsize > 0) {
1294 max_size = std::min(static_cast<size_t>(bufsize) - 1, str.size());
1295 memcpy(infolog, str.c_str(), max_size);
1296 infolog[max_size] = '\0';
1297 GPU_CLIENT_LOG("------\n" << infolog << "\n------");
1300 if (length != NULL) {
1301 *length = max_size;
1303 CheckGLError();
1305 void GLES2Implementation::GetShaderSource(GLuint shader,
1306 GLsizei bufsize,
1307 GLsizei* length,
1308 char* source) {
1309 GPU_CLIENT_SINGLE_THREAD_CHECK();
1310 GPU_CLIENT_VALIDATE_DESTINATION_OPTIONAL_INITALIZATION(GLsizei, length);
1311 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetShaderSource"
1312 << "(" << shader << ", " << bufsize << ", "
1313 << static_cast<void*>(length) << ", "
1314 << static_cast<void*>(source) << ")");
1315 helper_->SetBucketSize(kResultBucketId, 0);
1316 helper_->GetShaderSource(shader, kResultBucketId);
1317 std::string str;
1318 GLsizei max_size = 0;
1319 if (GetBucketAsString(kResultBucketId, &str)) {
1320 if (bufsize > 0) {
1321 max_size = std::min(static_cast<size_t>(bufsize) - 1, str.size());
1322 memcpy(source, str.c_str(), max_size);
1323 source[max_size] = '\0';
1324 GPU_CLIENT_LOG("------\n" << source << "\n------");
1327 if (length != NULL) {
1328 *length = max_size;
1330 CheckGLError();
1332 void GLES2Implementation::GetSynciv(GLsync sync,
1333 GLenum pname,
1334 GLsizei bufsize,
1335 GLsizei* length,
1336 GLint* values) {
1337 GPU_CLIENT_SINGLE_THREAD_CHECK();
1338 GPU_CLIENT_VALIDATE_DESTINATION_OPTIONAL_INITALIZATION(GLsizei, length);
1339 GPU_CLIENT_VALIDATE_DESTINATION_INITALIZATION(GLint, values);
1340 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetSynciv(" << sync << ", "
1341 << GLES2Util::GetStringSyncParameter(pname) << ", "
1342 << bufsize << ", " << static_cast<const void*>(length)
1343 << ", " << static_cast<const void*>(values) << ")");
1344 if (bufsize < 0) {
1345 SetGLError(GL_INVALID_VALUE, "glGetSynciv", "bufsize < 0");
1346 return;
1348 TRACE_EVENT0("gpu", "GLES2Implementation::GetSynciv");
1349 if (GetSyncivHelper(sync, pname, bufsize, length, values)) {
1350 return;
1352 typedef cmds::GetSynciv::Result Result;
1353 Result* result = GetResultAs<Result*>();
1354 if (!result) {
1355 return;
1357 result->SetNumResults(0);
1358 helper_->GetSynciv(ToGLuint(sync), pname, GetResultShmId(),
1359 GetResultShmOffset());
1360 WaitForCmd();
1361 result->CopyResult(values);
1362 GPU_CLIENT_LOG_CODE_BLOCK({
1363 for (int32_t i = 0; i < result->GetNumResults(); ++i) {
1364 GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]);
1367 if (length) {
1368 *length = result->GetNumResults();
1370 CheckGLError();
1372 void GLES2Implementation::GetTexParameterfv(GLenum target,
1373 GLenum pname,
1374 GLfloat* params) {
1375 GPU_CLIENT_SINGLE_THREAD_CHECK();
1376 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetTexParameterfv("
1377 << GLES2Util::GetStringGetTexParamTarget(target) << ", "
1378 << GLES2Util::GetStringTextureParameter(pname) << ", "
1379 << static_cast<const void*>(params) << ")");
1380 TRACE_EVENT0("gpu", "GLES2Implementation::GetTexParameterfv");
1381 if (GetTexParameterfvHelper(target, pname, params)) {
1382 return;
1384 typedef cmds::GetTexParameterfv::Result Result;
1385 Result* result = GetResultAs<Result*>();
1386 if (!result) {
1387 return;
1389 result->SetNumResults(0);
1390 helper_->GetTexParameterfv(target, pname, GetResultShmId(),
1391 GetResultShmOffset());
1392 WaitForCmd();
1393 result->CopyResult(params);
1394 GPU_CLIENT_LOG_CODE_BLOCK({
1395 for (int32_t i = 0; i < result->GetNumResults(); ++i) {
1396 GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]);
1399 CheckGLError();
1401 void GLES2Implementation::GetTexParameteriv(GLenum target,
1402 GLenum pname,
1403 GLint* params) {
1404 GPU_CLIENT_SINGLE_THREAD_CHECK();
1405 GPU_CLIENT_VALIDATE_DESTINATION_INITALIZATION(GLint, params);
1406 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetTexParameteriv("
1407 << GLES2Util::GetStringGetTexParamTarget(target) << ", "
1408 << GLES2Util::GetStringTextureParameter(pname) << ", "
1409 << static_cast<const void*>(params) << ")");
1410 TRACE_EVENT0("gpu", "GLES2Implementation::GetTexParameteriv");
1411 if (GetTexParameterivHelper(target, pname, params)) {
1412 return;
1414 typedef cmds::GetTexParameteriv::Result Result;
1415 Result* result = GetResultAs<Result*>();
1416 if (!result) {
1417 return;
1419 result->SetNumResults(0);
1420 helper_->GetTexParameteriv(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::Hint(GLenum target, GLenum mode) {
1432 GPU_CLIENT_SINGLE_THREAD_CHECK();
1433 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glHint("
1434 << GLES2Util::GetStringHintTarget(target) << ", "
1435 << GLES2Util::GetStringHintMode(mode) << ")");
1436 helper_->Hint(target, mode);
1437 CheckGLError();
1440 void GLES2Implementation::InvalidateFramebuffer(GLenum target,
1441 GLsizei count,
1442 const GLenum* attachments) {
1443 GPU_CLIENT_SINGLE_THREAD_CHECK();
1444 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glInvalidateFramebuffer("
1445 << GLES2Util::GetStringInvalidateFrameBufferTarget(target)
1446 << ", " << count << ", "
1447 << static_cast<const void*>(attachments) << ")");
1448 GPU_CLIENT_LOG_CODE_BLOCK({
1449 for (GLsizei i = 0; i < count; ++i) {
1450 GPU_CLIENT_LOG(" " << i << ": " << attachments[0 + i * 1]);
1453 if (count < 0) {
1454 SetGLError(GL_INVALID_VALUE, "glInvalidateFramebuffer", "count < 0");
1455 return;
1457 helper_->InvalidateFramebufferImmediate(target, count, attachments);
1458 CheckGLError();
1461 void GLES2Implementation::InvalidateSubFramebuffer(GLenum target,
1462 GLsizei count,
1463 const GLenum* attachments,
1464 GLint x,
1465 GLint y,
1466 GLsizei width,
1467 GLsizei height) {
1468 GPU_CLIENT_SINGLE_THREAD_CHECK();
1469 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glInvalidateSubFramebuffer("
1470 << GLES2Util::GetStringInvalidateFrameBufferTarget(target)
1471 << ", " << count << ", "
1472 << static_cast<const void*>(attachments) << ", " << x
1473 << ", " << y << ", " << width << ", " << height << ")");
1474 GPU_CLIENT_LOG_CODE_BLOCK({
1475 for (GLsizei i = 0; i < count; ++i) {
1476 GPU_CLIENT_LOG(" " << i << ": " << attachments[0 + i * 1]);
1479 if (count < 0) {
1480 SetGLError(GL_INVALID_VALUE, "glInvalidateSubFramebuffer", "count < 0");
1481 return;
1483 if (width < 0) {
1484 SetGLError(GL_INVALID_VALUE, "glInvalidateSubFramebuffer", "width < 0");
1485 return;
1487 if (height < 0) {
1488 SetGLError(GL_INVALID_VALUE, "glInvalidateSubFramebuffer", "height < 0");
1489 return;
1491 helper_->InvalidateSubFramebufferImmediate(target, count, attachments, x, y,
1492 width, height);
1493 CheckGLError();
1496 GLboolean GLES2Implementation::IsBuffer(GLuint buffer) {
1497 GPU_CLIENT_SINGLE_THREAD_CHECK();
1498 TRACE_EVENT0("gpu", "GLES2Implementation::IsBuffer");
1499 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glIsBuffer(" << buffer << ")");
1500 typedef cmds::IsBuffer::Result Result;
1501 Result* result = GetResultAs<Result*>();
1502 if (!result) {
1503 return GL_FALSE;
1505 *result = 0;
1506 helper_->IsBuffer(buffer, GetResultShmId(), GetResultShmOffset());
1507 WaitForCmd();
1508 GLboolean result_value = *result != 0;
1509 GPU_CLIENT_LOG("returned " << result_value);
1510 CheckGLError();
1511 return result_value;
1514 GLboolean GLES2Implementation::IsFramebuffer(GLuint framebuffer) {
1515 GPU_CLIENT_SINGLE_THREAD_CHECK();
1516 TRACE_EVENT0("gpu", "GLES2Implementation::IsFramebuffer");
1517 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glIsFramebuffer(" << framebuffer
1518 << ")");
1519 typedef cmds::IsFramebuffer::Result Result;
1520 Result* result = GetResultAs<Result*>();
1521 if (!result) {
1522 return GL_FALSE;
1524 *result = 0;
1525 helper_->IsFramebuffer(framebuffer, GetResultShmId(), GetResultShmOffset());
1526 WaitForCmd();
1527 GLboolean result_value = *result != 0;
1528 GPU_CLIENT_LOG("returned " << result_value);
1529 CheckGLError();
1530 return result_value;
1533 GLboolean GLES2Implementation::IsProgram(GLuint program) {
1534 GPU_CLIENT_SINGLE_THREAD_CHECK();
1535 TRACE_EVENT0("gpu", "GLES2Implementation::IsProgram");
1536 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glIsProgram(" << program << ")");
1537 typedef cmds::IsProgram::Result Result;
1538 Result* result = GetResultAs<Result*>();
1539 if (!result) {
1540 return GL_FALSE;
1542 *result = 0;
1543 helper_->IsProgram(program, GetResultShmId(), GetResultShmOffset());
1544 WaitForCmd();
1545 GLboolean result_value = *result != 0;
1546 GPU_CLIENT_LOG("returned " << result_value);
1547 CheckGLError();
1548 return result_value;
1551 GLboolean GLES2Implementation::IsRenderbuffer(GLuint renderbuffer) {
1552 GPU_CLIENT_SINGLE_THREAD_CHECK();
1553 TRACE_EVENT0("gpu", "GLES2Implementation::IsRenderbuffer");
1554 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glIsRenderbuffer(" << renderbuffer
1555 << ")");
1556 typedef cmds::IsRenderbuffer::Result Result;
1557 Result* result = GetResultAs<Result*>();
1558 if (!result) {
1559 return GL_FALSE;
1561 *result = 0;
1562 helper_->IsRenderbuffer(renderbuffer, GetResultShmId(), GetResultShmOffset());
1563 WaitForCmd();
1564 GLboolean result_value = *result != 0;
1565 GPU_CLIENT_LOG("returned " << result_value);
1566 CheckGLError();
1567 return result_value;
1570 GLboolean GLES2Implementation::IsSampler(GLuint sampler) {
1571 GPU_CLIENT_SINGLE_THREAD_CHECK();
1572 TRACE_EVENT0("gpu", "GLES2Implementation::IsSampler");
1573 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glIsSampler(" << sampler << ")");
1574 typedef cmds::IsSampler::Result Result;
1575 Result* result = GetResultAs<Result*>();
1576 if (!result) {
1577 return GL_FALSE;
1579 *result = 0;
1580 helper_->IsSampler(sampler, GetResultShmId(), GetResultShmOffset());
1581 WaitForCmd();
1582 GLboolean result_value = *result != 0;
1583 GPU_CLIENT_LOG("returned " << result_value);
1584 CheckGLError();
1585 return result_value;
1588 GLboolean GLES2Implementation::IsShader(GLuint shader) {
1589 GPU_CLIENT_SINGLE_THREAD_CHECK();
1590 TRACE_EVENT0("gpu", "GLES2Implementation::IsShader");
1591 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glIsShader(" << shader << ")");
1592 typedef cmds::IsShader::Result Result;
1593 Result* result = GetResultAs<Result*>();
1594 if (!result) {
1595 return GL_FALSE;
1597 *result = 0;
1598 helper_->IsShader(shader, GetResultShmId(), GetResultShmOffset());
1599 WaitForCmd();
1600 GLboolean result_value = *result != 0;
1601 GPU_CLIENT_LOG("returned " << result_value);
1602 CheckGLError();
1603 return result_value;
1606 GLboolean GLES2Implementation::IsSync(GLsync sync) {
1607 GPU_CLIENT_SINGLE_THREAD_CHECK();
1608 TRACE_EVENT0("gpu", "GLES2Implementation::IsSync");
1609 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glIsSync(" << sync << ")");
1610 typedef cmds::IsSync::Result Result;
1611 Result* result = GetResultAs<Result*>();
1612 if (!result) {
1613 return GL_FALSE;
1615 *result = 0;
1616 helper_->IsSync(ToGLuint(sync), GetResultShmId(), GetResultShmOffset());
1617 WaitForCmd();
1618 GLboolean result_value = *result != 0;
1619 GPU_CLIENT_LOG("returned " << result_value);
1620 CheckGLError();
1621 return result_value;
1624 GLboolean GLES2Implementation::IsTexture(GLuint texture) {
1625 GPU_CLIENT_SINGLE_THREAD_CHECK();
1626 TRACE_EVENT0("gpu", "GLES2Implementation::IsTexture");
1627 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glIsTexture(" << texture << ")");
1628 typedef cmds::IsTexture::Result Result;
1629 Result* result = GetResultAs<Result*>();
1630 if (!result) {
1631 return GL_FALSE;
1633 *result = 0;
1634 helper_->IsTexture(texture, GetResultShmId(), GetResultShmOffset());
1635 WaitForCmd();
1636 GLboolean result_value = *result != 0;
1637 GPU_CLIENT_LOG("returned " << result_value);
1638 CheckGLError();
1639 return result_value;
1642 GLboolean GLES2Implementation::IsTransformFeedback(GLuint transformfeedback) {
1643 GPU_CLIENT_SINGLE_THREAD_CHECK();
1644 TRACE_EVENT0("gpu", "GLES2Implementation::IsTransformFeedback");
1645 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glIsTransformFeedback("
1646 << transformfeedback << ")");
1647 typedef cmds::IsTransformFeedback::Result Result;
1648 Result* result = GetResultAs<Result*>();
1649 if (!result) {
1650 return GL_FALSE;
1652 *result = 0;
1653 helper_->IsTransformFeedback(transformfeedback, GetResultShmId(),
1654 GetResultShmOffset());
1655 WaitForCmd();
1656 GLboolean result_value = *result != 0;
1657 GPU_CLIENT_LOG("returned " << result_value);
1658 CheckGLError();
1659 return result_value;
1662 void GLES2Implementation::LineWidth(GLfloat width) {
1663 GPU_CLIENT_SINGLE_THREAD_CHECK();
1664 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glLineWidth(" << width << ")");
1665 helper_->LineWidth(width);
1666 CheckGLError();
1669 void GLES2Implementation::PauseTransformFeedback() {
1670 GPU_CLIENT_SINGLE_THREAD_CHECK();
1671 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glPauseTransformFeedback("
1672 << ")");
1673 helper_->PauseTransformFeedback();
1674 CheckGLError();
1677 void GLES2Implementation::PolygonOffset(GLfloat factor, GLfloat units) {
1678 GPU_CLIENT_SINGLE_THREAD_CHECK();
1679 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glPolygonOffset(" << factor << ", "
1680 << units << ")");
1681 helper_->PolygonOffset(factor, units);
1682 CheckGLError();
1685 void GLES2Implementation::ReadBuffer(GLenum src) {
1686 GPU_CLIENT_SINGLE_THREAD_CHECK();
1687 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glReadBuffer("
1688 << GLES2Util::GetStringEnum(src) << ")");
1689 helper_->ReadBuffer(src);
1690 CheckGLError();
1693 void GLES2Implementation::ReleaseShaderCompiler() {
1694 GPU_CLIENT_SINGLE_THREAD_CHECK();
1695 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glReleaseShaderCompiler("
1696 << ")");
1697 helper_->ReleaseShaderCompiler();
1698 CheckGLError();
1701 void GLES2Implementation::RenderbufferStorage(GLenum target,
1702 GLenum internalformat,
1703 GLsizei width,
1704 GLsizei height) {
1705 GPU_CLIENT_SINGLE_THREAD_CHECK();
1706 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glRenderbufferStorage("
1707 << GLES2Util::GetStringRenderBufferTarget(target) << ", "
1708 << GLES2Util::GetStringRenderBufferFormat(internalformat)
1709 << ", " << width << ", " << height << ")");
1710 if (width < 0) {
1711 SetGLError(GL_INVALID_VALUE, "glRenderbufferStorage", "width < 0");
1712 return;
1714 if (height < 0) {
1715 SetGLError(GL_INVALID_VALUE, "glRenderbufferStorage", "height < 0");
1716 return;
1718 helper_->RenderbufferStorage(target, internalformat, width, height);
1719 CheckGLError();
1722 void GLES2Implementation::ResumeTransformFeedback() {
1723 GPU_CLIENT_SINGLE_THREAD_CHECK();
1724 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glResumeTransformFeedback("
1725 << ")");
1726 helper_->ResumeTransformFeedback();
1727 CheckGLError();
1730 void GLES2Implementation::SampleCoverage(GLclampf value, GLboolean invert) {
1731 GPU_CLIENT_SINGLE_THREAD_CHECK();
1732 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glSampleCoverage(" << value << ", "
1733 << GLES2Util::GetStringBool(invert) << ")");
1734 helper_->SampleCoverage(value, invert);
1735 CheckGLError();
1738 void GLES2Implementation::SamplerParameterf(GLuint sampler,
1739 GLenum pname,
1740 GLfloat param) {
1741 GPU_CLIENT_SINGLE_THREAD_CHECK();
1742 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glSamplerParameterf(" << sampler
1743 << ", " << GLES2Util::GetStringSamplerParameter(pname)
1744 << ", " << param << ")");
1745 helper_->SamplerParameterf(sampler, pname, param);
1746 CheckGLError();
1749 void GLES2Implementation::SamplerParameterfv(GLuint sampler,
1750 GLenum pname,
1751 const GLfloat* params) {
1752 GPU_CLIENT_SINGLE_THREAD_CHECK();
1753 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glSamplerParameterfv(" << sampler
1754 << ", " << GLES2Util::GetStringSamplerParameter(pname)
1755 << ", " << static_cast<const void*>(params) << ")");
1756 size_t count = 1;
1757 for (size_t ii = 0; ii < count; ++ii)
1758 GPU_CLIENT_LOG("value[" << ii << "]: " << params[ii]);
1759 helper_->SamplerParameterfvImmediate(sampler, pname, params);
1760 CheckGLError();
1763 void GLES2Implementation::SamplerParameteri(GLuint sampler,
1764 GLenum pname,
1765 GLint param) {
1766 GPU_CLIENT_SINGLE_THREAD_CHECK();
1767 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glSamplerParameteri(" << sampler
1768 << ", " << GLES2Util::GetStringSamplerParameter(pname)
1769 << ", " << param << ")");
1770 helper_->SamplerParameteri(sampler, pname, param);
1771 CheckGLError();
1774 void GLES2Implementation::SamplerParameteriv(GLuint sampler,
1775 GLenum pname,
1776 const GLint* params) {
1777 GPU_CLIENT_SINGLE_THREAD_CHECK();
1778 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glSamplerParameteriv(" << sampler
1779 << ", " << GLES2Util::GetStringSamplerParameter(pname)
1780 << ", " << static_cast<const void*>(params) << ")");
1781 size_t count = 1;
1782 for (size_t ii = 0; ii < count; ++ii)
1783 GPU_CLIENT_LOG("value[" << ii << "]: " << params[ii]);
1784 helper_->SamplerParameterivImmediate(sampler, pname, params);
1785 CheckGLError();
1788 void GLES2Implementation::Scissor(GLint x,
1789 GLint y,
1790 GLsizei width,
1791 GLsizei height) {
1792 GPU_CLIENT_SINGLE_THREAD_CHECK();
1793 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glScissor(" << x << ", " << y
1794 << ", " << width << ", " << height << ")");
1795 if (width < 0) {
1796 SetGLError(GL_INVALID_VALUE, "glScissor", "width < 0");
1797 return;
1799 if (height < 0) {
1800 SetGLError(GL_INVALID_VALUE, "glScissor", "height < 0");
1801 return;
1803 helper_->Scissor(x, y, width, height);
1804 CheckGLError();
1807 void GLES2Implementation::ShaderSource(GLuint shader,
1808 GLsizei count,
1809 const GLchar* const* str,
1810 const GLint* length) {
1811 GPU_CLIENT_SINGLE_THREAD_CHECK();
1812 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glShaderSource(" << shader << ", "
1813 << count << ", " << static_cast<const void*>(str) << ", "
1814 << static_cast<const void*>(length) << ")");
1815 GPU_CLIENT_LOG_CODE_BLOCK({
1816 for (GLsizei ii = 0; ii < count; ++ii) {
1817 if (str[ii]) {
1818 if (length && length[ii] >= 0) {
1819 const std::string my_str(str[ii], length[ii]);
1820 GPU_CLIENT_LOG(" " << ii << ": ---\n" << my_str << "\n---");
1821 } else {
1822 GPU_CLIENT_LOG(" " << ii << ": ---\n" << str[ii] << "\n---");
1824 } else {
1825 GPU_CLIENT_LOG(" " << ii << ": NULL");
1829 if (count < 0) {
1830 SetGLError(GL_INVALID_VALUE, "glShaderSource", "count < 0");
1831 return;
1834 if (!PackStringsToBucket(count, str, length, "glShaderSource")) {
1835 return;
1837 helper_->ShaderSourceBucket(shader, kResultBucketId);
1838 helper_->SetBucketSize(kResultBucketId, 0);
1839 CheckGLError();
1842 void GLES2Implementation::StencilFunc(GLenum func, GLint ref, GLuint mask) {
1843 GPU_CLIENT_SINGLE_THREAD_CHECK();
1844 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glStencilFunc("
1845 << GLES2Util::GetStringCmpFunction(func) << ", " << ref
1846 << ", " << mask << ")");
1847 helper_->StencilFunc(func, ref, mask);
1848 CheckGLError();
1851 void GLES2Implementation::StencilFuncSeparate(GLenum face,
1852 GLenum func,
1853 GLint ref,
1854 GLuint mask) {
1855 GPU_CLIENT_SINGLE_THREAD_CHECK();
1856 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glStencilFuncSeparate("
1857 << GLES2Util::GetStringFaceType(face) << ", "
1858 << GLES2Util::GetStringCmpFunction(func) << ", " << ref
1859 << ", " << mask << ")");
1860 helper_->StencilFuncSeparate(face, func, ref, mask);
1861 CheckGLError();
1864 void GLES2Implementation::StencilMask(GLuint mask) {
1865 GPU_CLIENT_SINGLE_THREAD_CHECK();
1866 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glStencilMask(" << mask << ")");
1867 helper_->StencilMask(mask);
1868 CheckGLError();
1871 void GLES2Implementation::StencilMaskSeparate(GLenum face, GLuint mask) {
1872 GPU_CLIENT_SINGLE_THREAD_CHECK();
1873 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glStencilMaskSeparate("
1874 << GLES2Util::GetStringFaceType(face) << ", " << mask
1875 << ")");
1876 helper_->StencilMaskSeparate(face, mask);
1877 CheckGLError();
1880 void GLES2Implementation::StencilOp(GLenum fail, GLenum zfail, GLenum zpass) {
1881 GPU_CLIENT_SINGLE_THREAD_CHECK();
1882 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glStencilOp("
1883 << GLES2Util::GetStringStencilOp(fail) << ", "
1884 << GLES2Util::GetStringStencilOp(zfail) << ", "
1885 << GLES2Util::GetStringStencilOp(zpass) << ")");
1886 helper_->StencilOp(fail, zfail, zpass);
1887 CheckGLError();
1890 void GLES2Implementation::StencilOpSeparate(GLenum face,
1891 GLenum fail,
1892 GLenum zfail,
1893 GLenum zpass) {
1894 GPU_CLIENT_SINGLE_THREAD_CHECK();
1895 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glStencilOpSeparate("
1896 << GLES2Util::GetStringFaceType(face) << ", "
1897 << GLES2Util::GetStringStencilOp(fail) << ", "
1898 << GLES2Util::GetStringStencilOp(zfail) << ", "
1899 << GLES2Util::GetStringStencilOp(zpass) << ")");
1900 helper_->StencilOpSeparate(face, fail, zfail, zpass);
1901 CheckGLError();
1904 void GLES2Implementation::TexParameterf(GLenum target,
1905 GLenum pname,
1906 GLfloat param) {
1907 GPU_CLIENT_SINGLE_THREAD_CHECK();
1908 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glTexParameterf("
1909 << GLES2Util::GetStringTextureBindTarget(target) << ", "
1910 << GLES2Util::GetStringTextureParameter(pname) << ", "
1911 << param << ")");
1912 helper_->TexParameterf(target, pname, param);
1913 CheckGLError();
1916 void GLES2Implementation::TexParameterfv(GLenum target,
1917 GLenum pname,
1918 const GLfloat* params) {
1919 GPU_CLIENT_SINGLE_THREAD_CHECK();
1920 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glTexParameterfv("
1921 << GLES2Util::GetStringTextureBindTarget(target) << ", "
1922 << GLES2Util::GetStringTextureParameter(pname) << ", "
1923 << static_cast<const void*>(params) << ")");
1924 size_t count = 1;
1925 for (size_t ii = 0; ii < count; ++ii)
1926 GPU_CLIENT_LOG("value[" << ii << "]: " << params[ii]);
1927 helper_->TexParameterfvImmediate(target, pname, params);
1928 CheckGLError();
1931 void GLES2Implementation::TexParameteri(GLenum target,
1932 GLenum pname,
1933 GLint param) {
1934 GPU_CLIENT_SINGLE_THREAD_CHECK();
1935 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glTexParameteri("
1936 << GLES2Util::GetStringTextureBindTarget(target) << ", "
1937 << GLES2Util::GetStringTextureParameter(pname) << ", "
1938 << param << ")");
1939 helper_->TexParameteri(target, pname, param);
1940 CheckGLError();
1943 void GLES2Implementation::TexParameteriv(GLenum target,
1944 GLenum pname,
1945 const GLint* params) {
1946 GPU_CLIENT_SINGLE_THREAD_CHECK();
1947 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glTexParameteriv("
1948 << GLES2Util::GetStringTextureBindTarget(target) << ", "
1949 << GLES2Util::GetStringTextureParameter(pname) << ", "
1950 << static_cast<const void*>(params) << ")");
1951 size_t count = 1;
1952 for (size_t ii = 0; ii < count; ++ii)
1953 GPU_CLIENT_LOG("value[" << ii << "]: " << params[ii]);
1954 helper_->TexParameterivImmediate(target, pname, params);
1955 CheckGLError();
1958 void GLES2Implementation::TexStorage3D(GLenum target,
1959 GLsizei levels,
1960 GLenum internalFormat,
1961 GLsizei width,
1962 GLsizei height,
1963 GLsizei depth) {
1964 GPU_CLIENT_SINGLE_THREAD_CHECK();
1965 GPU_CLIENT_LOG(
1966 "[" << GetLogPrefix() << "] glTexStorage3D("
1967 << GLES2Util::GetStringTexture3DTarget(target) << ", " << levels
1968 << ", "
1969 << GLES2Util::GetStringTextureInternalFormatStorage(internalFormat)
1970 << ", " << width << ", " << height << ", " << depth << ")");
1971 if (levels < 0) {
1972 SetGLError(GL_INVALID_VALUE, "glTexStorage3D", "levels < 0");
1973 return;
1975 if (width < 0) {
1976 SetGLError(GL_INVALID_VALUE, "glTexStorage3D", "width < 0");
1977 return;
1979 if (height < 0) {
1980 SetGLError(GL_INVALID_VALUE, "glTexStorage3D", "height < 0");
1981 return;
1983 if (depth < 0) {
1984 SetGLError(GL_INVALID_VALUE, "glTexStorage3D", "depth < 0");
1985 return;
1987 helper_->TexStorage3D(target, levels, internalFormat, width, height, depth);
1988 CheckGLError();
1991 void GLES2Implementation::TransformFeedbackVaryings(GLuint program,
1992 GLsizei count,
1993 const char* const* varyings,
1994 GLenum buffermode) {
1995 GPU_CLIENT_SINGLE_THREAD_CHECK();
1996 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glTransformFeedbackVaryings("
1997 << program << ", " << count << ", "
1998 << static_cast<const void*>(varyings) << ", "
1999 << GLES2Util::GetStringBufferMode(buffermode) << ")");
2000 GPU_CLIENT_LOG_CODE_BLOCK({
2001 for (GLsizei ii = 0; ii < count; ++ii) {
2002 if (varyings[ii]) {
2003 GPU_CLIENT_LOG(" " << ii << ": ---\n" << varyings[ii] << "\n---");
2004 } else {
2005 GPU_CLIENT_LOG(" " << ii << ": NULL");
2009 if (count < 0) {
2010 SetGLError(GL_INVALID_VALUE, "glTransformFeedbackVaryings", "count < 0");
2011 return;
2014 if (!PackStringsToBucket(count, varyings, NULL,
2015 "glTransformFeedbackVaryings")) {
2016 return;
2018 helper_->TransformFeedbackVaryingsBucket(program, kResultBucketId,
2019 buffermode);
2020 helper_->SetBucketSize(kResultBucketId, 0);
2021 CheckGLError();
2024 void GLES2Implementation::Uniform1f(GLint location, GLfloat x) {
2025 GPU_CLIENT_SINGLE_THREAD_CHECK();
2026 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform1f(" << location << ", "
2027 << x << ")");
2028 helper_->Uniform1f(location, x);
2029 CheckGLError();
2032 void GLES2Implementation::Uniform1fv(GLint location,
2033 GLsizei count,
2034 const GLfloat* v) {
2035 GPU_CLIENT_SINGLE_THREAD_CHECK();
2036 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform1fv(" << location << ", "
2037 << count << ", " << static_cast<const void*>(v) << ")");
2038 GPU_CLIENT_LOG_CODE_BLOCK({
2039 for (GLsizei i = 0; i < count; ++i) {
2040 GPU_CLIENT_LOG(" " << i << ": " << v[0 + i * 1]);
2043 if (count < 0) {
2044 SetGLError(GL_INVALID_VALUE, "glUniform1fv", "count < 0");
2045 return;
2047 helper_->Uniform1fvImmediate(location, count, v);
2048 CheckGLError();
2051 void GLES2Implementation::Uniform1i(GLint location, GLint x) {
2052 GPU_CLIENT_SINGLE_THREAD_CHECK();
2053 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform1i(" << location << ", "
2054 << x << ")");
2055 helper_->Uniform1i(location, x);
2056 CheckGLError();
2059 void GLES2Implementation::Uniform1iv(GLint location,
2060 GLsizei count,
2061 const GLint* v) {
2062 GPU_CLIENT_SINGLE_THREAD_CHECK();
2063 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform1iv(" << location << ", "
2064 << count << ", " << static_cast<const void*>(v) << ")");
2065 GPU_CLIENT_LOG_CODE_BLOCK({
2066 for (GLsizei i = 0; i < count; ++i) {
2067 GPU_CLIENT_LOG(" " << i << ": " << v[0 + i * 1]);
2070 if (count < 0) {
2071 SetGLError(GL_INVALID_VALUE, "glUniform1iv", "count < 0");
2072 return;
2074 helper_->Uniform1ivImmediate(location, count, v);
2075 CheckGLError();
2078 void GLES2Implementation::Uniform1ui(GLint location, GLuint x) {
2079 GPU_CLIENT_SINGLE_THREAD_CHECK();
2080 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform1ui(" << location << ", "
2081 << x << ")");
2082 helper_->Uniform1ui(location, x);
2083 CheckGLError();
2086 void GLES2Implementation::Uniform1uiv(GLint location,
2087 GLsizei count,
2088 const GLuint* v) {
2089 GPU_CLIENT_SINGLE_THREAD_CHECK();
2090 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform1uiv(" << location << ", "
2091 << count << ", " << static_cast<const void*>(v) << ")");
2092 GPU_CLIENT_LOG_CODE_BLOCK({
2093 for (GLsizei i = 0; i < count; ++i) {
2094 GPU_CLIENT_LOG(" " << i << ": " << v[0 + i * 1]);
2097 if (count < 0) {
2098 SetGLError(GL_INVALID_VALUE, "glUniform1uiv", "count < 0");
2099 return;
2101 helper_->Uniform1uivImmediate(location, count, v);
2102 CheckGLError();
2105 void GLES2Implementation::Uniform2f(GLint location, GLfloat x, GLfloat y) {
2106 GPU_CLIENT_SINGLE_THREAD_CHECK();
2107 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform2f(" << location << ", "
2108 << x << ", " << y << ")");
2109 helper_->Uniform2f(location, x, y);
2110 CheckGLError();
2113 void GLES2Implementation::Uniform2fv(GLint location,
2114 GLsizei count,
2115 const GLfloat* v) {
2116 GPU_CLIENT_SINGLE_THREAD_CHECK();
2117 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform2fv(" << location << ", "
2118 << count << ", " << static_cast<const void*>(v) << ")");
2119 GPU_CLIENT_LOG_CODE_BLOCK({
2120 for (GLsizei i = 0; i < count; ++i) {
2121 GPU_CLIENT_LOG(" " << i << ": " << v[0 + i * 2] << ", " << v[1 + i * 2]);
2124 if (count < 0) {
2125 SetGLError(GL_INVALID_VALUE, "glUniform2fv", "count < 0");
2126 return;
2128 helper_->Uniform2fvImmediate(location, count, v);
2129 CheckGLError();
2132 void GLES2Implementation::Uniform2i(GLint location, GLint x, GLint y) {
2133 GPU_CLIENT_SINGLE_THREAD_CHECK();
2134 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform2i(" << location << ", "
2135 << x << ", " << y << ")");
2136 helper_->Uniform2i(location, x, y);
2137 CheckGLError();
2140 void GLES2Implementation::Uniform2iv(GLint location,
2141 GLsizei count,
2142 const GLint* v) {
2143 GPU_CLIENT_SINGLE_THREAD_CHECK();
2144 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform2iv(" << location << ", "
2145 << count << ", " << static_cast<const void*>(v) << ")");
2146 GPU_CLIENT_LOG_CODE_BLOCK({
2147 for (GLsizei i = 0; i < count; ++i) {
2148 GPU_CLIENT_LOG(" " << i << ": " << v[0 + i * 2] << ", " << v[1 + i * 2]);
2151 if (count < 0) {
2152 SetGLError(GL_INVALID_VALUE, "glUniform2iv", "count < 0");
2153 return;
2155 helper_->Uniform2ivImmediate(location, count, v);
2156 CheckGLError();
2159 void GLES2Implementation::Uniform2ui(GLint location, GLuint x, GLuint y) {
2160 GPU_CLIENT_SINGLE_THREAD_CHECK();
2161 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform2ui(" << location << ", "
2162 << x << ", " << y << ")");
2163 helper_->Uniform2ui(location, x, y);
2164 CheckGLError();
2167 void GLES2Implementation::Uniform2uiv(GLint location,
2168 GLsizei count,
2169 const GLuint* v) {
2170 GPU_CLIENT_SINGLE_THREAD_CHECK();
2171 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform2uiv(" << location << ", "
2172 << count << ", " << static_cast<const void*>(v) << ")");
2173 GPU_CLIENT_LOG_CODE_BLOCK({
2174 for (GLsizei i = 0; i < count; ++i) {
2175 GPU_CLIENT_LOG(" " << i << ": " << v[0 + i * 2] << ", " << v[1 + i * 2]);
2178 if (count < 0) {
2179 SetGLError(GL_INVALID_VALUE, "glUniform2uiv", "count < 0");
2180 return;
2182 helper_->Uniform2uivImmediate(location, count, v);
2183 CheckGLError();
2186 void GLES2Implementation::Uniform3f(GLint location,
2187 GLfloat x,
2188 GLfloat y,
2189 GLfloat z) {
2190 GPU_CLIENT_SINGLE_THREAD_CHECK();
2191 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform3f(" << location << ", "
2192 << x << ", " << y << ", " << z << ")");
2193 helper_->Uniform3f(location, x, y, z);
2194 CheckGLError();
2197 void GLES2Implementation::Uniform3fv(GLint location,
2198 GLsizei count,
2199 const GLfloat* v) {
2200 GPU_CLIENT_SINGLE_THREAD_CHECK();
2201 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform3fv(" << 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 * 3] << ", " << v[1 + i * 3]
2206 << ", " << v[2 + i * 3]);
2209 if (count < 0) {
2210 SetGLError(GL_INVALID_VALUE, "glUniform3fv", "count < 0");
2211 return;
2213 helper_->Uniform3fvImmediate(location, count, v);
2214 CheckGLError();
2217 void GLES2Implementation::Uniform3i(GLint location, GLint x, GLint y, GLint z) {
2218 GPU_CLIENT_SINGLE_THREAD_CHECK();
2219 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform3i(" << location << ", "
2220 << x << ", " << y << ", " << z << ")");
2221 helper_->Uniform3i(location, x, y, z);
2222 CheckGLError();
2225 void GLES2Implementation::Uniform3iv(GLint location,
2226 GLsizei count,
2227 const GLint* v) {
2228 GPU_CLIENT_SINGLE_THREAD_CHECK();
2229 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform3iv(" << location << ", "
2230 << count << ", " << static_cast<const void*>(v) << ")");
2231 GPU_CLIENT_LOG_CODE_BLOCK({
2232 for (GLsizei i = 0; i < count; ++i) {
2233 GPU_CLIENT_LOG(" " << i << ": " << v[0 + i * 3] << ", " << v[1 + i * 3]
2234 << ", " << v[2 + i * 3]);
2237 if (count < 0) {
2238 SetGLError(GL_INVALID_VALUE, "glUniform3iv", "count < 0");
2239 return;
2241 helper_->Uniform3ivImmediate(location, count, v);
2242 CheckGLError();
2245 void GLES2Implementation::Uniform3ui(GLint location,
2246 GLuint x,
2247 GLuint y,
2248 GLuint z) {
2249 GPU_CLIENT_SINGLE_THREAD_CHECK();
2250 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform3ui(" << location << ", "
2251 << x << ", " << y << ", " << z << ")");
2252 helper_->Uniform3ui(location, x, y, z);
2253 CheckGLError();
2256 void GLES2Implementation::Uniform3uiv(GLint location,
2257 GLsizei count,
2258 const GLuint* v) {
2259 GPU_CLIENT_SINGLE_THREAD_CHECK();
2260 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform3uiv(" << location << ", "
2261 << count << ", " << static_cast<const void*>(v) << ")");
2262 GPU_CLIENT_LOG_CODE_BLOCK({
2263 for (GLsizei i = 0; i < count; ++i) {
2264 GPU_CLIENT_LOG(" " << i << ": " << v[0 + i * 3] << ", " << v[1 + i * 3]
2265 << ", " << v[2 + i * 3]);
2268 if (count < 0) {
2269 SetGLError(GL_INVALID_VALUE, "glUniform3uiv", "count < 0");
2270 return;
2272 helper_->Uniform3uivImmediate(location, count, v);
2273 CheckGLError();
2276 void GLES2Implementation::Uniform4f(GLint location,
2277 GLfloat x,
2278 GLfloat y,
2279 GLfloat z,
2280 GLfloat w) {
2281 GPU_CLIENT_SINGLE_THREAD_CHECK();
2282 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform4f(" << location << ", "
2283 << x << ", " << y << ", " << z << ", " << w << ")");
2284 helper_->Uniform4f(location, x, y, z, w);
2285 CheckGLError();
2288 void GLES2Implementation::Uniform4fv(GLint location,
2289 GLsizei count,
2290 const GLfloat* v) {
2291 GPU_CLIENT_SINGLE_THREAD_CHECK();
2292 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform4fv(" << location << ", "
2293 << count << ", " << static_cast<const void*>(v) << ")");
2294 GPU_CLIENT_LOG_CODE_BLOCK({
2295 for (GLsizei i = 0; i < count; ++i) {
2296 GPU_CLIENT_LOG(" " << i << ": " << v[0 + i * 4] << ", " << v[1 + i * 4]
2297 << ", " << v[2 + i * 4] << ", " << v[3 + i * 4]);
2300 if (count < 0) {
2301 SetGLError(GL_INVALID_VALUE, "glUniform4fv", "count < 0");
2302 return;
2304 helper_->Uniform4fvImmediate(location, count, v);
2305 CheckGLError();
2308 void GLES2Implementation::Uniform4i(GLint location,
2309 GLint x,
2310 GLint y,
2311 GLint z,
2312 GLint w) {
2313 GPU_CLIENT_SINGLE_THREAD_CHECK();
2314 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform4i(" << location << ", "
2315 << x << ", " << y << ", " << z << ", " << w << ")");
2316 helper_->Uniform4i(location, x, y, z, w);
2317 CheckGLError();
2320 void GLES2Implementation::Uniform4iv(GLint location,
2321 GLsizei count,
2322 const GLint* v) {
2323 GPU_CLIENT_SINGLE_THREAD_CHECK();
2324 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform4iv(" << location << ", "
2325 << count << ", " << static_cast<const void*>(v) << ")");
2326 GPU_CLIENT_LOG_CODE_BLOCK({
2327 for (GLsizei i = 0; i < count; ++i) {
2328 GPU_CLIENT_LOG(" " << i << ": " << v[0 + i * 4] << ", " << v[1 + i * 4]
2329 << ", " << v[2 + i * 4] << ", " << v[3 + i * 4]);
2332 if (count < 0) {
2333 SetGLError(GL_INVALID_VALUE, "glUniform4iv", "count < 0");
2334 return;
2336 helper_->Uniform4ivImmediate(location, count, v);
2337 CheckGLError();
2340 void GLES2Implementation::Uniform4ui(GLint location,
2341 GLuint x,
2342 GLuint y,
2343 GLuint z,
2344 GLuint w) {
2345 GPU_CLIENT_SINGLE_THREAD_CHECK();
2346 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform4ui(" << location << ", "
2347 << x << ", " << y << ", " << z << ", " << w << ")");
2348 helper_->Uniform4ui(location, x, y, z, w);
2349 CheckGLError();
2352 void GLES2Implementation::Uniform4uiv(GLint location,
2353 GLsizei count,
2354 const GLuint* v) {
2355 GPU_CLIENT_SINGLE_THREAD_CHECK();
2356 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform4uiv(" << location << ", "
2357 << count << ", " << static_cast<const void*>(v) << ")");
2358 GPU_CLIENT_LOG_CODE_BLOCK({
2359 for (GLsizei i = 0; i < count; ++i) {
2360 GPU_CLIENT_LOG(" " << i << ": " << v[0 + i * 4] << ", " << v[1 + i * 4]
2361 << ", " << v[2 + i * 4] << ", " << v[3 + i * 4]);
2364 if (count < 0) {
2365 SetGLError(GL_INVALID_VALUE, "glUniform4uiv", "count < 0");
2366 return;
2368 helper_->Uniform4uivImmediate(location, count, v);
2369 CheckGLError();
2372 void GLES2Implementation::UniformMatrix2fv(GLint location,
2373 GLsizei count,
2374 GLboolean transpose,
2375 const GLfloat* value) {
2376 GPU_CLIENT_SINGLE_THREAD_CHECK();
2377 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniformMatrix2fv(" << location
2378 << ", " << count << ", "
2379 << GLES2Util::GetStringBool(transpose) << ", "
2380 << static_cast<const void*>(value) << ")");
2381 GPU_CLIENT_LOG_CODE_BLOCK({
2382 for (GLsizei i = 0; i < count; ++i) {
2383 GPU_CLIENT_LOG(" " << i << ": " << value[0 + i * 4] << ", "
2384 << value[1 + i * 4] << ", " << value[2 + i * 4]
2385 << ", " << value[3 + i * 4]);
2388 if (count < 0) {
2389 SetGLError(GL_INVALID_VALUE, "glUniformMatrix2fv", "count < 0");
2390 return;
2392 if (transpose != false) {
2393 SetGLError(GL_INVALID_VALUE, "glUniformMatrix2fv",
2394 "transpose GL_INVALID_VALUE");
2395 return;
2397 helper_->UniformMatrix2fvImmediate(location, count, value);
2398 CheckGLError();
2401 void GLES2Implementation::UniformMatrix2x3fv(GLint location,
2402 GLsizei count,
2403 GLboolean transpose,
2404 const GLfloat* value) {
2405 GPU_CLIENT_SINGLE_THREAD_CHECK();
2406 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniformMatrix2x3fv(" << location
2407 << ", " << count << ", "
2408 << GLES2Util::GetStringBool(transpose) << ", "
2409 << static_cast<const void*>(value) << ")");
2410 GPU_CLIENT_LOG_CODE_BLOCK({
2411 for (GLsizei i = 0; i < count; ++i) {
2412 GPU_CLIENT_LOG(" " << i << ": " << value[0 + i * 6] << ", "
2413 << value[1 + i * 6] << ", " << value[2 + i * 6]
2414 << ", " << value[3 + i * 6] << ", "
2415 << value[4 + i * 6] << ", " << value[5 + i * 6]);
2418 if (count < 0) {
2419 SetGLError(GL_INVALID_VALUE, "glUniformMatrix2x3fv", "count < 0");
2420 return;
2422 if (transpose != false) {
2423 SetGLError(GL_INVALID_VALUE, "glUniformMatrix2x3fv",
2424 "transpose GL_INVALID_VALUE");
2425 return;
2427 helper_->UniformMatrix2x3fvImmediate(location, count, value);
2428 CheckGLError();
2431 void GLES2Implementation::UniformMatrix2x4fv(GLint location,
2432 GLsizei count,
2433 GLboolean transpose,
2434 const GLfloat* value) {
2435 GPU_CLIENT_SINGLE_THREAD_CHECK();
2436 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniformMatrix2x4fv(" << 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(
2443 " " << i << ": " << value[0 + i * 8] << ", " << value[1 + i * 8]
2444 << ", " << value[2 + i * 8] << ", " << value[3 + i * 8] << ", "
2445 << value[4 + i * 8] << ", " << value[5 + i * 8] << ", "
2446 << value[6 + i * 8] << ", " << value[7 + i * 8]);
2449 if (count < 0) {
2450 SetGLError(GL_INVALID_VALUE, "glUniformMatrix2x4fv", "count < 0");
2451 return;
2453 if (transpose != false) {
2454 SetGLError(GL_INVALID_VALUE, "glUniformMatrix2x4fv",
2455 "transpose GL_INVALID_VALUE");
2456 return;
2458 helper_->UniformMatrix2x4fvImmediate(location, count, value);
2459 CheckGLError();
2462 void GLES2Implementation::UniformMatrix3fv(GLint location,
2463 GLsizei count,
2464 GLboolean transpose,
2465 const GLfloat* value) {
2466 GPU_CLIENT_SINGLE_THREAD_CHECK();
2467 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniformMatrix3fv(" << location
2468 << ", " << count << ", "
2469 << GLES2Util::GetStringBool(transpose) << ", "
2470 << static_cast<const void*>(value) << ")");
2471 GPU_CLIENT_LOG_CODE_BLOCK({
2472 for (GLsizei i = 0; i < count; ++i) {
2473 GPU_CLIENT_LOG(" " << i << ": " << value[0 + i * 9] << ", "
2474 << value[1 + i * 9] << ", " << value[2 + i * 9]
2475 << ", " << value[3 + i * 9] << ", "
2476 << value[4 + i * 9] << ", " << value[5 + i * 9]
2477 << ", " << value[6 + i * 9] << ", "
2478 << value[7 + i * 9] << ", " << value[8 + i * 9]);
2481 if (count < 0) {
2482 SetGLError(GL_INVALID_VALUE, "glUniformMatrix3fv", "count < 0");
2483 return;
2485 if (transpose != false) {
2486 SetGLError(GL_INVALID_VALUE, "glUniformMatrix3fv",
2487 "transpose GL_INVALID_VALUE");
2488 return;
2490 helper_->UniformMatrix3fvImmediate(location, count, value);
2491 CheckGLError();
2494 void GLES2Implementation::UniformMatrix3x2fv(GLint location,
2495 GLsizei count,
2496 GLboolean transpose,
2497 const GLfloat* value) {
2498 GPU_CLIENT_SINGLE_THREAD_CHECK();
2499 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniformMatrix3x2fv(" << location
2500 << ", " << count << ", "
2501 << GLES2Util::GetStringBool(transpose) << ", "
2502 << static_cast<const void*>(value) << ")");
2503 GPU_CLIENT_LOG_CODE_BLOCK({
2504 for (GLsizei i = 0; i < count; ++i) {
2505 GPU_CLIENT_LOG(" " << i << ": " << value[0 + i * 6] << ", "
2506 << value[1 + i * 6] << ", " << value[2 + i * 6]
2507 << ", " << value[3 + i * 6] << ", "
2508 << value[4 + i * 6] << ", " << value[5 + i * 6]);
2511 if (count < 0) {
2512 SetGLError(GL_INVALID_VALUE, "glUniformMatrix3x2fv", "count < 0");
2513 return;
2515 if (transpose != false) {
2516 SetGLError(GL_INVALID_VALUE, "glUniformMatrix3x2fv",
2517 "transpose GL_INVALID_VALUE");
2518 return;
2520 helper_->UniformMatrix3x2fvImmediate(location, count, value);
2521 CheckGLError();
2524 void GLES2Implementation::UniformMatrix3x4fv(GLint location,
2525 GLsizei count,
2526 GLboolean transpose,
2527 const GLfloat* value) {
2528 GPU_CLIENT_SINGLE_THREAD_CHECK();
2529 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniformMatrix3x4fv(" << 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(
2536 " " << i << ": " << value[0 + i * 12] << ", " << value[1 + i * 12]
2537 << ", " << value[2 + i * 12] << ", " << value[3 + i * 12] << ", "
2538 << value[4 + i * 12] << ", " << value[5 + i * 12] << ", "
2539 << value[6 + i * 12] << ", " << value[7 + i * 12] << ", "
2540 << value[8 + i * 12] << ", " << value[9 + i * 12] << ", "
2541 << value[10 + i * 12] << ", " << value[11 + i * 12]);
2544 if (count < 0) {
2545 SetGLError(GL_INVALID_VALUE, "glUniformMatrix3x4fv", "count < 0");
2546 return;
2548 if (transpose != false) {
2549 SetGLError(GL_INVALID_VALUE, "glUniformMatrix3x4fv",
2550 "transpose GL_INVALID_VALUE");
2551 return;
2553 helper_->UniformMatrix3x4fvImmediate(location, count, value);
2554 CheckGLError();
2557 void GLES2Implementation::UniformMatrix4fv(GLint location,
2558 GLsizei count,
2559 GLboolean transpose,
2560 const GLfloat* value) {
2561 GPU_CLIENT_SINGLE_THREAD_CHECK();
2562 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniformMatrix4fv(" << location
2563 << ", " << count << ", "
2564 << GLES2Util::GetStringBool(transpose) << ", "
2565 << static_cast<const void*>(value) << ")");
2566 GPU_CLIENT_LOG_CODE_BLOCK({
2567 for (GLsizei i = 0; i < count; ++i) {
2568 GPU_CLIENT_LOG(
2569 " " << i << ": " << value[0 + i * 16] << ", " << value[1 + i * 16]
2570 << ", " << value[2 + i * 16] << ", " << value[3 + i * 16] << ", "
2571 << value[4 + i * 16] << ", " << value[5 + i * 16] << ", "
2572 << value[6 + i * 16] << ", " << value[7 + i * 16] << ", "
2573 << value[8 + i * 16] << ", " << value[9 + i * 16] << ", "
2574 << value[10 + i * 16] << ", " << value[11 + i * 16] << ", "
2575 << value[12 + i * 16] << ", " << value[13 + i * 16] << ", "
2576 << value[14 + i * 16] << ", " << value[15 + i * 16]);
2579 if (count < 0) {
2580 SetGLError(GL_INVALID_VALUE, "glUniformMatrix4fv", "count < 0");
2581 return;
2583 if (transpose != false) {
2584 SetGLError(GL_INVALID_VALUE, "glUniformMatrix4fv",
2585 "transpose GL_INVALID_VALUE");
2586 return;
2588 helper_->UniformMatrix4fvImmediate(location, count, value);
2589 CheckGLError();
2592 void GLES2Implementation::UniformMatrix4x2fv(GLint location,
2593 GLsizei count,
2594 GLboolean transpose,
2595 const GLfloat* value) {
2596 GPU_CLIENT_SINGLE_THREAD_CHECK();
2597 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniformMatrix4x2fv(" << location
2598 << ", " << count << ", "
2599 << GLES2Util::GetStringBool(transpose) << ", "
2600 << static_cast<const void*>(value) << ")");
2601 GPU_CLIENT_LOG_CODE_BLOCK({
2602 for (GLsizei i = 0; i < count; ++i) {
2603 GPU_CLIENT_LOG(
2604 " " << i << ": " << value[0 + i * 8] << ", " << value[1 + i * 8]
2605 << ", " << value[2 + i * 8] << ", " << value[3 + i * 8] << ", "
2606 << value[4 + i * 8] << ", " << value[5 + i * 8] << ", "
2607 << value[6 + i * 8] << ", " << value[7 + i * 8]);
2610 if (count < 0) {
2611 SetGLError(GL_INVALID_VALUE, "glUniformMatrix4x2fv", "count < 0");
2612 return;
2614 if (transpose != false) {
2615 SetGLError(GL_INVALID_VALUE, "glUniformMatrix4x2fv",
2616 "transpose GL_INVALID_VALUE");
2617 return;
2619 helper_->UniformMatrix4x2fvImmediate(location, count, value);
2620 CheckGLError();
2623 void GLES2Implementation::UniformMatrix4x3fv(GLint location,
2624 GLsizei count,
2625 GLboolean transpose,
2626 const GLfloat* value) {
2627 GPU_CLIENT_SINGLE_THREAD_CHECK();
2628 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniformMatrix4x3fv(" << location
2629 << ", " << count << ", "
2630 << GLES2Util::GetStringBool(transpose) << ", "
2631 << static_cast<const void*>(value) << ")");
2632 GPU_CLIENT_LOG_CODE_BLOCK({
2633 for (GLsizei i = 0; i < count; ++i) {
2634 GPU_CLIENT_LOG(
2635 " " << i << ": " << value[0 + i * 12] << ", " << value[1 + i * 12]
2636 << ", " << value[2 + i * 12] << ", " << value[3 + i * 12] << ", "
2637 << value[4 + i * 12] << ", " << value[5 + i * 12] << ", "
2638 << value[6 + i * 12] << ", " << value[7 + i * 12] << ", "
2639 << value[8 + i * 12] << ", " << value[9 + i * 12] << ", "
2640 << value[10 + i * 12] << ", " << value[11 + i * 12]);
2643 if (count < 0) {
2644 SetGLError(GL_INVALID_VALUE, "glUniformMatrix4x3fv", "count < 0");
2645 return;
2647 if (transpose != false) {
2648 SetGLError(GL_INVALID_VALUE, "glUniformMatrix4x3fv",
2649 "transpose GL_INVALID_VALUE");
2650 return;
2652 helper_->UniformMatrix4x3fvImmediate(location, count, value);
2653 CheckGLError();
2656 void GLES2Implementation::UseProgram(GLuint program) {
2657 GPU_CLIENT_SINGLE_THREAD_CHECK();
2658 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUseProgram(" << program << ")");
2659 if (IsProgramReservedId(program)) {
2660 SetGLError(GL_INVALID_OPERATION, "UseProgram", "program reserved id");
2661 return;
2663 UseProgramHelper(program);
2664 CheckGLError();
2667 void GLES2Implementation::ValidateProgram(GLuint program) {
2668 GPU_CLIENT_SINGLE_THREAD_CHECK();
2669 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glValidateProgram(" << program
2670 << ")");
2671 helper_->ValidateProgram(program);
2672 CheckGLError();
2675 void GLES2Implementation::VertexAttrib1f(GLuint indx, GLfloat x) {
2676 GPU_CLIENT_SINGLE_THREAD_CHECK();
2677 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glVertexAttrib1f(" << indx << ", "
2678 << x << ")");
2679 helper_->VertexAttrib1f(indx, x);
2680 CheckGLError();
2683 void GLES2Implementation::VertexAttrib1fv(GLuint indx, const GLfloat* values) {
2684 GPU_CLIENT_SINGLE_THREAD_CHECK();
2685 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glVertexAttrib1fv(" << indx << ", "
2686 << static_cast<const void*>(values) << ")");
2687 size_t count = 1;
2688 for (size_t ii = 0; ii < count; ++ii)
2689 GPU_CLIENT_LOG("value[" << ii << "]: " << values[ii]);
2690 helper_->VertexAttrib1fvImmediate(indx, values);
2691 CheckGLError();
2694 void GLES2Implementation::VertexAttrib2f(GLuint indx, GLfloat x, GLfloat y) {
2695 GPU_CLIENT_SINGLE_THREAD_CHECK();
2696 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glVertexAttrib2f(" << indx << ", "
2697 << x << ", " << y << ")");
2698 helper_->VertexAttrib2f(indx, x, y);
2699 CheckGLError();
2702 void GLES2Implementation::VertexAttrib2fv(GLuint indx, const GLfloat* values) {
2703 GPU_CLIENT_SINGLE_THREAD_CHECK();
2704 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glVertexAttrib2fv(" << indx << ", "
2705 << static_cast<const void*>(values) << ")");
2706 size_t count = 2;
2707 for (size_t ii = 0; ii < count; ++ii)
2708 GPU_CLIENT_LOG("value[" << ii << "]: " << values[ii]);
2709 helper_->VertexAttrib2fvImmediate(indx, values);
2710 CheckGLError();
2713 void GLES2Implementation::VertexAttrib3f(GLuint indx,
2714 GLfloat x,
2715 GLfloat y,
2716 GLfloat z) {
2717 GPU_CLIENT_SINGLE_THREAD_CHECK();
2718 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glVertexAttrib3f(" << indx << ", "
2719 << x << ", " << y << ", " << z << ")");
2720 helper_->VertexAttrib3f(indx, x, y, z);
2721 CheckGLError();
2724 void GLES2Implementation::VertexAttrib3fv(GLuint indx, const GLfloat* values) {
2725 GPU_CLIENT_SINGLE_THREAD_CHECK();
2726 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glVertexAttrib3fv(" << indx << ", "
2727 << static_cast<const void*>(values) << ")");
2728 size_t count = 3;
2729 for (size_t ii = 0; ii < count; ++ii)
2730 GPU_CLIENT_LOG("value[" << ii << "]: " << values[ii]);
2731 helper_->VertexAttrib3fvImmediate(indx, values);
2732 CheckGLError();
2735 void GLES2Implementation::VertexAttrib4f(GLuint indx,
2736 GLfloat x,
2737 GLfloat y,
2738 GLfloat z,
2739 GLfloat w) {
2740 GPU_CLIENT_SINGLE_THREAD_CHECK();
2741 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glVertexAttrib4f(" << indx << ", "
2742 << x << ", " << y << ", " << z << ", " << w << ")");
2743 helper_->VertexAttrib4f(indx, x, y, z, w);
2744 CheckGLError();
2747 void GLES2Implementation::VertexAttrib4fv(GLuint indx, const GLfloat* values) {
2748 GPU_CLIENT_SINGLE_THREAD_CHECK();
2749 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glVertexAttrib4fv(" << indx << ", "
2750 << static_cast<const void*>(values) << ")");
2751 size_t count = 4;
2752 for (size_t ii = 0; ii < count; ++ii)
2753 GPU_CLIENT_LOG("value[" << ii << "]: " << values[ii]);
2754 helper_->VertexAttrib4fvImmediate(indx, values);
2755 CheckGLError();
2758 void GLES2Implementation::VertexAttribI4i(GLuint indx,
2759 GLint x,
2760 GLint y,
2761 GLint z,
2762 GLint w) {
2763 GPU_CLIENT_SINGLE_THREAD_CHECK();
2764 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glVertexAttribI4i(" << indx << ", "
2765 << x << ", " << y << ", " << z << ", " << w << ")");
2766 helper_->VertexAttribI4i(indx, x, y, z, w);
2767 CheckGLError();
2770 void GLES2Implementation::VertexAttribI4iv(GLuint indx, const GLint* values) {
2771 GPU_CLIENT_SINGLE_THREAD_CHECK();
2772 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glVertexAttribI4iv(" << indx
2773 << ", " << static_cast<const void*>(values) << ")");
2774 size_t count = 4;
2775 for (size_t ii = 0; ii < count; ++ii)
2776 GPU_CLIENT_LOG("value[" << ii << "]: " << values[ii]);
2777 helper_->VertexAttribI4ivImmediate(indx, values);
2778 CheckGLError();
2781 void GLES2Implementation::VertexAttribI4ui(GLuint indx,
2782 GLuint x,
2783 GLuint y,
2784 GLuint z,
2785 GLuint w) {
2786 GPU_CLIENT_SINGLE_THREAD_CHECK();
2787 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glVertexAttribI4ui(" << indx
2788 << ", " << x << ", " << y << ", " << z << ", " << w
2789 << ")");
2790 helper_->VertexAttribI4ui(indx, x, y, z, w);
2791 CheckGLError();
2794 void GLES2Implementation::VertexAttribI4uiv(GLuint indx, const GLuint* values) {
2795 GPU_CLIENT_SINGLE_THREAD_CHECK();
2796 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glVertexAttribI4uiv(" << indx
2797 << ", " << static_cast<const void*>(values) << ")");
2798 size_t count = 4;
2799 for (size_t ii = 0; ii < count; ++ii)
2800 GPU_CLIENT_LOG("value[" << ii << "]: " << values[ii]);
2801 helper_->VertexAttribI4uivImmediate(indx, values);
2802 CheckGLError();
2805 void GLES2Implementation::Viewport(GLint x,
2806 GLint y,
2807 GLsizei width,
2808 GLsizei height) {
2809 GPU_CLIENT_SINGLE_THREAD_CHECK();
2810 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glViewport(" << x << ", " << y
2811 << ", " << width << ", " << height << ")");
2812 if (width < 0) {
2813 SetGLError(GL_INVALID_VALUE, "glViewport", "width < 0");
2814 return;
2816 if (height < 0) {
2817 SetGLError(GL_INVALID_VALUE, "glViewport", "height < 0");
2818 return;
2820 helper_->Viewport(x, y, width, height);
2821 CheckGLError();
2824 void GLES2Implementation::BlitFramebufferCHROMIUM(GLint srcX0,
2825 GLint srcY0,
2826 GLint srcX1,
2827 GLint srcY1,
2828 GLint dstX0,
2829 GLint dstY0,
2830 GLint dstX1,
2831 GLint dstY1,
2832 GLbitfield mask,
2833 GLenum filter) {
2834 GPU_CLIENT_SINGLE_THREAD_CHECK();
2835 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBlitFramebufferCHROMIUM("
2836 << srcX0 << ", " << srcY0 << ", " << srcX1 << ", " << srcY1
2837 << ", " << dstX0 << ", " << dstY0 << ", " << dstX1 << ", "
2838 << dstY1 << ", " << mask << ", "
2839 << GLES2Util::GetStringBlitFilter(filter) << ")");
2840 helper_->BlitFramebufferCHROMIUM(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0,
2841 dstX1, dstY1, mask, filter);
2842 CheckGLError();
2845 void GLES2Implementation::RenderbufferStorageMultisampleCHROMIUM(
2846 GLenum target,
2847 GLsizei samples,
2848 GLenum internalformat,
2849 GLsizei width,
2850 GLsizei height) {
2851 GPU_CLIENT_SINGLE_THREAD_CHECK();
2852 GPU_CLIENT_LOG(
2853 "[" << GetLogPrefix() << "] glRenderbufferStorageMultisampleCHROMIUM("
2854 << GLES2Util::GetStringRenderBufferTarget(target) << ", " << samples
2855 << ", " << GLES2Util::GetStringRenderBufferFormat(internalformat)
2856 << ", " << width << ", " << height << ")");
2857 if (samples < 0) {
2858 SetGLError(GL_INVALID_VALUE, "glRenderbufferStorageMultisampleCHROMIUM",
2859 "samples < 0");
2860 return;
2862 if (width < 0) {
2863 SetGLError(GL_INVALID_VALUE, "glRenderbufferStorageMultisampleCHROMIUM",
2864 "width < 0");
2865 return;
2867 if (height < 0) {
2868 SetGLError(GL_INVALID_VALUE, "glRenderbufferStorageMultisampleCHROMIUM",
2869 "height < 0");
2870 return;
2872 helper_->RenderbufferStorageMultisampleCHROMIUM(
2873 target, samples, internalformat, width, height);
2874 CheckGLError();
2877 void GLES2Implementation::RenderbufferStorageMultisampleEXT(
2878 GLenum target,
2879 GLsizei samples,
2880 GLenum internalformat,
2881 GLsizei width,
2882 GLsizei height) {
2883 GPU_CLIENT_SINGLE_THREAD_CHECK();
2884 GPU_CLIENT_LOG(
2885 "[" << GetLogPrefix() << "] glRenderbufferStorageMultisampleEXT("
2886 << GLES2Util::GetStringRenderBufferTarget(target) << ", " << samples
2887 << ", " << GLES2Util::GetStringRenderBufferFormat(internalformat)
2888 << ", " << width << ", " << height << ")");
2889 if (samples < 0) {
2890 SetGLError(GL_INVALID_VALUE, "glRenderbufferStorageMultisampleEXT",
2891 "samples < 0");
2892 return;
2894 if (width < 0) {
2895 SetGLError(GL_INVALID_VALUE, "glRenderbufferStorageMultisampleEXT",
2896 "width < 0");
2897 return;
2899 if (height < 0) {
2900 SetGLError(GL_INVALID_VALUE, "glRenderbufferStorageMultisampleEXT",
2901 "height < 0");
2902 return;
2904 helper_->RenderbufferStorageMultisampleEXT(target, samples, internalformat,
2905 width, height);
2906 CheckGLError();
2909 void GLES2Implementation::FramebufferTexture2DMultisampleEXT(GLenum target,
2910 GLenum attachment,
2911 GLenum textarget,
2912 GLuint texture,
2913 GLint level,
2914 GLsizei samples) {
2915 GPU_CLIENT_SINGLE_THREAD_CHECK();
2916 GPU_CLIENT_LOG("[" << GetLogPrefix()
2917 << "] glFramebufferTexture2DMultisampleEXT("
2918 << GLES2Util::GetStringFrameBufferTarget(target) << ", "
2919 << GLES2Util::GetStringAttachment(attachment) << ", "
2920 << GLES2Util::GetStringTextureTarget(textarget) << ", "
2921 << texture << ", " << level << ", " << samples << ")");
2922 if (level != 0) {
2923 SetGLError(GL_INVALID_VALUE, "glFramebufferTexture2DMultisampleEXT",
2924 "level GL_INVALID_VALUE");
2925 return;
2927 if (samples < 0) {
2928 SetGLError(GL_INVALID_VALUE, "glFramebufferTexture2DMultisampleEXT",
2929 "samples < 0");
2930 return;
2932 helper_->FramebufferTexture2DMultisampleEXT(target, attachment, textarget,
2933 texture, samples);
2934 CheckGLError();
2937 void GLES2Implementation::TexStorage2DEXT(GLenum target,
2938 GLsizei levels,
2939 GLenum internalFormat,
2940 GLsizei width,
2941 GLsizei height) {
2942 GPU_CLIENT_SINGLE_THREAD_CHECK();
2943 GPU_CLIENT_LOG(
2944 "[" << GetLogPrefix() << "] glTexStorage2DEXT("
2945 << GLES2Util::GetStringTextureBindTarget(target) << ", " << levels
2946 << ", "
2947 << GLES2Util::GetStringTextureInternalFormatStorage(internalFormat)
2948 << ", " << width << ", " << height << ")");
2949 if (levels < 0) {
2950 SetGLError(GL_INVALID_VALUE, "glTexStorage2DEXT", "levels < 0");
2951 return;
2953 if (width < 0) {
2954 SetGLError(GL_INVALID_VALUE, "glTexStorage2DEXT", "width < 0");
2955 return;
2957 if (height < 0) {
2958 SetGLError(GL_INVALID_VALUE, "glTexStorage2DEXT", "height < 0");
2959 return;
2961 helper_->TexStorage2DEXT(target, levels, internalFormat, width, height);
2962 CheckGLError();
2965 void GLES2Implementation::GenQueriesEXT(GLsizei n, GLuint* queries) {
2966 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGenQueriesEXT(" << n << ", "
2967 << static_cast<const void*>(queries) << ")");
2968 if (n < 0) {
2969 SetGLError(GL_INVALID_VALUE, "glGenQueriesEXT", "n < 0");
2970 return;
2972 GPU_CLIENT_SINGLE_THREAD_CHECK();
2973 IdAllocator* id_allocator = GetIdAllocator(id_namespaces::kQueries);
2974 for (GLsizei ii = 0; ii < n; ++ii)
2975 queries[ii] = id_allocator->AllocateID();
2976 GenQueriesEXTHelper(n, queries);
2977 helper_->GenQueriesEXTImmediate(n, queries);
2978 if (share_group_->bind_generates_resource())
2979 helper_->CommandBufferHelper::Flush();
2980 GPU_CLIENT_LOG_CODE_BLOCK({
2981 for (GLsizei i = 0; i < n; ++i) {
2982 GPU_CLIENT_LOG(" " << i << ": " << queries[i]);
2985 CheckGLError();
2988 void GLES2Implementation::DeleteQueriesEXT(GLsizei n, const GLuint* queries) {
2989 GPU_CLIENT_SINGLE_THREAD_CHECK();
2990 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDeleteQueriesEXT(" << n << ", "
2991 << static_cast<const void*>(queries) << ")");
2992 GPU_CLIENT_LOG_CODE_BLOCK({
2993 for (GLsizei i = 0; i < n; ++i) {
2994 GPU_CLIENT_LOG(" " << i << ": " << queries[i]);
2997 GPU_CLIENT_DCHECK_CODE_BLOCK({
2998 for (GLsizei i = 0; i < n; ++i) {
2999 DCHECK(queries[i] != 0);
3002 if (n < 0) {
3003 SetGLError(GL_INVALID_VALUE, "glDeleteQueriesEXT", "n < 0");
3004 return;
3006 DeleteQueriesEXTHelper(n, queries);
3007 CheckGLError();
3010 void GLES2Implementation::BeginTransformFeedback(GLenum primitivemode) {
3011 GPU_CLIENT_SINGLE_THREAD_CHECK();
3012 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBeginTransformFeedback("
3013 << GLES2Util::GetStringTransformFeedbackPrimitiveMode(
3014 primitivemode) << ")");
3015 helper_->BeginTransformFeedback(primitivemode);
3016 CheckGLError();
3019 void GLES2Implementation::EndTransformFeedback() {
3020 GPU_CLIENT_SINGLE_THREAD_CHECK();
3021 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glEndTransformFeedback("
3022 << ")");
3023 helper_->EndTransformFeedback();
3024 CheckGLError();
3027 void GLES2Implementation::GenVertexArraysOES(GLsizei n, GLuint* arrays) {
3028 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGenVertexArraysOES(" << n << ", "
3029 << static_cast<const void*>(arrays) << ")");
3030 if (n < 0) {
3031 SetGLError(GL_INVALID_VALUE, "glGenVertexArraysOES", "n < 0");
3032 return;
3034 GPU_CLIENT_SINGLE_THREAD_CHECK();
3035 GetIdHandler(id_namespaces::kVertexArrays)->MakeIds(this, 0, n, arrays);
3036 GenVertexArraysOESHelper(n, arrays);
3037 helper_->GenVertexArraysOESImmediate(n, arrays);
3038 if (share_group_->bind_generates_resource())
3039 helper_->CommandBufferHelper::Flush();
3040 GPU_CLIENT_LOG_CODE_BLOCK({
3041 for (GLsizei i = 0; i < n; ++i) {
3042 GPU_CLIENT_LOG(" " << i << ": " << arrays[i]);
3045 CheckGLError();
3048 void GLES2Implementation::DeleteVertexArraysOES(GLsizei n,
3049 const GLuint* arrays) {
3050 GPU_CLIENT_SINGLE_THREAD_CHECK();
3051 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDeleteVertexArraysOES(" << n
3052 << ", " << static_cast<const void*>(arrays) << ")");
3053 GPU_CLIENT_LOG_CODE_BLOCK({
3054 for (GLsizei i = 0; i < n; ++i) {
3055 GPU_CLIENT_LOG(" " << i << ": " << arrays[i]);
3058 GPU_CLIENT_DCHECK_CODE_BLOCK({
3059 for (GLsizei i = 0; i < n; ++i) {
3060 DCHECK(arrays[i] != 0);
3063 if (n < 0) {
3064 SetGLError(GL_INVALID_VALUE, "glDeleteVertexArraysOES", "n < 0");
3065 return;
3067 DeleteVertexArraysOESHelper(n, arrays);
3068 CheckGLError();
3071 GLboolean GLES2Implementation::IsVertexArrayOES(GLuint array) {
3072 GPU_CLIENT_SINGLE_THREAD_CHECK();
3073 TRACE_EVENT0("gpu", "GLES2Implementation::IsVertexArrayOES");
3074 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glIsVertexArrayOES(" << array
3075 << ")");
3076 typedef cmds::IsVertexArrayOES::Result Result;
3077 Result* result = GetResultAs<Result*>();
3078 if (!result) {
3079 return GL_FALSE;
3081 *result = 0;
3082 helper_->IsVertexArrayOES(array, GetResultShmId(), GetResultShmOffset());
3083 WaitForCmd();
3084 GLboolean result_value = *result != 0;
3085 GPU_CLIENT_LOG("returned " << result_value);
3086 CheckGLError();
3087 return result_value;
3090 void GLES2Implementation::BindVertexArrayOES(GLuint array) {
3091 GPU_CLIENT_SINGLE_THREAD_CHECK();
3092 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBindVertexArrayOES(" << array
3093 << ")");
3094 if (IsVertexArrayReservedId(array)) {
3095 SetGLError(GL_INVALID_OPERATION, "BindVertexArrayOES", "array reserved id");
3096 return;
3098 BindVertexArrayOESHelper(array);
3099 CheckGLError();
3102 void GLES2Implementation::GetTranslatedShaderSourceANGLE(GLuint shader,
3103 GLsizei bufsize,
3104 GLsizei* length,
3105 char* source) {
3106 GPU_CLIENT_SINGLE_THREAD_CHECK();
3107 GPU_CLIENT_VALIDATE_DESTINATION_OPTIONAL_INITALIZATION(GLsizei, length);
3108 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetTranslatedShaderSourceANGLE"
3109 << "(" << shader << ", " << bufsize << ", "
3110 << static_cast<void*>(length) << ", "
3111 << static_cast<void*>(source) << ")");
3112 helper_->SetBucketSize(kResultBucketId, 0);
3113 helper_->GetTranslatedShaderSourceANGLE(shader, kResultBucketId);
3114 std::string str;
3115 GLsizei max_size = 0;
3116 if (GetBucketAsString(kResultBucketId, &str)) {
3117 if (bufsize > 0) {
3118 max_size = std::min(static_cast<size_t>(bufsize) - 1, str.size());
3119 memcpy(source, str.c_str(), max_size);
3120 source[max_size] = '\0';
3121 GPU_CLIENT_LOG("------\n" << source << "\n------");
3124 if (length != NULL) {
3125 *length = max_size;
3127 CheckGLError();
3129 void GLES2Implementation::TexImageIOSurface2DCHROMIUM(GLenum target,
3130 GLsizei width,
3131 GLsizei height,
3132 GLuint ioSurfaceId,
3133 GLuint plane) {
3134 GPU_CLIENT_SINGLE_THREAD_CHECK();
3135 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glTexImageIOSurface2DCHROMIUM("
3136 << GLES2Util::GetStringTextureBindTarget(target) << ", "
3137 << width << ", " << height << ", " << ioSurfaceId << ", "
3138 << plane << ")");
3139 if (width < 0) {
3140 SetGLError(GL_INVALID_VALUE, "glTexImageIOSurface2DCHROMIUM", "width < 0");
3141 return;
3143 if (height < 0) {
3144 SetGLError(GL_INVALID_VALUE, "glTexImageIOSurface2DCHROMIUM", "height < 0");
3145 return;
3147 helper_->TexImageIOSurface2DCHROMIUM(target, width, height, ioSurfaceId,
3148 plane);
3149 CheckGLError();
3152 void GLES2Implementation::CopyTextureCHROMIUM(GLenum target,
3153 GLenum source_id,
3154 GLenum dest_id,
3155 GLint internalformat,
3156 GLenum dest_type) {
3157 GPU_CLIENT_SINGLE_THREAD_CHECK();
3158 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glCopyTextureCHROMIUM("
3159 << GLES2Util::GetStringEnum(target) << ", "
3160 << GLES2Util::GetStringEnum(source_id) << ", "
3161 << GLES2Util::GetStringEnum(dest_id) << ", "
3162 << internalformat << ", "
3163 << GLES2Util::GetStringPixelType(dest_type) << ")");
3164 helper_->CopyTextureCHROMIUM(target, source_id, dest_id, internalformat,
3165 dest_type);
3166 CheckGLError();
3169 void GLES2Implementation::CopySubTextureCHROMIUM(GLenum target,
3170 GLenum source_id,
3171 GLenum dest_id,
3172 GLint xoffset,
3173 GLint yoffset,
3174 GLint x,
3175 GLint y,
3176 GLsizei width,
3177 GLsizei height) {
3178 GPU_CLIENT_SINGLE_THREAD_CHECK();
3179 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glCopySubTextureCHROMIUM("
3180 << GLES2Util::GetStringEnum(target) << ", "
3181 << GLES2Util::GetStringEnum(source_id) << ", "
3182 << GLES2Util::GetStringEnum(dest_id) << ", " << xoffset
3183 << ", " << yoffset << ", " << x << ", " << y << ", "
3184 << width << ", " << height << ")");
3185 if (width < 0) {
3186 SetGLError(GL_INVALID_VALUE, "glCopySubTextureCHROMIUM", "width < 0");
3187 return;
3189 if (height < 0) {
3190 SetGLError(GL_INVALID_VALUE, "glCopySubTextureCHROMIUM", "height < 0");
3191 return;
3193 helper_->CopySubTextureCHROMIUM(target, source_id, dest_id, xoffset, yoffset,
3194 x, y, width, height);
3195 CheckGLError();
3198 void GLES2Implementation::CompressedCopyTextureCHROMIUM(GLenum target,
3199 GLenum source_id,
3200 GLenum dest_id) {
3201 GPU_CLIENT_SINGLE_THREAD_CHECK();
3202 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glCompressedCopyTextureCHROMIUM("
3203 << GLES2Util::GetStringEnum(target) << ", "
3204 << GLES2Util::GetStringEnum(source_id) << ", "
3205 << GLES2Util::GetStringEnum(dest_id) << ")");
3206 helper_->CompressedCopyTextureCHROMIUM(target, source_id, dest_id);
3207 CheckGLError();
3210 void GLES2Implementation::GenValuebuffersCHROMIUM(GLsizei n, GLuint* buffers) {
3211 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGenValuebuffersCHROMIUM(" << n
3212 << ", " << static_cast<const void*>(buffers) << ")");
3213 if (n < 0) {
3214 SetGLError(GL_INVALID_VALUE, "glGenValuebuffersCHROMIUM", "n < 0");
3215 return;
3217 GPU_CLIENT_SINGLE_THREAD_CHECK();
3218 GetIdHandler(id_namespaces::kValuebuffers)->MakeIds(this, 0, n, buffers);
3219 GenValuebuffersCHROMIUMHelper(n, buffers);
3220 helper_->GenValuebuffersCHROMIUMImmediate(n, buffers);
3221 if (share_group_->bind_generates_resource())
3222 helper_->CommandBufferHelper::Flush();
3223 GPU_CLIENT_LOG_CODE_BLOCK({
3224 for (GLsizei i = 0; i < n; ++i) {
3225 GPU_CLIENT_LOG(" " << i << ": " << buffers[i]);
3228 CheckGLError();
3231 void GLES2Implementation::DeleteValuebuffersCHROMIUM(
3232 GLsizei n,
3233 const GLuint* valuebuffers) {
3234 GPU_CLIENT_SINGLE_THREAD_CHECK();
3235 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDeleteValuebuffersCHROMIUM(" << n
3236 << ", " << static_cast<const void*>(valuebuffers) << ")");
3237 GPU_CLIENT_LOG_CODE_BLOCK({
3238 for (GLsizei i = 0; i < n; ++i) {
3239 GPU_CLIENT_LOG(" " << i << ": " << valuebuffers[i]);
3242 GPU_CLIENT_DCHECK_CODE_BLOCK({
3243 for (GLsizei i = 0; i < n; ++i) {
3244 DCHECK(valuebuffers[i] != 0);
3247 if (n < 0) {
3248 SetGLError(GL_INVALID_VALUE, "glDeleteValuebuffersCHROMIUM", "n < 0");
3249 return;
3251 DeleteValuebuffersCHROMIUMHelper(n, valuebuffers);
3252 CheckGLError();
3255 GLboolean GLES2Implementation::IsValuebufferCHROMIUM(GLuint valuebuffer) {
3256 GPU_CLIENT_SINGLE_THREAD_CHECK();
3257 TRACE_EVENT0("gpu", "GLES2Implementation::IsValuebufferCHROMIUM");
3258 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glIsValuebufferCHROMIUM("
3259 << valuebuffer << ")");
3260 typedef cmds::IsValuebufferCHROMIUM::Result Result;
3261 Result* result = GetResultAs<Result*>();
3262 if (!result) {
3263 return GL_FALSE;
3265 *result = 0;
3266 helper_->IsValuebufferCHROMIUM(valuebuffer, GetResultShmId(),
3267 GetResultShmOffset());
3268 WaitForCmd();
3269 GLboolean result_value = *result != 0;
3270 GPU_CLIENT_LOG("returned " << result_value);
3271 CheckGLError();
3272 return result_value;
3275 void GLES2Implementation::BindValuebufferCHROMIUM(GLenum target,
3276 GLuint valuebuffer) {
3277 GPU_CLIENT_SINGLE_THREAD_CHECK();
3278 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBindValuebufferCHROMIUM("
3279 << GLES2Util::GetStringValueBufferTarget(target) << ", "
3280 << valuebuffer << ")");
3281 if (IsValuebufferReservedId(valuebuffer)) {
3282 SetGLError(GL_INVALID_OPERATION, "BindValuebufferCHROMIUM",
3283 "valuebuffer reserved id");
3284 return;
3286 BindValuebufferCHROMIUMHelper(target, valuebuffer);
3287 CheckGLError();
3290 void GLES2Implementation::SubscribeValueCHROMIUM(GLenum target,
3291 GLenum subscription) {
3292 GPU_CLIENT_SINGLE_THREAD_CHECK();
3293 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glSubscribeValueCHROMIUM("
3294 << GLES2Util::GetStringValueBufferTarget(target) << ", "
3295 << GLES2Util::GetStringSubscriptionTarget(subscription)
3296 << ")");
3297 helper_->SubscribeValueCHROMIUM(target, subscription);
3298 CheckGLError();
3301 void GLES2Implementation::PopulateSubscribedValuesCHROMIUM(GLenum target) {
3302 GPU_CLIENT_SINGLE_THREAD_CHECK();
3303 GPU_CLIENT_LOG("[" << GetLogPrefix()
3304 << "] glPopulateSubscribedValuesCHROMIUM("
3305 << GLES2Util::GetStringValueBufferTarget(target) << ")");
3306 helper_->PopulateSubscribedValuesCHROMIUM(target);
3307 CheckGLError();
3310 void GLES2Implementation::UniformValuebufferCHROMIUM(GLint location,
3311 GLenum target,
3312 GLenum subscription) {
3313 GPU_CLIENT_SINGLE_THREAD_CHECK();
3314 GPU_CLIENT_LOG(
3315 "[" << GetLogPrefix() << "] glUniformValuebufferCHROMIUM(" << location
3316 << ", " << GLES2Util::GetStringValueBufferTarget(target) << ", "
3317 << GLES2Util::GetStringSubscriptionTarget(subscription) << ")");
3318 helper_->UniformValuebufferCHROMIUM(location, target, subscription);
3319 CheckGLError();
3322 void GLES2Implementation::BindTexImage2DCHROMIUM(GLenum target, GLint imageId) {
3323 GPU_CLIENT_SINGLE_THREAD_CHECK();
3324 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBindTexImage2DCHROMIUM("
3325 << GLES2Util::GetStringTextureBindTarget(target) << ", "
3326 << imageId << ")");
3327 helper_->BindTexImage2DCHROMIUM(target, imageId);
3328 CheckGLError();
3331 void GLES2Implementation::ReleaseTexImage2DCHROMIUM(GLenum target,
3332 GLint imageId) {
3333 GPU_CLIENT_SINGLE_THREAD_CHECK();
3334 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glReleaseTexImage2DCHROMIUM("
3335 << GLES2Util::GetStringTextureBindTarget(target) << ", "
3336 << imageId << ")");
3337 helper_->ReleaseTexImage2DCHROMIUM(target, imageId);
3338 CheckGLError();
3341 void GLES2Implementation::DiscardFramebufferEXT(GLenum target,
3342 GLsizei count,
3343 const GLenum* attachments) {
3344 GPU_CLIENT_SINGLE_THREAD_CHECK();
3345 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDiscardFramebufferEXT("
3346 << GLES2Util::GetStringEnum(target) << ", " << count
3347 << ", " << static_cast<const void*>(attachments) << ")");
3348 GPU_CLIENT_LOG_CODE_BLOCK({
3349 for (GLsizei i = 0; i < count; ++i) {
3350 GPU_CLIENT_LOG(" " << i << ": " << attachments[0 + i * 1]);
3353 if (count < 0) {
3354 SetGLError(GL_INVALID_VALUE, "glDiscardFramebufferEXT", "count < 0");
3355 return;
3357 helper_->DiscardFramebufferEXTImmediate(target, count, attachments);
3358 CheckGLError();
3361 void GLES2Implementation::LoseContextCHROMIUM(GLenum current, GLenum other) {
3362 GPU_CLIENT_SINGLE_THREAD_CHECK();
3363 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glLoseContextCHROMIUM("
3364 << GLES2Util::GetStringResetStatus(current) << ", "
3365 << GLES2Util::GetStringResetStatus(other) << ")");
3366 helper_->LoseContextCHROMIUM(current, other);
3367 CheckGLError();
3370 void GLES2Implementation::WaitSyncPointCHROMIUM(GLuint sync_point) {
3371 GPU_CLIENT_SINGLE_THREAD_CHECK();
3372 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glWaitSyncPointCHROMIUM("
3373 << sync_point << ")");
3374 helper_->WaitSyncPointCHROMIUM(sync_point);
3375 CheckGLError();
3378 void GLES2Implementation::DrawBuffersEXT(GLsizei count, const GLenum* bufs) {
3379 GPU_CLIENT_SINGLE_THREAD_CHECK();
3380 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDrawBuffersEXT(" << count << ", "
3381 << static_cast<const void*>(bufs) << ")");
3382 GPU_CLIENT_LOG_CODE_BLOCK({
3383 for (GLsizei i = 0; i < count; ++i) {
3384 GPU_CLIENT_LOG(" " << i << ": " << bufs[0 + i * 1]);
3387 if (count < 0) {
3388 SetGLError(GL_INVALID_VALUE, "glDrawBuffersEXT", "count < 0");
3389 return;
3391 helper_->DrawBuffersEXTImmediate(count, bufs);
3392 CheckGLError();
3395 void GLES2Implementation::DiscardBackbufferCHROMIUM() {
3396 GPU_CLIENT_SINGLE_THREAD_CHECK();
3397 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDiscardBackbufferCHROMIUM("
3398 << ")");
3399 helper_->DiscardBackbufferCHROMIUM();
3400 CheckGLError();
3403 void GLES2Implementation::ScheduleOverlayPlaneCHROMIUM(
3404 GLint plane_z_order,
3405 GLenum plane_transform,
3406 GLuint overlay_texture_id,
3407 GLint bounds_x,
3408 GLint bounds_y,
3409 GLint bounds_width,
3410 GLint bounds_height,
3411 GLfloat uv_x,
3412 GLfloat uv_y,
3413 GLfloat uv_width,
3414 GLfloat uv_height) {
3415 GPU_CLIENT_SINGLE_THREAD_CHECK();
3416 GPU_CLIENT_LOG(
3417 "[" << GetLogPrefix() << "] glScheduleOverlayPlaneCHROMIUM("
3418 << plane_z_order << ", " << GLES2Util::GetStringEnum(plane_transform)
3419 << ", " << overlay_texture_id << ", " << bounds_x << ", " << bounds_y
3420 << ", " << bounds_width << ", " << bounds_height << ", " << uv_x
3421 << ", " << uv_y << ", " << uv_width << ", " << uv_height << ")");
3422 helper_->ScheduleOverlayPlaneCHROMIUM(
3423 plane_z_order, plane_transform, overlay_texture_id, bounds_x, bounds_y,
3424 bounds_width, bounds_height, uv_x, uv_y, uv_width, uv_height);
3425 CheckGLError();
3428 void GLES2Implementation::MatrixLoadfCHROMIUM(GLenum matrixMode,
3429 const GLfloat* m) {
3430 GPU_CLIENT_SINGLE_THREAD_CHECK();
3431 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glMatrixLoadfCHROMIUM("
3432 << GLES2Util::GetStringMatrixMode(matrixMode) << ", "
3433 << static_cast<const void*>(m) << ")");
3434 size_t count = 16;
3435 for (size_t ii = 0; ii < count; ++ii)
3436 GPU_CLIENT_LOG("value[" << ii << "]: " << m[ii]);
3437 helper_->MatrixLoadfCHROMIUMImmediate(matrixMode, m);
3438 CheckGLError();
3441 void GLES2Implementation::MatrixLoadIdentityCHROMIUM(GLenum matrixMode) {
3442 GPU_CLIENT_SINGLE_THREAD_CHECK();
3443 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glMatrixLoadIdentityCHROMIUM("
3444 << GLES2Util::GetStringMatrixMode(matrixMode) << ")");
3445 helper_->MatrixLoadIdentityCHROMIUM(matrixMode);
3446 CheckGLError();
3449 void GLES2Implementation::BlendBarrierKHR() {
3450 GPU_CLIENT_SINGLE_THREAD_CHECK();
3451 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBlendBarrierKHR("
3452 << ")");
3453 helper_->BlendBarrierKHR();
3454 CheckGLError();
3457 #endif // GPU_COMMAND_BUFFER_CLIENT_GLES2_IMPLEMENTATION_IMPL_AUTOGEN_H_