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
11 // This file is included by gles2_implementation.cc to define the
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
<< ", "
20 helper_
->AttachShader(program
, shader
);
24 void GLES2Implementation::BindBuffer(GLenum target
, GLuint buffer
) {
25 GPU_CLIENT_SINGLE_THREAD_CHECK();
26 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBindBuffer("
27 << GLES2Util::GetStringBufferTarget(target
) << ", "
29 if (IsBufferReservedId(buffer
)) {
30 SetGLError(GL_INVALID_OPERATION
, "BindBuffer", "buffer reserved id");
33 if (BindBufferHelper(target
, buffer
)) {
34 helper_
->BindBuffer(target
, buffer
);
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");
49 if (BindFramebufferHelper(target
, framebuffer
)) {
50 helper_
->BindFramebuffer(target
, framebuffer
);
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");
65 if (BindRenderbufferHelper(target
, renderbuffer
)) {
66 helper_
->BindRenderbuffer(target
, renderbuffer
);
71 void GLES2Implementation::BindTexture(GLenum target
, GLuint texture
) {
72 GPU_CLIENT_SINGLE_THREAD_CHECK();
73 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBindTexture("
74 << GLES2Util::GetStringTextureBindTarget(target
) << ", "
76 if (IsTextureReservedId(texture
)) {
77 SetGLError(GL_INVALID_OPERATION
, "BindTexture", "texture reserved id");
80 if (BindTextureHelper(target
, texture
)) {
81 helper_
->BindTexture(target
, texture
);
86 void GLES2Implementation::BlendColor(GLclampf red
,
90 GPU_CLIENT_SINGLE_THREAD_CHECK();
91 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBlendColor(" << red
<< ", "
92 << green
<< ", " << blue
<< ", " << alpha
<< ")");
93 helper_
->BlendColor(red
, green
, blue
, alpha
);
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
);
105 void GLES2Implementation::BlendEquationSeparate(GLenum modeRGB
,
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
);
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
);
124 void GLES2Implementation::BlendFuncSeparate(GLenum srcRGB
,
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
);
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
*>();
146 return GL_FRAMEBUFFER_UNSUPPORTED
;
149 helper_
->CheckFramebufferStatus(target
, GetResultShmId(),
150 GetResultShmOffset());
152 GLenum result_value
= *result
;
153 GPU_CLIENT_LOG("returned " << 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
);
165 void GLES2Implementation::ClearColor(GLclampf red
,
169 GPU_CLIENT_SINGLE_THREAD_CHECK();
170 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glClearColor(" << red
<< ", "
171 << green
<< ", " << blue
<< ", " << alpha
<< ")");
172 helper_
->ClearColor(red
, green
, blue
, alpha
);
176 void GLES2Implementation::ClearDepthf(GLclampf depth
) {
177 GPU_CLIENT_SINGLE_THREAD_CHECK();
178 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glClearDepthf(" << depth
<< ")");
179 helper_
->ClearDepthf(depth
);
183 void GLES2Implementation::ClearStencil(GLint s
) {
184 GPU_CLIENT_SINGLE_THREAD_CHECK();
185 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glClearStencil(" << s
<< ")");
186 helper_
->ClearStencil(s
);
190 void GLES2Implementation::ColorMask(GLboolean red
,
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
);
204 void GLES2Implementation::CompileShader(GLuint shader
) {
205 GPU_CLIENT_SINGLE_THREAD_CHECK();
206 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glCompileShader(" << shader
208 helper_
->CompileShader(shader
);
212 void GLES2Implementation::CopyTexImage2D(GLenum target
,
214 GLenum internalformat
,
220 GPU_CLIENT_SINGLE_THREAD_CHECK();
222 "[" << GetLogPrefix() << "] glCopyTexImage2D("
223 << GLES2Util::GetStringTextureTarget(target
) << ", " << level
<< ", "
224 << GLES2Util::GetStringTextureInternalFormat(internalformat
) << ", "
225 << x
<< ", " << y
<< ", " << width
<< ", " << height
<< ", " << border
228 SetGLError(GL_INVALID_VALUE
, "glCopyTexImage2D", "width < 0");
232 SetGLError(GL_INVALID_VALUE
, "glCopyTexImage2D", "height < 0");
236 SetGLError(GL_INVALID_VALUE
, "glCopyTexImage2D", "border GL_INVALID_VALUE");
239 helper_
->CopyTexImage2D(target
, level
, internalformat
, x
, y
, width
, height
);
243 void GLES2Implementation::CopyTexSubImage2D(GLenum target
,
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
<< ")");
257 SetGLError(GL_INVALID_VALUE
, "glCopyTexSubImage2D", "width < 0");
261 SetGLError(GL_INVALID_VALUE
, "glCopyTexSubImage2D", "height < 0");
264 helper_
->CopyTexSubImage2D(target
, level
, xoffset
, yoffset
, x
, y
, width
,
269 GLuint
GLES2Implementation::CreateProgram() {
270 GPU_CLIENT_SINGLE_THREAD_CHECK();
271 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glCreateProgram("
274 GetIdHandler(id_namespaces::kProgramsAndShaders
)
275 ->MakeIds(this, 0, 1, &client_id
);
276 helper_
->CreateProgram(client_id
);
277 GPU_CLIENT_LOG("returned " << client_id
);
282 GLuint
GLES2Implementation::CreateShader(GLenum type
) {
283 GPU_CLIENT_SINGLE_THREAD_CHECK();
284 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glCreateShader("
285 << GLES2Util::GetStringShaderType(type
) << ")");
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
);
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
);
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);
318 SetGLError(GL_INVALID_VALUE
, "glDeleteBuffers", "n < 0");
321 DeleteBuffersHelper(n
, buffers
);
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);
341 SetGLError(GL_INVALID_VALUE
, "glDeleteFramebuffers", "n < 0");
344 DeleteFramebuffersHelper(n
, framebuffers
);
348 void GLES2Implementation::DeleteProgram(GLuint program
) {
349 GPU_CLIENT_SINGLE_THREAD_CHECK();
350 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDeleteProgram(" << program
352 GPU_CLIENT_DCHECK(program
!= 0);
353 DeleteProgramHelper(program
);
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);
373 SetGLError(GL_INVALID_VALUE
, "glDeleteRenderbuffers", "n < 0");
376 DeleteRenderbuffersHelper(n
, renderbuffers
);
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
);
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);
403 SetGLError(GL_INVALID_VALUE
, "glDeleteTextures", "n < 0");
406 DeleteTexturesHelper(n
, textures
);
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
);
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
);
426 void GLES2Implementation::DepthRangef(GLclampf zNear
, GLclampf zFar
) {
427 GPU_CLIENT_SINGLE_THREAD_CHECK();
428 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDepthRangef(" << zNear
<< ", "
430 helper_
->DepthRangef(zNear
, zFar
);
434 void GLES2Implementation::DetachShader(GLuint program
, GLuint shader
) {
435 GPU_CLIENT_SINGLE_THREAD_CHECK();
436 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDetachShader(" << program
<< ", "
438 helper_
->DetachShader(program
, shader
);
442 void GLES2Implementation::FramebufferRenderbuffer(GLenum target
,
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
,
457 void GLES2Implementation::FramebufferTexture2D(GLenum target
,
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
<< ")");
469 SetGLError(GL_INVALID_VALUE
, "glFramebufferTexture2D",
470 "level GL_INVALID_VALUE");
473 helper_
->FramebufferTexture2D(target
, attachment
, textarget
, texture
);
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
);
485 void GLES2Implementation::GenBuffers(GLsizei n
, GLuint
* buffers
) {
486 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGenBuffers(" << n
<< ", "
487 << static_cast<const void*>(buffers
) << ")");
489 SetGLError(GL_INVALID_VALUE
, "glGenBuffers", "n < 0");
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
]);
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
);
514 void GLES2Implementation::GenFramebuffers(GLsizei n
, GLuint
* framebuffers
) {
515 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGenFramebuffers(" << n
<< ", "
516 << static_cast<const void*>(framebuffers
) << ")");
518 SetGLError(GL_INVALID_VALUE
, "glGenFramebuffers", "n < 0");
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
]);
535 void GLES2Implementation::GenRenderbuffers(GLsizei n
, GLuint
* renderbuffers
) {
536 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGenRenderbuffers(" << n
<< ", "
537 << static_cast<const void*>(renderbuffers
) << ")");
539 SetGLError(GL_INVALID_VALUE
, "glGenRenderbuffers", "n < 0");
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
]);
557 void GLES2Implementation::GenTextures(GLsizei n
, GLuint
* textures
) {
558 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGenTextures(" << n
<< ", "
559 << static_cast<const void*>(textures
) << ")");
561 SetGLError(GL_INVALID_VALUE
, "glGenTextures", "n < 0");
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
]);
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
)) {
588 typedef cmds::GetBooleanv::Result Result
;
589 Result
* result
= GetResultAs
<Result
*>();
593 result
->SetNumResults(0);
594 helper_
->GetBooleanv(pname
, GetResultShmId(), GetResultShmOffset());
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
]);
604 void GLES2Implementation::GetBufferParameteriv(GLenum target
,
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
)) {
617 typedef cmds::GetBufferParameteriv::Result Result
;
618 Result
* result
= GetResultAs
<Result
*>();
622 result
->SetNumResults(0);
623 helper_
->GetBufferParameteriv(target
, pname
, GetResultShmId(),
624 GetResultShmOffset());
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
]);
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
)) {
643 typedef cmds::GetFloatv::Result Result
;
644 Result
* result
= GetResultAs
<Result
*>();
648 result
->SetNumResults(0);
649 helper_
->GetFloatv(pname
, GetResultShmId(), GetResultShmOffset());
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
]);
659 void GLES2Implementation::GetFramebufferAttachmentParameteriv(GLenum target
,
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
) << ")");
672 "GLES2Implementation::GetFramebufferAttachmentParameteriv");
673 if (GetFramebufferAttachmentParameterivHelper(target
, attachment
, pname
,
677 typedef cmds::GetFramebufferAttachmentParameteriv::Result Result
;
678 Result
* result
= GetResultAs
<Result
*>();
682 result
->SetNumResults(0);
683 helper_
->GetFramebufferAttachmentParameteriv(
684 target
, attachment
, pname
, GetResultShmId(), GetResultShmOffset());
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
]);
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
)) {
704 typedef cmds::GetIntegerv::Result Result
;
705 Result
* result
= GetResultAs
<Result
*>();
709 result
->SetNumResults(0);
710 helper_
->GetIntegerv(pname
, GetResultShmId(), GetResultShmOffset());
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
]);
720 void GLES2Implementation::GetProgramiv(GLuint program
,
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
)) {
732 typedef cmds::GetProgramiv::Result Result
;
733 Result
* result
= GetResultAs
<Result
*>();
737 result
->SetNumResults(0);
738 helper_
->GetProgramiv(program
, pname
, GetResultShmId(), GetResultShmOffset());
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
]);
748 void GLES2Implementation::GetProgramInfoLog(GLuint program
,
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
);
761 GLsizei max_size
= 0;
762 if (GetBucketAsString(kResultBucketId
, &str
)) {
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
) {
775 void GLES2Implementation::GetRenderbufferParameteriv(GLenum target
,
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
)) {
788 typedef cmds::GetRenderbufferParameteriv::Result Result
;
789 Result
* result
= GetResultAs
<Result
*>();
793 result
->SetNumResults(0);
794 helper_
->GetRenderbufferParameteriv(target
, pname
, GetResultShmId(),
795 GetResultShmOffset());
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
]);
805 void GLES2Implementation::GetShaderiv(GLuint shader
,
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
)) {
817 typedef cmds::GetShaderiv::Result Result
;
818 Result
* result
= GetResultAs
<Result
*>();
822 result
->SetNumResults(0);
823 helper_
->GetShaderiv(shader
, pname
, GetResultShmId(), GetResultShmOffset());
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
]);
833 void GLES2Implementation::GetShaderInfoLog(GLuint shader
,
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
);
846 GLsizei max_size
= 0;
847 if (GetBucketAsString(kResultBucketId
, &str
)) {
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
) {
860 void GLES2Implementation::GetShaderSource(GLuint shader
,
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
);
873 GLsizei max_size
= 0;
874 if (GetBucketAsString(kResultBucketId
, &str
)) {
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
) {
887 void GLES2Implementation::GetTexParameterfv(GLenum target
,
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
)) {
899 typedef cmds::GetTexParameterfv::Result Result
;
900 Result
* result
= GetResultAs
<Result
*>();
904 result
->SetNumResults(0);
905 helper_
->GetTexParameterfv(target
, pname
, GetResultShmId(),
906 GetResultShmOffset());
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
]);
916 void GLES2Implementation::GetTexParameteriv(GLenum target
,
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
)) {
929 typedef cmds::GetTexParameteriv::Result Result
;
930 Result
* result
= GetResultAs
<Result
*>();
934 result
->SetNumResults(0);
935 helper_
->GetTexParameteriv(target
, pname
, GetResultShmId(),
936 GetResultShmOffset());
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
]);
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
);
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
*>();
965 helper_
->IsBuffer(buffer
, GetResultShmId(), GetResultShmOffset());
967 GLboolean result_value
= *result
!= 0;
968 GPU_CLIENT_LOG("returned " << 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
978 typedef cmds::IsFramebuffer::Result Result
;
979 Result
* result
= GetResultAs
<Result
*>();
984 helper_
->IsFramebuffer(framebuffer
, GetResultShmId(), GetResultShmOffset());
986 GLboolean result_value
= *result
!= 0;
987 GPU_CLIENT_LOG("returned " << 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
*>();
1002 helper_
->IsProgram(program
, GetResultShmId(), GetResultShmOffset());
1004 GLboolean result_value
= *result
!= 0;
1005 GPU_CLIENT_LOG("returned " << result_value
);
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
1015 typedef cmds::IsRenderbuffer::Result Result
;
1016 Result
* result
= GetResultAs
<Result
*>();
1021 helper_
->IsRenderbuffer(renderbuffer
, GetResultShmId(), GetResultShmOffset());
1023 GLboolean result_value
= *result
!= 0;
1024 GPU_CLIENT_LOG("returned " << result_value
);
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
*>();
1039 helper_
->IsShader(shader
, GetResultShmId(), GetResultShmOffset());
1041 GLboolean result_value
= *result
!= 0;
1042 GPU_CLIENT_LOG("returned " << result_value
);
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
*>();
1057 helper_
->IsTexture(texture
, GetResultShmId(), GetResultShmOffset());
1059 GLboolean result_value
= *result
!= 0;
1060 GPU_CLIENT_LOG("returned " << result_value
);
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
);
1072 void GLES2Implementation::PolygonOffset(GLfloat factor
, GLfloat units
) {
1073 GPU_CLIENT_SINGLE_THREAD_CHECK();
1074 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glPolygonOffset(" << factor
<< ", "
1076 helper_
->PolygonOffset(factor
, units
);
1080 void GLES2Implementation::ReleaseShaderCompiler() {
1081 GPU_CLIENT_SINGLE_THREAD_CHECK();
1082 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glReleaseShaderCompiler("
1084 helper_
->ReleaseShaderCompiler();
1088 void GLES2Implementation::RenderbufferStorage(GLenum target
,
1089 GLenum internalformat
,
1092 GPU_CLIENT_SINGLE_THREAD_CHECK();
1093 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glRenderbufferStorage("
1094 << GLES2Util::GetStringRenderBufferTarget(target
) << ", "
1095 << GLES2Util::GetStringRenderBufferFormat(internalformat
)
1096 << ", " << width
<< ", " << height
<< ")");
1098 SetGLError(GL_INVALID_VALUE
, "glRenderbufferStorage", "width < 0");
1102 SetGLError(GL_INVALID_VALUE
, "glRenderbufferStorage", "height < 0");
1105 helper_
->RenderbufferStorage(target
, internalformat
, width
, height
);
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
);
1117 void GLES2Implementation::Scissor(GLint x
,
1121 GPU_CLIENT_SINGLE_THREAD_CHECK();
1122 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glScissor(" << x
<< ", " << y
1123 << ", " << width
<< ", " << height
<< ")");
1125 SetGLError(GL_INVALID_VALUE
, "glScissor", "width < 0");
1129 SetGLError(GL_INVALID_VALUE
, "glScissor", "height < 0");
1132 helper_
->Scissor(x
, y
, width
, height
);
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
);
1145 void GLES2Implementation::StencilFuncSeparate(GLenum face
,
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
);
1158 void GLES2Implementation::StencilMask(GLuint mask
) {
1159 GPU_CLIENT_SINGLE_THREAD_CHECK();
1160 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glStencilMask(" << mask
<< ")");
1161 helper_
->StencilMask(mask
);
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
1170 helper_
->StencilMaskSeparate(face
, mask
);
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
);
1184 void GLES2Implementation::StencilOpSeparate(GLenum face
,
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
);
1198 void GLES2Implementation::TexParameterf(GLenum target
,
1201 GPU_CLIENT_SINGLE_THREAD_CHECK();
1202 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glTexParameterf("
1203 << GLES2Util::GetStringTextureBindTarget(target
) << ", "
1204 << GLES2Util::GetStringTextureParameter(pname
) << ", "
1206 helper_
->TexParameterf(target
, pname
, param
);
1210 void GLES2Implementation::TexParameterfv(GLenum target
,
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
);
1223 void GLES2Implementation::TexParameteri(GLenum target
,
1226 GPU_CLIENT_SINGLE_THREAD_CHECK();
1227 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glTexParameteri("
1228 << GLES2Util::GetStringTextureBindTarget(target
) << ", "
1229 << GLES2Util::GetStringTextureParameter(pname
) << ", "
1231 helper_
->TexParameteri(target
, pname
, param
);
1235 void GLES2Implementation::TexParameteriv(GLenum target
,
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
);
1248 void GLES2Implementation::Uniform1f(GLint location
, GLfloat x
) {
1249 GPU_CLIENT_SINGLE_THREAD_CHECK();
1250 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform1f(" << location
<< ", "
1252 helper_
->Uniform1f(location
, x
);
1256 void GLES2Implementation::Uniform1fv(GLint location
,
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]);
1268 SetGLError(GL_INVALID_VALUE
, "glUniform1fv", "count < 0");
1271 helper_
->Uniform1fvImmediate(location
, count
, v
);
1275 void GLES2Implementation::Uniform1i(GLint location
, GLint x
) {
1276 GPU_CLIENT_SINGLE_THREAD_CHECK();
1277 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform1i(" << location
<< ", "
1279 helper_
->Uniform1i(location
, x
);
1283 void GLES2Implementation::Uniform1iv(GLint location
,
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]);
1295 SetGLError(GL_INVALID_VALUE
, "glUniform1iv", "count < 0");
1298 helper_
->Uniform1ivImmediate(location
, count
, v
);
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
);
1310 void GLES2Implementation::Uniform2fv(GLint location
,
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]);
1322 SetGLError(GL_INVALID_VALUE
, "glUniform2fv", "count < 0");
1325 helper_
->Uniform2fvImmediate(location
, count
, v
);
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
);
1337 void GLES2Implementation::Uniform2iv(GLint location
,
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]);
1349 SetGLError(GL_INVALID_VALUE
, "glUniform2iv", "count < 0");
1352 helper_
->Uniform2ivImmediate(location
, count
, v
);
1356 void GLES2Implementation::Uniform3f(GLint location
,
1360 GPU_CLIENT_SINGLE_THREAD_CHECK();
1361 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform3f(" << location
<< ", "
1362 << x
<< ", " << y
<< ", " << z
<< ")");
1363 helper_
->Uniform3f(location
, x
, y
, z
);
1367 void GLES2Implementation::Uniform3fv(GLint location
,
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]);
1380 SetGLError(GL_INVALID_VALUE
, "glUniform3fv", "count < 0");
1383 helper_
->Uniform3fvImmediate(location
, count
, v
);
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
);
1395 void GLES2Implementation::Uniform3iv(GLint location
,
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]);
1408 SetGLError(GL_INVALID_VALUE
, "glUniform3iv", "count < 0");
1411 helper_
->Uniform3ivImmediate(location
, count
, v
);
1415 void GLES2Implementation::Uniform4f(GLint location
,
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
);
1427 void GLES2Implementation::Uniform4fv(GLint location
,
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]);
1440 SetGLError(GL_INVALID_VALUE
, "glUniform4fv", "count < 0");
1443 helper_
->Uniform4fvImmediate(location
, count
, v
);
1447 void GLES2Implementation::Uniform4i(GLint location
,
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
);
1459 void GLES2Implementation::Uniform4iv(GLint location
,
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]);
1472 SetGLError(GL_INVALID_VALUE
, "glUniform4iv", "count < 0");
1475 helper_
->Uniform4ivImmediate(location
, count
, v
);
1479 void GLES2Implementation::UniformMatrix2fv(GLint location
,
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]);
1496 SetGLError(GL_INVALID_VALUE
, "glUniformMatrix2fv", "count < 0");
1499 if (transpose
!= false) {
1500 SetGLError(GL_INVALID_VALUE
, "glUniformMatrix2fv",
1501 "transpose GL_INVALID_VALUE");
1504 helper_
->UniformMatrix2fvImmediate(location
, count
, value
);
1508 void GLES2Implementation::UniformMatrix3fv(GLint location
,
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]);
1528 SetGLError(GL_INVALID_VALUE
, "glUniformMatrix3fv", "count < 0");
1531 if (transpose
!= false) {
1532 SetGLError(GL_INVALID_VALUE
, "glUniformMatrix3fv",
1533 "transpose GL_INVALID_VALUE");
1536 helper_
->UniformMatrix3fvImmediate(location
, count
, value
);
1540 void GLES2Implementation::UniformMatrix4fv(GLint location
,
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
) {
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]);
1563 SetGLError(GL_INVALID_VALUE
, "glUniformMatrix4fv", "count < 0");
1566 if (transpose
!= false) {
1567 SetGLError(GL_INVALID_VALUE
, "glUniformMatrix4fv",
1568 "transpose GL_INVALID_VALUE");
1571 helper_
->UniformMatrix4fvImmediate(location
, count
, value
);
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");
1582 if (UseProgramHelper(program
)) {
1583 helper_
->UseProgram(program
);
1588 void GLES2Implementation::ValidateProgram(GLuint program
) {
1589 GPU_CLIENT_SINGLE_THREAD_CHECK();
1590 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glValidateProgram(" << program
1592 helper_
->ValidateProgram(program
);
1596 void GLES2Implementation::VertexAttrib1f(GLuint indx
, GLfloat x
) {
1597 GPU_CLIENT_SINGLE_THREAD_CHECK();
1598 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glVertexAttrib1f(" << indx
<< ", "
1600 helper_
->VertexAttrib1f(indx
, x
);
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
);
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
);
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
);
1630 void GLES2Implementation::VertexAttrib3f(GLuint indx
,
1634 GPU_CLIENT_SINGLE_THREAD_CHECK();
1635 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glVertexAttrib3f(" << indx
<< ", "
1636 << x
<< ", " << y
<< ", " << z
<< ")");
1637 helper_
->VertexAttrib3f(indx
, x
, y
, z
);
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] << ", "
1647 helper_
->VertexAttrib3fvImmediate(indx
, values
);
1651 void GLES2Implementation::VertexAttrib4f(GLuint indx
,
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
);
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
);
1673 void GLES2Implementation::Viewport(GLint x
,
1677 GPU_CLIENT_SINGLE_THREAD_CHECK();
1678 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glViewport(" << x
<< ", " << y
1679 << ", " << width
<< ", " << height
<< ")");
1681 SetGLError(GL_INVALID_VALUE
, "glViewport", "width < 0");
1685 SetGLError(GL_INVALID_VALUE
, "glViewport", "height < 0");
1688 helper_
->Viewport(x
, y
, width
, height
);
1692 void GLES2Implementation::BlitFramebufferCHROMIUM(GLint srcX0
,
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
);
1713 void GLES2Implementation::RenderbufferStorageMultisampleCHROMIUM(
1716 GLenum internalformat
,
1719 GPU_CLIENT_SINGLE_THREAD_CHECK();
1721 "[" << GetLogPrefix() << "] glRenderbufferStorageMultisampleCHROMIUM("
1722 << GLES2Util::GetStringRenderBufferTarget(target
) << ", " << samples
1723 << ", " << GLES2Util::GetStringRenderBufferFormat(internalformat
)
1724 << ", " << width
<< ", " << height
<< ")");
1726 SetGLError(GL_INVALID_VALUE
, "glRenderbufferStorageMultisampleCHROMIUM",
1731 SetGLError(GL_INVALID_VALUE
, "glRenderbufferStorageMultisampleCHROMIUM",
1736 SetGLError(GL_INVALID_VALUE
, "glRenderbufferStorageMultisampleCHROMIUM",
1740 helper_
->RenderbufferStorageMultisampleCHROMIUM(
1741 target
, samples
, internalformat
, width
, height
);
1745 void GLES2Implementation::RenderbufferStorageMultisampleEXT(
1748 GLenum internalformat
,
1751 GPU_CLIENT_SINGLE_THREAD_CHECK();
1753 "[" << GetLogPrefix() << "] glRenderbufferStorageMultisampleEXT("
1754 << GLES2Util::GetStringRenderBufferTarget(target
) << ", " << samples
1755 << ", " << GLES2Util::GetStringRenderBufferFormat(internalformat
)
1756 << ", " << width
<< ", " << height
<< ")");
1758 SetGLError(GL_INVALID_VALUE
, "glRenderbufferStorageMultisampleEXT",
1763 SetGLError(GL_INVALID_VALUE
, "glRenderbufferStorageMultisampleEXT",
1768 SetGLError(GL_INVALID_VALUE
, "glRenderbufferStorageMultisampleEXT",
1772 helper_
->RenderbufferStorageMultisampleEXT(target
, samples
, internalformat
,
1777 void GLES2Implementation::FramebufferTexture2DMultisampleEXT(GLenum target
,
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
<< ")");
1791 SetGLError(GL_INVALID_VALUE
, "glFramebufferTexture2DMultisampleEXT",
1792 "level GL_INVALID_VALUE");
1796 SetGLError(GL_INVALID_VALUE
, "glFramebufferTexture2DMultisampleEXT",
1800 helper_
->FramebufferTexture2DMultisampleEXT(target
, attachment
, textarget
,
1805 void GLES2Implementation::TexStorage2DEXT(GLenum target
,
1807 GLenum internalFormat
,
1810 GPU_CLIENT_SINGLE_THREAD_CHECK();
1812 "[" << GetLogPrefix() << "] glTexStorage2DEXT("
1813 << GLES2Util::GetStringTextureTarget(target
) << ", " << levels
<< ", "
1814 << GLES2Util::GetStringTextureInternalFormatStorage(internalFormat
)
1815 << ", " << width
<< ", " << height
<< ")");
1817 SetGLError(GL_INVALID_VALUE
, "glTexStorage2DEXT", "levels < 0");
1821 SetGLError(GL_INVALID_VALUE
, "glTexStorage2DEXT", "width < 0");
1825 SetGLError(GL_INVALID_VALUE
, "glTexStorage2DEXT", "height < 0");
1828 helper_
->TexStorage2DEXT(target
, levels
, internalFormat
, width
, height
);
1832 void GLES2Implementation::GenQueriesEXT(GLsizei n
, GLuint
* queries
) {
1833 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGenQueriesEXT(" << n
<< ", "
1834 << static_cast<const void*>(queries
) << ")");
1836 SetGLError(GL_INVALID_VALUE
, "glGenQueriesEXT", "n < 0");
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
]);
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);
1870 SetGLError(GL_INVALID_VALUE
, "glDeleteQueriesEXT", "n < 0");
1873 DeleteQueriesEXTHelper(n
, queries
);
1877 void GLES2Implementation::GenVertexArraysOES(GLsizei n
, GLuint
* arrays
) {
1878 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGenVertexArraysOES(" << n
<< ", "
1879 << static_cast<const void*>(arrays
) << ")");
1881 SetGLError(GL_INVALID_VALUE
, "glGenVertexArraysOES", "n < 0");
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
]);
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);
1914 SetGLError(GL_INVALID_VALUE
, "glDeleteVertexArraysOES", "n < 0");
1917 DeleteVertexArraysOESHelper(n
, arrays
);
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
1926 typedef cmds::IsVertexArrayOES::Result Result
;
1927 Result
* result
= GetResultAs
<Result
*>();
1932 helper_
->IsVertexArrayOES(array
, GetResultShmId(), GetResultShmOffset());
1934 GLboolean result_value
= *result
!= 0;
1935 GPU_CLIENT_LOG("returned " << result_value
);
1937 return result_value
;
1940 void GLES2Implementation::BindVertexArrayOES(GLuint array
) {
1941 GPU_CLIENT_SINGLE_THREAD_CHECK();
1942 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBindVertexArrayOES(" << array
1944 if (IsVertexArrayReservedId(array
)) {
1945 SetGLError(GL_INVALID_OPERATION
, "BindVertexArrayOES", "array reserved id");
1948 if (BindVertexArrayOESHelper(array
)) {
1949 helper_
->BindVertexArrayOES(array
);
1954 void GLES2Implementation::GetTranslatedShaderSourceANGLE(GLuint shader
,
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
);
1967 GLsizei max_size
= 0;
1968 if (GetBucketAsString(kResultBucketId
, &str
)) {
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
) {
1981 void GLES2Implementation::TexImageIOSurface2DCHROMIUM(GLenum target
,
1986 GPU_CLIENT_SINGLE_THREAD_CHECK();
1987 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glTexImageIOSurface2DCHROMIUM("
1988 << GLES2Util::GetStringTextureBindTarget(target
) << ", "
1989 << width
<< ", " << height
<< ", " << ioSurfaceId
<< ", "
1992 SetGLError(GL_INVALID_VALUE
, "glTexImageIOSurface2DCHROMIUM", "width < 0");
1996 SetGLError(GL_INVALID_VALUE
, "glTexImageIOSurface2DCHROMIUM", "height < 0");
1999 helper_
->TexImageIOSurface2DCHROMIUM(target
, width
, height
, ioSurfaceId
,
2004 void GLES2Implementation::CopyTextureCHROMIUM(GLenum target
,
2008 GLint internalformat
,
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
);
2022 void GLES2Implementation::GenValuebuffersCHROMIUM(GLsizei n
, GLuint
* buffers
) {
2023 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGenValuebuffersCHROMIUM(" << n
2024 << ", " << static_cast<const void*>(buffers
) << ")");
2026 SetGLError(GL_INVALID_VALUE
, "glGenValuebuffersCHROMIUM", "n < 0");
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
]);
2043 void GLES2Implementation::DeleteValuebuffersCHROMIUM(
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);
2060 SetGLError(GL_INVALID_VALUE
, "glDeleteValuebuffersCHROMIUM", "n < 0");
2063 DeleteValuebuffersCHROMIUMHelper(n
, valuebuffers
);
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
*>();
2078 helper_
->IsValuebufferCHROMIUM(valuebuffer
, GetResultShmId(),
2079 GetResultShmOffset());
2081 GLboolean result_value
= *result
!= 0;
2082 GPU_CLIENT_LOG("returned " << result_value
);
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");
2098 if (BindValuebufferCHROMIUMHelper(target
, valuebuffer
)) {
2099 helper_
->BindValuebufferCHROMIUM(target
, valuebuffer
);
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
)
2111 helper_
->SubscribeValueCHROMIUM(target
, subscription
);
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
);
2124 void GLES2Implementation::UniformValuebufferCHROMIUM(GLint location
,
2126 GLenum subscription
) {
2127 GPU_CLIENT_SINGLE_THREAD_CHECK();
2129 "[" << GetLogPrefix() << "] glUniformValuebufferCHROMIUM(" << location
2130 << ", " << GLES2Util::GetStringValueBufferTarget(target
) << ", "
2131 << GLES2Util::GetStringSubscriptionTarget(subscription
) << ")");
2132 helper_
->UniformValuebufferCHROMIUM(location
, target
, subscription
);
2136 void GLES2Implementation::BindTexImage2DCHROMIUM(GLenum target
, GLint imageId
) {
2137 GPU_CLIENT_SINGLE_THREAD_CHECK();
2138 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBindTexImage2DCHROMIUM("
2139 << GLES2Util::GetStringTextureBindTarget(target
) << ", "
2141 helper_
->BindTexImage2DCHROMIUM(target
, imageId
);
2145 void GLES2Implementation::ReleaseTexImage2DCHROMIUM(GLenum target
,
2147 GPU_CLIENT_SINGLE_THREAD_CHECK();
2148 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glReleaseTexImage2DCHROMIUM("
2149 << GLES2Util::GetStringTextureBindTarget(target
) << ", "
2151 helper_
->ReleaseTexImage2DCHROMIUM(target
, imageId
);
2155 void GLES2Implementation::DiscardFramebufferEXT(GLenum target
,
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]);
2168 SetGLError(GL_INVALID_VALUE
, "glDiscardFramebufferEXT", "count < 0");
2171 helper_
->DiscardFramebufferEXTImmediate(target
, count
, attachments
);
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
);
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
);
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]);
2202 SetGLError(GL_INVALID_VALUE
, "glDrawBuffersEXT", "count < 0");
2205 helper_
->DrawBuffersEXTImmediate(count
, bufs
);
2209 void GLES2Implementation::DiscardBackbufferCHROMIUM() {
2210 GPU_CLIENT_SINGLE_THREAD_CHECK();
2211 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDiscardBackbufferCHROMIUM("
2213 helper_
->DiscardBackbufferCHROMIUM();
2217 void GLES2Implementation::ScheduleOverlayPlaneCHROMIUM(
2218 GLint plane_z_order
,
2219 GLenum plane_transform
,
2220 GLuint overlay_texture_id
,
2224 GLint bounds_height
,
2228 GLfloat uv_height
) {
2229 GPU_CLIENT_SINGLE_THREAD_CHECK();
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
);
2242 void GLES2Implementation::MatrixLoadfCHROMIUM(GLenum matrixMode
,
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] << ", "
2254 helper_
->MatrixLoadfCHROMIUMImmediate(matrixMode
, m
);
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
);
2266 void GLES2Implementation::BlendBarrierKHR() {
2267 GPU_CLIENT_SINGLE_THREAD_CHECK();
2268 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBlendBarrierKHR("
2270 helper_
->BlendBarrierKHR();
2274 #endif // GPU_COMMAND_BUFFER_CLIENT_GLES2_IMPLEMENTATION_IMPL_AUTOGEN_H_