#include "test_utils/ANGLETest.h"
#include "test_utils/gl_raii.h"
#include "util/random_utils.h"
#include <stdint.h>
#include <thread>
usingnamespaceangle;
class BufferDataTest : public ANGLETest<>
{ … };
TEST_P(BufferDataTest, Uninitialized)
{ … }
TEST_P(BufferDataTest, ZeroNonNULLData)
{ … }
TEST_P(BufferDataTest, NULLResolvedData)
{ … }
TEST_P(BufferDataTest, RepeatedDrawWithDynamic)
{ … }
TEST_P(BufferDataTest, RepeatedDrawDynamicBug)
{ … }
BufferSubDataTestParams;
std::string BufferSubDataTestPrint(
const ::testing::TestParamInfo<BufferSubDataTestParams> ¶msInfo)
{ … }
class BufferSubDataTest : public ANGLETest<BufferSubDataTestParams>
{ … };
TEST_P(BufferSubDataTest, SmallIndexBufferUpdateAfterDraw)
{ … }
TEST_P(BufferSubDataTest, SmallVertexDataUpdateAfterDraw)
{ … }
class IndexedBufferCopyTest : public ANGLETest<>
{ … };
TEST_P(IndexedBufferCopyTest, IndexRangeBug)
{ … }
class BufferDataTestES3 : public BufferDataTest
{ … };
TEST_P(BufferDataTestES3, BufferResizing)
{ … }
TEST_P(BufferDataTestES3, CopyBufferSubDataMapReadTest)
{ … }
TEST_P(BufferDataTestES3, MapBufferUnsynchronizedReadTest)
{ … }
TEST_P(BufferDataTestES3, MapBufferRangeUnsynchronizedBit)
{ … }
TEST_P(BufferDataTest, ExtensionDependency)
{ … }
TEST_P(BufferDataTest, MapBufferOES)
{ … }
TEST_P(BufferDataTest, MapDynamicBufferUnsynchronizedEXTTest)
{ … }
TEST_P(BufferDataTest, MapWriteArrayBufferDataDrawQuad)
{ … }
TEST_P(BufferDataTest, MapWriteArrayBufferDataDrawArrays)
{ … }
TEST_P(BufferDataTest, BufferSizeValidation32Bit)
{ … }
TEST_P(BufferDataTestES3, GLDriverErrorWhenMappingArrayBuffersDuringDraw)
{ … }
TEST_P(BufferDataTestES3, DrawWithNotCallingBufferData)
{ … }
TEST_P(BufferDataTestES3, NoBufferInitDataCopyBug)
{ … }
TEST_P(BufferDataTestES3, CopyBufferSubDataDraw)
{ … }
TEST_P(BufferDataTestES3, BufferDataUnmap)
{ … }
TEST_P(BufferSubDataTest, MapInvalidateThenBufferSubData)
{ … }
TEST_P(BufferDataTestES3, BufferDataWithNullFollowedByMap)
{ … }
TEST_P(BufferDataTestES3, bufferReadFromRenderPassAndOutsideRenderPassWithFenceSyncInBetween)
{ … }
class BufferStorageTestES3 : public BufferDataTest
{ … };
TEST_P(BufferStorageTestES3, BufferStorageInvalidSize)
{ … }
TEST_P(BufferStorageTestES3, BufferStorageFlagsPersistentCoherentWrite)
{ … }
TEST_P(BufferStorageTestES3, StorageBufferBufferData)
{ … }
TEST_P(BufferStorageTestES3, BufferDataStorageBuffer)
{ … }
TEST_P(BufferStorageTestES3, BufferStorageClobber)
{ … }
TEST_P(BufferStorageTestES3, StorageBufferSubData)
{ … }
TEST_P(BufferStorageTestES3, StorageBufferMapBufferOES)
{ … }
TEST_P(BufferStorageTestES3, StorageCopyBufferSubDataMapped)
{ … }
TEST_P(BufferStorageTestES3, DrawElementsElementArrayBufferMapped)
{ … }
TEST_P(BufferStorageTestES3, NoUnmap)
{ … }
TEST_P(BufferStorageTestES3, TexImage2DPixelUnpackBufferMappedPersistently)
{ … }
TEST_P(BufferStorageTestES3, StorageBufferSubDataMapped)
{ … }
TEST_P(BufferStorageTestES3, UniformBufferMapped)
{ … }
TEST_P(BufferStorageTestES3, VertexBufferMapped)
{ … }
void TestPageSharingBuffers(std::function<void(void)> swapCallback,
size_t bufferSize,
const std::array<Vector3, 6> &quadVertices,
GLint positionLocation)
{ … }
TEST_P(BufferStorageTestES3, PageSharingBuffers)
{ … }
class BufferStorageTestES3Threaded : public ANGLETest<>
{ … };
TEST_P(BufferStorageTestES3Threaded, VertexBuffer)
{ … }
TEST_P(BufferDataTestES3, CopyBufferSubDataSelfDependency)
{ … }
ANGLE_INSTANTIATE_TEST_ES2(…);
GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(…);
ANGLE_INSTANTIATE_TEST_COMBINE_1(…);
GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(…);
ANGLE_INSTANTIATE_TEST_ES3_AND(…);
GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(…);
ANGLE_INSTANTIATE_TEST_ES3_AND(…);
GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(…);
ANGLE_INSTANTIATE_TEST_ES3(…);
GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(…);
ANGLE_INSTANTIATE_TEST_ES3(…);
#ifdef _WIN64
class BufferDataOverflowTest : public ANGLETest<>
{
protected:
BufferDataOverflowTest() {}
};
TEST_P(BufferDataOverflowTest, VertexBufferIntegerOverflow)
{
unsigned int numItems = 0x7FFFFFE;
constexpr GLsizei bufferCnt = 8;
std::vector<GLBuffer> buffers(bufferCnt);
std::stringstream vertexShaderStr;
for (GLsizei bufferIndex = 0; bufferIndex < bufferCnt; ++bufferIndex)
{
vertexShaderStr << "attribute float attrib" << bufferIndex << ";\n";
}
vertexShaderStr << "attribute vec2 position;\n"
"varying float v_attrib;\n"
"void main() {\n"
" gl_Position = vec4(position, 0, 1);\n"
" v_attrib = 0.0;\n";
for (GLsizei bufferIndex = 0; bufferIndex < bufferCnt; ++bufferIndex)
{
vertexShaderStr << "v_attrib += attrib" << bufferIndex << ";\n";
}
vertexShaderStr << "}";
constexpr char kFS[] =
"varying highp float v_attrib;\n"
"void main() {\n"
" gl_FragColor = vec4(v_attrib, 0, 0, 1);\n"
"}";
ANGLE_GL_PROGRAM(program, vertexShaderStr.str().c_str(), kFS);
glUseProgram(program);
std::vector<GLfloat> data(numItems, 1.0f);
for (GLsizei bufferIndex = 0; bufferIndex < bufferCnt; ++bufferIndex)
{
glBindBuffer(GL_ARRAY_BUFFER, buffers[bufferIndex]);
glBufferData(GL_ARRAY_BUFFER, numItems * sizeof(float), &data[0], GL_DYNAMIC_DRAW);
std::stringstream attribNameStr;
attribNameStr << "attrib" << bufferIndex;
GLint attribLocation = glGetAttribLocation(program, attribNameStr.str().c_str());
ASSERT_NE(-1, attribLocation);
glVertexAttribPointer(attribLocation, 1, GL_FLOAT, GL_FALSE, 4, nullptr);
glEnableVertexAttribArray(attribLocation);
}
GLint positionLocation = glGetAttribLocation(program, "position");
ASSERT_NE(-1, positionLocation);
glDisableVertexAttribArray(positionLocation);
glVertexAttrib2f(positionLocation, 1.0f, 1.0f);
EXPECT_GL_NO_ERROR();
glDrawArrays(GL_TRIANGLES, 0, numItems);
EXPECT_GL_ERROR(GL_OUT_OF_MEMORY);
for (GLsizei bufferIndex = 0; bufferIndex < bufferCnt; ++bufferIndex)
{
std::stringstream attribNameStr;
attribNameStr << "attrib" << bufferIndex;
GLint attribLocation = glGetAttribLocation(program, attribNameStr.str().c_str());
ASSERT_NE(-1, attribLocation);
glDisableVertexAttribArray(attribLocation);
}
glDrawArrays(GL_TRIANGLES, 0, 3);
EXPECT_GL_ERROR(GL_NO_ERROR);
}
TEST_P(BufferDataOverflowTest, CopySubDataValidation)
{
GLBuffer readBuffer, writeBuffer;
glBindBuffer(GL_COPY_READ_BUFFER, readBuffer);
glBindBuffer(GL_COPY_WRITE_BUFFER, writeBuffer);
constexpr int bufSize = 100;
glBufferData(GL_COPY_READ_BUFFER, bufSize, nullptr, GL_STATIC_DRAW);
glBufferData(GL_COPY_WRITE_BUFFER, bufSize, nullptr, GL_STATIC_DRAW);
GLintptr big = std::numeric_limits<GLintptr>::max() - bufSize + 90;
glCopyBufferSubData(GL_COPY_READ_BUFFER, GL_COPY_WRITE_BUFFER, big, 0, 50);
EXPECT_GL_ERROR(GL_INVALID_VALUE);
glCopyBufferSubData(GL_COPY_READ_BUFFER, GL_COPY_WRITE_BUFFER, 0, big, 50);
EXPECT_GL_ERROR(GL_INVALID_VALUE);
}
ANGLE_INSTANTIATE_TEST_ES3(BufferDataOverflowTest);
#endif