9#include "impeller/scene/shaders/skinned.vert.h"
10#include "impeller/scene/shaders/unlit.frag.h"
11#include "impeller/scene/shaders/unskinned.vert.h"
22 desc.SetDepthStencilAttachmentDescriptor(depth);
28 desc.SetStencilAttachmentDescriptors(stencil);
39 : context_(
std::move(context)) {
40 if (!context_ || !context_->IsValid()) {
44 auto unskinned_variant =
45 MakePipelineVariants<UnskinnedVertexShader, UnlitFragmentShader>(
47 if (!unskinned_variant) {
48 FML_LOG(
ERROR) <<
"Could not create unskinned pipeline variant.";
52 std::move(unskinned_variant);
54 auto skinned_variant =
55 MakePipelineVariants<SkinnedVertexShader, UnlitFragmentShader>(*context_);
56 if (!skinned_variant) {
57 FML_LOG(
ERROR) <<
"Could not create skinned pipeline variant.";
61 std::move(skinned_variant);
67 texture_descriptor.
size = {1, 1};
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.";
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.";
96 if (
auto found = pipelines_.find(
key); found != pipelines_.end()) {
97 return found->second->GetPipeline(*context_, opts);
111 return placeholder_texture_;
virtual PixelFormat GetDefaultDepthStencilFormat() const =0
Returns a supported PixelFormat for textures that store both a stencil and depth component....
static std::shared_ptr< HostBuffer > Create(const std::shared_ptr< Allocator > &allocator)
std::shared_ptr< Context > GetContext() const
SceneContext(std::shared_ptr< Context > context)
std::shared_ptr< Pipeline< PipelineDescriptor > > GetPipeline(PipelineKey key, SceneContextOptions opts) const
std::shared_ptr< Texture > GetPlaceholderTexture() const
#define FML_LOG(severity)
@ kAlways
Comparison test passes always passes.
@ kLess
Comparison test passes if new_value < current_value.
@ kKeep
Don't modify the current stencil value.
CompareFunction depth_compare
CompareFunction stencil_compare
StencilOperation depth_stencil_pass
A lightweight object that describes the attributes of a texture that can then used an allocator to cr...
PrimitiveType primitive_type
void ApplyToPipelineDescriptor(const Capabilities &capabilities, PipelineDescriptor &desc) const