1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 // This file is auto-generated from
6 // gpu/command_buffer/build_gles2_cmd_buffer.py
7 // It's formatted by clang-format using chromium coding style:
8 // clang-format -i -style=chromium filename
11 // This file is included by gles2_implementation.cc to define the
13 #ifndef GPU_COMMAND_BUFFER_CLIENT_GLES2_IMPLEMENTATION_IMPL_AUTOGEN_H_
14 #define GPU_COMMAND_BUFFER_CLIENT_GLES2_IMPLEMENTATION_IMPL_AUTOGEN_H_
16 void GLES2Implementation::AttachShader(GLuint program
, GLuint shader
) {
17 GPU_CLIENT_SINGLE_THREAD_CHECK();
18 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glAttachShader(" << program
<< ", "
20 helper_
->AttachShader(program
, shader
);
24 void GLES2Implementation::BindBuffer(GLenum target
, GLuint buffer
) {
25 GPU_CLIENT_SINGLE_THREAD_CHECK();
26 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBindBuffer("
27 << GLES2Util::GetStringBufferTarget(target
) << ", "
29 if (IsBufferReservedId(buffer
)) {
30 SetGLError(GL_INVALID_OPERATION
, "BindBuffer", "buffer reserved id");
33 BindBufferHelper(target
, buffer
);
37 void GLES2Implementation::BindBufferBase(GLenum target
,
40 GPU_CLIENT_SINGLE_THREAD_CHECK();
41 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBindBufferBase("
42 << GLES2Util::GetStringIndexedBufferTarget(target
) << ", "
43 << index
<< ", " << buffer
<< ")");
44 if (IsBufferReservedId(buffer
)) {
45 SetGLError(GL_INVALID_OPERATION
, "BindBufferBase", "buffer reserved id");
48 BindBufferBaseHelper(target
, index
, buffer
);
52 void GLES2Implementation::BindBufferRange(GLenum target
,
57 GPU_CLIENT_SINGLE_THREAD_CHECK();
58 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBindBufferRange("
59 << GLES2Util::GetStringIndexedBufferTarget(target
) << ", "
60 << index
<< ", " << buffer
<< ", " << offset
<< ", "
63 SetGLError(GL_INVALID_VALUE
, "glBindBufferRange", "offset < 0");
67 SetGLError(GL_INVALID_VALUE
, "glBindBufferRange", "size < 0");
70 if (IsBufferReservedId(buffer
)) {
71 SetGLError(GL_INVALID_OPERATION
, "BindBufferRange", "buffer reserved id");
74 BindBufferRangeHelper(target
, index
, buffer
, offset
, size
);
78 void GLES2Implementation::BindFramebuffer(GLenum target
, GLuint framebuffer
) {
79 GPU_CLIENT_SINGLE_THREAD_CHECK();
80 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBindFramebuffer("
81 << GLES2Util::GetStringFrameBufferTarget(target
) << ", "
82 << framebuffer
<< ")");
83 if (IsFramebufferReservedId(framebuffer
)) {
84 SetGLError(GL_INVALID_OPERATION
, "BindFramebuffer",
85 "framebuffer reserved id");
88 BindFramebufferHelper(target
, framebuffer
);
92 void GLES2Implementation::BindRenderbuffer(GLenum target
, GLuint renderbuffer
) {
93 GPU_CLIENT_SINGLE_THREAD_CHECK();
94 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBindRenderbuffer("
95 << GLES2Util::GetStringRenderBufferTarget(target
) << ", "
96 << renderbuffer
<< ")");
97 if (IsRenderbufferReservedId(renderbuffer
)) {
98 SetGLError(GL_INVALID_OPERATION
, "BindRenderbuffer",
99 "renderbuffer reserved id");
102 BindRenderbufferHelper(target
, renderbuffer
);
106 void GLES2Implementation::BindSampler(GLuint unit
, GLuint sampler
) {
107 GPU_CLIENT_SINGLE_THREAD_CHECK();
108 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBindSampler(" << unit
<< ", "
110 if (IsSamplerReservedId(sampler
)) {
111 SetGLError(GL_INVALID_OPERATION
, "BindSampler", "sampler reserved id");
114 BindSamplerHelper(unit
, sampler
);
118 void GLES2Implementation::BindTexture(GLenum target
, GLuint texture
) {
119 GPU_CLIENT_SINGLE_THREAD_CHECK();
120 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBindTexture("
121 << GLES2Util::GetStringTextureBindTarget(target
) << ", "
123 if (IsTextureReservedId(texture
)) {
124 SetGLError(GL_INVALID_OPERATION
, "BindTexture", "texture reserved id");
127 BindTextureHelper(target
, texture
);
131 void GLES2Implementation::BindTransformFeedback(GLenum target
,
132 GLuint transformfeedback
) {
133 GPU_CLIENT_SINGLE_THREAD_CHECK();
134 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBindTransformFeedback("
135 << GLES2Util::GetStringTransformFeedbackBindTarget(target
)
136 << ", " << transformfeedback
<< ")");
137 if (IsTransformFeedbackReservedId(transformfeedback
)) {
138 SetGLError(GL_INVALID_OPERATION
, "BindTransformFeedback",
139 "transformfeedback reserved id");
142 BindTransformFeedbackHelper(target
, transformfeedback
);
146 void GLES2Implementation::BlendColor(GLclampf red
,
150 GPU_CLIENT_SINGLE_THREAD_CHECK();
151 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBlendColor(" << red
<< ", "
152 << green
<< ", " << blue
<< ", " << alpha
<< ")");
153 helper_
->BlendColor(red
, green
, blue
, alpha
);
157 void GLES2Implementation::BlendEquation(GLenum mode
) {
158 GPU_CLIENT_SINGLE_THREAD_CHECK();
159 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBlendEquation("
160 << GLES2Util::GetStringEquation(mode
) << ")");
161 helper_
->BlendEquation(mode
);
165 void GLES2Implementation::BlendEquationSeparate(GLenum modeRGB
,
167 GPU_CLIENT_SINGLE_THREAD_CHECK();
168 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBlendEquationSeparate("
169 << GLES2Util::GetStringEquation(modeRGB
) << ", "
170 << GLES2Util::GetStringEquation(modeAlpha
) << ")");
171 helper_
->BlendEquationSeparate(modeRGB
, modeAlpha
);
175 void GLES2Implementation::BlendFunc(GLenum sfactor
, GLenum dfactor
) {
176 GPU_CLIENT_SINGLE_THREAD_CHECK();
177 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBlendFunc("
178 << GLES2Util::GetStringSrcBlendFactor(sfactor
) << ", "
179 << GLES2Util::GetStringDstBlendFactor(dfactor
) << ")");
180 helper_
->BlendFunc(sfactor
, dfactor
);
184 void GLES2Implementation::BlendFuncSeparate(GLenum srcRGB
,
188 GPU_CLIENT_SINGLE_THREAD_CHECK();
189 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBlendFuncSeparate("
190 << GLES2Util::GetStringSrcBlendFactor(srcRGB
) << ", "
191 << GLES2Util::GetStringDstBlendFactor(dstRGB
) << ", "
192 << GLES2Util::GetStringSrcBlendFactor(srcAlpha
) << ", "
193 << GLES2Util::GetStringDstBlendFactor(dstAlpha
) << ")");
194 helper_
->BlendFuncSeparate(srcRGB
, dstRGB
, srcAlpha
, dstAlpha
);
198 GLenum
GLES2Implementation::CheckFramebufferStatus(GLenum target
) {
199 GPU_CLIENT_SINGLE_THREAD_CHECK();
200 TRACE_EVENT0("gpu", "GLES2Implementation::CheckFramebufferStatus");
201 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glCheckFramebufferStatus("
202 << GLES2Util::GetStringFrameBufferTarget(target
) << ")");
203 typedef cmds::CheckFramebufferStatus::Result Result
;
204 Result
* result
= GetResultAs
<Result
*>();
206 return GL_FRAMEBUFFER_UNSUPPORTED
;
209 helper_
->CheckFramebufferStatus(target
, GetResultShmId(),
210 GetResultShmOffset());
212 GLenum result_value
= *result
;
213 GPU_CLIENT_LOG("returned " << result_value
);
218 void GLES2Implementation::Clear(GLbitfield mask
) {
219 GPU_CLIENT_SINGLE_THREAD_CHECK();
220 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glClear(" << mask
<< ")");
221 helper_
->Clear(mask
);
225 void GLES2Implementation::ClearBufferfi(GLenum buffer
,
229 GPU_CLIENT_SINGLE_THREAD_CHECK();
230 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glClearBufferfi("
231 << GLES2Util::GetStringBufferfv(buffer
) << ", "
232 << drawbuffers
<< ", " << depth
<< ", " << stencil
<< ")");
233 helper_
->ClearBufferfi(buffer
, drawbuffers
, depth
, stencil
);
237 void GLES2Implementation::ClearBufferfv(GLenum buffer
,
239 const GLfloat
* value
) {
240 GPU_CLIENT_SINGLE_THREAD_CHECK();
241 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glClearBufferfv("
242 << GLES2Util::GetStringBufferfv(buffer
) << ", "
243 << drawbuffers
<< ", " << static_cast<const void*>(value
)
245 size_t count
= GLES2Util::CalcClearBufferfvDataCount(buffer
);
246 DCHECK_LE(count
, 4u);
247 for (size_t ii
= 0; ii
< count
; ++ii
)
248 GPU_CLIENT_LOG("value[" << ii
<< "]: " << value
[ii
]);
249 helper_
->ClearBufferfvImmediate(buffer
, drawbuffers
, value
);
253 void GLES2Implementation::ClearBufferiv(GLenum buffer
,
255 const GLint
* value
) {
256 GPU_CLIENT_SINGLE_THREAD_CHECK();
257 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glClearBufferiv("
258 << GLES2Util::GetStringBufferiv(buffer
) << ", "
259 << drawbuffers
<< ", " << static_cast<const void*>(value
)
261 size_t count
= GLES2Util::CalcClearBufferivDataCount(buffer
);
262 DCHECK_LE(count
, 4u);
263 for (size_t ii
= 0; ii
< count
; ++ii
)
264 GPU_CLIENT_LOG("value[" << ii
<< "]: " << value
[ii
]);
265 helper_
->ClearBufferivImmediate(buffer
, drawbuffers
, value
);
269 void GLES2Implementation::ClearBufferuiv(GLenum buffer
,
271 const GLuint
* value
) {
272 GPU_CLIENT_SINGLE_THREAD_CHECK();
273 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glClearBufferuiv("
274 << GLES2Util::GetStringBufferuiv(buffer
) << ", "
275 << drawbuffers
<< ", " << static_cast<const void*>(value
)
278 for (size_t ii
= 0; ii
< count
; ++ii
)
279 GPU_CLIENT_LOG("value[" << ii
<< "]: " << value
[ii
]);
280 helper_
->ClearBufferuivImmediate(buffer
, drawbuffers
, value
);
284 void GLES2Implementation::ClearColor(GLclampf red
,
288 GPU_CLIENT_SINGLE_THREAD_CHECK();
289 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glClearColor(" << red
<< ", "
290 << green
<< ", " << blue
<< ", " << alpha
<< ")");
291 helper_
->ClearColor(red
, green
, blue
, alpha
);
295 void GLES2Implementation::ClearDepthf(GLclampf depth
) {
296 GPU_CLIENT_SINGLE_THREAD_CHECK();
297 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glClearDepthf(" << depth
<< ")");
298 helper_
->ClearDepthf(depth
);
302 void GLES2Implementation::ClearStencil(GLint s
) {
303 GPU_CLIENT_SINGLE_THREAD_CHECK();
304 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glClearStencil(" << s
<< ")");
305 helper_
->ClearStencil(s
);
309 void GLES2Implementation::ColorMask(GLboolean red
,
313 GPU_CLIENT_SINGLE_THREAD_CHECK();
314 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glColorMask("
315 << GLES2Util::GetStringBool(red
) << ", "
316 << GLES2Util::GetStringBool(green
) << ", "
317 << GLES2Util::GetStringBool(blue
) << ", "
318 << GLES2Util::GetStringBool(alpha
) << ")");
319 helper_
->ColorMask(red
, green
, blue
, alpha
);
323 void GLES2Implementation::CompileShader(GLuint shader
) {
324 GPU_CLIENT_SINGLE_THREAD_CHECK();
325 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glCompileShader(" << shader
327 helper_
->CompileShader(shader
);
331 void GLES2Implementation::CopyBufferSubData(GLenum readtarget
,
334 GLintptr writeoffset
,
336 GPU_CLIENT_SINGLE_THREAD_CHECK();
337 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glCopyBufferSubData("
338 << GLES2Util::GetStringBufferTarget(readtarget
) << ", "
339 << GLES2Util::GetStringBufferTarget(writetarget
) << ", "
340 << readoffset
<< ", " << writeoffset
<< ", " << size
342 if (readoffset
< 0) {
343 SetGLError(GL_INVALID_VALUE
, "glCopyBufferSubData", "readoffset < 0");
346 if (writeoffset
< 0) {
347 SetGLError(GL_INVALID_VALUE
, "glCopyBufferSubData", "writeoffset < 0");
351 SetGLError(GL_INVALID_VALUE
, "glCopyBufferSubData", "size < 0");
354 helper_
->CopyBufferSubData(readtarget
, writetarget
, readoffset
, writeoffset
,
359 void GLES2Implementation::CopyTexImage2D(GLenum target
,
361 GLenum internalformat
,
367 GPU_CLIENT_SINGLE_THREAD_CHECK();
369 "[" << GetLogPrefix() << "] glCopyTexImage2D("
370 << GLES2Util::GetStringTextureTarget(target
) << ", " << level
<< ", "
371 << GLES2Util::GetStringTextureInternalFormat(internalformat
) << ", "
372 << x
<< ", " << y
<< ", " << width
<< ", " << height
<< ", " << border
375 SetGLError(GL_INVALID_VALUE
, "glCopyTexImage2D", "width < 0");
379 SetGLError(GL_INVALID_VALUE
, "glCopyTexImage2D", "height < 0");
383 SetGLError(GL_INVALID_VALUE
, "glCopyTexImage2D", "border GL_INVALID_VALUE");
386 helper_
->CopyTexImage2D(target
, level
, internalformat
, x
, y
, width
, height
);
390 void GLES2Implementation::CopyTexSubImage2D(GLenum target
,
398 GPU_CLIENT_SINGLE_THREAD_CHECK();
399 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glCopyTexSubImage2D("
400 << GLES2Util::GetStringTextureTarget(target
) << ", "
401 << level
<< ", " << xoffset
<< ", " << yoffset
<< ", " << x
402 << ", " << y
<< ", " << width
<< ", " << height
<< ")");
404 SetGLError(GL_INVALID_VALUE
, "glCopyTexSubImage2D", "width < 0");
408 SetGLError(GL_INVALID_VALUE
, "glCopyTexSubImage2D", "height < 0");
411 helper_
->CopyTexSubImage2D(target
, level
, xoffset
, yoffset
, x
, y
, width
,
416 void GLES2Implementation::CopyTexSubImage3D(GLenum target
,
425 GPU_CLIENT_SINGLE_THREAD_CHECK();
426 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glCopyTexSubImage3D("
427 << GLES2Util::GetStringTexture3DTarget(target
) << ", "
428 << level
<< ", " << xoffset
<< ", " << yoffset
<< ", "
429 << zoffset
<< ", " << x
<< ", " << y
<< ", " << width
430 << ", " << height
<< ")");
432 SetGLError(GL_INVALID_VALUE
, "glCopyTexSubImage3D", "width < 0");
436 SetGLError(GL_INVALID_VALUE
, "glCopyTexSubImage3D", "height < 0");
439 helper_
->CopyTexSubImage3D(target
, level
, xoffset
, yoffset
, zoffset
, x
, y
,
444 GLuint
GLES2Implementation::CreateProgram() {
445 GPU_CLIENT_SINGLE_THREAD_CHECK();
446 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glCreateProgram("
449 GetIdHandler(id_namespaces::kProgramsAndShaders
)
450 ->MakeIds(this, 0, 1, &client_id
);
451 helper_
->CreateProgram(client_id
);
452 GPU_CLIENT_LOG("returned " << client_id
);
457 GLuint
GLES2Implementation::CreateShader(GLenum type
) {
458 GPU_CLIENT_SINGLE_THREAD_CHECK();
459 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glCreateShader("
460 << GLES2Util::GetStringShaderType(type
) << ")");
462 GetIdHandler(id_namespaces::kProgramsAndShaders
)
463 ->MakeIds(this, 0, 1, &client_id
);
464 helper_
->CreateShader(type
, client_id
);
465 GPU_CLIENT_LOG("returned " << client_id
);
470 void GLES2Implementation::CullFace(GLenum mode
) {
471 GPU_CLIENT_SINGLE_THREAD_CHECK();
472 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glCullFace("
473 << GLES2Util::GetStringFaceType(mode
) << ")");
474 helper_
->CullFace(mode
);
478 void GLES2Implementation::DeleteBuffers(GLsizei n
, const GLuint
* buffers
) {
479 GPU_CLIENT_SINGLE_THREAD_CHECK();
480 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDeleteBuffers(" << n
<< ", "
481 << static_cast<const void*>(buffers
) << ")");
482 GPU_CLIENT_LOG_CODE_BLOCK({
483 for (GLsizei i
= 0; i
< n
; ++i
) {
484 GPU_CLIENT_LOG(" " << i
<< ": " << buffers
[i
]);
487 GPU_CLIENT_DCHECK_CODE_BLOCK({
488 for (GLsizei i
= 0; i
< n
; ++i
) {
489 DCHECK(buffers
[i
] != 0);
493 SetGLError(GL_INVALID_VALUE
, "glDeleteBuffers", "n < 0");
496 DeleteBuffersHelper(n
, buffers
);
500 void GLES2Implementation::DeleteFramebuffers(GLsizei n
,
501 const GLuint
* framebuffers
) {
502 GPU_CLIENT_SINGLE_THREAD_CHECK();
503 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDeleteFramebuffers(" << n
<< ", "
504 << static_cast<const void*>(framebuffers
) << ")");
505 GPU_CLIENT_LOG_CODE_BLOCK({
506 for (GLsizei i
= 0; i
< n
; ++i
) {
507 GPU_CLIENT_LOG(" " << i
<< ": " << framebuffers
[i
]);
510 GPU_CLIENT_DCHECK_CODE_BLOCK({
511 for (GLsizei i
= 0; i
< n
; ++i
) {
512 DCHECK(framebuffers
[i
] != 0);
516 SetGLError(GL_INVALID_VALUE
, "glDeleteFramebuffers", "n < 0");
519 DeleteFramebuffersHelper(n
, framebuffers
);
523 void GLES2Implementation::DeleteProgram(GLuint program
) {
524 GPU_CLIENT_SINGLE_THREAD_CHECK();
525 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDeleteProgram(" << program
527 GPU_CLIENT_DCHECK(program
!= 0);
528 DeleteProgramHelper(program
);
532 void GLES2Implementation::DeleteRenderbuffers(GLsizei n
,
533 const GLuint
* renderbuffers
) {
534 GPU_CLIENT_SINGLE_THREAD_CHECK();
535 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDeleteRenderbuffers(" << n
536 << ", " << static_cast<const void*>(renderbuffers
) << ")");
537 GPU_CLIENT_LOG_CODE_BLOCK({
538 for (GLsizei i
= 0; i
< n
; ++i
) {
539 GPU_CLIENT_LOG(" " << i
<< ": " << renderbuffers
[i
]);
542 GPU_CLIENT_DCHECK_CODE_BLOCK({
543 for (GLsizei i
= 0; i
< n
; ++i
) {
544 DCHECK(renderbuffers
[i
] != 0);
548 SetGLError(GL_INVALID_VALUE
, "glDeleteRenderbuffers", "n < 0");
551 DeleteRenderbuffersHelper(n
, renderbuffers
);
555 void GLES2Implementation::DeleteSamplers(GLsizei n
, const GLuint
* samplers
) {
556 GPU_CLIENT_SINGLE_THREAD_CHECK();
557 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDeleteSamplers(" << n
<< ", "
558 << static_cast<const void*>(samplers
) << ")");
559 GPU_CLIENT_LOG_CODE_BLOCK({
560 for (GLsizei i
= 0; i
< n
; ++i
) {
561 GPU_CLIENT_LOG(" " << i
<< ": " << samplers
[i
]);
564 GPU_CLIENT_DCHECK_CODE_BLOCK({
565 for (GLsizei i
= 0; i
< n
; ++i
) {
566 DCHECK(samplers
[i
] != 0);
570 SetGLError(GL_INVALID_VALUE
, "glDeleteSamplers", "n < 0");
573 DeleteSamplersHelper(n
, samplers
);
577 void GLES2Implementation::DeleteSync(GLsync sync
) {
578 GPU_CLIENT_SINGLE_THREAD_CHECK();
579 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDeleteSync(" << sync
<< ")");
580 GPU_CLIENT_DCHECK(sync
!= 0);
581 DeleteSyncHelper(sync
);
585 void GLES2Implementation::DeleteShader(GLuint shader
) {
586 GPU_CLIENT_SINGLE_THREAD_CHECK();
587 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDeleteShader(" << shader
<< ")");
588 GPU_CLIENT_DCHECK(shader
!= 0);
589 DeleteShaderHelper(shader
);
593 void GLES2Implementation::DeleteTextures(GLsizei n
, const GLuint
* textures
) {
594 GPU_CLIENT_SINGLE_THREAD_CHECK();
595 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDeleteTextures(" << n
<< ", "
596 << static_cast<const void*>(textures
) << ")");
597 GPU_CLIENT_LOG_CODE_BLOCK({
598 for (GLsizei i
= 0; i
< n
; ++i
) {
599 GPU_CLIENT_LOG(" " << i
<< ": " << textures
[i
]);
602 GPU_CLIENT_DCHECK_CODE_BLOCK({
603 for (GLsizei i
= 0; i
< n
; ++i
) {
604 DCHECK(textures
[i
] != 0);
608 SetGLError(GL_INVALID_VALUE
, "glDeleteTextures", "n < 0");
611 DeleteTexturesHelper(n
, textures
);
615 void GLES2Implementation::DeleteTransformFeedbacks(GLsizei n
,
617 GPU_CLIENT_SINGLE_THREAD_CHECK();
618 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDeleteTransformFeedbacks(" << n
619 << ", " << static_cast<const void*>(ids
) << ")");
620 GPU_CLIENT_LOG_CODE_BLOCK({
621 for (GLsizei i
= 0; i
< n
; ++i
) {
622 GPU_CLIENT_LOG(" " << i
<< ": " << ids
[i
]);
625 GPU_CLIENT_DCHECK_CODE_BLOCK({
626 for (GLsizei i
= 0; i
< n
; ++i
) {
631 SetGLError(GL_INVALID_VALUE
, "glDeleteTransformFeedbacks", "n < 0");
634 DeleteTransformFeedbacksHelper(n
, ids
);
638 void GLES2Implementation::DepthFunc(GLenum func
) {
639 GPU_CLIENT_SINGLE_THREAD_CHECK();
640 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDepthFunc("
641 << GLES2Util::GetStringCmpFunction(func
) << ")");
642 helper_
->DepthFunc(func
);
646 void GLES2Implementation::DepthMask(GLboolean flag
) {
647 GPU_CLIENT_SINGLE_THREAD_CHECK();
648 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDepthMask("
649 << GLES2Util::GetStringBool(flag
) << ")");
650 helper_
->DepthMask(flag
);
654 void GLES2Implementation::DepthRangef(GLclampf zNear
, GLclampf zFar
) {
655 GPU_CLIENT_SINGLE_THREAD_CHECK();
656 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDepthRangef(" << zNear
<< ", "
658 helper_
->DepthRangef(zNear
, zFar
);
662 void GLES2Implementation::DetachShader(GLuint program
, GLuint shader
) {
663 GPU_CLIENT_SINGLE_THREAD_CHECK();
664 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDetachShader(" << program
<< ", "
666 helper_
->DetachShader(program
, shader
);
670 GLsync
GLES2Implementation::FenceSync(GLenum condition
, GLbitfield flags
) {
671 GPU_CLIENT_SINGLE_THREAD_CHECK();
672 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glFenceSync("
673 << GLES2Util::GetStringSyncCondition(condition
) << ", "
675 if (condition
!= GL_SYNC_GPU_COMMANDS_COMPLETE
) {
676 SetGLError(GL_INVALID_ENUM
, "glFenceSync", "condition GL_INVALID_ENUM");
680 SetGLError(GL_INVALID_VALUE
, "glFenceSync", "flags GL_INVALID_VALUE");
684 GetIdHandler(id_namespaces::kSyncs
)->MakeIds(this, 0, 1, &client_id
);
685 helper_
->FenceSync(client_id
);
686 GPU_CLIENT_LOG("returned " << client_id
);
688 return reinterpret_cast<GLsync
>(client_id
);
691 void GLES2Implementation::FramebufferRenderbuffer(GLenum target
,
693 GLenum renderbuffertarget
,
694 GLuint renderbuffer
) {
695 GPU_CLIENT_SINGLE_THREAD_CHECK();
696 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glFramebufferRenderbuffer("
697 << GLES2Util::GetStringFrameBufferTarget(target
) << ", "
698 << GLES2Util::GetStringAttachment(attachment
) << ", "
699 << GLES2Util::GetStringRenderBufferTarget(
700 renderbuffertarget
) << ", " << renderbuffer
<< ")");
701 helper_
->FramebufferRenderbuffer(target
, attachment
, renderbuffertarget
,
706 void GLES2Implementation::FramebufferTexture2D(GLenum target
,
711 GPU_CLIENT_SINGLE_THREAD_CHECK();
712 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glFramebufferTexture2D("
713 << GLES2Util::GetStringFrameBufferTarget(target
) << ", "
714 << GLES2Util::GetStringAttachment(attachment
) << ", "
715 << GLES2Util::GetStringTextureTarget(textarget
) << ", "
716 << texture
<< ", " << level
<< ")");
718 SetGLError(GL_INVALID_VALUE
, "glFramebufferTexture2D",
719 "level GL_INVALID_VALUE");
722 helper_
->FramebufferTexture2D(target
, attachment
, textarget
, texture
);
726 void GLES2Implementation::FramebufferTextureLayer(GLenum target
,
731 GPU_CLIENT_SINGLE_THREAD_CHECK();
732 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glFramebufferTextureLayer("
733 << GLES2Util::GetStringFrameBufferTarget(target
) << ", "
734 << GLES2Util::GetStringAttachment(attachment
) << ", "
735 << texture
<< ", " << level
<< ", " << layer
<< ")");
736 helper_
->FramebufferTextureLayer(target
, attachment
, texture
, level
, layer
);
740 void GLES2Implementation::FrontFace(GLenum mode
) {
741 GPU_CLIENT_SINGLE_THREAD_CHECK();
742 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glFrontFace("
743 << GLES2Util::GetStringFaceMode(mode
) << ")");
744 helper_
->FrontFace(mode
);
748 void GLES2Implementation::GenBuffers(GLsizei n
, GLuint
* buffers
) {
749 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGenBuffers(" << n
<< ", "
750 << static_cast<const void*>(buffers
) << ")");
752 SetGLError(GL_INVALID_VALUE
, "glGenBuffers", "n < 0");
755 GPU_CLIENT_SINGLE_THREAD_CHECK();
756 GetIdHandler(id_namespaces::kBuffers
)->MakeIds(this, 0, n
, buffers
);
757 GenBuffersHelper(n
, buffers
);
758 helper_
->GenBuffersImmediate(n
, buffers
);
759 if (share_group_
->bind_generates_resource())
760 helper_
->CommandBufferHelper::Flush();
761 GPU_CLIENT_LOG_CODE_BLOCK({
762 for (GLsizei i
= 0; i
< n
; ++i
) {
763 GPU_CLIENT_LOG(" " << i
<< ": " << buffers
[i
]);
769 void GLES2Implementation::GenerateMipmap(GLenum target
) {
770 GPU_CLIENT_SINGLE_THREAD_CHECK();
771 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGenerateMipmap("
772 << GLES2Util::GetStringTextureBindTarget(target
) << ")");
773 helper_
->GenerateMipmap(target
);
777 void GLES2Implementation::GenFramebuffers(GLsizei n
, GLuint
* framebuffers
) {
778 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGenFramebuffers(" << n
<< ", "
779 << static_cast<const void*>(framebuffers
) << ")");
781 SetGLError(GL_INVALID_VALUE
, "glGenFramebuffers", "n < 0");
784 GPU_CLIENT_SINGLE_THREAD_CHECK();
785 GetIdHandler(id_namespaces::kFramebuffers
)->MakeIds(this, 0, n
, framebuffers
);
786 GenFramebuffersHelper(n
, framebuffers
);
787 helper_
->GenFramebuffersImmediate(n
, framebuffers
);
788 if (share_group_
->bind_generates_resource())
789 helper_
->CommandBufferHelper::Flush();
790 GPU_CLIENT_LOG_CODE_BLOCK({
791 for (GLsizei i
= 0; i
< n
; ++i
) {
792 GPU_CLIENT_LOG(" " << i
<< ": " << framebuffers
[i
]);
798 void GLES2Implementation::GenRenderbuffers(GLsizei n
, GLuint
* renderbuffers
) {
799 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGenRenderbuffers(" << n
<< ", "
800 << static_cast<const void*>(renderbuffers
) << ")");
802 SetGLError(GL_INVALID_VALUE
, "glGenRenderbuffers", "n < 0");
805 GPU_CLIENT_SINGLE_THREAD_CHECK();
806 GetIdHandler(id_namespaces::kRenderbuffers
)
807 ->MakeIds(this, 0, n
, renderbuffers
);
808 GenRenderbuffersHelper(n
, renderbuffers
);
809 helper_
->GenRenderbuffersImmediate(n
, renderbuffers
);
810 if (share_group_
->bind_generates_resource())
811 helper_
->CommandBufferHelper::Flush();
812 GPU_CLIENT_LOG_CODE_BLOCK({
813 for (GLsizei i
= 0; i
< n
; ++i
) {
814 GPU_CLIENT_LOG(" " << i
<< ": " << renderbuffers
[i
]);
820 void GLES2Implementation::GenSamplers(GLsizei n
, GLuint
* samplers
) {
821 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGenSamplers(" << n
<< ", "
822 << static_cast<const void*>(samplers
) << ")");
824 SetGLError(GL_INVALID_VALUE
, "glGenSamplers", "n < 0");
827 GPU_CLIENT_SINGLE_THREAD_CHECK();
828 GetIdHandler(id_namespaces::kSamplers
)->MakeIds(this, 0, n
, samplers
);
829 GenSamplersHelper(n
, samplers
);
830 helper_
->GenSamplersImmediate(n
, samplers
);
831 if (share_group_
->bind_generates_resource())
832 helper_
->CommandBufferHelper::Flush();
833 GPU_CLIENT_LOG_CODE_BLOCK({
834 for (GLsizei i
= 0; i
< n
; ++i
) {
835 GPU_CLIENT_LOG(" " << i
<< ": " << samplers
[i
]);
841 void GLES2Implementation::GenTextures(GLsizei n
, GLuint
* textures
) {
842 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGenTextures(" << n
<< ", "
843 << static_cast<const void*>(textures
) << ")");
845 SetGLError(GL_INVALID_VALUE
, "glGenTextures", "n < 0");
848 GPU_CLIENT_SINGLE_THREAD_CHECK();
849 GetIdHandler(id_namespaces::kTextures
)->MakeIds(this, 0, n
, textures
);
850 GenTexturesHelper(n
, textures
);
851 helper_
->GenTexturesImmediate(n
, textures
);
852 if (share_group_
->bind_generates_resource())
853 helper_
->CommandBufferHelper::Flush();
854 GPU_CLIENT_LOG_CODE_BLOCK({
855 for (GLsizei i
= 0; i
< n
; ++i
) {
856 GPU_CLIENT_LOG(" " << i
<< ": " << textures
[i
]);
862 void GLES2Implementation::GenTransformFeedbacks(GLsizei n
, GLuint
* ids
) {
863 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGenTransformFeedbacks(" << n
864 << ", " << static_cast<const void*>(ids
) << ")");
866 SetGLError(GL_INVALID_VALUE
, "glGenTransformFeedbacks", "n < 0");
869 GPU_CLIENT_SINGLE_THREAD_CHECK();
870 GetIdHandler(id_namespaces::kTransformFeedbacks
)->MakeIds(this, 0, n
, ids
);
871 GenTransformFeedbacksHelper(n
, ids
);
872 helper_
->GenTransformFeedbacksImmediate(n
, ids
);
873 if (share_group_
->bind_generates_resource())
874 helper_
->CommandBufferHelper::Flush();
875 GPU_CLIENT_LOG_CODE_BLOCK({
876 for (GLsizei i
= 0; i
< n
; ++i
) {
877 GPU_CLIENT_LOG(" " << i
<< ": " << ids
[i
]);
883 void GLES2Implementation::GetBooleanv(GLenum pname
, GLboolean
* params
) {
884 GPU_CLIENT_SINGLE_THREAD_CHECK();
885 GPU_CLIENT_VALIDATE_DESTINATION_INITALIZATION(GLboolean
, params
);
886 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetBooleanv("
887 << GLES2Util::GetStringGLState(pname
) << ", "
888 << static_cast<const void*>(params
) << ")");
889 TRACE_EVENT0("gpu", "GLES2Implementation::GetBooleanv");
890 if (GetBooleanvHelper(pname
, params
)) {
893 typedef cmds::GetBooleanv::Result Result
;
894 Result
* result
= GetResultAs
<Result
*>();
898 result
->SetNumResults(0);
899 helper_
->GetBooleanv(pname
, GetResultShmId(), GetResultShmOffset());
901 result
->CopyResult(params
);
902 GPU_CLIENT_LOG_CODE_BLOCK({
903 for (int32_t i
= 0; i
< result
->GetNumResults(); ++i
) {
904 GPU_CLIENT_LOG(" " << i
<< ": " << result
->GetData()[i
]);
909 void GLES2Implementation::GetBufferParameteriv(GLenum target
,
912 GPU_CLIENT_SINGLE_THREAD_CHECK();
913 GPU_CLIENT_VALIDATE_DESTINATION_INITALIZATION(GLint
, params
);
914 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetBufferParameteriv("
915 << GLES2Util::GetStringBufferTarget(target
) << ", "
916 << GLES2Util::GetStringBufferParameter(pname
) << ", "
917 << static_cast<const void*>(params
) << ")");
918 TRACE_EVENT0("gpu", "GLES2Implementation::GetBufferParameteriv");
919 if (GetBufferParameterivHelper(target
, pname
, params
)) {
922 typedef cmds::GetBufferParameteriv::Result Result
;
923 Result
* result
= GetResultAs
<Result
*>();
927 result
->SetNumResults(0);
928 helper_
->GetBufferParameteriv(target
, pname
, GetResultShmId(),
929 GetResultShmOffset());
931 result
->CopyResult(params
);
932 GPU_CLIENT_LOG_CODE_BLOCK({
933 for (int32_t i
= 0; i
< result
->GetNumResults(); ++i
) {
934 GPU_CLIENT_LOG(" " << i
<< ": " << result
->GetData()[i
]);
939 void GLES2Implementation::GetFloatv(GLenum pname
, GLfloat
* params
) {
940 GPU_CLIENT_SINGLE_THREAD_CHECK();
941 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetFloatv("
942 << GLES2Util::GetStringGLState(pname
) << ", "
943 << static_cast<const void*>(params
) << ")");
944 TRACE_EVENT0("gpu", "GLES2Implementation::GetFloatv");
945 if (GetFloatvHelper(pname
, params
)) {
948 typedef cmds::GetFloatv::Result Result
;
949 Result
* result
= GetResultAs
<Result
*>();
953 result
->SetNumResults(0);
954 helper_
->GetFloatv(pname
, GetResultShmId(), GetResultShmOffset());
956 result
->CopyResult(params
);
957 GPU_CLIENT_LOG_CODE_BLOCK({
958 for (int32_t i
= 0; i
< result
->GetNumResults(); ++i
) {
959 GPU_CLIENT_LOG(" " << i
<< ": " << result
->GetData()[i
]);
964 void GLES2Implementation::GetFramebufferAttachmentParameteriv(GLenum target
,
968 GPU_CLIENT_SINGLE_THREAD_CHECK();
969 GPU_CLIENT_VALIDATE_DESTINATION_INITALIZATION(GLint
, params
);
970 GPU_CLIENT_LOG("[" << GetLogPrefix()
971 << "] glGetFramebufferAttachmentParameteriv("
972 << GLES2Util::GetStringFrameBufferTarget(target
) << ", "
973 << GLES2Util::GetStringAttachment(attachment
) << ", "
974 << GLES2Util::GetStringFrameBufferParameter(pname
) << ", "
975 << static_cast<const void*>(params
) << ")");
977 "GLES2Implementation::GetFramebufferAttachmentParameteriv");
978 if (GetFramebufferAttachmentParameterivHelper(target
, attachment
, pname
,
982 typedef cmds::GetFramebufferAttachmentParameteriv::Result Result
;
983 Result
* result
= GetResultAs
<Result
*>();
987 result
->SetNumResults(0);
988 helper_
->GetFramebufferAttachmentParameteriv(
989 target
, attachment
, pname
, GetResultShmId(), GetResultShmOffset());
991 result
->CopyResult(params
);
992 GPU_CLIENT_LOG_CODE_BLOCK({
993 for (int32_t i
= 0; i
< result
->GetNumResults(); ++i
) {
994 GPU_CLIENT_LOG(" " << i
<< ": " << result
->GetData()[i
]);
999 void GLES2Implementation::GetInteger64v(GLenum pname
, GLint64
* params
) {
1000 GPU_CLIENT_SINGLE_THREAD_CHECK();
1001 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetInteger64v("
1002 << GLES2Util::GetStringGLState(pname
) << ", "
1003 << static_cast<const void*>(params
) << ")");
1004 TRACE_EVENT0("gpu", "GLES2Implementation::GetInteger64v");
1005 if (GetInteger64vHelper(pname
, params
)) {
1008 typedef cmds::GetInteger64v::Result Result
;
1009 Result
* result
= GetResultAs
<Result
*>();
1013 result
->SetNumResults(0);
1014 helper_
->GetInteger64v(pname
, GetResultShmId(), GetResultShmOffset());
1016 result
->CopyResult(params
);
1017 GPU_CLIENT_LOG_CODE_BLOCK({
1018 for (int32_t i
= 0; i
< result
->GetNumResults(); ++i
) {
1019 GPU_CLIENT_LOG(" " << i
<< ": " << result
->GetData()[i
]);
1024 void GLES2Implementation::GetIntegeri_v(GLenum pname
,
1027 GPU_CLIENT_SINGLE_THREAD_CHECK();
1028 GPU_CLIENT_VALIDATE_DESTINATION_INITALIZATION(GLint
, data
);
1029 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetIntegeri_v("
1030 << GLES2Util::GetStringIndexedGLState(pname
) << ", "
1031 << index
<< ", " << static_cast<const void*>(data
) << ")");
1032 TRACE_EVENT0("gpu", "GLES2Implementation::GetIntegeri_v");
1033 if (GetIntegeri_vHelper(pname
, index
, data
)) {
1036 typedef cmds::GetIntegeri_v::Result Result
;
1037 Result
* result
= GetResultAs
<Result
*>();
1041 result
->SetNumResults(0);
1042 helper_
->GetIntegeri_v(pname
, index
, GetResultShmId(), GetResultShmOffset());
1044 result
->CopyResult(data
);
1045 GPU_CLIENT_LOG_CODE_BLOCK({
1046 for (int32_t i
= 0; i
< result
->GetNumResults(); ++i
) {
1047 GPU_CLIENT_LOG(" " << i
<< ": " << result
->GetData()[i
]);
1052 void GLES2Implementation::GetInteger64i_v(GLenum pname
,
1055 GPU_CLIENT_SINGLE_THREAD_CHECK();
1056 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetInteger64i_v("
1057 << GLES2Util::GetStringIndexedGLState(pname
) << ", "
1058 << index
<< ", " << static_cast<const void*>(data
) << ")");
1059 TRACE_EVENT0("gpu", "GLES2Implementation::GetInteger64i_v");
1060 if (GetInteger64i_vHelper(pname
, index
, data
)) {
1063 typedef cmds::GetInteger64i_v::Result Result
;
1064 Result
* result
= GetResultAs
<Result
*>();
1068 result
->SetNumResults(0);
1069 helper_
->GetInteger64i_v(pname
, index
, GetResultShmId(),
1070 GetResultShmOffset());
1072 result
->CopyResult(data
);
1073 GPU_CLIENT_LOG_CODE_BLOCK({
1074 for (int32_t i
= 0; i
< result
->GetNumResults(); ++i
) {
1075 GPU_CLIENT_LOG(" " << i
<< ": " << result
->GetData()[i
]);
1080 void GLES2Implementation::GetIntegerv(GLenum pname
, GLint
* params
) {
1081 GPU_CLIENT_SINGLE_THREAD_CHECK();
1082 GPU_CLIENT_VALIDATE_DESTINATION_INITALIZATION(GLint
, params
);
1083 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetIntegerv("
1084 << GLES2Util::GetStringGLState(pname
) << ", "
1085 << static_cast<const void*>(params
) << ")");
1086 TRACE_EVENT0("gpu", "GLES2Implementation::GetIntegerv");
1087 if (GetIntegervHelper(pname
, params
)) {
1090 typedef cmds::GetIntegerv::Result Result
;
1091 Result
* result
= GetResultAs
<Result
*>();
1095 result
->SetNumResults(0);
1096 helper_
->GetIntegerv(pname
, GetResultShmId(), GetResultShmOffset());
1098 result
->CopyResult(params
);
1099 GPU_CLIENT_LOG_CODE_BLOCK({
1100 for (int32_t i
= 0; i
< result
->GetNumResults(); ++i
) {
1101 GPU_CLIENT_LOG(" " << i
<< ": " << result
->GetData()[i
]);
1106 void GLES2Implementation::GetInternalformativ(GLenum target
,
1111 GPU_CLIENT_SINGLE_THREAD_CHECK();
1112 GPU_CLIENT_VALIDATE_DESTINATION_INITALIZATION(GLint
, params
);
1113 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetInternalformativ("
1114 << GLES2Util::GetStringRenderBufferTarget(target
) << ", "
1115 << GLES2Util::GetStringRenderBufferFormat(format
) << ", "
1116 << GLES2Util::GetStringRenderBufferParameter(pname
) << ", "
1117 << bufSize
<< ", " << static_cast<const void*>(params
)
1120 SetGLError(GL_INVALID_VALUE
, "glGetInternalformativ", "bufSize < 0");
1123 TRACE_EVENT0("gpu", "GLES2Implementation::GetInternalformativ");
1124 if (GetInternalformativHelper(target
, format
, pname
, bufSize
, params
)) {
1127 typedef cmds::GetInternalformativ::Result Result
;
1128 Result
* result
= GetResultAs
<Result
*>();
1132 result
->SetNumResults(0);
1133 helper_
->GetInternalformativ(target
, format
, pname
, bufSize
, GetResultShmId(),
1134 GetResultShmOffset());
1136 result
->CopyResult(params
);
1137 GPU_CLIENT_LOG_CODE_BLOCK({
1138 for (int32_t i
= 0; i
< result
->GetNumResults(); ++i
) {
1139 GPU_CLIENT_LOG(" " << i
<< ": " << result
->GetData()[i
]);
1144 void GLES2Implementation::GetProgramiv(GLuint program
,
1147 GPU_CLIENT_SINGLE_THREAD_CHECK();
1148 GPU_CLIENT_VALIDATE_DESTINATION_INITALIZATION(GLint
, params
);
1149 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetProgramiv(" << program
<< ", "
1150 << GLES2Util::GetStringProgramParameter(pname
) << ", "
1151 << static_cast<const void*>(params
) << ")");
1152 TRACE_EVENT0("gpu", "GLES2Implementation::GetProgramiv");
1153 if (GetProgramivHelper(program
, pname
, params
)) {
1156 typedef cmds::GetProgramiv::Result Result
;
1157 Result
* result
= GetResultAs
<Result
*>();
1161 result
->SetNumResults(0);
1162 helper_
->GetProgramiv(program
, pname
, GetResultShmId(), GetResultShmOffset());
1164 result
->CopyResult(params
);
1165 GPU_CLIENT_LOG_CODE_BLOCK({
1166 for (int32_t i
= 0; i
< result
->GetNumResults(); ++i
) {
1167 GPU_CLIENT_LOG(" " << i
<< ": " << result
->GetData()[i
]);
1172 void GLES2Implementation::GetProgramInfoLog(GLuint program
,
1176 GPU_CLIENT_SINGLE_THREAD_CHECK();
1177 GPU_CLIENT_VALIDATE_DESTINATION_OPTIONAL_INITALIZATION(GLsizei
, length
);
1178 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetProgramInfoLog"
1179 << "(" << program
<< ", " << bufsize
<< ", "
1180 << static_cast<void*>(length
) << ", "
1181 << static_cast<void*>(infolog
) << ")");
1182 helper_
->SetBucketSize(kResultBucketId
, 0);
1183 helper_
->GetProgramInfoLog(program
, kResultBucketId
);
1185 GLsizei max_size
= 0;
1186 if (GetBucketAsString(kResultBucketId
, &str
)) {
1188 max_size
= std::min(static_cast<size_t>(bufsize
) - 1, str
.size());
1189 memcpy(infolog
, str
.c_str(), max_size
);
1190 infolog
[max_size
] = '\0';
1191 GPU_CLIENT_LOG("------\n" << infolog
<< "\n------");
1194 if (length
!= NULL
) {
1199 void GLES2Implementation::GetRenderbufferParameteriv(GLenum target
,
1202 GPU_CLIENT_SINGLE_THREAD_CHECK();
1203 GPU_CLIENT_VALIDATE_DESTINATION_INITALIZATION(GLint
, params
);
1204 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetRenderbufferParameteriv("
1205 << GLES2Util::GetStringRenderBufferTarget(target
) << ", "
1206 << GLES2Util::GetStringRenderBufferParameter(pname
) << ", "
1207 << static_cast<const void*>(params
) << ")");
1208 TRACE_EVENT0("gpu", "GLES2Implementation::GetRenderbufferParameteriv");
1209 if (GetRenderbufferParameterivHelper(target
, pname
, params
)) {
1212 typedef cmds::GetRenderbufferParameteriv::Result Result
;
1213 Result
* result
= GetResultAs
<Result
*>();
1217 result
->SetNumResults(0);
1218 helper_
->GetRenderbufferParameteriv(target
, pname
, GetResultShmId(),
1219 GetResultShmOffset());
1221 result
->CopyResult(params
);
1222 GPU_CLIENT_LOG_CODE_BLOCK({
1223 for (int32_t i
= 0; i
< result
->GetNumResults(); ++i
) {
1224 GPU_CLIENT_LOG(" " << i
<< ": " << result
->GetData()[i
]);
1229 void GLES2Implementation::GetSamplerParameterfv(GLuint sampler
,
1232 GPU_CLIENT_SINGLE_THREAD_CHECK();
1233 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetSamplerParameterfv("
1235 << GLES2Util::GetStringSamplerParameter(pname
) << ", "
1236 << static_cast<const void*>(params
) << ")");
1237 TRACE_EVENT0("gpu", "GLES2Implementation::GetSamplerParameterfv");
1238 if (GetSamplerParameterfvHelper(sampler
, pname
, params
)) {
1241 typedef cmds::GetSamplerParameterfv::Result Result
;
1242 Result
* result
= GetResultAs
<Result
*>();
1246 result
->SetNumResults(0);
1247 helper_
->GetSamplerParameterfv(sampler
, pname
, GetResultShmId(),
1248 GetResultShmOffset());
1250 result
->CopyResult(params
);
1251 GPU_CLIENT_LOG_CODE_BLOCK({
1252 for (int32_t i
= 0; i
< result
->GetNumResults(); ++i
) {
1253 GPU_CLIENT_LOG(" " << i
<< ": " << result
->GetData()[i
]);
1258 void GLES2Implementation::GetSamplerParameteriv(GLuint sampler
,
1261 GPU_CLIENT_SINGLE_THREAD_CHECK();
1262 GPU_CLIENT_VALIDATE_DESTINATION_INITALIZATION(GLint
, params
);
1263 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetSamplerParameteriv("
1265 << GLES2Util::GetStringSamplerParameter(pname
) << ", "
1266 << static_cast<const void*>(params
) << ")");
1267 TRACE_EVENT0("gpu", "GLES2Implementation::GetSamplerParameteriv");
1268 if (GetSamplerParameterivHelper(sampler
, pname
, params
)) {
1271 typedef cmds::GetSamplerParameteriv::Result Result
;
1272 Result
* result
= GetResultAs
<Result
*>();
1276 result
->SetNumResults(0);
1277 helper_
->GetSamplerParameteriv(sampler
, pname
, GetResultShmId(),
1278 GetResultShmOffset());
1280 result
->CopyResult(params
);
1281 GPU_CLIENT_LOG_CODE_BLOCK({
1282 for (int32_t i
= 0; i
< result
->GetNumResults(); ++i
) {
1283 GPU_CLIENT_LOG(" " << i
<< ": " << result
->GetData()[i
]);
1288 void GLES2Implementation::GetShaderiv(GLuint shader
,
1291 GPU_CLIENT_SINGLE_THREAD_CHECK();
1292 GPU_CLIENT_VALIDATE_DESTINATION_INITALIZATION(GLint
, params
);
1293 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetShaderiv(" << shader
<< ", "
1294 << GLES2Util::GetStringShaderParameter(pname
) << ", "
1295 << static_cast<const void*>(params
) << ")");
1296 TRACE_EVENT0("gpu", "GLES2Implementation::GetShaderiv");
1297 if (GetShaderivHelper(shader
, pname
, params
)) {
1300 typedef cmds::GetShaderiv::Result Result
;
1301 Result
* result
= GetResultAs
<Result
*>();
1305 result
->SetNumResults(0);
1306 helper_
->GetShaderiv(shader
, pname
, GetResultShmId(), GetResultShmOffset());
1308 result
->CopyResult(params
);
1309 GPU_CLIENT_LOG_CODE_BLOCK({
1310 for (int32_t i
= 0; i
< result
->GetNumResults(); ++i
) {
1311 GPU_CLIENT_LOG(" " << i
<< ": " << result
->GetData()[i
]);
1316 void GLES2Implementation::GetShaderInfoLog(GLuint shader
,
1320 GPU_CLIENT_SINGLE_THREAD_CHECK();
1321 GPU_CLIENT_VALIDATE_DESTINATION_OPTIONAL_INITALIZATION(GLsizei
, length
);
1322 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetShaderInfoLog"
1323 << "(" << shader
<< ", " << bufsize
<< ", "
1324 << static_cast<void*>(length
) << ", "
1325 << static_cast<void*>(infolog
) << ")");
1326 helper_
->SetBucketSize(kResultBucketId
, 0);
1327 helper_
->GetShaderInfoLog(shader
, kResultBucketId
);
1329 GLsizei max_size
= 0;
1330 if (GetBucketAsString(kResultBucketId
, &str
)) {
1332 max_size
= std::min(static_cast<size_t>(bufsize
) - 1, str
.size());
1333 memcpy(infolog
, str
.c_str(), max_size
);
1334 infolog
[max_size
] = '\0';
1335 GPU_CLIENT_LOG("------\n" << infolog
<< "\n------");
1338 if (length
!= NULL
) {
1343 void GLES2Implementation::GetShaderSource(GLuint shader
,
1347 GPU_CLIENT_SINGLE_THREAD_CHECK();
1348 GPU_CLIENT_VALIDATE_DESTINATION_OPTIONAL_INITALIZATION(GLsizei
, length
);
1349 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetShaderSource"
1350 << "(" << shader
<< ", " << bufsize
<< ", "
1351 << static_cast<void*>(length
) << ", "
1352 << static_cast<void*>(source
) << ")");
1353 helper_
->SetBucketSize(kResultBucketId
, 0);
1354 helper_
->GetShaderSource(shader
, kResultBucketId
);
1356 GLsizei max_size
= 0;
1357 if (GetBucketAsString(kResultBucketId
, &str
)) {
1359 max_size
= std::min(static_cast<size_t>(bufsize
) - 1, str
.size());
1360 memcpy(source
, str
.c_str(), max_size
);
1361 source
[max_size
] = '\0';
1362 GPU_CLIENT_LOG("------\n" << source
<< "\n------");
1365 if (length
!= NULL
) {
1370 void GLES2Implementation::GetSynciv(GLsync sync
,
1375 GPU_CLIENT_SINGLE_THREAD_CHECK();
1376 GPU_CLIENT_VALIDATE_DESTINATION_OPTIONAL_INITALIZATION(GLsizei
, length
);
1377 GPU_CLIENT_VALIDATE_DESTINATION_INITALIZATION(GLint
, values
);
1378 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetSynciv(" << sync
<< ", "
1379 << GLES2Util::GetStringSyncParameter(pname
) << ", "
1380 << bufsize
<< ", " << static_cast<const void*>(length
)
1381 << ", " << static_cast<const void*>(values
) << ")");
1383 SetGLError(GL_INVALID_VALUE
, "glGetSynciv", "bufsize < 0");
1386 TRACE_EVENT0("gpu", "GLES2Implementation::GetSynciv");
1387 if (GetSyncivHelper(sync
, pname
, bufsize
, length
, values
)) {
1390 typedef cmds::GetSynciv::Result Result
;
1391 Result
* result
= GetResultAs
<Result
*>();
1395 result
->SetNumResults(0);
1396 helper_
->GetSynciv(ToGLuint(sync
), pname
, GetResultShmId(),
1397 GetResultShmOffset());
1399 result
->CopyResult(values
);
1400 GPU_CLIENT_LOG_CODE_BLOCK({
1401 for (int32_t i
= 0; i
< result
->GetNumResults(); ++i
) {
1402 GPU_CLIENT_LOG(" " << i
<< ": " << result
->GetData()[i
]);
1406 *length
= result
->GetNumResults();
1410 void GLES2Implementation::GetTexParameterfv(GLenum target
,
1413 GPU_CLIENT_SINGLE_THREAD_CHECK();
1414 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetTexParameterfv("
1415 << GLES2Util::GetStringGetTexParamTarget(target
) << ", "
1416 << GLES2Util::GetStringTextureParameter(pname
) << ", "
1417 << static_cast<const void*>(params
) << ")");
1418 TRACE_EVENT0("gpu", "GLES2Implementation::GetTexParameterfv");
1419 if (GetTexParameterfvHelper(target
, pname
, params
)) {
1422 typedef cmds::GetTexParameterfv::Result Result
;
1423 Result
* result
= GetResultAs
<Result
*>();
1427 result
->SetNumResults(0);
1428 helper_
->GetTexParameterfv(target
, pname
, GetResultShmId(),
1429 GetResultShmOffset());
1431 result
->CopyResult(params
);
1432 GPU_CLIENT_LOG_CODE_BLOCK({
1433 for (int32_t i
= 0; i
< result
->GetNumResults(); ++i
) {
1434 GPU_CLIENT_LOG(" " << i
<< ": " << result
->GetData()[i
]);
1439 void GLES2Implementation::GetTexParameteriv(GLenum target
,
1442 GPU_CLIENT_SINGLE_THREAD_CHECK();
1443 GPU_CLIENT_VALIDATE_DESTINATION_INITALIZATION(GLint
, params
);
1444 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetTexParameteriv("
1445 << GLES2Util::GetStringGetTexParamTarget(target
) << ", "
1446 << GLES2Util::GetStringTextureParameter(pname
) << ", "
1447 << static_cast<const void*>(params
) << ")");
1448 TRACE_EVENT0("gpu", "GLES2Implementation::GetTexParameteriv");
1449 if (GetTexParameterivHelper(target
, pname
, params
)) {
1452 typedef cmds::GetTexParameteriv::Result Result
;
1453 Result
* result
= GetResultAs
<Result
*>();
1457 result
->SetNumResults(0);
1458 helper_
->GetTexParameteriv(target
, pname
, GetResultShmId(),
1459 GetResultShmOffset());
1461 result
->CopyResult(params
);
1462 GPU_CLIENT_LOG_CODE_BLOCK({
1463 for (int32_t i
= 0; i
< result
->GetNumResults(); ++i
) {
1464 GPU_CLIENT_LOG(" " << i
<< ": " << result
->GetData()[i
]);
1469 void GLES2Implementation::Hint(GLenum target
, GLenum mode
) {
1470 GPU_CLIENT_SINGLE_THREAD_CHECK();
1471 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glHint("
1472 << GLES2Util::GetStringHintTarget(target
) << ", "
1473 << GLES2Util::GetStringHintMode(mode
) << ")");
1474 helper_
->Hint(target
, mode
);
1478 void GLES2Implementation::InvalidateFramebuffer(GLenum target
,
1480 const GLenum
* attachments
) {
1481 GPU_CLIENT_SINGLE_THREAD_CHECK();
1482 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glInvalidateFramebuffer("
1483 << GLES2Util::GetStringFrameBufferTarget(target
) << ", "
1484 << count
<< ", " << static_cast<const void*>(attachments
)
1486 GPU_CLIENT_LOG_CODE_BLOCK({
1487 for (GLsizei i
= 0; i
< count
; ++i
) {
1488 GPU_CLIENT_LOG(" " << i
<< ": " << attachments
[0 + i
* 1]);
1492 SetGLError(GL_INVALID_VALUE
, "glInvalidateFramebuffer", "count < 0");
1495 helper_
->InvalidateFramebufferImmediate(target
, count
, attachments
);
1499 void GLES2Implementation::InvalidateSubFramebuffer(GLenum target
,
1501 const GLenum
* attachments
,
1506 GPU_CLIENT_SINGLE_THREAD_CHECK();
1507 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glInvalidateSubFramebuffer("
1508 << GLES2Util::GetStringFrameBufferTarget(target
) << ", "
1509 << count
<< ", " << static_cast<const void*>(attachments
)
1510 << ", " << x
<< ", " << y
<< ", " << width
<< ", "
1512 GPU_CLIENT_LOG_CODE_BLOCK({
1513 for (GLsizei i
= 0; i
< count
; ++i
) {
1514 GPU_CLIENT_LOG(" " << i
<< ": " << attachments
[0 + i
* 1]);
1518 SetGLError(GL_INVALID_VALUE
, "glInvalidateSubFramebuffer", "count < 0");
1522 SetGLError(GL_INVALID_VALUE
, "glInvalidateSubFramebuffer", "width < 0");
1526 SetGLError(GL_INVALID_VALUE
, "glInvalidateSubFramebuffer", "height < 0");
1529 helper_
->InvalidateSubFramebufferImmediate(target
, count
, attachments
, x
, y
,
1534 GLboolean
GLES2Implementation::IsBuffer(GLuint buffer
) {
1535 GPU_CLIENT_SINGLE_THREAD_CHECK();
1536 TRACE_EVENT0("gpu", "GLES2Implementation::IsBuffer");
1537 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glIsBuffer(" << buffer
<< ")");
1538 typedef cmds::IsBuffer::Result Result
;
1539 Result
* result
= GetResultAs
<Result
*>();
1544 helper_
->IsBuffer(buffer
, GetResultShmId(), GetResultShmOffset());
1546 GLboolean result_value
= *result
!= 0;
1547 GPU_CLIENT_LOG("returned " << result_value
);
1549 return result_value
;
1552 GLboolean
GLES2Implementation::IsFramebuffer(GLuint framebuffer
) {
1553 GPU_CLIENT_SINGLE_THREAD_CHECK();
1554 TRACE_EVENT0("gpu", "GLES2Implementation::IsFramebuffer");
1555 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glIsFramebuffer(" << framebuffer
1557 typedef cmds::IsFramebuffer::Result Result
;
1558 Result
* result
= GetResultAs
<Result
*>();
1563 helper_
->IsFramebuffer(framebuffer
, GetResultShmId(), GetResultShmOffset());
1565 GLboolean result_value
= *result
!= 0;
1566 GPU_CLIENT_LOG("returned " << result_value
);
1568 return result_value
;
1571 GLboolean
GLES2Implementation::IsProgram(GLuint program
) {
1572 GPU_CLIENT_SINGLE_THREAD_CHECK();
1573 TRACE_EVENT0("gpu", "GLES2Implementation::IsProgram");
1574 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glIsProgram(" << program
<< ")");
1575 typedef cmds::IsProgram::Result Result
;
1576 Result
* result
= GetResultAs
<Result
*>();
1581 helper_
->IsProgram(program
, GetResultShmId(), GetResultShmOffset());
1583 GLboolean result_value
= *result
!= 0;
1584 GPU_CLIENT_LOG("returned " << result_value
);
1586 return result_value
;
1589 GLboolean
GLES2Implementation::IsRenderbuffer(GLuint renderbuffer
) {
1590 GPU_CLIENT_SINGLE_THREAD_CHECK();
1591 TRACE_EVENT0("gpu", "GLES2Implementation::IsRenderbuffer");
1592 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glIsRenderbuffer(" << renderbuffer
1594 typedef cmds::IsRenderbuffer::Result Result
;
1595 Result
* result
= GetResultAs
<Result
*>();
1600 helper_
->IsRenderbuffer(renderbuffer
, GetResultShmId(), GetResultShmOffset());
1602 GLboolean result_value
= *result
!= 0;
1603 GPU_CLIENT_LOG("returned " << result_value
);
1605 return result_value
;
1608 GLboolean
GLES2Implementation::IsSampler(GLuint sampler
) {
1609 GPU_CLIENT_SINGLE_THREAD_CHECK();
1610 TRACE_EVENT0("gpu", "GLES2Implementation::IsSampler");
1611 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glIsSampler(" << sampler
<< ")");
1612 typedef cmds::IsSampler::Result Result
;
1613 Result
* result
= GetResultAs
<Result
*>();
1618 helper_
->IsSampler(sampler
, GetResultShmId(), GetResultShmOffset());
1620 GLboolean result_value
= *result
!= 0;
1621 GPU_CLIENT_LOG("returned " << result_value
);
1623 return result_value
;
1626 GLboolean
GLES2Implementation::IsShader(GLuint shader
) {
1627 GPU_CLIENT_SINGLE_THREAD_CHECK();
1628 TRACE_EVENT0("gpu", "GLES2Implementation::IsShader");
1629 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glIsShader(" << shader
<< ")");
1630 typedef cmds::IsShader::Result Result
;
1631 Result
* result
= GetResultAs
<Result
*>();
1636 helper_
->IsShader(shader
, GetResultShmId(), GetResultShmOffset());
1638 GLboolean result_value
= *result
!= 0;
1639 GPU_CLIENT_LOG("returned " << result_value
);
1641 return result_value
;
1644 GLboolean
GLES2Implementation::IsSync(GLsync sync
) {
1645 GPU_CLIENT_SINGLE_THREAD_CHECK();
1646 TRACE_EVENT0("gpu", "GLES2Implementation::IsSync");
1647 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glIsSync(" << sync
<< ")");
1648 typedef cmds::IsSync::Result Result
;
1649 Result
* result
= GetResultAs
<Result
*>();
1654 helper_
->IsSync(ToGLuint(sync
), GetResultShmId(), GetResultShmOffset());
1656 GLboolean result_value
= *result
!= 0;
1657 GPU_CLIENT_LOG("returned " << result_value
);
1659 return result_value
;
1662 GLboolean
GLES2Implementation::IsTexture(GLuint texture
) {
1663 GPU_CLIENT_SINGLE_THREAD_CHECK();
1664 TRACE_EVENT0("gpu", "GLES2Implementation::IsTexture");
1665 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glIsTexture(" << texture
<< ")");
1666 typedef cmds::IsTexture::Result Result
;
1667 Result
* result
= GetResultAs
<Result
*>();
1672 helper_
->IsTexture(texture
, GetResultShmId(), GetResultShmOffset());
1674 GLboolean result_value
= *result
!= 0;
1675 GPU_CLIENT_LOG("returned " << result_value
);
1677 return result_value
;
1680 GLboolean
GLES2Implementation::IsTransformFeedback(GLuint transformfeedback
) {
1681 GPU_CLIENT_SINGLE_THREAD_CHECK();
1682 TRACE_EVENT0("gpu", "GLES2Implementation::IsTransformFeedback");
1683 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glIsTransformFeedback("
1684 << transformfeedback
<< ")");
1685 typedef cmds::IsTransformFeedback::Result Result
;
1686 Result
* result
= GetResultAs
<Result
*>();
1691 helper_
->IsTransformFeedback(transformfeedback
, GetResultShmId(),
1692 GetResultShmOffset());
1694 GLboolean result_value
= *result
!= 0;
1695 GPU_CLIENT_LOG("returned " << result_value
);
1697 return result_value
;
1700 void GLES2Implementation::LineWidth(GLfloat width
) {
1701 GPU_CLIENT_SINGLE_THREAD_CHECK();
1702 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glLineWidth(" << width
<< ")");
1703 helper_
->LineWidth(width
);
1707 void GLES2Implementation::PauseTransformFeedback() {
1708 GPU_CLIENT_SINGLE_THREAD_CHECK();
1709 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glPauseTransformFeedback("
1711 helper_
->PauseTransformFeedback();
1715 void GLES2Implementation::PolygonOffset(GLfloat factor
, GLfloat units
) {
1716 GPU_CLIENT_SINGLE_THREAD_CHECK();
1717 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glPolygonOffset(" << factor
<< ", "
1719 helper_
->PolygonOffset(factor
, units
);
1723 void GLES2Implementation::ReadBuffer(GLenum src
) {
1724 GPU_CLIENT_SINGLE_THREAD_CHECK();
1725 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glReadBuffer("
1726 << GLES2Util::GetStringEnum(src
) << ")");
1727 helper_
->ReadBuffer(src
);
1731 void GLES2Implementation::ReleaseShaderCompiler() {
1732 GPU_CLIENT_SINGLE_THREAD_CHECK();
1733 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glReleaseShaderCompiler("
1735 helper_
->ReleaseShaderCompiler();
1739 void GLES2Implementation::RenderbufferStorage(GLenum target
,
1740 GLenum internalformat
,
1743 GPU_CLIENT_SINGLE_THREAD_CHECK();
1744 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glRenderbufferStorage("
1745 << GLES2Util::GetStringRenderBufferTarget(target
) << ", "
1746 << GLES2Util::GetStringRenderBufferFormat(internalformat
)
1747 << ", " << width
<< ", " << height
<< ")");
1749 SetGLError(GL_INVALID_VALUE
, "glRenderbufferStorage", "width < 0");
1753 SetGLError(GL_INVALID_VALUE
, "glRenderbufferStorage", "height < 0");
1756 helper_
->RenderbufferStorage(target
, internalformat
, width
, height
);
1760 void GLES2Implementation::ResumeTransformFeedback() {
1761 GPU_CLIENT_SINGLE_THREAD_CHECK();
1762 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glResumeTransformFeedback("
1764 helper_
->ResumeTransformFeedback();
1768 void GLES2Implementation::SampleCoverage(GLclampf value
, GLboolean invert
) {
1769 GPU_CLIENT_SINGLE_THREAD_CHECK();
1770 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glSampleCoverage(" << value
<< ", "
1771 << GLES2Util::GetStringBool(invert
) << ")");
1772 helper_
->SampleCoverage(value
, invert
);
1776 void GLES2Implementation::SamplerParameterf(GLuint sampler
,
1779 GPU_CLIENT_SINGLE_THREAD_CHECK();
1780 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glSamplerParameterf(" << sampler
1781 << ", " << GLES2Util::GetStringSamplerParameter(pname
)
1782 << ", " << param
<< ")");
1783 helper_
->SamplerParameterf(sampler
, pname
, param
);
1787 void GLES2Implementation::SamplerParameterfv(GLuint sampler
,
1789 const GLfloat
* params
) {
1790 GPU_CLIENT_SINGLE_THREAD_CHECK();
1791 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glSamplerParameterfv(" << sampler
1792 << ", " << GLES2Util::GetStringSamplerParameter(pname
)
1793 << ", " << static_cast<const void*>(params
) << ")");
1795 for (size_t ii
= 0; ii
< count
; ++ii
)
1796 GPU_CLIENT_LOG("value[" << ii
<< "]: " << params
[ii
]);
1797 helper_
->SamplerParameterfvImmediate(sampler
, pname
, params
);
1801 void GLES2Implementation::SamplerParameteri(GLuint sampler
,
1804 GPU_CLIENT_SINGLE_THREAD_CHECK();
1805 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glSamplerParameteri(" << sampler
1806 << ", " << GLES2Util::GetStringSamplerParameter(pname
)
1807 << ", " << param
<< ")");
1808 helper_
->SamplerParameteri(sampler
, pname
, param
);
1812 void GLES2Implementation::SamplerParameteriv(GLuint sampler
,
1814 const GLint
* params
) {
1815 GPU_CLIENT_SINGLE_THREAD_CHECK();
1816 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glSamplerParameteriv(" << sampler
1817 << ", " << GLES2Util::GetStringSamplerParameter(pname
)
1818 << ", " << static_cast<const void*>(params
) << ")");
1820 for (size_t ii
= 0; ii
< count
; ++ii
)
1821 GPU_CLIENT_LOG("value[" << ii
<< "]: " << params
[ii
]);
1822 helper_
->SamplerParameterivImmediate(sampler
, pname
, params
);
1826 void GLES2Implementation::Scissor(GLint x
,
1830 GPU_CLIENT_SINGLE_THREAD_CHECK();
1831 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glScissor(" << x
<< ", " << y
1832 << ", " << width
<< ", " << height
<< ")");
1834 SetGLError(GL_INVALID_VALUE
, "glScissor", "width < 0");
1838 SetGLError(GL_INVALID_VALUE
, "glScissor", "height < 0");
1841 helper_
->Scissor(x
, y
, width
, height
);
1845 void GLES2Implementation::ShaderSource(GLuint shader
,
1847 const GLchar
* const* str
,
1848 const GLint
* length
) {
1849 GPU_CLIENT_SINGLE_THREAD_CHECK();
1850 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glShaderSource(" << shader
<< ", "
1851 << count
<< ", " << static_cast<const void*>(str
) << ", "
1852 << static_cast<const void*>(length
) << ")");
1853 GPU_CLIENT_LOG_CODE_BLOCK({
1854 for (GLsizei ii
= 0; ii
< count
; ++ii
) {
1856 if (length
&& length
[ii
] >= 0) {
1857 const std::string
my_str(str
[ii
], length
[ii
]);
1858 GPU_CLIENT_LOG(" " << ii
<< ": ---\n" << my_str
<< "\n---");
1860 GPU_CLIENT_LOG(" " << ii
<< ": ---\n" << str
[ii
] << "\n---");
1863 GPU_CLIENT_LOG(" " << ii
<< ": NULL");
1868 SetGLError(GL_INVALID_VALUE
, "glShaderSource", "count < 0");
1872 if (!PackStringsToBucket(count
, str
, length
, "glShaderSource")) {
1875 helper_
->ShaderSourceBucket(shader
, kResultBucketId
);
1876 helper_
->SetBucketSize(kResultBucketId
, 0);
1880 void GLES2Implementation::StencilFunc(GLenum func
, GLint ref
, GLuint mask
) {
1881 GPU_CLIENT_SINGLE_THREAD_CHECK();
1882 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glStencilFunc("
1883 << GLES2Util::GetStringCmpFunction(func
) << ", " << ref
1884 << ", " << mask
<< ")");
1885 helper_
->StencilFunc(func
, ref
, mask
);
1889 void GLES2Implementation::StencilFuncSeparate(GLenum face
,
1893 GPU_CLIENT_SINGLE_THREAD_CHECK();
1894 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glStencilFuncSeparate("
1895 << GLES2Util::GetStringFaceType(face
) << ", "
1896 << GLES2Util::GetStringCmpFunction(func
) << ", " << ref
1897 << ", " << mask
<< ")");
1898 helper_
->StencilFuncSeparate(face
, func
, ref
, mask
);
1902 void GLES2Implementation::StencilMask(GLuint mask
) {
1903 GPU_CLIENT_SINGLE_THREAD_CHECK();
1904 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glStencilMask(" << mask
<< ")");
1905 helper_
->StencilMask(mask
);
1909 void GLES2Implementation::StencilMaskSeparate(GLenum face
, GLuint mask
) {
1910 GPU_CLIENT_SINGLE_THREAD_CHECK();
1911 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glStencilMaskSeparate("
1912 << GLES2Util::GetStringFaceType(face
) << ", " << mask
1914 helper_
->StencilMaskSeparate(face
, mask
);
1918 void GLES2Implementation::StencilOp(GLenum fail
, GLenum zfail
, GLenum zpass
) {
1919 GPU_CLIENT_SINGLE_THREAD_CHECK();
1920 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glStencilOp("
1921 << GLES2Util::GetStringStencilOp(fail
) << ", "
1922 << GLES2Util::GetStringStencilOp(zfail
) << ", "
1923 << GLES2Util::GetStringStencilOp(zpass
) << ")");
1924 helper_
->StencilOp(fail
, zfail
, zpass
);
1928 void GLES2Implementation::StencilOpSeparate(GLenum face
,
1932 GPU_CLIENT_SINGLE_THREAD_CHECK();
1933 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glStencilOpSeparate("
1934 << GLES2Util::GetStringFaceType(face
) << ", "
1935 << GLES2Util::GetStringStencilOp(fail
) << ", "
1936 << GLES2Util::GetStringStencilOp(zfail
) << ", "
1937 << GLES2Util::GetStringStencilOp(zpass
) << ")");
1938 helper_
->StencilOpSeparate(face
, fail
, zfail
, zpass
);
1942 void GLES2Implementation::TexParameterf(GLenum target
,
1945 GPU_CLIENT_SINGLE_THREAD_CHECK();
1946 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glTexParameterf("
1947 << GLES2Util::GetStringTextureBindTarget(target
) << ", "
1948 << GLES2Util::GetStringTextureParameter(pname
) << ", "
1950 helper_
->TexParameterf(target
, pname
, param
);
1954 void GLES2Implementation::TexParameterfv(GLenum target
,
1956 const GLfloat
* params
) {
1957 GPU_CLIENT_SINGLE_THREAD_CHECK();
1958 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glTexParameterfv("
1959 << GLES2Util::GetStringTextureBindTarget(target
) << ", "
1960 << GLES2Util::GetStringTextureParameter(pname
) << ", "
1961 << static_cast<const void*>(params
) << ")");
1963 for (size_t ii
= 0; ii
< count
; ++ii
)
1964 GPU_CLIENT_LOG("value[" << ii
<< "]: " << params
[ii
]);
1965 helper_
->TexParameterfvImmediate(target
, pname
, params
);
1969 void GLES2Implementation::TexParameteri(GLenum target
,
1972 GPU_CLIENT_SINGLE_THREAD_CHECK();
1973 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glTexParameteri("
1974 << GLES2Util::GetStringTextureBindTarget(target
) << ", "
1975 << GLES2Util::GetStringTextureParameter(pname
) << ", "
1977 helper_
->TexParameteri(target
, pname
, param
);
1981 void GLES2Implementation::TexParameteriv(GLenum target
,
1983 const GLint
* params
) {
1984 GPU_CLIENT_SINGLE_THREAD_CHECK();
1985 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glTexParameteriv("
1986 << GLES2Util::GetStringTextureBindTarget(target
) << ", "
1987 << GLES2Util::GetStringTextureParameter(pname
) << ", "
1988 << static_cast<const void*>(params
) << ")");
1990 for (size_t ii
= 0; ii
< count
; ++ii
)
1991 GPU_CLIENT_LOG("value[" << ii
<< "]: " << params
[ii
]);
1992 helper_
->TexParameterivImmediate(target
, pname
, params
);
1996 void GLES2Implementation::TexStorage3D(GLenum target
,
1998 GLenum internalFormat
,
2002 GPU_CLIENT_SINGLE_THREAD_CHECK();
2004 "[" << GetLogPrefix() << "] glTexStorage3D("
2005 << GLES2Util::GetStringTexture3DTarget(target
) << ", " << levels
2007 << GLES2Util::GetStringTextureInternalFormatStorage(internalFormat
)
2008 << ", " << width
<< ", " << height
<< ", " << depth
<< ")");
2010 SetGLError(GL_INVALID_VALUE
, "glTexStorage3D", "levels < 0");
2014 SetGLError(GL_INVALID_VALUE
, "glTexStorage3D", "width < 0");
2018 SetGLError(GL_INVALID_VALUE
, "glTexStorage3D", "height < 0");
2022 SetGLError(GL_INVALID_VALUE
, "glTexStorage3D", "depth < 0");
2025 helper_
->TexStorage3D(target
, levels
, internalFormat
, width
, height
, depth
);
2029 void GLES2Implementation::TransformFeedbackVaryings(GLuint program
,
2031 const char* const* varyings
,
2032 GLenum buffermode
) {
2033 GPU_CLIENT_SINGLE_THREAD_CHECK();
2034 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glTransformFeedbackVaryings("
2035 << program
<< ", " << count
<< ", "
2036 << static_cast<const void*>(varyings
) << ", "
2037 << GLES2Util::GetStringBufferMode(buffermode
) << ")");
2038 GPU_CLIENT_LOG_CODE_BLOCK({
2039 for (GLsizei ii
= 0; ii
< count
; ++ii
) {
2041 GPU_CLIENT_LOG(" " << ii
<< ": ---\n" << varyings
[ii
] << "\n---");
2043 GPU_CLIENT_LOG(" " << ii
<< ": NULL");
2048 SetGLError(GL_INVALID_VALUE
, "glTransformFeedbackVaryings", "count < 0");
2052 if (!PackStringsToBucket(count
, varyings
, NULL
,
2053 "glTransformFeedbackVaryings")) {
2056 helper_
->TransformFeedbackVaryingsBucket(program
, kResultBucketId
,
2058 helper_
->SetBucketSize(kResultBucketId
, 0);
2062 void GLES2Implementation::Uniform1f(GLint location
, GLfloat x
) {
2063 GPU_CLIENT_SINGLE_THREAD_CHECK();
2064 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform1f(" << location
<< ", "
2066 helper_
->Uniform1f(location
, x
);
2070 void GLES2Implementation::Uniform1fv(GLint location
,
2073 GPU_CLIENT_SINGLE_THREAD_CHECK();
2074 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform1fv(" << location
<< ", "
2075 << count
<< ", " << static_cast<const void*>(v
) << ")");
2076 GPU_CLIENT_LOG_CODE_BLOCK({
2077 for (GLsizei i
= 0; i
< count
; ++i
) {
2078 GPU_CLIENT_LOG(" " << i
<< ": " << v
[0 + i
* 1]);
2082 SetGLError(GL_INVALID_VALUE
, "glUniform1fv", "count < 0");
2085 helper_
->Uniform1fvImmediate(location
, count
, v
);
2089 void GLES2Implementation::Uniform1i(GLint location
, GLint x
) {
2090 GPU_CLIENT_SINGLE_THREAD_CHECK();
2091 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform1i(" << location
<< ", "
2093 helper_
->Uniform1i(location
, x
);
2097 void GLES2Implementation::Uniform1iv(GLint location
,
2100 GPU_CLIENT_SINGLE_THREAD_CHECK();
2101 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform1iv(" << location
<< ", "
2102 << count
<< ", " << static_cast<const void*>(v
) << ")");
2103 GPU_CLIENT_LOG_CODE_BLOCK({
2104 for (GLsizei i
= 0; i
< count
; ++i
) {
2105 GPU_CLIENT_LOG(" " << i
<< ": " << v
[0 + i
* 1]);
2109 SetGLError(GL_INVALID_VALUE
, "glUniform1iv", "count < 0");
2112 helper_
->Uniform1ivImmediate(location
, count
, v
);
2116 void GLES2Implementation::Uniform1ui(GLint location
, GLuint x
) {
2117 GPU_CLIENT_SINGLE_THREAD_CHECK();
2118 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform1ui(" << location
<< ", "
2120 helper_
->Uniform1ui(location
, x
);
2124 void GLES2Implementation::Uniform1uiv(GLint location
,
2127 GPU_CLIENT_SINGLE_THREAD_CHECK();
2128 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform1uiv(" << location
<< ", "
2129 << count
<< ", " << static_cast<const void*>(v
) << ")");
2130 GPU_CLIENT_LOG_CODE_BLOCK({
2131 for (GLsizei i
= 0; i
< count
; ++i
) {
2132 GPU_CLIENT_LOG(" " << i
<< ": " << v
[0 + i
* 1]);
2136 SetGLError(GL_INVALID_VALUE
, "glUniform1uiv", "count < 0");
2139 helper_
->Uniform1uivImmediate(location
, count
, v
);
2143 void GLES2Implementation::Uniform2f(GLint location
, GLfloat x
, GLfloat y
) {
2144 GPU_CLIENT_SINGLE_THREAD_CHECK();
2145 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform2f(" << location
<< ", "
2146 << x
<< ", " << y
<< ")");
2147 helper_
->Uniform2f(location
, x
, y
);
2151 void GLES2Implementation::Uniform2fv(GLint location
,
2154 GPU_CLIENT_SINGLE_THREAD_CHECK();
2155 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform2fv(" << location
<< ", "
2156 << count
<< ", " << static_cast<const void*>(v
) << ")");
2157 GPU_CLIENT_LOG_CODE_BLOCK({
2158 for (GLsizei i
= 0; i
< count
; ++i
) {
2159 GPU_CLIENT_LOG(" " << i
<< ": " << v
[0 + i
* 2] << ", " << v
[1 + i
* 2]);
2163 SetGLError(GL_INVALID_VALUE
, "glUniform2fv", "count < 0");
2166 helper_
->Uniform2fvImmediate(location
, count
, v
);
2170 void GLES2Implementation::Uniform2i(GLint location
, GLint x
, GLint y
) {
2171 GPU_CLIENT_SINGLE_THREAD_CHECK();
2172 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform2i(" << location
<< ", "
2173 << x
<< ", " << y
<< ")");
2174 helper_
->Uniform2i(location
, x
, y
);
2178 void GLES2Implementation::Uniform2iv(GLint location
,
2181 GPU_CLIENT_SINGLE_THREAD_CHECK();
2182 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform2iv(" << location
<< ", "
2183 << count
<< ", " << static_cast<const void*>(v
) << ")");
2184 GPU_CLIENT_LOG_CODE_BLOCK({
2185 for (GLsizei i
= 0; i
< count
; ++i
) {
2186 GPU_CLIENT_LOG(" " << i
<< ": " << v
[0 + i
* 2] << ", " << v
[1 + i
* 2]);
2190 SetGLError(GL_INVALID_VALUE
, "glUniform2iv", "count < 0");
2193 helper_
->Uniform2ivImmediate(location
, count
, v
);
2197 void GLES2Implementation::Uniform2ui(GLint location
, GLuint x
, GLuint y
) {
2198 GPU_CLIENT_SINGLE_THREAD_CHECK();
2199 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform2ui(" << location
<< ", "
2200 << x
<< ", " << y
<< ")");
2201 helper_
->Uniform2ui(location
, x
, y
);
2205 void GLES2Implementation::Uniform2uiv(GLint location
,
2208 GPU_CLIENT_SINGLE_THREAD_CHECK();
2209 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform2uiv(" << 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
* 2] << ", " << v
[1 + i
* 2]);
2217 SetGLError(GL_INVALID_VALUE
, "glUniform2uiv", "count < 0");
2220 helper_
->Uniform2uivImmediate(location
, count
, v
);
2224 void GLES2Implementation::Uniform3f(GLint location
,
2228 GPU_CLIENT_SINGLE_THREAD_CHECK();
2229 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform3f(" << location
<< ", "
2230 << x
<< ", " << y
<< ", " << z
<< ")");
2231 helper_
->Uniform3f(location
, x
, y
, z
);
2235 void GLES2Implementation::Uniform3fv(GLint location
,
2238 GPU_CLIENT_SINGLE_THREAD_CHECK();
2239 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform3fv(" << location
<< ", "
2240 << count
<< ", " << static_cast<const void*>(v
) << ")");
2241 GPU_CLIENT_LOG_CODE_BLOCK({
2242 for (GLsizei i
= 0; i
< count
; ++i
) {
2243 GPU_CLIENT_LOG(" " << i
<< ": " << v
[0 + i
* 3] << ", " << v
[1 + i
* 3]
2244 << ", " << v
[2 + i
* 3]);
2248 SetGLError(GL_INVALID_VALUE
, "glUniform3fv", "count < 0");
2251 helper_
->Uniform3fvImmediate(location
, count
, v
);
2255 void GLES2Implementation::Uniform3i(GLint location
, GLint x
, GLint y
, GLint z
) {
2256 GPU_CLIENT_SINGLE_THREAD_CHECK();
2257 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform3i(" << location
<< ", "
2258 << x
<< ", " << y
<< ", " << z
<< ")");
2259 helper_
->Uniform3i(location
, x
, y
, z
);
2263 void GLES2Implementation::Uniform3iv(GLint location
,
2266 GPU_CLIENT_SINGLE_THREAD_CHECK();
2267 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform3iv(" << location
<< ", "
2268 << count
<< ", " << static_cast<const void*>(v
) << ")");
2269 GPU_CLIENT_LOG_CODE_BLOCK({
2270 for (GLsizei i
= 0; i
< count
; ++i
) {
2271 GPU_CLIENT_LOG(" " << i
<< ": " << v
[0 + i
* 3] << ", " << v
[1 + i
* 3]
2272 << ", " << v
[2 + i
* 3]);
2276 SetGLError(GL_INVALID_VALUE
, "glUniform3iv", "count < 0");
2279 helper_
->Uniform3ivImmediate(location
, count
, v
);
2283 void GLES2Implementation::Uniform3ui(GLint location
,
2287 GPU_CLIENT_SINGLE_THREAD_CHECK();
2288 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform3ui(" << location
<< ", "
2289 << x
<< ", " << y
<< ", " << z
<< ")");
2290 helper_
->Uniform3ui(location
, x
, y
, z
);
2294 void GLES2Implementation::Uniform3uiv(GLint location
,
2297 GPU_CLIENT_SINGLE_THREAD_CHECK();
2298 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform3uiv(" << location
<< ", "
2299 << count
<< ", " << static_cast<const void*>(v
) << ")");
2300 GPU_CLIENT_LOG_CODE_BLOCK({
2301 for (GLsizei i
= 0; i
< count
; ++i
) {
2302 GPU_CLIENT_LOG(" " << i
<< ": " << v
[0 + i
* 3] << ", " << v
[1 + i
* 3]
2303 << ", " << v
[2 + i
* 3]);
2307 SetGLError(GL_INVALID_VALUE
, "glUniform3uiv", "count < 0");
2310 helper_
->Uniform3uivImmediate(location
, count
, v
);
2314 void GLES2Implementation::Uniform4f(GLint location
,
2319 GPU_CLIENT_SINGLE_THREAD_CHECK();
2320 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform4f(" << location
<< ", "
2321 << x
<< ", " << y
<< ", " << z
<< ", " << w
<< ")");
2322 helper_
->Uniform4f(location
, x
, y
, z
, w
);
2326 void GLES2Implementation::Uniform4fv(GLint location
,
2329 GPU_CLIENT_SINGLE_THREAD_CHECK();
2330 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform4fv(" << location
<< ", "
2331 << count
<< ", " << static_cast<const void*>(v
) << ")");
2332 GPU_CLIENT_LOG_CODE_BLOCK({
2333 for (GLsizei i
= 0; i
< count
; ++i
) {
2334 GPU_CLIENT_LOG(" " << i
<< ": " << v
[0 + i
* 4] << ", " << v
[1 + i
* 4]
2335 << ", " << v
[2 + i
* 4] << ", " << v
[3 + i
* 4]);
2339 SetGLError(GL_INVALID_VALUE
, "glUniform4fv", "count < 0");
2342 helper_
->Uniform4fvImmediate(location
, count
, v
);
2346 void GLES2Implementation::Uniform4i(GLint location
,
2351 GPU_CLIENT_SINGLE_THREAD_CHECK();
2352 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform4i(" << location
<< ", "
2353 << x
<< ", " << y
<< ", " << z
<< ", " << w
<< ")");
2354 helper_
->Uniform4i(location
, x
, y
, z
, w
);
2358 void GLES2Implementation::Uniform4iv(GLint location
,
2361 GPU_CLIENT_SINGLE_THREAD_CHECK();
2362 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform4iv(" << location
<< ", "
2363 << count
<< ", " << static_cast<const void*>(v
) << ")");
2364 GPU_CLIENT_LOG_CODE_BLOCK({
2365 for (GLsizei i
= 0; i
< count
; ++i
) {
2366 GPU_CLIENT_LOG(" " << i
<< ": " << v
[0 + i
* 4] << ", " << v
[1 + i
* 4]
2367 << ", " << v
[2 + i
* 4] << ", " << v
[3 + i
* 4]);
2371 SetGLError(GL_INVALID_VALUE
, "glUniform4iv", "count < 0");
2374 helper_
->Uniform4ivImmediate(location
, count
, v
);
2378 void GLES2Implementation::Uniform4ui(GLint location
,
2383 GPU_CLIENT_SINGLE_THREAD_CHECK();
2384 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform4ui(" << location
<< ", "
2385 << x
<< ", " << y
<< ", " << z
<< ", " << w
<< ")");
2386 helper_
->Uniform4ui(location
, x
, y
, z
, w
);
2390 void GLES2Implementation::Uniform4uiv(GLint location
,
2393 GPU_CLIENT_SINGLE_THREAD_CHECK();
2394 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform4uiv(" << location
<< ", "
2395 << count
<< ", " << static_cast<const void*>(v
) << ")");
2396 GPU_CLIENT_LOG_CODE_BLOCK({
2397 for (GLsizei i
= 0; i
< count
; ++i
) {
2398 GPU_CLIENT_LOG(" " << i
<< ": " << v
[0 + i
* 4] << ", " << v
[1 + i
* 4]
2399 << ", " << v
[2 + i
* 4] << ", " << v
[3 + i
* 4]);
2403 SetGLError(GL_INVALID_VALUE
, "glUniform4uiv", "count < 0");
2406 helper_
->Uniform4uivImmediate(location
, count
, v
);
2410 void GLES2Implementation::UniformMatrix2fv(GLint location
,
2412 GLboolean transpose
,
2413 const GLfloat
* value
) {
2414 GPU_CLIENT_SINGLE_THREAD_CHECK();
2415 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniformMatrix2fv(" << location
2416 << ", " << count
<< ", "
2417 << GLES2Util::GetStringBool(transpose
) << ", "
2418 << static_cast<const void*>(value
) << ")");
2419 GPU_CLIENT_LOG_CODE_BLOCK({
2420 for (GLsizei i
= 0; i
< count
; ++i
) {
2421 GPU_CLIENT_LOG(" " << i
<< ": " << value
[0 + i
* 4] << ", "
2422 << value
[1 + i
* 4] << ", " << value
[2 + i
* 4]
2423 << ", " << value
[3 + i
* 4]);
2427 SetGLError(GL_INVALID_VALUE
, "glUniformMatrix2fv", "count < 0");
2430 if (transpose
!= false) {
2431 SetGLError(GL_INVALID_VALUE
, "glUniformMatrix2fv",
2432 "transpose GL_INVALID_VALUE");
2435 helper_
->UniformMatrix2fvImmediate(location
, count
, value
);
2439 void GLES2Implementation::UniformMatrix2x3fv(GLint location
,
2441 GLboolean transpose
,
2442 const GLfloat
* value
) {
2443 GPU_CLIENT_SINGLE_THREAD_CHECK();
2444 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniformMatrix2x3fv(" << location
2445 << ", " << count
<< ", "
2446 << GLES2Util::GetStringBool(transpose
) << ", "
2447 << static_cast<const void*>(value
) << ")");
2448 GPU_CLIENT_LOG_CODE_BLOCK({
2449 for (GLsizei i
= 0; i
< count
; ++i
) {
2450 GPU_CLIENT_LOG(" " << i
<< ": " << value
[0 + i
* 6] << ", "
2451 << value
[1 + i
* 6] << ", " << value
[2 + i
* 6]
2452 << ", " << value
[3 + i
* 6] << ", "
2453 << value
[4 + i
* 6] << ", " << value
[5 + i
* 6]);
2457 SetGLError(GL_INVALID_VALUE
, "glUniformMatrix2x3fv", "count < 0");
2460 if (transpose
!= false) {
2461 SetGLError(GL_INVALID_VALUE
, "glUniformMatrix2x3fv",
2462 "transpose GL_INVALID_VALUE");
2465 helper_
->UniformMatrix2x3fvImmediate(location
, count
, value
);
2469 void GLES2Implementation::UniformMatrix2x4fv(GLint location
,
2471 GLboolean transpose
,
2472 const GLfloat
* value
) {
2473 GPU_CLIENT_SINGLE_THREAD_CHECK();
2474 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniformMatrix2x4fv(" << location
2475 << ", " << count
<< ", "
2476 << GLES2Util::GetStringBool(transpose
) << ", "
2477 << static_cast<const void*>(value
) << ")");
2478 GPU_CLIENT_LOG_CODE_BLOCK({
2479 for (GLsizei i
= 0; i
< count
; ++i
) {
2481 " " << i
<< ": " << value
[0 + i
* 8] << ", " << value
[1 + i
* 8]
2482 << ", " << value
[2 + i
* 8] << ", " << value
[3 + i
* 8] << ", "
2483 << value
[4 + i
* 8] << ", " << value
[5 + i
* 8] << ", "
2484 << value
[6 + i
* 8] << ", " << value
[7 + i
* 8]);
2488 SetGLError(GL_INVALID_VALUE
, "glUniformMatrix2x4fv", "count < 0");
2491 if (transpose
!= false) {
2492 SetGLError(GL_INVALID_VALUE
, "glUniformMatrix2x4fv",
2493 "transpose GL_INVALID_VALUE");
2496 helper_
->UniformMatrix2x4fvImmediate(location
, count
, value
);
2500 void GLES2Implementation::UniformMatrix3fv(GLint location
,
2502 GLboolean transpose
,
2503 const GLfloat
* value
) {
2504 GPU_CLIENT_SINGLE_THREAD_CHECK();
2505 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniformMatrix3fv(" << location
2506 << ", " << count
<< ", "
2507 << GLES2Util::GetStringBool(transpose
) << ", "
2508 << static_cast<const void*>(value
) << ")");
2509 GPU_CLIENT_LOG_CODE_BLOCK({
2510 for (GLsizei i
= 0; i
< count
; ++i
) {
2511 GPU_CLIENT_LOG(" " << i
<< ": " << value
[0 + i
* 9] << ", "
2512 << value
[1 + i
* 9] << ", " << value
[2 + i
* 9]
2513 << ", " << value
[3 + i
* 9] << ", "
2514 << value
[4 + i
* 9] << ", " << value
[5 + i
* 9]
2515 << ", " << value
[6 + i
* 9] << ", "
2516 << value
[7 + i
* 9] << ", " << value
[8 + i
* 9]);
2520 SetGLError(GL_INVALID_VALUE
, "glUniformMatrix3fv", "count < 0");
2523 if (transpose
!= false) {
2524 SetGLError(GL_INVALID_VALUE
, "glUniformMatrix3fv",
2525 "transpose GL_INVALID_VALUE");
2528 helper_
->UniformMatrix3fvImmediate(location
, count
, value
);
2532 void GLES2Implementation::UniformMatrix3x2fv(GLint location
,
2534 GLboolean transpose
,
2535 const GLfloat
* value
) {
2536 GPU_CLIENT_SINGLE_THREAD_CHECK();
2537 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniformMatrix3x2fv(" << location
2538 << ", " << count
<< ", "
2539 << GLES2Util::GetStringBool(transpose
) << ", "
2540 << static_cast<const void*>(value
) << ")");
2541 GPU_CLIENT_LOG_CODE_BLOCK({
2542 for (GLsizei i
= 0; i
< count
; ++i
) {
2543 GPU_CLIENT_LOG(" " << i
<< ": " << value
[0 + i
* 6] << ", "
2544 << value
[1 + i
* 6] << ", " << value
[2 + i
* 6]
2545 << ", " << value
[3 + i
* 6] << ", "
2546 << value
[4 + i
* 6] << ", " << value
[5 + i
* 6]);
2550 SetGLError(GL_INVALID_VALUE
, "glUniformMatrix3x2fv", "count < 0");
2553 if (transpose
!= false) {
2554 SetGLError(GL_INVALID_VALUE
, "glUniformMatrix3x2fv",
2555 "transpose GL_INVALID_VALUE");
2558 helper_
->UniformMatrix3x2fvImmediate(location
, count
, value
);
2562 void GLES2Implementation::UniformMatrix3x4fv(GLint location
,
2564 GLboolean transpose
,
2565 const GLfloat
* value
) {
2566 GPU_CLIENT_SINGLE_THREAD_CHECK();
2567 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniformMatrix3x4fv(" << location
2568 << ", " << count
<< ", "
2569 << GLES2Util::GetStringBool(transpose
) << ", "
2570 << static_cast<const void*>(value
) << ")");
2571 GPU_CLIENT_LOG_CODE_BLOCK({
2572 for (GLsizei i
= 0; i
< count
; ++i
) {
2574 " " << i
<< ": " << value
[0 + i
* 12] << ", " << value
[1 + i
* 12]
2575 << ", " << value
[2 + i
* 12] << ", " << value
[3 + i
* 12] << ", "
2576 << value
[4 + i
* 12] << ", " << value
[5 + i
* 12] << ", "
2577 << value
[6 + i
* 12] << ", " << value
[7 + i
* 12] << ", "
2578 << value
[8 + i
* 12] << ", " << value
[9 + i
* 12] << ", "
2579 << value
[10 + i
* 12] << ", " << value
[11 + i
* 12]);
2583 SetGLError(GL_INVALID_VALUE
, "glUniformMatrix3x4fv", "count < 0");
2586 if (transpose
!= false) {
2587 SetGLError(GL_INVALID_VALUE
, "glUniformMatrix3x4fv",
2588 "transpose GL_INVALID_VALUE");
2591 helper_
->UniformMatrix3x4fvImmediate(location
, count
, value
);
2595 void GLES2Implementation::UniformMatrix4fv(GLint location
,
2597 GLboolean transpose
,
2598 const GLfloat
* value
) {
2599 GPU_CLIENT_SINGLE_THREAD_CHECK();
2600 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniformMatrix4fv(" << location
2601 << ", " << count
<< ", "
2602 << GLES2Util::GetStringBool(transpose
) << ", "
2603 << static_cast<const void*>(value
) << ")");
2604 GPU_CLIENT_LOG_CODE_BLOCK({
2605 for (GLsizei i
= 0; i
< count
; ++i
) {
2607 " " << i
<< ": " << value
[0 + i
* 16] << ", " << value
[1 + i
* 16]
2608 << ", " << value
[2 + i
* 16] << ", " << value
[3 + i
* 16] << ", "
2609 << value
[4 + i
* 16] << ", " << value
[5 + i
* 16] << ", "
2610 << value
[6 + i
* 16] << ", " << value
[7 + i
* 16] << ", "
2611 << value
[8 + i
* 16] << ", " << value
[9 + i
* 16] << ", "
2612 << value
[10 + i
* 16] << ", " << value
[11 + i
* 16] << ", "
2613 << value
[12 + i
* 16] << ", " << value
[13 + i
* 16] << ", "
2614 << value
[14 + i
* 16] << ", " << value
[15 + i
* 16]);
2618 SetGLError(GL_INVALID_VALUE
, "glUniformMatrix4fv", "count < 0");
2621 if (transpose
!= false) {
2622 SetGLError(GL_INVALID_VALUE
, "glUniformMatrix4fv",
2623 "transpose GL_INVALID_VALUE");
2626 helper_
->UniformMatrix4fvImmediate(location
, count
, value
);
2630 void GLES2Implementation::UniformMatrix4x2fv(GLint location
,
2632 GLboolean transpose
,
2633 const GLfloat
* value
) {
2634 GPU_CLIENT_SINGLE_THREAD_CHECK();
2635 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniformMatrix4x2fv(" << location
2636 << ", " << count
<< ", "
2637 << GLES2Util::GetStringBool(transpose
) << ", "
2638 << static_cast<const void*>(value
) << ")");
2639 GPU_CLIENT_LOG_CODE_BLOCK({
2640 for (GLsizei i
= 0; i
< count
; ++i
) {
2642 " " << i
<< ": " << value
[0 + i
* 8] << ", " << value
[1 + i
* 8]
2643 << ", " << value
[2 + i
* 8] << ", " << value
[3 + i
* 8] << ", "
2644 << value
[4 + i
* 8] << ", " << value
[5 + i
* 8] << ", "
2645 << value
[6 + i
* 8] << ", " << value
[7 + i
* 8]);
2649 SetGLError(GL_INVALID_VALUE
, "glUniformMatrix4x2fv", "count < 0");
2652 if (transpose
!= false) {
2653 SetGLError(GL_INVALID_VALUE
, "glUniformMatrix4x2fv",
2654 "transpose GL_INVALID_VALUE");
2657 helper_
->UniformMatrix4x2fvImmediate(location
, count
, value
);
2661 void GLES2Implementation::UniformMatrix4x3fv(GLint location
,
2663 GLboolean transpose
,
2664 const GLfloat
* value
) {
2665 GPU_CLIENT_SINGLE_THREAD_CHECK();
2666 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniformMatrix4x3fv(" << location
2667 << ", " << count
<< ", "
2668 << GLES2Util::GetStringBool(transpose
) << ", "
2669 << static_cast<const void*>(value
) << ")");
2670 GPU_CLIENT_LOG_CODE_BLOCK({
2671 for (GLsizei i
= 0; i
< count
; ++i
) {
2673 " " << i
<< ": " << value
[0 + i
* 12] << ", " << value
[1 + i
* 12]
2674 << ", " << value
[2 + i
* 12] << ", " << value
[3 + i
* 12] << ", "
2675 << value
[4 + i
* 12] << ", " << value
[5 + i
* 12] << ", "
2676 << value
[6 + i
* 12] << ", " << value
[7 + i
* 12] << ", "
2677 << value
[8 + i
* 12] << ", " << value
[9 + i
* 12] << ", "
2678 << value
[10 + i
* 12] << ", " << value
[11 + i
* 12]);
2682 SetGLError(GL_INVALID_VALUE
, "glUniformMatrix4x3fv", "count < 0");
2685 if (transpose
!= false) {
2686 SetGLError(GL_INVALID_VALUE
, "glUniformMatrix4x3fv",
2687 "transpose GL_INVALID_VALUE");
2690 helper_
->UniformMatrix4x3fvImmediate(location
, count
, value
);
2694 void GLES2Implementation::UseProgram(GLuint program
) {
2695 GPU_CLIENT_SINGLE_THREAD_CHECK();
2696 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUseProgram(" << program
<< ")");
2697 if (IsProgramReservedId(program
)) {
2698 SetGLError(GL_INVALID_OPERATION
, "UseProgram", "program reserved id");
2701 UseProgramHelper(program
);
2705 void GLES2Implementation::ValidateProgram(GLuint program
) {
2706 GPU_CLIENT_SINGLE_THREAD_CHECK();
2707 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glValidateProgram(" << program
2709 helper_
->ValidateProgram(program
);
2713 void GLES2Implementation::VertexAttrib1f(GLuint indx
, GLfloat x
) {
2714 GPU_CLIENT_SINGLE_THREAD_CHECK();
2715 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glVertexAttrib1f(" << indx
<< ", "
2717 helper_
->VertexAttrib1f(indx
, x
);
2721 void GLES2Implementation::VertexAttrib1fv(GLuint indx
, const GLfloat
* values
) {
2722 GPU_CLIENT_SINGLE_THREAD_CHECK();
2723 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glVertexAttrib1fv(" << indx
<< ", "
2724 << static_cast<const void*>(values
) << ")");
2726 for (size_t ii
= 0; ii
< count
; ++ii
)
2727 GPU_CLIENT_LOG("value[" << ii
<< "]: " << values
[ii
]);
2728 helper_
->VertexAttrib1fvImmediate(indx
, values
);
2732 void GLES2Implementation::VertexAttrib2f(GLuint indx
, GLfloat x
, GLfloat y
) {
2733 GPU_CLIENT_SINGLE_THREAD_CHECK();
2734 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glVertexAttrib2f(" << indx
<< ", "
2735 << x
<< ", " << y
<< ")");
2736 helper_
->VertexAttrib2f(indx
, x
, y
);
2740 void GLES2Implementation::VertexAttrib2fv(GLuint indx
, const GLfloat
* values
) {
2741 GPU_CLIENT_SINGLE_THREAD_CHECK();
2742 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glVertexAttrib2fv(" << indx
<< ", "
2743 << static_cast<const void*>(values
) << ")");
2745 for (size_t ii
= 0; ii
< count
; ++ii
)
2746 GPU_CLIENT_LOG("value[" << ii
<< "]: " << values
[ii
]);
2747 helper_
->VertexAttrib2fvImmediate(indx
, values
);
2751 void GLES2Implementation::VertexAttrib3f(GLuint indx
,
2755 GPU_CLIENT_SINGLE_THREAD_CHECK();
2756 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glVertexAttrib3f(" << indx
<< ", "
2757 << x
<< ", " << y
<< ", " << z
<< ")");
2758 helper_
->VertexAttrib3f(indx
, x
, y
, z
);
2762 void GLES2Implementation::VertexAttrib3fv(GLuint indx
, const GLfloat
* values
) {
2763 GPU_CLIENT_SINGLE_THREAD_CHECK();
2764 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glVertexAttrib3fv(" << indx
<< ", "
2765 << static_cast<const void*>(values
) << ")");
2767 for (size_t ii
= 0; ii
< count
; ++ii
)
2768 GPU_CLIENT_LOG("value[" << ii
<< "]: " << values
[ii
]);
2769 helper_
->VertexAttrib3fvImmediate(indx
, values
);
2773 void GLES2Implementation::VertexAttrib4f(GLuint indx
,
2778 GPU_CLIENT_SINGLE_THREAD_CHECK();
2779 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glVertexAttrib4f(" << indx
<< ", "
2780 << x
<< ", " << y
<< ", " << z
<< ", " << w
<< ")");
2781 helper_
->VertexAttrib4f(indx
, x
, y
, z
, w
);
2785 void GLES2Implementation::VertexAttrib4fv(GLuint indx
, const GLfloat
* values
) {
2786 GPU_CLIENT_SINGLE_THREAD_CHECK();
2787 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glVertexAttrib4fv(" << indx
<< ", "
2788 << static_cast<const void*>(values
) << ")");
2790 for (size_t ii
= 0; ii
< count
; ++ii
)
2791 GPU_CLIENT_LOG("value[" << ii
<< "]: " << values
[ii
]);
2792 helper_
->VertexAttrib4fvImmediate(indx
, values
);
2796 void GLES2Implementation::VertexAttribI4i(GLuint indx
,
2801 GPU_CLIENT_SINGLE_THREAD_CHECK();
2802 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glVertexAttribI4i(" << indx
<< ", "
2803 << x
<< ", " << y
<< ", " << z
<< ", " << w
<< ")");
2804 helper_
->VertexAttribI4i(indx
, x
, y
, z
, w
);
2808 void GLES2Implementation::VertexAttribI4iv(GLuint indx
, const GLint
* values
) {
2809 GPU_CLIENT_SINGLE_THREAD_CHECK();
2810 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glVertexAttribI4iv(" << indx
2811 << ", " << static_cast<const void*>(values
) << ")");
2813 for (size_t ii
= 0; ii
< count
; ++ii
)
2814 GPU_CLIENT_LOG("value[" << ii
<< "]: " << values
[ii
]);
2815 helper_
->VertexAttribI4ivImmediate(indx
, values
);
2819 void GLES2Implementation::VertexAttribI4ui(GLuint indx
,
2824 GPU_CLIENT_SINGLE_THREAD_CHECK();
2825 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glVertexAttribI4ui(" << indx
2826 << ", " << x
<< ", " << y
<< ", " << z
<< ", " << w
2828 helper_
->VertexAttribI4ui(indx
, x
, y
, z
, w
);
2832 void GLES2Implementation::VertexAttribI4uiv(GLuint indx
, const GLuint
* values
) {
2833 GPU_CLIENT_SINGLE_THREAD_CHECK();
2834 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glVertexAttribI4uiv(" << indx
2835 << ", " << static_cast<const void*>(values
) << ")");
2837 for (size_t ii
= 0; ii
< count
; ++ii
)
2838 GPU_CLIENT_LOG("value[" << ii
<< "]: " << values
[ii
]);
2839 helper_
->VertexAttribI4uivImmediate(indx
, values
);
2843 void GLES2Implementation::Viewport(GLint x
,
2847 GPU_CLIENT_SINGLE_THREAD_CHECK();
2848 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glViewport(" << x
<< ", " << y
2849 << ", " << width
<< ", " << height
<< ")");
2851 SetGLError(GL_INVALID_VALUE
, "glViewport", "width < 0");
2855 SetGLError(GL_INVALID_VALUE
, "glViewport", "height < 0");
2858 helper_
->Viewport(x
, y
, width
, height
);
2862 void GLES2Implementation::BlitFramebufferCHROMIUM(GLint srcX0
,
2872 GPU_CLIENT_SINGLE_THREAD_CHECK();
2873 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBlitFramebufferCHROMIUM("
2874 << srcX0
<< ", " << srcY0
<< ", " << srcX1
<< ", " << srcY1
2875 << ", " << dstX0
<< ", " << dstY0
<< ", " << dstX1
<< ", "
2876 << dstY1
<< ", " << mask
<< ", "
2877 << GLES2Util::GetStringBlitFilter(filter
) << ")");
2878 helper_
->BlitFramebufferCHROMIUM(srcX0
, srcY0
, srcX1
, srcY1
, dstX0
, dstY0
,
2879 dstX1
, dstY1
, mask
, filter
);
2883 void GLES2Implementation::RenderbufferStorageMultisampleCHROMIUM(
2886 GLenum internalformat
,
2889 GPU_CLIENT_SINGLE_THREAD_CHECK();
2891 "[" << GetLogPrefix() << "] glRenderbufferStorageMultisampleCHROMIUM("
2892 << GLES2Util::GetStringRenderBufferTarget(target
) << ", " << samples
2893 << ", " << GLES2Util::GetStringRenderBufferFormat(internalformat
)
2894 << ", " << width
<< ", " << height
<< ")");
2896 SetGLError(GL_INVALID_VALUE
, "glRenderbufferStorageMultisampleCHROMIUM",
2901 SetGLError(GL_INVALID_VALUE
, "glRenderbufferStorageMultisampleCHROMIUM",
2906 SetGLError(GL_INVALID_VALUE
, "glRenderbufferStorageMultisampleCHROMIUM",
2910 helper_
->RenderbufferStorageMultisampleCHROMIUM(
2911 target
, samples
, internalformat
, width
, height
);
2915 void GLES2Implementation::RenderbufferStorageMultisampleEXT(
2918 GLenum internalformat
,
2921 GPU_CLIENT_SINGLE_THREAD_CHECK();
2923 "[" << GetLogPrefix() << "] glRenderbufferStorageMultisampleEXT("
2924 << GLES2Util::GetStringRenderBufferTarget(target
) << ", " << samples
2925 << ", " << GLES2Util::GetStringRenderBufferFormat(internalformat
)
2926 << ", " << width
<< ", " << height
<< ")");
2928 SetGLError(GL_INVALID_VALUE
, "glRenderbufferStorageMultisampleEXT",
2933 SetGLError(GL_INVALID_VALUE
, "glRenderbufferStorageMultisampleEXT",
2938 SetGLError(GL_INVALID_VALUE
, "glRenderbufferStorageMultisampleEXT",
2942 helper_
->RenderbufferStorageMultisampleEXT(target
, samples
, internalformat
,
2947 void GLES2Implementation::FramebufferTexture2DMultisampleEXT(GLenum target
,
2953 GPU_CLIENT_SINGLE_THREAD_CHECK();
2954 GPU_CLIENT_LOG("[" << GetLogPrefix()
2955 << "] glFramebufferTexture2DMultisampleEXT("
2956 << GLES2Util::GetStringFrameBufferTarget(target
) << ", "
2957 << GLES2Util::GetStringAttachment(attachment
) << ", "
2958 << GLES2Util::GetStringTextureTarget(textarget
) << ", "
2959 << texture
<< ", " << level
<< ", " << samples
<< ")");
2961 SetGLError(GL_INVALID_VALUE
, "glFramebufferTexture2DMultisampleEXT",
2962 "level GL_INVALID_VALUE");
2966 SetGLError(GL_INVALID_VALUE
, "glFramebufferTexture2DMultisampleEXT",
2970 helper_
->FramebufferTexture2DMultisampleEXT(target
, attachment
, textarget
,
2975 void GLES2Implementation::TexStorage2DEXT(GLenum target
,
2977 GLenum internalFormat
,
2980 GPU_CLIENT_SINGLE_THREAD_CHECK();
2982 "[" << GetLogPrefix() << "] glTexStorage2DEXT("
2983 << GLES2Util::GetStringTextureTarget(target
) << ", " << levels
<< ", "
2984 << GLES2Util::GetStringTextureInternalFormatStorage(internalFormat
)
2985 << ", " << width
<< ", " << height
<< ")");
2987 SetGLError(GL_INVALID_VALUE
, "glTexStorage2DEXT", "levels < 0");
2991 SetGLError(GL_INVALID_VALUE
, "glTexStorage2DEXT", "width < 0");
2995 SetGLError(GL_INVALID_VALUE
, "glTexStorage2DEXT", "height < 0");
2998 helper_
->TexStorage2DEXT(target
, levels
, internalFormat
, width
, height
);
3002 void GLES2Implementation::GenQueriesEXT(GLsizei n
, GLuint
* queries
) {
3003 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGenQueriesEXT(" << n
<< ", "
3004 << static_cast<const void*>(queries
) << ")");
3006 SetGLError(GL_INVALID_VALUE
, "glGenQueriesEXT", "n < 0");
3009 GPU_CLIENT_SINGLE_THREAD_CHECK();
3010 IdAllocator
* id_allocator
= GetIdAllocator(id_namespaces::kQueries
);
3011 for (GLsizei ii
= 0; ii
< n
; ++ii
)
3012 queries
[ii
] = id_allocator
->AllocateID();
3013 GenQueriesEXTHelper(n
, queries
);
3014 helper_
->GenQueriesEXTImmediate(n
, queries
);
3015 if (share_group_
->bind_generates_resource())
3016 helper_
->CommandBufferHelper::Flush();
3017 GPU_CLIENT_LOG_CODE_BLOCK({
3018 for (GLsizei i
= 0; i
< n
; ++i
) {
3019 GPU_CLIENT_LOG(" " << i
<< ": " << queries
[i
]);
3025 void GLES2Implementation::DeleteQueriesEXT(GLsizei n
, const GLuint
* queries
) {
3026 GPU_CLIENT_SINGLE_THREAD_CHECK();
3027 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDeleteQueriesEXT(" << n
<< ", "
3028 << static_cast<const void*>(queries
) << ")");
3029 GPU_CLIENT_LOG_CODE_BLOCK({
3030 for (GLsizei i
= 0; i
< n
; ++i
) {
3031 GPU_CLIENT_LOG(" " << i
<< ": " << queries
[i
]);
3034 GPU_CLIENT_DCHECK_CODE_BLOCK({
3035 for (GLsizei i
= 0; i
< n
; ++i
) {
3036 DCHECK(queries
[i
] != 0);
3040 SetGLError(GL_INVALID_VALUE
, "glDeleteQueriesEXT", "n < 0");
3043 DeleteQueriesEXTHelper(n
, queries
);
3047 void GLES2Implementation::BeginTransformFeedback(GLenum primitivemode
) {
3048 GPU_CLIENT_SINGLE_THREAD_CHECK();
3049 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBeginTransformFeedback("
3050 << GLES2Util::GetStringTransformFeedbackPrimitiveMode(
3051 primitivemode
) << ")");
3052 helper_
->BeginTransformFeedback(primitivemode
);
3056 void GLES2Implementation::EndTransformFeedback() {
3057 GPU_CLIENT_SINGLE_THREAD_CHECK();
3058 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glEndTransformFeedback("
3060 helper_
->EndTransformFeedback();
3064 void GLES2Implementation::GenVertexArraysOES(GLsizei n
, GLuint
* arrays
) {
3065 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGenVertexArraysOES(" << n
<< ", "
3066 << static_cast<const void*>(arrays
) << ")");
3068 SetGLError(GL_INVALID_VALUE
, "glGenVertexArraysOES", "n < 0");
3071 GPU_CLIENT_SINGLE_THREAD_CHECK();
3072 GetIdHandler(id_namespaces::kVertexArrays
)->MakeIds(this, 0, n
, arrays
);
3073 GenVertexArraysOESHelper(n
, arrays
);
3074 helper_
->GenVertexArraysOESImmediate(n
, arrays
);
3075 if (share_group_
->bind_generates_resource())
3076 helper_
->CommandBufferHelper::Flush();
3077 GPU_CLIENT_LOG_CODE_BLOCK({
3078 for (GLsizei i
= 0; i
< n
; ++i
) {
3079 GPU_CLIENT_LOG(" " << i
<< ": " << arrays
[i
]);
3085 void GLES2Implementation::DeleteVertexArraysOES(GLsizei n
,
3086 const GLuint
* arrays
) {
3087 GPU_CLIENT_SINGLE_THREAD_CHECK();
3088 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDeleteVertexArraysOES(" << n
3089 << ", " << static_cast<const void*>(arrays
) << ")");
3090 GPU_CLIENT_LOG_CODE_BLOCK({
3091 for (GLsizei i
= 0; i
< n
; ++i
) {
3092 GPU_CLIENT_LOG(" " << i
<< ": " << arrays
[i
]);
3095 GPU_CLIENT_DCHECK_CODE_BLOCK({
3096 for (GLsizei i
= 0; i
< n
; ++i
) {
3097 DCHECK(arrays
[i
] != 0);
3101 SetGLError(GL_INVALID_VALUE
, "glDeleteVertexArraysOES", "n < 0");
3104 DeleteVertexArraysOESHelper(n
, arrays
);
3108 GLboolean
GLES2Implementation::IsVertexArrayOES(GLuint array
) {
3109 GPU_CLIENT_SINGLE_THREAD_CHECK();
3110 TRACE_EVENT0("gpu", "GLES2Implementation::IsVertexArrayOES");
3111 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glIsVertexArrayOES(" << array
3113 typedef cmds::IsVertexArrayOES::Result Result
;
3114 Result
* result
= GetResultAs
<Result
*>();
3119 helper_
->IsVertexArrayOES(array
, GetResultShmId(), GetResultShmOffset());
3121 GLboolean result_value
= *result
!= 0;
3122 GPU_CLIENT_LOG("returned " << result_value
);
3124 return result_value
;
3127 void GLES2Implementation::BindVertexArrayOES(GLuint array
) {
3128 GPU_CLIENT_SINGLE_THREAD_CHECK();
3129 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBindVertexArrayOES(" << array
3131 if (IsVertexArrayReservedId(array
)) {
3132 SetGLError(GL_INVALID_OPERATION
, "BindVertexArrayOES", "array reserved id");
3135 BindVertexArrayOESHelper(array
);
3139 void GLES2Implementation::GetTranslatedShaderSourceANGLE(GLuint shader
,
3143 GPU_CLIENT_SINGLE_THREAD_CHECK();
3144 GPU_CLIENT_VALIDATE_DESTINATION_OPTIONAL_INITALIZATION(GLsizei
, length
);
3145 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetTranslatedShaderSourceANGLE"
3146 << "(" << shader
<< ", " << bufsize
<< ", "
3147 << static_cast<void*>(length
) << ", "
3148 << static_cast<void*>(source
) << ")");
3149 helper_
->SetBucketSize(kResultBucketId
, 0);
3150 helper_
->GetTranslatedShaderSourceANGLE(shader
, kResultBucketId
);
3152 GLsizei max_size
= 0;
3153 if (GetBucketAsString(kResultBucketId
, &str
)) {
3155 max_size
= std::min(static_cast<size_t>(bufsize
) - 1, str
.size());
3156 memcpy(source
, str
.c_str(), max_size
);
3157 source
[max_size
] = '\0';
3158 GPU_CLIENT_LOG("------\n" << source
<< "\n------");
3161 if (length
!= NULL
) {
3166 void GLES2Implementation::TexImageIOSurface2DCHROMIUM(GLenum target
,
3171 GPU_CLIENT_SINGLE_THREAD_CHECK();
3172 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glTexImageIOSurface2DCHROMIUM("
3173 << GLES2Util::GetStringTextureBindTarget(target
) << ", "
3174 << width
<< ", " << height
<< ", " << ioSurfaceId
<< ", "
3177 SetGLError(GL_INVALID_VALUE
, "glTexImageIOSurface2DCHROMIUM", "width < 0");
3181 SetGLError(GL_INVALID_VALUE
, "glTexImageIOSurface2DCHROMIUM", "height < 0");
3184 helper_
->TexImageIOSurface2DCHROMIUM(target
, width
, height
, ioSurfaceId
,
3189 void GLES2Implementation::CopyTextureCHROMIUM(GLenum target
,
3192 GLint internalformat
,
3194 GPU_CLIENT_SINGLE_THREAD_CHECK();
3195 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glCopyTextureCHROMIUM("
3196 << GLES2Util::GetStringEnum(target
) << ", "
3197 << GLES2Util::GetStringEnum(source_id
) << ", "
3198 << GLES2Util::GetStringEnum(dest_id
) << ", "
3199 << internalformat
<< ", "
3200 << GLES2Util::GetStringPixelType(dest_type
) << ")");
3201 helper_
->CopyTextureCHROMIUM(target
, source_id
, dest_id
, internalformat
,
3206 void GLES2Implementation::CopySubTextureCHROMIUM(GLenum target
,
3211 GPU_CLIENT_SINGLE_THREAD_CHECK();
3212 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glCopySubTextureCHROMIUM("
3213 << GLES2Util::GetStringEnum(target
) << ", "
3214 << GLES2Util::GetStringEnum(source_id
) << ", "
3215 << GLES2Util::GetStringEnum(dest_id
) << ", " << xoffset
3216 << ", " << yoffset
<< ")");
3217 helper_
->CopySubTextureCHROMIUM(target
, source_id
, dest_id
, xoffset
, yoffset
);
3221 void GLES2Implementation::GenValuebuffersCHROMIUM(GLsizei n
, GLuint
* buffers
) {
3222 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGenValuebuffersCHROMIUM(" << n
3223 << ", " << static_cast<const void*>(buffers
) << ")");
3225 SetGLError(GL_INVALID_VALUE
, "glGenValuebuffersCHROMIUM", "n < 0");
3228 GPU_CLIENT_SINGLE_THREAD_CHECK();
3229 GetIdHandler(id_namespaces::kValuebuffers
)->MakeIds(this, 0, n
, buffers
);
3230 GenValuebuffersCHROMIUMHelper(n
, buffers
);
3231 helper_
->GenValuebuffersCHROMIUMImmediate(n
, buffers
);
3232 if (share_group_
->bind_generates_resource())
3233 helper_
->CommandBufferHelper::Flush();
3234 GPU_CLIENT_LOG_CODE_BLOCK({
3235 for (GLsizei i
= 0; i
< n
; ++i
) {
3236 GPU_CLIENT_LOG(" " << i
<< ": " << buffers
[i
]);
3242 void GLES2Implementation::DeleteValuebuffersCHROMIUM(
3244 const GLuint
* valuebuffers
) {
3245 GPU_CLIENT_SINGLE_THREAD_CHECK();
3246 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDeleteValuebuffersCHROMIUM(" << n
3247 << ", " << static_cast<const void*>(valuebuffers
) << ")");
3248 GPU_CLIENT_LOG_CODE_BLOCK({
3249 for (GLsizei i
= 0; i
< n
; ++i
) {
3250 GPU_CLIENT_LOG(" " << i
<< ": " << valuebuffers
[i
]);
3253 GPU_CLIENT_DCHECK_CODE_BLOCK({
3254 for (GLsizei i
= 0; i
< n
; ++i
) {
3255 DCHECK(valuebuffers
[i
] != 0);
3259 SetGLError(GL_INVALID_VALUE
, "glDeleteValuebuffersCHROMIUM", "n < 0");
3262 DeleteValuebuffersCHROMIUMHelper(n
, valuebuffers
);
3266 GLboolean
GLES2Implementation::IsValuebufferCHROMIUM(GLuint valuebuffer
) {
3267 GPU_CLIENT_SINGLE_THREAD_CHECK();
3268 TRACE_EVENT0("gpu", "GLES2Implementation::IsValuebufferCHROMIUM");
3269 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glIsValuebufferCHROMIUM("
3270 << valuebuffer
<< ")");
3271 typedef cmds::IsValuebufferCHROMIUM::Result Result
;
3272 Result
* result
= GetResultAs
<Result
*>();
3277 helper_
->IsValuebufferCHROMIUM(valuebuffer
, GetResultShmId(),
3278 GetResultShmOffset());
3280 GLboolean result_value
= *result
!= 0;
3281 GPU_CLIENT_LOG("returned " << result_value
);
3283 return result_value
;
3286 void GLES2Implementation::BindValuebufferCHROMIUM(GLenum target
,
3287 GLuint valuebuffer
) {
3288 GPU_CLIENT_SINGLE_THREAD_CHECK();
3289 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBindValuebufferCHROMIUM("
3290 << GLES2Util::GetStringValueBufferTarget(target
) << ", "
3291 << valuebuffer
<< ")");
3292 if (IsValuebufferReservedId(valuebuffer
)) {
3293 SetGLError(GL_INVALID_OPERATION
, "BindValuebufferCHROMIUM",
3294 "valuebuffer reserved id");
3297 BindValuebufferCHROMIUMHelper(target
, valuebuffer
);
3301 void GLES2Implementation::SubscribeValueCHROMIUM(GLenum target
,
3302 GLenum subscription
) {
3303 GPU_CLIENT_SINGLE_THREAD_CHECK();
3304 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glSubscribeValueCHROMIUM("
3305 << GLES2Util::GetStringValueBufferTarget(target
) << ", "
3306 << GLES2Util::GetStringSubscriptionTarget(subscription
)
3308 helper_
->SubscribeValueCHROMIUM(target
, subscription
);
3312 void GLES2Implementation::PopulateSubscribedValuesCHROMIUM(GLenum target
) {
3313 GPU_CLIENT_SINGLE_THREAD_CHECK();
3314 GPU_CLIENT_LOG("[" << GetLogPrefix()
3315 << "] glPopulateSubscribedValuesCHROMIUM("
3316 << GLES2Util::GetStringValueBufferTarget(target
) << ")");
3317 helper_
->PopulateSubscribedValuesCHROMIUM(target
);
3321 void GLES2Implementation::UniformValuebufferCHROMIUM(GLint location
,
3323 GLenum subscription
) {
3324 GPU_CLIENT_SINGLE_THREAD_CHECK();
3326 "[" << GetLogPrefix() << "] glUniformValuebufferCHROMIUM(" << location
3327 << ", " << GLES2Util::GetStringValueBufferTarget(target
) << ", "
3328 << GLES2Util::GetStringSubscriptionTarget(subscription
) << ")");
3329 helper_
->UniformValuebufferCHROMIUM(location
, target
, subscription
);
3333 void GLES2Implementation::BindTexImage2DCHROMIUM(GLenum target
, GLint imageId
) {
3334 GPU_CLIENT_SINGLE_THREAD_CHECK();
3335 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBindTexImage2DCHROMIUM("
3336 << GLES2Util::GetStringTextureBindTarget(target
) << ", "
3338 helper_
->BindTexImage2DCHROMIUM(target
, imageId
);
3342 void GLES2Implementation::ReleaseTexImage2DCHROMIUM(GLenum target
,
3344 GPU_CLIENT_SINGLE_THREAD_CHECK();
3345 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glReleaseTexImage2DCHROMIUM("
3346 << GLES2Util::GetStringTextureBindTarget(target
) << ", "
3348 helper_
->ReleaseTexImage2DCHROMIUM(target
, imageId
);
3352 void GLES2Implementation::DiscardFramebufferEXT(GLenum target
,
3354 const GLenum
* attachments
) {
3355 GPU_CLIENT_SINGLE_THREAD_CHECK();
3356 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDiscardFramebufferEXT("
3357 << GLES2Util::GetStringEnum(target
) << ", " << count
3358 << ", " << static_cast<const void*>(attachments
) << ")");
3359 GPU_CLIENT_LOG_CODE_BLOCK({
3360 for (GLsizei i
= 0; i
< count
; ++i
) {
3361 GPU_CLIENT_LOG(" " << i
<< ": " << attachments
[0 + i
* 1]);
3365 SetGLError(GL_INVALID_VALUE
, "glDiscardFramebufferEXT", "count < 0");
3368 helper_
->DiscardFramebufferEXTImmediate(target
, count
, attachments
);
3372 void GLES2Implementation::LoseContextCHROMIUM(GLenum current
, GLenum other
) {
3373 GPU_CLIENT_SINGLE_THREAD_CHECK();
3374 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glLoseContextCHROMIUM("
3375 << GLES2Util::GetStringResetStatus(current
) << ", "
3376 << GLES2Util::GetStringResetStatus(other
) << ")");
3377 helper_
->LoseContextCHROMIUM(current
, other
);
3381 void GLES2Implementation::WaitSyncPointCHROMIUM(GLuint sync_point
) {
3382 GPU_CLIENT_SINGLE_THREAD_CHECK();
3383 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glWaitSyncPointCHROMIUM("
3384 << sync_point
<< ")");
3385 helper_
->WaitSyncPointCHROMIUM(sync_point
);
3389 void GLES2Implementation::DrawBuffersEXT(GLsizei count
, const GLenum
* bufs
) {
3390 GPU_CLIENT_SINGLE_THREAD_CHECK();
3391 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDrawBuffersEXT(" << count
<< ", "
3392 << static_cast<const void*>(bufs
) << ")");
3393 GPU_CLIENT_LOG_CODE_BLOCK({
3394 for (GLsizei i
= 0; i
< count
; ++i
) {
3395 GPU_CLIENT_LOG(" " << i
<< ": " << bufs
[0 + i
* 1]);
3399 SetGLError(GL_INVALID_VALUE
, "glDrawBuffersEXT", "count < 0");
3402 helper_
->DrawBuffersEXTImmediate(count
, bufs
);
3406 void GLES2Implementation::DiscardBackbufferCHROMIUM() {
3407 GPU_CLIENT_SINGLE_THREAD_CHECK();
3408 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDiscardBackbufferCHROMIUM("
3410 helper_
->DiscardBackbufferCHROMIUM();
3414 void GLES2Implementation::ScheduleOverlayPlaneCHROMIUM(
3415 GLint plane_z_order
,
3416 GLenum plane_transform
,
3417 GLuint overlay_texture_id
,
3421 GLint bounds_height
,
3425 GLfloat uv_height
) {
3426 GPU_CLIENT_SINGLE_THREAD_CHECK();
3428 "[" << GetLogPrefix() << "] glScheduleOverlayPlaneCHROMIUM("
3429 << plane_z_order
<< ", " << GLES2Util::GetStringEnum(plane_transform
)
3430 << ", " << overlay_texture_id
<< ", " << bounds_x
<< ", " << bounds_y
3431 << ", " << bounds_width
<< ", " << bounds_height
<< ", " << uv_x
3432 << ", " << uv_y
<< ", " << uv_width
<< ", " << uv_height
<< ")");
3433 helper_
->ScheduleOverlayPlaneCHROMIUM(
3434 plane_z_order
, plane_transform
, overlay_texture_id
, bounds_x
, bounds_y
,
3435 bounds_width
, bounds_height
, uv_x
, uv_y
, uv_width
, uv_height
);
3439 void GLES2Implementation::MatrixLoadfCHROMIUM(GLenum matrixMode
,
3441 GPU_CLIENT_SINGLE_THREAD_CHECK();
3442 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glMatrixLoadfCHROMIUM("
3443 << GLES2Util::GetStringMatrixMode(matrixMode
) << ", "
3444 << static_cast<const void*>(m
) << ")");
3446 for (size_t ii
= 0; ii
< count
; ++ii
)
3447 GPU_CLIENT_LOG("value[" << ii
<< "]: " << m
[ii
]);
3448 helper_
->MatrixLoadfCHROMIUMImmediate(matrixMode
, m
);
3452 void GLES2Implementation::MatrixLoadIdentityCHROMIUM(GLenum matrixMode
) {
3453 GPU_CLIENT_SINGLE_THREAD_CHECK();
3454 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glMatrixLoadIdentityCHROMIUM("
3455 << GLES2Util::GetStringMatrixMode(matrixMode
) << ")");
3456 helper_
->MatrixLoadIdentityCHROMIUM(matrixMode
);
3460 void GLES2Implementation::BlendBarrierKHR() {
3461 GPU_CLIENT_SINGLE_THREAD_CHECK();
3462 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBlendBarrierKHR("
3464 helper_
->BlendBarrierKHR();
3468 #endif // GPU_COMMAND_BUFFER_CLIENT_GLES2_IMPLEMENTATION_IMPL_AUTOGEN_H_