Roll leveldb 3f7758:803d69 (v1.17 -> v1.18)
[chromium-blink-merge.git] / gpu / command_buffer / client / gles2_implementation_impl_autogen.h
blob8541e777423328292af595862b808c9e04b9562d
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 if (BindBufferHelper(target, buffer)) {
34 helper_->BindBuffer(target, buffer);
36 CheckGLError();
39 void GLES2Implementation::BindFramebuffer(GLenum target, GLuint framebuffer) {
40 GPU_CLIENT_SINGLE_THREAD_CHECK();
41 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBindFramebuffer("
42 << GLES2Util::GetStringFrameBufferTarget(target) << ", "
43 << framebuffer << ")");
44 if (IsFramebufferReservedId(framebuffer)) {
45 SetGLError(GL_INVALID_OPERATION, "BindFramebuffer",
46 "framebuffer reserved id");
47 return;
49 if (BindFramebufferHelper(target, framebuffer)) {
50 helper_->BindFramebuffer(target, framebuffer);
52 CheckGLError();
55 void GLES2Implementation::BindRenderbuffer(GLenum target, GLuint renderbuffer) {
56 GPU_CLIENT_SINGLE_THREAD_CHECK();
57 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBindRenderbuffer("
58 << GLES2Util::GetStringRenderBufferTarget(target) << ", "
59 << renderbuffer << ")");
60 if (IsRenderbufferReservedId(renderbuffer)) {
61 SetGLError(GL_INVALID_OPERATION, "BindRenderbuffer",
62 "renderbuffer reserved id");
63 return;
65 if (BindRenderbufferHelper(target, renderbuffer)) {
66 helper_->BindRenderbuffer(target, renderbuffer);
68 CheckGLError();
71 void GLES2Implementation::BindTexture(GLenum target, GLuint texture) {
72 GPU_CLIENT_SINGLE_THREAD_CHECK();
73 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBindTexture("
74 << GLES2Util::GetStringTextureBindTarget(target) << ", "
75 << texture << ")");
76 if (IsTextureReservedId(texture)) {
77 SetGLError(GL_INVALID_OPERATION, "BindTexture", "texture reserved id");
78 return;
80 if (BindTextureHelper(target, texture)) {
81 helper_->BindTexture(target, texture);
83 CheckGLError();
86 void GLES2Implementation::BlendColor(GLclampf red,
87 GLclampf green,
88 GLclampf blue,
89 GLclampf alpha) {
90 GPU_CLIENT_SINGLE_THREAD_CHECK();
91 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBlendColor(" << red << ", "
92 << green << ", " << blue << ", " << alpha << ")");
93 helper_->BlendColor(red, green, blue, alpha);
94 CheckGLError();
97 void GLES2Implementation::BlendEquation(GLenum mode) {
98 GPU_CLIENT_SINGLE_THREAD_CHECK();
99 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBlendEquation("
100 << GLES2Util::GetStringEquation(mode) << ")");
101 helper_->BlendEquation(mode);
102 CheckGLError();
105 void GLES2Implementation::BlendEquationSeparate(GLenum modeRGB,
106 GLenum modeAlpha) {
107 GPU_CLIENT_SINGLE_THREAD_CHECK();
108 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBlendEquationSeparate("
109 << GLES2Util::GetStringEquation(modeRGB) << ", "
110 << GLES2Util::GetStringEquation(modeAlpha) << ")");
111 helper_->BlendEquationSeparate(modeRGB, modeAlpha);
112 CheckGLError();
115 void GLES2Implementation::BlendFunc(GLenum sfactor, GLenum dfactor) {
116 GPU_CLIENT_SINGLE_THREAD_CHECK();
117 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBlendFunc("
118 << GLES2Util::GetStringSrcBlendFactor(sfactor) << ", "
119 << GLES2Util::GetStringDstBlendFactor(dfactor) << ")");
120 helper_->BlendFunc(sfactor, dfactor);
121 CheckGLError();
124 void GLES2Implementation::BlendFuncSeparate(GLenum srcRGB,
125 GLenum dstRGB,
126 GLenum srcAlpha,
127 GLenum dstAlpha) {
128 GPU_CLIENT_SINGLE_THREAD_CHECK();
129 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBlendFuncSeparate("
130 << GLES2Util::GetStringSrcBlendFactor(srcRGB) << ", "
131 << GLES2Util::GetStringDstBlendFactor(dstRGB) << ", "
132 << GLES2Util::GetStringSrcBlendFactor(srcAlpha) << ", "
133 << GLES2Util::GetStringDstBlendFactor(dstAlpha) << ")");
134 helper_->BlendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha);
135 CheckGLError();
138 GLenum GLES2Implementation::CheckFramebufferStatus(GLenum target) {
139 GPU_CLIENT_SINGLE_THREAD_CHECK();
140 TRACE_EVENT0("gpu", "GLES2Implementation::CheckFramebufferStatus");
141 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glCheckFramebufferStatus("
142 << GLES2Util::GetStringFrameBufferTarget(target) << ")");
143 typedef cmds::CheckFramebufferStatus::Result Result;
144 Result* result = GetResultAs<Result*>();
145 if (!result) {
146 return GL_FRAMEBUFFER_UNSUPPORTED;
148 *result = 0;
149 helper_->CheckFramebufferStatus(target, GetResultShmId(),
150 GetResultShmOffset());
151 WaitForCmd();
152 GLenum result_value = *result;
153 GPU_CLIENT_LOG("returned " << result_value);
154 CheckGLError();
155 return result_value;
158 void GLES2Implementation::Clear(GLbitfield mask) {
159 GPU_CLIENT_SINGLE_THREAD_CHECK();
160 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glClear(" << mask << ")");
161 helper_->Clear(mask);
162 CheckGLError();
165 void GLES2Implementation::ClearColor(GLclampf red,
166 GLclampf green,
167 GLclampf blue,
168 GLclampf alpha) {
169 GPU_CLIENT_SINGLE_THREAD_CHECK();
170 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glClearColor(" << red << ", "
171 << green << ", " << blue << ", " << alpha << ")");
172 helper_->ClearColor(red, green, blue, alpha);
173 CheckGLError();
176 void GLES2Implementation::ClearDepthf(GLclampf depth) {
177 GPU_CLIENT_SINGLE_THREAD_CHECK();
178 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glClearDepthf(" << depth << ")");
179 helper_->ClearDepthf(depth);
180 CheckGLError();
183 void GLES2Implementation::ClearStencil(GLint s) {
184 GPU_CLIENT_SINGLE_THREAD_CHECK();
185 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glClearStencil(" << s << ")");
186 helper_->ClearStencil(s);
187 CheckGLError();
190 void GLES2Implementation::ColorMask(GLboolean red,
191 GLboolean green,
192 GLboolean blue,
193 GLboolean alpha) {
194 GPU_CLIENT_SINGLE_THREAD_CHECK();
195 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glColorMask("
196 << GLES2Util::GetStringBool(red) << ", "
197 << GLES2Util::GetStringBool(green) << ", "
198 << GLES2Util::GetStringBool(blue) << ", "
199 << GLES2Util::GetStringBool(alpha) << ")");
200 helper_->ColorMask(red, green, blue, alpha);
201 CheckGLError();
204 void GLES2Implementation::CompileShader(GLuint shader) {
205 GPU_CLIENT_SINGLE_THREAD_CHECK();
206 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glCompileShader(" << shader
207 << ")");
208 helper_->CompileShader(shader);
209 CheckGLError();
212 void GLES2Implementation::CopyTexImage2D(GLenum target,
213 GLint level,
214 GLenum internalformat,
215 GLint x,
216 GLint y,
217 GLsizei width,
218 GLsizei height,
219 GLint border) {
220 GPU_CLIENT_SINGLE_THREAD_CHECK();
221 GPU_CLIENT_LOG(
222 "[" << GetLogPrefix() << "] glCopyTexImage2D("
223 << GLES2Util::GetStringTextureTarget(target) << ", " << level << ", "
224 << GLES2Util::GetStringTextureInternalFormat(internalformat) << ", "
225 << x << ", " << y << ", " << width << ", " << height << ", " << border
226 << ")");
227 if (width < 0) {
228 SetGLError(GL_INVALID_VALUE, "glCopyTexImage2D", "width < 0");
229 return;
231 if (height < 0) {
232 SetGLError(GL_INVALID_VALUE, "glCopyTexImage2D", "height < 0");
233 return;
235 if (border != 0) {
236 SetGLError(GL_INVALID_VALUE, "glCopyTexImage2D", "border GL_INVALID_VALUE");
237 return;
239 helper_->CopyTexImage2D(target, level, internalformat, x, y, width, height);
240 CheckGLError();
243 void GLES2Implementation::CopyTexSubImage2D(GLenum target,
244 GLint level,
245 GLint xoffset,
246 GLint yoffset,
247 GLint x,
248 GLint y,
249 GLsizei width,
250 GLsizei height) {
251 GPU_CLIENT_SINGLE_THREAD_CHECK();
252 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glCopyTexSubImage2D("
253 << GLES2Util::GetStringTextureTarget(target) << ", "
254 << level << ", " << xoffset << ", " << yoffset << ", " << x
255 << ", " << y << ", " << width << ", " << height << ")");
256 if (width < 0) {
257 SetGLError(GL_INVALID_VALUE, "glCopyTexSubImage2D", "width < 0");
258 return;
260 if (height < 0) {
261 SetGLError(GL_INVALID_VALUE, "glCopyTexSubImage2D", "height < 0");
262 return;
264 helper_->CopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width,
265 height);
266 CheckGLError();
269 GLuint GLES2Implementation::CreateProgram() {
270 GPU_CLIENT_SINGLE_THREAD_CHECK();
271 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glCreateProgram("
272 << ")");
273 GLuint client_id;
274 GetIdHandler(id_namespaces::kProgramsAndShaders)
275 ->MakeIds(this, 0, 1, &client_id);
276 helper_->CreateProgram(client_id);
277 GPU_CLIENT_LOG("returned " << client_id);
278 CheckGLError();
279 return client_id;
282 GLuint GLES2Implementation::CreateShader(GLenum type) {
283 GPU_CLIENT_SINGLE_THREAD_CHECK();
284 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glCreateShader("
285 << GLES2Util::GetStringShaderType(type) << ")");
286 GLuint client_id;
287 GetIdHandler(id_namespaces::kProgramsAndShaders)
288 ->MakeIds(this, 0, 1, &client_id);
289 helper_->CreateShader(type, client_id);
290 GPU_CLIENT_LOG("returned " << client_id);
291 CheckGLError();
292 return client_id;
295 void GLES2Implementation::CullFace(GLenum mode) {
296 GPU_CLIENT_SINGLE_THREAD_CHECK();
297 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glCullFace("
298 << GLES2Util::GetStringFaceType(mode) << ")");
299 helper_->CullFace(mode);
300 CheckGLError();
303 void GLES2Implementation::DeleteBuffers(GLsizei n, const GLuint* buffers) {
304 GPU_CLIENT_SINGLE_THREAD_CHECK();
305 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDeleteBuffers(" << n << ", "
306 << static_cast<const void*>(buffers) << ")");
307 GPU_CLIENT_LOG_CODE_BLOCK({
308 for (GLsizei i = 0; i < n; ++i) {
309 GPU_CLIENT_LOG(" " << i << ": " << buffers[i]);
312 GPU_CLIENT_DCHECK_CODE_BLOCK({
313 for (GLsizei i = 0; i < n; ++i) {
314 DCHECK(buffers[i] != 0);
317 if (n < 0) {
318 SetGLError(GL_INVALID_VALUE, "glDeleteBuffers", "n < 0");
319 return;
321 DeleteBuffersHelper(n, buffers);
322 CheckGLError();
325 void GLES2Implementation::DeleteFramebuffers(GLsizei n,
326 const GLuint* framebuffers) {
327 GPU_CLIENT_SINGLE_THREAD_CHECK();
328 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDeleteFramebuffers(" << n << ", "
329 << static_cast<const void*>(framebuffers) << ")");
330 GPU_CLIENT_LOG_CODE_BLOCK({
331 for (GLsizei i = 0; i < n; ++i) {
332 GPU_CLIENT_LOG(" " << i << ": " << framebuffers[i]);
335 GPU_CLIENT_DCHECK_CODE_BLOCK({
336 for (GLsizei i = 0; i < n; ++i) {
337 DCHECK(framebuffers[i] != 0);
340 if (n < 0) {
341 SetGLError(GL_INVALID_VALUE, "glDeleteFramebuffers", "n < 0");
342 return;
344 DeleteFramebuffersHelper(n, framebuffers);
345 CheckGLError();
348 void GLES2Implementation::DeleteProgram(GLuint program) {
349 GPU_CLIENT_SINGLE_THREAD_CHECK();
350 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDeleteProgram(" << program
351 << ")");
352 GPU_CLIENT_DCHECK(program != 0);
353 DeleteProgramHelper(program);
354 CheckGLError();
357 void GLES2Implementation::DeleteRenderbuffers(GLsizei n,
358 const GLuint* renderbuffers) {
359 GPU_CLIENT_SINGLE_THREAD_CHECK();
360 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDeleteRenderbuffers(" << n
361 << ", " << static_cast<const void*>(renderbuffers) << ")");
362 GPU_CLIENT_LOG_CODE_BLOCK({
363 for (GLsizei i = 0; i < n; ++i) {
364 GPU_CLIENT_LOG(" " << i << ": " << renderbuffers[i]);
367 GPU_CLIENT_DCHECK_CODE_BLOCK({
368 for (GLsizei i = 0; i < n; ++i) {
369 DCHECK(renderbuffers[i] != 0);
372 if (n < 0) {
373 SetGLError(GL_INVALID_VALUE, "glDeleteRenderbuffers", "n < 0");
374 return;
376 DeleteRenderbuffersHelper(n, renderbuffers);
377 CheckGLError();
380 void GLES2Implementation::DeleteShader(GLuint shader) {
381 GPU_CLIENT_SINGLE_THREAD_CHECK();
382 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDeleteShader(" << shader << ")");
383 GPU_CLIENT_DCHECK(shader != 0);
384 DeleteShaderHelper(shader);
385 CheckGLError();
388 void GLES2Implementation::DeleteTextures(GLsizei n, const GLuint* textures) {
389 GPU_CLIENT_SINGLE_THREAD_CHECK();
390 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDeleteTextures(" << n << ", "
391 << static_cast<const void*>(textures) << ")");
392 GPU_CLIENT_LOG_CODE_BLOCK({
393 for (GLsizei i = 0; i < n; ++i) {
394 GPU_CLIENT_LOG(" " << i << ": " << textures[i]);
397 GPU_CLIENT_DCHECK_CODE_BLOCK({
398 for (GLsizei i = 0; i < n; ++i) {
399 DCHECK(textures[i] != 0);
402 if (n < 0) {
403 SetGLError(GL_INVALID_VALUE, "glDeleteTextures", "n < 0");
404 return;
406 DeleteTexturesHelper(n, textures);
407 CheckGLError();
410 void GLES2Implementation::DepthFunc(GLenum func) {
411 GPU_CLIENT_SINGLE_THREAD_CHECK();
412 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDepthFunc("
413 << GLES2Util::GetStringCmpFunction(func) << ")");
414 helper_->DepthFunc(func);
415 CheckGLError();
418 void GLES2Implementation::DepthMask(GLboolean flag) {
419 GPU_CLIENT_SINGLE_THREAD_CHECK();
420 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDepthMask("
421 << GLES2Util::GetStringBool(flag) << ")");
422 helper_->DepthMask(flag);
423 CheckGLError();
426 void GLES2Implementation::DepthRangef(GLclampf zNear, GLclampf zFar) {
427 GPU_CLIENT_SINGLE_THREAD_CHECK();
428 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDepthRangef(" << zNear << ", "
429 << zFar << ")");
430 helper_->DepthRangef(zNear, zFar);
431 CheckGLError();
434 void GLES2Implementation::DetachShader(GLuint program, GLuint shader) {
435 GPU_CLIENT_SINGLE_THREAD_CHECK();
436 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDetachShader(" << program << ", "
437 << shader << ")");
438 helper_->DetachShader(program, shader);
439 CheckGLError();
442 void GLES2Implementation::FramebufferRenderbuffer(GLenum target,
443 GLenum attachment,
444 GLenum renderbuffertarget,
445 GLuint renderbuffer) {
446 GPU_CLIENT_SINGLE_THREAD_CHECK();
447 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glFramebufferRenderbuffer("
448 << GLES2Util::GetStringFrameBufferTarget(target) << ", "
449 << GLES2Util::GetStringAttachment(attachment) << ", "
450 << GLES2Util::GetStringRenderBufferTarget(
451 renderbuffertarget) << ", " << renderbuffer << ")");
452 helper_->FramebufferRenderbuffer(target, attachment, renderbuffertarget,
453 renderbuffer);
454 CheckGLError();
457 void GLES2Implementation::FramebufferTexture2D(GLenum target,
458 GLenum attachment,
459 GLenum textarget,
460 GLuint texture,
461 GLint level) {
462 GPU_CLIENT_SINGLE_THREAD_CHECK();
463 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glFramebufferTexture2D("
464 << GLES2Util::GetStringFrameBufferTarget(target) << ", "
465 << GLES2Util::GetStringAttachment(attachment) << ", "
466 << GLES2Util::GetStringTextureTarget(textarget) << ", "
467 << texture << ", " << level << ")");
468 if (level != 0) {
469 SetGLError(GL_INVALID_VALUE, "glFramebufferTexture2D",
470 "level GL_INVALID_VALUE");
471 return;
473 helper_->FramebufferTexture2D(target, attachment, textarget, texture);
474 CheckGLError();
477 void GLES2Implementation::FrontFace(GLenum mode) {
478 GPU_CLIENT_SINGLE_THREAD_CHECK();
479 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glFrontFace("
480 << GLES2Util::GetStringFaceMode(mode) << ")");
481 helper_->FrontFace(mode);
482 CheckGLError();
485 void GLES2Implementation::GenBuffers(GLsizei n, GLuint* buffers) {
486 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGenBuffers(" << n << ", "
487 << static_cast<const void*>(buffers) << ")");
488 if (n < 0) {
489 SetGLError(GL_INVALID_VALUE, "glGenBuffers", "n < 0");
490 return;
492 GPU_CLIENT_SINGLE_THREAD_CHECK();
493 GetIdHandler(id_namespaces::kBuffers)->MakeIds(this, 0, n, buffers);
494 GenBuffersHelper(n, buffers);
495 helper_->GenBuffersImmediate(n, buffers);
496 if (share_group_->bind_generates_resource())
497 helper_->CommandBufferHelper::Flush();
498 GPU_CLIENT_LOG_CODE_BLOCK({
499 for (GLsizei i = 0; i < n; ++i) {
500 GPU_CLIENT_LOG(" " << i << ": " << buffers[i]);
503 CheckGLError();
506 void GLES2Implementation::GenerateMipmap(GLenum target) {
507 GPU_CLIENT_SINGLE_THREAD_CHECK();
508 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGenerateMipmap("
509 << GLES2Util::GetStringTextureBindTarget(target) << ")");
510 helper_->GenerateMipmap(target);
511 CheckGLError();
514 void GLES2Implementation::GenFramebuffers(GLsizei n, GLuint* framebuffers) {
515 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGenFramebuffers(" << n << ", "
516 << static_cast<const void*>(framebuffers) << ")");
517 if (n < 0) {
518 SetGLError(GL_INVALID_VALUE, "glGenFramebuffers", "n < 0");
519 return;
521 GPU_CLIENT_SINGLE_THREAD_CHECK();
522 GetIdHandler(id_namespaces::kFramebuffers)->MakeIds(this, 0, n, framebuffers);
523 GenFramebuffersHelper(n, framebuffers);
524 helper_->GenFramebuffersImmediate(n, framebuffers);
525 if (share_group_->bind_generates_resource())
526 helper_->CommandBufferHelper::Flush();
527 GPU_CLIENT_LOG_CODE_BLOCK({
528 for (GLsizei i = 0; i < n; ++i) {
529 GPU_CLIENT_LOG(" " << i << ": " << framebuffers[i]);
532 CheckGLError();
535 void GLES2Implementation::GenRenderbuffers(GLsizei n, GLuint* renderbuffers) {
536 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGenRenderbuffers(" << n << ", "
537 << static_cast<const void*>(renderbuffers) << ")");
538 if (n < 0) {
539 SetGLError(GL_INVALID_VALUE, "glGenRenderbuffers", "n < 0");
540 return;
542 GPU_CLIENT_SINGLE_THREAD_CHECK();
543 GetIdHandler(id_namespaces::kRenderbuffers)
544 ->MakeIds(this, 0, n, renderbuffers);
545 GenRenderbuffersHelper(n, renderbuffers);
546 helper_->GenRenderbuffersImmediate(n, renderbuffers);
547 if (share_group_->bind_generates_resource())
548 helper_->CommandBufferHelper::Flush();
549 GPU_CLIENT_LOG_CODE_BLOCK({
550 for (GLsizei i = 0; i < n; ++i) {
551 GPU_CLIENT_LOG(" " << i << ": " << renderbuffers[i]);
554 CheckGLError();
557 void GLES2Implementation::GenTextures(GLsizei n, GLuint* textures) {
558 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGenTextures(" << n << ", "
559 << static_cast<const void*>(textures) << ")");
560 if (n < 0) {
561 SetGLError(GL_INVALID_VALUE, "glGenTextures", "n < 0");
562 return;
564 GPU_CLIENT_SINGLE_THREAD_CHECK();
565 GetIdHandler(id_namespaces::kTextures)->MakeIds(this, 0, n, textures);
566 GenTexturesHelper(n, textures);
567 helper_->GenTexturesImmediate(n, textures);
568 if (share_group_->bind_generates_resource())
569 helper_->CommandBufferHelper::Flush();
570 GPU_CLIENT_LOG_CODE_BLOCK({
571 for (GLsizei i = 0; i < n; ++i) {
572 GPU_CLIENT_LOG(" " << i << ": " << textures[i]);
575 CheckGLError();
578 void GLES2Implementation::GetBooleanv(GLenum pname, GLboolean* params) {
579 GPU_CLIENT_SINGLE_THREAD_CHECK();
580 GPU_CLIENT_VALIDATE_DESTINATION_INITALIZATION(GLboolean, params);
581 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetBooleanv("
582 << GLES2Util::GetStringGLState(pname) << ", "
583 << static_cast<const void*>(params) << ")");
584 TRACE_EVENT0("gpu", "GLES2Implementation::GetBooleanv");
585 if (GetBooleanvHelper(pname, params)) {
586 return;
588 typedef cmds::GetBooleanv::Result Result;
589 Result* result = GetResultAs<Result*>();
590 if (!result) {
591 return;
593 result->SetNumResults(0);
594 helper_->GetBooleanv(pname, GetResultShmId(), GetResultShmOffset());
595 WaitForCmd();
596 result->CopyResult(params);
597 GPU_CLIENT_LOG_CODE_BLOCK({
598 for (int32_t i = 0; i < result->GetNumResults(); ++i) {
599 GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]);
602 CheckGLError();
604 void GLES2Implementation::GetBufferParameteriv(GLenum target,
605 GLenum pname,
606 GLint* params) {
607 GPU_CLIENT_SINGLE_THREAD_CHECK();
608 GPU_CLIENT_VALIDATE_DESTINATION_INITALIZATION(GLint, params);
609 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetBufferParameteriv("
610 << GLES2Util::GetStringBufferTarget(target) << ", "
611 << GLES2Util::GetStringBufferParameter(pname) << ", "
612 << static_cast<const void*>(params) << ")");
613 TRACE_EVENT0("gpu", "GLES2Implementation::GetBufferParameteriv");
614 if (GetBufferParameterivHelper(target, pname, params)) {
615 return;
617 typedef cmds::GetBufferParameteriv::Result Result;
618 Result* result = GetResultAs<Result*>();
619 if (!result) {
620 return;
622 result->SetNumResults(0);
623 helper_->GetBufferParameteriv(target, pname, GetResultShmId(),
624 GetResultShmOffset());
625 WaitForCmd();
626 result->CopyResult(params);
627 GPU_CLIENT_LOG_CODE_BLOCK({
628 for (int32_t i = 0; i < result->GetNumResults(); ++i) {
629 GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]);
632 CheckGLError();
634 void GLES2Implementation::GetFloatv(GLenum pname, GLfloat* params) {
635 GPU_CLIENT_SINGLE_THREAD_CHECK();
636 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetFloatv("
637 << GLES2Util::GetStringGLState(pname) << ", "
638 << static_cast<const void*>(params) << ")");
639 TRACE_EVENT0("gpu", "GLES2Implementation::GetFloatv");
640 if (GetFloatvHelper(pname, params)) {
641 return;
643 typedef cmds::GetFloatv::Result Result;
644 Result* result = GetResultAs<Result*>();
645 if (!result) {
646 return;
648 result->SetNumResults(0);
649 helper_->GetFloatv(pname, GetResultShmId(), GetResultShmOffset());
650 WaitForCmd();
651 result->CopyResult(params);
652 GPU_CLIENT_LOG_CODE_BLOCK({
653 for (int32_t i = 0; i < result->GetNumResults(); ++i) {
654 GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]);
657 CheckGLError();
659 void GLES2Implementation::GetFramebufferAttachmentParameteriv(GLenum target,
660 GLenum attachment,
661 GLenum pname,
662 GLint* params) {
663 GPU_CLIENT_SINGLE_THREAD_CHECK();
664 GPU_CLIENT_VALIDATE_DESTINATION_INITALIZATION(GLint, params);
665 GPU_CLIENT_LOG("[" << GetLogPrefix()
666 << "] glGetFramebufferAttachmentParameteriv("
667 << GLES2Util::GetStringFrameBufferTarget(target) << ", "
668 << GLES2Util::GetStringAttachment(attachment) << ", "
669 << GLES2Util::GetStringFrameBufferParameter(pname) << ", "
670 << static_cast<const void*>(params) << ")");
671 TRACE_EVENT0("gpu",
672 "GLES2Implementation::GetFramebufferAttachmentParameteriv");
673 if (GetFramebufferAttachmentParameterivHelper(target, attachment, pname,
674 params)) {
675 return;
677 typedef cmds::GetFramebufferAttachmentParameteriv::Result Result;
678 Result* result = GetResultAs<Result*>();
679 if (!result) {
680 return;
682 result->SetNumResults(0);
683 helper_->GetFramebufferAttachmentParameteriv(
684 target, attachment, pname, GetResultShmId(), GetResultShmOffset());
685 WaitForCmd();
686 result->CopyResult(params);
687 GPU_CLIENT_LOG_CODE_BLOCK({
688 for (int32_t i = 0; i < result->GetNumResults(); ++i) {
689 GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]);
692 CheckGLError();
694 void GLES2Implementation::GetIntegerv(GLenum pname, GLint* params) {
695 GPU_CLIENT_SINGLE_THREAD_CHECK();
696 GPU_CLIENT_VALIDATE_DESTINATION_INITALIZATION(GLint, params);
697 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetIntegerv("
698 << GLES2Util::GetStringGLState(pname) << ", "
699 << static_cast<const void*>(params) << ")");
700 TRACE_EVENT0("gpu", "GLES2Implementation::GetIntegerv");
701 if (GetIntegervHelper(pname, params)) {
702 return;
704 typedef cmds::GetIntegerv::Result Result;
705 Result* result = GetResultAs<Result*>();
706 if (!result) {
707 return;
709 result->SetNumResults(0);
710 helper_->GetIntegerv(pname, GetResultShmId(), GetResultShmOffset());
711 WaitForCmd();
712 result->CopyResult(params);
713 GPU_CLIENT_LOG_CODE_BLOCK({
714 for (int32_t i = 0; i < result->GetNumResults(); ++i) {
715 GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]);
718 CheckGLError();
720 void GLES2Implementation::GetProgramiv(GLuint program,
721 GLenum pname,
722 GLint* params) {
723 GPU_CLIENT_SINGLE_THREAD_CHECK();
724 GPU_CLIENT_VALIDATE_DESTINATION_INITALIZATION(GLint, params);
725 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetProgramiv(" << program << ", "
726 << GLES2Util::GetStringProgramParameter(pname) << ", "
727 << static_cast<const void*>(params) << ")");
728 TRACE_EVENT0("gpu", "GLES2Implementation::GetProgramiv");
729 if (GetProgramivHelper(program, pname, params)) {
730 return;
732 typedef cmds::GetProgramiv::Result Result;
733 Result* result = GetResultAs<Result*>();
734 if (!result) {
735 return;
737 result->SetNumResults(0);
738 helper_->GetProgramiv(program, pname, GetResultShmId(), GetResultShmOffset());
739 WaitForCmd();
740 result->CopyResult(params);
741 GPU_CLIENT_LOG_CODE_BLOCK({
742 for (int32_t i = 0; i < result->GetNumResults(); ++i) {
743 GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]);
746 CheckGLError();
748 void GLES2Implementation::GetProgramInfoLog(GLuint program,
749 GLsizei bufsize,
750 GLsizei* length,
751 char* infolog) {
752 GPU_CLIENT_SINGLE_THREAD_CHECK();
753 GPU_CLIENT_VALIDATE_DESTINATION_OPTIONAL_INITALIZATION(GLsizei, length);
754 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetProgramInfoLog"
755 << "(" << program << ", " << bufsize << ", "
756 << static_cast<void*>(length) << ", "
757 << static_cast<void*>(infolog) << ")");
758 helper_->SetBucketSize(kResultBucketId, 0);
759 helper_->GetProgramInfoLog(program, kResultBucketId);
760 std::string str;
761 GLsizei max_size = 0;
762 if (GetBucketAsString(kResultBucketId, &str)) {
763 if (bufsize > 0) {
764 max_size = std::min(static_cast<size_t>(bufsize) - 1, str.size());
765 memcpy(infolog, str.c_str(), max_size);
766 infolog[max_size] = '\0';
767 GPU_CLIENT_LOG("------\n" << infolog << "\n------");
770 if (length != NULL) {
771 *length = max_size;
773 CheckGLError();
775 void GLES2Implementation::GetRenderbufferParameteriv(GLenum target,
776 GLenum pname,
777 GLint* params) {
778 GPU_CLIENT_SINGLE_THREAD_CHECK();
779 GPU_CLIENT_VALIDATE_DESTINATION_INITALIZATION(GLint, params);
780 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetRenderbufferParameteriv("
781 << GLES2Util::GetStringRenderBufferTarget(target) << ", "
782 << GLES2Util::GetStringRenderBufferParameter(pname) << ", "
783 << static_cast<const void*>(params) << ")");
784 TRACE_EVENT0("gpu", "GLES2Implementation::GetRenderbufferParameteriv");
785 if (GetRenderbufferParameterivHelper(target, pname, params)) {
786 return;
788 typedef cmds::GetRenderbufferParameteriv::Result Result;
789 Result* result = GetResultAs<Result*>();
790 if (!result) {
791 return;
793 result->SetNumResults(0);
794 helper_->GetRenderbufferParameteriv(target, pname, GetResultShmId(),
795 GetResultShmOffset());
796 WaitForCmd();
797 result->CopyResult(params);
798 GPU_CLIENT_LOG_CODE_BLOCK({
799 for (int32_t i = 0; i < result->GetNumResults(); ++i) {
800 GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]);
803 CheckGLError();
805 void GLES2Implementation::GetShaderiv(GLuint shader,
806 GLenum pname,
807 GLint* params) {
808 GPU_CLIENT_SINGLE_THREAD_CHECK();
809 GPU_CLIENT_VALIDATE_DESTINATION_INITALIZATION(GLint, params);
810 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetShaderiv(" << shader << ", "
811 << GLES2Util::GetStringShaderParameter(pname) << ", "
812 << static_cast<const void*>(params) << ")");
813 TRACE_EVENT0("gpu", "GLES2Implementation::GetShaderiv");
814 if (GetShaderivHelper(shader, pname, params)) {
815 return;
817 typedef cmds::GetShaderiv::Result Result;
818 Result* result = GetResultAs<Result*>();
819 if (!result) {
820 return;
822 result->SetNumResults(0);
823 helper_->GetShaderiv(shader, pname, GetResultShmId(), GetResultShmOffset());
824 WaitForCmd();
825 result->CopyResult(params);
826 GPU_CLIENT_LOG_CODE_BLOCK({
827 for (int32_t i = 0; i < result->GetNumResults(); ++i) {
828 GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]);
831 CheckGLError();
833 void GLES2Implementation::GetShaderInfoLog(GLuint shader,
834 GLsizei bufsize,
835 GLsizei* length,
836 char* infolog) {
837 GPU_CLIENT_SINGLE_THREAD_CHECK();
838 GPU_CLIENT_VALIDATE_DESTINATION_OPTIONAL_INITALIZATION(GLsizei, length);
839 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetShaderInfoLog"
840 << "(" << shader << ", " << bufsize << ", "
841 << static_cast<void*>(length) << ", "
842 << static_cast<void*>(infolog) << ")");
843 helper_->SetBucketSize(kResultBucketId, 0);
844 helper_->GetShaderInfoLog(shader, kResultBucketId);
845 std::string str;
846 GLsizei max_size = 0;
847 if (GetBucketAsString(kResultBucketId, &str)) {
848 if (bufsize > 0) {
849 max_size = std::min(static_cast<size_t>(bufsize) - 1, str.size());
850 memcpy(infolog, str.c_str(), max_size);
851 infolog[max_size] = '\0';
852 GPU_CLIENT_LOG("------\n" << infolog << "\n------");
855 if (length != NULL) {
856 *length = max_size;
858 CheckGLError();
860 void GLES2Implementation::GetShaderSource(GLuint shader,
861 GLsizei bufsize,
862 GLsizei* length,
863 char* source) {
864 GPU_CLIENT_SINGLE_THREAD_CHECK();
865 GPU_CLIENT_VALIDATE_DESTINATION_OPTIONAL_INITALIZATION(GLsizei, length);
866 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetShaderSource"
867 << "(" << shader << ", " << bufsize << ", "
868 << static_cast<void*>(length) << ", "
869 << static_cast<void*>(source) << ")");
870 helper_->SetBucketSize(kResultBucketId, 0);
871 helper_->GetShaderSource(shader, kResultBucketId);
872 std::string str;
873 GLsizei max_size = 0;
874 if (GetBucketAsString(kResultBucketId, &str)) {
875 if (bufsize > 0) {
876 max_size = std::min(static_cast<size_t>(bufsize) - 1, str.size());
877 memcpy(source, str.c_str(), max_size);
878 source[max_size] = '\0';
879 GPU_CLIENT_LOG("------\n" << source << "\n------");
882 if (length != NULL) {
883 *length = max_size;
885 CheckGLError();
887 void GLES2Implementation::GetTexParameterfv(GLenum target,
888 GLenum pname,
889 GLfloat* params) {
890 GPU_CLIENT_SINGLE_THREAD_CHECK();
891 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetTexParameterfv("
892 << GLES2Util::GetStringGetTexParamTarget(target) << ", "
893 << GLES2Util::GetStringTextureParameter(pname) << ", "
894 << static_cast<const void*>(params) << ")");
895 TRACE_EVENT0("gpu", "GLES2Implementation::GetTexParameterfv");
896 if (GetTexParameterfvHelper(target, pname, params)) {
897 return;
899 typedef cmds::GetTexParameterfv::Result Result;
900 Result* result = GetResultAs<Result*>();
901 if (!result) {
902 return;
904 result->SetNumResults(0);
905 helper_->GetTexParameterfv(target, pname, GetResultShmId(),
906 GetResultShmOffset());
907 WaitForCmd();
908 result->CopyResult(params);
909 GPU_CLIENT_LOG_CODE_BLOCK({
910 for (int32_t i = 0; i < result->GetNumResults(); ++i) {
911 GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]);
914 CheckGLError();
916 void GLES2Implementation::GetTexParameteriv(GLenum target,
917 GLenum pname,
918 GLint* params) {
919 GPU_CLIENT_SINGLE_THREAD_CHECK();
920 GPU_CLIENT_VALIDATE_DESTINATION_INITALIZATION(GLint, params);
921 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetTexParameteriv("
922 << GLES2Util::GetStringGetTexParamTarget(target) << ", "
923 << GLES2Util::GetStringTextureParameter(pname) << ", "
924 << static_cast<const void*>(params) << ")");
925 TRACE_EVENT0("gpu", "GLES2Implementation::GetTexParameteriv");
926 if (GetTexParameterivHelper(target, pname, params)) {
927 return;
929 typedef cmds::GetTexParameteriv::Result Result;
930 Result* result = GetResultAs<Result*>();
931 if (!result) {
932 return;
934 result->SetNumResults(0);
935 helper_->GetTexParameteriv(target, pname, GetResultShmId(),
936 GetResultShmOffset());
937 WaitForCmd();
938 result->CopyResult(params);
939 GPU_CLIENT_LOG_CODE_BLOCK({
940 for (int32_t i = 0; i < result->GetNumResults(); ++i) {
941 GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]);
944 CheckGLError();
946 void GLES2Implementation::Hint(GLenum target, GLenum mode) {
947 GPU_CLIENT_SINGLE_THREAD_CHECK();
948 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glHint("
949 << GLES2Util::GetStringHintTarget(target) << ", "
950 << GLES2Util::GetStringHintMode(mode) << ")");
951 helper_->Hint(target, mode);
952 CheckGLError();
955 GLboolean GLES2Implementation::IsBuffer(GLuint buffer) {
956 GPU_CLIENT_SINGLE_THREAD_CHECK();
957 TRACE_EVENT0("gpu", "GLES2Implementation::IsBuffer");
958 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glIsBuffer(" << buffer << ")");
959 typedef cmds::IsBuffer::Result Result;
960 Result* result = GetResultAs<Result*>();
961 if (!result) {
962 return GL_FALSE;
964 *result = 0;
965 helper_->IsBuffer(buffer, GetResultShmId(), GetResultShmOffset());
966 WaitForCmd();
967 GLboolean result_value = *result != 0;
968 GPU_CLIENT_LOG("returned " << result_value);
969 CheckGLError();
970 return result_value;
973 GLboolean GLES2Implementation::IsFramebuffer(GLuint framebuffer) {
974 GPU_CLIENT_SINGLE_THREAD_CHECK();
975 TRACE_EVENT0("gpu", "GLES2Implementation::IsFramebuffer");
976 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glIsFramebuffer(" << framebuffer
977 << ")");
978 typedef cmds::IsFramebuffer::Result Result;
979 Result* result = GetResultAs<Result*>();
980 if (!result) {
981 return GL_FALSE;
983 *result = 0;
984 helper_->IsFramebuffer(framebuffer, GetResultShmId(), GetResultShmOffset());
985 WaitForCmd();
986 GLboolean result_value = *result != 0;
987 GPU_CLIENT_LOG("returned " << result_value);
988 CheckGLError();
989 return result_value;
992 GLboolean GLES2Implementation::IsProgram(GLuint program) {
993 GPU_CLIENT_SINGLE_THREAD_CHECK();
994 TRACE_EVENT0("gpu", "GLES2Implementation::IsProgram");
995 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glIsProgram(" << program << ")");
996 typedef cmds::IsProgram::Result Result;
997 Result* result = GetResultAs<Result*>();
998 if (!result) {
999 return GL_FALSE;
1001 *result = 0;
1002 helper_->IsProgram(program, GetResultShmId(), GetResultShmOffset());
1003 WaitForCmd();
1004 GLboolean result_value = *result != 0;
1005 GPU_CLIENT_LOG("returned " << result_value);
1006 CheckGLError();
1007 return result_value;
1010 GLboolean GLES2Implementation::IsRenderbuffer(GLuint renderbuffer) {
1011 GPU_CLIENT_SINGLE_THREAD_CHECK();
1012 TRACE_EVENT0("gpu", "GLES2Implementation::IsRenderbuffer");
1013 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glIsRenderbuffer(" << renderbuffer
1014 << ")");
1015 typedef cmds::IsRenderbuffer::Result Result;
1016 Result* result = GetResultAs<Result*>();
1017 if (!result) {
1018 return GL_FALSE;
1020 *result = 0;
1021 helper_->IsRenderbuffer(renderbuffer, GetResultShmId(), GetResultShmOffset());
1022 WaitForCmd();
1023 GLboolean result_value = *result != 0;
1024 GPU_CLIENT_LOG("returned " << result_value);
1025 CheckGLError();
1026 return result_value;
1029 GLboolean GLES2Implementation::IsShader(GLuint shader) {
1030 GPU_CLIENT_SINGLE_THREAD_CHECK();
1031 TRACE_EVENT0("gpu", "GLES2Implementation::IsShader");
1032 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glIsShader(" << shader << ")");
1033 typedef cmds::IsShader::Result Result;
1034 Result* result = GetResultAs<Result*>();
1035 if (!result) {
1036 return GL_FALSE;
1038 *result = 0;
1039 helper_->IsShader(shader, GetResultShmId(), GetResultShmOffset());
1040 WaitForCmd();
1041 GLboolean result_value = *result != 0;
1042 GPU_CLIENT_LOG("returned " << result_value);
1043 CheckGLError();
1044 return result_value;
1047 GLboolean GLES2Implementation::IsTexture(GLuint texture) {
1048 GPU_CLIENT_SINGLE_THREAD_CHECK();
1049 TRACE_EVENT0("gpu", "GLES2Implementation::IsTexture");
1050 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glIsTexture(" << texture << ")");
1051 typedef cmds::IsTexture::Result Result;
1052 Result* result = GetResultAs<Result*>();
1053 if (!result) {
1054 return GL_FALSE;
1056 *result = 0;
1057 helper_->IsTexture(texture, GetResultShmId(), GetResultShmOffset());
1058 WaitForCmd();
1059 GLboolean result_value = *result != 0;
1060 GPU_CLIENT_LOG("returned " << result_value);
1061 CheckGLError();
1062 return result_value;
1065 void GLES2Implementation::LineWidth(GLfloat width) {
1066 GPU_CLIENT_SINGLE_THREAD_CHECK();
1067 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glLineWidth(" << width << ")");
1068 helper_->LineWidth(width);
1069 CheckGLError();
1072 void GLES2Implementation::PolygonOffset(GLfloat factor, GLfloat units) {
1073 GPU_CLIENT_SINGLE_THREAD_CHECK();
1074 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glPolygonOffset(" << factor << ", "
1075 << units << ")");
1076 helper_->PolygonOffset(factor, units);
1077 CheckGLError();
1080 void GLES2Implementation::ReleaseShaderCompiler() {
1081 GPU_CLIENT_SINGLE_THREAD_CHECK();
1082 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glReleaseShaderCompiler("
1083 << ")");
1084 helper_->ReleaseShaderCompiler();
1085 CheckGLError();
1088 void GLES2Implementation::RenderbufferStorage(GLenum target,
1089 GLenum internalformat,
1090 GLsizei width,
1091 GLsizei height) {
1092 GPU_CLIENT_SINGLE_THREAD_CHECK();
1093 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glRenderbufferStorage("
1094 << GLES2Util::GetStringRenderBufferTarget(target) << ", "
1095 << GLES2Util::GetStringRenderBufferFormat(internalformat)
1096 << ", " << width << ", " << height << ")");
1097 if (width < 0) {
1098 SetGLError(GL_INVALID_VALUE, "glRenderbufferStorage", "width < 0");
1099 return;
1101 if (height < 0) {
1102 SetGLError(GL_INVALID_VALUE, "glRenderbufferStorage", "height < 0");
1103 return;
1105 helper_->RenderbufferStorage(target, internalformat, width, height);
1106 CheckGLError();
1109 void GLES2Implementation::SampleCoverage(GLclampf value, GLboolean invert) {
1110 GPU_CLIENT_SINGLE_THREAD_CHECK();
1111 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glSampleCoverage(" << value << ", "
1112 << GLES2Util::GetStringBool(invert) << ")");
1113 helper_->SampleCoverage(value, invert);
1114 CheckGLError();
1117 void GLES2Implementation::Scissor(GLint x,
1118 GLint y,
1119 GLsizei width,
1120 GLsizei height) {
1121 GPU_CLIENT_SINGLE_THREAD_CHECK();
1122 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glScissor(" << x << ", " << y
1123 << ", " << width << ", " << height << ")");
1124 if (width < 0) {
1125 SetGLError(GL_INVALID_VALUE, "glScissor", "width < 0");
1126 return;
1128 if (height < 0) {
1129 SetGLError(GL_INVALID_VALUE, "glScissor", "height < 0");
1130 return;
1132 helper_->Scissor(x, y, width, height);
1133 CheckGLError();
1136 void GLES2Implementation::StencilFunc(GLenum func, GLint ref, GLuint mask) {
1137 GPU_CLIENT_SINGLE_THREAD_CHECK();
1138 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glStencilFunc("
1139 << GLES2Util::GetStringCmpFunction(func) << ", " << ref
1140 << ", " << mask << ")");
1141 helper_->StencilFunc(func, ref, mask);
1142 CheckGLError();
1145 void GLES2Implementation::StencilFuncSeparate(GLenum face,
1146 GLenum func,
1147 GLint ref,
1148 GLuint mask) {
1149 GPU_CLIENT_SINGLE_THREAD_CHECK();
1150 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glStencilFuncSeparate("
1151 << GLES2Util::GetStringFaceType(face) << ", "
1152 << GLES2Util::GetStringCmpFunction(func) << ", " << ref
1153 << ", " << mask << ")");
1154 helper_->StencilFuncSeparate(face, func, ref, mask);
1155 CheckGLError();
1158 void GLES2Implementation::StencilMask(GLuint mask) {
1159 GPU_CLIENT_SINGLE_THREAD_CHECK();
1160 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glStencilMask(" << mask << ")");
1161 helper_->StencilMask(mask);
1162 CheckGLError();
1165 void GLES2Implementation::StencilMaskSeparate(GLenum face, GLuint mask) {
1166 GPU_CLIENT_SINGLE_THREAD_CHECK();
1167 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glStencilMaskSeparate("
1168 << GLES2Util::GetStringFaceType(face) << ", " << mask
1169 << ")");
1170 helper_->StencilMaskSeparate(face, mask);
1171 CheckGLError();
1174 void GLES2Implementation::StencilOp(GLenum fail, GLenum zfail, GLenum zpass) {
1175 GPU_CLIENT_SINGLE_THREAD_CHECK();
1176 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glStencilOp("
1177 << GLES2Util::GetStringStencilOp(fail) << ", "
1178 << GLES2Util::GetStringStencilOp(zfail) << ", "
1179 << GLES2Util::GetStringStencilOp(zpass) << ")");
1180 helper_->StencilOp(fail, zfail, zpass);
1181 CheckGLError();
1184 void GLES2Implementation::StencilOpSeparate(GLenum face,
1185 GLenum fail,
1186 GLenum zfail,
1187 GLenum zpass) {
1188 GPU_CLIENT_SINGLE_THREAD_CHECK();
1189 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glStencilOpSeparate("
1190 << GLES2Util::GetStringFaceType(face) << ", "
1191 << GLES2Util::GetStringStencilOp(fail) << ", "
1192 << GLES2Util::GetStringStencilOp(zfail) << ", "
1193 << GLES2Util::GetStringStencilOp(zpass) << ")");
1194 helper_->StencilOpSeparate(face, fail, zfail, zpass);
1195 CheckGLError();
1198 void GLES2Implementation::TexParameterf(GLenum target,
1199 GLenum pname,
1200 GLfloat param) {
1201 GPU_CLIENT_SINGLE_THREAD_CHECK();
1202 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glTexParameterf("
1203 << GLES2Util::GetStringTextureBindTarget(target) << ", "
1204 << GLES2Util::GetStringTextureParameter(pname) << ", "
1205 << param << ")");
1206 helper_->TexParameterf(target, pname, param);
1207 CheckGLError();
1210 void GLES2Implementation::TexParameterfv(GLenum target,
1211 GLenum pname,
1212 const GLfloat* params) {
1213 GPU_CLIENT_SINGLE_THREAD_CHECK();
1214 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glTexParameterfv("
1215 << GLES2Util::GetStringTextureBindTarget(target) << ", "
1216 << GLES2Util::GetStringTextureParameter(pname) << ", "
1217 << static_cast<const void*>(params) << ")");
1218 GPU_CLIENT_LOG("values: " << params[0]);
1219 helper_->TexParameterfvImmediate(target, pname, params);
1220 CheckGLError();
1223 void GLES2Implementation::TexParameteri(GLenum target,
1224 GLenum pname,
1225 GLint param) {
1226 GPU_CLIENT_SINGLE_THREAD_CHECK();
1227 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glTexParameteri("
1228 << GLES2Util::GetStringTextureBindTarget(target) << ", "
1229 << GLES2Util::GetStringTextureParameter(pname) << ", "
1230 << param << ")");
1231 helper_->TexParameteri(target, pname, param);
1232 CheckGLError();
1235 void GLES2Implementation::TexParameteriv(GLenum target,
1236 GLenum pname,
1237 const GLint* params) {
1238 GPU_CLIENT_SINGLE_THREAD_CHECK();
1239 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glTexParameteriv("
1240 << GLES2Util::GetStringTextureBindTarget(target) << ", "
1241 << GLES2Util::GetStringTextureParameter(pname) << ", "
1242 << static_cast<const void*>(params) << ")");
1243 GPU_CLIENT_LOG("values: " << params[0]);
1244 helper_->TexParameterivImmediate(target, pname, params);
1245 CheckGLError();
1248 void GLES2Implementation::Uniform1f(GLint location, GLfloat x) {
1249 GPU_CLIENT_SINGLE_THREAD_CHECK();
1250 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform1f(" << location << ", "
1251 << x << ")");
1252 helper_->Uniform1f(location, x);
1253 CheckGLError();
1256 void GLES2Implementation::Uniform1fv(GLint location,
1257 GLsizei count,
1258 const GLfloat* v) {
1259 GPU_CLIENT_SINGLE_THREAD_CHECK();
1260 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform1fv(" << location << ", "
1261 << count << ", " << static_cast<const void*>(v) << ")");
1262 GPU_CLIENT_LOG_CODE_BLOCK({
1263 for (GLsizei i = 0; i < count; ++i) {
1264 GPU_CLIENT_LOG(" " << i << ": " << v[0 + i * 1]);
1267 if (count < 0) {
1268 SetGLError(GL_INVALID_VALUE, "glUniform1fv", "count < 0");
1269 return;
1271 helper_->Uniform1fvImmediate(location, count, v);
1272 CheckGLError();
1275 void GLES2Implementation::Uniform1i(GLint location, GLint x) {
1276 GPU_CLIENT_SINGLE_THREAD_CHECK();
1277 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform1i(" << location << ", "
1278 << x << ")");
1279 helper_->Uniform1i(location, x);
1280 CheckGLError();
1283 void GLES2Implementation::Uniform1iv(GLint location,
1284 GLsizei count,
1285 const GLint* v) {
1286 GPU_CLIENT_SINGLE_THREAD_CHECK();
1287 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform1iv(" << location << ", "
1288 << count << ", " << static_cast<const void*>(v) << ")");
1289 GPU_CLIENT_LOG_CODE_BLOCK({
1290 for (GLsizei i = 0; i < count; ++i) {
1291 GPU_CLIENT_LOG(" " << i << ": " << v[0 + i * 1]);
1294 if (count < 0) {
1295 SetGLError(GL_INVALID_VALUE, "glUniform1iv", "count < 0");
1296 return;
1298 helper_->Uniform1ivImmediate(location, count, v);
1299 CheckGLError();
1302 void GLES2Implementation::Uniform2f(GLint location, GLfloat x, GLfloat y) {
1303 GPU_CLIENT_SINGLE_THREAD_CHECK();
1304 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform2f(" << location << ", "
1305 << x << ", " << y << ")");
1306 helper_->Uniform2f(location, x, y);
1307 CheckGLError();
1310 void GLES2Implementation::Uniform2fv(GLint location,
1311 GLsizei count,
1312 const GLfloat* v) {
1313 GPU_CLIENT_SINGLE_THREAD_CHECK();
1314 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform2fv(" << location << ", "
1315 << count << ", " << static_cast<const void*>(v) << ")");
1316 GPU_CLIENT_LOG_CODE_BLOCK({
1317 for (GLsizei i = 0; i < count; ++i) {
1318 GPU_CLIENT_LOG(" " << i << ": " << v[0 + i * 2] << ", " << v[1 + i * 2]);
1321 if (count < 0) {
1322 SetGLError(GL_INVALID_VALUE, "glUniform2fv", "count < 0");
1323 return;
1325 helper_->Uniform2fvImmediate(location, count, v);
1326 CheckGLError();
1329 void GLES2Implementation::Uniform2i(GLint location, GLint x, GLint y) {
1330 GPU_CLIENT_SINGLE_THREAD_CHECK();
1331 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform2i(" << location << ", "
1332 << x << ", " << y << ")");
1333 helper_->Uniform2i(location, x, y);
1334 CheckGLError();
1337 void GLES2Implementation::Uniform2iv(GLint location,
1338 GLsizei count,
1339 const GLint* v) {
1340 GPU_CLIENT_SINGLE_THREAD_CHECK();
1341 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform2iv(" << location << ", "
1342 << count << ", " << static_cast<const void*>(v) << ")");
1343 GPU_CLIENT_LOG_CODE_BLOCK({
1344 for (GLsizei i = 0; i < count; ++i) {
1345 GPU_CLIENT_LOG(" " << i << ": " << v[0 + i * 2] << ", " << v[1 + i * 2]);
1348 if (count < 0) {
1349 SetGLError(GL_INVALID_VALUE, "glUniform2iv", "count < 0");
1350 return;
1352 helper_->Uniform2ivImmediate(location, count, v);
1353 CheckGLError();
1356 void GLES2Implementation::Uniform3f(GLint location,
1357 GLfloat x,
1358 GLfloat y,
1359 GLfloat z) {
1360 GPU_CLIENT_SINGLE_THREAD_CHECK();
1361 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform3f(" << location << ", "
1362 << x << ", " << y << ", " << z << ")");
1363 helper_->Uniform3f(location, x, y, z);
1364 CheckGLError();
1367 void GLES2Implementation::Uniform3fv(GLint location,
1368 GLsizei count,
1369 const GLfloat* v) {
1370 GPU_CLIENT_SINGLE_THREAD_CHECK();
1371 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform3fv(" << location << ", "
1372 << count << ", " << static_cast<const void*>(v) << ")");
1373 GPU_CLIENT_LOG_CODE_BLOCK({
1374 for (GLsizei i = 0; i < count; ++i) {
1375 GPU_CLIENT_LOG(" " << i << ": " << v[0 + i * 3] << ", " << v[1 + i * 3]
1376 << ", " << v[2 + i * 3]);
1379 if (count < 0) {
1380 SetGLError(GL_INVALID_VALUE, "glUniform3fv", "count < 0");
1381 return;
1383 helper_->Uniform3fvImmediate(location, count, v);
1384 CheckGLError();
1387 void GLES2Implementation::Uniform3i(GLint location, GLint x, GLint y, GLint z) {
1388 GPU_CLIENT_SINGLE_THREAD_CHECK();
1389 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform3i(" << location << ", "
1390 << x << ", " << y << ", " << z << ")");
1391 helper_->Uniform3i(location, x, y, z);
1392 CheckGLError();
1395 void GLES2Implementation::Uniform3iv(GLint location,
1396 GLsizei count,
1397 const GLint* v) {
1398 GPU_CLIENT_SINGLE_THREAD_CHECK();
1399 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform3iv(" << location << ", "
1400 << count << ", " << static_cast<const void*>(v) << ")");
1401 GPU_CLIENT_LOG_CODE_BLOCK({
1402 for (GLsizei i = 0; i < count; ++i) {
1403 GPU_CLIENT_LOG(" " << i << ": " << v[0 + i * 3] << ", " << v[1 + i * 3]
1404 << ", " << v[2 + i * 3]);
1407 if (count < 0) {
1408 SetGLError(GL_INVALID_VALUE, "glUniform3iv", "count < 0");
1409 return;
1411 helper_->Uniform3ivImmediate(location, count, v);
1412 CheckGLError();
1415 void GLES2Implementation::Uniform4f(GLint location,
1416 GLfloat x,
1417 GLfloat y,
1418 GLfloat z,
1419 GLfloat w) {
1420 GPU_CLIENT_SINGLE_THREAD_CHECK();
1421 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform4f(" << location << ", "
1422 << x << ", " << y << ", " << z << ", " << w << ")");
1423 helper_->Uniform4f(location, x, y, z, w);
1424 CheckGLError();
1427 void GLES2Implementation::Uniform4fv(GLint location,
1428 GLsizei count,
1429 const GLfloat* v) {
1430 GPU_CLIENT_SINGLE_THREAD_CHECK();
1431 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform4fv(" << location << ", "
1432 << count << ", " << static_cast<const void*>(v) << ")");
1433 GPU_CLIENT_LOG_CODE_BLOCK({
1434 for (GLsizei i = 0; i < count; ++i) {
1435 GPU_CLIENT_LOG(" " << i << ": " << v[0 + i * 4] << ", " << v[1 + i * 4]
1436 << ", " << v[2 + i * 4] << ", " << v[3 + i * 4]);
1439 if (count < 0) {
1440 SetGLError(GL_INVALID_VALUE, "glUniform4fv", "count < 0");
1441 return;
1443 helper_->Uniform4fvImmediate(location, count, v);
1444 CheckGLError();
1447 void GLES2Implementation::Uniform4i(GLint location,
1448 GLint x,
1449 GLint y,
1450 GLint z,
1451 GLint w) {
1452 GPU_CLIENT_SINGLE_THREAD_CHECK();
1453 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform4i(" << location << ", "
1454 << x << ", " << y << ", " << z << ", " << w << ")");
1455 helper_->Uniform4i(location, x, y, z, w);
1456 CheckGLError();
1459 void GLES2Implementation::Uniform4iv(GLint location,
1460 GLsizei count,
1461 const GLint* v) {
1462 GPU_CLIENT_SINGLE_THREAD_CHECK();
1463 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform4iv(" << location << ", "
1464 << count << ", " << static_cast<const void*>(v) << ")");
1465 GPU_CLIENT_LOG_CODE_BLOCK({
1466 for (GLsizei i = 0; i < count; ++i) {
1467 GPU_CLIENT_LOG(" " << i << ": " << v[0 + i * 4] << ", " << v[1 + i * 4]
1468 << ", " << v[2 + i * 4] << ", " << v[3 + i * 4]);
1471 if (count < 0) {
1472 SetGLError(GL_INVALID_VALUE, "glUniform4iv", "count < 0");
1473 return;
1475 helper_->Uniform4ivImmediate(location, count, v);
1476 CheckGLError();
1479 void GLES2Implementation::UniformMatrix2fv(GLint location,
1480 GLsizei count,
1481 GLboolean transpose,
1482 const GLfloat* value) {
1483 GPU_CLIENT_SINGLE_THREAD_CHECK();
1484 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniformMatrix2fv(" << location
1485 << ", " << count << ", "
1486 << GLES2Util::GetStringBool(transpose) << ", "
1487 << static_cast<const void*>(value) << ")");
1488 GPU_CLIENT_LOG_CODE_BLOCK({
1489 for (GLsizei i = 0; i < count; ++i) {
1490 GPU_CLIENT_LOG(" " << i << ": " << value[0 + i * 4] << ", "
1491 << value[1 + i * 4] << ", " << value[2 + i * 4]
1492 << ", " << value[3 + i * 4]);
1495 if (count < 0) {
1496 SetGLError(GL_INVALID_VALUE, "glUniformMatrix2fv", "count < 0");
1497 return;
1499 if (transpose != false) {
1500 SetGLError(GL_INVALID_VALUE, "glUniformMatrix2fv",
1501 "transpose GL_INVALID_VALUE");
1502 return;
1504 helper_->UniformMatrix2fvImmediate(location, count, value);
1505 CheckGLError();
1508 void GLES2Implementation::UniformMatrix3fv(GLint location,
1509 GLsizei count,
1510 GLboolean transpose,
1511 const GLfloat* value) {
1512 GPU_CLIENT_SINGLE_THREAD_CHECK();
1513 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniformMatrix3fv(" << location
1514 << ", " << count << ", "
1515 << GLES2Util::GetStringBool(transpose) << ", "
1516 << static_cast<const void*>(value) << ")");
1517 GPU_CLIENT_LOG_CODE_BLOCK({
1518 for (GLsizei i = 0; i < count; ++i) {
1519 GPU_CLIENT_LOG(" " << i << ": " << value[0 + i * 9] << ", "
1520 << value[1 + i * 9] << ", " << value[2 + i * 9]
1521 << ", " << value[3 + i * 9] << ", "
1522 << value[4 + i * 9] << ", " << value[5 + i * 9]
1523 << ", " << value[6 + i * 9] << ", "
1524 << value[7 + i * 9] << ", " << value[8 + i * 9]);
1527 if (count < 0) {
1528 SetGLError(GL_INVALID_VALUE, "glUniformMatrix3fv", "count < 0");
1529 return;
1531 if (transpose != false) {
1532 SetGLError(GL_INVALID_VALUE, "glUniformMatrix3fv",
1533 "transpose GL_INVALID_VALUE");
1534 return;
1536 helper_->UniformMatrix3fvImmediate(location, count, value);
1537 CheckGLError();
1540 void GLES2Implementation::UniformMatrix4fv(GLint location,
1541 GLsizei count,
1542 GLboolean transpose,
1543 const GLfloat* value) {
1544 GPU_CLIENT_SINGLE_THREAD_CHECK();
1545 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniformMatrix4fv(" << location
1546 << ", " << count << ", "
1547 << GLES2Util::GetStringBool(transpose) << ", "
1548 << static_cast<const void*>(value) << ")");
1549 GPU_CLIENT_LOG_CODE_BLOCK({
1550 for (GLsizei i = 0; i < count; ++i) {
1551 GPU_CLIENT_LOG(
1552 " " << i << ": " << value[0 + i * 16] << ", " << value[1 + i * 16]
1553 << ", " << value[2 + i * 16] << ", " << value[3 + i * 16] << ", "
1554 << value[4 + i * 16] << ", " << value[5 + i * 16] << ", "
1555 << value[6 + i * 16] << ", " << value[7 + i * 16] << ", "
1556 << value[8 + i * 16] << ", " << value[9 + i * 16] << ", "
1557 << value[10 + i * 16] << ", " << value[11 + i * 16] << ", "
1558 << value[12 + i * 16] << ", " << value[13 + i * 16] << ", "
1559 << value[14 + i * 16] << ", " << value[15 + i * 16]);
1562 if (count < 0) {
1563 SetGLError(GL_INVALID_VALUE, "glUniformMatrix4fv", "count < 0");
1564 return;
1566 if (transpose != false) {
1567 SetGLError(GL_INVALID_VALUE, "glUniformMatrix4fv",
1568 "transpose GL_INVALID_VALUE");
1569 return;
1571 helper_->UniformMatrix4fvImmediate(location, count, value);
1572 CheckGLError();
1575 void GLES2Implementation::UseProgram(GLuint program) {
1576 GPU_CLIENT_SINGLE_THREAD_CHECK();
1577 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUseProgram(" << program << ")");
1578 if (IsProgramReservedId(program)) {
1579 SetGLError(GL_INVALID_OPERATION, "UseProgram", "program reserved id");
1580 return;
1582 if (UseProgramHelper(program)) {
1583 helper_->UseProgram(program);
1585 CheckGLError();
1588 void GLES2Implementation::ValidateProgram(GLuint program) {
1589 GPU_CLIENT_SINGLE_THREAD_CHECK();
1590 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glValidateProgram(" << program
1591 << ")");
1592 helper_->ValidateProgram(program);
1593 CheckGLError();
1596 void GLES2Implementation::VertexAttrib1f(GLuint indx, GLfloat x) {
1597 GPU_CLIENT_SINGLE_THREAD_CHECK();
1598 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glVertexAttrib1f(" << indx << ", "
1599 << x << ")");
1600 helper_->VertexAttrib1f(indx, x);
1601 CheckGLError();
1604 void GLES2Implementation::VertexAttrib1fv(GLuint indx, const GLfloat* values) {
1605 GPU_CLIENT_SINGLE_THREAD_CHECK();
1606 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glVertexAttrib1fv(" << indx << ", "
1607 << static_cast<const void*>(values) << ")");
1608 GPU_CLIENT_LOG("values: " << values[0]);
1609 helper_->VertexAttrib1fvImmediate(indx, values);
1610 CheckGLError();
1613 void GLES2Implementation::VertexAttrib2f(GLuint indx, GLfloat x, GLfloat y) {
1614 GPU_CLIENT_SINGLE_THREAD_CHECK();
1615 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glVertexAttrib2f(" << indx << ", "
1616 << x << ", " << y << ")");
1617 helper_->VertexAttrib2f(indx, x, y);
1618 CheckGLError();
1621 void GLES2Implementation::VertexAttrib2fv(GLuint indx, const GLfloat* values) {
1622 GPU_CLIENT_SINGLE_THREAD_CHECK();
1623 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glVertexAttrib2fv(" << indx << ", "
1624 << static_cast<const void*>(values) << ")");
1625 GPU_CLIENT_LOG("values: " << values[0] << ", " << values[1]);
1626 helper_->VertexAttrib2fvImmediate(indx, values);
1627 CheckGLError();
1630 void GLES2Implementation::VertexAttrib3f(GLuint indx,
1631 GLfloat x,
1632 GLfloat y,
1633 GLfloat z) {
1634 GPU_CLIENT_SINGLE_THREAD_CHECK();
1635 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glVertexAttrib3f(" << indx << ", "
1636 << x << ", " << y << ", " << z << ")");
1637 helper_->VertexAttrib3f(indx, x, y, z);
1638 CheckGLError();
1641 void GLES2Implementation::VertexAttrib3fv(GLuint indx, const GLfloat* values) {
1642 GPU_CLIENT_SINGLE_THREAD_CHECK();
1643 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glVertexAttrib3fv(" << indx << ", "
1644 << static_cast<const void*>(values) << ")");
1645 GPU_CLIENT_LOG("values: " << values[0] << ", " << values[1] << ", "
1646 << values[2]);
1647 helper_->VertexAttrib3fvImmediate(indx, values);
1648 CheckGLError();
1651 void GLES2Implementation::VertexAttrib4f(GLuint indx,
1652 GLfloat x,
1653 GLfloat y,
1654 GLfloat z,
1655 GLfloat w) {
1656 GPU_CLIENT_SINGLE_THREAD_CHECK();
1657 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glVertexAttrib4f(" << indx << ", "
1658 << x << ", " << y << ", " << z << ", " << w << ")");
1659 helper_->VertexAttrib4f(indx, x, y, z, w);
1660 CheckGLError();
1663 void GLES2Implementation::VertexAttrib4fv(GLuint indx, const GLfloat* values) {
1664 GPU_CLIENT_SINGLE_THREAD_CHECK();
1665 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glVertexAttrib4fv(" << indx << ", "
1666 << static_cast<const void*>(values) << ")");
1667 GPU_CLIENT_LOG("values: " << values[0] << ", " << values[1] << ", "
1668 << values[2] << ", " << values[3]);
1669 helper_->VertexAttrib4fvImmediate(indx, values);
1670 CheckGLError();
1673 void GLES2Implementation::Viewport(GLint x,
1674 GLint y,
1675 GLsizei width,
1676 GLsizei height) {
1677 GPU_CLIENT_SINGLE_THREAD_CHECK();
1678 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glViewport(" << x << ", " << y
1679 << ", " << width << ", " << height << ")");
1680 if (width < 0) {
1681 SetGLError(GL_INVALID_VALUE, "glViewport", "width < 0");
1682 return;
1684 if (height < 0) {
1685 SetGLError(GL_INVALID_VALUE, "glViewport", "height < 0");
1686 return;
1688 helper_->Viewport(x, y, width, height);
1689 CheckGLError();
1692 void GLES2Implementation::BlitFramebufferCHROMIUM(GLint srcX0,
1693 GLint srcY0,
1694 GLint srcX1,
1695 GLint srcY1,
1696 GLint dstX0,
1697 GLint dstY0,
1698 GLint dstX1,
1699 GLint dstY1,
1700 GLbitfield mask,
1701 GLenum filter) {
1702 GPU_CLIENT_SINGLE_THREAD_CHECK();
1703 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBlitFramebufferCHROMIUM("
1704 << srcX0 << ", " << srcY0 << ", " << srcX1 << ", " << srcY1
1705 << ", " << dstX0 << ", " << dstY0 << ", " << dstX1 << ", "
1706 << dstY1 << ", " << mask << ", "
1707 << GLES2Util::GetStringBlitFilter(filter) << ")");
1708 helper_->BlitFramebufferCHROMIUM(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0,
1709 dstX1, dstY1, mask, filter);
1710 CheckGLError();
1713 void GLES2Implementation::RenderbufferStorageMultisampleCHROMIUM(
1714 GLenum target,
1715 GLsizei samples,
1716 GLenum internalformat,
1717 GLsizei width,
1718 GLsizei height) {
1719 GPU_CLIENT_SINGLE_THREAD_CHECK();
1720 GPU_CLIENT_LOG(
1721 "[" << GetLogPrefix() << "] glRenderbufferStorageMultisampleCHROMIUM("
1722 << GLES2Util::GetStringRenderBufferTarget(target) << ", " << samples
1723 << ", " << GLES2Util::GetStringRenderBufferFormat(internalformat)
1724 << ", " << width << ", " << height << ")");
1725 if (samples < 0) {
1726 SetGLError(GL_INVALID_VALUE, "glRenderbufferStorageMultisampleCHROMIUM",
1727 "samples < 0");
1728 return;
1730 if (width < 0) {
1731 SetGLError(GL_INVALID_VALUE, "glRenderbufferStorageMultisampleCHROMIUM",
1732 "width < 0");
1733 return;
1735 if (height < 0) {
1736 SetGLError(GL_INVALID_VALUE, "glRenderbufferStorageMultisampleCHROMIUM",
1737 "height < 0");
1738 return;
1740 helper_->RenderbufferStorageMultisampleCHROMIUM(
1741 target, samples, internalformat, width, height);
1742 CheckGLError();
1745 void GLES2Implementation::RenderbufferStorageMultisampleEXT(
1746 GLenum target,
1747 GLsizei samples,
1748 GLenum internalformat,
1749 GLsizei width,
1750 GLsizei height) {
1751 GPU_CLIENT_SINGLE_THREAD_CHECK();
1752 GPU_CLIENT_LOG(
1753 "[" << GetLogPrefix() << "] glRenderbufferStorageMultisampleEXT("
1754 << GLES2Util::GetStringRenderBufferTarget(target) << ", " << samples
1755 << ", " << GLES2Util::GetStringRenderBufferFormat(internalformat)
1756 << ", " << width << ", " << height << ")");
1757 if (samples < 0) {
1758 SetGLError(GL_INVALID_VALUE, "glRenderbufferStorageMultisampleEXT",
1759 "samples < 0");
1760 return;
1762 if (width < 0) {
1763 SetGLError(GL_INVALID_VALUE, "glRenderbufferStorageMultisampleEXT",
1764 "width < 0");
1765 return;
1767 if (height < 0) {
1768 SetGLError(GL_INVALID_VALUE, "glRenderbufferStorageMultisampleEXT",
1769 "height < 0");
1770 return;
1772 helper_->RenderbufferStorageMultisampleEXT(target, samples, internalformat,
1773 width, height);
1774 CheckGLError();
1777 void GLES2Implementation::FramebufferTexture2DMultisampleEXT(GLenum target,
1778 GLenum attachment,
1779 GLenum textarget,
1780 GLuint texture,
1781 GLint level,
1782 GLsizei samples) {
1783 GPU_CLIENT_SINGLE_THREAD_CHECK();
1784 GPU_CLIENT_LOG("[" << GetLogPrefix()
1785 << "] glFramebufferTexture2DMultisampleEXT("
1786 << GLES2Util::GetStringFrameBufferTarget(target) << ", "
1787 << GLES2Util::GetStringAttachment(attachment) << ", "
1788 << GLES2Util::GetStringTextureTarget(textarget) << ", "
1789 << texture << ", " << level << ", " << samples << ")");
1790 if (level != 0) {
1791 SetGLError(GL_INVALID_VALUE, "glFramebufferTexture2DMultisampleEXT",
1792 "level GL_INVALID_VALUE");
1793 return;
1795 if (samples < 0) {
1796 SetGLError(GL_INVALID_VALUE, "glFramebufferTexture2DMultisampleEXT",
1797 "samples < 0");
1798 return;
1800 helper_->FramebufferTexture2DMultisampleEXT(target, attachment, textarget,
1801 texture, samples);
1802 CheckGLError();
1805 void GLES2Implementation::TexStorage2DEXT(GLenum target,
1806 GLsizei levels,
1807 GLenum internalFormat,
1808 GLsizei width,
1809 GLsizei height) {
1810 GPU_CLIENT_SINGLE_THREAD_CHECK();
1811 GPU_CLIENT_LOG(
1812 "[" << GetLogPrefix() << "] glTexStorage2DEXT("
1813 << GLES2Util::GetStringTextureTarget(target) << ", " << levels << ", "
1814 << GLES2Util::GetStringTextureInternalFormatStorage(internalFormat)
1815 << ", " << width << ", " << height << ")");
1816 if (levels < 0) {
1817 SetGLError(GL_INVALID_VALUE, "glTexStorage2DEXT", "levels < 0");
1818 return;
1820 if (width < 0) {
1821 SetGLError(GL_INVALID_VALUE, "glTexStorage2DEXT", "width < 0");
1822 return;
1824 if (height < 0) {
1825 SetGLError(GL_INVALID_VALUE, "glTexStorage2DEXT", "height < 0");
1826 return;
1828 helper_->TexStorage2DEXT(target, levels, internalFormat, width, height);
1829 CheckGLError();
1832 void GLES2Implementation::GenQueriesEXT(GLsizei n, GLuint* queries) {
1833 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGenQueriesEXT(" << n << ", "
1834 << static_cast<const void*>(queries) << ")");
1835 if (n < 0) {
1836 SetGLError(GL_INVALID_VALUE, "glGenQueriesEXT", "n < 0");
1837 return;
1839 GPU_CLIENT_SINGLE_THREAD_CHECK();
1840 IdAllocator* id_allocator = GetIdAllocator(id_namespaces::kQueries);
1841 for (GLsizei ii = 0; ii < n; ++ii)
1842 queries[ii] = id_allocator->AllocateID();
1843 GenQueriesEXTHelper(n, queries);
1844 helper_->GenQueriesEXTImmediate(n, queries);
1845 if (share_group_->bind_generates_resource())
1846 helper_->CommandBufferHelper::Flush();
1847 GPU_CLIENT_LOG_CODE_BLOCK({
1848 for (GLsizei i = 0; i < n; ++i) {
1849 GPU_CLIENT_LOG(" " << i << ": " << queries[i]);
1852 CheckGLError();
1855 void GLES2Implementation::DeleteQueriesEXT(GLsizei n, const GLuint* queries) {
1856 GPU_CLIENT_SINGLE_THREAD_CHECK();
1857 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDeleteQueriesEXT(" << n << ", "
1858 << static_cast<const void*>(queries) << ")");
1859 GPU_CLIENT_LOG_CODE_BLOCK({
1860 for (GLsizei i = 0; i < n; ++i) {
1861 GPU_CLIENT_LOG(" " << i << ": " << queries[i]);
1864 GPU_CLIENT_DCHECK_CODE_BLOCK({
1865 for (GLsizei i = 0; i < n; ++i) {
1866 DCHECK(queries[i] != 0);
1869 if (n < 0) {
1870 SetGLError(GL_INVALID_VALUE, "glDeleteQueriesEXT", "n < 0");
1871 return;
1873 DeleteQueriesEXTHelper(n, queries);
1874 CheckGLError();
1877 void GLES2Implementation::GenVertexArraysOES(GLsizei n, GLuint* arrays) {
1878 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGenVertexArraysOES(" << n << ", "
1879 << static_cast<const void*>(arrays) << ")");
1880 if (n < 0) {
1881 SetGLError(GL_INVALID_VALUE, "glGenVertexArraysOES", "n < 0");
1882 return;
1884 GPU_CLIENT_SINGLE_THREAD_CHECK();
1885 GetIdHandler(id_namespaces::kVertexArrays)->MakeIds(this, 0, n, arrays);
1886 GenVertexArraysOESHelper(n, arrays);
1887 helper_->GenVertexArraysOESImmediate(n, arrays);
1888 if (share_group_->bind_generates_resource())
1889 helper_->CommandBufferHelper::Flush();
1890 GPU_CLIENT_LOG_CODE_BLOCK({
1891 for (GLsizei i = 0; i < n; ++i) {
1892 GPU_CLIENT_LOG(" " << i << ": " << arrays[i]);
1895 CheckGLError();
1898 void GLES2Implementation::DeleteVertexArraysOES(GLsizei n,
1899 const GLuint* arrays) {
1900 GPU_CLIENT_SINGLE_THREAD_CHECK();
1901 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDeleteVertexArraysOES(" << n
1902 << ", " << static_cast<const void*>(arrays) << ")");
1903 GPU_CLIENT_LOG_CODE_BLOCK({
1904 for (GLsizei i = 0; i < n; ++i) {
1905 GPU_CLIENT_LOG(" " << i << ": " << arrays[i]);
1908 GPU_CLIENT_DCHECK_CODE_BLOCK({
1909 for (GLsizei i = 0; i < n; ++i) {
1910 DCHECK(arrays[i] != 0);
1913 if (n < 0) {
1914 SetGLError(GL_INVALID_VALUE, "glDeleteVertexArraysOES", "n < 0");
1915 return;
1917 DeleteVertexArraysOESHelper(n, arrays);
1918 CheckGLError();
1921 GLboolean GLES2Implementation::IsVertexArrayOES(GLuint array) {
1922 GPU_CLIENT_SINGLE_THREAD_CHECK();
1923 TRACE_EVENT0("gpu", "GLES2Implementation::IsVertexArrayOES");
1924 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glIsVertexArrayOES(" << array
1925 << ")");
1926 typedef cmds::IsVertexArrayOES::Result Result;
1927 Result* result = GetResultAs<Result*>();
1928 if (!result) {
1929 return GL_FALSE;
1931 *result = 0;
1932 helper_->IsVertexArrayOES(array, GetResultShmId(), GetResultShmOffset());
1933 WaitForCmd();
1934 GLboolean result_value = *result != 0;
1935 GPU_CLIENT_LOG("returned " << result_value);
1936 CheckGLError();
1937 return result_value;
1940 void GLES2Implementation::BindVertexArrayOES(GLuint array) {
1941 GPU_CLIENT_SINGLE_THREAD_CHECK();
1942 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBindVertexArrayOES(" << array
1943 << ")");
1944 if (IsVertexArrayReservedId(array)) {
1945 SetGLError(GL_INVALID_OPERATION, "BindVertexArrayOES", "array reserved id");
1946 return;
1948 if (BindVertexArrayOESHelper(array)) {
1949 helper_->BindVertexArrayOES(array);
1951 CheckGLError();
1954 void GLES2Implementation::GetTranslatedShaderSourceANGLE(GLuint shader,
1955 GLsizei bufsize,
1956 GLsizei* length,
1957 char* source) {
1958 GPU_CLIENT_SINGLE_THREAD_CHECK();
1959 GPU_CLIENT_VALIDATE_DESTINATION_OPTIONAL_INITALIZATION(GLsizei, length);
1960 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetTranslatedShaderSourceANGLE"
1961 << "(" << shader << ", " << bufsize << ", "
1962 << static_cast<void*>(length) << ", "
1963 << static_cast<void*>(source) << ")");
1964 helper_->SetBucketSize(kResultBucketId, 0);
1965 helper_->GetTranslatedShaderSourceANGLE(shader, kResultBucketId);
1966 std::string str;
1967 GLsizei max_size = 0;
1968 if (GetBucketAsString(kResultBucketId, &str)) {
1969 if (bufsize > 0) {
1970 max_size = std::min(static_cast<size_t>(bufsize) - 1, str.size());
1971 memcpy(source, str.c_str(), max_size);
1972 source[max_size] = '\0';
1973 GPU_CLIENT_LOG("------\n" << source << "\n------");
1976 if (length != NULL) {
1977 *length = max_size;
1979 CheckGLError();
1981 void GLES2Implementation::TexImageIOSurface2DCHROMIUM(GLenum target,
1982 GLsizei width,
1983 GLsizei height,
1984 GLuint ioSurfaceId,
1985 GLuint plane) {
1986 GPU_CLIENT_SINGLE_THREAD_CHECK();
1987 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glTexImageIOSurface2DCHROMIUM("
1988 << GLES2Util::GetStringTextureBindTarget(target) << ", "
1989 << width << ", " << height << ", " << ioSurfaceId << ", "
1990 << plane << ")");
1991 if (width < 0) {
1992 SetGLError(GL_INVALID_VALUE, "glTexImageIOSurface2DCHROMIUM", "width < 0");
1993 return;
1995 if (height < 0) {
1996 SetGLError(GL_INVALID_VALUE, "glTexImageIOSurface2DCHROMIUM", "height < 0");
1997 return;
1999 helper_->TexImageIOSurface2DCHROMIUM(target, width, height, ioSurfaceId,
2000 plane);
2001 CheckGLError();
2004 void GLES2Implementation::CopyTextureCHROMIUM(GLenum target,
2005 GLenum source_id,
2006 GLenum dest_id,
2007 GLint level,
2008 GLint internalformat,
2009 GLenum dest_type) {
2010 GPU_CLIENT_SINGLE_THREAD_CHECK();
2011 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glCopyTextureCHROMIUM("
2012 << GLES2Util::GetStringEnum(target) << ", "
2013 << GLES2Util::GetStringEnum(source_id) << ", "
2014 << GLES2Util::GetStringEnum(dest_id) << ", " << level
2015 << ", " << internalformat << ", "
2016 << GLES2Util::GetStringPixelType(dest_type) << ")");
2017 helper_->CopyTextureCHROMIUM(target, source_id, dest_id, level,
2018 internalformat, dest_type);
2019 CheckGLError();
2022 void GLES2Implementation::GenValuebuffersCHROMIUM(GLsizei n, GLuint* buffers) {
2023 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGenValuebuffersCHROMIUM(" << n
2024 << ", " << static_cast<const void*>(buffers) << ")");
2025 if (n < 0) {
2026 SetGLError(GL_INVALID_VALUE, "glGenValuebuffersCHROMIUM", "n < 0");
2027 return;
2029 GPU_CLIENT_SINGLE_THREAD_CHECK();
2030 GetIdHandler(id_namespaces::kValuebuffers)->MakeIds(this, 0, n, buffers);
2031 GenValuebuffersCHROMIUMHelper(n, buffers);
2032 helper_->GenValuebuffersCHROMIUMImmediate(n, buffers);
2033 if (share_group_->bind_generates_resource())
2034 helper_->CommandBufferHelper::Flush();
2035 GPU_CLIENT_LOG_CODE_BLOCK({
2036 for (GLsizei i = 0; i < n; ++i) {
2037 GPU_CLIENT_LOG(" " << i << ": " << buffers[i]);
2040 CheckGLError();
2043 void GLES2Implementation::DeleteValuebuffersCHROMIUM(
2044 GLsizei n,
2045 const GLuint* valuebuffers) {
2046 GPU_CLIENT_SINGLE_THREAD_CHECK();
2047 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDeleteValuebuffersCHROMIUM(" << n
2048 << ", " << static_cast<const void*>(valuebuffers) << ")");
2049 GPU_CLIENT_LOG_CODE_BLOCK({
2050 for (GLsizei i = 0; i < n; ++i) {
2051 GPU_CLIENT_LOG(" " << i << ": " << valuebuffers[i]);
2054 GPU_CLIENT_DCHECK_CODE_BLOCK({
2055 for (GLsizei i = 0; i < n; ++i) {
2056 DCHECK(valuebuffers[i] != 0);
2059 if (n < 0) {
2060 SetGLError(GL_INVALID_VALUE, "glDeleteValuebuffersCHROMIUM", "n < 0");
2061 return;
2063 DeleteValuebuffersCHROMIUMHelper(n, valuebuffers);
2064 CheckGLError();
2067 GLboolean GLES2Implementation::IsValuebufferCHROMIUM(GLuint valuebuffer) {
2068 GPU_CLIENT_SINGLE_THREAD_CHECK();
2069 TRACE_EVENT0("gpu", "GLES2Implementation::IsValuebufferCHROMIUM");
2070 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glIsValuebufferCHROMIUM("
2071 << valuebuffer << ")");
2072 typedef cmds::IsValuebufferCHROMIUM::Result Result;
2073 Result* result = GetResultAs<Result*>();
2074 if (!result) {
2075 return GL_FALSE;
2077 *result = 0;
2078 helper_->IsValuebufferCHROMIUM(valuebuffer, GetResultShmId(),
2079 GetResultShmOffset());
2080 WaitForCmd();
2081 GLboolean result_value = *result != 0;
2082 GPU_CLIENT_LOG("returned " << result_value);
2083 CheckGLError();
2084 return result_value;
2087 void GLES2Implementation::BindValuebufferCHROMIUM(GLenum target,
2088 GLuint valuebuffer) {
2089 GPU_CLIENT_SINGLE_THREAD_CHECK();
2090 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBindValuebufferCHROMIUM("
2091 << GLES2Util::GetStringValueBufferTarget(target) << ", "
2092 << valuebuffer << ")");
2093 if (IsValuebufferReservedId(valuebuffer)) {
2094 SetGLError(GL_INVALID_OPERATION, "BindValuebufferCHROMIUM",
2095 "valuebuffer reserved id");
2096 return;
2098 if (BindValuebufferCHROMIUMHelper(target, valuebuffer)) {
2099 helper_->BindValuebufferCHROMIUM(target, valuebuffer);
2101 CheckGLError();
2104 void GLES2Implementation::SubscribeValueCHROMIUM(GLenum target,
2105 GLenum subscription) {
2106 GPU_CLIENT_SINGLE_THREAD_CHECK();
2107 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glSubscribeValueCHROMIUM("
2108 << GLES2Util::GetStringValueBufferTarget(target) << ", "
2109 << GLES2Util::GetStringSubscriptionTarget(subscription)
2110 << ")");
2111 helper_->SubscribeValueCHROMIUM(target, subscription);
2112 CheckGLError();
2115 void GLES2Implementation::PopulateSubscribedValuesCHROMIUM(GLenum target) {
2116 GPU_CLIENT_SINGLE_THREAD_CHECK();
2117 GPU_CLIENT_LOG("[" << GetLogPrefix()
2118 << "] glPopulateSubscribedValuesCHROMIUM("
2119 << GLES2Util::GetStringValueBufferTarget(target) << ")");
2120 helper_->PopulateSubscribedValuesCHROMIUM(target);
2121 CheckGLError();
2124 void GLES2Implementation::UniformValuebufferCHROMIUM(GLint location,
2125 GLenum target,
2126 GLenum subscription) {
2127 GPU_CLIENT_SINGLE_THREAD_CHECK();
2128 GPU_CLIENT_LOG(
2129 "[" << GetLogPrefix() << "] glUniformValuebufferCHROMIUM(" << location
2130 << ", " << GLES2Util::GetStringValueBufferTarget(target) << ", "
2131 << GLES2Util::GetStringSubscriptionTarget(subscription) << ")");
2132 helper_->UniformValuebufferCHROMIUM(location, target, subscription);
2133 CheckGLError();
2136 void GLES2Implementation::BindTexImage2DCHROMIUM(GLenum target, GLint imageId) {
2137 GPU_CLIENT_SINGLE_THREAD_CHECK();
2138 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBindTexImage2DCHROMIUM("
2139 << GLES2Util::GetStringTextureBindTarget(target) << ", "
2140 << imageId << ")");
2141 helper_->BindTexImage2DCHROMIUM(target, imageId);
2142 CheckGLError();
2145 void GLES2Implementation::ReleaseTexImage2DCHROMIUM(GLenum target,
2146 GLint imageId) {
2147 GPU_CLIENT_SINGLE_THREAD_CHECK();
2148 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glReleaseTexImage2DCHROMIUM("
2149 << GLES2Util::GetStringTextureBindTarget(target) << ", "
2150 << imageId << ")");
2151 helper_->ReleaseTexImage2DCHROMIUM(target, imageId);
2152 CheckGLError();
2155 void GLES2Implementation::DiscardFramebufferEXT(GLenum target,
2156 GLsizei count,
2157 const GLenum* attachments) {
2158 GPU_CLIENT_SINGLE_THREAD_CHECK();
2159 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDiscardFramebufferEXT("
2160 << GLES2Util::GetStringEnum(target) << ", " << count
2161 << ", " << static_cast<const void*>(attachments) << ")");
2162 GPU_CLIENT_LOG_CODE_BLOCK({
2163 for (GLsizei i = 0; i < count; ++i) {
2164 GPU_CLIENT_LOG(" " << i << ": " << attachments[0 + i * 1]);
2167 if (count < 0) {
2168 SetGLError(GL_INVALID_VALUE, "glDiscardFramebufferEXT", "count < 0");
2169 return;
2171 helper_->DiscardFramebufferEXTImmediate(target, count, attachments);
2172 CheckGLError();
2175 void GLES2Implementation::LoseContextCHROMIUM(GLenum current, GLenum other) {
2176 GPU_CLIENT_SINGLE_THREAD_CHECK();
2177 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glLoseContextCHROMIUM("
2178 << GLES2Util::GetStringResetStatus(current) << ", "
2179 << GLES2Util::GetStringResetStatus(other) << ")");
2180 helper_->LoseContextCHROMIUM(current, other);
2181 CheckGLError();
2184 void GLES2Implementation::WaitSyncPointCHROMIUM(GLuint sync_point) {
2185 GPU_CLIENT_SINGLE_THREAD_CHECK();
2186 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glWaitSyncPointCHROMIUM("
2187 << sync_point << ")");
2188 helper_->WaitSyncPointCHROMIUM(sync_point);
2189 CheckGLError();
2192 void GLES2Implementation::DrawBuffersEXT(GLsizei count, const GLenum* bufs) {
2193 GPU_CLIENT_SINGLE_THREAD_CHECK();
2194 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDrawBuffersEXT(" << count << ", "
2195 << static_cast<const void*>(bufs) << ")");
2196 GPU_CLIENT_LOG_CODE_BLOCK({
2197 for (GLsizei i = 0; i < count; ++i) {
2198 GPU_CLIENT_LOG(" " << i << ": " << bufs[0 + i * 1]);
2201 if (count < 0) {
2202 SetGLError(GL_INVALID_VALUE, "glDrawBuffersEXT", "count < 0");
2203 return;
2205 helper_->DrawBuffersEXTImmediate(count, bufs);
2206 CheckGLError();
2209 void GLES2Implementation::DiscardBackbufferCHROMIUM() {
2210 GPU_CLIENT_SINGLE_THREAD_CHECK();
2211 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDiscardBackbufferCHROMIUM("
2212 << ")");
2213 helper_->DiscardBackbufferCHROMIUM();
2214 CheckGLError();
2217 void GLES2Implementation::ScheduleOverlayPlaneCHROMIUM(
2218 GLint plane_z_order,
2219 GLenum plane_transform,
2220 GLuint overlay_texture_id,
2221 GLint bounds_x,
2222 GLint bounds_y,
2223 GLint bounds_width,
2224 GLint bounds_height,
2225 GLfloat uv_x,
2226 GLfloat uv_y,
2227 GLfloat uv_width,
2228 GLfloat uv_height) {
2229 GPU_CLIENT_SINGLE_THREAD_CHECK();
2230 GPU_CLIENT_LOG(
2231 "[" << GetLogPrefix() << "] glScheduleOverlayPlaneCHROMIUM("
2232 << plane_z_order << ", " << GLES2Util::GetStringEnum(plane_transform)
2233 << ", " << overlay_texture_id << ", " << bounds_x << ", " << bounds_y
2234 << ", " << bounds_width << ", " << bounds_height << ", " << uv_x
2235 << ", " << uv_y << ", " << uv_width << ", " << uv_height << ")");
2236 helper_->ScheduleOverlayPlaneCHROMIUM(
2237 plane_z_order, plane_transform, overlay_texture_id, bounds_x, bounds_y,
2238 bounds_width, bounds_height, uv_x, uv_y, uv_width, uv_height);
2239 CheckGLError();
2242 void GLES2Implementation::MatrixLoadfCHROMIUM(GLenum matrixMode,
2243 const GLfloat* m) {
2244 GPU_CLIENT_SINGLE_THREAD_CHECK();
2245 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glMatrixLoadfCHROMIUM("
2246 << GLES2Util::GetStringMatrixMode(matrixMode) << ", "
2247 << static_cast<const void*>(m) << ")");
2248 GPU_CLIENT_LOG("values: " << m[0] << ", " << m[1] << ", " << m[2] << ", "
2249 << m[3] << ", " << m[4] << ", " << m[5] << ", "
2250 << m[6] << ", " << m[7] << ", " << m[8] << ", "
2251 << m[9] << ", " << m[10] << ", " << m[11] << ", "
2252 << m[12] << ", " << m[13] << ", " << m[14] << ", "
2253 << m[15]);
2254 helper_->MatrixLoadfCHROMIUMImmediate(matrixMode, m);
2255 CheckGLError();
2258 void GLES2Implementation::MatrixLoadIdentityCHROMIUM(GLenum matrixMode) {
2259 GPU_CLIENT_SINGLE_THREAD_CHECK();
2260 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glMatrixLoadIdentityCHROMIUM("
2261 << GLES2Util::GetStringMatrixMode(matrixMode) << ")");
2262 helper_->MatrixLoadIdentityCHROMIUM(matrixMode);
2263 CheckGLError();
2266 void GLES2Implementation::BlendBarrierKHR() {
2267 GPU_CLIENT_SINGLE_THREAD_CHECK();
2268 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBlendBarrierKHR("
2269 << ")");
2270 helper_->BlendBarrierKHR();
2271 CheckGLError();
2274 #endif // GPU_COMMAND_BUFFER_CLIENT_GLES2_IMPLEMENTATION_IMPL_AUTOGEN_H_