39 : context_(std::move(context)) {
40 if (!context_ || !context_->IsValid()) {
41 return;
42 }
43
44 auto unskinned_variant =
45 MakePipelineVariants<UnskinnedVertexShader, UnlitFragmentShader>(
46 *context_);
47 if (!unskinned_variant) {
48 FML_LOG(
ERROR) <<
"Could not create unskinned pipeline variant.";
49 return;
50 }
52 std::move(unskinned_variant);
53
54 auto skinned_variant =
55 MakePipelineVariants<SkinnedVertexShader, UnlitFragmentShader>(*context_);
56 if (!skinned_variant) {
57 FML_LOG(
ERROR) <<
"Could not create skinned pipeline variant.";
58 return;
59 }
61 std::move(skinned_variant);
62
63 {
67 texture_descriptor.
size = {1, 1};
69
70 placeholder_texture_ =
71 context_->GetResourceAllocator()->CreateTexture(texture_descriptor);
72 placeholder_texture_->SetLabel("Placeholder Texture");
73 if (!placeholder_texture_) {
74 FML_LOG(
ERROR) <<
"Could not create placeholder texture.";
75 return;
76 }
77
78 uint8_t pixel[] = {0xFF, 0xFF, 0xFF, 0xFF};
79 if (!placeholder_texture_->SetContents(pixel, 4)) {
80 FML_LOG(
ERROR) <<
"Could not set contents of placeholder texture.";
81 return;
82 }
83 }
85 is_valid_ = true;
86}
static std::shared_ptr< HostBuffer > Create(const std::shared_ptr< Allocator > &allocator)
std::shared_ptr< Context > GetContext() const
#define FML_LOG(severity)
A lightweight object that describes the attributes of a texture that can then used an allocator to cr...