#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "gpu/command_buffer/client/gles2_implementation.h"
#include <GLES2/gl2.h>
#include <GLES2/gl2ext.h>
#include <GLES2/gl2extchromium.h>
#include <GLES3/gl3.h>
#include <stddef.h>
#include <stdint.h>
#include <memory>
#include "base/compiler_specific.h"
#include "base/containers/heap_array.h"
#include "base/functional/bind.h"
#include "base/memory/raw_ptr.h"
#include "gpu/command_buffer/client/client_test_helper.h"
#include "gpu/command_buffer/client/gles2_cmd_helper.h"
#include "gpu/command_buffer/client/mock_transfer_buffer.h"
#include "gpu/command_buffer/client/program_info_manager.h"
#include "gpu/command_buffer/client/query_tracker.h"
#include "gpu/command_buffer/client/ring_buffer.h"
#include "gpu/command_buffer/client/shared_memory_limits.h"
#include "gpu/command_buffer/common/command_buffer.h"
#include "gpu/command_buffer/common/sync_token.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#if !defined(GLES2_SUPPORT_CLIENT_SIDE_ARRAYS)
#define GLES2_SUPPORT_CLIENT_SIDE_ARRAYS
#endif
_;
AtLeast;
AnyNumber;
DoAll;
InSequence;
Invoke;
Mock;
Pointee;
SaveArg;
Sequence;
StrictMock;
Truly;
Return;
ReturnRef;
namespace gpu {
namespace gles2 {
ACTION_P2(SetMemory, dst, obj) { … }
ACTION_P3(SetMemoryFromArray, dst, array, size) { … }
template <typename T>
class SizedResultHelper { … };
struct FourFloats { … };
#pragma pack(push, 1)
struct Str7 { … };
#pragma pack(pop)
class GenBuffersAPI { … };
class GenRenderbuffersAPI { … };
class GenTexturesAPI { … };
class GLES2ImplementationTest : public testing::Test { … };
void GLES2ImplementationTest::SetUp() { … }
void GLES2ImplementationTest::TearDown() { … }
class GLES2ImplementationManualInitTest : public GLES2ImplementationTest { … };
class GLES2ImplementationStrictSharedTest : public GLES2ImplementationTest { … };
void GLES2ImplementationStrictSharedTest::SetUp() { … }
class GLES3ImplementationTest : public GLES2ImplementationTest { … };
void GLES3ImplementationTest::SetUp() { … }
const uint8_t GLES2ImplementationTest::kInitialValue;
const int32_t GLES2ImplementationTest::kNumCommandEntries;
const int32_t GLES2ImplementationTest::kCommandBufferSizeBytes;
const size_t GLES2ImplementationTest::kTransferBufferSize;
const GLint GLES2ImplementationTest::kMaxCombinedTextureImageUnits;
const GLint GLES2ImplementationTest::kMaxCubeMapTextureSize;
const GLint GLES2ImplementationTest::kMaxFragmentUniformVectors;
const GLint GLES2ImplementationTest::kMaxRenderbufferSize;
const GLint GLES2ImplementationTest::kMaxTextureImageUnits;
const GLint GLES2ImplementationTest::kMaxTextureSize;
const GLint GLES2ImplementationTest::kMaxVaryingVectors;
const GLint GLES2ImplementationTest::kMaxVertexAttribs;
const GLint GLES2ImplementationTest::kMaxVertexTextureImageUnits;
const GLint GLES2ImplementationTest::kMaxVertexUniformVectors;
const GLint GLES2ImplementationTest::kNumCompressedTextureFormats;
const GLint GLES2ImplementationTest::kNumShaderBinaryFormats;
const GLuint GLES2ImplementationTest::kStartId;
const GLuint GLES2ImplementationTest::kBuffersStartId;
const GLuint GLES2ImplementationTest::kFramebuffersStartId;
const GLuint GLES2ImplementationTest::kProgramsAndShadersStartId;
const GLuint GLES2ImplementationTest::kRenderbuffersStartId;
const GLuint GLES2ImplementationTest::kSamplersStartId;
const GLuint GLES2ImplementationTest::kTexturesStartId;
const GLuint GLES2ImplementationTest::kTransformFeedbacksStartId;
const GLuint GLES2ImplementationTest::kQueriesStartId;
const GLuint GLES2ImplementationTest::kVertexArraysStartId;
TEST_F(GLES2ImplementationTest, Basic) { … }
TEST_F(GLES2ImplementationTest, GetBucketContents) { … }
TEST_F(GLES2ImplementationTest, GetShaderPrecisionFormat) { … }
TEST_F(GLES2ImplementationTest, GetShaderSource) { … }
#if defined(GLES2_SUPPORT_CLIENT_SIDE_ARRAYS)
TEST_F(GLES2ImplementationTest, DrawArraysClientSideBuffers) { … }
TEST_F(GLES2ImplementationTest, DrawArraysInstancedANGLEClientSideBuffers) { … }
TEST_F(GLES2ImplementationTest, DrawElementsClientSideBuffers) { … }
TEST_F(GLES2ImplementationTest, DrawElementsClientSideBuffersIndexUint) { … }
TEST_F(GLES2ImplementationTest, DrawElementsClientSideBuffersInvalidIndexUint) { … }
TEST_F(GLES2ImplementationTest,
DrawElementsClientSideBuffersServiceSideIndices) { … }
TEST_F(GLES2ImplementationTest, DrawElementsInstancedANGLEClientSideBuffers) { … }
TEST_F(GLES2ImplementationTest, GetVertexBufferPointerv) { … }
TEST_F(GLES2ImplementationTest, GetVertexAttrib) { … }
TEST_F(GLES2ImplementationTest, ReservedIds) { … }
#endif
TEST_F(GLES2ImplementationTest, ReadPixels2Reads) { … }
TEST_F(GLES2ImplementationTest, ReadPixelsBadFormatType) { … }
TEST_F(GLES2ImplementationTest, FreeUnusedSharedMemory) { … }
TEST_F(GLES2ImplementationTest, MapUnmapBufferSubDataCHROMIUM) { … }
TEST_F(GLES2ImplementationTest, MapUnmapBufferSubDataCHROMIUMBadArgs) { … }
TEST_F(GLES2ImplementationTest, MapUnmapTexSubImage2DCHROMIUM) { … }
TEST_F(GLES2ImplementationTest, MapUnmapTexSubImage2DCHROMIUMBadArgs) { … }
TEST_F(GLES2ImplementationTest, GetProgramInfoCHROMIUMGoodArgs) { … }
TEST_F(GLES2ImplementationTest, GetProgramInfoCHROMIUMBadArgs) { … }
TEST_F(GLES2ImplementationTest, GetUniformBlocksCHROMIUMGoodArgs) { … }
TEST_F(GLES2ImplementationTest, GetUniformBlocksCHROMIUMBadArgs) { … }
TEST_F(GLES2ImplementationTest, GetIntegerCacheRead) { … }
TEST_F(GLES2ImplementationTest, GetIntegerDisjointValue) { … }
TEST_F(GLES2ImplementationTest, GetIntegerCacheWrite) { … }
static bool CheckRect(int width,
int height,
GLenum format,
GLenum type,
int alignment,
const uint8_t* r1,
const uint8_t* r2) { … }
ACTION_P7(CheckRectAction, width, height, format, type, alignment, r1, r2) { … }
TEST_F(GLES2ImplementationTest, TexImage2D) { … }
TEST_F(GLES2ImplementationTest, TexImage2DViaMappedMem) { … }
TEST_F(GLES2ImplementationTest, TexImage2DViaTexSubImage2D) { … }
TEST_F(GLES2ImplementationTest, SubImage2DUnpack) { … }
TEST_F(GLES3ImplementationTest, SubImage3DUnpack) { … }
TEST_F(GLES2ImplementationTest, TextureInvalidArguments) { … }
TEST_F(GLES2ImplementationTest, TexImage3DSingleCommand) { … }
TEST_F(GLES2ImplementationTest, TexImage3DViaMappedMem) { … }
TEST_F(GLES2ImplementationTest, TexImage3DViaTexSubImage3D) { … }
TEST_F(GLES2ImplementationTest, TexSubImage3D4Writes) { … }
TEST_F(GLES2ImplementationStrictSharedTest, FlushGenerationTestBuffers) { … }
TEST_F(GLES2ImplementationStrictSharedTest, FlushGenerationTestRenderbuffers) { … }
TEST_F(GLES2ImplementationStrictSharedTest, FlushGenerationTestTextures) { … }
TEST_F(GLES2ImplementationStrictSharedTest, CrossContextGenerationTestBuffers) { … }
TEST_F(GLES2ImplementationStrictSharedTest,
CrossContextGenerationTestRenderbuffers) { … }
TEST_F(GLES2ImplementationStrictSharedTest,
CrossContextGenerationTestTextures) { … }
TEST_F(GLES2ImplementationStrictSharedTest,
CrossContextGenerationAutoFlushTestBuffers) { … }
TEST_F(GLES2ImplementationStrictSharedTest,
CrossContextGenerationAutoFlushTestRenderbuffers) { … }
TEST_F(GLES2ImplementationStrictSharedTest,
CrossContextGenerationAutoFlushTestTextures) { … }
TEST_F(GLES2ImplementationStrictSharedTest,
DeletingInvalidIdGeneratesErrorBuffers) { … }
TEST_F(GLES2ImplementationStrictSharedTest,
DeletingInvalidIdGeneratesErrorRenderbuffers) { … }
TEST_F(GLES2ImplementationStrictSharedTest,
DeletingInvalidIdGeneratesErrorTextures) { … }
TEST_F(GLES2ImplementationStrictSharedTest,
DoubleDeletingIdGeneratesErrorBuffers) { … }
TEST_F(GLES2ImplementationStrictSharedTest,
DoubleDeletingIdGeneratesErrorRenderbuffers) { … }
TEST_F(GLES2ImplementationStrictSharedTest,
DoubleDeletingIdGeneratesErrorTextures) { … }
TEST_F(GLES2ImplementationTest, GetString) { … }
TEST_F(GLES2ImplementationTest, CreateProgram) { … }
TEST_F(GLES2ImplementationTest, BufferDataLargerThanTransferBuffer) { … }
TEST_F(GLES2ImplementationTest, MultiDrawArraysWEBGLLargerThanTransferBuffer) { … }
TEST_F(GLES2ImplementationTest, CapabilitiesAreCached) { … }
TEST_F(GLES2ImplementationTest, BindVertexArrayOES) { … }
TEST_F(GLES2ImplementationTest, BeginEndQueryEXT) { … }
TEST_F(GLES2ImplementationManualInitTest, BadQueryTargets) { … }
TEST_F(GLES2ImplementationTest, SetDisjointSync) { … }
TEST_F(GLES2ImplementationTest, QueryCounterEXT) { … }
TEST_F(GLES2ImplementationTest, ErrorQuery) { … }
#if !defined(GLES2_SUPPORT_CLIENT_SIDE_ARRAYS)
TEST_F(GLES2ImplementationTest, VertexArrays) {
const GLuint kAttribIndex1 = 1;
const GLint kNumComponents1 = 3;
const GLsizei kClientStride = 12;
GLuint id = 0;
gl_->GenVertexArraysOES(1, &id);
ClearCommands();
gl_->BindVertexArrayOES(id);
gl_->BindBuffer(GL_ARRAY_BUFFER, 0);
gl_->VertexAttribPointer(
kAttribIndex1, kNumComponents1, GL_FLOAT, GL_FALSE, kClientStride,
reinterpret_cast<const void*>(4));
EXPECT_EQ(GL_INVALID_OPERATION, CheckError());
gl_->VertexAttribPointer(kAttribIndex1, kNumComponents1, GL_FLOAT, GL_FALSE,
kClientStride, nullptr);
EXPECT_EQ(GL_NO_ERROR, CheckError());
}
#endif
TEST_F(GLES2ImplementationTest, Disable) { … }
TEST_F(GLES2ImplementationTest, Enable) { … }
TEST_F(GLES2ImplementationTest, CreateAndTexStorage2DSharedImageCHROMIUM) { … }
TEST_F(GLES2ImplementationTest, LimitSizeAndOffsetTo32Bit) { … }
TEST_F(GLES2ImplementationTest, TraceBeginCHROMIUM) { … }
TEST_F(GLES2ImplementationTest, SetActiveURLCHROMIUM) { … }
TEST_F(GLES2ImplementationTest, AllowNestedTracesCHROMIUM) { … }
TEST_F(GLES2ImplementationTest, GenSyncTokenCHROMIUM) { … }
TEST_F(GLES2ImplementationTest, GenUnverifiedSyncTokenCHROMIUM) { … }
TEST_F(GLES2ImplementationTest, VerifySyncTokensCHROMIUM) { … }
TEST_F(GLES2ImplementationTest, VerifySyncTokensCHROMIUM_Sequence) { … }
TEST_F(GLES2ImplementationTest, VerifySyncTokensCHROMIUM_EmptySyncToken) { … }
TEST_F(GLES2ImplementationTest, WaitSyncTokenCHROMIUM) { … }
TEST_F(GLES2ImplementationTest, WaitSyncTokenCHROMIUMErrors) { … }
TEST_F(GLES2ImplementationTest, IsEnabled) { … }
TEST_F(GLES2ImplementationTest, ClientWaitSync) { … }
TEST_F(GLES2ImplementationTest, WaitSync) { … }
TEST_F(GLES2ImplementationTest, MapBufferRangeUnmapBufferWrite) { … }
TEST_F(GLES2ImplementationTest, MapBufferRangeWriteWithInvalidateBit) { … }
TEST_F(GLES2ImplementationTest, MapBufferRangeWriteWithGLError) { … }
TEST_F(GLES2ImplementationTest, MapBufferRangeUnmapBufferRead) { … }
TEST_F(GLES2ImplementationTest, MapBufferRangeReadWithGLError) { … }
TEST_F(GLES2ImplementationTest, UnmapBufferFails) { … }
TEST_F(GLES2ImplementationTest, BufferDataUnmapsDataStore) { … }
TEST_F(GLES2ImplementationTest, DeleteBuffersUnmapsDataStore) { … }
TEST_F(GLES2ImplementationTest, GetInternalformativ) { … }
static void CountCallback(int* count) { … }
TEST_F(GLES2ImplementationTest, SignalSyncToken) { … }
TEST_F(GLES2ImplementationTest, SignalSyncTokenAfterContextLoss) { … }
TEST_F(GLES2ImplementationTest, ReportLoss) { … }
TEST_F(GLES2ImplementationTest, ReportLossReentrant) { … }
TEST_F(GLES2ImplementationManualInitTest, FailInitOnBGRMismatch1) { … }
TEST_F(GLES2ImplementationManualInitTest, FailInitOnBGRMismatch2) { … }
TEST_F(GLES2ImplementationManualInitTest, FailInitOnTransferBufferFail) { … }
TEST_F(GLES2ImplementationTest, DiscardableMemoryDelete) { … }
TEST_F(GLES2ImplementationTest, DiscardableTextureLockFail) { … }
TEST_F(GLES2ImplementationTest, DiscardableTextureDoubleInitError) { … }
TEST_F(GLES2ImplementationTest, DiscardableTextureLockError) { … }
TEST_F(GLES2ImplementationTest, DiscardableTextureLockCounting) { … }
struct ErrorMessageCounter { … };
TEST_F(GLES2ImplementationTest, ReentrantErrorCallbacksShouldNotCrash) { … }
TEST_F(GLES2ImplementationTest, DeleteZero) { … }
#include "gpu/command_buffer/client/gles2_implementation_unittest_autogen.h"
}
}