#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "gpu/command_buffer/service/program_manager.h"
#include <stddef.h>
#include <stdint.h>
#include <algorithm>
#include <memory>
#include "base/command_line.h"
#include "base/memory/raw_ptr.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
#include "gpu/command_buffer/common/gles2_cmd_format.h"
#include "gpu/command_buffer/common/gles2_cmd_utils.h"
#include "gpu/command_buffer/service/common_decoder.h"
#include "gpu/command_buffer/service/decoder_client.h"
#include "gpu/command_buffer/service/feature_info.h"
#include "gpu/command_buffer/service/gpu_service_test.h"
#include "gpu/command_buffer/service/gpu_switches.h"
#include "gpu/command_buffer/service/mocks.h"
#include "gpu/command_buffer/service/shader_manager.h"
#include "gpu/command_buffer/service/test_helper.h"
#include "gpu/config/gpu_preferences.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/gl/gl_mock.h"
_;
DoAll;
Exactly;
InSequence;
MatcherCast;
Pointee;
Return;
ReturnRef;
SetArrayArgument;
SetArgPointee;
StrEq;
namespace gpu {
namespace gles2 {
namespace {
const uint32_t kMaxVaryingVectors = …;
const uint32_t kMaxDrawBuffers = …;
const uint32_t kMaxDualSourceDrawBuffers = …;
const uint32_t kMaxVertexAttribs = …;
uint32_t ComputeOffset(const void* start, const void* position) { … }
}
class ProgramManagerTestBase : public GpuServiceTest, public DecoderClient { … };
class ProgramManagerTest : public ProgramManagerTestBase { … };
TEST_F(ProgramManagerTest, Basic) { … }
TEST_F(ProgramManagerTest, Destroy) { … }
TEST_F(ProgramManagerTest, DeleteBug) { … }
TEST_F(ProgramManagerTest, Program) { … }
class ProgramManagerWithShaderTest : public ProgramManagerTestBase { … };
ProgramManagerWithShaderTest::AttribInfo
ProgramManagerWithShaderTest::kAttribs[] = …;
#ifndef COMPILER_MSVC
const GLint ProgramManagerWithShaderTest::kNumVertexAttribs;
const GLuint ProgramManagerWithShaderTest::kClientProgramId;
const GLuint ProgramManagerWithShaderTest::kServiceProgramId;
const GLuint ProgramManagerWithShaderTest::kVertexShaderClientId;
const GLuint ProgramManagerWithShaderTest::kFragmentShaderClientId;
const GLuint ProgramManagerWithShaderTest::kVertexShaderServiceId;
const GLuint ProgramManagerWithShaderTest::kFragmentShaderServiceId;
const GLint ProgramManagerWithShaderTest::kAttrib1Size;
const GLint ProgramManagerWithShaderTest::kAttrib2Size;
const GLint ProgramManagerWithShaderTest::kAttrib3Size;
const GLint ProgramManagerWithShaderTest::kAttrib4Size;
const GLint ProgramManagerWithShaderTest::kAttrib1Location;
const GLint ProgramManagerWithShaderTest::kAttrib2Location;
const GLint ProgramManagerWithShaderTest::kAttrib3Location;
const GLint ProgramManagerWithShaderTest::kAttrib4Location;
const GLenum ProgramManagerWithShaderTest::kAttrib1Type;
const GLenum ProgramManagerWithShaderTest::kAttrib2Type;
const GLenum ProgramManagerWithShaderTest::kAttrib3Type;
const GLenum ProgramManagerWithShaderTest::kAttrib4Type;
const GLint ProgramManagerWithShaderTest::kInvalidAttribLocation;
const GLint ProgramManagerWithShaderTest::kBadAttribIndex;
const GLint ProgramManagerWithShaderTest::kUniform1Size;
const GLint ProgramManagerWithShaderTest::kUniform2Size;
const GLint ProgramManagerWithShaderTest::kUniform3Size;
const GLint ProgramManagerWithShaderTest::kUniform1FakeLocation;
const GLint ProgramManagerWithShaderTest::kUniform2FakeLocation;
const GLint ProgramManagerWithShaderTest::kUniform3FakeLocation;
const GLint ProgramManagerWithShaderTest::kUniform1RealLocation;
const GLint ProgramManagerWithShaderTest::kUniform2RealLocation;
const GLint ProgramManagerWithShaderTest::kUniform3RealLocation;
const GLint ProgramManagerWithShaderTest::kUniform1DesiredLocation;
const GLint ProgramManagerWithShaderTest::kUniform2DesiredLocation;
const GLint ProgramManagerWithShaderTest::kUniform3DesiredLocation;
const GLenum ProgramManagerWithShaderTest::kUniform1Type;
const GLenum ProgramManagerWithShaderTest::kUniform2Type;
const GLenum ProgramManagerWithShaderTest::kUniform3Type;
const GLint ProgramManagerWithShaderTest::kInvalidUniformLocation;
const GLint ProgramManagerWithShaderTest::kBadUniformIndex;
#endif
const size_t ProgramManagerWithShaderTest::kNumAttribs = …;
ProgramManagerWithShaderTest::UniformInfo
ProgramManagerWithShaderTest::kUniforms[] = …;
const size_t ProgramManagerWithShaderTest::kNumUniforms = …;
const char* ProgramManagerWithShaderTest::kAttrib1Name = …;
const char* ProgramManagerWithShaderTest::kAttrib2Name = …;
const char* ProgramManagerWithShaderTest::kAttrib3Name = …;
const char* ProgramManagerWithShaderTest::kAttrib4Name = …;
const char* ProgramManagerWithShaderTest::kUniform1Name = …;
const char* ProgramManagerWithShaderTest::kUniform2Name = …;
const char* ProgramManagerWithShaderTest::kUniform2NameWithArrayIndex = …;
const char* ProgramManagerWithShaderTest::kUniform3Name = …;
const char* ProgramManagerWithShaderTest::kUniform3NameWithArrayIndex = …;
const char* ProgramManagerWithShaderTest::kOutputVariable1Name = …;
TEST_F(ProgramManagerWithShaderTest, GetAttribInfos) { … }
TEST_F(ProgramManagerWithShaderTest, GetAttribInfo) { … }
TEST_F(ProgramManagerWithShaderTest, GetAttribInfoByLocation) { … }
TEST_F(ProgramManagerWithShaderTest, GetAttribLocation) { … }
TEST_F(ProgramManagerWithShaderTest, VertexArrayMasks) { … }
TEST_F(ProgramManagerWithShaderTest, GetUniformInfo) { … }
TEST_F(ProgramManagerWithShaderTest, AttachDetachShader) { … }
TEST_F(ProgramManagerWithShaderTest, GetUniformFakeLocation) { … }
TEST_F(ProgramManagerWithShaderTest, GetUniformInfoByFakeLocation) { … }
TEST_F(ProgramManagerWithShaderTest, GLDriverReturnsGLUnderscoreUniform) { … }
TEST_F(ProgramManagerWithShaderTest, SimilarArrayNames) { … }
TEST_F(ProgramManagerWithShaderTest, GLDriverReturnsWrongTypeInfo) { … }
TEST_F(ProgramManagerWithShaderTest, ProgramInfoUseCount) { … }
TEST_F(ProgramManagerWithShaderTest, ProgramInfoUseCount2) { … }
TEST_F(ProgramManagerWithShaderTest, ProgramInfoGetProgramInfo) { … }
TEST_F(ProgramManagerWithShaderTest, ProgramInfoGetUniformBlocksNone) { … }
TEST_F(ProgramManagerWithShaderTest, ProgramInfoGetUniformBlocksValid) { … }
TEST_F(ProgramManagerWithShaderTest,
ProgramInfoGetTransformFeedbackVaryingsNone) { … }
TEST_F(ProgramManagerWithShaderTest,
ProgramInfoGetTransformFeedbackVaryingsValid) { … }
TEST_F(ProgramManagerWithShaderTest, ProgramInfoGetUniformsES3None) { … }
TEST_F(ProgramManagerWithShaderTest, ProgramInfoGetUniformsES3Valid) { … }
TEST_F(ProgramManagerWithShaderTest, UnusedUniformArrayElements) { … }
TEST_F(ProgramManagerWithShaderTest, BindAttribLocationConflicts) { … }
TEST_F(ProgramManagerWithShaderTest, UniformsPrecisionMismatch) { … }
TEST_F(ProgramManagerWithShaderTest, VaryingTypeMismatch) { … }
TEST_F(ProgramManagerWithShaderTest, VaryingArraySizeMismatch) { … }
TEST_F(ProgramManagerWithShaderTest, VaryingPrecisionMismatch) { … }
TEST_F(ProgramManagerWithShaderTest, VaryingMissing) { … }
TEST_F(ProgramManagerWithShaderTest, InactiveVarying) { … }
TEST_F(ProgramManagerWithShaderTest, AttribUniformNameConflict) { … }
TEST_F(ProgramManagerWithShaderTest, FragmentOutputTypes) { … }
TEST_F(ProgramManagerWithShaderTest, TooManyVaryings) { … }
TEST_F(ProgramManagerWithShaderTest, TooManyInactiveVaryings) { … }
TEST_F(ProgramManagerWithShaderTest, BindUniformLocation) { … }
TEST_F(ProgramManagerWithShaderTest, ZeroSizeUniformMarkedInvalid) { … }
class ProgramManagerWithCacheTest : public ProgramManagerTestBase { … };
#ifndef COMPILER_MSVC
const GLuint ProgramManagerWithCacheTest::kClientProgramId;
const GLuint ProgramManagerWithCacheTest::kServiceProgramId;
const GLuint ProgramManagerWithCacheTest::kVertexShaderClientId;
const GLuint ProgramManagerWithCacheTest::kFragmentShaderClientId;
const GLuint ProgramManagerWithCacheTest::kVertexShaderServiceId;
const GLuint ProgramManagerWithCacheTest::kFragmentShaderServiceId;
#endif
TEST_F(ProgramManagerWithCacheTest, CacheProgramOnSuccessfulLink) { … }
TEST_F(ProgramManagerWithCacheTest, LoadProgramOnProgramCacheHit) { … }
TEST_F(ProgramManagerWithCacheTest, RelinkOnChangedCompileOptions) { … }
namespace {
testing::tuple<const char*, const char*> make_gl_ext_tuple(
const char* gl_version,
const char* gl_extensions) { … }
}
class ProgramManagerDualSourceBlendingTest
: public ProgramManagerWithShaderTest,
public testing::WithParamInterface<
testing::tuple<const char*, const char*>> { … };
class ProgramManagerDualSourceBlendingES2Test
: public ProgramManagerDualSourceBlendingTest { … };
TEST_P(ProgramManagerDualSourceBlendingES2Test, UseSecondaryFragCoord) { … }
TEST_P(ProgramManagerDualSourceBlendingES2Test, UseSecondaryFragData) { … }
INSTANTIATE_TEST_SUITE_P(…);
}
}