blob: 84d7ce46bc1fba2e43b73b96248a344476f5e306 [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 contains unit tests for gles2 commands
// It is included by gles2_cmd_format_test.cc
#ifndef GPU_COMMAND_BUFFER_COMMON_GLES2_CMD_FORMAT_TEST_AUTOGEN_H_
#define GPU_COMMAND_BUFFER_COMMON_GLES2_CMD_FORMAT_TEST_AUTOGEN_H_
TEST_F(GLES2FormatTest, ActiveTexture) {
cmds::ActiveTexture& cmd = *GetBufferAs<cmds::ActiveTexture>();
void* next_cmd = cmd.Set(&cmd, static_cast<GLenum>(11));
EXPECT_EQ(static_cast<uint32_t>(cmds::ActiveTexture::kCmdId),
cmd.header.command);
EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
EXPECT_EQ(static_cast<GLenum>(11), cmd.texture);
CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
}
TEST_F(GLES2FormatTest, AttachShader) {
cmds::AttachShader& cmd = *GetBufferAs<cmds::AttachShader>();
void* next_cmd =
cmd.Set(&cmd, static_cast<GLuint>(11), static_cast<GLuint>(12));
EXPECT_EQ(static_cast<uint32_t>(cmds::AttachShader::kCmdId),
cmd.header.command);
EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
EXPECT_EQ(static_cast<GLuint>(11), cmd.program);
EXPECT_EQ(static_cast<GLuint>(12), cmd.shader);
CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
}
TEST_F(GLES2FormatTest, BindAttribLocationBucket) {
cmds::BindAttribLocationBucket& cmd =
*GetBufferAs<cmds::BindAttribLocationBucket>();
void* next_cmd = cmd.Set(&cmd, static_cast<GLuint>(11),
static_cast<GLuint>(12), static_cast<uint32_t>(13));
EXPECT_EQ(static_cast<uint32_t>(cmds::BindAttribLocationBucket::kCmdId),
cmd.header.command);
EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
EXPECT_EQ(static_cast<GLuint>(11), cmd.program);
EXPECT_EQ(static_cast<GLuint>(12), cmd.index);
EXPECT_EQ(static_cast<uint32_t>(13), cmd.name_bucket_id);
CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
}
TEST_F(GLES2FormatTest, BindBuffer) {
cmds::BindBuffer& cmd = *GetBufferAs<cmds::BindBuffer>();
void* next_cmd =
cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<GLuint>(12));
EXPECT_EQ(static_cast<uint32_t>(cmds::BindBuffer::kCmdId),
cmd.header.command);
EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
EXPECT_EQ(static_cast<GLuint>(12), cmd.buffer);
CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
}
TEST_F(GLES2FormatTest, BindBufferBase) {
cmds::BindBufferBase& cmd = *GetBufferAs<cmds::BindBufferBase>();
void* next_cmd = cmd.Set(&cmd, static_cast<GLenum>(11),
static_cast<GLuint>(12), static_cast<GLuint>(13));
EXPECT_EQ(static_cast<uint32_t>(cmds::BindBufferBase::kCmdId),
cmd.header.command);
EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
EXPECT_EQ(static_cast<GLuint>(12), cmd.index);
EXPECT_EQ(static_cast<GLuint>(13), cmd.buffer);
CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
}
TEST_F(GLES2FormatTest, BindBufferRange) {
cmds::BindBufferRange& cmd = *GetBufferAs<cmds::BindBufferRange>();
void* next_cmd =
cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<GLuint>(12),
static_cast<GLuint>(13), static_cast<GLintptr>(14),
static_cast<GLsizeiptr>(15));
EXPECT_EQ(static_cast<uint32_t>(cmds::BindBufferRange::kCmdId),
cmd.header.command);
EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
EXPECT_EQ(static_cast<GLuint>(12), cmd.index);
EXPECT_EQ(static_cast<GLuint>(13), cmd.buffer);
EXPECT_EQ(static_cast<GLintptr>(14), cmd.offset);
EXPECT_EQ(static_cast<GLsizeiptr>(15), cmd.size);
CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
}
TEST_F(GLES2FormatTest, BindFramebuffer) {
cmds::BindFramebuffer& cmd = *GetBufferAs<cmds::BindFramebuffer>();
void* next_cmd =
cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<GLuint>(12));
EXPECT_EQ(static_cast<uint32_t>(cmds::BindFramebuffer::kCmdId),
cmd.header.command);
EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
EXPECT_EQ(static_cast<GLuint>(12), cmd.framebuffer);
CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
}
TEST_F(GLES2FormatTest, BindRenderbuffer) {
cmds::BindRenderbuffer& cmd = *GetBufferAs<cmds::BindRenderbuffer>();
void* next_cmd =
cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<GLuint>(12));
EXPECT_EQ(static_cast<uint32_t>(cmds::BindRenderbuffer::kCmdId),
cmd.header.command);
EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
EXPECT_EQ(static_cast<GLuint>(12), cmd.renderbuffer);
CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
}
TEST_F(GLES2FormatTest, BindSampler) {
cmds::BindSampler& cmd = *GetBufferAs<cmds::BindSampler>();
void* next_cmd =
cmd.Set(&cmd, static_cast<GLuint>(11), static_cast<GLuint>(12));
EXPECT_EQ(static_cast<uint32_t>(cmds::BindSampler::kCmdId),
cmd.header.command);
EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
EXPECT_EQ(static_cast<GLuint>(11), cmd.unit);
EXPECT_EQ(static_cast<GLuint>(12), cmd.sampler);
CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
}
TEST_F(GLES2FormatTest, BindTexture) {
cmds::BindTexture& cmd = *GetBufferAs<cmds::BindTexture>();
void* next_cmd =
cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<GLuint>(12));
EXPECT_EQ(static_cast<uint32_t>(cmds::BindTexture::kCmdId),
cmd.header.command);
EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
EXPECT_EQ(static_cast<GLuint>(12), cmd.texture);
CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
}
TEST_F(GLES2FormatTest, BindTransformFeedback) {
cmds::BindTransformFeedback& cmd =
*GetBufferAs<cmds::BindTransformFeedback>();
void* next_cmd =
cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<GLuint>(12));
EXPECT_EQ(static_cast<uint32_t>(cmds::BindTransformFeedback::kCmdId),
cmd.header.command);
EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
EXPECT_EQ(static_cast<GLuint>(12), cmd.transformfeedback);
CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
}
TEST_F(GLES2FormatTest, BlendColor) {
cmds::BlendColor& cmd = *GetBufferAs<cmds::BlendColor>();
void* next_cmd =
cmd.Set(&cmd, static_cast<GLclampf>(11), static_cast<GLclampf>(12),
static_cast<GLclampf>(13), static_cast<GLclampf>(14));
EXPECT_EQ(static_cast<uint32_t>(cmds::BlendColor::kCmdId),
cmd.header.command);
EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
EXPECT_EQ(static_cast<GLclampf>(11), cmd.red);
EXPECT_EQ(static_cast<GLclampf>(12), cmd.green);
EXPECT_EQ(static_cast<GLclampf>(13), cmd.blue);
EXPECT_EQ(static_cast<GLclampf>(14), cmd.alpha);
CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
}
TEST_F(GLES2FormatTest, BlendEquation) {
cmds::BlendEquation& cmd = *GetBufferAs<cmds::BlendEquation>();
void* next_cmd = cmd.Set(&cmd, static_cast<GLenum>(11));
EXPECT_EQ(static_cast<uint32_t>(cmds::BlendEquation::kCmdId),
cmd.header.command);
EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
EXPECT_EQ(static_cast<GLenum>(11), cmd.mode);
CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
}
TEST_F(GLES2FormatTest, BlendEquationSeparate) {
cmds::BlendEquationSeparate& cmd =
*GetBufferAs<cmds::BlendEquationSeparate>();
void* next_cmd =
cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<GLenum>(12));
EXPECT_EQ(static_cast<uint32_t>(cmds::BlendEquationSeparate::kCmdId),
cmd.header.command);
EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
EXPECT_EQ(static_cast<GLenum>(11), cmd.modeRGB);
EXPECT_EQ(static_cast<GLenum>(12), cmd.modeAlpha);
CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
}
TEST_F(GLES2FormatTest, BlendFunc) {
cmds::BlendFunc& cmd = *GetBufferAs<cmds::BlendFunc>();
void* next_cmd =
cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<GLenum>(12));
EXPECT_EQ(static_cast<uint32_t>(cmds::BlendFunc::kCmdId), cmd.header.command);
EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
EXPECT_EQ(static_cast<GLenum>(11), cmd.sfactor);
EXPECT_EQ(static_cast<GLenum>(12), cmd.dfactor);
CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
}
TEST_F(GLES2FormatTest, BlendFuncSeparate) {
cmds::BlendFuncSeparate& cmd = *GetBufferAs<cmds::BlendFuncSeparate>();
void* next_cmd =
cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<GLenum>(12),
static_cast<GLenum>(13), static_cast<GLenum>(14));
EXPECT_EQ(static_cast<uint32_t>(cmds::BlendFuncSeparate::kCmdId),
cmd.header.command);
EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
EXPECT_EQ(static_cast<GLenum>(11), cmd.srcRGB);
EXPECT_EQ(static_cast<GLenum>(12), cmd.dstRGB);
EXPECT_EQ(static_cast<GLenum>(13), cmd.srcAlpha);
EXPECT_EQ(static_cast<GLenum>(14), cmd.dstAlpha);
CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
}
TEST_F(GLES2FormatTest, BufferData) {
cmds::BufferData& cmd = *GetBufferAs<cmds::BufferData>();
void* next_cmd =
cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<GLsizeiptr>(12),
static_cast<uint32_t>(13), static_cast<uint32_t>(14),
static_cast<GLenum>(15));
EXPECT_EQ(static_cast<uint32_t>(cmds::BufferData::kCmdId),
cmd.header.command);
EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
EXPECT_EQ(static_cast<GLsizeiptr>(12), cmd.size);
EXPECT_EQ(static_cast<uint32_t>(13), cmd.data_shm_id);
EXPECT_EQ(static_cast<uint32_t>(14), cmd.data_shm_offset);
EXPECT_EQ(static_cast<GLenum>(15), cmd.usage);
CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
}
TEST_F(GLES2FormatTest, BufferSubData) {
cmds::BufferSubData& cmd = *GetBufferAs<cmds::BufferSubData>();
void* next_cmd =
cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<GLintptr>(12),
static_cast<GLsizeiptr>(13), static_cast<uint32_t>(14),
static_cast<uint32_t>(15));
EXPECT_EQ(static_cast<uint32_t>(cmds::BufferSubData::kCmdId),
cmd.header.command);
EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
EXPECT_EQ(static_cast<GLintptr>(12), cmd.offset);
EXPECT_EQ(static_cast<GLsizeiptr>(13), cmd.size);
EXPECT_EQ(static_cast<uint32_t>(14), cmd.data_shm_id);
EXPECT_EQ(static_cast<uint32_t>(15), cmd.data_shm_offset);
CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
}
TEST_F(GLES2FormatTest, CheckFramebufferStatus) {
cmds::CheckFramebufferStatus& cmd =
*GetBufferAs<cmds::CheckFramebufferStatus>();
void* next_cmd =
cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<uint32_t>(12),
static_cast<uint32_t>(13));
EXPECT_EQ(static_cast<uint32_t>(cmds::CheckFramebufferStatus::kCmdId),
cmd.header.command);
EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
EXPECT_EQ(static_cast<uint32_t>(12), cmd.result_shm_id);
EXPECT_EQ(static_cast<uint32_t>(13), cmd.result_shm_offset);
CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
}
TEST_F(GLES2FormatTest, Clear) {
cmds::Clear& cmd = *GetBufferAs<cmds::Clear>();
void* next_cmd = cmd.Set(&cmd, static_cast<GLbitfield>(11));
EXPECT_EQ(static_cast<uint32_t>(cmds::Clear::kCmdId), cmd.header.command);
EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
EXPECT_EQ(static_cast<GLbitfield>(11), cmd.mask);
CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
}
TEST_F(GLES2FormatTest, ClearBufferfi) {
cmds::ClearBufferfi& cmd = *GetBufferAs<cmds::ClearBufferfi>();
void* next_cmd =
cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<GLint>(12),
static_cast<GLfloat>(13), static_cast<GLint>(14));
EXPECT_EQ(static_cast<uint32_t>(cmds::ClearBufferfi::kCmdId),
cmd.header.command);
EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
EXPECT_EQ(static_cast<GLenum>(11), cmd.buffer);
EXPECT_EQ(static_cast<GLint>(12), cmd.drawbuffers);
EXPECT_EQ(static_cast<GLfloat>(13), cmd.depth);
EXPECT_EQ(static_cast<GLint>(14), cmd.stencil);
CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
}
TEST_F(GLES2FormatTest, ClearBufferfvImmediate) {
const int kSomeBaseValueToTestWith = 51;
static GLfloat data[] = {
static_cast<GLfloat>(kSomeBaseValueToTestWith + 0),
static_cast<GLfloat>(kSomeBaseValueToTestWith + 1),
static_cast<GLfloat>(kSomeBaseValueToTestWith + 2),
static_cast<GLfloat>(kSomeBaseValueToTestWith + 3),
};
cmds::ClearBufferfvImmediate& cmd =
*GetBufferAs<cmds::ClearBufferfvImmediate>();
void* next_cmd =
cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<GLint>(12), data);
EXPECT_EQ(static_cast<uint32_t>(cmds::ClearBufferfvImmediate::kCmdId),
cmd.header.command);
EXPECT_EQ(sizeof(cmd) + RoundSizeToMultipleOfEntries(sizeof(data)),
cmd.header.size * 4u);
EXPECT_EQ(static_cast<GLenum>(11), cmd.buffer);
EXPECT_EQ(static_cast<GLint>(12), cmd.drawbuffers);
CheckBytesWrittenMatchesExpectedSize(
next_cmd, sizeof(cmd) + RoundSizeToMultipleOfEntries(sizeof(data)));
}
TEST_F(GLES2FormatTest, ClearBufferivImmediate) {
const int kSomeBaseValueToTestWith = 51;
static GLint data[] = {
static_cast<GLint>(kSomeBaseValueToTestWith + 0),
static_cast<GLint>(kSomeBaseValueToTestWith + 1),
static_cast<GLint>(kSomeBaseValueToTestWith + 2),
static_cast<GLint>(kSomeBaseValueToTestWith + 3),
};
cmds::ClearBufferivImmediate& cmd =
*GetBufferAs<cmds::ClearBufferivImmediate>();
void* next_cmd =
cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<GLint>(12), data);
EXPECT_EQ(static_cast<uint32_t>(cmds::ClearBufferivImmediate::kCmdId),
cmd.header.command);
EXPECT_EQ(sizeof(cmd) + RoundSizeToMultipleOfEntries(sizeof(data)),
cmd.header.size * 4u);
EXPECT_EQ(static_cast<GLenum>(11), cmd.buffer);
EXPECT_EQ(static_cast<GLint>(12), cmd.drawbuffers);
CheckBytesWrittenMatchesExpectedSize(
next_cmd, sizeof(cmd) + RoundSizeToMultipleOfEntries(sizeof(data)));
}
TEST_F(GLES2FormatTest, ClearBufferuivImmediate) {
const int kSomeBaseValueToTestWith = 51;
static GLuint data[] = {
static_cast<GLuint>(kSomeBaseValueToTestWith + 0),
static_cast<GLuint>(kSomeBaseValueToTestWith + 1),
static_cast<GLuint>(kSomeBaseValueToTestWith + 2),
static_cast<GLuint>(kSomeBaseValueToTestWith + 3),
};
cmds::ClearBufferuivImmediate& cmd =
*GetBufferAs<cmds::ClearBufferuivImmediate>();
void* next_cmd =
cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<GLint>(12), data);
EXPECT_EQ(static_cast<uint32_t>(cmds::ClearBufferuivImmediate::kCmdId),
cmd.header.command);
EXPECT_EQ(sizeof(cmd) + RoundSizeToMultipleOfEntries(sizeof(data)),
cmd.header.size * 4u);
EXPECT_EQ(static_cast<GLenum>(11), cmd.buffer);
EXPECT_EQ(static_cast<GLint>(12), cmd.drawbuffers);
CheckBytesWrittenMatchesExpectedSize(
next_cmd, sizeof(cmd) + RoundSizeToMultipleOfEntries(sizeof(data)));
}
TEST_F(GLES2FormatTest, ClearColor) {
cmds::ClearColor& cmd = *GetBufferAs<cmds::ClearColor>();
void* next_cmd =
cmd.Set(&cmd, static_cast<GLclampf>(11), static_cast<GLclampf>(12),
static_cast<GLclampf>(13), static_cast<GLclampf>(14));
EXPECT_EQ(static_cast<uint32_t>(cmds::ClearColor::kCmdId),
cmd.header.command);
EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
EXPECT_EQ(static_cast<GLclampf>(11), cmd.red);
EXPECT_EQ(static_cast<GLclampf>(12), cmd.green);
EXPECT_EQ(static_cast<GLclampf>(13), cmd.blue);
EXPECT_EQ(static_cast<GLclampf>(14), cmd.alpha);
CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
}
TEST_F(GLES2FormatTest, ClearDepthf) {
cmds::ClearDepthf& cmd = *GetBufferAs<cmds::ClearDepthf>();
void* next_cmd = cmd.Set(&cmd, static_cast<GLclampf>(11));
EXPECT_EQ(static_cast<uint32_t>(cmds::ClearDepthf::kCmdId),
cmd.header.command);
EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
EXPECT_EQ(static_cast<GLclampf>(11), cmd.depth);
CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
}
TEST_F(GLES2FormatTest, ClearStencil) {
cmds::ClearStencil& cmd = *GetBufferAs<cmds::ClearStencil>();
void* next_cmd = cmd.Set(&cmd, static_cast<GLint>(11));
EXPECT_EQ(static_cast<uint32_t>(cmds::ClearStencil::kCmdId),
cmd.header.command);
EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
EXPECT_EQ(static_cast<GLint>(11), cmd.s);
CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
}
TEST_F(GLES2FormatTest, ClientWaitSync) {
cmds::ClientWaitSync& cmd = *GetBufferAs<cmds::ClientWaitSync>();
void* next_cmd =
cmd.Set(&cmd, static_cast<GLuint>(11), static_cast<GLbitfield>(12),
static_cast<GLuint64>(13), static_cast<uint32_t>(14),
static_cast<uint32_t>(15));
EXPECT_EQ(static_cast<uint32_t>(cmds::ClientWaitSync::kCmdId),
cmd.header.command);
EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
EXPECT_EQ(static_cast<GLuint>(11), cmd.sync);
EXPECT_EQ(static_cast<GLbitfield>(12), cmd.flags);
EXPECT_EQ(static_cast<GLuint64>(13), cmd.timeout());
EXPECT_EQ(static_cast<uint32_t>(14), cmd.result_shm_id);
EXPECT_EQ(static_cast<uint32_t>(15), cmd.result_shm_offset);
CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
}
TEST_F(GLES2FormatTest, ColorMask) {
cmds::ColorMask& cmd = *GetBufferAs<cmds::ColorMask>();
void* next_cmd =
cmd.Set(&cmd, static_cast<GLboolean>(11), static_cast<GLboolean>(12),
static_cast<GLboolean>(13), static_cast<GLboolean>(14));
EXPECT_EQ(static_cast<uint32_t>(cmds::ColorMask::kCmdId), cmd.header.command);
EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
EXPECT_EQ(static_cast<GLboolean>(11), cmd.red);
EXPECT_EQ(static_cast<GLboolean>(12), cmd.green);
EXPECT_EQ(static_cast<GLboolean>(13), cmd.blue);
EXPECT_EQ(static_cast<GLboolean>(14), cmd.alpha);
CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
}
TEST_F(GLES2FormatTest, CompileShader) {
cmds::CompileShader& cmd = *GetBufferAs<cmds::CompileShader>();
void* next_cmd = cmd.Set(&cmd, static_cast<GLuint>(11));
EXPECT_EQ(static_cast<uint32_t>(cmds::CompileShader::kCmdId),
cmd.header.command);
EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
EXPECT_EQ(static_cast<GLuint>(11), cmd.shader);
CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
}
TEST_F(GLES2FormatTest, CompressedTexImage2DBucket) {
cmds::CompressedTexImage2DBucket& cmd =
*GetBufferAs<cmds::CompressedTexImage2DBucket>();
void* next_cmd =
cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<GLint>(12),
static_cast<GLenum>(13), static_cast<GLsizei>(14),
static_cast<GLsizei>(15), static_cast<GLuint>(16));
EXPECT_EQ(static_cast<uint32_t>(cmds::CompressedTexImage2DBucket::kCmdId),
cmd.header.command);
EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
EXPECT_EQ(static_cast<GLint>(12), cmd.level);
EXPECT_EQ(static_cast<GLenum>(13), cmd.internalformat);
EXPECT_EQ(static_cast<GLsizei>(14), cmd.width);
EXPECT_EQ(static_cast<GLsizei>(15), cmd.height);
EXPECT_EQ(static_cast<GLuint>(16), cmd.bucket_id);
CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
}
TEST_F(GLES2FormatTest, CompressedTexImage2D) {
cmds::CompressedTexImage2D& cmd = *GetBufferAs<cmds::CompressedTexImage2D>();
void* next_cmd =
cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<GLint>(12),
static_cast<GLenum>(13), static_cast<GLsizei>(14),
static_cast<GLsizei>(15), static_cast<GLsizei>(16),
static_cast<uint32_t>(17), static_cast<uint32_t>(18));
EXPECT_EQ(static_cast<uint32_t>(cmds::CompressedTexImage2D::kCmdId),
cmd.header.command);
EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
EXPECT_EQ(static_cast<GLint>(12), cmd.level);
EXPECT_EQ(static_cast<GLenum>(13), cmd.internalformat);
EXPECT_EQ(static_cast<GLsizei>(14), cmd.width);
EXPECT_EQ(static_cast<GLsizei>(15), cmd.height);
EXPECT_EQ(static_cast<GLsizei>(16), cmd.imageSize);
EXPECT_EQ(static_cast<uint32_t>(17), cmd.data_shm_id);
EXPECT_EQ(static_cast<uint32_t>(18), cmd.data_shm_offset);
CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
}
TEST_F(GLES2FormatTest, CompressedTexSubImage2DBucket) {
cmds::CompressedTexSubImage2DBucket& cmd =
*GetBufferAs<cmds::CompressedTexSubImage2DBucket>();
void* next_cmd =
cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<GLint>(12),
static_cast<GLint>(13), static_cast<GLint>(14),
static_cast<GLsizei>(15), static_cast<GLsizei>(16),
static_cast<GLenum>(17), static_cast<GLuint>(18));
EXPECT_EQ(static_cast<uint32_t>(cmds::CompressedTexSubImage2DBucket::kCmdId),
cmd.header.command);
EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
EXPECT_EQ(static_cast<GLint>(12), cmd.level);
EXPECT_EQ(static_cast<GLint>(13), cmd.xoffset);
EXPECT_EQ(static_cast<GLint>(14), cmd.yoffset);
EXPECT_EQ(static_cast<GLsizei>(15), cmd.width);
EXPECT_EQ(static_cast<GLsizei>(16), cmd.height);
EXPECT_EQ(static_cast<GLenum>(17), cmd.format);
EXPECT_EQ(static_cast<GLuint>(18), cmd.bucket_id);
CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
}
TEST_F(GLES2FormatTest, CompressedTexSubImage2D) {
cmds::CompressedTexSubImage2D& cmd =
*GetBufferAs<cmds::CompressedTexSubImage2D>();
void* next_cmd =
cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<GLint>(12),
static_cast<GLint>(13), static_cast<GLint>(14),
static_cast<GLsizei>(15), static_cast<GLsizei>(16),
static_cast<GLenum>(17), static_cast<GLsizei>(18),
static_cast<uint32_t>(19), static_cast<uint32_t>(20));
EXPECT_EQ(static_cast<uint32_t>(cmds::CompressedTexSubImage2D::kCmdId),
cmd.header.command);
EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
EXPECT_EQ(static_cast<GLint>(12), cmd.level);
EXPECT_EQ(static_cast<GLint>(13), cmd.xoffset);
EXPECT_EQ(static_cast<GLint>(14), cmd.yoffset);
EXPECT_EQ(static_cast<GLsizei>(15), cmd.width);
EXPECT_EQ(static_cast<GLsizei>(16), cmd.height);
EXPECT_EQ(static_cast<GLenum>(17), cmd.format);
EXPECT_EQ(static_cast<GLsizei>(18), cmd.imageSize);
EXPECT_EQ(static_cast<uint32_t>(19), cmd.data_shm_id);
EXPECT_EQ(static_cast<uint32_t>(20), cmd.data_shm_offset);
CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
}
TEST_F(GLES2FormatTest, CompressedTexImage3DBucket) {
cmds::CompressedTexImage3DBucket& cmd =
*GetBufferAs<cmds::CompressedTexImage3DBucket>();
void* next_cmd = cmd.Set(&cmd, static_cast<GLenum>(11),
static_cast<GLint>(12), static_cast<GLenum>(13),
static_cast<GLsizei>(14), static_cast<GLsizei>(15),
static_cast<GLsizei>(16), static_cast<GLuint>(17));
EXPECT_EQ(static_cast<uint32_t>(cmds::CompressedTexImage3DBucket::kCmdId),
cmd.header.command);
EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
EXPECT_EQ(static_cast<GLint>(12), cmd.level);
EXPECT_EQ(static_cast<GLenum>(13), cmd.internalformat);
EXPECT_EQ(static_cast<GLsizei>(14), cmd.width);
EXPECT_EQ(static_cast<GLsizei>(15), cmd.height);
EXPECT_EQ(static_cast<GLsizei>(16), cmd.depth);
EXPECT_EQ(static_cast<GLuint>(17), cmd.bucket_id);
CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
}
TEST_F(GLES2FormatTest, CompressedTexImage3D) {
cmds::CompressedTexImage3D& cmd = *GetBufferAs<cmds::CompressedTexImage3D>();
void* next_cmd =
cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<GLint>(12),
static_cast<GLenum>(13), static_cast<GLsizei>(14),
static_cast<GLsizei>(15), static_cast<GLsizei>(16),
static_cast<GLsizei>(17), static_cast<uint32_t>(18),
static_cast<uint32_t>(19));
EXPECT_EQ(static_cast<uint32_t>(cmds::CompressedTexImage3D::kCmdId),
cmd.header.command);
EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
EXPECT_EQ(static_cast<GLint>(12), cmd.level);
EXPECT_EQ(static_cast<GLenum>(13), cmd.internalformat);
EXPECT_EQ(static_cast<GLsizei>(14), cmd.width);
EXPECT_EQ(static_cast<GLsizei>(15), cmd.height);
EXPECT_EQ(static_cast<GLsizei>(16), cmd.depth);
EXPECT_EQ(static_cast<GLsizei>(17), cmd.imageSize);
EXPECT_EQ(static_cast<uint32_t>(18), cmd.data_shm_id);
EXPECT_EQ(static_cast<uint32_t>(19), cmd.data_shm_offset);
CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
}
TEST_F(GLES2FormatTest, CompressedTexSubImage3DBucket) {
cmds::CompressedTexSubImage3DBucket& cmd =
*GetBufferAs<cmds::CompressedTexSubImage3DBucket>();
void* next_cmd =
cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<GLint>(12),
static_cast<GLint>(13), static_cast<GLint>(14),
static_cast<GLint>(15), static_cast<GLsizei>(16),
static_cast<GLsizei>(17), static_cast<GLsizei>(18),
static_cast<GLenum>(19), static_cast<GLuint>(20));
EXPECT_EQ(static_cast<uint32_t>(cmds::CompressedTexSubImage3DBucket::kCmdId),
cmd.header.command);
EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
EXPECT_EQ(static_cast<GLint>(12), cmd.level);
EXPECT_EQ(static_cast<GLint>(13), cmd.xoffset);
EXPECT_EQ(static_cast<GLint>(14), cmd.yoffset);
EXPECT_EQ(static_cast<GLint>(15), cmd.zoffset);
EXPECT_EQ(static_cast<GLsizei>(16), cmd.width);
EXPECT_EQ(static_cast<GLsizei>(17), cmd.height);
EXPECT_EQ(static_cast<GLsizei>(18), cmd.depth);
EXPECT_EQ(static_cast<GLenum>(19), cmd.format);
EXPECT_EQ(static_cast<GLuint>(20), cmd.bucket_id);
CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
}
TEST_F(GLES2FormatTest, CompressedTexSubImage3D) {
cmds::CompressedTexSubImage3D& cmd =
*GetBufferAs<cmds::CompressedTexSubImage3D>();
void* next_cmd =
cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<GLint>(12),
static_cast<GLint>(13), static_cast<GLint>(14),
static_cast<GLint>(15), static_cast<GLsizei>(16),
static_cast<GLsizei>(17), static_cast<GLsizei>(18),
static_cast<GLenum>(19), static_cast<GLsizei>(20),
static_cast<uint32_t>(21), static_cast<uint32_t>(22));
EXPECT_EQ(static_cast<uint32_t>(cmds::CompressedTexSubImage3D::kCmdId),
cmd.header.command);
EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
EXPECT_EQ(static_cast<GLint>(12), cmd.level);
EXPECT_EQ(static_cast<GLint>(13), cmd.xoffset);
EXPECT_EQ(static_cast<GLint>(14), cmd.yoffset);
EXPECT_EQ(static_cast<GLint>(15), cmd.zoffset);
EXPECT_EQ(static_cast<GLsizei>(16), cmd.width);
EXPECT_EQ(static_cast<GLsizei>(17), cmd.height);
EXPECT_EQ(static_cast<GLsizei>(18), cmd.depth);
EXPECT_EQ(static_cast<GLenum>(19), cmd.format);
EXPECT_EQ(static_cast<GLsizei>(20), cmd.imageSize);
EXPECT_EQ(static_cast<uint32_t>(21), cmd.data_shm_id);
EXPECT_EQ(static_cast<uint32_t>(22), cmd.data_shm_offset);
CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
}
TEST_F(GLES2FormatTest, CopyBufferSubData) {
cmds::CopyBufferSubData& cmd = *GetBufferAs<cmds::CopyBufferSubData>();
void* next_cmd =
cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<GLenum>(12),
static_cast<GLintptr>(13), static_cast<GLintptr>(14),
static_cast<GLsizeiptr>(15));
EXPECT_EQ(static_cast<uint32_t>(cmds::CopyBufferSubData::kCmdId),
cmd.header.command);
EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
EXPECT_EQ(static_cast<GLenum>(11), cmd.readtarget);
EXPECT_EQ(static_cast<GLenum>(12), cmd.writetarget);
EXPECT_EQ(static_cast<GLintptr>(13), cmd.readoffset);
EXPECT_EQ(static_cast<GLintptr>(14), cmd.writeoffset);
EXPECT_EQ(static_cast<GLsizeiptr>(15), cmd.size);
CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
}
TEST_F(GLES2FormatTest, CopyTexImage2D) {
cmds::CopyTexImage2D& cmd = *GetBufferAs<cmds::CopyTexImage2D>();
void* next_cmd = cmd.Set(&cmd, static_cast<GLenum>(11),
static_cast<GLint>(12), static_cast<GLenum>(13),
static_cast<GLint>(14), static_cast<GLint>(15),
static_cast<GLsizei>(16), static_cast<GLsizei>(17));
EXPECT_EQ(static_cast<uint32_t>(cmds::CopyTexImage2D::kCmdId),
cmd.header.command);
EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
EXPECT_EQ(static_cast<GLint>(12), cmd.level);
EXPECT_EQ(static_cast<GLenum>(13), cmd.internalformat);
EXPECT_EQ(static_cast<GLint>(14), cmd.x);
EXPECT_EQ(static_cast<GLint>(15), cmd.y);
EXPECT_EQ(static_cast<GLsizei>(16), cmd.width);
EXPECT_EQ(static_cast<GLsizei>(17), cmd.height);
CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
}
TEST_F(GLES2FormatTest, CopyTexSubImage2D) {
cmds::CopyTexSubImage2D& cmd = *GetBufferAs<cmds::CopyTexSubImage2D>();
void* next_cmd =
cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<GLint>(12),
static_cast<GLint>(13), static_cast<GLint>(14),
static_cast<GLint>(15), static_cast<GLint>(16),
static_cast<GLsizei>(17), static_cast<GLsizei>(18));
EXPECT_EQ(static_cast<uint32_t>(cmds::CopyTexSubImage2D::kCmdId),
cmd.header.command);
EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
EXPECT_EQ(static_cast<GLint>(12), cmd.level);
EXPECT_EQ(static_cast<GLint>(13), cmd.xoffset);
EXPECT_EQ(static_cast<GLint>(14), cmd.yoffset);
EXPECT_EQ(static_cast<GLint>(15), cmd.x);
EXPECT_EQ(static_cast<GLint>(16), cmd.y);
EXPECT_EQ(static_cast<GLsizei>(17), cmd.width);
EXPECT_EQ(static_cast<GLsizei>(18), cmd.height);
CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
}
TEST_F(GLES2FormatTest, CopyTexSubImage3D) {
cmds::CopyTexSubImage3D& cmd = *GetBufferAs<cmds::CopyTexSubImage3D>();
void* next_cmd = cmd.Set(&cmd, static_cast<GLenum>(11),
static_cast<GLint>(12), static_cast<GLint>(13),
static_cast<GLint>(14), static_cast<GLint>(15),
static_cast<GLint>(16), static_cast<GLint>(17),
static_cast<GLsizei>(18), static_cast<GLsizei>(19));
EXPECT_EQ(static_cast<uint32_t>(cmds::CopyTexSubImage3D::kCmdId),
cmd.header.command);
EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
EXPECT_EQ(static_cast<GLint>(12), cmd.level);
EXPECT_EQ(static_cast<GLint>(13), cmd.xoffset);
EXPECT_EQ(static_cast<GLint>(14), cmd.yoffset);
EXPECT_EQ(static_cast<GLint>(15), cmd.zoffset);
EXPECT_EQ(static_cast<GLint>(16), cmd.x);
EXPECT_EQ(static_cast<GLint>(17), cmd.y);
EXPECT_EQ(static_cast<GLsizei>(18), cmd.width);
EXPECT_EQ(static_cast<GLsizei>(19), cmd.height);
CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
}
TEST_F(GLES2FormatTest, CreateProgram) {
cmds::CreateProgram& cmd = *GetBufferAs<cmds::CreateProgram>();
void* next_cmd = cmd.Set(&cmd, static_cast<uint32_t>(11));
EXPECT_EQ(static_cast<uint32_t>(cmds::CreateProgram::kCmdId),
cmd.header.command);
EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
EXPECT_EQ(static_cast<uint32_t>(11), cmd.client_id);
CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
}
TEST_F(GLES2FormatTest, CreateShader) {
cmds::CreateShader& cmd = *GetBufferAs<cmds::CreateShader>();
void* next_cmd =
cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<uint32_t>(12));
EXPECT_EQ(static_cast<uint32_t>(cmds::CreateShader::kCmdId),
cmd.header.command);
EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
EXPECT_EQ(static_cast<GLenum>(11), cmd.type);
EXPECT_EQ(static_cast<uint32_t>(12), cmd.client_id);
CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
}
TEST_F(GLES2FormatTest, CullFace) {
cmds::CullFace& cmd = *GetBufferAs<cmds::CullFace>();
void* next_cmd = cmd.Set(&cmd, static_cast<GLenum>(11));
EXPECT_EQ(static_cast<uint32_t>(cmds::CullFace::kCmdId), cmd.header.command);
EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
EXPECT_EQ(static_cast<GLenum>(11), cmd.mode);
CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
}
TEST_F(GLES2FormatTest, DeleteBuffersImmediate) {
static GLuint ids[] = {
12,
23,
34,
};
cmds::DeleteBuffersImmediate& cmd =
*GetBufferAs<cmds::DeleteBuffersImmediate>();
void* next_cmd = cmd.Set(&cmd, static_cast<GLsizei>(base::size(ids)), ids);
EXPECT_EQ(static_cast<uint32_t>(cmds::DeleteBuffersImmediate::kCmdId),
cmd.header.command);
EXPECT_EQ(sizeof(cmd) + RoundSizeToMultipleOfEntries(cmd.n * 4u),
cmd.header.size * 4u);
EXPECT_EQ(static_cast<GLsizei>(base::size(ids)), cmd.n);
CheckBytesWrittenMatchesExpectedSize(
next_cmd,
sizeof(cmd) + RoundSizeToMultipleOfEntries(base::size(ids) * 4u));
EXPECT_EQ(0, memcmp(ids, ImmediateDataAddress(&cmd), sizeof(ids)));
}
TEST_F(GLES2FormatTest, DeleteFramebuffersImmediate) {
static GLuint ids[] = {
12,
23,
34,
};
cmds::DeleteFramebuffersImmediate& cmd =
*GetBufferAs<cmds::DeleteFramebuffersImmediate>();
void* next_cmd = cmd.Set(&cmd, static_cast<GLsizei>(base::size(ids)), ids);
EXPECT_EQ(static_cast<uint32_t>(cmds::DeleteFramebuffersImmediate::kCmdId),
cmd.header.command);
EXPECT_EQ(sizeof(cmd) + RoundSizeToMultipleOfEntries(cmd.n * 4u),
cmd.header.size * 4u);
EXPECT_EQ(static_cast<GLsizei>(base::size(ids)), cmd.n);
CheckBytesWrittenMatchesExpectedSize(
next_cmd,
sizeof(cmd) + RoundSizeToMultipleOfEntries(base::size(ids) * 4u));
EXPECT_EQ(0, memcmp(ids, ImmediateDataAddress(&cmd), sizeof(ids)));
}
TEST_F(GLES2FormatTest, DeleteProgram) {
cmds::DeleteProgram& cmd = *GetBufferAs<cmds::DeleteProgram>();
void* next_cmd = cmd.Set(&cmd, static_cast<GLuint>(11));
EXPECT_EQ(static_cast<uint32_t>(cmds::DeleteProgram::kCmdId),
cmd.header.command);
EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
EXPECT_EQ(static_cast<GLuint>(11), cmd.program);
CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
}
TEST_F(GLES2FormatTest, DeleteRenderbuffersImmediate) {
static GLuint ids[] = {
12,
23,
34,
};
cmds::DeleteRenderbuffersImmediate& cmd =
*GetBufferAs<cmds::DeleteRenderbuffersImmediate>();
void* next_cmd = cmd.Set(&cmd, static_cast<GLsizei>(base::size(ids)), ids);
EXPECT_EQ(static_cast<uint32_t>(cmds::DeleteRenderbuffersImmediate::kCmdId),
cmd.header.command);
EXPECT_EQ(sizeof(cmd) + RoundSizeToMultipleOfEntries(cmd.n * 4u),
cmd.header.size * 4u);
EXPECT_EQ(static_cast<GLsizei>(base::size(ids)), cmd.n);
CheckBytesWrittenMatchesExpectedSize(
next_cmd,
sizeof(cmd) + RoundSizeToMultipleOfEntries(base::size(ids) * 4u));
EXPECT_EQ(0, memcmp(ids, ImmediateDataAddress(&cmd), sizeof(ids)));
}
TEST_F(GLES2FormatTest, DeleteSamplersImmediate) {
static GLuint ids[] = {
12,
23,
34,
};
cmds::DeleteSamplersImmediate& cmd =
*GetBufferAs<cmds::DeleteSamplersImmediate>();
void* next_cmd = cmd.Set(&cmd, static_cast<GLsizei>(base::size(ids)), ids);
EXPECT_EQ(static_cast<uint32_t>(cmds::DeleteSamplersImmediate::kCmdId),
cmd.header.command);
EXPECT_EQ(sizeof(cmd) + RoundSizeToMultipleOfEntries(cmd.n * 4u),
cmd.header.size * 4u);
EXPECT_EQ(static_cast<GLsizei>(base::size(ids)), cmd.n);
CheckBytesWrittenMatchesExpectedSize(
next_cmd,
sizeof(cmd) + RoundSizeToMultipleOfEntries(base::size(ids) * 4u));
EXPECT_EQ(0, memcmp(ids, ImmediateDataAddress(&cmd), sizeof(ids)));
}
TEST_F(GLES2FormatTest, DeleteSync) {
cmds::DeleteSync& cmd = *GetBufferAs<cmds::DeleteSync>();
void* next_cmd = cmd.Set(&cmd, static_cast<GLuint>(11));
EXPECT_EQ(static_cast<uint32_t>(cmds::DeleteSync::kCmdId),
cmd.header.command);
EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
EXPECT_EQ(static_cast<GLuint>(11), cmd.sync);
CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
}
TEST_F(GLES2FormatTest, DeleteShader) {
cmds::DeleteShader& cmd = *GetBufferAs<cmds::DeleteShader>();
void* next_cmd = cmd.Set(&cmd, static_cast<GLuint>(11));
EXPECT_EQ(static_cast<uint32_t>(cmds::DeleteShader::kCmdId),
cmd.header.command);
EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
EXPECT_EQ(static_cast<GLuint>(11), cmd.shader);
CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
}
TEST_F(GLES2FormatTest, DeleteTexturesImmediate) {
static GLuint ids[] = {
12,
23,
34,
};
cmds::DeleteTexturesImmediate& cmd =
*GetBufferAs<cmds::DeleteTexturesImmediate>();
void* next_cmd = cmd.Set(&cmd, static_cast<GLsizei>(base::size(ids)), ids);
EXPECT_EQ(static_cast<uint32_t>(cmds::DeleteTexturesImmediate::kCmdId),
cmd.header.command);
EXPECT_EQ(sizeof(cmd) + RoundSizeToMultipleOfEntries(cmd.n * 4u),
cmd.header.size * 4u);
EXPECT_EQ(static_cast<GLsizei>(base::size(ids)), cmd.n);
CheckBytesWrittenMatchesExpectedSize(
next_cmd,
sizeof(cmd) + RoundSizeToMultipleOfEntries(base::size(ids) * 4u));
EXPECT_EQ(0, memcmp(ids, ImmediateDataAddress(&cmd), sizeof(ids)));
}
TEST_F(GLES2FormatTest, DeleteTransformFeedbacksImmediate) {
static GLuint ids[] = {
12,
23,
34,
};
cmds::DeleteTransformFeedbacksImmediate& cmd =
*GetBufferAs<cmds::DeleteTransformFeedbacksImmediate>();
void* next_cmd = cmd.Set(&cmd, static_cast<GLsizei>(base::size(ids)), ids);
EXPECT_EQ(
static_cast<uint32_t>(cmds::DeleteTransformFeedbacksImmediate::kCmdId),
cmd.header.command);
EXPECT_EQ(sizeof(cmd) + RoundSizeToMultipleOfEntries(cmd.n * 4u),
cmd.header.size * 4u);
EXPECT_EQ(static_cast<GLsizei>(base::size(ids)), cmd.n);
CheckBytesWrittenMatchesExpectedSize(
next_cmd,
sizeof(cmd) + RoundSizeToMultipleOfEntries(base::size(ids) * 4u));
EXPECT_EQ(0, memcmp(ids, ImmediateDataAddress(&cmd), sizeof(ids)));
}
TEST_F(GLES2FormatTest, DepthFunc) {
cmds::DepthFunc& cmd = *GetBufferAs<cmds::DepthFunc>();
void* next_cmd = cmd.Set(&cmd, static_cast<GLenum>(11));
EXPECT_EQ(static_cast<uint32_t>(cmds::DepthFunc::kCmdId), cmd.header.command);
EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
EXPECT_EQ(static_cast<GLenum>(11), cmd.func);
CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
}
TEST_F(GLES2FormatTest, DepthMask) {
cmds::DepthMask& cmd = *GetBufferAs<cmds::DepthMask>();
void* next_cmd = cmd.Set(&cmd, static_cast<GLboolean>(11));
EXPECT_EQ(static_cast<uint32_t>(cmds::DepthMask::kCmdId), cmd.header.command);
EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
EXPECT_EQ(static_cast<GLboolean>(11), cmd.flag);
CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
}
TEST_F(GLES2FormatTest, DepthRangef) {
cmds::DepthRangef& cmd = *GetBufferAs<cmds::DepthRangef>();
void* next_cmd =
cmd.Set(&cmd, static_cast<GLclampf>(11), static_cast<GLclampf>(12));
EXPECT_EQ(static_cast<uint32_t>(cmds::DepthRangef::kCmdId),
cmd.header.command);
EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
EXPECT_EQ(static_cast<GLclampf>(11), cmd.zNear);
EXPECT_EQ(static_cast<GLclampf>(12), cmd.zFar);
CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
}
TEST_F(GLES2FormatTest, DetachShader) {
cmds::DetachShader& cmd = *GetBufferAs<cmds::DetachShader>();
void* next_cmd =
cmd.Set(&cmd, static_cast<GLuint>(11), static_cast<GLuint>(12));
EXPECT_EQ(static_cast<uint32_t>(cmds::DetachShader::kCmdId),
cmd.header.command);
EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
EXPECT_EQ(static_cast<GLuint>(11), cmd.program);
EXPECT_EQ(static_cast<GLuint>(12), cmd.shader);
CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
}
TEST_F(GLES2FormatTest, Disable) {
cmds::Disable& cmd = *GetBufferAs<cmds::Disable>();
void* next_cmd = cmd.Set(&cmd, static_cast<GLenum>(11));
EXPECT_EQ(static_cast<uint32_t>(cmds::Disable::kCmdId), cmd.header.command);
EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
EXPECT_EQ(static_cast<GLenum>(11), cmd.cap);
CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
}
TEST_F(GLES2FormatTest, DisableVertexAttribArray) {
cmds::DisableVertexAttribArray& cmd =
*GetBufferAs<cmds::DisableVertexAttribArray>();
void* next_cmd = cmd.Set(&cmd, static_cast<GLuint>(11));
EXPECT_EQ(static_cast<uint32_t>(cmds::DisableVertexAttribArray::kCmdId),
cmd.header.command);
EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
EXPECT_EQ(static_cast<GLuint>(11), cmd.index);
CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
}
TEST_F(GLES2FormatTest, DrawArrays) {
cmds::DrawArrays& cmd = *GetBufferAs<cmds::DrawArrays>();
void* next_cmd = cmd.Set(&cmd, static_cast<GLenum>(11),
static_cast<GLint>(12), static_cast<GLsizei>(13));
EXPECT_EQ(static_cast<uint32_t>(cmds::DrawArrays::kCmdId),
cmd.header.command);
EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
EXPECT_EQ(static_cast<GLenum>(11), cmd.mode);
EXPECT_EQ(static_cast<GLint>(12), cmd.first);
EXPECT_EQ(static_cast<GLsizei>(13), cmd.count);
CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
}
TEST_F(GLES2FormatTest, DrawElements) {
cmds::DrawElements& cmd = *GetBufferAs<cmds::DrawElements>();
void* next_cmd =
cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<GLsizei>(12),
static_cast<GLenum>(13), static_cast<GLuint>(14));
EXPECT_EQ(static_cast<uint32_t>(cmds::DrawElements::kCmdId),
cmd.header.command);
EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
EXPECT_EQ(static_cast<GLenum>(11), cmd.mode);
EXPECT_EQ(static_cast<GLsizei>(12), cmd.count);
EXPECT_EQ(static_cast<GLenum>(13), cmd.type);
EXPECT_EQ(static_cast<GLuint>(14), cmd.index_offset);
CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
}
TEST_F(GLES2FormatTest, Enable) {
cmds::Enable& cmd = *GetBufferAs<cmds::Enable>();
void* next_cmd = cmd.Set(&cmd, static_cast<GLenum>(11));
EXPECT_EQ(static_cast<uint32_t>(cmds::Enable::kCmdId), cmd.header.command);
EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
EXPECT_EQ(static_cast<GLenum>(11), cmd.cap);
CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
}
TEST_F(GLES2FormatTest, EnableVertexAttribArray) {
cmds::EnableVertexAttribArray& cmd =
*GetBufferAs<cmds::EnableVertexAttribArray>();
void* next_cmd = cmd.Set(&cmd, static_cast<GLuint>(11));
EXPECT_EQ(static_cast<uint32_t>(cmds::EnableVertexAttribArray::kCmdId),
cmd.header.command);
EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
EXPECT_EQ(static_cast<GLuint>(11), cmd.index);
CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
}
TEST_F(GLES2FormatTest, FenceSync) {
cmds::FenceSync& cmd = *GetBufferAs<cmds::FenceSync>();
void* next_cmd = cmd.Set(&cmd, static_cast<uint32_t>(11));
EXPECT_EQ(static_cast<uint32_t>(cmds::FenceSync::kCmdId), cmd.header.command);
EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
EXPECT_EQ(static_cast<uint32_t>(11), cmd.client_id);
CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
}
TEST_F(GLES2FormatTest, Finish) {
cmds::Finish& cmd = *GetBufferAs<cmds::Finish>();
void* next_cmd = cmd.Set(&cmd);
EXPECT_EQ(static_cast<uint32_t>(cmds::Finish::kCmdId), cmd.header.command);
EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
}
TEST_F(GLES2FormatTest, Flush) {
cmds::Flush& cmd = *GetBufferAs<cmds::Flush>();
void* next_cmd = cmd.Set(&cmd);
EXPECT_EQ(static_cast<uint32_t>(cmds::Flush::kCmdId), cmd.header.command);
EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
}
TEST_F(GLES2FormatTest, FramebufferRenderbuffer) {
cmds::FramebufferRenderbuffer& cmd =
*GetBufferAs<cmds::FramebufferRenderbuffer>();
void* next_cmd =
cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<GLenum>(12),
static_cast<GLenum>(13), static_cast<GLuint>(14));
EXPECT_EQ(static_cast<uint32_t>(cmds::FramebufferRenderbuffer::kCmdId),
cmd.header.command);
EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
EXPECT_EQ(static_cast<GLenum>(12), cmd.attachment);
EXPECT_EQ(static_cast<GLenum>(13), cmd.renderbuffertarget);
EXPECT_EQ(static_cast<GLuint>(14), cmd.renderbuffer);
CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
}
TEST_F(GLES2FormatTest, FramebufferTexture2D) {
cmds::FramebufferTexture2D& cmd = *GetBufferAs<cmds::FramebufferTexture2D>();
void* next_cmd = cmd.Set(&cmd, static_cast<GLenum>(11),
static_cast<GLenum>(12), static_cast<GLenum>(13),
static_cast<GLuint>(14), static_cast<GLint>(15));
EXPECT_EQ(static_cast<uint32_t>(cmds::FramebufferTexture2D::kCmdId),
cmd.header.command);
EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
EXPECT_EQ(static_cast<GLenum>(12), cmd.attachment);
EXPECT_EQ(static_cast<GLenum>(13), cmd.textarget);
EXPECT_EQ(static_cast<GLuint>(14), cmd.texture);
EXPECT_EQ(static_cast<GLint>(15), cmd.level);
CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
}
TEST_F(GLES2FormatTest, FramebufferTextureLayer) {
cmds::FramebufferTextureLayer& cmd =
*GetBufferAs<cmds::FramebufferTextureLayer>();
void* next_cmd = cmd.Set(&cmd, static_cast<GLenum>(11),
static_cast<GLenum>(12), static_cast<GLuint>(13),
static_cast<GLint>(14), static_cast<GLint>(15));
EXPECT_EQ(static_cast<uint32_t>(cmds::FramebufferTextureLayer::kCmdId),
cmd.header.command);
EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
EXPECT_EQ(static_cast<GLenum>(12), cmd.attachment);
EXPECT_EQ(static_cast<GLuint>(13), cmd.texture);
EXPECT_EQ(static_cast<GLint>(14), cmd.level);
EXPECT_EQ(static_cast<GLint>(15), cmd.layer);
CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
}
TEST_F(GLES2FormatTest, FrontFace) {
cmds::FrontFace& cmd = *GetBufferAs<cmds::FrontFace>();
void* next_cmd = cmd.Set(&cmd, static_cast<GLenum>(11));
EXPECT_EQ(static_cast<uint32_t>(cmds::FrontFace::kCmdId), cmd.header.command);
EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
EXPECT_EQ(static_cast<GLenum>(11), cmd.mode);
CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
}
TEST_F(GLES2FormatTest, GenBuffersImmediate) {
static GLuint ids[] = {
12,
23,
34,
};
cmds::GenBuffersImmediate& cmd = *GetBufferAs<cmds::GenBuffersImmediate>();
void* next_cmd = cmd.Set(&cmd, static_cast<GLsizei>(base::size(ids)), ids);
EXPECT_EQ(static_cast<uint32_t>(cmds::GenBuffersImmediate::kCmdId),
cmd.header.command);
EXPECT_EQ(sizeof(cmd) + RoundSizeToMultipleOfEntries(cmd.n * 4u),
cmd.header.size * 4u);
EXPECT_EQ(static_cast<GLsizei>(base::size(ids)), cmd.n);
CheckBytesWrittenMatchesExpectedSize(
next_cmd,
sizeof(cmd) + RoundSizeToMultipleOfEntries(base::size(ids) * 4u));
EXPECT_EQ(0, memcmp(ids, ImmediateDataAddress(&cmd), sizeof(ids)));
}
TEST_F(GLES2FormatTest, GenerateMipmap) {
cmds::GenerateMipmap& cmd = *GetBufferAs<cmds::GenerateMipmap>();
void* next_cmd = cmd.Set(&cmd, static_cast<GLenum>(11));
EXPECT_EQ(static_cast<uint32_t>(cmds::GenerateMipmap::kCmdId),
cmd.header.command);
EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
}
TEST_F(GLES2FormatTest, GenFramebuffersImmediate) {
static GLuint ids[] = {
12,
23,
34,
};
cmds::GenFramebuffersImmediate& cmd =
*GetBufferAs<cmds::GenFramebuffersImmediate>();
void* next_cmd = cmd.Set(&cmd, static_cast<GLsizei>(base::size(ids)), ids);
EXPECT_EQ(static_cast<uint32_t>(cmds::GenFramebuffersImmediate::kCmdId),
cmd.header.command);
EXPECT_EQ(sizeof(cmd) + RoundSizeToMultipleOfEntries(cmd.n * 4u),
cmd.header.size * 4u);
EXPECT_EQ(static_cast<GLsizei>(base::size(ids)), cmd.n);
CheckBytesWrittenMatchesExpectedSize(
next_cmd,
sizeof(cmd) + RoundSizeToMultipleOfEntries(base::size(ids) * 4u));
EXPECT_EQ(0, memcmp(ids, ImmediateDataAddress(&cmd), sizeof(ids)));
}
TEST_F(GLES2FormatTest, GenRenderbuffersImmediate) {
static GLuint ids[] = {
12,
23,
34,
};
cmds::GenRenderbuffersImmediate& cmd =
*GetBufferAs<cmds::GenRenderbuffersImmediate>();
void* next_cmd = cmd.Set(&cmd, static_cast<GLsizei>(base::size(ids)), ids);
EXPECT_EQ(static_cast<uint32_t>(cmds::GenRenderbuffersImmediate::kCmdId),
cmd.header.command);
EXPECT_EQ(sizeof(cmd) + RoundSizeToMultipleOfEntries(cmd.n * 4u),
cmd.header.size * 4u);
EXPECT_EQ(static_cast<GLsizei>(base::size(ids)), cmd.n);
CheckBytesWrittenMatchesExpectedSize(
next_cmd,
sizeof(cmd) + RoundSizeToMultipleOfEntries(base::size(ids) * 4u));
EXPECT_EQ(0, memcmp(ids, ImmediateDataAddress(&cmd), sizeof(ids)));
}
TEST_F(GLES2FormatTest, GenSamplersImmediate) {
static GLuint ids[] = {
12,
23,
34,
};
cmds::GenSamplersImmediate& cmd = *GetBufferAs<cmds::GenSamplersImmediate>();
void* next_cmd = cmd.Set(&cmd, static_cast<GLsizei>(base::size(ids)), ids);
EXPECT_EQ(static_cast<uint32_t>(cmds::GenSamplersImmediate::kCmdId),
cmd.header.command);
EXPECT_EQ(sizeof(cmd) + RoundSizeToMultipleOfEntries(cmd.n * 4u),
cmd.header.size * 4u);
EXPECT_EQ(static_cast<GLsizei>(base::size(ids)), cmd.n);
CheckBytesWrittenMatchesExpectedSize(
next_cmd,
sizeof(cmd) + RoundSizeToMultipleOfEntries(base::size(ids) * 4u));
EXPECT_EQ(0, memcmp(ids, ImmediateDataAddress(&cmd), sizeof(ids)));
}
TEST_F(GLES2FormatTest, GenTexturesImmediate) {
static GLuint ids[] = {
12,
23,
34,
};
cmds::GenTexturesImmediate& cmd = *GetBufferAs<cmds::GenTexturesImmediate>();
void* next_cmd = cmd.Set(&cmd, static_cast<GLsizei>(base::size(ids)), ids);
EXPECT_EQ(static_cast<uint32_t>(cmds::GenTexturesImmediate::kCmdId),
cmd.header.command);
EXPECT_EQ(sizeof(cmd) + RoundSizeToMultipleOfEntries(cmd.n * 4u),
cmd.header.size * 4u);
EXPECT_EQ(static_cast<GLsizei>(base::size(ids)), cmd.n);
CheckBytesWrittenMatchesExpectedSize(
next_cmd,
sizeof(cmd) + RoundSizeToMultipleOfEntries(base::size(ids) * 4u));
EXPECT_EQ(0, memcmp(ids, ImmediateDataAddress(&cmd), sizeof(ids)));
}
TEST_F(GLES2FormatTest, GenTransformFeedbacksImmediate) {
static GLuint ids[] = {
12,
23,
34,
};
cmds::GenTransformFeedbacksImmediate& cmd =
*GetBufferAs<cmds::GenTransformFeedbacksImmediate>();
void* next_cmd = cmd.Set(&cmd, static_cast<GLsizei>(base::size(ids)), ids);
EXPECT_EQ(static_cast<uint32_t>(cmds::GenTransformFeedbacksImmediate::kCmdId),
cmd.header.command);
EXPECT_EQ(sizeof(cmd) + RoundSizeToMultipleOfEntries(cmd.n * 4u),
cmd.header.size * 4u);
EXPECT_EQ(static_cast<GLsizei>(base::size(ids)), cmd.n);
CheckBytesWrittenMatchesExpectedSize(
next_cmd,
sizeof(cmd) + RoundSizeToMultipleOfEntries(base::size(ids) * 4u));
EXPECT_EQ(0, memcmp(ids, ImmediateDataAddress(&cmd), sizeof(ids)));
}
TEST_F(GLES2FormatTest, GetActiveAttrib) {
cmds::GetActiveAttrib& cmd = *GetBufferAs<cmds::GetActiveAttrib>();
void* next_cmd =
cmd.Set(&cmd, static_cast<GLuint>(11), static_cast<GLuint>(12),
static_cast<uint32_t>(13), static_cast<uint32_t>(14),
static_cast<uint32_t>(15));
EXPECT_EQ(static_cast<uint32_t>(cmds::GetActiveAttrib::kCmdId),
cmd.header.command);
EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
EXPECT_EQ(static_cast<GLuint>(11), cmd.program);
EXPECT_EQ(static_cast<GLuint>(12), cmd.index);
EXPECT_EQ(static_cast<uint32_t>(13), cmd.name_bucket_id);
EXPECT_EQ(static_cast<uint32_t>(14), cmd.result_shm_id);
EXPECT_EQ(static_cast<uint32_t>(15), cmd.result_shm_offset);
CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
}
TEST_F(GLES2FormatTest, GetActiveUniform) {
cmds::GetActiveUniform& cmd = *GetBufferAs<cmds::GetActiveUniform>();
void* next_cmd =
cmd.Set(&cmd, static_cast<GLuint>(11), static_cast<GLuint>(12),
static_cast<uint32_t>(13), static_cast<uint32_t>(14),
static_cast<uint32_t>(15));
EXPECT_EQ(static_cast<uint32_t>(cmds::GetActiveUniform::kCmdId),
cmd.header.command);
EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
EXPECT_EQ(static_cast<GLuint>(11), cmd.program);
EXPECT_EQ(static_cast<GLuint>(12), cmd.index);
EXPECT_EQ(static_cast<uint32_t>(13), cmd.name_bucket_id);
EXPECT_EQ(static_cast<uint32_t>(14), cmd.result_shm_id);
EXPECT_EQ(static_cast<uint32_t>(15), cmd.result_shm_offset);
CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
}
TEST_F(GLES2FormatTest, GetActiveUniformBlockiv) {
cmds::GetActiveUniformBlockiv& cmd =
*GetBufferAs<cmds::GetActiveUniformBlockiv>();
void* next_cmd =
cmd.Set(&cmd, static_cast<GLuint>(11), static_cast<GLuint>(12),
static_cast<GLenum>(13), static_cast<uint32_t>(14),
static_cast<uint32_t>(15));
EXPECT_EQ(static_cast<uint32_t>(cmds::GetActiveUniformBlockiv::kCmdId),
cmd.header.command);
EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
EXPECT_EQ(static_cast<GLuint>(11), cmd.program);
EXPECT_EQ(static_cast<GLuint>(12), cmd.index);
EXPECT_EQ(static_cast<GLenum>(13), cmd.pname);
EXPECT_EQ(static_cast<uint32_t>(14), cmd.params_shm_id);
EXPECT_EQ(static_cast<uint32_t>(15), cmd.params_shm_offset);
CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
}
TEST_F(GLES2FormatTest, GetActiveUniformBlockName) {
cmds::GetActiveUniformBlockName& cmd =
*GetBufferAs<cmds::GetActiveUniformBlockName>();
void* next_cmd =
cmd.Set(&cmd, static_cast<GLuint>(11), static_cast<GLuint>(12),
static_cast<uint32_t>(13), static_cast<uint32_t>(14),
static_cast<uint32_t>(15));
EXPECT_EQ(static_cast<uint32_t>(cmds::GetActiveUniformBlockName::kCmdId),
cmd.header.command);
EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
EXPECT_EQ(static_cast<GLuint>(11), cmd.program);
EXPECT_EQ(static_cast<GLuint>(12), cmd.index);
EXPECT_EQ(static_cast<uint32_t>(13), cmd.name_bucket_id);
EXPECT_EQ(static_cast<uint32_t>(14), cmd.result_shm_id);
EXPECT_EQ(static_cast<uint32_t>(15), cmd.result_shm_offset);
CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
}
TEST_F(GLES2FormatTest, GetActiveUniformsiv) {
cmds::GetActiveUniformsiv& cmd = *GetBufferAs<cmds::GetActiveUniformsiv>();
void* next_cmd =
cmd.Set(&cmd, static_cast<GLuint>(11), static_cast<uint32_t>(12),
static_cast<GLenum>(13), static_cast<uint32_t>(14),
static_cast<uint32_t>(15));
EXPECT_EQ(static_cast<uint32_t>(cmds::GetActiveUniformsiv::kCmdId),
cmd.header.command);
EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
EXPECT_EQ(static_cast<GLuint>(11), cmd.program);
EXPECT_EQ(static_cast<uint32_t>(12), cmd.indices_bucket_id);
EXPECT_EQ(static_cast<GLenum>(13), cmd.pname);
EXPECT_EQ(static_cast<uint32_t>(14), cmd.params_shm_id);
EXPECT_EQ(static_cast<uint32_t>(15), cmd.params_shm_offset);
CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
}
TEST_F(GLES2FormatTest, GetAttachedShaders) {
cmds::GetAttachedShaders& cmd = *GetBufferAs<cmds::GetAttachedShaders>();
void* next_cmd =
cmd.Set(&cmd, static_cast<GLuint>(11), static_cast<uint32_t>(12),
static_cast<uint32_t>(13), static_cast<uint32_t>(14));
EXPECT_EQ(static_cast<uint32_t>(cmds::GetAttachedShaders::kCmdId),
cmd.header.command);
EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
EXPECT_EQ(static_cast<GLuint>(11), cmd.program);
EXPECT_EQ(static_cast<uint32_t>(12), cmd.result_shm_id);
EXPECT_EQ(static_cast<uint32_t>(13), cmd.result_shm_offset);
EXPECT_EQ(static_cast<uint32_t>(14), cmd.result_size);
CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
}
TEST_F(GLES2FormatTest, GetAttribLocation) {
cmds::GetAttribLocation& cmd = *GetBufferAs<cmds::GetAttribLocation>();
void* next_cmd =
cmd.Set(&cmd, static_cast<GLuint>(11), static_cast<uint32_t>(12),
static_cast<uint32_t>(13), static_cast<uint32_t>(14));
EXPECT_EQ(static_cast<uint32_t>(cmds::GetAttribLocation::kCmdId),
cmd.header.command);
EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
EXPECT_EQ(static_cast<GLuint>(11), cmd.program);
EXPECT_EQ(static_cast<uint32_t>(12), cmd.name_bucket_id);
EXPECT_EQ(static_cast<uint32_t>(13), cmd.location_shm_id);
EXPECT_EQ(static_cast<uint32_t>(14), cmd.location_shm_offset);
CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
}
TEST_F(GLES2FormatTest, GetBooleanv) {
cmds::GetBooleanv& cmd = *GetBufferAs<cmds::GetBooleanv>();
void* next_cmd =
cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<uint32_t>(12),
static_cast<uint32_t>(13));
EXPECT_EQ(static_cast<uint32_t>(cmds::GetBooleanv::kCmdId),
cmd.header.command);
EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
EXPECT_EQ(static_cast<GLenum>(11), cmd.pname);
EXPECT_EQ(static_cast<uint32_t>(12), cmd.params_shm_id);
EXPECT_EQ(static_cast<uint32_t>(13), cmd.params_shm_offset);
CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
}
TEST_F(GLES2FormatTest, GetBufferParameteri64v) {
cmds::GetBufferParameteri64v& cmd =
*GetBufferAs<cmds::GetBufferParameteri64v>();
void* next_cmd =
cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<GLenum>(12),
static_cast<uint32_t>(13), static_cast<uint32_t>(14));
EXPECT_EQ(static_cast<uint32_t>(cmds::GetBufferParameteri64v::kCmdId),
cmd.header.command);
EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
EXPECT_EQ(static_cast<GLenum>(12), cmd.pname);
EXPECT_EQ(static_cast<uint32_t>(13), cmd.params_shm_id);
EXPECT_EQ(static_cast<uint32_t>(14), cmd.params_shm_offset);
CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
}
TEST_F(GLES2FormatTest, GetBufferParameteriv) {
cmds::GetBufferParameteriv& cmd = *GetBufferAs<cmds::GetBufferParameteriv>();
void* next_cmd =
cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<GLenum>(12),
static_cast<uint32_t>(13), static_cast<uint32_t>(14));
EXPECT_EQ(static_cast<uint32_t>(cmds::GetBufferParameteriv::kCmdId),
cmd.header.command);
EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
EXPECT_EQ(static_cast<GLenum>(12), cmd.pname);
EXPECT_EQ(static_cast<uint32_t>(13), cmd.params_shm_id);
EXPECT_EQ(static_cast<uint32_t>(14), cmd.params_shm_offset);
CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
}
TEST_F(GLES2FormatTest, GetError) {
cmds::GetError& cmd = *GetBufferAs<cmds::GetError>();
void* next_cmd =
cmd.Set(&cmd, static_cast<uint32_t>(11), static_cast<uint32_t>(12));
EXPECT_EQ(static_cast<uint32_t>(cmds::GetError::kCmdId), cmd.header.command);
EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
EXPECT_EQ(static_cast<uint32_t>(11), cmd.result_shm_id);
EXPECT_EQ(static_cast<uint32_t>(12), cmd.result_shm_offset);
CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
}
TEST_F(GLES2FormatTest, GetFloatv) {
cmds::GetFloatv& cmd = *GetBufferAs<cmds::GetFloatv>();
void* next_cmd =
cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<uint32_t>(12),
static_cast<uint32_t>(13));
EXPECT_EQ(static_cast<uint32_t>(cmds::GetFloatv::kCmdId), cmd.header.command);
EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
EXPECT_EQ(static_cast<GLenum>(11), cmd.pname);
EXPECT_EQ(static_cast<uint32_t>(12), cmd.params_shm_id);
EXPECT_EQ(static_cast<uint32_t>(13), cmd.params_shm_offset);
CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
}
TEST_F(GLES2FormatTest, GetFragDataLocation) {
cmds::GetFragDataLocation& cmd = *GetBufferAs<cmds::GetFragDataLocation>();
void* next_cmd =
cmd.Set(&cmd, static_cast<GLuint>(11), static_cast<uint32_t>(12),
static_cast<uint32_t>(13), static_cast<uint32_t>(14));
EXPECT_EQ(static_cast<uint32_t>(cmds::GetFragDataLocation::kCmdId),
cmd.header.command);
EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
EXPECT_EQ(static_cast<GLuint>(11), cmd.program);
EXPECT_EQ(static_cast<uint32_t>(12), cmd.name_bucket_id);
EXPECT_EQ(static_cast<uint32_t>(13), cmd.location_shm_id);
EXPECT_EQ(static_cast<uint32_t>(14), cmd.location_shm_offset);
CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
}
TEST_F(GLES2FormatTest, GetFramebufferAttachmentParameteriv) {
cmds::GetFramebufferAttachmentParameteriv& cmd =
*GetBufferAs<cmds::GetFramebufferAttachmentParameteriv>();
void* next_cmd =
cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<GLenum>(12),
static_cast<GLenum>(13), static_cast<uint32_t>(14),
static_cast<uint32_t>(15));
EXPECT_EQ(
static_cast<uint32_t>(cmds::GetFramebufferAttachmentParameteriv::kCmdId),
cmd.header.command);
EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
EXPECT_EQ(static_cast<GLenum>(12), cmd.attachment);
EXPECT_EQ(static_cast<GLenum>(13), cmd.pname);
EXPECT_EQ(static_cast<uint32_t>(14), cmd.params_shm_id);
EXPECT_EQ(static_cast<uint32_t>(15), cmd.params_shm_offset);
CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
}
TEST_F(GLES2FormatTest, GetInteger64v) {
cmds::GetInteger64v& cmd = *GetBufferAs<cmds::GetInteger64v>();
void* next_cmd =
cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<uint32_t>(12),
static_cast<uint32_t>(13));
EXPECT_EQ(static_cast<uint32_t>(cmds::GetInteger64v::kCmdId),
cmd.header.command);
EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
EXPECT_EQ(static_cast<GLenum>(11), cmd.pname);
EXPECT_EQ(static_cast<uint32_t>(12), cmd.params_shm_id);
EXPECT_EQ(static_cast<uint32_t>(13), cmd.params_shm_offset);
CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
}
TEST_F(GLES2FormatTest, GetIntegeri_v) {
cmds::GetIntegeri_v& cmd = *GetBufferAs<cmds::GetIntegeri_v>();
void* next_cmd =
cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<GLuint>(12),
static_cast<uint32_t>(13), static_cast<uint32_t>(14));
EXPECT_EQ(static_cast<uint32_t>(cmds::GetIntegeri_v::kCmdId),
cmd.header.command);
EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
EXPECT_EQ(static_cast<GLenum>(11), cmd.pname);
EXPECT_EQ(static_cast<GLuint>(12), cmd.index);
EXPECT_EQ(static_cast<uint32_t>(13), cmd.data_shm_id);
EXPECT_EQ(static_cast<uint32_t>(14), cmd.data_shm_offset);
CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
}
TEST_F(GLES2FormatTest, GetInteger64i_v) {
cmds::GetInteger64i_v& cmd = *GetBufferAs<cmds::GetInteger64i_v>();
void* next_cmd =
cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<GLuint>(12),
static_cast<uint32_t>(13), static_cast<uint32_t>(14));
EXPECT_EQ(static_cast<uint32_t>(cmds::GetInteger64i_v::kCmdId),
cmd.header.command);
EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
EXPECT_EQ(static_cast<GLenum>(11), cmd.pname);
EXPECT_EQ(static_cast<GLuint>(12), cmd.index);
EXPECT_EQ(static_cast<uint32_t>(13), cmd.data_shm_id);
EXPECT_EQ(static_cast<uint32_t>(14), cmd.data_shm_offset);
CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
}
TEST_F(GLES2FormatTest, GetIntegerv) {
cmds::GetIntegerv& cmd = *GetBufferAs<cmds::GetIntegerv>();
void* next_cmd =
cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<uint32_t>(12),
static_cast<uint32_t>(13));
EXPECT_EQ(static_cast<uint32_t>(cmds::GetIntegerv::kCmdId),
cmd.header.command);
EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
EXPECT_EQ(static_cast<GLenum>(11), cmd.pname);
EXPECT_EQ(static_cast<uint32_t>(12), cmd.params_shm_id);
EXPECT_EQ(static_cast<uint32_t>(13), cmd.params_shm_offset);
CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
}
TEST_F(GLES2FormatTest, GetInternalformativ) {
cmds::GetInternalformativ& cmd = *GetBufferAs<cmds::GetInternalformativ>();
void* next_cmd =
cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<GLenum>(12),
static_cast<GLenum>(13), static_cast<uint32_t>(14),
static_cast<uint32_t>(15));
EXPECT_EQ(static_cast<uint32_t>(cmds::GetInternalformativ::kCmdId),
cmd.header.command);
EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
EXPECT_EQ(static_cast<GLenum>(12), cmd.format);
EXPECT_EQ(static_cast<GLenum>(13), cmd.pname);
EXPECT_EQ(static_cast<uint32_t>(14), cmd.params_shm_id);
EXPECT_EQ(static_cast<uint32_t>(15), cmd.params_shm_offset);
CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
}
TEST_F(GLES2FormatTest, GetProgramiv) {
cmds::GetProgramiv& cmd = *GetBufferAs<cmds::GetProgramiv>();
void* next_cmd =
cmd.Set(&cmd, static_cast<GLuint>(11), static_cast<GLenum>(12),
static_cast<uint32_t>(13), static_cast<uint32_t>(14));
EXPECT_EQ(static_cast<uint32_t>(cmds::GetProgramiv::kCmdId),
cmd.header.command);
EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
EXPECT_EQ(static_cast<GLuint>(11), cmd.program);
EXPECT_EQ(static_cast<GLenum>(12), cmd.pname);
EXPECT_EQ(static_cast<uint32_t>(13), cmd.params_shm_id);
EXPECT_EQ(static_cast<uint32_t>(14), cmd.params_shm_offset);
CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
}
TEST_F(GLES2FormatTest, GetProgramInfoLog) {
cmds::GetProgramInfoLog& cmd = *GetBufferAs<cmds::GetProgramInfoLog>();
void* next_cmd =
cmd.Set(&cmd, static_cast<GLuint>(11), static_cast<uint32_t>(12));
EXPECT_EQ(static_cast<uint32_t>(cmds::GetProgramInfoLog::kCmdId),
cmd.header.command);
EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
EXPECT_EQ(static_cast<GLuint>(11), cmd.program);
EXPECT_EQ(static_cast<uint32_t>(12), cmd.bucket_id);
CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
}
TEST_F(GLES2FormatTest, GetRenderbufferParameteriv) {
cmds::GetRenderbufferParameteriv& cmd =
*GetBufferAs<cmds::GetRenderbufferParameteriv>();
void* next_cmd =
cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<GLenum>(12),
static_cast<uint32_t>(13), static_cast<uint32_t>(14));
EXPECT_EQ(static_cast<uint32_t>(cmds::GetRenderbufferParameteriv::kCmdId),
cmd.header.command);
EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
EXPECT_EQ(static_cast<GLenum>(12), cmd.pname);
EXPECT_EQ(static_cast<uint32_t>(13), cmd.params_shm_id);
EXPECT_EQ(static_cast<uint32_t>(14), cmd.params_shm_offset);
CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
}
TEST_F(GLES2FormatTest, GetSamplerParameterfv) {
cmds::GetSamplerParameterfv& cmd =
*GetBufferAs<cmds::GetSamplerParameterfv>();
void* next_cmd =
cmd.Set(&cmd, static_cast<GLuint>(11), static_cast<GLenum>(12),
static_cast<uint32_t>(13), static_cast<uint32_t>(14));
EXPECT_EQ(static_cast<uint32_t>(cmds::GetSamplerParameterfv::kCmdId),
cmd.header.command);
EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
EXPECT_EQ(static_cast<GLuint>(11), cmd.sampler);
EXPECT_EQ(static_cast<GLenum>(12), cmd.pname);
EXPECT_EQ(static_cast<uint32_t>(13), cmd.params_shm_id);
EXPECT_EQ(static_cast<uint32_t>(14), cmd.params_shm_offset);
CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
}
TEST_F(GLES2FormatTest, GetSamplerParameteriv) {
cmds::GetSamplerParameteriv& cmd =
*GetBufferAs<cmds::GetSamplerParameteriv>();
void* next_cmd =
cmd.Set(&cmd, static_cast<GLuint>(11), static_cast<GLenum>(12),
static_cast<uint32_t>(13), static_cast<uint32_t>(14));
EXPECT_EQ(static_cast<uint32_t>(cmds::GetSamplerParameteriv::kCmdId),
cmd.header.command);
EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
EXPECT_EQ(static_cast<GLuint>(11), cmd.sampler);
EXPECT_EQ(static_cast<GLenum>(12), cmd.pname);
EXPECT_EQ(static_cast<uint32_t>(13), cmd.params_shm_id);
EXPECT_EQ(static_cast<uint32_t>(14), cmd.params_shm_offset);
CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
}
TEST_F(GLES2FormatTest, GetShaderiv) {
cmds::GetShaderiv& cmd = *GetBufferAs<cmds::GetShaderiv>();
void* next_cmd =
cmd.Set(&cmd, static_cast<GLuint>(11), static_cast<GLenum>(12),
static_cast<uint32_t>(13), static_cast<uint32_t>(14));
EXPECT_EQ(static_cast<uint32_t>(cmds::GetShaderiv::kCmdId),
cmd.header.command);
EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
EXPECT_EQ(static_cast<GLuint>(11), cmd.shader);
EXPECT_EQ(static_cast<GLenum>(12), cmd.pname);
EXPECT_EQ(static_cast<uint32_t>(13), cmd.params_shm_id);
EXPECT_EQ(static_cast<uint32_t>(14), cmd.params_shm_offset);
CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
}
TEST_F(GLES2FormatTest, GetShaderInfoLog) {
cmds::GetShaderInfoLog& cmd = *GetBufferAs<cmds::GetShaderInfoLog>();
void* next_cmd =
cmd.Set(&cmd, static_cast<GLuint>(11), static_cast<uint32_t>(12));
EXPECT_EQ(static_cast<uint32_t>(cmds::GetShaderInfoLog::kCmdId),
cmd.header.command);
EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
EXPECT_EQ(static_cast<GLuint>(11), cmd.shader);
EXPECT_EQ(static_cast<uint32_t>(12), cmd.bucket_id);
CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
}
TEST_F(GLES2FormatTest, GetShaderPrecisionFormat) {
cmds::GetShaderPrecisionFormat& cmd =
*GetBufferAs<cmds::GetShaderPrecisionFormat>();
void* next_cmd =
cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<GLenum>(12),
static_cast<uint32_t>(13), static_cast<uint32_t>(14));
EXPECT_EQ(static_cast<uint32_t>(cmds::GetShaderPrecisionFormat::kCmdId),
cmd.header.command);
EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
EXPECT_EQ(static_cast<GLenum>(11), cmd.shadertype);
EXPECT_EQ(static_cast<GLenum>(12), cmd.precisiontype);
EXPECT_EQ(static_cast<uint32_t>(13), cmd.result_shm_id);
EXPECT_EQ(static_cast<uint32_t>(14), cmd.result_shm_offset);
CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
}
TEST_F(GLES2FormatTest, GetShaderSource) {
cmds::GetShaderSource& cmd = *GetBufferAs<cmds::GetShaderSource>();
void* next_cmd =
cmd.Set(&cmd, static_cast<GLuint>(11), static_cast<uint32_t>(12));
EXPECT_EQ(static_cast<uint32_t>(cmds::GetShaderSource::kCmdId),
cmd.header.command);
EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
EXPECT_EQ(static_cast<GLuint>(11), cmd.shader);
EXPECT_EQ(static_cast<uint32_t>(12), cmd.bucket_id);
CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
}
TEST_F(GLES2FormatTest, GetString) {
cmds::GetString& cmd = *GetBufferAs<cmds::GetString>();
void* next_cmd =
cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<uint32_t>(12));
EXPECT_EQ(static_cast<uint32_t>(cmds::GetString::kCmdId), cmd.header.command);
EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
EXPECT_EQ(static_cast<GLenum>(11), cmd.name);
EXPECT_EQ(static_cast<uint32_t>(12), cmd.bucket_id);
CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
}
TEST_F(GLES2FormatTest, GetSynciv) {
cmds::GetSynciv& cmd = *GetBufferAs<cmds::GetSynciv>();
void* next_cmd =
cmd.Set(&cmd, static_cast<GLuint>(11), static_cast<GLenum>(12),
static_cast<uint32_t>(13), static_cast<uint32_t>(14));
EXPECT_EQ(static_cast<uint32_t>(cmds::GetSynciv::kCmdId), cmd.header.command);
EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
EXPECT_EQ(static_cast<GLuint>(11), cmd.sync);
EXPECT_EQ(static_cast<GLenum>(12), cmd.pname);
EXPECT_EQ(static_cast<uint32_t>(13), cmd.values_shm_id);
EXPECT_EQ(static_cast<uint32_t>(14), cmd.values_shm_offset);
CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
}
TEST_F(GLES2FormatTest, GetTexParameterfv) {
cmds::GetTexParameterfv& cmd = *GetBufferAs<cmds::GetTexParameterfv>();
void* next_cmd =
cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<GLenum>(12),
static_cast<uint32_t>(13), static_cast<uint32_t>(14));
EXPECT_EQ(static_cast<uint32_t>(cmds::GetTexParameterfv::kCmdId),
cmd.header.command);
EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
EXPECT_EQ(static_cast<GLenum>(12), cmd.pname);
EXPECT_EQ(static_cast<uint32_t>(13), cmd.params_shm_id);
EXPECT_EQ(static_cast<uint32_t>(14), cmd.params_shm_offset);
CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
}
TEST_F(GLES2FormatTest, GetTexParameteriv) {
cmds::GetTexParameteriv& cmd = *GetBufferAs<cmds::GetTexParameteriv>();
void* next_cmd =
cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<GLenum>(12),
static_cast<uint32_t>(13), static_cast<uint32_t>(14));
EXPECT_EQ(static_cast<uint32_t>(cmds::GetTexParameteriv::kCmdId),
cmd.header.command);
EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
EXPECT_EQ(static_cast<GLenum>(12), cmd.pname);
EXPECT_EQ(static_cast<uint32_t>(13), cmd.params_shm_id);
EXPECT_EQ(static_cast<uint32_t>(14), cmd.params_shm_offset);
CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
}
TEST_F(GLES2FormatTest, GetTransformFeedbackVarying) {
cmds::GetTransformFeedbackVarying& cmd =
*GetBufferAs<cmds::GetTransformFeedbackVarying>();
void* next_cmd =
cmd.Set(&cmd, static_cast<GLuint>(11), static_cast<GLuint>(12),
static_cast<uint32_t>(13), static_cast<uint32_t>(14),
static_cast<uint32_t>(15));
EXPECT_EQ(static_cast<uint32_t>(cmds::GetTransformFeedbackVarying::kCmdId),
cmd.header.command);
EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
EXPECT_EQ(static_cast<GLuint>(11), cmd.program);
EXPECT_EQ(static_cast<GLuint>(12), cmd.index);
EXPECT_EQ(static_cast<uint32_t>(13), cmd.name_bucket_id);
EXPECT_EQ(static_cast<uint32_t>(14), cmd.result_shm_id);
EXPECT_EQ(static_cast<uint32_t>(15), cmd.result_shm_offset);
CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
}
TEST_F(GLES2FormatTest, GetUniformBlockIndex) {
cmds::GetUniformBlockIndex& cmd = *GetBufferAs<cmds::GetUniformBlockIndex>();
void* next_cmd =
cmd.Set(&cmd, static_cast<GLuint>(11), static_cast<uint32_t>(12),
static_cast<uint32_t>(13), static_cast<uint32_t>(14));
EXPECT_EQ(static_cast<uint32_t>(cmds::GetUniformBlockIndex::kCmdId),
cmd.header.command);
EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
EXPECT_EQ(static_cast<GLuint>(11), cmd.program);
EXPECT_EQ(static_cast<uint32_t>(12), cmd.name_bucket_id);
EXPECT_EQ(static_cast<uint32_t>(13), cmd.index_shm_id);
EXPECT_EQ(static_cast<uint32_t>(14), cmd.index_shm_offset);
CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
}
TEST_F(GLES2FormatTest, GetUniformfv) {
cmds::GetUniformfv& cmd = *GetBufferAs<cmds::GetUniformfv>();
void* next_cmd =
cmd.Set(&cmd, static_cast<GLuint>(11), static_cast<GLint>(12),
static_cast<uint32_t>(13), static_cast<uint32_t>(14));
EXPECT_EQ(static_cast<uint32_t>(cmds::GetUniformfv::kCmdId),
cmd.header.command);
EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
EXPECT_EQ(static_cast<GLuint>(11), cmd.program);
EXPECT_EQ(static_cast<GLint>(12), cmd.location);
EXPECT_EQ(static_cast<uint32_t>(13), cmd.params_shm_id);
EXPECT_EQ(static_cast<uint32_t>(14), cmd.params_shm_offset);
CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
}
TEST_F(GLES2FormatTest, GetUniformiv) {
cmds::GetUniformiv& cmd = *GetBufferAs<cmds::GetUniformiv>();
void* next_cmd =
cmd.Set(&cmd, static_cast<GLuint>(11), static_cast<GLint>(12),
static_cast<uint32_t>(13), static_cast<uint32_t>(14));
EXPECT_EQ(static_cast<uint32_t>(cmds::GetUniformiv::kCmdId),
cmd.header.command);
EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
EXPECT_EQ(static_cast<GLuint>(11), cmd.program);
EXPECT_EQ(static_cast<GLint>(12), cmd.location);
EXPECT_EQ(static_cast<uint32_t>(13), cmd.params_shm_id);
EXPECT_EQ(static_cast<uint32_t>(14), cmd.params_shm_offset);
CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
}
TEST_F(GLES2FormatTest, GetUniformuiv) {
cmds::GetUniformuiv& cmd = *GetBufferAs<cmds::GetUniformuiv>();
void* next_cmd =
cmd.Set(&cmd, static_cast<GLuint>(11), static_cast<GLint>(12),
static_cast<uint32_t>(13), static_cast<uint32_t>(14));
EXPECT_EQ(static_cast<uint32_t>(cmds::GetUniformuiv::kCmdId),
cmd.header.command);
EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
EXPECT_EQ(static_cast<GLuint>(11), cmd.program);
EXPECT_EQ(static_cast<GLint>(12), cmd.location);
EXPECT_EQ(static_cast<uint32_t>(13), cmd.params_shm_id);
EXPECT_EQ(static_cast<uint32_t>(14), cmd.params_shm_offset);
CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
}
TEST_F(GLES2FormatTest, GetUniformIndices) {
cmds::GetUniformIndices& cmd = *GetBufferAs<cmds::GetUniformIndices>();
void* next_cmd =
cmd.Set(&cmd, static_cast<GLuint>(11), static_cast<uint32_t>(12),
static_cast<uint32_t>(13), static_cast<uint32_t>(14));
EXPECT_EQ(static_cast<uint32_t>(cmds::GetUniformIndices::kCmdId),
cmd.header.command);
EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
EXPECT_EQ(static_cast<GLuint>(11), cmd.program);
EXPECT_EQ(static_cast<uint32_t>(12), cmd.names_bucket_id);
EXPECT_EQ(static_cast<uint32_t>(13), cmd.indices_shm_id);
EXPECT_EQ(static_cast<uint32_t>(14), cmd.indices_shm_offset);
CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
}
TEST_F(GLES2FormatTest, GetUniformLocation) {
cmds::GetUniformLocation& cmd = *GetBufferAs<cmds::GetUniformLocation>();
void* next_cmd =
cmd.Set(&cmd, static_cast<GLuint>(11), static_cast<uint32_t>(12),
static_cast<uint32_t>(13), static_cast<uint32_t>(14));
EXPECT_EQ(static_cast<uint32_t>(cmds::GetUniformLocation::kCmdId),
cmd.header.command);
EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
EXPECT_EQ(static_cast<GLuint>(11), cmd.program);
EXPECT_EQ(static_cast<uint32_t>(12), cmd.name_bucket_id);
EXPECT_EQ(static_cast<uint32_t>(13), cmd.location_shm_id);
EXPECT_EQ(static_cast<uint32_t>(14), cmd.location_shm_offset);
CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
}
TEST_F(GLES2FormatTest, GetVertexAttribfv) {
cmds::GetVertexAttribfv& cmd = *GetBufferAs<cmds::GetVertexAttribfv>();
void* next_cmd =
cmd.Set(&cmd, static_cast<GLuint>(11), static_cast<GLenum>(12),
static_cast<uint32_t>(13), static_cast<uint32_t>(14));
EXPECT_EQ(static_cast<uint32_t>(cmds::GetVertexAttribfv::kCmdId),
cmd.header.command);
EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
EXPECT_EQ(static_cast<GLuint>(11), cmd.index);
EXPECT_EQ(static_cast<GLenum>(12), cmd.pname);
EXPECT_EQ(static_cast<uint32_t>(13), cmd.params_shm_id);
EXPECT_EQ(static_cast<uint32_t>(14), cmd.params_shm_offset);
CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
}
TEST_F(GLES2FormatTest, GetVertexAttribiv) {
cmds::GetVertexAttribiv& cmd = *GetBufferAs<cmds::GetVertexAttribiv>();
void* next_cmd =
cmd.Set(&cmd, static_cast<GLuint>(11), static_cast<GLenum>(12),
static_cast<uint32_t>(13), static_cast<uint32_t>(14));
EXPECT_EQ(static_cast<uint32_t>(cmds::GetVertexAttribiv::kCmdId),
cmd.header.command);
EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
EXPECT_EQ(static_cast<GLuint>(11), cmd.index);
EXPECT_EQ(static_cast<GLenum>(12), cmd.pname);
EXPECT_EQ(static_cast<uint32_t>(13), cmd.params_shm_id);
EXPECT_EQ(static_cast<uint32_t>(14), cmd.params_shm_offset);
CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
}
TEST_F(GLES2FormatTest, GetVertexAttribIiv) {
cmds::GetVertexAttribIiv& cmd = *GetBufferAs<cmds::GetVertexAttribIiv>();
void* next_cmd =
cmd.Set(&cmd, static_cast<GLuint>(11), static_cast<GLenum>(12),
static_cast<uint32_t>(13), static_cast<uint32_t>(14));
EXPECT_EQ(static_cast<uint32_t>(cmds::GetVertexAttribIiv::kCmdId),
cmd.header.command);
EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
EXPECT_EQ(static_cast<GLuint>(11), cmd.index);
EXPECT_EQ(static_cast<GLenum>(12), cmd.pname);
EXPECT_EQ(static_cast<uint32_t>(13), cmd.params_shm_id);
EXPECT_EQ(static_cast<uint32_t>(14), cmd.params_shm_offset);
CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
}
TEST_F(GLES2FormatTest, GetVertexAttribIuiv) {
cmds::GetVertexAttribIuiv& cmd = *GetBufferAs<cmds::GetVertexAttribIuiv>();
void* next_cmd =
cmd.Set(&cmd, static_cast<GLuint>(11), static_cast<GLenum>(12),
static_cast<uint32_t>(13), static_cast<uint32_t>(14));
EXPECT_EQ(static_cast<uint32_t>(cmds::GetVertexAttribIuiv::kCmdId),
cmd.header.command);
EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
EXPECT_EQ(static_cast<GLuint>(11), cmd.index);
EXPECT_EQ(static_cast<GLenum>(12), cmd.pname);
EXPECT_EQ(static_cast<uint32_t>(13), cmd.params_shm_id);
EXPECT_EQ(static_cast<uint32_t>(14), cmd.params_shm_offset);
CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
}
TEST_F(GLES2FormatTest, GetVertexAttribPointerv) {
cmds::GetVertexAttribPointerv& cmd =
*GetBufferAs<cmds::GetVertexAttribPointerv>();
void* next_cmd =
cmd.Set(&cmd, static_cast<GLuint>(11), static_cast<GLenum>(12),
static_cast<uint32_t>(13), static_cast<uint32_t>(14));
EXPECT_EQ(static_cast<uint32_t>(cmds::GetVertexAttribPointerv::kCmdId),
cmd.header.command);
EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
EXPECT_EQ(static_cast<GLuint>(11), cmd.index);
EXPECT_EQ(static_cast<GLenum>(12), cmd.pname);
EXPECT_EQ(static_cast<uint32_t>(13), cmd.pointer_shm_id);
EXPECT_EQ(static_cast<uint32_t>(14), cmd.pointer_shm_offset);
CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
}
TEST_F(GLES2FormatTest, Hint) {
cmds::Hint& cmd = *GetBufferAs<cmds::Hint>();
void* next_cmd =
cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<GLenum>(12));
EXPECT_EQ(static_cast<uint32_t>(cmds::Hint::kCmdId), cmd.header.command);
EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
EXPECT_EQ(static_cast<GLenum>(11), cmd.target);
EXPECT_EQ(static_cast<GLenum>(12), cmd.mode);
CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
}
TEST_F(GLES2FormatTest, InvalidateFramebufferImmediate) {
const int kSomeBaseValueToTestWith = 51;
static GLenum data[] = {
static_cast<GLenum>(kSomeBaseValueToTestWith + 0),
static_cast<GLenum>(kSomeBaseValueToTestWith + 1),
};
cmds::InvalidateFramebufferImmediate& cmd =
*GetBufferAs<cmds::InvalidateFramebufferImmediate>();
const GLsizei kNumElements = 2;
const size_t kExpectedCmdSize =
sizeof(cmd) + kNumElements * sizeof(GLenum) * 1;
void* next_cmd =
cmd.Set(&cmd, static_cast<GLenum>(1), static_cast<GLsizei>(2), data);
EXPECT_EQ(static_cast<uint32_t>(cmds::InvalidateFramebufferImmediate::kCmdId),
cmd.header.command);
EXPECT_EQ(kExpectedCmdSize, cmd.header.size * 4u);
EXPECT_EQ(static_cast<GLenum>(1), cmd.target);
EXPECT_EQ(static_cast<GLsizei>(2), cmd.count);
CheckBytesWrittenMatchesExpectedSize(
next_cmd, sizeof(cmd) + RoundSizeToMultipleOfEntries(sizeof(data)));
}
TEST_F(GLES2FormatTest, InvalidateSubFramebufferImmediate) {
const int kSomeBaseValueToTestWith = 51;
static GLenum data[] = {
static_cast<GLenum>(kSomeBaseValueToTestWith + 0),
static_cast<GLenum>(kSomeBaseValueToTestWith + 1),
};
cmds::InvalidateSubFramebufferImmediate& cmd =
*GetBufferAs<cmds::InvalidateSubFramebufferImmediate>();
const GLsizei kNumElements = 2;
const size_t kExpectedCmdSize =
sizeof(cmd) + kNumElements * sizeof(GLenum) * 1;
void* next_cmd =
cmd.Set(&cmd, static_cast<GLenum>(1), static_cast<GLsizei>(2), data,
static_cast<GLint>(4), static_cast<GLint>(5),
static_cast<GLsizei>(6), static_cast<GLsizei>(7));
EXPECT_EQ(
static_cast<uint32_t>(cmds::InvalidateSubFramebufferImmediate::kCmdId),
cmd.header.command);
EXPECT_EQ(kExpectedCmdSize, cmd.header.size * 4u);
EXPECT_EQ(static_cast<GLenum>(1), cmd.target);
EXPECT_EQ(static_cast<GLsizei>(2), cmd.count);
EXPECT_EQ(static_cast<GLint>(4), cmd.x);
EXPECT_EQ(static_cast<GLint>(5), cmd.y);
EXPECT_EQ(static_cast<GLsizei>(6), cmd.width);
EXPECT_EQ(static_cast<GLsizei>(7), cmd.height);
CheckBytesWrittenMatchesExpectedSize(
next_cmd, sizeof(cmd) + RoundSizeToMultipleOfEntries(sizeof(data)));
}
TEST_F(GLES2FormatTest, IsBuffer) {
cmds::IsBuffer& cmd = *GetBufferAs<cmds::IsBuffer>();
void* next_cmd =
cmd.Set(&cmd, static_cast<GLuint>(11), static_cast<uint32_t>(12),
static_cast<uint32_t>(13));
EXPECT_EQ(static_cast<uint32_t>(cmds::IsBuffer::kCmdId), cmd.header.command);
EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
EXPECT_EQ(static_cast<GLuint>(11), cmd.buffer);
EXPECT_EQ(static_cast<uint32_t>(12), cmd.result_shm_id);
EXPECT_EQ(static_cast<uint32_t>(13), cmd.result_shm_offset);
CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
}
TEST_F(GLES2FormatTest, IsEnabled) {
cmds::IsEnabled& cmd = *GetBufferAs<cmds::IsEnabled>();
void* next_cmd =
cmd.Set(&cmd, static_cast<GLenum>(11), static_cast<uint32_t>(12),
static_cast<uint32_t>(13));
EXPECT_EQ(static_cast<uint32_t>(cmds::IsEnabled::kCmdId), cmd.header.command);
EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
EXPECT_EQ(static_cast<GLenum>(11), cmd.cap);
EXPECT_EQ(static_cast<uint32_t>(12), cmd.result_shm_id);
EXPECT_EQ(static_cast<uint32_t>(13), cmd.result_shm_offset);
CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
}
TEST_F(GLES2FormatTest, IsFramebuffer) {
cmds::IsFramebuffer& cmd = *GetBufferAs<cmds::IsFramebuffer>();
void* next_cmd =
cmd.Set(&cmd, static_cast<GLuint>(11), static_cast<uint32_t>(12),
static_cast<uint32_t>(13));
EXPECT_EQ(static_cast<uint32_t>(cmds::IsFramebuffer::kCmdId),
cmd.header.command);
EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
EXPECT_EQ(static_cast<GLuint>(11), cmd.framebuffer);
EXPECT_EQ(static_cast<uint32_t>(12), cmd.result_shm_id);
EXPECT_EQ(static_cast<uint32_t>(13), cmd.result_shm_offset);
CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
}
TEST_F(GLES2FormatTest, IsProgram) {
cmds::IsProgram& cmd = *GetBufferAs<cmds::IsProgram>();
void* next_cmd =
cmd.Set(&cmd, static_cast<GLuint>(11), static_cast<uint32_t>(12),
static_cast<uint32_t>(13));
EXPECT_EQ(static_cast<uint32_t>(cmds::IsProgram::kCmdId), cmd.header.command);
EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
EXPECT_EQ(static_cast<GLuint>(11), cmd.program);
EXPECT_EQ(static_cast<uint32_t>(12), cmd.result_shm_id);
EXPECT_EQ(static_cast<uint32_t>(13), cmd.result_shm_offset);
CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
}
TEST_F(GLES2FormatTest, IsRenderbuffer) {
cmds::IsRenderbuffer& cmd = *GetBufferAs<cmds::IsRenderbuffer>();
void* next_cmd =
cmd.Set(&cmd, static_cast<GLuint>(11), static_cast<uint32_t>(12),
static_cast<uint32_t>(13));
EXPECT_EQ(static_cast<uint32_t>(cmds::IsRenderbuffer::kCmdId),
cmd.header.command);
EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
EXPECT_EQ(static_cast<GLuint>(11), cmd.renderbuffer);
EXPECT_EQ(static_cast<uint32_t>(12), cmd.result_shm_id);
EXPECT_EQ(static_cast<uint32_t>(13), cmd.result_shm_offset);
CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
}
TEST_F(GLES2FormatTest, IsSampler) {
cmds::IsSampler& cmd = *GetBufferAs<cmds::IsSampler>();
void* next_cmd =
cmd.Set(&cmd, static_cast<GLuint>(11), static_cast<uint32_t>(12),
static_cast<uint32_t>(13));
EXPECT_EQ(static_cast<uint32_t>(cmds::IsSampler::kCmdId), cmd.header.command);
EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
EXPECT_EQ(static_cast<GLuint>(11), cmd.sampler);
EXPECT_EQ(static_cast<uint32_t>(12), cmd.result_shm_id);
EXPECT_EQ(static_cast<uint32_t>(13), cmd.result_shm_offset);
CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
}
TEST_F(GLES2FormatTest, IsShader) {
cmds::IsShader& cmd = *GetBufferAs<cmds::IsShader>();
void* next_cmd =
cmd.Set(&cmd, static_cast<GLuint>(11), static_cast<uint32_t>(12),
static_cast<uint32_t>(13));
EXPECT_EQ(static_cast<uint32_t>(cmds::IsShader::kCmdId), cmd.header.command);
EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
EXPECT_EQ(static_cast<GLuint>(11), cmd.shader);
EXPECT_EQ(static_cast<uint32_t>(12), cmd.result_shm_id);
EXPECT_EQ(static_cast<uint32_t>(13), cmd.result_shm_offset);
CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
}
TEST_F(GLES2FormatTest, IsSync) {
cmds::IsSync& cmd = *GetBufferAs<cmds::IsSync>();
void* next_cmd =
cmd.Set(&cmd, static_cast<GLuint>(11), static_cast<uint32_t>(12),
static_cast<uint32_t>(13));
EXPECT_EQ(static_cast<uint32_t>(cmds::IsSync::kCmdId), cmd.header.command);
EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
EXPECT_EQ(static_cast<GLuint>(11), cmd.sync);
EXPECT_EQ(static_cast<uint32_t>(12), cmd.result_shm_id);
EXPECT_EQ(static_cast<uint32_t>(13), cmd.result_shm_offset);
CheckBytesWrittenMatchesExpectedSize