[core] Introduce gl::Program template

This commit is contained in:
John Firebaugh
2016-10-28 18:17:33 -07:00
parent 36210fe4e9
commit 66bdbc3b96
90 changed files with 984 additions and 1451 deletions

View File

@@ -7,6 +7,8 @@
#include <memory>
using namespace mbgl;
namespace {
static bool getFlag = false;
@@ -27,7 +29,7 @@ TEST(GLObject, PreserveState) {
getFlag = false;
setFlag = false;
auto object = std::make_unique<mbgl::gl::PreserveState<MockGLObject>>();
auto object = std::make_unique<gl::PreserveState<MockGLObject>>();
EXPECT_TRUE(getFlag);
EXPECT_FALSE(setFlag);
@@ -40,7 +42,7 @@ TEST(GLObject, PreserveState) {
TEST(GLObject, Value) {
setFlag = false;
auto object = std::make_unique<mbgl::gl::State<MockGLObject>>();
auto object = std::make_unique<gl::State<MockGLObject>>();
EXPECT_EQ(object->getCurrentValue(), false);
EXPECT_TRUE(object->isDirty());
EXPECT_FALSE(setFlag);
@@ -58,27 +60,13 @@ TEST(GLObject, Value) {
}
TEST(GLObject, Store) {
mbgl::HeadlessBackend backend;
mbgl::OffscreenView view(backend.getContext());
HeadlessBackend backend;
OffscreenView view(backend.getContext());
mbgl::gl::Context context;
gl::Context context;
EXPECT_TRUE(context.empty());
mbgl::gl::UniqueProgram program = context.createProgram();
EXPECT_NE(program.get(), 0u);
program.reset();
EXPECT_FALSE(context.empty());
context.performCleanup();
EXPECT_TRUE(context.empty());
mbgl::gl::UniqueShader shader = context.createVertexShader();
EXPECT_NE(shader.get(), 0u);
shader.reset();
EXPECT_FALSE(context.empty());
context.performCleanup();
EXPECT_TRUE(context.empty());
mbgl::gl::UniqueTexture texture = context.createTexture();
gl::UniqueTexture texture = context.createTexture();
EXPECT_NE(texture.get(), 0u);
texture.reset();
EXPECT_FALSE(context.empty());