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 BindBufferHelper(target
, buffer
);
37 void GLES2Implementation::BindBufferBase(GLenum target
,
40 GPU_CLIENT_SINGLE_THREAD_CHECK();
41 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBindBufferBase("
42 << GLES2Util::GetStringIndexedBufferTarget(target
) << ", "
43 << index
<< ", " << buffer
<< ")");
44 if (IsBufferReservedId(buffer
)) {
45 SetGLError(GL_INVALID_OPERATION
, "BindBufferBase", "buffer reserved id");
48 BindBufferBaseHelper(target
, index
, buffer
);
52 void GLES2Implementation::BindBufferRange(GLenum target
,
57 GPU_CLIENT_SINGLE_THREAD_CHECK();
58 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBindBufferRange("
59 << GLES2Util::GetStringIndexedBufferTarget(target
) << ", "
60 << index
<< ", " << buffer
<< ", " << offset
<< ", "
63 SetGLError(GL_INVALID_VALUE
, "glBindBufferRange", "offset < 0");
67 SetGLError(GL_INVALID_VALUE
, "glBindBufferRange", "size < 0");
70 if (IsBufferReservedId(buffer
)) {
71 SetGLError(GL_INVALID_OPERATION
, "BindBufferRange", "buffer reserved id");
74 BindBufferRangeHelper(target
, index
, buffer
, offset
, size
);
78 void GLES2Implementation::BindFramebuffer(GLenum target
, GLuint framebuffer
) {
79 GPU_CLIENT_SINGLE_THREAD_CHECK();
80 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBindFramebuffer("
81 << GLES2Util::GetStringFrameBufferTarget(target
) << ", "
82 << framebuffer
<< ")");
83 if (IsFramebufferReservedId(framebuffer
)) {
84 SetGLError(GL_INVALID_OPERATION
, "BindFramebuffer",
85 "framebuffer reserved id");
88 BindFramebufferHelper(target
, framebuffer
);
92 void GLES2Implementation::BindRenderbuffer(GLenum target
, GLuint renderbuffer
) {
93 GPU_CLIENT_SINGLE_THREAD_CHECK();
94 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBindRenderbuffer("
95 << GLES2Util::GetStringRenderBufferTarget(target
) << ", "
96 << renderbuffer
<< ")");
97 if (IsRenderbufferReservedId(renderbuffer
)) {
98 SetGLError(GL_INVALID_OPERATION
, "BindRenderbuffer",
99 "renderbuffer reserved id");
102 BindRenderbufferHelper(target
, renderbuffer
);
106 void GLES2Implementation::BindSampler(GLuint unit
, GLuint sampler
) {
107 GPU_CLIENT_SINGLE_THREAD_CHECK();
108 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBindSampler(" << unit
<< ", "
110 if (IsSamplerReservedId(sampler
)) {
111 SetGLError(GL_INVALID_OPERATION
, "BindSampler", "sampler reserved id");
114 BindSamplerHelper(unit
, sampler
);
118 void GLES2Implementation::BindTexture(GLenum target
, GLuint texture
) {
119 GPU_CLIENT_SINGLE_THREAD_CHECK();
120 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBindTexture("
121 << GLES2Util::GetStringTextureBindTarget(target
) << ", "
123 if (IsTextureReservedId(texture
)) {
124 SetGLError(GL_INVALID_OPERATION
, "BindTexture", "texture reserved id");
127 BindTextureHelper(target
, texture
);
131 void GLES2Implementation::BindTransformFeedback(GLenum target
,
132 GLuint transformfeedback
) {
133 GPU_CLIENT_SINGLE_THREAD_CHECK();
134 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBindTransformFeedback("
135 << GLES2Util::GetStringTransformFeedbackBindTarget(target
)
136 << ", " << transformfeedback
<< ")");
137 if (IsTransformFeedbackReservedId(transformfeedback
)) {
138 SetGLError(GL_INVALID_OPERATION
, "BindTransformFeedback",
139 "transformfeedback reserved id");
142 BindTransformFeedbackHelper(target
, transformfeedback
);
146 void GLES2Implementation::BlendColor(GLclampf red
,
150 GPU_CLIENT_SINGLE_THREAD_CHECK();
151 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBlendColor(" << red
<< ", "
152 << green
<< ", " << blue
<< ", " << alpha
<< ")");
153 helper_
->BlendColor(red
, green
, blue
, alpha
);
157 void GLES2Implementation::BlendEquation(GLenum mode
) {
158 GPU_CLIENT_SINGLE_THREAD_CHECK();
159 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBlendEquation("
160 << GLES2Util::GetStringEquation(mode
) << ")");
161 helper_
->BlendEquation(mode
);
165 void GLES2Implementation::BlendEquationSeparate(GLenum modeRGB
,
167 GPU_CLIENT_SINGLE_THREAD_CHECK();
168 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBlendEquationSeparate("
169 << GLES2Util::GetStringEquation(modeRGB
) << ", "
170 << GLES2Util::GetStringEquation(modeAlpha
) << ")");
171 helper_
->BlendEquationSeparate(modeRGB
, modeAlpha
);
175 void GLES2Implementation::BlendFunc(GLenum sfactor
, GLenum dfactor
) {
176 GPU_CLIENT_SINGLE_THREAD_CHECK();
177 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBlendFunc("
178 << GLES2Util::GetStringSrcBlendFactor(sfactor
) << ", "
179 << GLES2Util::GetStringDstBlendFactor(dfactor
) << ")");
180 helper_
->BlendFunc(sfactor
, dfactor
);
184 void GLES2Implementation::BlendFuncSeparate(GLenum srcRGB
,
188 GPU_CLIENT_SINGLE_THREAD_CHECK();
189 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBlendFuncSeparate("
190 << GLES2Util::GetStringSrcBlendFactor(srcRGB
) << ", "
191 << GLES2Util::GetStringDstBlendFactor(dstRGB
) << ", "
192 << GLES2Util::GetStringSrcBlendFactor(srcAlpha
) << ", "
193 << GLES2Util::GetStringDstBlendFactor(dstAlpha
) << ")");
194 helper_
->BlendFuncSeparate(srcRGB
, dstRGB
, srcAlpha
, dstAlpha
);
198 GLenum
GLES2Implementation::CheckFramebufferStatus(GLenum target
) {
199 GPU_CLIENT_SINGLE_THREAD_CHECK();
200 TRACE_EVENT0("gpu", "GLES2Implementation::CheckFramebufferStatus");
201 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glCheckFramebufferStatus("
202 << GLES2Util::GetStringFrameBufferTarget(target
) << ")");
203 typedef cmds::CheckFramebufferStatus::Result Result
;
204 Result
* result
= GetResultAs
<Result
*>();
206 return GL_FRAMEBUFFER_UNSUPPORTED
;
209 helper_
->CheckFramebufferStatus(target
, GetResultShmId(),
210 GetResultShmOffset());
212 GLenum result_value
= *result
;
213 GPU_CLIENT_LOG("returned " << result_value
);
218 void GLES2Implementation::Clear(GLbitfield mask
) {
219 GPU_CLIENT_SINGLE_THREAD_CHECK();
220 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glClear(" << mask
<< ")");
221 helper_
->Clear(mask
);
225 void GLES2Implementation::ClearBufferfi(GLenum buffer
,
229 GPU_CLIENT_SINGLE_THREAD_CHECK();
230 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glClearBufferfi("
231 << GLES2Util::GetStringBufferfv(buffer
) << ", "
232 << drawbuffers
<< ", " << depth
<< ", " << stencil
<< ")");
233 helper_
->ClearBufferfi(buffer
, drawbuffers
, depth
, stencil
);
237 void GLES2Implementation::ClearBufferfv(GLenum buffer
,
239 const GLfloat
* value
) {
240 GPU_CLIENT_SINGLE_THREAD_CHECK();
241 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glClearBufferfv("
242 << GLES2Util::GetStringBufferfv(buffer
) << ", "
243 << drawbuffers
<< ", " << static_cast<const void*>(value
)
245 size_t count
= GLES2Util::CalcClearBufferfvDataCount(buffer
);
246 DCHECK_LE(count
, 4u);
247 for (size_t ii
= 0; ii
< count
; ++ii
)
248 GPU_CLIENT_LOG("value[" << ii
<< "]: " << value
[ii
]);
249 helper_
->ClearBufferfvImmediate(buffer
, drawbuffers
, value
);
253 void GLES2Implementation::ClearBufferiv(GLenum buffer
,
255 const GLint
* value
) {
256 GPU_CLIENT_SINGLE_THREAD_CHECK();
257 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glClearBufferiv("
258 << GLES2Util::GetStringBufferiv(buffer
) << ", "
259 << drawbuffers
<< ", " << static_cast<const void*>(value
)
261 size_t count
= GLES2Util::CalcClearBufferivDataCount(buffer
);
262 DCHECK_LE(count
, 4u);
263 for (size_t ii
= 0; ii
< count
; ++ii
)
264 GPU_CLIENT_LOG("value[" << ii
<< "]: " << value
[ii
]);
265 helper_
->ClearBufferivImmediate(buffer
, drawbuffers
, value
);
269 void GLES2Implementation::ClearBufferuiv(GLenum buffer
,
271 const GLuint
* value
) {
272 GPU_CLIENT_SINGLE_THREAD_CHECK();
273 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glClearBufferuiv("
274 << GLES2Util::GetStringBufferuiv(buffer
) << ", "
275 << drawbuffers
<< ", " << static_cast<const void*>(value
)
278 for (size_t ii
= 0; ii
< count
; ++ii
)
279 GPU_CLIENT_LOG("value[" << ii
<< "]: " << value
[ii
]);
280 helper_
->ClearBufferuivImmediate(buffer
, drawbuffers
, value
);
284 void GLES2Implementation::ClearColor(GLclampf red
,
288 GPU_CLIENT_SINGLE_THREAD_CHECK();
289 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glClearColor(" << red
<< ", "
290 << green
<< ", " << blue
<< ", " << alpha
<< ")");
291 helper_
->ClearColor(red
, green
, blue
, alpha
);
295 void GLES2Implementation::ClearDepthf(GLclampf depth
) {
296 GPU_CLIENT_SINGLE_THREAD_CHECK();
297 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glClearDepthf(" << depth
<< ")");
298 helper_
->ClearDepthf(depth
);
302 void GLES2Implementation::ClearStencil(GLint s
) {
303 GPU_CLIENT_SINGLE_THREAD_CHECK();
304 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glClearStencil(" << s
<< ")");
305 helper_
->ClearStencil(s
);
309 void GLES2Implementation::ColorMask(GLboolean red
,
313 GPU_CLIENT_SINGLE_THREAD_CHECK();
314 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glColorMask("
315 << GLES2Util::GetStringBool(red
) << ", "
316 << GLES2Util::GetStringBool(green
) << ", "
317 << GLES2Util::GetStringBool(blue
) << ", "
318 << GLES2Util::GetStringBool(alpha
) << ")");
319 helper_
->ColorMask(red
, green
, blue
, alpha
);
323 void GLES2Implementation::CompileShader(GLuint shader
) {
324 GPU_CLIENT_SINGLE_THREAD_CHECK();
325 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glCompileShader(" << shader
327 helper_
->CompileShader(shader
);
331 void GLES2Implementation::CopyBufferSubData(GLenum readtarget
,
334 GLintptr writeoffset
,
336 GPU_CLIENT_SINGLE_THREAD_CHECK();
337 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glCopyBufferSubData("
338 << GLES2Util::GetStringBufferTarget(readtarget
) << ", "
339 << GLES2Util::GetStringBufferTarget(writetarget
) << ", "
340 << readoffset
<< ", " << writeoffset
<< ", " << size
342 if (readoffset
< 0) {
343 SetGLError(GL_INVALID_VALUE
, "glCopyBufferSubData", "readoffset < 0");
346 if (writeoffset
< 0) {
347 SetGLError(GL_INVALID_VALUE
, "glCopyBufferSubData", "writeoffset < 0");
351 SetGLError(GL_INVALID_VALUE
, "glCopyBufferSubData", "size < 0");
354 helper_
->CopyBufferSubData(readtarget
, writetarget
, readoffset
, writeoffset
,
359 void GLES2Implementation::CopyTexImage2D(GLenum target
,
361 GLenum internalformat
,
367 GPU_CLIENT_SINGLE_THREAD_CHECK();
369 "[" << GetLogPrefix() << "] glCopyTexImage2D("
370 << GLES2Util::GetStringTextureTarget(target
) << ", " << level
<< ", "
371 << GLES2Util::GetStringTextureInternalFormat(internalformat
) << ", "
372 << x
<< ", " << y
<< ", " << width
<< ", " << height
<< ", " << border
375 SetGLError(GL_INVALID_VALUE
, "glCopyTexImage2D", "width < 0");
379 SetGLError(GL_INVALID_VALUE
, "glCopyTexImage2D", "height < 0");
383 SetGLError(GL_INVALID_VALUE
, "glCopyTexImage2D", "border GL_INVALID_VALUE");
386 helper_
->CopyTexImage2D(target
, level
, internalformat
, x
, y
, width
, height
);
390 void GLES2Implementation::CopyTexSubImage2D(GLenum target
,
398 GPU_CLIENT_SINGLE_THREAD_CHECK();
399 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glCopyTexSubImage2D("
400 << GLES2Util::GetStringTextureTarget(target
) << ", "
401 << level
<< ", " << xoffset
<< ", " << yoffset
<< ", " << x
402 << ", " << y
<< ", " << width
<< ", " << height
<< ")");
404 SetGLError(GL_INVALID_VALUE
, "glCopyTexSubImage2D", "width < 0");
408 SetGLError(GL_INVALID_VALUE
, "glCopyTexSubImage2D", "height < 0");
411 helper_
->CopyTexSubImage2D(target
, level
, xoffset
, yoffset
, x
, y
, width
,
416 void GLES2Implementation::CopyTexSubImage3D(GLenum target
,
425 GPU_CLIENT_SINGLE_THREAD_CHECK();
426 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glCopyTexSubImage3D("
427 << GLES2Util::GetStringTexture3DTarget(target
) << ", "
428 << level
<< ", " << xoffset
<< ", " << yoffset
<< ", "
429 << zoffset
<< ", " << x
<< ", " << y
<< ", " << width
430 << ", " << height
<< ")");
432 SetGLError(GL_INVALID_VALUE
, "glCopyTexSubImage3D", "width < 0");
436 SetGLError(GL_INVALID_VALUE
, "glCopyTexSubImage3D", "height < 0");
439 helper_
->CopyTexSubImage3D(target
, level
, xoffset
, yoffset
, zoffset
, x
, y
,
444 GLuint
GLES2Implementation::CreateProgram() {
445 GPU_CLIENT_SINGLE_THREAD_CHECK();
446 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glCreateProgram("
449 GetIdHandler(id_namespaces::kProgramsAndShaders
)
450 ->MakeIds(this, 0, 1, &client_id
);
451 helper_
->CreateProgram(client_id
);
452 GPU_CLIENT_LOG("returned " << client_id
);
457 GLuint
GLES2Implementation::CreateShader(GLenum type
) {
458 GPU_CLIENT_SINGLE_THREAD_CHECK();
459 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glCreateShader("
460 << GLES2Util::GetStringShaderType(type
) << ")");
462 GetIdHandler(id_namespaces::kProgramsAndShaders
)
463 ->MakeIds(this, 0, 1, &client_id
);
464 helper_
->CreateShader(type
, client_id
);
465 GPU_CLIENT_LOG("returned " << client_id
);
470 void GLES2Implementation::CullFace(GLenum mode
) {
471 GPU_CLIENT_SINGLE_THREAD_CHECK();
472 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glCullFace("
473 << GLES2Util::GetStringFaceType(mode
) << ")");
474 helper_
->CullFace(mode
);
478 void GLES2Implementation::DeleteBuffers(GLsizei n
, const GLuint
* buffers
) {
479 GPU_CLIENT_SINGLE_THREAD_CHECK();
480 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDeleteBuffers(" << n
<< ", "
481 << static_cast<const void*>(buffers
) << ")");
482 GPU_CLIENT_LOG_CODE_BLOCK({
483 for (GLsizei i
= 0; i
< n
; ++i
) {
484 GPU_CLIENT_LOG(" " << i
<< ": " << buffers
[i
]);
487 GPU_CLIENT_DCHECK_CODE_BLOCK({
488 for (GLsizei i
= 0; i
< n
; ++i
) {
489 DCHECK(buffers
[i
] != 0);
493 SetGLError(GL_INVALID_VALUE
, "glDeleteBuffers", "n < 0");
496 DeleteBuffersHelper(n
, buffers
);
500 void GLES2Implementation::DeleteFramebuffers(GLsizei n
,
501 const GLuint
* framebuffers
) {
502 GPU_CLIENT_SINGLE_THREAD_CHECK();
503 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDeleteFramebuffers(" << n
<< ", "
504 << static_cast<const void*>(framebuffers
) << ")");
505 GPU_CLIENT_LOG_CODE_BLOCK({
506 for (GLsizei i
= 0; i
< n
; ++i
) {
507 GPU_CLIENT_LOG(" " << i
<< ": " << framebuffers
[i
]);
510 GPU_CLIENT_DCHECK_CODE_BLOCK({
511 for (GLsizei i
= 0; i
< n
; ++i
) {
512 DCHECK(framebuffers
[i
] != 0);
516 SetGLError(GL_INVALID_VALUE
, "glDeleteFramebuffers", "n < 0");
519 DeleteFramebuffersHelper(n
, framebuffers
);
523 void GLES2Implementation::DeleteProgram(GLuint program
) {
524 GPU_CLIENT_SINGLE_THREAD_CHECK();
525 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDeleteProgram(" << program
527 GPU_CLIENT_DCHECK(program
!= 0);
528 DeleteProgramHelper(program
);
532 void GLES2Implementation::DeleteRenderbuffers(GLsizei n
,
533 const GLuint
* renderbuffers
) {
534 GPU_CLIENT_SINGLE_THREAD_CHECK();
535 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDeleteRenderbuffers(" << n
536 << ", " << static_cast<const void*>(renderbuffers
) << ")");
537 GPU_CLIENT_LOG_CODE_BLOCK({
538 for (GLsizei i
= 0; i
< n
; ++i
) {
539 GPU_CLIENT_LOG(" " << i
<< ": " << renderbuffers
[i
]);
542 GPU_CLIENT_DCHECK_CODE_BLOCK({
543 for (GLsizei i
= 0; i
< n
; ++i
) {
544 DCHECK(renderbuffers
[i
] != 0);
548 SetGLError(GL_INVALID_VALUE
, "glDeleteRenderbuffers", "n < 0");
551 DeleteRenderbuffersHelper(n
, renderbuffers
);
555 void GLES2Implementation::DeleteSamplers(GLsizei n
, const GLuint
* samplers
) {
556 GPU_CLIENT_SINGLE_THREAD_CHECK();
557 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDeleteSamplers(" << n
<< ", "
558 << static_cast<const void*>(samplers
) << ")");
559 GPU_CLIENT_LOG_CODE_BLOCK({
560 for (GLsizei i
= 0; i
< n
; ++i
) {
561 GPU_CLIENT_LOG(" " << i
<< ": " << samplers
[i
]);
564 GPU_CLIENT_DCHECK_CODE_BLOCK({
565 for (GLsizei i
= 0; i
< n
; ++i
) {
566 DCHECK(samplers
[i
] != 0);
570 SetGLError(GL_INVALID_VALUE
, "glDeleteSamplers", "n < 0");
573 DeleteSamplersHelper(n
, samplers
);
577 void GLES2Implementation::DeleteSync(GLsync sync
) {
578 GPU_CLIENT_SINGLE_THREAD_CHECK();
579 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDeleteSync(" << sync
<< ")");
580 GPU_CLIENT_DCHECK(sync
!= 0);
581 DeleteSyncHelper(sync
);
585 void GLES2Implementation::DeleteShader(GLuint shader
) {
586 GPU_CLIENT_SINGLE_THREAD_CHECK();
587 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDeleteShader(" << shader
<< ")");
588 GPU_CLIENT_DCHECK(shader
!= 0);
589 DeleteShaderHelper(shader
);
593 void GLES2Implementation::DeleteTextures(GLsizei n
, const GLuint
* textures
) {
594 GPU_CLIENT_SINGLE_THREAD_CHECK();
595 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDeleteTextures(" << n
<< ", "
596 << static_cast<const void*>(textures
) << ")");
597 GPU_CLIENT_LOG_CODE_BLOCK({
598 for (GLsizei i
= 0; i
< n
; ++i
) {
599 GPU_CLIENT_LOG(" " << i
<< ": " << textures
[i
]);
602 GPU_CLIENT_DCHECK_CODE_BLOCK({
603 for (GLsizei i
= 0; i
< n
; ++i
) {
604 DCHECK(textures
[i
] != 0);
608 SetGLError(GL_INVALID_VALUE
, "glDeleteTextures", "n < 0");
611 DeleteTexturesHelper(n
, textures
);
615 void GLES2Implementation::DeleteTransformFeedbacks(GLsizei n
,
617 GPU_CLIENT_SINGLE_THREAD_CHECK();
618 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDeleteTransformFeedbacks(" << n
619 << ", " << static_cast<const void*>(ids
) << ")");
620 GPU_CLIENT_LOG_CODE_BLOCK({
621 for (GLsizei i
= 0; i
< n
; ++i
) {
622 GPU_CLIENT_LOG(" " << i
<< ": " << ids
[i
]);
625 GPU_CLIENT_DCHECK_CODE_BLOCK({
626 for (GLsizei i
= 0; i
< n
; ++i
) {
631 SetGLError(GL_INVALID_VALUE
, "glDeleteTransformFeedbacks", "n < 0");
634 DeleteTransformFeedbacksHelper(n
, ids
);
638 void GLES2Implementation::DepthFunc(GLenum func
) {
639 GPU_CLIENT_SINGLE_THREAD_CHECK();
640 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDepthFunc("
641 << GLES2Util::GetStringCmpFunction(func
) << ")");
642 helper_
->DepthFunc(func
);
646 void GLES2Implementation::DepthMask(GLboolean flag
) {
647 GPU_CLIENT_SINGLE_THREAD_CHECK();
648 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDepthMask("
649 << GLES2Util::GetStringBool(flag
) << ")");
650 helper_
->DepthMask(flag
);
654 void GLES2Implementation::DepthRangef(GLclampf zNear
, GLclampf zFar
) {
655 GPU_CLIENT_SINGLE_THREAD_CHECK();
656 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDepthRangef(" << zNear
<< ", "
658 helper_
->DepthRangef(zNear
, zFar
);
662 void GLES2Implementation::DetachShader(GLuint program
, GLuint shader
) {
663 GPU_CLIENT_SINGLE_THREAD_CHECK();
664 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDetachShader(" << program
<< ", "
666 helper_
->DetachShader(program
, shader
);
670 GLsync
GLES2Implementation::FenceSync(GLenum condition
, GLbitfield flags
) {
671 GPU_CLIENT_SINGLE_THREAD_CHECK();
672 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glFenceSync("
673 << GLES2Util::GetStringSyncCondition(condition
) << ", "
675 if (condition
!= GL_SYNC_GPU_COMMANDS_COMPLETE
) {
676 SetGLError(GL_INVALID_ENUM
, "glFenceSync", "condition GL_INVALID_ENUM");
680 SetGLError(GL_INVALID_VALUE
, "glFenceSync", "flags GL_INVALID_VALUE");
684 GetIdHandler(id_namespaces::kSyncs
)->MakeIds(this, 0, 1, &client_id
);
685 helper_
->FenceSync(client_id
);
686 GPU_CLIENT_LOG("returned " << client_id
);
688 return reinterpret_cast<GLsync
>(client_id
);
691 void GLES2Implementation::FramebufferRenderbuffer(GLenum target
,
693 GLenum renderbuffertarget
,
694 GLuint renderbuffer
) {
695 GPU_CLIENT_SINGLE_THREAD_CHECK();
696 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glFramebufferRenderbuffer("
697 << GLES2Util::GetStringFrameBufferTarget(target
) << ", "
698 << GLES2Util::GetStringAttachment(attachment
) << ", "
699 << GLES2Util::GetStringRenderBufferTarget(
700 renderbuffertarget
) << ", " << renderbuffer
<< ")");
701 helper_
->FramebufferRenderbuffer(target
, attachment
, renderbuffertarget
,
706 void GLES2Implementation::FramebufferTexture2D(GLenum target
,
711 GPU_CLIENT_SINGLE_THREAD_CHECK();
712 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glFramebufferTexture2D("
713 << GLES2Util::GetStringFrameBufferTarget(target
) << ", "
714 << GLES2Util::GetStringAttachment(attachment
) << ", "
715 << GLES2Util::GetStringTextureTarget(textarget
) << ", "
716 << texture
<< ", " << level
<< ")");
718 SetGLError(GL_INVALID_VALUE
, "glFramebufferTexture2D",
719 "level GL_INVALID_VALUE");
722 helper_
->FramebufferTexture2D(target
, attachment
, textarget
, texture
);
726 void GLES2Implementation::FramebufferTextureLayer(GLenum target
,
731 GPU_CLIENT_SINGLE_THREAD_CHECK();
732 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glFramebufferTextureLayer("
733 << GLES2Util::GetStringFrameBufferTarget(target
) << ", "
734 << GLES2Util::GetStringAttachment(attachment
) << ", "
735 << texture
<< ", " << level
<< ", " << layer
<< ")");
736 helper_
->FramebufferTextureLayer(target
, attachment
, texture
, level
, layer
);
740 void GLES2Implementation::FrontFace(GLenum mode
) {
741 GPU_CLIENT_SINGLE_THREAD_CHECK();
742 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glFrontFace("
743 << GLES2Util::GetStringFaceMode(mode
) << ")");
744 helper_
->FrontFace(mode
);
748 void GLES2Implementation::GenBuffers(GLsizei n
, GLuint
* buffers
) {
749 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGenBuffers(" << n
<< ", "
750 << static_cast<const void*>(buffers
) << ")");
752 SetGLError(GL_INVALID_VALUE
, "glGenBuffers", "n < 0");
755 GPU_CLIENT_SINGLE_THREAD_CHECK();
756 GetIdHandler(id_namespaces::kBuffers
)->MakeIds(this, 0, n
, buffers
);
757 GenBuffersHelper(n
, buffers
);
758 helper_
->GenBuffersImmediate(n
, buffers
);
759 if (share_group_
->bind_generates_resource())
760 helper_
->CommandBufferHelper::Flush();
761 GPU_CLIENT_LOG_CODE_BLOCK({
762 for (GLsizei i
= 0; i
< n
; ++i
) {
763 GPU_CLIENT_LOG(" " << i
<< ": " << buffers
[i
]);
769 void GLES2Implementation::GenerateMipmap(GLenum target
) {
770 GPU_CLIENT_SINGLE_THREAD_CHECK();
771 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGenerateMipmap("
772 << GLES2Util::GetStringTextureBindTarget(target
) << ")");
773 helper_
->GenerateMipmap(target
);
777 void GLES2Implementation::GenFramebuffers(GLsizei n
, GLuint
* framebuffers
) {
778 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGenFramebuffers(" << n
<< ", "
779 << static_cast<const void*>(framebuffers
) << ")");
781 SetGLError(GL_INVALID_VALUE
, "glGenFramebuffers", "n < 0");
784 GPU_CLIENT_SINGLE_THREAD_CHECK();
785 GetIdHandler(id_namespaces::kFramebuffers
)->MakeIds(this, 0, n
, framebuffers
);
786 GenFramebuffersHelper(n
, framebuffers
);
787 helper_
->GenFramebuffersImmediate(n
, framebuffers
);
788 if (share_group_
->bind_generates_resource())
789 helper_
->CommandBufferHelper::Flush();
790 GPU_CLIENT_LOG_CODE_BLOCK({
791 for (GLsizei i
= 0; i
< n
; ++i
) {
792 GPU_CLIENT_LOG(" " << i
<< ": " << framebuffers
[i
]);
798 void GLES2Implementation::GenRenderbuffers(GLsizei n
, GLuint
* renderbuffers
) {
799 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGenRenderbuffers(" << n
<< ", "
800 << static_cast<const void*>(renderbuffers
) << ")");
802 SetGLError(GL_INVALID_VALUE
, "glGenRenderbuffers", "n < 0");
805 GPU_CLIENT_SINGLE_THREAD_CHECK();
806 GetIdHandler(id_namespaces::kRenderbuffers
)
807 ->MakeIds(this, 0, n
, renderbuffers
);
808 GenRenderbuffersHelper(n
, renderbuffers
);
809 helper_
->GenRenderbuffersImmediate(n
, renderbuffers
);
810 if (share_group_
->bind_generates_resource())
811 helper_
->CommandBufferHelper::Flush();
812 GPU_CLIENT_LOG_CODE_BLOCK({
813 for (GLsizei i
= 0; i
< n
; ++i
) {
814 GPU_CLIENT_LOG(" " << i
<< ": " << renderbuffers
[i
]);
820 void GLES2Implementation::GenSamplers(GLsizei n
, GLuint
* samplers
) {
821 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGenSamplers(" << n
<< ", "
822 << static_cast<const void*>(samplers
) << ")");
824 SetGLError(GL_INVALID_VALUE
, "glGenSamplers", "n < 0");
827 GPU_CLIENT_SINGLE_THREAD_CHECK();
828 GetIdHandler(id_namespaces::kSamplers
)->MakeIds(this, 0, n
, samplers
);
829 GenSamplersHelper(n
, samplers
);
830 helper_
->GenSamplersImmediate(n
, samplers
);
831 if (share_group_
->bind_generates_resource())
832 helper_
->CommandBufferHelper::Flush();
833 GPU_CLIENT_LOG_CODE_BLOCK({
834 for (GLsizei i
= 0; i
< n
; ++i
) {
835 GPU_CLIENT_LOG(" " << i
<< ": " << samplers
[i
]);
841 void GLES2Implementation::GenTextures(GLsizei n
, GLuint
* textures
) {
842 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGenTextures(" << n
<< ", "
843 << static_cast<const void*>(textures
) << ")");
845 SetGLError(GL_INVALID_VALUE
, "glGenTextures", "n < 0");
848 GPU_CLIENT_SINGLE_THREAD_CHECK();
849 GetIdHandler(id_namespaces::kTextures
)->MakeIds(this, 0, n
, textures
);
850 GenTexturesHelper(n
, textures
);
851 helper_
->GenTexturesImmediate(n
, textures
);
852 if (share_group_
->bind_generates_resource())
853 helper_
->CommandBufferHelper::Flush();
854 GPU_CLIENT_LOG_CODE_BLOCK({
855 for (GLsizei i
= 0; i
< n
; ++i
) {
856 GPU_CLIENT_LOG(" " << i
<< ": " << textures
[i
]);
862 void GLES2Implementation::GenTransformFeedbacks(GLsizei n
, GLuint
* ids
) {
863 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGenTransformFeedbacks(" << n
864 << ", " << static_cast<const void*>(ids
) << ")");
866 SetGLError(GL_INVALID_VALUE
, "glGenTransformFeedbacks", "n < 0");
869 GPU_CLIENT_SINGLE_THREAD_CHECK();
870 GetIdHandler(id_namespaces::kTransformFeedbacks
)->MakeIds(this, 0, n
, ids
);
871 GenTransformFeedbacksHelper(n
, ids
);
872 helper_
->GenTransformFeedbacksImmediate(n
, ids
);
873 if (share_group_
->bind_generates_resource())
874 helper_
->CommandBufferHelper::Flush();
875 GPU_CLIENT_LOG_CODE_BLOCK({
876 for (GLsizei i
= 0; i
< n
; ++i
) {
877 GPU_CLIENT_LOG(" " << i
<< ": " << ids
[i
]);
883 void GLES2Implementation::GetBooleanv(GLenum pname
, GLboolean
* params
) {
884 GPU_CLIENT_SINGLE_THREAD_CHECK();
885 GPU_CLIENT_VALIDATE_DESTINATION_INITALIZATION(GLboolean
, params
);
886 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetBooleanv("
887 << GLES2Util::GetStringGLState(pname
) << ", "
888 << static_cast<const void*>(params
) << ")");
889 TRACE_EVENT0("gpu", "GLES2Implementation::GetBooleanv");
890 if (GetBooleanvHelper(pname
, params
)) {
893 typedef cmds::GetBooleanv::Result Result
;
894 Result
* result
= GetResultAs
<Result
*>();
898 result
->SetNumResults(0);
899 helper_
->GetBooleanv(pname
, GetResultShmId(), GetResultShmOffset());
901 result
->CopyResult(params
);
902 GPU_CLIENT_LOG_CODE_BLOCK({
903 for (int32_t i
= 0; i
< result
->GetNumResults(); ++i
) {
904 GPU_CLIENT_LOG(" " << i
<< ": " << result
->GetData()[i
]);
909 void GLES2Implementation::GetBufferParameteriv(GLenum target
,
912 GPU_CLIENT_SINGLE_THREAD_CHECK();
913 GPU_CLIENT_VALIDATE_DESTINATION_INITALIZATION(GLint
, params
);
914 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetBufferParameteriv("
915 << GLES2Util::GetStringBufferTarget(target
) << ", "
916 << GLES2Util::GetStringBufferParameter(pname
) << ", "
917 << static_cast<const void*>(params
) << ")");
918 TRACE_EVENT0("gpu", "GLES2Implementation::GetBufferParameteriv");
919 if (GetBufferParameterivHelper(target
, pname
, params
)) {
922 typedef cmds::GetBufferParameteriv::Result Result
;
923 Result
* result
= GetResultAs
<Result
*>();
927 result
->SetNumResults(0);
928 helper_
->GetBufferParameteriv(target
, pname
, GetResultShmId(),
929 GetResultShmOffset());
931 result
->CopyResult(params
);
932 GPU_CLIENT_LOG_CODE_BLOCK({
933 for (int32_t i
= 0; i
< result
->GetNumResults(); ++i
) {
934 GPU_CLIENT_LOG(" " << i
<< ": " << result
->GetData()[i
]);
939 void GLES2Implementation::GetFloatv(GLenum pname
, GLfloat
* params
) {
940 GPU_CLIENT_SINGLE_THREAD_CHECK();
941 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetFloatv("
942 << GLES2Util::GetStringGLState(pname
) << ", "
943 << static_cast<const void*>(params
) << ")");
944 TRACE_EVENT0("gpu", "GLES2Implementation::GetFloatv");
945 if (GetFloatvHelper(pname
, params
)) {
948 typedef cmds::GetFloatv::Result Result
;
949 Result
* result
= GetResultAs
<Result
*>();
953 result
->SetNumResults(0);
954 helper_
->GetFloatv(pname
, GetResultShmId(), GetResultShmOffset());
956 result
->CopyResult(params
);
957 GPU_CLIENT_LOG_CODE_BLOCK({
958 for (int32_t i
= 0; i
< result
->GetNumResults(); ++i
) {
959 GPU_CLIENT_LOG(" " << i
<< ": " << result
->GetData()[i
]);
964 void GLES2Implementation::GetFramebufferAttachmentParameteriv(GLenum target
,
968 GPU_CLIENT_SINGLE_THREAD_CHECK();
969 GPU_CLIENT_VALIDATE_DESTINATION_INITALIZATION(GLint
, params
);
970 GPU_CLIENT_LOG("[" << GetLogPrefix()
971 << "] glGetFramebufferAttachmentParameteriv("
972 << GLES2Util::GetStringFrameBufferTarget(target
) << ", "
973 << GLES2Util::GetStringAttachment(attachment
) << ", "
974 << GLES2Util::GetStringFrameBufferParameter(pname
) << ", "
975 << static_cast<const void*>(params
) << ")");
977 "GLES2Implementation::GetFramebufferAttachmentParameteriv");
978 if (GetFramebufferAttachmentParameterivHelper(target
, attachment
, pname
,
982 typedef cmds::GetFramebufferAttachmentParameteriv::Result Result
;
983 Result
* result
= GetResultAs
<Result
*>();
987 result
->SetNumResults(0);
988 helper_
->GetFramebufferAttachmentParameteriv(
989 target
, attachment
, pname
, GetResultShmId(), GetResultShmOffset());
991 result
->CopyResult(params
);
992 GPU_CLIENT_LOG_CODE_BLOCK({
993 for (int32_t i
= 0; i
< result
->GetNumResults(); ++i
) {
994 GPU_CLIENT_LOG(" " << i
<< ": " << result
->GetData()[i
]);
999 void GLES2Implementation::GetInteger64v(GLenum pname
, GLint64
* params
) {
1000 GPU_CLIENT_SINGLE_THREAD_CHECK();
1001 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetInteger64v("
1002 << GLES2Util::GetStringGLState(pname
) << ", "
1003 << static_cast<const void*>(params
) << ")");
1004 TRACE_EVENT0("gpu", "GLES2Implementation::GetInteger64v");
1005 if (GetInteger64vHelper(pname
, params
)) {
1008 typedef cmds::GetInteger64v::Result Result
;
1009 Result
* result
= GetResultAs
<Result
*>();
1013 result
->SetNumResults(0);
1014 helper_
->GetInteger64v(pname
, GetResultShmId(), GetResultShmOffset());
1016 result
->CopyResult(params
);
1017 GPU_CLIENT_LOG_CODE_BLOCK({
1018 for (int32_t i
= 0; i
< result
->GetNumResults(); ++i
) {
1019 GPU_CLIENT_LOG(" " << i
<< ": " << result
->GetData()[i
]);
1024 void GLES2Implementation::GetIntegeri_v(GLenum pname
,
1027 GPU_CLIENT_SINGLE_THREAD_CHECK();
1028 GPU_CLIENT_VALIDATE_DESTINATION_INITALIZATION(GLint
, data
);
1029 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetIntegeri_v("
1030 << GLES2Util::GetStringIndexedGLState(pname
) << ", "
1031 << index
<< ", " << static_cast<const void*>(data
) << ")");
1032 TRACE_EVENT0("gpu", "GLES2Implementation::GetIntegeri_v");
1033 if (GetIntegeri_vHelper(pname
, index
, data
)) {
1036 typedef cmds::GetIntegeri_v::Result Result
;
1037 Result
* result
= GetResultAs
<Result
*>();
1041 result
->SetNumResults(0);
1042 helper_
->GetIntegeri_v(pname
, index
, GetResultShmId(), GetResultShmOffset());
1044 result
->CopyResult(data
);
1045 GPU_CLIENT_LOG_CODE_BLOCK({
1046 for (int32_t i
= 0; i
< result
->GetNumResults(); ++i
) {
1047 GPU_CLIENT_LOG(" " << i
<< ": " << result
->GetData()[i
]);
1052 void GLES2Implementation::GetInteger64i_v(GLenum pname
,
1055 GPU_CLIENT_SINGLE_THREAD_CHECK();
1056 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetInteger64i_v("
1057 << GLES2Util::GetStringIndexedGLState(pname
) << ", "
1058 << index
<< ", " << static_cast<const void*>(data
) << ")");
1059 TRACE_EVENT0("gpu", "GLES2Implementation::GetInteger64i_v");
1060 if (GetInteger64i_vHelper(pname
, index
, data
)) {
1063 typedef cmds::GetInteger64i_v::Result Result
;
1064 Result
* result
= GetResultAs
<Result
*>();
1068 result
->SetNumResults(0);
1069 helper_
->GetInteger64i_v(pname
, index
, GetResultShmId(),
1070 GetResultShmOffset());
1072 result
->CopyResult(data
);
1073 GPU_CLIENT_LOG_CODE_BLOCK({
1074 for (int32_t i
= 0; i
< result
->GetNumResults(); ++i
) {
1075 GPU_CLIENT_LOG(" " << i
<< ": " << result
->GetData()[i
]);
1080 void GLES2Implementation::GetIntegerv(GLenum pname
, GLint
* params
) {
1081 GPU_CLIENT_SINGLE_THREAD_CHECK();
1082 GPU_CLIENT_VALIDATE_DESTINATION_INITALIZATION(GLint
, params
);
1083 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetIntegerv("
1084 << GLES2Util::GetStringGLState(pname
) << ", "
1085 << static_cast<const void*>(params
) << ")");
1086 TRACE_EVENT0("gpu", "GLES2Implementation::GetIntegerv");
1087 if (GetIntegervHelper(pname
, params
)) {
1090 typedef cmds::GetIntegerv::Result Result
;
1091 Result
* result
= GetResultAs
<Result
*>();
1095 result
->SetNumResults(0);
1096 helper_
->GetIntegerv(pname
, GetResultShmId(), GetResultShmOffset());
1098 result
->CopyResult(params
);
1099 GPU_CLIENT_LOG_CODE_BLOCK({
1100 for (int32_t i
= 0; i
< result
->GetNumResults(); ++i
) {
1101 GPU_CLIENT_LOG(" " << i
<< ": " << result
->GetData()[i
]);
1106 void GLES2Implementation::GetProgramiv(GLuint program
,
1109 GPU_CLIENT_SINGLE_THREAD_CHECK();
1110 GPU_CLIENT_VALIDATE_DESTINATION_INITALIZATION(GLint
, params
);
1111 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetProgramiv(" << program
<< ", "
1112 << GLES2Util::GetStringProgramParameter(pname
) << ", "
1113 << static_cast<const void*>(params
) << ")");
1114 TRACE_EVENT0("gpu", "GLES2Implementation::GetProgramiv");
1115 if (GetProgramivHelper(program
, pname
, params
)) {
1118 typedef cmds::GetProgramiv::Result Result
;
1119 Result
* result
= GetResultAs
<Result
*>();
1123 result
->SetNumResults(0);
1124 helper_
->GetProgramiv(program
, pname
, GetResultShmId(), GetResultShmOffset());
1126 result
->CopyResult(params
);
1127 GPU_CLIENT_LOG_CODE_BLOCK({
1128 for (int32_t i
= 0; i
< result
->GetNumResults(); ++i
) {
1129 GPU_CLIENT_LOG(" " << i
<< ": " << result
->GetData()[i
]);
1134 void GLES2Implementation::GetProgramInfoLog(GLuint program
,
1138 GPU_CLIENT_SINGLE_THREAD_CHECK();
1139 GPU_CLIENT_VALIDATE_DESTINATION_OPTIONAL_INITALIZATION(GLsizei
, length
);
1140 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetProgramInfoLog"
1141 << "(" << program
<< ", " << bufsize
<< ", "
1142 << static_cast<void*>(length
) << ", "
1143 << static_cast<void*>(infolog
) << ")");
1144 helper_
->SetBucketSize(kResultBucketId
, 0);
1145 helper_
->GetProgramInfoLog(program
, kResultBucketId
);
1147 GLsizei max_size
= 0;
1148 if (GetBucketAsString(kResultBucketId
, &str
)) {
1150 max_size
= std::min(static_cast<size_t>(bufsize
) - 1, str
.size());
1151 memcpy(infolog
, str
.c_str(), max_size
);
1152 infolog
[max_size
] = '\0';
1153 GPU_CLIENT_LOG("------\n" << infolog
<< "\n------");
1156 if (length
!= NULL
) {
1161 void GLES2Implementation::GetRenderbufferParameteriv(GLenum target
,
1164 GPU_CLIENT_SINGLE_THREAD_CHECK();
1165 GPU_CLIENT_VALIDATE_DESTINATION_INITALIZATION(GLint
, params
);
1166 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetRenderbufferParameteriv("
1167 << GLES2Util::GetStringRenderBufferTarget(target
) << ", "
1168 << GLES2Util::GetStringRenderBufferParameter(pname
) << ", "
1169 << static_cast<const void*>(params
) << ")");
1170 TRACE_EVENT0("gpu", "GLES2Implementation::GetRenderbufferParameteriv");
1171 if (GetRenderbufferParameterivHelper(target
, pname
, params
)) {
1174 typedef cmds::GetRenderbufferParameteriv::Result Result
;
1175 Result
* result
= GetResultAs
<Result
*>();
1179 result
->SetNumResults(0);
1180 helper_
->GetRenderbufferParameteriv(target
, pname
, GetResultShmId(),
1181 GetResultShmOffset());
1183 result
->CopyResult(params
);
1184 GPU_CLIENT_LOG_CODE_BLOCK({
1185 for (int32_t i
= 0; i
< result
->GetNumResults(); ++i
) {
1186 GPU_CLIENT_LOG(" " << i
<< ": " << result
->GetData()[i
]);
1191 void GLES2Implementation::GetSamplerParameterfv(GLuint sampler
,
1194 GPU_CLIENT_SINGLE_THREAD_CHECK();
1195 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetSamplerParameterfv("
1197 << GLES2Util::GetStringSamplerParameter(pname
) << ", "
1198 << static_cast<const void*>(params
) << ")");
1199 TRACE_EVENT0("gpu", "GLES2Implementation::GetSamplerParameterfv");
1200 if (GetSamplerParameterfvHelper(sampler
, pname
, params
)) {
1203 typedef cmds::GetSamplerParameterfv::Result Result
;
1204 Result
* result
= GetResultAs
<Result
*>();
1208 result
->SetNumResults(0);
1209 helper_
->GetSamplerParameterfv(sampler
, pname
, GetResultShmId(),
1210 GetResultShmOffset());
1212 result
->CopyResult(params
);
1213 GPU_CLIENT_LOG_CODE_BLOCK({
1214 for (int32_t i
= 0; i
< result
->GetNumResults(); ++i
) {
1215 GPU_CLIENT_LOG(" " << i
<< ": " << result
->GetData()[i
]);
1220 void GLES2Implementation::GetSamplerParameteriv(GLuint sampler
,
1223 GPU_CLIENT_SINGLE_THREAD_CHECK();
1224 GPU_CLIENT_VALIDATE_DESTINATION_INITALIZATION(GLint
, params
);
1225 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetSamplerParameteriv("
1227 << GLES2Util::GetStringSamplerParameter(pname
) << ", "
1228 << static_cast<const void*>(params
) << ")");
1229 TRACE_EVENT0("gpu", "GLES2Implementation::GetSamplerParameteriv");
1230 if (GetSamplerParameterivHelper(sampler
, pname
, params
)) {
1233 typedef cmds::GetSamplerParameteriv::Result Result
;
1234 Result
* result
= GetResultAs
<Result
*>();
1238 result
->SetNumResults(0);
1239 helper_
->GetSamplerParameteriv(sampler
, pname
, GetResultShmId(),
1240 GetResultShmOffset());
1242 result
->CopyResult(params
);
1243 GPU_CLIENT_LOG_CODE_BLOCK({
1244 for (int32_t i
= 0; i
< result
->GetNumResults(); ++i
) {
1245 GPU_CLIENT_LOG(" " << i
<< ": " << result
->GetData()[i
]);
1250 void GLES2Implementation::GetShaderiv(GLuint shader
,
1253 GPU_CLIENT_SINGLE_THREAD_CHECK();
1254 GPU_CLIENT_VALIDATE_DESTINATION_INITALIZATION(GLint
, params
);
1255 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetShaderiv(" << shader
<< ", "
1256 << GLES2Util::GetStringShaderParameter(pname
) << ", "
1257 << static_cast<const void*>(params
) << ")");
1258 TRACE_EVENT0("gpu", "GLES2Implementation::GetShaderiv");
1259 if (GetShaderivHelper(shader
, pname
, params
)) {
1262 typedef cmds::GetShaderiv::Result Result
;
1263 Result
* result
= GetResultAs
<Result
*>();
1267 result
->SetNumResults(0);
1268 helper_
->GetShaderiv(shader
, pname
, GetResultShmId(), GetResultShmOffset());
1270 result
->CopyResult(params
);
1271 GPU_CLIENT_LOG_CODE_BLOCK({
1272 for (int32_t i
= 0; i
< result
->GetNumResults(); ++i
) {
1273 GPU_CLIENT_LOG(" " << i
<< ": " << result
->GetData()[i
]);
1278 void GLES2Implementation::GetShaderInfoLog(GLuint shader
,
1282 GPU_CLIENT_SINGLE_THREAD_CHECK();
1283 GPU_CLIENT_VALIDATE_DESTINATION_OPTIONAL_INITALIZATION(GLsizei
, length
);
1284 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetShaderInfoLog"
1285 << "(" << shader
<< ", " << bufsize
<< ", "
1286 << static_cast<void*>(length
) << ", "
1287 << static_cast<void*>(infolog
) << ")");
1288 helper_
->SetBucketSize(kResultBucketId
, 0);
1289 helper_
->GetShaderInfoLog(shader
, kResultBucketId
);
1291 GLsizei max_size
= 0;
1292 if (GetBucketAsString(kResultBucketId
, &str
)) {
1294 max_size
= std::min(static_cast<size_t>(bufsize
) - 1, str
.size());
1295 memcpy(infolog
, str
.c_str(), max_size
);
1296 infolog
[max_size
] = '\0';
1297 GPU_CLIENT_LOG("------\n" << infolog
<< "\n------");
1300 if (length
!= NULL
) {
1305 void GLES2Implementation::GetShaderSource(GLuint shader
,
1309 GPU_CLIENT_SINGLE_THREAD_CHECK();
1310 GPU_CLIENT_VALIDATE_DESTINATION_OPTIONAL_INITALIZATION(GLsizei
, length
);
1311 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetShaderSource"
1312 << "(" << shader
<< ", " << bufsize
<< ", "
1313 << static_cast<void*>(length
) << ", "
1314 << static_cast<void*>(source
) << ")");
1315 helper_
->SetBucketSize(kResultBucketId
, 0);
1316 helper_
->GetShaderSource(shader
, kResultBucketId
);
1318 GLsizei max_size
= 0;
1319 if (GetBucketAsString(kResultBucketId
, &str
)) {
1321 max_size
= std::min(static_cast<size_t>(bufsize
) - 1, str
.size());
1322 memcpy(source
, str
.c_str(), max_size
);
1323 source
[max_size
] = '\0';
1324 GPU_CLIENT_LOG("------\n" << source
<< "\n------");
1327 if (length
!= NULL
) {
1332 void GLES2Implementation::GetSynciv(GLsync sync
,
1337 GPU_CLIENT_SINGLE_THREAD_CHECK();
1338 GPU_CLIENT_VALIDATE_DESTINATION_OPTIONAL_INITALIZATION(GLsizei
, length
);
1339 GPU_CLIENT_VALIDATE_DESTINATION_INITALIZATION(GLint
, values
);
1340 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetSynciv(" << sync
<< ", "
1341 << GLES2Util::GetStringSyncParameter(pname
) << ", "
1342 << bufsize
<< ", " << static_cast<const void*>(length
)
1343 << ", " << static_cast<const void*>(values
) << ")");
1345 SetGLError(GL_INVALID_VALUE
, "glGetSynciv", "bufsize < 0");
1348 TRACE_EVENT0("gpu", "GLES2Implementation::GetSynciv");
1349 if (GetSyncivHelper(sync
, pname
, bufsize
, length
, values
)) {
1352 typedef cmds::GetSynciv::Result Result
;
1353 Result
* result
= GetResultAs
<Result
*>();
1357 result
->SetNumResults(0);
1358 helper_
->GetSynciv(ToGLuint(sync
), pname
, GetResultShmId(),
1359 GetResultShmOffset());
1361 result
->CopyResult(values
);
1362 GPU_CLIENT_LOG_CODE_BLOCK({
1363 for (int32_t i
= 0; i
< result
->GetNumResults(); ++i
) {
1364 GPU_CLIENT_LOG(" " << i
<< ": " << result
->GetData()[i
]);
1368 *length
= result
->GetNumResults();
1372 void GLES2Implementation::GetTexParameterfv(GLenum target
,
1375 GPU_CLIENT_SINGLE_THREAD_CHECK();
1376 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetTexParameterfv("
1377 << GLES2Util::GetStringGetTexParamTarget(target
) << ", "
1378 << GLES2Util::GetStringTextureParameter(pname
) << ", "
1379 << static_cast<const void*>(params
) << ")");
1380 TRACE_EVENT0("gpu", "GLES2Implementation::GetTexParameterfv");
1381 if (GetTexParameterfvHelper(target
, pname
, params
)) {
1384 typedef cmds::GetTexParameterfv::Result Result
;
1385 Result
* result
= GetResultAs
<Result
*>();
1389 result
->SetNumResults(0);
1390 helper_
->GetTexParameterfv(target
, pname
, GetResultShmId(),
1391 GetResultShmOffset());
1393 result
->CopyResult(params
);
1394 GPU_CLIENT_LOG_CODE_BLOCK({
1395 for (int32_t i
= 0; i
< result
->GetNumResults(); ++i
) {
1396 GPU_CLIENT_LOG(" " << i
<< ": " << result
->GetData()[i
]);
1401 void GLES2Implementation::GetTexParameteriv(GLenum target
,
1404 GPU_CLIENT_SINGLE_THREAD_CHECK();
1405 GPU_CLIENT_VALIDATE_DESTINATION_INITALIZATION(GLint
, params
);
1406 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetTexParameteriv("
1407 << GLES2Util::GetStringGetTexParamTarget(target
) << ", "
1408 << GLES2Util::GetStringTextureParameter(pname
) << ", "
1409 << static_cast<const void*>(params
) << ")");
1410 TRACE_EVENT0("gpu", "GLES2Implementation::GetTexParameteriv");
1411 if (GetTexParameterivHelper(target
, pname
, params
)) {
1414 typedef cmds::GetTexParameteriv::Result Result
;
1415 Result
* result
= GetResultAs
<Result
*>();
1419 result
->SetNumResults(0);
1420 helper_
->GetTexParameteriv(target
, pname
, GetResultShmId(),
1421 GetResultShmOffset());
1423 result
->CopyResult(params
);
1424 GPU_CLIENT_LOG_CODE_BLOCK({
1425 for (int32_t i
= 0; i
< result
->GetNumResults(); ++i
) {
1426 GPU_CLIENT_LOG(" " << i
<< ": " << result
->GetData()[i
]);
1431 void GLES2Implementation::Hint(GLenum target
, GLenum mode
) {
1432 GPU_CLIENT_SINGLE_THREAD_CHECK();
1433 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glHint("
1434 << GLES2Util::GetStringHintTarget(target
) << ", "
1435 << GLES2Util::GetStringHintMode(mode
) << ")");
1436 helper_
->Hint(target
, mode
);
1440 void GLES2Implementation::InvalidateFramebuffer(GLenum target
,
1442 const GLenum
* attachments
) {
1443 GPU_CLIENT_SINGLE_THREAD_CHECK();
1444 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glInvalidateFramebuffer("
1445 << GLES2Util::GetStringInvalidateFrameBufferTarget(target
)
1446 << ", " << count
<< ", "
1447 << static_cast<const void*>(attachments
) << ")");
1448 GPU_CLIENT_LOG_CODE_BLOCK({
1449 for (GLsizei i
= 0; i
< count
; ++i
) {
1450 GPU_CLIENT_LOG(" " << i
<< ": " << attachments
[0 + i
* 1]);
1454 SetGLError(GL_INVALID_VALUE
, "glInvalidateFramebuffer", "count < 0");
1457 helper_
->InvalidateFramebufferImmediate(target
, count
, attachments
);
1461 void GLES2Implementation::InvalidateSubFramebuffer(GLenum target
,
1463 const GLenum
* attachments
,
1468 GPU_CLIENT_SINGLE_THREAD_CHECK();
1469 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glInvalidateSubFramebuffer("
1470 << GLES2Util::GetStringInvalidateFrameBufferTarget(target
)
1471 << ", " << count
<< ", "
1472 << static_cast<const void*>(attachments
) << ", " << x
1473 << ", " << y
<< ", " << width
<< ", " << height
<< ")");
1474 GPU_CLIENT_LOG_CODE_BLOCK({
1475 for (GLsizei i
= 0; i
< count
; ++i
) {
1476 GPU_CLIENT_LOG(" " << i
<< ": " << attachments
[0 + i
* 1]);
1480 SetGLError(GL_INVALID_VALUE
, "glInvalidateSubFramebuffer", "count < 0");
1484 SetGLError(GL_INVALID_VALUE
, "glInvalidateSubFramebuffer", "width < 0");
1488 SetGLError(GL_INVALID_VALUE
, "glInvalidateSubFramebuffer", "height < 0");
1491 helper_
->InvalidateSubFramebufferImmediate(target
, count
, attachments
, x
, y
,
1496 GLboolean
GLES2Implementation::IsBuffer(GLuint buffer
) {
1497 GPU_CLIENT_SINGLE_THREAD_CHECK();
1498 TRACE_EVENT0("gpu", "GLES2Implementation::IsBuffer");
1499 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glIsBuffer(" << buffer
<< ")");
1500 typedef cmds::IsBuffer::Result Result
;
1501 Result
* result
= GetResultAs
<Result
*>();
1506 helper_
->IsBuffer(buffer
, GetResultShmId(), GetResultShmOffset());
1508 GLboolean result_value
= *result
!= 0;
1509 GPU_CLIENT_LOG("returned " << result_value
);
1511 return result_value
;
1514 GLboolean
GLES2Implementation::IsFramebuffer(GLuint framebuffer
) {
1515 GPU_CLIENT_SINGLE_THREAD_CHECK();
1516 TRACE_EVENT0("gpu", "GLES2Implementation::IsFramebuffer");
1517 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glIsFramebuffer(" << framebuffer
1519 typedef cmds::IsFramebuffer::Result Result
;
1520 Result
* result
= GetResultAs
<Result
*>();
1525 helper_
->IsFramebuffer(framebuffer
, GetResultShmId(), GetResultShmOffset());
1527 GLboolean result_value
= *result
!= 0;
1528 GPU_CLIENT_LOG("returned " << result_value
);
1530 return result_value
;
1533 GLboolean
GLES2Implementation::IsProgram(GLuint program
) {
1534 GPU_CLIENT_SINGLE_THREAD_CHECK();
1535 TRACE_EVENT0("gpu", "GLES2Implementation::IsProgram");
1536 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glIsProgram(" << program
<< ")");
1537 typedef cmds::IsProgram::Result Result
;
1538 Result
* result
= GetResultAs
<Result
*>();
1543 helper_
->IsProgram(program
, GetResultShmId(), GetResultShmOffset());
1545 GLboolean result_value
= *result
!= 0;
1546 GPU_CLIENT_LOG("returned " << result_value
);
1548 return result_value
;
1551 GLboolean
GLES2Implementation::IsRenderbuffer(GLuint renderbuffer
) {
1552 GPU_CLIENT_SINGLE_THREAD_CHECK();
1553 TRACE_EVENT0("gpu", "GLES2Implementation::IsRenderbuffer");
1554 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glIsRenderbuffer(" << renderbuffer
1556 typedef cmds::IsRenderbuffer::Result Result
;
1557 Result
* result
= GetResultAs
<Result
*>();
1562 helper_
->IsRenderbuffer(renderbuffer
, GetResultShmId(), GetResultShmOffset());
1564 GLboolean result_value
= *result
!= 0;
1565 GPU_CLIENT_LOG("returned " << result_value
);
1567 return result_value
;
1570 GLboolean
GLES2Implementation::IsSampler(GLuint sampler
) {
1571 GPU_CLIENT_SINGLE_THREAD_CHECK();
1572 TRACE_EVENT0("gpu", "GLES2Implementation::IsSampler");
1573 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glIsSampler(" << sampler
<< ")");
1574 typedef cmds::IsSampler::Result Result
;
1575 Result
* result
= GetResultAs
<Result
*>();
1580 helper_
->IsSampler(sampler
, GetResultShmId(), GetResultShmOffset());
1582 GLboolean result_value
= *result
!= 0;
1583 GPU_CLIENT_LOG("returned " << result_value
);
1585 return result_value
;
1588 GLboolean
GLES2Implementation::IsShader(GLuint shader
) {
1589 GPU_CLIENT_SINGLE_THREAD_CHECK();
1590 TRACE_EVENT0("gpu", "GLES2Implementation::IsShader");
1591 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glIsShader(" << shader
<< ")");
1592 typedef cmds::IsShader::Result Result
;
1593 Result
* result
= GetResultAs
<Result
*>();
1598 helper_
->IsShader(shader
, GetResultShmId(), GetResultShmOffset());
1600 GLboolean result_value
= *result
!= 0;
1601 GPU_CLIENT_LOG("returned " << result_value
);
1603 return result_value
;
1606 GLboolean
GLES2Implementation::IsSync(GLsync sync
) {
1607 GPU_CLIENT_SINGLE_THREAD_CHECK();
1608 TRACE_EVENT0("gpu", "GLES2Implementation::IsSync");
1609 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glIsSync(" << sync
<< ")");
1610 typedef cmds::IsSync::Result Result
;
1611 Result
* result
= GetResultAs
<Result
*>();
1616 helper_
->IsSync(ToGLuint(sync
), GetResultShmId(), GetResultShmOffset());
1618 GLboolean result_value
= *result
!= 0;
1619 GPU_CLIENT_LOG("returned " << result_value
);
1621 return result_value
;
1624 GLboolean
GLES2Implementation::IsTexture(GLuint texture
) {
1625 GPU_CLIENT_SINGLE_THREAD_CHECK();
1626 TRACE_EVENT0("gpu", "GLES2Implementation::IsTexture");
1627 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glIsTexture(" << texture
<< ")");
1628 typedef cmds::IsTexture::Result Result
;
1629 Result
* result
= GetResultAs
<Result
*>();
1634 helper_
->IsTexture(texture
, GetResultShmId(), GetResultShmOffset());
1636 GLboolean result_value
= *result
!= 0;
1637 GPU_CLIENT_LOG("returned " << result_value
);
1639 return result_value
;
1642 GLboolean
GLES2Implementation::IsTransformFeedback(GLuint transformfeedback
) {
1643 GPU_CLIENT_SINGLE_THREAD_CHECK();
1644 TRACE_EVENT0("gpu", "GLES2Implementation::IsTransformFeedback");
1645 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glIsTransformFeedback("
1646 << transformfeedback
<< ")");
1647 typedef cmds::IsTransformFeedback::Result Result
;
1648 Result
* result
= GetResultAs
<Result
*>();
1653 helper_
->IsTransformFeedback(transformfeedback
, GetResultShmId(),
1654 GetResultShmOffset());
1656 GLboolean result_value
= *result
!= 0;
1657 GPU_CLIENT_LOG("returned " << result_value
);
1659 return result_value
;
1662 void GLES2Implementation::LineWidth(GLfloat width
) {
1663 GPU_CLIENT_SINGLE_THREAD_CHECK();
1664 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glLineWidth(" << width
<< ")");
1665 helper_
->LineWidth(width
);
1669 void GLES2Implementation::PauseTransformFeedback() {
1670 GPU_CLIENT_SINGLE_THREAD_CHECK();
1671 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glPauseTransformFeedback("
1673 helper_
->PauseTransformFeedback();
1677 void GLES2Implementation::PolygonOffset(GLfloat factor
, GLfloat units
) {
1678 GPU_CLIENT_SINGLE_THREAD_CHECK();
1679 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glPolygonOffset(" << factor
<< ", "
1681 helper_
->PolygonOffset(factor
, units
);
1685 void GLES2Implementation::ReadBuffer(GLenum src
) {
1686 GPU_CLIENT_SINGLE_THREAD_CHECK();
1687 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glReadBuffer("
1688 << GLES2Util::GetStringEnum(src
) << ")");
1689 helper_
->ReadBuffer(src
);
1693 void GLES2Implementation::ReleaseShaderCompiler() {
1694 GPU_CLIENT_SINGLE_THREAD_CHECK();
1695 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glReleaseShaderCompiler("
1697 helper_
->ReleaseShaderCompiler();
1701 void GLES2Implementation::RenderbufferStorage(GLenum target
,
1702 GLenum internalformat
,
1705 GPU_CLIENT_SINGLE_THREAD_CHECK();
1706 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glRenderbufferStorage("
1707 << GLES2Util::GetStringRenderBufferTarget(target
) << ", "
1708 << GLES2Util::GetStringRenderBufferFormat(internalformat
)
1709 << ", " << width
<< ", " << height
<< ")");
1711 SetGLError(GL_INVALID_VALUE
, "glRenderbufferStorage", "width < 0");
1715 SetGLError(GL_INVALID_VALUE
, "glRenderbufferStorage", "height < 0");
1718 helper_
->RenderbufferStorage(target
, internalformat
, width
, height
);
1722 void GLES2Implementation::ResumeTransformFeedback() {
1723 GPU_CLIENT_SINGLE_THREAD_CHECK();
1724 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glResumeTransformFeedback("
1726 helper_
->ResumeTransformFeedback();
1730 void GLES2Implementation::SampleCoverage(GLclampf value
, GLboolean invert
) {
1731 GPU_CLIENT_SINGLE_THREAD_CHECK();
1732 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glSampleCoverage(" << value
<< ", "
1733 << GLES2Util::GetStringBool(invert
) << ")");
1734 helper_
->SampleCoverage(value
, invert
);
1738 void GLES2Implementation::SamplerParameterf(GLuint sampler
,
1741 GPU_CLIENT_SINGLE_THREAD_CHECK();
1742 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glSamplerParameterf(" << sampler
1743 << ", " << GLES2Util::GetStringSamplerParameter(pname
)
1744 << ", " << param
<< ")");
1745 helper_
->SamplerParameterf(sampler
, pname
, param
);
1749 void GLES2Implementation::SamplerParameterfv(GLuint sampler
,
1751 const GLfloat
* params
) {
1752 GPU_CLIENT_SINGLE_THREAD_CHECK();
1753 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glSamplerParameterfv(" << sampler
1754 << ", " << GLES2Util::GetStringSamplerParameter(pname
)
1755 << ", " << static_cast<const void*>(params
) << ")");
1757 for (size_t ii
= 0; ii
< count
; ++ii
)
1758 GPU_CLIENT_LOG("value[" << ii
<< "]: " << params
[ii
]);
1759 helper_
->SamplerParameterfvImmediate(sampler
, pname
, params
);
1763 void GLES2Implementation::SamplerParameteri(GLuint sampler
,
1766 GPU_CLIENT_SINGLE_THREAD_CHECK();
1767 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glSamplerParameteri(" << sampler
1768 << ", " << GLES2Util::GetStringSamplerParameter(pname
)
1769 << ", " << param
<< ")");
1770 helper_
->SamplerParameteri(sampler
, pname
, param
);
1774 void GLES2Implementation::SamplerParameteriv(GLuint sampler
,
1776 const GLint
* params
) {
1777 GPU_CLIENT_SINGLE_THREAD_CHECK();
1778 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glSamplerParameteriv(" << sampler
1779 << ", " << GLES2Util::GetStringSamplerParameter(pname
)
1780 << ", " << static_cast<const void*>(params
) << ")");
1782 for (size_t ii
= 0; ii
< count
; ++ii
)
1783 GPU_CLIENT_LOG("value[" << ii
<< "]: " << params
[ii
]);
1784 helper_
->SamplerParameterivImmediate(sampler
, pname
, params
);
1788 void GLES2Implementation::Scissor(GLint x
,
1792 GPU_CLIENT_SINGLE_THREAD_CHECK();
1793 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glScissor(" << x
<< ", " << y
1794 << ", " << width
<< ", " << height
<< ")");
1796 SetGLError(GL_INVALID_VALUE
, "glScissor", "width < 0");
1800 SetGLError(GL_INVALID_VALUE
, "glScissor", "height < 0");
1803 helper_
->Scissor(x
, y
, width
, height
);
1807 void GLES2Implementation::ShaderSource(GLuint shader
,
1809 const GLchar
* const* str
,
1810 const GLint
* length
) {
1811 GPU_CLIENT_SINGLE_THREAD_CHECK();
1812 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glShaderSource(" << shader
<< ", "
1813 << count
<< ", " << static_cast<const void*>(str
) << ", "
1814 << static_cast<const void*>(length
) << ")");
1815 GPU_CLIENT_LOG_CODE_BLOCK({
1816 for (GLsizei ii
= 0; ii
< count
; ++ii
) {
1818 if (length
&& length
[ii
] >= 0) {
1819 const std::string
my_str(str
[ii
], length
[ii
]);
1820 GPU_CLIENT_LOG(" " << ii
<< ": ---\n" << my_str
<< "\n---");
1822 GPU_CLIENT_LOG(" " << ii
<< ": ---\n" << str
[ii
] << "\n---");
1825 GPU_CLIENT_LOG(" " << ii
<< ": NULL");
1830 SetGLError(GL_INVALID_VALUE
, "glShaderSource", "count < 0");
1834 if (!PackStringsToBucket(count
, str
, length
, "glShaderSource")) {
1837 helper_
->ShaderSourceBucket(shader
, kResultBucketId
);
1838 helper_
->SetBucketSize(kResultBucketId
, 0);
1842 void GLES2Implementation::StencilFunc(GLenum func
, GLint ref
, GLuint mask
) {
1843 GPU_CLIENT_SINGLE_THREAD_CHECK();
1844 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glStencilFunc("
1845 << GLES2Util::GetStringCmpFunction(func
) << ", " << ref
1846 << ", " << mask
<< ")");
1847 helper_
->StencilFunc(func
, ref
, mask
);
1851 void GLES2Implementation::StencilFuncSeparate(GLenum face
,
1855 GPU_CLIENT_SINGLE_THREAD_CHECK();
1856 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glStencilFuncSeparate("
1857 << GLES2Util::GetStringFaceType(face
) << ", "
1858 << GLES2Util::GetStringCmpFunction(func
) << ", " << ref
1859 << ", " << mask
<< ")");
1860 helper_
->StencilFuncSeparate(face
, func
, ref
, mask
);
1864 void GLES2Implementation::StencilMask(GLuint mask
) {
1865 GPU_CLIENT_SINGLE_THREAD_CHECK();
1866 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glStencilMask(" << mask
<< ")");
1867 helper_
->StencilMask(mask
);
1871 void GLES2Implementation::StencilMaskSeparate(GLenum face
, GLuint mask
) {
1872 GPU_CLIENT_SINGLE_THREAD_CHECK();
1873 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glStencilMaskSeparate("
1874 << GLES2Util::GetStringFaceType(face
) << ", " << mask
1876 helper_
->StencilMaskSeparate(face
, mask
);
1880 void GLES2Implementation::StencilOp(GLenum fail
, GLenum zfail
, GLenum zpass
) {
1881 GPU_CLIENT_SINGLE_THREAD_CHECK();
1882 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glStencilOp("
1883 << GLES2Util::GetStringStencilOp(fail
) << ", "
1884 << GLES2Util::GetStringStencilOp(zfail
) << ", "
1885 << GLES2Util::GetStringStencilOp(zpass
) << ")");
1886 helper_
->StencilOp(fail
, zfail
, zpass
);
1890 void GLES2Implementation::StencilOpSeparate(GLenum face
,
1894 GPU_CLIENT_SINGLE_THREAD_CHECK();
1895 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glStencilOpSeparate("
1896 << GLES2Util::GetStringFaceType(face
) << ", "
1897 << GLES2Util::GetStringStencilOp(fail
) << ", "
1898 << GLES2Util::GetStringStencilOp(zfail
) << ", "
1899 << GLES2Util::GetStringStencilOp(zpass
) << ")");
1900 helper_
->StencilOpSeparate(face
, fail
, zfail
, zpass
);
1904 void GLES2Implementation::TexParameterf(GLenum target
,
1907 GPU_CLIENT_SINGLE_THREAD_CHECK();
1908 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glTexParameterf("
1909 << GLES2Util::GetStringTextureBindTarget(target
) << ", "
1910 << GLES2Util::GetStringTextureParameter(pname
) << ", "
1912 helper_
->TexParameterf(target
, pname
, param
);
1916 void GLES2Implementation::TexParameterfv(GLenum target
,
1918 const GLfloat
* params
) {
1919 GPU_CLIENT_SINGLE_THREAD_CHECK();
1920 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glTexParameterfv("
1921 << GLES2Util::GetStringTextureBindTarget(target
) << ", "
1922 << GLES2Util::GetStringTextureParameter(pname
) << ", "
1923 << static_cast<const void*>(params
) << ")");
1925 for (size_t ii
= 0; ii
< count
; ++ii
)
1926 GPU_CLIENT_LOG("value[" << ii
<< "]: " << params
[ii
]);
1927 helper_
->TexParameterfvImmediate(target
, pname
, params
);
1931 void GLES2Implementation::TexParameteri(GLenum target
,
1934 GPU_CLIENT_SINGLE_THREAD_CHECK();
1935 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glTexParameteri("
1936 << GLES2Util::GetStringTextureBindTarget(target
) << ", "
1937 << GLES2Util::GetStringTextureParameter(pname
) << ", "
1939 helper_
->TexParameteri(target
, pname
, param
);
1943 void GLES2Implementation::TexParameteriv(GLenum target
,
1945 const GLint
* params
) {
1946 GPU_CLIENT_SINGLE_THREAD_CHECK();
1947 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glTexParameteriv("
1948 << GLES2Util::GetStringTextureBindTarget(target
) << ", "
1949 << GLES2Util::GetStringTextureParameter(pname
) << ", "
1950 << static_cast<const void*>(params
) << ")");
1952 for (size_t ii
= 0; ii
< count
; ++ii
)
1953 GPU_CLIENT_LOG("value[" << ii
<< "]: " << params
[ii
]);
1954 helper_
->TexParameterivImmediate(target
, pname
, params
);
1958 void GLES2Implementation::TexStorage3D(GLenum target
,
1960 GLenum internalFormat
,
1964 GPU_CLIENT_SINGLE_THREAD_CHECK();
1966 "[" << GetLogPrefix() << "] glTexStorage3D("
1967 << GLES2Util::GetStringTexture3DTarget(target
) << ", " << levels
1969 << GLES2Util::GetStringTextureInternalFormatStorage(internalFormat
)
1970 << ", " << width
<< ", " << height
<< ", " << depth
<< ")");
1972 SetGLError(GL_INVALID_VALUE
, "glTexStorage3D", "levels < 0");
1976 SetGLError(GL_INVALID_VALUE
, "glTexStorage3D", "width < 0");
1980 SetGLError(GL_INVALID_VALUE
, "glTexStorage3D", "height < 0");
1984 SetGLError(GL_INVALID_VALUE
, "glTexStorage3D", "depth < 0");
1987 helper_
->TexStorage3D(target
, levels
, internalFormat
, width
, height
, depth
);
1991 void GLES2Implementation::TransformFeedbackVaryings(GLuint program
,
1993 const char* const* varyings
,
1994 GLenum buffermode
) {
1995 GPU_CLIENT_SINGLE_THREAD_CHECK();
1996 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glTransformFeedbackVaryings("
1997 << program
<< ", " << count
<< ", "
1998 << static_cast<const void*>(varyings
) << ", "
1999 << GLES2Util::GetStringBufferMode(buffermode
) << ")");
2000 GPU_CLIENT_LOG_CODE_BLOCK({
2001 for (GLsizei ii
= 0; ii
< count
; ++ii
) {
2003 GPU_CLIENT_LOG(" " << ii
<< ": ---\n" << varyings
[ii
] << "\n---");
2005 GPU_CLIENT_LOG(" " << ii
<< ": NULL");
2010 SetGLError(GL_INVALID_VALUE
, "glTransformFeedbackVaryings", "count < 0");
2014 if (!PackStringsToBucket(count
, varyings
, NULL
,
2015 "glTransformFeedbackVaryings")) {
2018 helper_
->TransformFeedbackVaryingsBucket(program
, kResultBucketId
,
2020 helper_
->SetBucketSize(kResultBucketId
, 0);
2024 void GLES2Implementation::Uniform1f(GLint location
, GLfloat x
) {
2025 GPU_CLIENT_SINGLE_THREAD_CHECK();
2026 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform1f(" << location
<< ", "
2028 helper_
->Uniform1f(location
, x
);
2032 void GLES2Implementation::Uniform1fv(GLint location
,
2035 GPU_CLIENT_SINGLE_THREAD_CHECK();
2036 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform1fv(" << location
<< ", "
2037 << count
<< ", " << static_cast<const void*>(v
) << ")");
2038 GPU_CLIENT_LOG_CODE_BLOCK({
2039 for (GLsizei i
= 0; i
< count
; ++i
) {
2040 GPU_CLIENT_LOG(" " << i
<< ": " << v
[0 + i
* 1]);
2044 SetGLError(GL_INVALID_VALUE
, "glUniform1fv", "count < 0");
2047 helper_
->Uniform1fvImmediate(location
, count
, v
);
2051 void GLES2Implementation::Uniform1i(GLint location
, GLint x
) {
2052 GPU_CLIENT_SINGLE_THREAD_CHECK();
2053 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform1i(" << location
<< ", "
2055 helper_
->Uniform1i(location
, x
);
2059 void GLES2Implementation::Uniform1iv(GLint location
,
2062 GPU_CLIENT_SINGLE_THREAD_CHECK();
2063 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform1iv(" << location
<< ", "
2064 << count
<< ", " << static_cast<const void*>(v
) << ")");
2065 GPU_CLIENT_LOG_CODE_BLOCK({
2066 for (GLsizei i
= 0; i
< count
; ++i
) {
2067 GPU_CLIENT_LOG(" " << i
<< ": " << v
[0 + i
* 1]);
2071 SetGLError(GL_INVALID_VALUE
, "glUniform1iv", "count < 0");
2074 helper_
->Uniform1ivImmediate(location
, count
, v
);
2078 void GLES2Implementation::Uniform1ui(GLint location
, GLuint x
) {
2079 GPU_CLIENT_SINGLE_THREAD_CHECK();
2080 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform1ui(" << location
<< ", "
2082 helper_
->Uniform1ui(location
, x
);
2086 void GLES2Implementation::Uniform1uiv(GLint location
,
2089 GPU_CLIENT_SINGLE_THREAD_CHECK();
2090 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform1uiv(" << location
<< ", "
2091 << count
<< ", " << static_cast<const void*>(v
) << ")");
2092 GPU_CLIENT_LOG_CODE_BLOCK({
2093 for (GLsizei i
= 0; i
< count
; ++i
) {
2094 GPU_CLIENT_LOG(" " << i
<< ": " << v
[0 + i
* 1]);
2098 SetGLError(GL_INVALID_VALUE
, "glUniform1uiv", "count < 0");
2101 helper_
->Uniform1uivImmediate(location
, count
, v
);
2105 void GLES2Implementation::Uniform2f(GLint location
, GLfloat x
, GLfloat y
) {
2106 GPU_CLIENT_SINGLE_THREAD_CHECK();
2107 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform2f(" << location
<< ", "
2108 << x
<< ", " << y
<< ")");
2109 helper_
->Uniform2f(location
, x
, y
);
2113 void GLES2Implementation::Uniform2fv(GLint location
,
2116 GPU_CLIENT_SINGLE_THREAD_CHECK();
2117 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform2fv(" << location
<< ", "
2118 << count
<< ", " << static_cast<const void*>(v
) << ")");
2119 GPU_CLIENT_LOG_CODE_BLOCK({
2120 for (GLsizei i
= 0; i
< count
; ++i
) {
2121 GPU_CLIENT_LOG(" " << i
<< ": " << v
[0 + i
* 2] << ", " << v
[1 + i
* 2]);
2125 SetGLError(GL_INVALID_VALUE
, "glUniform2fv", "count < 0");
2128 helper_
->Uniform2fvImmediate(location
, count
, v
);
2132 void GLES2Implementation::Uniform2i(GLint location
, GLint x
, GLint y
) {
2133 GPU_CLIENT_SINGLE_THREAD_CHECK();
2134 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform2i(" << location
<< ", "
2135 << x
<< ", " << y
<< ")");
2136 helper_
->Uniform2i(location
, x
, y
);
2140 void GLES2Implementation::Uniform2iv(GLint location
,
2143 GPU_CLIENT_SINGLE_THREAD_CHECK();
2144 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform2iv(" << location
<< ", "
2145 << count
<< ", " << static_cast<const void*>(v
) << ")");
2146 GPU_CLIENT_LOG_CODE_BLOCK({
2147 for (GLsizei i
= 0; i
< count
; ++i
) {
2148 GPU_CLIENT_LOG(" " << i
<< ": " << v
[0 + i
* 2] << ", " << v
[1 + i
* 2]);
2152 SetGLError(GL_INVALID_VALUE
, "glUniform2iv", "count < 0");
2155 helper_
->Uniform2ivImmediate(location
, count
, v
);
2159 void GLES2Implementation::Uniform2ui(GLint location
, GLuint x
, GLuint y
) {
2160 GPU_CLIENT_SINGLE_THREAD_CHECK();
2161 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform2ui(" << location
<< ", "
2162 << x
<< ", " << y
<< ")");
2163 helper_
->Uniform2ui(location
, x
, y
);
2167 void GLES2Implementation::Uniform2uiv(GLint location
,
2170 GPU_CLIENT_SINGLE_THREAD_CHECK();
2171 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform2uiv(" << location
<< ", "
2172 << count
<< ", " << static_cast<const void*>(v
) << ")");
2173 GPU_CLIENT_LOG_CODE_BLOCK({
2174 for (GLsizei i
= 0; i
< count
; ++i
) {
2175 GPU_CLIENT_LOG(" " << i
<< ": " << v
[0 + i
* 2] << ", " << v
[1 + i
* 2]);
2179 SetGLError(GL_INVALID_VALUE
, "glUniform2uiv", "count < 0");
2182 helper_
->Uniform2uivImmediate(location
, count
, v
);
2186 void GLES2Implementation::Uniform3f(GLint location
,
2190 GPU_CLIENT_SINGLE_THREAD_CHECK();
2191 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform3f(" << location
<< ", "
2192 << x
<< ", " << y
<< ", " << z
<< ")");
2193 helper_
->Uniform3f(location
, x
, y
, z
);
2197 void GLES2Implementation::Uniform3fv(GLint location
,
2200 GPU_CLIENT_SINGLE_THREAD_CHECK();
2201 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform3fv(" << location
<< ", "
2202 << count
<< ", " << static_cast<const void*>(v
) << ")");
2203 GPU_CLIENT_LOG_CODE_BLOCK({
2204 for (GLsizei i
= 0; i
< count
; ++i
) {
2205 GPU_CLIENT_LOG(" " << i
<< ": " << v
[0 + i
* 3] << ", " << v
[1 + i
* 3]
2206 << ", " << v
[2 + i
* 3]);
2210 SetGLError(GL_INVALID_VALUE
, "glUniform3fv", "count < 0");
2213 helper_
->Uniform3fvImmediate(location
, count
, v
);
2217 void GLES2Implementation::Uniform3i(GLint location
, GLint x
, GLint y
, GLint z
) {
2218 GPU_CLIENT_SINGLE_THREAD_CHECK();
2219 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform3i(" << location
<< ", "
2220 << x
<< ", " << y
<< ", " << z
<< ")");
2221 helper_
->Uniform3i(location
, x
, y
, z
);
2225 void GLES2Implementation::Uniform3iv(GLint location
,
2228 GPU_CLIENT_SINGLE_THREAD_CHECK();
2229 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform3iv(" << location
<< ", "
2230 << count
<< ", " << static_cast<const void*>(v
) << ")");
2231 GPU_CLIENT_LOG_CODE_BLOCK({
2232 for (GLsizei i
= 0; i
< count
; ++i
) {
2233 GPU_CLIENT_LOG(" " << i
<< ": " << v
[0 + i
* 3] << ", " << v
[1 + i
* 3]
2234 << ", " << v
[2 + i
* 3]);
2238 SetGLError(GL_INVALID_VALUE
, "glUniform3iv", "count < 0");
2241 helper_
->Uniform3ivImmediate(location
, count
, v
);
2245 void GLES2Implementation::Uniform3ui(GLint location
,
2249 GPU_CLIENT_SINGLE_THREAD_CHECK();
2250 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform3ui(" << location
<< ", "
2251 << x
<< ", " << y
<< ", " << z
<< ")");
2252 helper_
->Uniform3ui(location
, x
, y
, z
);
2256 void GLES2Implementation::Uniform3uiv(GLint location
,
2259 GPU_CLIENT_SINGLE_THREAD_CHECK();
2260 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform3uiv(" << location
<< ", "
2261 << count
<< ", " << static_cast<const void*>(v
) << ")");
2262 GPU_CLIENT_LOG_CODE_BLOCK({
2263 for (GLsizei i
= 0; i
< count
; ++i
) {
2264 GPU_CLIENT_LOG(" " << i
<< ": " << v
[0 + i
* 3] << ", " << v
[1 + i
* 3]
2265 << ", " << v
[2 + i
* 3]);
2269 SetGLError(GL_INVALID_VALUE
, "glUniform3uiv", "count < 0");
2272 helper_
->Uniform3uivImmediate(location
, count
, v
);
2276 void GLES2Implementation::Uniform4f(GLint location
,
2281 GPU_CLIENT_SINGLE_THREAD_CHECK();
2282 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform4f(" << location
<< ", "
2283 << x
<< ", " << y
<< ", " << z
<< ", " << w
<< ")");
2284 helper_
->Uniform4f(location
, x
, y
, z
, w
);
2288 void GLES2Implementation::Uniform4fv(GLint location
,
2291 GPU_CLIENT_SINGLE_THREAD_CHECK();
2292 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform4fv(" << location
<< ", "
2293 << count
<< ", " << static_cast<const void*>(v
) << ")");
2294 GPU_CLIENT_LOG_CODE_BLOCK({
2295 for (GLsizei i
= 0; i
< count
; ++i
) {
2296 GPU_CLIENT_LOG(" " << i
<< ": " << v
[0 + i
* 4] << ", " << v
[1 + i
* 4]
2297 << ", " << v
[2 + i
* 4] << ", " << v
[3 + i
* 4]);
2301 SetGLError(GL_INVALID_VALUE
, "glUniform4fv", "count < 0");
2304 helper_
->Uniform4fvImmediate(location
, count
, v
);
2308 void GLES2Implementation::Uniform4i(GLint location
,
2313 GPU_CLIENT_SINGLE_THREAD_CHECK();
2314 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform4i(" << location
<< ", "
2315 << x
<< ", " << y
<< ", " << z
<< ", " << w
<< ")");
2316 helper_
->Uniform4i(location
, x
, y
, z
, w
);
2320 void GLES2Implementation::Uniform4iv(GLint location
,
2323 GPU_CLIENT_SINGLE_THREAD_CHECK();
2324 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform4iv(" << location
<< ", "
2325 << count
<< ", " << static_cast<const void*>(v
) << ")");
2326 GPU_CLIENT_LOG_CODE_BLOCK({
2327 for (GLsizei i
= 0; i
< count
; ++i
) {
2328 GPU_CLIENT_LOG(" " << i
<< ": " << v
[0 + i
* 4] << ", " << v
[1 + i
* 4]
2329 << ", " << v
[2 + i
* 4] << ", " << v
[3 + i
* 4]);
2333 SetGLError(GL_INVALID_VALUE
, "glUniform4iv", "count < 0");
2336 helper_
->Uniform4ivImmediate(location
, count
, v
);
2340 void GLES2Implementation::Uniform4ui(GLint location
,
2345 GPU_CLIENT_SINGLE_THREAD_CHECK();
2346 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform4ui(" << location
<< ", "
2347 << x
<< ", " << y
<< ", " << z
<< ", " << w
<< ")");
2348 helper_
->Uniform4ui(location
, x
, y
, z
, w
);
2352 void GLES2Implementation::Uniform4uiv(GLint location
,
2355 GPU_CLIENT_SINGLE_THREAD_CHECK();
2356 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform4uiv(" << location
<< ", "
2357 << count
<< ", " << static_cast<const void*>(v
) << ")");
2358 GPU_CLIENT_LOG_CODE_BLOCK({
2359 for (GLsizei i
= 0; i
< count
; ++i
) {
2360 GPU_CLIENT_LOG(" " << i
<< ": " << v
[0 + i
* 4] << ", " << v
[1 + i
* 4]
2361 << ", " << v
[2 + i
* 4] << ", " << v
[3 + i
* 4]);
2365 SetGLError(GL_INVALID_VALUE
, "glUniform4uiv", "count < 0");
2368 helper_
->Uniform4uivImmediate(location
, count
, v
);
2372 void GLES2Implementation::UniformMatrix2fv(GLint location
,
2374 GLboolean transpose
,
2375 const GLfloat
* value
) {
2376 GPU_CLIENT_SINGLE_THREAD_CHECK();
2377 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniformMatrix2fv(" << location
2378 << ", " << count
<< ", "
2379 << GLES2Util::GetStringBool(transpose
) << ", "
2380 << static_cast<const void*>(value
) << ")");
2381 GPU_CLIENT_LOG_CODE_BLOCK({
2382 for (GLsizei i
= 0; i
< count
; ++i
) {
2383 GPU_CLIENT_LOG(" " << i
<< ": " << value
[0 + i
* 4] << ", "
2384 << value
[1 + i
* 4] << ", " << value
[2 + i
* 4]
2385 << ", " << value
[3 + i
* 4]);
2389 SetGLError(GL_INVALID_VALUE
, "glUniformMatrix2fv", "count < 0");
2392 if (transpose
!= false) {
2393 SetGLError(GL_INVALID_VALUE
, "glUniformMatrix2fv",
2394 "transpose GL_INVALID_VALUE");
2397 helper_
->UniformMatrix2fvImmediate(location
, count
, value
);
2401 void GLES2Implementation::UniformMatrix2x3fv(GLint location
,
2403 GLboolean transpose
,
2404 const GLfloat
* value
) {
2405 GPU_CLIENT_SINGLE_THREAD_CHECK();
2406 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniformMatrix2x3fv(" << location
2407 << ", " << count
<< ", "
2408 << GLES2Util::GetStringBool(transpose
) << ", "
2409 << static_cast<const void*>(value
) << ")");
2410 GPU_CLIENT_LOG_CODE_BLOCK({
2411 for (GLsizei i
= 0; i
< count
; ++i
) {
2412 GPU_CLIENT_LOG(" " << i
<< ": " << value
[0 + i
* 6] << ", "
2413 << value
[1 + i
* 6] << ", " << value
[2 + i
* 6]
2414 << ", " << value
[3 + i
* 6] << ", "
2415 << value
[4 + i
* 6] << ", " << value
[5 + i
* 6]);
2419 SetGLError(GL_INVALID_VALUE
, "glUniformMatrix2x3fv", "count < 0");
2422 if (transpose
!= false) {
2423 SetGLError(GL_INVALID_VALUE
, "glUniformMatrix2x3fv",
2424 "transpose GL_INVALID_VALUE");
2427 helper_
->UniformMatrix2x3fvImmediate(location
, count
, value
);
2431 void GLES2Implementation::UniformMatrix2x4fv(GLint location
,
2433 GLboolean transpose
,
2434 const GLfloat
* value
) {
2435 GPU_CLIENT_SINGLE_THREAD_CHECK();
2436 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniformMatrix2x4fv(" << location
2437 << ", " << count
<< ", "
2438 << GLES2Util::GetStringBool(transpose
) << ", "
2439 << static_cast<const void*>(value
) << ")");
2440 GPU_CLIENT_LOG_CODE_BLOCK({
2441 for (GLsizei i
= 0; i
< count
; ++i
) {
2443 " " << i
<< ": " << value
[0 + i
* 8] << ", " << value
[1 + i
* 8]
2444 << ", " << value
[2 + i
* 8] << ", " << value
[3 + i
* 8] << ", "
2445 << value
[4 + i
* 8] << ", " << value
[5 + i
* 8] << ", "
2446 << value
[6 + i
* 8] << ", " << value
[7 + i
* 8]);
2450 SetGLError(GL_INVALID_VALUE
, "glUniformMatrix2x4fv", "count < 0");
2453 if (transpose
!= false) {
2454 SetGLError(GL_INVALID_VALUE
, "glUniformMatrix2x4fv",
2455 "transpose GL_INVALID_VALUE");
2458 helper_
->UniformMatrix2x4fvImmediate(location
, count
, value
);
2462 void GLES2Implementation::UniformMatrix3fv(GLint location
,
2464 GLboolean transpose
,
2465 const GLfloat
* value
) {
2466 GPU_CLIENT_SINGLE_THREAD_CHECK();
2467 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniformMatrix3fv(" << location
2468 << ", " << count
<< ", "
2469 << GLES2Util::GetStringBool(transpose
) << ", "
2470 << static_cast<const void*>(value
) << ")");
2471 GPU_CLIENT_LOG_CODE_BLOCK({
2472 for (GLsizei i
= 0; i
< count
; ++i
) {
2473 GPU_CLIENT_LOG(" " << i
<< ": " << value
[0 + i
* 9] << ", "
2474 << value
[1 + i
* 9] << ", " << value
[2 + i
* 9]
2475 << ", " << value
[3 + i
* 9] << ", "
2476 << value
[4 + i
* 9] << ", " << value
[5 + i
* 9]
2477 << ", " << value
[6 + i
* 9] << ", "
2478 << value
[7 + i
* 9] << ", " << value
[8 + i
* 9]);
2482 SetGLError(GL_INVALID_VALUE
, "glUniformMatrix3fv", "count < 0");
2485 if (transpose
!= false) {
2486 SetGLError(GL_INVALID_VALUE
, "glUniformMatrix3fv",
2487 "transpose GL_INVALID_VALUE");
2490 helper_
->UniformMatrix3fvImmediate(location
, count
, value
);
2494 void GLES2Implementation::UniformMatrix3x2fv(GLint location
,
2496 GLboolean transpose
,
2497 const GLfloat
* value
) {
2498 GPU_CLIENT_SINGLE_THREAD_CHECK();
2499 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniformMatrix3x2fv(" << location
2500 << ", " << count
<< ", "
2501 << GLES2Util::GetStringBool(transpose
) << ", "
2502 << static_cast<const void*>(value
) << ")");
2503 GPU_CLIENT_LOG_CODE_BLOCK({
2504 for (GLsizei i
= 0; i
< count
; ++i
) {
2505 GPU_CLIENT_LOG(" " << i
<< ": " << value
[0 + i
* 6] << ", "
2506 << value
[1 + i
* 6] << ", " << value
[2 + i
* 6]
2507 << ", " << value
[3 + i
* 6] << ", "
2508 << value
[4 + i
* 6] << ", " << value
[5 + i
* 6]);
2512 SetGLError(GL_INVALID_VALUE
, "glUniformMatrix3x2fv", "count < 0");
2515 if (transpose
!= false) {
2516 SetGLError(GL_INVALID_VALUE
, "glUniformMatrix3x2fv",
2517 "transpose GL_INVALID_VALUE");
2520 helper_
->UniformMatrix3x2fvImmediate(location
, count
, value
);
2524 void GLES2Implementation::UniformMatrix3x4fv(GLint location
,
2526 GLboolean transpose
,
2527 const GLfloat
* value
) {
2528 GPU_CLIENT_SINGLE_THREAD_CHECK();
2529 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniformMatrix3x4fv(" << location
2530 << ", " << count
<< ", "
2531 << GLES2Util::GetStringBool(transpose
) << ", "
2532 << static_cast<const void*>(value
) << ")");
2533 GPU_CLIENT_LOG_CODE_BLOCK({
2534 for (GLsizei i
= 0; i
< count
; ++i
) {
2536 " " << i
<< ": " << value
[0 + i
* 12] << ", " << value
[1 + i
* 12]
2537 << ", " << value
[2 + i
* 12] << ", " << value
[3 + i
* 12] << ", "
2538 << value
[4 + i
* 12] << ", " << value
[5 + i
* 12] << ", "
2539 << value
[6 + i
* 12] << ", " << value
[7 + i
* 12] << ", "
2540 << value
[8 + i
* 12] << ", " << value
[9 + i
* 12] << ", "
2541 << value
[10 + i
* 12] << ", " << value
[11 + i
* 12]);
2545 SetGLError(GL_INVALID_VALUE
, "glUniformMatrix3x4fv", "count < 0");
2548 if (transpose
!= false) {
2549 SetGLError(GL_INVALID_VALUE
, "glUniformMatrix3x4fv",
2550 "transpose GL_INVALID_VALUE");
2553 helper_
->UniformMatrix3x4fvImmediate(location
, count
, value
);
2557 void GLES2Implementation::UniformMatrix4fv(GLint location
,
2559 GLboolean transpose
,
2560 const GLfloat
* value
) {
2561 GPU_CLIENT_SINGLE_THREAD_CHECK();
2562 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniformMatrix4fv(" << location
2563 << ", " << count
<< ", "
2564 << GLES2Util::GetStringBool(transpose
) << ", "
2565 << static_cast<const void*>(value
) << ")");
2566 GPU_CLIENT_LOG_CODE_BLOCK({
2567 for (GLsizei i
= 0; i
< count
; ++i
) {
2569 " " << i
<< ": " << value
[0 + i
* 16] << ", " << value
[1 + i
* 16]
2570 << ", " << value
[2 + i
* 16] << ", " << value
[3 + i
* 16] << ", "
2571 << value
[4 + i
* 16] << ", " << value
[5 + i
* 16] << ", "
2572 << value
[6 + i
* 16] << ", " << value
[7 + i
* 16] << ", "
2573 << value
[8 + i
* 16] << ", " << value
[9 + i
* 16] << ", "
2574 << value
[10 + i
* 16] << ", " << value
[11 + i
* 16] << ", "
2575 << value
[12 + i
* 16] << ", " << value
[13 + i
* 16] << ", "
2576 << value
[14 + i
* 16] << ", " << value
[15 + i
* 16]);
2580 SetGLError(GL_INVALID_VALUE
, "glUniformMatrix4fv", "count < 0");
2583 if (transpose
!= false) {
2584 SetGLError(GL_INVALID_VALUE
, "glUniformMatrix4fv",
2585 "transpose GL_INVALID_VALUE");
2588 helper_
->UniformMatrix4fvImmediate(location
, count
, value
);
2592 void GLES2Implementation::UniformMatrix4x2fv(GLint location
,
2594 GLboolean transpose
,
2595 const GLfloat
* value
) {
2596 GPU_CLIENT_SINGLE_THREAD_CHECK();
2597 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniformMatrix4x2fv(" << location
2598 << ", " << count
<< ", "
2599 << GLES2Util::GetStringBool(transpose
) << ", "
2600 << static_cast<const void*>(value
) << ")");
2601 GPU_CLIENT_LOG_CODE_BLOCK({
2602 for (GLsizei i
= 0; i
< count
; ++i
) {
2604 " " << i
<< ": " << value
[0 + i
* 8] << ", " << value
[1 + i
* 8]
2605 << ", " << value
[2 + i
* 8] << ", " << value
[3 + i
* 8] << ", "
2606 << value
[4 + i
* 8] << ", " << value
[5 + i
* 8] << ", "
2607 << value
[6 + i
* 8] << ", " << value
[7 + i
* 8]);
2611 SetGLError(GL_INVALID_VALUE
, "glUniformMatrix4x2fv", "count < 0");
2614 if (transpose
!= false) {
2615 SetGLError(GL_INVALID_VALUE
, "glUniformMatrix4x2fv",
2616 "transpose GL_INVALID_VALUE");
2619 helper_
->UniformMatrix4x2fvImmediate(location
, count
, value
);
2623 void GLES2Implementation::UniformMatrix4x3fv(GLint location
,
2625 GLboolean transpose
,
2626 const GLfloat
* value
) {
2627 GPU_CLIENT_SINGLE_THREAD_CHECK();
2628 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniformMatrix4x3fv(" << location
2629 << ", " << count
<< ", "
2630 << GLES2Util::GetStringBool(transpose
) << ", "
2631 << static_cast<const void*>(value
) << ")");
2632 GPU_CLIENT_LOG_CODE_BLOCK({
2633 for (GLsizei i
= 0; i
< count
; ++i
) {
2635 " " << i
<< ": " << value
[0 + i
* 12] << ", " << value
[1 + i
* 12]
2636 << ", " << value
[2 + i
* 12] << ", " << value
[3 + i
* 12] << ", "
2637 << value
[4 + i
* 12] << ", " << value
[5 + i
* 12] << ", "
2638 << value
[6 + i
* 12] << ", " << value
[7 + i
* 12] << ", "
2639 << value
[8 + i
* 12] << ", " << value
[9 + i
* 12] << ", "
2640 << value
[10 + i
* 12] << ", " << value
[11 + i
* 12]);
2644 SetGLError(GL_INVALID_VALUE
, "glUniformMatrix4x3fv", "count < 0");
2647 if (transpose
!= false) {
2648 SetGLError(GL_INVALID_VALUE
, "glUniformMatrix4x3fv",
2649 "transpose GL_INVALID_VALUE");
2652 helper_
->UniformMatrix4x3fvImmediate(location
, count
, value
);
2656 void GLES2Implementation::UseProgram(GLuint program
) {
2657 GPU_CLIENT_SINGLE_THREAD_CHECK();
2658 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUseProgram(" << program
<< ")");
2659 if (IsProgramReservedId(program
)) {
2660 SetGLError(GL_INVALID_OPERATION
, "UseProgram", "program reserved id");
2663 UseProgramHelper(program
);
2667 void GLES2Implementation::ValidateProgram(GLuint program
) {
2668 GPU_CLIENT_SINGLE_THREAD_CHECK();
2669 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glValidateProgram(" << program
2671 helper_
->ValidateProgram(program
);
2675 void GLES2Implementation::VertexAttrib1f(GLuint indx
, GLfloat x
) {
2676 GPU_CLIENT_SINGLE_THREAD_CHECK();
2677 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glVertexAttrib1f(" << indx
<< ", "
2679 helper_
->VertexAttrib1f(indx
, x
);
2683 void GLES2Implementation::VertexAttrib1fv(GLuint indx
, const GLfloat
* values
) {
2684 GPU_CLIENT_SINGLE_THREAD_CHECK();
2685 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glVertexAttrib1fv(" << indx
<< ", "
2686 << static_cast<const void*>(values
) << ")");
2688 for (size_t ii
= 0; ii
< count
; ++ii
)
2689 GPU_CLIENT_LOG("value[" << ii
<< "]: " << values
[ii
]);
2690 helper_
->VertexAttrib1fvImmediate(indx
, values
);
2694 void GLES2Implementation::VertexAttrib2f(GLuint indx
, GLfloat x
, GLfloat y
) {
2695 GPU_CLIENT_SINGLE_THREAD_CHECK();
2696 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glVertexAttrib2f(" << indx
<< ", "
2697 << x
<< ", " << y
<< ")");
2698 helper_
->VertexAttrib2f(indx
, x
, y
);
2702 void GLES2Implementation::VertexAttrib2fv(GLuint indx
, const GLfloat
* values
) {
2703 GPU_CLIENT_SINGLE_THREAD_CHECK();
2704 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glVertexAttrib2fv(" << indx
<< ", "
2705 << static_cast<const void*>(values
) << ")");
2707 for (size_t ii
= 0; ii
< count
; ++ii
)
2708 GPU_CLIENT_LOG("value[" << ii
<< "]: " << values
[ii
]);
2709 helper_
->VertexAttrib2fvImmediate(indx
, values
);
2713 void GLES2Implementation::VertexAttrib3f(GLuint indx
,
2717 GPU_CLIENT_SINGLE_THREAD_CHECK();
2718 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glVertexAttrib3f(" << indx
<< ", "
2719 << x
<< ", " << y
<< ", " << z
<< ")");
2720 helper_
->VertexAttrib3f(indx
, x
, y
, z
);
2724 void GLES2Implementation::VertexAttrib3fv(GLuint indx
, const GLfloat
* values
) {
2725 GPU_CLIENT_SINGLE_THREAD_CHECK();
2726 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glVertexAttrib3fv(" << indx
<< ", "
2727 << static_cast<const void*>(values
) << ")");
2729 for (size_t ii
= 0; ii
< count
; ++ii
)
2730 GPU_CLIENT_LOG("value[" << ii
<< "]: " << values
[ii
]);
2731 helper_
->VertexAttrib3fvImmediate(indx
, values
);
2735 void GLES2Implementation::VertexAttrib4f(GLuint indx
,
2740 GPU_CLIENT_SINGLE_THREAD_CHECK();
2741 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glVertexAttrib4f(" << indx
<< ", "
2742 << x
<< ", " << y
<< ", " << z
<< ", " << w
<< ")");
2743 helper_
->VertexAttrib4f(indx
, x
, y
, z
, w
);
2747 void GLES2Implementation::VertexAttrib4fv(GLuint indx
, const GLfloat
* values
) {
2748 GPU_CLIENT_SINGLE_THREAD_CHECK();
2749 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glVertexAttrib4fv(" << indx
<< ", "
2750 << static_cast<const void*>(values
) << ")");
2752 for (size_t ii
= 0; ii
< count
; ++ii
)
2753 GPU_CLIENT_LOG("value[" << ii
<< "]: " << values
[ii
]);
2754 helper_
->VertexAttrib4fvImmediate(indx
, values
);
2758 void GLES2Implementation::VertexAttribI4i(GLuint indx
,
2763 GPU_CLIENT_SINGLE_THREAD_CHECK();
2764 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glVertexAttribI4i(" << indx
<< ", "
2765 << x
<< ", " << y
<< ", " << z
<< ", " << w
<< ")");
2766 helper_
->VertexAttribI4i(indx
, x
, y
, z
, w
);
2770 void GLES2Implementation::VertexAttribI4iv(GLuint indx
, const GLint
* values
) {
2771 GPU_CLIENT_SINGLE_THREAD_CHECK();
2772 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glVertexAttribI4iv(" << indx
2773 << ", " << static_cast<const void*>(values
) << ")");
2775 for (size_t ii
= 0; ii
< count
; ++ii
)
2776 GPU_CLIENT_LOG("value[" << ii
<< "]: " << values
[ii
]);
2777 helper_
->VertexAttribI4ivImmediate(indx
, values
);
2781 void GLES2Implementation::VertexAttribI4ui(GLuint indx
,
2786 GPU_CLIENT_SINGLE_THREAD_CHECK();
2787 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glVertexAttribI4ui(" << indx
2788 << ", " << x
<< ", " << y
<< ", " << z
<< ", " << w
2790 helper_
->VertexAttribI4ui(indx
, x
, y
, z
, w
);
2794 void GLES2Implementation::VertexAttribI4uiv(GLuint indx
, const GLuint
* values
) {
2795 GPU_CLIENT_SINGLE_THREAD_CHECK();
2796 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glVertexAttribI4uiv(" << indx
2797 << ", " << static_cast<const void*>(values
) << ")");
2799 for (size_t ii
= 0; ii
< count
; ++ii
)
2800 GPU_CLIENT_LOG("value[" << ii
<< "]: " << values
[ii
]);
2801 helper_
->VertexAttribI4uivImmediate(indx
, values
);
2805 void GLES2Implementation::Viewport(GLint x
,
2809 GPU_CLIENT_SINGLE_THREAD_CHECK();
2810 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glViewport(" << x
<< ", " << y
2811 << ", " << width
<< ", " << height
<< ")");
2813 SetGLError(GL_INVALID_VALUE
, "glViewport", "width < 0");
2817 SetGLError(GL_INVALID_VALUE
, "glViewport", "height < 0");
2820 helper_
->Viewport(x
, y
, width
, height
);
2824 void GLES2Implementation::BlitFramebufferCHROMIUM(GLint srcX0
,
2834 GPU_CLIENT_SINGLE_THREAD_CHECK();
2835 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBlitFramebufferCHROMIUM("
2836 << srcX0
<< ", " << srcY0
<< ", " << srcX1
<< ", " << srcY1
2837 << ", " << dstX0
<< ", " << dstY0
<< ", " << dstX1
<< ", "
2838 << dstY1
<< ", " << mask
<< ", "
2839 << GLES2Util::GetStringBlitFilter(filter
) << ")");
2840 helper_
->BlitFramebufferCHROMIUM(srcX0
, srcY0
, srcX1
, srcY1
, dstX0
, dstY0
,
2841 dstX1
, dstY1
, mask
, filter
);
2845 void GLES2Implementation::RenderbufferStorageMultisampleCHROMIUM(
2848 GLenum internalformat
,
2851 GPU_CLIENT_SINGLE_THREAD_CHECK();
2853 "[" << GetLogPrefix() << "] glRenderbufferStorageMultisampleCHROMIUM("
2854 << GLES2Util::GetStringRenderBufferTarget(target
) << ", " << samples
2855 << ", " << GLES2Util::GetStringRenderBufferFormat(internalformat
)
2856 << ", " << width
<< ", " << height
<< ")");
2858 SetGLError(GL_INVALID_VALUE
, "glRenderbufferStorageMultisampleCHROMIUM",
2863 SetGLError(GL_INVALID_VALUE
, "glRenderbufferStorageMultisampleCHROMIUM",
2868 SetGLError(GL_INVALID_VALUE
, "glRenderbufferStorageMultisampleCHROMIUM",
2872 helper_
->RenderbufferStorageMultisampleCHROMIUM(
2873 target
, samples
, internalformat
, width
, height
);
2877 void GLES2Implementation::RenderbufferStorageMultisampleEXT(
2880 GLenum internalformat
,
2883 GPU_CLIENT_SINGLE_THREAD_CHECK();
2885 "[" << GetLogPrefix() << "] glRenderbufferStorageMultisampleEXT("
2886 << GLES2Util::GetStringRenderBufferTarget(target
) << ", " << samples
2887 << ", " << GLES2Util::GetStringRenderBufferFormat(internalformat
)
2888 << ", " << width
<< ", " << height
<< ")");
2890 SetGLError(GL_INVALID_VALUE
, "glRenderbufferStorageMultisampleEXT",
2895 SetGLError(GL_INVALID_VALUE
, "glRenderbufferStorageMultisampleEXT",
2900 SetGLError(GL_INVALID_VALUE
, "glRenderbufferStorageMultisampleEXT",
2904 helper_
->RenderbufferStorageMultisampleEXT(target
, samples
, internalformat
,
2909 void GLES2Implementation::FramebufferTexture2DMultisampleEXT(GLenum target
,
2915 GPU_CLIENT_SINGLE_THREAD_CHECK();
2916 GPU_CLIENT_LOG("[" << GetLogPrefix()
2917 << "] glFramebufferTexture2DMultisampleEXT("
2918 << GLES2Util::GetStringFrameBufferTarget(target
) << ", "
2919 << GLES2Util::GetStringAttachment(attachment
) << ", "
2920 << GLES2Util::GetStringTextureTarget(textarget
) << ", "
2921 << texture
<< ", " << level
<< ", " << samples
<< ")");
2923 SetGLError(GL_INVALID_VALUE
, "glFramebufferTexture2DMultisampleEXT",
2924 "level GL_INVALID_VALUE");
2928 SetGLError(GL_INVALID_VALUE
, "glFramebufferTexture2DMultisampleEXT",
2932 helper_
->FramebufferTexture2DMultisampleEXT(target
, attachment
, textarget
,
2937 void GLES2Implementation::TexStorage2DEXT(GLenum target
,
2939 GLenum internalFormat
,
2942 GPU_CLIENT_SINGLE_THREAD_CHECK();
2944 "[" << GetLogPrefix() << "] glTexStorage2DEXT("
2945 << GLES2Util::GetStringTextureBindTarget(target
) << ", " << levels
2947 << GLES2Util::GetStringTextureInternalFormatStorage(internalFormat
)
2948 << ", " << width
<< ", " << height
<< ")");
2950 SetGLError(GL_INVALID_VALUE
, "glTexStorage2DEXT", "levels < 0");
2954 SetGLError(GL_INVALID_VALUE
, "glTexStorage2DEXT", "width < 0");
2958 SetGLError(GL_INVALID_VALUE
, "glTexStorage2DEXT", "height < 0");
2961 helper_
->TexStorage2DEXT(target
, levels
, internalFormat
, width
, height
);
2965 void GLES2Implementation::GenQueriesEXT(GLsizei n
, GLuint
* queries
) {
2966 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGenQueriesEXT(" << n
<< ", "
2967 << static_cast<const void*>(queries
) << ")");
2969 SetGLError(GL_INVALID_VALUE
, "glGenQueriesEXT", "n < 0");
2972 GPU_CLIENT_SINGLE_THREAD_CHECK();
2973 IdAllocator
* id_allocator
= GetIdAllocator(id_namespaces::kQueries
);
2974 for (GLsizei ii
= 0; ii
< n
; ++ii
)
2975 queries
[ii
] = id_allocator
->AllocateID();
2976 GenQueriesEXTHelper(n
, queries
);
2977 helper_
->GenQueriesEXTImmediate(n
, queries
);
2978 if (share_group_
->bind_generates_resource())
2979 helper_
->CommandBufferHelper::Flush();
2980 GPU_CLIENT_LOG_CODE_BLOCK({
2981 for (GLsizei i
= 0; i
< n
; ++i
) {
2982 GPU_CLIENT_LOG(" " << i
<< ": " << queries
[i
]);
2988 void GLES2Implementation::DeleteQueriesEXT(GLsizei n
, const GLuint
* queries
) {
2989 GPU_CLIENT_SINGLE_THREAD_CHECK();
2990 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDeleteQueriesEXT(" << n
<< ", "
2991 << static_cast<const void*>(queries
) << ")");
2992 GPU_CLIENT_LOG_CODE_BLOCK({
2993 for (GLsizei i
= 0; i
< n
; ++i
) {
2994 GPU_CLIENT_LOG(" " << i
<< ": " << queries
[i
]);
2997 GPU_CLIENT_DCHECK_CODE_BLOCK({
2998 for (GLsizei i
= 0; i
< n
; ++i
) {
2999 DCHECK(queries
[i
] != 0);
3003 SetGLError(GL_INVALID_VALUE
, "glDeleteQueriesEXT", "n < 0");
3006 DeleteQueriesEXTHelper(n
, queries
);
3010 void GLES2Implementation::BeginTransformFeedback(GLenum primitivemode
) {
3011 GPU_CLIENT_SINGLE_THREAD_CHECK();
3012 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBeginTransformFeedback("
3013 << GLES2Util::GetStringTransformFeedbackPrimitiveMode(
3014 primitivemode
) << ")");
3015 helper_
->BeginTransformFeedback(primitivemode
);
3019 void GLES2Implementation::EndTransformFeedback() {
3020 GPU_CLIENT_SINGLE_THREAD_CHECK();
3021 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glEndTransformFeedback("
3023 helper_
->EndTransformFeedback();
3027 void GLES2Implementation::GenVertexArraysOES(GLsizei n
, GLuint
* arrays
) {
3028 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGenVertexArraysOES(" << n
<< ", "
3029 << static_cast<const void*>(arrays
) << ")");
3031 SetGLError(GL_INVALID_VALUE
, "glGenVertexArraysOES", "n < 0");
3034 GPU_CLIENT_SINGLE_THREAD_CHECK();
3035 GetIdHandler(id_namespaces::kVertexArrays
)->MakeIds(this, 0, n
, arrays
);
3036 GenVertexArraysOESHelper(n
, arrays
);
3037 helper_
->GenVertexArraysOESImmediate(n
, arrays
);
3038 if (share_group_
->bind_generates_resource())
3039 helper_
->CommandBufferHelper::Flush();
3040 GPU_CLIENT_LOG_CODE_BLOCK({
3041 for (GLsizei i
= 0; i
< n
; ++i
) {
3042 GPU_CLIENT_LOG(" " << i
<< ": " << arrays
[i
]);
3048 void GLES2Implementation::DeleteVertexArraysOES(GLsizei n
,
3049 const GLuint
* arrays
) {
3050 GPU_CLIENT_SINGLE_THREAD_CHECK();
3051 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDeleteVertexArraysOES(" << n
3052 << ", " << static_cast<const void*>(arrays
) << ")");
3053 GPU_CLIENT_LOG_CODE_BLOCK({
3054 for (GLsizei i
= 0; i
< n
; ++i
) {
3055 GPU_CLIENT_LOG(" " << i
<< ": " << arrays
[i
]);
3058 GPU_CLIENT_DCHECK_CODE_BLOCK({
3059 for (GLsizei i
= 0; i
< n
; ++i
) {
3060 DCHECK(arrays
[i
] != 0);
3064 SetGLError(GL_INVALID_VALUE
, "glDeleteVertexArraysOES", "n < 0");
3067 DeleteVertexArraysOESHelper(n
, arrays
);
3071 GLboolean
GLES2Implementation::IsVertexArrayOES(GLuint array
) {
3072 GPU_CLIENT_SINGLE_THREAD_CHECK();
3073 TRACE_EVENT0("gpu", "GLES2Implementation::IsVertexArrayOES");
3074 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glIsVertexArrayOES(" << array
3076 typedef cmds::IsVertexArrayOES::Result Result
;
3077 Result
* result
= GetResultAs
<Result
*>();
3082 helper_
->IsVertexArrayOES(array
, GetResultShmId(), GetResultShmOffset());
3084 GLboolean result_value
= *result
!= 0;
3085 GPU_CLIENT_LOG("returned " << result_value
);
3087 return result_value
;
3090 void GLES2Implementation::BindVertexArrayOES(GLuint array
) {
3091 GPU_CLIENT_SINGLE_THREAD_CHECK();
3092 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBindVertexArrayOES(" << array
3094 if (IsVertexArrayReservedId(array
)) {
3095 SetGLError(GL_INVALID_OPERATION
, "BindVertexArrayOES", "array reserved id");
3098 BindVertexArrayOESHelper(array
);
3102 void GLES2Implementation::GetTranslatedShaderSourceANGLE(GLuint shader
,
3106 GPU_CLIENT_SINGLE_THREAD_CHECK();
3107 GPU_CLIENT_VALIDATE_DESTINATION_OPTIONAL_INITALIZATION(GLsizei
, length
);
3108 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetTranslatedShaderSourceANGLE"
3109 << "(" << shader
<< ", " << bufsize
<< ", "
3110 << static_cast<void*>(length
) << ", "
3111 << static_cast<void*>(source
) << ")");
3112 helper_
->SetBucketSize(kResultBucketId
, 0);
3113 helper_
->GetTranslatedShaderSourceANGLE(shader
, kResultBucketId
);
3115 GLsizei max_size
= 0;
3116 if (GetBucketAsString(kResultBucketId
, &str
)) {
3118 max_size
= std::min(static_cast<size_t>(bufsize
) - 1, str
.size());
3119 memcpy(source
, str
.c_str(), max_size
);
3120 source
[max_size
] = '\0';
3121 GPU_CLIENT_LOG("------\n" << source
<< "\n------");
3124 if (length
!= NULL
) {
3129 void GLES2Implementation::TexImageIOSurface2DCHROMIUM(GLenum target
,
3134 GPU_CLIENT_SINGLE_THREAD_CHECK();
3135 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glTexImageIOSurface2DCHROMIUM("
3136 << GLES2Util::GetStringTextureBindTarget(target
) << ", "
3137 << width
<< ", " << height
<< ", " << ioSurfaceId
<< ", "
3140 SetGLError(GL_INVALID_VALUE
, "glTexImageIOSurface2DCHROMIUM", "width < 0");
3144 SetGLError(GL_INVALID_VALUE
, "glTexImageIOSurface2DCHROMIUM", "height < 0");
3147 helper_
->TexImageIOSurface2DCHROMIUM(target
, width
, height
, ioSurfaceId
,
3152 void GLES2Implementation::CopyTextureCHROMIUM(GLenum target
,
3155 GLint internalformat
,
3157 GPU_CLIENT_SINGLE_THREAD_CHECK();
3158 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glCopyTextureCHROMIUM("
3159 << GLES2Util::GetStringEnum(target
) << ", "
3160 << GLES2Util::GetStringEnum(source_id
) << ", "
3161 << GLES2Util::GetStringEnum(dest_id
) << ", "
3162 << internalformat
<< ", "
3163 << GLES2Util::GetStringPixelType(dest_type
) << ")");
3164 helper_
->CopyTextureCHROMIUM(target
, source_id
, dest_id
, internalformat
,
3169 void GLES2Implementation::CopySubTextureCHROMIUM(GLenum target
,
3178 GPU_CLIENT_SINGLE_THREAD_CHECK();
3179 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glCopySubTextureCHROMIUM("
3180 << GLES2Util::GetStringEnum(target
) << ", "
3181 << GLES2Util::GetStringEnum(source_id
) << ", "
3182 << GLES2Util::GetStringEnum(dest_id
) << ", " << xoffset
3183 << ", " << yoffset
<< ", " << x
<< ", " << y
<< ", "
3184 << width
<< ", " << height
<< ")");
3186 SetGLError(GL_INVALID_VALUE
, "glCopySubTextureCHROMIUM", "width < 0");
3190 SetGLError(GL_INVALID_VALUE
, "glCopySubTextureCHROMIUM", "height < 0");
3193 helper_
->CopySubTextureCHROMIUM(target
, source_id
, dest_id
, xoffset
, yoffset
,
3194 x
, y
, width
, height
);
3198 void GLES2Implementation::CompressedCopyTextureCHROMIUM(GLenum target
,
3201 GPU_CLIENT_SINGLE_THREAD_CHECK();
3202 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glCompressedCopyTextureCHROMIUM("
3203 << GLES2Util::GetStringEnum(target
) << ", "
3204 << GLES2Util::GetStringEnum(source_id
) << ", "
3205 << GLES2Util::GetStringEnum(dest_id
) << ")");
3206 helper_
->CompressedCopyTextureCHROMIUM(target
, source_id
, dest_id
);
3210 void GLES2Implementation::GenValuebuffersCHROMIUM(GLsizei n
, GLuint
* buffers
) {
3211 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGenValuebuffersCHROMIUM(" << n
3212 << ", " << static_cast<const void*>(buffers
) << ")");
3214 SetGLError(GL_INVALID_VALUE
, "glGenValuebuffersCHROMIUM", "n < 0");
3217 GPU_CLIENT_SINGLE_THREAD_CHECK();
3218 GetIdHandler(id_namespaces::kValuebuffers
)->MakeIds(this, 0, n
, buffers
);
3219 GenValuebuffersCHROMIUMHelper(n
, buffers
);
3220 helper_
->GenValuebuffersCHROMIUMImmediate(n
, buffers
);
3221 if (share_group_
->bind_generates_resource())
3222 helper_
->CommandBufferHelper::Flush();
3223 GPU_CLIENT_LOG_CODE_BLOCK({
3224 for (GLsizei i
= 0; i
< n
; ++i
) {
3225 GPU_CLIENT_LOG(" " << i
<< ": " << buffers
[i
]);
3231 void GLES2Implementation::DeleteValuebuffersCHROMIUM(
3233 const GLuint
* valuebuffers
) {
3234 GPU_CLIENT_SINGLE_THREAD_CHECK();
3235 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDeleteValuebuffersCHROMIUM(" << n
3236 << ", " << static_cast<const void*>(valuebuffers
) << ")");
3237 GPU_CLIENT_LOG_CODE_BLOCK({
3238 for (GLsizei i
= 0; i
< n
; ++i
) {
3239 GPU_CLIENT_LOG(" " << i
<< ": " << valuebuffers
[i
]);
3242 GPU_CLIENT_DCHECK_CODE_BLOCK({
3243 for (GLsizei i
= 0; i
< n
; ++i
) {
3244 DCHECK(valuebuffers
[i
] != 0);
3248 SetGLError(GL_INVALID_VALUE
, "glDeleteValuebuffersCHROMIUM", "n < 0");
3251 DeleteValuebuffersCHROMIUMHelper(n
, valuebuffers
);
3255 GLboolean
GLES2Implementation::IsValuebufferCHROMIUM(GLuint valuebuffer
) {
3256 GPU_CLIENT_SINGLE_THREAD_CHECK();
3257 TRACE_EVENT0("gpu", "GLES2Implementation::IsValuebufferCHROMIUM");
3258 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glIsValuebufferCHROMIUM("
3259 << valuebuffer
<< ")");
3260 typedef cmds::IsValuebufferCHROMIUM::Result Result
;
3261 Result
* result
= GetResultAs
<Result
*>();
3266 helper_
->IsValuebufferCHROMIUM(valuebuffer
, GetResultShmId(),
3267 GetResultShmOffset());
3269 GLboolean result_value
= *result
!= 0;
3270 GPU_CLIENT_LOG("returned " << result_value
);
3272 return result_value
;
3275 void GLES2Implementation::BindValuebufferCHROMIUM(GLenum target
,
3276 GLuint valuebuffer
) {
3277 GPU_CLIENT_SINGLE_THREAD_CHECK();
3278 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBindValuebufferCHROMIUM("
3279 << GLES2Util::GetStringValueBufferTarget(target
) << ", "
3280 << valuebuffer
<< ")");
3281 if (IsValuebufferReservedId(valuebuffer
)) {
3282 SetGLError(GL_INVALID_OPERATION
, "BindValuebufferCHROMIUM",
3283 "valuebuffer reserved id");
3286 BindValuebufferCHROMIUMHelper(target
, valuebuffer
);
3290 void GLES2Implementation::SubscribeValueCHROMIUM(GLenum target
,
3291 GLenum subscription
) {
3292 GPU_CLIENT_SINGLE_THREAD_CHECK();
3293 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glSubscribeValueCHROMIUM("
3294 << GLES2Util::GetStringValueBufferTarget(target
) << ", "
3295 << GLES2Util::GetStringSubscriptionTarget(subscription
)
3297 helper_
->SubscribeValueCHROMIUM(target
, subscription
);
3301 void GLES2Implementation::PopulateSubscribedValuesCHROMIUM(GLenum target
) {
3302 GPU_CLIENT_SINGLE_THREAD_CHECK();
3303 GPU_CLIENT_LOG("[" << GetLogPrefix()
3304 << "] glPopulateSubscribedValuesCHROMIUM("
3305 << GLES2Util::GetStringValueBufferTarget(target
) << ")");
3306 helper_
->PopulateSubscribedValuesCHROMIUM(target
);
3310 void GLES2Implementation::UniformValuebufferCHROMIUM(GLint location
,
3312 GLenum subscription
) {
3313 GPU_CLIENT_SINGLE_THREAD_CHECK();
3315 "[" << GetLogPrefix() << "] glUniformValuebufferCHROMIUM(" << location
3316 << ", " << GLES2Util::GetStringValueBufferTarget(target
) << ", "
3317 << GLES2Util::GetStringSubscriptionTarget(subscription
) << ")");
3318 helper_
->UniformValuebufferCHROMIUM(location
, target
, subscription
);
3322 void GLES2Implementation::BindTexImage2DCHROMIUM(GLenum target
, GLint imageId
) {
3323 GPU_CLIENT_SINGLE_THREAD_CHECK();
3324 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBindTexImage2DCHROMIUM("
3325 << GLES2Util::GetStringTextureBindTarget(target
) << ", "
3327 helper_
->BindTexImage2DCHROMIUM(target
, imageId
);
3331 void GLES2Implementation::ReleaseTexImage2DCHROMIUM(GLenum target
,
3333 GPU_CLIENT_SINGLE_THREAD_CHECK();
3334 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glReleaseTexImage2DCHROMIUM("
3335 << GLES2Util::GetStringTextureBindTarget(target
) << ", "
3337 helper_
->ReleaseTexImage2DCHROMIUM(target
, imageId
);
3341 void GLES2Implementation::DiscardFramebufferEXT(GLenum target
,
3343 const GLenum
* attachments
) {
3344 GPU_CLIENT_SINGLE_THREAD_CHECK();
3345 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDiscardFramebufferEXT("
3346 << GLES2Util::GetStringEnum(target
) << ", " << count
3347 << ", " << static_cast<const void*>(attachments
) << ")");
3348 GPU_CLIENT_LOG_CODE_BLOCK({
3349 for (GLsizei i
= 0; i
< count
; ++i
) {
3350 GPU_CLIENT_LOG(" " << i
<< ": " << attachments
[0 + i
* 1]);
3354 SetGLError(GL_INVALID_VALUE
, "glDiscardFramebufferEXT", "count < 0");
3357 helper_
->DiscardFramebufferEXTImmediate(target
, count
, attachments
);
3361 void GLES2Implementation::LoseContextCHROMIUM(GLenum current
, GLenum other
) {
3362 GPU_CLIENT_SINGLE_THREAD_CHECK();
3363 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glLoseContextCHROMIUM("
3364 << GLES2Util::GetStringResetStatus(current
) << ", "
3365 << GLES2Util::GetStringResetStatus(other
) << ")");
3366 helper_
->LoseContextCHROMIUM(current
, other
);
3370 void GLES2Implementation::WaitSyncPointCHROMIUM(GLuint sync_point
) {
3371 GPU_CLIENT_SINGLE_THREAD_CHECK();
3372 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glWaitSyncPointCHROMIUM("
3373 << sync_point
<< ")");
3374 helper_
->WaitSyncPointCHROMIUM(sync_point
);
3378 void GLES2Implementation::DrawBuffersEXT(GLsizei count
, const GLenum
* bufs
) {
3379 GPU_CLIENT_SINGLE_THREAD_CHECK();
3380 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDrawBuffersEXT(" << count
<< ", "
3381 << static_cast<const void*>(bufs
) << ")");
3382 GPU_CLIENT_LOG_CODE_BLOCK({
3383 for (GLsizei i
= 0; i
< count
; ++i
) {
3384 GPU_CLIENT_LOG(" " << i
<< ": " << bufs
[0 + i
* 1]);
3388 SetGLError(GL_INVALID_VALUE
, "glDrawBuffersEXT", "count < 0");
3391 helper_
->DrawBuffersEXTImmediate(count
, bufs
);
3395 void GLES2Implementation::DiscardBackbufferCHROMIUM() {
3396 GPU_CLIENT_SINGLE_THREAD_CHECK();
3397 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDiscardBackbufferCHROMIUM("
3399 helper_
->DiscardBackbufferCHROMIUM();
3403 void GLES2Implementation::ScheduleOverlayPlaneCHROMIUM(
3404 GLint plane_z_order
,
3405 GLenum plane_transform
,
3406 GLuint overlay_texture_id
,
3410 GLint bounds_height
,
3414 GLfloat uv_height
) {
3415 GPU_CLIENT_SINGLE_THREAD_CHECK();
3417 "[" << GetLogPrefix() << "] glScheduleOverlayPlaneCHROMIUM("
3418 << plane_z_order
<< ", " << GLES2Util::GetStringEnum(plane_transform
)
3419 << ", " << overlay_texture_id
<< ", " << bounds_x
<< ", " << bounds_y
3420 << ", " << bounds_width
<< ", " << bounds_height
<< ", " << uv_x
3421 << ", " << uv_y
<< ", " << uv_width
<< ", " << uv_height
<< ")");
3422 helper_
->ScheduleOverlayPlaneCHROMIUM(
3423 plane_z_order
, plane_transform
, overlay_texture_id
, bounds_x
, bounds_y
,
3424 bounds_width
, bounds_height
, uv_x
, uv_y
, uv_width
, uv_height
);
3428 void GLES2Implementation::MatrixLoadfCHROMIUM(GLenum matrixMode
,
3430 GPU_CLIENT_SINGLE_THREAD_CHECK();
3431 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glMatrixLoadfCHROMIUM("
3432 << GLES2Util::GetStringMatrixMode(matrixMode
) << ", "
3433 << static_cast<const void*>(m
) << ")");
3435 for (size_t ii
= 0; ii
< count
; ++ii
)
3436 GPU_CLIENT_LOG("value[" << ii
<< "]: " << m
[ii
]);
3437 helper_
->MatrixLoadfCHROMIUMImmediate(matrixMode
, m
);
3441 void GLES2Implementation::MatrixLoadIdentityCHROMIUM(GLenum matrixMode
) {
3442 GPU_CLIENT_SINGLE_THREAD_CHECK();
3443 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glMatrixLoadIdentityCHROMIUM("
3444 << GLES2Util::GetStringMatrixMode(matrixMode
) << ")");
3445 helper_
->MatrixLoadIdentityCHROMIUM(matrixMode
);
3449 void GLES2Implementation::BlendBarrierKHR() {
3450 GPU_CLIENT_SINGLE_THREAD_CHECK();
3451 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBlendBarrierKHR("
3453 helper_
->BlendBarrierKHR();
3457 #endif // GPU_COMMAND_BUFFER_CLIENT_GLES2_IMPLEMENTATION_IMPL_AUTOGEN_H_