blob: 1dc136933aa114eba3471ce11e1db7117aa64747 [file] [log] [blame]
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// This file is auto-generated from
// gpu/command_buffer/build_gles2_cmd_buffer.py
// It's formatted by clang-format using chromium coding style:
// clang-format -i -style=chromium filename
// DO NOT EDIT!
// This file is included by gles2_implementation.cc to define the
// GL api functions.
#ifndef GPU_COMMAND_BUFFER_CLIENT_GLES2_IMPLEMENTATION_IMPL_AUTOGEN_H_
#define GPU_COMMAND_BUFFER_CLIENT_GLES2_IMPLEMENTATION_IMPL_AUTOGEN_H_
void GLES2Implementation::AttachShader(GLuint program, GLuint shader) {
GPU_CLIENT_SINGLE_THREAD_CHECK();
GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glAttachShader(" << program << ", "
<< shader << ")");
helper_->AttachShader(program, shader);
CheckGLError();
}
void GLES2Implementation::BindBuffer(GLenum target, GLuint buffer) {
GPU_CLIENT_SINGLE_THREAD_CHECK();
GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBindBuffer("
<< GLES2Util::GetStringBufferTarget(target) << ", "
<< buffer << ")");
if (IsBufferReservedId(buffer)) {
SetGLError(GL_INVALID_OPERATION, "BindBuffer", "buffer reserved id");
return;
}
BindBufferHelper(target, buffer);
CheckGLError();
}
void GLES2Implementation::BindBufferBase(GLenum target,
GLuint index,
GLuint buffer) {
GPU_CLIENT_SINGLE_THREAD_CHECK();
GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBindBufferBase("
<< GLES2Util::GetStringIndexedBufferTarget(target) << ", "
<< index << ", " << buffer << ")");
if (IsBufferReservedId(buffer)) {
SetGLError(GL_INVALID_OPERATION, "BindBufferBase", "buffer reserved id");
return;
}
BindBufferBaseHelper(target, index, buffer);
CheckGLError();
}
void GLES2Implementation::BindBufferRange(GLenum target,
GLuint index,
GLuint buffer,
GLintptr offset,
GLsizeiptr size) {
GPU_CLIENT_SINGLE_THREAD_CHECK();
GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBindBufferRange("
<< GLES2Util::GetStringIndexedBufferTarget(target) << ", "
<< index << ", " << buffer << ", " << offset << ", "
<< size << ")");
if (offset < 0) {
SetGLError(GL_INVALID_VALUE, "glBindBufferRange", "offset < 0");
return;
}
if (size < 0) {
SetGLError(GL_INVALID_VALUE, "glBindBufferRange", "size < 0");
return;
}
if (IsBufferReservedId(buffer)) {
SetGLError(GL_INVALID_OPERATION, "BindBufferRange", "buffer reserved id");
return;
}
BindBufferRangeHelper(target, index, buffer, offset, size);
CheckGLError();
}
void GLES2Implementation::BindFramebuffer(GLenum target, GLuint framebuffer) {
GPU_CLIENT_SINGLE_THREAD_CHECK();
GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBindFramebuffer("
<< GLES2Util::GetStringFramebufferTarget(target) << ", "
<< framebuffer << ")");
if (IsFramebufferReservedId(framebuffer)) {
SetGLError(GL_INVALID_OPERATION, "BindFramebuffer",
"framebuffer reserved id");
return;
}
BindFramebufferHelper(target, framebuffer);
CheckGLError();
}
void GLES2Implementation::BindRenderbuffer(GLenum target, GLuint renderbuffer) {
GPU_CLIENT_SINGLE_THREAD_CHECK();
GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBindRenderbuffer("
<< GLES2Util::GetStringRenderBufferTarget(target) << ", "
<< renderbuffer << ")");
if (IsRenderbufferReservedId(renderbuffer)) {
SetGLError(GL_INVALID_OPERATION, "BindRenderbuffer",
"renderbuffer reserved id");
return;
}
BindRenderbufferHelper(target, renderbuffer);
CheckGLError();
}
void GLES2Implementation::BindSampler(GLuint unit, GLuint sampler) {
GPU_CLIENT_SINGLE_THREAD_CHECK();
GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBindSampler(" << unit << ", "
<< sampler << ")");
if (IsSamplerReservedId(sampler)) {
SetGLError(GL_INVALID_OPERATION, "BindSampler", "sampler reserved id");
return;
}
BindSamplerHelper(unit, sampler);
CheckGLError();
}
void GLES2Implementation::BindTexture(GLenum target, GLuint texture) {
GPU_CLIENT_SINGLE_THREAD_CHECK();
GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBindTexture("
<< GLES2Util::GetStringTextureBindTarget(target) << ", "
<< texture << ")");
if (IsTextureReservedId(texture)) {
SetGLError(GL_INVALID_OPERATION, "BindTexture", "texture reserved id");
return;
}
BindTextureHelper(target, texture);
CheckGLError();
}
void GLES2Implementation::BindTransformFeedback(GLenum target,
GLuint transformfeedback) {
GPU_CLIENT_SINGLE_THREAD_CHECK();
GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBindTransformFeedback("
<< GLES2Util::GetStringTransformFeedbackBindTarget(target)
<< ", " << transformfeedback << ")");
if (IsTransformFeedbackReservedId(transformfeedback)) {
SetGLError(GL_INVALID_OPERATION, "BindTransformFeedback",
"transformfeedback reserved id");
return;
}
BindTransformFeedbackHelper(target, transformfeedback);
CheckGLError();
}
void GLES2Implementation::BlendColor(GLclampf red,
GLclampf green,
GLclampf blue,
GLclampf alpha) {
GPU_CLIENT_SINGLE_THREAD_CHECK();
GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBlendColor(" << red << ", "
<< green << ", " << blue << ", " << alpha << ")");
helper_->BlendColor(red, green, blue, alpha);
CheckGLError();
}
void GLES2Implementation::BlendEquation(GLenum mode) {
GPU_CLIENT_SINGLE_THREAD_CHECK();
GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBlendEquation("
<< GLES2Util::GetStringEquation(mode) << ")");
helper_->BlendEquation(mode);
CheckGLError();
}
void GLES2Implementation::BlendEquationSeparate(GLenum modeRGB,
GLenum modeAlpha) {
GPU_CLIENT_SINGLE_THREAD_CHECK();
GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBlendEquationSeparate("
<< GLES2Util::GetStringEquation(modeRGB) << ", "
<< GLES2Util::GetStringEquation(modeAlpha) << ")");
helper_->BlendEquationSeparate(modeRGB, modeAlpha);
CheckGLError();
}
void GLES2Implementation::BlendFunc(GLenum sfactor, GLenum dfactor) {
GPU_CLIENT_SINGLE_THREAD_CHECK();
GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBlendFunc("
<< GLES2Util::GetStringSrcBlendFactor(sfactor) << ", "
<< GLES2Util::GetStringDstBlendFactor(dfactor) << ")");
helper_->BlendFunc(sfactor, dfactor);
CheckGLError();
}
void GLES2Implementation::BlendFuncSeparate(GLenum srcRGB,
GLenum dstRGB,
GLenum srcAlpha,
GLenum dstAlpha) {
GPU_CLIENT_SINGLE_THREAD_CHECK();
GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBlendFuncSeparate("
<< GLES2Util::GetStringSrcBlendFactor(srcRGB) << ", "
<< GLES2Util::GetStringDstBlendFactor(dstRGB) << ", "
<< GLES2Util::GetStringSrcBlendFactor(srcAlpha) << ", "
<< GLES2Util::GetStringDstBlendFactor(dstAlpha) << ")");
helper_->BlendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha);
CheckGLError();
}
GLenum GLES2Implementation::CheckFramebufferStatus(GLenum target) {
GPU_CLIENT_SINGLE_THREAD_CHECK();
TRACE_EVENT0("gpu", "GLES2Implementation::CheckFramebufferStatus");
GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glCheckFramebufferStatus("
<< GLES2Util::GetStringFramebufferTarget(target) << ")");
typedef cmds::CheckFramebufferStatus::Result Result;
ScopedResultPtr<Result> result = GetResultAs<Result>();
if (!result) {
return GL_FRAMEBUFFER_UNSUPPORTED;
}
*result = 0;
helper_->CheckFramebufferStatus(target, GetResultShmId(), result.offset());
WaitForCmd();
GLenum result_value = *result;
GPU_CLIENT_LOG("returned " << result_value);
CheckGLError();
return result_value;
}
void GLES2Implementation::Clear(GLbitfield mask) {
GPU_CLIENT_SINGLE_THREAD_CHECK();
GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glClear(" << mask << ")");
helper_->Clear(mask);
CheckGLError();
}
void GLES2Implementation::ClearBufferfi(GLenum buffer,
GLint drawbuffers,
GLfloat depth,
GLint stencil) {
GPU_CLIENT_SINGLE_THREAD_CHECK();
GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glClearBufferfi("
<< GLES2Util::GetStringBufferfi(buffer) << ", "
<< drawbuffers << ", " << depth << ", " << stencil << ")");
helper_->ClearBufferfi(buffer, drawbuffers, depth, stencil);
CheckGLError();
}
void GLES2Implementation::ClearBufferfv(GLenum buffer,
GLint drawbuffers,
const GLfloat* value) {
GPU_CLIENT_SINGLE_THREAD_CHECK();
GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glClearBufferfv("
<< GLES2Util::GetStringBufferfv(buffer) << ", "
<< drawbuffers << ", " << static_cast<const void*>(value)
<< ")");
size_t count = GLES2Util::CalcClearBufferfvDataCount(buffer);
DCHECK_LE(count, 4u);
if (count == 0) {
SetGLErrorInvalidEnum("glClearBufferfv", buffer, "buffer");
return;
}
for (size_t ii = 0; ii < count; ++ii)
GPU_CLIENT_LOG("value[" << ii << "]: " << value[ii]);
helper_->ClearBufferfvImmediate(buffer, drawbuffers, value);
CheckGLError();
}
void GLES2Implementation::ClearBufferiv(GLenum buffer,
GLint drawbuffers,
const GLint* value) {
GPU_CLIENT_SINGLE_THREAD_CHECK();
GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glClearBufferiv("
<< GLES2Util::GetStringBufferiv(buffer) << ", "
<< drawbuffers << ", " << static_cast<const void*>(value)
<< ")");
size_t count = GLES2Util::CalcClearBufferivDataCount(buffer);
DCHECK_LE(count, 4u);
if (count == 0) {
SetGLErrorInvalidEnum("glClearBufferiv", buffer, "buffer");
return;
}
for (size_t ii = 0; ii < count; ++ii)
GPU_CLIENT_LOG("value[" << ii << "]: " << value[ii]);
helper_->ClearBufferivImmediate(buffer, drawbuffers, value);
CheckGLError();
}
void GLES2Implementation::ClearBufferuiv(GLenum buffer,
GLint drawbuffers,
const GLuint* value) {
GPU_CLIENT_SINGLE_THREAD_CHECK();
GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glClearBufferuiv("
<< GLES2Util::GetStringBufferuiv(buffer) << ", "
<< drawbuffers << ", " << static_cast<const void*>(value)
<< ")");
size_t count = GLES2Util::CalcClearBufferuivDataCount(buffer);
DCHECK_LE(count, 4u);
if (count == 0) {
SetGLErrorInvalidEnum("glClearBufferuiv", buffer, "buffer");
return;
}
for (size_t ii = 0; ii < count; ++ii)
GPU_CLIENT_LOG("value[" << ii << "]: " << value[ii]);
helper_->ClearBufferuivImmediate(buffer, drawbuffers, value);
CheckGLError();
}
void GLES2Implementation::ClearColor(GLclampf red,
GLclampf green,
GLclampf blue,
GLclampf alpha) {
GPU_CLIENT_SINGLE_THREAD_CHECK();
GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glClearColor(" << red << ", "
<< green << ", " << blue << ", " << alpha << ")");
helper_->ClearColor(red, green, blue, alpha);
CheckGLError();
}
void GLES2Implementation::ClearDepthf(GLclampf depth) {
GPU_CLIENT_SINGLE_THREAD_CHECK();
GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glClearDepthf(" << depth << ")");
helper_->ClearDepthf(depth);
CheckGLError();
}
void GLES2Implementation::ClearStencil(GLint s) {
GPU_CLIENT_SINGLE_THREAD_CHECK();
GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glClearStencil(" << s << ")");
helper_->ClearStencil(s);
CheckGLError();
}
void GLES2Implementation::ColorMask(GLboolean red,
GLboolean green,
GLboolean blue,
GLboolean alpha) {
GPU_CLIENT_SINGLE_THREAD_CHECK();
GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glColorMask("
<< GLES2Util::GetStringBool(red) << ", "
<< GLES2Util::GetStringBool(green) << ", "
<< GLES2Util::GetStringBool(blue) << ", "
<< GLES2Util::GetStringBool(alpha) << ")");
helper_->ColorMask(red, green, blue, alpha);
CheckGLError();
}
void GLES2Implementation::CompileShader(GLuint shader) {
GPU_CLIENT_SINGLE_THREAD_CHECK();
GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glCompileShader(" << shader
<< ")");
helper_->CompileShader(shader);
CheckGLError();
}
void GLES2Implementation::CopyTexImage2D(GLenum target,
GLint level,
GLenum internalformat,
GLint x,
GLint y,
GLsizei width,
GLsizei height,
GLint border) {
GPU_CLIENT_SINGLE_THREAD_CHECK();
GPU_CLIENT_LOG(
"[" << GetLogPrefix() << "] glCopyTexImage2D("
<< GLES2Util::GetStringTextureTarget(target) << ", " << level << ", "
<< GLES2Util::GetStringTextureInternalFormat(internalformat) << ", "
<< x << ", " << y << ", " << width << ", " << height << ", " << border
<< ")");
if (width < 0) {
SetGLError(GL_INVALID_VALUE, "glCopyTexImage2D", "width < 0");
return;
}
if (height < 0) {
SetGLError(GL_INVALID_VALUE, "glCopyTexImage2D", "height < 0");
return;
}
if (border != 0) {
SetGLError(GL_INVALID_VALUE, "glCopyTexImage2D", "border GL_INVALID_VALUE");
return;
}
helper_->CopyTexImage2D(target, level, internalformat, x, y, width, height);
CheckGLError();
}
void GLES2Implementation::CopyTexSubImage2D(GLenum target,
GLint level,
GLint xoffset,
GLint yoffset,
GLint x,
GLint y,
GLsizei width,
GLsizei height) {
GPU_CLIENT_SINGLE_THREAD_CHECK();
GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glCopyTexSubImage2D("
<< GLES2Util::GetStringTextureTarget(target) << ", "
<< level << ", " << xoffset << ", " << yoffset << ", " << x
<< ", " << y << ", " << width << ", " << height << ")");
if (width < 0) {
SetGLError(GL_INVALID_VALUE, "glCopyTexSubImage2D", "width < 0");
return;
}
if (height < 0) {
SetGLError(GL_INVALID_VALUE, "glCopyTexSubImage2D", "height < 0");
return;
}
helper_->CopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width,
height);
CheckGLError();
}
void GLES2Implementation::CopyTexSubImage3D(GLenum target,
GLint level,
GLint xoffset,
GLint yoffset,
GLint zoffset,
GLint x,
GLint y,
GLsizei width,
GLsizei height) {
GPU_CLIENT_SINGLE_THREAD_CHECK();
GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glCopyTexSubImage3D("
<< GLES2Util::GetStringTexture3DTarget(target) << ", "
<< level << ", " << xoffset << ", " << yoffset << ", "
<< zoffset << ", " << x << ", " << y << ", " << width
<< ", " << height << ")");
if (width < 0) {
SetGLError(GL_INVALID_VALUE, "glCopyTexSubImage3D", "width < 0");
return;
}
if (height < 0) {
SetGLError(GL_INVALID_VALUE, "glCopyTexSubImage3D", "height < 0");
return;
}
helper_->CopyTexSubImage3D(target, level, xoffset, yoffset, zoffset, x, y,
width, height);
CheckGLError();
}
GLuint GLES2Implementation::CreateProgram() {
GPU_CLIENT_SINGLE_THREAD_CHECK();
GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glCreateProgram("
<< ")");
GLuint client_id;
GetIdHandler(SharedIdNamespaces::kProgramsAndShaders)
->MakeIds(this, 0, 1, &client_id);
helper_->CreateProgram(client_id);
GPU_CLIENT_LOG("returned " << client_id);
CheckGLError();
return client_id;
}
GLuint GLES2Implementation::CreateShader(GLenum type) {
GPU_CLIENT_SINGLE_THREAD_CHECK();
GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glCreateShader("
<< GLES2Util::GetStringShaderType(type) << ")");
GLuint client_id;
GetIdHandler(SharedIdNamespaces::kProgramsAndShaders)
->MakeIds(this, 0, 1, &client_id);
helper_->CreateShader(type, client_id);
GPU_CLIENT_LOG("returned " << client_id);
CheckGLError();
return client_id;
}
void GLES2Implementation::CullFace(GLenum mode) {
GPU_CLIENT_SINGLE_THREAD_CHECK();
GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glCullFace("
<< GLES2Util::GetStringFaceType(mode) << ")");
helper_->CullFace(mode);
CheckGLError();
}
void GLES2Implementation::DeleteBuffers(GLsizei n, const GLuint* buffers) {
GPU_CLIENT_SINGLE_THREAD_CHECK();
GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDeleteBuffers(" << n << ", "
<< static_cast<const void*>(buffers) << ")");
GPU_CLIENT_LOG_CODE_BLOCK({
for (GLsizei i = 0; i < n; ++i) {
GPU_CLIENT_LOG(" " << i << ": " << buffers[i]);
}
});
GPU_CLIENT_DCHECK_CODE_BLOCK({
for (GLsizei i = 0; i < n; ++i) {
DCHECK(buffers[i] != 0);
}
});
if (n < 0) {
SetGLError(GL_INVALID_VALUE, "glDeleteBuffers", "n < 0");
return;
}
DeleteBuffersHelper(n, buffers);
CheckGLError();
}
void GLES2Implementation::DeleteFramebuffers(GLsizei n,
const GLuint* framebuffers) {
GPU_CLIENT_SINGLE_THREAD_CHECK();
GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDeleteFramebuffers(" << n << ", "
<< static_cast<const void*>(framebuffers) << ")");
GPU_CLIENT_LOG_CODE_BLOCK({
for (GLsizei i = 0; i < n; ++i) {
GPU_CLIENT_LOG(" " << i << ": " << framebuffers[i]);
}
});
GPU_CLIENT_DCHECK_CODE_BLOCK({
for (GLsizei i = 0; i < n; ++i) {
DCHECK(framebuffers[i] != 0);
}
});
if (n < 0) {
SetGLError(GL_INVALID_VALUE, "glDeleteFramebuffers", "n < 0");
return;
}
DeleteFramebuffersHelper(n, framebuffers);
CheckGLError();
}
void GLES2Implementation::DeleteProgram(GLuint program) {
GPU_CLIENT_SINGLE_THREAD_CHECK();
GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDeleteProgram(" << program
<< ")");
if (program == 0)
return;
DeleteProgramHelper(program);
CheckGLError();
}
void GLES2Implementation::DeleteRenderbuffers(GLsizei n,
const GLuint* renderbuffers) {
GPU_CLIENT_SINGLE_THREAD_CHECK();
GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDeleteRenderbuffers(" << n
<< ", " << static_cast<const void*>(renderbuffers) << ")");
GPU_CLIENT_LOG_CODE_BLOCK({
for (GLsizei i = 0; i < n; ++i) {
GPU_CLIENT_LOG(" " << i << ": " << renderbuffers[i]);
}
});
GPU_CLIENT_DCHECK_CODE_BLOCK({
for (GLsizei i = 0; i < n; ++i) {
DCHECK(renderbuffers[i] != 0);
}
});
if (n < 0) {
SetGLError(GL_INVALID_VALUE, "glDeleteRenderbuffers", "n < 0");
return;
}
DeleteRenderbuffersHelper(n, renderbuffers);
CheckGLError();
}
void GLES2Implementation::DeleteSamplers(GLsizei n, const GLuint* samplers) {
GPU_CLIENT_SINGLE_THREAD_CHECK();
GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDeleteSamplers(" << n << ", "
<< static_cast<const void*>(samplers) << ")");
GPU_CLIENT_LOG_CODE_BLOCK({
for (GLsizei i = 0; i < n; ++i) {
GPU_CLIENT_LOG(" " << i << ": " << samplers[i]);
}
});
GPU_CLIENT_DCHECK_CODE_BLOCK({
for (GLsizei i = 0; i < n; ++i) {
DCHECK(samplers[i] != 0);
}
});
if (n < 0) {
SetGLError(GL_INVALID_VALUE, "glDeleteSamplers", "n < 0");
return;
}
DeleteSamplersHelper(n, samplers);
CheckGLError();
}
void GLES2Implementation::DeleteSync(GLsync sync) {
GPU_CLIENT_SINGLE_THREAD_CHECK();
GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDeleteSync(" << sync << ")");
if (sync == 0)
return;
DeleteSyncHelper(sync);
CheckGLError();
}
void GLES2Implementation::DeleteShader(GLuint shader) {
GPU_CLIENT_SINGLE_THREAD_CHECK();
GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDeleteShader(" << shader << ")");
if (shader == 0)
return;
DeleteShaderHelper(shader);
CheckGLError();
}
void GLES2Implementation::DeleteTextures(GLsizei n, const GLuint* textures) {
GPU_CLIENT_SINGLE_THREAD_CHECK();
GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDeleteTextures(" << n << ", "
<< static_cast<const void*>(textures) << ")");
GPU_CLIENT_LOG_CODE_BLOCK({
for (GLsizei i = 0; i < n; ++i) {
GPU_CLIENT_LOG(" " << i << ": " << textures[i]);
}
});
GPU_CLIENT_DCHECK_CODE_BLOCK({
for (GLsizei i = 0; i < n; ++i) {
DCHECK(textures[i] != 0);
}
});
if (n < 0) {
SetGLError(GL_INVALID_VALUE, "glDeleteTextures", "n < 0");
return;
}
DeleteTexturesHelper(n, textures);
CheckGLError();
}
void GLES2Implementation::DeleteTransformFeedbacks(GLsizei n,
const GLuint* ids) {
GPU_CLIENT_SINGLE_THREAD_CHECK();
GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDeleteTransformFeedbacks(" << n
<< ", " << static_cast<const void*>(ids) << ")");
GPU_CLIENT_LOG_CODE_BLOCK({
for (GLsizei i = 0; i < n; ++i) {
GPU_CLIENT_LOG(" " << i << ": " << ids[i]);
}
});
GPU_CLIENT_DCHECK_CODE_BLOCK({
for (GLsizei i = 0; i < n; ++i) {
DCHECK(ids[i] != 0);
}
});
if (n < 0) {
SetGLError(GL_INVALID_VALUE, "glDeleteTransformFeedbacks", "n < 0");
return;
}
DeleteTransformFeedbacksHelper(n, ids);
CheckGLError();
}
void GLES2Implementation::DepthFunc(GLenum func) {
GPU_CLIENT_SINGLE_THREAD_CHECK();
GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDepthFunc("
<< GLES2Util::GetStringCmpFunction(func) << ")");
helper_->DepthFunc(func);
CheckGLError();
}
void GLES2Implementation::DepthMask(GLboolean flag) {
GPU_CLIENT_SINGLE_THREAD_CHECK();
GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDepthMask("
<< GLES2Util::GetStringBool(flag) << ")");
helper_->DepthMask(flag);
CheckGLError();
}
void GLES2Implementation::DepthRangef(GLclampf zNear, GLclampf zFar) {
GPU_CLIENT_SINGLE_THREAD_CHECK();
GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDepthRangef(" << zNear << ", "
<< zFar << ")");
helper_->DepthRangef(zNear, zFar);
CheckGLError();
}
void GLES2Implementation::DetachShader(GLuint program, GLuint shader) {
GPU_CLIENT_SINGLE_THREAD_CHECK();
GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDetachShader(" << program << ", "
<< shader << ")");
helper_->DetachShader(program, shader);
CheckGLError();
}
GLsync GLES2Implementation::FenceSync(GLenum condition, GLbitfield flags) {
GPU_CLIENT_SINGLE_THREAD_CHECK();
GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glFenceSync("
<< GLES2Util::GetStringSyncCondition(condition) << ", "
<< flags << ")");
if (condition != GL_SYNC_GPU_COMMANDS_COMPLETE) {
SetGLError(GL_INVALID_ENUM, "glFenceSync", "condition GL_INVALID_ENUM");
return 0;
}
if (flags != 0) {
SetGLError(GL_INVALID_VALUE, "glFenceSync", "flags GL_INVALID_VALUE");
return 0;
}
GLuint client_id;
GetIdHandler(SharedIdNamespaces::kSyncs)->MakeIds(this, 0, 1, &client_id);
helper_->FenceSync(client_id);
GPU_CLIENT_LOG("returned " << client_id);
CheckGLError();
return reinterpret_cast<GLsync>(client_id);
}
void GLES2Implementation::FramebufferRenderbuffer(GLenum target,
GLenum attachment,
GLenum renderbuffertarget,
GLuint renderbuffer) {
GPU_CLIENT_SINGLE_THREAD_CHECK();
GPU_CLIENT_LOG(
"[" << GetLogPrefix() << "] glFramebufferRenderbuffer("
<< GLES2Util::GetStringFramebufferTarget(target) << ", "
<< GLES2Util::GetStringAttachment(attachment) << ", "
<< GLES2Util::GetStringRenderBufferTarget(renderbuffertarget) << ", "
<< renderbuffer << ")");
helper_->FramebufferRenderbuffer(target, attachment, renderbuffertarget,
renderbuffer);
CheckGLError();
}
void GLES2Implementation::FramebufferTexture2D(GLenum target,
GLenum attachment,
GLenum textarget,
GLuint texture,
GLint level) {
GPU_CLIENT_SINGLE_THREAD_CHECK();
GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glFramebufferTexture2D("
<< GLES2Util::GetStringFramebufferTarget(target) << ", "
<< GLES2Util::GetStringAttachment(attachment) << ", "
<< GLES2Util::GetStringTextureTarget(textarget) << ", "
<< texture << ", " << level << ")");
helper_->FramebufferTexture2D(target, attachment, textarget, texture, level);
CheckGLError();
}
void GLES2Implementation::FramebufferTextureLayer(GLenum target,
GLenum attachment,
GLuint texture,
GLint level,
GLint layer) {
GPU_CLIENT_SINGLE_THREAD_CHECK();
GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glFramebufferTextureLayer("
<< GLES2Util::GetStringFramebufferTarget(target) << ", "
<< GLES2Util::GetStringAttachment(attachment) << ", "
<< texture << ", " << level << ", " << layer << ")");
helper_->FramebufferTextureLayer(target, attachment, texture, level, layer);
CheckGLError();
}
void GLES2Implementation::FrontFace(GLenum mode) {
GPU_CLIENT_SINGLE_THREAD_CHECK();
GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glFrontFace("
<< GLES2Util::GetStringFaceMode(mode) << ")");
helper_->FrontFace(mode);
CheckGLError();
}
void GLES2Implementation::GenBuffers(GLsizei n, GLuint* buffers) {
GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGenBuffers(" << n << ", "
<< static_cast<const void*>(buffers) << ")");
if (n < 0) {
SetGLError(GL_INVALID_VALUE, "glGenBuffers", "n < 0");
return;
}
GPU_CLIENT_SINGLE_THREAD_CHECK();
GetIdHandler(SharedIdNamespaces::kBuffers)->MakeIds(this, 0, n, buffers);
GenBuffersHelper(n, buffers);
helper_->GenBuffersImmediate(n, buffers);
if (share_group_->bind_generates_resource())
helper_->CommandBufferHelper::Flush();
GPU_CLIENT_LOG_CODE_BLOCK({
for (GLsizei i = 0; i < n; ++i) {
GPU_CLIENT_LOG(" " << i << ": " << buffers[i]);
}
});
CheckGLError();
}
void GLES2Implementation::GenerateMipmap(GLenum target) {
GPU_CLIENT_SINGLE_THREAD_CHECK();
GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGenerateMipmap("
<< GLES2Util::GetStringTextureBindTarget(target) << ")");
helper_->GenerateMipmap(target);
CheckGLError();
}
void GLES2Implementation::GenFramebuffers(GLsizei n, GLuint* framebuffers) {
GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGenFramebuffers(" << n << ", "
<< static_cast<const void*>(framebuffers) << ")");
if (n < 0) {
SetGLError(GL_INVALID_VALUE, "glGenFramebuffers", "n < 0");
return;
}
GPU_CLIENT_SINGLE_THREAD_CHECK();
IdAllocator* id_allocator = GetIdAllocator(IdNamespaces::kFramebuffers);
for (GLsizei ii = 0; ii < n; ++ii)
framebuffers[ii] = id_allocator->AllocateID();
GenFramebuffersHelper(n, framebuffers);
helper_->GenFramebuffersImmediate(n, framebuffers);
GPU_CLIENT_LOG_CODE_BLOCK({
for (GLsizei i = 0; i < n; ++i) {
GPU_CLIENT_LOG(" " << i << ": " << framebuffers[i]);
}
});
CheckGLError();
}
void GLES2Implementation::GenRenderbuffers(GLsizei n, GLuint* renderbuffers) {
GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGenRenderbuffers(" << n << ", "
<< static_cast<const void*>(renderbuffers) << ")");
if (n < 0) {
SetGLError(GL_INVALID_VALUE, "glGenRenderbuffers", "n < 0");
return;
}
GPU_CLIENT_SINGLE_THREAD_CHECK();
GetIdHandler(SharedIdNamespaces::kRenderbuffers)
->MakeIds(this, 0, n, renderbuffers);
GenRenderbuffersHelper(n, renderbuffers);
helper_->GenRenderbuffersImmediate(n, renderbuffers);
if (share_group_->bind_generates_resource())
helper_->CommandBufferHelper::Flush();
GPU_CLIENT_LOG_CODE_BLOCK({
for (GLsizei i = 0; i < n; ++i) {
GPU_CLIENT_LOG(" " << i << ": " << renderbuffers[i]);
}
});
CheckGLError();
}
void GLES2Implementation::GenSamplers(GLsizei n, GLuint* samplers) {
GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGenSamplers(" << n << ", "
<< static_cast<const void*>(samplers) << ")");
if (n < 0) {
SetGLError(GL_INVALID_VALUE, "glGenSamplers", "n < 0");
return;
}
GPU_CLIENT_SINGLE_THREAD_CHECK();
GetIdHandler(SharedIdNamespaces::kSamplers)->MakeIds(this, 0, n, samplers);
GenSamplersHelper(n, samplers);
helper_->GenSamplersImmediate(n, samplers);
if (share_group_->bind_generates_resource())
helper_->CommandBufferHelper::Flush();
GPU_CLIENT_LOG_CODE_BLOCK({
for (GLsizei i = 0; i < n; ++i) {
GPU_CLIENT_LOG(" " << i << ": " << samplers[i]);
}
});
CheckGLError();
}
void GLES2Implementation::GenTextures(GLsizei n, GLuint* textures) {
GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGenTextures(" << n << ", "
<< static_cast<const void*>(textures) << ")");
if (n < 0) {
SetGLError(GL_INVALID_VALUE, "glGenTextures", "n < 0");
return;
}
GPU_CLIENT_SINGLE_THREAD_CHECK();
GetIdHandler(SharedIdNamespaces::kTextures)->MakeIds(this, 0, n, textures);
GenTexturesHelper(n, textures);
helper_->GenTexturesImmediate(n, textures);
if (share_group_->bind_generates_resource())
helper_->CommandBufferHelper::Flush();
GPU_CLIENT_LOG_CODE_BLOCK({
for (GLsizei i = 0; i < n; ++i) {
GPU_CLIENT_LOG(" " << i << ": " << textures[i]);
}
});
CheckGLError();
}
void GLES2Implementation::GenTransformFeedbacks(GLsizei n, GLuint* ids) {
GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGenTransformFeedbacks(" << n
<< ", " << static_cast<const void*>(ids) << ")");
if (n < 0) {
SetGLError(GL_INVALID_VALUE, "glGenTransformFeedbacks", "n < 0");
return;
}
GPU_CLIENT_SINGLE_THREAD_CHECK();
IdAllocator* id_allocator = GetIdAllocator(IdNamespaces::kTransformFeedbacks);
for (GLsizei ii = 0; ii < n; ++ii)
ids[ii] = id_allocator->AllocateID();
GenTransformFeedbacksHelper(n, ids);
helper_->GenTransformFeedbacksImmediate(n, ids);
GPU_CLIENT_LOG_CODE_BLOCK({
for (GLsizei i = 0; i < n; ++i) {
GPU_CLIENT_LOG(" " << i << ": " << ids[i]);
}
});
CheckGLError();
}
void GLES2Implementation::GetBooleanv(GLenum pname, GLboolean* params) {
GPU_CLIENT_SINGLE_THREAD_CHECK();
GPU_CLIENT_VALIDATE_DESTINATION_INITALIZATION(GLboolean, params);
GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetBooleanv("
<< GLES2Util::GetStringGLState(pname) << ", "
<< static_cast<const void*>(params) << ")");
TRACE_EVENT0("gpu", "GLES2Implementation::GetBooleanv");
if (GetBooleanvHelper(pname, params)) {
return;
}
typedef cmds::GetBooleanv::Result Result;
ScopedResultPtr<Result> result = GetResultAs<Result>();
if (!result) {
return;
}
result->SetNumResults(0);
helper_->GetBooleanv(pname, GetResultShmId(), result.offset());
WaitForCmd();
result->CopyResult(params);
GPU_CLIENT_LOG_CODE_BLOCK({
for (int32_t i = 0; i < result->GetNumResults(); ++i) {
GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]);
}
});
CheckGLError();
}
void GLES2Implementation::GetBufferParameteri64v(GLenum target,
GLenum pname,
GLint64* params) {
GPU_CLIENT_SINGLE_THREAD_CHECK();
GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetBufferParameteri64v("
<< GLES2Util::GetStringBufferTarget(target) << ", "
<< GLES2Util::GetStringBufferParameter64(pname) << ", "
<< static_cast<const void*>(params) << ")");
TRACE_EVENT0("gpu", "GLES2Implementation::GetBufferParameteri64v");
if (GetBufferParameteri64vHelper(target, pname, params)) {
return;
}
typedef cmds::GetBufferParameteri64v::Result Result;
ScopedResultPtr<Result> result = GetResultAs<Result>();
if (!result) {
return;
}
result->SetNumResults(0);
helper_->GetBufferParameteri64v(target, pname, GetResultShmId(),
result.offset());
WaitForCmd();
result->CopyResult(params);
GPU_CLIENT_LOG_CODE_BLOCK({
for (int32_t i = 0; i < result->GetNumResults(); ++i) {
GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]);
}
});
CheckGLError();
}
void GLES2Implementation::GetBufferParameteriv(GLenum target,
GLenum pname,
GLint* params) {
GPU_CLIENT_SINGLE_THREAD_CHECK();
GPU_CLIENT_VALIDATE_DESTINATION_INITALIZATION(GLint, params);
GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetBufferParameteriv("
<< GLES2Util::GetStringBufferTarget(target) << ", "
<< GLES2Util::GetStringBufferParameter(pname) << ", "
<< static_cast<const void*>(params) << ")");
TRACE_EVENT0("gpu", "GLES2Implementation::GetBufferParameteriv");
if (GetBufferParameterivHelper(target, pname, params)) {
return;
}
typedef cmds::GetBufferParameteriv::Result Result;
ScopedResultPtr<Result> result = GetResultAs<Result>();
if (!result) {
return;
}
result->SetNumResults(0);
helper_->GetBufferParameteriv(target, pname, GetResultShmId(),
result.offset());
WaitForCmd();
result->CopyResult(params);
GPU_CLIENT_LOG_CODE_BLOCK({
for (int32_t i = 0; i < result->GetNumResults(); ++i) {
GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]);
}
});
CheckGLError();
}
void GLES2Implementation::GetFloatv(GLenum pname, GLfloat* params) {
GPU_CLIENT_SINGLE_THREAD_CHECK();
GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetFloatv("
<< GLES2Util::GetStringGLState(pname) << ", "
<< static_cast<const void*>(params) << ")");
TRACE_EVENT0("gpu", "GLES2Implementation::GetFloatv");
if (GetFloatvHelper(pname, params)) {
return;
}
typedef cmds::GetFloatv::Result Result;
ScopedResultPtr<Result> result = GetResultAs<Result>();
if (!result) {
return;
}
result->SetNumResults(0);
helper_->GetFloatv(pname, GetResultShmId(), result.offset());
WaitForCmd();
result->CopyResult(params);
GPU_CLIENT_LOG_CODE_BLOCK({
for (int32_t i = 0; i < result->GetNumResults(); ++i) {
GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]);
}
});
CheckGLError();
}
void GLES2Implementation::GetFramebufferAttachmentParameteriv(GLenum target,
GLenum attachment,
GLenum pname,
GLint* params) {
GPU_CLIENT_SINGLE_THREAD_CHECK();
GPU_CLIENT_VALIDATE_DESTINATION_INITALIZATION(GLint, params);
GPU_CLIENT_LOG(
"[" << GetLogPrefix() << "] glGetFramebufferAttachmentParameteriv("
<< GLES2Util::GetStringFramebufferTarget(target) << ", "
<< GLES2Util::GetStringAttachmentQuery(attachment) << ", "
<< GLES2Util::GetStringFramebufferAttachmentParameter(pname) << ", "
<< static_cast<const void*>(params) << ")");
TRACE_EVENT0("gpu",
"GLES2Implementation::GetFramebufferAttachmentParameteriv");
if (GetFramebufferAttachmentParameterivHelper(target, attachment, pname,
params)) {
return;
}
typedef cmds::GetFramebufferAttachmentParameteriv::Result Result;
ScopedResultPtr<Result> result = GetResultAs<Result>();
if (!result) {
return;
}
result->SetNumResults(0);
helper_->GetFramebufferAttachmentParameteriv(
target, attachment, pname, GetResultShmId(), result.offset());
WaitForCmd();
result->CopyResult(params);
GPU_CLIENT_LOG_CODE_BLOCK({
for (int32_t i = 0; i < result->GetNumResults(); ++i) {
GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]);
}
});
CheckGLError();
}
void GLES2Implementation::GetInteger64v(GLenum pname, GLint64* params) {
GPU_CLIENT_SINGLE_THREAD_CHECK();
GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetInteger64v("
<< GLES2Util::GetStringGLState(pname) << ", "
<< static_cast<const void*>(params) << ")");
TRACE_EVENT0("gpu", "GLES2Implementation::GetInteger64v");
if (GetInteger64vHelper(pname, params)) {
return;
}
typedef cmds::GetInteger64v::Result Result;
ScopedResultPtr<Result> result = GetResultAs<Result>();
if (!result) {
return;
}
result->SetNumResults(0);
helper_->GetInteger64v(pname, GetResultShmId(), result.offset());
WaitForCmd();
result->CopyResult(params);
GPU_CLIENT_LOG_CODE_BLOCK({
for (int32_t i = 0; i < result->GetNumResults(); ++i) {
GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]);
}
});
CheckGLError();
}
void GLES2Implementation::GetIntegeri_v(GLenum pname,
GLuint index,
GLint* data) {
GPU_CLIENT_SINGLE_THREAD_CHECK();
GPU_CLIENT_VALIDATE_DESTINATION_INITALIZATION(GLint, data);
GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetIntegeri_v("
<< GLES2Util::GetStringIndexedGLState(pname) << ", "
<< index << ", " << static_cast<const void*>(data) << ")");
TRACE_EVENT0("gpu", "GLES2Implementation::GetIntegeri_v");
if (GetIntegeri_vHelper(pname, index, data)) {
return;
}
typedef cmds::GetIntegeri_v::Result Result;
ScopedResultPtr<Result> result = GetResultAs<Result>();
if (!result) {
return;
}
result->SetNumResults(0);
helper_->GetIntegeri_v(pname, index, GetResultShmId(), result.offset());
WaitForCmd();
result->CopyResult(data);
GPU_CLIENT_LOG_CODE_BLOCK({
for (int32_t i = 0; i < result->GetNumResults(); ++i) {
GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]);
}
});
CheckGLError();
}
void GLES2Implementation::GetInteger64i_v(GLenum pname,
GLuint index,
GLint64* data) {
GPU_CLIENT_SINGLE_THREAD_CHECK();
GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetInteger64i_v("
<< GLES2Util::GetStringIndexedGLState(pname) << ", "
<< index << ", " << static_cast<const void*>(data) << ")");
TRACE_EVENT0("gpu", "GLES2Implementation::GetInteger64i_v");
if (GetInteger64i_vHelper(pname, index, data)) {
return;
}
typedef cmds::GetInteger64i_v::Result Result;
ScopedResultPtr<Result> result = GetResultAs<Result>();
if (!result) {
return;
}
result->SetNumResults(0);
helper_->GetInteger64i_v(pname, index, GetResultShmId(), result.offset());
WaitForCmd();
result->CopyResult(data);
GPU_CLIENT_LOG_CODE_BLOCK({
for (int32_t i = 0; i < result->GetNumResults(); ++i) {
GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]);
}
});
CheckGLError();
}
void GLES2Implementation::GetIntegerv(GLenum pname, GLint* params) {
GPU_CLIENT_SINGLE_THREAD_CHECK();
GPU_CLIENT_VALIDATE_DESTINATION_INITALIZATION(GLint, params);
GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetIntegerv("
<< GLES2Util::GetStringGLState(pname) << ", "
<< static_cast<const void*>(params) << ")");
TRACE_EVENT0("gpu", "GLES2Implementation::GetIntegerv");
if (GetIntegervHelper(pname, params)) {
return;
}
typedef cmds::GetIntegerv::Result Result;
ScopedResultPtr<Result> result = GetResultAs<Result>();
if (!result) {
return;
}
result->SetNumResults(0);
helper_->GetIntegerv(pname, GetResultShmId(), result.offset());
WaitForCmd();
result->CopyResult(params);
GPU_CLIENT_LOG_CODE_BLOCK({
for (int32_t i = 0; i < result->GetNumResults(); ++i) {
GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]);
}
});
CheckGLError();
}
void GLES2Implementation::GetProgramiv(GLuint program,
GLenum pname,
GLint* params) {
GPU_CLIENT_SINGLE_THREAD_CHECK();
GPU_CLIENT_VALIDATE_DESTINATION_INITALIZATION(GLint, params);
GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetProgramiv(" << program << ", "
<< GLES2Util::GetStringProgramParameter(pname) << ", "
<< static_cast<const void*>(params) << ")");
TRACE_EVENT0("gpu", "GLES2Implementation::GetProgramiv");
if (GetProgramivHelper(program, pname, params)) {
return;
}
typedef cmds::GetProgramiv::Result Result;
ScopedResultPtr<Result> result = GetResultAs<Result>();
if (!result) {
return;
}
result->SetNumResults(0);
helper_->GetProgramiv(program, pname, GetResultShmId(), result.offset());
WaitForCmd();
result->CopyResult(params);
GPU_CLIENT_LOG_CODE_BLOCK({
for (int32_t i = 0; i < result->GetNumResults(); ++i) {
GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]);
}
});
CheckGLError();
}
void GLES2Implementation::GetProgramInfoLog(GLuint program,
GLsizei bufsize,
GLsizei* length,
char* infolog) {
GPU_CLIENT_SINGLE_THREAD_CHECK();
GPU_CLIENT_VALIDATE_DESTINATION_OPTIONAL_INITALIZATION(GLsizei, length);
GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetProgramInfoLog"
<< "(" << program << ", " << bufsize << ", "
<< static_cast<void*>(length) << ", "
<< static_cast<void*>(infolog) << ")");
helper_->SetBucketSize(kResultBucketId, 0);
helper_->GetProgramInfoLog(program, kResultBucketId);
std::string str;
GLsizei max_size = 0;
if (GetBucketAsString(kResultBucketId, &str)) {
if (bufsize > 0) {
max_size = std::min(static_cast<size_t>(bufsize) - 1, str.size());
memcpy(infolog, str.c_str(), max_size);
infolog[max_size] = '\0';
GPU_CLIENT_LOG("------\n" << infolog << "\n------");
}
}
if (length != nullptr) {
*length = max_size;
}
CheckGLError();
}
void GLES2Implementation::GetRenderbufferParameteriv(GLenum target,
GLenum pname,
GLint* params) {
GPU_CLIENT_SINGLE_THREAD_CHECK();
GPU_CLIENT_VALIDATE_DESTINATION_INITALIZATION(GLint, params);
GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetRenderbufferParameteriv("
<< GLES2Util::GetStringRenderBufferTarget(target) << ", "
<< GLES2Util::GetStringRenderBufferParameter(pname) << ", "
<< static_cast<const void*>(params) << ")");
TRACE_EVENT0("gpu", "GLES2Implementation::GetRenderbufferParameteriv");
if (GetRenderbufferParameterivHelper(target, pname, params)) {
return;
}
typedef cmds::GetRenderbufferParameteriv::Result Result;
ScopedResultPtr<Result> result = GetResultAs<Result>();
if (!result) {
return;
}
result->SetNumResults(0);
helper_->GetRenderbufferParameteriv(target, pname, GetResultShmId(),
result.offset());
WaitForCmd();
result->CopyResult(params);
GPU_CLIENT_LOG_CODE_BLOCK({
for (int32_t i = 0; i < result->GetNumResults(); ++i) {
GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]);
}
});
CheckGLError();
}
void GLES2Implementation::GetSamplerParameterfv(GLuint sampler,
GLenum pname,
GLfloat* params) {
GPU_CLIENT_SINGLE_THREAD_CHECK();
GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetSamplerParameterfv("
<< sampler << ", "
<< GLES2Util::GetStringSamplerParameter(pname) << ", "
<< static_cast<const void*>(params) << ")");
TRACE_EVENT0("gpu", "GLES2Implementation::GetSamplerParameterfv");
if (GetSamplerParameterfvHelper(sampler, pname, params)) {
return;
}
typedef cmds::GetSamplerParameterfv::Result Result;
ScopedResultPtr<Result> result = GetResultAs<Result>();
if (!result) {
return;
}
result->SetNumResults(0);
helper_->GetSamplerParameterfv(sampler, pname, GetResultShmId(),
result.offset());
WaitForCmd();
result->CopyResult(params);
GPU_CLIENT_LOG_CODE_BLOCK({
for (int32_t i = 0; i < result->GetNumResults(); ++i) {
GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]);
}
});
CheckGLError();
}
void GLES2Implementation::GetSamplerParameteriv(GLuint sampler,
GLenum pname,
GLint* params) {
GPU_CLIENT_SINGLE_THREAD_CHECK();
GPU_CLIENT_VALIDATE_DESTINATION_INITALIZATION(GLint, params);
GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetSamplerParameteriv("
<< sampler << ", "
<< GLES2Util::GetStringSamplerParameter(pname) << ", "
<< static_cast<const void*>(params) << ")");
TRACE_EVENT0("gpu", "GLES2Implementation::GetSamplerParameteriv");
if (GetSamplerParameterivHelper(sampler, pname, params)) {
return;
}
typedef cmds::GetSamplerParameteriv::Result Result;
ScopedResultPtr<Result> result = GetResultAs<Result>();
if (!result) {
return;
}
result->SetNumResults(0);
helper_->GetSamplerParameteriv(sampler, pname, GetResultShmId(),
result.offset());
WaitForCmd();
result->CopyResult(params);
GPU_CLIENT_LOG_CODE_BLOCK({
for (int32_t i = 0; i < result->GetNumResults(); ++i) {
GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]);
}
});
CheckGLError();
}
void GLES2Implementation::GetShaderiv(GLuint shader,
GLenum pname,
GLint* params) {
GPU_CLIENT_SINGLE_THREAD_CHECK();
GPU_CLIENT_VALIDATE_DESTINATION_INITALIZATION(GLint, params);
GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetShaderiv(" << shader << ", "
<< GLES2Util::GetStringShaderParameter(pname) << ", "
<< static_cast<const void*>(params) << ")");
TRACE_EVENT0("gpu", "GLES2Implementation::GetShaderiv");
if (GetShaderivHelper(shader, pname, params)) {
return;
}
typedef cmds::GetShaderiv::Result Result;
ScopedResultPtr<Result> result = GetResultAs<Result>();
if (!result) {
return;
}
result->SetNumResults(0);
helper_->GetShaderiv(shader, pname, GetResultShmId(), result.offset());
WaitForCmd();
result->CopyResult(params);
GPU_CLIENT_LOG_CODE_BLOCK({
for (int32_t i = 0; i < result->GetNumResults(); ++i) {
GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]);
}
});
CheckGLError();
}
void GLES2Implementation::GetShaderInfoLog(GLuint shader,
GLsizei bufsize,
GLsizei* length,
char* infolog) {
GPU_CLIENT_SINGLE_THREAD_CHECK();
GPU_CLIENT_VALIDATE_DESTINATION_OPTIONAL_INITALIZATION(GLsizei, length);
GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetShaderInfoLog"
<< "(" << shader << ", " << bufsize << ", "
<< static_cast<void*>(length) << ", "
<< static_cast<void*>(infolog) << ")");
helper_->SetBucketSize(kResultBucketId, 0);
helper_->GetShaderInfoLog(shader, kResultBucketId);
std::string str;
GLsizei max_size = 0;
if (GetBucketAsString(kResultBucketId, &str)) {
if (bufsize > 0) {
max_size = std::min(static_cast<size_t>(bufsize) - 1, str.size());
memcpy(infolog, str.c_str(), max_size);
infolog[max_size] = '\0';
GPU_CLIENT_LOG("------\n" << infolog << "\n------");
}
}
if (length != nullptr) {
*length = max_size;
}
CheckGLError();
}
void GLES2Implementation::GetShaderSource(GLuint shader,
GLsizei bufsize,
GLsizei* length,
char* source) {
GPU_CLIENT_SINGLE_THREAD_CHECK();
GPU_CLIENT_VALIDATE_DESTINATION_OPTIONAL_INITALIZATION(GLsizei, length);
GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetShaderSource"
<< "(" << shader << ", " << bufsize << ", "
<< static_cast<void*>(length) << ", "
<< static_cast<void*>(source) << ")");
helper_->SetBucketSize(kResultBucketId, 0);
helper_->GetShaderSource(shader, kResultBucketId);
std::string str;
GLsizei max_size = 0;
if (GetBucketAsString(kResultBucketId, &str)) {
if (bufsize > 0) {
max_size = std::min(static_cast<size_t>(bufsize) - 1, str.size());
memcpy(source, str.c_str(), max_size);
source[max_size] = '\0';
GPU_CLIENT_LOG("------\n" << source << "\n------");
}
}
if (length != nullptr) {
*length = max_size;
}
CheckGLError();
}
void GLES2Implementation::GetSynciv(GLsync sync,
GLenum pname,
GLsizei bufsize,
GLsizei* length,
GLint* values) {
GPU_CLIENT_SINGLE_THREAD_CHECK();
GPU_CLIENT_VALIDATE_DESTINATION_OPTIONAL_INITALIZATION(GLsizei, length);
GPU_CLIENT_VALIDATE_DESTINATION_INITALIZATION(GLint, values);
GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetSynciv(" << sync << ", "
<< GLES2Util::GetStringSyncParameter(pname) << ", "
<< bufsize << ", " << static_cast<const void*>(length)
<< ", " << static_cast<const void*>(values) << ")");
if (bufsize < 0) {
SetGLError(GL_INVALID_VALUE, "glGetSynciv", "bufsize < 0");
return;
}
TRACE_EVENT0("gpu", "GLES2Implementation::GetSynciv");
if (GetSyncivHelper(sync, pname, bufsize, length, values)) {
return;
}
typedef cmds::GetSynciv::Result Result;
ScopedResultPtr<Result> result = GetResultAs<Result>();
if (!result) {
return;
}
result->SetNumResults(0);
helper_->GetSynciv(ToGLuint(sync), pname, GetResultShmId(), result.offset());
WaitForCmd();
result->CopyResult(values);
GPU_CLIENT_LOG_CODE_BLOCK({
for (int32_t i = 0; i < result->GetNumResults(); ++i) {
GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]);
}
});
if (length) {
*length = result->GetNumResults();
}
CheckGLError();
}
void GLES2Implementation::GetTexParameterfv(GLenum target,
GLenum pname,
GLfloat* params) {
GPU_CLIENT_SINGLE_THREAD_CHECK();
GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetTexParameterfv("
<< GLES2Util::GetStringGetTexParamTarget(target) << ", "
<< GLES2Util::GetStringTextureParameter(pname) << ", "
<< static_cast<const void*>(params) << ")");
TRACE_EVENT0("gpu", "GLES2Implementation::GetTexParameterfv");
if (GetTexParameterfvHelper(target, pname, params)) {
return;
}
typedef cmds::GetTexParameterfv::Result Result;
ScopedResultPtr<Result> result = GetResultAs<Result>();
if (!result) {
return;
}
result->SetNumResults(0);
helper_->GetTexParameterfv(target, pname, GetResultShmId(), result.offset());
WaitForCmd();
result->CopyResult(params);
GPU_CLIENT_LOG_CODE_BLOCK({
for (int32_t i = 0; i < result->GetNumResults(); ++i) {
GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]);
}
});
CheckGLError();
}
void GLES2Implementation::GetTexParameteriv(GLenum target,
GLenum pname,
GLint* params) {
GPU_CLIENT_SINGLE_THREAD_CHECK();
GPU_CLIENT_VALIDATE_DESTINATION_INITALIZATION(GLint, params);
GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetTexParameteriv("
<< GLES2Util::GetStringGetTexParamTarget(target) << ", "
<< GLES2Util::GetStringTextureParameter(pname) << ", "
<< static_cast<const void*>(params) << ")");
TRACE_EVENT0("gpu", "GLES2Implementation::GetTexParameteriv");
if (GetTexParameterivHelper(target, pname, params)) {
return;
}
typedef cmds::GetTexParameteriv::Result Result;
ScopedResultPtr<Result> result = GetResultAs<Result>();
if (!result) {
return;
}
result->SetNumResults(0);
helper_->GetTexParameteriv(target, pname, GetResultShmId(), result.offset());
WaitForCmd();
result->CopyResult(params);
GPU_CLIENT_LOG_CODE_BLOCK({
for (int32_t i = 0; i < result->GetNumResults(); ++i) {
GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]);
}
});
CheckGLError();
}
void GLES2Implementation::Hint(GLenum target, GLenum mode) {
GPU_CLIENT_SINGLE_THREAD_CHECK();
GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glHint("
<< GLES2Util::GetStringHintTarget(target) << ", "
<< GLES2Util::GetStringHintMode(mode) << ")");
helper_->Hint(target, mode);
CheckGLError();
}
void GLES2Implementation::InvalidateFramebuffer(GLenum target,
GLsizei count,
const GLenum* attachments) {
GPU_CLIENT_SINGLE_THREAD_CHECK();
GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glInvalidateFramebuffer("
<< GLES2Util::GetStringFramebufferTarget(target) << ", "
<< count << ", " << static_cast<const void*>(attachments)
<< ")");
GPU_CLIENT_LOG_CODE_BLOCK({
for (GLsizei i = 0; i < count; ++i) {
GPU_CLIENT_LOG(" " << i << ": " << attachments[0 + i * 1]);
}
});
if (count < 0) {
SetGLError(GL_INVALID_VALUE, "glInvalidateFramebuffer", "count < 0");
return;
}
helper_->InvalidateFramebufferImmediate(target, count, attachments);
CheckGLError();
}
void GLES2Implementation::InvalidateSubFramebuffer(GLenum target,
GLsizei count,
const GLenum* attachments,
GLint x,
GLint y,
GLsizei width,
GLsizei height) {
GPU_CLIENT_SINGLE_THREAD_CHECK();
GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glInvalidateSubFramebuffer("
<< GLES2Util::GetStringFramebufferTarget(target) << ", "
<< count << ", " << static_cast<const void*>(attachments)
<< ", " << x << ", " << y << ", " << width << ", "
<< height << ")");
GPU_CLIENT_LOG_CODE_BLOCK({
for (GLsizei i = 0; i < count; ++i) {
GPU_CLIENT_LOG(" " << i << ": " << attachments[0 + i * 1]);
}
});
if (count < 0) {
SetGLError(GL_INVALID_VALUE, "glInvalidateSubFramebuffer", "count < 0");
return;
}
if (width < 0) {
SetGLError(GL_INVALID_VALUE, "glInvalidateSubFramebuffer", "width < 0");
return;
}
if (height < 0) {
SetGLError(GL_INVALID_VALUE, "glInvalidateSubFramebuffer", "height < 0");
return;
}
helper_->InvalidateSubFramebufferImmediate(target, count, attachments, x, y,
width, height);
CheckGLError();
}
GLboolean GLES2Implementation::IsBuffer(GLuint buffer) {
GPU_CLIENT_SINGLE_THREAD_CHECK();
TRACE_EVENT0("gpu", "GLES2Implementation::IsBuffer");
GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glIsBuffer(" << buffer << ")");
typedef cmds::IsBuffer::Result Result;
ScopedResultPtr<Result> result = GetResultAs<Result>();
if (!result) {
return GL_FALSE;
}
*result = 0;
helper_->IsBuffer(buffer, GetResultShmId(), result.offset());
WaitForCmd();
GLboolean result_value = *result != 0;
GPU_CLIENT_LOG("returned " << result_value);
CheckGLError();
return result_value;
}
GLboolean GLES2Implementation::IsFramebuffer(GLuint framebuffer) {
GPU_CLIENT_SINGLE_THREAD_CHECK();
TRACE_EVENT0("gpu", "GLES2Implementation::IsFramebuffer");
GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glIsFramebuffer(" << framebuffer
<< ")");
typedef cmds::IsFramebuffer::Result Result;
ScopedResultPtr<Result> result = GetResultAs<Result>();
if (!result) {
return GL_FALSE;
}
*result = 0;
helper_->IsFramebuffer(framebuffer, GetResultShmId(), result.offset());
WaitForCmd();
GLboolean result_value = *result != 0;
GPU_CLIENT_LOG("returned " << result_value);
CheckGLError();
return result_value;
}
GLboolean GLES2Implementation::IsProgram(GLuint program) {
GPU_CLIENT_SINGLE_THREAD_CHECK();
TRACE_EVENT0("gpu", "GLES2Implementation::IsProgram");
GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glIsProgram(" << program << ")");
typedef cmds::IsProgram::Result Result;
ScopedResultPtr<Result> result = GetResultAs<Result>();
if (!result) {
return GL_FALSE;
}
*result = 0;
helper_->IsProgram(program, GetResultShmId(), result.offset());
WaitForCmd();
GLboolean result_value = *result != 0;
GPU_CLIENT_LOG("returned " << result_value);
CheckGLError();
return result_value;
}
GLboolean GLES2Implementation::IsRenderbuffer(GLuint renderbuffer) {
GPU_CLIENT_SINGLE_THREAD_CHECK();
TRACE_EVENT0("gpu", "GLES2Implementation::IsRenderbuffer");
GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glIsRenderbuffer(" << renderbuffer
<< ")");
typedef cmds::IsRenderbuffer::Result Result;
ScopedResultPtr<Result> result = GetResultAs<Result>();
if (!result) {
return GL_FALSE;
}
*result = 0;
helper_->IsRenderbuffer(renderbuffer, GetResultShmId(), result.offset());
WaitForCmd();
GLboolean result_value = *result != 0;
GPU_CLIENT_LOG("returned " << result_value);
CheckGLError();
return result_value;
}
GLboolean GLES2Implementation::IsSampler(GLuint sampler) {
GPU_CLIENT_SINGLE_THREAD_CHECK();
TRACE_EVENT0("gpu", "GLES2Implementation::IsSampler");
GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glIsSampler(" << sampler << ")");
typedef cmds::IsSampler::Result Result;
ScopedResultPtr<Result> result = GetResultAs<Result>();
if (!result) {
return GL_FALSE;
}
*result = 0;
helper_->IsSampler(sampler, GetResultShmId(), result.offset());
WaitForCmd();
GLboolean result_value = *result != 0;
GPU_CLIENT_LOG("returned " << result_value);
CheckGLError();
return result_value;
}
GLboolean GLES2Implementation::IsShader(GLuint shader) {
GPU_CLIENT_SINGLE_THREAD_CHECK();
TRACE_EVENT0("gpu", "GLES2Implementation::IsShader");
GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glIsShader(" << shader << ")");
typedef cmds::IsShader::Result Result;
ScopedResultPtr<Result> result = GetResultAs<Result>();
if (!result) {
return GL_FALSE;
}
*result = 0;
helper_->IsShader(shader, GetResultShmId(), result.offset());
WaitForCmd();
GLboolean result_value = *result != 0;
GPU_CLIENT_LOG("returned " << result_value);
CheckGLError();
return result_value;
}
GLboolean GLES2Implementation::IsSync(GLsync sync) {
GPU_CLIENT_SINGLE_THREAD_CHECK();
TRACE_EVENT0("gpu", "GLES2Implementation::IsSync");
GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glIsSync(" << sync << ")");
typedef cmds::IsSync::Result Result;
ScopedResultPtr<Result> result = GetResultAs<Result>();
if (!result) {
return GL_FALSE;
}
*result = 0;
helper_->IsSync(ToGLuint(sync), GetResultShmId(), result.offset());
WaitForCmd();
GLboolean result_value = *result != 0;
GPU_CLIENT_LOG("returned " << result_value);
CheckGLError();
return result_value;
}
GLboolean GLES2Implementation::IsTexture(GLuint texture) {
GPU_CLIENT_SINGLE_THREAD_CHECK();
TRACE_EVENT0("gpu", "GLES2Implementation::IsTexture");
GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glIsTexture(" << texture << ")");
typedef cmds::IsTexture::Result Result;
ScopedResultPtr<Result> result = GetResultAs<Result>();
if (!result) {
return GL_FALSE;
}
*result = 0;
helper_->IsTexture(texture, GetResultShmId(), result.offset());
WaitForCmd();
GLboolean result_value = *result != 0;
GPU_CLIENT_LOG("returned " << result_value);
CheckGLError();
return result_value;
}
GLboolean GLES2Implementation::IsTransformFeedback(GLuint transformfeedback) {
GPU_CLIENT_SINGLE_THREAD_CHECK();
TRACE_EVENT0("gpu", "GLES2Implementation::IsTransformFeedback");
GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glIsTransformFeedback("
<< transformfeedback << ")");
typedef cmds::IsTransformFeedback::Result Result;
ScopedResultPtr<Result> result = GetResultAs<Result>();
if (!result) {
return GL_FALSE;
}
*result = 0;
helper_->IsTransformFeedback(transformfeedback, GetResultShmId(),
result.offset());
WaitForCmd();
GLboolean result_value = *result != 0;
GPU_CLIENT_LOG("returned " << result_value);
CheckGLError();
return result_value;
}
void GLES2Implementation::LineWidth(GLfloat width) {
GPU_CLIENT_SINGLE_THREAD_CHECK();
GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glLineWidth(" << width << ")");
helper_->LineWidth(width);
CheckGLError();
}
void GLES2Implementation::PauseTransformFeedback() {
GPU_CLIENT_SINGLE_THREAD_CHECK();
GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glPauseTransformFeedback("
<< ")");
helper_->PauseTransformFeedback();
CheckGLError();
}
void GLES2Implementation::PolygonOffset(GLfloat factor, GLfloat units) {
GPU_CLIENT_SINGLE_THREAD_CHECK();
GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glPolygonOffset(" << factor << ", "
<< units << ")");
helper_->PolygonOffset(factor, units);
CheckGLError();
}
void GLES2Implementation::ReadBuffer(GLenum src) {
GPU_CLIENT_SINGLE_THREAD_CHECK();
GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glReadBuffer("
<< GLES2Util::GetStringReadBuffer(src) << ")");
helper_->ReadBuffer(src);
CheckGLError();
}
void GLES2Implementation::ReleaseShaderCompiler() {
GPU_CLIENT_SINGLE_THREAD_CHECK();
GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glReleaseShaderCompiler("
<< ")");
helper_->ReleaseShaderCompiler();
CheckGLError();
}
void GLES2Implementation::RenderbufferStorage(GLenum target,
GLenum internalformat,
GLsizei width,
GLsizei height) {
GPU_CLIENT_SINGLE_THREAD_CHECK();
GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glRenderbufferStorage("
<< GLES2Util::GetStringRenderBufferTarget(target) << ", "
<< GLES2Util::GetStringRenderBufferFormat(internalformat)
<< ", " << width << ", " << height << ")");
if (width < 0) {
SetGLError(GL_INVALID_VALUE, "glRenderbufferStorage", "width < 0");
return;
}
if (height < 0) {
SetGLError(GL_INVALID_VALUE, "glRenderbufferStorage", "height < 0");
return;
}
helper_->RenderbufferStorage(target, internalformat, width, height);
CheckGLError();
}
void GLES2Implementation::ResumeTransformFeedback() {
GPU_CLIENT_SINGLE_THREAD_CHECK();
GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glResumeTransformFeedback("
<< ")");
helper_->ResumeTransformFeedback();
CheckGLError();
}
void GLES2Implementation::SampleCoverage(GLclampf value, GLboolean invert) {
GPU_CLIENT_SINGLE_THREAD_CHECK();
GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glSampleCoverage(" << value << ", "
<< GLES2Util::GetStringBool(invert) << ")");
helper_->SampleCoverage(value, invert);
CheckGLError();
}
void GLES2Implementation::SamplerParameterf(GLuint sampler,
GLenum pname,
GLfloat param) {
GPU_CLIENT_SINGLE_THREAD_CHECK();
GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glSamplerParameterf(" << sampler
<< ", " << GLES2Util::GetStringSamplerParameter(pname)
<< ", " << param << ")");
helper_->SamplerParameterf(sampler, pname, param);
CheckGLError();
}
void GLES2Implementation::SamplerParameterfv(GLuint sampler,
GLenum pname,
const GLfloat* params) {
GPU_CLIENT_SINGLE_THREAD_CHECK();
GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glSamplerParameterfv(" << sampler
<< ", " << GLES2Util::GetStringSamplerParameter(pname)
<< ", " << static_cast<const void*>(params) << ")");
size_t count = 1;
for (size_t ii = 0; ii < count; ++ii)
GPU_CLIENT_LOG("value[" << ii << "]: " << params[ii]);
helper_->SamplerParameterfvImmediate(sampler, pname, params);
CheckGLError();
}
void GLES2Implementation::SamplerParameteri(GLuint sampler,
GLenum pname,
GLint param) {
GPU_CLIENT_SINGLE_THREAD_CHECK();
GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glSamplerParameteri(" << sampler
<< ", " << GLES2Util::GetStringSamplerParameter(pname)
<< ", " << param << ")");
helper_->SamplerParameteri(sampler, pname, param);
CheckGLError();
}
void GLES2Implementation::SamplerParameteriv(GLuint sampler,
GLenum pname,
const GLint* params) {
GPU_CLIENT_SINGLE_THREAD_CHECK();
GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glSamplerParameteriv(" << sampler
<< ", " << GLES2Util::GetStringSamplerParameter(pname)
<< ", " << static_cast<const void*>(params) << ")");
size_t count = 1;
for (size_t ii = 0; ii < count; ++ii)
GPU_CLIENT_LOG("value[" << ii << "]: " << params[ii]);
helper_->SamplerParameterivImmediate(sampler, pname, params);
CheckGLError();
}
void GLES2Implementation::Scissor(GLint x,
GLint y,
GLsizei width,
GLsizei height) {
GPU_CLIENT_SINGLE_THREAD_CHECK();
GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glScissor(" << x << ", " << y
<< ", " << width << ", " << height << ")");
if (width < 0) {
SetGLError(GL_INVALID_VALUE, "glScissor", "width < 0");
return;
}
if (height < 0) {
SetGLError(GL_INVALID_VALUE, "glScissor", "height < 0");
return;
}
helper_->Scissor(x, y, width, height);
CheckGLError();
}
void GLES2Implementation::ShaderSource(GLuint shader,
GLsizei count,
const GLchar* const* str,
const GLint* length) {
GPU_CLIENT_SINGLE_THREAD_CHECK();
GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glShaderSource(" << shader << ", "
<< count << ", " << static_cast<const void*>(str) << ", "
<< static_cast<const void*>(length) << ")");
GPU_CLIENT_LOG_CODE_BLOCK({
for (GLsizei ii = 0; ii < count; ++ii) {
if (str[ii]) {
if (length && length[ii] >= 0) {
const std::string my_str(str[ii], length[ii]);
GPU_CLIENT_LOG(" " << ii << ": ---\n" << my_str << "\n---");
} else {
GPU_CLIENT_LOG(" " << ii << ": ---\n" << str[ii] << "\n---");
}
} else {
GPU_CLIENT_LOG(" " << ii << ": NULL");
}
}
});
if (count < 0) {
SetGLError(GL_INVALID_VALUE, "glShaderSource", "count < 0");
return;
}
if (!PackStringsToBucket(count, str, length, "glShaderSource")) {
return;
}
helper_->ShaderSourceBucket(shader, kResultBucketId);
helper_->SetBucketSize(kResultBucketId, 0);
CheckGLError();
}
void GLES2Implementation::StencilFunc(GLenum func, GLint ref, GLuint mask) {
GPU_CLIENT_SINGLE_THREAD_CHECK();
GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glStencilFunc("
<< GLES2Util::GetStringCmpFunction(func) << ", " << ref
<< ", " << mask << ")");
helper_->StencilFunc(func, ref, mask);
CheckGLError();
}
void GLES2Implementation::StencilFuncSeparate(GLenum face,
GLenum func,
GLint ref,
GLuint mask) {
GPU_CLIENT_SINGLE_THREAD_CHECK();
GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glStencilFuncSeparate("
<< GLES2Util::GetStringFaceType(face) << ", "
<< GLES2Util::GetStringCmpFunction(func) << ", " << ref
<< ", " << mask << ")");
helper_->StencilFuncSeparate(face, func, ref, mask);
CheckGLError();
}
void GLES2Implementation::StencilMask(GLuint mask) {
GPU_CLIENT_SINGLE_THREAD_CHECK();
GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glStencilMask(" << mask << ")");
helper_->StencilMask(mask);
CheckGLError();
}
void GLES2Implementation::StencilMaskSeparate(GLenum face, GLuint mask) {
GPU_CLIENT_SINGLE_THREAD_CHECK();
GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glStencilMaskSeparate("
<< GLES2Util::GetStringFaceType(face) << ", " << mask
<< ")");
helper_->StencilMaskSeparate(face, mask);
CheckGLError();
}
void GLES2Implementation::StencilOp(GLenum fail, GLenum zfail, GLenum zpass) {
GPU_CLIENT_SINGLE_THREAD_CHECK();
GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glStencilOp("
<< GLES2Util::GetStringStencilOp(fail) << ", "
<< GLES2Util::GetStringStencilOp(zfail) << ", "
<< GLES2Util::GetStringStencilOp(zpass) << ")");
helper_->StencilOp(fail, zfail, zpass);
CheckGLError();
}
void GLES2Implementation::StencilOpSeparate(GLenum face,
GLenum fail,
GLenum zfail,
GLenum zpass) {
GPU_CLIENT_SINGLE_THREAD_CHECK();
GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glStencilOpSeparate("
<< GLES2Util::GetStringFaceType(face) << ", "
<< GLES2Util::GetStringStencilOp(fail) << ", "
<< GLES2Util::GetStringStencilOp(zfail) << ", "
<< GLES2Util::GetStringStencilOp(zpass) << ")");
helper_->StencilOpSeparate(face, fail, zfail, zpass);
CheckGLError();
}
void GLES2Implementation::TexParameterf(GLenum target,
GLenum pname,
GLfloat param) {
GPU_CLIENT_SINGLE_THREAD_CHECK();
GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glTexParameterf("
<< GLES2Util::GetStringTextureBindTarget(target) << ", "
<< GLES2Util::GetStringTextureParameter(pname) << ", "
<< param << ")");
helper_->TexParameterf(target, pname, param);
CheckGLError();
}
void GLES2Implementation::TexParameterfv(GLenum target,
GLenum pname,
const GLfloat* params) {
GPU_CLIENT_SINGLE_THREAD_CHECK();
GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glTexParameterfv("
<< GLES2Util::GetStringTextureBindTarget(target) << ", "
<< GLES2Util::GetStringTextureParameter(pname) << ", "
<< static_cast<const void*>(params) << ")");
size_t count = 1;
for (size_t ii = 0; ii < count; ++ii)
GPU_CLIENT_LOG("value[" << ii << "]: " << params[ii]);
helper_->TexParameterfvImmediate(target, pname, params);
CheckGLError();
}
void GLES2Implementation::TexParameteri(GLenum target,
GLenum pname,
GLint param) {
GPU_CLIENT_SINGLE_THREAD_CHECK();
GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glTexParameteri("
<< GLES2Util::GetStringTextureBindTarget(target) << ", "
<< GLES2Util::GetStringTextureParameter(pname) << ", "
<< param << ")");
helper_->TexParameteri(target, pname, param);
CheckGLError();
}
void GLES2Implementation::TexParameteriv(GLenum target,
GLenum pname,
const GLint* params) {
GPU_CLIENT_SINGLE_THREAD_CHECK();
GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glTexParameteriv("
<< GLES2Util::GetStringTextureBindTarget(target) << ", "
<< GLES2Util::GetStringTextureParameter(pname) << ", "
<< static_cast<const void*>(params) << ")");
size_t count = 1;
for (size_t ii = 0; ii < count; ++ii)
GPU_CLIENT_LOG("value[" << ii << "]: " << params[ii]);
helper_->TexParameterivImmediate(target, pname, params);
CheckGLError();
}
void GLES2Implementation::TexStorage3D(GLenum target,
GLsizei levels,
GLenum internalFormat,
GLsizei width,
GLsizei height,
GLsizei depth) {
GPU_CLIENT_SINGLE_THREAD_CHECK();
GPU_CLIENT_LOG(
"[" << GetLogPrefix() << "] glTexStorage3D("
<< GLES2Util::GetStringTexture3DTarget(target) << ", " << levels
<< ", "
<< GLES2Util::GetStringTextureInternalFormatStorage(internalFormat)
<< ", " << width << ", " << height << ", " << depth << ")");
if (levels < 0) {
SetGLError(GL_INVALID_VALUE, "glTexStorage3D", "levels < 0");
return;
}
if (width < 0) {
SetGLError(GL_INVALID_VALUE, "glTexStorage3D", "width < 0");
return;
}
if (height < 0) {
SetGLError(GL_INVALID_VALUE, "glTexStorage3D", "height < 0");
return;
}
if (depth < 0) {
SetGLError(GL_INVALID_VALUE, "glTexStorage3D", "depth < 0");
return;
}
helper_->TexStorage3D(target, levels, internalFormat, width, height, depth);
CheckGLError();
}
void GLES2Implementation::TransformFeedbackVaryings(GLuint program,
GLsizei count,
const char* const* varyings,
GLenum buffermode) {
GPU_CLIENT_SINGLE_THREAD_CHECK();
GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glTransformFeedbackVaryings("
<< program << ", " << count << ", "
<< static_cast<const void*>(varyings) << ", "
<< GLES2Util::GetStringBufferMode(buffermode) << ")");
GPU_CLIENT_LOG_CODE_BLOCK({
for (GLsizei ii = 0; ii < count; ++ii) {
if (varyings[ii]) {
GPU_CLIENT_LOG(" " << ii << ": ---\n" << varyings[ii] << "\n---");
} else {
GPU_CLIENT_LOG(" " << ii << ": NULL");
}
}
});
if (count < 0) {
SetGLError(GL_INVALID_VALUE, "glTransformFeedbackVaryings", "count < 0");
return;
}
if (!PackStringsToBucket(count, varyings, nullptr,
"glTransformFeedbackVaryings")) {
return;
}
helper_->TransformFeedbackVaryingsBucket(program, kResultBucketId,
buffermode);
helper_->SetBucketSize(kResultBucketId, 0);
CheckGLError();
}
void GLES2Implementation::Uniform1f(GLint location, GLfloat x) {
GPU_CLIENT_SINGLE_THREAD_CHECK();
GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform1f(" << location << ", "
<< x << ")");
helper_->Uniform1f(location, x);
CheckGLError();
}
void GLES2Implementation::Uniform1fv(GLint location,
GLsizei count,
const GLfloat* v) {
GPU_CLIENT_SINGLE_THREAD_CHECK();
GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform1fv(" << location << ", "
<< count << ", " << static_cast<const void*>(v) << ")");
GPU_CLIENT_LOG_CODE_BLOCK({
for (GLsizei i = 0; i < count; ++i) {
GPU_CLIENT_LOG(" " << i << ": " << v[0 + i * 1]);
}
});
if (count < 0) {
SetGLError(GL_INVALID_VALUE, "glUniform1fv", "count < 0");
return;
}
helper_->Uniform1fvImmediate(location, count, v);
CheckGLError();
}
void GLES2Implementation::Uniform1i(GLint location, GLint x) {
GPU_CLIENT_SINGLE_THREAD_CHECK();
GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform1i(" << location << ", "
<< x << ")");
helper_->Uniform1i(location, x);
CheckGLError();
}
void GLES2Implementation::Uniform1iv(GLint location,
GLsizei count,
const GLint* v) {
GPU_CLIENT_SINGLE_THREAD_CHECK();
GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform1iv(" << location << ", "
<< count << ", " << static_cast<const void*>(v) << ")");
GPU_CLIENT_LOG_CODE_BLOCK({
for (GLsizei i = 0; i < count; ++i) {
GPU_CLIENT_LOG(" " << i << ": " << v[0 + i * 1]);
}
});
if (count < 0) {
SetGLError(GL_INVALID_VALUE, "glUniform1iv", "count < 0");
return;
}
helper_->Uniform1ivImmediate(location, count, v);
CheckGLError();
}
void GLES2Implementation::Uniform1ui(GLint location, GLuint x) {
GPU_CLIENT_SINGLE_THREAD_CHECK();
GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform1ui(" << location << ", "
<< x << ")");
helper_->Uniform1ui(location, x);
CheckGLError();
}
void GLES2Implementation::Uniform1uiv(GLint location,
GLsizei count,
const GLuint* v) {
GPU_CLIENT_SINGLE_THREAD_CHECK();
GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform1uiv(" << location << ", "
<< count << ", " << static_cast<const void*>(v) << ")");
GPU_CLIENT_LOG_CODE_BLOCK({
for (GLsizei i = 0; i < count; ++i) {
GPU_CLIENT_LOG(" " << i << ": " << v[0 + i * 1]);
}
});
if (count < 0) {
SetGLError(GL_INVALID_VALUE, "glUniform1uiv", "count < 0");
return;
}
helper_->Uniform1uivImmediate(location, count, v);
CheckGLError();
}
void GLES2Implementation::Uniform2f(GLint location, GLfloat x, GLfloat y) {
GPU_CLIENT_SINGLE_THREAD_CHECK();
GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform2f(" << location << ", "
<< x << ", " << y << ")");
helper_->Uniform2f(location, x, y);
CheckGLError();
}
void GLES2Implementation::Uniform2fv(GLint location,
GLsizei count,
const GLfloat* v) {
GPU_CLIENT_SINGLE_THREAD_CHECK();
GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform2fv(" << location << ", "
<< count << ", " << static_cast<const void*>(v) << ")");
GPU_CLIENT_LOG_CODE_BLOCK({
for (GLsizei i = 0; i < count; ++i) {
GPU_CLIENT_LOG(" " << i << ": " << v[0 + i * 2] << ", " << v[1 + i * 2]);
}
});
if (count < 0) {
SetGLError(GL_INVALID_VALUE, "glUniform2fv", "count < 0");
return;
}
helper_->Uniform2fvImmediate(location, count, v);
CheckGLError();
}
void GLES2Implementation::Uniform2i(GLint location, GLint x, GLint y) {
GPU_CLIENT_SINGLE_THREAD_CHECK();
GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform2i(" << location << ", "
<< x << ", " << y << ")");
helper_->Uniform2i(location, x, y);
CheckGLError();
}
void GLES2Implementation::Uniform2iv(GLint location,
GLsizei count,
const GLint* v) {
GPU_CLIENT_SINGLE_THREAD_CHECK();
GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform2iv(" << location << ", "
<< count << ", " << static_cast<const void*>(v) << ")");
GPU_CLIENT_LOG_CODE_BLOCK({
for (GLsizei i = 0; i < count; ++i) {
GPU_CLIENT_LOG(" " << i << ": " << v[0 + i * 2] << ", " << v[1 + i * 2]);
}
});
if (count < 0) {
SetGLError(GL_INVALID_VALUE, "glUniform2iv", "count < 0");
return;
}
helper_->Uniform2ivImmediate(location, count, v);
CheckGLError();
}
void GLES2Implementation::Uniform2ui(GLint location, GLuint x, GLuint y) {
GPU_CLIENT_SINGLE_THREAD_CHECK();
GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform2ui(" << location << ", "
<< x << ", " << y << ")");
helper_->Uniform2ui(location, x, y);
CheckGLError();
}
void GLES2Implementation::Uniform2uiv(GLint location,
GLsizei count,
const GLuint* v) {
GPU_CLIENT_SINGLE_THREAD_CHECK();
GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform2uiv(" << location << ", "
<< count << ", " << static_cast<const void*>(v) << ")");
GPU_CLIENT_LOG_CODE_BLOCK({
for (GLsizei i = 0; i < count; ++i) {
GPU_CLIENT_LOG(" " << i << ": " << v[0 + i * 2] << ", " << v[1 + i * 2]);
}
});
if (count < 0) {
SetGLError(GL_INVALID_VALUE, "glUniform2uiv", "count < 0");
return;
}
helper_->Uniform2uivImmediate(location, count, v);
CheckGLError();
}
void GLES2Implementation::Uniform3f(GLint location,
GLfloat x,
GLfloat y,
GLfloat z) {
GPU_CLIENT_SINGLE_THREAD_CHECK();
GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform3f(" << location << ", "
<< x << ", " << y << ", " << z << ")");
helper_->Uniform3f(location, x, y, z);
CheckGLError();
}
void GLES2Implementation::Uniform3fv(GLint location,
GLsizei count,
const GLfloat* v) {
GPU_CLIENT_SINGLE_THREAD_CHECK();
GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform3fv(" << location << ", "
<< count << ", " << static_cast<const void*>(v) << ")");
GPU_CLIENT_LOG_CODE_BLOCK({
for (GLsizei i = 0; i < count; ++i) {
GPU_CLIENT_LOG(" " << i << ": " << v[0 + i * 3] << ", " << v[1 + i * 3]
<< ", " << v[2 + i * 3]);
}
});
if (count < 0) {
SetGLError(GL_INVALID_VALUE, "glUniform3fv", "count < 0");
return;
}
helper_->Uniform3fvImmediate(location, count, v);
CheckGLError();
}
void GLES2Implementation::Uniform3i(GLint location, GLint x, GLint y, GLint z) {
GPU_CLIENT_SINGLE_THREAD_CHECK();
GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform3i(" << location << ", "
<< x << ", " << y << ", " << z << ")");
helper_->Uniform3i(location, x, y, z);
CheckGLError();
}
void GLES2Implementation::Uniform3iv(GLint location,
GLsizei count,
const GLint* v) {
GPU_CLIENT_SINGLE_THREAD_CHECK();
GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform3iv(" << location << ", "
<< count << ", " << static_cast<const void*>(v) << ")");
GPU_CLIENT_LOG_CODE_BLOCK({
for (GLsizei i = 0; i < count; ++i) {
GPU_CLIENT_LOG(" " << i << ": " << v[0 + i * 3] << ", " << v[1 + i * 3]
<< ", " << v[2 + i * 3]);
}
});
if (count < 0) {
SetGLError(GL_INVALID_VALUE, "glUniform3iv", "count < 0");
return;
}
helper_->Uniform3ivImmediate(location, count, v);
CheckGLError();
}
void GLES2Implementation::Uniform3ui(GLint location,
GLuint x,
GLuint y,
GLuint z) {
GPU_CLIENT_SINGLE_THREAD_CHECK();
GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform3ui(" << location << ", "
<< x << ", " << y << ", " << z << ")");
helper_->Uniform3ui(location, x, y, z);
CheckGLError();
}
void GLES2Implementation::Uniform3uiv(GLint location,
GLsizei count,
const GLuint* v) {
GPU_CLIENT_SINGLE_THREAD_CHECK();
GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform3uiv(" << location << ", "
<< count << ", " << static_cast<const void*>(v) << ")");
GPU_CLIENT_LOG_CODE_BLOCK({
for (GLsizei i = 0; i < count; ++i) {
GPU_CLIENT_LOG(" " << i << ": " << v[0 + i * 3] << ", " << v[1 + i * 3]
<< ", " << v[2 + i * 3]);
}
});
if (count < 0) {
SetGLError(GL_INVALID_VALUE, "glUniform3uiv", "count < 0");
return;
}
helper_->Uniform3uivImmediate(location, count, v);
CheckGLError();
}
void GLES2Implementation::Uniform4f(GLint location,
GLfloat x,
GLfloat y,
GLfloat z,
GLfloat w) {
GPU_CLIENT_SINGLE_THREAD_CHECK();
GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform4f(" << location << ", "
<< x << ", " << y << ", " << z << ", " << w << ")");
helper_->Uniform4f(location, x, y, z, w);
CheckGLError();
}
void GLES2Implementation::Uniform4fv(GLint location,
GLsizei count,
const GLfloat* v) {
GPU_CLIENT_SINGLE_THREAD_CHECK();
GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform4fv(" << location << ", "
<< count << ", " << static_cast<const void*>(v) << ")");
GPU_CLIENT_LOG_CODE_BLOCK({
for (GLsizei i = 0; i < count; ++i) {