Add shader registry (#924)

This commit is contained in:
mwilsnd
2023-03-27 12:41:38 -05:00
committed by GitHub
parent 7c96e517c3
commit 1d8c4b527f
23 changed files with 416 additions and 11 deletions

View File

@@ -7,6 +7,7 @@
#include <mbgl/gfx/backend_scope.hpp>
#include <mbgl/gfx/headless_frontend.hpp>
#include <mbgl/gfx/shader_registry.hpp>
#include <mbgl/gl/context.hpp>
#include <mbgl/map/map_options.hpp>
#include <mbgl/math/log2.hpp>
@@ -1576,3 +1577,23 @@ TEST(Map, VolatileSource) {
test.runLoop.run();
EXPECT_EQ(8, requestedTiles);
}
TEST(Map, ObserveShaderRegistration) {
MapTest<> test;
bool observedRegistry = false;
test.observer.onRegisterShadersCallback = [&observedRegistry](gfx::ShaderRegistry&) {
observedRegistry = true;
};
test.map.jumpTo(CameraOptions().withZoom(10));
test.map.getStyle().loadJSON(util::read_file("test/fixtures/api/empty.json"));
test.frontend.render(test.map);
EXPECT_EQ(observedRegistry, true);
// Should not see it again
observedRegistry = false;
test.frontend.render(test.map);
EXPECT_EQ(observedRegistry, false);
}