53 auto mock_gles_impl = std::make_unique<MockGLESImpl>();
55 EXPECT_CALL(*mock_gles_impl, GenTextures(1, _))
56 .WillOnce([](GLsizei
size, GLuint* queries) { queries[0] = 1234; });
57 EXPECT_CALL(*mock_gles_impl, DeleteTextures(1, ::testing::Pointee(1234)))
60 std::shared_ptr<MockGLES> mock_gles =
63 auto proc_table = std::make_unique<ProcTableGLES>(resolver);
64 auto worker = std::make_shared<TestWorker>();
65 auto reactor = std::make_shared<ReactorGLES>(std::move(proc_table));
72 auto mock_gles_impl = std::make_unique<MockGLESImpl>();
74 EXPECT_CALL(*mock_gles_impl, GenTextures(1, _))
75 .WillOnce([](GLsizei
size, GLuint* queries) { queries[0] = 1234; });
76 EXPECT_CALL(*mock_gles_impl, DeleteTextures(1, ::testing::Pointee(1234)))
79 std::shared_ptr<MockGLES> mock_gles =
82 auto proc_table = std::make_unique<ProcTableGLES>(resolver);
83 auto worker = std::make_shared<TestWorker>();
84 auto reactor = std::make_shared<ReactorGLES>(std::move(proc_table));
88 EXPECT_FALSE(handle.
IsDead());
89 std::optional<GLuint> glint =
reactor->GetGLHandle(handle);
90 EXPECT_TRUE(glint.has_value());
91 if (glint.has_value()) {
92 EXPECT_EQ(1234u, *glint);
100 auto mock_gles_impl = std::make_unique<NiceMock<MockGLESImpl>>();
101 NiceMock<MockGLESImpl>* raw_mock_gles = mock_gles_impl.get();
103 std::shared_ptr<MockGLES> mock_gles =
106 auto proc_table = std::make_unique<ProcTableGLES>(resolver);
108 if (!proc_table->SupportsDebugLabels()) {
109 GTEST_SKIP() <<
"This device doesn't support labelling.";
112 EXPECT_CALL(*raw_mock_gles, GenTextures(1, _))
113 .WillOnce([](GLsizei
size, GLuint* queries) { queries[0] = 1234; });
114 EXPECT_CALL(*raw_mock_gles,
115 ObjectLabelKHR(_, 1234, _, ::testing::StrEq(
"hello, joe!")))
117 ON_CALL(*raw_mock_gles, IsTexture).WillByDefault(::testing::Return(GL_TRUE));
119 auto worker = std::make_shared<TestWorker>();
120 auto reactor = std::make_shared<ReactorGLES>(std::move(proc_table));
124 reactor->SetDebugLabel(handle,
"hello, joe!");
130 auto proc_table = std::make_unique<ProcTableGLES>(resolver);
131 auto worker = std::make_shared<TestWorker>();
132 auto reactor = std::make_shared<ReactorGLES>(std::move(proc_table));
135 bool op1_called =
false;
140 bool op2_called =
false;
141 std::thread thread([&] {
142 EXPECT_TRUE(
reactor->AddOperation(
143 [&](
const ReactorGLES&) { op2_called = true; },
true));
150 EXPECT_TRUE(op1_called);
151 EXPECT_FALSE(op2_called);
156 EXPECT_TRUE(op2_called);
184 auto mock_gles_impl = std::make_unique<MockGLESImpl>();
186 EXPECT_CALL(*mock_gles_impl, GenFramebuffers(1, _))
187 .WillOnce([](GLsizei
size, GLuint* queries) { queries[0] = 1234; });
189 std::shared_ptr<MockGLES> mock_gles =
192 auto proc_table = std::make_unique<ProcTableGLES>(resolver);
193 auto worker = std::make_shared<TestWorker>();
194 auto reactor = std::make_shared<ReactorGLES>(std::move(proc_table));
199 std::thread::id cleanup_thread;
200 reactor->RegisterCleanupCallback(
201 handle, [&]() { cleanup_thread = std::this_thread::get_id(); });
203 reactor->CollectHandle(handle);
205 std::thread thread([&] {
211 EXPECT_EQ(cleanup_thread, std::thread::id());
215 EXPECT_EQ(cleanup_thread, std::this_thread::get_id());