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::GetTexParameterfv(GLenum target
,
1292 GPU_CLIENT_SINGLE_THREAD_CHECK();
1293 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetTexParameterfv("
1294 << GLES2Util::GetStringGetTexParamTarget(target
) << ", "
1295 << GLES2Util::GetStringTextureParameter(pname
) << ", "
1296 << static_cast<const void*>(params
) << ")");
1297 TRACE_EVENT0("gpu", "GLES2Implementation::GetTexParameterfv");
1298 if (GetTexParameterfvHelper(target
, pname
, params
)) {
1301 typedef cmds::GetTexParameterfv::Result Result
;
1302 Result
* result
= GetResultAs
<Result
*>();
1306 result
->SetNumResults(0);
1307 helper_
->GetTexParameterfv(target
, pname
, GetResultShmId(),
1308 GetResultShmOffset());
1310 result
->CopyResult(params
);
1311 GPU_CLIENT_LOG_CODE_BLOCK({
1312 for (int32_t i
= 0; i
< result
->GetNumResults(); ++i
) {
1313 GPU_CLIENT_LOG(" " << i
<< ": " << result
->GetData()[i
]);
1318 void GLES2Implementation::GetTexParameteriv(GLenum target
,
1321 GPU_CLIENT_SINGLE_THREAD_CHECK();
1322 GPU_CLIENT_VALIDATE_DESTINATION_INITALIZATION(GLint
, params
);
1323 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetTexParameteriv("
1324 << GLES2Util::GetStringGetTexParamTarget(target
) << ", "
1325 << GLES2Util::GetStringTextureParameter(pname
) << ", "
1326 << static_cast<const void*>(params
) << ")");
1327 TRACE_EVENT0("gpu", "GLES2Implementation::GetTexParameteriv");
1328 if (GetTexParameterivHelper(target
, pname
, params
)) {
1331 typedef cmds::GetTexParameteriv::Result Result
;
1332 Result
* result
= GetResultAs
<Result
*>();
1336 result
->SetNumResults(0);
1337 helper_
->GetTexParameteriv(target
, pname
, GetResultShmId(),
1338 GetResultShmOffset());
1340 result
->CopyResult(params
);
1341 GPU_CLIENT_LOG_CODE_BLOCK({
1342 for (int32_t i
= 0; i
< result
->GetNumResults(); ++i
) {
1343 GPU_CLIENT_LOG(" " << i
<< ": " << result
->GetData()[i
]);
1348 void GLES2Implementation::Hint(GLenum target
, GLenum mode
) {
1349 GPU_CLIENT_SINGLE_THREAD_CHECK();
1350 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glHint("
1351 << GLES2Util::GetStringHintTarget(target
) << ", "
1352 << GLES2Util::GetStringHintMode(mode
) << ")");
1353 helper_
->Hint(target
, mode
);
1357 void GLES2Implementation::InvalidateFramebuffer(GLenum target
,
1359 const GLenum
* attachments
) {
1360 GPU_CLIENT_SINGLE_THREAD_CHECK();
1361 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glInvalidateFramebuffer("
1362 << GLES2Util::GetStringFrameBufferTarget(target
) << ", "
1363 << count
<< ", " << static_cast<const void*>(attachments
)
1365 GPU_CLIENT_LOG_CODE_BLOCK({
1366 for (GLsizei i
= 0; i
< count
; ++i
) {
1367 GPU_CLIENT_LOG(" " << i
<< ": " << attachments
[0 + i
* 1]);
1371 SetGLError(GL_INVALID_VALUE
, "glInvalidateFramebuffer", "count < 0");
1374 helper_
->InvalidateFramebufferImmediate(target
, count
, attachments
);
1378 void GLES2Implementation::InvalidateSubFramebuffer(GLenum target
,
1380 const GLenum
* attachments
,
1385 GPU_CLIENT_SINGLE_THREAD_CHECK();
1386 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glInvalidateSubFramebuffer("
1387 << GLES2Util::GetStringFrameBufferTarget(target
) << ", "
1388 << count
<< ", " << static_cast<const void*>(attachments
)
1389 << ", " << x
<< ", " << y
<< ", " << width
<< ", "
1391 GPU_CLIENT_LOG_CODE_BLOCK({
1392 for (GLsizei i
= 0; i
< count
; ++i
) {
1393 GPU_CLIENT_LOG(" " << i
<< ": " << attachments
[0 + i
* 1]);
1397 SetGLError(GL_INVALID_VALUE
, "glInvalidateSubFramebuffer", "count < 0");
1401 SetGLError(GL_INVALID_VALUE
, "glInvalidateSubFramebuffer", "width < 0");
1405 SetGLError(GL_INVALID_VALUE
, "glInvalidateSubFramebuffer", "height < 0");
1408 helper_
->InvalidateSubFramebufferImmediate(target
, count
, attachments
, x
, y
,
1413 GLboolean
GLES2Implementation::IsBuffer(GLuint buffer
) {
1414 GPU_CLIENT_SINGLE_THREAD_CHECK();
1415 TRACE_EVENT0("gpu", "GLES2Implementation::IsBuffer");
1416 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glIsBuffer(" << buffer
<< ")");
1417 typedef cmds::IsBuffer::Result Result
;
1418 Result
* result
= GetResultAs
<Result
*>();
1423 helper_
->IsBuffer(buffer
, GetResultShmId(), GetResultShmOffset());
1425 GLboolean result_value
= *result
!= 0;
1426 GPU_CLIENT_LOG("returned " << result_value
);
1428 return result_value
;
1431 GLboolean
GLES2Implementation::IsFramebuffer(GLuint framebuffer
) {
1432 GPU_CLIENT_SINGLE_THREAD_CHECK();
1433 TRACE_EVENT0("gpu", "GLES2Implementation::IsFramebuffer");
1434 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glIsFramebuffer(" << framebuffer
1436 typedef cmds::IsFramebuffer::Result Result
;
1437 Result
* result
= GetResultAs
<Result
*>();
1442 helper_
->IsFramebuffer(framebuffer
, GetResultShmId(), GetResultShmOffset());
1444 GLboolean result_value
= *result
!= 0;
1445 GPU_CLIENT_LOG("returned " << result_value
);
1447 return result_value
;
1450 GLboolean
GLES2Implementation::IsProgram(GLuint program
) {
1451 GPU_CLIENT_SINGLE_THREAD_CHECK();
1452 TRACE_EVENT0("gpu", "GLES2Implementation::IsProgram");
1453 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glIsProgram(" << program
<< ")");
1454 typedef cmds::IsProgram::Result Result
;
1455 Result
* result
= GetResultAs
<Result
*>();
1460 helper_
->IsProgram(program
, GetResultShmId(), GetResultShmOffset());
1462 GLboolean result_value
= *result
!= 0;
1463 GPU_CLIENT_LOG("returned " << result_value
);
1465 return result_value
;
1468 GLboolean
GLES2Implementation::IsRenderbuffer(GLuint renderbuffer
) {
1469 GPU_CLIENT_SINGLE_THREAD_CHECK();
1470 TRACE_EVENT0("gpu", "GLES2Implementation::IsRenderbuffer");
1471 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glIsRenderbuffer(" << renderbuffer
1473 typedef cmds::IsRenderbuffer::Result Result
;
1474 Result
* result
= GetResultAs
<Result
*>();
1479 helper_
->IsRenderbuffer(renderbuffer
, GetResultShmId(), GetResultShmOffset());
1481 GLboolean result_value
= *result
!= 0;
1482 GPU_CLIENT_LOG("returned " << result_value
);
1484 return result_value
;
1487 GLboolean
GLES2Implementation::IsSampler(GLuint sampler
) {
1488 GPU_CLIENT_SINGLE_THREAD_CHECK();
1489 TRACE_EVENT0("gpu", "GLES2Implementation::IsSampler");
1490 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glIsSampler(" << sampler
<< ")");
1491 typedef cmds::IsSampler::Result Result
;
1492 Result
* result
= GetResultAs
<Result
*>();
1497 helper_
->IsSampler(sampler
, GetResultShmId(), GetResultShmOffset());
1499 GLboolean result_value
= *result
!= 0;
1500 GPU_CLIENT_LOG("returned " << result_value
);
1502 return result_value
;
1505 GLboolean
GLES2Implementation::IsShader(GLuint shader
) {
1506 GPU_CLIENT_SINGLE_THREAD_CHECK();
1507 TRACE_EVENT0("gpu", "GLES2Implementation::IsShader");
1508 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glIsShader(" << shader
<< ")");
1509 typedef cmds::IsShader::Result Result
;
1510 Result
* result
= GetResultAs
<Result
*>();
1515 helper_
->IsShader(shader
, GetResultShmId(), GetResultShmOffset());
1517 GLboolean result_value
= *result
!= 0;
1518 GPU_CLIENT_LOG("returned " << result_value
);
1520 return result_value
;
1523 GLboolean
GLES2Implementation::IsSync(GLsync sync
) {
1524 GPU_CLIENT_SINGLE_THREAD_CHECK();
1525 TRACE_EVENT0("gpu", "GLES2Implementation::IsSync");
1526 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glIsSync(" << sync
<< ")");
1527 typedef cmds::IsSync::Result Result
;
1528 Result
* result
= GetResultAs
<Result
*>();
1533 helper_
->IsSync(ToGLuint(sync
), GetResultShmId(), GetResultShmOffset());
1535 GLboolean result_value
= *result
!= 0;
1536 GPU_CLIENT_LOG("returned " << result_value
);
1538 return result_value
;
1541 GLboolean
GLES2Implementation::IsTexture(GLuint texture
) {
1542 GPU_CLIENT_SINGLE_THREAD_CHECK();
1543 TRACE_EVENT0("gpu", "GLES2Implementation::IsTexture");
1544 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glIsTexture(" << texture
<< ")");
1545 typedef cmds::IsTexture::Result Result
;
1546 Result
* result
= GetResultAs
<Result
*>();
1551 helper_
->IsTexture(texture
, GetResultShmId(), GetResultShmOffset());
1553 GLboolean result_value
= *result
!= 0;
1554 GPU_CLIENT_LOG("returned " << result_value
);
1556 return result_value
;
1559 GLboolean
GLES2Implementation::IsTransformFeedback(GLuint transformfeedback
) {
1560 GPU_CLIENT_SINGLE_THREAD_CHECK();
1561 TRACE_EVENT0("gpu", "GLES2Implementation::IsTransformFeedback");
1562 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glIsTransformFeedback("
1563 << transformfeedback
<< ")");
1564 typedef cmds::IsTransformFeedback::Result Result
;
1565 Result
* result
= GetResultAs
<Result
*>();
1570 helper_
->IsTransformFeedback(transformfeedback
, GetResultShmId(),
1571 GetResultShmOffset());
1573 GLboolean result_value
= *result
!= 0;
1574 GPU_CLIENT_LOG("returned " << result_value
);
1576 return result_value
;
1579 void GLES2Implementation::LineWidth(GLfloat width
) {
1580 GPU_CLIENT_SINGLE_THREAD_CHECK();
1581 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glLineWidth(" << width
<< ")");
1582 helper_
->LineWidth(width
);
1586 void GLES2Implementation::PauseTransformFeedback() {
1587 GPU_CLIENT_SINGLE_THREAD_CHECK();
1588 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glPauseTransformFeedback("
1590 helper_
->PauseTransformFeedback();
1594 void GLES2Implementation::PolygonOffset(GLfloat factor
, GLfloat units
) {
1595 GPU_CLIENT_SINGLE_THREAD_CHECK();
1596 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glPolygonOffset(" << factor
<< ", "
1598 helper_
->PolygonOffset(factor
, units
);
1602 void GLES2Implementation::ReadBuffer(GLenum src
) {
1603 GPU_CLIENT_SINGLE_THREAD_CHECK();
1604 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glReadBuffer("
1605 << GLES2Util::GetStringEnum(src
) << ")");
1606 helper_
->ReadBuffer(src
);
1610 void GLES2Implementation::ReleaseShaderCompiler() {
1611 GPU_CLIENT_SINGLE_THREAD_CHECK();
1612 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glReleaseShaderCompiler("
1614 helper_
->ReleaseShaderCompiler();
1618 void GLES2Implementation::RenderbufferStorage(GLenum target
,
1619 GLenum internalformat
,
1622 GPU_CLIENT_SINGLE_THREAD_CHECK();
1623 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glRenderbufferStorage("
1624 << GLES2Util::GetStringRenderBufferTarget(target
) << ", "
1625 << GLES2Util::GetStringRenderBufferFormat(internalformat
)
1626 << ", " << width
<< ", " << height
<< ")");
1628 SetGLError(GL_INVALID_VALUE
, "glRenderbufferStorage", "width < 0");
1632 SetGLError(GL_INVALID_VALUE
, "glRenderbufferStorage", "height < 0");
1635 helper_
->RenderbufferStorage(target
, internalformat
, width
, height
);
1639 void GLES2Implementation::ResumeTransformFeedback() {
1640 GPU_CLIENT_SINGLE_THREAD_CHECK();
1641 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glResumeTransformFeedback("
1643 helper_
->ResumeTransformFeedback();
1647 void GLES2Implementation::SampleCoverage(GLclampf value
, GLboolean invert
) {
1648 GPU_CLIENT_SINGLE_THREAD_CHECK();
1649 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glSampleCoverage(" << value
<< ", "
1650 << GLES2Util::GetStringBool(invert
) << ")");
1651 helper_
->SampleCoverage(value
, invert
);
1655 void GLES2Implementation::SamplerParameterf(GLuint sampler
,
1658 GPU_CLIENT_SINGLE_THREAD_CHECK();
1659 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glSamplerParameterf(" << sampler
1660 << ", " << GLES2Util::GetStringSamplerParameter(pname
)
1661 << ", " << param
<< ")");
1662 helper_
->SamplerParameterf(sampler
, pname
, param
);
1666 void GLES2Implementation::SamplerParameterfv(GLuint sampler
,
1668 const GLfloat
* params
) {
1669 GPU_CLIENT_SINGLE_THREAD_CHECK();
1670 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glSamplerParameterfv(" << sampler
1671 << ", " << GLES2Util::GetStringSamplerParameter(pname
)
1672 << ", " << static_cast<const void*>(params
) << ")");
1674 for (size_t ii
= 0; ii
< count
; ++ii
)
1675 GPU_CLIENT_LOG("value[" << ii
<< "]: " << params
[ii
]);
1676 helper_
->SamplerParameterfvImmediate(sampler
, pname
, params
);
1680 void GLES2Implementation::SamplerParameteri(GLuint sampler
,
1683 GPU_CLIENT_SINGLE_THREAD_CHECK();
1684 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glSamplerParameteri(" << sampler
1685 << ", " << GLES2Util::GetStringSamplerParameter(pname
)
1686 << ", " << param
<< ")");
1687 helper_
->SamplerParameteri(sampler
, pname
, param
);
1691 void GLES2Implementation::SamplerParameteriv(GLuint sampler
,
1693 const GLint
* params
) {
1694 GPU_CLIENT_SINGLE_THREAD_CHECK();
1695 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glSamplerParameteriv(" << sampler
1696 << ", " << GLES2Util::GetStringSamplerParameter(pname
)
1697 << ", " << static_cast<const void*>(params
) << ")");
1699 for (size_t ii
= 0; ii
< count
; ++ii
)
1700 GPU_CLIENT_LOG("value[" << ii
<< "]: " << params
[ii
]);
1701 helper_
->SamplerParameterivImmediate(sampler
, pname
, params
);
1705 void GLES2Implementation::Scissor(GLint x
,
1709 GPU_CLIENT_SINGLE_THREAD_CHECK();
1710 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glScissor(" << x
<< ", " << y
1711 << ", " << width
<< ", " << height
<< ")");
1713 SetGLError(GL_INVALID_VALUE
, "glScissor", "width < 0");
1717 SetGLError(GL_INVALID_VALUE
, "glScissor", "height < 0");
1720 helper_
->Scissor(x
, y
, width
, height
);
1724 void GLES2Implementation::ShaderSource(GLuint shader
,
1726 const GLchar
* const* str
,
1727 const GLint
* length
) {
1728 GPU_CLIENT_SINGLE_THREAD_CHECK();
1729 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glShaderSource(" << shader
<< ", "
1730 << count
<< ", " << static_cast<const void*>(str
) << ", "
1731 << static_cast<const void*>(length
) << ")");
1732 GPU_CLIENT_LOG_CODE_BLOCK({
1733 for (GLsizei ii
= 0; ii
< count
; ++ii
) {
1735 if (length
&& length
[ii
] >= 0) {
1736 const std::string
my_str(str
[ii
], length
[ii
]);
1737 GPU_CLIENT_LOG(" " << ii
<< ": ---\n" << my_str
<< "\n---");
1739 GPU_CLIENT_LOG(" " << ii
<< ": ---\n" << str
[ii
] << "\n---");
1742 GPU_CLIENT_LOG(" " << ii
<< ": NULL");
1747 SetGLError(GL_INVALID_VALUE
, "glShaderSource", "count < 0");
1751 if (!PackStringsToBucket(count
, str
, length
, "glShaderSource")) {
1754 helper_
->ShaderSourceBucket(shader
, kResultBucketId
);
1755 helper_
->SetBucketSize(kResultBucketId
, 0);
1759 void GLES2Implementation::StencilFunc(GLenum func
, GLint ref
, GLuint mask
) {
1760 GPU_CLIENT_SINGLE_THREAD_CHECK();
1761 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glStencilFunc("
1762 << GLES2Util::GetStringCmpFunction(func
) << ", " << ref
1763 << ", " << mask
<< ")");
1764 helper_
->StencilFunc(func
, ref
, mask
);
1768 void GLES2Implementation::StencilFuncSeparate(GLenum face
,
1772 GPU_CLIENT_SINGLE_THREAD_CHECK();
1773 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glStencilFuncSeparate("
1774 << GLES2Util::GetStringFaceType(face
) << ", "
1775 << GLES2Util::GetStringCmpFunction(func
) << ", " << ref
1776 << ", " << mask
<< ")");
1777 helper_
->StencilFuncSeparate(face
, func
, ref
, mask
);
1781 void GLES2Implementation::StencilMask(GLuint mask
) {
1782 GPU_CLIENT_SINGLE_THREAD_CHECK();
1783 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glStencilMask(" << mask
<< ")");
1784 helper_
->StencilMask(mask
);
1788 void GLES2Implementation::StencilMaskSeparate(GLenum face
, GLuint mask
) {
1789 GPU_CLIENT_SINGLE_THREAD_CHECK();
1790 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glStencilMaskSeparate("
1791 << GLES2Util::GetStringFaceType(face
) << ", " << mask
1793 helper_
->StencilMaskSeparate(face
, mask
);
1797 void GLES2Implementation::StencilOp(GLenum fail
, GLenum zfail
, GLenum zpass
) {
1798 GPU_CLIENT_SINGLE_THREAD_CHECK();
1799 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glStencilOp("
1800 << GLES2Util::GetStringStencilOp(fail
) << ", "
1801 << GLES2Util::GetStringStencilOp(zfail
) << ", "
1802 << GLES2Util::GetStringStencilOp(zpass
) << ")");
1803 helper_
->StencilOp(fail
, zfail
, zpass
);
1807 void GLES2Implementation::StencilOpSeparate(GLenum face
,
1811 GPU_CLIENT_SINGLE_THREAD_CHECK();
1812 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glStencilOpSeparate("
1813 << GLES2Util::GetStringFaceType(face
) << ", "
1814 << GLES2Util::GetStringStencilOp(fail
) << ", "
1815 << GLES2Util::GetStringStencilOp(zfail
) << ", "
1816 << GLES2Util::GetStringStencilOp(zpass
) << ")");
1817 helper_
->StencilOpSeparate(face
, fail
, zfail
, zpass
);
1821 void GLES2Implementation::TexParameterf(GLenum target
,
1824 GPU_CLIENT_SINGLE_THREAD_CHECK();
1825 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glTexParameterf("
1826 << GLES2Util::GetStringTextureBindTarget(target
) << ", "
1827 << GLES2Util::GetStringTextureParameter(pname
) << ", "
1829 helper_
->TexParameterf(target
, pname
, param
);
1833 void GLES2Implementation::TexParameterfv(GLenum target
,
1835 const GLfloat
* params
) {
1836 GPU_CLIENT_SINGLE_THREAD_CHECK();
1837 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glTexParameterfv("
1838 << GLES2Util::GetStringTextureBindTarget(target
) << ", "
1839 << GLES2Util::GetStringTextureParameter(pname
) << ", "
1840 << static_cast<const void*>(params
) << ")");
1842 for (size_t ii
= 0; ii
< count
; ++ii
)
1843 GPU_CLIENT_LOG("value[" << ii
<< "]: " << params
[ii
]);
1844 helper_
->TexParameterfvImmediate(target
, pname
, params
);
1848 void GLES2Implementation::TexParameteri(GLenum target
,
1851 GPU_CLIENT_SINGLE_THREAD_CHECK();
1852 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glTexParameteri("
1853 << GLES2Util::GetStringTextureBindTarget(target
) << ", "
1854 << GLES2Util::GetStringTextureParameter(pname
) << ", "
1856 helper_
->TexParameteri(target
, pname
, param
);
1860 void GLES2Implementation::TexParameteriv(GLenum target
,
1862 const GLint
* params
) {
1863 GPU_CLIENT_SINGLE_THREAD_CHECK();
1864 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glTexParameteriv("
1865 << GLES2Util::GetStringTextureBindTarget(target
) << ", "
1866 << GLES2Util::GetStringTextureParameter(pname
) << ", "
1867 << static_cast<const void*>(params
) << ")");
1869 for (size_t ii
= 0; ii
< count
; ++ii
)
1870 GPU_CLIENT_LOG("value[" << ii
<< "]: " << params
[ii
]);
1871 helper_
->TexParameterivImmediate(target
, pname
, params
);
1875 void GLES2Implementation::TexStorage3D(GLenum target
,
1877 GLenum internalFormat
,
1881 GPU_CLIENT_SINGLE_THREAD_CHECK();
1883 "[" << GetLogPrefix() << "] glTexStorage3D("
1884 << GLES2Util::GetStringTexture3DTarget(target
) << ", " << levels
1886 << GLES2Util::GetStringTextureInternalFormatStorage(internalFormat
)
1887 << ", " << width
<< ", " << height
<< ", " << depth
<< ")");
1889 SetGLError(GL_INVALID_VALUE
, "glTexStorage3D", "levels < 0");
1893 SetGLError(GL_INVALID_VALUE
, "glTexStorage3D", "width < 0");
1897 SetGLError(GL_INVALID_VALUE
, "glTexStorage3D", "height < 0");
1901 SetGLError(GL_INVALID_VALUE
, "glTexStorage3D", "depth < 0");
1904 helper_
->TexStorage3D(target
, levels
, internalFormat
, width
, height
, depth
);
1908 void GLES2Implementation::TransformFeedbackVaryings(GLuint program
,
1910 const char* const* varyings
,
1911 GLenum buffermode
) {
1912 GPU_CLIENT_SINGLE_THREAD_CHECK();
1913 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glTransformFeedbackVaryings("
1914 << program
<< ", " << count
<< ", "
1915 << static_cast<const void*>(varyings
) << ", "
1916 << GLES2Util::GetStringBufferMode(buffermode
) << ")");
1917 GPU_CLIENT_LOG_CODE_BLOCK({
1918 for (GLsizei ii
= 0; ii
< count
; ++ii
) {
1920 GPU_CLIENT_LOG(" " << ii
<< ": ---\n" << varyings
[ii
] << "\n---");
1922 GPU_CLIENT_LOG(" " << ii
<< ": NULL");
1927 SetGLError(GL_INVALID_VALUE
, "glTransformFeedbackVaryings", "count < 0");
1931 if (!PackStringsToBucket(count
, varyings
, NULL
,
1932 "glTransformFeedbackVaryings")) {
1935 helper_
->TransformFeedbackVaryingsBucket(program
, kResultBucketId
,
1937 helper_
->SetBucketSize(kResultBucketId
, 0);
1941 void GLES2Implementation::Uniform1f(GLint location
, GLfloat x
) {
1942 GPU_CLIENT_SINGLE_THREAD_CHECK();
1943 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform1f(" << location
<< ", "
1945 helper_
->Uniform1f(location
, x
);
1949 void GLES2Implementation::Uniform1fv(GLint location
,
1952 GPU_CLIENT_SINGLE_THREAD_CHECK();
1953 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform1fv(" << location
<< ", "
1954 << count
<< ", " << static_cast<const void*>(v
) << ")");
1955 GPU_CLIENT_LOG_CODE_BLOCK({
1956 for (GLsizei i
= 0; i
< count
; ++i
) {
1957 GPU_CLIENT_LOG(" " << i
<< ": " << v
[0 + i
* 1]);
1961 SetGLError(GL_INVALID_VALUE
, "glUniform1fv", "count < 0");
1964 helper_
->Uniform1fvImmediate(location
, count
, v
);
1968 void GLES2Implementation::Uniform1i(GLint location
, GLint x
) {
1969 GPU_CLIENT_SINGLE_THREAD_CHECK();
1970 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform1i(" << location
<< ", "
1972 helper_
->Uniform1i(location
, x
);
1976 void GLES2Implementation::Uniform1iv(GLint location
,
1979 GPU_CLIENT_SINGLE_THREAD_CHECK();
1980 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform1iv(" << location
<< ", "
1981 << count
<< ", " << static_cast<const void*>(v
) << ")");
1982 GPU_CLIENT_LOG_CODE_BLOCK({
1983 for (GLsizei i
= 0; i
< count
; ++i
) {
1984 GPU_CLIENT_LOG(" " << i
<< ": " << v
[0 + i
* 1]);
1988 SetGLError(GL_INVALID_VALUE
, "glUniform1iv", "count < 0");
1991 helper_
->Uniform1ivImmediate(location
, count
, v
);
1995 void GLES2Implementation::Uniform1ui(GLint location
, GLuint x
) {
1996 GPU_CLIENT_SINGLE_THREAD_CHECK();
1997 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform1ui(" << location
<< ", "
1999 helper_
->Uniform1ui(location
, x
);
2003 void GLES2Implementation::Uniform1uiv(GLint location
,
2006 GPU_CLIENT_SINGLE_THREAD_CHECK();
2007 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform1uiv(" << location
<< ", "
2008 << count
<< ", " << static_cast<const void*>(v
) << ")");
2009 GPU_CLIENT_LOG_CODE_BLOCK({
2010 for (GLsizei i
= 0; i
< count
; ++i
) {
2011 GPU_CLIENT_LOG(" " << i
<< ": " << v
[0 + i
* 1]);
2015 SetGLError(GL_INVALID_VALUE
, "glUniform1uiv", "count < 0");
2018 helper_
->Uniform1uivImmediate(location
, count
, v
);
2022 void GLES2Implementation::Uniform2f(GLint location
, GLfloat x
, GLfloat y
) {
2023 GPU_CLIENT_SINGLE_THREAD_CHECK();
2024 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform2f(" << location
<< ", "
2025 << x
<< ", " << y
<< ")");
2026 helper_
->Uniform2f(location
, x
, y
);
2030 void GLES2Implementation::Uniform2fv(GLint location
,
2033 GPU_CLIENT_SINGLE_THREAD_CHECK();
2034 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform2fv(" << location
<< ", "
2035 << count
<< ", " << static_cast<const void*>(v
) << ")");
2036 GPU_CLIENT_LOG_CODE_BLOCK({
2037 for (GLsizei i
= 0; i
< count
; ++i
) {
2038 GPU_CLIENT_LOG(" " << i
<< ": " << v
[0 + i
* 2] << ", " << v
[1 + i
* 2]);
2042 SetGLError(GL_INVALID_VALUE
, "glUniform2fv", "count < 0");
2045 helper_
->Uniform2fvImmediate(location
, count
, v
);
2049 void GLES2Implementation::Uniform2i(GLint location
, GLint x
, GLint y
) {
2050 GPU_CLIENT_SINGLE_THREAD_CHECK();
2051 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform2i(" << location
<< ", "
2052 << x
<< ", " << y
<< ")");
2053 helper_
->Uniform2i(location
, x
, y
);
2057 void GLES2Implementation::Uniform2iv(GLint location
,
2060 GPU_CLIENT_SINGLE_THREAD_CHECK();
2061 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform2iv(" << location
<< ", "
2062 << count
<< ", " << static_cast<const void*>(v
) << ")");
2063 GPU_CLIENT_LOG_CODE_BLOCK({
2064 for (GLsizei i
= 0; i
< count
; ++i
) {
2065 GPU_CLIENT_LOG(" " << i
<< ": " << v
[0 + i
* 2] << ", " << v
[1 + i
* 2]);
2069 SetGLError(GL_INVALID_VALUE
, "glUniform2iv", "count < 0");
2072 helper_
->Uniform2ivImmediate(location
, count
, v
);
2076 void GLES2Implementation::Uniform2ui(GLint location
, GLuint x
, GLuint y
) {
2077 GPU_CLIENT_SINGLE_THREAD_CHECK();
2078 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform2ui(" << location
<< ", "
2079 << x
<< ", " << y
<< ")");
2080 helper_
->Uniform2ui(location
, x
, y
);
2084 void GLES2Implementation::Uniform2uiv(GLint location
,
2087 GPU_CLIENT_SINGLE_THREAD_CHECK();
2088 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform2uiv(" << location
<< ", "
2089 << count
<< ", " << static_cast<const void*>(v
) << ")");
2090 GPU_CLIENT_LOG_CODE_BLOCK({
2091 for (GLsizei i
= 0; i
< count
; ++i
) {
2092 GPU_CLIENT_LOG(" " << i
<< ": " << v
[0 + i
* 2] << ", " << v
[1 + i
* 2]);
2096 SetGLError(GL_INVALID_VALUE
, "glUniform2uiv", "count < 0");
2099 helper_
->Uniform2uivImmediate(location
, count
, v
);
2103 void GLES2Implementation::Uniform3f(GLint location
,
2107 GPU_CLIENT_SINGLE_THREAD_CHECK();
2108 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform3f(" << location
<< ", "
2109 << x
<< ", " << y
<< ", " << z
<< ")");
2110 helper_
->Uniform3f(location
, x
, y
, z
);
2114 void GLES2Implementation::Uniform3fv(GLint location
,
2117 GPU_CLIENT_SINGLE_THREAD_CHECK();
2118 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform3fv(" << location
<< ", "
2119 << count
<< ", " << static_cast<const void*>(v
) << ")");
2120 GPU_CLIENT_LOG_CODE_BLOCK({
2121 for (GLsizei i
= 0; i
< count
; ++i
) {
2122 GPU_CLIENT_LOG(" " << i
<< ": " << v
[0 + i
* 3] << ", " << v
[1 + i
* 3]
2123 << ", " << v
[2 + i
* 3]);
2127 SetGLError(GL_INVALID_VALUE
, "glUniform3fv", "count < 0");
2130 helper_
->Uniform3fvImmediate(location
, count
, v
);
2134 void GLES2Implementation::Uniform3i(GLint location
, GLint x
, GLint y
, GLint z
) {
2135 GPU_CLIENT_SINGLE_THREAD_CHECK();
2136 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform3i(" << location
<< ", "
2137 << x
<< ", " << y
<< ", " << z
<< ")");
2138 helper_
->Uniform3i(location
, x
, y
, z
);
2142 void GLES2Implementation::Uniform3iv(GLint location
,
2145 GPU_CLIENT_SINGLE_THREAD_CHECK();
2146 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform3iv(" << location
<< ", "
2147 << count
<< ", " << static_cast<const void*>(v
) << ")");
2148 GPU_CLIENT_LOG_CODE_BLOCK({
2149 for (GLsizei i
= 0; i
< count
; ++i
) {
2150 GPU_CLIENT_LOG(" " << i
<< ": " << v
[0 + i
* 3] << ", " << v
[1 + i
* 3]
2151 << ", " << v
[2 + i
* 3]);
2155 SetGLError(GL_INVALID_VALUE
, "glUniform3iv", "count < 0");
2158 helper_
->Uniform3ivImmediate(location
, count
, v
);
2162 void GLES2Implementation::Uniform3ui(GLint location
,
2166 GPU_CLIENT_SINGLE_THREAD_CHECK();
2167 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform3ui(" << location
<< ", "
2168 << x
<< ", " << y
<< ", " << z
<< ")");
2169 helper_
->Uniform3ui(location
, x
, y
, z
);
2173 void GLES2Implementation::Uniform3uiv(GLint location
,
2176 GPU_CLIENT_SINGLE_THREAD_CHECK();
2177 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform3uiv(" << location
<< ", "
2178 << count
<< ", " << static_cast<const void*>(v
) << ")");
2179 GPU_CLIENT_LOG_CODE_BLOCK({
2180 for (GLsizei i
= 0; i
< count
; ++i
) {
2181 GPU_CLIENT_LOG(" " << i
<< ": " << v
[0 + i
* 3] << ", " << v
[1 + i
* 3]
2182 << ", " << v
[2 + i
* 3]);
2186 SetGLError(GL_INVALID_VALUE
, "glUniform3uiv", "count < 0");
2189 helper_
->Uniform3uivImmediate(location
, count
, v
);
2193 void GLES2Implementation::Uniform4f(GLint location
,
2198 GPU_CLIENT_SINGLE_THREAD_CHECK();
2199 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform4f(" << location
<< ", "
2200 << x
<< ", " << y
<< ", " << z
<< ", " << w
<< ")");
2201 helper_
->Uniform4f(location
, x
, y
, z
, w
);
2205 void GLES2Implementation::Uniform4fv(GLint location
,
2208 GPU_CLIENT_SINGLE_THREAD_CHECK();
2209 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform4fv(" << location
<< ", "
2210 << count
<< ", " << static_cast<const void*>(v
) << ")");
2211 GPU_CLIENT_LOG_CODE_BLOCK({
2212 for (GLsizei i
= 0; i
< count
; ++i
) {
2213 GPU_CLIENT_LOG(" " << i
<< ": " << v
[0 + i
* 4] << ", " << v
[1 + i
* 4]
2214 << ", " << v
[2 + i
* 4] << ", " << v
[3 + i
* 4]);
2218 SetGLError(GL_INVALID_VALUE
, "glUniform4fv", "count < 0");
2221 helper_
->Uniform4fvImmediate(location
, count
, v
);
2225 void GLES2Implementation::Uniform4i(GLint location
,
2230 GPU_CLIENT_SINGLE_THREAD_CHECK();
2231 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform4i(" << location
<< ", "
2232 << x
<< ", " << y
<< ", " << z
<< ", " << w
<< ")");
2233 helper_
->Uniform4i(location
, x
, y
, z
, w
);
2237 void GLES2Implementation::Uniform4iv(GLint location
,
2240 GPU_CLIENT_SINGLE_THREAD_CHECK();
2241 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform4iv(" << location
<< ", "
2242 << count
<< ", " << static_cast<const void*>(v
) << ")");
2243 GPU_CLIENT_LOG_CODE_BLOCK({
2244 for (GLsizei i
= 0; i
< count
; ++i
) {
2245 GPU_CLIENT_LOG(" " << i
<< ": " << v
[0 + i
* 4] << ", " << v
[1 + i
* 4]
2246 << ", " << v
[2 + i
* 4] << ", " << v
[3 + i
* 4]);
2250 SetGLError(GL_INVALID_VALUE
, "glUniform4iv", "count < 0");
2253 helper_
->Uniform4ivImmediate(location
, count
, v
);
2257 void GLES2Implementation::Uniform4ui(GLint location
,
2262 GPU_CLIENT_SINGLE_THREAD_CHECK();
2263 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform4ui(" << location
<< ", "
2264 << x
<< ", " << y
<< ", " << z
<< ", " << w
<< ")");
2265 helper_
->Uniform4ui(location
, x
, y
, z
, w
);
2269 void GLES2Implementation::Uniform4uiv(GLint location
,
2272 GPU_CLIENT_SINGLE_THREAD_CHECK();
2273 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform4uiv(" << location
<< ", "
2274 << count
<< ", " << static_cast<const void*>(v
) << ")");
2275 GPU_CLIENT_LOG_CODE_BLOCK({
2276 for (GLsizei i
= 0; i
< count
; ++i
) {
2277 GPU_CLIENT_LOG(" " << i
<< ": " << v
[0 + i
* 4] << ", " << v
[1 + i
* 4]
2278 << ", " << v
[2 + i
* 4] << ", " << v
[3 + i
* 4]);
2282 SetGLError(GL_INVALID_VALUE
, "glUniform4uiv", "count < 0");
2285 helper_
->Uniform4uivImmediate(location
, count
, v
);
2289 void GLES2Implementation::UniformMatrix2fv(GLint location
,
2291 GLboolean transpose
,
2292 const GLfloat
* value
) {
2293 GPU_CLIENT_SINGLE_THREAD_CHECK();
2294 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniformMatrix2fv(" << location
2295 << ", " << count
<< ", "
2296 << GLES2Util::GetStringBool(transpose
) << ", "
2297 << static_cast<const void*>(value
) << ")");
2298 GPU_CLIENT_LOG_CODE_BLOCK({
2299 for (GLsizei i
= 0; i
< count
; ++i
) {
2300 GPU_CLIENT_LOG(" " << i
<< ": " << value
[0 + i
* 4] << ", "
2301 << value
[1 + i
* 4] << ", " << value
[2 + i
* 4]
2302 << ", " << value
[3 + i
* 4]);
2306 SetGLError(GL_INVALID_VALUE
, "glUniformMatrix2fv", "count < 0");
2309 if (transpose
!= false) {
2310 SetGLError(GL_INVALID_VALUE
, "glUniformMatrix2fv",
2311 "transpose GL_INVALID_VALUE");
2314 helper_
->UniformMatrix2fvImmediate(location
, count
, value
);
2318 void GLES2Implementation::UniformMatrix2x3fv(GLint location
,
2320 GLboolean transpose
,
2321 const GLfloat
* value
) {
2322 GPU_CLIENT_SINGLE_THREAD_CHECK();
2323 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniformMatrix2x3fv(" << location
2324 << ", " << count
<< ", "
2325 << GLES2Util::GetStringBool(transpose
) << ", "
2326 << static_cast<const void*>(value
) << ")");
2327 GPU_CLIENT_LOG_CODE_BLOCK({
2328 for (GLsizei i
= 0; i
< count
; ++i
) {
2329 GPU_CLIENT_LOG(" " << i
<< ": " << value
[0 + i
* 6] << ", "
2330 << value
[1 + i
* 6] << ", " << value
[2 + i
* 6]
2331 << ", " << value
[3 + i
* 6] << ", "
2332 << value
[4 + i
* 6] << ", " << value
[5 + i
* 6]);
2336 SetGLError(GL_INVALID_VALUE
, "glUniformMatrix2x3fv", "count < 0");
2339 if (transpose
!= false) {
2340 SetGLError(GL_INVALID_VALUE
, "glUniformMatrix2x3fv",
2341 "transpose GL_INVALID_VALUE");
2344 helper_
->UniformMatrix2x3fvImmediate(location
, count
, value
);
2348 void GLES2Implementation::UniformMatrix2x4fv(GLint location
,
2350 GLboolean transpose
,
2351 const GLfloat
* value
) {
2352 GPU_CLIENT_SINGLE_THREAD_CHECK();
2353 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniformMatrix2x4fv(" << location
2354 << ", " << count
<< ", "
2355 << GLES2Util::GetStringBool(transpose
) << ", "
2356 << static_cast<const void*>(value
) << ")");
2357 GPU_CLIENT_LOG_CODE_BLOCK({
2358 for (GLsizei i
= 0; i
< count
; ++i
) {
2360 " " << i
<< ": " << value
[0 + i
* 8] << ", " << value
[1 + i
* 8]
2361 << ", " << value
[2 + i
* 8] << ", " << value
[3 + i
* 8] << ", "
2362 << value
[4 + i
* 8] << ", " << value
[5 + i
* 8] << ", "
2363 << value
[6 + i
* 8] << ", " << value
[7 + i
* 8]);
2367 SetGLError(GL_INVALID_VALUE
, "glUniformMatrix2x4fv", "count < 0");
2370 if (transpose
!= false) {
2371 SetGLError(GL_INVALID_VALUE
, "glUniformMatrix2x4fv",
2372 "transpose GL_INVALID_VALUE");
2375 helper_
->UniformMatrix2x4fvImmediate(location
, count
, value
);
2379 void GLES2Implementation::UniformMatrix3fv(GLint location
,
2381 GLboolean transpose
,
2382 const GLfloat
* value
) {
2383 GPU_CLIENT_SINGLE_THREAD_CHECK();
2384 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniformMatrix3fv(" << location
2385 << ", " << count
<< ", "
2386 << GLES2Util::GetStringBool(transpose
) << ", "
2387 << static_cast<const void*>(value
) << ")");
2388 GPU_CLIENT_LOG_CODE_BLOCK({
2389 for (GLsizei i
= 0; i
< count
; ++i
) {
2390 GPU_CLIENT_LOG(" " << i
<< ": " << value
[0 + i
* 9] << ", "
2391 << value
[1 + i
* 9] << ", " << value
[2 + i
* 9]
2392 << ", " << value
[3 + i
* 9] << ", "
2393 << value
[4 + i
* 9] << ", " << value
[5 + i
* 9]
2394 << ", " << value
[6 + i
* 9] << ", "
2395 << value
[7 + i
* 9] << ", " << value
[8 + i
* 9]);
2399 SetGLError(GL_INVALID_VALUE
, "glUniformMatrix3fv", "count < 0");
2402 if (transpose
!= false) {
2403 SetGLError(GL_INVALID_VALUE
, "glUniformMatrix3fv",
2404 "transpose GL_INVALID_VALUE");
2407 helper_
->UniformMatrix3fvImmediate(location
, count
, value
);
2411 void GLES2Implementation::UniformMatrix3x2fv(GLint location
,
2413 GLboolean transpose
,
2414 const GLfloat
* value
) {
2415 GPU_CLIENT_SINGLE_THREAD_CHECK();
2416 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniformMatrix3x2fv(" << location
2417 << ", " << count
<< ", "
2418 << GLES2Util::GetStringBool(transpose
) << ", "
2419 << static_cast<const void*>(value
) << ")");
2420 GPU_CLIENT_LOG_CODE_BLOCK({
2421 for (GLsizei i
= 0; i
< count
; ++i
) {
2422 GPU_CLIENT_LOG(" " << i
<< ": " << value
[0 + i
* 6] << ", "
2423 << value
[1 + i
* 6] << ", " << value
[2 + i
* 6]
2424 << ", " << value
[3 + i
* 6] << ", "
2425 << value
[4 + i
* 6] << ", " << value
[5 + i
* 6]);
2429 SetGLError(GL_INVALID_VALUE
, "glUniformMatrix3x2fv", "count < 0");
2432 if (transpose
!= false) {
2433 SetGLError(GL_INVALID_VALUE
, "glUniformMatrix3x2fv",
2434 "transpose GL_INVALID_VALUE");
2437 helper_
->UniformMatrix3x2fvImmediate(location
, count
, value
);
2441 void GLES2Implementation::UniformMatrix3x4fv(GLint location
,
2443 GLboolean transpose
,
2444 const GLfloat
* value
) {
2445 GPU_CLIENT_SINGLE_THREAD_CHECK();
2446 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniformMatrix3x4fv(" << location
2447 << ", " << count
<< ", "
2448 << GLES2Util::GetStringBool(transpose
) << ", "
2449 << static_cast<const void*>(value
) << ")");
2450 GPU_CLIENT_LOG_CODE_BLOCK({
2451 for (GLsizei i
= 0; i
< count
; ++i
) {
2453 " " << i
<< ": " << value
[0 + i
* 12] << ", " << value
[1 + i
* 12]
2454 << ", " << value
[2 + i
* 12] << ", " << value
[3 + i
* 12] << ", "
2455 << value
[4 + i
* 12] << ", " << value
[5 + i
* 12] << ", "
2456 << value
[6 + i
* 12] << ", " << value
[7 + i
* 12] << ", "
2457 << value
[8 + i
* 12] << ", " << value
[9 + i
* 12] << ", "
2458 << value
[10 + i
* 12] << ", " << value
[11 + i
* 12]);
2462 SetGLError(GL_INVALID_VALUE
, "glUniformMatrix3x4fv", "count < 0");
2465 if (transpose
!= false) {
2466 SetGLError(GL_INVALID_VALUE
, "glUniformMatrix3x4fv",
2467 "transpose GL_INVALID_VALUE");
2470 helper_
->UniformMatrix3x4fvImmediate(location
, count
, value
);
2474 void GLES2Implementation::UniformMatrix4fv(GLint location
,
2476 GLboolean transpose
,
2477 const GLfloat
* value
) {
2478 GPU_CLIENT_SINGLE_THREAD_CHECK();
2479 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniformMatrix4fv(" << location
2480 << ", " << count
<< ", "
2481 << GLES2Util::GetStringBool(transpose
) << ", "
2482 << static_cast<const void*>(value
) << ")");
2483 GPU_CLIENT_LOG_CODE_BLOCK({
2484 for (GLsizei i
= 0; i
< count
; ++i
) {
2486 " " << i
<< ": " << value
[0 + i
* 16] << ", " << value
[1 + i
* 16]
2487 << ", " << value
[2 + i
* 16] << ", " << value
[3 + i
* 16] << ", "
2488 << value
[4 + i
* 16] << ", " << value
[5 + i
* 16] << ", "
2489 << value
[6 + i
* 16] << ", " << value
[7 + i
* 16] << ", "
2490 << value
[8 + i
* 16] << ", " << value
[9 + i
* 16] << ", "
2491 << value
[10 + i
* 16] << ", " << value
[11 + i
* 16] << ", "
2492 << value
[12 + i
* 16] << ", " << value
[13 + i
* 16] << ", "
2493 << value
[14 + i
* 16] << ", " << value
[15 + i
* 16]);
2497 SetGLError(GL_INVALID_VALUE
, "glUniformMatrix4fv", "count < 0");
2500 if (transpose
!= false) {
2501 SetGLError(GL_INVALID_VALUE
, "glUniformMatrix4fv",
2502 "transpose GL_INVALID_VALUE");
2505 helper_
->UniformMatrix4fvImmediate(location
, count
, value
);
2509 void GLES2Implementation::UniformMatrix4x2fv(GLint location
,
2511 GLboolean transpose
,
2512 const GLfloat
* value
) {
2513 GPU_CLIENT_SINGLE_THREAD_CHECK();
2514 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniformMatrix4x2fv(" << location
2515 << ", " << count
<< ", "
2516 << GLES2Util::GetStringBool(transpose
) << ", "
2517 << static_cast<const void*>(value
) << ")");
2518 GPU_CLIENT_LOG_CODE_BLOCK({
2519 for (GLsizei i
= 0; i
< count
; ++i
) {
2521 " " << i
<< ": " << value
[0 + i
* 8] << ", " << value
[1 + i
* 8]
2522 << ", " << value
[2 + i
* 8] << ", " << value
[3 + i
* 8] << ", "
2523 << value
[4 + i
* 8] << ", " << value
[5 + i
* 8] << ", "
2524 << value
[6 + i
* 8] << ", " << value
[7 + i
* 8]);
2528 SetGLError(GL_INVALID_VALUE
, "glUniformMatrix4x2fv", "count < 0");
2531 if (transpose
!= false) {
2532 SetGLError(GL_INVALID_VALUE
, "glUniformMatrix4x2fv",
2533 "transpose GL_INVALID_VALUE");
2536 helper_
->UniformMatrix4x2fvImmediate(location
, count
, value
);
2540 void GLES2Implementation::UniformMatrix4x3fv(GLint location
,
2542 GLboolean transpose
,
2543 const GLfloat
* value
) {
2544 GPU_CLIENT_SINGLE_THREAD_CHECK();
2545 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniformMatrix4x3fv(" << location
2546 << ", " << count
<< ", "
2547 << GLES2Util::GetStringBool(transpose
) << ", "
2548 << static_cast<const void*>(value
) << ")");
2549 GPU_CLIENT_LOG_CODE_BLOCK({
2550 for (GLsizei i
= 0; i
< count
; ++i
) {
2552 " " << i
<< ": " << value
[0 + i
* 12] << ", " << value
[1 + i
* 12]
2553 << ", " << value
[2 + i
* 12] << ", " << value
[3 + i
* 12] << ", "
2554 << value
[4 + i
* 12] << ", " << value
[5 + i
* 12] << ", "
2555 << value
[6 + i
* 12] << ", " << value
[7 + i
* 12] << ", "
2556 << value
[8 + i
* 12] << ", " << value
[9 + i
* 12] << ", "
2557 << value
[10 + i
* 12] << ", " << value
[11 + i
* 12]);
2561 SetGLError(GL_INVALID_VALUE
, "glUniformMatrix4x3fv", "count < 0");
2564 if (transpose
!= false) {
2565 SetGLError(GL_INVALID_VALUE
, "glUniformMatrix4x3fv",
2566 "transpose GL_INVALID_VALUE");
2569 helper_
->UniformMatrix4x3fvImmediate(location
, count
, value
);
2573 void GLES2Implementation::UseProgram(GLuint program
) {
2574 GPU_CLIENT_SINGLE_THREAD_CHECK();
2575 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUseProgram(" << program
<< ")");
2576 if (IsProgramReservedId(program
)) {
2577 SetGLError(GL_INVALID_OPERATION
, "UseProgram", "program reserved id");
2580 UseProgramHelper(program
);
2584 void GLES2Implementation::ValidateProgram(GLuint program
) {
2585 GPU_CLIENT_SINGLE_THREAD_CHECK();
2586 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glValidateProgram(" << program
2588 helper_
->ValidateProgram(program
);
2592 void GLES2Implementation::VertexAttrib1f(GLuint indx
, GLfloat x
) {
2593 GPU_CLIENT_SINGLE_THREAD_CHECK();
2594 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glVertexAttrib1f(" << indx
<< ", "
2596 helper_
->VertexAttrib1f(indx
, x
);
2600 void GLES2Implementation::VertexAttrib1fv(GLuint indx
, const GLfloat
* values
) {
2601 GPU_CLIENT_SINGLE_THREAD_CHECK();
2602 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glVertexAttrib1fv(" << indx
<< ", "
2603 << static_cast<const void*>(values
) << ")");
2605 for (size_t ii
= 0; ii
< count
; ++ii
)
2606 GPU_CLIENT_LOG("value[" << ii
<< "]: " << values
[ii
]);
2607 helper_
->VertexAttrib1fvImmediate(indx
, values
);
2611 void GLES2Implementation::VertexAttrib2f(GLuint indx
, GLfloat x
, GLfloat y
) {
2612 GPU_CLIENT_SINGLE_THREAD_CHECK();
2613 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glVertexAttrib2f(" << indx
<< ", "
2614 << x
<< ", " << y
<< ")");
2615 helper_
->VertexAttrib2f(indx
, x
, y
);
2619 void GLES2Implementation::VertexAttrib2fv(GLuint indx
, const GLfloat
* values
) {
2620 GPU_CLIENT_SINGLE_THREAD_CHECK();
2621 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glVertexAttrib2fv(" << indx
<< ", "
2622 << static_cast<const void*>(values
) << ")");
2624 for (size_t ii
= 0; ii
< count
; ++ii
)
2625 GPU_CLIENT_LOG("value[" << ii
<< "]: " << values
[ii
]);
2626 helper_
->VertexAttrib2fvImmediate(indx
, values
);
2630 void GLES2Implementation::VertexAttrib3f(GLuint indx
,
2634 GPU_CLIENT_SINGLE_THREAD_CHECK();
2635 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glVertexAttrib3f(" << indx
<< ", "
2636 << x
<< ", " << y
<< ", " << z
<< ")");
2637 helper_
->VertexAttrib3f(indx
, x
, y
, z
);
2641 void GLES2Implementation::VertexAttrib3fv(GLuint indx
, const GLfloat
* values
) {
2642 GPU_CLIENT_SINGLE_THREAD_CHECK();
2643 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glVertexAttrib3fv(" << indx
<< ", "
2644 << static_cast<const void*>(values
) << ")");
2646 for (size_t ii
= 0; ii
< count
; ++ii
)
2647 GPU_CLIENT_LOG("value[" << ii
<< "]: " << values
[ii
]);
2648 helper_
->VertexAttrib3fvImmediate(indx
, values
);
2652 void GLES2Implementation::VertexAttrib4f(GLuint indx
,
2657 GPU_CLIENT_SINGLE_THREAD_CHECK();
2658 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glVertexAttrib4f(" << indx
<< ", "
2659 << x
<< ", " << y
<< ", " << z
<< ", " << w
<< ")");
2660 helper_
->VertexAttrib4f(indx
, x
, y
, z
, w
);
2664 void GLES2Implementation::VertexAttrib4fv(GLuint indx
, const GLfloat
* values
) {
2665 GPU_CLIENT_SINGLE_THREAD_CHECK();
2666 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glVertexAttrib4fv(" << indx
<< ", "
2667 << static_cast<const void*>(values
) << ")");
2669 for (size_t ii
= 0; ii
< count
; ++ii
)
2670 GPU_CLIENT_LOG("value[" << ii
<< "]: " << values
[ii
]);
2671 helper_
->VertexAttrib4fvImmediate(indx
, values
);
2675 void GLES2Implementation::VertexAttribI4i(GLuint indx
,
2680 GPU_CLIENT_SINGLE_THREAD_CHECK();
2681 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glVertexAttribI4i(" << indx
<< ", "
2682 << x
<< ", " << y
<< ", " << z
<< ", " << w
<< ")");
2683 helper_
->VertexAttribI4i(indx
, x
, y
, z
, w
);
2687 void GLES2Implementation::VertexAttribI4iv(GLuint indx
, const GLint
* values
) {
2688 GPU_CLIENT_SINGLE_THREAD_CHECK();
2689 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glVertexAttribI4iv(" << indx
2690 << ", " << static_cast<const void*>(values
) << ")");
2692 for (size_t ii
= 0; ii
< count
; ++ii
)
2693 GPU_CLIENT_LOG("value[" << ii
<< "]: " << values
[ii
]);
2694 helper_
->VertexAttribI4ivImmediate(indx
, values
);
2698 void GLES2Implementation::VertexAttribI4ui(GLuint indx
,
2703 GPU_CLIENT_SINGLE_THREAD_CHECK();
2704 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glVertexAttribI4ui(" << indx
2705 << ", " << x
<< ", " << y
<< ", " << z
<< ", " << w
2707 helper_
->VertexAttribI4ui(indx
, x
, y
, z
, w
);
2711 void GLES2Implementation::VertexAttribI4uiv(GLuint indx
, const GLuint
* values
) {
2712 GPU_CLIENT_SINGLE_THREAD_CHECK();
2713 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glVertexAttribI4uiv(" << indx
2714 << ", " << static_cast<const void*>(values
) << ")");
2716 for (size_t ii
= 0; ii
< count
; ++ii
)
2717 GPU_CLIENT_LOG("value[" << ii
<< "]: " << values
[ii
]);
2718 helper_
->VertexAttribI4uivImmediate(indx
, values
);
2722 void GLES2Implementation::Viewport(GLint x
,
2726 GPU_CLIENT_SINGLE_THREAD_CHECK();
2727 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glViewport(" << x
<< ", " << y
2728 << ", " << width
<< ", " << height
<< ")");
2730 SetGLError(GL_INVALID_VALUE
, "glViewport", "width < 0");
2734 SetGLError(GL_INVALID_VALUE
, "glViewport", "height < 0");
2737 helper_
->Viewport(x
, y
, width
, height
);
2741 void GLES2Implementation::BlitFramebufferCHROMIUM(GLint srcX0
,
2751 GPU_CLIENT_SINGLE_THREAD_CHECK();
2752 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBlitFramebufferCHROMIUM("
2753 << srcX0
<< ", " << srcY0
<< ", " << srcX1
<< ", " << srcY1
2754 << ", " << dstX0
<< ", " << dstY0
<< ", " << dstX1
<< ", "
2755 << dstY1
<< ", " << mask
<< ", "
2756 << GLES2Util::GetStringBlitFilter(filter
) << ")");
2757 helper_
->BlitFramebufferCHROMIUM(srcX0
, srcY0
, srcX1
, srcY1
, dstX0
, dstY0
,
2758 dstX1
, dstY1
, mask
, filter
);
2762 void GLES2Implementation::RenderbufferStorageMultisampleCHROMIUM(
2765 GLenum internalformat
,
2768 GPU_CLIENT_SINGLE_THREAD_CHECK();
2770 "[" << GetLogPrefix() << "] glRenderbufferStorageMultisampleCHROMIUM("
2771 << GLES2Util::GetStringRenderBufferTarget(target
) << ", " << samples
2772 << ", " << GLES2Util::GetStringRenderBufferFormat(internalformat
)
2773 << ", " << width
<< ", " << height
<< ")");
2775 SetGLError(GL_INVALID_VALUE
, "glRenderbufferStorageMultisampleCHROMIUM",
2780 SetGLError(GL_INVALID_VALUE
, "glRenderbufferStorageMultisampleCHROMIUM",
2785 SetGLError(GL_INVALID_VALUE
, "glRenderbufferStorageMultisampleCHROMIUM",
2789 helper_
->RenderbufferStorageMultisampleCHROMIUM(
2790 target
, samples
, internalformat
, width
, height
);
2794 void GLES2Implementation::RenderbufferStorageMultisampleEXT(
2797 GLenum internalformat
,
2800 GPU_CLIENT_SINGLE_THREAD_CHECK();
2802 "[" << GetLogPrefix() << "] glRenderbufferStorageMultisampleEXT("
2803 << GLES2Util::GetStringRenderBufferTarget(target
) << ", " << samples
2804 << ", " << GLES2Util::GetStringRenderBufferFormat(internalformat
)
2805 << ", " << width
<< ", " << height
<< ")");
2807 SetGLError(GL_INVALID_VALUE
, "glRenderbufferStorageMultisampleEXT",
2812 SetGLError(GL_INVALID_VALUE
, "glRenderbufferStorageMultisampleEXT",
2817 SetGLError(GL_INVALID_VALUE
, "glRenderbufferStorageMultisampleEXT",
2821 helper_
->RenderbufferStorageMultisampleEXT(target
, samples
, internalformat
,
2826 void GLES2Implementation::FramebufferTexture2DMultisampleEXT(GLenum target
,
2832 GPU_CLIENT_SINGLE_THREAD_CHECK();
2833 GPU_CLIENT_LOG("[" << GetLogPrefix()
2834 << "] glFramebufferTexture2DMultisampleEXT("
2835 << GLES2Util::GetStringFrameBufferTarget(target
) << ", "
2836 << GLES2Util::GetStringAttachment(attachment
) << ", "
2837 << GLES2Util::GetStringTextureTarget(textarget
) << ", "
2838 << texture
<< ", " << level
<< ", " << samples
<< ")");
2840 SetGLError(GL_INVALID_VALUE
, "glFramebufferTexture2DMultisampleEXT",
2841 "level GL_INVALID_VALUE");
2845 SetGLError(GL_INVALID_VALUE
, "glFramebufferTexture2DMultisampleEXT",
2849 helper_
->FramebufferTexture2DMultisampleEXT(target
, attachment
, textarget
,
2854 void GLES2Implementation::TexStorage2DEXT(GLenum target
,
2856 GLenum internalFormat
,
2859 GPU_CLIENT_SINGLE_THREAD_CHECK();
2861 "[" << GetLogPrefix() << "] glTexStorage2DEXT("
2862 << GLES2Util::GetStringTextureTarget(target
) << ", " << levels
<< ", "
2863 << GLES2Util::GetStringTextureInternalFormatStorage(internalFormat
)
2864 << ", " << width
<< ", " << height
<< ")");
2866 SetGLError(GL_INVALID_VALUE
, "glTexStorage2DEXT", "levels < 0");
2870 SetGLError(GL_INVALID_VALUE
, "glTexStorage2DEXT", "width < 0");
2874 SetGLError(GL_INVALID_VALUE
, "glTexStorage2DEXT", "height < 0");
2877 helper_
->TexStorage2DEXT(target
, levels
, internalFormat
, width
, height
);
2881 void GLES2Implementation::GenQueriesEXT(GLsizei n
, GLuint
* queries
) {
2882 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGenQueriesEXT(" << n
<< ", "
2883 << static_cast<const void*>(queries
) << ")");
2885 SetGLError(GL_INVALID_VALUE
, "glGenQueriesEXT", "n < 0");
2888 GPU_CLIENT_SINGLE_THREAD_CHECK();
2889 IdAllocator
* id_allocator
= GetIdAllocator(id_namespaces::kQueries
);
2890 for (GLsizei ii
= 0; ii
< n
; ++ii
)
2891 queries
[ii
] = id_allocator
->AllocateID();
2892 GenQueriesEXTHelper(n
, queries
);
2893 helper_
->GenQueriesEXTImmediate(n
, queries
);
2894 if (share_group_
->bind_generates_resource())
2895 helper_
->CommandBufferHelper::Flush();
2896 GPU_CLIENT_LOG_CODE_BLOCK({
2897 for (GLsizei i
= 0; i
< n
; ++i
) {
2898 GPU_CLIENT_LOG(" " << i
<< ": " << queries
[i
]);
2904 void GLES2Implementation::DeleteQueriesEXT(GLsizei n
, const GLuint
* queries
) {
2905 GPU_CLIENT_SINGLE_THREAD_CHECK();
2906 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDeleteQueriesEXT(" << n
<< ", "
2907 << static_cast<const void*>(queries
) << ")");
2908 GPU_CLIENT_LOG_CODE_BLOCK({
2909 for (GLsizei i
= 0; i
< n
; ++i
) {
2910 GPU_CLIENT_LOG(" " << i
<< ": " << queries
[i
]);
2913 GPU_CLIENT_DCHECK_CODE_BLOCK({
2914 for (GLsizei i
= 0; i
< n
; ++i
) {
2915 DCHECK(queries
[i
] != 0);
2919 SetGLError(GL_INVALID_VALUE
, "glDeleteQueriesEXT", "n < 0");
2922 DeleteQueriesEXTHelper(n
, queries
);
2926 void GLES2Implementation::BeginTransformFeedback(GLenum primitivemode
) {
2927 GPU_CLIENT_SINGLE_THREAD_CHECK();
2928 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBeginTransformFeedback("
2929 << GLES2Util::GetStringTransformFeedbackPrimitiveMode(
2930 primitivemode
) << ")");
2931 helper_
->BeginTransformFeedback(primitivemode
);
2935 void GLES2Implementation::EndTransformFeedback() {
2936 GPU_CLIENT_SINGLE_THREAD_CHECK();
2937 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glEndTransformFeedback("
2939 helper_
->EndTransformFeedback();
2943 void GLES2Implementation::GenVertexArraysOES(GLsizei n
, GLuint
* arrays
) {
2944 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGenVertexArraysOES(" << n
<< ", "
2945 << static_cast<const void*>(arrays
) << ")");
2947 SetGLError(GL_INVALID_VALUE
, "glGenVertexArraysOES", "n < 0");
2950 GPU_CLIENT_SINGLE_THREAD_CHECK();
2951 GetIdHandler(id_namespaces::kVertexArrays
)->MakeIds(this, 0, n
, arrays
);
2952 GenVertexArraysOESHelper(n
, arrays
);
2953 helper_
->GenVertexArraysOESImmediate(n
, arrays
);
2954 if (share_group_
->bind_generates_resource())
2955 helper_
->CommandBufferHelper::Flush();
2956 GPU_CLIENT_LOG_CODE_BLOCK({
2957 for (GLsizei i
= 0; i
< n
; ++i
) {
2958 GPU_CLIENT_LOG(" " << i
<< ": " << arrays
[i
]);
2964 void GLES2Implementation::DeleteVertexArraysOES(GLsizei n
,
2965 const GLuint
* arrays
) {
2966 GPU_CLIENT_SINGLE_THREAD_CHECK();
2967 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDeleteVertexArraysOES(" << n
2968 << ", " << static_cast<const void*>(arrays
) << ")");
2969 GPU_CLIENT_LOG_CODE_BLOCK({
2970 for (GLsizei i
= 0; i
< n
; ++i
) {
2971 GPU_CLIENT_LOG(" " << i
<< ": " << arrays
[i
]);
2974 GPU_CLIENT_DCHECK_CODE_BLOCK({
2975 for (GLsizei i
= 0; i
< n
; ++i
) {
2976 DCHECK(arrays
[i
] != 0);
2980 SetGLError(GL_INVALID_VALUE
, "glDeleteVertexArraysOES", "n < 0");
2983 DeleteVertexArraysOESHelper(n
, arrays
);
2987 GLboolean
GLES2Implementation::IsVertexArrayOES(GLuint array
) {
2988 GPU_CLIENT_SINGLE_THREAD_CHECK();
2989 TRACE_EVENT0("gpu", "GLES2Implementation::IsVertexArrayOES");
2990 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glIsVertexArrayOES(" << array
2992 typedef cmds::IsVertexArrayOES::Result Result
;
2993 Result
* result
= GetResultAs
<Result
*>();
2998 helper_
->IsVertexArrayOES(array
, GetResultShmId(), GetResultShmOffset());
3000 GLboolean result_value
= *result
!= 0;
3001 GPU_CLIENT_LOG("returned " << result_value
);
3003 return result_value
;
3006 void GLES2Implementation::BindVertexArrayOES(GLuint array
) {
3007 GPU_CLIENT_SINGLE_THREAD_CHECK();
3008 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBindVertexArrayOES(" << array
3010 if (IsVertexArrayReservedId(array
)) {
3011 SetGLError(GL_INVALID_OPERATION
, "BindVertexArrayOES", "array reserved id");
3014 BindVertexArrayOESHelper(array
);
3018 void GLES2Implementation::GetTranslatedShaderSourceANGLE(GLuint shader
,
3022 GPU_CLIENT_SINGLE_THREAD_CHECK();
3023 GPU_CLIENT_VALIDATE_DESTINATION_OPTIONAL_INITALIZATION(GLsizei
, length
);
3024 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetTranslatedShaderSourceANGLE"
3025 << "(" << shader
<< ", " << bufsize
<< ", "
3026 << static_cast<void*>(length
) << ", "
3027 << static_cast<void*>(source
) << ")");
3028 helper_
->SetBucketSize(kResultBucketId
, 0);
3029 helper_
->GetTranslatedShaderSourceANGLE(shader
, kResultBucketId
);
3031 GLsizei max_size
= 0;
3032 if (GetBucketAsString(kResultBucketId
, &str
)) {
3034 max_size
= std::min(static_cast<size_t>(bufsize
) - 1, str
.size());
3035 memcpy(source
, str
.c_str(), max_size
);
3036 source
[max_size
] = '\0';
3037 GPU_CLIENT_LOG("------\n" << source
<< "\n------");
3040 if (length
!= NULL
) {
3045 void GLES2Implementation::TexImageIOSurface2DCHROMIUM(GLenum target
,
3050 GPU_CLIENT_SINGLE_THREAD_CHECK();
3051 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glTexImageIOSurface2DCHROMIUM("
3052 << GLES2Util::GetStringTextureBindTarget(target
) << ", "
3053 << width
<< ", " << height
<< ", " << ioSurfaceId
<< ", "
3056 SetGLError(GL_INVALID_VALUE
, "glTexImageIOSurface2DCHROMIUM", "width < 0");
3060 SetGLError(GL_INVALID_VALUE
, "glTexImageIOSurface2DCHROMIUM", "height < 0");
3063 helper_
->TexImageIOSurface2DCHROMIUM(target
, width
, height
, ioSurfaceId
,
3068 void GLES2Implementation::CopyTextureCHROMIUM(GLenum target
,
3072 GLint internalformat
,
3074 GPU_CLIENT_SINGLE_THREAD_CHECK();
3075 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glCopyTextureCHROMIUM("
3076 << GLES2Util::GetStringEnum(target
) << ", "
3077 << GLES2Util::GetStringEnum(source_id
) << ", "
3078 << GLES2Util::GetStringEnum(dest_id
) << ", " << level
3079 << ", " << internalformat
<< ", "
3080 << GLES2Util::GetStringPixelType(dest_type
) << ")");
3081 helper_
->CopyTextureCHROMIUM(target
, source_id
, dest_id
, level
,
3082 internalformat
, dest_type
);
3086 void GLES2Implementation::GenValuebuffersCHROMIUM(GLsizei n
, GLuint
* buffers
) {
3087 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGenValuebuffersCHROMIUM(" << n
3088 << ", " << static_cast<const void*>(buffers
) << ")");
3090 SetGLError(GL_INVALID_VALUE
, "glGenValuebuffersCHROMIUM", "n < 0");
3093 GPU_CLIENT_SINGLE_THREAD_CHECK();
3094 GetIdHandler(id_namespaces::kValuebuffers
)->MakeIds(this, 0, n
, buffers
);
3095 GenValuebuffersCHROMIUMHelper(n
, buffers
);
3096 helper_
->GenValuebuffersCHROMIUMImmediate(n
, buffers
);
3097 if (share_group_
->bind_generates_resource())
3098 helper_
->CommandBufferHelper::Flush();
3099 GPU_CLIENT_LOG_CODE_BLOCK({
3100 for (GLsizei i
= 0; i
< n
; ++i
) {
3101 GPU_CLIENT_LOG(" " << i
<< ": " << buffers
[i
]);
3107 void GLES2Implementation::DeleteValuebuffersCHROMIUM(
3109 const GLuint
* valuebuffers
) {
3110 GPU_CLIENT_SINGLE_THREAD_CHECK();
3111 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDeleteValuebuffersCHROMIUM(" << n
3112 << ", " << static_cast<const void*>(valuebuffers
) << ")");
3113 GPU_CLIENT_LOG_CODE_BLOCK({
3114 for (GLsizei i
= 0; i
< n
; ++i
) {
3115 GPU_CLIENT_LOG(" " << i
<< ": " << valuebuffers
[i
]);
3118 GPU_CLIENT_DCHECK_CODE_BLOCK({
3119 for (GLsizei i
= 0; i
< n
; ++i
) {
3120 DCHECK(valuebuffers
[i
] != 0);
3124 SetGLError(GL_INVALID_VALUE
, "glDeleteValuebuffersCHROMIUM", "n < 0");
3127 DeleteValuebuffersCHROMIUMHelper(n
, valuebuffers
);
3131 GLboolean
GLES2Implementation::IsValuebufferCHROMIUM(GLuint valuebuffer
) {
3132 GPU_CLIENT_SINGLE_THREAD_CHECK();
3133 TRACE_EVENT0("gpu", "GLES2Implementation::IsValuebufferCHROMIUM");
3134 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glIsValuebufferCHROMIUM("
3135 << valuebuffer
<< ")");
3136 typedef cmds::IsValuebufferCHROMIUM::Result Result
;
3137 Result
* result
= GetResultAs
<Result
*>();
3142 helper_
->IsValuebufferCHROMIUM(valuebuffer
, GetResultShmId(),
3143 GetResultShmOffset());
3145 GLboolean result_value
= *result
!= 0;
3146 GPU_CLIENT_LOG("returned " << result_value
);
3148 return result_value
;
3151 void GLES2Implementation::BindValuebufferCHROMIUM(GLenum target
,
3152 GLuint valuebuffer
) {
3153 GPU_CLIENT_SINGLE_THREAD_CHECK();
3154 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBindValuebufferCHROMIUM("
3155 << GLES2Util::GetStringValueBufferTarget(target
) << ", "
3156 << valuebuffer
<< ")");
3157 if (IsValuebufferReservedId(valuebuffer
)) {
3158 SetGLError(GL_INVALID_OPERATION
, "BindValuebufferCHROMIUM",
3159 "valuebuffer reserved id");
3162 BindValuebufferCHROMIUMHelper(target
, valuebuffer
);
3166 void GLES2Implementation::SubscribeValueCHROMIUM(GLenum target
,
3167 GLenum subscription
) {
3168 GPU_CLIENT_SINGLE_THREAD_CHECK();
3169 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glSubscribeValueCHROMIUM("
3170 << GLES2Util::GetStringValueBufferTarget(target
) << ", "
3171 << GLES2Util::GetStringSubscriptionTarget(subscription
)
3173 helper_
->SubscribeValueCHROMIUM(target
, subscription
);
3177 void GLES2Implementation::PopulateSubscribedValuesCHROMIUM(GLenum target
) {
3178 GPU_CLIENT_SINGLE_THREAD_CHECK();
3179 GPU_CLIENT_LOG("[" << GetLogPrefix()
3180 << "] glPopulateSubscribedValuesCHROMIUM("
3181 << GLES2Util::GetStringValueBufferTarget(target
) << ")");
3182 helper_
->PopulateSubscribedValuesCHROMIUM(target
);
3186 void GLES2Implementation::UniformValuebufferCHROMIUM(GLint location
,
3188 GLenum subscription
) {
3189 GPU_CLIENT_SINGLE_THREAD_CHECK();
3191 "[" << GetLogPrefix() << "] glUniformValuebufferCHROMIUM(" << location
3192 << ", " << GLES2Util::GetStringValueBufferTarget(target
) << ", "
3193 << GLES2Util::GetStringSubscriptionTarget(subscription
) << ")");
3194 helper_
->UniformValuebufferCHROMIUM(location
, target
, subscription
);
3198 void GLES2Implementation::BindTexImage2DCHROMIUM(GLenum target
, GLint imageId
) {
3199 GPU_CLIENT_SINGLE_THREAD_CHECK();
3200 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBindTexImage2DCHROMIUM("
3201 << GLES2Util::GetStringTextureBindTarget(target
) << ", "
3203 helper_
->BindTexImage2DCHROMIUM(target
, imageId
);
3207 void GLES2Implementation::ReleaseTexImage2DCHROMIUM(GLenum target
,
3209 GPU_CLIENT_SINGLE_THREAD_CHECK();
3210 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glReleaseTexImage2DCHROMIUM("
3211 << GLES2Util::GetStringTextureBindTarget(target
) << ", "
3213 helper_
->ReleaseTexImage2DCHROMIUM(target
, imageId
);
3217 void GLES2Implementation::DiscardFramebufferEXT(GLenum target
,
3219 const GLenum
* attachments
) {
3220 GPU_CLIENT_SINGLE_THREAD_CHECK();
3221 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDiscardFramebufferEXT("
3222 << GLES2Util::GetStringEnum(target
) << ", " << count
3223 << ", " << static_cast<const void*>(attachments
) << ")");
3224 GPU_CLIENT_LOG_CODE_BLOCK({
3225 for (GLsizei i
= 0; i
< count
; ++i
) {
3226 GPU_CLIENT_LOG(" " << i
<< ": " << attachments
[0 + i
* 1]);
3230 SetGLError(GL_INVALID_VALUE
, "glDiscardFramebufferEXT", "count < 0");
3233 helper_
->DiscardFramebufferEXTImmediate(target
, count
, attachments
);
3237 void GLES2Implementation::LoseContextCHROMIUM(GLenum current
, GLenum other
) {
3238 GPU_CLIENT_SINGLE_THREAD_CHECK();
3239 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glLoseContextCHROMIUM("
3240 << GLES2Util::GetStringResetStatus(current
) << ", "
3241 << GLES2Util::GetStringResetStatus(other
) << ")");
3242 helper_
->LoseContextCHROMIUM(current
, other
);
3246 void GLES2Implementation::WaitSyncPointCHROMIUM(GLuint sync_point
) {
3247 GPU_CLIENT_SINGLE_THREAD_CHECK();
3248 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glWaitSyncPointCHROMIUM("
3249 << sync_point
<< ")");
3250 helper_
->WaitSyncPointCHROMIUM(sync_point
);
3254 void GLES2Implementation::DrawBuffersEXT(GLsizei count
, const GLenum
* bufs
) {
3255 GPU_CLIENT_SINGLE_THREAD_CHECK();
3256 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDrawBuffersEXT(" << count
<< ", "
3257 << static_cast<const void*>(bufs
) << ")");
3258 GPU_CLIENT_LOG_CODE_BLOCK({
3259 for (GLsizei i
= 0; i
< count
; ++i
) {
3260 GPU_CLIENT_LOG(" " << i
<< ": " << bufs
[0 + i
* 1]);
3264 SetGLError(GL_INVALID_VALUE
, "glDrawBuffersEXT", "count < 0");
3267 helper_
->DrawBuffersEXTImmediate(count
, bufs
);
3271 void GLES2Implementation::DiscardBackbufferCHROMIUM() {
3272 GPU_CLIENT_SINGLE_THREAD_CHECK();
3273 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDiscardBackbufferCHROMIUM("
3275 helper_
->DiscardBackbufferCHROMIUM();
3279 void GLES2Implementation::ScheduleOverlayPlaneCHROMIUM(
3280 GLint plane_z_order
,
3281 GLenum plane_transform
,
3282 GLuint overlay_texture_id
,
3286 GLint bounds_height
,
3290 GLfloat uv_height
) {
3291 GPU_CLIENT_SINGLE_THREAD_CHECK();
3293 "[" << GetLogPrefix() << "] glScheduleOverlayPlaneCHROMIUM("
3294 << plane_z_order
<< ", " << GLES2Util::GetStringEnum(plane_transform
)
3295 << ", " << overlay_texture_id
<< ", " << bounds_x
<< ", " << bounds_y
3296 << ", " << bounds_width
<< ", " << bounds_height
<< ", " << uv_x
3297 << ", " << uv_y
<< ", " << uv_width
<< ", " << uv_height
<< ")");
3298 helper_
->ScheduleOverlayPlaneCHROMIUM(
3299 plane_z_order
, plane_transform
, overlay_texture_id
, bounds_x
, bounds_y
,
3300 bounds_width
, bounds_height
, uv_x
, uv_y
, uv_width
, uv_height
);
3304 void GLES2Implementation::MatrixLoadfCHROMIUM(GLenum matrixMode
,
3306 GPU_CLIENT_SINGLE_THREAD_CHECK();
3307 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glMatrixLoadfCHROMIUM("
3308 << GLES2Util::GetStringMatrixMode(matrixMode
) << ", "
3309 << static_cast<const void*>(m
) << ")");
3311 for (size_t ii
= 0; ii
< count
; ++ii
)
3312 GPU_CLIENT_LOG("value[" << ii
<< "]: " << m
[ii
]);
3313 helper_
->MatrixLoadfCHROMIUMImmediate(matrixMode
, m
);
3317 void GLES2Implementation::MatrixLoadIdentityCHROMIUM(GLenum matrixMode
) {
3318 GPU_CLIENT_SINGLE_THREAD_CHECK();
3319 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glMatrixLoadIdentityCHROMIUM("
3320 << GLES2Util::GetStringMatrixMode(matrixMode
) << ")");
3321 helper_
->MatrixLoadIdentityCHROMIUM(matrixMode
);
3325 void GLES2Implementation::BlendBarrierKHR() {
3326 GPU_CLIENT_SINGLE_THREAD_CHECK();
3327 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBlendBarrierKHR("
3329 helper_
->BlendBarrierKHR();
3333 #endif // GPU_COMMAND_BUFFER_CLIENT_GLES2_IMPLEMENTATION_IMPL_AUTOGEN_H_