Added grv@ and dvh@ as owners of developer private API.
[chromium-blink-merge.git] / gpu / command_buffer / client / gles2_implementation_impl_autogen.h
blob9dba99fc849569b990d26be73735cb23194f30f6
1 // Copyright (c) 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 // DO NOT EDIT!
9 // This file is included by gles2_implementation.cc to define the
10 // GL api functions.
11 #ifndef GPU_COMMAND_BUFFER_CLIENT_GLES2_IMPLEMENTATION_IMPL_AUTOGEN_H_
12 #define GPU_COMMAND_BUFFER_CLIENT_GLES2_IMPLEMENTATION_IMPL_AUTOGEN_H_
14 void GLES2Implementation::AttachShader(GLuint program, GLuint shader) {
15 GPU_CLIENT_SINGLE_THREAD_CHECK();
16 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glAttachShader(" << program << ", " << shader << ")"); // NOLINT
17 helper_->AttachShader(program, shader);
18 CheckGLError();
21 void GLES2Implementation::BindBuffer(GLenum target, GLuint buffer) {
22 GPU_CLIENT_SINGLE_THREAD_CHECK();
23 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBindBuffer(" << GLES2Util::GetStringBufferTarget(target) << ", " << buffer << ")"); // NOLINT
24 if (IsBufferReservedId(buffer)) {
25 SetGLError(GL_INVALID_OPERATION, "BindBuffer", "buffer reserved id");
26 return;
28 if (BindBufferHelper(target, buffer)) {
29 helper_->BindBuffer(target, buffer);
31 CheckGLError();
34 void GLES2Implementation::BindFramebuffer(GLenum target, GLuint framebuffer) {
35 GPU_CLIENT_SINGLE_THREAD_CHECK();
36 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBindFramebuffer(" << GLES2Util::GetStringFrameBufferTarget(target) << ", " << framebuffer << ")"); // NOLINT
37 if (IsFramebufferReservedId(framebuffer)) {
38 SetGLError(
39 GL_INVALID_OPERATION, "BindFramebuffer", "framebuffer reserved id");
40 return;
42 if (BindFramebufferHelper(target, framebuffer)) {
43 helper_->BindFramebuffer(target, framebuffer);
45 CheckGLError();
48 void GLES2Implementation::BindRenderbuffer(
49 GLenum target, GLuint renderbuffer) {
50 GPU_CLIENT_SINGLE_THREAD_CHECK();
51 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBindRenderbuffer(" << GLES2Util::GetStringRenderBufferTarget(target) << ", " << renderbuffer << ")"); // NOLINT
52 if (IsRenderbufferReservedId(renderbuffer)) {
53 SetGLError(
54 GL_INVALID_OPERATION, "BindRenderbuffer", "renderbuffer reserved id");
55 return;
57 if (BindRenderbufferHelper(target, renderbuffer)) {
58 helper_->BindRenderbuffer(target, renderbuffer);
60 CheckGLError();
63 void GLES2Implementation::BindTexture(GLenum target, GLuint texture) {
64 GPU_CLIENT_SINGLE_THREAD_CHECK();
65 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBindTexture(" << GLES2Util::GetStringTextureBindTarget(target) << ", " << texture << ")"); // NOLINT
66 if (IsTextureReservedId(texture)) {
67 SetGLError(GL_INVALID_OPERATION, "BindTexture", "texture reserved id");
68 return;
70 if (BindTextureHelper(target, texture)) {
71 helper_->BindTexture(target, texture);
73 CheckGLError();
76 void GLES2Implementation::BlendColor(
77 GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) {
78 GPU_CLIENT_SINGLE_THREAD_CHECK();
79 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBlendColor(" << red << ", " << green << ", " << blue << ", " << alpha << ")"); // NOLINT
80 helper_->BlendColor(red, green, blue, alpha);
81 CheckGLError();
84 void GLES2Implementation::BlendEquation(GLenum mode) {
85 GPU_CLIENT_SINGLE_THREAD_CHECK();
86 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBlendEquation(" << GLES2Util::GetStringEquation(mode) << ")"); // NOLINT
87 helper_->BlendEquation(mode);
88 CheckGLError();
91 void GLES2Implementation::BlendEquationSeparate(
92 GLenum modeRGB, GLenum modeAlpha) {
93 GPU_CLIENT_SINGLE_THREAD_CHECK();
94 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBlendEquationSeparate(" << GLES2Util::GetStringEquation(modeRGB) << ", " << GLES2Util::GetStringEquation(modeAlpha) << ")"); // NOLINT
95 helper_->BlendEquationSeparate(modeRGB, modeAlpha);
96 CheckGLError();
99 void GLES2Implementation::BlendFunc(GLenum sfactor, GLenum dfactor) {
100 GPU_CLIENT_SINGLE_THREAD_CHECK();
101 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBlendFunc(" << GLES2Util::GetStringSrcBlendFactor(sfactor) << ", " << GLES2Util::GetStringDstBlendFactor(dfactor) << ")"); // NOLINT
102 helper_->BlendFunc(sfactor, dfactor);
103 CheckGLError();
106 void GLES2Implementation::BlendFuncSeparate(
107 GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha) {
108 GPU_CLIENT_SINGLE_THREAD_CHECK();
109 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBlendFuncSeparate(" << GLES2Util::GetStringSrcBlendFactor(srcRGB) << ", " << GLES2Util::GetStringDstBlendFactor(dstRGB) << ", " << GLES2Util::GetStringSrcBlendFactor(srcAlpha) << ", " << GLES2Util::GetStringDstBlendFactor(dstAlpha) << ")"); // NOLINT
110 helper_->BlendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha);
111 CheckGLError();
114 GLenum GLES2Implementation::CheckFramebufferStatus(GLenum target) {
115 GPU_CLIENT_SINGLE_THREAD_CHECK();
116 TRACE_EVENT0("gpu", "GLES2Implementation::CheckFramebufferStatus");
117 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glCheckFramebufferStatus(" << GLES2Util::GetStringFrameBufferTarget(target) << ")"); // NOLINT
118 typedef cmds::CheckFramebufferStatus::Result Result;
119 Result* result = GetResultAs<Result*>();
120 if (!result) {
121 return GL_FRAMEBUFFER_UNSUPPORTED;
123 *result = 0;
124 helper_->CheckFramebufferStatus(
125 target, GetResultShmId(), GetResultShmOffset());
126 WaitForCmd();
127 GLenum result_value = *result;
128 GPU_CLIENT_LOG("returned " << result_value);
129 CheckGLError();
130 return result_value;
133 void GLES2Implementation::Clear(GLbitfield mask) {
134 GPU_CLIENT_SINGLE_THREAD_CHECK();
135 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glClear(" << mask << ")");
136 helper_->Clear(mask);
137 CheckGLError();
140 void GLES2Implementation::ClearColor(
141 GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) {
142 GPU_CLIENT_SINGLE_THREAD_CHECK();
143 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glClearColor(" << red << ", " << green << ", " << blue << ", " << alpha << ")"); // NOLINT
144 helper_->ClearColor(red, green, blue, alpha);
145 CheckGLError();
148 void GLES2Implementation::ClearDepthf(GLclampf depth) {
149 GPU_CLIENT_SINGLE_THREAD_CHECK();
150 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glClearDepthf(" << depth << ")");
151 helper_->ClearDepthf(depth);
152 CheckGLError();
155 void GLES2Implementation::ClearStencil(GLint s) {
156 GPU_CLIENT_SINGLE_THREAD_CHECK();
157 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glClearStencil(" << s << ")");
158 helper_->ClearStencil(s);
159 CheckGLError();
162 void GLES2Implementation::ColorMask(
163 GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha) {
164 GPU_CLIENT_SINGLE_THREAD_CHECK();
165 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glColorMask(" << GLES2Util::GetStringBool(red) << ", " << GLES2Util::GetStringBool(green) << ", " << GLES2Util::GetStringBool(blue) << ", " << GLES2Util::GetStringBool(alpha) << ")"); // NOLINT
166 helper_->ColorMask(red, green, blue, alpha);
167 CheckGLError();
170 void GLES2Implementation::CompileShader(GLuint shader) {
171 GPU_CLIENT_SINGLE_THREAD_CHECK();
172 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glCompileShader(" << shader << ")"); // NOLINT
173 helper_->CompileShader(shader);
174 CheckGLError();
177 void GLES2Implementation::CopyTexImage2D(
178 GLenum target, GLint level, GLenum internalformat, GLint x, GLint y,
179 GLsizei width, GLsizei height, GLint border) {
180 GPU_CLIENT_SINGLE_THREAD_CHECK();
181 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glCopyTexImage2D(" << GLES2Util::GetStringTextureTarget(target) << ", " << level << ", " << GLES2Util::GetStringTextureInternalFormat(internalformat) << ", " << x << ", " << y << ", " << width << ", " << height << ", " << border << ")"); // NOLINT
182 if (width < 0) {
183 SetGLError(GL_INVALID_VALUE, "glCopyTexImage2D", "width < 0");
184 return;
186 if (height < 0) {
187 SetGLError(GL_INVALID_VALUE, "glCopyTexImage2D", "height < 0");
188 return;
190 helper_->CopyTexImage2D(
191 target, level, internalformat, x, y, width, height, border);
192 CheckGLError();
195 void GLES2Implementation::CopyTexSubImage2D(
196 GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y,
197 GLsizei width, GLsizei height) {
198 GPU_CLIENT_SINGLE_THREAD_CHECK();
199 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glCopyTexSubImage2D(" << GLES2Util::GetStringTextureTarget(target) << ", " << level << ", " << xoffset << ", " << yoffset << ", " << x << ", " << y << ", " << width << ", " << height << ")"); // NOLINT
200 if (width < 0) {
201 SetGLError(GL_INVALID_VALUE, "glCopyTexSubImage2D", "width < 0");
202 return;
204 if (height < 0) {
205 SetGLError(GL_INVALID_VALUE, "glCopyTexSubImage2D", "height < 0");
206 return;
208 helper_->CopyTexSubImage2D(
209 target, level, xoffset, yoffset, x, y, width, height);
210 CheckGLError();
213 GLuint GLES2Implementation::CreateProgram() {
214 GPU_CLIENT_SINGLE_THREAD_CHECK();
215 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glCreateProgram(" << ")");
216 GLuint client_id;
217 GetIdHandler(id_namespaces::kProgramsAndShaders)->
218 MakeIds(this, 0, 1, &client_id);
219 helper_->CreateProgram(client_id);
220 GPU_CLIENT_LOG("returned " << client_id);
221 CheckGLError();
222 return client_id;
225 GLuint GLES2Implementation::CreateShader(GLenum type) {
226 GPU_CLIENT_SINGLE_THREAD_CHECK();
227 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glCreateShader(" << GLES2Util::GetStringShaderType(type) << ")"); // NOLINT
228 GLuint client_id;
229 GetIdHandler(id_namespaces::kProgramsAndShaders)->
230 MakeIds(this, 0, 1, &client_id);
231 helper_->CreateShader(type, client_id);
232 GPU_CLIENT_LOG("returned " << client_id);
233 CheckGLError();
234 return client_id;
237 void GLES2Implementation::CullFace(GLenum mode) {
238 GPU_CLIENT_SINGLE_THREAD_CHECK();
239 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glCullFace(" << GLES2Util::GetStringFaceType(mode) << ")"); // NOLINT
240 helper_->CullFace(mode);
241 CheckGLError();
244 void GLES2Implementation::DeleteBuffers(GLsizei n, const GLuint* buffers) {
245 GPU_CLIENT_SINGLE_THREAD_CHECK();
246 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDeleteBuffers(" << n << ", " << static_cast<const void*>(buffers) << ")"); // NOLINT
247 GPU_CLIENT_LOG_CODE_BLOCK({
248 for (GLsizei i = 0; i < n; ++i) {
249 GPU_CLIENT_LOG(" " << i << ": " << buffers[i]);
252 GPU_CLIENT_DCHECK_CODE_BLOCK({
253 for (GLsizei i = 0; i < n; ++i) {
254 DCHECK(buffers[i] != 0);
257 if (n < 0) {
258 SetGLError(GL_INVALID_VALUE, "glDeleteBuffers", "n < 0");
259 return;
261 DeleteBuffersHelper(n, buffers);
262 CheckGLError();
265 void GLES2Implementation::DeleteFramebuffers(
266 GLsizei n, const GLuint* framebuffers) {
267 GPU_CLIENT_SINGLE_THREAD_CHECK();
268 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDeleteFramebuffers(" << n << ", " << static_cast<const void*>(framebuffers) << ")"); // NOLINT
269 GPU_CLIENT_LOG_CODE_BLOCK({
270 for (GLsizei i = 0; i < n; ++i) {
271 GPU_CLIENT_LOG(" " << i << ": " << framebuffers[i]);
274 GPU_CLIENT_DCHECK_CODE_BLOCK({
275 for (GLsizei i = 0; i < n; ++i) {
276 DCHECK(framebuffers[i] != 0);
279 if (n < 0) {
280 SetGLError(GL_INVALID_VALUE, "glDeleteFramebuffers", "n < 0");
281 return;
283 DeleteFramebuffersHelper(n, framebuffers);
284 CheckGLError();
287 void GLES2Implementation::DeleteProgram(GLuint program) {
288 GPU_CLIENT_SINGLE_THREAD_CHECK();
289 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDeleteProgram(" << program << ")"); // NOLINT
290 GPU_CLIENT_DCHECK(program != 0);
291 DeleteProgramHelper(program);
292 CheckGLError();
295 void GLES2Implementation::DeleteRenderbuffers(
296 GLsizei n, const GLuint* renderbuffers) {
297 GPU_CLIENT_SINGLE_THREAD_CHECK();
298 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDeleteRenderbuffers(" << n << ", " << static_cast<const void*>(renderbuffers) << ")"); // NOLINT
299 GPU_CLIENT_LOG_CODE_BLOCK({
300 for (GLsizei i = 0; i < n; ++i) {
301 GPU_CLIENT_LOG(" " << i << ": " << renderbuffers[i]);
304 GPU_CLIENT_DCHECK_CODE_BLOCK({
305 for (GLsizei i = 0; i < n; ++i) {
306 DCHECK(renderbuffers[i] != 0);
309 if (n < 0) {
310 SetGLError(GL_INVALID_VALUE, "glDeleteRenderbuffers", "n < 0");
311 return;
313 DeleteRenderbuffersHelper(n, renderbuffers);
314 CheckGLError();
317 void GLES2Implementation::DeleteShader(GLuint shader) {
318 GPU_CLIENT_SINGLE_THREAD_CHECK();
319 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDeleteShader(" << shader << ")");
320 GPU_CLIENT_DCHECK(shader != 0);
321 DeleteShaderHelper(shader);
322 CheckGLError();
325 void GLES2Implementation::DeleteTextures(GLsizei n, const GLuint* textures) {
326 GPU_CLIENT_SINGLE_THREAD_CHECK();
327 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDeleteTextures(" << n << ", " << static_cast<const void*>(textures) << ")"); // NOLINT
328 GPU_CLIENT_LOG_CODE_BLOCK({
329 for (GLsizei i = 0; i < n; ++i) {
330 GPU_CLIENT_LOG(" " << i << ": " << textures[i]);
333 GPU_CLIENT_DCHECK_CODE_BLOCK({
334 for (GLsizei i = 0; i < n; ++i) {
335 DCHECK(textures[i] != 0);
338 if (n < 0) {
339 SetGLError(GL_INVALID_VALUE, "glDeleteTextures", "n < 0");
340 return;
342 DeleteTexturesHelper(n, textures);
343 CheckGLError();
346 void GLES2Implementation::DepthFunc(GLenum func) {
347 GPU_CLIENT_SINGLE_THREAD_CHECK();
348 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDepthFunc(" << GLES2Util::GetStringCmpFunction(func) << ")"); // NOLINT
349 helper_->DepthFunc(func);
350 CheckGLError();
353 void GLES2Implementation::DepthMask(GLboolean flag) {
354 GPU_CLIENT_SINGLE_THREAD_CHECK();
355 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDepthMask(" << GLES2Util::GetStringBool(flag) << ")"); // NOLINT
356 helper_->DepthMask(flag);
357 CheckGLError();
360 void GLES2Implementation::DepthRangef(GLclampf zNear, GLclampf zFar) {
361 GPU_CLIENT_SINGLE_THREAD_CHECK();
362 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDepthRangef(" << zNear << ", " << zFar << ")"); // NOLINT
363 helper_->DepthRangef(zNear, zFar);
364 CheckGLError();
367 void GLES2Implementation::DetachShader(GLuint program, GLuint shader) {
368 GPU_CLIENT_SINGLE_THREAD_CHECK();
369 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDetachShader(" << program << ", " << shader << ")"); // NOLINT
370 helper_->DetachShader(program, shader);
371 CheckGLError();
374 void GLES2Implementation::FramebufferRenderbuffer(
375 GLenum target, GLenum attachment, GLenum renderbuffertarget,
376 GLuint renderbuffer) {
377 GPU_CLIENT_SINGLE_THREAD_CHECK();
378 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glFramebufferRenderbuffer(" << GLES2Util::GetStringFrameBufferTarget(target) << ", " << GLES2Util::GetStringAttachment(attachment) << ", " << GLES2Util::GetStringRenderBufferTarget(renderbuffertarget) << ", " << renderbuffer << ")"); // NOLINT
379 helper_->FramebufferRenderbuffer(
380 target, attachment, renderbuffertarget, renderbuffer);
381 CheckGLError();
384 void GLES2Implementation::FramebufferTexture2D(
385 GLenum target, GLenum attachment, GLenum textarget, GLuint texture,
386 GLint level) {
387 GPU_CLIENT_SINGLE_THREAD_CHECK();
388 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glFramebufferTexture2D(" << GLES2Util::GetStringFrameBufferTarget(target) << ", " << GLES2Util::GetStringAttachment(attachment) << ", " << GLES2Util::GetStringTextureTarget(textarget) << ", " << texture << ", " << level << ")"); // NOLINT
389 helper_->FramebufferTexture2D(target, attachment, textarget, texture, level);
390 CheckGLError();
393 void GLES2Implementation::FrontFace(GLenum mode) {
394 GPU_CLIENT_SINGLE_THREAD_CHECK();
395 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glFrontFace(" << GLES2Util::GetStringFaceMode(mode) << ")"); // NOLINT
396 helper_->FrontFace(mode);
397 CheckGLError();
400 void GLES2Implementation::GenBuffers(GLsizei n, GLuint* buffers) {
401 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGenBuffers(" << n << ", " << static_cast<const void*>(buffers) << ")"); // NOLINT
402 if (n < 0) {
403 SetGLError(GL_INVALID_VALUE, "glGenBuffers", "n < 0");
404 return;
406 GPU_CLIENT_SINGLE_THREAD_CHECK();
407 GetIdHandler(id_namespaces::kBuffers)->
408 MakeIds(this, 0, n, buffers);
409 GenBuffersHelper(n, buffers);
410 helper_->GenBuffersImmediate(n, buffers);
411 helper_->CommandBufferHelper::Flush();
412 GPU_CLIENT_LOG_CODE_BLOCK({
413 for (GLsizei i = 0; i < n; ++i) {
414 GPU_CLIENT_LOG(" " << i << ": " << buffers[i]);
417 CheckGLError();
420 void GLES2Implementation::GenerateMipmap(GLenum target) {
421 GPU_CLIENT_SINGLE_THREAD_CHECK();
422 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGenerateMipmap(" << GLES2Util::GetStringTextureBindTarget(target) << ")"); // NOLINT
423 helper_->GenerateMipmap(target);
424 CheckGLError();
427 void GLES2Implementation::GenFramebuffers(GLsizei n, GLuint* framebuffers) {
428 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGenFramebuffers(" << n << ", " << static_cast<const void*>(framebuffers) << ")"); // NOLINT
429 if (n < 0) {
430 SetGLError(GL_INVALID_VALUE, "glGenFramebuffers", "n < 0");
431 return;
433 GPU_CLIENT_SINGLE_THREAD_CHECK();
434 GetIdHandler(id_namespaces::kFramebuffers)->
435 MakeIds(this, 0, n, framebuffers);
436 GenFramebuffersHelper(n, framebuffers);
437 helper_->GenFramebuffersImmediate(n, framebuffers);
438 helper_->CommandBufferHelper::Flush();
439 GPU_CLIENT_LOG_CODE_BLOCK({
440 for (GLsizei i = 0; i < n; ++i) {
441 GPU_CLIENT_LOG(" " << i << ": " << framebuffers[i]);
444 CheckGLError();
447 void GLES2Implementation::GenRenderbuffers(GLsizei n, GLuint* renderbuffers) {
448 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGenRenderbuffers(" << n << ", " << static_cast<const void*>(renderbuffers) << ")"); // NOLINT
449 if (n < 0) {
450 SetGLError(GL_INVALID_VALUE, "glGenRenderbuffers", "n < 0");
451 return;
453 GPU_CLIENT_SINGLE_THREAD_CHECK();
454 GetIdHandler(id_namespaces::kRenderbuffers)->
455 MakeIds(this, 0, n, renderbuffers);
456 GenRenderbuffersHelper(n, renderbuffers);
457 helper_->GenRenderbuffersImmediate(n, renderbuffers);
458 helper_->CommandBufferHelper::Flush();
459 GPU_CLIENT_LOG_CODE_BLOCK({
460 for (GLsizei i = 0; i < n; ++i) {
461 GPU_CLIENT_LOG(" " << i << ": " << renderbuffers[i]);
464 CheckGLError();
467 void GLES2Implementation::GenTextures(GLsizei n, GLuint* textures) {
468 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGenTextures(" << n << ", " << static_cast<const void*>(textures) << ")"); // NOLINT
469 if (n < 0) {
470 SetGLError(GL_INVALID_VALUE, "glGenTextures", "n < 0");
471 return;
473 GPU_CLIENT_SINGLE_THREAD_CHECK();
474 GetIdHandler(id_namespaces::kTextures)->
475 MakeIds(this, 0, n, textures);
476 GenTexturesHelper(n, textures);
477 helper_->GenTexturesImmediate(n, textures);
478 helper_->CommandBufferHelper::Flush();
479 GPU_CLIENT_LOG_CODE_BLOCK({
480 for (GLsizei i = 0; i < n; ++i) {
481 GPU_CLIENT_LOG(" " << i << ": " << textures[i]);
484 CheckGLError();
487 void GLES2Implementation::GetBooleanv(GLenum pname, GLboolean* params) {
488 GPU_CLIENT_SINGLE_THREAD_CHECK();
489 GPU_CLIENT_VALIDATE_DESTINATION_INITALIZATION(GLboolean, params);
490 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetBooleanv(" << GLES2Util::GetStringGLState(pname) << ", " << static_cast<const void*>(params) << ")"); // NOLINT
491 TRACE_EVENT0("gpu", "GLES2Implementation::GetBooleanv");
492 if (GetBooleanvHelper(pname, params)) {
493 return;
495 typedef cmds::GetBooleanv::Result Result;
496 Result* result = GetResultAs<Result*>();
497 if (!result) {
498 return;
500 result->SetNumResults(0);
501 helper_->GetBooleanv(pname,
502 GetResultShmId(), GetResultShmOffset());
503 WaitForCmd();
504 result->CopyResult(params);
505 GPU_CLIENT_LOG_CODE_BLOCK({
506 for (int32 i = 0; i < result->GetNumResults(); ++i) {
507 GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]);
510 CheckGLError();
512 void GLES2Implementation::GetBufferParameteriv(
513 GLenum target, GLenum pname, GLint* params) {
514 GPU_CLIENT_SINGLE_THREAD_CHECK();
515 GPU_CLIENT_VALIDATE_DESTINATION_INITALIZATION(GLint, params);
516 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetBufferParameteriv(" << GLES2Util::GetStringBufferTarget(target) << ", " << GLES2Util::GetStringBufferParameter(pname) << ", " << static_cast<const void*>(params) << ")"); // NOLINT
517 TRACE_EVENT0("gpu", "GLES2Implementation::GetBufferParameteriv");
518 if (GetBufferParameterivHelper(target, pname, params)) {
519 return;
521 typedef cmds::GetBufferParameteriv::Result Result;
522 Result* result = GetResultAs<Result*>();
523 if (!result) {
524 return;
526 result->SetNumResults(0);
527 helper_->GetBufferParameteriv(target, pname,
528 GetResultShmId(), GetResultShmOffset());
529 WaitForCmd();
530 result->CopyResult(params);
531 GPU_CLIENT_LOG_CODE_BLOCK({
532 for (int32 i = 0; i < result->GetNumResults(); ++i) {
533 GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]);
536 CheckGLError();
538 void GLES2Implementation::GetFloatv(GLenum pname, GLfloat* params) {
539 GPU_CLIENT_SINGLE_THREAD_CHECK();
540 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetFloatv(" << GLES2Util::GetStringGLState(pname) << ", " << static_cast<const void*>(params) << ")"); // NOLINT
541 TRACE_EVENT0("gpu", "GLES2Implementation::GetFloatv");
542 if (GetFloatvHelper(pname, params)) {
543 return;
545 typedef cmds::GetFloatv::Result Result;
546 Result* result = GetResultAs<Result*>();
547 if (!result) {
548 return;
550 result->SetNumResults(0);
551 helper_->GetFloatv(pname,
552 GetResultShmId(), GetResultShmOffset());
553 WaitForCmd();
554 result->CopyResult(params);
555 GPU_CLIENT_LOG_CODE_BLOCK({
556 for (int32 i = 0; i < result->GetNumResults(); ++i) {
557 GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]);
560 CheckGLError();
562 void GLES2Implementation::GetFramebufferAttachmentParameteriv(
563 GLenum target, GLenum attachment, GLenum pname, GLint* params) {
564 GPU_CLIENT_SINGLE_THREAD_CHECK();
565 GPU_CLIENT_VALIDATE_DESTINATION_INITALIZATION(GLint, params);
566 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetFramebufferAttachmentParameteriv(" << GLES2Util::GetStringFrameBufferTarget(target) << ", " << GLES2Util::GetStringAttachment(attachment) << ", " << GLES2Util::GetStringFrameBufferParameter(pname) << ", " << static_cast<const void*>(params) << ")"); // NOLINT
567 TRACE_EVENT0("gpu", "GLES2Implementation::GetFramebufferAttachmentParameteriv"); // NOLINT
568 if (GetFramebufferAttachmentParameterivHelper(
569 target, attachment, pname, params)) {
570 return;
572 typedef cmds::GetFramebufferAttachmentParameteriv::Result Result;
573 Result* result = GetResultAs<Result*>();
574 if (!result) {
575 return;
577 result->SetNumResults(0);
578 helper_->GetFramebufferAttachmentParameteriv(target, attachment, pname,
579 GetResultShmId(), GetResultShmOffset());
580 WaitForCmd();
581 result->CopyResult(params);
582 GPU_CLIENT_LOG_CODE_BLOCK({
583 for (int32 i = 0; i < result->GetNumResults(); ++i) {
584 GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]);
587 CheckGLError();
589 void GLES2Implementation::GetIntegerv(GLenum pname, GLint* params) {
590 GPU_CLIENT_SINGLE_THREAD_CHECK();
591 GPU_CLIENT_VALIDATE_DESTINATION_INITALIZATION(GLint, params);
592 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetIntegerv(" << GLES2Util::GetStringGLState(pname) << ", " << static_cast<const void*>(params) << ")"); // NOLINT
593 TRACE_EVENT0("gpu", "GLES2Implementation::GetIntegerv");
594 if (GetIntegervHelper(pname, params)) {
595 return;
597 typedef cmds::GetIntegerv::Result Result;
598 Result* result = GetResultAs<Result*>();
599 if (!result) {
600 return;
602 result->SetNumResults(0);
603 helper_->GetIntegerv(pname,
604 GetResultShmId(), GetResultShmOffset());
605 WaitForCmd();
606 result->CopyResult(params);
607 GPU_CLIENT_LOG_CODE_BLOCK({
608 for (int32 i = 0; i < result->GetNumResults(); ++i) {
609 GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]);
612 CheckGLError();
614 void GLES2Implementation::GetProgramiv(
615 GLuint program, GLenum pname, GLint* params) {
616 GPU_CLIENT_SINGLE_THREAD_CHECK();
617 GPU_CLIENT_VALIDATE_DESTINATION_INITALIZATION(GLint, params);
618 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetProgramiv(" << program << ", " << GLES2Util::GetStringProgramParameter(pname) << ", " << static_cast<const void*>(params) << ")"); // NOLINT
619 TRACE_EVENT0("gpu", "GLES2Implementation::GetProgramiv");
620 if (GetProgramivHelper(program, pname, params)) {
621 return;
623 typedef cmds::GetProgramiv::Result Result;
624 Result* result = GetResultAs<Result*>();
625 if (!result) {
626 return;
628 result->SetNumResults(0);
629 helper_->GetProgramiv(program, pname,
630 GetResultShmId(), GetResultShmOffset());
631 WaitForCmd();
632 result->CopyResult(params);
633 GPU_CLIENT_LOG_CODE_BLOCK({
634 for (int32 i = 0; i < result->GetNumResults(); ++i) {
635 GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]);
638 CheckGLError();
640 void GLES2Implementation::GetProgramInfoLog(
641 GLuint program, GLsizei bufsize, GLsizei* length, char* infolog) {
642 GPU_CLIENT_SINGLE_THREAD_CHECK();
643 GPU_CLIENT_VALIDATE_DESTINATION_OPTIONAL_INITALIZATION(GLsizei, length);
644 GPU_CLIENT_LOG("[" << GetLogPrefix()
645 << "] glGetProgramInfoLog" << "("
646 << program << ", "
647 << bufsize << ", "
648 << static_cast<void*>(length) << ", "
649 << static_cast<void*>(infolog) << ")");
650 helper_->SetBucketSize(kResultBucketId, 0);
651 helper_->GetProgramInfoLog(program, kResultBucketId);
652 std::string str;
653 GLsizei max_size = 0;
654 if (GetBucketAsString(kResultBucketId, &str)) {
655 if (bufsize > 0) {
656 max_size =
657 std::min(static_cast<size_t>(bufsize) - 1, str.size());
658 memcpy(infolog, str.c_str(), max_size);
659 infolog[max_size] = '\0';
660 GPU_CLIENT_LOG("------\n" << infolog << "\n------");
663 if (length != NULL) {
664 *length = max_size;
666 CheckGLError();
668 void GLES2Implementation::GetRenderbufferParameteriv(
669 GLenum target, GLenum pname, GLint* params) {
670 GPU_CLIENT_SINGLE_THREAD_CHECK();
671 GPU_CLIENT_VALIDATE_DESTINATION_INITALIZATION(GLint, params);
672 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetRenderbufferParameteriv(" << GLES2Util::GetStringRenderBufferTarget(target) << ", " << GLES2Util::GetStringRenderBufferParameter(pname) << ", " << static_cast<const void*>(params) << ")"); // NOLINT
673 TRACE_EVENT0("gpu", "GLES2Implementation::GetRenderbufferParameteriv");
674 if (GetRenderbufferParameterivHelper(target, pname, params)) {
675 return;
677 typedef cmds::GetRenderbufferParameteriv::Result Result;
678 Result* result = GetResultAs<Result*>();
679 if (!result) {
680 return;
682 result->SetNumResults(0);
683 helper_->GetRenderbufferParameteriv(target, pname,
684 GetResultShmId(), GetResultShmOffset());
685 WaitForCmd();
686 result->CopyResult(params);
687 GPU_CLIENT_LOG_CODE_BLOCK({
688 for (int32 i = 0; i < result->GetNumResults(); ++i) {
689 GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]);
692 CheckGLError();
694 void GLES2Implementation::GetShaderiv(
695 GLuint shader, GLenum pname, GLint* params) {
696 GPU_CLIENT_SINGLE_THREAD_CHECK();
697 GPU_CLIENT_VALIDATE_DESTINATION_INITALIZATION(GLint, params);
698 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetShaderiv(" << shader << ", " << GLES2Util::GetStringShaderParameter(pname) << ", " << static_cast<const void*>(params) << ")"); // NOLINT
699 TRACE_EVENT0("gpu", "GLES2Implementation::GetShaderiv");
700 if (GetShaderivHelper(shader, pname, params)) {
701 return;
703 typedef cmds::GetShaderiv::Result Result;
704 Result* result = GetResultAs<Result*>();
705 if (!result) {
706 return;
708 result->SetNumResults(0);
709 helper_->GetShaderiv(shader, pname,
710 GetResultShmId(), GetResultShmOffset());
711 WaitForCmd();
712 result->CopyResult(params);
713 GPU_CLIENT_LOG_CODE_BLOCK({
714 for (int32 i = 0; i < result->GetNumResults(); ++i) {
715 GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]);
718 CheckGLError();
720 void GLES2Implementation::GetShaderInfoLog(
721 GLuint shader, GLsizei bufsize, GLsizei* length, char* infolog) {
722 GPU_CLIENT_SINGLE_THREAD_CHECK();
723 GPU_CLIENT_VALIDATE_DESTINATION_OPTIONAL_INITALIZATION(GLsizei, length);
724 GPU_CLIENT_LOG("[" << GetLogPrefix()
725 << "] glGetShaderInfoLog" << "("
726 << shader << ", "
727 << bufsize << ", "
728 << static_cast<void*>(length) << ", "
729 << static_cast<void*>(infolog) << ")");
730 helper_->SetBucketSize(kResultBucketId, 0);
731 helper_->GetShaderInfoLog(shader, kResultBucketId);
732 std::string str;
733 GLsizei max_size = 0;
734 if (GetBucketAsString(kResultBucketId, &str)) {
735 if (bufsize > 0) {
736 max_size =
737 std::min(static_cast<size_t>(bufsize) - 1, str.size());
738 memcpy(infolog, str.c_str(), max_size);
739 infolog[max_size] = '\0';
740 GPU_CLIENT_LOG("------\n" << infolog << "\n------");
743 if (length != NULL) {
744 *length = max_size;
746 CheckGLError();
748 void GLES2Implementation::GetShaderSource(
749 GLuint shader, GLsizei bufsize, GLsizei* length, char* source) {
750 GPU_CLIENT_SINGLE_THREAD_CHECK();
751 GPU_CLIENT_VALIDATE_DESTINATION_OPTIONAL_INITALIZATION(GLsizei, length);
752 GPU_CLIENT_LOG("[" << GetLogPrefix()
753 << "] glGetShaderSource" << "("
754 << shader << ", "
755 << bufsize << ", "
756 << static_cast<void*>(length) << ", "
757 << static_cast<void*>(source) << ")");
758 helper_->SetBucketSize(kResultBucketId, 0);
759 helper_->GetShaderSource(shader, kResultBucketId);
760 std::string str;
761 GLsizei max_size = 0;
762 if (GetBucketAsString(kResultBucketId, &str)) {
763 if (bufsize > 0) {
764 max_size =
765 std::min(static_cast<size_t>(bufsize) - 1, str.size());
766 memcpy(source, str.c_str(), max_size);
767 source[max_size] = '\0';
768 GPU_CLIENT_LOG("------\n" << source << "\n------");
771 if (length != NULL) {
772 *length = max_size;
774 CheckGLError();
776 void GLES2Implementation::GetTexParameterfv(
777 GLenum target, GLenum pname, GLfloat* params) {
778 GPU_CLIENT_SINGLE_THREAD_CHECK();
779 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetTexParameterfv(" << GLES2Util::GetStringGetTexParamTarget(target) << ", " << GLES2Util::GetStringTextureParameter(pname) << ", " << static_cast<const void*>(params) << ")"); // NOLINT
780 TRACE_EVENT0("gpu", "GLES2Implementation::GetTexParameterfv");
781 if (GetTexParameterfvHelper(target, pname, params)) {
782 return;
784 typedef cmds::GetTexParameterfv::Result Result;
785 Result* result = GetResultAs<Result*>();
786 if (!result) {
787 return;
789 result->SetNumResults(0);
790 helper_->GetTexParameterfv(target, pname,
791 GetResultShmId(), GetResultShmOffset());
792 WaitForCmd();
793 result->CopyResult(params);
794 GPU_CLIENT_LOG_CODE_BLOCK({
795 for (int32 i = 0; i < result->GetNumResults(); ++i) {
796 GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]);
799 CheckGLError();
801 void GLES2Implementation::GetTexParameteriv(
802 GLenum target, GLenum pname, GLint* params) {
803 GPU_CLIENT_SINGLE_THREAD_CHECK();
804 GPU_CLIENT_VALIDATE_DESTINATION_INITALIZATION(GLint, params);
805 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetTexParameteriv(" << GLES2Util::GetStringGetTexParamTarget(target) << ", " << GLES2Util::GetStringTextureParameter(pname) << ", " << static_cast<const void*>(params) << ")"); // NOLINT
806 TRACE_EVENT0("gpu", "GLES2Implementation::GetTexParameteriv");
807 if (GetTexParameterivHelper(target, pname, params)) {
808 return;
810 typedef cmds::GetTexParameteriv::Result Result;
811 Result* result = GetResultAs<Result*>();
812 if (!result) {
813 return;
815 result->SetNumResults(0);
816 helper_->GetTexParameteriv(target, pname,
817 GetResultShmId(), GetResultShmOffset());
818 WaitForCmd();
819 result->CopyResult(params);
820 GPU_CLIENT_LOG_CODE_BLOCK({
821 for (int32 i = 0; i < result->GetNumResults(); ++i) {
822 GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]);
825 CheckGLError();
827 void GLES2Implementation::Hint(GLenum target, GLenum mode) {
828 GPU_CLIENT_SINGLE_THREAD_CHECK();
829 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glHint(" << GLES2Util::GetStringHintTarget(target) << ", " << GLES2Util::GetStringHintMode(mode) << ")"); // NOLINT
830 helper_->Hint(target, mode);
831 CheckGLError();
834 GLboolean GLES2Implementation::IsBuffer(GLuint buffer) {
835 GPU_CLIENT_SINGLE_THREAD_CHECK();
836 TRACE_EVENT0("gpu", "GLES2Implementation::IsBuffer");
837 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glIsBuffer(" << buffer << ")");
838 typedef cmds::IsBuffer::Result Result;
839 Result* result = GetResultAs<Result*>();
840 if (!result) {
841 return GL_FALSE;
843 *result = 0;
844 helper_->IsBuffer(buffer, GetResultShmId(), GetResultShmOffset());
845 WaitForCmd();
846 GLboolean result_value = *result;
847 GPU_CLIENT_LOG("returned " << result_value);
848 CheckGLError();
849 return result_value;
852 GLboolean GLES2Implementation::IsFramebuffer(GLuint framebuffer) {
853 GPU_CLIENT_SINGLE_THREAD_CHECK();
854 TRACE_EVENT0("gpu", "GLES2Implementation::IsFramebuffer");
855 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glIsFramebuffer(" << framebuffer << ")"); // NOLINT
856 typedef cmds::IsFramebuffer::Result Result;
857 Result* result = GetResultAs<Result*>();
858 if (!result) {
859 return GL_FALSE;
861 *result = 0;
862 helper_->IsFramebuffer(framebuffer, GetResultShmId(), GetResultShmOffset());
863 WaitForCmd();
864 GLboolean result_value = *result;
865 GPU_CLIENT_LOG("returned " << result_value);
866 CheckGLError();
867 return result_value;
870 GLboolean GLES2Implementation::IsProgram(GLuint program) {
871 GPU_CLIENT_SINGLE_THREAD_CHECK();
872 TRACE_EVENT0("gpu", "GLES2Implementation::IsProgram");
873 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glIsProgram(" << program << ")");
874 typedef cmds::IsProgram::Result Result;
875 Result* result = GetResultAs<Result*>();
876 if (!result) {
877 return GL_FALSE;
879 *result = 0;
880 helper_->IsProgram(program, GetResultShmId(), GetResultShmOffset());
881 WaitForCmd();
882 GLboolean result_value = *result;
883 GPU_CLIENT_LOG("returned " << result_value);
884 CheckGLError();
885 return result_value;
888 GLboolean GLES2Implementation::IsRenderbuffer(GLuint renderbuffer) {
889 GPU_CLIENT_SINGLE_THREAD_CHECK();
890 TRACE_EVENT0("gpu", "GLES2Implementation::IsRenderbuffer");
891 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glIsRenderbuffer(" << renderbuffer << ")"); // NOLINT
892 typedef cmds::IsRenderbuffer::Result Result;
893 Result* result = GetResultAs<Result*>();
894 if (!result) {
895 return GL_FALSE;
897 *result = 0;
898 helper_->IsRenderbuffer(
899 renderbuffer, GetResultShmId(), GetResultShmOffset());
900 WaitForCmd();
901 GLboolean result_value = *result;
902 GPU_CLIENT_LOG("returned " << result_value);
903 CheckGLError();
904 return result_value;
907 GLboolean GLES2Implementation::IsShader(GLuint shader) {
908 GPU_CLIENT_SINGLE_THREAD_CHECK();
909 TRACE_EVENT0("gpu", "GLES2Implementation::IsShader");
910 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glIsShader(" << shader << ")");
911 typedef cmds::IsShader::Result Result;
912 Result* result = GetResultAs<Result*>();
913 if (!result) {
914 return GL_FALSE;
916 *result = 0;
917 helper_->IsShader(shader, GetResultShmId(), GetResultShmOffset());
918 WaitForCmd();
919 GLboolean result_value = *result;
920 GPU_CLIENT_LOG("returned " << result_value);
921 CheckGLError();
922 return result_value;
925 GLboolean GLES2Implementation::IsTexture(GLuint texture) {
926 GPU_CLIENT_SINGLE_THREAD_CHECK();
927 TRACE_EVENT0("gpu", "GLES2Implementation::IsTexture");
928 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glIsTexture(" << texture << ")");
929 typedef cmds::IsTexture::Result Result;
930 Result* result = GetResultAs<Result*>();
931 if (!result) {
932 return GL_FALSE;
934 *result = 0;
935 helper_->IsTexture(texture, GetResultShmId(), GetResultShmOffset());
936 WaitForCmd();
937 GLboolean result_value = *result;
938 GPU_CLIENT_LOG("returned " << result_value);
939 CheckGLError();
940 return result_value;
943 void GLES2Implementation::LineWidth(GLfloat width) {
944 GPU_CLIENT_SINGLE_THREAD_CHECK();
945 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glLineWidth(" << width << ")");
946 helper_->LineWidth(width);
947 CheckGLError();
950 void GLES2Implementation::PolygonOffset(GLfloat factor, GLfloat units) {
951 GPU_CLIENT_SINGLE_THREAD_CHECK();
952 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glPolygonOffset(" << factor << ", " << units << ")"); // NOLINT
953 helper_->PolygonOffset(factor, units);
954 CheckGLError();
957 void GLES2Implementation::ReleaseShaderCompiler() {
958 GPU_CLIENT_SINGLE_THREAD_CHECK();
959 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glReleaseShaderCompiler(" << ")");
960 helper_->ReleaseShaderCompiler();
961 CheckGLError();
964 void GLES2Implementation::RenderbufferStorage(
965 GLenum target, GLenum internalformat, GLsizei width, GLsizei height) {
966 GPU_CLIENT_SINGLE_THREAD_CHECK();
967 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glRenderbufferStorage(" << GLES2Util::GetStringRenderBufferTarget(target) << ", " << GLES2Util::GetStringRenderBufferFormat(internalformat) << ", " << width << ", " << height << ")"); // NOLINT
968 if (width < 0) {
969 SetGLError(GL_INVALID_VALUE, "glRenderbufferStorage", "width < 0");
970 return;
972 if (height < 0) {
973 SetGLError(GL_INVALID_VALUE, "glRenderbufferStorage", "height < 0");
974 return;
976 helper_->RenderbufferStorage(target, internalformat, width, height);
977 CheckGLError();
980 void GLES2Implementation::SampleCoverage(GLclampf value, GLboolean invert) {
981 GPU_CLIENT_SINGLE_THREAD_CHECK();
982 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glSampleCoverage(" << value << ", " << GLES2Util::GetStringBool(invert) << ")"); // NOLINT
983 helper_->SampleCoverage(value, invert);
984 CheckGLError();
987 void GLES2Implementation::Scissor(
988 GLint x, GLint y, GLsizei width, GLsizei height) {
989 GPU_CLIENT_SINGLE_THREAD_CHECK();
990 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glScissor(" << x << ", " << y << ", " << width << ", " << height << ")"); // NOLINT
991 if (width < 0) {
992 SetGLError(GL_INVALID_VALUE, "glScissor", "width < 0");
993 return;
995 if (height < 0) {
996 SetGLError(GL_INVALID_VALUE, "glScissor", "height < 0");
997 return;
999 helper_->Scissor(x, y, width, height);
1000 CheckGLError();
1003 void GLES2Implementation::StencilFunc(GLenum func, GLint ref, GLuint mask) {
1004 GPU_CLIENT_SINGLE_THREAD_CHECK();
1005 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glStencilFunc(" << GLES2Util::GetStringCmpFunction(func) << ", " << ref << ", " << mask << ")"); // NOLINT
1006 helper_->StencilFunc(func, ref, mask);
1007 CheckGLError();
1010 void GLES2Implementation::StencilFuncSeparate(
1011 GLenum face, GLenum func, GLint ref, GLuint mask) {
1012 GPU_CLIENT_SINGLE_THREAD_CHECK();
1013 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glStencilFuncSeparate(" << GLES2Util::GetStringFaceType(face) << ", " << GLES2Util::GetStringCmpFunction(func) << ", " << ref << ", " << mask << ")"); // NOLINT
1014 helper_->StencilFuncSeparate(face, func, ref, mask);
1015 CheckGLError();
1018 void GLES2Implementation::StencilMask(GLuint mask) {
1019 GPU_CLIENT_SINGLE_THREAD_CHECK();
1020 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glStencilMask(" << mask << ")");
1021 helper_->StencilMask(mask);
1022 CheckGLError();
1025 void GLES2Implementation::StencilMaskSeparate(GLenum face, GLuint mask) {
1026 GPU_CLIENT_SINGLE_THREAD_CHECK();
1027 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glStencilMaskSeparate(" << GLES2Util::GetStringFaceType(face) << ", " << mask << ")"); // NOLINT
1028 helper_->StencilMaskSeparate(face, mask);
1029 CheckGLError();
1032 void GLES2Implementation::StencilOp(GLenum fail, GLenum zfail, GLenum zpass) {
1033 GPU_CLIENT_SINGLE_THREAD_CHECK();
1034 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glStencilOp(" << GLES2Util::GetStringStencilOp(fail) << ", " << GLES2Util::GetStringStencilOp(zfail) << ", " << GLES2Util::GetStringStencilOp(zpass) << ")"); // NOLINT
1035 helper_->StencilOp(fail, zfail, zpass);
1036 CheckGLError();
1039 void GLES2Implementation::StencilOpSeparate(
1040 GLenum face, GLenum fail, GLenum zfail, GLenum zpass) {
1041 GPU_CLIENT_SINGLE_THREAD_CHECK();
1042 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glStencilOpSeparate(" << GLES2Util::GetStringFaceType(face) << ", " << GLES2Util::GetStringStencilOp(fail) << ", " << GLES2Util::GetStringStencilOp(zfail) << ", " << GLES2Util::GetStringStencilOp(zpass) << ")"); // NOLINT
1043 helper_->StencilOpSeparate(face, fail, zfail, zpass);
1044 CheckGLError();
1047 void GLES2Implementation::TexParameterf(
1048 GLenum target, GLenum pname, GLfloat param) {
1049 GPU_CLIENT_SINGLE_THREAD_CHECK();
1050 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glTexParameterf(" << GLES2Util::GetStringTextureBindTarget(target) << ", " << GLES2Util::GetStringTextureParameter(pname) << ", " << param << ")"); // NOLINT
1051 helper_->TexParameterf(target, pname, param);
1052 CheckGLError();
1055 void GLES2Implementation::TexParameterfv(
1056 GLenum target, GLenum pname, const GLfloat* params) {
1057 GPU_CLIENT_SINGLE_THREAD_CHECK();
1058 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glTexParameterfv(" << GLES2Util::GetStringTextureBindTarget(target) << ", " << GLES2Util::GetStringTextureParameter(pname) << ", " << static_cast<const void*>(params) << ")"); // NOLINT
1059 GPU_CLIENT_LOG("values: " << params[0]);
1060 helper_->TexParameterfvImmediate(target, pname, params);
1061 CheckGLError();
1064 void GLES2Implementation::TexParameteri(
1065 GLenum target, GLenum pname, GLint param) {
1066 GPU_CLIENT_SINGLE_THREAD_CHECK();
1067 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glTexParameteri(" << GLES2Util::GetStringTextureBindTarget(target) << ", " << GLES2Util::GetStringTextureParameter(pname) << ", " << param << ")"); // NOLINT
1068 helper_->TexParameteri(target, pname, param);
1069 CheckGLError();
1072 void GLES2Implementation::TexParameteriv(
1073 GLenum target, GLenum pname, const GLint* params) {
1074 GPU_CLIENT_SINGLE_THREAD_CHECK();
1075 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glTexParameteriv(" << GLES2Util::GetStringTextureBindTarget(target) << ", " << GLES2Util::GetStringTextureParameter(pname) << ", " << static_cast<const void*>(params) << ")"); // NOLINT
1076 GPU_CLIENT_LOG("values: " << params[0]);
1077 helper_->TexParameterivImmediate(target, pname, params);
1078 CheckGLError();
1081 void GLES2Implementation::Uniform1f(GLint location, GLfloat x) {
1082 GPU_CLIENT_SINGLE_THREAD_CHECK();
1083 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform1f(" << location << ", " << x << ")"); // NOLINT
1084 helper_->Uniform1f(location, x);
1085 CheckGLError();
1088 void GLES2Implementation::Uniform1fv(
1089 GLint location, GLsizei count, const GLfloat* v) {
1090 GPU_CLIENT_SINGLE_THREAD_CHECK();
1091 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform1fv(" << location << ", " << count << ", " << static_cast<const void*>(v) << ")"); // NOLINT
1092 GPU_CLIENT_LOG_CODE_BLOCK({
1093 for (GLsizei i = 0; i < count; ++i) {
1094 GPU_CLIENT_LOG(" " << i << ": " << v[0 + i * 1]);
1097 if (count < 0) {
1098 SetGLError(GL_INVALID_VALUE, "glUniform1fv", "count < 0");
1099 return;
1101 helper_->Uniform1fvImmediate(location, count, v);
1102 CheckGLError();
1105 void GLES2Implementation::Uniform1i(GLint location, GLint x) {
1106 GPU_CLIENT_SINGLE_THREAD_CHECK();
1107 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform1i(" << location << ", " << x << ")"); // NOLINT
1108 helper_->Uniform1i(location, x);
1109 CheckGLError();
1112 void GLES2Implementation::Uniform1iv(
1113 GLint location, GLsizei count, const GLint* v) {
1114 GPU_CLIENT_SINGLE_THREAD_CHECK();
1115 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform1iv(" << location << ", " << count << ", " << static_cast<const void*>(v) << ")"); // NOLINT
1116 GPU_CLIENT_LOG_CODE_BLOCK({
1117 for (GLsizei i = 0; i < count; ++i) {
1118 GPU_CLIENT_LOG(" " << i << ": " << v[0 + i * 1]);
1121 if (count < 0) {
1122 SetGLError(GL_INVALID_VALUE, "glUniform1iv", "count < 0");
1123 return;
1125 helper_->Uniform1ivImmediate(location, count, v);
1126 CheckGLError();
1129 void GLES2Implementation::Uniform2f(GLint location, GLfloat x, GLfloat y) {
1130 GPU_CLIENT_SINGLE_THREAD_CHECK();
1131 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform2f(" << location << ", " << x << ", " << y << ")"); // NOLINT
1132 helper_->Uniform2f(location, x, y);
1133 CheckGLError();
1136 void GLES2Implementation::Uniform2fv(
1137 GLint location, GLsizei count, const GLfloat* v) {
1138 GPU_CLIENT_SINGLE_THREAD_CHECK();
1139 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform2fv(" << location << ", " << count << ", " << static_cast<const void*>(v) << ")"); // NOLINT
1140 GPU_CLIENT_LOG_CODE_BLOCK({
1141 for (GLsizei i = 0; i < count; ++i) {
1142 GPU_CLIENT_LOG(" " << i << ": " << v[0 + i * 2] << ", " << v[1 + i * 2]); // NOLINT
1145 if (count < 0) {
1146 SetGLError(GL_INVALID_VALUE, "glUniform2fv", "count < 0");
1147 return;
1149 helper_->Uniform2fvImmediate(location, count, v);
1150 CheckGLError();
1153 void GLES2Implementation::Uniform2i(GLint location, GLint x, GLint y) {
1154 GPU_CLIENT_SINGLE_THREAD_CHECK();
1155 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform2i(" << location << ", " << x << ", " << y << ")"); // NOLINT
1156 helper_->Uniform2i(location, x, y);
1157 CheckGLError();
1160 void GLES2Implementation::Uniform2iv(
1161 GLint location, GLsizei count, const GLint* v) {
1162 GPU_CLIENT_SINGLE_THREAD_CHECK();
1163 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform2iv(" << location << ", " << count << ", " << static_cast<const void*>(v) << ")"); // NOLINT
1164 GPU_CLIENT_LOG_CODE_BLOCK({
1165 for (GLsizei i = 0; i < count; ++i) {
1166 GPU_CLIENT_LOG(" " << i << ": " << v[0 + i * 2] << ", " << v[1 + i * 2]); // NOLINT
1169 if (count < 0) {
1170 SetGLError(GL_INVALID_VALUE, "glUniform2iv", "count < 0");
1171 return;
1173 helper_->Uniform2ivImmediate(location, count, v);
1174 CheckGLError();
1177 void GLES2Implementation::Uniform3f(
1178 GLint location, GLfloat x, GLfloat y, GLfloat z) {
1179 GPU_CLIENT_SINGLE_THREAD_CHECK();
1180 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform3f(" << location << ", " << x << ", " << y << ", " << z << ")"); // NOLINT
1181 helper_->Uniform3f(location, x, y, z);
1182 CheckGLError();
1185 void GLES2Implementation::Uniform3fv(
1186 GLint location, GLsizei count, const GLfloat* v) {
1187 GPU_CLIENT_SINGLE_THREAD_CHECK();
1188 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform3fv(" << location << ", " << count << ", " << static_cast<const void*>(v) << ")"); // NOLINT
1189 GPU_CLIENT_LOG_CODE_BLOCK({
1190 for (GLsizei i = 0; i < count; ++i) {
1191 GPU_CLIENT_LOG(" " << i << ": " << v[0 + i * 3] << ", " << v[1 + i * 3] << ", " << v[2 + i * 3]); // NOLINT
1194 if (count < 0) {
1195 SetGLError(GL_INVALID_VALUE, "glUniform3fv", "count < 0");
1196 return;
1198 helper_->Uniform3fvImmediate(location, count, v);
1199 CheckGLError();
1202 void GLES2Implementation::Uniform3i(
1203 GLint location, GLint x, GLint y, GLint z) {
1204 GPU_CLIENT_SINGLE_THREAD_CHECK();
1205 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform3i(" << location << ", " << x << ", " << y << ", " << z << ")"); // NOLINT
1206 helper_->Uniform3i(location, x, y, z);
1207 CheckGLError();
1210 void GLES2Implementation::Uniform3iv(
1211 GLint location, GLsizei count, const GLint* v) {
1212 GPU_CLIENT_SINGLE_THREAD_CHECK();
1213 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform3iv(" << location << ", " << count << ", " << static_cast<const void*>(v) << ")"); // NOLINT
1214 GPU_CLIENT_LOG_CODE_BLOCK({
1215 for (GLsizei i = 0; i < count; ++i) {
1216 GPU_CLIENT_LOG(" " << i << ": " << v[0 + i * 3] << ", " << v[1 + i * 3] << ", " << v[2 + i * 3]); // NOLINT
1219 if (count < 0) {
1220 SetGLError(GL_INVALID_VALUE, "glUniform3iv", "count < 0");
1221 return;
1223 helper_->Uniform3ivImmediate(location, count, v);
1224 CheckGLError();
1227 void GLES2Implementation::Uniform4f(
1228 GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w) {
1229 GPU_CLIENT_SINGLE_THREAD_CHECK();
1230 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform4f(" << location << ", " << x << ", " << y << ", " << z << ", " << w << ")"); // NOLINT
1231 helper_->Uniform4f(location, x, y, z, w);
1232 CheckGLError();
1235 void GLES2Implementation::Uniform4fv(
1236 GLint location, GLsizei count, const GLfloat* v) {
1237 GPU_CLIENT_SINGLE_THREAD_CHECK();
1238 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform4fv(" << location << ", " << count << ", " << static_cast<const void*>(v) << ")"); // NOLINT
1239 GPU_CLIENT_LOG_CODE_BLOCK({
1240 for (GLsizei i = 0; i < count; ++i) {
1241 GPU_CLIENT_LOG(" " << i << ": " << v[0 + i * 4] << ", " << v[1 + i * 4] << ", " << v[2 + i * 4] << ", " << v[3 + i * 4]); // NOLINT
1244 if (count < 0) {
1245 SetGLError(GL_INVALID_VALUE, "glUniform4fv", "count < 0");
1246 return;
1248 helper_->Uniform4fvImmediate(location, count, v);
1249 CheckGLError();
1252 void GLES2Implementation::Uniform4i(
1253 GLint location, GLint x, GLint y, GLint z, GLint w) {
1254 GPU_CLIENT_SINGLE_THREAD_CHECK();
1255 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform4i(" << location << ", " << x << ", " << y << ", " << z << ", " << w << ")"); // NOLINT
1256 helper_->Uniform4i(location, x, y, z, w);
1257 CheckGLError();
1260 void GLES2Implementation::Uniform4iv(
1261 GLint location, GLsizei count, const GLint* v) {
1262 GPU_CLIENT_SINGLE_THREAD_CHECK();
1263 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform4iv(" << location << ", " << count << ", " << static_cast<const void*>(v) << ")"); // NOLINT
1264 GPU_CLIENT_LOG_CODE_BLOCK({
1265 for (GLsizei i = 0; i < count; ++i) {
1266 GPU_CLIENT_LOG(" " << i << ": " << v[0 + i * 4] << ", " << v[1 + i * 4] << ", " << v[2 + i * 4] << ", " << v[3 + i * 4]); // NOLINT
1269 if (count < 0) {
1270 SetGLError(GL_INVALID_VALUE, "glUniform4iv", "count < 0");
1271 return;
1273 helper_->Uniform4ivImmediate(location, count, v);
1274 CheckGLError();
1277 void GLES2Implementation::UniformMatrix2fv(
1278 GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) {
1279 GPU_CLIENT_SINGLE_THREAD_CHECK();
1280 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniformMatrix2fv(" << location << ", " << count << ", " << GLES2Util::GetStringBool(transpose) << ", " << static_cast<const void*>(value) << ")"); // NOLINT
1281 GPU_CLIENT_LOG_CODE_BLOCK({
1282 for (GLsizei i = 0; i < count; ++i) {
1283 GPU_CLIENT_LOG(" " << i << ": " << value[0 + i * 4] << ", " << value[1 + i * 4] << ", " << value[2 + i * 4] << ", " << value[3 + i * 4]); // NOLINT
1286 if (count < 0) {
1287 SetGLError(GL_INVALID_VALUE, "glUniformMatrix2fv", "count < 0");
1288 return;
1290 helper_->UniformMatrix2fvImmediate(location, count, transpose, value);
1291 CheckGLError();
1294 void GLES2Implementation::UniformMatrix3fv(
1295 GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) {
1296 GPU_CLIENT_SINGLE_THREAD_CHECK();
1297 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniformMatrix3fv(" << location << ", " << count << ", " << GLES2Util::GetStringBool(transpose) << ", " << static_cast<const void*>(value) << ")"); // NOLINT
1298 GPU_CLIENT_LOG_CODE_BLOCK({
1299 for (GLsizei i = 0; i < count; ++i) {
1300 GPU_CLIENT_LOG(" " << i << ": " << value[0 + i * 9] << ", " << value[1 + i * 9] << ", " << value[2 + i * 9] << ", " << value[3 + i * 9] << ", " << value[4 + i * 9] << ", " << value[5 + i * 9] << ", " << value[6 + i * 9] << ", " << value[7 + i * 9] << ", " << value[8 + i * 9]); // NOLINT
1303 if (count < 0) {
1304 SetGLError(GL_INVALID_VALUE, "glUniformMatrix3fv", "count < 0");
1305 return;
1307 helper_->UniformMatrix3fvImmediate(location, count, transpose, value);
1308 CheckGLError();
1311 void GLES2Implementation::UniformMatrix4fv(
1312 GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) {
1313 GPU_CLIENT_SINGLE_THREAD_CHECK();
1314 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniformMatrix4fv(" << location << ", " << count << ", " << GLES2Util::GetStringBool(transpose) << ", " << static_cast<const void*>(value) << ")"); // NOLINT
1315 GPU_CLIENT_LOG_CODE_BLOCK({
1316 for (GLsizei i = 0; i < count; ++i) {
1317 GPU_CLIENT_LOG(" " << i << ": " << value[0 + i * 16] << ", " << value[1 + i * 16] << ", " << value[2 + i * 16] << ", " << value[3 + i * 16] << ", " << value[4 + i * 16] << ", " << value[5 + i * 16] << ", " << value[6 + i * 16] << ", " << value[7 + i * 16] << ", " << value[8 + i * 16] << ", " << value[9 + i * 16] << ", " << value[10 + i * 16] << ", " << value[11 + i * 16] << ", " << value[12 + i * 16] << ", " << value[13 + i * 16] << ", " << value[14 + i * 16] << ", " << value[15 + i * 16]); // NOLINT
1320 if (count < 0) {
1321 SetGLError(GL_INVALID_VALUE, "glUniformMatrix4fv", "count < 0");
1322 return;
1324 helper_->UniformMatrix4fvImmediate(location, count, transpose, value);
1325 CheckGLError();
1328 void GLES2Implementation::ValidateProgram(GLuint program) {
1329 GPU_CLIENT_SINGLE_THREAD_CHECK();
1330 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glValidateProgram(" << program << ")"); // NOLINT
1331 helper_->ValidateProgram(program);
1332 CheckGLError();
1335 void GLES2Implementation::VertexAttrib1f(GLuint indx, GLfloat x) {
1336 GPU_CLIENT_SINGLE_THREAD_CHECK();
1337 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glVertexAttrib1f(" << indx << ", " << x << ")"); // NOLINT
1338 helper_->VertexAttrib1f(indx, x);
1339 CheckGLError();
1342 void GLES2Implementation::VertexAttrib1fv(GLuint indx, const GLfloat* values) {
1343 GPU_CLIENT_SINGLE_THREAD_CHECK();
1344 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glVertexAttrib1fv(" << indx << ", " << static_cast<const void*>(values) << ")"); // NOLINT
1345 GPU_CLIENT_LOG("values: " << values[0]);
1346 helper_->VertexAttrib1fvImmediate(indx, values);
1347 CheckGLError();
1350 void GLES2Implementation::VertexAttrib2f(GLuint indx, GLfloat x, GLfloat y) {
1351 GPU_CLIENT_SINGLE_THREAD_CHECK();
1352 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glVertexAttrib2f(" << indx << ", " << x << ", " << y << ")"); // NOLINT
1353 helper_->VertexAttrib2f(indx, x, y);
1354 CheckGLError();
1357 void GLES2Implementation::VertexAttrib2fv(GLuint indx, const GLfloat* values) {
1358 GPU_CLIENT_SINGLE_THREAD_CHECK();
1359 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glVertexAttrib2fv(" << indx << ", " << static_cast<const void*>(values) << ")"); // NOLINT
1360 GPU_CLIENT_LOG("values: " << values[0] << ", " << values[1]);
1361 helper_->VertexAttrib2fvImmediate(indx, values);
1362 CheckGLError();
1365 void GLES2Implementation::VertexAttrib3f(
1366 GLuint indx, GLfloat x, GLfloat y, GLfloat z) {
1367 GPU_CLIENT_SINGLE_THREAD_CHECK();
1368 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glVertexAttrib3f(" << indx << ", " << x << ", " << y << ", " << z << ")"); // NOLINT
1369 helper_->VertexAttrib3f(indx, x, y, z);
1370 CheckGLError();
1373 void GLES2Implementation::VertexAttrib3fv(GLuint indx, const GLfloat* values) {
1374 GPU_CLIENT_SINGLE_THREAD_CHECK();
1375 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glVertexAttrib3fv(" << indx << ", " << static_cast<const void*>(values) << ")"); // NOLINT
1376 GPU_CLIENT_LOG("values: " << values[0] << ", " << values[1] << ", " << values[2]); // NOLINT
1377 helper_->VertexAttrib3fvImmediate(indx, values);
1378 CheckGLError();
1381 void GLES2Implementation::VertexAttrib4f(
1382 GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w) {
1383 GPU_CLIENT_SINGLE_THREAD_CHECK();
1384 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glVertexAttrib4f(" << indx << ", " << x << ", " << y << ", " << z << ", " << w << ")"); // NOLINT
1385 helper_->VertexAttrib4f(indx, x, y, z, w);
1386 CheckGLError();
1389 void GLES2Implementation::VertexAttrib4fv(GLuint indx, const GLfloat* values) {
1390 GPU_CLIENT_SINGLE_THREAD_CHECK();
1391 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glVertexAttrib4fv(" << indx << ", " << static_cast<const void*>(values) << ")"); // NOLINT
1392 GPU_CLIENT_LOG("values: " << values[0] << ", " << values[1] << ", " << values[2] << ", " << values[3]); // NOLINT
1393 helper_->VertexAttrib4fvImmediate(indx, values);
1394 CheckGLError();
1397 void GLES2Implementation::Viewport(
1398 GLint x, GLint y, GLsizei width, GLsizei height) {
1399 GPU_CLIENT_SINGLE_THREAD_CHECK();
1400 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glViewport(" << x << ", " << y << ", " << width << ", " << height << ")"); // NOLINT
1401 if (width < 0) {
1402 SetGLError(GL_INVALID_VALUE, "glViewport", "width < 0");
1403 return;
1405 if (height < 0) {
1406 SetGLError(GL_INVALID_VALUE, "glViewport", "height < 0");
1407 return;
1409 helper_->Viewport(x, y, width, height);
1410 CheckGLError();
1413 void GLES2Implementation::BlitFramebufferCHROMIUM(
1414 GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0,
1415 GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter) {
1416 GPU_CLIENT_SINGLE_THREAD_CHECK();
1417 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBlitFramebufferCHROMIUM(" << srcX0 << ", " << srcY0 << ", " << srcX1 << ", " << srcY1 << ", " << dstX0 << ", " << dstY0 << ", " << dstX1 << ", " << dstY1 << ", " << mask << ", " << GLES2Util::GetStringBlitFilter(filter) << ")"); // NOLINT
1418 helper_->BlitFramebufferCHROMIUM(
1419 srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter);
1420 CheckGLError();
1423 void GLES2Implementation::RenderbufferStorageMultisampleCHROMIUM(
1424 GLenum target, GLsizei samples, GLenum internalformat, GLsizei width,
1425 GLsizei height) {
1426 GPU_CLIENT_SINGLE_THREAD_CHECK();
1427 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glRenderbufferStorageMultisampleCHROMIUM(" << GLES2Util::GetStringRenderBufferTarget(target) << ", " << samples << ", " << GLES2Util::GetStringRenderBufferFormat(internalformat) << ", " << width << ", " << height << ")"); // NOLINT
1428 if (samples < 0) {
1429 SetGLError(
1430 GL_INVALID_VALUE, "glRenderbufferStorageMultisampleCHROMIUM", "samples < 0"); // NOLINT
1431 return;
1433 if (width < 0) {
1434 SetGLError(
1435 GL_INVALID_VALUE, "glRenderbufferStorageMultisampleCHROMIUM", "width < 0"); // NOLINT
1436 return;
1438 if (height < 0) {
1439 SetGLError(
1440 GL_INVALID_VALUE, "glRenderbufferStorageMultisampleCHROMIUM", "height < 0"); // NOLINT
1441 return;
1443 helper_->RenderbufferStorageMultisampleCHROMIUM(
1444 target, samples, internalformat, width, height);
1445 CheckGLError();
1448 void GLES2Implementation::RenderbufferStorageMultisampleEXT(
1449 GLenum target, GLsizei samples, GLenum internalformat, GLsizei width,
1450 GLsizei height) {
1451 GPU_CLIENT_SINGLE_THREAD_CHECK();
1452 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glRenderbufferStorageMultisampleEXT(" << GLES2Util::GetStringRenderBufferTarget(target) << ", " << samples << ", " << GLES2Util::GetStringRenderBufferFormat(internalformat) << ", " << width << ", " << height << ")"); // NOLINT
1453 if (samples < 0) {
1454 SetGLError(
1455 GL_INVALID_VALUE, "glRenderbufferStorageMultisampleEXT", "samples < 0");
1456 return;
1458 if (width < 0) {
1459 SetGLError(
1460 GL_INVALID_VALUE, "glRenderbufferStorageMultisampleEXT", "width < 0");
1461 return;
1463 if (height < 0) {
1464 SetGLError(
1465 GL_INVALID_VALUE, "glRenderbufferStorageMultisampleEXT", "height < 0");
1466 return;
1468 helper_->RenderbufferStorageMultisampleEXT(
1469 target, samples, internalformat, width, height);
1470 CheckGLError();
1473 void GLES2Implementation::FramebufferTexture2DMultisampleEXT(
1474 GLenum target, GLenum attachment, GLenum textarget, GLuint texture,
1475 GLint level, GLsizei samples) {
1476 GPU_CLIENT_SINGLE_THREAD_CHECK();
1477 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glFramebufferTexture2DMultisampleEXT(" << GLES2Util::GetStringFrameBufferTarget(target) << ", " << GLES2Util::GetStringAttachment(attachment) << ", " << GLES2Util::GetStringTextureTarget(textarget) << ", " << texture << ", " << level << ", " << samples << ")"); // NOLINT
1478 if (samples < 0) {
1479 SetGLError(
1480 GL_INVALID_VALUE, "glFramebufferTexture2DMultisampleEXT", "samples < 0"); // NOLINT
1481 return;
1483 helper_->FramebufferTexture2DMultisampleEXT(
1484 target, attachment, textarget, texture, level, samples);
1485 CheckGLError();
1488 void GLES2Implementation::TexStorage2DEXT(
1489 GLenum target, GLsizei levels, GLenum internalFormat, GLsizei width,
1490 GLsizei height) {
1491 GPU_CLIENT_SINGLE_THREAD_CHECK();
1492 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glTexStorage2DEXT(" << GLES2Util::GetStringTextureTarget(target) << ", " << levels << ", " << GLES2Util::GetStringTextureInternalFormatStorage(internalFormat) << ", " << width << ", " << height << ")"); // NOLINT
1493 if (levels < 0) {
1494 SetGLError(GL_INVALID_VALUE, "glTexStorage2DEXT", "levels < 0");
1495 return;
1497 if (width < 0) {
1498 SetGLError(GL_INVALID_VALUE, "glTexStorage2DEXT", "width < 0");
1499 return;
1501 if (height < 0) {
1502 SetGLError(GL_INVALID_VALUE, "glTexStorage2DEXT", "height < 0");
1503 return;
1505 helper_->TexStorage2DEXT(target, levels, internalFormat, width, height);
1506 CheckGLError();
1509 void GLES2Implementation::GenQueriesEXT(GLsizei n, GLuint* queries) {
1510 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGenQueriesEXT(" << n << ", " << static_cast<const void*>(queries) << ")"); // NOLINT
1511 if (n < 0) {
1512 SetGLError(GL_INVALID_VALUE, "glGenQueriesEXT", "n < 0");
1513 return;
1515 GPU_CLIENT_SINGLE_THREAD_CHECK();
1516 GetIdHandler(id_namespaces::kQueries)->
1517 MakeIds(this, 0, n, queries);
1518 GenQueriesEXTHelper(n, queries);
1519 helper_->GenQueriesEXTImmediate(n, queries);
1520 helper_->CommandBufferHelper::Flush();
1521 GPU_CLIENT_LOG_CODE_BLOCK({
1522 for (GLsizei i = 0; i < n; ++i) {
1523 GPU_CLIENT_LOG(" " << i << ": " << queries[i]);
1526 CheckGLError();
1529 void GLES2Implementation::DeleteQueriesEXT(GLsizei n, const GLuint* queries) {
1530 GPU_CLIENT_SINGLE_THREAD_CHECK();
1531 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDeleteQueriesEXT(" << n << ", " << static_cast<const void*>(queries) << ")"); // NOLINT
1532 GPU_CLIENT_LOG_CODE_BLOCK({
1533 for (GLsizei i = 0; i < n; ++i) {
1534 GPU_CLIENT_LOG(" " << i << ": " << queries[i]);
1537 GPU_CLIENT_DCHECK_CODE_BLOCK({
1538 for (GLsizei i = 0; i < n; ++i) {
1539 DCHECK(queries[i] != 0);
1542 if (n < 0) {
1543 SetGLError(GL_INVALID_VALUE, "glDeleteQueriesEXT", "n < 0");
1544 return;
1546 DeleteQueriesEXTHelper(n, queries);
1547 CheckGLError();
1550 void GLES2Implementation::GenVertexArraysOES(GLsizei n, GLuint* arrays) {
1551 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGenVertexArraysOES(" << n << ", " << static_cast<const void*>(arrays) << ")"); // NOLINT
1552 if (n < 0) {
1553 SetGLError(GL_INVALID_VALUE, "glGenVertexArraysOES", "n < 0");
1554 return;
1556 GPU_CLIENT_SINGLE_THREAD_CHECK();
1557 GetIdHandler(id_namespaces::kVertexArrays)->
1558 MakeIds(this, 0, n, arrays);
1559 GenVertexArraysOESHelper(n, arrays);
1560 helper_->GenVertexArraysOESImmediate(n, arrays);
1561 helper_->CommandBufferHelper::Flush();
1562 GPU_CLIENT_LOG_CODE_BLOCK({
1563 for (GLsizei i = 0; i < n; ++i) {
1564 GPU_CLIENT_LOG(" " << i << ": " << arrays[i]);
1567 CheckGLError();
1570 void GLES2Implementation::DeleteVertexArraysOES(
1571 GLsizei n, const GLuint* arrays) {
1572 GPU_CLIENT_SINGLE_THREAD_CHECK();
1573 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDeleteVertexArraysOES(" << n << ", " << static_cast<const void*>(arrays) << ")"); // NOLINT
1574 GPU_CLIENT_LOG_CODE_BLOCK({
1575 for (GLsizei i = 0; i < n; ++i) {
1576 GPU_CLIENT_LOG(" " << i << ": " << arrays[i]);
1579 GPU_CLIENT_DCHECK_CODE_BLOCK({
1580 for (GLsizei i = 0; i < n; ++i) {
1581 DCHECK(arrays[i] != 0);
1584 if (n < 0) {
1585 SetGLError(GL_INVALID_VALUE, "glDeleteVertexArraysOES", "n < 0");
1586 return;
1588 DeleteVertexArraysOESHelper(n, arrays);
1589 CheckGLError();
1592 GLboolean GLES2Implementation::IsVertexArrayOES(GLuint array) {
1593 GPU_CLIENT_SINGLE_THREAD_CHECK();
1594 TRACE_EVENT0("gpu", "GLES2Implementation::IsVertexArrayOES");
1595 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glIsVertexArrayOES(" << array << ")"); // NOLINT
1596 typedef cmds::IsVertexArrayOES::Result Result;
1597 Result* result = GetResultAs<Result*>();
1598 if (!result) {
1599 return GL_FALSE;
1601 *result = 0;
1602 helper_->IsVertexArrayOES(array, GetResultShmId(), GetResultShmOffset());
1603 WaitForCmd();
1604 GLboolean result_value = *result;
1605 GPU_CLIENT_LOG("returned " << result_value);
1606 CheckGLError();
1607 return result_value;
1610 void GLES2Implementation::BindVertexArrayOES(GLuint array) {
1611 GPU_CLIENT_SINGLE_THREAD_CHECK();
1612 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBindVertexArrayOES(" << array << ")"); // NOLINT
1613 if (IsVertexArrayReservedId(array)) {
1614 SetGLError(
1615 GL_INVALID_OPERATION, "BindVertexArrayOES", "array reserved id");
1616 return;
1618 if (BindVertexArrayHelper(array)) {
1619 helper_->BindVertexArrayOES(array);
1621 CheckGLError();
1624 void GLES2Implementation::GetTranslatedShaderSourceANGLE(
1625 GLuint shader, GLsizei bufsize, GLsizei* length, char* source) {
1626 GPU_CLIENT_SINGLE_THREAD_CHECK();
1627 GPU_CLIENT_VALIDATE_DESTINATION_OPTIONAL_INITALIZATION(GLsizei, length);
1628 GPU_CLIENT_LOG("[" << GetLogPrefix()
1629 << "] glGetTranslatedShaderSourceANGLE" << "("
1630 << shader << ", "
1631 << bufsize << ", "
1632 << static_cast<void*>(length) << ", "
1633 << static_cast<void*>(source) << ")");
1634 helper_->SetBucketSize(kResultBucketId, 0);
1635 helper_->GetTranslatedShaderSourceANGLE(shader, kResultBucketId);
1636 std::string str;
1637 GLsizei max_size = 0;
1638 if (GetBucketAsString(kResultBucketId, &str)) {
1639 if (bufsize > 0) {
1640 max_size =
1641 std::min(static_cast<size_t>(bufsize) - 1, str.size());
1642 memcpy(source, str.c_str(), max_size);
1643 source[max_size] = '\0';
1644 GPU_CLIENT_LOG("------\n" << source << "\n------");
1647 if (length != NULL) {
1648 *length = max_size;
1650 CheckGLError();
1652 void GLES2Implementation::TexImageIOSurface2DCHROMIUM(
1653 GLenum target, GLsizei width, GLsizei height, GLuint ioSurfaceId,
1654 GLuint plane) {
1655 GPU_CLIENT_SINGLE_THREAD_CHECK();
1656 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glTexImageIOSurface2DCHROMIUM(" << GLES2Util::GetStringTextureBindTarget(target) << ", " << width << ", " << height << ", " << ioSurfaceId << ", " << plane << ")"); // NOLINT
1657 if (width < 0) {
1658 SetGLError(GL_INVALID_VALUE, "glTexImageIOSurface2DCHROMIUM", "width < 0");
1659 return;
1661 if (height < 0) {
1662 SetGLError(
1663 GL_INVALID_VALUE, "glTexImageIOSurface2DCHROMIUM", "height < 0");
1664 return;
1666 helper_->TexImageIOSurface2DCHROMIUM(
1667 target, width, height, ioSurfaceId, plane);
1668 CheckGLError();
1671 void GLES2Implementation::CopyTextureCHROMIUM(
1672 GLenum target, GLenum source_id, GLenum dest_id, GLint level,
1673 GLint internalformat, GLenum dest_type) {
1674 GPU_CLIENT_SINGLE_THREAD_CHECK();
1675 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glCopyTextureCHROMIUM(" << GLES2Util::GetStringEnum(target) << ", " << GLES2Util::GetStringEnum(source_id) << ", " << GLES2Util::GetStringEnum(dest_id) << ", " << level << ", " << internalformat << ", " << GLES2Util::GetStringPixelType(dest_type) << ")"); // NOLINT
1676 helper_->CopyTextureCHROMIUM(
1677 target, source_id, dest_id, level, internalformat, dest_type);
1678 CheckGLError();
1681 void GLES2Implementation::ProduceTextureCHROMIUM(
1682 GLenum target, const GLbyte* mailbox) {
1683 GPU_CLIENT_SINGLE_THREAD_CHECK();
1684 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glProduceTextureCHROMIUM(" << GLES2Util::GetStringTextureBindTarget(target) << ", " << static_cast<const void*>(mailbox) << ")"); // NOLINT
1685 GPU_CLIENT_LOG("values: " << mailbox[0] << ", " << mailbox[1] << ", " << mailbox[2] << ", " << mailbox[3] << ", " << mailbox[4] << ", " << mailbox[5] << ", " << mailbox[6] << ", " << mailbox[7] << ", " << mailbox[8] << ", " << mailbox[9] << ", " << mailbox[10] << ", " << mailbox[11] << ", " << mailbox[12] << ", " << mailbox[13] << ", " << mailbox[14] << ", " << mailbox[15] << ", " << mailbox[16] << ", " << mailbox[17] << ", " << mailbox[18] << ", " << mailbox[19] << ", " << mailbox[20] << ", " << mailbox[21] << ", " << mailbox[22] << ", " << mailbox[23] << ", " << mailbox[24] << ", " << mailbox[25] << ", " << mailbox[26] << ", " << mailbox[27] << ", " << mailbox[28] << ", " << mailbox[29] << ", " << mailbox[30] << ", " << mailbox[31] << ", " << mailbox[32] << ", " << mailbox[33] << ", " << mailbox[34] << ", " << mailbox[35] << ", " << mailbox[36] << ", " << mailbox[37] << ", " << mailbox[38] << ", " << mailbox[39] << ", " << mailbox[40] << ", " << mailbox[41] << ", " << mailbox[42] << ", " << mailbox[43] << ", " << mailbox[44] << ", " << mailbox[45] << ", " << mailbox[46] << ", " << mailbox[47] << ", " << mailbox[48] << ", " << mailbox[49] << ", " << mailbox[50] << ", " << mailbox[51] << ", " << mailbox[52] << ", " << mailbox[53] << ", " << mailbox[54] << ", " << mailbox[55] << ", " << mailbox[56] << ", " << mailbox[57] << ", " << mailbox[58] << ", " << mailbox[59] << ", " << mailbox[60] << ", " << mailbox[61] << ", " << mailbox[62] << ", " << mailbox[63]); // NOLINT
1686 helper_->ProduceTextureCHROMIUMImmediate(target, mailbox);
1687 CheckGLError();
1690 void GLES2Implementation::ConsumeTextureCHROMIUM(
1691 GLenum target, const GLbyte* mailbox) {
1692 GPU_CLIENT_SINGLE_THREAD_CHECK();
1693 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glConsumeTextureCHROMIUM(" << GLES2Util::GetStringTextureBindTarget(target) << ", " << static_cast<const void*>(mailbox) << ")"); // NOLINT
1694 GPU_CLIENT_LOG("values: " << mailbox[0] << ", " << mailbox[1] << ", " << mailbox[2] << ", " << mailbox[3] << ", " << mailbox[4] << ", " << mailbox[5] << ", " << mailbox[6] << ", " << mailbox[7] << ", " << mailbox[8] << ", " << mailbox[9] << ", " << mailbox[10] << ", " << mailbox[11] << ", " << mailbox[12] << ", " << mailbox[13] << ", " << mailbox[14] << ", " << mailbox[15] << ", " << mailbox[16] << ", " << mailbox[17] << ", " << mailbox[18] << ", " << mailbox[19] << ", " << mailbox[20] << ", " << mailbox[21] << ", " << mailbox[22] << ", " << mailbox[23] << ", " << mailbox[24] << ", " << mailbox[25] << ", " << mailbox[26] << ", " << mailbox[27] << ", " << mailbox[28] << ", " << mailbox[29] << ", " << mailbox[30] << ", " << mailbox[31] << ", " << mailbox[32] << ", " << mailbox[33] << ", " << mailbox[34] << ", " << mailbox[35] << ", " << mailbox[36] << ", " << mailbox[37] << ", " << mailbox[38] << ", " << mailbox[39] << ", " << mailbox[40] << ", " << mailbox[41] << ", " << mailbox[42] << ", " << mailbox[43] << ", " << mailbox[44] << ", " << mailbox[45] << ", " << mailbox[46] << ", " << mailbox[47] << ", " << mailbox[48] << ", " << mailbox[49] << ", " << mailbox[50] << ", " << mailbox[51] << ", " << mailbox[52] << ", " << mailbox[53] << ", " << mailbox[54] << ", " << mailbox[55] << ", " << mailbox[56] << ", " << mailbox[57] << ", " << mailbox[58] << ", " << mailbox[59] << ", " << mailbox[60] << ", " << mailbox[61] << ", " << mailbox[62] << ", " << mailbox[63]); // NOLINT
1695 helper_->ConsumeTextureCHROMIUMImmediate(target, mailbox);
1696 CheckGLError();
1699 void GLES2Implementation::BindTexImage2DCHROMIUM(
1700 GLenum target, GLint imageId) {
1701 GPU_CLIENT_SINGLE_THREAD_CHECK();
1702 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBindTexImage2DCHROMIUM(" << GLES2Util::GetStringTextureBindTarget(target) << ", " << imageId << ")"); // NOLINT
1703 helper_->BindTexImage2DCHROMIUM(target, imageId);
1704 CheckGLError();
1707 void GLES2Implementation::ReleaseTexImage2DCHROMIUM(
1708 GLenum target, GLint imageId) {
1709 GPU_CLIENT_SINGLE_THREAD_CHECK();
1710 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glReleaseTexImage2DCHROMIUM(" << GLES2Util::GetStringTextureBindTarget(target) << ", " << imageId << ")"); // NOLINT
1711 helper_->ReleaseTexImage2DCHROMIUM(target, imageId);
1712 CheckGLError();
1715 void GLES2Implementation::DiscardFramebufferEXT(
1716 GLenum target, GLsizei count, const GLenum* attachments) {
1717 GPU_CLIENT_SINGLE_THREAD_CHECK();
1718 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDiscardFramebufferEXT(" << GLES2Util::GetStringEnum(target) << ", " << count << ", " << static_cast<const void*>(attachments) << ")"); // NOLINT
1719 GPU_CLIENT_LOG_CODE_BLOCK({
1720 for (GLsizei i = 0; i < count; ++i) {
1721 GPU_CLIENT_LOG(" " << i << ": " << attachments[0 + i * 1]);
1724 if (count < 0) {
1725 SetGLError(GL_INVALID_VALUE, "glDiscardFramebufferEXT", "count < 0");
1726 return;
1728 helper_->DiscardFramebufferEXTImmediate(target, count, attachments);
1729 CheckGLError();
1732 void GLES2Implementation::LoseContextCHROMIUM(GLenum current, GLenum other) {
1733 GPU_CLIENT_SINGLE_THREAD_CHECK();
1734 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glLoseContextCHROMIUM(" << GLES2Util::GetStringEnum(current) << ", " << GLES2Util::GetStringEnum(other) << ")"); // NOLINT
1735 helper_->LoseContextCHROMIUM(current, other);
1736 CheckGLError();
1739 void GLES2Implementation::WaitSyncPointCHROMIUM(GLuint sync_point) {
1740 GPU_CLIENT_SINGLE_THREAD_CHECK();
1741 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glWaitSyncPointCHROMIUM(" << sync_point << ")"); // NOLINT
1742 helper_->WaitSyncPointCHROMIUM(sync_point);
1743 CheckGLError();
1746 void GLES2Implementation::DrawBuffersEXT(GLsizei count, const GLenum* bufs) {
1747 GPU_CLIENT_SINGLE_THREAD_CHECK();
1748 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDrawBuffersEXT(" << count << ", " << static_cast<const void*>(bufs) << ")"); // NOLINT
1749 GPU_CLIENT_LOG_CODE_BLOCK({
1750 for (GLsizei i = 0; i < count; ++i) {
1751 GPU_CLIENT_LOG(" " << i << ": " << bufs[0 + i * 1]);
1754 if (count < 0) {
1755 SetGLError(GL_INVALID_VALUE, "glDrawBuffersEXT", "count < 0");
1756 return;
1758 helper_->DrawBuffersEXTImmediate(count, bufs);
1759 CheckGLError();
1762 void GLES2Implementation::DiscardBackbufferCHROMIUM() {
1763 GPU_CLIENT_SINGLE_THREAD_CHECK();
1764 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDiscardBackbufferCHROMIUM(" << ")"); // NOLINT
1765 helper_->DiscardBackbufferCHROMIUM();
1766 CheckGLError();
1769 #endif // GPU_COMMAND_BUFFER_CLIENT_GLES2_IMPLEMENTATION_IMPL_AUTOGEN_H_