5 #include "flutter/testing/testing.h"
6 #include "gtest/gtest.h"
11 #include "impeller/renderer/backend/vulkan/test/mock_vulkan.h"
13 #include "vulkan/vulkan_enums.hpp"
19 std::shared_ptr<ContextVK>
context = MockVulkanContextBuilder().Build();
20 std::shared_ptr<Context> copy =
context;
21 auto cmd_buffer =
context->CreateCommandBuffer();
27 cmd_buffer->CreateRenderPass(target);
30 auto called_functions = GetMockVulkanFunctions(
context->GetDevice());
31 EXPECT_EQ(std::count(called_functions->begin(), called_functions->end(),
32 "vkCmdSetStencilReference"),
40 called_functions = GetMockVulkanFunctions(
context->GetDevice());
41 EXPECT_EQ(std::count(called_functions->begin(), called_functions->end(),
42 "vkCmdSetStencilReference"),
47 called_functions = GetMockVulkanFunctions(
context->GetDevice());
48 EXPECT_EQ(std::count(called_functions->begin(), called_functions->end(),
49 "vkCmdSetStencilReference"),
57 std::shared_ptr<ContextVK>
context = MockVulkanContextBuilder().Build();
58 auto cmd_buffer =
context->CreateCommandBuffer();
65 cmd_buffer->CreateRenderPass(target);
70 VkCommandBuffer raw_cmd_buffer =
72 const std::vector<VkViewport>& recorded =
73 GetRecordedViewports(raw_cmd_buffer);
74 ASSERT_EQ(recorded.size(), 1u);
81 ASSERT_EQ(recorded.size(), 2u);
82 const VkViewport& vp = recorded[1];
83 EXPECT_FLOAT_EQ(vp.x, 25.0f);
86 EXPECT_FLOAT_EQ(vp.y, 90.0f);
87 EXPECT_FLOAT_EQ(vp.width, 50.0f);
88 EXPECT_FLOAT_EQ(vp.height, -80.0f);
89 EXPECT_FLOAT_EQ(vp.minDepth, 0.25f);
90 EXPECT_FLOAT_EQ(vp.maxDepth, 0.75f);
static CommandBufferVK & Cast(CommandBuffer &base)
vk::CommandBuffer GetCommandBuffer() const
Retrieve the native command buffer from this object.
a wrapper around the impeller [Allocator] instance that can be used to provide caching of allocated r...
virtual RenderTarget CreateOffscreenMSAA(const Context &context, ISize size, int mip_count, std::string_view label="Offscreen MSAA", RenderTarget::AttachmentConfigMSAA color_attachment_config=RenderTarget::kDefaultColorAttachmentConfigMSAA, std::optional< RenderTarget::AttachmentConfig > stencil_attachment_config=RenderTarget::kDefaultStencilAttachmentConfig, const std::shared_ptr< Texture > &existing_color_msaa_texture=nullptr, const std::shared_ptr< Texture > &existing_color_resolve_texture=nullptr, const std::shared_ptr< Texture > &existing_depth_stencil_texture=nullptr, std::optional< PixelFormat > target_pixel_format=std::nullopt)
TEST(AllocationSizeTest, CanCreateTypedAllocations)
std::shared_ptr< ContextGLES > context
std::shared_ptr< RenderPass > render_pass
constexpr static TRect MakeXYWH(Type x, Type y, Type width, Type height)