5#define FML_USED_ON_EMBEDDER
9#include <vulkan/vulkan.h>
16#include "impeller/entity/vk/entity_shaders_vk.h"
17#include "impeller/entity/vk/framebuffer_blend_shaders_vk.h"
18#include "impeller/entity/vk/modern_shaders_vk.h"
21#include "impeller/renderer/vk/compute_shaders_vk.h"
27std::vector<std::shared_ptr<fml::Mapping>> ShaderLibraryMappings() {
29 std::make_shared<fml::NonOwnedMapping>(impeller_entity_shaders_vk_data,
30 impeller_entity_shaders_vk_length),
31 std::make_shared<fml::NonOwnedMapping>(impeller_modern_shaders_vk_data,
32 impeller_modern_shaders_vk_length),
33 std::make_shared<fml::NonOwnedMapping>(
34 impeller_framebuffer_blend_shaders_vk_data,
35 impeller_framebuffer_blend_shaders_vk_length),
36 std::make_shared<fml::NonOwnedMapping>(
37 impeller_compute_shaders_vk_data, impeller_compute_shaders_vk_length),
41class TesterContextVK :
public TesterContext {
43 TesterContextVK() =
default;
45 ~TesterContextVK()
override {
51 bool Initialize(
bool enable_validation) {
59 if (!context_ || !context_->IsValid()) {
64 impeller::vk::SurfaceKHR vk_surface;
65 impeller::vk::HeadlessSurfaceCreateInfoEXT surface_create_info;
66 auto res = context_->GetInstance().createHeadlessSurfaceEXT(
71 if (res != impeller::vk::Result::eSuccess) {
73 << impeller::vk::to_string(res);
77 impeller::vk::UniqueSurfaceKHR
surface{vk_surface, context_->GetInstance()};
78 surface_context_ = context_->CreateSurfaceContext();
79 if (!surface_context_->SetWindowSurface(std::move(
surface),
88 std::shared_ptr<impeller::Context> GetImpellerContext()
const override {
93 std::unique_ptr<Surface> CreateRenderingSurface()
override {
96 std::make_unique<GPUSurfaceVulkanImpeller>(
nullptr, surface_context_);
102 std::shared_ptr<impeller::ContextVK> context_;
103 std::shared_ptr<impeller::SurfaceContextVK> surface_context_;
109 bool enable_validation) {
110 auto context = std::make_unique<TesterContextVK>();
111 if (!context->Initialize(enable_validation)) {
static std::unique_ptr< TesterContext > Create(bool enable_validation)
static std::shared_ptr< ContextVK > Create(Settings settings)
#define FML_DCHECK(condition)
fml::UniqueFD GetCachesDirectory()
std::vector< std::shared_ptr< fml::Mapping > > shader_libraries_data
PFN_vkGetInstanceProcAddr proc_address_callback
fml::UniqueFD cache_directory