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::GetIntegerv(GLenum pname
, GLint
* params
) {
1000 GPU_CLIENT_SINGLE_THREAD_CHECK();
1001 GPU_CLIENT_VALIDATE_DESTINATION_INITALIZATION(GLint
, params
);
1002 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetIntegerv("
1003 << GLES2Util::GetStringGLState(pname
) << ", "
1004 << static_cast<const void*>(params
) << ")");
1005 TRACE_EVENT0("gpu", "GLES2Implementation::GetIntegerv");
1006 if (GetIntegervHelper(pname
, params
)) {
1009 typedef cmds::GetIntegerv::Result Result
;
1010 Result
* result
= GetResultAs
<Result
*>();
1014 result
->SetNumResults(0);
1015 helper_
->GetIntegerv(pname
, GetResultShmId(), GetResultShmOffset());
1017 result
->CopyResult(params
);
1018 GPU_CLIENT_LOG_CODE_BLOCK({
1019 for (int32_t i
= 0; i
< result
->GetNumResults(); ++i
) {
1020 GPU_CLIENT_LOG(" " << i
<< ": " << result
->GetData()[i
]);
1025 void GLES2Implementation::GetInternalformativ(GLenum target
,
1030 GPU_CLIENT_SINGLE_THREAD_CHECK();
1031 GPU_CLIENT_VALIDATE_DESTINATION_INITALIZATION(GLint
, params
);
1032 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetInternalformativ("
1033 << GLES2Util::GetStringRenderBufferTarget(target
) << ", "
1034 << GLES2Util::GetStringRenderBufferFormat(format
) << ", "
1035 << GLES2Util::GetStringRenderBufferParameter(pname
) << ", "
1036 << bufSize
<< ", " << static_cast<const void*>(params
)
1039 SetGLError(GL_INVALID_VALUE
, "glGetInternalformativ", "bufSize < 0");
1042 TRACE_EVENT0("gpu", "GLES2Implementation::GetInternalformativ");
1043 if (GetInternalformativHelper(target
, format
, pname
, bufSize
, params
)) {
1046 typedef cmds::GetInternalformativ::Result Result
;
1047 Result
* result
= GetResultAs
<Result
*>();
1051 result
->SetNumResults(0);
1052 helper_
->GetInternalformativ(target
, format
, pname
, bufSize
, GetResultShmId(),
1053 GetResultShmOffset());
1055 result
->CopyResult(params
);
1056 GPU_CLIENT_LOG_CODE_BLOCK({
1057 for (int32_t i
= 0; i
< result
->GetNumResults(); ++i
) {
1058 GPU_CLIENT_LOG(" " << i
<< ": " << result
->GetData()[i
]);
1063 void GLES2Implementation::GetProgramiv(GLuint program
,
1066 GPU_CLIENT_SINGLE_THREAD_CHECK();
1067 GPU_CLIENT_VALIDATE_DESTINATION_INITALIZATION(GLint
, params
);
1068 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetProgramiv(" << program
<< ", "
1069 << GLES2Util::GetStringProgramParameter(pname
) << ", "
1070 << static_cast<const void*>(params
) << ")");
1071 TRACE_EVENT0("gpu", "GLES2Implementation::GetProgramiv");
1072 if (GetProgramivHelper(program
, pname
, params
)) {
1075 typedef cmds::GetProgramiv::Result Result
;
1076 Result
* result
= GetResultAs
<Result
*>();
1080 result
->SetNumResults(0);
1081 helper_
->GetProgramiv(program
, pname
, GetResultShmId(), GetResultShmOffset());
1083 result
->CopyResult(params
);
1084 GPU_CLIENT_LOG_CODE_BLOCK({
1085 for (int32_t i
= 0; i
< result
->GetNumResults(); ++i
) {
1086 GPU_CLIENT_LOG(" " << i
<< ": " << result
->GetData()[i
]);
1091 void GLES2Implementation::GetProgramInfoLog(GLuint program
,
1095 GPU_CLIENT_SINGLE_THREAD_CHECK();
1096 GPU_CLIENT_VALIDATE_DESTINATION_OPTIONAL_INITALIZATION(GLsizei
, length
);
1097 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetProgramInfoLog"
1098 << "(" << program
<< ", " << bufsize
<< ", "
1099 << static_cast<void*>(length
) << ", "
1100 << static_cast<void*>(infolog
) << ")");
1101 helper_
->SetBucketSize(kResultBucketId
, 0);
1102 helper_
->GetProgramInfoLog(program
, kResultBucketId
);
1104 GLsizei max_size
= 0;
1105 if (GetBucketAsString(kResultBucketId
, &str
)) {
1107 max_size
= std::min(static_cast<size_t>(bufsize
) - 1, str
.size());
1108 memcpy(infolog
, str
.c_str(), max_size
);
1109 infolog
[max_size
] = '\0';
1110 GPU_CLIENT_LOG("------\n" << infolog
<< "\n------");
1113 if (length
!= NULL
) {
1118 void GLES2Implementation::GetRenderbufferParameteriv(GLenum target
,
1121 GPU_CLIENT_SINGLE_THREAD_CHECK();
1122 GPU_CLIENT_VALIDATE_DESTINATION_INITALIZATION(GLint
, params
);
1123 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetRenderbufferParameteriv("
1124 << GLES2Util::GetStringRenderBufferTarget(target
) << ", "
1125 << GLES2Util::GetStringRenderBufferParameter(pname
) << ", "
1126 << static_cast<const void*>(params
) << ")");
1127 TRACE_EVENT0("gpu", "GLES2Implementation::GetRenderbufferParameteriv");
1128 if (GetRenderbufferParameterivHelper(target
, pname
, params
)) {
1131 typedef cmds::GetRenderbufferParameteriv::Result Result
;
1132 Result
* result
= GetResultAs
<Result
*>();
1136 result
->SetNumResults(0);
1137 helper_
->GetRenderbufferParameteriv(target
, pname
, GetResultShmId(),
1138 GetResultShmOffset());
1140 result
->CopyResult(params
);
1141 GPU_CLIENT_LOG_CODE_BLOCK({
1142 for (int32_t i
= 0; i
< result
->GetNumResults(); ++i
) {
1143 GPU_CLIENT_LOG(" " << i
<< ": " << result
->GetData()[i
]);
1148 void GLES2Implementation::GetSamplerParameterfv(GLuint sampler
,
1151 GPU_CLIENT_SINGLE_THREAD_CHECK();
1152 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetSamplerParameterfv("
1154 << GLES2Util::GetStringSamplerParameter(pname
) << ", "
1155 << static_cast<const void*>(params
) << ")");
1156 TRACE_EVENT0("gpu", "GLES2Implementation::GetSamplerParameterfv");
1157 if (GetSamplerParameterfvHelper(sampler
, pname
, params
)) {
1160 typedef cmds::GetSamplerParameterfv::Result Result
;
1161 Result
* result
= GetResultAs
<Result
*>();
1165 result
->SetNumResults(0);
1166 helper_
->GetSamplerParameterfv(sampler
, pname
, GetResultShmId(),
1167 GetResultShmOffset());
1169 result
->CopyResult(params
);
1170 GPU_CLIENT_LOG_CODE_BLOCK({
1171 for (int32_t i
= 0; i
< result
->GetNumResults(); ++i
) {
1172 GPU_CLIENT_LOG(" " << i
<< ": " << result
->GetData()[i
]);
1177 void GLES2Implementation::GetSamplerParameteriv(GLuint sampler
,
1180 GPU_CLIENT_SINGLE_THREAD_CHECK();
1181 GPU_CLIENT_VALIDATE_DESTINATION_INITALIZATION(GLint
, params
);
1182 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetSamplerParameteriv("
1184 << GLES2Util::GetStringSamplerParameter(pname
) << ", "
1185 << static_cast<const void*>(params
) << ")");
1186 TRACE_EVENT0("gpu", "GLES2Implementation::GetSamplerParameteriv");
1187 if (GetSamplerParameterivHelper(sampler
, pname
, params
)) {
1190 typedef cmds::GetSamplerParameteriv::Result Result
;
1191 Result
* result
= GetResultAs
<Result
*>();
1195 result
->SetNumResults(0);
1196 helper_
->GetSamplerParameteriv(sampler
, pname
, GetResultShmId(),
1197 GetResultShmOffset());
1199 result
->CopyResult(params
);
1200 GPU_CLIENT_LOG_CODE_BLOCK({
1201 for (int32_t i
= 0; i
< result
->GetNumResults(); ++i
) {
1202 GPU_CLIENT_LOG(" " << i
<< ": " << result
->GetData()[i
]);
1207 void GLES2Implementation::GetShaderiv(GLuint shader
,
1210 GPU_CLIENT_SINGLE_THREAD_CHECK();
1211 GPU_CLIENT_VALIDATE_DESTINATION_INITALIZATION(GLint
, params
);
1212 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetShaderiv(" << shader
<< ", "
1213 << GLES2Util::GetStringShaderParameter(pname
) << ", "
1214 << static_cast<const void*>(params
) << ")");
1215 TRACE_EVENT0("gpu", "GLES2Implementation::GetShaderiv");
1216 if (GetShaderivHelper(shader
, pname
, params
)) {
1219 typedef cmds::GetShaderiv::Result Result
;
1220 Result
* result
= GetResultAs
<Result
*>();
1224 result
->SetNumResults(0);
1225 helper_
->GetShaderiv(shader
, pname
, GetResultShmId(), GetResultShmOffset());
1227 result
->CopyResult(params
);
1228 GPU_CLIENT_LOG_CODE_BLOCK({
1229 for (int32_t i
= 0; i
< result
->GetNumResults(); ++i
) {
1230 GPU_CLIENT_LOG(" " << i
<< ": " << result
->GetData()[i
]);
1235 void GLES2Implementation::GetShaderInfoLog(GLuint shader
,
1239 GPU_CLIENT_SINGLE_THREAD_CHECK();
1240 GPU_CLIENT_VALIDATE_DESTINATION_OPTIONAL_INITALIZATION(GLsizei
, length
);
1241 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetShaderInfoLog"
1242 << "(" << shader
<< ", " << bufsize
<< ", "
1243 << static_cast<void*>(length
) << ", "
1244 << static_cast<void*>(infolog
) << ")");
1245 helper_
->SetBucketSize(kResultBucketId
, 0);
1246 helper_
->GetShaderInfoLog(shader
, kResultBucketId
);
1248 GLsizei max_size
= 0;
1249 if (GetBucketAsString(kResultBucketId
, &str
)) {
1251 max_size
= std::min(static_cast<size_t>(bufsize
) - 1, str
.size());
1252 memcpy(infolog
, str
.c_str(), max_size
);
1253 infolog
[max_size
] = '\0';
1254 GPU_CLIENT_LOG("------\n" << infolog
<< "\n------");
1257 if (length
!= NULL
) {
1262 void GLES2Implementation::GetShaderSource(GLuint shader
,
1266 GPU_CLIENT_SINGLE_THREAD_CHECK();
1267 GPU_CLIENT_VALIDATE_DESTINATION_OPTIONAL_INITALIZATION(GLsizei
, length
);
1268 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetShaderSource"
1269 << "(" << shader
<< ", " << bufsize
<< ", "
1270 << static_cast<void*>(length
) << ", "
1271 << static_cast<void*>(source
) << ")");
1272 helper_
->SetBucketSize(kResultBucketId
, 0);
1273 helper_
->GetShaderSource(shader
, kResultBucketId
);
1275 GLsizei max_size
= 0;
1276 if (GetBucketAsString(kResultBucketId
, &str
)) {
1278 max_size
= std::min(static_cast<size_t>(bufsize
) - 1, str
.size());
1279 memcpy(source
, str
.c_str(), max_size
);
1280 source
[max_size
] = '\0';
1281 GPU_CLIENT_LOG("------\n" << source
<< "\n------");
1284 if (length
!= NULL
) {
1289 void GLES2Implementation::GetSynciv(GLsync sync
,
1294 GPU_CLIENT_SINGLE_THREAD_CHECK();
1295 GPU_CLIENT_VALIDATE_DESTINATION_OPTIONAL_INITALIZATION(GLsizei
, length
);
1296 GPU_CLIENT_VALIDATE_DESTINATION_INITALIZATION(GLint
, values
);
1297 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetSynciv(" << sync
<< ", "
1298 << GLES2Util::GetStringSyncParameter(pname
) << ", "
1299 << bufsize
<< ", " << static_cast<const void*>(length
)
1300 << ", " << static_cast<const void*>(values
) << ")");
1302 SetGLError(GL_INVALID_VALUE
, "glGetSynciv", "bufsize < 0");
1305 TRACE_EVENT0("gpu", "GLES2Implementation::GetSynciv");
1306 if (GetSyncivHelper(sync
, pname
, bufsize
, length
, values
)) {
1309 typedef cmds::GetSynciv::Result Result
;
1310 Result
* result
= GetResultAs
<Result
*>();
1314 result
->SetNumResults(0);
1315 helper_
->GetSynciv(ToGLuint(sync
), pname
, GetResultShmId(),
1316 GetResultShmOffset());
1318 result
->CopyResult(values
);
1319 GPU_CLIENT_LOG_CODE_BLOCK({
1320 for (int32_t i
= 0; i
< result
->GetNumResults(); ++i
) {
1321 GPU_CLIENT_LOG(" " << i
<< ": " << result
->GetData()[i
]);
1325 *length
= result
->GetNumResults();
1329 void GLES2Implementation::GetTexParameterfv(GLenum target
,
1332 GPU_CLIENT_SINGLE_THREAD_CHECK();
1333 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetTexParameterfv("
1334 << GLES2Util::GetStringGetTexParamTarget(target
) << ", "
1335 << GLES2Util::GetStringTextureParameter(pname
) << ", "
1336 << static_cast<const void*>(params
) << ")");
1337 TRACE_EVENT0("gpu", "GLES2Implementation::GetTexParameterfv");
1338 if (GetTexParameterfvHelper(target
, pname
, params
)) {
1341 typedef cmds::GetTexParameterfv::Result Result
;
1342 Result
* result
= GetResultAs
<Result
*>();
1346 result
->SetNumResults(0);
1347 helper_
->GetTexParameterfv(target
, pname
, GetResultShmId(),
1348 GetResultShmOffset());
1350 result
->CopyResult(params
);
1351 GPU_CLIENT_LOG_CODE_BLOCK({
1352 for (int32_t i
= 0; i
< result
->GetNumResults(); ++i
) {
1353 GPU_CLIENT_LOG(" " << i
<< ": " << result
->GetData()[i
]);
1358 void GLES2Implementation::GetTexParameteriv(GLenum target
,
1361 GPU_CLIENT_SINGLE_THREAD_CHECK();
1362 GPU_CLIENT_VALIDATE_DESTINATION_INITALIZATION(GLint
, params
);
1363 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetTexParameteriv("
1364 << GLES2Util::GetStringGetTexParamTarget(target
) << ", "
1365 << GLES2Util::GetStringTextureParameter(pname
) << ", "
1366 << static_cast<const void*>(params
) << ")");
1367 TRACE_EVENT0("gpu", "GLES2Implementation::GetTexParameteriv");
1368 if (GetTexParameterivHelper(target
, pname
, params
)) {
1371 typedef cmds::GetTexParameteriv::Result Result
;
1372 Result
* result
= GetResultAs
<Result
*>();
1376 result
->SetNumResults(0);
1377 helper_
->GetTexParameteriv(target
, pname
, GetResultShmId(),
1378 GetResultShmOffset());
1380 result
->CopyResult(params
);
1381 GPU_CLIENT_LOG_CODE_BLOCK({
1382 for (int32_t i
= 0; i
< result
->GetNumResults(); ++i
) {
1383 GPU_CLIENT_LOG(" " << i
<< ": " << result
->GetData()[i
]);
1388 void GLES2Implementation::Hint(GLenum target
, GLenum mode
) {
1389 GPU_CLIENT_SINGLE_THREAD_CHECK();
1390 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glHint("
1391 << GLES2Util::GetStringHintTarget(target
) << ", "
1392 << GLES2Util::GetStringHintMode(mode
) << ")");
1393 helper_
->Hint(target
, mode
);
1397 void GLES2Implementation::InvalidateFramebuffer(GLenum target
,
1399 const GLenum
* attachments
) {
1400 GPU_CLIENT_SINGLE_THREAD_CHECK();
1401 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glInvalidateFramebuffer("
1402 << GLES2Util::GetStringFrameBufferTarget(target
) << ", "
1403 << count
<< ", " << static_cast<const void*>(attachments
)
1405 GPU_CLIENT_LOG_CODE_BLOCK({
1406 for (GLsizei i
= 0; i
< count
; ++i
) {
1407 GPU_CLIENT_LOG(" " << i
<< ": " << attachments
[0 + i
* 1]);
1411 SetGLError(GL_INVALID_VALUE
, "glInvalidateFramebuffer", "count < 0");
1414 helper_
->InvalidateFramebufferImmediate(target
, count
, attachments
);
1418 void GLES2Implementation::InvalidateSubFramebuffer(GLenum target
,
1420 const GLenum
* attachments
,
1425 GPU_CLIENT_SINGLE_THREAD_CHECK();
1426 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glInvalidateSubFramebuffer("
1427 << GLES2Util::GetStringFrameBufferTarget(target
) << ", "
1428 << count
<< ", " << static_cast<const void*>(attachments
)
1429 << ", " << x
<< ", " << y
<< ", " << width
<< ", "
1431 GPU_CLIENT_LOG_CODE_BLOCK({
1432 for (GLsizei i
= 0; i
< count
; ++i
) {
1433 GPU_CLIENT_LOG(" " << i
<< ": " << attachments
[0 + i
* 1]);
1437 SetGLError(GL_INVALID_VALUE
, "glInvalidateSubFramebuffer", "count < 0");
1441 SetGLError(GL_INVALID_VALUE
, "glInvalidateSubFramebuffer", "width < 0");
1445 SetGLError(GL_INVALID_VALUE
, "glInvalidateSubFramebuffer", "height < 0");
1448 helper_
->InvalidateSubFramebufferImmediate(target
, count
, attachments
, x
, y
,
1453 GLboolean
GLES2Implementation::IsBuffer(GLuint buffer
) {
1454 GPU_CLIENT_SINGLE_THREAD_CHECK();
1455 TRACE_EVENT0("gpu", "GLES2Implementation::IsBuffer");
1456 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glIsBuffer(" << buffer
<< ")");
1457 typedef cmds::IsBuffer::Result Result
;
1458 Result
* result
= GetResultAs
<Result
*>();
1463 helper_
->IsBuffer(buffer
, GetResultShmId(), GetResultShmOffset());
1465 GLboolean result_value
= *result
!= 0;
1466 GPU_CLIENT_LOG("returned " << result_value
);
1468 return result_value
;
1471 GLboolean
GLES2Implementation::IsFramebuffer(GLuint framebuffer
) {
1472 GPU_CLIENT_SINGLE_THREAD_CHECK();
1473 TRACE_EVENT0("gpu", "GLES2Implementation::IsFramebuffer");
1474 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glIsFramebuffer(" << framebuffer
1476 typedef cmds::IsFramebuffer::Result Result
;
1477 Result
* result
= GetResultAs
<Result
*>();
1482 helper_
->IsFramebuffer(framebuffer
, GetResultShmId(), GetResultShmOffset());
1484 GLboolean result_value
= *result
!= 0;
1485 GPU_CLIENT_LOG("returned " << result_value
);
1487 return result_value
;
1490 GLboolean
GLES2Implementation::IsProgram(GLuint program
) {
1491 GPU_CLIENT_SINGLE_THREAD_CHECK();
1492 TRACE_EVENT0("gpu", "GLES2Implementation::IsProgram");
1493 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glIsProgram(" << program
<< ")");
1494 typedef cmds::IsProgram::Result Result
;
1495 Result
* result
= GetResultAs
<Result
*>();
1500 helper_
->IsProgram(program
, GetResultShmId(), GetResultShmOffset());
1502 GLboolean result_value
= *result
!= 0;
1503 GPU_CLIENT_LOG("returned " << result_value
);
1505 return result_value
;
1508 GLboolean
GLES2Implementation::IsRenderbuffer(GLuint renderbuffer
) {
1509 GPU_CLIENT_SINGLE_THREAD_CHECK();
1510 TRACE_EVENT0("gpu", "GLES2Implementation::IsRenderbuffer");
1511 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glIsRenderbuffer(" << renderbuffer
1513 typedef cmds::IsRenderbuffer::Result Result
;
1514 Result
* result
= GetResultAs
<Result
*>();
1519 helper_
->IsRenderbuffer(renderbuffer
, GetResultShmId(), GetResultShmOffset());
1521 GLboolean result_value
= *result
!= 0;
1522 GPU_CLIENT_LOG("returned " << result_value
);
1524 return result_value
;
1527 GLboolean
GLES2Implementation::IsSampler(GLuint sampler
) {
1528 GPU_CLIENT_SINGLE_THREAD_CHECK();
1529 TRACE_EVENT0("gpu", "GLES2Implementation::IsSampler");
1530 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glIsSampler(" << sampler
<< ")");
1531 typedef cmds::IsSampler::Result Result
;
1532 Result
* result
= GetResultAs
<Result
*>();
1537 helper_
->IsSampler(sampler
, GetResultShmId(), GetResultShmOffset());
1539 GLboolean result_value
= *result
!= 0;
1540 GPU_CLIENT_LOG("returned " << result_value
);
1542 return result_value
;
1545 GLboolean
GLES2Implementation::IsShader(GLuint shader
) {
1546 GPU_CLIENT_SINGLE_THREAD_CHECK();
1547 TRACE_EVENT0("gpu", "GLES2Implementation::IsShader");
1548 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glIsShader(" << shader
<< ")");
1549 typedef cmds::IsShader::Result Result
;
1550 Result
* result
= GetResultAs
<Result
*>();
1555 helper_
->IsShader(shader
, GetResultShmId(), GetResultShmOffset());
1557 GLboolean result_value
= *result
!= 0;
1558 GPU_CLIENT_LOG("returned " << result_value
);
1560 return result_value
;
1563 GLboolean
GLES2Implementation::IsSync(GLsync sync
) {
1564 GPU_CLIENT_SINGLE_THREAD_CHECK();
1565 TRACE_EVENT0("gpu", "GLES2Implementation::IsSync");
1566 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glIsSync(" << sync
<< ")");
1567 typedef cmds::IsSync::Result Result
;
1568 Result
* result
= GetResultAs
<Result
*>();
1573 helper_
->IsSync(ToGLuint(sync
), GetResultShmId(), GetResultShmOffset());
1575 GLboolean result_value
= *result
!= 0;
1576 GPU_CLIENT_LOG("returned " << result_value
);
1578 return result_value
;
1581 GLboolean
GLES2Implementation::IsTexture(GLuint texture
) {
1582 GPU_CLIENT_SINGLE_THREAD_CHECK();
1583 TRACE_EVENT0("gpu", "GLES2Implementation::IsTexture");
1584 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glIsTexture(" << texture
<< ")");
1585 typedef cmds::IsTexture::Result Result
;
1586 Result
* result
= GetResultAs
<Result
*>();
1591 helper_
->IsTexture(texture
, GetResultShmId(), GetResultShmOffset());
1593 GLboolean result_value
= *result
!= 0;
1594 GPU_CLIENT_LOG("returned " << result_value
);
1596 return result_value
;
1599 GLboolean
GLES2Implementation::IsTransformFeedback(GLuint transformfeedback
) {
1600 GPU_CLIENT_SINGLE_THREAD_CHECK();
1601 TRACE_EVENT0("gpu", "GLES2Implementation::IsTransformFeedback");
1602 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glIsTransformFeedback("
1603 << transformfeedback
<< ")");
1604 typedef cmds::IsTransformFeedback::Result Result
;
1605 Result
* result
= GetResultAs
<Result
*>();
1610 helper_
->IsTransformFeedback(transformfeedback
, GetResultShmId(),
1611 GetResultShmOffset());
1613 GLboolean result_value
= *result
!= 0;
1614 GPU_CLIENT_LOG("returned " << result_value
);
1616 return result_value
;
1619 void GLES2Implementation::LineWidth(GLfloat width
) {
1620 GPU_CLIENT_SINGLE_THREAD_CHECK();
1621 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glLineWidth(" << width
<< ")");
1622 helper_
->LineWidth(width
);
1626 void GLES2Implementation::PauseTransformFeedback() {
1627 GPU_CLIENT_SINGLE_THREAD_CHECK();
1628 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glPauseTransformFeedback("
1630 helper_
->PauseTransformFeedback();
1634 void GLES2Implementation::PolygonOffset(GLfloat factor
, GLfloat units
) {
1635 GPU_CLIENT_SINGLE_THREAD_CHECK();
1636 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glPolygonOffset(" << factor
<< ", "
1638 helper_
->PolygonOffset(factor
, units
);
1642 void GLES2Implementation::ReadBuffer(GLenum src
) {
1643 GPU_CLIENT_SINGLE_THREAD_CHECK();
1644 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glReadBuffer("
1645 << GLES2Util::GetStringEnum(src
) << ")");
1646 helper_
->ReadBuffer(src
);
1650 void GLES2Implementation::ReleaseShaderCompiler() {
1651 GPU_CLIENT_SINGLE_THREAD_CHECK();
1652 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glReleaseShaderCompiler("
1654 helper_
->ReleaseShaderCompiler();
1658 void GLES2Implementation::RenderbufferStorage(GLenum target
,
1659 GLenum internalformat
,
1662 GPU_CLIENT_SINGLE_THREAD_CHECK();
1663 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glRenderbufferStorage("
1664 << GLES2Util::GetStringRenderBufferTarget(target
) << ", "
1665 << GLES2Util::GetStringRenderBufferFormat(internalformat
)
1666 << ", " << width
<< ", " << height
<< ")");
1668 SetGLError(GL_INVALID_VALUE
, "glRenderbufferStorage", "width < 0");
1672 SetGLError(GL_INVALID_VALUE
, "glRenderbufferStorage", "height < 0");
1675 helper_
->RenderbufferStorage(target
, internalformat
, width
, height
);
1679 void GLES2Implementation::ResumeTransformFeedback() {
1680 GPU_CLIENT_SINGLE_THREAD_CHECK();
1681 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glResumeTransformFeedback("
1683 helper_
->ResumeTransformFeedback();
1687 void GLES2Implementation::SampleCoverage(GLclampf value
, GLboolean invert
) {
1688 GPU_CLIENT_SINGLE_THREAD_CHECK();
1689 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glSampleCoverage(" << value
<< ", "
1690 << GLES2Util::GetStringBool(invert
) << ")");
1691 helper_
->SampleCoverage(value
, invert
);
1695 void GLES2Implementation::SamplerParameterf(GLuint sampler
,
1698 GPU_CLIENT_SINGLE_THREAD_CHECK();
1699 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glSamplerParameterf(" << sampler
1700 << ", " << GLES2Util::GetStringSamplerParameter(pname
)
1701 << ", " << param
<< ")");
1702 helper_
->SamplerParameterf(sampler
, pname
, param
);
1706 void GLES2Implementation::SamplerParameterfv(GLuint sampler
,
1708 const GLfloat
* params
) {
1709 GPU_CLIENT_SINGLE_THREAD_CHECK();
1710 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glSamplerParameterfv(" << sampler
1711 << ", " << GLES2Util::GetStringSamplerParameter(pname
)
1712 << ", " << static_cast<const void*>(params
) << ")");
1714 for (size_t ii
= 0; ii
< count
; ++ii
)
1715 GPU_CLIENT_LOG("value[" << ii
<< "]: " << params
[ii
]);
1716 helper_
->SamplerParameterfvImmediate(sampler
, pname
, params
);
1720 void GLES2Implementation::SamplerParameteri(GLuint sampler
,
1723 GPU_CLIENT_SINGLE_THREAD_CHECK();
1724 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glSamplerParameteri(" << sampler
1725 << ", " << GLES2Util::GetStringSamplerParameter(pname
)
1726 << ", " << param
<< ")");
1727 helper_
->SamplerParameteri(sampler
, pname
, param
);
1731 void GLES2Implementation::SamplerParameteriv(GLuint sampler
,
1733 const GLint
* params
) {
1734 GPU_CLIENT_SINGLE_THREAD_CHECK();
1735 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glSamplerParameteriv(" << sampler
1736 << ", " << GLES2Util::GetStringSamplerParameter(pname
)
1737 << ", " << static_cast<const void*>(params
) << ")");
1739 for (size_t ii
= 0; ii
< count
; ++ii
)
1740 GPU_CLIENT_LOG("value[" << ii
<< "]: " << params
[ii
]);
1741 helper_
->SamplerParameterivImmediate(sampler
, pname
, params
);
1745 void GLES2Implementation::Scissor(GLint x
,
1749 GPU_CLIENT_SINGLE_THREAD_CHECK();
1750 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glScissor(" << x
<< ", " << y
1751 << ", " << width
<< ", " << height
<< ")");
1753 SetGLError(GL_INVALID_VALUE
, "glScissor", "width < 0");
1757 SetGLError(GL_INVALID_VALUE
, "glScissor", "height < 0");
1760 helper_
->Scissor(x
, y
, width
, height
);
1764 void GLES2Implementation::ShaderSource(GLuint shader
,
1766 const GLchar
* const* str
,
1767 const GLint
* length
) {
1768 GPU_CLIENT_SINGLE_THREAD_CHECK();
1769 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glShaderSource(" << shader
<< ", "
1770 << count
<< ", " << static_cast<const void*>(str
) << ", "
1771 << static_cast<const void*>(length
) << ")");
1772 GPU_CLIENT_LOG_CODE_BLOCK({
1773 for (GLsizei ii
= 0; ii
< count
; ++ii
) {
1775 if (length
&& length
[ii
] >= 0) {
1776 const std::string
my_str(str
[ii
], length
[ii
]);
1777 GPU_CLIENT_LOG(" " << ii
<< ": ---\n" << my_str
<< "\n---");
1779 GPU_CLIENT_LOG(" " << ii
<< ": ---\n" << str
[ii
] << "\n---");
1782 GPU_CLIENT_LOG(" " << ii
<< ": NULL");
1787 SetGLError(GL_INVALID_VALUE
, "glShaderSource", "count < 0");
1791 if (!PackStringsToBucket(count
, str
, length
, "glShaderSource")) {
1794 helper_
->ShaderSourceBucket(shader
, kResultBucketId
);
1795 helper_
->SetBucketSize(kResultBucketId
, 0);
1799 void GLES2Implementation::StencilFunc(GLenum func
, GLint ref
, GLuint mask
) {
1800 GPU_CLIENT_SINGLE_THREAD_CHECK();
1801 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glStencilFunc("
1802 << GLES2Util::GetStringCmpFunction(func
) << ", " << ref
1803 << ", " << mask
<< ")");
1804 helper_
->StencilFunc(func
, ref
, mask
);
1808 void GLES2Implementation::StencilFuncSeparate(GLenum face
,
1812 GPU_CLIENT_SINGLE_THREAD_CHECK();
1813 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glStencilFuncSeparate("
1814 << GLES2Util::GetStringFaceType(face
) << ", "
1815 << GLES2Util::GetStringCmpFunction(func
) << ", " << ref
1816 << ", " << mask
<< ")");
1817 helper_
->StencilFuncSeparate(face
, func
, ref
, mask
);
1821 void GLES2Implementation::StencilMask(GLuint mask
) {
1822 GPU_CLIENT_SINGLE_THREAD_CHECK();
1823 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glStencilMask(" << mask
<< ")");
1824 helper_
->StencilMask(mask
);
1828 void GLES2Implementation::StencilMaskSeparate(GLenum face
, GLuint mask
) {
1829 GPU_CLIENT_SINGLE_THREAD_CHECK();
1830 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glStencilMaskSeparate("
1831 << GLES2Util::GetStringFaceType(face
) << ", " << mask
1833 helper_
->StencilMaskSeparate(face
, mask
);
1837 void GLES2Implementation::StencilOp(GLenum fail
, GLenum zfail
, GLenum zpass
) {
1838 GPU_CLIENT_SINGLE_THREAD_CHECK();
1839 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glStencilOp("
1840 << GLES2Util::GetStringStencilOp(fail
) << ", "
1841 << GLES2Util::GetStringStencilOp(zfail
) << ", "
1842 << GLES2Util::GetStringStencilOp(zpass
) << ")");
1843 helper_
->StencilOp(fail
, zfail
, zpass
);
1847 void GLES2Implementation::StencilOpSeparate(GLenum face
,
1851 GPU_CLIENT_SINGLE_THREAD_CHECK();
1852 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glStencilOpSeparate("
1853 << GLES2Util::GetStringFaceType(face
) << ", "
1854 << GLES2Util::GetStringStencilOp(fail
) << ", "
1855 << GLES2Util::GetStringStencilOp(zfail
) << ", "
1856 << GLES2Util::GetStringStencilOp(zpass
) << ")");
1857 helper_
->StencilOpSeparate(face
, fail
, zfail
, zpass
);
1861 void GLES2Implementation::TexParameterf(GLenum target
,
1864 GPU_CLIENT_SINGLE_THREAD_CHECK();
1865 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glTexParameterf("
1866 << GLES2Util::GetStringTextureBindTarget(target
) << ", "
1867 << GLES2Util::GetStringTextureParameter(pname
) << ", "
1869 helper_
->TexParameterf(target
, pname
, param
);
1873 void GLES2Implementation::TexParameterfv(GLenum target
,
1875 const GLfloat
* params
) {
1876 GPU_CLIENT_SINGLE_THREAD_CHECK();
1877 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glTexParameterfv("
1878 << GLES2Util::GetStringTextureBindTarget(target
) << ", "
1879 << GLES2Util::GetStringTextureParameter(pname
) << ", "
1880 << static_cast<const void*>(params
) << ")");
1882 for (size_t ii
= 0; ii
< count
; ++ii
)
1883 GPU_CLIENT_LOG("value[" << ii
<< "]: " << params
[ii
]);
1884 helper_
->TexParameterfvImmediate(target
, pname
, params
);
1888 void GLES2Implementation::TexParameteri(GLenum target
,
1891 GPU_CLIENT_SINGLE_THREAD_CHECK();
1892 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glTexParameteri("
1893 << GLES2Util::GetStringTextureBindTarget(target
) << ", "
1894 << GLES2Util::GetStringTextureParameter(pname
) << ", "
1896 helper_
->TexParameteri(target
, pname
, param
);
1900 void GLES2Implementation::TexParameteriv(GLenum target
,
1902 const GLint
* params
) {
1903 GPU_CLIENT_SINGLE_THREAD_CHECK();
1904 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glTexParameteriv("
1905 << GLES2Util::GetStringTextureBindTarget(target
) << ", "
1906 << GLES2Util::GetStringTextureParameter(pname
) << ", "
1907 << static_cast<const void*>(params
) << ")");
1909 for (size_t ii
= 0; ii
< count
; ++ii
)
1910 GPU_CLIENT_LOG("value[" << ii
<< "]: " << params
[ii
]);
1911 helper_
->TexParameterivImmediate(target
, pname
, params
);
1915 void GLES2Implementation::TexStorage3D(GLenum target
,
1917 GLenum internalFormat
,
1921 GPU_CLIENT_SINGLE_THREAD_CHECK();
1923 "[" << GetLogPrefix() << "] glTexStorage3D("
1924 << GLES2Util::GetStringTexture3DTarget(target
) << ", " << levels
1926 << GLES2Util::GetStringTextureInternalFormatStorage(internalFormat
)
1927 << ", " << width
<< ", " << height
<< ", " << depth
<< ")");
1929 SetGLError(GL_INVALID_VALUE
, "glTexStorage3D", "levels < 0");
1933 SetGLError(GL_INVALID_VALUE
, "glTexStorage3D", "width < 0");
1937 SetGLError(GL_INVALID_VALUE
, "glTexStorage3D", "height < 0");
1941 SetGLError(GL_INVALID_VALUE
, "glTexStorage3D", "depth < 0");
1944 helper_
->TexStorage3D(target
, levels
, internalFormat
, width
, height
, depth
);
1948 void GLES2Implementation::TransformFeedbackVaryings(GLuint program
,
1950 const char* const* varyings
,
1951 GLenum buffermode
) {
1952 GPU_CLIENT_SINGLE_THREAD_CHECK();
1953 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glTransformFeedbackVaryings("
1954 << program
<< ", " << count
<< ", "
1955 << static_cast<const void*>(varyings
) << ", "
1956 << GLES2Util::GetStringBufferMode(buffermode
) << ")");
1957 GPU_CLIENT_LOG_CODE_BLOCK({
1958 for (GLsizei ii
= 0; ii
< count
; ++ii
) {
1960 GPU_CLIENT_LOG(" " << ii
<< ": ---\n" << varyings
[ii
] << "\n---");
1962 GPU_CLIENT_LOG(" " << ii
<< ": NULL");
1967 SetGLError(GL_INVALID_VALUE
, "glTransformFeedbackVaryings", "count < 0");
1971 if (!PackStringsToBucket(count
, varyings
, NULL
,
1972 "glTransformFeedbackVaryings")) {
1975 helper_
->TransformFeedbackVaryingsBucket(program
, kResultBucketId
,
1977 helper_
->SetBucketSize(kResultBucketId
, 0);
1981 void GLES2Implementation::Uniform1f(GLint location
, GLfloat x
) {
1982 GPU_CLIENT_SINGLE_THREAD_CHECK();
1983 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform1f(" << location
<< ", "
1985 helper_
->Uniform1f(location
, x
);
1989 void GLES2Implementation::Uniform1fv(GLint location
,
1992 GPU_CLIENT_SINGLE_THREAD_CHECK();
1993 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform1fv(" << location
<< ", "
1994 << count
<< ", " << static_cast<const void*>(v
) << ")");
1995 GPU_CLIENT_LOG_CODE_BLOCK({
1996 for (GLsizei i
= 0; i
< count
; ++i
) {
1997 GPU_CLIENT_LOG(" " << i
<< ": " << v
[0 + i
* 1]);
2001 SetGLError(GL_INVALID_VALUE
, "glUniform1fv", "count < 0");
2004 helper_
->Uniform1fvImmediate(location
, count
, v
);
2008 void GLES2Implementation::Uniform1i(GLint location
, GLint x
) {
2009 GPU_CLIENT_SINGLE_THREAD_CHECK();
2010 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform1i(" << location
<< ", "
2012 helper_
->Uniform1i(location
, x
);
2016 void GLES2Implementation::Uniform1iv(GLint location
,
2019 GPU_CLIENT_SINGLE_THREAD_CHECK();
2020 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform1iv(" << location
<< ", "
2021 << count
<< ", " << static_cast<const void*>(v
) << ")");
2022 GPU_CLIENT_LOG_CODE_BLOCK({
2023 for (GLsizei i
= 0; i
< count
; ++i
) {
2024 GPU_CLIENT_LOG(" " << i
<< ": " << v
[0 + i
* 1]);
2028 SetGLError(GL_INVALID_VALUE
, "glUniform1iv", "count < 0");
2031 helper_
->Uniform1ivImmediate(location
, count
, v
);
2035 void GLES2Implementation::Uniform1ui(GLint location
, GLuint x
) {
2036 GPU_CLIENT_SINGLE_THREAD_CHECK();
2037 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform1ui(" << location
<< ", "
2039 helper_
->Uniform1ui(location
, x
);
2043 void GLES2Implementation::Uniform1uiv(GLint location
,
2046 GPU_CLIENT_SINGLE_THREAD_CHECK();
2047 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform1uiv(" << location
<< ", "
2048 << count
<< ", " << static_cast<const void*>(v
) << ")");
2049 GPU_CLIENT_LOG_CODE_BLOCK({
2050 for (GLsizei i
= 0; i
< count
; ++i
) {
2051 GPU_CLIENT_LOG(" " << i
<< ": " << v
[0 + i
* 1]);
2055 SetGLError(GL_INVALID_VALUE
, "glUniform1uiv", "count < 0");
2058 helper_
->Uniform1uivImmediate(location
, count
, v
);
2062 void GLES2Implementation::Uniform2f(GLint location
, GLfloat x
, GLfloat y
) {
2063 GPU_CLIENT_SINGLE_THREAD_CHECK();
2064 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform2f(" << location
<< ", "
2065 << x
<< ", " << y
<< ")");
2066 helper_
->Uniform2f(location
, x
, y
);
2070 void GLES2Implementation::Uniform2fv(GLint location
,
2073 GPU_CLIENT_SINGLE_THREAD_CHECK();
2074 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform2fv(" << location
<< ", "
2075 << count
<< ", " << static_cast<const void*>(v
) << ")");
2076 GPU_CLIENT_LOG_CODE_BLOCK({
2077 for (GLsizei i
= 0; i
< count
; ++i
) {
2078 GPU_CLIENT_LOG(" " << i
<< ": " << v
[0 + i
* 2] << ", " << v
[1 + i
* 2]);
2082 SetGLError(GL_INVALID_VALUE
, "glUniform2fv", "count < 0");
2085 helper_
->Uniform2fvImmediate(location
, count
, v
);
2089 void GLES2Implementation::Uniform2i(GLint location
, GLint x
, GLint y
) {
2090 GPU_CLIENT_SINGLE_THREAD_CHECK();
2091 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform2i(" << location
<< ", "
2092 << x
<< ", " << y
<< ")");
2093 helper_
->Uniform2i(location
, x
, y
);
2097 void GLES2Implementation::Uniform2iv(GLint location
,
2100 GPU_CLIENT_SINGLE_THREAD_CHECK();
2101 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform2iv(" << location
<< ", "
2102 << count
<< ", " << static_cast<const void*>(v
) << ")");
2103 GPU_CLIENT_LOG_CODE_BLOCK({
2104 for (GLsizei i
= 0; i
< count
; ++i
) {
2105 GPU_CLIENT_LOG(" " << i
<< ": " << v
[0 + i
* 2] << ", " << v
[1 + i
* 2]);
2109 SetGLError(GL_INVALID_VALUE
, "glUniform2iv", "count < 0");
2112 helper_
->Uniform2ivImmediate(location
, count
, v
);
2116 void GLES2Implementation::Uniform2ui(GLint location
, GLuint x
, GLuint y
) {
2117 GPU_CLIENT_SINGLE_THREAD_CHECK();
2118 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform2ui(" << location
<< ", "
2119 << x
<< ", " << y
<< ")");
2120 helper_
->Uniform2ui(location
, x
, y
);
2124 void GLES2Implementation::Uniform2uiv(GLint location
,
2127 GPU_CLIENT_SINGLE_THREAD_CHECK();
2128 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform2uiv(" << location
<< ", "
2129 << count
<< ", " << static_cast<const void*>(v
) << ")");
2130 GPU_CLIENT_LOG_CODE_BLOCK({
2131 for (GLsizei i
= 0; i
< count
; ++i
) {
2132 GPU_CLIENT_LOG(" " << i
<< ": " << v
[0 + i
* 2] << ", " << v
[1 + i
* 2]);
2136 SetGLError(GL_INVALID_VALUE
, "glUniform2uiv", "count < 0");
2139 helper_
->Uniform2uivImmediate(location
, count
, v
);
2143 void GLES2Implementation::Uniform3f(GLint location
,
2147 GPU_CLIENT_SINGLE_THREAD_CHECK();
2148 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform3f(" << location
<< ", "
2149 << x
<< ", " << y
<< ", " << z
<< ")");
2150 helper_
->Uniform3f(location
, x
, y
, z
);
2154 void GLES2Implementation::Uniform3fv(GLint location
,
2157 GPU_CLIENT_SINGLE_THREAD_CHECK();
2158 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform3fv(" << location
<< ", "
2159 << count
<< ", " << static_cast<const void*>(v
) << ")");
2160 GPU_CLIENT_LOG_CODE_BLOCK({
2161 for (GLsizei i
= 0; i
< count
; ++i
) {
2162 GPU_CLIENT_LOG(" " << i
<< ": " << v
[0 + i
* 3] << ", " << v
[1 + i
* 3]
2163 << ", " << v
[2 + i
* 3]);
2167 SetGLError(GL_INVALID_VALUE
, "glUniform3fv", "count < 0");
2170 helper_
->Uniform3fvImmediate(location
, count
, v
);
2174 void GLES2Implementation::Uniform3i(GLint location
, GLint x
, GLint y
, GLint z
) {
2175 GPU_CLIENT_SINGLE_THREAD_CHECK();
2176 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform3i(" << location
<< ", "
2177 << x
<< ", " << y
<< ", " << z
<< ")");
2178 helper_
->Uniform3i(location
, x
, y
, z
);
2182 void GLES2Implementation::Uniform3iv(GLint location
,
2185 GPU_CLIENT_SINGLE_THREAD_CHECK();
2186 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform3iv(" << location
<< ", "
2187 << count
<< ", " << static_cast<const void*>(v
) << ")");
2188 GPU_CLIENT_LOG_CODE_BLOCK({
2189 for (GLsizei i
= 0; i
< count
; ++i
) {
2190 GPU_CLIENT_LOG(" " << i
<< ": " << v
[0 + i
* 3] << ", " << v
[1 + i
* 3]
2191 << ", " << v
[2 + i
* 3]);
2195 SetGLError(GL_INVALID_VALUE
, "glUniform3iv", "count < 0");
2198 helper_
->Uniform3ivImmediate(location
, count
, v
);
2202 void GLES2Implementation::Uniform3ui(GLint location
,
2206 GPU_CLIENT_SINGLE_THREAD_CHECK();
2207 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform3ui(" << location
<< ", "
2208 << x
<< ", " << y
<< ", " << z
<< ")");
2209 helper_
->Uniform3ui(location
, x
, y
, z
);
2213 void GLES2Implementation::Uniform3uiv(GLint location
,
2216 GPU_CLIENT_SINGLE_THREAD_CHECK();
2217 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform3uiv(" << location
<< ", "
2218 << count
<< ", " << static_cast<const void*>(v
) << ")");
2219 GPU_CLIENT_LOG_CODE_BLOCK({
2220 for (GLsizei i
= 0; i
< count
; ++i
) {
2221 GPU_CLIENT_LOG(" " << i
<< ": " << v
[0 + i
* 3] << ", " << v
[1 + i
* 3]
2222 << ", " << v
[2 + i
* 3]);
2226 SetGLError(GL_INVALID_VALUE
, "glUniform3uiv", "count < 0");
2229 helper_
->Uniform3uivImmediate(location
, count
, v
);
2233 void GLES2Implementation::Uniform4f(GLint location
,
2238 GPU_CLIENT_SINGLE_THREAD_CHECK();
2239 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform4f(" << location
<< ", "
2240 << x
<< ", " << y
<< ", " << z
<< ", " << w
<< ")");
2241 helper_
->Uniform4f(location
, x
, y
, z
, w
);
2245 void GLES2Implementation::Uniform4fv(GLint location
,
2248 GPU_CLIENT_SINGLE_THREAD_CHECK();
2249 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform4fv(" << location
<< ", "
2250 << count
<< ", " << static_cast<const void*>(v
) << ")");
2251 GPU_CLIENT_LOG_CODE_BLOCK({
2252 for (GLsizei i
= 0; i
< count
; ++i
) {
2253 GPU_CLIENT_LOG(" " << i
<< ": " << v
[0 + i
* 4] << ", " << v
[1 + i
* 4]
2254 << ", " << v
[2 + i
* 4] << ", " << v
[3 + i
* 4]);
2258 SetGLError(GL_INVALID_VALUE
, "glUniform4fv", "count < 0");
2261 helper_
->Uniform4fvImmediate(location
, count
, v
);
2265 void GLES2Implementation::Uniform4i(GLint location
,
2270 GPU_CLIENT_SINGLE_THREAD_CHECK();
2271 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform4i(" << location
<< ", "
2272 << x
<< ", " << y
<< ", " << z
<< ", " << w
<< ")");
2273 helper_
->Uniform4i(location
, x
, y
, z
, w
);
2277 void GLES2Implementation::Uniform4iv(GLint location
,
2280 GPU_CLIENT_SINGLE_THREAD_CHECK();
2281 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform4iv(" << location
<< ", "
2282 << count
<< ", " << static_cast<const void*>(v
) << ")");
2283 GPU_CLIENT_LOG_CODE_BLOCK({
2284 for (GLsizei i
= 0; i
< count
; ++i
) {
2285 GPU_CLIENT_LOG(" " << i
<< ": " << v
[0 + i
* 4] << ", " << v
[1 + i
* 4]
2286 << ", " << v
[2 + i
* 4] << ", " << v
[3 + i
* 4]);
2290 SetGLError(GL_INVALID_VALUE
, "glUniform4iv", "count < 0");
2293 helper_
->Uniform4ivImmediate(location
, count
, v
);
2297 void GLES2Implementation::Uniform4ui(GLint location
,
2302 GPU_CLIENT_SINGLE_THREAD_CHECK();
2303 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform4ui(" << location
<< ", "
2304 << x
<< ", " << y
<< ", " << z
<< ", " << w
<< ")");
2305 helper_
->Uniform4ui(location
, x
, y
, z
, w
);
2309 void GLES2Implementation::Uniform4uiv(GLint location
,
2312 GPU_CLIENT_SINGLE_THREAD_CHECK();
2313 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform4uiv(" << location
<< ", "
2314 << count
<< ", " << static_cast<const void*>(v
) << ")");
2315 GPU_CLIENT_LOG_CODE_BLOCK({
2316 for (GLsizei i
= 0; i
< count
; ++i
) {
2317 GPU_CLIENT_LOG(" " << i
<< ": " << v
[0 + i
* 4] << ", " << v
[1 + i
* 4]
2318 << ", " << v
[2 + i
* 4] << ", " << v
[3 + i
* 4]);
2322 SetGLError(GL_INVALID_VALUE
, "glUniform4uiv", "count < 0");
2325 helper_
->Uniform4uivImmediate(location
, count
, v
);
2329 void GLES2Implementation::UniformMatrix2fv(GLint location
,
2331 GLboolean transpose
,
2332 const GLfloat
* value
) {
2333 GPU_CLIENT_SINGLE_THREAD_CHECK();
2334 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniformMatrix2fv(" << location
2335 << ", " << count
<< ", "
2336 << GLES2Util::GetStringBool(transpose
) << ", "
2337 << static_cast<const void*>(value
) << ")");
2338 GPU_CLIENT_LOG_CODE_BLOCK({
2339 for (GLsizei i
= 0; i
< count
; ++i
) {
2340 GPU_CLIENT_LOG(" " << i
<< ": " << value
[0 + i
* 4] << ", "
2341 << value
[1 + i
* 4] << ", " << value
[2 + i
* 4]
2342 << ", " << value
[3 + i
* 4]);
2346 SetGLError(GL_INVALID_VALUE
, "glUniformMatrix2fv", "count < 0");
2349 if (transpose
!= false) {
2350 SetGLError(GL_INVALID_VALUE
, "glUniformMatrix2fv",
2351 "transpose GL_INVALID_VALUE");
2354 helper_
->UniformMatrix2fvImmediate(location
, count
, value
);
2358 void GLES2Implementation::UniformMatrix2x3fv(GLint location
,
2360 GLboolean transpose
,
2361 const GLfloat
* value
) {
2362 GPU_CLIENT_SINGLE_THREAD_CHECK();
2363 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniformMatrix2x3fv(" << location
2364 << ", " << count
<< ", "
2365 << GLES2Util::GetStringBool(transpose
) << ", "
2366 << static_cast<const void*>(value
) << ")");
2367 GPU_CLIENT_LOG_CODE_BLOCK({
2368 for (GLsizei i
= 0; i
< count
; ++i
) {
2369 GPU_CLIENT_LOG(" " << i
<< ": " << value
[0 + i
* 6] << ", "
2370 << value
[1 + i
* 6] << ", " << value
[2 + i
* 6]
2371 << ", " << value
[3 + i
* 6] << ", "
2372 << value
[4 + i
* 6] << ", " << value
[5 + i
* 6]);
2376 SetGLError(GL_INVALID_VALUE
, "glUniformMatrix2x3fv", "count < 0");
2379 if (transpose
!= false) {
2380 SetGLError(GL_INVALID_VALUE
, "glUniformMatrix2x3fv",
2381 "transpose GL_INVALID_VALUE");
2384 helper_
->UniformMatrix2x3fvImmediate(location
, count
, value
);
2388 void GLES2Implementation::UniformMatrix2x4fv(GLint location
,
2390 GLboolean transpose
,
2391 const GLfloat
* value
) {
2392 GPU_CLIENT_SINGLE_THREAD_CHECK();
2393 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniformMatrix2x4fv(" << location
2394 << ", " << count
<< ", "
2395 << GLES2Util::GetStringBool(transpose
) << ", "
2396 << static_cast<const void*>(value
) << ")");
2397 GPU_CLIENT_LOG_CODE_BLOCK({
2398 for (GLsizei i
= 0; i
< count
; ++i
) {
2400 " " << i
<< ": " << value
[0 + i
* 8] << ", " << value
[1 + i
* 8]
2401 << ", " << value
[2 + i
* 8] << ", " << value
[3 + i
* 8] << ", "
2402 << value
[4 + i
* 8] << ", " << value
[5 + i
* 8] << ", "
2403 << value
[6 + i
* 8] << ", " << value
[7 + i
* 8]);
2407 SetGLError(GL_INVALID_VALUE
, "glUniformMatrix2x4fv", "count < 0");
2410 if (transpose
!= false) {
2411 SetGLError(GL_INVALID_VALUE
, "glUniformMatrix2x4fv",
2412 "transpose GL_INVALID_VALUE");
2415 helper_
->UniformMatrix2x4fvImmediate(location
, count
, value
);
2419 void GLES2Implementation::UniformMatrix3fv(GLint location
,
2421 GLboolean transpose
,
2422 const GLfloat
* value
) {
2423 GPU_CLIENT_SINGLE_THREAD_CHECK();
2424 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniformMatrix3fv(" << location
2425 << ", " << count
<< ", "
2426 << GLES2Util::GetStringBool(transpose
) << ", "
2427 << static_cast<const void*>(value
) << ")");
2428 GPU_CLIENT_LOG_CODE_BLOCK({
2429 for (GLsizei i
= 0; i
< count
; ++i
) {
2430 GPU_CLIENT_LOG(" " << i
<< ": " << value
[0 + i
* 9] << ", "
2431 << value
[1 + i
* 9] << ", " << value
[2 + i
* 9]
2432 << ", " << value
[3 + i
* 9] << ", "
2433 << value
[4 + i
* 9] << ", " << value
[5 + i
* 9]
2434 << ", " << value
[6 + i
* 9] << ", "
2435 << value
[7 + i
* 9] << ", " << value
[8 + i
* 9]);
2439 SetGLError(GL_INVALID_VALUE
, "glUniformMatrix3fv", "count < 0");
2442 if (transpose
!= false) {
2443 SetGLError(GL_INVALID_VALUE
, "glUniformMatrix3fv",
2444 "transpose GL_INVALID_VALUE");
2447 helper_
->UniformMatrix3fvImmediate(location
, count
, value
);
2451 void GLES2Implementation::UniformMatrix3x2fv(GLint location
,
2453 GLboolean transpose
,
2454 const GLfloat
* value
) {
2455 GPU_CLIENT_SINGLE_THREAD_CHECK();
2456 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniformMatrix3x2fv(" << location
2457 << ", " << count
<< ", "
2458 << GLES2Util::GetStringBool(transpose
) << ", "
2459 << static_cast<const void*>(value
) << ")");
2460 GPU_CLIENT_LOG_CODE_BLOCK({
2461 for (GLsizei i
= 0; i
< count
; ++i
) {
2462 GPU_CLIENT_LOG(" " << i
<< ": " << value
[0 + i
* 6] << ", "
2463 << value
[1 + i
* 6] << ", " << value
[2 + i
* 6]
2464 << ", " << value
[3 + i
* 6] << ", "
2465 << value
[4 + i
* 6] << ", " << value
[5 + i
* 6]);
2469 SetGLError(GL_INVALID_VALUE
, "glUniformMatrix3x2fv", "count < 0");
2472 if (transpose
!= false) {
2473 SetGLError(GL_INVALID_VALUE
, "glUniformMatrix3x2fv",
2474 "transpose GL_INVALID_VALUE");
2477 helper_
->UniformMatrix3x2fvImmediate(location
, count
, value
);
2481 void GLES2Implementation::UniformMatrix3x4fv(GLint location
,
2483 GLboolean transpose
,
2484 const GLfloat
* value
) {
2485 GPU_CLIENT_SINGLE_THREAD_CHECK();
2486 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniformMatrix3x4fv(" << location
2487 << ", " << count
<< ", "
2488 << GLES2Util::GetStringBool(transpose
) << ", "
2489 << static_cast<const void*>(value
) << ")");
2490 GPU_CLIENT_LOG_CODE_BLOCK({
2491 for (GLsizei i
= 0; i
< count
; ++i
) {
2493 " " << i
<< ": " << value
[0 + i
* 12] << ", " << value
[1 + i
* 12]
2494 << ", " << value
[2 + i
* 12] << ", " << value
[3 + i
* 12] << ", "
2495 << value
[4 + i
* 12] << ", " << value
[5 + i
* 12] << ", "
2496 << value
[6 + i
* 12] << ", " << value
[7 + i
* 12] << ", "
2497 << value
[8 + i
* 12] << ", " << value
[9 + i
* 12] << ", "
2498 << value
[10 + i
* 12] << ", " << value
[11 + i
* 12]);
2502 SetGLError(GL_INVALID_VALUE
, "glUniformMatrix3x4fv", "count < 0");
2505 if (transpose
!= false) {
2506 SetGLError(GL_INVALID_VALUE
, "glUniformMatrix3x4fv",
2507 "transpose GL_INVALID_VALUE");
2510 helper_
->UniformMatrix3x4fvImmediate(location
, count
, value
);
2514 void GLES2Implementation::UniformMatrix4fv(GLint location
,
2516 GLboolean transpose
,
2517 const GLfloat
* value
) {
2518 GPU_CLIENT_SINGLE_THREAD_CHECK();
2519 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniformMatrix4fv(" << location
2520 << ", " << count
<< ", "
2521 << GLES2Util::GetStringBool(transpose
) << ", "
2522 << static_cast<const void*>(value
) << ")");
2523 GPU_CLIENT_LOG_CODE_BLOCK({
2524 for (GLsizei i
= 0; i
< count
; ++i
) {
2526 " " << i
<< ": " << value
[0 + i
* 16] << ", " << value
[1 + i
* 16]
2527 << ", " << value
[2 + i
* 16] << ", " << value
[3 + i
* 16] << ", "
2528 << value
[4 + i
* 16] << ", " << value
[5 + i
* 16] << ", "
2529 << value
[6 + i
* 16] << ", " << value
[7 + i
* 16] << ", "
2530 << value
[8 + i
* 16] << ", " << value
[9 + i
* 16] << ", "
2531 << value
[10 + i
* 16] << ", " << value
[11 + i
* 16] << ", "
2532 << value
[12 + i
* 16] << ", " << value
[13 + i
* 16] << ", "
2533 << value
[14 + i
* 16] << ", " << value
[15 + i
* 16]);
2537 SetGLError(GL_INVALID_VALUE
, "glUniformMatrix4fv", "count < 0");
2540 if (transpose
!= false) {
2541 SetGLError(GL_INVALID_VALUE
, "glUniformMatrix4fv",
2542 "transpose GL_INVALID_VALUE");
2545 helper_
->UniformMatrix4fvImmediate(location
, count
, value
);
2549 void GLES2Implementation::UniformMatrix4x2fv(GLint location
,
2551 GLboolean transpose
,
2552 const GLfloat
* value
) {
2553 GPU_CLIENT_SINGLE_THREAD_CHECK();
2554 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniformMatrix4x2fv(" << location
2555 << ", " << count
<< ", "
2556 << GLES2Util::GetStringBool(transpose
) << ", "
2557 << static_cast<const void*>(value
) << ")");
2558 GPU_CLIENT_LOG_CODE_BLOCK({
2559 for (GLsizei i
= 0; i
< count
; ++i
) {
2561 " " << i
<< ": " << value
[0 + i
* 8] << ", " << value
[1 + i
* 8]
2562 << ", " << value
[2 + i
* 8] << ", " << value
[3 + i
* 8] << ", "
2563 << value
[4 + i
* 8] << ", " << value
[5 + i
* 8] << ", "
2564 << value
[6 + i
* 8] << ", " << value
[7 + i
* 8]);
2568 SetGLError(GL_INVALID_VALUE
, "glUniformMatrix4x2fv", "count < 0");
2571 if (transpose
!= false) {
2572 SetGLError(GL_INVALID_VALUE
, "glUniformMatrix4x2fv",
2573 "transpose GL_INVALID_VALUE");
2576 helper_
->UniformMatrix4x2fvImmediate(location
, count
, value
);
2580 void GLES2Implementation::UniformMatrix4x3fv(GLint location
,
2582 GLboolean transpose
,
2583 const GLfloat
* value
) {
2584 GPU_CLIENT_SINGLE_THREAD_CHECK();
2585 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniformMatrix4x3fv(" << location
2586 << ", " << count
<< ", "
2587 << GLES2Util::GetStringBool(transpose
) << ", "
2588 << static_cast<const void*>(value
) << ")");
2589 GPU_CLIENT_LOG_CODE_BLOCK({
2590 for (GLsizei i
= 0; i
< count
; ++i
) {
2592 " " << i
<< ": " << value
[0 + i
* 12] << ", " << value
[1 + i
* 12]
2593 << ", " << value
[2 + i
* 12] << ", " << value
[3 + i
* 12] << ", "
2594 << value
[4 + i
* 12] << ", " << value
[5 + i
* 12] << ", "
2595 << value
[6 + i
* 12] << ", " << value
[7 + i
* 12] << ", "
2596 << value
[8 + i
* 12] << ", " << value
[9 + i
* 12] << ", "
2597 << value
[10 + i
* 12] << ", " << value
[11 + i
* 12]);
2601 SetGLError(GL_INVALID_VALUE
, "glUniformMatrix4x3fv", "count < 0");
2604 if (transpose
!= false) {
2605 SetGLError(GL_INVALID_VALUE
, "glUniformMatrix4x3fv",
2606 "transpose GL_INVALID_VALUE");
2609 helper_
->UniformMatrix4x3fvImmediate(location
, count
, value
);
2613 void GLES2Implementation::UseProgram(GLuint program
) {
2614 GPU_CLIENT_SINGLE_THREAD_CHECK();
2615 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUseProgram(" << program
<< ")");
2616 if (IsProgramReservedId(program
)) {
2617 SetGLError(GL_INVALID_OPERATION
, "UseProgram", "program reserved id");
2620 UseProgramHelper(program
);
2624 void GLES2Implementation::ValidateProgram(GLuint program
) {
2625 GPU_CLIENT_SINGLE_THREAD_CHECK();
2626 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glValidateProgram(" << program
2628 helper_
->ValidateProgram(program
);
2632 void GLES2Implementation::VertexAttrib1f(GLuint indx
, GLfloat x
) {
2633 GPU_CLIENT_SINGLE_THREAD_CHECK();
2634 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glVertexAttrib1f(" << indx
<< ", "
2636 helper_
->VertexAttrib1f(indx
, x
);
2640 void GLES2Implementation::VertexAttrib1fv(GLuint indx
, const GLfloat
* values
) {
2641 GPU_CLIENT_SINGLE_THREAD_CHECK();
2642 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glVertexAttrib1fv(" << indx
<< ", "
2643 << static_cast<const void*>(values
) << ")");
2645 for (size_t ii
= 0; ii
< count
; ++ii
)
2646 GPU_CLIENT_LOG("value[" << ii
<< "]: " << values
[ii
]);
2647 helper_
->VertexAttrib1fvImmediate(indx
, values
);
2651 void GLES2Implementation::VertexAttrib2f(GLuint indx
, GLfloat x
, GLfloat y
) {
2652 GPU_CLIENT_SINGLE_THREAD_CHECK();
2653 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glVertexAttrib2f(" << indx
<< ", "
2654 << x
<< ", " << y
<< ")");
2655 helper_
->VertexAttrib2f(indx
, x
, y
);
2659 void GLES2Implementation::VertexAttrib2fv(GLuint indx
, const GLfloat
* values
) {
2660 GPU_CLIENT_SINGLE_THREAD_CHECK();
2661 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glVertexAttrib2fv(" << indx
<< ", "
2662 << static_cast<const void*>(values
) << ")");
2664 for (size_t ii
= 0; ii
< count
; ++ii
)
2665 GPU_CLIENT_LOG("value[" << ii
<< "]: " << values
[ii
]);
2666 helper_
->VertexAttrib2fvImmediate(indx
, values
);
2670 void GLES2Implementation::VertexAttrib3f(GLuint indx
,
2674 GPU_CLIENT_SINGLE_THREAD_CHECK();
2675 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glVertexAttrib3f(" << indx
<< ", "
2676 << x
<< ", " << y
<< ", " << z
<< ")");
2677 helper_
->VertexAttrib3f(indx
, x
, y
, z
);
2681 void GLES2Implementation::VertexAttrib3fv(GLuint indx
, const GLfloat
* values
) {
2682 GPU_CLIENT_SINGLE_THREAD_CHECK();
2683 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glVertexAttrib3fv(" << indx
<< ", "
2684 << static_cast<const void*>(values
) << ")");
2686 for (size_t ii
= 0; ii
< count
; ++ii
)
2687 GPU_CLIENT_LOG("value[" << ii
<< "]: " << values
[ii
]);
2688 helper_
->VertexAttrib3fvImmediate(indx
, values
);
2692 void GLES2Implementation::VertexAttrib4f(GLuint indx
,
2697 GPU_CLIENT_SINGLE_THREAD_CHECK();
2698 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glVertexAttrib4f(" << indx
<< ", "
2699 << x
<< ", " << y
<< ", " << z
<< ", " << w
<< ")");
2700 helper_
->VertexAttrib4f(indx
, x
, y
, z
, w
);
2704 void GLES2Implementation::VertexAttrib4fv(GLuint indx
, const GLfloat
* values
) {
2705 GPU_CLIENT_SINGLE_THREAD_CHECK();
2706 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glVertexAttrib4fv(" << indx
<< ", "
2707 << static_cast<const void*>(values
) << ")");
2709 for (size_t ii
= 0; ii
< count
; ++ii
)
2710 GPU_CLIENT_LOG("value[" << ii
<< "]: " << values
[ii
]);
2711 helper_
->VertexAttrib4fvImmediate(indx
, values
);
2715 void GLES2Implementation::VertexAttribI4i(GLuint indx
,
2720 GPU_CLIENT_SINGLE_THREAD_CHECK();
2721 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glVertexAttribI4i(" << indx
<< ", "
2722 << x
<< ", " << y
<< ", " << z
<< ", " << w
<< ")");
2723 helper_
->VertexAttribI4i(indx
, x
, y
, z
, w
);
2727 void GLES2Implementation::VertexAttribI4iv(GLuint indx
, const GLint
* values
) {
2728 GPU_CLIENT_SINGLE_THREAD_CHECK();
2729 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glVertexAttribI4iv(" << indx
2730 << ", " << static_cast<const void*>(values
) << ")");
2732 for (size_t ii
= 0; ii
< count
; ++ii
)
2733 GPU_CLIENT_LOG("value[" << ii
<< "]: " << values
[ii
]);
2734 helper_
->VertexAttribI4ivImmediate(indx
, values
);
2738 void GLES2Implementation::VertexAttribI4ui(GLuint indx
,
2743 GPU_CLIENT_SINGLE_THREAD_CHECK();
2744 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glVertexAttribI4ui(" << indx
2745 << ", " << x
<< ", " << y
<< ", " << z
<< ", " << w
2747 helper_
->VertexAttribI4ui(indx
, x
, y
, z
, w
);
2751 void GLES2Implementation::VertexAttribI4uiv(GLuint indx
, const GLuint
* values
) {
2752 GPU_CLIENT_SINGLE_THREAD_CHECK();
2753 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glVertexAttribI4uiv(" << indx
2754 << ", " << static_cast<const void*>(values
) << ")");
2756 for (size_t ii
= 0; ii
< count
; ++ii
)
2757 GPU_CLIENT_LOG("value[" << ii
<< "]: " << values
[ii
]);
2758 helper_
->VertexAttribI4uivImmediate(indx
, values
);
2762 void GLES2Implementation::Viewport(GLint x
,
2766 GPU_CLIENT_SINGLE_THREAD_CHECK();
2767 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glViewport(" << x
<< ", " << y
2768 << ", " << width
<< ", " << height
<< ")");
2770 SetGLError(GL_INVALID_VALUE
, "glViewport", "width < 0");
2774 SetGLError(GL_INVALID_VALUE
, "glViewport", "height < 0");
2777 helper_
->Viewport(x
, y
, width
, height
);
2781 void GLES2Implementation::BlitFramebufferCHROMIUM(GLint srcX0
,
2791 GPU_CLIENT_SINGLE_THREAD_CHECK();
2792 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBlitFramebufferCHROMIUM("
2793 << srcX0
<< ", " << srcY0
<< ", " << srcX1
<< ", " << srcY1
2794 << ", " << dstX0
<< ", " << dstY0
<< ", " << dstX1
<< ", "
2795 << dstY1
<< ", " << mask
<< ", "
2796 << GLES2Util::GetStringBlitFilter(filter
) << ")");
2797 helper_
->BlitFramebufferCHROMIUM(srcX0
, srcY0
, srcX1
, srcY1
, dstX0
, dstY0
,
2798 dstX1
, dstY1
, mask
, filter
);
2802 void GLES2Implementation::RenderbufferStorageMultisampleCHROMIUM(
2805 GLenum internalformat
,
2808 GPU_CLIENT_SINGLE_THREAD_CHECK();
2810 "[" << GetLogPrefix() << "] glRenderbufferStorageMultisampleCHROMIUM("
2811 << GLES2Util::GetStringRenderBufferTarget(target
) << ", " << samples
2812 << ", " << GLES2Util::GetStringRenderBufferFormat(internalformat
)
2813 << ", " << width
<< ", " << height
<< ")");
2815 SetGLError(GL_INVALID_VALUE
, "glRenderbufferStorageMultisampleCHROMIUM",
2820 SetGLError(GL_INVALID_VALUE
, "glRenderbufferStorageMultisampleCHROMIUM",
2825 SetGLError(GL_INVALID_VALUE
, "glRenderbufferStorageMultisampleCHROMIUM",
2829 helper_
->RenderbufferStorageMultisampleCHROMIUM(
2830 target
, samples
, internalformat
, width
, height
);
2834 void GLES2Implementation::RenderbufferStorageMultisampleEXT(
2837 GLenum internalformat
,
2840 GPU_CLIENT_SINGLE_THREAD_CHECK();
2842 "[" << GetLogPrefix() << "] glRenderbufferStorageMultisampleEXT("
2843 << GLES2Util::GetStringRenderBufferTarget(target
) << ", " << samples
2844 << ", " << GLES2Util::GetStringRenderBufferFormat(internalformat
)
2845 << ", " << width
<< ", " << height
<< ")");
2847 SetGLError(GL_INVALID_VALUE
, "glRenderbufferStorageMultisampleEXT",
2852 SetGLError(GL_INVALID_VALUE
, "glRenderbufferStorageMultisampleEXT",
2857 SetGLError(GL_INVALID_VALUE
, "glRenderbufferStorageMultisampleEXT",
2861 helper_
->RenderbufferStorageMultisampleEXT(target
, samples
, internalformat
,
2866 void GLES2Implementation::FramebufferTexture2DMultisampleEXT(GLenum target
,
2872 GPU_CLIENT_SINGLE_THREAD_CHECK();
2873 GPU_CLIENT_LOG("[" << GetLogPrefix()
2874 << "] glFramebufferTexture2DMultisampleEXT("
2875 << GLES2Util::GetStringFrameBufferTarget(target
) << ", "
2876 << GLES2Util::GetStringAttachment(attachment
) << ", "
2877 << GLES2Util::GetStringTextureTarget(textarget
) << ", "
2878 << texture
<< ", " << level
<< ", " << samples
<< ")");
2880 SetGLError(GL_INVALID_VALUE
, "glFramebufferTexture2DMultisampleEXT",
2881 "level GL_INVALID_VALUE");
2885 SetGLError(GL_INVALID_VALUE
, "glFramebufferTexture2DMultisampleEXT",
2889 helper_
->FramebufferTexture2DMultisampleEXT(target
, attachment
, textarget
,
2894 void GLES2Implementation::TexStorage2DEXT(GLenum target
,
2896 GLenum internalFormat
,
2899 GPU_CLIENT_SINGLE_THREAD_CHECK();
2901 "[" << GetLogPrefix() << "] glTexStorage2DEXT("
2902 << GLES2Util::GetStringTextureTarget(target
) << ", " << levels
<< ", "
2903 << GLES2Util::GetStringTextureInternalFormatStorage(internalFormat
)
2904 << ", " << width
<< ", " << height
<< ")");
2906 SetGLError(GL_INVALID_VALUE
, "glTexStorage2DEXT", "levels < 0");
2910 SetGLError(GL_INVALID_VALUE
, "glTexStorage2DEXT", "width < 0");
2914 SetGLError(GL_INVALID_VALUE
, "glTexStorage2DEXT", "height < 0");
2917 helper_
->TexStorage2DEXT(target
, levels
, internalFormat
, width
, height
);
2921 void GLES2Implementation::GenQueriesEXT(GLsizei n
, GLuint
* queries
) {
2922 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGenQueriesEXT(" << n
<< ", "
2923 << static_cast<const void*>(queries
) << ")");
2925 SetGLError(GL_INVALID_VALUE
, "glGenQueriesEXT", "n < 0");
2928 GPU_CLIENT_SINGLE_THREAD_CHECK();
2929 IdAllocator
* id_allocator
= GetIdAllocator(id_namespaces::kQueries
);
2930 for (GLsizei ii
= 0; ii
< n
; ++ii
)
2931 queries
[ii
] = id_allocator
->AllocateID();
2932 GenQueriesEXTHelper(n
, queries
);
2933 helper_
->GenQueriesEXTImmediate(n
, queries
);
2934 if (share_group_
->bind_generates_resource())
2935 helper_
->CommandBufferHelper::Flush();
2936 GPU_CLIENT_LOG_CODE_BLOCK({
2937 for (GLsizei i
= 0; i
< n
; ++i
) {
2938 GPU_CLIENT_LOG(" " << i
<< ": " << queries
[i
]);
2944 void GLES2Implementation::DeleteQueriesEXT(GLsizei n
, const GLuint
* queries
) {
2945 GPU_CLIENT_SINGLE_THREAD_CHECK();
2946 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDeleteQueriesEXT(" << n
<< ", "
2947 << static_cast<const void*>(queries
) << ")");
2948 GPU_CLIENT_LOG_CODE_BLOCK({
2949 for (GLsizei i
= 0; i
< n
; ++i
) {
2950 GPU_CLIENT_LOG(" " << i
<< ": " << queries
[i
]);
2953 GPU_CLIENT_DCHECK_CODE_BLOCK({
2954 for (GLsizei i
= 0; i
< n
; ++i
) {
2955 DCHECK(queries
[i
] != 0);
2959 SetGLError(GL_INVALID_VALUE
, "glDeleteQueriesEXT", "n < 0");
2962 DeleteQueriesEXTHelper(n
, queries
);
2966 void GLES2Implementation::BeginTransformFeedback(GLenum primitivemode
) {
2967 GPU_CLIENT_SINGLE_THREAD_CHECK();
2968 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBeginTransformFeedback("
2969 << GLES2Util::GetStringTransformFeedbackPrimitiveMode(
2970 primitivemode
) << ")");
2971 helper_
->BeginTransformFeedback(primitivemode
);
2975 void GLES2Implementation::EndTransformFeedback() {
2976 GPU_CLIENT_SINGLE_THREAD_CHECK();
2977 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glEndTransformFeedback("
2979 helper_
->EndTransformFeedback();
2983 void GLES2Implementation::GenVertexArraysOES(GLsizei n
, GLuint
* arrays
) {
2984 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGenVertexArraysOES(" << n
<< ", "
2985 << static_cast<const void*>(arrays
) << ")");
2987 SetGLError(GL_INVALID_VALUE
, "glGenVertexArraysOES", "n < 0");
2990 GPU_CLIENT_SINGLE_THREAD_CHECK();
2991 GetIdHandler(id_namespaces::kVertexArrays
)->MakeIds(this, 0, n
, arrays
);
2992 GenVertexArraysOESHelper(n
, arrays
);
2993 helper_
->GenVertexArraysOESImmediate(n
, arrays
);
2994 if (share_group_
->bind_generates_resource())
2995 helper_
->CommandBufferHelper::Flush();
2996 GPU_CLIENT_LOG_CODE_BLOCK({
2997 for (GLsizei i
= 0; i
< n
; ++i
) {
2998 GPU_CLIENT_LOG(" " << i
<< ": " << arrays
[i
]);
3004 void GLES2Implementation::DeleteVertexArraysOES(GLsizei n
,
3005 const GLuint
* arrays
) {
3006 GPU_CLIENT_SINGLE_THREAD_CHECK();
3007 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDeleteVertexArraysOES(" << n
3008 << ", " << static_cast<const void*>(arrays
) << ")");
3009 GPU_CLIENT_LOG_CODE_BLOCK({
3010 for (GLsizei i
= 0; i
< n
; ++i
) {
3011 GPU_CLIENT_LOG(" " << i
<< ": " << arrays
[i
]);
3014 GPU_CLIENT_DCHECK_CODE_BLOCK({
3015 for (GLsizei i
= 0; i
< n
; ++i
) {
3016 DCHECK(arrays
[i
] != 0);
3020 SetGLError(GL_INVALID_VALUE
, "glDeleteVertexArraysOES", "n < 0");
3023 DeleteVertexArraysOESHelper(n
, arrays
);
3027 GLboolean
GLES2Implementation::IsVertexArrayOES(GLuint array
) {
3028 GPU_CLIENT_SINGLE_THREAD_CHECK();
3029 TRACE_EVENT0("gpu", "GLES2Implementation::IsVertexArrayOES");
3030 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glIsVertexArrayOES(" << array
3032 typedef cmds::IsVertexArrayOES::Result Result
;
3033 Result
* result
= GetResultAs
<Result
*>();
3038 helper_
->IsVertexArrayOES(array
, GetResultShmId(), GetResultShmOffset());
3040 GLboolean result_value
= *result
!= 0;
3041 GPU_CLIENT_LOG("returned " << result_value
);
3043 return result_value
;
3046 void GLES2Implementation::BindVertexArrayOES(GLuint array
) {
3047 GPU_CLIENT_SINGLE_THREAD_CHECK();
3048 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBindVertexArrayOES(" << array
3050 if (IsVertexArrayReservedId(array
)) {
3051 SetGLError(GL_INVALID_OPERATION
, "BindVertexArrayOES", "array reserved id");
3054 BindVertexArrayOESHelper(array
);
3058 void GLES2Implementation::GetTranslatedShaderSourceANGLE(GLuint shader
,
3062 GPU_CLIENT_SINGLE_THREAD_CHECK();
3063 GPU_CLIENT_VALIDATE_DESTINATION_OPTIONAL_INITALIZATION(GLsizei
, length
);
3064 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetTranslatedShaderSourceANGLE"
3065 << "(" << shader
<< ", " << bufsize
<< ", "
3066 << static_cast<void*>(length
) << ", "
3067 << static_cast<void*>(source
) << ")");
3068 helper_
->SetBucketSize(kResultBucketId
, 0);
3069 helper_
->GetTranslatedShaderSourceANGLE(shader
, kResultBucketId
);
3071 GLsizei max_size
= 0;
3072 if (GetBucketAsString(kResultBucketId
, &str
)) {
3074 max_size
= std::min(static_cast<size_t>(bufsize
) - 1, str
.size());
3075 memcpy(source
, str
.c_str(), max_size
);
3076 source
[max_size
] = '\0';
3077 GPU_CLIENT_LOG("------\n" << source
<< "\n------");
3080 if (length
!= NULL
) {
3085 void GLES2Implementation::TexImageIOSurface2DCHROMIUM(GLenum target
,
3090 GPU_CLIENT_SINGLE_THREAD_CHECK();
3091 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glTexImageIOSurface2DCHROMIUM("
3092 << GLES2Util::GetStringTextureBindTarget(target
) << ", "
3093 << width
<< ", " << height
<< ", " << ioSurfaceId
<< ", "
3096 SetGLError(GL_INVALID_VALUE
, "glTexImageIOSurface2DCHROMIUM", "width < 0");
3100 SetGLError(GL_INVALID_VALUE
, "glTexImageIOSurface2DCHROMIUM", "height < 0");
3103 helper_
->TexImageIOSurface2DCHROMIUM(target
, width
, height
, ioSurfaceId
,
3108 void GLES2Implementation::CopyTextureCHROMIUM(GLenum target
,
3111 GLint internalformat
,
3113 GPU_CLIENT_SINGLE_THREAD_CHECK();
3114 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glCopyTextureCHROMIUM("
3115 << GLES2Util::GetStringEnum(target
) << ", "
3116 << GLES2Util::GetStringEnum(source_id
) << ", "
3117 << GLES2Util::GetStringEnum(dest_id
) << ", "
3118 << internalformat
<< ", "
3119 << GLES2Util::GetStringPixelType(dest_type
) << ")");
3120 helper_
->CopyTextureCHROMIUM(target
, source_id
, dest_id
, internalformat
,
3125 void GLES2Implementation::CopySubTextureCHROMIUM(GLenum target
,
3130 GPU_CLIENT_SINGLE_THREAD_CHECK();
3131 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glCopySubTextureCHROMIUM("
3132 << GLES2Util::GetStringEnum(target
) << ", "
3133 << GLES2Util::GetStringEnum(source_id
) << ", "
3134 << GLES2Util::GetStringEnum(dest_id
) << ", " << xoffset
3135 << ", " << yoffset
<< ")");
3136 helper_
->CopySubTextureCHROMIUM(target
, source_id
, dest_id
, xoffset
, yoffset
);
3140 void GLES2Implementation::GenValuebuffersCHROMIUM(GLsizei n
, GLuint
* buffers
) {
3141 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGenValuebuffersCHROMIUM(" << n
3142 << ", " << static_cast<const void*>(buffers
) << ")");
3144 SetGLError(GL_INVALID_VALUE
, "glGenValuebuffersCHROMIUM", "n < 0");
3147 GPU_CLIENT_SINGLE_THREAD_CHECK();
3148 GetIdHandler(id_namespaces::kValuebuffers
)->MakeIds(this, 0, n
, buffers
);
3149 GenValuebuffersCHROMIUMHelper(n
, buffers
);
3150 helper_
->GenValuebuffersCHROMIUMImmediate(n
, buffers
);
3151 if (share_group_
->bind_generates_resource())
3152 helper_
->CommandBufferHelper::Flush();
3153 GPU_CLIENT_LOG_CODE_BLOCK({
3154 for (GLsizei i
= 0; i
< n
; ++i
) {
3155 GPU_CLIENT_LOG(" " << i
<< ": " << buffers
[i
]);
3161 void GLES2Implementation::DeleteValuebuffersCHROMIUM(
3163 const GLuint
* valuebuffers
) {
3164 GPU_CLIENT_SINGLE_THREAD_CHECK();
3165 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDeleteValuebuffersCHROMIUM(" << n
3166 << ", " << static_cast<const void*>(valuebuffers
) << ")");
3167 GPU_CLIENT_LOG_CODE_BLOCK({
3168 for (GLsizei i
= 0; i
< n
; ++i
) {
3169 GPU_CLIENT_LOG(" " << i
<< ": " << valuebuffers
[i
]);
3172 GPU_CLIENT_DCHECK_CODE_BLOCK({
3173 for (GLsizei i
= 0; i
< n
; ++i
) {
3174 DCHECK(valuebuffers
[i
] != 0);
3178 SetGLError(GL_INVALID_VALUE
, "glDeleteValuebuffersCHROMIUM", "n < 0");
3181 DeleteValuebuffersCHROMIUMHelper(n
, valuebuffers
);
3185 GLboolean
GLES2Implementation::IsValuebufferCHROMIUM(GLuint valuebuffer
) {
3186 GPU_CLIENT_SINGLE_THREAD_CHECK();
3187 TRACE_EVENT0("gpu", "GLES2Implementation::IsValuebufferCHROMIUM");
3188 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glIsValuebufferCHROMIUM("
3189 << valuebuffer
<< ")");
3190 typedef cmds::IsValuebufferCHROMIUM::Result Result
;
3191 Result
* result
= GetResultAs
<Result
*>();
3196 helper_
->IsValuebufferCHROMIUM(valuebuffer
, GetResultShmId(),
3197 GetResultShmOffset());
3199 GLboolean result_value
= *result
!= 0;
3200 GPU_CLIENT_LOG("returned " << result_value
);
3202 return result_value
;
3205 void GLES2Implementation::BindValuebufferCHROMIUM(GLenum target
,
3206 GLuint valuebuffer
) {
3207 GPU_CLIENT_SINGLE_THREAD_CHECK();
3208 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBindValuebufferCHROMIUM("
3209 << GLES2Util::GetStringValueBufferTarget(target
) << ", "
3210 << valuebuffer
<< ")");
3211 if (IsValuebufferReservedId(valuebuffer
)) {
3212 SetGLError(GL_INVALID_OPERATION
, "BindValuebufferCHROMIUM",
3213 "valuebuffer reserved id");
3216 BindValuebufferCHROMIUMHelper(target
, valuebuffer
);
3220 void GLES2Implementation::SubscribeValueCHROMIUM(GLenum target
,
3221 GLenum subscription
) {
3222 GPU_CLIENT_SINGLE_THREAD_CHECK();
3223 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glSubscribeValueCHROMIUM("
3224 << GLES2Util::GetStringValueBufferTarget(target
) << ", "
3225 << GLES2Util::GetStringSubscriptionTarget(subscription
)
3227 helper_
->SubscribeValueCHROMIUM(target
, subscription
);
3231 void GLES2Implementation::PopulateSubscribedValuesCHROMIUM(GLenum target
) {
3232 GPU_CLIENT_SINGLE_THREAD_CHECK();
3233 GPU_CLIENT_LOG("[" << GetLogPrefix()
3234 << "] glPopulateSubscribedValuesCHROMIUM("
3235 << GLES2Util::GetStringValueBufferTarget(target
) << ")");
3236 helper_
->PopulateSubscribedValuesCHROMIUM(target
);
3240 void GLES2Implementation::UniformValuebufferCHROMIUM(GLint location
,
3242 GLenum subscription
) {
3243 GPU_CLIENT_SINGLE_THREAD_CHECK();
3245 "[" << GetLogPrefix() << "] glUniformValuebufferCHROMIUM(" << location
3246 << ", " << GLES2Util::GetStringValueBufferTarget(target
) << ", "
3247 << GLES2Util::GetStringSubscriptionTarget(subscription
) << ")");
3248 helper_
->UniformValuebufferCHROMIUM(location
, target
, subscription
);
3252 void GLES2Implementation::BindTexImage2DCHROMIUM(GLenum target
, GLint imageId
) {
3253 GPU_CLIENT_SINGLE_THREAD_CHECK();
3254 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBindTexImage2DCHROMIUM("
3255 << GLES2Util::GetStringTextureBindTarget(target
) << ", "
3257 helper_
->BindTexImage2DCHROMIUM(target
, imageId
);
3261 void GLES2Implementation::ReleaseTexImage2DCHROMIUM(GLenum target
,
3263 GPU_CLIENT_SINGLE_THREAD_CHECK();
3264 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glReleaseTexImage2DCHROMIUM("
3265 << GLES2Util::GetStringTextureBindTarget(target
) << ", "
3267 helper_
->ReleaseTexImage2DCHROMIUM(target
, imageId
);
3271 void GLES2Implementation::DiscardFramebufferEXT(GLenum target
,
3273 const GLenum
* attachments
) {
3274 GPU_CLIENT_SINGLE_THREAD_CHECK();
3275 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDiscardFramebufferEXT("
3276 << GLES2Util::GetStringEnum(target
) << ", " << count
3277 << ", " << static_cast<const void*>(attachments
) << ")");
3278 GPU_CLIENT_LOG_CODE_BLOCK({
3279 for (GLsizei i
= 0; i
< count
; ++i
) {
3280 GPU_CLIENT_LOG(" " << i
<< ": " << attachments
[0 + i
* 1]);
3284 SetGLError(GL_INVALID_VALUE
, "glDiscardFramebufferEXT", "count < 0");
3287 helper_
->DiscardFramebufferEXTImmediate(target
, count
, attachments
);
3291 void GLES2Implementation::LoseContextCHROMIUM(GLenum current
, GLenum other
) {
3292 GPU_CLIENT_SINGLE_THREAD_CHECK();
3293 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glLoseContextCHROMIUM("
3294 << GLES2Util::GetStringResetStatus(current
) << ", "
3295 << GLES2Util::GetStringResetStatus(other
) << ")");
3296 helper_
->LoseContextCHROMIUM(current
, other
);
3300 void GLES2Implementation::WaitSyncPointCHROMIUM(GLuint sync_point
) {
3301 GPU_CLIENT_SINGLE_THREAD_CHECK();
3302 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glWaitSyncPointCHROMIUM("
3303 << sync_point
<< ")");
3304 helper_
->WaitSyncPointCHROMIUM(sync_point
);
3308 void GLES2Implementation::DrawBuffersEXT(GLsizei count
, const GLenum
* bufs
) {
3309 GPU_CLIENT_SINGLE_THREAD_CHECK();
3310 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDrawBuffersEXT(" << count
<< ", "
3311 << static_cast<const void*>(bufs
) << ")");
3312 GPU_CLIENT_LOG_CODE_BLOCK({
3313 for (GLsizei i
= 0; i
< count
; ++i
) {
3314 GPU_CLIENT_LOG(" " << i
<< ": " << bufs
[0 + i
* 1]);
3318 SetGLError(GL_INVALID_VALUE
, "glDrawBuffersEXT", "count < 0");
3321 helper_
->DrawBuffersEXTImmediate(count
, bufs
);
3325 void GLES2Implementation::DiscardBackbufferCHROMIUM() {
3326 GPU_CLIENT_SINGLE_THREAD_CHECK();
3327 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDiscardBackbufferCHROMIUM("
3329 helper_
->DiscardBackbufferCHROMIUM();
3333 void GLES2Implementation::ScheduleOverlayPlaneCHROMIUM(
3334 GLint plane_z_order
,
3335 GLenum plane_transform
,
3336 GLuint overlay_texture_id
,
3340 GLint bounds_height
,
3344 GLfloat uv_height
) {
3345 GPU_CLIENT_SINGLE_THREAD_CHECK();
3347 "[" << GetLogPrefix() << "] glScheduleOverlayPlaneCHROMIUM("
3348 << plane_z_order
<< ", " << GLES2Util::GetStringEnum(plane_transform
)
3349 << ", " << overlay_texture_id
<< ", " << bounds_x
<< ", " << bounds_y
3350 << ", " << bounds_width
<< ", " << bounds_height
<< ", " << uv_x
3351 << ", " << uv_y
<< ", " << uv_width
<< ", " << uv_height
<< ")");
3352 helper_
->ScheduleOverlayPlaneCHROMIUM(
3353 plane_z_order
, plane_transform
, overlay_texture_id
, bounds_x
, bounds_y
,
3354 bounds_width
, bounds_height
, uv_x
, uv_y
, uv_width
, uv_height
);
3358 void GLES2Implementation::MatrixLoadfCHROMIUM(GLenum matrixMode
,
3360 GPU_CLIENT_SINGLE_THREAD_CHECK();
3361 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glMatrixLoadfCHROMIUM("
3362 << GLES2Util::GetStringMatrixMode(matrixMode
) << ", "
3363 << static_cast<const void*>(m
) << ")");
3365 for (size_t ii
= 0; ii
< count
; ++ii
)
3366 GPU_CLIENT_LOG("value[" << ii
<< "]: " << m
[ii
]);
3367 helper_
->MatrixLoadfCHROMIUMImmediate(matrixMode
, m
);
3371 void GLES2Implementation::MatrixLoadIdentityCHROMIUM(GLenum matrixMode
) {
3372 GPU_CLIENT_SINGLE_THREAD_CHECK();
3373 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glMatrixLoadIdentityCHROMIUM("
3374 << GLES2Util::GetStringMatrixMode(matrixMode
) << ")");
3375 helper_
->MatrixLoadIdentityCHROMIUM(matrixMode
);
3379 void GLES2Implementation::BlendBarrierKHR() {
3380 GPU_CLIENT_SINGLE_THREAD_CHECK();
3381 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBlendBarrierKHR("
3383 helper_
->BlendBarrierKHR();
3387 #endif // GPU_COMMAND_BUFFER_CLIENT_GLES2_IMPLEMENTATION_IMPL_AUTOGEN_H_