Flutter Engine
The Flutter Engine
Functions
VulkanBackendTextureTest.cpp File Reference
#include "tests/Test.h"
#include "include/gpu/graphite/BackendTexture.h"
#include "include/gpu/graphite/Context.h"
#include "include/gpu/graphite/Recorder.h"
#include "include/gpu/graphite/vk/VulkanGraphiteTypes.h"
#include "src/gpu/graphite/Caps.h"
#include "src/gpu/graphite/ContextPriv.h"

Go to the source code of this file.

Functions

 DEF_GRAPHITE_TEST_FOR_VULKAN_CONTEXT (VulkanBackendTextureSimpleCreationTest, reporter, context, CtsEnforcement::kNextRelease)
 
 DEF_GRAPHITE_TEST_FOR_VULKAN_CONTEXT (VulkanBackendTextureCopyVariableTest, reporter, context, CtsEnforcement::kNextRelease)
 

Function Documentation

◆ DEF_GRAPHITE_TEST_FOR_VULKAN_CONTEXT() [1/2]

DEF_GRAPHITE_TEST_FOR_VULKAN_CONTEXT ( VulkanBackendTextureCopyVariableTest  ,
reporter  ,
context  ,
CtsEnforcement::kNextRelease   
)

Definition at line 50 of file VulkanBackendTextureTest.cpp.

51 {
52 auto recorder = context->makeRecorder();
53
54 bool isProtected = context->priv().caps()->protectedSupport();
55
56 VulkanTextureInfo textureInfo;
57 textureInfo.fSampleCount = 1;
59 textureInfo.fFlags = isProtected ? VK_IMAGE_CREATE_PROTECTED_BIT : 0;
64
65 BackendTexture beTexture = recorder->createBackendTexture(kSize, textureInfo);
66 REPORTER_ASSERT(reporter, beTexture.isValid());
67
68 BackendTexture beTexture2;
69 REPORTER_ASSERT(reporter, beTexture2 != beTexture);
70 REPORTER_ASSERT(reporter, beTexture2.getVkImage() == VK_NULL_HANDLE);
71 REPORTER_ASSERT(reporter, beTexture2.getVkImageLayout() == VK_IMAGE_LAYOUT_UNDEFINED);
72
73 beTexture2 = beTexture;
74 REPORTER_ASSERT(reporter, beTexture2 == beTexture);
75 REPORTER_ASSERT(reporter, beTexture2.getVkImage() == beTexture.getVkImage());
76 REPORTER_ASSERT(reporter, beTexture2.getVkImageLayout() == beTexture.getVkImageLayout());
78 reporter, beTexture2.getVkQueueFamilyIndex() == beTexture.getVkQueueFamilyIndex());
79
80 recorder->deleteBackendTexture(beTexture);
81 // The backend memory of beTexture2 == that of beTexture, so only call delete once.
82}
reporter
Definition: FontMgrTest.cpp:39
#define REPORTER_ASSERT(r, cond,...)
Definition: Test.h:286
constexpr int kSize
@ VK_IMAGE_LAYOUT_UNDEFINED
Definition: vulkan_core.h:1331
@ VK_SHARING_MODE_EXCLUSIVE
Definition: vulkan_core.h:1813
@ VK_IMAGE_CREATE_PROTECTED_BIT
Definition: vulkan_core.h:2320
@ VK_IMAGE_TILING_OPTIMAL
Definition: vulkan_core.h:1767
@ VK_IMAGE_USAGE_SAMPLED_BIT
Definition: vulkan_core.h:2354
#define VK_NULL_HANDLE
Definition: vulkan_core.h:46
@ VK_FORMAT_R8G8B8A8_UNORM
Definition: vulkan_core.h:1496

◆ DEF_GRAPHITE_TEST_FOR_VULKAN_CONTEXT() [2/2]

DEF_GRAPHITE_TEST_FOR_VULKAN_CONTEXT ( VulkanBackendTextureSimpleCreationTest  ,
reporter  ,
context  ,
CtsEnforcement::kNextRelease   
)

Definition at line 23 of file VulkanBackendTextureTest.cpp.

24 {
25 auto recorder = context->makeRecorder();
26
27 bool isProtected = context->priv().caps()->protectedSupport();
28
29 VulkanTextureInfo textureInfo;
30 textureInfo.fSampleCount = 1;
32 textureInfo.fFlags = isProtected ? VK_IMAGE_CREATE_PROTECTED_BIT : 0;
37
38 auto beTexture = recorder->createBackendTexture(kSize, textureInfo);
39 REPORTER_ASSERT(reporter, beTexture.isValid());
40 recorder->deleteBackendTexture(beTexture);
41
42 // It should also pass if we set the usage to be a render target
44 beTexture = recorder->createBackendTexture(kSize, textureInfo);
45 REPORTER_ASSERT(reporter, beTexture.isValid());
46 recorder->deleteBackendTexture(beTexture);
47}
@ VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT
Definition: vulkan_core.h:2356