Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Functions
DawnBackendTextureTest.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/dawn/DawnTypes.h"
#include "webgpu/webgpu_cpp.h"

Go to the source code of this file.

Functions

 DEF_GRAPHITE_TEST_FOR_DAWN_CONTEXT (DawnBackendTextureSimpleCreationTest, reporter, context, testContext)
 
 DEF_GRAPHITE_TEST_FOR_DAWN_CONTEXT (DawnBackendTextureCopyVariableTest, reporter, context, testContext)
 

Function Documentation

◆ DEF_GRAPHITE_TEST_FOR_DAWN_CONTEXT() [1/2]

DEF_GRAPHITE_TEST_FOR_DAWN_CONTEXT ( DawnBackendTextureCopyVariableTest  ,
reporter  ,
context  ,
testContext   
)

Definition at line 47 of file DawnBackendTextureTest.cpp.

50 {
51 auto recorder = context->makeRecorder();
52
53 DawnTextureInfo textureInfo;
54 textureInfo.fSampleCount = 1;
55 textureInfo.fMipmapped = skgpu::Mipmapped::kNo;
56 textureInfo.fFormat = wgpu::TextureFormat::RGBA8Unorm;
57 textureInfo.fUsage = wgpu::TextureUsage::TextureBinding;
58
59 BackendTexture beTexture = recorder->createBackendTexture(kSize, textureInfo);
60 REPORTER_ASSERT(reporter, beTexture.isValid());
61
62 BackendTexture beTexture2;
63 REPORTER_ASSERT(reporter, beTexture2 != beTexture);
64 REPORTER_ASSERT(reporter, beTexture2.getDawnTexturePtr() == nullptr);
65 REPORTER_ASSERT(reporter, beTexture2.getDawnTextureViewPtr() == nullptr);
66
67 beTexture2 = beTexture;
68 REPORTER_ASSERT(reporter, beTexture2 == beTexture);
69 REPORTER_ASSERT(reporter, beTexture2.getDawnTexturePtr() != nullptr);
70 REPORTER_ASSERT(reporter, beTexture2.getDawnTexturePtr() == beTexture.getDawnTexturePtr());
71
72 recorder->deleteBackendTexture(beTexture);
73}
reporter
#define REPORTER_ASSERT(r, cond,...)
Definition Test.h:286
static constexpr int kSize
wgpu::TextureFormat fFormat
Definition DawnTypes.h:21
wgpu::TextureUsage fUsage
Definition DawnTypes.h:24

◆ DEF_GRAPHITE_TEST_FOR_DAWN_CONTEXT() [2/2]

DEF_GRAPHITE_TEST_FOR_DAWN_CONTEXT ( DawnBackendTextureSimpleCreationTest  ,
reporter  ,
context  ,
testContext   
)

Definition at line 23 of file DawnBackendTextureTest.cpp.

26 {
27 auto recorder = context->makeRecorder();
28
29 DawnTextureInfo textureInfo;
30 textureInfo.fSampleCount = 1;
31 textureInfo.fMipmapped = skgpu::Mipmapped::kNo;
32 textureInfo.fFormat = wgpu::TextureFormat::RGBA8Unorm;
33 textureInfo.fUsage = wgpu::TextureUsage::TextureBinding;
34
35 auto beTexture = recorder->createBackendTexture(kSize, textureInfo);
36 REPORTER_ASSERT(reporter, beTexture.isValid());
37 recorder->deleteBackendTexture(beTexture);
38
39 // It should also pass if we set the usage to be a render target
40 textureInfo.fUsage |= wgpu::TextureUsage::RenderAttachment;
41 beTexture = recorder->createBackendTexture(kSize, textureInfo);
42 REPORTER_ASSERT(reporter, beTexture.isValid());
43 recorder->deleteBackendTexture(beTexture);
44}