8 #include "gtest/gtest.h"
12 #include "impeller/entity/contents/test/contents_test_helpers.h"
16 #include "impeller/entity/vertices.frag.h"
26 const std::vector<Point>& vertices,
27 const std::vector<Color>& colors) {
29 std::vector<uint16_t> indices = {};
30 indices.reserve(vertices.size());
31 for (
auto i = 0u; i < vertices.size(); i++) {
32 indices.emplace_back(i);
34 std::vector<Point> texture_coordinates = {};
36 return std::make_shared<VerticesGeometry>(
37 vertices, indices, texture_coordinates, colors,
46 auto contents = std::make_shared<VerticesContents>();
48 {{0, 0}, {100, 0}, {0, 100}, {100, 0}, {0, 100}, {100, 100}},
55 contents->SetGeometry(vertices);
56 contents->SetAlpha(0.5);
58 contents->SetSourceContents(std::move(src_contents));
60 auto content_context = GetContentContext();
61 auto buffer = content_context->GetContext()->CreateCommandBuffer();
63 *content_context->GetContext(),
64 *GetContentContext()->GetRenderTargetCache(), {100, 100});
65 auto render_pass = buffer->CreateRenderPass(render_target);
68 ASSERT_TRUE(render_pass->GetCommands().empty());
69 ASSERT_TRUE(contents->Render(*content_context, entity, *render_pass));
71 const auto& cmd = render_pass->GetCommands()[0];
72 auto* frag_uniforms = GetFragInfo<FS>(cmd);
74 ASSERT_EQ(frag_uniforms->alpha, 0.5);