Route GL runtime info through renderer GL
This commit is contained in:
@@ -25,6 +25,7 @@ struct RecordedOpenGlStateCall {
|
||||
};
|
||||
|
||||
std::vector<RecordedOpenGlStateCall> recorded_state_calls;
|
||||
std::vector<std::uint32_t> recorded_string_queries;
|
||||
|
||||
void record_enable(std::uint32_t state) noexcept
|
||||
{
|
||||
@@ -60,6 +61,23 @@ void record_blend_equation_separate(std::uint32_t color_equation, std::uint32_t
|
||||
});
|
||||
}
|
||||
|
||||
const char* record_string_query(std::uint32_t name) noexcept
|
||||
{
|
||||
recorded_string_queries.push_back(name);
|
||||
switch (name) {
|
||||
case 0x1F02U:
|
||||
return "test-version";
|
||||
case 0x1F00U:
|
||||
return "test-vendor";
|
||||
case 0x1F01U:
|
||||
return "test-renderer";
|
||||
case 0x8B8CU:
|
||||
return "test-glsl";
|
||||
default:
|
||||
return "unexpected";
|
||||
}
|
||||
}
|
||||
|
||||
void detects_common_extension_capabilities(pp::tests::Harness& h)
|
||||
{
|
||||
constexpr std::array<std::string_view, 2> extensions {
|
||||
@@ -738,6 +756,35 @@ void rejects_incomplete_app_initialization_state_dispatch(pp::tests::Harness& h)
|
||||
PP_EXPECT(h, status.code == pp::foundation::StatusCode::invalid_argument);
|
||||
}
|
||||
|
||||
void queries_app_runtime_info(pp::tests::Harness& h)
|
||||
{
|
||||
recorded_string_queries.clear();
|
||||
|
||||
const auto result = pp::renderer::gl::query_opengl_runtime_info(
|
||||
pp::renderer::gl::OpenGlRuntimeInfoDispatch {
|
||||
.get_string = record_string_query,
|
||||
});
|
||||
|
||||
PP_EXPECT(h, result.ok());
|
||||
PP_EXPECT(h, recorded_string_queries.size() == 4U);
|
||||
PP_EXPECT(h, recorded_string_queries[0] == 0x1F02U);
|
||||
PP_EXPECT(h, recorded_string_queries[1] == 0x1F00U);
|
||||
PP_EXPECT(h, recorded_string_queries[2] == 0x1F01U);
|
||||
PP_EXPECT(h, recorded_string_queries[3] == 0x8B8CU);
|
||||
PP_EXPECT(h, std::strcmp(result.value().version, "test-version") == 0);
|
||||
PP_EXPECT(h, std::strcmp(result.value().vendor, "test-vendor") == 0);
|
||||
PP_EXPECT(h, std::strcmp(result.value().renderer, "test-renderer") == 0);
|
||||
PP_EXPECT(h, std::strcmp(result.value().shading_language_version, "test-glsl") == 0);
|
||||
}
|
||||
|
||||
void rejects_incomplete_app_runtime_info_dispatch(pp::tests::Harness& h)
|
||||
{
|
||||
const auto result = pp::renderer::gl::query_opengl_runtime_info(pp::renderer::gl::OpenGlRuntimeInfoDispatch {});
|
||||
|
||||
PP_EXPECT(h, !result.ok());
|
||||
PP_EXPECT(h, result.status().code == pp::foundation::StatusCode::invalid_argument);
|
||||
}
|
||||
|
||||
void maps_renderer_viewports_and_scissors(pp::tests::Harness& h)
|
||||
{
|
||||
const auto viewport = pp::renderer::gl::viewport_for_renderer_viewport(
|
||||
@@ -1114,6 +1161,8 @@ int main()
|
||||
harness.run("maps_app_initialization_parameters", maps_app_initialization_parameters);
|
||||
harness.run("applies_app_initialization_state", applies_app_initialization_state);
|
||||
harness.run("rejects_incomplete_app_initialization_state_dispatch", rejects_incomplete_app_initialization_state_dispatch);
|
||||
harness.run("queries_app_runtime_info", queries_app_runtime_info);
|
||||
harness.run("rejects_incomplete_app_runtime_info_dispatch", rejects_incomplete_app_runtime_info_dispatch);
|
||||
harness.run("maps_renderer_viewports_and_scissors", maps_renderer_viewports_and_scissors);
|
||||
harness.run("maps_renderer_blend_state_tokens", maps_renderer_blend_state_tokens);
|
||||
harness.run("maps_renderer_color_write_masks", maps_renderer_color_write_masks);
|
||||
|
||||
Reference in New Issue
Block a user